@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.
@@ -1,234 +0,0 @@
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 e(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=e(i);fetch(i.href,s)}})();var B9=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rk(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var V1={exports:{}},Rh={};var Tv;function mE(){if(Tv)return Rh;Tv=1;var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function e(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:n,type:r,key:l,ref:i!==void 0?i:null,props:s}}return Rh.Fragment=t,Rh.jsx=e,Rh.jsxs=e,Rh}var Nv;function gE(){return Nv||(Nv=1,V1.exports=mE()),V1.exports}var E=gE(),W1={exports:{}},Yn={};var _v;function yE(){if(_v)return Yn;_v=1;var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),e=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($){return $===null||typeof $!="object"?null:($=b&&$[b]||$["@@iterator"],typeof $=="function"?$:null)}var M={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,L={};function R($,N,Q){this.props=$,this.context=N,this.refs=L,this.updater=Q||M}R.prototype.isReactComponent={},R.prototype.setState=function($,N){if(typeof $!="object"&&typeof $!="function"&&$!=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,$,N,"setState")},R.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function B(){}B.prototype=R.prototype;function q($,N,Q){this.props=$,this.context=N,this.refs=L,this.updater=Q||M}var V=q.prototype=new B;V.constructor=q,C(V,R.prototype),V.isPureReactComponent=!0;var gt=Array.isArray;function Mt(){}var kt={H:null,A:null,T:null,S:null},bt=Object.prototype.hasOwnProperty;function it($,N,Q){var tt=Q.ref;return{$$typeof:n,type:$,key:N,ref:tt!==void 0?tt:null,props:Q}}function Lt($,N){return it($.type,N,$.props)}function J($){return typeof $=="object"&&$!==null&&$.$$typeof===n}function ct($){var N={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(Q){return N[Q]})}var G=/\/+/g;function vt($,N){return typeof $=="object"&&$!==null&&$.key!=null?ct(""+$.key):N.toString(36)}function _t($){switch($.status){case"fulfilled":return $.value;case"rejected":throw $.reason;default:switch(typeof $.status=="string"?$.then(Mt,Mt):($.status="pending",$.then(function(N){$.status==="pending"&&($.status="fulfilled",$.value=N)},function(N){$.status==="pending"&&($.status="rejected",$.reason=N)})),$.status){case"fulfilled":return $.value;case"rejected":throw $.reason}}throw $}function ht($,N,Q,tt,pt){var wt=typeof $;(wt==="undefined"||wt==="boolean")&&($=null);var At=!1;if($===null)At=!0;else switch(wt){case"bigint":case"string":case"number":At=!0;break;case"object":switch($.$$typeof){case n:case t:At=!0;break;case p:return At=$._init,ht(At($._payload),N,Q,tt,pt)}}if(At)return pt=pt($),At=tt===""?"."+vt($,0):tt,gt(pt)?(Q="",At!=null&&(Q=At.replace(G,"$&/")+"/"),ht(pt,N,Q,"",function(Jt){return Jt})):pt!=null&&(J(pt)&&(pt=Lt(pt,Q+(pt.key==null||$&&$.key===pt.key?"":(""+pt.key).replace(G,"$&/")+"/")+At)),N.push(pt)),1;At=0;var Ft=tt===""?".":tt+":";if(gt($))for(var Rt=0;Rt<$.length;Rt++)tt=$[Rt],wt=Ft+vt(tt,Rt),At+=ht(tt,N,Q,wt,pt);else if(Rt=y($),typeof Rt=="function")for($=Rt.call($),Rt=0;!(tt=$.next()).done;)tt=tt.value,wt=Ft+vt(tt,Rt++),At+=ht(tt,N,Q,wt,pt);else if(wt==="object"){if(typeof $.then=="function")return ht(_t($),N,Q,tt,pt);throw N=String($),Error("Objects are not valid as a React child (found: "+(N==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":N)+"). If you meant to render a collection of children, use an array instead.")}return At}function Z($,N,Q){if($==null)return $;var tt=[],pt=0;return ht($,tt,"","",function(wt){return N.call(Q,wt,pt++)}),tt}function ut($){if($._status===-1){var N=$._result;N=N(),N.then(function(Q){($._status===0||$._status===-1)&&($._status=1,$._result=Q)},function(Q){($._status===0||$._status===-1)&&($._status=2,$._result=Q)}),$._status===-1&&($._status=0,$._result=N)}if($._status===1)return $._result.default;throw $._result}var It=typeof reportError=="function"?reportError:function($){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var N=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof $=="object"&&$!==null&&typeof $.message=="string"?String($.message):String($),error:$});if(!window.dispatchEvent(N))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",$);return}console.error($)},Zt={map:Z,forEach:function($,N,Q){Z($,function(){N.apply(this,arguments)},Q)},count:function($){var N=0;return Z($,function(){N++}),N},toArray:function($){return Z($,function(N){return N})||[]},only:function($){if(!J($))throw Error("React.Children.only expected to receive a single React element child.");return $}};return Yn.Activity=g,Yn.Children=Zt,Yn.Component=R,Yn.Fragment=e,Yn.Profiler=i,Yn.PureComponent=q,Yn.StrictMode=r,Yn.Suspense=f,Yn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=kt,Yn.__COMPILER_RUNTIME={__proto__:null,c:function($){return kt.H.useMemoCache($)}},Yn.cache=function($){return function(){return $.apply(null,arguments)}},Yn.cacheSignal=function(){return null},Yn.cloneElement=function($,N,Q){if($==null)throw Error("The argument must be a React element, but you passed "+$+".");var tt=C({},$.props),pt=$.key;if(N!=null)for(wt in N.key!==void 0&&(pt=""+N.key),N)!bt.call(N,wt)||wt==="key"||wt==="__self"||wt==="__source"||wt==="ref"&&N.ref===void 0||(tt[wt]=N[wt]);var wt=arguments.length-2;if(wt===1)tt.children=Q;else if(1<wt){for(var At=Array(wt),Ft=0;Ft<wt;Ft++)At[Ft]=arguments[Ft+2];tt.children=At}return it($.type,pt,tt)},Yn.createContext=function($){return $={$$typeof:l,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null},$.Provider=$,$.Consumer={$$typeof:s,_context:$},$},Yn.createElement=function($,N,Q){var tt,pt={},wt=null;if(N!=null)for(tt in N.key!==void 0&&(wt=""+N.key),N)bt.call(N,tt)&&tt!=="key"&&tt!=="__self"&&tt!=="__source"&&(pt[tt]=N[tt]);var At=arguments.length-2;if(At===1)pt.children=Q;else if(1<At){for(var Ft=Array(At),Rt=0;Rt<At;Rt++)Ft[Rt]=arguments[Rt+2];pt.children=Ft}if($&&$.defaultProps)for(tt in At=$.defaultProps,At)pt[tt]===void 0&&(pt[tt]=At[tt]);return it($,wt,pt)},Yn.createRef=function(){return{current:null}},Yn.forwardRef=function($){return{$$typeof:c,render:$}},Yn.isValidElement=J,Yn.lazy=function($){return{$$typeof:p,_payload:{_status:-1,_result:$},_init:ut}},Yn.memo=function($,N){return{$$typeof:d,type:$,compare:N===void 0?null:N}},Yn.startTransition=function($){var N=kt.T,Q={};kt.T=Q;try{var tt=$(),pt=kt.S;pt!==null&&pt(Q,tt),typeof tt=="object"&&tt!==null&&typeof tt.then=="function"&&tt.then(Mt,It)}catch(wt){It(wt)}finally{N!==null&&Q.types!==null&&(N.types=Q.types),kt.T=N}},Yn.unstable_useCacheRefresh=function(){return kt.H.useCacheRefresh()},Yn.use=function($){return kt.H.use($)},Yn.useActionState=function($,N,Q){return kt.H.useActionState($,N,Q)},Yn.useCallback=function($,N){return kt.H.useCallback($,N)},Yn.useContext=function($){return kt.H.useContext($)},Yn.useDebugValue=function(){},Yn.useDeferredValue=function($,N){return kt.H.useDeferredValue($,N)},Yn.useEffect=function($,N){return kt.H.useEffect($,N)},Yn.useEffectEvent=function($){return kt.H.useEffectEvent($)},Yn.useId=function(){return kt.H.useId()},Yn.useImperativeHandle=function($,N,Q){return kt.H.useImperativeHandle($,N,Q)},Yn.useInsertionEffect=function($,N){return kt.H.useInsertionEffect($,N)},Yn.useLayoutEffect=function($,N){return kt.H.useLayoutEffect($,N)},Yn.useMemo=function($,N){return kt.H.useMemo($,N)},Yn.useOptimistic=function($,N){return kt.H.useOptimistic($,N)},Yn.useReducer=function($,N,Q){return kt.H.useReducer($,N,Q)},Yn.useRef=function($){return kt.H.useRef($)},Yn.useState=function($){return kt.H.useState($)},Yn.useSyncExternalStore=function($,N,Q){return kt.H.useSyncExternalStore($,N,Q)},Yn.useTransition=function(){return kt.H.useTransition()},Yn.version="19.2.4",Yn}var Dv;function _p(){return Dv||(Dv=1,W1.exports=yE()),W1.exports}var H=_p();const zc=Rk(H);var X1={exports:{}},Oh={},G1={exports:{}},K1={};var Lv;function bE(){return Lv||(Lv=1,(function(n){function t(ht,Z){var ut=ht.length;ht.push(Z);t:for(;0<ut;){var It=ut-1>>>1,Zt=ht[It];if(0<i(Zt,Z))ht[It]=Z,ht[ut]=Zt,ut=It;else break t}}function e(ht){return ht.length===0?null:ht[0]}function r(ht){if(ht.length===0)return null;var Z=ht[0],ut=ht.pop();if(ut!==Z){ht[0]=ut;t:for(var It=0,Zt=ht.length,$=Zt>>>1;It<$;){var N=2*(It+1)-1,Q=ht[N],tt=N+1,pt=ht[tt];if(0>i(Q,ut))tt<Zt&&0>i(pt,Q)?(ht[It]=pt,ht[tt]=ut,It=tt):(ht[It]=Q,ht[N]=ut,It=N);else if(tt<Zt&&0>i(pt,ut))ht[It]=pt,ht[tt]=ut,It=tt;else break t}}return Z}function i(ht,Z){var ut=ht.sortIndex-Z.sortIndex;return ut!==0?ut:ht.id-Z.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var l=Date,c=l.now();n.unstable_now=function(){return l.now()-c}}var f=[],d=[],p=1,g=null,b=3,y=!1,M=!1,C=!1,L=!1,R=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function V(ht){for(var Z=e(d);Z!==null;){if(Z.callback===null)r(d);else if(Z.startTime<=ht)r(d),Z.sortIndex=Z.expirationTime,t(f,Z);else break;Z=e(d)}}function gt(ht){if(C=!1,V(ht),!M)if(e(f)!==null)M=!0,Mt||(Mt=!0,ct());else{var Z=e(d);Z!==null&&_t(gt,Z.startTime-ht)}}var Mt=!1,kt=-1,bt=5,it=-1;function Lt(){return L?!0:!(n.unstable_now()-it<bt)}function J(){if(L=!1,Mt){var ht=n.unstable_now();it=ht;var Z=!0;try{t:{M=!1,C&&(C=!1,B(kt),kt=-1),y=!0;var ut=b;try{e:{for(V(ht),g=e(f);g!==null&&!(g.expirationTime>ht&&Lt());){var It=g.callback;if(typeof It=="function"){g.callback=null,b=g.priorityLevel;var Zt=It(g.expirationTime<=ht);if(ht=n.unstable_now(),typeof Zt=="function"){g.callback=Zt,V(ht),Z=!0;break e}g===e(f)&&r(f),V(ht)}else r(f);g=e(f)}if(g!==null)Z=!0;else{var $=e(d);$!==null&&_t(gt,$.startTime-ht),Z=!1}}break t}finally{g=null,b=ut,y=!1}Z=void 0}}finally{Z?ct():Mt=!1}}}var ct;if(typeof q=="function")ct=function(){q(J)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,vt=G.port2;G.port1.onmessage=J,ct=function(){vt.postMessage(null)}}else ct=function(){R(J,0)};function _t(ht,Z){kt=R(function(){ht(n.unstable_now())},Z)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(ht){ht.callback=null},n.unstable_forceFrameRate=function(ht){0>ht||125<ht?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):bt=0<ht?Math.floor(1e3/ht):5},n.unstable_getCurrentPriorityLevel=function(){return b},n.unstable_next=function(ht){switch(b){case 1:case 2:case 3:var Z=3;break;default:Z=b}var ut=b;b=Z;try{return ht()}finally{b=ut}},n.unstable_requestPaint=function(){L=!0},n.unstable_runWithPriority=function(ht,Z){switch(ht){case 1:case 2:case 3:case 4:case 5:break;default:ht=3}var ut=b;b=ht;try{return Z()}finally{b=ut}},n.unstable_scheduleCallback=function(ht,Z,ut){var It=n.unstable_now();switch(typeof ut=="object"&&ut!==null?(ut=ut.delay,ut=typeof ut=="number"&&0<ut?It+ut:It):ut=It,ht){case 1:var Zt=-1;break;case 2:Zt=250;break;case 5:Zt=1073741823;break;case 4:Zt=1e4;break;default:Zt=5e3}return Zt=ut+Zt,ht={id:p++,callback:Z,priorityLevel:ht,startTime:ut,expirationTime:Zt,sortIndex:-1},ut>It?(ht.sortIndex=ut,t(d,ht),e(f)===null&&ht===e(d)&&(C?(B(kt),kt=-1):C=!0,_t(gt,ut-It))):(ht.sortIndex=Zt,t(f,ht),M||y||(M=!0,Mt||(Mt=!0,ct()))),ht},n.unstable_shouldYield=Lt,n.unstable_wrapCallback=function(ht){var Z=b;return function(){var ut=b;b=Z;try{return ht.apply(this,arguments)}finally{b=ut}}}})(K1)),K1}var Rv;function xE(){return Rv||(Rv=1,G1.exports=bE()),G1.exports}var J1={exports:{}},Us={};var Ov;function vE(){if(Ov)return Us;Ov=1;var n=_p();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 e(){}var r={d:{f:e,r:function(){throw Error(t(522))},D:e,C:e,L:e,m:e,X:e,S:e,M:e},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=n.__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 Us.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Us.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)},Us.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()}},Us.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))},Us.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},Us.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})}},Us.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)},Us.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})}},Us.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)},Us.requestFormReset=function(f){r.d.r(f)},Us.unstable_batchedUpdates=function(f,d){return f(d)},Us.useFormState=function(f,d,p){return l.H.useFormState(f,d,p)},Us.useFormStatus=function(){return l.H.useHostTransitionStatus()},Us.version="19.2.4",Us}var Pv;function Ok(){if(Pv)return J1.exports;Pv=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),J1.exports=vE(),J1.exports}var Iv;function wE(){if(Iv)return Oh;Iv=1;var n=xE(),t=_p(),e=Ok();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 k=x.alternate;if(k===null){if(h=x.return,h!==null){u=h;continue}break}if(x.child===k.child){for(k=x.child;k;){if(k===u)return f(x),o;if(k===h)return f(x),a;k=k.sibling}throw Error(r(188))}if(u.return!==h.return)u=x,h=k;else{for(var P=!1,et=x.child;et;){if(et===u){P=!0,u=x,h=k;break}if(et===h){P=!0,h=x,u=k;break}et=et.sibling}if(!P){for(et=k.child;et;){if(et===u){P=!0,u=k,h=x;break}if(et===h){P=!0,h=k,u=x;break}et=et.sibling}if(!P)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"),C=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),B=Symbol.for("react.consumer"),q=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),gt=Symbol.for("react.suspense"),Mt=Symbol.for("react.suspense_list"),kt=Symbol.for("react.memo"),bt=Symbol.for("react.lazy"),it=Symbol.for("react.activity"),Lt=Symbol.for("react.memo_cache_sentinel"),J=Symbol.iterator;function ct(o){return o===null||typeof o!="object"?null:(o=J&&o[J]||o["@@iterator"],typeof o=="function"?o:null)}var G=Symbol.for("react.client.reference");function vt(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===G?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case C:return"Fragment";case R:return"Profiler";case L:return"StrictMode";case gt:return"Suspense";case Mt:return"SuspenseList";case it:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case M:return"Portal";case q:return o.displayName||"Context";case B:return(o._context.displayName||"Context")+".Consumer";case V:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case kt:return a=o.displayName||null,a!==null?a:vt(o.type)||"Memo";case bt:a=o._payload,o=o._init;try{return vt(o(a))}catch{}}return null}var _t=Array.isArray,ht=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ut={pending:!1,data:null,method:null,action:null},It=[],Zt=-1;function $(o){return{current:o}}function N(o){0>Zt||(o.current=It[Zt],It[Zt]=null,Zt--)}function Q(o,a){Zt++,It[Zt]=o.current,o.current=a}var tt=$(null),pt=$(null),wt=$(null),At=$(null);function Ft(o,a){switch(Q(wt,a),Q(pt,o),Q(tt,null),a.nodeType){case 9:case 11:o=(o=a.documentElement)&&(o=o.namespaceURI)?Jx(o):0;break;default:if(o=a.tagName,a=a.namespaceURI)a=Jx(a),o=Zx(a,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}N(tt),Q(tt,o)}function Rt(){N(tt),N(pt),N(wt)}function Jt(o){o.memoizedState!==null&&Q(At,o);var a=tt.current,u=Zx(a,o.type);a!==u&&(Q(pt,o),Q(tt,u))}function ke(o){pt.current===o&&(N(tt),N(pt)),At.current===o&&(N(At),Nh._currentValue=ut)}var Re,Ie;function Ve(o){if(Re===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);Re=a&&a[1]||"",Ie=-1<u.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+Re+o+Ie}var rt=!1;function Oe(o,a){if(!o||rt)return"";rt=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(ee){var Kt=ee}Reflect.construct(o,[],me)}else{try{me.call()}catch(ee){Kt=ee}o.call(me.prototype)}}else{try{throw Error()}catch(ee){Kt=ee}(me=o())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(ee){if(ee&&Kt&&typeof ee.stack=="string")return[ee.stack,Kt.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 k=h.DetermineComponentFrameRoot(),P=k[0],et=k[1];if(P&&et){var Tt=P.split(`
4
- `),Gt=et.split(`
5
- `);for(x=h=0;h<Tt.length&&!Tt[h].includes("DetermineComponentFrameRoot");)h++;for(;x<Gt.length&&!Gt[x].includes("DetermineComponentFrameRoot");)x++;if(h===Tt.length||x===Gt.length)for(h=Tt.length-1,x=Gt.length-1;1<=h&&0<=x&&Tt[h]!==Gt[x];)x--;for(;1<=h&&0<=x;h--,x--)if(Tt[h]!==Gt[x]){if(h!==1||x!==1)do if(h--,x--,0>x||Tt[h]!==Gt[x]){var le=`
6
- `+Tt[h].replace(" at new "," at ");return o.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",o.displayName)),le}while(1<=h&&0<=x);break}}}finally{rt=!1,Error.prepareStackTrace=u}return(u=o?o.displayName||o.name:"")?Ve(u):""}function Cn(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 cn(o){try{var a="",u=null;do a+=Cn(o,u),u=o,o=o.return;while(o);return a}catch(h){return`
7
- Error generating stack: `+h.message+`
8
- `+h.stack}}var xe=Object.prototype.hasOwnProperty,we=n.unstable_scheduleCallback,Ne=n.unstable_cancelCallback,De=n.unstable_shouldYield,Fe=n.unstable_requestPaint,tn=n.unstable_now,Pn=n.unstable_getCurrentPriorityLevel,mn=n.unstable_ImmediatePriority,In=n.unstable_UserBlockingPriority,hn=n.unstable_NormalPriority,Ue=n.unstable_LowPriority,$e=n.unstable_IdlePriority,je=n.log,nr=n.unstable_setDisableYieldValue,bn=null,an=null;function ln(o){if(typeof je=="function"&&nr(o),an&&typeof an.setStrictMode=="function")try{an.setStrictMode(bn,o)}catch{}}var Bn=Math.clz32?Math.clz32:gn,Xe=Math.log,Mr=Math.LN2;function gn(o){return o>>>=0,o===0?32:31-(Xe(o)/Mr|0)|0}var yn=256,Qt=262144,ye=4194304;function Ce(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 ve(o,a,u){var h=o.pendingLanes;if(h===0)return 0;var x=0,k=o.suspendedLanes,P=o.pingedLanes;o=o.warmLanes;var et=h&134217727;return et!==0?(h=et&~k,h!==0?x=Ce(h):(P&=et,P!==0?x=Ce(P):u||(u=et&~o,u!==0&&(x=Ce(u))))):(et=h&~k,et!==0?x=Ce(et):P!==0?x=Ce(P):u||(u=h&~o,u!==0&&(x=Ce(u)))),x===0?0:a!==0&&a!==x&&(a&k)===0&&(k=x&-x,u=a&-a,k>=u||k===32&&(u&4194048)!==0)?a:x}function Zn(o,a){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&a)===0}function $n(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 xr(){var o=ye;return ye<<=1,(ye&62914560)===0&&(ye=4194304),o}function Bo(o){for(var a=[],u=0;31>u;u++)a.push(o);return a}function Ze(o,a){o.pendingLanes|=a,a!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function ts(o,a,u,h,x,k){var P=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,Tt=o.expirationTimes,Gt=o.hiddenUpdates;for(u=P&~u;0<u;){var le=31-Bn(u),me=1<<le;et[le]=0,Tt[le]=-1;var Kt=Gt[le];if(Kt!==null)for(Gt[le]=null,le=0;le<Kt.length;le++){var ee=Kt[le];ee!==null&&(ee.lane&=-536870913)}u&=~me}h!==0&&Yt(o,h,0),k!==0&&x===0&&o.tag!==0&&(o.suspendedLanes|=k&~(P&~a))}function Yt(o,a,u){o.pendingLanes|=a,o.suspendedLanes&=~a;var h=31-Bn(a);o.entangledLanes|=a,o.entanglements[h]=o.entanglements[h]|1073741824|u&261930}function Ur(o,a){var u=o.entangledLanes|=a;for(o=o.entanglements;u;){var h=31-Bn(u),x=1<<h;x&a|o[h]&a&&(o[h]|=a),u&=~x}}function Ni(o,a){var u=a&-a;return u=(u&42)!==0?1:Tn(u),(u&(o.suspendedLanes|a))!==0?0:u}function Tn(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 fi(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function _i(){var o=Z.p;return o!==0?o:(o=window.event,o===void 0?32:wv(o.type))}function ha(o,a){var u=Z.p;try{return Z.p=o,a()}finally{Z.p=u}}var go=Math.random().toString(36).slice(2),pr="__reactFiber$"+go,Cr="__reactProps$"+go,no="__reactContainer$"+go,Hr="__reactEvents$"+go,sr="__reactListeners$"+go,Fl="__reactHandles$"+go,Ks="__reactResources$"+go,es="__reactMarker$"+go;function pa(o){delete o[pr],delete o[Cr],delete o[Hr],delete o[sr],delete o[Fl]}function No(o){var a=o[pr];if(a)return a;for(var u=o.parentNode;u;){if(a=u[no]||u[pr]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(o=ov(o);o!==null;){if(u=o[pr])return u;o=ov(o)}return a}o=u,u=o.parentNode}return null}function ma(o){if(o=o[pr]||o[no]){var a=o.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return o}return null}function pc(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o.stateNode;throw Error(r(33))}function Js(o){var a=o[Ks];return a||(a=o[Ks]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function di(o){o[es]=!0}var sl=new Set,Fo={};function Uo(o,a){_o(o,a),_o(o+"Capture",a)}function _o(o,a){for(Fo[o]=a,o=0;o<a.length;o++)sl.add(a[o])}var Do=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]*$"),al={},Ul={};function Uc(o){return xe.call(Ul,o)?!0:xe.call(al,o)?!1:Do.test(o)?Ul[o]=!0:(al[o]=!0,!1)}function ns(o,a,u){if(Uc(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 ga(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 Lo(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 Fn(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Ho(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function vi(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,k=h.set;return Object.defineProperty(o,a,{configurable:!0,get:function(){return x.call(this)},set:function(P){u=""+P,k.call(this,P)}}),Object.defineProperty(o,a,{enumerable:h.enumerable}),{getValue:function(){return u},setValue:function(P){u=""+P},stopTracking:function(){o._valueTracker=null,delete o[a]}}}}function ro(o){if(!o._valueTracker){var a=Ho(o)?"checked":"value";o._valueTracker=vi(o,a,""+o[a])}}function _r(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var u=a.getValue(),h="";return o&&(h=Ho(o)?o.checked?"true":"false":o.value),o=h,o!==u?(a.setValue(o),!0):!1}function hi(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 Ui=/[\n"\\]/g;function vr(o){return o.replace(Ui,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Rn(o,a,u,h,x,k,P,et){o.name="",P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?o.type=P:o.removeAttribute("type"),a!=null?P==="number"?(a===0&&o.value===""||o.value!=a)&&(o.value=""+Fn(a)):o.value!==""+Fn(a)&&(o.value=""+Fn(a)):P!=="submit"&&P!=="reset"||o.removeAttribute("value"),a!=null?ll(o,P,Fn(a)):u!=null?ll(o,P,Fn(u)):h!=null&&o.removeAttribute("value"),x==null&&k!=null&&(o.defaultChecked=!!k),x!=null&&(o.checked=x&&typeof x!="function"&&typeof x!="symbol"),et!=null&&typeof et!="function"&&typeof et!="symbol"&&typeof et!="boolean"?o.name=""+Fn(et):o.removeAttribute("name")}function ya(o,a,u,h,x,k,P,et){if(k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(o.type=k),a!=null||u!=null){if(!(k!=="submit"&&k!=="reset"||a!=null)){ro(o);return}u=u!=null?""+Fn(u):"",a=a!=null?""+Fn(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,P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"&&(o.name=P),ro(o)}function ll(o,a,u){a==="number"&&hi(o.ownerDocument)===o||o.defaultValue===""+u||(o.defaultValue=""+u)}function qo(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=""+Fn(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 te(o,a,u){if(a!=null&&(a=""+Fn(a),a!==o.value&&(o.value=a),u==null)){o.defaultValue!==a&&(o.defaultValue=a);return}o.defaultValue=u!=null?""+Fn(u):""}function Zs(o,a,u,h){if(a==null){if(h!=null){if(u!=null)throw Error(r(92));if(_t(h)){if(1<h.length)throw Error(r(93));h=h[0]}u=h}u==null&&(u=""),a=u}u=Fn(a),o.defaultValue=u,h=o.textContent,h===u&&h!==""&&h!==null&&(o.value=h),ro(o)}function $o(o,a){if(a){var u=o.firstChild;if(u&&u===o.lastChild&&u.nodeType===3){u.nodeValue=a;return}}o.textContent=a}var mc=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 Ts(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||mc.has(a)?a==="float"?o.cssFloat=u:o[a]=(""+u).trim():o[a]=u+"px"}function Hl(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&&Ts(o,x,h)}else for(var k in a)a.hasOwnProperty(k)&&Ts(o,k,a[k])}function Hc(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 Af=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"]]),Nu=/^[\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 Ns(o){return Nu.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Ro(){}var rs=null;function ql(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Oo=null,pn=null;function qc(o){var a=ma(o);if(a&&(o=a.stateNode)){var u=o[Cr]||null;t:switch(o=a.stateNode,a.type){case"input":if(Rn(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="'+vr(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var h=u[a];if(h!==o&&h.form===o.form){var x=h[Cr]||null;if(!x)throw Error(r(90));Rn(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&&_r(h)}break t;case"textarea":te(o,u.value,u.defaultValue);break t;case"select":a=u.value,a!=null&&qo(o,!!u.multiple,a,!1)}}}var gc=!1;function yc(o,a,u){if(gc)return o(a,u);gc=!0;try{var h=o(a);return h}finally{if(gc=!1,(Oo!==null||pn!==null)&&(Jp(),Oo&&(a=Oo,o=pn,pn=Oo=null,qc(a),o)))for(a=0;a<o.length;a++)qc(o[a])}}function mr(o,a){var u=o.stateNode;if(u===null)return null;var h=u[Cr]||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 is=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yo=!1;if(is)try{var yo={};Object.defineProperty(yo,"passive",{get:function(){Yo=!0}}),window.addEventListener("test",yo,yo),window.removeEventListener("test",yo,yo)}catch{Yo=!1}var ss=null,ba=null,Vo=null;function za(){if(Vo)return Vo;var o,a=ba,u=a.length,h,x="value"in ss?ss.value:ss.textContent,k=x.length;for(o=0;o<u&&a[o]===x[o];o++);var P=u-o;for(h=1;h<=P&&a[u-h]===x[k-h];h++);return Vo=x.slice(o,1<h?1-h:void 0)}function bo(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 Ba(){return!0}function Qs(){return!1}function Hi(o){function a(u,h,x,k,P){this._reactName=u,this._targetInst=x,this.type=h,this.nativeEvent=k,this.target=P,this.currentTarget=null;for(var et in o)o.hasOwnProperty(et)&&(u=o[et],this[et]=u?u(k):k[et]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?Ba:Qs,this.isPropagationStopped=Qs,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=Ba)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Ba)},persist:function(){},isPersistent:Ba}),a}var Po={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},as=Hi(Po),_s=g({},Po,{view:0,detail:0}),ta=Hi(_s),xa,ea,Ds,Ls=g({},_s,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ge,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!==Ds&&(Ds&&o.type==="mousemove"?(xa=o.screenX-Ds.screenX,ea=o.screenY-Ds.screenY):ea=xa=0,Ds=o),xa)},movementY:function(o){return"movementY"in o?o.movementY:ea}}),cl=Hi(Ls),Rs=g({},Ls,{dataTransfer:0}),Os=Hi(Rs),$l=g({},_s,{relatedTarget:0}),va=Hi($l),Yl=g({},Po,{animationName:0,elapsedTime:0,pseudoElement:0}),wa=Hi(Yl),Vl=g({},Po,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),A=Hi(Vl),F=g({},Po,{data:0}),dt=Hi(F),Nt={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Bt={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"},ie={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ge(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=ie[o])?!!a[o]:!1}function Ge(){return ge}var rn=g({},_s,{key:function(o){if(o.key){var a=Nt[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=bo(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?Bt[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ge,charCode:function(o){return o.type==="keypress"?bo(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?bo(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),jn=Hi(rn),On=g({},Ls,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),cr=Hi(On),Di=g({},_s,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ge}),pi=Hi(Di),Er=g({},Po,{propertyName:0,elapsedTime:0,pseudoElement:0}),Li=Hi(Er),ce=g({},Ls,{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}),ei=Hi(ce),Ri=g({},Po,{newState:0,oldState:0}),Sn=Hi(Ri),Dn=[9,13,27,32],Fa=is&&"CompositionEvent"in window,ls=null;is&&"documentMode"in document&&(ls=document.documentMode);var ul=is&&"TextEvent"in window&&!ls,wr=is&&(!Fa||ls&&8<ls&&11>=ls),Ps=" ",Wl=!1;function Oi(o,a){switch(o){case"keyup":return Dn.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fl(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Wo=!1;function bc(o,a){switch(o){case"compositionend":return fl(a);case"keypress":return a.which!==32?null:(Wl=!0,Ps);case"textInput":return o=a.data,o===Ps&&Wl?null:o;default:return null}}function cs(o,a){if(Wo)return o==="compositionend"||!Fa&&Oi(o,a)?(o=za(),Vo=ba=ss=null,Wo=!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 wr&&a.locale!=="ko"?null:a.data;default:return null}}var xo={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 xc(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!xo[o.type]:a==="textarea"}function dl(o,a,u,h){Oo?pn?pn.push(h):pn=[h]:Oo=h,a=im(a,"onChange"),0<a.length&&(u=new as("onChange","change",null,u,h),o.push({event:u,listeners:a}))}var Ua=null,io=null;function hl(o){Yx(o,0)}function na(o){var a=pc(o);if(_r(a))return o}function us(o,a){if(o==="change")return a}var Ha=!1;if(is){var qa;if(is){var Vi="oninput"in document;if(!Vi){var ni=document.createElement("div");ni.setAttribute("oninput","return;"),Vi=typeof ni.oninput=="function"}qa=Vi}else qa=!1;Ha=qa&&(!document.documentMode||9<document.documentMode)}function qi(){Ua&&(Ua.detachEvent("onpropertychange",Is),io=Ua=null)}function Is(o){if(o.propertyName==="value"&&na(io)){var a=[];dl(a,io,o,ql(o)),yc(hl,a)}}function vo(o,a,u){o==="focusin"?(qi(),Ua=a,io=u,Ua.attachEvent("onpropertychange",Is)):o==="focusout"&&qi()}function pl(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return na(io)}function ml(o,a){if(o==="click")return na(a)}function mi(o,a){if(o==="input"||o==="change")return na(a)}function Me(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var ur=typeof Object.is=="function"?Object.is:Me;function wo(o,a){if(ur(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(!xe.call(a,x)||!ur(o[x],a[x]))return!1}return!0}function Sa(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function vc(o,a){var u=Sa(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=Sa(u)}}function gl(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?gl(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function Xl(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var a=hi(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=hi(o.document)}return a}function ka(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 Gl=is&&"documentMode"in document&&11>=document.documentMode,fs=null,js=null,ds=null,yl=!1;function Wi(o,a,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;yl||fs==null||fs!==hi(h)||(h=fs,"selectionStart"in h&&ka(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}),ds&&wo(ds,h)||(ds=h,h=im(js,"onSelect"),0<h.length&&(a=new as("onSelect","select",null,a,u),o.push({event:a,listeners:h}),a.target=fs)))}function wi(o,a){var u={};return u[o.toLowerCase()]=a.toLowerCase(),u["Webkit"+o]="webkit"+a,u["Moz"+o]="moz"+a,u}var ar={animationend:wi("Animation","AnimationEnd"),animationiteration:wi("Animation","AnimationIteration"),animationstart:wi("Animation","AnimationStart"),transitionrun:wi("Transition","TransitionRun"),transitionstart:wi("Transition","TransitionStart"),transitioncancel:wi("Transition","TransitionCancel"),transitionend:wi("Transition","TransitionEnd")},Dr={},ri={};is&&(ri=document.createElement("div").style,"AnimationEvent"in window||(delete ar.animationend.animation,delete ar.animationiteration.animation,delete ar.animationstart.animation),"TransitionEvent"in window||delete ar.transitionend.transition);function qr(o){if(Dr[o])return Dr[o];if(!ar[o])return o;var a=ar[o],u;for(u in a)if(a.hasOwnProperty(u)&&u in ri)return Dr[o]=a[u];return o}var Aa=qr("animationend"),Kl=qr("animationiteration"),bl=qr("animationstart"),Jl=qr("transitionrun"),Mf=qr("transitionstart"),Cf=qr("transitioncancel"),_u=qr("transitionend"),Du=new Map,Zl="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(" ");Zl.push("scrollEnd");function hs(o,a){Du.set(o,a),Uo(a,[o])}var $c=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)},Xo=[],xl=0,Yc=0;function wc(){for(var o=xl,a=Yc=xl=0;a<o;){var u=Xo[a];Xo[a++]=null;var h=Xo[a];Xo[a++]=null;var x=Xo[a];Xo[a++]=null;var k=Xo[a];if(Xo[a++]=null,h!==null&&x!==null){var P=h.pending;P===null?x.next=x:(x.next=P.next,P.next=x),h.pending=x}k!==0&&kc(u,x,k)}}function Sc(o,a,u,h){Xo[xl++]=o,Xo[xl++]=a,Xo[xl++]=u,Xo[xl++]=h,Yc|=h,o.lanes|=h,o=o.alternate,o!==null&&(o.lanes|=h)}function Vc(o,a,u,h){return Sc(o,a,u,h),oo(o)}function Ma(o,a){return Sc(o,null,null,a),oo(o)}function kc(o,a,u){o.lanes|=u;var h=o.alternate;h!==null&&(h.lanes|=u);for(var x=!1,k=o.return;k!==null;)k.childLanes|=u,h=k.alternate,h!==null&&(h.childLanes|=u),k.tag===22&&(o=k.stateNode,o===null||o._visibility&1||(x=!0)),o=k,k=k.return;return o.tag===3?(k=o.stateNode,x&&a!==null&&(x=31-Bn(u),o=k.hiddenUpdates,h=o[x],h===null?o[x]=[a]:h.push(a),a.lane=u|536870912),k):null}function oo(o){if(50<Sh)throw Sh=0,g1=null,Error(r(185));for(var a=o.return;a!==null;)o=a,a=o.return;return o.tag===3?o.stateNode:null}var Xi={};function Wc(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 so(o,a,u,h){return new Wc(o,a,u,h)}function Xc(o){return o=o.prototype,!(!o||!o.isReactComponent)}function ps(o,a){var u=o.alternate;return u===null?(u=so(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 Gc(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 Ql(o,a,u,h,x,k){var P=0;if(h=o,typeof o=="function")Xc(o)&&(P=1);else if(typeof o=="string")P=rE(o,u,tt.current)?26:o==="html"||o==="head"||o==="body"?27:5;else t:switch(o){case it:return o=so(31,u,a,x),o.elementType=it,o.lanes=k,o;case C:return $a(u.children,x,k,a);case L:P=8,x|=24;break;case R:return o=so(12,u,a,x|2),o.elementType=R,o.lanes=k,o;case gt:return o=so(13,u,a,x),o.elementType=gt,o.lanes=k,o;case Mt:return o=so(19,u,a,x),o.elementType=Mt,o.lanes=k,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case q:P=10;break t;case B:P=9;break t;case V:P=11;break t;case kt:P=14;break t;case bt:P=16,h=null;break t}P=29,u=Error(r(130,o===null?"null":typeof o,"")),h=null}return a=so(P,u,a,x),a.elementType=o,a.type=h,a.lanes=k,a}function $a(o,a,u,h){return o=so(7,o,h,a),o.lanes=u,o}function Ac(o,a,u){return o=so(6,o,null,a),o.lanes=u,o}function Ya(o){var a=so(18,null,null,0);return a.stateNode=o,a}function tc(o,a,u){return a=so(4,o.children!==null?o.children:[],o.key,a),a.lanes=u,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}var Kc=new WeakMap;function ms(o,a){if(typeof o=="object"&&o!==null){var u=Kc.get(o);return u!==void 0?u:(a={value:o,source:a,stack:cn(a)},Kc.set(o,a),a)}return{value:o,source:a,stack:cn(a)}}var ec=[],vl=0,wl=null,Mc=0,ao=[],gs=0,Va=null,ys=1,bs="";function Go(o,a){ec[vl++]=Mc,ec[vl++]=wl,wl=o,Mc=a}function Ef(o,a,u){ao[gs++]=ys,ao[gs++]=bs,ao[gs++]=Va,Va=o;var h=ys;o=bs;var x=32-Bn(h)-1;h&=~(1<<x),u+=1;var k=32-Bn(a)+x;if(30<k){var P=x-x%5;k=(h&(1<<P)-1).toString(32),h>>=P,x-=P,ys=1<<32-Bn(a)+x|u<<x|h,bs=k+o}else ys=1<<k|u<<x|h,bs=o}function Lu(o){o.return!==null&&(Go(o,1),Ef(o,1,0))}function zs(o){for(;o===wl;)wl=ec[--vl],ec[vl]=null,Mc=ec[--vl],ec[vl]=null;for(;o===Va;)Va=ao[--gs],ao[gs]=null,bs=ao[--gs],ao[gs]=null,ys=ao[--gs],ao[gs]=null}function Jc(o,a){ao[gs++]=ys,ao[gs++]=bs,ao[gs++]=Va,ys=a.id,bs=a.overflow,Va=o}var $r=null,Lr=null,rr=!1,Io=null,ii=!1,ra=Error(r(519));function Sl(o){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw kl(ms(a,o)),ra}function Ru(o){var a=o.stateNode,u=o.type,h=o.memoizedProps;switch(a[pr]=o,a[Cr]=h,u){case"dialog":dr("cancel",a),dr("close",a);break;case"iframe":case"object":case"embed":dr("load",a);break;case"video":case"audio":for(u=0;u<Ah.length;u++)dr(Ah[u],a);break;case"source":dr("error",a);break;case"img":case"image":case"link":dr("error",a),dr("load",a);break;case"details":dr("toggle",a);break;case"input":dr("invalid",a),ya(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":dr("invalid",a);break;case"textarea":dr("invalid",a),Zs(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||Gx(a.textContent,u)?(h.popover!=null&&(dr("beforetoggle",a),dr("toggle",a)),h.onScroll!=null&&dr("scroll",a),h.onScrollEnd!=null&&dr("scrollend",a),h.onClick!=null&&(a.onclick=Ro),a=!0):a=!1,a||Sl(o,!0)}function Wa(o){for($r=o.return;$r;)switch($r.tag){case 5:case 31:case 13:ii=!1;return;case 27:case 3:ii=!0;return;default:$r=$r.return}}function Pi(o){if(o!==$r)return!1;if(!rr)return Wa(o),rr=!0,!1;var a=o.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=o.type,u=!(u!=="form"&&u!=="button")||D1(o.type,o.memoizedProps)),u=!u),u&&Lr&&Sl(o),Wa(o),a===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Lr=iv(o)}else if(a===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Lr=iv(o)}else a===27?(a=Lr,Hu(o.type)?(o=I1,I1=null,Lr=o):Lr=a):Lr=$r?Tl(o.stateNode.nextSibling):null;return!0}function Bs(){Lr=$r=null,rr=!1}function Zc(){var o=Io;return o!==null&&(_a===null?_a=o:_a.push.apply(_a,o),Io=null),o}function kl(o){Io===null?Io=[o]:Io.push(o)}var Al=$(null),Xa=null,ia=null;function Ca(o,a,u){Q(Al,a._currentValue),a._currentValue=u}function xs(o){o._currentValue=Al.current,N(Al)}function Cc(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 vs(o,a,u,h){var x=o.child;for(x!==null&&(x.return=o);x!==null;){var k=x.dependencies;if(k!==null){var P=x.child;k=k.firstContext;t:for(;k!==null;){var et=k;k=x;for(var Tt=0;Tt<a.length;Tt++)if(et.context===a[Tt]){k.lanes|=u,et=k.alternate,et!==null&&(et.lanes|=u),Cc(k.return,u,o),h||(P=null);break t}k=et.next}}else if(x.tag===18){if(P=x.return,P===null)throw Error(r(341));P.lanes|=u,k=P.alternate,k!==null&&(k.lanes|=u),Cc(P,u,o),P=null}else P=x.child;if(P!==null)P.return=x;else for(P=x;P!==null;){if(P===o){P=null;break}if(x=P.sibling,x!==null){x.return=P.return,P=x;break}P=P.return}x=P}}function Ml(o,a,u,h){o=null;for(var x=a,k=!1;x!==null;){if(!k){if((x.flags&524288)!==0)k=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var P=x.alternate;if(P===null)throw Error(r(387));if(P=P.memoizedProps,P!==null){var et=x.type;ur(x.pendingProps.value,P.value)||(o!==null?o.push(et):o=[et])}}else if(x===At.current){if(P=x.alternate,P===null)throw Error(r(387));P.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(o!==null?o.push(Nh):o=[Nh])}x=x.return}o!==null&&vs(a,o,u,h),a.flags|=262144}function Ec(o){for(o=o.firstContext;o!==null;){if(!ur(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function $i(o){Xa=o,ia=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function Yi(o){return md(Xa,o)}function Qc(o,a){return Xa===null&&$i(o),md(o,a)}function md(o,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},ia===null){if(o===null)throw Error(r(308));ia=a,o.dependencies={lanes:0,firstContext:a},o.flags|=524288}else ia=ia.next=a;return u}var Ou=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()})}},Tf=n.unstable_scheduleCallback,Nf=n.unstable_NormalPriority,Si={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function oa(){return{controller:new Ou,data:new Map,refCount:0}}function Tc(o){o.refCount--,o.refCount===0&&Tf(Nf,function(){o.controller.abort()})}var Cl=null,El=0,m=0,v=null;function T(o,a){if(Cl===null){var u=Cl=[];El=0,m=S1(),v={status:"pending",value:void 0,then:function(h){u.push(h)}}}return El++,a.then(O,O),a}function O(){if(--El===0&&Cl!==null){v!==null&&(v.status="fulfilled");var o=Cl;Cl=null,m=0,v=null;for(var a=0;a<o.length;a++)(0,o[a])()}}function U(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 W=ht.S;ht.S=function(o,a){xx=tn(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&T(o,a),W!==null&&W(o,a)};var X=$(null);function ot(){var o=X.current;return o!==null?o:ai.pooledCache}function at(o,a){a===null?Q(X,X.current):Q(X,a.pool)}function yt(){var o=ot();return o===null?null:{parent:Si._currentValue,pool:o}}var Et=Error(r(460)),Vt=Error(r(474)),mt=Error(r(542)),Pt={then:function(){}};function Ht(o){return o=o.status,o==="fulfilled"||o==="rejected"}function oe(o,a,u){switch(u=o[u],u===void 0?o.push(a):u!==a&&(a.then(Ro,Ro),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,Se(o),o;default:if(typeof a.status=="string")a.then(Ro,Ro);else{if(o=ai,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,Se(o),o}throw ne=a,Et}}function $t(o){try{var a=o._init;return a(o._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(ne=u,Et):u}}var ne=null;function se(){if(ne===null)throw Error(r(459));var o=ne;return ne=null,o}function Se(o){if(o===Et||o===mt)throw Error(r(483))}var he=null,en=0;function Ye(o){var a=en;return en+=1,he===null&&(he=[]),oe(he,o,a)}function Nn(o,a){a=a.props.ref,o.ref=a!==void 0?a:null}function Ke(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 Xn(o){function a(Ut,Ot){if(o){var Xt=Ut.deletions;Xt===null?(Ut.deletions=[Ot],Ut.flags|=16):Xt.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=ps(Ut,Ot),Ut.index=0,Ut.sibling=null,Ut}function k(Ut,Ot,Xt){return Ut.index=Xt,o?(Xt=Ut.alternate,Xt!==null?(Xt=Xt.index,Xt<Ot?(Ut.flags|=67108866,Ot):Xt):(Ut.flags|=67108866,Ot)):(Ut.flags|=1048576,Ot)}function P(Ut){return o&&Ut.alternate===null&&(Ut.flags|=67108866),Ut}function et(Ut,Ot,Xt,ue){return Ot===null||Ot.tag!==6?(Ot=Ac(Xt,Ut.mode,ue),Ot.return=Ut,Ot):(Ot=x(Ot,Xt),Ot.return=Ut,Ot)}function Tt(Ut,Ot,Xt,ue){var wn=Xt.type;return wn===C?le(Ut,Ot,Xt.props.children,ue,Xt.key):Ot!==null&&(Ot.elementType===wn||typeof wn=="object"&&wn!==null&&wn.$$typeof===bt&&$t(wn)===Ot.type)?(Ot=x(Ot,Xt.props),Nn(Ot,Xt),Ot.return=Ut,Ot):(Ot=Ql(Xt.type,Xt.key,Xt.props,null,Ut.mode,ue),Nn(Ot,Xt),Ot.return=Ut,Ot)}function Gt(Ut,Ot,Xt,ue){return Ot===null||Ot.tag!==4||Ot.stateNode.containerInfo!==Xt.containerInfo||Ot.stateNode.implementation!==Xt.implementation?(Ot=tc(Xt,Ut.mode,ue),Ot.return=Ut,Ot):(Ot=x(Ot,Xt.children||[]),Ot.return=Ut,Ot)}function le(Ut,Ot,Xt,ue,wn){return Ot===null||Ot.tag!==7?(Ot=$a(Xt,Ut.mode,ue,wn),Ot.return=Ut,Ot):(Ot=x(Ot,Xt),Ot.return=Ut,Ot)}function me(Ut,Ot,Xt){if(typeof Ot=="string"&&Ot!==""||typeof Ot=="number"||typeof Ot=="bigint")return Ot=Ac(""+Ot,Ut.mode,Xt),Ot.return=Ut,Ot;if(typeof Ot=="object"&&Ot!==null){switch(Ot.$$typeof){case y:return Xt=Ql(Ot.type,Ot.key,Ot.props,null,Ut.mode,Xt),Nn(Xt,Ot),Xt.return=Ut,Xt;case M:return Ot=tc(Ot,Ut.mode,Xt),Ot.return=Ut,Ot;case bt:return Ot=$t(Ot),me(Ut,Ot,Xt)}if(_t(Ot)||ct(Ot))return Ot=$a(Ot,Ut.mode,Xt,null),Ot.return=Ut,Ot;if(typeof Ot.then=="function")return me(Ut,Ye(Ot),Xt);if(Ot.$$typeof===q)return me(Ut,Qc(Ut,Ot),Xt);Ke(Ut,Ot)}return null}function Kt(Ut,Ot,Xt,ue){var wn=Ot!==null?Ot.key:null;if(typeof Xt=="string"&&Xt!==""||typeof Xt=="number"||typeof Xt=="bigint")return wn!==null?null:et(Ut,Ot,""+Xt,ue);if(typeof Xt=="object"&&Xt!==null){switch(Xt.$$typeof){case y:return Xt.key===wn?Tt(Ut,Ot,Xt,ue):null;case M:return Xt.key===wn?Gt(Ut,Ot,Xt,ue):null;case bt:return Xt=$t(Xt),Kt(Ut,Ot,Xt,ue)}if(_t(Xt)||ct(Xt))return wn!==null?null:le(Ut,Ot,Xt,ue,null);if(typeof Xt.then=="function")return Kt(Ut,Ot,Ye(Xt),ue);if(Xt.$$typeof===q)return Kt(Ut,Ot,Qc(Ut,Xt),ue);Ke(Ut,Xt)}return null}function ee(Ut,Ot,Xt,ue,wn){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return Ut=Ut.get(Xt)||null,et(Ot,Ut,""+ue,wn);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case y:return Ut=Ut.get(ue.key===null?Xt:ue.key)||null,Tt(Ot,Ut,ue,wn);case M:return Ut=Ut.get(ue.key===null?Xt:ue.key)||null,Gt(Ot,Ut,ue,wn);case bt:return ue=$t(ue),ee(Ut,Ot,Xt,ue,wn)}if(_t(ue)||ct(ue))return Ut=Ut.get(Xt)||null,le(Ot,Ut,ue,wn,null);if(typeof ue.then=="function")return ee(Ut,Ot,Xt,Ye(ue),wn);if(ue.$$typeof===q)return ee(Ut,Ot,Xt,Qc(Ot,ue),wn);Ke(Ot,ue)}return null}function nn(Ut,Ot,Xt,ue){for(var wn=null,Rr=null,un=Ot,Jn=Ot=0,br=null;un!==null&&Jn<Xt.length;Jn++){un.index>Jn?(br=un,un=null):br=un.sibling;var Or=Kt(Ut,un,Xt[Jn],ue);if(Or===null){un===null&&(un=br);break}o&&un&&Or.alternate===null&&a(Ut,un),Ot=k(Or,Ot,Jn),Rr===null?wn=Or:Rr.sibling=Or,Rr=Or,un=br}if(Jn===Xt.length)return u(Ut,un),rr&&Go(Ut,Jn),wn;if(un===null){for(;Jn<Xt.length;Jn++)un=me(Ut,Xt[Jn],ue),un!==null&&(Ot=k(un,Ot,Jn),Rr===null?wn=un:Rr.sibling=un,Rr=un);return rr&&Go(Ut,Jn),wn}for(un=h(un);Jn<Xt.length;Jn++)br=ee(un,Ut,Jn,Xt[Jn],ue),br!==null&&(o&&br.alternate!==null&&un.delete(br.key===null?Jn:br.key),Ot=k(br,Ot,Jn),Rr===null?wn=br:Rr.sibling=br,Rr=br);return o&&un.forEach(function(Wu){return a(Ut,Wu)}),rr&&Go(Ut,Jn),wn}function _n(Ut,Ot,Xt,ue){if(Xt==null)throw Error(r(151));for(var wn=null,Rr=null,un=Ot,Jn=Ot=0,br=null,Or=Xt.next();un!==null&&!Or.done;Jn++,Or=Xt.next()){un.index>Jn?(br=un,un=null):br=un.sibling;var Wu=Kt(Ut,un,Or.value,ue);if(Wu===null){un===null&&(un=br);break}o&&un&&Wu.alternate===null&&a(Ut,un),Ot=k(Wu,Ot,Jn),Rr===null?wn=Wu:Rr.sibling=Wu,Rr=Wu,un=br}if(Or.done)return u(Ut,un),rr&&Go(Ut,Jn),wn;if(un===null){for(;!Or.done;Jn++,Or=Xt.next())Or=me(Ut,Or.value,ue),Or!==null&&(Ot=k(Or,Ot,Jn),Rr===null?wn=Or:Rr.sibling=Or,Rr=Or);return rr&&Go(Ut,Jn),wn}for(un=h(un);!Or.done;Jn++,Or=Xt.next())Or=ee(un,Ut,Jn,Or.value,ue),Or!==null&&(o&&Or.alternate!==null&&un.delete(Or.key===null?Jn:Or.key),Ot=k(Or,Ot,Jn),Rr===null?wn=Or:Rr.sibling=Or,Rr=Or);return o&&un.forEach(function(pE){return a(Ut,pE)}),rr&&Go(Ut,Jn),wn}function Zr(Ut,Ot,Xt,ue){if(typeof Xt=="object"&&Xt!==null&&Xt.type===C&&Xt.key===null&&(Xt=Xt.props.children),typeof Xt=="object"&&Xt!==null){switch(Xt.$$typeof){case y:t:{for(var wn=Xt.key;Ot!==null;){if(Ot.key===wn){if(wn=Xt.type,wn===C){if(Ot.tag===7){u(Ut,Ot.sibling),ue=x(Ot,Xt.props.children),ue.return=Ut,Ut=ue;break t}}else if(Ot.elementType===wn||typeof wn=="object"&&wn!==null&&wn.$$typeof===bt&&$t(wn)===Ot.type){u(Ut,Ot.sibling),ue=x(Ot,Xt.props),Nn(ue,Xt),ue.return=Ut,Ut=ue;break t}u(Ut,Ot);break}else a(Ut,Ot);Ot=Ot.sibling}Xt.type===C?(ue=$a(Xt.props.children,Ut.mode,ue,Xt.key),ue.return=Ut,Ut=ue):(ue=Ql(Xt.type,Xt.key,Xt.props,null,Ut.mode,ue),Nn(ue,Xt),ue.return=Ut,Ut=ue)}return P(Ut);case M:t:{for(wn=Xt.key;Ot!==null;){if(Ot.key===wn)if(Ot.tag===4&&Ot.stateNode.containerInfo===Xt.containerInfo&&Ot.stateNode.implementation===Xt.implementation){u(Ut,Ot.sibling),ue=x(Ot,Xt.children||[]),ue.return=Ut,Ut=ue;break t}else{u(Ut,Ot);break}else a(Ut,Ot);Ot=Ot.sibling}ue=tc(Xt,Ut.mode,ue),ue.return=Ut,Ut=ue}return P(Ut);case bt:return Xt=$t(Xt),Zr(Ut,Ot,Xt,ue)}if(_t(Xt))return nn(Ut,Ot,Xt,ue);if(ct(Xt)){if(wn=ct(Xt),typeof wn!="function")throw Error(r(150));return Xt=wn.call(Xt),_n(Ut,Ot,Xt,ue)}if(typeof Xt.then=="function")return Zr(Ut,Ot,Ye(Xt),ue);if(Xt.$$typeof===q)return Zr(Ut,Ot,Qc(Ut,Xt),ue);Ke(Ut,Xt)}return typeof Xt=="string"&&Xt!==""||typeof Xt=="number"||typeof Xt=="bigint"?(Xt=""+Xt,Ot!==null&&Ot.tag===6?(u(Ut,Ot.sibling),ue=x(Ot,Xt),ue.return=Ut,Ut=ue):(u(Ut,Ot),ue=Ac(Xt,Ut.mode,ue),ue.return=Ut,Ut=ue),P(Ut)):u(Ut,Ot)}return function(Ut,Ot,Xt,ue){try{en=0;var wn=Zr(Ut,Ot,Xt,ue);return he=null,wn}catch(un){if(un===Et||un===mt)throw un;var Rr=so(29,un,null,Ut.mode);return Rr.lanes=ue,Rr.return=Ut,Rr}}}var zr=Xn(!0),zn=Xn(!1),qe=!1;function Pe(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function oi(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 xn(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function qn(o,a,u){var h=o.updateQueue;if(h===null)return null;if(h=h.shared,(jr&2)!==0){var x=h.pending;return x===null?a.next=a:(a.next=x.next,x.next=a),h.pending=a,a=oo(o),kc(o,null,u),a}return Sc(o,h,a,u),oo(o)}function Tr(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,Ur(o,u)}}function Ii(o,a){var u=o.updateQueue,h=o.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var x=null,k=null;if(u=u.firstBaseUpdate,u!==null){do{var P={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};k===null?x=k=P:k=k.next=P,u=u.next}while(u!==null);k===null?x=k=a:k=k.next=a}else x=k=a;u={baseState:h.baseState,firstBaseUpdate:x,lastBaseUpdate:k,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 lo=!1;function Nr(){if(lo){var o=v;if(o!==null)throw o}}function ji(o,a,u,h){lo=!1;var x=o.updateQueue;qe=!1;var k=x.firstBaseUpdate,P=x.lastBaseUpdate,et=x.shared.pending;if(et!==null){x.shared.pending=null;var Tt=et,Gt=Tt.next;Tt.next=null,P===null?k=Gt:P.next=Gt,P=Tt;var le=o.alternate;le!==null&&(le=le.updateQueue,et=le.lastBaseUpdate,et!==P&&(et===null?le.firstBaseUpdate=Gt:et.next=Gt,le.lastBaseUpdate=Tt))}if(k!==null){var me=x.baseState;P=0,le=Gt=Tt=null,et=k;do{var Kt=et.lane&-536870913,ee=Kt!==et.lane;if(ee?(yr&Kt)===Kt:(h&Kt)===Kt){Kt!==0&&Kt===m&&(lo=!0),le!==null&&(le=le.next={lane:0,tag:et.tag,payload:et.payload,callback:null,next:null});t:{var nn=o,_n=et;Kt=a;var Zr=u;switch(_n.tag){case 1:if(nn=_n.payload,typeof nn=="function"){me=nn.call(Zr,me,Kt);break t}me=nn;break t;case 3:nn.flags=nn.flags&-65537|128;case 0:if(nn=_n.payload,Kt=typeof nn=="function"?nn.call(Zr,me,Kt):nn,Kt==null)break t;me=g({},me,Kt);break t;case 2:qe=!0}}Kt=et.callback,Kt!==null&&(o.flags|=64,ee&&(o.flags|=8192),ee=x.callbacks,ee===null?x.callbacks=[Kt]:ee.push(Kt))}else ee={lane:Kt,tag:et.tag,payload:et.payload,callback:et.callback,next:null},le===null?(Gt=le=ee,Tt=me):le=le.next=ee,P|=Kt;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);le===null&&(Tt=me),x.baseState=Tt,x.firstBaseUpdate=Gt,x.lastBaseUpdate=le,k===null&&(x.shared.lanes=0),ju|=P,o.lanes=P,o.memoizedState=me}}function So(o,a){if(typeof o!="function")throw Error(r(191,o));o.call(a)}function gi(o,a){var u=o.callbacks;if(u!==null)for(o.callbacks=null,o=0;o<u.length;o++)So(u[o],a)}var Kn=$(null),ir=$(0);function Br(o,a){o=fu,Q(ir,o),Q(Kn,a),fu=o|a.baseLanes}function lr(){Q(ir,fu),Q(Kn,Kn.current)}function si(){fu=ir.current,N(Kn),N(ir)}var Un=$(null),Qn=null;function Yr(o){var a=o.alternate;Q(I,I.current&1),Q(Un,o),Qn===null&&(a===null||Kn.current!==null||a.memoizedState!==null)&&(Qn=o)}function w(o){Q(I,I.current),Q(Un,o),Qn===null&&(Qn=o)}function S(o){o.tag===22?(Q(I,I.current),Q(Un,o),Qn===null&&(Qn=o)):D()}function D(){Q(I,I.current),Q(Un,Un.current)}function _(o){N(Un),Qn===o&&(Qn=null),N(I)}var I=$(0);function K(o){for(var a=o;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||O1(u)||P1(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 nt=0,j=null,Y=null,lt=null,st=!1,ft=!1,z=!1,Ct=0,jt=0,St=null,Dt=0;function xt(){throw Error(r(321))}function qt(o,a){if(a===null)return!1;for(var u=0;u<a.length&&u<o.length;u++)if(!ur(o[u],a[u]))return!1;return!0}function Wt(o,a,u,h,x,k){return nt=k,j=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,ht.H=o===null||o.memoizedState===null?_b:Y0,z=!1,k=u(h,x),z=!1,ft&&(k=be(a,u,h,x)),fe(o),k}function fe(o){ht.H=hh;var a=Y!==null&&Y.next!==null;if(nt=0,lt=Y=j=null,st=!1,jt=0,St=null,a)throw Error(r(300));o===null||Ao||(o=o.dependencies,o!==null&&Ec(o)&&(Ao=!0))}function be(o,a,u,h){j=o;var x=0;do{if(ft&&(St=null),jt=0,ft=!1,25<=x)throw Error(r(301));if(x+=1,lt=Y=null,o.updateQueue!=null){var k=o.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}ht.H=Db,k=a(u,h)}while(ft);return k}function Ee(){var o=ht.H,a=o.useState()[0];return a=typeof a.then=="function"?Hn(a):a,o=o.useState()[0],(Y!==null?Y.memoizedState:null)!==o&&(j.flags|=1024),a}function Je(){var o=Ct!==0;return Ct=0,o}function En(o,a,u){a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~u}function pe(o){if(st){for(o=o.memoizedState;o!==null;){var a=o.queue;a!==null&&(a.pending=null),o=o.next}st=!1}nt=0,lt=Y=j=null,ft=!1,jt=Ct=0,St=null}function Le(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return lt===null?j.memoizedState=lt=o:lt=lt.next=o,lt}function ae(){if(Y===null){var o=j.alternate;o=o!==null?o.memoizedState:null}else o=Y.next;var a=lt===null?j.memoizedState:lt.next;if(a!==null)lt=a,Y=o;else{if(o===null)throw j.alternate===null?Error(r(467)):Error(r(310));Y=o,o={memoizedState:Y.memoizedState,baseState:Y.baseState,baseQueue:Y.baseQueue,queue:Y.queue,next:null},lt===null?j.memoizedState=lt=o:lt=lt.next=o}return lt}function An(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Hn(o){var a=jt;return jt+=1,St===null&&(St=[]),o=oe(St,o,a),a=j,(lt===null?a.memoizedState:lt.next)===null&&(a=a.alternate,ht.H=a===null||a.memoizedState===null?_b:Y0),o}function Sr(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return Hn(o);if(o.$$typeof===q)return Yi(o)}throw Error(r(438,String(o)))}function Gr(o){var a=null,u=j.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var h=j.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=An(),j.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]=Lt;return a.index++,u}function yi(o,a){return typeof a=="function"?a(o):a}function zt(o){var a=ae();return He(a,Y,o)}function He(o,a,u){var h=o.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=u;var x=o.baseQueue,k=h.pending;if(k!==null){if(x!==null){var P=x.next;x.next=k.next,k.next=P}a.baseQueue=x=k,h.pending=null}if(k=o.baseState,x===null)o.memoizedState=k;else{a=x.next;var et=P=null,Tt=null,Gt=a,le=!1;do{var me=Gt.lane&-536870913;if(me!==Gt.lane?(yr&me)===me:(nt&me)===me){var Kt=Gt.revertLane;if(Kt===0)Tt!==null&&(Tt=Tt.next={lane:0,revertLane:0,gesture:null,action:Gt.action,hasEagerState:Gt.hasEagerState,eagerState:Gt.eagerState,next:null}),me===m&&(le=!0);else if((nt&Kt)===Kt){Gt=Gt.next,Kt===m&&(le=!0);continue}else me={lane:0,revertLane:Gt.revertLane,gesture:null,action:Gt.action,hasEagerState:Gt.hasEagerState,eagerState:Gt.eagerState,next:null},Tt===null?(et=Tt=me,P=k):Tt=Tt.next=me,j.lanes|=Kt,ju|=Kt;me=Gt.action,z&&u(k,me),k=Gt.hasEagerState?Gt.eagerState:u(k,me)}else Kt={lane:me,revertLane:Gt.revertLane,gesture:Gt.gesture,action:Gt.action,hasEagerState:Gt.hasEagerState,eagerState:Gt.eagerState,next:null},Tt===null?(et=Tt=Kt,P=k):Tt=Tt.next=Kt,j.lanes|=me,ju|=me;Gt=Gt.next}while(Gt!==null&&Gt!==a);if(Tt===null?P=k:Tt.next=et,!ur(k,o.memoizedState)&&(Ao=!0,le&&(u=v,u!==null)))throw u;o.memoizedState=k,o.baseState=P,o.baseQueue=Tt,h.lastRenderedState=k}return x===null&&(h.lanes=0),[o.memoizedState,h.dispatch]}function Te(o){var a=ae(),u=a.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=o;var h=u.dispatch,x=u.pending,k=a.memoizedState;if(x!==null){u.pending=null;var P=x=x.next;do k=o(k,P.action),P=P.next;while(P!==x);ur(k,a.memoizedState)||(Ao=!0),a.memoizedState=k,a.baseQueue===null&&(a.baseState=k),u.lastRenderedState=k}return[k,h]}function ze(o,a,u){var h=j,x=ae(),k=rr;if(k){if(u===void 0)throw Error(r(407));u=u()}else u=a();var P=!ur((Y||x).memoizedState,u);if(P&&(x.memoizedState=u,Ao=!0),x=x.queue,co(Ir.bind(null,h,x,o),[o]),x.getSnapshot!==a||P||lt!==null&&lt.memoizedState.tag&1){if(h.flags|=2048,rc(9,{destroy:void 0},vn.bind(null,h,x,u,a),null),ai===null)throw Error(r(349));k||(nt&127)!==0||Be(h,a,u)}return u}function Be(o,a,u){o.flags|=16384,o={getSnapshot:a,value:u},a=j.updateQueue,a===null?(a=An(),j.updateQueue=a,a.stores=[o]):(u=a.stores,u===null?a.stores=[o]:u.push(o))}function vn(o,a,u,h){a.value=u,a.getSnapshot=h,Gi(a)&&bi(o)}function Ir(o,a,u){return u(function(){Gi(a)&&bi(o)})}function Gi(o){var a=o.getSnapshot;o=o.value;try{var u=a();return!ur(o,u)}catch{return!0}}function bi(o){var a=Ma(o,2);a!==null&&Da(a,o,2)}function ki(o){var a=Le();if(typeof o=="function"){var u=o;if(o=u(),z){ln(!0);try{u()}finally{ln(!1)}}}return a.memoizedState=a.baseState=o,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:yi,lastRenderedState:o},a}function Ai(o,a,u,h){return o.baseState=u,He(o,Y,typeof h=="function"?h:yi)}function xi(o,a,u,h,x){if(Bp(o))throw Error(r(485));if(o=a.action,o!==null){var k={payload:x,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(P){k.listeners.push(P)}};ht.T!==null?u(!0):k.isTransition=!1,h(k),u=a.pending,u===null?(k.next=a.pending=k,Kr(a,k)):(k.next=u.next,a.pending=u.next=k)}}function Kr(o,a){var u=a.action,h=a.payload,x=o.state;if(a.isTransition){var k=ht.T,P={};ht.T=P;try{var et=u(x,h),Tt=ht.S;Tt!==null&&Tt(P,et),gr(o,a,et)}catch(Gt){ko(o,a,Gt)}finally{k!==null&&P.types!==null&&(k.types=P.types),ht.T=k}}else try{k=u(x,h),gr(o,a,k)}catch(Gt){ko(o,a,Gt)}}function gr(o,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(h){Ki(o,a,h)},function(h){return ko(o,a,h)}):Ki(o,a,u)}function Ki(o,a,u){a.status="fulfilled",a.value=u,tu(a),o.state=u,a=o.pending,a!==null&&(u=a.next,u===a?o.pending=null:(u=u.next,a.next=u,Kr(o,u)))}function ko(o,a,u){var h=o.pending;if(o.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=u,tu(a),a=a.next;while(a!==h)}o.action=null}function tu(o){o=o.listeners;for(var a=0;a<o.length;a++)(0,o[a])()}function nc(o,a){return a}function jo(o,a){if(rr){var u=ai.formState;if(u!==null){t:{var h=j;if(rr){if(Lr){e:{for(var x=Lr,k=ii;x.nodeType!==8;){if(!k){x=null;break e}if(x=Tl(x.nextSibling),x===null){x=null;break e}}k=x.data,x=k==="F!"||k==="F"?x:null}if(x){Lr=Tl(x.nextSibling),h=x.data==="F!";break t}}Sl(h)}h=!1}h&&(a=u[0])}}return u=Le(),u.memoizedState=u.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nc,lastRenderedState:a},u.queue=h,u=Eb.bind(null,j,h),h.dispatch=u,h=ki(!1),k=$0.bind(null,j,!1,h.queue),h=Le(),x={state:a,dispatch:null,action:o,pending:null},h.queue=x,u=xi.bind(null,j,x,k,u),x.dispatch=u,h.memoizedState=o,[a,u,!1]}function sa(o){var a=ae();return aa(a,Y,o)}function aa(o,a,u){if(a=He(o,a,nc)[0],o=zt(yi)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=Hn(a)}catch(P){throw P===Et?mt:P}else h=a;a=ae();var x=a.queue,k=x.dispatch;return u!==a.memoizedState&&(j.flags|=2048,rc(9,{destroy:void 0},eu.bind(null,x,u),null)),[h,k,o]}function eu(o,a){o.action=a}function nu(o){var a=ae(),u=Y;if(u!==null)return aa(a,u,o);ae(),a=a.memoizedState,u=ae();var h=u.queue.dispatch;return u.memoizedState=o,[a,h,!1]}function rc(o,a,u,h){return o={tag:o,create:u,deps:h,inst:a,next:null},a=j.updateQueue,a===null&&(a=An(),j.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 la(){return ae().memoizedState}function Fs(o,a,u,h){var x=Le();j.flags|=o,x.memoizedState=rc(1|a,{destroy:void 0},u,h===void 0?null:h)}function ca(o,a,u,h){var x=ae();h=h===void 0?null:h;var k=x.memoizedState.inst;Y!==null&&h!==null&&qt(h,Y.memoizedState.deps)?x.memoizedState=rc(a,k,u,h):(j.flags|=o,x.memoizedState=rc(1|a,k,u,h))}function ru(o,a){Fs(8390656,8,o,a)}function co(o,a){ca(2048,8,o,a)}function iu(o){j.flags|=4;var a=j.updateQueue;if(a===null)a=An(),j.updateQueue=a,a.events=[o];else{var u=a.events;u===null?a.events=[o]:u.push(o)}}function Ga(o){var a=ae().memoizedState;return iu({ref:a,nextImpl:o}),function(){if((jr&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function mb(o,a){return ca(4,2,o,a)}function gb(o,a){return ca(4,4,o,a)}function yb(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 bb(o,a,u){u=u!=null?u.concat([o]):null,ca(4,4,yb.bind(null,a,o),u)}function F0(){}function xb(o,a){var u=ae();a=a===void 0?null:a;var h=u.memoizedState;return a!==null&&qt(a,h[1])?h[0]:(u.memoizedState=[o,a],o)}function vb(o,a){var u=ae();a=a===void 0?null:a;var h=u.memoizedState;if(a!==null&&qt(a,h[1]))return h[0];if(h=o(),z){ln(!0);try{o()}finally{ln(!1)}}return u.memoizedState=[h,a],h}function U0(o,a,u){return u===void 0||(nt&1073741824)!==0&&(yr&261930)===0?o.memoizedState=a:(o.memoizedState=u,o=wx(),j.lanes|=o,ju|=o,u)}function wb(o,a,u,h){return ur(u,a)?u:Kn.current!==null?(o=U0(o,u,h),ur(o,a)||(Ao=!0),o):(nt&42)===0||(nt&1073741824)!==0&&(yr&261930)===0?(Ao=!0,o.memoizedState=u):(o=wx(),j.lanes|=o,ju|=o,a)}function Sb(o,a,u,h,x){var k=Z.p;Z.p=k!==0&&8>k?k:8;var P=ht.T,et={};ht.T=et,$0(o,!1,a,u);try{var Tt=x(),Gt=ht.S;if(Gt!==null&&Gt(et,Tt),Tt!==null&&typeof Tt=="object"&&typeof Tt.then=="function"){var le=U(Tt,h);dh(o,a,le,Za(o))}else dh(o,a,h,Za(o))}catch(me){dh(o,a,{then:function(){},status:"rejected",reason:me},Za())}finally{Z.p=k,P!==null&&et.types!==null&&(P.types=et.types),ht.T=P}}function c6(){}function H0(o,a,u,h){if(o.tag!==5)throw Error(r(476));var x=kb(o).queue;Sb(o,x,a,ut,u===null?c6:function(){return Ab(o),u(h)})}function kb(o){var a=o.memoizedState;if(a!==null)return a;a={memoizedState:ut,baseState:ut,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yi,lastRenderedState:ut},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yi,lastRenderedState:u},next:null},o.memoizedState=a,o=o.alternate,o!==null&&(o.memoizedState=a),a}function Ab(o){var a=kb(o);a.next===null&&(a=o.alternate.memoizedState),dh(o,a.next.queue,{},Za())}function q0(){return Yi(Nh)}function Mb(){return ae().memoizedState}function Cb(){return ae().memoizedState}function u6(o){for(var a=o.return;a!==null;){switch(a.tag){case 24:case 3:var u=Za();o=xn(u);var h=qn(a,o,u);h!==null&&(Da(h,a,u),Tr(h,a,u)),a={cache:oa()},o.payload=a;return}a=a.return}}function f6(o,a,u){var h=Za();u={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Bp(o)?Tb(a,u):(u=Vc(o,a,u,h),u!==null&&(Da(u,o,h),Nb(u,a,h)))}function Eb(o,a,u){var h=Za();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(Bp(o))Tb(a,x);else{var k=o.alternate;if(o.lanes===0&&(k===null||k.lanes===0)&&(k=a.lastRenderedReducer,k!==null))try{var P=a.lastRenderedState,et=k(P,u);if(x.hasEagerState=!0,x.eagerState=et,ur(et,P))return Sc(o,a,x,0),ai===null&&wc(),!1}catch{}if(u=Vc(o,a,x,h),u!==null)return Da(u,o,h),Nb(u,a,h),!0}return!1}function $0(o,a,u,h){if(h={lane:2,revertLane:S1(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Bp(o)){if(a)throw Error(r(479))}else a=Vc(o,u,h,2),a!==null&&Da(a,o,2)}function Bp(o){var a=o.alternate;return o===j||a!==null&&a===j}function Tb(o,a){ft=st=!0;var u=o.pending;u===null?a.next=a:(a.next=u.next,u.next=a),o.pending=a}function Nb(o,a,u){if((u&4194048)!==0){var h=a.lanes;h&=o.pendingLanes,u|=h,a.lanes=u,Ur(o,u)}}var hh={readContext:Yi,use:Sr,useCallback:xt,useContext:xt,useEffect:xt,useImperativeHandle:xt,useLayoutEffect:xt,useInsertionEffect:xt,useMemo:xt,useReducer:xt,useRef:xt,useState:xt,useDebugValue:xt,useDeferredValue:xt,useTransition:xt,useSyncExternalStore:xt,useId:xt,useHostTransitionStatus:xt,useFormState:xt,useActionState:xt,useOptimistic:xt,useMemoCache:xt,useCacheRefresh:xt};hh.useEffectEvent=xt;var _b={readContext:Yi,use:Sr,useCallback:function(o,a){return Le().memoizedState=[o,a===void 0?null:a],o},useContext:Yi,useEffect:ru,useImperativeHandle:function(o,a,u){u=u!=null?u.concat([o]):null,Fs(4194308,4,yb.bind(null,a,o),u)},useLayoutEffect:function(o,a){return Fs(4194308,4,o,a)},useInsertionEffect:function(o,a){Fs(4,2,o,a)},useMemo:function(o,a){var u=Le();a=a===void 0?null:a;var h=o();if(z){ln(!0);try{o()}finally{ln(!1)}}return u.memoizedState=[h,a],h},useReducer:function(o,a,u){var h=Le();if(u!==void 0){var x=u(a);if(z){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=f6.bind(null,j,o),[h.memoizedState,o]},useRef:function(o){var a=Le();return o={current:o},a.memoizedState=o},useState:function(o){o=ki(o);var a=o.queue,u=Eb.bind(null,j,a);return a.dispatch=u,[o.memoizedState,u]},useDebugValue:F0,useDeferredValue:function(o,a){var u=Le();return U0(u,o,a)},useTransition:function(){var o=ki(!1);return o=Sb.bind(null,j,o.queue,!0,!1),Le().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,a,u){var h=j,x=Le();if(rr){if(u===void 0)throw Error(r(407));u=u()}else{if(u=a(),ai===null)throw Error(r(349));(yr&127)!==0||Be(h,a,u)}x.memoizedState=u;var k={value:u,getSnapshot:a};return x.queue=k,ru(Ir.bind(null,h,k,o),[o]),h.flags|=2048,rc(9,{destroy:void 0},vn.bind(null,h,k,u,a),null),u},useId:function(){var o=Le(),a=ai.identifierPrefix;if(rr){var u=bs,h=ys;u=(h&~(1<<32-Bn(h)-1)).toString(32)+u,a="_"+a+"R_"+u,u=Ct++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=Dt++,a="_"+a+"r_"+u.toString(32)+"_";return o.memoizedState=a},useHostTransitionStatus:q0,useFormState:jo,useActionState:jo,useOptimistic:function(o){var a=Le();a.memoizedState=a.baseState=o;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=$0.bind(null,j,!0,u),u.dispatch=a,[o,a]},useMemoCache:Gr,useCacheRefresh:function(){return Le().memoizedState=u6.bind(null,j)},useEffectEvent:function(o){var a=Le(),u={impl:o};return a.memoizedState=u,function(){if((jr&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},Y0={readContext:Yi,use:Sr,useCallback:xb,useContext:Yi,useEffect:co,useImperativeHandle:bb,useInsertionEffect:mb,useLayoutEffect:gb,useMemo:vb,useReducer:zt,useRef:la,useState:function(){return zt(yi)},useDebugValue:F0,useDeferredValue:function(o,a){var u=ae();return wb(u,Y.memoizedState,o,a)},useTransition:function(){var o=zt(yi)[0],a=ae().memoizedState;return[typeof o=="boolean"?o:Hn(o),a]},useSyncExternalStore:ze,useId:Mb,useHostTransitionStatus:q0,useFormState:sa,useActionState:sa,useOptimistic:function(o,a){var u=ae();return Ai(u,Y,o,a)},useMemoCache:Gr,useCacheRefresh:Cb};Y0.useEffectEvent=Ga;var Db={readContext:Yi,use:Sr,useCallback:xb,useContext:Yi,useEffect:co,useImperativeHandle:bb,useInsertionEffect:mb,useLayoutEffect:gb,useMemo:vb,useReducer:Te,useRef:la,useState:function(){return Te(yi)},useDebugValue:F0,useDeferredValue:function(o,a){var u=ae();return Y===null?U0(u,o,a):wb(u,Y.memoizedState,o,a)},useTransition:function(){var o=Te(yi)[0],a=ae().memoizedState;return[typeof o=="boolean"?o:Hn(o),a]},useSyncExternalStore:ze,useId:Mb,useHostTransitionStatus:q0,useFormState:nu,useActionState:nu,useOptimistic:function(o,a){var u=ae();return Y!==null?Ai(u,Y,o,a):(u.baseState=o,[o,u.queue.dispatch])},useMemoCache:Gr,useCacheRefresh:Cb};Db.useEffectEvent=Ga;function V0(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 W0={enqueueSetState:function(o,a,u){o=o._reactInternals;var h=Za(),x=xn(h);x.payload=a,u!=null&&(x.callback=u),a=qn(o,x,h),a!==null&&(Da(a,o,h),Tr(a,o,h))},enqueueReplaceState:function(o,a,u){o=o._reactInternals;var h=Za(),x=xn(h);x.tag=1,x.payload=a,u!=null&&(x.callback=u),a=qn(o,x,h),a!==null&&(Da(a,o,h),Tr(a,o,h))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var u=Za(),h=xn(u);h.tag=2,a!=null&&(h.callback=a),a=qn(o,h,u),a!==null&&(Da(a,o,u),Tr(a,o,u))}};function Lb(o,a,u,h,x,k,P){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(h,k,P):a.prototype&&a.prototype.isPureReactComponent?!wo(u,h)||!wo(x,k):!0}function Rb(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&&W0.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 Ob(o){$c(o)}function Pb(o){console.error(o)}function Ib(o){$c(o)}function Fp(o,a){try{var u=o.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function jb(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 X0(o,a,u){return u=xn(u),u.tag=3,u.payload={element:null},u.callback=function(){Fp(o,a)},u}function zb(o){return o=xn(o),o.tag=3,o}function Bb(o,a,u,h){var x=u.type.getDerivedStateFromError;if(typeof x=="function"){var k=h.value;o.payload=function(){return x(k)},o.callback=function(){jb(a,u,h)}}var P=u.stateNode;P!==null&&typeof P.componentDidCatch=="function"&&(o.callback=function(){jb(a,u,h),typeof x!="function"&&(zu===null?zu=new Set([this]):zu.add(this));var et=h.stack;this.componentDidCatch(h.value,{componentStack:et!==null?et:""})})}function d6(o,a,u,h,x){if(u.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=u.alternate,a!==null&&Ml(a,u,x,!0),u=Un.current,u!==null){switch(u.tag){case 31:case 13:return Qn===null?Zp():u.alternate===null&&Ji===0&&(Ji=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),x1(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)),x1(o,h,x)),!1}throw Error(r(435,u.tag))}return x1(o,h,x),Zp(),!1}if(rr)return a=Un.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,h!==ra&&(o=Error(r(422),{cause:h}),kl(ms(o,u)))):(h!==ra&&(a=Error(r(423),{cause:h}),kl(ms(a,u))),o=o.current.alternate,o.flags|=65536,x&=-x,o.lanes|=x,h=ms(h,u),x=X0(o.stateNode,h,x),Ii(o,x),Ji!==4&&(Ji=2)),!1;var k=Error(r(520),{cause:h});if(k=ms(k,u),wh===null?wh=[k]:wh.push(k),Ji!==4&&(Ji=2),a===null)return!0;h=ms(h,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,o=x&-x,u.lanes|=o,o=X0(u.stateNode,h,o),Ii(u,o),!1;case 1:if(a=u.type,k=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(zu===null||!zu.has(k))))return u.flags|=65536,x&=-x,u.lanes|=x,x=zb(x),Bb(x,o,u,h),Ii(u,x),!1}u=u.return}while(u!==null);return!1}var G0=Error(r(461)),Ao=!1;function ws(o,a,u,h){a.child=o===null?zn(a,null,u,h):zr(a,o.child,u,h)}function Fb(o,a,u,h,x){u=u.render;var k=a.ref;if("ref"in h){var P={};for(var et in h)et!=="ref"&&(P[et]=h[et])}else P=h;return $i(a),h=Wt(o,a,u,P,k,x),et=Je(),o!==null&&!Ao?(En(o,a,x),ou(o,a,x)):(rr&&et&&Lu(a),a.flags|=1,ws(o,a,h,x),a.child)}function Ub(o,a,u,h,x){if(o===null){var k=u.type;return typeof k=="function"&&!Xc(k)&&k.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=k,Hb(o,a,k,h,x)):(o=Ql(u.type,null,h,a,a.mode,x),o.ref=a.ref,o.return=a,a.child=o)}if(k=o.child,!r1(o,x)){var P=k.memoizedProps;if(u=u.compare,u=u!==null?u:wo,u(P,h)&&o.ref===a.ref)return ou(o,a,x)}return a.flags|=1,o=ps(k,h),o.ref=a.ref,o.return=a,a.child=o}function Hb(o,a,u,h,x){if(o!==null){var k=o.memoizedProps;if(wo(k,h)&&o.ref===a.ref)if(Ao=!1,a.pendingProps=h=k,r1(o,x))(o.flags&131072)!==0&&(Ao=!0);else return a.lanes=o.lanes,ou(o,a,x)}return K0(o,a,u,h,x)}function qb(o,a,u,h){var x=h.children,k=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(k=k!==null?k.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&~k}else h=0,a.child=null;return $b(o,a,k,u,h)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},o!==null&&at(a,k!==null?k.cachePool:null),k!==null?Br(a,k):lr(),S(a);else return h=a.lanes=536870912,$b(o,a,k!==null?k.baseLanes|u:u,u,h)}else k!==null?(at(a,k.cachePool),Br(a,k),D(),a.memoizedState=null):(o!==null&&at(a,null),lr(),D());return ws(o,a,x,u),a.child}function ph(o,a){return o!==null&&o.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function $b(o,a,u,h,x){var k=ot();return k=k===null?null:{parent:Si._currentValue,pool:k},a.memoizedState={baseLanes:u,cachePool:k},o!==null&&at(a,null),lr(),S(a),o!==null&&Ml(o,a,h,!0),a.childLanes=x,null}function Up(o,a){return a=qp({mode:a.mode,children:a.children},o.mode),a.ref=o.ref,o.child=a,a.return=o,a}function Yb(o,a,u){return zr(a,o.child,null,u),o=Up(a,a.pendingProps),o.flags|=2,_(a),a.memoizedState=null,o}function h6(o,a,u){var h=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,o===null){if(rr){if(h.mode==="hidden")return o=Up(a,h),a.lanes=536870912,ph(null,o);if(w(a),(o=Lr)?(o=rv(o,ii),o=o!==null&&o.data==="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:Va!==null?{id:ys,overflow:bs}:null,retryLane:536870912,hydrationErrors:null},u=Ya(o),u.return=a,a.child=u,$r=a,Lr=null)):o=null,o===null)throw Sl(a);return a.lanes=536870912,null}return Up(a,h)}var k=o.memoizedState;if(k!==null){var P=k.dehydrated;if(w(a),x)if(a.flags&256)a.flags&=-257,a=Yb(o,a,u);else if(a.memoizedState!==null)a.child=o.child,a.flags|=128,a=null;else throw Error(r(558));else if(Ao||Ml(o,a,u,!1),x=(u&o.childLanes)!==0,Ao||x){if(h=ai,h!==null&&(P=Ni(h,u),P!==0&&P!==k.retryLane))throw k.retryLane=P,Ma(o,P),Da(h,o,P),G0;Zp(),a=Yb(o,a,u)}else o=k.treeContext,Lr=Tl(P.nextSibling),$r=a,rr=!0,Io=null,ii=!1,o!==null&&Jc(a,o),a=Up(a,h),a.flags|=4096;return a}return o=ps(o.child,{mode:h.mode,children:h.children}),o.ref=a.ref,a.child=o,o.return=a,o}function Hp(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 K0(o,a,u,h,x){return $i(a),u=Wt(o,a,u,h,void 0,x),h=Je(),o!==null&&!Ao?(En(o,a,x),ou(o,a,x)):(rr&&h&&Lu(a),a.flags|=1,ws(o,a,u,x),a.child)}function Vb(o,a,u,h,x,k){return $i(a),a.updateQueue=null,u=be(a,h,u,x),fe(o),h=Je(),o!==null&&!Ao?(En(o,a,k),ou(o,a,k)):(rr&&h&&Lu(a),a.flags|=1,ws(o,a,u,k),a.child)}function Wb(o,a,u,h,x){if($i(a),a.stateNode===null){var k=Xi,P=u.contextType;typeof P=="object"&&P!==null&&(k=Yi(P)),k=new u(h,k),a.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=W0,a.stateNode=k,k._reactInternals=a,k=a.stateNode,k.props=h,k.state=a.memoizedState,k.refs={},Pe(a),P=u.contextType,k.context=typeof P=="object"&&P!==null?Yi(P):Xi,k.state=a.memoizedState,P=u.getDerivedStateFromProps,typeof P=="function"&&(V0(a,u,P,h),k.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(P=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),P!==k.state&&W0.enqueueReplaceState(k,k.state,null),ji(a,h,k,x),Nr(),k.state=a.memoizedState),typeof k.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(o===null){k=a.stateNode;var et=a.memoizedProps,Tt=_f(u,et);k.props=Tt;var Gt=k.context,le=u.contextType;P=Xi,typeof le=="object"&&le!==null&&(P=Yi(le));var me=u.getDerivedStateFromProps;le=typeof me=="function"||typeof k.getSnapshotBeforeUpdate=="function",et=a.pendingProps!==et,le||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(et||Gt!==P)&&Rb(a,k,h,P),qe=!1;var Kt=a.memoizedState;k.state=Kt,ji(a,h,k,x),Nr(),Gt=a.memoizedState,et||Kt!==Gt||qe?(typeof me=="function"&&(V0(a,u,me,h),Gt=a.memoizedState),(Tt=qe||Lb(a,u,Tt,h,Kt,Gt,P))?(le||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(a.flags|=4194308)):(typeof k.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=Gt),k.props=h,k.state=Gt,k.context=P,h=Tt):(typeof k.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{k=a.stateNode,oi(o,a),P=a.memoizedProps,le=_f(u,P),k.props=le,me=a.pendingProps,Kt=k.context,Gt=u.contextType,Tt=Xi,typeof Gt=="object"&&Gt!==null&&(Tt=Yi(Gt)),et=u.getDerivedStateFromProps,(Gt=typeof et=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(P!==me||Kt!==Tt)&&Rb(a,k,h,Tt),qe=!1,Kt=a.memoizedState,k.state=Kt,ji(a,h,k,x),Nr();var ee=a.memoizedState;P!==me||Kt!==ee||qe||o!==null&&o.dependencies!==null&&Ec(o.dependencies)?(typeof et=="function"&&(V0(a,u,et,h),ee=a.memoizedState),(le=qe||Lb(a,u,le,h,Kt,ee,Tt)||o!==null&&o.dependencies!==null&&Ec(o.dependencies))?(Gt||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(h,ee,Tt),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(h,ee,Tt)),typeof k.componentDidUpdate=="function"&&(a.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof k.componentDidUpdate!="function"||P===o.memoizedProps&&Kt===o.memoizedState||(a.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||P===o.memoizedProps&&Kt===o.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=ee),k.props=h,k.state=ee,k.context=Tt,h=le):(typeof k.componentDidUpdate!="function"||P===o.memoizedProps&&Kt===o.memoizedState||(a.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||P===o.memoizedProps&&Kt===o.memoizedState||(a.flags|=1024),h=!1)}return k=h,Hp(o,a),h=(a.flags&128)!==0,k||h?(k=a.stateNode,u=h&&typeof u.getDerivedStateFromError!="function"?null:k.render(),a.flags|=1,o!==null&&h?(a.child=zr(a,o.child,null,x),a.child=zr(a,null,u,x)):ws(o,a,u,x),a.memoizedState=k.state,o=a.child):o=ou(o,a,x),o}function Xb(o,a,u,h){return Bs(),a.flags|=256,ws(o,a,u,h),a.child}var J0={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Z0(o){return{baseLanes:o,cachePool:yt()}}function Q0(o,a,u){return o=o!==null?o.childLanes&~u:0,a&&(o|=Ja),o}function Gb(o,a,u){var h=a.pendingProps,x=!1,k=(a.flags&128)!==0,P;if((P=k)||(P=o!==null&&o.memoizedState===null?!1:(I.current&2)!==0),P&&(x=!0,a.flags&=-129),P=(a.flags&32)!==0,a.flags&=-33,o===null){if(rr){if(x?Yr(a):D(),(o=Lr)?(o=rv(o,ii),o=o!==null&&o.data!=="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:Va!==null?{id:ys,overflow:bs}:null,retryLane:536870912,hydrationErrors:null},u=Ya(o),u.return=a,a.child=u,$r=a,Lr=null)):o=null,o===null)throw Sl(a);return P1(o)?a.lanes=32:a.lanes=536870912,null}var et=h.children;return h=h.fallback,x?(D(),x=a.mode,et=qp({mode:"hidden",children:et},x),h=$a(h,x,u,null),et.return=a,h.return=a,et.sibling=h,a.child=et,h=a.child,h.memoizedState=Z0(u),h.childLanes=Q0(o,P,u),a.memoizedState=J0,ph(null,h)):(Yr(a),t1(a,et))}var Tt=o.memoizedState;if(Tt!==null&&(et=Tt.dehydrated,et!==null)){if(k)a.flags&256?(Yr(a),a.flags&=-257,a=e1(o,a,u)):a.memoizedState!==null?(D(),a.child=o.child,a.flags|=128,a=null):(D(),et=h.fallback,x=a.mode,h=qp({mode:"visible",children:h.children},x),et=$a(et,x,u,null),et.flags|=2,h.return=a,et.return=a,h.sibling=et,a.child=h,zr(a,o.child,null,u),h=a.child,h.memoizedState=Z0(u),h.childLanes=Q0(o,P,u),a.memoizedState=J0,a=ph(null,h));else if(Yr(a),P1(et)){if(P=et.nextSibling&&et.nextSibling.dataset,P)var Gt=P.dgst;P=Gt,h=Error(r(419)),h.stack="",h.digest=P,kl({value:h,source:null,stack:null}),a=e1(o,a,u)}else if(Ao||Ml(o,a,u,!1),P=(u&o.childLanes)!==0,Ao||P){if(P=ai,P!==null&&(h=Ni(P,u),h!==0&&h!==Tt.retryLane))throw Tt.retryLane=h,Ma(o,h),Da(P,o,h),G0;O1(et)||Zp(),a=e1(o,a,u)}else O1(et)?(a.flags|=192,a.child=o.child,a=null):(o=Tt.treeContext,Lr=Tl(et.nextSibling),$r=a,rr=!0,Io=null,ii=!1,o!==null&&Jc(a,o),a=t1(a,h.children),a.flags|=4096);return a}return x?(D(),et=h.fallback,x=a.mode,Tt=o.child,Gt=Tt.sibling,h=ps(Tt,{mode:"hidden",children:h.children}),h.subtreeFlags=Tt.subtreeFlags&65011712,Gt!==null?et=ps(Gt,et):(et=$a(et,x,u,null),et.flags|=2),et.return=a,h.return=a,h.sibling=et,a.child=h,ph(null,h),h=a.child,et=o.child.memoizedState,et===null?et=Z0(u):(x=et.cachePool,x!==null?(Tt=Si._currentValue,x=x.parent!==Tt?{parent:Tt,pool:Tt}:x):x=yt(),et={baseLanes:et.baseLanes|u,cachePool:x}),h.memoizedState=et,h.childLanes=Q0(o,P,u),a.memoizedState=J0,ph(o.child,h)):(Yr(a),u=o.child,o=u.sibling,u=ps(u,{mode:"visible",children:h.children}),u.return=a,u.sibling=null,o!==null&&(P=a.deletions,P===null?(a.deletions=[o],a.flags|=16):P.push(o)),a.child=u,a.memoizedState=null,u)}function t1(o,a){return a=qp({mode:"visible",children:a},o.mode),a.return=o,o.child=a}function qp(o,a){return o=so(22,o,null,a),o.lanes=0,o}function e1(o,a,u){return zr(a,o.child,null,u),o=t1(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function Kb(o,a,u){o.lanes|=a;var h=o.alternate;h!==null&&(h.lanes|=a),Cc(o.return,a,u)}function n1(o,a,u,h,x,k){var P=o.memoizedState;P===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:u,tailMode:x,treeForkCount:k}:(P.isBackwards=a,P.rendering=null,P.renderingStartTime=0,P.last=h,P.tail=u,P.tailMode=x,P.treeForkCount=k)}function Jb(o,a,u){var h=a.pendingProps,x=h.revealOrder,k=h.tail;h=h.children;var P=I.current,et=(P&2)!==0;if(et?(P=P&1|2,a.flags|=128):P&=1,Q(I,P),ws(o,a,h,u),h=rr?Mc:0,!et&&o!==null&&(o.flags&128)!==0)t:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Kb(o,u,a);else if(o.tag===19)Kb(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&&K(o)===null&&(x=u),u=u.sibling;u=x,u===null?(x=a.child,a.child=null):(x=u.sibling,u.sibling=null),n1(a,!1,x,u,k,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&&K(o)===null){a.child=x;break}o=x.sibling,x.sibling=u,u=x,x=o}n1(a,!0,u,null,k,h);break;case"together":n1(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function ou(o,a,u){if(o!==null&&(a.dependencies=o.dependencies),ju|=a.lanes,(u&a.childLanes)===0)if(o!==null){if(Ml(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=ps(o,o.pendingProps),a.child=u,u.return=a;o.sibling!==null;)o=o.sibling,u=u.sibling=ps(o,o.pendingProps),u.return=a;u.sibling=null}return a.child}function r1(o,a){return(o.lanes&a)!==0?!0:(o=o.dependencies,!!(o!==null&&Ec(o)))}function p6(o,a,u){switch(a.tag){case 3:Ft(a,a.stateNode.containerInfo),Ca(a,Si,o.memoizedState.cache),Bs();break;case 27:case 5:Jt(a);break;case 4:Ft(a,a.stateNode.containerInfo);break;case 10:Ca(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,w(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(Yr(a),a.flags|=128,null):(u&a.child.childLanes)!==0?Gb(o,a,u):(Yr(a),o=ou(o,a,u),o!==null?o.sibling:null);Yr(a);break;case 19:var x=(o.flags&128)!==0;if(h=(u&a.childLanes)!==0,h||(Ml(o,a,u,!1),h=(u&a.childLanes)!==0),x){if(h)return Jb(o,a,u);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),Q(I,I.current),h)break;return null;case 22:return a.lanes=0,qb(o,a,u,a.pendingProps);case 24:Ca(a,Si,o.memoizedState.cache)}return ou(o,a,u)}function Zb(o,a,u){if(o!==null)if(o.memoizedProps!==a.pendingProps)Ao=!0;else{if(!r1(o,u)&&(a.flags&128)===0)return Ao=!1,p6(o,a,u);Ao=(o.flags&131072)!==0}else Ao=!1,rr&&(a.flags&1048576)!==0&&Ef(a,Mc,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")Xc(o)?(h=_f(o,h),a.tag=1,a=Wb(null,a,o,h,u)):(a.tag=0,a=K0(null,a,o,h,u));else{if(o!=null){var x=o.$$typeof;if(x===V){a.tag=11,a=Fb(null,a,o,h,u);break t}else if(x===kt){a.tag=14,a=Ub(null,a,o,h,u);break t}}throw a=vt(o)||o,Error(r(306,a,""))}}return a;case 0:return K0(o,a,a.type,a.pendingProps,u);case 1:return h=a.type,x=_f(h,a.pendingProps),Wb(o,a,h,x,u);case 3:t:{if(Ft(a,a.stateNode.containerInfo),o===null)throw Error(r(387));h=a.pendingProps;var k=a.memoizedState;x=k.element,oi(o,a),ji(a,h,null,u);var P=a.memoizedState;if(h=P.cache,Ca(a,Si,h),h!==k.cache&&vs(a,[Si],u,!0),Nr(),h=P.element,k.isDehydrated)if(k={element:h,isDehydrated:!1,cache:P.cache},a.updateQueue.baseState=k,a.memoizedState=k,a.flags&256){a=Xb(o,a,h,u);break t}else if(h!==x){x=ms(Error(r(424)),a),kl(x),a=Xb(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,Lr=Tl(o.firstChild),$r=a,rr=!0,Io=null,ii=!0,u=zn(a,null,h,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Bs(),h===x){a=ou(o,a,u);break t}ws(o,a,h,u)}a=a.child}return a;case 26:return Hp(o,a),o===null?(u=cv(a.type,null,a.pendingProps,null))?a.memoizedState=u:rr||(u=a.type,o=a.pendingProps,h=om(wt.current).createElement(u),h[pr]=a,h[Cr]=o,Ss(h,u,o),di(h),a.stateNode=h):a.memoizedState=cv(a.type,o.memoizedProps,a.pendingProps,o.memoizedState),null;case 27:return Jt(a),o===null&&rr&&(h=a.stateNode=sv(a.type,a.pendingProps,wt.current),$r=a,ii=!0,x=Lr,Hu(a.type)?(I1=x,Lr=Tl(h.firstChild)):Lr=x),ws(o,a,a.pendingProps.children,u),Hp(o,a),o===null&&(a.flags|=4194304),a.child;case 5:return o===null&&rr&&((x=h=Lr)&&(h=$6(h,a.type,a.pendingProps,ii),h!==null?(a.stateNode=h,$r=a,Lr=Tl(h.firstChild),ii=!1,x=!0):x=!1),x||Sl(a)),Jt(a),x=a.type,k=a.pendingProps,P=o!==null?o.memoizedProps:null,h=k.children,D1(x,k)?h=null:P!==null&&D1(x,P)&&(a.flags|=32),a.memoizedState!==null&&(x=Wt(o,a,Ee,null,null,u),Nh._currentValue=x),Hp(o,a),ws(o,a,h,u),a.child;case 6:return o===null&&rr&&((o=u=Lr)&&(u=Y6(u,a.pendingProps,ii),u!==null?(a.stateNode=u,$r=a,Lr=null,o=!0):o=!1),o||Sl(a)),null;case 13:return Gb(o,a,u);case 4:return Ft(a,a.stateNode.containerInfo),h=a.pendingProps,o===null?a.child=zr(a,null,h,u):ws(o,a,h,u),a.child;case 11:return Fb(o,a,a.type,a.pendingProps,u);case 7:return ws(o,a,a.pendingProps,u),a.child;case 8:return ws(o,a,a.pendingProps.children,u),a.child;case 12:return ws(o,a,a.pendingProps.children,u),a.child;case 10:return h=a.pendingProps,Ca(a,a.type,h.value),ws(o,a,h.children,u),a.child;case 9:return x=a.type._context,h=a.pendingProps.children,$i(a),x=Yi(x),h=h(x),a.flags|=1,ws(o,a,h,u),a.child;case 14:return Ub(o,a,a.type,a.pendingProps,u);case 15:return Hb(o,a,a.type,a.pendingProps,u);case 19:return Jb(o,a,u);case 31:return h6(o,a,u);case 22:return qb(o,a,u,a.pendingProps);case 24:return $i(a),h=Yi(Si),o===null?(x=ot(),x===null&&(x=ai,k=oa(),x.pooledCache=k,k.refCount++,k!==null&&(x.pooledCacheLanes|=u),x=k),a.memoizedState={parent:h,cache:x},Pe(a),Ca(a,Si,x)):((o.lanes&u)!==0&&(oi(o,a),ji(a,null,null,u),Nr()),x=o.memoizedState,k=a.memoizedState,x.parent!==h?(x={parent:h,cache:h},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),Ca(a,Si,h)):(h=k.cache,Ca(a,Si,h),h!==x.cache&&vs(a,[Si],u,!0))),ws(o,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function su(o){o.flags|=4}function i1(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(Mx())o.flags|=8192;else throw ne=Pt,Vt}else o.flags&=-16777217}function Qb(o,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!pv(a))if(Mx())o.flags|=8192;else throw ne=Pt,Vt}function $p(o,a){a!==null&&(o.flags|=4),o.flags&16384&&(a=o.tag!==22?xr():536870912,o.lanes|=a,xd|=a)}function mh(o,a){if(!rr)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 Mi(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 m6(o,a,u){var h=a.pendingProps;switch(zs(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mi(a),null;case 1:return Mi(a),null;case 3:return u=a.stateNode,h=null,o!==null&&(h=o.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),xs(Si),Rt(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(o===null||o.child===null)&&(Pi(a)?su(a):o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Zc())),Mi(a),null;case 26:var x=a.type,k=a.memoizedState;return o===null?(su(a),k!==null?(Mi(a),Qb(a,k)):(Mi(a),i1(a,x,null,h,u))):k?k!==o.memoizedState?(su(a),Mi(a),Qb(a,k)):(Mi(a),a.flags&=-16777217):(o=o.memoizedProps,o!==h&&su(a),Mi(a),i1(a,x,o,h,u)),null;case 27:if(ke(a),u=wt.current,x=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==h&&su(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return Mi(a),null}o=tt.current,Pi(a)?Ru(a):(o=sv(x,h,u),a.stateNode=o,su(a))}return Mi(a),null;case 5:if(ke(a),x=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==h&&su(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return Mi(a),null}if(k=tt.current,Pi(a))Ru(a);else{var P=om(wt.current);switch(k){case 1:k=P.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:k=P.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":k=P.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":k=P.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":k=P.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof h.is=="string"?P.createElement("select",{is:h.is}):P.createElement("select"),h.multiple?k.multiple=!0:h.size&&(k.size=h.size);break;default:k=typeof h.is=="string"?P.createElement(x,{is:h.is}):P.createElement(x)}}k[pr]=a,k[Cr]=h;t:for(P=a.child;P!==null;){if(P.tag===5||P.tag===6)k.appendChild(P.stateNode);else if(P.tag!==4&&P.tag!==27&&P.child!==null){P.child.return=P,P=P.child;continue}if(P===a)break t;for(;P.sibling===null;){if(P.return===null||P.return===a)break t;P=P.return}P.sibling.return=P.return,P=P.sibling}a.stateNode=k;t:switch(Ss(k,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&&su(a)}}return Mi(a),i1(a,a.type,o===null?null:o.memoizedProps,a.pendingProps,u),null;case 6:if(o&&a.stateNode!=null)o.memoizedProps!==h&&su(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(r(166));if(o=wt.current,Pi(a)){if(o=a.stateNode,u=a.memoizedProps,h=null,x=$r,x!==null)switch(x.tag){case 27:case 5:h=x.memoizedProps}o[pr]=a,o=!!(o.nodeValue===u||h!==null&&h.suppressHydrationWarning===!0||Gx(o.nodeValue,u)),o||Sl(a,!0)}else o=om(o).createTextNode(h),o[pr]=a,a.stateNode=o}return Mi(a),null;case 31:if(u=a.memoizedState,o===null||o.memoizedState!==null){if(h=Pi(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[pr]=a}else Bs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Mi(a),o=!1}else u=Zc(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=u),o=!0;if(!o)return a.flags&256?(_(a),a):(_(a),null);if((a.flags&128)!==0)throw Error(r(558))}return Mi(a),null;case 13:if(h=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(x=Pi(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[pr]=a}else Bs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Mi(a),x=!1}else x=Zc(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(_(a),a):(_(a),null)}return _(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),k=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(k=h.memoizedState.cachePool.pool),k!==x&&(h.flags|=2048)),u!==o&&u&&(a.child.flags|=8192),$p(a,a.updateQueue),Mi(a),null);case 4:return Rt(),o===null&&C1(a.stateNode.containerInfo),Mi(a),null;case 10:return xs(a.type),Mi(a),null;case 19:if(N(I),h=a.memoizedState,h===null)return Mi(a),null;if(x=(a.flags&128)!==0,k=h.rendering,k===null)if(x)mh(h,!1);else{if(Ji!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(k=K(o),k!==null){for(a.flags|=128,mh(h,!1),o=k.updateQueue,a.updateQueue=o,$p(a,o),a.subtreeFlags=0,o=u,u=a.child;u!==null;)Gc(u,o),u=u.sibling;return Q(I,I.current&1|2),rr&&Go(a,h.treeForkCount),a.child}o=o.sibling}h.tail!==null&&tn()>Gp&&(a.flags|=128,x=!0,mh(h,!1),a.lanes=4194304)}else{if(!x)if(o=K(k),o!==null){if(a.flags|=128,x=!0,o=o.updateQueue,a.updateQueue=o,$p(a,o),mh(h,!0),h.tail===null&&h.tailMode==="hidden"&&!k.alternate&&!rr)return Mi(a),null}else 2*tn()-h.renderingStartTime>Gp&&u!==536870912&&(a.flags|=128,x=!0,mh(h,!1),a.lanes=4194304);h.isBackwards?(k.sibling=a.child,a.child=k):(o=h.last,o!==null?o.sibling=k:a.child=k,h.last=k)}return h.tail!==null?(o=h.tail,h.rendering=o,h.tail=o.sibling,h.renderingStartTime=tn(),o.sibling=null,u=I.current,Q(I,x?u&1|2:u&1),rr&&Go(a,h.treeForkCount),o):(Mi(a),null);case 22:case 23:return _(a),si(),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&&(Mi(a),a.subtreeFlags&6&&(a.flags|=8192)):Mi(a),u=a.updateQueue,u!==null&&$p(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&&N(X),null;case 24:return u=null,o!==null&&(u=o.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),xs(Si),Mi(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function g6(o,a){switch(zs(a),a.tag){case 1:return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return xs(Si),Rt(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 26:case 27:case 5:return ke(a),null;case 31:if(a.memoizedState!==null){if(_(a),a.alternate===null)throw Error(r(340));Bs()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 13:if(_(a),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(r(340));Bs()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return N(I),null;case 4:return Rt(),null;case 10:return xs(a.type),null;case 22:case 23:return _(a),si(),o!==null&&N(X),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 24:return xs(Si),null;case 25:return null;default:return null}}function tx(o,a){switch(zs(a),a.tag){case 3:xs(Si),Rt();break;case 26:case 27:case 5:ke(a);break;case 4:Rt();break;case 31:a.memoizedState!==null&&_(a);break;case 13:_(a);break;case 19:N(I);break;case 10:xs(a.type);break;case 22:case 23:_(a),si(),o!==null&&N(X);break;case 24:xs(Si)}}function gh(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 k=u.create,P=u.inst;h=k(),P.destroy=h}u=u.next}while(u!==x)}}catch(et){Wr(a,a.return,et)}}function Pu(o,a,u){try{var h=a.updateQueue,x=h!==null?h.lastEffect:null;if(x!==null){var k=x.next;h=k;do{if((h.tag&o)===o){var P=h.inst,et=P.destroy;if(et!==void 0){P.destroy=void 0,x=a;var Tt=u,Gt=et;try{Gt()}catch(le){Wr(x,Tt,le)}}}h=h.next}while(h!==k)}}catch(le){Wr(a,a.return,le)}}function ex(o){var a=o.updateQueue;if(a!==null){var u=o.stateNode;try{gi(a,u)}catch(h){Wr(o,o.return,h)}}}function nx(o,a,u){u.props=_f(o.type,o.memoizedProps),u.state=o.memoizedState;try{u.componentWillUnmount()}catch(h){Wr(o,a,h)}}function yh(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){Wr(o,a,x)}}function Nc(o,a){var u=o.ref,h=o.refCleanup;if(u!==null)if(typeof h=="function")try{h()}catch(x){Wr(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){Wr(o,a,x)}else u.current=null}function rx(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){Wr(o,o.return,x)}}function o1(o,a,u){try{var h=o.stateNode;z6(h,o.type,u,a),h[Cr]=a}catch(x){Wr(o,o.return,x)}}function ix(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Hu(o.type)||o.tag===4}function s1(o){t:for(;;){for(;o.sibling===null;){if(o.return===null||ix(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&&Hu(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 a1(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=Ro));else if(h!==4&&(h===27&&Hu(o.type)&&(u=o.stateNode,a=null),o=o.child,o!==null))for(a1(o,a,u),o=o.sibling;o!==null;)a1(o,a,u),o=o.sibling}function Yp(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&&Hu(o.type)&&(u=o.stateNode),o=o.child,o!==null))for(Yp(o,a,u),o=o.sibling;o!==null;)Yp(o,a,u),o=o.sibling}function ox(o){var a=o.stateNode,u=o.memoizedProps;try{for(var h=o.type,x=a.attributes;x.length;)a.removeAttributeNode(x[0]);Ss(a,h,u),a[pr]=o,a[Cr]=u}catch(k){Wr(o,o.return,k)}}var au=!1,Mo=!1,l1=!1,sx=typeof WeakSet=="function"?WeakSet:Set,Ko=null;function y6(o,a){if(o=o.containerInfo,N1=dm,o=Xl(o),ka(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,k=h.focusNode;h=h.focusOffset;try{u.nodeType,k.nodeType}catch{u=null;break t}var P=0,et=-1,Tt=-1,Gt=0,le=0,me=o,Kt=null;e:for(;;){for(var ee;me!==u||x!==0&&me.nodeType!==3||(et=P+x),me!==k||h!==0&&me.nodeType!==3||(Tt=P+h),me.nodeType===3&&(P+=me.nodeValue.length),(ee=me.firstChild)!==null;)Kt=me,me=ee;for(;;){if(me===o)break e;if(Kt===u&&++Gt===x&&(et=P),Kt===k&&++le===h&&(Tt=P),(ee=me.nextSibling)!==null)break;me=Kt,Kt=me.parentNode}me=ee}u=et===-1||Tt===-1?null:{start:et,end:Tt}}else u=null}u=u||{start:0,end:0}}else u=null;for(_1={focusedElem:o,selectionRange:u},dm=!1,Ko=a;Ko!==null;)if(a=Ko,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,Ko=o;else for(;Ko!==null;){switch(a=Ko,k=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&&k!==null){o=void 0,u=a,x=k.memoizedProps,k=k.memoizedState,h=u.stateNode;try{var nn=_f(u.type,x);o=h.getSnapshotBeforeUpdate(nn,k),h.__reactInternalSnapshotBeforeUpdate=o}catch(_n){Wr(u,u.return,_n)}}break;case 3:if((o&1024)!==0){if(o=a.stateNode.containerInfo,u=o.nodeType,u===9)R1(o);else if(u===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":R1(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,Ko=o;break}Ko=a.return}}function ax(o,a,u){var h=u.flags;switch(u.tag){case 0:case 11:case 15:cu(o,u),h&4&&gh(5,u);break;case 1:if(cu(o,u),h&4)if(o=u.stateNode,a===null)try{o.componentDidMount()}catch(P){Wr(u,u.return,P)}else{var x=_f(u.type,a.memoizedProps);a=a.memoizedState;try{o.componentDidUpdate(x,a,o.__reactInternalSnapshotBeforeUpdate)}catch(P){Wr(u,u.return,P)}}h&64&&ex(u),h&512&&yh(u,u.return);break;case 3:if(cu(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{gi(o,a)}catch(P){Wr(u,u.return,P)}}break;case 27:a===null&&h&4&&ox(u);case 26:case 5:cu(o,u),a===null&&h&4&&rx(u),h&512&&yh(u,u.return);break;case 12:cu(o,u);break;case 31:cu(o,u),h&4&&ux(o,u);break;case 13:cu(o,u),h&4&&fx(o,u),h&64&&(o=u.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(u=C6.bind(null,u),V6(o,u))));break;case 22:if(h=u.memoizedState!==null||au,!h){a=a!==null&&a.memoizedState!==null||Mo,x=au;var k=Mo;au=h,(Mo=a)&&!k?uu(o,u,(u.subtreeFlags&8772)!==0):cu(o,u),au=x,Mo=k}break;case 30:break;default:cu(o,u)}}function lx(o){var a=o.alternate;a!==null&&(o.alternate=null,lx(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&pa(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 zi=null,Ea=!1;function lu(o,a,u){for(u=u.child;u!==null;)cx(o,a,u),u=u.sibling}function cx(o,a,u){if(an&&typeof an.onCommitFiberUnmount=="function")try{an.onCommitFiberUnmount(bn,u)}catch{}switch(u.tag){case 26:Mo||Nc(u,a),lu(o,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:Mo||Nc(u,a);var h=zi,x=Ea;Hu(u.type)&&(zi=u.stateNode,Ea=!1),lu(o,a,u),Ch(u.stateNode),zi=h,Ea=x;break;case 5:Mo||Nc(u,a);case 6:if(h=zi,x=Ea,zi=null,lu(o,a,u),zi=h,Ea=x,zi!==null)if(Ea)try{(zi.nodeType===9?zi.body:zi.nodeName==="HTML"?zi.ownerDocument.body:zi).removeChild(u.stateNode)}catch(k){Wr(u,a,k)}else try{zi.removeChild(u.stateNode)}catch(k){Wr(u,a,k)}break;case 18:zi!==null&&(Ea?(o=zi,ev(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,u.stateNode),Ed(o)):ev(zi,u.stateNode));break;case 4:h=zi,x=Ea,zi=u.stateNode.containerInfo,Ea=!0,lu(o,a,u),zi=h,Ea=x;break;case 0:case 11:case 14:case 15:Pu(2,u,a),Mo||Pu(4,u,a),lu(o,a,u);break;case 1:Mo||(Nc(u,a),h=u.stateNode,typeof h.componentWillUnmount=="function"&&nx(u,a,h)),lu(o,a,u);break;case 21:lu(o,a,u);break;case 22:Mo=(h=Mo)||u.memoizedState!==null,lu(o,a,u),Mo=h;break;default:lu(o,a,u)}}function ux(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{Ed(o)}catch(u){Wr(a,a.return,u)}}}function fx(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{Ed(o)}catch(u){Wr(a,a.return,u)}}function b6(o){switch(o.tag){case 31:case 13:case 19:var a=o.stateNode;return a===null&&(a=o.stateNode=new sx),a;case 22:return o=o.stateNode,a=o._retryCache,a===null&&(a=o._retryCache=new sx),a;default:throw Error(r(435,o.tag))}}function Vp(o,a){var u=b6(o);a.forEach(function(h){if(!u.has(h)){u.add(h);var x=E6.bind(null,o,h);h.then(x,x)}})}function Ta(o,a){var u=a.deletions;if(u!==null)for(var h=0;h<u.length;h++){var x=u[h],k=o,P=a,et=P;t:for(;et!==null;){switch(et.tag){case 27:if(Hu(et.type)){zi=et.stateNode,Ea=!1;break t}break;case 5:zi=et.stateNode,Ea=!1;break t;case 3:case 4:zi=et.stateNode.containerInfo,Ea=!0;break t}et=et.return}if(zi===null)throw Error(r(160));cx(k,P,x),zi=null,Ea=!1,k=x.alternate,k!==null&&(k.return=null),x.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)dx(a,o),a=a.sibling}var ic=null;function dx(o,a){var u=o.alternate,h=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:Ta(a,o),Na(o),h&4&&(Pu(3,o,o.return),gh(3,o),Pu(5,o,o.return));break;case 1:Ta(a,o),Na(o),h&512&&(Mo||u===null||Nc(u,u.return)),h&64&&au&&(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=ic;if(Ta(a,o),Na(o),h&512&&(Mo||u===null||Nc(u,u.return)),h&4){var k=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":k=x.getElementsByTagName("title")[0],(!k||k[es]||k[pr]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=x.createElement(h),x.head.insertBefore(k,x.querySelector("head > title"))),Ss(k,h,u),k[pr]=o,di(k),h=k;break t;case"link":var P=dv("link","href",x).get(h+(u.href||""));if(P){for(var et=0;et<P.length;et++)if(k=P[et],k.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&k.getAttribute("rel")===(u.rel==null?null:u.rel)&&k.getAttribute("title")===(u.title==null?null:u.title)&&k.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){P.splice(et,1);break e}}k=x.createElement(h),Ss(k,h,u),x.head.appendChild(k);break;case"meta":if(P=dv("meta","content",x).get(h+(u.content||""))){for(et=0;et<P.length;et++)if(k=P[et],k.getAttribute("content")===(u.content==null?null:""+u.content)&&k.getAttribute("name")===(u.name==null?null:u.name)&&k.getAttribute("property")===(u.property==null?null:u.property)&&k.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&k.getAttribute("charset")===(u.charSet==null?null:u.charSet)){P.splice(et,1);break e}}k=x.createElement(h),Ss(k,h,u),x.head.appendChild(k);break;default:throw Error(r(468,h))}k[pr]=o,di(k),h=k}o.stateNode=h}else hv(x,o.type,o.stateNode);else o.stateNode=fv(x,h,o.memoizedProps);else k!==h?(k===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):k.count--,h===null?hv(x,o.type,o.stateNode):fv(x,h,o.memoizedProps)):h===null&&o.stateNode!==null&&o1(o,o.memoizedProps,u.memoizedProps)}break;case 27:Ta(a,o),Na(o),h&512&&(Mo||u===null||Nc(u,u.return)),u!==null&&h&4&&o1(o,o.memoizedProps,u.memoizedProps);break;case 5:if(Ta(a,o),Na(o),h&512&&(Mo||u===null||Nc(u,u.return)),o.flags&32){x=o.stateNode;try{$o(x,"")}catch(nn){Wr(o,o.return,nn)}}h&4&&o.stateNode!=null&&(x=o.memoizedProps,o1(o,x,u!==null?u.memoizedProps:x)),h&1024&&(l1=!0);break;case 6:if(Ta(a,o),Na(o),h&4){if(o.stateNode===null)throw Error(r(162));h=o.memoizedProps,u=o.stateNode;try{u.nodeValue=h}catch(nn){Wr(o,o.return,nn)}}break;case 3:if(lm=null,x=ic,ic=sm(a.containerInfo),Ta(a,o),ic=x,Na(o),h&4&&u!==null&&u.memoizedState.isDehydrated)try{Ed(a.containerInfo)}catch(nn){Wr(o,o.return,nn)}l1&&(l1=!1,hx(o));break;case 4:h=ic,ic=sm(o.stateNode.containerInfo),Ta(a,o),Na(o),ic=h;break;case 12:Ta(a,o),Na(o);break;case 31:Ta(a,o),Na(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,Vp(o,h)));break;case 13:Ta(a,o),Na(o),o.child.flags&8192&&o.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(Xp=tn()),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,Vp(o,h)));break;case 22:x=o.memoizedState!==null;var Tt=u!==null&&u.memoizedState!==null,Gt=au,le=Mo;if(au=Gt||x,Mo=le||Tt,Ta(a,o),Mo=le,au=Gt,Na(o),h&8192)t:for(a=o.stateNode,a._visibility=x?a._visibility&-2:a._visibility|1,x&&(u===null||Tt||au||Mo||Df(o)),u=null,a=o;;){if(a.tag===5||a.tag===26){if(u===null){Tt=u=a;try{if(k=Tt.stateNode,x)P=k.style,typeof P.setProperty=="function"?P.setProperty("display","none","important"):P.display="none";else{et=Tt.stateNode;var me=Tt.memoizedProps.style,Kt=me!=null&&me.hasOwnProperty("display")?me.display:null;et.style.display=Kt==null||typeof Kt=="boolean"?"":(""+Kt).trim()}}catch(nn){Wr(Tt,Tt.return,nn)}}}else if(a.tag===6){if(u===null){Tt=a;try{Tt.stateNode.nodeValue=x?"":Tt.memoizedProps}catch(nn){Wr(Tt,Tt.return,nn)}}}else if(a.tag===18){if(u===null){Tt=a;try{var ee=Tt.stateNode;x?nv(ee,!0):nv(Tt.stateNode,!1)}catch(nn){Wr(Tt,Tt.return,nn)}}}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,Vp(o,u))));break;case 19:Ta(a,o),Na(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,Vp(o,h)));break;case 30:break;case 21:break;default:Ta(a,o),Na(o)}}function Na(o){var a=o.flags;if(a&2){try{for(var u,h=o.return;h!==null;){if(ix(h)){u=h;break}h=h.return}if(u==null)throw Error(r(160));switch(u.tag){case 27:var x=u.stateNode,k=s1(o);Yp(o,k,x);break;case 5:var P=u.stateNode;u.flags&32&&($o(P,""),u.flags&=-33);var et=s1(o);Yp(o,et,P);break;case 3:case 4:var Tt=u.stateNode.containerInfo,Gt=s1(o);a1(o,Gt,Tt);break;default:throw Error(r(161))}}catch(le){Wr(o,o.return,le)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function hx(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var a=o;hx(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),o=o.sibling}}function cu(o,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)ax(o,a.alternate,a),a=a.sibling}function Df(o){for(o=o.child;o!==null;){var a=o;switch(a.tag){case 0:case 11:case 14:case 15:Pu(4,a,a.return),Df(a);break;case 1:Nc(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&nx(a,a.return,u),Df(a);break;case 27:Ch(a.stateNode);case 26:case 5:Nc(a,a.return),Df(a);break;case 22:a.memoizedState===null&&Df(a);break;case 30:Df(a);break;default:Df(a)}o=o.sibling}}function uu(o,a,u){for(u=u&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,x=o,k=a,P=k.flags;switch(k.tag){case 0:case 11:case 15:uu(x,k,u),gh(4,k);break;case 1:if(uu(x,k,u),h=k,x=h.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(Gt){Wr(h,h.return,Gt)}if(h=k,x=h.updateQueue,x!==null){var et=h.stateNode;try{var Tt=x.shared.hiddenCallbacks;if(Tt!==null)for(x.shared.hiddenCallbacks=null,x=0;x<Tt.length;x++)So(Tt[x],et)}catch(Gt){Wr(h,h.return,Gt)}}u&&P&64&&ex(k),yh(k,k.return);break;case 27:ox(k);case 26:case 5:uu(x,k,u),u&&h===null&&P&4&&rx(k),yh(k,k.return);break;case 12:uu(x,k,u);break;case 31:uu(x,k,u),u&&P&4&&ux(x,k);break;case 13:uu(x,k,u),u&&P&4&&fx(x,k);break;case 22:k.memoizedState===null&&uu(x,k,u),yh(k,k.return);break;case 30:break;default:uu(x,k,u)}a=a.sibling}}function c1(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&&Tc(u))}function u1(o,a){o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&Tc(o))}function oc(o,a,u,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)px(o,a,u,h),a=a.sibling}function px(o,a,u,h){var x=a.flags;switch(a.tag){case 0:case 11:case 15:oc(o,a,u,h),x&2048&&gh(9,a);break;case 1:oc(o,a,u,h);break;case 3:oc(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&&Tc(o)));break;case 12:if(x&2048){oc(o,a,u,h),o=a.stateNode;try{var k=a.memoizedProps,P=k.id,et=k.onPostCommit;typeof et=="function"&&et(P,a.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(Tt){Wr(a,a.return,Tt)}}else oc(o,a,u,h);break;case 31:oc(o,a,u,h);break;case 13:oc(o,a,u,h);break;case 23:break;case 22:k=a.stateNode,P=a.alternate,a.memoizedState!==null?k._visibility&2?oc(o,a,u,h):bh(o,a):k._visibility&2?oc(o,a,u,h):(k._visibility|=2,gd(o,a,u,h,(a.subtreeFlags&10256)!==0||!1)),x&2048&&c1(P,a);break;case 24:oc(o,a,u,h),x&2048&&u1(a.alternate,a);break;default:oc(o,a,u,h)}}function gd(o,a,u,h,x){for(x=x&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var k=o,P=a,et=u,Tt=h,Gt=P.flags;switch(P.tag){case 0:case 11:case 15:gd(k,P,et,Tt,x),gh(8,P);break;case 23:break;case 22:var le=P.stateNode;P.memoizedState!==null?le._visibility&2?gd(k,P,et,Tt,x):bh(k,P):(le._visibility|=2,gd(k,P,et,Tt,x)),x&&Gt&2048&&c1(P.alternate,P);break;case 24:gd(k,P,et,Tt,x),x&&Gt&2048&&u1(P.alternate,P);break;default:gd(k,P,et,Tt,x)}a=a.sibling}}function bh(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:bh(u,h),x&2048&&c1(h.alternate,h);break;case 24:bh(u,h),x&2048&&u1(h.alternate,h);break;default:bh(u,h)}a=a.sibling}}var xh=8192;function yd(o,a,u){if(o.subtreeFlags&xh)for(o=o.child;o!==null;)mx(o,a,u),o=o.sibling}function mx(o,a,u){switch(o.tag){case 26:yd(o,a,u),o.flags&xh&&o.memoizedState!==null&&iE(u,ic,o.memoizedState,o.memoizedProps);break;case 5:yd(o,a,u);break;case 3:case 4:var h=ic;ic=sm(o.stateNode.containerInfo),yd(o,a,u),ic=h;break;case 22:o.memoizedState===null&&(h=o.alternate,h!==null&&h.memoizedState!==null?(h=xh,xh=16777216,yd(o,a,u),xh=h):yd(o,a,u));break;default:yd(o,a,u)}}function gx(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 vh(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];Ko=h,bx(h,o)}gx(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)yx(o),o=o.sibling}function yx(o){switch(o.tag){case 0:case 11:case 15:vh(o),o.flags&2048&&Pu(9,o,o.return);break;case 3:vh(o);break;case 12:vh(o);break;case 22:var a=o.stateNode;o.memoizedState!==null&&a._visibility&2&&(o.return===null||o.return.tag!==13)?(a._visibility&=-3,Wp(o)):vh(o);break;default:vh(o)}}function Wp(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];Ko=h,bx(h,o)}gx(o)}for(o=o.child;o!==null;){switch(a=o,a.tag){case 0:case 11:case 15:Pu(8,a,a.return),Wp(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,Wp(a));break;default:Wp(a)}o=o.sibling}}function bx(o,a){for(;Ko!==null;){var u=Ko;switch(u.tag){case 0:case 11:case 15:Pu(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:Tc(u.memoizedState.cache)}if(h=u.child,h!==null)h.return=u,Ko=h;else t:for(u=o;Ko!==null;){h=Ko;var x=h.sibling,k=h.return;if(lx(h),h===u){Ko=null;break t}if(x!==null){x.return=k,Ko=x;break t}Ko=k}}}var x6={getCacheForType:function(o){var a=Yi(Si),u=a.data.get(o);return u===void 0&&(u=o(),a.data.set(o,u)),u},cacheSignal:function(){return Yi(Si).controller.signal}},v6=typeof WeakMap=="function"?WeakMap:Map,jr=0,ai=null,fr=null,yr=0,Vr=0,Ka=null,Iu=!1,bd=!1,f1=!1,fu=0,Ji=0,ju=0,Lf=0,d1=0,Ja=0,xd=0,wh=null,_a=null,h1=!1,Xp=0,xx=0,Gp=1/0,Kp=null,zu=null,zo=0,Bu=null,vd=null,du=0,p1=0,m1=null,vx=null,Sh=0,g1=null;function Za(){return(jr&2)!==0&&yr!==0?yr&-yr:ht.T!==null?S1():_i()}function wx(){if(Ja===0)if((yr&536870912)===0||rr){var o=Qt;Qt<<=1,(Qt&3932160)===0&&(Qt=262144),Ja=o}else Ja=536870912;return o=Un.current,o!==null&&(o.flags|=32),Ja}function Da(o,a,u){(o===ai&&(Vr===2||Vr===9)||o.cancelPendingCommit!==null)&&(wd(o,0),Fu(o,yr,Ja,!1)),Ze(o,u),((jr&2)===0||o!==ai)&&(o===ai&&((jr&2)===0&&(Lf|=u),Ji===4&&Fu(o,yr,Ja,!1)),_c(o))}function Sx(o,a,u){if((jr&6)!==0)throw Error(r(327));var h=!u&&(a&127)===0&&(a&o.expiredLanes)===0||Zn(o,a),x=h?k6(o,a):b1(o,a,!0),k=h;do{if(x===0){bd&&!h&&Fu(o,a,0,!1);break}else{if(u=o.current.alternate,k&&!w6(u)){x=b1(o,a,!1),k=!1;continue}if(x===2){if(k=a,o.errorRecoveryDisabledLanes&k)var P=0;else P=o.pendingLanes&-536870913,P=P!==0?P:P&536870912?536870912:0;if(P!==0){a=P;t:{var et=o;x=wh;var Tt=et.current.memoizedState.isDehydrated;if(Tt&&(wd(et,P).flags|=256),P=b1(et,P,!1),P!==2){if(f1&&!Tt){et.errorRecoveryDisabledLanes|=k,Lf|=k,x=4;break t}k=_a,_a=x,k!==null&&(_a===null?_a=k:_a.push.apply(_a,k))}x=P}if(k=!1,x!==2)continue}}if(x===1){wd(o,0),Fu(o,a,0,!0);break}t:{switch(h=o,k=x,k){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Fu(h,a,Ja,!Iu);break t;case 2:_a=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(x=Xp+300-tn(),10<x)){if(Fu(h,a,Ja,!Iu),ve(h,0,!0)!==0)break t;du=a,h.timeoutHandle=Qx(kx.bind(null,h,u,_a,Kp,h1,a,Ja,Lf,xd,Iu,k,"Throttled",-0,0),x);break t}kx(h,u,_a,Kp,h1,a,Ja,Lf,xd,Iu,k,null,-0,0)}}break}while(!0);_c(o)}function kx(o,a,u,h,x,k,P,et,Tt,Gt,le,me,Kt,ee){if(o.timeoutHandle=-1,me=a.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ro},mx(a,k,me);var nn=(k&62914560)===k?Xp-tn():(k&4194048)===k?xx-tn():0;if(nn=oE(me,nn),nn!==null){du=k,o.cancelPendingCommit=nn(Dx.bind(null,o,a,k,u,h,x,P,et,Tt,le,me,null,Kt,ee)),Fu(o,k,P,!Gt);return}}Dx(o,a,k,u,h,x,P,et,Tt)}function w6(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],k=x.getSnapshot;x=x.value;try{if(!ur(k(),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 Fu(o,a,u,h){a&=~d1,a&=~Lf,o.suspendedLanes|=a,o.pingedLanes&=~a,h&&(o.warmLanes|=a),h=o.expirationTimes;for(var x=a;0<x;){var k=31-Bn(x),P=1<<k;h[k]=-1,x&=~P}u!==0&&Yt(o,u,a)}function Jp(){return(jr&6)===0?(kh(0),!1):!0}function y1(){if(fr!==null){if(Vr===0)var o=fr.return;else o=fr,ia=Xa=null,pe(o),he=null,en=0,o=fr;for(;o!==null;)tx(o.alternate,o),o=o.return;fr=null}}function wd(o,a){var u=o.timeoutHandle;u!==-1&&(o.timeoutHandle=-1,U6(u)),u=o.cancelPendingCommit,u!==null&&(o.cancelPendingCommit=null,u()),du=0,y1(),ai=o,fr=u=ps(o.current,null),yr=a,Vr=0,Ka=null,Iu=!1,bd=Zn(o,a),f1=!1,xd=Ja=d1=Lf=ju=Ji=0,_a=wh=null,h1=!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-Bn(h),k=1<<x;a|=o[x],h&=~k}return fu=a,wc(),u}function Ax(o,a){j=null,ht.H=hh,a===Et||a===mt?(a=se(),Vr=3):a===Vt?(a=se(),Vr=4):Vr=a===G0?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Ka=a,fr===null&&(Ji=1,Fp(o,ms(a,o.current)))}function Mx(){var o=Un.current;return o===null?!0:(yr&4194048)===yr?Qn===null:(yr&62914560)===yr||(yr&536870912)!==0?o===Qn:!1}function Cx(){var o=ht.H;return ht.H=hh,o===null?hh:o}function Ex(){var o=ht.A;return ht.A=x6,o}function Zp(){Ji=4,Iu||(yr&4194048)!==yr&&Un.current!==null||(bd=!0),(ju&134217727)===0&&(Lf&134217727)===0||ai===null||Fu(ai,yr,Ja,!1)}function b1(o,a,u){var h=jr;jr|=2;var x=Cx(),k=Ex();(ai!==o||yr!==a)&&(Kp=null,wd(o,a)),a=!1;var P=Ji;t:do try{if(Vr!==0&&fr!==null){var et=fr,Tt=Ka;switch(Vr){case 8:y1(),P=6;break t;case 3:case 2:case 9:case 6:Un.current===null&&(a=!0);var Gt=Vr;if(Vr=0,Ka=null,Sd(o,et,Tt,Gt),u&&bd){P=0;break t}break;default:Gt=Vr,Vr=0,Ka=null,Sd(o,et,Tt,Gt)}}S6(),P=Ji;break}catch(le){Ax(o,le)}while(!0);return a&&o.shellSuspendCounter++,ia=Xa=null,jr=h,ht.H=x,ht.A=k,fr===null&&(ai=null,yr=0,wc()),P}function S6(){for(;fr!==null;)Tx(fr)}function k6(o,a){var u=jr;jr|=2;var h=Cx(),x=Ex();ai!==o||yr!==a?(Kp=null,Gp=tn()+500,wd(o,a)):bd=Zn(o,a);t:do try{if(Vr!==0&&fr!==null){a=fr;var k=Ka;e:switch(Vr){case 1:Vr=0,Ka=null,Sd(o,a,k,1);break;case 2:case 9:if(Ht(k)){Vr=0,Ka=null,Nx(a);break}a=function(){Vr!==2&&Vr!==9||ai!==o||(Vr=7),_c(o)},k.then(a,a);break t;case 3:Vr=7;break t;case 4:Vr=5;break t;case 7:Ht(k)?(Vr=0,Ka=null,Nx(a)):(Vr=0,Ka=null,Sd(o,a,k,7));break;case 5:var P=null;switch(fr.tag){case 26:P=fr.memoizedState;case 5:case 27:var et=fr;if(P?pv(P):et.stateNode.complete){Vr=0,Ka=null;var Tt=et.sibling;if(Tt!==null)fr=Tt;else{var Gt=et.return;Gt!==null?(fr=Gt,Qp(Gt)):fr=null}break e}}Vr=0,Ka=null,Sd(o,a,k,5);break;case 6:Vr=0,Ka=null,Sd(o,a,k,6);break;case 8:y1(),Ji=6;break t;default:throw Error(r(462))}}A6();break}catch(le){Ax(o,le)}while(!0);return ia=Xa=null,ht.H=h,ht.A=x,jr=u,fr!==null?0:(ai=null,yr=0,wc(),Ji)}function A6(){for(;fr!==null&&!De();)Tx(fr)}function Tx(o){var a=Zb(o.alternate,o,fu);o.memoizedProps=o.pendingProps,a===null?Qp(o):fr=a}function Nx(o){var a=o,u=a.alternate;switch(a.tag){case 15:case 0:a=Vb(u,a,a.pendingProps,a.type,void 0,yr);break;case 11:a=Vb(u,a,a.pendingProps,a.type.render,a.ref,yr);break;case 5:pe(a);default:tx(u,a),a=fr=Gc(a,fu),a=Zb(u,a,fu)}o.memoizedProps=o.pendingProps,a===null?Qp(o):fr=a}function Sd(o,a,u,h){ia=Xa=null,pe(a),he=null,en=0;var x=a.return;try{if(d6(o,x,a,u,yr)){Ji=1,Fp(o,ms(u,o.current)),fr=null;return}}catch(k){if(x!==null)throw fr=x,k;Ji=1,Fp(o,ms(u,o.current)),fr=null;return}a.flags&32768?(rr||h===1?o=!0:bd||(yr&536870912)!==0?o=!1:(Iu=o=!0,(h===2||h===9||h===3||h===6)&&(h=Un.current,h!==null&&h.tag===13&&(h.flags|=16384))),_x(a,o)):Qp(a)}function Qp(o){var a=o;do{if((a.flags&32768)!==0){_x(a,Iu);return}o=a.return;var u=m6(a.alternate,a,fu);if(u!==null){fr=u;return}if(a=a.sibling,a!==null){fr=a;return}fr=a=o}while(a!==null);Ji===0&&(Ji=5)}function _x(o,a){do{var u=g6(o.alternate,o);if(u!==null){u.flags&=32767,fr=u;return}if(u=o.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(o=o.sibling,o!==null)){fr=o;return}fr=o=u}while(o!==null);Ji=6,fr=null}function Dx(o,a,u,h,x,k,P,et,Tt){o.cancelPendingCommit=null;do tm();while(zo!==0);if((jr&6)!==0)throw Error(r(327));if(a!==null){if(a===o.current)throw Error(r(177));if(k=a.lanes|a.childLanes,k|=Yc,ts(o,u,k,P,et,Tt),o===ai&&(fr=ai=null,yr=0),vd=a,Bu=o,du=u,p1=k,m1=x,vx=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,T6(hn,function(){return Ix(),null})):(o.callbackNode=null,o.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=ht.T,ht.T=null,x=Z.p,Z.p=2,P=jr,jr|=4;try{y6(o,a,u)}finally{jr=P,Z.p=x,ht.T=h}}zo=1,Lx(),Rx(),Ox()}}function Lx(){if(zo===1){zo=0;var o=Bu,a=vd,u=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||u){u=ht.T,ht.T=null;var h=Z.p;Z.p=2;var x=jr;jr|=4;try{dx(a,o);var k=_1,P=Xl(o.containerInfo),et=k.focusedElem,Tt=k.selectionRange;if(P!==et&&et&&et.ownerDocument&&gl(et.ownerDocument.documentElement,et)){if(Tt!==null&&ka(et)){var Gt=Tt.start,le=Tt.end;if(le===void 0&&(le=Gt),"selectionStart"in et)et.selectionStart=Gt,et.selectionEnd=Math.min(le,et.value.length);else{var me=et.ownerDocument||document,Kt=me&&me.defaultView||window;if(Kt.getSelection){var ee=Kt.getSelection(),nn=et.textContent.length,_n=Math.min(Tt.start,nn),Zr=Tt.end===void 0?_n:Math.min(Tt.end,nn);!ee.extend&&_n>Zr&&(P=Zr,Zr=_n,_n=P);var Ut=vc(et,_n),Ot=vc(et,Zr);if(Ut&&Ot&&(ee.rangeCount!==1||ee.anchorNode!==Ut.node||ee.anchorOffset!==Ut.offset||ee.focusNode!==Ot.node||ee.focusOffset!==Ot.offset)){var Xt=me.createRange();Xt.setStart(Ut.node,Ut.offset),ee.removeAllRanges(),_n>Zr?(ee.addRange(Xt),ee.extend(Ot.node,Ot.offset)):(Xt.setEnd(Ot.node,Ot.offset),ee.addRange(Xt))}}}}for(me=[],ee=et;ee=ee.parentNode;)ee.nodeType===1&&me.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof et.focus=="function"&&et.focus(),et=0;et<me.length;et++){var ue=me[et];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}dm=!!N1,_1=N1=null}finally{jr=x,Z.p=h,ht.T=u}}o.current=a,zo=2}}function Rx(){if(zo===2){zo=0;var o=Bu,a=vd,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=ht.T,ht.T=null;var h=Z.p;Z.p=2;var x=jr;jr|=4;try{ax(o,a.alternate,a)}finally{jr=x,Z.p=h,ht.T=u}}zo=3}}function Ox(){if(zo===4||zo===3){zo=0,Fe();var o=Bu,a=vd,u=du,h=vx;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?zo=5:(zo=0,vd=Bu=null,Px(o,o.pendingLanes));var x=o.pendingLanes;if(x===0&&(zu=null),fi(u),a=a.stateNode,an&&typeof an.onCommitFiberRoot=="function")try{an.onCommitFiberRoot(bn,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=ht.T,x=Z.p,Z.p=2,ht.T=null;try{for(var k=o.onRecoverableError,P=0;P<h.length;P++){var et=h[P];k(et.value,{componentStack:et.stack})}}finally{ht.T=a,Z.p=x}}(du&3)!==0&&tm(),_c(o),x=o.pendingLanes,(u&261930)!==0&&(x&42)!==0?o===g1?Sh++:(Sh=0,g1=o):Sh=0,kh(0)}}function Px(o,a){(o.pooledCacheLanes&=a)===0&&(a=o.pooledCache,a!=null&&(o.pooledCache=null,Tc(a)))}function tm(){return Lx(),Rx(),Ox(),Ix()}function Ix(){if(zo!==5)return!1;var o=Bu,a=p1;p1=0;var u=fi(du),h=ht.T,x=Z.p;try{Z.p=32>u?32:u,ht.T=null,u=m1,m1=null;var k=Bu,P=du;if(zo=0,vd=Bu=null,du=0,(jr&6)!==0)throw Error(r(331));var et=jr;if(jr|=4,yx(k.current),px(k,k.current,P,u),jr=et,kh(0,!1),an&&typeof an.onPostCommitFiberRoot=="function")try{an.onPostCommitFiberRoot(bn,k)}catch{}return!0}finally{Z.p=x,ht.T=h,Px(o,a)}}function jx(o,a,u){a=ms(u,a),a=X0(o.stateNode,a,2),o=qn(o,a,2),o!==null&&(Ze(o,2),_c(o))}function Wr(o,a,u){if(o.tag===3)jx(o,o,u);else for(;a!==null;){if(a.tag===3){jx(a,o,u);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(zu===null||!zu.has(h))){o=ms(u,o),u=zb(2),h=qn(a,u,2),h!==null&&(Bb(u,h,a,o),Ze(h,2),_c(h));break}}a=a.return}}function x1(o,a,u){var h=o.pingCache;if(h===null){h=o.pingCache=new v6;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)||(f1=!0,x.add(u),o=M6.bind(null,o,a,u),a.then(o,o))}function M6(o,a,u){var h=o.pingCache;h!==null&&h.delete(a),o.pingedLanes|=o.suspendedLanes&u,o.warmLanes&=~u,ai===o&&(yr&u)===u&&(Ji===4||Ji===3&&(yr&62914560)===yr&&300>tn()-Xp?(jr&2)===0&&wd(o,0):d1|=u,xd===yr&&(xd=0)),_c(o)}function zx(o,a){a===0&&(a=xr()),o=Ma(o,a),o!==null&&(Ze(o,a),_c(o))}function C6(o){var a=o.memoizedState,u=0;a!==null&&(u=a.retryLane),zx(o,u)}function E6(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),zx(o,u)}function T6(o,a){return we(o,a)}var em=null,kd=null,v1=!1,nm=!1,w1=!1,Uu=0;function _c(o){o!==kd&&o.next===null&&(kd===null?em=kd=o:kd=kd.next=o),nm=!0,v1||(v1=!0,_6())}function kh(o,a){if(!w1&&nm){w1=!0;do for(var u=!1,h=em;h!==null;){if(o!==0){var x=h.pendingLanes;if(x===0)var k=0;else{var P=h.suspendedLanes,et=h.pingedLanes;k=(1<<31-Bn(42|o)+1)-1,k&=x&~(P&~et),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(u=!0,Hx(h,k))}else k=yr,k=ve(h,h===ai?k:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(k&3)===0||Zn(h,k)||(u=!0,Hx(h,k));h=h.next}while(u);w1=!1}}function N6(){Bx()}function Bx(){nm=v1=!1;var o=0;Uu!==0&&F6()&&(o=Uu);for(var a=tn(),u=null,h=em;h!==null;){var x=h.next,k=Fx(h,a);k===0?(h.next=null,u===null?em=x:u.next=x,x===null&&(kd=u)):(u=h,(o!==0||(k&3)!==0)&&(nm=!0)),h=x}zo!==0&&zo!==5||kh(o),Uu!==0&&(Uu=0)}function Fx(o,a){for(var u=o.suspendedLanes,h=o.pingedLanes,x=o.expirationTimes,k=o.pendingLanes&-62914561;0<k;){var P=31-Bn(k),et=1<<P,Tt=x[P];Tt===-1?((et&u)===0||(et&h)!==0)&&(x[P]=$n(et,a)):Tt<=a&&(o.expiredLanes|=et),k&=~et}if(a=ai,u=yr,u=ve(o,o===a?u:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h=o.callbackNode,u===0||o===a&&(Vr===2||Vr===9)||o.cancelPendingCommit!==null)return h!==null&&h!==null&&Ne(h),o.callbackNode=null,o.callbackPriority=0;if((u&3)===0||Zn(o,u)){if(a=u&-u,a===o.callbackPriority)return a;switch(h!==null&&Ne(h),fi(u)){case 2:case 8:u=In;break;case 32:u=hn;break;case 268435456:u=$e;break;default:u=hn}return h=Ux.bind(null,o),u=we(u,h),o.callbackPriority=a,o.callbackNode=u,a}return h!==null&&h!==null&&Ne(h),o.callbackPriority=2,o.callbackNode=null,2}function Ux(o,a){if(zo!==0&&zo!==5)return o.callbackNode=null,o.callbackPriority=0,null;var u=o.callbackNode;if(tm()&&o.callbackNode!==u)return null;var h=yr;return h=ve(o,o===ai?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h===0?null:(Sx(o,h,a),Fx(o,tn()),o.callbackNode!=null&&o.callbackNode===u?Ux.bind(null,o):null)}function Hx(o,a){if(tm())return null;Sx(o,a,!0)}function _6(){H6(function(){(jr&6)!==0?we(mn,N6):Bx()})}function S1(){if(Uu===0){var o=m;o===0&&(o=yn,yn<<=1,(yn&261888)===0&&(yn=256)),Uu=o}return Uu}function qx(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Ns(""+o)}function $x(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 D6(o,a,u,h,x){if(a==="submit"&&u&&u.stateNode===x){var k=qx((x[Cr]||null).action),P=h.submitter;P&&(a=(a=P[Cr]||null)?qx(a.formAction):P.getAttribute("formAction"),a!==null&&(k=a,P=null));var et=new as("action","action",null,h,x);o.push({event:et,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Uu!==0){var Tt=P?$x(x,P):new FormData(x);H0(u,{pending:!0,data:Tt,method:x.method,action:k},null,Tt)}}else typeof k=="function"&&(et.preventDefault(),Tt=P?$x(x,P):new FormData(x),H0(u,{pending:!0,data:Tt,method:x.method,action:k},k,Tt))},currentTarget:x}]})}}for(var k1=0;k1<Zl.length;k1++){var A1=Zl[k1],L6=A1.toLowerCase(),R6=A1[0].toUpperCase()+A1.slice(1);hs(L6,"on"+R6)}hs(Aa,"onAnimationEnd"),hs(Kl,"onAnimationIteration"),hs(bl,"onAnimationStart"),hs("dblclick","onDoubleClick"),hs("focusin","onFocus"),hs("focusout","onBlur"),hs(Jl,"onTransitionRun"),hs(Mf,"onTransitionStart"),hs(Cf,"onTransitionCancel"),hs(_u,"onTransitionEnd"),_o("onMouseEnter",["mouseout","mouseover"]),_o("onMouseLeave",["mouseout","mouseover"]),_o("onPointerEnter",["pointerout","pointerover"]),_o("onPointerLeave",["pointerout","pointerover"]),Uo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Uo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Uo("onBeforeInput",["compositionend","keypress","textInput","paste"]),Uo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Uo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Uo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ah="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(" "),O6=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ah));function Yx(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 k=void 0;if(a)for(var P=h.length-1;0<=P;P--){var et=h[P],Tt=et.instance,Gt=et.currentTarget;if(et=et.listener,Tt!==k&&x.isPropagationStopped())break t;k=et,x.currentTarget=Gt;try{k(x)}catch(le){$c(le)}x.currentTarget=null,k=Tt}else for(P=0;P<h.length;P++){if(et=h[P],Tt=et.instance,Gt=et.currentTarget,et=et.listener,Tt!==k&&x.isPropagationStopped())break t;k=et,x.currentTarget=Gt;try{k(x)}catch(le){$c(le)}x.currentTarget=null,k=Tt}}}}function dr(o,a){var u=a[Hr];u===void 0&&(u=a[Hr]=new Set);var h=o+"__bubble";u.has(h)||(Vx(a,o,2,!1),u.add(h))}function M1(o,a,u){var h=0;a&&(h|=4),Vx(u,o,h,a)}var rm="_reactListening"+Math.random().toString(36).slice(2);function C1(o){if(!o[rm]){o[rm]=!0,sl.forEach(function(u){u!=="selectionchange"&&(O6.has(u)||M1(u,!1,o),M1(u,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[rm]||(a[rm]=!0,M1("selectionchange",!1,a))}}function Vx(o,a,u,h){switch(wv(a)){case 2:var x=lE;break;case 8:x=cE;break;default:x=U1}u=x.bind(null,a,u,o),x=void 0,!Yo||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 E1(o,a,u,h,x){var k=h;if((a&1)===0&&(a&2)===0&&h!==null)t:for(;;){if(h===null)return;var P=h.tag;if(P===3||P===4){var et=h.stateNode.containerInfo;if(et===x)break;if(P===4)for(P=h.return;P!==null;){var Tt=P.tag;if((Tt===3||Tt===4)&&P.stateNode.containerInfo===x)return;P=P.return}for(;et!==null;){if(P=No(et),P===null)return;if(Tt=P.tag,Tt===5||Tt===6||Tt===26||Tt===27){h=k=P;continue t}et=et.parentNode}}h=h.return}yc(function(){var Gt=k,le=ql(u),me=[];t:{var Kt=Du.get(o);if(Kt!==void 0){var ee=as,nn=o;switch(o){case"keypress":if(bo(u)===0)break t;case"keydown":case"keyup":ee=jn;break;case"focusin":nn="focus",ee=va;break;case"focusout":nn="blur",ee=va;break;case"beforeblur":case"afterblur":ee=va;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=cl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ee=Os;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ee=pi;break;case Aa:case Kl:case bl:ee=wa;break;case _u:ee=Li;break;case"scroll":case"scrollend":ee=ta;break;case"wheel":ee=ei;break;case"copy":case"cut":case"paste":ee=A;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=Sn}var _n=(a&4)!==0,Zr=!_n&&(o==="scroll"||o==="scrollend"),Ut=_n?Kt!==null?Kt+"Capture":null:Kt;_n=[];for(var Ot=Gt,Xt;Ot!==null;){var ue=Ot;if(Xt=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||Xt===null||Ut===null||(ue=mr(Ot,Ut),ue!=null&&_n.push(Mh(Ot,ue,Xt))),Zr)break;Ot=Ot.return}0<_n.length&&(Kt=new ee(Kt,nn,null,u,le),me.push({event:Kt,listeners:_n}))}}if((a&7)===0){t:{if(Kt=o==="mouseover"||o==="pointerover",ee=o==="mouseout"||o==="pointerout",Kt&&u!==rs&&(nn=u.relatedTarget||u.fromElement)&&(No(nn)||nn[no]))break t;if((ee||Kt)&&(Kt=le.window===le?le:(Kt=le.ownerDocument)?Kt.defaultView||Kt.parentWindow:window,ee?(nn=u.relatedTarget||u.toElement,ee=Gt,nn=nn?No(nn):null,nn!==null&&(Zr=s(nn),_n=nn.tag,nn!==Zr||_n!==5&&_n!==27&&_n!==6)&&(nn=null)):(ee=null,nn=Gt),ee!==nn)){if(_n=cl,ue="onMouseLeave",Ut="onMouseEnter",Ot="mouse",(o==="pointerout"||o==="pointerover")&&(_n=cr,ue="onPointerLeave",Ut="onPointerEnter",Ot="pointer"),Zr=ee==null?Kt:pc(ee),Xt=nn==null?Kt:pc(nn),Kt=new _n(ue,Ot+"leave",ee,u,le),Kt.target=Zr,Kt.relatedTarget=Xt,ue=null,No(le)===Gt&&(_n=new _n(Ut,Ot+"enter",nn,u,le),_n.target=Xt,_n.relatedTarget=Zr,ue=_n),Zr=ue,ee&&nn)e:{for(_n=P6,Ut=ee,Ot=nn,Xt=0,ue=Ut;ue;ue=_n(ue))Xt++;ue=0;for(var wn=Ot;wn;wn=_n(wn))ue++;for(;0<Xt-ue;)Ut=_n(Ut),Xt--;for(;0<ue-Xt;)Ot=_n(Ot),ue--;for(;Xt--;){if(Ut===Ot||Ot!==null&&Ut===Ot.alternate){_n=Ut;break e}Ut=_n(Ut),Ot=_n(Ot)}_n=null}else _n=null;ee!==null&&Wx(me,Kt,ee,_n,!1),nn!==null&&Zr!==null&&Wx(me,Zr,nn,_n,!0)}}t:{if(Kt=Gt?pc(Gt):window,ee=Kt.nodeName&&Kt.nodeName.toLowerCase(),ee==="select"||ee==="input"&&Kt.type==="file")var Rr=us;else if(xc(Kt))if(Ha)Rr=mi;else{Rr=pl;var un=vo}else ee=Kt.nodeName,!ee||ee.toLowerCase()!=="input"||Kt.type!=="checkbox"&&Kt.type!=="radio"?Gt&&Hc(Gt.elementType)&&(Rr=us):Rr=ml;if(Rr&&(Rr=Rr(o,Gt))){dl(me,Rr,u,le);break t}un&&un(o,Kt,Gt),o==="focusout"&&Gt&&Kt.type==="number"&&Gt.memoizedProps.value!=null&&ll(Kt,"number",Kt.value)}switch(un=Gt?pc(Gt):window,o){case"focusin":(xc(un)||un.contentEditable==="true")&&(fs=un,js=Gt,ds=null);break;case"focusout":ds=js=fs=null;break;case"mousedown":yl=!0;break;case"contextmenu":case"mouseup":case"dragend":yl=!1,Wi(me,u,le);break;case"selectionchange":if(Gl)break;case"keydown":case"keyup":Wi(me,u,le)}var Jn;if(Fa)t:{switch(o){case"compositionstart":var br="onCompositionStart";break t;case"compositionend":br="onCompositionEnd";break t;case"compositionupdate":br="onCompositionUpdate";break t}br=void 0}else Wo?Oi(o,u)&&(br="onCompositionEnd"):o==="keydown"&&u.keyCode===229&&(br="onCompositionStart");br&&(wr&&u.locale!=="ko"&&(Wo||br!=="onCompositionStart"?br==="onCompositionEnd"&&Wo&&(Jn=za()):(ss=le,ba="value"in ss?ss.value:ss.textContent,Wo=!0)),un=im(Gt,br),0<un.length&&(br=new dt(br,o,null,u,le),me.push({event:br,listeners:un}),Jn?br.data=Jn:(Jn=fl(u),Jn!==null&&(br.data=Jn)))),(Jn=ul?bc(o,u):cs(o,u))&&(br=im(Gt,"onBeforeInput"),0<br.length&&(un=new dt("onBeforeInput","beforeinput",null,u,le),me.push({event:un,listeners:br}),un.data=Jn)),D6(me,o,Gt,u,le)}Yx(me,a)})}function Mh(o,a,u){return{instance:o,listener:a,currentTarget:u}}function im(o,a){for(var u=a+"Capture",h=[];o!==null;){var x=o,k=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||k===null||(x=mr(o,u),x!=null&&h.unshift(Mh(o,x,k)),x=mr(o,a),x!=null&&h.push(Mh(o,x,k))),o.tag===3)return h;o=o.return}return[]}function P6(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function Wx(o,a,u,h,x){for(var k=a._reactName,P=[];u!==null&&u!==h;){var et=u,Tt=et.alternate,Gt=et.stateNode;if(et=et.tag,Tt!==null&&Tt===h)break;et!==5&&et!==26&&et!==27||Gt===null||(Tt=Gt,x?(Gt=mr(u,k),Gt!=null&&P.unshift(Mh(u,Gt,Tt))):x||(Gt=mr(u,k),Gt!=null&&P.push(Mh(u,Gt,Tt)))),u=u.return}P.length!==0&&o.push({event:a,listeners:P})}var I6=/\r\n?/g,j6=/\u0000|\uFFFD/g;function Xx(o){return(typeof o=="string"?o:""+o).replace(I6,`
9
- `).replace(j6,"")}function Gx(o,a){return a=Xx(a),Xx(o)===a}function Jr(o,a,u,h,x,k){switch(u){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||$o(o,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&$o(o,""+h);break;case"className":ga(o,"class",h);break;case"tabIndex":ga(o,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":ga(o,u,h);break;case"style":Hl(o,h,k);break;case"data":if(a!=="object"){ga(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=Ns(""+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 k=="function"&&(u==="formAction"?(a!=="input"&&Jr(o,a,"name",x.name,x,null),Jr(o,a,"formEncType",x.formEncType,x,null),Jr(o,a,"formMethod",x.formMethod,x,null),Jr(o,a,"formTarget",x.formTarget,x,null)):(Jr(o,a,"encType",x.encType,x,null),Jr(o,a,"method",x.method,x,null),Jr(o,a,"target",x.target,x,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){o.removeAttribute(u);break}h=Ns(""+h),o.setAttribute(u,h);break;case"onClick":h!=null&&(o.onclick=Ro);break;case"onScroll":h!=null&&dr("scroll",o);break;case"onScrollEnd":h!=null&&dr("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=Ns(""+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":dr("beforetoggle",o),dr("toggle",o),ns(o,"popover",h);break;case"xlinkActuate":Lo(o,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":Lo(o,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":Lo(o,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":Lo(o,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":Lo(o,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":Lo(o,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":Lo(o,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":Lo(o,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":Lo(o,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":ns(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=Af.get(u)||u,ns(o,u,h))}}function T1(o,a,u,h,x,k){switch(u){case"style":Hl(o,h,k);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"?$o(o,h):(typeof h=="number"||typeof h=="bigint")&&$o(o,""+h);break;case"onScroll":h!=null&&dr("scroll",o);break;case"onScrollEnd":h!=null&&dr("scrollend",o);break;case"onClick":h!=null&&(o.onclick=Ro);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Fo.hasOwnProperty(u))t:{if(u[0]==="o"&&u[1]==="n"&&(x=u.endsWith("Capture"),a=u.slice(2,x?u.length-7:void 0),k=o[Cr]||null,k=k!=null?k[u]:null,typeof k=="function"&&o.removeEventListener(a,k,x),typeof h=="function")){typeof k!="function"&&k!==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,""):ns(o,u,h)}}}function Ss(o,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":dr("error",o),dr("load",o);var h=!1,x=!1,k;for(k in u)if(u.hasOwnProperty(k)){var P=u[k];if(P!=null)switch(k){case"src":h=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:Jr(o,a,k,P,u,null)}}x&&Jr(o,a,"srcSet",u.srcSet,u,null),h&&Jr(o,a,"src",u.src,u,null);return;case"input":dr("invalid",o);var et=k=P=x=null,Tt=null,Gt=null;for(h in u)if(u.hasOwnProperty(h)){var le=u[h];if(le!=null)switch(h){case"name":x=le;break;case"type":P=le;break;case"checked":Tt=le;break;case"defaultChecked":Gt=le;break;case"value":k=le;break;case"defaultValue":et=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(r(137,a));break;default:Jr(o,a,h,le,u,null)}}ya(o,k,et,Tt,Gt,P,x,!1);return;case"select":dr("invalid",o),h=P=k=null;for(x in u)if(u.hasOwnProperty(x)&&(et=u[x],et!=null))switch(x){case"value":k=et;break;case"defaultValue":P=et;break;case"multiple":h=et;default:Jr(o,a,x,et,u,null)}a=k,u=P,o.multiple=!!h,a!=null?qo(o,!!h,a,!1):u!=null&&qo(o,!!h,u,!0);return;case"textarea":dr("invalid",o),k=x=h=null;for(P in u)if(u.hasOwnProperty(P)&&(et=u[P],et!=null))switch(P){case"value":h=et;break;case"defaultValue":x=et;break;case"children":k=et;break;case"dangerouslySetInnerHTML":if(et!=null)throw Error(r(91));break;default:Jr(o,a,P,et,u,null)}Zs(o,h,x,k);return;case"option":for(Tt in u)u.hasOwnProperty(Tt)&&(h=u[Tt],h!=null)&&(Tt==="selected"?o.selected=h&&typeof h!="function"&&typeof h!="symbol":Jr(o,a,Tt,h,u,null));return;case"dialog":dr("beforetoggle",o),dr("toggle",o),dr("cancel",o),dr("close",o);break;case"iframe":case"object":dr("load",o);break;case"video":case"audio":for(h=0;h<Ah.length;h++)dr(Ah[h],o);break;case"image":dr("error",o),dr("load",o);break;case"details":dr("toggle",o);break;case"embed":case"source":case"link":dr("error",o),dr("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(Gt in u)if(u.hasOwnProperty(Gt)&&(h=u[Gt],h!=null))switch(Gt){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:Jr(o,a,Gt,h,u,null)}return;default:if(Hc(a)){for(le in u)u.hasOwnProperty(le)&&(h=u[le],h!==void 0&&T1(o,a,le,h,u,void 0));return}}for(et in u)u.hasOwnProperty(et)&&(h=u[et],h!=null&&Jr(o,a,et,h,u,null))}function z6(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,k=null,P=null,et=null,Tt=null,Gt=null,le=null;for(ee in u){var me=u[ee];if(u.hasOwnProperty(ee)&&me!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":Tt=me;default:h.hasOwnProperty(ee)||Jr(o,a,ee,null,h,me)}}for(var Kt in h){var ee=h[Kt];if(me=u[Kt],h.hasOwnProperty(Kt)&&(ee!=null||me!=null))switch(Kt){case"type":k=ee;break;case"name":x=ee;break;case"checked":Gt=ee;break;case"defaultChecked":le=ee;break;case"value":P=ee;break;case"defaultValue":et=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(r(137,a));break;default:ee!==me&&Jr(o,a,Kt,ee,h,me)}}Rn(o,P,et,Tt,Gt,le,k,x);return;case"select":ee=P=et=Kt=null;for(k in u)if(Tt=u[k],u.hasOwnProperty(k)&&Tt!=null)switch(k){case"value":break;case"multiple":ee=Tt;default:h.hasOwnProperty(k)||Jr(o,a,k,null,h,Tt)}for(x in h)if(k=h[x],Tt=u[x],h.hasOwnProperty(x)&&(k!=null||Tt!=null))switch(x){case"value":Kt=k;break;case"defaultValue":et=k;break;case"multiple":P=k;default:k!==Tt&&Jr(o,a,x,k,h,Tt)}a=et,u=P,h=ee,Kt!=null?qo(o,!!u,Kt,!1):!!h!=!!u&&(a!=null?qo(o,!!u,a,!0):qo(o,!!u,u?[]:"",!1));return;case"textarea":ee=Kt=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:Jr(o,a,et,null,h,x)}for(P in h)if(x=h[P],k=u[P],h.hasOwnProperty(P)&&(x!=null||k!=null))switch(P){case"value":Kt=x;break;case"defaultValue":ee=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:x!==k&&Jr(o,a,P,x,h,k)}te(o,Kt,ee);return;case"option":for(var nn in u)Kt=u[nn],u.hasOwnProperty(nn)&&Kt!=null&&!h.hasOwnProperty(nn)&&(nn==="selected"?o.selected=!1:Jr(o,a,nn,null,h,Kt));for(Tt in h)Kt=h[Tt],ee=u[Tt],h.hasOwnProperty(Tt)&&Kt!==ee&&(Kt!=null||ee!=null)&&(Tt==="selected"?o.selected=Kt&&typeof Kt!="function"&&typeof Kt!="symbol":Jr(o,a,Tt,Kt,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 _n in u)Kt=u[_n],u.hasOwnProperty(_n)&&Kt!=null&&!h.hasOwnProperty(_n)&&Jr(o,a,_n,null,h,Kt);for(Gt in h)if(Kt=h[Gt],ee=u[Gt],h.hasOwnProperty(Gt)&&Kt!==ee&&(Kt!=null||ee!=null))switch(Gt){case"children":case"dangerouslySetInnerHTML":if(Kt!=null)throw Error(r(137,a));break;default:Jr(o,a,Gt,Kt,h,ee)}return;default:if(Hc(a)){for(var Zr in u)Kt=u[Zr],u.hasOwnProperty(Zr)&&Kt!==void 0&&!h.hasOwnProperty(Zr)&&T1(o,a,Zr,void 0,h,Kt);for(le in h)Kt=h[le],ee=u[le],!h.hasOwnProperty(le)||Kt===ee||Kt===void 0&&ee===void 0||T1(o,a,le,Kt,h,ee);return}}for(var Ut in u)Kt=u[Ut],u.hasOwnProperty(Ut)&&Kt!=null&&!h.hasOwnProperty(Ut)&&Jr(o,a,Ut,null,h,Kt);for(me in h)Kt=h[me],ee=u[me],!h.hasOwnProperty(me)||Kt===ee||Kt==null&&ee==null||Jr(o,a,me,Kt,h,ee)}function Kx(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function B6(){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],k=x.transferSize,P=x.initiatorType,et=x.duration;if(k&&et&&Kx(P)){for(P=0,et=x.responseEnd,h+=1;h<u.length;h++){var Tt=u[h],Gt=Tt.startTime;if(Gt>et)break;var le=Tt.transferSize,me=Tt.initiatorType;le&&Kx(me)&&(Tt=Tt.responseEnd,P+=le*(Tt<et?1:(et-Gt)/(Tt-Gt)))}if(--h,a+=8*(k+P)/(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 N1=null,_1=null;function om(o){return o.nodeType===9?o:o.ownerDocument}function Jx(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 Zx(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 D1(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 L1=null;function F6(){var o=window.event;return o&&o.type==="popstate"?o===L1?!1:(L1=o,!0):(L1=null,!1)}var Qx=typeof setTimeout=="function"?setTimeout:void 0,U6=typeof clearTimeout=="function"?clearTimeout:void 0,tv=typeof Promise=="function"?Promise:void 0,H6=typeof queueMicrotask=="function"?queueMicrotask:typeof tv<"u"?function(o){return tv.resolve(null).then(o).catch(q6)}:Qx;function q6(o){setTimeout(function(){throw o})}function Hu(o){return o==="head"}function ev(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),Ed(a);return}h--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")h++;else if(u==="html")Ch(o.ownerDocument.documentElement);else if(u==="head"){u=o.ownerDocument.head,Ch(u);for(var k=u.firstChild;k;){var P=k.nextSibling,et=k.nodeName;k[es]||et==="SCRIPT"||et==="STYLE"||et==="LINK"&&k.rel.toLowerCase()==="stylesheet"||u.removeChild(k),k=P}}else u==="body"&&Ch(o.ownerDocument.body);u=x}while(u);Ed(a)}function nv(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 R1(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":R1(u),pa(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}o.removeChild(u)}}function $6(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[es])switch(a){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(k=o.getAttribute("rel"),k==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(k!==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(k=o.getAttribute("src"),(k!==(x.src==null?null:x.src)||o.getAttribute("type")!==(x.type==null?null:x.type)||o.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&k&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(a==="input"&&o.type==="hidden"){var k=x.name==null?null:""+x.name;if(x.type==="hidden"&&o.getAttribute("name")===k)return o}else return o;if(o=Tl(o.nextSibling),o===null)break}return null}function Y6(o,a,u){if(a==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!u||(o=Tl(o.nextSibling),o===null))return null;return o}function rv(o,a){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!a||(o=Tl(o.nextSibling),o===null))return null;return o}function O1(o){return o.data==="$?"||o.data==="$~"}function P1(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function V6(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 Tl(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 I1=null;function iv(o){o=o.nextSibling;for(var a=0;o;){if(o.nodeType===8){var u=o.data;if(u==="/$"||u==="/&"){if(a===0)return Tl(o.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}o=o.nextSibling}return null}function ov(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 sv(o,a,u){switch(a=om(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 Ch(o){for(var a=o.attributes;a.length;)o.removeAttributeNode(a[0]);pa(o)}var Nl=new Map,av=new Set;function sm(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var hu=Z.d;Z.d={f:W6,r:X6,D:G6,C:K6,L:J6,m:Z6,X:tE,S:Q6,M:eE};function W6(){var o=hu.f(),a=Jp();return o||a}function X6(o){var a=ma(o);a!==null&&a.tag===5&&a.type==="form"?Ab(a):hu.r(o)}var Ad=typeof document>"u"?null:document;function lv(o,a,u){var h=Ad;if(h&&typeof a=="string"&&a){var x=vr(a);x='link[rel="'+o+'"][href="'+x+'"]',typeof u=="string"&&(x+='[crossorigin="'+u+'"]'),av.has(x)||(av.add(x),o={rel:o,crossOrigin:u,href:a},h.querySelector(x)===null&&(a=h.createElement("link"),Ss(a,"link",o),di(a),h.head.appendChild(a)))}}function G6(o){hu.D(o),lv("dns-prefetch",o,null)}function K6(o,a){hu.C(o,a),lv("preconnect",o,a)}function J6(o,a,u){hu.L(o,a,u);var h=Ad;if(h&&o&&a){var x='link[rel="preload"][as="'+vr(a)+'"]';a==="image"&&u&&u.imageSrcSet?(x+='[imagesrcset="'+vr(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(x+='[imagesizes="'+vr(u.imageSizes)+'"]')):x+='[href="'+vr(o)+'"]';var k=x;switch(a){case"style":k=Md(o);break;case"script":k=Cd(o)}Nl.has(k)||(o=g({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:o,as:a},u),Nl.set(k,o),h.querySelector(x)!==null||a==="style"&&h.querySelector(Eh(k))||a==="script"&&h.querySelector(Th(k))||(a=h.createElement("link"),Ss(a,"link",o),di(a),h.head.appendChild(a)))}}function Z6(o,a){hu.m(o,a);var u=Ad;if(u&&o){var h=a&&typeof a.as=="string"?a.as:"script",x='link[rel="modulepreload"][as="'+vr(h)+'"][href="'+vr(o)+'"]',k=x;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=Cd(o)}if(!Nl.has(k)&&(o=g({rel:"modulepreload",href:o},a),Nl.set(k,o),u.querySelector(x)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Th(k)))return}h=u.createElement("link"),Ss(h,"link",o),di(h),u.head.appendChild(h)}}}function Q6(o,a,u){hu.S(o,a,u);var h=Ad;if(h&&o){var x=Js(h).hoistableStyles,k=Md(o);a=a||"default";var P=x.get(k);if(!P){var et={loading:0,preload:null};if(P=h.querySelector(Eh(k)))et.loading=5;else{o=g({rel:"stylesheet",href:o,"data-precedence":a},u),(u=Nl.get(k))&&j1(o,u);var Tt=P=h.createElement("link");di(Tt),Ss(Tt,"link",o),Tt._p=new Promise(function(Gt,le){Tt.onload=Gt,Tt.onerror=le}),Tt.addEventListener("load",function(){et.loading|=1}),Tt.addEventListener("error",function(){et.loading|=2}),et.loading|=4,am(P,a,h)}P={type:"stylesheet",instance:P,count:1,state:et},x.set(k,P)}}}function tE(o,a){hu.X(o,a);var u=Ad;if(u&&o){var h=Js(u).hoistableScripts,x=Cd(o),k=h.get(x);k||(k=u.querySelector(Th(x)),k||(o=g({src:o,async:!0},a),(a=Nl.get(x))&&z1(o,a),k=u.createElement("script"),di(k),Ss(k,"link",o),u.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},h.set(x,k))}}function eE(o,a){hu.M(o,a);var u=Ad;if(u&&o){var h=Js(u).hoistableScripts,x=Cd(o),k=h.get(x);k||(k=u.querySelector(Th(x)),k||(o=g({src:o,async:!0,type:"module"},a),(a=Nl.get(x))&&z1(o,a),k=u.createElement("script"),di(k),Ss(k,"link",o),u.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},h.set(x,k))}}function cv(o,a,u,h){var x=(x=wt.current)?sm(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=Md(u.href),u=Js(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=Md(u.href);var k=Js(x).hoistableStyles,P=k.get(o);if(P||(x=x.ownerDocument||x,P={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(o,P),(k=x.querySelector(Eh(o)))&&!k._p&&(P.instance=k,P.state.loading=5),Nl.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},Nl.set(o,u),k||nE(x,o,u,P.state))),a&&h===null)throw Error(r(528,""));return P}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=Cd(u),u=Js(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 Md(o){return'href="'+vr(o)+'"'}function Eh(o){return'link[rel="stylesheet"]['+o+"]"}function uv(o){return g({},o,{"data-precedence":o.precedence,precedence:null})}function nE(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}),Ss(a,"link",u),di(a),o.head.appendChild(a))}function Cd(o){return'[src="'+vr(o)+'"]'}function Th(o){return"script[async]"+o}function fv(o,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var h=o.querySelector('style[data-href~="'+vr(u.href)+'"]');if(h)return a.instance=h,di(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"),di(h),Ss(h,"style",x),am(h,u.precedence,o),a.instance=h;case"stylesheet":x=Md(u.href);var k=o.querySelector(Eh(x));if(k)return a.state.loading|=4,a.instance=k,di(k),k;h=uv(u),(x=Nl.get(x))&&j1(h,x),k=(o.ownerDocument||o).createElement("link"),di(k);var P=k;return P._p=new Promise(function(et,Tt){P.onload=et,P.onerror=Tt}),Ss(k,"link",h),a.state.loading|=4,am(k,u.precedence,o),a.instance=k;case"script":return k=Cd(u.src),(x=o.querySelector(Th(k)))?(a.instance=x,di(x),x):(h=u,(x=Nl.get(k))&&(h=g({},u),z1(h,x)),o=o.ownerDocument||o,x=o.createElement("script"),di(x),Ss(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,am(h,u.precedence,o));return a.instance}function am(o,a,u){for(var h=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=h.length?h[h.length-1]:null,k=x,P=0;P<h.length;P++){var et=h[P];if(et.dataset.precedence===a)k=et;else if(k!==x)break}k?k.parentNode.insertBefore(o,k.nextSibling):(a=u.nodeType===9?u.head:u,a.insertBefore(o,a.firstChild))}function j1(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.title==null&&(o.title=a.title)}function z1(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.integrity==null&&(o.integrity=a.integrity)}var lm=null;function dv(o,a,u){if(lm===null){var h=new Map,x=lm=new Map;x.set(u,h)}else x=lm,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 k=u[x];if(!(k[es]||k[pr]||o==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var P=k.getAttribute(a)||"";P=o+P;var et=h.get(P);et?et.push(k):h.set(P,[k])}}return h}function hv(o,a,u){o=o.ownerDocument||o,o.head.insertBefore(u,a==="title"?o.querySelector("head > title"):null)}function rE(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 pv(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function iE(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=Md(h.href),k=a.querySelector(Eh(x));if(k){a=k._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(o.count++,o=cm.bind(o),a.then(o,o)),u.state.loading|=4,u.instance=k,di(k);return}k=a.ownerDocument||a,h=uv(h),(x=Nl.get(x))&&j1(h,x),k=k.createElement("link"),di(k);var P=k;P._p=new Promise(function(et,Tt){P.onload=et,P.onerror=Tt}),Ss(k,"link",h),u.instance=k}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(u,a),(a=u.state.preload)&&(u.state.loading&3)===0&&(o.count++,u=cm.bind(o),a.addEventListener("load",u),a.addEventListener("error",u))}}var B1=0;function oE(o,a){return o.stylesheets&&o.count===0&&fm(o,o.stylesheets),0<o.count||0<o.imgCount?function(u){var h=setTimeout(function(){if(o.stylesheets&&fm(o,o.stylesheets),o.unsuspend){var k=o.unsuspend;o.unsuspend=null,k()}},6e4+a);0<o.imgBytes&&B1===0&&(B1=62500*B6());var x=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&fm(o,o.stylesheets),o.unsuspend)){var k=o.unsuspend;o.unsuspend=null,k()}},(o.imgBytes>B1?50:800)+a);return o.unsuspend=u,function(){o.unsuspend=null,clearTimeout(h),clearTimeout(x)}}:null}function cm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)fm(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var um=null;function fm(o,a){o.stylesheets=null,o.unsuspend!==null&&(o.count++,um=new Map,a.forEach(sE,o),um=null,cm.call(o))}function sE(o,a){if(!(a.state.loading&4)){var u=um.get(o);if(u)var h=u.get(null);else{u=new Map,um.set(o,u);for(var x=o.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<x.length;k++){var P=x[k];(P.nodeName==="LINK"||P.getAttribute("media")!=="not all")&&(u.set(P.dataset.precedence,P),h=P)}h&&u.set(null,h)}x=a.instance,P=x.getAttribute("data-precedence"),k=u.get(P)||h,k===h&&u.set(null,x),u.set(P,x),this.count++,h=cm.bind(this),x.addEventListener("load",h),x.addEventListener("error",h),k?k.parentNode.insertBefore(x,k.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(x,o.firstChild)),a.state.loading|=4}}var Nh={$$typeof:q,Provider:null,Consumer:null,_currentValue:ut,_currentValue2:ut,_threadCount:0};function aE(o,a,u,h,x,k,P,et,Tt){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=Bo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bo(0),this.hiddenUpdates=Bo(null),this.identifierPrefix=h,this.onUncaughtError=x,this.onCaughtError=k,this.onRecoverableError=P,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Tt,this.incompleteTransitions=new Map}function mv(o,a,u,h,x,k,P,et,Tt,Gt,le,me){return o=new aE(o,a,u,P,Tt,Gt,le,me,et),a=1,k===!0&&(a|=24),k=so(3,null,null,a),o.current=k,k.stateNode=o,a=oa(),a.refCount++,o.pooledCache=a,a.refCount++,k.memoizedState={element:h,isDehydrated:u,cache:a},Pe(k),o}function gv(o){return o?(o=Xi,o):Xi}function yv(o,a,u,h,x,k){x=gv(x),h.context===null?h.context=x:h.pendingContext=x,h=xn(a),h.payload={element:u},k=k===void 0?null:k,k!==null&&(h.callback=k),u=qn(o,h,a),u!==null&&(Da(u,o,a),Tr(u,o,a))}function bv(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var u=o.retryLane;o.retryLane=u!==0&&u<a?u:a}}function F1(o,a){bv(o,a),(o=o.alternate)&&bv(o,a)}function xv(o){if(o.tag===13||o.tag===31){var a=Ma(o,67108864);a!==null&&Da(a,o,67108864),F1(o,67108864)}}function vv(o){if(o.tag===13||o.tag===31){var a=Za();a=Tn(a);var u=Ma(o,a);u!==null&&Da(u,o,a),F1(o,a)}}var dm=!0;function lE(o,a,u,h){var x=ht.T;ht.T=null;var k=Z.p;try{Z.p=2,U1(o,a,u,h)}finally{Z.p=k,ht.T=x}}function cE(o,a,u,h){var x=ht.T;ht.T=null;var k=Z.p;try{Z.p=8,U1(o,a,u,h)}finally{Z.p=k,ht.T=x}}function U1(o,a,u,h){if(dm){var x=H1(h);if(x===null)E1(o,a,h,hm,u),Sv(o,h);else if(fE(x,o,a,u,h))h.stopPropagation();else if(Sv(o,h),a&4&&-1<uE.indexOf(o)){for(;x!==null;){var k=ma(x);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var P=Ce(k.pendingLanes);if(P!==0){var et=k;for(et.pendingLanes|=2,et.entangledLanes|=2;P;){var Tt=1<<31-Bn(P);et.entanglements[1]|=Tt,P&=~Tt}_c(k),(jr&6)===0&&(Gp=tn()+500,kh(0))}}break;case 31:case 13:et=Ma(k,2),et!==null&&Da(et,k,2),Jp(),F1(k,2)}if(k=H1(h),k===null&&E1(o,a,h,hm,u),k===x)break;x=k}x!==null&&h.stopPropagation()}else E1(o,a,h,null,u)}}function H1(o){return o=ql(o),q1(o)}var hm=null;function q1(o){if(hm=null,o=No(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 hm=o,null}function wv(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(Pn()){case mn:return 2;case In:return 8;case hn:case Ue:return 32;case $e:return 268435456;default:return 32}default:return 32}}var $1=!1,qu=null,$u=null,Yu=null,_h=new Map,Dh=new Map,Vu=[],uE="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 Sv(o,a){switch(o){case"focusin":case"focusout":qu=null;break;case"dragenter":case"dragleave":$u=null;break;case"mouseover":case"mouseout":Yu=null;break;case"pointerover":case"pointerout":_h.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dh.delete(a.pointerId)}}function Lh(o,a,u,h,x,k){return o===null||o.nativeEvent!==k?(o={blockedOn:a,domEventName:u,eventSystemFlags:h,nativeEvent:k,targetContainers:[x]},a!==null&&(a=ma(a),a!==null&&xv(a)),o):(o.eventSystemFlags|=h,a=o.targetContainers,x!==null&&a.indexOf(x)===-1&&a.push(x),o)}function fE(o,a,u,h,x){switch(a){case"focusin":return qu=Lh(qu,o,a,u,h,x),!0;case"dragenter":return $u=Lh($u,o,a,u,h,x),!0;case"mouseover":return Yu=Lh(Yu,o,a,u,h,x),!0;case"pointerover":var k=x.pointerId;return _h.set(k,Lh(_h.get(k)||null,o,a,u,h,x)),!0;case"gotpointercapture":return k=x.pointerId,Dh.set(k,Lh(Dh.get(k)||null,o,a,u,h,x)),!0}return!1}function kv(o){var a=No(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,ha(o.priority,function(){vv(u)});return}}else if(a===31){if(a=c(u),a!==null){o.blockedOn=a,ha(o.priority,function(){vv(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 pm(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var u=H1(o.nativeEvent);if(u===null){u=o.nativeEvent;var h=new u.constructor(u.type,u);rs=h,u.target.dispatchEvent(h),rs=null}else return a=ma(u),a!==null&&xv(a),o.blockedOn=u,!1;a.shift()}return!0}function Av(o,a,u){pm(o)&&u.delete(a)}function dE(){$1=!1,qu!==null&&pm(qu)&&(qu=null),$u!==null&&pm($u)&&($u=null),Yu!==null&&pm(Yu)&&(Yu=null),_h.forEach(Av),Dh.forEach(Av)}function mm(o,a){o.blockedOn===a&&(o.blockedOn=null,$1||($1=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,dE)))}var gm=null;function Mv(o){gm!==o&&(gm=o,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){gm===o&&(gm=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(q1(h||u)===null)continue;break}var k=ma(u);k!==null&&(o.splice(a,3),a-=3,H0(k,{pending:!0,data:x,method:u.method,action:h},h,x))}}))}function Ed(o){function a(Tt){return mm(Tt,o)}qu!==null&&mm(qu,o),$u!==null&&mm($u,o),Yu!==null&&mm(Yu,o),_h.forEach(a),Dh.forEach(a);for(var u=0;u<Vu.length;u++){var h=Vu[u];h.blockedOn===o&&(h.blockedOn=null)}for(;0<Vu.length&&(u=Vu[0],u.blockedOn===null);)kv(u),u.blockedOn===null&&Vu.shift();if(u=(o.ownerDocument||o).$$reactFormReplay,u!=null)for(h=0;h<u.length;h+=3){var x=u[h],k=u[h+1],P=x[Cr]||null;if(typeof k=="function")P||Mv(u);else if(P){var et=null;if(k&&k.hasAttribute("formAction")){if(x=k,P=k[Cr]||null)et=P.formAction;else if(q1(x)!==null)continue}else et=P.action;typeof et=="function"?u[h+1]=et:(u.splice(h,3),h-=3),Mv(u)}}}function Cv(){function o(k){k.canIntercept&&k.info==="react-transition"&&k.intercept({handler:function(){return new Promise(function(P){return x=P})},focusReset:"manual",scroll:"manual"})}function a(){x!==null&&(x(),x=null),h||setTimeout(u,20)}function u(){if(!h&&!navigation.transition){var k=navigation.currentEntry;k&&k.url!=null&&navigation.navigate(k.url,{state:k.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 Y1(o){this._internalRoot=o}ym.prototype.render=Y1.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(r(409));var u=a.current,h=Za();yv(u,h,o,a,null,null)},ym.prototype.unmount=Y1.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;yv(o.current,2,null,o,null,null),Jp(),a[no]=null}};function ym(o){this._internalRoot=o}ym.prototype.unstable_scheduleHydration=function(o){if(o){var a=_i();o={blockedOn:null,target:o,priority:a};for(var u=0;u<Vu.length&&a!==0&&a<Vu[u].priority;u++);Vu.splice(u,0,o),u===0&&kv(o)}};var Ev=t.version;if(Ev!=="19.2.4")throw Error(r(527,Ev,"19.2.4"));Z.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 hE={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:ht,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var bm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!bm.isDisabled&&bm.supportsFiber)try{bn=bm.inject(hE),an=bm}catch{}}return Oh.createRoot=function(o,a){if(!i(o))throw Error(r(299));var u=!1,h="",x=Ob,k=Pb,P=Ib;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&&(k=a.onCaughtError),a.onRecoverableError!==void 0&&(P=a.onRecoverableError)),a=mv(o,1,!1,null,null,u,h,null,x,k,P,Cv),o[no]=a.current,C1(o),new Y1(a)},Oh.hydrateRoot=function(o,a,u){if(!i(o))throw Error(r(299));var h=!1,x="",k=Ob,P=Pb,et=Ib,Tt=null;return u!=null&&(u.unstable_strictMode===!0&&(h=!0),u.identifierPrefix!==void 0&&(x=u.identifierPrefix),u.onUncaughtError!==void 0&&(k=u.onUncaughtError),u.onCaughtError!==void 0&&(P=u.onCaughtError),u.onRecoverableError!==void 0&&(et=u.onRecoverableError),u.formState!==void 0&&(Tt=u.formState)),a=mv(o,1,!0,a,u??null,h,x,Tt,k,P,et,Cv),a.context=gv(null),u=a.current,h=Za(),h=Tn(h),x=xn(h),x.callback=null,qn(u,x,h),u=h,a.current.lanes=u,Ze(a,u),_c(a),o[no]=a.current,C1(o),new ym(a)},Oh.version="19.2.4",Oh}var jv;function SE(){if(jv)return X1.exports;jv=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),X1.exports=wE(),X1.exports}var kE=SE();const ks=[];for(let n=0;n<256;++n)ks.push((n+256).toString(16).slice(1));function AE(n,t=0){return(ks[n[t+0]]+ks[n[t+1]]+ks[n[t+2]]+ks[n[t+3]]+"-"+ks[n[t+4]]+ks[n[t+5]]+"-"+ks[n[t+6]]+ks[n[t+7]]+"-"+ks[n[t+8]]+ks[n[t+9]]+"-"+ks[n[t+10]]+ks[n[t+11]]+ks[n[t+12]]+ks[n[t+13]]+ks[n[t+14]]+ks[n[t+15]]).toLowerCase()}let Z1;const ME=new Uint8Array(16);function CE(){if(!Z1){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Z1=crypto.getRandomValues.bind(crypto)}return Z1(ME)}const EE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),zv={randomUUID:EE};function TE(n,t,e){n=n||{};const r=n.random??n.rng?.()??CE();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,AE(r)}function _l(n,t,e){return zv.randomUUID&&!n?zv.randomUUID():TE(n)}const NE="modulepreload",_E=function(n,t){return new URL(n,t).href},Bv={},Q1=function(t,e,r){let i=Promise.resolve();if(e&&e.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(e.map(p=>{if(p=_E(p,r),p in Bv)return;Bv[p]=!0;const g=p.endsWith(".css"),b=g?'[rel="stylesheet"]':"";if(r)for(let M=l.length-1;M>=0;M--){const C=l[M];if(C.href===p&&(!g||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${p}"]${b}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":NE,g||(y.as="script"),y.crossOrigin="",y.href=p,f&&y.setAttribute("nonce",f),document.head.appendChild(y),g)return new Promise((M,C)=>{y.addEventListener("load",M),y.addEventListener("error",()=>C(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 Xr(n){"@babel/helpers - typeof";return Xr=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},Xr(n)}var fc=Uint8Array,nl=Uint16Array,m5=Int32Array,g5=new fc([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]),y5=new fc([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]),Fv=new fc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Pk=function(n,t){for(var e=new nl(31),r=0;r<31;++r)e[r]=t+=1<<n[r-1];for(var i=new m5(e[30]),r=1;r<30;++r)for(var s=e[r];s<e[r+1];++s)i[s]=s-e[r]<<5|r;return{b:e,r:i}},Ik=Pk(g5,2),DE=Ik.b,c2=Ik.r;DE[28]=258,c2[258]=28;var LE=Pk(y5,0),Uv=LE.r,u2=new nl(32768);for(var Ti=0;Ti<32768;++Ti){var Xu=(Ti&43690)>>1|(Ti&21845)<<1;Xu=(Xu&52428)>>2|(Xu&13107)<<2,Xu=(Xu&61680)>>4|(Xu&3855)<<4,u2[Ti]=((Xu&65280)>>8|(Xu&255)<<8)>>1}var tp=(function(n,t,e){for(var r=n.length,i=0,s=new nl(t);i<r;++i)n[i]&&++s[n[i]-1];var l=new nl(t);for(i=1;i<t;++i)l[i]=l[i-1]+s[i-1]<<1;var c;if(e){c=new nl(1<<t);var f=15-t;for(i=0;i<r;++i)if(n[i])for(var d=i<<4|n[i],p=t-n[i],g=l[n[i]-1]++<<p,b=g|(1<<p)-1;g<=b;++g)c[u2[g]>>f]=d}else for(c=new nl(r),i=0;i<r;++i)n[i]&&(c[i]=u2[l[n[i]-1]++]>>15-n[i]);return c}),nd=new fc(288);for(var Ti=0;Ti<144;++Ti)nd[Ti]=8;for(var Ti=144;Ti<256;++Ti)nd[Ti]=9;for(var Ti=256;Ti<280;++Ti)nd[Ti]=7;for(var Ti=280;Ti<288;++Ti)nd[Ti]=8;var hg=new fc(32);for(var Ti=0;Ti<32;++Ti)hg[Ti]=5;var RE=tp(nd,9,0),OE=tp(hg,5,0),jk=function(n){return(n+7)/8|0},PE=function(n,t,e){return(e==null||e>n.length)&&(e=n.length),new fc(n.subarray(t,e))},pu=function(n,t,e){e<<=t&7;var r=t/8|0;n[r]|=e,n[r+1]|=e>>8},Ph=function(n,t,e){e<<=t&7;var r=t/8|0;n[r]|=e,n[r+1]|=e>>8,n[r+2]|=e>>16},ty=function(n,t){for(var e=[],r=0;r<n.length;++r)n[r]&&e.push({s:r,f:n[r]});var i=e.length,s=e.slice();if(!i)return{t:Bk,l:0};if(i==1){var l=new fc(e[0].s+1);return l[e[0].s]=1,{t:l,l:1}}e.sort(function(gt,Mt){return gt.f-Mt.f}),e.push({s:-1,f:25001});var c=e[0],f=e[1],d=0,p=1,g=2;for(e[0]={s:-1,f:c.f+f.f,l:c,r:f};p!=i-1;)c=e[e[d].f<e[g].f?d++:g++],f=e[d!=p&&e[d].f<e[g].f?d++:g++],e[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 nl(b+1),M=f2(e[p-1],y,0);if(M>t){var r=0,C=0,L=M-t,R=1<<L;for(s.sort(function(Mt,kt){return y[kt.s]-y[Mt.s]||Mt.f-kt.f});r<i;++r){var B=s[r].s;if(y[B]>t)C+=R-(1<<M-y[B]),y[B]=t;else break}for(C>>=L;C>0;){var q=s[r].s;y[q]<t?C-=1<<t-y[q]++-1:++r}for(;r>=0&&C;--r){var V=s[r].s;y[V]==t&&(--y[V],++C)}M=t}return{t:new fc(y),l:M}},f2=function(n,t,e){return n.s==-1?Math.max(f2(n.l,t,e+1),f2(n.r,t,e+1)):t[n.s]=e},Hv=function(n){for(var t=n.length;t&&!n[--t];);for(var e=new nl(++t),r=0,i=n[0],s=1,l=function(f){e[r++]=f},c=1;c<=t;++c)if(n[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=n[c]}return{c:e.subarray(0,r),n:t}},Ih=function(n,t){for(var e=0,r=0;r<t.length;++r)e+=n[r]*t[r];return e},zk=function(n,t,e){var r=e.length,i=jk(t+2);n[i]=r&255,n[i+1]=r>>8,n[i+2]=n[i]^255,n[i+3]=n[i+1]^255;for(var s=0;s<r;++s)n[i+s+4]=e[s];return(i+4+r)*8},qv=function(n,t,e,r,i,s,l,c,f,d,p){pu(t,p++,e),++i[256];for(var g=ty(i,15),b=g.t,y=g.l,M=ty(s,15),C=M.t,L=M.l,R=Hv(b),B=R.c,q=R.n,V=Hv(C),gt=V.c,Mt=V.n,kt=new nl(19),bt=0;bt<B.length;++bt)++kt[B[bt]&31];for(var bt=0;bt<gt.length;++bt)++kt[gt[bt]&31];for(var it=ty(kt,7),Lt=it.t,J=it.l,ct=19;ct>4&&!Lt[Fv[ct-1]];--ct);var G=d+5<<3,vt=Ih(i,nd)+Ih(s,hg)+l,_t=Ih(i,b)+Ih(s,C)+l+14+3*ct+Ih(kt,Lt)+2*kt[16]+3*kt[17]+7*kt[18];if(f>=0&&G<=vt&&G<=_t)return zk(t,p,n.subarray(f,f+d));var ht,Z,ut,It;if(pu(t,p,1+(_t<vt)),p+=2,_t<vt){ht=tp(b,y,0),Z=b,ut=tp(C,L,0),It=C;var Zt=tp(Lt,J,0);pu(t,p,q-257),pu(t,p+5,Mt-1),pu(t,p+10,ct-4),p+=14;for(var bt=0;bt<ct;++bt)pu(t,p+3*bt,Lt[Fv[bt]]);p+=3*ct;for(var $=[B,gt],N=0;N<2;++N)for(var Q=$[N],bt=0;bt<Q.length;++bt){var tt=Q[bt]&31;pu(t,p,Zt[tt]),p+=Lt[tt],tt>15&&(pu(t,p,Q[bt]>>5&127),p+=Q[bt]>>12)}}else ht=RE,Z=nd,ut=OE,It=hg;for(var bt=0;bt<c;++bt){var pt=r[bt];if(pt>255){var tt=pt>>18&31;Ph(t,p,ht[tt+257]),p+=Z[tt+257],tt>7&&(pu(t,p,pt>>23&31),p+=g5[tt]);var wt=pt&31;Ph(t,p,ut[wt]),p+=It[wt],wt>3&&(Ph(t,p,pt>>5&8191),p+=y5[wt])}else Ph(t,p,ht[pt]),p+=Z[pt]}return Ph(t,p,ht[256]),p+Z[256]},IE=new m5([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Bk=new fc(0),jE=function(n,t,e,r,i,s){var l=s.z||n.length,c=new fc(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=IE[t-1],b=g>>13,y=g&8191,M=(1<<e)-1,C=s.p||new nl(32768),L=s.h||new nl(M+1),R=Math.ceil(e/3),B=2*R,q=function(Ve){return(n[Ve]^n[Ve+1]<<R^n[Ve+2]<<B)&M},V=new m5(25e3),gt=new nl(288),Mt=new nl(32),kt=0,bt=0,it=s.i||0,Lt=0,J=s.w||0,ct=0;it+2<l;++it){var G=q(it),vt=it&32767,_t=L[G];if(C[vt]=_t,L[G]=vt,J<=it){var ht=l-it;if((kt>7e3||Lt>24576)&&(ht>423||!d)){p=qv(n,f,0,V,gt,Mt,bt,Lt,ct,it-ct,p),Lt=kt=bt=0,ct=it;for(var Z=0;Z<286;++Z)gt[Z]=0;for(var Z=0;Z<30;++Z)Mt[Z]=0}var ut=2,It=0,Zt=y,$=vt-_t&32767;if(ht>2&&G==q(it-$))for(var N=Math.min(b,ht)-1,Q=Math.min(32767,it),tt=Math.min(258,ht);$<=Q&&--Zt&&vt!=_t;){if(n[it+ut]==n[it+ut-$]){for(var pt=0;pt<tt&&n[it+pt]==n[it+pt-$];++pt);if(pt>ut){if(ut=pt,It=$,pt>N)break;for(var wt=Math.min($,pt-2),At=0,Z=0;Z<wt;++Z){var Ft=it-$+Z&32767,Rt=C[Ft],Jt=Ft-Rt&32767;Jt>At&&(At=Jt,_t=Ft)}}}vt=_t,_t=C[vt],$+=vt-_t&32767}if(It){V[Lt++]=268435456|c2[ut]<<18|Uv[It];var ke=c2[ut]&31,Re=Uv[It]&31;bt+=g5[ke]+y5[Re],++gt[257+ke],++Mt[Re],J=it+ut,++kt}else V[Lt++]=n[it],++gt[n[it]]}}for(it=Math.max(it,J);it<l;++it)V[Lt++]=n[it],++gt[n[it]];p=qv(n,f,d,V,gt,Mt,bt,Lt,ct,it-ct,p),d||(s.r=p&7|f[p/8|0]<<3,p-=7,s.h=L,s.p=C,s.i=it,s.w=J)}else{for(var it=s.w||0;it<l+d;it+=65535){var Ie=it+65535;Ie>=l&&(f[p/8|0]=d,Ie=l),p=zk(f,p+1,n.subarray(it,Ie))}s.i=l}return PE(c,0,r+jk(p)+i)},Fk=function(){var n=1,t=0;return{p:function(e){for(var r=n,i=t,s=e.length|0,l=0;l!=s;){for(var c=Math.min(l+2655,s);l<c;++l)i+=r+=e[l];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}n=r,t=i},d:function(){return n%=65521,t%=65521,(n&255)<<24|(n&65280)<<8|(t&255)<<8|t>>8}}},zE=function(n,t,e,r,i){if(!i&&(i={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),l=new fc(s.length+n.length);l.set(s),l.set(n,s.length),n=l,i.w=s.length}return jE(n,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):20:12+t.mem,e,r,i)},Uk=function(n,t,e){for(;e;++t)n[t]=e,e>>>=8},BE=function(n,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(n[0]=120,n[1]=r<<6|(t.dictionary&&32),n[1]|=31-(n[0]<<8|n[1])%31,t.dictionary){var i=Fk();i.p(t.dictionary),Uk(n,2,i.d())}};function d2(n,t){t||(t={});var e=Fk();e.p(n);var r=zE(n,t,t.dictionary?6:2,4);return BE(r,t),Uk(r,r.length-4,e.d()),r}var FE=typeof TextDecoder<"u"&&new TextDecoder,UE=0;try{FE.decode(Bk,{stream:!0}),UE=1}catch{}function HE(n){if(Array.isArray(n))return n}function qE(n,t){var e=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(e!=null){var r,i,s,l,c=[],f=!0,d=!1;try{if(s=(e=e.call(n)).next,t!==0)for(;!(f=(r=s.call(e)).done)&&(c.push(r.value),c.length!==t);f=!0);}catch(p){d=!0,i=p}finally{try{if(!f&&e.return!=null&&(l=e.return(),Object(l)!==l))return}finally{if(d)throw i}}return c}}function $v(n,t){(t==null||t>n.length)&&(t=n.length);for(var e=0,r=Array(t);e<t;e++)r[e]=n[e];return r}function $E(n,t){if(n){if(typeof n=="string")return $v(n,t);var e={}.toString.call(n).slice(8,-1);return e==="Object"&&n.constructor&&(e=n.constructor.name),e==="Map"||e==="Set"?Array.from(n):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?$v(n,t):void 0}}function YE(){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 Yv(n,t){return HE(n)||qE(n,t)||$E(n,t)||YE()}function Vv(n,t="utf8"){return new TextDecoder(t).decode(n)}const VE=new TextEncoder;function WE(n){return VE.encode(n)}const XE=1024*8,GE=(()=>{const n=new Uint8Array(4),t=new Uint32Array(n.buffer);return!((t[0]=1)&n[0])})(),ey={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 b5{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(t=XE,e={}){let r=!1;typeof t=="number"?t=new ArrayBuffer(t):(r=!0,this.lastWrittenByte=t.byteLength);const i=e.offset?e.offset>>>0:0,s=t.byteLength-i;let l=i;(ArrayBuffer.isView(t)||t instanceof b5)&&(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,e){const r=ey[e].BYTES_PER_ELEMENT*t,i=this.byteOffset+this.offset,s=this.buffer.slice(i,i+r);if(this.littleEndian===GE&&e!=="uint8"&&e!=="int8"){const c=new Uint8Array(this.buffer.slice(i,i+r));c.reverse();const f=new ey[e](c.buffer);return this.offset+=r,f.reverse(),f}const l=new ey[e](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 e="";for(let r=0;r<t;r++)e+=this.readChar();return e}readUtf8(t=1){return Vv(this.readBytes(t))}decodeText(t=1,e="utf8"){return Vv(this.readBytes(t),e)}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 e=0;e<t.length;e++)this._data.setUint8(this.offset++,t[e]);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 e=0;e<t.length;e++)this.writeUint8(t.charCodeAt(e));return this}writeUtf8(t){return this.writeBytes(WE(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 ch(n){let t=n.length;for(;--t>=0;)n[t]=0}const KE=3,JE=258,Hk=29,ZE=256,QE=ZE+1+Hk,qk=30,tT=512,eT=new Array((QE+2)*2);ch(eT);const nT=new Array(qk*2);ch(nT);const rT=new Array(tT);ch(rT);const iT=new Array(JE-KE+1);ch(iT);const oT=new Array(Hk);ch(oT);const sT=new Array(qk);ch(sT);const aT=(n,t,e,r)=>{let i=n&65535|0,s=n>>>16&65535|0,l=0;for(;e!==0;){l=e>2e3?2e3:e,e-=l;do i=i+t[r++]|0,s=s+i|0;while(--l);i%=65521,s%=65521}return i|s<<16|0};var h2=aT;const lT=()=>{let n,t=[];for(var e=0;e<256;e++){n=e;for(var r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;t[e]=n}return t},cT=new Uint32Array(lT()),uT=(n,t,e,r)=>{const i=cT,s=r+e;n^=-1;for(let l=r;l<s;l++)n=n>>>8^i[(n^t[l])&255];return n^-1};var Dc=uT,p2={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"},$k={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 fT=(n,t)=>Object.prototype.hasOwnProperty.call(n,t);var dT=function(n){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const r in e)fT(e,r)&&(n[r]=e[r])}}return n},hT=n=>{let t=0;for(let r=0,i=n.length;r<i;r++)t+=n[r].length;const e=new Uint8Array(t);for(let r=0,i=0,s=n.length;r<s;r++){let l=n[r];e.set(l,i),i+=l.length}return e},Yk={assign:dT,flattenChunks:hT};let Vk=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Vk=!1}const mp=new Uint8Array(256);for(let n=0;n<256;n++)mp[n]=n>=252?6:n>=248?5:n>=240?4:n>=224?3:n>=192?2:1;mp[254]=mp[254]=1;var pT=n=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(n);let t,e,r,i,s,l=n.length,c=0;for(i=0;i<l;i++)e=n.charCodeAt(i),(e&64512)===55296&&i+1<l&&(r=n.charCodeAt(i+1),(r&64512)===56320&&(e=65536+(e-55296<<10)+(r-56320),i++)),c+=e<128?1:e<2048?2:e<65536?3:4;for(t=new Uint8Array(c),s=0,i=0;s<c;i++)e=n.charCodeAt(i),(e&64512)===55296&&i+1<l&&(r=n.charCodeAt(i+1),(r&64512)===56320&&(e=65536+(e-55296<<10)+(r-56320),i++)),e<128?t[s++]=e:e<2048?(t[s++]=192|e>>>6,t[s++]=128|e&63):e<65536?(t[s++]=224|e>>>12,t[s++]=128|e>>>6&63,t[s++]=128|e&63):(t[s++]=240|e>>>18,t[s++]=128|e>>>12&63,t[s++]=128|e>>>6&63,t[s++]=128|e&63);return t};const mT=(n,t)=>{if(t<65534&&n.subarray&&Vk)return String.fromCharCode.apply(null,n.length===t?n:n.subarray(0,t));let e="";for(let r=0;r<t;r++)e+=String.fromCharCode(n[r]);return e};var gT=(n,t)=>{const e=t||n.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(n.subarray(0,t));let r,i;const s=new Array(e*2);for(i=0,r=0;r<e;){let l=n[r++];if(l<128){s[i++]=l;continue}let c=mp[l];if(c>4){s[i++]=65533,r+=c-1;continue}for(l&=c===2?31:c===3?15:7;c>1&&r<e;)l=l<<6|n[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 mT(s,i)},yT=(n,t)=>{t=t||n.length,t>n.length&&(t=n.length);let e=t-1;for(;e>=0&&(n[e]&192)===128;)e--;return e<0||e===0?t:e+mp[n[e]]>t?e:t},m2={string2buf:pT,buf2string:gT,utf8border:yT};function bT(){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 xT=bT;const xm=16209,vT=16191;var wT=function(t,e){let r,i,s,l,c,f,d,p,g,b,y,M,C,L,R,B,q,V,gt,Mt,kt,bt,it,Lt;const J=t.state;r=t.next_in,it=t.input,i=r+(t.avail_in-5),s=t.next_out,Lt=t.output,l=s-(e-t.avail_out),c=s+(t.avail_out-257),f=J.dmax,d=J.wsize,p=J.whave,g=J.wnext,b=J.window,y=J.hold,M=J.bits,C=J.lencode,L=J.distcode,R=(1<<J.lenbits)-1,B=(1<<J.distbits)-1;t:do{M<15&&(y+=it[r++]<<M,M+=8,y+=it[r++]<<M,M+=8),q=C[y&R];e:for(;;){if(V=q>>>24,y>>>=V,M-=V,V=q>>>16&255,V===0)Lt[s++]=q&65535;else if(V&16){gt=q&65535,V&=15,V&&(M<V&&(y+=it[r++]<<M,M+=8),gt+=y&(1<<V)-1,y>>>=V,M-=V),M<15&&(y+=it[r++]<<M,M+=8,y+=it[r++]<<M,M+=8),q=L[y&B];n:for(;;){if(V=q>>>24,y>>>=V,M-=V,V=q>>>16&255,V&16){if(Mt=q&65535,V&=15,M<V&&(y+=it[r++]<<M,M+=8,M<V&&(y+=it[r++]<<M,M+=8)),Mt+=y&(1<<V)-1,Mt>f){t.msg="invalid distance too far back",J.mode=xm;break t}if(y>>>=V,M-=V,V=s-l,Mt>V){if(V=Mt-V,V>p&&J.sane){t.msg="invalid distance too far back",J.mode=xm;break t}if(kt=0,bt=b,g===0){if(kt+=d-V,V<gt){gt-=V;do Lt[s++]=b[kt++];while(--V);kt=s-Mt,bt=Lt}}else if(g<V){if(kt+=d+g-V,V-=g,V<gt){gt-=V;do Lt[s++]=b[kt++];while(--V);if(kt=0,g<gt){V=g,gt-=V;do Lt[s++]=b[kt++];while(--V);kt=s-Mt,bt=Lt}}}else if(kt+=g-V,V<gt){gt-=V;do Lt[s++]=b[kt++];while(--V);kt=s-Mt,bt=Lt}for(;gt>2;)Lt[s++]=bt[kt++],Lt[s++]=bt[kt++],Lt[s++]=bt[kt++],gt-=3;gt&&(Lt[s++]=bt[kt++],gt>1&&(Lt[s++]=bt[kt++]))}else{kt=s-Mt;do Lt[s++]=Lt[kt++],Lt[s++]=Lt[kt++],Lt[s++]=Lt[kt++],gt-=3;while(gt>2);gt&&(Lt[s++]=Lt[kt++],gt>1&&(Lt[s++]=Lt[kt++]))}}else if((V&64)===0){q=L[(q&65535)+(y&(1<<V)-1)];continue n}else{t.msg="invalid distance code",J.mode=xm;break t}break}}else if((V&64)===0){q=C[(q&65535)+(y&(1<<V)-1)];continue e}else if(V&32){J.mode=vT;break t}else{t.msg="invalid literal/length code",J.mode=xm;break t}break}}while(r<i&&s<c);gt=M>>3,r-=gt,M-=gt<<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),J.hold=y,J.bits=M};const Td=15,Wv=852,Xv=592,Gv=0,ny=1,Kv=2,ST=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]),kT=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]),AT=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]),MT=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]),CT=(n,t,e,r,i,s,l,c)=>{const f=c.bits;let d=0,p=0,g=0,b=0,y=0,M=0,C=0,L=0,R=0,B=0,q,V,gt,Mt,kt,bt=null,it;const Lt=new Uint16Array(Td+1),J=new Uint16Array(Td+1);let ct=null,G,vt,_t;for(d=0;d<=Td;d++)Lt[d]=0;for(p=0;p<r;p++)Lt[t[e+p]]++;for(y=f,b=Td;b>=1&&Lt[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&&Lt[g]===0;g++);for(y<g&&(y=g),L=1,d=1;d<=Td;d++)if(L<<=1,L-=Lt[d],L<0)return-1;if(L>0&&(n===Gv||b!==1))return-1;for(J[1]=0,d=1;d<Td;d++)J[d+1]=J[d]+Lt[d];for(p=0;p<r;p++)t[e+p]!==0&&(l[J[t[e+p]]++]=p);if(n===Gv?(bt=ct=l,it=20):n===ny?(bt=ST,ct=kT,it=257):(bt=AT,ct=MT,it=0),B=0,p=0,d=g,kt=s,M=y,C=0,gt=-1,R=1<<y,Mt=R-1,n===ny&&R>Wv||n===Kv&&R>Xv)return 1;for(;;){G=d-C,l[p]+1<it?(vt=0,_t=l[p]):l[p]>=it?(vt=ct[l[p]-it],_t=bt[l[p]-it]):(vt=96,_t=0),q=1<<d-C,V=1<<M,g=V;do V-=q,i[kt+(B>>C)+V]=G<<24|vt<<16|_t|0;while(V!==0);for(q=1<<d-1;B&q;)q>>=1;if(q!==0?(B&=q-1,B+=q):B=0,p++,--Lt[d]===0){if(d===b)break;d=t[e+l[p]]}if(d>y&&(B&Mt)!==gt){for(C===0&&(C=y),kt+=g,M=d-C,L=1<<M;M+C<b&&(L-=Lt[M+C],!(L<=0));)M++,L<<=1;if(R+=1<<M,n===ny&&R>Wv||n===Kv&&R>Xv)return 1;gt=B&Mt,i[gt]=y<<24|M<<16|kt-s|0}}return B!==0&&(i[kt+B]=d-C<<24|64<<16|0),c.bits=y,0};var ep=CT;const ET=0,Wk=1,Xk=2,{Z_FINISH:Jv,Z_BLOCK:TT,Z_TREES:vm,Z_OK:rd,Z_STREAM_END:NT,Z_NEED_DICT:_T,Z_STREAM_ERROR:Bl,Z_DATA_ERROR:Gk,Z_MEM_ERROR:Kk,Z_BUF_ERROR:DT,Z_DEFLATED:Zv}=$k,b0=16180,Qv=16181,tw=16182,ew=16183,nw=16184,rw=16185,iw=16186,ow=16187,sw=16188,aw=16189,pg=16190,mu=16191,ry=16192,lw=16193,iy=16194,cw=16195,uw=16196,fw=16197,dw=16198,wm=16199,Sm=16200,hw=16201,pw=16202,mw=16203,gw=16204,yw=16205,oy=16206,bw=16207,xw=16208,Bi=16209,Jk=16210,Zk=16211,LT=852,RT=592,OT=15,PT=OT,vw=n=>(n>>>24&255)+(n>>>8&65280)+((n&65280)<<8)+((n&255)<<24);function IT(){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 fd=n=>{if(!n)return 1;const t=n.state;return!t||t.strm!==n||t.mode<b0||t.mode>Zk?1:0},Qk=n=>{if(fd(n))return Bl;const t=n.state;return n.total_in=n.total_out=t.total=0,n.msg="",t.wrap&&(n.adler=t.wrap&1),t.mode=b0,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(LT),t.distcode=t.distdyn=new Int32Array(RT),t.sane=1,t.back=-1,rd},t4=n=>{if(fd(n))return Bl;const t=n.state;return t.wsize=0,t.whave=0,t.wnext=0,Qk(n)},e4=(n,t)=>{let e;if(fd(n))return Bl;const r=n.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Bl:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=e,r.wbits=t,t4(n))},n4=(n,t)=>{if(!n)return Bl;const e=new IT;n.state=e,e.strm=n,e.window=null,e.mode=b0;const r=e4(n,t);return r!==rd&&(n.state=null),r},jT=n=>n4(n,PT);let ww=!0,sy,ay;const zT=n=>{if(ww){sy=new Int32Array(512),ay=new Int32Array(32);let t=0;for(;t<144;)n.lens[t++]=8;for(;t<256;)n.lens[t++]=9;for(;t<280;)n.lens[t++]=7;for(;t<288;)n.lens[t++]=8;for(ep(Wk,n.lens,0,288,sy,0,n.work,{bits:9}),t=0;t<32;)n.lens[t++]=5;ep(Xk,n.lens,0,32,ay,0,n.work,{bits:5}),ww=!1}n.lencode=sy,n.lenbits=9,n.distcode=ay,n.distbits=5},r4=(n,t,e,r)=>{let i;const s=n.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(e-s.wsize,e),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>r&&(i=r),s.window.set(t.subarray(e-r,e-r+i),s.wnext),r-=i,r?(s.window.set(t.subarray(e-r,e),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},BT=(n,t)=>{let e,r,i,s,l,c,f,d,p,g,b,y,M,C,L=0,R,B,q,V,gt,Mt,kt,bt;const it=new Uint8Array(4);let Lt,J;const ct=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(fd(n)||!n.output||!n.input&&n.avail_in!==0)return Bl;e=n.state,e.mode===mu&&(e.mode=ry),l=n.next_out,i=n.output,f=n.avail_out,s=n.next_in,r=n.input,c=n.avail_in,d=e.hold,p=e.bits,g=c,b=f,bt=rd;t:for(;;)switch(e.mode){case b0:if(e.wrap===0){e.mode=ry;break}for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(e.wrap&2&&d===35615){e.wbits===0&&(e.wbits=15),e.check=0,it[0]=d&255,it[1]=d>>>8&255,e.check=Dc(e.check,it,2,0),d=0,p=0,e.mode=Qv;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((d&255)<<8)+(d>>8))%31){n.msg="incorrect header check",e.mode=Bi;break}if((d&15)!==Zv){n.msg="unknown compression method",e.mode=Bi;break}if(d>>>=4,p-=4,kt=(d&15)+8,e.wbits===0&&(e.wbits=kt),kt>15||kt>e.wbits){n.msg="invalid window size",e.mode=Bi;break}e.dmax=1<<e.wbits,e.flags=0,n.adler=e.check=1,e.mode=d&512?aw:mu,d=0,p=0;break;case Qv:for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(e.flags=d,(e.flags&255)!==Zv){n.msg="unknown compression method",e.mode=Bi;break}if(e.flags&57344){n.msg="unknown header flags set",e.mode=Bi;break}e.head&&(e.head.text=d>>8&1),e.flags&512&&e.wrap&4&&(it[0]=d&255,it[1]=d>>>8&255,e.check=Dc(e.check,it,2,0)),d=0,p=0,e.mode=tw;case tw:for(;p<32;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}e.head&&(e.head.time=d),e.flags&512&&e.wrap&4&&(it[0]=d&255,it[1]=d>>>8&255,it[2]=d>>>16&255,it[3]=d>>>24&255,e.check=Dc(e.check,it,4,0)),d=0,p=0,e.mode=ew;case ew:for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}e.head&&(e.head.xflags=d&255,e.head.os=d>>8),e.flags&512&&e.wrap&4&&(it[0]=d&255,it[1]=d>>>8&255,e.check=Dc(e.check,it,2,0)),d=0,p=0,e.mode=nw;case nw:if(e.flags&1024){for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}e.length=d,e.head&&(e.head.extra_len=d),e.flags&512&&e.wrap&4&&(it[0]=d&255,it[1]=d>>>8&255,e.check=Dc(e.check,it,2,0)),d=0,p=0}else e.head&&(e.head.extra=null);e.mode=rw;case rw:if(e.flags&1024&&(y=e.length,y>c&&(y=c),y&&(e.head&&(kt=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(r.subarray(s,s+y),kt)),e.flags&512&&e.wrap&4&&(e.check=Dc(e.check,r,y,s)),c-=y,s+=y,e.length-=y),e.length))break t;e.length=0,e.mode=iw;case iw:if(e.flags&2048){if(c===0)break t;y=0;do kt=r[s+y++],e.head&&kt&&e.length<65536&&(e.head.name+=String.fromCharCode(kt));while(kt&&y<c);if(e.flags&512&&e.wrap&4&&(e.check=Dc(e.check,r,y,s)),c-=y,s+=y,kt)break t}else e.head&&(e.head.name=null);e.length=0,e.mode=ow;case ow:if(e.flags&4096){if(c===0)break t;y=0;do kt=r[s+y++],e.head&&kt&&e.length<65536&&(e.head.comment+=String.fromCharCode(kt));while(kt&&y<c);if(e.flags&512&&e.wrap&4&&(e.check=Dc(e.check,r,y,s)),c-=y,s+=y,kt)break t}else e.head&&(e.head.comment=null);e.mode=sw;case sw:if(e.flags&512){for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(e.wrap&4&&d!==(e.check&65535)){n.msg="header crc mismatch",e.mode=Bi;break}d=0,p=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),n.adler=e.check=0,e.mode=mu;break;case aw:for(;p<32;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}n.adler=e.check=vw(d),d=0,p=0,e.mode=pg;case pg:if(e.havedict===0)return n.next_out=l,n.avail_out=f,n.next_in=s,n.avail_in=c,e.hold=d,e.bits=p,_T;n.adler=e.check=1,e.mode=mu;case mu:if(t===TT||t===vm)break t;case ry:if(e.last){d>>>=p&7,p-=p&7,e.mode=oy;break}for(;p<3;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}switch(e.last=d&1,d>>>=1,p-=1,d&3){case 0:e.mode=lw;break;case 1:if(zT(e),e.mode=wm,t===vm){d>>>=2,p-=2;break t}break;case 2:e.mode=uw;break;case 3:n.msg="invalid block type",e.mode=Bi}d>>>=2,p-=2;break;case lw: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)){n.msg="invalid stored block lengths",e.mode=Bi;break}if(e.length=d&65535,d=0,p=0,e.mode=iy,t===vm)break t;case iy:e.mode=cw;case cw:if(y=e.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,e.length-=y;break}e.mode=mu;break;case uw:for(;p<14;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(e.nlen=(d&31)+257,d>>>=5,p-=5,e.ndist=(d&31)+1,d>>>=5,p-=5,e.ncode=(d&15)+4,d>>>=4,p-=4,e.nlen>286||e.ndist>30){n.msg="too many length or distance symbols",e.mode=Bi;break}e.have=0,e.mode=fw;case fw:for(;e.have<e.ncode;){for(;p<3;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}e.lens[ct[e.have++]]=d&7,d>>>=3,p-=3}for(;e.have<19;)e.lens[ct[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,Lt={bits:e.lenbits},bt=ep(ET,e.lens,0,19,e.lencode,0,e.work,Lt),e.lenbits=Lt.bits,bt){n.msg="invalid code lengths set",e.mode=Bi;break}e.have=0,e.mode=dw;case dw:for(;e.have<e.nlen+e.ndist;){for(;L=e.lencode[d&(1<<e.lenbits)-1],R=L>>>24,B=L>>>16&255,q=L&65535,!(R<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(q<16)d>>>=R,p-=R,e.lens[e.have++]=q;else{if(q===16){for(J=R+2;p<J;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(d>>>=R,p-=R,e.have===0){n.msg="invalid bit length repeat",e.mode=Bi;break}kt=e.lens[e.have-1],y=3+(d&3),d>>>=2,p-=2}else if(q===17){for(J=R+3;p<J;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=R,p-=R,kt=0,y=3+(d&7),d>>>=3,p-=3}else{for(J=R+7;p<J;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=R,p-=R,kt=0,y=11+(d&127),d>>>=7,p-=7}if(e.have+y>e.nlen+e.ndist){n.msg="invalid bit length repeat",e.mode=Bi;break}for(;y--;)e.lens[e.have++]=kt}}if(e.mode===Bi)break;if(e.lens[256]===0){n.msg="invalid code -- missing end-of-block",e.mode=Bi;break}if(e.lenbits=9,Lt={bits:e.lenbits},bt=ep(Wk,e.lens,0,e.nlen,e.lencode,0,e.work,Lt),e.lenbits=Lt.bits,bt){n.msg="invalid literal/lengths set",e.mode=Bi;break}if(e.distbits=6,e.distcode=e.distdyn,Lt={bits:e.distbits},bt=ep(Xk,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,Lt),e.distbits=Lt.bits,bt){n.msg="invalid distances set",e.mode=Bi;break}if(e.mode=wm,t===vm)break t;case wm:e.mode=Sm;case Sm:if(c>=6&&f>=258){n.next_out=l,n.avail_out=f,n.next_in=s,n.avail_in=c,e.hold=d,e.bits=p,wT(n,b),l=n.next_out,i=n.output,f=n.avail_out,s=n.next_in,r=n.input,c=n.avail_in,d=e.hold,p=e.bits,e.mode===mu&&(e.back=-1);break}for(e.back=0;L=e.lencode[d&(1<<e.lenbits)-1],R=L>>>24,B=L>>>16&255,q=L&65535,!(R<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(B&&(B&240)===0){for(V=R,gt=B,Mt=q;L=e.lencode[Mt+((d&(1<<V+gt)-1)>>V)],R=L>>>24,B=L>>>16&255,q=L&65535,!(V+R<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=V,p-=V,e.back+=V}if(d>>>=R,p-=R,e.back+=R,e.length=q,B===0){e.mode=yw;break}if(B&32){e.back=-1,e.mode=mu;break}if(B&64){n.msg="invalid literal/length code",e.mode=Bi;break}e.extra=B&15,e.mode=hw;case hw:if(e.extra){for(J=e.extra;p<J;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}e.length+=d&(1<<e.extra)-1,d>>>=e.extra,p-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=pw;case pw:for(;L=e.distcode[d&(1<<e.distbits)-1],R=L>>>24,B=L>>>16&255,q=L&65535,!(R<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if((B&240)===0){for(V=R,gt=B,Mt=q;L=e.distcode[Mt+((d&(1<<V+gt)-1)>>V)],R=L>>>24,B=L>>>16&255,q=L&65535,!(V+R<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=V,p-=V,e.back+=V}if(d>>>=R,p-=R,e.back+=R,B&64){n.msg="invalid distance code",e.mode=Bi;break}e.offset=q,e.extra=B&15,e.mode=mw;case mw:if(e.extra){for(J=e.extra;p<J;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}e.offset+=d&(1<<e.extra)-1,d>>>=e.extra,p-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){n.msg="invalid distance too far back",e.mode=Bi;break}e.mode=gw;case gw:if(f===0)break t;if(y=b-f,e.offset>y){if(y=e.offset-y,y>e.whave&&e.sane){n.msg="invalid distance too far back",e.mode=Bi;break}y>e.wnext?(y-=e.wnext,M=e.wsize-y):M=e.wnext-y,y>e.length&&(y=e.length),C=e.window}else C=i,M=l-e.offset,y=e.length;y>f&&(y=f),f-=y,e.length-=y;do i[l++]=C[M++];while(--y);e.length===0&&(e.mode=Sm);break;case yw:if(f===0)break t;i[l++]=e.length,f--,e.mode=Sm;break;case oy:if(e.wrap){for(;p<32;){if(c===0)break t;c--,d|=r[s++]<<p,p+=8}if(b-=f,n.total_out+=b,e.total+=b,e.wrap&4&&b&&(n.adler=e.check=e.flags?Dc(e.check,i,b,l-b):h2(e.check,i,b,l-b)),b=f,e.wrap&4&&(e.flags?d:vw(d))!==e.check){n.msg="incorrect data check",e.mode=Bi;break}d=0,p=0}e.mode=bw;case bw:if(e.wrap&&e.flags){for(;p<32;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(e.wrap&4&&d!==(e.total&4294967295)){n.msg="incorrect length check",e.mode=Bi;break}d=0,p=0}e.mode=xw;case xw:bt=NT;break t;case Bi:bt=Gk;break t;case Jk:return Kk;case Zk:default:return Bl}return n.next_out=l,n.avail_out=f,n.next_in=s,n.avail_in=c,e.hold=d,e.bits=p,(e.wsize||b!==n.avail_out&&e.mode<Bi&&(e.mode<oy||t!==Jv))&&r4(n,n.output,n.next_out,b-n.avail_out),g-=n.avail_in,b-=n.avail_out,n.total_in+=g,n.total_out+=b,e.total+=b,e.wrap&4&&b&&(n.adler=e.check=e.flags?Dc(e.check,i,b,n.next_out-b):h2(e.check,i,b,n.next_out-b)),n.data_type=e.bits+(e.last?64:0)+(e.mode===mu?128:0)+(e.mode===wm||e.mode===iy?256:0),(g===0&&b===0||t===Jv)&&bt===rd&&(bt=DT),bt},FT=n=>{if(fd(n))return Bl;let t=n.state;return t.window&&(t.window=null),n.state=null,rd},UT=(n,t)=>{if(fd(n))return Bl;const e=n.state;return(e.wrap&2)===0?Bl:(e.head=t,t.done=!1,rd)},HT=(n,t)=>{const e=t.length;let r,i,s;return fd(n)||(r=n.state,r.wrap!==0&&r.mode!==pg)?Bl:r.mode===pg&&(i=1,i=h2(i,t,e,0),i!==r.check)?Gk:(s=r4(n,t,e,e),s?(r.mode=Jk,Kk):(r.havedict=1,rd))};var qT=t4,$T=e4,YT=Qk,VT=jT,WT=n4,XT=BT,GT=FT,KT=UT,JT=HT,ZT="pako inflate (from Nodeca project)",Su={inflateReset:qT,inflateReset2:$T,inflateResetKeep:YT,inflateInit:VT,inflateInit2:WT,inflate:XT,inflateEnd:GT,inflateGetHeader:KT,inflateSetDictionary:JT,inflateInfo:ZT};function QT(){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 tN=QT;const i4=Object.prototype.toString,{Z_NO_FLUSH:eN,Z_FINISH:nN,Z_OK:gp,Z_STREAM_END:ly,Z_NEED_DICT:cy,Z_STREAM_ERROR:rN,Z_DATA_ERROR:Sw,Z_MEM_ERROR:iN}=$k;function Dp(n){this.options=Yk.assign({chunkSize:1024*64,windowBits:15,to:""},n||{});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&&!(n&&n.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 xT,this.strm.avail_out=0;let e=Su.inflateInit2(this.strm,t.windowBits);if(e!==gp)throw new Error(p2[e]);if(this.header=new tN,Su.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=m2.string2buf(t.dictionary):i4.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=Su.inflateSetDictionary(this.strm,t.dictionary),e!==gp)))throw new Error(p2[e])}Dp.prototype.push=function(n,t){const e=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?nN:eN,i4.call(n)==="[object ArrayBuffer]"?e.input=new Uint8Array(n):e.input=n,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(r),e.next_out=0,e.avail_out=r),s=Su.inflate(e,l),s===cy&&i&&(s=Su.inflateSetDictionary(e,i),s===gp?s=Su.inflate(e,l):s===Sw&&(s=cy));e.avail_in>0&&s===ly&&e.state.wrap>0&&n[e.next_in]!==0;)Su.inflateReset(e),s=Su.inflate(e,l);switch(s){case rN:case Sw:case cy:case iN:return this.onEnd(s),this.ended=!0,!1}if(c=e.avail_out,e.next_out&&(e.avail_out===0||s===ly))if(this.options.to==="string"){let f=m2.utf8border(e.output,e.next_out),d=e.next_out-f,p=m2.buf2string(e.output,f);e.next_out=d,e.avail_out=r-d,d&&e.output.set(e.output.subarray(f,f+d),0),this.onData(p)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(s===gp&&c===0)){if(s===ly)return s=Su.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(e.avail_in===0)break}}return!0};Dp.prototype.onData=function(n){this.chunks.push(n)};Dp.prototype.onEnd=function(n){n===gp&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Yk.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};function oN(n,t){const e=new Dp(t);if(e.push(n),e.err)throw e.msg||p2[e.err];return e.result}var sN=Dp,aN=oN,lN={Inflate:sN,inflate:aN};const{Inflate:cN,inflate:uN}=lN;var kw=cN,fN=uN;const o4=[];for(let n=0;n<256;n++){let t=n;for(let e=0;e<8;e++)t&1?t=3988292384^t>>>1:t=t>>>1;o4[n]=t}const Aw=4294967295;function dN(n,t,e){let r=n;for(let i=0;i<e;i++)r=o4[(r^t[i])&255]^r>>>8;return r}function hN(n,t){return(dN(Aw,n,t)^Aw)>>>0}function Mw(n,t,e){const r=n.readUint32(),i=hN(new Uint8Array(n.buffer,n.byteOffset+n.offset-t-4,t),t);if(i!==r)throw new Error(`CRC mismatch for chunk ${e}. Expected ${r}, found ${i}`)}function s4(n,t,e){for(let r=0;r<e;r++)t[r]=n[r]}function a4(n,t,e,r){let i=0;for(;i<r;i++)t[i]=n[i];for(;i<e;i++)t[i]=n[i]+t[i-r]&255}function l4(n,t,e,r){let i=0;if(e.length===0)for(;i<r;i++)t[i]=n[i];else for(;i<r;i++)t[i]=n[i]+e[i]&255}function c4(n,t,e,r,i){let s=0;if(e.length===0){for(;s<i;s++)t[s]=n[s];for(;s<r;s++)t[s]=n[s]+(t[s-i]>>1)&255}else{for(;s<i;s++)t[s]=n[s]+(e[s]>>1)&255;for(;s<r;s++)t[s]=n[s]+(t[s-i]+e[s]>>1)&255}}function u4(n,t,e,r,i){let s=0;if(e.length===0){for(;s<i;s++)t[s]=n[s];for(;s<r;s++)t[s]=n[s]+t[s-i]&255}else{for(;s<i;s++)t[s]=n[s]+e[s]&255;for(;s<r;s++)t[s]=n[s]+pN(t[s-i],e[s],e[s-i])&255}}function pN(n,t,e){const r=n+t-e,i=Math.abs(r-n),s=Math.abs(r-t),l=Math.abs(r-e);return i<=s&&i<=l?n:s<=l?t:e}function mN(n,t,e,r,i,s){switch(n){case 0:s4(t,e,i);break;case 1:a4(t,e,i,s);break;case 2:l4(t,e,r,i);break;case 3:c4(t,e,r,i,s);break;case 4:u4(t,e,r,i,s);break;default:throw new Error(`Unsupported filter: ${n}`)}}const gN=new Uint16Array([255]),yN=new Uint8Array(gN.buffer),bN=yN[0]===255;function xN(n){const{data:t,width:e,height:r,channels:i,depth:s}=n,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*e*c);let d=0;for(let p=0;p<7;p++){const g=l[p],b=Math.ceil((e-g.x)/g.xStep),y=Math.ceil((r-g.y)/g.yStep);if(b<=0||y<=0)continue;const M=b*c,C=new Uint8Array(M);for(let L=0;L<y;L++){const R=t[d++],B=t.subarray(d,d+M);d+=M;const q=new Uint8Array(M);mN(R,B,q,C,M,c),C.set(q);for(let V=0;V<b;V++){const gt=g.x+V*g.xStep,Mt=g.y+L*g.yStep;if(!(gt>=e||Mt>=r))for(let kt=0;kt<c;kt++)f[(Mt*e+gt)*c+kt]=q[V*c+kt]}}}if(s===16){const p=new Uint16Array(f.buffer);if(bN)for(let g=0;g<p.length;g++)p[g]=vN(p[g]);return p}else return f}function vN(n){return(n&255)<<8|n>>8&255}const wN=new Uint16Array([255]),SN=new Uint8Array(wN.buffer),kN=SN[0]===255,AN=new Uint8Array(0);function Cw(n){const{data:t,width:e,height:r,channels:i,depth:s}=n,l=Math.ceil(s/8)*i,c=Math.ceil(s/8*i*e),f=new Uint8Array(r*c);let d=AN,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:s4(g,b,c);break;case 1:a4(g,b,c,l);break;case 2:l4(g,b,d,c);break;case 3:c4(g,b,d,c,l);break;case 4:u4(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(kN)for(let M=0;M<y.length;M++)y[M]=MN(y[M]);return y}else return f}function MN(n){return(n&255)<<8|n>>8&255}const Zm=Uint8Array.of(137,80,78,71,13,10,26,10);function Ew(n){if(!CN(n.readBytes(Zm.length)))throw new Error("wrong PNG signature")}function CN(n){if(n.length<Zm.length)return!1;for(let t=0;t<Zm.length;t++)if(n[t]!==Zm[t])return!1;return!0}const EN="tEXt",TN=0,f4=new TextDecoder("latin1");function NN(n){if(DN(n),n.length===0||n.length>79)throw new Error("keyword length must be between 1 and 79")}const _N=/^[\u0000-\u00FF]*$/;function DN(n){if(!_N.test(n))throw new Error("invalid latin1 text")}function LN(n,t,e){const r=d4(t);n[r]=RN(t,e-r.length-1)}function d4(n){for(n.mark();n.readByte()!==TN;);const t=n.offset;n.reset();const e=f4.decode(n.readBytes(t-n.offset-1));return n.skip(1),NN(e),e}function RN(n,t){return f4.decode(n.readBytes(t))}const Qa={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},uy={UNKNOWN:-1,DEFLATE:0},Tw={UNKNOWN:-1,ADAPTIVE:0},fy={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},km={NONE:0,BACKGROUND:1,PREVIOUS:2},dy={SOURCE:0,OVER:1};class ON extends b5{_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;constructor(t,e={}){super(t);const{checkCrc:r=!1}=e;this._checkCrc=r,this._inflator=new kw,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=uy.UNKNOWN,this._filterMethod=Tw.UNKNOWN,this._interlaceMethod=fy.UNKNOWN,this._colorType=Qa.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(Ew(this);!this._end;){const t=this.readUint32(),e=this.readChars(4);this.decodeChunk(t,e)}return this.decodeImage(),this._png}decodeApng(){for(Ew(this);!this._end;){const t=this.readUint32(),e=this.readChars(4);this.decodeApngChunk(t,e)}return this.decodeApngImage(),this._apng}decodeChunk(t,e){const r=this.offset;switch(e){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 EN:LN(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 ${e}`);this._checkCrc?Mw(this,t+4,e):this.skip(4)}decodeApngChunk(t,e){const r=this.offset;switch(e!=="fdAT"&&e!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),e){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(t);break;default:this.decodeChunk(t,e),this.offset=r+t;break}if(this.offset-r!==t)throw new Error(`Length mismatch while decoding chunk ${e}`);this._checkCrc?Mw(this,t+4,e):this.skip(4)}decodeIHDR(){const t=this._png;t.width=this.readUint32(),t.height=this.readUint32(),t.depth=PN(this.readUint8());const e=this.readUint8();this._colorType=e;let r;switch(e){case Qa.GREYSCALE:r=1;break;case Qa.TRUECOLOUR:r=3;break;case Qa.INDEXED_COLOUR:r=1;break;case Qa.GREYSCALE_ALPHA:r=2;break;case Qa.TRUECOLOUR_ALPHA:r=4;break;case Qa.UNKNOWN:default:throw new Error(`Unknown color type: ${e}`)}if(this._png.channels=r,this._compressionMethod=this.readUint8(),this._compressionMethod!==uy.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 e=t/3;this._hasPalette=!0;const r=[];this._palette=r;for(let i=0;i<e;i++)r.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(t){this._writingDataChunks=!0;const e=t,r=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,r,e)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(t)}decodeFDAT(t){this._writingDataChunks=!0;let e=t,r=this.offset+this.byteOffset;if(r+=4,e-=4,this._inflator.push(new Uint8Array(this.buffer,r,e)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(t)}decodetRNS(t){switch(this._colorType){case Qa.GREYSCALE:case Qa.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 e=0;e<t/2;e++)this._transparency[e]=this.readUint16();break}case Qa.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 e=0;for(;e<t;e++){const r=this.readByte();this._palette[e].push(r)}for(;e<this._palette.length;e++)this._palette[e].push(255);break}case Qa.UNKNOWN:case Qa.GREYSCALE_ALPHA:case Qa.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(t){const e=d4(this),r=this.readUint8();if(r!==uy.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${r}`);const i=this.readBytes(t-e.length-2);this._png.iccEmbeddedProfile={name:e,profile:fN(i)}}decodepHYs(){const t=this.readUint32(),e=this.readUint32(),r=this.readByte();this._png.resolution={x:t,y:e,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 e={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=Cw({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)e.data=r.data;else{const i=this._apng.frames.at(t-1);this.disposeFrame(r,i,e),this.addFrameDataToCanvas(e,r)}this._apng.frames.push(e)}}return this._apng}disposeFrame(t,e,r){switch(t.disposeOp){case km.NONE:break;case km.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 km.PREVIOUS:r.data.set(e.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(t,e){const r=1<<this._png.depth,i=(s,l)=>{const c=((s+e.yOffset)*this._png.width+e.xOffset+l)*this._png.channels,f=(s*e.width+l)*this._png.channels;return{index:c,frameIndex:f}};switch(e.blendOp){case dy.SOURCE:for(let s=0;s<e.height;s++)for(let l=0;l<e.width;l++){const{index:c,frameIndex:f}=i(s,l);for(let d=0;d<this._png.channels;d++)t.data[c+d]=e.data[f+d]}break;case dy.OVER:for(let s=0;s<e.height;s++)for(let l=0;l<e.width;l++){const{index:c,frameIndex:f}=i(s,l);for(let d=0;d<this._png.channels;d++){const p=e.data[f+this._png.channels-1]/r,g=d%(this._png.channels-1)===0?1:e.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!==Tw.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===fy.NO_INTERLACE)this._png.data=Cw({data:t,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===fy.ADAM7)this._png.data=xN({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,e=this._frames.at(-1);e?e.data=t:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:km.NONE,blendOp:dy.SOURCE,data:t}),this._inflator=new kw,this._writingDataChunks=!1}}function PN(n){if(n!==1&&n!==2&&n!==4&&n!==8&&n!==16)throw new Error(`invalid bit depth: ${n}`);return n}var Nw;(function(n){n[n.UNKNOWN=0]="UNKNOWN",n[n.METRE=1]="METRE"})(Nw||(Nw={}));function IN(n,t){return new ON(n,t).decode()}var Gn=(function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this})();function hy(){Gn.console&&typeof Gn.console.log=="function"&&Gn.console.log.apply(Gn.console,arguments)}var li={log:hy,warn:function(n){Gn.console&&(typeof Gn.console.warn=="function"?Gn.console.warn.apply(Gn.console,arguments):hy.call(null,arguments))},error:function(n){Gn.console&&(typeof Gn.console.error=="function"?Gn.console.error.apply(Gn.console,arguments):hy(n))}};function py(n,t,e){var r=new XMLHttpRequest;r.open("GET",n),r.responseType="blob",r.onload=function(){jf(r.response,t,e)},r.onerror=function(){li.error("could not download file")},r.send()}function _w(n){var t=new XMLHttpRequest;t.open("HEAD",n,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Am(n){try{n.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),n.dispatchEvent(t)}}var jf=Gn.saveAs||((typeof window>"u"?"undefined":Xr(window))!=="object"||window!==Gn?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(n,t,e){var r=Gn.URL||Gn.webkitURL,i=document.createElement("a");t=t||n.name||"download",i.download=t,i.rel="noopener",typeof n=="string"?(i.href=n,i.origin!==location.origin?_w(i.href)?py(n,t,e):Am(i,i.target="_blank"):Am(i)):(i.href=r.createObjectURL(n),setTimeout(function(){r.revokeObjectURL(i.href)},4e4),setTimeout(function(){Am(i)},0))}:"msSaveOrOpenBlob"in navigator?function(n,t,e){if(t=t||n.name||"download",typeof n=="string")if(_w(n))py(n,t,e);else{var r=document.createElement("a");r.href=n,r.target="_blank",setTimeout(function(){Am(r)})}else navigator.msSaveOrOpenBlob((function(i,s){return s===void 0?s={autoBom:!1}:Xr(s)!=="object"&&(li.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})(n,e),t)}:function(n,t,e,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),typeof n=="string")return py(n,t,e);var i=n.type==="application/octet-stream",s=/constructor/i.test(Gn.HTMLElement)||Gn.safari,l=/CriOS\/[\d]+/.test(navigator.userAgent);if((l||i&&s)&&(typeof FileReader>"u"?"undefined":Xr(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(n)}else{var f=Gn.URL||Gn.webkitURL,d=f.createObjectURL(n);r?r.location=d:location.href=d,r=null,setTimeout(function(){f.revokeObjectURL(d)},4e4)}});function h4(n){var t;n=n||"",this.ok=!1,n.charAt(0)=="#"&&(n=n.substr(1,6)),n={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"}[n=(n=n.replace(/ /g,"")).toLowerCase()]||n;for(var e=[{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<e.length;r++){var i=e[r].re,s=e[r].process,l=i.exec(n);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 Qm=Gn.atob.bind(Gn),Dw=Gn.btoa.bind(Gn);function my(n,t){var e=n[0],r=n[1],i=n[2],s=n[3];e=Hs(e,r,i,s,t[0],7,-680876936),s=Hs(s,e,r,i,t[1],12,-389564586),i=Hs(i,s,e,r,t[2],17,606105819),r=Hs(r,i,s,e,t[3],22,-1044525330),e=Hs(e,r,i,s,t[4],7,-176418897),s=Hs(s,e,r,i,t[5],12,1200080426),i=Hs(i,s,e,r,t[6],17,-1473231341),r=Hs(r,i,s,e,t[7],22,-45705983),e=Hs(e,r,i,s,t[8],7,1770035416),s=Hs(s,e,r,i,t[9],12,-1958414417),i=Hs(i,s,e,r,t[10],17,-42063),r=Hs(r,i,s,e,t[11],22,-1990404162),e=Hs(e,r,i,s,t[12],7,1804603682),s=Hs(s,e,r,i,t[13],12,-40341101),i=Hs(i,s,e,r,t[14],17,-1502002290),e=qs(e,r=Hs(r,i,s,e,t[15],22,1236535329),i,s,t[1],5,-165796510),s=qs(s,e,r,i,t[6],9,-1069501632),i=qs(i,s,e,r,t[11],14,643717713),r=qs(r,i,s,e,t[0],20,-373897302),e=qs(e,r,i,s,t[5],5,-701558691),s=qs(s,e,r,i,t[10],9,38016083),i=qs(i,s,e,r,t[15],14,-660478335),r=qs(r,i,s,e,t[4],20,-405537848),e=qs(e,r,i,s,t[9],5,568446438),s=qs(s,e,r,i,t[14],9,-1019803690),i=qs(i,s,e,r,t[3],14,-187363961),r=qs(r,i,s,e,t[8],20,1163531501),e=qs(e,r,i,s,t[13],5,-1444681467),s=qs(s,e,r,i,t[2],9,-51403784),i=qs(i,s,e,r,t[7],14,1735328473),e=$s(e,r=qs(r,i,s,e,t[12],20,-1926607734),i,s,t[5],4,-378558),s=$s(s,e,r,i,t[8],11,-2022574463),i=$s(i,s,e,r,t[11],16,1839030562),r=$s(r,i,s,e,t[14],23,-35309556),e=$s(e,r,i,s,t[1],4,-1530992060),s=$s(s,e,r,i,t[4],11,1272893353),i=$s(i,s,e,r,t[7],16,-155497632),r=$s(r,i,s,e,t[10],23,-1094730640),e=$s(e,r,i,s,t[13],4,681279174),s=$s(s,e,r,i,t[0],11,-358537222),i=$s(i,s,e,r,t[3],16,-722521979),r=$s(r,i,s,e,t[6],23,76029189),e=$s(e,r,i,s,t[9],4,-640364487),s=$s(s,e,r,i,t[12],11,-421815835),i=$s(i,s,e,r,t[15],16,530742520),e=Ys(e,r=$s(r,i,s,e,t[2],23,-995338651),i,s,t[0],6,-198630844),s=Ys(s,e,r,i,t[7],10,1126891415),i=Ys(i,s,e,r,t[14],15,-1416354905),r=Ys(r,i,s,e,t[5],21,-57434055),e=Ys(e,r,i,s,t[12],6,1700485571),s=Ys(s,e,r,i,t[3],10,-1894986606),i=Ys(i,s,e,r,t[10],15,-1051523),r=Ys(r,i,s,e,t[1],21,-2054922799),e=Ys(e,r,i,s,t[8],6,1873313359),s=Ys(s,e,r,i,t[15],10,-30611744),i=Ys(i,s,e,r,t[6],15,-1560198380),r=Ys(r,i,s,e,t[13],21,1309151649),e=Ys(e,r,i,s,t[4],6,-145523070),s=Ys(s,e,r,i,t[11],10,-1120210379),i=Ys(i,s,e,r,t[2],15,718787259),r=Ys(r,i,s,e,t[9],21,-343485551),n[0]=lf(e,n[0]),n[1]=lf(r,n[1]),n[2]=lf(i,n[2]),n[3]=lf(s,n[3])}function x0(n,t,e,r,i,s){return t=lf(lf(t,n),lf(r,s)),lf(t<<i|t>>>32-i,e)}function Hs(n,t,e,r,i,s,l){return x0(t&e|~t&r,n,t,i,s,l)}function qs(n,t,e,r,i,s,l){return x0(t&r|e&~r,n,t,i,s,l)}function $s(n,t,e,r,i,s,l){return x0(t^e^r,n,t,i,s,l)}function Ys(n,t,e,r,i,s,l){return x0(e^(t|~r),n,t,i,s,l)}function p4(n){var t,e=n.length,r=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=n.length;t+=64)my(r,jN(n.substring(t-64,t)));n=n.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<n.length;t++)i[t>>2]|=n.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(my(r,i),t=0;t<16;t++)i[t]=0;return i[14]=8*e,my(r,i),r}function jN(n){var t,e=[];for(t=0;t<64;t+=4)e[t>>2]=n.charCodeAt(t)+(n.charCodeAt(t+1)<<8)+(n.charCodeAt(t+2)<<16)+(n.charCodeAt(t+3)<<24);return e}var Lw="0123456789abcdef".split("");function zN(n){for(var t="",e=0;e<4;e++)t+=Lw[n>>8*e+4&15]+Lw[n>>8*e&15];return t}function BN(n){return String.fromCharCode(255&n,(65280&n)>>8,(16711680&n)>>16,(4278190080&n)>>24)}function g2(n){return p4(n).map(BN).join("")}var FN=(function(n){for(var t=0;t<n.length;t++)n[t]=zN(n[t]);return n.join("")})(p4("hello"))!="5d41402abc4b2a76b9719d911017c592";function lf(n,t){if(FN){var e=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(e>>16)<<16|65535&e}return n+t&4294967295}function y2(n,t){var e,r,i,s;if(n!==e){for(var l=(i=n,s=1+(256/n.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}e=n,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 Rw={print:4,modify:8,copy:16,"annot-forms":32};function jd(n,t,e,r){this.v=1,this.r=2;var i=192;n.forEach(function(c){if(Rw.perm!==void 0)throw new Error("Invalid permission: "+c);i+=Rw[c]}),this.padding="(¿N^NuŠAd\0NVÿú\b..\0¶Ðh>€/\f©þdSiz";var s=(t+this.padding).substr(0,32),l=(e+this.padding).substr(0,32);this.O=this.processOwnerPassword(s,l),this.P=-(1+(255^i)),this.encryptionKey=g2(s+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(r)).substr(0,5),this.U=y2(this.encryptionKey,this.padding)}function zd(n){if(/[^\u0000-\u00ff]/.test(n))throw new Error("Invalid PDF Name Object: "+n+", Only accept ASCII characters.");for(var t="",e=n.length,r=0;r<e;r++){var i=n.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):n[r]}return t}function Ow(n){if(Xr(n)!=="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var t={};this.subscribe=function(e,r,i){if(i=i||!1,typeof e!="string"||typeof r!="function"||typeof i!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");t.hasOwnProperty(e)||(t[e]={});var s=Math.random().toString(35);return t[e][s]=[r,!!i],s},this.unsubscribe=function(e){for(var r in t)if(t[r][e])return delete t[r][e],Object.keys(t[r]).length===0&&delete t[r],!0;return!1},this.publish=function(e){if(t.hasOwnProperty(e)){var r=Array.prototype.slice.call(arguments,1),i=[];for(var s in t[e]){var l=t[e][s];try{l[0].apply(n,r)}catch(c){Gn.console&&li.error("jsPDF PubSub Error",c.message,c)}l[1]&&i.push(s)}i.length&&i.forEach(this.unsubscribe)}},this.getTopics=function(){return t}}function mg(n){if(!(this instanceof mg))return new mg(n);var t="opacity,stroke-opacity".split(",");for(var e in n)n.hasOwnProperty(e)&&t.indexOf(e)>=0&&(this[e]=n[e]);this.id="",this.objectNumber=-1}function m4(n,t){this.gState=n,this.matrix=t,this.id="",this.objectNumber=-1}function zf(n,t,e,r,i){if(!(this instanceof zf))return new zf(n,t,e,r,i);this.type=n==="axial"?2:3,this.coords=t,this.colors=e,m4.call(this,r,i)}function $d(n,t,e,r,i){if(!(this instanceof $d))return new $d(n,t,e,r,i);this.boundingBox=n,this.xStep=t,this.yStep=e,this.stream="",this.cloneIndex=0,m4.call(this,r,i)}function dn(n){var t,e=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;Xr(n=n||{})==="object"&&(e=n.orientation,r=n.unit||r,i=n.format||i,s=n.compress||n.compressPdf||s,(p=n.encryption||null)!==null&&(p.userPassword=p.userPassword||"",p.ownerPassword=p.ownerPassword||"",p.userPermissions=p.userPermissions||[]),c=typeof n.userUnit=="number"?Math.abs(n.userUnit):1,n.precision!==void 0&&(t=n.precision),n.floatPrecision!==void 0&&(f=n.floatPrecision),d=n.defaultPathOperation||"S"),l=n.filters||(s===!0?["FlateEncode"]:l),r=r||"mm",e=(""+(e||"P")).toLowerCase();var g=n.putOnlyUsedFonts||!1,b={},y={internal:{},__private__:{}};y.__private__.PubSub=Ow;var M="1.3",C=y.__private__.getPdfVersion=function(){return M};y.__private__.setPdfVersion=function(A){M=A};var L={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 L};var R=y.__private__.getPageFormat=function(A){return L[A]};i=i||"a4";var B="compat",q="advanced",V=B;function gt(){this.saveGraphicsState(),rt(new Ze($e,0,0,-$e,0,wa()*$e).toString()+" cm"),this.setFontSize(this.getFontSize()/$e),d="n",V=q}function Mt(){this.restoreGraphicsState(),d="S",V=B}var kt=y.__private__.combineFontStyleAndFontWeight=function(A,F){if(A=="bold"&&F=="normal"||A=="bold"&&F==400||A=="normal"&&F=="italic"||A=="bold"&&F=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return F&&(A=F==400||F==="normal"?A==="italic"?"italic":"normal":F!=700&&F!=="bold"||A!=="normal"?(F==700?"bold":F)+""+A:"bold"),A};y.advancedAPI=function(A){var F=V===B;return F&&gt.call(this),typeof A!="function"||(A(this),F&&Mt.call(this)),this},y.compatAPI=function(A){var F=V===q;return F&&Mt.call(this),typeof A!="function"||(A(this),F&&gt.call(this)),this},y.isAdvancedAPI=function(){return V===q};var bt,it=function(A){if(V!==q)throw new Error(A+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},Lt=y.roundToPrecision=y.__private__.roundToPrecision=function(A,F){var dt=t||F;if(isNaN(A)||isNaN(dt))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return A.toFixed(dt).replace(/0+$/,"")};bt=y.hpf=y.__private__.hpf=typeof f=="number"?function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.hpf");return Lt(A,f)}:f==="smart"?function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.hpf");return Lt(A,A>-1&&A<1?16:5)}:function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.hpf");return Lt(A,16)};var J=y.f2=y.__private__.f2=function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.f2");return Lt(A,2)},ct=y.__private__.f3=function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.f3");return Lt(A,3)},G=y.scale=y.__private__.scale=function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.scale");return V===B?A*$e:V===q?A:void 0},vt=function(A){return G((function(F){return V===B?wa()-F:V===q?F:void 0})(A))};y.__private__.setPrecision=y.setPrecision=function(A){typeof parseInt(A,10)=="number"&&(t=parseInt(A,10))};var _t,ht="00000000000000000000000000000000",Z=y.__private__.getFileId=function(){return ht},ut=y.__private__.setFileId=function(A){return ht=A!==void 0&&/^[a-fA-F0-9]{32}$/.test(A)?A.toUpperCase():ht.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),p!==null&&(Rn=new jd(p.userPermissions,p.userPassword,p.ownerPassword,ht)),ht};y.setFileId=function(A){return ut(A),this},y.getFileId=function(){return Z()};var It=y.__private__.convertDateToPDFDate=function(A){var F=A.getTimezoneOffset(),dt=F<0?"+":"-",Nt=Math.floor(Math.abs(F/60)),Bt=Math.abs(F%60),ie=[dt,tt(Nt),"'",tt(Bt),"'"].join("");return["D:",A.getFullYear(),tt(A.getMonth()+1),tt(A.getDate()),tt(A.getHours()),tt(A.getMinutes()),tt(A.getSeconds()),ie].join("")},Zt=y.__private__.convertPDFDateToDate=function(A){var F=parseInt(A.substr(2,4),10),dt=parseInt(A.substr(6,2),10)-1,Nt=parseInt(A.substr(8,2),10),Bt=parseInt(A.substr(10,2),10),ie=parseInt(A.substr(12,2),10),ge=parseInt(A.substr(14,2),10);return new Date(F,dt,Nt,Bt,ie,ge,0)},$=y.__private__.setCreationDate=function(A){var F;if(A===void 0&&(A=new Date),A instanceof Date)F=It(A);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(A))throw new Error("Invalid argument passed to jsPDF.setCreationDate");F=A}return _t=F},N=y.__private__.getCreationDate=function(A){var F=_t;return A==="jsDate"&&(F=Zt(_t)),F};y.setCreationDate=function(A){return $(A),this},y.getCreationDate=function(A){return N(A)};var Q,tt=y.__private__.padd2=function(A){return("0"+parseInt(A)).slice(-2)},pt=y.__private__.padd2Hex=function(A){return("00"+(A=A.toString())).substr(A.length)},wt=0,At=[],Ft=[],Rt=0,Jt=[],ke=[],Re=!1,Ie=Ft;y.__private__.setCustomOutputDestination=function(A){Re=!0,Ie=A};var Ve=function(A){Re||(Ie=A)};y.__private__.resetCustomOutputDestination=function(){Re=!1,Ie=Ft};var rt=y.__private__.out=function(A){return A=A.toString(),Rt+=A.length+1,Ie.push(A),Ie},Oe=y.__private__.write=function(A){return rt(arguments.length===1?A.toString():Array.prototype.join.call(arguments," "))},Cn=y.__private__.getArrayBuffer=function(A){for(var F=A.length,dt=new ArrayBuffer(F),Nt=new Uint8Array(dt);F--;)Nt[F]=A.charCodeAt(F);return dt},cn=[["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 cn};var xe=n.fontSize||16;y.__private__.setFontSize=y.setFontSize=function(A){return xe=V===q?A/$e:A,this};var we,Ne=y.__private__.getFontSize=y.getFontSize=function(){return V===B?xe:xe*$e},De=n.R2L||!1;y.__private__.setR2L=y.setR2L=function(A){return De=A,this},y.__private__.getR2L=y.getR2L=function(){return De};var Fe,tn=y.__private__.setZoomMode=function(A){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(A))we=A;else if(isNaN(A)){if([void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(A)===-1)throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+A+'" is not recognized.');we=A}else we=parseInt(A,10)};y.__private__.getZoomMode=function(){return we};var Pn,mn=y.__private__.setPageMode=function(A){if([void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(A)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+A+'" is not recognized.');Fe=A};y.__private__.getPageMode=function(){return Fe};var In=y.__private__.setLayoutMode=function(A){if([void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(A)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+A+'" is not recognized.');Pn=A};y.__private__.getLayoutMode=function(){return Pn},y.__private__.setDisplayMode=y.setDisplayMode=function(A,F,dt){return tn(A),In(F),mn(dt),this};var hn={title:"",subject:"",author:"",keywords:"",creator:""};y.__private__.getDocumentProperty=function(A){if(Object.keys(hn).indexOf(A)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return hn[A]},y.__private__.getDocumentProperties=function(){return hn},y.__private__.setDocumentProperties=y.setProperties=y.setDocumentProperties=function(A){for(var F in hn)hn.hasOwnProperty(F)&&A[F]&&(hn[F]=A[F]);return this},y.__private__.setDocumentProperty=function(A,F){if(Object.keys(hn).indexOf(A)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return hn[A]=F};var Ue,$e,je,nr,bn,an={},ln={},Bn=[],Xe={},Mr={},gn={},yn={},Qt=null,ye=0,Ce=[],ve=new Ow(y),Zn=n.hotfixes||[],$n={},xr={},Bo=[],Ze=function A(F,dt,Nt,Bt,ie,ge){if(!(this instanceof A))return new A(F,dt,Nt,Bt,ie,ge);isNaN(F)&&(F=1),isNaN(dt)&&(dt=0),isNaN(Nt)&&(Nt=0),isNaN(Bt)&&(Bt=1),isNaN(ie)&&(ie=0),isNaN(ge)&&(ge=0),this._matrix=[F,dt,Nt,Bt,ie,ge]};Object.defineProperty(Ze.prototype,"sx",{get:function(){return this._matrix[0]},set:function(A){this._matrix[0]=A}}),Object.defineProperty(Ze.prototype,"shy",{get:function(){return this._matrix[1]},set:function(A){this._matrix[1]=A}}),Object.defineProperty(Ze.prototype,"shx",{get:function(){return this._matrix[2]},set:function(A){this._matrix[2]=A}}),Object.defineProperty(Ze.prototype,"sy",{get:function(){return this._matrix[3]},set:function(A){this._matrix[3]=A}}),Object.defineProperty(Ze.prototype,"tx",{get:function(){return this._matrix[4]},set:function(A){this._matrix[4]=A}}),Object.defineProperty(Ze.prototype,"ty",{get:function(){return this._matrix[5]},set:function(A){this._matrix[5]=A}}),Object.defineProperty(Ze.prototype,"a",{get:function(){return this._matrix[0]},set:function(A){this._matrix[0]=A}}),Object.defineProperty(Ze.prototype,"b",{get:function(){return this._matrix[1]},set:function(A){this._matrix[1]=A}}),Object.defineProperty(Ze.prototype,"c",{get:function(){return this._matrix[2]},set:function(A){this._matrix[2]=A}}),Object.defineProperty(Ze.prototype,"d",{get:function(){return this._matrix[3]},set:function(A){this._matrix[3]=A}}),Object.defineProperty(Ze.prototype,"e",{get:function(){return this._matrix[4]},set:function(A){this._matrix[4]=A}}),Object.defineProperty(Ze.prototype,"f",{get:function(){return this._matrix[5]},set:function(A){this._matrix[5]=A}}),Object.defineProperty(Ze.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(Ze.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(Ze.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(Ze.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),Ze.prototype.join=function(A){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(bt).join(A)},Ze.prototype.multiply=function(A){var F=A.sx*this.sx+A.shy*this.shx,dt=A.sx*this.shy+A.shy*this.sy,Nt=A.shx*this.sx+A.sy*this.shx,Bt=A.shx*this.shy+A.sy*this.sy,ie=A.tx*this.sx+A.ty*this.shx+this.tx,ge=A.tx*this.shy+A.ty*this.sy+this.ty;return new Ze(F,dt,Nt,Bt,ie,ge)},Ze.prototype.decompose=function(){var A=this.sx,F=this.shy,dt=this.shx,Nt=this.sy,Bt=this.tx,ie=this.ty,ge=Math.sqrt(A*A+F*F),Ge=(A/=ge)*dt+(F/=ge)*Nt;dt-=A*Ge,Nt-=F*Ge;var rn=Math.sqrt(dt*dt+Nt*Nt);return Ge/=rn,A*(Nt/=rn)<F*(dt/=rn)&&(A=-A,F=-F,Ge=-Ge,ge=-ge),{scale:new Ze(ge,0,0,rn,0,0),translate:new Ze(1,0,0,1,Bt,ie),rotate:new Ze(A,F,-F,A,0,0),skew:new Ze(1,0,Ge,1,0,0)}},Ze.prototype.toString=function(A){return this.join(" ")},Ze.prototype.inversed=function(){var A=this.sx,F=this.shy,dt=this.shx,Nt=this.sy,Bt=this.tx,ie=this.ty,ge=1/(A*Nt-F*dt),Ge=Nt*ge,rn=-F*ge,jn=-dt*ge,On=A*ge;return new Ze(Ge,rn,jn,On,-Ge*Bt-jn*ie,-rn*Bt-On*ie)},Ze.prototype.applyToPoint=function(A){var F=A.x*this.sx+A.y*this.shx+this.tx,dt=A.x*this.shy+A.y*this.sy+this.ty;return new ta(F,dt)},Ze.prototype.applyToRectangle=function(A){var F=this.applyToPoint(A),dt=this.applyToPoint(new ta(A.x+A.w,A.y+A.h));return new xa(F.x,F.y,dt.x-F.x,dt.y-F.y)},Ze.prototype.clone=function(){var A=this.sx,F=this.shy,dt=this.shx,Nt=this.sy,Bt=this.tx,ie=this.ty;return new Ze(A,F,dt,Nt,Bt,ie)},y.Matrix=Ze;var ts=y.matrixMult=function(A,F){return F.multiply(A)},Yt=new Ze(1,0,0,1,0,0);y.unitMatrix=y.identityMatrix=Yt;var Ur=function(A,F){if(!Mr[A]){var dt=(F instanceof zf?"Sh":"P")+(Object.keys(Xe).length+1).toString(10);F.id=dt,Mr[A]=dt,Xe[dt]=F,ve.publish("addPattern",F)}};y.ShadingPattern=zf,y.TilingPattern=$d,y.addShadingPattern=function(A,F){return it("addShadingPattern()"),Ur(A,F),this},y.beginTilingPattern=function(A){it("beginTilingPattern()"),Ds(A.boundingBox[0],A.boundingBox[1],A.boundingBox[2]-A.boundingBox[0],A.boundingBox[3]-A.boundingBox[1],A.matrix)},y.endTilingPattern=function(A,F){it("endTilingPattern()"),F.stream=ke[Q].join(`
11
- `),Ur(A,F),ve.publish("endTilingPattern",F),Bo.pop().restore()};var Ni,Tn=y.__private__.newObject=function(){var A=fi();return _i(A,!0),A},fi=y.__private__.newObjectDeferred=function(){return wt++,At[wt]=function(){return Rt},wt},_i=function(A,F){return F=typeof F=="boolean"&&F,At[A]=Rt,F&&rt(A+" 0 obj"),A},ha=y.__private__.newAdditionalObject=function(){var A={objId:fi(),content:""};return Jt.push(A),A},go=fi(),pr=fi(),Cr=y.__private__.decodeColorString=function(A){var F=A.split(" ");if(F.length!==2||F[1]!=="g"&&F[1]!=="G")F.length!==5||F[4]!=="k"&&F[4]!=="K"||(F=[(1-F[0])*(1-F[3]),(1-F[1])*(1-F[3]),(1-F[2])*(1-F[3]),"r"]);else{var dt=parseFloat(F[0]);F=[dt,dt,dt,"r"]}for(var Nt="#",Bt=0;Bt<3;Bt++)Nt+=("0"+Math.floor(255*parseFloat(F[Bt])).toString(16)).slice(-2);return Nt},no=y.__private__.encodeColorString=function(A){var F;typeof A=="string"&&(A={ch1:A});var dt=A.ch1,Nt=A.ch2,Bt=A.ch3,ie=A.ch4,ge=A.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof dt=="string"&&dt.charAt(0)!=="#"){var Ge=new h4(dt);if(Ge.ok)dt=Ge.toHex();else if(!/^\d*\.?\d*$/.test(dt))throw new Error('Invalid color "'+dt+'" passed to jsPDF.encodeColorString.')}if(typeof dt=="string"&&/^#[0-9A-Fa-f]{3}$/.test(dt)&&(dt="#"+dt[1]+dt[1]+dt[2]+dt[2]+dt[3]+dt[3]),typeof dt=="string"&&/^#[0-9A-Fa-f]{6}$/.test(dt)){var rn=parseInt(dt.substr(1),16);dt=rn>>16&255,Nt=rn>>8&255,Bt=255&rn}if(Nt===void 0||ie===void 0&&dt===Nt&&Nt===Bt)F=typeof dt=="string"?dt+" "+ge[0]:A.precision===2?J(dt/255)+" "+ge[0]:ct(dt/255)+" "+ge[0];else if(ie===void 0||Xr(ie)==="object"){if(ie&&!isNaN(ie.a)&&ie.a===0)return["1.","1.","1.",ge[1]].join(" ");F=typeof dt=="string"?[dt,Nt,Bt,ge[1]].join(" "):A.precision===2?[J(dt/255),J(Nt/255),J(Bt/255),ge[1]].join(" "):[ct(dt/255),ct(Nt/255),ct(Bt/255),ge[1]].join(" ")}else F=typeof dt=="string"?[dt,Nt,Bt,ie,ge[2]].join(" "):A.precision===2?[J(dt),J(Nt),J(Bt),J(ie),ge[2]].join(" "):[ct(dt),ct(Nt),ct(Bt),ct(ie),ge[2]].join(" ");return F},Hr=y.__private__.getFilters=function(){return l},sr=y.__private__.putStream=function(A){var F=(A=A||{}).data||"",dt=A.filters||Hr(),Nt=A.alreadyAppliedFilters||[],Bt=A.addLength1||!1,ie=F.length,ge=A.objectId,Ge=function(Li){return Li};if(p!==null&&ge===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");p!==null&&(Ge=Rn.encryptor(ge,0));var rn={};dt===!0&&(dt=["FlateEncode"]);var jn=A.additionalKeyValues||[],On=(rn=dn.API.processDataByFilters!==void 0?dn.API.processDataByFilters(F,dt):{data:F,reverseChain:[]}).reverseChain+(Array.isArray(Nt)?Nt.join(" "):Nt.toString());if(rn.data.length!==0&&(jn.push({key:"Length",value:rn.data.length}),Bt===!0&&jn.push({key:"Length1",value:ie})),On.length!=0)if(On.split("/").length-1==1)jn.push({key:"Filter",value:On});else{jn.push({key:"Filter",value:"["+On+"]"});for(var cr=0;cr<jn.length;cr+=1)if(jn[cr].key==="DecodeParms"){for(var Di=[],pi=0;pi<rn.reverseChain.split("/").length-1;pi+=1)Di.push("null");Di.push(jn[cr].value),jn[cr].value="["+Di.join(" ")+"]"}}rt("<<");for(var Er=0;Er<jn.length;Er++)rt("/"+jn[Er].key+" "+jn[Er].value);rt(">>"),rn.data.length!==0&&(rt("stream"),rt(Ge(rn.data)),rt("endstream"))},Fl=y.__private__.putPage=function(A){var F=A.number,dt=A.data,Nt=A.objId,Bt=A.contentsObjId;_i(Nt,!0),rt("<</Type /Page"),rt("/Parent "+A.rootDictionaryObjId+" 0 R"),rt("/Resources "+A.resourceDictionaryObjId+" 0 R"),rt("/MediaBox ["+parseFloat(bt(A.mediaBox.bottomLeftX))+" "+parseFloat(bt(A.mediaBox.bottomLeftY))+" "+bt(A.mediaBox.topRightX)+" "+bt(A.mediaBox.topRightY)+"]"),A.cropBox!==null&&rt("/CropBox ["+bt(A.cropBox.bottomLeftX)+" "+bt(A.cropBox.bottomLeftY)+" "+bt(A.cropBox.topRightX)+" "+bt(A.cropBox.topRightY)+"]"),A.bleedBox!==null&&rt("/BleedBox ["+bt(A.bleedBox.bottomLeftX)+" "+bt(A.bleedBox.bottomLeftY)+" "+bt(A.bleedBox.topRightX)+" "+bt(A.bleedBox.topRightY)+"]"),A.trimBox!==null&&rt("/TrimBox ["+bt(A.trimBox.bottomLeftX)+" "+bt(A.trimBox.bottomLeftY)+" "+bt(A.trimBox.topRightX)+" "+bt(A.trimBox.topRightY)+"]"),A.artBox!==null&&rt("/ArtBox ["+bt(A.artBox.bottomLeftX)+" "+bt(A.artBox.bottomLeftY)+" "+bt(A.artBox.topRightX)+" "+bt(A.artBox.topRightY)+"]"),typeof A.userUnit=="number"&&A.userUnit!==1&&rt("/UserUnit "+A.userUnit),ve.publish("putPage",{objId:Nt,pageContext:Ce[F],pageNumber:F,page:dt}),rt("/Contents "+Bt+" 0 R"),rt(">>"),rt("endobj");var ie=dt.join(`
12
- `);return V===q&&(ie+=`
13
- Q`),_i(Bt,!0),sr({data:ie,filters:Hr(),objectId:Bt}),rt("endobj"),Nt},Ks=y.__private__.putPages=function(){var A,F,dt=[];for(A=1;A<=ye;A++)Ce[A].objId=fi(),Ce[A].contentsObjId=fi();for(A=1;A<=ye;A++)dt.push(Fl({number:A,data:ke[A],objId:Ce[A].objId,contentsObjId:Ce[A].contentsObjId,mediaBox:Ce[A].mediaBox,cropBox:Ce[A].cropBox,bleedBox:Ce[A].bleedBox,trimBox:Ce[A].trimBox,artBox:Ce[A].artBox,userUnit:Ce[A].userUnit,rootDictionaryObjId:go,resourceDictionaryObjId:pr}));_i(go,!0),rt("<</Type /Pages");var Nt="/Kids [";for(F=0;F<ye;F++)Nt+=dt[F]+" 0 R ";rt(Nt+"]"),rt("/Count "+ye),rt(">>"),rt("endobj"),ve.publish("postPutPages")},es=function(A){ve.publish("putFont",{font:A,out:rt,newObject:Tn,putStream:sr}),A.isAlreadyPutted!==!0&&(A.objectNumber=Tn(),rt("<<"),rt("/Type /Font"),rt("/BaseFont /"+zd(A.postScriptName)),rt("/Subtype /Type1"),typeof A.encoding=="string"&&rt("/Encoding /"+A.encoding),rt("/FirstChar 32"),rt("/LastChar 255"),rt(">>"),rt("endobj"))},pa=function(A){A.objectNumber=Tn();var F=[];F.push({key:"Type",value:"/XObject"}),F.push({key:"Subtype",value:"/Form"}),F.push({key:"BBox",value:"["+[bt(A.x),bt(A.y),bt(A.x+A.width),bt(A.y+A.height)].join(" ")+"]"}),F.push({key:"Matrix",value:"["+A.matrix.toString()+"]"});var dt=A.pages[1].join(`
14
- `);sr({data:dt,additionalKeyValues:F,objectId:A.objectNumber}),rt("endobj")},No=function(A,F){F||(F=21);var dt=Tn(),Nt=(function(ge,Ge){var rn,jn=[],On=1/(Ge-1);for(rn=0;rn<1;rn+=On)jn.push(rn);if(jn.push(1),ge[0].offset!=0){var cr={offset:0,color:ge[0].color};ge.unshift(cr)}if(ge[ge.length-1].offset!=1){var Di={offset:1,color:ge[ge.length-1].color};ge.push(Di)}for(var pi="",Er=0,Li=0;Li<jn.length;Li++){for(rn=jn[Li];rn>ge[Er+1].offset;)Er++;var ce=ge[Er].offset,ei=(rn-ce)/(ge[Er+1].offset-ce),Ri=ge[Er].color,Sn=ge[Er+1].color;pi+=pt(Math.round((1-ei)*Ri[0]+ei*Sn[0]).toString(16))+pt(Math.round((1-ei)*Ri[1]+ei*Sn[1]).toString(16))+pt(Math.round((1-ei)*Ri[2]+ei*Sn[2]).toString(16))}return pi.trim()})(A.colors,F),Bt=[];Bt.push({key:"FunctionType",value:"0"}),Bt.push({key:"Domain",value:"[0.0 1.0]"}),Bt.push({key:"Size",value:"["+F+"]"}),Bt.push({key:"BitsPerSample",value:"8"}),Bt.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),Bt.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),sr({data:Nt,additionalKeyValues:Bt,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:dt}),rt("endobj"),A.objectNumber=Tn(),rt("<< /ShadingType "+A.type),rt("/ColorSpace /DeviceRGB");var ie="/Coords ["+bt(parseFloat(A.coords[0]))+" "+bt(parseFloat(A.coords[1]))+" ";A.type===2?ie+=bt(parseFloat(A.coords[2]))+" "+bt(parseFloat(A.coords[3])):ie+=bt(parseFloat(A.coords[2]))+" "+bt(parseFloat(A.coords[3]))+" "+bt(parseFloat(A.coords[4]))+" "+bt(parseFloat(A.coords[5])),rt(ie+="]"),A.matrix&&rt("/Matrix ["+A.matrix.toString()+"]"),rt("/Function "+dt+" 0 R"),rt("/Extend [true true]"),rt(">>"),rt("endobj")},ma=function(A,F){var dt=fi(),Nt=Tn();F.push({resourcesOid:dt,objectOid:Nt}),A.objectNumber=Nt;var Bt=[];Bt.push({key:"Type",value:"/Pattern"}),Bt.push({key:"PatternType",value:"1"}),Bt.push({key:"PaintType",value:"1"}),Bt.push({key:"TilingType",value:"1"}),Bt.push({key:"BBox",value:"["+A.boundingBox.map(bt).join(" ")+"]"}),Bt.push({key:"XStep",value:bt(A.xStep)}),Bt.push({key:"YStep",value:bt(A.yStep)}),Bt.push({key:"Resources",value:dt+" 0 R"}),A.matrix&&Bt.push({key:"Matrix",value:"["+A.matrix.toString()+"]"}),sr({data:A.stream,additionalKeyValues:Bt,objectId:A.objectNumber}),rt("endobj")},pc=function(A){for(var F in A.objectNumber=Tn(),rt("<<"),A)switch(F){case"opacity":rt("/ca "+J(A[F]));break;case"stroke-opacity":rt("/CA "+J(A[F]))}rt(">>"),rt("endobj")},Js=function(A){_i(A.resourcesOid,!0),rt("<<"),rt("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),(function(){for(var F in rt("/Font <<"),an)an.hasOwnProperty(F)&&(g===!1||g===!0&&b.hasOwnProperty(F))&&rt("/"+F+" "+an[F].objectNumber+" 0 R");rt(">>")})(),(function(){if(Object.keys(Xe).length>0){for(var F in rt("/Shading <<"),Xe)Xe.hasOwnProperty(F)&&Xe[F]instanceof zf&&Xe[F].objectNumber>=0&&rt("/"+F+" "+Xe[F].objectNumber+" 0 R");ve.publish("putShadingPatternDict"),rt(">>")}})(),(function(F){if(Object.keys(Xe).length>0){for(var dt in rt("/Pattern <<"),Xe)Xe.hasOwnProperty(dt)&&Xe[dt]instanceof y.TilingPattern&&Xe[dt].objectNumber>=0&&Xe[dt].objectNumber<F&&rt("/"+dt+" "+Xe[dt].objectNumber+" 0 R");ve.publish("putTilingPatternDict"),rt(">>")}})(A.objectOid),(function(){if(Object.keys(gn).length>0){var F;for(F in rt("/ExtGState <<"),gn)gn.hasOwnProperty(F)&&gn[F].objectNumber>=0&&rt("/"+F+" "+gn[F].objectNumber+" 0 R");ve.publish("putGStateDict"),rt(">>")}})(),(function(){for(var F in rt("/XObject <<"),$n)$n.hasOwnProperty(F)&&$n[F].objectNumber>=0&&rt("/"+F+" "+$n[F].objectNumber+" 0 R");ve.publish("putXobjectDict"),rt(">>")})(),rt(">>"),rt("endobj")},di=function(A){ln[A.fontName]=ln[A.fontName]||{},ln[A.fontName][A.fontStyle]=A.id},sl=function(A,F,dt,Nt,Bt){var ie={id:"F"+(Object.keys(an).length+1).toString(10),postScriptName:A,fontName:F,fontStyle:dt,encoding:Nt,isStandardFont:Bt||!1,metadata:{}};return ve.publish("addFont",{font:ie,instance:this}),an[ie.id]=ie,di(ie),ie.id},Fo=y.__private__.pdfEscape=y.pdfEscape=function(A,F){return(function(dt,Nt){var Bt,ie,ge,Ge,rn,jn,On,cr,Di;if(ge=(Nt=Nt||{}).sourceEncoding||"Unicode",rn=Nt.outputEncoding,(Nt.autoencode||rn)&&an[Ue].metadata&&an[Ue].metadata[ge]&&an[Ue].metadata[ge].encoding&&(Ge=an[Ue].metadata[ge].encoding,!rn&&an[Ue].encoding&&(rn=an[Ue].encoding),!rn&&Ge.codePages&&(rn=Ge.codePages[0]),typeof rn=="string"&&(rn=Ge[rn]),rn)){for(On=!1,jn=[],Bt=0,ie=dt.length;Bt<ie;Bt++)(cr=rn[dt.charCodeAt(Bt)])?jn.push(String.fromCharCode(cr)):jn.push(dt[Bt]),jn[Bt].charCodeAt(0)>>8&&(On=!0);dt=jn.join("")}for(Bt=dt.length;On===void 0&&Bt!==0;)dt.charCodeAt(Bt-1)>>8&&(On=!0),Bt--;if(!On)return dt;for(jn=Nt.noBOM?[]:[254,255],Bt=0,ie=dt.length;Bt<ie;Bt++){if((Di=(cr=dt.charCodeAt(Bt))>>8)>>8)throw new Error("Character at position "+Bt+" of string '"+dt+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");jn.push(Di),jn.push(cr-(Di<<8))}return String.fromCharCode.apply(void 0,jn)})(A,F).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Uo=y.__private__.beginPage=function(A){ke[++ye]=[],Ce[ye]={objId:0,contentsObjId:0,userUnit:Number(c),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(A[0]),topRightY:Number(A[1])}},al(ye),Ve(ke[Q])},_o=function(A,F){var dt,Nt,Bt;switch(e=F||e,typeof A=="string"&&(dt=R(A.toLowerCase()),Array.isArray(dt)&&(Nt=dt[0],Bt=dt[1])),Array.isArray(A)&&(Nt=A[0]*$e,Bt=A[1]*$e),isNaN(Nt)&&(Nt=i[0],Bt=i[1]),(Nt>14400||Bt>14400)&&(li.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),Nt=Math.min(14400,Nt),Bt=Math.min(14400,Bt)),i=[Nt,Bt],e.substr(0,1)){case"l":Bt>Nt&&(i=[Bt,Nt]);break;case"p":Nt>Bt&&(i=[Bt,Nt])}Uo(i),gc(pn),rt(Vo),Po!==0&&rt(Po+" J"),as!==0&&rt(as+" j"),ve.publish("addPage",{pageNumber:ye})},Do=function(A){A>0&&A<=ye&&(ke.splice(A,1),Ce.splice(A,1),ye--,Q>ye&&(Q=ye),this.setPage(Q))},al=function(A){A>0&&A<=ye&&(Q=A)},Ul=y.__private__.getNumberOfPages=y.getNumberOfPages=function(){return ke.length-1},Uc=function(A,F,dt){var Nt,Bt=void 0;return dt=dt||{},A=A!==void 0?A:an[Ue].fontName,F=F!==void 0?F:an[Ue].fontStyle,Nt=A.toLowerCase(),ln[Nt]!==void 0&&ln[Nt][F]!==void 0?Bt=ln[Nt][F]:ln[A]!==void 0&&ln[A][F]!==void 0?Bt=ln[A][F]:dt.disableWarning===!1&&li.warn("Unable to look up font label for font '"+A+"', '"+F+"'. Refer to getFontList() for available fonts."),Bt||dt.noFallback||(Bt=ln.times[F])==null&&(Bt=ln.times.normal),Bt},ns=y.__private__.putInfo=function(){var A=Tn(),F=function(Nt){return Nt};for(var dt in p!==null&&(F=Rn.encryptor(A,0)),rt("<<"),rt("/Producer ("+Fo(F("jsPDF "+dn.version))+")"),hn)hn.hasOwnProperty(dt)&&hn[dt]&&rt("/"+dt.substr(0,1).toUpperCase()+dt.substr(1)+" ("+Fo(F(hn[dt]))+")");rt("/CreationDate ("+Fo(F(_t))+")"),rt(">>"),rt("endobj")},ga=y.__private__.putCatalog=function(A){var F=(A=A||{}).rootDictionaryObjId||go;switch(Tn(),rt("<<"),rt("/Type /Catalog"),rt("/Pages "+F+" 0 R"),we||(we="fullwidth"),we){case"fullwidth":rt("/OpenAction [3 0 R /FitH null]");break;case"fullheight":rt("/OpenAction [3 0 R /FitV null]");break;case"fullpage":rt("/OpenAction [3 0 R /Fit]");break;case"original":rt("/OpenAction [3 0 R /XYZ null null 1]");break;default:var dt=""+we;dt.substr(dt.length-1)==="%"&&(we=parseInt(we)/100),typeof we=="number"&&rt("/OpenAction [3 0 R /XYZ null null "+J(we)+"]")}switch(Pn||(Pn="continuous"),Pn){case"continuous":rt("/PageLayout /OneColumn");break;case"single":rt("/PageLayout /SinglePage");break;case"two":case"twoleft":rt("/PageLayout /TwoColumnLeft");break;case"tworight":rt("/PageLayout /TwoColumnRight")}Fe&&rt("/PageMode /"+Fe),ve.publish("putCatalog"),rt(">>"),rt("endobj")},Lo=y.__private__.putTrailer=function(){rt("trailer"),rt("<<"),rt("/Size "+(wt+1)),rt("/Root "+wt+" 0 R"),rt("/Info "+(wt-1)+" 0 R"),p!==null&&rt("/Encrypt "+Rn.oid+" 0 R"),rt("/ID [ <"+ht+"> <"+ht+"> ]"),rt(">>")},Fn=y.__private__.putHeader=function(){rt("%PDF-"+M),rt("%ºß¬à")},Ho=y.__private__.putXRef=function(){var A="0000000000";rt("xref"),rt("0 "+(wt+1)),rt("0000000000 65535 f ");for(var F=1;F<=wt;F++)typeof At[F]=="function"?rt((A+At[F]()).slice(-10)+" 00000 n "):At[F]!==void 0?rt((A+At[F]).slice(-10)+" 00000 n "):rt("0000000000 00000 n ")},vi=y.__private__.buildDocument=function(){var A;wt=0,Rt=0,Ft=[],At=[],Jt=[],go=fi(),pr=fi(),Ve(Ft),ve.publish("buildDocument"),Fn(),Ks(),(function(){ve.publish("putAdditionalObjects");for(var dt=0;dt<Jt.length;dt++){var Nt=Jt[dt];_i(Nt.objId,!0),rt(Nt.content),rt("endobj")}ve.publish("postPutAdditionalObjects")})(),A=[],(function(){for(var dt in an)an.hasOwnProperty(dt)&&(g===!1||g===!0&&b.hasOwnProperty(dt))&&es(an[dt])})(),(function(){var dt;for(dt in gn)gn.hasOwnProperty(dt)&&pc(gn[dt])})(),(function(){for(var dt in $n)$n.hasOwnProperty(dt)&&pa($n[dt])})(),(function(dt){var Nt;for(Nt in Xe)Xe.hasOwnProperty(Nt)&&(Xe[Nt]instanceof zf?No(Xe[Nt]):Xe[Nt]instanceof $d&&ma(Xe[Nt],dt))})(A),ve.publish("putResources"),A.forEach(Js),Js({resourcesOid:pr,objectOid:Number.MAX_SAFE_INTEGER}),ve.publish("postPutResources"),p!==null&&(Rn.oid=Tn(),rt("<<"),rt("/Filter /Standard"),rt("/V "+Rn.v),rt("/R "+Rn.r),rt("/U <"+Rn.toHexString(Rn.U)+">"),rt("/O <"+Rn.toHexString(Rn.O)+">"),rt("/P "+Rn.P),rt(">>"),rt("endobj")),ns(),ga();var F=Rt;return Ho(),Lo(),rt("startxref"),rt(""+F),rt("%%EOF"),Ve(ke[Q]),Ft.join(`
15
- `)},ro=y.__private__.getBlob=function(A){return new Blob([Cn(A)],{type:"application/pdf"})},_r=function(A){for(;A.firstChild;)A.removeChild(A.firstChild)},hi=function(A){var F,dt=A.document,Nt=dt.documentElement,Bt=dt.head,ie=dt.body;return Bt||(Bt=dt.createElement("head"),Nt.appendChild(Bt)),ie||(ie=dt.createElement("body"),Nt.appendChild(ie)),_r(Bt),_r(ie),(F=dt.createElement("style")).appendChild(dt.createTextNode("html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;}")),Bt.appendChild(F),{document:dt,body:ie}},Ui=y.output=y.__private__.output=(Ni=function(A,F){switch(typeof(F=F||{})=="string"?F={filename:F}:F.filename=F.filename||"generated.pdf",A){case void 0:return vi();case"save":y.save(F.filename);break;case"arraybuffer":return Cn(vi());case"blob":return ro(vi());case"bloburi":case"bloburl":if(Gn.URL!==void 0&&typeof Gn.URL.createObjectURL=="function")return Gn.URL&&Gn.URL.createObjectURL(ro(vi()))||void 0;li.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var dt="",Nt=vi();try{dt=Dw(Nt)}catch{dt=Dw(unescape(encodeURIComponent(Nt)))}return"data:application/pdf;filename="+encodeURIComponent(F.filename)+";base64,"+dt;case"pdfobjectnewwindow":case"pdfjsnewwindow":throw new Error("jsPDF viewer output modes are disabled in this build.");case"dataurlnewwindow":if(Object.prototype.toString.call(Gn)!=="[object Window]")throw new Error("The option dataurlnewwindow just works in a browser-environment.");var Bt=Gn.open();if(Bt!==null){var ie=hi(Bt),ge=ie.document.createElement("iframe");ge.src=this.output("datauristring",F),ie.body.appendChild(ge),Bt.document.title=F.filename}if(Bt||typeof safari>"u")return Bt;break;case"datauri":case"dataurl":return Gn.document.location.href=this.output("datauristring",F);default:return null}},Ni.foo=function(){try{return Ni.apply(this,arguments)}catch(dt){var A=dt.stack||"";~A.indexOf(" at ")&&(A=A.split(" at ")[1]);var F="Error in function "+A.split(`
16
- `)[0].split("<")[0]+": "+dt.message;if(!Gn.console)throw new Error(F);Gn.console.error(F,dt),Gn.alert&&alert(F)}},Ni.foo.bar=Ni,Ni.foo),vr=function(A){return Array.isArray(Zn)===!0&&Zn.indexOf(A)>-1};switch(r){case"pt":$e=1;break;case"mm":$e=72/25.4;break;case"cm":$e=72/2.54;break;case"in":$e=72;break;case"px":$e=vr("px_scaling")==1?.75:96/72;break;case"pc":case"em":$e=12;break;case"ex":$e=6;break;default:if(typeof r!="number")throw new Error("Invalid unit: "+r);$e=r}var Rn=null;$(),ut();var ya=y.__private__.getPageInfo=y.getPageInfo=function(A){if(isNaN(A)||A%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfo");return{objId:Ce[A].objId,pageNumber:A,pageContext:Ce[A]}},ll=y.__private__.getPageInfoByObjId=function(A){if(isNaN(A)||A%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");for(var F in Ce)if(Ce[F].objId===A)break;return ya(F)},qo=y.__private__.getCurrentPageInfo=y.getCurrentPageInfo=function(){return{objId:Ce[Q].objId,pageNumber:Q,pageContext:Ce[Q]}};y.addPage=function(){return _o.apply(this,arguments),this},y.setPage=function(){return al.apply(this,arguments),Ve.call(this,ke[Q]),this},y.insertPage=function(A){return this.addPage(),this.movePage(Q,A),this},y.movePage=function(A,F){var dt,Nt;if(A>F){dt=ke[A],Nt=Ce[A];for(var Bt=A;Bt>F;Bt--)ke[Bt]=ke[Bt-1],Ce[Bt]=Ce[Bt-1];ke[F]=dt,Ce[F]=Nt,this.setPage(F)}else if(A<F){dt=ke[A],Nt=Ce[A];for(var ie=A;ie<F;ie++)ke[ie]=ke[ie+1],Ce[ie]=Ce[ie+1];ke[F]=dt,Ce[F]=Nt,this.setPage(F)}return this},y.deletePage=function(){return Do.apply(this,arguments),this},y.__private__.text=y.text=function(A,F,dt,Nt,Bt){var ie,ge,Ge,rn,jn,On,cr,Di,pi,Er=(Nt=Nt||{}).scope||this;if(typeof A=="number"&&typeof F=="number"&&(typeof dt=="string"||Array.isArray(dt))){var Li=dt;dt=F,F=A,A=Li}if(arguments[3]instanceof Ze==0?(Ge=arguments[4],rn=arguments[5],Xr(cr=arguments[3])==="object"&&cr!==null||(typeof Ge=="string"&&(rn=Ge,Ge=null),typeof cr=="string"&&(rn=cr,cr=null),typeof cr=="number"&&(Ge=cr,cr=null),Nt={flags:cr,angle:Ge,align:rn})):(it("The transform parameter of text() with a Matrix value"),pi=Bt),isNaN(F)||isNaN(dt)||A==null)throw new Error("Invalid arguments passed to jsPDF.text");if(A.length===0)return Er;var ce,ei="",Ri=typeof Nt.lineHeightFactor=="number"?Nt.lineHeightFactor:Oo,Sn=Er.internal.scaleFactor;function Dn(ar){return ar=ar.split(" ").join(Array(Nt.TabLen||9).join(" ")),Fo(ar,cr)}function Fa(ar){for(var Dr,ri=ar.concat(),qr=[],Aa=ri.length;Aa--;)typeof(Dr=ri.shift())=="string"?qr.push(Dr):Array.isArray(ar)&&(Dr.length===1||Dr[1]===void 0&&Dr[2]===void 0)?qr.push(Dr[0]):qr.push([Dr[0],Dr[1],Dr[2]]);return qr}function ls(ar,Dr){var ri;if(typeof ar=="string")ri=Dr(ar)[0];else if(Array.isArray(ar)){for(var qr,Aa,Kl=ar.concat(),bl=[],Jl=Kl.length;Jl--;)typeof(qr=Kl.shift())=="string"?bl.push(Dr(qr)[0]):Array.isArray(qr)&&typeof qr[0]=="string"&&(Aa=Dr(qr[0],qr[1],qr[2]),bl.push([Aa[0],Aa[1],Aa[2]]));ri=bl}return ri}var ul=!1,wr=!0;if(typeof A=="string")ul=!0;else if(Array.isArray(A)){var Ps=A.concat();ge=[];for(var Wl,Oi=Ps.length;Oi--;)(typeof(Wl=Ps.shift())!="string"||Array.isArray(Wl)&&typeof Wl[0]!="string")&&(wr=!1);ul=wr}if(ul===!1)throw new Error('Type of text must be string or Array. "'+A+'" is not recognized.');typeof A=="string"&&(A=A.match(/[\r?\n]/)?A.split(/\r\n|\r|\n/g):[A]);var fl=xe/Er.internal.scaleFactor,Wo=fl*(Ri-1);switch(Nt.baseline){case"bottom":dt-=Wo;break;case"top":dt+=fl-Wo;break;case"hanging":dt+=fl-2*Wo;break;case"middle":dt+=fl/2-Wo}if((On=Nt.maxWidth||0)>0&&(typeof A=="string"?A=Er.splitTextToSize(A,On):Object.prototype.toString.call(A)==="[object Array]"&&(A=A.reduce(function(ar,Dr){return ar.concat(Er.splitTextToSize(Dr,On))},[]))),ie={text:A,x:F,y:dt,options:Nt,mutex:{pdfEscape:Fo,activeFontKey:Ue,fonts:an,activeFontSize:xe}},ve.publish("preProcessText",ie),A=ie.text,Ge=(Nt=ie.options).angle,pi instanceof Ze==0&&Ge&&typeof Ge=="number"){Ge*=Math.PI/180,Nt.rotationDirection===0&&(Ge=-Ge),V===q&&(Ge=-Ge);var bc=Math.cos(Ge),cs=Math.sin(Ge);pi=new Ze(bc,cs,-cs,bc,0,0)}else Ge&&Ge instanceof Ze&&(pi=Ge);V!==q||pi||(pi=Yt),(jn=Nt.charSpace||Qs)!==void 0&&(ei+=bt(G(jn))+` Tc
17
- `,this.setCharSpace(this.getCharSpace()||0)),(Di=Nt.horizontalScale)!==void 0&&(ei+=bt(100*Di)+` Tz
18
- `),Nt.lang;var xo=-1,xc=Nt.renderingMode!==void 0?Nt.renderingMode:Nt.stroke,dl=Er.internal.getCurrentPageInfo().pageContext;switch(xc){case 0:case!1:case"fill":xo=0;break;case 1:case!0:case"stroke":xo=1;break;case 2:case"fillThenStroke":xo=2;break;case 3:case"invisible":xo=3;break;case 4:case"fillAndAddForClipping":xo=4;break;case 5:case"strokeAndAddPathForClipping":xo=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":xo=6;break;case 7:case"addToPathForClipping":xo=7}var Ua=dl.usedRenderingMode!==void 0?dl.usedRenderingMode:-1;xo!==-1?ei+=xo+` Tr
19
- `:Ua!==-1&&(ei+=`0 Tr
20
- `),xo!==-1&&(dl.usedRenderingMode=xo),rn=Nt.align||"left";var io,hl=xe*Ri,na=Er.internal.pageSize.getWidth(),us=an[Ue];jn=Nt.charSpace||Qs,On=Nt.maxWidth||0,cr=Object.assign({autoencode:!0,noBOM:!0},Nt.flags);var Ha=[],qa=function(ar){return Er.getStringUnitWidth(ar,{font:us,charSpace:jn,fontSize:xe,doKerning:!1})*xe/Sn};if(Object.prototype.toString.call(A)==="[object Array]"){var Vi;ge=Fa(A),rn!=="left"&&(io=ge.map(qa));var ni,qi=0;if(rn==="right"){F-=io[0],A=[],Oi=ge.length;for(var Is=0;Is<Oi;Is++)Is===0?(ni=Yo(F),Vi=yo(dt)):(ni=G(qi-io[Is]),Vi=-hl),A.push([ge[Is],ni,Vi]),qi=io[Is]}else if(rn==="center"){F-=io[0]/2,A=[],Oi=ge.length;for(var vo=0;vo<Oi;vo++)vo===0?(ni=Yo(F),Vi=yo(dt)):(ni=G((qi-io[vo])/2),Vi=-hl),A.push([ge[vo],ni,Vi]),qi=io[vo]}else if(rn==="left"){A=[],Oi=ge.length;for(var pl=0;pl<Oi;pl++)A.push(ge[pl])}else if(rn==="justify"&&us.encoding==="Identity-H"){A=[],Oi=ge.length,On=On!==0?On:na;for(var ml=0,mi=0;mi<Oi;mi++)if(Vi=mi===0?yo(dt):-hl,ni=mi===0?Yo(F):ml,mi<Oi-1){var Me=G((On-io[mi])/(ge[mi].split(" ").length-1)),ur=ge[mi].split(" ");A.push([ur[0]+" ",ni,Vi]),ml=0;for(var wo=1;wo<ur.length;wo++){var Sa=(qa(ur[wo-1]+" "+ur[wo])-qa(ur[wo]))*Sn+Me;wo==ur.length-1?A.push([ur[wo],Sa,0]):A.push([ur[wo]+" ",Sa,0]),ml-=Sa}}else A.push([ge[mi],ni,Vi]);A.push(["",ml,0])}else{if(rn!=="justify")throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');for(A=[],Oi=ge.length,On=On!==0?On:na,mi=0;mi<Oi;mi++){Vi=mi===0?yo(dt):-hl,ni=mi===0?Yo(F):0;var vc=ge[mi].split(" ").length-1,gl=vc>0?(On-io[mi])/vc:0;mi<Oi-1?Ha.push(bt(G(gl))):Ha.push(0),A.push([ge[mi],ni,Vi])}}}(typeof Nt.R2L=="boolean"?Nt.R2L:De)===!0&&(A=ls(A,function(ar,Dr,ri){return[ar.split("").reverse().join(""),Dr,ri]})),ie={text:A,x:F,y:dt,options:Nt,mutex:{pdfEscape:Fo,activeFontKey:Ue,fonts:an,activeFontSize:xe}},ve.publish("postProcessText",ie),A=ie.text,ce=ie.mutex.isHex||!1;var Xl=an[Ue].encoding;Xl!=="WinAnsiEncoding"&&Xl!=="StandardEncoding"||(A=ls(A,function(ar,Dr,ri){return[Dn(ar),Dr,ri]})),ge=Fa(A),A=[];for(var ka,Gl,fs,js=Array.isArray(ge[0])?1:0,ds="",yl=function(ar,Dr,ri){var qr="";return ri instanceof Ze?(ri=typeof Nt.angle=="number"?ts(ri,new Ze(1,0,0,1,ar,Dr)):ts(new Ze(1,0,0,1,ar,Dr),ri),V===q&&(ri=ts(new Ze(1,0,0,-1,0,0),ri)),qr=ri.join(" ")+` Tm
21
- `):qr=bt(ar)+" "+bt(Dr)+` Td
22
- `,qr},Wi=0;Wi<ge.length;Wi++){switch(ds="",js){case 1:fs=(ce?"<":"(")+ge[Wi][0]+(ce?">":")"),ka=parseFloat(ge[Wi][1]),Gl=parseFloat(ge[Wi][2]);break;case 0:fs=(ce?"<":"(")+ge[Wi]+(ce?">":")"),ka=Yo(F),Gl=yo(dt)}Ha!==void 0&&Ha[Wi]!==void 0&&(ds=Ha[Wi]+` Tw
23
- `),Wi===0?A.push(ds+yl(ka,Gl,pi)+fs):js===0?A.push(ds+fs):js===1&&A.push(ds+yl(ka,Gl,pi)+fs)}A=js===0?A.join(` Tj
24
- T* `):A.join(` Tj
25
- `),A+=` Tj
26
- `;var wi=`BT
27
- /`;return wi+=Ue+" "+xe+` Tf
28
- `,wi+=bt(xe*Ri)+` TL
29
- `,wi+=bo+`
30
- `,wi+=ei,wi+=A,rt(wi+="ET"),b[Ue]=!0,Er};var te=y.__private__.clip=y.clip=function(A){return rt(A==="evenodd"?"W*":"W"),this};y.clipEvenOdd=function(){return te("evenodd")},y.__private__.discardPath=y.discardPath=function(){return rt("n"),this};var Zs=y.__private__.isValidStyle=function(A){var F=!1;return[void 0,null,"S","D","F","DF","FD","f","f*","B","B*","n"].indexOf(A)!==-1&&(F=!0),F};y.__private__.setDefaultPathOperation=y.setDefaultPathOperation=function(A){return Zs(A)&&(d=A),this};var $o=y.__private__.getStyle=y.getStyle=function(A){var F=d;switch(A){case"D":case"S":F="S";break;case"F":F="f";break;case"FD":case"DF":F="B";break;case"f":case"f*":case"B":case"B*":F=A}return F},mc=y.close=function(){return rt("h"),this};y.stroke=function(){return rt("S"),this},y.fill=function(A){return Ts("f",A),this},y.fillEvenOdd=function(A){return Ts("f*",A),this},y.fillStroke=function(A){return Ts("B",A),this},y.fillStrokeEvenOdd=function(A){return Ts("B*",A),this};var Ts=function(A,F){Xr(F)==="object"?Af(F,A):rt(A)},Hl=function(A){A===null||V===q&&A===void 0||(A=$o(A),rt(A))};function Hc(A,F,dt,Nt,Bt){var ie=new $d(F||this.boundingBox,dt||this.xStep,Nt||this.yStep,this.gState,Bt||this.matrix);ie.stream=this.stream;var ge=A+"$$"+this.cloneIndex+++"$$";return Ur(ge,ie),ie}var Af=function(A,F){var dt=Mr[A.key],Nt=Xe[dt];if(Nt instanceof zf)rt("q"),rt(Nu(F)),Nt.gState&&y.setGState(Nt.gState),rt(A.matrix.toString()+" cm"),rt("/"+dt+" sh"),rt("Q");else if(Nt instanceof $d){var Bt=new Ze(1,0,0,-1,0,wa());A.matrix&&(Bt=Bt.multiply(A.matrix||Yt),dt=Hc.call(Nt,A.key,A.boundingBox,A.xStep,A.yStep,Bt).id),rt("q"),rt("/Pattern cs"),rt("/"+dt+" scn"),Nt.gState&&y.setGState(Nt.gState),rt(F),rt("Q")}},Nu=function(A){switch(A){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"}},Ns=y.moveTo=function(A,F){return rt(bt(G(A))+" "+bt(vt(F))+" m"),this},Ro=y.lineTo=function(A,F){return rt(bt(G(A))+" "+bt(vt(F))+" l"),this},rs=y.curveTo=function(A,F,dt,Nt,Bt,ie){return rt([bt(G(A)),bt(vt(F)),bt(G(dt)),bt(vt(Nt)),bt(G(Bt)),bt(vt(ie)),"c"].join(" ")),this};y.__private__.line=y.line=function(A,F,dt,Nt,Bt){if(isNaN(A)||isNaN(F)||isNaN(dt)||isNaN(Nt)||!Zs(Bt))throw new Error("Invalid arguments passed to jsPDF.line");return V===B?this.lines([[dt-A,Nt-F]],A,F,[1,1],Bt||"S"):this.lines([[dt-A,Nt-F]],A,F,[1,1]).stroke()},y.__private__.lines=y.lines=function(A,F,dt,Nt,Bt,ie){var ge,Ge,rn,jn,On,cr,Di,pi,Er,Li,ce,ei;if(typeof A=="number"&&(ei=dt,dt=F,F=A,A=ei),Nt=Nt||[1,1],ie=ie||!1,isNaN(F)||isNaN(dt)||!Array.isArray(A)||!Array.isArray(Nt)||!Zs(Bt)||typeof ie!="boolean")throw new Error("Invalid arguments passed to jsPDF.lines");for(Ns(F,dt),ge=Nt[0],Ge=Nt[1],jn=A.length,Li=F,ce=dt,rn=0;rn<jn;rn++)(On=A[rn]).length===2?(Li=On[0]*ge+Li,ce=On[1]*Ge+ce,Ro(Li,ce)):(cr=On[0]*ge+Li,Di=On[1]*Ge+ce,pi=On[2]*ge+Li,Er=On[3]*Ge+ce,Li=On[4]*ge+Li,ce=On[5]*Ge+ce,rs(cr,Di,pi,Er,Li,ce));return ie&&mc(),Hl(Bt),this},y.path=function(A){for(var F=0;F<A.length;F++){var dt=A[F],Nt=dt.c;switch(dt.op){case"m":Ns(Nt[0],Nt[1]);break;case"l":Ro(Nt[0],Nt[1]);break;case"c":rs.apply(this,Nt);break;case"h":mc()}}return this},y.__private__.rect=y.rect=function(A,F,dt,Nt,Bt){if(isNaN(A)||isNaN(F)||isNaN(dt)||isNaN(Nt)||!Zs(Bt))throw new Error("Invalid arguments passed to jsPDF.rect");return V===B&&(Nt=-Nt),rt([bt(G(A)),bt(vt(F)),bt(G(dt)),bt(G(Nt)),"re"].join(" ")),Hl(Bt),this},y.__private__.triangle=y.triangle=function(A,F,dt,Nt,Bt,ie,ge){if(isNaN(A)||isNaN(F)||isNaN(dt)||isNaN(Nt)||isNaN(Bt)||isNaN(ie)||!Zs(ge))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[dt-A,Nt-F],[Bt-dt,ie-Nt],[A-Bt,F-ie]],A,F,[1,1],ge,!0),this},y.__private__.roundedRect=y.roundedRect=function(A,F,dt,Nt,Bt,ie,ge){if(isNaN(A)||isNaN(F)||isNaN(dt)||isNaN(Nt)||isNaN(Bt)||isNaN(ie)||!Zs(ge))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var Ge=4/3*(Math.SQRT2-1);return Bt=Math.min(Bt,.5*dt),ie=Math.min(ie,.5*Nt),this.lines([[dt-2*Bt,0],[Bt*Ge,0,Bt,ie-ie*Ge,Bt,ie],[0,Nt-2*ie],[0,ie*Ge,-Bt*Ge,ie,-Bt,ie],[2*Bt-dt,0],[-Bt*Ge,0,-Bt,-ie*Ge,-Bt,-ie],[0,2*ie-Nt],[0,-ie*Ge,Bt*Ge,-ie,Bt,-ie]],A+Bt,F,[1,1],ge,!0),this},y.__private__.ellipse=y.ellipse=function(A,F,dt,Nt,Bt){if(isNaN(A)||isNaN(F)||isNaN(dt)||isNaN(Nt)||!Zs(Bt))throw new Error("Invalid arguments passed to jsPDF.ellipse");var ie=4/3*(Math.SQRT2-1)*dt,ge=4/3*(Math.SQRT2-1)*Nt;return Ns(A+dt,F),rs(A+dt,F-ge,A+ie,F-Nt,A,F-Nt),rs(A-ie,F-Nt,A-dt,F-ge,A-dt,F),rs(A-dt,F+ge,A-ie,F+Nt,A,F+Nt),rs(A+ie,F+Nt,A+dt,F+ge,A+dt,F),Hl(Bt),this},y.__private__.circle=y.circle=function(A,F,dt,Nt){if(isNaN(A)||isNaN(F)||isNaN(dt)||!Zs(Nt))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(A,F,dt,dt,Nt)},y.setFont=function(A,F,dt){return dt&&(F=kt(F,dt)),Ue=Uc(A,F,{disableWarning:!1}),this};var ql=y.__private__.getFont=y.getFont=function(){return an[Uc.apply(y,arguments)]};y.__private__.getFontList=y.getFontList=function(){var A,F,dt={};for(A in ln)if(ln.hasOwnProperty(A))for(F in dt[A]=[],ln[A])ln[A].hasOwnProperty(F)&&dt[A].push(F);return dt},y.addFont=function(A,F,dt,Nt,Bt){var ie=["StandardEncoding","MacRomanEncoding","Identity-H","WinAnsiEncoding"];return arguments[3]&&ie.indexOf(arguments[3])!==-1?Bt=arguments[3]:arguments[3]&&ie.indexOf(arguments[3])==-1&&(dt=kt(dt,Nt)),sl.call(this,A,F,dt,Bt=Bt||"Identity-H")};var Oo,pn=n.lineWidth||.200025,qc=y.__private__.getLineWidth=y.getLineWidth=function(){return pn},gc=y.__private__.setLineWidth=y.setLineWidth=function(A){return pn=A,rt(bt(G(A))+" w"),this};y.__private__.setLineDash=dn.API.setLineDash=dn.API.setLineDashPattern=function(A,F){if(A=A||[],F=F||0,isNaN(F)||!Array.isArray(A))throw new Error("Invalid arguments passed to jsPDF.setLineDash");return A=A.map(function(dt){return bt(G(dt))}).join(" "),F=bt(G(F)),rt("["+A+"] "+F+" d"),this};var yc=y.__private__.getLineHeight=y.getLineHeight=function(){return xe*Oo};y.__private__.getLineHeight=y.getLineHeight=function(){return xe*Oo};var mr=y.__private__.setLineHeightFactor=y.setLineHeightFactor=function(A){return typeof(A=A||1.15)=="number"&&(Oo=A),this},is=y.__private__.getLineHeightFactor=y.getLineHeightFactor=function(){return Oo};mr(n.lineHeight);var Yo=y.__private__.getHorizontalCoordinate=function(A){return G(A)},yo=y.__private__.getVerticalCoordinate=function(A){return V===q?A:Ce[Q].mediaBox.topRightY-Ce[Q].mediaBox.bottomLeftY-G(A)},ss=y.__private__.getHorizontalCoordinateString=y.getHorizontalCoordinateString=function(A){return bt(Yo(A))},ba=y.__private__.getVerticalCoordinateString=y.getVerticalCoordinateString=function(A){return bt(yo(A))},Vo=n.strokeColor||"0 G";y.__private__.getStrokeColor=y.getDrawColor=function(){return Cr(Vo)},y.__private__.setStrokeColor=y.setDrawColor=function(A,F,dt,Nt){return Vo=no({ch1:A,ch2:F,ch3:dt,ch4:Nt,pdfColorType:"draw",precision:2}),rt(Vo),this};var za=n.fillColor||"0 g";y.__private__.getFillColor=y.getFillColor=function(){return Cr(za)},y.__private__.setFillColor=y.setFillColor=function(A,F,dt,Nt){return za=no({ch1:A,ch2:F,ch3:dt,ch4:Nt,pdfColorType:"fill",precision:2}),rt(za),this};var bo=n.textColor||"0 g",Ba=y.__private__.getTextColor=y.getTextColor=function(){return Cr(bo)};y.__private__.setTextColor=y.setTextColor=function(A,F,dt,Nt){return bo=no({ch1:A,ch2:F,ch3:dt,ch4:Nt,pdfColorType:"text",precision:3}),this};var Qs=n.charSpace,Hi=y.__private__.getCharSpace=y.getCharSpace=function(){return parseFloat(Qs||0)};y.__private__.setCharSpace=y.setCharSpace=function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return Qs=A,this};var Po=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(A){var F=y.CapJoinStyles[A];if(F===void 0)throw new Error("Line cap style of '"+A+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return Po=F,rt(F+" J"),this};var as=0;y.__private__.setLineJoin=y.setLineJoin=function(A){var F=y.CapJoinStyles[A];if(F===void 0)throw new Error("Line join style of '"+A+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return as=F,rt(F+" j"),this},y.__private__.setLineMiterLimit=y.__private__.setMiterLimit=y.setLineMiterLimit=y.setMiterLimit=function(A){if(A=A||0,isNaN(A))throw new Error("Invalid argument passed to jsPDF.setLineMiterLimit");return rt(bt(G(A))+" M"),this},y.GState=mg,y.setGState=function(A){(A=typeof A=="string"?gn[yn[A]]:_s(null,A)).equals(Qt)||(rt("/"+A.id+" gs"),Qt=A)};var _s=function(A,F){if(!A||!yn[A]){var dt=!1;for(var Nt in gn)if(gn.hasOwnProperty(Nt)&&gn[Nt].equals(F)){dt=!0;break}if(dt)F=gn[Nt];else{var Bt="GS"+(Object.keys(gn).length+1).toString(10);gn[Bt]=F,F.id=Bt}return A&&(yn[A]=F.id),ve.publish("addGState",F),F}};y.addGState=function(A,F){return _s(A,F),this},y.saveGraphicsState=function(){return rt("q"),Bn.push({key:Ue,size:xe,color:bo}),this},y.restoreGraphicsState=function(){rt("Q");var A=Bn.pop();return Ue=A.key,xe=A.size,bo=A.color,Qt=null,this},y.setCurrentTransformationMatrix=function(A){return rt(A.toString()+" cm"),this},y.comment=function(A){return rt("#"+A),this};var ta=function(A,F){var dt=A||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return dt},set:function(ie){isNaN(ie)||(dt=parseFloat(ie))}});var Nt=F||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return Nt},set:function(ie){isNaN(ie)||(Nt=parseFloat(ie))}});var Bt="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return Bt},set:function(ie){Bt=ie.toString()}}),this},xa=function(A,F,dt,Nt){ta.call(this,A,F),this.type="rect";var Bt=dt||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return Bt},set:function(ge){isNaN(ge)||(Bt=parseFloat(ge))}});var ie=Nt||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return ie},set:function(ge){isNaN(ge)||(ie=parseFloat(ge))}}),this},ea=function(){this.page=ye,this.currentPage=Q,this.pages=ke.slice(0),this.pagesContext=Ce.slice(0),this.x=je,this.y=nr,this.matrix=bn,this.width=cl(Q),this.height=Os(Q),this.outputDestination=Ie,this.id="",this.objectNumber=-1};ea.prototype.restore=function(){ye=this.page,Q=this.currentPage,Ce=this.pagesContext,ke=this.pages,je=this.x,nr=this.y,bn=this.matrix,Rs(Q,this.width),$l(Q,this.height),Ie=this.outputDestination};var Ds=function(A,F,dt,Nt,Bt){Bo.push(new ea),ye=Q=0,ke=[],je=A,nr=F,bn=Bt,Uo([dt,Nt])};for(var Ls in y.beginFormObject=function(A,F,dt,Nt,Bt){return Ds(A,F,dt,Nt,Bt),this},y.endFormObject=function(A){return(function(F){if(xr[F])Bo.pop().restore();else{var dt=new ea,Nt="Xo"+(Object.keys($n).length+1).toString(10);dt.id=Nt,xr[F]=Nt,$n[Nt]=dt,ve.publish("addFormObject",dt),Bo.pop().restore()}})(A),this},y.doFormObject=function(A,F){var dt=$n[xr[A]];return rt("q"),rt(F.toString()+" cm"),rt("/"+dt.id+" Do"),rt("Q"),this},y.getFormObject=function(A){var F=$n[xr[A]];return{x:F.x,y:F.y,width:F.width,height:F.height,matrix:F.matrix}},y.save=function(A,F){return A=A||"generated.pdf",(F=F||{}).returnPromise=F.returnPromise||!1,F.returnPromise===!1?(jf(ro(vi()),A),typeof jf.unload=="function"&&Gn.setTimeout&&setTimeout(jf.unload,911),this):new Promise(function(dt,Nt){try{var Bt=jf(ro(vi()),A);typeof jf.unload=="function"&&Gn.setTimeout&&setTimeout(jf.unload,911),dt(Bt)}catch(ie){Nt(ie.message)}})},dn.API)dn.API.hasOwnProperty(Ls)&&(Ls==="events"&&dn.API.events.length?(function(A,F){var dt,Nt,Bt;for(Bt=F.length-1;Bt!==-1;Bt--)dt=F[Bt][0],Nt=F[Bt][1],A.subscribe.apply(A,[dt].concat(typeof Nt=="function"?[Nt]:Nt))})(ve,dn.API.events):y[Ls]=dn.API[Ls]);function cl(A){return Ce[A].mediaBox.topRightX-Ce[A].mediaBox.bottomLeftX}function Rs(A,F){Ce[A].mediaBox.topRightX=F+Ce[A].mediaBox.bottomLeftX}function Os(A){return Ce[A].mediaBox.topRightY-Ce[A].mediaBox.bottomLeftY}function $l(A,F){Ce[A].mediaBox.topRightY=F+Ce[A].mediaBox.bottomLeftY}var va=y.getPageWidth=function(A){return cl(A=A||Q)/$e},Yl=y.setPageWidth=function(A,F){Rs(A,F*$e)},wa=y.getPageHeight=function(A){return Os(A=A||Q)/$e},Vl=y.setPageHeight=function(A,F){$l(A,F*$e)};return y.internal={pdfEscape:Fo,getStyle:$o,getFont:ql,getFontSize:Ne,getCharSpace:Hi,getTextColor:Ba,getLineHeight:yc,getLineHeightFactor:is,getLineWidth:qc,write:Oe,getHorizontalCoordinate:Yo,getVerticalCoordinate:yo,getCoordinateString:ss,getVerticalCoordinateString:ba,collections:{},newObject:Tn,newAdditionalObject:ha,newObjectDeferred:fi,newObjectDeferredBegin:_i,getFilters:Hr,putStream:sr,events:ve,scaleFactor:$e,pageSize:{getWidth:function(){return va(Q)},setWidth:function(A){Yl(Q,A)},getHeight:function(){return wa(Q)},setHeight:function(A){Vl(Q,A)}},encryptionOptions:p,encryption:Rn,getEncryptor:function(A){return p!==null?Rn.encryptor(A,0):function(F){return F}},output:Ui,getNumberOfPages:Ul,get pages(){return ke},out:rt,f2:J,f3:ct,getPageInfo:ya,getPageInfoByObjId:ll,getCurrentPageInfo:qo,getPDFVersion:C,Point:ta,Rectangle:xa,Matrix:Ze,hasHotfix:vr},Object.defineProperty(y.internal.pageSize,"width",{get:function(){return va(Q)},set:function(A){Yl(Q,A)},enumerable:!0,configurable:!0}),Object.defineProperty(y.internal.pageSize,"height",{get:function(){return wa(Q)},set:function(A){Vl(Q,A)},enumerable:!0,configurable:!0}),(function(A){for(var F=0,dt=cn.length;F<dt;F++){var Nt=sl.call(this,A[F][0],A[F][1],A[F][2],cn[F][3],!0);g===!1&&(b[Nt]=!0);var Bt=A[F][0].split("-");di({id:Nt,fontName:Bt[0],fontStyle:Bt[1]||""})}ve.publish("addFonts",{fonts:an,dictionary:ln})}).call(y,cn),Ue="F1",_o(i,e),ve.publish("initialized"),y}jd.prototype.lsbFirstWord=function(n){return String.fromCharCode(255&n,n>>8&255,n>>16&255,n>>24&255)},jd.prototype.toHexString=function(n){return n.split("").map(function(t){return("0"+(255&t.charCodeAt(0)).toString(16)).slice(-2)}).join("")},jd.prototype.hexToBytes=function(n){for(var t=[],e=0;e<n.length;e+=2)t.push(String.fromCharCode(parseInt(n.substr(e,2),16)));return t.join("")},jd.prototype.processOwnerPassword=function(n,t){return y2(g2(t).substr(0,5),n)},jd.prototype.encryptor=function(n,t){var e=g2(this.encryptionKey+String.fromCharCode(255&n,n>>8&255,n>>16&255,255&t,t>>8&255)).substr(0,10);return function(r){return y2(e,r)}},mg.prototype.equals=function(n){var t,e="id,objectNumber,equals";if(!n||Xr(n)!==Xr(this))return!1;var r=0;for(t in this)if(!(e.indexOf(t)>=0)){if(this.hasOwnProperty(t)&&!n.hasOwnProperty(t)||this[t]!==n[t])return!1;r++}for(t in n)n.hasOwnProperty(t)&&e.indexOf(t)<0&&r--;return r===0},dn.API={events:[]},dn.version="4.2.1";var Qi=dn.API,x5=1,dd=function(n){return n.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Nd=function(n){return n.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},id=function(n){return n.toString().replace(/#/g,"#23").replace(/[\s\n\r()<>[\]{}\/%]/g,function(t){var e=t.charCodeAt(0).toString(16).toUpperCase();return"#"+(e.length===1?"0"+e:e)})},Wn=function(n){return n.toFixed(2)},Gu=function(n){return n.toFixed(5)};Qi.__acroform__={};var ja=function(n,t){n.prototype=Object.create(t.prototype),n.prototype.constructor=n},Pw=function(n){return n*x5},Rc=function(n){var t=new y4,e=sn.internal.getHeight(n)||0,r=sn.internal.getWidth(n)||0;return t.BBox=[0,0,Number(Wn(r)),Number(Wn(e))],t},UN=Qi.__acroform__.setBit=function(n,t){if(n=n||0,t=t||0,isNaN(n)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBit");return n|1<<t},HN=Qi.__acroform__.clearBit=function(n,t){if(n=n||0,t=t||0,isNaN(n)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBit");return n&~(1<<t)},qN=Qi.__acroform__.getBit=function(n,t){if(isNaN(n)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBit");return n&1<<t?1:0},fo=Qi.__acroform__.getBitForPdf=function(n,t){if(isNaN(n)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return qN(n,t-1)},ho=Qi.__acroform__.setBitForPdf=function(n,t){if(isNaN(n)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return UN(n,t-1)},po=Qi.__acroform__.clearBitForPdf=function(n,t){if(isNaN(n)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return HN(n,t-1)},$N=Qi.__acroform__.calculateCoordinates=function(n,t){var e=t.internal.getHorizontalCoordinate,r=t.internal.getVerticalCoordinate,i=n[0],s=n[1],l=n[2],c=n[3],f={};return f.lowerLeft_X=e(i)||0,f.lowerLeft_Y=r(s+c)||0,f.upperRight_X=e(i+l)||0,f.upperRight_Y=r(s)||0,[Number(Wn(f.lowerLeft_X)),Number(Wn(f.lowerLeft_Y)),Number(Wn(f.upperRight_X)),Number(Wn(f.upperRight_Y))]},YN=function(n){if(n.appearanceStreamContent)return n.appearanceStreamContent;if(n.V||n.DV){var t=[],e=n._V||n.DV,r=b2(n,e),i=n.scope.internal.getFont(n.fontName,n.fontStyle).id;t.push("/Tx BMC"),t.push("q"),t.push("BT"),t.push(n.scope.__private__.encodeColorString(n.color)),t.push("/"+i+" "+Wn(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=Rc(n);return s.scope=n.scope,s.stream=t.join(`
31
- `),s}},b2=function(n,t){var e=n.fontSize===0?n.maxFontSize:n.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=n.multiline?i.map(function(J){return J.split(`
32
- `)}):i.map(function(J){return[J]});var s=e,l=sn.internal.getHeight(n)||0;l=l<0?-l:l;var c=sn.internal.getWidth(n)||0;c=c<0?-c:c;var f=function(J,ct,G){if(J+1<i.length){var vt=ct+" "+i[J+1][0];return Mm(vt,n,G).width<=c-4}return!1};s++;t:for(;s>0;){t="",s--;var d,p,g=Mm("3",n,s).height,b=n.multiline?l-s:(l-g)/2,y=b+=2,M=0,C=0,L=0;if(s<=0){t=`(...) Tj
33
- `,t+="% Width of Text: "+Mm(t,n,s=12).width+", FieldWidth:"+c+`
34
- `;break}for(var R="",B=0,q=0;q<i.length;q++)if(i.hasOwnProperty(q)){var V=!1;if(i[q].length!==1&&L!==i[q].length-1){if((g+2)*(B+2)+2>l)continue t;R+=i[q][L],V=!0,C=q,q--}else{R=(R+=i[q][L]+" ").substr(R.length-1)==" "?R.substr(0,R.length-1):R;var gt=parseInt(q),Mt=f(gt,R,s),kt=q>=i.length-1;if(Mt&&!kt){R+=" ",L=0;continue}if(Mt||kt){if(kt)C=gt;else if(n.multiline&&(g+2)*(B+2)+2>l)continue t}else{if(!n.multiline||(g+2)*(B+2)+2>l)continue t;C=gt}}for(var bt="",it=M;it<=C;it++){var Lt=i[it];if(n.multiline){if(it===C){bt+=Lt[L]+" ",L=(L+1)%Lt.length;continue}if(it===M){bt+=Lt[Lt.length-1]+" ";continue}}bt+=Lt[0]+" "}switch(bt=bt.substr(bt.length-1)==" "?bt.substr(0,bt.length-1):bt,p=Mm(bt,n,s).width,n.textAlign){case"right":d=c-p-2;break;case"center":d=(c-p)/2;break;default:d=2}t+=Wn(d)+" "+Wn(y)+` Td
35
- `,t+="("+dd(bt)+`) Tj
36
- `,t+=-Wn(d)+` 0 Td
37
- `,y=-(s+2),p=0,M=V?C:C+1,B++,R=""}break}return r.text=t,r.fontSize=s,r},Mm=function(n,t,e){var r=t.scope.internal.getFont(t.fontName,t.fontStyle),i=t.scope.getStringUnitWidth(n,{font:r,fontSize:parseFloat(e),charSpace:0})*parseFloat(e);return{height:t.scope.getStringUnitWidth("3",{font:r,fontSize:parseFloat(e),charSpace:0})*parseFloat(e)*1.5,width:i}},VN={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},WN=function(n,t){var e={type:"reference",object:n};t.internal.getPageInfo(n.page).pageContext.annotations.find(function(r){return r.type===e.type&&r.object===e.object})===void 0&&t.internal.getPageInfo(n.page).pageContext.annotations.push(e)},XN=function(n,t){if(t.scope=n,n.internal!==void 0&&(n.internal.acroformPlugin===void 0||n.internal.acroformPlugin.isInitialized===!1)){if(dc.FieldNum=0,n.internal.acroformPlugin=JSON.parse(JSON.stringify(VN)),n.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");x5=n.internal.scaleFactor,n.internal.acroformPlugin.acroFormDictionaryRoot=new b4,n.internal.acroformPlugin.acroFormDictionaryRoot.scope=n,n.internal.acroformPlugin.acroFormDictionaryRoot._eventID=n.internal.events.subscribe("postPutResources",function(){(function(e){e.internal.events.unsubscribe(e.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete e.internal.acroformPlugin.acroFormDictionaryRoot._eventID,e.internal.acroformPlugin.printedOut=!0})(n)}),n.internal.events.subscribe("buildDocument",function(){(function(e){e.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var r=e.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var i in r)if(r.hasOwnProperty(i)){var s=r[i];s.objId=void 0,s.hasAnnotation&&WN(s,e)}})(n)}),n.internal.events.subscribe("putCatalog",function(){(function(e){if(e.internal.acroformPlugin.acroFormDictionaryRoot===void 0)throw new Error("putCatalogCallback: Root missing.");e.internal.write("/AcroForm "+e.internal.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R")})(n)}),n.internal.events.subscribe("postPutPages",function(e){(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=$N(c.Rect,i)),i.internal.newObjectDeferredBegin(c.objId,!0),c.DA=sn.createDefaultAppearanceStream(c),Xr(c)==="object"&&typeof c.getKeyValueListForStream=="function"&&(f=c.getKeyValueListForStream()),c.Rect=d,c.hasAppearanceStream&&!c.appearanceStreamContent){var p=YN(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(C,L){for(var R in C)if(C.hasOwnProperty(R)){var B=R,q=C[R];L.internal.newObjectDeferredBegin(q.objId,!0),Xr(q)==="object"&&typeof q.putStream=="function"&&q.putStream(),delete C[B]}})(i.internal.acroformPlugin.xForms,i)})(e,n)}),n.internal.acroformPlugin.isInitialized=!0}},g4=Qi.__acroform__.arrayToPdfArray=function(n,t,e){var r=function(l){return l};if(Array.isArray(n)){for(var i="[",s=0;s<n.length;s++)switch(s!==0&&(i+=" "),Xr(n[s])){case"boolean":case"number":case"object":i+=n[s].toString();break;case"string":n[s].substr(0,1)==="/"?i+="/"+id(n[s].substr(1)):(t!==void 0&&e&&(r=e.internal.getEncryptor(t)),i+="("+dd(r(n[s].toString()))+")")}return i+"]"}throw new Error("Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray")},gy=function(n,t,e){var r=function(i){return i};return t!==void 0&&e&&(r=e.internal.getEncryptor(t)),(n=n||"").toString(),"("+dd(r(n))+")"},jc=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(n){this._objId=n}}),Object.defineProperty(this,"scope",{value:this._scope,writable:!0})};jc.prototype.toString=function(){return this.objId+" 0 R"},jc.prototype.putStream=function(){var n=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:n,objectId:this.objId}),this.scope.internal.out("endobj")},jc.prototype.getKeyValueListForStream=function(){var n=[],t=Object.getOwnPropertyNames(this).filter(function(s){return s!="content"&&s!="appearanceStreamContent"&&s!="scope"&&s!="objId"&&s.substring(0,1)!="_"});for(var e in t)if(Object.getOwnPropertyDescriptor(this,t[e]).configurable===!1){var r=t[e],i=this[r];i&&(Array.isArray(i)?n.push({key:r,value:g4(i,this.objId,this.scope)}):i instanceof jc?(i.scope=this.scope,n.push({key:r,value:i.objId+" 0 R"})):typeof i!="function"&&n.push({key:r,value:i}))}return n};var y4=function(){jc.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 n,t=[];Object.defineProperty(this,"BBox",{configurable:!1,get:function(){return t},set:function(e){t=e}}),Object.defineProperty(this,"Resources",{value:"2 0 R",configurable:!1,writable:!0}),Object.defineProperty(this,"stream",{enumerable:!1,configurable:!0,set:function(e){n=e.trim()},get:function(){return n||null}})};ja(y4,jc);var b4=function(){jc.call(this);var n,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(n){var e=function(r){return r};return this.scope&&(e=this.scope.internal.getEncryptor(this.objId)),"("+dd(e(n))+")"}},set:function(e){n=e}})};ja(b4,jc);var dc=function n(){jc.call(this);var t=4;Object.defineProperty(this,"F",{enumerable:!1,configurable:!1,get:function(){return t},set:function(R){if(isNaN(R))throw new Error('Invalid value "'+R+'" for attribute F supplied.');t=R}}),Object.defineProperty(this,"showWhenPrinted",{enumerable:!0,configurable:!0,get:function(){return!!fo(t,3)},set:function(R){R?this.F=ho(t,3):this.F=po(t,3)}});var e=0;Object.defineProperty(this,"Ff",{enumerable:!1,configurable:!1,get:function(){return e},set:function(R){if(isNaN(R))throw new Error('Invalid value "'+R+'" for attribute Ff supplied.');e=R}});var r=[];Object.defineProperty(this,"Rect",{enumerable:!1,configurable:!1,get:function(){if(r.length!==0)return r},set:function(R){r=R!==void 0?R:[]}}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[0])?0:r[0]},set:function(R){r[0]=R}}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[1])?0:r[1]},set:function(R){r[1]=R}}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[2])?0:r[2]},set:function(R){r[2]=R}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[3])?0:r[3]},set:function(R){r[3]=R}});var i="";Object.defineProperty(this,"FT",{enumerable:!0,configurable:!1,get:function(){return i},set:function(R){switch(R){case"/Btn":case"/Tx":case"/Ch":case"/Sig":i=R;break;default:throw new Error('Invalid value "'+R+'" 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 gg)return;s="FieldObject"+n.FieldNum++}var R=function(B){return B};return this.scope&&(R=this.scope.internal.getEncryptor(this.objId)),"("+dd(R(s))+")"},set:function(R){s=R.toString()}}),Object.defineProperty(this,"fieldName",{configurable:!0,enumerable:!0,get:function(){return s},set:function(R){s=R}});var l="helvetica";Object.defineProperty(this,"fontName",{enumerable:!0,configurable:!0,get:function(){return l},set:function(R){l=R}});var c="normal";Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,get:function(){return c},set:function(R){c=R}});var f=0;Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,get:function(){return f},set:function(R){f=R}});var d=void 0;Object.defineProperty(this,"maxFontSize",{enumerable:!0,configurable:!0,get:function(){return d===void 0?50/x5:d},set:function(R){d=R}});var p="black";Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,get:function(){return p},set:function(R){p=R}});var g="/F1 0 Tf 0 g";Object.defineProperty(this,"DA",{enumerable:!0,configurable:!1,get:function(){if(!(!g||this instanceof gg||this instanceof Xf))return gy(g,this.objId,this.scope)},set:function(R){R=R.toString(),g=R}});var b=null;Object.defineProperty(this,"DV",{enumerable:!1,configurable:!1,get:function(){if(b)return this instanceof Jo==0?gy(b,this.objId,this.scope):b},set:function(R){R=R.toString(),b=this instanceof Jo==0?R.substr(0,1)==="("?Nd(R.substr(1,R.length-2)):Nd(R):R}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof Jo==1?Nd(b.substr(1,b.length-1)):b},set:function(R){R=R.toString(),b=this instanceof Jo==1?"/"+id(R):R}});var y=null;Object.defineProperty(this,"_V",{enumerable:!1,configurable:!1,get:function(){if(y)return y},set:function(R){this.V=R}}),Object.defineProperty(this,"V",{enumerable:!1,configurable:!1,get:function(){if(y)return this instanceof Jo==0?gy(y,this.objId,this.scope):y},set:function(R){R=R.toString(),y=this instanceof Jo==0?R.substr(0,1)==="("?Nd(R.substr(1,R.length-2)):Nd(R):R}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof Jo==1?Nd(y.substr(1,y.length-1)):y},set:function(R){R=R.toString(),y=this instanceof Jo==1?"/"+id(R):R}}),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,C=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return C},set:function(R){R=!!R,C=R}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(M)return M},set:function(R){M=R}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,1)},set:function(R){R?this.Ff=ho(this.Ff,1):this.Ff=po(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,2)},set:function(R){R?this.Ff=ho(this.Ff,2):this.Ff=po(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,3)},set:function(R){R?this.Ff=ho(this.Ff,3):this.Ff=po(this.Ff,3)}});var L=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(L!==null)return L},set:function(R){if([0,1,2].indexOf(R)===-1)throw new Error('Invalid value "'+R+'" for attribute Q supplied.');L=R}}),Object.defineProperty(this,"textAlign",{get:function(){var R;switch(L){case 0:default:R="left";break;case 1:R="center";break;case 2:R="right"}return R},configurable:!0,enumerable:!0,set:function(R){switch(R){case"right":case 2:L=2;break;case"center":case 1:L=1;break;default:L=0}}})};ja(dc,jc);var Vd=function(){dc.call(this),this.FT="/Ch",this.V="()",this.fontName="zapfdingbats";var n=0;Object.defineProperty(this,"TI",{enumerable:!0,configurable:!1,get:function(){return n},set:function(e){n=e}}),Object.defineProperty(this,"topIndex",{enumerable:!0,configurable:!0,get:function(){return n},set:function(e){n=e}});var t=[];Object.defineProperty(this,"Opt",{enumerable:!0,configurable:!1,get:function(){return g4(t,this.objId,this.scope)},set:function(e){var r,i;i=[],typeof(r=e)=="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(e){t=e,this.sort&&t.sort()},this.addOption=function(e){e=(e=e||"").toString(),t.push(e),this.sort&&t.sort()},this.removeOption=function(e,r){for(r=r||!1,e=(e=e||"").toString();t.indexOf(e)!==-1&&(t.splice(t.indexOf(e),1),r!==!1););},Object.defineProperty(this,"combo",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,18)},set:function(e){e?this.Ff=ho(this.Ff,18):this.Ff=po(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,19)},set:function(e){this.combo===!0&&(e?this.Ff=ho(this.Ff,19):this.Ff=po(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,20)},set:function(e){e?(this.Ff=ho(this.Ff,20),t.sort()):this.Ff=po(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,22)},set:function(e){e?this.Ff=ho(this.Ff,22):this.Ff=po(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,23)},set:function(e){e?this.Ff=ho(this.Ff,23):this.Ff=po(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,27)},set:function(e){e?this.Ff=ho(this.Ff,27):this.Ff=po(this.Ff,27)}}),this.hasAppearanceStream=!1};ja(Vd,dc);var Wd=function(){Vd.call(this),this.fontName="helvetica",this.combo=!1};ja(Wd,Vd);var Xd=function(){Wd.call(this),this.combo=!0};ja(Xd,Wd);var tg=function(){Xd.call(this),this.edit=!0};ja(tg,Xd);var Jo=function(){dc.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,15)},set:function(e){e?this.Ff=ho(this.Ff,15):this.Ff=po(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,16)},set:function(e){e?this.Ff=ho(this.Ff,16):this.Ff=po(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,17)},set:function(e){e?this.Ff=ho(this.Ff,17):this.Ff=po(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,26)},set:function(e){e?this.Ff=ho(this.Ff,26):this.Ff=po(this.Ff,26)}});var n,t={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var e=function(s){return s};if(this.scope&&(e=this.scope.internal.getEncryptor(this.objId)),Object.keys(t).length!==0){var r,i=[];for(r in i.push("<<"),t)i.push("/"+r+" ("+dd(e(t[r]))+")");return i.push(">>"),i.join(`
39
- `)}},set:function(e){Xr(e)==="object"&&(t=e)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return t.CA||""},set:function(e){typeof e=="string"&&(t.CA=e)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return n},set:function(e){var r=e==null?"":e.toString();r.substr(0,1)==="/"&&(r=r.substr(1)),n="/"+id(r)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return n.substr(1,n.length-1)},set:function(e){n="/"+id(e)}})};ja(Jo,dc);var eg=function(){Jo.call(this),this.pushButton=!0};ja(eg,Jo);var Gd=function(){Jo.call(this),this.radio=!0,this.pushButton=!1;var n=[];Object.defineProperty(this,"Kids",{enumerable:!0,configurable:!1,get:function(){return n},set:function(t){n=t!==void 0?t:[]}})};ja(Gd,Jo);var gg=function(){var n,t;dc.call(this),Object.defineProperty(this,"Parent",{enumerable:!1,configurable:!1,get:function(){return n},set:function(i){n=i}}),Object.defineProperty(this,"optionName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(i){t=i}});var e,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+" ("+dd(i(r[s]))+")");return l.push(">>"),l.join(`
40
- `)},set:function(i){Xr(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 e},set:function(i){var s=i==null?"":i.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),e="/"+id(s)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return e.substr(1,e.length-1)},set:function(i){var s=i==null?"":i.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),e="/"+id(s)}}),this.caption="l",this.appearanceState="Off",this._AppearanceType=sn.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};ja(gg,dc),Gd.prototype.setAppearance=function(n){if(!("createAppearanceStream"in n)||!("getCA"in n))throw new Error("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");for(var t in this.Kids)if(this.Kids.hasOwnProperty(t)){var e=this.Kids[t];e.appearanceStreamContent=n.createAppearanceStream(e.optionName),e.caption=n.getCA()}},Gd.prototype.createOption=function(n){var t=new gg;return t.Parent=this,t.optionName=n,this.Kids.push(t),GN.call(this.scope,t),t};var ng=function(){Jo.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=sn.CheckBox.createAppearanceStream()};ja(ng,Jo);var Xf=function(){dc.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,13)},set:function(t){t?this.Ff=ho(this.Ff,13):this.Ff=po(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,21)},set:function(t){t?this.Ff=ho(this.Ff,21):this.Ff=po(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,23)},set:function(t){t?this.Ff=ho(this.Ff,23):this.Ff=po(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,24)},set:function(t){t?this.Ff=ho(this.Ff,24):this.Ff=po(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,25)},set:function(t){t?this.Ff=ho(this.Ff,25):this.Ff=po(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,26)},set:function(t){t?this.Ff=ho(this.Ff,26):this.Ff=po(this.Ff,26)}});var n=null;Object.defineProperty(this,"MaxLen",{enumerable:!0,configurable:!1,get:function(){return n},set:function(t){n=t}}),Object.defineProperty(this,"maxLength",{enumerable:!0,configurable:!0,get:function(){return n},set:function(t){Number.isInteger(t)&&(n=t)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return this.V||this.DV}})};ja(Xf,dc);var rg=function(){Xf.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,14)},set:function(n){n?this.Ff=ho(this.Ff,14):this.Ff=po(this.Ff,14)}}),this.password=!0};ja(rg,Xf);var sn={CheckBox:{createAppearanceStream:function(){return{N:{On:sn.CheckBox.YesNormal},D:{On:sn.CheckBox.YesPushDown,Off:sn.CheckBox.OffPushDown}}},YesPushDown:function(n){var t=Rc(n);t.scope=n.scope;var e=[],r=n.scope.internal.getFont(n.fontName,n.fontStyle).id,i=n.scope.__private__.encodeColorString(n.color),s=b2(n,n.caption);return e.push("0.749023 g"),e.push("0 0 "+Wn(sn.internal.getWidth(n))+" "+Wn(sn.internal.getHeight(n))+" re"),e.push("f"),e.push("BMC"),e.push("q"),e.push("0 0 1 rg"),e.push("/"+r+" "+Wn(s.fontSize)+" Tf "+i),e.push("BT"),e.push(s.text),e.push("ET"),e.push("Q"),e.push("EMC"),t.stream=e.join(`
41
- `),t},YesNormal:function(n){var t=Rc(n);t.scope=n.scope;var e=n.scope.internal.getFont(n.fontName,n.fontStyle).id,r=n.scope.__private__.encodeColorString(n.color),i=[],s=sn.internal.getHeight(n),l=sn.internal.getWidth(n),c=b2(n,n.caption);return i.push("1 g"),i.push("0 0 "+Wn(l)+" "+Wn(s)+" re"),i.push("f"),i.push("q"),i.push("0 0 1 rg"),i.push("0 0 "+Wn(l-1)+" "+Wn(s-1)+" re"),i.push("W"),i.push("n"),i.push("0 g"),i.push("BT"),i.push("/"+e+" "+Wn(c.fontSize)+" Tf "+r),i.push(c.text),i.push("ET"),i.push("Q"),t.stream=i.join(`
42
- `),t},OffPushDown:function(n){var t=Rc(n);t.scope=n.scope;var e=[];return e.push("0.749023 g"),e.push("0 0 "+Wn(sn.internal.getWidth(n))+" "+Wn(sn.internal.getHeight(n))+" re"),e.push("f"),t.stream=e.join(`
43
- `),t}},RadioButton:{Circle:{createAppearanceStream:function(n){var t={D:{Off:sn.RadioButton.Circle.OffPushDown},N:{}};return t.N[n]=sn.RadioButton.Circle.YesNormal,t.D[n]=sn.RadioButton.Circle.YesPushDown,t},getCA:function(){return"l"},YesNormal:function(n){var t=Rc(n);t.scope=n.scope;var e=[],r=sn.internal.getWidth(n)<=sn.internal.getHeight(n)?sn.internal.getWidth(n)/4:sn.internal.getHeight(n)/4;r=Number((.9*r).toFixed(5));var i=sn.internal.Bezier_C,s=Number((r*i).toFixed(5));return e.push("q"),e.push("1 0 0 1 "+Gu(sn.internal.getWidth(n)/2)+" "+Gu(sn.internal.getHeight(n)/2)+" cm"),e.push(r+" 0 m"),e.push(r+" "+s+" "+s+" "+r+" 0 "+r+" c"),e.push("-"+s+" "+r+" -"+r+" "+s+" -"+r+" 0 c"),e.push("-"+r+" -"+s+" -"+s+" -"+r+" 0 -"+r+" c"),e.push(s+" -"+r+" "+r+" -"+s+" "+r+" 0 c"),e.push("f"),e.push("Q"),t.stream=e.join(`
44
- `),t},YesPushDown:function(n){var t=Rc(n);t.scope=n.scope;var e=[],r=sn.internal.getWidth(n)<=sn.internal.getHeight(n)?sn.internal.getWidth(n)/4:sn.internal.getHeight(n)/4;r=Number((.9*r).toFixed(5));var i=Number((2*r).toFixed(5)),s=Number((i*sn.internal.Bezier_C).toFixed(5)),l=Number((r*sn.internal.Bezier_C).toFixed(5));return e.push("0.749023 g"),e.push("q"),e.push("1 0 0 1 "+Gu(sn.internal.getWidth(n)/2)+" "+Gu(sn.internal.getHeight(n)/2)+" cm"),e.push(i+" 0 m"),e.push(i+" "+s+" "+s+" "+i+" 0 "+i+" c"),e.push("-"+s+" "+i+" -"+i+" "+s+" -"+i+" 0 c"),e.push("-"+i+" -"+s+" -"+s+" -"+i+" 0 -"+i+" c"),e.push(s+" -"+i+" "+i+" -"+s+" "+i+" 0 c"),e.push("f"),e.push("Q"),e.push("0 g"),e.push("q"),e.push("1 0 0 1 "+Gu(sn.internal.getWidth(n)/2)+" "+Gu(sn.internal.getHeight(n)/2)+" cm"),e.push(r+" 0 m"),e.push(r+" "+l+" "+l+" "+r+" 0 "+r+" c"),e.push("-"+l+" "+r+" -"+r+" "+l+" -"+r+" 0 c"),e.push("-"+r+" -"+l+" -"+l+" -"+r+" 0 -"+r+" c"),e.push(l+" -"+r+" "+r+" -"+l+" "+r+" 0 c"),e.push("f"),e.push("Q"),t.stream=e.join(`
45
- `),t},OffPushDown:function(n){var t=Rc(n);t.scope=n.scope;var e=[],r=sn.internal.getWidth(n)<=sn.internal.getHeight(n)?sn.internal.getWidth(n)/4:sn.internal.getHeight(n)/4;r=Number((.9*r).toFixed(5));var i=Number((2*r).toFixed(5)),s=Number((i*sn.internal.Bezier_C).toFixed(5));return e.push("0.749023 g"),e.push("q"),e.push("1 0 0 1 "+Gu(sn.internal.getWidth(n)/2)+" "+Gu(sn.internal.getHeight(n)/2)+" cm"),e.push(i+" 0 m"),e.push(i+" "+s+" "+s+" "+i+" 0 "+i+" c"),e.push("-"+s+" "+i+" -"+i+" "+s+" -"+i+" 0 c"),e.push("-"+i+" -"+s+" -"+s+" -"+i+" 0 -"+i+" c"),e.push(s+" -"+i+" "+i+" -"+s+" "+i+" 0 c"),e.push("f"),e.push("Q"),t.stream=e.join(`
46
- `),t}},Cross:{createAppearanceStream:function(n){var t={D:{Off:sn.RadioButton.Cross.OffPushDown},N:{}};return t.N[n]=sn.RadioButton.Cross.YesNormal,t.D[n]=sn.RadioButton.Cross.YesPushDown,t},getCA:function(){return"8"},YesNormal:function(n){var t=Rc(n);t.scope=n.scope;var e=[],r=sn.internal.calculateCross(n);return e.push("q"),e.push("1 1 "+Wn(sn.internal.getWidth(n)-2)+" "+Wn(sn.internal.getHeight(n)-2)+" re"),e.push("W"),e.push("n"),e.push(Wn(r.x1.x)+" "+Wn(r.x1.y)+" m"),e.push(Wn(r.x2.x)+" "+Wn(r.x2.y)+" l"),e.push(Wn(r.x4.x)+" "+Wn(r.x4.y)+" m"),e.push(Wn(r.x3.x)+" "+Wn(r.x3.y)+" l"),e.push("s"),e.push("Q"),t.stream=e.join(`
47
- `),t},YesPushDown:function(n){var t=Rc(n);t.scope=n.scope;var e=sn.internal.calculateCross(n),r=[];return r.push("0.749023 g"),r.push("0 0 "+Wn(sn.internal.getWidth(n))+" "+Wn(sn.internal.getHeight(n))+" re"),r.push("f"),r.push("q"),r.push("1 1 "+Wn(sn.internal.getWidth(n)-2)+" "+Wn(sn.internal.getHeight(n)-2)+" re"),r.push("W"),r.push("n"),r.push(Wn(e.x1.x)+" "+Wn(e.x1.y)+" m"),r.push(Wn(e.x2.x)+" "+Wn(e.x2.y)+" l"),r.push(Wn(e.x4.x)+" "+Wn(e.x4.y)+" m"),r.push(Wn(e.x3.x)+" "+Wn(e.x3.y)+" l"),r.push("s"),r.push("Q"),t.stream=r.join(`
48
- `),t},OffPushDown:function(n){var t=Rc(n);t.scope=n.scope;var e=[];return e.push("0.749023 g"),e.push("0 0 "+Wn(sn.internal.getWidth(n))+" "+Wn(sn.internal.getHeight(n))+" re"),e.push("f"),t.stream=e.join(`
49
- `),t}}},createDefaultAppearanceStream:function(n){var t=n.scope.internal.getFont(n.fontName,n.fontStyle).id,e=n.scope.__private__.encodeColorString(n.color);return"/"+t+" "+n.fontSize+" Tf "+e}};sn.internal={Bezier_C:.551915024494,calculateCross:function(n){var t=sn.internal.getWidth(n),e=sn.internal.getHeight(n),r=Math.min(t,e);return{x1:{x:(t-r)/2,y:(e-r)/2+r},x2:{x:(t-r)/2+r,y:(e-r)/2},x3:{x:(t-r)/2,y:(e-r)/2},x4:{x:(t-r)/2+r,y:(e-r)/2+r}}}},sn.internal.getWidth=function(n){var t=0;return Xr(n)==="object"&&(t=Pw(n.Rect[2])),t},sn.internal.getHeight=function(n){var t=0;return Xr(n)==="object"&&(t=Pw(n.Rect[3])),t};var GN=Qi.addField=function(n){if(XN(this,n),!(n instanceof dc))throw new Error("Invalid argument passed to jsPDF.addField.");var t;return(t=n).scope.internal.acroformPlugin.printedOut&&(t.scope.internal.acroformPlugin.printedOut=!1,t.scope.internal.acroformPlugin.acroFormDictionaryRoot=null),t.scope.internal.acroformPlugin.acroFormDictionaryRoot.Fields.push(t),n.page=n.scope.internal.getCurrentPageInfo().pageNumber,this};Qi.AcroFormChoiceField=Vd,Qi.AcroFormListBox=Wd,Qi.AcroFormComboBox=Xd,Qi.AcroFormEditBox=tg,Qi.AcroFormButton=Jo,Qi.AcroFormPushButton=eg,Qi.AcroFormRadioButton=Gd,Qi.AcroFormCheckBox=ng,Qi.AcroFormTextField=Xf,Qi.AcroFormPasswordField=rg,Qi.AcroFormAppearance=sn,Qi.AcroForm={ChoiceField:Vd,ListBox:Wd,ComboBox:Xd,EditBox:tg,Button:Jo,PushButton:eg,RadioButton:Gd,CheckBox:ng,TextField:Xf,PasswordField:rg,Appearance:sn},dn.AcroForm={ChoiceField:Vd,ListBox:Wd,ComboBox:Xd,EditBox:tg,Button:Jo,PushButton:eg,RadioButton:Gd,CheckBox:ng,TextField:Xf,PasswordField:rg,Appearance:sn};dn.AcroForm;function x4(n){return n.reduce(function(t,e,r){return t[e]=r,t},{})}(function(n){var t="addImage_";n.__addimage__={};var e="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=n.__addimage__.getImageFileTypeByImageData=function(J,ct){var G,vt,_t,ht,Z,ut=e;if((ct=ct||e)==="RGBA"||J.data!==void 0&&J.data instanceof Uint8ClampedArray&&"height"in J&&"width"in J)return"RGBA";if(Mt(J))for(Z in r)for(_t=r[Z],G=0;G<_t.length;G+=1){for(ht=!0,vt=0;vt<_t[G].length;vt+=1)if(_t[G][vt]!==void 0&&_t[G][vt]!==J[vt]){ht=!1;break}if(ht===!0){ut=Z;break}}else for(Z in r)for(_t=r[Z],G=0;G<_t.length;G+=1){for(ht=!0,vt=0;vt<_t[G].length;vt+=1)if(_t[G][vt]!==void 0&&_t[G][vt]!==J.charCodeAt(vt)){ht=!1;break}if(ht===!0){ut=Z;break}}return ut===e&&ct!==e&&(ut=ct),ut},s=function J(ct){for(var G=this.internal.write,vt=this.internal.putStream,_t=(0,this.internal.getFilters)();_t.indexOf("FlateEncode")!==-1;)_t.splice(_t.indexOf("FlateEncode"),1);ct.objectId=this.internal.newObject();var ht=[];if(ht.push({key:"Type",value:"/XObject"}),ht.push({key:"Subtype",value:"/Image"}),ht.push({key:"Width",value:ct.width}),ht.push({key:"Height",value:ct.height}),ct.colorSpace===R.INDEXED?ht.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(ct.palette.length/3-1)+" "+("sMask"in ct&&ct.sMask!==void 0?ct.objectId+2:ct.objectId+1)+" 0 R]"}):(ht.push({key:"ColorSpace",value:"/"+ct.colorSpace}),ct.colorSpace===R.DEVICE_CMYK&&ht.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),ht.push({key:"BitsPerComponent",value:ct.bitsPerComponent}),"decodeParameters"in ct&&ct.decodeParameters!==void 0&&ht.push({key:"DecodeParms",value:"<<"+ct.decodeParameters+">>"}),"transparency"in ct&&Array.isArray(ct.transparency)&&ct.transparency.length>0){for(var Z="",ut=0,It=ct.transparency.length;ut<It;ut++)Z+=ct.transparency[ut]+" "+ct.transparency[ut]+" ";ht.push({key:"Mask",value:"["+Z+"]"})}ct.sMask!==void 0&&ht.push({key:"SMask",value:ct.objectId+1+" 0 R"});var Zt=ct.filter!==void 0?["/"+ct.filter]:void 0;if(vt({data:ct.data,additionalKeyValues:ht,alreadyAppliedFilters:Zt,objectId:ct.objectId}),G("endobj"),"sMask"in ct&&ct.sMask!==void 0){var $,N=($=ct.sMaskBitsPerComponent)!==null&&$!==void 0?$:ct.bitsPerComponent,Q={width:ct.width,height:ct.height,colorSpace:"DeviceGray",bitsPerComponent:N,data:ct.sMask};"filter"in ct&&(Q.decodeParameters="/Predictor ".concat(ct.predictor," /Colors 1 /BitsPerComponent ").concat(N," /Columns ").concat(ct.width),Q.filter=ct.filter),J.call(this,Q)}if(ct.colorSpace===R.INDEXED){var tt=this.internal.newObject();vt({data:bt(new Uint8Array(ct.palette)),objectId:tt}),G("endobj")}},l=function(){var J=this.internal.collections[t+"images"];for(var ct in J)s.call(this,J[ct])},c=function(){var J,ct=this.internal.collections[t+"images"],G=this.internal.write;for(var vt in ct)G("/I"+(J=ct[vt]).index,J.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 J=this.internal.collections[t+"images"];return f.call(this),J},p=function(){return Object.keys(this.internal.collections[t+"images"]).length},g=function(J){return typeof n["process"+J.toUpperCase()]=="function"},b=function(J){return Xr(J)==="object"&&J.nodeType===1},y=function(J,ct){if(J.nodeName==="IMG"&&J.hasAttribute("src")){var G=""+J.getAttribute("src");if(G.indexOf("data:image/")===0)return Qm(unescape(G).split("base64,").pop());var vt=n.loadFile(G,!0);if(vt!==void 0)return vt}if(J.nodeName==="CANVAS"){if(J.width===0||J.height===0)throw new Error("Given canvas must have data. Canvas width: "+J.width+", height: "+J.height);var _t;switch(ct){case"PNG":_t="image/png";break;case"WEBP":_t="image/webp";break;default:_t="image/jpeg"}return Qm(J.toDataURL(_t,1).split("base64,").pop())}},M=function(J){var ct=this.internal.collections[t+"images"];if(ct){for(var G in ct)if(J===ct[G].alias)return ct[G]}},C=function(J,ct,G){return J||ct||(J=-96,ct=-96),J<0&&(J=-1*G.width*72/J/this.internal.scaleFactor),ct<0&&(ct=-1*G.height*72/ct/this.internal.scaleFactor),J===0&&(J=ct*G.width/G.height),ct===0&&(ct=J*G.height/G.width),[J,ct]},L=function(J,ct,G,vt,_t,ht){var Z=C.call(this,G,vt,_t),ut=this.internal.getCoordinateString,It=this.internal.getVerticalCoordinateString,Zt=d.call(this);if(G=Z[0],vt=Z[1],Zt[_t.index]=_t,ht){ht*=Math.PI/180;var $=Math.cos(ht),N=Math.sin(ht),Q=function(pt){return pt.toFixed(4)},tt=[Q($),Q(N),Q(-1*N),Q($),0,0,"cm"]}this.internal.write("q"),ht?(this.internal.write([1,"0","0",1,ut(J),It(ct+vt),"cm"].join(" ")),this.internal.write(tt.join(" ")),this.internal.write([ut(G),"0","0",ut(vt),"0","0","cm"].join(" "))):this.internal.write([ut(G),"0","0",ut(vt),ut(J),It(ct+vt),"cm"].join(" ")),this.isAdvancedAPI()&&this.internal.write([1,0,0,-1,0,0,"cm"].join(" ")),this.internal.write("/I"+_t.index+" Do"),this.internal.write("Q")},R=n.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"};n.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 B=n.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},q=n.__addimage__.sHashCode=function(J){var ct,G,vt=0;if(typeof J=="string")for(G=J.length,ct=0;ct<G;ct++)vt=(vt<<5)-vt+J.charCodeAt(ct),vt|=0;else if(Mt(J))for(G=J.byteLength/2,ct=0;ct<G;ct++)vt=(vt<<5)-vt+J[ct],vt|=0;return vt},V=n.__addimage__.validateStringAsBase64=function(J){(J=J||"").toString().trim();var ct=!0;return J.length===0&&(ct=!1),J.length%4!=0&&(ct=!1),/^[A-Za-z0-9+/]+$/.test(J.substr(0,J.length-2))===!1&&(ct=!1),/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(J.substr(-2))===!1&&(ct=!1),ct},gt=n.__addimage__.extractImageFromDataUrl=function(J){if(J==null||!(J=J.trim()).startsWith("data:"))return null;var ct=J.indexOf(",");return ct<0?null:J.substring(0,ct).trim().endsWith("base64")?J.substring(ct+1):null};n.__addimage__.isArrayBuffer=function(J){return J instanceof ArrayBuffer};var Mt=n.__addimage__.isArrayBufferView=function(J){return J instanceof Int8Array||J instanceof Uint8Array||J instanceof Uint8ClampedArray||J instanceof Int16Array||J instanceof Uint16Array||J instanceof Int32Array||J instanceof Uint32Array||J instanceof Float32Array||J instanceof Float64Array},kt=n.__addimage__.binaryStringToUint8Array=function(J){for(var ct=J.length,G=new Uint8Array(ct),vt=0;vt<ct;vt++)G[vt]=J.charCodeAt(vt);return G},bt=n.__addimage__.arrayBufferToBinaryString=function(J){for(var ct="",G=Mt(J)?J:new Uint8Array(J),vt=0;vt<G.length;vt+=8192)ct+=String.fromCharCode.apply(null,G.subarray(vt,vt+8192));return ct};n.addImage=function(){var J,ct,G,vt,_t,ht,Z,ut,It;if(typeof arguments[1]=="number"?(ct=e,G=arguments[1],vt=arguments[2],_t=arguments[3],ht=arguments[4],Z=arguments[5],ut=arguments[6],It=arguments[7]):(ct=arguments[1],G=arguments[2],vt=arguments[3],_t=arguments[4],ht=arguments[5],Z=arguments[6],ut=arguments[7],It=arguments[8]),Xr(J=arguments[0])==="object"&&!b(J)&&"imageData"in J){var Zt=J;J=Zt.imageData,ct=Zt.format||ct||e,G=Zt.x||G||0,vt=Zt.y||vt||0,_t=Zt.w||Zt.width||_t,ht=Zt.h||Zt.height||ht,Z=Zt.alias||Z,ut=Zt.compression||ut,It=Zt.rotation||Zt.angle||It}var $=this.internal.getFilters();if(ut===void 0&&$.indexOf("FlateEncode")!==-1&&(ut="SLOW"),isNaN(G)||isNaN(vt))throw new Error("Invalid coordinates passed to jsPDF.addImage");f.call(this);var N=it.call(this,J,ct,Z,ut);return L.call(this,G,vt,_t,ht,N,It),this};var it=function(J,ct,G,vt){var _t,ht,Z;if(typeof J=="string"&&i(J)===e){J=unescape(J);var ut=Lt(J,!1);(ut!==""||(ut=n.loadFile(J,!0))!==void 0)&&(J=ut)}if(b(J)&&(J=y(J,ct)),ct=i(J,ct),!g(ct))throw new Error("addImage does not support files of type '"+ct+"', please ensure that a plugin for '"+ct+"' support is added.");if(((Z=G)==null||Z.length===0)&&(G=(function(It){return typeof It=="string"||Mt(It)?q(It):Mt(It.data)?q(It.data):null})(J)),(_t=M.call(this,G))||(J instanceof Uint8Array||ct==="RGBA"||(ht=J,J=kt(J)),_t=this["process"+ct.toUpperCase()](J,p.call(this),G,(function(It){return It&&typeof It=="string"&&(It=It.toUpperCase()),It in n.image_compression?It:B.NONE})(vt),ht)),!_t)throw new Error("An unknown error occurred whilst processing the image.");return _t},Lt=n.__addimage__.convertBase64ToBinaryString=function(J,ct){ct=typeof ct!="boolean"||ct;var G,vt="";if(typeof J=="string"){var _t;G=(_t=gt(J))!==null&&_t!==void 0?_t:J;try{vt=Qm(G)}catch(ht){if(ct)throw V(G)?new Error("atob-Error in jsPDF.convertBase64ToBinaryString "+ht.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ")}}return vt};n.getImageProperties=function(J){var ct,G,vt="";if(b(J)&&(J=y(J)),typeof J=="string"&&i(J)===e&&((vt=Lt(J,!1))===""&&(vt=n.loadFile(J)||""),J=vt),G=i(J),!g(G))throw new Error("addImage does not support files of type '"+G+"', please ensure that a plugin for '"+G+"' support is added.");if(J instanceof Uint8Array||(J=kt(J)),!(ct=this["process"+G.toUpperCase()](J)))throw new Error("An unknown error occurred whilst processing the image");return ct.fileType=G,ct}})(dn.API),(function(n){var t=function(e){if(e!==void 0&&e!="")return!0};dn.API.events.push(["addPage",function(e){this.internal.getPageInfo(e.pageNumber).pageContext.annotations=[]}]),n.events.push(["putPage",function(e){for(var r,i,s,l=this.internal.getCoordinateString,c=this.internal.getVerticalCoordinateString,f=this.internal.getPageInfoByObjId(e.objId),d=e.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(e.objId);switch(r.type){case"reference":this.internal.write(" "+r.object.objId+" 0 R ");break;case"text":var C=this.internal.newAdditionalObject(),L=this.internal.newAdditionalObject(),R=this.internal.getEncryptor(C.objId),B=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(R(r.contents))+")",s+=" /Popup "+L.objId+" 0 R",s+=" /P "+f.objId+" 0 R",s+=" /T ("+y(R(B))+") >>",C.content=s;var q=C.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 "+q,r.open&&(s+=" /Open true"),s+=" >>",L.content=s,this.internal.write(C.objId,"0 R",L.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 V="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(V))+")",s+=" /Border [0 0 0]",s+=" >>",this.internal.write(s);break;case"link":if(r.options.name){var gt=this.annotations._nameMap[r.options.name];r.options.pageNumber=gt.page,r.options.top=gt.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("]")}}]),n.createAnnotation=function(e){var r=this.internal.getCurrentPageInfo();switch(e.type){case"link":this.link(e.bounds.x,e.bounds.y,e.bounds.w,e.bounds.h,e);break;case"text":case"freetext":r.pageContext.annotations.push(e)}},n.link=function(e,r,i,s,l){var c=this.internal.getCurrentPageInfo(),f=this.internal.getCoordinateString,d=this.internal.getVerticalCoordinateString;c.pageContext.annotations.push({finalBounds:{x:f(e),y:d(r),w:f(e+i),h:d(r+s)},options:l,type:"link"})},n.textWithLink=function(e,r,i,s){var l,c,f=this.getTextWidth(e),d=this.internal.getLineHeight()/this.internal.scaleFactor;if(s.maxWidth!==void 0){c=s.maxWidth;var p=this.splitTextToSize(e,c).length;l=Math.ceil(d*p)}else c=f,l=d;return this.text(e,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},n.getTextWidth=function(e){var r=this.internal.getFontSize();return this.getStringUnitWidth(e)*r/this.internal.scaleFactor}})(dn.API),(function(n){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]},e={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];n.__arabicParser__={};var s=n.__arabicParser__.isInArabicSubstitutionA=function(C){return t[C.charCodeAt(0)]!==void 0},l=n.__arabicParser__.isArabicLetter=function(C){return typeof C=="string"&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(C)},c=n.__arabicParser__.isArabicEndLetter=function(C){return l(C)&&s(C)&&t[C.charCodeAt(0)].length<=2},f=n.__arabicParser__.isArabicAlfLetter=function(C){return l(C)&&i.indexOf(C.charCodeAt(0))>=0};n.__arabicParser__.arabicLetterHasIsolatedForm=function(C){return l(C)&&s(C)&&t[C.charCodeAt(0)].length>=1};var d=n.__arabicParser__.arabicLetterHasFinalForm=function(C){return l(C)&&s(C)&&t[C.charCodeAt(0)].length>=2};n.__arabicParser__.arabicLetterHasInitialForm=function(C){return l(C)&&s(C)&&t[C.charCodeAt(0)].length>=3};var p=n.__arabicParser__.arabicLetterHasMedialForm=function(C){return l(C)&&s(C)&&t[C.charCodeAt(0)].length==4},g=n.__arabicParser__.resolveLigatures=function(C){var L=0,R=e,B="",q=0;for(L=0;L<C.length;L+=1)R[C.charCodeAt(L)]!==void 0?(q++,typeof(R=R[C.charCodeAt(L)])=="number"&&(B+=String.fromCharCode(R),R=e,q=0),L===C.length-1&&(R=e,B+=C.charAt(L-(q-1)),L-=q-1,q=0)):(R=e,B+=C.charAt(L-q),L-=q,q=0);return B};n.__arabicParser__.isArabicDiacritic=function(C){return C!==void 0&&r[C.charCodeAt(0)]!==void 0};var b=n.__arabicParser__.getCorrectForm=function(C,L,R){return l(C)?s(C)===!1?-1:!d(C)||!l(L)&&!l(R)||!l(R)&&c(L)||c(C)&&!l(L)||c(C)&&f(L)||c(C)&&c(L)?0:p(C)&&l(L)&&!c(L)&&l(R)&&d(R)?3:c(C)||!l(R)?1:2:-1},y=function(C){var L=0,R=0,B=0,q="",V="",gt="",Mt=(C=C||"").split("\\s+"),kt=[];for(L=0;L<Mt.length;L+=1){for(kt.push(""),R=0;R<Mt[L].length;R+=1)q=Mt[L][R],V=Mt[L][R-1],gt=Mt[L][R+1],l(q)?(B=b(q,V,gt),kt[L]+=B!==-1?String.fromCharCode(t[q.charCodeAt(0)][B]):q):kt[L]+=q;kt[L]=g(kt[L])}return kt.join(" ")},M=n.__arabicParser__.processArabic=n.processArabic=function(){var C,L=typeof arguments[0]=="string"?arguments[0]:arguments[0].text,R=[];if(Array.isArray(L)){var B=0;for(R=[],B=0;B<L.length;B+=1)Array.isArray(L[B])?R.push([y(L[B][0]),L[B][1],L[B][2]]):R.push([y(L[B])]);C=R}else C=y(L);return typeof arguments[0]=="string"?C:(arguments[0].text=C,arguments[0])};n.events.push(["preProcessText",M])})(dn.API),dn.API.autoPrint=function(n){var t;return(n=n||{}).variant=n.variant||"non-conform",n.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(n){var t=function(){var e=void 0;Object.defineProperty(this,"pdf",{get:function(){return e},set:function(c){e=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(e,r){var i;if((e=e||"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.")},n.events.push(["initialized",function(){this.canvas=new t,this.canvas.pdf=this}])})(dn.API),(function(n){var t={left:0,top:0,bottom:0,right:0},e=!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(C){f=C}});var d=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return d},set:function(C){d=C}});var p=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return p},set:function(C){p=C}});var g=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return g},set:function(C){g=C}});var b=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return b},set:function(C){b=C}});var y=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return y},set:function(C){y=C}});var M=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return M},set:function(C){M=C}}),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]},n.setHeaderFunction=function(f){return r.call(this),this.internal.__cell__.headerFunction=typeof f=="function"?f:void 0,this},n.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,C=0,L=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 R=d.maxWidth;R>0?typeof f=="string"?f=this.splitTextToSize(f,R):Object.prototype.toString.call(f)==="[object Array]"&&(f=f.reduce(function(q,V){return q.concat(L.splitTextToSize(V,R))},[])):f=Array.isArray(f)?f:[f];for(var B=0;B<f.length;B++)y<(C=this.getStringUnitWidth(f[B],{font:g})*p)&&(y=C);return y!==0&&(M=f.length),{w:y/=b,h:Math.max((M*p*this.getLineHeightFactor()-p*(this.getLineHeightFactor()-1))/b,0)}},n.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=n.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,e===!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};n.table=function(f,d,p,g,b){if(r.call(this),!p)throw new Error("No data for PDF table.");var y,M,C,L,R=[],B=[],q=[],V={},gt={},Mt=[],kt=[],bt=(b=b||{}).autoSize||!1,it=b.printHeaders!==!1,Lt=b.css&&b.css["font-size"]!==void 0?16*b.css["font-size"]:b.fontSize||12,J=b.margins||Object.assign({width:this.getPageWidth()},t),ct=typeof b.padding=="number"?b.padding:3,G=b.headerBackgroundColor||"#c8c8c8",vt=b.headerTextColor||"#000";if(i.call(this),this.internal.__cell__.printHeaders=it,this.internal.__cell__.margins=J,this.internal.__cell__.table_font_size=Lt,this.internal.__cell__.padding=ct,this.internal.__cell__.headerBackgroundColor=G,this.internal.__cell__.headerTextColor=vt,this.setFontSize(Lt),g==null)B=R=Object.keys(p[0]),q=R.map(function(){return"left"});else if(Array.isArray(g)&&Xr(g[0])==="object")for(R=g.map(function(Zt){return Zt.name}),B=g.map(function(Zt){return Zt.prompt||Zt.name||""}),q=g.map(function(Zt){return Zt.align||"left"}),y=0;y<g.length;y+=1)gt[g[y].name]=.7499990551181103*g[y].width;else Array.isArray(g)&&typeof g[0]=="string"&&(B=R=g,q=R.map(function(){return"left"}));if(bt||Array.isArray(g)&&typeof g[0]=="string")for(y=0;y<R.length;y+=1){for(V[L=R[y]]=p.map(function(Zt){return Zt[L]}),this.setFont(void 0,"bold"),Mt.push(this.getTextDimensions(B[y],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),M=V[L],this.setFont(void 0,"normal"),C=0;C<M.length;C+=1)Mt.push(this.getTextDimensions(M[C],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);gt[L]=Math.max.apply(null,Mt)+ct+ct,Mt=[]}if(it){var _t={};for(y=0;y<R.length;y+=1)_t[R[y]]={},_t[R[y]].text=B[y],_t[R[y]].align=q[y];var ht=c.call(this,_t,gt);kt=R.map(function(Zt){return new s(f,d,gt[Zt],ht,_t[Zt].text,void 0,_t[Zt].align)}),this.setTableHeaderRow(kt),this.printHeaderRow(1,!1)}var Z=g.reduce(function(Zt,$){return Zt[$.name]=$.align,Zt},{});for(y=0;y<p.length;y+=1){"rowStart"in b&&b.rowStart instanceof Function&&b.rowStart({row:y,data:p[y]},this);var ut=c.call(this,p[y],gt);for(C=0;C<R.length;C+=1){var It=p[y][R[C]];"cellStart"in b&&b.cellStart instanceof Function&&b.cellStart({row:y,col:C,data:It},this),l.call(this,new s(f,d,gt[R[C]],ut,It,y+2,Z[R[C]]))}}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)};n.setTableHeaderRow=function(f){r.call(this),this.internal.__cell__.tableHeaderRow=f},n.printHeaderRow=function(f,d){if(r.call(this),!this.internal.__cell__.tableHeaderRow)throw new Error("Property tableHeaderRow does not exist.");var p;if(e=!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"),e=!1}})(dn.API);var v4={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},w4=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],x2=x4(w4),S4=[100,200,300,400,500,600,700,800,900],KN=x4(S4);function yy(n){var t=n.family.replace(/"|'/g,"").toLowerCase(),e=(function(s){return v4[s=s||"normal"]?s:"normal"})(n.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})(n.weight),i=(function(s){return typeof x2[s=s||"normal"]=="number"?s:"normal"})(n.stretch);return{family:t,style:e,weight:r,stretch:i,src:n.src||[],ref:n.ref||{name:t,style:[i,e,r].join(" ")}}}function Iw(n,t,e,r){var i;for(i=e;i>=0&&i<t.length;i+=r)if(n[t[i]])return n[t[i]];for(i=e;i>=0&&i<t.length;i-=r)if(n[t[i]])return n[t[i]]}var JN={"sans-serif":"helvetica",fixed:"courier",monospace:"courier",terminal:"courier",cursive:"times",fantasy:"times",serif:"times"},jw={caption:"times",icon:"times",menu:"times","message-box":"times","small-caption":"times","status-bar":"times"};function zw(n){return[n.stretch,n.style,n.weight,n.family].join(" ")}function Bw(n){return n.trimLeft()}function ZN(n,t){for(var e=0;e<n.length;){if(n.charAt(e)===t)return[n.substring(0,e),n.substring(e+1)];e+=1}return null}function QN(n){var t=n.match(/^(-[a-z_]|[a-z_])[a-z0-9_-]*/i);return t===null?null:[t[0],n.substring(t[0].length)]}var _d,Cm,Fw,Uw,Hw,by=["times"];function qw(n,t,e,r,i){var s=4,l=Yw;switch(i){case dn.API.image_compression.FAST:s=1,l=$w;break;case dn.API.image_compression.MEDIUM:s=6,l=Vw;break;case dn.API.image_compression.SLOW:s=9,l=Ww}n=(function(f,d,p,g){for(var b,y=f.length/d,M=new Uint8Array(f.length+y),C=[t_,$w,Yw,Vw,Ww],L=0;L<y;L+=1){var R=L*d,B=f.subarray(R,R+d);if(g)M.set(g(B,p,b),R+L);else{for(var q=C.length,V=[],gt=0;gt<q;gt+=1)V[gt]=C[gt](B,p,b);var Mt=n_(V.concat());M.set(V[Mt],R+L)}b=B}return M})(n,t,Math.ceil(e*r/8),l);var c=d2(n,{level:s});return dn.API.__addimage__.arrayBufferToBinaryString(c)}function t_(n){var t=Array.apply([],n);return t.unshift(0),t}function $w(n,t){var e=n.length,r=[];r[0]=1;for(var i=0;i<e;i+=1){var s=n[i-t]||0;r[i+1]=n[i]-s+256&255}return r}function Yw(n,t,e){var r=n.length,i=[];i[0]=2;for(var s=0;s<r;s+=1){var l=e&&e[s]||0;i[s+1]=n[s]-l+256&255}return i}function Vw(n,t,e){var r=n.length,i=[];i[0]=3;for(var s=0;s<r;s+=1){var l=n[s-t]||0,c=e&&e[s]||0;i[s+1]=n[s]+256-(l+c>>>1)&255}return i}function Ww(n,t,e){var r=n.length,i=[];i[0]=4;for(var s=0;s<r;s+=1){var l=e_(n[s-t]||0,e&&e[s]||0,e&&e[s-t]||0);i[s+1]=n[s]-l+256&255}return i}function e_(n,t,e){if(n===t&&t===e)return n;var r=Math.abs(t-e),i=Math.abs(n-e),s=Math.abs(n+t-e-e);return r<=i&&r<=s?n:i<=s?t:e}function n_(n){var t=n.map(function(e){return e.reduce(function(r,i){return r+Math.abs(i)},0)});return t.indexOf(Math.min.apply(null,t))}function xy(n,t,e){var r=t*e,i=Math.floor(r/8),s=16-(r-8*i+e),l=(1<<e)-1;return k4(n,i)>>s&l}function Xw(n,t,e,r){var i=e*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)}})(n,s,k4(n,s)&~(c<<l)&65535|f)}function k4(n,t){return t+1<n.byteLength?n.getUint16(t,!1):n.getUint8(t)<<8}function r_(n){var t=0;if(n[t++]!==71||n[t++]!==73||n[t++]!==70||n[t++]!==56||(n[t++]+1&253)!=56||n[t++]!==97)throw new Error("Invalid GIF 87a/89a header.");var e=n[t++]|n[t++]<<8,r=n[t++]|n[t++]<<8,i=n[t++],s=i>>7,l=1<<1+(7&i);n[t++],n[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=e,this.height=r;d&&t<n.length;)switch(n[t++]){case 33:switch(n[t++]){case 255:if(n[t]!==11||n[t+1]==78&&n[t+2]==69&&n[t+3]==84&&n[t+4]==83&&n[t+5]==67&&n[t+6]==65&&n[t+7]==80&&n[t+8]==69&&n[t+9]==50&&n[t+10]==46&&n[t+11]==48&&n[t+12]==3&&n[t+13]==1&&n[t+16]==0)t+=14,M=n[t++]|n[t++]<<8,t++;else for(t+=12;;){if(!((J=n[t++])>=0))throw Error("Invalid block size");if(J===0)break;t+=J}break;case 249:if(n[t++]!==4||n[t+4]!==0)throw new Error("Invalid graphics extension block.");var C=n[t++];g=n[t++]|n[t++]<<8,b=n[t++],1&C||(b=null),y=C>>2&7,t++;break;case 254:for(;;){if(!((J=n[t++])>=0))throw Error("Invalid block size");if(J===0)break;t+=J}break;default:throw new Error("Unknown graphic control label: 0x"+n[t-1].toString(16))}break;case 44:var L=n[t++]|n[t++]<<8,R=n[t++]|n[t++]<<8,B=n[t++]|n[t++]<<8,q=n[t++]|n[t++]<<8,V=n[t++],gt=V>>6&1,Mt=1<<1+(7&V),kt=c,bt=f,it=!1;V>>7&&(it=!0,kt=t,bt=Mt,t+=3*Mt);var Lt=t;for(t++;;){var J;if(!((J=n[t++])>=0))throw Error("Invalid block size");if(J===0)break;t+=J}p.push({x:L,y:R,width:B,height:q,has_local_palette:it,palette_offset:kt,palette_size:bt,data_offset:Lt,data_length:t-Lt,transparent_index:b,interlaced:!!gt,delay:g,disposal:y});break;case 59:d=!1;break;default:throw new Error("Unknown gif block: 0x"+n[t-1].toString(16))}this.numFrames=function(){return p.length},this.loopCount=function(){return M},this.frameInfo=function(ct){if(ct<0||ct>=p.length)throw new Error("Frame index out of range.");return p[ct]},this.decodeAndBlitFrameBGRA=function(ct,G){var vt=this.frameInfo(ct),_t=vt.width*vt.height;if(_t>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var ht=new Uint8Array(_t);Gw(n,vt.data_offset,ht,_t);var Z=vt.palette_offset,ut=vt.transparent_index;ut===null&&(ut=256);var It=vt.width,Zt=e-It,$=It,N=4*(vt.y*e+vt.x),Q=4*((vt.y+vt.height)*e+vt.x),tt=N,pt=4*Zt;vt.interlaced===!0&&(pt+=4*e*7);for(var wt=8,At=0,Ft=ht.length;At<Ft;++At){var Rt=ht[At];if($===0&&($=It,(tt+=pt)>=Q&&(pt=4*Zt+4*e*(wt-1),tt=N+(It+Zt)*(wt<<1),wt>>=1)),Rt===ut)tt+=4;else{var Jt=n[Z+3*Rt],ke=n[Z+3*Rt+1],Re=n[Z+3*Rt+2];G[tt++]=Re,G[tt++]=ke,G[tt++]=Jt,G[tt++]=255}--$}},this.decodeAndBlitFrameRGBA=function(ct,G){var vt=this.frameInfo(ct),_t=vt.width*vt.height;if(_t>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var ht=new Uint8Array(_t);Gw(n,vt.data_offset,ht,_t);var Z=vt.palette_offset,ut=vt.transparent_index;ut===null&&(ut=256);var It=vt.width,Zt=e-It,$=It,N=4*(vt.y*e+vt.x),Q=4*((vt.y+vt.height)*e+vt.x),tt=N,pt=4*Zt;vt.interlaced===!0&&(pt+=4*e*7);for(var wt=8,At=0,Ft=ht.length;At<Ft;++At){var Rt=ht[At];if($===0&&($=It,(tt+=pt)>=Q&&(pt=4*Zt+4*e*(wt-1),tt=N+(It+Zt)*(wt<<1),wt>>=1)),Rt===ut)tt+=4;else{var Jt=n[Z+3*Rt],ke=n[Z+3*Rt+1],Re=n[Z+3*Rt+2];G[tt++]=Jt,G[tt++]=ke,G[tt++]=Re,G[tt++]=255}--$}}}function Gw(n,t,e,r){for(var i=n[t++],s=1<<i,l=s+1,c=l+1,f=i+1,d=(1<<f)-1,p=0,g=0,b=0,y=n[t++],M=new Int32Array(4096),C=null;;){for(;p<16&&y!==0;)g|=n[t++]<<p,p+=8,y===1?y=n[t++]:--y;if(p<f)break;var L=g&d;if(g>>=f,p-=f,L!==s){if(L===l)break;for(var R=L<c?L:C,B=0,q=R;q>s;)q=M[q]>>8,++B;var V=q;if(b+B+(R!==L?1:0)>r)return void li.log("Warning, gif stream longer than expected.");e[b++]=V;var gt=b+=B;for(R!==L&&(e[b++]=V),q=R;B--;)q=M[q],e[--gt]=255&q,q>>=8;C!==null&&c<4096&&(M[c++]=C<<8|V,c>=d+1&&f<12&&(++f,d=d<<1|1)),C=L}else c=l+1,d=(1<<(f=i+1))-1,C=null}return b!==r&&li.log("Warning, gif stream shorter than expected."),e}function vy(n){var t,e,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),C=[],L=0,R=7,B=new Array(64),q=new Array(64),V=new Array(64),gt=new Array(256),Mt=new Array(2048),kt=[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],it=[0,1,2,3,4,5,6,7,8,9,10,11],Lt=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],J=[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],ct=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],G=[0,1,2,3,4,5,6,7,8,9,10,11],vt=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],_t=[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 ht(N,Q){for(var tt=0,pt=0,wt=new Array,At=1;At<=16;At++){for(var Ft=1;Ft<=N[At];Ft++)wt[Q[pt]]=[],wt[Q[pt]][0]=tt,wt[Q[pt]][1]=At,pt++,tt++;tt*=2}return wt}function Z(N){for(var Q=N[0],tt=N[1]-1;tt>=0;)Q&1<<tt&&(L|=1<<R),tt--,--R<0&&(L==255?(ut(255),ut(0)):ut(L),R=7,L=0)}function ut(N){C.push(N)}function It(N){ut(N>>8&255),ut(255&N)}function Zt(N,Q,tt,pt,wt){for(var At,Ft=wt[0],Rt=wt[240],Jt=(function(xe,we){var Ne,De,Fe,tn,Pn,mn,In,hn,Ue,$e,je=0;for(Ue=0;Ue<8;++Ue){Ne=xe[je],De=xe[je+1],Fe=xe[je+2],tn=xe[je+3],Pn=xe[je+4],mn=xe[je+5],In=xe[je+6];var nr=Ne+(hn=xe[je+7]),bn=Ne-hn,an=De+In,ln=De-In,Bn=Fe+mn,Xe=Fe-mn,Mr=tn+Pn,gn=tn-Pn,yn=nr+Mr,Qt=nr-Mr,ye=an+Bn,Ce=an-Bn;xe[je]=yn+ye,xe[je+4]=yn-ye;var ve=.707106781*(Ce+Qt);xe[je+2]=Qt+ve,xe[je+6]=Qt-ve;var Zn=.382683433*((yn=gn+Xe)-(Ce=ln+bn)),$n=.5411961*yn+Zn,xr=1.306562965*Ce+Zn,Bo=.707106781*(ye=Xe+ln),Ze=bn+Bo,ts=bn-Bo;xe[je+5]=ts+$n,xe[je+3]=ts-$n,xe[je+1]=Ze+xr,xe[je+7]=Ze-xr,je+=8}for(je=0,Ue=0;Ue<8;++Ue){Ne=xe[je],De=xe[je+8],Fe=xe[je+16],tn=xe[je+24],Pn=xe[je+32],mn=xe[je+40],In=xe[je+48];var Yt=Ne+(hn=xe[je+56]),Ur=Ne-hn,Ni=De+In,Tn=De-In,fi=Fe+mn,_i=Fe-mn,ha=tn+Pn,go=tn-Pn,pr=Yt+ha,Cr=Yt-ha,no=Ni+fi,Hr=Ni-fi;xe[je]=pr+no,xe[je+32]=pr-no;var sr=.707106781*(Hr+Cr);xe[je+16]=Cr+sr,xe[je+48]=Cr-sr;var Fl=.382683433*((pr=go+_i)-(Hr=Tn+Ur)),Ks=.5411961*pr+Fl,es=1.306562965*Hr+Fl,pa=.707106781*(no=_i+Tn),No=Ur+pa,ma=Ur-pa;xe[je+40]=ma+Ks,xe[je+24]=ma-Ks,xe[je+8]=No+es,xe[je+56]=No-es,je++}for(Ue=0;Ue<64;++Ue)$e=xe[Ue]*we[Ue],y[Ue]=$e>0?$e+.5|0:$e-.5|0;return y})(N,Q),ke=0;ke<64;++ke)M[kt[ke]]=Jt[ke];var Re=M[0]-tt;tt=M[0],Re==0?Z(pt[0]):(Z(pt[b[At=32767+Re]]),Z(g[At]));for(var Ie=63;Ie>0&&M[Ie]==0;)Ie--;if(Ie==0)return Z(Ft),tt;for(var Ve,rt=1;rt<=Ie;){for(var Oe=rt;M[rt]==0&&rt<=Ie;)++rt;var Cn=rt-Oe;if(Cn>=16){Ve=Cn>>4;for(var cn=1;cn<=Ve;++cn)Z(Rt);Cn&=15}At=32767+M[rt],Z(wt[(Cn<<4)+b[At]]),Z(g[At]),rt++}return Ie!=63&&Z(Ft),tt}function $(N){N=Math.min(Math.max(N,1),100),s!=N&&((function(Q){for(var tt=[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],pt=0;pt<64;pt++){var wt=l((tt[pt]*Q+50)/100);wt=Math.min(Math.max(wt,1),255),c[kt[pt]]=wt}for(var At=[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((At[Ft]*Q+50)/100);Rt=Math.min(Math.max(Rt,1),255),f[kt[Ft]]=Rt}for(var Jt=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],ke=0,Re=0;Re<8;Re++)for(var Ie=0;Ie<8;Ie++)d[ke]=1/(c[kt[ke]]*Jt[Re]*Jt[Ie]*8),p[ke]=1/(f[kt[ke]]*Jt[Re]*Jt[Ie]*8),ke++})(N<50?Math.floor(5e3/N):Math.floor(200-2*N)),s=N)}this.encode=function(N,Q){Q&&$(Q),C=new Array,L=0,R=7,It(65496),It(65504),It(16),ut(74),ut(70),ut(73),ut(70),ut(0),ut(1),ut(1),ut(0),It(1),It(1),ut(0),ut(0),(function(){It(65499),It(132),ut(0);for(var De=0;De<64;De++)ut(c[De]);ut(1);for(var Fe=0;Fe<64;Fe++)ut(f[Fe])})(),(function(De,Fe){It(65472),It(17),ut(8),It(Fe),It(De),ut(3),ut(1),ut(17),ut(0),ut(2),ut(17),ut(1),ut(3),ut(17),ut(1)})(N.width,N.height),(function(){It(65476),It(418),ut(0);for(var De=0;De<16;De++)ut(bt[De+1]);for(var Fe=0;Fe<=11;Fe++)ut(it[Fe]);ut(16);for(var tn=0;tn<16;tn++)ut(Lt[tn+1]);for(var Pn=0;Pn<=161;Pn++)ut(J[Pn]);ut(1);for(var mn=0;mn<16;mn++)ut(ct[mn+1]);for(var In=0;In<=11;In++)ut(G[In]);ut(17);for(var hn=0;hn<16;hn++)ut(vt[hn+1]);for(var Ue=0;Ue<=161;Ue++)ut(_t[Ue])})(),It(65498),It(12),ut(3),ut(1),ut(0),ut(2),ut(17),ut(3),ut(17),ut(0),ut(63),ut(0);var tt=0,pt=0,wt=0;L=0,R=7,this.encode.displayName="_encode_";for(var At,Ft,Rt,Jt,ke,Re,Ie,Ve,rt,Oe=N.data,Cn=N.width,cn=N.height,xe=4*Cn,we=0;we<cn;){for(At=0;At<xe;){for(ke=xe*we+At,Ie=-1,Ve=0,rt=0;rt<64;rt++)Re=ke+(Ve=rt>>3)*xe+(Ie=4*(7&rt)),we+Ve>=cn&&(Re-=xe*(we+1+Ve-cn)),At+Ie>=xe&&(Re-=At+Ie-xe+4),Ft=Oe[Re++],Rt=Oe[Re++],Jt=Oe[Re++],B[rt]=(Mt[Ft]+Mt[Rt+256|0]+Mt[Jt+512|0]>>16)-128,q[rt]=(Mt[Ft+768|0]+Mt[Rt+1024|0]+Mt[Jt+1280|0]>>16)-128,V[rt]=(Mt[Ft+1280|0]+Mt[Rt+1536|0]+Mt[Jt+1792|0]>>16)-128;tt=Zt(B,d,tt,t,r),pt=Zt(q,p,pt,e,i),wt=Zt(V,p,wt,e,i),At+=32}we+=8}if(R>=0){var Ne=[];Ne[1]=R+1,Ne[0]=(1<<R+1)-1,Z(Ne)}return It(65497),new Uint8Array(C)},n=n||50,(function(){for(var N=String.fromCharCode,Q=0;Q<256;Q++)gt[Q]=N(Q)})(),t=ht(bt,it),e=ht(ct,G),r=ht(Lt,J),i=ht(vt,_t),(function(){for(var N=1,Q=2,tt=1;tt<=15;tt++){for(var pt=N;pt<Q;pt++)b[32767+pt]=tt,g[32767+pt]=[],g[32767+pt][1]=tt,g[32767+pt][0]=pt;for(var wt=-(Q-1);wt<=-N;wt++)b[32767+wt]=tt,g[32767+wt]=[],g[32767+wt][1]=tt,g[32767+wt][0]=Q-1+wt;N<<=1,Q<<=1}})(),(function(){for(var N=0;N<256;N++)Mt[N]=19595*N,Mt[N+256|0]=38470*N,Mt[N+512|0]=7471*N+32768,Mt[N+768|0]=-11059*N,Mt[N+1024|0]=-21709*N,Mt[N+1280|0]=32768*N+8421375,Mt[N+1536|0]=-27439*N,Mt[N+1792|0]=-5329*N})(),$(n)}function sc(n,t){if(this.pos=0,this.buffer=n,this.datav=new DataView(n.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 Kw(n){function t(it){if(!it)throw Error("assert :P")}function e(it,Lt,J){for(var ct=0;4>ct;ct++)if(it[Lt+ct]!=J.charCodeAt(ct))return!0;return!1}function r(it,Lt,J,ct,G){for(var vt=0;vt<G;vt++)it[Lt+vt]=J[ct+vt]}function i(it,Lt,J,ct){for(var G=0;G<ct;G++)it[Lt+G]=J}function s(it){return new Int32Array(it)}function l(it,Lt){for(var J=[],ct=0;ct<it;ct++)J.push(new Lt);return J}function c(it,Lt){var J=[];return(function ct(G,vt,_t){for(var ht=_t[vt],Z=0;Z<ht&&(G.push(_t.length>vt+1?[]:new Lt),!(_t.length<vt+1));Z++)ct(G[Z],vt+1,_t)})(J,0,it),J}var f=function(){var it=this;function Lt(m,v){for(var T=1<<v-1>>>0;m&T;)T>>>=1;return T?(m&T-1)+T:m}function J(m,v,T,O,U){t(!(O%T));do m[v+(O-=T)]=U;while(0<O)}function ct(m,v,T,O,U){if(t(2328>=U),512>=U)var W=s(512);else if((W=s(U))==null)return 0;return(function(X,ot,at,yt,Et,Vt){var mt,Pt,Ht=ot,oe=1<<at,$t=s(16),ne=s(16);for(t(Et!=0),t(yt!=null),t(X!=null),t(0<at),Pt=0;Pt<Et;++Pt){if(15<yt[Pt])return 0;++$t[yt[Pt]]}if($t[0]==Et)return 0;for(ne[1]=0,mt=1;15>mt;++mt){if($t[mt]>1<<mt)return 0;ne[mt+1]=ne[mt]+$t[mt]}for(Pt=0;Pt<Et;++Pt)mt=yt[Pt],0<yt[Pt]&&(Vt[ne[mt]++]=Pt);if(ne[15]==1)return(yt=new G).g=0,yt.value=Vt[0],J(X,Ht,1,oe,yt),oe;var se,Se=-1,he=oe-1,en=0,Ye=1,Nn=1,Ke=1<<at;for(Pt=0,mt=1,Et=2;mt<=at;++mt,Et<<=1){if(Ye+=Nn<<=1,0>(Nn-=$t[mt]))return 0;for(;0<$t[mt];--$t[mt])(yt=new G).g=mt,yt.value=Vt[Pt++],J(X,Ht+en,Et,Ke,yt),en=Lt(en,mt)}for(mt=at+1,Et=2;15>=mt;++mt,Et<<=1){if(Ye+=Nn<<=1,0>(Nn-=$t[mt]))return 0;for(;0<$t[mt];--$t[mt]){if(yt=new G,(en&he)!=Se){for(Ht+=Ke,se=1<<(Se=mt)-at;15>Se&&!(0>=(se-=$t[Se]));)++Se,se<<=1;oe+=Ke=1<<(se=Se-at),X[ot+(Se=en&he)].g=se+at,X[ot+Se].value=Ht-ot-Se}yt.g=mt-at,yt.value=Vt[Pt++],J(X,Ht+(en>>at),Et,Ke,yt),en=Lt(en,mt)}}return Ye!=2*ne[15]-1?0:oe})(m,v,T,O,U,W)}function G(){this.value=this.g=0}function vt(){this.value=this.g=0}function _t(){this.G=l(5,G),this.H=s(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=l(us,vt)}function ht(m,v,T,O){t(m!=null),t(v!=null),t(2147483648>O),m.Ca=254,m.I=0,m.b=-8,m.Ka=0,m.oa=v,m.pa=T,m.Jd=v,m.Yc=T+O,m.Zc=4<=O?T+O-4+1:T,Ft(m)}function Z(m,v){for(var T=0;0<v--;)T|=Jt(m,128)<<v;return T}function ut(m,v){var T=Z(m,v);return Rt(m)?-T:T}function It(m,v,T,O){var U,W=0;for(t(m!=null),t(v!=null),t(4294967288>O),m.Sb=O,m.Ra=0,m.u=0,m.h=0,4<O&&(O=4),U=0;U<O;++U)W+=v[T+U]<<8*U;m.Ra=W,m.bb=O,m.oa=v,m.pa=T}function Zt(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;pt(m)&&(m.h=1,m.u=0)}function $(m,v){if(t(0<=v),!m.h&&v<=qa){var T=tt(m)&Ha[v];return m.u+=v,Zt(m),T}return m.h=1,m.u=0}function N(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function Q(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function tt(m){return m.Ra>>>(m.u&Vi-1)>>>0}function pt(m){return t(m.bb<=m.Sb),m.h||m.bb==m.Sb&&m.u>Vi}function wt(m,v){m.u=v,m.h=pt(m)}function At(m){m.u>=ni&&(t(m.u>=ni),Zt(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 Z(m,1)}function Jt(m,v){var T=m.Ca;0>m.b&&Ft(m);var O=m.b,U=T*v>>>8,W=(m.I>>>O>U)+0;for(W?(T-=U,m.I-=U+1<<O>>>0):T=U+1,O=T,U=0;256<=O;)U+=8,O>>=8;return O=7^U+qi[O],m.b-=O,m.Ca=(T<<O)-1,W}function ke(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 Re(m,v){return m[v+0]|m[v+1]<<8}function Ie(m,v){return Re(m,v)|m[v+2]<<16}function Ve(m,v){return Re(m,v)|Re(m,v+2)<<16}function rt(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 Cn(){this.X=[],this.Xa=this.Mb=0}function cn(m,v,T,O){t(T!=null),t(O!=null);var U=T[0],W=O[0];return U==0&&(U=(m*W+v/2)/v),W==0&&(W=(v*U+m/2)/m),0>=U||0>=W?0:(T[0]=U,O[0]=W,1)}function xe(m,v){return m+(1<<v)-1>>>v}function we(m,v){return((4278255360&m)+(4278255360&v)>>>0&4278255360)+((16711935&m)+(16711935&v)>>>0&16711935)>>>0}function Ne(m,v){it[v]=function(T,O,U,W,X,ot,at){var yt;for(yt=0;yt<X;++yt){var Et=it[m](ot[at+yt-1],U,W+yt);ot[at+yt]=we(T[O+yt],Et)}}}function De(){this.ud=this.hd=this.jd=0}function Fe(m,v){return((4278124286&(m^v))>>>1)+(m&v)>>>0}function tn(m){return 0<=m&&256>m?m:0>m?0:255<m?255:void 0}function Pn(m,v){return tn(m+(m-v+.5>>1))}function mn(m,v,T){return Math.abs(v-T)-Math.abs(m-T)}function In(m,v,T,O,U,W,X){for(O=W[X-1],T=0;T<U;++T)W[X+T]=O=we(m[v+T],O)}function hn(m,v,T,O,U){var W;for(W=0;W<T;++W){var X=m[v+W],ot=X>>8&255,at=16711935&(at=(at=16711935&X)+((ot<<16)+ot));O[U+W]=(4278255360&X)+at>>>0}}function Ue(m,v){v.jd=255&m,v.hd=m>>8&255,v.ud=m>>16&255}function $e(m,v,T,O,U,W){var X;for(X=0;X<O;++X){var ot=v[T+X],at=ot>>>8,yt=ot,Et=255&(Et=(Et=ot>>>16)+((m.jd<<24>>24)*(at<<24>>24)>>>5));yt=255&(yt=(yt+=(m.hd<<24>>24)*(at<<24>>24)>>>5)+((m.ud<<24>>24)*(Et<<24>>24)>>>5)),U[W+X]=(4278255360&ot)+(Et<<16)+yt}}function je(m,v,T,O,U){it[v]=function(W,X,ot,at,yt,Et,Vt,mt,Pt){for(at=Vt;at<mt;++at)for(Vt=0;Vt<Pt;++Vt)yt[Et++]=U(ot[O(W[X++])])},it[m]=function(W,X,ot,at,yt,Et,Vt){var mt=8>>W.b,Pt=W.Ea,Ht=W.K[0],oe=W.w;if(8>mt)for(W=(1<<W.b)-1,oe=(1<<mt)-1;X<ot;++X){var $t,ne=0;for($t=0;$t<Pt;++$t)$t&W||(ne=O(at[yt++])),Et[Vt++]=U(Ht[ne&oe]),ne>>=mt}else it["VP8LMapColor"+T](at,yt,Ht,oe,Et,Vt,X,ot,Pt)}}function nr(m,v,T,O,U){for(T=v+T;v<T;){var W=m[v++];O[U++]=W>>16&255,O[U++]=W>>8&255,O[U++]=255&W}}function bn(m,v,T,O,U){for(T=v+T;v<T;){var W=m[v++];O[U++]=W>>16&255,O[U++]=W>>8&255,O[U++]=255&W,O[U++]=W>>24&255}}function an(m,v,T,O,U){for(T=v+T;v<T;){var W=(X=m[v++])>>16&240|X>>12&15,X=240&X|X>>28&15;O[U++]=W,O[U++]=X}}function ln(m,v,T,O,U){for(T=v+T;v<T;){var W=(X=m[v++])>>16&248|X>>13&7,X=X>>5&224|X>>3&31;O[U++]=W,O[U++]=X}}function Bn(m,v,T,O,U){for(T=v+T;v<T;){var W=m[v++];O[U++]=255&W,O[U++]=W>>8&255,O[U++]=W>>16&255}}function Xe(m,v,T,O,U,W){if(W==0)for(T=v+T;v<T;)ke(O,((W=m[v++])[0]>>24|W[1]>>8&65280|W[2]<<8&16711680|W[3]<<24)>>>0),U+=32;else r(O,U,m,v,T)}function Mr(m,v){it[v][0]=it[m+"0"],it[v][1]=it[m+"1"],it[v][2]=it[m+"2"],it[v][3]=it[m+"3"],it[v][4]=it[m+"4"],it[v][5]=it[m+"5"],it[v][6]=it[m+"6"],it[v][7]=it[m+"7"],it[v][8]=it[m+"8"],it[v][9]=it[m+"9"],it[v][10]=it[m+"10"],it[v][11]=it[m+"11"],it[v][12]=it[m+"12"],it[v][13]=it[m+"13"],it[v][14]=it[m+"0"],it[v][15]=it[m+"0"]}function gn(m){return m==Ac||m==Ya||m==tc||m==Kc}function yn(){this.eb=[],this.size=this.A=this.fb=0}function Qt(){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 ye(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new yn,this.f.kb=new Qt,this.sd=null}function Ce(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function ve(){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 Zn(m){return alert("todo:WebPSamplerProcessPlane"),m.T}function $n(m,v){var T=m.T,O=v.ba.f.RGBA,U=O.eb,W=O.fb+m.ka*O.A,X=Pi[v.ba.S],ot=m.y,at=m.O,yt=m.f,Et=m.N,Vt=m.ea,mt=m.W,Pt=v.cc,Ht=v.dc,oe=v.Mc,$t=v.Nc,ne=m.ka,se=m.ka+m.T,Se=m.U,he=Se+1>>1;for(ne==0?X(ot,at,null,null,yt,Et,Vt,mt,yt,Et,Vt,mt,U,W,null,null,Se):(X(v.ec,v.fc,ot,at,Pt,Ht,oe,$t,yt,Et,Vt,mt,U,W-O.A,U,W,Se),++T);ne+2<se;ne+=2)Pt=yt,Ht=Et,oe=Vt,$t=mt,Et+=m.Rc,mt+=m.Rc,W+=2*O.A,X(ot,(at+=2*m.fa)-m.fa,ot,at,Pt,Ht,oe,$t,yt,Et,Vt,mt,U,W-O.A,U,W,Se);return at+=m.fa,m.j+se<m.o?(r(v.ec,v.fc,ot,at,Se),r(v.cc,v.dc,yt,Et,he),r(v.Mc,v.Nc,Vt,mt,he),T--):1&se||X(ot,at,null,null,yt,Et,Vt,mt,yt,Et,Vt,mt,U,W+O.A,null,null,Se),T}function xr(m,v,T){var O=m.F,U=[m.J];if(O!=null){var W=m.U,X=v.ba.S,ot=X==Gc||X==tc;v=v.ba.f.RGBA;var at=[0],yt=m.ka;at[0]=m.T,m.Kb&&(yt==0?--at[0]:(--yt,U[0]-=m.width),m.j+m.ka+m.T==m.o&&(at[0]=m.o-m.j-yt));var Et=v.eb;yt=v.fb+yt*v.A,m=$c(O,U[0],m.width,W,at,Et,yt+(ot?0:3),v.A),t(T==at),m&&gn(X)&&Zl(Et,yt,ot,W,at,v.A)}return 0}function Bo(m){var v=m.ma,T=v.ba.S,O=11>T,U=T==so||T==ps||T==Gc||T==Ql||T==12||gn(T);if(v.memory=null,v.Ib=null,v.Jb=null,v.Nd=null,!io(v.Oa,m,U?11:12))return 0;if(U&&gn(T)&&Sn(),m.da)alert("todo:use_scaling");else{if(O){if(v.Ib=Zn,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=$n,Sn()}}else alert("todo:EmitYUV");U&&(v.Jb=xr,O&&ei())}if(O&&!$i){for(m=0;256>m;++m)Yi[m]=89858*(m-128)+Cc>>xs,Ou[m]=-22014*(m-128)+Cc,md[m]=-45773*(m-128),Qc[m]=113618*(m-128)+Cc>>xs;for(m=vs;m<Ml;++m)v=76283*(m-16)+Cc>>xs,Tf[m-vs]=ns(v,255),Nf[m-vs]=ns(v+8>>4,15);$i=1}return 1}function Ze(m){var v=m.ma,T=m.U,O=m.T;return t(!(1&m.ka)),0>=T||0>=O?0:(T=v.Ib(m,v),v.Jb!=null&&v.Jb(m,v,T),v.Dc+=T,1)}function ts(m){m.ma.memory=null}function Yt(m,v,T,O){return $(m,8)!=47?0:(v[0]=$(m,14)+1,T[0]=$(m,14)+1,O[0]=$(m,1),$(m,3)!=0?0:!m.h)}function Ur(m,v){if(4>m)return m+1;var T=m-2>>1;return(2+(1&m)<<T)+$(v,T)+1}function Ni(m,v){return 120<v?v-120:1<=(T=((T=ao[v-1])>>4)*m+(8-(15&T)))?T:1;var T}function Tn(m,v,T){var O=tt(T),U=m[v+=255&O].g-8;return 0<U&&(wt(T,T.u+8),O=tt(T),v+=m[v].value,v+=O&(1<<U)-1),wt(T,T.u+m[v].g),m[v].value}function fi(m,v,T){return T.g+=m.g,T.value+=m.value<<v>>>0,t(8>=T.g),m.g}function _i(m,v,T){var O=m.xc;return t((v=O==0?0:m.vc[m.md*(T>>O)+(v>>O)])<m.Wb),m.Ya[v]}function ha(m,v,T,O){var U=m.ab,W=m.c*v,X=m.C;v=X+v;var ot=T,at=O;for(O=m.Ta,T=m.Ua;0<U--;){var yt=m.gc[U],Et=X,Vt=v,mt=ot,Pt=at,Ht=(at=O,ot=T,yt.Ea);switch(t(Et<Vt),t(Vt<=yt.nc),yt.hc){case 2:pl(mt,Pt,(Vt-Et)*Ht,at,ot);break;case 0:var oe=Et,$t=Vt,ne=at,se=ot,Se=(Ke=yt).Ea;oe==0&&(Is(mt,Pt,null,null,1,ne,se),In(mt,Pt+1,0,0,Se-1,ne,se+1),Pt+=Se,se+=Se,++oe);for(var he=1<<Ke.b,en=he-1,Ye=xe(Se,Ke.b),Nn=Ke.K,Ke=Ke.w+(oe>>Ke.b)*Ye;oe<$t;){var Xn=Nn,zr=Ke,zn=1;for(vo(mt,Pt,ne,se-Se,1,ne,se);zn<Se;){var qe=(zn&~en)+he;qe>Se&&(qe=Se),(0,wo[Xn[zr++]>>8&15])(mt,Pt+ +zn,ne,se+zn-Se,qe-zn,ne,se+zn),zn=qe}Pt+=Se,se+=Se,++oe&en||(Ke+=Ye)}Vt!=yt.nc&&r(at,ot-Ht,at,ot+(Vt-Et-1)*Ht,Ht);break;case 1:for(Ht=mt,$t=Pt,Se=(mt=yt.Ea)-(se=mt&~(ne=(Pt=1<<yt.b)-1)),oe=xe(mt,yt.b),he=yt.K,yt=yt.w+(Et>>yt.b)*oe;Et<Vt;){for(en=he,Ye=yt,Nn=new De,Ke=$t+se,Xn=$t+mt;$t<Ke;)Ue(en[Ye++],Nn),Sa(Nn,Ht,$t,Pt,at,ot),$t+=Pt,ot+=Pt;$t<Xn&&(Ue(en[Ye++],Nn),Sa(Nn,Ht,$t,Se,at,ot),$t+=Se,ot+=Se),++Et&ne||(yt+=oe)}break;case 3:if(mt==at&&Pt==ot&&0<yt.b){for($t=at,mt=Ht=ot+(Vt-Et)*Ht-(se=(Vt-Et)*xe(yt.Ea,yt.b)),Pt=at,ne=ot,oe=[],se=(Se=se)-1;0<=se;--se)oe[se]=Pt[ne+se];for(se=Se-1;0<=se;--se)$t[mt+se]=oe[se];ml(yt,Et,Vt,at,Ht,at,ot)}else ml(yt,Et,Vt,mt,Pt,at,ot)}ot=O,at=T}at!=T&&r(O,T,ot,at,W)}function go(m,v){var T=m.V,O=m.Ba+m.c*m.C,U=v-m.C;if(t(v<=m.l.o),t(16>=U),0<U){var W=m.l,X=m.Ta,ot=m.Ua,at=W.width;if(ha(m,U,T,O),U=ot=[ot],t((T=m.C)<(O=v)),t(W.v<W.va),O>W.o&&(O=W.o),T<W.j){var yt=W.j-T;T=W.j,U[0]+=yt*at}if(T>=O?T=0:(U[0]+=4*W.v,W.ka=T-W.j,W.U=W.va-W.v,W.T=O-T,T=1),T){if(ot=ot[0],11>(T=m.ca).S){var Et=T.f.RGBA,Vt=(O=T.S,U=W.U,W=W.T,yt=Et.eb,Et.A),mt=W;for(Et=Et.fb+m.Ma*Et.A;0<mt--;){var Pt=X,Ht=ot,oe=U,$t=yt,ne=Et;switch(O){case Wc:vc(Pt,Ht,oe,$t,ne);break;case so:gl(Pt,Ht,oe,$t,ne);break;case Ac:gl(Pt,Ht,oe,$t,ne),Zl($t,ne,0,oe,1,0);break;case Xc:Gl(Pt,Ht,oe,$t,ne);break;case ps:Xe(Pt,Ht,oe,$t,ne,1);break;case Ya:Xe(Pt,Ht,oe,$t,ne,1),Zl($t,ne,0,oe,1,0);break;case Gc:Xe(Pt,Ht,oe,$t,ne,0);break;case tc:Xe(Pt,Ht,oe,$t,ne,0),Zl($t,ne,1,oe,1,0);break;case Ql:Xl(Pt,Ht,oe,$t,ne);break;case Kc:Xl(Pt,Ht,oe,$t,ne),hs($t,ne,oe,1,0);break;case $a:ka(Pt,Ht,oe,$t,ne);break;default:t(0)}ot+=at,Et+=Vt}m.Ma+=W}else alert("todo:EmitRescaledRowsYUVA");t(m.Ma<=T.height)}}m.C=v,t(m.C<=m.i)}function pr(m){var v;if(0<m.ua)return 0;for(v=0;v<m.Wb;++v){var T=m.Ya[v].G,O=m.Ya[v].H;if(0<T[1][O[1]+0].g||0<T[2][O[2]+0].g||0<T[3][O[3]+0].g)return 0}return 1}function Cr(m,v,T,O,U,W){if(m.Z!=0){var X=m.qd,ot=m.rd;for(t(Wa[m.Z]!=null);v<T;++v)Wa[m.Z](X,ot,O,U,O,U,W),X=O,ot=U,U+=W;m.qd=X,m.rd=ot}}function no(m,v){var T=m.l.ma,O=T.Z==0||T.Z==1?m.l.j:m.C;if(O=m.C<O?O:m.C,t(v<=m.l.o),v>O){var U=m.l.width,W=T.ca,X=T.tb+U*O,ot=m.V,at=m.Ba+m.c*O,yt=m.gc;t(m.ab==1),t(yt[0].hc==3),Me(yt[0],O,v,ot,at,W,X),Cr(T,O,v,W,X,U)}m.C=m.Ma=v}function Hr(m,v,T,O,U,W,X){var ot=m.$/O,at=m.$%O,yt=m.m,Et=m.s,Vt=T+m.$,mt=Vt;U=T+O*U;var Pt=T+O*W,Ht=280+Et.ua,oe=m.Pb?ot:16777216,$t=0<Et.ua?Et.Wa:null,ne=Et.wc,se=Vt<Pt?_i(Et,at,ot):null;t(m.C<W),t(Pt<=U);var Se=!1;t:for(;;){for(;Se||Vt<Pt;){var he=0;if(ot>=oe){var en=Vt-T;t((oe=m).Pb),oe.wd=oe.m,oe.xd=en,0<oe.s.ua&&Oe(oe.s.Wa,oe.s.vb),oe=ot+Va}if(at&ne||(se=_i(Et,at,ot)),t(se!=null),se.Qb&&(v[Vt]=se.qb,Se=!0),!Se)if(At(yt),se.jc){he=yt,en=v;var Ye=Vt,Nn=se.pd[tt(he)&us-1];t(se.jc),256>Nn.g?(wt(he,he.u+Nn.g),en[Ye]=Nn.value,he=0):(wt(he,he.u+Nn.g-256),t(256<=Nn.value),he=Nn.value),he==0&&(Se=!0)}else he=Tn(se.G[0],se.H[0],yt);if(yt.h)break;if(Se||256>he){if(!Se)if(se.nd)v[Vt]=(se.qb|he<<8)>>>0;else{if(At(yt),Se=Tn(se.G[1],se.H[1],yt),At(yt),en=Tn(se.G[2],se.H[2],yt),Ye=Tn(se.G[3],se.H[3],yt),yt.h)break;v[Vt]=(Ye<<24|Se<<16|he<<8|en)>>>0}if(Se=!1,++Vt,++at>=O&&(at=0,++ot,X!=null&&ot<=W&&!(ot%16)&&X(m,ot),$t!=null))for(;mt<Vt;)he=v[mt++],$t.X[(506832829*he&4294967295)>>>$t.Mb]=he}else if(280>he){if(he=Ur(he-256,yt),en=Tn(se.G[4],se.H[4],yt),At(yt),en=Ni(O,en=Ur(en,yt)),yt.h)break;if(Vt-T<en||U-Vt<he)break t;for(Ye=0;Ye<he;++Ye)v[Vt+Ye]=v[Vt+Ye-en];for(Vt+=he,at+=he;at>=O;)at-=O,++ot,X!=null&&ot<=W&&!(ot%16)&&X(m,ot);if(t(Vt<=U),at&ne&&(se=_i(Et,at,ot)),$t!=null)for(;mt<Vt;)he=v[mt++],$t.X[(506832829*he&4294967295)>>>$t.Mb]=he}else{if(!(he<Ht))break t;for(Se=he-280,t($t!=null);mt<Vt;)he=v[mt++],$t.X[(506832829*he&4294967295)>>>$t.Mb]=he;he=Vt,t(!(Se>>>(en=$t).Xa)),v[he]=en.X[Se],Se=!0}Se||t(yt.h==pt(yt))}if(m.Pb&&yt.h&&Vt<U)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(yt.h)break t;X?.(m,ot>W?W:ot),m.a=0,m.$=Vt-T}return 1}return m.a=3,0}function sr(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 Fl(){var m=new Ge;return m==null?null:(m.a=0,m.xb=Ru,Mr("Predictor","VP8LPredictors"),Mr("Predictor","VP8LPredictors_C"),Mr("PredictorAdd","VP8LPredictorsAdd"),Mr("PredictorAdd","VP8LPredictorsAdd_C"),pl=hn,Sa=$e,vc=nr,gl=bn,Xl=an,ka=ln,Gl=Bn,it.VP8LMapColor32b=mi,it.VP8LMapColor8b=ur,m)}function Ks(m,v,T,O,U){var W=1,X=[m],ot=[v],at=O.m,yt=O.s,Et=null,Vt=0;t:for(;;){if(T)for(;W&&$(at,1);){var mt=X,Pt=ot,Ht=O,oe=1,$t=Ht.m,ne=Ht.gc[Ht.ab],se=$($t,2);if(Ht.Oc&1<<se)W=0;else{switch(Ht.Oc|=1<<se,ne.hc=se,ne.Ea=mt[0],ne.nc=Pt[0],ne.K=[null],++Ht.ab,t(4>=Ht.ab),se){case 0:case 1:ne.b=$($t,3)+2,oe=Ks(xe(ne.Ea,ne.b),xe(ne.nc,ne.b),0,Ht,ne.K),ne.K=ne.K[0];break;case 3:var Se,he=$($t,8)+1,en=16<he?0:4<he?1:2<he?2:3;if(mt[0]=xe(ne.Ea,en),ne.b=en,Se=oe=Ks(he,1,0,Ht,ne.K)){var Ye,Nn=he,Ke=ne,Xn=1<<(8>>Ke.b),zr=s(Xn);if(zr==null)Se=0;else{var zn=Ke.K[0],qe=Ke.w;for(zr[0]=Ke.K[0][0],Ye=1;Ye<1*Nn;++Ye)zr[Ye]=we(zn[qe+Ye],zr[Ye-1]);for(;Ye<4*Xn;++Ye)zr[Ye]=0;Ke.K[0]=null,Ke.K[0]=zr,Se=1}}oe=Se;break;case 2:break;default:t(0)}W=oe}}if(X=X[0],ot=ot[0],W&&$(at,1)&&!(W=1<=(Vt=$(at,4))&&11>=Vt)){O.a=3;break t}var Pe;if(Pe=W)e:{var oi,xn,qn,Tr=O,Ii=X,lo=ot,Nr=Vt,ji=T,So=Tr.m,gi=Tr.s,Kn=[null],ir=1,Br=0,lr=gs[Nr];n:for(;;){if(ji&&$(So,1)){var si=$(So,3)+2,Un=xe(Ii,si),Qn=xe(lo,si),Yr=Un*Qn;if(!Ks(Un,Qn,0,Tr,Kn))break n;for(Kn=Kn[0],gi.xc=si,oi=0;oi<Yr;++oi){var w=Kn[oi]>>8&65535;Kn[oi]=w,w>=ir&&(ir=w+1)}}if(So.h)break n;for(xn=0;5>xn;++xn){var S=vl[xn];!xn&&0<Nr&&(S+=1<<Nr),Br<S&&(Br=S)}var D=l(ir*lr,G),_=ir,I=l(_,_t);if(I==null)var K=null;else t(65536>=_),K=I;var nt=s(Br);if(K==null||nt==null||D==null){Tr.a=1;break n}var j=D;for(oi=qn=0;oi<ir;++oi){var Y=K[oi],lt=Y.G,st=Y.H,ft=0,z=1,Ct=0;for(xn=0;5>xn;++xn){S=vl[xn],lt[xn]=j,st[xn]=qn,!xn&&0<Nr&&(S+=1<<Nr);i:{var jt,St=S,Dt=Tr,xt=nt,qt=j,Wt=qn,fe=0,be=Dt.m,Ee=$(be,1);if(i(xt,0,0,St),Ee){var Je=$(be,1)+1,En=$(be,1),pe=$(be,En==0?1:8);xt[pe]=1,Je==2&&(xt[pe=$(be,8)]=1);var Le=1}else{var ae=s(19),An=$(be,4)+4;if(19<An){Dt.a=3;var Hn=0;break i}for(jt=0;jt<An;++jt)ae[Mc[jt]]=$(be,3);var Sr=void 0,Gr=void 0,yi=Dt,zt=ae,He=St,Te=xt,ze=0,Be=yi.m,vn=8,Ir=l(128,G);r:for(;ct(Ir,0,7,zt,19);){if($(Be,1)){var Gi=2+2*$(Be,3);if((Sr=2+$(Be,Gi))>He)break r}else Sr=He;for(Gr=0;Gr<He&&Sr--;){At(Be);var bi=Ir[0+(127&tt(Be))];wt(Be,Be.u+bi.g);var ki=bi.value;if(16>ki)Te[Gr++]=ki,ki!=0&&(vn=ki);else{var Ai=ki==16,xi=ki-16,Kr=ec[xi],gr=$(Be,ms[xi])+Kr;if(Gr+gr>He)break r;for(var Ki=Ai?vn:0;0<gr--;)Te[Gr++]=Ki}}ze=1;break r}ze||(yi.a=3),Le=ze}(Le=Le&&!be.h)&&(fe=ct(qt,Wt,8,xt,St)),Le&&fe!=0?Hn=fe:(Dt.a=3,Hn=0)}if(Hn==0)break n;if(z&&wl[xn]==1&&(z=j[qn].g==0),ft+=j[qn].g,qn+=Hn,3>=xn){var ko,tu=nt[0];for(ko=1;ko<S;++ko)nt[ko]>tu&&(tu=nt[ko]);Ct+=tu}}if(Y.nd=z,Y.Qb=0,z&&(Y.qb=(lt[3][st[3]+0].value<<24|lt[1][st[1]+0].value<<16|lt[2][st[2]+0].value)>>>0,ft==0&&256>lt[0][st[0]+0].value&&(Y.Qb=1,Y.qb+=lt[0][st[0]+0].value<<8)),Y.jc=!Y.Qb&&6>Ct,Y.jc){var nc,jo=Y;for(nc=0;nc<us;++nc){var sa=nc,aa=jo.pd[sa],eu=jo.G[0][jo.H[0]+sa];256<=eu.value?(aa.g=eu.g+256,aa.value=eu.value):(aa.g=0,aa.value=0,sa>>=fi(eu,8,aa),sa>>=fi(jo.G[1][jo.H[1]+sa],16,aa),sa>>=fi(jo.G[2][jo.H[2]+sa],0,aa),fi(jo.G[3][jo.H[3]+sa],24,aa))}}}gi.vc=Kn,gi.Wb=ir,gi.Ya=K,gi.yc=D,Pe=1;break e}Pe=0}if(!(W=Pe)){O.a=3;break t}if(0<Vt){if(yt.ua=1<<Vt,!rt(yt.Wa,Vt)){O.a=1,W=0;break t}}else yt.ua=0;var nu=O,rc=X,la=ot,Fs=nu.s,ca=Fs.xc;if(nu.c=rc,nu.i=la,Fs.md=xe(rc,ca),Fs.wc=ca==0?-1:(1<<ca)-1,T){O.xb=Sl;break t}if((Et=s(X*ot))==null){O.a=1,W=0;break t}W=(W=Hr(O,Et,0,X,ot,ot,null))&&!at.h;break t}return W?(U!=null?U[0]=Et:(t(Et==null),t(T)),O.$=0,T||sr(yt)):sr(yt),W}function es(m,v){var T=m.c*m.i,O=T+v+16*v;return t(m.c<=v),m.V=s(O),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 pa(m,v){var T=m.C,O=v-T,U=m.V,W=m.Ba+m.c*T;for(t(v<=m.l.o);0<O;){var X=16<O?16:O,ot=m.l.ma,at=m.l.width,yt=at*X,Et=ot.ca,Vt=ot.tb+at*T,mt=m.Ta,Pt=m.Ua;ha(m,X,U,W),Xo(mt,Pt,Et,Vt,yt),Cr(ot,T,T+X,Et,Vt,at),O-=X,U+=X*m.c,T+=X}t(T==v),m.C=m.Ma=v}function No(){this.ub=this.yd=this.td=this.Rb=0}function ma(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function pc(){this.Fb=this.Bb=this.Cb=0,this.Zb=s(4),this.Lb=s(4)}function Js(){this.Yb=(function(){var m=[];return(function v(T,O,U){for(var W=U[O],X=0;X<W&&(T.push(U.length>O+1?[]:0),!(U.length<O+1));X++)v(T[X],O+1,U)})(m,0,[3,11]),m})()}function di(){this.jb=s(3),this.Wc=c([4,8],Js),this.Xc=c([4,17],Js)}function sl(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new s(4),this.od=new s(4)}function Fo(){this.ld=this.La=this.dd=this.tc=0}function Uo(){this.Na=this.la=0}function _o(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function Do(){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 al(){this.uc=this.M=this.Nb=0,this.wa=Array(new Fo),this.Y=0,this.ya=Array(new Do),this.aa=0,this.l=new ga}function Ul(){this.y=s(16),this.f=s(8),this.ea=s(8)}function Uc(){this.cb=this.a=0,this.sc="",this.m=new N,this.Od=new No,this.Kc=new ma,this.ed=new sl,this.Qa=new pc,this.Ic=this.$c=this.Aa=0,this.D=new al,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=l(8,N),this.ia=0,this.pb=l(4,_o),this.Pa=new di,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new Ul),this.Hd=0,this.rb=Array(new Uo),this.sb=0,this.wa=Array(new Fo),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 Do),this.L=this.aa=0,this.gd=c([4,2],Fo),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 ns(m,v){return 0>m?0:m>v?v:m}function ga(){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 Lo(){var m=new Uc;return m!=null&&(m.a=0,m.sc="OK",m.cb=0,m.Xb=0,Go||(Go=ro)),m}function Fn(m,v,T){return m.a==0&&(m.a=v,m.sc=T,m.cb=0),0}function Ho(m,v,T){return 3<=T&&m[v+0]==157&&m[v+1]==1&&m[v+2]==42}function vi(m,v){if(m==null)return 0;if(m.a=0,m.sc="OK",v==null)return Fn(m,2,"null VP8Io passed to VP8GetHeaders()");var T=v.data,O=v.w,U=v.ha;if(4>U)return Fn(m,7,"Truncated header.");var W=T[O+0]|T[O+1]<<8|T[O+2]<<16,X=m.Od;if(X.Rb=!(1&W),X.td=W>>1&7,X.yd=W>>4&1,X.ub=W>>5,3<X.td)return Fn(m,3,"Incorrect keyframe parameters.");if(!X.yd)return Fn(m,4,"Frame not displayable.");O+=3,U-=3;var ot=m.Kc;if(X.Rb){if(7>U)return Fn(m,7,"cannot parse picture header");if(!Ho(T,O,U))return Fn(m,3,"Bad code word");ot.c=16383&(T[O+4]<<8|T[O+3]),ot.Td=T[O+4]>>6,ot.i=16383&(T[O+6]<<8|T[O+5]),ot.Ud=T[O+6]>>6,O+=7,U-=7,m.za=ot.c+15>>4,m.Ub=ot.i+15>>4,v.width=ot.c,v.height=ot.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((W=m.Pa).jb,0,255,W.jb.length),t((W=m.Qa)!=null),W.Cb=0,W.Bb=0,W.Fb=1,i(W.Zb,0,0,W.Zb.length),i(W.Lb,0,0,W.Lb)}if(X.ub>U)return Fn(m,7,"bad partition length");ht(W=m.m,T,O,X.ub),O+=X.ub,U-=X.ub,X.Rb&&(ot.Ld=Rt(W),ot.Kd=Rt(W)),ot=m.Qa;var at,yt=m.Pa;if(t(W!=null),t(ot!=null),ot.Cb=Rt(W),ot.Cb){if(ot.Bb=Rt(W),Rt(W)){for(ot.Fb=Rt(W),at=0;4>at;++at)ot.Zb[at]=Rt(W)?ut(W,7):0;for(at=0;4>at;++at)ot.Lb[at]=Rt(W)?ut(W,6):0}if(ot.Bb)for(at=0;3>at;++at)yt.jb[at]=Rt(W)?Z(W,8):255}else ot.Bb=0;if(W.Ka)return Fn(m,3,"cannot parse segment header");if((ot=m.ed).zd=Rt(W),ot.Tb=Z(W,6),ot.wb=Z(W,3),ot.Pc=Rt(W),ot.Pc&&Rt(W)){for(yt=0;4>yt;++yt)Rt(W)&&(ot.vd[yt]=ut(W,6));for(yt=0;4>yt;++yt)Rt(W)&&(ot.od[yt]=ut(W,6))}if(m.L=ot.Tb==0?0:ot.zd?1:2,W.Ka)return Fn(m,3,"cannot parse filter header");var Et=U;if(U=at=O,O=at+Et,ot=Et,m.Xb=(1<<Z(m.m,2))-1,Et<3*(yt=m.Xb))T=7;else{for(at+=3*yt,ot-=3*yt,Et=0;Et<yt;++Et){var Vt=T[U+0]|T[U+1]<<8|T[U+2]<<16;Vt>ot&&(Vt=ot),ht(m.Jc[+Et],T,at,Vt),at+=Vt,ot-=Vt,U+=3}ht(m.Jc[+yt],T,at,ot),T=at<O?0:5}if(T!=0)return Fn(m,T,"cannot parse partitions");for(T=Z(at=m.m,7),U=Rt(at)?ut(at,4):0,O=Rt(at)?ut(at,4):0,ot=Rt(at)?ut(at,4):0,yt=Rt(at)?ut(at,4):0,at=Rt(at)?ut(at,4):0,Et=m.Qa,Vt=0;4>Vt;++Vt){if(Et.Cb){var mt=Et.Zb[Vt];Et.Fb||(mt+=T)}else{if(0<Vt){m.pb[Vt]=m.pb[0];continue}mt=T}var Pt=m.pb[Vt];Pt.Sc[0]=ys[ns(mt+U,127)],Pt.Sc[1]=bs[ns(mt+0,127)],Pt.Eb[0]=2*ys[ns(mt+O,127)],Pt.Eb[1]=101581*bs[ns(mt+ot,127)]>>16,8>Pt.Eb[1]&&(Pt.Eb[1]=8),Pt.Qc[0]=ys[ns(mt+yt,117)],Pt.Qc[1]=bs[ns(mt+at,127)],Pt.lc=mt+at}if(!X.Rb)return Fn(m,4,"Not a key frame.");for(Rt(W),X=m.Pa,T=0;4>T;++T){for(U=0;8>U;++U)for(O=0;3>O;++O)for(ot=0;11>ot;++ot)yt=Jt(W,Lr[T][U][O][ot])?Z(W,8):Jc[T][U][O][ot],X.Wc[T][U].Yb[O][ot]=yt;for(U=0;17>U;++U)X.Xc[T][U]=X.Wc[T][rr[U]]}return m.kc=Rt(W),m.kc&&(m.Bd=Z(W,8)),m.cb=1}function ro(m,v,T,O,U,W,X){var ot=v[U].Yb[T];for(T=0;16>U;++U){if(!Jt(m,ot[T+0]))return U;for(;!Jt(m,ot[T+1]);)if(ot=v[++U].Yb[0],T=0,U==16)return 16;var at=v[U+1].Yb;if(Jt(m,ot[T+2])){var yt=m,Et=0;if(Jt(yt,(mt=ot)[(Vt=T)+3]))if(Jt(yt,mt[Vt+6])){for(ot=0,Vt=2*(Et=Jt(yt,mt[Vt+8]))+(mt=Jt(yt,mt[Vt+9+Et])),Et=0,mt=Ef[Vt];mt[ot];++ot)Et+=Et+Jt(yt,mt[ot]);Et+=3+(8<<Vt)}else Jt(yt,mt[Vt+7])?(Et=7+2*Jt(yt,165),Et+=Jt(yt,145)):Et=5+Jt(yt,159);else Et=Jt(yt,mt[Vt+4])?3+Jt(yt,mt[Vt+5]):2;ot=at[2]}else Et=1,ot=at[1];at=X+Lu[U],0>(yt=m).b&&Ft(yt);var Vt,mt=yt.b,Pt=(Vt=yt.Ca>>1)-(yt.I>>mt)>>31;--yt.b,yt.Ca+=Pt,yt.Ca|=1,yt.I-=(Vt+1&Pt)<<mt,W[at]=((Et^Pt)-Pt)*O[(0<U)+0]}return 16}function _r(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 hi(m,v,T,O,U){U=m[v+T+32*O]+(U>>3),m[v+T+32*O]=-256&U?0>U?0:255:U}function Ui(m,v,T,O,U,W){hi(m,v,0,T,O+U),hi(m,v,1,T,O+W),hi(m,v,2,T,O-W),hi(m,v,3,T,O-U)}function vr(m){return(20091*m>>16)+m}function Rn(m,v,T,O){var U,W=0,X=s(16);for(U=0;4>U;++U){var ot=m[v+0]+m[v+8],at=m[v+0]-m[v+8],yt=(35468*m[v+4]>>16)-vr(m[v+12]),Et=vr(m[v+4])+(35468*m[v+12]>>16);X[W+0]=ot+Et,X[W+1]=at+yt,X[W+2]=at-yt,X[W+3]=ot-Et,W+=4,v++}for(U=W=0;4>U;++U)ot=(m=X[W+0]+4)+X[W+8],at=m-X[W+8],yt=(35468*X[W+4]>>16)-vr(X[W+12]),hi(T,O,0,0,ot+(Et=vr(X[W+4])+(35468*X[W+12]>>16))),hi(T,O,1,0,at+yt),hi(T,O,2,0,at-yt),hi(T,O,3,0,ot-Et),W++,O+=32}function ya(m,v,T,O){var U=m[v+0]+4,W=35468*m[v+4]>>16,X=vr(m[v+4]),ot=35468*m[v+1]>>16;Ui(T,O,0,U+X,m=vr(m[v+1]),ot),Ui(T,O,1,U+W,m,ot),Ui(T,O,2,U-W,m,ot),Ui(T,O,3,U-X,m,ot)}function ll(m,v,T,O,U){Rn(m,v,T,O),U&&Rn(m,v+16,T,O+4)}function qo(m,v,T,O){js(m,v+0,T,O,1),js(m,v+32,T,O+128,1)}function te(m,v,T,O){var U;for(m=m[v+0]+4,U=0;4>U;++U)for(v=0;4>v;++v)hi(T,O,v,U,m)}function Zs(m,v,T,O){m[v+0]&&Wi(m,v+0,T,O),m[v+16]&&Wi(m,v+16,T,O+4),m[v+32]&&Wi(m,v+32,T,O+128),m[v+48]&&Wi(m,v+48,T,O+128+4)}function $o(m,v,T,O){var U,W=s(16);for(U=0;4>U;++U){var X=m[v+0+U]+m[v+12+U],ot=m[v+4+U]+m[v+8+U],at=m[v+4+U]-m[v+8+U],yt=m[v+0+U]-m[v+12+U];W[0+U]=X+ot,W[8+U]=X-ot,W[4+U]=yt+at,W[12+U]=yt-at}for(U=0;4>U;++U)X=(m=W[0+4*U]+3)+W[3+4*U],ot=W[1+4*U]+W[2+4*U],at=W[1+4*U]-W[2+4*U],yt=m-W[3+4*U],T[O+0]=X+ot>>3,T[O+16]=yt+at>>3,T[O+32]=X-ot>>3,T[O+48]=yt-at>>3,O+=64}function mc(m,v,T){var O,U=v-32,W=oo,X=255-m[U-1];for(O=0;O<T;++O){var ot,at=W,yt=X+m[v-1];for(ot=0;ot<T;++ot)m[v+ot]=at[yt+m[U+ot]];v+=32}}function Ts(m,v){mc(m,v,4)}function Hl(m,v){mc(m,v,8)}function Hc(m,v){mc(m,v,16)}function Af(m,v){var T;for(T=0;16>T;++T)r(m,v+32*T,m,v-32,16)}function Nu(m,v){var T;for(T=16;0<T;--T)i(m,v,m[v-1],16),v+=32}function Ns(m,v,T){var O;for(O=0;16>O;++O)i(v,T+32*O,m,16)}function Ro(m,v){var T,O=16;for(T=0;16>T;++T)O+=m[v-1+32*T]+m[v+T-32];Ns(O>>5,m,v)}function rs(m,v){var T,O=8;for(T=0;16>T;++T)O+=m[v-1+32*T];Ns(O>>4,m,v)}function ql(m,v){var T,O=8;for(T=0;16>T;++T)O+=m[v+T-32];Ns(O>>4,m,v)}function Oo(m,v){Ns(128,m,v)}function pn(m,v,T){return m+2*v+T+2>>2}function qc(m,v){var T,O=v-32;for(O=new Uint8Array([pn(m[O-1],m[O+0],m[O+1]),pn(m[O+0],m[O+1],m[O+2]),pn(m[O+1],m[O+2],m[O+3]),pn(m[O+2],m[O+3],m[O+4])]),T=0;4>T;++T)r(m,v+32*T,O,0,O.length)}function gc(m,v){var T=m[v-1],O=m[v-1+32],U=m[v-1+64],W=m[v-1+96];ke(m,v+0,16843009*pn(m[v-1-32],T,O)),ke(m,v+32,16843009*pn(T,O,U)),ke(m,v+64,16843009*pn(O,U,W)),ke(m,v+96,16843009*pn(U,W,W))}function yc(m,v){var T,O=4;for(T=0;4>T;++T)O+=m[v+T-32]+m[v-1+32*T];for(O>>=3,T=0;4>T;++T)i(m,v+32*T,O,4)}function mr(m,v){var T=m[v-1+0],O=m[v-1+32],U=m[v-1+64],W=m[v-1-32],X=m[v+0-32],ot=m[v+1-32],at=m[v+2-32],yt=m[v+3-32];m[v+0+96]=pn(O,U,m[v-1+96]),m[v+1+96]=m[v+0+64]=pn(T,O,U),m[v+2+96]=m[v+1+64]=m[v+0+32]=pn(W,T,O),m[v+3+96]=m[v+2+64]=m[v+1+32]=m[v+0+0]=pn(X,W,T),m[v+3+64]=m[v+2+32]=m[v+1+0]=pn(ot,X,W),m[v+3+32]=m[v+2+0]=pn(at,ot,X),m[v+3+0]=pn(yt,at,ot)}function is(m,v){var T=m[v+1-32],O=m[v+2-32],U=m[v+3-32],W=m[v+4-32],X=m[v+5-32],ot=m[v+6-32],at=m[v+7-32];m[v+0+0]=pn(m[v+0-32],T,O),m[v+1+0]=m[v+0+32]=pn(T,O,U),m[v+2+0]=m[v+1+32]=m[v+0+64]=pn(O,U,W),m[v+3+0]=m[v+2+32]=m[v+1+64]=m[v+0+96]=pn(U,W,X),m[v+3+32]=m[v+2+64]=m[v+1+96]=pn(W,X,ot),m[v+3+64]=m[v+2+96]=pn(X,ot,at),m[v+3+96]=pn(ot,at,at)}function Yo(m,v){var T=m[v-1+0],O=m[v-1+32],U=m[v-1+64],W=m[v-1-32],X=m[v+0-32],ot=m[v+1-32],at=m[v+2-32],yt=m[v+3-32];m[v+0+0]=m[v+1+64]=W+X+1>>1,m[v+1+0]=m[v+2+64]=X+ot+1>>1,m[v+2+0]=m[v+3+64]=ot+at+1>>1,m[v+3+0]=at+yt+1>>1,m[v+0+96]=pn(U,O,T),m[v+0+64]=pn(O,T,W),m[v+0+32]=m[v+1+96]=pn(T,W,X),m[v+1+32]=m[v+2+96]=pn(W,X,ot),m[v+2+32]=m[v+3+96]=pn(X,ot,at),m[v+3+32]=pn(ot,at,yt)}function yo(m,v){var T=m[v+0-32],O=m[v+1-32],U=m[v+2-32],W=m[v+3-32],X=m[v+4-32],ot=m[v+5-32],at=m[v+6-32],yt=m[v+7-32];m[v+0+0]=T+O+1>>1,m[v+1+0]=m[v+0+64]=O+U+1>>1,m[v+2+0]=m[v+1+64]=U+W+1>>1,m[v+3+0]=m[v+2+64]=W+X+1>>1,m[v+0+32]=pn(T,O,U),m[v+1+32]=m[v+0+96]=pn(O,U,W),m[v+2+32]=m[v+1+96]=pn(U,W,X),m[v+3+32]=m[v+2+96]=pn(W,X,ot),m[v+3+64]=pn(X,ot,at),m[v+3+96]=pn(ot,at,yt)}function ss(m,v){var T=m[v-1+0],O=m[v-1+32],U=m[v-1+64],W=m[v-1+96];m[v+0+0]=T+O+1>>1,m[v+2+0]=m[v+0+32]=O+U+1>>1,m[v+2+32]=m[v+0+64]=U+W+1>>1,m[v+1+0]=pn(T,O,U),m[v+3+0]=m[v+1+32]=pn(O,U,W),m[v+3+32]=m[v+1+64]=pn(U,W,W),m[v+3+64]=m[v+2+64]=m[v+0+96]=m[v+1+96]=m[v+2+96]=m[v+3+96]=W}function ba(m,v){var T=m[v-1+0],O=m[v-1+32],U=m[v-1+64],W=m[v-1+96],X=m[v-1-32],ot=m[v+0-32],at=m[v+1-32],yt=m[v+2-32];m[v+0+0]=m[v+2+32]=T+X+1>>1,m[v+0+32]=m[v+2+64]=O+T+1>>1,m[v+0+64]=m[v+2+96]=U+O+1>>1,m[v+0+96]=W+U+1>>1,m[v+3+0]=pn(ot,at,yt),m[v+2+0]=pn(X,ot,at),m[v+1+0]=m[v+3+32]=pn(T,X,ot),m[v+1+32]=m[v+3+64]=pn(O,T,X),m[v+1+64]=m[v+3+96]=pn(U,O,T),m[v+1+96]=pn(W,U,O)}function Vo(m,v){var T;for(T=0;8>T;++T)r(m,v+32*T,m,v-32,8)}function za(m,v){var T;for(T=0;8>T;++T)i(m,v,m[v-1],8),v+=32}function bo(m,v,T){var O;for(O=0;8>O;++O)i(v,T+32*O,m,8)}function Ba(m,v){var T,O=8;for(T=0;8>T;++T)O+=m[v+T-32]+m[v-1+32*T];bo(O>>4,m,v)}function Qs(m,v){var T,O=4;for(T=0;8>T;++T)O+=m[v+T-32];bo(O>>3,m,v)}function Hi(m,v){var T,O=4;for(T=0;8>T;++T)O+=m[v-1+32*T];bo(O>>3,m,v)}function Po(m,v){bo(128,m,v)}function as(m,v,T){var O=m[v-T],U=m[v+0],W=3*(U-O)+Ma[1020+m[v-2*T]-m[v+T]],X=kc[112+(W+4>>3)];m[v-T]=oo[255+O+kc[112+(W+3>>3)]],m[v+0]=oo[255+U-X]}function _s(m,v,T,O){var U=m[v+0],W=m[v+T];return Xi[255+m[v-2*T]-m[v-T]]>O||Xi[255+W-U]>O}function ta(m,v,T,O){return 4*Xi[255+m[v-T]-m[v+0]]+Xi[255+m[v-2*T]-m[v+T]]<=O}function xa(m,v,T,O,U){var W=m[v-3*T],X=m[v-2*T],ot=m[v-T],at=m[v+0],yt=m[v+T],Et=m[v+2*T],Vt=m[v+3*T];return 4*Xi[255+ot-at]+Xi[255+X-yt]>O?0:Xi[255+m[v-4*T]-W]<=U&&Xi[255+W-X]<=U&&Xi[255+X-ot]<=U&&Xi[255+Vt-Et]<=U&&Xi[255+Et-yt]<=U&&Xi[255+yt-at]<=U}function ea(m,v,T,O){var U=2*O+1;for(O=0;16>O;++O)ta(m,v+O,T,U)&&as(m,v+O,T)}function Ds(m,v,T,O){var U=2*O+1;for(O=0;16>O;++O)ta(m,v+O*T,1,U)&&as(m,v+O*T,1)}function Ls(m,v,T,O){var U;for(U=3;0<U;--U)ea(m,v+=4*T,T,O)}function cl(m,v,T,O){var U;for(U=3;0<U;--U)Ds(m,v+=4,T,O)}function Rs(m,v,T,O,U,W,X,ot){for(W=2*W+1;0<U--;){if(xa(m,v,T,W,X))if(_s(m,v,T,ot))as(m,v,T);else{var at=m,yt=v,Et=T,Vt=at[yt-2*Et],mt=at[yt-Et],Pt=at[yt+0],Ht=at[yt+Et],oe=at[yt+2*Et],$t=27*(se=Ma[1020+3*(Pt-mt)+Ma[1020+Vt-Ht]])+63>>7,ne=18*se+63>>7,se=9*se+63>>7;at[yt-3*Et]=oo[255+at[yt-3*Et]+se],at[yt-2*Et]=oo[255+Vt+ne],at[yt-Et]=oo[255+mt+$t],at[yt+0]=oo[255+Pt-$t],at[yt+Et]=oo[255+Ht-ne],at[yt+2*Et]=oo[255+oe-se]}v+=O}}function Os(m,v,T,O,U,W,X,ot){for(W=2*W+1;0<U--;){if(xa(m,v,T,W,X))if(_s(m,v,T,ot))as(m,v,T);else{var at=m,yt=v,Et=T,Vt=at[yt-Et],mt=at[yt+0],Pt=at[yt+Et],Ht=kc[112+(4+(oe=3*(mt-Vt))>>3)],oe=kc[112+(oe+3>>3)],$t=Ht+1>>1;at[yt-2*Et]=oo[255+at[yt-2*Et]+$t],at[yt-Et]=oo[255+Vt+oe],at[yt+0]=oo[255+mt-Ht],at[yt+Et]=oo[255+Pt-$t]}v+=O}}function $l(m,v,T,O,U,W){Rs(m,v,T,1,16,O,U,W)}function va(m,v,T,O,U,W){Rs(m,v,1,T,16,O,U,W)}function Yl(m,v,T,O,U,W){var X;for(X=3;0<X;--X)Os(m,v+=4*T,T,1,16,O,U,W)}function wa(m,v,T,O,U,W){var X;for(X=3;0<X;--X)Os(m,v+=4,1,T,16,O,U,W)}function Vl(m,v,T,O,U,W,X,ot){Rs(m,v,U,1,8,W,X,ot),Rs(T,O,U,1,8,W,X,ot)}function A(m,v,T,O,U,W,X,ot){Rs(m,v,1,U,8,W,X,ot),Rs(T,O,1,U,8,W,X,ot)}function F(m,v,T,O,U,W,X,ot){Os(m,v+4*U,U,1,8,W,X,ot),Os(T,O+4*U,U,1,8,W,X,ot)}function dt(m,v,T,O,U,W,X,ot){Os(m,v+4,1,U,8,W,X,ot),Os(T,O+4,1,U,8,W,X,ot)}function Nt(){this.ba=new ye,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new ve,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function Bt(){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 ie(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function ge(){this.ua=0,this.Wa=new Cn,this.vb=new Cn,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new _t,this.yc=new G}function Ge(){this.xb=this.a=0,this.l=new ga,this.ca=new ye,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new Q,this.Pb=0,this.wd=new Q,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new ge,this.ab=0,this.gc=l(4,ie),this.Oc=0}function rn(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new ga,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function jn(m,v,T,O,U,W,X){for(m=m==null?0:m[v+0],v=0;v<X;++v)U[W+v]=m+T[O+v]&255,m=U[W+v]}function On(m,v,T,O,U,W,X){var ot;if(m==null)jn(null,null,T,O,U,W,X);else for(ot=0;ot<X;++ot)U[W+ot]=m[v+ot]+T[O+ot]&255}function cr(m,v,T,O,U,W,X){if(m==null)jn(null,null,T,O,U,W,X);else{var ot,at=m[v+0],yt=at,Et=at;for(ot=0;ot<X;++ot)yt=Et+(at=m[v+ot])-yt,Et=T[O+ot]+(-256&yt?0>yt?0:255:yt)&255,yt=at,U[W+ot]=Et}}function Di(m,v,T,O){var U=v.width,W=v.o;if(t(m!=null&&v!=null),0>T||0>=O||T+O>W)return null;if(!m.Cc){if(m.ga==null){var X;if(m.ga=new rn,(X=m.ga==null)||(X=v.width*v.o,t(m.Gb.length==0),m.Gb=s(X),m.Uc=0,m.Gb==null?X=0:(m.mb=m.Gb,m.nb=m.Uc,m.rc=null,X=1),X=!X),!X){X=m.ga;var ot=m.Fa,at=m.P,yt=m.qc,Et=m.mb,Vt=m.nb,mt=at+1,Pt=yt-1,Ht=X.l;if(t(ot!=null&&Et!=null&&v!=null),Wa[0]=null,Wa[1]=jn,Wa[2]=On,Wa[3]=cr,X.ca=Et,X.tb=Vt,X.c=v.width,X.i=v.height,t(0<X.c&&0<X.i),1>=yt)v=0;else if(X.$a=3&ot[at+0],X.Z=ot[at+0]>>2&3,X.Lc=ot[at+0]>>4&3,at=ot[at+0]>>6&3,0>X.$a||1<X.$a||4<=X.Z||1<X.Lc||at)v=0;else if(Ht.put=Ze,Ht.ac=Bo,Ht.bc=ts,Ht.ma=X,Ht.width=v.width,Ht.height=v.height,Ht.Da=v.Da,Ht.v=v.v,Ht.va=v.va,Ht.j=v.j,Ht.o=v.o,X.$a)t:{t(X.$a==1),v=Fl();e:for(;;){if(v==null){v=0;break t}if(t(X!=null),X.mc=v,v.c=X.c,v.i=X.i,v.l=X.l,v.l.ma=X,v.l.width=X.c,v.l.height=X.i,v.a=0,It(v.m,ot,mt,Pt),!Ks(X.c,X.i,1,v,null)||(v.ab==1&&v.gc[0].hc==3&&pr(v.s)?(X.ic=1,ot=v.c*v.i,v.Ta=null,v.Ua=0,v.V=s(ot),v.Ba=0,v.V==null?(v.a=1,v=0):v=1):(X.ic=0,v=es(v,X.c)),!v))break e;v=1;break t}X.mc=null,v=0}else v=Pt>=X.c*X.i;X=!v}if(X)return null;m.ga.Lc!=1?m.Ga=0:O=W-T}t(m.ga!=null),t(T+O<=W);t:{if(v=(ot=m.ga).c,W=ot.l.o,ot.$a==0){if(mt=m.rc,Pt=m.Vc,Ht=m.Fa,at=m.P+1+T*v,yt=m.mb,Et=m.nb+T*v,t(at<=m.P+m.qc),ot.Z!=0)for(t(Wa[ot.Z]!=null),X=0;X<O;++X)Wa[ot.Z](mt,Pt,Ht,at,yt,Et,v),mt=yt,Pt=Et,Et+=v,at+=v;else for(X=0;X<O;++X)r(yt,Et,Ht,at,v),mt=yt,Pt=Et,Et+=v,at+=v;m.rc=mt,m.Vc=Pt}else{if(t(ot.mc!=null),v=T+O,t((X=ot.mc)!=null),t(v<=X.i),X.C>=v)v=1;else if(ot.ic||ei(),ot.ic){ot=X.V,mt=X.Ba,Pt=X.c;var oe=X.i,$t=(Ht=1,at=X.$/Pt,yt=X.$%Pt,Et=X.m,Vt=X.s,X.$),ne=Pt*oe,se=Pt*v,Se=Vt.wc,he=$t<se?_i(Vt,yt,at):null;t($t<=ne),t(v<=oe),t(pr(Vt));e:for(;;){for(;!Et.h&&$t<se;){if(yt&Se||(he=_i(Vt,yt,at)),t(he!=null),At(Et),256>(oe=Tn(he.G[0],he.H[0],Et)))ot[mt+$t]=oe,++$t,++yt>=Pt&&(yt=0,++at<=v&&!(at%16)&&no(X,at));else{if(!(280>oe)){Ht=0;break e}oe=Ur(oe-256,Et);var en,Ye=Tn(he.G[4],he.H[4],Et);if(At(Et),!($t>=(Ye=Ni(Pt,Ye=Ur(Ye,Et)))&&ne-$t>=oe)){Ht=0;break e}for(en=0;en<oe;++en)ot[mt+$t+en]=ot[mt+$t+en-Ye];for($t+=oe,yt+=oe;yt>=Pt;)yt-=Pt,++at<=v&&!(at%16)&&no(X,at);$t<se&&yt&Se&&(he=_i(Vt,yt,at))}t(Et.h==pt(Et))}no(X,at>v?v:at);break e}!Ht||Et.h&&$t<ne?(Ht=0,X.a=Et.h?5:3):X.$=$t,v=Ht}else v=Hr(X,X.V,X.Ba,X.c,X.i,v,pa);if(!v){O=0;break t}}T+O>=W&&(m.Cc=1),O=1}if(!O)return null;if(m.Cc&&((O=m.ga)!=null&&(O.mc=null),m.ga=null,0<m.Ga))return alert("todo:WebPDequantizeLevels"),null}return m.nb+T*U}function pi(m,v,T,O,U,W){for(;0<U--;){var X,ot=m,at=v+(T?1:0),yt=m,Et=v+(T?0:3);for(X=0;X<O;++X){var Vt=yt[Et+4*X];Vt!=255&&(Vt*=32897,ot[at+4*X+0]=ot[at+4*X+0]*Vt>>23,ot[at+4*X+1]=ot[at+4*X+1]*Vt>>23,ot[at+4*X+2]=ot[at+4*X+2]*Vt>>23)}v+=W}}function Er(m,v,T,O,U){for(;0<O--;){var W;for(W=0;W<T;++W){var X=m[v+2*W+0],ot=15&(yt=m[v+2*W+1]),at=4369*ot,yt=(240&yt|yt>>4)*at>>16;m[v+2*W+0]=(240&X|X>>4)*at>>16&240|(15&X|X<<4)*at>>16>>4&15,m[v+2*W+1]=240&yt|ot}v+=U}}function Li(m,v,T,O,U,W,X,ot){var at,yt,Et=255;for(yt=0;yt<U;++yt){for(at=0;at<O;++at){var Vt=m[v+at];W[X+4*at]=Vt,Et&=Vt}v+=T,X+=ot}return Et!=255}function ce(m,v,T,O,U){var W;for(W=0;W<U;++W)T[O+W]=m[v+W]>>8}function ei(){Zl=pi,hs=Er,$c=Li,Xo=ce}function Ri(m,v,T){it[m]=function(O,U,W,X,ot,at,yt,Et,Vt,mt,Pt,Ht,oe,$t,ne,se,Se){var he,en=Se-1>>1,Ye=ot[at+0]|yt[Et+0]<<16,Nn=Vt[mt+0]|Pt[Ht+0]<<16;t(O!=null);var Ke=3*Ye+Nn+131074>>2;for(v(O[U+0],255&Ke,Ke>>16,oe,$t),W!=null&&(Ke=3*Nn+Ye+131074>>2,v(W[X+0],255&Ke,Ke>>16,ne,se)),he=1;he<=en;++he){var Xn=ot[at+he]|yt[Et+he]<<16,zr=Vt[mt+he]|Pt[Ht+he]<<16,zn=Ye+Xn+Nn+zr+524296,qe=zn+2*(Xn+Nn)>>3;Ke=qe+Ye>>1,Ye=(zn=zn+2*(Ye+zr)>>3)+Xn>>1,v(O[U+2*he-1],255&Ke,Ke>>16,oe,$t+(2*he-1)*T),v(O[U+2*he-0],255&Ye,Ye>>16,oe,$t+(2*he-0)*T),W!=null&&(Ke=zn+Nn>>1,Ye=qe+zr>>1,v(W[X+2*he-1],255&Ke,Ke>>16,ne,se+(2*he-1)*T),v(W[X+2*he+0],255&Ye,Ye>>16,ne,se+(2*he+0)*T)),Ye=Xn,Nn=zr}1&Se||(Ke=3*Ye+Nn+131074>>2,v(O[U+Se-1],255&Ke,Ke>>16,oe,$t+(Se-1)*T),W!=null&&(Ke=3*Nn+Ye+131074>>2,v(W[X+Se-1],255&Ke,Ke>>16,ne,se+(Se-1)*T)))}}function Sn(){Pi[Wc]=Bs,Pi[so]=kl,Pi[Xc]=Zc,Pi[ps]=Al,Pi[Gc]=Xa,Pi[Ql]=ia,Pi[$a]=Ca,Pi[Ac]=kl,Pi[Ya]=Al,Pi[tc]=Xa,Pi[Kc]=ia}function Dn(m){return m&-16384?0>m?0:255:m>>Ec}function Fa(m,v){return Dn((19077*m>>8)+(26149*v>>8)-14234)}function ls(m,v,T){return Dn((19077*m>>8)-(6419*v>>8)-(13320*T>>8)+8708)}function ul(m,v){return Dn((19077*m>>8)+(33050*v>>8)-17685)}function wr(m,v,T,O,U){O[U+0]=Fa(m,T),O[U+1]=ls(m,v,T),O[U+2]=ul(m,v)}function Ps(m,v,T,O,U){O[U+0]=ul(m,v),O[U+1]=ls(m,v,T),O[U+2]=Fa(m,T)}function Wl(m,v,T,O,U){var W=ls(m,v,T);v=W<<3&224|ul(m,v)>>3,O[U+0]=248&Fa(m,T)|W>>5,O[U+1]=v}function Oi(m,v,T,O,U){var W=240&ul(m,v)|15;O[U+0]=240&Fa(m,T)|ls(m,v,T)>>4,O[U+1]=W}function fl(m,v,T,O,U){O[U+0]=255,wr(m,v,T,O,U+1)}function Wo(m,v,T,O,U){Ps(m,v,T,O,U),O[U+3]=255}function bc(m,v,T,O,U){wr(m,v,T,O,U),O[U+3]=255}function cs(m,v,T){it[m]=function(O,U,W,X,ot,at,yt,Et,Vt){for(var mt=Et+(-2&Vt)*T;Et!=mt;)v(O[U+0],W[X+0],ot[at+0],yt,Et),v(O[U+1],W[X+0],ot[at+0],yt,Et+T),U+=2,++X,++at,Et+=2*T;1&Vt&&v(O[U+0],W[X+0],ot[at+0],yt,Et)}}function xo(m,v,T){return T==0?m==0?v==0?6:5:v==0?4:0:T}function xc(m,v,T,O,U){switch(m>>>30){case 3:js(v,T,O,U,0);break;case 2:ds(v,T,O,U);break;case 1:Wi(v,T,O,U)}}function dl(m,v){var T,O,U=v.M,W=v.Nb,X=m.oc,ot=m.pc+40,at=m.oc,yt=m.pc+584,Et=m.oc,Vt=m.pc+600;for(T=0;16>T;++T)X[ot+32*T-1]=129;for(T=0;8>T;++T)at[yt+32*T-1]=129,Et[Vt+32*T-1]=129;for(0<U?X[ot-1-32]=at[yt-1-32]=Et[Vt-1-32]=129:(i(X,ot-32-1,127,21),i(at,yt-32-1,127,9),i(Et,Vt-32-1,127,9)),O=0;O<m.za;++O){var mt=v.ya[v.aa+O];if(0<O){for(T=-1;16>T;++T)r(X,ot+32*T-4,X,ot+32*T+12,4);for(T=-1;8>T;++T)r(at,yt+32*T-4,at,yt+32*T+4,4),r(Et,Vt+32*T-4,Et,Vt+32*T+4,4)}var Pt=m.Gd,Ht=m.Hd+O,oe=mt.ad,$t=mt.Hc;if(0<U&&(r(X,ot-32,Pt[Ht].y,0,16),r(at,yt-32,Pt[Ht].f,0,8),r(Et,Vt-32,Pt[Ht].ea,0,8)),mt.Za){var ne=X,se=ot-32+16;for(0<U&&(O>=m.za-1?i(ne,se,Pt[Ht].y[15],4):r(ne,se,Pt[Ht+1].y,0,4)),T=0;4>T;T++)ne[se+128+T]=ne[se+256+T]=ne[se+384+T]=ne[se+0+T];for(T=0;16>T;++T,$t<<=2)ne=X,se=ot+Si[T],ii[mt.Ob[T]](ne,se),xc($t,oe,16*+T,ne,se)}else if(ne=xo(O,U,mt.Ob[0]),Io[ne](X,ot),$t!=0)for(T=0;16>T;++T,$t<<=2)xc($t,oe,16*+T,X,ot+Si[T]);for(T=mt.Gc,ne=xo(O,U,mt.Dd),ra[ne](at,yt),ra[ne](Et,Vt),$t=oe,ne=at,se=yt,255&(mt=0|T)&&(170&mt?yl($t,256,ne,se):wi($t,256,ne,se)),mt=Et,$t=Vt,255&(T>>=8)&&(170&T?yl(oe,320,mt,$t):wi(oe,320,mt,$t)),U<m.Ub-1&&(r(Pt[Ht].y,0,X,ot+480,16),r(Pt[Ht].f,0,at,yt+224,8),r(Pt[Ht].ea,0,Et,Vt+224,8)),T=8*W*m.B,Pt=m.sa,Ht=m.ta+16*O+16*W*m.R,oe=m.qa,mt=m.ra+8*O+T,$t=m.Ha,ne=m.Ia+8*O+T,T=0;16>T;++T)r(Pt,Ht+T*m.R,X,ot+32*T,16);for(T=0;8>T;++T)r(oe,mt+T*m.B,at,yt+32*T,8),r($t,ne+T*m.B,Et,Vt+32*T,8)}}function Ua(m,v,T,O,U,W,X,ot,at){var yt=[0],Et=[0],Vt=0,mt=at!=null?at.kd:0,Pt=at??new Bt;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 Ht=v,oe=T,$t=Pt.gb;if(t(m!=null),t(oe!=null),t($t!=null),$t[0]=0,12<=oe[0]&&!e(m,Ht[0],"RIFF")){if(e(m,Ht[0]+8,"WEBP")){$t=3;break t}var ne=Ve(m,Ht[0]+4);if(12>ne||4294967286<ne){$t=3;break t}if(mt&&ne>oe[0]-8){$t=7;break t}$t[0]=ne,Ht[0]+=12,oe[0]-=12}$t=0}if($t!=0)return $t;for(ne=0<Pt.gb[0],T=T[0];;){t:{var se=m;oe=v,$t=T;var Se=yt,he=Et,en=Ht=[0];if((Ke=Vt=[Vt])[0]=0,8>$t[0])$t=7;else{if(!e(se,oe[0],"VP8X")){if(Ve(se,oe[0]+4)!=10){$t=3;break t}if(18>$t[0]){$t=7;break t}var Ye=Ve(se,oe[0]+8),Nn=1+Ie(se,oe[0]+12);if(2147483648<=Nn*(se=1+Ie(se,oe[0]+15))){$t=3;break t}en!=null&&(en[0]=Ye),Se!=null&&(Se[0]=Nn),he!=null&&(he[0]=se),oe[0]+=18,$t[0]-=18,Ke[0]=1}$t=0}}if(Vt=Vt[0],Ht=Ht[0],$t!=0)return $t;if(oe=!!(2&Ht),!ne&&Vt)return 3;if(W!=null&&(W[0]=!!(16&Ht)),X!=null&&(X[0]=oe),ot!=null&&(ot[0]=0),X=yt[0],Ht=Et[0],Vt&&oe&&at==null){$t=0;break}if(4>T){$t=7;break}if(ne&&Vt||!ne&&!Vt&&!e(m,v[0],"ALPH")){T=[T],Pt.na=[Pt.na],Pt.P=[Pt.P],Pt.Sa=[Pt.Sa];t:{Ye=m,$t=v,ne=T;var Ke=Pt.gb;Se=Pt.na,he=Pt.P,en=Pt.Sa,Nn=22,t(Ye!=null),t(ne!=null),se=$t[0];var Xn=ne[0];for(t(Se!=null),t(en!=null),Se[0]=null,he[0]=null,en[0]=0;;){if($t[0]=se,ne[0]=Xn,8>Xn){$t=7;break t}var zr=Ve(Ye,se+4);if(4294967286<zr){$t=3;break t}var zn=8+zr+1&-2;if(Nn+=zn,0<Ke&&Nn>Ke){$t=3;break t}if(!e(Ye,se,"VP8 ")||!e(Ye,se,"VP8L")){$t=0;break t}if(Xn[0]<zn){$t=7;break t}e(Ye,se,"ALPH")||(Se[0]=Ye,he[0]=se+8,en[0]=zr),se+=zn,Xn-=zn}}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(Ke=m,$t=v,ne=T,Se=Pt.gb[0],he=Pt.Ja,en=Pt.xa,Ye=$t[0],se=!e(Ke,Ye,"VP8 "),Nn=!e(Ke,Ye,"VP8L"),t(Ke!=null),t(ne!=null),t(he!=null),t(en!=null),8>ne[0])$t=7;else{if(se||Nn){if(Ke=Ve(Ke,Ye+4),12<=Se&&Ke>Se-12){$t=3;break t}if(mt&&Ke>ne[0]-8){$t=7;break t}he[0]=Ke,$t[0]+=8,ne[0]-=8,en[0]=Nn}else en[0]=5<=ne[0]&&Ke[Ye+0]==47&&!(Ke[Ye+4]>>5),he[0]=ne[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(ot==null||oe||(ot[0]=Pt.xa?2:1),X=[X],Ht=[Ht],Pt.xa){if(5>T){$t=7;break}ot=X,mt=Ht,oe=W,m==null||5>T?m=0:5<=T&&m[v+0]==47&&!(m[v+4]>>5)?(ne=[0],Ke=[0],Se=[0],It(he=new Q,m,v,T),Yt(he,ne,Ke,Se)?(ot!=null&&(ot[0]=ne[0]),mt!=null&&(mt[0]=Ke[0]),oe!=null&&(oe[0]=Se[0]),m=1):m=0):m=0}else{if(10>T){$t=7;break}ot=Ht,m==null||10>T||!Ho(m,v+3,T-3)?m=0:(mt=m[v+0]|m[v+1]<<8|m[v+2]<<16,oe=16383&(m[v+7]<<8|m[v+6]),m=16383&(m[v+9]<<8|m[v+8]),1&mt||3<(mt>>1&7)||!(mt>>4&1)||mt>>5>=Pt.Ja||!oe||!m?m=0:(X&&(X[0]=oe),ot&&(ot[0]=m),m=1))}if(!m||(X=X[0],Ht=Ht[0],Vt&&(yt[0]!=X||Et[0]!=Ht)))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?(W!=null&&(W[0]|=Pt.na!=null&&0<Pt.na.length),O!=null&&(O[0]=X),U!=null&&(U[0]=Ht),0):$t}function io(m,v,T){var O=v.width,U=v.height,W=0,X=0,ot=O,at=U;if(v.Da=m!=null&&0<m.Da,v.Da&&(ot=m.cd,at=m.bd,W=m.v,X=m.j,11>T||(W&=-2,X&=-2),0>W||0>X||0>=ot||0>=at||W+ot>O||X+at>U))return 0;if(v.v=W,v.j=X,v.va=W+ot,v.o=X+at,v.U=ot,v.T=at,v.da=m!=null&&0<m.da,v.da){if(!cn(ot,at,T=[m.ib],W=[m.hb]))return 0;v.ib=T[0],v.hb=W[0]}return v.ob=m!=null&&m.ob,v.Kb=m==null||!m.Sd,v.da&&(v.ob=v.ib<3*O/4&&v.hb<3*U/4,v.Kb=0),1}function hl(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 na(m,v,T,O){if(O==null||0>=m||0>=v)return 2;if(T!=null){if(T.Da){var U=T.cd,W=T.bd,X=-2&T.v,ot=-2&T.j;if(0>X||0>ot||0>=U||0>=W||X+U>m||ot+W>v)return 2;m=U,v=W}if(T.da){if(!cn(m,v,U=[T.ib],W=[T.hb]))return 2;m=U[0],v=W[0]}}O.width=m,O.height=v;t:{var at=O.width,yt=O.height;if(m=O.S,0>=at||0>=yt||!(m>=Wc&&13>m))m=2;else{if(0>=O.Rd&&O.sd==null){X=W=U=v=0;var Et=(ot=at*El[m])*yt;if(11>m||(W=(yt+1)/2*(v=(at+1)/2),m==12&&(X=(U=at)*yt)),(yt=s(Et+2*W+X))==null){m=1;break t}O.sd=yt,11>m?((at=O.f.RGBA).eb=yt,at.fb=0,at.A=ot,at.size=Et):((at=O.f.kb).y=yt,at.O=0,at.fa=ot,at.Fd=Et,at.f=yt,at.N=0+Et,at.Ab=v,at.Cd=W,at.ea=yt,at.W=0+Et+W,at.Db=v,at.Ed=W,m==12&&(at.F=yt,at.J=0+Et+2*W),at.Tc=X,at.lb=U)}if(v=1,U=O.S,W=O.width,X=O.height,U>=Wc&&13>U)if(11>U)m=O.f.RGBA,v&=(ot=Math.abs(m.A))*(X-1)+W<=m.size,v&=ot>=W*El[U],v&=m.eb!=null;else{m=O.f.kb,ot=(W+1)/2,Et=(X+1)/2,at=Math.abs(m.fa),yt=Math.abs(m.Ab);var Vt=Math.abs(m.Db),mt=Math.abs(m.lb),Pt=mt*(X-1)+W;v&=at*(X-1)+W<=m.Fd,v&=yt*(Et-1)+ot<=m.Cd,v=(v&=Vt*(Et-1)+ot<=m.Ed)&at>=W&yt>=ot&Vt>=ot,v&=m.y!=null,v&=m.f!=null,v&=m.ea!=null,U==12&&(v&=mt>=W,v&=Pt<=m.Tc,v&=m.F!=null)}else v=0;m=v?0:2}}return m!=0||T!=null&&T.fd&&(m=hl(O)),m}var us=64,Ha=[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],qa=24,Vi=32,ni=8,qi=[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"),it.Predictor0=function(){return 4278190080},it.Predictor1=function(m){return m},it.Predictor2=function(m,v,T){return v[T+0]},it.Predictor3=function(m,v,T){return v[T+1]},it.Predictor4=function(m,v,T){return v[T-1]},it.Predictor5=function(m,v,T){return Fe(Fe(m,v[T+1]),v[T+0])},it.Predictor6=function(m,v,T){return Fe(m,v[T-1])},it.Predictor7=function(m,v,T){return Fe(m,v[T+0])},it.Predictor8=function(m,v,T){return Fe(v[T-1],v[T+0])},it.Predictor9=function(m,v,T){return Fe(v[T+0],v[T+1])},it.Predictor10=function(m,v,T){return Fe(Fe(m,v[T-1]),Fe(v[T+0],v[T+1]))},it.Predictor11=function(m,v,T){var O=v[T+0];return 0>=mn(O>>24&255,m>>24&255,(v=v[T-1])>>24&255)+mn(O>>16&255,m>>16&255,v>>16&255)+mn(O>>8&255,m>>8&255,v>>8&255)+mn(255&O,255&m,255&v)?O:m},it.Predictor12=function(m,v,T){var O=v[T+0];return(tn((m>>24&255)+(O>>24&255)-((v=v[T-1])>>24&255))<<24|tn((m>>16&255)+(O>>16&255)-(v>>16&255))<<16|tn((m>>8&255)+(O>>8&255)-(v>>8&255))<<8|tn((255&m)+(255&O)-(255&v)))>>>0},it.Predictor13=function(m,v,T){var O=v[T-1];return(Pn((m=Fe(m,v[T+0]))>>24&255,O>>24&255)<<24|Pn(m>>16&255,O>>16&255)<<16|Pn(m>>8&255,O>>8&255)<<8|Pn(255&m,255&O))>>>0};var Is=it.PredictorAdd0;it.PredictorAdd1=In,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 vo=it.PredictorAdd2;je("ColorIndexInverseTransform","MapARGB","32b",function(m){return m>>8&255},function(m){return m}),je("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",function(m){return m},function(m){return m>>8&255});var pl,ml=it.ColorIndexInverseTransform,mi=it.MapARGB,Me=it.VP8LColorIndexInverseTransformAlpha,ur=it.MapAlpha,wo=it.VP8LPredictorsAdd=[];wo.length=16,(it.VP8LPredictors=[]).length=16,(it.VP8LPredictorsAdd_C=[]).length=16,(it.VP8LPredictors_C=[]).length=16;var Sa,vc,gl,Xl,ka,Gl,fs,js,ds,yl,Wi,wi,ar,Dr,ri,qr,Aa,Kl,bl,Jl,Mf,Cf,_u,Du,Zl,hs,$c,Xo,xl=s(511),Yc=s(2041),wc=s(225),Sc=s(767),Vc=0,Ma=Yc,kc=wc,oo=Sc,Xi=xl,Wc=0,so=1,Xc=2,ps=3,Gc=4,Ql=5,$a=6,Ac=7,Ya=8,tc=9,Kc=10,ms=[2,3,7],ec=[3,3,11],vl=[280,256,256,256,40],wl=[0,1,1,1,0],Mc=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],ao=[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],gs=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],Va=8,ys=[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],bs=[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],Go=null,Ef=[[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]],Lu=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],zs=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],Jc=[[[[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]]]],$r=[[[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]]],Lr=[[[[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]]]],rr=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],Io=[],ii=[],ra=[],Sl=1,Ru=2,Wa=[],Pi=[];Ri("UpsampleRgbLinePair",wr,3),Ri("UpsampleBgrLinePair",Ps,3),Ri("UpsampleRgbaLinePair",bc,4),Ri("UpsampleBgraLinePair",Wo,4),Ri("UpsampleArgbLinePair",fl,4),Ri("UpsampleRgba4444LinePair",Oi,2),Ri("UpsampleRgb565LinePair",Wl,2);var Bs=it.UpsampleRgbLinePair,Zc=it.UpsampleBgrLinePair,kl=it.UpsampleRgbaLinePair,Al=it.UpsampleBgraLinePair,Xa=it.UpsampleArgbLinePair,ia=it.UpsampleRgba4444LinePair,Ca=it.UpsampleRgb565LinePair,xs=16,Cc=1<<xs-1,vs=-227,Ml=482,Ec=6,$i=0,Yi=s(256),Qc=s(256),md=s(256),Ou=s(256),Tf=s(Ml-vs),Nf=s(Ml-vs);cs("YuvToRgbRow",wr,3),cs("YuvToBgrRow",Ps,3),cs("YuvToRgbaRow",bc,4),cs("YuvToBgraRow",Wo,4),cs("YuvToArgbRow",fl,4),cs("YuvToRgba4444Row",Oi,2),cs("YuvToRgb565Row",Wl,2);var Si=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],oa=[0,2,8],Tc=[8,7,6,4,4,2,2,2,1,1,1,1],Cl=1;this.WebPDecodeRGBA=function(m,v,T,O,U){var W=so,X=new Nt,ot=new ye;X.ba=ot,ot.S=W,ot.width=[ot.width],ot.height=[ot.height];var at=ot.width,yt=ot.height,Et=new Ce;if(Et==null||m==null)var Vt=2;else t(Et!=null),Vt=Ua(m,v,T,Et.width,Et.height,Et.Pd,Et.Qd,Et.format,null);if(Vt!=0?at=0:(at!=null&&(at[0]=Et.width[0]),yt!=null&&(yt[0]=Et.height[0]),at=1),at){ot.width=ot.width[0],ot.height=ot.height[0],O!=null&&(O[0]=ot.width),U!=null&&(U[0]=ot.height);t:{if(O=new ga,(U=new Bt).data=m,U.w=v,U.ha=T,U.kd=1,v=[0],t(U!=null),((m=Ua(U.data,U.w,U.ha,null,null,null,v,null,U))==0||m==7)&&v[0]&&(m=4),(v=m)==0){if(t(X!=null),O.data=U.data,O.w=U.w+U.offset,O.ha=U.ha-U.offset,O.put=Ze,O.ac=Bo,O.bc=ts,O.ma=X,U.xa){if((m=Fl())==null){X=1;break t}if((function(mt,Pt){var Ht=[0],oe=[0],$t=[0];e:for(;;){if(mt==null)return 0;if(Pt==null)return mt.a=2,0;if(mt.l=Pt,mt.a=0,It(mt.m,Pt.data,Pt.w,Pt.ha),!Yt(mt.m,Ht,oe,$t)){mt.a=3;break e}if(mt.xb=Ru,Pt.width=Ht[0],Pt.height=oe[0],!Ks(Ht[0],oe[0],1,mt,null))break e;return 1}return t(mt.a!=0),0})(m,O)){if(O=(v=na(O.width,O.height,X.Oa,X.ba))==0){e:{O=m;n:for(;;){if(O==null){O=0;break e}if(t(O.s.yc!=null),t(O.s.Ya!=null),t(0<O.s.Wb),t((T=O.l)!=null),t((U=T.ma)!=null),O.xb!=0){if(O.ca=U.ba,O.tb=U.tb,t(O.ca!=null),!io(U.Oa,T,ps)){O.a=2;break n}if(!es(O,T.width)||T.da)break n;if((T.da||gn(O.ca.S))&&ei(),11>O.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),O.ca.f.kb.F!=null&&ei()),O.Pb&&0<O.s.ua&&O.s.vb.X==null&&!rt(O.s.vb,O.s.Wa.Xa)){O.a=1;break n}O.xb=0}if(!Hr(O,O.V,O.Ba,O.c,O.i,T.o,go))break n;U.Dc=O.Ma,O=1;break e}t(O.a!=0),O=0}O=!O}O&&(v=m.a)}else v=m.a}else{if((m=new Lo)==null){X=1;break t}if(m.Fa=U.na,m.P=U.P,m.qc=U.Sa,vi(m,O)){if((v=na(O.width,O.height,X.Oa,X.ba))==0){if(m.Aa=0,T=X.Oa,t((U=m)!=null),T!=null){if(0<(at=0>(at=T.Md)?0:100<at?255:255*at/100)){for(yt=Et=0;4>yt;++yt)12>(Vt=U.pb[yt]).lc&&(Vt.ia=at*Tc[0>Vt.lc?0:Vt.lc]>>3),Et|=Vt.ia;Et&&(alert("todo:VP8InitRandom"),U.ia=1)}U.Ga=T.Id,100<U.Ga?U.Ga=100:0>U.Ga&&(U.Ga=0)}(function(mt,Pt){if(mt==null)return 0;if(Pt==null)return Fn(mt,2,"NULL VP8Io parameter in VP8Decode().");if(!mt.cb&&!vi(mt,Pt))return 0;if(t(mt.cb),Pt.ac==null||Pt.ac(Pt)){Pt.ob&&(mt.L=0);var Ht=oa[mt.L];if(mt.L==2?(mt.yb=0,mt.zb=0):(mt.yb=Pt.v-Ht>>4,mt.zb=Pt.j-Ht>>4,0>mt.yb&&(mt.yb=0),0>mt.zb&&(mt.zb=0)),mt.Va=Pt.o+15+Ht>>4,mt.Hb=Pt.va+15+Ht>>4,mt.Hb>mt.za&&(mt.Hb=mt.za),mt.Va>mt.Ub&&(mt.Va=mt.Ub),0<mt.L){var oe=mt.ed;for(Ht=0;4>Ht;++Ht){var $t;if(mt.Qa.Cb){var ne=mt.Qa.Lb[Ht];mt.Qa.Fb||(ne+=oe.Tb)}else ne=oe.Tb;for($t=0;1>=$t;++$t){var se=mt.gd[Ht][$t],Se=ne;if(oe.Pc&&(Se+=oe.vd[0],$t&&(Se+=oe.od[0])),0<(Se=0>Se?0:63<Se?63:Se)){var he=Se;0<oe.wb&&(he=4<oe.wb?he>>2:he>>1)>9-oe.wb&&(he=9-oe.wb),1>he&&(he=1),se.dd=he,se.tc=2*Se+he,se.ld=40<=Se?2:15<=Se?1:0}else se.tc=0;se.La=$t}}}Ht=0}else Fn(mt,6,"Frame setup failed"),Ht=mt.a;if(Ht=Ht==0){if(Ht){mt.$c=0,0<mt.Aa||(mt.Ic=Cl);e:{Ht=mt.Ic,oe=4*(he=mt.za);var en=32*he,Ye=he+1,Nn=0<mt.L?he*(0<mt.Aa?2:1):0,Ke=(mt.Aa==2?2:1)*he;if((se=oe+832+($t=3*(16*Ht+oa[mt.L])/2*en)+(ne=mt.Fa!=null&&0<mt.Fa.length?mt.Kc.c*mt.Kc.i:0))!=se)Ht=0;else{if(se>mt.Vb){if(mt.Vb=0,mt.Ec=s(se),mt.Fc=0,mt.Ec==null){Ht=Fn(mt,1,"no memory during frame initialization.");break e}mt.Vb=se}se=mt.Ec,Se=mt.Fc,mt.Ac=se,mt.Bc=Se,Se+=oe,mt.Gd=l(en,Ul),mt.Hd=0,mt.rb=l(Ye+1,Uo),mt.sb=1,mt.wa=Nn?l(Nn,Fo):null,mt.Y=0,mt.D.Nb=0,mt.D.wa=mt.wa,mt.D.Y=mt.Y,0<mt.Aa&&(mt.D.Y+=he),t(!0),mt.oc=se,mt.pc=Se,Se+=832,mt.ya=l(Ke,Do),mt.aa=0,mt.D.ya=mt.ya,mt.D.aa=mt.aa,mt.Aa==2&&(mt.D.aa+=he),mt.R=16*he,mt.B=8*he,he=(en=oa[mt.L])*mt.R,en=en/2*mt.B,mt.sa=se,mt.ta=Se+he,mt.qa=mt.sa,mt.ra=mt.ta+16*Ht*mt.R+en,mt.Ha=mt.qa,mt.Ia=mt.ra+8*Ht*mt.B+en,mt.$c=0,Se+=$t,mt.mb=ne?se:null,mt.nb=ne?Se:null,t(Se+ne<=mt.Fc+mt.Vb),_r(mt),i(mt.Ac,mt.Bc,0,oe),Ht=1}}if(Ht){if(Pt.ka=0,Pt.y=mt.sa,Pt.O=mt.ta,Pt.f=mt.qa,Pt.N=mt.ra,Pt.ea=mt.Ha,Pt.Vd=mt.Ia,Pt.fa=mt.R,Pt.Rc=mt.B,Pt.F=null,Pt.J=0,!Vc){for(Ht=-255;255>=Ht;++Ht)xl[255+Ht]=0>Ht?-Ht:Ht;for(Ht=-1020;1020>=Ht;++Ht)Yc[1020+Ht]=-128>Ht?-128:127<Ht?127:Ht;for(Ht=-112;112>=Ht;++Ht)wc[112+Ht]=-16>Ht?-16:15<Ht?15:Ht;for(Ht=-255;510>=Ht;++Ht)Sc[255+Ht]=0>Ht?0:255<Ht?255:Ht;Vc=1}fs=$o,js=ll,yl=qo,Wi=te,wi=Zs,ds=ya,ar=$l,Dr=va,ri=Vl,qr=A,Aa=Yl,Kl=wa,bl=F,Jl=dt,Mf=ea,Cf=Ds,_u=Ls,Du=cl,ii[0]=yc,ii[1]=Ts,ii[2]=qc,ii[3]=gc,ii[4]=mr,ii[5]=Yo,ii[6]=is,ii[7]=yo,ii[8]=ba,ii[9]=ss,Io[0]=Ro,Io[1]=Hc,Io[2]=Af,Io[3]=Nu,Io[4]=rs,Io[5]=ql,Io[6]=Oo,ra[0]=Ba,ra[1]=Hl,ra[2]=Vo,ra[3]=za,ra[4]=Hi,ra[5]=Qs,ra[6]=Po,Ht=1}else Ht=0}Ht&&(Ht=(function(Xn,zr){for(Xn.M=0;Xn.M<Xn.Va;++Xn.M){var zn,qe=Xn.Jc[Xn.M&Xn.Xb],Pe=Xn.m,oi=Xn;for(zn=0;zn<oi.za;++zn){var xn=Pe,qn=oi,Tr=qn.Ac,Ii=qn.Bc+4*zn,lo=qn.zc,Nr=qn.ya[qn.aa+zn];if(qn.Qa.Bb?Nr.$b=Jt(xn,qn.Pa.jb[0])?2+Jt(xn,qn.Pa.jb[2]):Jt(xn,qn.Pa.jb[1]):Nr.$b=0,qn.kc&&(Nr.Ad=Jt(xn,qn.Bd)),Nr.Za=!Jt(xn,145)+0,Nr.Za){var ji=Nr.Ob,So=0;for(qn=0;4>qn;++qn){var gi,Kn=lo[0+qn];for(gi=0;4>gi;++gi){Kn=$r[Tr[Ii+gi]][Kn];for(var ir=zs[Jt(xn,Kn[0])];0<ir;)ir=zs[2*ir+Jt(xn,Kn[ir])];Kn=-ir,Tr[Ii+gi]=Kn}r(ji,So,Tr,Ii,4),So+=4,lo[0+qn]=Kn}}else Kn=Jt(xn,156)?Jt(xn,128)?1:3:Jt(xn,163)?2:0,Nr.Ob[0]=Kn,i(Tr,Ii,Kn,4),i(lo,0,Kn,4);Nr.Dd=Jt(xn,142)?Jt(xn,114)?Jt(xn,183)?1:3:2:0}if(oi.m.Ka)return Fn(Xn,7,"Premature end-of-partition0 encountered.");for(;Xn.ja<Xn.za;++Xn.ja){if(oi=qe,xn=(Pe=Xn).rb[Pe.sb-1],Tr=Pe.rb[Pe.sb+Pe.ja],zn=Pe.ya[Pe.aa+Pe.ja],Ii=Pe.kc?zn.Ad:0)xn.la=Tr.la=0,zn.Za||(xn.Na=Tr.Na=0),zn.Hc=0,zn.Gc=0,zn.ia=0;else{var Br,lr;if(xn=Tr,Tr=oi,Ii=Pe.Pa.Xc,lo=Pe.ya[Pe.aa+Pe.ja],Nr=Pe.pb[lo.$b],qn=lo.ad,ji=0,So=Pe.rb[Pe.sb-1],Kn=gi=0,i(qn,ji,0,384),lo.Za)var si=0,Un=Ii[3];else{ir=s(16);var Qn=xn.Na+So.Na;if(Qn=Go(Tr,Ii[1],Qn,Nr.Eb,0,ir,0),xn.Na=So.Na=(0<Qn)+0,1<Qn)fs(ir,0,qn,ji);else{var Yr=ir[0]+3>>3;for(ir=0;256>ir;ir+=16)qn[ji+ir]=Yr}si=1,Un=Ii[0]}var w=15&xn.la,S=15&So.la;for(ir=0;4>ir;++ir){var D=1&S;for(Yr=lr=0;4>Yr;++Yr)w=w>>1|(D=(Qn=Go(Tr,Un,Qn=D+(1&w),Nr.Sc,si,qn,ji))>si)<<7,lr=lr<<2|(3<Qn?3:1<Qn?2:qn[ji+0]!=0),ji+=16;w>>=4,S=S>>1|D<<7,gi=(gi<<8|lr)>>>0}for(Un=w,si=S>>4,Br=0;4>Br;Br+=2){for(lr=0,w=xn.la>>4+Br,S=So.la>>4+Br,ir=0;2>ir;++ir){for(D=1&S,Yr=0;2>Yr;++Yr)Qn=D+(1&w),w=w>>1|(D=0<(Qn=Go(Tr,Ii[2],Qn,Nr.Qc,0,qn,ji)))<<3,lr=lr<<2|(3<Qn?3:1<Qn?2:qn[ji+0]!=0),ji+=16;w>>=2,S=S>>1|D<<5}Kn|=lr<<4*Br,Un|=w<<4<<Br,si|=(240&S)<<Br}xn.la=Un,So.la=si,lo.Hc=gi,lo.Gc=Kn,lo.ia=43690&Kn?0:Nr.ia,Ii=!(gi|Kn)}if(0<Pe.L&&(Pe.wa[Pe.Y+Pe.ja]=Pe.gd[zn.$b][zn.Za],Pe.wa[Pe.Y+Pe.ja].La|=!Ii),oi.Ka)return Fn(Xn,7,"Premature end-of-file encountered.")}if(_r(Xn),Pe=zr,oi=1,zn=(qe=Xn).D,xn=0<qe.L&&qe.M>=qe.zb&&qe.M<=qe.Va,qe.Aa==0)e:{if(zn.M=qe.M,zn.uc=xn,dl(qe,zn),oi=1,zn=(lr=qe.D).Nb,xn=(Kn=oa[qe.L])*qe.R,Tr=Kn/2*qe.B,ir=16*zn*qe.R,Yr=8*zn*qe.B,Ii=qe.sa,lo=qe.ta-xn+ir,Nr=qe.qa,qn=qe.ra-Tr+Yr,ji=qe.Ha,So=qe.Ia-Tr+Yr,S=(w=lr.M)==0,gi=w>=qe.Va-1,qe.Aa==2&&dl(qe,lr),lr.uc)for(D=(Qn=qe).D.M,t(Qn.D.uc),lr=Qn.yb;lr<Qn.Hb;++lr){si=lr,Un=D;var _=(I=(Ct=Qn).D).Nb;Br=Ct.R;var I=I.wa[I.Y+si],K=Ct.sa,nt=Ct.ta+16*_*Br+16*si,j=I.dd,Y=I.tc;if(Y!=0)if(t(3<=Y),Ct.L==1)0<si&&Cf(K,nt,Br,Y+4),I.La&&Du(K,nt,Br,Y),0<Un&&Mf(K,nt,Br,Y+4),I.La&&_u(K,nt,Br,Y);else{var lt=Ct.B,st=Ct.qa,ft=Ct.ra+8*_*lt+8*si,z=Ct.Ha,Ct=Ct.Ia+8*_*lt+8*si;_=I.ld,0<si&&(Dr(K,nt,Br,Y+4,j,_),qr(st,ft,z,Ct,lt,Y+4,j,_)),I.La&&(Kl(K,nt,Br,Y,j,_),Jl(st,ft,z,Ct,lt,Y,j,_)),0<Un&&(ar(K,nt,Br,Y+4,j,_),ri(st,ft,z,Ct,lt,Y+4,j,_)),I.La&&(Aa(K,nt,Br,Y,j,_),bl(st,ft,z,Ct,lt,Y,j,_))}}if(qe.ia&&alert("todo:DitherRow"),Pe.put!=null){if(lr=16*w,w=16*(w+1),S?(Pe.y=qe.sa,Pe.O=qe.ta+ir,Pe.f=qe.qa,Pe.N=qe.ra+Yr,Pe.ea=qe.Ha,Pe.W=qe.Ia+Yr):(lr-=Kn,Pe.y=Ii,Pe.O=lo,Pe.f=Nr,Pe.N=qn,Pe.ea=ji,Pe.W=So),gi||(w-=Kn),w>Pe.o&&(w=Pe.o),Pe.F=null,Pe.J=null,qe.Fa!=null&&0<qe.Fa.length&&lr<w&&(Pe.J=Di(qe,Pe,lr,w-lr),Pe.F=qe.mb,Pe.F==null&&Pe.F.length==0)){oi=Fn(qe,3,"Could not decode alpha data.");break e}lr<Pe.j&&(Kn=Pe.j-lr,lr=Pe.j,t(!(1&Kn)),Pe.O+=qe.R*Kn,Pe.N+=qe.B*(Kn>>1),Pe.W+=qe.B*(Kn>>1),Pe.F!=null&&(Pe.J+=Pe.width*Kn)),lr<w&&(Pe.O+=Pe.v,Pe.N+=Pe.v>>1,Pe.W+=Pe.v>>1,Pe.F!=null&&(Pe.J+=Pe.v),Pe.ka=lr-Pe.j,Pe.U=Pe.va-Pe.v,Pe.T=w-lr,oi=Pe.put(Pe))}zn+1!=qe.Ic||gi||(r(qe.sa,qe.ta-xn,Ii,lo+16*qe.R,xn),r(qe.qa,qe.ra-Tr,Nr,qn+8*qe.B,Tr),r(qe.Ha,qe.Ia-Tr,ji,So+8*qe.B,Tr))}if(!oi)return Fn(Xn,6,"Output aborted.")}return 1})(mt,Pt)),Pt.bc!=null&&Pt.bc(Pt),Ht&=1}return Ht?(mt.cb=0,Ht):0})(m,O)||(v=m.a)}}else v=m.a}v==0&&X.Oa!=null&&X.Oa.fd&&(v=hl(X.ba))}X=v}W=X!=0?null:11>W?ot.f.RGBA.eb:ot.f.kb.y}else W=null;return W};var El=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function d(it,Lt){for(var J="",ct=0;ct<4;ct++)J+=String.fromCharCode(it[Lt++]);return J}function p(it,Lt){return it[Lt+0]|it[Lt+1]<<8}function g(it,Lt){return(it[Lt+0]|it[Lt+1]<<8|it[Lt+2]<<16)>>>0}function b(it,Lt){return(it[Lt+0]|it[Lt+1]<<8|it[Lt+2]<<16|it[Lt+3]<<24)>>>0}new f;var y=[0],M=[0],C=[],L=new f,R=n,B=(function(it,Lt){var J={},ct=0,G=!1,vt=0,_t=0;if(J.frames=[],!(function(N,Q){for(var tt=0;tt<4;tt++)if(N[Q+tt]!="RIFF".charCodeAt(tt))return!0;return!1})(it,Lt)){for(b(it,Lt+=4),Lt+=8;Lt<it.length;){var ht=d(it,Lt),Z=b(it,Lt+=4);Lt+=4;var ut=Z+(1&Z);switch(ht){case"VP8 ":case"VP8L":J.frames[ct]===void 0&&(J.frames[ct]={}),($=J.frames[ct]).src_off=G?_t:Lt-8,$.src_size=vt+Z+8,ct++,G&&(G=!1,vt=0,_t=0);break;case"VP8X":($=J.header={}).feature_flags=it[Lt];var It=Lt+4;$.canvas_width=1+g(it,It),It+=3,$.canvas_height=1+g(it,It),It+=3;break;case"ALPH":G=!0,vt=ut+8,_t=Lt-8;break;case"ANIM":($=J.header).bgcolor=b(it,Lt),It=Lt+4,$.loop_count=p(it,It),It+=2;break;case"ANMF":var Zt,$;($=J.frames[ct]={}).offset_x=2*g(it,Lt),Lt+=3,$.offset_y=2*g(it,Lt),Lt+=3,$.width=1+g(it,Lt),Lt+=3,$.height=1+g(it,Lt),Lt+=3,$.duration=g(it,Lt),Lt+=3,Zt=it[Lt++],$.dispose=1&Zt,$.blend=Zt>>1&1}ht!="ANMF"&&(Lt+=ut)}return J}})(R,0);B.response=R,B.rgbaoutput=!0,B.dataurl=!1;var q=B.header?B.header:null,V=B.frames?B.frames:null;if(q){q.loop_counter=q.loop_count,y=[q.canvas_height],M=[q.canvas_width];for(var gt=0;gt<V.length&&V[gt].blend!=0;gt++);}var Mt=V[0],kt=L.WebPDecodeRGBA(R,Mt.src_off,Mt.src_size,M,y);Mt.rgba=kt,Mt.imgwidth=M[0],Mt.imgheight=y[0];for(var bt=0;bt<M[0]*y[0]*4;bt++)C[bt]=kt[bt];return this.width=M,this.height=y,this.data=C,this}function i_(){var n,t=this.internal.__metadata__.metadata,e=unescape(encodeURIComponent(t));n=this.internal.__metadata__.rawXml?e:'<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>'+e.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 "+n.length+" >>"),this.internal.write("stream"),this.internal.write(n),this.internal.write("endstream"),this.internal.write("endobj")}function o_(){this.internal.__metadata__.metadataObjectNumber&&this.internal.write("/Metadata "+this.internal.__metadata__.metadataObjectNumber+" 0 R")}(function(n){var t,e,r,i,s,l,c,f,d,p=function(N){return N=N||{},this.isStrokeTransparent=N.isStrokeTransparent||!1,this.strokeOpacity=N.strokeOpacity||1,this.strokeStyle=N.strokeStyle||"#000000",this.fillStyle=N.fillStyle||"#000000",this.isFillTransparent=N.isFillTransparent||!1,this.fillOpacity=N.fillOpacity||1,this.font=N.font||"10px sans-serif",this.textBaseline=N.textBaseline||"alphabetic",this.textAlign=N.textAlign||"left",this.lineWidth=N.lineWidth||1,this.lineJoin=N.lineJoin||"miter",this.lineCap=N.lineCap||"butt",this.path=N.path||[],this.transform=N.transform!==void 0?N.transform.clone():new f,this.globalCompositeOperation=N.globalCompositeOperation||"normal",this.globalAlpha=N.globalAlpha||1,this.clip_path=N.clip_path||[],this.currentPoint=N.currentPoint||new l,this.miterLimit=N.miterLimit||10,this.lastPoint=N.lastPoint||new l,this.lineDashOffset=N.lineDashOffset||0,this.lineDash=N.lineDash||[],this.margin=N.margin||[0,0,0,0],this.prevPageLastElemOffset=N.prevPageLastElemOffset||0,this.ignoreClearRect=typeof N.ignoreClearRect!="boolean"||N.ignoreClearRect,this};n.events.push(["initialized",function(){this.context2d=new g(this),t=this.internal.f2,e=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(N){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var Q=N;Object.defineProperty(this,"pdf",{get:function(){return Q}});var tt=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return tt},set:function(rt){tt=!!rt}});var pt=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return pt},set:function(rt){pt=!!rt}});var wt=0;Object.defineProperty(this,"posX",{get:function(){return wt},set:function(rt){isNaN(rt)||(wt=rt)}});var At=0;Object.defineProperty(this,"posY",{get:function(){return At},set:function(rt){isNaN(rt)||(At=rt)}}),Object.defineProperty(this,"margin",{get:function(){return d.margin},set:function(rt){var Oe;typeof rt=="number"?Oe=[rt,rt,rt,rt]:((Oe=new Array(4))[0]=rt[0],Oe[1]=rt.length>=2?rt[1]:Oe[0],Oe[2]=rt.length>=3?rt[2]:Oe[0],Oe[3]=rt.length>=4?rt[3]:Oe[1]),d.margin=Oe}});var Ft=!1;Object.defineProperty(this,"autoPaging",{get:function(){return Ft},set:function(rt){Ft=rt}});var Rt=0;Object.defineProperty(this,"lastBreak",{get:function(){return Rt},set:function(rt){Rt=rt}});var Jt=[];Object.defineProperty(this,"pageBreaks",{get:function(){return Jt},set:function(rt){Jt=rt}}),Object.defineProperty(this,"ctx",{get:function(){return d},set:function(rt){rt instanceof p&&(d=rt)}}),Object.defineProperty(this,"path",{get:function(){return d.path},set:function(rt){d.path=rt}});var ke=[];Object.defineProperty(this,"ctxStack",{get:function(){return ke},set:function(rt){ke=rt}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(rt){var Oe;Oe=b(rt),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(rt){var Oe=b(rt);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(rt){["butt","round","square"].indexOf(rt)!==-1&&(this.ctx.lineCap=rt,this.pdf.setLineCap(rt))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(rt){isNaN(rt)||(this.ctx.lineWidth=rt,this.pdf.setLineWidth(rt))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(rt){["bevel","round","miter"].indexOf(rt)!==-1&&(this.ctx.lineJoin=rt,this.pdf.setLineJoin(rt))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(rt){isNaN(rt)||(this.ctx.miterLimit=rt,this.pdf.setMiterLimit(rt))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(rt){this.ctx.textBaseline=rt}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(rt){["right","end","center","left","start"].indexOf(rt)!==-1&&(this.ctx.textAlign=rt)}});var Re=null,Ie=null,Ve=null;Object.defineProperty(this,"fontFaces",{get:function(){return Ve},set:function(rt){Re=null,Ie=null,Ve=rt}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(rt){var Oe;if(this.ctx.font=rt,(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(rt))!==null){var Cn=Oe[1];Oe[2];var cn=Oe[3],xe=Oe[4];Oe[5];var we=Oe[6],Ne=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(xe)[2];xe=Math.floor(Ne==="px"?parseFloat(xe)*this.pdf.internal.scaleFactor:Ne==="em"?parseFloat(xe)*this.pdf.getFontSize():parseFloat(xe)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(xe);var De=(function(je){var nr,bn,an=[],ln=je.trim();if(ln==="")return by;if(ln in jw)return[jw[ln]];for(;ln!=="";){switch(bn=null,nr=(ln=Bw(ln)).charAt(0)){case'"':case"'":bn=ZN(ln.substring(1),nr);break;default:bn=QN(ln)}if(bn===null||(an.push(bn[0]),(ln=Bw(bn[1]))!==""&&ln.charAt(0)!==","))return by;ln=ln.replace(/^,/,"")}return an})(we);if(this.fontFaces){var Fe=(function(je,nr){var bn=je.getFontList(),an=JSON.stringify(bn);if(Re===null||Ie!==an){var ln=(function(Bn){var Xe=[];return Object.keys(Bn).forEach(function(Mr){Bn[Mr].forEach(function(gn){var yn=null;switch(gn){case"bold":yn={family:Mr,weight:"bold"};break;case"italic":yn={family:Mr,style:"italic"};break;case"bolditalic":yn={family:Mr,weight:"bold",style:"italic"};break;case"":case"normal":yn={family:Mr}}yn!==null&&(yn.ref={name:Mr,style:gn},Xe.push(yn))})}),Xe})(bn);Re=(function(Bn){for(var Xe={},Mr=0;Mr<Bn.length;++Mr){var gn=yy(Bn[Mr]),yn=gn.family,Qt=gn.stretch,ye=gn.style,Ce=gn.weight;Xe[yn]=Xe[yn]||{},Xe[yn][Qt]=Xe[yn][Qt]||{},Xe[yn][Qt][ye]=Xe[yn][Qt][ye]||{},Xe[yn][Qt][ye][Ce]=gn}return Xe})(ln.concat(nr)),Ie=an}return Re})(this.pdf,this.fontFaces),tn=De.map(function(je){return{family:je,stretch:"normal",weight:cn,style:Cn}}),Pn=(function(je,nr,bn){for(var an=(bn=bn||{}).defaultFontFamily||"times",ln=Object.assign({},JN,bn.genericFontFamilies||{}),Bn=null,Xe=null,Mr=0;Mr<nr.length;++Mr)if(ln[(Bn=yy(nr[Mr])).family]&&(Bn.family=ln[Bn.family]),je.hasOwnProperty(Bn.family)){Xe=je[Bn.family];break}if(!(Xe=Xe||je[an]))throw new Error("Could not find a font-family for the rule '"+zw(Bn)+"' and default family '"+an+"'.");if(Xe=(function(gn,yn){if(yn[gn])return yn[gn];var Qt=x2[gn],ye=Qt<=x2.normal?-1:1,Ce=Iw(yn,w4,Qt,ye);if(!Ce)throw new Error("Could not find a matching font-stretch value for "+gn);return Ce})(Bn.stretch,Xe),Xe=(function(gn,yn){if(yn[gn])return yn[gn];for(var Qt=v4[gn],ye=0;ye<Qt.length;++ye)if(yn[Qt[ye]])return yn[Qt[ye]];throw new Error("Could not find a matching font-style for "+gn)})(Bn.style,Xe),!(Xe=(function(gn,yn){if(yn[gn])return yn[gn];if(gn===400&&yn[500])return yn[500];if(gn===500&&yn[400])return yn[400];var Qt=KN[gn],ye=Iw(yn,S4,Qt,gn<400?-1:1);if(!ye)throw new Error("Could not find a matching font-weight for value "+gn);return ye})(Bn.weight,Xe)))throw new Error("Failed to resolve a font for the rule '"+zw(Bn)+"'.");return Xe})(Fe,tn);this.pdf.setFont(Pn.ref.name,Pn.ref.style)}else{var mn="";(cn==="bold"||parseInt(cn,10)>=700||Cn==="bold")&&(mn="bold"),Cn==="italic"&&(mn+="italic"),mn.length===0&&(mn="normal");for(var In="",hn={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"},Ue=0;Ue<De.length;Ue++){if(this.pdf.internal.getFont(De[Ue],mn,{noFallback:!0,disableWarning:!0})!==void 0){In=De[Ue];break}if(mn==="bolditalic"&&this.pdf.internal.getFont(De[Ue],"bold",{noFallback:!0,disableWarning:!0})!==void 0)In=De[Ue],mn="bold";else if(this.pdf.internal.getFont(De[Ue],"normal",{noFallback:!0,disableWarning:!0})!==void 0){In=De[Ue],mn="normal";break}}if(In===""){for(var $e=0;$e<De.length;$e++)if(hn[De[$e]]){In=hn[De[$e]];break}}In=In===""?"Times":In,this.pdf.setFont(In,mn)}}}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(rt){this.ctx.globalCompositeOperation=rt}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(rt){this.ctx.globalAlpha=rt}}),Object.defineProperty(this,"lineDashOffset",{get:function(){return this.ctx.lineDashOffset},set:function(rt){this.ctx.lineDashOffset=rt,$.call(this)}}),Object.defineProperty(this,"lineDash",{get:function(){return this.ctx.lineDash},set:function(rt){this.ctx.lineDash=rt,$.call(this)}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(rt){this.ctx.ignoreClearRect=!!rt}})};g.prototype.setLineDash=function(N){this.lineDash=N},g.prototype.getLineDash=function(){return this.lineDash.length%2?this.lineDash.concat(this.lineDash):this.lineDash.slice()},g.prototype.fill=function(){V.call(this,"fill",!1)},g.prototype.stroke=function(){V.call(this,"stroke",!1)},g.prototype.beginPath=function(){this.path=[{type:"begin"}]},g.prototype.moveTo=function(N,Q){if(isNaN(N)||isNaN(Q))throw li.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.moveTo");var tt=this.ctx.transform.applyToPoint(new l(N,Q));this.path.push({type:"mt",x:tt.x,y:tt.y}),this.ctx.lastPoint=new l(N,Q)},g.prototype.closePath=function(){var N=new l(0,0),Q=0;for(Q=this.path.length-1;Q!==-1;Q--)if(this.path[Q].type==="begin"&&Xr(this.path[Q+1])==="object"&&typeof this.path[Q+1].x=="number"){N=new l(this.path[Q+1].x,this.path[Q+1].y);break}this.path.push({type:"close"}),this.ctx.lastPoint=new l(N.x,N.y)},g.prototype.lineTo=function(N,Q){if(isNaN(N)||isNaN(Q))throw li.error("jsPDF.context2d.lineTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.lineTo");var tt=this.ctx.transform.applyToPoint(new l(N,Q));this.path.push({type:"lt",x:tt.x,y:tt.y}),this.ctx.lastPoint=new l(tt.x,tt.y)},g.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),V.call(this,null,!0)},g.prototype.quadraticCurveTo=function(N,Q,tt,pt){if(isNaN(tt)||isNaN(pt)||isNaN(N)||isNaN(Q))throw li.error("jsPDF.context2d.quadraticCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");var wt=this.ctx.transform.applyToPoint(new l(tt,pt)),At=this.ctx.transform.applyToPoint(new l(N,Q));this.path.push({type:"qct",x1:At.x,y1:At.y,x:wt.x,y:wt.y}),this.ctx.lastPoint=new l(wt.x,wt.y)},g.prototype.bezierCurveTo=function(N,Q,tt,pt,wt,At){if(isNaN(wt)||isNaN(At)||isNaN(N)||isNaN(Q)||isNaN(tt)||isNaN(pt))throw li.error("jsPDF.context2d.bezierCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");var Ft=this.ctx.transform.applyToPoint(new l(wt,At)),Rt=this.ctx.transform.applyToPoint(new l(N,Q)),Jt=this.ctx.transform.applyToPoint(new l(tt,pt));this.path.push({type:"bct",x1:Rt.x,y1:Rt.y,x2:Jt.x,y2:Jt.y,x:Ft.x,y:Ft.y}),this.ctx.lastPoint=new l(Ft.x,Ft.y)},g.prototype.arc=function(N,Q,tt,pt,wt,At){if(isNaN(N)||isNaN(Q)||isNaN(tt)||isNaN(pt)||isNaN(wt))throw li.error("jsPDF.context2d.arc: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.arc");if(At=!!At,!this.ctx.transform.isIdentity){var Ft=this.ctx.transform.applyToPoint(new l(N,Q));N=Ft.x,Q=Ft.y;var Rt=this.ctx.transform.applyToPoint(new l(0,tt)),Jt=this.ctx.transform.applyToPoint(new l(0,0));tt=Math.sqrt(Math.pow(Rt.x-Jt.x,2)+Math.pow(Rt.y-Jt.y,2))}Math.abs(wt-pt)>=2*Math.PI&&(pt=0,wt=2*Math.PI),this.path.push({type:"arc",x:N,y:Q,radius:tt,startAngle:pt,endAngle:wt,counterclockwise:At})},g.prototype.arcTo=function(N,Q,tt,pt,wt){throw new Error("arcTo not implemented.")},g.prototype.rect=function(N,Q,tt,pt){if(isNaN(N)||isNaN(Q)||isNaN(tt)||isNaN(pt))throw li.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(N,Q),this.lineTo(N+tt,Q),this.lineTo(N+tt,Q+pt),this.lineTo(N,Q+pt),this.lineTo(N,Q),this.lineTo(N+tt,Q),this.lineTo(N,Q)},g.prototype.fillRect=function(N,Q,tt,pt){if(isNaN(N)||isNaN(Q)||isNaN(tt)||isNaN(pt))throw li.error("jsPDF.context2d.fillRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillRect");if(!y.call(this)){var wt={};this.lineCap!=="butt"&&(wt.lineCap=this.lineCap,this.lineCap="butt"),this.lineJoin!=="miter"&&(wt.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(N,Q,tt,pt),this.fill(),wt.hasOwnProperty("lineCap")&&(this.lineCap=wt.lineCap),wt.hasOwnProperty("lineJoin")&&(this.lineJoin=wt.lineJoin)}},g.prototype.strokeRect=function(N,Q,tt,pt){if(isNaN(N)||isNaN(Q)||isNaN(tt)||isNaN(pt))throw li.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");M.call(this)||(this.beginPath(),this.rect(N,Q,tt,pt),this.stroke())},g.prototype.clearRect=function(N,Q,tt,pt){if(isNaN(N)||isNaN(Q)||isNaN(tt)||isNaN(pt))throw li.error("jsPDF.context2d.clearRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(N,Q,tt,pt))},g.prototype.save=function(N){N=typeof N!="boolean"||N;for(var Q=this.pdf.internal.getCurrentPageInfo().pageNumber,tt=0;tt<this.pdf.internal.getNumberOfPages();tt++)this.pdf.setPage(tt+1),this.pdf.internal.out("q");if(this.pdf.setPage(Q),N){this.ctx.fontSize=this.pdf.internal.getFontSize();var pt=new p(this.ctx);this.ctxStack.push(this.ctx),this.ctx=pt}},g.prototype.restore=function(N){N=typeof N!="boolean"||N;for(var Q=this.pdf.internal.getCurrentPageInfo().pageNumber,tt=0;tt<this.pdf.internal.getNumberOfPages();tt++)this.pdf.setPage(tt+1),this.pdf.internal.out("Q");this.pdf.setPage(Q),N&&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(N){var Q,tt,pt,wt;if(N.isCanvasGradient===!0&&(N=N.getColor()),!N)return{r:0,g:0,b:0,a:0,style:N};if(/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/.test(N))Q=0,tt=0,pt=0,wt=0;else{var At=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(N);if(At!==null)Q=parseInt(At[1]),tt=parseInt(At[2]),pt=parseInt(At[3]),wt=1;else if((At=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(N))!==null)Q=parseInt(At[1]),tt=parseInt(At[2]),pt=parseInt(At[3]),wt=parseFloat(At[4]);else{if(wt=1,typeof N=="string"&&N.charAt(0)!=="#"){var Ft=new h4(N);N=Ft.ok?Ft.toHex():"#000000"}N.length===4?(Q=N.substring(1,2),Q+=Q,tt=N.substring(2,3),tt+=tt,pt=N.substring(3,4),pt+=pt):(Q=N.substring(1,3),tt=N.substring(3,5),pt=N.substring(5,7)),Q=parseInt(Q,16),tt=parseInt(tt,16),pt=parseInt(pt,16)}}return{r:Q,g:tt,b:pt,a:wt,style:N}},y=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},M=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};g.prototype.fillText=function(N,Q,tt,pt){if(isNaN(Q)||isNaN(tt)||typeof N!="string")throw li.error("jsPDF.context2d.fillText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillText");if(pt=isNaN(pt)?void 0:pt,!y.call(this)){var wt=ut(this.ctx.transform.rotation),At=this.ctx.transform.scaleX;ct.call(this,{text:N,x:Q,y:tt,scale:At,angle:wt,align:this.textAlign,maxWidth:pt})}},g.prototype.strokeText=function(N,Q,tt,pt){if(isNaN(Q)||isNaN(tt)||typeof N!="string")throw li.error("jsPDF.context2d.strokeText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeText");if(!M.call(this)){pt=isNaN(pt)?void 0:pt;var wt=ut(this.ctx.transform.rotation),At=this.ctx.transform.scaleX;ct.call(this,{text:N,x:Q,y:tt,scale:At,renderingMode:"stroke",angle:wt,align:this.textAlign,maxWidth:pt})}},g.prototype.measureText=function(N){if(typeof N!="string")throw li.error("jsPDF.context2d.measureText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.measureText");var Q=this.pdf,tt=this.pdf.internal.scaleFactor,pt=Q.internal.getFontSize(),wt=Q.getStringUnitWidth(N)*pt/Q.internal.scaleFactor;return new function(At){var Ft=(At=At||{}).width||0;return Object.defineProperty(this,"width",{get:function(){return Ft}}),this}({width:wt*=Math.round(96*tt/72*1e4)/1e4})},g.prototype.scale=function(N,Q){if(isNaN(N)||isNaN(Q))throw li.error("jsPDF.context2d.scale: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.scale");var tt=new f(N,0,0,Q,0,0);this.ctx.transform=this.ctx.transform.multiply(tt)},g.prototype.rotate=function(N){if(isNaN(N))throw li.error("jsPDF.context2d.rotate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rotate");var Q=new f(Math.cos(N),Math.sin(N),-Math.sin(N),Math.cos(N),0,0);this.ctx.transform=this.ctx.transform.multiply(Q)},g.prototype.translate=function(N,Q){if(isNaN(N)||isNaN(Q))throw li.error("jsPDF.context2d.translate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.translate");var tt=new f(1,0,0,1,N,Q);this.ctx.transform=this.ctx.transform.multiply(tt)},g.prototype.transform=function(N,Q,tt,pt,wt,At){if(isNaN(N)||isNaN(Q)||isNaN(tt)||isNaN(pt)||isNaN(wt)||isNaN(At))throw li.error("jsPDF.context2d.transform: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.transform");var Ft=new f(N,Q,tt,pt,wt,At);this.ctx.transform=this.ctx.transform.multiply(Ft)},g.prototype.setTransform=function(N,Q,tt,pt,wt,At){N=isNaN(N)?1:N,Q=isNaN(Q)?0:Q,tt=isNaN(tt)?0:tt,pt=isNaN(pt)?1:pt,wt=isNaN(wt)?0:wt,At=isNaN(At)?0:At,this.ctx.transform=new f(N,Q,tt,pt,wt,At)};var C=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};g.prototype.drawImage=function(N,Q,tt,pt,wt,At,Ft,Rt,Jt){var ke=this.pdf.getImageProperties(N),Re=1,Ie=1,Ve=1,rt=1;pt!==void 0&&Rt!==void 0&&(Ve=Rt/pt,rt=Jt/wt,Re=ke.width/pt*Rt/pt,Ie=ke.height/wt*Jt/wt),At===void 0&&(At=Q,Ft=tt,Q=0,tt=0),pt!==void 0&&Rt===void 0&&(Rt=pt,Jt=wt),pt===void 0&&Rt===void 0&&(Rt=ke.width,Jt=ke.height);var Oe=this.ctx.transform.decompose(),Cn=ut(Oe.rotate.shx),cn=new f,xe=(cn=(cn=(cn=cn.multiply(Oe.translate)).multiply(Oe.skew)).multiply(Oe.scale)).applyToRectangle(new c(At-Q*Ve,Ft-tt*rt,pt*Re,wt*Ie));if(this.autoPaging){for(var we,Ne=L.call(this,xe),De=[],Fe=0;Fe<Ne.length;Fe+=1)De.indexOf(Ne[Fe])===-1&&De.push(Ne[Fe]);q(De);for(var tn=De[0],Pn=De[De.length-1],mn=tn;mn<Pn+1;mn++){this.pdf.setPage(mn);var In=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],hn=mn===1?this.posY+this.margin[0]:this.margin[0],Ue=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],$e=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],je=mn===1?0:Ue+(mn-2)*$e;if(this.ctx.clip_path.length!==0){var nr=this.path;we=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=B(we,this.posX+this.margin[3],-je+hn+this.ctx.prevPageLastElemOffset),gt.call(this,"fill",!0),this.path=nr}var bn=JSON.parse(JSON.stringify(xe));bn=B([bn],this.posX+this.margin[3],-je+hn+this.ctx.prevPageLastElemOffset)[0];var an=(mn>tn||mn<Pn)&&C.call(this);an&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],In,$e,null).clip().discardPath()),this.pdf.addImage(N,"JPEG",bn.x,bn.y,bn.w,bn.h,null,null,Cn),an&&this.pdf.restoreGraphicsState()}}else this.pdf.addImage(N,"JPEG",xe.x,xe.y,xe.w,xe.h,null,null,Cn)};var L=function(N,Q,tt){var pt=[];Q=Q||this.pdf.internal.pageSize.width,tt=tt||this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var wt=this.posY+this.ctx.prevPageLastElemOffset;switch(N.type){default:case"mt":case"lt":pt.push(Math.floor((N.y+wt)/tt)+1);break;case"arc":pt.push(Math.floor((N.y+wt-N.radius)/tt)+1),pt.push(Math.floor((N.y+wt+N.radius)/tt)+1);break;case"qct":var At=It(this.ctx.lastPoint.x,this.ctx.lastPoint.y,N.x1,N.y1,N.x,N.y);pt.push(Math.floor((At.y+wt)/tt)+1),pt.push(Math.floor((At.y+At.h+wt)/tt)+1);break;case"bct":var Ft=Zt(this.ctx.lastPoint.x,this.ctx.lastPoint.y,N.x1,N.y1,N.x2,N.y2,N.x,N.y);pt.push(Math.floor((Ft.y+wt)/tt)+1),pt.push(Math.floor((Ft.y+Ft.h+wt)/tt)+1);break;case"rect":pt.push(Math.floor((N.y+wt)/tt)+1),pt.push(Math.floor((N.y+N.h+wt)/tt)+1)}for(var Rt=0;Rt<pt.length;Rt+=1)for(;this.pdf.internal.getNumberOfPages()<pt[Rt];)R.call(this);return pt},R=function(){var N=this.fillStyle,Q=this.strokeStyle,tt=this.font,pt=this.lineCap,wt=this.lineWidth,At=this.lineJoin;this.pdf.addPage(),this.fillStyle=N,this.strokeStyle=Q,this.font=tt,this.lineCap=pt,this.lineWidth=wt,this.lineJoin=At},B=function(N,Q,tt){for(var pt=0;pt<N.length;pt++)switch(N[pt].type){case"bct":N[pt].x2+=Q,N[pt].y2+=tt;case"qct":N[pt].x1+=Q,N[pt].y1+=tt;default:N[pt].x+=Q,N[pt].y+=tt}return N},q=function(N){return N.sort(function(Q,tt){return Q-tt})},V=function(N,Q){var tt=this.fillStyle,pt=this.strokeStyle,wt=this.lineCap,At=this.lineWidth,Ft=Math.abs(At*this.ctx.transform.scaleX),Rt=this.lineJoin;if(this.autoPaging){for(var Jt,ke,Re=JSON.parse(JSON.stringify(this.path)),Ie=JSON.parse(JSON.stringify(this.path)),Ve=[],rt=0;rt<Ie.length;rt++)if(Ie[rt].x!==void 0)for(var Oe=L.call(this,Ie[rt]),Cn=0;Cn<Oe.length;Cn+=1)Ve.indexOf(Oe[Cn])===-1&&Ve.push(Oe[Cn]);for(var cn=0;cn<Ve.length;cn++)for(;this.pdf.internal.getNumberOfPages()<Ve[cn];)R.call(this);q(Ve);for(var xe=Ve[0],we=Ve[Ve.length-1],Ne=xe;Ne<we+1;Ne++){this.pdf.setPage(Ne),this.fillStyle=tt,this.strokeStyle=pt,this.lineCap=wt,this.lineWidth=Ft,this.lineJoin=Rt;var De=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Fe=Ne===1?this.posY+this.margin[0]:this.margin[0],tn=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Pn=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],mn=Ne===1?0:tn+(Ne-2)*Pn;if(this.ctx.clip_path.length!==0){var In=this.path;Jt=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=B(Jt,this.posX+this.margin[3],-mn+Fe+this.ctx.prevPageLastElemOffset),gt.call(this,N,!0),this.path=In}if(ke=JSON.parse(JSON.stringify(Re)),this.path=B(ke,this.posX+this.margin[3],-mn+Fe+this.ctx.prevPageLastElemOffset),Q===!1||Ne===0){var hn=(Ne>xe||Ne<we)&&C.call(this);hn&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],De,Pn,null).clip().discardPath()),gt.call(this,N,Q),hn&&this.pdf.restoreGraphicsState()}this.lineWidth=At}this.path=Re}else this.lineWidth=Ft,gt.call(this,N,Q),this.lineWidth=At},gt=function(N,Q){if((N!=="stroke"||Q||!M.call(this))&&(N==="stroke"||Q||!y.call(this))){for(var tt,pt,wt=[],At=this.path,Ft=0;Ft<At.length;Ft++){var Rt=At[Ft];switch(Rt.type){case"begin":wt.push({begin:!0});break;case"close":wt.push({close:!0});break;case"mt":wt.push({start:Rt,deltas:[],abs:[]});break;case"lt":var Jt=wt.length;if(At[Ft-1]&&!isNaN(At[Ft-1].x)&&(tt=[Rt.x-At[Ft-1].x,Rt.y-At[Ft-1].y],Jt>0)){for(;Jt>=0;Jt--)if(wt[Jt-1].close!==!0&&wt[Jt-1].begin!==!0){wt[Jt-1].deltas.push(tt),wt[Jt-1].abs.push(Rt);break}}break;case"bct":tt=[Rt.x1-At[Ft-1].x,Rt.y1-At[Ft-1].y,Rt.x2-At[Ft-1].x,Rt.y2-At[Ft-1].y,Rt.x-At[Ft-1].x,Rt.y-At[Ft-1].y],wt[wt.length-1].deltas.push(tt);break;case"qct":var ke=At[Ft-1].x+2/3*(Rt.x1-At[Ft-1].x),Re=At[Ft-1].y+2/3*(Rt.y1-At[Ft-1].y),Ie=Rt.x+2/3*(Rt.x1-Rt.x),Ve=Rt.y+2/3*(Rt.y1-Rt.y),rt=Rt.x,Oe=Rt.y;tt=[ke-At[Ft-1].x,Re-At[Ft-1].y,Ie-At[Ft-1].x,Ve-At[Ft-1].y,rt-At[Ft-1].x,Oe-At[Ft-1].y],wt[wt.length-1].deltas.push(tt);break;case"arc":wt.push({deltas:[],abs:[],arc:!0}),Array.isArray(wt[wt.length-1].abs)&&wt[wt.length-1].abs.push(Rt)}}pt=Q?null:N==="stroke"?"stroke":"fill";for(var Cn=!1,cn=0;cn<wt.length;cn++)if(wt[cn].arc)for(var xe=wt[cn].abs,we=0;we<xe.length;we++){var Ne=xe[we];Ne.type==="arc"?bt.call(this,Ne.x,Ne.y,Ne.radius,Ne.startAngle,Ne.endAngle,Ne.counterclockwise,void 0,Q,!Cn):G.call(this,Ne.x,Ne.y),Cn=!0}else if(wt[cn].close===!0)this.pdf.internal.out("h"),Cn=!1;else if(wt[cn].begin!==!0){var De=wt[cn].start.x,Fe=wt[cn].start.y;vt.call(this,wt[cn].deltas,De,Fe),Cn=!0}pt&&it.call(this,pt),Q&&Lt.call(this)}},Mt=function(N){var Q=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,tt=Q*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case"bottom":return N-tt;case"top":return N+Q-tt;case"hanging":return N+Q-2*tt;case"middle":return N+Q/2-tt;default:return N}},kt=function(N){return N+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};g.prototype.createLinearGradient=function(){var N=function(){};return N.colorStops=[],N.addColorStop=function(Q,tt){this.colorStops.push([Q,tt])},N.getColor=function(){return this.colorStops.length===0?"#000000":this.colorStops[0][1]},N.isCanvasGradient=!0,N},g.prototype.createPattern=function(){return this.createLinearGradient()},g.prototype.createRadialGradient=function(){return this.createLinearGradient()};var bt=function(N,Q,tt,pt,wt,At,Ft,Rt,Jt){for(var ke=ht.call(this,tt,pt,wt,At),Re=0;Re<ke.length;Re++){var Ie=ke[Re];Re===0&&(Jt?J.call(this,Ie.x1+N,Ie.y1+Q):G.call(this,Ie.x1+N,Ie.y1+Q)),_t.call(this,N,Q,Ie.x2,Ie.y2,Ie.x3,Ie.y3,Ie.x4,Ie.y4)}Rt?Lt.call(this):it.call(this,Ft)},it=function(N){switch(N){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f")}},Lt=function(){this.pdf.clip(),this.pdf.discardPath()},J=function(N,Q){this.pdf.internal.out(e(N)+" "+r(Q)+" m")},ct=function(N){var Q;switch(N.align){case"right":case"end":Q="right";break;case"center":Q="center";break;default:Q="left"}var tt,pt,wt,At=this.pdf.getTextDimensions(N.text),Ft=Mt.call(this,N.y),Rt=kt.call(this,Ft)-At.h,Jt=this.ctx.transform.applyToPoint(new l(N.x,Ft));if(this.autoPaging){var ke=this.ctx.transform.decompose(),Re=new f;Re=(Re=(Re=Re.multiply(ke.translate)).multiply(ke.skew)).multiply(ke.scale);for(var Ie=this.ctx.transform.applyToRectangle(new c(N.x,Ft,At.w,At.h)),Ve=Re.applyToRectangle(new c(N.x,Rt,At.w,At.h)),rt=L.call(this,Ve),Oe=[],Cn=0;Cn<rt.length;Cn+=1)Oe.indexOf(rt[Cn])===-1&&Oe.push(rt[Cn]);q(Oe);for(var cn=Oe[0],xe=Oe[Oe.length-1],we=cn;we<xe+1;we++){this.pdf.setPage(we);var Ne=we===1?this.posY+this.margin[0]:this.margin[0],De=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Fe=this.pdf.internal.pageSize.height-this.margin[2],tn=Fe-this.margin[0],Pn=this.pdf.internal.pageSize.width-this.margin[1],mn=Pn-this.margin[3],In=we===1?0:De+(we-2)*tn;if(this.ctx.clip_path.length!==0){var hn=this.path;tt=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=B(tt,this.posX+this.margin[3],-1*In+Ne),gt.call(this,"fill",!0),this.path=hn}var Ue=B([JSON.parse(JSON.stringify(Ve))],this.posX+this.margin[3],-In+Ne+this.ctx.prevPageLastElemOffset)[0];N.scale>=.01&&(pt=this.pdf.internal.getFontSize(),this.pdf.setFontSize(pt*N.scale),wt=this.lineWidth,this.lineWidth=wt*N.scale);var $e=this.autoPaging!=="text";if($e||Ue.y+Ue.h<=Fe){if($e||Ue.y>=Ne&&Ue.x<=Pn){var je=$e?N.text:this.pdf.splitTextToSize(N.text,N.maxWidth||Pn-Ue.x)[0],nr=B([JSON.parse(JSON.stringify(Ie))],this.posX+this.margin[3],-In+Ne+this.ctx.prevPageLastElemOffset)[0],bn=$e&&(we>cn||we<xe)&&C.call(this);bn&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],mn,tn,null).clip().discardPath()),this.pdf.text(je,nr.x,nr.y,{angle:N.angle,align:Q,renderingMode:N.renderingMode}),bn&&this.pdf.restoreGraphicsState()}}else Ue.y<Fe&&(this.ctx.prevPageLastElemOffset+=Fe-Ue.y);N.scale>=.01&&(this.pdf.setFontSize(pt),this.lineWidth=wt)}}else N.scale>=.01&&(pt=this.pdf.internal.getFontSize(),this.pdf.setFontSize(pt*N.scale),wt=this.lineWidth,this.lineWidth=wt*N.scale),this.pdf.text(N.text,Jt.x+this.posX,Jt.y+this.posY,{angle:N.angle,align:Q,renderingMode:N.renderingMode,maxWidth:N.maxWidth}),N.scale>=.01&&(this.pdf.setFontSize(pt),this.lineWidth=wt)},G=function(N,Q,tt,pt){tt=tt||0,pt=pt||0,this.pdf.internal.out(e(N+tt)+" "+r(Q+pt)+" l")},vt=function(N,Q,tt){return this.pdf.lines(N,Q,tt,null,null)},_t=function(N,Q,tt,pt,wt,At,Ft,Rt){this.pdf.internal.out([t(i(tt+N)),t(s(pt+Q)),t(i(wt+N)),t(s(At+Q)),t(i(Ft+N)),t(s(Rt+Q)),"c"].join(" "))},ht=function(N,Q,tt,pt){for(var wt=2*Math.PI,At=Math.PI/2;Q>tt;)Q-=wt;var Ft=Math.abs(tt-Q);Ft<wt&&pt&&(Ft=wt-Ft);for(var Rt=[],Jt=pt?-1:1,ke=Q;Ft>1e-5;){var Re=ke+Jt*Math.min(Ft,At);Rt.push(Z.call(this,N,ke,Re)),Ft-=Math.abs(Re-ke),ke=Re}return Rt},Z=function(N,Q,tt){var pt=(tt-Q)/2,wt=N*Math.cos(pt),At=N*Math.sin(pt),Ft=wt,Rt=-At,Jt=Ft*Ft+Rt*Rt,ke=Jt+Ft*wt+Rt*At,Re=4/3*(Math.sqrt(2*Jt*ke)-ke)/(Ft*At-Rt*wt),Ie=Ft-Re*Rt,Ve=Rt+Re*Ft,rt=Ie,Oe=-Ve,Cn=pt+Q,cn=Math.cos(Cn),xe=Math.sin(Cn);return{x1:N*Math.cos(Q),y1:N*Math.sin(Q),x2:Ie*cn-Ve*xe,y2:Ie*xe+Ve*cn,x3:rt*cn-Oe*xe,y3:rt*xe+Oe*cn,x4:N*Math.cos(tt),y4:N*Math.sin(tt)}},ut=function(N){return 180*N/Math.PI},It=function(N,Q,tt,pt,wt,At){var Ft=N+.5*(tt-N),Rt=Q+.5*(pt-Q),Jt=wt+.5*(tt-wt),ke=At+.5*(pt-At),Re=Math.min(N,wt,Ft,Jt),Ie=Math.max(N,wt,Ft,Jt),Ve=Math.min(Q,At,Rt,ke),rt=Math.max(Q,At,Rt,ke);return new c(Re,Ve,Ie-Re,rt-Ve)},Zt=function(N,Q,tt,pt,wt,At,Ft,Rt){var Jt,ke,Re,Ie,Ve,rt,Oe,Cn,cn,xe,we,Ne,De,Fe,tn=tt-N,Pn=pt-Q,mn=wt-tt,In=At-pt,hn=Ft-wt,Ue=Rt-At;for(ke=0;ke<41;ke++)cn=(Oe=(Re=N+(Jt=ke/40)*tn)+Jt*((Ve=tt+Jt*mn)-Re))+Jt*(Ve+Jt*(wt+Jt*hn-Ve)-Oe),xe=(Cn=(Ie=Q+Jt*Pn)+Jt*((rt=pt+Jt*In)-Ie))+Jt*(rt+Jt*(At+Jt*Ue-rt)-Cn),ke==0?(we=cn,Ne=xe,De=cn,Fe=xe):(we=Math.min(we,cn),Ne=Math.min(Ne,xe),De=Math.max(De,cn),Fe=Math.max(Fe,xe));return new c(Math.round(we),Math.round(Ne),Math.round(De-we),Math.round(Fe-Ne))},$=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var N,Q,tt=(N=this.ctx.lineDash,Q=this.ctx.lineDashOffset,JSON.stringify({lineDash:N,lineDashOffset:Q}));this.prevLineDash!==tt&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=tt)}}})(dn.API),(function(n){var t=function(l){var c,f,d,p,g,b,y,M,C,L;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-(L=g%85))/85)-(C=g%85))/85)-(M=g%85))/85)-(y=g%85))/85)%85,f.push(b+33,y+33,M+33,C+33,L+33)):f.push(122);return(function(R,B){for(var q=B;q>0;q--)R.pop()})(f,c.length),String.fromCharCode.apply(String,f)+"~>"},e=function(l){var c,f,d,p,g,b=String,y="length",M=255,C="charCodeAt",L="slice",R="replace";for(l[L](-2),l=l[L](0,-2)[R](/\s/g,"")[R]("z","!!!!!"),d=[],p=0,g=(l+=c="uuuuu"[L](l[y]%5||5))[y];g>p;p+=5)f=52200625*(l[C](p)-33)+614125*(l[C](p+1)-33)+7225*(l[C](p+2)-33)+85*(l[C](p+3)-33)+(l[C](p+4)-33),d.push(M&f>>24,M&f>>16,M&f>>8,M&f);return(function(B,q){for(var V=q;V>0;V--)B.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=d2(c)).reduce(function(d,p){return d+String.fromCharCode(p)},"")};n.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=e(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(" ")}}})(dn.API),(function(n){n.loadFile=function(t,e,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 C=M.length,L=[],R=String.fromCharCode;for(b=0;b<C;b+=1)L.push(R(255&M.charCodeAt(b)));return L.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,e,r)},n.allowFsRead=void 0,n.loadImageFile=n.loadFile})(dn.API),(function(n){function t(){return(Gn.html2canvas?Promise.resolve(Gn.html2canvas):Q1(()=>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 e(){return(Gn.DOMPurify?Promise.resolve(Gn.DOMPurify):Q1(()=>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=Xr(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(e).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],C=M.src.find(function(L){return L.format==="truetype"});C&&d.addFont(C.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||dn.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,dn.getPageSize=function(c,f,d){if(Xr(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,C=0,L=0;if(y.hasOwnProperty(b))C=y[b][1]/g,L=y[b][0]/g;else try{C=d[1],L=d[0]}catch{throw new Error("Invalid format: "+d)}if(c==="p"||c==="portrait")c="p",L>C&&(M=L,L=C,C=M);else{if(c!=="l"&&c!=="landscape")throw"Invalid orientation: "+c;c="l",C>L&&(M=L,L=C,C=M)}return{width:L,height:C,unit:f,k:g,orientation:c}},n.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(yy):null;var d=new l(f);return f.worker?d:d.from(c).doCallback()}})(dn.API),dn.API.addJS=function(n){var t,e,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})(n);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"),e=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&&e!==void 0&&this.internal.out("/Names <</JavaScript "+t+" 0 R>>")}),this},(function(n){var t;n.events.push(["postPutResources",function(){var e=this,r=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var i=e.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];e.internal.newObjectDeferredBegin(f,!1)}e.internal.write(l)}if(this.outline.createNamedDestinations){var d=this.internal.pages.length,p=[];for(s=0;s<d;s++){var g=e.internal.newObject();p.push(g);var b=e.internal.getPageInfo(s+1);e.internal.write("<< /D["+b.objId+" 0 R /XYZ null null null]>> endobj")}var y=e.internal.newObject();for(e.internal.write("<< /Names [ "),s=0;s<p.length;s++)e.internal.write("(page_"+(s+1)+")"+p[s]+" 0 R");e.internal.write(" ] >>","endobj"),t=e.internal.newObject(),e.internal.write("<< /Dests "+y+" 0 R"),e.internal.write(">>","endobj")}}]),n.events.push(["putCatalog",function(){var e=this;e.outline.root.children.length>0&&(e.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&e.internal.write("/Names "+t+" 0 R"))}]),n.events.push(["initialized",function(){var e=this;e.outline={createNamedDestinations:!1,root:{children:[]}},e.outline.add=function(r,i,s){var l={title:i,options:s,children:[]};return r==null&&(r=this.root),r.children.push(l),l},e.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=e,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},e.outline.genIds_r=function(r){r.id=e.internal.newObjectDeferred();for(var i=0;i<r.children.length;i++)this.genIds_r(r.children[i])},e.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()},e.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=e.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])},e.outline.line=function(r){this.ctx.val+=r+`\r
50
- `},e.outline.makeRef=function(r){return r.id+" 0 R"},e.outline.makeString=function(r){return"("+e.internal.pdfEscape(r)+")"},e.outline.objStart=function(r){this.ctx.val+=`\r
51
- `+r.id+` 0 obj\r
52
- <<\r
53
- `},e.outline.objEnd=function(){this.ctx.val+=`>> \r
54
- endobj\r
55
- `},e.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}}])})(dn.API),(function(n){var t=[192,193,194,195,196,197,198,199];n.processJPEG=function(e,r,i,s,l,c){var f,d=this.decode.DCT_DECODE,p=null;if(typeof e=="string"||this.__addimage__.isArrayBuffer(e)||this.__addimage__.isArrayBufferView(e)){switch(e=l||e,e=this.__addimage__.isArrayBuffer(e)?new Uint8Array(e):e,f=(function(g){for(var b,y=256*g.charCodeAt(4)+g.charCodeAt(5),M=g.length,C={width:0,height:0,numcomponents:1},L=4;L<M;L+=2){if(L+=y,t.indexOf(g.charCodeAt(L+1))!==-1){b=256*g.charCodeAt(L+5)+g.charCodeAt(L+6),C={width:256*g.charCodeAt(L+7)+g.charCodeAt(L+8),height:b,numcomponents:g.charCodeAt(L+9)};break}y=256*g.charCodeAt(L+2)+g.charCodeAt(L+3)}return C})(e=this.__addimage__.isArrayBufferView(e)?this.__addimage__.arrayBufferToBinaryString(e):e),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:e,width:f.width,height:f.height,colorSpace:c,bitsPerComponent:8,filter:d,index:r,alias:i}}return p}})(dn.API),dn.API.processPNG=function(n,t,e,r){if(this.__addimage__.isArrayBuffer(n)&&(n=new Uint8Array(n)),this.__addimage__.isArrayBufferView(n)){var i,s=IN(n,{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 it=bt.width,Lt=bt.height,J=bt.data,ct=bt.palette,G=bt.depth,vt=!1,_t=[],ht=[],Z=void 0,ut=!1,It=0,Zt=0;Zt<ct.length;Zt++){var $=Yv(ct[Zt],4),N=$[0],Q=$[1],tt=$[2],pt=$[3];_t.push(N,Q,tt),pt!=null&&(pt===0?(It++,ht.length<1&&ht.push(Zt)):pt<255&&(ut=!0))}if(ut||It>1){vt=!0,ht=void 0;var wt=it*Lt;Z=new Uint8Array(wt);for(var At=new DataView(J.buffer),Ft=0;Ft<wt;Ft++){var Rt=xy(At,Ft,G),Jt=Yv(ct[Rt],4)[3];Z[Ft]=Jt}}else It===0&&(ht=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:vt?8:void 0,colorBytes:J,alphaBytes:Z,needSMask:vt,palette:_t,mask:ht}})(s):f===2||f===4?(function(bt){for(var it=bt.data,Lt=bt.width,J=bt.height,ct=bt.channels,G=bt.depth,vt=ct===2?"DeviceGray":"DeviceRGB",_t=ct-1,ht=Lt*J,Z=_t,ut=ht*Z,It=1*ht,Zt=Math.ceil(ut*G/8),$=Math.ceil(It*G/8),N=new Uint8Array(Zt),Q=new Uint8Array($),tt=new DataView(it.buffer),pt=new DataView(N.buffer),wt=new DataView(Q.buffer),At=!1,Ft=0;Ft<ht;Ft++){for(var Rt=Ft*ct,Jt=0;Jt<Z;Jt++)Xw(pt,xy(tt,Rt+Jt,G),Ft*Z+Jt,G);var ke=xy(tt,Rt+Z,G);ke<(1<<G)-1&&(At=!0),Xw(wt,ke,1*Ft,G)}return{colorSpace:vt,colorsPerPixel:_t,sMaskBitsPerComponent:At?G:void 0,colorBytes:N,alphaBytes:Q,needSMask:At}})(s):(function(bt){var it=bt.data,Lt=bt.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:Lt,colorsPerPixel:Lt==="DeviceGray"?1:3,colorBytes:it instanceof Uint16Array?(function(J){for(var ct=J.length,G=new Uint8Array(2*ct),vt=new DataView(G.buffer,G.byteOffset,G.byteLength),_t=0;_t<ct;_t++)vt.setUint16(2*_t,J[_t],!1);return G})(it):it,needSMask:!1}})(s);var g,b,y,M=i,C=M.colorSpace,L=M.colorsPerPixel,R=M.sMaskBitsPerComponent,B=M.colorBytes,q=M.alphaBytes,V=M.needSMask,gt=M.palette,Mt=M.mask,kt=null;return r!==dn.API.image_compression.NONE&&typeof d2=="function"?(kt=(function(bt){var it;switch(bt){case dn.API.image_compression.FAST:it=11;break;case dn.API.image_compression.MEDIUM:it=13;break;case dn.API.image_compression.SLOW:it=14;break;default:it=12}return it})(r),g=this.decode.FLATE_DECODE,b="/Predictor ".concat(kt," /Colors ").concat(L," /BitsPerComponent ").concat(p," /Columns ").concat(l),n=qw(B,Math.ceil(l*L*p/8),L,p,r),V&&(y=qw(q,Math.ceil(l*R/8),1,R,r))):(g=void 0,b=void 0,n=B,V&&(y=q)),(this.__addimage__.isArrayBuffer(n)||this.__addimage__.isArrayBufferView(n))&&(n=this.__addimage__.arrayBufferToBinaryString(n)),(y&&this.__addimage__.isArrayBuffer(y)||this.__addimage__.isArrayBufferView(y))&&(y=this.__addimage__.arrayBufferToBinaryString(y)),{alias:e,data:n,index:t,filter:g,decodeParameters:b,transparency:Mt,palette:gt,sMask:y,predictor:kt,width:l,height:c,bitsPerComponent:p,sMaskBitsPerComponent:R,colorSpace:C}}},(function(n){n.processGIF89A=function(t,e,r,i){var s=new r_(t),l=s.width,c=s.height,f=[];s.decodeAndBlitFrameRGBA(0,f);var d={data:f,width:l,height:c},p=new vy(100).encode(d,100);return n.processJPEG.call(this,p,e,r,i)},n.processGIF87A=n.processGIF89A})(dn.API),sc.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 n=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(n);for(var t=0;t<n;t++){var e=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:e,quad:s}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},sc.prototype.parseBGR=function(){this.pos=this.offset;var n="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[n]()}catch(e){li.log("bit decode error:"+e)}},sc.prototype.bit1=function(){var n,t=Math.ceil(this.width/8),e=t%4;for(n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,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}e!==0&&(this.pos+=4-e)}},sc.prototype.bit4=function(){for(var n=Math.ceil(this.width/2),t=n%4,e=this.height-1;e>=0;e--){for(var r=this.bottom_up?e:this.height-1-e,i=0;i<n;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)}},sc.prototype.bit8=function(){for(var n=this.width%4,t=this.height-1;t>=0;t--){for(var e=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){var i=this.datav.getUint8(this.pos++,!0),s=e*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}n!==0&&(this.pos+=4-n)}},sc.prototype.bit15=function(){for(var n=this.width%3,t=parseInt("11111",2),e=this.height-1;e>=0;e--){for(var r=this.bottom_up?e:this.height-1-e,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+=n}},sc.prototype.bit16=function(){for(var n=this.width%3,t=parseInt("11111",2),e=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&e)/e*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+=n}},sc.prototype.bit24=function(){for(var n=this.height-1;n>=0;n--){for(var t=this.bottom_up?n:this.height-1-n,e=0;e<this.width;e++){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*e;this.data[l]=s,this.data[l+1]=i,this.data[l+2]=r,this.data[l+3]=255}this.pos+=this.width%4}},sc.prototype.bit32=function(){for(var n=this.height-1;n>=0;n--)for(var t=this.bottom_up?n:this.height-1-n,e=0;e<this.width;e++){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*e;this.data[c]=s,this.data[c+1]=i,this.data[c+2]=r,this.data[c+3]=l}},sc.prototype.getData=function(){return this.data},(function(n){n.processBMP=function(t,e,r,i){var s=new sc(t,!1),l=s.width,c=s.height,f={data:s.getData(),width:l,height:c},d=new vy(100).encode(f,100);return n.processJPEG.call(this,d,e,r,i)}})(dn.API),Kw.prototype.getData=function(){return this.data},(function(n){n.processWEBP=function(t,e,r,i){var s=new Kw(t),l=s.width,c=s.height,f={data:s.getData(),width:l,height:c},d=new vy(100).encode(f,100);return n.processJPEG.call(this,d,e,r,i)}})(dn.API),dn.API.processRGBA=function(n,t,e){for(var r=n.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:e,colorSpace:"DeviceRGB",bitsPerComponent:8,width:n.width,height:n.height}},dn.API.setLanguage=function(n){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"}[n]!==void 0&&(this.internal.languageSettings.languageCode=n,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=dn.API,Cm=_d.getCharWidthsArray=function(n,t){var e,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=n.length,M=0,C=c[0]||f,L=[];for(e=0;e<y;e++)r=n.charCodeAt(e),typeof i.metadata.widthOfString=="function"?L.push((i.metadata.widthOfGlyph(i.metadata.characterToGlyph(r))+l*(1e3/s)||0)/1e3):(b=g&&Xr(d[r])==="object"&&!isNaN(parseInt(d[r][M],10))?d[r][M]/p:0,L.push((c[r]||C)/f+b)),M=r;return L},Fw=_d.getStringUnitWidth=function(n,t){var e=(t=t||{}).fontSize||this.internal.getFontSize(),r=t.font||this.internal.getFont(),i=t.charSpace||this.internal.getCharSpace();return _d.processArabic&&(n=_d.processArabic(n)),typeof r.metadata.widthOfString=="function"?r.metadata.widthOfString(n,e,i)/e:Cm.apply(this,arguments).reduce(function(s,l){return s+l},0)},Uw=function(n,t,e,r){for(var i=[],s=0,l=n.length,c=0;s!==l&&c+t[s]<e;)c+=t[s],s++;i.push(n.slice(0,s));var f=s;for(c=0;s!==l;)c+t[s]>r&&(i.push(n.slice(f,s)),c=0,f=s),c+=t[s],s++;return f!==s&&i.push(n.slice(f,s)),i},Hw=function(n,t,e){e||(e={});var r,i,s,l,c,f,d,p=[],g=[p],b=e.textIndent||0,y=0,M=0,C=n.split(" "),L=Cm.apply(this,[" ",e])[0];if(f=e.lineIndent===-1?C[0].length+2:e.lineIndent||0){var R=Array(f).join(" "),B=[];C.map(function(V){(V=V.split(/\s*\n/)).length>1?B=B.concat(V.map(function(gt,Mt){return(Mt&&gt.length?`
56
- `:"")+gt})):B.push(V[0])}),C=B,f=Fw.apply(this,[R,e])}for(s=0,l=C.length;s<l;s++){var q=0;if(r=C[s],f&&r[0]==`
57
- `&&(r=r.substr(1),q=1),b+y+(M=(i=Cm.apply(this,[r,e])).reduce(function(V,gt){return V+gt},0))>t||q){if(M>t){for(c=Uw.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(V,gt){return V+gt},0)}else p=[r];g.push(p),b=M+f,y=L}else p.push(r),b+=y+M,y=L}return d=f?function(V,gt){return(gt?R:"")+V.join(" ")}:function(V){return V.join(" ")},g.map(d)},_d.splitTextToSize=function(n,t,e){var r,i=(e=e||{}).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,e);r=Array.isArray(n)?n:String(n).split(/\r?\n/);var l=1*this.internal.scaleFactor*t/i;s.textIndent=e.textIndent?1*e.textIndent*this.internal.scaleFactor/i:0,s.lineIndent=e.lineIndent;var c,f,d=[];for(c=0,f=r.length;c<f;c++)d=d.concat(Hw.apply(this,[r[c],l,s]));return d},(function(n){n.__fontmetrics__=n.__fontmetrics__||{};for(var t="0123456789abcdef",e="klmnopqrstuvwxyz",r={},i={},s=0;s<16;s++)r[e[s]]=t[s],i[t[s]]=e[s];var l=function(b){return"0x"+parseInt(b,10).toString(16)},c=n.__fontmetrics__.compress=function(b){var y,M,C,L,R=["{"];for(var B in b){if(y=b[B],isNaN(parseInt(B,10))?M="'"+B+"'":(B=parseInt(B,10),M=(M=l(B).slice(2)).slice(0,-1)+i[M.slice(-1)]),typeof y=="number")y<0?(C=l(y).slice(3),L="-"):(C=l(y).slice(2),L=""),C=L+C.slice(0,-1)+i[C.slice(-1)];else{if(Xr(y)!=="object")throw new Error("Don't know what to do with value type "+Xr(y)+".");C=c(y)}R.push(M+C)}return R.push("}"),R.join("")},f=n.__fontmetrics__.uncompress=function(b){if(typeof b!="string")throw new Error("Invalid argument passed to uncompress.");for(var y,M,C,L,R={},B=1,q=R,V=[],gt="",Mt="",kt=b.length-1,bt=1;bt<kt;bt+=1)(L=b[bt])=="'"?y?(C=y.join(""),y=void 0):y=[]:y?y.push(L):L=="{"?(V.push([q,C]),q={},C=void 0):L=="}"?((M=V.pop())[0][M[1]]=q,C=void 0,q=M[0]):L=="-"?B=-1:C===void 0?r.hasOwnProperty(L)?(gt+=r[L],C=parseInt(gt,16)*B,B=1,gt=""):gt+=L:r.hasOwnProperty(L)?(Mt+=r[L],q[C]=parseInt(Mt,16)*B,B=1,C=void 0,Mt=""):Mt+=L;return R},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}}}")}};n.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 C=p.Unicode[y.postScriptName];C&&(y.metadata.Unicode.encoding=C,y.encoding=C.codePages[0])}])})(dn.API),(function(n){var t=function(e){for(var r=e.length,i=new Uint8Array(r),s=0;s<r;s++)i[s]=e.charCodeAt(s);return i};n.API.events.push(["addFont",function(e){var r=void 0,i=e.font,s=e.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(Qm(c)),l.metadata=n.API.TTFFont.open(c),l.metadata.Unicode=l.metadata.Unicode||{encoding:{},kerning:{},widths:[]},l.metadata.glyIdsUsed=[0]})(i,r)}}])})(dn),dn.API.addSvgAsImage=function(n,t,e,r,i,s,l,c){if(isNaN(t)||isNaN(e))throw li.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(r)||isNaN(i))throw li.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(Gn.canvg?Promise.resolve(Gn.canvg):Q1(()=>import("./index.es-DzTwXigo.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,n,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,e,r,i,l,c)})},dn.API.putTotalPages=function(n){var t,e=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(n,"g"),e=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(n,this.internal.getFont()),"g"),e=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,e);return this},dn.API.viewerPreferences=function(n,t){var e;n=n||{},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,C){var L,R=!1;for(L=0;L<M.length;L+=1)M[L]===C&&(R=!0);return R}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(l)),this.internal.viewerpreferences.isSubscribed=!1),e=this.internal.viewerpreferences.configuration,n==="reset"||t===!0){var y=c.length;for(g=0;g<y;g+=1)e[c[g]].value=e[c[g]].defaultValue,e[c[g]].explicitSet=!1}if(Xr(n)==="object"){for(i in n)if(s=n[i],b(c,i)&&s!==void 0){if(e[i].type==="boolean"&&typeof s=="boolean")e[i].value=s;else if(e[i].type==="name"&&b(e[i].valueSet,s))e[i].value=s;else if(e[i].type==="integer"&&Number.isInteger(s))e[i].value=s;else if(e[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(" "))}e[i].value="["+f.join(" ")+"]"}else e[i].value=e[i].defaultValue;e[i].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var M,C=[];for(M in e)e[M].explicitSet===!0&&(e[M].type==="name"?C.push("/"+M+" /"+e[M].value):C.push("/"+M+" "+e[M].value));C.length!==0&&this.internal.write(`/ViewerPreferences
58
- <<
59
- `+C.join(`
60
- `)+`
61
- >>`)}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=e,this},dn.API.addMetadata=function(n,t){return this.internal.__metadata__===void 0&&(this.internal.__metadata__={metadata:n,namespaceUri:t??"http://jspdf.default.namespaceuri/",rawXml:typeof t=="boolean"&&t},this.internal.events.subscribe("putCatalog",o_),this.internal.events.subscribe("postPutResources",i_)),this},(function(n){var t=n.API,e=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 n.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 C=d();p({data:y,addLength1:!0,objectId:C}),f("endobj");var L=d();p({data:r(c.metadata.toUnicode),addLength1:!0,objectId:L}),f("endobj");var R=d();f("<<"),f("/Type /FontDescriptor"),f("/FontName /"+zd(c.fontName)),f("/FontFile2 "+C+" 0 R"),f("/FontBBox "+n.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 B=d();f("<<"),f("/Type /Font"),f("/BaseFont /"+zd(c.fontName)),f("/FontDescriptor "+R+" 0 R"),f("/W "+n.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 "+L+" 0 R"),f("/BaseFont /"+zd(c.fontName)),f("/Encoding /"+c.encoding),f("/DescendantFonts ["+B+" 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 n.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 C=d();p({data:r(c.metadata.toUnicode),addLength1:!0,objectId:C}),f("endobj");var L=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 "+n.API.PDFObject.convert(c.metadata.bbox)),f("/FontName /"+zd(c.fontName)),f("/ItalicAngle "+c.metadata.italicAngle),f("/Ascent "+c.metadata.ascender),f(">>"),f("endobj"),c.objectNumber=d();for(var R=0;R<c.metadata.hmtx.widths.length;R++)c.metadata.hmtx.widths[R]=parseInt(c.metadata.hmtx.widths[R]*(1e3/c.metadata.head.unitsPerEm));f("<</Subtype/TrueType/Type/Font/ToUnicode "+C+" 0 R/BaseFont/"+zd(c.fontName)+"/FontDescriptor "+L+" 0 R/Encoding/"+c.encoding+" /FirstChar 29 /LastChar 255 /Widths "+n.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,C=y,L="",R=0,B="",q=M[C].encoding;if(M[C].encoding!=="Identity-H")return{text:c,x:f,y:d,options:p,mutex:g};for(B=c,C=y,Array.isArray(c)&&(B=c[0]),R=0;R<B.length;R+=1)M[C].metadata.hasOwnProperty("cmap")&&(l=M[C].metadata.cmap.unicode.codeMap[B[R].charCodeAt(0)]),l||B[R].charCodeAt(0)<256&&M[C].metadata.hasOwnProperty("Unicode")?L+=B[R]:L+="";var V="";return parseInt(C.slice(1))<14||q==="WinAnsiEncoding"?V=b(L,C).split("").map(function(gt){return gt.charCodeAt(0).toString(16)}).join(""):q==="Identity-H"&&(V=e(L,M[C])),g.isHex=!0,{text:V,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}])})(dn),(function(n){var t=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};n.existsFileInVFS=function(e){return t.call(this),this.internal.vFS[e]!==void 0},n.addFileToVFS=function(e,r){return t.call(this),this.internal.vFS[e]=r,this},n.getFileFromVFS=function(e){return t.call(this),this.internal.vFS[e]!==void 0?this.internal.vFS[e]:null}})(dn.API),(function(n){n.__bidiEngine__=n.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},C={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},L=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],R=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)$/),B=!1,q=0;this.__bidiEngine__={};var V=function(J){var ct=J.charCodeAt(),G=ct>>8,vt=C[G];return vt!==void 0?g[256*vt+(255&ct)]:G===252||G===253?"AL":R.test(G)?"L":G===8?"R":"N"},gt=function(J){for(var ct,G=0;G<J.length;G++){if((ct=V(J.charAt(G)))==="L")return!1;if(ct==="R")return!0}return!1},Mt=function(J,ct,G,vt){var _t,ht,Z,ut,It=ct[vt];switch(It){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":B=!1;break;case"N":case"AN":break;case"EN":B&&(It="AN");break;case"AL":B=!0,It="R";break;case"WS":case"BN":It="N";break;case"CS":vt<1||vt+1>=ct.length||(_t=G[vt-1])!=="EN"&&_t!=="AN"||(ht=ct[vt+1])!=="EN"&&ht!=="AN"?It="N":B&&(ht="AN"),It=ht===_t?ht:"N";break;case"ES":It=(_t=vt>0?G[vt-1]:"B")==="EN"&&vt+1<ct.length&&ct[vt+1]==="EN"?"EN":"N";break;case"ET":if(vt>0&&G[vt-1]==="EN"){It="EN";break}if(B){It="N";break}for(Z=vt+1,ut=ct.length;Z<ut&&ct[Z]==="ET";)Z++;It=Z<ut&&ct[Z]==="EN"?"EN":"N";break;case"NSM":if(l&&!c){for(ut=ct.length,Z=vt+1;Z<ut&&ct[Z]==="NSM";)Z++;if(Z<ut){var Zt=J[vt],$=Zt>=1425&&Zt<=2303||Zt===64286;if(_t=ct[Z],$&&(_t==="R"||_t==="AL")){It="R";break}}}It=vt<1||(_t=ct[vt-1])==="B"?"N":G[vt-1];break;case"B":B=!1,i=!0,It=q;break;case"S":s=!0,It="N"}return It},kt=function(J,ct,G){var vt=J.split("");return G&&bt(vt,G,{hiLevel:q}),vt.reverse(),ct&&ct.reverse(),vt.join("")},bt=function(J,ct,G){var vt,_t,ht,Z,ut,It=-1,Zt=J.length,$=0,N=[],Q=q?y:b,tt=[];for(B=!1,i=!1,s=!1,_t=0;_t<Zt;_t++)tt[_t]=V(J[_t]);for(ht=0;ht<Zt;ht++){if(ut=$,N[ht]=Mt(J,tt,N,ht),vt=240&($=Q[ut][M[N[ht]]]),$&=15,ct[ht]=Z=Q[$][5],vt>0)if(vt===16){for(_t=It;_t<ht;_t++)ct[_t]=1;It=-1}else It=-1;if(Q[$][6])It===-1&&(It=ht);else if(It>-1){for(_t=It;_t<ht;_t++)ct[_t]=Z;It=-1}tt[ht]==="B"&&(ct[ht]=0),G.hiLevel|=Z}s&&(function(pt,wt,At){for(var Ft=0;Ft<At;Ft++)if(pt[Ft]==="S"){wt[Ft]=q;for(var Rt=Ft-1;Rt>=0&&pt[Rt]==="WS";Rt--)wt[Rt]=q}})(tt,ct,Zt)},it=function(J,ct,G,vt,_t){if(!(_t.hiLevel<J)){if(J===1&&q===1&&!i)return ct.reverse(),void(G&&G.reverse());for(var ht,Z,ut,It,Zt=ct.length,$=0;$<Zt;){if(vt[$]>=J){for(ut=$+1;ut<Zt&&vt[ut]>=J;)ut++;for(It=$,Z=ut-1;It<Z;It++,Z--)ht=ct[It],ct[It]=ct[Z],ct[Z]=ht,G&&(ht=G[It],G[It]=G[Z],G[Z]=ht);$=ut}$++}}},Lt=function(J,ct,G){var vt=J.split(""),_t={hiLevel:q};return G||(G=[]),bt(vt,G,_t),(function(ht,Z,ut){if(ut.hiLevel!==0&&p)for(var It,Zt=0;Zt<ht.length;Zt++)Z[Zt]===1&&(It=L.indexOf(ht[Zt]))>=0&&(ht[Zt]=L[It+1])})(vt,G,_t),it(2,vt,ct,G,_t),it(1,vt,ct,G,_t),vt.join("")};return this.__bidiEngine__.doBidiReorder=function(J,ct,G){if((function(_t,ht){if(ht)for(var Z=0;Z<_t.length;Z++)ht[Z]=Z;c===void 0&&(c=gt(_t)),d===void 0&&(d=gt(_t))})(J,ct),l||!f||d)if(l&&f&&c^d)q=c?1:0,J=kt(J,ct,G);else if(!l&&f&&d)q=c?1:0,J=Lt(J,ct,G),J=kt(J,ct);else if(!l||c||f||d){if(l&&!f&&c^d)J=kt(J,ct),c?(q=0,J=Lt(J,ct,G)):(q=1,J=Lt(J,ct,G),J=kt(J,ct));else if(l&&c&&!f&&d)q=1,J=Lt(J,ct,G),J=kt(J,ct);else if(!l&&!f&&c^d){var vt=p;c?(q=1,J=Lt(J,ct,G),q=0,p=!1,J=Lt(J,ct,G),p=vt):(q=0,J=Lt(J,ct,G),J=kt(J,ct),q=1,p=!1,J=Lt(J,ct,G),p=vt,J=kt(J,ct))}}else q=0,J=Lt(J,ct,G);else q=c?1:0,J=Lt(J,ct,G);return J},this.__bidiEngine__.setOptions=function(J){J&&(l=J.isInputVisual,f=J.isOutputVisual,c=J.isInputRtl,d=J.isOutputRtl,p=J.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"],e=new n.__bidiEngine__({isInputVisual:!0});n.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,e.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([e.doBidiReorder(i[c][0]),i[c][1],i[c][2]]):l.push([e.doBidiReorder(i[c])]);r.text=l}else r.text=e.doBidiReorder(i);e.setOptions({isInputVisual:!0})}])})(dn),dn.API.TTFFont=(function(){function n(t){var e;if(this.rawData=t,e=this.contents=new yf(t),this.contents.pos=4,e.readString(4)==="ttcf")throw new Error("TTCF not supported.");e.pos=0,this.parse(),this.subset=new v_(this),this.registerTTF()}return n.open=function(t){return new n(t)},n.prototype.parse=function(){return this.directory=new s_(this.contents),this.head=new l_(this),this.name=new h_(this),this.cmap=new A4(this),this.toUnicode={},this.hhea=new c_(this),this.maxp=new p_(this),this.hmtx=new m_(this),this.post=new f_(this),this.os2=new u_(this),this.loca=new x_(this),this.glyf=new g_(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]},n.prototype.registerTTF=function(){var t,e,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&(e=i>>16)&&(e=-(1+(65535^e))),this.italicAngle=+(e+"."+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")},n.prototype.characterToGlyph=function(t){var e;return((e=this.cmap.unicode)!=null?e.codeMap[t]:void 0)||0},n.prototype.widthOfGlyph=function(t){var e;return e=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(t).advance*e},n.prototype.widthOfString=function(t,e,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/e)||0;return l*(e/1e3)},n.prototype.lineHeight=function(t,e){var r;return e==null&&(e=!1),r=e?this.lineGap:0,(this.ascender+r-this.decender)/1e3*t},n})();var hc,yf=(function(){function n(t){this.data=t??[],this.pos=0,this.length=this.data.length}return n.prototype.readByte=function(){return this.data[this.pos++]},n.prototype.writeByte=function(t){return this.data[this.pos++]=t},n.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},n.prototype.writeUInt32=function(t){return this.writeByte(t>>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(255&t)},n.prototype.readInt32=function(){var t;return(t=this.readUInt32())>=2147483648?t-4294967296:t},n.prototype.writeInt32=function(t){return t<0&&(t+=4294967296),this.writeUInt32(t)},n.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},n.prototype.writeUInt16=function(t){return this.writeByte(t>>8&255),this.writeByte(255&t)},n.prototype.readInt16=function(){var t;return(t=this.readUInt16())>=32768?t-65536:t},n.prototype.writeInt16=function(t){return t<0&&(t+=65536),this.writeUInt16(t)},n.prototype.readString=function(t){var e,r;for(r=[],e=0;0<=t?e<t:e>t;e=0<=t?++e:--e)r[e]=String.fromCharCode(this.readByte());return r.join("")},n.prototype.writeString=function(t){var e,r,i;for(i=[],e=0,r=t.length;0<=r?e<r:e>r;e=0<=r?++e:--e)i.push(this.writeByte(t.charCodeAt(e)));return i},n.prototype.readShort=function(){return this.readInt16()},n.prototype.writeShort=function(t){return this.writeInt16(t)},n.prototype.readLongLong=function(){var t,e,r,i,s,l,c,f;return t=this.readByte(),e=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^e)+1099511627776*(255^r)+4294967296*(255^i)+16777216*(255^s)+65536*(255^l)+256*(255^c)+(255^f)+1):72057594037927940*t+281474976710656*e+1099511627776*r+4294967296*i+16777216*s+65536*l+256*c+f},n.prototype.writeLongLong=function(t){var e,r;return e=Math.floor(t/4294967296),r=4294967295&t,this.writeByte(e>>24&255),this.writeByte(e>>16&255),this.writeByte(e>>8&255),this.writeByte(255&e),this.writeByte(r>>24&255),this.writeByte(r>>16&255),this.writeByte(r>>8&255),this.writeByte(255&r)},n.prototype.readInt=function(){return this.readInt32()},n.prototype.writeInt=function(t){return this.writeInt32(t)},n.prototype.read=function(t){var e,r;for(e=[],r=0;0<=t?r<t:r>t;r=0<=t?++r:--r)e.push(this.readByte());return e},n.prototype.write=function(t){var e,r,i,s;for(s=[],r=0,i=t.length;r<i;r++)e=t[r],s.push(this.writeByte(e));return s},n})(),s_=(function(){var n;function t(e){var r,i,s;for(this.scalarType=e.readInt(),this.tableCount=e.readShort(),this.searchRange=e.readShort(),this.entrySelector=e.readShort(),this.rangeShift=e.readShort(),this.tables={},i=0,s=this.tableCount;0<=s?i<s:i>s;i=0<=s?++i:--i)r={tag:e.readString(4),checksum:e.readInt(),offset:e.readInt(),length:e.readInt()},this.tables[r.tag]=r}return t.prototype.encode=function(e){var r,i,s,l,c,f,d,p,g,b,y,M,C;for(C in y=Object.keys(e).length,f=Math.log(2),g=16*Math.floor(Math.log(y)/f),l=Math.floor(g/f),p=16*y-g,(i=new yf).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=[],e)for(b=e[C],i.writeString(C),i.writeInt(n(b)),i.writeInt(d),i.writeInt(b.length),M=M.concat(b),C==="head"&&(c=d),d+=b.length;d%4;)M.push(0),d++;return i.write(M),r=2981146554-n(i.data),i.pos=c+8,i.writeUInt32(r),i.data},n=function(e){var r,i,s,l;for(e=M4.call(e);e.length%4;)e.push(0);for(s=new yf(e),i=0,r=0,l=e.length;r<l;r=r+=4)i+=s.readUInt32();return 4294967295&i},t})(),a_={}.hasOwnProperty,Fc=function(n,t){for(var e in t)a_.call(t,e)&&(n[e]=t[e]);function r(){this.constructor=n}return r.prototype=t.prototype,n.prototype=new r,n.__super__=t.prototype,n};hc=(function(){function n(t){var e;this.file=t,e=this.file.directory.tables[this.tag],this.exists=!!e,e&&(this.offset=e.offset,this.length=e.length,this.parse(this.file.contents))}return n.prototype.parse=function(){},n.prototype.encode=function(){},n.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},n})();var l_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Fc(n,hc),n.prototype.tag="head",n.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()},n.prototype.encode=function(t){var e;return(e=new yf).writeInt(this.version),e.writeInt(this.revision),e.writeInt(this.checkSumAdjustment),e.writeInt(this.magicNumber),e.writeShort(this.flags),e.writeShort(this.unitsPerEm),e.writeLongLong(this.created),e.writeLongLong(this.modified),e.writeShort(this.xMin),e.writeShort(this.yMin),e.writeShort(this.xMax),e.writeShort(this.yMax),e.writeShort(this.macStyle),e.writeShort(this.lowestRecPPEM),e.writeShort(this.fontDirectionHint),e.writeShort(t),e.writeShort(this.glyphDataFormat),e.data},n})(),Jw=(function(){function n(t,e){var r,i,s,l,c,f,d,p,g,b,y,M,C,L,R,B,q;switch(this.platformID=t.readUInt16(),this.encodingID=t.readShort(),this.offset=e+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 V,gt;for(gt=[],f=V=0;0<=b?V<b:V>b;f=0<=b?++V:--V)gt.push(t.readUInt16());return gt})(),t.pos+=2,C=(function(){var V,gt;for(gt=[],f=V=0;0<=b?V<b:V>b;f=0<=b?++V:--V)gt.push(t.readUInt16());return gt})(),d=(function(){var V,gt;for(gt=[],f=V=0;0<=b?V<b:V>b;f=0<=b?++V:--V)gt.push(t.readUInt16());return gt})(),p=(function(){var V,gt;for(gt=[],f=V=0;0<=b?V<b:V>b;f=0<=b?++V:--V)gt.push(t.readUInt16());return gt})(),i=(this.length-t.pos+this.offset)/2,c=(function(){var V,gt;for(gt=[],f=V=0;0<=i?V<i:V>i;f=0<=i?++V:--V)gt.push(t.readUInt16());return gt})(),f=R=0,q=s.length;R<q;f=++R)for(L=s[f],r=B=M=C[f];M<=L?B<=L:B>=L;r=M<=L?++B:--B)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 n.encode=function(t,e){var r,i,s,l,c,f,d,p,g,b,y,M,C,L,R,B,q,V,gt,Mt,kt,bt,it,Lt,J,ct,G,vt,_t,ht,Z,ut,It,Zt,$,N,Q,tt,pt,wt,At,Ft,Rt,Jt,ke,Re;switch(vt=new yf,l=Object.keys(t).sort(function(Ie,Ve){return Ie-Ve}),e){case"macroman":for(C=0,L=(function(){var Ie=[];for(M=0;M<256;++M)Ie.push(0);return Ie})(),B={0:0},s={},_t=0,It=l.length;_t<It;_t++)B[Rt=t[i=l[_t]]]==null&&(B[Rt]=++C),s[i]={old:t[i],new:B[t[i]]},L[i]=B[t[i]];return vt.writeUInt16(1),vt.writeUInt16(0),vt.writeUInt32(12),vt.writeUInt16(0),vt.writeUInt16(262),vt.writeUInt16(0),vt.write(L),{charMap:s,subtable:vt.data,maxGlyphID:C+1};case"unicode":for(ct=[],g=[],q=0,B={},r={},R=d=null,ht=0,Zt=l.length;ht<Zt;ht++)B[gt=t[i=l[ht]]]==null&&(B[gt]=++q),r[i]={old:gt,new:B[gt]},c=B[gt]-i,R!=null&&c===d||(R&&g.push(R),ct.push(i),d=c),R=i;for(R&&g.push(R),g.push(65535),ct.push(65535),Lt=2*(it=ct.length),bt=2*Math.pow(Math.log(it)/Math.LN2,2),b=Math.log(bt/2)/Math.LN2,kt=2*it-bt,f=[],Mt=[],y=[],M=Z=0,$=ct.length;Z<$;M=++Z){if(J=ct[M],p=g[M],J===65535){f.push(0),Mt.push(0);break}if(J-(G=r[J].new)>=32768)for(f.push(0),Mt.push(2*(y.length+it-M)),i=ut=J;J<=p?ut<=p:ut>=p;i=J<=p?++ut:--ut)y.push(r[i].new);else f.push(G-J),Mt.push(0)}for(vt.writeUInt16(3),vt.writeUInt16(1),vt.writeUInt32(12),vt.writeUInt16(4),vt.writeUInt16(16+8*it+2*y.length),vt.writeUInt16(0),vt.writeUInt16(Lt),vt.writeUInt16(bt),vt.writeUInt16(b),vt.writeUInt16(kt),At=0,N=g.length;At<N;At++)i=g[At],vt.writeUInt16(i);for(vt.writeUInt16(0),Ft=0,Q=ct.length;Ft<Q;Ft++)i=ct[Ft],vt.writeUInt16(i);for(Jt=0,tt=f.length;Jt<tt;Jt++)c=f[Jt],vt.writeUInt16(c);for(ke=0,pt=Mt.length;ke<pt;ke++)V=Mt[ke],vt.writeUInt16(V);for(Re=0,wt=y.length;Re<wt;Re++)C=y[Re],vt.writeUInt16(C);return{charMap:r,subtable:vt.data,maxGlyphID:q+1}}},n})(),A4=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Fc(n,hc),n.prototype.tag="cmap",n.prototype.parse=function(t){var e,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)e=new Jw(t,this.offset),this.tables.push(e),e.isUnicode&&this.unicode==null&&(this.unicode=e);return!0},n.encode=function(t,e){var r,i;return e==null&&(e="macroman"),r=Jw.encode(t,e),(i=new yf).writeUInt16(0),i.writeUInt16(1),r.table=i.data.concat(r.subtable),r},n})(),c_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Fc(n,hc),n.prototype.tag="hhea",n.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()},n})(),u_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Fc(n,hc),n.prototype.tag="OS/2",n.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 e,r;for(r=[],e=0;e<10;++e)r.push(t.readByte());return r})(),this.charRange=(function(){var e,r;for(r=[],e=0;e<4;++e)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 e,r;for(r=[],e=0;e<2;e=++e)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()},n})(),f_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Fc(n,hc),n.prototype.tag="post",n.prototype.parse=function(t){var e,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;)e=t.readByte(),i.push(this.names.push(t.readString(e)));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)}},n})(),d_=function(n,t){this.raw=n,this.length=n.length,this.platformID=t.platformID,this.encodingID=t.encodingID,this.languageID=t.languageID},h_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Fc(n,hc),n.prototype.tag="name",n.prototype.parse=function(t){var e,r,i,s,l,c,f,d,p,g,b;for(t.pos=this.offset,t.readShort(),e=t.readShort(),c=t.readShort(),r=[],s=0;0<=e?s<e:s>e;s=0<=e?++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 d_(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]},n})(),p_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Fc(n,hc),n.prototype.tag="maxp",n.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()},n})(),m_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Fc(n,hc),n.prototype.tag="hmtx",n.prototype.parse=function(t){var e,r,i,s,l,c,f;for(t.pos=this.offset,this.metrics=[],e=0,c=this.file.hhea.numberOfMetrics;0<=c?e<c:e>c;e=0<=c?++e:--e)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=[],e=d=0;0<=i?d<i:d>i;e=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=[],e=l=0;0<=i?l<i:l>i;e=0<=i?++l:--l)f.push(this.widths.push(r));return f},n.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]}},n})(),M4=[].slice,g_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Fc(n,hc),n.prototype.tag="glyf",n.prototype.parse=function(){return this.cache={}},n.prototype.glyphFor=function(t){var e,r,i,s,l,c,f,d,p,g;return t in this.cache?this.cache[t]:(s=this.file.loca,e=this.file.contents,r=s.indexOf(t),(i=s.lengthOf(t))===0?this.cache[t]=null:(e.pos=this.offset+r,l=(c=new yf(e.read(i))).readShort(),d=c.readShort(),g=c.readShort(),f=c.readShort(),p=c.readShort(),this.cache[t]=l===-1?new b_(c,d,g,f,p):new y_(c,l,d,g,f,p),this.cache[t]))},n.prototype.encode=function(t,e,r){var i,s,l,c,f;for(l=[],s=[],c=0,f=e.length;c<f;c++)i=t[e[c]],s.push(l.length),i&&(l=l.concat(i.encode(r)));return s.push(l.length),{table:l,offsets:s}},n})(),y_=(function(){function n(t,e,r,i,s,l){this.raw=t,this.numberOfContours=e,this.xMin=r,this.yMin=i,this.xMax=s,this.yMax=l,this.compound=!1}return n.prototype.encode=function(){return this.raw.data},n})(),b_=(function(){function n(t,e,r,i,s){var l,c;for(this.raw=t,this.xMin=e,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 n.prototype.encode=function(){var t,e,r;for(e=new yf(M4.call(this.raw.data)),t=0,r=this.glyphIDs.length;t<r;++t)e.pos=this.glyphOffsets[t];return e.data},n})(),x_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Fc(n,hc),n.prototype.tag="loca",n.prototype.parse=function(t){var e,r;return t.pos=this.offset,e=this.file.head.indexToLocFormat,this.offsets=e===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)},n.prototype.indexOf=function(t){return this.offsets[t]},n.prototype.lengthOf=function(t){return this.offsets[t+1]-this.offsets[t]},n.prototype.encode=function(t,e){for(var r=new Uint32Array(this.offsets.length),i=0,s=0,l=0;l<r.length;++l)if(r[l]=i,s<e.length&&e[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},n})(),v_=(function(){function n(t){this.font=t,this.subset={},this.unicodes={},this.next=33}return n.prototype.generateCmap=function(){var t,e,r,i,s;for(e in i=this.font.cmap.tables[0].codeMap,t={},s=this.subset)r=s[e],t[e]=i[r];return t},n.prototype.glyphsFor=function(t){var e,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 e=[],i)(r=i[s])!=null&&r.compound&&e.push.apply(e,r.glyphIDs);if(e.length>0)for(s in f=this.glyphsFor(e))r=f[s],i[s]=r;return i},n.prototype.encode=function(t,e){var r,i,s,l,c,f,d,p,g,b,y,M,C,L,R;for(i in r=A4.encode(this.generateCmap(),"unicode"),l=this.glyphsFor(t),y={0:0},R=r.charMap)y[(f=R[i]).old]=f.new;for(M in b=r.maxGlyphID,l)M in y||(y[M]=b++);return p=(function(B){var q,V;for(q in V={},B)V[B[q]]=q;return V})(y),g=Object.keys(p).sort(function(B,q){return B-q}),C=(function(){var B,q,V;for(V=[],B=0,q=g.length;B<q;B++)c=g[B],V.push(p[c]);return V})(),s=this.font.glyf.encode(l,C,y),d=this.font.loca.encode(s.offsets,C),L={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(e)},this.font.os2.exists&&(L["OS/2"]=this.font.os2.raw()),this.font.directory.encode(L)},n})();dn.API.PDFObject=(function(){var n;function t(){}return n=function(e,r){return(Array(r+1).join("0")+e).slice(-r)},t.convert=function(e){var r,i,s,l;if(Array.isArray(e))return"["+(function(){var c,f,d;for(d=[],c=0,f=e.length;c<f;c++)r=e[c],d.push(t.convert(r));return d})().join(" ")+"]";if(typeof e=="string")return"/"+e;if(e?.isString)return"("+e+")";if(e instanceof Date)return"(D:"+n(e.getUTCFullYear(),4)+n(e.getUTCMonth(),2)+n(e.getUTCDate(),2)+n(e.getUTCHours(),2)+n(e.getUTCMinutes(),2)+n(e.getUTCSeconds(),2)+"Z)";if({}.toString.call(e)==="[object Object]"){for(i in s=["<<"],e)l=e[i],s.push("/"+i+" "+t.convert(l));return s.push(">>"),s.join(`
86
- `)}return""+e},t})();const w_=new Set(["point","polygon","polyline","rectangle","ellipse","arrow","compass","numbering","image"]);function Zw(n){return w_.has(n.anchor.type)}function Em(n,t){if(n.anchor.type!=="linked")return n.anchor;const{pinId:e}=n.anchor,r=t.find(i=>i.id===e);return!r||r.anchor.type==="linked"?null:r.anchor}function v2(n,t){if(n.anchor.type!=="linked")return n;const{pinId:e}=n.anchor,r=t.find(i=>i.id===e);return r&&r.anchor.type!=="linked"?r:null}function v5(n,t){return t.filter(e=>e.anchor.type==="linked"&&e.anchor.pinId===n).map(e=>e.id)}function S_(n,t){return new Set([n,...v5(n,t)])}const k_="1.16.2",Oa=["#FBD710","#F0462F","#FF8D28","#4FD553","#00C0E8","#0088FF","#E246A1","#FFFFFF","#A0522D","#888888","#000000"],A_="small",M_={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}},uh=M_[A_],w2=uh.maxLogicalImageSize,Tm=uh.minZoom,Nm=uh.maxZoom,Qw=uh.zoomWheelFactor,_m=uh.zoomPrecision,ti=uh.contourScale,w5=1/1.25,C4=ti*w5,E4=280*ti,S2=100*ti,tS=12*ti,eS=12*ti,Yh=3*ti,ig=1*ti,nS=1*ti,rS=2*ti,iS=1*ti,oS="rgba(0,0,0,0.45)",T4=2.5*ti,Rf=2.5*ti,rl=.25,Eu=4,v0=.25,S5=1,C_=.5,E_=.6,Hf="solid",yp="filled",T_="44",Bf=[5*ti,3*ti],k2=4*ti,N4=60*ti,Vs=20,A2="iso";function Dm(n){return n.toString().padStart(2,"0")}function Bd(n=new Date,t=A2){const e=n.getFullYear(),r=Dm(n.getMonth()+1),i=Dm(n.getDate()),s=Dm(n.getHours()),l=Dm(n.getMinutes());return t==="ua_full"?`${i}.${r}.${e} ${s}:${l}`:`${e}-${r}-${i} ${s}:${l}`}const tf="#E63946",_4=3*ti,M2=2*ti,C2=7*ti,D4=0,yg=1.4,N_="image/png,image/jpeg,image/svg+xml,image/webp,image/gif,image/avif,image/bmp",__=["PNG","JPG","SVG","WebP","GIF","AVIF","BMP"],D_=2,L_=40,R_=4,O_=48,P_="blur",I_=.5,j_=.05,Lm=12,wy=200*ti,Rm=16,L4=10*ti,z_=.1,B_="#ffffff",F_="#000000",Sy="<p>Текст</p>",E2=6,U_=5,bg=1,sS=4,H_=18;function Yd(){return typeof navigator>"u"?"Ctrl+V":/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"⌘+V":"Ctrl+V"}function od(n){return typeof n!="number"||!Number.isFinite(n)?S5:Math.min(Eu,Math.max(rl,n))}function aS(n,t){return od(n.strokeWidthScale??od(t))}function w0(n){return od(n).toFixed(2).replace(/\.?0+$/,"")}function R4(n){const t=1+(od(n)-1)*C_;return Math.max(E_,t)}function O4(n){return n.type!=="text"}const P4=!1,I4="tyts-app-settings",T2={fontId:"road-ui",strokeWidthScale:S5,calloutPanelCollapsed:!1},q_="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif";function $_(n){return`${n==="uaf-sans"&&P4?"'UAF Sans'":"'Road UI'"}, ${q_}`}function Y_(n){return n==="road-ui"?n:T2.fontId}function V_(){try{const n=localStorage.getItem(I4);if(!n)return{...T2};const t=JSON.parse(n);return{fontId:Y_(t.fontId),strokeWidthScale:od(t.strokeWidthScale),calloutPanelCollapsed:t.calloutPanelCollapsed===!0}}catch{}return{...T2}}function Om(n){localStorage.setItem(I4,JSON.stringify(n))}function W_(){const[n,t]=H.useState(()=>V_()),e=H.useMemo(()=>$_(n.fontId),[n.fontId]);H.useEffect(()=>{document.documentElement.style.setProperty("--tyts-font-family",e),document.body.style.fontFamily=e},[e]);const r=H.useCallback(c=>{t(f=>{const d={...f,fontId:c};return Om(d),d})},[]),i=H.useCallback(c=>{t(f=>{const d={...f,strokeWidthScale:od(c)};return Om(d),d})},[]),s=H.useCallback(c=>{t(f=>{if(f.calloutPanelCollapsed===c)return f;const d={...f,calloutPanelCollapsed:c};return Om(d),d})},[]),l=H.useCallback(()=>{t(c=>{const f={...c,calloutPanelCollapsed:!c.calloutPanelCollapsed};return Om(f),f})},[]);return{settings:n,fontFamily:e,setFontId:r,setStrokeWidthScale:i,setCalloutPanelCollapsed:s,toggleCalloutPanelCollapsed:l}}const X_=[{id:"road-ui",label:"Road UI"}];function G_({open:n,fontId:t,fontFamily:e,strokeWidthScale:r,onClose:i,onFontIdChange:s,onStrokeWidthScaleChange:l}){if(!n)return null;const c=(r-rl)/(Eu-rl)*100;return E.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:i,children:E.jsxs("div",{onClick:f=>f.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:e},children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:14},children:[E.jsx("h2",{id:"tyts-settings-title",style:{margin:0,fontSize:15,fontWeight:800,color:"#fff"},children:"Налаштування"}),E.jsx("button",{type:"button",onClick:i,style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.65)",cursor:"pointer",fontSize:20,lineHeight:1,padding:0},title:"Закрити","aria-label":"Закрити",children:"×"})]}),E.jsxs("fieldset",{style:{border:"none",margin:0,padding:0},children:[E.jsx("legend",{style:{fontSize:12,fontWeight:600,color:"rgba(255,255,255,0.75)",marginBottom:8},children:"Шрифт"}),E.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:X_.map(f=>E.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:8,cursor:"pointer",background:t===f.id?"rgba(255,255,255,0.08)":"transparent",border:`1px solid ${t===f.id?"rgba(255,255,255,0.2)":"rgba(255,255,255,0.08)"}`,fontFamily:f.id==="uaf-sans"?"'UAF Sans', sans-serif":"'Road UI', sans-serif",fontSize:14},children:[E.jsx("input",{type:"radio",name:"tyts-font",value:f.id,checked:t===f.id,onChange:()=>s(f.id)}),f.label]},f.id))})]}),E.jsxs("fieldset",{style:{border:"none",margin:"16px 0 0",padding:0},children:[E.jsx("legend",{style:{fontSize:12,fontWeight:600,color:"rgba(255,255,255,0.75)",marginBottom:8},children:"Товщина ліній"}),E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[E.jsx("input",{type:"range",min:rl,max:Eu,step:v0,value:r,"aria-label":"Товщина ліній",onChange:f=>l(Number(f.target.value)),className:"tyts-range",style:{flex:1,"--tyts-range-accent":tf,"--tyts-range-fill":`${c}%`}}),E.jsxs("span",{style:{minWidth:42,textAlign:"right",fontVariantNumeric:"tabular-nums",fontSize:13},children:["×",w0(r)]}),E.jsx("button",{type:"button",onClick:()=>l(S5),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:"Скинути"})]}),E.jsx("p",{style:{margin:"8px 0 0",fontSize:11,lineHeight:1.4,color:"rgba(255,255,255,0.45)"},children:"Діє на контури, лінії-виноски й маркери. Обʼєкти з власною товщиною лишаються незмінними."})]})]})})}const j4=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],K_=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"];function J_(n){return(n.getDay()+6)%7}function Ff(n){return new Date(n.getFullYear(),n.getMonth(),1)}function N2(n,t){const e=n.getFullYear(),r=n.getMonth()+t,i=n.getDate(),s=new Date(e,r+1,0).getDate();return new Date(e,r,Math.min(i,s),n.getHours(),n.getMinutes(),0,0)}function lS(n,t){return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()}function _2(n,t,e){return Number.isFinite(n)?Math.min(e,Math.max(t,Math.trunc(n))):t}function Z_(n,t){const e=new Date(n,t,1),r=new Date(n,t+1,0).getDate(),i=J_(e),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(n,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 Q_(n){const t=Ff(n);return[N2(t,-1),t,N2(t,1)]}function t8(n){const t=n.getMonth(),e=j4[t];return t===0||t===11?`${e} ${n.getFullYear()}`:e}function D2(n,t,e){return new Date(n.getFullYear(),n.getMonth(),n.getDate(),_2(t,0,23),_2(e,0,59),0,0)}function e8(n,t){return D2(t,n.getHours(),n.getMinutes())}function n8({monthDate:n,value:t,today:e,onSelectDay:r}){const i=n.getFullYear(),s=n.getMonth(),l=H.useMemo(()=>Z_(i,s),[i,s]);return E.jsxs("div",{style:{minWidth:168,flex:"1 1 168px"},children:[E.jsx("div",{style:{textAlign:"center",fontSize:12,fontWeight:600,color:"#cfd3dc",marginBottom:6,textTransform:"capitalize"},children:t8(n)}),E.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2,marginBottom:4},children:K_.map(c=>E.jsx("div",{style:{textAlign:"center",fontSize:10,color:"rgba(255,255,255,0.45)",padding:"2px 0"},children:c},c))}),E.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2},children:l.map((c,f)=>{if(!c.date||c.day==null)return E.jsx("div",{style:{height:24}},`empty-${f}`);const d=lS(c.date,t),p=lS(c.date,e);return E.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 cS({id:n,label:t,value:e,min:r,max:i,onChange:s}){const[l,c]=H.useState(null),f=l!==null,d=f?l:jh(e),p=b=>{const y=b.replace(/\D/g,"");if(y===""){c(null);return}const M=_2(Number(y),r,i);s(M),c(null)},g=b=>{const y=i-r+1,M=((e-r+b)%y+y)%y+r;s(M),f&&c(jh(M))};return E.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:[E.jsx("label",{htmlFor:n,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"},children:t}),E.jsx("input",{id:n,className:"tyts-time-input",type:"text",inputMode:"numeric",autoComplete:"off",spellCheck:!1,value:d,onFocus:()=>c(jh(e)),onBlur:()=>p(l??jh(e)),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??jh(e)),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"}}),E.jsxs("div",{style:{display:"flex",flexDirection:"column",borderLeft:"1px solid rgba(255,255,255,0.1)",width:20},children:[E.jsx("button",{type:"button",tabIndex:-1,title:`${t}: +1`,onMouseDown:b=>b.preventDefault(),onClick:()=>g(1),style:dS,children:E.jsx("i",{className:"bi bi-chevron-up",style:{fontSize:9,lineHeight:1},"aria-hidden":!0})}),E.jsx("button",{type:"button",tabIndex:-1,title:`${t}: -1`,onMouseDown:b=>b.preventDefault(),onClick:()=>g(-1),style:{...dS,borderTop:"1px solid rgba(255,255,255,0.1)"},children:E.jsx("i",{className:"bi bi-chevron-down",style:{fontSize:9,lineHeight:1},"aria-hidden":!0})})]})]})}function r8({year:n,selected:t,today:e,onSelectMonth:r}){return E.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(120px, 1fr))",gap:8,minWidth:400,marginBottom:12},children:j4.map((i,s)=>{const l=t.getFullYear()===n&&t.getMonth()===s,c=e.getFullYear()===n&&e.getMonth()===s;return E.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 i8({value:n,viewMonth:t,format:e,locked:r,onChange:i,onViewMonthChange:s,onFormatChange:l,onLockedChange:c,onInsert:f,onNow:d,onClose:p}){const g=H.useId(),b=H.useId(),y=H.useMemo(()=>new Date,[]),M=H.useMemo(()=>Q_(t),[t]),C=Bd(n,e),[L,R]=H.useState(!1),[B,q]=H.useState(()=>t.getFullYear()),V=L?B:t.getFullYear();H.useEffect(()=>{const bt=it=>{if(it.key==="Escape"){if(it.preventDefault(),it.stopPropagation(),L){R(!1);return}p()}};return window.addEventListener("keydown",bt,!0),()=>window.removeEventListener("keydown",bt,!0)},[p,L]);const gt=()=>{q(t.getFullYear()),R(!0)},Mt=bt=>{if(L){q(it=>it+bt);return}s(N2(t,bt))},kt=bt=>{s(Ff(new Date(B,bt,1))),R(!1)};return E.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:[E.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:10},children:[E.jsx("button",{type:"button",title:L?"Попередній рік":"Попередній місяць",onClick:()=>Mt(-1),style:fS,children:E.jsx("i",{className:"bi bi-chevron-left","aria-hidden":!0})}),E.jsx("button",{type:"button",title:L?"Закрити вибір місяця":"Показати всі місяці року",onClick:()=>{L?R(!1):gt()},style:{border:"none",background:"transparent",color:"#e8eaed",fontSize:15,fontWeight:700,fontFamily:"inherit",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"4px 10px",borderRadius:6,textDecoration:L?"underline":"none",textUnderlineOffset:3},children:V}),E.jsx("button",{type:"button",title:L?"Наступний рік":"Наступний місяць",onClick:()=>Mt(1),style:fS,children:E.jsx("i",{className:"bi bi-chevron-right","aria-hidden":!0})})]}),L?E.jsx(r8,{year:B,selected:t,today:y,onSelectMonth:kt}):E.jsx("div",{style:{display:"flex",gap:12,flexWrap:"wrap",marginBottom:12},children:M.map(bt=>E.jsx(n8,{monthDate:bt,value:n,today:y,onSelectDay:it=>i(e8(n,it))},`${bt.getFullYear()}-${bt.getMonth()}`))}),E.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:[E.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("span",{style:{fontSize:12,color:"rgba(255,255,255,0.65)"},children:"Час"}),E.jsx(cS,{id:g,label:"Години",value:n.getHours(),min:0,max:23,onChange:bt=>i(D2(n,bt,n.getMinutes()))}),E.jsx("span",{style:{opacity:.6,fontWeight:600},children:":"}),E.jsx(cS,{id:b,label:"Хвилини",value:n.getMinutes(),min:0,max:59,onChange:bt=>i(D2(n,n.getHours(),bt))})]}),E.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[E.jsx("span",{style:{fontSize:12,color:"rgba(255,255,255,0.65)"},children:"Формат"}),E.jsx(uS,{active:e==="iso",label:"ISO",onClick:()=>l("iso")}),E.jsx(uS,{active:e==="ua_full",label:"UA",onClick:()=>l("ua_full")})]}),E.jsx(o8,{locked:r,onToggle:()=>c(!r)}),E.jsx("button",{type:"button",onClick:d,style:{...s8,marginLeft:"auto"},children:"Зараз"})]}),E.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:[E.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.55)",fontVariantNumeric:"tabular-nums"},children:C}),E.jsx("button",{type:"button",onClick:f,style:a8,children:"Вставити"})]})]})}function uS({active:n,label:t,onClick:e}){return E.jsx("button",{type:"button",onClick:e,style:{border:n?"1px solid rgba(230,57,70,0.55)":"1px solid rgba(255,255,255,0.12)",background:n?"rgba(230,57,70,0.18)":"rgba(255,255,255,0.04)",color:n?"#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 o8({locked:n,onToggle:t}){const[e,r]=H.useState(!1),i=n?"Дата й час зафіксовані — основна кнопка «Дата/час» вставляє їх. Натисніть, щоб зняти фіксацію":"Зафіксувати дату й час: основна кнопка «Дата/час» вставлятиме їх замість поточного моменту";return E.jsxs("span",{style:{position:"relative",display:"inline-flex"},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[E.jsx("button",{type:"button",onClick:t,"aria-pressed":n,"aria-label":n?"Зняти фіксацію дати й часу":"Зафіксувати дату й час",style:{width:30,height:30,boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:6,border:n?"1px solid rgba(230,57,70,0.55)":"1px solid rgba(255,255,255,0.12)",background:n?"rgba(230,57,70,0.18)":"rgba(255,255,255,0.04)",color:n?"#ffc2c8":"#ccc",cursor:"pointer",padding:0},children:E.jsx("i",{className:`bi ${n?"bi-lock-fill":"bi-unlock"}`,style:{fontSize:14},"aria-hidden":!0})}),e&&E.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 jh(n){return n.toString().padStart(2,"0")}const fS={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"},dS={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},s8={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"},a8={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"},l8=20,ky=12,c8=12;function u8(n,t,e){if(n.length===0)return{};const i=E4,s=S2,l=l8,c=Math.max(0,e-2*l),f=Math.max(1,Math.floor((c+ky)/(s+ky))),d={};return n.forEach((p,g)=>{const b=Math.floor(g/f),y=g%f;let M=t-l-i-b*(i+c8),C=l+y*(s+ky);M=Math.max(l,Math.min(M,t-i-l)),C=Math.max(l,Math.min(C,e-s-l)),d[p]={x:M,y:C,width:i,height:s}}),d}function f8(n,t){const e=Math.min(w2/n,w2/t,Number.POSITIVE_INFINITY);return{w:Math.round(n*e),h:Math.round(t*e)}}function k5(n,t,e,r){const i=Math.max(1,e.width),s=Math.max(1,e.height);return{x:(n-e.x)*(r.w/i),y:(t-e.y)*(r.h/s)}}function hS(n,t,e){const r=(i,s)=>k5(i,s,t,e);switch(n.type){case"linked":return n;case"point":case"standalone":return{...n,...r(n.x,n.y)};case"text":{const i=r(n.x,n.y),s=Math.max(1,t.width),l=Math.max(1,t.height);return{...n,x:i.x,y:i.y,width:n.width*(e.w/s),height:n.height*(e.h/l),...n.point?{point:r(n.point.x,n.point.y)}:{}}}case"image":case"redact":case"rectangle":{const i=r(n.x,n.y),s=Math.max(1,t.width),l=Math.max(1,t.height);return{...n,x:i.x,y:i.y,width:n.width*(e.w/s),height:n.height*(e.h/l)}}case"ellipse":{const i=r(n.cx,n.cy),s=Math.max(1,t.width),l=Math.max(1,t.height);return{...n,cx:i.x,cy:i.y,rx:n.rx*(e.w/s),ry:n.ry*(e.h/l)}}case"compass":{const i=r(n.cx,n.cy),s=Math.max(1,t.width),l=Math.max(1,t.height),c=Math.min(e.w/s,e.h/l);return{...n,cx:i.x,cy:i.y,radius:n.radius*c}}case"polygon":case"polyline":return{...n,points:n.points.map(i=>r(i.x,i.y))};case"numbering":case"arrow":{const i=r(n.start.x,n.start.y),s=r(n.end.x,n.end.y);if(n.type==="numbering")return{...n,start:i,end:s};const l=r(n.control.x,n.control.y);return{...n,start:i,end:s,control:l}}default:return n}}function pS(n){switch(n.type){case"linked":return{x:0,y:0,w:0,h:0};case"point":case"standalone":return{x:n.x,y:n.y,w:0,h:0};case"text":case"image":case"redact":case"rectangle":return{x:n.x,y:n.y,w:n.width,h:n.height};case"ellipse":return{x:n.cx-n.rx,y:n.cy-n.ry,w:n.rx*2,h:n.ry*2};case"compass":return{x:n.cx-n.radius,y:n.cy-n.radius,w:n.radius*2,h:n.radius*2};case"polygon":case"polyline":{if(n.points.length===0)return{x:0,y:0,w:0,h:0};const t=n.points.map(s=>s.x),e=n.points.map(s=>s.y),r=Math.min(...t),i=Math.min(...e);return{x:r,y:i,w:Math.max(...t)-r,h:Math.max(...e)-i}}case"numbering":case"arrow":{const t=[n.start.x,n.end.x],e=[n.start.y,n.end.y];n.type==="arrow"&&(t.push(n.control.x),e.push(n.control.y));const r=Math.min(...t),i=Math.min(...e);return{x:r,y:i,w:Math.max(...t)-r,h:Math.max(...e)-i}}default:return n}}function d8(n,t){const e=n.x+n.w,r=n.y+n.h,i=t.x+t.w,s=t.y+t.h;return n.x<=i&&e>=t.x&&n.y<=s&&r>=t.y}function Pm(n,t){return d8(n,{x:0,y:0,w:t.w,h:t.h})}function mS(n,t,e){const r=k5(n.x,n.y,t,e),i=Math.max(1,t.width),s=Math.max(1,t.height);return{x:r.x,y:r.y,width:n.width*(e.w/i),height:n.height*(e.h/s)}}function h8(n,t,e,r){const i=[],s={},l=new Set;for(const c of n){if(c.anchor.type==="linked")continue;const f=hS(c.anchor,e,r),d=t[c.id],p=d?mS(d,e,r):null;(Pm(pS(f),r)||p!==null&&Pm({x:p.x,y:p.y,w:p.width,h:p.height},r))&&l.add(c.id)}for(const c of n){if(c.anchor.type==="linked"&&!l.has(c.anchor.pinId))continue;const f=hS(c.anchor,e,r),d=pS(f),p=c.anchor.type==="linked"?!0:Pm(d,r),g=t[c.id],b=g?mS(g,e,r):null,y=b?Pm({x:b.x,y:b.y,w:b.width,h:b.height},r):!1;if(!p&&!y)continue;const M=c.leaderPoints?.map(C=>k5(C.x,C.y,e,r));i.push(M?{...c,anchor:f,leaderPoints:M}:{...c,anchor:f}),b&&(s[c.id]=b)}return{pins:i,cardPositions:s}}function L2(n){const e=(n||"").replace(/<br\s*\/?>/gi,`
87
- `).replace(/<\/p>/gi,`
88
- `).replace(/<\/div>/gi,`
89
- `).replace(/<[^>]+>/g,"").split(`
90
- `);for(;e.length>1&&e[e.length-1].trim()==="";)e.pop();return e}function z4(n,t){const e=t*yg;return Math.ceil(n*e+bg*2)}function p8(n,t,e){const r=L2(n),i=e?.fontSize??Vs,s=E2*2+bg*2,l=Math.max(1,...r.map(d=>Math.ceil(t(d||" ")))),c=Math.max(24,l+s),f=Math.max(H_,z4(r.length,i));return{width:c,height:f}}const m8=4e3,g8=1;function B4(n,t){return n.b===t.b&&n.i===t.i&&n.u===t.u&&n.s===t.s&&n.fs===t.fs}function y8(n){n.querySelectorAll("script,style,iframe,object,embed,img,svg,link,video,audio,source").forEach(t=>t.remove()),n.querySelectorAll("*").forEach(t=>{for(const e of Array.from(t.attributes))e.name.toLowerCase().startsWith("on")&&t.removeAttribute(e.name)})}function b8(n){n.querySelectorAll("p,div,h1,h2,h3,h4,h5,h6,li,blockquote,pre").forEach(t=>{t.firstChild||t.appendChild(document.createElement("br"))})}function x8(n){return["width:100%",`font-size:${n.fontSize}px`,`line-height:${n.lineHeight}`,`font-family:${n.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 v8(n){const{html:t,width:e,metrics:r}=n;if(typeof document>"u"||!document.body||!t||!(e>0))return null;const i=document.createElement("div");i.setAttribute("aria-hidden","true"),i.style.cssText=`position:absolute;left:-99999px;top:0;width:${e}px;visibility:hidden;pointer-events:none;`;const s=document.createElement("div");s.style.cssText=x8(n),s.innerHTML=t,y8(s),b8(s),i.appendChild(s),document.body.appendChild(i);try{const l=s.getBoundingClientRect();if(!(l.height>0))return null;const c=new Map,f=R=>{const B=c.get(R);if(B)return B;const q=getComputedStyle(R),V=Number.parseFloat(q.fontSize);let gt=!1,Mt=!1;for(let bt=R;bt;bt=bt.parentElement){const it=getComputedStyle(bt).textDecorationLine||"";if(it.includes("underline")&&(gt=!0),it.includes("line-through")&&(Mt=!0),bt===s)break}const kt={b:(Number.parseInt(q.fontWeight,10)||400)>=600,i:q.fontStyle==="italic"||q.fontStyle.startsWith("oblique"),u:gt,s:Mt,fs:Number.isFinite(V)?V:n.fontSize};return c.set(R,kt),kt},d=[];let p=null,g=null,b=0;const y=n.maxDomChars??m8,M=document.createRange(),C=document.createTreeWalker(s,NodeFilter.SHOW_TEXT);let L=C.nextNode();for(;L;){const R=L.textContent??"";if(b+=R.length,b>y)return null;const B=L.parentElement,q=f(B??s);for(let V=0;V<R.length;V+=1){const gt=R[V];if(gt===`
91
- `||gt==="\r")continue;M.setStart(L,V),M.setEnd(L,V+1);const Mt=M.getClientRects()[0];if(!Mt)continue;const kt=Mt.top-l.top+Mt.height*r.ascentRatio(q);(!p||Math.abs(p.baseline-kt)>g8)&&(p={runs:[],baseline:kt},d.push(p),g=null),(!g||!B4(g,q))&&(g={...q,text:"",x:Mt.left-l.left},p.runs.push(g)),g.text+=gt}L=C.nextNode()}return d.length===0?null:{lines:d,height:l.height,fromDom:!0}}finally{i.remove()}}function w8(n,t){if(typeof document>"u")return[];const e=document.createElement("div");let r=n;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
- `),e.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,C=f||b.tagName==="I"||b.tagName==="EM"||y.fontStyle==="italic",L=typeof y.textDecoration=="string"?y.textDecoration:"",R=d||b.tagName==="U"||L.includes("underline"),B=p||b.tagName==="S"||b.tagName==="STRIKE"||L.includes("line-through"),q=y.fontSize?Number.parseFloat(y.fontSize):Number.NaN,V=Number.isFinite(q)?q:g;for(const gt of Array.from(b.childNodes))s(gt,M,C,R,B,V)};for(const l of Array.from(e.childNodes))s(l,!1,!1,!1,!1,t);return i}function S8(n){const{width:t,fontSize:e,lineHeight:r,metrics:i}=n,s=w8(n.html,e),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((gt,Mt)=>Math.max(gt,Mt.fs),e),C={b:!1,i:!1,u:!1,s:!1,fs:M},L=M*r,R=i.contentHeight(C),B=b+(L-R)/2+R*i.ascentRatio(C),q=[];let V=0;for(const gt of y){const Mt=q[q.length-1];Mt&&B4(Mt,gt)?Mt.text+=gt.text:q.push({...gt,x:V}),V+=i.measure(gt.text,gt)}g.push({runs:q,baseline:B}),b+=L}return{lines:g,height:b,fromDom:!1}}function k8(n){return v8(n)??S8(n)}function A8(n,t,e){const r=n.width/2,i=n.height/2,s=Math.abs(Math.cos(t)),l=Math.abs(Math.sin(t));if(s>1e-9){const d=(r+e)/s;if(d*l<=i)return d}if(l>1e-9){const d=(i+e)/l;if(d*s<=r)return d}const c=s*r+l*i,f=r*r+i*i-e*e;return c+Math.sqrt(Math.max(0,c*c-f))}function F4(n,t,e,r=L4){const i=A8(e,t,r);return{x:n.x+Math.cos(t)*i-e.width/2,y:n.y+Math.sin(t)*i-e.height/2}}function M8(n,t,e,r=L4){const i=Math.atan2(t.y-n.y,t.x-n.x);return F4(n,i,e,r)}function C8(n,t,e){const r=e.x+e.width/2,i=e.y+e.height/2,s=n-r,l=t-i,c=e.width/2/Math.abs(s||.001),f=e.height/2/Math.abs(l||.001),d=Math.min(c,f);return{x:r+s*d,y:i+l*d}}function S0(n,t,e,r,i,s){const l=i-e,c=s-r,f=l*l+c*c;if(f===0)return{x:e,y:r,dist2:(n-e)**2+(t-r)**2};let d=((n-e)*l+(t-r)*c)/f;d=Math.max(0,Math.min(1,d));const p=e+d*l,g=r+d*c;return{x:p,y:g,dist2:(n-p)**2+(t-g)**2}}function E8(n,t,e){if(n.length===0)return{x:t,y:e};if(n.length===1)return{x:n[0].x,y:n[0].y};let r={x:n[0].x,y:n[0].y,dist2:1/0};for(let i=0;i<n.length;i++){const s=n[i],l=n[(i+1)%n.length],c=S0(t,e,s.x,s.y,l.x,l.y);c.dist2<r.dist2&&(r=c)}return{x:r.x,y:r.y}}function T8(n,t,e){if(n.length===0)return{x:t,y:e};if(n.length===1)return{x:n[0].x,y:n[0].y};let r={x:n[0].x,y:n[0].y,dist2:1/0};for(let i=0;i<n.length-1;i++){const s=n[i],l=n[i+1],c=S0(t,e,s.x,s.y,l.x,l.y);c.dist2<r.dist2&&(r=c)}return{x:r.x,y:r.y}}function N8(n,t,e,r,i){let l={x:n.x,y:n.y,dist2:1/0},c=n;for(let f=1;f<=24;f+=1){const d=f/24,p=1-d,g={x:p*p*n.x+2*p*d*t.x+d*d*e.x,y:p*p*n.y+2*p*d*t.y+d*d*e.y},b=S0(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 U4(n,t,e){const r=Math.cos(-e),i=Math.sin(-e);return{x:n*r-t*i,y:n*i+t*r}}function H4(n,t,e){const r=Math.cos(e),i=Math.sin(e);return{x:n*r-t*i,y:n*i+t*r}}function Ay(n,t,e,r=0){const{x:i,y:s,width:l,height:c}=n,f=i+l/2,d=s+c/2,p=r*Math.PI/180,g=U4(t-f,e-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 C={x:0,y:0,dist2:1/0};for(const[R,B]of M){const q=S0(g.x,g.y,R[0],R[1],B[0],B[1]);q.dist2<C.dist2&&(C=q)}const L=H4(C.x,C.y,p);return{x:f+L.x,y:d+L.y}}function gS(n,t,e,r=0){const{cx:i,cy:s,rx:l,ry:c}=n;if(l<=0||c<=0)return{x:i,y:s};const f=r*Math.PI/180,d=U4(t-i,e-s,f),p=Math.atan2(d.y*l,d.x*c),g=l*Math.cos(p),b=c*Math.sin(p),y=H4(g,b,f);return{x:i+y.x,y:s+y.y}}function _8(n,t){const e=t.x+t.width/2,r=t.y+t.height/2;return n.type==="point"?{x:n.x,y:n.y}:n.type==="standalone"?{x:n.x,y:n.y}:n.type==="polygon"?E8(n.points,e,r):n.type==="polyline"?T8(n.points,e,r):n.type==="arrow"?N8(n.start,n.control,n.end,e,r):n.type==="rectangle"?Ay(n,e,r,n.rotation??0):n.type==="image"||n.type==="redact"?Ay(n,e,r):n.type==="ellipse"?gS(n,e,r,n.rotation??0):n.type==="compass"?gS({cx:n.cx,cy:n.cy,rx:n.radius,ry:n.radius},e,r,n.rotation??0):{x:e,y:r}}function og(n,t,e=[]){const r=(Array.isArray(e)?e:[]).filter(f=>!!f&&Number.isFinite(f.x)&&Number.isFinite(f.y)),i=r[0],s=_8(n,i?{x:i.x,y:i.y,width:0,height:0}:t),l=r.length>0?r[r.length-1]:s,c=C8(l.x,l.y,t);return[s,...r,c]}function D8(n){return n.map((t,e)=>`${e===0?"M":"L"} ${t.x} ${t.y}`).join(" ")}function L8(n){const t=[];for(let e=0;e<n.length-1;e+=1)t.push({x:(n[e].x+n[e+1].x)/2,y:(n[e].y+n[e+1].y)/2});return t}function Im(n,t,e,r,i,s,l,c){const f=(e-n)*(s-t)-(r-t)*(i-n),d=(e-n)*(c-t)-(r-t)*(l-n),p=(l-i)*(t-s)-(c-s)*(n-i),g=(l-i)*(r-s)-(c-s)*(e-i);return(f>0!=d>0||f===0||d===0)&&(p>0!=g>0||p===0||g===0)}function R8(n,t,e){const r=e.x+e.width,i=e.y+e.height,s=l=>l.x>=e.x&&l.x<=r&&l.y>=e.y&&l.y<=i;return s(n)||s(t)?!0:Im(n.x,n.y,t.x,t.y,e.x,e.y,r,e.y)||Im(n.x,n.y,t.x,t.y,r,e.y,r,i)||Im(n.x,n.y,t.x,t.y,r,i,e.x,i)||Im(n.x,n.y,t.x,t.y,e.x,i,e.x,e.y)}function O8(n,t){for(let e=1;e<n.length;e+=1)if(R8(n[e-1],n[e],t))return!0;return!1}function P8(n,t){return n.x<t.x+t.width&&n.x+n.width>t.x&&n.y<t.y+t.height&&n.y+n.height>t.y}function xg(n){const{card:t,panel:e,gap:r,bounds:i,leader:s,margin:l}=n,c=gt=>Math.max(0,Math.min(gt,i.w-e.w)),f=gt=>Math.max(0,Math.min(gt,i.h-e.h)),d=c(t.x+(t.width-e.w)/2),p=f(t.y-e.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,C=l?.right??0,L=l?.top??0,R=l?.bottom??0,B=(gt,Mt)=>{const kt={x:gt-M,y:Mt-L,width:e.w+M+C,height:e.h+L+R};return P8(kt,t)||O8(s,kt)},q=b?[{y:g,above:!1},{y:p,above:!0}]:[{y:p,above:!0},{y:g,above:!1}],V=[d,c(t.x),c(t.x+t.width-e.w)];for(const gt of V)for(const Mt of q)if(!B(gt,Mt.y))return{x:gt,y:Mt.y,above:Mt.above};return y}function yS(n){return n.z??Number.POSITIVE_INFINITY}function vg(n){return n.map((t,e)=>({pin:t,index:e})).sort((t,e)=>yS(t.pin)-yS(e.pin)||t.index-e.index).map(t=>t.pin)}function I8(n,t,e){switch(n){case"front":return e;case"back":return 0;case"up":return Math.min(e,t+1);case"down":return Math.max(0,t-1);default:return n}}function q4(n,t){const e=n.find(i=>i.id===t);if(!e)return new Set;const r=v2(e,n)??e;return new Set([r.id,...v5(r.id,n)])}function j8(n,t,e){if(!n.some(b=>b.id===t))return[...n];const r=q4(n,t),i=vg(n),s=i.filter(b=>r.has(b.id)),l=i.filter(b=>!r.has(b.id));if(s.length===0)return[...n];const c=i.findIndex(b=>r.has(b.id)),f=i.slice(0,c).filter(b=>!r.has(b.id)).length,d=I8(e,f,l.length),p=[...l.slice(0,d),...s,...l.slice(d)],g=new Map(p.map((b,y)=>[b.id,y]));return n.every(b=>!g.has(b.id)||b.z===g.get(b.id))?[...n]:n.map(b=>g.has(b.id)?{...b,z:g.get(b.id)}:b)}function z8(n,t,e){if(!n.some(f=>f.id===t))return!1;const r=q4(n,t),i=vg(n),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 e==="front"||e==="up"?c<l:c>0}function B8(n){if(n.type==="linked")return{x:0,y:0};if(n.type==="point")return{x:n.x,y:n.y};if(n.type==="numbering")return{x:n.end.x,y:n.end.y};if(n.type==="standalone")return{x:n.x,y:n.y};if(n.type==="rectangle")return{x:n.x+n.width/2,y:n.y+n.height/2};if(n.type==="text")return{x:n.x+n.width/2,y:n.y+n.height/2};if(n.type==="image")return{x:n.x+n.width/2,y:n.y+n.height/2};if(n.type==="redact")return{x:n.x+n.width/2,y:n.y+n.height/2};if(n.type==="ellipse")return{x:n.cx,y:n.cy};if(n.type==="compass")return{x:n.cx,y:n.cy};if(n.type==="arrow")return{x:(n.start.x+n.end.x+n.control.x)/3,y:(n.start.y+n.end.y+n.control.y)/3};if(n.type==="polygon"||n.type==="polyline"){const t=n.points;if(t.length===0)return{x:0,y:0};const e=t.reduce((i,s)=>i+s.x,0),r=t.reduce((i,s)=>i+s.y,0);return{x:e/t.length,y:r/t.length}}return{x:0,y:0}}function F8(n,t,e){const r=i=>({x:i.x+t,y:i.y+e});switch(n.type){case"linked":return n;case"point":case"standalone":return{...n,...r(n)};case"text":return{...n,...r(n),...n.point?{point:r(n.point)}:{}};case"image":case"redact":case"rectangle":return{...n,...r(n)};case"ellipse":case"compass":{const i=r({x:n.cx,y:n.cy});return{...n,cx:i.x,cy:i.y}}case"polygon":case"polyline":return{...n,points:n.points.map(r)};case"numbering":return{...n,start:r(n.start),end:r(n.end)};case"arrow":return{...n,start:r(n.start),end:r(n.end),control:r(n.control)};default:return n}}function bS(n,t){return{pin:{...n},card:t?{...t}:null}}function U8(n,t,e){const r=B8(n.pin.anchor),i=t.x-r.x,s=t.y-r.y;return $4(n,i,s,e)}function $4(n,t,e,r){return{pin:{...n.pin,id:r,anchor:F8(n.pin.anchor,t,e)},card:n.card?{...n.card,x:n.card.x+t,y:n.card.y+e}:null}}function k0(n){switch(n.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 n}}function A5(n){switch(n.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 n}}function Lc(n){return k0(n.anchor)&&(n.strokeStyle??Hf)==="dashed"}function sg(n,t){return(t??yp)==="none"?null:`${n}${T_}`}function My(n,t){return sg(n,t)??"transparent"}const Y4=24*ti,H8=12,q8=12*ti,ag=1.25*ti;function $8(n,t,e,r=Y4,i=q8){const s=i+r;switch(n){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,e-s)};case"sw":return{cx:s,cy:Math.max(s,e-s)};default:return n}}function M5(n){const t=Math.max(1,n),e=-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:e},{x:i,y:r},{x:-i,y:r}],letterY:-t,fontSize:s,arcGapHalfRad:l,arcStartRad:c+l,arcEndRad:c-l+Math.PI*2}}function Y8(n,t,e){const{arcStartRad:r,arcEndRad:i}=M5(e),s=n+e*Math.cos(r),l=t+e*Math.sin(r),c=n+e*Math.cos(i),f=t+e*Math.sin(i);return`M ${s} ${l} A ${e} ${e} 0 1 1 ${c} ${f}`}function V8(n,t){const{cx:e,cy:r,radius:i,rotation:s=0,color:l,strokeWidth:c=ag}=t,f=s*Math.PI/180,d=M5(i);n.save(),n.translate(e,r),n.rotate(f),n.beginPath(),n.arc(0,0,i,d.arcStartRad,d.arcEndRad,!1),n.strokeStyle=l,n.lineWidth=c,n.lineCap="round",n.stroke();const[p,g,b]=d.arrowPoints;n.beginPath(),n.moveTo(p.x,p.y),n.lineTo(g.x,g.y),n.lineTo(b.x,b.y),n.closePath(),n.fillStyle=l,n.fill(),n.fillStyle=l,n.font=`700 ${d.fontSize}px sans-serif`,n.textAlign="center",n.textBaseline="middle",n.fillText("N",0,d.letterY),n.restore()}const W8=zc.memo(function({x:t,y:e,color:r,widthScale:i=1,onClick:s,onMouseDown:l,onPointerDown:c}){const f=Yh*i;return E.jsx("g",{transform:`translate(${t}, ${e})`,onClick:s,onPointerDown:c,onMouseDown:l,style:{cursor:l?"grab":"pointer"},children:E.jsx("circle",{r:f,fill:r,stroke:"white",strokeWidth:ig*i})})},(n,t)=>n.x===t.x&&n.y===t.y&&n.color===t.color&&n.label===t.label&&n.active===t.active&&n.widthScale===t.widthScale),V4=(n,t,e)=>n+(t-n)*Math.min(1,Math.max(0,e));function X8(n){return V4(D_,L_,n)}function G8(n){return V4(R_,O_,n)}function K8(n,t,e){const r=e.w/Math.max(1,t.w),i=e.h/Math.max(1,t.h);return{sx:n.x*r,sy:n.y*i,sw:Math.max(1,n.width*r),sh:Math.max(1,n.height*i)}}function J8(n,t){let e=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;e+=n[f],r+=n[f+1],i+=n[f+2],s+=1}return s?{r:Math.round(e/s),g:Math.round(r/s),b:Math.round(i/s)}:null}const Z8=24;function Q8(n,t,e,r){const{sx:i,sy:s,sw:l,sh:c}=K8(t,e,r),f=Z8,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(n,i,s,l,c,0,0,f,f);const g=J8(p.getImageData(0,0,f,f).data,f);return g?`rgb(${g.r}, ${g.g}, ${g.b})`:null}catch{return null}}function xS(n,t,e,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(n,t,e,r,i,0,0,s,l)}catch{return null}return c}function W4(n,t,e){const{rect:r,mode:i,strength:s,imageSize:l,sourceSize:c}=e;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 L=Q8(t,r,l,c);n.save(),n.fillStyle=L??"#808080",n.fillRect(r.x,r.y,r.width,r.height),n.restore();return}if(i==="blur"){const L=X8(s),R=L*2,B=xS(t,(r.x-R)*f,(r.y-R)*d,(r.width+R*2)*f,(r.height+R*2)*d);if(!B)return;n.save(),n.beginPath(),n.rect(r.x,r.y,r.width,r.height),n.clip(),n.filter=`blur(${L}px)`,n.drawImage(B,r.x-R,r.y-R,r.width+R*2,r.height+R*2),n.filter="none",n.restore();return}const p=xS(t,r.x*f,r.y*d,r.width*f,r.height*d);if(!p)return;const g=G8(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 C=M.getContext("2d");C&&(C.imageSmoothingEnabled=!0,C.drawImage(p,0,0,b,y),n.save(),n.beginPath(),n.rect(r.x,r.y,r.width,r.height),n.clip(),n.imageSmoothingEnabled=!1,n.drawImage(M,0,0,b,y,r.x,r.y,r.width,r.height),n.imageSmoothingEnabled=!0,n.restore())}const tD=H.memo(function({x:t,y:e,width:r,height:i,mode:s,strength:l,source:c,imageSize:f,resolution:d=2}){const p=H.useRef(null);return H.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,-e*d),y.clearRect(t,e,r,i),W4(y,c,{rect:{x:t,y:e,width:r,height:i},mode:s,strength:l,imageSize:f,sourceSize:b}))},[t,e,r,i,s,l,c,f,d]),E.jsx("foreignObject",{x:t,y:e,width:r,height:i,style:{overflow:"hidden"},children:E.jsx("canvas",{xmlns:"http://www.w3.org/1999/xhtml",ref:p,style:{width:"100%",height:"100%",display:"block",pointerEvents:"none"}})})});var bp=Ok();const eD=Rk(bp);var Cy={exports:{}},Ey={};var vS;function nD(){if(vS)return Ey;vS=1;var n=_p();function t(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}var e=typeof Object.is=="function"?Object.is:t,r=n.useState,i=n.useEffect,s=n.useLayoutEffect,l=n.useDebugValue;function c(g,b){var y=b(),M=r({inst:{value:y,getSnapshot:b}}),C=M[0].inst,L=M[1];return s(function(){C.value=y,C.getSnapshot=b,f(C)&&L({inst:C})},[g,y,b]),i(function(){return f(C)&&L({inst:C}),g(function(){f(C)&&L({inst:C})})},[g]),l(y),y}function f(g){var b=g.getSnapshot;g=g.value;try{var y=b();return!e(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 Ey.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:p,Ey}var wS;function X4(){return wS||(wS=1,Cy.exports=nD()),Cy.exports}var G4=X4(),SS=Object.defineProperty,rD=(n,t)=>{let e={};for(var r in n)SS(e,r,{get:n[r],enumerable:!0});return SS(e,Symbol.toStringTag,{value:"Module"}),e};function As(n){this.content=n}As.prototype={constructor:As,find:function(n){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===n)return t;return-1},get:function(n){var t=this.find(n);return t==-1?void 0:this.content[t+1]},update:function(n,t,e){var r=e&&e!=n?this.remove(e):this,i=r.find(n),s=r.content.slice();return i==-1?s.push(e||n,t):(s[i+1]=t,e&&(s[i]=e)),new As(s)},remove:function(n){var t=this.find(n);if(t==-1)return this;var e=this.content.slice();return e.splice(t,2),new As(e)},addToStart:function(n,t){return new As([n,t].concat(this.remove(n).content))},addToEnd:function(n,t){var e=this.remove(n).content.slice();return e.push(n,t),new As(e)},addBefore:function(n,t,e){var r=this.remove(t),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,t,e),new As(i)},forEach:function(n){for(var t=0;t<this.content.length;t+=2)n(this.content[t],this.content[t+1])},prepend:function(n){return n=As.from(n),n.size?new As(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=As.from(n),n.size?new As(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var t=this;n=As.from(n);for(var e=0;e<n.content.length;e+=2)t=t.remove(n.content[e]);return t},toObject:function(){var n={};return this.forEach(function(t,e){n[t]=e}),n},get size(){return this.content.length>>1}};As.from=function(n){if(n instanceof As)return n;var t=[];if(n)for(var e in n)t.push(e,n[e]);return new As(t)};function K4(n,t,e){for(let r=0;;r++){if(r==n.childCount||r==t.childCount)return n.childCount==t.childCount?null:e;let i=n.child(r),s=t.child(r);if(i==s){e+=i.nodeSize;continue}if(!i.sameMarkup(s))return e;if(i.isText&&i.text!=s.text){let l=i.text,c=s.text,f=0;for(;l[f]==c[f];f++)e++;return f&&f<l.length&&f<c.length&&Q4(l.charCodeAt(f-1))&&Z4(l.charCodeAt(f))&&e--,e}if(i.content.size||s.content.size){let l=K4(i.content,s.content,e+1);if(l!=null)return l}e+=i.nodeSize}}function J4(n,t,e,r){for(let i=n.childCount,s=t.childCount;;){if(i==0||s==0)return i==s?null:{a:e,b:r};let l=n.child(--i),c=t.child(--s),f=l.nodeSize;if(l==c){e-=f,r-=f;continue}if(!l.sameMarkup(c))return{a:e,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--,e--,r--;return g&&b&&g<d.length&&Q4(d.charCodeAt(g-1))&&Z4(d.charCodeAt(g))&&(e++,r++),{a:e,b:r}}if(l.content.size||c.content.size){let d=J4(l.content,c.content,e-1,r-1);if(d)return d}e-=f,r-=f}}function Z4(n){return n>=56320&&n<57344}function Q4(n){return n>=55296&&n<56320}class Ae{constructor(t,e){if(this.content=t,this.size=e||0,e==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,e,r,i=0,s){for(let l=0,c=0;c<e;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,e-p),r,i+p)}c=d}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,r,i){let s="",l=!0;return this.nodesBetween(t,e,(c,f)=>{let d=c.isText?c.text.slice(Math.max(t,f)-f,e-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 e=this.lastChild,r=t.firstChild,i=this.content.slice(),s=0;for(e.isText&&e.sameMarkup(r)&&(i[i.length-1]=e.withText(e.text+r.text),s=1);s<t.content.length;s++)i.push(t.content[s]);return new Ae(i,this.size+t.size)}cut(t,e=this.size){if(t==0&&e==this.size)return this;let r=[],i=0;if(e>t)for(let s=0,l=0;l<e;s++){let c=this.content[s],f=l+c.nodeSize;f>t&&((l<t||f>e)&&(c.isText?c=c.cut(Math.max(0,t-l),Math.min(c.text.length,e-l)):c=c.cut(Math.max(0,t-l-1),Math.min(c.content.size,e-l-1))),r.push(c),i+=c.nodeSize),l=f}return new Ae(r,i)}cutByIndex(t,e){return t==e?Ae.empty:t==0&&e==this.content.length?this:new Ae(this.content.slice(t,e))}replaceChild(t,e){let r=this.content[t];if(r==e)return this;let i=this.content.slice(),s=this.size+e.nodeSize-r.nodeSize;return i[t]=e,new Ae(i,s)}addToStart(t){return new Ae([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new Ae(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))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 e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,r=0;e<this.content.length;e++){let i=this.content[e];t(i,r,e),r+=i.nodeSize}}findDiffStart(t,e=0){return K4(this,t,e)}findDiffEnd(t,e=this.size,r=t.size){return J4(this,t,e,r)}findIndex(t){if(t==0)return jm(0,t);if(t==this.size)return jm(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let e=0,r=0;;e++){let i=this.child(e),s=r+i.nodeSize;if(s>=t)return s==t?jm(e+1,s):jm(e,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,e){if(!e)return Ae.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return Ae.fromArray(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return Ae.empty;let e,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)?(e||(e=t.slice(0,i)),e[e.length-1]=s.withText(e[e.length-1].text+s.text)):e&&e.push(s)}return new Ae(e||t,r)}static from(t){if(!t)return Ae.empty;if(t instanceof Ae)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new Ae([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ae.empty=new Ae([],0);const Ty={index:0,offset:0};function jm(n,t){return Ty.index=n,Ty.offset=t,Ty}function wg(n,t){if(n===t)return!0;if(!(n&&typeof n=="object")||!(t&&typeof t=="object"))return!1;let e=Array.isArray(n);if(Array.isArray(t)!=e)return!1;if(e){if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(!wg(n[r],t[r]))return!1}else{for(let r in n)if(!(r in t)||!wg(n[r],t[r]))return!1;for(let r in t)if(!(r in n))return!1}return!0}let ci=class R2{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,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))e||(e=t.slice(0,i));else{if(s.type.excludes(this.type))return t;!r&&s.type.rank>this.type.rank&&(e||(e=t.slice(0,i)),e.push(this),r=!0),e&&e.push(s)}}return e||(e=t.slice()),r||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&wg(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[e.type];if(!r)throw new RangeError(`There is no mark type ${e.type} in this schema`);let i=r.create(e.attrs);return r.checkAttrs(i.attrs),i}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(e[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return R2.none;if(t instanceof R2)return[t];let e=t.slice();return e.sort((r,i)=>r.type.rank-i.type.rank),e}};ci.none=[];class xp extends Error{}class We{constructor(t,e,r){this.content=t,this.openStart=e,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let r=eA(this.content,t+this.openStart,e,this.openStart+1,this.openEnd+1);return r&&new We(r,this.openStart,this.openEnd)}removeBetween(t,e){return new We(tA(this.content,t+this.openStart,e+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,e){if(!e)return We.empty;let r=e.openStart||0,i=e.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new We(Ae.fromJSON(t,e.content),r,i)}static maxOpen(t,e=!0){let r=0,i=0;for(let s=t.firstChild;s&&!s.isLeaf&&(e||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=t.lastChild;s&&!s.isLeaf&&(e||!s.type.spec.isolating);s=s.lastChild)i++;return new We(t,r,i)}}We.empty=new We(Ae.empty,0,0);function tA(n,t,e){let{index:r,offset:i}=n.findIndex(t),s=n.maybeChild(r),{index:l,offset:c}=n.findIndex(e);if(i==t||s.isText){if(c!=e&&!n.child(l).isText)throw new RangeError("Removing non-flat range");return n.cut(0,t).append(n.cut(e))}if(r!=l)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(tA(s.content,t-i-1,e-i-1)))}function eA(n,t,e,r,i,s){let{index:l,offset:c}=n.findIndex(t),f=n.maybeChild(l);if(c==t||f.isText)return s&&r<=0&&i<=0&&!s.canReplace(l,l,e)?null:n.cut(0,t).append(e).append(n.cut(t));let d=eA(f.content,t-c-1,e,l==0?r-1:0,l==n.childCount-1?i-1:0,f);return d&&n.replaceChild(l,f.copy(d))}function iD(n,t,e){if(e.openStart>n.depth)throw new xp("Inserted content deeper than insertion position");if(n.depth-e.openStart!=t.depth-e.openEnd)throw new xp("Inconsistent open depths");return nA(n,t,e,0)}function nA(n,t,e,r){let i=n.index(r),s=n.node(r);if(i==t.index(r)&&r<n.depth-e.openStart){let l=nA(n,t,e,r+1);return s.copy(s.content.replaceChild(i,l))}else if(e.content.size)if(!e.openStart&&!e.openEnd&&n.depth==r&&t.depth==r){let l=n.parent,c=l.content;return Kf(l,c.cut(0,n.parentOffset).append(e.content).append(c.cut(t.parentOffset)))}else{let{start:l,end:c}=oD(e,n);return Kf(s,iA(n,l,c,t,r))}else return Kf(s,Sg(n,t,r))}function rA(n,t){if(!t.type.compatibleContent(n.type))throw new xp("Cannot join "+t.type.name+" onto "+n.type.name)}function O2(n,t,e){let r=n.node(e);return rA(r,t.node(e)),r}function Gf(n,t){let e=t.length-1;e>=0&&n.isText&&n.sameMarkup(t[e])?t[e]=n.withText(t[e].text+n.text):t.push(n)}function np(n,t,e,r){let i=(t||n).node(e),s=0,l=t?t.index(e):i.childCount;n&&(s=n.index(e),n.depth>e?s++:n.textOffset&&(Gf(n.nodeAfter,r),s++));for(let c=s;c<l;c++)Gf(i.child(c),r);t&&t.depth==e&&t.textOffset&&Gf(t.nodeBefore,r)}function Kf(n,t){if(!n.type.validContent(t))throw new xp("Invalid content for node "+n.type.name);return n.copy(t)}function iA(n,t,e,r,i){let s=n.depth>i&&O2(n,t,i+1),l=r.depth>i&&O2(e,r,i+1),c=[];return np(null,n,i,c),s&&l&&t.index(i)==e.index(i)?(rA(s,l),Gf(Kf(s,iA(n,t,e,r,i+1)),c)):(s&&Gf(Kf(s,Sg(n,t,i+1)),c),np(t,e,i,c),l&&Gf(Kf(l,Sg(e,r,i+1)),c)),np(r,null,i,c),new Ae(c)}function Sg(n,t,e){let r=[];if(np(null,n,e,r),n.depth>e){let i=O2(n,t,e+1);Gf(Kf(i,Sg(n,t,e+1)),r)}return np(t,null,e,r),new Ae(r)}function oD(n,t){let e=t.depth-n.openStart,i=t.node(e).copy(n.content);for(let s=e-1;s>=0;s--)i=t.node(s).copy(Ae.from(i));return{start:i.resolveNoCache(n.openStart+e),end:i.resolveNoCache(i.content.size-n.openEnd-e)}}class vp{constructor(t,e,r){this.pos=t,this.path=e,this.parentOffset=r,this.depth=e.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,e=this.index(this.depth);if(e==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=t.child(e);return r?t.child(e).cut(r):i}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):t==0?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let r=this.path[e*3],i=e==0?0:this.path[e*3-1]+1;for(let s=0;s<t;s++)i+=r.child(s).nodeSize;return i}marks(){let t=this.parent,e=this.index();if(t.content.size==0)return ci.none;if(this.textOffset)return t.child(e).marks;let r=t.maybeChild(e-1),i=t.maybeChild(e);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 e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let r=e.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 e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){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)&&(!e||e(this.node(r))))return new kg(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 e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let r=[],i=0,s=e;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 vp(e,r,s)}static resolveCached(t,e){let r=kS.get(t);if(r)for(let s=0;s<r.elts.length;s++){let l=r.elts[s];if(l.pos==e)return l}else kS.set(t,r=new sD);let i=r.elts[r.i]=vp.resolve(t,e);return r.i=(r.i+1)%aD,i}}class sD{constructor(){this.elts=[],this.i=0}}const aD=12,kS=new WeakMap;class kg{constructor(t,e,r){this.$from=t,this.$to=e,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 lD=Object.create(null);let Jf=class P2{constructor(t,e,r,i=ci.none){this.type=t,this.attrs=e,this.marks=i,this.content=r||Ae.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,e,r,i=0){this.content.nodesBetween(t,e,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,e,r,i){return this.content.textBetween(t,e,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,e,r){return this.type==t&&wg(this.attrs,e||t.defaultAttrs||lD)&&ci.sameSet(this.marks,r||ci.none)}copy(t=null){return t==this.content?this:new P2(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new P2(this.type,this.attrs,this.content,t)}cut(t,e=this.content.size){return t==0&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,r=!1){if(t==e)return We.empty;let i=this.resolve(t),s=this.resolve(e),l=r?0:i.sharedDepth(e),c=i.start(l),d=i.node(l).content.cut(i.pos-c,s.pos-c);return new We(d,i.depth-l,s.depth-l)}replace(t,e,r){return iD(this.resolve(t),this.resolve(e),r)}nodeAt(t){for(let e=this;;){let{index:r,offset:i}=e.content.findIndex(t);if(e=e.maybeChild(r),!e)return null;if(i==t||e.isText)return e;t-=i+1}}childAfter(t){let{index:e,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:e,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(e),index:e,offset:r};let i=this.content.child(e-1);return{node:i,index:e-1,offset:r-i.nodeSize}}resolve(t){return vp.resolveCached(this,t)}resolveNoCache(t){return vp.resolve(this,t)}rangeHasMark(t,e,r){let i=!1;return e>t&&this.nodesBetween(t,e,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()+")"),oA(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,r=Ae.empty,i=0,s=r.childCount){let l=this.contentMatchAt(t).matchFragment(r,i,s),c=l&&l.matchFragment(this.content,e);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,e,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(t).matchType(r),l=s&&s.matchFragment(this.content,e);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=ci.none;for(let e=0;e<this.marks.length;e++){let r=this.marks[e];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!ci.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let t={type:this.type.name};for(let e 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(e=>e.toJSON())),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let r;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=e.marks.map(t.markFromJSON)}if(e.type=="text"){if(typeof e.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(e.text,r)}let i=Ae.fromJSON(t,e.content),s=t.nodeType(e.type).create(e.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Jf.prototype.text=void 0;class Ag extends Jf{constructor(t,e,r,i){if(super(t,e,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):oA(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Ag(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Ag(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return t==0&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function oA(n,t){for(let e=n.length-1;e>=0;e--)t=n[e].type.name+"("+t+")";return t}class sd{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let r=new cD(t,e);if(r.next==null)return sd.empty;let i=sA(r);r.next&&r.err("Unexpected trailing text");let s=gD(mD(i));return yD(s,r),s}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,r=t.childCount){let i=this;for(let s=e;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:e}=this.next[t];if(!(e.isText||e.hasRequiredAttrs()))return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let r=0;r<t.next.length;r++)if(this.next[e].type==t.next[r].type)return!0;return!1}fillBefore(t,e=!1,r=0){let i=[this];function s(l,c){let f=l.matchFragment(t,r);if(f&&(!e||f.validEnd))return Ae.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 e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=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 e)&&(!i.type||f.validEnd)&&(r.push({match:c.contentMatch,type:c,via:i}),e[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 e(r){t.push(r);for(let i=0;i<r.next.length;i++)t.indexOf(r.next[i].next)==-1&&e(r.next[i].next)}return e(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
- `)}}sd.empty=new sd(!0);class cD{constructor(t,e){this.string=t,this.nodeTypes=e,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 sA(n){let t=[];do t.push(uD(n));while(n.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function uD(n){let t=[];do t.push(fD(n));while(n.next&&n.next!=")"&&n.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function fD(n){let t=pD(n);for(;;)if(n.eat("+"))t={type:"plus",expr:t};else if(n.eat("*"))t={type:"star",expr:t};else if(n.eat("?"))t={type:"opt",expr:t};else if(n.eat("{"))t=dD(n,t);else break;return t}function AS(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let t=Number(n.next);return n.pos++,t}function dD(n,t){let e=AS(n),r=e;return n.eat(",")&&(n.next!="}"?r=AS(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:e,max:r,expr:t}}function hD(n,t){let e=n.nodeTypes,r=e[t];if(r)return[r];let i=[];for(let s in e){let l=e[s];l.isInGroup(t)&&i.push(l)}return i.length==0&&n.err("No node type or group '"+t+"' found"),i}function pD(n){if(n.eat("(")){let t=sA(n);return n.eat(")")||n.err("Missing closing paren"),t}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let t=hD(n,n.next).map(e=>(n.inline==null?n.inline=e.isInline:n.inline!=e.isInline&&n.err("Mixing inline and block content"),{type:"name",value:e}));return n.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function mD(n){let t=[[]];return i(s(n,0),e()),t;function e(){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=e())}else if(l.type=="star"){let f=e();return r(c,f),i(s(l.expr,f),f),[r(f)]}else if(l.type=="plus"){let f=e();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=e();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=e();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 aA(n,t){return t-n}function MS(n,t){let e=[];return r(t),e.sort(aA);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);e.push(i);for(let l=0;l<s.length;l++){let{term:c,to:f}=s[l];!c&&e.indexOf(f)==-1&&r(f)}}}function gD(n){let t=Object.create(null);return e(MS(n,0));function e(r){let i=[];r.forEach(l=>{n[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]);MS(n,f).forEach(p=>{d||i.push([c,d=[]]),d.indexOf(p)==-1&&d.push(p)})})});let s=t[r.join(",")]=new sd(r.indexOf(n.length-1)>-1);for(let l=0;l<i.length;l++){let c=i[l][1].sort(aA);s.next.push({type:i[l][0],next:t[c.join(",")]||e(c)})}return s}}function yD(n,t){for(let e=0,r=[n];e<r.length;e++){let i=r[e],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 lA(n){let t=Object.create(null);for(let e in n){let r=n[e];if(!r.hasDefault)return null;t[e]=r.default}return t}function cA(n,t){let e=Object.create(null);for(let r in n){let i=t&&t[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}e[r]=i}return e}function uA(n,t,e,r){for(let i in t)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${e} of type ${r}`);for(let i in n)n[i].validate&&n[i].validate(t[i])}function fA(n,t){let e=Object.create(null);if(t)for(let r in t)e[r]=new xD(n,r,t[r]);return e}let CS=class dA{constructor(t,e,r){this.name=t,this.schema=e,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=fA(t,r.attrs),this.defaultAttrs=lA(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==sd.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:cA(this.attrs,t)}create(t=null,e,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Jf(this,this.computeAttrs(t),Ae.from(e),ci.setFrom(r))}createChecked(t=null,e,r){return e=Ae.from(e),this.checkContent(e),new Jf(this,this.computeAttrs(t),e,ci.setFrom(r))}createAndFill(t=null,e,r){if(t=this.computeAttrs(t),e=Ae.from(e),e.size){let l=this.contentMatch.fillBefore(e);if(!l)return null;e=l.append(e)}let i=this.contentMatch.matchFragment(e),s=i&&i.fillBefore(Ae.empty,!0);return s?new Jf(this,t,e.append(s),ci.setFrom(r)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.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){uA(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 e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let e;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?e&&e.push(t[r]):e||(e=t.slice(0,r));return e?e.length?e:ci.none:t}static compile(t,e){let r=Object.create(null);t.forEach((s,l)=>r[s]=new dA(s,e,l));let i=e.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 bD(n,t,e){let r=e.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 ${n}, got ${s}`)}}class xD{constructor(t,e,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?bD(t,e,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class A0{constructor(t,e,r,i){this.name=t,this.rank=e,this.schema=r,this.spec=i,this.attrs=fA(t,i.attrs),this.excluded=null;let s=lA(this.attrs);this.instance=s?new ci(this,s):null}create(t=null){return!t&&this.instance?this.instance:new ci(this,cA(this.attrs,t))}static compile(t,e){let r=Object.create(null),i=0;return t.forEach((s,l)=>r[s]=new A0(s,i++,e,l)),r}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}checkAttrs(t){uA(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class hA{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let e=this.spec={};for(let i in t)e[i]=t[i];e.nodes=As.from(t.nodes),e.marks=As.from(t.marks||{}),this.nodes=CS.compile(this.spec.nodes,this),this.marks=A0.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]=sd.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?ES(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==""?[]:ES(this,l.split(" "))}this.nodeFromJSON=i=>Jf.fromJSON(this,i),this.markFromJSON=i=>ci.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,e=null,r,i){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof CS){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(e,r,i)}text(t,e){let r=this.nodes.text;return new Ag(r,r.defaultAttrs,t,ci.setFrom(e))}mark(t,e){return typeof t=="string"&&(t=this.marks[t]),t.create(e)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}function ES(n,t){let e=[];for(let r=0;r<t.length;r++){let i=t[r],s=n.marks[i],l=s;if(s)e.push(s);else for(let c in n.marks){let f=n.marks[c];(i=="_"||f.spec.group&&f.spec.group.split(" ").indexOf(i)>-1)&&e.push(l=f)}if(!l)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return e}function vD(n){return n.tag!=null}function wD(n){return n.style!=null}let rp=class I2{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[];let r=this.matchedStyles=[];e.forEach(i=>{if(vD(i))this.tags.push(i);else if(wD(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,e={}){let r=new NS(this,e,!1);return r.addAll(t,ci.none,e.from,e.to),r.finish()}parseSlice(t,e={}){let r=new NS(this,e,!0);return r.addAll(t,ci.none,e.from,e.to),We.maxOpen(r.finish())}matchTag(t,e,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(AD(t,s.tag)&&(s.namespace===void 0||t.namespaceURI==s.namespace)&&(!s.context||e.matchesContext(s.context))){if(s.getAttrs){let l=s.getAttrs(t);if(l===!1)continue;s.attrs=l||void 0}return s}}}matchStyle(t,e,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)!=e))){if(l.getAttrs){let f=l.getAttrs(e);if(f===!1)continue;l.attrs=f||void 0}return l}}}static schemaRules(t){let e=[];function r(i){let s=i.priority==null?50:i.priority,l=0;for(;l<e.length;l++){let c=e[l];if((c.priority==null?50:c.priority)<s)break}e.splice(l,0,i)}for(let i in t.marks){let s=t.marks[i].spec.parseDOM;s&&s.forEach(l=>{r(l=_S(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=_S(l)),l.node||l.ignore||l.mark||(l.node=i)})}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new I2(t,I2.schemaRules(t)))}};const pA={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},SD={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},mA={ol:!0,ul:!0},wp=1,j2=2,ip=4;function TS(n,t,e){return t!=null?(t?wp:0)|(t==="full"?j2:0):n&&n.whitespace=="pre"?wp|j2:e&~ip}class zm{constructor(t,e,r,i,s,l){this.type=t,this.attrs=e,this.marks=r,this.solid=i,this.options=l,this.content=[],this.activeMarks=ci.none,this.match=s||(l&ip?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(Ae.from(t));if(e)this.match=this.type.contentMatch.matchFragment(e);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&wp)){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 e=Ae.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(Ae.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!pA.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class NS{constructor(t,e,r){this.parser=t,this.options=e,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=e.topNode,s,l=TS(null,e.preserveWhitespace,0)|(r?ip:0);i?s=new zm(i.type,i.attrs,ci.none,!0,e.topMatch||i.type.contentMatch,l):r?s=new zm(null,null,ci.none,!0,null,l):s=new zm(t.schema.topNodeType,null,ci.none,!0,null,l),this.nodes=[s],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,e){t.nodeType==3?this.addTextNode(t,e):t.nodeType==1&&this.addElement(t,e)}addTextNode(t,e){let r=t.nodeValue,i=this.top,s=i.options&j2?"full":this.localPreserveWS||(i.options&wp)>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(),e,!0),c[f]&&this.insertNode(l.text(c[f]),e,!/\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),e,!/\S/.test(r)),this.findInText(t)}else this.findInside(t)}addElement(t,e,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;mA.hasOwnProperty(l)&&this.parser.normalizeLists&&kD(t);let f=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(c=this.parser.matchTag(t,this,r));t:if(f?f.ignore:SD.hasOwnProperty(l))this.findInside(t),this.ignoreFallback(t,e);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(pA.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,e);break t}let g=f&&f.skip?e:this.readStyles(t,e);g&&this.addAll(t,g),d&&this.sync(s),this.needsBlock=p}else{let d=this.readStyles(t,e);d&&this.addElementByRule(t,f,d,f.consuming===!1?c:void 0)}this.localPreserveWS=i}leafFallback(t,e){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
98
- `),e)}ignoreFallback(t,e){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),e,!0)}readStyles(t,e){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?e=e.filter(d=>!f.clearMark(d)):e=e.concat(this.parser.schema.marks[f.mark].create(f.attrs)),f.consuming===!1)c=f;else break}}return e}addElementByRule(t,e,r,i){let s,l;if(e.node)if(l=this.parser.schema.nodes[e.node],l.isLeaf)this.insertNode(l.create(e.attrs),r,t.nodeName=="BR")||this.leafFallback(t,r);else{let f=this.enter(l,e.attrs||null,r,e.preserveWhitespace);f&&(s=!0,r=f)}else{let f=this.parser.schema.marks[e.mark];r=r.concat(f.create(e.attrs))}let c=this.top;if(l&&l.isLeaf)this.findInside(t);else if(i)this.addElement(t,r,i);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach(f=>this.insertNode(f,r,!1));else{let f=t;typeof e.contentElement=="string"?f=t.querySelector(e.contentElement):typeof e.contentElement=="function"?f=e.contentElement(t):e.contentElement&&(f=e.contentElement),this.findAround(t,f,!0),this.addAll(f,r),this.findAround(t,f,!1)}s&&this.sync(c)&&this.open--}addAll(t,e,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,e);this.findAtPoint(t,s)}findPlace(t,e,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++)e=this.enterInner(i[l],null,e,!1);return e}insertNode(t,e,r){if(t.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(e=this.enterInner(s,null,e))}let i=this.findPlace(t,e,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(t.type));let l=ci.none;for(let c of i.concat(t.marks))(s.type?s.type.allowsMarkType(c.type):DS(c.type,t.type))&&(l=c.addToSet(l));return s.content.push(t.mark(l)),!0}return!1}enter(t,e,r,i){let s=this.findPlace(t.create(e),r,!1);return s&&(s=this.enterInner(t,e,r,!0,i)),s}enterInner(t,e,r,i=!1,s){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(t);let c=TS(t,s,l.options);l.options&ip&&l.content.length==0&&(c|=ip);let f=ci.none;return r=r.filter(d=>(l.type?l.type.allowsMarkType(d.type):DS(d.type,t))?(f=d.addToSet(f),!1):!0),this.nodes.push(new zm(t,e,f,i,null,c)),this.open++,r}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].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 e=this.open;e>=0;e--){if(this.nodes[e]==t)return this.open=e,!0;this.localPreserveWS&&(this.nodes[e].options|=wp)}return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let r=this.nodes[e].content;for(let i=r.length-1;i>=0;i--)t+=r[i].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==e&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].pos==null&&t.nodeType==1&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,r){if(t!=e&&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)&&e.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=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=e[c];if(d==""){if(c==e.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(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let r=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let e in this.parser.schema.nodes){let r=this.parser.schema.nodes[e];if(r.isTextblock&&r.defaultAttrs)return r}}}function kD(n){for(let t=n.firstChild,e=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&mA.hasOwnProperty(r)&&e?(e.appendChild(t),t=e):r=="li"?e=t:r&&(e=null)}}function AD(n,t){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,t)}function _S(n){let t={};for(let e in n)t[e]=n[e];return t}function DS(n,t){let e=t.schema.nodes;for(let r in e){let i=e[r];if(!i.allowsMarkType(n))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 hd{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},r){r||(r=Bm(e).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,e);p&&(s.push([d,i]),i.appendChild(p.dom),i=p.contentDOM||p.dom)}}i.appendChild(this.serializeNodeInner(l,e))}),r}serializeNodeInner(t,e){if(t.isText)return Bm(e).createTextNode(t.text);let{dom:r,contentDOM:i}=lg(Bm(e),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,e,i)}return r}serializeNode(t,e={}){let r=this.serializeNodeInner(t,e);for(let i=t.marks.length-1;i>=0;i--){let s=this.serializeMark(t.marks[i],t.isInline,e);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(t,e,r={}){let i=this.marks[t.type.name];return i&&lg(Bm(r),i(t,e),null,t.attrs)}static renderSpec(t,e,r=null,i){return typeof e=="string"?{dom:t.createTextNode(e)}:lg(t,e,r,i)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new hd(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=LS(t.nodes);return e.text||(e.text=r=>r.text),e}static marksFromSchema(t){return LS(t.marks)}}function LS(n){let t={};for(let e in n){let r=n[e].spec.toDOM;r&&(t[e]=r)}return t}function Bm(n){return n.document||window.document}const RS=new WeakMap;function MD(n){let t=RS.get(n);return t===void 0&&RS.set(n,t=CD(n)),t}function CD(n){let t=null;function e(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++)e(r[i]);else for(let i in r)e(r[i])}return e(n),t}function lg(n,t,e,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=MD(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&&(e=i.slice(0,l),i=i.slice(l+1));let c,f=e?n.createElementNS(e,i):n.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(n.createTextNode(b));else{let{dom:y,contentDOM:M}=lg(n,b,e,r);if(f.appendChild(y),M){if(c)throw new RangeError("Multiple content holes");c=M}}}return{dom:f,contentDOM:c}}const gA=65535,yA=Math.pow(2,16);function ED(n,t){return n+t*yA}function OS(n){return n&gA}function TD(n){return(n-(n&gA))/yA}const bA=1,xA=2,cg=4,vA=8;class z2{constructor(t,e,r){this.pos=t,this.delInfo=e,this.recover=r}get deleted(){return(this.delInfo&vA)>0}get deletedBefore(){return(this.delInfo&(bA|cg))>0}get deletedAfter(){return(this.delInfo&(xA|cg))>0}get deletedAcross(){return(this.delInfo&cg)>0}}class el{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&el.empty)return el.empty}recover(t){let e=0,r=OS(t);if(!this.inverted)for(let i=0;i<r;i++)e+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+e+TD(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,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:e:e,y=f+i+(b<0?0:p);if(r)return y;let M=t==(e<0?f:g)?null:ED(c/3,t-f),C=t==f?xA:t==g?bA:cg;return(e<0?t!=f:t!=g)&&(C|=vA),new z2(y,C,M)}i+=p-d}return r?t+i:new z2(t+i,0,null)}touches(t,e){let r=0,i=OS(e),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 e=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+e],p=this.ranges[i+r];t(c,c+d,f,f+p),s+=p-d}}invert(){return new el(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?el.empty:new el(t<0?[0,-t,0]:[0,0,t])}}el.empty=new el([]);class Sp{constructor(t,e,r=0,i=t?t.length:0){this.mirror=e,this.from=r,this.to=i,this._maps=t||[],this.ownData=!(t||e)}get maps(){return this._maps}slice(t=0,e=this.maps.length){return new Sp(this._maps,this.mirror,t,e)}appendMap(t,e){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),e!=null&&this.setMirror(this._maps.length-1,e)}appendMapping(t){for(let e=0,r=this._maps.length;e<t._maps.length;e++){let i=t.getMirror(e);this.appendMap(t._maps[e],i!=null&&i<e?r+i:void 0)}}getMirror(t){if(this.mirror){for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,r=this._maps.length+t._maps.length;e>=0;e--){let i=t.getMirror(e);this.appendMap(t._maps[e].invert(),i!=null&&i>e?r-i-1:void 0)}}invert(){let t=new Sp;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let r=this.from;r<this.to;r++)t=this._maps[r].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,!1)}_map(t,e,r){let i=0;for(let s=this.from;s<this.to;s++){let l=this._maps[s],c=l.mapResult(t,e);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 z2(t,i,null)}}const Ny=Object.create(null);class Gs{getMap(){return el.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ny[e.stepType];if(!r)throw new RangeError(`No step type ${e.stepType} defined`);return r.fromJSON(t,e)}static jsonID(t,e){if(t in Ny)throw new RangeError("Duplicate use of step JSON ID "+t);return Ny[t]=e,e.prototype.jsonID=t,e}}class Co{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new Co(t,null)}static fail(t){return new Co(null,t)}static fromReplace(t,e,r,i){try{return Co.ok(t.replace(e,r,i))}catch(s){if(s instanceof xp)return Co.fail(s.message);throw s}}}function C5(n,t,e){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(C5(s.content,t,s))),s.isInline&&(s=t(s,e,i)),r.push(s)}return Ae.fromArray(r)}class cf extends Gs{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new We(C5(e.content,(l,c)=>!l.isAtom||!c.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),i),e.openStart,e.openEnd);return Co.fromReplace(t,this.from,this.to,s)}invert(){return new cc(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new cf(e.pos,r.pos,this.mark)}merge(t){return t instanceof cf&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new cf(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,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new cf(e.from,e.to,t.markFromJSON(e.mark))}}Gs.jsonID("addMark",cf);class cc extends Gs{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=new We(C5(e.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),e.openStart,e.openEnd);return Co.fromReplace(t,this.from,this.to,r)}invert(){return new cf(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new cc(e.pos,r.pos,this.mark)}merge(t){return t instanceof cc&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new cc(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,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new cc(e.from,e.to,t.markFromJSON(e.mark))}}Gs.jsonID("removeMark",cc);class uf extends Gs{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return Co.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return Co.fromReplace(t,this.pos,this.pos+1,new We(Ae.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let r=this.mark.addToSet(e.marks);if(r.length==e.marks.length){for(let i=0;i<e.marks.length;i++)if(!e.marks[i].isInSet(r))return new uf(this.pos,e.marks[i]);return new uf(this.pos,this.mark)}}return new ad(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new uf(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new uf(e.pos,t.markFromJSON(e.mark))}}Gs.jsonID("addNodeMark",uf);class ad extends Gs{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return Co.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return Co.fromReplace(t,this.pos,this.pos+1,new We(Ae.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return!e||!this.mark.isInSet(e.marks)?this:new uf(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new ad(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ad(e.pos,t.markFromJSON(e.mark))}}Gs.jsonID("removeNodeMark",ad);class uo extends Gs{constructor(t,e,r,i=!1){super(),this.from=t,this.to=e,this.slice=r,this.structure=i}apply(t){return this.structure&&B2(t,this.from,this.to)?Co.fail("Structure replace would overwrite content"):Co.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new el([this.from,this.to-this.from,this.slice.size])}invert(t){return new uo(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.to,-1),r=this.from==this.to&&uo.MAP_BIAS<0?e:t.mapResult(this.from,1);return r.deletedAcross&&e.deletedAcross?null:new uo(r.pos,Math.max(r.pos,e.pos),this.slice,this.structure)}merge(t){if(!(t instanceof uo)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let e=this.slice.size+t.slice.size==0?We.empty:new We(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new uo(this.from,this.to+(t.to-t.from),e,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let e=this.slice.size+t.slice.size==0?We.empty:new We(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new uo(t.from,this.to,e,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,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new uo(e.from,e.to,We.fromJSON(t,e.slice),!!e.structure)}}uo.MAP_BIAS=1;Gs.jsonID("replace",uo);class Zo extends Gs{constructor(t,e,r,i,s,l,c=!1){super(),this.from=t,this.to=e,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=l,this.structure=c}apply(t){if(this.structure&&(B2(t,this.from,this.gapFrom)||B2(t,this.gapTo,this.to)))return Co.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return Co.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,e.content);return r?Co.fromReplace(t,this.from,this.to,r):Co.fail("Content does not fit in gap")}getMap(){return new el([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new Zo(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?e.pos:t.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return e.deletedAcross&&r.deletedAcross||i<e.pos||s>r.pos?null:new Zo(e.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,e){if(typeof e.from!="number"||typeof e.to!="number"||typeof e.gapFrom!="number"||typeof e.gapTo!="number"||typeof e.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Zo(e.from,e.to,e.gapFrom,e.gapTo,We.fromJSON(t,e.slice),e.insert,!!e.structure)}}Gs.jsonID("replaceAround",Zo);function B2(n,t,e){let r=n.resolve(t),i=e-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 ND(n,t,e,r){let i=[],s=[],l,c;n.doc.nodesBetween(t,e,(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,e),M=r.addToSet(g);for(let C=0;C<g.length;C++)g[C].isInSet(M)||(l&&l.to==b&&l.mark.eq(g[C])?l.to=y:i.push(l=new cc(b,y,g[C])));c&&c.to==b?c.to=y:s.push(c=new cf(b,y,r))}}),i.forEach(f=>n.step(f)),s.forEach(f=>n.step(f))}function _D(n,t,e,r){let i=[],s=0;n.doc.nodesBetween(t,e,(l,c)=>{if(!l.isInline)return;s++;let f=null;if(r instanceof A0){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,e);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=>n.step(new cc(l.from,l.to,l.style)))}function E5(n,t,e,r=e.contentMatch,i=!0){let s=n.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 uo(c,p,We.empty));else{r=g;for(let b=0;b<d.marks.length;b++)e.allowsMarkType(d.marks[b].type)||n.step(new cc(c,p,d.marks[b]));if(i&&d.isText&&e.whitespace!="pre"){let b,y=/\r?\n|\r/g,M;for(;b=y.exec(d.text);)M||(M=new We(Ae.from(e.schema.text(" ",e.allowedMarks(d.marks))),0,0)),l.push(new uo(c+b.index,c+b.index+b[0].length,M))}}c=p}if(!r.validEnd){let f=r.fillBefore(Ae.empty,!0);n.replace(c,c,new We(f,0,0))}for(let f=l.length-1;f>=0;f--)n.step(l[f])}function DD(n,t,e){return(t==0||n.canReplace(t,n.childCount))&&(e==n.childCount||n.canReplace(0,e))}function fh(n){let e=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,i=0,s=0;;--r){let l=n.$from.node(r),c=n.$from.index(r)+i,f=n.$to.indexAfter(r)-s;if(r<n.depth&&l.canReplace(c,f,e))return r;if(r==0||l.type.spec.isolating||!DD(l,c,f))break;c&&(i=1),f<l.childCount&&(s=1)}return null}function LD(n,t,e){let{$from:r,$to:i,depth:s}=t,l=r.before(s+1),c=i.after(s+1),f=l,d=c,p=Ae.empty,g=0;for(let M=s,C=!1;M>e;M--)C||r.index(M)>0?(C=!0,p=Ae.from(r.node(M).copy(p)),g++):f--;let b=Ae.empty,y=0;for(let M=s,C=!1;M>e;M--)C||i.after(M+1)<i.end(M)?(C=!0,b=Ae.from(i.node(M).copy(b)),y++):d++;n.step(new Zo(f,d,l,c,new We(p.append(b),g,y),p.size-g,!0))}function T5(n,t,e=null,r=n){let i=RD(n,t),s=i&&OD(r,t);return s?i.map(PS).concat({type:t,attrs:e}).concat(s.map(PS)):null}function PS(n){return{type:n,attrs:null}}function RD(n,t){let{parent:e,startIndex:r,endIndex:i}=n,s=e.contentMatchAt(r).findWrapping(t);if(!s)return null;let l=s.length?s[0]:t;return e.canReplaceWith(r,i,l)?s:null}function OD(n,t){let{parent:e,startIndex:r,endIndex:i}=n,s=e.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(e.child(d).type);return!f||!f.validEnd?null:l}function PD(n,t,e){let r=Ae.empty;for(let l=e.length-1;l>=0;l--){if(r.size){let c=e[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=Ae.from(e[l].type.create(e[l].attrs,r))}let i=t.start,s=t.end;n.step(new Zo(i,s,i,s,new We(r,0,0),e.length,!0))}function ID(n,t,e,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(t,e,(l,c)=>{let f=typeof i=="function"?i(l):i;if(l.isTextblock&&!l.hasMarkup(r,f)&&jD(n.doc,n.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&&SA(n,l,c,s),E5(n,n.mapping.slice(s).map(c,1),r,void 0,d===null);let p=n.mapping.slice(s),g=p.map(c,1),b=p.map(c+l.nodeSize,1);return n.step(new Zo(g,b,g+1,b-1,new We(Ae.from(r.create(f,null,l.marks)),0,0),1,!0)),d===!0&&wA(n,l,c,s),!1}})}function wA(n,t,e,r){t.forEach((i,s)=>{if(i.isText){let l,c=/\r?\n|\r/g;for(;l=c.exec(i.text);){let f=n.mapping.slice(r).map(e+1+s+l.index);n.replaceWith(f,f+1,t.type.schema.linebreakReplacement.create())}}})}function SA(n,t,e,r){t.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let l=n.mapping.slice(r).map(e+1+s);n.replaceWith(l,l+1,t.type.schema.text(`
99
- `))}})}function jD(n,t,e){let r=n.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,e)}function zD(n,t,e,r,i){let s=n.doc.nodeAt(t);if(!s)throw new RangeError("No node at given position");e||(e=s.type);let l=e.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(t,t+s.nodeSize,l);if(!e.validContent(s.content))throw new RangeError("Invalid content for node type "+e.name);n.step(new Zo(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new We(Ae.from(l),0,0),1,!0))}function Mu(n,t,e=1,r){let i=n.resolve(t),s=i.depth-e,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=e-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 C=r&&r[p]||g;if(!g.canReplace(b+1,g.childCount)||!C.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 BD(n,t,e=1,r){let i=n.doc.resolve(t),s=Ae.empty,l=Ae.empty;for(let c=i.depth,f=i.depth-e,d=e-1;c>f;c--,d--){s=Ae.from(i.node(c).copy(s));let p=r&&r[d];l=Ae.from(p?p.type.create(p.attrs,l):i.node(c).copy(l))}n.step(new uo(t,t,new We(s.append(l),e,e),!0))}function vf(n,t){let e=n.resolve(t),r=e.index();return kA(e.nodeBefore,e.nodeAfter)&&e.parent.canReplace(r,r+1)}function FD(n,t){t.content.size||n.type.compatibleContent(t.type);let e=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<t.childCount;i++){let s=t.child(i),l=s.type==r?n.type.schema.nodes.text:s.type;if(e=e.matchType(l),!e||!n.type.allowsMarks(s.marks))return!1}return e.validEnd}function kA(n,t){return!!(n&&t&&!n.isLeaf&&FD(n,t))}function M0(n,t,e=-1){let r=n.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):e>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&&kA(s,l)&&r.node(i).canReplace(c,c+1))return t;if(i==0)break;t=e<0?r.before(i):r.after(i)}}function UD(n,t,e){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(t-e),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=n.steps.length;if(r===!1){let p=n.doc.resolve(t+e);SA(n,p.node(),p.before(),c)}l.inlineContent&&E5(n,t+e-1,l,s.node().contentMatchAt(s.index()),r==null);let f=n.mapping.slice(c),d=f.map(t-e);if(n.step(new uo(d,f.map(t+e,-1),We.empty,!0)),r===!0){let p=n.doc.resolve(d);wA(n,p.node(),p.before(),n.steps.length)}return n}function HD(n,t,e){let r=n.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),e))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,e))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,e))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function AA(n,t,e){let r=n.resolve(t);if(!e.content.size)return t;let i=e.content;for(let s=0;s<e.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(e.openStart==0&&e.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 C0(n,t,e=t,r=We.empty){if(t==e&&!r.size)return null;let i=n.resolve(t),s=n.resolve(e);return MA(i,s,r)?new uo(t,e,r):new qD(i,s,r).fit()}function MA(n,t,e){return!e.openStart&&!e.openEnd&&n.start()==t.start()&&n.parent.canReplace(n.index(),t.index(),e.content)}class qD{constructor(t,e,r){this.$from=t,this.$to=e,this.unplaced=r,this.frontier=[],this.placed=Ae.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=Ae.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(),e=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 We(s,l,c);return t>-1?new Zo(r.pos,t,this.$to.pos,this.$to.end(),f,e):f.size||r.pos!=this.$to.pos?new uo(r.pos,i.pos,f):null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<t;r++){let s=e.firstChild;if(e.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){t=r;break}e=s.content}for(let e=1;e<=2;e++)for(let r=e==1?t:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=IS(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(e==1&&(l?d.matchType(l.type)||(g=d.fillBefore(Ae.from(l),!1)):s&&f.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:c,parent:s,inject:g};if(e==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:e,openEnd:r}=this.unplaced;return jS(t,-1)<=e?!1:(this.unplaced.size>1&&jS(t,1)>r&&r++,this.unplaced=new We(t,e+1,r),!0)}dropNode(){let{content:t,openStart:e,openEnd:r}=this.unplaced,i=IS(t,e);if(i.childCount<=1&&e>0){let s=t.size-e<=e+i.size;this.unplaced=new We(Vh(t,e-1,1),e-1,s?e-1:r)}else this.unplaced=new We(Vh(t,e,1),e,r)}placeNodes({sliceDepth:t,frontierDepth:e,parent:r,inject:i,wrap:s}){for(;this.depth>e;)this.closeFrontierNode();if(s)for(let C=0;C<s.length;C++)this.openFrontierNode(s[C]);let l=this.unplaced,c=r?r.content:l.content,f=l.openStart-t,d=0,p=[],{match:g,type:b}=this.frontier[e];if(i){for(let C=0;C<i.childCount;C++)p.push(i.child(C));g=g.matchFragment(i)}let y=c.size+t-(l.content.size-l.openEnd);for(;d<c.childCount;){let C=c.child(d),L=g.matchType(C.type);if(!L)break;d++,(d>1||f==0||C.content.size)&&(g=L,p.push(CA(C.mark(b.allowedMarks(C.marks)),d==1?f:0,d==c.childCount?y:-1)))}let M=d==c.childCount;M||(y=-1),this.placed=Wh(this.placed,e,Ae.from(p)),this.frontier[e].match=g,M&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let C=0,L=c;C<y;C++){let R=L.lastChild;this.frontier.push({type:R.type,match:R.contentMatchAt(R.childCount)}),L=R.content}this.unplaced=M?t==0?We.empty:new We(Vh(l.content,t-1,1),t-1,y<0?l.openEnd:t-1):new We(Vh(l.content,t,d),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],e;if(!t.type.isTextblock||!_y(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.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 e=Math.min(this.depth,t.depth);e>=0;e--){let{match:r,type:i}=this.frontier[e],s=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),l=_y(t,e,i,r,s);if(l){for(let c=e-1;c>=0;c--){let{match:f,type:d}=this.frontier[c],p=_y(t,c,d,f,!0);if(!p||p.childCount)continue t}return{depth:e,fit:l,move:s?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=Wh(this.placed,e.depth,e.fit)),t=e.move;for(let r=e.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,e=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=Wh(this.placed,this.depth,Ae.from(t.create(e,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Ae.empty,!0);e.childCount&&(this.placed=Wh(this.placed,this.frontier.length,e))}}function Vh(n,t,e){return t==0?n.cutByIndex(e,n.childCount):n.replaceChild(0,n.firstChild.copy(Vh(n.firstChild.content,t-1,e)))}function Wh(n,t,e){return t==0?n.append(e):n.replaceChild(n.childCount-1,n.lastChild.copy(Wh(n.lastChild.content,t-1,e)))}function IS(n,t){for(let e=0;e<t;e++)n=n.firstChild.content;return n}function CA(n,t,e){if(t<=0)return n;let r=n.content;return t>1&&(r=r.replaceChild(0,CA(r.firstChild,t-1,r.childCount==1?e-1:0))),t>0&&(r=n.type.contentMatch.fillBefore(r).append(r),e<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(Ae.empty,!0)))),n.copy(r)}function _y(n,t,e,r,i){let s=n.node(t),l=i?n.indexAfter(t):n.index(t);if(l==s.childCount&&!e.compatibleContent(s.type))return null;let c=r.fillBefore(s.content,!0,l);return c&&!$D(e,s.content,l)?c:null}function $D(n,t,e){for(let r=e;r<t.childCount;r++)if(!n.allowsMarks(t.child(r).marks))return!0;return!1}function YD(n){return n.spec.defining||n.spec.definingForContent}function jS(n,t){for(let e=0;;e++){let r=t<0?n.firstChild:n.lastChild;if(!r||r.isAtom)return e;n=r.content}}function VD(n,t,e,r){if(!r.size)return n.deleteRange(t,e);let i=n.doc.resolve(t),s=n.doc.resolve(e);if(MA(i,s,r))return n.step(new uo(t,e,r));let l=TA(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=YD(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 C=0;C<l.length;C++){let L=l[(C+f)%l.length],R=!0;L<0&&(R=!1,L=-L);let B=i.node(L-1),q=i.index(L-1);if(B.canReplaceWith(q,q,M.type,M.marks))return n.replace(i.before(L),R?s.after(L):e,new We(EA(r.content,0,r.openStart,y),y,r.openEnd))}}let g=n.steps.length;for(let b=l.length-1;b>=0&&(n.replace(t,e,r),!(n.steps.length>g));b--){let y=l[b];y<0||(t=i.before(y),e=s.after(y))}}function EA(n,t,e,r,i){if(t<e){let s=n.firstChild;n=n.replaceChild(0,s.copy(EA(s.content,t+1,e,r,s)))}if(t>r){let s=i.contentMatchAt(0),l=s.fillBefore(n).append(n);n=l.append(s.matchFragment(l).fillBefore(Ae.empty,!0))}return n}function WD(n,t,e,r){if(!r.isInline&&t==e&&n.doc.resolve(t).parent.content.size){let i=HD(n.doc,t,r.type);i!=null&&(t=e=i)}n.replaceRange(t,e,new We(Ae.from(r),0,0))}function XD(n,t,e){let r=n.doc.resolve(t),i=n.doc.resolve(e);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let l=r.sharedDepth(e),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&&e==i.start(f);f--)e=i.before(f);r=n.doc.resolve(t),i=n.doc.resolve(e)}}let s=TA(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 n.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 n.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&&e>r.end(l)&&i.end(l)-e!=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 n.delete(r.before(l),e);n.delete(t,e)}function TA(n,t){let e=[],r=Math.min(n.depth,t.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<n.pos-(n.depth-i)||t.end(i)>t.pos+(t.depth-i)||n.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(s==t.start(i)||i==n.depth&&i==t.depth&&n.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==s-1)&&e.push(i)}return e}class Kd extends Gs{constructor(t,e,r){super(),this.pos=t,this.attr=e,this.value=r}apply(t){let e=t.nodeAt(this.pos);if(!e)return Co.fail("No node at attribute step's position");let r=Object.create(null);for(let s in e.attrs)r[s]=e.attrs[s];r[this.attr]=this.value;let i=e.type.create(r,null,e.marks);return Co.fromReplace(t,this.pos,this.pos+1,new We(Ae.from(i),0,e.isLeaf?0:1))}getMap(){return el.empty}invert(t){return new Kd(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Kd(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.pos!="number"||typeof e.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Kd(e.pos,e.attr,e.value)}}Gs.jsonID("attr",Kd);class kp extends Gs{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let i in t.attrs)e[i]=t.attrs[i];e[this.attr]=this.value;let r=t.type.create(e,t.content,t.marks);return Co.ok(r)}getMap(){return el.empty}invert(t){return new kp(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new kp(e.attr,e.value)}}Gs.jsonID("docAttr",kp);let Qd=class extends Error{};Qd=function n(t){let e=Error.call(this,t);return e.__proto__=n.prototype,e};Qd.prototype=Object.create(Error.prototype);Qd.prototype.constructor=Qd;Qd.prototype.name="TransformError";class NA{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new Sp}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new Qd(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,e=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(t=i.map(t,1),e=i.map(e,-1)),i.forEach((s,l,c,f)=>{t=Math.min(t,c),e=Math.max(e,f)})}return t==1e9?null:{from:t,to:e}}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,r=We.empty){let i=C0(this.doc,t,e,r);return i&&this.step(i),this}replaceWith(t,e,r){return this.replace(t,e,new We(Ae.from(r),0,0))}delete(t,e){return this.replace(t,e,We.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,r){return VD(this,t,e,r),this}replaceRangeWith(t,e,r){return WD(this,t,e,r),this}deleteRange(t,e){return XD(this,t,e),this}lift(t,e){return LD(this,t,e),this}join(t,e=1){return UD(this,t,e),this}wrap(t,e){return PD(this,t,e),this}setBlockType(t,e=t,r,i=null){return ID(this,t,e,r,i),this}setNodeMarkup(t,e,r=null,i){return zD(this,t,e,r,i),this}setNodeAttribute(t,e,r){return this.step(new Kd(t,e,r)),this}setDocAttribute(t,e){return this.step(new kp(t,e)),this}addNodeMark(t,e){return this.step(new uf(t,e)),this}removeNodeMark(t,e){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(e instanceof ci)e.isInSet(r.marks)&&this.step(new ad(t,e));else{let i=r.marks,s,l=[];for(;s=e.isInSet(i);)l.push(new ad(t,s)),i=s.removeFromSet(i);for(let c=l.length-1;c>=0;c--)this.step(l[c])}return this}split(t,e=1,r){return BD(this,t,e,r),this}addMark(t,e,r){return ND(this,t,e,r),this}removeMark(t,e,r){return _D(this,t,e,r),this}clearIncompatible(t,e,r){return E5(this,t,e,r),this}}const Dy=Object.create(null);class er{constructor(t,e,r){this.$anchor=t,this.$head=e,this.ranges=r||[new GD(t.min(e),t.max(e))]}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 e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=We.empty){let r=e.content.lastChild,i=null;for(let c=0;c<e.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?We.empty:e),c==0&&FS(t,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(t,e){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,e),FS(t,r,e.isInline?-1:1))}}static findFrom(t,e,r=!1){let i=t.parent.inlineContent?new Ln(t):Fd(t.node(0),t.parent,t.pos,t.index(),e,r);if(i)return i;for(let s=t.depth-1;s>=0;s--){let l=e<0?Fd(t.node(0),t.node(s),t.before(s+1),t.index(s),e,r):Fd(t.node(0),t.node(s),t.after(s+1),t.index(s)+1,e,r);if(l)return l}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new il(t.node(0))}static atStart(t){return Fd(t,t,0,0,1)||new il(t)}static atEnd(t){return Fd(t,t,t.content.size,t.childCount,-1)||new il(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Dy[e.type];if(!r)throw new RangeError(`No selection type ${e.type} defined`);return r.fromJSON(t,e)}static jsonID(t,e){if(t in Dy)throw new RangeError("Duplicate use of selection JSON ID "+t);return Dy[t]=e,e.prototype.jsonID=t,e}getBookmark(){return Ln.between(this.$anchor,this.$head).getBookmark()}}er.prototype.visible=!0;class GD{constructor(t,e){this.$from=t,this.$to=e}}let zS=!1;function BS(n){!zS&&!n.parent.inlineContent&&(zS=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Ln extends er{constructor(t,e=t){BS(t),BS(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let r=t.resolve(e.map(this.head));if(!r.parent.inlineContent)return er.near(r);let i=t.resolve(e.map(this.anchor));return new Ln(i.parent.inlineContent?i:r,r)}replace(t,e=We.empty){if(super.replace(t,e),e==We.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof Ln&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new E0(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if(typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Ln(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,r=e){let i=t.resolve(e);return new this(i,r==e?i:t.resolve(r))}static between(t,e,r){let i=t.pos-e.pos;if((!r||i)&&(r=i>=0?1:-1),!e.parent.inlineContent){let s=er.findFrom(e,r,!0)||er.findFrom(e,-r,!0);if(s)e=s.$head;else return er.near(e,r)}return t.parent.inlineContent||(i==0?t=e:(t=(er.findFrom(t,-r,!0)||er.findFrom(t,r,!0)).$anchor,t.pos<e.pos!=i<0&&(t=e))),new Ln(t,e)}}er.jsonID("text",Ln);class E0{constructor(t,e){this.anchor=t,this.head=e}map(t){return new E0(t.map(this.anchor),t.map(this.head))}resolve(t){return Ln.between(t.resolve(this.anchor),t.resolve(this.head))}}class kn extends er{constructor(t){let e=t.nodeAfter,r=t.node(0).resolve(t.pos+e.nodeSize);super(t,r),this.node=e}map(t,e){let{deleted:r,pos:i}=e.mapResult(this.anchor),s=t.resolve(i);return r?er.near(s):new kn(s)}content(){return new We(Ae.from(this.node),0,0)}eq(t){return t instanceof kn&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new N5(this.anchor)}static fromJSON(t,e){if(typeof e.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new kn(t.resolve(e.anchor))}static create(t,e){return new kn(t.resolve(e))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}kn.prototype.visible=!1;er.jsonID("node",kn);class N5{constructor(t){this.anchor=t}map(t){let{deleted:e,pos:r}=t.mapResult(this.anchor);return e?new E0(r,r):new N5(r)}resolve(t){let e=t.resolve(this.anchor),r=e.nodeAfter;return r&&kn.isSelectable(r)?new kn(e):er.near(e)}}class il extends er{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=We.empty){if(e==We.empty){t.delete(0,t.doc.content.size);let r=er.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(t){return new il(t)}map(t){return new il(t)}eq(t){return t instanceof il}getBookmark(){return KD}}er.jsonID("all",il);const KD={map(){return this},resolve(n){return new il(n)}};function Fd(n,t,e,r,i,s=!1){if(t.inlineContent)return Ln.create(n,e);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&&kn.isSelectable(c))return kn.create(n,e-(i<0?c.nodeSize:0))}else{let f=Fd(n,c,e+i,i<0?c.childCount:0,i,s);if(f)return f}e+=c.nodeSize*i}return null}function FS(n,t,e){let r=n.steps.length-1;if(r<t)return;let i=n.steps[r];if(!(i instanceof uo||i instanceof Zo))return;let s=n.mapping.maps[r],l;s.forEach((c,f,d,p)=>{l==null&&(l=p)}),n.setSelection(er.near(n.doc.resolve(l),e))}const US=1,Fm=2,HS=4;class JD extends NA{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|US)&~Fm,this.storedMarks=null,this}get selectionSet(){return(this.updated&US)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=Fm,this}ensureMarks(t){return ci.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&Fm)>0}addStep(t,e){super.addStep(t,e),this.updated=this.updated&~Fm,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,e=!0){let r=this.selection;return e&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ci.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,e,r){let i=this.doc.type.schema;if(e==null)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(r==null&&(r=e),!t)return this.deleteRange(e,r);let s=this.storedMarks;if(!s){let l=this.doc.resolve(e);s=r==e?l.marks():l.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(e,r,i.text(t,s)),!this.selection.empty&&this.selection.to==e+t.length&&this.setSelection(er.near(this.selection.$to)),this}}setMeta(t,e){return this.meta[typeof t=="string"?t:t.key]=e,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|=HS,this}get scrolledIntoView(){return(this.updated&HS)>0}}function qS(n,t){return!t||!n?n:n.bind(t)}class Xh{constructor(t,e,r){this.name=t,this.init=qS(e.init,r),this.apply=qS(e.apply,r)}}const ZD=[new Xh("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Xh("selection",{init(n,t){return n.selection||er.atStart(t.doc)},apply(n){return n.selection}}),new Xh("storedMarks",{init(n){return n.storedMarks||null},apply(n,t,e,r){return r.selection.$cursor?n.storedMarks:null}}),new Xh("scrollToSelection",{init(){return 0},apply(n,t){return n.scrolledIntoView?t+1:t}})];class Ly{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=ZD.slice(),e&&e.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 Xh(r.key,r.spec.state,r))})}}class qf{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,e=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=e){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 e=[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<e.length&&c.spec.appendTransaction.call(c,f?e.slice(f):e,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:e.length}:{state:this,n:0})}e.push(p),r=r.applyInner(p),s=!0}i&&(i[l]={state:r,n:e.length})}}if(!s)return{state:r,transactions:e}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let e=new qf(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];e[s.name]=s.apply(t,this[s.name],this,e)}return e}get tr(){return new JD(this)}static create(t){let e=new Ly(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new qf(e);for(let i=0;i<e.fields.length;i++)r[e.fields[i].name]=e.fields[i].init(t,r);return r}reconfigure(t){let e=new Ly(this.schema,t.plugins),r=e.fields,i=new qf(e);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 e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.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&&(e[r]=s.toJSON.call(i,this[i.key]))}return e}static fromJSON(t,e,r){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new Ly(t.schema,t.plugins),s=new qf(i);return i.fields.forEach(l=>{if(l.name=="doc")s.doc=Jf.fromJSON(t.schema,e.doc);else if(l.name=="selection")s.selection=er.fromJSON(s.doc,e.selection);else if(l.name=="storedMarks")e.storedMarks&&(s.storedMarks=e.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(e,c)){s[l.name]=d.fromJSON.call(f,t,e[c],s);return}}s[l.name]=l.init(t,s)}}),s}}function _A(n,t,e){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(t):r=="handleDOMEvents"&&(i=_A(i,t,{})),e[r]=i}return e}class Fi{constructor(t){this.spec=t,this.props={},t.props&&_A(t.props,this,this.props),this.key=t.key?t.key.key:DA("plugin")}getState(t){return t[this.key]}}const Ry=Object.create(null);function DA(n){return n in Ry?n+"$"+ ++Ry[n]:(Ry[n]=0,n+"$")}class To{constructor(t="key"){this.key=DA(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const LA=(n,t)=>n.selection.empty?!1:(t&&t(n.tr.deleteSelection().scrollIntoView()),!0);function RA(n,t){let{$cursor:e}=n.selection;return!e||(t?!t.endOfTextblock("backward",n):e.parentOffset>0)?null:e}const OA=(n,t,e)=>{let r=RA(n,e);if(!r)return!1;let i=_5(r);if(!i){let l=r.blockRange(),c=l&&fh(l);return c==null?!1:(t&&t(n.tr.lift(l,c).scrollIntoView()),!0)}let s=i.nodeBefore;if(qA(n,i,t,-1))return!0;if(r.parent.content.size==0&&(th(s,"end")||kn.isSelectable(s)))for(let l=r.depth;;l--){let c=C0(n.doc,r.before(l),r.after(l),We.empty);if(c&&c.slice.size<c.to-c.from){if(t){let f=n.tr.step(c);f.setSelection(th(s,"end")?er.findFrom(f.doc.resolve(f.mapping.map(i.pos,-1)),-1):kn.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(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},QD=(n,t,e)=>{let r=RA(n,e);if(!r)return!1;let i=_5(r);return i?PA(n,i,t):!1},tL=(n,t,e)=>{let r=jA(n,e);if(!r)return!1;let i=D5(r);return i?PA(n,i,t):!1};function PA(n,t,e){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=C0(n.doc,s,f,We.empty);if(!d||d.from!=s||d instanceof uo&&d.slice.size>=f-s)return!1;if(e){let p=n.tr.step(d);p.setSelection(Ln.create(p.doc,s)),e(p.scrollIntoView())}return!0}function th(n,t,e=!1){for(let r=n;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(e&&r.childCount!=1)return!1}return!1}const IA=(n,t,e)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(e?!e.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=_5(r)}let l=s&&s.nodeBefore;return!l||!kn.isSelectable(l)?!1:(t&&t(n.tr.setSelection(kn.create(n.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function _5(n){if(!n.parent.type.spec.isolating)for(let t=n.depth-1;t>=0;t--){if(n.index(t)>0)return n.doc.resolve(n.before(t+1));if(n.node(t).type.spec.isolating)break}return null}function jA(n,t){let{$cursor:e}=n.selection;return!e||(t?!t.endOfTextblock("forward",n):e.parentOffset<e.parent.content.size)?null:e}const zA=(n,t,e)=>{let r=jA(n,e);if(!r)return!1;let i=D5(r);if(!i)return!1;let s=i.nodeAfter;if(qA(n,i,t,1))return!0;if(r.parent.content.size==0&&(th(s,"start")||kn.isSelectable(s))){let l=C0(n.doc,r.before(),r.after(),We.empty);if(l&&l.slice.size<l.to-l.from){if(t){let c=n.tr.step(l);c.setSelection(th(s,"start")?er.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):kn.create(c.doc,c.mapping.map(i.pos))),t(c.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(t&&t(n.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},BA=(n,t,e)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(e?!e.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=D5(r)}let l=s&&s.nodeAfter;return!l||!kn.isSelectable(l)?!1:(t&&t(n.tr.setSelection(kn.create(n.doc,s.pos)).scrollIntoView()),!0)};function D5(n){if(!n.parent.type.spec.isolating)for(let t=n.depth-1;t>=0;t--){let e=n.node(t);if(n.index(t)+1<e.childCount)return n.doc.resolve(n.after(t+1));if(e.type.spec.isolating)break}return null}const eL=(n,t)=>{let e=n.selection,r=e instanceof kn,i;if(r){if(e.node.isTextblock||!vf(n.doc,e.from))return!1;i=e.from}else if(i=M0(n.doc,e.from,-1),i==null)return!1;if(t){let s=n.tr.join(i);r&&s.setSelection(kn.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),t(s.scrollIntoView())}return!0},nL=(n,t)=>{let e=n.selection,r;if(e instanceof kn){if(e.node.isTextblock||!vf(n.doc,e.to))return!1;r=e.to}else if(r=M0(n.doc,e.to,1),r==null)return!1;return t&&t(n.tr.join(r).scrollIntoView()),!0},rL=(n,t)=>{let{$from:e,$to:r}=n.selection,i=e.blockRange(r),s=i&&fh(i);return s==null?!1:(t&&t(n.tr.lift(i,s).scrollIntoView()),!0)},FA=(n,t)=>{let{$head:e,$anchor:r}=n.selection;return!e.parent.type.spec.code||!e.sameParent(r)?!1:(t&&t(n.tr.insertText(`
100
- `).scrollIntoView()),!0)};function L5(n){for(let t=0;t<n.edgeCount;t++){let{type:e}=n.edge(t);if(e.isTextblock&&!e.hasRequiredAttrs())return e}return null}const iL=(n,t)=>{let{$head:e,$anchor:r}=n.selection;if(!e.parent.type.spec.code||!e.sameParent(r))return!1;let i=e.node(-1),s=e.indexAfter(-1),l=L5(i.contentMatchAt(s));if(!l||!i.canReplaceWith(s,s,l))return!1;if(t){let c=e.after(),f=n.tr.replaceWith(c,c,l.createAndFill());f.setSelection(er.near(f.doc.resolve(c),1)),t(f.scrollIntoView())}return!0},UA=(n,t)=>{let e=n.selection,{$from:r,$to:i}=e;if(e instanceof il||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=L5(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=n.tr.insert(l,s.createAndFill());c.setSelection(Ln.create(c.doc,l+1)),t(c.scrollIntoView())}return!0},HA=(n,t)=>{let{$cursor:e}=n.selection;if(!e||e.parent.content.size)return!1;if(e.depth>1&&e.after()!=e.end(-1)){let s=e.before();if(Mu(n.doc,s))return t&&t(n.tr.split(s).scrollIntoView()),!0}let r=e.blockRange(),i=r&&fh(r);return i==null?!1:(t&&t(n.tr.lift(r,i).scrollIntoView()),!0)};function oL(n){return(t,e)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof kn&&t.selection.node.isBlock)return!r.parentOffset||!Mu(t.doc,r.pos)?!1:(e&&e(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=L5(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 Ln||t.selection instanceof il)&&p.deleteSelection();let g=p.mapping.map(r.pos),b=Mu(p.doc,g,s.length,s);if(b||(s[0]=c?{type:c}:null,b=Mu(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 e&&e(p.scrollIntoView()),!0}}const sL=oL(),aL=(n,t)=>{let{$from:e,to:r}=n.selection,i,s=e.sharedDepth(r);return s==0?!1:(i=e.before(s),t&&t(n.tr.setSelection(kn.create(n.doc,i))),!0)};function lL(n,t,e){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)?(e&&e(n.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(s,s+1)||!(i.isTextblock||vf(n.doc,t.pos))?!1:(e&&e(n.tr.join(t.pos).scrollIntoView()),!0)}function qA(n,t,e,r){let i=t.nodeBefore,s=t.nodeAfter,l,c,f=i.type.spec.isolating||s.type.spec.isolating;if(!f&&lL(n,t,e))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(e){let y=t.pos+s.nodeSize,M=Ae.empty;for(let R=l.length-1;R>=0;R--)M=Ae.from(l[R].create(null,M));M=Ae.from(i.copy(M));let C=n.tr.step(new Zo(t.pos-1,y,t.pos,y,new We(M,1,0),l.length,!0)),L=C.doc.resolve(y+2*l.length);L.nodeAfter&&L.nodeAfter.type==i.type&&vf(C.doc,L.pos)&&C.join(L.pos),e(C.scrollIntoView())}return!0}let p=s.type.spec.isolating||r>0&&f?null:er.findFrom(t,1),g=p&&p.$from.blockRange(p.$to),b=g&&fh(g);if(b!=null&&b>=t.depth)return e&&e(n.tr.lift(g,b).scrollIntoView()),!0;if(d&&th(s,"start",!0)&&th(i,"end")){let y=i,M=[];for(;M.push(y),!y.isTextblock;)y=y.lastChild;let C=s,L=1;for(;!C.isTextblock;C=C.firstChild)L++;if(y.canReplace(y.childCount,y.childCount,C.content)){if(e){let R=Ae.empty;for(let q=M.length-1;q>=0;q--)R=Ae.from(M[q].copy(R));let B=n.tr.step(new Zo(t.pos-M.length,t.pos+s.nodeSize,t.pos+L,t.pos+s.nodeSize-L,new We(R,M.length,0),0,!0));e(B.scrollIntoView())}return!0}}return!1}function $A(n){return function(t,e){let r=t.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(e&&e(t.tr.setSelection(Ln.create(t.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const cL=$A(-1),uL=$A(1);function fL(n,t=null){return function(e,r){let{$from:i,$to:s}=e.selection,l=i.blockRange(s),c=l&&T5(l,n,t);return c?(r&&r(e.tr.wrap(l,c).scrollIntoView()),!0):!1}}function $S(n,t=null){return function(e,r){let i=!1;for(let s=0;s<e.selection.ranges.length&&!i;s++){let{$from:{pos:l},$to:{pos:c}}=e.selection.ranges[s];e.doc.nodesBetween(l,c,(f,d)=>{if(i)return!1;if(!(!f.isTextblock||f.hasMarkup(n,t)))if(f.type==n)i=!0;else{let p=e.doc.resolve(d),g=p.index();i=p.parent.canReplaceWith(g,g+1,n)}})}if(!i)return!1;if(r){let s=e.tr;for(let l=0;l<e.selection.ranges.length;l++){let{$from:{pos:c},$to:{pos:f}}=e.selection.ranges[l];s.setBlockType(c,f,n,t)}r(s.scrollIntoView())}return!0}}function R5(...n){return function(t,e,r){for(let i=0;i<n.length;i++)if(n[i](t,e,r))return!0;return!1}}R5(LA,OA,IA);R5(LA,zA,BA);R5(FA,UA,HA,sL);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function dL(n,t=null){return function(e,r){let{$from:i,$to:s}=e.selection,l=i.blockRange(s);if(!l)return!1;let c=r?e.tr:null;return hL(c,l,n,t)?(r&&r(c.scrollIntoView()),!0):!1}}function hL(n,t,e,r=null){let i=!1,s=t,l=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(e)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let f=l.resolve(t.start-2);s=new kg(f,f,t.depth),t.endIndex<t.parent.childCount&&(t=new kg(t.$from,l.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let c=T5(s,e,r,t);return c?(n&&pL(n,t,c,i,e),!0):!1}function pL(n,t,e,r,i){let s=Ae.empty;for(let p=e.length-1;p>=0;p--)s=Ae.from(e[p].type.create(e[p].attrs,s));n.step(new Zo(t.start-(r?2:0),t.end,t.start,t.end,new We(s,0,0),e.length,!0));let l=0;for(let p=0;p<e.length;p++)e[p].type==i&&(l=p+1);let c=e.length-l,f=t.start+e.length-(r?2:0),d=t.parent;for(let p=t.startIndex,g=t.endIndex,b=!0;p<g;p++,b=!1)!b&&Mu(n.doc,f,c)&&(n.split(f,c),f+=2*c),f+=d.child(p).nodeSize;return n}function mL(n){return function(t,e){let{$from:r,$to:i}=t.selection,s=r.blockRange(i,l=>l.childCount>0&&l.firstChild.type==n);return s?e?r.node(s.depth-1).type==n?gL(t,e,n,s):yL(t,e,s):!0:!1}}function gL(n,t,e,r){let i=n.tr,s=r.end,l=r.$to.end(r.depth);s<l&&(i.step(new Zo(s-1,l,s,l,new We(Ae.from(e.create(null,r.parent.copy())),1,0),1,!0)),r=new kg(i.doc.resolve(r.$from.pos),i.doc.resolve(l),r.depth));const c=fh(r);if(c==null)return!1;i.lift(r,c);let f=i.doc.resolve(i.mapping.map(s,-1)-1);return vf(i.doc,f.pos)&&f.nodeBefore.type==f.nodeAfter.type&&i.join(f.pos),t(i.scrollIntoView()),!0}function yL(n,t,e){let r=n.tr,i=e.parent;for(let y=e.end,M=e.endIndex-1,C=e.startIndex;M>C;M--)y-=i.child(M).nodeSize,r.delete(y-1,y+1);let s=r.doc.resolve(e.start),l=s.nodeAfter;if(r.mapping.map(e.end)!=e.start+s.nodeAfter.nodeSize)return!1;let c=e.startIndex==0,f=e.endIndex==i.childCount,d=s.node(-1),p=s.index(-1);if(!d.canReplace(p+(c?0:1),p+1,l.content.append(f?Ae.empty:Ae.from(i))))return!1;let g=s.pos,b=g+l.nodeSize;return r.step(new Zo(g-(c?1:0),b+(f?1:0),g+1,b-1,new We((c?Ae.empty:Ae.from(i.copy(Ae.empty))).append(f?Ae.empty:Ae.from(i.copy(Ae.empty))),c?0:1,f?0:1),c?0:1)),t(r.scrollIntoView()),!0}function bL(n){return function(t,e){let{$from:r,$to:i}=t.selection,s=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==n);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!=n)return!1;if(e){let d=f.lastChild&&f.lastChild.type==c.type,p=Ae.from(d?n.create():null),g=new We(Ae.from(n.create(null,Ae.from(c.type.create(null,p)))),d?3:1,0),b=s.start,y=s.end;e(t.tr.step(new Zo(b-(d?3:1),y,b,y,g,1,!0)).scrollIntoView())}return!0}}const Ms=function(n){for(var t=0;;t++)if(n=n.previousSibling,!n)return t},eh=function(n){let t=n.assignedSlot||n.parentNode;return t&&t.nodeType==11?t.host:t};let F2=null;const wu=function(n,t,e){let r=F2||(F2=document.createRange());return r.setEnd(n,e??n.nodeValue.length),r.setStart(n,t||0),r},xL=function(){F2=null},ld=function(n,t,e,r){return e&&(YS(n,t,e,r,-1)||YS(n,t,e,r,1))},vL=/^(img|br|input|textarea|hr)$/i;function YS(n,t,e,r,i){for(var s;;){if(n==e&&t==r)return!0;if(t==(i<0?0:Il(n))){let l=n.parentNode;if(!l||l.nodeType!=1||Lp(n)||vL.test(n.nodeName)||n.contentEditable=="false")return!1;t=Ms(n)+(i<0?0:1),n=l}else if(n.nodeType==1){let l=n.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 n=l,t=i<0?Il(n):0}else return!1}}function Il(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function wL(n,t){for(;;){if(n.nodeType==3&&t)return n;if(n.nodeType==1&&t>0){if(n.contentEditable=="false")return null;n=n.childNodes[t-1],t=Il(n)}else if(n.parentNode&&!Lp(n))t=Ms(n),n=n.parentNode;else return null}}function SL(n,t){for(;;){if(n.nodeType==3&&t<n.nodeValue.length)return n;if(n.nodeType==1&&t<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[t],t=0}else if(n.parentNode&&!Lp(n))t=Ms(n)+1,n=n.parentNode;else return null}}function kL(n,t,e){for(let r=t==0,i=t==Il(n);r||i;){if(n==e)return!0;let s=Ms(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==Il(n)}}function Lp(n){let t;for(let e=n;e&&!(t=e.pmViewDesc);e=e.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==n||t.contentDOM==n)}const T0=function(n){return n.focusNode&&ld(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Uf(n,t){let e=document.createEvent("Event");return e.initEvent("keydown",!0,!0),e.keyCode=n,e.key=e.code=t,e}function AL(n){let t=n.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function ML(n,t,e){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(t,e);if(r)return{node:r.offsetNode,offset:Math.min(Il(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(t,e);if(r)return{node:r.startContainer,offset:Math.min(Il(r.startContainer),r.startOffset)}}}const Bc=typeof navigator<"u"?navigator:null,VS=typeof document<"u"?document:null,wf=Bc&&Bc.userAgent||"",U2=/Edge\/(\d+)/.exec(wf),YA=/MSIE \d/.exec(wf),H2=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(wf),Ia=!!(YA||H2||U2),hf=YA?document.documentMode:H2?+H2[1]:U2?+U2[1]:0,jl=!Ia&&/gecko\/(\d+)/i.test(wf);jl&&+(/Firefox\/(\d+)/.exec(wf)||[0,0])[1];const q2=!Ia&&/Chrome\/(\d+)/.exec(wf),Es=!!q2,VA=q2?+q2[1]:0,Xs=!Ia&&!!Bc&&/Apple Computer/.test(Bc.vendor),nh=Xs&&(/Mobile\/\w+/.test(wf)||!!Bc&&Bc.maxTouchPoints>2),Pl=nh||(Bc?/Mac/.test(Bc.platform):!1),WA=Bc?/Win/.test(Bc.platform):!1,ku=/Android \d/.test(wf),Rp=!!VS&&"webkitFontSmoothing"in VS.documentElement.style,CL=Rp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function EL(n){let t=n.defaultView&&n.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function gu(n,t){return typeof n=="number"?n:n[t]}function TL(n){let t=n.getBoundingClientRect(),e=t.width/n.offsetWidth||1,r=t.height/n.offsetHeight||1;return{left:t.left,right:t.left+n.clientWidth*e,top:t.top,bottom:t.top+n.clientHeight*r}}function WS(n,t,e){if(!$2(t)&&t.left==0)return;let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let l=e||n.dom;l;){if(l.nodeType!=1){l=eh(l);continue}let c=l,f=c==s.body,d=f?EL(s):TL(c),p=0,g=0;if(t.top<d.top+gu(r,"top")?g=-(d.top-t.top+gu(i,"top")):t.bottom>d.bottom-gu(r,"bottom")&&(g=t.bottom-t.top>d.bottom-d.top?t.top+gu(i,"top")-d.top:t.bottom-d.bottom+gu(i,"bottom")),t.left<d.left+gu(r,"left")?p=-(d.left-t.left+gu(i,"left")):t.right>d.right-gu(r,"right")&&(p=t.right-d.right+gu(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 C=c.scrollLeft-y,L=c.scrollTop-M;t={left:t.left-C,top:t.top-L,right:t.right-C,bottom:t.bottom-L}}let b=f?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(b))break;l=b=="absolute"?l.offsetParent:eh(l)}}function NL(n){let t=n.dom.getBoundingClientRect(),e=Math.max(0,t.top),r,i;for(let s=(t.left+t.right)/2,l=e+1;l<Math.min(innerHeight,t.bottom);l+=5){let c=n.root.elementFromPoint(s,l);if(!c||c==n.dom||!n.dom.contains(c))continue;let f=c.getBoundingClientRect();if(f.top>=e-20){r=c,i=f.top;break}}return{refDOM:r,refTop:i,stack:XA(n.dom)}}function XA(n){let t=[],e=n.ownerDocument;for(let r=n;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=e);r=eh(r));return t}function _L({refDOM:n,refTop:t,stack:e}){let r=n?n.getBoundingClientRect().top:0;GA(e,r==0?0:r-t)}function GA(n,t){for(let e=0;e<n.length;e++){let{dom:r,top:i,left:s}=n[e];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Dd=null;function DL(n){if(n.setActive)return n.setActive();if(Dd)return n.focus(Dd);let t=XA(n);n.focus(Dd==null?{get preventScroll(){return Dd={preventScroll:!0},!0}}:void 0),Dd||(Dd=!1,GA(t,0))}function KA(n,t){let e,r=2e8,i,s=0,l=t.top,c=t.top,f,d;for(let p=n.firstChild,g=0;p;p=p.nextSibling,g++){let b;if(p.nodeType==1)b=p.getClientRects();else if(p.nodeType==3)b=wu(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 C=M.left>t.left?M.left-t.left:M.right<t.left?t.left-M.right:0;if(C<r){e=p,r=C,i=C&&e.nodeType==3?{left:M.right<t.left?M.right:M.left,top:t.top}:t,p.nodeType==1&&C&&(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});!e&&(t.left>=M.right&&t.top>=M.top||t.left>=M.left&&t.top>=M.bottom)&&(s=g+1)}}return!e&&f&&(e=f,i=d,r=0),e&&e.nodeType==3?LL(e,i):!e||r&&e.nodeType==1?{node:n,offset:s}:KA(e,i)}function LL(n,t){let e=n.nodeValue.length,r=document.createRange(),i;for(let s=0;s<e;s++){r.setEnd(n,s+1),r.setStart(n,s);let l=ef(r,1);if(l.top!=l.bottom&&O5(t,l)){i={node:n,offset:s+(t.left>=(l.left+l.right)/2?1:0)};break}}return r.detach(),i||{node:n,offset:0}}function O5(n,t){return n.left>=t.left-1&&n.left<=t.right+1&&n.top>=t.top-1&&n.top<=t.bottom+1}function RL(n,t){let e=n.parentNode;return e&&/^li$/i.test(e.nodeName)&&t.left<n.getBoundingClientRect().left?e:n}function OL(n,t,e){let{node:r,offset:i}=KA(t,e),s=-1;if(r.nodeType==1&&!r.firstChild){let l=r.getBoundingClientRect();s=l.left!=l.right&&e.left>(l.left+l.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function PL(n,t,e,r){let i=-1;for(let s=t,l=!1;s!=n.dom;){let c=n.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:n.docView.posFromDOM(t,e,-1)}function JA(n,t,e){let r=n.childNodes.length;if(r&&e.top<e.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-e.top)/(e.bottom-e.top))-2)),s=i;;){let l=n.childNodes[s];if(l.nodeType==1){let c=l.getClientRects();for(let f=0;f<c.length;f++){let d=c[f];if(O5(t,d))return JA(l,t,d)}}if((s=(s+1)%r)==i)break}return n}function IL(n,t){let e=n.dom.ownerDocument,r,i=0,s=ML(e,t.left,t.top);s&&({node:r,offset:i}=s);let l=(n.root.elementFromPoint?n.root:e).elementFromPoint(t.left,t.top),c;if(!l||!n.dom.contains(l.nodeType!=1?l.parentNode:l)){let d=n.dom.getBoundingClientRect();if(!O5(t,d)||(l=JA(n.dom,t,d),!l))return null}if(Xs)for(let d=l;r&&d;d=eh(d))d.draggable&&(r=void 0);if(l=RL(l,t),r){if(jl&&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;Rp&&i&&r.nodeType==1&&(d=r.childNodes[i-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=t.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?c=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(c=PL(n,r,i,t))}c==null&&(c=OL(n,l,t));let f=n.docView.nearestDesc(l,!0);return{pos:c,inside:f?f.posAtStart-f.border:-1}}function $2(n){return n.top<n.bottom||n.left<n.right}function ef(n,t){let e=n.getClientRects();if(e.length){let r=e[t<0?0:e.length-1];if($2(r))return r}return Array.prototype.find.call(e,$2)||n.getBoundingClientRect()}const jL=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ZA(n,t,e){let{node:r,offset:i,atom:s}=n.docView.domFromPos(t,e<0?-1:1),l=Rp||jl;if(r.nodeType==3)if(l&&(jL.test(r.nodeValue)||(e<0?!i:i==r.nodeValue.length))){let f=ef(wu(r,i,i),e);if(jl&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=ef(wu(r,i-1,i-1),-1);if(d.top==f.top){let p=ef(wu(r,i,i+1),-1);if(p.top!=f.top)return zh(p,p.left<d.left)}}return f}else{let f=i,d=i,p=e<0?1:-1;return e<0&&!i?(d++,p=-1):e>=0&&i==r.nodeValue.length?(f--,p=1):e<0?f--:d++,zh(ef(wu(r,f,d),p),p<0)}if(!n.state.doc.resolve(t-(s||0)).parent.inlineContent){if(s==null&&i&&(e<0||i==Il(r))){let f=r.childNodes[i-1];if(f.nodeType==1)return Oy(f.getBoundingClientRect(),!1)}if(s==null&&i<Il(r)){let f=r.childNodes[i];if(f.nodeType==1)return Oy(f.getBoundingClientRect(),!0)}return Oy(r.getBoundingClientRect(),e>=0)}if(s==null&&i&&(e<0||i==Il(r))){let f=r.childNodes[i-1],d=f.nodeType==3?wu(f,Il(f)-(l?0:1)):f.nodeType==1&&(f.nodeName!="BR"||!f.nextSibling)?f:null;if(d)return zh(ef(d,1),!1)}if(s==null&&i<Il(r)){let f=r.childNodes[i];for(;f.pmViewDesc&&f.pmViewDesc.ignoreForCoords;)f=f.nextSibling;let d=f?f.nodeType==3?wu(f,0,l?0:1):f.nodeType==1?f:null:null;if(d)return zh(ef(d,-1),!0)}return zh(ef(r.nodeType==3?wu(r):r,-e),e>=0)}function zh(n,t){if(n.width==0)return n;let e=t?n.left:n.right;return{top:n.top,bottom:n.bottom,left:e,right:e}}function Oy(n,t){if(n.height==0)return n;let e=t?n.top:n.bottom;return{top:e,bottom:e,left:n.left,right:n.right}}function QA(n,t,e){let r=n.state,i=n.root.activeElement;r!=t&&n.updateState(t),i!=n.dom&&n.focus();try{return e()}finally{r!=t&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function zL(n,t,e){let r=t.selection,i=e=="up"?r.$from:r.$to;return QA(n,t,()=>{let{node:s}=n.docView.domFromPos(i.pos,e=="up"?-1:1);for(;;){let c=n.docView.nearestDesc(s,!0);if(!c)break;if(c.node.isBlock){s=c.contentDOM||c.dom;break}s=c.dom.parentNode}let l=ZA(n,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=wu(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&&(e=="up"?l.top-p.top>(p.bottom-l.top)*2:p.bottom-l.bottom>(l.bottom-p.top)*2))return!1}}return!0})}const BL=/[\u0590-\u08ac]/;function FL(n,t,e){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,l=i==r.parent.content.size,c=n.domSelection();return c?!BL.test(r.parent.textContent)||!c.modify?e=="left"||e=="backward"?s:l:QA(n,t,()=>{let{focusNode:f,focusOffset:d,anchorNode:p,anchorOffset:g}=n.domSelectionRange(),b=c.caretBidiLevel;c.modify("move",e,"character");let y=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:M,focusOffset:C}=n.domSelectionRange(),L=M&&!y.contains(M.nodeType==1?M:M.parentNode)||f==M&&d==C;try{c.collapse(p,g),f&&(f!=p||d!=g)&&c.extend&&c.extend(f,d)}catch{}return b!=null&&(c.caretBidiLevel=b),L}):r.pos==r.start()||r.pos==r.end()}let XS=null,GS=null,KS=!1;function UL(n,t,e){return XS==t&&GS==e?KS:(XS=t,GS=e,KS=e=="up"||e=="down"?zL(n,t,e):FL(n,t,e))}const zl=0,JS=1,$f=2,uc=3;class Op{constructor(t,e,r,i){this.parent=t,this.children=e,this.dom=r,this.contentDOM=i,this.dirty=zl,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,e,r){return!1}matchesHack(t){return!1}parseRule(t){return null}stopEvent(t){return!1}get size(){let t=0;for(let e=0;e<this.children.length;e++)t+=this.children[e].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 e=0,r=this.posAtStart;;e++){let i=this.children[e];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,e,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[e-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[e];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=e>Ms(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(e==0)for(let s=t;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&e==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,e=!1){for(let r=!0,i=t;i;i=i.parentNode){let s=this.getDesc(i),l;if(s&&(!e||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 e=t.pmViewDesc;for(let r=e;r;r=r.parent)if(r==this)return e}posFromDOM(t,e,r){for(let i=t;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(t,e,r)}return-1}descAt(t){for(let e=0,r=0;e<this.children.length;e++){let i=this.children[e],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,e){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 eM){i=t-s;break}s=c}if(i)return this.children[r].domFromPos(i-this.children[r].border,e);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof tM&&s.side>=0;r--);if(e<=0){let s,l=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,l=!1);return s&&e&&l&&!s.border&&!s.domAtom?s.domFromPos(s.size,e):{node:this.contentDOM,offset:s?Ms(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,e):{node:this.contentDOM,offset:s?Ms(s.dom):this.contentDOM.childNodes.length}}}parseRange(t,e,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:e,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&&e<=d-f.border&&f.node&&f.contentDOM&&this.contentDOM.contains(f.contentDOM))return f.parseRange(t,e,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=Ms(b.dom)+1;break}t-=b.size}i==-1&&(i=0)}if(i>-1&&(d>e||c==this.children.length-1)){e=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=Ms(g.dom);break}e+=g.size}s==-1&&(s=this.contentDOM.childNodes.length);break}l=d}return{node:this.contentDOM,from:t,to:e,fromOffset:i,toOffset:s}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let e=this.children[t<0?0:this.children.length-1];return e.size==0||e.emptyChildAt(t)}domAfterPos(t){let{node:e,offset:r}=this.domFromPos(t,0);if(e.nodeType!=1||r==e.childNodes.length)throw new RangeError("No node after pos "+t);return e.childNodes[r]}setSelection(t,e,r,i=!1){let s=Math.min(t,e),l=Math.max(t,e);for(let y=0,M=0;y<this.children.length;y++){let C=this.children[y],L=M+C.size;if(s>M&&l<L)return C.setSelection(t-M-C.border,e-M-C.border,r,i);M=L}let c=this.domFromPos(t,t?-1:1),f=e==t?c:this.domFromPos(e,e?-1:1),d=r.root.getSelection(),p=r.domSelectionRange(),g=!1;if((jl||Xs)&&t==e){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 C=y,L;C;C=C.parentNode){if(L=C.nextSibling){L.nodeName=="BR"&&(c=f={node:L.parentNode,offset:Ms(L)+1});break}let R=C.pmViewDesc;if(R&&R.node&&R.node.isBlock)break}}else{let C=y.childNodes[M-1];g=C&&(C.nodeName=="BR"||C.contentEditable=="false")}}if(jl&&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&&Xs)&&ld(c.node,c.offset,p.anchorNode,p.anchorOffset)&&ld(f.node,f.offset,p.focusNode,p.focusOffset))return;let b=!1;if((d.extend||t==e)&&!(g&&jl)){d.collapse(c.node,c.offset);try{t!=e&&d.extend(f.node,f.offset),b=!0}catch{}}if(!b){if(t>e){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,e){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&&e>=r:t<l&&e>r){let c=r+s.border,f=l-s.border;if(t>=c&&e<=f){this.dirty=t==r||e==l?$f:JS,t==c&&e==f&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=uc:s.markDirty(t-c,e-c);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?$f:uc}r=l}this.dirty=$f}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let r=t==1?$f:JS;e.dirty<r&&(e.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class tM extends Op{constructor(t,e,r,i){let s,l=e.type.toDOM;if(typeof l=="function"&&(l=l(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!e.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=e,this.widget=e,s=this}matchesWidget(t){return this.dirty==zl&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let e=this.widget.spec.stopEvent;return e?e(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 HL extends Op{constructor(t,e,r,i){super(t,[],e,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class pf extends Op{constructor(t,e,r,i,s){super(t,[],r,i),this.mark=e,this.spec=s}static create(t,e,r,i){let s=i.nodeViews[e.type.name],l=s&&s(e,i,r);return(!l||!l.dom)&&(l=hd.renderSpec(document,e.type.spec.toDOM(e,r),null,e.attrs)),new pf(t,e,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&uc||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=uc&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),this.dirty!=zl){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=zl}}slice(t,e,r){let i=pf.create(this.parent,this.mark,!0,r),s=this.children,l=this.size;e<l&&(s=V2(s,e,l,r)),t>0&&(s=V2(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 mf extends Op{constructor(t,e,r,i,s,l,c){super(t,[],s,l),this.node=e,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=c}static create(t,e,r,i,s,l){let c=s.nodeViews[e.type.name],f,d=c&&c(e,s,()=>{if(!f)return l;if(f.parent)return f.parent.posBeforeChild(f)},r,i),p=d&&d.dom,g=d&&d.contentDOM;if(e.isText){if(!p)p=document.createTextNode(e.text);else if(p.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else p||({dom:p,contentDOM:g}=hd.renderSpec(document,e.type.spec.toDOM(e),null,e.attrs));!g&&!e.isText&&p.nodeName!="BR"&&(p.hasAttribute("contenteditable")||(p.contentEditable="false"),e.type.spec.draggable&&(p.draggable=!0));let b=p;return p=iM(p,r,e),d?f=new qL(t,e,r,i,p,g||null,b,d):e.isText?new N0(t,e,r,i,p,b):new mf(t,e,r,i,p,g||null,b)}parseRule(t){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.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)){e.contentElement=i.dom.parentNode;break}}if(!e.contentElement){let r=t&&t.find(i=>i.nodeType==1&&t.indexOf(i.parentNode)<0&&this.dom.contains(i));r?e.contentElement=r:e.getContent=()=>Ae.empty}}return e}matchesNode(t,e,r){return this.dirty==zl&&t.eq(this.node)&&Mg(e,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let r=this.node.inlineContent,i=e,s=t.composing?this.localCompositionInfo(t,e):null,l=s&&s.pos>-1?s:null,c=s&&s.pos<0,f=new YL(this,l&&l.node,t);XL(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?ci.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==$f)&&(l&&this.protectLocalComposition(t,l),nM(this.contentDOM,this.children,t),nh&&GL(this.dom))}localCompositionInfo(t,e){let{from:r,to:i}=t.state.selection;if(!(t.state.selection instanceof Ln)||r<e||i>e+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=KL(this.node.content,l,r-e,i-e);return c<0?null:{node:s,pos:c,text:l}}else return{node:s,pos:-1,text:""}}protectLocalComposition(t,{node:e,pos:r,text:i}){if(this.getDesc(e))return;let s=e;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 HL(this,s,e,i);t.input.compositionNodes.push(l),this.children=V2(this.children,r,r+i.length,t,l)}update(t,e,r,i){return this.dirty==uc||!t.sameMarkup(this.node)?!1:(this.updateInner(t,e,r,i),!0)}updateInner(t,e,r,i){this.updateOuterDeco(e),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=zl}updateOuterDeco(t){if(Mg(t,this.outerDeco))return;let e=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=rM(this.dom,this.nodeDOM,Y2(this.outerDeco,this.node,e),Y2(t,this.node,e)),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 ZS(n,t,e,r,i){iM(r,t,n);let s=new mf(void 0,n,t,e,r,r,r);return s.contentDOM&&s.updateChildren(i,0),s}class N0 extends mf{constructor(t,e,r,i,s,l){super(t,e,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,e,r,i){return this.dirty==uc||this.dirty!=zl&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(e),(this.dirty!=zl||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=zl,!0)}inParent(){let t=this.parent.contentDOM;for(let e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,e,r){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):super.localPosFromDOM(t,e,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,e,r){let i=this.node.cut(t,e),s=document.createTextNode(i.text);return new N0(this.parent,i,this.outerDeco,this.innerDeco,s,s)}markDirty(t,e){super.markDirty(t,e),this.dom!=this.nodeDOM&&(t==0||e==this.nodeDOM.nodeValue.length)&&(this.dirty=uc)}get domAtom(){return!1}isText(t){return this.node.text==t}}class eM extends Op{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==zl&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class qL extends mf{constructor(t,e,r,i,s,l,c,f){super(t,e,r,i,s,l,c),this.spec=f}update(t,e,r,i){if(this.dirty==uc)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let s=this.spec.update(t,e,r);return s&&this.updateInner(t,e,r,i),s}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,e,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,r,i){this.spec.setSelection?this.spec.setSelection(t,e,r.root):super.setSelection(t,e,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 nM(n,t,e){let r=n.firstChild,i=!1;for(let s=0;s<t.length;s++){let l=t[s],c=l.dom;if(c.parentNode==n){for(;c!=r;)r=QS(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(c,r);if(l instanceof pf){let f=r?r.previousSibling:n.lastChild;nM(l.contentDOM,l.children,e),r=f?f.nextSibling:n.firstChild}}for(;r;)r=QS(r),i=!0;i&&e.trackWrites==n&&(e.trackWrites=null)}const op=function(n){n&&(this.nodeName=n)};op.prototype=Object.create(null);const Yf=[new op];function Y2(n,t,e){if(n.length==0)return Yf;let r=e?Yf[0]:new op,i=[r];for(let s=0;s<n.length;s++){let l=n[s].type.attrs;if(l){l.nodeName&&i.push(r=new op(l.nodeName));for(let c in l){let f=l[c];f!=null&&(e&&i.length==1&&i.push(r=new op(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 rM(n,t,e,r){if(e==Yf&&r==Yf)return t;let i=t;for(let s=0;s<r.length;s++){let l=r[s],c=e[s];if(s){let f;c&&c.nodeName==l.nodeName&&i!=n&&(f=i.parentNode)&&f.nodeName.toLowerCase()==l.nodeName||(f=document.createElement(l.nodeName),f.pmIsDeco=!0,f.appendChild(i),c=Yf[0]),i=f}$L(i,c||Yf[0],l)}return i}function $L(n,t,e){for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&!(r in e)&&n.removeAttribute(r);for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&e[r]!=t[r]&&n.setAttribute(r,e[r]);if(t.class!=e.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=e.class?e.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&n.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&n.classList.add(i[s]);n.classList.length==0&&n.removeAttribute("class")}if(t.style!=e.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(t.style);)n.style.removeProperty(i[1])}e.style&&(n.style.cssText+=e.style)}}function iM(n,t,e){return rM(n,n,Yf,Y2(t,e,n.nodeType!=1))}function Mg(n,t){if(n.length!=t.length)return!1;for(let e=0;e<n.length;e++)if(!n[e].type.eq(t[e].type))return!1;return!0}function QS(n){let t=n.nextSibling;return n.parentNode.removeChild(n),t}class YL{constructor(t,e,r){this.lock=e,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=VL(t.node.content,t)}destroyBetween(t,e){if(t!=e){for(let r=t;r<e;r++)this.top.children[r].destroy();this.top.children.splice(t,e-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,e,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=zl,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 pf&&p.dirty!=uc&&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=pf.create(this.top,t[l],e,r);this.top.children.splice(this.index,0,p),this.top=p,this.changed=!0}this.index=0,l++}}findNodeMatch(t,e,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,e,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,e,r)&&!this.preMatch.matched.has(d)){s=c;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(t,e,r,i,s){let l=this.top.children[i];return l.dirty==uc&&l.dom==l.contentDOM&&(l.dirty=$f),l.update(t,e,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(t){for(;;){let e=t.parentNode;if(!e)return-1;if(e==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=e}}updateNextNode(t,e,r,i,s,l){for(let c=this.index;c<this.top.children.length;c++){let f=this.top.children[c];if(f instanceof mf){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!=uc&&Mg(e,f.outerDeco));if(!b&&f.update(t,e,r,i))return this.destroyBetween(this.index,c),f.dom!=p&&(this.changed=!0),this.index++,!0;if(!b&&(g=this.recreateWrapper(f,t,e,r,i,l)))return this.destroyBetween(this.index,c),this.top.children[this.index]=g,g.contentDOM&&(g.dirty=$f,g.updateChildren(i,l+1),g.dirty=zl),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,e,r,i,s,l){if(t.dirty||e.isAtom||!t.children.length||!t.node.content.eq(e.content)||!Mg(r,t.outerDeco)||!i.eq(t.innerDeco))return null;let c=mf.create(this.top,e,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,e,r,i,s){let l=mf.create(this.top,t,e,r,i,s);l.contentDOM&&l.updateChildren(i,s+1),this.top.children.splice(this.index++,0,l),this.changed=!0}placeWidget(t,e,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 tM(this.top,t,e,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],e=this.top;for(;t instanceof pf;)e=t,t=e.children[e.children.length-1];(!t||!(t instanceof N0)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Xs||Es)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",e),this.addHackNode("BR",this.top))}addHackNode(t,e){if(e==this.top&&this.index<e.children.length&&e.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 eM(this.top,[],r,null);e!=this.top?e.children.push(i):e.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 VL(n,t){let e=t,r=e.children.length,i=n.childCount,s=new Map,l=[];t:for(;i>0;){let c;for(;;)if(r){let d=e.children[r-1];if(d instanceof pf)e=d,r=d.children.length;else{c=d,r--;break}}else{if(e==t)break t;r=e.parent.children.indexOf(e),e=e.parent}let f=c.node;if(f){if(f!=n.child(i-1))break;--i,s.set(c,i),l.push(c)}}return{index:i,matched:s,matches:l.reverse()}}function WL(n,t){return n.type.side-t.type.side}function XL(n,t,e,r){let i=t.locals(n),s=0;if(i.length==0){for(let d=0;d<n.childCount;d++){let p=n.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 L=i[l++];L.widget&&(p?(g||(g=[p])).push(L):p=L)}if(p)if(g){g.sort(WL);for(let L=0;L<g.length;L++)e(g[L],d,!!f)}else e(p,d,!!f);let b,y;if(f)y=-1,b=f,f=null;else if(d<n.childCount)y=d,b=n.child(d++);else break;for(let L=0;L<c.length;L++)c[L].to<=s&&c.splice(L--,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 L=M;l<i.length&&i[l].from<L&&(L=i[l].from);for(let R=0;R<c.length;R++)c[R].to<L&&(L=c[R].to);L<M&&(f=b.cut(L-s),b=b.cut(0,L-s),M=L,y=-1)}else for(;l<i.length&&i[l].to<M;)l++;let C=b.isInline&&!b.isLeaf?c.filter(L=>!L.inline):c.slice();r(b,C,t.forChild(s,b),y),s=M}}function GL(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let t=n.style.cssText;n.style.cssText=t+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=t}}function KL(n,t,e,r){for(let i=0,s=0;i<n.childCount&&s<=r;){let l=n.child(i++),c=s;if(s+=l.nodeSize,!l.isText)continue;let f=l.text;for(;i<n.childCount;){let d=n.child(i++);if(s+=d.nodeSize,!d.isText)break;f+=d.text}if(s>=e){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>=e)return c+d;if(e==r&&f.length>=r+t.length-c&&f.slice(r-c,r-c+t.length)==t)return r}}return-1}function V2(n,t,e,r,i){let s=[];for(let l=0,c=0;l<n.length;l++){let f=n[l],d=c,p=c+=f.size;d>=e||p<=t?s.push(f):(d<t&&s.push(f.slice(0,t-d,r)),i&&(s.push(i),i=void 0),p>e&&s.push(f.slice(e-d,f.size,r)))}return s}function P5(n,t=null){let e=n.domSelectionRange(),r=n.state.doc;if(!e.focusNode)return null;let i=n.docView.nearestDesc(e.focusNode),s=i&&i.size==0,l=n.docView.posFromDOM(e.focusNode,e.focusOffset,1);if(l<0)return null;let c=r.resolve(l),f,d;if(T0(e)){for(f=l;i&&!i.node;)i=i.parent;let g=i.node;if(i&&g.isAtom&&kn.isSelectable(g)&&i.parent&&!(g.isInline&&kL(e.focusNode,e.focusOffset,i.dom))){let b=i.posBefore;d=new kn(l==b?c:r.resolve(b))}}else{if(e instanceof n.dom.ownerDocument.defaultView.Selection&&e.rangeCount>1){let g=l,b=l;for(let y=0;y<e.rangeCount;y++){let M=e.getRangeAt(y);g=Math.min(g,n.docView.posFromDOM(M.startContainer,M.startOffset,1)),b=Math.max(b,n.docView.posFromDOM(M.endContainer,M.endOffset,-1))}if(g<0)return null;[f,l]=b==n.state.selection.anchor?[b,g]:[g,b],c=r.resolve(l)}else f=n.docView.posFromDOM(e.anchorNode,e.anchorOffset,1);if(f<0)return null}let p=r.resolve(f);if(!d){let g=t=="pointer"||n.state.selection.head<c.pos&&!s?1:-1;d=I5(n,p,c,g)}return d}function oM(n){return n.editable?n.hasFocus():aM(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Cu(n,t=!1){let e=n.state.selection;if(sM(n,e),!oM(n))return;let r=n.input.mouseDown;if(!t&&Es&&r){let i=n.domSelectionRange(),s=n.domObserver.currentSelection;if(i.anchorNode&&s.anchorNode&&ld(i.anchorNode,i.anchorOffset,s.anchorNode,s.anchorOffset)&&r.delaySelUpdate()){n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)ZL(n);else{let{anchor:i,head:s}=e,l,c;t3&&!(e instanceof Ln)&&(e.$from.parent.inlineContent||(l=e3(n,e.from)),!e.empty&&!e.$from.parent.inlineContent&&(c=e3(n,e.to))),n.docView.setSelection(i,s,n,t),t3&&(l&&n3(l),c&&n3(c)),e.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&JL(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}const t3=Xs||Es&&VA<63;function e3(n,t){let{node:e,offset:r}=n.docView.domFromPos(t,0),i=r<e.childNodes.length?e.childNodes[r]:null,s=r?e.childNodes[r-1]:null;if(Xs&&i&&i.contentEditable=="false")return Py(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Py(i);if(s)return Py(s)}}function Py(n){return n.contentEditable="true",Xs&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function n3(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function JL(n){let t=n.dom.ownerDocument;t.removeEventListener("selectionchange",n.input.hideSelectionGuard);let e=n.domSelectionRange(),r=e.anchorNode,i=e.anchorOffset;t.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(e.anchorNode!=r||e.anchorOffset!=i)&&(t.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!oM(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function ZL(n){let t=n.domSelection();if(!t)return;let e=n.cursorWrapper.dom,r=e.nodeName=="IMG";r?t.collapse(e.parentNode,Ms(e)+1):t.collapse(e,0),!r&&!n.state.selection.visible&&Ia&&hf<=11&&(e.disabled=!0,e.disabled=!1)}function sM(n,t){if(t instanceof kn){let e=n.docView.descAt(t.from);e!=n.lastSelectedViewDesc&&(r3(n),e&&e.selectNode(),n.lastSelectedViewDesc=e)}else r3(n)}function r3(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function I5(n,t,e,r){return n.someProp("createSelectionBetween",i=>i(n,t,e))||Ln.between(t,e,r)}function i3(n){return n.editable&&!n.hasFocus()?!1:aM(n)}function aM(n){let t=n.domSelectionRange();if(!t.anchorNode)return!1;try{return n.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(n.editable||n.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function QL(n){let t=n.docView.domFromPos(n.state.selection.anchor,0),e=n.domSelectionRange();return ld(t.node,t.offset,e.anchorNode,e.anchorOffset)}function W2(n,t){let{$anchor:e,$head:r}=n.selection,i=t>0?e.max(r):e.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(t>0?i.after():i.before()):null:i;return s&&er.findFrom(s,t)}function nf(n,t){return n.dispatch(n.state.tr.setSelection(t).scrollIntoView()),!0}function o3(n,t,e){let r=n.state.selection;if(r instanceof Ln)if(e.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=n.state.doc.resolve(i.pos+s.nodeSize*(t<0?-1:1));return nf(n,new Ln(r.$anchor,l))}else if(r.empty){if(n.endOfTextblock(t>0?"forward":"backward")){let i=W2(n.state,t);return i&&i instanceof kn?nf(n,i):!1}else if(!(Pl&&e.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=n.docView.descAt(c))&&!l.contentDOM?kn.isSelectable(s)?nf(n,new kn(t<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Rp?nf(n,new Ln(n.state.doc.resolve(t<0?c:c+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof kn&&r.node.isInline)return nf(n,new Ln(t>0?r.$to:r.$from));{let i=W2(n.state,t);return i?nf(n,i):!1}}}function Cg(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function sp(n,t){let e=n.pmViewDesc;return e&&e.size==0&&(t<0||n.nextSibling||n.nodeName!="BR")}function Ld(n,t){return t<0?tR(n):eR(n)}function tR(n){let t=n.domSelectionRange(),e=t.focusNode,r=t.focusOffset;if(!e)return;let i,s,l=!1;for(jl&&e.nodeType==1&&r<Cg(e)&&sp(e.childNodes[r],-1)&&(l=!0);;)if(r>0){if(e.nodeType!=1)break;{let c=e.childNodes[r-1];if(sp(c,-1))i=e,s=--r;else if(c.nodeType==3)e=c,r=e.nodeValue.length;else break}}else{if(lM(e))break;{let c=e.previousSibling;for(;c&&sp(c,-1);)i=e.parentNode,s=Ms(c),c=c.previousSibling;if(c)e=c,r=Cg(e);else{if(e=e.parentNode,e==n.dom)break;r=0}}}l?X2(n,e,r):i&&X2(n,i,s)}function eR(n){let t=n.domSelectionRange(),e=t.focusNode,r=t.focusOffset;if(!e)return;let i=Cg(e),s,l;for(;;)if(r<i){if(e.nodeType!=1)break;let c=e.childNodes[r];if(sp(c,1))s=e,l=++r;else break}else{if(lM(e))break;{let c=e.nextSibling;for(;c&&sp(c,1);)s=c.parentNode,l=Ms(c)+1,c=c.nextSibling;if(c)e=c,r=0,i=Cg(e);else{if(e=e.parentNode,e==n.dom)break;r=i=0}}}s&&X2(n,s,l)}function lM(n){let t=n.pmViewDesc;return t&&t.node&&t.node.isBlock}function nR(n,t){for(;n&&t==n.childNodes.length&&!Lp(n);)t=Ms(n)+1,n=n.parentNode;for(;n&&t<n.childNodes.length;){let e=n.childNodes[t];if(e.nodeType==3)return e;if(e.nodeType==1&&e.contentEditable=="false")break;n=e,t=0}}function rR(n,t){for(;n&&!t&&!Lp(n);)t=Ms(n),n=n.parentNode;for(;n&&t;){let e=n.childNodes[t-1];if(e.nodeType==3)return e;if(e.nodeType==1&&e.contentEditable=="false")break;n=e,t=n.childNodes.length}}function X2(n,t,e){if(t.nodeType!=3){let s,l;(l=nR(t,e))?(t=l,e=0):(s=rR(t,e))&&(t=s,e=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(T0(r)){let s=document.createRange();s.setEnd(t,e),s.setStart(t,e),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(t,e);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Cu(n)},50)}function s3(n,t){let e=n.state.doc.resolve(t);if(!(Es||WA)&&e.parent.inlineContent){let i=n.coordsAtPos(t);if(t>e.start()){let s=n.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<e.end()){let s=n.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(n.dom).direction=="rtl"?"rtl":"ltr"}function a3(n,t,e){let r=n.state.selection;if(r instanceof Ln&&!r.empty||e.indexOf("s")>-1||Pl&&e.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(t<0?"up":"down")){let l=W2(n.state,t);if(l&&l instanceof kn)return nf(n,l)}if(!i.parent.inlineContent){let l=t<0?i:s,c=r instanceof il?er.near(l,t):er.findFrom(l,t);return c?nf(n,c):!1}return!1}function l3(n,t){if(!(n.state.selection instanceof Ln))return!0;let{$head:e,$anchor:r,empty:i}=n.state.selection;if(!e.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(t>0?"forward":"backward"))return!0;let s=!e.textOffset&&(t<0?e.nodeBefore:e.nodeAfter);if(s&&!s.isText){let l=n.state.tr;return t<0?l.delete(e.pos-s.nodeSize,e.pos):l.delete(e.pos,e.pos+s.nodeSize),n.dispatch(l),!0}return!1}function c3(n,t,e){n.domObserver.stop(),t.contentEditable=e,n.domObserver.start()}function iR(n){if(!Xs||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:e}=n.domSelectionRange();if(t&&t.nodeType==1&&e==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;c3(n,r,"true"),setTimeout(()=>c3(n,r,"false"),20)}return!1}function oR(n){let t="";return n.ctrlKey&&(t+="c"),n.metaKey&&(t+="m"),n.altKey&&(t+="a"),n.shiftKey&&(t+="s"),t}function sR(n,t){let e=t.keyCode,r=oR(t);if(e==8||Pl&&e==72&&r=="c")return l3(n,-1)||Ld(n,-1);if(e==46&&!t.shiftKey||Pl&&e==68&&r=="c")return l3(n,1)||Ld(n,1);if(e==13||e==27)return!0;if(e==37||Pl&&e==66&&r=="c"){let i=e==37?s3(n,n.state.selection.from)=="ltr"?-1:1:-1;return o3(n,i,r)||Ld(n,i)}else if(e==39||Pl&&e==70&&r=="c"){let i=e==39?s3(n,n.state.selection.from)=="ltr"?1:-1:1;return o3(n,i,r)||Ld(n,i)}else{if(e==38||Pl&&e==80&&r=="c")return a3(n,-1,r)||Ld(n,-1);if(e==40||Pl&&e==78&&r=="c")return iR(n)||a3(n,1,r)||Ld(n,1);if(r==(Pl?"m":"c")&&(e==66||e==73||e==89||e==90))return!0}return!1}function j5(n,t){n.someProp("transformCopied",y=>{t=y(t,n)});let e=[],{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;e.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let l=n.someProp("clipboardSerializer")||hd.fromSchema(n.state.schema),c=pM(),f=c.createElement("div");f.appendChild(l.serializeFragment(r,{document:c}));let d=f.firstChild,p,g=0;for(;d&&d.nodeType==1&&(p=hM[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(e)}`);let b=n.someProp("clipboardTextSerializer",y=>y(t,n))||t.content.textBetween(0,t.content.size,`
102
-
103
- `);return{dom:f,text:b,slice:t}}function cM(n,t,e,r,i){let s=i.parent.type.spec.code,l,c;if(!e&&!t)return null;let f=!!t&&(r||s||!e);if(f){if(n.someProp("transformPastedText",b=>{t=b(t,s||r,n)}),s)return c=new We(Ae.from(n.state.schema.text(t.replace(/\r\n?/g,`
104
- `))),0,0),n.someProp("transformPasted",b=>{c=b(c,n,!0)}),c;let g=n.someProp("clipboardTextParser",b=>b(t,i,r,n));if(g)c=g;else{let b=i.marks(),{schema:y}=n.state,M=hd.fromSchema(y);l=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(C=>{let L=l.appendChild(document.createElement("p"));C&&L.appendChild(M.serializeNode(y.text(C,b)))})}}else n.someProp("transformPastedHTML",g=>{e=g(e,n)}),l=uR(e),Rp&&fR(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=(n.someProp("clipboardParser")||n.someProp("domParser")||rp.fromSchema(n.state.schema)).parseSlice(l,{preserveWhitespace:!!(f||p),context:i,ruleFromNode(b){return b.nodeName=="BR"&&!b.nextSibling&&b.parentNode&&!aR.test(b.parentNode.nodeName)?{ignore:!0}:null}})),p)c=dR(u3(c,+p[1],+p[2]),p[4]);else if(c=We.maxOpen(lR(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=u3(c,g,b)}return n.someProp("transformPasted",g=>{c=g(c,n,f)}),c}const aR=/^(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 lR(n,t){if(n.childCount<2)return n;for(let e=t.depth;e>=0;e--){let i=t.node(e).contentMatchAt(t.index(e)),s,l=[];if(n.forEach(c=>{if(!l)return;let f=i.findWrapping(c.type),d;if(!f)return l=null;if(d=l.length&&s.length&&fM(f,s,c,l[l.length-1],0))l[l.length-1]=d;else{l.length&&(l[l.length-1]=dM(l[l.length-1],s.length));let p=uM(c,f);l.push(p),i=i.matchType(p.type),s=f}}),l)return Ae.from(l)}return n}function uM(n,t,e=0){for(let r=t.length-1;r>=e;r--)n=t[r].create(null,Ae.from(n));return n}function fM(n,t,e,r,i){if(i<n.length&&i<t.length&&n[i]==t[i]){let s=fM(n,t,e,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?e.type:n[i+1]))return r.copy(r.content.append(Ae.from(uM(e,n,i+1))))}}function dM(n,t){if(t==0)return n;let e=n.content.replaceChild(n.childCount-1,dM(n.lastChild,t-1)),r=n.contentMatchAt(n.childCount).fillBefore(Ae.empty,!0);return n.copy(e.append(r))}function G2(n,t,e,r,i,s){let l=t<0?n.firstChild:n.lastChild,c=l.content;return n.childCount>1&&(s=0),i<r-1&&(c=G2(c,t,e,r,i+1,s)),i>=e&&(c=t<0?l.contentMatchAt(0).fillBefore(c,s<=i).append(c):c.append(l.contentMatchAt(l.childCount).fillBefore(Ae.empty,!0))),n.replaceChild(t<0?0:n.childCount-1,l.copy(c))}function u3(n,t,e){return t<n.openStart&&(n=new We(G2(n.content,-1,t,n.openStart,0,n.openEnd),t,n.openEnd)),e<n.openEnd&&(n=new We(G2(n.content,1,e,n.openEnd,0,0),n.openStart,e)),n}const hM={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 pM(){return document.implementation.createHTMLDocument("title")}let Bh=null;function cR(n){let t=window.trustedTypes;if(!t)return n;if(!Bh){if(Bh=t.defaultPolicy)try{return Bh.createHTML(n)}catch{}Bh=t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})}return Bh.createHTML(n)}function uR(n){let t=/^(\s*<meta [^>]*>)*/.exec(n);t&&(n=n.slice(t[0].length));let e=pM(),r=e.body,i=/<([a-z][^>\s]+)/i.exec(n),s;if((s=i&&hM[i[1].toLowerCase()])&&(n=s.map(l=>"<"+l+">").join("")+n+s.map(l=>"</"+l+">").reverse().join("")),r.innerHTML=cR(n),s)for(let l=0;l<s.length;l++)r=r.querySelector(s[l])||r;for(let l=0;l<e.styleSheets.length;l++){let c=e.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 fR(n){let t=n.querySelectorAll(Es?"span:not([class]):not([style])":"span.Apple-converted-space");for(let e=0;e<t.length;e++){let r=t[e];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function dR(n,t){if(!n.size)return n;let e=n.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return n}let{content:i,openStart:s,openEnd:l}=n;for(let c=r.length-2;c>=0;c-=2){let f=e.nodes[r[c]];if(!f||f.hasRequiredAttrs())break;try{f.checkAttrs(r[c+1])}catch{break}i=Ae.from(f.create(r[c+1],i)),s++,l++}return new We(i,s,l)}const fa={},da={},hR={touchstart:!0,touchmove:!0};class pR{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 mR(n){for(let t in fa){let e=fa[t];n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>{yR(n,r)&&!z5(n,r)&&(n.editable||!(r.type in da))&&e(n,r)},hR[t]?{passive:!0}:void 0)}Xs&&n.dom.addEventListener("input",()=>null),K2(n)}function Au(n,t){n.input.lastSelectionOrigin=t,n.input.lastSelectionTime=Date.now()}function gR(n){n.input.mouseDown&&n.input.mouseDown.done(),n.domObserver.stop();for(let t in n.input.eventHandlers)n.dom.removeEventListener(t,n.input.eventHandlers[t]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function K2(n){n.someProp("handleDOMEvents",t=>{for(let e in t)n.input.eventHandlers[e]||n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>z5(n,r))})}function z5(n,t){return n.someProp("handleDOMEvents",e=>{let r=e[t.type];return r?r(n,t)||t.defaultPrevented:!1})}function yR(n,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target;e!=n.dom;e=e.parentNode)if(!e||e.nodeType==11||e.pmViewDesc&&e.pmViewDesc.stopEvent(t))return!1;return!0}function bR(n,t){!z5(n,t)&&fa[t.type]&&(n.editable||!(t.type in da))&&fa[t.type](n,t)}da.keydown=(n,t)=>{let e=t;if(n.input.shiftKey=e.keyCode==16||e.shiftKey,!bM(n)&&(n.input.lastKeyCode=e.keyCode,n.input.lastKeyCodeTime=Date.now(),!(ku&&Es&&e.keyCode==13)))if(e.keyCode!=229&&n.domObserver.forceFlush(),nh&&e.keyCode==13&&!e.ctrlKey&&!e.altKey&&!e.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Uf(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,e))||sR(n,e)?e.preventDefault():Au(n,"key")};da.keyup=(n,t)=>{t.keyCode==16&&(n.input.shiftKey=!1)};da.keypress=(n,t)=>{let e=t;if(bM(n)||!e.charCode||e.ctrlKey&&!e.altKey||Pl&&e.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,e))){e.preventDefault();return}let r=n.state.selection;if(!(r instanceof Ln)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(e.charCode),s=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",l=>l(n,r.$from.pos,r.$to.pos,i,s))&&n.dispatch(s()),e.preventDefault()}};function Pp(n){return{left:n.clientX,top:n.clientY}}function xR(n,t){let e=t.x-n.clientX,r=t.y-n.clientY;return e*e+r*r<100}function B5(n,t,e,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let l=s.depth+1;l>0;l--)if(n.someProp(t,c=>l>s.depth?c(n,e,s.nodeAfter,s.before(l),i,!0):c(n,e,s.node(l),s.before(l),i,!1)))return!0;return!1}function Ip(n,t,e){if(n.focused||n.focus(),n.state.selection.eq(t))return;let r=n.state.tr.setSelection(t);r.setMeta("pointer",!0),n.dispatch(r)}function vR(n,t){if(t==-1)return!1;let e=n.state.doc.resolve(t),r=e.nodeAfter;return r&&r.isAtom&&kn.isSelectable(r)?(Ip(n,new kn(e)),!0):!1}function wR(n,t){if(t==-1)return!1;let e=n.state.selection,r,i;e instanceof kn&&(r=e.node);let s=n.state.doc.resolve(t);for(let l=s.depth+1;l>0;l--){let c=l>s.depth?s.nodeAfter:s.node(l);if(kn.isSelectable(c)){r&&e.$from.depth>0&&l>=e.$from.depth&&s.before(e.$from.depth+1)==e.$from.pos?i=s.before(e.$from.depth):i=s.before(l);break}}return i!=null?(Ip(n,kn.create(n.state.doc,i)),!0):!1}function SR(n,t,e,r,i){return B5(n,"handleClickOn",t,e,r)||n.someProp("handleClick",s=>s(n,t,r))||(i?wR(n,e):vR(n,e))}function kR(n,t,e,r){return B5(n,"handleDoubleClickOn",t,e,r)||n.someProp("handleDoubleClick",i=>i(n,t,r))}function AR(n,t,e,r){return B5(n,"handleTripleClickOn",t,e,r)||n.someProp("handleTripleClick",i=>i(n,t,r))||MR(n,e,r)}function MR(n,t,e){if(e.button!=0)return!1;let r=mM(n,t,!0),i=n.state.doc;return r?(Ip(n,r),r instanceof Ln&&i.eq(n.state.doc)&&(n.input.mouseDown=new ER(n,r)),!0):!1}function mM(n,t,e){let r=n.state.doc;if(t==-1)return r.inlineContent?Ln.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 Ln.create(r,c+1,c+1+l.content.size);if(e&&kn.isSelectable(l))return kn.create(r,c)}return null}function F5(n){return Eg(n)}const gM=Pl?"metaKey":"ctrlKey";fa.mousedown=(n,t)=>{let e=t;n.input.shiftKey=e.shiftKey;let r=F5(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&xR(e,n.input.lastClick)&&!e[gM]&&n.input.lastClick.button==e.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:e.clientX,y:e.clientY,type:s,button:e.button},n.input.mouseDown&&n.input.mouseDown.done();let l=n.posAtCoords(Pp(e));l&&(s=="singleClick"?n.input.mouseDown=new CR(n,l,e,!!r):(s=="doubleClick"?kR:AR)(n,l.pos,l.inside,e)?e.preventDefault():Au(n,"pointer"))};class yM{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 CR extends yM{constructor(t,e,r,i){super(t),this.pos=e,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=t.state.doc,this.selectNode=!!r[gM],this.allowDefault=r.shiftKey;let s,l;if(e.inside>-1)s=t.state.doc.nodeAt(e.inside),l=e.inside;else{let p=t.state.doc.resolve(e.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 kn&&d.from<=l&&d.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&jl&&!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()),Au(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||Cu(this.view)})}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(Pp(t))),this.updateAllowDefault(t),this.allowDefault||!e?Au(this.view,"pointer"):SR(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Xs&&this.mightDrag&&!this.mightDrag.node.isAtom||Es&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(Ip(this.view,er.near(this.view.state.doc.resolve(e.pos))),t.preventDefault()):Au(this.view,"pointer")}move(t){this.updateAllowDefault(t),Au(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 ER extends yM{constructor(t,e){super(t),this.startSelection=e,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(),Au(this.view,"pointer");let e=this.view.posAtCoords(Pp(t)),r=e&&mM(this.view,e.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];Ip(this.view,Ln.create(i,l,c))}}fa.touchstart=n=>{n.input.lastTouch=Date.now(),F5(n),Au(n,"pointer")};fa.touchmove=n=>{n.input.lastTouch=Date.now(),Au(n,"pointer")};fa.contextmenu=n=>F5(n);function bM(n,t){return n.composing?!0:Xs&&Math.abs(Date.now()-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const TR=ku?5e3:-1;da.compositionstart=da.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:t}=n,e=t.selection.$to;if(t.selection instanceof Ln&&(t.storedMarks||!e.textOffset&&e.parentOffset&&e.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Es&&WA&&NR(n)))n.markCursor=n.state.storedMarks||e.marks(),Eg(n,!0),n.markCursor=null;else if(Eg(n,!t.selection.empty),jl&&t.selection.empty&&e.parentOffset&&!e.textOffset&&e.nodeBefore.marks.length){let r=n.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=n.domSelection();c&&c.collapse(l,l.nodeValue.length);break}else i=l,s=-1}}n.input.composing=!0}xM(n,TR)};function NR(n){let{focusNode:t,focusOffset:e}=n.domSelectionRange();if(!t||t.nodeType!=1||e>=t.childNodes.length)return!1;let r=t.childNodes[e];return r.nodeType==1&&r.contentEditable=="false"}da.compositionend=(n,t)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now(),n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,xM(n,20))};function xM(n,t){clearTimeout(n.input.composingTimeout),t>-1&&(n.input.composingTimeout=setTimeout(()=>Eg(n),t))}function vM(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function _R(n){let t=n.domSelectionRange();if(!t.focusNode)return null;let e=wL(t.focusNode,t.focusOffset),r=SL(t.focusNode,t.focusOffset);if(e&&r&&e!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(e==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let l=e.pmViewDesc;if(!(!l||!l.isText(e.nodeValue)))return r}}return e||r}function Eg(n,t=!1){if(!(ku&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),vM(n),t||n.docView&&n.docView.dirty){let e=P5(n),r=n.state.selection;return e&&!e.eq(r)?n.dispatch(n.state.tr.setSelection(e)):(n.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function DR(n,t){if(!n.dom.parentNode)return;let e=n.dom.parentNode.appendChild(document.createElement("div"));e.appendChild(t),e.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e),n.focus()},50)}const Ap=Ia&&hf<15||nh&&CL<604;fa.copy=da.cut=(n,t)=>{let e=t,r=n.state.selection,i=e.type=="cut";if(r.empty)return;let s=Ap?null:e.clipboardData,l=r.content(),{dom:c,text:f}=j5(n,l);s?(e.preventDefault(),s.clearData(),s.setData("text/html",c.innerHTML),s.setData("text/plain",f)):DR(n,c),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function LR(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function RR(n,t){if(!n.dom.parentNode)return;let e=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(e?"textarea":"div"));e||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),e?Mp(n,r.value,null,i,t):Mp(n,r.textContent,r.innerHTML,i,t)},50)}function Mp(n,t,e,r,i){let s=cM(n,t,e,r,n.state.selection.$from);if(n.someProp("handlePaste",f=>f(n,i,s||We.empty)))return!0;if(!s)return!1;let l=LR(s),c=l?n.state.tr.replaceSelectionWith(l,r):n.state.tr.replaceSelection(s);return n.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function wM(n){let t=n.getData("text/plain")||n.getData("Text");if(t)return t;let e=n.getData("text/uri-list");return e?e.replace(/\r?\n/g," "):""}da.paste=(n,t)=>{let e=t;if(n.composing&&!ku)return;let r=Ap?null:e.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Mp(n,wM(r),r.getData("text/html"),i,e)?e.preventDefault():RR(n,e)};class SM{constructor(t,e,r){this.slice=t,this.move=e,this.node=r}}const OR=Pl?"altKey":"ctrlKey";function kM(n,t){let e;return n.someProp("dragCopies",r=>{e=e||r(t)}),e!=null?!e:!t[OR]}fa.dragstart=(n,t)=>{let e=t,r=n.input.mouseDown;if(r&&r.done(),!e.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(Pp(e)),l;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof kn?i.to-1:i.to))){if(r&&r.mightDrag)l=kn.create(n.state.doc,r.mightDrag.pos);else if(e.target&&e.target.nodeType==1){let g=n.docView.nearestDesc(e.target,!0);g&&g.node.type.spec.draggable&&g!=n.docView&&(l=kn.create(n.state.doc,g.posBefore))}}let c=(l||n.state.selection).content(),{dom:f,text:d,slice:p}=j5(n,c);(!e.dataTransfer.files.length||!Es||VA>120)&&e.dataTransfer.clearData(),e.dataTransfer.setData(Ap?"Text":"text/html",f.innerHTML),e.dataTransfer.effectAllowed="copyMove",Ap||e.dataTransfer.setData("text/plain",d),n.dragging=new SM(p,kM(n,e),l)};fa.dragend=n=>{let t=n.dragging;window.setTimeout(()=>{n.dragging==t&&(n.dragging=null)},50)};da.dragover=da.dragenter=(n,t)=>t.preventDefault();da.drop=(n,t)=>{try{PR(n,t,n.dragging)}finally{n.dragging=null}};function PR(n,t,e){if(!t.dataTransfer)return;let r=n.posAtCoords(Pp(t));if(!r)return;let i=n.state.doc.resolve(r.pos),s=e&&e.slice;s?n.someProp("transformPasted",y=>{s=y(s,n,!1)}):s=cM(n,wM(t.dataTransfer),Ap?null:t.dataTransfer.getData("text/html"),!1,i);let l=!!(e&&kM(n,t));if(n.someProp("handleDrop",y=>y(n,t,s||We.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let c=s?AA(n.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let f=n.state.tr;if(l){let{node:y}=e;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&&kn.isSelectable(s.content.firstChild)&&b.nodeAfter&&b.nodeAfter.sameMarkup(s.content.firstChild))f.setSelection(new kn(b));else{let y=f.mapping.map(c);f.mapping.maps[f.mapping.maps.length-1].forEach((M,C,L,R)=>y=R),f.setSelection(I5(n,b,f.doc.resolve(y)))}n.focus(),n.dispatch(f.setMeta("uiEvent","drop"))}fa.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Cu(n)},20))};fa.blur=(n,t)=>{let e=t;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),e.relatedTarget&&n.dom.contains(e.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};fa.beforeinput=(n,t)=>{if(ku&&t.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,Uf(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in da)fa[n]=da[n];function Cp(n,t){if(n==t)return!0;for(let e in n)if(n[e]!==t[e])return!1;for(let e in t)if(!(e in n))return!1;return!0}class Tg{constructor(t,e){this.toDOM=t,this.spec=e||Zf,this.side=this.spec.side||0}map(t,e,r,i){let{pos:s,deleted:l}=t.mapResult(e.from+i,this.side<0?-1:1);return l?null:new ua(s-r,s-r,this)}valid(){return!0}eq(t){return this==t||t instanceof Tg&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Cp(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class gf{constructor(t,e){this.attrs=t,this.spec=e||Zf}map(t,e,r,i){let s=t.map(e.from+i,this.spec.inclusiveStart?-1:1)-r,l=t.map(e.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=l?null:new ua(s,l,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof gf&&Cp(this.attrs,t.attrs)&&Cp(this.spec,t.spec)}static is(t){return t.type instanceof gf}destroy(){}}class U5{constructor(t,e){this.attrs=t,this.spec=e||Zf}map(t,e,r,i){let s=t.mapResult(e.from+i,1);if(s.deleted)return null;let l=t.mapResult(e.to+i,-1);return l.deleted||l.pos<=s.pos?null:new ua(s.pos-r,l.pos-r,this)}valid(t,e){let{index:r,offset:i}=t.content.findIndex(e.from),s;return i==e.from&&!(s=t.child(r)).isText&&i+s.nodeSize==e.to}eq(t){return this==t||t instanceof U5&&Cp(this.attrs,t.attrs)&&Cp(this.spec,t.spec)}destroy(){}}class ua{constructor(t,e,r){this.from=t,this.to=e,this.type=r}copy(t,e){return new ua(t,e,this.type)}eq(t,e=0){return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to}map(t,e,r){return this.type.map(t,this,e,r)}static widget(t,e,r){return new ua(t,t,new Tg(e,r))}static inline(t,e,r,i){return new ua(t,e,new gf(r,i))}static node(t,e,r,i){return new ua(t,e,new U5(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof gf}get widget(){return this.type instanceof Tg}}const Ud=[],Zf={};class Qr{constructor(t,e){this.local=t.length?t:Ud,this.children=e.length?e:Ud}static create(t,e){return e.length?Ng(e,t,0,Zf):Ws}find(t,e,r){let i=[];return this.findInner(t??0,e??1e9,i,0,r),i}findInner(t,e,r,i,s){for(let l=0;l<this.local.length;l++){let c=this.local[l];c.from<=e&&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]<e&&this.children[l+1]>t){let c=this.children[l]+1;this.children[l+2].findInner(t-c,e-c,r,i+c,s)}}map(t,e,r){return this==Ws||t.maps.length==0?this:this.mapInner(t,e,0,0,r||Zf)}mapInner(t,e,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(e,f)?(l||(l=[])).push(f):s.onRemove&&s.onRemove(this.local[c].spec)}return this.children.length?IR(this.children,l||[],t,e,r,i,s):l?new Qr(l.sort(Qf),Ud):Ws}add(t,e){return e.length?this==Ws?Qr.create(t,e):this.addInner(t,e,0):this}addInner(t,e,r){let i,s=0;t.forEach((c,f)=>{let d=f+r,p;if(p=MM(e,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,Ng(p,c,d+1,Zf)),s+=3}});let l=AM(s?CM(e):e,-r);for(let c=0;c<l.length;c++)l[c].type.valid(t,l[c])||l.splice(c--,1);return new Qr(l.length?this.local.concat(l).sort(Qf):this.local,i||this.children)}remove(t){return t.length==0||this==Ws?this:this.removeInner(t,0)}removeInner(t,e){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let l,c=r[s]+e,f=r[s+1]+e;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!=Ws?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,e)&&(i==this.local&&(i=this.local.slice()),i.splice(c--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Qr(i,r):Ws}forChild(t,e){if(this==Ws)return this;if(e.isLeaf)return Qr.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+e.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 gf){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 Qr(i.sort(Qf),Ud);return r?new sf([c,r]):c}return r||Ws}eq(t){if(this==t)return!0;if(!(t instanceof Qr)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(t){return H5(this.localsInner(t))}localsInner(t){if(this==Ws)return Ud;if(t.inlineContent||!this.local.some(gf.is))return this.local;let e=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof gf||e.push(this.local[r]);return e}forEachSet(t){t(this)}}Qr.empty=new Qr([],[]);Qr.removeOverlap=H5;const Ws=Qr.empty;class sf{constructor(t){this.members=t}map(t,e){const r=this.members.map(i=>i.map(t,e,Zf));return sf.from(r)}forChild(t,e){if(e.isLeaf)return Qr.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(t,e);s!=Ws&&(s instanceof sf?r=r.concat(s.members):r.push(s))}return sf.from(r)}eq(t){if(!(t instanceof sf)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(t){let e,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(t);if(s.length)if(!e)e=s;else{r&&(e=e.slice(),r=!1);for(let l=0;l<s.length;l++)e.push(s[l])}}return e?H5(r?e:e.sort(Qf)):Ud}static from(t){switch(t.length){case 0:return Ws;case 1:return t[0];default:return new sf(t.every(e=>e instanceof Qr)?t:t.reduce((e,r)=>e.concat(r instanceof Qr?r:r.members),[]))}}forEachSet(t){for(let e=0;e<this.members.length;e++)this.members[e].forEachSet(t)}}function IR(n,t,e,r,i,s,l){let c=n.slice();for(let d=0,p=s;d<e.maps.length;d++){let g=0;e.maps[d].forEach((b,y,M,C)=>{let L=C-M-(y-b);for(let R=0;R<c.length;R+=3){let B=c[R+1];if(B<0||b>B+p-g)continue;let q=c[R]+p-g;y>=q?c[R+1]=b<=q?-2:-1:b>=p&&L&&(c[R]+=L,c[R+1]+=L)}g+=L}),p=e.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=e.map(n[d]+s),g=p-i;if(g<0||g>=r.content.size){f=!0;continue}let b=e.map(n[d+1]+s,-1),y=b-i,{index:M,offset:C}=r.content.findIndex(g),L=r.maybeChild(M);if(L&&C==g&&C+L.nodeSize==y){let R=c[d+2].mapInner(e,L,p+1,n[d]+s+1,l);R!=Ws?(c[d]=g,c[d+1]=y,c[d+2]=R):(c[d+1]=-2,f=!0)}else f=!0}if(f){let d=jR(c,n,t,e,i,s,l),p=Ng(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 Qr(t.sort(Qf),c)}function AM(n,t){if(!t||!n.length)return n;let e=[];for(let r=0;r<n.length;r++){let i=n[r];e.push(new ua(i.from+t,i.to+t,i.type))}return e}function jR(n,t,e,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?e.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<n.length;f+=3)n[f+1]==-1&&c(n[f+2],t[f]+s+1);return e}function MM(n,t,e){if(t.isLeaf)return null;let r=e+t.nodeSize,i=null;for(let s=0,l;s<n.length;s++)(l=n[s])&&l.from>e&&l.to<r&&((i||(i=[])).push(l),n[s]=null);return i}function CM(n){let t=[];for(let e=0;e<n.length;e++)n[e]!=null&&t.push(n[e]);return t}function Ng(n,t,e,r){let i=[],s=!1;t.forEach((c,f)=>{let d=MM(n,c,f+e);if(d){s=!0;let p=Ng(d,c,e+f+1,r);p!=Ws&&i.push(f,f+c.nodeSize,p)}});let l=AM(s?CM(n):n,-e).sort(Qf);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 Qr(l,i):Ws}function Qf(n,t){return n.from-t.from||n.to-t.to}function H5(n){let t=n;for(let e=0;e<t.length-1;e++){let r=t[e];if(r.from!=r.to)for(let i=e+1;i<t.length;i++){let s=t[i];if(s.from==r.from){s.to!=r.to&&(t==n&&(t=n.slice()),t[i]=s.copy(s.from,r.to),f3(t,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(t==n&&(t=n.slice()),t[e]=r.copy(r.from,s.from),f3(t,i,r.copy(s.from,r.to)));break}}}return t}function f3(n,t,e){for(;t<n.length&&Qf(e,n[t])>0;)t++;n.splice(t,0,e)}function Iy(n){let t=[];return n.someProp("decorations",e=>{let r=e(n.state);r&&r!=Ws&&t.push(r)}),n.cursorWrapper&&t.push(Qr.create(n.state.doc,[n.cursorWrapper.deco])),sf.from(t)}const zR={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},BR=Ia&&hf<=11;class FR{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 UR{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new FR,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]);Ia&&hf<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Xs&&t.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),BR&&(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,zR)),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 e=0;e<t.length;e++)this.queue.push(t[e]);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(i3(this.view)){if(this.suppressingSelectionUpdates)return Cu(this.view);if(Ia&&hf<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&ld(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 e=new Set,r;for(let s=t.focusNode;s;s=eh(s))e.add(s);for(let s=t.anchorNode;s;s=eh(s))if(e.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 e=this.pendingRecords();e.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&i3(t)&&!this.ignoreSelectionChange(r),s=-1,l=-1,c=!1,f=[];if(t.editable)for(let p=0;p<e.length;p++){let g=this.registerMutation(e[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||Es&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&e.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(jl&&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||$R(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&&T0(r)&&(d=P5(t))&&d.eq(er.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Cu(t),this.currentSelection.set(r),t.scrollToSelection()):(s>-1||i)&&(s>-1&&(t.docView.markDirty(s,l),HR(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,YR(t,f)),this.handleDOMChange(s,l,c,f),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||Cu(t),this.currentSelection.set(r))}registerMutation(t,e){if(e.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];e.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(Ia&&hf<=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?Ms(i)+1:0,c=r.localPosFromDOM(t.target,l,-1),f=s&&s.parentNode==t.target?Ms(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 d3=new WeakMap,h3=!1;function HR(n){if(!d3.has(n)&&(d3.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=jl,h3)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."),h3=!0}}function p3(n,t){let e=t.startContainer,r=t.startOffset,i=t.endContainer,s=t.endOffset,l=n.domAtPos(n.state.selection.anchor);return ld(l.node,l.offset,i,s)&&([e,r,i,s]=[i,s,e,r]),{anchorNode:e,anchorOffset:r,focusNode:i,focusOffset:s}}function qR(n,t){if(t.getComposedRanges){let i=t.getComposedRanges(n.root)[0];if(i)return p3(n,i)}let e;function r(i){i.preventDefault(),i.stopImmediatePropagation(),e=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),e?p3(n,e):null}function $R(n,t){for(let e=t.parentNode;e&&e!=n.dom;e=e.parentNode){let r=n.docView.nearestDesc(e,!0);if(r&&r.node.isBlock)return e}return null}function YR(n,t){var e;let{focusNode:r,focusOffset:i}=n.domSelectionRange();for(let s of t)if(((e=s.parentNode)===null||e===void 0?void 0:e.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&&n.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function VR(n,t,e,r){let{node:i,fromOffset:s,toOffset:l,from:c,to:f}=n.docView.parseRange(t,e),d=n.domSelectionRange(),p,g=d.anchorNode;if(g&&n.dom.contains(g.nodeType==1?g:g.parentNode)&&(p=[{node:g,offset:d.anchorOffset}],T0(d)||p.push({node:d.focusNode,offset:d.focusOffset})),Es&&n.input.lastKeyCode===8)for(let R=l;R>s;R--){let B=i.childNodes[R-1],q=B.pmViewDesc;if(B.nodeName=="BR"&&!q){l=R;break}if(!q||q.size)break}let b=n.state.doc,y=n.someProp("domParser")||rp.fromSchema(n.state.schema),M=b.resolve(c),C=null,L=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:WR(r),context:M});if(p&&p[0].pos!=null){let R=p[0].pos,B=p[1]&&p[1].pos;B==null&&(B=R),C={anchor:R+c,head:B+c}}return{doc:L,sel:C,from:c,to:f}}const WR=n=>t=>{let e=t.pmViewDesc;if(e)return e.parseRule(n);if(t.nodeName=="BR"&&t.parentNode){if(Xs&&/^(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||Xs&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null},XR=/^(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 GR(n,t,e,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,t<0){let kt=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,bt=P5(n,kt);if(bt&&!n.state.selection.eq(bt)){if(Es&&ku&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",Lt=>Lt(n,Uf(13,"Enter"))))return;let it=n.state.tr.setSelection(bt);kt=="pointer"?it.setMeta("pointer",!0):kt=="key"&&it.scrollIntoView(),s&&it.setMeta("composition",s),n.dispatch(it)}return}let l=n.state.doc.resolve(t),c=l.sharedDepth(e);t=l.before(c+1),e=n.state.doc.resolve(e).after(c+1);let f=n.state.selection,d=VR(n,t,e,i),p=n.state.doc,g=p.slice(d.from,d.to),b,y;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(b=n.state.selection.to,y="end"):(b=n.state.selection.from,y="start"),n.input.lastKeyCode=null;let M=ZR(g.content,d.doc.content,d.from,b,y);if(M&&n.input.domChangeCount++,(nh&&n.input.lastIOSEnter>Date.now()-225||ku)&&i.some(kt=>kt.nodeType==1&&!XR.test(kt.nodeName))&&(!M||M.endA>=M.endB)&&n.someProp("handleKeyDown",kt=>kt(n,Uf(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!M)if(r&&f instanceof Ln&&!f.empty&&f.$head.sameParent(f.$anchor)&&!n.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))M={start:f.from,endA:f.to,endB:f.to};else{if(d.sel){let kt=m3(n,n.state.doc,d.sel);if(kt&&!kt.eq(n.state.selection)){let bt=n.state.tr.setSelection(kt);s&&bt.setMeta("composition",s),n.dispatch(bt)}}return}n.state.selection.from<n.state.selection.to&&M.start==M.endB&&n.state.selection instanceof Ln&&(M.start>n.state.selection.from&&M.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?M.start=n.state.selection.from:M.endA<n.state.selection.to&&M.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(M.endB+=n.state.selection.to-M.endA,M.endA=n.state.selection.to)),Ia&&hf<=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 C=d.doc.resolveNoCache(M.start-d.from),L=d.doc.resolveNoCache(M.endB-d.from),R=p.resolve(M.start),B=C.sameParent(L)&&C.parent.inlineContent&&R.end()>=M.endA;if((nh&&n.input.lastIOSEnter>Date.now()-225&&(!B||i.some(kt=>kt.nodeName=="DIV"||kt.nodeName=="P"))||!B&&C.pos<d.doc.content.size&&(!C.sameParent(L)||!C.parent.inlineContent)&&C.pos<L.pos&&!/\S/.test(d.doc.textBetween(C.pos,L.pos,"","")))&&n.someProp("handleKeyDown",kt=>kt(n,Uf(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>M.start&&JR(p,M.start,M.endA,C,L)&&n.someProp("handleKeyDown",kt=>kt(n,Uf(8,"Backspace")))){ku&&Es&&n.domObserver.suppressSelectionUpdates();return}Es&&M.endB==M.start&&(n.input.lastChromeDelete=Date.now()),ku&&!B&&C.start()!=L.start()&&L.parentOffset==0&&C.depth==L.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==M.endA&&(M.endB-=2,L=d.doc.resolveNoCache(M.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(kt){return kt(n,Uf(13,"Enter"))})},20));let q=M.start,V=M.endA,gt=kt=>{let bt=kt||n.state.tr.replace(q,V,d.doc.slice(M.start-d.from,M.endB-d.from));if(d.sel){let it=m3(n,bt.doc,d.sel);it&&!(Es&&n.composing&&it.empty&&(M.start!=M.endB||n.input.lastChromeDelete<Date.now()-100)&&(it.head==q||it.head==bt.mapping.map(V)-1)||Ia&&it.empty&&it.head==q)&&bt.setSelection(it)}return s&&bt.setMeta("composition",s),bt.scrollIntoView()},Mt;if(B)if(C.pos==L.pos){Ia&&hf<=11&&C.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Cu(n),20));let kt=gt(n.state.tr.delete(q,V)),bt=p.resolve(M.start).marksAcross(p.resolve(M.endA));bt&&kt.ensureMarks(bt),n.dispatch(kt)}else if(M.endA==M.endB&&(Mt=KR(C.parent.content.cut(C.parentOffset,L.parentOffset),R.parent.content.cut(R.parentOffset,M.endA-R.start())))){let kt=gt(n.state.tr);Mt.type=="add"?kt.addMark(q,V,Mt.mark):kt.removeMark(q,V,Mt.mark),n.dispatch(kt)}else if(C.parent.child(C.index()).isText&&C.index()==L.index()-(L.textOffset?0:1)){let kt=C.parent.textBetween(C.parentOffset,L.parentOffset),bt=()=>gt(n.state.tr.insertText(kt,q,V));n.someProp("handleTextInput",it=>it(n,q,V,kt,bt))||n.dispatch(bt())}else n.dispatch(gt());else n.dispatch(gt())}function m3(n,t,e){return Math.max(e.anchor,e.head)>t.content.size?null:I5(n,t.resolve(e.anchor),t.resolve(e.head))}function KR(n,t){let e=n.firstChild.marks,r=t.firstChild.marks,i=e,s=r,l,c,f;for(let p=0;p<r.length;p++)i=r[p].removeFromSet(i);for(let p=0;p<e.length;p++)s=e[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(Ae.from(d).eq(n))return{mark:c,type:l}}function JR(n,t,e,r,i){if(e-t<=i.pos-r.pos||jy(r,!0,!1)<i.pos)return!1;let s=n.resolve(t);if(!r.parent.isTextblock){let c=s.nodeAfter;return c!=null&&e==t+c.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let l=n.resolve(jy(s,!0,!0));return!l.parent.isTextblock||l.pos>e||jy(l,!0,!1)<e?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function jy(n,t,e){let r=n.depth,i=t?n.end():n.pos;for(;r>0&&(t||n.indexAfter(r)==n.node(r).childCount);)r--,i++,t=!1;if(e){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function ZR(n,t,e,r,i){let s=n.findDiffStart(t,e),l=e+n.size,c=e+t.size;if(s==null)return null;let{a:f,b:d}=n.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 EM{constructor(t,e){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 pR,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(v3),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=b3(this),y3(this),this.nodeViews=x3(this),this.docView=ZS(this.state.doc,g3(this),Iy(this),this.dom,this),this.domObserver=new UR(this,(r,i,s,l)=>GR(this,r,i,s,l)),this.domObserver.start(),mR(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 e in t)this._props[e]=t[e];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&K2(this);let e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(v3),this.directPlugins=t.plugins),this.updateStateInner(t.state,e)}setProps(t){let e={};for(let r in this._props)e[r]=this._props[r];e.state=this.state;for(let r in t)e[r]=t[r];this.update(e)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,e){var r;let i=this.state,s=!1,l=!1;t.storedMarks&&this.composing&&(vM(this),l=!0),this.state=t;let c=i.plugins!=t.plugins||this._props.plugins!=e.plugins;if(c||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){let y=x3(this);tO(y,this.nodeViews)&&(this.nodeViews=y,s=!0)}(c||e.handleDOMEvents!=this._props.handleDOMEvents)&&K2(this),this.editable=b3(this),y3(this);let f=Iy(this),d=g3(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&&NL(this);if(l){this.domObserver.stop();let y=g&&(Ia||Es)&&!this.composing&&!i.selection.empty&&!t.selection.empty&&QR(i.selection,t.selection);if(g){let C=Es?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=_R(this)),(s||!this.docView.update(t.doc,d,f,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=ZS(t.doc,d,f,this.dom,this)),C&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}let M=this.input.mouseDown;y||!(M&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&QL(this)&&M.delaySelUpdate())?Cu(this,y):(sM(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&&_L(b)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",e=>e(this)))if(this.state.selection instanceof kn){let e=this.docView.domAfterPos(this.state.selection.from);e.nodeType==1&&WS(this,e.getBoundingClientRect(),t)}else WS(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 e=0;e<this.directPlugins.length;e++){let r=this.directPlugins[e];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let r=this.state.plugins[e];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let e=0;e<this.pluginViews.length;e++){let r=this.pluginViews[e];r.update&&r.update(this,t)}}updateDraggedNode(t,e){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-e.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new SM(t.slice,t.move,i<0?void 0:kn.create(this.state.doc,i))}someProp(t,e){let r=this._props&&this._props[t],i;if(r!=null&&(i=e?e(r):r))return i;for(let l=0;l<this.directPlugins.length;l++){let c=this.directPlugins[l].props[t];if(c!=null&&(i=e?e(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=e?e(c):c))return i}}hasFocus(){if(Ia){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&&DL(this.dom),Cu(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return t||document}updateRoot(){this._root=null}posAtCoords(t){return IL(this,t)}coordsAtPos(t,e=1){return ZA(this,t,e)}domAtPos(t,e=0){return this.docView.domFromPos(t,e)}nodeDOM(t){let e=this.docView.descAt(t);return e?e.nodeDOM:null}posAtDOM(t,e,r=-1){let i=this.docView.posFromDOM(t,e,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(t,e){return UL(this,e||this.state,t)}pasteHTML(t,e){return Mp(this,"",t,!1,e||new ClipboardEvent("paste"))}pasteText(t,e){return Mp(this,t,null,!0,e||new ClipboardEvent("paste"))}serializeForClipboard(t){return j5(this,t)}destroy(){this.docView&&(gR(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Iy(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,xL())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return bR(this,t)}domSelectionRange(){let t=this.domSelection();return t?Xs&&this.root.nodeType===11&&AL(this.dom.ownerDocument)==this.dom&&qR(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}EM.prototype.dispatch=function(n){let t=this._props.dispatchTransaction;t?t.call(this,n):this.updateState(this.state.apply(n))};function g3(n){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(n.editable),n.someProp("attributes",e=>{if(typeof e=="function"&&(e=e(n.state)),e)for(let r in e)r=="class"?t.class+=" "+e[r]:r=="style"?t.style=(t.style?t.style+";":"")+e[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(e[r]))}),t.translate||(t.translate="no"),[ua.node(0,n.state.doc.content.size,t)]}function y3(n){if(n.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),n.cursorWrapper={dom:t,deco:ua.widget(n.state.selection.from,t,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function b3(n){return!n.someProp("editable",t=>t(n.state)===!1)}function QR(n,t){let e=Math.min(n.$anchor.sharedDepth(n.head),t.$anchor.sharedDepth(t.head));return n.$anchor.start(e)!=t.$anchor.start(e)}function x3(n){let t=Object.create(null);function e(r){for(let i in r)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=r[i])}return n.someProp("nodeViews",e),n.someProp("markViews",e),t}function tO(n,t){let e=0,r=0;for(let i in n){if(n[i]!=t[i])return!0;e++}for(let i in t)r++;return e!=r}function v3(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var bf={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:"'"},_g={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},eO=typeof navigator<"u"&&/Mac/.test(navigator.platform),nO=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Cs=0;Cs<10;Cs++)bf[48+Cs]=bf[96+Cs]=String(Cs);for(var Cs=1;Cs<=24;Cs++)bf[Cs+111]="F"+Cs;for(var Cs=65;Cs<=90;Cs++)bf[Cs]=String.fromCharCode(Cs+32),_g[Cs]=String.fromCharCode(Cs);for(var zy in bf)_g.hasOwnProperty(zy)||(_g[zy]=bf[zy]);function rO(n){var t=eO&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||nO&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",e=!t&&n.key||(n.shiftKey?_g:bf)[n.keyCode]||n.key||"Unidentified";return e=="Esc"&&(e="Escape"),e=="Del"&&(e="Delete"),e=="Left"&&(e="ArrowLeft"),e=="Up"&&(e="ArrowUp"),e=="Right"&&(e="ArrowRight"),e=="Down"&&(e="ArrowDown"),e}const iO=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),oO=typeof navigator<"u"&&/Win/.test(navigator.platform);function sO(n){let t=n.split(/-(?!$)/),e=t[t.length-1];e=="Space"&&(e=" ");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))iO?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+f)}return r&&(e="Alt-"+e),i&&(e="Ctrl-"+e),l&&(e="Meta-"+e),s&&(e="Shift-"+e),e}function aO(n){let t=Object.create(null);for(let e in n)t[sO(e)]=n[e];return t}function By(n,t,e=!0){return t.altKey&&(n="Alt-"+n),t.ctrlKey&&(n="Ctrl-"+n),t.metaKey&&(n="Meta-"+n),e&&t.shiftKey&&(n="Shift-"+n),n}function lO(n){return new Fi({props:{handleKeyDown:TM(n)}})}function TM(n){let t=aO(n);return function(e,r){let i=rO(r),s,l=t[By(i,r)];if(l&&l(e.state,e.dispatch,e))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=t[By(i,r,!1)];if(c&&c(e.state,e.dispatch,e))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(oO&&r.ctrlKey&&r.altKey)&&(s=bf[r.keyCode])&&s!=i){let c=t[By(s,r)];if(c&&c(e.state,e.dispatch,e))return!0}}return!1}}function _0(n){const{state:t,transaction:e}=n;let{selection:r}=e,{doc:i}=e,{storedMarks:s}=e;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=e.selection,i=e.doc,s=e.storedMarks,e}}}var Jd=class NM{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:e,state:r}=this,{view:i}=e,{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,e=!0){const{rawCommands:r,editor:i,state:s}=this,{view:l}=i,c=[],f=!!t,d=t||s.tr,p=()=>(!f&&e&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(d),c.every(b=>b===!0)),g={...Object.fromEntries(Object.entries(r).map(([b,y])=>[b,(...C)=>{const L=this.buildProps(d,e),R=y(...C)(L);return c.push(R),g}])),run:p};return g}static createFakeChain(){const t=new Proxy({},{get:(e,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>t}});return t}createCan(t){const{rawCommands:e,state:r}=this,i=!1,s=t||r.tr,l=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(e).map(([c,f])=>[c,(...d)=>f(...d)({...l,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}static createFallbackCan(){const t=NM.createFakeChain();return new Proxy({chain:()=>t},{get:(e,r)=>{if(r!=="then")return r==="chain"?e.chain:()=>!1}})}buildProps(t,e=!0){const{rawCommands:r,editor:i,state:s}=this,{view:l}=i,c={tr:t,editor:i,view:l,state:_0({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map(([f,d])=>[f,(...p)=>d(...p)(c)]))}};return c}};const cO=()=>({editor:n,view:t})=>(requestAnimationFrame(()=>{if(!n.isDestroyed){var e;t.dom.blur(),(e=window)===null||e===void 0||(e=e.getSelection())===null||e===void 0||e.removeAllRanges()}}),!0),uO=(n=!0)=>({commands:t})=>t.setContent("",{emitUpdate:n}),fO=()=>({state:n,tr:t,dispatch:e})=>{const{selection:r}=t,{ranges:i}=r;return e&&i.forEach(({$from:s,$to:l})=>{n.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=fh(y);if(c.type.isTextblock){const{defaultType:C}=g.parent.contentMatchAt(g.index());t.setNodeMarkup(y.start,C)}(M||M===0)&&t.lift(y,M)})}),!0},dO=n=>t=>n(t),hO=()=>({state:n,dispatch:t})=>UA(n,t),pO=(n,t)=>({editor:e,tr:r})=>{const{state:i}=e,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const l=r.mapping.map(t);return r.insert(l,s.content),r.setSelection(new Ln(r.doc.resolve(Math.max(l-1,0)))),!0},mO=()=>({tr:n,dispatch:t})=>{const{selection:e}=n,r=e.$anchor.node();if(r.content.size>0)return!1;const i=n.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);n.delete(l,c).scrollIntoView()}return!0}return!1};function Eo(n,t){if(typeof n=="string"){if(!t.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return t.nodes[n]}return n}const gO=n=>({tr:t,state:e,dispatch:r})=>{const i=Eo(n,e.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},yO=n=>({tr:t,dispatch:e})=>{const{from:r,to:i}=n;return e&&t.delete(r,i),!0},bO=n=>n.content?/^text(\*|\+)/.test(n.content):!1,w3=(n,t,e)=>{if(!n.parent.isInline||e==="left"&&n.pos>n.start()||e==="right"&&n.pos<n.end())return n.pos;const r=t.nodes[n.parent.type.name].spec;return bO(r)?e==="left"?n.start()-1:n.end()+1:n.pos},xO=(n,t,e)=>({from:w3(n,e,"left"),to:w3(t,e,"right")}),vO=()=>({state:n,dispatch:t})=>{if(n.selection.empty)return!1;if(t){const e=n.tr,{ranges:r}=n.selection,i=e.steps.length;r.forEach(s=>{const l=e.mapping.slice(i),c=e.doc.resolve(l.map(s.$from.pos)),f=e.doc.resolve(l.map(s.$to.pos)),{from:d,to:p}=xO(c,f,n.schema);e.deleteRange(d,p)}),e.selection.empty||e.setSelection(Ln.near(e.doc.resolve(e.selection.from))),e.scrollIntoView(),t(e)}return!0},wO=()=>({commands:n})=>n.keyboardShortcut("Enter"),SO=()=>({state:n,dispatch:t})=>iL(n,t);function q5(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Dg(n,t,e={strict:!0}){const r=Object.keys(t);return r.length?r.every(i=>e.strict?t[i]===n[i]:q5(t[i])?t[i].test(n[i]):t[i]===n[i]):!0}function _M(n,t,e={}){return n.find(r=>r.type===t&&Dg(Object.fromEntries(Object.keys(e).map(i=>[i,r.attrs[i]])),e))}function S3(n,t,e={}){return!!_M(n,t,e)}function $5(n,t,e){if(!n||!t)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(f=>f.type===t))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(f=>f.type===t))return;if(!e){const f=r.node.marks.find(d=>d.type===t);f&&(e=f.attrs)}if(!_M([...r.node.marks],t,e))return;let i=r.index,s=n.start()+r.offset,l=i+1,c=s+r.node.nodeSize;for(;i>0&&S3([...n.parent.child(i-1).marks],t,e);)i-=1,s-=n.parent.child(i).nodeSize;for(;l<n.parent.childCount&&S3([...n.parent.child(l).marks],t,e);)c+=n.parent.child(l).nodeSize,l+=1;return{from:s,to:c}}function Tu(n,t){if(typeof n=="string"){if(!t.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return t.marks[n]}return n}const kO=(n,t)=>({tr:e,state:r,dispatch:i})=>{const s=Tu(n,r.schema),{doc:l,selection:c}=e,{$from:f,from:d,to:p}=c;if(i){const g=$5(f,s,t);if(g&&g.from<=d&&g.to>=p){const b=Ln.create(l,g.from,g.to);e.setSelection(b)}}return!0},AO=n=>t=>{const e=typeof n=="function"?n(t):n;for(let r=0;r<e.length;r+=1)if(e[r](t))return!0;return!1};function DM(n){return n instanceof Ln}function Vf(n=0,t=0,e=0){return Math.min(Math.max(n,t),e)}function J2(n,t=null){if(!t)return null;const e=er.atStart(n),r=er.atEnd(n);if(t==="start"||t===!0)return e;if(t==="end")return r;const i=e.from,s=r.to;return t==="all"?Ln.create(n,Vf(0,i,s),Vf(n.content.size,i,s)):Ln.create(n,Vf(t,i,s),Vf(t,i,s))}function k3(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function Lg(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function MO(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const CO=(n=null,t={})=>({editor:e,view:r,tr:i,dispatch:s})=>{t={scrollIntoView:!0,...t};const l=()=>{(Lg()||k3())&&r.dom.focus(),MO()&&!Lg()&&!k3()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{e.isDestroyed||(r.focus(),t?.scrollIntoView&&e.commands.scrollIntoView())})};try{if(r.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(s&&n===null&&!DM(e.state.selection))return l(),!0;const c=J2(i.doc,n)||e.state.selection,f=e.state.selection.eq(c);return s&&(f||i.setSelection(c),f&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},EO=(n,t)=>e=>n.every((r,i)=>t(r,{...e,index:i})),TO=(n,t)=>({tr:e,commands:r})=>r.insertContentAt({from:e.selection.from,to:e.selection.to},n,t),LM=n=>{const t=n.childNodes;for(let e=t.length-1;e>=0;e-=1){const r=t[e];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&LM(r)}return n};function Um(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${n}</body>`,e=new window.DOMParser().parseFromString(t,"text/html").body;return LM(e)}function RM(n){return typeof n?.nodesBetween=="function"}function rh(n,t,e){if(RM(n))return n;const r=typeof n=="object"&&n!==null;e={slice:!0,parseOptions:{},...e};const i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return Ae.fromArray(n.map(l=>t.nodeFromJSON(l)));const s=t.nodeFromJSON(n);return e.errorOnInvalidContent&&s.check(),s}catch(s){if(e.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),rh("",t,e)}if(i){if(e.errorOnInvalidContent){let l=!1,c="";const f=new hA({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(e.slice?rp.fromSchema(f).parseSlice(Um(n),e.parseOptions):rp.fromSchema(f).parse(Um(n),e.parseOptions),e.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=rp.fromSchema(t);return e.slice?s.parseSlice(Um(n),e.parseOptions).content:s.parse(Um(n),e.parseOptions)}return rh("",t,e)}function OM(n){return!("type"in n)}function PM(n,t,e){const r=n.steps.length-1;if(r<t)return;const i=n.steps[r];if(!(i instanceof uo||i instanceof Zo))return;const s=n.mapping.maps[r];let l=0;s.forEach((c,f,d,p)=>{l===0&&(l=p)}),n.setSelection(er.near(n.doc.resolve(l),e))}const NO=(n,t,e)=>({tr:r,dispatch:i,editor:s})=>{if(i){e={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...e};let c;const f=L=>{s.emit("contentError",{editor:s,error:L,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...e.parseOptions};if(!e.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{rh(t,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(L){f(L)}try{var l;c=rh(t,s.schema,{parseOptions:d,errorOnInvalidContent:(l=e.errorOnInvalidContent)!==null&&l!==void 0?l:s.options.enableContentCheck})}catch(L){return f(L),!1}let{from:p,to:g}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},b=!0,y=!0;const M=OM(c)?c.content:[c];if(M.forEach(L=>{L.check(),b=b?L.isText&&L.marks.length===0:!1,y=y?L.isBlock:!1}),p===g&&y){const{parent:L}=r.doc.resolve(p);L.isTextblock&&!L.type.spec.code&&!L.childCount&&(p-=1,g+=1)}let C;if(b)Array.isArray(t)?C=t.map(L=>L.text||"").join(""):RM(t)?C=M.map(L=>{var R;return(R=L.text)!==null&&R!==void 0?R:""}).join(""):typeof t=="object"&&t&&t.text?C=t.text:C=t,r.insertText(C,p,g);else{C=Ae.from(M);const L=r.doc.resolve(p),R=L.node(),B=L.parentOffset===0,q=R.isText||R.isTextblock,V=R.content.size>0;B&&q&&V&&y&&(p=Math.max(0,p-1)),r.replaceWith(p,g,M)}e.updateSelection&&PM(r,r.steps.length-1,-1),e.applyInputRules&&r.setMeta("applyInputRules",{from:p,text:C}),e.applyPasteRules&&r.setMeta("applyPasteRules",{from:p,text:C})}return!0};function IM(n){for(let t=0;t<n.edgeCount;t+=1){const{type:e}=n.edge(t);if(e.isTextblock&&!e.hasRequiredAttrs())return e}return null}const _O=(n={})=>({tr:t,dispatch:e,editor:r})=>{const{pos:i,attrs:s,content:l,updateSelection:c=!0}=n;let f;typeof i=="number"?f=t.doc.resolve(i):i?f=i:f=t.selection.$from;const d=IM(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=rh(l,r.schema);b=d.createAndFill(g,y)}else b=d.createAndFill(g);return b?(e&&(t.insert(f.pos,b),c&&PM(t,t.steps.length-1,-1)),!0):!1},DO=()=>({state:n,dispatch:t})=>eL(n,t),LO=()=>({state:n,dispatch:t})=>nL(n,t),RO=()=>({state:n,dispatch:t})=>OA(n,t),OO=()=>({state:n,dispatch:t})=>zA(n,t),PO=()=>({state:n,dispatch:t,tr:e})=>{try{const r=M0(n.doc,n.selection.$from.pos,-1);return r==null?!1:(e.join(r,2),t&&t(e),!0)}catch{return!1}},IO=()=>({state:n,dispatch:t,tr:e})=>{try{const r=M0(n.doc,n.selection.$from.pos,1);return r==null?!1:(e.join(r,2),t&&t(e),!0)}catch{return!1}},jO=()=>({state:n,dispatch:t})=>QD(n,t),zO=()=>({state:n,dispatch:t})=>tL(n,t);function jM(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function BO(n){const t=n.split(/-(?!$)/);let e=t[t.length-1];e==="Space"&&(e=" ");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))Lg()||jM()?l=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${f}`)}return r&&(e=`Alt-${e}`),i&&(e=`Ctrl-${e}`),l&&(e=`Meta-${e}`),s&&(e=`Shift-${e}`),e}const FO=n=>({editor:t,view:e,tr:r,dispatch:i})=>{const s=BO(n).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(()=>{e.someProp("handleKeyDown",d=>d(e,c))});return f?.steps.forEach(d=>{const p=d.map(r.mapping);p&&i&&r.maybeStep(p)}),!0};function xf(n,t,e={}){const{from:r,to:i,empty:s}=n.selection,l=t?Eo(t,n.schema):null,c=[];n.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=>Dg(p.node.attrs,e,{strict:!1}));return s?!!d.length:d.reduce((p,g)=>p+g.to-g.from,0)>=f}const UO=(n,t={})=>({state:e,dispatch:r})=>xf(e,Eo(n,e.schema),t)?rL(e,r):!1,HO=()=>({state:n,dispatch:t})=>HA(n,t),qO=n=>({state:t,dispatch:e})=>{const r=Eo(n,t.schema);return mL(r)(t,e)},$O=()=>({state:n,dispatch:t})=>FA(n,t);function D0(n,t){return t.nodes[n]?"node":t.marks[n]?"mark":null}function A3(n,t){const e=typeof t=="string"?[t]:t;return Object.keys(n).reduce((r,i)=>(e.includes(i)||(r[i]=n[i]),r),{})}const YO=(n,t)=>({tr:e,state:r,dispatch:i})=>{let s=null,l=null;const c=D0(typeof n=="string"?n:n.name,r.schema);if(!c)return!1;c==="node"&&(s=Eo(n,r.schema)),c==="mark"&&(l=Tu(n,r.schema));let f=!1;return e.selection.ranges.forEach(d=>{r.doc.nodesBetween(d.$from.pos,d.$to.pos,(p,g)=>{s&&s===p.type&&(f=!0,i&&e.setNodeMarkup(g,void 0,A3(p.attrs,t))),l&&p.marks.length&&p.marks.forEach(b=>{l===b.type&&(f=!0,i&&e.addMark(g,g+p.nodeSize,l.create(A3(b.attrs,t))))})})}),f},VO=()=>({tr:n,dispatch:t})=>(t&&n.scrollIntoView(),!0),WO=()=>({tr:n,dispatch:t})=>{if(t){const e=new il(n.doc);n.setSelection(e)}return!0},XO=()=>({state:n,dispatch:t})=>IA(n,t),GO=()=>({state:n,dispatch:t})=>BA(n,t),KO=()=>({state:n,dispatch:t})=>aL(n,t),JO=()=>({state:n,dispatch:t})=>uL(n,t),ZO=()=>({state:n,dispatch:t})=>cL(n,t);function Z2(n,t,e={},r={}){return rh(n,t,{slice:!1,parseOptions:e,errorOnInvalidContent:r.errorOnInvalidContent})}const QO=(n,{errorOnInvalidContent:t,emitUpdate:e=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:l,commands:c})=>{const{doc:f}=s;if(r.preserveWhitespace!=="full"){const d=Z2(n,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});if(l){const p=OM(d)?d.content:[d];s.replaceWith(0,f.content.size,p).setMeta("preventUpdate",!e)}return!0}return l&&s.setMeta("preventUpdate",!e),c.insertContentAt({from:0,to:f.content.size},n,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function zM(n,t){const e=Tu(t,n.schema),{from:r,to:i,empty:s}=n.selection,l=[];s?(n.storedMarks&&l.push(...n.storedMarks),l.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,f=>{l.push(...f.marks)});const c=l.find(f=>f.type.name===e.name);return c?{...c.attrs}:{}}function BM(n,t){const e=new NA(n);return t.forEach(r=>{r.steps.forEach(i=>{e.step(i)})}),e}function t7(n,t,e){const r=[];return n.nodesBetween(t.from,t.to,(i,s)=>{e(i)&&r.push({node:i,pos:s})}),r}function e7(n,t){for(let e=n.depth;e>0;e-=1){const r=n.node(e);if(t(r))return{pos:e>0?n.before(e):0,start:n.start(e),depth:e,node:r}}}function L0(n){return t=>e7(t.$from,n)}function fn(n,t,e){return n.config[t]===void 0&&n.parent?fn(n.parent,t,e):typeof n.config[t]=="function"?n.config[t].bind({...e,parent:n.parent?fn(n.parent,t,e):null}):n.config[t]}function Y5(n){return n.map(t=>{const e=fn(t,"addExtensions",{name:t.name,options:t.options,storage:t.storage});return e?[t,...Y5(e())]:t}).flat(10)}function V5(n,t){const e=hd.fromSchema(t).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(e),r.innerHTML}function FM(n){return typeof n=="function"}function Fr(n,t=void 0,...e){return FM(n)?t?n.bind(t)(...e):n(...e):n}function n7(n={}){return Object.keys(n).length===0&&n.constructor===Object}function ih(n){return{baseExtensions:n.filter(t=>t.type==="extension"),nodeExtensions:n.filter(t=>t.type==="node"),markExtensions:n.filter(t=>t.type==="mark")}}function UM(n){const t=[],{nodeExtensions:e,markExtensions:r}=ih(n),i=[...e,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},l=e.filter(d=>d.name!=="text").map(d=>d.name),c=r.map(d=>d.name),f=[...l,...c];return n.forEach(d=>{const p=fn(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,C])=>{t.push({type:y,name:M,attribute:{...s,...C}})})})})}),i.forEach(d=>{const p=fn(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 r7(n){const t=[];let e="",r=!1,i=!1,s=0;const l=n.length;for(let c=0;c<l;c+=1){const f=n[c];if(f==="'"&&!i){r=!r,e+=f;continue}if(f==='"'&&!r){i=!i,e+=f;continue}if(!r&&!i){if(f==="("){s+=1,e+=f;continue}if(f===")"&&s>0){s-=1,e+=f;continue}if(f===";"&&s===0){t.push(e),e="";continue}}e+=f}return e&&t.push(e),t}function M3(n){const t=[],e=r7(n||""),r=e.length;for(let i=0;i<r;i+=1){const s=e[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 mo(...n){return n.filter(t=>!!t).reduce((t,e)=>{const r={...t};return Object.entries(e).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([...M3(r[i]),...M3(s)]);r[i]=Array.from(l.entries()).map(([c,f])=>`${c}: ${f}`).join("; ")}else r[i]=s}),r},{})}function Ep(n,t){return t.filter(e=>e.type===n.type.name).filter(e=>e.attribute.rendered).map(e=>e.attribute.renderHTML?e.attribute.renderHTML(n.attrs)||{}:{[e.name]:n.attrs[e.name]}).reduce((e,r)=>mo(e,r),{})}function i7(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function C3(n,t){return"style"in n?n:{...n,getAttrs:e=>{const r=n.getAttrs?n.getAttrs(e):n.attrs;if(r===!1)return!1;const i=t.reduce((s,l)=>{const c=l.attribute.parseHTML?l.attribute.parseHTML(e):i7(e.getAttribute(l.name));return c==null?s:{...s,[l.name]:c}},{});return{...r,...i}}}}function E3(n){return Object.fromEntries(Object.entries(n).filter(([t,e])=>t==="attrs"&&n7(e)?!1:e!=null))}function T3(n){var t,e;const r={};return!(!(n==null||(t=n.attribute)===null||t===void 0)&&t.isRequired)&&"default"in(n?.attribute||{})&&(r.default=n.attribute.default),(n==null||(e=n.attribute)===null||e===void 0?void 0:e.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function o7(n,t){var e;const r=UM(n),{nodeExtensions:i,markExtensions:s}=ih(n),l=(e=i.find(d=>fn(d,"topNode")))===null||e===void 0?void 0:e.name,c=Object.fromEntries(i.map(d=>{const p=r.filter(L=>L.type===d.name),g={name:d.name,options:d.options,storage:d.storage,editor:t},b=E3({...n.reduce((L,R)=>{const B=fn(R,"extendNodeSchema",g);return{...L,...B?B(d):{}}},{}),content:Fr(fn(d,"content",g)),marks:Fr(fn(d,"marks",g)),group:Fr(fn(d,"group",g)),inline:Fr(fn(d,"inline",g)),atom:Fr(fn(d,"atom",g)),selectable:Fr(fn(d,"selectable",g)),draggable:Fr(fn(d,"draggable",g)),code:Fr(fn(d,"code",g)),whitespace:Fr(fn(d,"whitespace",g)),linebreakReplacement:Fr(fn(d,"linebreakReplacement",g)),defining:Fr(fn(d,"defining",g)),isolating:Fr(fn(d,"isolating",g)),attrs:Object.fromEntries(p.map(T3))}),y=Fr(fn(d,"parseHTML",g));y&&(b.parseDOM=y.map(L=>C3(L,p)));const M=fn(d,"renderHTML",g);M&&(b.toDOM=L=>M({node:L,HTMLAttributes:Ep(L,p)}));const C=fn(d,"renderText",g);return C&&(b.toText=C),[d.name,b]})),f=Object.fromEntries(s.map(d=>{const p=r.filter(C=>C.type===d.name),g={name:d.name,options:d.options,storage:d.storage,editor:t},b=E3({...n.reduce((C,L)=>{const R=fn(L,"extendMarkSchema",g);return{...C,...R?R(d):{}}},{}),inclusive:Fr(fn(d,"inclusive",g)),excludes:Fr(fn(d,"excludes",g)),group:Fr(fn(d,"group",g)),spanning:Fr(fn(d,"spanning",g)),code:Fr(fn(d,"code",g)),attrs:Object.fromEntries(p.map(T3))}),y=Fr(fn(d,"parseHTML",g));y&&(b.parseDOM=y.map(C=>C3(C,p)));const M=fn(d,"renderHTML",g);return M&&(b.toDOM=C=>M({mark:C,HTMLAttributes:Ep(C,p)})),[d.name,b]}));return new hA({topNode:l,nodes:c,marks:f})}function s7(n){const t=n.filter((e,r)=>n.indexOf(e)!==r);return Array.from(new Set(t))}function ap(n){return n.sort((e,r)=>{const i=fn(e,"priority")||100,s=fn(r,"priority")||100;return i>s?-1:i<s?1:0})}function HM(n){const t=ap(Y5(n)),e=s7(t.map(r=>r.name));return e.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${e.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),t}function qM(n,t,e){const{from:r,to:i}=t,{blockSeparator:s=`
105
-
106
- `,textSerializers:l={}}=e||{};let c="";return n.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 a7(n,t){return qM(n,{from:0,to:n.content.size},t)}function $M(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,t])=>t.spec.toText).map(([t,e])=>[t,e.spec.toText]))}function l7(n,t){const e=Eo(t,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,c=>{s.push(c)});const l=s.reverse().find(c=>c.type.name===e.name);return l?{...l.attrs}:{}}function YM(n,t){const e=D0(typeof t=="string"?t:t.name,n.schema);return e==="node"?l7(n,t):e==="mark"?zM(n,t):{}}function c7(n,t=JSON.stringify){const e={};return n.filter(r=>{const i=t(r);return Object.prototype.hasOwnProperty.call(e,i)?!1:e[i]=!0})}function u7(n){const t=c7(n);return t.length===1?t:t.filter((e,r)=>!t.filter((i,s)=>s!==r).some(i=>e.oldRange.from>=i.oldRange.from&&e.oldRange.to<=i.oldRange.to&&e.newRange.from>=i.newRange.from&&e.newRange.to<=i.newRange.to))}function W5(n){const{mapping:t,steps:e}=n,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}=e[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}})})}),u7(r)}function X5(n,t,e){const r=[];return n===t?e.resolve(n).marks().forEach(i=>{const s=$5(e.resolve(n),i.type);s&&r.push({mark:i,...s})}):e.nodesBetween(n,t,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(l=>({from:s,to:s+i.nodeSize,mark:l})))}),r}const f7=(n,t,e,r=20)=>{const i=n.doc.resolve(e);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 Rd(n,t){return t.nodes[n]||t.marks[n]||null}function ug(n,t,e){return Object.fromEntries(Object.entries(e).filter(([r])=>{const i=n.find(s=>s.type===t&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}const d7=(n,t=500)=>{let e="";const r=n.parentOffset;return n.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%";e+=i.isAtom&&!i.isText?p:p.slice(0,Math.max(0,r-s))}),e};function Q2(n,t,e={}){const{empty:r,ranges:i}=n.selection,s=t?Tu(t,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(p=>s?s.name===p.type.name:!0).find(p=>Dg(p.attrs,e,{strict:!1}));let l=0;const c=[];if(i.forEach(({$from:p,$to:g})=>{const b=p.pos,y=g.pos;n.doc.nodesBetween(b,y,(M,C)=>{if(s&&M.inlineContent&&!M.type.allowsMarkType(s))return!1;if(!M.isText&&!M.marks.length)return;const L=Math.max(b,C),R=Math.min(y,C+M.nodeSize),B=R-L;l+=B,c.push(...M.marks.map(q=>({mark:q,from:L,to:R})))})}),l===0)return!1;const f=c.filter(p=>s?s.name===p.mark.type.name:!0).filter(p=>Dg(p.mark.attrs,e,{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 h7(n,t,e={}){if(!t)return xf(n,null,e)||Q2(n,null,e);const r=D0(t,n.schema);return r==="node"?xf(n,t,e):r==="mark"?Q2(n,t,e):!1}const p7=(n,t)=>{const{$from:e,$to:r,$anchor:i}=n.selection;if(t){const s=L0(c=>c.type.name===t)(n.selection);if(!s)return!1;const l=n.doc.resolve(s.pos+1);return i.pos+1===l.end()}return!(r.parentOffset<r.parent.nodeSize-2||e.pos!==r.pos)},m7=n=>{const{$from:t,$to:e}=n.selection;return!(t.parentOffset>0||t.pos!==e.pos)};function N3(n,t){return Array.isArray(t)?t.some(e=>(typeof e=="string"?e:e.name)===n.name):t}function Fy(n,t){const{nodeExtensions:e}=ih(t),r=e.find(s=>s.name===n);if(!r)return!1;const i=Fr(fn(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof i!="string"?!1:i.split(" ").includes("list")}function R0(n,{checkChildren:t=!0,ignoreWhitespace:e=!1}={}){if(e){if(n.type.name==="hardBreak")return!0;if(n.isText){var r;return!/\S/.test((r=n.text)!==null&&r!==void 0?r:"")}}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(t){let i=!0;return n.content.forEach(s=>{i!==!1&&(R0(s,{ignoreWhitespace:e,checkChildren:t})||(i=!1))}),i}return!1}function VM(n){return n instanceof kn}var WM=class XM{constructor(t){this.position=t}static fromJSON(t){return new XM(t.position)}toJSON(){return{position:this.position}}};function g7(n,t){const e=t.mapping.mapResult(n.position);return{position:new WM(e.pos),mapResult:e}}function y7(n){return new WM(n)}function b7(n,t,e){const{selection:r}=t;let i=null;if(DM(r)&&(i=r.$cursor),i){var s;const c=(s=n.storedMarks)!==null&&s!==void 0?s:i.marks();return i.parent.type.allowsMarkType(e)&&(!!e.isInSet(c)||!c.some(f=>f.type.excludes(e)))}const{ranges:l}=r;return l.some(({$from:c,$to:f})=>{let d=c.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(e):!1;return n.doc.nodesBetween(c.pos,f.pos,(p,g,b)=>{if(d)return!1;if(p.isInline){const y=!b||b.type.allowsMarkType(e),M=!!e.isInSet(p.marks)||!p.marks.some(C=>C.type.excludes(e));d=y&&M}return!d}),d})}const x7=(n,t={})=>({tr:e,state:r,dispatch:i})=>{const{selection:s}=e,{empty:l,ranges:c}=s,f=Tu(n,r.schema);if(i)if(l){const d=zM(r,f);e.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),C=Math.min(y+b.nodeSize,g);b.marks.find(L=>L.type===f)?b.marks.forEach(L=>{f===L.type&&e.addMark(M,C,f.create({...L.attrs,...t}))}):e.addMark(M,C,f.create(t))})});return b7(r,e,f)},v7=(n,t)=>({tr:e})=>(e.setMeta(n,t),!0),w7=(n,t={})=>({state:e,dispatch:r,chain:i})=>{const s=Eo(n,e.schema);let l;return e.selection.$anchor.sameParent(e.selection.$head)&&(l=e.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:c})=>$S(s,{...l,...t})(e)?!0:c.clearNodes()).command(({state:c})=>$S(s,{...l,...t})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},S7=n=>({tr:t,dispatch:e})=>{if(e){const{doc:r}=t,i=Vf(n,0,r.content.size),s=kn.create(r,i);t.setSelection(s)}return!0},k7=(n,t)=>({tr:e,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&&e.doc.nodesBetween(l,c,(f,d)=>{f.isText||e.setNodeMarkup(d,void 0,{...f.attrs,dir:n})}),!0},A7=n=>({tr:t,dispatch:e})=>{if(e){const{doc:r}=t,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,l=Ln.atStart(r).from,c=Ln.atEnd(r).to,f=Vf(i,l,c),d=Vf(s,l,c),p=Ln.create(r,f,d);t.setSelection(p)}return!0},M7=n=>({state:t,dispatch:e})=>{const r=Eo(n,t.schema);return bL(r)(t,e)};function _3(n,t){const e=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(e){const r=e.filter(i=>t?.includes(i.type.name));n.tr.ensureMarks(r)}}const C7=({keepMarks:n=!0}={})=>({tr:t,state:e,dispatch:r,editor:i})=>{const{selection:s,doc:l}=t,{$from:c,$to:f}=s,d=i.extensionManager.attributes,p=ug(d,c.node().type.name,c.node().attrs);if(s instanceof kn&&s.node.isBlock)return!c.parentOffset||!Mu(l,c.pos)?!1:(r&&(n&&_3(e,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:IM(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=g&&b?[{type:b,attrs:p}]:void 0,M=Mu(t.doc,t.mapping.map(c.pos),1,y);if(!y&&!M&&Mu(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 Ln&&t.deleteSelection(),t.split(t.mapping.map(c.pos),1,y),b&&!g&&!c.parentOffset&&c.parent.type!==b)){const C=t.mapping.map(c.before()),L=t.doc.resolve(C);c.node(-1).canReplaceWith(L.index(),L.index()+1,b)&&t.setNodeMarkup(t.mapping.map(c.before()),b)}n&&_3(e,i.extensionManager.splittableMarks),t.scrollIntoView()}return M},E7=(n,t={})=>({tr:e,state:r,dispatch:i,editor:s})=>{const l=Eo(n,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 R=Ae.empty;const B=c.index(-1)?1:c.index(-2)?2:3;for(let bt=c.depth-B;bt>=c.depth-3;bt-=1)R=Ae.from(c.node(bt).copy(R));const q=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,V={...ug(g,c.node().type.name,c.node().attrs),...t},gt=((b=l.contentMatch.defaultType)===null||b===void 0?void 0:b.createAndFill(V))||void 0;R=R.append(Ae.from(l.createAndFill(null,gt)||void 0));const Mt=c.before(c.depth-(B-1));e.replace(Mt,c.after(-q),new We(R,4-B,0));let kt=-1;e.doc.nodesBetween(Mt,e.doc.content.size,(bt,it)=>{if(kt>-1)return!1;bt.isTextblock&&bt.content.size===0&&(kt=it+1)}),kt>-1&&e.setSelection(Ln.near(e.doc.resolve(kt))),e.scrollIntoView()}return!0}const y=f.pos===c.end()?p.contentMatchAt(0).defaultType:null,M={...ug(g,p.type.name,p.attrs),...t},C={...ug(g,c.node().type.name,c.node().attrs),...t};e.delete(c.pos,f.pos);const L=y?[{type:l,attrs:M},{type:y,attrs:C}]:[{type:l,attrs:M}];if(!Mu(e.doc,c.pos,2))return!1;if(i){const{selection:R,storedMarks:B}=r,{splittableMarks:q}=s.extensionManager,V=B||R.$to.parentOffset&&R.$from.marks();if(e.split(c.pos,2,L).scrollIntoView(),!V||!i)return!0;const gt=V.filter(Mt=>q.includes(Mt.type.name));e.ensureMarks(gt)}return!0};function D3(n){return!n||n==="1"?null:n}function GM(n,t){return D3(n)===D3(t)}const Uy=(n,t)=>{const e=L0(s=>s.type===t)(n.selection);if(!e)return!0;const r=n.doc.resolve(Math.max(0,e.pos-1)).before(e.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return!(e.node.type===i?.type&&vf(n.doc,e.pos))||!GM(e.node.attrs.type,i?.attrs.type)||n.join(e.pos),!0},Hy=(n,t)=>{const e=L0(s=>s.type===t)(n.selection);if(!e)return!0;const r=n.doc.resolve(e.start).after(e.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return!(e.node.type===i?.type&&vf(n.doc,r))||!GM(e.node.attrs.type,i?.attrs.type)||n.join(r),!0};function T7(n){const t=n.doc,e=t.firstChild;if(!e)return null;const r=t.resolve(1),i=t.resolve(e.nodeSize-1);return Ln.between(r,i)}const N7=(n,t,e,r={})=>({editor:i,tr:s,state:l,dispatch:c,chain:f,commands:d,can:p})=>{const{extensions:g,splittableMarks:b}=i.extensionManager,y=Eo(n,l.schema),M=Eo(t,l.schema),{selection:C,storedMarks:L}=l,{$from:R,$to:B}=C,q=R.blockRange(B),V=L||C.$to.parentOffset&&C.$from.marks();if(!q)return!1;const gt=L0(G=>Fy(G.type.name,g))(C),Mt=C.from===0&&C.to===l.doc.content.size,kt=l.doc.content.content,bt=kt.length===1?kt[0]:null,it=Mt&&bt&&Fy(bt.type.name,g)?{node:bt,pos:0}:null,Lt=gt??it,J=!!gt&&q.depth>=1&&q.depth-gt.depth<=1,ct=!!it;if((J||ct)&&Lt){if(Lt.node.type===y)return Mt&&ct?f().command(({tr:G,dispatch:vt})=>{const _t=T7(G);return _t?(G.setSelection(_t),vt&&vt(G),!0):!1}).liftListItem(M).run():d.liftListItem(M);if(Fy(Lt.node.type.name,g)&&y.validContent(Lt.node.content))return f().command(()=>(s.setNodeMarkup(Lt.pos,y),!0)).command(()=>Uy(s,y)).command(()=>Hy(s,y)).run()}return!e||!V||!c?f().command(()=>p().wrapInList(y,r)?!0:d.clearNodes()).wrapInList(y,r).command(()=>Uy(s,y)).command(()=>Hy(s,y)).run():f().command(()=>{const G=p().wrapInList(y,r),vt=V.filter(_t=>b.includes(_t.type.name));return s.ensureMarks(vt),G?!0:d.clearNodes()}).wrapInList(y,r).command(()=>Uy(s,y)).command(()=>Hy(s,y)).run()},_7=(n,t={},e={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=e,l=Tu(n,r.schema);return Q2(r,l,t)?i.unsetMark(l,{extendEmptyMarkRange:s}):i.setMark(l,t)},D7=(n,t,e={})=>({state:r,commands:i})=>{const s=Eo(n,r.schema),l=Eo(t,r.schema),c=xf(r,s,e);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,...e})},L7=(n,t={})=>({state:e,commands:r})=>{const i=Eo(n,e.schema);return xf(e,i,t)?r.lift(i):r.wrapIn(i,t)},R7=()=>({state:n,dispatch:t})=>{const e=n.plugins;for(let r=0;r<e.length;r+=1){const i=e[r];let s;if(i.spec.isInputRules&&(s=i.getState(n))){if(t){const l=n.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,n.schema.text(s.text,f))}else l.delete(s.from,s.to)}return!0}}return!1},O7=(n={})=>({tr:t,dispatch:e,editor:r})=>{const{ignoreClearable:i=!1}=n,{selection:s}=t,{empty:l,ranges:c}=s;if(l)return!0;const{nonClearableMarks:f}=r.extensionManager;if(e){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},P7=(n,t={})=>({tr:e,state:r,dispatch:i})=>{const{extendEmptyMarkRange:s=!1}=t,{selection:l}=e,c=Tu(n,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=$5(f,c,(g=f.marks().find(C=>C.type===c))===null||g===void 0?void 0:g.attrs);M&&(b=M.from,y=M.to),e.removeMark(b,y,c)}else p.forEach(b=>{e.removeMark(b.$from.pos,b.$to.pos,c)});return e.removeStoredMark(c),!0},I7=n=>({tr:t,state:e,dispatch:r})=>{const{selection:i}=e;let s,l;return typeof n=="number"?(s=n,l=n):n&&"from"in n&&"to"in n?(s=n.from,l=n.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},j7=(n,t={})=>({tr:e,state:r,dispatch:i})=>{let s=null,l=null;const c=D0(typeof n=="string"?n:n.name,r.schema);if(!c)return!1;c==="node"&&(s=Eo(n,r.schema)),c==="mark"&&(l=Tu(n,r.schema));let f=!1;return e.selection.ranges.forEach(d=>{const p=d.$from.pos,g=d.$to.pos;let b,y,M,C;e.selection.empty?r.doc.nodesBetween(p,g,(L,R)=>{s&&s===L.type&&(f=!0,M=Math.max(R,p),C=Math.min(R+L.nodeSize,g),b=R,y=L)}):r.doc.nodesBetween(p,g,(L,R)=>{R<p&&s&&s===L.type&&(f=!0,M=Math.max(R,p),C=Math.min(R+L.nodeSize,g),b=R,y=L),R>=p&&R<=g&&(s&&s===L.type&&(f=!0,i&&e.setNodeMarkup(R,void 0,{...L.attrs,...t})),l&&L.marks.length&&L.marks.forEach(B=>{if(l===B.type&&(f=!0,i)){const q=Math.max(R,p),V=Math.min(R+L.nodeSize,g);e.addMark(q,V,l.create({...B.attrs,...t}))}}))}),y&&(b!==void 0&&i&&e.setNodeMarkup(b,void 0,{...y.attrs,...t}),l&&y.marks.length&&y.marks.forEach(L=>{l===L.type&&i&&e.addMark(M,C,l.create({...L.attrs,...t}))}))}),f},Hd=new To("__tiptap_decorations__"),z7=n=>({tr:t,dispatch:e})=>(e&&t.setMeta(Hd,{type:"force",name:n}),!0),B7=(n,t={})=>({state:e,dispatch:r})=>{const i=Eo(n,e.schema);return fL(i,t)(e,r)},F7=(n,t={})=>({state:e,dispatch:r})=>{const i=Eo(n,e.schema);return dL(i,t)(e,r)};var U7=rD({blur:()=>cO,clearContent:()=>uO,clearNodes:()=>fO,command:()=>dO,createParagraphNear:()=>hO,cut:()=>pO,deleteCurrentNode:()=>mO,deleteNode:()=>gO,deleteRange:()=>yO,deleteSelection:()=>vO,enter:()=>wO,exitCode:()=>SO,extendMarkRange:()=>kO,first:()=>AO,focus:()=>CO,forEach:()=>EO,insertContent:()=>TO,insertContentAt:()=>NO,insertDefaultBlock:()=>_O,joinBackward:()=>RO,joinDown:()=>LO,joinForward:()=>OO,joinItemBackward:()=>PO,joinItemForward:()=>IO,joinTextblockBackward:()=>jO,joinTextblockForward:()=>zO,joinUp:()=>DO,keyboardShortcut:()=>FO,lift:()=>UO,liftEmptyBlock:()=>HO,liftListItem:()=>qO,newlineInCode:()=>$O,resetAttributes:()=>YO,scrollIntoView:()=>VO,selectAll:()=>WO,selectNodeBackward:()=>XO,selectNodeForward:()=>GO,selectParentNode:()=>KO,selectTextblockEnd:()=>JO,selectTextblockStart:()=>ZO,setContent:()=>QO,setMark:()=>x7,setMeta:()=>v7,setNode:()=>w7,setNodeSelection:()=>S7,setTextDirection:()=>k7,setTextSelection:()=>A7,sinkListItem:()=>M7,splitBlock:()=>C7,splitListItem:()=>E7,toggleList:()=>N7,toggleMark:()=>_7,toggleNode:()=>D7,toggleWrap:()=>L7,undoInputRule:()=>R7,unsetAllMarks:()=>O7,unsetMark:()=>P7,unsetTextDirection:()=>I7,updateAttributes:()=>j7,updateDecorations:()=>z7,wrapIn:()=>B7,wrapInList:()=>F7});const Fh=new WeakMap;function H7(n,t){var e;Fh.set(n,((e=Fh.get(n))!==null&&e!==void 0?e:0)+1);try{return t()}finally{var r;const i=((r=Fh.get(n))!==null&&r!==void 0?r:1)-1;i>0?Fh.set(n,i):Fh.delete(n)}}var q7=class{constructor(){this.callbacks={}}on(n,t){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(t),this}emit(n,...t){const e=this.callbacks[n];return e&&e.forEach(r=>r.apply(this,t)),this}off(n,t){const e=this.callbacks[n];return e&&(t?this.callbacks[n]=e.filter(r=>r!==t):delete this.callbacks[n]),this}once(n,t){const e=(...r)=>{this.off(n,e),t.apply(this,r)};return this.on(n,e)}removeAllListeners(){this.callbacks={}}};function $7(n){return n.kind==="widget"}function KM(n,t){const e=[],r=new Set;for(const i of n)i.kind==="widget"&&$7(i)&&r.add(i.key),e.push(i.toPMDecoration(t));return{decorations:e,widgetKeys:r}}function Y7(n,t,e){const{decorations:r,widgetKeys:i}=KM(t,e);return{set:Qr.create(n,r),widgetKeys:i}}function JM({position:n,from:t,to:e,docSize:r}){return n<t?!1:n<e?!0:n===e&&e===r}function V7({decorations:n,from:t,to:e,docSize:r,extensionName:i,warnedExtensions:s}){return n.filter(l=>JM({position:l.anchor,from:t,to:e,docSize:r})?!0:(l.anchor===e||s.has(i)||(s.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${e}). It was ignored.`)),!1))}function W7(n){var t;const e=(t=n.spec)===null||t===void 0?void 0:t.key;return typeof e=="string"?e:void 0}function ZM(n){return n.jsonID==="attr"}function X7(n){let t=!1;if(n.getMap().forEach(()=>{t=!0}),t||ZM(n))return!0;const e=n;return typeof e.from=="number"&&typeof e.to=="number"}function G7(n,t){let e=null,r=0,i=0;for(let s=0;s<n.childCount&&!(i>t.to);s+=1){const l=i+n.child(s).nodeSize;l>=t.from&&(e===null&&(e=i),r=l),i=l}return e===null?null:{from:e,to:r}}function K7(n,t){if(n.steps.some(s=>!X7(s)))return{type:"full"};const e=W5(n).map(({newRange:s})=>s);n.steps.forEach((s,l)=>{if(!ZM(s))return;const c=n.mapping.slice(l);e.push({from:c.map(s.pos,-1),to:c.map(s.pos+1)})});const r=[];for(const s of e){const l=G7(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 QM(n,t,e,r){return n.map(t,e,{onRemove:i=>{const s=i?.key;typeof s=="string"&&r.delete(s)}})}function J7(n,t,e){var r,i;const s=(r=t.decorationSetsByExtension[n])!==null&&r!==void 0?r:Qr.empty,l=new Set((i=t.widgetKeysByExtension[n])!==null&&i!==void 0?i:[]);return{set:QM(s,e.mapping,e.doc,l),widgetKeys:l}}function L3(n,t){const e=Object.values(t).flatMap(r=>r.find());return Qr.create(n,e)}function R3(n){const t=new Set;for(const e of Object.values(n))for(const r of e)t.add(r);return t}function Z7(n,t){var e;switch((e=t.update)!==null&&e!==void 0?e:"document"){case"document":if(t.createInRange)throw new Error(`[tiptap error]: Extension "${n}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!t.createInRange)throw new Error(`[tiptap error]: Extension "${n}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(t.createInRange)throw new Error(`[tiptap error]: Extension "${n}" 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 "${n}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${n}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function Q7(n,t,e){return e?!0:n.update==="manual"?!1:n.shouldUpdate?n.shouldUpdate(t):t.tr.docChanged}const tP=new Set;var eP=class{constructor(n){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:t})=>{const e=Hd.getState(t);e&&this.warnDuplicateWidgetKeys(e)},this.editor=n.editor,this.entries=this.resolveEntries(n.entries),this.entries.forEach(({name:t,spec:e})=>Z7(t,e)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var n,t;return(n=(t=Hd.getState(this.editor.state))===null||t===void 0?void 0:t.widgetKeys)!==null&&n!==void 0?n:tP}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(n){const t=[];for(const{name:e,addDecorations:r}of n){const i=r();i&&t.push({name:e,spec:i})}return t}createPlugin(){const{editor:n,entries:t}=this;return new Fi({key:Hd,state:{init:(e,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:R3(s)};return this.warnDuplicateWidgetKeys(l),l},apply:(e,r,i,s)=>{const l=e.getMeta(Hd),c=l?.type==="force"&&!l.name,f=l?.type==="force"?l.name:void 0,d={},p={},g=new Set;return H7(n,()=>{for(const{name:b,spec:y}of t){const M=c||f===b;if(Q7(y,{editor:n,tr:e,oldState:i,newState:s},M))if(y.update==="changedRanges"&&e.docChanged&&!M){const C=this.applyChangedRangesRecompute(b,y,r,e,s);d[b]=C.set,p[b]=C.widgetKeys,g.add(b)}else{const{set:C,widgetKeys:L}=this.buildFullSet(b,y,s);d[b]=C,p[b]=L,g.add(b)}else{const C=J7(b,r,e);d[b]=C.set,p[b]=C.widgetKeys}}}),g.size===0&&!e.docChanged?r:{decorationSetsByExtension:d,widgetKeysByExtension:p,mergedDecorationSet:this.mergeAfterApply({entries:t,previous:r,tr:e,decorationSetsByExtension:d,recomputedNames:g}),widgetKeys:R3(p)}}},props:{decorations(e){var r,i;return(r=(i=Hd.getState(e))===null||i===void 0?void 0:i.mergedDecorationSet)!==null&&r!==void 0?r:Qr.empty}}})}applyChangedRangesRecompute(n,t,e,r,i){const s=K7(r,i.doc);return s.type==="full"?this.buildFullSet(n,t,i):this.rebuildRanges(n,t,e,r,i,s.ranges)}rebuildRanges(n,t,e,r,i,s){var l,c;const f=(l=e.decorationSetsByExtension[n])!==null&&l!==void 0?l:Qr.empty,d=new Set((c=e.widgetKeysByExtension[n])!==null&&c!==void 0?c:[]);let p=QM(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(R=>JM({position:R.from,from:b,to:y,docSize:g}));for(const R of M){const B=W7(R);B&&d.delete(B)}p=p.remove(M);const{decorations:C,widgetKeys:L}=KM(V7({decorations:this.runCreate(n,"createInRange",()=>t.createInRange({editor:this.editor,state:i,view:this.mountedView,from:b,to:y})),from:b,to:y,docSize:g,extensionName:n,warnedExtensions:this.warnedOutOfRangeExtensions}),n);p=p.add(i.doc,C);for(const R of L)d.add(R)}return{set:p,widgetKeys:d}}buildFullSet(n,t,e){const r=this.runCreate(n,"create",()=>t.create({editor:this.editor,state:e,view:this.mountedView}));return Y7(e.doc,r,n)}runCreate(n,t,e){try{return e()}catch(r){return console.error(`[tiptap error]: Extension "${n}" threw in \`addDecorations().${t}()\`. Its decorations were dropped for this update.`,r),[]}}warnDuplicateWidgetKeys(n){}buildMergedSet(n,t){const e=Object.keys(t);return e.length===1?t[e[0]]:L3(n,t)}mergeAfterApply({entries:n,previous:t,tr:e,decorationSetsByExtension:r,recomputedNames:i}){return n.length===1?r[n[0].name]:i.size===0?t.mergedDecorationSet.map(e.mapping,e.doc):L3(e.doc,r)}};function nP(n,t){const{selection:e}=n,{$from:r}=e;if(e instanceof kn){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 rP(n,t,e){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=n,document.getElementsByTagName("head")[0].appendChild(i),i}function iP(n){return typeof n=="number"}function oP(n){return Object.prototype.toString.call(n).slice(8,-1)}function Hm(n){return oP(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function O3(n,t,e){const r=n.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 C=[M];for(l+=1;l<r.length;){var f;const q=r[l];if(q.trim()===""){var d;const V=r.slice(l+1).findIndex(gt=>gt.trim()!=="");if(V===-1)break;if((((d=r[l+1+V].match(/^(\s*)/))===null||d===void 0||(d=d[1])===null||d===void 0?void 0:d.length)||0)>y){C.push(q),s=`${s}${q}
110
- `,l+=1;continue}else break}if((((f=q.match(/^(\s*)/))===null||f===void 0||(f=f[1])===null||f===void 0?void 0:f.length)||0)>y)C.push(q),s=`${s}${q}
111
- `,l+=1;else break}let L;const R=C.slice(1);if(R.length>0){const q=R.map(V=>V.slice(y+c)).join(`
112
- `);q.trim()&&(t.customNestedParser?L=t.customNestedParser(q):L=e.blockTokens(q))}const B=t.createToken(b,L);i.push(B)}if(i.length!==0)return{items:i,raw:s}}function tC(n,t,e,r,i){if(!n||!Array.isArray(n.content))return"";const s=typeof e=="function"?e(r):e,[l,...c]=n.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=L=>t.indent(L),C=y.split(`
113
- `).map(L=>M(L||"")).join(`
114
- `);f+=d.type==="paragraph"?`
115
-
116
- ${C}`:`
117
- ${C}`}}),f}function eC(n,t){const e={...n};return Hm(n)&&Hm(t)&&Object.keys(t).forEach(r=>{Hm(t[r])&&Hm(n[r])?e[r]=eC(n[r],t[r]):e[r]=t[r]}),e}function sP(n,t,e={}){const{state:r}=t,{doc:i,tr:s}=r,l=n;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(e).forEach(y=>{e[y]!==g.attrs[y]&&(b=!0)}),b){const y=n.type.create({...n.attrs,...e});s.removeMark(d,p,n.type),s.addMark(d,p,y)}}),s.docChanged&&t.view.dispatch(s)}var O0=class{constructor(n){var t;this.find=n.find,this.handler=n.handler,this.undoable=(t=n.undoable)!==null&&t!==void 0?t:!0}};const aP=(n,t)=>{if(q5(t))return t.exec(n);const e=t(n);if(!e)return null;const r=[e.text];return r.index=e.index,r.input=n,r.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(e.replaceWith)),r};function qm(n){var t;const{editor:e,from:r,to:i,text:s,rules:l,plugin:c}=n,{view:f}=e;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=d7(d)+s;return l.forEach(b=>{if(p)return;const y=aP(g,b.find);if(!y)return;const M=y[0].length-s.length;if(M>0){const gt=d.parentOffset-M;if(gt<0||d.parent.textBetween(gt,d.parentOffset)!==y[0].slice(0,M))return}const C=f.state.tr,L=_0({state:f.state,transaction:C}),R={from:r-(y[0].length-s.length),to:i},{commands:B,chain:q,can:V}=new Jd({editor:e,state:L});b.handler({state:L,range:R,match:y,commands:B,chain:q,can:V})===null||!C.steps.length||(b.undoable&&C.setMeta(c,{transform:C,from:r,to:i,text:s}),f.dispatch(C),p=!0)}),p}function lP(n){const{editor:t,rules:e}=n,r=new Fi({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=V5(Ae.from(d),l.schema);const{from:p}=f,g=p+d.length;qm({editor:t,from:p,to:g,text:d,rules:e,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,l,c){return qm({editor:t,from:s,to:l,text:c,rules:e,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&qm({editor:t,from:s.pos,to:s.pos,text:"",rules:e,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:l}=i.state.selection;return l?qm({editor:t,from:l.pos,to:l.pos,text:`
118
- `,rules:e,plugin:r}):!1}},isInputRules:!0});return r}var G5=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...Fr(fn(this,"addOptions",{name:this.name}))}}get storage(){return{...Fr(fn(this,"addStorage",{name:this.name,options:this.options}))}}configure(n={}){const t=this.extend({...this.config,addOptions:()=>eC(this.options,n)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(n={}){const t=new this.constructor({...this.config,...n});return t.parent=this,this.child=t,t.name="name"in n?n.name:t.parent.name,t}},Sf=class nC extends G5{constructor(...t){super(...t),this.type="mark"}static create(t={}){const e=typeof t=="function"?t():t;return new nC(e)}static handleExit({editor:t,mark:e}){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===e.name))return!1;const l=s.find(c=>c?.type.name===e.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 e=typeof t=="function"?t():t;return super.extend(e)}},cP=class{constructor(n){this.find=n.find,this.handler=n.handler}};const uP=(n,t,e)=>{if(q5(t))return[...n.matchAll(t)];const r=t(n,e);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,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 fP(n){const{editor:t,state:e,from:r,to:i,rule:s,pasteEvent:l,dropEvent:c}=n,{commands:f,chain:d,can:p}=new Jd({editor:t,state:e}),g=[];return e.doc.nodesBetween(r,i,(b,y)=>{var M,C,L,R;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 B=(C=(L=(R=b.content)===null||R===void 0?void 0:R.size)!==null&&L!==void 0?L:b.nodeSize)!==null&&C!==void 0?C:0,q=Math.max(r,y),V=Math.min(i,y+B);if(q>=V)return;const gt=b.isText?b.text||"":b.textBetween(q-y,V-y,void 0,"");uP(gt,s.find,l).forEach(Mt=>{if(Mt.index===void 0)return;const kt=q+Mt.index+1,bt=kt+Mt[0].length,it={from:e.tr.mapping.map(kt),to:e.tr.mapping.map(bt)},Lt=s.handler({state:e,range:it,match:Mt,commands:f,chain:d,can:p,pasteEvent:l,dropEvent:c});g.push(Lt)})}),g.every(b=>b!==null)}let $m=null;const dP=n=>{var t;const e=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=e.clipboardData)===null||t===void 0||t.setData("text/html",n),e};function hP(n){const{editor:t,rules:e}=n;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,C=_0({state:d,transaction:M});if(!(!fP({editor:t,state:C,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 e.map(d=>new Fi({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&&($m=t)},b=()=>{$m&&($m=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=$m;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,C=y.getMeta("uiEvent")==="drop"&&!s,L=y.getMeta("applyPasteRules"),R=!!L;if(!M&&!C&&!R)return;if(R){let{text:V}=L;typeof V=="string"?V=V:V=V5(Ae.from(V),b.schema);const{from:gt}=L,Mt=gt+V.length,kt=dP(V);return f({rule:d,state:b,from:gt,to:{b:Mt},pasteEvt:kt})}const B=g.doc.content.findDiffStart(b.doc.content),q=g.doc.content.findDiffEnd(b.doc.content);if(!(!iP(B)||!q||B===q.b))return f({rule:d,state:b,from:B,to:q,pasteEvt:l})}}))}var P0=class{constructor(n,t){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=t,this.baseExtensions=n,this.extensions=HM(n),this.schema=o7(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((n,t)=>{const e=fn(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Rd(t.name,this.schema)});return e?{...n,...e()}:n},{})}get plugins(){const{editor:n}=this,t=ap([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:Rd(r.name,this.schema)},s=[],l=fn(r,"addKeyboardShortcuts",i);let c={};if(r.type==="mark"&&fn(r,"exitable",i)&&(c.ArrowRight=()=>Sf.handleExit({editor:n,mark:r})),l){const b=Object.fromEntries(Object.entries(l()).map(([y,M])=>[y,()=>M({editor:n})]));c={...c,...b}}const f=lO(c);s.push(f);const d=fn(r,"addInputRules",i);if(N3(r,n.options.enableInputRules)&&d){const b=d();if(b&&b.length){const y=lP({editor:n,rules:b}),M=Array.isArray(y)?y:[y];s.push(...M)}}const p=fn(r,"addPasteRules",i);if(N3(r,n.options.enablePasteRules)&&p){const b=p();if(b&&b.length){const y=hP({editor:n,rules:b});s.push(...y)}}const g=fn(r,"addProseMirrorPlugins",i);if(g){const b=g();s.push(...b)}return s}),e=this.createDecorationPlugin();return e&&t.push(e),t}createDecorationPlugin(){var n;const{editor:t}=this;(n=this.decorationManager)===null||n===void 0||n.destroy();const e=[];return this.extensions.forEach(r=>{const i=fn(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Rd(r.name,this.schema)});i&&e.push({name:r.name,addDecorations:i})}),this.decorationManager=new eP({editor:t,entries:e}),this.decorationManager.plugin}get attributes(){return UM(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:t}=ih(this.extensions);return Object.fromEntries(t.filter(e=>!!fn(e,"addNodeView")).map(e=>{const r=this.attributes.filter(c=>c.type===e.name),i=fn(e,"addNodeView",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:n,type:Eo(e.name,this.schema)});if(!i)return[];const s=i();if(!s)return[];const l=(c,f,d,p,g)=>{const b=Ep(c,r);return s({node:c,view:f,getPos:d,decorations:p,innerDecorations:g,editor:n,extension:e,HTMLAttributes:b})};return[e.name,l]}))}dispatchTransaction(n){const{editor:t}=this;return ap([...this.extensions].reverse()).reduceRight((e,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Rd(r.name,this.schema)},s=fn(r,"dispatchTransaction",i);return s?l=>{s.call(i,{transaction:l,next:e})}:e},n)}transformPastedHTML(n){const{editor:t}=this;return ap([...this.extensions]).reduce((e,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Rd(r.name,this.schema)},s=fn(r,"transformPastedHTML",i);return s?(l,c)=>{const f=e(l,c);return s.call(i,f)}:e},n||(e=>e))}get markViews(){const{editor:n}=this,{markExtensions:t}=ih(this.extensions);return Object.fromEntries(t.filter(e=>!!fn(e,"addMarkView")).map(e=>{const r=this.attributes.filter(l=>l.type===e.name),i=fn(e,"addMarkView",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:n,type:Tu(e.name,this.schema)});if(!i)return[];const s=(l,c,f)=>{const d=Ep(l,r);return i()({mark:l,view:c,inline:f,editor:n,extension:e,HTMLAttributes:d,updateAttributes:p=>{sP(l,n,p)}})};return[e.name,s]}))}destroy(){var n;(n=this.decorationManager)===null||n===void 0||n.destroy(),this.extensions.forEach(t=>{let e=t;for(;e.parent;){const r=e.parent;r.child===e&&(r.child=null),e=r}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(t=>[t.name,t.storage])),n.forEach(t=>{const e={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Rd(t.name,this.schema)};if(t.type==="mark"){var r,i;(!((r=Fr(fn(t,"keepOnSplit",e)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(t.name),!((i=Fr(fn(t,"clearable",e)))!==null&&i!==void 0)||i||this.nonClearableMarks.push(t.name)}const s=fn(t,"onBeforeCreate",e),l=fn(t,"onCreate",e),c=fn(t,"onUpdate",e),f=fn(t,"onSelectionUpdate",e),d=fn(t,"onTransaction",e),p=fn(t,"onFocus",e),g=fn(t,"onBlur",e),b=fn(t,"onDestroy",e);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)})}};P0.resolve=HM;P0.sort=ap;P0.flatten=Y5;var ui=class rC extends G5{constructor(...t){super(...t),this.type="extension"}static create(t={}){const e=typeof t=="function"?t():t;return new rC(e)}configure(t){return super.configure(t)}extend(t){const e=typeof t=="function"?t():t;return super.extend(e)}};const pP=ui.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Fi({key:new To("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:t,schema:e}=n,{doc:r,selection:i}=t,s=$M(e),{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})=>qM(r,{from:f.pos,to:d.pos},c)).join(l??`
119
-
120
- `)}}})]}}),mP=ui.create({name:"commands",addCommands(){return{...U7}}}),gP=ui.create({name:"delete",onUpdate({transaction:n,appendedTransactions:t}){var e,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,n))!==null&&s!==void 0?s:n.getMeta("y-sync$"))return;const f=BM(n.before,[n,...t]);W5(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:n,combinedTransform:f})})});const d=f.mapping;f.steps.forEach((p,g)=>{if(p instanceof cc){var b,y;const M=d.slice(g).map(p.from,-1),C=d.slice(g).map(p.to),L=d.invert().map(M,-1),R=d.invert().map(C),B=M>0?(b=f.doc.nodeAt(M-1))===null||b===void 0?void 0:b.marks.some(V=>V.eq(p.mark)):!1,q=(y=f.doc.nodeAt(C))===null||y===void 0?void 0:y.marks.some(V=>V.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:L,to:R},newRange:{from:M,to:C},partial:!!(q||B),editor:this.editor,transaction:n,combinedTransform:f})}})};!((e=(r=this.editor.options.coreExtensionOptions)===null||r===void 0||(r=r.delete)===null||r===void 0?void 0:r.async)!==null&&e!==void 0)||e?setTimeout(i,0):i()}}),yP=ui.create({name:"drop",addProseMirrorPlugins(){return[new Fi({key:new To("tiptapDrop"),props:{handleDrop:(n,t,e,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:e,moved:r})}}})]}}),bP=ui.create({name:"editable",addProseMirrorPlugins(){return[new Fi({key:new To("editable"),props:{editable:()=>this.editor.options.editable}})]}}),xP=new To("focusEvents"),vP=ui.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Fi({key:xP,props:{handleDOMEvents:{focus:(t,e)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:e}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,e)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:e}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),wP=ui.create({name:"keymap",addKeyboardShortcuts(){const n=()=>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,C=M.parent.type.spec.isolating,L=g.pos-g.parentOffset,R=C&&M.parent.childCount===1?L===g.pos:er.atStart(d).from===b;return!p||!y.type.isTextblock||y.textContent.length||!R||R&&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:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"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 Lg()||jM()?s:i},addProseMirrorPlugins(){return[new Fi({key:new To("clearDocument"),appendTransaction:(n,t,e)=>{if(n.some(y=>y.getMeta("composition")))return;const r=n.some(y=>y.docChanged)&&!t.doc.eq(e.doc),i=n.some(y=>y.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:l,to:c}=t.selection,f=er.atStart(t.doc).from,d=er.atEnd(t.doc).to;if(s||!(l===f&&c===d)||!R0(e.doc))return;const p=e.tr,g=_0({state:e,transaction:p}),{commands:b}=new Jd({editor:this.editor,state:g});if(b.clearNodes(),!!p.steps.length)return p}})]}}),SP=ui.create({name:"paste",addProseMirrorPlugins(){return[new Fi({key:new To("tiptapPaste"),props:{handlePaste:(n,t,e)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:e})}}})]}}),kP=ui.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Fi({key:new To("tabindex"),props:{attributes:()=>{var n;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(n=this.options.value)!==null&&n!==void 0?n:"0"}}}})]}}),AP=ui.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=ih(this.extensions);return[{types:n.filter(t=>t.name!=="text").map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{const e=t.getAttribute("dir");return e&&(e==="ltr"||e==="rtl"||e==="auto")?e:this.options.direction},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return[new Fi({key:new To("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}});let P3=!1;function MP(n){if(P3)return;P3=!0;let t;try{t=uo.fromJSON(n,{from:0,to:0}).slice.content}catch{return}t instanceof Ae||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 CP=class Gh{get name(){return this.node.type.name}constructor(t,e,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,this.editor=e,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 e=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}e=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:e,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),e=this.resolvedPos.doc.resolve(t);return new Gh(e,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 Gh(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 Gh(t,this.editor)}get children(){const t=[];return this.node.content.forEach((e,r)=>{const i=e.isBlock&&!e.isTextblock,s=e.isAtom&&!e.isText,l=e.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 Gh(f,this.editor,i,i||l?e: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,e={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===t)if(Object.keys(e).length>0){const s=i.node.attrs,l=Object.keys(e);for(let c=0;c<l.length;c+=1){const f=l[c];if(s[f]!==e[f])break}}else r=i;i=i.parent}return r}querySelector(t,e={}){return this.querySelectorAll(t,e,!0)[0]||null}querySelectorAll(t,e={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(e);return this.children.forEach(l=>{r&&i.length>0||(l.node.type.name===t&&s.every(c=>e[c]===l.node.attrs[c])&&i.push(l),!(r&&i.length>0)&&(i=i.concat(l.querySelectorAll(t,e,r))))}),i}setAttribute(t){const{tr:e}=this.editor.state;e.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(e)}};const EP=`.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 TP=class extends q7{constructor(n={}){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:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:g7,createMappablePosition:y7},this.setOptions(n),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:e,slice:r,moved:i})=>this.options.onDrop(e,r,i)),this.on("paste",({event:e,slice:r})=>this.options.onPaste(e,r)),this.on("delete",this.options.onDelete);const t=this.createDoc();if(!this.editorState){const e=J2(t,this.options.autofocus);this.editorState=qf.create({doc:t,schema:this.schema,selection:e||void 0})}MP(this.schema),this.options.element&&this.mount(this.options.element)}mount(n){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(n),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 n=this.editorView.dom;n?.editor&&delete n.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(n){console.warn("Failed to remove CSS element:",n)}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():Jd.createFakeChain()}can(){return this.commandManager?this.commandManager.can():Jd.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=rP(EP,this.options.injectNonce))}setOptions(n={}){this.options={...this.options,...n},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(n,t=!0){this.setOptions({editable:n}),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:n=>{this.editorState=n},dispatch:n=>{this.dispatchTransaction(n)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(n,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in n)return Reflect.get(n,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(n,t){const e=FM(t)?t(n,[...this.state.plugins]):[...this.state.plugins,n],r=this.state.reconfigure({plugins:e});return this.view.updateState(r),r}unregisterPlugin(n){if(this.isDestroyed)return;const t=this.state.plugins;let e=t;if([].concat(n).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;e=e.filter(l=>!l.key.startsWith(s))}),t.length===e.length)return;const r=this.state.reconfigure({plugins:e});return this.view.updateState(r),r}createExtensionManager(){var n,t;const e=[...this.options.enableCoreExtensions?[bP,pP.configure({blockSeparator:(n=this.options.coreExtensionOptions)===null||n===void 0||(n=n.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),mP,vP,wP,kP.configure({value:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.tabindex)===null||t===void 0?void 0:t.value}),yP,SP,gP,AP.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 P0(e,this)}createCommandManager(){this.commandManager=new Jd({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=Z2(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 e=Z2(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=qf.create({doc:e,schema:this.schema,selection:J2(e,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 n}createView(n){const{editorProps:t,enableExtensionDispatchTransaction:e}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=e?this.extensionManager.dispatchTransaction(r):r,s=t.transformPastedHTML,l=this.extensionManager.transformPastedHTML(s);this.editorView=new EM(n,{...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(n){this.isCapturingTransaction=!0,n(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(n){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=n;return}n.steps.forEach(d=>{var p;return(p=this.capturedTransaction)===null||p===void 0?void 0:p.step(d)});return}const{state:t,transactions:e}=this.state.applyTransaction(n),r=!this.state.selection.eq(t.selection),i=e.includes(n),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:n,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:n,appendedTransactions:e.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:n});const l=e.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}),!(n.getMeta("preventUpdate")||!e.some(d=>d.docChanged)||s.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:n,appendedTransactions:e.slice(1)})}getAttributes(n){return YM(this.state,n)}isActive(n,t){const e=typeof n=="string"?n:null,r=typeof n=="string"?t:n;return h7(this.state,e,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return V5(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:t=`
191
-
192
- `,textSerializers:e={}}=n||{};return a7(this.state.doc,{blockSeparator:t,textSerializers:{...$M(this.schema),...e}})}get isEmpty(){return R0(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 n,t;return(n=(t=this.editorView)===null||t===void 0?void 0:t.isDestroyed)!==null&&n!==void 0?n:!0}$node(n,t){var e;return((e=this.$doc)===null||e===void 0?void 0:e.querySelector(n,t))||null}$nodes(n,t){var e;return((e=this.$doc)===null||e===void 0?void 0:e.querySelectorAll(n,t))||null}$pos(n){const t=this.state.doc.resolve(n),e=n>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new CP(t,this,!1,e)}get $doc(){return this.$pos(0)}};function oh(n){return new O0({find:n.find,handler:({state:t,range:e,match:r})=>{const i=Fr(n.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=e.from+c.indexOf(l),p=d+l.length;if(X5(e.from,e.to,t.doc).filter(b=>b.mark.type.excluded.find(y=>y===n.type&&y!==b.mark.type)).filter(b=>b.to>d).length)return null;p<e.to&&s.delete(p,e.to),d>e.from&&s.delete(e.from+f,d);const g=e.from+f+l.length;s.addMark(e.from+f,g,n.type.create(i||{})),s.removeStoredMark(n.type)}},undoable:n.undoable})}function NP(n){return new O0({find:n.find,handler:({state:t,range:e,match:r})=>{const i=Fr(n.getAttributes,void 0,r)||{},{tr:s}=t,l=e.from;let c=e.to;const f=n.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=n.type.isInline?l:l-1;s.insert(d,n.type.create(i)).delete(s.mapping.map(l),s.mapping.map(c))}s.scrollIntoView()},undoable:n.undoable})}function t5(n){return new O0({find:n.find,handler:({state:t,range:e,match:r})=>{const i=t.doc.resolve(e.from),s=Fr(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;t.tr.delete(e.from,e.to).setBlockType(e.from,e.from,n.type,s)},undoable:n.undoable})}function sh(n){return new O0({find:n.find,handler:({state:t,range:e,match:r,chain:i})=>{const s=Fr(n.getAttributes,void 0,r)||{},l=t.tr.delete(e.from,e.to),c=l.doc.resolve(e.from).blockRange(),f=c&&T5(c,n.type,s);if(!f)return null;if(l.wrap(c,f),n.keepMarks&&n.editor){const{selection:p,storedMarks:g}=t,{splittableMarks:b}=n.editor.extensionManager,y=g||p.$to.parentOffset&&p.$from.marks();if(y){const M=y.filter(C=>b.includes(C.type.name));l.ensureMarks(M)}}if(n.keepAttributes){const p=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(p,s).run()}const d=l.doc.resolve(e.from-1).nodeBefore;d&&d.type===n.type&&vf(l.doc,e.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&l.join(e.from-1)},undoable:n.undoable})}var ol=class iC extends G5{constructor(...t){super(...t),this.type="node"}static create(t={}){const e=typeof t=="function"?t():t;return new iC(e)}configure(t){return super.configure(t)}extend(t){const e=typeof t=="function"?t():t;return super.extend(e)}};function cd(n){return new cP({find:n.find,handler:({state:t,range:e,match:r,pasteEvent:i})=>{const s=Fr(n.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=e.to;if(c){const p=f.search(/\S/),g=e.from+f.indexOf(c),b=g+c.length;if(X5(e.from,e.to,t.doc).filter(y=>y.mark.type.excluded.find(M=>M===n.type&&M!==y.mark.type)).filter(y=>y.to>g).length)return null;b<e.to&&l.delete(b,e.to),g>e.from&&l.delete(e.from+p,g),d=e.from+p+c.length,l.addMark(e.from+p,d,n.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||l.removeStoredMark(n.type)}}})}const{getOwnPropertyNames:_P,getOwnPropertySymbols:DP}=Object,{hasOwnProperty:LP}=Object.prototype;function qy(n,t){return function(r,i,s){return n(r,i,s)&&t(r,i,s)}}function Ym(n){return function(e,r,i){if(!e||!r||typeof e!="object"||typeof r!="object")return n(e,r,i);const{cache:s}=i,l=s.get(e),c=s.get(r);if(l&&c)return l===r&&c===e;s.set(e,r),s.set(r,e);const f=n(e,r,i);return s.delete(e),s.delete(r),f}}function RP(n){return n?.[Symbol.toStringTag]}function I3(n){return _P(n).concat(DP(n))}const OP=Object.hasOwn||((n,t)=>LP.call(n,t));function pd(n,t){return n===t||!n&&!t&&n!==n&&t!==t}const PP="__v",IP="__o",jP="_owner",{getOwnPropertyDescriptor:j3,keys:z3}=Object;function zP(n,t){return n.byteLength===t.byteLength&&Rg(new Uint8Array(n),new Uint8Array(t))}function BP(n,t,e){let r=n.length;if(t.length!==r)return!1;for(;r-- >0;)if(!e.equals(n[r],t[r],r,r,n,t,e))return!1;return!0}function FP(n,t){return n.byteLength===t.byteLength&&Rg(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function UP(n,t){return pd(n.getTime(),t.getTime())}function HP(n,t){return n.name===t.name&&n.message===t.message&&n.cause===t.cause&&n.stack===t.stack}function qP(n,t){return n===t}function B3(n,t,e){const r=n.size;if(r!==t.size)return!1;if(!r)return!0;const i=new Array(r),s=n.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(e.equals(b[0],y[0],f,g,n,t,e)&&e.equals(b[1],y[1],b[0],y[0],n,t,e)){p=i[g]=!0;break}g++}if(!p)return!1;f++}return!0}const $P=pd;function YP(n,t,e){const r=z3(n);let i=r.length;if(z3(t).length!==i)return!1;for(;i-- >0;)if(!oC(n,t,e,r[i]))return!1;return!0}function Uh(n,t,e){const r=I3(n);let i=r.length;if(I3(t).length!==i)return!1;let s,l,c;for(;i-- >0;)if(s=r[i],!oC(n,t,e,s)||(l=j3(n,s),c=j3(t,s),(l||c)&&(!l||!c||l.configurable!==c.configurable||l.enumerable!==c.enumerable||l.writable!==c.writable)))return!1;return!0}function VP(n,t){return pd(n.valueOf(),t.valueOf())}function WP(n,t){return n.source===t.source&&n.flags===t.flags}function F3(n,t,e){const r=n.size;if(r!==t.size)return!1;if(!r)return!0;const i=new Array(r),s=n.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]&&e.equals(l.value,c.value,l.value,c.value,n,t,e)){d=i[p]=!0;break}p++}if(!d)return!1}return!0}function Rg(n,t){let e=n.byteLength;if(t.byteLength!==e||n.byteOffset!==t.byteOffset)return!1;for(;e-- >0;)if(n[e]!==t[e])return!1;return!0}function XP(n,t){return n.hostname===t.hostname&&n.pathname===t.pathname&&n.protocol===t.protocol&&n.port===t.port&&n.hash===t.hash&&n.username===t.username&&n.password===t.password}function oC(n,t,e,r){return(r===jP||r===IP||r===PP)&&(n.$$typeof||t.$$typeof)?!0:OP(t,r)&&e.equals(n[r],t[r],r,r,n,t,e)}const GP="[object ArrayBuffer]",KP="[object Arguments]",JP="[object Boolean]",ZP="[object DataView]",QP="[object Date]",tI="[object Error]",eI="[object Map]",nI="[object Number]",rI="[object Object]",iI="[object RegExp]",oI="[object Set]",sI="[object String]",aI={"[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},lI="[object URL]",cI=Object.prototype.toString;function uI({areArrayBuffersEqual:n,areArraysEqual:t,areDataViewsEqual:e,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(L,R,B){if(L===R)return!0;if(L==null||R==null)return!1;const q=typeof L;if(q!==typeof R)return!1;if(q!=="object")return q==="number"?c(L,R,B):q==="function"?s(L,R,B):!1;const V=L.constructor;if(V!==R.constructor)return!1;if(V===Object)return f(L,R,B);if(Array.isArray(L))return t(L,R,B);if(V===Date)return r(L,R,B);if(V===RegExp)return p(L,R,B);if(V===Map)return l(L,R,B);if(V===Set)return g(L,R,B);const gt=cI.call(L);if(gt===QP)return r(L,R,B);if(gt===iI)return p(L,R,B);if(gt===eI)return l(L,R,B);if(gt===oI)return g(L,R,B);if(gt===rI)return typeof L.then!="function"&&typeof R.then!="function"&&f(L,R,B);if(gt===lI)return y(L,R,B);if(gt===tI)return i(L,R,B);if(gt===KP)return f(L,R,B);if(aI[gt])return b(L,R,B);if(gt===GP)return n(L,R,B);if(gt===ZP)return e(L,R,B);if(gt===JP||gt===nI||gt===sI)return d(L,R,B);if(M){let Mt=M[gt];if(!Mt){const kt=RP(L);kt&&(Mt=M[kt])}if(Mt)return Mt(L,R,B)}return!1}}function fI({circular:n,createCustomConfig:t,strict:e}){let r={areArrayBuffersEqual:zP,areArraysEqual:e?Uh:BP,areDataViewsEqual:FP,areDatesEqual:UP,areErrorsEqual:HP,areFunctionsEqual:qP,areMapsEqual:e?qy(B3,Uh):B3,areNumbersEqual:$P,areObjectsEqual:e?Uh:YP,arePrimitiveWrappersEqual:VP,areRegExpsEqual:WP,areSetsEqual:e?qy(F3,Uh):F3,areTypedArraysEqual:e?qy(Rg,Uh):Rg,areUrlsEqual:XP,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),n){const i=Ym(r.areArraysEqual),s=Ym(r.areMapsEqual),l=Ym(r.areObjectsEqual),c=Ym(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:l,areSetsEqual:c})}return r}function dI(n){return function(t,e,r,i,s,l,c){return n(t,e,c)}}function hI({circular:n,comparator:t,createState:e,equals:r,strict:i}){if(e)return function(c,f){const{cache:d=n?new WeakMap:void 0,meta:p}=e();return t(c,f,{cache:d,equals:r,meta:p,strict:i})};if(n)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 pI=kf();kf({strict:!0});kf({circular:!0});kf({circular:!0,strict:!0});kf({createInternalComparator:()=>pd});kf({strict:!0,createInternalComparator:()=>pd});kf({circular:!0,createInternalComparator:()=>pd});kf({circular:!0,createInternalComparator:()=>pd,strict:!0});function kf(n={}){const{circular:t=!1,createInternalComparator:e,createState:r,strict:i=!1}=n,s=fI(n),l=uI(s),c=e?e(l):dI(l);return hI({circular:t,comparator:l,createState:r,equals:c,strict:i})}var $y={exports:{}},Yy={};var U3;function mI(){if(U3)return Yy;U3=1;var n=_p(),t=X4();function e(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var r=typeof Object.is=="function"?Object.is:e,i=t.useSyncExternalStore,s=n.useRef,l=n.useEffect,c=n.useMemo,f=n.useDebugValue;return Yy.useSyncExternalStoreWithSelector=function(d,p,g,b,y){var M=s(null);if(M.current===null){var C={hasValue:!1,value:null};M.current=C}else C=M.current;M=c(function(){function R(Mt){if(!B){if(B=!0,q=Mt,Mt=b(Mt),y!==void 0&&C.hasValue){var kt=C.value;if(y(kt,Mt))return V=kt}return V=Mt}if(kt=V,r(q,Mt))return kt;var bt=b(Mt);return y!==void 0&&y(kt,bt)?(q=Mt,kt):(q=Mt,V=bt)}var B=!1,q,V,gt=g===void 0?null:g;return[function(){return R(p())},gt===null?void 0:function(){return R(gt())}]},[p,g,b,y]);var L=i(d,M[0],M[1]);return l(function(){C.hasValue=!0,C.value=L},[L]),f(L),L},Yy}var H3;function gI(){return H3||(H3=1,$y.exports=mI()),$y.exports}var yI=gI(),bI=(...n)=>t=>{n.forEach(e=>{typeof e=="function"?e(t):e&&(e.current=t)})},xI=({contentComponent:n})=>{const t=G4.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return E.jsx(E.Fragment,{children:Object.values(t)})};function vI(){const n=new Set;let t={};return{subscribe(e){return n.add(e),()=>{n.delete(e)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(e,r){t={...t,[e]:eD.createPortal(r.reactElement,r.element,e)},n.forEach(i=>i())},removeRenderer(e){const r={...t};delete r[e],t=r,n.forEach(i=>i())}}}var wI=class extends zc.Component{constructor(n){var t;super(n),this.editorContentRef=zc.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((t=n.editor)!=null&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var n;const t=this.props.editor;if(t&&!t.isDestroyed&&((n=t.view.dom)!=null&&n.parentNode)){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:e}),t.contentComponent=vI(),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 n;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(!((n=t.view.dom)!=null&&n.parentNode))return;const e=document.createElement("div");e.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:e})}catch{}}}render(){const{editor:n,innerRef:t,...e}=this.props;return E.jsxs(E.Fragment,{children:[E.jsx("div",{ref:bI(t,this.editorContentRef),...e}),n?.contentComponent&&E.jsx(xI,{contentComponent:n.contentComponent})]})}},SI=H.forwardRef((n,t)=>{const e=zc.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return zc.createElement(wI,{key:e,innerRef:t,...n})}),sC=zc.memo(SI),kI=typeof window<"u"?H.useLayoutEffect:H.useEffect,AI=class{constructor(n){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=n,this.lastSnapshot={editor:n,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(n){return this.subscribers.add(n),()=>{this.subscribers.delete(n)}}watch(n){if(this.editor=n,this.editor){const t=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},e=this.editor;return e.on("transaction",t),()=>{e.off("transaction",t)}}}};function MI(n){var t;const[e]=H.useState(()=>new AI(n.editor)),r=yI.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getServerSnapshot,n.selector,(t=n.equalityFn)!=null?t:pI);return kI(()=>e.watch(n.editor),[n.editor,e]),H.useDebugValue(r),r}var CI=!1,e5=typeof window>"u",EI=e5||!!(typeof window<"u"&&window.next),TI=class aC{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(e=>e())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?e5||EI?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 TP(t)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}static compareOptions(t,e){return Object.keys(t).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&t.extensions&&e.extensions?t.extensions.length!==e.extensions.length?!1:t.extensions.every((i,s)=>{var l;return i===((l=e.extensions)==null?void 0:l[s])}):t[r]===e[r])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?aC.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,e=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===t){e&&e.setOptions(this.options.current);return}e&&!e.isDestroyed&&(e.destroy(),this.instanceId===t&&this.setEditor(null))},1)}};function NI(n={},t=[]){const e=H.useRef(n);e.current=n;const[r]=H.useState(()=>new TI(e)),i=G4.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return H.useDebugValue(i),H.useEffect(r.onRender(t)),MI({editor:i,selector:({transactionNumber:s})=>n.shouldRerenderOnTransaction===!1||n.shouldRerenderOnTransaction===void 0?null:n.immediatelyRender&&s===0?0:s+1}),i}var lC=H.createContext({editor:null});lC.Consumer;var _I=H.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),DI=()=>H.useContext(_I);zc.forwardRef((n,t)=>{const{onDragStart:e}=DI(),r=n.as||"div";return E.jsx(r,{...n,ref:t,"data-node-view-wrapper":"",onDragStart:e,style:{whiteSpace:"normal",...n.style}})});zc.createContext({markViewContentRef:()=>{}});var K5=H.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});K5.displayName="TiptapContext";var LI=()=>H.useContext(K5);function cC({editor:n,instance:t,children:e}){const r=n??t;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=H.useMemo(()=>({editor:r}),[r]),s=H.useMemo(()=>({editor:r}),[r]);return E.jsx(lC.Provider,{value:s,children:E.jsx(K5.Provider,{value:i,children:e})})}cC.displayName="Tiptap";function uC({...n}){const{editor:t}=LI();return E.jsx(sC,{editor:t,...n})}uC.displayName="Tiptap.Content";Object.assign(cC,{Content:uC});const fC=new WeakSet,dC=new WeakSet;function Of(n){const t=n;return fC.add(t),t}function n5(n){return Array.isArray(n)&&fC.has(n)}function hC(n){return n.flatMap(t=>t==null?[]:Array.isArray(t)&&dC.has(t)&&!n5(t)?hC(t):[t])}function RI(n,t){if(n==="slot")return 0;if(n instanceof Function){const i=n(t);return Array.isArray(i)&&!n5(i)&&!dC.has(i)?Of(i):i}const{children:e,...r}=t??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(e)){if(n5(e))return Of([n,r,e]);if(e.length===0)return Of([n,r]);const i=hC(e);return i.length===0?Of([n,r]):Of([n,r,...i])}return e!=null?Of([n,r,e]):Of([n,r])}const Og=(n,t)=>RI(n,t);var OI=/^\s*>\s$/,PI=ol.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Og("blockquote",{...mo(this.options.HTMLAttributes,n),children:Og("slot",{})})},parseMarkdown:(n,t)=>t.createNode("blockquote",void 0,t.parseChildren(n.tokens||[])),renderMarkdown:(n,t)=>{if(!n.content)return"";const e=">",r=[];return n.content.forEach(i=>{const c=t.renderChildren([i]).split(`
193
- `).map(f=>f.trim()===""?e:`${e} ${f}`);r.push(c.join(`
194
- `))}),r.join(`
195
- ${e}
196
- `)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[sh({find:OI,type:this.type})]}}),II=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,jI=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,zI=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,BI=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,FI=Sf.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return Og("strong",{...mo(this.options.HTMLAttributes,n),children:Og("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,t)=>t.applyMark("bold",t.parseInline(n.tokens||[])),renderMarkdown:(n,t)=>`**${t.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[oh({find:II,type:this.type}),oh({find:zI,type:this.type})]},addPasteRules(){return[cd({find:jI,type:this.type}),cd({find:BI,type:this.type})]}}),UI=/(^|[^`])`([^`]+)`(?!`)$/,HI=/(^|[^`])`([^`]+)`(?!`)/g,qI=Sf.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",mo(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,t)=>t.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,t)=>n.content?`\`${t.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[oh({find:UI,type:this.type})]},addPasteRules(){return[cd({find:HI,type:this.type})]}}),Vy=4,$I=/^```([a-z]+)?[\s\n]$/,YI=/^~~~([a-z]+)?[\s\n]$/,VI=ol.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Vy,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var t;const{languageClassPrefix:e}=this.options;if(!e)return null;const s=[...((t=n.firstElementChild)==null?void 0:t.classList)||[]].filter(l=>l.startsWith(e)).map(l=>l.replace(e,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:t}){return["pre",mo(this.options.HTMLAttributes,t),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,t)=>{var e,r;return((e=n.raw)==null?void 0:e.startsWith("```"))===!1&&((r=n.raw)==null?void 0:r.startsWith("~~~"))===!1&&n.codeBlockStyle!=="indented"?[]:t.createNode("codeBlock",{language:n.lang||null},n.text?[t.createTextNode(n.text)]:[])},renderMarkdown:(n,t)=>{var e;let r="";const i=((e=n.attrs)==null?void 0:e.language)||"";return n.content?r=[`\`\`\`${i}`,t.renderChildren(n.content),"```"].join(`
197
- `):r=`\`\`\`${i}
198
-
199
- \`\`\``,r},addCommands(){return{setCodeBlock:n=>({commands:t})=>t.setNode(this.name,n),toggleCodeBlock:n=>({commands:t})=>t.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:t}=this.editor.state.selection,e=t.pos===1;return!n||t.parent.type.name!==this.name?!1:e||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var t;if(!this.options.enableTabIndentation)return!1;const e=(t=this.options.tabSize)!=null?t:Vy,{state:r}=n,{selection:i}=r,{$from:s,empty:l}=i;if(s.parent.type!==this.type)return!1;const c=" ".repeat(e);return l?n.commands.insertContent(c):n.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:n})=>{var t;if(!this.options.enableTabIndentation)return!1;const e=(t=this.options.tabSize)!=null?t:Vy,{state:r}=n,{selection:i}=r,{$from:s,empty:l}=i;return s.parent.type!==this.type?!1:l?n.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,C=0;const L=d-p;for(let Mt=0;Mt<y.length;Mt+=1){if(C+y[Mt].length>=L){M=Mt;break}C+=y[Mt].length+1}const B=((f=y[M].match(/^ */))==null?void 0:f[0])||"",q=Math.min(B.length,e);if(q===0)return!0;let V=p;for(let Mt=0;Mt<M;Mt+=1)V+=y[Mt].length+1;return c.delete(V,V+q),d-V<=q&&c.setSelection(Ln.create(c.doc,V)),!0}):n.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 C=((M=y.match(/^ */))==null?void 0:M[0])||"",L=Math.min(C.length,e);return y.slice(L)}).join(`
210
- `);return c.replaceWith(f,d,r.schema.text(b)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=n,{selection:e}=t,{$from:r,empty:i}=e;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:n.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=n,{selection:e,doc:r}=t,{$from:i,empty:s}=e;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)?n.commands.command(({tr:d})=>(d.setSelection(er.near(r.resolve(c))),!0)):n.commands.exitCode()}}},addInputRules(){return[t5({find:$I,type:this.type,getAttributes:n=>({language:n[1]})}),t5({find:YI,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Fi({key:new To("codeBlockVSCodeHandler"),props:{handlePaste:(n,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const e=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!e||!s)return!1;const{tr:l,schema:c}=n.state,f=c.text(e.replace(/\r\n?/g,`
213
- `));return l.replaceSelectionWith(this.type.create({language:s},f)),l.selection.$from.parent.type!==this.type&&l.setSelection(Ln.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),n.dispatch(l),!0}}})]}}),WI=ol.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,t)=>n.content?t.renderChildren(n.content,`
214
-
215
- `):""}),XI=ol.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",mo(this.options.HTMLAttributes,n)]},renderText(){return`
216
- `},renderMarkdown:()=>`
217
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:t,state:e,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=e;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()}}}),GI=ol.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(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:t}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,mo(this.options.HTMLAttributes,t),0]},parseMarkdown:(n,t)=>t.createNode("heading",{level:n.depth||1},t.parseInline(n.tokens||[])),renderMarkdown:(n,t)=>{var e;const r=(e=n.attrs)!=null&&e.level?parseInt(n.attrs.level,10):1,i="#".repeat(r);return n.content?`${i} ${t.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:t})=>this.options.levels.includes(n.level)?t.setNode(this.name,n):!1,toggleHeading:n=>({commands:t})=>this.options.levels.includes(n.level)?t.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,t)=>({...n,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(n=>t5({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),KI=ol.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",mo(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:t})=>{if(!nP(t,t.schema.nodes[this.name]))return!1;const{selection:e}=t,{$to:r}=e,i=n();return VM(e)?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(Ln.create(l.doc,f.pos+1)):f.nodeAfter.isBlock?l.setSelection(kn.create(l.doc,f.pos)):l.setSelection(Ln.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(Ln.create(l.doc,d+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[NP({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),JI=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,ZI=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,QI=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,tj=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,ej=Sf.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",mo(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,t)=>t.applyMark("italic",t.parseInline(n.tokens||[])),renderMarkdown:(n,t)=>`*${t.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[oh({find:JI,type:this.type}),oh({find:QI,type:this.type})]},addPasteRules(){return[cd({find:ZI,type:this.type}),cd({find:tj,type:this.type})]}});const nj="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",rj="ελ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",i5="ascii",o5="alpha",lp="asciinumeric",Kh="alphanumeric",s5="domain",pC="emoji",ij="scheme",oj="slashscheme",Wy="whitespace";function sj(n,t){return n in t||(t[n]=[]),t[n]}function Wf(n,t,e){t[r5]&&(t[lp]=!0,t[Kh]=!0),t[i5]&&(t[lp]=!0,t[o5]=!0),t[lp]&&(t[Kh]=!0),t[o5]&&(t[Kh]=!0),t[Kh]&&(t[s5]=!0),t[pC]&&(t[s5]=!0);for(const r in t){const i=sj(r,e);i.indexOf(n)<0&&i.push(n)}}function aj(n,t){const e={};for(const r in t)t[r].indexOf(n)>=0&&(e[r]=!0);return e}function Pa(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Pa.groups={};Pa.prototype={accepts(){return!!this.t},go(n){const t=this,e=t.j[n];if(e)return e;for(let r=0;r<t.jr.length;r++){const i=t.jr[r][0],s=t.jr[r][1];if(s&&i.test(n))return s}return t.jd},has(n,t=!1){return t?n in this.j:!!this.go(n)},ta(n,t,e,r){for(let i=0;i<n.length;i++)this.tt(n[i],t,e,r)},tr(n,t,e,r){r=r||Pa.groups;let i;return t&&t.j?i=t:(i=new Pa(t),e&&r&&Wf(t,e,r)),this.jr.push([n,i]),i},ts(n,t,e,r){let i=this;const s=n.length;if(!s)return i;for(let l=0;l<s-1;l++)i=i.tt(n[l]);return i.tt(n[s-1],t,e,r)},tt(n,t,e,r){r=r||Pa.groups;const i=this;if(t&&t.j)return i.j[n]=t,t;const s=t;let l,c=i.go(n);if(c?(l=new Pa,Object.assign(l.j,c.j),l.jr.push.apply(l.jr,c.jr),l.jd=c.jd,l.t=c.t):l=new Pa,s){if(r)if(l.t&&typeof l.t=="string"){const f=Object.assign(aj(l.t,r),e);Wf(s,f,r)}else e&&Wf(s,e,r);l.t=s}return i.j[n]=l,l}};const tr=(n,t,e,r,i)=>n.ta(t,e,r,i),Zi=(n,t,e,r,i)=>n.tr(t,e,r,i),q3=(n,t,e,r,i)=>n.ts(t,e,r,i),_e=(n,t,e,r,i)=>n.tt(t,e,r,i),vu="WORD",a5="UWORD",mC="ASCIINUMERICAL",gC="ALPHANUMERICAL",Tp="LOCALHOST",l5="TLD",c5="UTLD",fg="SCHEME",qd="SLASH_SCHEME",J5="NUM",u5="WS",Z5="NL",cp="OPENBRACE",up="CLOSEBRACE",Pg="OPENBRACKET",Ig="CLOSEBRACKET",jg="OPENPAREN",zg="CLOSEPAREN",Bg="OPENANGLEBRACKET",Fg="CLOSEANGLEBRACKET",Ug="FULLWIDTHLEFTPAREN",Hg="FULLWIDTHRIGHTPAREN",qg="LEFTCORNERBRACKET",$g="RIGHTCORNERBRACKET",Yg="LEFTWHITECORNERBRACKET",Vg="RIGHTWHITECORNERBRACKET",Wg="FULLWIDTHLESSTHAN",Xg="FULLWIDTHGREATERTHAN",Gg="AMPERSAND",Kg="APOSTROPHE",Jg="ASTERISK",rf="AT",Zg="BACKSLASH",Qg="BACKTICK",t0="CARET",af="COLON",Q5="COMMA",e0="DOLLAR",Oc="DOT",n0="EQUALS",tb="EXCLAMATION",Ol="HYPHEN",fp="PERCENT",r0="PIPE",i0="PLUS",o0="POUND",dp="QUERY",eb="QUOTE",yC="FULLWIDTHMIDDLEDOT",nb="SEMI",Pc="SLASH",hp="TILDE",s0="UNDERSCORE",bC="EMOJI",a0="SYM";var xC=Object.freeze({__proto__:null,ALPHANUMERICAL:gC,AMPERSAND:Gg,APOSTROPHE:Kg,ASCIINUMERICAL:mC,ASTERISK:Jg,AT:rf,BACKSLASH:Zg,BACKTICK:Qg,CARET:t0,CLOSEANGLEBRACKET:Fg,CLOSEBRACE:up,CLOSEBRACKET:Ig,CLOSEPAREN:zg,COLON:af,COMMA:Q5,DOLLAR:e0,DOT:Oc,EMOJI:bC,EQUALS:n0,EXCLAMATION:tb,FULLWIDTHGREATERTHAN:Xg,FULLWIDTHLEFTPAREN:Ug,FULLWIDTHLESSTHAN:Wg,FULLWIDTHMIDDLEDOT:yC,FULLWIDTHRIGHTPAREN:Hg,HYPHEN:Ol,LEFTCORNERBRACKET:qg,LEFTWHITECORNERBRACKET:Yg,LOCALHOST:Tp,NL:Z5,NUM:J5,OPENANGLEBRACKET:Bg,OPENBRACE:cp,OPENBRACKET:Pg,OPENPAREN:jg,PERCENT:fp,PIPE:r0,PLUS:i0,POUND:o0,QUERY:dp,QUOTE:eb,RIGHTCORNERBRACKET:$g,RIGHTWHITECORNERBRACKET:Vg,SCHEME:fg,SEMI:nb,SLASH:Pc,SLASH_SCHEME:qd,SYM:a0,TILDE:hp,TLD:l5,UNDERSCORE:s0,UTLD:c5,UWORD:a5,WORD:vu,WS:u5});const yu=/[a-z]/,Hh=new RegExp("\\p{L}","u"),Xy=new RegExp("\\p{Emoji}","u"),bu=/\d/,Gy=/\s/,$3="\r",Ky=`
218
- `,lj="️",cj="‍",Jy="";let Vm=null,Wm=null;function uj(n=[]){const t={};Pa.groups=t;const e=new Pa;Vm==null&&(Vm=Y3(nj)),Wm==null&&(Wm=Y3(rj)),_e(e,"'",Kg),_e(e,"{",cp),_e(e,"}",up),_e(e,"[",Pg),_e(e,"]",Ig),_e(e,"(",jg),_e(e,")",zg),_e(e,"<",Bg),_e(e,">",Fg),_e(e,"(",Ug),_e(e,")",Hg),_e(e,"「",qg),_e(e,"」",$g),_e(e,"『",Yg),_e(e,"』",Vg),_e(e,"<",Wg),_e(e,">",Xg),_e(e,"&",Gg),_e(e,"*",Jg),_e(e,"@",rf),_e(e,"`",Qg),_e(e,"^",t0),_e(e,":",af),_e(e,",",Q5),_e(e,"$",e0),_e(e,".",Oc),_e(e,"=",n0),_e(e,"!",tb),_e(e,"-",Ol),_e(e,"%",fp),_e(e,"|",r0),_e(e,"+",i0),_e(e,"#",o0),_e(e,"?",dp),_e(e,'"',eb),_e(e,"/",Pc),_e(e,";",nb),_e(e,"~",hp),_e(e,"_",s0),_e(e,"\\",Zg),_e(e,"・",yC);const r=Zi(e,bu,J5,{[r5]:!0});Zi(r,bu,r);const i=Zi(r,yu,mC,{[lp]:!0}),s=Zi(r,Hh,gC,{[Kh]:!0}),l=Zi(e,yu,vu,{[i5]:!0});Zi(l,bu,i),Zi(l,yu,l),Zi(i,bu,i),Zi(i,yu,i);const c=Zi(e,Hh,a5,{[o5]:!0});Zi(c,yu),Zi(c,bu,s),Zi(c,Hh,c),Zi(s,bu,s),Zi(s,yu),Zi(s,Hh,s);const f=_e(e,Ky,Z5,{[Wy]:!0}),d=_e(e,$3,u5,{[Wy]:!0}),p=Zi(e,Gy,u5,{[Wy]:!0});_e(e,Jy,p),_e(d,Ky,f),_e(d,Jy,p),Zi(d,Gy,p),_e(p,$3),_e(p,Ky),Zi(p,Gy,p),_e(p,Jy,p);const g=Zi(e,Xy,bC,{[pC]:!0});_e(g,"#"),Zi(g,Xy,g),_e(g,lj,g);const b=_e(g,cj);_e(b,"#"),Zi(b,Xy,g);const y=[[yu,l],[bu,i]],M=[[yu,null],[Hh,c],[bu,s]];for(let C=0;C<Vm.length;C++)Ku(e,Vm[C],l5,vu,y);for(let C=0;C<Wm.length;C++)Ku(e,Wm[C],c5,a5,M);Wf(l5,{tld:!0,ascii:!0},t),Wf(c5,{utld:!0,alpha:!0},t),Ku(e,"file",fg,vu,y),Ku(e,"mailto",fg,vu,y),Ku(e,"http",qd,vu,y),Ku(e,"https",qd,vu,y),Ku(e,"ftp",qd,vu,y),Ku(e,"ftps",qd,vu,y),Wf(fg,{scheme:!0,ascii:!0},t),Wf(qd,{slashscheme:!0,ascii:!0},t),n=n.sort((C,L)=>C[0]>L[0]?1:-1);for(let C=0;C<n.length;C++){const L=n[C][0],B=n[C][1]?{[ij]:!0}:{[oj]:!0};L.indexOf("-")>=0?B[s5]=!0:yu.test(L)?bu.test(L)?B[lp]=!0:B[i5]=!0:B[r5]=!0,q3(e,L,L,B)}return q3(e,"localhost",Tp,{ascii:!0}),e.jd=new Pa(a0),{start:e,tokens:Object.assign({groups:t},xC)}}function vC(n,t){const e=fj(t.replace(/[A-Z]/g,c=>c.toLowerCase())),r=e.length,i=[];let s=0,l=0;for(;l<r;){let c=n,f=null,d=0,p=null,g=-1,b=-1;for(;l<r&&(f=c.go(e[l]));)c=f,c.accepts()?(g=0,b=0,p=c):g>=0&&(g+=e[l].length,b++),d+=e[l].length,s+=e[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 fj(n){const t=[],e=n.length;let r=0;for(;r<e;){let i=n.charCodeAt(r),s,l=i<55296||i>56319||r+1===e||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);t.push(l),r+=l.length}return t}function Ku(n,t,e,r,i){let s;const l=t.length;for(let c=0;c<l-1;c++){const f=t[c];n.j[f]?s=n.j[f]:(s=new Pa(r),s.jr=i.slice(),n.j[f]=s),n=s}return s=new Pa(e),s.jr=i.slice(),n.j[t[l-1]]=s,s}function Y3(n){const t=[],e=[];let r=0,i="0123456789";for(;r<n.length;){let s=0;for(;i.indexOf(n[r+s])>=0;)s++;if(s>0){t.push(e.join(""));for(let l=parseInt(n.substring(r,r+s),10);l>0;l--)e.pop();r+=s}else e.push(n[r]),r++}return t}const Np={defaultProtocol:"http",events:null,format:V3,formatHref:V3,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function rb(n,t=null){let e=Object.assign({},Np);n&&(e=Object.assign(e,n instanceof rb?n.o:n));const r=e.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=e,t&&(this.defaultRender=t),this.ignoreTags=i}rb.prototype={o:Np,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,t,e){const r=t!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=e.t in i?i[e.t]:Np[n],typeof i=="function"&&r&&(i=i(t,e))):typeof i=="function"&&r&&(i=i(t,e.t,e)),i)},getObj(n,t,e){let r=this.o[n];return typeof r=="function"&&t!=null&&(r=r(t,e.t,e)),r},render(n){const t=n.render(this);return(this.get("render",null,n)||this.defaultRender)(t,n.t,n)}};function V3(n){return n}function wC(n,t){this.t="token",this.v=n,this.tk=t}wC.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const t=this.toString(),e=n.get("truncate",t,this),r=n.get("format",t,this);return e&&r.length>e?r.substring(0,e)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Np.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const t=this,e=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",e,this),i=n.get("tagName",e,t),s=this.toFormattedString(n),l={},c=n.get("className",e,t),f=n.get("target",e,t),d=n.get("rel",e,t),p=n.getObj("attributes",e,t),g=n.getObj("events",e,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 I0(n,t){class e extends wC{constructor(i,s){super(i,s),this.t=n}}for(const r in t)e.prototype[r]=t[r];return e.t=n,e}const W3=I0("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),X3=I0("text"),dj=I0("nl"),Xm=I0("url",{isLink:!0,toHref(n=Np.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Tp&&n[1].t===af}}),Dl=n=>new Pa(n);function hj({groups:n}){const t=n.domain.concat([Gg,Jg,rf,Zg,Qg,t0,e0,n0,Ol,J5,fp,r0,i0,o0,Pc,a0,hp,s0]),e=[Kg,af,Q5,Oc,tb,fp,dp,eb,nb,Bg,Fg,cp,up,Ig,Pg,jg,zg,Ug,Hg,qg,$g,Yg,Vg,Wg,Xg],r=[Gg,Kg,Jg,Zg,Qg,t0,e0,n0,Ol,cp,up,fp,r0,i0,o0,dp,Pc,a0,hp,s0],i=Dl(),s=_e(i,hp);tr(s,r,s),tr(s,n.domain,s);const l=Dl(),c=Dl(),f=Dl();tr(i,n.domain,l),tr(i,n.scheme,c),tr(i,n.slashscheme,f),tr(l,r,s),tr(l,n.domain,l);const d=_e(l,rf);_e(s,rf,d),_e(c,rf,d),_e(f,rf,d);const p=_e(s,Oc);tr(p,r,s),tr(p,n.domain,s);const g=Dl();tr(d,n.domain,g),tr(g,n.domain,g);const b=_e(g,Oc);tr(b,n.domain,g);const y=Dl(W3);tr(b,n.tld,y),tr(b,n.utld,y),_e(d,Tp,y);const M=_e(g,Ol);_e(M,Ol,M),tr(M,n.domain,g),tr(y,n.domain,g),_e(y,Oc,b),_e(y,Ol,M);const C=_e(y,af);tr(C,n.numeric,W3);const L=_e(l,Ol),R=_e(l,Oc);_e(L,Ol,L),tr(L,n.domain,l),tr(R,r,s),tr(R,n.domain,l);const B=Dl(Xm);tr(R,n.tld,B),tr(R,n.utld,B),tr(B,n.domain,l),tr(B,r,s),_e(B,Oc,R),_e(B,Ol,L),_e(B,rf,d);const q=_e(B,af),V=Dl(Xm);tr(q,n.numeric,V);const gt=Dl(Xm),Mt=Dl();tr(gt,t,gt),tr(gt,e,Mt),tr(Mt,t,gt),tr(Mt,e,Mt),_e(B,Pc,gt),_e(V,Pc,gt);const kt=_e(c,af),bt=_e(f,af),it=_e(bt,Pc),Lt=_e(it,Pc);tr(c,n.domain,l),_e(c,Oc,R),_e(c,Ol,L),tr(f,n.domain,l),_e(f,Oc,R),_e(f,Ol,L),tr(kt,n.domain,gt),_e(kt,Pc,gt),_e(kt,dp,gt),tr(Lt,n.domain,gt),tr(Lt,t,gt),_e(Lt,Pc,gt);const J=[[cp,up],[Pg,Ig],[jg,zg],[Bg,Fg],[Ug,Hg],[qg,$g],[Yg,Vg],[Wg,Xg]];for(let ct=0;ct<J.length;ct++){const[G,vt]=J[ct],_t=_e(gt,G);_e(Mt,G,_t),_e(_t,vt,gt);const ht=Dl(Xm);tr(_t,t,ht);const Z=Dl();tr(_t,e),tr(ht,t,ht),tr(ht,e,Z),tr(Z,t,ht),tr(Z,e,Z),_e(ht,vt,gt),_e(Z,vt,gt)}return _e(i,Tp,B),_e(i,Z5,dj),{start:i,tokens:xC}}function pj(n,t,e){let r=e.length,i=0,s=[],l=[];for(;i<r;){let c=n,f=null,d=null,p=0,g=null,b=-1;for(;i<r&&!(f=c.go(e[i].t));)l.push(e[i++]);for(;i<r&&(d=f||c.go(e[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(e[i]),i++);else{l.length>0&&(s.push(Zy(X3,t,l)),l=[]),i-=b,p-=b;const y=g.t,M=e.slice(i-p,i);s.push(Zy(y,t,M))}}return l.length>0&&s.push(Zy(X3,t,l)),s}function Zy(n,t,e){const r=e[0].s,i=e[e.length-1].e,s=t.slice(r,i);return new n(s,e)}const mj=typeof console<"u"&&console&&console.warn||(()=>{}),gj="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ei={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function yj(){return Pa.groups={},Ei.scanner=null,Ei.parser=null,Ei.tokenQueue=[],Ei.pluginQueue=[],Ei.customSchemes=[],Ei.initialized=!1,Ei}function G3(n,t=!1){if(Ei.initialized&&mj(`linkifyjs: already initialized - will not register custom scheme "${n}" ${gj}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))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`);Ei.customSchemes.push([n,t])}function bj(){Ei.scanner=uj(Ei.customSchemes);for(let n=0;n<Ei.tokenQueue.length;n++)Ei.tokenQueue[n][1]({scanner:Ei.scanner});Ei.parser=hj(Ei.scanner.tokens);for(let n=0;n<Ei.pluginQueue.length;n++)Ei.pluginQueue[n][1]({scanner:Ei.scanner,parser:Ei.parser});return Ei.initialized=!0,Ei}function ib(n){return Ei.initialized||bj(),pj(Ei.parser.start,n,vC(Ei.scanner.start,n))}ib.scan=vC;function SC(n,t=null,e=null){if(t&&typeof t=="object"){if(e)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);e=t,t=null}const r=new rb(e),i=ib(n),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 ob="[\0-   ᠎ -\u2029  ]",xj=new RegExp(ob),vj=new RegExp(`${ob}$`),wj=new RegExp(ob,"g");function Sj(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function kj(n){return new Fi({key:new To("autolink"),appendTransaction:(t,e,r)=>{const i=t.some(d=>d.docChanged)&&!e.doc.eq(r.doc),s=t.some(d=>d.getMeta("preventAutolink"));if(!i||s)return;const{tr:l}=r,c=BM(e.doc,[...t]);if(W5(c).forEach(({newRange:d})=>{const p=t7(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(!vj.test(y))return;g=p[0],b=r.doc.textBetween(g.pos,d.to,void 0," ")}if(g&&b){const y=b.split(xj).filter(Boolean);if(y.length<=0)return!1;const M=y[y.length-1],C=g.pos+b.lastIndexOf(M);if(!M)return!1;const L=ib(M).map(R=>R.toObject(n.defaultProtocol));if(!Sj(L))return!1;L.filter(R=>R.isLink).map(R=>({...R,from:C+R.start+1,to:C+R.end+1})).filter(R=>r.schema.marks.code?!r.doc.rangeHasMark(R.from,R.to,r.schema.marks.code):!0).filter(R=>n.validate(R.value)).filter(R=>n.shouldAutoLink(R.value)).forEach(R=>{X5(R.from,R.to,r.doc).some(B=>B.mark.type===n.type)||l.addMark(R.from,R.to,n.type.create({href:R.href}))})}}),!!l.steps.length)return l}})}function Aj(n){return new Fi({key:new To("handleClickLink"),props:{handleClick:(t,e,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=n.editor.view.dom;l=f.closest("a"),l&&!d.contains(l)&&(l=null)}if(!l)return!1;let c=!1;if(n.enableClickSelection&&(c=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){const f=YM(t.state,n.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 Mj(n){return new Fi({key:new To("handlePasteLink"),props:{handlePaste:(t,e,r)=>{const{shouldAutoLink:i}=n,{state:s}=t,{selection:l}=s,{empty:c}=l;if(c)return!1;let f="";r.content.forEach(p=>{f+=p.textContent});const d=SC(f,{defaultProtocol:n.defaultProtocol}).find(p=>p.isLink&&p.value===f);return!f||!d||i!==void 0&&!i(d.value)?!1:n.editor.commands.setMark(n.type,{href:d.href})}}})}function Pf(n,t){const e=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&e.push(i)}),!n||n.replace(wj,"").match(new RegExp(`^(?:(?:${e.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Cj=Sf.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(n=>{if(typeof n=="string"){G3(n);return}G3(n.scheme,n.optionalSlashes)})},onDestroy(){yj()},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:(n,t)=>!!Pf(n,t.protocols),validate:n=>!!n,shouldAutoLink:n=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),e=/^[a-z][a-z0-9+.-]*:/i.test(n);if(t||e&&!n.includes("@"))return!0;const i=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(n){return n.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:n=>{const t=n.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!Pf(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:t=>!!Pf(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",mo(this.options.HTMLAttributes,n),0]:["a",mo(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,t)=>t.applyMark("link",t.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,t)=>{var e,r,i,s;const l=(r=(e=n.attrs)==null?void 0:e.href)!=null?r:"",c=(s=(i=n.attrs)==null?void 0:i.title)!=null?s:"",f=t.renderChildren(n);return c?`[${f}](${l} "${c}")`:`[${f}](${l})`},addCommands(){return{setLink:n=>({chain:t})=>{const{href:e}=n;return this.options.isAllowedUri(e,{defaultValidate:r=>!!Pf(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:t})=>{const{href:e}=n||{};return e&&!this.options.isAllowedUri(e,{defaultValidate:r=>!!Pf(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[cd({find:n=>{const t=[];if(n){const{protocols:e,defaultProtocol:r}=this.options,i=SC(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!Pf(l,e),protocols:e,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:n=>{var t;return{href:(t=n.data)==null?void 0:t.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:t,defaultProtocol:e}=this.options;return this.options.autolink&&n.push(kj({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Pf(i,t),protocols:t,defaultProtocol:e}),shouldAutoLink:this.options.shouldAutoLink})),n.push(Aj({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(Mj({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),Ej=Object.defineProperty,Tj=(n,t)=>{for(var e in t)Ej(n,e,{get:t[e],enumerable:!0})},Nj="listItem",K3="textStyle",J3=/^\s*([-+*])\s$/,kC=ol.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:n}){return["ul",mo(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,t)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?t.parseChildren(n.items):[]},renderMarkdown:(n,t)=>n.content?t.renderChildren(n.content,`
222
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Nj,this.editor.getAttributes(K3)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=sh({find:J3,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=sh({find:J3,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(K3),editor:this.editor})),[n]}}),AC=ol.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",mo(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,t)=>{if(n.type!=="list_item")return[];let e=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(i=>i.type==="paragraph"))e=t.parseChildren(n.tokens);else{const i=n.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(e=[{type:"paragraph",content:t.parseInline(i.tokens)}],n.tokens.length>1){const l=n.tokens.slice(1),c=t.parseChildren(l);e.push(...c)}}else e=t.parseChildren(n.tokens)}return e.length===0&&(e=[{type:"paragraph",content:[]}]),{type:"listItem",content:e}},renderMarkdown:(n,t,e)=>tC(n,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}. `:"- "},e),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),_j={};Tj(_j,{findListItemPos:()=>jp,getNextListDepth:()=>sb,handleBackspace:()=>f5,handleDelete:()=>d5,hasListBefore:()=>MC,hasListItemAfter:()=>Dj,hasListItemBefore:()=>CC,listItemHasSubList:()=>EC,nextListIsDeeper:()=>TC,nextListIsHigher:()=>NC});var jp=(n,t)=>{const{$from:e}=t.selection,r=Eo(n,t.schema);let i=null,s=e.depth,l=e.pos,c=null;for(;s>0&&c===null;)i=e.node(s),i.type===r?c=s:(s-=1,l-=1);return c===null?null:{$pos:t.doc.resolve(l),depth:c}},sb=(n,t)=>{const e=jp(n,t);if(!e)return!1;const[,r]=f7(t,n,e.$pos.pos+4);return r},MC=(n,t,e)=>{const{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),s=n.doc.resolve(i).node();return!(!s||!e.includes(s.type.name))},CC=(n,t)=>{var e;const{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-2);return!(i.index()===0||((e=i.nodeBefore)==null?void 0:e.type.name)!==n)},EC=(n,t,e)=>{if(!e)return!1;const r=Eo(n,t.schema);let i=!1;return e.descendants(s=>{s.type===r&&(i=!0)}),i},f5=(n,t,e)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!xf(n.state,t)&&MC(n.state,t,e)){const{$anchor:c}=n.state.selection,f=n.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=n.state.doc.resolve(f.start()+p.pos+1);return n.chain().cut({from:c.start()-1,to:c.end()+1},g.end()).joinForward().run()}if(!xf(n.state,t)||!m7(n.state))return!1;const r=jp(t,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),l=EC(t,n.state,s);return CC(t,n.state)&&!l?n.commands.joinItemBackward():n.chain().liftListItem(t).run()},TC=(n,t)=>{const e=sb(n,t),r=jp(n,t);return!r||!e?!1:e>r.depth},NC=(n,t)=>{const e=sb(n,t),r=jp(n,t);return!r||!e?!1:e<r.depth},d5=(n,t)=>{if(!xf(n.state,t)||!p7(n.state,t))return!1;const{selection:e}=n.state,{$from:r,$to:i}=e;return!e.empty&&r.sameParent(i)?!1:TC(t,n.state)?n.chain().focus(n.state.selection.from+4).lift(t).joinBackward().run():NC(t,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},Dj=(n,t)=>{var e;const{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((e=i.nodeAfter)==null?void 0:e.type.name)!==n)},_C=ui.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let t=!1;return this.options.listTypes.forEach(({itemName:e})=>{n.state.schema.nodes[e]!==void 0&&d5(n,e)&&(t=!0)}),t},"Mod-Delete":({editor:n})=>{let t=!1;return this.options.listTypes.forEach(({itemName:e})=>{n.state.schema.nodes[e]!==void 0&&d5(n,e)&&(t=!0)}),t},Backspace:({editor:n})=>{let t=!1;return this.options.listTypes.forEach(({itemName:e,wrapperNames:r})=>{n.state.schema.nodes[e]!==void 0&&f5(n,e,r)&&(t=!0)}),t},"Mod-Backspace":({editor:n})=>{let t=!1;return this.options.listTypes.forEach(({itemName:e,wrapperNames:r})=>{n.state.schema.nodes[e]!==void 0&&f5(n,e,r)&&(t=!0)}),t}}}}),Z3=/^(\s*)(\d+)\.\s+(.*)$/,Lj=/^\s/;function Rj(n){const t=[];let e=0,r=0;for(;e<n.length;){const i=n[e],s=i.match(Z3);if(!s)break;const[,l,c,f]=s,d=l.length;let p=f,g=e+1;const b=[i];for(;g<n.length;){const y=n[g];if(y.match(Z3))break;if(y.trim()==="")b.push(y),p+=`
223
- `,g+=1;else if(y.match(Lj))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,e=g}return[t,r]}function DC(n,t,e){var r;const i=[];let s=0;for(;s<n.length;){const l=n[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:e.inlineTokens(f)});const p=c.slice(1).join(`
227
- `).trim();if(p){const y=e.blockTokens(p);d.push(...y)}let g=s+1;const b=[];for(;g<n.length&&n[g].indent>t;)b.push(n[g]),g+=1;if(b.length>0){const y=Math.min(...b.map(C=>C.indent)),M=DC(b,y,e);d.push({type:"list",ordered:!0,start:b[0].number,items:M,raw:b.map(C=>C.raw).join(`
228
- `)})}i.push({type:"list_item",raw:l.raw,tokens:d}),s=g}else s+=1}return i}function Oj(n,t){return n.map(e=>{if(e.type!=="list_item")return t.parseChildren([e])[0];const r=[];return e.tokens&&e.tokens.length>0&&e.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 Pj="listItem",Q3="textStyle",tk=/^(\d+)\.\s$/,LC=ol.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:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:t,...e}=n;return t===1?["ol",mo(this.options.HTMLAttributes,e),0]:["ol",mo(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,t)=>{if(n.type!=="list"||!n.ordered)return[];const e=n.start||1,r=n.items?Oj(n.items,t):[];return e!==1?{type:"orderedList",attrs:{start:e},content:r}:{type:"orderedList",content:r}},renderMarkdown:(n,t)=>n.content?t.renderChildren(n.content,`
229
- `):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const t=n.match(/^(\s*)(\d+)\.\s+/),e=t?.index;return e!==void 0?e:-1},tokenize:(n,t,e)=>{var r;const i=n.split(`
230
- `),[s,l]=Rj(i);if(s.length===0)return;const c=DC(s,0,e);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:n,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Pj,this.editor.getAttributes(Q3)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=sh({find:tk,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=sh({find:tk,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(Q3)}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1],editor:this.editor})),[n]}}),Ij=/^\s*(\[([( |x])?\])\s$/,jj=ol.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:n=>{const t=n.getAttribute("data-checked");return t===""||t==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:t}){return["li",mo(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,t)=>{const e=[];if(n.tokens&&n.tokens.length>0?e.push(t.createNode("paragraph",{},t.parseInline(n.tokens))):n.text?e.push(t.createNode("paragraph",{},[t.createNode("text",{text:n.text})])):e.push(t.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=t.parseChildren(n.nestedTokens);e.push(...r)}return t.createNode("taskItem",{checked:n.checked||!1},e)},renderMarkdown:(n,t)=>{var e;const i=`- [${(e=n.attrs)!=null&&e.checked?"x":" "}] `;return tC(n,t,i)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:t,getPos:e,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(n),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 e=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:y})=>{const M=e();if(typeof M!="number")return!1;const C=y.doc.nodeAt(M);return y.setNodeMarkup(M,void 0,{...C?.attrs,checked:b}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,b)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([g,b])=>{i.setAttribute(g,b)}),i.dataset.checked=n.attrs.checked,c.checked=n.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=Ep(g,b),M=new Set(Object.keys(y)),C=this.options.HTMLAttributes;return p.forEach(L=>{M.has(L)||(L in C?i.setAttribute(L,C[L]):i.removeAttribute(L))}),Object.entries(y).forEach(([L,R])=>{R==null?L in C?i.setAttribute(L,C[L]):i.removeAttribute(L):i.setAttribute(L,R)}),p=M,!0}}}},addInputRules(){return[sh({find:Ij,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),zj=ol.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:n}){return["ul",mo(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,t)=>t.createNode("taskList",{},t.parseChildren(n.items||[])),renderMarkdown:(n,t)=>n.content?t.renderChildren(n.content,`
232
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var t;const e=(t=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:t.index;return e!==void 0?e:-1},tokenize(n,t,e){const r=s=>{const l=O3(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:e.inlineTokens(c.mainContent),nestedTokens:f}),customNestedParser:r},e);return l?[{type:"taskList",raw:l.raw,items:l.items}]:e.blockTokens(s)},i=O3(n,{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:e.inlineTokens(s.mainContent),nestedTokens:l}),customNestedParser:r},e);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ui.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(kC.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(AC.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(_C.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(LC.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(jj.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(zj.configure(this.options.taskList)),n}});var ek="&nbsp;",Bj=" ",Fj=ol.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",mo(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,t)=>{const e=n.tokens||[];if(e.length===1&&e[0].type==="image")return t.parseChildren([e[0]]);const r=t.parseInline(e);return r.length===1&&r[0].type==="text"&&(r[0].text===ek||r[0].text===Bj)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,r)},renderMarkdown:(n,t)=>{if(!n)return"";const e=Array.isArray(n.content)?n.content:[];return e.length===0?ek:t.renderChildren(e)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Uj=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Hj=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,qj=Sf.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",mo(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,t)=>t.applyMark("strike",t.parseInline(n.tokens||[])),renderMarkdown:(n,t)=>`~~${t.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[oh({find:Uj,type:this.type})]},addPasteRules(){return[cd({find:Hj,type:this.type})]}}),$j=ol.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),Yj=Sf.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",mo(this.options.HTMLAttributes,n),0]},parseMarkdown(n,t){return t.applyMark(this.name||"underline",t.parseInline(n.tokens||[]))},renderMarkdown(n,t){return`++${t.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,t,e){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:e.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Vj(n={}){return new Fi({view(t){return new Wj(t,n)}})}class Wj{constructor(t,e){var r;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=e.width)!==null&&r!==void 0?r:1,this.color=e.color===!1?void 0:e.color||"black",this.class=e.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:e})=>this.editorView.dom.removeEventListener(t,e))}update(t,e){this.cursorPos!=null&&e.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),e=!t.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),l=s.width/i.offsetWidth,c=s.height/i.offsetHeight;if(e){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(),C=g?M.bottom:M.top;g&&b&&(C=(C+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let L=this.width/2*c;r={left:M.left,right:M.right,top:C-L,bottom:C+L}}}}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",e),this.element.classList.toggle("prosemirror-dropcursor-inline",!e);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 e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=e&&e.inside>=0&&this.editorView.state.doc.nodeAt(e.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,e,t):i;if(e&&!s){let l=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=AA(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 eo extends er{constructor(t){super(t,t)}map(t,e){let r=t.resolve(e.map(this.head));return eo.valid(r)?new eo(r):er.near(r)}content(){return We.empty}eq(t){return t instanceof eo&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new eo(t.resolve(e.pos))}getBookmark(){return new ab(this.anchor)}static valid(t){let e=t.parent;if(e.inlineContent||!Xj(t)||!Gj(t))return!1;let r=e.type.spec.allowGapCursor;if(r!=null)return r;let i=e.contentMatchAt(t.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(t,e,r=!1){t:for(;;){if(!r&&eo.valid(t))return t;let i=t.pos,s=null;for(let l=t.depth;;l--){let c=t.node(l);if(e>0?t.indexAfter(l)<c.childCount:t.index(l)>0){s=c.child(e>0?t.indexAfter(l):t.index(l)-1);break}else if(l==0)return null;i+=e;let f=t.doc.resolve(i);if(eo.valid(f))return f}for(;;){let l=e>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!kn.isSelectable(s)){t=t.doc.resolve(i+s.nodeSize*e),r=!1;continue t}break}s=l,i+=e;let c=t.doc.resolve(i);if(eo.valid(c))return c}return null}}}eo.prototype.visible=!1;eo.findFrom=eo.findGapCursorFrom;er.jsonID("gapcursor",eo);class ab{constructor(t){this.pos=t}map(t){return new ab(t.map(this.pos))}resolve(t){let e=t.resolve(this.pos);return eo.valid(e)?new eo(e):er.near(e)}}function RC(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function Xj(n){for(let t=n.depth;t>=0;t--){let e=n.index(t),r=n.node(t);if(e==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(e-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||RC(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Gj(n){for(let t=n.depth;t>=0;t--){let e=n.indexAfter(t),r=n.node(t);if(e==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(e);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||RC(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Kj(){return new Fi({props:{decorations:tz,createSelectionBetween(n,t,e){return t.pos==e.pos&&eo.valid(e)?new eo(e):null},handleClick:Zj,handleKeyDown:Jj,handleDOMEvents:{beforeinput:Qj}}})}const Jj=TM({ArrowLeft:Gm("horiz",-1),ArrowRight:Gm("horiz",1),ArrowUp:Gm("vert",-1),ArrowDown:Gm("vert",1)});function Gm(n,t){const e=n=="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 Ln){if(!s.endOfTextblock(e)||c.depth==0)return!1;f=!1,c=r.doc.resolve(t>0?c.after():c.before())}let d=eo.findGapCursorFrom(c,t,f);return d?(i&&i(r.tr.setSelection(new eo(d))),!0):!1}}function Zj(n,t,e){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(t);if(!eo.valid(r))return!1;let i=n.posAtCoords({left:e.clientX,top:e.clientY});return i&&i.inside>-1&&kn.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new eo(r))),!0)}function Qj(n,t){if(t.inputType!="insertCompositionText"||!(n.state.selection instanceof eo))return!1;let{$from:e}=n.state.selection,r=e.parent.contentMatchAt(e.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=Ae.empty;for(let l=r.length-1;l>=0;l--)i=Ae.from(r[l].createAndFill(null,i));let s=n.state.tr.replace(e.pos,e.pos,new We(i,0,0));return s.setSelection(Ln.near(s.doc.resolve(e.pos+1))),n.dispatch(s),!1}function tz(n){if(!(n.selection instanceof eo))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Qr.create(n.doc,[ua.widget(n.selection.head,t,{key:"gapcursor"})])}var l0=200,Qo=function(){};Qo.prototype.append=function(t){return t.length?(t=Qo.from(t),!this.length&&t||t.length<l0&&this.leafAppend(t)||this.length<l0&&t.leafPrepend(this)||this.appendInner(t)):this};Qo.prototype.prepend=function(t){return t.length?Qo.from(t).append(this):this};Qo.prototype.appendInner=function(t){return new ez(this,t)};Qo.prototype.slice=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.length),t>=e?Qo.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))};Qo.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};Qo.prototype.forEach=function(t,e,r){e===void 0&&(e=0),r===void 0&&(r=this.length),e<=r?this.forEachInner(t,e,r,0):this.forEachInvertedInner(t,e,r,0)};Qo.prototype.map=function(t,e,r){e===void 0&&(e=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,l){return i.push(t(s,l))},e,r),i};Qo.from=function(t){return t instanceof Qo?t:t&&t.length?new OC(t):Qo.empty};var OC=(function(n){function t(r){n.call(this),this.values=r}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var e={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<=l0)return new t(this.values.concat(i.flatten()))},t.prototype.leafPrepend=function(i){if(this.length+i.length<=l0)return new t(i.flatten().concat(this.values))},e.length.get=function(){return this.values.length},e.depth.get=function(){return 0},Object.defineProperties(t.prototype,e),t})(Qo);Qo.empty=new OC([]);var ez=(function(n){function t(e,r){n.call(this),this.left=e,this.right=r,this.length=e.length+r.length,this.depth=Math.max(e.depth,r.depth)+1}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.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})(Qo);const nz=500;class lc{constructor(t,e){this.items=t,this.eventCount=e}popEvent(t,e){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;e&&(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 Ic(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 Ic(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 lc(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,e,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 Ic(t.mapping.maps[p],g,e),y;(y=f&&f.merge(b))&&(b=y,p?s.pop():c=c.slice(0,c.length-1)),s.push(b),e&&(l++,e=void 0),i||(f=b)}let d=l-r.depth;return d>iz&&(c=rz(c,d),l-=d),new lc(c.append(s),l)}remapping(t,e){let r=new Sp;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,e),r}addMaps(t){return this.eventCount==0?this:new lc(this.items.append(t.map(e=>new Ic(e))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-e),s=t.mapping,l=t.steps.length,c=this.eventCount;this.items.forEach(b=>{b.selection&&c--},i);let f=e;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 C=t.steps[y].invert(t.docs[y]),L=b.selection&&b.selection.map(s.slice(f+1,y));L&&c++,r.push(new Ic(M,C,L))}else r.push(new Ic(M))},i);let d=[];for(let b=e;b<l;b++)d.push(new Ic(s.maps[b]));let p=this.items.slice(0,i).append(d).append(r),g=new lc(p,c);return g.emptyItemCount()>nz&&(g=g.compress(this.items.length-r.length)),g}emptyItemCount(){let t=0;return this.items.forEach(e=>{e.step||t++}),t}compress(t=this.items.length){let e=this.remapping(0,t),r=e.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(e.slice(r)),d=f&&f.getMap();if(r--,d&&e.appendMap(d,r),f){let p=l.selection&&l.selection.map(e.slice(r));p&&s++;let g=new Ic(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 lc(Qo.from(i.reverse()),s)}}lc.empty=new lc(Qo.empty,0);function rz(n,t){let e;return n.forEach((r,i)=>{if(r.selection&&t--==0)return e=i,!1}),n.slice(e)}class Ic{constructor(t,e,r,i){this.map=t,this.step=e,this.selection=r,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new Ic(e.getMap().invert(),e,this.selection)}}}class of{constructor(t,e,r,i,s){this.done=t,this.undone=e,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const iz=20;function oz(n,t,e,r){let i=e.getMeta(td),s;if(i)return i.historyState;e.getMeta(lz)&&(n=new of(n.done,n.undone,null,0,-1));let l=e.getMeta("appendedTransaction");if(e.steps.length==0)return n;if(l&&l.getMeta(td))return l.getMeta(td).redo?new of(n.done.addTransform(e,void 0,r,dg(t)),n.undone,nk(e.mapping.maps),n.prevTime,n.prevComposition):new of(n.done,n.undone.addTransform(e,void 0,r,dg(t)),null,n.prevTime,n.prevComposition);if(e.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let c=e.getMeta("composition"),f=n.prevTime==0||!l&&n.prevComposition!=c&&(n.prevTime<(e.time||0)-r.newGroupDelay||!sz(e,n.prevRanges)),d=l?Qy(n.prevRanges,e.mapping):nk(e.mapping.maps);return new of(n.done.addTransform(e,f?t.selection.getBookmark():void 0,r,dg(t)),lc.empty,d,e.time,c??n.prevComposition)}else return(s=e.getMeta("rebased"))?new of(n.done.rebased(e,s),n.undone.rebased(e,s),Qy(n.prevRanges,e.mapping),n.prevTime,n.prevComposition):new of(n.done.addMaps(e.mapping.maps),n.undone.addMaps(e.mapping.maps),Qy(n.prevRanges,e.mapping),n.prevTime,n.prevComposition)}function sz(n,t){if(!t)return!1;if(!n.docChanged)return!0;let e=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<t.length;s+=2)r<=t[s+1]&&i>=t[s]&&(e=!0)}),e}function nk(n){let t=[];for(let e=n.length-1;e>=0&&t.length==0;e--)n[e].forEach((r,i,s,l)=>t.push(s,l));return t}function Qy(n,t){if(!n)return null;let e=[];for(let r=0;r<n.length;r+=2){let i=t.map(n[r],1),s=t.map(n[r+1],-1);i<=s&&e.push(i,s)}return e}function az(n,t,e){let r=dg(t),i=td.get(t).spec.config,s=(e?n.undone:n.done).popEvent(t,r);if(!s)return null;let l=s.selection.resolve(s.transform.doc),c=(e?n.done:n.undone).addTransform(s.transform,t.selection.getBookmark(),i,r),f=new of(e?c:s.remaining,e?s.remaining:c,null,0,-1);return s.transform.setSelection(l).setMeta(td,{redo:e,historyState:f})}let t2=!1,rk=null;function dg(n){let t=n.plugins;if(rk!=t){t2=!1,rk=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){t2=!0;break}}return t2}const td=new To("history"),lz=new To("closeHistory");function cz(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Fi({key:td,state:{init(){return new of(lc.empty,lc.empty,null,0,-1)},apply(t,e,r){return oz(e,r,t,n)}},config:n,props:{handleDOMEvents:{beforeinput(t,e){let r=e.inputType,i=r=="historyUndo"?IC:r=="historyRedo"?jC:null;return!i||!t.editable?!1:(e.preventDefault(),i(t.state,t.dispatch))}}}})}function PC(n,t){return(e,r)=>{let i=td.getState(e);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=az(i,e,n);s&&r(t?s.scrollIntoView():s)}return!0}}const IC=PC(!1,!0),jC=PC(!0,!0);ui.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(t=>t!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const t=n?.node||this.editor.state.doc;if((n?.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=n=>{const t=n?.node||this.editor.state.doc,e=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(e)}},addProseMirrorPlugins(){let n=!1;return[new Fi({key:new To("characterCount"),appendTransaction:(t,e,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!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 n=!0,d}n=!0},filterTransaction:(t,e)=>{const r=this.options.limit;if(!t.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:e.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 uz=ui.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Vj(this.options)]}});ui.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Fi({key:new To("focus"),props:{decorations:({doc:n,selection:t})=>{const{isEditable:e,isFocused:r}=this.editor,{anchor:i}=t,s=[];if(!e||!r)return Qr.create(n,[]);let l=0;this.options.mode==="deepest"&&n.descendants((f,d)=>{if(f.isText)return;if(!(i>=d&&i<=d+f.nodeSize-1))return!1;l+=1});let c=0;return n.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(ua.node(d,d+f.nodeSize,{class:this.options.className}))}),Qr.create(n,s)}}})]}});var fz=ui.create({name:"gapCursor",addProseMirrorPlugins(){return[Kj()]},extendNodeSchema(n){var t;const e={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(t=Fr(fn(n,"allowGapCursor",e)))!=null?t:null}}}),ik="placeholder";function dz(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}ui.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:ik,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const n=this.options.dataAttribute?`data-${dz(this.options.dataAttribute)}`:`data-${ik}`;return[new Fi({key:new To("placeholder"),props:{decorations:({doc:t,selection:e})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=e,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&&R0(c);if((d||!this.options.showOnlyCurrent)&&p){const g=[this.options.emptyNodeClass];l&&g.push(this.options.emptyEditorClass);const b=ua.node(f,f+c.nodeSize,{class:g.join(" "),[n]: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}),Qr.create(t,s)}}})]}});ui.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:t}=this;return[new Fi({key:new To("selection"),props:{decorations(e){return e.selection.empty||n.isFocused||!n.isEditable||VM(e.selection)||n.view.dragging?null:Qr.create(e.doc,[ua.inline(e.selection.from,e.selection.to,{class:t.className})])}}})]}});function ok({types:n,node:t}){return t&&Array.isArray(n)&&n.includes(t.type)||t?.type===n}var hz=ui.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const t=new To(this.name),e=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(e).includes(i.name));return[new Fi({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[e];if(p)return f.insert(g,b.create())},state:{init:(i,s)=>{const l=s.tr.doc.lastChild;return!ok({node:l,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const l=i.doc.lastChild;return!ok({node:l,types:r})}}})]}}),pz=ui.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:t})=>IC(n,t),redo:()=>({state:n,dispatch:t})=>jC(n,t)}},addProseMirrorPlugins(){return[cz(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()}}}),mz=ui.create({name:"starterKit",addExtensions(){var n,t,e,r;const i=[];return this.options.bold!==!1&&i.push(FI.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(PI.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(kC.configure(this.options.bulletList)),this.options.code!==!1&&i.push(qI.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(VI.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(WI.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(uz.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(fz.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(XI.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(GI.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(pz.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(KI.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(ej.configure(this.options.italic)),this.options.listItem!==!1&&i.push(AC.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(_C.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(Cj.configure((t=this.options)==null?void 0:t.link)),this.options.orderedList!==!1&&i.push(LC.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(Fj.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(qj.configure(this.options.strike)),this.options.text!==!1&&i.push($j.configure(this.options.text)),this.options.underline!==!1&&i.push(Yj.configure((e=this.options)==null?void 0:e.underline)),this.options.trailingNode!==!1&&i.push(hz.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),gz=mz,yz=20,zC=(n,t=0)=>{const e=[];return!n.children.length||t>yz||Array.from(n.children).forEach(r=>{r.tagName==="SPAN"?e.push(r):r.children.length&&e.push(...zC(r,t+1))}),e},bz=n=>{if(!n.children.length)return;const t=zC(n);t&&t.forEach(e=>{var r,i;const s=e.getAttribute("style"),l=(i=(r=e.parentElement)==null?void 0:r.closest("span"))==null?void 0:i.getAttribute("style");e.setAttribute("style",`${l};${s}`)})},BC=Sf.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&bz(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",mo(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleTextStyle:n=>({commands:t})=>t.toggleMark(this.name,n),removeEmptyTextStyle:()=>({tr:n})=>{const{selection:t}=n;return n.doc.nodesBetween(t.from,t.to,(e,r)=>{if(e.isTextblock)return!0;e.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(s=>!!s))||n.removeMark(r,r+e.nodeSize,this.type)}),!0}}}}),xz=ui.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:n=>{var t;const e=n.getAttribute("style");if(e){const r=e.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=n.style.backgroundColor)==null?void 0:t.replace(/['"]+/g,"")},renderHTML:n=>n.backgroundColor?{style:`background-color: ${n.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:n=>({chain:t})=>t().setMark("textStyle",{backgroundColor:n}).run(),unsetBackgroundColor:()=>({chain:n})=>n().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),vz=ui.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var t;const e=n.getAttribute("style");if(e){const r=e.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=n.style.color)==null?void 0:t.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:t})=>t().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),wz=ui.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>n.style.fontFamily,renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:t})=>t().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Sz=ui.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:n=>n.style.fontSize,renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:n=>({chain:t})=>t().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),kz=ui.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:n=>n.style.lineHeight,renderHTML:n=>n.lineHeight?{style:`line-height: ${n.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:n=>({chain:t})=>t().setMark("textStyle",{lineHeight:n}).run(),unsetLineHeight:()=>({chain:n})=>n().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});ui.create({name:"textStyleKit",addExtensions(){const n=[];return this.options.backgroundColor!==!1&&n.push(xz.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(vz.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(wz.configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(Sz.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push(kz.configure(this.options.lineHeight)),this.options.textStyle!==!1&&n.push(BC.configure(this.options.textStyle)),n}});const re={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"}]},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 ud(){return/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function Qe(n,t){const e=t?.isMac??ud();return n.keys.map(i=>i.kind==="cmdOrCtrl"?e?"⌘":"Ctrl":i.kind==="shift"?e?"⇧":"Shift":i.kind==="plusMinus"||i.kind==="digits"?i.value:i.value.toUpperCase()).join(e?"":"+")}function Ci(n,t){const e=t?.isMac??ud();return n.keys.map(r=>r.kind==="cmdOrCtrl"?e?"⌘":"Ctrl":r.kind==="shift"?e?"⇧":"Shift":r.kind==="plusMinus"||r.kind==="digits"?r.value:r.value.toUpperCase())}const tl={minWidth:16,height:16,paddingV:0,paddingH:4,borderRadius:4,fontSize:11,translateY:-.5},sk={display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:tl.minWidth,height:tl.height,padding:`0 ${tl.paddingH}px`,borderRadius:tl.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:tl.fontSize,fontWeight:900,lineHeight:1,letterSpacing:"0.02em",transform:`translateY(${tl.translateY}px)`,userSelect:"none",boxShadow:"0 1px 0 0 rgba(255,255,255,0.2)"};function ac({children:n,title:t,scale:e=1}){const r=e,i=r===1?sk:{...sk,minWidth:tl.minWidth*r,height:tl.height*r,padding:`${tl.paddingV*r}px ${tl.paddingH*r}px`,borderRadius:tl.borderRadius*r,fontSize:tl.fontSize*r,transform:`translateY(${tl.translateY*r}px)`};return E.jsx("span",{style:i,title:t,children:n})}const c0="tyts-callout-insert-plain-text",Ar="bi",Mn=ti*w5,Pr=Math.round(12*Mn),zp="rgba(255,255,255,0.08)",lb="1px solid rgba(255,255,255,0.18)",FC="#ccc",Az="rgba(230,57,70,0.1)",Mz="1px solid rgba(230,57,70,0.8)",h5="#ff6b6b",j0=4*Mn,z0=14*Mn,Cz=`${3*Mn}px ${8*Mn}px`,u0=10*Mn,f0=8*Mn,ff=18*Mn,UC=Math.round(10*Mn),Km=7*Mn,HC=8*Mn,qC=4*Mn,$C=12*Mn,YC="rgba(20,20,32,0.95)",VC="1px solid rgba(60,60,80,0.9)",pp=6*Mn,to=16*Mn,d0=6*Mn,df=4*Mn,Zd="2px solid #fff",WC="1px solid rgba(255,255,255,0.2)",h0="rgba(255,255,255,0.05)",p0="1px solid rgba(255,255,255,0.35)",m0="1.8",XC="2.2 1.8",g0="#fff",GC=10*Mn,KC=3*Mn,JC=10*Mn,ZC=32*Mn,ak=16*Mn,ah="#aaa",QC={width:ak,height:ak,padding:0,margin:0,background:"transparent",border:"none",color:ah,cursor:"pointer",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center"},B0=28*Mn,Ez=26*Mn,t6=`${2*Mn}px ${6*Mn}px`,Tz=4*Mn,e6={minWidth:Ez,height:B0,cursor:"pointer",borderRadius:j0,fontSize:z0,padding:t6,fontFamily:"inherit",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:Tz,lineHeight:1,boxSizing:"border-box"},Jh={...e6,background:zp,border:lb,color:ah},Zh={...e6,background:Az,border:Mz,color:h5},lh=32*Mn,Nz=`${3*Mn}px`,_z=6,y0="rgba(20, 20, 32, 0.95)",cb="1px solid rgba(255,255,255,0.28)",ub="#cfcfcf",fb="background 0.15s, border 0.15s, color 0.15s",lk="1px solid rgba(230,57,70,0.7)",Dz="rgba(230,57,70,0.95)",Lz="1px solid #ff6b6b",Rz="#fff",Qh={position:"absolute",top:"50%",width:lh,height:lh,transform:"translateY(-50%)",background:y0,border:cb,color:ub,cursor:"pointer",borderRadius:"50%",fontSize:z0,padding:Nz,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center",transition:fb};function Oz(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const Pz=8,Ju=18*Mn,n6=5*Mn,Iz=Math.max(n6,18*Mn),jz=1.5*Mn,zz="#1a1a2e",Bz=.45,Fz="rgba(0,0,0,0.001)",ck="blur(12px)",Uz=2*Mn,Hz=2*Mn,qz="88",uk="33",$z=10*Mn,Yz="1.5em",Vz="#d0d0d0",Wz="#111111",Xz="rgba(10,10,16,0.88)",Gz="rgba(245,245,250,0.98)",fk=4*Mn,Kz=4*Mn,Jz=`${2*Mn}px ${6*Mn}px`,Zz=10*Mn,Qz=4*Mn,tB="rgba(0,0,0,0.6)",eB="#ddd",dk=8*Mn,nB=14*Mn,rB="#888",iB=8*Mn,oB=12*Mn,sB="rgba(255,255,255,0.5)",aB=2,lB=1*Mn,hk={background:zp,border:lb,color:FC,cursor:"pointer",borderRadius:j0,fontSize:z0,padding:Cz,fontFamily:"inherit",display:"inline-flex",alignItems:"center",gap:6*Mn},r6=B0,cB=4*Mn,Od={minWidth:r6,height:B0,background:zp,border:lb,color:FC,cursor:"pointer",borderRadius:j0,fontSize:z0,padding:t6,fontFamily:"inherit",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,boxSizing:"border-box"},uB="1px solid rgba(255,255,255,0.4)",pk=18*Mn,fB=3*Mn,dB=10*Mn,hB="1px solid rgba(255,255,255,0.25)",pB="#f5f5fa",mB="#111",gB="#111",yB="#fff";function e2(n){return n*(lh+_z)}const bB=[{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 xB(n,t){return n===t?!0:!n||!t||n.length!==t.length?!1:n.every((e,r)=>e.x===t[r].x&&e.y===t[r].y)}const vB=zc.memo(function({pin:t,position:e,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:C,onDragStart:L,onResizeStart:R,onActivate:B,onUpdateColor:q,onUpdateStrokeStyle:V,onUpdateFillStyle:gt,onUpdateStrokeWidthScale:Mt,onContextMenu:kt,onToggleDescPos:bt,onToggleTheme:it,onHide:Lt,onAddLinked:J,onDelete:ct,onUpdateTextStyle:G,onUpdateTextFontSize:vt}){const _t=Qt=>Qt,ht=H.useRef(null),Z=H.useRef(null),ut=H.useRef(null),[It,Zt]=H.useState(()=>t.description.trim().length>0),$=t.description.trim().length>0,N=!!t.image,Q=k0(t.anchor),tt=A5(t.anchor),pt=(t.strokeStyle??Hf)==="dashed",wt=(t.fillStyle??yp)==="none",At=O4(t.anchor),Ft=t.strokeWidthScale!==void 0,Rt=(f-rl)/(Eu-rl)*100,Jt=(t.textFontSize??Vs)*C4,ke=t.anchor.type==="standalone"?"Блок виноски":`Виноска ${t.label}`,Re=t.theme==="light"&&$,Ie=t.textColor??(Re?Wz:Vz),Ve=t.textBackgroundColor===null?"transparent":t.textBackgroundColor??(Re?Gz:Xz),rt=NI({extensions:[gz,BC],content:t.description||"",autofocus:!1,editorProps:{attributes:{style:["width: 100%",`min-height: ${Yz}`,"background: transparent","border: none","outline: none",`color: ${Ie}`,`font-size: ${Jt}px`,`line-height: ${yg}`,`font-family: ${c}`,"direction: ltr","unicode-bidi: plaintext","text-align: left","white-space: pre-wrap","word-break: break-word"].join("; ")}},onUpdate({editor:Qt}){let ye=Qt.getHTML();(ye==="<p></p>"||ye===`<p></p>
233
- `)&&(ye=""),y(t.id,ye),!It&&ye.trim().length>0&&Zt(!0)}}),Oe=H.useCallback(Qt=>Math.max($z,Qt),[]),Cn=H.useCallback(Qt=>{if(!$||!rt)return;const ye=rt.state.selection;if(!ye.empty&&ye.from!==ye.to){const ve=rt.getAttributes("textStyle"),Zn=ve?.fontSize?Number.parseFloat(ve.fontSize):Number.NaN,$n=Number.isFinite(Zn)?Zn:Jt,xr=Oe($n+Qt*Mn);rt.chain().focus().setMark("textStyle",{fontSize:`${xr}px`}).run();return}vt&&vt(t.id,Qt)},[$,rt,Jt,Oe,vt,t.id]),cn=H.useCallback(()=>{B(t.id),Zt(!0),requestAnimationFrame(()=>{rt?.commands.focus("end")})},[B,t.id,rt]);H.useEffect(()=>{if(rt){if(!i&&!s){rt.commands.blur();return}s&&!i&&rt.isFocused&&rt.commands.blur()}},[i,s,rt]),H.useEffect(()=>{if(!i||!rt)return;const Qt=ye=>{const Ce=ye;if(Ce.detail?.pinId!==t.id)return;const ve=Ce.detail.text??"";if(!ve.trim())return;Zt(!0);const Zn=()=>{if(!rt||rt.isDestroyed)return;rt.isFocused||rt.commands.focus("end");const $n=Oz(ve);rt.chain().focus().insertContent($n).run()};requestAnimationFrame(()=>requestAnimationFrame(Zn))};return document.addEventListener(c0,Qt),()=>document.removeEventListener(c0,Qt)},[i,rt,t.id]),H.useEffect(()=>{if(!l||!rt)return;B(t.id);const Qt=setTimeout(()=>{document.activeElement?.blur?.(),rt.commands.focus("end")},0);return()=>clearTimeout(Qt)},[l,t.id,B,rt]);const xe=(i||s)&&!!rt;H.useEffect(()=>{if(!xe||!rt)return;const Qt=ye=>{const Ce=ye.target;Ce&&(Ce.tagName==="TEXTAREA"||Ce.tagName==="INPUT"&&Ce!==ut.current||Ce.getAttribute?.("contenteditable")==="true")||ye.ctrlKey||ye.metaKey||ye.altKey||ye.key.length===1&&(rt.isFocused||(ye.preventDefault(),ye.stopPropagation(),B(t.id),rt.chain().focus().insertContent(ye.key).run(),Zt(!0)))};return window.addEventListener("keydown",Qt,!0),()=>window.removeEventListener("keydown",Qt,!0)},[xe,t.id,B,rt]);const we=ud();H.useEffect(()=>{if(!i||!q||!bt||!ct)return;const Qt=we?ve=>ve.metaKey:ve=>ve.ctrlKey,ye=(ve,Zn)=>ve.code===`Key${Zn.toUpperCase()}`||!ve.code&&ve.key.toLowerCase()===Zn,Ce=ve=>{const Zn=ve.key,$n=Qt(ve),xr=ve.shiftKey;if($n&&!xr&&ye(ve,"b")){ve.preventDefault(),ve.stopPropagation(),$&&rt&&rt.chain().focus().toggleBold().run();return}if($n&&!xr&&ye(ve,"i")){ve.preventDefault(),ve.stopPropagation(),$&&rt&&rt.chain().focus().toggleItalic().run();return}if($n&&!xr&&ye(ve,"u")){ve.preventDefault(),ve.stopPropagation(),$&&rt&&rt.chain().focus().toggleUnderline?.().run?.();return}if($n&&xr&&ye(ve,"s")){ve.preventDefault(),ve.stopPropagation(),$&&rt&&rt.chain().focus().toggleStrike?.().run?.();return}if($n&&(Zn==="-"||Zn==="Minus")){ve.preventDefault(),ve.stopPropagation(),Cn(-2);return}if($n&&(Zn==="="||Zn==="+")){ve.preventDefault(),ve.stopPropagation(),Cn(2);return}if($n&&xr&&ye(ve,"t")){ve.preventDefault(),ve.stopPropagation(),B(t.id),Zt(!0),requestAnimationFrame(()=>rt?.commands.focus("end"));return}if($n&&xr&&ye(ve,"i")){ve.preventDefault(),ve.stopPropagation(),Z.current?.click();return}if($n&&xr&&ye(ve,"x")){ve.preventDefault(),ve.stopPropagation(),y(t.id,""),Zt(!1);return}if($n&&xr&&ye(ve,"e")){ve.preventDefault(),ve.stopPropagation(),N&&C&&C(t.id);return}if($n&&xr&&ye(ve,"p")){ve.preventDefault(),ve.stopPropagation(),N&&($||It)&&bt(t.id);return}if($n&&xr&&ye(ve,"l")){ve.preventDefault(),ve.stopPropagation(),$&&it&&it(t.id);return}Zn==="Delete"&&(ve.preventDefault(),ve.stopPropagation(),ct(t.id))};return window.addEventListener("keydown",Ce,!0),()=>window.removeEventListener("keydown",Ce,!0)},[i,t.id,$,N,It,we,B,y,bt,it,ct,C,vt,q,rt,Cn]);const{x:Ne,y:De,width:Fe,height:tn}=e,{w:Pn,h:mn}=r,In=e2(1),hn=e2(2),Ue=e2(3),$e=Ne+Fe+hn+lh>Pn,je=H.useCallback(Qt=>["TEXTAREA","BUTTON","INPUT","LABEL"].includes(Qt.tagName)||Qt.getAttribute("contenteditable")==="true"||!!Qt.closest('[contenteditable="true"]')||!!Qt.closest(".ProseMirror"),[]),nr=H.useCallback(Qt=>{L(t.id,_t(Qt))},[L,t.id]),[bn,an]=H.useState(1),ln=H.useRef(null),Bn=H.useCallback(()=>{const Qt=ln.current;if(!Qt)return;const ye=Math.ceil(Qt.getBoundingClientRect().height),Ce=Math.ceil(Qt.scrollHeight),ve=Math.max(1,ye,Ce);an(Zn=>Zn!==ve?ve:Zn)},[]);H.useLayoutEffect(()=>{if(!i)return;const Qt=ln.current;if(!Qt)return;Bn();const ye=requestAnimationFrame(()=>{Bn(),requestAnimationFrame(Bn)}),Ce=new ResizeObserver(()=>Bn());return Ce.observe(Qt),()=>{cancelAnimationFrame(ye),Ce.disconnect()}},[i,g,N,$,It,t.theme,t.descPos,Bn]);const Xe=H.useCallback(()=>{},[]);H.useEffect(()=>{(It||$)&&Xe()},[It,$,Xe,tn]);const Mr=Qt=>{const ye=Qt.target.files?.[0];if(!ye)return;const Ce=new FileReader;Ce.onload=ve=>M(t.id,ve.target?.result),Ce.readAsDataURL(ye),Qt.target.value=""},gn=t.image?E.jsx("div",{style:{width:"100%",flex:$||It?"1 1 auto":"1 1 100%",minHeight:N4,background:`url(${t.image}) center/cover no-repeat`,position:"relative",borderTop:t.descPos==="above"&&($||It)?`1px solid ${t.color}${uk}`:"none",borderBottom:t.descPos==="below"&&($||It)?`1px solid ${t.color}${uk}`:"none",boxSizing:"border-box"},children:E.jsxs("label",{style:{position:"absolute",bottom:fk,right:fk,cursor:"pointer",background:tB,borderRadius:Kz,padding:Jz,fontSize:Zz,color:eB,display:"inline-flex",alignItems:"center",gap:Qz},children:[E.jsx("i",{className:`${Ar} bi-arrow-repeat`,style:{fontSize:Pr},"aria-hidden":!0}),"замінити (",Yd(),")",E.jsx("input",{type:"file",accept:"image/*",style:{display:"none"},onChange:Mr})]})}):null,yn=$||It||!N?E.jsx("div",{style:{flex:N?"0 0 auto":"1 1 auto",padding:`${M2}px ${C2}px ${D4}px`,overflow:"hidden",minHeight:"1.5em",height:N?"auto":"100%",display:"flex",flexDirection:"column",boxSizing:"border-box"},children:It||$?E.jsx("div",{style:{position:"relative",width:"100%",height:"100%",flex:"1 1 auto",display:"flex",flexDirection:"column"},children:rt&&E.jsx(sC,{editor:rt,className:"tyts-no-scrollbar",onContextMenu:Qt=>Qt.preventDefault(),onPointerDown:()=>{B(t.id)},onMouseDown:()=>{B(t.id)},onDoubleClick:Qt=>{Qt.stopPropagation(),cn()},style:{width:"100%",minHeight:"1.5em",flex:"1 1 auto",height:"100%",overflowY:"auto",boxSizing:"border-box",userSelect:"text",WebkitUserSelect:"text",WebkitTouchCallout:"default"}})}):N?null:E.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:dk,color:rB,fontSize:nB},children:[E.jsxs("div",{style:{display:"flex",gap:dk},children:[!N&&E.jsxs("button",{type:"button",onPointerDown:Qt=>Qt.stopPropagation(),onMouseDown:Qt=>Qt.stopPropagation(),onClick:Qt=>{Qt.stopPropagation(),B(t.id),Z.current?.click()},style:hk,children:[E.jsx("i",{className:`${Ar} bi-plus-lg-lg`,style:{fontSize:Pr},"aria-hidden":!0}),E.jsx("i",{className:`${Ar} bi-image`,style:{fontSize:Pr},"aria-hidden":!0}),"Фото"]}),E.jsxs("button",{type:"button",onPointerDown:Qt=>Qt.stopPropagation(),onMouseDown:Qt=>Qt.stopPropagation(),onClick:Qt=>{Qt.stopPropagation(),cn()},style:hk,children:[E.jsx("i",{className:`${Ar} bi-plus-lg`,style:{fontSize:Pr},"aria-hidden":!0}),E.jsx("i",{className:`${Ar} bi-type`,style:{fontSize:Pr},"aria-hidden":!0}),"Текст"]})]}),E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:iB,fontSize:oB,color:sB,marginTop:aB},children:["Або вставте з буфера"," ",Ci(re.pasteInCallout,{isMac:ud()}).map(Qt=>E.jsx(ac,{title:Yd(),scale:lB,children:Qt},Qt))]})]})}):null;return E.jsxs("g",{onContextMenu:kt?Qt=>kt(t.id,Qt):void 0,children:[E.jsx("foreignObject",{x:Ne,y:De,width:Fe,height:tn,style:{overflow:"visible"},onPointerDown:Qt=>{Qt.stopPropagation(),B(t.id);const ye=Qt.target;if(je(ye)){ht.current={pointerId:Qt.pointerId,pointerType:Qt.pointerType,startX:Qt.clientX,startY:Qt.clientY};return}nr(Qt)},onPointerMove:Qt=>{const ye=ht.current;if(!ye||ye.pointerId!==Qt.pointerId)return;const Ce=window.getSelection();if(ye.pointerType==="mouse"&&Ce&&!Ce.isCollapsed&&Ce.toString().trim().length>0){ht.current=null;return}const ve=Qt.clientX-ye.startX,Zn=Qt.clientY-ye.startY;Math.hypot(ve,Zn)<Pz||(ht.current=null,nr(Qt))},onPointerUp:Qt=>{ht.current?.pointerId===Qt.pointerId&&(ht.current=null)},onPointerCancel:Qt=>{ht.current?.pointerId===Qt.pointerId&&(ht.current=null)},onMouseDown:Qt=>{Qt.stopPropagation(),B(t.id);const ye=Qt.target;je(ye)||L(t.id,Qt)},children:E.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{width:"100%",height:"100%",border:`${_4*R4(f)}px solid ${t.color}`,borderRadius:k2,background:Ve,backdropFilter:ck,WebkitBackdropFilter:ck,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:c,cursor:"grab",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",outline:i?`${Uz}px solid ${t.color}${qz}`:"none",outlineOffset:Hz},onDragOver:Qt=>{Qt.preventDefault(),Qt.stopPropagation(),Qt.dataTransfer.dropEffect="copy"},onDrop:Qt=>{Qt.preventDefault(),Qt.stopPropagation(),B(t.id);const ye=Qt.dataTransfer.files?.[0];if(ye?.type.startsWith("image/")){const Ce=new FileReader;Ce.onload=ve=>{const Zn=ve.target?.result;Zn&&M(t.id,Zn)},Ce.readAsDataURL(ye)}},children:[E.jsx("input",{ref:ut,type:"text",readOnly:!0,tabIndex:0,"aria-label":ke,style:{position:"absolute",left:0,top:0,width:1,height:1,opacity:0,pointerEvents:"none",padding:0,margin:0,border:"none",outline:"none"}}),E.jsx("input",{ref:Z,type:"file",accept:"image/*",style:{display:"none"},onChange:Mr}),E.jsxs("div",{style:{display:"flex",flexDirection:t.descPos==="above"?"column":"column-reverse",height:"100%"},children:[yn,gn]}),E.jsx("div",{"data-drag-hit-zone":"top",style:{position:"absolute",top:0,left:0,right:0,height:Ju,cursor:"grab",background:"transparent"},onPointerDown:Qt=>{Qt.stopPropagation(),Qt.pointerType==="touch"&&(B(t.id),nr(Qt))}}),E.jsx("div",{"data-drag-hit-zone":"bottom",style:{position:"absolute",bottom:0,left:0,right:0,height:Ju,cursor:"grab",background:"transparent"},onPointerDown:Qt=>{Qt.stopPropagation(),Qt.pointerType==="touch"&&(B(t.id),nr(Qt))}}),E.jsx("div",{"data-drag-hit-zone":"left",style:{position:"absolute",top:Ju,bottom:Ju,left:0,width:Ju,cursor:"grab",background:"transparent"},onPointerDown:Qt=>{Qt.stopPropagation(),Qt.pointerType==="touch"&&(B(t.id),nr(Qt))}}),E.jsx("div",{"data-drag-hit-zone":"right",style:{position:"absolute",top:Ju,bottom:Ju,right:0,width:Ju,cursor:"grab",background:"transparent"},onPointerDown:Qt=>{Qt.stopPropagation(),Qt.pointerType==="touch"&&(B(t.id),nr(Qt))}})]})}),i&&q&&bt&&ct&&(()=>{if(g){const Yt=lh,Ur=xg({card:{x:Ne,y:De,width:Fe,height:tn},panel:{w:Yt,h:Yt},gap:u0,bounds:{w:Pn,h:mn},leader:p,margin:{top:Km,bottom:Km}}),Ni=E.jsx("foreignObject",{x:Ur.x,y:Ur.y,width:Yt,height:Yt,style:{overflow:"visible",outline:"none"},onPointerDown:Tn=>Tn.stopPropagation(),onMouseDown:Tn=>Tn.stopPropagation(),children:E.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",children:E.jsx("button",{type:"button",onPointerDown:Tn=>Tn.stopPropagation(),onClick:Tn=>{Tn.stopPropagation(),b?.()},title:`Показати панель (${Qe(re.calloutTogglePanel,{isMac:we})})`,style:{...Qh,position:"static",transform:"none"},children:E.jsx("i",{className:`${Ar} bi-sliders`,style:{fontSize:Pr},"aria-hidden":!0})})})});return d?bp.createPortal(Ni,d):Ni}const Qt=(Q&&V?1:0)+(tt&&gt?1:0),ye=Oa.length+Qt,ve=ye*to+(ye-1)*d0+f0*2,Zn=Ue,$n=xg({card:{x:Ne,y:De,width:Fe,height:tn},panel:{w:ve,h:bn},gap:u0,bounds:{w:Pn,h:mn},leader:p,margin:{left:$e?Zn:0,right:$e?0:Zn,top:Km,bottom:Km}}),xr=$n.above,Bo=$n.y,Ze=$n.x,ts=E.jsx("foreignObject",{x:Ze,y:Bo,width:ve,height:bn,style:{overflow:"visible",outline:"none"},onPointerDown:Yt=>Yt.stopPropagation(),onMouseDown:Yt=>Yt.stopPropagation(),children:E.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{display:"flex",flexDirection:"column",justifyContent:xr?"flex-end":"flex-start",width:"100%",height:"100%"},children:E.jsxs("div",{ref:ln,style:{display:"flex",flexDirection:"column",gap:HC,width:"100%",padding:f0,boxSizing:"border-box",background:YC,borderRadius:qC,border:VC,fontFamily:c,fontSize:$C,position:"relative"},children:[b&&E.jsx("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),b()},title:`Згорнути панель (${Qe(re.calloutTogglePanel,{isMac:we})})`,style:{position:"absolute",top:-ff/2,right:-ff/2,width:ff,height:ff,borderRadius:"50%",background:y0,border:cb,color:ub,cursor:"pointer",padding:0,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:fb},children:E.jsx("i",{className:`${Ar} bi-dash-lg`,style:{fontSize:UC},"aria-hidden":!0})}),E.jsxs("div",{style:{display:"flex",gap:d0,justifyContent:"center"},children:[Oa.map(Yt=>E.jsx("button",{type:"button",onPointerDown:Ur=>Ur.stopPropagation(),onClick:Ur=>{Ur.stopPropagation(),q(t.id,Yt)},title:Yt,style:{width:to,height:to,borderRadius:"50%",background:Yt,border:t.color===Yt?Zd:WC,cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0}},Yt)),Q&&V&&E.jsx("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),V(t.id,pt?"solid":"dashed")},onMouseDown:Yt=>Yt.preventDefault(),"aria-label":"Перемикач стилю обводки",title:pt?"Змінити на суцільну обводку":"Змінити на пунктирну обводку",style:{width:to,height:to,borderRadius:"50%",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0,background:h0,border:pt?Zd:p0,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:E.jsx("svg",{width:to-df,height:to-df,viewBox:"0 0 16 16","aria-hidden":!0,children:E.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:g0,strokeWidth:m0,strokeDasharray:XC})})}),tt&&gt&&E.jsx("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),gt(t.id,wt?"filled":"none")},onMouseDown:Yt=>Yt.preventDefault(),"aria-label":"Перемикач фону фігури",title:wt?"Додати фон фігури":"Прибрати фон фігури",style:{width:to,height:to,borderRadius:"50%",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0,background:h0,border:wt?Zd:p0,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:E.jsx("svg",{width:to-df,height:to-df,viewBox:"0 0 16 16","aria-hidden":!0,children:E.jsx("rect",{x:"3",y:"3",width:"10",height:"10",fill:"none",stroke:g0,strokeWidth:m0})})})]}),At&&Mt&&E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:pp},children:[E.jsx("i",{className:`${Ar} bi-border-width`,style:{fontSize:Pr,color:ah,flexShrink:0},"aria-hidden":!0}),E.jsx("input",{type:"range",min:rl,max:Eu,step:v0,value:f,"aria-label":"Товщина ліній виноски",title:"Товщина контуру, лінії та маркера",onPointerDown:Yt=>Yt.stopPropagation(),onMouseDown:Yt=>Yt.stopPropagation(),onChange:Yt=>Mt(t.id,Number(Yt.target.value)),className:"tyts-range",style:{flex:1,minWidth:0,"--tyts-range-accent":t.color,"--tyts-range-bg":zp,"--tyts-range-track":`${KC}px`,"--tyts-range-thumb":`${GC}px`,"--tyts-range-fill":`${Rt}%`}}),E.jsxs("span",{style:{color:ah,fontSize:JC,fontVariantNumeric:"tabular-nums",minWidth:ZC,textAlign:"right",flexShrink:0},children:["×",w0(f)]}),Ft&&E.jsx("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onMouseDown:Yt=>Yt.preventDefault(),onClick:Yt=>{Yt.stopPropagation(),Mt(t.id,null)},title:"Повернути глобальну товщину","aria-label":"Повернути глобальну товщину",style:QC,children:E.jsx("i",{className:`${Ar} bi-arrow-counterclockwise`,style:{fontSize:Pr},"aria-hidden":!0})})]}),(N&&!$||!N&&$||N&&($||It)||$&&G&&vt&&rt||$&&it)&&E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:pp,flexShrink:0,flexWrap:"wrap",overflowX:"visible",rowGap:pp},children:[N&&!$&&!It&&E.jsxs(E.Fragment,{children:[E.jsxs("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),B(t.id),Zt(!0)},title:`Додати текст (${Qe(re.calloutAddText,{isMac:we})})`,style:Jh,children:[E.jsx("i",{className:`${Ar} bi-type`,style:{fontSize:Pr},"aria-hidden":!0}),E.jsx("i",{className:`${Ar} bi-plus-lg`,style:{fontSize:Pr},"aria-hidden":!0})]}),C&&E.jsxs("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),C(t.id)},title:`Прибрати фото (${Qe(re.calloutRemoveImage,{isMac:we})})`,style:Zh,children:[E.jsx("i",{className:`${Ar} bi-image`,style:{fontSize:Pr},"aria-hidden":!0}),E.jsx("i",{className:`${Ar} bi-x-lg`,style:{fontSize:Pr},"aria-hidden":!0})]})]}),!N&&$&&E.jsxs(E.Fragment,{children:[E.jsxs("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),Z.current?.click()},onMouseDown:Yt=>Yt.preventDefault(),title:`Додати фото (${Yd()} або ${Qe(re.calloutAddImage,{isMac:we})})`,style:Jh,children:[E.jsx("i",{className:`${Ar} bi-image`,style:{fontSize:Pr},"aria-hidden":!0}),E.jsx("i",{className:`${Ar} bi-plus-lg`,style:{fontSize:Pr},"aria-hidden":!0})]}),E.jsxs("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),y(t.id,""),Zt(!1)},onMouseDown:Yt=>Yt.preventDefault(),title:`Прибрати текст (${Qe(re.calloutRemoveText,{isMac:we})})`,style:Zh,children:[E.jsx("i",{className:`${Ar} bi-type`,style:{fontSize:Pr},"aria-hidden":!0}),E.jsx("i",{className:`${Ar} bi-x-lg`,style:{fontSize:Pr},"aria-hidden":!0})]})]}),N&&($||It)&&E.jsxs(E.Fragment,{children:[E.jsxs("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),Z.current?.click()},onMouseDown:Yt=>Yt.preventDefault(),title:`Змінити фото (${Yd()} або ${Qe(re.calloutAddImage,{isMac:we})})`,style:Jh,children:[E.jsx("i",{className:`${Ar} bi-image`,style:{fontSize:Pr},"aria-hidden":!0}),E.jsx("i",{className:`${Ar} bi-arrow-repeat`,style:{fontSize:Pr},"aria-hidden":!0})]}),E.jsx("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),bt(t.id)},onMouseDown:Yt=>Yt.preventDefault(),title:`${t.descPos==="above"?"Текст вниз":"Текст вгору"} (${Qe(re.calloutToggleDescPos,{isMac:we})})`,style:Jh,children:E.jsx("i",{className:`${Ar} ${t.descPos==="above"?"bi-arrow-bar-down":"bi-arrow-bar-up"}`,style:{fontSize:Pr},"aria-hidden":!0})}),E.jsxs("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),y(t.id,""),Zt(!1)},onMouseDown:Yt=>Yt.preventDefault(),title:`Прибрати текст (${Qe(re.calloutRemoveText,{isMac:we})})`,style:Zh,children:[E.jsx("i",{className:`${Ar} bi-type`,style:{fontSize:Pr},"aria-hidden":!0}),E.jsx("i",{className:`${Ar} bi-x-lg`,style:{fontSize:Pr},"aria-hidden":!0})]}),C&&E.jsxs("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),C(t.id)},title:`Прибрати фото (${Qe(re.calloutRemoveImage,{isMac:we})})`,style:Zh,children:[E.jsx("i",{className:`${Ar} bi-image`,style:{fontSize:Pr},"aria-hidden":!0}),E.jsx("i",{className:`${Ar} bi-x-lg`,style:{fontSize:Pr},"aria-hidden":!0})]})]}),$&&G&&vt&&rt&&E.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:cB,flexWrap:"wrap"},children:[E.jsx("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),rt.chain().focus().toggleBold().run()},onMouseDown:Yt=>Yt.preventDefault(),title:`Жирний текст (${Qe(re.calloutBold,{isMac:we})})`,style:{...Od,fontWeight:700},children:"B"}),E.jsx("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),rt.chain().focus().toggleItalic().run()},onMouseDown:Yt=>Yt.preventDefault(),title:`Курсив (${Qe(re.calloutItalic,{isMac:we})})`,style:{...Od,fontStyle:"italic"},children:"I"}),E.jsx("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),rt.chain().focus().toggleUnderline?.().run?.()},onMouseDown:Yt=>Yt.preventDefault(),title:`Підкреслення (${Qe(re.calloutUnderline,{isMac:we})})`,style:{...Od,textDecoration:"underline"},children:"U"}),E.jsx("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),rt.chain().focus().toggleStrike?.().run?.()},onMouseDown:Yt=>Yt.preventDefault(),title:`Закреслення (${Qe(re.calloutStrike,{isMac:we})})`,style:{...Od,textDecoration:"line-through"},children:"S"}),E.jsx("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),Cn(-2)},onMouseDown:Yt=>Yt.preventDefault(),title:`Менший шрифт (${Qe(re.calloutFontSizeDown,{isMac:we})})`,style:Od,children:"A–"}),E.jsx("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),Cn(2)},onMouseDown:Yt=>Yt.preventDefault(),title:`Більший шрифт (${Qe(re.calloutFontSizeUp,{isMac:we})})`,style:Od,children:"A+"})]}),$&&it&&E.jsx("button",{type:"button",onPointerDown:Yt=>Yt.stopPropagation(),onClick:Yt=>{Yt.stopPropagation(),it(t.id)},onMouseDown:Yt=>Yt.preventDefault(),title:`${Re?"Світлий фон, темний текст":"Темний фон, світлий текст"} (${Qe(re.calloutToggleTheme,{isMac:we})})`,style:{width:r6,height:B0,borderRadius:j0,background:"transparent",border:uB,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,cursor:"pointer",padding:0,boxSizing:"border-box"},children:E.jsx("span",{style:{width:pk,height:pk,borderRadius:fB,background:Re?pB:mB,color:Re?gB:yB,border:hB,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:dB,fontWeight:700,lineHeight:1},children:"Aa"})})]}),Lt&&E.jsx("button",{type:"button",onPointerDown:Yt=>{Yt.stopPropagation()},onClick:Yt=>{Yt.stopPropagation(),Lt(t.id)},title:"Приховати виноску",style:{...Qh,right:$e?"auto":-hn,left:$e?-hn:"auto"},children:E.jsx("i",{className:`${Ar} bi-eye-slash`,style:{fontSize:Pr},"aria-hidden":!0})}),J&&E.jsx("button",{type:"button",onPointerDown:Yt=>{Yt.stopPropagation()},onClick:Yt=>{Yt.stopPropagation(),J(t.id)},title:"Додати ще одну виноску до цієї фігури",style:{...Qh,right:$e?"auto":-Ue,left:$e?-Ue:"auto"},children:E.jsx("i",{className:`${Ar} bi-plus-lg`,style:{fontSize:Pr},"aria-hidden":!0})}),E.jsx("button",{type:"button",onPointerDown:Yt=>{Yt.stopPropagation()},onClick:Yt=>{Yt.stopPropagation(),ct(t.id)},title:`Видалити виноску (${Qe(re.calloutDelete,{isMac:we})})`,style:{...Qh,right:$e?"auto":-In,left:$e?-In:"auto",border:lk,color:h5},onMouseEnter:Yt=>{Yt.currentTarget.style.background=Dz,Yt.currentTarget.style.border=Lz,Yt.currentTarget.style.color=Rz},onMouseLeave:Yt=>{Yt.currentTarget.style.background=y0,Yt.currentTarget.style.border=lk,Yt.currentTarget.style.color=h5},children:E.jsx("i",{className:`${Ar} bi-trash`,style:{fontSize:Pr},"aria-hidden":!0})})]})})});return d?bp.createPortal(ts,d):ts})(),bB.map(Qt=>E.jsxs("g",{children:[E.jsx("circle",{cx:Ne+Qt.cx*Fe,cy:De+Qt.cy*tn,r:Iz,fill:Fz,stroke:"none","data-resize-handle-hit":Qt.id,style:{cursor:Qt.cursor},onPointerDown:ye=>{ye.stopPropagation(),B(t.id),R(t.id,Qt.id,_t(ye))},onMouseDown:ye=>{ye.stopPropagation(),B(t.id),R(t.id,Qt.id,ye)}}),E.jsx("circle",{cx:Ne+Qt.cx*Fe,cy:De+Qt.cy*tn,r:n6,fill:i?t.color:zz,stroke:t.color,strokeWidth:jz,opacity:i?1:Bz,pointerEvents:"none"})]},Qt.id))]})},(n,t)=>n.pin===t.pin&&n.position===t.position&&n.active===t.active&&n.isSelected===t.isSelected&&n.imageSize===t.imageSize&&n.justCreated===t.justCreated&&n.controlsCollapsed===t.controlsCollapsed&&xB(n.leaderPath,t.leaderPath)),La=n=>n.stopPropagation(),mk={xmlns:"http://www.w3.org/1999/xhtml"},wB=zc.memo(function({pin:t,bbox:e,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 C=ud(),L=k0(t.anchor)&&!!p,R=A5(t.anchor)&&!!g,B=O4(t.anchor)&&!!b,q=(t.strokeStyle??Hf)==="dashed",V=(t.fillStyle??yp)==="none",gt=t.strokeWidthScale!==void 0,Mt=(i-rl)/(Eu-rl)*100,[kt,bt]=H.useState(1),it=H.useRef(null),Lt=H.useCallback(()=>{const Z=it.current;if(!Z)return;const ut=Math.max(1,Math.ceil(Z.getBoundingClientRect().height),Math.ceil(Z.scrollHeight));bt(It=>It!==ut?ut:It)},[]);H.useLayoutEffect(()=>{const Z=it.current;if(!Z)return;Lt();const ut=requestAnimationFrame(()=>{Lt(),requestAnimationFrame(Lt)}),It=new ResizeObserver(Lt);return It.observe(Z),()=>{cancelAnimationFrame(ut),It.disconnect()}},[c,B,Lt]);const J={x:e.minX,y:e.minY,width:e.maxX-e.minX,height:e.maxY-e.minY},ct={w:r.w,h:r.h};if(c){const Z=lh,ut=xg({card:J,panel:{w:Z,h:Z},gap:u0,bounds:ct}),It=E.jsx("foreignObject",{x:ut.x,y:ut.y,width:Z,height:Z,style:{overflow:"visible",outline:"none"},onPointerDown:La,onMouseDown:La,children:E.jsx("div",{...mk,children:E.jsx("button",{type:"button",onPointerDown:La,onClick:Zt=>{Zt.stopPropagation(),f?.()},title:`Показати панель (${Qe(re.calloutTogglePanel,{isMac:C})})`,style:{...Qh,position:"static",transform:"none"},children:E.jsx("i",{className:`${Ar} bi-sliders`,style:{fontSize:Pr},"aria-hidden":!0})})})});return l?bp.createPortal(It,l):It}const G=Oa.length+(L?1:0)+(R?1:0),vt=G*to+(G-1)*d0+f0*2,_t=xg({card:J,panel:{w:vt,h:kt},gap:u0,bounds:ct}),ht=E.jsx("foreignObject",{x:_t.x,y:_t.y,width:vt,height:kt,style:{overflow:"visible",outline:"none"},onPointerDown:La,onMouseDown:La,children:E.jsx("div",{...mk,style:{display:"flex",flexDirection:"column",justifyContent:_t.above?"flex-end":"flex-start",width:"100%",height:"100%"},children:E.jsxs("div",{ref:it,style:{display:"flex",flexDirection:"column",gap:HC,width:"100%",padding:f0,boxSizing:"border-box",background:YC,borderRadius:qC,border:VC,fontFamily:s,fontSize:$C,position:"relative"},children:[f&&E.jsx("button",{type:"button",onPointerDown:La,onClick:Z=>{Z.stopPropagation(),f()},title:`Згорнути панель (${Qe(re.calloutTogglePanel,{isMac:C})})`,style:{position:"absolute",top:-ff/2,right:-ff/2,width:ff,height:ff,borderRadius:"50%",background:y0,border:cb,color:ub,cursor:"pointer",padding:0,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:fb},children:E.jsx("i",{className:`${Ar} bi-dash-lg`,style:{fontSize:UC},"aria-hidden":!0})}),E.jsxs("div",{style:{display:"flex",gap:d0,justifyContent:"center"},children:[Oa.map(Z=>E.jsx("button",{type:"button",onPointerDown:La,onClick:ut=>{ut.stopPropagation(),d(t.id,Z)},title:Z,style:{width:to,height:to,borderRadius:"50%",background:Z,border:t.color===Z?Zd:WC,cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0}},Z)),L&&E.jsx("button",{type:"button",onPointerDown:La,onClick:Z=>{Z.stopPropagation(),p(t.id,q?"solid":"dashed")},onMouseDown:Z=>Z.preventDefault(),"aria-label":"Перемикач стилю обводки",title:q?"Змінити на суцільну обводку":"Змінити на пунктирну обводку",style:{width:to,height:to,borderRadius:"50%",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0,background:h0,border:q?Zd:p0,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:E.jsx("svg",{width:to-df,height:to-df,viewBox:"0 0 16 16","aria-hidden":!0,children:E.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:g0,strokeWidth:m0,strokeDasharray:XC})})}),R&&E.jsx("button",{type:"button",onPointerDown:La,onClick:Z=>{Z.stopPropagation(),g(t.id,V?"filled":"none")},onMouseDown:Z=>Z.preventDefault(),"aria-label":"Перемикач фону фігури",title:V?"Додати фон фігури":"Прибрати фон фігури",style:{width:to,height:to,borderRadius:"50%",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0,background:h0,border:V?Zd:p0,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:E.jsx("svg",{width:to-df,height:to-df,viewBox:"0 0 16 16","aria-hidden":!0,children:E.jsx("rect",{x:"3",y:"3",width:"10",height:"10",fill:"none",stroke:g0,strokeWidth:m0})})})]}),B&&E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:pp},children:[E.jsx("i",{className:`${Ar} bi-border-width`,style:{fontSize:Pr,color:ah,flexShrink:0},"aria-hidden":!0}),E.jsx("input",{type:"range",min:rl,max:Eu,step:v0,value:i,"aria-label":"Товщина ліній фігури",title:"Товщина контуру та маркера",onPointerDown:La,onMouseDown:La,onChange:Z=>b(t.id,Number(Z.target.value)),className:"tyts-range",style:{flex:1,minWidth:0,"--tyts-range-accent":t.color,"--tyts-range-bg":zp,"--tyts-range-track":`${KC}px`,"--tyts-range-thumb":`${GC}px`,"--tyts-range-fill":`${Mt}%`}}),E.jsxs("span",{style:{color:ah,fontSize:JC,fontVariantNumeric:"tabular-nums",minWidth:ZC,textAlign:"right",flexShrink:0},children:["×",w0(i)]}),gt&&E.jsx("button",{type:"button",onPointerDown:La,onMouseDown:Z=>Z.preventDefault(),onClick:Z=>{Z.stopPropagation(),b(t.id,null)},title:"Повернути глобальну товщину","aria-label":"Повернути глобальну товщину",style:QC,children:E.jsx("i",{className:`${Ar} bi-arrow-counterclockwise`,style:{fontSize:Pr},"aria-hidden":!0})})]}),E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:pp},children:[E.jsxs("button",{type:"button",onPointerDown:La,onClick:Z=>{Z.stopPropagation(),y(t.id)},title:"Показати виноску",style:{...Jh,flex:1},children:[E.jsx("i",{className:`${Ar} bi-chat-square-text`,style:{fontSize:Pr},"aria-hidden":!0}),E.jsx("i",{className:`${Ar} bi-plus-lg`,style:{fontSize:Pr},"aria-hidden":!0})]}),E.jsx("button",{type:"button",onPointerDown:La,onClick:Z=>{Z.stopPropagation(),M(t.id)},title:`Видалити (${Qe(re.calloutDelete,{isMac:C})})`,style:Zh,children:E.jsx("i",{className:`${Ar} bi-trash`,style:{fontSize:Pr},"aria-hidden":!0})})]})]})})});return l?bp.createPortal(ht,l):ht}),SB=H.memo(function({anchor:t,card:e,color:r,widthScale:i=1,points:s}){if(t.type==="standalone")return null;const l=D8(og(t,e,s));return E.jsx("g",{children:E.jsx("path",{d:l,fill:"none",stroke:r,strokeWidth:T4*i,strokeLinecap:"round",strokeLinejoin:"round"})})});function kB({isMac:n,backgroundImage:t,pinsLength:e,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:C,copyPin:L,duplicatePin:R,pastePinFromClipboard:B,setMode:q,setPolygonDraft:V,setPolylineDraft:gt,setShapeDraftType:Mt,setPlacementTool:kt,setShowExportMenu:bt,beginCrop:it,insertCurrentDateTimeText:Lt,toggleCompassMenu:J,toggleImageObjectMenu:ct,toggleCalloutPanel:G,newBgFileRef:vt,replaceBgFileRef:_t,exportMenuOpenedViaHotkeyRef:ht}){H.useEffect(()=>{const Z=["range","checkbox","radio","button","color","file","submit","reset"],ut=N=>N?N.isContentEditable||N.tagName==="TEXTAREA"?!0:N.tagName==="INPUT"?!Z.includes(N.type):!1:!1,It=N=>N.code==="NumpadAdd"||N.key==="+"||N.key==="="||N.code==="Equal"&&N.shiftKey,Zt=N=>N.code==="NumpadSubtract"||N.code==="Minus"||N.key==="-"||N.key==="_",$=N=>{const Q=N.target,tt=n?N.metaKey:N.ctrlKey;if(tt&&N.shiftKey&&!N.altKey&&N.code==="KeyH"){N.preventDefault(),G();return}if(!ut(Q)){if(r&&!tt&&!N.altKey&&!N.shiftKey){const pt=/^[1-9]$/.test(N.key)?Number(N.key):null;if(pt!=null){N.preventDefault();const wt=[];i&&wt.push(()=>{const{w:Ft}=s;if(!Ft)return;const Rt=i.w/Ft/2;p("png",Rt)}),wt.push(()=>p("png",1)),wt.push(()=>p("png",2)),wt.push(()=>p("jpeg",2)),wt.push(()=>g()),wt.push(()=>{t&&window.print()});const At=wt[pt-1];At&&(bt(!1),ht.current=!1,At());return}}if(tt&&N.shiftKey&&N.code==="KeyV"){N.preventDefault(),B();return}if(tt&&!N.shiftKey&&(N.code==="KeyC"||N.code==="KeyJ")){const pt=c??l;if(pt){N.preventDefault(),N.code==="KeyC"?L(pt):R(pt);return}}if(tt&&(N.code==="BracketRight"||N.code==="BracketLeft")){const pt=c??l;if(pt){N.preventDefault();const wt=N.code==="BracketRight",At=N.shiftKey?wt?"front":"back":wt?"up":"down";C(pt,At);return}}if(tt&&(N.code==="KeyZ"||N.key.toLowerCase()==="z")){N.preventDefault(),N.shiftKey?d():f();return}if(!n&&N.ctrlKey&&(N.code==="KeyY"||N.key.toLowerCase()==="y")){N.preventDefault(),d();return}if(tt&&!N.shiftKey&&(N.code==="KeyD"||N.key.toLowerCase()==="d")){N.preventDefault(),t&&p("jpeg");return}if(tt&&N.shiftKey&&N.code==="KeyD"){if(N.preventDefault(),!t)return;ht.current=!0,bt(!0);return}if((N.key==="Delete"||N.key==="Backspace")&&(c||l)){N.preventDefault(),M(c??l);return}if(tt&&!N.altKey&&!N.shiftKey){if(N.code==="KeyN"){N.preventDefault(),vt.current?.click();return}if(N.code==="KeyB"){N.preventDefault(),(_t.current??vt.current)?.click();return}if(N.code==="KeyO"){N.preventDefault(),t&&y();return}}if(t){if(!tt&&!N.altKey&&!N.shiftKey){if(N.code==="Digit1"||N.code==="Numpad1"){N.preventDefault(),q("place"),V(null),gt(null),Mt(null),kt("point");return}if(N.code==="Digit0"||N.code==="Numpad0"||N.key==="0"){N.preventDefault(),q("place"),V(null),gt(null),Mt(null),kt("numbering");return}if(N.code==="Digit2"||N.code==="Numpad2"){N.preventDefault(),q("place"),V([]),gt(null),Mt(null);return}if(N.code==="Digit3"||N.code==="Numpad3"){N.preventDefault(),q("place"),V(null),gt([]),Mt(null);return}if(N.code==="Digit4"||N.code==="Numpad4"){N.preventDefault(),q("place"),V(null),gt(null),Mt("rectangle");return}if(N.code==="Digit5"||N.code==="Numpad5"){N.preventDefault(),q("place"),V(null),gt(null),Mt("ellipse"),kt("point");return}if(N.code==="Digit6"||N.code==="Numpad6"){N.preventDefault(),q("place"),V(null),gt(null),Mt(null),kt("text");return}if(N.code==="Digit7"||N.code==="Numpad7"){N.preventDefault(),q("place"),V(null),gt(null),Mt(null),kt("arrow");return}if(N.code==="Digit8"||N.code==="Numpad8"){N.preventDefault(),Lt();return}if(N.code==="Digit9"||N.code==="Numpad9"){N.preventDefault(),q("place"),V(null),gt(null),Mt(null),kt("standalone");return}if(N.code==="KeyK"){N.preventDefault(),J();return}if(N.code==="KeyP"){N.preventDefault(),q("place"),V(null),gt(null),Mt(null),kt("pointText");return}if(N.code==="KeyR"){N.preventDefault(),q("place"),V(null),gt(null),Mt("redact");return}if(N.code==="KeyI"){N.preventDefault(),ct();return}if(N.code==="KeyC"){N.preventDefault(),it();return}}if(!tt&&!N.altKey){if(It(N)){N.preventDefault(),b("in");return}if(Zt(N)){N.preventDefault(),b("out");return}}}}};return window.addEventListener("keydown",$,!0),()=>window.removeEventListener("keydown",$,!0)},[t,e,f,d,l,c,r,i,s,p,g,b,y,n,M,C,L,R,B,q,V,gt,Mt,kt,bt,it,Lt,J,ct,G,vt,_t,ht])}function AB(){return{past:[],future:[]}}function db(n){return n.map(t=>({x:t.x,y:t.y}))}function MB(n){n.past=[],n.future=[]}function CB(n,t,e=100){n.past.push(db(t)),n.past.length>e&&n.past.shift(),n.future=[]}function EB(n,t){if(n.past.length===0)return null;const e=n.past.pop();return n.future.push(db(t)),e}function TB(n,t){if(n.future.length===0)return null;const e=n.future.pop();return n.past.push(db(t)),e}const NB=100;function _B(){const n=H.useRef(AB()),[t,e]=H.useState(!1),[r,i]=H.useState(!1),s=H.useCallback(()=>{e(n.current.past.length>0),i(n.current.future.length>0)},[]),l=H.useCallback(()=>{MB(n.current),e(!1),i(!1)},[]),c=H.useCallback(p=>{CB(n.current,p,NB),s()},[s]),f=H.useCallback(p=>{const g=EB(n.current,p);return s(),g},[s]),d=H.useCallback(p=>{const g=TB(n.current,p);return s(),g},[s]);return{canUndo:t,canRedo:r,reset:l,record:c,undo:f,redo:d}}const hb="tyts-collage-autosave",DB=2e3,LB=.82;function hr(n){return typeof n=="number"&&Number.isFinite(n)}function i6(n){if(!n||typeof n!="object")return!1;const t=n;return hr(t.w)&&hr(t.h)&&t.w>0&&t.h>0}function RB(n){return n===null?!0:i6(n)}function OB(n){if(!n||typeof n!="object")return!1;const t=n;return hr(t.x)&&hr(t.y)&&hr(t.width)&&hr(t.height)&&t.width>0&&t.height>0}function Zu(n){if(!n||typeof n!="object")return!1;const t=n;return hr(t.x)&&hr(t.y)}function PB(n){if(!n||typeof n!="object")return!1;const t=n;if(typeof t.type!="string")return!1;switch(t.type){case"point":case"standalone":return Zu(t);case"linked":{const e=t.pinId;return typeof e=="string"&&e.length>0}case"numbering":return Zu(t.start)&&Zu(t.end);case"polygon":case"polyline":{const e=t.points;return Array.isArray(e)&&e.every(Zu)}case"arrow":{const e=t;return Zu(e.start)&&Zu(e.end)&&Zu(e.control)}case"rectangle":{const e=t;return hr(e.x)&&hr(e.y)&&hr(e.width)&&hr(e.height)}case"ellipse":{const e=t;return hr(e.cx)&&hr(e.cy)&&hr(e.rx)&&hr(e.ry)}case"compass":{const e=t;return hr(e.cx)&&hr(e.cy)&&hr(e.radius)&&e.radius>0}case"redact":{const e=t;return hr(e.x)&&hr(e.y)&&hr(e.width)&&hr(e.height)&&hr(e.strength)&&(e.mode==="blur"||e.mode==="pixelate"||e.mode==="fill")}case"image":{const e=t;return hr(e.x)&&hr(e.y)&&hr(e.width)&&hr(e.height)&&hr(e.aspect)&&typeof e.src=="string"&&e.src.length>0}case"text":{const e=t;return e.point!==void 0&&!Zu(e.point)?!1:hr(e.x)&&hr(e.y)&&hr(e.width)&&hr(e.height)}default:return!1}}function IB(n){if(!n||typeof n!="object")return!1;const t=n;return typeof t.id!="string"||!t.id||typeof t.color!="string"||!t.color||!hr(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&&!hr(t.imageAspect)?!1:PB(t.anchor)}function o6(n){return s6(n)?n:null}function s6(n){if(!n||typeof n!="object")return!1;const t=n;return t.version!==1&&t.version!==2||!hr(t.savedAt)||t.sourceUrl!==void 0&&typeof t.sourceUrl!="string"||t.sourceTitle!==void 0&&typeof t.sourceTitle!="string"||t.capturedAt!==void 0&&!hr(t.capturedAt)||typeof t.backgroundImage!="string"||!t.backgroundImage.startsWith("data:")||!i6(t.imageSize)||!RB(t.sourceImageSize??null)||!Array.isArray(t.pins)||!t.pins.every(IB)||!t.cardPositions||typeof t.cardPositions!="object"?!1:Object.values(t.cardPositions).every(OB)}function jB(n){return new Promise((t,e)=>{const r=new Image;r.onload=()=>t(r),r.onerror=()=>e(new Error("Image load failed")),r.src=n})}function zB(n){return new Promise(t=>{const e=new FileReader;e.onload=()=>{const r=e.result;t(typeof r=="string"?r:null)},e.onerror=()=>t(null),e.readAsDataURL(n)})}async function BB(n){if(n.startsWith("data:"))return n;if(n.startsWith("blob:"))try{const e=await(await fetch(n)).blob();return zB(e)}catch{return null}return n}async function FB(n,t=DB,e=LB){try{const r=await jB(n),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",e)):null}catch{return null}}function gk(n){try{return localStorage.setItem(hb,JSON.stringify(n)),!0}catch(t){if(t instanceof DOMException&&t.name==="QuotaExceededError")return!1;throw t}}function n2(){try{const n=localStorage.getItem(hb);if(!n)return null;const t=JSON.parse(n);return s6(t)?t:null}catch{return null}}function UB(){localStorage.removeItem(hb)}async function HB(n){const t=await BB(n.backgroundImage);if(!t||!t.startsWith("data:"))return{ok:!1,error:"invalid_background"};const e={version:2,savedAt:Date.now(),backgroundImage:t,imageSize:n.imageSize,sourceImageSize:n.sourceImageSize,pins:n.pins,cardPositions:n.cardPositions,sourceUrl:n.sourceUrl,sourceTitle:n.sourceTitle,capturedAt:n.capturedAt};if(gk(e))return{ok:!0,compressed:!1};const r=await FB(t);if(!r)return{ok:!1,error:"quota"};const i={...e,backgroundImage:r};return gk(i)?{ok:!0,compressed:!0}:{ok:!1,error:"quota"}}const qB=800,$B=2e3;function yk(n){return n.backgroundImage?JSON.stringify({backgroundImage:n.backgroundImage,imageSize:n.imageSize,sourceImageSize:n.sourceImageSize,pins:n.pins,cardPositions:n.cardPositions,sourceUrl:n.sourceUrl??null,sourceTitle:n.sourceTitle??null,capturedAt:n.capturedAt??null}):null}function YB({state:n,onRestore:t,enabled:e=!0}){const[r,i]=H.useState("idle"),[s,l]=H.useState(null),[c,f]=H.useState(null),[d,p]=H.useState(()=>n2()),[g,b]=H.useState(!1),[y,M]=H.useState(!1),C=H.useRef(t),L=H.useRef(n),R=H.useRef(null),B=H.useRef(!1),q=H.useRef(!1),V=H.useRef(null),gt=H.useRef(null),Mt=H.useRef(async()=>!1);H.useEffect(()=>{C.current=t,L.current=n});const kt=H.useCallback(async(vt=!1)=>{if(!e)return!1;const _t=L.current;if(!_t.backgroundImage)return!1;const ht=yk(_t);if(!ht)return!1;if(!vt&&ht===R.current)return!0;if(B.current)return q.current=!0,!1;B.current=!0,i("saving"),f(null);const Z=await HB({backgroundImage:_t.backgroundImage,imageSize:_t.imageSize,sourceImageSize:_t.sourceImageSize,pins:_t.pins,cardPositions:_t.cardPositions,sourceUrl:_t.sourceUrl,sourceTitle:_t.sourceTitle,capturedAt:_t.capturedAt});if(B.current=!1,!Z.ok){const It=Z.error==="quota"?"Чернетка занадто велика для localStorage":"Не вдалося зберегти чернетку";return i("error"),f(It),!1}R.current=ht;const ut=Date.now();return l(ut),i("saved"),p(n2()),M(!0),gt.current&&clearTimeout(gt.current),gt.current=setTimeout(()=>M(!1),$B),q.current&&(q.current=!1,queueMicrotask(()=>{Mt.current()})),!0},[e]);H.useEffect(()=>{Mt.current=kt},[kt]);const bt=H.useCallback(()=>{e&&L.current.backgroundImage&&(V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{V.current=null,Mt.current()},qB))},[e]),it=H.useCallback(()=>{e&&(UB(),p(null),b(!0),R.current=null,i("idle"),l(null),f(null),M(!1))},[e]),Lt=H.useCallback(()=>{const vt=n2();return vt?(C.current(vt),R.current=yk({backgroundImage:vt.backgroundImage,imageSize:vt.imageSize,sourceImageSize:vt.sourceImageSize,pins:vt.pins,cardPositions:vt.cardPositions,sourceUrl:vt.sourceUrl,sourceTitle:vt.sourceTitle,capturedAt:vt.capturedAt}),p(vt),l(vt.savedAt),i("saved"),f(null),b(!0),!0):(p(null),!1)},[]),J=H.useCallback(()=>{b(!0)},[]);H.useEffect(()=>{e&&n.backgroundImage&&bt()},[e,n.backgroundImage,n.imageSize,n.sourceImageSize,n.pins,n.cardPositions,n.sourceUrl,n.sourceTitle,n.capturedAt,bt]),H.useEffect(()=>{if(!e)return;const vt=()=>{V.current&&(clearTimeout(V.current),V.current=null),Mt.current()},_t=()=>vt(),ht=()=>{document.visibilityState==="hidden"&&vt()};return window.addEventListener("beforeunload",_t),document.addEventListener("visibilitychange",ht),()=>{window.removeEventListener("beforeunload",_t),document.removeEventListener("visibilitychange",ht),V.current&&clearTimeout(V.current),gt.current&&clearTimeout(gt.current)}},[e]);const ct=e&&d!==null,G=e&&ct&&!n.backgroundImage;return{status:r,lastSavedAt:s,errorMessage:c,hasStoredDraft:ct,canRestore:G,showRestorePrompt:G&&!g,storedDraftSavedAt:d?.savedAt??null,saveFlash:y,saveNow:kt,restoreDraft:Lt,clearDraft:it,dismissRestorePrompt:J}}const pb=1;function VB(n){if(!n||typeof n!="object")return!1;const t=n;if(t.version!==pb)return!1;const e={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 o6(e)!==null}function bk(n){if(VB(n))return n;const t=o6(n);return t?WB(t):null}function WB(n){return{version:pb,backgroundImage:n.backgroundImage,imageSize:n.imageSize,sourceImageSize:n.sourceImageSize,pins:n.pins,cardPositions:n.cardPositions,meta:n.sourceUrl!==void 0||n.sourceTitle!==void 0||n.capturedAt!==void 0?{sourceUrl:n.sourceUrl,sourceTitle:n.sourceTitle,capturedAt:n.capturedAt}:void 0}}function XB(n){return{version:2,savedAt:Date.now(),backgroundImage:n.backgroundImage,imageSize:n.imageSize,sourceImageSize:n.sourceImageSize,pins:n.pins,cardPositions:n.cardPositions,sourceUrl:n.meta?.sourceUrl,sourceTitle:n.meta?.sourceTitle,capturedAt:n.meta?.capturedAt}}function GB(n){return!n.backgroundImage||!n.imageSize.w?null:{version:pb,backgroundImage:n.backgroundImage,imageSize:n.imageSize,sourceImageSize:n.sourceImageSize,pins:n.pins,cardPositions:n.cardPositions,settings:n.settings,meta:n.meta??void 0}}function KB(n){return`${n.length}:${n.slice(0,64)}:${n.slice(-64)}`}function JB(n){return JSON.stringify({...n,backgroundImage:KB(n.backgroundImage)})}async function ZB(n){if(typeof n=="string")return n;const t=await QB(n);if(!t)throw new Error("Failed to read image");return t}async function QB(n){return new Promise(t=>{const e=new FileReader;e.onload=()=>{const r=e.result;t(typeof r=="string"?r:null)},e.onerror=()=>t(null),e.readAsDataURL(n)})}const r2=1;function t9(n){if(!n||typeof n!="object")return!1;const t=n;return typeof t.type=="string"&&t.type.startsWith("tyts:")}const e9=250;function n9(){if(typeof window>"u")return null;try{if(window.parent===window)return null}catch{return null}return{parentWindow:window.parent,post:(n,t)=>window.parent.postMessage(n,t)}}function r9(n){return(n??[]).map(t=>t.trim()).filter(Boolean)}function Ll(n,t){return{code:n,message:t}}function xk(n,t){return n instanceof Error?n.message:t}function i9(n){const t=n.transport===void 0?n9():n.transport,e=r9(n.config?.allowedOrigins),r=e.length===0||e.includes("*"),i=n.config?.token||void 0,s=n.changeDebounceMs??e9;let l=null,c=!1,f=null,d=null;const p=(B,q)=>{c||t?.post(B,q)},g=(B,q,V)=>{n.onError?.(q),p({type:"tyts:error",requestId:B,error:q},V)},b=B=>r||e.includes(B),y=()=>{if(f=null,!d||l===null)return;const B=d;d=null,p({type:"tyts:change",document:B.document,dirty:B.dirty},l)},M=()=>{l===null||c||(f&&clearTimeout(f),f=setTimeout(y,s))},C=(B,q)=>{if(!b(q)){g(B.requestId,Ll("origin_denied",`Origin not allowed: ${q}`),q);return}if(B.protocol!==r2){g(B.requestId,Ll("protocol_mismatch","Unsupported embed protocol version"),q);return}if(i&&B.token!==i){g(B.requestId,Ll("invalid_token","Invalid embed token"),q);return}l=q,(async()=>{try{if(B.document){const V=bk(B.document);if(!V){g(B.requestId,Ll("invalid_document","Invalid initial document"),q);return}await n.editor.loadDocument(V)}p({type:"tyts:initialized",requestId:B.requestId,protocol:r2},q),n.onReady?.(),d&&M()}catch(V){g(B.requestId,Ll("init_failed",xk(V,"Init failed")),q)}})()},L=async(B,q)=>{switch(B.type){case"tyts:loadDocument":{const V=bk(B.document);if(!V){g(B.requestId,Ll("invalid_document","Invalid document"),q);return}await n.editor.loadDocument(V),B.requestId&&p({type:"tyts:done",requestId:B.requestId},q);return}case"tyts:loadImage":await n.editor.loadImage(B.dataUrl),B.requestId&&p({type:"tyts:done",requestId:B.requestId},q);return;case"tyts:getDocument":p({type:"tyts:document",requestId:B.requestId,document:n.editor.getDocument()},q);return;case"tyts:export":{if(B.format==="pdf"){const gt=await n.editor.exportPdf();if(!gt){g(B.requestId,Ll("export_failed","PDF export failed"),q);return}const Mt=await s9(gt);p({type:"tyts:exportResult",requestId:B.requestId,format:"pdf",mime:"application/pdf",dataUrl:Mt},q);return}const V=await n.editor.exportImage(B.format,B.scale??1);if(!V){g(B.requestId,Ll("export_failed","Image export failed"),q);return}p({type:"tyts:exportResult",requestId:B.requestId,format:B.format,mime:V.mime,dataUrl:V.dataUrl},q);return}case"tyts:markSaved":n.editor.markSaved(),B.requestId&&p({type:"tyts:done",requestId:B.requestId},q);return;case"tyts:reset":n.editor.reset(),B.requestId&&p({type:"tyts:done",requestId:B.requestId},q);return;case"tyts:init":return;default:{const V=B;g(V.requestId,Ll("unknown_message",`Unknown message: ${V.type}`),q)}}};return{handleMessage:B=>{if(c||!t||B.source!==t.parentWindow||!t9(B.data))return;const q=B.data,V="requestId"in q?q.requestId:void 0;if(q.type==="tyts:init"){C(q,B.origin);return}if(l===null){g(V,Ll("not_initialized","Editor is not initialized"),B.origin);return}if(B.origin!==l){g(V,Ll("origin_denied",`Origin not allowed: ${B.origin}`),B.origin);return}L(q,l).catch(gt=>{g(V,Ll("handler_error",xk(gt,"Handler error")),B.origin)})},notifyChange(B,q){d={document:B,dirty:q},M()},announceReady(){const B={type:"tyts:ready",protocol:r2};if(r){p(B,"*");return}for(const q of e)p(B,q)},stop(){c=!0,f&&clearTimeout(f),f=null,d=null}}}function o9(n){const t=i9(n),e=r=>{t.handleMessage({data:r.data,origin:r.origin,source:r.source})};return window.addEventListener("message",e),t.announceReady(),{...t,stop(){window.removeEventListener("message",e),t.stop()}}}async function s9(n){return new Promise((t,e)=>{const r=new FileReader;r.onload=()=>{const i=r.result;typeof i=="string"?t(i):e(new Error("Failed to encode blob"))},r.onerror=()=>e(new Error("Failed to encode blob")),r.readAsDataURL(n)})}const a9={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_TYTS_EMBED:"1",VITE_UAF_SANS:"0"};function l9(){return!0}function c9(n=a9){const t=n.VITE_TYTS_EMBED_ALLOWED_ORIGINS,e=typeof t=="string"?t.split(",").map(s=>s.trim()).filter(Boolean):[],r=n.VITE_TYTS_EMBED_TOKEN,i=typeof r=="string"&&r.trim()?r.trim():void 0;return{allowedOrigins:e.length>0?e:void 0,token:i}}function ed(){return typeof window>"u"||window.location.protocol!=="chrome-extension:"?!1:!!globalThis.chrome?.runtime?.id}function u9(n){if(typeof n!="object"||n===null)return!1;const t=n;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 a6(n){const t=new URL(window.location.href);t.searchParams.delete(n),window.history.replaceState(null,"",t.toString())}function f9(){return ed()?new URLSearchParams(window.location.search).has("capture"):!1}function d9(){if(!ed())return!1;const n=new URLSearchParams(window.location.search).get("restore")==="1";return n&&a6("restore"),n}async function h9(){if(!ed())return null;const n=new URLSearchParams(window.location.search).get("capture");if(!n)return null;a6("capture");const t=`capture:${n}`,e=[chrome.storage.session,chrome.storage.local].filter(Boolean);for(const r of e)try{const i=(await r.get(t))[t];if(i===void 0)continue;return r.remove(t),u9(i)?i:null}catch{}return null}const vk="tyts-ext-settings",qh={downloadSubfolder:"Tyts",saveAs:!1};function p9(n){return n.trim().replace(/[/\\]/g,"").replace(/\.\./g,"").replace(/[<>:"|?*]/g,"").slice(0,60)}async function m9(){if(!ed())return{...qh};try{const n=(await chrome.storage.sync.get(vk))[vk];if(!n||typeof n!="object")return{...qh};const t=n;return{downloadSubfolder:typeof t.downloadSubfolder=="string"?p9(t.downloadSubfolder):qh.downloadSubfolder,saveAs:typeof t.saveAs=="boolean"?t.saveAs:qh.saveAs}}catch{return{...qh}}}const Vn="bi",or=14,g9=2800,y9=.5,b9=250,x9=16*ti,v9={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},w9=400,S9=6,k9=1500,A9=150,M9=/\.(png|jpe?g|svg|webp|gif|avif|bmp)$/i;function i2(n){if(!n)return null;const t=Array.from(n.files??[]),e=Array.from(n.items??[]).filter(i=>i.kind==="file").map(i=>i.getAsFile()).filter(i=>!!i);return[...t,...e].find(i=>i.type.startsWith("image/")||M9.test(i.name))??null}const wk=96,Sk=44,de=ti,on=ti*w5,$h=n=>`${Bf[0]*n} ${Bf[1]*n}`;async function kk(n,t){try{const e=await m9(),r=e.downloadSubfolder?`${e.downloadSubfolder}/${t}`:t;return await chrome.downloads.download({url:n,filename:r,saveAs:e.saveAs}),!0}catch{return!1}}function Ak(n,t){const e=t.x-n.x,r=t.y-n.y;return Math.abs(e)>=Math.abs(r)?{x:t.x,y:n.y}:{x:n.x,y:t.y}}const xu=Oa[0];function C9(n){return n.filter(t=>t.anchor.type==="numbering").length+1}function Qu(n){return n.filter(t=>t.anchor.type!=="numbering"&&t.anchor.type!=="linked").length+1}function Mk(n){let t=0,e=0;const r=new Map;return n.map(s=>s.anchor.type==="linked"?s:s.anchor.type==="numbering"?(t+=1,r.set(s.id,t),{...s,label:t}):(e+=1,r.set(s.id,e),{...s,label:e})).map(s=>s.anchor.type==="linked"?{...s,label:r.get(s.anchor.pinId)??s.label}:s)}function E9(n,t){const e=t.x-n.x,r=t.y-n.y;if(e===0&&r===0)return t;const i=Math.max(Math.abs(e),Math.abs(r)),s=e===0?r>=0?1:-1:Math.sign(e),l=r===0?e>=0?1:-1:Math.sign(r);return{x:n.x+s*i,y:n.y+l*i}}function Ck(n,t){return{x:t.x-n.x,y:t.y-n.y}}const l6=5.25*de,Jm=18*on,o2=6*on,Ek={fontSize:12*on,color:"#aaa",flexShrink:0},If={minWidth:28*on,height:28*on,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.18)",color:"#ccc",cursor:"pointer",borderRadius:4*on,fontSize:16*on,padding:`${3*on}px ${8*on}px`,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center"},Rl=4*de,T9=22*de,N9=18*de,_9=12*de,s2=5*de;function Pd(n,t,e,r=1,i=[]){const s=T9*r,l=l6*1.6*r,c=(n.minX+n.maxX)/2,f=(n.minY+n.maxY)/2,d=[{cx:c,cy:n.minY-s},{cx:c,cy:n.maxY+s},{cx:n.maxX+s,cy:f},{cx:n.minX-s,cy:f}],p=g=>{if(g.cx<l||g.cx>t-l||g.cy<l||g.cy>e-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(n.minY+s,e-l))}}function a2(n,t,e=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 n.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>=N9*e)return l;const[f,d]=r[l.handle],p=_9*e*s(l.handle);return{...l,cx:l.cx+f*p,cy:l.cy+d*p}})}function Id({color:n,scale:t=1}){const e=l6*t,r=`M 0 ${-e} L ${e} 0 L 0 ${e} L ${-e} 0 Z`;return E.jsx("path",{d:r,fill:n,stroke:"#fff",strokeWidth:1.5*de*t})}function Tk(n){const t=n.indexOf(",");if(t<0)return null;const e=n.slice(0,t),r=n.slice(t+1),s=e.match(/data:([^;]+)(;base64)?/)?.[1]??"image/png",l=/;base64/i.test(e);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 D9=new Set(["jpg","jpeg","png","webp","gif","bmp","svg","avif","heic","heif"]),L9=15e3;function p5(n){if(!n)return!1;if(n.type.startsWith("image/"))return!0;if(n.type)return!1;const t=n.name.lastIndexOf(".");if(t<0||t===n.name.length-1)return!1;const e=n.name.slice(t+1).toLowerCase();return D9.has(e)}function R9(n,t,e=L9){const r=Math.max(n,t);return r<=e?null:`Зображення завелике (${r} px по довгій стороні). Зменште до ${e} px або менше.`}async function O9(n){const t=URL.createObjectURL(n),e=new Image;try{return await new Promise((r,i)=>{e.onload=()=>r(),e.onerror=()=>i(new Error("Image decode failed")),e.src=t}),{width:e.naturalWidth,height:e.naturalHeight}}catch{return null}finally{URL.revokeObjectURL(t)}}const Ra=24,Nk=[{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 l2(n){switch(n){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 _k(n,t,e){if(!e)return{x:0,y:0,width:n,height:t};let r=n,i=r/e;return i>t&&(i=t,r=i*e),{x:(n-r)/2,y:(t-i)/2,width:r,height:i}}const P9=H.forwardRef(function(t,e){const{mode:r="standalone",initialDocument:i,embedConfig:s,features:l,onReady:c,onChange:f,onError:d}=t,p=r==="embed"||l9(),g=H.useMemo(()=>({autosave:l?.autosave??!p}),[p,l]),b=ud(),y=typeof window<"u"&&(navigator.maxTouchPoints>0||window.matchMedia?.("(pointer: coarse)").matches===!0),M=typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent),[C,L]=H.useState(null),[R,B]=H.useState(null),[q,V]=H.useState(!1),[gt,Mt]=H.useState("free"),[kt,bt]=H.useState(!1),[it,Lt]=H.useState(null),[J,ct]=H.useState(!1),[G,vt]=H.useState({w:0,h:0}),[_t,ht]=H.useState(null),[Z,ut]=H.useState([]),[It,Zt]=H.useState({}),[$,N]=H.useState("select"),[Q,tt]=H.useState(null),[pt,wt]=H.useState(null),[At,Ft]=H.useState(null),[Rt,Jt]=H.useState(null),{canUndo:ke,canRedo:Re,reset:Ie,record:Ve,undo:rt,redo:Oe}=_B(),Cn=H.useRef(Ve);Cn.current=Ve;const cn=At!==null?"polygon":Rt!==null?"polyline":"none",xe=H.useRef(cn);H.useEffect(()=>{xe.current!==cn&&(Ie(),xe.current=cn)},[cn,Ie]);const[we,Ne]=H.useState(null),[De,Fe]=H.useState("point"),[tn,Pn]=H.useState(null),[mn,In]=H.useState(null),hn=H.useRef(null),[Ue,$e]=H.useState(null),[je,nr]=H.useState(null),bn=H.useRef(null),an=H.useRef(null);H.useEffect(()=>{an.current=it},[it]);const ln=H.useRef(null),[Bn,Xe]=H.useState(!1),Mr=H.useRef(!1),[gn,yn]=H.useState(!1),[Qt,ye]=H.useState(!1),[Ce,ve]=H.useState(()=>new Date),[Zn,$n]=H.useState(()=>Ff(new Date)),[xr,Bo]=H.useState(A2),[Ze,ts]=H.useState(!1),[Yt,Ur]=H.useState(null);H.useEffect(()=>{(De!=="numbering"||$!=="place")&&tn&&(Pn(null),In(null),hn.current=null)},[De,$,tn]);const{settings:Ni,fontFamily:Tn,setFontId:fi,setStrokeWidthScale:_i,toggleCalloutPanelCollapsed:ha}=W_(),go=Ni.calloutPanelCollapsed,pr=H.useRef(Tn);pr.current=Tn;const Cr=Ni.strokeWidthScale,no=H.useRef(Cr);no.current=Cr;const Hr=H.useCallback(w=>aS(w,Cr),[Cr]),[sr,Fl]=H.useState(!1),[Ks,es]=H.useState(!1),[pa,No]=H.useState(!1);H.useEffect(()=>{if(!pa)return;const w=S=>{S.key==="Escape"&&No(!1)};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[pa]);const[ma,pc]=H.useState(!1),[Js,di]=H.useState(!1),[sl,Fo]=H.useState(!1),Uo=typeof window<"u"&&!!navigator.clipboard&&"ClipboardItem"in window,[_o,Do]=H.useState(null),[al,Ul]=H.useState(null),[Uc,ns]=H.useState({w:420*on,h:96*on}),ga=H.useRef(null),Lo=H.useRef(null),Fn=H.useRef(null),Ho=H.useRef(!1),vi=H.useRef([]),ro=H.useRef([]),_r=H.useRef(Z),hi=H.useRef(It),Ui=H.useRef(C),vr=H.useRef(null),Rn=H.useRef(G),ya=H.useRef(_t);H.useEffect(()=>{_r.current=Z,hi.current=It},[Z,It]),H.useEffect(()=>{Ui.current=C},[C]),H.useEffect(()=>{Rn.current=G},[G]),H.useEffect(()=>{ya.current=_t},[_t]);const ll=20;function qo(w){const S=E4,D=S2,{w:_,h:I}=Rn.current;let K,nt;if(w.type==="linked")K=0,nt=0;else if(w.type==="point")K=w.x,nt=w.y;else if(w.type==="polygon"||w.type==="polyline"){const lt=w.points;K=Math.max(...lt.map(st=>st.x)),nt=Math.max(...lt.map(st=>st.y))}else w.type==="rectangle"?(K=w.x+w.width,nt=w.y+w.height):w.type==="ellipse"?(K=w.cx+w.rx,nt=w.cy+w.ry):w.type==="compass"?(K=w.cx+w.radius,nt=w.cy+w.radius):w.type==="arrow"?(K=Math.max(w.start.x,w.end.x,w.control.x),nt=Math.max(w.start.y,w.end.y,w.control.y)):w.type==="numbering"?(K=Math.max(w.start.x,w.end.x),nt=Math.max(w.start.y,w.end.y)):w.type==="text"||w.type==="image"?(K=w.x+w.width,nt=w.y+w.height):(K=w.x,nt=w.y);let j=K+ll,Y=nt+ll;return j=Math.max(0,Math.min(j,Math.max(0,_-S))),Y=Math.max(0,Math.min(Y,Math.max(0,I-D))),{x:j,y:Y,width:S,height:D}}const te=H.useCallback(()=>{const w={pins:structuredClone(_r.current),cardPositions:structuredClone(hi.current),backgroundImage:Ui.current,imageSize:structuredClone(Rn.current),sourceImageSize:structuredClone(ya.current)};vi.current=[...vi.current.slice(-99),w],ro.current=[],$o(vi.current.length),Ts(0)},[]),[Zs,$o]=H.useState(0),[mc,Ts]=H.useState(0),Hl=At!==null||Rt!==null,Hc=Hl?ke:Zs>0,Af=Hl?Re:mc>0,Nu=H.useCallback(()=>{if(vi.current.length===0)return;ro.current=[{pins:structuredClone(_r.current),cardPositions:structuredClone(hi.current),backgroundImage:Ui.current,imageSize:structuredClone(Rn.current),sourceImageSize:structuredClone(ya.current)},...ro.current];const w=vi.current.pop();ut(w.pins),Zt(w.cardPositions),L(w.backgroundImage),vt(w.imageSize),ht(w.sourceImageSize),$o(vi.current.length),Ts(ro.current.length)},[]),Ns=H.useCallback(()=>{if(ro.current.length===0)return;vi.current=[...vi.current,{pins:structuredClone(_r.current),cardPositions:structuredClone(hi.current),backgroundImage:Ui.current,imageSize:structuredClone(Rn.current),sourceImageSize:structuredClone(ya.current)}];const w=ro.current.shift();ut(w.pins),Zt(w.cardPositions),L(w.backgroundImage),vt(w.imageSize),ht(w.sourceImageSize),$o(vi.current.length),Ts(ro.current.length)},[]),Ro=H.useCallback(()=>{if(At!==null){const w=rt(At);w!==null&&Ft(w);return}if(Rt!==null){const w=rt(Rt);w!==null&&Jt(w);return}Nu()},[At,Rt,Nu,rt]),rs=H.useCallback(()=>{if(At!==null){const w=Oe(At);w!==null&&Ft(w);return}if(Rt!==null){const w=Oe(Rt);w!==null&&Jt(w);return}Ns()},[At,Rt,Ns,Oe]),ql=H.useRef(null),Oo=H.useRef(null),pn=H.useRef(null),qc=H.useRef(()=>{}),gc=H.useRef(null),yc=H.useRef(null),mr=H.useRef(null),is=H.useRef(null),Yo=H.useRef(!1),yo=H.useRef(null),ss=H.useRef(null),ba=H.useRef(null),Vo=H.useRef(null),za=H.useRef(null),bo=H.useRef(null),Ba=H.useRef(null),Qs=H.useRef(null),Hi=H.useRef(null),Po=H.useRef(null),as=H.useRef(null),_s=H.useRef(null),ta=H.useRef(null),xa=H.useRef(null),ea=H.useRef(null),Ds=H.useRef(null),Ls=H.useRef(null),cl=H.useRef(null),Rs=H.useRef(null),Os=H.useRef(null),$l=H.useRef(null),va=H.useRef(null),Yl=H.useRef(null),wa=H.useRef(null),Vl=H.useRef(null),A=H.useRef(null),F=H.useRef(null),dt=H.useRef(null),Nt=H.useRef(null),Bt=H.useRef(null),ie=H.useRef(null);H.useEffect(()=>{ie.current=At},[At]);const ge=H.useRef(null),Ge=H.useRef(null),rn=H.useRef(null),jn=H.useRef(null),On=H.useRef(null),cr=H.useRef(null),Di=H.useRef(null),pi=H.useRef(null),Er=H.useRef(null),Li=H.useRef(null);H.useEffect(()=>{Li.current=Rt},[Rt]),H.useEffect(()=>{ln.current=Ue},[Ue]),H.useEffect(()=>{hn.current=tn&&mn?{start:tn,end:mn}:null},[tn,mn]);const ce=H.useRef(!1),ei=20,Ri=10,Sn=20,[Dn,Fa]=H.useState(!1),[ls,ul]=H.useState(!1),[wr,Ps]=H.useState(1),[Wl,Oi]=H.useState(!1),[fl,Wo]=H.useState(null);H.useEffect(()=>{if(!C){Wo(null);return}let w=!1;const S=new Image;return S.onload=()=>{w||Wo(S)},S.onerror=()=>{w||Wo(null)},S.src=C,()=>{w=!0}},[C]),H.useLayoutEffect(()=>{const w=ga.current;if(!w)return;const S=()=>{const I=Math.max(1,Math.ceil(w.getBoundingClientRect().width),Math.ceil(w.scrollWidth)),K=Math.max(1,Math.ceil(w.getBoundingClientRect().height),Math.ceil(w.scrollHeight));ns(nt=>nt.w!==I||nt.h!==K?{w:I,h:K}:nt)};S();const D=requestAnimationFrame(S),_=new ResizeObserver(S);return _.observe(w),()=>{cancelAnimationFrame(D),_.disconnect()}},[Q,pt,al]);const bc=H.useRef(null),cs=H.useRef(null),xo=H.useRef(null),xc=H.useRef(null),dl=H.useRef(null),Ua=H.useRef(null),io=H.useRef(null),hl=H.useRef(null),[na,us]=H.useState(!1),[Ha,qa]=H.useState(!1),Vi=H.useRef(null),ni=H.useRef({isPanning:!1,startX:0,startY:0,startScrollLeft:0,startScrollTop:0}),qi=H.useRef(new Map),Is=H.useRef(null),vo=H.useRef(!0),pl=H.useRef(null),ml=H.useRef(1),mi=H.useCallback(w=>{const S=[.25,.5,.75,1,1.25,1.5,1.75,2,2.5,3,3.5,4,5,6,8,10,12,16,20];pl.current="viewport-center",Ps(D=>{const _=Math.min(S[S.length-1],Math.max(S[0],D));let I=0;for(let j=1;j<S.length;j+=1)Math.abs(S[j]-_)<Math.abs(S[I]-_)&&(I=j);const K=w==="in"?Math.min(S.length-1,I+1):Math.max(0,I-1),nt=S[K];return vo.current=!1,nt})},[]),Me=H.useCallback((w,S)=>{if(!is.current)return{x:0,y:0};const D=w,_=S,I=is.current.getBoundingClientRect(),K=wr||1,nt=(D-I.left)/K,j=(_-I.top)/K;return{x:nt,y:j}},[wr]),ur=H.useCallback((w,S,D)=>{const _=new Image;_.onload=()=>{const I=w2,K=Math.min(I/_.naturalWidth,I/_.naturalHeight,Number.POSITIVE_INFINITY),nt=Math.round(_.naturalWidth*K),j=Math.round(_.naturalHeight*K);vt({w:nt,h:j}),ht({w:_.naturalWidth,h:_.naturalHeight}),L(w),tt(null),wt(null),Ft(null),Jt(null),Ne(null),nr(null),V(!1),Lt(null),S&&(ut([]),Zt({})),Yo.current=!0,vo.current=!0,D?.(!0)},_.onerror=()=>{D?.(!1)},_.src=w},[]);H.useEffect(()=>()=>{vr.current&&(URL.revokeObjectURL(vr.current),vr.current=null)},[]),H.useEffect(()=>{if(!C||!mr.current||!G.w||!G.h)return;const w=mr.current,S=G.w*wr,D=G.h*wr,{clientWidth:_,clientHeight:I}=w;if(pl.current==="viewport-center"){const K=ml.current,nt=w.scrollLeft+_/2,j=w.scrollTop+I/2,Y=nt/K,lt=j/K;w.scrollLeft=Math.max(0,Math.min(S-_,Y*wr-_/2)),w.scrollTop=Math.max(0,Math.min(D-I,lt*wr-I/2)),pl.current=null}else vo.current&&(w.scrollLeft=Math.max(0,(S-_)/2),w.scrollTop=Math.max(0,(D-I)/2));ml.current=wr},[C,G.w,G.h,wr]),H.useEffect(()=>{if(!Yo.current||!C||!G.w||!G.h)return;const w=mr.current,S=G.w,D=G.h,_=()=>{const nt=mr.current;if(!nt?.clientWidth||!nt?.clientHeight)return!1;const j=Math.min(nt.clientWidth/S,nt.clientHeight/D);if(!j||!Number.isFinite(j))return!1;const Y=Math.max(Tm,Math.min(Nm,+j.toFixed(_m)));return Yo.current=!1,Ps(Y),!0};if(_())return;let I=0,K=null;return I=requestAnimationFrame(()=>{I=0,!_()&&w&&(K=new ResizeObserver(()=>{_()&&K?.disconnect()}),K.observe(w))}),()=>{I&&cancelAnimationFrame(I),K?.disconnect()}},[C,G.w,G.h]);const wo=H.useCallback(()=>{if(!C||!mr.current||!G.w||!G.h)return;const w=mr.current,{clientWidth:S,clientHeight:D}=w;if(!S||!D)return;const _=Math.min(S/G.w,D/G.h);if(!_||!Number.isFinite(_))return;const I=Math.max(Tm,Math.min(Nm,+_.toFixed(_m)));vo.current=!0,Ps(I)},[C,G.w,G.h]);H.useEffect(()=>{const w=mr.current;if(!w)return;const S=D=>{if(!Ui.current||!(D.ctrlKey||D.metaKey))return;D.preventDefault();const _=w.getBoundingClientRect(),I=D.clientX,K=D.clientY,nt=I-_.left,j=K-_.top,Y=D.deltaY>0?1/Qw:Qw;Ps(lt=>{const st=Math.min(Nm,Math.max(Tm,+(lt*Y).toFixed(_m))),ft=w.scrollLeft+nt,z=w.scrollTop+j,Ct=ft/lt,jt=z/lt,St=Rn.current.w*st,Dt=Rn.current.h*st;return w.scrollLeft=Math.max(0,Math.min(St-w.clientWidth,Ct*st-nt)),w.scrollTop=Math.max(0,Math.min(Dt-w.clientHeight,jt*st-j)),vo.current=!1,st})};return w.addEventListener("wheel",S,{passive:!1}),()=>w.removeEventListener("wheel",S)},[]);const Sa=H.useCallback(async w=>{if(!p5(w))return;const S=await O9(w);if(!S){B("Не вдалося відкрити зображення. Спробуйте інший файл.");return}const D=R9(S.width,S.height);if(D){B(D);return}B(null),Ur(null);const _=URL.createObjectURL(w);ur(_,!0,I=>{if(!I){B("Не вдалося завантажити зображення. Спробуйте файл меншого розміру."),URL.revokeObjectURL(_);return}vr.current&&vr.current!==_&&URL.revokeObjectURL(vr.current),vr.current=_})},[ur]),vc=H.useCallback(w=>{if(!p5(w)||!Ui.current)return;te(),Ur(null);const S=URL.createObjectURL(w);ur(S,!1,D=>{if(!D){URL.revokeObjectURL(S);return}vr.current&&vr.current!==S&&URL.revokeObjectURL(vr.current),vr.current=S})},[ur,te]),gl=w=>{const S=w.target.files?.[0];S&&(Sa(S),w.target.value="")},Xl=w=>{const S=w.target.files?.[0];S&&(vc(S),w.target.value="")},ka=H.useCallback(()=>{if(!Ui.current)return;const{w,h:S}=Rn.current;if(!w||!S)return;const D=l2(gt);Lt(_k(w,S,D)),V(!0),bt(!1),N("select")},[gt]),Gl=H.useCallback(()=>{V(!1),bt(!1),Lt(null),ba.current=null,Vo.current=null},[]),fs=H.useCallback(w=>{Mt(w);const{w:S,h:D}=Rn.current;!S||!D||Lt(_k(S,D,l2(w)))},[]),js=H.useCallback(w=>{if(!an.current)return;w.preventDefault(),w.stopPropagation();const S=Me(w.clientX,w.clientY);ba.current={startRect:an.current,startSvgX:S.x,startSvgY:S.y}},[Me]),ds=H.useCallback((w,S)=>{if(!an.current)return;S.preventDefault(),S.stopPropagation();const D=Me(S.clientX,S.clientY);Vo.current={corner:w,startRect:an.current,startSvgX:D.x,startSvgY:D.y,aspect:l2(gt)}},[gt,Me]),yl=H.useCallback(async()=>{if(!an.current||!Ui.current||!ya.current||!Rn.current.w||!Rn.current.h)return;const w=Ui.current,S=an.current,D=ya.current,_=Rn.current,I=D.w/_.w,K=D.h/_.h,nt=Math.max(0,Math.round(S.x*I)),j=Math.max(0,Math.round(S.y*K)),Y=Math.max(1,Math.round(S.width*I)),lt=Math.max(1,Math.round(S.height*K)),st=new Image;ct(!0);try{await new Promise((xt,qt)=>{st.onload=()=>xt(),st.onerror=()=>qt(new Error("Crop image load failed")),st.src=w});const ft=document.createElement("canvas");ft.width=Y,ft.height=lt;const z=ft.getContext("2d");if(!z)return;z.drawImage(st,nt,j,Y,lt,0,0,Y,lt);const Ct=ft.toDataURL("image/png"),jt=f8(Y,lt),{pins:St,cardPositions:Dt}=h8(_r.current,hi.current,S,jt);te(),ut(St),Zt(Dt),tt(null),wt(null),Do(null),ur(Ct,!1),V(!1),bt(!1),Lt(null)}finally{ct(!1),ba.current=null,Vo.current=null}},[ur,te]);H.useEffect(()=>{const w=S=>{if(C)return;const D=S.clipboardData?.items;if(D){for(const _ of D)if(_.type.startsWith("image/")){S.preventDefault();const I=_.getAsFile();if(!I)return;const K=new FileReader;K.onload=nt=>{const j=nt.target?.result;j&&(Ur(null),ur(j,!0))},K.readAsDataURL(I);return}}};return document.addEventListener("paste",w),()=>document.removeEventListener("paste",w)},[C,ur]),H.useEffect(()=>{const w=D=>{D.dataTransfer?.types?.includes("Files")&&(D.preventDefault(),D.dataTransfer.dropEffect="copy")},S=D=>{if(!D.dataTransfer?.files?.length)return;D.preventDefault();const _=D.dataTransfer.files[0];if(_){if(!Ui.current){Sa(_);return}qc.current(_)}};return window.addEventListener("dragover",w),window.addEventListener("drop",S),()=>{window.removeEventListener("dragover",w),window.removeEventListener("drop",S)}},[Sa]),H.useEffect(()=>{const w=()=>{if(!cs.current)return;const _=cs.current,I=_.scrollWidth>_.clientWidth,K=typeof window<"u"&&window.innerWidth<(y?1280:g9),nt=I||K,j=typeof window<"u"&&window.innerWidth<(y?1040:1320),Y=_.clientWidth<(y?980:1240);Fa(nt),ul(j||I&&Y)};w(),window.addEventListener("resize",w);const S=cs.current;let D=null;return S&&typeof ResizeObserver<"u"&&(D=new ResizeObserver(()=>w()),D.observe(S)),()=>{window.removeEventListener("resize",w),D&&D.disconnect()}},[y]),H.useEffect(()=>{G.w&&Zt(w=>{const S=new Set(Z.filter(I=>I.anchor.type==="text").map(I=>I.id)),D=Object.fromEntries(Object.entries(w).filter(([I])=>!S.has(I))),_=Z.filter(I=>I.anchor.type!=="text").map(I=>I.id);return _.length===0||Object.keys(D).length>0?Object.keys(D).length===Object.keys(w).length?w:D:u8(_,G.w,G.h)})},[Z.length,G]);const Wi=H.useCallback(w=>{if(q||$!=="place"||!C)return;const S=w.target;if(S!==ql.current&&S.getAttribute?.("data-background")!=="true")return;w.preventDefault();const{x:D,y:_}=Me(w.clientX,w.clientY),{w:I,h:K}=Rn.current,nt=Math.max(0,Math.min(D,I)),j=Math.max(0,Math.min(_,K));if(De==="arrow"&&!we&&At===null&&Rt===null){const Y={start:{x:nt,y:j},end:{x:nt,y:j},control:{x:nt,y:j}};ln.current=Y,$e(Y);return}if(De==="numbering"&&!we&&At===null&&Rt===null){const Y={start:{x:nt,y:j},end:{x:nt,y:j}};hn.current=Y,Pn(Y.start),In(Y.end);return}we&&(bn.current={shape:we,x1:nt,y1:j,x2:nt,y2:j},nr({x1:nt,y1:j,x2:nt,y2:j}))},[$,we,C,Me,De,At,Rt,q]),wi=H.useCallback(w=>{if(w&&(w.preventDefault(),w.stopPropagation()),!At||At.length<2)return;const S=_l(),D=xu,_={type:"polygon",points:[...At],rotation:0},I=qo(_);te(),ut(K=>[...K,{id:S,anchor:_,color:D,strokeStyle:Hf,fillStyle:yp,label:Qu(K),image:null,imageAspect:null,description:"",descPos:"below"}]),Zt(K=>({...K,[S]:I})),Ft(null),tt(S),wt(S),N("select"),Fn.current=S,Ho.current=!0},[At,te]),ar=H.useCallback(w=>{if(w&&(w.preventDefault(),w.stopPropagation()),!Rt||Rt.length<2)return;const S=_l(),D=xu,_={type:"polyline",points:[...Rt],rotation:0},I=qo(_);te(),ut(K=>[...K,{id:S,anchor:_,color:D,strokeStyle:Hf,label:Qu(K),image:null,imageAspect:null,description:"",descPos:"below"}]),Zt(K=>({...K,[S]:I})),Jt(null),tt(S),wt(S),N("select"),Fn.current=S,Ho.current=!0},[Rt,te]),Dr=H.useCallback(w=>{if(q)return;const S=w.target;if($!=="place"&&(S===ql.current||S.getAttribute?.("data-background")==="true")){tt(null),wt(null);return}if($!=="place"||!C)return;if(ce.current){ce.current=!1;return}const{x:D,y:_}=Me(w.clientX,w.clientY),{w:I,h:K}=Rn.current;if(D<0||_<0||D>I||_>K)return;let nt=D,j=_;if(At!==null){if(w.shiftKey&&At.length>0){const xt=Ak(At[At.length-1],{x:D,y:_});nt=Math.max(0,Math.min(xt.x,I)),j=Math.max(0,Math.min(xt.y,K))}if(At.length>=2){const xt=At[0];if(Math.hypot(nt-xt.x,j-xt.y)<18*de){w.preventDefault(),w.stopPropagation(),wi(w);return}}Ve(At),Ft(xt=>[...xt??[],{x:nt,y:j}]);return}if(Rt!==null){if(w.shiftKey&&Rt.length>0){const xt=Ak(Rt[Rt.length-1],{x:D,y:_});nt=Math.max(0,Math.min(xt.x,I)),j=Math.max(0,Math.min(xt.y,K))}Ve(Rt),Jt(xt=>[...xt??[],{x:nt,y:j}]);return}if(De==="arrow"||De==="numbering")return;w.preventDefault(),w.stopPropagation();const Y=_l(),lt=xu,st=De==="pointText",ft=De==="text"||st,z=De==="standalone",Ct={width:wk,height:Sk},jt=st?F4({x:D,y:_},z_,Ct):{x:D,y:_},St=ft?{type:"text",x:jt.x,y:jt.y,...Ct,...st?{point:{x:D,y:_}}:{}}:z?{type:"standalone",x:D,y:_}:{type:"point",x:D,y:_},Dt=ft?null:qo(St);te(),ut(xt=>[...xt,{id:Y,anchor:St,color:lt,label:Qu(xt),image:null,imageAspect:null,description:ft?Sy:"",descPos:"below",textColor:st?B_:void 0,textBackgroundColor:st?F_:ft?null:void 0}]),Dt&&Zt(xt=>({...xt,[Y]:Dt})),tt(Y),wt(Y),N("select"),Fn.current=Y,Ho.current=!0,ft&&Do(Y)},[$,C,Me,At,Rt,te,wi,De,q,Ve]),ri=H.useCallback(w=>{if(!C||(he.current=Me(w.clientX,w.clientY),$!=="place"||De!=="numbering"||!tn))return;const{x:S,y:D}=Me(w.clientX,w.clientY),{w:_,h:I}=Rn.current;In({x:Math.max(0,Math.min(S,_)),y:Math.max(0,Math.min(D,I))})},[C,$,De,tn,Me]);H.useEffect(()=>{const w=S=>{S.key==="Enter"&&(At&&At.length>=2?wi():Rt&&Rt.length>=2&&ar()),S.key==="Escape"&&$==="place"&&(S.preventDefault(),tn&&(Pn(null),In(null),hn.current=null),At&&At.length>0&&Ft(null),Rt&&Rt.length>0&&Jt(null),we&&(Ne(null),nr(null),bn.current=null),ln.current&&($e(null),ln.current=null),N("select"))};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[$,tn,At,Rt,wi,ar,we]);const qr=H.useCallback((w,S)=>{if($==="place")return;S.preventDefault();const D=It[w];if(!D)return;te();const _=Me(S.clientX,S.clientY);ce.current=!1,yo.current={pinId:w,startCardX:D.x,startCardY:D.y,startSvgX:_.x,startSvgY:_.y}},[It,Me,$,te]),Aa=H.useCallback((w,S,D)=>{D.preventDefault();const _=It[w];if(!_)return;te();const I=Me(D.clientX,D.clientY);ce.current=!1,ss.current={pinId:w,handle:S,startCardX:_.x,startCardY:_.y,startCardW:_.width,startCardH:_.height,startSvgX:I.x,startSvgY:I.y}},[It,Me,te]);H.useEffect(()=>{const w=_=>Me(_.clientX,_.clientY),S=_=>{const{w:I,h:K}=Rn.current;if(ba.current){const{startRect:nt,startSvgX:j,startSvgY:Y}=ba.current,lt=w(_),st=lt.x-j,ft=lt.y-Y;Lt({x:Math.max(0,Math.min(nt.x+st,I-nt.width)),y:Math.max(0,Math.min(nt.y+ft,K-nt.height)),width:nt.width,height:nt.height});return}if(Vo.current){const{corner:nt,startRect:j,startSvgX:Y,startSvgY:lt,aspect:st}=Vo.current,ft=w(_),z=ft.x-Y,Ct=ft.y-lt;let jt={...j};if(st==null)if(nt==="nw"){const St=j.x+j.width,Dt=j.y+j.height,xt=Math.max(0,Math.min(j.x+z,St-Ra)),qt=Math.max(0,Math.min(j.y+Ct,Dt-Ra));jt={x:xt,y:qt,width:St-xt,height:Dt-qt}}else if(nt==="ne"){const St=j.y+j.height,Dt=Math.max(Ra,Math.min(j.width+z,I-j.x)),xt=Math.max(0,Math.min(j.y+Ct,St-Ra));jt={x:j.x,y:xt,width:Dt,height:St-xt}}else if(nt==="se"){const St=Math.max(Ra,Math.min(j.width+z,I-j.x)),Dt=Math.max(Ra,Math.min(j.height+Ct,K-j.y));jt={x:j.x,y:j.y,width:St,height:Dt}}else{const St=j.x+j.width,Dt=Math.max(0,Math.min(j.x+z,St-Ra)),xt=Math.max(Ra,Math.min(j.height+Ct,K-j.y));jt={x:Dt,y:j.y,width:St-Dt,height:xt}}else{const St=nt==="nw"?{x:j.x+j.width,y:j.y+j.height}:nt==="ne"?{x:j.x,y:j.y+j.height}:nt==="se"?{x:j.x,y:j.y}:{x:j.x+j.width,y:j.y},Dt=nt==="nw"||nt==="sw"?Math.max(0,Math.min(j.x+z,St.x-Ra)):Math.max(St.x+Ra,Math.min(j.x+j.width+z,I)),xt=nt==="nw"||nt==="ne"?Math.max(0,Math.min(j.y+Ct,St.y-Ra)):Math.max(St.y+Ra,Math.min(j.y+j.height+Ct,K)),qt=Math.abs(Dt-St.x),Wt=Math.abs(xt-St.y),fe=nt==="nw"||nt==="sw"?St.x:I-St.x,be=nt==="nw"||nt==="ne"?St.y:K-St.y;let Ee=qt,Je=Wt;Ee/Math.max(1,Je)>st?Je=Ee/st:Ee=Je*st;const En=Math.max(Ra,Math.min(fe,be*st));Ee=Math.max(Ra,Math.min(Ee,En)),Je=Ee/st,jt={x:nt==="nw"||nt==="sw"?St.x-Ee:St.x,y:nt==="nw"||nt==="ne"?St.y-Je:St.y,width:Ee,height:Je}}Lt(jt);return}if(Bt.current){const{pointIndex:nt,startX:j,startY:Y,startSvgX:lt,startSvgY:st}=Bt.current,ft=w(_),z=ft.x-lt,Ct=ft.y-st;(Math.abs(z)>2||Math.abs(Ct)>2)&&(ce.current=!0);const jt=Math.max(0,Math.min(j+z,I)),St=Math.max(0,Math.min(Y+Ct,K));Ft(Dt=>{if(!Dt||nt<0||nt>=Dt.length)return Dt;const xt=[...Dt];return xt[nt]={x:jt,y:St},xt});return}if(On.current){const{pointIndex:nt,startX:j,startY:Y,startSvgX:lt,startSvgY:st}=On.current,ft=w(_),z=ft.x-lt,Ct=ft.y-st;(Math.abs(z)>2||Math.abs(Ct)>2)&&(ce.current=!0);const jt=Math.max(0,Math.min(j+z,I)),St=Math.max(0,Math.min(Y+Ct,K));Jt(Dt=>{if(!Dt||nt<0||nt>=Dt.length)return Dt;const xt=[...Dt];return xt[nt]={x:jt,y:St},xt});return}if(bn.current){const nt=w(_);let j=Math.max(0,Math.min(nt.x,I)),Y=Math.max(0,Math.min(nt.y,K));if(_.shiftKey){const lt=E9({x:bn.current.x1,y:bn.current.y1},{x:j,y:Y});j=Math.max(0,Math.min(lt.x,I)),Y=Math.max(0,Math.min(lt.y,K))}bn.current.x2=j,bn.current.y2=Y,nr({x1:bn.current.x1,y1:bn.current.y1,x2:j,y2:Y});return}if(ln.current){const nt=w(_),j=Math.max(0,Math.min(nt.x,I)),Y=Math.max(0,Math.min(nt.y,K)),lt=ln.current.start;(Math.abs(j-lt.x)>2||Math.abs(Y-lt.y)>2)&&(ce.current=!0);const st={start:lt,end:{x:j,y:Y},control:{x:(lt.x+j)/2,y:(lt.y+Y)/2}};ln.current=st,$e(st);return}if(hn.current){const nt=w(_),j=Math.max(0,Math.min(nt.x,I)),Y=Math.max(0,Math.min(nt.y,K)),lt=hn.current.start;(Math.abs(j-lt.x)>2||Math.abs(Y-lt.y)>2)&&(ce.current=!0);const st={start:lt,end:{x:j,y:Y}};hn.current=st,Pn(lt),In(st.end);return}if(_s.current){const{pinId:nt,startCenterX:j,startCenterY:Y,startDist:lt,startFontSize:st}=_s.current,ft=w(_),z=Math.hypot(ft.x-j,ft.y-Y);Math.abs(z-lt)>1.5&&(ce.current=!0);const Ct=Math.max(.25,z/Math.max(1,lt)),jt=Math.max(10,Math.round(st*Ct));ut(St=>St.map(Dt=>{if(Dt.id!==nt||Dt.anchor.type!=="text")return Dt;const xt=zs(Dt.description||"",{fontSize:jt,bold:Dt.textBold??!1,italic:Dt.textItalic??!1}),qt=xt.width,Wt=xt.height,fe=Math.max(0,Math.min(j-qt/2,I-qt)),be=Math.max(0,Math.min(Y-Wt/2,K-Wt));return{...Dt,textFontSize:jt,anchor:{...Dt.anchor,x:fe,y:be,width:qt,height:Wt}}}));return}if(ea.current){const{pinId:nt,startX:j,startY:Y,startSvgX:lt,startSvgY:st}=ea.current,ft=w(_),z=ft.x-lt,Ct=ft.y-st;(Math.abs(z)>2||Math.abs(Ct)>2)&&(ce.current=!0),ut(jt=>jt.map(St=>St.id!==nt||St.anchor.type!=="redact"?St:{...St,anchor:{...St.anchor,x:Math.max(0,Math.min(j+z,I-St.anchor.width)),y:Math.max(0,Math.min(Y+Ct,K-St.anchor.height))}}));return}if(Ds.current){const{pinId:nt,handle:j,startX:Y,startY:lt,startW:st,startH:ft,startSvgX:z,startSvgY:Ct}=Ds.current,jt=w(_),St=jt.x-z,Dt=jt.y-Ct;(Math.abs(St)>2||Math.abs(Dt)>2)&&(ce.current=!0);const xt=Y+st,qt=lt+ft,Wt=j==="nw"||j==="sw",fe=j==="nw"||j==="ne",be=Wt?Math.min(Y+St,xt-Lm):Y,Ee=fe?Math.min(lt+Dt,qt-Lm):lt,Je=Wt?xt-be:Math.max(Lm,st+St),En=fe?qt-Ee:Math.max(Lm,ft+Dt);ut(pe=>pe.map(Le=>Le.id!==nt||Le.anchor.type!=="redact"?Le:{...Le,anchor:{...Le.anchor,x:be,y:Ee,width:Je,height:En}}));return}if(Ls.current){const{pinId:nt,startX:j,startY:Y,startSvgX:lt,startSvgY:st}=Ls.current,ft=w(_),z=ft.x-lt,Ct=ft.y-st;(Math.abs(z)>2||Math.abs(Ct)>2)&&(ce.current=!0),ut(jt=>jt.map(St=>St.id!==nt||St.anchor.type!=="image"?St:{...St,anchor:{...St.anchor,x:Math.max(0,Math.min(j+z,I-St.anchor.width)),y:Math.max(0,Math.min(Y+Ct,K-St.anchor.height))}}));return}if(cl.current){const{pinId:nt,handle:j,startX:Y,startY:lt,startW:st,startH:ft,startSvgX:z,startSvgY:Ct}=cl.current,jt=w(_),St=jt.x-z,Dt=jt.y-Ct;(Math.abs(St)>2||Math.abs(Dt)>2)&&(ce.current=!0);const qt=Math.max(Rm,st+(j==="ne"||j==="se"?1:-1)*St);ut(Wt=>Wt.map(fe=>{if(fe.id!==nt||fe.anchor.type!=="image")return fe;const be=fe.anchor.aspect||1,Ee=qt,Je=Math.max(Rm,Ee/be),En=j==="nw"||j==="sw"?Y+st-Ee:Y,pe=j==="nw"||j==="ne"?lt+ft-Je:lt;return{...fe,anchor:{...fe.anchor,x:En,y:pe,width:Ee,height:Je}}}));return}if(Hi.current){const{pinId:nt,startPoint:j,startBox:Y,startSvgX:lt,startSvgY:st}=Hi.current,ft=w(_),z=ft.x-lt,Ct=ft.y-st;(Math.abs(z)>2||Math.abs(Ct)>2)&&(ce.current=!0);const jt=Math.max(0,Math.min(j.x+z,I)),St=Math.max(0,Math.min(j.y+Ct,K));ut(Dt=>Dt.map(xt=>xt.id!==nt||xt.anchor.type!=="text"||!xt.anchor.point?xt:{...xt,anchor:{...xt.anchor,point:{x:jt,y:St},x:Y.x+(jt-j.x),y:Y.y+(St-j.y)}}));return}if(Po.current){const{pinId:nt,startX:j,startY:Y,startSvgX:lt,startSvgY:st}=Po.current,ft=w(_),z=ft.x-lt,Ct=ft.y-st;(Math.abs(z)>2||Math.abs(Ct)>2)&&(ce.current=!0),ut(jt=>jt.map(St=>{if(St.id!==nt||St.anchor.type!=="text")return St;const Dt={width:St.anchor.width,height:St.anchor.height};if(St.anchor.point){const Wt={x:j+z+Dt.width/2,y:Y+Ct+Dt.height/2},fe=M8(St.anchor.point,Wt,Dt);return{...St,anchor:{...St.anchor,x:fe.x,y:fe.y}}}const xt=Math.max(0,Math.min(j+z,I-Dt.width)),qt=Math.max(0,Math.min(Y+Ct,K-Dt.height));return{...St,anchor:{...St.anchor,x:xt,y:qt}}}));return}if(za.current){const{pinId:nt,startPinX:j,startPinY:Y,startSvgX:lt,startSvgY:st}=za.current,ft=w(_),z=ft.x-lt,Ct=ft.y-st;(Math.abs(z)>2||Math.abs(Ct)>2)&&(ce.current=!0),ut(jt=>jt.map(St=>St.id!==nt||St.anchor.type!=="point"?St:{...St,anchor:{type:"point",x:Math.max(0,Math.min(j+z,I)),y:Math.max(0,Math.min(Y+Ct,K))}}));return}if(bo.current){const{pinId:nt,startStart:j,startEnd:Y,startSvgX:lt,startSvgY:st}=bo.current,ft=w(_),z=ft.x-lt,Ct=ft.y-st;(Math.abs(z)>2||Math.abs(Ct)>2)&&(ce.current=!0),ut(jt=>jt.map(St=>St.id!==nt||St.anchor.type!=="numbering"?St:{...St,anchor:{type:"numbering",start:{x:Math.max(0,Math.min(j.x+z,I)),y:Math.max(0,Math.min(j.y+Ct,K))},end:{x:Math.max(0,Math.min(Y.x+z,I)),y:Math.max(0,Math.min(Y.y+Ct,K))}}}));return}if(Ba.current){const{pinId:nt,endpoint:j,startStart:Y,startEnd:lt,startSvgX:st,startSvgY:ft}=Ba.current,z=w(_),Ct=z.x-st,jt=z.y-ft;(Math.abs(Ct)>2||Math.abs(jt)>2)&&(ce.current=!0);const St=j==="start"?{x:Math.max(0,Math.min(Y.x+Ct,I)),y:Math.max(0,Math.min(Y.y+jt,K))}:Y,Dt=j==="end"?{x:Math.max(0,Math.min(lt.x+Ct,I)),y:Math.max(0,Math.min(lt.y+jt,K))}:lt;ut(xt=>xt.map(qt=>qt.id!==nt||qt.anchor.type!=="numbering"?qt:{...qt,anchor:{type:"numbering",start:St,end:Dt}}));return}if(ta.current){const{pinId:nt,pointIndex:j,startPoints:Y,startSvgX:lt,startSvgY:st}=ta.current,ft=w(_),z=ft.x-lt,Ct=ft.y-st;(Math.abs(z)>2||Math.abs(Ct)>2)&&(ce.current=!0),ut(jt=>jt.map(St=>{if(St.id!==nt||St.anchor.type!=="polygon")return St;const Dt=[...St.anchor.points];return Dt[j]={x:Math.max(0,Math.min(Y[j].x+z,I)),y:Math.max(0,Math.min(Y[j].y+Ct,K))},{...St,anchor:{type:"polygon",points:Dt,rotation:St.anchor.rotation??0}}}));return}if(xa.current){const{pinId:nt,startPoints:j,startSvgX:Y,startSvgY:lt}=xa.current,st=w(_),ft=st.x-Y,z=st.y-lt;(Math.abs(ft)>2||Math.abs(z)>2)&&(ce.current=!0),ut(Ct=>Ct.map(jt=>{if(jt.id!==nt||jt.anchor.type!=="polygon")return jt;const St=j.map(Dt=>({x:Math.max(0,Math.min(Dt.x+ft,I)),y:Math.max(0,Math.min(Dt.y+z,K))}));return{...jt,anchor:{type:"polygon",points:St,rotation:jt.anchor.rotation??0}}}));return}if(ge.current){const{pinId:nt,pointIndex:j,startPoints:Y,startSvgX:lt,startSvgY:st}=ge.current,ft=w(_),z=ft.x-lt,Ct=ft.y-st;(Math.abs(z)>2||Math.abs(Ct)>2)&&(ce.current=!0),ut(jt=>jt.map(St=>{if(St.id!==nt||St.anchor.type!=="polyline")return St;const Dt=[...St.anchor.points];return Dt[j]={x:Math.max(0,Math.min(Y[j].x+z,I)),y:Math.max(0,Math.min(Y[j].y+Ct,K))},{...St,anchor:{type:"polyline",points:Dt,rotation:St.anchor.rotation??0}}}));return}if(Ge.current){const{pinId:nt,startPoints:j,startSvgX:Y,startSvgY:lt}=Ge.current,st=w(_),ft=st.x-Y,z=st.y-lt;(Math.abs(ft)>2||Math.abs(z)>2)&&(ce.current=!0),ut(Ct=>Ct.map(jt=>{if(jt.id!==nt||jt.anchor.type!=="polyline")return jt;const St=j.map(Dt=>({x:Math.max(0,Math.min(Dt.x+ft,I)),y:Math.max(0,Math.min(Dt.y+z,K))}));return{...jt,anchor:{type:"polyline",points:St,rotation:jt.anchor.rotation??0}}}));return}if(jn.current){const{pinId:nt,handle:j,startPoints:Y,startMinX:lt,startMinY:st,startMaxX:ft,startMaxY:z,startSvgX:Ct,startSvgY:jt}=jn.current,St=w(_);(Math.abs(St.x-Ct)>2||Math.abs(St.y-jt)>2)&&(ce.current=!0);const Dt=Math.max(Sn,ft-lt),xt=Math.max(Sn,z-st);let qt=lt,Wt=st,fe=ft,be=z;switch(j){case"se":fe=Math.max(lt+Sn,St.x),be=Math.max(st+Sn,St.y);break;case"sw":qt=Math.min(ft-Sn,St.x),be=Math.max(st+Sn,St.y);break;case"nw":qt=Math.min(ft-Sn,St.x),Wt=Math.min(z-Sn,St.y);break;case"ne":fe=Math.max(lt+Sn,St.x),Wt=Math.min(z-Sn,St.y);break;case"n":Wt=Math.min(z-Sn,St.y);break;case"s":be=Math.max(st+Sn,St.y);break;case"e":fe=Math.max(lt+Sn,St.x);break;case"w":qt=Math.min(ft-Sn,St.x);break}const Ee=fe-qt,Je=be-Wt,En=Y.map(pe=>({x:qt+(pe.x-lt)/Dt*Ee,y:Wt+(pe.y-st)/xt*Je}));ut(pe=>pe.map(Le=>Le.id!==nt||Le.anchor.type!=="polyline"?Le:{...Le,anchor:{type:"polyline",points:En,rotation:Le.anchor.rotation??0}}));return}if(Nt.current){const{pinId:nt,handle:j,startPoints:Y,startMinX:lt,startMinY:st,startMaxX:ft,startMaxY:z,startSvgX:Ct,startSvgY:jt}=Nt.current,St=w(_);(Math.abs(St.x-Ct)>2||Math.abs(St.y-jt)>2)&&(ce.current=!0);const Dt=Math.max(Sn,ft-lt),xt=Math.max(Sn,z-st);let qt=lt,Wt=st,fe=ft,be=z;switch(j){case"se":fe=Math.max(lt+Sn,St.x),be=Math.max(st+Sn,St.y);break;case"sw":qt=Math.min(ft-Sn,St.x),be=Math.max(st+Sn,St.y);break;case"nw":qt=Math.min(ft-Sn,St.x),Wt=Math.min(z-Sn,St.y);break;case"ne":fe=Math.max(lt+Sn,St.x),Wt=Math.min(z-Sn,St.y);break;case"n":Wt=Math.min(z-Sn,St.y);break;case"s":be=Math.max(st+Sn,St.y);break;case"e":fe=Math.max(lt+Sn,St.x);break;case"w":qt=Math.min(ft-Sn,St.x);break}const Ee=fe-qt,Je=be-Wt,En=Y.map(pe=>({x:qt+(pe.x-lt)/Dt*Ee,y:Wt+(pe.y-st)/xt*Je}));ut(pe=>pe.map(Le=>Le.id!==nt||Le.anchor.type!=="polygon"?Le:{...Le,anchor:{type:"polygon",points:En,rotation:Le.anchor.rotation??0}}));return}if(Rs.current){const{pinId:nt,startX:j,startY:Y,startW:lt,startH:st,startSvgX:ft,startSvgY:z}=Rs.current,Ct=w(_),jt=Ct.x-ft,St=Ct.y-z;(Math.abs(jt)>2||Math.abs(St)>2)&&(ce.current=!0);const Dt=Math.max(0,Math.min(j+jt,I-lt)),xt=Math.max(0,Math.min(Y+St,K-st));ut(qt=>qt.map(Wt=>Wt.id!==nt||Wt.anchor.type!=="rectangle"?Wt:{...Wt,anchor:{type:"rectangle",x:Dt,y:xt,width:lt,height:st,rotation:Wt.anchor.rotation??0}}));return}if(Os.current){const{pinId:nt,startCx:j,startCy:Y,startRx:lt,startRy:st,startSvgX:ft,startSvgY:z}=Os.current,Ct=w(_),jt=Ct.x-ft,St=Ct.y-z;(Math.abs(jt)>2||Math.abs(St)>2)&&(ce.current=!0);const Dt=Math.max(lt,Math.min(j+jt,I-lt)),xt=Math.max(st,Math.min(Y+St,K-st));ut(qt=>qt.map(Wt=>Wt.id!==nt||Wt.anchor.type!=="ellipse"?Wt:{...Wt,anchor:{type:"ellipse",cx:Dt,cy:xt,rx:lt,ry:st,rotation:Wt.anchor.rotation??0}}));return}if(Vl.current){const{pinId:nt,startCx:j,startCy:Y,startRadius:lt,startSvgX:st,startSvgY:ft}=Vl.current,z=w(_),Ct=z.x-st,jt=z.y-ft;(Math.abs(Ct)>2||Math.abs(jt)>2)&&(ce.current=!0);const St=Math.max(lt,Math.min(j+Ct,I-lt)),Dt=Math.max(lt,Math.min(Y+jt,K-lt));ut(xt=>xt.map(qt=>qt.id!==nt||qt.anchor.type!=="compass"?qt:{...qt,anchor:{type:"compass",cx:St,cy:Dt,radius:lt,rotation:qt.anchor.rotation??0}}));return}if(cr.current){const{pinId:nt,startStart:j,startEnd:Y,startControl:lt,startSvgX:st,startSvgY:ft}=cr.current,z=w(_),Ct=z.x-st,jt=z.y-ft;(Math.abs(Ct)>2||Math.abs(jt)>2)&&(ce.current=!0),ut(St=>St.map(Dt=>Dt.id!==nt||Dt.anchor.type!=="arrow"?Dt:{...Dt,anchor:{type:"arrow",start:{x:Math.max(0,Math.min(j.x+Ct,I)),y:Math.max(0,Math.min(j.y+jt,K))},end:{x:Math.max(0,Math.min(Y.x+Ct,I)),y:Math.max(0,Math.min(Y.y+jt,K))},control:{x:Math.max(0,Math.min(lt.x+Ct,I)),y:Math.max(0,Math.min(lt.y+jt,K))}}}));return}if(Di.current){const{pinId:nt,handle:j,startStart:Y,startEnd:lt,startControl:st,startSvgX:ft,startSvgY:z}=Di.current,Ct=w(_),jt=Ct.x-ft,St=Ct.y-z;(Math.abs(jt)>2||Math.abs(St)>2)&&(ce.current=!0),ut(Dt=>Dt.map(xt=>{if(xt.id!==nt||xt.anchor.type!=="arrow")return xt;const qt={...Y},Wt={...lt},fe={...st};return j==="start"?(qt.x=Math.max(0,Math.min(qt.x+jt,I)),qt.y=Math.max(0,Math.min(qt.y+St,K))):j==="end"?(Wt.x=Math.max(0,Math.min(Wt.x+jt,I)),Wt.y=Math.max(0,Math.min(Wt.y+St,K))):(fe.x=Math.max(0,Math.min(fe.x+jt,I)),fe.y=Math.max(0,Math.min(fe.y+St,K))),{...xt,anchor:{type:"arrow",start:qt,end:Wt,control:fe}}}));return}if(Er.current){const{pinId:nt,handle:j,startStart:Y,startEnd:lt,startControl:st,startMinX:ft,startMinY:z,startMaxX:Ct,startMaxY:jt,startSvgX:St,startSvgY:Dt}=Er.current,xt=w(_);(Math.abs(xt.x-St)>2||Math.abs(xt.y-Dt)>2)&&(ce.current=!0);const qt=Math.max(Sn,Ct-ft),Wt=Math.max(Sn,jt-z);let fe=ft,be=z,Ee=Ct,Je=jt;switch(j){case"se":Ee=Math.max(ft+Sn,xt.x),Je=Math.max(z+Sn,xt.y);break;case"sw":fe=Math.min(Ct-Sn,xt.x),Je=Math.max(z+Sn,xt.y);break;case"nw":fe=Math.min(Ct-Sn,xt.x),be=Math.min(jt-Sn,xt.y);break;case"ne":Ee=Math.max(ft+Sn,xt.x),be=Math.min(jt-Sn,xt.y);break;case"n":be=Math.min(jt-Sn,xt.y);break;case"s":Je=Math.max(z+Sn,xt.y);break;case"e":Ee=Math.max(ft+Sn,xt.x);break;case"w":fe=Math.min(Ct-Sn,xt.x);break}const En=Ee-fe,pe=Je-be,Le=ae=>({x:fe+(ae.x-ft)/qt*En,y:be+(ae.y-z)/Wt*pe});ut(ae=>ae.map(An=>An.id!==nt||An.anchor.type!=="arrow"?An:{...An,anchor:{type:"arrow",start:Le(Y),end:Le(lt),control:Le(st)}}));return}if(pi.current){const{pinId:nt,startStart:j,startEnd:Y,startControl:lt,centerX:st,centerY:ft,startAngle:z,startSvgX:Ct,startSvgY:jt}=pi.current,St=w(_);(Math.abs(St.x-Ct)>2||Math.abs(St.y-jt)>2)&&(ce.current=!0);const xt=Math.atan2(St.y-ft,St.x-st)-z,qt=Math.cos(xt),Wt=Math.sin(xt),fe=be=>({x:st+(be.x-st)*qt-(be.y-ft)*Wt,y:ft+(be.x-st)*Wt+(be.y-ft)*qt});ut(be=>be.map(Ee=>Ee.id!==nt||Ee.anchor.type!=="arrow"?Ee:{...Ee,anchor:{type:"arrow",start:fe(j),end:fe(Y),control:fe(lt)}}));return}if(Yl.current){const{pinId:nt,startRotation:j,centerX:Y,centerY:lt,startSvgX:st,startSvgY:ft}=Yl.current,z=w(_);(Math.abs(z.x-st)>2||Math.abs(z.y-ft)>2)&&(ce.current=!0);const Ct=xt=>xt*180/Math.PI,jt=Ct(Math.atan2(ft-lt,st-Y)),St=Ct(Math.atan2(z.y-lt,z.x-Y));let Dt=j+(St-jt);for(;Dt<0;)Dt+=360;for(;Dt>=360;)Dt-=360;ut(xt=>xt.map(qt=>qt.id!==nt||qt.anchor.type!=="rectangle"?qt:{...qt,anchor:{...qt.anchor,rotation:Dt}}));return}if(wa.current){const{pinId:nt,startRotation:j,centerX:Y,centerY:lt,startSvgX:st,startSvgY:ft}=wa.current,z=w(_);(Math.abs(z.x-st)>2||Math.abs(z.y-ft)>2)&&(ce.current=!0);const Ct=xt=>xt*180/Math.PI,jt=Ct(Math.atan2(ft-lt,st-Y)),St=Ct(Math.atan2(z.y-lt,z.x-Y));let Dt=j+(St-jt);for(;Dt<0;)Dt+=360;for(;Dt>=360;)Dt-=360;ut(xt=>xt.map(qt=>qt.id!==nt||qt.anchor.type!=="ellipse"?qt:{...qt,anchor:{...qt.anchor,rotation:Dt}}));return}if(F.current){const{pinId:nt,startRotation:j,centerX:Y,centerY:lt,startSvgX:st,startSvgY:ft}=F.current,z=w(_);(Math.abs(z.x-st)>2||Math.abs(z.y-ft)>2)&&(ce.current=!0);const Ct=xt=>xt*180/Math.PI,jt=Ct(Math.atan2(ft-lt,st-Y)),St=Ct(Math.atan2(z.y-lt,z.x-Y));let Dt=j+(St-jt);for(;Dt<0;)Dt+=360;for(;Dt>=360;)Dt-=360;ut(xt=>xt.map(qt=>qt.id!==nt||qt.anchor.type!=="compass"?qt:{...qt,anchor:{...qt.anchor,rotation:Dt}}));return}if(dt.current){const{pinId:nt,startPoints:j,centerX:Y,centerY:lt,startAngle:st,startRotation:ft,startSvgX:z,startSvgY:Ct}=dt.current,jt=w(_);(Math.abs(jt.x-z)>2||Math.abs(jt.y-Ct)>2)&&(ce.current=!0);const Dt=Math.atan2(jt.y-lt,jt.x-Y)-st,xt=Math.cos(Dt),qt=Math.sin(Dt),Wt=j.map(Ee=>({x:Y+(Ee.x-Y)*xt-(Ee.y-lt)*qt,y:lt+(Ee.x-Y)*qt+(Ee.y-lt)*xt}));let be=ft+(Ee=>Ee*180/Math.PI)(Dt);for(;be<0;)be+=360;for(;be>=360;)be-=360;ut(Ee=>Ee.map(Je=>Je.id!==nt||Je.anchor.type!=="polygon"?Je:{...Je,anchor:{type:"polygon",points:Wt,rotation:be}}));return}if(rn.current){const{pinId:nt,startPoints:j,centerX:Y,centerY:lt,startAngle:st,startRotation:ft,startSvgX:z,startSvgY:Ct}=rn.current,jt=w(_);(Math.abs(jt.x-z)>2||Math.abs(jt.y-Ct)>2)&&(ce.current=!0);const Dt=Math.atan2(jt.y-lt,jt.x-Y)-st,xt=Math.cos(Dt),qt=Math.sin(Dt),Wt=j.map(Ee=>({x:Y+(Ee.x-Y)*xt-(Ee.y-lt)*qt,y:lt+(Ee.x-Y)*qt+(Ee.y-lt)*xt}));let be=ft+(Ee=>Ee*180/Math.PI)(Dt);for(;be<0;)be+=360;for(;be>=360;)be-=360;ut(Ee=>Ee.map(Je=>Je.id!==nt||Je.anchor.type!=="polyline"?Je:{...Je,anchor:{type:"polyline",points:Wt,rotation:be}}));return}if($l.current){const{pinId:nt,handle:j,startX:Y,startY:lt,startW:st,startH:ft,startRotation:z,startSvgX:Ct,startSvgY:jt}=$l.current,St=w(_);(Math.abs(St.x-Ct)>2||Math.abs(St.y-jt)>2)&&(ce.current=!0);const Dt=z*Math.PI/180,xt=Math.cos(Dt),qt=Math.sin(Dt),Wt=Y+st/2,fe=lt+ft/2,be=(Be,vn)=>({x:Wt+Be*xt-vn*qt,y:fe+Be*qt+vn*xt}),Ee={nw:be(-st/2,-ft/2),ne:be(st/2,-ft/2),se:be(st/2,ft/2),sw:be(-st/2,ft/2)},Je={n:be(0,-ft/2),s:be(0,ft/2),e:be(st/2,0),w:be(-st/2,0)},En={nw:Ee.se,ne:Ee.sw,se:Ee.nw,sw:Ee.ne},pe={n:Je.s,s:Je.n,e:Je.w,w:Je.e},Le=En[j]??pe[j],ae=(St.x+Le.x)/2,An=(St.y+Le.y)/2,Hn=Le.x-ae,Sr=Le.y-An,Gr={x:Hn*xt+Sr*qt,y:-Hn*qt+Sr*xt},yi=j==="n"||j==="e"||j==="s"||j==="w",zt=yi?j==="e"||j==="w"?Math.max(ei,2*Math.abs(Gr.x)):st:Math.max(ei,2*Math.abs(Gr.x)),He=yi?j==="n"||j==="s"?Math.max(ei,2*Math.abs(Gr.y)):ft:Math.max(ei,2*Math.abs(Gr.y)),Te=ae-zt/2,ze=An-He/2;ut(Be=>Be.map(vn=>vn.id!==nt||vn.anchor.type!=="rectangle"?vn:{...vn,anchor:{type:"rectangle",x:Te,y:ze,width:zt,height:He,rotation:z}}));return}if(va.current){const{pinId:nt,handle:j,startCx:Y,startCy:lt,startRx:st,startRy:ft,startSvgX:z,startSvgY:Ct}=va.current,jt=w(_);(Math.abs(jt.x-z)>2||Math.abs(jt.y-Ct)>2)&&(ce.current=!0);const{startRotation:St}=va.current,Dt=St*Math.PI/180,xt=Math.cos(Dt),qt=Math.sin(Dt),Wt=(pe,Le)=>({x:Y+pe*xt-Le*qt,y:lt+pe*qt+Le*xt}),fe=j==="nw"||j==="ne"||j==="se"||j==="sw";let be=Y,Ee=lt,Je=st,En=ft;if(fe){const pe={nw:Wt(-st,-ft),ne:Wt(st,-ft),se:Wt(st,ft),sw:Wt(-st,ft)},ae={nw:pe.se,ne:pe.sw,se:pe.nw,sw:pe.ne}[j];be=(jt.x+ae.x)/2,Ee=(jt.y+ae.y)/2;const An=ae.x-be,Hn=ae.y-Ee;Je=Math.max(Ri,Math.abs(An*xt+Hn*qt)),En=Math.max(Ri,Math.abs(-An*qt+Hn*xt))}else{if(j==="n"){const pe=lt+ft;En=Math.max(Ri,(pe-jt.y)/2),Ee=pe-En}else if(j==="s"){const pe=lt-ft;En=Math.max(Ri,(jt.y-pe)/2),Ee=pe+En}else if(j==="e"){const pe=Y-st;Je=Math.max(Ri,(jt.x-pe)/2),be=pe+Je}else if(j==="w"){const pe=Y+st;Je=Math.max(Ri,(pe-jt.x)/2),be=pe-Je}be=Math.max(Je,Math.min(be,I-Je)),Ee=Math.max(En,Math.min(Ee,K-En))}ut(pe=>pe.map(Le=>Le.id!==nt||Le.anchor.type!=="ellipse"?Le:{...Le,anchor:{type:"ellipse",cx:be,cy:Ee,rx:Je,ry:En,rotation:Le.anchor.rotation??0}}));return}if(A.current){const{pinId:nt,startCx:j,startCy:Y,startSvgX:lt,startSvgY:st}=A.current,ft=w(_);(Math.abs(ft.x-lt)>2||Math.abs(ft.y-st)>2)&&(ce.current=!0);const z=Math.hypot(ft.x-j,ft.y-Y),Ct=Math.min(j,Y,I-j,K-Y),jt=Math.max(H8,Math.min(z,Ct));ut(St=>St.map(Dt=>Dt.id!==nt||Dt.anchor.type!=="compass"?Dt:{...Dt,anchor:{type:"compass",cx:j,cy:Y,radius:jt,rotation:Dt.anchor.rotation??0}}));return}if(Qs.current){const{pinId:nt,pointIndex:j,startPoints:Y,startSvgX:lt,startSvgY:st}=Qs.current,ft=w(_),z=ft.x-lt,Ct=ft.y-st;(Math.abs(z)>2||Math.abs(Ct)>2)&&(ce.current=!0);const jt=Y.map((St,Dt)=>Dt===j?{x:Math.max(0,Math.min(St.x+z,I)),y:Math.max(0,Math.min(St.y+Ct,K))}:St);ut(St=>St.map(Dt=>Dt.id===nt?{...Dt,leaderPoints:jt}:Dt));return}if(yo.current){const{pinId:nt,startCardX:j,startCardY:Y,startSvgX:lt,startSvgY:st}=yo.current,ft=w(_),z=ft.x-lt,Ct=ft.y-st;(Math.abs(z)>2||Math.abs(Ct)>2)&&(ce.current=!0),Zt(jt=>{const St=jt[nt];return St?{...jt,[nt]:{...St,x:Math.max(0,Math.min(j+z,I-St.width)),y:Math.max(0,Math.min(Y+Ct,K-St.height))}}:jt});return}if(ss.current){const{pinId:nt,handle:j,startCardX:Y,startCardY:lt,startCardW:st,startCardH:ft,startSvgX:z,startSvgY:Ct}=ss.current,jt=w(_),St=jt.x-z,Dt=jt.y-Ct;(Math.abs(St)>2||Math.abs(Dt)>2)&&(ce.current=!0);let xt=Y,qt=lt,Wt=st,fe=ft;j.includes("e")&&(Wt=Math.max(tS,st+St)),j.includes("s")&&(fe=Math.max(eS,ft+Dt)),j.includes("w")&&(Wt=Math.max(tS,st-St),xt=Y+st-Wt),j.includes("n")&&(fe=Math.max(eS,ft-Dt),qt=lt+ft-fe),xt=Math.max(0,Math.min(xt,I-Wt)),qt=Math.max(0,Math.min(qt,K-fe)),Zt(be=>({...be,[nt]:{x:xt,y:qt,width:Wt,height:fe}}))}},D=()=>{if(ba.current=null,Vo.current=null,bn.current){const _=bn.current,I=20,K=Math.min(_.x1,_.x2),nt=Math.max(_.x1,_.x2),j=Math.min(_.y1,_.y2),Y=Math.max(_.y1,_.y2),lt=Math.max(I,nt-K),st=Math.max(I,Y-j),ft=_l(),z=xu;te();const Ct=_.shape==="rectangle"?{type:"rectangle",x:K,y:j,width:lt,height:st}:_.shape==="redact"?{type:"redact",x:K,y:j,width:lt,height:st,mode:P_,strength:I_}:{type:"ellipse",cx:(K+nt)/2,cy:(j+Y)/2,rx:lt/2,ry:st/2},jt=_.shape==="redact"?null:qo(Ct);ut(St=>[...St,{id:ft,anchor:Ct,color:z,strokeStyle:Hf,fillStyle:yp,label:Qu(St),image:null,imageAspect:null,description:"",descPos:"below"}]),jt&&Zt(St=>({...St,[ft]:jt})),tt(ft),wt(ft),N("select"),nr(null),Ne(null),bn.current=null,Fn.current=ft,Ho.current=!0}if(ln.current){const _=ln.current;if(Math.hypot(_.end.x-_.start.x,_.end.y-_.start.y)>=6){const K=_l(),nt=xu,j={type:"arrow",start:_.start,end:_.end,control:_.control},Y=qo(j);te(),ut(lt=>[...lt,{id:K,anchor:j,color:nt,strokeStyle:Hf,label:Qu(lt),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),Zt(lt=>({...lt,[K]:Y})),tt(K),wt(null),N("select"),Fn.current=K,Ho.current=!0}$e(null),ln.current=null}if(hn.current){const _=hn.current;if(Math.hypot(_.end.x-_.start.x,_.end.y-_.start.y)>=6){const K=_l(),nt=xu;te(),ut(j=>[...j,{id:K,anchor:{type:"numbering",start:_.start,end:_.end},color:nt,label:C9(j),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),tt(K),wt(null),N("select"),Fn.current=K,Ho.current=!0}Pn(null),In(null),hn.current=null}yo.current=null,ss.current=null,za.current=null,bo.current=null,Ba.current=null,Po.current=null,_s.current=null,ta.current=null,Bt.current&&ce.current&&Cn.current(Bt.current.startPoints),Bt.current=null,xa.current=null,ge.current=null,On.current&&ce.current&&Cn.current(On.current.startPoints),On.current=null,Ge.current=null,rn.current=null,jn.current=null,Rs.current=null,Os.current=null,Vl.current=null,$l.current=null,va.current=null,A.current=null,Yl.current=null,wa.current=null,F.current=null,dt.current=null,Nt.current=null,cr.current=null,Di.current=null,pi.current=null,Er.current=null,hn.current=null,Qs.current=null,Hi.current=null,Ls.current=null,cl.current=null,ea.current=null,Ds.current=null};return window.addEventListener("pointermove",S,{passive:!1}),window.addEventListener("pointerup",D),window.addEventListener("pointercancel",D),window.addEventListener("mousemove",S),window.addEventListener("mouseup",D),()=>{window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D),window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",D)}},[Me]);const Kl=H.useCallback((w,S)=>{if($==="place")return;const D=Z.find(I=>I.id===w);if(!D||D.anchor.type!=="point")return;S.preventDefault(),te();const _=Me(S.clientX,S.clientY);ce.current=!1,za.current={pinId:w,startPinX:D.anchor.x,startPinY:D.anchor.y,startSvgX:_.x,startSvgY:_.y}},[$,Z,Me,te]),bl=H.useCallback((w,S)=>{if($==="place")return;const D=Z.find(I=>I.id===w);if(!D||D.anchor.type!=="numbering")return;S.preventDefault(),S.stopPropagation(),te();const _=Me(S.clientX,S.clientY);ce.current=!1,bo.current={pinId:w,startStart:{...D.anchor.start},startEnd:{...D.anchor.end},startSvgX:_.x,startSvgY:_.y}},[$,Z,Me,te]),Jl=H.useCallback((w,S,D)=>{if($==="place")return;const _=Z.find(K=>K.id===w);if(!_||_.anchor.type!=="numbering")return;D.preventDefault(),D.stopPropagation(),te();const I=Me(D.clientX,D.clientY);ce.current=!1,Ba.current={pinId:w,endpoint:S,startStart:{..._.anchor.start},startEnd:{..._.anchor.end},startSvgX:I.x,startSvgY:I.y}},[$,Z,Me,te]),Mf=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=ie.current;if(!D||w<0||w>=D.length)return;const _=D[w],{x:I,y:K}=Me(S.clientX,S.clientY);ce.current=!1,Bt.current={pointIndex:w,startX:_.x,startY:_.y,startSvgX:I,startSvgY:K,startPoints:D.map(nt=>({x:nt.x,y:nt.y}))}},[Me]),Cf=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=Li.current;if(!D||w<0||w>=D.length)return;const _=D[w],{x:I,y:K}=Me(S.clientX,S.clientY);ce.current=!1,On.current={pointIndex:w,startX:_.x,startY:_.y,startSvgX:I,startSvgY:K,startPoints:D.map(nt=>({x:nt.x,y:nt.y}))}},[Me]),_u=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation();const _=_r.current.find(K=>K.id===w);if(!_)return;te();const I=Me(D.clientX,D.clientY);ce.current=!1,Qs.current={pinId:w,pointIndex:S,startPoints:(_.leaderPoints??[]).map(K=>({x:K.x,y:K.y})),startSvgX:I.x,startSvgY:I.y}},[Me,te]),Du=H.useCallback((w,S,D,_)=>{_.preventDefault(),_.stopPropagation();const I=_r.current.find(Y=>Y.id===w);if(!I)return;te();const K=Me(_.clientX,_.clientY);ce.current=!1;const nt=(I.leaderPoints??[]).map(Y=>({x:Y.x,y:Y.y})),j=[...nt.slice(0,S),{x:D.x,y:D.y},...nt.slice(S)];ut(Y=>Y.map(lt=>lt.id===w?{...lt,leaderPoints:j}:lt)),Qs.current={pinId:w,pointIndex:S,startPoints:j,startSvgX:K.x,startSvgY:K.y}},[Me,te]),Zl=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation(),te(),ut(_=>_.map(I=>{if(I.id!==w||!I.leaderPoints)return I;const K=I.leaderPoints.filter((nt,j)=>j!==S);if(K.length===0){const nt={...I};return delete nt.leaderPoints,nt}return{...I,leaderPoints:K}}))},[te]),hs=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation();const _=Z.find(K=>K.id===w);if(!_||_.anchor.type!=="polygon")return;te();const I=Me(D.clientX,D.clientY);ce.current=!1,ta.current={pinId:w,pointIndex:S,startPoints:_.anchor.points.map(K=>({x:K.x,y:K.y})),startSvgX:I.x,startSvgY:I.y}},[Z,Me,te]),$c=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation(),te(),ut(_=>_.map(I=>{if(I.id!==w||I.anchor.type!=="polygon")return I;const K=I.anchor.points;if(K.length<=3)return I;const nt=K.filter((j,Y)=>Y!==S);return{...I,anchor:{type:"polygon",points:nt,rotation:I.anchor.rotation??0}}}))},[te]),Xo=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation();const _=Z.find(ft=>ft.id===w);if(!_||_.anchor.type!=="polygon")return;const I=_.anchor.points,K=I.length,nt=I[S],j=I[(S+1)%K],Y={x:(nt.x+j.x)/2,y:(nt.y+j.y)/2},lt=[...I.slice(0,S+1),Y,...I.slice(S+1)];te(),ut(ft=>ft.map(z=>z.id!==w||z.anchor.type!=="polygon"?z:{...z,anchor:{type:"polygon",points:lt,rotation:z.anchor.rotation??0}}));const st=Me(D.clientX,D.clientY);ce.current=!1,ta.current={pinId:w,pointIndex:S+1,startPoints:lt.map(ft=>({x:ft.x,y:ft.y})),startSvgX:st.x,startSvgY:st.y}},[Z,Me,te]),xl=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=Z.find(I=>I.id===w);if(!D||D.anchor.type!=="polygon")return;te();const _=Me(S.clientX,S.clientY);ce.current=!1,xa.current={pinId:w,startPoints:D.anchor.points.map(I=>({x:I.x,y:I.y})),startSvgX:_.x,startSvgY:_.y}},[Z,Me,te]),Yc=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=Z.find(I=>I.id===w);if(!D||D.anchor.type!=="rectangle")return;te();const _=Me(S.clientX,S.clientY);ce.current=!1,Rs.current={pinId:w,startX:D.anchor.x,startY:D.anchor.y,startW:D.anchor.width,startH:D.anchor.height,startSvgX:_.x,startSvgY:_.y}},[Z,Me,te]),wc=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=Z.find(I=>I.id===w);if(!D||D.anchor.type!=="ellipse")return;te();const _=Me(S.clientX,S.clientY);ce.current=!1,Os.current={pinId:w,startCx:D.anchor.cx,startCy:D.anchor.cy,startRx:D.anchor.rx,startRy:D.anchor.ry,startSvgX:_.x,startSvgY:_.y}},[Z,Me,te]),Sc=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation();const _=Z.find(K=>K.id===w);if(!_||_.anchor.type!=="rectangle")return;te();const I=Me(D.clientX,D.clientY);ce.current=!1,$l.current={pinId:w,handle:S,startX:_.anchor.x,startY:_.anchor.y,startW:_.anchor.width,startH:_.anchor.height,startRotation:_.anchor.rotation??0,startSvgX:I.x,startSvgY:I.y}},[Z,Me,te]),Vc=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation();const _=Z.find(K=>K.id===w);if(!_||_.anchor.type!=="ellipse")return;te();const I=Me(D.clientX,D.clientY);ce.current=!1,va.current={pinId:w,handle:S,startCx:_.anchor.cx,startCy:_.anchor.cy,startRx:_.anchor.rx,startRy:_.anchor.ry,startRotation:_.anchor.rotation??0,startSvgX:I.x,startSvgY:I.y}},[Z,Me,te]),Ma=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation();const _=Z.find(st=>st.id===w);if(!_||_.anchor.type!=="polygon")return;const I=_.anchor.points;if(I.length<2)return;te();const K=Me(D.clientX,D.clientY),nt=Math.min(...I.map(st=>st.x)),j=Math.min(...I.map(st=>st.y)),Y=Math.max(...I.map(st=>st.x)),lt=Math.max(...I.map(st=>st.y));ce.current=!1,Nt.current={pinId:w,handle:S,startPoints:I.map(st=>({x:st.x,y:st.y})),startMinX:nt,startMinY:j,startMaxX:Y,startMaxY:lt,startSvgX:K.x,startSvgY:K.y}},[Z,Me,te]),kc=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=Z.find(nt=>nt.id===w);if(!D||D.anchor.type!=="rectangle")return;te();const _=Me(S.clientX,S.clientY),I=D.anchor.x+D.anchor.width/2,K=D.anchor.y+D.anchor.height/2;ce.current=!1,Yl.current={pinId:w,startRotation:D.anchor.rotation??0,centerX:I,centerY:K,startSvgX:_.x,startSvgY:_.y}},[Z,Me,te]),oo=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=Z.find(I=>I.id===w);if(!D||D.anchor.type!=="ellipse")return;te();const _=Me(S.clientX,S.clientY);ce.current=!1,wa.current={pinId:w,startRotation:D.anchor.rotation??0,centerX:D.anchor.cx,centerY:D.anchor.cy,startSvgX:_.x,startSvgY:_.y}},[Z,Me,te]),Xi=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=Z.find(I=>I.id===w);if(!D||D.anchor.type!=="compass")return;te();const _=Me(S.clientX,S.clientY);ce.current=!1,Vl.current={pinId:w,startCx:D.anchor.cx,startCy:D.anchor.cy,startRadius:D.anchor.radius,startSvgX:_.x,startSvgY:_.y}},[Z,Me,te]),Wc=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation();const _=Z.find(K=>K.id===w);if(!_||_.anchor.type!=="compass")return;te();const I=Me(D.clientX,D.clientY);ce.current=!1,A.current={pinId:w,handle:S,startCx:_.anchor.cx,startCy:_.anchor.cy,startRadius:_.anchor.radius,startRotation:_.anchor.rotation??0,startSvgX:I.x,startSvgY:I.y}},[Z,Me,te]),so=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=Z.find(I=>I.id===w);if(!D||D.anchor.type!=="compass")return;te();const _=Me(S.clientX,S.clientY);ce.current=!1,F.current={pinId:w,startRotation:D.anchor.rotation??0,centerX:D.anchor.cx,centerY:D.anchor.cy,startSvgX:_.x,startSvgY:_.y}},[Z,Me,te]),Xc=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=Z.find(Y=>Y.id===w);if(!D||D.anchor.type!=="polygon")return;const _=D.anchor.points;if(_.length<2)return;te();const I=Me(S.clientX,S.clientY),K=_.reduce((Y,lt)=>Y+lt.x,0)/_.length,nt=_.reduce((Y,lt)=>Y+lt.y,0)/_.length,j=Math.atan2(I.y-nt,I.x-K);ce.current=!1,dt.current={pinId:w,startPoints:_.map(Y=>({x:Y.x,y:Y.y})),centerX:K,centerY:nt,startAngle:j,startRotation:D.anchor.rotation??0,startSvgX:I.x,startSvgY:I.y}},[Z,Me,te]),ps=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation();const _=Z.find(K=>K.id===w);if(!_||_.anchor.type!=="polyline")return;te();const I=Me(D.clientX,D.clientY);ce.current=!1,ge.current={pinId:w,pointIndex:S,startPoints:_.anchor.points.map(K=>({x:K.x,y:K.y})),startSvgX:I.x,startSvgY:I.y}},[Z,Me,te]),Gc=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation(),te(),ut(_=>_.map(I=>{if(I.id!==w||I.anchor.type!=="polyline")return I;const K=I.anchor.points;if(K.length<=2)return I;const nt=K.filter((j,Y)=>Y!==S);return{...I,anchor:{type:"polyline",points:nt,rotation:I.anchor.rotation??0}}}))},[te]),Ql=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation();const _=Z.find(st=>st.id===w);if(!_||_.anchor.type!=="polyline")return;const I=_.anchor.points;if(S>=I.length-1)return;const K=I[S],nt=I[S+1],j={x:(K.x+nt.x)/2,y:(K.y+nt.y)/2},Y=[...I.slice(0,S+1),j,...I.slice(S+1)];te(),ut(st=>st.map(ft=>ft.id!==w||ft.anchor.type!=="polyline"?ft:{...ft,anchor:{type:"polyline",points:Y,rotation:ft.anchor.rotation??0}}));const lt=Me(D.clientX,D.clientY);ce.current=!1,ge.current={pinId:w,pointIndex:S+1,startPoints:Y.map(st=>({x:st.x,y:st.y})),startSvgX:lt.x,startSvgY:lt.y}},[Z,Me,te]),$a=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=Z.find(I=>I.id===w);if(!D||D.anchor.type!=="polyline")return;te();const _=Me(S.clientX,S.clientY);ce.current=!1,Ge.current={pinId:w,startPoints:D.anchor.points.map(I=>({x:I.x,y:I.y})),startSvgX:_.x,startSvgY:_.y}},[Z,Me,te]),Ac=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=Z.find(I=>I.id===w);if(!D||D.anchor.type!=="arrow")return;te();const _=Me(S.clientX,S.clientY);ce.current=!1,cr.current={pinId:w,startStart:{...D.anchor.start},startEnd:{...D.anchor.end},startControl:{...D.anchor.control},startSvgX:_.x,startSvgY:_.y}},[Z,Me,te]),Ya=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation();const _=Z.find(K=>K.id===w);if(!_||_.anchor.type!=="arrow")return;te();const I=Me(D.clientX,D.clientY);ce.current=!1,Di.current={pinId:w,handle:S,startStart:{..._.anchor.start},startEnd:{..._.anchor.end},startControl:{..._.anchor.control},startSvgX:I.x,startSvgY:I.y}},[Z,Me,te]),tc=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation();const _=Z.find(st=>st.id===w);if(!_||_.anchor.type!=="arrow")return;te();const I=[_.anchor.start,_.anchor.end,_.anchor.control],K=Math.min(...I.map(st=>st.x)),nt=Math.min(...I.map(st=>st.y)),j=Math.max(...I.map(st=>st.x)),Y=Math.max(...I.map(st=>st.y)),lt=Me(D.clientX,D.clientY);ce.current=!1,Er.current={pinId:w,handle:S,startStart:{..._.anchor.start},startEnd:{..._.anchor.end},startControl:{..._.anchor.control},startMinX:K,startMinY:nt,startMaxX:j,startMaxY:Y,startSvgX:lt.x,startSvgY:lt.y}},[Z,Me,te]),Kc=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=Z.find(Y=>Y.id===w);if(!D||D.anchor.type!=="arrow")return;te();const _=Me(S.clientX,S.clientY),I=[D.anchor.start,D.anchor.end,D.anchor.control],K=I.reduce((Y,lt)=>Y+lt.x,0)/I.length,nt=I.reduce((Y,lt)=>Y+lt.y,0)/I.length,j=Math.atan2(_.y-nt,_.x-K);ce.current=!1,pi.current={pinId:w,startStart:{...D.anchor.start},startEnd:{...D.anchor.end},startControl:{...D.anchor.control},centerX:K,centerY:nt,startAngle:j,startSvgX:_.x,startSvgY:_.y}},[Z,Me,te]),ms=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation();const _=Z.find(st=>st.id===w);if(!_||_.anchor.type!=="polyline")return;te();const I=_.anchor.points,K=Math.min(...I.map(st=>st.x)),nt=Math.min(...I.map(st=>st.y)),j=Math.max(...I.map(st=>st.x)),Y=Math.max(...I.map(st=>st.y)),lt=Me(D.clientX,D.clientY);ce.current=!1,jn.current={pinId:w,handle:S,startPoints:I.map(st=>({x:st.x,y:st.y})),startMinX:K,startMinY:nt,startMaxX:j,startMaxY:Y,startSvgX:lt.x,startSvgY:lt.y}},[Z,Me,te]),ec=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=Z.find(Y=>Y.id===w);if(!D||D.anchor.type!=="polyline")return;const _=D.anchor.points;if(_.length<2)return;te();const I=Me(S.clientX,S.clientY),K=_.reduce((Y,lt)=>Y+lt.x,0)/_.length,nt=_.reduce((Y,lt)=>Y+lt.y,0)/_.length,j=Math.atan2(I.y-nt,I.x-K);ce.current=!1,rn.current={pinId:w,startPoints:_.map(Y=>({x:Y.x,y:Y.y})),centerX:K,centerY:nt,startAngle:j,startRotation:D.anchor.rotation??0,startSvgX:I.x,startSvgY:I.y}},[Z,Me,te]),vl=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=Z.find(nt=>nt.id===w);if(!D||D.anchor.type!=="text")return;tt(w),wt(w);const _=performance.now(),I=as.current;if(I&&I.pinId===w&&_-I.time<=w9&&Math.hypot(S.clientX-I.x,S.clientY-I.y)<=S9){as.current=null,Po.current=null,Do(w);return}as.current={pinId:w,time:_,x:S.clientX,y:S.clientY},te();const K=Me(S.clientX,S.clientY);ce.current=!1,Po.current={pinId:w,startX:D.anchor.x,startY:D.anchor.y,startSvgX:K.x,startSvgY:K.y}},[Z,Me,te]),wl=H.useCallback(async w=>{const S=await new Promise(ft=>{const z=new FileReader;z.onload=Ct=>ft(Ct.target?.result??null),z.onerror=()=>ft(null),z.readAsDataURL(w)});if(!S)return;const D=await new Promise(ft=>{const z=new Image;z.onload=()=>ft({w:z.naturalWidth||wy,h:z.naturalHeight||wy}),z.onerror=()=>ft(null),z.src=S});if(!D)return;const _=D.w/D.h,I=wy/Math.max(D.w,D.h),K=Math.max(Rm,D.w*I),nt=Math.max(Rm,D.h*I),{w:j,h:Y}=Rn.current,lt={type:"image",x:Math.max(0,(j-K)/2),y:Math.max(0,(Y-nt)/2),width:K,height:nt,src:S,aspect:_},st=_l();te(),ut(ft=>[...ft,{id:st,anchor:lt,color:xu,label:Qu(ft),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),Zt(ft=>({...ft,[st]:qo(lt)})),tt(st),wt(st),N("select")},[te]);qc.current=wl;const Mc=H.useRef(0),ao=H.useCallback(w=>{const S=Date.now();S-Mc.current<800||(Mc.current=S,wl(w),us(!1))},[wl]);H.useEffect(()=>{if(!na)return;Vi.current?.focus();const w=D=>{const _=i2(D.clipboardData);_&&(D.preventDefault(),D.stopPropagation(),ao(_))},S=D=>{if(D.key==="Escape"){us(!1);return}!(b?D.metaKey:D.ctrlKey)||D.shiftKey||D.altKey||D.code!=="KeyV"||(async()=>{try{const I=await Promise.race([navigator.clipboard?.read?.(),new Promise(K=>setTimeout(()=>K(void 0),k9))]);for(const K of I??[]){const nt=K.types.find(Y=>Y.startsWith("image/"));if(!nt)continue;const j=await K.getType(nt);ao(new File([j],"clipboard",{type:nt}));return}}catch{}})()};return window.addEventListener("paste",w,!0),window.addEventListener("keydown",S,!0),()=>{window.removeEventListener("paste",w,!0),window.removeEventListener("keydown",S,!0)}},[na,b,ao]);const gs=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=_r.current.find(I=>I.id===w);if(!D||D.anchor.type!=="redact")return;te();const _=Me(S.clientX,S.clientY);ce.current=!1,ea.current={pinId:w,startX:D.anchor.x,startY:D.anchor.y,startSvgX:_.x,startSvgY:_.y}},[Me,te]),Va=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation();const _=_r.current.find(K=>K.id===w);if(!_||_.anchor.type!=="redact")return;te();const I=Me(D.clientX,D.clientY);ce.current=!1,Ds.current={pinId:w,handle:S,startX:_.anchor.x,startY:_.anchor.y,startW:_.anchor.width,startH:_.anchor.height,startSvgX:I.x,startSvgY:I.y}},[Me,te]),ys=H.useCallback((w,S)=>{te(),ut(D=>D.map(_=>_.id===w&&_.anchor.type==="redact"?{..._,anchor:{..._.anchor,...S}}:_))},[te]),bs=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=_r.current.find(I=>I.id===w);if(!D||D.anchor.type!=="image")return;te();const _=Me(S.clientX,S.clientY);ce.current=!1,Ls.current={pinId:w,startX:D.anchor.x,startY:D.anchor.y,startSvgX:_.x,startSvgY:_.y}},[Me,te]),Go=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation();const _=_r.current.find(K=>K.id===w);if(!_||_.anchor.type!=="image")return;te();const I=Me(D.clientX,D.clientY);ce.current=!1,cl.current={pinId:w,handle:S,startX:_.anchor.x,startY:_.anchor.y,startW:_.anchor.width,startH:_.anchor.height,startSvgX:I.x,startSvgY:I.y}},[Me,te]),Ef=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const D=_r.current.find(I=>I.id===w);if(!D||D.anchor.type!=="text"||!D.anchor.point)return;te();const _=Me(S.clientX,S.clientY);ce.current=!1,tt(w),Hi.current={pinId:w,startPoint:{...D.anchor.point},startBox:{x:D.anchor.x,y:D.anchor.y},startSvgX:_.x,startSvgY:_.y}},[Me,te]),Lu=H.useCallback((w,S,D)=>{D.preventDefault(),D.stopPropagation();const _=Z.find(j=>j.id===w);if(!_||_.anchor.type!=="text")return;te();const I=Me(D.clientX,D.clientY),K=_.anchor.x+_.anchor.width/2,nt=_.anchor.y+_.anchor.height/2;_s.current={pinId:w,handle:S,startCenterX:K,startCenterY:nt,startDist:Math.max(1,Math.hypot(I.x-K,I.y-nt)),startFontSize:_.textFontSize??Vs},ce.current=!1},[Z,te,Me]),zs=H.useCallback((w,S)=>{const D=S?.fontSize??Vs,_=S?.bold?"700":"400",I=S?.italic?"italic ":"",nt=document.createElement("canvas").getContext("2d");return nt?(nt.font=`${I}${_} ${D}px ${pr.current}`,p8(w,j=>nt.measureText(j).width,S)):{width:wk,height:Sk}},[]),Jc=H.useCallback((w,S)=>{const D=_r.current.find(nt=>nt.id===w);if(!D||D.anchor.type!=="text")return;const _=zs(S,{fontSize:D.textFontSize??Vs,bold:D.textBold??!1,italic:D.textItalic??!1}),I=_.width,K=_.height;ut(nt=>nt.map(j=>{if(j.id!==w||j.anchor.type!=="text")return j;const Y=Math.max(0,Rn.current.w-I),lt=Math.max(0,Rn.current.h-K);return{...j,anchor:{...j.anchor,width:I,height:K,x:Math.max(0,Math.min(j.anchor.x,Y)),y:Math.max(0,Math.min(j.anchor.y,lt))}}}))},[zs]),$r=H.useCallback(w=>{const S=w.trim()?w:Sy;if(typeof document>"u")return S;const D=document.createElement("div");return D.innerHTML=S,D.querySelectorAll("p").forEach(_=>{_.style.margin="0",_.style.padding="0"}),D.innerHTML},[]),Lr=H.useCallback((w=new Date,S=A2)=>{if(!C)return;const{w:D,h:_}=Rn.current;if(!D||!_)return;const I=Bd(w,S),K=$r(`<p>${I}</p>`),nt=zs(K,{fontSize:Vs,bold:!1,italic:!1}),j=12*de,Y=Math.max(0,Math.min(j,D-nt.width)),lt=Math.max(0,Math.min(_-nt.height-j,_-nt.height)),st=_l(),ft=xu;te(),ut(z=>[...z,{id:st,anchor:{type:"text",x:Y,y:lt,width:nt.width,height:nt.height},color:ft,label:Qu(z),image:null,imageAspect:null,description:K,descPos:"below",textColor:"#FFFFFF",textBackgroundColor:"#000000"}]),tt(st),wt(st),Do(st),N("select"),Fn.current=st,Ho.current=!0,yn(!1)},[C,zs,$r,te]),rr=H.useCallback(w=>{if(!C)return;const{w:S,h:D}=Rn.current;if(!S||!D)return;const _=Y4,{cx:I,cy:K}=$8(w,S,D,_),nt=_l(),j=xu;te(),ut(Y=>[...Y,{id:nt,anchor:{type:"compass",cx:I,cy:K,radius:_,rotation:0},color:j,label:Qu(Y),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),tt(nt),wt(nt),N("select"),Fn.current=nt,Ho.current=!0,ye(!1)},[C,te]),Io=H.useCallback(()=>{us(w=>!w)},[]),ii=H.useCallback(()=>{C&&(yn(!1),ye(w=>!w))},[C]),ra=H.useCallback(()=>{C&&(ye(!1),yn(w=>{if(w)return!1;if(Ze)$n(Ff(Ce));else{const S=new Date;ve(S),$n(Ff(S))}return!0}))},[C,Ce,Ze]),Sl=H.useCallback(()=>{const w=new Date;ve(w),$n(Ff(w))},[]),Ru=H.useCallback(()=>{Lr(Ze?Ce:new Date,xr)},[Ce,xr,Ze,Lr]),Wa=H.useCallback(()=>{Lr(Ce,xr)},[Ce,xr,Lr]),Pi=H.useCallback((w,S)=>{const D=document.querySelector(`div[data-text-pin-id="${w}"]`);if(!D)return!1;const _=window.getSelection();if(!_||_.rangeCount===0)return!1;const I=_.getRangeAt(0);if(I.collapsed||!D.contains(I.commonAncestorContainer))return!1;te(),D.focus(),document.execCommand(S,!1);const K=$r(D.innerHTML);return D.innerHTML=K,ut(nt=>nt.map(j=>j.id===w?{...j,description:K}:j)),Jc(w,K),!0},[te,Jc,$r]),Bs=H.useCallback((w,S)=>{const D=_r.current.find(_=>_.id===w);!D||D.description===S||(te(),ut(_=>_.map(I=>I.id===w?{...I,description:S}:I)))},[te]),Zc=H.useCallback(w=>{const S=Lo.current;if(!S)return;const D=$r(S.innerHTML);Bs(w,D),Jc(w,D)},[Jc,$r,Bs]);H.useEffect(()=>{if(!al)return;const w=S=>{S.target?.closest('[data-text-bg-picker="true"]')||Ul(null)};return window.addEventListener("pointerdown",w,!0),()=>window.removeEventListener("pointerdown",w,!0)},[al]),H.useEffect(()=>{if(!_o){Lo.current=null;return}const w=_r.current.find(_=>_.id===_o);if(!w||w.anchor.type!=="text")return;const S=$r(w.description),D=!w.description.trim()||w.description===Sy;requestAnimationFrame(()=>{const _=Lo.current;if(!_)return;_.innerHTML!==S&&(_.innerHTML=S),_.focus();const I=document.createRange();I.selectNodeContents(_),D||I.collapse(!1);const K=window.getSelection();K?.removeAllRanges(),K?.addRange(I)})},[_o,$r]),H.useEffect(()=>{if(!_o)return;const w=S=>{const D=S.target,_=Lo.current;!_||D&&_.contains(D)||(Zc(_o),Do(null))};return window.addEventListener("pointerdown",w,!0),()=>window.removeEventListener("pointerdown",w,!0)},[_o,Zc]);const kl=H.useCallback((w,S)=>{const D=new Image;D.onload=()=>{const _=D.naturalWidth/D.naturalHeight;te(),ut(I=>I.map(K=>K.id===w?{...K,image:S,imageAspect:_}:K))},D.src=S},[te]);H.useEffect(()=>{const w=S=>{const D=pt??Q;if(!D){if(!Ui.current)return;const st=i2(S.clipboardData);if(!st)return;S.preventDefault(),ao(st);return}const _=_r.current.find(st=>st.id===D)??null,I=S.target,K=I?.tagName,nt=K==="TEXTAREA"||K==="INPUT"&&!I.readOnly&&!I.disabled,j=!!I&&(I.isContentEditable||I.closest(".ProseMirror")!==null||nt),Y=S.clipboardData?.items;if(Y){for(const st of Y)if(st.type.startsWith("image/")){S.preventDefault(),S.stopPropagation();const ft=st.getAsFile();if(!ft)return;const z=new FileReader;z.onload=Ct=>{const jt=Ct.target?.result;jt&&kl(D,jt)},z.readAsDataURL(ft);return}}let lt=S.clipboardData?.getData("text/plain")??"";if(!lt&&S.clipboardData?.items?.length){for(const ft of S.clipboardData.items)if(ft.kind==="string"&&ft.type==="text/plain"){S.preventDefault();const z=D,Ct=pt;ft.getAsString(jt=>{const St=jt??"";if(St.trim()){if(Ct&&z===Ct&&_?.anchor.type!=="text"){document.dispatchEvent(new CustomEvent(c0,{detail:{pinId:Ct,text:St},bubbles:!0}));return}Bs(z,St)}});return}const st=S.clipboardData.getData("text/html");if(st)try{lt=new DOMParser().parseFromString(st,"text/html").body?.textContent??""}catch{lt=""}}if(lt.trim().length>0){if(pt&&D===pt&&_?.anchor.type!=="text"){S.preventDefault(),S.stopPropagation(),document.dispatchEvent(new CustomEvent(c0,{detail:{pinId:pt,text:lt},bubbles:!0}));return}if(j)return;S.preventDefault(),Bs(D,lt)}};return document.addEventListener("paste",w,!0),()=>document.removeEventListener("paste",w,!0)},[pt,Q,kl,Bs,ao]);const Al=H.useCallback((w,S)=>{te(),ut(D=>D.map(_=>_.id===w?{..._,color:S}:_))},[te]),Xa=H.useCallback((w,S)=>{te(),ut(D=>D.map(_=>_.id!==w||!k0(_.anchor)?_:{..._,strokeStyle:S}))},[te]),ia=H.useCallback((w,S)=>{te(),ut(D=>D.map(_=>_.id!==w||!A5(_.anchor)?_:{..._,fillStyle:S}))},[te]),Ca=H.useCallback((w,S)=>{te(),ut(D=>D.map(_=>{if(_.id!==w)return _;if(S===null){const I={..._};return delete I.strokeWidthScale,I}return{..._,strokeWidthScale:od(S)}}))},[te]),xs=H.useCallback((w,S)=>{te(),ut(D=>j8(D,w,S))},[te]),Cc=H.useCallback(w=>{te(),ut(S=>S.map(D=>D.id===w?{...D,descPos:D.descPos==="above"?"below":"above"}:D))},[te]),vs=H.useCallback(w=>{te();const S=S_(w,_r.current);ut(D=>Mk(D.filter(_=>!S.has(_.id)))),Zt(D=>{const _={...D};for(const I of S)delete _[I];return _}),tt(null),wt(null),Do(D=>D===w?null:D)},[te]),Ml=H.useCallback(w=>{const S=_r.current.find(Ct=>Ct.id===w),D=S?v2(S,_r.current):null;if(!D||!Zw(D))return;const _=D.id;te();const I=_l(),nt=[_,...v5(_,_r.current)].map(Ct=>hi.current[Ct]).filter(Ct=>!!Ct),j=nt.length>0?nt.reduce((Ct,jt)=>jt.y+jt.height>Ct.y+Ct.height?jt:Ct):qo(D.anchor),{w:Y,h:lt}=Rn.current,st=j.width,ft=S2,z={x:Math.max(0,Math.min(j.x+ll,Math.max(0,Y-st))),y:Math.max(0,Math.min(j.y+j.height+ll,Math.max(0,lt-ft))),width:st,height:ft};ut(Ct=>[...Ct,{id:I,anchor:{type:"linked",pinId:_},color:D.color,label:D.label,image:null,imageAspect:null,description:"",descPos:D.descPos,theme:D.theme,textFontSize:D.textFontSize}]),Zt(Ct=>({...Ct,[I]:z})),Fn.current=I,tt(I),wt(I)},[te]),Ec=H.useCallback((w,S)=>{te(),ut(D=>D.map(_=>_.id===w?{..._,calloutHidden:S}:_)),S?(tt(w),wt(null)):(tt(w),wt(w))},[te]),$i=H.useCallback(async(w="png",S=1,D)=>{if(!Ui.current||!Rn.current.w)return;const _=zt=>new Promise((He,Te)=>{const ze=new Image;ze.onload=()=>He(ze),ze.onerror=Te,ze.src=zt});let I=null;try{I=await _(Ui.current)}catch{I=null}const K=_r.current,nt=hi.current,{w:j,h:Y}=Rn.current;if(!j)return;const st=2*(S||1),ft=document.createElement("canvas");ft.width=j*st,ft.height=Y*st;const z=ft.getContext("2d");z.scale(st,st);const Ct=(zt,He,Te,ze,Be)=>{z.beginPath(),z.moveTo(zt+Be,He),z.lineTo(zt+Te-Be,He),z.arcTo(zt+Te,He,zt+Te,He+Be,Be),z.lineTo(zt+Te,He+ze-Be),z.arcTo(zt+Te,He+ze,zt+Te-Be,He+ze,Be),z.lineTo(zt+Be,He+ze),z.arcTo(zt,He+ze,zt,He+ze-Be,Be),z.lineTo(zt,He+Be),z.arcTo(zt,He,zt+Be,He,Be),z.closePath()},jt=await Promise.allSettled(K.map(zt=>zt.image?_(zt.image):Promise.resolve(null))),St=await Promise.all(K.filter(zt=>zt.anchor.type==="image").map(async zt=>{const He=zt.anchor.type==="image"?zt.anchor.src:"";try{return[zt.id,await _(He)]}catch{return[zt.id,null]}})),Dt=new Map(St),xt=new Map(jt.map((zt,He)=>[K[He].id,zt.status==="fulfilled"?zt.value:null]));I&&z.drawImage(I,0,0,j,Y);const qt=zt=>aS(zt,no.current),Wt=zt=>`${zt.i?"italic ":""}${zt.b?"700":"400"} ${zt.fs}px ${pr.current}`,fe=new Map,be=zt=>{const He=Wt(zt),Te=fe.get(He);if(Te)return Te;z.font=He;const ze=z.measureText("Hg"),Be=ze.fontBoundingBoxAscent||zt.fs*.8,vn=ze.fontBoundingBoxDescent||zt.fs*.2,Ir={asc:Be,desc:vn};return fe.set(He,Ir),Ir},Ee={measure:(zt,He)=>(z.font=Wt(He),z.measureText(zt).width),contentHeight:zt=>{const{asc:He,desc:Te}=be(zt);return He+Te},ascentRatio:zt=>{const{asc:He,desc:Te}=be(zt);return He+Te>0?He/(He+Te):.8}},Je=vg(K);z.lineCap="round";const En=zt=>{if(zt.calloutHidden||zt.anchor.type==="text"||zt.anchor.type==="standalone"||zt.anchor.type==="redact")return;const He=nt[zt.id];if(!He)return;const Te=Em(zt,K);if(!Te)return;const ze=og(Te,He,zt.leaderPoints);z.beginPath(),ze.forEach((Be,vn)=>vn===0?z.moveTo(Be.x,Be.y):z.lineTo(Be.x,Be.y)),z.strokeStyle=zt.color,z.lineJoin="round",z.lineWidth=T4*qt(zt),z.stroke()},pe=zt=>{const He=qt(zt);if(zt.anchor.type==="redact"){if(D?.skipRedaction)return;W4(z,ft,{rect:zt.anchor,mode:zt.anchor.mode,strength:zt.anchor.strength,imageSize:{w:j,h:Y},sourceSize:{w:ft.width,h:ft.height}});return}if(zt.anchor.type==="image"){const Te=Dt.get(zt.id);if(Te){const{x:ze,y:Be,width:vn,height:Ir}=zt.anchor;z.drawImage(Te,ze,Be,vn,Ir)}return}if(zt.anchor.type==="point"){const{x:Te,y:ze}=zt.anchor,Be=Yh*He;z.beginPath(),z.arc(Te+nS*He,ze+rS*He,Be+iS*He,0,Math.PI*2),z.fillStyle=oS,z.fill(),z.beginPath(),z.arc(Te,ze,Be,0,Math.PI*2),z.fillStyle=zt.color,z.fill(),z.strokeStyle="white",z.lineWidth=ig*He,z.stroke()}else if(zt.anchor.type==="numbering"){const{start:Te,end:ze}=zt.anchor;z.beginPath(),z.moveTo(Te.x,Te.y),z.lineTo(ze.x,ze.y),z.strokeStyle=zt.color,z.lineWidth=Rf*He,z.stroke();const Be=String(zt.label),vn=14*de,Ir=0*vn,Gi=.4*vn,bi=.35*vn;z.font=`700 ${vn}px ${pr.current}`;const Ai=Math.max(vn*.62,z.measureText(Be).width)+Gi*2,xi=vn+Ir+bi,Kr=ze.x-Ai/2,gr=ze.y-xi/2,Ki=4*de;z.beginPath(),z.moveTo(Kr+Ki,gr),z.lineTo(Kr+Ai-Ki,gr),z.quadraticCurveTo(Kr+Ai,gr,Kr+Ai,gr+Ki),z.lineTo(Kr+Ai,gr+xi-Ki),z.quadraticCurveTo(Kr+Ai,gr+xi,Kr+Ai-Ki,gr+xi),z.lineTo(Kr+Ki,gr+xi),z.quadraticCurveTo(Kr,gr+xi,Kr,gr+xi-Ki),z.lineTo(Kr,gr+Ki),z.quadraticCurveTo(Kr,gr,Kr+Ki,gr),z.closePath(),z.fillStyle="rgba(10,10,16,0.95)",z.fill(),z.strokeStyle=zt.color,z.lineWidth=1.5*de,z.stroke(),z.textAlign="center",z.textBaseline="middle",z.fillStyle="#ffffff",z.fillText(Be,ze.x,ze.y),z.textAlign="left",z.textBaseline="alphabetic"}else if(zt.anchor.type==="polygon"){const ze=zt.anchor.points;if(ze.length>=2){z.beginPath(),z.moveTo(ze[0].x,ze[0].y);for(let vn=1;vn<ze.length;vn++)z.lineTo(ze[vn].x,ze[vn].y);z.closePath();const Be=sg(zt.color,zt.fillStyle);Be&&(z.fillStyle=Be,z.fill()),z.setLineDash(Lc(zt)?Bf.map(vn=>vn*He):[]),z.strokeStyle=zt.color,z.lineWidth=Rf*He,z.stroke(),z.setLineDash([])}}else if(zt.anchor.type==="polyline"){const ze=zt.anchor.points;if(ze.length>=2){z.beginPath(),z.moveTo(ze[0].x,ze[0].y);for(let Be=1;Be<ze.length;Be++)z.lineTo(ze[Be].x,ze[Be].y);z.setLineDash(Lc(zt)?Bf.map(Be=>Be*He):[]),z.strokeStyle=zt.color,z.lineWidth=Rf*He,z.stroke(),z.setLineDash([])}}else if(zt.anchor.type==="rectangle"){const{x:Te,y:ze,width:Be,height:vn,rotation:Ir=0}=zt.anchor,Gi=Te+Be/2,bi=ze+vn/2,ki=Ir*Math.PI/180;z.save(),z.translate(Gi,bi),z.rotate(ki),z.translate(-Be/2,-vn/2),z.beginPath(),z.rect(0,0,Be,vn);const Ai=sg(zt.color,zt.fillStyle);Ai&&(z.fillStyle=Ai,z.fill()),z.setLineDash(Lc(zt)?Bf.map(xi=>xi*He):[]),z.strokeStyle=zt.color,z.lineWidth=Rf*He,z.stroke(),z.setLineDash([]),z.restore()}else if(zt.anchor.type==="ellipse"){const{cx:Te,cy:ze,rx:Be,ry:vn,rotation:Ir=0}=zt.anchor,Gi=Ir*Math.PI/180;z.save(),z.translate(Te,ze),z.rotate(Gi),z.beginPath(),z.ellipse(0,0,Be,vn,0,0,Math.PI*2);const bi=sg(zt.color,zt.fillStyle);bi&&(z.fillStyle=bi,z.fill()),z.setLineDash(Lc(zt)?Bf.map(ki=>ki*He):[]),z.strokeStyle=zt.color,z.lineWidth=Rf*He,z.stroke(),z.setLineDash([]),z.restore()}else if(zt.anchor.type==="compass")V8(z,{cx:zt.anchor.cx,cy:zt.anchor.cy,radius:zt.anchor.radius,rotation:zt.anchor.rotation??0,color:zt.color,strokeWidth:ag*He});else if(zt.anchor.type==="arrow"){const{start:Te,end:ze,control:Be}=zt.anchor;z.beginPath(),z.moveTo(Te.x,Te.y),z.quadraticCurveTo(Be.x,Be.y,ze.x,ze.y),z.setLineDash(Lc(zt)?Bf.map(gr=>gr*He):[]),z.strokeStyle=zt.color,z.lineWidth=Rf*He,z.stroke(),z.setLineDash([]);const vn=Ck(Be,ze),Ir=Math.atan2(vn.y,vn.x),Gi=8*de,bi=Math.PI/7,ki=ze.x-Math.cos(Ir-bi)*Gi,Ai=ze.y-Math.sin(Ir-bi)*Gi,xi=ze.x-Math.cos(Ir+bi)*Gi,Kr=ze.y-Math.sin(Ir+bi)*Gi;z.beginPath(),z.moveTo(ze.x,ze.y),z.lineTo(ki,Ai),z.lineTo(xi,Kr),z.closePath(),z.fillStyle=zt.color,z.fill(),z.stroke()}},Le=zt=>{if(zt.anchor.type!=="text")return;if(zt.anchor.point){const gr=qt(zt),{x:Ki,y:ko}=zt.anchor.point;z.beginPath(),z.arc(Ki+nS*gr,ko+rS*gr,Yh*gr+iS*gr,0,Math.PI*2),z.fillStyle=oS,z.fill(),z.beginPath(),z.arc(Ki,ko,Yh*gr,0,Math.PI*2),z.fillStyle=zt.color,z.fill(),z.strokeStyle="white",z.lineWidth=ig*gr,z.stroke()}const{x:He,y:Te,width:ze}=zt.anchor,Be=zt.textBackgroundColor,vn=zt.textColor??"#ffffff",Ir=zt.textFontSize??Vs,Gi=zt.textBold?700:400,bi=zt.textItalic?"italic ":"",ki=L2(zt.description||""),Ai=z4(ki.length,Ir);Be!=null&&Be!=="transparent"&&(z.fillStyle=Be,Ct(He,Te,ze,Ai,sS),z.fill()),z.font=`${bi}${Gi} ${Ir}px ${pr.current}`,z.fillStyle=vn,z.textBaseline="top";const xi=He+bg+E2;let Kr=Te+bg+U_;for(const gr of ki){z.fillText(gr,xi,Kr);const Ki=Kr+Ir*.9,ko=z.measureText(gr).width;zt.textUnderline&&(z.strokeStyle=vn,z.lineWidth=1,z.beginPath(),z.moveTo(xi,Ki+1),z.lineTo(xi+ko,Ki+1),z.stroke()),zt.textStrike&&(z.strokeStyle=vn,z.lineWidth=1,z.beginPath(),z.moveTo(xi,Kr+Ir*.55),z.lineTo(xi+ko,Kr+Ir*.55),z.stroke()),Kr+=Ir*yg}},ae=zt=>{if(zt.calloutHidden||zt.anchor.type==="text"||zt.anchor.type==="redact")return;const He=nt[zt.id];if(!He)return;const{x:Te,y:ze,width:Be,height:vn}=He,Ir=_4*R4(qt(zt)),Gi=Ir,bi=Te+Gi,ki=ze+Gi,Ai=Math.max(0,Be-2*Gi),xi=Math.max(0,vn-2*Gi),Kr=(zt.textFontSize??Vs)*C4,gr=zt.description?k8({html:zt.description,width:Math.max(0,Ai-C2*2),fontSize:Kr,fontFamily:pr.current,lineHeight:yg,metrics:Ee}):null,Ki=gr?gr.height+M2+D4:0,ko=!!zt.description,tu=zt.image?N4:0;let nc=ko?Ki:zt.image?0:xi,jo=zt.image?xi-nc:0;zt.image&&jo<tu&&(jo=tu,nc=Math.max(0,xi-jo));const sa=zt.descPos==="above"?ki+nc:ki,aa=zt.descPos==="above"?ki:ki+jo;z.save(),Ct(Te,ze,Be,vn,k2),z.clip();const eu=zt.theme==="light"&&ko,nu=zt.textColor??(eu?"#111111":"#d0d0d0"),rc=zt.textBackgroundColor===null?"rgba(0,0,0,0)":zt.textBackgroundColor??(eu?"rgba(245,245,250,0.98)":"rgba(10,10,16,0.88)");if(z.fillStyle=rc,z.fillRect(Te,ze,Be,vn),zt.image){const la=xt.get(zt.id)??null;if(la){const Fs=la.width/la.height,ca=Ai/jo;let ru=0,co=0,iu=la.width,Ga=la.height;Fs>ca?(iu=Ga*ca,ru=(la.width-iu)/2):(Ga=iu/ca,co=(la.height-Ga)/2),z.drawImage(la,ru,co,iu,Ga,bi,sa,Ai,jo)}z.strokeStyle=zt.color+"44",z.lineWidth=1*de,z.beginPath(),zt.descPos==="above"?ko&&(z.moveTo(bi,sa),z.lineTo(bi+Ai,sa)):ko&&(z.moveTo(bi,aa),z.lineTo(bi+Ai,aa)),z.stroke()}if(gr){const la=aa+M2,Fs=bi+C2;z.textAlign="left",z.textBaseline="alphabetic";for(const ca of gr.lines){const ru=la+ca.baseline;for(const co of ca.runs)if(z.font=Wt(co),z.fillStyle=nu,z.fillText(co.text,Fs+co.x,ru),co.u||co.s){const iu=z.measureText(co.text).width;if(z.strokeStyle=nu,z.lineWidth=1*de,z.beginPath(),co.u){const Ga=ru+co.fs*.1;z.moveTo(Fs+co.x,Ga),z.lineTo(Fs+co.x+iu,Ga)}if(co.s){const Ga=ru-co.fs*.3;z.moveTo(Fs+co.x,Ga),z.lineTo(Fs+co.x+iu,Ga)}z.stroke()}}}z.restore(),Ct(Te,ze,Be,vn,k2),z.strokeStyle=zt.color,z.lineWidth=Ir,z.stroke()};for(const zt of Je)En(zt),zt.anchor.type==="text"?Le(zt):pe(zt),ae(zt);const An=w==="jpeg"?"image/jpeg":"image/png",Hn=ft.toDataURL(An,w==="jpeg"?.92:void 0);if(D?.returnDataUrl)return Hn;const Sr=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),Gr=w==="jpeg"?`img_${Sr}.jpg`:`img_${Sr}.png`;if(ed()&&await kk(Hn,Gr))return;const yi=document.createElement("a");if(yi.href=Hn,yi.download=Gr,M){window.open(Hn,"_blank","noopener,noreferrer");return}yi.click()},[M]);pn.current=$i;const Yi=H.useCallback(async()=>{if(!C||!G.w)return null;const w=await $i("png",1,{returnDataUrl:!0});if(!w||typeof w!="string")return null;const{w:S,h:D}=G,_=new dn({orientation:S>D?"landscape":"portrait",unit:"mm",format:"a4"}),I=_.internal.pageSize.getWidth(),K=_.internal.pageSize.getHeight(),nt=25.4/96,j=S*nt,Y=D*nt,lt=Math.min(I/j,K/Y),st=j*lt,ft=Y*lt,z=(I-st)/2,Ct=(K-ft)/2;return _.addImage(w,"PNG",z,Ct,st,ft),_.output("blob")},[C,G,$i]),Qc=H.useCallback(async()=>{const w=await Yi();if(!w)return;const D=`collage_${new Date().toISOString().replace(/[:.]/g,"-").slice(0,19)}.pdf`,_=URL.createObjectURL(w);if(setTimeout(()=>URL.revokeObjectURL(_),6e4),ed()&&await kk(_,D))return;const I=document.createElement("a");I.href=_,I.download=D,I.click()},[Yi]),md=H.useCallback(async()=>{if(!(!C||!G.w||sl)){Fo(!0);try{const S=window.ClipboardItem;if(!Uo||!S)return;const D=await $i("png",1,{returnDataUrl:!0});if(!D||typeof D!="string")return;const _=Tk(D);if(!_)return;const I=new S({[_.type]:_});await navigator.clipboard.write([I]),di(!0),setTimeout(()=>di(!1),1500)}catch{}finally{Fo(!1)}}},[C,G.w,sl,$i,Uo]),Ou=H.useCallback(w=>{const S=new Date(w);ve(S),$n(Ff(S)),ts(!0)},[]),Tf=H.useCallback(w=>{Ur(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&&Ou(w.capturedAt),L(w.backgroundImage),vt(w.imageSize),ht(w.sourceImageSize),ut(w.pins),Zt(w.cardPositions),tt(null),wt(null),Do(null),Ft(null),Jt(null),Ne(null),nr(null),$e(null),V(!1),Lt(null),Yo.current=!0,vo.current=!0,vi.current=[],ro.current=[],$o(0),Ts(0)},[Ou]),Nf=H.useCallback(()=>GB({backgroundImage:C,imageSize:G,sourceImageSize:_t,pins:Z,cardPositions:It,settings:{fontId:Ni.fontId,strokeWidthScale:Cr},meta:Yt}),[C,G,_t,Z,It,Ni.fontId,Cr,Yt]),Si=H.useCallback(()=>{L(null),vt({w:0,h:0}),ht(null),ut([]),Zt({}),Ur(null),tt(null),wt(null),Do(null),Ft(null),Jt(null),Ne(null),nr(null),$e(null),V(!1),Lt(null),vi.current=[],ro.current=[],$o(0),Ts(0),oa.current=null,Cl.current=null},[]),oa=H.useRef(null),Tc=H.useRef(0),Cl=H.useRef(null),El=H.useRef(null),m=H.useCallback(()=>{oa.current=null,Tc.current=performance.now()+A9},[]),v=H.useRef(f);v.current=f;const T=H.useRef(c);T.current=c;const O=H.useRef(d);O.current=d;const U=H.useCallback(w=>{w&&((w.fontId==="road-ui"||w.fontId==="uaf-sans"&&P4)&&fi(w.fontId),typeof w.strokeWidthScale=="number"&&_i(w.strokeWidthScale))},[fi,_i]),W=H.useCallback(async w=>{Tf(XB(w)),U(w.settings),m()},[Tf,U,m]),X=H.useCallback(async w=>{const S=await ZB(w);await new Promise((D,_)=>{ur(S,!0,I=>{I?D():_(new Error("Failed to load image"))})}),m()},[ur,m]),ot=H.useCallback(()=>{const w=Cl.current;w&&(oa.current=w.fingerprint,v.current?.(w.document,{dirty:!1}),El.current?.notifyChange(w.document,!1))},[]),at=H.useRef({loadDocument:async()=>{},loadImage:async()=>{},getDocument:()=>null,exportImage:async()=>null,exportPdf:async()=>null,markSaved:()=>{},reset:()=>{}});at.current.loadDocument=W,at.current.loadImage=X,at.current.getDocument=Nf,at.current.exportImage=async(w,S=1)=>{const D=await $i(w,S,{returnDataUrl:!0});if(!D||typeof D!="string")return null;const _=w==="jpeg"?"image/jpeg":"image/png",I=Tk(D);return I?{mime:_,dataUrl:D,blob:I}:null},at.current.exportPdf=Yi,at.current.markSaved=ot,at.current.reset=Si,H.useImperativeHandle(e,()=>at.current,[]);const yt=H.useRef(!1);H.useEffect(()=>{yt.current||!i||(yt.current=!0,W(i))},[i,W]),H.useEffect(()=>{const w=Nf();if(!w){Cl.current=null;return}const S=JB(w);(oa.current===null||performance.now()<Tc.current)&&(oa.current=S),Cl.current={document:w,fingerprint:S};const D=S!==oa.current;v.current?.(w,{dirty:D}),El.current?.notifyChange(w,D)},[Nf]),H.useEffect(()=>{const w=o9({editor:at.current,config:{...c9(),...s},onReady:()=>T.current?.(),onError:S=>O.current?.(S)});return El.current=w,()=>{w.stop(),El.current===w&&(El.current=null)}},[p,s]);const Et=YB({state:{backgroundImage:C,imageSize:G,sourceImageSize:_t,pins:Z,cardPositions:It,sourceUrl:Yt?.sourceUrl,sourceTitle:Yt?.sourceTitle,capturedAt:Yt?.capturedAt},onRestore:Tf,enabled:g.autosave}),{restoreDraft:Vt,dismissRestorePrompt:mt}=Et,Pt=H.useRef(!1);H.useEffect(()=>{if(!Pt.current&&(Pt.current=!0,!!ed())){if(d9()){Vt();return}f9()&&(mt(),h9().then(w=>{if(!w){B("Не вдалося отримати знімок від розширення.");return}ur(w.dataUrl,!0,S=>{if(!S){B("Не вдалося завантажити знімок.");return}Ur({sourceUrl:w.sourceUrl,sourceTitle:w.sourceTitle,capturedAt:w.capturedAt}),w.capturedAt!==void 0&&Ou(w.capturedAt)})}))}},[Vt,mt,ur,Ou]);const Ht=Et.errorMessage??(Et.status==="saving"?"Збереження чернетки…":Et.status==="saved"&&Et.lastSavedAt?`Чернетка збережена: ${Bd(new Date(Et.lastSavedAt))}`:Et.canRestore&&Et.storedDraftSavedAt?`Знайдено чернетку від ${Bd(new Date(Et.storedDraftSavedAt))}`:null),oe=Et.status==="error"?"#E63946":"#555",[$t,ne]=H.useState(null),se=H.useRef(null),Se=H.useRef(null),he=H.useRef(null),[en,Ye]=H.useState(!1),Nn=H.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation(),w&&tt(w),ne({pinId:w,x:S.clientX,y:S.clientY,at:Me(S.clientX,S.clientY)})},[Me]),Ke=H.useCallback(w=>{const S=_r.current.find(I=>I.id===w);if(!S)return;se.current=bS(S,hi.current[w]),Ye(!0);const _=L2(S.description||"").join(`
234
- `).trim()||`ТИЦЬ: ${S.label}`;Se.current=null,navigator.clipboard?.writeText?.(_).then(()=>{Se.current=_}).catch(()=>{})},[]),Xn=H.useCallback(w=>{te(),ut(S=>Mk([...S,w.pin])),w.card&&Zt(S=>({...S,[w.pin.id]:w.card})),tt(w.pin.id),wt(w.pin.id),Fn.current=null},[te]),zr=H.useCallback(w=>{const S=_r.current.find(_=>_.id===w);if(!S)return;const D=x9;Xn($4(bS(S,hi.current[w]),D,D,_l()))},[Xn]),zn=H.useCallback(w=>{const S=se.current;S&&Xn(U8(S,w,_l()))},[Xn]),qe=H.useCallback(()=>{const{w,h:S}=Rn.current;zn(he.current??{x:w/2,y:S/2})},[zn]);H.useEffect(()=>{const w=S=>{const D=Se.current;if(D===null||!se.current||!Ui.current)return;const _=S.target;_&&(_.isContentEditable||_.closest(".ProseMirror")!==null||_.tagName==="TEXTAREA"||_.tagName==="INPUT")||(S.clipboardData?.getData("text/plain")??"")!==D||(S.preventDefault(),S.stopPropagation(),qe())};return window.addEventListener("paste",w,!0),()=>window.removeEventListener("paste",w,!0)},[qe]),kB({isMac:b,backgroundImage:C,pinsLength:Z.length,showExportMenu:Bn,sourceImageSize:_t,imageSize:G,activePin:Q,calloutControlPinId:pt,undo:Ro,redo:rs,handleExport:$i,handleExportPdf:Qc,stepZoom:mi,handleFitToWindow:wo,deletePin:vs,movePinZ:xs,copyPin:Ke,duplicatePin:zr,pastePinFromClipboard:qe,setMode:N,setPolygonDraft:Ft,setPolylineDraft:Jt,setShapeDraftType:Ne,setPlacementTool:Fe,setShowExportMenu:Xe,beginCrop:ka,insertCurrentDateTimeText:Ru,toggleCompassMenu:ii,toggleImageObjectMenu:Io,toggleCalloutPanel:ha,newBgFileRef:Oo,replaceBgFileRef:yc,exportMenuOpenedViaHotkeyRef:Mr}),H.useEffect(()=>{if(!Fn.current)return;const w=setTimeout(()=>{Fn.current=null},500);return()=>clearTimeout(w)},[pt]);const Pe=H.useMemo(()=>vg(Z),[Z]),[oi,xn]=H.useState(null),qn=Z.some(w=>w.anchor.type==="redact"),Tr=H.useMemo(()=>JSON.stringify(Z.filter(w=>w.anchor.type!=="redact").map(w=>[w.id,w.anchor,w.color,w.description,w.calloutHidden,w.z])),[Z]);H.useEffect(()=>{if(!qn||!C||!G.w){xn(null);return}let w=!1;const S=setTimeout(async()=>{const D=await pn.current?.("png",y9,{returnDataUrl:!0,skipRedaction:!0});if(w||typeof D!="string")return;const _=new Image;_.onload=()=>{w||xn(_)},_.src=D},b9);return()=>{w=!0,clearTimeout(S)}},[qn,C,G.w,G.h,Tr,It]);const[Ii,lo]=H.useState(null);H.useEffect(()=>{if(!$t)return;const w=()=>ne(null),S=D=>{D.key==="Escape"&&w()};return window.addEventListener("pointerdown",w),window.addEventListener("wheel",w,{passive:!0}),window.addEventListener("resize",w),window.addEventListener("keydown",S),()=>{window.removeEventListener("pointerdown",w),window.removeEventListener("wheel",w),window.removeEventListener("resize",w),window.removeEventListener("keydown",S)}},[$t]);const Nr=H.useMemo(()=>{const w={};for(const S of Z)if(S.anchor.type==="polygon"||S.anchor.type==="polyline"){const D=S.anchor.points;if(!D.length)continue;let _=D[0].x,I=D[0].y,K=D[0].x,nt=D[0].y;for(let j=1;j<D.length;j++)D[j].x<_&&(_=D[j].x),D[j].y<I&&(I=D[j].y),D[j].x>K&&(K=D[j].x),D[j].y>nt&&(nt=D[j].y);w[S.id]={minX:_,minY:I,maxX:K,maxY:nt}}return w},[Z]),ji=H.useCallback(w=>{const S=12*de,D=S,_=S,I=Math.max(D,G.w-S),K=Math.max(_,G.h-S),nt=(lt,st,ft)=>Math.max(st,Math.min(lt,ft));let j=S,Y=S;if(w.anchor.type==="point")j=w.anchor.x+S,Y=w.anchor.y+S;else if(w.anchor.type==="image")j=w.anchor.x+w.anchor.width+S,Y=w.anchor.y+S;else if(w.anchor.type==="polygon"||w.anchor.type==="polyline"){const lt=Nr[w.id];lt&&(j=lt.maxX+S,Y=lt.maxY+S)}else if(w.anchor.type==="rectangle"){const{x:lt,y:st,width:ft,height:z,rotation:Ct=0}=w.anchor,jt=lt+ft/2,St=st+z/2,Dt=Ct*Math.PI/180,xt=Math.cos(Dt),qt=Math.sin(Dt),Wt=[{lx:-ft/2,ly:-z/2},{lx:ft/2,ly:-z/2},{lx:ft/2,ly:z/2},{lx:-ft/2,ly:z/2}].map(Ee=>({x:jt+Ee.lx*xt-Ee.ly*qt,y:St+Ee.lx*qt+Ee.ly*xt})),fe=Math.max(...Wt.map(Ee=>Ee.x)),be=Math.max(...Wt.map(Ee=>Ee.y));j=fe+S,Y=be+S}else if(w.anchor.type==="ellipse"){const{cx:lt,cy:st,rx:ft,ry:z,rotation:Ct=0}=w.anchor,jt=Ct*Math.PI/180,St=Math.cos(jt),Dt=Math.sin(jt),xt=Math.sqrt((ft*St)**2+(z*Dt)**2),qt=Math.sqrt((ft*Dt)**2+(z*St)**2);j=lt+xt+S,Y=st+qt+S}else if(w.anchor.type==="compass")j=w.anchor.cx+w.anchor.radius+S,Y=w.anchor.cy+w.anchor.radius+S;else if(w.anchor.type==="arrow"){const lt=[w.anchor.start,w.anchor.end,w.anchor.control],st=Math.max(...lt.map(z=>z.x)),ft=Math.max(...lt.map(z=>z.y));j=st+S,Y=ft+S}return{x:nt(j,D,I),y:nt(Y,_,K)}},[G.h,G.w,Nr]),So=w=>{const S=v2(w,Z);return S!==null&&Zw(S)},gi=ls,Kn=ls,ir=xo.current?.getBoundingClientRect()??null,Br=xc.current?.getBoundingClientRect()??null,lr=dl.current?.getBoundingClientRect()??null,si=Ua.current?.getBoundingClientRect()??null,Un=!!C&&G.w>0,Qn=io.current?.getBoundingClientRect()??null,Yr=hl.current?.getBoundingClientRect()??null;return E.jsxs("div",{ref:bc,style:{display:"flex",flexDirection:"column",height:"100dvh",minHeight:"100vh",background:"#08080d",color:"#ddd",fontFamily:Tn},onClick:()=>{if(Ho.current){Ho.current=!1;return}tt(null),wt(null),Xe(!1),No(!1),bt(!1),yn(!1),ye(!1),us(!1)},onDragOver:w=>{w.dataTransfer?.types?.includes("Files")&&(w.preventDefault(),w.dataTransfer.dropEffect="copy",Oi(!0))},onDragLeave:w=>{const S=w.relatedTarget;S&&bc.current?.contains(S)||Oi(!1)},onDrop:()=>{Oi(!1)},children:[E.jsxs("div",{ref:cs,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:[E.jsx("div",{className:"tyts-no-scrollbar",style:{flex:1,minWidth:0,overflowX:"auto",overflowY:"hidden",display:"flex",alignItems:"center"},children:E.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,minWidth:"100%",width:"max-content"},children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[E.jsx("img",{src:"./favicon/favicon.svg",alt:"",width:24,height:24,style:{flexShrink:0},"aria-hidden":!0}),!ls&&E.jsx("span",{style:{fontWeight:700,letterSpacing:"0.03em"},children:"Тиць"}),C?E.jsxs(E.Fragment,{children:[E.jsx(kr,{title:"Створити новий колаж (виноски будуть видалені)",onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),Et.clearDraft(),L(null),vt({w:0,h:0}),ht(null),ut([]),Zt({}),tt(null),wt(null),Do(null),Ft(null),Jt(null),Ne(null),$e(null),Fe("point"),$e(null),nr(null),V(!1),bt(!1),Lt(null),Xe(!1),Oi(!1),vi.current=[],ro.current=[],$o(0),Ts(0),N("select"),Fe("point"),Ps(1)},children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-file-earmark-plus`,style:{fontSize:or},"aria-hidden":!0}),!Dn&&"Нове"]})}),E.jsx(kr,{title:"Замінити фон, зберегти виноски",onClick:()=>yc.current?.click(),children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-arrow-repeat`,style:{fontSize:or},"aria-hidden":!0}),!Dn&&"Замінити"]})}),E.jsxs("div",{ref:xo,style:{position:"relative"},children:[E.jsx(kr,{title:`Обрізати фон (${Qe(re.toolCrop,{isMac:b})})`,tooltip:`Обрізати фон (${Qe(re.toolCrop,{isMac:b})})`,onClick:ka,disabled:!C,active:q,hotkeyParts:Ci(re.toolCrop,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-crop`,style:{fontSize:or,display:"block",lineHeight:1,transform:"translate(-1px, -1px)"},"aria-hidden":!0}),!Dn&&"Crop"]})}),q&&E.jsxs("div",{style:{position:"fixed",top:ir?ir.bottom+6:0,left:ir?ir.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:[E.jsx(kr,{title:"Обрати формат обрізки",onClick:()=>bt(w=>!w),children:E.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:128,whiteSpace:"nowrap"},children:E.jsx("span",{children:`${Nk.find(w=>w.id===gt)?.label??"Вільний формат"}`})})}),kt&&E.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:Nk.map(w=>{const S=w.id===gt;return E.jsxs("button",{type:"button",onClick:()=>{fs(w.id),bt(!1)},style:{width:"100%",textAlign:"left",border:"none",background:S?"rgba(78,205,196,0.16)":"transparent",color:S?"#bdf8f3":"#ddd",borderRadius:6,padding:"6px 8px",cursor:"pointer",fontFamily:Tn,fontSize:13,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[E.jsx("span",{children:w.label}),S&&E.jsx("span",{style:{opacity:.9},children:"✓"})]},w.id)})}),E.jsx(kr,{title:"Скасувати crop",onClick:Gl,children:E.jsx("i",{className:`${Vn} bi-x-lg`,style:{fontSize:or-1},"aria-hidden":!0})}),E.jsx(kr,{primary:!0,title:"Застосувати crop",onClick:()=>{yl()},disabled:J,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-check-lg`,style:{fontSize:or},"aria-hidden":!0}),!Dn&&(J?"Обробка…":"Застосувати")]})})]})]}),E.jsx("input",{ref:Oo,type:"file",accept:"image/*",style:{display:"none"},onChange:gl}),E.jsx("input",{ref:yc,type:"file",accept:"image/*",style:{display:"none"},onChange:Xl})]}):E.jsxs(E.Fragment,{children:[E.jsx(kr,{title:"Завантажити фонове зображення",onClick:()=>Oo.current?.click(),children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-image`,style:{fontSize:or},"aria-hidden":!0}),!Dn&&"Нове зображення"]})}),E.jsx("input",{ref:Oo,type:"file",accept:"image/*",style:{display:"none"},onChange:gl})]})]}),E.jsx("div",{style:{display:"flex",justifyContent:"center",flexShrink:0,margin:"0 auto"},children:E.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[E.jsx(kr,{disabled:!C,active:$==="place"&&At===null&&Rt===null&&we===null&&De==="point",onClick:()=>{N("place"),Ft(null),Jt(null),Ne(null),Fe("point")},title:`${$==="place"&&At===null&&!we?"Клікніть на фото, щоб поставити точку":"Додати точку на фото"} (${Qe(re.toolPoint,{isMac:b})})`,tooltip:`${$==="place"&&At===null&&!we?"Клікніть на фото, щоб поставити точку":"Додати точку на фото"} (${Qe(re.toolPoint,{isMac:b})})`,hotkeyParts:Ci(re.toolPoint,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-pin-map`,style:{fontSize:or-1},"aria-hidden":!0}),!Dn&&"Точка"]})}),E.jsxs("div",{ref:xc,style:{position:"relative"},children:[E.jsx(kr,{disabled:!C,active:$==="place"&&At!==null,onClick:()=>{N("place"),Ft([]),Jt(null),Ne(null),$e(null),Fe("point")},title:`${$==="place"&&At!==null?"Клік — додати вершину; тягніть вершину — перемістити; «Готово» — закрити":"Додати район (полігон)"} (${Qe(re.toolRegion,{isMac:b})})`,tooltip:`${$==="place"&&At!==null?"Клік — додати вершину; тягніть вершину — перемістити; подвійний клік, клік на першу точку або «Готово» — закрити район":"Додати район (полігон). Кліки задають вершини."} (${Qe(re.toolRegion,{isMac:b})})`,hotkeyParts:Ci(re.toolRegion,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-hexagon`,style:{fontSize:or},"aria-hidden":!0}),!Dn&&"Район"]})}),At!==null&&E.jsxs("div",{onClick:w=>w.stopPropagation(),style:{position:"fixed",top:Br?Br.bottom+6:0,left:Br?Br.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:[E.jsx(kr,{title:"Скасувати район",onClick:()=>Ft(null),children:E.jsx("i",{className:`${Vn} bi-x-lg`,style:{fontSize:or-1},"aria-hidden":!0})}),E.jsx(Lk,{canUndo:ke,canRedo:Re,onUndo:Ro,onRedo:rs,isMac:b}),E.jsx(kr,{accent:!0,title:"Завершити район із поточних вершин",tooltip:"Завершити район із поточних вершин",onClick:wi,disabled:At.length<2,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-check-lg`,style:{fontSize:or},"aria-hidden":!0}),!gi&&`Готово (${At.length})`]})})]})]}),E.jsxs("div",{ref:dl,style:{position:"relative"},children:[E.jsx(kr,{disabled:!C,active:$==="place"&&Rt!==null,onClick:()=>{N("place"),Ft(null),Jt([]),Ne(null),$e(null),Fe("point")},title:`${$==="place"&&Rt!==null?"Клік — додати точку маршруту; «Готово» — завершити":"Додати маршрут (полілінія)"} (${Qe(re.toolRoute,{isMac:b})})`,tooltip:`${$==="place"&&Rt!==null?"Клік — додати точку; тягніть вершину — перемістити; подвійний клік або «Готово» — завершити маршрут (без замикання)":"Додати маршрут (полілінія). Кліки задають точки; лінія не замикається."} (${Qe(re.toolRoute,{isMac:b})})`,hotkeyParts:Ci(re.toolRoute,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("svg",{width:or,height:or,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:E.jsx("path",{d:"M1.00007 15L6 8L10 8L15 1.00002",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})}),!Dn&&"Маршрут"]})}),Rt!==null&&E.jsxs("div",{onClick:w=>w.stopPropagation(),style:{position:"fixed",top:lr?lr.bottom+6:0,left:lr?lr.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:[E.jsx(kr,{title:"Скасувати маршрут",onClick:()=>Jt(null),children:E.jsx("i",{className:`${Vn} bi-x-lg`,style:{fontSize:or-1},"aria-hidden":!0})}),E.jsx(Lk,{canUndo:ke,canRedo:Re,onUndo:Ro,onRedo:rs,isMac:b}),E.jsx(kr,{accent:!0,title:"Завершити маршрут",tooltip:"Завершити маршрут із поточних точок",onClick:ar,disabled:Rt.length<2,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-check-lg`,style:{fontSize:or},"aria-hidden":!0}),!gi&&`Готово (${Rt.length})`]})})]})]}),E.jsx(kr,{disabled:!C,active:$==="place"&&we==="rectangle",onClick:()=>{N("place"),Ft(null),Jt(null),Ne("rectangle"),$e(null),Fe("point")},title:`${we==="rectangle"?"Потягніть на фото, щоб намалювати прямокутник":"Додати прямокутну область"} (${Qe(re.toolRectangle,{isMac:b})})`,tooltip:`${we==="rectangle"?"Потягніть на фото, щоб намалювати прямокутник":"Додати прямокутну область. Потягніть на фото для малювання."} (${Qe(re.toolRectangle,{isMac:b})})`,hotkeyParts:Ci(re.toolRectangle,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-square`,style:{fontSize:or-2},"aria-hidden":!0}),!Dn&&"Прямокутник"]})}),E.jsx(kr,{disabled:!C,active:$==="place"&&we==="ellipse",onClick:()=>{N("place"),Ft(null),Jt(null),Ne("ellipse"),$e(null),Fe("point")},title:`${we==="ellipse"?"Потягніть на фото, щоб намалювати еліпс":"Додати еліптичну область"} (${Qe(re.toolEllipse,{isMac:b})})`,tooltip:`${we==="ellipse"?"Потягніть на фото, щоб намалювати еліпс":"Додати еліптичну область. Потягніть на фото для малювання."} (${Qe(re.toolEllipse,{isMac:b})})`,hotkeyParts:Ci(re.toolEllipse,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-circle`,style:{fontSize:or-2},"aria-hidden":!0}),!Dn&&"Еліпс"]})}),E.jsx(kr,{disabled:!C,active:$==="place"&&At===null&&Rt===null&&we===null&&De==="arrow",onClick:()=>{N("place"),Ft(null),Jt(null),Ne(null),$e(null),Fe("arrow")},title:`${De==="arrow"&&$==="place"?"Потягніть на фото, щоб намалювати стрілку":"Додати стрілку"} (${Qe(re.toolArrow,{isMac:b})})`,tooltip:`${De==="arrow"&&$==="place"?"Потягніть на фото, щоб намалювати стрілку; центральний важіль згинає лінію":"Додати стрілку (drag для створення, центральний важіль для вигину)."} (${Qe(re.toolArrow,{isMac:b})})`,hotkeyParts:Ci(re.toolArrow,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-arrow-right`,style:{fontSize:or-1},"aria-hidden":!0}),!Dn&&"Стрілка"]})}),E.jsx(kr,{disabled:!C,active:$==="place"&&At===null&&Rt===null&&we===null&&De==="text",onClick:()=>{N("place"),Ft(null),Jt(null),Ne(null),$e(null),Fe("text")},title:`${De==="text"&&$==="place"?"Клікніть на фото, щоб додати текст":"Додати текст"} (${Qe(re.toolText,{isMac:b})})`,tooltip:`${De==="text"&&$==="place"?"Клікніть на фото, щоб додати текстову виноску":"Додати текстову виноску"} (${Qe(re.toolText,{isMac:b})})`,hotkeyParts:Ci(re.toolText,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-type`,style:{fontSize:or-1},"aria-hidden":!0}),!Dn&&"Текст"]})}),E.jsx(kr,{disabled:!C,active:$==="place"&&At===null&&Rt===null&&we===null&&De==="pointText",onClick:()=>{N("place"),Ft(null),Jt(null),Ne(null),$e(null),Fe("pointText")},title:`${De==="pointText"&&$==="place"?"Клікніть на фото, щоб поставити точку з текстом":"Точка з текстом"} (${Qe(re.toolPointText,{isMac:b})})`,tooltip:`${De==="pointText"&&$==="place"?"Клікніть на фото, щоб поставити точку з підписом":"Точка з підписом, без виноски"} (${Qe(re.toolPointText,{isMac:b})})`,hotkeyParts:Ci(re.toolPointText,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsxs("svg",{width:or,height:or,viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,style:{display:"block",flexShrink:0},children:[E.jsx("circle",{cx:"3.4",cy:"12.6",r:"1.5",fill:"currentColor"}),E.jsx("rect",{x:"6.6",y:"1.1",width:"8.8",height:"7.4",rx:"1.6",stroke:"currentColor",strokeWidth:"1.2"}),E.jsx("text",{x:"11",y:"4.8",textAnchor:"middle",dominantBaseline:"central",fontSize:"5.6",fontWeight:"700",fill:"currentColor",children:"А"})]}),!Dn&&"Точка з текстом"]})}),E.jsx(kr,{disabled:!C,active:$==="place"&&we==="redact",onClick:()=>{N("place"),Ft(null),Jt(null),$e(null),Ne("redact")},title:`Замалювати ділянку фону (${Qe(re.toolRedact,{isMac:b})})`,tooltip:`Виділіть ділянку — її можна розмити, пікселізувати або залити середнім кольором (${Qe(re.toolRedact,{isMac:b})})`,hotkeyParts:Ci(re.toolRedact,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-droplet-half`,style:{fontSize:or-1},"aria-hidden":!0}),!Dn&&"Замалювати"]})}),E.jsxs("div",{ref:hl,style:{position:"relative"},onClick:w=>w.stopPropagation(),children:[E.jsx(kr,{disabled:!C,active:na,onClick:()=>us(w=>!w),title:`Додати зображення (${Qe(re.toolImageObject,{isMac:b})})`,tooltip:`Покласти зображення поверх фото — можна совати й масштабувати (${Qe(re.toolImageObject,{isMac:b})})`,hotkeyParts:Ci(re.toolImageObject,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-image`,style:{fontSize:or-1},"aria-hidden":!0}),!Dn&&"Картинка"]})}),na&&E.jsxs("div",{style:{position:"fixed",top:Yr?Yr.bottom+6:0,left:Yr?Yr.left+Yr.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:[E.jsx("input",{ref:Vi,type:"text","aria-label":"Вставте зображення з буфера",onChange:()=>{},value:"",onPaste:w=>{const S=i2(w.clipboardData);S&&(w.preventDefault(),ao(S))},style:{position:"absolute",width:1,height:1,opacity:0,border:"none",outline:"none",padding:0,margin:0}}),E.jsxs("button",{type:"button",onClick:()=>gc.current?.click(),onDragOver:w=>{w.preventDefault(),qa(!0)},onDragLeave:()=>qa(!1),onDrop:w=>{w.preventDefault(),w.stopPropagation(),qa(!1);const S=Array.from(w.dataTransfer.files).find(D=>D.type.startsWith("image/"));S&&(wl(S),us(!1))},style:{width:260,minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:6,padding:14,borderRadius:8,border:`2px dashed ${Ha?tf:"rgba(255,255,255,0.28)"}`,background:Ha?"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:[E.jsx("i",{className:`${Vn} bi-file-earmark-image`,style:{fontSize:22},"aria-hidden":!0}),E.jsx("span",{children:"Перетягніть зображення сюди"}),E.jsx("span",{style:{color:"rgba(255,255,255,0.55)",fontSize:11,letterSpacing:.2},children:__.join(" · ")}),E.jsxs("span",{style:{color:"rgba(255,255,255,0.45)",fontSize:11,lineHeight:1.5},children:["або клікніть, щоб вибрати файл",E.jsx("br",{}),"чи вставте з буфера (",Yd(),")"]})]})]})]}),E.jsx(kr,{disabled:!C,active:$==="place"&&At===null&&Rt===null&&we===null&&De==="standalone",onClick:()=>{N("place"),Ft(null),Jt(null),Ne(null),$e(null),Fe("standalone")},title:`${De==="standalone"&&$==="place"?"Клікніть на фото, щоб додати блок виноски":"Додати блок виноски"} (${Qe(re.toolStandaloneCallout,{isMac:b})})`,tooltip:`${De==="standalone"&&$==="place"?"Клікніть на фото, щоб додати блок виноски без лінії та фігури":"Додати блок виноски без лінії та фігури"} (${Qe(re.toolStandaloneCallout,{isMac:b})})`,hotkeyParts:Ci(re.toolStandaloneCallout,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-chat-square-text`,style:{fontSize:or-1},"aria-hidden":!0}),!Dn&&"Блок"]})}),E.jsxs("div",{ref:Ua,style:{position:"relative"},children:[E.jsx(j9,{disabled:!C,menuOpen:gn,onMainClick:Ru,onMenuClick:ra,mainTitle:Ze?`Вставити зафіксовані дату та час (${Qe(re.toolDateTime,{isMac:b})})`:`Вставити поточні дату та час (${Qe(re.toolDateTime,{isMac:b})})`,mainTooltip:Ze?`Вставляє зафіксовані дату й час: ${Bd(Ce,xr)}`:"Додає редагований текст із поточними датою й часом у лівому нижньому куті",menuTitle:"Відкрити календар і вибір часу",menuTooltip:"Відкрити календар (3 місяці) та вибрати дату й час",hotkeyParts:Ci(re.toolDateTime,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,whiteSpace:"nowrap"},children:[E.jsx("i",{className:`${Vn} bi-clock`,style:{fontSize:or-1},"aria-hidden":!0}),Ze&&E.jsx("i",{className:`${Vn} bi-lock-fill`,style:{fontSize:or-3,opacity:.85},"aria-hidden":!0}),!Dn&&"Дата/час"]})}),gn&&E.jsx("div",{style:{position:"fixed",top:si?si.bottom+6:0,left:si?si.left+si.width/2:0,transform:"translateX(-50%)",zIndex:3200},onClick:w=>w.stopPropagation(),children:E.jsx(i8,{value:Ce,viewMonth:Zn,format:xr,locked:Ze,onChange:ve,onViewMonthChange:$n,onFormatChange:Bo,onLockedChange:ts,onInsert:Wa,onNow:Sl,onClose:()=>yn(!1)})})]}),E.jsx(kr,{disabled:!C,active:$==="place"&&At===null&&Rt===null&&we===null&&De==="numbering",onClick:()=>{N("place"),Ft(null),Jt(null),Ne(null),$e(null),Fe("numbering")},title:`${De==="numbering"&&$==="place"?tn?"Клікніть кінцеву точку лінії нумерації":"Клікніть початкову точку лінії нумерації":"Нумерація (2 точки: початок -> кінець)"} (${Qe(re.toolNumbering,{isMac:b})})`,tooltip:`${De==="numbering"&&$==="place"?tn?"Другий клік поставить кінець і номер на кінці":"Перший клік задає старт лінії":"Поставте старт і фініш лінії, номер буде на кінці"} (${Qe(re.toolNumbering,{isMac:b})})`,hotkeyParts:Ci(re.toolNumbering,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-123`,style:{fontSize:or-1},"aria-hidden":!0}),!Dn&&"Нумерація"]})}),E.jsxs("div",{ref:io,style:{position:"relative"},onClick:w=>w.stopPropagation(),children:[E.jsx(kr,{disabled:!C,active:Qt,onClick:ii,title:`Додати компас (${Qe(re.toolCompass,{isMac:b})})`,tooltip:`Оберіть кут, щоб додати компас на зображення (${Qe(re.toolCompass,{isMac:b})})`,hotkeyParts:Ci(re.toolCompass,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-compass`,style:{fontSize:or-1},"aria-hidden":!0}),!Dn&&"Компас"]})}),Qt&&E.jsx("div",{style:{position:"fixed",top:Qn?Qn.bottom+6:0,left:Qn?Qn.left+Qn.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:w=>w.stopPropagation(),children:[["nw","ne"],["sw","se"]].flatMap(w=>w.map(S=>E.jsx("button",{type:"button",title:S==="nw"?"Верхній лівий":S==="ne"?"Верхній правий":S==="sw"?"Нижній лівий":"Нижній правий",onClick:()=>rr(S),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:E.jsx(I9,{corner:S})},S)))})]}),E.jsx("span",{style:{width:1,height:20,background:"rgba(255,255,255,0.2)",flexShrink:0,marginLeft:10,marginRight:10},"aria-hidden":!0}),E.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[E.jsx(kr,{disabled:!C,title:`Зменшити масштаб (${Qe(re.zoomOut,{isMac:b})})`,onClick:()=>mi("out"),hotkeyParts:Ci(re.zoomOut,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:E.jsx("i",{className:`${Vn} bi-zoom-out`,style:{fontSize:or-2},"aria-hidden":!0})})}),!gi&&E.jsxs("span",{style:{minWidth:52,textAlign:"center",color:"#888",fontVariantNumeric:"tabular-nums"},children:[Math.round(wr*100),"%"]}),E.jsx(kr,{disabled:!C,title:`Збільшити масштаб (${Qe(re.zoomIn,{isMac:b})})`,onClick:()=>mi("in"),hotkeyParts:Ci(re.zoomIn,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:E.jsx("i",{className:`${Vn} bi-zoom-in`,style:{fontSize:or-2},"aria-hidden":!0})})}),E.jsx(kr,{disabled:!C,title:`Припасувати розмір зображення під розмір вікна (${Qe(re.fitToWindow,{isMac:b})})`,tooltip:`Припасувати розмір зображення під розмір вікна (${Qe(re.fitToWindow,{isMac:b})})`,onClick:wo,hotkeyParts:Ci(re.fitToWindow,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:E.jsx("i",{className:`${Vn} bi-aspect-ratio`,style:{fontSize:or-2},"aria-hidden":!0})})})]}),E.jsx("span",{style:{width:1,height:20,background:"rgba(255,255,255,0.2)",flexShrink:0,marginLeft:10,marginRight:10},"aria-hidden":!0}),E.jsx(kr,{title:`Відмінити останню дію (${Qe(re.undo,{isMac:b})})`,tooltip:`Відмінити останню дію (${Qe(re.undo,{isMac:b})})`,onClick:Ro,disabled:!C||!Hc,hotkeyParts:Ci(re.undo,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:E.jsx("i",{className:`${Vn} bi-arrow-counterclockwise`,style:{fontSize:or},"aria-hidden":!0})})}),E.jsx(kr,{title:`Повернути скасовану дію (${Qe(re.redo,{isMac:b})})`,tooltip:`Повернути скасовану дію (${Qe(re.redo,{isMac:b})})`,onClick:rs,disabled:!C||!Af,hotkeyParts:Ci(re.redo,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:E.jsx("i",{className:`${Vn} bi-arrow-clockwise`,style:{fontSize:or},"aria-hidden":!0})})})]})})]})}),E.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",flexShrink:0,position:"relative",zIndex:1},children:[E.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:10},children:[E.jsx(kr,{title:C?`Швидке збереження у форматі JPEG (${Qe(re.downloadJpg,{isMac:b})})`:"Спочатку завантажте фонове зображення",onClick:()=>$i("jpeg"),disabled:!Un,hotkeyParts:Ci(re.downloadJpg,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} bi-download`,style:{fontSize:or},"aria-hidden":!0}),!Kn&&"JPG"]})}),E.jsx(kr,{title:Uo?"Скопіювати зображення в буфер обміну":"Ваш браузер не підтримує копіювання зображення в буфер",onClick:md,disabled:!Un||sl||!Uo,success:Js,children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[E.jsx("i",{className:`${Vn} ${sl?"bi-arrow-repeat tyts-spin":Js?"bi-check-lg":"bi-clipboard-plus"}`,style:{fontSize:or-2},"aria-hidden":!0}),!Dn&&"Копіювати"]})}),E.jsx(kr,{title:`Більше опцій збереження (${Qe(re.openExportMenu,{isMac:b})})`,onClick:()=>{Xe(w=>!w)},disabled:!Un,hotkeyParts:Ci(re.openExportMenu,{isMac:b}),showHotkeyBadge:sr&&!Dn,children:E.jsx("i",{className:`${Vn} bi-caret-down-fill`,style:{fontSize:or-4},"aria-hidden":!0})})]}),Bn&&E.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:[_t&&E.jsx("button",{type:"button",disabled:!Un,onClick:()=>{if(!_t)return;Xe(!1);const{w}=G;if(!w)return;const S=_t.w/w/2;$i("png",S)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:Un?"#fff":"rgba(255,255,255,0.35)",fontFamily:Tn,fontSize:13,cursor:Un?"pointer":"not-allowed"},children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[E.jsx(ac,{children:"1"}),E.jsxs("span",{children:["PNG оригінал"," ",E.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:[_t.w,"×",_t.h," px"]})]})]})}),E.jsx("button",{type:"button",disabled:!Un,onClick:()=>{Xe(!1),$i("png",1)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:Un?"#fff":"rgba(255,255,255,0.35)",fontFamily:Tn,fontSize:13,cursor:Un?"pointer":"not-allowed"},children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[E.jsx(ac,{children:_t?"2":"1"}),E.jsxs("span",{children:["PNG"," ",E.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:["– ",G.w,"×",G.h," px"]})]})]})}),E.jsx("button",{type:"button",disabled:!Un,onClick:()=>{Xe(!1),$i("png",2)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:Un?"#fff":"rgba(255,255,255,0.35)",fontFamily:Tn,fontSize:13,cursor:Un?"pointer":"not-allowed"},children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[E.jsx(ac,{children:_t?"3":"2"}),E.jsxs("span",{children:["PNG ×2"," ",E.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:["– ",G.w*2,"×",G.h*2," px"]})]})]})}),E.jsx("button",{type:"button",disabled:!Un,onClick:()=>{Xe(!1),$i("jpeg",2)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:Un?"#fff":"rgba(255,255,255,0.35)",fontFamily:Tn,fontSize:13,cursor:Un?"pointer":"not-allowed"},children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[E.jsx(ac,{children:_t?"4":"3"}),E.jsxs("span",{children:["JPG ×2"," ",E.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:["– ",G.w*2,"×",G.h*2," px"]})]})]})}),E.jsx("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),E.jsx("button",{type:"button",disabled:!Un,onClick:()=>{Xe(!1),Qc()},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:Un?"#fff":"rgba(255,255,255,0.35)",fontFamily:Tn,fontSize:13,cursor:Un?"pointer":"not-allowed"},children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[E.jsx(ac,{children:_t?"5":"4"}),E.jsx("span",{children:"PDF"})]})}),E.jsx("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),E.jsx("button",{type:"button",disabled:!Un,onClick:()=>{Xe(!1),Z.length>0&&window.print()},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:Un?"#fff":"rgba(255,255,255,0.35)",fontFamily:Tn,fontSize:13,cursor:Un?"pointer":"not-allowed"},children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[E.jsx(ac,{children:_t?"6":"5"}),E.jsx("span",{children:"Друк… (діалог друку)"})]})})]})]})]}),E.jsx("div",{ref:mr,style:{flex:1,minHeight:0,overflow:C?"auto":"hidden",position:"relative",touchAction:"none"},onClick:w=>w.stopPropagation(),onPointerDown:w=>{if(!C||!mr.current)return;const S=w.target,D=y&&w.pointerType!=="mouse";if(D&&(qi.current.set(w.pointerId,{x:w.clientX,y:w.clientY}),qi.current.size>=2)){const j=Array.from(qi.current.values()),Y=j[0],lt=j[1],st=Math.hypot(lt.x-Y.x,lt.y-Y.y);if(st>0){const ft=mr.current.getBoundingClientRect(),z=(Y.x+lt.x)/2,Ct=(Y.y+lt.y)/2,jt=z-ft.left,St=Ct-ft.top,Dt=wr||1,xt=(mr.current.scrollLeft+jt)/Dt,qt=(mr.current.scrollTop+St)/Dt;Is.current={active:!0,startDistance:st,startZoom:Dt,anchorImageX:xt,anchorImageY:qt},ni.current.isPanning=!1,mr.current.style.cursor="default",w.preventDefault();return}}const _=w.button===1,I=w.button===0&&(S.getAttribute("data-background")==="true"||!!S.closest('[data-background="true"]'));(D||_||I&&!($==="place"&&we))&&(w.preventDefault(),vo.current=!1,ni.current={isPanning:!0,startX:w.clientX,startY:w.clientY,startScrollLeft:mr.current.scrollLeft,startScrollTop:mr.current.scrollTop},mr.current.style.cursor="grabbing")},onPointerMove:w=>{const S=mr.current;if(!S)return;y&&w.pointerType!=="mouse"&&qi.current.has(w.pointerId)&&qi.current.set(w.pointerId,{x:w.clientX,y:w.clientY});const _=Is.current;if(_?.active&&qi.current.size>=2){const j=Array.from(qi.current.values()),Y=j[0],lt=j[1],st=Math.hypot(lt.x-Y.x,lt.y-Y.y);if(st>0&&_.startDistance>0){const ft=S.getBoundingClientRect(),z=(Y.x+lt.x)/2-ft.left,Ct=(Y.y+lt.y)/2-ft.top,jt=st/_.startDistance,St=Math.min(Nm,Math.max(Tm,+(_.startZoom*jt).toFixed(_m))),Dt=Rn.current.w*St,xt=Rn.current.h*St;S.scrollLeft=Math.max(0,Math.min(Dt-S.clientWidth,_.anchorImageX*St-z)),S.scrollTop=Math.max(0,Math.min(xt-S.clientHeight,_.anchorImageY*St-Ct)),vo.current=!1,Ps(St)}w.preventDefault();return}const I=ni.current;if(!I.isPanning)return;w.preventDefault();const K=w.clientX-I.startX,nt=w.clientY-I.startY;S.scrollLeft=I.startScrollLeft-K,S.scrollTop=I.startScrollTop-nt},onPointerUp:w=>{const S=mr.current;S&&(qi.current.has(w.pointerId)&&qi.current.delete(w.pointerId),qi.current.size<2&&(Is.current=null),ni.current.isPanning=!1,S.style.cursor="default")},onPointerCancel:w=>{const S=mr.current;S&&(qi.current.has(w.pointerId)&&qi.current.delete(w.pointerId),qi.current.size<2&&(Is.current=null),ni.current.isPanning=!1,S.style.cursor="default")},onMouseDown:w=>{if(!C||!mr.current)return;const S=w.target,D=w.button===1,_=w.button===0&&(S.getAttribute("data-background")==="true"||!!S.closest('[data-background="true"]'));!D&&(!_||$==="place"&&we)||(w.preventDefault(),vo.current=!1,ni.current={isPanning:!0,startX:w.clientX,startY:w.clientY,startScrollLeft:mr.current.scrollLeft,startScrollTop:mr.current.scrollTop},mr.current.style.cursor="grabbing")},onMouseMove:w=>{const S=ni.current,D=mr.current;if(!S.isPanning||!D)return;w.preventDefault();const _=w.clientX-S.startX,I=w.clientY-S.startY;D.scrollLeft=S.startScrollLeft-_,D.scrollTop=S.startScrollTop-I},onMouseUp:()=>{const w=mr.current;w&&(ni.current.isPanning=!1,w.style.cursor="default")},onMouseLeave:()=>{const w=mr.current;w&&(ni.current.isPanning=!1,w.style.cursor="default")},children:C?E.jsx(E.Fragment,{children:E.jsx("div",{style:{minWidth:"100%",minHeight:"100%",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"},children:E.jsx("div",{style:{width:G.w*wr,height:G.h*wr,position:"relative"},children:E.jsx("div",{ref:is,style:{transform:`scale(${wr})`,transformOrigin:"top left",width:G.w,height:G.h},children:E.jsxs("svg",{ref:ql,width:G.w,height:G.h,viewBox:`0 0 ${G.w} ${G.h}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",cursor:q?"default":$==="place"?"crosshair":"default",touchAction:"none",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"},onContextMenu:w=>{q||Nn(null,w)},onPointerDown:w=>Wi(w),onMouseDown:Wi,onPointerMove:w=>ri(w),onMouseMove:ri,onClick:Dr,onDoubleClick:()=>{At&&At.length>=2&&wi(),Rt&&Rt.length>=2&&ar()},children:[E.jsx("image",{href:C,x:0,y:0,width:G.w,height:G.h,preserveAspectRatio:"xMidYMid meet","data-background":"true",style:{userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"}}),E.jsx("defs",{children:E.jsxs("radialGradient",{id:"vignette",cx:"50%",cy:"50%",r:"70%",children:[E.jsx("stop",{offset:"60%",stopColor:"transparent"}),E.jsx("stop",{offset:"100%",stopColor:"rgba(0,0,0,0.18)"})]})}),E.jsx("rect",{x:0,y:0,width:G.w,height:G.h,fill:"url(#vignette)",pointerEvents:"none","data-background":"true"}),q&&it&&E.jsxs("g",{children:[E.jsx("rect",{x:0,y:0,width:G.w,height:it.y,fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),E.jsx("rect",{x:0,y:it.y+it.height,width:G.w,height:Math.max(0,G.h-it.y-it.height),fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),E.jsx("rect",{x:0,y:it.y,width:it.x,height:it.height,fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),E.jsx("rect",{x:it.x+it.width,y:it.y,width:Math.max(0,G.w-it.x-it.width),height:it.height,fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),E.jsx("rect",{x:it.x,y:it.y,width:it.width,height:it.height,fill:"rgba(78,205,196,0.12)",stroke:"#4ECDC4",strokeWidth:2*de,style:{cursor:"move"},onPointerDown:w=>js(w),onMouseDown:js}),[{key:"nw",x:it.x,y:it.y,cursor:"nwse-resize"},{key:"ne",x:it.x+it.width,y:it.y,cursor:"nesw-resize"},{key:"se",x:it.x+it.width,y:it.y+it.height,cursor:"nwse-resize"},{key:"sw",x:it.x,y:it.y+it.height,cursor:"nesw-resize"}].map(w=>E.jsx("rect",{x:w.x-6*de,y:w.y-6*de,width:12*de,height:12*de,fill:"#4ECDC4",stroke:"#fff",strokeWidth:1.2*de,style:{cursor:w.cursor},onPointerDown:S=>ds(w.key,S),onMouseDown:S=>ds(w.key,S)},w.key))]}),At&&At.length>0&&E.jsxs("g",{stroke:"#4ECDC4",strokeWidth:2*de,fill:"none",children:[At.length>=2&&E.jsx("polyline",{points:At.map(w=>`${w.x},${w.y}`).join(" "),strokeDasharray:`${6*de} ${4*de}`,pointerEvents:"none"}),At.map((w,S)=>E.jsx("circle",{cx:w.x,cy:w.y,r:8*de,fill:"#4ECDC4",stroke:"#fff",strokeWidth:1.5*de,style:{cursor:"move"},onPointerDown:D=>Mf(S,D),onMouseDown:D=>Mf(S,D)},S))]}),Rt&&Rt.length>0&&E.jsxs("g",{stroke:"#9B59B6",strokeWidth:2*de,fill:"none",children:[Rt.length>=2&&E.jsx("polyline",{points:Rt.map(w=>`${w.x},${w.y}`).join(" "),strokeDasharray:`${6*de} ${4*de}`,pointerEvents:"none"}),Rt.map((w,S)=>E.jsx("circle",{cx:w.x,cy:w.y,r:8*de,fill:"#9B59B6",stroke:"#fff",strokeWidth:1.5*de,style:{cursor:"move"},onPointerDown:D=>Cf(S,D),onMouseDown:D=>Cf(S,D)},S))]}),je&&we&&E.jsx("g",{stroke:"#4ECDC4",strokeWidth:2*de,fill:"#4ECDC444",strokeDasharray:`${6*de} ${4*de}`,pointerEvents:"none",children:we==="rectangle"||we==="redact"?E.jsx("rect",{x:Math.min(je.x1,je.x2),y:Math.min(je.y1,je.y2),width:Math.abs(je.x2-je.x1),height:Math.abs(je.y2-je.y1)}):E.jsx("ellipse",{cx:(je.x1+je.x2)/2,cy:(je.y1+je.y2)/2,rx:Math.abs(je.x2-je.x1)/2,ry:Math.abs(je.y2-je.y1)/2})}),Ue&&E.jsx("g",{stroke:"#4ECDC4",strokeWidth:2*de,fill:"none",pointerEvents:"none",children:E.jsx("path",{d:`M ${Ue.start.x} ${Ue.start.y} Q ${Ue.control.x} ${Ue.control.y} ${Ue.end.x} ${Ue.end.y}`,strokeDasharray:`${6*de} ${4*de}`})}),tn&&mn&&$==="place"&&De==="numbering"&&E.jsx("g",{stroke:"#4ECDC4",fill:"none",pointerEvents:"none",children:E.jsx("line",{x1:tn.x,y1:tn.y,x2:mn.x,y2:mn.y,strokeWidth:2*de,strokeDasharray:`${6*de} ${4*de}`})}),Pe.map(w=>E.jsxs("g",{onContextMenu:S=>Nn(w.id,S),children:[[w].map(S=>{if(S.anchor.type==="text"||S.anchor.type==="standalone"||S.anchor.type==="redact"||S.calloutHidden)return null;const D=It[S.id];if(!D)return null;const _=Em(S,Z);return _?E.jsx(SB,{anchor:_,card:D,color:S.color,widthScale:Hr(S),points:S.leaderPoints},S.id+"-line"):null}),Z.filter(S=>S.id===w.id&&S.anchor.type==="point").map(S=>{const{x:D,y:_}=S.anchor;return E.jsx(W8,{x:D,y:_,color:S.color,label:S.label,widthScale:Hr(S),active:Q===S.id,onPointerDown:I=>Kl(S.id,I),onMouseDown:I=>Kl(S.id,I),onClick:I=>{if(I.stopPropagation(),ce.current){ce.current=!1;return}tt(K=>K===S.id?null:S.id),wt(null)}},S.id+"-pin")}),Z.filter(S=>S.id===w.id&&S.anchor.type==="numbering").map(S=>{const{start:D,end:_}=S.anchor,I=Q===S.id,K=Hr(S),nt=String(S.label),j=14*de,Y=.075*j,lt=.4*j,st=.35*j,z=Math.max(j*.62,nt.length*.62*j)+lt*2,Ct=j+Y+st,jt=_.x-z/2,St=_.y-Ct/2,Dt=14*de,xt=4*de,qt=7*de,Wt=6*de,fe=qt*2+Dt*Oa.length+xt*Math.max(0,Oa.length-1),be=Wt*2+Dt,Ee=10*de,Je=_.x-fe/2,En=Math.max(0,Math.min(Je,G.w-fe)),pe=St-Ee-be,Le=Math.max(0,Math.min(pe,G.h-be)),ae=24*de,An=6*de,Hn=En+fe+An,Sr=En-ae-An,Gr=Hn+ae<=G.w?Hn:Sr>=0?Sr:Math.max(0,Math.min(Hn,G.w-ae)),yi=Math.max(0,Math.min(Le+be/2-ae/2,G.h-ae));return E.jsxs("g",{style:{cursor:"pointer"},children:[E.jsx("line",{x1:D.x,y1:D.y,x2:_.x,y2:_.y,stroke:S.color,strokeWidth:(I?3*de:Rf)*K,style:{cursor:"grab"},onPointerDown:zt=>bl(S.id,zt),onMouseDown:zt=>bl(S.id,zt),onClick:zt=>{if(zt.stopPropagation(),ce.current){ce.current=!1;return}tt(He=>He===S.id?null:S.id),wt(null)}}),E.jsx("rect",{x:jt,y:St,width:z,height:Ct,rx:4*de,ry:4*de,fill:"rgba(10,10,16,0.95)",stroke:S.color,strokeWidth:1.5*de,pointerEvents:"none"}),E.jsx("text",{x:_.x,y:_.y,textAnchor:"middle",dominantBaseline:"middle",fill:"#ffffff",style:{fontSize:`${j}px`,fontWeight:700,userSelect:"none",pointerEvents:"none"},children:nt}),I&&E.jsxs(E.Fragment,{children:[E.jsx("circle",{cx:D.x,cy:D.y,r:6*de,fill:S.color,stroke:"#fff",strokeWidth:1.5*de,style:{cursor:"grab"},onPointerDown:zt=>Jl(S.id,"start",zt),onMouseDown:zt=>Jl(S.id,"start",zt)}),E.jsx("circle",{cx:_.x,cy:_.y,r:6*de,fill:S.color,stroke:"#fff",strokeWidth:1.5*de,style:{cursor:"grab"},onPointerDown:zt=>Jl(S.id,"end",zt),onMouseDown:zt=>Jl(S.id,"end",zt)})]}),I&&E.jsx("foreignObject",{x:En,y:Le,width:fe,height:be,children:E.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:zt=>zt.stopPropagation(),onMouseDown:zt=>zt.stopPropagation(),onClick:zt=>zt.stopPropagation(),style:{width:fe,height:be,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",padding:`${Wt}px ${qt}px`,borderRadius:8*de,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)"},children:E.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:`${xt}px`},children:Oa.map(zt=>E.jsx("button",{type:"button",title:`Колір ${zt}`,onClick:()=>Al(S.id,zt),style:{width:Dt,height:Dt,borderRadius:"50%",border:S.color===zt?"2px solid #fff":"1px solid rgba(255,255,255,0.3)",background:zt,padding:0,cursor:"pointer",boxSizing:"border-box"}},`${S.id}-num-color-${zt}`))})})}),I&&E.jsx("foreignObject",{x:Gr,y:yi,width:ae,height:ae,children:E.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:zt=>zt.stopPropagation(),onMouseDown:zt=>zt.stopPropagation(),onClick:zt=>zt.stopPropagation(),children:E.jsx("button",{type:"button",title:"Видалити",onClick:()=>vs(S.id),style:{width:ae,height:ae,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:E.jsx("i",{className:`${Vn} bi-trash`,style:{fontSize:12*de},"aria-hidden":!0})})})})]},S.id+"-numbering")}),Z.filter(S=>S.id===w.id&&S.anchor.type==="polygon"&&S.anchor.points.length>=2).map(S=>{const D=S.anchor.points,_=1/Math.max(wr,1e-4),I=1.5*de*_,K=pt===S.id,nt=Hr(S),{minX:j,minY:Y,maxX:lt,maxY:st}=Nr[S.id],ft=lt-j,z=st-Y,Ct=Pd({minX:j,minY:Y,maxX:lt,maxY:st},G.w,G.h,_),jt=[{cx:j,cy:Y,handle:"nw"},{cx:j+ft/2,cy:Y,handle:"n"},{cx:lt,cy:Y,handle:"ne"},{cx:lt,cy:Y+z/2,handle:"e"},{cx:lt,cy:st,handle:"se"},{cx:j+ft/2,cy:st,handle:"s"},{cx:j,cy:st,handle:"sw"},{cx:j,cy:Y+z/2,handle:"w"}],St=a2(jt,D,_),Dt=xt=>xt==="n"||xt==="s"?"ns-resize":xt==="e"||xt==="w"?"ew-resize":xt==="nw"||xt==="se"?"nwse-resize":"nesw-resize";return E.jsxs("g",{style:{cursor:"default"},children:[E.jsx("polygon",{points:D.map(xt=>`${xt.x},${xt.y}`).join(" "),fill:My(S.color,S.fillStyle),stroke:S.color,strokeWidth:(K?3:2.5)*de*nt,strokeDasharray:Lc(S)?$h(nt):void 0,style:K?{cursor:"grab"}:void 0,onPointerDown:xt=>{K&&(xt.stopPropagation(),xl(S.id,xt))},onMouseDown:xt=>{K&&(xt.stopPropagation(),xl(S.id,xt))},onClick:xt=>{if(xt.stopPropagation(),ce.current){ce.current=!1;return}tt(qt=>qt===S.id?null:S.id),wt(S.id)}}),K&&D.map((xt,qt)=>E.jsx("circle",{cx:xt.x,cy:xt.y,r:8*de*_,fill:S.color,stroke:"white",strokeWidth:2*de*_,style:{cursor:"grab"},onPointerDown:Wt=>hs(S.id,qt,Wt),onMouseDown:Wt=>hs(S.id,qt,Wt),onDoubleClick:Wt=>$c(S.id,qt,Wt)},`v-${qt}`)),K&&D.map((xt,qt)=>{const Wt=D.length,fe=D[qt],be=D[(qt+1)%Wt],Ee=(fe.x+be.x)/2,Je=(fe.y+be.y)/2;return E.jsx("circle",{cx:Ee,cy:Je,r:6*de*_,fill:"white",stroke:S.color,strokeWidth:I,style:{cursor:"pointer"},onPointerDown:En=>Xo(S.id,qt,En),onMouseDown:En=>Xo(S.id,qt,En)},`m-${qt}`)}),K&&E.jsxs(E.Fragment,{children:[E.jsx("rect",{x:j,y:Y,width:ft,height:z,fill:"none",stroke:S.color,strokeWidth:I,strokeDasharray:`${6*de*_} ${4*de*_}`,opacity:.8,style:{pointerEvents:"none"}}),St.map(({cx:xt,cy:qt,handle:Wt})=>E.jsx("rect",{x:xt-Rl*_,y:qt-Rl*_,width:Rl*2*_,height:Rl*2*_,fill:"white",stroke:S.color,strokeWidth:I,style:{cursor:Dt(Wt)},onPointerDown:fe=>Ma(S.id,Wt,fe),onMouseDown:fe=>Ma(S.id,Wt,fe)},`bbox-${Wt}`))]}),K&&E.jsx("g",{transform:`translate(${Ct.cx}, ${Ct.cy})`,style:{cursor:"move"},onPointerDown:xt=>Xc(S.id,xt),onMouseDown:xt=>Xc(S.id,xt),children:E.jsx(Id,{color:S.color,scale:_})})]},S.id+"-poly")}),Z.filter(S=>S.id===w.id&&S.anchor.type==="polyline"&&S.anchor.points.length>=2).map(S=>{const D=S.anchor.points,_=1/Math.max(wr,1e-4),I=1.5*de*_,K=pt===S.id,nt=Hr(S),{minX:j,minY:Y,maxX:lt,maxY:st}=Nr[S.id],ft=lt-j,z=st-Y,Ct=Pd({minX:j,minY:Y,maxX:lt,maxY:st},G.w,G.h,_),jt=[{cx:j,cy:Y,handle:"nw"},{cx:j+ft/2,cy:Y,handle:"n"},{cx:lt,cy:Y,handle:"ne"},{cx:lt,cy:Y+z/2,handle:"e"},{cx:lt,cy:st,handle:"se"},{cx:j+ft/2,cy:st,handle:"s"},{cx:j,cy:st,handle:"sw"},{cx:j,cy:Y+z/2,handle:"w"}],St=a2(jt,D,_),Dt=xt=>xt==="n"||xt==="s"?"ns-resize":xt==="e"||xt==="w"?"ew-resize":xt==="nw"||xt==="se"?"nwse-resize":"nesw-resize";return E.jsxs("g",{style:{cursor:"default"},children:[E.jsx("polyline",{points:D.map(xt=>`${xt.x},${xt.y}`).join(" "),fill:"none",stroke:S.color,strokeWidth:(K?3:2.5)*de*nt,strokeDasharray:Lc(S)?$h(nt):void 0,style:K?{cursor:"grab"}:void 0,onPointerDown:xt=>{K&&(xt.stopPropagation(),$a(S.id,xt))},onMouseDown:xt=>{K&&(xt.stopPropagation(),$a(S.id,xt))},onClick:xt=>{if(xt.stopPropagation(),ce.current){ce.current=!1;return}tt(qt=>qt===S.id?null:S.id),wt(S.id)}}),K&&D.map((xt,qt)=>E.jsx("circle",{cx:xt.x,cy:xt.y,r:8*de*_,fill:S.color,stroke:"white",strokeWidth:2*de*_,style:{cursor:"grab"},onPointerDown:Wt=>ps(S.id,qt,Wt),onMouseDown:Wt=>ps(S.id,qt,Wt),onDoubleClick:Wt=>Gc(S.id,qt,Wt)},`v-${qt}`)),K&&D.slice(0,-1).map((xt,qt)=>{const Wt=D[qt],fe=D[qt+1],be=(Wt.x+fe.x)/2,Ee=(Wt.y+fe.y)/2;return E.jsx("circle",{cx:be,cy:Ee,r:6*de*_,fill:"white",stroke:S.color,strokeWidth:I,style:{cursor:"pointer"},onPointerDown:Je=>Ql(S.id,qt,Je),onMouseDown:Je=>Ql(S.id,qt,Je)},`m-${qt}`)}),K&&E.jsxs(E.Fragment,{children:[E.jsx("rect",{x:j,y:Y,width:ft,height:z,fill:"none",stroke:S.color,strokeWidth:I,strokeDasharray:`${6*de*_} ${4*de*_}`,opacity:.8,style:{pointerEvents:"none"}}),St.map(({cx:xt,cy:qt,handle:Wt})=>E.jsx("rect",{x:xt-Rl*_,y:qt-Rl*_,width:Rl*2*_,height:Rl*2*_,fill:"white",stroke:S.color,strokeWidth:I,style:{cursor:Dt(Wt)},onPointerDown:fe=>ms(S.id,Wt,fe),onMouseDown:fe=>ms(S.id,Wt,fe)},`bbox-${Wt}`))]}),K&&E.jsx("g",{transform:`translate(${Ct.cx}, ${Ct.cy})`,style:{cursor:"move"},onPointerDown:xt=>ec(S.id,xt),onMouseDown:xt=>ec(S.id,xt),children:E.jsx(Id,{color:S.color,scale:_})})]},S.id+"-polyline")}),Z.filter(S=>S.id===w.id&&S.anchor.type==="arrow").map(S=>{const{start:D,end:_,control:I}=S.anchor,K=1/Math.max(wr,1e-4),nt=pt===S.id,j=Hr(S),Y=[D,_,I],lt=Math.min(...Y.map(ae=>ae.x)),st=Math.min(...Y.map(ae=>ae.y)),ft=Math.max(...Y.map(ae=>ae.x)),z=Math.max(...Y.map(ae=>ae.y)),Ct=ft-lt,jt=z-st,St=Pd({minX:lt,minY:st,maxX:ft,maxY:z},G.w,G.h,K),Dt=[{cx:lt,cy:st,handle:"nw"},{cx:lt+Ct/2,cy:st,handle:"n"},{cx:ft,cy:st,handle:"ne"},{cx:ft,cy:st+jt/2,handle:"e"},{cx:ft,cy:z,handle:"se"},{cx:lt+Ct/2,cy:z,handle:"s"},{cx:lt,cy:z,handle:"sw"},{cx:lt,cy:st+jt/2,handle:"w"}],xt=a2(Dt,Y,K),qt=ae=>ae==="n"||ae==="s"?"ns-resize":ae==="e"||ae==="w"?"ew-resize":ae==="nw"||ae==="se"?"nwse-resize":"nesw-resize",Wt=Ck(I,_),fe=Math.atan2(Wt.y,Wt.x),be=12*de*K,Ee=Math.PI/7,Je=_.x-Math.cos(fe-Ee)*be,En=_.y-Math.sin(fe-Ee)*be,pe=_.x-Math.cos(fe+Ee)*be,Le=_.y-Math.sin(fe+Ee)*be;return E.jsxs("g",{style:{cursor:"default"},children:[E.jsx("path",{d:`M ${D.x} ${D.y} Q ${I.x} ${I.y} ${_.x} ${_.y}`,fill:"none",stroke:S.color,strokeWidth:(nt?3:2.5)*de*j,strokeDasharray:Lc(S)?$h(j):void 0,style:nt?{cursor:"grab"}:void 0,onPointerDown:ae=>{nt&&Ac(S.id,ae)},onMouseDown:ae=>{nt&&Ac(S.id,ae)},onClick:ae=>{if(ae.stopPropagation(),ce.current){ce.current=!1;return}tt(An=>An===S.id?null:S.id),wt(S.id)}}),E.jsx("path",{d:`M ${_.x} ${_.y} L ${Je} ${En} L ${pe} ${Le} Z`,fill:S.color,stroke:S.color,strokeWidth:(nt?3:2.5)*de*j,pointerEvents:"none"}),nt&&E.jsxs(E.Fragment,{children:[E.jsx("rect",{x:lt,y:st,width:Ct,height:jt,fill:"none",stroke:S.color,strokeWidth:1.5*de*K,strokeDasharray:`${6*de*K} ${4*de*K}`,opacity:.8,style:{pointerEvents:"none"}}),xt.map(({cx:ae,cy:An,handle:Hn})=>E.jsx("rect",{x:ae-Rl*K,y:An-Rl*K,width:Rl*2*K,height:Rl*2*K,fill:"white",stroke:S.color,strokeWidth:1.5*de*K,style:{cursor:qt(Hn)},onPointerDown:Sr=>tc(S.id,Hn,Sr),onMouseDown:Sr=>tc(S.id,Hn,Sr)},`arrow-bbox-${Hn}`)),E.jsx("g",{transform:`translate(${St.cx}, ${St.cy})`,style:{cursor:"move"},onPointerDown:ae=>Kc(S.id,ae),onMouseDown:ae=>Kc(S.id,ae),children:E.jsx(Id,{color:S.color,scale:K})}),E.jsx("circle",{cx:D.x,cy:D.y,r:7*de*K,fill:S.color,stroke:"#fff",strokeWidth:1.5*de*K,style:{cursor:"grab"},onPointerDown:ae=>Ya(S.id,"start",ae),onMouseDown:ae=>Ya(S.id,"start",ae)}),E.jsx("circle",{cx:_.x,cy:_.y,r:7*de*K,fill:S.color,stroke:"#fff",strokeWidth:1.5*de*K,style:{cursor:"grab"},onPointerDown:ae=>Ya(S.id,"end",ae),onMouseDown:ae=>Ya(S.id,"end",ae)}),E.jsx("circle",{cx:I.x,cy:I.y,r:6*de*K,fill:"#fff",stroke:S.color,strokeWidth:1.5*de*K,style:{cursor:"grab"},onPointerDown:ae=>Ya(S.id,"control",ae),onMouseDown:ae=>Ya(S.id,"control",ae)})]})]},S.id+"-arrow")}),Z.filter(S=>S.id===w.id&&S.anchor.type==="rectangle").map(S=>{const{x:D,y:_,width:I,height:K,rotation:nt=0}=S.anchor,j=1/Math.max(wr,1e-4),Y=pt===S.id,lt=Hr(S),st=D+I/2,ft=_+K/2,z=nt*Math.PI/180,Ct=Math.cos(z),jt=Math.sin(z),St=(Wt,fe)=>({cx:st+Wt*Ct-fe*jt,cy:ft+Wt*jt+fe*Ct}),Dt=[{...St(-I/2,-K/2),handle:"nw"},{...St(0,-K/2),handle:"n"},{...St(I/2,-K/2),handle:"ne"},{...St(I/2,0),handle:"e"},{...St(I/2,K/2),handle:"se"},{...St(0,K/2),handle:"s"},{...St(-I/2,K/2),handle:"sw"},{...St(-I/2,0),handle:"w"}],xt=Pd({minX:Math.min(...Dt.map(Wt=>Wt.cx)),minY:Math.min(...Dt.map(Wt=>Wt.cy)),maxX:Math.max(...Dt.map(Wt=>Wt.cx)),maxY:Math.max(...Dt.map(Wt=>Wt.cy))},G.w,G.h,j),qt=Wt=>Wt==="n"||Wt==="s"?"ns-resize":Wt==="e"||Wt==="w"?"ew-resize":Wt==="nw"||Wt==="se"?"nwse-resize":"nesw-resize";return E.jsxs("g",{style:{cursor:"default"},children:[E.jsx("g",{transform:`rotate(${nt} ${st} ${ft})`,children:E.jsx("rect",{x:D,y:_,width:I,height:K,fill:My(S.color,S.fillStyle),stroke:S.color,strokeWidth:(Y?3:2.5)*de*lt,strokeDasharray:Lc(S)?$h(lt):void 0,style:Y?{cursor:"grab"}:void 0,onPointerDown:Wt=>{Y&&(Wt.stopPropagation(),Yc(S.id,Wt))},onMouseDown:Wt=>{Y&&(Wt.stopPropagation(),Yc(S.id,Wt))},onClick:Wt=>{if(Wt.stopPropagation(),ce.current){ce.current=!1;return}tt(fe=>fe===S.id?null:S.id),wt(S.id)}})}),Y&&Dt.map(({cx:Wt,cy:fe,handle:be})=>E.jsx("circle",{cx:Wt,cy:fe,r:s2*j,fill:S.color,stroke:"white",strokeWidth:1.5*de*j,style:{cursor:qt(be)},onPointerDown:Ee=>Sc(S.id,be,Ee),onMouseDown:Ee=>Sc(S.id,be,Ee)},be)),Y&&E.jsx("g",{transform:`translate(${xt.cx}, ${xt.cy})`,style:{cursor:"move"},onPointerDown:Wt=>kc(S.id,Wt),onMouseDown:Wt=>kc(S.id,Wt),children:E.jsx(Id,{color:S.color,scale:j})})]},S.id+"-rect")}),Z.filter(S=>S.id===w.id&&S.anchor.type==="ellipse").map(S=>{const{cx:D,cy:_,rx:I,ry:K,rotation:nt=0}=S.anchor,j=1/Math.max(wr,1e-4),Y=pt===S.id,lt=Hr(S),st=nt*Math.PI/180,ft=Math.cos(st),z=Math.sin(st),Ct=(xt,qt)=>({cx:D+xt*ft-qt*z,cy:_+xt*z+qt*ft}),jt=[{...Ct(-I,-K),handle:"nw"},{...Ct(0,-K),handle:"n"},{...Ct(I,-K),handle:"ne"},{...Ct(I,0),handle:"e"},{...Ct(I,K),handle:"se"},{...Ct(0,K),handle:"s"},{...Ct(-I,K),handle:"sw"},{...Ct(-I,0),handle:"w"}],St=Pd({minX:Math.min(...jt.map(xt=>xt.cx)),minY:Math.min(...jt.map(xt=>xt.cy)),maxX:Math.max(...jt.map(xt=>xt.cx)),maxY:Math.max(...jt.map(xt=>xt.cy))},G.w,G.h,j),Dt=xt=>xt==="n"||xt==="s"?"ns-resize":xt==="e"||xt==="w"?"ew-resize":xt==="nw"||xt==="se"?"nwse-resize":"nesw-resize";return E.jsxs("g",{style:{cursor:"default"},children:[E.jsx("g",{transform:`rotate(${nt} ${D} ${_})`,children:E.jsx("ellipse",{cx:D,cy:_,rx:I,ry:K,fill:My(S.color,S.fillStyle),stroke:S.color,strokeWidth:(Y?3:2.5)*de*lt,strokeDasharray:Lc(S)?$h(lt):void 0,style:Y?{cursor:"grab"}:void 0,onPointerDown:xt=>{Y&&(xt.stopPropagation(),wc(S.id,xt))},onMouseDown:xt=>{Y&&(xt.stopPropagation(),wc(S.id,xt))},onClick:xt=>{if(xt.stopPropagation(),ce.current){ce.current=!1;return}tt(qt=>qt===S.id?null:S.id),wt(S.id)}})}),Y&&jt.map(({cx:xt,cy:qt,handle:Wt})=>E.jsx("circle",{cx:xt,cy:qt,r:s2*j,fill:S.color,stroke:"white",strokeWidth:1.5*de*j,style:{cursor:Dt(Wt)},onPointerDown:fe=>Vc(S.id,Wt,fe),onMouseDown:fe=>Vc(S.id,Wt,fe)},Wt)),Y&&E.jsx("g",{transform:`translate(${St.cx}, ${St.cy})`,style:{cursor:"move"},onPointerDown:xt=>oo(S.id,xt),onMouseDown:xt=>oo(S.id,xt),children:E.jsx(Id,{color:S.color,scale:j})})]},S.id+"-ellipse")}),Z.filter(S=>S.id===w.id&&S.anchor.type==="text").map(S=>{const D=Q===S.id||pt===S.id,_=_o===S.id,I=S.textColor??"#ffffff",K=S.textBackgroundColor,nt=`${S.textUnderline?" underline":""}${S.textStrike?" line-through":""}`.trim(),j=S.textBold?700:400,Y=S.textItalic?"italic":"normal",lt=S.textFontSize??Vs,{x:st,y:ft,width:z,height:Ct}=S.anchor,jt=1/Math.max(wr,1e-4),St=Hr(S);return E.jsxs("g",{children:[S.anchor.point&&E.jsx("circle",{cx:S.anchor.point.x,cy:S.anchor.point.y,r:Yh*St,fill:S.color,stroke:"white",strokeWidth:ig*St,style:{cursor:"grab"},onPointerDown:Dt=>Ef(S.id,Dt),onMouseDown:Dt=>Ef(S.id,Dt)}),E.jsx("foreignObject",{x:st,y:ft,width:z,height:Ct,onPointerDown:Dt=>vl(S.id,Dt),children:E.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",ref:_?Dt=>{Lo.current=Dt}:void 0,"data-text-pin-id":S.id,contentEditable:_,suppressContentEditableWarning:!0,onContextMenu:Dt=>Dt.preventDefault(),onPointerDown:Dt=>{if(!_){vl(S.id,Dt);return}Dt.stopPropagation()},onDoubleClick:Dt=>{Dt.preventDefault(),Dt.stopPropagation(),tt(S.id),wt(S.id),Do(S.id)},onBlur:()=>{_&&(Zc(S.id),Do(Dt=>Dt===S.id?null:Dt))},onInput:Dt=>{if(!_)return;const xt=Dt.currentTarget,qt=xt.innerHTML,Wt=zs(qt,{fontSize:S.textFontSize??Vs,bold:S.textBold??!1,italic:S.textItalic??!1}),fe=xt.closest("foreignObject");fe&&(fe.setAttribute("width",String(Wt.width)),fe.setAttribute("height",String(Wt.height)))},style:{width:"100%",height:"auto",overflow:"hidden",whiteSpace:"pre",wordBreak:"normal",overflowWrap:"normal",color:I,background:K??"transparent",border:D?`1px dashed ${S.color}`:"1px dashed transparent",borderRadius:sS,padding:`0 ${E2}px`,boxSizing:"border-box",fontFamily:Tn,fontSize:lt,lineHeight:1.4,fontWeight:j,fontStyle:Y,textDecoration:nt||"none",outline:"none",cursor:_?"text":"move",userSelect:"text"},..._?{}:{dangerouslySetInnerHTML:{__html:$r(S.description)}}})}),D&&!_&&(()=>{const Dt=5*jt;return[{cx:st,cy:ft,key:"nw",cursor:"nwse-resize"},{cx:st+z,cy:ft,key:"ne",cursor:"nesw-resize"},{cx:st+z,cy:ft+Ct,key:"se",cursor:"nwse-resize"},{cx:st,cy:ft+Ct,key:"sw",cursor:"nesw-resize"}].map(qt=>E.jsx("circle",{cx:qt.cx,cy:qt.cy,r:Dt,fill:S.color,stroke:"#ffffff",strokeWidth:1.2*jt,style:{cursor:qt.cursor},onPointerDown:Wt=>Lu(S.id,qt.key,Wt),onMouseDown:Wt=>Lu(S.id,qt.key,Wt)},`${S.id}-text-resize-${qt.key}`))})()]},`${S.id}-text`)}),Z.filter(S=>S.id===w.id&&S.anchor.type==="redact").map(S=>{const{x:D,y:_,width:I,height:K,mode:nt,strength:j}=S.anchor,Y=Q===S.id||pt===S.id,lt=1/Math.max(wr,1e-4),st=5*de*lt,ft=[{id:"nw",cx:D,cy:_,cursor:"nwse-resize"},{id:"ne",cx:D+I,cy:_,cursor:"nesw-resize"},{id:"se",cx:D+I,cy:_+K,cursor:"nwse-resize"},{id:"sw",cx:D,cy:_+K,cursor:"nesw-resize"}];return E.jsxs("g",{children:[E.jsx(tD,{x:D,y:_,width:I,height:K,mode:nt,strength:j,source:oi??fl,imageSize:G}),E.jsx("rect",{x:D,y:_,width:I,height:K,fill:"rgba(0,0,0,0.001)",style:{cursor:"grab"},onPointerDown:z=>gs(S.id,z),onMouseDown:z=>gs(S.id,z),onClick:z=>{if(z.stopPropagation(),ce.current){ce.current=!1;return}tt(S.id),wt(S.id)}}),Y&&E.jsxs(E.Fragment,{children:[E.jsx("rect",{x:D,y:_,width:I,height:K,fill:"none",stroke:tf,strokeWidth:1.5*de*lt,strokeDasharray:`${5*de*lt} ${3*de*lt}`,pointerEvents:"none"}),ft.map(z=>E.jsx("circle",{cx:z.cx,cy:z.cy,r:st,fill:tf,stroke:"#fff",strokeWidth:1.2*de*lt,style:{cursor:z.cursor},onPointerDown:Ct=>Va(S.id,z.id,Ct),onMouseDown:Ct=>Va(S.id,z.id,Ct)},`${S.id}-redact-${z.id}`))]})]},`${S.id}-redact`)}),Z.filter(S=>S.id===w.id&&S.anchor.type==="image").map(S=>{const{x:D,y:_,width:I,height:K,src:nt}=S.anchor,j=Q===S.id||pt===S.id,Y=1/Math.max(wr,1e-4),lt=5*de*Y,st=[{id:"nw",cx:D,cy:_,cursor:"nwse-resize"},{id:"ne",cx:D+I,cy:_,cursor:"nesw-resize"},{id:"se",cx:D+I,cy:_+K,cursor:"nwse-resize"},{id:"sw",cx:D,cy:_+K,cursor:"nesw-resize"}];return E.jsxs("g",{children:[E.jsx("image",{href:nt,x:D,y:_,width:I,height:K,preserveAspectRatio:"xMidYMid meet",style:{cursor:"grab"},onPointerDown:ft=>bs(S.id,ft),onMouseDown:ft=>bs(S.id,ft),onClick:ft=>{if(ft.stopPropagation(),ce.current){ce.current=!1;return}tt(S.id),wt(S.id)}}),j&&E.jsxs(E.Fragment,{children:[E.jsx("rect",{x:D,y:_,width:I,height:K,fill:"none",stroke:tf,strokeWidth:1.5*de*Y,strokeDasharray:`${5*de*Y} ${3*de*Y}`,pointerEvents:"none"}),st.map(ft=>E.jsx("circle",{cx:ft.cx,cy:ft.cy,r:lt,fill:tf,stroke:"#fff",strokeWidth:1.2*de*Y,style:{cursor:ft.cursor},onPointerDown:z=>Go(S.id,ft.id,z),onMouseDown:z=>Go(S.id,ft.id,z)},`${S.id}-img-${ft.id}`))]})]},`${S.id}-image`)}),Z.filter(S=>S.id===w.id&&S.anchor.type==="compass").map(S=>{const{cx:D,cy:_,radius:I,rotation:K=0}=S.anchor,nt=1/Math.max(wr,1e-4),j=pt===S.id,Y=Hr(S),lt=K*Math.PI/180,st=Math.cos(lt),ft=Math.sin(lt),z=(Te,ze)=>({cx:D+Te*st-ze*ft,cy:_+Te*ft+ze*st}),Ct=[{...z(0,-I),handle:"n"},{...z(I,0),handle:"e"},{...z(0,I),handle:"s"},{...z(-I,0),handle:"w"}],jt=M5(I),St=Te=>Te==="n"||Te==="s"?"ns-resize":"ew-resize",Dt=14*de,xt=4*de,qt=7*de,Wt=6*de,fe=qt*2+Dt*Oa.length+xt*Math.max(0,Oa.length-1),be=Wt*2+Dt,Ee=10*de,Je=D-fe/2,En=Math.max(0,Math.min(Je,G.w-fe)),Le=_<G.h/2?_+I+Ee:_-I-Ee-be,ae=Math.max(0,Math.min(Le,G.h-be)),An=24*de,Hn=6*de,Sr=En+fe+Hn,Gr=En-An-Hn,yi=Sr+An<=G.w?Sr:Gr>=0?Gr:Math.max(0,Math.min(Sr,G.w-An)),zt=Math.max(0,Math.min(ae+be/2-An/2,G.h-An)),He=Pd({minX:D-I,minY:_-I,maxX:D+I,maxY:_+I},G.w,G.h,nt,[{x:En,y:ae,w:fe,h:be},{x:yi,y:zt,w:An,h:An}]);return E.jsxs("g",{style:{cursor:"default"},children:[E.jsxs("g",{transform:`rotate(${K} ${D} ${_})`,children:[E.jsx("circle",{cx:D,cy:_,r:I,fill:"transparent",stroke:"none",style:j?{cursor:"grab"}:void 0,onPointerDown:Te=>{j&&(Te.stopPropagation(),Xi(S.id,Te))},onMouseDown:Te=>{j&&(Te.stopPropagation(),Xi(S.id,Te))},onClick:Te=>{if(Te.stopPropagation(),ce.current){ce.current=!1;return}tt(ze=>ze===S.id?null:S.id),wt(S.id)}}),E.jsx("path",{d:Y8(D,_,I),fill:"none",stroke:S.color,strokeWidth:(j?ag*1.35:ag)*Y,strokeLinecap:"round",pointerEvents:"none"}),E.jsx("polygon",{points:jt.arrowPoints.map(Te=>`${D+Te.x},${_+Te.y}`).join(" "),fill:S.color,pointerEvents:"none"}),E.jsx("text",{x:D,y:_+jt.letterY,textAnchor:"middle",dominantBaseline:"middle",fill:S.color,style:{fontSize:`${jt.fontSize}px`,fontWeight:700,userSelect:"none",pointerEvents:"none"},children:"N"})]}),j&&Ct.map(({cx:Te,cy:ze,handle:Be})=>E.jsx("circle",{cx:Te,cy:ze,r:s2*nt,fill:S.color,stroke:"white",strokeWidth:1.5*de*nt,style:{cursor:St(Be)},onPointerDown:vn=>Wc(S.id,Be,vn),onMouseDown:vn=>Wc(S.id,Be,vn)},Be)),j&&E.jsx("g",{transform:`translate(${He.cx}, ${He.cy})`,style:{cursor:"move"},onPointerDown:Te=>so(S.id,Te),onMouseDown:Te=>so(S.id,Te),children:E.jsx(Id,{color:S.color,scale:nt})}),j&&E.jsx("foreignObject",{x:En,y:ae,width:fe,height:be,children:E.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:Te=>Te.stopPropagation(),onMouseDown:Te=>Te.stopPropagation(),onClick:Te=>Te.stopPropagation(),style:{width:fe,height:be,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",padding:`${Wt}px ${qt}px`,borderRadius:8*de,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)"},children:E.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:`${xt}px`},children:Oa.map(Te=>E.jsx("button",{type:"button",title:`Колір ${Te}`,onClick:()=>Al(S.id,Te),style:{width:Dt,height:Dt,borderRadius:"50%",border:S.color===Te?"2px solid #fff":"1px solid rgba(255,255,255,0.3)",background:Te,padding:0,cursor:"pointer",boxSizing:"border-box"}},`${S.id}-compass-color-${Te}`))})})}),j&&E.jsx("foreignObject",{x:yi,y:zt,width:An,height:An,children:E.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:Te=>Te.stopPropagation(),onMouseDown:Te=>Te.stopPropagation(),onClick:Te=>Te.stopPropagation(),children:E.jsx("button",{type:"button",title:"Видалити",onClick:()=>vs(S.id),style:{width:An,height:An,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:E.jsx("i",{className:`${Vn} bi-trash`,style:{fontSize:12*de},"aria-hidden":!0})})})})]},S.id+"-compass")}),[w].map(S=>{if(S.anchor.type==="text"||S.anchor.type==="redact"||S.calloutHidden)return null;const D=It[S.id];if(!D)return null;const _=S.anchor.type==="standalone"?null:Em(S,Z),I=_?og(_,D,S.leaderPoints):void 0;return E.jsx(vB,{pin:S,leaderPath:I,fontFamily:Tn,justCreated:Fn.current===S.id,position:D,imageSize:G,active:pt===S.id,isSelected:pt===S.id||Q===S.id,onUpdateDescription:Bs,onUpdateImage:kl,onClearImage:K=>{te(),ut(nt=>nt.map(j=>j.id===K?{...j,image:null,imageAspect:null}:j))},onDragStart:qr,onResizeStart:Aa,onActivate:K=>{tt(K),wt(K)},onUpdateColor:Al,onUpdateStrokeStyle:Xa,onUpdateFillStyle:ia,strokeWidthScale:Hr(S),onUpdateStrokeWidthScale:Ca,onContextMenu:Nn,controlsLayer:Ii,controlsCollapsed:go,onToggleControlsCollapsed:ha,onToggleDescPos:Cc,onToggleTheme:K=>{te(),ut(nt=>nt.map(j=>j.id===K?{...j,theme:j.theme==="light"?"dark":"light"}:j))},onHide:K=>Ec(K,!0),onAddLinked:So(S)?Ml:void 0,onDelete:vs,onUpdateTextStyle:(K,nt)=>{te(),ut(j=>j.map(Y=>Y.id===K?{...Y,textBold:nt.bold??Y.textBold??!1,textItalic:nt.italic??Y.textItalic??!1,textUnderline:nt.underline??Y.textUnderline??!1,textStrike:nt.strike??Y.textStrike??!1}:Y))},onUpdateTextFontSize:(K,nt)=>{te(),ut(j=>j.map(Y=>{if(Y.id!==K)return Y;let st=(Y.textFontSize??Vs)+nt;return st=Math.max(10,st),{...Y,textFontSize:st}}))}},S.id+"-card")})]},w.id+"-z")),Z.filter(w=>w.anchor.type==="text"&&(Q===w.id||pt===w.id)).map(w=>{const S=Uc.w,D=Uc.h,_=4*on,I=Math.max(0,Math.min(w.anchor.x,G.w-S)),K=w.anchor.y+w.anchor.height/2,nt=G.h/2,Y=K<nt?w.anchor.y+w.anchor.height+_:w.anchor.y-D-_,lt=Math.max(0,Math.min(Y,G.h-D)),st=al===w.id,ft=lt,z=D,Ct=32*on,jt=6*on,St=I+S+jt,Dt=I-Ct-jt,xt=St+Ct<=G.w?St:Dt>=0?Dt:Math.max(0,Math.min(St,G.w-Ct)),qt=168*on,Wt=132*on,fe=Math.max(0,Math.min(I+S-qt,G.w-qt)),be=Math.max(0,lt-Wt-6*on),Ee=pe=>{te(),ut(Le=>Le.map(ae=>ae.id===w.id?{...ae,textColor:pe}:ae))},Je=pe=>{te(),ut(Le=>Le.map(ae=>ae.id===w.id?{...ae,textBackgroundColor:pe}:ae)),Ul(null)},En=pe=>{te(),ut(Le=>Le.map(ae=>{if(ae.id!==w.id||ae.anchor.type!=="text")return ae;const An={...ae,...pe},Hn=ae.anchor,Sr=zs(An.description||"",{fontSize:An.textFontSize??Vs,bold:An.textBold??!1,italic:An.textItalic??!1}),Gr=Math.max(0,G.w-Sr.width),yi=Math.max(0,G.h-Sr.height);return{...An,anchor:{...Hn,width:Sr.width,height:Sr.height,x:Math.max(0,Math.min(Hn.x,Gr)),y:Math.max(0,Math.min(Hn.y,yi))}}}))};return E.jsxs("g",{children:[E.jsx("foreignObject",{x:I,y:ft,width:S,height:z,children:E.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:pe=>pe.stopPropagation(),onMouseDown:pe=>pe.stopPropagation(),style:{width:"100%",height:D,boxSizing:"border-box",display:"flex",alignItems:"flex-start"},children:E.jsxs("div",{ref:ga,style:{width:"max-content",minWidth:300*on,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)",borderRadius:10*on,padding:`${8*on}px ${10*on}px`,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7*on},children:[w.anchor.point&&(()=>{const pe=Hr(w),Le=(pe-rl)/(Eu-rl)*100;return E.jsxs(E.Fragment,{children:[E.jsxs("div",{style:{display:"flex",gap:o2,alignItems:"center",justifyContent:"center",flexWrap:"nowrap",flexShrink:0},children:[E.jsx("i",{className:`${Vn} bi-record-circle`,style:Ek,"aria-hidden":!0}),Oa.map(ae=>E.jsx("button",{type:"button",title:`Колір точки ${ae}`,onClick:()=>Al(w.id,ae),style:{width:Jm,height:Jm,borderRadius:"50%",background:ae,border:w.color===ae?"2px solid #fff":"1px solid rgba(255,255,255,0.25)",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0}},`${w.id}-pointc-${ae}`))]}),E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:o2},children:[E.jsx("input",{type:"range",className:"tyts-range",min:rl,max:Eu,step:v0,value:pe,"aria-label":"Розмір точки",title:"Розмір точки",onChange:ae=>Ca(w.id,Number(ae.target.value)),style:{flex:1,minWidth:0,"--tyts-range-accent":w.color,"--tyts-range-fill":`${Le}%`}}),E.jsxs("span",{style:{color:"#aaa",fontSize:11*on,minWidth:30*on,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:["×",w0(pe)]})]})]})})(),E.jsxs("div",{style:{display:"flex",gap:o2,alignItems:"center",justifyContent:"center",flexWrap:"nowrap",flexShrink:0},children:[E.jsx("i",{className:`${Vn} bi-type`,style:Ek,"aria-hidden":!0}),Oa.map(pe=>E.jsx("button",{type:"button",onClick:()=>Ee(pe),style:{width:Jm,height:Jm,borderRadius:"50%",border:w.textColor===pe?"2px solid #fff":"1px solid rgba(255,255,255,0.25)",background:pe,padding:0,cursor:"pointer",boxSizing:"border-box"}},`${w.id}-tc-${pe}`))]}),E.jsxs("div",{style:{display:"flex",gap:4*on,alignItems:"center",justifyContent:"space-between",position:"relative",flexWrap:"nowrap"},children:[E.jsx("button",{type:"button",style:{...If,fontWeight:700},onClick:()=>{Pi(w.id,"bold")||En({textBold:!(w.textBold??!1)})},children:"B"}),E.jsx("button",{type:"button",style:{...If,fontStyle:"italic"},onClick:()=>{Pi(w.id,"italic")||En({textItalic:!(w.textItalic??!1)})},children:"I"}),E.jsx("button",{type:"button",style:{...If,textDecoration:"underline"},onClick:()=>{Pi(w.id,"underline")||En({textUnderline:!(w.textUnderline??!1)})},children:"U"}),E.jsx("button",{type:"button",style:{...If,textDecoration:"line-through"},onClick:()=>{Pi(w.id,"strikeThrough")||En({textStrike:!(w.textStrike??!1)})},children:"S"}),E.jsx("button",{type:"button",style:If,onClick:()=>{te(),ut(pe=>pe.map(Le=>{if(Le.id!==w.id||Le.anchor.type!=="text")return Le;const ae={...Le,textFontSize:Math.max(10,(Le.textFontSize??Vs)-2)},An=Le.anchor,Hn=zs(ae.description||"",{fontSize:ae.textFontSize??Vs,bold:ae.textBold??!1,italic:ae.textItalic??!1}),Sr=Math.max(0,G.w-Hn.width),Gr=Math.max(0,G.h-Hn.height);return{...ae,anchor:{...An,width:Hn.width,height:Hn.height,x:Math.max(0,Math.min(An.x,Sr)),y:Math.max(0,Math.min(An.y,Gr))}}}))},children:"A-"}),E.jsx("button",{type:"button",style:If,onClick:()=>{te(),ut(pe=>pe.map(Le=>{if(Le.id!==w.id||Le.anchor.type!=="text")return Le;const ae={...Le,textFontSize:(Le.textFontSize??Vs)+2},An=Le.anchor,Hn=zs(ae.description||"",{fontSize:ae.textFontSize??Vs,bold:ae.textBold??!1,italic:ae.textItalic??!1}),Sr=Math.max(0,G.w-Hn.width),Gr=Math.max(0,G.h-Hn.height);return{...ae,anchor:{...An,width:Hn.width,height:Hn.height,x:Math.max(0,Math.min(An.x,Sr)),y:Math.max(0,Math.min(An.y,Gr))}}}))},children:"A+"}),E.jsx("div",{"data-text-bg-picker":"true",style:{position:"relative"},children:E.jsxs("button",{type:"button",onClick:()=>Ul(pe=>pe===w.id?null:w.id),style:{...If,minWidth:42*on,justifyContent:"space-between",gap:6*on,padding:`0 ${7*on}px`,color:"#e8e8e8"},title:"Колір фону тексту",children:[E.jsx("span",{style:{width:18*on,height:18*on,borderRadius:3*on,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*on,fontWeight:700},children:"A"}),E.jsx("i",{className:`${Vn} bi-chevron-down`,style:{fontSize:11*on},"aria-hidden":!0})]})})]})]})})},`${w.id}-text-tools`),st&&E.jsx("foreignObject",{x:fe,y:be,width:qt,height:Wt,style:{overflow:"visible"},children:E.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml","data-text-bg-picker":"true",onPointerDown:pe=>pe.stopPropagation(),onMouseDown:pe=>pe.stopPropagation(),style:{width:"100%",background:"rgba(18, 20, 30, 0.98)",border:"1px solid rgba(255,255,255,0.18)",borderRadius:8*on,padding:8*on,boxSizing:"border-box",display:"grid",gridTemplateColumns:`repeat(4, ${30*on}px)`,gap:6*on},children:[E.jsx("button",{type:"button",onClick:()=>Je(null),style:{gridColumn:"1 / -1",height:24*on,borderRadius:5*on,border:"1px solid rgba(255,255,255,0.22)",background:"rgba(255,255,255,0.06)",color:"#ddd",cursor:"pointer",fontSize:12*on},children:"Без фону"}),Oa.map(pe=>E.jsx("button",{type:"button",onClick:()=>Je(pe),style:{width:30*on,height:24*on,borderRadius:5*on,border:w.textBackgroundColor===pe?"2px solid #fff":"1px solid rgba(255,255,255,0.3)",background:pe,cursor:"pointer",boxSizing:"border-box"},title:pe},`${w.id}-bg-${pe}`))]})},`${w.id}-text-bg-picker`),E.jsx("foreignObject",{x:xt,y:Math.max(0,Math.min(lt+D/2-Ct/2,G.h-Ct)),width:Ct,height:Ct,children:E.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:pe=>pe.stopPropagation(),onMouseDown:pe=>pe.stopPropagation(),children:E.jsx("button",{type:"button",title:"Видалити",onClick:()=>vs(w.id),style:{width:Ct,height:Ct,background:"rgba(20, 20, 32, 0.95)",border:"1px solid rgba(230,57,70,0.7)",color:"#ff6b6b",cursor:"pointer",borderRadius:"50%",fontSize:16*on,padding:`${3*on}px`,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:E.jsx("i",{className:`${Vn} bi-trash`,style:{fontSize:or},"aria-hidden":!0})})})},`${w.id}-text-tools-delete`)]},`${w.id}-text-tools-wrap`)}),Z.map(w=>{if(w.anchor.type==="text"||w.anchor.type==="standalone"||w.anchor.type==="redact"||w.calloutHidden||pt!==w.id&&Q!==w.id)return null;const S=It[w.id];if(!S)return null;const D=Em(w,Z);if(!D)return null;const _=Array.isArray(w.leaderPoints)?w.leaderPoints:[],I=og(D,S,_),K=1/Math.max(wr,1e-4),nt=5*de*K,j=3.5*de*K;return E.jsxs("g",{children:[L8(I).map((Y,lt)=>E.jsx("circle",{cx:Y.x,cy:Y.y,r:j,fill:"rgba(255,255,255,0.8)",stroke:w.color,strokeWidth:1.2*de*K,style:{cursor:"crosshair"},onPointerDown:st=>Du(w.id,lt,Y,st),onMouseDown:st=>Du(w.id,lt,Y,st),children:E.jsx("title",{children:"Потягніть, щоб зламати лінію"})},`${w.id}-leader-mid-${lt}`)),_.map((Y,lt)=>E.jsx("circle",{cx:Y.x,cy:Y.y,r:nt,fill:w.color,stroke:"#fff",strokeWidth:1.5*de*K,style:{cursor:"grab"},onPointerDown:st=>_u(w.id,lt,st),onMouseDown:st=>_u(w.id,lt,st),onDoubleClick:st=>Zl(w.id,lt,st),children:E.jsx("title",{children:"Подвійний клік — прибрати злам"})},`${w.id}-leader-pt-${lt}`))]},w.id+"-leader-handles")}),Z.filter(w=>w.anchor.type==="redact"&&(Q===w.id||pt===w.id)).map(w=>{const{x:S,y:D,width:_,height:I,mode:K,strength:nt}=w.anchor,j=250*on,Y=8*on,lt=24*on,st=7*on,ft=12*on,z=Y*2+lt+(K==="fill"?0:st+ft),Ct=8*on,jt=Math.max(0,Math.min(S+_/2-j/2,G.w-j)),St=D<G.h/2,Dt=Math.max(0,Math.min(St?D+I+Ct:D-Ct-z,G.h-z)),xt=32*on,qt=6*on,Wt=jt+j+qt,fe=jt-xt-qt,be=Wt+xt<=G.w?Wt:fe>=0?fe:Math.max(0,Math.min(Wt,G.w-xt)),Ee=Math.max(0,Math.min(Dt+z/2-xt/2,G.h-xt)),Je=[{id:"blur",label:"Розмити",icon:"bi-droplet-half"},{id:"pixelate",label:"Пікселі",icon:"bi-grid-3x3"},{id:"fill",label:"Заливка",icon:"bi-square-fill"}],En=nt*100;return E.jsxs("g",{children:[E.jsx("foreignObject",{x:jt,y:Dt,width:j,height:z,children:E.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:pe=>pe.stopPropagation(),onMouseDown:pe=>pe.stopPropagation(),onClick:pe=>pe.stopPropagation(),style:{width:j,height:z,boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"center",gap:st,padding:`${Y}px ${10*on}px`,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)",borderRadius:10*on,fontFamily:Tn},children:[E.jsx("div",{style:{display:"flex",gap:6*on},children:Je.map(pe=>E.jsxs("button",{type:"button",title:pe.label,onClick:()=>ys(w.id,{mode:pe.id}),style:{flex:1,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4*on,height:24*on,borderRadius:6*on,cursor:"pointer",fontFamily:"inherit",fontSize:11*on,background:K===pe.id?"rgba(255,255,255,0.14)":"rgba(255,255,255,0.06)",border:`1px solid ${K===pe.id?tf:"rgba(255,255,255,0.18)"}`,color:K===pe.id?"#fff":"#bbb"},children:[E.jsx("i",{className:`${Vn} ${pe.icon}`,style:{fontSize:11*on},"aria-hidden":!0}),pe.label]},pe.id))}),K!=="fill"&&E.jsx("input",{type:"range",className:"tyts-range",min:0,max:1,step:j_,value:nt,"aria-label":"Сила ефекту",title:"Сила ефекту",onChange:pe=>ys(w.id,{strength:Number(pe.target.value)}),style:{width:"100%",height:ft,minWidth:0,"--tyts-range-accent":tf,"--tyts-range-thumb":`${ft}px`,"--tyts-range-track":`${4*on}px`,"--tyts-range-fill":`${En}%`}})]})}),E.jsx("foreignObject",{x:be,y:Ee,width:xt,height:xt,children:E.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:pe=>pe.stopPropagation(),onMouseDown:pe=>pe.stopPropagation(),onClick:pe=>pe.stopPropagation(),children:E.jsx("button",{type:"button",title:"Видалити ділянку","aria-label":"Видалити ділянку",onClick:()=>vs(w.id),style:{width:xt,height:xt,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*on}px`},children:E.jsx("i",{className:`${Vn} bi-trash`,style:{fontSize:Math.round(12*on)},"aria-hidden":!0})})})})]},`${w.id}-redact-panel`)}),E.jsx("g",{ref:lo}),Z.filter(w=>w.anchor.type==="arrow"&&!!w.calloutHidden&&(Q===w.id||pt===w.id)).map(w=>{const S=[w.anchor.start,w.anchor.end,w.anchor.control];return E.jsx(wB,{pin:w,bbox:{minX:Math.min(...S.map(D=>D.x)),minY:Math.min(...S.map(D=>D.y)),maxX:Math.max(...S.map(D=>D.x)),maxY:Math.max(...S.map(D=>D.y))},imageSize:G,strokeWidthScale:Hr(w),fontFamily:Tn,controlsLayer:Ii,controlsCollapsed:go,onToggleControlsCollapsed:ha,onUpdateColor:Al,onUpdateStrokeStyle:Xa,onUpdateFillStyle:ia,onUpdateStrokeWidthScale:Ca,onShowCallout:D=>Ec(D,!1),onDelete:vs},`${w.id}-shape-controls`)}),Z.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"||Q===w.id||pt===w.id).map(w=>{const S=ji(w);return E.jsxs("g",{transform:`translate(${S.x}, ${S.y})`,style:{cursor:"pointer"},onMouseDown:D=>D.stopPropagation(),onClick:D=>{D.stopPropagation(),Ec(w.id,!1)},children:[E.jsx("circle",{cx:0,cy:0,r:11*de,fill:"rgba(20,20,32,0.95)",stroke:w.color,strokeWidth:2*de}),E.jsx("text",{x:0,y:1*de,textAnchor:"middle",dominantBaseline:"middle",fill:w.color,style:{fontSize:`${14*de}px`,fontWeight:700,userSelect:"none"},children:"+"})]},`${w.id}-restore-callout`)})]})})})})}):E.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16},children:[E.jsx(z9,{onFile:gl,highlight:Wl,warning:R}),Et.showRestorePrompt&&Et.storedDraftSavedAt&&E.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:[E.jsxs("span",{children:["Знайдено збережену чернетку від"," ",Bd(new Date(Et.storedDraftSavedAt))]}),E.jsx("button",{type:"button",onClick:()=>Et.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:"Відновити"}),E.jsx("button",{type:"button",onClick:()=>Et.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:"Відкинути"})]})]})}),E.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:[E.jsxs("div",{style:{...v9,flex:1},children:[E.jsxs("span",{title:`полотно: ${G.w} × ${G.h}px`,children:["полотно: ",G.w," × ",G.h,"px"]}),_t&&E.jsxs("span",{title:`оригінал: ${_t.w} × ${_t.h}px`,style:{marginLeft:16},children:["оригінал: ",_t.w," × ",_t.h,"px"]}),Q&&(()=>{const w=It[Q];if(!w)return null;const S=`картка: ${Math.round(w.width)} × ${Math.round(w.height)}px`;return E.jsx("span",{title:S,style:{marginLeft:16},children:S})})(),Ht&&E.jsxs("span",{title:Ht,style:{color:oe,display:"inline-flex",alignItems:"center",gap:5,marginLeft:16,verticalAlign:"bottom"},children:[E.jsx("i",{className:`${Vn} ${Et.status==="error"?"bi-exclamation-triangle":Et.status==="saving"?"bi-cloud-arrow-up tyts-spin":"bi-cloud-check"}`,style:{fontSize:11,flexShrink:0},"aria-hidden":!0}),E.jsx("span",{children:Ht})]})]}),E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:10,flexShrink:0},children:[!p,E.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),No(!0),es(!1)},style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.55)",fontFamily:"inherit",fontSize:10,cursor:"pointer",padding:0},title:"Налаштування",children:"Налаштування"}),E.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),es(S=>!S),No(!1)},style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.55)",fontFamily:"inherit",fontSize:10,cursor:"pointer",padding:0},title:"Показати список гарячих клавіш",children:"Гарячі клавіші"}),!p,E.jsxs("span",{children:["v",k_]})]}),Ks&&E.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:[E.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:[E.jsx("div",{style:{fontWeight:800,color:"#fff"},children:"Гарячі клавіші"}),E.jsx("button",{type:"button",onClick:()=>es(!1),style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.65)",cursor:"pointer",fontSize:16,lineHeight:1},title:"Закрити",children:"×"})]}),E.jsxs("div",{style:{display:"flex",gap:16,fontSize:12},children:[E.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:4},children:[re.newImage,re.replaceBackground,re.toolPoint,re.toolRegion,re.toolRoute,re.toolRectangle,re.toolEllipse,re.toolArrow,re.toolText,re.toolPointText,re.toolImageObject,re.toolRedact,re.toolDateTime,re.toolStandaloneCallout,re.toolNumbering,re.toolCompass,re.toolCrop,re.zoomIn,re.zoomOut,re.fitToWindow,re.undo,re.redo,re.downloadJpg,re.openExportMenu,re.exportMenuChooseByNumber].map(w=>E.jsx(Dk,{shortcut:w,isMac:b},w.id))}),E.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:4},children:[re.calloutBold,re.calloutItalic,re.calloutUnderline,re.calloutStrike,re.calloutFontSizeDown,re.calloutFontSizeUp,re.calloutAddText,re.calloutAddImage,re.calloutRemoveText,re.calloutRemoveImage,re.calloutToggleDescPos,re.calloutToggleTheme,re.calloutDelete,re.calloutTogglePanel,re.calloutBringForward,re.calloutSendBackward,re.calloutBringToFront,re.calloutSendToBack,re.objectCopy,re.objectDuplicate,re.objectPaste].map(w=>E.jsx(Dk,{shortcut:w,isMac:b},w.id))})]}),E.jsx("div",{style:{marginTop:10,paddingTop:10,borderTop:"1px solid rgba(255,255,255,0.08)"},children:E.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer",fontSize:12,color:"rgba(255,255,255,0.8)"},children:[E.jsx("input",{type:"checkbox",checked:sr,onChange:w=>Fl(w.target.checked)}),"Показувати бейджі хоткеїв на кнопках"]})})]})]}),$t&&(()=>{const w=$t.pinId,S=[{move:"front",label:"На передній план",shortcut:"calloutBringToFront"},{move:"up",label:"На рівень вище",shortcut:"calloutBringForward"},{move:"down",label:"На рівень нижче",shortcut:"calloutSendBackward"},{move:"back",label:"На задній план",shortcut:"calloutSendToBack"}],D=[...w?[{key:"copy",label:"Копіювати",shortcut:"objectCopy",enabled:!0,run:()=>Ke(w)},{key:"duplicate",label:"Дублювати",shortcut:"objectDuplicate",enabled:!0,run:()=>zr(w)}]:[],{key:"paste",label:"Вставити сюди",shortcut:"objectPaste",enabled:en,run:()=>zn($t.at)}],_=D.length+(w?S.length:0),I=230,K=8+_*30+(w?9:0),nt=Math.max(8,Math.min($t.x,window.innerWidth-I-8)),j=Math.max(8,Math.min($t.y,window.innerHeight-K-8));return E.jsxs("div",{role:"menu",onPointerDown:Y=>Y.stopPropagation(),onContextMenu:Y=>Y.preventDefault(),style:{position:"fixed",left:nt,top:j,zIndex:6e3,width:I,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:Tn,fontSize:13},children:[D.map(({key:Y,label:lt,shortcut:st,enabled:ft,run:z})=>E.jsxs("button",{type:"button",role:"menuitem",disabled:!ft,onClick:()=>{z(),ne(null)},style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,width:"100%",padding:"6px 8px",borderRadius:6,border:"none",background:"transparent",color:ft?"#ddd":"rgba(255,255,255,0.28)",cursor:ft?"pointer":"default",fontFamily:"inherit",fontSize:"inherit",textAlign:"left"},onMouseEnter:Ct=>{ft&&(Ct.currentTarget.style.background="rgba(255,255,255,0.08)")},onMouseLeave:Ct=>{Ct.currentTarget.style.background="transparent"},children:[E.jsx("span",{children:lt}),E.jsx("span",{style:{color:"rgba(255,255,255,0.35)",fontSize:11},children:Qe(re[st],{isMac:b})})]},Y)),w&&E.jsx("div",{style:{height:1,margin:"4px 6px",background:"rgba(255,255,255,0.12)"}}),w&&S.map(({move:Y,label:lt,shortcut:st})=>{const ft=z8(Z,w,Y);return E.jsxs("button",{type:"button",role:"menuitem",disabled:!ft,onClick:()=>{xs(w,Y),ne(null)},style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,width:"100%",padding:"6px 8px",borderRadius:6,border:"none",background:"transparent",color:ft?"#ddd":"rgba(255,255,255,0.28)",cursor:ft?"pointer":"default",fontFamily:"inherit",fontSize:"inherit",textAlign:"left"},onMouseEnter:z=>{ft&&(z.currentTarget.style.background="rgba(255,255,255,0.08)")},onMouseLeave:z=>{z.currentTarget.style.background="transparent"},children:[E.jsx("span",{children:lt}),E.jsx("span",{style:{color:"rgba(255,255,255,0.35)",fontSize:11},children:Qe(re[st],{isMac:b})})]},Y)})]})})(),E.jsx("input",{ref:gc,type:"file",accept:N_,style:{display:"none"},onChange:w=>{const S=w.target.files?.[0];w.target.value="",S&&(wl(S),us(!1))}}),E.jsx(G_,{open:pa,fontId:Ni.fontId,fontFamily:Tn,strokeWidthScale:Cr,onClose:()=>No(!1),onFontIdChange:fi,onStrokeWidthScaleChange:_i})]})});function I9({corner:n}){const i=n==="nw"||n==="sw"?12:32,s=n==="nw"||n==="ne"?12:32;return E.jsx("svg",{width:44,height:44,viewBox:"0 0 44 44","aria-hidden":!0,children:E.jsx("circle",{cx:i,cy:s,r:7,fill:"none",stroke:"#F2D727",strokeWidth:1.6})})}function Dk({shortcut:n,isMac:t}){const[e,r]=H.useState(!1);return E.jsxs("div",{onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,padding:"4px 6px",borderRadius:6,background:e?"rgba(255,255,255,0.08)":"transparent",transition:"background 0.15s"},children:[E.jsx("span",{style:{color:"rgba(255,255,255,0.85)"},children:n.label}),E.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:Ci(n,{isMac:t}).map(i=>E.jsx(ac,{children:i},i))})]})}function Lk({canUndo:n,canRedo:t,onUndo:e,onRedo:r,isMac:i}){return E.jsxs(E.Fragment,{children:[E.jsx(kr,{title:`Відмінити (${Qe(re.undo,{isMac:i})})`,tooltip:`Відмінити останню точку або переміщення (${Qe(re.undo,{isMac:i})})`,onClick:e,disabled:!n,children:E.jsx("i",{className:`${Vn} bi-arrow-counterclockwise`,style:{fontSize:or},"aria-hidden":!0})}),E.jsx(kr,{title:`Повернути (${Qe(re.redo,{isMac:i})})`,tooltip:`Повернути скасовану дію (${Qe(re.redo,{isMac:i})})`,onClick:r,disabled:!t,children:E.jsx("i",{className:`${Vn} bi-arrow-clockwise`,style:{fontSize:or},"aria-hidden":!0})})]})}function kr({children:n,onClick:t,active:e,accent:r,primary:i,title:s,tooltip:l,disabled:c,hotkeyParts:f,showHotkeyBadge:d,success:p}){const[g,b]=H.useState(!1),[y,M]=H.useState(!1),C=typeof window<"u"&&(navigator.maxTouchPoints>0||window.matchMedia?.("(pointer: coarse)").matches===!0),L=typeof window<"u"&&window.innerWidth<(C?1040:1320),R=l!=null&&l!=="",B=y&&!c,q=i?B?"rgb(30, 90, 180)":"rgb(0, 102, 204)":null,V=r?B?"rgb(210, 50, 60)":"rgb(230, 57, 70)":null,gt=!!p&&!c;return E.jsxs("span",{style:{position:"relative",display:"inline-block"},onMouseEnter:()=>{b(!0),M(!0)},onMouseLeave:()=>{b(!1),M(!1)},children:[E.jsx("button",{onClick:t,disabled:c,title:R?void 0:s,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:C?40:30,boxSizing:"border-box",background:q??V??(e?"linear-gradient(135deg, rgb(230, 57, 70), rgb(198, 43, 56))":B?"rgba(255,255,255,0.12)":"rgba(255,255,255,0.06)"),border:gt?"1px solid #2ecc71":`1px solid ${q??V??(e?"transparent":"rgba(255,255,255,0.08)")}`,borderRadius:5,color:c?"rgba(255,255,255,0.55)":gt?"#2ecc71":i||r||e?"#fff":"#bbb",fontFamily:"inherit",fontSize:"inherit",fontWeight:600,padding:C?L?"7px 10px":"8px 14px":L?"4px 8px":"5px 12px",transition:"all 0.15s",cursor:c?"not-allowed":"pointer",opacity:c?.6:1},children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:L?6:8},children:[n,d&&f&&f.length>0&&E.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:f.map(Mt=>E.jsx(ac,{title:`Гаряча клавіша: ${Mt}`,children:Mt},Mt))})]})}),R&&g&&E.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:320,whiteSpace:"normal",textAlign:"center",zIndex:1e3,pointerEvents:"none",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"},children:l})]})}function j9({children:n,onMainClick:t,onMenuClick:e,menuOpen:r,disabled:i,mainTitle:s,mainTooltip:l,menuTitle:c,menuTooltip:f,hotkeyParts:d,showHotkeyBadge:p}){const[g,b]=H.useState(!1),[y,M]=H.useState(!1),[C,L]=H.useState(!1),[R,B]=H.useState(!1),q=typeof window<"u"&&(navigator.maxTouchPoints>0||window.matchMedia?.("(pointer: coarse)").matches===!0),V=typeof window<"u"&&window.innerWidth<(q?1040:1320),gt=q?40:30,Mt=q?V?7:8:V?4:5,kt=q?V?10:14:V?8:12,bt="rgba(255,255,255,0.06)",it="rgba(255,255,255,0.12)",Lt="linear-gradient(135deg, rgb(230, 57, 70), rgb(198, 43, 56))",J=r?"transparent":"rgba(255,255,255,0.08)",ct={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:320,whiteSpace:"normal",textAlign:"center",zIndex:1e3,pointerEvents:"none",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"};return E.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"stretch",opacity:i?.6:1,border:`1px solid ${J}`,borderRadius:5,overflow:"hidden",background:bt},children:[E.jsxs("span",{style:{position:"relative",display:"inline-flex"},onMouseEnter:()=>{b(!0),L(!0)},onMouseLeave:()=>{b(!1),L(!1)},children:[E.jsx("button",{type:"button",onClick:t,disabled:i,title:l?void 0:s,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:gt,boxSizing:"border-box",background:g&&!i?it:"transparent",border:"none",borderRadius:0,color:i?"rgba(255,255,255,0.55)":"#bbb",fontFamily:"inherit",fontSize:"inherit",fontWeight:600,padding:`${Mt}px ${kt}px`,transition:"background 0.15s",cursor:i?"not-allowed":"pointer"},children:E.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:V?6:8},children:[n,p&&d&&d.length>0&&E.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:d.map(G=>E.jsx(ac,{title:`Гаряча клавіша: ${G}`,children:G},G))})]})}),l&&C&&E.jsx("span",{role:"tooltip",style:ct,children:l})]}),E.jsxs("span",{style:{position:"relative",display:"inline-flex"},onMouseEnter:()=>{M(!0),B(!0)},onMouseLeave:()=>{M(!1),B(!1)},children:[E.jsx("button",{type:"button",onClick:e,disabled:i,"aria-expanded":!!r,"aria-haspopup":"dialog",title:f?void 0:c,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:gt,minWidth:q?32:26,boxSizing:"border-box",background:r?Lt:y&&!i?it:"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:`${Mt}px ${V?6:8}px`,transition:"background 0.15s, color 0.15s",cursor:i?"not-allowed":"pointer"},children:E.jsx("i",{className:"bi bi-chevron-down",style:{fontSize:or-2},"aria-hidden":!0})}),f&&R&&E.jsx("span",{role:"tooltip",style:ct,children:f})]})]})}function z9({onFile:n,highlight:t=!1,warning:e=null}){const r=H.useRef(null),[i,s]=H.useState(!1),l=i||t,c=f=>{f.preventDefault(),f.stopPropagation(),s(!1);const d=f.dataTransfer.files[0];if(!p5(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 E.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:[E.jsx("div",{style:{marginBottom:14,opacity:.5,display:"flex",justifyContent:"center",color:"#555"},children:E.jsx("i",{className:`${Vn} bi-image`,style:{fontSize:48},"aria-hidden":!0})}),E.jsx("p",{style:{fontSize:16,color:"#777",lineHeight:1.7,fontWeight:700,margin:0},children:"Завантажте фонове зображення"}),E.jsxs("p",{style:{fontSize:14,color:"#555",margin:0,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,flexWrap:"wrap"},children:["або вставте з буфера",Ci(re.pasteInCallout,{isMac:ud()}).map(f=>E.jsx(ac,{title:Yd(),children:f},f))]}),E.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:"Обрати файл"}),e&&E.jsx("p",{style:{marginTop:14,marginBottom:0,color:"#E63946",fontSize:13,lineHeight:1.5},children:e}),E.jsx("input",{ref:r,type:"file",accept:"image/*",style:{display:"none"},onChange:n})]})}kE.createRoot(document.getElementById("root")).render(E.jsx(H.StrictMode,{children:E.jsx(P9,{mode:"embed"})}));export{Xr as _,B9 as c,Rk as g};