@3rtools/tyts-mcp 1.17.1 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -2
- package/dist/document.d.ts +83 -6
- package/dist/document.js +276 -26
- package/dist/document.js.map +1 -1
- package/dist/schemas.d.ts +829 -0
- package/dist/schemas.js +68 -3
- package/dist/schemas.js.map +1 -1
- package/dist/server.js +81 -16
- package/dist/server.js.map +1 -1
- package/dist/session.d.ts +7 -0
- package/dist/session.js +4 -0
- package/dist/session.js.map +1 -1
- package/editor/assets/index-CUMfZ4B-.js +236 -0
- package/editor/assets/{index.es-CDplo0TQ.js → index.es-CWFRC_1c.js} +1 -1
- package/editor/index.html +1 -1
- package/editor/tyts-embed.js +2 -2
- package/package.json +1 -1
- package/static/harness.html +18 -0
- package/editor/assets/index-Cyezu1-q.js +0 -236
|
@@ -1,236 +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 xF=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wk(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var oy={exports:{}},Bh={};var Iv;function OE(){if(Iv)return Bh;Iv=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 Bh.Fragment=t,Bh.jsx=e,Bh.jsxs=e,Bh}var zv;function PE(){return zv||(zv=1,oy.exports=OE()),oy.exports}var C=PE(),sy={exports:{}},qn={};var Bv;function jE(){if(Bv)return qn;Bv=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(J){return J===null||typeof J!="object"?null:(J=b&&J[b]||J["@@iterator"],typeof J=="function"?J:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,L={};function R(J,_,K){this.props=J,this.context=_,this.refs=L,this.updater=K||A}R.prototype.isReactComponent={},R.prototype.setState=function(J,_){if(typeof J!="object"&&typeof J!="function"&&J!=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,J,_,"setState")},R.prototype.forceUpdate=function(J){this.updater.enqueueForceUpdate(this,J,"forceUpdate")};function q(){}q.prototype=R.prototype;function H(J,_,K){this.props=J,this.context=_,this.refs=L,this.updater=K||A}var $=H.prototype=new q;$.constructor=H,E($,R.prototype),$.isPureReactComponent=!0;var ht=Array.isArray;function Mt(){}var wt={H:null,A:null,T:null,S:null},bt=Object.prototype.hasOwnProperty;function ot(J,_,K){var V=K.ref;return{$$typeof:n,type:J,key:_,ref:V!==void 0?V:null,props:K}}function Dt(J,_){return ot(J.type,_,J.props)}function Q(J){return typeof J=="object"&&J!==null&&J.$$typeof===n}function at(J){var _={"=":"=0",":":"=2"};return"$"+J.replace(/[=:]/g,function(K){return _[K]})}var G=/\/+/g;function vt(J,_){return typeof J=="object"&&J!==null&&J.key!=null?at(""+J.key):_.toString(36)}function Tt(J){switch(J.status){case"fulfilled":return J.value;case"rejected":throw J.reason;default:switch(typeof J.status=="string"?J.then(Mt,Mt):(J.status="pending",J.then(function(_){J.status==="pending"&&(J.status="fulfilled",J.value=_)},function(_){J.status==="pending"&&(J.status="rejected",J.reason=_)})),J.status){case"fulfilled":return J.value;case"rejected":throw J.reason}}throw J}function gt(J,_,K,V,ut){var xt=typeof J;(xt==="undefined"||xt==="boolean")&&(J=null);var At=!1;if(J===null)At=!0;else switch(xt){case"bigint":case"string":case"number":At=!0;break;case"object":switch(J.$$typeof){case n:case t:At=!0;break;case p:return At=J._init,gt(At(J._payload),_,K,V,ut)}}if(At)return ut=ut(J),At=V===""?"."+vt(J,0):V,ht(ut)?(K="",At!=null&&(K=At.replace(G,"$&/")+"/"),gt(ut,_,K,"",function(Zt){return Zt})):ut!=null&&(Q(ut)&&(ut=Dt(ut,K+(ut.key==null||J&&J.key===ut.key?"":(""+ut.key).replace(G,"$&/")+"/")+At)),_.push(ut)),1;At=0;var Ft=V===""?".":V+":";if(ht(J))for(var Lt=0;Lt<J.length;Lt++)V=J[Lt],xt=Ft+vt(V,Lt),At+=gt(V,_,K,xt,ut);else if(Lt=y(J),typeof Lt=="function")for(J=Lt.call(J),Lt=0;!(V=J.next()).done;)V=V.value,xt=Ft+vt(V,Lt++),At+=gt(V,_,K,xt,ut);else if(xt==="object"){if(typeof J.then=="function")return gt(Tt(J),_,K,V,ut);throw _=String(J),Error("Objects are not valid as a React child (found: "+(_==="[object Object]"?"object with keys {"+Object.keys(J).join(", ")+"}":_)+"). If you meant to render a collection of children, use an array instead.")}return At}function Z(J,_,K){if(J==null)return J;var V=[],ut=0;return gt(J,V,"","",function(xt){return _.call(K,xt,ut++)}),V}function lt(J){if(J._status===-1){var _=J._result;_=_(),_.then(function(K){(J._status===0||J._status===-1)&&(J._status=1,J._result=K)},function(K){(J._status===0||J._status===-1)&&(J._status=2,J._result=K)}),J._status===-1&&(J._status=0,J._result=_)}if(J._status===1)return J._result.default;throw J._result}var Bt=typeof reportError=="function"?reportError:function(J){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var _=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof J=="object"&&J!==null&&typeof J.message=="string"?String(J.message):String(J),error:J});if(!window.dispatchEvent(_))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",J);return}console.error(J)},ee={map:Z,forEach:function(J,_,K){Z(J,function(){_.apply(this,arguments)},K)},count:function(J){var _=0;return Z(J,function(){_++}),_},toArray:function(J){return Z(J,function(_){return _})||[]},only:function(J){if(!Q(J))throw Error("React.Children.only expected to receive a single React element child.");return J}};return qn.Activity=g,qn.Children=ee,qn.Component=R,qn.Fragment=e,qn.Profiler=i,qn.PureComponent=H,qn.StrictMode=r,qn.Suspense=f,qn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=wt,qn.__COMPILER_RUNTIME={__proto__:null,c:function(J){return wt.H.useMemoCache(J)}},qn.cache=function(J){return function(){return J.apply(null,arguments)}},qn.cacheSignal=function(){return null},qn.cloneElement=function(J,_,K){if(J==null)throw Error("The argument must be a React element, but you passed "+J+".");var V=E({},J.props),ut=J.key;if(_!=null)for(xt in _.key!==void 0&&(ut=""+_.key),_)!bt.call(_,xt)||xt==="key"||xt==="__self"||xt==="__source"||xt==="ref"&&_.ref===void 0||(V[xt]=_[xt]);var xt=arguments.length-2;if(xt===1)V.children=K;else if(1<xt){for(var At=Array(xt),Ft=0;Ft<xt;Ft++)At[Ft]=arguments[Ft+2];V.children=At}return ot(J.type,ut,V)},qn.createContext=function(J){return J={$$typeof:l,_currentValue:J,_currentValue2:J,_threadCount:0,Provider:null,Consumer:null},J.Provider=J,J.Consumer={$$typeof:s,_context:J},J},qn.createElement=function(J,_,K){var V,ut={},xt=null;if(_!=null)for(V in _.key!==void 0&&(xt=""+_.key),_)bt.call(_,V)&&V!=="key"&&V!=="__self"&&V!=="__source"&&(ut[V]=_[V]);var At=arguments.length-2;if(At===1)ut.children=K;else if(1<At){for(var Ft=Array(At),Lt=0;Lt<At;Lt++)Ft[Lt]=arguments[Lt+2];ut.children=Ft}if(J&&J.defaultProps)for(V in At=J.defaultProps,At)ut[V]===void 0&&(ut[V]=At[V]);return ot(J,xt,ut)},qn.createRef=function(){return{current:null}},qn.forwardRef=function(J){return{$$typeof:c,render:J}},qn.isValidElement=Q,qn.lazy=function(J){return{$$typeof:p,_payload:{_status:-1,_result:J},_init:lt}},qn.memo=function(J,_){return{$$typeof:d,type:J,compare:_===void 0?null:_}},qn.startTransition=function(J){var _=wt.T,K={};wt.T=K;try{var V=J(),ut=wt.S;ut!==null&&ut(K,V),typeof V=="object"&&V!==null&&typeof V.then=="function"&&V.then(Mt,Bt)}catch(xt){Bt(xt)}finally{_!==null&&K.types!==null&&(_.types=K.types),wt.T=_}},qn.unstable_useCacheRefresh=function(){return wt.H.useCacheRefresh()},qn.use=function(J){return wt.H.use(J)},qn.useActionState=function(J,_,K){return wt.H.useActionState(J,_,K)},qn.useCallback=function(J,_){return wt.H.useCallback(J,_)},qn.useContext=function(J){return wt.H.useContext(J)},qn.useDebugValue=function(){},qn.useDeferredValue=function(J,_){return wt.H.useDeferredValue(J,_)},qn.useEffect=function(J,_){return wt.H.useEffect(J,_)},qn.useEffectEvent=function(J){return wt.H.useEffectEvent(J)},qn.useId=function(){return wt.H.useId()},qn.useImperativeHandle=function(J,_,K){return wt.H.useImperativeHandle(J,_,K)},qn.useInsertionEffect=function(J,_){return wt.H.useInsertionEffect(J,_)},qn.useLayoutEffect=function(J,_){return wt.H.useLayoutEffect(J,_)},qn.useMemo=function(J,_){return wt.H.useMemo(J,_)},qn.useOptimistic=function(J,_){return wt.H.useOptimistic(J,_)},qn.useReducer=function(J,_,K){return wt.H.useReducer(J,_,K)},qn.useRef=function(J){return wt.H.useRef(J)},qn.useState=function(J){return wt.H.useState(J)},qn.useSyncExternalStore=function(J,_,K){return wt.H.useSyncExternalStore(J,_,K)},qn.useTransition=function(){return wt.H.useTransition()},qn.version="19.2.4",qn}var Fv;function Fp(){return Fv||(Fv=1,sy.exports=jE()),sy.exports}var I=Fp();const Bc=Wk(I);var ay={exports:{}},Fh={},ly={exports:{}},cy={};var Uv;function IE(){return Uv||(Uv=1,(function(n){function t(gt,Z){var lt=gt.length;gt.push(Z);t:for(;0<lt;){var Bt=lt-1>>>1,ee=gt[Bt];if(0<i(ee,Z))gt[Bt]=Z,gt[lt]=ee,lt=Bt;else break t}}function e(gt){return gt.length===0?null:gt[0]}function r(gt){if(gt.length===0)return null;var Z=gt[0],lt=gt.pop();if(lt!==Z){gt[0]=lt;t:for(var Bt=0,ee=gt.length,J=ee>>>1;Bt<J;){var _=2*(Bt+1)-1,K=gt[_],V=_+1,ut=gt[V];if(0>i(K,lt))V<ee&&0>i(ut,K)?(gt[Bt]=ut,gt[V]=lt,Bt=V):(gt[Bt]=K,gt[_]=lt,Bt=_);else if(V<ee&&0>i(ut,lt))gt[Bt]=ut,gt[V]=lt,Bt=V;else break t}}return Z}function i(gt,Z){var lt=gt.sortIndex-Z.sortIndex;return lt!==0?lt:gt.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,A=!1,E=!1,L=!1,R=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,H=typeof setImmediate<"u"?setImmediate:null;function $(gt){for(var Z=e(d);Z!==null;){if(Z.callback===null)r(d);else if(Z.startTime<=gt)r(d),Z.sortIndex=Z.expirationTime,t(f,Z);else break;Z=e(d)}}function ht(gt){if(E=!1,$(gt),!A)if(e(f)!==null)A=!0,Mt||(Mt=!0,at());else{var Z=e(d);Z!==null&&Tt(ht,Z.startTime-gt)}}var Mt=!1,wt=-1,bt=5,ot=-1;function Dt(){return L?!0:!(n.unstable_now()-ot<bt)}function Q(){if(L=!1,Mt){var gt=n.unstable_now();ot=gt;var Z=!0;try{t:{A=!1,E&&(E=!1,q(wt),wt=-1),y=!0;var lt=b;try{e:{for($(gt),g=e(f);g!==null&&!(g.expirationTime>gt&&Dt());){var Bt=g.callback;if(typeof Bt=="function"){g.callback=null,b=g.priorityLevel;var ee=Bt(g.expirationTime<=gt);if(gt=n.unstable_now(),typeof ee=="function"){g.callback=ee,$(gt),Z=!0;break e}g===e(f)&&r(f),$(gt)}else r(f);g=e(f)}if(g!==null)Z=!0;else{var J=e(d);J!==null&&Tt(ht,J.startTime-gt),Z=!1}}break t}finally{g=null,b=lt,y=!1}Z=void 0}}finally{Z?at():Mt=!1}}}var at;if(typeof H=="function")at=function(){H(Q)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,vt=G.port2;G.port1.onmessage=Q,at=function(){vt.postMessage(null)}}else at=function(){R(Q,0)};function Tt(gt,Z){wt=R(function(){gt(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(gt){gt.callback=null},n.unstable_forceFrameRate=function(gt){0>gt||125<gt?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):bt=0<gt?Math.floor(1e3/gt):5},n.unstable_getCurrentPriorityLevel=function(){return b},n.unstable_next=function(gt){switch(b){case 1:case 2:case 3:var Z=3;break;default:Z=b}var lt=b;b=Z;try{return gt()}finally{b=lt}},n.unstable_requestPaint=function(){L=!0},n.unstable_runWithPriority=function(gt,Z){switch(gt){case 1:case 2:case 3:case 4:case 5:break;default:gt=3}var lt=b;b=gt;try{return Z()}finally{b=lt}},n.unstable_scheduleCallback=function(gt,Z,lt){var Bt=n.unstable_now();switch(typeof lt=="object"&<!==null?(lt=lt.delay,lt=typeof lt=="number"&&0<lt?Bt+lt:Bt):lt=Bt,gt){case 1:var ee=-1;break;case 2:ee=250;break;case 5:ee=1073741823;break;case 4:ee=1e4;break;default:ee=5e3}return ee=lt+ee,gt={id:p++,callback:Z,priorityLevel:gt,startTime:lt,expirationTime:ee,sortIndex:-1},lt>Bt?(gt.sortIndex=lt,t(d,gt),e(f)===null&>===e(d)&&(E?(q(wt),wt=-1):E=!0,Tt(ht,lt-Bt))):(gt.sortIndex=ee,t(f,gt),A||y||(A=!0,Mt||(Mt=!0,at()))),gt},n.unstable_shouldYield=Dt,n.unstable_wrapCallback=function(gt){var Z=b;return function(){var lt=b;b=Z;try{return gt.apply(this,arguments)}finally{b=lt}}}})(cy)),cy}var Hv;function zE(){return Hv||(Hv=1,ly.exports=IE()),ly.exports}var uy={exports:{}},Vs={};var qv;function BE(){if(qv)return Vs;qv=1;var n=Fp();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 Vs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Vs.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)},Vs.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()}},Vs.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))},Vs.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},Vs.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})}},Vs.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)},Vs.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})}},Vs.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)},Vs.requestFormReset=function(f){r.d.r(f)},Vs.unstable_batchedUpdates=function(f,d){return f(d)},Vs.useFormState=function(f,d,p){return l.H.useFormState(f,d,p)},Vs.useFormStatus=function(){return l.H.useHostTransitionStatus()},Vs.version="19.2.4",Vs}var $v;function Xk(){if($v)return uy.exports;$v=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(),uy.exports=BE(),uy.exports}var Yv;function FE(){if(Yv)return Fh;Yv=1;var n=zE(),t=Fp(),e=Xk();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"),A=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),H=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),ht=Symbol.for("react.suspense"),Mt=Symbol.for("react.suspense_list"),wt=Symbol.for("react.memo"),bt=Symbol.for("react.lazy"),ot=Symbol.for("react.activity"),Dt=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function at(o){return o===null||typeof o!="object"?null:(o=Q&&o[Q]||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 E:return"Fragment";case R:return"Profiler";case L:return"StrictMode";case ht:return"Suspense";case Mt:return"SuspenseList";case ot:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case A:return"Portal";case H:return o.displayName||"Context";case q:return(o._context.displayName||"Context")+".Consumer";case $:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case wt: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 Tt=Array.isArray,gt=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,lt={pending:!1,data:null,method:null,action:null},Bt=[],ee=-1;function J(o){return{current:o}}function _(o){0>ee||(o.current=Bt[ee],Bt[ee]=null,ee--)}function K(o,a){ee++,Bt[ee]=o.current,o.current=a}var V=J(null),ut=J(null),xt=J(null),At=J(null);function Ft(o,a){switch(K(xt,a),K(ut,o),K(V,null),a.nodeType){case 9:case 11:o=(o=a.documentElement)&&(o=o.namespaceURI)?sv(o):0;break;default:if(o=a.tagName,a=a.namespaceURI)a=sv(a),o=av(a,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}_(V),K(V,o)}function Lt(){_(V),_(ut),_(xt)}function Zt(o){o.memoizedState!==null&&K(At,o);var a=V.current,u=av(a,o.type);a!==u&&(K(ut,o),K(V,u))}function ve(o){ut.current===o&&(_(V),_(ut)),At.current===o&&(_(At),Ph._currentValue=lt)}var je,Pe;function We(o){if(je===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);je=a&&a[1]||"",Pe=-1<u.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+je+o+Pe}var ct=!1;function Le(o,a){if(!o||ct)return"";ct=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(re){var Kt=re}Reflect.construct(o,[],pe)}else{try{pe.call()}catch(re){Kt=re}o.call(pe.prototype)}}else{try{throw Error()}catch(re){Kt=re}(pe=o())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(re){if(re&&Kt&&typeof re.stack=="string")return[re.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 Ct=P.split(`
|
|
4
|
-
`),Gt=et.split(`
|
|
5
|
-
`);for(x=h=0;h<Ct.length&&!Ct[h].includes("DetermineComponentFrameRoot");)h++;for(;x<Gt.length&&!Gt[x].includes("DetermineComponentFrameRoot");)x++;if(h===Ct.length||x===Gt.length)for(h=Ct.length-1,x=Gt.length-1;1<=h&&0<=x&&Ct[h]!==Gt[x];)x--;for(;1<=h&&0<=x;h--,x--)if(Ct[h]!==Gt[x]){if(h!==1||x!==1)do if(h--,x--,0>x||Ct[h]!==Gt[x]){var le=`
|
|
6
|
-
`+Ct[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{ct=!1,Error.prepareStackTrace=u}return(u=o?o.displayName||o.name:"")?We(u):""}function Pn(o,a){switch(o.tag){case 26:case 27:case 5:return We(o.type);case 16:return We("Lazy");case 13:return o.child!==a&&a!==null?We("Suspense Fallback"):We("Suspense");case 19:return We("SuspenseList");case 0:case 15:return Le(o.type,!1);case 11:return Le(o.type.render,!1);case 1:return Le(o.type,!0);case 31:return We("Activity");default:return""}}function fe(o){try{var a="",u=null;do a+=Pn(o,u),u=o,o=o.return;while(o);return a}catch(h){return`
|
|
7
|
-
Error generating stack: `+h.message+`
|
|
8
|
-
`+h.stack}}var ye=Object.prototype.hasOwnProperty,Te=n.unstable_scheduleCallback,Ne=n.unstable_cancelCallback,_e=n.unstable_shouldYield,Ue=n.unstable_requestPaint,cn=n.unstable_now,In=n.unstable_getCurrentPriorityLevel,Fe=n.unstable_ImmediatePriority,_n=n.unstable_UserBlockingPriority,dn=n.unstable_NormalPriority,ze=n.unstable_LowPriority,Xe=n.unstable_IdlePriority,Ie=n.log,kr=n.unstable_setDisableYieldValue,wn=null,nn=null;function ln(o){if(typeof Ie=="function"&&kr(o),nn&&typeof nn.setStrictMode=="function")try{nn.setStrictMode(wn,o)}catch{}}var Ln=Math.clz32?Math.clz32:gn,Ze=Math.log,ur=Math.LN2;function gn(o){return o>>>=0,o===0?32:31-(Ze(o)/ur|0)|0}var xn=256,gr=262144,Mn=4194304;function Ke(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 Vn(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=Ke(h):(P&=et,P!==0?x=Ke(P):u||(u=et&~o,u!==0&&(x=Ke(u))))):(et=h&~k,et!==0?x=Ke(et):P!==0?x=Ke(P):u||(u=h&~o,u!==0&&(x=Ke(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 ss(o,a){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&a)===0}function Ei(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 Qt(){var o=Mn;return Mn<<=1,(Mn&62914560)===0&&(Mn=4194304),o}function Re(o){for(var a=[],u=0;31>u;u++)a.push(o);return a}function Me(o,a){o.pendingLanes|=a,a!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Oe(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,Ct=o.expirationTimes,Gt=o.hiddenUpdates;for(u=P&~u;0<u;){var le=31-Ln(u),pe=1<<le;et[le]=0,Ct[le]=-1;var Kt=Gt[le];if(Kt!==null)for(Gt[le]=null,le=0;le<Kt.length;le++){var re=Kt[le];re!==null&&(re.lane&=-536870913)}u&=~pe}h!==0&&Xn(o,h,0),k!==0&&x===0&&o.tag!==0&&(o.suspendedLanes|=k&~(P&~a))}function Xn(o,a,u){o.pendingLanes|=a,o.suspendedLanes&=~a;var h=31-Ln(a);o.entangledLanes|=a,o.entanglements[h]=o.entanglements[h]|1073741824|u&261930}function Bn(o,a){var u=o.entangledLanes|=a;for(o=o.entanglements;u;){var h=31-Ln(u),x=1<<h;x&a|o[h]&a&&(o[h]|=a),u&=~x}}function or(o,a){var u=a&-a;return u=(u&42)!==0?1:Fn(u),(u&(o.suspendedLanes|a))!==0?0:u}function Fn(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 si(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function mi(){var o=Z.p;return o!==0?o:(o=window.event,o===void 0?32:_v(o.type))}function Wt(o,a){var u=Z.p;try{return Z.p=o,a()}finally{Z.p=u}}var ai=Math.random().toString(36).slice(2),Ar="__reactFiber$"+ai,er="__reactProps$"+ai,Ti="__reactContainer$"+ai,Yo="__reactEvents$"+ai,li="__reactListeners$"+ai,Or="__reactHandles$"+ai,ta="__reactResources$"+ai,ea="__reactMarker$"+ai;function fa(o){delete o[Ar],delete o[er],delete o[Yo],delete o[li],delete o[Or]}function as(o){var a=o[Ar];if(a)return a;for(var u=o.parentNode;u;){if(a=u[Ti]||u[Ar]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(o=pv(o);o!==null;){if(u=o[Ar])return u;o=pv(o)}return a}o=u,u=o.parentNode}return null}function Bo(o){if(o=o[Ar]||o[Ti]){var a=o.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return o}return null}function gl(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o.stateNode;throw Error(r(33))}function na(o){var a=o[ta];return a||(a=o[ta]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Wr(o){o[ea]=!0}var dc=new Set,Ls={};function da(o,a){ha(o,a),ha(o+"Capture",a)}function ha(o,a){for(Ls[o]=a,o=0;o<a.length;o++)dc.add(a[o])}var hc=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]*$"),yl={},pc={};function $l(o){return ye.call(pc,o)?!0:ye.call(yl,o)?!1:hc.test(o)?pc[o]=!0:(yl[o]=!0,!1)}function Wi(o,a,u){if($l(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 Xi(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 Vo(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 fr(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function mc(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function pa(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 Fa(o){if(!o._valueTracker){var a=mc(o)?"checked":"value";o._valueTracker=pa(o,a,""+o[a])}}function ma(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var u=a.getValue(),h="";return o&&(h=mc(o)?o.checked?"true":"false":o.value),o=h,o!==u?(a.setValue(o),!0):!1}function Xr(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 Fo=/[\n"\\]/g;function Mr(o){return o.replace(Fo,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Br(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=""+fr(a)):o.value!==""+fr(a)&&(o.value=""+fr(a)):P!=="submit"&&P!=="reset"||o.removeAttribute("value"),a!=null?ls(o,P,fr(a)):u!=null?ls(o,P,fr(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=""+fr(et):o.removeAttribute("name")}function Fr(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)){Fa(o);return}u=u!=null?""+fr(u):"",a=a!=null?""+fr(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),Fa(o)}function ls(o,a,u){a==="number"&&Xr(o.ownerDocument)===o||o.defaultValue===""+u||(o.defaultValue=""+u)}function Di(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=""+fr(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 Wo(o,a,u){if(a!=null&&(a=""+fr(a),a!==o.value&&(o.value=a),u==null)){o.defaultValue!==a&&(o.defaultValue=a);return}o.defaultValue=u!=null?""+fr(u):""}function Zn(o,a,u,h){if(a==null){if(h!=null){if(u!=null)throw Error(r(92));if(Tt(h)){if(1<h.length)throw Error(r(93));h=h[0]}u=h}u==null&&(u=""),a=u}u=fr(a),o.defaultValue=u,h=o.textContent,h===u&&h!==""&&h!==null&&(o.value=h),Fa(o)}function Xo(o,a){if(a){var u=o.firstChild;if(u&&u===o.lastChild&&u.nodeType===3){u.nodeValue=a;return}}o.textContent=a}var Ua=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 cs(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||Ua.has(a)?a==="float"?o.cssFloat=u:o[a]=(""+u).trim():o[a]=u+"px"}function te(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&&cs(o,x,h)}else for(var k in a)a.hasOwnProperty(k)&&cs(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 bl=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"]]),Mf=/^[\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 No(o){return Mf.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function us(){}var ga=null;function qc(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var fs=null,yn=null;function Yl(o){var a=Bo(o);if(a&&(o=a.stateNode)){var u=o[er]||null;t:switch(o=a.stateNode,a.type){case"input":if(Br(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="'+Mr(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var h=u[a];if(h!==o&&h.form===o.form){var x=h[er]||null;if(!x)throw Error(r(90));Br(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&&ma(h)}break t;case"textarea":Wo(o,u.value,u.defaultValue);break t;case"select":a=u.value,a!=null&&Di(o,!!u.multiple,a,!1)}}}var xl=!1;function gc(o,a,u){if(xl)return o(a,u);xl=!0;try{var h=o(a);return h}finally{if(xl=!1,(fs!==null||yn!==null)&&(fm(),fs&&(a=fs,o=yn,yn=fs=null,Yl(a),o)))for(a=0;a<o.length;a++)Yl(o[a])}}function ya(o,a){var u=o.stateNode;if(u===null)return null;var h=u[er]||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 Rs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Os=!1;if(Rs)try{var Go={};Object.defineProperty(Go,"passive",{get:function(){Os=!0}}),window.addEventListener("test",Go,Go),window.removeEventListener("test",Go,Go)}catch{Os=!1}var Ps=null,Nr=null,ra=null;function Ha(){if(ra)return ra;var o,a=Nr,u=a.length,h,x="value"in Ps?Ps.value:Ps.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 ra=x.slice(o,1<h?1-h:void 0)}function _o(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 qa(){return!0}function js(){return!1}function Li(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)?qa:js,this.isPropagationStopped=js,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=qa)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=qa)},persist:function(){},isPersistent:qa}),a}var Ko={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jo=Li(Ko),Is=g({},Ko,{view:0,detail:0}),ia=Li(Is),ba,zs,oa,Bs=g({},Is,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qe,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!==oa&&(oa&&o.type==="mousemove"?(ba=o.screenX-oa.screenX,zs=o.screenY-oa.screenY):zs=ba=0,oa=o),ba)},movementY:function(o){return"movementY"in o?o.movementY:zs}}),$a=Li(Bs),Fs=g({},Bs,{dataTransfer:0}),Us=Li(Fs),Vl=g({},Is,{relatedTarget:0}),Ya=Li(Vl),Wl=g({},Ko,{animationName:0,elapsedTime:0,pseudoElement:0}),xa=Li(Wl),Xl=g({},Ko,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),M=Li(Xl),B=g({},Ko,{data:0}),dt=Li(B),Et={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},zt={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},se={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function me(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=se[o])?!!a[o]:!1}function Qe(){return me}var on=g({},Is,{key:function(o){if(o.key){var a=Et[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=_o(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?zt[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qe,charCode:function(o){return o.type==="keypress"?_o(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?_o(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),Rn=Li(on),Un=g({},Bs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sr=Li(Un),Fi=g({},Is,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qe}),Ni=Li(Fi),Pr=g({},Ko,{propertyName:0,elapsedTime:0,pseudoElement:0}),ci=Li(Pr),gi=g({},Bs,{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}),yi=Li(gi),eo=g({},Ko,{newState:0,oldState:0}),Hs=Li(eo),yc=[9,13,27,32],ge=Rs&&"CompositionEvent"in window,Zo=null;Rs&&"documentMode"in document&&(Zo=document.documentMode);var ds=Rs&&"TextEvent"in window&&!Zo,Tn=Rs&&(!ge||Zo&&8<Zo&&11>=Zo),Nn=" ",Gl=!1;function Gi(o,a){switch(o){case"keyup":return yc.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vl(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var ar=!1;function va(o,a){switch(o){case"compositionend":return vl(a);case"keypress":return a.which!==32?null:(Gl=!0,Nn);case"textInput":return o=a.data,o===Nn&&Gl?null:o;default:return null}}function wa(o,a){if(ar)return o==="compositionend"||!ge&&Gi(o,a)?(o=Ha(),ra=Nr=Ps=null,ar=!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 Tn&&a.locale!=="ko"?null:a.data;default:return null}}var no={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 $c(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!no[o.type]:a==="textarea"}function Va(o,a,u,h){fs?yn?yn.push(h):yn=[h]:fs=h,a=bm(a,"onChange"),0<a.length&&(u=new Jo("onChange","change",null,u,h),o.push({event:u,listeners:a}))}var Wa=null,Ki=null;function wl(o){tv(o,0)}function Xa(o){var a=gl(o);if(ma(a))return o}function Sl(o,a){if(o==="change")return a}var Ga=!1;if(Rs){var kl;if(Rs){var ro="oninput"in document;if(!ro){var io=document.createElement("div");io.setAttribute("oninput","return;"),ro=typeof io.oninput=="function"}kl=ro}else kl=!1;Ga=kl&&(!document.documentMode||9<document.documentMode)}function hs(){Wa&&(Wa.detachEvent("onpropertychange",Sa),Ki=Wa=null)}function Sa(o){if(o.propertyName==="value"&&Xa(Ki)){var a=[];Va(a,Ki,o,qc(o)),gc(wl,a)}}function ka(o,a,u){o==="focusin"?(hs(),Wa=a,Ki=u,Wa.attachEvent("onpropertychange",Sa)):o==="focusout"&&hs()}function Kl(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Xa(Ki)}function Uo(o,a){if(o==="click")return Xa(a)}function yr(o,a){if(o==="input"||o==="change")return Xa(a)}function bc(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var _r=typeof Object.is=="function"?Object.is:bc;function go(o,a){if(_r(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(!ye.call(a,x)||!_r(o[x],a[x]))return!1}return!0}function Ka(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function Al(o,a){var u=Ka(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=Ka(u)}}function Se(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?Se(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function oo(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var a=Xr(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=Xr(o.document)}return a}function Aa(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 Ja=Rs&&"documentMode"in document&&11>=document.documentMode,ps=null,ms=null,qs=null,Za=!1;function yo(o,a,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Za||ps==null||ps!==Xr(h)||(h=ps,"selectionStart"in h&&Aa(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}),qs&&go(qs,h)||(qs=h,h=bm(ms,"onSelect"),0<h.length&&(a=new Jo("onSelect","select",null,a,u),o.push({event:a,listeners:h}),a.target=ps)))}function Do(o,a){var u={};return u[o.toLowerCase()]=a.toLowerCase(),u["Webkit"+o]="webkit"+a,u["Moz"+o]="moz"+a,u}var br={animationend:Do("Animation","AnimationEnd"),animationiteration:Do("Animation","AnimationIteration"),animationstart:Do("Animation","AnimationStart"),transitionrun:Do("Transition","TransitionRun"),transitionstart:Do("Transition","TransitionStart"),transitioncancel:Do("Transition","TransitionCancel"),transitionend:Do("Transition","TransitionEnd")},jr={},_i={};Rs&&(_i=document.createElement("div").style,"AnimationEvent"in window||(delete br.animationend.animation,delete br.animationiteration.animation,delete br.animationstart.animation),"TransitionEvent"in window||delete br.transitionend.transition);function Gr(o){if(jr[o])return jr[o];if(!br[o])return o;var a=br[o],u;for(u in a)if(a.hasOwnProperty(u)&&u in _i)return jr[o]=a[u];return o}var Ho=Gr("animationend"),Qa=Gr("animationiteration"),Jl=Gr("animationstart"),Yc=Gr("transitionrun"),pd=Gr("transitionstart"),md=Gr("transitioncancel"),Du=Gr("transitionend"),Lu=new Map,Ma="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(" ");Ma.push("scrollEnd");function gs(o,a){Lu.set(o,a),da(a,[o])}var xc=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)},Qo=[],Ml=0,Ru=0;function vc(){for(var o=Ml,a=Ru=Ml=0;a<o;){var u=Qo[a];Qo[a++]=null;var h=Qo[a];Qo[a++]=null;var x=Qo[a];Qo[a++]=null;var k=Qo[a];if(Qo[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&&wc(u,x,k)}}function Vc(o,a,u,h){Qo[Ml++]=o,Qo[Ml++]=a,Qo[Ml++]=u,Qo[Ml++]=h,Ru|=h,o.lanes|=h,o=o.alternate,o!==null&&(o.lanes|=h)}function Wc(o,a,u,h){return Vc(o,a,u,h),bo(o)}function Ca(o,a){return Vc(o,null,null,a),bo(o)}function wc(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-Ln(u),o=k.hiddenUpdates,h=o[x],h===null?o[x]=[a]:h.push(a),a.lane=u|536870912),k):null}function bo(o){if(50<Th)throw Th=0,N1=null,Error(r(185));for(var a=o.return;a!==null;)o=a,a=o.return;return o.tag===3?o.stateNode:null}var so={};function Xc(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 xo(o,a,u,h){return new Xc(o,a,u,h)}function Gc(o){return o=o.prototype,!(!o||!o.isReactComponent)}function ys(o,a){var u=o.alternate;return u===null?(u=xo(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 Sc(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 Zl(o,a,u,h,x,k){var P=0;if(h=o,typeof o=="function")Gc(o)&&(P=1);else if(typeof o=="string")P=SE(o,u,V.current)?26:o==="html"||o==="head"||o==="body"?27:5;else t:switch(o){case ot:return o=xo(31,u,a,x),o.elementType=ot,o.lanes=k,o;case E:return tl(u.children,x,k,a);case L:P=8,x|=24;break;case R:return o=xo(12,u,a,x|2),o.elementType=R,o.lanes=k,o;case ht:return o=xo(13,u,a,x),o.elementType=ht,o.lanes=k,o;case Mt:return o=xo(19,u,a,x),o.elementType=Mt,o.lanes=k,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case H:P=10;break t;case q:P=9;break t;case $:P=11;break t;case wt: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=xo(P,u,a,x),a.elementType=o,a.type=h,a.lanes=k,a}function tl(o,a,u,h){return o=xo(7,o,h,a),o.lanes=u,o}function kc(o,a,u){return o=xo(6,o,null,a),o.lanes=u,o}function Kc(o){var a=xo(18,null,null,0);return a.stateNode=o,a}function Ac(o,a,u){return a=xo(4,o.children!==null?o.children:[],o.key,a),a.lanes=u,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}var Jc=new WeakMap;function bs(o,a){if(typeof o=="object"&&o!==null){var u=Jc.get(o);return u!==void 0?u:(a={value:o,source:a,stack:fe(a)},Jc.set(o,a),a)}return{value:o,source:a,stack:fe(a)}}var Ql=[],$s=0,Zc=null,Mc=0,xs=[],vs=0,el=null,Lo=1,ws="";function ao(o,a){Ql[$s++]=Mc,Ql[$s++]=Zc,Zc=o,Mc=a}function Cf(o,a,u){xs[vs++]=Lo,xs[vs++]=ws,xs[vs++]=el,el=o;var h=Lo;o=ws;var x=32-Ln(h)-1;h&=~(1<<x),u+=1;var k=32-Ln(a)+x;if(30<k){var P=x-x%5;k=(h&(1<<P)-1).toString(32),h>>=P,x-=P,Lo=1<<32-Ln(a)+x|u<<x|h,ws=k+o}else Lo=1<<k|u<<x|h,ws=o}function Ou(o){o.return!==null&&(ao(o,1),Cf(o,1,0))}function Qc(o){for(;o===Zc;)Zc=Ql[--$s],Ql[$s]=null,Mc=Ql[--$s],Ql[$s]=null;for(;o===el;)el=xs[--vs],xs[vs]=null,ws=xs[--vs],xs[vs]=null,Lo=xs[--vs],xs[vs]=null}function Ef(o,a){xs[vs++]=Lo,xs[vs++]=ws,xs[vs++]=el,Lo=a.id,ws=a.overflow,el=o}var lo=null,Kr=null,nr=!1,bi=null,ei=!1,Ji=Error(r(519));function sa(o){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Cc(bs(a,o)),Ji}function Pu(o){var a=o.stateNode,u=o.type,h=o.memoizedProps;switch(a[Ar]=o,a[er]=h,u){case"dialog":pr("cancel",a),pr("close",a);break;case"iframe":case"object":case"embed":pr("load",a);break;case"video":case"audio":for(u=0;u<_h.length;u++)pr(_h[u],a);break;case"source":pr("error",a);break;case"img":case"image":case"link":pr("error",a),pr("load",a);break;case"details":pr("toggle",a);break;case"input":pr("invalid",a),Fr(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":pr("invalid",a);break;case"textarea":pr("invalid",a),Zn(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||iv(a.textContent,u)?(h.popover!=null&&(pr("beforetoggle",a),pr("toggle",a)),h.onScroll!=null&&pr("scroll",a),h.onScrollEnd!=null&&pr("scrollend",a),h.onClick!=null&&(a.onclick=us),a=!0):a=!1,a||sa(o,!0)}function nl(o){for(lo=o.return;lo;)switch(lo.tag){case 5:case 31:case 13:ei=!1;return;case 27:case 3:ei=!0;return;default:lo=lo.return}}function vo(o){if(o!==lo)return!1;if(!nr)return nl(o),nr=!0,!1;var a=o.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=o.type,u=!(u!=="form"&&u!=="button")||$1(o.type,o.memoizedProps)),u=!u),u&&Kr&&sa(o),nl(o),a===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Kr=hv(o)}else if(a===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Kr=hv(o)}else a===27?(a=Kr,$u(o.type)?(o=G1,G1=null,Kr=o):Kr=a):Kr=lo?Ll(o.stateNode.nextSibling):null;return!0}function Cl(){Kr=lo=null,nr=!1}function Tf(){var o=bi;return o!==null&&(_a===null?_a=o:_a.push.apply(_a,o),bi=null),o}function Cc(o){bi===null?bi=[o]:bi.push(o)}var tu=J(null),El=null,Ss=null;function ks(o,a,u){K(tu,a._currentValue),a._currentValue=u}function ts(o){o._currentValue=tu.current,_(tu)}function Tl(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 tc(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 Ct=0;Ct<a.length;Ct++)if(et.context===a[Ct]){k.lanes|=u,et=k.alternate,et!==null&&(et.lanes|=u),Tl(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),Tl(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 Ys(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;_r(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(Ph):o=[Ph])}x=x.return}o!==null&&tc(a,o,u,h),a.flags|=262144}function eu(o){for(o=o.firstContext;o!==null;){if(!_r(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function rl(o){El=o,Ss=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function Zi(o){return gd(El,o)}function nu(o,a){return El===null&&rl(o),gd(o,a)}function gd(o,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},Ss===null){if(o===null)throw Error(r(308));Ss=a,o.dependencies={lanes:0,firstContext:a},o.flags|=524288}else Ss=Ss.next=a;return u}var ec=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()})}},yh=n.unstable_scheduleCallback,Nf=n.unstable_NormalPriority,xr={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Nl(){return{controller:new ec,data:new Map,refCount:0}}function Ec(o){o.refCount--,o.refCount===0&&yh(Nf,function(){o.controller.abort()})}var ru=null,nc=0,m=0,v=null;function T(o,a){if(ru===null){var u=ru=[];nc=0,m=P1(),v={status:"pending",value:void 0,then:function(h){u.push(h)}}}return nc++,a.then(O,O),a}function O(){if(--nc===0&&ru!==null){v!==null&&(v.status="fulfilled");var o=ru;ru=null,m=0,v=null;for(var a=0;a<o.length;a++)(0,o[a])()}}function F(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 Y=gt.S;gt.S=function(o,a){Tx=cn(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&T(o,a),Y!==null&&Y(o,a)};var W=J(null);function rt(){var o=W.current;return o!==null?o:ki.pooledCache}function st(o,a){a===null?K(W,W.current):K(W,a.pool)}function yt(){var o=rt();return o===null?null:{parent:xr._currentValue,pool:o}}var _t=Error(r(460)),Vt=Error(r(474)),pt=Error(r(542)),Pt={then:function(){}};function $t(o){return o=o.status,o==="fulfilled"||o==="rejected"}function ne(o,a,u){switch(u=o[u],u===void 0?o.push(a):u!==a&&(a.then(us,us),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,we(o),o;default:if(typeof a.status=="string")a.then(us,us);else{if(o=ki,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=a,o.status="pending",o.then(function(h){if(a.status==="pending"){var x=a;x.status="fulfilled",x.value=h}},function(h){if(a.status==="pending"){var x=a;x.status="rejected",x.reason=h}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,we(o),o}throw Jt=a,_t}}function Yt(o){try{var a=o._init;return a(o._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(Jt=u,_t):u}}var Jt=null;function ae(){if(Jt===null)throw Error(r(459));var o=Jt;return Jt=null,o}function we(o){if(o===_t||o===pt)throw Error(r(483))}var he=null,tn=0;function He(o){var a=tn;return tn+=1,he===null&&(he=[]),ne(he,o,a)}function Sn(o,a){a=a.props.ref,o.ref=a!==void 0?a:null}function Ge(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 Gn(o){function a(Ht,Ot){if(o){var Xt=Ht.deletions;Xt===null?(Ht.deletions=[Ot],Ht.flags|=16):Xt.push(Ot)}}function u(Ht,Ot){if(!o)return null;for(;Ot!==null;)a(Ht,Ot),Ot=Ot.sibling;return null}function h(Ht){for(var Ot=new Map;Ht!==null;)Ht.key!==null?Ot.set(Ht.key,Ht):Ot.set(Ht.index,Ht),Ht=Ht.sibling;return Ot}function x(Ht,Ot){return Ht=ys(Ht,Ot),Ht.index=0,Ht.sibling=null,Ht}function k(Ht,Ot,Xt){return Ht.index=Xt,o?(Xt=Ht.alternate,Xt!==null?(Xt=Xt.index,Xt<Ot?(Ht.flags|=67108866,Ot):Xt):(Ht.flags|=67108866,Ot)):(Ht.flags|=1048576,Ot)}function P(Ht){return o&&Ht.alternate===null&&(Ht.flags|=67108866),Ht}function et(Ht,Ot,Xt,ce){return Ot===null||Ot.tag!==6?(Ot=kc(Xt,Ht.mode,ce),Ot.return=Ht,Ot):(Ot=x(Ot,Xt),Ot.return=Ht,Ot)}function Ct(Ht,Ot,Xt,ce){var An=Xt.type;return An===E?le(Ht,Ot,Xt.props.children,ce,Xt.key):Ot!==null&&(Ot.elementType===An||typeof An=="object"&&An!==null&&An.$$typeof===bt&&Yt(An)===Ot.type)?(Ot=x(Ot,Xt.props),Sn(Ot,Xt),Ot.return=Ht,Ot):(Ot=Zl(Xt.type,Xt.key,Xt.props,null,Ht.mode,ce),Sn(Ot,Xt),Ot.return=Ht,Ot)}function Gt(Ht,Ot,Xt,ce){return Ot===null||Ot.tag!==4||Ot.stateNode.containerInfo!==Xt.containerInfo||Ot.stateNode.implementation!==Xt.implementation?(Ot=Ac(Xt,Ht.mode,ce),Ot.return=Ht,Ot):(Ot=x(Ot,Xt.children||[]),Ot.return=Ht,Ot)}function le(Ht,Ot,Xt,ce,An){return Ot===null||Ot.tag!==7?(Ot=tl(Xt,Ht.mode,ce,An),Ot.return=Ht,Ot):(Ot=x(Ot,Xt),Ot.return=Ht,Ot)}function pe(Ht,Ot,Xt){if(typeof Ot=="string"&&Ot!==""||typeof Ot=="number"||typeof Ot=="bigint")return Ot=kc(""+Ot,Ht.mode,Xt),Ot.return=Ht,Ot;if(typeof Ot=="object"&&Ot!==null){switch(Ot.$$typeof){case y:return Xt=Zl(Ot.type,Ot.key,Ot.props,null,Ht.mode,Xt),Sn(Xt,Ot),Xt.return=Ht,Xt;case A:return Ot=Ac(Ot,Ht.mode,Xt),Ot.return=Ht,Ot;case bt:return Ot=Yt(Ot),pe(Ht,Ot,Xt)}if(Tt(Ot)||at(Ot))return Ot=tl(Ot,Ht.mode,Xt,null),Ot.return=Ht,Ot;if(typeof Ot.then=="function")return pe(Ht,He(Ot),Xt);if(Ot.$$typeof===H)return pe(Ht,nu(Ht,Ot),Xt);Ge(Ht,Ot)}return null}function Kt(Ht,Ot,Xt,ce){var An=Ot!==null?Ot.key:null;if(typeof Xt=="string"&&Xt!==""||typeof Xt=="number"||typeof Xt=="bigint")return An!==null?null:et(Ht,Ot,""+Xt,ce);if(typeof Xt=="object"&&Xt!==null){switch(Xt.$$typeof){case y:return Xt.key===An?Ct(Ht,Ot,Xt,ce):null;case A:return Xt.key===An?Gt(Ht,Ot,Xt,ce):null;case bt:return Xt=Yt(Xt),Kt(Ht,Ot,Xt,ce)}if(Tt(Xt)||at(Xt))return An!==null?null:le(Ht,Ot,Xt,ce,null);if(typeof Xt.then=="function")return Kt(Ht,Ot,He(Xt),ce);if(Xt.$$typeof===H)return Kt(Ht,Ot,nu(Ht,Xt),ce);Ge(Ht,Xt)}return null}function re(Ht,Ot,Xt,ce,An){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return Ht=Ht.get(Xt)||null,et(Ot,Ht,""+ce,An);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case y:return Ht=Ht.get(ce.key===null?Xt:ce.key)||null,Ct(Ot,Ht,ce,An);case A:return Ht=Ht.get(ce.key===null?Xt:ce.key)||null,Gt(Ot,Ht,ce,An);case bt:return ce=Yt(ce),re(Ht,Ot,Xt,ce,An)}if(Tt(ce)||at(ce))return Ht=Ht.get(Xt)||null,le(Ot,Ht,ce,An,null);if(typeof ce.then=="function")return re(Ht,Ot,Xt,He(ce),An);if(ce.$$typeof===H)return re(Ht,Ot,Xt,nu(Ot,ce),An);Ge(Ot,ce)}return null}function rn(Ht,Ot,Xt,ce){for(var An=null,Ur=null,un=Ot,Qn=Ot=0,Sr=null;un!==null&&Qn<Xt.length;Qn++){un.index>Qn?(Sr=un,un=null):Sr=un.sibling;var Hr=Kt(Ht,un,Xt[Qn],ce);if(Hr===null){un===null&&(un=Sr);break}o&&un&&Hr.alternate===null&&a(Ht,un),Ot=k(Hr,Ot,Qn),Ur===null?An=Hr:Ur.sibling=Hr,Ur=Hr,un=Sr}if(Qn===Xt.length)return u(Ht,un),nr&&ao(Ht,Qn),An;if(un===null){for(;Qn<Xt.length;Qn++)un=pe(Ht,Xt[Qn],ce),un!==null&&(Ot=k(un,Ot,Qn),Ur===null?An=un:Ur.sibling=un,Ur=un);return nr&&ao(Ht,Qn),An}for(un=h(un);Qn<Xt.length;Qn++)Sr=re(un,Ht,Qn,Xt[Qn],ce),Sr!==null&&(o&&Sr.alternate!==null&&un.delete(Sr.key===null?Qn:Sr.key),Ot=k(Sr,Ot,Qn),Ur===null?An=Sr:Ur.sibling=Sr,Ur=Sr);return o&&un.forEach(function(Gu){return a(Ht,Gu)}),nr&&ao(Ht,Qn),An}function Dn(Ht,Ot,Xt,ce){if(Xt==null)throw Error(r(151));for(var An=null,Ur=null,un=Ot,Qn=Ot=0,Sr=null,Hr=Xt.next();un!==null&&!Hr.done;Qn++,Hr=Xt.next()){un.index>Qn?(Sr=un,un=null):Sr=un.sibling;var Gu=Kt(Ht,un,Hr.value,ce);if(Gu===null){un===null&&(un=Sr);break}o&&un&&Gu.alternate===null&&a(Ht,un),Ot=k(Gu,Ot,Qn),Ur===null?An=Gu:Ur.sibling=Gu,Ur=Gu,un=Sr}if(Hr.done)return u(Ht,un),nr&&ao(Ht,Qn),An;if(un===null){for(;!Hr.done;Qn++,Hr=Xt.next())Hr=pe(Ht,Hr.value,ce),Hr!==null&&(Ot=k(Hr,Ot,Qn),Ur===null?An=Hr:Ur.sibling=Hr,Ur=Hr);return nr&&ao(Ht,Qn),An}for(un=h(un);!Hr.done;Qn++,Hr=Xt.next())Hr=re(un,Ht,Qn,Hr.value,ce),Hr!==null&&(o&&Hr.alternate!==null&&un.delete(Hr.key===null?Qn:Hr.key),Ot=k(Hr,Ot,Qn),Ur===null?An=Hr:Ur.sibling=Hr,Ur=Hr);return o&&un.forEach(function(RE){return a(Ht,RE)}),nr&&ao(Ht,Qn),An}function di(Ht,Ot,Xt,ce){if(typeof Xt=="object"&&Xt!==null&&Xt.type===E&&Xt.key===null&&(Xt=Xt.props.children),typeof Xt=="object"&&Xt!==null){switch(Xt.$$typeof){case y:t:{for(var An=Xt.key;Ot!==null;){if(Ot.key===An){if(An=Xt.type,An===E){if(Ot.tag===7){u(Ht,Ot.sibling),ce=x(Ot,Xt.props.children),ce.return=Ht,Ht=ce;break t}}else if(Ot.elementType===An||typeof An=="object"&&An!==null&&An.$$typeof===bt&&Yt(An)===Ot.type){u(Ht,Ot.sibling),ce=x(Ot,Xt.props),Sn(ce,Xt),ce.return=Ht,Ht=ce;break t}u(Ht,Ot);break}else a(Ht,Ot);Ot=Ot.sibling}Xt.type===E?(ce=tl(Xt.props.children,Ht.mode,ce,Xt.key),ce.return=Ht,Ht=ce):(ce=Zl(Xt.type,Xt.key,Xt.props,null,Ht.mode,ce),Sn(ce,Xt),ce.return=Ht,Ht=ce)}return P(Ht);case A:t:{for(An=Xt.key;Ot!==null;){if(Ot.key===An)if(Ot.tag===4&&Ot.stateNode.containerInfo===Xt.containerInfo&&Ot.stateNode.implementation===Xt.implementation){u(Ht,Ot.sibling),ce=x(Ot,Xt.children||[]),ce.return=Ht,Ht=ce;break t}else{u(Ht,Ot);break}else a(Ht,Ot);Ot=Ot.sibling}ce=Ac(Xt,Ht.mode,ce),ce.return=Ht,Ht=ce}return P(Ht);case bt:return Xt=Yt(Xt),di(Ht,Ot,Xt,ce)}if(Tt(Xt))return rn(Ht,Ot,Xt,ce);if(at(Xt)){if(An=at(Xt),typeof An!="function")throw Error(r(150));return Xt=An.call(Xt),Dn(Ht,Ot,Xt,ce)}if(typeof Xt.then=="function")return di(Ht,Ot,He(Xt),ce);if(Xt.$$typeof===H)return di(Ht,Ot,nu(Ht,Xt),ce);Ge(Ht,Xt)}return typeof Xt=="string"&&Xt!==""||typeof Xt=="number"||typeof Xt=="bigint"?(Xt=""+Xt,Ot!==null&&Ot.tag===6?(u(Ht,Ot.sibling),ce=x(Ot,Xt),ce.return=Ht,Ht=ce):(u(Ht,Ot),ce=kc(Xt,Ht.mode,ce),ce.return=Ht,Ht=ce),P(Ht)):u(Ht,Ot)}return function(Ht,Ot,Xt,ce){try{tn=0;var An=di(Ht,Ot,Xt,ce);return he=null,An}catch(un){if(un===_t||un===pt)throw un;var Ur=xo(29,un,null,Ht.mode);return Ur.lanes=ce,Ur.return=Ht,Ur}}}var $r=Gn(!0),zn=Gn(!1),qe=!1;function De(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ni(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 kn(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function jn(o,a,u){var h=o.updateQueue;if(h===null)return null;if(h=h.shared,(Vr&2)!==0){var x=h.pending;return x===null?a.next=a:(a.next=x.next,x.next=a),h.pending=a,a=bo(o),wc(o,null,u),a}return Vc(o,h,a,u),bo(o)}function Dr(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,Bn(o,u)}}function Ri(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 Qi=!1;function Jr(){if(Qi){var o=v;if(o!==null)throw o}}function Ui(o,a,u,h){Qi=!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 Ct=et,Gt=Ct.next;Ct.next=null,P===null?k=Gt:P.next=Gt,P=Ct;var le=o.alternate;le!==null&&(le=le.updateQueue,et=le.lastBaseUpdate,et!==P&&(et===null?le.firstBaseUpdate=Gt:et.next=Gt,le.lastBaseUpdate=Ct))}if(k!==null){var pe=x.baseState;P=0,le=Gt=Ct=null,et=k;do{var Kt=et.lane&-536870913,re=Kt!==et.lane;if(re?(wr&Kt)===Kt:(h&Kt)===Kt){Kt!==0&&Kt===m&&(Qi=!0),le!==null&&(le=le.next={lane:0,tag:et.tag,payload:et.payload,callback:null,next:null});t:{var rn=o,Dn=et;Kt=a;var di=u;switch(Dn.tag){case 1:if(rn=Dn.payload,typeof rn=="function"){pe=rn.call(di,pe,Kt);break t}pe=rn;break t;case 3:rn.flags=rn.flags&-65537|128;case 0:if(rn=Dn.payload,Kt=typeof rn=="function"?rn.call(di,pe,Kt):rn,Kt==null)break t;pe=g({},pe,Kt);break t;case 2:qe=!0}}Kt=et.callback,Kt!==null&&(o.flags|=64,re&&(o.flags|=8192),re=x.callbacks,re===null?x.callbacks=[Kt]:re.push(Kt))}else re={lane:Kt,tag:et.tag,payload:et.payload,callback:et.callback,next:null},le===null?(Gt=le=re,Ct=pe):le=le.next=re,P|=Kt;if(et=et.next,et===null){if(et=x.shared.pending,et===null)break;re=et,et=re.next,re.next=null,x.lastBaseUpdate=re,x.shared.pending=null}}while(!0);le===null&&(Ct=pe),x.baseState=Ct,x.firstBaseUpdate=Gt,x.lastBaseUpdate=le,k===null&&(x.shared.lanes=0),Bu|=P,o.lanes=P,o.memoizedState=pe}}function wo(o,a){if(typeof o!="function")throw Error(r(191,o));o.call(a)}function Oi(o,a){var u=o.callbacks;if(u!==null)for(o.callbacks=null,o=0;o<u.length;o++)wo(u[o],a)}var Kn=J(null),dr=J(0);function xi(o,a){o=du,K(dr,o),K(Kn,a),du=o|a.baseLanes}function lr(){K(dr,du),K(Kn,Kn.current)}function to(){du=dr.current,_(Kn),_(dr)}var vi=J(null),cr=null;function Pi(o){var a=o.alternate;K(bn,bn.current&1),K(vi,o),cr===null&&(a===null||Kn.current!==null||a.memoizedState!==null)&&(cr=o)}function vr(o){K(bn,bn.current),K(vi,o),cr===null&&(cr=o)}function wi(o){o.tag===22?(K(bn,bn.current),K(vi,o),cr===null&&(cr=o)):Si()}function Si(){K(bn,bn.current),K(vi,vi.current)}function Cr(o){_(vi),cr===o&&(cr=null),_(bn)}var bn=J(0);function Hi(o){for(var a=o;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||W1(u)||X1(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 Zr=0,w=null,S=null,N=null,D=!1,j=!1,X=!1,tt=0,U=0,nt=null,ft=0;function it(){throw Error(r(321))}function mt(o,a){if(a===null)return!1;for(var u=0;u<a.length&&u<o.length;u++)if(!_r(o[u],a[u]))return!1;return!0}function z(o,a,u,h,x,k){return Zr=k,w=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,gt.H=o===null||o.memoizedState===null?Bb:i1,X=!1,k=u(h,x),X=!1,j&&(k=jt(a,u,h,x)),Nt(o),k}function Nt(o){gt.H=xh;var a=S!==null&&S.next!==null;if(Zr=0,N=S=w=null,D=!1,U=0,nt=null,a)throw Error(r(300));o===null||Oo||(o=o.dependencies,o!==null&&eu(o)&&(Oo=!0))}function jt(o,a,u,h){w=o;var x=0;do{if(j&&(nt=null),U=0,j=!1,25<=x)throw Error(r(301));if(x+=1,N=S=null,o.updateQueue!=null){var k=o.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}gt.H=Fb,k=a(u,h)}while(j);return k}function St(){var o=gt.H,a=o.useState()[0];return a=typeof a.then=="function"?xe(a):a,o=o.useState()[0],(S!==null?S.memoizedState:null)!==o&&(w.flags|=1024),a}function Rt(){var o=tt!==0;return tt=0,o}function kt(o,a,u){a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~u}function qt(o){if(D){for(o=o.memoizedState;o!==null;){var a=o.queue;a!==null&&(a.pending=null),o=o.next}D=!1}Zr=0,N=S=w=null,j=!1,U=tt=0,nt=null}function Ut(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return N===null?w.memoizedState=N=o:N=N.next=o,N}function oe(){if(S===null){var o=w.alternate;o=o!==null?o.memoizedState:null}else o=S.next;var a=N===null?w.memoizedState:N.next;if(a!==null)N=a,S=o;else{if(o===null)throw w.alternate===null?Error(r(467)):Error(r(310));S=o,o={memoizedState:S.memoizedState,baseState:S.baseState,baseQueue:S.baseQueue,queue:S.queue,next:null},N===null?w.memoizedState=N=o:N=N.next=o}return N}function be(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function xe(o){var a=U;return U+=1,nt===null&&(nt=[]),o=ne(nt,o,a),a=w,(N===null?a.memoizedState:N.next)===null&&(a=a.alternate,gt.H=a===null||a.memoizedState===null?Bb:i1),o}function $e(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return xe(o);if(o.$$typeof===H)return Zi(o)}throw Error(r(438,String(o)))}function vn(o){var a=null,u=w.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var h=w.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=be(),w.updateQueue=u),u.memoCache=a,u=a.data[a.index],u===void 0)for(u=a.data[a.index]=Array(o),h=0;h<o;h++)u[h]=Dt;return a.index++,u}function de(o,a){return typeof a=="function"?a(o):a}function fn(o){var a=oe();return Ce(a,S,o)}function Ce(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,Ct=null,Gt=a,le=!1;do{var pe=Gt.lane&-536870913;if(pe!==Gt.lane?(wr&pe)===pe:(Zr&pe)===pe){var Kt=Gt.revertLane;if(Kt===0)Ct!==null&&(Ct=Ct.next={lane:0,revertLane:0,gesture:null,action:Gt.action,hasEagerState:Gt.hasEagerState,eagerState:Gt.eagerState,next:null}),pe===m&&(le=!0);else if((Zr&Kt)===Kt){Gt=Gt.next,Kt===m&&(le=!0);continue}else pe={lane:0,revertLane:Gt.revertLane,gesture:null,action:Gt.action,hasEagerState:Gt.hasEagerState,eagerState:Gt.eagerState,next:null},Ct===null?(et=Ct=pe,P=k):Ct=Ct.next=pe,w.lanes|=Kt,Bu|=Kt;pe=Gt.action,X&&u(k,pe),k=Gt.hasEagerState?Gt.eagerState:u(k,pe)}else Kt={lane:pe,revertLane:Gt.revertLane,gesture:Gt.gesture,action:Gt.action,hasEagerState:Gt.hasEagerState,eagerState:Gt.eagerState,next:null},Ct===null?(et=Ct=Kt,P=k):Ct=Ct.next=Kt,w.lanes|=pe,Bu|=pe;Gt=Gt.next}while(Gt!==null&&Gt!==a);if(Ct===null?P=k:Ct.next=et,!_r(k,o.memoizedState)&&(Oo=!0,le&&(u=v,u!==null)))throw u;o.memoizedState=k,o.baseState=P,o.baseQueue=Ct,h.lastRenderedState=k}return x===null&&(h.lanes=0),[o.memoizedState,h.dispatch]}function Hn(o){var a=oe(),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);_r(k,a.memoizedState)||(Oo=!0),a.memoizedState=k,a.baseQueue===null&&(a.baseState=k),u.lastRenderedState=k}return[k,h]}function Ir(o,a,u){var h=w,x=oe(),k=nr;if(k){if(u===void 0)throw Error(r(407));u=u()}else u=a();var P=!_r((S||x).memoizedState,u);if(P&&(x.memoizedState=u,Oo=!0),x=x.queue,bd(qo.bind(null,h,x,o),[o]),x.getSnapshot!==a||P||N!==null&&N.memoizedState.tag&1){if(h.flags|=2048,_l(9,{destroy:void 0},Ro.bind(null,h,x,u,a),null),ki===null)throw Error(r(349));k||(Zr&127)!==0||zr(h,a,u)}return u}function zr(o,a,u){o.flags|=16384,o={getSnapshot:a,value:u},a=w.updateQueue,a===null?(a=be(),w.updateQueue=a,a.stores=[o]):(u=a.stores,u===null?a.stores=[o]:u.push(o))}function Ro(o,a,u,h){a.value=u,a.getSnapshot=h,It(a)&&Ye(o)}function qo(o,a,u){return u(function(){It(a)&&Ye(o)})}function It(o){var a=o.getSnapshot;o=o.value;try{var u=a();return!_r(o,u)}catch{return!0}}function Ye(o){var a=Ca(o,2);a!==null&&Da(a,o,2)}function Ae(o){var a=Ut();if(typeof o=="function"){var u=o;if(o=u(),X){ln(!0);try{u()}finally{ln(!1)}}}return a.memoizedState=a.baseState=o,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:de,lastRenderedState:o},a}function Be(o,a,u,h){return o.baseState=u,Ce(o,S,typeof h=="function"?h:de)}function Ve(o,a,u,h,x){if(Qp(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)}};gt.T!==null?u(!0):k.isTransition=!1,h(k),u=a.pending,u===null?(k.next=a.pending=k,Cn(a,k)):(k.next=u.next,a.pending=u.next=k)}}function Cn(o,a){var u=a.action,h=a.payload,x=o.state;if(a.isTransition){var k=gt.T,P={};gt.T=P;try{var et=u(x,h),Ct=gt.S;Ct!==null&&Ct(P,et),Yr(o,a,et)}catch(Gt){Qr(o,a,Gt)}finally{k!==null&&P.types!==null&&(k.types=P.types),gt.T=k}}else try{k=u(x,h),Yr(o,a,k)}catch(Gt){Qr(o,a,Gt)}}function Yr(o,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(h){co(o,a,h)},function(h){return Qr(o,a,h)}):co(o,a,u)}function co(o,a,u){a.status="fulfilled",a.value=u,So(a),o.state=u,a=o.pending,a!==null&&(u=a.next,u===a?o.pending=null:(u=u.next,a.next=u,Cn(o,u)))}function Qr(o,a,u){var h=o.pending;if(o.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=u,So(a),a=a.next;while(a!==h)}o.action=null}function So(o){o=o.listeners;for(var a=0;a<o.length;a++)(0,o[a])()}function ui(o,a){return a}function Lr(o,a){if(nr){var u=ki.formState;if(u!==null){t:{var h=w;if(nr){if(Kr){e:{for(var x=Kr,k=ei;x.nodeType!==8;){if(!k){x=null;break e}if(x=Ll(x.nextSibling),x===null){x=null;break e}}k=x.data,x=k==="F!"||k==="F"?x:null}if(x){Kr=Ll(x.nextSibling),h=x.data==="F!";break t}}sa(h)}h=!1}h&&(a=u[0])}}return u=Ut(),u.memoizedState=u.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ui,lastRenderedState:a},u.queue=h,u=jb.bind(null,w,h),h.dispatch=u,h=Ae(!1),k=r1.bind(null,w,!1,h.queue),h=Ut(),x={state:a,dispatch:null,action:o,pending:null},h.queue=x,u=Ve.bind(null,w,x,k,u),x.dispatch=u,h.memoizedState=o,[a,u,!1]}function Er(o){var a=oe();return Jn(a,S,o)}function Jn(o,a,u){if(a=Ce(o,a,ui)[0],o=fn(de)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=xe(a)}catch(P){throw P===_t?pt:P}else h=a;a=oe();var x=a.queue,k=x.dispatch;return u!==a.memoizedState&&(w.flags|=2048,_l(9,{destroy:void 0},qi.bind(null,x,u),null)),[h,k,o]}function qi(o,a){o.action=a}function As(o){var a=oe(),u=S;if(u!==null)return Jn(a,u,o);oe(),a=a.memoizedState,u=oe();var h=u.queue.dispatch;return u.memoizedState=o,[a,h,!1]}function _l(o,a,u,h){return o={tag:o,create:u,deps:h,inst:a,next:null},a=w.updateQueue,a===null&&(a=be(),w.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 ju(){return oe().memoizedState}function aa(o,a,u,h){var x=Ut();w.flags|=o,x.memoizedState=_l(1|a,{destroy:void 0},u,h===void 0?null:h)}function Dl(o,a,u,h){var x=oe();h=h===void 0?null:h;var k=x.memoizedState.inst;S!==null&&h!==null&&mt(h,S.memoizedState.deps)?x.memoizedState=_l(a,k,u,h):(w.flags|=o,x.memoizedState=_l(1|a,k,u,h))}function yd(o,a){aa(8390656,8,o,a)}function bd(o,a){Dl(2048,8,o,a)}function Jp(o){w.flags|=4;var a=w.updateQueue;if(a===null)a=be(),w.updateQueue=a,a.events=[o];else{var u=a.events;u===null?a.events=[o]:u.push(o)}}function Zp(o){var a=oe().memoizedState;return Jp({ref:a,nextImpl:o}),function(){if((Vr&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function il(o,a){return Dl(4,2,o,a)}function Tc(o,a){return Dl(4,4,o,a)}function iu(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 ou(o,a,u){u=u!=null?u.concat([o]):null,Dl(4,4,iu.bind(null,a,o),u)}function ko(){}function Nc(o,a){var u=oe();a=a===void 0?null:a;var h=u.memoizedState;return a!==null&&mt(a,h[1])?h[0]:(u.memoizedState=[o,a],o)}function ol(o,a){var u=oe();a=a===void 0?null:a;var h=u.memoizedState;if(a!==null&&mt(a,h[1]))return h[0];if(h=o(),X){ln(!0);try{o()}finally{ln(!1)}}return u.memoizedState=[h,a],h}function t1(o,a,u){return u===void 0||(Zr&1073741824)!==0&&(wr&261930)===0?o.memoizedState=a:(o.memoizedState=u,o=_x(),w.lanes|=o,Bu|=o,u)}function _b(o,a,u,h){return _r(u,a)?u:Kn.current!==null?(o=t1(o,u,h),_r(o,a)||(Oo=!0),o):(Zr&42)===0||(Zr&1073741824)!==0&&(wr&261930)===0?(Oo=!0,o.memoizedState=u):(o=_x(),w.lanes|=o,Bu|=o,a)}function Db(o,a,u,h,x){var k=Z.p;Z.p=k!==0&&8>k?k:8;var P=gt.T,et={};gt.T=et,r1(o,!1,a,u);try{var Ct=x(),Gt=gt.S;if(Gt!==null&&Gt(et,Ct),Ct!==null&&typeof Ct=="object"&&typeof Ct.then=="function"){var le=F(Ct,h);bh(o,a,le,ll(o))}else bh(o,a,h,ll(o))}catch(pe){bh(o,a,{then:function(){},status:"rejected",reason:pe},ll())}finally{Z.p=k,P!==null&&et.types!==null&&(P.types=et.types),gt.T=P}}function T6(){}function e1(o,a,u,h){if(o.tag!==5)throw Error(r(476));var x=Lb(o).queue;Db(o,x,a,lt,u===null?T6:function(){return Rb(o),u(h)})}function Lb(o){var a=o.memoizedState;if(a!==null)return a;a={memoizedState:lt,baseState:lt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:de,lastRenderedState:lt},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:de,lastRenderedState:u},next:null},o.memoizedState=a,o=o.alternate,o!==null&&(o.memoizedState=a),a}function Rb(o){var a=Lb(o);a.next===null&&(a=o.alternate.memoizedState),bh(o,a.next.queue,{},ll())}function n1(){return Zi(Ph)}function Ob(){return oe().memoizedState}function Pb(){return oe().memoizedState}function N6(o){for(var a=o.return;a!==null;){switch(a.tag){case 24:case 3:var u=ll();o=kn(u);var h=jn(a,o,u);h!==null&&(Da(h,a,u),Dr(h,a,u)),a={cache:Nl()},o.payload=a;return}a=a.return}}function _6(o,a,u){var h=ll();u={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Qp(o)?Ib(a,u):(u=Wc(o,a,u,h),u!==null&&(Da(u,o,h),zb(u,a,h)))}function jb(o,a,u){var h=ll();bh(o,a,u,h)}function bh(o,a,u,h){var x={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Qp(o))Ib(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,_r(et,P))return Vc(o,a,x,0),ki===null&&vc(),!1}catch{}if(u=Wc(o,a,x,h),u!==null)return Da(u,o,h),zb(u,a,h),!0}return!1}function r1(o,a,u,h){if(h={lane:2,revertLane:P1(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Qp(o)){if(a)throw Error(r(479))}else a=Wc(o,u,h,2),a!==null&&Da(a,o,2)}function Qp(o){var a=o.alternate;return o===w||a!==null&&a===w}function Ib(o,a){j=D=!0;var u=o.pending;u===null?a.next=a:(a.next=u.next,u.next=a),o.pending=a}function zb(o,a,u){if((u&4194048)!==0){var h=a.lanes;h&=o.pendingLanes,u|=h,a.lanes=u,Bn(o,u)}}var xh={readContext:Zi,use:$e,useCallback:it,useContext:it,useEffect:it,useImperativeHandle:it,useLayoutEffect:it,useInsertionEffect:it,useMemo:it,useReducer:it,useRef:it,useState:it,useDebugValue:it,useDeferredValue:it,useTransition:it,useSyncExternalStore:it,useId:it,useHostTransitionStatus:it,useFormState:it,useActionState:it,useOptimistic:it,useMemoCache:it,useCacheRefresh:it};xh.useEffectEvent=it;var Bb={readContext:Zi,use:$e,useCallback:function(o,a){return Ut().memoizedState=[o,a===void 0?null:a],o},useContext:Zi,useEffect:yd,useImperativeHandle:function(o,a,u){u=u!=null?u.concat([o]):null,aa(4194308,4,iu.bind(null,a,o),u)},useLayoutEffect:function(o,a){return aa(4194308,4,o,a)},useInsertionEffect:function(o,a){aa(4,2,o,a)},useMemo:function(o,a){var u=Ut();a=a===void 0?null:a;var h=o();if(X){ln(!0);try{o()}finally{ln(!1)}}return u.memoizedState=[h,a],h},useReducer:function(o,a,u){var h=Ut();if(u!==void 0){var x=u(a);if(X){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=_6.bind(null,w,o),[h.memoizedState,o]},useRef:function(o){var a=Ut();return o={current:o},a.memoizedState=o},useState:function(o){o=Ae(o);var a=o.queue,u=jb.bind(null,w,a);return a.dispatch=u,[o.memoizedState,u]},useDebugValue:ko,useDeferredValue:function(o,a){var u=Ut();return t1(u,o,a)},useTransition:function(){var o=Ae(!1);return o=Db.bind(null,w,o.queue,!0,!1),Ut().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,a,u){var h=w,x=Ut();if(nr){if(u===void 0)throw Error(r(407));u=u()}else{if(u=a(),ki===null)throw Error(r(349));(wr&127)!==0||zr(h,a,u)}x.memoizedState=u;var k={value:u,getSnapshot:a};return x.queue=k,yd(qo.bind(null,h,k,o),[o]),h.flags|=2048,_l(9,{destroy:void 0},Ro.bind(null,h,k,u,a),null),u},useId:function(){var o=Ut(),a=ki.identifierPrefix;if(nr){var u=ws,h=Lo;u=(h&~(1<<32-Ln(h)-1)).toString(32)+u,a="_"+a+"R_"+u,u=tt++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=ft++,a="_"+a+"r_"+u.toString(32)+"_";return o.memoizedState=a},useHostTransitionStatus:n1,useFormState:Lr,useActionState:Lr,useOptimistic:function(o){var a=Ut();a.memoizedState=a.baseState=o;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=r1.bind(null,w,!0,u),u.dispatch=a,[o,a]},useMemoCache:vn,useCacheRefresh:function(){return Ut().memoizedState=N6.bind(null,w)},useEffectEvent:function(o){var a=Ut(),u={impl:o};return a.memoizedState=u,function(){if((Vr&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},i1={readContext:Zi,use:$e,useCallback:Nc,useContext:Zi,useEffect:bd,useImperativeHandle:ou,useInsertionEffect:il,useLayoutEffect:Tc,useMemo:ol,useReducer:fn,useRef:ju,useState:function(){return fn(de)},useDebugValue:ko,useDeferredValue:function(o,a){var u=oe();return _b(u,S.memoizedState,o,a)},useTransition:function(){var o=fn(de)[0],a=oe().memoizedState;return[typeof o=="boolean"?o:xe(o),a]},useSyncExternalStore:Ir,useId:Ob,useHostTransitionStatus:n1,useFormState:Er,useActionState:Er,useOptimistic:function(o,a){var u=oe();return Be(u,S,o,a)},useMemoCache:vn,useCacheRefresh:Pb};i1.useEffectEvent=Zp;var Fb={readContext:Zi,use:$e,useCallback:Nc,useContext:Zi,useEffect:bd,useImperativeHandle:ou,useInsertionEffect:il,useLayoutEffect:Tc,useMemo:ol,useReducer:Hn,useRef:ju,useState:function(){return Hn(de)},useDebugValue:ko,useDeferredValue:function(o,a){var u=oe();return S===null?t1(u,o,a):_b(u,S.memoizedState,o,a)},useTransition:function(){var o=Hn(de)[0],a=oe().memoizedState;return[typeof o=="boolean"?o:xe(o),a]},useSyncExternalStore:Ir,useId:Ob,useHostTransitionStatus:n1,useFormState:As,useActionState:As,useOptimistic:function(o,a){var u=oe();return S!==null?Be(u,S,o,a):(u.baseState=o,[o,u.queue.dispatch])},useMemoCache:vn,useCacheRefresh:Pb};Fb.useEffectEvent=Zp;function o1(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 s1={enqueueSetState:function(o,a,u){o=o._reactInternals;var h=ll(),x=kn(h);x.payload=a,u!=null&&(x.callback=u),a=jn(o,x,h),a!==null&&(Da(a,o,h),Dr(a,o,h))},enqueueReplaceState:function(o,a,u){o=o._reactInternals;var h=ll(),x=kn(h);x.tag=1,x.payload=a,u!=null&&(x.callback=u),a=jn(o,x,h),a!==null&&(Da(a,o,h),Dr(a,o,h))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var u=ll(),h=kn(u);h.tag=2,a!=null&&(h.callback=a),a=jn(o,h,u),a!==null&&(Da(a,o,u),Dr(a,o,u))}};function Ub(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?!go(u,h)||!go(x,k):!0}function Hb(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&&s1.enqueueReplaceState(a,a.state,null)}function _f(o,a){var u=a;if("ref"in a){u={};for(var h in a)h!=="ref"&&(u[h]=a[h])}if(o=o.defaultProps){u===a&&(u=g({},u));for(var x in o)u[x]===void 0&&(u[x]=o[x])}return u}function qb(o){xc(o)}function $b(o){console.error(o)}function Yb(o){xc(o)}function tm(o,a){try{var u=o.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function Vb(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 a1(o,a,u){return u=kn(u),u.tag=3,u.payload={element:null},u.callback=function(){tm(o,a)},u}function Wb(o){return o=kn(o),o.tag=3,o}function Xb(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(){Vb(a,u,h)}}var P=u.stateNode;P!==null&&typeof P.componentDidCatch=="function"&&(o.callback=function(){Vb(a,u,h),typeof x!="function"&&(Fu===null?Fu=new Set([this]):Fu.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&&Ys(a,u,x,!0),u=vi.current,u!==null){switch(u.tag){case 31:case 13:return cr===null?dm():u.alternate===null&&uo===0&&(uo=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),L1(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)),L1(o,h,x)),!1}throw Error(r(435,u.tag))}return L1(o,h,x),dm(),!1}if(nr)return a=vi.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,h!==Ji&&(o=Error(r(422),{cause:h}),Cc(bs(o,u)))):(h!==Ji&&(a=Error(r(423),{cause:h}),Cc(bs(a,u))),o=o.current.alternate,o.flags|=65536,x&=-x,o.lanes|=x,h=bs(h,u),x=a1(o.stateNode,h,x),Ri(o,x),uo!==4&&(uo=2)),!1;var k=Error(r(520),{cause:h});if(k=bs(k,u),Eh===null?Eh=[k]:Eh.push(k),uo!==4&&(uo=2),a===null)return!0;h=bs(h,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,o=x&-x,u.lanes|=o,o=a1(u.stateNode,h,o),Ri(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"&&(Fu===null||!Fu.has(k))))return u.flags|=65536,x&=-x,u.lanes|=x,x=Wb(x),Xb(x,o,u,h),Ri(u,x),!1}u=u.return}while(u!==null);return!1}var l1=Error(r(461)),Oo=!1;function Ms(o,a,u,h){a.child=o===null?zn(a,null,u,h):$r(a,o.child,u,h)}function Gb(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 rl(a),h=z(o,a,u,P,k,x),et=Rt(),o!==null&&!Oo?(kt(o,a,x),su(o,a,x)):(nr&&et&&Ou(a),a.flags|=1,Ms(o,a,h,x),a.child)}function Kb(o,a,u,h,x){if(o===null){var k=u.type;return typeof k=="function"&&!Gc(k)&&k.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=k,Jb(o,a,k,h,x)):(o=Zl(u.type,null,h,a,a.mode,x),o.ref=a.ref,o.return=a,a.child=o)}if(k=o.child,!g1(o,x)){var P=k.memoizedProps;if(u=u.compare,u=u!==null?u:go,u(P,h)&&o.ref===a.ref)return su(o,a,x)}return a.flags|=1,o=ys(k,h),o.ref=a.ref,o.return=a,a.child=o}function Jb(o,a,u,h,x){if(o!==null){var k=o.memoizedProps;if(go(k,h)&&o.ref===a.ref)if(Oo=!1,a.pendingProps=h=k,g1(o,x))(o.flags&131072)!==0&&(Oo=!0);else return a.lanes=o.lanes,su(o,a,x)}return c1(o,a,u,h,x)}function Zb(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 Qb(o,a,k,u,h)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},o!==null&&st(a,k!==null?k.cachePool:null),k!==null?xi(a,k):lr(),wi(a);else return h=a.lanes=536870912,Qb(o,a,k!==null?k.baseLanes|u:u,u,h)}else k!==null?(st(a,k.cachePool),xi(a,k),Si(),a.memoizedState=null):(o!==null&&st(a,null),lr(),Si());return Ms(o,a,x,u),a.child}function vh(o,a){return o!==null&&o.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Qb(o,a,u,h,x){var k=rt();return k=k===null?null:{parent:xr._currentValue,pool:k},a.memoizedState={baseLanes:u,cachePool:k},o!==null&&st(a,null),lr(),wi(a),o!==null&&Ys(o,a,h,!0),a.childLanes=x,null}function em(o,a){return a=rm({mode:a.mode,children:a.children},o.mode),a.ref=o.ref,o.child=a,a.return=o,a}function tx(o,a,u){return $r(a,o.child,null,u),o=em(a,a.pendingProps),o.flags|=2,Cr(a),a.memoizedState=null,o}function L6(o,a,u){var h=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,o===null){if(nr){if(h.mode==="hidden")return o=em(a,h),a.lanes=536870912,vh(null,o);if(vr(a),(o=Kr)?(o=dv(o,ei),o=o!==null&&o.data==="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:el!==null?{id:Lo,overflow:ws}:null,retryLane:536870912,hydrationErrors:null},u=Kc(o),u.return=a,a.child=u,lo=a,Kr=null)):o=null,o===null)throw sa(a);return a.lanes=536870912,null}return em(a,h)}var k=o.memoizedState;if(k!==null){var P=k.dehydrated;if(vr(a),x)if(a.flags&256)a.flags&=-257,a=tx(o,a,u);else if(a.memoizedState!==null)a.child=o.child,a.flags|=128,a=null;else throw Error(r(558));else if(Oo||Ys(o,a,u,!1),x=(u&o.childLanes)!==0,Oo||x){if(h=ki,h!==null&&(P=or(h,u),P!==0&&P!==k.retryLane))throw k.retryLane=P,Ca(o,P),Da(h,o,P),l1;dm(),a=tx(o,a,u)}else o=k.treeContext,Kr=Ll(P.nextSibling),lo=a,nr=!0,bi=null,ei=!1,o!==null&&Ef(a,o),a=em(a,h),a.flags|=4096;return a}return o=ys(o.child,{mode:h.mode,children:h.children}),o.ref=a.ref,a.child=o,o.return=a,o}function nm(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 c1(o,a,u,h,x){return rl(a),u=z(o,a,u,h,void 0,x),h=Rt(),o!==null&&!Oo?(kt(o,a,x),su(o,a,x)):(nr&&h&&Ou(a),a.flags|=1,Ms(o,a,u,x),a.child)}function ex(o,a,u,h,x,k){return rl(a),a.updateQueue=null,u=jt(a,h,u,x),Nt(o),h=Rt(),o!==null&&!Oo?(kt(o,a,k),su(o,a,k)):(nr&&h&&Ou(a),a.flags|=1,Ms(o,a,u,k),a.child)}function nx(o,a,u,h,x){if(rl(a),a.stateNode===null){var k=so,P=u.contextType;typeof P=="object"&&P!==null&&(k=Zi(P)),k=new u(h,k),a.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=s1,a.stateNode=k,k._reactInternals=a,k=a.stateNode,k.props=h,k.state=a.memoizedState,k.refs={},De(a),P=u.contextType,k.context=typeof P=="object"&&P!==null?Zi(P):so,k.state=a.memoizedState,P=u.getDerivedStateFromProps,typeof P=="function"&&(o1(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&&s1.enqueueReplaceState(k,k.state,null),Ui(a,h,k,x),Jr(),k.state=a.memoizedState),typeof k.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(o===null){k=a.stateNode;var et=a.memoizedProps,Ct=_f(u,et);k.props=Ct;var Gt=k.context,le=u.contextType;P=so,typeof le=="object"&&le!==null&&(P=Zi(le));var pe=u.getDerivedStateFromProps;le=typeof pe=="function"||typeof k.getSnapshotBeforeUpdate=="function",et=a.pendingProps!==et,le||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(et||Gt!==P)&&Hb(a,k,h,P),qe=!1;var Kt=a.memoizedState;k.state=Kt,Ui(a,h,k,x),Jr(),Gt=a.memoizedState,et||Kt!==Gt||qe?(typeof pe=="function"&&(o1(a,u,pe,h),Gt=a.memoizedState),(Ct=qe||Ub(a,u,Ct,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=Ct):(typeof k.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{k=a.stateNode,ni(o,a),P=a.memoizedProps,le=_f(u,P),k.props=le,pe=a.pendingProps,Kt=k.context,Gt=u.contextType,Ct=so,typeof Gt=="object"&&Gt!==null&&(Ct=Zi(Gt)),et=u.getDerivedStateFromProps,(Gt=typeof et=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(P!==pe||Kt!==Ct)&&Hb(a,k,h,Ct),qe=!1,Kt=a.memoizedState,k.state=Kt,Ui(a,h,k,x),Jr();var re=a.memoizedState;P!==pe||Kt!==re||qe||o!==null&&o.dependencies!==null&&eu(o.dependencies)?(typeof et=="function"&&(o1(a,u,et,h),re=a.memoizedState),(le=qe||Ub(a,u,le,h,Kt,re,Ct)||o!==null&&o.dependencies!==null&&eu(o.dependencies))?(Gt||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(h,re,Ct),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(h,re,Ct)),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=re),k.props=h,k.state=re,k.context=Ct,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,nm(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=$r(a,o.child,null,x),a.child=$r(a,null,u,x)):Ms(o,a,u,x),a.memoizedState=k.state,o=a.child):o=su(o,a,x),o}function rx(o,a,u,h){return Cl(),a.flags|=256,Ms(o,a,u,h),a.child}var u1={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function f1(o){return{baseLanes:o,cachePool:yt()}}function d1(o,a,u){return o=o!==null?o.childLanes&~u:0,a&&(o|=al),o}function ix(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:(bn.current&2)!==0),P&&(x=!0,a.flags&=-129),P=(a.flags&32)!==0,a.flags&=-33,o===null){if(nr){if(x?Pi(a):Si(),(o=Kr)?(o=dv(o,ei),o=o!==null&&o.data!=="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:el!==null?{id:Lo,overflow:ws}:null,retryLane:536870912,hydrationErrors:null},u=Kc(o),u.return=a,a.child=u,lo=a,Kr=null)):o=null,o===null)throw sa(a);return X1(o)?a.lanes=32:a.lanes=536870912,null}var et=h.children;return h=h.fallback,x?(Si(),x=a.mode,et=rm({mode:"hidden",children:et},x),h=tl(h,x,u,null),et.return=a,h.return=a,et.sibling=h,a.child=et,h=a.child,h.memoizedState=f1(u),h.childLanes=d1(o,P,u),a.memoizedState=u1,vh(null,h)):(Pi(a),h1(a,et))}var Ct=o.memoizedState;if(Ct!==null&&(et=Ct.dehydrated,et!==null)){if(k)a.flags&256?(Pi(a),a.flags&=-257,a=p1(o,a,u)):a.memoizedState!==null?(Si(),a.child=o.child,a.flags|=128,a=null):(Si(),et=h.fallback,x=a.mode,h=rm({mode:"visible",children:h.children},x),et=tl(et,x,u,null),et.flags|=2,h.return=a,et.return=a,h.sibling=et,a.child=h,$r(a,o.child,null,u),h=a.child,h.memoizedState=f1(u),h.childLanes=d1(o,P,u),a.memoizedState=u1,a=vh(null,h));else if(Pi(a),X1(et)){if(P=et.nextSibling&&et.nextSibling.dataset,P)var Gt=P.dgst;P=Gt,h=Error(r(419)),h.stack="",h.digest=P,Cc({value:h,source:null,stack:null}),a=p1(o,a,u)}else if(Oo||Ys(o,a,u,!1),P=(u&o.childLanes)!==0,Oo||P){if(P=ki,P!==null&&(h=or(P,u),h!==0&&h!==Ct.retryLane))throw Ct.retryLane=h,Ca(o,h),Da(P,o,h),l1;W1(et)||dm(),a=p1(o,a,u)}else W1(et)?(a.flags|=192,a.child=o.child,a=null):(o=Ct.treeContext,Kr=Ll(et.nextSibling),lo=a,nr=!0,bi=null,ei=!1,o!==null&&Ef(a,o),a=h1(a,h.children),a.flags|=4096);return a}return x?(Si(),et=h.fallback,x=a.mode,Ct=o.child,Gt=Ct.sibling,h=ys(Ct,{mode:"hidden",children:h.children}),h.subtreeFlags=Ct.subtreeFlags&65011712,Gt!==null?et=ys(Gt,et):(et=tl(et,x,u,null),et.flags|=2),et.return=a,h.return=a,h.sibling=et,a.child=h,vh(null,h),h=a.child,et=o.child.memoizedState,et===null?et=f1(u):(x=et.cachePool,x!==null?(Ct=xr._currentValue,x=x.parent!==Ct?{parent:Ct,pool:Ct}:x):x=yt(),et={baseLanes:et.baseLanes|u,cachePool:x}),h.memoizedState=et,h.childLanes=d1(o,P,u),a.memoizedState=u1,vh(o.child,h)):(Pi(a),u=o.child,o=u.sibling,u=ys(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 h1(o,a){return a=rm({mode:"visible",children:a},o.mode),a.return=o,o.child=a}function rm(o,a){return o=xo(22,o,null,a),o.lanes=0,o}function p1(o,a,u){return $r(a,o.child,null,u),o=h1(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function ox(o,a,u){o.lanes|=a;var h=o.alternate;h!==null&&(h.lanes|=a),Tl(o.return,a,u)}function m1(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 sx(o,a,u){var h=a.pendingProps,x=h.revealOrder,k=h.tail;h=h.children;var P=bn.current,et=(P&2)!==0;if(et?(P=P&1|2,a.flags|=128):P&=1,K(bn,P),Ms(o,a,h,u),h=nr?Mc:0,!et&&o!==null&&(o.flags&128)!==0)t:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&ox(o,u,a);else if(o.tag===19)ox(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&&Hi(o)===null&&(x=u),u=u.sibling;u=x,u===null?(x=a.child,a.child=null):(x=u.sibling,u.sibling=null),m1(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&&Hi(o)===null){a.child=x;break}o=x.sibling,x.sibling=u,u=x,x=o}m1(a,!0,u,null,k,h);break;case"together":m1(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function su(o,a,u){if(o!==null&&(a.dependencies=o.dependencies),Bu|=a.lanes,(u&a.childLanes)===0)if(o!==null){if(Ys(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=ys(o,o.pendingProps),a.child=u,u.return=a;o.sibling!==null;)o=o.sibling,u=u.sibling=ys(o,o.pendingProps),u.return=a;u.sibling=null}return a.child}function g1(o,a){return(o.lanes&a)!==0?!0:(o=o.dependencies,!!(o!==null&&eu(o)))}function R6(o,a,u){switch(a.tag){case 3:Ft(a,a.stateNode.containerInfo),ks(a,xr,o.memoizedState.cache),Cl();break;case 27:case 5:Zt(a);break;case 4:Ft(a,a.stateNode.containerInfo);break;case 10:ks(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,vr(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(Pi(a),a.flags|=128,null):(u&a.child.childLanes)!==0?ix(o,a,u):(Pi(a),o=su(o,a,u),o!==null?o.sibling:null);Pi(a);break;case 19:var x=(o.flags&128)!==0;if(h=(u&a.childLanes)!==0,h||(Ys(o,a,u,!1),h=(u&a.childLanes)!==0),x){if(h)return sx(o,a,u);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),K(bn,bn.current),h)break;return null;case 22:return a.lanes=0,Zb(o,a,u,a.pendingProps);case 24:ks(a,xr,o.memoizedState.cache)}return su(o,a,u)}function ax(o,a,u){if(o!==null)if(o.memoizedProps!==a.pendingProps)Oo=!0;else{if(!g1(o,u)&&(a.flags&128)===0)return Oo=!1,R6(o,a,u);Oo=(o.flags&131072)!==0}else Oo=!1,nr&&(a.flags&1048576)!==0&&Cf(a,Mc,a.index);switch(a.lanes=0,a.tag){case 16:t:{var h=a.pendingProps;if(o=Yt(a.elementType),a.type=o,typeof o=="function")Gc(o)?(h=_f(o,h),a.tag=1,a=nx(null,a,o,h,u)):(a.tag=0,a=c1(null,a,o,h,u));else{if(o!=null){var x=o.$$typeof;if(x===$){a.tag=11,a=Gb(null,a,o,h,u);break t}else if(x===wt){a.tag=14,a=Kb(null,a,o,h,u);break t}}throw a=vt(o)||o,Error(r(306,a,""))}}return a;case 0:return c1(o,a,a.type,a.pendingProps,u);case 1:return h=a.type,x=_f(h,a.pendingProps),nx(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,ni(o,a),Ui(a,h,null,u);var P=a.memoizedState;if(h=P.cache,ks(a,xr,h),h!==k.cache&&tc(a,[xr],u,!0),Jr(),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=rx(o,a,h,u);break t}else if(h!==x){x=bs(Error(r(424)),a),Cc(x),a=rx(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,Kr=Ll(o.firstChild),lo=a,nr=!0,bi=null,ei=!0,u=zn(a,null,h,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Cl(),h===x){a=su(o,a,u);break t}Ms(o,a,h,u)}a=a.child}return a;case 26:return nm(o,a),o===null?(u=bv(a.type,null,a.pendingProps,null))?a.memoizedState=u:nr||(u=a.type,o=a.pendingProps,h=xm(xt.current).createElement(u),h[Ar]=a,h[er]=o,Cs(h,u,o),Wr(h),a.stateNode=h):a.memoizedState=bv(a.type,o.memoizedProps,a.pendingProps,o.memoizedState),null;case 27:return Zt(a),o===null&&nr&&(h=a.stateNode=mv(a.type,a.pendingProps,xt.current),lo=a,ei=!0,x=Kr,$u(a.type)?(G1=x,Kr=Ll(h.firstChild)):Kr=x),Ms(o,a,a.pendingProps.children,u),nm(o,a),o===null&&(a.flags|=4194304),a.child;case 5:return o===null&&nr&&((x=h=Kr)&&(h=cE(h,a.type,a.pendingProps,ei),h!==null?(a.stateNode=h,lo=a,Kr=Ll(h.firstChild),ei=!1,x=!0):x=!1),x||sa(a)),Zt(a),x=a.type,k=a.pendingProps,P=o!==null?o.memoizedProps:null,h=k.children,$1(x,k)?h=null:P!==null&&$1(x,P)&&(a.flags|=32),a.memoizedState!==null&&(x=z(o,a,St,null,null,u),Ph._currentValue=x),nm(o,a),Ms(o,a,h,u),a.child;case 6:return o===null&&nr&&((o=u=Kr)&&(u=uE(u,a.pendingProps,ei),u!==null?(a.stateNode=u,lo=a,Kr=null,o=!0):o=!1),o||sa(a)),null;case 13:return ix(o,a,u);case 4:return Ft(a,a.stateNode.containerInfo),h=a.pendingProps,o===null?a.child=$r(a,null,h,u):Ms(o,a,h,u),a.child;case 11:return Gb(o,a,a.type,a.pendingProps,u);case 7:return Ms(o,a,a.pendingProps,u),a.child;case 8:return Ms(o,a,a.pendingProps.children,u),a.child;case 12:return Ms(o,a,a.pendingProps.children,u),a.child;case 10:return h=a.pendingProps,ks(a,a.type,h.value),Ms(o,a,h.children,u),a.child;case 9:return x=a.type._context,h=a.pendingProps.children,rl(a),x=Zi(x),h=h(x),a.flags|=1,Ms(o,a,h,u),a.child;case 14:return Kb(o,a,a.type,a.pendingProps,u);case 15:return Jb(o,a,a.type,a.pendingProps,u);case 19:return sx(o,a,u);case 31:return L6(o,a,u);case 22:return Zb(o,a,u,a.pendingProps);case 24:return rl(a),h=Zi(xr),o===null?(x=rt(),x===null&&(x=ki,k=Nl(),x.pooledCache=k,k.refCount++,k!==null&&(x.pooledCacheLanes|=u),x=k),a.memoizedState={parent:h,cache:x},De(a),ks(a,xr,x)):((o.lanes&u)!==0&&(ni(o,a),Ui(a,null,null,u),Jr()),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),ks(a,xr,h)):(h=k.cache,ks(a,xr,h),h!==x.cache&&tc(a,[xr],u,!0))),Ms(o,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function au(o){o.flags|=4}function y1(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(Ox())o.flags|=8192;else throw Jt=Pt,Vt}else o.flags&=-16777217}function lx(o,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!kv(a))if(Ox())o.flags|=8192;else throw Jt=Pt,Vt}function im(o,a){a!==null&&(o.flags|=4),o.flags&16384&&(a=o.tag!==22?Qt():536870912,o.lanes|=a,Sd|=a)}function wh(o,a){if(!nr)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 ji(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 O6(o,a,u){var h=a.pendingProps;switch(Qc(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ji(a),null;case 1:return ji(a),null;case 3:return u=a.stateNode,h=null,o!==null&&(h=o.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),ts(xr),Lt(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(o===null||o.child===null)&&(vo(a)?au(a):o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Tf())),ji(a),null;case 26:var x=a.type,k=a.memoizedState;return o===null?(au(a),k!==null?(ji(a),lx(a,k)):(ji(a),y1(a,x,null,h,u))):k?k!==o.memoizedState?(au(a),ji(a),lx(a,k)):(ji(a),a.flags&=-16777217):(o=o.memoizedProps,o!==h&&au(a),ji(a),y1(a,x,o,h,u)),null;case 27:if(ve(a),u=xt.current,x=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==h&&au(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return ji(a),null}o=V.current,vo(a)?Pu(a):(o=mv(x,h,u),a.stateNode=o,au(a))}return ji(a),null;case 5:if(ve(a),x=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==h&&au(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return ji(a),null}if(k=V.current,vo(a))Pu(a);else{var P=xm(xt.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[Ar]=a,k[er]=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(Cs(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&&au(a)}}return ji(a),y1(a,a.type,o===null?null:o.memoizedProps,a.pendingProps,u),null;case 6:if(o&&a.stateNode!=null)o.memoizedProps!==h&&au(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(r(166));if(o=xt.current,vo(a)){if(o=a.stateNode,u=a.memoizedProps,h=null,x=lo,x!==null)switch(x.tag){case 27:case 5:h=x.memoizedProps}o[Ar]=a,o=!!(o.nodeValue===u||h!==null&&h.suppressHydrationWarning===!0||iv(o.nodeValue,u)),o||sa(a,!0)}else o=xm(o).createTextNode(h),o[Ar]=a,a.stateNode=o}return ji(a),null;case 31:if(u=a.memoizedState,o===null||o.memoizedState!==null){if(h=vo(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[Ar]=a}else Cl(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;ji(a),o=!1}else u=Tf(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=u),o=!0;if(!o)return a.flags&256?(Cr(a),a):(Cr(a),null);if((a.flags&128)!==0)throw Error(r(558))}return ji(a),null;case 13:if(h=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(x=vo(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[Ar]=a}else Cl(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;ji(a),x=!1}else x=Tf(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(Cr(a),a):(Cr(a),null)}return Cr(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),im(a,a.updateQueue),ji(a),null);case 4:return Lt(),o===null&&B1(a.stateNode.containerInfo),ji(a),null;case 10:return ts(a.type),ji(a),null;case 19:if(_(bn),h=a.memoizedState,h===null)return ji(a),null;if(x=(a.flags&128)!==0,k=h.rendering,k===null)if(x)wh(h,!1);else{if(uo!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(k=Hi(o),k!==null){for(a.flags|=128,wh(h,!1),o=k.updateQueue,a.updateQueue=o,im(a,o),a.subtreeFlags=0,o=u,u=a.child;u!==null;)Sc(u,o),u=u.sibling;return K(bn,bn.current&1|2),nr&&ao(a,h.treeForkCount),a.child}o=o.sibling}h.tail!==null&&cn()>cm&&(a.flags|=128,x=!0,wh(h,!1),a.lanes=4194304)}else{if(!x)if(o=Hi(k),o!==null){if(a.flags|=128,x=!0,o=o.updateQueue,a.updateQueue=o,im(a,o),wh(h,!0),h.tail===null&&h.tailMode==="hidden"&&!k.alternate&&!nr)return ji(a),null}else 2*cn()-h.renderingStartTime>cm&&u!==536870912&&(a.flags|=128,x=!0,wh(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=cn(),o.sibling=null,u=bn.current,K(bn,x?u&1|2:u&1),nr&&ao(a,h.treeForkCount),o):(ji(a),null);case 22:case 23:return Cr(a),to(),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&&(ji(a),a.subtreeFlags&6&&(a.flags|=8192)):ji(a),u=a.updateQueue,u!==null&&im(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&&_(W),null;case 24:return u=null,o!==null&&(u=o.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),ts(xr),ji(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function P6(o,a){switch(Qc(a),a.tag){case 1:return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return ts(xr),Lt(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 26:case 27:case 5:return ve(a),null;case 31:if(a.memoizedState!==null){if(Cr(a),a.alternate===null)throw Error(r(340));Cl()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 13:if(Cr(a),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(r(340));Cl()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return _(bn),null;case 4:return Lt(),null;case 10:return ts(a.type),null;case 22:case 23:return Cr(a),to(),o!==null&&_(W),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 24:return ts(xr),null;case 25:return null;default:return null}}function cx(o,a){switch(Qc(a),a.tag){case 3:ts(xr),Lt();break;case 26:case 27:case 5:ve(a);break;case 4:Lt();break;case 31:a.memoizedState!==null&&Cr(a);break;case 13:Cr(a);break;case 19:_(bn);break;case 10:ts(a.type);break;case 22:case 23:Cr(a),to(),o!==null&&_(W);break;case 24:ts(xr)}}function Sh(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){ii(a,a.return,et)}}function Iu(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 Ct=u,Gt=et;try{Gt()}catch(le){ii(x,Ct,le)}}}h=h.next}while(h!==k)}}catch(le){ii(a,a.return,le)}}function ux(o){var a=o.updateQueue;if(a!==null){var u=o.stateNode;try{Oi(a,u)}catch(h){ii(o,o.return,h)}}}function fx(o,a,u){u.props=_f(o.type,o.memoizedProps),u.state=o.memoizedState;try{u.componentWillUnmount()}catch(h){ii(o,a,h)}}function kh(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){ii(o,a,x)}}function _c(o,a){var u=o.ref,h=o.refCleanup;if(u!==null)if(typeof h=="function")try{h()}catch(x){ii(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){ii(o,a,x)}else u.current=null}function dx(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){ii(o,o.return,x)}}function b1(o,a,u){try{var h=o.stateNode;rE(h,o.type,u,a),h[er]=a}catch(x){ii(o,o.return,x)}}function hx(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&$u(o.type)||o.tag===4}function x1(o){t:for(;;){for(;o.sibling===null;){if(o.return===null||hx(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&&$u(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 v1(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=us));else if(h!==4&&(h===27&&$u(o.type)&&(u=o.stateNode,a=null),o=o.child,o!==null))for(v1(o,a,u),o=o.sibling;o!==null;)v1(o,a,u),o=o.sibling}function om(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&&$u(o.type)&&(u=o.stateNode),o=o.child,o!==null))for(om(o,a,u),o=o.sibling;o!==null;)om(o,a,u),o=o.sibling}function px(o){var a=o.stateNode,u=o.memoizedProps;try{for(var h=o.type,x=a.attributes;x.length;)a.removeAttributeNode(x[0]);Cs(a,h,u),a[Ar]=o,a[er]=u}catch(k){ii(o,o.return,k)}}var lu=!1,Po=!1,w1=!1,mx=typeof WeakSet=="function"?WeakSet:Set,es=null;function j6(o,a){if(o=o.containerInfo,H1=Cm,o=oo(o),Aa(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,Ct=-1,Gt=0,le=0,pe=o,Kt=null;e:for(;;){for(var re;pe!==u||x!==0&&pe.nodeType!==3||(et=P+x),pe!==k||h!==0&&pe.nodeType!==3||(Ct=P+h),pe.nodeType===3&&(P+=pe.nodeValue.length),(re=pe.firstChild)!==null;)Kt=pe,pe=re;for(;;){if(pe===o)break e;if(Kt===u&&++Gt===x&&(et=P),Kt===k&&++le===h&&(Ct=P),(re=pe.nextSibling)!==null)break;pe=Kt,Kt=pe.parentNode}pe=re}u=et===-1||Ct===-1?null:{start:et,end:Ct}}else u=null}u=u||{start:0,end:0}}else u=null;for(q1={focusedElem:o,selectionRange:u},Cm=!1,es=a;es!==null;)if(a=es,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,es=o;else for(;es!==null;){switch(a=es,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 rn=_f(u.type,x);o=h.getSnapshotBeforeUpdate(rn,k),h.__reactInternalSnapshotBeforeUpdate=o}catch(Dn){ii(u,u.return,Dn)}}break;case 3:if((o&1024)!==0){if(o=a.stateNode.containerInfo,u=o.nodeType,u===9)V1(o);else if(u===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":V1(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,es=o;break}es=a.return}}function gx(o,a,u){var h=u.flags;switch(u.tag){case 0:case 11:case 15:uu(o,u),h&4&&Sh(5,u);break;case 1:if(uu(o,u),h&4)if(o=u.stateNode,a===null)try{o.componentDidMount()}catch(P){ii(u,u.return,P)}else{var x=_f(u.type,a.memoizedProps);a=a.memoizedState;try{o.componentDidUpdate(x,a,o.__reactInternalSnapshotBeforeUpdate)}catch(P){ii(u,u.return,P)}}h&64&&ux(u),h&512&&kh(u,u.return);break;case 3:if(uu(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{Oi(o,a)}catch(P){ii(u,u.return,P)}}break;case 27:a===null&&h&4&&px(u);case 26:case 5:uu(o,u),a===null&&h&4&&dx(u),h&512&&kh(u,u.return);break;case 12:uu(o,u);break;case 31:uu(o,u),h&4&&xx(o,u);break;case 13:uu(o,u),h&4&&vx(o,u),h&64&&(o=u.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(u=Y6.bind(null,u),fE(o,u))));break;case 22:if(h=u.memoizedState!==null||lu,!h){a=a!==null&&a.memoizedState!==null||Po,x=lu;var k=Po;lu=h,(Po=a)&&!k?fu(o,u,(u.subtreeFlags&8772)!==0):uu(o,u),lu=x,Po=k}break;case 30:break;default:uu(o,u)}}function yx(o){var a=o.alternate;a!==null&&(o.alternate=null,yx(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&fa(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 $i=null,Ea=!1;function cu(o,a,u){for(u=u.child;u!==null;)bx(o,a,u),u=u.sibling}function bx(o,a,u){if(nn&&typeof nn.onCommitFiberUnmount=="function")try{nn.onCommitFiberUnmount(wn,u)}catch{}switch(u.tag){case 26:Po||_c(u,a),cu(o,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:Po||_c(u,a);var h=$i,x=Ea;$u(u.type)&&($i=u.stateNode,Ea=!1),cu(o,a,u),Lh(u.stateNode),$i=h,Ea=x;break;case 5:Po||_c(u,a);case 6:if(h=$i,x=Ea,$i=null,cu(o,a,u),$i=h,Ea=x,$i!==null)if(Ea)try{($i.nodeType===9?$i.body:$i.nodeName==="HTML"?$i.ownerDocument.body:$i).removeChild(u.stateNode)}catch(k){ii(u,a,k)}else try{$i.removeChild(u.stateNode)}catch(k){ii(u,a,k)}break;case 18:$i!==null&&(Ea?(o=$i,uv(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,u.stateNode),_d(o)):uv($i,u.stateNode));break;case 4:h=$i,x=Ea,$i=u.stateNode.containerInfo,Ea=!0,cu(o,a,u),$i=h,Ea=x;break;case 0:case 11:case 14:case 15:Iu(2,u,a),Po||Iu(4,u,a),cu(o,a,u);break;case 1:Po||(_c(u,a),h=u.stateNode,typeof h.componentWillUnmount=="function"&&fx(u,a,h)),cu(o,a,u);break;case 21:cu(o,a,u);break;case 22:Po=(h=Po)||u.memoizedState!==null,cu(o,a,u),Po=h;break;default:cu(o,a,u)}}function xx(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{_d(o)}catch(u){ii(a,a.return,u)}}}function vx(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{_d(o)}catch(u){ii(a,a.return,u)}}function I6(o){switch(o.tag){case 31:case 13:case 19:var a=o.stateNode;return a===null&&(a=o.stateNode=new mx),a;case 22:return o=o.stateNode,a=o._retryCache,a===null&&(a=o._retryCache=new mx),a;default:throw Error(r(435,o.tag))}}function sm(o,a){var u=I6(o);a.forEach(function(h){if(!u.has(h)){u.add(h);var x=V6.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($u(et.type)){$i=et.stateNode,Ea=!1;break t}break;case 5:$i=et.stateNode,Ea=!1;break t;case 3:case 4:$i=et.stateNode.containerInfo,Ea=!0;break t}et=et.return}if($i===null)throw Error(r(160));bx(k,P,x),$i=null,Ea=!1,k=x.alternate,k!==null&&(k.return=null),x.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)wx(a,o),a=a.sibling}var rc=null;function wx(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&&(Iu(3,o,o.return),Sh(3,o),Iu(5,o,o.return));break;case 1:Ta(a,o),Na(o),h&512&&(Po||u===null||_c(u,u.return)),h&64&&lu&&(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=rc;if(Ta(a,o),Na(o),h&512&&(Po||u===null||_c(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[ea]||k[Ar]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=x.createElement(h),x.head.insertBefore(k,x.querySelector("head > title"))),Cs(k,h,u),k[Ar]=o,Wr(k),h=k;break t;case"link":var P=wv("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),Cs(k,h,u),x.head.appendChild(k);break;case"meta":if(P=wv("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),Cs(k,h,u),x.head.appendChild(k);break;default:throw Error(r(468,h))}k[Ar]=o,Wr(k),h=k}o.stateNode=h}else Sv(x,o.type,o.stateNode);else o.stateNode=vv(x,h,o.memoizedProps);else k!==h?(k===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):k.count--,h===null?Sv(x,o.type,o.stateNode):vv(x,h,o.memoizedProps)):h===null&&o.stateNode!==null&&b1(o,o.memoizedProps,u.memoizedProps)}break;case 27:Ta(a,o),Na(o),h&512&&(Po||u===null||_c(u,u.return)),u!==null&&h&4&&b1(o,o.memoizedProps,u.memoizedProps);break;case 5:if(Ta(a,o),Na(o),h&512&&(Po||u===null||_c(u,u.return)),o.flags&32){x=o.stateNode;try{Xo(x,"")}catch(rn){ii(o,o.return,rn)}}h&4&&o.stateNode!=null&&(x=o.memoizedProps,b1(o,x,u!==null?u.memoizedProps:x)),h&1024&&(w1=!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(rn){ii(o,o.return,rn)}}break;case 3:if(Sm=null,x=rc,rc=vm(a.containerInfo),Ta(a,o),rc=x,Na(o),h&4&&u!==null&&u.memoizedState.isDehydrated)try{_d(a.containerInfo)}catch(rn){ii(o,o.return,rn)}w1&&(w1=!1,Sx(o));break;case 4:h=rc,rc=vm(o.stateNode.containerInfo),Ta(a,o),Na(o),rc=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,sm(o,h)));break;case 13:Ta(a,o),Na(o),o.child.flags&8192&&o.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(lm=cn()),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,sm(o,h)));break;case 22:x=o.memoizedState!==null;var Ct=u!==null&&u.memoizedState!==null,Gt=lu,le=Po;if(lu=Gt||x,Po=le||Ct,Ta(a,o),Po=le,lu=Gt,Na(o),h&8192)t:for(a=o.stateNode,a._visibility=x?a._visibility&-2:a._visibility|1,x&&(u===null||Ct||lu||Po||Df(o)),u=null,a=o;;){if(a.tag===5||a.tag===26){if(u===null){Ct=u=a;try{if(k=Ct.stateNode,x)P=k.style,typeof P.setProperty=="function"?P.setProperty("display","none","important"):P.display="none";else{et=Ct.stateNode;var pe=Ct.memoizedProps.style,Kt=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;et.style.display=Kt==null||typeof Kt=="boolean"?"":(""+Kt).trim()}}catch(rn){ii(Ct,Ct.return,rn)}}}else if(a.tag===6){if(u===null){Ct=a;try{Ct.stateNode.nodeValue=x?"":Ct.memoizedProps}catch(rn){ii(Ct,Ct.return,rn)}}}else if(a.tag===18){if(u===null){Ct=a;try{var re=Ct.stateNode;x?fv(re,!0):fv(Ct.stateNode,!1)}catch(rn){ii(Ct,Ct.return,rn)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===o)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break t;for(;a.sibling===null;){if(a.return===null||a.return===o)break t;u===a&&(u=null),a=a.return}u===a&&(u=null),a.sibling.return=a.return,a=a.sibling}h&4&&(h=o.updateQueue,h!==null&&(u=h.retryQueue,u!==null&&(h.retryQueue=null,sm(o,u))));break;case 19:Ta(a,o),Na(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,sm(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(hx(h)){u=h;break}h=h.return}if(u==null)throw Error(r(160));switch(u.tag){case 27:var x=u.stateNode,k=x1(o);om(o,k,x);break;case 5:var P=u.stateNode;u.flags&32&&(Xo(P,""),u.flags&=-33);var et=x1(o);om(o,et,P);break;case 3:case 4:var Ct=u.stateNode.containerInfo,Gt=x1(o);v1(o,Gt,Ct);break;default:throw Error(r(161))}}catch(le){ii(o,o.return,le)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function Sx(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var a=o;Sx(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),o=o.sibling}}function uu(o,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)gx(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:Iu(4,a,a.return),Df(a);break;case 1:_c(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&fx(a,a.return,u),Df(a);break;case 27:Lh(a.stateNode);case 26:case 5:_c(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 fu(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:fu(x,k,u),Sh(4,k);break;case 1:if(fu(x,k,u),h=k,x=h.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(Gt){ii(h,h.return,Gt)}if(h=k,x=h.updateQueue,x!==null){var et=h.stateNode;try{var Ct=x.shared.hiddenCallbacks;if(Ct!==null)for(x.shared.hiddenCallbacks=null,x=0;x<Ct.length;x++)wo(Ct[x],et)}catch(Gt){ii(h,h.return,Gt)}}u&&P&64&&ux(k),kh(k,k.return);break;case 27:px(k);case 26:case 5:fu(x,k,u),u&&h===null&&P&4&&dx(k),kh(k,k.return);break;case 12:fu(x,k,u);break;case 31:fu(x,k,u),u&&P&4&&xx(x,k);break;case 13:fu(x,k,u),u&&P&4&&vx(x,k);break;case 22:k.memoizedState===null&&fu(x,k,u),kh(k,k.return);break;case 30:break;default:fu(x,k,u)}a=a.sibling}}function S1(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&&Ec(u))}function k1(o,a){o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&Ec(o))}function ic(o,a,u,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)kx(o,a,u,h),a=a.sibling}function kx(o,a,u,h){var x=a.flags;switch(a.tag){case 0:case 11:case 15:ic(o,a,u,h),x&2048&&Sh(9,a);break;case 1:ic(o,a,u,h);break;case 3:ic(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&&Ec(o)));break;case 12:if(x&2048){ic(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(Ct){ii(a,a.return,Ct)}}else ic(o,a,u,h);break;case 31:ic(o,a,u,h);break;case 13:ic(o,a,u,h);break;case 23:break;case 22:k=a.stateNode,P=a.alternate,a.memoizedState!==null?k._visibility&2?ic(o,a,u,h):Ah(o,a):k._visibility&2?ic(o,a,u,h):(k._visibility|=2,xd(o,a,u,h,(a.subtreeFlags&10256)!==0||!1)),x&2048&&S1(P,a);break;case 24:ic(o,a,u,h),x&2048&&k1(a.alternate,a);break;default:ic(o,a,u,h)}}function xd(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,Ct=h,Gt=P.flags;switch(P.tag){case 0:case 11:case 15:xd(k,P,et,Ct,x),Sh(8,P);break;case 23:break;case 22:var le=P.stateNode;P.memoizedState!==null?le._visibility&2?xd(k,P,et,Ct,x):Ah(k,P):(le._visibility|=2,xd(k,P,et,Ct,x)),x&&Gt&2048&&S1(P.alternate,P);break;case 24:xd(k,P,et,Ct,x),x&&Gt&2048&&k1(P.alternate,P);break;default:xd(k,P,et,Ct,x)}a=a.sibling}}function Ah(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:Ah(u,h),x&2048&&S1(h.alternate,h);break;case 24:Ah(u,h),x&2048&&k1(h.alternate,h);break;default:Ah(u,h)}a=a.sibling}}var Mh=8192;function vd(o,a,u){if(o.subtreeFlags&Mh)for(o=o.child;o!==null;)Ax(o,a,u),o=o.sibling}function Ax(o,a,u){switch(o.tag){case 26:vd(o,a,u),o.flags&Mh&&o.memoizedState!==null&&kE(u,rc,o.memoizedState,o.memoizedProps);break;case 5:vd(o,a,u);break;case 3:case 4:var h=rc;rc=vm(o.stateNode.containerInfo),vd(o,a,u),rc=h;break;case 22:o.memoizedState===null&&(h=o.alternate,h!==null&&h.memoizedState!==null?(h=Mh,Mh=16777216,vd(o,a,u),Mh=h):vd(o,a,u));break;default:vd(o,a,u)}}function Mx(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 Ch(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];es=h,Ex(h,o)}Mx(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)Cx(o),o=o.sibling}function Cx(o){switch(o.tag){case 0:case 11:case 15:Ch(o),o.flags&2048&&Iu(9,o,o.return);break;case 3:Ch(o);break;case 12:Ch(o);break;case 22:var a=o.stateNode;o.memoizedState!==null&&a._visibility&2&&(o.return===null||o.return.tag!==13)?(a._visibility&=-3,am(o)):Ch(o);break;default:Ch(o)}}function am(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];es=h,Ex(h,o)}Mx(o)}for(o=o.child;o!==null;){switch(a=o,a.tag){case 0:case 11:case 15:Iu(8,a,a.return),am(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,am(a));break;default:am(a)}o=o.sibling}}function Ex(o,a){for(;es!==null;){var u=es;switch(u.tag){case 0:case 11:case 15:Iu(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:Ec(u.memoizedState.cache)}if(h=u.child,h!==null)h.return=u,es=h;else t:for(u=o;es!==null;){h=es;var x=h.sibling,k=h.return;if(yx(h),h===u){es=null;break t}if(x!==null){x.return=k,es=x;break t}es=k}}}var z6={getCacheForType:function(o){var a=Zi(xr),u=a.data.get(o);return u===void 0&&(u=o(),a.data.set(o,u)),u},cacheSignal:function(){return Zi(xr).controller.signal}},B6=typeof WeakMap=="function"?WeakMap:Map,Vr=0,ki=null,hr=null,wr=0,ri=0,sl=null,zu=!1,wd=!1,A1=!1,du=0,uo=0,Bu=0,Lf=0,M1=0,al=0,Sd=0,Eh=null,_a=null,C1=!1,lm=0,Tx=0,cm=1/0,um=null,Fu=null,$o=0,Uu=null,kd=null,hu=0,E1=0,T1=null,Nx=null,Th=0,N1=null;function ll(){return(Vr&2)!==0&&wr!==0?wr&-wr:gt.T!==null?P1():mi()}function _x(){if(al===0)if((wr&536870912)===0||nr){var o=gr;gr<<=1,(gr&3932160)===0&&(gr=262144),al=o}else al=536870912;return o=vi.current,o!==null&&(o.flags|=32),al}function Da(o,a,u){(o===ki&&(ri===2||ri===9)||o.cancelPendingCommit!==null)&&(Ad(o,0),Hu(o,wr,al,!1)),Me(o,u),((Vr&2)===0||o!==ki)&&(o===ki&&((Vr&2)===0&&(Lf|=u),uo===4&&Hu(o,wr,al,!1)),Dc(o))}function Dx(o,a,u){if((Vr&6)!==0)throw Error(r(327));var h=!u&&(a&127)===0&&(a&o.expiredLanes)===0||ss(o,a),x=h?H6(o,a):D1(o,a,!0),k=h;do{if(x===0){wd&&!h&&Hu(o,a,0,!1);break}else{if(u=o.current.alternate,k&&!F6(u)){x=D1(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=Eh;var Ct=et.current.memoizedState.isDehydrated;if(Ct&&(Ad(et,P).flags|=256),P=D1(et,P,!1),P!==2){if(A1&&!Ct){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){Ad(o,0),Hu(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:Hu(h,a,al,!zu);break t;case 2:_a=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(x=lm+300-cn(),10<x)){if(Hu(h,a,al,!zu),Vn(h,0,!0)!==0)break t;hu=a,h.timeoutHandle=lv(Lx.bind(null,h,u,_a,um,C1,a,al,Lf,Sd,zu,k,"Throttled",-0,0),x);break t}Lx(h,u,_a,um,C1,a,al,Lf,Sd,zu,k,null,-0,0)}}break}while(!0);Dc(o)}function Lx(o,a,u,h,x,k,P,et,Ct,Gt,le,pe,Kt,re){if(o.timeoutHandle=-1,pe=a.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:us},Ax(a,k,pe);var rn=(k&62914560)===k?lm-cn():(k&4194048)===k?Tx-cn():0;if(rn=AE(pe,rn),rn!==null){hu=k,o.cancelPendingCommit=rn(Fx.bind(null,o,a,k,u,h,x,P,et,Ct,le,pe,null,Kt,re)),Hu(o,k,P,!Gt);return}}Fx(o,a,k,u,h,x,P,et,Ct)}function F6(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(!_r(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 Hu(o,a,u,h){a&=~M1,a&=~Lf,o.suspendedLanes|=a,o.pingedLanes&=~a,h&&(o.warmLanes|=a),h=o.expirationTimes;for(var x=a;0<x;){var k=31-Ln(x),P=1<<k;h[k]=-1,x&=~P}u!==0&&Xn(o,u,a)}function fm(){return(Vr&6)===0?(Nh(0),!1):!0}function _1(){if(hr!==null){if(ri===0)var o=hr.return;else o=hr,Ss=El=null,qt(o),he=null,tn=0,o=hr;for(;o!==null;)cx(o.alternate,o),o=o.return;hr=null}}function Ad(o,a){var u=o.timeoutHandle;u!==-1&&(o.timeoutHandle=-1,sE(u)),u=o.cancelPendingCommit,u!==null&&(o.cancelPendingCommit=null,u()),hu=0,_1(),ki=o,hr=u=ys(o.current,null),wr=a,ri=0,sl=null,zu=!1,wd=ss(o,a),A1=!1,Sd=al=M1=Lf=Bu=uo=0,_a=Eh=null,C1=!1,(a&8)!==0&&(a|=a&32);var h=o.entangledLanes;if(h!==0)for(o=o.entanglements,h&=a;0<h;){var x=31-Ln(h),k=1<<x;a|=o[x],h&=~k}return du=a,vc(),u}function Rx(o,a){w=null,gt.H=xh,a===_t||a===pt?(a=ae(),ri=3):a===Vt?(a=ae(),ri=4):ri=a===l1?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,sl=a,hr===null&&(uo=1,tm(o,bs(a,o.current)))}function Ox(){var o=vi.current;return o===null?!0:(wr&4194048)===wr?cr===null:(wr&62914560)===wr||(wr&536870912)!==0?o===cr:!1}function Px(){var o=gt.H;return gt.H=xh,o===null?xh:o}function jx(){var o=gt.A;return gt.A=z6,o}function dm(){uo=4,zu||(wr&4194048)!==wr&&vi.current!==null||(wd=!0),(Bu&134217727)===0&&(Lf&134217727)===0||ki===null||Hu(ki,wr,al,!1)}function D1(o,a,u){var h=Vr;Vr|=2;var x=Px(),k=jx();(ki!==o||wr!==a)&&(um=null,Ad(o,a)),a=!1;var P=uo;t:do try{if(ri!==0&&hr!==null){var et=hr,Ct=sl;switch(ri){case 8:_1(),P=6;break t;case 3:case 2:case 9:case 6:vi.current===null&&(a=!0);var Gt=ri;if(ri=0,sl=null,Md(o,et,Ct,Gt),u&&wd){P=0;break t}break;default:Gt=ri,ri=0,sl=null,Md(o,et,Ct,Gt)}}U6(),P=uo;break}catch(le){Rx(o,le)}while(!0);return a&&o.shellSuspendCounter++,Ss=El=null,Vr=h,gt.H=x,gt.A=k,hr===null&&(ki=null,wr=0,vc()),P}function U6(){for(;hr!==null;)Ix(hr)}function H6(o,a){var u=Vr;Vr|=2;var h=Px(),x=jx();ki!==o||wr!==a?(um=null,cm=cn()+500,Ad(o,a)):wd=ss(o,a);t:do try{if(ri!==0&&hr!==null){a=hr;var k=sl;e:switch(ri){case 1:ri=0,sl=null,Md(o,a,k,1);break;case 2:case 9:if($t(k)){ri=0,sl=null,zx(a);break}a=function(){ri!==2&&ri!==9||ki!==o||(ri=7),Dc(o)},k.then(a,a);break t;case 3:ri=7;break t;case 4:ri=5;break t;case 7:$t(k)?(ri=0,sl=null,zx(a)):(ri=0,sl=null,Md(o,a,k,7));break;case 5:var P=null;switch(hr.tag){case 26:P=hr.memoizedState;case 5:case 27:var et=hr;if(P?kv(P):et.stateNode.complete){ri=0,sl=null;var Ct=et.sibling;if(Ct!==null)hr=Ct;else{var Gt=et.return;Gt!==null?(hr=Gt,hm(Gt)):hr=null}break e}}ri=0,sl=null,Md(o,a,k,5);break;case 6:ri=0,sl=null,Md(o,a,k,6);break;case 8:_1(),uo=6;break t;default:throw Error(r(462))}}q6();break}catch(le){Rx(o,le)}while(!0);return Ss=El=null,gt.H=h,gt.A=x,Vr=u,hr!==null?0:(ki=null,wr=0,vc(),uo)}function q6(){for(;hr!==null&&!_e();)Ix(hr)}function Ix(o){var a=ax(o.alternate,o,du);o.memoizedProps=o.pendingProps,a===null?hm(o):hr=a}function zx(o){var a=o,u=a.alternate;switch(a.tag){case 15:case 0:a=ex(u,a,a.pendingProps,a.type,void 0,wr);break;case 11:a=ex(u,a,a.pendingProps,a.type.render,a.ref,wr);break;case 5:qt(a);default:cx(u,a),a=hr=Sc(a,du),a=ax(u,a,du)}o.memoizedProps=o.pendingProps,a===null?hm(o):hr=a}function Md(o,a,u,h){Ss=El=null,qt(a),he=null,tn=0;var x=a.return;try{if(D6(o,x,a,u,wr)){uo=1,tm(o,bs(u,o.current)),hr=null;return}}catch(k){if(x!==null)throw hr=x,k;uo=1,tm(o,bs(u,o.current)),hr=null;return}a.flags&32768?(nr||h===1?o=!0:wd||(wr&536870912)!==0?o=!1:(zu=o=!0,(h===2||h===9||h===3||h===6)&&(h=vi.current,h!==null&&h.tag===13&&(h.flags|=16384))),Bx(a,o)):hm(a)}function hm(o){var a=o;do{if((a.flags&32768)!==0){Bx(a,zu);return}o=a.return;var u=O6(a.alternate,a,du);if(u!==null){hr=u;return}if(a=a.sibling,a!==null){hr=a;return}hr=a=o}while(a!==null);uo===0&&(uo=5)}function Bx(o,a){do{var u=P6(o.alternate,o);if(u!==null){u.flags&=32767,hr=u;return}if(u=o.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(o=o.sibling,o!==null)){hr=o;return}hr=o=u}while(o!==null);uo=6,hr=null}function Fx(o,a,u,h,x,k,P,et,Ct){o.cancelPendingCommit=null;do pm();while($o!==0);if((Vr&6)!==0)throw Error(r(327));if(a!==null){if(a===o.current)throw Error(r(177));if(k=a.lanes|a.childLanes,k|=Ru,Oe(o,u,k,P,et,Ct),o===ki&&(hr=ki=null,wr=0),kd=a,Uu=o,hu=u,E1=k,T1=x,Nx=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,W6(dn,function(){return Yx(),null})):(o.callbackNode=null,o.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=gt.T,gt.T=null,x=Z.p,Z.p=2,P=Vr,Vr|=4;try{j6(o,a,u)}finally{Vr=P,Z.p=x,gt.T=h}}$o=1,Ux(),Hx(),qx()}}function Ux(){if($o===1){$o=0;var o=Uu,a=kd,u=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||u){u=gt.T,gt.T=null;var h=Z.p;Z.p=2;var x=Vr;Vr|=4;try{wx(a,o);var k=q1,P=oo(o.containerInfo),et=k.focusedElem,Ct=k.selectionRange;if(P!==et&&et&&et.ownerDocument&&Se(et.ownerDocument.documentElement,et)){if(Ct!==null&&Aa(et)){var Gt=Ct.start,le=Ct.end;if(le===void 0&&(le=Gt),"selectionStart"in et)et.selectionStart=Gt,et.selectionEnd=Math.min(le,et.value.length);else{var pe=et.ownerDocument||document,Kt=pe&&pe.defaultView||window;if(Kt.getSelection){var re=Kt.getSelection(),rn=et.textContent.length,Dn=Math.min(Ct.start,rn),di=Ct.end===void 0?Dn:Math.min(Ct.end,rn);!re.extend&&Dn>di&&(P=di,di=Dn,Dn=P);var Ht=Al(et,Dn),Ot=Al(et,di);if(Ht&&Ot&&(re.rangeCount!==1||re.anchorNode!==Ht.node||re.anchorOffset!==Ht.offset||re.focusNode!==Ot.node||re.focusOffset!==Ot.offset)){var Xt=pe.createRange();Xt.setStart(Ht.node,Ht.offset),re.removeAllRanges(),Dn>di?(re.addRange(Xt),re.extend(Ot.node,Ot.offset)):(Xt.setEnd(Ot.node,Ot.offset),re.addRange(Xt))}}}}for(pe=[],re=et;re=re.parentNode;)re.nodeType===1&&pe.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof et.focus=="function"&&et.focus(),et=0;et<pe.length;et++){var ce=pe[et];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Cm=!!H1,q1=H1=null}finally{Vr=x,Z.p=h,gt.T=u}}o.current=a,$o=2}}function Hx(){if($o===2){$o=0;var o=Uu,a=kd,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=gt.T,gt.T=null;var h=Z.p;Z.p=2;var x=Vr;Vr|=4;try{gx(o,a.alternate,a)}finally{Vr=x,Z.p=h,gt.T=u}}$o=3}}function qx(){if($o===4||$o===3){$o=0,Ue();var o=Uu,a=kd,u=hu,h=Nx;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?$o=5:($o=0,kd=Uu=null,$x(o,o.pendingLanes));var x=o.pendingLanes;if(x===0&&(Fu=null),si(u),a=a.stateNode,nn&&typeof nn.onCommitFiberRoot=="function")try{nn.onCommitFiberRoot(wn,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=gt.T,x=Z.p,Z.p=2,gt.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{gt.T=a,Z.p=x}}(hu&3)!==0&&pm(),Dc(o),x=o.pendingLanes,(u&261930)!==0&&(x&42)!==0?o===N1?Th++:(Th=0,N1=o):Th=0,Nh(0)}}function $x(o,a){(o.pooledCacheLanes&=a)===0&&(a=o.pooledCache,a!=null&&(o.pooledCache=null,Ec(a)))}function pm(){return Ux(),Hx(),qx(),Yx()}function Yx(){if($o!==5)return!1;var o=Uu,a=E1;E1=0;var u=si(hu),h=gt.T,x=Z.p;try{Z.p=32>u?32:u,gt.T=null,u=T1,T1=null;var k=Uu,P=hu;if($o=0,kd=Uu=null,hu=0,(Vr&6)!==0)throw Error(r(331));var et=Vr;if(Vr|=4,Cx(k.current),kx(k,k.current,P,u),Vr=et,Nh(0,!1),nn&&typeof nn.onPostCommitFiberRoot=="function")try{nn.onPostCommitFiberRoot(wn,k)}catch{}return!0}finally{Z.p=x,gt.T=h,$x(o,a)}}function Vx(o,a,u){a=bs(u,a),a=a1(o.stateNode,a,2),o=jn(o,a,2),o!==null&&(Me(o,2),Dc(o))}function ii(o,a,u){if(o.tag===3)Vx(o,o,u);else for(;a!==null;){if(a.tag===3){Vx(a,o,u);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Fu===null||!Fu.has(h))){o=bs(u,o),u=Wb(2),h=jn(a,u,2),h!==null&&(Xb(u,h,a,o),Me(h,2),Dc(h));break}}a=a.return}}function L1(o,a,u){var h=o.pingCache;if(h===null){h=o.pingCache=new B6;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)||(A1=!0,x.add(u),o=$6.bind(null,o,a,u),a.then(o,o))}function $6(o,a,u){var h=o.pingCache;h!==null&&h.delete(a),o.pingedLanes|=o.suspendedLanes&u,o.warmLanes&=~u,ki===o&&(wr&u)===u&&(uo===4||uo===3&&(wr&62914560)===wr&&300>cn()-lm?(Vr&2)===0&&Ad(o,0):M1|=u,Sd===wr&&(Sd=0)),Dc(o)}function Wx(o,a){a===0&&(a=Qt()),o=Ca(o,a),o!==null&&(Me(o,a),Dc(o))}function Y6(o){var a=o.memoizedState,u=0;a!==null&&(u=a.retryLane),Wx(o,u)}function V6(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),Wx(o,u)}function W6(o,a){return Te(o,a)}var mm=null,Cd=null,R1=!1,gm=!1,O1=!1,qu=0;function Dc(o){o!==Cd&&o.next===null&&(Cd===null?mm=Cd=o:Cd=Cd.next=o),gm=!0,R1||(R1=!0,G6())}function Nh(o,a){if(!O1&&gm){O1=!0;do for(var u=!1,h=mm;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-Ln(42|o)+1)-1,k&=x&~(P&~et),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(u=!0,Jx(h,k))}else k=wr,k=Vn(h,h===ki?k:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(k&3)===0||ss(h,k)||(u=!0,Jx(h,k));h=h.next}while(u);O1=!1}}function X6(){Xx()}function Xx(){gm=R1=!1;var o=0;qu!==0&&oE()&&(o=qu);for(var a=cn(),u=null,h=mm;h!==null;){var x=h.next,k=Gx(h,a);k===0?(h.next=null,u===null?mm=x:u.next=x,x===null&&(Cd=u)):(u=h,(o!==0||(k&3)!==0)&&(gm=!0)),h=x}$o!==0&&$o!==5||Nh(o),qu!==0&&(qu=0)}function Gx(o,a){for(var u=o.suspendedLanes,h=o.pingedLanes,x=o.expirationTimes,k=o.pendingLanes&-62914561;0<k;){var P=31-Ln(k),et=1<<P,Ct=x[P];Ct===-1?((et&u)===0||(et&h)!==0)&&(x[P]=Ei(et,a)):Ct<=a&&(o.expiredLanes|=et),k&=~et}if(a=ki,u=wr,u=Vn(o,o===a?u:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h=o.callbackNode,u===0||o===a&&(ri===2||ri===9)||o.cancelPendingCommit!==null)return h!==null&&h!==null&&Ne(h),o.callbackNode=null,o.callbackPriority=0;if((u&3)===0||ss(o,u)){if(a=u&-u,a===o.callbackPriority)return a;switch(h!==null&&Ne(h),si(u)){case 2:case 8:u=_n;break;case 32:u=dn;break;case 268435456:u=Xe;break;default:u=dn}return h=Kx.bind(null,o),u=Te(u,h),o.callbackPriority=a,o.callbackNode=u,a}return h!==null&&h!==null&&Ne(h),o.callbackPriority=2,o.callbackNode=null,2}function Kx(o,a){if($o!==0&&$o!==5)return o.callbackNode=null,o.callbackPriority=0,null;var u=o.callbackNode;if(pm()&&o.callbackNode!==u)return null;var h=wr;return h=Vn(o,o===ki?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h===0?null:(Dx(o,h,a),Gx(o,cn()),o.callbackNode!=null&&o.callbackNode===u?Kx.bind(null,o):null)}function Jx(o,a){if(pm())return null;Dx(o,a,!0)}function G6(){aE(function(){(Vr&6)!==0?Te(Fe,X6):Xx()})}function P1(){if(qu===0){var o=m;o===0&&(o=xn,xn<<=1,(xn&261888)===0&&(xn=256)),qu=o}return qu}function Zx(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:No(""+o)}function Qx(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 K6(o,a,u,h,x){if(a==="submit"&&u&&u.stateNode===x){var k=Zx((x[er]||null).action),P=h.submitter;P&&(a=(a=P[er]||null)?Zx(a.formAction):P.getAttribute("formAction"),a!==null&&(k=a,P=null));var et=new Jo("action","action",null,h,x);o.push({event:et,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(qu!==0){var Ct=P?Qx(x,P):new FormData(x);e1(u,{pending:!0,data:Ct,method:x.method,action:k},null,Ct)}}else typeof k=="function"&&(et.preventDefault(),Ct=P?Qx(x,P):new FormData(x),e1(u,{pending:!0,data:Ct,method:x.method,action:k},k,Ct))},currentTarget:x}]})}}for(var j1=0;j1<Ma.length;j1++){var I1=Ma[j1],J6=I1.toLowerCase(),Z6=I1[0].toUpperCase()+I1.slice(1);gs(J6,"on"+Z6)}gs(Ho,"onAnimationEnd"),gs(Qa,"onAnimationIteration"),gs(Jl,"onAnimationStart"),gs("dblclick","onDoubleClick"),gs("focusin","onFocus"),gs("focusout","onBlur"),gs(Yc,"onTransitionRun"),gs(pd,"onTransitionStart"),gs(md,"onTransitionCancel"),gs(Du,"onTransitionEnd"),ha("onMouseEnter",["mouseout","mouseover"]),ha("onMouseLeave",["mouseout","mouseover"]),ha("onPointerEnter",["pointerout","pointerover"]),ha("onPointerLeave",["pointerout","pointerover"]),da("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),da("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),da("onBeforeInput",["compositionend","keypress","textInput","paste"]),da("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),da("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),da("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var _h="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(" "),Q6=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(_h));function tv(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],Ct=et.instance,Gt=et.currentTarget;if(et=et.listener,Ct!==k&&x.isPropagationStopped())break t;k=et,x.currentTarget=Gt;try{k(x)}catch(le){xc(le)}x.currentTarget=null,k=Ct}else for(P=0;P<h.length;P++){if(et=h[P],Ct=et.instance,Gt=et.currentTarget,et=et.listener,Ct!==k&&x.isPropagationStopped())break t;k=et,x.currentTarget=Gt;try{k(x)}catch(le){xc(le)}x.currentTarget=null,k=Ct}}}}function pr(o,a){var u=a[Yo];u===void 0&&(u=a[Yo]=new Set);var h=o+"__bubble";u.has(h)||(ev(a,o,2,!1),u.add(h))}function z1(o,a,u){var h=0;a&&(h|=4),ev(u,o,h,a)}var ym="_reactListening"+Math.random().toString(36).slice(2);function B1(o){if(!o[ym]){o[ym]=!0,dc.forEach(function(u){u!=="selectionchange"&&(Q6.has(u)||z1(u,!1,o),z1(u,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[ym]||(a[ym]=!0,z1("selectionchange",!1,a))}}function ev(o,a,u,h){switch(_v(a)){case 2:var x=EE;break;case 8:x=TE;break;default:x=ty}u=x.bind(null,a,u,o),x=void 0,!Os||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 F1(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 Ct=P.tag;if((Ct===3||Ct===4)&&P.stateNode.containerInfo===x)return;P=P.return}for(;et!==null;){if(P=as(et),P===null)return;if(Ct=P.tag,Ct===5||Ct===6||Ct===26||Ct===27){h=k=P;continue t}et=et.parentNode}}h=h.return}gc(function(){var Gt=k,le=qc(u),pe=[];t:{var Kt=Lu.get(o);if(Kt!==void 0){var re=Jo,rn=o;switch(o){case"keypress":if(_o(u)===0)break t;case"keydown":case"keyup":re=Rn;break;case"focusin":rn="focus",re=Ya;break;case"focusout":rn="blur",re=Ya;break;case"beforeblur":case"afterblur":re=Ya;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":re=$a;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=Us;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=Ni;break;case Ho:case Qa:case Jl:re=xa;break;case Du:re=ci;break;case"scroll":case"scrollend":re=ia;break;case"wheel":re=yi;break;case"copy":case"cut":case"paste":re=M;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=sr;break;case"toggle":case"beforetoggle":re=Hs}var Dn=(a&4)!==0,di=!Dn&&(o==="scroll"||o==="scrollend"),Ht=Dn?Kt!==null?Kt+"Capture":null:Kt;Dn=[];for(var Ot=Gt,Xt;Ot!==null;){var ce=Ot;if(Xt=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||Xt===null||Ht===null||(ce=ya(Ot,Ht),ce!=null&&Dn.push(Dh(Ot,ce,Xt))),di)break;Ot=Ot.return}0<Dn.length&&(Kt=new re(Kt,rn,null,u,le),pe.push({event:Kt,listeners:Dn}))}}if((a&7)===0){t:{if(Kt=o==="mouseover"||o==="pointerover",re=o==="mouseout"||o==="pointerout",Kt&&u!==ga&&(rn=u.relatedTarget||u.fromElement)&&(as(rn)||rn[Ti]))break t;if((re||Kt)&&(Kt=le.window===le?le:(Kt=le.ownerDocument)?Kt.defaultView||Kt.parentWindow:window,re?(rn=u.relatedTarget||u.toElement,re=Gt,rn=rn?as(rn):null,rn!==null&&(di=s(rn),Dn=rn.tag,rn!==di||Dn!==5&&Dn!==27&&Dn!==6)&&(rn=null)):(re=null,rn=Gt),re!==rn)){if(Dn=$a,ce="onMouseLeave",Ht="onMouseEnter",Ot="mouse",(o==="pointerout"||o==="pointerover")&&(Dn=sr,ce="onPointerLeave",Ht="onPointerEnter",Ot="pointer"),di=re==null?Kt:gl(re),Xt=rn==null?Kt:gl(rn),Kt=new Dn(ce,Ot+"leave",re,u,le),Kt.target=di,Kt.relatedTarget=Xt,ce=null,as(le)===Gt&&(Dn=new Dn(Ht,Ot+"enter",rn,u,le),Dn.target=Xt,Dn.relatedTarget=di,ce=Dn),di=ce,re&&rn)e:{for(Dn=tE,Ht=re,Ot=rn,Xt=0,ce=Ht;ce;ce=Dn(ce))Xt++;ce=0;for(var An=Ot;An;An=Dn(An))ce++;for(;0<Xt-ce;)Ht=Dn(Ht),Xt--;for(;0<ce-Xt;)Ot=Dn(Ot),ce--;for(;Xt--;){if(Ht===Ot||Ot!==null&&Ht===Ot.alternate){Dn=Ht;break e}Ht=Dn(Ht),Ot=Dn(Ot)}Dn=null}else Dn=null;re!==null&&nv(pe,Kt,re,Dn,!1),rn!==null&&di!==null&&nv(pe,di,rn,Dn,!0)}}t:{if(Kt=Gt?gl(Gt):window,re=Kt.nodeName&&Kt.nodeName.toLowerCase(),re==="select"||re==="input"&&Kt.type==="file")var Ur=Sl;else if($c(Kt))if(Ga)Ur=yr;else{Ur=Kl;var un=ka}else re=Kt.nodeName,!re||re.toLowerCase()!=="input"||Kt.type!=="checkbox"&&Kt.type!=="radio"?Gt&&Hc(Gt.elementType)&&(Ur=Sl):Ur=Uo;if(Ur&&(Ur=Ur(o,Gt))){Va(pe,Ur,u,le);break t}un&&un(o,Kt,Gt),o==="focusout"&&Gt&&Kt.type==="number"&&Gt.memoizedProps.value!=null&&ls(Kt,"number",Kt.value)}switch(un=Gt?gl(Gt):window,o){case"focusin":($c(un)||un.contentEditable==="true")&&(ps=un,ms=Gt,qs=null);break;case"focusout":qs=ms=ps=null;break;case"mousedown":Za=!0;break;case"contextmenu":case"mouseup":case"dragend":Za=!1,yo(pe,u,le);break;case"selectionchange":if(Ja)break;case"keydown":case"keyup":yo(pe,u,le)}var Qn;if(ge)t:{switch(o){case"compositionstart":var Sr="onCompositionStart";break t;case"compositionend":Sr="onCompositionEnd";break t;case"compositionupdate":Sr="onCompositionUpdate";break t}Sr=void 0}else ar?Gi(o,u)&&(Sr="onCompositionEnd"):o==="keydown"&&u.keyCode===229&&(Sr="onCompositionStart");Sr&&(Tn&&u.locale!=="ko"&&(ar||Sr!=="onCompositionStart"?Sr==="onCompositionEnd"&&ar&&(Qn=Ha()):(Ps=le,Nr="value"in Ps?Ps.value:Ps.textContent,ar=!0)),un=bm(Gt,Sr),0<un.length&&(Sr=new dt(Sr,o,null,u,le),pe.push({event:Sr,listeners:un}),Qn?Sr.data=Qn:(Qn=vl(u),Qn!==null&&(Sr.data=Qn)))),(Qn=ds?va(o,u):wa(o,u))&&(Sr=bm(Gt,"onBeforeInput"),0<Sr.length&&(un=new dt("onBeforeInput","beforeinput",null,u,le),pe.push({event:un,listeners:Sr}),un.data=Qn)),K6(pe,o,Gt,u,le)}tv(pe,a)})}function Dh(o,a,u){return{instance:o,listener:a,currentTarget:u}}function bm(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=ya(o,u),x!=null&&h.unshift(Dh(o,x,k)),x=ya(o,a),x!=null&&h.push(Dh(o,x,k))),o.tag===3)return h;o=o.return}return[]}function tE(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function nv(o,a,u,h,x){for(var k=a._reactName,P=[];u!==null&&u!==h;){var et=u,Ct=et.alternate,Gt=et.stateNode;if(et=et.tag,Ct!==null&&Ct===h)break;et!==5&&et!==26&&et!==27||Gt===null||(Ct=Gt,x?(Gt=ya(u,k),Gt!=null&&P.unshift(Dh(u,Gt,Ct))):x||(Gt=ya(u,k),Gt!=null&&P.push(Dh(u,Gt,Ct)))),u=u.return}P.length!==0&&o.push({event:a,listeners:P})}var eE=/\r\n?/g,nE=/\u0000|\uFFFD/g;function rv(o){return(typeof o=="string"?o:""+o).replace(eE,`
|
|
9
|
-
`).replace(nE,"")}function iv(o,a){return a=rv(a),rv(o)===a}function fi(o,a,u,h,x,k){switch(u){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||Xo(o,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&Xo(o,""+h);break;case"className":Xi(o,"class",h);break;case"tabIndex":Xi(o,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":Xi(o,u,h);break;case"style":te(o,h,k);break;case"data":if(a!=="object"){Xi(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=No(""+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"&&fi(o,a,"name",x.name,x,null),fi(o,a,"formEncType",x.formEncType,x,null),fi(o,a,"formMethod",x.formMethod,x,null),fi(o,a,"formTarget",x.formTarget,x,null)):(fi(o,a,"encType",x.encType,x,null),fi(o,a,"method",x.method,x,null),fi(o,a,"target",x.target,x,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){o.removeAttribute(u);break}h=No(""+h),o.setAttribute(u,h);break;case"onClick":h!=null&&(o.onclick=us);break;case"onScroll":h!=null&&pr("scroll",o);break;case"onScrollEnd":h!=null&&pr("scrollend",o);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(x.children!=null)throw Error(r(60));o.innerHTML=u}}break;case"multiple":o.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":o.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){o.removeAttribute("xlink:href");break}u=No(""+h),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,""+h):o.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,""):o.removeAttribute(u);break;case"capture":case"download":h===!0?o.setAttribute(u,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,h):o.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?o.setAttribute(u,h):o.removeAttribute(u);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?o.removeAttribute(u):o.setAttribute(u,h);break;case"popover":pr("beforetoggle",o),pr("toggle",o),Wi(o,"popover",h);break;case"xlinkActuate":Vo(o,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":Vo(o,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":Vo(o,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":Vo(o,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":Vo(o,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":Vo(o,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":Vo(o,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":Vo(o,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":Vo(o,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":Wi(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=bl.get(u)||u,Wi(o,u,h))}}function U1(o,a,u,h,x,k){switch(u){case"style":te(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"?Xo(o,h):(typeof h=="number"||typeof h=="bigint")&&Xo(o,""+h);break;case"onScroll":h!=null&&pr("scroll",o);break;case"onScrollEnd":h!=null&&pr("scrollend",o);break;case"onClick":h!=null&&(o.onclick=us);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ls.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[er]||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,""):Wi(o,u,h)}}}function Cs(o,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":pr("error",o),pr("load",o);var h=!1,x=!1,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:fi(o,a,k,P,u,null)}}x&&fi(o,a,"srcSet",u.srcSet,u,null),h&&fi(o,a,"src",u.src,u,null);return;case"input":pr("invalid",o);var et=k=P=x=null,Ct=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":Ct=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:fi(o,a,h,le,u,null)}}Fr(o,k,et,Ct,Gt,P,x,!1);return;case"select":pr("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:fi(o,a,x,et,u,null)}a=k,u=P,o.multiple=!!h,a!=null?Di(o,!!h,a,!1):u!=null&&Di(o,!!h,u,!0);return;case"textarea":pr("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:fi(o,a,P,et,u,null)}Zn(o,h,x,k);return;case"option":for(Ct in u)u.hasOwnProperty(Ct)&&(h=u[Ct],h!=null)&&(Ct==="selected"?o.selected=h&&typeof h!="function"&&typeof h!="symbol":fi(o,a,Ct,h,u,null));return;case"dialog":pr("beforetoggle",o),pr("toggle",o),pr("cancel",o),pr("close",o);break;case"iframe":case"object":pr("load",o);break;case"video":case"audio":for(h=0;h<_h.length;h++)pr(_h[h],o);break;case"image":pr("error",o),pr("load",o);break;case"details":pr("toggle",o);break;case"embed":case"source":case"link":pr("error",o),pr("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Gt in u)if(u.hasOwnProperty(Gt)&&(h=u[Gt],h!=null))switch(Gt){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:fi(o,a,Gt,h,u,null)}return;default:if(Hc(a)){for(le in u)u.hasOwnProperty(le)&&(h=u[le],h!==void 0&&U1(o,a,le,h,u,void 0));return}}for(et in u)u.hasOwnProperty(et)&&(h=u[et],h!=null&&fi(o,a,et,h,u,null))}function rE(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,Ct=null,Gt=null,le=null;for(re in u){var pe=u[re];if(u.hasOwnProperty(re)&&pe!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":Ct=pe;default:h.hasOwnProperty(re)||fi(o,a,re,null,h,pe)}}for(var Kt in h){var re=h[Kt];if(pe=u[Kt],h.hasOwnProperty(Kt)&&(re!=null||pe!=null))switch(Kt){case"type":k=re;break;case"name":x=re;break;case"checked":Gt=re;break;case"defaultChecked":le=re;break;case"value":P=re;break;case"defaultValue":et=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(r(137,a));break;default:re!==pe&&fi(o,a,Kt,re,h,pe)}}Br(o,P,et,Ct,Gt,le,k,x);return;case"select":re=P=et=Kt=null;for(k in u)if(Ct=u[k],u.hasOwnProperty(k)&&Ct!=null)switch(k){case"value":break;case"multiple":re=Ct;default:h.hasOwnProperty(k)||fi(o,a,k,null,h,Ct)}for(x in h)if(k=h[x],Ct=u[x],h.hasOwnProperty(x)&&(k!=null||Ct!=null))switch(x){case"value":Kt=k;break;case"defaultValue":et=k;break;case"multiple":P=k;default:k!==Ct&&fi(o,a,x,k,h,Ct)}a=et,u=P,h=re,Kt!=null?Di(o,!!u,Kt,!1):!!h!=!!u&&(a!=null?Di(o,!!u,a,!0):Di(o,!!u,u?[]:"",!1));return;case"textarea":re=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:fi(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":re=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:x!==k&&fi(o,a,P,x,h,k)}Wo(o,Kt,re);return;case"option":for(var rn in u)Kt=u[rn],u.hasOwnProperty(rn)&&Kt!=null&&!h.hasOwnProperty(rn)&&(rn==="selected"?o.selected=!1:fi(o,a,rn,null,h,Kt));for(Ct in h)Kt=h[Ct],re=u[Ct],h.hasOwnProperty(Ct)&&Kt!==re&&(Kt!=null||re!=null)&&(Ct==="selected"?o.selected=Kt&&typeof Kt!="function"&&typeof Kt!="symbol":fi(o,a,Ct,Kt,h,re));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Dn in u)Kt=u[Dn],u.hasOwnProperty(Dn)&&Kt!=null&&!h.hasOwnProperty(Dn)&&fi(o,a,Dn,null,h,Kt);for(Gt in h)if(Kt=h[Gt],re=u[Gt],h.hasOwnProperty(Gt)&&Kt!==re&&(Kt!=null||re!=null))switch(Gt){case"children":case"dangerouslySetInnerHTML":if(Kt!=null)throw Error(r(137,a));break;default:fi(o,a,Gt,Kt,h,re)}return;default:if(Hc(a)){for(var di in u)Kt=u[di],u.hasOwnProperty(di)&&Kt!==void 0&&!h.hasOwnProperty(di)&&U1(o,a,di,void 0,h,Kt);for(le in h)Kt=h[le],re=u[le],!h.hasOwnProperty(le)||Kt===re||Kt===void 0&&re===void 0||U1(o,a,le,Kt,h,re);return}}for(var Ht in u)Kt=u[Ht],u.hasOwnProperty(Ht)&&Kt!=null&&!h.hasOwnProperty(Ht)&&fi(o,a,Ht,null,h,Kt);for(pe in h)Kt=h[pe],re=u[pe],!h.hasOwnProperty(pe)||Kt===re||Kt==null&&re==null||fi(o,a,pe,Kt,h,re)}function ov(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function iE(){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&&ov(P)){for(P=0,et=x.responseEnd,h+=1;h<u.length;h++){var Ct=u[h],Gt=Ct.startTime;if(Gt>et)break;var le=Ct.transferSize,pe=Ct.initiatorType;le&&ov(pe)&&(Ct=Ct.responseEnd,P+=le*(Ct<et?1:(et-Gt)/(Ct-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 H1=null,q1=null;function xm(o){return o.nodeType===9?o:o.ownerDocument}function sv(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 av(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 $1(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 Y1=null;function oE(){var o=window.event;return o&&o.type==="popstate"?o===Y1?!1:(Y1=o,!0):(Y1=null,!1)}var lv=typeof setTimeout=="function"?setTimeout:void 0,sE=typeof clearTimeout=="function"?clearTimeout:void 0,cv=typeof Promise=="function"?Promise:void 0,aE=typeof queueMicrotask=="function"?queueMicrotask:typeof cv<"u"?function(o){return cv.resolve(null).then(o).catch(lE)}:lv;function lE(o){setTimeout(function(){throw o})}function $u(o){return o==="head"}function uv(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),_d(a);return}h--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")h++;else if(u==="html")Lh(o.ownerDocument.documentElement);else if(u==="head"){u=o.ownerDocument.head,Lh(u);for(var k=u.firstChild;k;){var P=k.nextSibling,et=k.nodeName;k[ea]||et==="SCRIPT"||et==="STYLE"||et==="LINK"&&k.rel.toLowerCase()==="stylesheet"||u.removeChild(k),k=P}}else u==="body"&&Lh(o.ownerDocument.body);u=x}while(u);_d(a)}function fv(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 V1(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":V1(u),fa(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}o.removeChild(u)}}function cE(o,a,u,h){for(;o.nodeType===1;){var x=u;if(o.nodeName.toLowerCase()!==a.toLowerCase()){if(!h&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(h){if(!o[ea])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=Ll(o.nextSibling),o===null)break}return null}function uE(o,a,u){if(a==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!u||(o=Ll(o.nextSibling),o===null))return null;return o}function dv(o,a){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!a||(o=Ll(o.nextSibling),o===null))return null;return o}function W1(o){return o.data==="$?"||o.data==="$~"}function X1(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function fE(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 Ll(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 G1=null;function hv(o){o=o.nextSibling;for(var a=0;o;){if(o.nodeType===8){var u=o.data;if(u==="/$"||u==="/&"){if(a===0)return Ll(o.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}o=o.nextSibling}return null}function pv(o){o=o.previousSibling;for(var a=0;o;){if(o.nodeType===8){var u=o.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(a===0)return o;a--}else u!=="/$"&&u!=="/&"||a++}o=o.previousSibling}return null}function mv(o,a,u){switch(a=xm(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 Lh(o){for(var a=o.attributes;a.length;)o.removeAttributeNode(a[0]);fa(o)}var Rl=new Map,gv=new Set;function vm(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var pu=Z.d;Z.d={f:dE,r:hE,D:pE,C:mE,L:gE,m:yE,X:xE,S:bE,M:vE};function dE(){var o=pu.f(),a=fm();return o||a}function hE(o){var a=Bo(o);a!==null&&a.tag===5&&a.type==="form"?Rb(a):pu.r(o)}var Ed=typeof document>"u"?null:document;function yv(o,a,u){var h=Ed;if(h&&typeof a=="string"&&a){var x=Mr(a);x='link[rel="'+o+'"][href="'+x+'"]',typeof u=="string"&&(x+='[crossorigin="'+u+'"]'),gv.has(x)||(gv.add(x),o={rel:o,crossOrigin:u,href:a},h.querySelector(x)===null&&(a=h.createElement("link"),Cs(a,"link",o),Wr(a),h.head.appendChild(a)))}}function pE(o){pu.D(o),yv("dns-prefetch",o,null)}function mE(o,a){pu.C(o,a),yv("preconnect",o,a)}function gE(o,a,u){pu.L(o,a,u);var h=Ed;if(h&&o&&a){var x='link[rel="preload"][as="'+Mr(a)+'"]';a==="image"&&u&&u.imageSrcSet?(x+='[imagesrcset="'+Mr(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(x+='[imagesizes="'+Mr(u.imageSizes)+'"]')):x+='[href="'+Mr(o)+'"]';var k=x;switch(a){case"style":k=Td(o);break;case"script":k=Nd(o)}Rl.has(k)||(o=g({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:o,as:a},u),Rl.set(k,o),h.querySelector(x)!==null||a==="style"&&h.querySelector(Rh(k))||a==="script"&&h.querySelector(Oh(k))||(a=h.createElement("link"),Cs(a,"link",o),Wr(a),h.head.appendChild(a)))}}function yE(o,a){pu.m(o,a);var u=Ed;if(u&&o){var h=a&&typeof a.as=="string"?a.as:"script",x='link[rel="modulepreload"][as="'+Mr(h)+'"][href="'+Mr(o)+'"]',k=x;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=Nd(o)}if(!Rl.has(k)&&(o=g({rel:"modulepreload",href:o},a),Rl.set(k,o),u.querySelector(x)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Oh(k)))return}h=u.createElement("link"),Cs(h,"link",o),Wr(h),u.head.appendChild(h)}}}function bE(o,a,u){pu.S(o,a,u);var h=Ed;if(h&&o){var x=na(h).hoistableStyles,k=Td(o);a=a||"default";var P=x.get(k);if(!P){var et={loading:0,preload:null};if(P=h.querySelector(Rh(k)))et.loading=5;else{o=g({rel:"stylesheet",href:o,"data-precedence":a},u),(u=Rl.get(k))&&K1(o,u);var Ct=P=h.createElement("link");Wr(Ct),Cs(Ct,"link",o),Ct._p=new Promise(function(Gt,le){Ct.onload=Gt,Ct.onerror=le}),Ct.addEventListener("load",function(){et.loading|=1}),Ct.addEventListener("error",function(){et.loading|=2}),et.loading|=4,wm(P,a,h)}P={type:"stylesheet",instance:P,count:1,state:et},x.set(k,P)}}}function xE(o,a){pu.X(o,a);var u=Ed;if(u&&o){var h=na(u).hoistableScripts,x=Nd(o),k=h.get(x);k||(k=u.querySelector(Oh(x)),k||(o=g({src:o,async:!0},a),(a=Rl.get(x))&&J1(o,a),k=u.createElement("script"),Wr(k),Cs(k,"link",o),u.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},h.set(x,k))}}function vE(o,a){pu.M(o,a);var u=Ed;if(u&&o){var h=na(u).hoistableScripts,x=Nd(o),k=h.get(x);k||(k=u.querySelector(Oh(x)),k||(o=g({src:o,async:!0,type:"module"},a),(a=Rl.get(x))&&J1(o,a),k=u.createElement("script"),Wr(k),Cs(k,"link",o),u.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},h.set(x,k))}}function bv(o,a,u,h){var x=(x=xt.current)?vm(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=Td(u.href),u=na(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=Td(u.href);var k=na(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(Rh(o)))&&!k._p&&(P.instance=k,P.state.loading=5),Rl.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},Rl.set(o,u),k||wE(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=Nd(u),u=na(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 Td(o){return'href="'+Mr(o)+'"'}function Rh(o){return'link[rel="stylesheet"]['+o+"]"}function xv(o){return g({},o,{"data-precedence":o.precedence,precedence:null})}function wE(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}),Cs(a,"link",u),Wr(a),o.head.appendChild(a))}function Nd(o){return'[src="'+Mr(o)+'"]'}function Oh(o){return"script[async]"+o}function vv(o,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var h=o.querySelector('style[data-href~="'+Mr(u.href)+'"]');if(h)return a.instance=h,Wr(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"),Wr(h),Cs(h,"style",x),wm(h,u.precedence,o),a.instance=h;case"stylesheet":x=Td(u.href);var k=o.querySelector(Rh(x));if(k)return a.state.loading|=4,a.instance=k,Wr(k),k;h=xv(u),(x=Rl.get(x))&&K1(h,x),k=(o.ownerDocument||o).createElement("link"),Wr(k);var P=k;return P._p=new Promise(function(et,Ct){P.onload=et,P.onerror=Ct}),Cs(k,"link",h),a.state.loading|=4,wm(k,u.precedence,o),a.instance=k;case"script":return k=Nd(u.src),(x=o.querySelector(Oh(k)))?(a.instance=x,Wr(x),x):(h=u,(x=Rl.get(k))&&(h=g({},u),J1(h,x)),o=o.ownerDocument||o,x=o.createElement("script"),Wr(x),Cs(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,wm(h,u.precedence,o));return a.instance}function wm(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 K1(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.title==null&&(o.title=a.title)}function J1(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.integrity==null&&(o.integrity=a.integrity)}var Sm=null;function wv(o,a,u){if(Sm===null){var h=new Map,x=Sm=new Map;x.set(u,h)}else x=Sm,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[ea]||k[Ar]||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 Sv(o,a,u){o=o.ownerDocument||o,o.head.insertBefore(u,a==="title"?o.querySelector("head > title"):null)}function SE(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 kv(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function kE(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=Td(h.href),k=a.querySelector(Rh(x));if(k){a=k._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(o.count++,o=km.bind(o),a.then(o,o)),u.state.loading|=4,u.instance=k,Wr(k);return}k=a.ownerDocument||a,h=xv(h),(x=Rl.get(x))&&K1(h,x),k=k.createElement("link"),Wr(k);var P=k;P._p=new Promise(function(et,Ct){P.onload=et,P.onerror=Ct}),Cs(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=km.bind(o),a.addEventListener("load",u),a.addEventListener("error",u))}}var Z1=0;function AE(o,a){return o.stylesheets&&o.count===0&&Mm(o,o.stylesheets),0<o.count||0<o.imgCount?function(u){var h=setTimeout(function(){if(o.stylesheets&&Mm(o,o.stylesheets),o.unsuspend){var k=o.unsuspend;o.unsuspend=null,k()}},6e4+a);0<o.imgBytes&&Z1===0&&(Z1=62500*iE());var x=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Mm(o,o.stylesheets),o.unsuspend)){var k=o.unsuspend;o.unsuspend=null,k()}},(o.imgBytes>Z1?50:800)+a);return o.unsuspend=u,function(){o.unsuspend=null,clearTimeout(h),clearTimeout(x)}}:null}function km(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Mm(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Am=null;function Mm(o,a){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Am=new Map,a.forEach(ME,o),Am=null,km.call(o))}function ME(o,a){if(!(a.state.loading&4)){var u=Am.get(o);if(u)var h=u.get(null);else{u=new Map,Am.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=km.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 Ph={$$typeof:H,Provider:null,Consumer:null,_currentValue:lt,_currentValue2:lt,_threadCount:0};function CE(o,a,u,h,x,k,P,et,Ct){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Re(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Re(0),this.hiddenUpdates=Re(null),this.identifierPrefix=h,this.onUncaughtError=x,this.onCaughtError=k,this.onRecoverableError=P,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Ct,this.incompleteTransitions=new Map}function Av(o,a,u,h,x,k,P,et,Ct,Gt,le,pe){return o=new CE(o,a,u,P,Ct,Gt,le,pe,et),a=1,k===!0&&(a|=24),k=xo(3,null,null,a),o.current=k,k.stateNode=o,a=Nl(),a.refCount++,o.pooledCache=a,a.refCount++,k.memoizedState={element:h,isDehydrated:u,cache:a},De(k),o}function Mv(o){return o?(o=so,o):so}function Cv(o,a,u,h,x,k){x=Mv(x),h.context===null?h.context=x:h.pendingContext=x,h=kn(a),h.payload={element:u},k=k===void 0?null:k,k!==null&&(h.callback=k),u=jn(o,h,a),u!==null&&(Da(u,o,a),Dr(u,o,a))}function Ev(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var u=o.retryLane;o.retryLane=u!==0&&u<a?u:a}}function Q1(o,a){Ev(o,a),(o=o.alternate)&&Ev(o,a)}function Tv(o){if(o.tag===13||o.tag===31){var a=Ca(o,67108864);a!==null&&Da(a,o,67108864),Q1(o,67108864)}}function Nv(o){if(o.tag===13||o.tag===31){var a=ll();a=Fn(a);var u=Ca(o,a);u!==null&&Da(u,o,a),Q1(o,a)}}var Cm=!0;function EE(o,a,u,h){var x=gt.T;gt.T=null;var k=Z.p;try{Z.p=2,ty(o,a,u,h)}finally{Z.p=k,gt.T=x}}function TE(o,a,u,h){var x=gt.T;gt.T=null;var k=Z.p;try{Z.p=8,ty(o,a,u,h)}finally{Z.p=k,gt.T=x}}function ty(o,a,u,h){if(Cm){var x=ey(h);if(x===null)F1(o,a,h,Em,u),Dv(o,h);else if(_E(x,o,a,u,h))h.stopPropagation();else if(Dv(o,h),a&4&&-1<NE.indexOf(o)){for(;x!==null;){var k=Bo(x);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var P=Ke(k.pendingLanes);if(P!==0){var et=k;for(et.pendingLanes|=2,et.entangledLanes|=2;P;){var Ct=1<<31-Ln(P);et.entanglements[1]|=Ct,P&=~Ct}Dc(k),(Vr&6)===0&&(cm=cn()+500,Nh(0))}}break;case 31:case 13:et=Ca(k,2),et!==null&&Da(et,k,2),fm(),Q1(k,2)}if(k=ey(h),k===null&&F1(o,a,h,Em,u),k===x)break;x=k}x!==null&&h.stopPropagation()}else F1(o,a,h,null,u)}}function ey(o){return o=qc(o),ny(o)}var Em=null;function ny(o){if(Em=null,o=as(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 Em=o,null}function _v(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(In()){case Fe:return 2;case _n:return 8;case dn:case ze:return 32;case Xe:return 268435456;default:return 32}default:return 32}}var ry=!1,Yu=null,Vu=null,Wu=null,jh=new Map,Ih=new Map,Xu=[],NE="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 Dv(o,a){switch(o){case"focusin":case"focusout":Yu=null;break;case"dragenter":case"dragleave":Vu=null;break;case"mouseover":case"mouseout":Wu=null;break;case"pointerover":case"pointerout":jh.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ih.delete(a.pointerId)}}function zh(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=Bo(a),a!==null&&Tv(a)),o):(o.eventSystemFlags|=h,a=o.targetContainers,x!==null&&a.indexOf(x)===-1&&a.push(x),o)}function _E(o,a,u,h,x){switch(a){case"focusin":return Yu=zh(Yu,o,a,u,h,x),!0;case"dragenter":return Vu=zh(Vu,o,a,u,h,x),!0;case"mouseover":return Wu=zh(Wu,o,a,u,h,x),!0;case"pointerover":var k=x.pointerId;return jh.set(k,zh(jh.get(k)||null,o,a,u,h,x)),!0;case"gotpointercapture":return k=x.pointerId,Ih.set(k,zh(Ih.get(k)||null,o,a,u,h,x)),!0}return!1}function Lv(o){var a=as(o.target);if(a!==null){var u=s(a);if(u!==null){if(a=u.tag,a===13){if(a=l(u),a!==null){o.blockedOn=a,Wt(o.priority,function(){Nv(u)});return}}else if(a===31){if(a=c(u),a!==null){o.blockedOn=a,Wt(o.priority,function(){Nv(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 Tm(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var u=ey(o.nativeEvent);if(u===null){u=o.nativeEvent;var h=new u.constructor(u.type,u);ga=h,u.target.dispatchEvent(h),ga=null}else return a=Bo(u),a!==null&&Tv(a),o.blockedOn=u,!1;a.shift()}return!0}function Rv(o,a,u){Tm(o)&&u.delete(a)}function DE(){ry=!1,Yu!==null&&Tm(Yu)&&(Yu=null),Vu!==null&&Tm(Vu)&&(Vu=null),Wu!==null&&Tm(Wu)&&(Wu=null),jh.forEach(Rv),Ih.forEach(Rv)}function Nm(o,a){o.blockedOn===a&&(o.blockedOn=null,ry||(ry=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,DE)))}var _m=null;function Ov(o){_m!==o&&(_m=o,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){_m===o&&(_m=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(ny(h||u)===null)continue;break}var k=Bo(u);k!==null&&(o.splice(a,3),a-=3,e1(k,{pending:!0,data:x,method:u.method,action:h},h,x))}}))}function _d(o){function a(Ct){return Nm(Ct,o)}Yu!==null&&Nm(Yu,o),Vu!==null&&Nm(Vu,o),Wu!==null&&Nm(Wu,o),jh.forEach(a),Ih.forEach(a);for(var u=0;u<Xu.length;u++){var h=Xu[u];h.blockedOn===o&&(h.blockedOn=null)}for(;0<Xu.length&&(u=Xu[0],u.blockedOn===null);)Lv(u),u.blockedOn===null&&Xu.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[er]||null;if(typeof k=="function")P||Ov(u);else if(P){var et=null;if(k&&k.hasAttribute("formAction")){if(x=k,P=k[er]||null)et=P.formAction;else if(ny(x)!==null)continue}else et=P.action;typeof et=="function"?u[h+1]=et:(u.splice(h,3),h-=3),Ov(u)}}}function Pv(){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 iy(o){this._internalRoot=o}Dm.prototype.render=iy.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(r(409));var u=a.current,h=ll();Cv(u,h,o,a,null,null)},Dm.prototype.unmount=iy.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;Cv(o.current,2,null,o,null,null),fm(),a[Ti]=null}};function Dm(o){this._internalRoot=o}Dm.prototype.unstable_scheduleHydration=function(o){if(o){var a=mi();o={blockedOn:null,target:o,priority:a};for(var u=0;u<Xu.length&&a!==0&&a<Xu[u].priority;u++);Xu.splice(u,0,o),u===0&&Lv(o)}};var jv=t.version;if(jv!=="19.2.4")throw Error(r(527,jv,"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 LE={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:gt,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Lm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Lm.isDisabled&&Lm.supportsFiber)try{wn=Lm.inject(LE),nn=Lm}catch{}}return Fh.createRoot=function(o,a){if(!i(o))throw Error(r(299));var u=!1,h="",x=qb,k=$b,P=Yb;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=Av(o,1,!1,null,null,u,h,null,x,k,P,Pv),o[Ti]=a.current,B1(o),new iy(a)},Fh.hydrateRoot=function(o,a,u){if(!i(o))throw Error(r(299));var h=!1,x="",k=qb,P=$b,et=Yb,Ct=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&&(Ct=u.formState)),a=Av(o,1,!0,a,u??null,h,x,Ct,k,P,et,Pv),a.context=Mv(null),u=a.current,h=ll(),h=Fn(h),x=kn(h),x.callback=null,jn(u,x,h),u=h,a.current.lanes=u,Me(a,u),Dc(a),o[Ti]=a.current,B1(o),new Dm(a)},Fh.version="19.2.4",Fh}var Vv;function UE(){if(Vv)return ay.exports;Vv=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(),ay.exports=FE(),ay.exports}var HE=UE();const Es=[];for(let n=0;n<256;++n)Es.push((n+256).toString(16).slice(1));function qE(n,t=0){return(Es[n[t+0]]+Es[n[t+1]]+Es[n[t+2]]+Es[n[t+3]]+"-"+Es[n[t+4]]+Es[n[t+5]]+"-"+Es[n[t+6]]+Es[n[t+7]]+"-"+Es[n[t+8]]+Es[n[t+9]]+"-"+Es[n[t+10]]+Es[n[t+11]]+Es[n[t+12]]+Es[n[t+13]]+Es[n[t+14]]+Es[n[t+15]]).toLowerCase()}let fy;const $E=new Uint8Array(16);function YE(){if(!fy){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");fy=crypto.getRandomValues.bind(crypto)}return fy($E)}const VE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Wv={randomUUID:VE};function WE(n,t,e){n=n||{};const r=n.random??n.rng?.()??YE();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,qE(r)}function Oa(n,t,e){return Wv.randomUUID&&!n?Wv.randomUUID():WE(n)}const XE="modulepreload",GE=function(n,t){return new URL(n,t).href},Xv={},dy=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=GE(p,r),p in Xv)return;Xv[p]=!0;const g=p.endsWith(".css"),b=g?'[rel="stylesheet"]':"";if(r)for(let A=l.length-1;A>=0;A--){const E=l[A];if(E.href===p&&(!g||E.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${p}"]${b}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":XE,g||(y.as="script"),y.crossOrigin="",y.href=p,f&&y.setAttribute("nonce",f),document.head.appendChild(y),g)return new Promise((A,E)=>{y.addEventListener("load",A),y.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${p}`)))})}))}function s(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return i.then(l=>{for(const c of l||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};function oi(n){"@babel/helpers - typeof";return oi=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},oi(n)}var cc=Uint8Array,dl=Uint16Array,D5=Int32Array,L5=new cc([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]),R5=new cc([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]),Gv=new cc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Gk=function(n,t){for(var e=new dl(31),r=0;r<31;++r)e[r]=t+=1<<n[r-1];for(var i=new D5(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}},Kk=Gk(L5,2),KE=Kk.b,S2=Kk.r;KE[28]=258,S2[258]=28;var JE=Gk(R5,0),Kv=JE.r,k2=new dl(32768);for(var Bi=0;Bi<32768;++Bi){var Ku=(Bi&43690)>>1|(Bi&21845)<<1;Ku=(Ku&52428)>>2|(Ku&13107)<<2,Ku=(Ku&61680)>>4|(Ku&3855)<<4,k2[Bi]=((Ku&65280)>>8|(Ku&255)<<8)>>1}var cp=(function(n,t,e){for(var r=n.length,i=0,s=new dl(t);i<r;++i)n[i]&&++s[n[i]-1];var l=new dl(t);for(i=1;i<t;++i)l[i]=l[i-1]+s[i-1]<<1;var c;if(e){c=new dl(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[k2[g]>>f]=d}else for(c=new dl(r),i=0;i<r;++i)n[i]&&(c[i]=k2[l[n[i]-1]++]>>15-n[i]);return c}),ed=new cc(288);for(var Bi=0;Bi<144;++Bi)ed[Bi]=8;for(var Bi=144;Bi<256;++Bi)ed[Bi]=9;for(var Bi=256;Bi<280;++Bi)ed[Bi]=7;for(var Bi=280;Bi<288;++Bi)ed[Bi]=8;var Tg=new cc(32);for(var Bi=0;Bi<32;++Bi)Tg[Bi]=5;var ZE=cp(ed,9,0),QE=cp(Tg,5,0),Jk=function(n){return(n+7)/8|0},tT=function(n,t,e){return(e==null||e>n.length)&&(e=n.length),new cc(n.subarray(t,e))},mu=function(n,t,e){e<<=t&7;var r=t/8|0;n[r]|=e,n[r+1]|=e>>8},Uh=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},hy=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:Qk,l:0};if(i==1){var l=new cc(e[0].s+1);return l[e[0].s]=1,{t:l,l:1}}e.sort(function(ht,Mt){return ht.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 dl(b+1),A=A2(e[p-1],y,0);if(A>t){var r=0,E=0,L=A-t,R=1<<L;for(s.sort(function(Mt,wt){return y[wt.s]-y[Mt.s]||Mt.f-wt.f});r<i;++r){var q=s[r].s;if(y[q]>t)E+=R-(1<<A-y[q]),y[q]=t;else break}for(E>>=L;E>0;){var H=s[r].s;y[H]<t?E-=1<<t-y[H]++-1:++r}for(;r>=0&&E;--r){var $=s[r].s;y[$]==t&&(--y[$],++E)}A=t}return{t:new cc(y),l:A}},A2=function(n,t,e){return n.s==-1?Math.max(A2(n.l,t,e+1),A2(n.r,t,e+1)):t[n.s]=e},Jv=function(n){for(var t=n.length;t&&!n[--t];);for(var e=new dl(++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}},Hh=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},Zv=function(n,t,e,r,i,s,l,c,f,d,p){mu(t,p++,e),++i[256];for(var g=hy(i,15),b=g.t,y=g.l,A=hy(s,15),E=A.t,L=A.l,R=Jv(b),q=R.c,H=R.n,$=Jv(E),ht=$.c,Mt=$.n,wt=new dl(19),bt=0;bt<q.length;++bt)++wt[q[bt]&31];for(var bt=0;bt<ht.length;++bt)++wt[ht[bt]&31];for(var ot=hy(wt,7),Dt=ot.t,Q=ot.l,at=19;at>4&&!Dt[Gv[at-1]];--at);var G=d+5<<3,vt=Hh(i,ed)+Hh(s,Tg)+l,Tt=Hh(i,b)+Hh(s,E)+l+14+3*at+Hh(wt,Dt)+2*wt[16]+3*wt[17]+7*wt[18];if(f>=0&&G<=vt&&G<=Tt)return Zk(t,p,n.subarray(f,f+d));var gt,Z,lt,Bt;if(mu(t,p,1+(Tt<vt)),p+=2,Tt<vt){gt=cp(b,y,0),Z=b,lt=cp(E,L,0),Bt=E;var ee=cp(Dt,Q,0);mu(t,p,H-257),mu(t,p+5,Mt-1),mu(t,p+10,at-4),p+=14;for(var bt=0;bt<at;++bt)mu(t,p+3*bt,Dt[Gv[bt]]);p+=3*at;for(var J=[q,ht],_=0;_<2;++_)for(var K=J[_],bt=0;bt<K.length;++bt){var V=K[bt]&31;mu(t,p,ee[V]),p+=Dt[V],V>15&&(mu(t,p,K[bt]>>5&127),p+=K[bt]>>12)}}else gt=ZE,Z=ed,lt=QE,Bt=Tg;for(var bt=0;bt<c;++bt){var ut=r[bt];if(ut>255){var V=ut>>18&31;Uh(t,p,gt[V+257]),p+=Z[V+257],V>7&&(mu(t,p,ut>>23&31),p+=L5[V]);var xt=ut&31;Uh(t,p,lt[xt]),p+=Bt[xt],xt>3&&(Uh(t,p,ut>>5&8191),p+=R5[xt])}else Uh(t,p,gt[ut]),p+=Z[ut]}return Uh(t,p,gt[256]),p+Z[256]},eT=new D5([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Qk=new cc(0),nT=function(n,t,e,r,i,s){var l=s.z||n.length,c=new cc(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=eT[t-1],b=g>>13,y=g&8191,A=(1<<e)-1,E=s.p||new dl(32768),L=s.h||new dl(A+1),R=Math.ceil(e/3),q=2*R,H=function(We){return(n[We]^n[We+1]<<R^n[We+2]<<q)&A},$=new D5(25e3),ht=new dl(288),Mt=new dl(32),wt=0,bt=0,ot=s.i||0,Dt=0,Q=s.w||0,at=0;ot+2<l;++ot){var G=H(ot),vt=ot&32767,Tt=L[G];if(E[vt]=Tt,L[G]=vt,Q<=ot){var gt=l-ot;if((wt>7e3||Dt>24576)&&(gt>423||!d)){p=Zv(n,f,0,$,ht,Mt,bt,Dt,at,ot-at,p),Dt=wt=bt=0,at=ot;for(var Z=0;Z<286;++Z)ht[Z]=0;for(var Z=0;Z<30;++Z)Mt[Z]=0}var lt=2,Bt=0,ee=y,J=vt-Tt&32767;if(gt>2&&G==H(ot-J))for(var _=Math.min(b,gt)-1,K=Math.min(32767,ot),V=Math.min(258,gt);J<=K&&--ee&&vt!=Tt;){if(n[ot+lt]==n[ot+lt-J]){for(var ut=0;ut<V&&n[ot+ut]==n[ot+ut-J];++ut);if(ut>lt){if(lt=ut,Bt=J,ut>_)break;for(var xt=Math.min(J,ut-2),At=0,Z=0;Z<xt;++Z){var Ft=ot-J+Z&32767,Lt=E[Ft],Zt=Ft-Lt&32767;Zt>At&&(At=Zt,Tt=Ft)}}}vt=Tt,Tt=E[vt],J+=vt-Tt&32767}if(Bt){$[Dt++]=268435456|S2[lt]<<18|Kv[Bt];var ve=S2[lt]&31,je=Kv[Bt]&31;bt+=L5[ve]+R5[je],++ht[257+ve],++Mt[je],Q=ot+lt,++wt}else $[Dt++]=n[ot],++ht[n[ot]]}}for(ot=Math.max(ot,Q);ot<l;++ot)$[Dt++]=n[ot],++ht[n[ot]];p=Zv(n,f,d,$,ht,Mt,bt,Dt,at,ot-at,p),d||(s.r=p&7|f[p/8|0]<<3,p-=7,s.h=L,s.p=E,s.i=ot,s.w=Q)}else{for(var ot=s.w||0;ot<l+d;ot+=65535){var Pe=ot+65535;Pe>=l&&(f[p/8|0]=d,Pe=l),p=Zk(f,p+1,n.subarray(ot,Pe))}s.i=l}return tT(c,0,r+Jk(p)+i)},t4=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}}},rT=function(n,t,e,r,i){if(!i&&(i={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),l=new cc(s.length+n.length);l.set(s),l.set(n,s.length),n=l,i.w=s.length}return nT(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)},e4=function(n,t,e){for(;e;++t)n[t]=e,e>>>=8},iT=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=t4();i.p(t.dictionary),e4(n,2,i.d())}};function M2(n,t){t||(t={});var e=t4();e.p(n);var r=rT(n,t,t.dictionary?6:2,4);return iT(r,t),e4(r,r.length-4,e.d()),r}var oT=typeof TextDecoder<"u"&&new TextDecoder,sT=0;try{oT.decode(Qk,{stream:!0}),sT=1}catch{}function aT(n){if(Array.isArray(n))return n}function lT(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 Qv(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 cT(n,t){if(n){if(typeof n=="string")return Qv(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)?Qv(n,t):void 0}}function uT(){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 tw(n,t){return aT(n)||lT(n,t)||cT(n,t)||uT()}function ew(n,t="utf8"){return new TextDecoder(t).decode(n)}const fT=new TextEncoder;function dT(n){return fT.encode(n)}const hT=1024*8,pT=(()=>{const n=new Uint8Array(4),t=new Uint32Array(n.buffer);return!((t[0]=1)&n[0])})(),py={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 O5{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(t=hT,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 O5)&&(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=py[e].BYTES_PER_ELEMENT*t,i=this.byteOffset+this.offset,s=this.buffer.slice(i,i+r);if(this.littleEndian===pT&&e!=="uint8"&&e!=="int8"){const c=new Uint8Array(this.buffer.slice(i,i+r));c.reverse();const f=new py[e](c.buffer);return this.offset+=r,f.reverse(),f}const l=new py[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 ew(this.readBytes(t))}decodeText(t=1,e="utf8"){return ew(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(dT(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 hh(n){let t=n.length;for(;--t>=0;)n[t]=0}const mT=3,gT=258,n4=29,yT=256,bT=yT+1+n4,r4=30,xT=512,vT=new Array((bT+2)*2);hh(vT);const wT=new Array(r4*2);hh(wT);const ST=new Array(xT);hh(ST);const kT=new Array(gT-mT+1);hh(kT);const AT=new Array(n4);hh(AT);const MT=new Array(r4);hh(MT);const CT=(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 C2=CT;const ET=()=>{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},TT=new Uint32Array(ET()),NT=(n,t,e,r)=>{const i=TT,s=r+e;n^=-1;for(let l=r;l<s;l++)n=n>>>8^i[(n^t[l])&255];return n^-1};var Lc=NT,E2={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"},i4={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 _T=(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)_T(e,r)&&(n[r]=e[r])}}return n},LT=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},o4={assign:DT,flattenChunks:LT};let s4=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{s4=!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 RT=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 OT=(n,t)=>{if(t<65534&&n.subarray&&s4)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 PT=(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 OT(s,i)},jT=(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},T2={string2buf:RT,buf2string:PT,utf8border:jT};function IT(){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 zT=IT;const Rm=16209,BT=16191;var FT=function(t,e){let r,i,s,l,c,f,d,p,g,b,y,A,E,L,R,q,H,$,ht,Mt,wt,bt,ot,Dt;const Q=t.state;r=t.next_in,ot=t.input,i=r+(t.avail_in-5),s=t.next_out,Dt=t.output,l=s-(e-t.avail_out),c=s+(t.avail_out-257),f=Q.dmax,d=Q.wsize,p=Q.whave,g=Q.wnext,b=Q.window,y=Q.hold,A=Q.bits,E=Q.lencode,L=Q.distcode,R=(1<<Q.lenbits)-1,q=(1<<Q.distbits)-1;t:do{A<15&&(y+=ot[r++]<<A,A+=8,y+=ot[r++]<<A,A+=8),H=E[y&R];e:for(;;){if($=H>>>24,y>>>=$,A-=$,$=H>>>16&255,$===0)Dt[s++]=H&65535;else if($&16){ht=H&65535,$&=15,$&&(A<$&&(y+=ot[r++]<<A,A+=8),ht+=y&(1<<$)-1,y>>>=$,A-=$),A<15&&(y+=ot[r++]<<A,A+=8,y+=ot[r++]<<A,A+=8),H=L[y&q];n:for(;;){if($=H>>>24,y>>>=$,A-=$,$=H>>>16&255,$&16){if(Mt=H&65535,$&=15,A<$&&(y+=ot[r++]<<A,A+=8,A<$&&(y+=ot[r++]<<A,A+=8)),Mt+=y&(1<<$)-1,Mt>f){t.msg="invalid distance too far back",Q.mode=Rm;break t}if(y>>>=$,A-=$,$=s-l,Mt>$){if($=Mt-$,$>p&&Q.sane){t.msg="invalid distance too far back",Q.mode=Rm;break t}if(wt=0,bt=b,g===0){if(wt+=d-$,$<ht){ht-=$;do Dt[s++]=b[wt++];while(--$);wt=s-Mt,bt=Dt}}else if(g<$){if(wt+=d+g-$,$-=g,$<ht){ht-=$;do Dt[s++]=b[wt++];while(--$);if(wt=0,g<ht){$=g,ht-=$;do Dt[s++]=b[wt++];while(--$);wt=s-Mt,bt=Dt}}}else if(wt+=g-$,$<ht){ht-=$;do Dt[s++]=b[wt++];while(--$);wt=s-Mt,bt=Dt}for(;ht>2;)Dt[s++]=bt[wt++],Dt[s++]=bt[wt++],Dt[s++]=bt[wt++],ht-=3;ht&&(Dt[s++]=bt[wt++],ht>1&&(Dt[s++]=bt[wt++]))}else{wt=s-Mt;do Dt[s++]=Dt[wt++],Dt[s++]=Dt[wt++],Dt[s++]=Dt[wt++],ht-=3;while(ht>2);ht&&(Dt[s++]=Dt[wt++],ht>1&&(Dt[s++]=Dt[wt++]))}}else if(($&64)===0){H=L[(H&65535)+(y&(1<<$)-1)];continue n}else{t.msg="invalid distance code",Q.mode=Rm;break t}break}}else if(($&64)===0){H=E[(H&65535)+(y&(1<<$)-1)];continue e}else if($&32){Q.mode=BT;break t}else{t.msg="invalid literal/length code",Q.mode=Rm;break t}break}}while(r<i&&s<c);ht=A>>3,r-=ht,A-=ht<<3,y&=(1<<A)-1,t.next_in=r,t.next_out=s,t.avail_in=r<i?5+(i-r):5-(r-i),t.avail_out=s<c?257+(c-s):257-(s-c),Q.hold=y,Q.bits=A};const Dd=15,nw=852,rw=592,iw=0,my=1,ow=2,UT=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]),HT=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]),qT=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]),$T=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]),YT=(n,t,e,r,i,s,l,c)=>{const f=c.bits;let d=0,p=0,g=0,b=0,y=0,A=0,E=0,L=0,R=0,q=0,H,$,ht,Mt,wt,bt=null,ot;const Dt=new Uint16Array(Dd+1),Q=new Uint16Array(Dd+1);let at=null,G,vt,Tt;for(d=0;d<=Dd;d++)Dt[d]=0;for(p=0;p<r;p++)Dt[t[e+p]]++;for(y=f,b=Dd;b>=1&&Dt[b]===0;b--);if(y>b&&(y=b),b===0)return i[s++]=1<<24|64<<16|0,i[s++]=1<<24|64<<16|0,c.bits=1,0;for(g=1;g<b&&Dt[g]===0;g++);for(y<g&&(y=g),L=1,d=1;d<=Dd;d++)if(L<<=1,L-=Dt[d],L<0)return-1;if(L>0&&(n===iw||b!==1))return-1;for(Q[1]=0,d=1;d<Dd;d++)Q[d+1]=Q[d]+Dt[d];for(p=0;p<r;p++)t[e+p]!==0&&(l[Q[t[e+p]]++]=p);if(n===iw?(bt=at=l,ot=20):n===my?(bt=UT,at=HT,ot=257):(bt=qT,at=$T,ot=0),q=0,p=0,d=g,wt=s,A=y,E=0,ht=-1,R=1<<y,Mt=R-1,n===my&&R>nw||n===ow&&R>rw)return 1;for(;;){G=d-E,l[p]+1<ot?(vt=0,Tt=l[p]):l[p]>=ot?(vt=at[l[p]-ot],Tt=bt[l[p]-ot]):(vt=96,Tt=0),H=1<<d-E,$=1<<A,g=$;do $-=H,i[wt+(q>>E)+$]=G<<24|vt<<16|Tt|0;while($!==0);for(H=1<<d-1;q&H;)H>>=1;if(H!==0?(q&=H-1,q+=H):q=0,p++,--Dt[d]===0){if(d===b)break;d=t[e+l[p]]}if(d>y&&(q&Mt)!==ht){for(E===0&&(E=y),wt+=g,A=d-E,L=1<<A;A+E<b&&(L-=Dt[A+E],!(L<=0));)A++,L<<=1;if(R+=1<<A,n===my&&R>nw||n===ow&&R>rw)return 1;ht=q&Mt,i[ht]=y<<24|A<<16|wt-s|0}}return q!==0&&(i[wt+q]=d-E<<24|64<<16|0),c.bits=y,0};var up=YT;const VT=0,a4=1,l4=2,{Z_FINISH:sw,Z_BLOCK:WT,Z_TREES:Om,Z_OK:nd,Z_STREAM_END:XT,Z_NEED_DICT:GT,Z_STREAM_ERROR:ql,Z_DATA_ERROR:c4,Z_MEM_ERROR:u4,Z_BUF_ERROR:KT,Z_DEFLATED:aw}=i4,O0=16180,lw=16181,cw=16182,uw=16183,fw=16184,dw=16185,hw=16186,pw=16187,mw=16188,gw=16189,Ng=16190,gu=16191,gy=16192,yw=16193,yy=16194,bw=16195,xw=16196,vw=16197,ww=16198,Pm=16199,jm=16200,Sw=16201,kw=16202,Aw=16203,Mw=16204,Cw=16205,by=16206,Ew=16207,Tw=16208,Yi=16209,f4=16210,d4=16211,JT=852,ZT=592,QT=15,tN=QT,Nw=n=>(n>>>24&255)+(n>>>8&65280)+((n&65280)<<8)+((n&255)<<24);function eN(){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 ud=n=>{if(!n)return 1;const t=n.state;return!t||t.strm!==n||t.mode<O0||t.mode>d4?1:0},h4=n=>{if(ud(n))return ql;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=O0,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(JT),t.distcode=t.distdyn=new Int32Array(ZT),t.sane=1,t.back=-1,nd},p4=n=>{if(ud(n))return ql;const t=n.state;return t.wsize=0,t.whave=0,t.wnext=0,h4(n)},m4=(n,t)=>{let e;if(ud(n))return ql;const r=n.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?ql:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=e,r.wbits=t,p4(n))},g4=(n,t)=>{if(!n)return ql;const e=new eN;n.state=e,e.strm=n,e.window=null,e.mode=O0;const r=m4(n,t);return r!==nd&&(n.state=null),r},nN=n=>g4(n,tN);let _w=!0,xy,vy;const rN=n=>{if(_w){xy=new Int32Array(512),vy=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(up(a4,n.lens,0,288,xy,0,n.work,{bits:9}),t=0;t<32;)n.lens[t++]=5;up(l4,n.lens,0,32,vy,0,n.work,{bits:5}),_w=!1}n.lencode=xy,n.lenbits=9,n.distcode=vy,n.distbits=5},y4=(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},iN=(n,t)=>{let e,r,i,s,l,c,f,d,p,g,b,y,A,E,L=0,R,q,H,$,ht,Mt,wt,bt;const ot=new Uint8Array(4);let Dt,Q;const at=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ud(n)||!n.output||!n.input&&n.avail_in!==0)return ql;e=n.state,e.mode===gu&&(e.mode=gy),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=nd;t:for(;;)switch(e.mode){case O0:if(e.wrap===0){e.mode=gy;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,ot[0]=d&255,ot[1]=d>>>8&255,e.check=Lc(e.check,ot,2,0),d=0,p=0,e.mode=lw;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((d&255)<<8)+(d>>8))%31){n.msg="incorrect header check",e.mode=Yi;break}if((d&15)!==aw){n.msg="unknown compression method",e.mode=Yi;break}if(d>>>=4,p-=4,wt=(d&15)+8,e.wbits===0&&(e.wbits=wt),wt>15||wt>e.wbits){n.msg="invalid window size",e.mode=Yi;break}e.dmax=1<<e.wbits,e.flags=0,n.adler=e.check=1,e.mode=d&512?gw:gu,d=0,p=0;break;case lw:for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(e.flags=d,(e.flags&255)!==aw){n.msg="unknown compression method",e.mode=Yi;break}if(e.flags&57344){n.msg="unknown header flags set",e.mode=Yi;break}e.head&&(e.head.text=d>>8&1),e.flags&512&&e.wrap&4&&(ot[0]=d&255,ot[1]=d>>>8&255,e.check=Lc(e.check,ot,2,0)),d=0,p=0,e.mode=cw;case cw: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&&(ot[0]=d&255,ot[1]=d>>>8&255,ot[2]=d>>>16&255,ot[3]=d>>>24&255,e.check=Lc(e.check,ot,4,0)),d=0,p=0,e.mode=uw;case uw: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&&(ot[0]=d&255,ot[1]=d>>>8&255,e.check=Lc(e.check,ot,2,0)),d=0,p=0,e.mode=fw;case fw: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&&(ot[0]=d&255,ot[1]=d>>>8&255,e.check=Lc(e.check,ot,2,0)),d=0,p=0}else e.head&&(e.head.extra=null);e.mode=dw;case dw:if(e.flags&1024&&(y=e.length,y>c&&(y=c),y&&(e.head&&(wt=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),wt)),e.flags&512&&e.wrap&4&&(e.check=Lc(e.check,r,y,s)),c-=y,s+=y,e.length-=y),e.length))break t;e.length=0,e.mode=hw;case hw:if(e.flags&2048){if(c===0)break t;y=0;do wt=r[s+y++],e.head&&wt&&e.length<65536&&(e.head.name+=String.fromCharCode(wt));while(wt&&y<c);if(e.flags&512&&e.wrap&4&&(e.check=Lc(e.check,r,y,s)),c-=y,s+=y,wt)break t}else e.head&&(e.head.name=null);e.length=0,e.mode=pw;case pw:if(e.flags&4096){if(c===0)break t;y=0;do wt=r[s+y++],e.head&&wt&&e.length<65536&&(e.head.comment+=String.fromCharCode(wt));while(wt&&y<c);if(e.flags&512&&e.wrap&4&&(e.check=Lc(e.check,r,y,s)),c-=y,s+=y,wt)break t}else e.head&&(e.head.comment=null);e.mode=mw;case mw: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=Yi;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=gu;break;case gw:for(;p<32;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}n.adler=e.check=Nw(d),d=0,p=0,e.mode=Ng;case Ng: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,GT;n.adler=e.check=1,e.mode=gu;case gu:if(t===WT||t===Om)break t;case gy:if(e.last){d>>>=p&7,p-=p&7,e.mode=by;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=yw;break;case 1:if(rN(e),e.mode=Pm,t===Om){d>>>=2,p-=2;break t}break;case 2:e.mode=xw;break;case 3:n.msg="invalid block type",e.mode=Yi}d>>>=2,p-=2;break;case yw: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=Yi;break}if(e.length=d&65535,d=0,p=0,e.mode=yy,t===Om)break t;case yy:e.mode=bw;case bw: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=gu;break;case xw: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=Yi;break}e.have=0,e.mode=vw;case vw:for(;e.have<e.ncode;){for(;p<3;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}e.lens[at[e.have++]]=d&7,d>>>=3,p-=3}for(;e.have<19;)e.lens[at[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,Dt={bits:e.lenbits},bt=up(VT,e.lens,0,19,e.lencode,0,e.work,Dt),e.lenbits=Dt.bits,bt){n.msg="invalid code lengths set",e.mode=Yi;break}e.have=0,e.mode=ww;case ww:for(;e.have<e.nlen+e.ndist;){for(;L=e.lencode[d&(1<<e.lenbits)-1],R=L>>>24,q=L>>>16&255,H=L&65535,!(R<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(H<16)d>>>=R,p-=R,e.lens[e.have++]=H;else{if(H===16){for(Q=R+2;p<Q;){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=Yi;break}wt=e.lens[e.have-1],y=3+(d&3),d>>>=2,p-=2}else if(H===17){for(Q=R+3;p<Q;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=R,p-=R,wt=0,y=3+(d&7),d>>>=3,p-=3}else{for(Q=R+7;p<Q;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=R,p-=R,wt=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=Yi;break}for(;y--;)e.lens[e.have++]=wt}}if(e.mode===Yi)break;if(e.lens[256]===0){n.msg="invalid code -- missing end-of-block",e.mode=Yi;break}if(e.lenbits=9,Dt={bits:e.lenbits},bt=up(a4,e.lens,0,e.nlen,e.lencode,0,e.work,Dt),e.lenbits=Dt.bits,bt){n.msg="invalid literal/lengths set",e.mode=Yi;break}if(e.distbits=6,e.distcode=e.distdyn,Dt={bits:e.distbits},bt=up(l4,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,Dt),e.distbits=Dt.bits,bt){n.msg="invalid distances set",e.mode=Yi;break}if(e.mode=Pm,t===Om)break t;case Pm:e.mode=jm;case jm: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,FT(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===gu&&(e.back=-1);break}for(e.back=0;L=e.lencode[d&(1<<e.lenbits)-1],R=L>>>24,q=L>>>16&255,H=L&65535,!(R<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(q&&(q&240)===0){for($=R,ht=q,Mt=H;L=e.lencode[Mt+((d&(1<<$+ht)-1)>>$)],R=L>>>24,q=L>>>16&255,H=L&65535,!($+R<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=$,p-=$,e.back+=$}if(d>>>=R,p-=R,e.back+=R,e.length=H,q===0){e.mode=Cw;break}if(q&32){e.back=-1,e.mode=gu;break}if(q&64){n.msg="invalid literal/length code",e.mode=Yi;break}e.extra=q&15,e.mode=Sw;case Sw:if(e.extra){for(Q=e.extra;p<Q;){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=kw;case kw:for(;L=e.distcode[d&(1<<e.distbits)-1],R=L>>>24,q=L>>>16&255,H=L&65535,!(R<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if((q&240)===0){for($=R,ht=q,Mt=H;L=e.distcode[Mt+((d&(1<<$+ht)-1)>>$)],R=L>>>24,q=L>>>16&255,H=L&65535,!($+R<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=$,p-=$,e.back+=$}if(d>>>=R,p-=R,e.back+=R,q&64){n.msg="invalid distance code",e.mode=Yi;break}e.offset=H,e.extra=q&15,e.mode=Aw;case Aw:if(e.extra){for(Q=e.extra;p<Q;){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=Yi;break}e.mode=Mw;case Mw: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=Yi;break}y>e.wnext?(y-=e.wnext,A=e.wsize-y):A=e.wnext-y,y>e.length&&(y=e.length),E=e.window}else E=i,A=l-e.offset,y=e.length;y>f&&(y=f),f-=y,e.length-=y;do i[l++]=E[A++];while(--y);e.length===0&&(e.mode=jm);break;case Cw:if(f===0)break t;i[l++]=e.length,f--,e.mode=jm;break;case by: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?Lc(e.check,i,b,l-b):C2(e.check,i,b,l-b)),b=f,e.wrap&4&&(e.flags?d:Nw(d))!==e.check){n.msg="incorrect data check",e.mode=Yi;break}d=0,p=0}e.mode=Ew;case Ew: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=Yi;break}d=0,p=0}e.mode=Tw;case Tw:bt=XT;break t;case Yi:bt=c4;break t;case f4:return u4;case d4:default:return ql}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<Yi&&(e.mode<by||t!==sw))&&y4(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?Lc(e.check,i,b,n.next_out-b):C2(e.check,i,b,n.next_out-b)),n.data_type=e.bits+(e.last?64:0)+(e.mode===gu?128:0)+(e.mode===Pm||e.mode===yy?256:0),(g===0&&b===0||t===sw)&&bt===nd&&(bt=KT),bt},oN=n=>{if(ud(n))return ql;let t=n.state;return t.window&&(t.window=null),n.state=null,nd},sN=(n,t)=>{if(ud(n))return ql;const e=n.state;return(e.wrap&2)===0?ql:(e.head=t,t.done=!1,nd)},aN=(n,t)=>{const e=t.length;let r,i,s;return ud(n)||(r=n.state,r.wrap!==0&&r.mode!==Ng)?ql:r.mode===Ng&&(i=1,i=C2(i,t,e,0),i!==r.check)?c4:(s=y4(n,t,e,e),s?(r.mode=f4,u4):(r.havedict=1,nd))};var lN=p4,cN=m4,uN=h4,fN=nN,dN=g4,hN=iN,pN=oN,mN=sN,gN=aN,yN="pako inflate (from Nodeca project)",Au={inflateReset:lN,inflateReset2:cN,inflateResetKeep:uN,inflateInit:fN,inflateInit2:dN,inflate:hN,inflateEnd:pN,inflateGetHeader:mN,inflateSetDictionary:gN,inflateInfo:yN};function bN(){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 xN=bN;const b4=Object.prototype.toString,{Z_NO_FLUSH:vN,Z_FINISH:wN,Z_OK:Cp,Z_STREAM_END:wy,Z_NEED_DICT:Sy,Z_STREAM_ERROR:SN,Z_DATA_ERROR:Dw,Z_MEM_ERROR:kN}=i4;function Up(n){this.options=o4.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 zT,this.strm.avail_out=0;let e=Au.inflateInit2(this.strm,t.windowBits);if(e!==Cp)throw new Error(E2[e]);if(this.header=new xN,Au.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=T2.string2buf(t.dictionary):b4.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=Au.inflateSetDictionary(this.strm,t.dictionary),e!==Cp)))throw new Error(E2[e])}Up.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?wN:vN,b4.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=Au.inflate(e,l),s===Sy&&i&&(s=Au.inflateSetDictionary(e,i),s===Cp?s=Au.inflate(e,l):s===Dw&&(s=Sy));e.avail_in>0&&s===wy&&e.state.wrap>0&&n[e.next_in]!==0;)Au.inflateReset(e),s=Au.inflate(e,l);switch(s){case SN:case Dw:case Sy:case kN:return this.onEnd(s),this.ended=!0,!1}if(c=e.avail_out,e.next_out&&(e.avail_out===0||s===wy))if(this.options.to==="string"){let f=T2.utf8border(e.output,e.next_out),d=e.next_out-f,p=T2.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===Cp&&c===0)){if(s===wy)return s=Au.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(e.avail_in===0)break}}return!0};Up.prototype.onData=function(n){this.chunks.push(n)};Up.prototype.onEnd=function(n){n===Cp&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o4.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};function AN(n,t){const e=new Up(t);if(e.push(n),e.err)throw e.msg||E2[e.err];return e.result}var MN=Up,CN=AN,EN={Inflate:MN,inflate:CN};const{Inflate:TN,inflate:NN}=EN;var Lw=TN,_N=NN;const x4=[];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;x4[n]=t}const Rw=4294967295;function DN(n,t,e){let r=n;for(let i=0;i<e;i++)r=x4[(r^t[i])&255]^r>>>8;return r}function LN(n,t){return(DN(Rw,n,t)^Rw)>>>0}function Ow(n,t,e){const r=n.readUint32(),i=LN(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 v4(n,t,e){for(let r=0;r<e;r++)t[r]=n[r]}function w4(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 S4(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 k4(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 A4(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]+RN(t[s-i],e[s],e[s-i])&255}}function RN(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 ON(n,t,e,r,i,s){switch(n){case 0:v4(t,e,i);break;case 1:w4(t,e,i,s);break;case 2:S4(t,e,r,i);break;case 3:k4(t,e,r,i,s);break;case 4:A4(t,e,r,i,s);break;default:throw new Error(`Unsupported filter: ${n}`)}}const PN=new Uint16Array([255]),jN=new Uint8Array(PN.buffer),IN=jN[0]===255;function zN(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 A=b*c,E=new Uint8Array(A);for(let L=0;L<y;L++){const R=t[d++],q=t.subarray(d,d+A);d+=A;const H=new Uint8Array(A);ON(R,q,H,E,A,c),E.set(H);for(let $=0;$<b;$++){const ht=g.x+$*g.xStep,Mt=g.y+L*g.yStep;if(!(ht>=e||Mt>=r))for(let wt=0;wt<c;wt++)f[(Mt*e+ht)*c+wt]=H[$*c+wt]}}}if(s===16){const p=new Uint16Array(f.buffer);if(IN)for(let g=0;g<p.length;g++)p[g]=BN(p[g]);return p}else return f}function BN(n){return(n&255)<<8|n>>8&255}const FN=new Uint16Array([255]),UN=new Uint8Array(FN.buffer),HN=UN[0]===255,qN=new Uint8Array(0);function Pw(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=qN,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:v4(g,b,c);break;case 1:w4(g,b,c,l);break;case 2:S4(g,b,d,c);break;case 3:k4(g,b,d,c,l);break;case 4:A4(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(HN)for(let A=0;A<y.length;A++)y[A]=$N(y[A]);return y}else return f}function $N(n){return(n&255)<<8|n>>8&255}const dg=Uint8Array.of(137,80,78,71,13,10,26,10);function jw(n){if(!YN(n.readBytes(dg.length)))throw new Error("wrong PNG signature")}function YN(n){if(n.length<dg.length)return!1;for(let t=0;t<dg.length;t++)if(n[t]!==dg[t])return!1;return!0}const VN="tEXt",WN=0,M4=new TextDecoder("latin1");function XN(n){if(KN(n),n.length===0||n.length>79)throw new Error("keyword length must be between 1 and 79")}const GN=/^[\u0000-\u00FF]*$/;function KN(n){if(!GN.test(n))throw new Error("invalid latin1 text")}function JN(n,t,e){const r=C4(t);n[r]=ZN(t,e-r.length-1)}function C4(n){for(n.mark();n.readByte()!==WN;);const t=n.offset;n.reset();const e=M4.decode(n.readBytes(t-n.offset-1));return n.skip(1),XN(e),e}function ZN(n,t){return M4.decode(n.readBytes(t))}const cl={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},ky={UNKNOWN:-1,DEFLATE:0},Iw={UNKNOWN:-1,ADAPTIVE:0},Ay={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},Im={NONE:0,BACKGROUND:1,PREVIOUS:2},My={SOURCE:0,OVER:1};class QN extends O5{_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 Lw,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=ky.UNKNOWN,this._filterMethod=Iw.UNKNOWN,this._interlaceMethod=Ay.UNKNOWN,this._colorType=cl.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(jw(this);!this._end;){const t=this.readUint32(),e=this.readChars(4);this.decodeChunk(t,e)}return this.decodeImage(),this._png}decodeApng(){for(jw(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 VN:JN(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?Ow(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?Ow(this,t+4,e):this.skip(4)}decodeIHDR(){const t=this._png;t.width=this.readUint32(),t.height=this.readUint32(),t.depth=t_(this.readUint8());const e=this.readUint8();this._colorType=e;let r;switch(e){case cl.GREYSCALE:r=1;break;case cl.TRUECOLOUR:r=3;break;case cl.INDEXED_COLOUR:r=1;break;case cl.GREYSCALE_ALPHA:r=2;break;case cl.TRUECOLOUR_ALPHA:r=4;break;case cl.UNKNOWN:default:throw new Error(`Unknown color type: ${e}`)}if(this._png.channels=r,this._compressionMethod=this.readUint8(),this._compressionMethod!==ky.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 cl.GREYSCALE:case cl.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 cl.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 cl.UNKNOWN:case cl.GREYSCALE_ALPHA:case cl.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(t){const e=C4(this),r=this.readUint8();if(r!==ky.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${r}`);const i=this.readBytes(t-e.length-2);this._png.iccEmbeddedProfile={name:e,profile:_N(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=Pw({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 Im.NONE:break;case Im.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 Im.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 My.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 My.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!==Iw.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===Ay.NO_INTERLACE)this._png.data=Pw({data:t,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===Ay.ADAM7)this._png.data=zN({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:Im.NONE,blendOp:My.SOURCE,data:t}),this._inflator=new Lw,this._writingDataChunks=!1}}function t_(n){if(n!==1&&n!==2&&n!==4&&n!==8&&n!==16)throw new Error(`invalid bit depth: ${n}`);return n}var zw;(function(n){n[n.UNKNOWN=0]="UNKNOWN",n[n.METRE=1]="METRE"})(zw||(zw={}));function e_(n,t){return new QN(n,t).decode()}var Wn=(function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this})();function Cy(){Wn.console&&typeof Wn.console.log=="function"&&Wn.console.log.apply(Wn.console,arguments)}var Ai={log:Cy,warn:function(n){Wn.console&&(typeof Wn.console.warn=="function"?Wn.console.warn.apply(Wn.console,arguments):Cy.call(null,arguments))},error:function(n){Wn.console&&(typeof Wn.console.error=="function"?Wn.console.error.apply(Wn.console,arguments):Cy(n))}};function Ey(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(){Ai.error("could not download file")},r.send()}function Bw(n){var t=new XMLHttpRequest;t.open("HEAD",n,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function zm(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=Wn.saveAs||((typeof window>"u"?"undefined":oi(window))!=="object"||window!==Wn?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(n,t,e){var r=Wn.URL||Wn.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?Bw(i.href)?Ey(n,t,e):zm(i,i.target="_blank"):zm(i)):(i.href=r.createObjectURL(n),setTimeout(function(){r.revokeObjectURL(i.href)},4e4),setTimeout(function(){zm(i)},0))}:"msSaveOrOpenBlob"in navigator?function(n,t,e){if(t=t||n.name||"download",typeof n=="string")if(Bw(n))Ey(n,t,e);else{var r=document.createElement("a");r.href=n,r.target="_blank",setTimeout(function(){zm(r)})}else navigator.msSaveOrOpenBlob((function(i,s){return s===void 0?s={autoBom:!1}:oi(s)!=="object"&&(Ai.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 Ey(n,t,e);var i=n.type==="application/octet-stream",s=/constructor/i.test(Wn.HTMLElement)||Wn.safari,l=/CriOS\/[\d]+/.test(navigator.userAgent);if((l||i&&s)&&(typeof FileReader>"u"?"undefined":oi(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=Wn.URL||Wn.webkitURL,d=f.createObjectURL(n);r?r.location=d:location.href=d,r=null,setTimeout(function(){f.revokeObjectURL(d)},4e4)}});function E4(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 hg=Wn.atob.bind(Wn),Fw=Wn.btoa.bind(Wn);function Ty(n,t){var e=n[0],r=n[1],i=n[2],s=n[3];e=Ws(e,r,i,s,t[0],7,-680876936),s=Ws(s,e,r,i,t[1],12,-389564586),i=Ws(i,s,e,r,t[2],17,606105819),r=Ws(r,i,s,e,t[3],22,-1044525330),e=Ws(e,r,i,s,t[4],7,-176418897),s=Ws(s,e,r,i,t[5],12,1200080426),i=Ws(i,s,e,r,t[6],17,-1473231341),r=Ws(r,i,s,e,t[7],22,-45705983),e=Ws(e,r,i,s,t[8],7,1770035416),s=Ws(s,e,r,i,t[9],12,-1958414417),i=Ws(i,s,e,r,t[10],17,-42063),r=Ws(r,i,s,e,t[11],22,-1990404162),e=Ws(e,r,i,s,t[12],7,1804603682),s=Ws(s,e,r,i,t[13],12,-40341101),i=Ws(i,s,e,r,t[14],17,-1502002290),e=Xs(e,r=Ws(r,i,s,e,t[15],22,1236535329),i,s,t[1],5,-165796510),s=Xs(s,e,r,i,t[6],9,-1069501632),i=Xs(i,s,e,r,t[11],14,643717713),r=Xs(r,i,s,e,t[0],20,-373897302),e=Xs(e,r,i,s,t[5],5,-701558691),s=Xs(s,e,r,i,t[10],9,38016083),i=Xs(i,s,e,r,t[15],14,-660478335),r=Xs(r,i,s,e,t[4],20,-405537848),e=Xs(e,r,i,s,t[9],5,568446438),s=Xs(s,e,r,i,t[14],9,-1019803690),i=Xs(i,s,e,r,t[3],14,-187363961),r=Xs(r,i,s,e,t[8],20,1163531501),e=Xs(e,r,i,s,t[13],5,-1444681467),s=Xs(s,e,r,i,t[2],9,-51403784),i=Xs(i,s,e,r,t[7],14,1735328473),e=Gs(e,r=Xs(r,i,s,e,t[12],20,-1926607734),i,s,t[5],4,-378558),s=Gs(s,e,r,i,t[8],11,-2022574463),i=Gs(i,s,e,r,t[11],16,1839030562),r=Gs(r,i,s,e,t[14],23,-35309556),e=Gs(e,r,i,s,t[1],4,-1530992060),s=Gs(s,e,r,i,t[4],11,1272893353),i=Gs(i,s,e,r,t[7],16,-155497632),r=Gs(r,i,s,e,t[10],23,-1094730640),e=Gs(e,r,i,s,t[13],4,681279174),s=Gs(s,e,r,i,t[0],11,-358537222),i=Gs(i,s,e,r,t[3],16,-722521979),r=Gs(r,i,s,e,t[6],23,76029189),e=Gs(e,r,i,s,t[9],4,-640364487),s=Gs(s,e,r,i,t[12],11,-421815835),i=Gs(i,s,e,r,t[15],16,530742520),e=Ks(e,r=Gs(r,i,s,e,t[2],23,-995338651),i,s,t[0],6,-198630844),s=Ks(s,e,r,i,t[7],10,1126891415),i=Ks(i,s,e,r,t[14],15,-1416354905),r=Ks(r,i,s,e,t[5],21,-57434055),e=Ks(e,r,i,s,t[12],6,1700485571),s=Ks(s,e,r,i,t[3],10,-1894986606),i=Ks(i,s,e,r,t[10],15,-1051523),r=Ks(r,i,s,e,t[1],21,-2054922799),e=Ks(e,r,i,s,t[8],6,1873313359),s=Ks(s,e,r,i,t[15],10,-30611744),i=Ks(i,s,e,r,t[6],15,-1560198380),r=Ks(r,i,s,e,t[13],21,1309151649),e=Ks(e,r,i,s,t[4],6,-145523070),s=Ks(s,e,r,i,t[11],10,-1120210379),i=Ks(i,s,e,r,t[2],15,718787259),r=Ks(r,i,s,e,t[9],21,-343485551),n[0]=cf(e,n[0]),n[1]=cf(r,n[1]),n[2]=cf(i,n[2]),n[3]=cf(s,n[3])}function P0(n,t,e,r,i,s){return t=cf(cf(t,n),cf(r,s)),cf(t<<i|t>>>32-i,e)}function Ws(n,t,e,r,i,s,l){return P0(t&e|~t&r,n,t,i,s,l)}function Xs(n,t,e,r,i,s,l){return P0(t&r|e&~r,n,t,i,s,l)}function Gs(n,t,e,r,i,s,l){return P0(t^e^r,n,t,i,s,l)}function Ks(n,t,e,r,i,s,l){return P0(e^(t|~r),n,t,i,s,l)}function T4(n){var t,e=n.length,r=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=n.length;t+=64)Ty(r,n_(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(Ty(r,i),t=0;t<16;t++)i[t]=0;return i[14]=8*e,Ty(r,i),r}function n_(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 Uw="0123456789abcdef".split("");function r_(n){for(var t="",e=0;e<4;e++)t+=Uw[n>>8*e+4&15]+Uw[n>>8*e&15];return t}function i_(n){return String.fromCharCode(255&n,(65280&n)>>8,(16711680&n)>>16,(4278190080&n)>>24)}function N2(n){return T4(n).map(i_).join("")}var o_=(function(n){for(var t=0;t<n.length;t++)n[t]=r_(n[t]);return n.join("")})(T4("hello"))!="5d41402abc4b2a76b9719d911017c592";function cf(n,t){if(o_){var e=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(e>>16)<<16|65535&e}return n+t&4294967295}function _2(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,A="";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],A+=String.fromCharCode(t.charCodeAt(f)^l);return A}var Hw={print:4,modify:8,copy:16,"annot-forms":32};function Bd(n,t,e,r){this.v=1,this.r=2;var i=192;n.forEach(function(c){if(Hw.perm!==void 0)throw new Error("Invalid permission: "+c);i+=Hw[c]}),this.padding="(¿N^NuAd\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=N2(s+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(r)).substr(0,5),this.U=_2(this.encryptionKey,this.padding)}function Fd(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 qw(n){if(oi(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){Wn.console&&Ai.error("jsPDF PubSub Error",c.message,c)}l[1]&&i.push(s)}i.length&&i.forEach(this.unsubscribe)}},this.getTopics=function(){return t}}function _g(n){if(!(this instanceof _g))return new _g(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 N4(n,t){this.gState=n,this.matrix=t,this.id="",this.objectNumber=-1}function If(n,t,e,r,i){if(!(this instanceof If))return new If(n,t,e,r,i);this.type=n==="axial"?2:3,this.coords=t,this.colors=e,N4.call(this,r,i)}function Vd(n,t,e,r,i){if(!(this instanceof Vd))return new Vd(n,t,e,r,i);this.boundingBox=n,this.xStep=t,this.yStep=e,this.stream="",this.cloneIndex=0,N4.call(this,r,i)}function pn(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;oi(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=qw;var A="1.3",E=y.__private__.getPdfVersion=function(){return A};y.__private__.setPdfVersion=function(M){A=M};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(M){return L[M]};i=i||"a4";var q="compat",H="advanced",$=q;function ht(){this.saveGraphicsState(),ct(new Me(Xe,0,0,-Xe,0,xa()*Xe).toString()+" cm"),this.setFontSize(this.getFontSize()/Xe),d="n",$=H}function Mt(){this.restoreGraphicsState(),d="S",$=q}var wt=y.__private__.combineFontStyleAndFontWeight=function(M,B){if(M=="bold"&&B=="normal"||M=="bold"&&B==400||M=="normal"&&B=="italic"||M=="bold"&&B=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return B&&(M=B==400||B==="normal"?M==="italic"?"italic":"normal":B!=700&&B!=="bold"||M!=="normal"?(B==700?"bold":B)+""+M:"bold"),M};y.advancedAPI=function(M){var B=$===q;return B&&ht.call(this),typeof M!="function"||(M(this),B&&Mt.call(this)),this},y.compatAPI=function(M){var B=$===H;return B&&Mt.call(this),typeof M!="function"||(M(this),B&&ht.call(this)),this},y.isAdvancedAPI=function(){return $===H};var bt,ot=function(M){if($!==H)throw new Error(M+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},Dt=y.roundToPrecision=y.__private__.roundToPrecision=function(M,B){var dt=t||B;if(isNaN(M)||isNaN(dt))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return M.toFixed(dt).replace(/0+$/,"")};bt=y.hpf=y.__private__.hpf=typeof f=="number"?function(M){if(isNaN(M))throw new Error("Invalid argument passed to jsPDF.hpf");return Dt(M,f)}:f==="smart"?function(M){if(isNaN(M))throw new Error("Invalid argument passed to jsPDF.hpf");return Dt(M,M>-1&&M<1?16:5)}:function(M){if(isNaN(M))throw new Error("Invalid argument passed to jsPDF.hpf");return Dt(M,16)};var Q=y.f2=y.__private__.f2=function(M){if(isNaN(M))throw new Error("Invalid argument passed to jsPDF.f2");return Dt(M,2)},at=y.__private__.f3=function(M){if(isNaN(M))throw new Error("Invalid argument passed to jsPDF.f3");return Dt(M,3)},G=y.scale=y.__private__.scale=function(M){if(isNaN(M))throw new Error("Invalid argument passed to jsPDF.scale");return $===q?M*Xe:$===H?M:void 0},vt=function(M){return G((function(B){return $===q?xa()-B:$===H?B:void 0})(M))};y.__private__.setPrecision=y.setPrecision=function(M){typeof parseInt(M,10)=="number"&&(t=parseInt(M,10))};var Tt,gt="00000000000000000000000000000000",Z=y.__private__.getFileId=function(){return gt},lt=y.__private__.setFileId=function(M){return gt=M!==void 0&&/^[a-fA-F0-9]{32}$/.test(M)?M.toUpperCase():gt.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),p!==null&&(Br=new Bd(p.userPermissions,p.userPassword,p.ownerPassword,gt)),gt};y.setFileId=function(M){return lt(M),this},y.getFileId=function(){return Z()};var Bt=y.__private__.convertDateToPDFDate=function(M){var B=M.getTimezoneOffset(),dt=B<0?"+":"-",Et=Math.floor(Math.abs(B/60)),zt=Math.abs(B%60),se=[dt,V(Et),"'",V(zt),"'"].join("");return["D:",M.getFullYear(),V(M.getMonth()+1),V(M.getDate()),V(M.getHours()),V(M.getMinutes()),V(M.getSeconds()),se].join("")},ee=y.__private__.convertPDFDateToDate=function(M){var B=parseInt(M.substr(2,4),10),dt=parseInt(M.substr(6,2),10)-1,Et=parseInt(M.substr(8,2),10),zt=parseInt(M.substr(10,2),10),se=parseInt(M.substr(12,2),10),me=parseInt(M.substr(14,2),10);return new Date(B,dt,Et,zt,se,me,0)},J=y.__private__.setCreationDate=function(M){var B;if(M===void 0&&(M=new Date),M instanceof Date)B=Bt(M);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(M))throw new Error("Invalid argument passed to jsPDF.setCreationDate");B=M}return Tt=B},_=y.__private__.getCreationDate=function(M){var B=Tt;return M==="jsDate"&&(B=ee(Tt)),B};y.setCreationDate=function(M){return J(M),this},y.getCreationDate=function(M){return _(M)};var K,V=y.__private__.padd2=function(M){return("0"+parseInt(M)).slice(-2)},ut=y.__private__.padd2Hex=function(M){return("00"+(M=M.toString())).substr(M.length)},xt=0,At=[],Ft=[],Lt=0,Zt=[],ve=[],je=!1,Pe=Ft;y.__private__.setCustomOutputDestination=function(M){je=!0,Pe=M};var We=function(M){je||(Pe=M)};y.__private__.resetCustomOutputDestination=function(){je=!1,Pe=Ft};var ct=y.__private__.out=function(M){return M=M.toString(),Lt+=M.length+1,Pe.push(M),Pe},Le=y.__private__.write=function(M){return ct(arguments.length===1?M.toString():Array.prototype.join.call(arguments," "))},Pn=y.__private__.getArrayBuffer=function(M){for(var B=M.length,dt=new ArrayBuffer(B),Et=new Uint8Array(dt);B--;)Et[B]=M.charCodeAt(B);return dt},fe=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];y.__private__.getStandardFonts=function(){return fe};var ye=n.fontSize||16;y.__private__.setFontSize=y.setFontSize=function(M){return ye=$===H?M/Xe:M,this};var Te,Ne=y.__private__.getFontSize=y.getFontSize=function(){return $===q?ye:ye*Xe},_e=n.R2L||!1;y.__private__.setR2L=y.setR2L=function(M){return _e=M,this},y.__private__.getR2L=y.getR2L=function(){return _e};var Ue,cn=y.__private__.setZoomMode=function(M){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(M))Te=M;else if(isNaN(M)){if([void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(M)===-1)throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+M+'" is not recognized.');Te=M}else Te=parseInt(M,10)};y.__private__.getZoomMode=function(){return Te};var In,Fe=y.__private__.setPageMode=function(M){if([void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(M)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+M+'" is not recognized.');Ue=M};y.__private__.getPageMode=function(){return Ue};var _n=y.__private__.setLayoutMode=function(M){if([void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(M)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+M+'" is not recognized.');In=M};y.__private__.getLayoutMode=function(){return In},y.__private__.setDisplayMode=y.setDisplayMode=function(M,B,dt){return cn(M),_n(B),Fe(dt),this};var dn={title:"",subject:"",author:"",keywords:"",creator:""};y.__private__.getDocumentProperty=function(M){if(Object.keys(dn).indexOf(M)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return dn[M]},y.__private__.getDocumentProperties=function(){return dn},y.__private__.setDocumentProperties=y.setProperties=y.setDocumentProperties=function(M){for(var B in dn)dn.hasOwnProperty(B)&&M[B]&&(dn[B]=M[B]);return this},y.__private__.setDocumentProperty=function(M,B){if(Object.keys(dn).indexOf(M)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return dn[M]=B};var ze,Xe,Ie,kr,wn,nn={},ln={},Ln=[],Ze={},ur={},gn={},xn={},gr=null,Mn=0,Ke=[],Vn=new qw(y),ss=n.hotfixes||[],Ei={},Qt={},Re=[],Me=function M(B,dt,Et,zt,se,me){if(!(this instanceof M))return new M(B,dt,Et,zt,se,me);isNaN(B)&&(B=1),isNaN(dt)&&(dt=0),isNaN(Et)&&(Et=0),isNaN(zt)&&(zt=1),isNaN(se)&&(se=0),isNaN(me)&&(me=0),this._matrix=[B,dt,Et,zt,se,me]};Object.defineProperty(Me.prototype,"sx",{get:function(){return this._matrix[0]},set:function(M){this._matrix[0]=M}}),Object.defineProperty(Me.prototype,"shy",{get:function(){return this._matrix[1]},set:function(M){this._matrix[1]=M}}),Object.defineProperty(Me.prototype,"shx",{get:function(){return this._matrix[2]},set:function(M){this._matrix[2]=M}}),Object.defineProperty(Me.prototype,"sy",{get:function(){return this._matrix[3]},set:function(M){this._matrix[3]=M}}),Object.defineProperty(Me.prototype,"tx",{get:function(){return this._matrix[4]},set:function(M){this._matrix[4]=M}}),Object.defineProperty(Me.prototype,"ty",{get:function(){return this._matrix[5]},set:function(M){this._matrix[5]=M}}),Object.defineProperty(Me.prototype,"a",{get:function(){return this._matrix[0]},set:function(M){this._matrix[0]=M}}),Object.defineProperty(Me.prototype,"b",{get:function(){return this._matrix[1]},set:function(M){this._matrix[1]=M}}),Object.defineProperty(Me.prototype,"c",{get:function(){return this._matrix[2]},set:function(M){this._matrix[2]=M}}),Object.defineProperty(Me.prototype,"d",{get:function(){return this._matrix[3]},set:function(M){this._matrix[3]=M}}),Object.defineProperty(Me.prototype,"e",{get:function(){return this._matrix[4]},set:function(M){this._matrix[4]=M}}),Object.defineProperty(Me.prototype,"f",{get:function(){return this._matrix[5]},set:function(M){this._matrix[5]=M}}),Object.defineProperty(Me.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(Me.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(Me.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(Me.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),Me.prototype.join=function(M){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(bt).join(M)},Me.prototype.multiply=function(M){var B=M.sx*this.sx+M.shy*this.shx,dt=M.sx*this.shy+M.shy*this.sy,Et=M.shx*this.sx+M.sy*this.shx,zt=M.shx*this.shy+M.sy*this.sy,se=M.tx*this.sx+M.ty*this.shx+this.tx,me=M.tx*this.shy+M.ty*this.sy+this.ty;return new Me(B,dt,Et,zt,se,me)},Me.prototype.decompose=function(){var M=this.sx,B=this.shy,dt=this.shx,Et=this.sy,zt=this.tx,se=this.ty,me=Math.sqrt(M*M+B*B),Qe=(M/=me)*dt+(B/=me)*Et;dt-=M*Qe,Et-=B*Qe;var on=Math.sqrt(dt*dt+Et*Et);return Qe/=on,M*(Et/=on)<B*(dt/=on)&&(M=-M,B=-B,Qe=-Qe,me=-me),{scale:new Me(me,0,0,on,0,0),translate:new Me(1,0,0,1,zt,se),rotate:new Me(M,B,-B,M,0,0),skew:new Me(1,0,Qe,1,0,0)}},Me.prototype.toString=function(M){return this.join(" ")},Me.prototype.inversed=function(){var M=this.sx,B=this.shy,dt=this.shx,Et=this.sy,zt=this.tx,se=this.ty,me=1/(M*Et-B*dt),Qe=Et*me,on=-B*me,Rn=-dt*me,Un=M*me;return new Me(Qe,on,Rn,Un,-Qe*zt-Rn*se,-on*zt-Un*se)},Me.prototype.applyToPoint=function(M){var B=M.x*this.sx+M.y*this.shx+this.tx,dt=M.x*this.shy+M.y*this.sy+this.ty;return new ia(B,dt)},Me.prototype.applyToRectangle=function(M){var B=this.applyToPoint(M),dt=this.applyToPoint(new ia(M.x+M.w,M.y+M.h));return new ba(B.x,B.y,dt.x-B.x,dt.y-B.y)},Me.prototype.clone=function(){var M=this.sx,B=this.shy,dt=this.shx,Et=this.sy,zt=this.tx,se=this.ty;return new Me(M,B,dt,Et,zt,se)},y.Matrix=Me;var Oe=y.matrixMult=function(M,B){return B.multiply(M)},Xn=new Me(1,0,0,1,0,0);y.unitMatrix=y.identityMatrix=Xn;var Bn=function(M,B){if(!ur[M]){var dt=(B instanceof If?"Sh":"P")+(Object.keys(Ze).length+1).toString(10);B.id=dt,ur[M]=dt,Ze[dt]=B,Vn.publish("addPattern",B)}};y.ShadingPattern=If,y.TilingPattern=Vd,y.addShadingPattern=function(M,B){return ot("addShadingPattern()"),Bn(M,B),this},y.beginTilingPattern=function(M){ot("beginTilingPattern()"),oa(M.boundingBox[0],M.boundingBox[1],M.boundingBox[2]-M.boundingBox[0],M.boundingBox[3]-M.boundingBox[1],M.matrix)},y.endTilingPattern=function(M,B){ot("endTilingPattern()"),B.stream=ve[K].join(`
|
|
11
|
-
`),Bn(M,B),Vn.publish("endTilingPattern",B),Re.pop().restore()};var or,Fn=y.__private__.newObject=function(){var M=si();return mi(M,!0),M},si=y.__private__.newObjectDeferred=function(){return xt++,At[xt]=function(){return Lt},xt},mi=function(M,B){return B=typeof B=="boolean"&&B,At[M]=Lt,B&&ct(M+" 0 obj"),M},Wt=y.__private__.newAdditionalObject=function(){var M={objId:si(),content:""};return Zt.push(M),M},ai=si(),Ar=si(),er=y.__private__.decodeColorString=function(M){var B=M.split(" ");if(B.length!==2||B[1]!=="g"&&B[1]!=="G")B.length!==5||B[4]!=="k"&&B[4]!=="K"||(B=[(1-B[0])*(1-B[3]),(1-B[1])*(1-B[3]),(1-B[2])*(1-B[3]),"r"]);else{var dt=parseFloat(B[0]);B=[dt,dt,dt,"r"]}for(var Et="#",zt=0;zt<3;zt++)Et+=("0"+Math.floor(255*parseFloat(B[zt])).toString(16)).slice(-2);return Et},Ti=y.__private__.encodeColorString=function(M){var B;typeof M=="string"&&(M={ch1:M});var dt=M.ch1,Et=M.ch2,zt=M.ch3,se=M.ch4,me=M.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof dt=="string"&&dt.charAt(0)!=="#"){var Qe=new E4(dt);if(Qe.ok)dt=Qe.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 on=parseInt(dt.substr(1),16);dt=on>>16&255,Et=on>>8&255,zt=255&on}if(Et===void 0||se===void 0&&dt===Et&&Et===zt)B=typeof dt=="string"?dt+" "+me[0]:M.precision===2?Q(dt/255)+" "+me[0]:at(dt/255)+" "+me[0];else if(se===void 0||oi(se)==="object"){if(se&&!isNaN(se.a)&&se.a===0)return["1.","1.","1.",me[1]].join(" ");B=typeof dt=="string"?[dt,Et,zt,me[1]].join(" "):M.precision===2?[Q(dt/255),Q(Et/255),Q(zt/255),me[1]].join(" "):[at(dt/255),at(Et/255),at(zt/255),me[1]].join(" ")}else B=typeof dt=="string"?[dt,Et,zt,se,me[2]].join(" "):M.precision===2?[Q(dt),Q(Et),Q(zt),Q(se),me[2]].join(" "):[at(dt),at(Et),at(zt),at(se),me[2]].join(" ");return B},Yo=y.__private__.getFilters=function(){return l},li=y.__private__.putStream=function(M){var B=(M=M||{}).data||"",dt=M.filters||Yo(),Et=M.alreadyAppliedFilters||[],zt=M.addLength1||!1,se=B.length,me=M.objectId,Qe=function(ci){return ci};if(p!==null&&me===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");p!==null&&(Qe=Br.encryptor(me,0));var on={};dt===!0&&(dt=["FlateEncode"]);var Rn=M.additionalKeyValues||[],Un=(on=pn.API.processDataByFilters!==void 0?pn.API.processDataByFilters(B,dt):{data:B,reverseChain:[]}).reverseChain+(Array.isArray(Et)?Et.join(" "):Et.toString());if(on.data.length!==0&&(Rn.push({key:"Length",value:on.data.length}),zt===!0&&Rn.push({key:"Length1",value:se})),Un.length!=0)if(Un.split("/").length-1==1)Rn.push({key:"Filter",value:Un});else{Rn.push({key:"Filter",value:"["+Un+"]"});for(var sr=0;sr<Rn.length;sr+=1)if(Rn[sr].key==="DecodeParms"){for(var Fi=[],Ni=0;Ni<on.reverseChain.split("/").length-1;Ni+=1)Fi.push("null");Fi.push(Rn[sr].value),Rn[sr].value="["+Fi.join(" ")+"]"}}ct("<<");for(var Pr=0;Pr<Rn.length;Pr++)ct("/"+Rn[Pr].key+" "+Rn[Pr].value);ct(">>"),on.data.length!==0&&(ct("stream"),ct(Qe(on.data)),ct("endstream"))},Or=y.__private__.putPage=function(M){var B=M.number,dt=M.data,Et=M.objId,zt=M.contentsObjId;mi(Et,!0),ct("<</Type /Page"),ct("/Parent "+M.rootDictionaryObjId+" 0 R"),ct("/Resources "+M.resourceDictionaryObjId+" 0 R"),ct("/MediaBox ["+parseFloat(bt(M.mediaBox.bottomLeftX))+" "+parseFloat(bt(M.mediaBox.bottomLeftY))+" "+bt(M.mediaBox.topRightX)+" "+bt(M.mediaBox.topRightY)+"]"),M.cropBox!==null&&ct("/CropBox ["+bt(M.cropBox.bottomLeftX)+" "+bt(M.cropBox.bottomLeftY)+" "+bt(M.cropBox.topRightX)+" "+bt(M.cropBox.topRightY)+"]"),M.bleedBox!==null&&ct("/BleedBox ["+bt(M.bleedBox.bottomLeftX)+" "+bt(M.bleedBox.bottomLeftY)+" "+bt(M.bleedBox.topRightX)+" "+bt(M.bleedBox.topRightY)+"]"),M.trimBox!==null&&ct("/TrimBox ["+bt(M.trimBox.bottomLeftX)+" "+bt(M.trimBox.bottomLeftY)+" "+bt(M.trimBox.topRightX)+" "+bt(M.trimBox.topRightY)+"]"),M.artBox!==null&&ct("/ArtBox ["+bt(M.artBox.bottomLeftX)+" "+bt(M.artBox.bottomLeftY)+" "+bt(M.artBox.topRightX)+" "+bt(M.artBox.topRightY)+"]"),typeof M.userUnit=="number"&&M.userUnit!==1&&ct("/UserUnit "+M.userUnit),Vn.publish("putPage",{objId:Et,pageContext:Ke[B],pageNumber:B,page:dt}),ct("/Contents "+zt+" 0 R"),ct(">>"),ct("endobj");var se=dt.join(`
|
|
12
|
-
`);return $===H&&(se+=`
|
|
13
|
-
Q`),mi(zt,!0),li({data:se,filters:Yo(),objectId:zt}),ct("endobj"),Et},ta=y.__private__.putPages=function(){var M,B,dt=[];for(M=1;M<=Mn;M++)Ke[M].objId=si(),Ke[M].contentsObjId=si();for(M=1;M<=Mn;M++)dt.push(Or({number:M,data:ve[M],objId:Ke[M].objId,contentsObjId:Ke[M].contentsObjId,mediaBox:Ke[M].mediaBox,cropBox:Ke[M].cropBox,bleedBox:Ke[M].bleedBox,trimBox:Ke[M].trimBox,artBox:Ke[M].artBox,userUnit:Ke[M].userUnit,rootDictionaryObjId:ai,resourceDictionaryObjId:Ar}));mi(ai,!0),ct("<</Type /Pages");var Et="/Kids [";for(B=0;B<Mn;B++)Et+=dt[B]+" 0 R ";ct(Et+"]"),ct("/Count "+Mn),ct(">>"),ct("endobj"),Vn.publish("postPutPages")},ea=function(M){Vn.publish("putFont",{font:M,out:ct,newObject:Fn,putStream:li}),M.isAlreadyPutted!==!0&&(M.objectNumber=Fn(),ct("<<"),ct("/Type /Font"),ct("/BaseFont /"+Fd(M.postScriptName)),ct("/Subtype /Type1"),typeof M.encoding=="string"&&ct("/Encoding /"+M.encoding),ct("/FirstChar 32"),ct("/LastChar 255"),ct(">>"),ct("endobj"))},fa=function(M){M.objectNumber=Fn();var B=[];B.push({key:"Type",value:"/XObject"}),B.push({key:"Subtype",value:"/Form"}),B.push({key:"BBox",value:"["+[bt(M.x),bt(M.y),bt(M.x+M.width),bt(M.y+M.height)].join(" ")+"]"}),B.push({key:"Matrix",value:"["+M.matrix.toString()+"]"});var dt=M.pages[1].join(`
|
|
14
|
-
`);li({data:dt,additionalKeyValues:B,objectId:M.objectNumber}),ct("endobj")},as=function(M,B){B||(B=21);var dt=Fn(),Et=(function(me,Qe){var on,Rn=[],Un=1/(Qe-1);for(on=0;on<1;on+=Un)Rn.push(on);if(Rn.push(1),me[0].offset!=0){var sr={offset:0,color:me[0].color};me.unshift(sr)}if(me[me.length-1].offset!=1){var Fi={offset:1,color:me[me.length-1].color};me.push(Fi)}for(var Ni="",Pr=0,ci=0;ci<Rn.length;ci++){for(on=Rn[ci];on>me[Pr+1].offset;)Pr++;var gi=me[Pr].offset,yi=(on-gi)/(me[Pr+1].offset-gi),eo=me[Pr].color,Hs=me[Pr+1].color;Ni+=ut(Math.round((1-yi)*eo[0]+yi*Hs[0]).toString(16))+ut(Math.round((1-yi)*eo[1]+yi*Hs[1]).toString(16))+ut(Math.round((1-yi)*eo[2]+yi*Hs[2]).toString(16))}return Ni.trim()})(M.colors,B),zt=[];zt.push({key:"FunctionType",value:"0"}),zt.push({key:"Domain",value:"[0.0 1.0]"}),zt.push({key:"Size",value:"["+B+"]"}),zt.push({key:"BitsPerSample",value:"8"}),zt.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),zt.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),li({data:Et,additionalKeyValues:zt,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:dt}),ct("endobj"),M.objectNumber=Fn(),ct("<< /ShadingType "+M.type),ct("/ColorSpace /DeviceRGB");var se="/Coords ["+bt(parseFloat(M.coords[0]))+" "+bt(parseFloat(M.coords[1]))+" ";M.type===2?se+=bt(parseFloat(M.coords[2]))+" "+bt(parseFloat(M.coords[3])):se+=bt(parseFloat(M.coords[2]))+" "+bt(parseFloat(M.coords[3]))+" "+bt(parseFloat(M.coords[4]))+" "+bt(parseFloat(M.coords[5])),ct(se+="]"),M.matrix&&ct("/Matrix ["+M.matrix.toString()+"]"),ct("/Function "+dt+" 0 R"),ct("/Extend [true true]"),ct(">>"),ct("endobj")},Bo=function(M,B){var dt=si(),Et=Fn();B.push({resourcesOid:dt,objectOid:Et}),M.objectNumber=Et;var zt=[];zt.push({key:"Type",value:"/Pattern"}),zt.push({key:"PatternType",value:"1"}),zt.push({key:"PaintType",value:"1"}),zt.push({key:"TilingType",value:"1"}),zt.push({key:"BBox",value:"["+M.boundingBox.map(bt).join(" ")+"]"}),zt.push({key:"XStep",value:bt(M.xStep)}),zt.push({key:"YStep",value:bt(M.yStep)}),zt.push({key:"Resources",value:dt+" 0 R"}),M.matrix&&zt.push({key:"Matrix",value:"["+M.matrix.toString()+"]"}),li({data:M.stream,additionalKeyValues:zt,objectId:M.objectNumber}),ct("endobj")},gl=function(M){for(var B in M.objectNumber=Fn(),ct("<<"),M)switch(B){case"opacity":ct("/ca "+Q(M[B]));break;case"stroke-opacity":ct("/CA "+Q(M[B]))}ct(">>"),ct("endobj")},na=function(M){mi(M.resourcesOid,!0),ct("<<"),ct("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),(function(){for(var B in ct("/Font <<"),nn)nn.hasOwnProperty(B)&&(g===!1||g===!0&&b.hasOwnProperty(B))&&ct("/"+B+" "+nn[B].objectNumber+" 0 R");ct(">>")})(),(function(){if(Object.keys(Ze).length>0){for(var B in ct("/Shading <<"),Ze)Ze.hasOwnProperty(B)&&Ze[B]instanceof If&&Ze[B].objectNumber>=0&&ct("/"+B+" "+Ze[B].objectNumber+" 0 R");Vn.publish("putShadingPatternDict"),ct(">>")}})(),(function(B){if(Object.keys(Ze).length>0){for(var dt in ct("/Pattern <<"),Ze)Ze.hasOwnProperty(dt)&&Ze[dt]instanceof y.TilingPattern&&Ze[dt].objectNumber>=0&&Ze[dt].objectNumber<B&&ct("/"+dt+" "+Ze[dt].objectNumber+" 0 R");Vn.publish("putTilingPatternDict"),ct(">>")}})(M.objectOid),(function(){if(Object.keys(gn).length>0){var B;for(B in ct("/ExtGState <<"),gn)gn.hasOwnProperty(B)&&gn[B].objectNumber>=0&&ct("/"+B+" "+gn[B].objectNumber+" 0 R");Vn.publish("putGStateDict"),ct(">>")}})(),(function(){for(var B in ct("/XObject <<"),Ei)Ei.hasOwnProperty(B)&&Ei[B].objectNumber>=0&&ct("/"+B+" "+Ei[B].objectNumber+" 0 R");Vn.publish("putXobjectDict"),ct(">>")})(),ct(">>"),ct("endobj")},Wr=function(M){ln[M.fontName]=ln[M.fontName]||{},ln[M.fontName][M.fontStyle]=M.id},dc=function(M,B,dt,Et,zt){var se={id:"F"+(Object.keys(nn).length+1).toString(10),postScriptName:M,fontName:B,fontStyle:dt,encoding:Et,isStandardFont:zt||!1,metadata:{}};return Vn.publish("addFont",{font:se,instance:this}),nn[se.id]=se,Wr(se),se.id},Ls=y.__private__.pdfEscape=y.pdfEscape=function(M,B){return(function(dt,Et){var zt,se,me,Qe,on,Rn,Un,sr,Fi;if(me=(Et=Et||{}).sourceEncoding||"Unicode",on=Et.outputEncoding,(Et.autoencode||on)&&nn[ze].metadata&&nn[ze].metadata[me]&&nn[ze].metadata[me].encoding&&(Qe=nn[ze].metadata[me].encoding,!on&&nn[ze].encoding&&(on=nn[ze].encoding),!on&&Qe.codePages&&(on=Qe.codePages[0]),typeof on=="string"&&(on=Qe[on]),on)){for(Un=!1,Rn=[],zt=0,se=dt.length;zt<se;zt++)(sr=on[dt.charCodeAt(zt)])?Rn.push(String.fromCharCode(sr)):Rn.push(dt[zt]),Rn[zt].charCodeAt(0)>>8&&(Un=!0);dt=Rn.join("")}for(zt=dt.length;Un===void 0&&zt!==0;)dt.charCodeAt(zt-1)>>8&&(Un=!0),zt--;if(!Un)return dt;for(Rn=Et.noBOM?[]:[254,255],zt=0,se=dt.length;zt<se;zt++){if((Fi=(sr=dt.charCodeAt(zt))>>8)>>8)throw new Error("Character at position "+zt+" of string '"+dt+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");Rn.push(Fi),Rn.push(sr-(Fi<<8))}return String.fromCharCode.apply(void 0,Rn)})(M,B).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},da=y.__private__.beginPage=function(M){ve[++Mn]=[],Ke[Mn]={objId:0,contentsObjId:0,userUnit:Number(c),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(M[0]),topRightY:Number(M[1])}},yl(Mn),We(ve[K])},ha=function(M,B){var dt,Et,zt;switch(e=B||e,typeof M=="string"&&(dt=R(M.toLowerCase()),Array.isArray(dt)&&(Et=dt[0],zt=dt[1])),Array.isArray(M)&&(Et=M[0]*Xe,zt=M[1]*Xe),isNaN(Et)&&(Et=i[0],zt=i[1]),(Et>14400||zt>14400)&&(Ai.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),Et=Math.min(14400,Et),zt=Math.min(14400,zt)),i=[Et,zt],e.substr(0,1)){case"l":zt>Et&&(i=[zt,Et]);break;case"p":Et>zt&&(i=[zt,Et])}da(i),xl(yn),ct(ra),Ko!==0&&ct(Ko+" J"),Jo!==0&&ct(Jo+" j"),Vn.publish("addPage",{pageNumber:Mn})},hc=function(M){M>0&&M<=Mn&&(ve.splice(M,1),Ke.splice(M,1),Mn--,K>Mn&&(K=Mn),this.setPage(K))},yl=function(M){M>0&&M<=Mn&&(K=M)},pc=y.__private__.getNumberOfPages=y.getNumberOfPages=function(){return ve.length-1},$l=function(M,B,dt){var Et,zt=void 0;return dt=dt||{},M=M!==void 0?M:nn[ze].fontName,B=B!==void 0?B:nn[ze].fontStyle,Et=M.toLowerCase(),ln[Et]!==void 0&&ln[Et][B]!==void 0?zt=ln[Et][B]:ln[M]!==void 0&&ln[M][B]!==void 0?zt=ln[M][B]:dt.disableWarning===!1&&Ai.warn("Unable to look up font label for font '"+M+"', '"+B+"'. Refer to getFontList() for available fonts."),zt||dt.noFallback||(zt=ln.times[B])==null&&(zt=ln.times.normal),zt},Wi=y.__private__.putInfo=function(){var M=Fn(),B=function(Et){return Et};for(var dt in p!==null&&(B=Br.encryptor(M,0)),ct("<<"),ct("/Producer ("+Ls(B("jsPDF "+pn.version))+")"),dn)dn.hasOwnProperty(dt)&&dn[dt]&&ct("/"+dt.substr(0,1).toUpperCase()+dt.substr(1)+" ("+Ls(B(dn[dt]))+")");ct("/CreationDate ("+Ls(B(Tt))+")"),ct(">>"),ct("endobj")},Xi=y.__private__.putCatalog=function(M){var B=(M=M||{}).rootDictionaryObjId||ai;switch(Fn(),ct("<<"),ct("/Type /Catalog"),ct("/Pages "+B+" 0 R"),Te||(Te="fullwidth"),Te){case"fullwidth":ct("/OpenAction [3 0 R /FitH null]");break;case"fullheight":ct("/OpenAction [3 0 R /FitV null]");break;case"fullpage":ct("/OpenAction [3 0 R /Fit]");break;case"original":ct("/OpenAction [3 0 R /XYZ null null 1]");break;default:var dt=""+Te;dt.substr(dt.length-1)==="%"&&(Te=parseInt(Te)/100),typeof Te=="number"&&ct("/OpenAction [3 0 R /XYZ null null "+Q(Te)+"]")}switch(In||(In="continuous"),In){case"continuous":ct("/PageLayout /OneColumn");break;case"single":ct("/PageLayout /SinglePage");break;case"two":case"twoleft":ct("/PageLayout /TwoColumnLeft");break;case"tworight":ct("/PageLayout /TwoColumnRight")}Ue&&ct("/PageMode /"+Ue),Vn.publish("putCatalog"),ct(">>"),ct("endobj")},Vo=y.__private__.putTrailer=function(){ct("trailer"),ct("<<"),ct("/Size "+(xt+1)),ct("/Root "+xt+" 0 R"),ct("/Info "+(xt-1)+" 0 R"),p!==null&&ct("/Encrypt "+Br.oid+" 0 R"),ct("/ID [ <"+gt+"> <"+gt+"> ]"),ct(">>")},fr=y.__private__.putHeader=function(){ct("%PDF-"+A),ct("%ºß¬à")},mc=y.__private__.putXRef=function(){var M="0000000000";ct("xref"),ct("0 "+(xt+1)),ct("0000000000 65535 f ");for(var B=1;B<=xt;B++)typeof At[B]=="function"?ct((M+At[B]()).slice(-10)+" 00000 n "):At[B]!==void 0?ct((M+At[B]).slice(-10)+" 00000 n "):ct("0000000000 00000 n ")},pa=y.__private__.buildDocument=function(){var M;xt=0,Lt=0,Ft=[],At=[],Zt=[],ai=si(),Ar=si(),We(Ft),Vn.publish("buildDocument"),fr(),ta(),(function(){Vn.publish("putAdditionalObjects");for(var dt=0;dt<Zt.length;dt++){var Et=Zt[dt];mi(Et.objId,!0),ct(Et.content),ct("endobj")}Vn.publish("postPutAdditionalObjects")})(),M=[],(function(){for(var dt in nn)nn.hasOwnProperty(dt)&&(g===!1||g===!0&&b.hasOwnProperty(dt))&&ea(nn[dt])})(),(function(){var dt;for(dt in gn)gn.hasOwnProperty(dt)&&gl(gn[dt])})(),(function(){for(var dt in Ei)Ei.hasOwnProperty(dt)&&fa(Ei[dt])})(),(function(dt){var Et;for(Et in Ze)Ze.hasOwnProperty(Et)&&(Ze[Et]instanceof If?as(Ze[Et]):Ze[Et]instanceof Vd&&Bo(Ze[Et],dt))})(M),Vn.publish("putResources"),M.forEach(na),na({resourcesOid:Ar,objectOid:Number.MAX_SAFE_INTEGER}),Vn.publish("postPutResources"),p!==null&&(Br.oid=Fn(),ct("<<"),ct("/Filter /Standard"),ct("/V "+Br.v),ct("/R "+Br.r),ct("/U <"+Br.toHexString(Br.U)+">"),ct("/O <"+Br.toHexString(Br.O)+">"),ct("/P "+Br.P),ct(">>"),ct("endobj")),Wi(),Xi();var B=Lt;return mc(),Vo(),ct("startxref"),ct(""+B),ct("%%EOF"),We(ve[K]),Ft.join(`
|
|
15
|
-
`)},Fa=y.__private__.getBlob=function(M){return new Blob([Pn(M)],{type:"application/pdf"})},ma=function(M){for(;M.firstChild;)M.removeChild(M.firstChild)},Xr=function(M){var B,dt=M.document,Et=dt.documentElement,zt=dt.head,se=dt.body;return zt||(zt=dt.createElement("head"),Et.appendChild(zt)),se||(se=dt.createElement("body"),Et.appendChild(se)),ma(zt),ma(se),(B=dt.createElement("style")).appendChild(dt.createTextNode("html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;}")),zt.appendChild(B),{document:dt,body:se}},Fo=y.output=y.__private__.output=(or=function(M,B){switch(typeof(B=B||{})=="string"?B={filename:B}:B.filename=B.filename||"generated.pdf",M){case void 0:return pa();case"save":y.save(B.filename);break;case"arraybuffer":return Pn(pa());case"blob":return Fa(pa());case"bloburi":case"bloburl":if(Wn.URL!==void 0&&typeof Wn.URL.createObjectURL=="function")return Wn.URL&&Wn.URL.createObjectURL(Fa(pa()))||void 0;Ai.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var dt="",Et=pa();try{dt=Fw(Et)}catch{dt=Fw(unescape(encodeURIComponent(Et)))}return"data:application/pdf;filename="+encodeURIComponent(B.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(Wn)!=="[object Window]")throw new Error("The option dataurlnewwindow just works in a browser-environment.");var zt=Wn.open();if(zt!==null){var se=Xr(zt),me=se.document.createElement("iframe");me.src=this.output("datauristring",B),se.body.appendChild(me),zt.document.title=B.filename}if(zt||typeof safari>"u")return zt;break;case"datauri":case"dataurl":return Wn.document.location.href=this.output("datauristring",B);default:return null}},or.foo=function(){try{return or.apply(this,arguments)}catch(dt){var M=dt.stack||"";~M.indexOf(" at ")&&(M=M.split(" at ")[1]);var B="Error in function "+M.split(`
|
|
16
|
-
`)[0].split("<")[0]+": "+dt.message;if(!Wn.console)throw new Error(B);Wn.console.error(B,dt),Wn.alert&&alert(B)}},or.foo.bar=or,or.foo),Mr=function(M){return Array.isArray(ss)===!0&&ss.indexOf(M)>-1};switch(r){case"pt":Xe=1;break;case"mm":Xe=72/25.4;break;case"cm":Xe=72/2.54;break;case"in":Xe=72;break;case"px":Xe=Mr("px_scaling")==1?.75:96/72;break;case"pc":case"em":Xe=12;break;case"ex":Xe=6;break;default:if(typeof r!="number")throw new Error("Invalid unit: "+r);Xe=r}var Br=null;J(),lt();var Fr=y.__private__.getPageInfo=y.getPageInfo=function(M){if(isNaN(M)||M%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfo");return{objId:Ke[M].objId,pageNumber:M,pageContext:Ke[M]}},ls=y.__private__.getPageInfoByObjId=function(M){if(isNaN(M)||M%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");for(var B in Ke)if(Ke[B].objId===M)break;return Fr(B)},Di=y.__private__.getCurrentPageInfo=y.getCurrentPageInfo=function(){return{objId:Ke[K].objId,pageNumber:K,pageContext:Ke[K]}};y.addPage=function(){return ha.apply(this,arguments),this},y.setPage=function(){return yl.apply(this,arguments),We.call(this,ve[K]),this},y.insertPage=function(M){return this.addPage(),this.movePage(K,M),this},y.movePage=function(M,B){var dt,Et;if(M>B){dt=ve[M],Et=Ke[M];for(var zt=M;zt>B;zt--)ve[zt]=ve[zt-1],Ke[zt]=Ke[zt-1];ve[B]=dt,Ke[B]=Et,this.setPage(B)}else if(M<B){dt=ve[M],Et=Ke[M];for(var se=M;se<B;se++)ve[se]=ve[se+1],Ke[se]=Ke[se+1];ve[B]=dt,Ke[B]=Et,this.setPage(B)}return this},y.deletePage=function(){return hc.apply(this,arguments),this},y.__private__.text=y.text=function(M,B,dt,Et,zt){var se,me,Qe,on,Rn,Un,sr,Fi,Ni,Pr=(Et=Et||{}).scope||this;if(typeof M=="number"&&typeof B=="number"&&(typeof dt=="string"||Array.isArray(dt))){var ci=dt;dt=B,B=M,M=ci}if(arguments[3]instanceof Me==0?(Qe=arguments[4],on=arguments[5],oi(sr=arguments[3])==="object"&&sr!==null||(typeof Qe=="string"&&(on=Qe,Qe=null),typeof sr=="string"&&(on=sr,sr=null),typeof sr=="number"&&(Qe=sr,sr=null),Et={flags:sr,angle:Qe,align:on})):(ot("The transform parameter of text() with a Matrix value"),Ni=zt),isNaN(B)||isNaN(dt)||M==null)throw new Error("Invalid arguments passed to jsPDF.text");if(M.length===0)return Pr;var gi,yi="",eo=typeof Et.lineHeightFactor=="number"?Et.lineHeightFactor:fs,Hs=Pr.internal.scaleFactor;function yc(br){return br=br.split(" ").join(Array(Et.TabLen||9).join(" ")),Ls(br,sr)}function ge(br){for(var jr,_i=br.concat(),Gr=[],Ho=_i.length;Ho--;)typeof(jr=_i.shift())=="string"?Gr.push(jr):Array.isArray(br)&&(jr.length===1||jr[1]===void 0&&jr[2]===void 0)?Gr.push(jr[0]):Gr.push([jr[0],jr[1],jr[2]]);return Gr}function Zo(br,jr){var _i;if(typeof br=="string")_i=jr(br)[0];else if(Array.isArray(br)){for(var Gr,Ho,Qa=br.concat(),Jl=[],Yc=Qa.length;Yc--;)typeof(Gr=Qa.shift())=="string"?Jl.push(jr(Gr)[0]):Array.isArray(Gr)&&typeof Gr[0]=="string"&&(Ho=jr(Gr[0],Gr[1],Gr[2]),Jl.push([Ho[0],Ho[1],Ho[2]]));_i=Jl}return _i}var ds=!1,Tn=!0;if(typeof M=="string")ds=!0;else if(Array.isArray(M)){var Nn=M.concat();me=[];for(var Gl,Gi=Nn.length;Gi--;)(typeof(Gl=Nn.shift())!="string"||Array.isArray(Gl)&&typeof Gl[0]!="string")&&(Tn=!1);ds=Tn}if(ds===!1)throw new Error('Type of text must be string or Array. "'+M+'" is not recognized.');typeof M=="string"&&(M=M.match(/[\r?\n]/)?M.split(/\r\n|\r|\n/g):[M]);var vl=ye/Pr.internal.scaleFactor,ar=vl*(eo-1);switch(Et.baseline){case"bottom":dt-=ar;break;case"top":dt+=vl-ar;break;case"hanging":dt+=vl-2*ar;break;case"middle":dt+=vl/2-ar}if((Un=Et.maxWidth||0)>0&&(typeof M=="string"?M=Pr.splitTextToSize(M,Un):Object.prototype.toString.call(M)==="[object Array]"&&(M=M.reduce(function(br,jr){return br.concat(Pr.splitTextToSize(jr,Un))},[]))),se={text:M,x:B,y:dt,options:Et,mutex:{pdfEscape:Ls,activeFontKey:ze,fonts:nn,activeFontSize:ye}},Vn.publish("preProcessText",se),M=se.text,Qe=(Et=se.options).angle,Ni instanceof Me==0&&Qe&&typeof Qe=="number"){Qe*=Math.PI/180,Et.rotationDirection===0&&(Qe=-Qe),$===H&&(Qe=-Qe);var va=Math.cos(Qe),wa=Math.sin(Qe);Ni=new Me(va,wa,-wa,va,0,0)}else Qe&&Qe instanceof Me&&(Ni=Qe);$!==H||Ni||(Ni=Xn),(Rn=Et.charSpace||js)!==void 0&&(yi+=bt(G(Rn))+` Tc
|
|
17
|
-
`,this.setCharSpace(this.getCharSpace()||0)),(Fi=Et.horizontalScale)!==void 0&&(yi+=bt(100*Fi)+` Tz
|
|
18
|
-
`),Et.lang;var no=-1,$c=Et.renderingMode!==void 0?Et.renderingMode:Et.stroke,Va=Pr.internal.getCurrentPageInfo().pageContext;switch($c){case 0:case!1:case"fill":no=0;break;case 1:case!0:case"stroke":no=1;break;case 2:case"fillThenStroke":no=2;break;case 3:case"invisible":no=3;break;case 4:case"fillAndAddForClipping":no=4;break;case 5:case"strokeAndAddPathForClipping":no=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":no=6;break;case 7:case"addToPathForClipping":no=7}var Wa=Va.usedRenderingMode!==void 0?Va.usedRenderingMode:-1;no!==-1?yi+=no+` Tr
|
|
19
|
-
`:Wa!==-1&&(yi+=`0 Tr
|
|
20
|
-
`),no!==-1&&(Va.usedRenderingMode=no),on=Et.align||"left";var Ki,wl=ye*eo,Xa=Pr.internal.pageSize.getWidth(),Sl=nn[ze];Rn=Et.charSpace||js,Un=Et.maxWidth||0,sr=Object.assign({autoencode:!0,noBOM:!0},Et.flags);var Ga=[],kl=function(br){return Pr.getStringUnitWidth(br,{font:Sl,charSpace:Rn,fontSize:ye,doKerning:!1})*ye/Hs};if(Object.prototype.toString.call(M)==="[object Array]"){var ro;me=ge(M),on!=="left"&&(Ki=me.map(kl));var io,hs=0;if(on==="right"){B-=Ki[0],M=[],Gi=me.length;for(var Sa=0;Sa<Gi;Sa++)Sa===0?(io=Os(B),ro=Go(dt)):(io=G(hs-Ki[Sa]),ro=-wl),M.push([me[Sa],io,ro]),hs=Ki[Sa]}else if(on==="center"){B-=Ki[0]/2,M=[],Gi=me.length;for(var ka=0;ka<Gi;ka++)ka===0?(io=Os(B),ro=Go(dt)):(io=G((hs-Ki[ka])/2),ro=-wl),M.push([me[ka],io,ro]),hs=Ki[ka]}else if(on==="left"){M=[],Gi=me.length;for(var Kl=0;Kl<Gi;Kl++)M.push(me[Kl])}else if(on==="justify"&&Sl.encoding==="Identity-H"){M=[],Gi=me.length,Un=Un!==0?Un:Xa;for(var Uo=0,yr=0;yr<Gi;yr++)if(ro=yr===0?Go(dt):-wl,io=yr===0?Os(B):Uo,yr<Gi-1){var bc=G((Un-Ki[yr])/(me[yr].split(" ").length-1)),_r=me[yr].split(" ");M.push([_r[0]+" ",io,ro]),Uo=0;for(var go=1;go<_r.length;go++){var Ka=(kl(_r[go-1]+" "+_r[go])-kl(_r[go]))*Hs+bc;go==_r.length-1?M.push([_r[go],Ka,0]):M.push([_r[go]+" ",Ka,0]),Uo-=Ka}}else M.push([me[yr],io,ro]);M.push(["",Uo,0])}else{if(on!=="justify")throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');for(M=[],Gi=me.length,Un=Un!==0?Un:Xa,yr=0;yr<Gi;yr++){ro=yr===0?Go(dt):-wl,io=yr===0?Os(B):0;var Al=me[yr].split(" ").length-1,Se=Al>0?(Un-Ki[yr])/Al:0;yr<Gi-1?Ga.push(bt(G(Se))):Ga.push(0),M.push([me[yr],io,ro])}}}(typeof Et.R2L=="boolean"?Et.R2L:_e)===!0&&(M=Zo(M,function(br,jr,_i){return[br.split("").reverse().join(""),jr,_i]})),se={text:M,x:B,y:dt,options:Et,mutex:{pdfEscape:Ls,activeFontKey:ze,fonts:nn,activeFontSize:ye}},Vn.publish("postProcessText",se),M=se.text,gi=se.mutex.isHex||!1;var oo=nn[ze].encoding;oo!=="WinAnsiEncoding"&&oo!=="StandardEncoding"||(M=Zo(M,function(br,jr,_i){return[yc(br),jr,_i]})),me=ge(M),M=[];for(var Aa,Ja,ps,ms=Array.isArray(me[0])?1:0,qs="",Za=function(br,jr,_i){var Gr="";return _i instanceof Me?(_i=typeof Et.angle=="number"?Oe(_i,new Me(1,0,0,1,br,jr)):Oe(new Me(1,0,0,1,br,jr),_i),$===H&&(_i=Oe(new Me(1,0,0,-1,0,0),_i)),Gr=_i.join(" ")+` Tm
|
|
21
|
-
`):Gr=bt(br)+" "+bt(jr)+` Td
|
|
22
|
-
`,Gr},yo=0;yo<me.length;yo++){switch(qs="",ms){case 1:ps=(gi?"<":"(")+me[yo][0]+(gi?">":")"),Aa=parseFloat(me[yo][1]),Ja=parseFloat(me[yo][2]);break;case 0:ps=(gi?"<":"(")+me[yo]+(gi?">":")"),Aa=Os(B),Ja=Go(dt)}Ga!==void 0&&Ga[yo]!==void 0&&(qs=Ga[yo]+` Tw
|
|
23
|
-
`),yo===0?M.push(qs+Za(Aa,Ja,Ni)+ps):ms===0?M.push(qs+ps):ms===1&&M.push(qs+Za(Aa,Ja,Ni)+ps)}M=ms===0?M.join(` Tj
|
|
24
|
-
T* `):M.join(` Tj
|
|
25
|
-
`),M+=` Tj
|
|
26
|
-
`;var Do=`BT
|
|
27
|
-
/`;return Do+=ze+" "+ye+` Tf
|
|
28
|
-
`,Do+=bt(ye*eo)+` TL
|
|
29
|
-
`,Do+=_o+`
|
|
30
|
-
`,Do+=yi,Do+=M,ct(Do+="ET"),b[ze]=!0,Pr};var Wo=y.__private__.clip=y.clip=function(M){return ct(M==="evenodd"?"W*":"W"),this};y.clipEvenOdd=function(){return Wo("evenodd")},y.__private__.discardPath=y.discardPath=function(){return ct("n"),this};var Zn=y.__private__.isValidStyle=function(M){var B=!1;return[void 0,null,"S","D","F","DF","FD","f","f*","B","B*","n"].indexOf(M)!==-1&&(B=!0),B};y.__private__.setDefaultPathOperation=y.setDefaultPathOperation=function(M){return Zn(M)&&(d=M),this};var Xo=y.__private__.getStyle=y.getStyle=function(M){var B=d;switch(M){case"D":case"S":B="S";break;case"F":B="f";break;case"FD":case"DF":B="B";break;case"f":case"f*":case"B":case"B*":B=M}return B},Ua=y.close=function(){return ct("h"),this};y.stroke=function(){return ct("S"),this},y.fill=function(M){return cs("f",M),this},y.fillEvenOdd=function(M){return cs("f*",M),this},y.fillStroke=function(M){return cs("B",M),this},y.fillStrokeEvenOdd=function(M){return cs("B*",M),this};var cs=function(M,B){oi(B)==="object"?bl(B,M):ct(M)},te=function(M){M===null||$===H&&M===void 0||(M=Xo(M),ct(M))};function Hc(M,B,dt,Et,zt){var se=new Vd(B||this.boundingBox,dt||this.xStep,Et||this.yStep,this.gState,zt||this.matrix);se.stream=this.stream;var me=M+"$$"+this.cloneIndex+++"$$";return Bn(me,se),se}var bl=function(M,B){var dt=ur[M.key],Et=Ze[dt];if(Et instanceof If)ct("q"),ct(Mf(B)),Et.gState&&y.setGState(Et.gState),ct(M.matrix.toString()+" cm"),ct("/"+dt+" sh"),ct("Q");else if(Et instanceof Vd){var zt=new Me(1,0,0,-1,0,xa());M.matrix&&(zt=zt.multiply(M.matrix||Xn),dt=Hc.call(Et,M.key,M.boundingBox,M.xStep,M.yStep,zt).id),ct("q"),ct("/Pattern cs"),ct("/"+dt+" scn"),Et.gState&&y.setGState(Et.gState),ct(B),ct("Q")}},Mf=function(M){switch(M){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"}},No=y.moveTo=function(M,B){return ct(bt(G(M))+" "+bt(vt(B))+" m"),this},us=y.lineTo=function(M,B){return ct(bt(G(M))+" "+bt(vt(B))+" l"),this},ga=y.curveTo=function(M,B,dt,Et,zt,se){return ct([bt(G(M)),bt(vt(B)),bt(G(dt)),bt(vt(Et)),bt(G(zt)),bt(vt(se)),"c"].join(" ")),this};y.__private__.line=y.line=function(M,B,dt,Et,zt){if(isNaN(M)||isNaN(B)||isNaN(dt)||isNaN(Et)||!Zn(zt))throw new Error("Invalid arguments passed to jsPDF.line");return $===q?this.lines([[dt-M,Et-B]],M,B,[1,1],zt||"S"):this.lines([[dt-M,Et-B]],M,B,[1,1]).stroke()},y.__private__.lines=y.lines=function(M,B,dt,Et,zt,se){var me,Qe,on,Rn,Un,sr,Fi,Ni,Pr,ci,gi,yi;if(typeof M=="number"&&(yi=dt,dt=B,B=M,M=yi),Et=Et||[1,1],se=se||!1,isNaN(B)||isNaN(dt)||!Array.isArray(M)||!Array.isArray(Et)||!Zn(zt)||typeof se!="boolean")throw new Error("Invalid arguments passed to jsPDF.lines");for(No(B,dt),me=Et[0],Qe=Et[1],Rn=M.length,ci=B,gi=dt,on=0;on<Rn;on++)(Un=M[on]).length===2?(ci=Un[0]*me+ci,gi=Un[1]*Qe+gi,us(ci,gi)):(sr=Un[0]*me+ci,Fi=Un[1]*Qe+gi,Ni=Un[2]*me+ci,Pr=Un[3]*Qe+gi,ci=Un[4]*me+ci,gi=Un[5]*Qe+gi,ga(sr,Fi,Ni,Pr,ci,gi));return se&&Ua(),te(zt),this},y.path=function(M){for(var B=0;B<M.length;B++){var dt=M[B],Et=dt.c;switch(dt.op){case"m":No(Et[0],Et[1]);break;case"l":us(Et[0],Et[1]);break;case"c":ga.apply(this,Et);break;case"h":Ua()}}return this},y.__private__.rect=y.rect=function(M,B,dt,Et,zt){if(isNaN(M)||isNaN(B)||isNaN(dt)||isNaN(Et)||!Zn(zt))throw new Error("Invalid arguments passed to jsPDF.rect");return $===q&&(Et=-Et),ct([bt(G(M)),bt(vt(B)),bt(G(dt)),bt(G(Et)),"re"].join(" ")),te(zt),this},y.__private__.triangle=y.triangle=function(M,B,dt,Et,zt,se,me){if(isNaN(M)||isNaN(B)||isNaN(dt)||isNaN(Et)||isNaN(zt)||isNaN(se)||!Zn(me))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[dt-M,Et-B],[zt-dt,se-Et],[M-zt,B-se]],M,B,[1,1],me,!0),this},y.__private__.roundedRect=y.roundedRect=function(M,B,dt,Et,zt,se,me){if(isNaN(M)||isNaN(B)||isNaN(dt)||isNaN(Et)||isNaN(zt)||isNaN(se)||!Zn(me))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var Qe=4/3*(Math.SQRT2-1);return zt=Math.min(zt,.5*dt),se=Math.min(se,.5*Et),this.lines([[dt-2*zt,0],[zt*Qe,0,zt,se-se*Qe,zt,se],[0,Et-2*se],[0,se*Qe,-zt*Qe,se,-zt,se],[2*zt-dt,0],[-zt*Qe,0,-zt,-se*Qe,-zt,-se],[0,2*se-Et],[0,-se*Qe,zt*Qe,-se,zt,-se]],M+zt,B,[1,1],me,!0),this},y.__private__.ellipse=y.ellipse=function(M,B,dt,Et,zt){if(isNaN(M)||isNaN(B)||isNaN(dt)||isNaN(Et)||!Zn(zt))throw new Error("Invalid arguments passed to jsPDF.ellipse");var se=4/3*(Math.SQRT2-1)*dt,me=4/3*(Math.SQRT2-1)*Et;return No(M+dt,B),ga(M+dt,B-me,M+se,B-Et,M,B-Et),ga(M-se,B-Et,M-dt,B-me,M-dt,B),ga(M-dt,B+me,M-se,B+Et,M,B+Et),ga(M+se,B+Et,M+dt,B+me,M+dt,B),te(zt),this},y.__private__.circle=y.circle=function(M,B,dt,Et){if(isNaN(M)||isNaN(B)||isNaN(dt)||!Zn(Et))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(M,B,dt,dt,Et)},y.setFont=function(M,B,dt){return dt&&(B=wt(B,dt)),ze=$l(M,B,{disableWarning:!1}),this};var qc=y.__private__.getFont=y.getFont=function(){return nn[$l.apply(y,arguments)]};y.__private__.getFontList=y.getFontList=function(){var M,B,dt={};for(M in ln)if(ln.hasOwnProperty(M))for(B in dt[M]=[],ln[M])ln[M].hasOwnProperty(B)&&dt[M].push(B);return dt},y.addFont=function(M,B,dt,Et,zt){var se=["StandardEncoding","MacRomanEncoding","Identity-H","WinAnsiEncoding"];return arguments[3]&&se.indexOf(arguments[3])!==-1?zt=arguments[3]:arguments[3]&&se.indexOf(arguments[3])==-1&&(dt=wt(dt,Et)),dc.call(this,M,B,dt,zt=zt||"Identity-H")};var fs,yn=n.lineWidth||.200025,Yl=y.__private__.getLineWidth=y.getLineWidth=function(){return yn},xl=y.__private__.setLineWidth=y.setLineWidth=function(M){return yn=M,ct(bt(G(M))+" w"),this};y.__private__.setLineDash=pn.API.setLineDash=pn.API.setLineDashPattern=function(M,B){if(M=M||[],B=B||0,isNaN(B)||!Array.isArray(M))throw new Error("Invalid arguments passed to jsPDF.setLineDash");return M=M.map(function(dt){return bt(G(dt))}).join(" "),B=bt(G(B)),ct("["+M+"] "+B+" d"),this};var gc=y.__private__.getLineHeight=y.getLineHeight=function(){return ye*fs};y.__private__.getLineHeight=y.getLineHeight=function(){return ye*fs};var ya=y.__private__.setLineHeightFactor=y.setLineHeightFactor=function(M){return typeof(M=M||1.15)=="number"&&(fs=M),this},Rs=y.__private__.getLineHeightFactor=y.getLineHeightFactor=function(){return fs};ya(n.lineHeight);var Os=y.__private__.getHorizontalCoordinate=function(M){return G(M)},Go=y.__private__.getVerticalCoordinate=function(M){return $===H?M:Ke[K].mediaBox.topRightY-Ke[K].mediaBox.bottomLeftY-G(M)},Ps=y.__private__.getHorizontalCoordinateString=y.getHorizontalCoordinateString=function(M){return bt(Os(M))},Nr=y.__private__.getVerticalCoordinateString=y.getVerticalCoordinateString=function(M){return bt(Go(M))},ra=n.strokeColor||"0 G";y.__private__.getStrokeColor=y.getDrawColor=function(){return er(ra)},y.__private__.setStrokeColor=y.setDrawColor=function(M,B,dt,Et){return ra=Ti({ch1:M,ch2:B,ch3:dt,ch4:Et,pdfColorType:"draw",precision:2}),ct(ra),this};var Ha=n.fillColor||"0 g";y.__private__.getFillColor=y.getFillColor=function(){return er(Ha)},y.__private__.setFillColor=y.setFillColor=function(M,B,dt,Et){return Ha=Ti({ch1:M,ch2:B,ch3:dt,ch4:Et,pdfColorType:"fill",precision:2}),ct(Ha),this};var _o=n.textColor||"0 g",qa=y.__private__.getTextColor=y.getTextColor=function(){return er(_o)};y.__private__.setTextColor=y.setTextColor=function(M,B,dt,Et){return _o=Ti({ch1:M,ch2:B,ch3:dt,ch4:Et,pdfColorType:"text",precision:3}),this};var js=n.charSpace,Li=y.__private__.getCharSpace=y.getCharSpace=function(){return parseFloat(js||0)};y.__private__.setCharSpace=y.setCharSpace=function(M){if(isNaN(M))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return js=M,this};var Ko=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(M){var B=y.CapJoinStyles[M];if(B===void 0)throw new Error("Line cap style of '"+M+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return Ko=B,ct(B+" J"),this};var Jo=0;y.__private__.setLineJoin=y.setLineJoin=function(M){var B=y.CapJoinStyles[M];if(B===void 0)throw new Error("Line join style of '"+M+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return Jo=B,ct(B+" j"),this},y.__private__.setLineMiterLimit=y.__private__.setMiterLimit=y.setLineMiterLimit=y.setMiterLimit=function(M){if(M=M||0,isNaN(M))throw new Error("Invalid argument passed to jsPDF.setLineMiterLimit");return ct(bt(G(M))+" M"),this},y.GState=_g,y.setGState=function(M){(M=typeof M=="string"?gn[xn[M]]:Is(null,M)).equals(gr)||(ct("/"+M.id+" gs"),gr=M)};var Is=function(M,B){if(!M||!xn[M]){var dt=!1;for(var Et in gn)if(gn.hasOwnProperty(Et)&&gn[Et].equals(B)){dt=!0;break}if(dt)B=gn[Et];else{var zt="GS"+(Object.keys(gn).length+1).toString(10);gn[zt]=B,B.id=zt}return M&&(xn[M]=B.id),Vn.publish("addGState",B),B}};y.addGState=function(M,B){return Is(M,B),this},y.saveGraphicsState=function(){return ct("q"),Ln.push({key:ze,size:ye,color:_o}),this},y.restoreGraphicsState=function(){ct("Q");var M=Ln.pop();return ze=M.key,ye=M.size,_o=M.color,gr=null,this},y.setCurrentTransformationMatrix=function(M){return ct(M.toString()+" cm"),this},y.comment=function(M){return ct("#"+M),this};var ia=function(M,B){var dt=M||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return dt},set:function(se){isNaN(se)||(dt=parseFloat(se))}});var Et=B||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return Et},set:function(se){isNaN(se)||(Et=parseFloat(se))}});var zt="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return zt},set:function(se){zt=se.toString()}}),this},ba=function(M,B,dt,Et){ia.call(this,M,B),this.type="rect";var zt=dt||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return zt},set:function(me){isNaN(me)||(zt=parseFloat(me))}});var se=Et||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return se},set:function(me){isNaN(me)||(se=parseFloat(me))}}),this},zs=function(){this.page=Mn,this.currentPage=K,this.pages=ve.slice(0),this.pagesContext=Ke.slice(0),this.x=Ie,this.y=kr,this.matrix=wn,this.width=$a(K),this.height=Us(K),this.outputDestination=Pe,this.id="",this.objectNumber=-1};zs.prototype.restore=function(){Mn=this.page,K=this.currentPage,Ke=this.pagesContext,ve=this.pages,Ie=this.x,kr=this.y,wn=this.matrix,Fs(K,this.width),Vl(K,this.height),Pe=this.outputDestination};var oa=function(M,B,dt,Et,zt){Re.push(new zs),Mn=K=0,ve=[],Ie=M,kr=B,wn=zt,da([dt,Et])};for(var Bs in y.beginFormObject=function(M,B,dt,Et,zt){return oa(M,B,dt,Et,zt),this},y.endFormObject=function(M){return(function(B){if(Qt[B])Re.pop().restore();else{var dt=new zs,Et="Xo"+(Object.keys(Ei).length+1).toString(10);dt.id=Et,Qt[B]=Et,Ei[Et]=dt,Vn.publish("addFormObject",dt),Re.pop().restore()}})(M),this},y.doFormObject=function(M,B){var dt=Ei[Qt[M]];return ct("q"),ct(B.toString()+" cm"),ct("/"+dt.id+" Do"),ct("Q"),this},y.getFormObject=function(M){var B=Ei[Qt[M]];return{x:B.x,y:B.y,width:B.width,height:B.height,matrix:B.matrix}},y.save=function(M,B){return M=M||"generated.pdf",(B=B||{}).returnPromise=B.returnPromise||!1,B.returnPromise===!1?(jf(Fa(pa()),M),typeof jf.unload=="function"&&Wn.setTimeout&&setTimeout(jf.unload,911),this):new Promise(function(dt,Et){try{var zt=jf(Fa(pa()),M);typeof jf.unload=="function"&&Wn.setTimeout&&setTimeout(jf.unload,911),dt(zt)}catch(se){Et(se.message)}})},pn.API)pn.API.hasOwnProperty(Bs)&&(Bs==="events"&&pn.API.events.length?(function(M,B){var dt,Et,zt;for(zt=B.length-1;zt!==-1;zt--)dt=B[zt][0],Et=B[zt][1],M.subscribe.apply(M,[dt].concat(typeof Et=="function"?[Et]:Et))})(Vn,pn.API.events):y[Bs]=pn.API[Bs]);function $a(M){return Ke[M].mediaBox.topRightX-Ke[M].mediaBox.bottomLeftX}function Fs(M,B){Ke[M].mediaBox.topRightX=B+Ke[M].mediaBox.bottomLeftX}function Us(M){return Ke[M].mediaBox.topRightY-Ke[M].mediaBox.bottomLeftY}function Vl(M,B){Ke[M].mediaBox.topRightY=B+Ke[M].mediaBox.bottomLeftY}var Ya=y.getPageWidth=function(M){return $a(M=M||K)/Xe},Wl=y.setPageWidth=function(M,B){Fs(M,B*Xe)},xa=y.getPageHeight=function(M){return Us(M=M||K)/Xe},Xl=y.setPageHeight=function(M,B){Vl(M,B*Xe)};return y.internal={pdfEscape:Ls,getStyle:Xo,getFont:qc,getFontSize:Ne,getCharSpace:Li,getTextColor:qa,getLineHeight:gc,getLineHeightFactor:Rs,getLineWidth:Yl,write:Le,getHorizontalCoordinate:Os,getVerticalCoordinate:Go,getCoordinateString:Ps,getVerticalCoordinateString:Nr,collections:{},newObject:Fn,newAdditionalObject:Wt,newObjectDeferred:si,newObjectDeferredBegin:mi,getFilters:Yo,putStream:li,events:Vn,scaleFactor:Xe,pageSize:{getWidth:function(){return Ya(K)},setWidth:function(M){Wl(K,M)},getHeight:function(){return xa(K)},setHeight:function(M){Xl(K,M)}},encryptionOptions:p,encryption:Br,getEncryptor:function(M){return p!==null?Br.encryptor(M,0):function(B){return B}},output:Fo,getNumberOfPages:pc,get pages(){return ve},out:ct,f2:Q,f3:at,getPageInfo:Fr,getPageInfoByObjId:ls,getCurrentPageInfo:Di,getPDFVersion:E,Point:ia,Rectangle:ba,Matrix:Me,hasHotfix:Mr},Object.defineProperty(y.internal.pageSize,"width",{get:function(){return Ya(K)},set:function(M){Wl(K,M)},enumerable:!0,configurable:!0}),Object.defineProperty(y.internal.pageSize,"height",{get:function(){return xa(K)},set:function(M){Xl(K,M)},enumerable:!0,configurable:!0}),(function(M){for(var B=0,dt=fe.length;B<dt;B++){var Et=dc.call(this,M[B][0],M[B][1],M[B][2],fe[B][3],!0);g===!1&&(b[Et]=!0);var zt=M[B][0].split("-");Wr({id:Et,fontName:zt[0],fontStyle:zt[1]||""})}Vn.publish("addFonts",{fonts:nn,dictionary:ln})}).call(y,fe),ze="F1",ha(i,e),Vn.publish("initialized"),y}Bd.prototype.lsbFirstWord=function(n){return String.fromCharCode(255&n,n>>8&255,n>>16&255,n>>24&255)},Bd.prototype.toHexString=function(n){return n.split("").map(function(t){return("0"+(255&t.charCodeAt(0)).toString(16)).slice(-2)}).join("")},Bd.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("")},Bd.prototype.processOwnerPassword=function(n,t){return _2(N2(t).substr(0,5),n)},Bd.prototype.encryptor=function(n,t){var e=N2(this.encryptionKey+String.fromCharCode(255&n,n>>8&255,n>>16&255,255&t,t>>8&255)).substr(0,10);return function(r){return _2(e,r)}},_g.prototype.equals=function(n){var t,e="id,objectNumber,equals";if(!n||oi(n)!==oi(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},pn.API={events:[]},pn.version="4.2.1";var ho=pn.API,P5=1,fd=function(n){return n.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Ld=function(n){return n.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},rd=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)})},Yn=function(n){return n.toFixed(2)},Ju=function(n){return n.toFixed(5)};ho.__acroform__={};var Ba=function(n,t){n.prototype=Object.create(t.prototype),n.prototype.constructor=n},$w=function(n){return n*P5},Oc=function(n){var t=new D4,e=an.internal.getHeight(n)||0,r=an.internal.getWidth(n)||0;return t.BBox=[0,0,Number(Yn(r)),Number(Yn(e))],t},s_=ho.__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},a_=ho.__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)},l_=ho.__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},Mo=ho.__acroform__.getBitForPdf=function(n,t){if(isNaN(n)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return l_(n,t-1)},Co=ho.__acroform__.setBitForPdf=function(n,t){if(isNaN(n)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return s_(n,t-1)},Eo=ho.__acroform__.clearBitForPdf=function(n,t){if(isNaN(n)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return a_(n,t-1)},c_=ho.__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(Yn(f.lowerLeft_X)),Number(Yn(f.lowerLeft_Y)),Number(Yn(f.upperRight_X)),Number(Yn(f.upperRight_Y))]},u_=function(n){if(n.appearanceStreamContent)return n.appearanceStreamContent;if(n.V||n.DV){var t=[],e=n._V||n.DV,r=D2(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+" "+Yn(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=Oc(n);return s.scope=n.scope,s.stream=t.join(`
|
|
31
|
-
`),s}},D2=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(Q){return Q.split(`
|
|
32
|
-
`)}):i.map(function(Q){return[Q]});var s=e,l=an.internal.getHeight(n)||0;l=l<0?-l:l;var c=an.internal.getWidth(n)||0;c=c<0?-c:c;var f=function(Q,at,G){if(Q+1<i.length){var vt=at+" "+i[Q+1][0];return Bm(vt,n,G).width<=c-4}return!1};s++;t:for(;s>0;){t="",s--;var d,p,g=Bm("3",n,s).height,b=n.multiline?l-s:(l-g)/2,y=b+=2,A=0,E=0,L=0;if(s<=0){t=`(...) Tj
|
|
33
|
-
`,t+="% Width of Text: "+Bm(t,n,s=12).width+", FieldWidth:"+c+`
|
|
34
|
-
`;break}for(var R="",q=0,H=0;H<i.length;H++)if(i.hasOwnProperty(H)){var $=!1;if(i[H].length!==1&&L!==i[H].length-1){if((g+2)*(q+2)+2>l)continue t;R+=i[H][L],$=!0,E=H,H--}else{R=(R+=i[H][L]+" ").substr(R.length-1)==" "?R.substr(0,R.length-1):R;var ht=parseInt(H),Mt=f(ht,R,s),wt=H>=i.length-1;if(Mt&&!wt){R+=" ",L=0;continue}if(Mt||wt){if(wt)E=ht;else if(n.multiline&&(g+2)*(q+2)+2>l)continue t}else{if(!n.multiline||(g+2)*(q+2)+2>l)continue t;E=ht}}for(var bt="",ot=A;ot<=E;ot++){var Dt=i[ot];if(n.multiline){if(ot===E){bt+=Dt[L]+" ",L=(L+1)%Dt.length;continue}if(ot===A){bt+=Dt[Dt.length-1]+" ";continue}}bt+=Dt[0]+" "}switch(bt=bt.substr(bt.length-1)==" "?bt.substr(0,bt.length-1):bt,p=Bm(bt,n,s).width,n.textAlign){case"right":d=c-p-2;break;case"center":d=(c-p)/2;break;default:d=2}t+=Yn(d)+" "+Yn(y)+` Td
|
|
35
|
-
`,t+="("+fd(bt)+`) Tj
|
|
36
|
-
`,t+=-Yn(d)+` 0 Td
|
|
37
|
-
`,y=-(s+2),p=0,A=$?E:E+1,q++,R=""}break}return r.text=t,r.fontSize=s,r},Bm=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}},f_={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},d_=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)},h_=function(n,t){if(t.scope=n,n.internal!==void 0&&(n.internal.acroformPlugin===void 0||n.internal.acroformPlugin.isInitialized===!1)){if(uc.FieldNum=0,n.internal.acroformPlugin=JSON.parse(JSON.stringify(f_)),n.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");P5=n.internal.scaleFactor,n.internal.acroformPlugin.acroFormDictionaryRoot=new L4,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&&d_(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=c_(c.Rect,i)),i.internal.newObjectDeferredBegin(c.objId,!0),c.DA=an.createDefaultAppearanceStream(c),oi(c)==="object"&&typeof c.getKeyValueListForStream=="function"&&(f=c.getKeyValueListForStream()),c.Rect=d,c.hasAppearanceStream&&!c.appearanceStreamContent){var p=u_(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 A=y[l];typeof A=="function"&&(A=A.call(i,c)),g+="/"+l+" "+A+" ",i.internal.acroformPlugin.xForms.indexOf(A)>=0||i.internal.acroformPlugin.xForms.push(A)}}else typeof(A=y)=="function"&&(A=A.call(i,c)),g+="/"+l+" "+A,i.internal.acroformPlugin.xForms.indexOf(A)>=0||i.internal.acroformPlugin.xForms.push(A);g+=">>"}f.push({key:"AP",value:`<<
|
|
38
|
-
`+g+">>"})}i.internal.putStream({additionalKeyValues:f,objectId:c.objId}),i.internal.out("endobj")}s&&(function(E,L){for(var R in E)if(E.hasOwnProperty(R)){var q=R,H=E[R];L.internal.newObjectDeferredBegin(H.objId,!0),oi(H)==="object"&&typeof H.putStream=="function"&&H.putStream(),delete E[q]}})(i.internal.acroformPlugin.xForms,i)})(e,n)}),n.internal.acroformPlugin.isInitialized=!0}},_4=ho.__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+=" "),oi(n[s])){case"boolean":case"number":case"object":i+=n[s].toString();break;case"string":n[s].substr(0,1)==="/"?i+="/"+rd(n[s].substr(1)):(t!==void 0&&e&&(r=e.internal.getEncryptor(t)),i+="("+fd(r(n[s].toString()))+")")}return i+"]"}throw new Error("Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray")},Ny=function(n,t,e){var r=function(i){return i};return t!==void 0&&e&&(r=e.internal.getEncryptor(t)),(n=n||"").toString(),"("+fd(r(n))+")"},zc=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})};zc.prototype.toString=function(){return this.objId+" 0 R"},zc.prototype.putStream=function(){var n=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:n,objectId:this.objId}),this.scope.internal.out("endobj")},zc.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:_4(i,this.objId,this.scope)}):i instanceof zc?(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 D4=function(){zc.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}})};Ba(D4,zc);var L4=function(){zc.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)),"("+fd(e(n))+")"}},set:function(e){n=e}})};Ba(L4,zc);var uc=function n(){zc.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!!Mo(t,3)},set:function(R){R?this.F=Co(t,3):this.F=Eo(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 Dg)return;s="FieldObject"+n.FieldNum++}var R=function(q){return q};return this.scope&&(R=this.scope.internal.getEncryptor(this.objId)),"("+fd(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/P5: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 Dg||this instanceof Wf))return Ny(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 ns==0?Ny(b,this.objId,this.scope):b},set:function(R){R=R.toString(),b=this instanceof ns==0?R.substr(0,1)==="("?Ld(R.substr(1,R.length-2)):Ld(R):R}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof ns==1?Ld(b.substr(1,b.length-1)):b},set:function(R){R=R.toString(),b=this instanceof ns==1?"/"+rd(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 ns==0?Ny(y,this.objId,this.scope):y},set:function(R){R=R.toString(),y=this instanceof ns==0?R.substr(0,1)==="("?Ld(R.substr(1,R.length-2)):Ld(R):R}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof ns==1?Ld(y.substr(1,y.length-1)):y},set:function(R){R=R.toString(),y=this instanceof ns==1?"/"+rd(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 A,E=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return E},set:function(R){R=!!R,E=R}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(A)return A},set:function(R){A=R}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,1)},set:function(R){R?this.Ff=Co(this.Ff,1):this.Ff=Eo(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,2)},set:function(R){R?this.Ff=Co(this.Ff,2):this.Ff=Eo(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,3)},set:function(R){R?this.Ff=Co(this.Ff,3):this.Ff=Eo(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}}})};Ba(uc,zc);var Xd=function(){uc.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 _4(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!!Mo(this.Ff,18)},set:function(e){e?this.Ff=Co(this.Ff,18):this.Ff=Eo(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,19)},set:function(e){this.combo===!0&&(e?this.Ff=Co(this.Ff,19):this.Ff=Eo(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,20)},set:function(e){e?(this.Ff=Co(this.Ff,20),t.sort()):this.Ff=Eo(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,22)},set:function(e){e?this.Ff=Co(this.Ff,22):this.Ff=Eo(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,23)},set:function(e){e?this.Ff=Co(this.Ff,23):this.Ff=Eo(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,27)},set:function(e){e?this.Ff=Co(this.Ff,27):this.Ff=Eo(this.Ff,27)}}),this.hasAppearanceStream=!1};Ba(Xd,uc);var Gd=function(){Xd.call(this),this.fontName="helvetica",this.combo=!1};Ba(Gd,Xd);var Kd=function(){Gd.call(this),this.combo=!0};Ba(Kd,Gd);var pg=function(){Kd.call(this),this.edit=!0};Ba(pg,Kd);var ns=function(){uc.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,15)},set:function(e){e?this.Ff=Co(this.Ff,15):this.Ff=Eo(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,16)},set:function(e){e?this.Ff=Co(this.Ff,16):this.Ff=Eo(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,17)},set:function(e){e?this.Ff=Co(this.Ff,17):this.Ff=Eo(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,26)},set:function(e){e?this.Ff=Co(this.Ff,26):this.Ff=Eo(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+" ("+fd(e(t[r]))+")");return i.push(">>"),i.join(`
|
|
39
|
-
`)}},set:function(e){oi(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="/"+rd(r)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return n.substr(1,n.length-1)},set:function(e){n="/"+rd(e)}})};Ba(ns,uc);var mg=function(){ns.call(this),this.pushButton=!0};Ba(mg,ns);var Jd=function(){ns.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:[]}})};Ba(Jd,ns);var Dg=function(){var n,t;uc.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+" ("+fd(i(r[s]))+")");return l.push(">>"),l.join(`
|
|
40
|
-
`)},set:function(i){oi(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="/"+rd(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="/"+rd(s)}}),this.caption="l",this.appearanceState="Off",this._AppearanceType=an.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};Ba(Dg,uc),Jd.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()}},Jd.prototype.createOption=function(n){var t=new Dg;return t.Parent=this,t.optionName=n,this.Kids.push(t),p_.call(this.scope,t),t};var gg=function(){ns.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=an.CheckBox.createAppearanceStream()};Ba(gg,ns);var Wf=function(){uc.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,13)},set:function(t){t?this.Ff=Co(this.Ff,13):this.Ff=Eo(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,21)},set:function(t){t?this.Ff=Co(this.Ff,21):this.Ff=Eo(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,23)},set:function(t){t?this.Ff=Co(this.Ff,23):this.Ff=Eo(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,24)},set:function(t){t?this.Ff=Co(this.Ff,24):this.Ff=Eo(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,25)},set:function(t){t?this.Ff=Co(this.Ff,25):this.Ff=Eo(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,26)},set:function(t){t?this.Ff=Co(this.Ff,26):this.Ff=Eo(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}})};Ba(Wf,uc);var yg=function(){Wf.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!Mo(this.Ff,14)},set:function(n){n?this.Ff=Co(this.Ff,14):this.Ff=Eo(this.Ff,14)}}),this.password=!0};Ba(yg,Wf);var an={CheckBox:{createAppearanceStream:function(){return{N:{On:an.CheckBox.YesNormal},D:{On:an.CheckBox.YesPushDown,Off:an.CheckBox.OffPushDown}}},YesPushDown:function(n){var t=Oc(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=D2(n,n.caption);return e.push("0.749023 g"),e.push("0 0 "+Yn(an.internal.getWidth(n))+" "+Yn(an.internal.getHeight(n))+" re"),e.push("f"),e.push("BMC"),e.push("q"),e.push("0 0 1 rg"),e.push("/"+r+" "+Yn(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=Oc(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=an.internal.getHeight(n),l=an.internal.getWidth(n),c=D2(n,n.caption);return i.push("1 g"),i.push("0 0 "+Yn(l)+" "+Yn(s)+" re"),i.push("f"),i.push("q"),i.push("0 0 1 rg"),i.push("0 0 "+Yn(l-1)+" "+Yn(s-1)+" re"),i.push("W"),i.push("n"),i.push("0 g"),i.push("BT"),i.push("/"+e+" "+Yn(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=Oc(n);t.scope=n.scope;var e=[];return e.push("0.749023 g"),e.push("0 0 "+Yn(an.internal.getWidth(n))+" "+Yn(an.internal.getHeight(n))+" re"),e.push("f"),t.stream=e.join(`
|
|
43
|
-
`),t}},RadioButton:{Circle:{createAppearanceStream:function(n){var t={D:{Off:an.RadioButton.Circle.OffPushDown},N:{}};return t.N[n]=an.RadioButton.Circle.YesNormal,t.D[n]=an.RadioButton.Circle.YesPushDown,t},getCA:function(){return"l"},YesNormal:function(n){var t=Oc(n);t.scope=n.scope;var e=[],r=an.internal.getWidth(n)<=an.internal.getHeight(n)?an.internal.getWidth(n)/4:an.internal.getHeight(n)/4;r=Number((.9*r).toFixed(5));var i=an.internal.Bezier_C,s=Number((r*i).toFixed(5));return e.push("q"),e.push("1 0 0 1 "+Ju(an.internal.getWidth(n)/2)+" "+Ju(an.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=Oc(n);t.scope=n.scope;var e=[],r=an.internal.getWidth(n)<=an.internal.getHeight(n)?an.internal.getWidth(n)/4:an.internal.getHeight(n)/4;r=Number((.9*r).toFixed(5));var i=Number((2*r).toFixed(5)),s=Number((i*an.internal.Bezier_C).toFixed(5)),l=Number((r*an.internal.Bezier_C).toFixed(5));return e.push("0.749023 g"),e.push("q"),e.push("1 0 0 1 "+Ju(an.internal.getWidth(n)/2)+" "+Ju(an.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 "+Ju(an.internal.getWidth(n)/2)+" "+Ju(an.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=Oc(n);t.scope=n.scope;var e=[],r=an.internal.getWidth(n)<=an.internal.getHeight(n)?an.internal.getWidth(n)/4:an.internal.getHeight(n)/4;r=Number((.9*r).toFixed(5));var i=Number((2*r).toFixed(5)),s=Number((i*an.internal.Bezier_C).toFixed(5));return e.push("0.749023 g"),e.push("q"),e.push("1 0 0 1 "+Ju(an.internal.getWidth(n)/2)+" "+Ju(an.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:an.RadioButton.Cross.OffPushDown},N:{}};return t.N[n]=an.RadioButton.Cross.YesNormal,t.D[n]=an.RadioButton.Cross.YesPushDown,t},getCA:function(){return"8"},YesNormal:function(n){var t=Oc(n);t.scope=n.scope;var e=[],r=an.internal.calculateCross(n);return e.push("q"),e.push("1 1 "+Yn(an.internal.getWidth(n)-2)+" "+Yn(an.internal.getHeight(n)-2)+" re"),e.push("W"),e.push("n"),e.push(Yn(r.x1.x)+" "+Yn(r.x1.y)+" m"),e.push(Yn(r.x2.x)+" "+Yn(r.x2.y)+" l"),e.push(Yn(r.x4.x)+" "+Yn(r.x4.y)+" m"),e.push(Yn(r.x3.x)+" "+Yn(r.x3.y)+" l"),e.push("s"),e.push("Q"),t.stream=e.join(`
|
|
47
|
-
`),t},YesPushDown:function(n){var t=Oc(n);t.scope=n.scope;var e=an.internal.calculateCross(n),r=[];return r.push("0.749023 g"),r.push("0 0 "+Yn(an.internal.getWidth(n))+" "+Yn(an.internal.getHeight(n))+" re"),r.push("f"),r.push("q"),r.push("1 1 "+Yn(an.internal.getWidth(n)-2)+" "+Yn(an.internal.getHeight(n)-2)+" re"),r.push("W"),r.push("n"),r.push(Yn(e.x1.x)+" "+Yn(e.x1.y)+" m"),r.push(Yn(e.x2.x)+" "+Yn(e.x2.y)+" l"),r.push(Yn(e.x4.x)+" "+Yn(e.x4.y)+" m"),r.push(Yn(e.x3.x)+" "+Yn(e.x3.y)+" l"),r.push("s"),r.push("Q"),t.stream=r.join(`
|
|
48
|
-
`),t},OffPushDown:function(n){var t=Oc(n);t.scope=n.scope;var e=[];return e.push("0.749023 g"),e.push("0 0 "+Yn(an.internal.getWidth(n))+" "+Yn(an.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}};an.internal={Bezier_C:.551915024494,calculateCross:function(n){var t=an.internal.getWidth(n),e=an.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}}}},an.internal.getWidth=function(n){var t=0;return oi(n)==="object"&&(t=$w(n.Rect[2])),t},an.internal.getHeight=function(n){var t=0;return oi(n)==="object"&&(t=$w(n.Rect[3])),t};var p_=ho.addField=function(n){if(h_(this,n),!(n instanceof uc))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};ho.AcroFormChoiceField=Xd,ho.AcroFormListBox=Gd,ho.AcroFormComboBox=Kd,ho.AcroFormEditBox=pg,ho.AcroFormButton=ns,ho.AcroFormPushButton=mg,ho.AcroFormRadioButton=Jd,ho.AcroFormCheckBox=gg,ho.AcroFormTextField=Wf,ho.AcroFormPasswordField=yg,ho.AcroFormAppearance=an,ho.AcroForm={ChoiceField:Xd,ListBox:Gd,ComboBox:Kd,EditBox:pg,Button:ns,PushButton:mg,RadioButton:Jd,CheckBox:gg,TextField:Wf,PasswordField:yg,Appearance:an},pn.AcroForm={ChoiceField:Xd,ListBox:Gd,ComboBox:Kd,EditBox:pg,Button:ns,PushButton:mg,RadioButton:Jd,CheckBox:gg,TextField:Wf,PasswordField:yg,Appearance:an};pn.AcroForm;function R4(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(Q,at){var G,vt,Tt,gt,Z,lt=e;if((at=at||e)==="RGBA"||Q.data!==void 0&&Q.data instanceof Uint8ClampedArray&&"height"in Q&&"width"in Q)return"RGBA";if(Mt(Q))for(Z in r)for(Tt=r[Z],G=0;G<Tt.length;G+=1){for(gt=!0,vt=0;vt<Tt[G].length;vt+=1)if(Tt[G][vt]!==void 0&&Tt[G][vt]!==Q[vt]){gt=!1;break}if(gt===!0){lt=Z;break}}else for(Z in r)for(Tt=r[Z],G=0;G<Tt.length;G+=1){for(gt=!0,vt=0;vt<Tt[G].length;vt+=1)if(Tt[G][vt]!==void 0&&Tt[G][vt]!==Q.charCodeAt(vt)){gt=!1;break}if(gt===!0){lt=Z;break}}return lt===e&&at!==e&&(lt=at),lt},s=function Q(at){for(var G=this.internal.write,vt=this.internal.putStream,Tt=(0,this.internal.getFilters)();Tt.indexOf("FlateEncode")!==-1;)Tt.splice(Tt.indexOf("FlateEncode"),1);at.objectId=this.internal.newObject();var gt=[];if(gt.push({key:"Type",value:"/XObject"}),gt.push({key:"Subtype",value:"/Image"}),gt.push({key:"Width",value:at.width}),gt.push({key:"Height",value:at.height}),at.colorSpace===R.INDEXED?gt.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(at.palette.length/3-1)+" "+("sMask"in at&&at.sMask!==void 0?at.objectId+2:at.objectId+1)+" 0 R]"}):(gt.push({key:"ColorSpace",value:"/"+at.colorSpace}),at.colorSpace===R.DEVICE_CMYK&>.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),gt.push({key:"BitsPerComponent",value:at.bitsPerComponent}),"decodeParameters"in at&&at.decodeParameters!==void 0&>.push({key:"DecodeParms",value:"<<"+at.decodeParameters+">>"}),"transparency"in at&&Array.isArray(at.transparency)&&at.transparency.length>0){for(var Z="",lt=0,Bt=at.transparency.length;lt<Bt;lt++)Z+=at.transparency[lt]+" "+at.transparency[lt]+" ";gt.push({key:"Mask",value:"["+Z+"]"})}at.sMask!==void 0&>.push({key:"SMask",value:at.objectId+1+" 0 R"});var ee=at.filter!==void 0?["/"+at.filter]:void 0;if(vt({data:at.data,additionalKeyValues:gt,alreadyAppliedFilters:ee,objectId:at.objectId}),G("endobj"),"sMask"in at&&at.sMask!==void 0){var J,_=(J=at.sMaskBitsPerComponent)!==null&&J!==void 0?J:at.bitsPerComponent,K={width:at.width,height:at.height,colorSpace:"DeviceGray",bitsPerComponent:_,data:at.sMask};"filter"in at&&(K.decodeParameters="/Predictor ".concat(at.predictor," /Colors 1 /BitsPerComponent ").concat(_," /Columns ").concat(at.width),K.filter=at.filter),Q.call(this,K)}if(at.colorSpace===R.INDEXED){var V=this.internal.newObject();vt({data:bt(new Uint8Array(at.palette)),objectId:V}),G("endobj")}},l=function(){var Q=this.internal.collections[t+"images"];for(var at in Q)s.call(this,Q[at])},c=function(){var Q,at=this.internal.collections[t+"images"],G=this.internal.write;for(var vt in at)G("/I"+(Q=at[vt]).index,Q.objectId,"0","R")},f=function(){this.internal.collections[t+"images"]||(this.internal.collections[t+"images"]={},this.internal.events.subscribe("putResources",l),this.internal.events.subscribe("putXobjectDict",c))},d=function(){var Q=this.internal.collections[t+"images"];return f.call(this),Q},p=function(){return Object.keys(this.internal.collections[t+"images"]).length},g=function(Q){return typeof n["process"+Q.toUpperCase()]=="function"},b=function(Q){return oi(Q)==="object"&&Q.nodeType===1},y=function(Q,at){if(Q.nodeName==="IMG"&&Q.hasAttribute("src")){var G=""+Q.getAttribute("src");if(G.indexOf("data:image/")===0)return hg(unescape(G).split("base64,").pop());var vt=n.loadFile(G,!0);if(vt!==void 0)return vt}if(Q.nodeName==="CANVAS"){if(Q.width===0||Q.height===0)throw new Error("Given canvas must have data. Canvas width: "+Q.width+", height: "+Q.height);var Tt;switch(at){case"PNG":Tt="image/png";break;case"WEBP":Tt="image/webp";break;default:Tt="image/jpeg"}return hg(Q.toDataURL(Tt,1).split("base64,").pop())}},A=function(Q){var at=this.internal.collections[t+"images"];if(at){for(var G in at)if(Q===at[G].alias)return at[G]}},E=function(Q,at,G){return Q||at||(Q=-96,at=-96),Q<0&&(Q=-1*G.width*72/Q/this.internal.scaleFactor),at<0&&(at=-1*G.height*72/at/this.internal.scaleFactor),Q===0&&(Q=at*G.width/G.height),at===0&&(at=Q*G.height/G.width),[Q,at]},L=function(Q,at,G,vt,Tt,gt){var Z=E.call(this,G,vt,Tt),lt=this.internal.getCoordinateString,Bt=this.internal.getVerticalCoordinateString,ee=d.call(this);if(G=Z[0],vt=Z[1],ee[Tt.index]=Tt,gt){gt*=Math.PI/180;var J=Math.cos(gt),_=Math.sin(gt),K=function(ut){return ut.toFixed(4)},V=[K(J),K(_),K(-1*_),K(J),0,0,"cm"]}this.internal.write("q"),gt?(this.internal.write([1,"0","0",1,lt(Q),Bt(at+vt),"cm"].join(" ")),this.internal.write(V.join(" ")),this.internal.write([lt(G),"0","0",lt(vt),"0","0","cm"].join(" "))):this.internal.write([lt(G),"0","0",lt(vt),lt(Q),Bt(at+vt),"cm"].join(" ")),this.isAdvancedAPI()&&this.internal.write([1,0,0,-1,0,0,"cm"].join(" ")),this.internal.write("/I"+Tt.index+" Do"),this.internal.write("Q")},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 q=n.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},H=n.__addimage__.sHashCode=function(Q){var at,G,vt=0;if(typeof Q=="string")for(G=Q.length,at=0;at<G;at++)vt=(vt<<5)-vt+Q.charCodeAt(at),vt|=0;else if(Mt(Q))for(G=Q.byteLength/2,at=0;at<G;at++)vt=(vt<<5)-vt+Q[at],vt|=0;return vt},$=n.__addimage__.validateStringAsBase64=function(Q){(Q=Q||"").toString().trim();var at=!0;return Q.length===0&&(at=!1),Q.length%4!=0&&(at=!1),/^[A-Za-z0-9+/]+$/.test(Q.substr(0,Q.length-2))===!1&&(at=!1),/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(Q.substr(-2))===!1&&(at=!1),at},ht=n.__addimage__.extractImageFromDataUrl=function(Q){if(Q==null||!(Q=Q.trim()).startsWith("data:"))return null;var at=Q.indexOf(",");return at<0?null:Q.substring(0,at).trim().endsWith("base64")?Q.substring(at+1):null};n.__addimage__.isArrayBuffer=function(Q){return Q instanceof ArrayBuffer};var Mt=n.__addimage__.isArrayBufferView=function(Q){return Q instanceof Int8Array||Q instanceof Uint8Array||Q instanceof Uint8ClampedArray||Q instanceof Int16Array||Q instanceof Uint16Array||Q instanceof Int32Array||Q instanceof Uint32Array||Q instanceof Float32Array||Q instanceof Float64Array},wt=n.__addimage__.binaryStringToUint8Array=function(Q){for(var at=Q.length,G=new Uint8Array(at),vt=0;vt<at;vt++)G[vt]=Q.charCodeAt(vt);return G},bt=n.__addimage__.arrayBufferToBinaryString=function(Q){for(var at="",G=Mt(Q)?Q:new Uint8Array(Q),vt=0;vt<G.length;vt+=8192)at+=String.fromCharCode.apply(null,G.subarray(vt,vt+8192));return at};n.addImage=function(){var Q,at,G,vt,Tt,gt,Z,lt,Bt;if(typeof arguments[1]=="number"?(at=e,G=arguments[1],vt=arguments[2],Tt=arguments[3],gt=arguments[4],Z=arguments[5],lt=arguments[6],Bt=arguments[7]):(at=arguments[1],G=arguments[2],vt=arguments[3],Tt=arguments[4],gt=arguments[5],Z=arguments[6],lt=arguments[7],Bt=arguments[8]),oi(Q=arguments[0])==="object"&&!b(Q)&&"imageData"in Q){var ee=Q;Q=ee.imageData,at=ee.format||at||e,G=ee.x||G||0,vt=ee.y||vt||0,Tt=ee.w||ee.width||Tt,gt=ee.h||ee.height||gt,Z=ee.alias||Z,lt=ee.compression||lt,Bt=ee.rotation||ee.angle||Bt}var J=this.internal.getFilters();if(lt===void 0&&J.indexOf("FlateEncode")!==-1&&(lt="SLOW"),isNaN(G)||isNaN(vt))throw new Error("Invalid coordinates passed to jsPDF.addImage");f.call(this);var _=ot.call(this,Q,at,Z,lt);return L.call(this,G,vt,Tt,gt,_,Bt),this};var ot=function(Q,at,G,vt){var Tt,gt,Z;if(typeof Q=="string"&&i(Q)===e){Q=unescape(Q);var lt=Dt(Q,!1);(lt!==""||(lt=n.loadFile(Q,!0))!==void 0)&&(Q=lt)}if(b(Q)&&(Q=y(Q,at)),at=i(Q,at),!g(at))throw new Error("addImage does not support files of type '"+at+"', please ensure that a plugin for '"+at+"' support is added.");if(((Z=G)==null||Z.length===0)&&(G=(function(Bt){return typeof Bt=="string"||Mt(Bt)?H(Bt):Mt(Bt.data)?H(Bt.data):null})(Q)),(Tt=A.call(this,G))||(Q instanceof Uint8Array||at==="RGBA"||(gt=Q,Q=wt(Q)),Tt=this["process"+at.toUpperCase()](Q,p.call(this),G,(function(Bt){return Bt&&typeof Bt=="string"&&(Bt=Bt.toUpperCase()),Bt in n.image_compression?Bt:q.NONE})(vt),gt)),!Tt)throw new Error("An unknown error occurred whilst processing the image.");return Tt},Dt=n.__addimage__.convertBase64ToBinaryString=function(Q,at){at=typeof at!="boolean"||at;var G,vt="";if(typeof Q=="string"){var Tt;G=(Tt=ht(Q))!==null&&Tt!==void 0?Tt:Q;try{vt=hg(G)}catch(gt){if(at)throw $(G)?new Error("atob-Error in jsPDF.convertBase64ToBinaryString "+gt.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ")}}return vt};n.getImageProperties=function(Q){var at,G,vt="";if(b(Q)&&(Q=y(Q)),typeof Q=="string"&&i(Q)===e&&((vt=Dt(Q,!1))===""&&(vt=n.loadFile(Q)||""),Q=vt),G=i(Q),!g(G))throw new Error("addImage does not support files of type '"+G+"', please ensure that a plugin for '"+G+"' support is added.");if(Q instanceof Uint8Array||(Q=wt(Q)),!(at=this["process"+G.toUpperCase()](Q)))throw new Error("An unknown error occurred whilst processing the image");return at.fileType=G,at}})(pn.API),(function(n){var t=function(e){if(e!==void 0&&e!="")return!0};pn.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,A=this.internal.getEncryptor(e.objId);switch(r.type){case"reference":this.internal.write(" "+r.object.objId+" 0 R ");break;case"text":var E=this.internal.newAdditionalObject(),L=this.internal.newAdditionalObject(),R=this.internal.getEncryptor(E.objId),q=r.title||"Note";s="<</Type /Annot /Subtype /Text "+(i="/Rect ["+l(r.bounds.x)+" "+c(r.bounds.y+r.bounds.h)+" "+l(r.bounds.x+r.bounds.w)+" "+c(r.bounds.y)+"] ")+"/Contents ("+y(R(r.contents))+")",s+=" /Popup "+L.objId+" 0 R",s+=" /P "+f.objId+" 0 R",s+=" /T ("+y(R(q))+") >>",E.content=s;var H=E.objId+" 0 R";s="<</Type /Annot /Subtype /Popup "+(i="/Rect ["+l(r.bounds.x+30)+" "+c(r.bounds.y+r.bounds.h)+" "+l(r.bounds.x+r.bounds.w+30)+" "+c(r.bounds.y)+"] ")+" /Parent "+H,r.open&&(s+=" /Open true"),s+=" >>",L.content=s,this.internal.write(E.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 $="font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+(r.color||"#000000");s="<</Type /Annot /Subtype /FreeText "+i+"/Contents ("+y(A(r.contents))+")",s+=" /DS("+y(A($))+")",s+=" /Border [0 0 0]",s+=" >>",this.internal.write(s);break;case"link":if(r.options.name){var ht=this.annotations._nameMap[r.options.name];r.options.pageNumber=ht.page,r.options.top=ht.y}else r.options.top||(r.options.top=0);if(i="/Rect ["+r.finalBounds.x+" "+r.finalBounds.y+" "+r.finalBounds.w+" "+r.finalBounds.h+"] ",s="",r.options.url)s="<</Type /Annot /Subtype /Link "+i+"/Border [0 0 0] /A <</S /URI /URI ("+y(A(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}})(pn.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(E){return t[E.charCodeAt(0)]!==void 0},l=n.__arabicParser__.isArabicLetter=function(E){return typeof E=="string"&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(E)},c=n.__arabicParser__.isArabicEndLetter=function(E){return l(E)&&s(E)&&t[E.charCodeAt(0)].length<=2},f=n.__arabicParser__.isArabicAlfLetter=function(E){return l(E)&&i.indexOf(E.charCodeAt(0))>=0};n.__arabicParser__.arabicLetterHasIsolatedForm=function(E){return l(E)&&s(E)&&t[E.charCodeAt(0)].length>=1};var d=n.__arabicParser__.arabicLetterHasFinalForm=function(E){return l(E)&&s(E)&&t[E.charCodeAt(0)].length>=2};n.__arabicParser__.arabicLetterHasInitialForm=function(E){return l(E)&&s(E)&&t[E.charCodeAt(0)].length>=3};var p=n.__arabicParser__.arabicLetterHasMedialForm=function(E){return l(E)&&s(E)&&t[E.charCodeAt(0)].length==4},g=n.__arabicParser__.resolveLigatures=function(E){var L=0,R=e,q="",H=0;for(L=0;L<E.length;L+=1)R[E.charCodeAt(L)]!==void 0?(H++,typeof(R=R[E.charCodeAt(L)])=="number"&&(q+=String.fromCharCode(R),R=e,H=0),L===E.length-1&&(R=e,q+=E.charAt(L-(H-1)),L-=H-1,H=0)):(R=e,q+=E.charAt(L-H),L-=H,H=0);return q};n.__arabicParser__.isArabicDiacritic=function(E){return E!==void 0&&r[E.charCodeAt(0)]!==void 0};var b=n.__arabicParser__.getCorrectForm=function(E,L,R){return l(E)?s(E)===!1?-1:!d(E)||!l(L)&&!l(R)||!l(R)&&c(L)||c(E)&&!l(L)||c(E)&&f(L)||c(E)&&c(L)?0:p(E)&&l(L)&&!c(L)&&l(R)&&d(R)?3:c(E)||!l(R)?1:2:-1},y=function(E){var L=0,R=0,q=0,H="",$="",ht="",Mt=(E=E||"").split("\\s+"),wt=[];for(L=0;L<Mt.length;L+=1){for(wt.push(""),R=0;R<Mt[L].length;R+=1)H=Mt[L][R],$=Mt[L][R-1],ht=Mt[L][R+1],l(H)?(q=b(H,$,ht),wt[L]+=q!==-1?String.fromCharCode(t[H.charCodeAt(0)][q]):H):wt[L]+=H;wt[L]=g(wt[L])}return wt.join(" ")},A=n.__arabicParser__.processArabic=n.processArabic=function(){var E,L=typeof arguments[0]=="string"?arguments[0]:arguments[0].text,R=[];if(Array.isArray(L)){var q=0;for(R=[],q=0;q<L.length;q+=1)Array.isArray(L[q])?R.push([y(L[q][0]),L[q][1],L[q][2]]):R.push([y(L[q])]);E=R}else E=y(L);return typeof arguments[0]=="string"?E:(arguments[0].text=E,arguments[0])};n.events.push(["preProcessText",A])})(pn.API),pn.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}])})(pn.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(E){f=E}});var d=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return d},set:function(E){d=E}});var p=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return p},set:function(E){p=E}});var g=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return g},set:function(E){g=E}});var b=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return b},set:function(E){b=E}});var y=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return y},set:function(E){y=E}});var A=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return A},set:function(E){A=E}}),this};s.prototype.clone=function(){return new s(this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align)},s.prototype.toArray=function(){return[this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align]},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,A=0,E=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(H,$){return H.concat(L.splitTextToSize($,R))},[])):f=Array.isArray(f)?f:[f];for(var q=0;q<f.length;q++)y<(E=this.getStringUnitWidth(f[q],{font:g})*p)&&(y=E);return y!==0&&(A=f.length),{w:y/=b,h:Math.max((A*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,A,E,L,R=[],q=[],H=[],$={},ht={},Mt=[],wt=[],bt=(b=b||{}).autoSize||!1,ot=b.printHeaders!==!1,Dt=b.css&&b.css["font-size"]!==void 0?16*b.css["font-size"]:b.fontSize||12,Q=b.margins||Object.assign({width:this.getPageWidth()},t),at=typeof b.padding=="number"?b.padding:3,G=b.headerBackgroundColor||"#c8c8c8",vt=b.headerTextColor||"#000";if(i.call(this),this.internal.__cell__.printHeaders=ot,this.internal.__cell__.margins=Q,this.internal.__cell__.table_font_size=Dt,this.internal.__cell__.padding=at,this.internal.__cell__.headerBackgroundColor=G,this.internal.__cell__.headerTextColor=vt,this.setFontSize(Dt),g==null)q=R=Object.keys(p[0]),H=R.map(function(){return"left"});else if(Array.isArray(g)&&oi(g[0])==="object")for(R=g.map(function(ee){return ee.name}),q=g.map(function(ee){return ee.prompt||ee.name||""}),H=g.map(function(ee){return ee.align||"left"}),y=0;y<g.length;y+=1)ht[g[y].name]=.7499990551181103*g[y].width;else Array.isArray(g)&&typeof g[0]=="string"&&(q=R=g,H=R.map(function(){return"left"}));if(bt||Array.isArray(g)&&typeof g[0]=="string")for(y=0;y<R.length;y+=1){for($[L=R[y]]=p.map(function(ee){return ee[L]}),this.setFont(void 0,"bold"),Mt.push(this.getTextDimensions(q[y],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),A=$[L],this.setFont(void 0,"normal"),E=0;E<A.length;E+=1)Mt.push(this.getTextDimensions(A[E],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);ht[L]=Math.max.apply(null,Mt)+at+at,Mt=[]}if(ot){var Tt={};for(y=0;y<R.length;y+=1)Tt[R[y]]={},Tt[R[y]].text=q[y],Tt[R[y]].align=H[y];var gt=c.call(this,Tt,ht);wt=R.map(function(ee){return new s(f,d,ht[ee],gt,Tt[ee].text,void 0,Tt[ee].align)}),this.setTableHeaderRow(wt),this.printHeaderRow(1,!1)}var Z=g.reduce(function(ee,J){return ee[J.name]=J.align,ee},{});for(y=0;y<p.length;y+=1){"rowStart"in b&&b.rowStart instanceof Function&&b.rowStart({row:y,data:p[y]},this);var lt=c.call(this,p[y],ht);for(E=0;E<R.length;E+=1){var Bt=p[y][R[E]];"cellStart"in b&&b.cellStart instanceof Function&&b.cellStart({row:y,col:E,data:Bt},this),l.call(this,new s(f,d,ht[R[E]],lt,Bt,y+2,Z[R[E]]))}}return this.internal.__cell__.table_x=f,this.internal.__cell__.table_y=d,this};var c=function(f,d){var p=this.internal.__cell__.padding,g=this.internal.__cell__.table_font_size,b=this.internal.scaleFactor;return Object.keys(f).map(function(y){var A=f[y];return this.splitTextToSize(A.hasOwnProperty("text")?A.text:A,d[y]-p-p)},this).map(function(y){return this.getLineHeightFactor()*y.length*g/b+p+p},this).reduce(function(y,A){return Math.max(y,A)},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 A=this.getTextColor();this.setTextColor(this.internal.__cell__.headerTextColor),this.setFillColor(this.internal.__cell__.headerBackgroundColor),l.call(this,p),this.setTextColor(A)}b.length>0&&this.setTableHeaderRow(b),this.setFont(void 0,"normal"),e=!1}})(pn.API);var O4={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},P4=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],L2=R4(P4),j4=[100,200,300,400,500,600,700,800,900],m_=R4(j4);function _y(n){var t=n.family.replace(/"|'/g,"").toLowerCase(),e=(function(s){return O4[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 L2[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 Yw(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 g_={"sans-serif":"helvetica",fixed:"courier",monospace:"courier",terminal:"courier",cursive:"times",fantasy:"times",serif:"times"},Vw={caption:"times",icon:"times",menu:"times","message-box":"times","small-caption":"times","status-bar":"times"};function Ww(n){return[n.stretch,n.style,n.weight,n.family].join(" ")}function Xw(n){return n.trimLeft()}function y_(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 b_(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 Rd,Fm,Gw,Kw,Jw,Dy=["times"];function Zw(n,t,e,r,i){var s=4,l=tS;switch(i){case pn.API.image_compression.FAST:s=1,l=Qw;break;case pn.API.image_compression.MEDIUM:s=6,l=eS;break;case pn.API.image_compression.SLOW:s=9,l=nS}n=(function(f,d,p,g){for(var b,y=f.length/d,A=new Uint8Array(f.length+y),E=[x_,Qw,tS,eS,nS],L=0;L<y;L+=1){var R=L*d,q=f.subarray(R,R+d);if(g)A.set(g(q,p,b),R+L);else{for(var H=E.length,$=[],ht=0;ht<H;ht+=1)$[ht]=E[ht](q,p,b);var Mt=w_($.concat());A.set($[Mt],R+L)}b=q}return A})(n,t,Math.ceil(e*r/8),l);var c=M2(n,{level:s});return pn.API.__addimage__.arrayBufferToBinaryString(c)}function x_(n){var t=Array.apply([],n);return t.unshift(0),t}function Qw(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 tS(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 eS(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 nS(n,t,e){var r=n.length,i=[];i[0]=4;for(var s=0;s<r;s+=1){var l=v_(n[s-t]||0,e&&e[s]||0,e&&e[s-t]||0);i[s+1]=n[s]-l+256&255}return i}function v_(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 w_(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 Ly(n,t,e){var r=t*e,i=Math.floor(r/8),s=16-(r-8*i+e),l=(1<<e)-1;return I4(n,i)>>s&l}function rS(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,I4(n,s)&~(c<<l)&65535|f)}function I4(n,t){return t+1<n.byteLength?n.getUint16(t,!1):n.getUint8(t)<<8}function S_(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,A=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,A=n[t++]|n[t++]<<8,t++;else for(t+=12;;){if(!((Q=n[t++])>=0))throw Error("Invalid block size");if(Q===0)break;t+=Q}break;case 249:if(n[t++]!==4||n[t+4]!==0)throw new Error("Invalid graphics extension block.");var E=n[t++];g=n[t++]|n[t++]<<8,b=n[t++],1&E||(b=null),y=E>>2&7,t++;break;case 254:for(;;){if(!((Q=n[t++])>=0))throw Error("Invalid block size");if(Q===0)break;t+=Q}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,q=n[t++]|n[t++]<<8,H=n[t++]|n[t++]<<8,$=n[t++],ht=$>>6&1,Mt=1<<1+(7&$),wt=c,bt=f,ot=!1;$>>7&&(ot=!0,wt=t,bt=Mt,t+=3*Mt);var Dt=t;for(t++;;){var Q;if(!((Q=n[t++])>=0))throw Error("Invalid block size");if(Q===0)break;t+=Q}p.push({x:L,y:R,width:q,height:H,has_local_palette:ot,palette_offset:wt,palette_size:bt,data_offset:Dt,data_length:t-Dt,transparent_index:b,interlaced:!!ht,delay:g,disposal:y});break;case 59:d=!1;break;default:throw new Error("Unknown gif block: 0x"+n[t-1].toString(16))}this.numFrames=function(){return p.length},this.loopCount=function(){return A},this.frameInfo=function(at){if(at<0||at>=p.length)throw new Error("Frame index out of range.");return p[at]},this.decodeAndBlitFrameBGRA=function(at,G){var vt=this.frameInfo(at),Tt=vt.width*vt.height;if(Tt>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var gt=new Uint8Array(Tt);iS(n,vt.data_offset,gt,Tt);var Z=vt.palette_offset,lt=vt.transparent_index;lt===null&&(lt=256);var Bt=vt.width,ee=e-Bt,J=Bt,_=4*(vt.y*e+vt.x),K=4*((vt.y+vt.height)*e+vt.x),V=_,ut=4*ee;vt.interlaced===!0&&(ut+=4*e*7);for(var xt=8,At=0,Ft=gt.length;At<Ft;++At){var Lt=gt[At];if(J===0&&(J=Bt,(V+=ut)>=K&&(ut=4*ee+4*e*(xt-1),V=_+(Bt+ee)*(xt<<1),xt>>=1)),Lt===lt)V+=4;else{var Zt=n[Z+3*Lt],ve=n[Z+3*Lt+1],je=n[Z+3*Lt+2];G[V++]=je,G[V++]=ve,G[V++]=Zt,G[V++]=255}--J}},this.decodeAndBlitFrameRGBA=function(at,G){var vt=this.frameInfo(at),Tt=vt.width*vt.height;if(Tt>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var gt=new Uint8Array(Tt);iS(n,vt.data_offset,gt,Tt);var Z=vt.palette_offset,lt=vt.transparent_index;lt===null&&(lt=256);var Bt=vt.width,ee=e-Bt,J=Bt,_=4*(vt.y*e+vt.x),K=4*((vt.y+vt.height)*e+vt.x),V=_,ut=4*ee;vt.interlaced===!0&&(ut+=4*e*7);for(var xt=8,At=0,Ft=gt.length;At<Ft;++At){var Lt=gt[At];if(J===0&&(J=Bt,(V+=ut)>=K&&(ut=4*ee+4*e*(xt-1),V=_+(Bt+ee)*(xt<<1),xt>>=1)),Lt===lt)V+=4;else{var Zt=n[Z+3*Lt],ve=n[Z+3*Lt+1],je=n[Z+3*Lt+2];G[V++]=Zt,G[V++]=ve,G[V++]=je,G[V++]=255}--J}}}function iS(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++],A=new Int32Array(4096),E=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:E,q=0,H=R;H>s;)H=A[H]>>8,++q;var $=H;if(b+q+(R!==L?1:0)>r)return void Ai.log("Warning, gif stream longer than expected.");e[b++]=$;var ht=b+=q;for(R!==L&&(e[b++]=$),H=R;q--;)H=A[H],e[--ht]=255&H,H>>=8;E!==null&&c<4096&&(A[c++]=E<<8|$,c>=d+1&&f<12&&(++f,d=d<<1|1)),E=L}else c=l+1,d=(1<<(f=i+1))-1,E=null}return b!==r&&Ai.log("Warning, gif stream shorter than expected."),e}function Ry(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),A=new Array(64),E=[],L=0,R=7,q=new Array(64),H=new Array(64),$=new Array(64),ht=new Array(256),Mt=new Array(2048),wt=[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],ot=[0,1,2,3,4,5,6,7,8,9,10,11],Dt=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],Q=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],at=[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],Tt=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function gt(_,K){for(var V=0,ut=0,xt=new Array,At=1;At<=16;At++){for(var Ft=1;Ft<=_[At];Ft++)xt[K[ut]]=[],xt[K[ut]][0]=V,xt[K[ut]][1]=At,ut++,V++;V*=2}return xt}function Z(_){for(var K=_[0],V=_[1]-1;V>=0;)K&1<<V&&(L|=1<<R),V--,--R<0&&(L==255?(lt(255),lt(0)):lt(L),R=7,L=0)}function lt(_){E.push(_)}function Bt(_){lt(_>>8&255),lt(255&_)}function ee(_,K,V,ut,xt){for(var At,Ft=xt[0],Lt=xt[240],Zt=(function(ye,Te){var Ne,_e,Ue,cn,In,Fe,_n,dn,ze,Xe,Ie=0;for(ze=0;ze<8;++ze){Ne=ye[Ie],_e=ye[Ie+1],Ue=ye[Ie+2],cn=ye[Ie+3],In=ye[Ie+4],Fe=ye[Ie+5],_n=ye[Ie+6];var kr=Ne+(dn=ye[Ie+7]),wn=Ne-dn,nn=_e+_n,ln=_e-_n,Ln=Ue+Fe,Ze=Ue-Fe,ur=cn+In,gn=cn-In,xn=kr+ur,gr=kr-ur,Mn=nn+Ln,Ke=nn-Ln;ye[Ie]=xn+Mn,ye[Ie+4]=xn-Mn;var Vn=.707106781*(Ke+gr);ye[Ie+2]=gr+Vn,ye[Ie+6]=gr-Vn;var ss=.382683433*((xn=gn+Ze)-(Ke=ln+wn)),Ei=.5411961*xn+ss,Qt=1.306562965*Ke+ss,Re=.707106781*(Mn=Ze+ln),Me=wn+Re,Oe=wn-Re;ye[Ie+5]=Oe+Ei,ye[Ie+3]=Oe-Ei,ye[Ie+1]=Me+Qt,ye[Ie+7]=Me-Qt,Ie+=8}for(Ie=0,ze=0;ze<8;++ze){Ne=ye[Ie],_e=ye[Ie+8],Ue=ye[Ie+16],cn=ye[Ie+24],In=ye[Ie+32],Fe=ye[Ie+40],_n=ye[Ie+48];var Xn=Ne+(dn=ye[Ie+56]),Bn=Ne-dn,or=_e+_n,Fn=_e-_n,si=Ue+Fe,mi=Ue-Fe,Wt=cn+In,ai=cn-In,Ar=Xn+Wt,er=Xn-Wt,Ti=or+si,Yo=or-si;ye[Ie]=Ar+Ti,ye[Ie+32]=Ar-Ti;var li=.707106781*(Yo+er);ye[Ie+16]=er+li,ye[Ie+48]=er-li;var Or=.382683433*((Ar=ai+mi)-(Yo=Fn+Bn)),ta=.5411961*Ar+Or,ea=1.306562965*Yo+Or,fa=.707106781*(Ti=mi+Fn),as=Bn+fa,Bo=Bn-fa;ye[Ie+40]=Bo+ta,ye[Ie+24]=Bo-ta,ye[Ie+8]=as+ea,ye[Ie+56]=as-ea,Ie++}for(ze=0;ze<64;++ze)Xe=ye[ze]*Te[ze],y[ze]=Xe>0?Xe+.5|0:Xe-.5|0;return y})(_,K),ve=0;ve<64;++ve)A[wt[ve]]=Zt[ve];var je=A[0]-V;V=A[0],je==0?Z(ut[0]):(Z(ut[b[At=32767+je]]),Z(g[At]));for(var Pe=63;Pe>0&&A[Pe]==0;)Pe--;if(Pe==0)return Z(Ft),V;for(var We,ct=1;ct<=Pe;){for(var Le=ct;A[ct]==0&&ct<=Pe;)++ct;var Pn=ct-Le;if(Pn>=16){We=Pn>>4;for(var fe=1;fe<=We;++fe)Z(Lt);Pn&=15}At=32767+A[ct],Z(xt[(Pn<<4)+b[At]]),Z(g[At]),ct++}return Pe!=63&&Z(Ft),V}function J(_){_=Math.min(Math.max(_,1),100),s!=_&&((function(K){for(var V=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],ut=0;ut<64;ut++){var xt=l((V[ut]*K+50)/100);xt=Math.min(Math.max(xt,1),255),c[wt[ut]]=xt}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 Lt=l((At[Ft]*K+50)/100);Lt=Math.min(Math.max(Lt,1),255),f[wt[Ft]]=Lt}for(var Zt=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],ve=0,je=0;je<8;je++)for(var Pe=0;Pe<8;Pe++)d[ve]=1/(c[wt[ve]]*Zt[je]*Zt[Pe]*8),p[ve]=1/(f[wt[ve]]*Zt[je]*Zt[Pe]*8),ve++})(_<50?Math.floor(5e3/_):Math.floor(200-2*_)),s=_)}this.encode=function(_,K){K&&J(K),E=new Array,L=0,R=7,Bt(65496),Bt(65504),Bt(16),lt(74),lt(70),lt(73),lt(70),lt(0),lt(1),lt(1),lt(0),Bt(1),Bt(1),lt(0),lt(0),(function(){Bt(65499),Bt(132),lt(0);for(var _e=0;_e<64;_e++)lt(c[_e]);lt(1);for(var Ue=0;Ue<64;Ue++)lt(f[Ue])})(),(function(_e,Ue){Bt(65472),Bt(17),lt(8),Bt(Ue),Bt(_e),lt(3),lt(1),lt(17),lt(0),lt(2),lt(17),lt(1),lt(3),lt(17),lt(1)})(_.width,_.height),(function(){Bt(65476),Bt(418),lt(0);for(var _e=0;_e<16;_e++)lt(bt[_e+1]);for(var Ue=0;Ue<=11;Ue++)lt(ot[Ue]);lt(16);for(var cn=0;cn<16;cn++)lt(Dt[cn+1]);for(var In=0;In<=161;In++)lt(Q[In]);lt(1);for(var Fe=0;Fe<16;Fe++)lt(at[Fe+1]);for(var _n=0;_n<=11;_n++)lt(G[_n]);lt(17);for(var dn=0;dn<16;dn++)lt(vt[dn+1]);for(var ze=0;ze<=161;ze++)lt(Tt[ze])})(),Bt(65498),Bt(12),lt(3),lt(1),lt(0),lt(2),lt(17),lt(3),lt(17),lt(0),lt(63),lt(0);var V=0,ut=0,xt=0;L=0,R=7,this.encode.displayName="_encode_";for(var At,Ft,Lt,Zt,ve,je,Pe,We,ct,Le=_.data,Pn=_.width,fe=_.height,ye=4*Pn,Te=0;Te<fe;){for(At=0;At<ye;){for(ve=ye*Te+At,Pe=-1,We=0,ct=0;ct<64;ct++)je=ve+(We=ct>>3)*ye+(Pe=4*(7&ct)),Te+We>=fe&&(je-=ye*(Te+1+We-fe)),At+Pe>=ye&&(je-=At+Pe-ye+4),Ft=Le[je++],Lt=Le[je++],Zt=Le[je++],q[ct]=(Mt[Ft]+Mt[Lt+256|0]+Mt[Zt+512|0]>>16)-128,H[ct]=(Mt[Ft+768|0]+Mt[Lt+1024|0]+Mt[Zt+1280|0]>>16)-128,$[ct]=(Mt[Ft+1280|0]+Mt[Lt+1536|0]+Mt[Zt+1792|0]>>16)-128;V=ee(q,d,V,t,r),ut=ee(H,p,ut,e,i),xt=ee($,p,xt,e,i),At+=32}Te+=8}if(R>=0){var Ne=[];Ne[1]=R+1,Ne[0]=(1<<R+1)-1,Z(Ne)}return Bt(65497),new Uint8Array(E)},n=n||50,(function(){for(var _=String.fromCharCode,K=0;K<256;K++)ht[K]=_(K)})(),t=gt(bt,ot),e=gt(at,G),r=gt(Dt,Q),i=gt(vt,Tt),(function(){for(var _=1,K=2,V=1;V<=15;V++){for(var ut=_;ut<K;ut++)b[32767+ut]=V,g[32767+ut]=[],g[32767+ut][1]=V,g[32767+ut][0]=ut;for(var xt=-(K-1);xt<=-_;xt++)b[32767+xt]=V,g[32767+xt]=[],g[32767+xt][1]=V,g[32767+xt][0]=K-1+xt;_<<=1,K<<=1}})(),(function(){for(var _=0;_<256;_++)Mt[_]=19595*_,Mt[_+256|0]=38470*_,Mt[_+512|0]=7471*_+32768,Mt[_+768|0]=-11059*_,Mt[_+1024|0]=-21709*_,Mt[_+1280|0]=32768*_+8421375,Mt[_+1536|0]=-27439*_,Mt[_+1792|0]=-5329*_})(),J(n)}function oc(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 oS(n){function t(ot){if(!ot)throw Error("assert :P")}function e(ot,Dt,Q){for(var at=0;4>at;at++)if(ot[Dt+at]!=Q.charCodeAt(at))return!0;return!1}function r(ot,Dt,Q,at,G){for(var vt=0;vt<G;vt++)ot[Dt+vt]=Q[at+vt]}function i(ot,Dt,Q,at){for(var G=0;G<at;G++)ot[Dt+G]=Q}function s(ot){return new Int32Array(ot)}function l(ot,Dt){for(var Q=[],at=0;at<ot;at++)Q.push(new Dt);return Q}function c(ot,Dt){var Q=[];return(function at(G,vt,Tt){for(var gt=Tt[vt],Z=0;Z<gt&&(G.push(Tt.length>vt+1?[]:new Dt),!(Tt.length<vt+1));Z++)at(G[Z],vt+1,Tt)})(Q,0,ot),Q}var f=function(){var ot=this;function Dt(m,v){for(var T=1<<v-1>>>0;m&T;)T>>>=1;return T?(m&T-1)+T:m}function Q(m,v,T,O,F){t(!(O%T));do m[v+(O-=T)]=F;while(0<O)}function at(m,v,T,O,F){if(t(2328>=F),512>=F)var Y=s(512);else if((Y=s(F))==null)return 0;return(function(W,rt,st,yt,_t,Vt){var pt,Pt,$t=rt,ne=1<<st,Yt=s(16),Jt=s(16);for(t(_t!=0),t(yt!=null),t(W!=null),t(0<st),Pt=0;Pt<_t;++Pt){if(15<yt[Pt])return 0;++Yt[yt[Pt]]}if(Yt[0]==_t)return 0;for(Jt[1]=0,pt=1;15>pt;++pt){if(Yt[pt]>1<<pt)return 0;Jt[pt+1]=Jt[pt]+Yt[pt]}for(Pt=0;Pt<_t;++Pt)pt=yt[Pt],0<yt[Pt]&&(Vt[Jt[pt]++]=Pt);if(Jt[15]==1)return(yt=new G).g=0,yt.value=Vt[0],Q(W,$t,1,ne,yt),ne;var ae,we=-1,he=ne-1,tn=0,He=1,Sn=1,Ge=1<<st;for(Pt=0,pt=1,_t=2;pt<=st;++pt,_t<<=1){if(He+=Sn<<=1,0>(Sn-=Yt[pt]))return 0;for(;0<Yt[pt];--Yt[pt])(yt=new G).g=pt,yt.value=Vt[Pt++],Q(W,$t+tn,_t,Ge,yt),tn=Dt(tn,pt)}for(pt=st+1,_t=2;15>=pt;++pt,_t<<=1){if(He+=Sn<<=1,0>(Sn-=Yt[pt]))return 0;for(;0<Yt[pt];--Yt[pt]){if(yt=new G,(tn&he)!=we){for($t+=Ge,ae=1<<(we=pt)-st;15>we&&!(0>=(ae-=Yt[we]));)++we,ae<<=1;ne+=Ge=1<<(ae=we-st),W[rt+(we=tn&he)].g=ae+st,W[rt+we].value=$t-rt-we}yt.g=pt-st,yt.value=Vt[Pt++],Q(W,$t+(tn>>st),_t,Ge,yt),tn=Dt(tn,pt)}}return He!=2*Jt[15]-1?0:ne})(m,v,T,O,F,Y)}function G(){this.value=this.g=0}function vt(){this.value=this.g=0}function Tt(){this.G=l(5,G),this.H=s(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=l(Sl,vt)}function gt(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|=Zt(m,128)<<v;return T}function lt(m,v){var T=Z(m,v);return Lt(m)?-T:T}function Bt(m,v,T,O){var F,Y=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),F=0;F<O;++F)Y+=v[T+F]<<8*F;m.Ra=Y,m.bb=O,m.oa=v,m.pa=T}function ee(m){for(;8<=m.u&&m.bb<m.Sb;)m.Ra>>>=8,m.Ra+=m.oa[m.pa+m.bb]<<ro-8>>>0,++m.bb,m.u-=8;ut(m)&&(m.h=1,m.u=0)}function J(m,v){if(t(0<=v),!m.h&&v<=kl){var T=V(m)&Ga[v];return m.u+=v,ee(m),T}return m.h=1,m.u=0}function _(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function K(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function V(m){return m.Ra>>>(m.u&ro-1)>>>0}function ut(m){return t(m.bb<=m.Sb),m.h||m.bb==m.Sb&&m.u>ro}function xt(m,v){m.u=v,m.h=ut(m)}function At(m){m.u>=io&&(t(m.u>=io),ee(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 Lt(m){return Z(m,1)}function Zt(m,v){var T=m.Ca;0>m.b&&Ft(m);var O=m.b,F=T*v>>>8,Y=(m.I>>>O>F)+0;for(Y?(T-=F,m.I-=F+1<<O>>>0):T=F+1,O=T,F=0;256<=O;)F+=8,O>>=8;return O=7^F+hs[O],m.b-=O,m.Ca=(T<<O)-1,Y}function ve(m,v,T){m[v+0]=T>>24&255,m[v+1]=T>>16&255,m[v+2]=T>>8&255,m[v+3]=255&T}function je(m,v){return m[v+0]|m[v+1]<<8}function Pe(m,v){return je(m,v)|m[v+2]<<16}function We(m,v){return je(m,v)|je(m,v+2)<<16}function ct(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 Le(m,v){t(m!=null),t(v!=null),t(m.Xa==v.Xa),r(v.X,0,m.X,0,1<<v.Xa)}function Pn(){this.X=[],this.Xa=this.Mb=0}function fe(m,v,T,O){t(T!=null),t(O!=null);var F=T[0],Y=O[0];return F==0&&(F=(m*Y+v/2)/v),Y==0&&(Y=(v*F+m/2)/m),0>=F||0>=Y?0:(T[0]=F,O[0]=Y,1)}function ye(m,v){return m+(1<<v)-1>>>v}function Te(m,v){return((4278255360&m)+(4278255360&v)>>>0&4278255360)+((16711935&m)+(16711935&v)>>>0&16711935)>>>0}function Ne(m,v){ot[v]=function(T,O,F,Y,W,rt,st){var yt;for(yt=0;yt<W;++yt){var _t=ot[m](rt[st+yt-1],F,Y+yt);rt[st+yt]=Te(T[O+yt],_t)}}}function _e(){this.ud=this.hd=this.jd=0}function Ue(m,v){return((4278124286&(m^v))>>>1)+(m&v)>>>0}function cn(m){return 0<=m&&256>m?m:0>m?0:255<m?255:void 0}function In(m,v){return cn(m+(m-v+.5>>1))}function Fe(m,v,T){return Math.abs(v-T)-Math.abs(m-T)}function _n(m,v,T,O,F,Y,W){for(O=Y[W-1],T=0;T<F;++T)Y[W+T]=O=Te(m[v+T],O)}function dn(m,v,T,O,F){var Y;for(Y=0;Y<T;++Y){var W=m[v+Y],rt=W>>8&255,st=16711935&(st=(st=16711935&W)+((rt<<16)+rt));O[F+Y]=(4278255360&W)+st>>>0}}function ze(m,v){v.jd=255&m,v.hd=m>>8&255,v.ud=m>>16&255}function Xe(m,v,T,O,F,Y){var W;for(W=0;W<O;++W){var rt=v[T+W],st=rt>>>8,yt=rt,_t=255&(_t=(_t=rt>>>16)+((m.jd<<24>>24)*(st<<24>>24)>>>5));yt=255&(yt=(yt+=(m.hd<<24>>24)*(st<<24>>24)>>>5)+((m.ud<<24>>24)*(_t<<24>>24)>>>5)),F[Y+W]=(4278255360&rt)+(_t<<16)+yt}}function Ie(m,v,T,O,F){ot[v]=function(Y,W,rt,st,yt,_t,Vt,pt,Pt){for(st=Vt;st<pt;++st)for(Vt=0;Vt<Pt;++Vt)yt[_t++]=F(rt[O(Y[W++])])},ot[m]=function(Y,W,rt,st,yt,_t,Vt){var pt=8>>Y.b,Pt=Y.Ea,$t=Y.K[0],ne=Y.w;if(8>pt)for(Y=(1<<Y.b)-1,ne=(1<<pt)-1;W<rt;++W){var Yt,Jt=0;for(Yt=0;Yt<Pt;++Yt)Yt&Y||(Jt=O(st[yt++])),_t[Vt++]=F($t[Jt&ne]),Jt>>=pt}else ot["VP8LMapColor"+T](st,yt,$t,ne,_t,Vt,W,rt,Pt)}}function kr(m,v,T,O,F){for(T=v+T;v<T;){var Y=m[v++];O[F++]=Y>>16&255,O[F++]=Y>>8&255,O[F++]=255&Y}}function wn(m,v,T,O,F){for(T=v+T;v<T;){var Y=m[v++];O[F++]=Y>>16&255,O[F++]=Y>>8&255,O[F++]=255&Y,O[F++]=Y>>24&255}}function nn(m,v,T,O,F){for(T=v+T;v<T;){var Y=(W=m[v++])>>16&240|W>>12&15,W=240&W|W>>28&15;O[F++]=Y,O[F++]=W}}function ln(m,v,T,O,F){for(T=v+T;v<T;){var Y=(W=m[v++])>>16&248|W>>13&7,W=W>>5&224|W>>3&31;O[F++]=Y,O[F++]=W}}function Ln(m,v,T,O,F){for(T=v+T;v<T;){var Y=m[v++];O[F++]=255&Y,O[F++]=Y>>8&255,O[F++]=Y>>16&255}}function Ze(m,v,T,O,F,Y){if(Y==0)for(T=v+T;v<T;)ve(O,((Y=m[v++])[0]>>24|Y[1]>>8&65280|Y[2]<<8&16711680|Y[3]<<24)>>>0),F+=32;else r(O,F,m,v,T)}function ur(m,v){ot[v][0]=ot[m+"0"],ot[v][1]=ot[m+"1"],ot[v][2]=ot[m+"2"],ot[v][3]=ot[m+"3"],ot[v][4]=ot[m+"4"],ot[v][5]=ot[m+"5"],ot[v][6]=ot[m+"6"],ot[v][7]=ot[m+"7"],ot[v][8]=ot[m+"8"],ot[v][9]=ot[m+"9"],ot[v][10]=ot[m+"10"],ot[v][11]=ot[m+"11"],ot[v][12]=ot[m+"12"],ot[v][13]=ot[m+"13"],ot[v][14]=ot[m+"0"],ot[v][15]=ot[m+"0"]}function gn(m){return m==kc||m==Kc||m==Ac||m==Jc}function xn(){this.eb=[],this.size=this.A=this.fb=0}function gr(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function Mn(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new xn,this.f.kb=new gr,this.sd=null}function Ke(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function Vn(){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 ss(m){return alert("todo:WebPSamplerProcessPlane"),m.T}function Ei(m,v){var T=m.T,O=v.ba.f.RGBA,F=O.eb,Y=O.fb+m.ka*O.A,W=vo[v.ba.S],rt=m.y,st=m.O,yt=m.f,_t=m.N,Vt=m.ea,pt=m.W,Pt=v.cc,$t=v.dc,ne=v.Mc,Yt=v.Nc,Jt=m.ka,ae=m.ka+m.T,we=m.U,he=we+1>>1;for(Jt==0?W(rt,st,null,null,yt,_t,Vt,pt,yt,_t,Vt,pt,F,Y,null,null,we):(W(v.ec,v.fc,rt,st,Pt,$t,ne,Yt,yt,_t,Vt,pt,F,Y-O.A,F,Y,we),++T);Jt+2<ae;Jt+=2)Pt=yt,$t=_t,ne=Vt,Yt=pt,_t+=m.Rc,pt+=m.Rc,Y+=2*O.A,W(rt,(st+=2*m.fa)-m.fa,rt,st,Pt,$t,ne,Yt,yt,_t,Vt,pt,F,Y-O.A,F,Y,we);return st+=m.fa,m.j+ae<m.o?(r(v.ec,v.fc,rt,st,we),r(v.cc,v.dc,yt,_t,he),r(v.Mc,v.Nc,Vt,pt,he),T--):1&ae||W(rt,st,null,null,yt,_t,Vt,pt,yt,_t,Vt,pt,F,Y+O.A,null,null,we),T}function Qt(m,v,T){var O=m.F,F=[m.J];if(O!=null){var Y=m.U,W=v.ba.S,rt=W==Sc||W==Ac;v=v.ba.f.RGBA;var st=[0],yt=m.ka;st[0]=m.T,m.Kb&&(yt==0?--st[0]:(--yt,F[0]-=m.width),m.j+m.ka+m.T==m.o&&(st[0]=m.o-m.j-yt));var _t=v.eb;yt=v.fb+yt*v.A,m=xc(O,F[0],m.width,Y,st,_t,yt+(rt?0:3),v.A),t(T==st),m&&gn(W)&&Ma(_t,yt,rt,Y,st,v.A)}return 0}function Re(m){var v=m.ma,T=v.ba.S,O=11>T,F=T==xo||T==ys||T==Sc||T==Zl||T==12||gn(T);if(v.memory=null,v.Ib=null,v.Jb=null,v.Nd=null,!Ki(v.Oa,m,F?11:12))return 0;if(F&&gn(T)&&Hs(),m.da)alert("todo:use_scaling");else{if(O){if(v.Ib=ss,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=Ei,Hs()}}else alert("todo:EmitYUV");F&&(v.Jb=Qt,O&&yi())}if(O&&!rl){for(m=0;256>m;++m)Zi[m]=89858*(m-128)+Tl>>ts,ec[m]=-22014*(m-128)+Tl,gd[m]=-45773*(m-128),nu[m]=113618*(m-128)+Tl>>ts;for(m=tc;m<Ys;++m)v=76283*(m-16)+Tl>>ts,yh[m-tc]=Wi(v,255),Nf[m-tc]=Wi(v+8>>4,15);rl=1}return 1}function Me(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 Oe(m){m.ma.memory=null}function Xn(m,v,T,O){return J(m,8)!=47?0:(v[0]=J(m,14)+1,T[0]=J(m,14)+1,O[0]=J(m,1),J(m,3)!=0?0:!m.h)}function Bn(m,v){if(4>m)return m+1;var T=m-2>>1;return(2+(1&m)<<T)+J(v,T)+1}function or(m,v){return 120<v?v-120:1<=(T=((T=xs[v-1])>>4)*m+(8-(15&T)))?T:1;var T}function Fn(m,v,T){var O=V(T),F=m[v+=255&O].g-8;return 0<F&&(xt(T,T.u+8),O=V(T),v+=m[v].value,v+=O&(1<<F)-1),xt(T,T.u+m[v].g),m[v].value}function si(m,v,T){return T.g+=m.g,T.value+=m.value<<v>>>0,t(8>=T.g),m.g}function mi(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 Wt(m,v,T,O){var F=m.ab,Y=m.c*v,W=m.C;v=W+v;var rt=T,st=O;for(O=m.Ta,T=m.Ua;0<F--;){var yt=m.gc[F],_t=W,Vt=v,pt=rt,Pt=st,$t=(st=O,rt=T,yt.Ea);switch(t(_t<Vt),t(Vt<=yt.nc),yt.hc){case 2:Kl(pt,Pt,(Vt-_t)*$t,st,rt);break;case 0:var ne=_t,Yt=Vt,Jt=st,ae=rt,we=(Ge=yt).Ea;ne==0&&(Sa(pt,Pt,null,null,1,Jt,ae),_n(pt,Pt+1,0,0,we-1,Jt,ae+1),Pt+=we,ae+=we,++ne);for(var he=1<<Ge.b,tn=he-1,He=ye(we,Ge.b),Sn=Ge.K,Ge=Ge.w+(ne>>Ge.b)*He;ne<Yt;){var Gn=Sn,$r=Ge,zn=1;for(ka(pt,Pt,Jt,ae-we,1,Jt,ae);zn<we;){var qe=(zn&~tn)+he;qe>we&&(qe=we),(0,go[Gn[$r++]>>8&15])(pt,Pt+ +zn,Jt,ae+zn-we,qe-zn,Jt,ae+zn),zn=qe}Pt+=we,ae+=we,++ne&tn||(Ge+=He)}Vt!=yt.nc&&r(st,rt-$t,st,rt+(Vt-_t-1)*$t,$t);break;case 1:for($t=pt,Yt=Pt,we=(pt=yt.Ea)-(ae=pt&~(Jt=(Pt=1<<yt.b)-1)),ne=ye(pt,yt.b),he=yt.K,yt=yt.w+(_t>>yt.b)*ne;_t<Vt;){for(tn=he,He=yt,Sn=new _e,Ge=Yt+ae,Gn=Yt+pt;Yt<Ge;)ze(tn[He++],Sn),Ka(Sn,$t,Yt,Pt,st,rt),Yt+=Pt,rt+=Pt;Yt<Gn&&(ze(tn[He++],Sn),Ka(Sn,$t,Yt,we,st,rt),Yt+=we,rt+=we),++_t&Jt||(yt+=ne)}break;case 3:if(pt==st&&Pt==rt&&0<yt.b){for(Yt=st,pt=$t=rt+(Vt-_t)*$t-(ae=(Vt-_t)*ye(yt.Ea,yt.b)),Pt=st,Jt=rt,ne=[],ae=(we=ae)-1;0<=ae;--ae)ne[ae]=Pt[Jt+ae];for(ae=we-1;0<=ae;--ae)Yt[pt+ae]=ne[ae];Uo(yt,_t,Vt,st,$t,st,rt)}else Uo(yt,_t,Vt,pt,Pt,st,rt)}rt=O,st=T}st!=T&&r(O,T,rt,st,Y)}function ai(m,v){var T=m.V,O=m.Ba+m.c*m.C,F=v-m.C;if(t(v<=m.l.o),t(16>=F),0<F){var Y=m.l,W=m.Ta,rt=m.Ua,st=Y.width;if(Wt(m,F,T,O),F=rt=[rt],t((T=m.C)<(O=v)),t(Y.v<Y.va),O>Y.o&&(O=Y.o),T<Y.j){var yt=Y.j-T;T=Y.j,F[0]+=yt*st}if(T>=O?T=0:(F[0]+=4*Y.v,Y.ka=T-Y.j,Y.U=Y.va-Y.v,Y.T=O-T,T=1),T){if(rt=rt[0],11>(T=m.ca).S){var _t=T.f.RGBA,Vt=(O=T.S,F=Y.U,Y=Y.T,yt=_t.eb,_t.A),pt=Y;for(_t=_t.fb+m.Ma*_t.A;0<pt--;){var Pt=W,$t=rt,ne=F,Yt=yt,Jt=_t;switch(O){case Xc:Al(Pt,$t,ne,Yt,Jt);break;case xo:Se(Pt,$t,ne,Yt,Jt);break;case kc:Se(Pt,$t,ne,Yt,Jt),Ma(Yt,Jt,0,ne,1,0);break;case Gc:Ja(Pt,$t,ne,Yt,Jt);break;case ys:Ze(Pt,$t,ne,Yt,Jt,1);break;case Kc:Ze(Pt,$t,ne,Yt,Jt,1),Ma(Yt,Jt,0,ne,1,0);break;case Sc:Ze(Pt,$t,ne,Yt,Jt,0);break;case Ac:Ze(Pt,$t,ne,Yt,Jt,0),Ma(Yt,Jt,1,ne,1,0);break;case Zl:oo(Pt,$t,ne,Yt,Jt);break;case Jc:oo(Pt,$t,ne,Yt,Jt),gs(Yt,Jt,ne,1,0);break;case tl:Aa(Pt,$t,ne,Yt,Jt);break;default:t(0)}rt+=st,_t+=Vt}m.Ma+=Y}else alert("todo:EmitRescaledRowsYUVA");t(m.Ma<=T.height)}}m.C=v,t(m.C<=m.i)}function Ar(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 er(m,v,T,O,F,Y){if(m.Z!=0){var W=m.qd,rt=m.rd;for(t(nl[m.Z]!=null);v<T;++v)nl[m.Z](W,rt,O,F,O,F,Y),W=O,rt=F,F+=Y;m.qd=W,m.rd=rt}}function Ti(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 F=m.l.width,Y=T.ca,W=T.tb+F*O,rt=m.V,st=m.Ba+m.c*O,yt=m.gc;t(m.ab==1),t(yt[0].hc==3),bc(yt[0],O,v,rt,st,Y,W),er(T,O,v,Y,W,F)}m.C=m.Ma=v}function Yo(m,v,T,O,F,Y,W){var rt=m.$/O,st=m.$%O,yt=m.m,_t=m.s,Vt=T+m.$,pt=Vt;F=T+O*F;var Pt=T+O*Y,$t=280+_t.ua,ne=m.Pb?rt:16777216,Yt=0<_t.ua?_t.Wa:null,Jt=_t.wc,ae=Vt<Pt?mi(_t,st,rt):null;t(m.C<Y),t(Pt<=F);var we=!1;t:for(;;){for(;we||Vt<Pt;){var he=0;if(rt>=ne){var tn=Vt-T;t((ne=m).Pb),ne.wd=ne.m,ne.xd=tn,0<ne.s.ua&&Le(ne.s.Wa,ne.s.vb),ne=rt+el}if(st&Jt||(ae=mi(_t,st,rt)),t(ae!=null),ae.Qb&&(v[Vt]=ae.qb,we=!0),!we)if(At(yt),ae.jc){he=yt,tn=v;var He=Vt,Sn=ae.pd[V(he)&Sl-1];t(ae.jc),256>Sn.g?(xt(he,he.u+Sn.g),tn[He]=Sn.value,he=0):(xt(he,he.u+Sn.g-256),t(256<=Sn.value),he=Sn.value),he==0&&(we=!0)}else he=Fn(ae.G[0],ae.H[0],yt);if(yt.h)break;if(we||256>he){if(!we)if(ae.nd)v[Vt]=(ae.qb|he<<8)>>>0;else{if(At(yt),we=Fn(ae.G[1],ae.H[1],yt),At(yt),tn=Fn(ae.G[2],ae.H[2],yt),He=Fn(ae.G[3],ae.H[3],yt),yt.h)break;v[Vt]=(He<<24|we<<16|he<<8|tn)>>>0}if(we=!1,++Vt,++st>=O&&(st=0,++rt,W!=null&&rt<=Y&&!(rt%16)&&W(m,rt),Yt!=null))for(;pt<Vt;)he=v[pt++],Yt.X[(506832829*he&4294967295)>>>Yt.Mb]=he}else if(280>he){if(he=Bn(he-256,yt),tn=Fn(ae.G[4],ae.H[4],yt),At(yt),tn=or(O,tn=Bn(tn,yt)),yt.h)break;if(Vt-T<tn||F-Vt<he)break t;for(He=0;He<he;++He)v[Vt+He]=v[Vt+He-tn];for(Vt+=he,st+=he;st>=O;)st-=O,++rt,W!=null&&rt<=Y&&!(rt%16)&&W(m,rt);if(t(Vt<=F),st&Jt&&(ae=mi(_t,st,rt)),Yt!=null)for(;pt<Vt;)he=v[pt++],Yt.X[(506832829*he&4294967295)>>>Yt.Mb]=he}else{if(!(he<$t))break t;for(we=he-280,t(Yt!=null);pt<Vt;)he=v[pt++],Yt.X[(506832829*he&4294967295)>>>Yt.Mb]=he;he=Vt,t(!(we>>>(tn=Yt).Xa)),v[he]=tn.X[we],we=!0}we||t(yt.h==ut(yt))}if(m.Pb&&yt.h&&Vt<F)t(m.m.h),m.a=5,m.m=m.wd,m.$=m.xd,0<m.s.ua&&Le(m.s.vb,m.s.Wa);else{if(yt.h)break t;W?.(m,rt>Y?Y:rt),m.a=0,m.$=Vt-T}return 1}return m.a=3,0}function li(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 Or(){var m=new Qe;return m==null?null:(m.a=0,m.xb=Pu,ur("Predictor","VP8LPredictors"),ur("Predictor","VP8LPredictors_C"),ur("PredictorAdd","VP8LPredictorsAdd"),ur("PredictorAdd","VP8LPredictorsAdd_C"),Kl=dn,Ka=Xe,Al=kr,Se=wn,oo=nn,Aa=ln,Ja=Ln,ot.VP8LMapColor32b=yr,ot.VP8LMapColor8b=_r,m)}function ta(m,v,T,O,F){var Y=1,W=[m],rt=[v],st=O.m,yt=O.s,_t=null,Vt=0;t:for(;;){if(T)for(;Y&&J(st,1);){var pt=W,Pt=rt,$t=O,ne=1,Yt=$t.m,Jt=$t.gc[$t.ab],ae=J(Yt,2);if($t.Oc&1<<ae)Y=0;else{switch($t.Oc|=1<<ae,Jt.hc=ae,Jt.Ea=pt[0],Jt.nc=Pt[0],Jt.K=[null],++$t.ab,t(4>=$t.ab),ae){case 0:case 1:Jt.b=J(Yt,3)+2,ne=ta(ye(Jt.Ea,Jt.b),ye(Jt.nc,Jt.b),0,$t,Jt.K),Jt.K=Jt.K[0];break;case 3:var we,he=J(Yt,8)+1,tn=16<he?0:4<he?1:2<he?2:3;if(pt[0]=ye(Jt.Ea,tn),Jt.b=tn,we=ne=ta(he,1,0,$t,Jt.K)){var He,Sn=he,Ge=Jt,Gn=1<<(8>>Ge.b),$r=s(Gn);if($r==null)we=0;else{var zn=Ge.K[0],qe=Ge.w;for($r[0]=Ge.K[0][0],He=1;He<1*Sn;++He)$r[He]=Te(zn[qe+He],$r[He-1]);for(;He<4*Gn;++He)$r[He]=0;Ge.K[0]=null,Ge.K[0]=$r,we=1}}ne=we;break;case 2:break;default:t(0)}Y=ne}}if(W=W[0],rt=rt[0],Y&&J(st,1)&&!(Y=1<=(Vt=J(st,4))&&11>=Vt)){O.a=3;break t}var De;if(De=Y)e:{var ni,kn,jn,Dr=O,Ri=W,Qi=rt,Jr=Vt,Ui=T,wo=Dr.m,Oi=Dr.s,Kn=[null],dr=1,xi=0,lr=vs[Jr];n:for(;;){if(Ui&&J(wo,1)){var to=J(wo,3)+2,vi=ye(Ri,to),cr=ye(Qi,to),Pi=vi*cr;if(!ta(vi,cr,0,Dr,Kn))break n;for(Kn=Kn[0],Oi.xc=to,ni=0;ni<Pi;++ni){var vr=Kn[ni]>>8&65535;Kn[ni]=vr,vr>=dr&&(dr=vr+1)}}if(wo.h)break n;for(kn=0;5>kn;++kn){var wi=$s[kn];!kn&&0<Jr&&(wi+=1<<Jr),xi<wi&&(xi=wi)}var Si=l(dr*lr,G),Cr=dr,bn=l(Cr,Tt);if(bn==null)var Hi=null;else t(65536>=Cr),Hi=bn;var Zr=s(xi);if(Hi==null||Zr==null||Si==null){Dr.a=1;break n}var w=Si;for(ni=jn=0;ni<dr;++ni){var S=Hi[ni],N=S.G,D=S.H,j=0,X=1,tt=0;for(kn=0;5>kn;++kn){wi=$s[kn],N[kn]=w,D[kn]=jn,!kn&&0<Jr&&(wi+=1<<Jr);i:{var U,nt=wi,ft=Dr,it=Zr,mt=w,z=jn,Nt=0,jt=ft.m,St=J(jt,1);if(i(it,0,0,nt),St){var Rt=J(jt,1)+1,kt=J(jt,1),qt=J(jt,kt==0?1:8);it[qt]=1,Rt==2&&(it[qt=J(jt,8)]=1);var Ut=1}else{var oe=s(19),be=J(jt,4)+4;if(19<be){ft.a=3;var xe=0;break i}for(U=0;U<be;++U)oe[Mc[U]]=J(jt,3);var $e=void 0,vn=void 0,de=ft,fn=oe,Ce=nt,Hn=it,Ir=0,zr=de.m,Ro=8,qo=l(128,G);r:for(;at(qo,0,7,fn,19);){if(J(zr,1)){var It=2+2*J(zr,3);if(($e=2+J(zr,It))>Ce)break r}else $e=Ce;for(vn=0;vn<Ce&&$e--;){At(zr);var Ye=qo[0+(127&V(zr))];xt(zr,zr.u+Ye.g);var Ae=Ye.value;if(16>Ae)Hn[vn++]=Ae,Ae!=0&&(Ro=Ae);else{var Be=Ae==16,Ve=Ae-16,Cn=Ql[Ve],Yr=J(zr,bs[Ve])+Cn;if(vn+Yr>Ce)break r;for(var co=Be?Ro:0;0<Yr--;)Hn[vn++]=co}}Ir=1;break r}Ir||(de.a=3),Ut=Ir}(Ut=Ut&&!jt.h)&&(Nt=at(mt,z,8,it,nt)),Ut&&Nt!=0?xe=Nt:(ft.a=3,xe=0)}if(xe==0)break n;if(X&&Zc[kn]==1&&(X=w[jn].g==0),j+=w[jn].g,jn+=xe,3>=kn){var Qr,So=Zr[0];for(Qr=1;Qr<wi;++Qr)Zr[Qr]>So&&(So=Zr[Qr]);tt+=So}}if(S.nd=X,S.Qb=0,X&&(S.qb=(N[3][D[3]+0].value<<24|N[1][D[1]+0].value<<16|N[2][D[2]+0].value)>>>0,j==0&&256>N[0][D[0]+0].value&&(S.Qb=1,S.qb+=N[0][D[0]+0].value<<8)),S.jc=!S.Qb&&6>tt,S.jc){var ui,Lr=S;for(ui=0;ui<Sl;++ui){var Er=ui,Jn=Lr.pd[Er],qi=Lr.G[0][Lr.H[0]+Er];256<=qi.value?(Jn.g=qi.g+256,Jn.value=qi.value):(Jn.g=0,Jn.value=0,Er>>=si(qi,8,Jn),Er>>=si(Lr.G[1][Lr.H[1]+Er],16,Jn),Er>>=si(Lr.G[2][Lr.H[2]+Er],0,Jn),si(Lr.G[3][Lr.H[3]+Er],24,Jn))}}}Oi.vc=Kn,Oi.Wb=dr,Oi.Ya=Hi,Oi.yc=Si,De=1;break e}De=0}if(!(Y=De)){O.a=3;break t}if(0<Vt){if(yt.ua=1<<Vt,!ct(yt.Wa,Vt)){O.a=1,Y=0;break t}}else yt.ua=0;var As=O,_l=W,ju=rt,aa=As.s,Dl=aa.xc;if(As.c=_l,As.i=ju,aa.md=ye(_l,Dl),aa.wc=Dl==0?-1:(1<<Dl)-1,T){O.xb=sa;break t}if((_t=s(W*rt))==null){O.a=1,Y=0;break t}Y=(Y=Yo(O,_t,0,W,rt,rt,null))&&!st.h;break t}return Y?(F!=null?F[0]=_t:(t(_t==null),t(T)),O.$=0,T||li(yt)):li(yt),Y}function ea(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 fa(m,v){var T=m.C,O=v-T,F=m.V,Y=m.Ba+m.c*T;for(t(v<=m.l.o);0<O;){var W=16<O?16:O,rt=m.l.ma,st=m.l.width,yt=st*W,_t=rt.ca,Vt=rt.tb+st*T,pt=m.Ta,Pt=m.Ua;Wt(m,W,F,Y),Qo(pt,Pt,_t,Vt,yt),er(rt,T,T+W,_t,Vt,st),O-=W,F+=W*m.c,T+=W}t(T==v),m.C=m.Ma=v}function as(){this.ub=this.yd=this.td=this.Rb=0}function Bo(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function gl(){this.Fb=this.Bb=this.Cb=0,this.Zb=s(4),this.Lb=s(4)}function na(){this.Yb=(function(){var m=[];return(function v(T,O,F){for(var Y=F[O],W=0;W<Y&&(T.push(F.length>O+1?[]:0),!(F.length<O+1));W++)v(T[W],O+1,F)})(m,0,[3,11]),m})()}function Wr(){this.jb=s(3),this.Wc=c([4,8],na),this.Xc=c([4,17],na)}function dc(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new s(4),this.od=new s(4)}function Ls(){this.ld=this.La=this.dd=this.tc=0}function da(){this.Na=this.la=0}function ha(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function hc(){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 yl(){this.uc=this.M=this.Nb=0,this.wa=Array(new Ls),this.Y=0,this.ya=Array(new hc),this.aa=0,this.l=new Xi}function pc(){this.y=s(16),this.f=s(8),this.ea=s(8)}function $l(){this.cb=this.a=0,this.sc="",this.m=new _,this.Od=new as,this.Kc=new Bo,this.ed=new dc,this.Qa=new gl,this.Ic=this.$c=this.Aa=0,this.D=new yl,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=l(8,_),this.ia=0,this.pb=l(4,ha),this.Pa=new Wr,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new pc),this.Hd=0,this.rb=Array(new da),this.sb=0,this.wa=Array(new Ls),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 hc),this.L=this.aa=0,this.gd=c([4,2],Ls),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 Wi(m,v){return 0>m?0:m>v?v:m}function Xi(){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 Vo(){var m=new $l;return m!=null&&(m.a=0,m.sc="OK",m.cb=0,m.Xb=0,ao||(ao=Fa)),m}function fr(m,v,T){return m.a==0&&(m.a=v,m.sc=T,m.cb=0),0}function mc(m,v,T){return 3<=T&&m[v+0]==157&&m[v+1]==1&&m[v+2]==42}function pa(m,v){if(m==null)return 0;if(m.a=0,m.sc="OK",v==null)return fr(m,2,"null VP8Io passed to VP8GetHeaders()");var T=v.data,O=v.w,F=v.ha;if(4>F)return fr(m,7,"Truncated header.");var Y=T[O+0]|T[O+1]<<8|T[O+2]<<16,W=m.Od;if(W.Rb=!(1&Y),W.td=Y>>1&7,W.yd=Y>>4&1,W.ub=Y>>5,3<W.td)return fr(m,3,"Incorrect keyframe parameters.");if(!W.yd)return fr(m,4,"Frame not displayable.");O+=3,F-=3;var rt=m.Kc;if(W.Rb){if(7>F)return fr(m,7,"cannot parse picture header");if(!mc(T,O,F))return fr(m,3,"Bad code word");rt.c=16383&(T[O+4]<<8|T[O+3]),rt.Td=T[O+4]>>6,rt.i=16383&(T[O+6]<<8|T[O+5]),rt.Ud=T[O+6]>>6,O+=7,F-=7,m.za=rt.c+15>>4,m.Ub=rt.i+15>>4,v.width=rt.c,v.height=rt.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((Y=m.Pa).jb,0,255,Y.jb.length),t((Y=m.Qa)!=null),Y.Cb=0,Y.Bb=0,Y.Fb=1,i(Y.Zb,0,0,Y.Zb.length),i(Y.Lb,0,0,Y.Lb)}if(W.ub>F)return fr(m,7,"bad partition length");gt(Y=m.m,T,O,W.ub),O+=W.ub,F-=W.ub,W.Rb&&(rt.Ld=Lt(Y),rt.Kd=Lt(Y)),rt=m.Qa;var st,yt=m.Pa;if(t(Y!=null),t(rt!=null),rt.Cb=Lt(Y),rt.Cb){if(rt.Bb=Lt(Y),Lt(Y)){for(rt.Fb=Lt(Y),st=0;4>st;++st)rt.Zb[st]=Lt(Y)?lt(Y,7):0;for(st=0;4>st;++st)rt.Lb[st]=Lt(Y)?lt(Y,6):0}if(rt.Bb)for(st=0;3>st;++st)yt.jb[st]=Lt(Y)?Z(Y,8):255}else rt.Bb=0;if(Y.Ka)return fr(m,3,"cannot parse segment header");if((rt=m.ed).zd=Lt(Y),rt.Tb=Z(Y,6),rt.wb=Z(Y,3),rt.Pc=Lt(Y),rt.Pc&&Lt(Y)){for(yt=0;4>yt;++yt)Lt(Y)&&(rt.vd[yt]=lt(Y,6));for(yt=0;4>yt;++yt)Lt(Y)&&(rt.od[yt]=lt(Y,6))}if(m.L=rt.Tb==0?0:rt.zd?1:2,Y.Ka)return fr(m,3,"cannot parse filter header");var _t=F;if(F=st=O,O=st+_t,rt=_t,m.Xb=(1<<Z(m.m,2))-1,_t<3*(yt=m.Xb))T=7;else{for(st+=3*yt,rt-=3*yt,_t=0;_t<yt;++_t){var Vt=T[F+0]|T[F+1]<<8|T[F+2]<<16;Vt>rt&&(Vt=rt),gt(m.Jc[+_t],T,st,Vt),st+=Vt,rt-=Vt,F+=3}gt(m.Jc[+yt],T,st,rt),T=st<O?0:5}if(T!=0)return fr(m,T,"cannot parse partitions");for(T=Z(st=m.m,7),F=Lt(st)?lt(st,4):0,O=Lt(st)?lt(st,4):0,rt=Lt(st)?lt(st,4):0,yt=Lt(st)?lt(st,4):0,st=Lt(st)?lt(st,4):0,_t=m.Qa,Vt=0;4>Vt;++Vt){if(_t.Cb){var pt=_t.Zb[Vt];_t.Fb||(pt+=T)}else{if(0<Vt){m.pb[Vt]=m.pb[0];continue}pt=T}var Pt=m.pb[Vt];Pt.Sc[0]=Lo[Wi(pt+F,127)],Pt.Sc[1]=ws[Wi(pt+0,127)],Pt.Eb[0]=2*Lo[Wi(pt+O,127)],Pt.Eb[1]=101581*ws[Wi(pt+rt,127)]>>16,8>Pt.Eb[1]&&(Pt.Eb[1]=8),Pt.Qc[0]=Lo[Wi(pt+yt,117)],Pt.Qc[1]=ws[Wi(pt+st,127)],Pt.lc=pt+st}if(!W.Rb)return fr(m,4,"Not a key frame.");for(Lt(Y),W=m.Pa,T=0;4>T;++T){for(F=0;8>F;++F)for(O=0;3>O;++O)for(rt=0;11>rt;++rt)yt=Zt(Y,Kr[T][F][O][rt])?Z(Y,8):Ef[T][F][O][rt],W.Wc[T][F].Yb[O][rt]=yt;for(F=0;17>F;++F)W.Xc[T][F]=W.Wc[T][nr[F]]}return m.kc=Lt(Y),m.kc&&(m.Bd=Z(Y,8)),m.cb=1}function Fa(m,v,T,O,F,Y,W){var rt=v[F].Yb[T];for(T=0;16>F;++F){if(!Zt(m,rt[T+0]))return F;for(;!Zt(m,rt[T+1]);)if(rt=v[++F].Yb[0],T=0,F==16)return 16;var st=v[F+1].Yb;if(Zt(m,rt[T+2])){var yt=m,_t=0;if(Zt(yt,(pt=rt)[(Vt=T)+3]))if(Zt(yt,pt[Vt+6])){for(rt=0,Vt=2*(_t=Zt(yt,pt[Vt+8]))+(pt=Zt(yt,pt[Vt+9+_t])),_t=0,pt=Cf[Vt];pt[rt];++rt)_t+=_t+Zt(yt,pt[rt]);_t+=3+(8<<Vt)}else Zt(yt,pt[Vt+7])?(_t=7+2*Zt(yt,165),_t+=Zt(yt,145)):_t=5+Zt(yt,159);else _t=Zt(yt,pt[Vt+4])?3+Zt(yt,pt[Vt+5]):2;rt=st[2]}else _t=1,rt=st[1];st=W+Ou[F],0>(yt=m).b&&Ft(yt);var Vt,pt=yt.b,Pt=(Vt=yt.Ca>>1)-(yt.I>>pt)>>31;--yt.b,yt.Ca+=Pt,yt.Ca|=1,yt.I-=(Vt+1&Pt)<<pt,Y[st]=((_t^Pt)-Pt)*O[(0<F)+0]}return 16}function ma(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 Xr(m,v,T,O,F){F=m[v+T+32*O]+(F>>3),m[v+T+32*O]=-256&F?0>F?0:255:F}function Fo(m,v,T,O,F,Y){Xr(m,v,0,T,O+F),Xr(m,v,1,T,O+Y),Xr(m,v,2,T,O-Y),Xr(m,v,3,T,O-F)}function Mr(m){return(20091*m>>16)+m}function Br(m,v,T,O){var F,Y=0,W=s(16);for(F=0;4>F;++F){var rt=m[v+0]+m[v+8],st=m[v+0]-m[v+8],yt=(35468*m[v+4]>>16)-Mr(m[v+12]),_t=Mr(m[v+4])+(35468*m[v+12]>>16);W[Y+0]=rt+_t,W[Y+1]=st+yt,W[Y+2]=st-yt,W[Y+3]=rt-_t,Y+=4,v++}for(F=Y=0;4>F;++F)rt=(m=W[Y+0]+4)+W[Y+8],st=m-W[Y+8],yt=(35468*W[Y+4]>>16)-Mr(W[Y+12]),Xr(T,O,0,0,rt+(_t=Mr(W[Y+4])+(35468*W[Y+12]>>16))),Xr(T,O,1,0,st+yt),Xr(T,O,2,0,st-yt),Xr(T,O,3,0,rt-_t),Y++,O+=32}function Fr(m,v,T,O){var F=m[v+0]+4,Y=35468*m[v+4]>>16,W=Mr(m[v+4]),rt=35468*m[v+1]>>16;Fo(T,O,0,F+W,m=Mr(m[v+1]),rt),Fo(T,O,1,F+Y,m,rt),Fo(T,O,2,F-Y,m,rt),Fo(T,O,3,F-W,m,rt)}function ls(m,v,T,O,F){Br(m,v,T,O),F&&Br(m,v+16,T,O+4)}function Di(m,v,T,O){ms(m,v+0,T,O,1),ms(m,v+32,T,O+128,1)}function Wo(m,v,T,O){var F;for(m=m[v+0]+4,F=0;4>F;++F)for(v=0;4>v;++v)Xr(T,O,v,F,m)}function Zn(m,v,T,O){m[v+0]&&yo(m,v+0,T,O),m[v+16]&&yo(m,v+16,T,O+4),m[v+32]&&yo(m,v+32,T,O+128),m[v+48]&&yo(m,v+48,T,O+128+4)}function Xo(m,v,T,O){var F,Y=s(16);for(F=0;4>F;++F){var W=m[v+0+F]+m[v+12+F],rt=m[v+4+F]+m[v+8+F],st=m[v+4+F]-m[v+8+F],yt=m[v+0+F]-m[v+12+F];Y[0+F]=W+rt,Y[8+F]=W-rt,Y[4+F]=yt+st,Y[12+F]=yt-st}for(F=0;4>F;++F)W=(m=Y[0+4*F]+3)+Y[3+4*F],rt=Y[1+4*F]+Y[2+4*F],st=Y[1+4*F]-Y[2+4*F],yt=m-Y[3+4*F],T[O+0]=W+rt>>3,T[O+16]=yt+st>>3,T[O+32]=W-rt>>3,T[O+48]=yt-st>>3,O+=64}function Ua(m,v,T){var O,F=v-32,Y=bo,W=255-m[F-1];for(O=0;O<T;++O){var rt,st=Y,yt=W+m[v-1];for(rt=0;rt<T;++rt)m[v+rt]=st[yt+m[F+rt]];v+=32}}function cs(m,v){Ua(m,v,4)}function te(m,v){Ua(m,v,8)}function Hc(m,v){Ua(m,v,16)}function bl(m,v){var T;for(T=0;16>T;++T)r(m,v+32*T,m,v-32,16)}function Mf(m,v){var T;for(T=16;0<T;--T)i(m,v,m[v-1],16),v+=32}function No(m,v,T){var O;for(O=0;16>O;++O)i(v,T+32*O,m,16)}function us(m,v){var T,O=16;for(T=0;16>T;++T)O+=m[v-1+32*T]+m[v+T-32];No(O>>5,m,v)}function ga(m,v){var T,O=8;for(T=0;16>T;++T)O+=m[v-1+32*T];No(O>>4,m,v)}function qc(m,v){var T,O=8;for(T=0;16>T;++T)O+=m[v+T-32];No(O>>4,m,v)}function fs(m,v){No(128,m,v)}function yn(m,v,T){return m+2*v+T+2>>2}function Yl(m,v){var T,O=v-32;for(O=new Uint8Array([yn(m[O-1],m[O+0],m[O+1]),yn(m[O+0],m[O+1],m[O+2]),yn(m[O+1],m[O+2],m[O+3]),yn(m[O+2],m[O+3],m[O+4])]),T=0;4>T;++T)r(m,v+32*T,O,0,O.length)}function xl(m,v){var T=m[v-1],O=m[v-1+32],F=m[v-1+64],Y=m[v-1+96];ve(m,v+0,16843009*yn(m[v-1-32],T,O)),ve(m,v+32,16843009*yn(T,O,F)),ve(m,v+64,16843009*yn(O,F,Y)),ve(m,v+96,16843009*yn(F,Y,Y))}function gc(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 ya(m,v){var T=m[v-1+0],O=m[v-1+32],F=m[v-1+64],Y=m[v-1-32],W=m[v+0-32],rt=m[v+1-32],st=m[v+2-32],yt=m[v+3-32];m[v+0+96]=yn(O,F,m[v-1+96]),m[v+1+96]=m[v+0+64]=yn(T,O,F),m[v+2+96]=m[v+1+64]=m[v+0+32]=yn(Y,T,O),m[v+3+96]=m[v+2+64]=m[v+1+32]=m[v+0+0]=yn(W,Y,T),m[v+3+64]=m[v+2+32]=m[v+1+0]=yn(rt,W,Y),m[v+3+32]=m[v+2+0]=yn(st,rt,W),m[v+3+0]=yn(yt,st,rt)}function Rs(m,v){var T=m[v+1-32],O=m[v+2-32],F=m[v+3-32],Y=m[v+4-32],W=m[v+5-32],rt=m[v+6-32],st=m[v+7-32];m[v+0+0]=yn(m[v+0-32],T,O),m[v+1+0]=m[v+0+32]=yn(T,O,F),m[v+2+0]=m[v+1+32]=m[v+0+64]=yn(O,F,Y),m[v+3+0]=m[v+2+32]=m[v+1+64]=m[v+0+96]=yn(F,Y,W),m[v+3+32]=m[v+2+64]=m[v+1+96]=yn(Y,W,rt),m[v+3+64]=m[v+2+96]=yn(W,rt,st),m[v+3+96]=yn(rt,st,st)}function Os(m,v){var T=m[v-1+0],O=m[v-1+32],F=m[v-1+64],Y=m[v-1-32],W=m[v+0-32],rt=m[v+1-32],st=m[v+2-32],yt=m[v+3-32];m[v+0+0]=m[v+1+64]=Y+W+1>>1,m[v+1+0]=m[v+2+64]=W+rt+1>>1,m[v+2+0]=m[v+3+64]=rt+st+1>>1,m[v+3+0]=st+yt+1>>1,m[v+0+96]=yn(F,O,T),m[v+0+64]=yn(O,T,Y),m[v+0+32]=m[v+1+96]=yn(T,Y,W),m[v+1+32]=m[v+2+96]=yn(Y,W,rt),m[v+2+32]=m[v+3+96]=yn(W,rt,st),m[v+3+32]=yn(rt,st,yt)}function Go(m,v){var T=m[v+0-32],O=m[v+1-32],F=m[v+2-32],Y=m[v+3-32],W=m[v+4-32],rt=m[v+5-32],st=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+F+1>>1,m[v+2+0]=m[v+1+64]=F+Y+1>>1,m[v+3+0]=m[v+2+64]=Y+W+1>>1,m[v+0+32]=yn(T,O,F),m[v+1+32]=m[v+0+96]=yn(O,F,Y),m[v+2+32]=m[v+1+96]=yn(F,Y,W),m[v+3+32]=m[v+2+96]=yn(Y,W,rt),m[v+3+64]=yn(W,rt,st),m[v+3+96]=yn(rt,st,yt)}function Ps(m,v){var T=m[v-1+0],O=m[v-1+32],F=m[v-1+64],Y=m[v-1+96];m[v+0+0]=T+O+1>>1,m[v+2+0]=m[v+0+32]=O+F+1>>1,m[v+2+32]=m[v+0+64]=F+Y+1>>1,m[v+1+0]=yn(T,O,F),m[v+3+0]=m[v+1+32]=yn(O,F,Y),m[v+3+32]=m[v+1+64]=yn(F,Y,Y),m[v+3+64]=m[v+2+64]=m[v+0+96]=m[v+1+96]=m[v+2+96]=m[v+3+96]=Y}function Nr(m,v){var T=m[v-1+0],O=m[v-1+32],F=m[v-1+64],Y=m[v-1+96],W=m[v-1-32],rt=m[v+0-32],st=m[v+1-32],yt=m[v+2-32];m[v+0+0]=m[v+2+32]=T+W+1>>1,m[v+0+32]=m[v+2+64]=O+T+1>>1,m[v+0+64]=m[v+2+96]=F+O+1>>1,m[v+0+96]=Y+F+1>>1,m[v+3+0]=yn(rt,st,yt),m[v+2+0]=yn(W,rt,st),m[v+1+0]=m[v+3+32]=yn(T,W,rt),m[v+1+32]=m[v+3+64]=yn(O,T,W),m[v+1+64]=m[v+3+96]=yn(F,O,T),m[v+1+96]=yn(Y,F,O)}function ra(m,v){var T;for(T=0;8>T;++T)r(m,v+32*T,m,v-32,8)}function Ha(m,v){var T;for(T=0;8>T;++T)i(m,v,m[v-1],8),v+=32}function _o(m,v,T){var O;for(O=0;8>O;++O)i(v,T+32*O,m,8)}function qa(m,v){var T,O=8;for(T=0;8>T;++T)O+=m[v+T-32]+m[v-1+32*T];_o(O>>4,m,v)}function js(m,v){var T,O=4;for(T=0;8>T;++T)O+=m[v+T-32];_o(O>>3,m,v)}function Li(m,v){var T,O=4;for(T=0;8>T;++T)O+=m[v-1+32*T];_o(O>>3,m,v)}function Ko(m,v){_o(128,m,v)}function Jo(m,v,T){var O=m[v-T],F=m[v+0],Y=3*(F-O)+Ca[1020+m[v-2*T]-m[v+T]],W=wc[112+(Y+4>>3)];m[v-T]=bo[255+O+wc[112+(Y+3>>3)]],m[v+0]=bo[255+F-W]}function Is(m,v,T,O){var F=m[v+0],Y=m[v+T];return so[255+m[v-2*T]-m[v-T]]>O||so[255+Y-F]>O}function ia(m,v,T,O){return 4*so[255+m[v-T]-m[v+0]]+so[255+m[v-2*T]-m[v+T]]<=O}function ba(m,v,T,O,F){var Y=m[v-3*T],W=m[v-2*T],rt=m[v-T],st=m[v+0],yt=m[v+T],_t=m[v+2*T],Vt=m[v+3*T];return 4*so[255+rt-st]+so[255+W-yt]>O?0:so[255+m[v-4*T]-Y]<=F&&so[255+Y-W]<=F&&so[255+W-rt]<=F&&so[255+Vt-_t]<=F&&so[255+_t-yt]<=F&&so[255+yt-st]<=F}function zs(m,v,T,O){var F=2*O+1;for(O=0;16>O;++O)ia(m,v+O,T,F)&&Jo(m,v+O,T)}function oa(m,v,T,O){var F=2*O+1;for(O=0;16>O;++O)ia(m,v+O*T,1,F)&&Jo(m,v+O*T,1)}function Bs(m,v,T,O){var F;for(F=3;0<F;--F)zs(m,v+=4*T,T,O)}function $a(m,v,T,O){var F;for(F=3;0<F;--F)oa(m,v+=4,T,O)}function Fs(m,v,T,O,F,Y,W,rt){for(Y=2*Y+1;0<F--;){if(ba(m,v,T,Y,W))if(Is(m,v,T,rt))Jo(m,v,T);else{var st=m,yt=v,_t=T,Vt=st[yt-2*_t],pt=st[yt-_t],Pt=st[yt+0],$t=st[yt+_t],ne=st[yt+2*_t],Yt=27*(ae=Ca[1020+3*(Pt-pt)+Ca[1020+Vt-$t]])+63>>7,Jt=18*ae+63>>7,ae=9*ae+63>>7;st[yt-3*_t]=bo[255+st[yt-3*_t]+ae],st[yt-2*_t]=bo[255+Vt+Jt],st[yt-_t]=bo[255+pt+Yt],st[yt+0]=bo[255+Pt-Yt],st[yt+_t]=bo[255+$t-Jt],st[yt+2*_t]=bo[255+ne-ae]}v+=O}}function Us(m,v,T,O,F,Y,W,rt){for(Y=2*Y+1;0<F--;){if(ba(m,v,T,Y,W))if(Is(m,v,T,rt))Jo(m,v,T);else{var st=m,yt=v,_t=T,Vt=st[yt-_t],pt=st[yt+0],Pt=st[yt+_t],$t=wc[112+(4+(ne=3*(pt-Vt))>>3)],ne=wc[112+(ne+3>>3)],Yt=$t+1>>1;st[yt-2*_t]=bo[255+st[yt-2*_t]+Yt],st[yt-_t]=bo[255+Vt+ne],st[yt+0]=bo[255+pt-$t],st[yt+_t]=bo[255+Pt-Yt]}v+=O}}function Vl(m,v,T,O,F,Y){Fs(m,v,T,1,16,O,F,Y)}function Ya(m,v,T,O,F,Y){Fs(m,v,1,T,16,O,F,Y)}function Wl(m,v,T,O,F,Y){var W;for(W=3;0<W;--W)Us(m,v+=4*T,T,1,16,O,F,Y)}function xa(m,v,T,O,F,Y){var W;for(W=3;0<W;--W)Us(m,v+=4,1,T,16,O,F,Y)}function Xl(m,v,T,O,F,Y,W,rt){Fs(m,v,F,1,8,Y,W,rt),Fs(T,O,F,1,8,Y,W,rt)}function M(m,v,T,O,F,Y,W,rt){Fs(m,v,1,F,8,Y,W,rt),Fs(T,O,1,F,8,Y,W,rt)}function B(m,v,T,O,F,Y,W,rt){Us(m,v+4*F,F,1,8,Y,W,rt),Us(T,O+4*F,F,1,8,Y,W,rt)}function dt(m,v,T,O,F,Y,W,rt){Us(m,v+4,1,F,8,Y,W,rt),Us(T,O+4,1,F,8,Y,W,rt)}function Et(){this.ba=new Mn,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new Vn,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function zt(){this.data=[],this.offset=this.kd=this.ha=this.w=0,this.na=[],this.xa=this.gb=this.Ja=this.Sa=this.P=0}function se(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function me(){this.ua=0,this.Wa=new Pn,this.vb=new Pn,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new Tt,this.yc=new G}function Qe(){this.xb=this.a=0,this.l=new Xi,this.ca=new Mn,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new K,this.Pb=0,this.wd=new K,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new me,this.ab=0,this.gc=l(4,se),this.Oc=0}function on(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new Xi,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function Rn(m,v,T,O,F,Y,W){for(m=m==null?0:m[v+0],v=0;v<W;++v)F[Y+v]=m+T[O+v]&255,m=F[Y+v]}function Un(m,v,T,O,F,Y,W){var rt;if(m==null)Rn(null,null,T,O,F,Y,W);else for(rt=0;rt<W;++rt)F[Y+rt]=m[v+rt]+T[O+rt]&255}function sr(m,v,T,O,F,Y,W){if(m==null)Rn(null,null,T,O,F,Y,W);else{var rt,st=m[v+0],yt=st,_t=st;for(rt=0;rt<W;++rt)yt=_t+(st=m[v+rt])-yt,_t=T[O+rt]+(-256&yt?0>yt?0:255:yt)&255,yt=st,F[Y+rt]=_t}}function Fi(m,v,T,O){var F=v.width,Y=v.o;if(t(m!=null&&v!=null),0>T||0>=O||T+O>Y)return null;if(!m.Cc){if(m.ga==null){var W;if(m.ga=new on,(W=m.ga==null)||(W=v.width*v.o,t(m.Gb.length==0),m.Gb=s(W),m.Uc=0,m.Gb==null?W=0:(m.mb=m.Gb,m.nb=m.Uc,m.rc=null,W=1),W=!W),!W){W=m.ga;var rt=m.Fa,st=m.P,yt=m.qc,_t=m.mb,Vt=m.nb,pt=st+1,Pt=yt-1,$t=W.l;if(t(rt!=null&&_t!=null&&v!=null),nl[0]=null,nl[1]=Rn,nl[2]=Un,nl[3]=sr,W.ca=_t,W.tb=Vt,W.c=v.width,W.i=v.height,t(0<W.c&&0<W.i),1>=yt)v=0;else if(W.$a=3&rt[st+0],W.Z=rt[st+0]>>2&3,W.Lc=rt[st+0]>>4&3,st=rt[st+0]>>6&3,0>W.$a||1<W.$a||4<=W.Z||1<W.Lc||st)v=0;else if($t.put=Me,$t.ac=Re,$t.bc=Oe,$t.ma=W,$t.width=v.width,$t.height=v.height,$t.Da=v.Da,$t.v=v.v,$t.va=v.va,$t.j=v.j,$t.o=v.o,W.$a)t:{t(W.$a==1),v=Or();e:for(;;){if(v==null){v=0;break t}if(t(W!=null),W.mc=v,v.c=W.c,v.i=W.i,v.l=W.l,v.l.ma=W,v.l.width=W.c,v.l.height=W.i,v.a=0,Bt(v.m,rt,pt,Pt),!ta(W.c,W.i,1,v,null)||(v.ab==1&&v.gc[0].hc==3&&Ar(v.s)?(W.ic=1,rt=v.c*v.i,v.Ta=null,v.Ua=0,v.V=s(rt),v.Ba=0,v.V==null?(v.a=1,v=0):v=1):(W.ic=0,v=ea(v,W.c)),!v))break e;v=1;break t}W.mc=null,v=0}else v=Pt>=W.c*W.i;W=!v}if(W)return null;m.ga.Lc!=1?m.Ga=0:O=Y-T}t(m.ga!=null),t(T+O<=Y);t:{if(v=(rt=m.ga).c,Y=rt.l.o,rt.$a==0){if(pt=m.rc,Pt=m.Vc,$t=m.Fa,st=m.P+1+T*v,yt=m.mb,_t=m.nb+T*v,t(st<=m.P+m.qc),rt.Z!=0)for(t(nl[rt.Z]!=null),W=0;W<O;++W)nl[rt.Z](pt,Pt,$t,st,yt,_t,v),pt=yt,Pt=_t,_t+=v,st+=v;else for(W=0;W<O;++W)r(yt,_t,$t,st,v),pt=yt,Pt=_t,_t+=v,st+=v;m.rc=pt,m.Vc=Pt}else{if(t(rt.mc!=null),v=T+O,t((W=rt.mc)!=null),t(v<=W.i),W.C>=v)v=1;else if(rt.ic||yi(),rt.ic){rt=W.V,pt=W.Ba,Pt=W.c;var ne=W.i,Yt=($t=1,st=W.$/Pt,yt=W.$%Pt,_t=W.m,Vt=W.s,W.$),Jt=Pt*ne,ae=Pt*v,we=Vt.wc,he=Yt<ae?mi(Vt,yt,st):null;t(Yt<=Jt),t(v<=ne),t(Ar(Vt));e:for(;;){for(;!_t.h&&Yt<ae;){if(yt&we||(he=mi(Vt,yt,st)),t(he!=null),At(_t),256>(ne=Fn(he.G[0],he.H[0],_t)))rt[pt+Yt]=ne,++Yt,++yt>=Pt&&(yt=0,++st<=v&&!(st%16)&&Ti(W,st));else{if(!(280>ne)){$t=0;break e}ne=Bn(ne-256,_t);var tn,He=Fn(he.G[4],he.H[4],_t);if(At(_t),!(Yt>=(He=or(Pt,He=Bn(He,_t)))&&Jt-Yt>=ne)){$t=0;break e}for(tn=0;tn<ne;++tn)rt[pt+Yt+tn]=rt[pt+Yt+tn-He];for(Yt+=ne,yt+=ne;yt>=Pt;)yt-=Pt,++st<=v&&!(st%16)&&Ti(W,st);Yt<ae&&yt&we&&(he=mi(Vt,yt,st))}t(_t.h==ut(_t))}Ti(W,st>v?v:st);break e}!$t||_t.h&&Yt<Jt?($t=0,W.a=_t.h?5:3):W.$=Yt,v=$t}else v=Yo(W,W.V,W.Ba,W.c,W.i,v,fa);if(!v){O=0;break t}}T+O>=Y&&(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*F}function Ni(m,v,T,O,F,Y){for(;0<F--;){var W,rt=m,st=v+(T?1:0),yt=m,_t=v+(T?0:3);for(W=0;W<O;++W){var Vt=yt[_t+4*W];Vt!=255&&(Vt*=32897,rt[st+4*W+0]=rt[st+4*W+0]*Vt>>23,rt[st+4*W+1]=rt[st+4*W+1]*Vt>>23,rt[st+4*W+2]=rt[st+4*W+2]*Vt>>23)}v+=Y}}function Pr(m,v,T,O,F){for(;0<O--;){var Y;for(Y=0;Y<T;++Y){var W=m[v+2*Y+0],rt=15&(yt=m[v+2*Y+1]),st=4369*rt,yt=(240&yt|yt>>4)*st>>16;m[v+2*Y+0]=(240&W|W>>4)*st>>16&240|(15&W|W<<4)*st>>16>>4&15,m[v+2*Y+1]=240&yt|rt}v+=F}}function ci(m,v,T,O,F,Y,W,rt){var st,yt,_t=255;for(yt=0;yt<F;++yt){for(st=0;st<O;++st){var Vt=m[v+st];Y[W+4*st]=Vt,_t&=Vt}v+=T,W+=rt}return _t!=255}function gi(m,v,T,O,F){var Y;for(Y=0;Y<F;++Y)T[O+Y]=m[v+Y]>>8}function yi(){Ma=Ni,gs=Pr,xc=ci,Qo=gi}function eo(m,v,T){ot[m]=function(O,F,Y,W,rt,st,yt,_t,Vt,pt,Pt,$t,ne,Yt,Jt,ae,we){var he,tn=we-1>>1,He=rt[st+0]|yt[_t+0]<<16,Sn=Vt[pt+0]|Pt[$t+0]<<16;t(O!=null);var Ge=3*He+Sn+131074>>2;for(v(O[F+0],255&Ge,Ge>>16,ne,Yt),Y!=null&&(Ge=3*Sn+He+131074>>2,v(Y[W+0],255&Ge,Ge>>16,Jt,ae)),he=1;he<=tn;++he){var Gn=rt[st+he]|yt[_t+he]<<16,$r=Vt[pt+he]|Pt[$t+he]<<16,zn=He+Gn+Sn+$r+524296,qe=zn+2*(Gn+Sn)>>3;Ge=qe+He>>1,He=(zn=zn+2*(He+$r)>>3)+Gn>>1,v(O[F+2*he-1],255&Ge,Ge>>16,ne,Yt+(2*he-1)*T),v(O[F+2*he-0],255&He,He>>16,ne,Yt+(2*he-0)*T),Y!=null&&(Ge=zn+Sn>>1,He=qe+$r>>1,v(Y[W+2*he-1],255&Ge,Ge>>16,Jt,ae+(2*he-1)*T),v(Y[W+2*he+0],255&He,He>>16,Jt,ae+(2*he+0)*T)),He=Gn,Sn=$r}1&we||(Ge=3*He+Sn+131074>>2,v(O[F+we-1],255&Ge,Ge>>16,ne,Yt+(we-1)*T),Y!=null&&(Ge=3*Sn+He+131074>>2,v(Y[W+we-1],255&Ge,Ge>>16,Jt,ae+(we-1)*T)))}}function Hs(){vo[Xc]=Cl,vo[xo]=Cc,vo[Gc]=Tf,vo[ys]=tu,vo[Sc]=El,vo[Zl]=Ss,vo[tl]=ks,vo[kc]=Cc,vo[Kc]=tu,vo[Ac]=El,vo[Jc]=Ss}function yc(m){return m&-16384?0>m?0:255:m>>eu}function ge(m,v){return yc((19077*m>>8)+(26149*v>>8)-14234)}function Zo(m,v,T){return yc((19077*m>>8)-(6419*v>>8)-(13320*T>>8)+8708)}function ds(m,v){return yc((19077*m>>8)+(33050*v>>8)-17685)}function Tn(m,v,T,O,F){O[F+0]=ge(m,T),O[F+1]=Zo(m,v,T),O[F+2]=ds(m,v)}function Nn(m,v,T,O,F){O[F+0]=ds(m,v),O[F+1]=Zo(m,v,T),O[F+2]=ge(m,T)}function Gl(m,v,T,O,F){var Y=Zo(m,v,T);v=Y<<3&224|ds(m,v)>>3,O[F+0]=248&ge(m,T)|Y>>5,O[F+1]=v}function Gi(m,v,T,O,F){var Y=240&ds(m,v)|15;O[F+0]=240&ge(m,T)|Zo(m,v,T)>>4,O[F+1]=Y}function vl(m,v,T,O,F){O[F+0]=255,Tn(m,v,T,O,F+1)}function ar(m,v,T,O,F){Nn(m,v,T,O,F),O[F+3]=255}function va(m,v,T,O,F){Tn(m,v,T,O,F),O[F+3]=255}function wa(m,v,T){ot[m]=function(O,F,Y,W,rt,st,yt,_t,Vt){for(var pt=_t+(-2&Vt)*T;_t!=pt;)v(O[F+0],Y[W+0],rt[st+0],yt,_t),v(O[F+1],Y[W+0],rt[st+0],yt,_t+T),F+=2,++W,++st,_t+=2*T;1&Vt&&v(O[F+0],Y[W+0],rt[st+0],yt,_t)}}function no(m,v,T){return T==0?m==0?v==0?6:5:v==0?4:0:T}function $c(m,v,T,O,F){switch(m>>>30){case 3:ms(v,T,O,F,0);break;case 2:qs(v,T,O,F);break;case 1:yo(v,T,O,F)}}function Va(m,v){var T,O,F=v.M,Y=v.Nb,W=m.oc,rt=m.pc+40,st=m.oc,yt=m.pc+584,_t=m.oc,Vt=m.pc+600;for(T=0;16>T;++T)W[rt+32*T-1]=129;for(T=0;8>T;++T)st[yt+32*T-1]=129,_t[Vt+32*T-1]=129;for(0<F?W[rt-1-32]=st[yt-1-32]=_t[Vt-1-32]=129:(i(W,rt-32-1,127,21),i(st,yt-32-1,127,9),i(_t,Vt-32-1,127,9)),O=0;O<m.za;++O){var pt=v.ya[v.aa+O];if(0<O){for(T=-1;16>T;++T)r(W,rt+32*T-4,W,rt+32*T+12,4);for(T=-1;8>T;++T)r(st,yt+32*T-4,st,yt+32*T+4,4),r(_t,Vt+32*T-4,_t,Vt+32*T+4,4)}var Pt=m.Gd,$t=m.Hd+O,ne=pt.ad,Yt=pt.Hc;if(0<F&&(r(W,rt-32,Pt[$t].y,0,16),r(st,yt-32,Pt[$t].f,0,8),r(_t,Vt-32,Pt[$t].ea,0,8)),pt.Za){var Jt=W,ae=rt-32+16;for(0<F&&(O>=m.za-1?i(Jt,ae,Pt[$t].y[15],4):r(Jt,ae,Pt[$t+1].y,0,4)),T=0;4>T;T++)Jt[ae+128+T]=Jt[ae+256+T]=Jt[ae+384+T]=Jt[ae+0+T];for(T=0;16>T;++T,Yt<<=2)Jt=W,ae=rt+xr[T],ei[pt.Ob[T]](Jt,ae),$c(Yt,ne,16*+T,Jt,ae)}else if(Jt=no(O,F,pt.Ob[0]),bi[Jt](W,rt),Yt!=0)for(T=0;16>T;++T,Yt<<=2)$c(Yt,ne,16*+T,W,rt+xr[T]);for(T=pt.Gc,Jt=no(O,F,pt.Dd),Ji[Jt](st,yt),Ji[Jt](_t,Vt),Yt=ne,Jt=st,ae=yt,255&(pt=0|T)&&(170&pt?Za(Yt,256,Jt,ae):Do(Yt,256,Jt,ae)),pt=_t,Yt=Vt,255&(T>>=8)&&(170&T?Za(ne,320,pt,Yt):Do(ne,320,pt,Yt)),F<m.Ub-1&&(r(Pt[$t].y,0,W,rt+480,16),r(Pt[$t].f,0,st,yt+224,8),r(Pt[$t].ea,0,_t,Vt+224,8)),T=8*Y*m.B,Pt=m.sa,$t=m.ta+16*O+16*Y*m.R,ne=m.qa,pt=m.ra+8*O+T,Yt=m.Ha,Jt=m.Ia+8*O+T,T=0;16>T;++T)r(Pt,$t+T*m.R,W,rt+32*T,16);for(T=0;8>T;++T)r(ne,pt+T*m.B,st,yt+32*T,8),r(Yt,Jt+T*m.B,_t,Vt+32*T,8)}}function Wa(m,v,T,O,F,Y,W,rt,st){var yt=[0],_t=[0],Vt=0,pt=st!=null?st.kd:0,Pt=st??new zt;if(m==null||12>T)return 7;Pt.data=m,Pt.w=v,Pt.ha=T,v=[v],T=[T],Pt.gb=[Pt.gb];t:{var $t=v,ne=T,Yt=Pt.gb;if(t(m!=null),t(ne!=null),t(Yt!=null),Yt[0]=0,12<=ne[0]&&!e(m,$t[0],"RIFF")){if(e(m,$t[0]+8,"WEBP")){Yt=3;break t}var Jt=We(m,$t[0]+4);if(12>Jt||4294967286<Jt){Yt=3;break t}if(pt&&Jt>ne[0]-8){Yt=7;break t}Yt[0]=Jt,$t[0]+=12,ne[0]-=12}Yt=0}if(Yt!=0)return Yt;for(Jt=0<Pt.gb[0],T=T[0];;){t:{var ae=m;ne=v,Yt=T;var we=yt,he=_t,tn=$t=[0];if((Ge=Vt=[Vt])[0]=0,8>Yt[0])Yt=7;else{if(!e(ae,ne[0],"VP8X")){if(We(ae,ne[0]+4)!=10){Yt=3;break t}if(18>Yt[0]){Yt=7;break t}var He=We(ae,ne[0]+8),Sn=1+Pe(ae,ne[0]+12);if(2147483648<=Sn*(ae=1+Pe(ae,ne[0]+15))){Yt=3;break t}tn!=null&&(tn[0]=He),we!=null&&(we[0]=Sn),he!=null&&(he[0]=ae),ne[0]+=18,Yt[0]-=18,Ge[0]=1}Yt=0}}if(Vt=Vt[0],$t=$t[0],Yt!=0)return Yt;if(ne=!!(2&$t),!Jt&&Vt)return 3;if(Y!=null&&(Y[0]=!!(16&$t)),W!=null&&(W[0]=ne),rt!=null&&(rt[0]=0),W=yt[0],$t=_t[0],Vt&&ne&&st==null){Yt=0;break}if(4>T){Yt=7;break}if(Jt&&Vt||!Jt&&!Vt&&!e(m,v[0],"ALPH")){T=[T],Pt.na=[Pt.na],Pt.P=[Pt.P],Pt.Sa=[Pt.Sa];t:{He=m,Yt=v,Jt=T;var Ge=Pt.gb;we=Pt.na,he=Pt.P,tn=Pt.Sa,Sn=22,t(He!=null),t(Jt!=null),ae=Yt[0];var Gn=Jt[0];for(t(we!=null),t(tn!=null),we[0]=null,he[0]=null,tn[0]=0;;){if(Yt[0]=ae,Jt[0]=Gn,8>Gn){Yt=7;break t}var $r=We(He,ae+4);if(4294967286<$r){Yt=3;break t}var zn=8+$r+1&-2;if(Sn+=zn,0<Ge&&Sn>Ge){Yt=3;break t}if(!e(He,ae,"VP8 ")||!e(He,ae,"VP8L")){Yt=0;break t}if(Gn[0]<zn){Yt=7;break t}e(He,ae,"ALPH")||(we[0]=He,he[0]=ae+8,tn[0]=$r),ae+=zn,Gn-=zn}}if(T=T[0],Pt.na=Pt.na[0],Pt.P=Pt.P[0],Pt.Sa=Pt.Sa[0],Yt!=0)break}T=[T],Pt.Ja=[Pt.Ja],Pt.xa=[Pt.xa];t:if(Ge=m,Yt=v,Jt=T,we=Pt.gb[0],he=Pt.Ja,tn=Pt.xa,He=Yt[0],ae=!e(Ge,He,"VP8 "),Sn=!e(Ge,He,"VP8L"),t(Ge!=null),t(Jt!=null),t(he!=null),t(tn!=null),8>Jt[0])Yt=7;else{if(ae||Sn){if(Ge=We(Ge,He+4),12<=we&&Ge>we-12){Yt=3;break t}if(pt&&Ge>Jt[0]-8){Yt=7;break t}he[0]=Ge,Yt[0]+=8,Jt[0]-=8,tn[0]=Sn}else tn[0]=5<=Jt[0]&&Ge[He+0]==47&&!(Ge[He+4]>>5),he[0]=Jt[0];Yt=0}if(T=T[0],Pt.Ja=Pt.Ja[0],Pt.xa=Pt.xa[0],v=v[0],Yt!=0)break;if(4294967286<Pt.Ja)return 3;if(rt==null||ne||(rt[0]=Pt.xa?2:1),W=[W],$t=[$t],Pt.xa){if(5>T){Yt=7;break}rt=W,pt=$t,ne=Y,m==null||5>T?m=0:5<=T&&m[v+0]==47&&!(m[v+4]>>5)?(Jt=[0],Ge=[0],we=[0],Bt(he=new K,m,v,T),Xn(he,Jt,Ge,we)?(rt!=null&&(rt[0]=Jt[0]),pt!=null&&(pt[0]=Ge[0]),ne!=null&&(ne[0]=we[0]),m=1):m=0):m=0}else{if(10>T){Yt=7;break}rt=$t,m==null||10>T||!mc(m,v+3,T-3)?m=0:(pt=m[v+0]|m[v+1]<<8|m[v+2]<<16,ne=16383&(m[v+7]<<8|m[v+6]),m=16383&(m[v+9]<<8|m[v+8]),1&pt||3<(pt>>1&7)||!(pt>>4&1)||pt>>5>=Pt.Ja||!ne||!m?m=0:(W&&(W[0]=ne),rt&&(rt[0]=m),m=1))}if(!m||(W=W[0],$t=$t[0],Vt&&(yt[0]!=W||_t[0]!=$t)))return 3;st!=null&&(st[0]=Pt,st.offset=v-st.w,t(4294967286>v-st.w),t(st.offset==st.ha-T));break}return Yt==0||Yt==7&&Vt&&st==null?(Y!=null&&(Y[0]|=Pt.na!=null&&0<Pt.na.length),O!=null&&(O[0]=W),F!=null&&(F[0]=$t),0):Yt}function Ki(m,v,T){var O=v.width,F=v.height,Y=0,W=0,rt=O,st=F;if(v.Da=m!=null&&0<m.Da,v.Da&&(rt=m.cd,st=m.bd,Y=m.v,W=m.j,11>T||(Y&=-2,W&=-2),0>Y||0>W||0>=rt||0>=st||Y+rt>O||W+st>F))return 0;if(v.v=Y,v.j=W,v.va=Y+rt,v.o=W+st,v.U=rt,v.T=st,v.da=m!=null&&0<m.da,v.da){if(!fe(rt,st,T=[m.ib],Y=[m.hb]))return 0;v.ib=T[0],v.hb=Y[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*F/4,v.Kb=0),1}function wl(m){if(m==null)return 2;if(11>m.S){var v=m.f.RGBA;v.fb+=(m.height-1)*v.A,v.A=-v.A}else v=m.f.kb,m=m.height,v.O+=(m-1)*v.fa,v.fa=-v.fa,v.N+=(m-1>>1)*v.Ab,v.Ab=-v.Ab,v.W+=(m-1>>1)*v.Db,v.Db=-v.Db,v.F!=null&&(v.J+=(m-1)*v.lb,v.lb=-v.lb);return 0}function Xa(m,v,T,O){if(O==null||0>=m||0>=v)return 2;if(T!=null){if(T.Da){var F=T.cd,Y=T.bd,W=-2&T.v,rt=-2&T.j;if(0>W||0>rt||0>=F||0>=Y||W+F>m||rt+Y>v)return 2;m=F,v=Y}if(T.da){if(!fe(m,v,F=[T.ib],Y=[T.hb]))return 2;m=F[0],v=Y[0]}}O.width=m,O.height=v;t:{var st=O.width,yt=O.height;if(m=O.S,0>=st||0>=yt||!(m>=Xc&&13>m))m=2;else{if(0>=O.Rd&&O.sd==null){W=Y=F=v=0;var _t=(rt=st*nc[m])*yt;if(11>m||(Y=(yt+1)/2*(v=(st+1)/2),m==12&&(W=(F=st)*yt)),(yt=s(_t+2*Y+W))==null){m=1;break t}O.sd=yt,11>m?((st=O.f.RGBA).eb=yt,st.fb=0,st.A=rt,st.size=_t):((st=O.f.kb).y=yt,st.O=0,st.fa=rt,st.Fd=_t,st.f=yt,st.N=0+_t,st.Ab=v,st.Cd=Y,st.ea=yt,st.W=0+_t+Y,st.Db=v,st.Ed=Y,m==12&&(st.F=yt,st.J=0+_t+2*Y),st.Tc=W,st.lb=F)}if(v=1,F=O.S,Y=O.width,W=O.height,F>=Xc&&13>F)if(11>F)m=O.f.RGBA,v&=(rt=Math.abs(m.A))*(W-1)+Y<=m.size,v&=rt>=Y*nc[F],v&=m.eb!=null;else{m=O.f.kb,rt=(Y+1)/2,_t=(W+1)/2,st=Math.abs(m.fa),yt=Math.abs(m.Ab);var Vt=Math.abs(m.Db),pt=Math.abs(m.lb),Pt=pt*(W-1)+Y;v&=st*(W-1)+Y<=m.Fd,v&=yt*(_t-1)+rt<=m.Cd,v=(v&=Vt*(_t-1)+rt<=m.Ed)&st>=Y&yt>=rt&Vt>=rt,v&=m.y!=null,v&=m.f!=null,v&=m.ea!=null,F==12&&(v&=pt>=Y,v&=Pt<=m.Tc,v&=m.F!=null)}else v=0;m=v?0:2}}return m!=0||T!=null&&T.fd&&(m=wl(O)),m}var Sl=64,Ga=[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],kl=24,ro=32,io=8,hs=[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"),ot.Predictor0=function(){return 4278190080},ot.Predictor1=function(m){return m},ot.Predictor2=function(m,v,T){return v[T+0]},ot.Predictor3=function(m,v,T){return v[T+1]},ot.Predictor4=function(m,v,T){return v[T-1]},ot.Predictor5=function(m,v,T){return Ue(Ue(m,v[T+1]),v[T+0])},ot.Predictor6=function(m,v,T){return Ue(m,v[T-1])},ot.Predictor7=function(m,v,T){return Ue(m,v[T+0])},ot.Predictor8=function(m,v,T){return Ue(v[T-1],v[T+0])},ot.Predictor9=function(m,v,T){return Ue(v[T+0],v[T+1])},ot.Predictor10=function(m,v,T){return Ue(Ue(m,v[T-1]),Ue(v[T+0],v[T+1]))},ot.Predictor11=function(m,v,T){var O=v[T+0];return 0>=Fe(O>>24&255,m>>24&255,(v=v[T-1])>>24&255)+Fe(O>>16&255,m>>16&255,v>>16&255)+Fe(O>>8&255,m>>8&255,v>>8&255)+Fe(255&O,255&m,255&v)?O:m},ot.Predictor12=function(m,v,T){var O=v[T+0];return(cn((m>>24&255)+(O>>24&255)-((v=v[T-1])>>24&255))<<24|cn((m>>16&255)+(O>>16&255)-(v>>16&255))<<16|cn((m>>8&255)+(O>>8&255)-(v>>8&255))<<8|cn((255&m)+(255&O)-(255&v)))>>>0},ot.Predictor13=function(m,v,T){var O=v[T-1];return(In((m=Ue(m,v[T+0]))>>24&255,O>>24&255)<<24|In(m>>16&255,O>>16&255)<<16|In(m>>8&255,O>>8&255)<<8|In(255&m,255&O))>>>0};var Sa=ot.PredictorAdd0;ot.PredictorAdd1=_n,Ne("Predictor2","PredictorAdd2"),Ne("Predictor3","PredictorAdd3"),Ne("Predictor4","PredictorAdd4"),Ne("Predictor5","PredictorAdd5"),Ne("Predictor6","PredictorAdd6"),Ne("Predictor7","PredictorAdd7"),Ne("Predictor8","PredictorAdd8"),Ne("Predictor9","PredictorAdd9"),Ne("Predictor10","PredictorAdd10"),Ne("Predictor11","PredictorAdd11"),Ne("Predictor12","PredictorAdd12"),Ne("Predictor13","PredictorAdd13");var ka=ot.PredictorAdd2;Ie("ColorIndexInverseTransform","MapARGB","32b",function(m){return m>>8&255},function(m){return m}),Ie("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",function(m){return m},function(m){return m>>8&255});var Kl,Uo=ot.ColorIndexInverseTransform,yr=ot.MapARGB,bc=ot.VP8LColorIndexInverseTransformAlpha,_r=ot.MapAlpha,go=ot.VP8LPredictorsAdd=[];go.length=16,(ot.VP8LPredictors=[]).length=16,(ot.VP8LPredictorsAdd_C=[]).length=16,(ot.VP8LPredictors_C=[]).length=16;var Ka,Al,Se,oo,Aa,Ja,ps,ms,qs,Za,yo,Do,br,jr,_i,Gr,Ho,Qa,Jl,Yc,pd,md,Du,Lu,Ma,gs,xc,Qo,Ml=s(511),Ru=s(2041),vc=s(225),Vc=s(767),Wc=0,Ca=Ru,wc=vc,bo=Vc,so=Ml,Xc=0,xo=1,Gc=2,ys=3,Sc=4,Zl=5,tl=6,kc=7,Kc=8,Ac=9,Jc=10,bs=[2,3,7],Ql=[3,3,11],$s=[280,256,256,256,40],Zc=[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],xs=[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],vs=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],el=8,Lo=[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],ws=[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],ao=null,Cf=[[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]],Ou=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],Qc=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],Ef=[[[[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]]]],lo=[[[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]]],Kr=[[[[255,255,255,255,255,255,255,255,255,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]]]],nr=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],bi=[],ei=[],Ji=[],sa=1,Pu=2,nl=[],vo=[];eo("UpsampleRgbLinePair",Tn,3),eo("UpsampleBgrLinePair",Nn,3),eo("UpsampleRgbaLinePair",va,4),eo("UpsampleBgraLinePair",ar,4),eo("UpsampleArgbLinePair",vl,4),eo("UpsampleRgba4444LinePair",Gi,2),eo("UpsampleRgb565LinePair",Gl,2);var Cl=ot.UpsampleRgbLinePair,Tf=ot.UpsampleBgrLinePair,Cc=ot.UpsampleRgbaLinePair,tu=ot.UpsampleBgraLinePair,El=ot.UpsampleArgbLinePair,Ss=ot.UpsampleRgba4444LinePair,ks=ot.UpsampleRgb565LinePair,ts=16,Tl=1<<ts-1,tc=-227,Ys=482,eu=6,rl=0,Zi=s(256),nu=s(256),gd=s(256),ec=s(256),yh=s(Ys-tc),Nf=s(Ys-tc);wa("YuvToRgbRow",Tn,3),wa("YuvToBgrRow",Nn,3),wa("YuvToRgbaRow",va,4),wa("YuvToBgraRow",ar,4),wa("YuvToArgbRow",vl,4),wa("YuvToRgba4444Row",Gi,2),wa("YuvToRgb565Row",Gl,2);var xr=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Nl=[0,2,8],Ec=[8,7,6,4,4,2,2,2,1,1,1,1],ru=1;this.WebPDecodeRGBA=function(m,v,T,O,F){var Y=xo,W=new Et,rt=new Mn;W.ba=rt,rt.S=Y,rt.width=[rt.width],rt.height=[rt.height];var st=rt.width,yt=rt.height,_t=new Ke;if(_t==null||m==null)var Vt=2;else t(_t!=null),Vt=Wa(m,v,T,_t.width,_t.height,_t.Pd,_t.Qd,_t.format,null);if(Vt!=0?st=0:(st!=null&&(st[0]=_t.width[0]),yt!=null&&(yt[0]=_t.height[0]),st=1),st){rt.width=rt.width[0],rt.height=rt.height[0],O!=null&&(O[0]=rt.width),F!=null&&(F[0]=rt.height);t:{if(O=new Xi,(F=new zt).data=m,F.w=v,F.ha=T,F.kd=1,v=[0],t(F!=null),((m=Wa(F.data,F.w,F.ha,null,null,null,v,null,F))==0||m==7)&&v[0]&&(m=4),(v=m)==0){if(t(W!=null),O.data=F.data,O.w=F.w+F.offset,O.ha=F.ha-F.offset,O.put=Me,O.ac=Re,O.bc=Oe,O.ma=W,F.xa){if((m=Or())==null){W=1;break t}if((function(pt,Pt){var $t=[0],ne=[0],Yt=[0];e:for(;;){if(pt==null)return 0;if(Pt==null)return pt.a=2,0;if(pt.l=Pt,pt.a=0,Bt(pt.m,Pt.data,Pt.w,Pt.ha),!Xn(pt.m,$t,ne,Yt)){pt.a=3;break e}if(pt.xb=Pu,Pt.width=$t[0],Pt.height=ne[0],!ta($t[0],ne[0],1,pt,null))break e;return 1}return t(pt.a!=0),0})(m,O)){if(O=(v=Xa(O.width,O.height,W.Oa,W.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((F=T.ma)!=null),O.xb!=0){if(O.ca=F.ba,O.tb=F.tb,t(O.ca!=null),!Ki(F.Oa,T,ys)){O.a=2;break n}if(!ea(O,T.width)||T.da)break n;if((T.da||gn(O.ca.S))&&yi(),11>O.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),O.ca.f.kb.F!=null&&yi()),O.Pb&&0<O.s.ua&&O.s.vb.X==null&&!ct(O.s.vb,O.s.Wa.Xa)){O.a=1;break n}O.xb=0}if(!Yo(O,O.V,O.Ba,O.c,O.i,T.o,ai))break n;F.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 Vo)==null){W=1;break t}if(m.Fa=F.na,m.P=F.P,m.qc=F.Sa,pa(m,O)){if((v=Xa(O.width,O.height,W.Oa,W.ba))==0){if(m.Aa=0,T=W.Oa,t((F=m)!=null),T!=null){if(0<(st=0>(st=T.Md)?0:100<st?255:255*st/100)){for(yt=_t=0;4>yt;++yt)12>(Vt=F.pb[yt]).lc&&(Vt.ia=st*Ec[0>Vt.lc?0:Vt.lc]>>3),_t|=Vt.ia;_t&&(alert("todo:VP8InitRandom"),F.ia=1)}F.Ga=T.Id,100<F.Ga?F.Ga=100:0>F.Ga&&(F.Ga=0)}(function(pt,Pt){if(pt==null)return 0;if(Pt==null)return fr(pt,2,"NULL VP8Io parameter in VP8Decode().");if(!pt.cb&&!pa(pt,Pt))return 0;if(t(pt.cb),Pt.ac==null||Pt.ac(Pt)){Pt.ob&&(pt.L=0);var $t=Nl[pt.L];if(pt.L==2?(pt.yb=0,pt.zb=0):(pt.yb=Pt.v-$t>>4,pt.zb=Pt.j-$t>>4,0>pt.yb&&(pt.yb=0),0>pt.zb&&(pt.zb=0)),pt.Va=Pt.o+15+$t>>4,pt.Hb=Pt.va+15+$t>>4,pt.Hb>pt.za&&(pt.Hb=pt.za),pt.Va>pt.Ub&&(pt.Va=pt.Ub),0<pt.L){var ne=pt.ed;for($t=0;4>$t;++$t){var Yt;if(pt.Qa.Cb){var Jt=pt.Qa.Lb[$t];pt.Qa.Fb||(Jt+=ne.Tb)}else Jt=ne.Tb;for(Yt=0;1>=Yt;++Yt){var ae=pt.gd[$t][Yt],we=Jt;if(ne.Pc&&(we+=ne.vd[0],Yt&&(we+=ne.od[0])),0<(we=0>we?0:63<we?63:we)){var he=we;0<ne.wb&&(he=4<ne.wb?he>>2:he>>1)>9-ne.wb&&(he=9-ne.wb),1>he&&(he=1),ae.dd=he,ae.tc=2*we+he,ae.ld=40<=we?2:15<=we?1:0}else ae.tc=0;ae.La=Yt}}}$t=0}else fr(pt,6,"Frame setup failed"),$t=pt.a;if($t=$t==0){if($t){pt.$c=0,0<pt.Aa||(pt.Ic=ru);e:{$t=pt.Ic,ne=4*(he=pt.za);var tn=32*he,He=he+1,Sn=0<pt.L?he*(0<pt.Aa?2:1):0,Ge=(pt.Aa==2?2:1)*he;if((ae=ne+832+(Yt=3*(16*$t+Nl[pt.L])/2*tn)+(Jt=pt.Fa!=null&&0<pt.Fa.length?pt.Kc.c*pt.Kc.i:0))!=ae)$t=0;else{if(ae>pt.Vb){if(pt.Vb=0,pt.Ec=s(ae),pt.Fc=0,pt.Ec==null){$t=fr(pt,1,"no memory during frame initialization.");break e}pt.Vb=ae}ae=pt.Ec,we=pt.Fc,pt.Ac=ae,pt.Bc=we,we+=ne,pt.Gd=l(tn,pc),pt.Hd=0,pt.rb=l(He+1,da),pt.sb=1,pt.wa=Sn?l(Sn,Ls):null,pt.Y=0,pt.D.Nb=0,pt.D.wa=pt.wa,pt.D.Y=pt.Y,0<pt.Aa&&(pt.D.Y+=he),t(!0),pt.oc=ae,pt.pc=we,we+=832,pt.ya=l(Ge,hc),pt.aa=0,pt.D.ya=pt.ya,pt.D.aa=pt.aa,pt.Aa==2&&(pt.D.aa+=he),pt.R=16*he,pt.B=8*he,he=(tn=Nl[pt.L])*pt.R,tn=tn/2*pt.B,pt.sa=ae,pt.ta=we+he,pt.qa=pt.sa,pt.ra=pt.ta+16*$t*pt.R+tn,pt.Ha=pt.qa,pt.Ia=pt.ra+8*$t*pt.B+tn,pt.$c=0,we+=Yt,pt.mb=Jt?ae:null,pt.nb=Jt?we:null,t(we+Jt<=pt.Fc+pt.Vb),ma(pt),i(pt.Ac,pt.Bc,0,ne),$t=1}}if($t){if(Pt.ka=0,Pt.y=pt.sa,Pt.O=pt.ta,Pt.f=pt.qa,Pt.N=pt.ra,Pt.ea=pt.Ha,Pt.Vd=pt.Ia,Pt.fa=pt.R,Pt.Rc=pt.B,Pt.F=null,Pt.J=0,!Wc){for($t=-255;255>=$t;++$t)Ml[255+$t]=0>$t?-$t:$t;for($t=-1020;1020>=$t;++$t)Ru[1020+$t]=-128>$t?-128:127<$t?127:$t;for($t=-112;112>=$t;++$t)vc[112+$t]=-16>$t?-16:15<$t?15:$t;for($t=-255;510>=$t;++$t)Vc[255+$t]=0>$t?0:255<$t?255:$t;Wc=1}ps=Xo,ms=ls,Za=Di,yo=Wo,Do=Zn,qs=Fr,br=Vl,jr=Ya,_i=Xl,Gr=M,Ho=Wl,Qa=xa,Jl=B,Yc=dt,pd=zs,md=oa,Du=Bs,Lu=$a,ei[0]=gc,ei[1]=cs,ei[2]=Yl,ei[3]=xl,ei[4]=ya,ei[5]=Os,ei[6]=Rs,ei[7]=Go,ei[8]=Nr,ei[9]=Ps,bi[0]=us,bi[1]=Hc,bi[2]=bl,bi[3]=Mf,bi[4]=ga,bi[5]=qc,bi[6]=fs,Ji[0]=qa,Ji[1]=te,Ji[2]=ra,Ji[3]=Ha,Ji[4]=Li,Ji[5]=js,Ji[6]=Ko,$t=1}else $t=0}$t&&($t=(function(Gn,$r){for(Gn.M=0;Gn.M<Gn.Va;++Gn.M){var zn,qe=Gn.Jc[Gn.M&Gn.Xb],De=Gn.m,ni=Gn;for(zn=0;zn<ni.za;++zn){var kn=De,jn=ni,Dr=jn.Ac,Ri=jn.Bc+4*zn,Qi=jn.zc,Jr=jn.ya[jn.aa+zn];if(jn.Qa.Bb?Jr.$b=Zt(kn,jn.Pa.jb[0])?2+Zt(kn,jn.Pa.jb[2]):Zt(kn,jn.Pa.jb[1]):Jr.$b=0,jn.kc&&(Jr.Ad=Zt(kn,jn.Bd)),Jr.Za=!Zt(kn,145)+0,Jr.Za){var Ui=Jr.Ob,wo=0;for(jn=0;4>jn;++jn){var Oi,Kn=Qi[0+jn];for(Oi=0;4>Oi;++Oi){Kn=lo[Dr[Ri+Oi]][Kn];for(var dr=Qc[Zt(kn,Kn[0])];0<dr;)dr=Qc[2*dr+Zt(kn,Kn[dr])];Kn=-dr,Dr[Ri+Oi]=Kn}r(Ui,wo,Dr,Ri,4),wo+=4,Qi[0+jn]=Kn}}else Kn=Zt(kn,156)?Zt(kn,128)?1:3:Zt(kn,163)?2:0,Jr.Ob[0]=Kn,i(Dr,Ri,Kn,4),i(Qi,0,Kn,4);Jr.Dd=Zt(kn,142)?Zt(kn,114)?Zt(kn,183)?1:3:2:0}if(ni.m.Ka)return fr(Gn,7,"Premature end-of-partition0 encountered.");for(;Gn.ja<Gn.za;++Gn.ja){if(ni=qe,kn=(De=Gn).rb[De.sb-1],Dr=De.rb[De.sb+De.ja],zn=De.ya[De.aa+De.ja],Ri=De.kc?zn.Ad:0)kn.la=Dr.la=0,zn.Za||(kn.Na=Dr.Na=0),zn.Hc=0,zn.Gc=0,zn.ia=0;else{var xi,lr;if(kn=Dr,Dr=ni,Ri=De.Pa.Xc,Qi=De.ya[De.aa+De.ja],Jr=De.pb[Qi.$b],jn=Qi.ad,Ui=0,wo=De.rb[De.sb-1],Kn=Oi=0,i(jn,Ui,0,384),Qi.Za)var to=0,vi=Ri[3];else{dr=s(16);var cr=kn.Na+wo.Na;if(cr=ao(Dr,Ri[1],cr,Jr.Eb,0,dr,0),kn.Na=wo.Na=(0<cr)+0,1<cr)ps(dr,0,jn,Ui);else{var Pi=dr[0]+3>>3;for(dr=0;256>dr;dr+=16)jn[Ui+dr]=Pi}to=1,vi=Ri[0]}var vr=15&kn.la,wi=15&wo.la;for(dr=0;4>dr;++dr){var Si=1&wi;for(Pi=lr=0;4>Pi;++Pi)vr=vr>>1|(Si=(cr=ao(Dr,vi,cr=Si+(1&vr),Jr.Sc,to,jn,Ui))>to)<<7,lr=lr<<2|(3<cr?3:1<cr?2:jn[Ui+0]!=0),Ui+=16;vr>>=4,wi=wi>>1|Si<<7,Oi=(Oi<<8|lr)>>>0}for(vi=vr,to=wi>>4,xi=0;4>xi;xi+=2){for(lr=0,vr=kn.la>>4+xi,wi=wo.la>>4+xi,dr=0;2>dr;++dr){for(Si=1&wi,Pi=0;2>Pi;++Pi)cr=Si+(1&vr),vr=vr>>1|(Si=0<(cr=ao(Dr,Ri[2],cr,Jr.Qc,0,jn,Ui)))<<3,lr=lr<<2|(3<cr?3:1<cr?2:jn[Ui+0]!=0),Ui+=16;vr>>=2,wi=wi>>1|Si<<5}Kn|=lr<<4*xi,vi|=vr<<4<<xi,to|=(240&wi)<<xi}kn.la=vi,wo.la=to,Qi.Hc=Oi,Qi.Gc=Kn,Qi.ia=43690&Kn?0:Jr.ia,Ri=!(Oi|Kn)}if(0<De.L&&(De.wa[De.Y+De.ja]=De.gd[zn.$b][zn.Za],De.wa[De.Y+De.ja].La|=!Ri),ni.Ka)return fr(Gn,7,"Premature end-of-file encountered.")}if(ma(Gn),De=$r,ni=1,zn=(qe=Gn).D,kn=0<qe.L&&qe.M>=qe.zb&&qe.M<=qe.Va,qe.Aa==0)e:{if(zn.M=qe.M,zn.uc=kn,Va(qe,zn),ni=1,zn=(lr=qe.D).Nb,kn=(Kn=Nl[qe.L])*qe.R,Dr=Kn/2*qe.B,dr=16*zn*qe.R,Pi=8*zn*qe.B,Ri=qe.sa,Qi=qe.ta-kn+dr,Jr=qe.qa,jn=qe.ra-Dr+Pi,Ui=qe.Ha,wo=qe.Ia-Dr+Pi,wi=(vr=lr.M)==0,Oi=vr>=qe.Va-1,qe.Aa==2&&Va(qe,lr),lr.uc)for(Si=(cr=qe).D.M,t(cr.D.uc),lr=cr.yb;lr<cr.Hb;++lr){to=lr,vi=Si;var Cr=(bn=(tt=cr).D).Nb;xi=tt.R;var bn=bn.wa[bn.Y+to],Hi=tt.sa,Zr=tt.ta+16*Cr*xi+16*to,w=bn.dd,S=bn.tc;if(S!=0)if(t(3<=S),tt.L==1)0<to&&md(Hi,Zr,xi,S+4),bn.La&&Lu(Hi,Zr,xi,S),0<vi&&pd(Hi,Zr,xi,S+4),bn.La&&Du(Hi,Zr,xi,S);else{var N=tt.B,D=tt.qa,j=tt.ra+8*Cr*N+8*to,X=tt.Ha,tt=tt.Ia+8*Cr*N+8*to;Cr=bn.ld,0<to&&(jr(Hi,Zr,xi,S+4,w,Cr),Gr(D,j,X,tt,N,S+4,w,Cr)),bn.La&&(Qa(Hi,Zr,xi,S,w,Cr),Yc(D,j,X,tt,N,S,w,Cr)),0<vi&&(br(Hi,Zr,xi,S+4,w,Cr),_i(D,j,X,tt,N,S+4,w,Cr)),bn.La&&(Ho(Hi,Zr,xi,S,w,Cr),Jl(D,j,X,tt,N,S,w,Cr))}}if(qe.ia&&alert("todo:DitherRow"),De.put!=null){if(lr=16*vr,vr=16*(vr+1),wi?(De.y=qe.sa,De.O=qe.ta+dr,De.f=qe.qa,De.N=qe.ra+Pi,De.ea=qe.Ha,De.W=qe.Ia+Pi):(lr-=Kn,De.y=Ri,De.O=Qi,De.f=Jr,De.N=jn,De.ea=Ui,De.W=wo),Oi||(vr-=Kn),vr>De.o&&(vr=De.o),De.F=null,De.J=null,qe.Fa!=null&&0<qe.Fa.length&&lr<vr&&(De.J=Fi(qe,De,lr,vr-lr),De.F=qe.mb,De.F==null&&De.F.length==0)){ni=fr(qe,3,"Could not decode alpha data.");break e}lr<De.j&&(Kn=De.j-lr,lr=De.j,t(!(1&Kn)),De.O+=qe.R*Kn,De.N+=qe.B*(Kn>>1),De.W+=qe.B*(Kn>>1),De.F!=null&&(De.J+=De.width*Kn)),lr<vr&&(De.O+=De.v,De.N+=De.v>>1,De.W+=De.v>>1,De.F!=null&&(De.J+=De.v),De.ka=lr-De.j,De.U=De.va-De.v,De.T=vr-lr,ni=De.put(De))}zn+1!=qe.Ic||Oi||(r(qe.sa,qe.ta-kn,Ri,Qi+16*qe.R,kn),r(qe.qa,qe.ra-Dr,Jr,jn+8*qe.B,Dr),r(qe.Ha,qe.Ia-Dr,Ui,wo+8*qe.B,Dr))}if(!ni)return fr(Gn,6,"Output aborted.")}return 1})(pt,Pt)),Pt.bc!=null&&Pt.bc(Pt),$t&=1}return $t?(pt.cb=0,$t):0})(m,O)||(v=m.a)}}else v=m.a}v==0&&W.Oa!=null&&W.Oa.fd&&(v=wl(W.ba))}W=v}Y=W!=0?null:11>Y?rt.f.RGBA.eb:rt.f.kb.y}else Y=null;return Y};var nc=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function d(ot,Dt){for(var Q="",at=0;at<4;at++)Q+=String.fromCharCode(ot[Dt++]);return Q}function p(ot,Dt){return ot[Dt+0]|ot[Dt+1]<<8}function g(ot,Dt){return(ot[Dt+0]|ot[Dt+1]<<8|ot[Dt+2]<<16)>>>0}function b(ot,Dt){return(ot[Dt+0]|ot[Dt+1]<<8|ot[Dt+2]<<16|ot[Dt+3]<<24)>>>0}new f;var y=[0],A=[0],E=[],L=new f,R=n,q=(function(ot,Dt){var Q={},at=0,G=!1,vt=0,Tt=0;if(Q.frames=[],!(function(_,K){for(var V=0;V<4;V++)if(_[K+V]!="RIFF".charCodeAt(V))return!0;return!1})(ot,Dt)){for(b(ot,Dt+=4),Dt+=8;Dt<ot.length;){var gt=d(ot,Dt),Z=b(ot,Dt+=4);Dt+=4;var lt=Z+(1&Z);switch(gt){case"VP8 ":case"VP8L":Q.frames[at]===void 0&&(Q.frames[at]={}),(J=Q.frames[at]).src_off=G?Tt:Dt-8,J.src_size=vt+Z+8,at++,G&&(G=!1,vt=0,Tt=0);break;case"VP8X":(J=Q.header={}).feature_flags=ot[Dt];var Bt=Dt+4;J.canvas_width=1+g(ot,Bt),Bt+=3,J.canvas_height=1+g(ot,Bt),Bt+=3;break;case"ALPH":G=!0,vt=lt+8,Tt=Dt-8;break;case"ANIM":(J=Q.header).bgcolor=b(ot,Dt),Bt=Dt+4,J.loop_count=p(ot,Bt),Bt+=2;break;case"ANMF":var ee,J;(J=Q.frames[at]={}).offset_x=2*g(ot,Dt),Dt+=3,J.offset_y=2*g(ot,Dt),Dt+=3,J.width=1+g(ot,Dt),Dt+=3,J.height=1+g(ot,Dt),Dt+=3,J.duration=g(ot,Dt),Dt+=3,ee=ot[Dt++],J.dispose=1&ee,J.blend=ee>>1&1}gt!="ANMF"&&(Dt+=lt)}return Q}})(R,0);q.response=R,q.rgbaoutput=!0,q.dataurl=!1;var H=q.header?q.header:null,$=q.frames?q.frames:null;if(H){H.loop_counter=H.loop_count,y=[H.canvas_height],A=[H.canvas_width];for(var ht=0;ht<$.length&&$[ht].blend!=0;ht++);}var Mt=$[0],wt=L.WebPDecodeRGBA(R,Mt.src_off,Mt.src_size,A,y);Mt.rgba=wt,Mt.imgwidth=A[0],Mt.imgheight=y[0];for(var bt=0;bt<A[0]*y[0]*4;bt++)E[bt]=wt[bt];return this.width=A,this.height=y,this.data=E,this}function k_(){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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")+"</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 A_(){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(_){return _=_||{},this.isStrokeTransparent=_.isStrokeTransparent||!1,this.strokeOpacity=_.strokeOpacity||1,this.strokeStyle=_.strokeStyle||"#000000",this.fillStyle=_.fillStyle||"#000000",this.isFillTransparent=_.isFillTransparent||!1,this.fillOpacity=_.fillOpacity||1,this.font=_.font||"10px sans-serif",this.textBaseline=_.textBaseline||"alphabetic",this.textAlign=_.textAlign||"left",this.lineWidth=_.lineWidth||1,this.lineJoin=_.lineJoin||"miter",this.lineCap=_.lineCap||"butt",this.path=_.path||[],this.transform=_.transform!==void 0?_.transform.clone():new f,this.globalCompositeOperation=_.globalCompositeOperation||"normal",this.globalAlpha=_.globalAlpha||1,this.clip_path=_.clip_path||[],this.currentPoint=_.currentPoint||new l,this.miterLimit=_.miterLimit||10,this.lastPoint=_.lastPoint||new l,this.lineDashOffset=_.lineDashOffset||0,this.lineDash=_.lineDash||[],this.margin=_.margin||[0,0,0,0],this.prevPageLastElemOffset=_.prevPageLastElemOffset||0,this.ignoreClearRect=typeof _.ignoreClearRect!="boolean"||_.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(_){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var K=_;Object.defineProperty(this,"pdf",{get:function(){return K}});var V=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return V},set:function(ct){V=!!ct}});var ut=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return ut},set:function(ct){ut=!!ct}});var xt=0;Object.defineProperty(this,"posX",{get:function(){return xt},set:function(ct){isNaN(ct)||(xt=ct)}});var At=0;Object.defineProperty(this,"posY",{get:function(){return At},set:function(ct){isNaN(ct)||(At=ct)}}),Object.defineProperty(this,"margin",{get:function(){return d.margin},set:function(ct){var Le;typeof ct=="number"?Le=[ct,ct,ct,ct]:((Le=new Array(4))[0]=ct[0],Le[1]=ct.length>=2?ct[1]:Le[0],Le[2]=ct.length>=3?ct[2]:Le[0],Le[3]=ct.length>=4?ct[3]:Le[1]),d.margin=Le}});var Ft=!1;Object.defineProperty(this,"autoPaging",{get:function(){return Ft},set:function(ct){Ft=ct}});var Lt=0;Object.defineProperty(this,"lastBreak",{get:function(){return Lt},set:function(ct){Lt=ct}});var Zt=[];Object.defineProperty(this,"pageBreaks",{get:function(){return Zt},set:function(ct){Zt=ct}}),Object.defineProperty(this,"ctx",{get:function(){return d},set:function(ct){ct instanceof p&&(d=ct)}}),Object.defineProperty(this,"path",{get:function(){return d.path},set:function(ct){d.path=ct}});var ve=[];Object.defineProperty(this,"ctxStack",{get:function(){return ve},set:function(ct){ve=ct}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(ct){var Le;Le=b(ct),this.ctx.fillStyle=Le.style,this.ctx.isFillTransparent=Le.a===0,this.ctx.fillOpacity=Le.a,this.pdf.setFillColor(Le.r,Le.g,Le.b,{a:Le.a}),this.pdf.setTextColor(Le.r,Le.g,Le.b,{a:Le.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(ct){var Le=b(ct);this.ctx.strokeStyle=Le.style,this.ctx.isStrokeTransparent=Le.a===0,this.ctx.strokeOpacity=Le.a,Le.a===0?this.pdf.setDrawColor(255,255,255):(Le.a,this.pdf.setDrawColor(Le.r,Le.g,Le.b))}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(ct){["butt","round","square"].indexOf(ct)!==-1&&(this.ctx.lineCap=ct,this.pdf.setLineCap(ct))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(ct){isNaN(ct)||(this.ctx.lineWidth=ct,this.pdf.setLineWidth(ct))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(ct){["bevel","round","miter"].indexOf(ct)!==-1&&(this.ctx.lineJoin=ct,this.pdf.setLineJoin(ct))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(ct){isNaN(ct)||(this.ctx.miterLimit=ct,this.pdf.setMiterLimit(ct))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(ct){this.ctx.textBaseline=ct}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(ct){["right","end","center","left","start"].indexOf(ct)!==-1&&(this.ctx.textAlign=ct)}});var je=null,Pe=null,We=null;Object.defineProperty(this,"fontFaces",{get:function(){return We},set:function(ct){je=null,Pe=null,We=ct}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(ct){var Le;if(this.ctx.font=ct,(Le=/^\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(ct))!==null){var Pn=Le[1];Le[2];var fe=Le[3],ye=Le[4];Le[5];var Te=Le[6],Ne=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(ye)[2];ye=Math.floor(Ne==="px"?parseFloat(ye)*this.pdf.internal.scaleFactor:Ne==="em"?parseFloat(ye)*this.pdf.getFontSize():parseFloat(ye)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(ye);var _e=(function(Ie){var kr,wn,nn=[],ln=Ie.trim();if(ln==="")return Dy;if(ln in Vw)return[Vw[ln]];for(;ln!=="";){switch(wn=null,kr=(ln=Xw(ln)).charAt(0)){case'"':case"'":wn=y_(ln.substring(1),kr);break;default:wn=b_(ln)}if(wn===null||(nn.push(wn[0]),(ln=Xw(wn[1]))!==""&&ln.charAt(0)!==","))return Dy;ln=ln.replace(/^,/,"")}return nn})(Te);if(this.fontFaces){var Ue=(function(Ie,kr){var wn=Ie.getFontList(),nn=JSON.stringify(wn);if(je===null||Pe!==nn){var ln=(function(Ln){var Ze=[];return Object.keys(Ln).forEach(function(ur){Ln[ur].forEach(function(gn){var xn=null;switch(gn){case"bold":xn={family:ur,weight:"bold"};break;case"italic":xn={family:ur,style:"italic"};break;case"bolditalic":xn={family:ur,weight:"bold",style:"italic"};break;case"":case"normal":xn={family:ur}}xn!==null&&(xn.ref={name:ur,style:gn},Ze.push(xn))})}),Ze})(wn);je=(function(Ln){for(var Ze={},ur=0;ur<Ln.length;++ur){var gn=_y(Ln[ur]),xn=gn.family,gr=gn.stretch,Mn=gn.style,Ke=gn.weight;Ze[xn]=Ze[xn]||{},Ze[xn][gr]=Ze[xn][gr]||{},Ze[xn][gr][Mn]=Ze[xn][gr][Mn]||{},Ze[xn][gr][Mn][Ke]=gn}return Ze})(ln.concat(kr)),Pe=nn}return je})(this.pdf,this.fontFaces),cn=_e.map(function(Ie){return{family:Ie,stretch:"normal",weight:fe,style:Pn}}),In=(function(Ie,kr,wn){for(var nn=(wn=wn||{}).defaultFontFamily||"times",ln=Object.assign({},g_,wn.genericFontFamilies||{}),Ln=null,Ze=null,ur=0;ur<kr.length;++ur)if(ln[(Ln=_y(kr[ur])).family]&&(Ln.family=ln[Ln.family]),Ie.hasOwnProperty(Ln.family)){Ze=Ie[Ln.family];break}if(!(Ze=Ze||Ie[nn]))throw new Error("Could not find a font-family for the rule '"+Ww(Ln)+"' and default family '"+nn+"'.");if(Ze=(function(gn,xn){if(xn[gn])return xn[gn];var gr=L2[gn],Mn=gr<=L2.normal?-1:1,Ke=Yw(xn,P4,gr,Mn);if(!Ke)throw new Error("Could not find a matching font-stretch value for "+gn);return Ke})(Ln.stretch,Ze),Ze=(function(gn,xn){if(xn[gn])return xn[gn];for(var gr=O4[gn],Mn=0;Mn<gr.length;++Mn)if(xn[gr[Mn]])return xn[gr[Mn]];throw new Error("Could not find a matching font-style for "+gn)})(Ln.style,Ze),!(Ze=(function(gn,xn){if(xn[gn])return xn[gn];if(gn===400&&xn[500])return xn[500];if(gn===500&&xn[400])return xn[400];var gr=m_[gn],Mn=Yw(xn,j4,gr,gn<400?-1:1);if(!Mn)throw new Error("Could not find a matching font-weight for value "+gn);return Mn})(Ln.weight,Ze)))throw new Error("Failed to resolve a font for the rule '"+Ww(Ln)+"'.");return Ze})(Ue,cn);this.pdf.setFont(In.ref.name,In.ref.style)}else{var Fe="";(fe==="bold"||parseInt(fe,10)>=700||Pn==="bold")&&(Fe="bold"),Pn==="italic"&&(Fe+="italic"),Fe.length===0&&(Fe="normal");for(var _n="",dn={arial:"Helvetica",Arial:"Helvetica",verdana:"Helvetica",Verdana:"Helvetica",helvetica:"Helvetica",Helvetica:"Helvetica","sans-serif":"Helvetica",fixed:"Courier",monospace:"Courier",terminal:"Courier",cursive:"Times",fantasy:"Times",serif:"Times"},ze=0;ze<_e.length;ze++){if(this.pdf.internal.getFont(_e[ze],Fe,{noFallback:!0,disableWarning:!0})!==void 0){_n=_e[ze];break}if(Fe==="bolditalic"&&this.pdf.internal.getFont(_e[ze],"bold",{noFallback:!0,disableWarning:!0})!==void 0)_n=_e[ze],Fe="bold";else if(this.pdf.internal.getFont(_e[ze],"normal",{noFallback:!0,disableWarning:!0})!==void 0){_n=_e[ze],Fe="normal";break}}if(_n===""){for(var Xe=0;Xe<_e.length;Xe++)if(dn[_e[Xe]]){_n=dn[_e[Xe]];break}}_n=_n===""?"Times":_n,this.pdf.setFont(_n,Fe)}}}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(ct){this.ctx.globalCompositeOperation=ct}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(ct){this.ctx.globalAlpha=ct}}),Object.defineProperty(this,"lineDashOffset",{get:function(){return this.ctx.lineDashOffset},set:function(ct){this.ctx.lineDashOffset=ct,J.call(this)}}),Object.defineProperty(this,"lineDash",{get:function(){return this.ctx.lineDash},set:function(ct){this.ctx.lineDash=ct,J.call(this)}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(ct){this.ctx.ignoreClearRect=!!ct}})};g.prototype.setLineDash=function(_){this.lineDash=_},g.prototype.getLineDash=function(){return this.lineDash.length%2?this.lineDash.concat(this.lineDash):this.lineDash.slice()},g.prototype.fill=function(){$.call(this,"fill",!1)},g.prototype.stroke=function(){$.call(this,"stroke",!1)},g.prototype.beginPath=function(){this.path=[{type:"begin"}]},g.prototype.moveTo=function(_,K){if(isNaN(_)||isNaN(K))throw Ai.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.moveTo");var V=this.ctx.transform.applyToPoint(new l(_,K));this.path.push({type:"mt",x:V.x,y:V.y}),this.ctx.lastPoint=new l(_,K)},g.prototype.closePath=function(){var _=new l(0,0),K=0;for(K=this.path.length-1;K!==-1;K--)if(this.path[K].type==="begin"&&oi(this.path[K+1])==="object"&&typeof this.path[K+1].x=="number"){_=new l(this.path[K+1].x,this.path[K+1].y);break}this.path.push({type:"close"}),this.ctx.lastPoint=new l(_.x,_.y)},g.prototype.lineTo=function(_,K){if(isNaN(_)||isNaN(K))throw Ai.error("jsPDF.context2d.lineTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.lineTo");var V=this.ctx.transform.applyToPoint(new l(_,K));this.path.push({type:"lt",x:V.x,y:V.y}),this.ctx.lastPoint=new l(V.x,V.y)},g.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),$.call(this,null,!0)},g.prototype.quadraticCurveTo=function(_,K,V,ut){if(isNaN(V)||isNaN(ut)||isNaN(_)||isNaN(K))throw Ai.error("jsPDF.context2d.quadraticCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");var xt=this.ctx.transform.applyToPoint(new l(V,ut)),At=this.ctx.transform.applyToPoint(new l(_,K));this.path.push({type:"qct",x1:At.x,y1:At.y,x:xt.x,y:xt.y}),this.ctx.lastPoint=new l(xt.x,xt.y)},g.prototype.bezierCurveTo=function(_,K,V,ut,xt,At){if(isNaN(xt)||isNaN(At)||isNaN(_)||isNaN(K)||isNaN(V)||isNaN(ut))throw Ai.error("jsPDF.context2d.bezierCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");var Ft=this.ctx.transform.applyToPoint(new l(xt,At)),Lt=this.ctx.transform.applyToPoint(new l(_,K)),Zt=this.ctx.transform.applyToPoint(new l(V,ut));this.path.push({type:"bct",x1:Lt.x,y1:Lt.y,x2:Zt.x,y2:Zt.y,x:Ft.x,y:Ft.y}),this.ctx.lastPoint=new l(Ft.x,Ft.y)},g.prototype.arc=function(_,K,V,ut,xt,At){if(isNaN(_)||isNaN(K)||isNaN(V)||isNaN(ut)||isNaN(xt))throw Ai.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(_,K));_=Ft.x,K=Ft.y;var Lt=this.ctx.transform.applyToPoint(new l(0,V)),Zt=this.ctx.transform.applyToPoint(new l(0,0));V=Math.sqrt(Math.pow(Lt.x-Zt.x,2)+Math.pow(Lt.y-Zt.y,2))}Math.abs(xt-ut)>=2*Math.PI&&(ut=0,xt=2*Math.PI),this.path.push({type:"arc",x:_,y:K,radius:V,startAngle:ut,endAngle:xt,counterclockwise:At})},g.prototype.arcTo=function(_,K,V,ut,xt){throw new Error("arcTo not implemented.")},g.prototype.rect=function(_,K,V,ut){if(isNaN(_)||isNaN(K)||isNaN(V)||isNaN(ut))throw Ai.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(_,K),this.lineTo(_+V,K),this.lineTo(_+V,K+ut),this.lineTo(_,K+ut),this.lineTo(_,K),this.lineTo(_+V,K),this.lineTo(_,K)},g.prototype.fillRect=function(_,K,V,ut){if(isNaN(_)||isNaN(K)||isNaN(V)||isNaN(ut))throw Ai.error("jsPDF.context2d.fillRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillRect");if(!y.call(this)){var xt={};this.lineCap!=="butt"&&(xt.lineCap=this.lineCap,this.lineCap="butt"),this.lineJoin!=="miter"&&(xt.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(_,K,V,ut),this.fill(),xt.hasOwnProperty("lineCap")&&(this.lineCap=xt.lineCap),xt.hasOwnProperty("lineJoin")&&(this.lineJoin=xt.lineJoin)}},g.prototype.strokeRect=function(_,K,V,ut){if(isNaN(_)||isNaN(K)||isNaN(V)||isNaN(ut))throw Ai.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");A.call(this)||(this.beginPath(),this.rect(_,K,V,ut),this.stroke())},g.prototype.clearRect=function(_,K,V,ut){if(isNaN(_)||isNaN(K)||isNaN(V)||isNaN(ut))throw Ai.error("jsPDF.context2d.clearRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(_,K,V,ut))},g.prototype.save=function(_){_=typeof _!="boolean"||_;for(var K=this.pdf.internal.getCurrentPageInfo().pageNumber,V=0;V<this.pdf.internal.getNumberOfPages();V++)this.pdf.setPage(V+1),this.pdf.internal.out("q");if(this.pdf.setPage(K),_){this.ctx.fontSize=this.pdf.internal.getFontSize();var ut=new p(this.ctx);this.ctxStack.push(this.ctx),this.ctx=ut}},g.prototype.restore=function(_){_=typeof _!="boolean"||_;for(var K=this.pdf.internal.getCurrentPageInfo().pageNumber,V=0;V<this.pdf.internal.getNumberOfPages();V++)this.pdf.setPage(V+1),this.pdf.internal.out("Q");this.pdf.setPage(K),_&&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(_){var K,V,ut,xt;if(_.isCanvasGradient===!0&&(_=_.getColor()),!_)return{r:0,g:0,b:0,a:0,style:_};if(/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/.test(_))K=0,V=0,ut=0,xt=0;else{var At=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(_);if(At!==null)K=parseInt(At[1]),V=parseInt(At[2]),ut=parseInt(At[3]),xt=1;else if((At=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(_))!==null)K=parseInt(At[1]),V=parseInt(At[2]),ut=parseInt(At[3]),xt=parseFloat(At[4]);else{if(xt=1,typeof _=="string"&&_.charAt(0)!=="#"){var Ft=new E4(_);_=Ft.ok?Ft.toHex():"#000000"}_.length===4?(K=_.substring(1,2),K+=K,V=_.substring(2,3),V+=V,ut=_.substring(3,4),ut+=ut):(K=_.substring(1,3),V=_.substring(3,5),ut=_.substring(5,7)),K=parseInt(K,16),V=parseInt(V,16),ut=parseInt(ut,16)}}return{r:K,g:V,b:ut,a:xt,style:_}},y=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},A=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};g.prototype.fillText=function(_,K,V,ut){if(isNaN(K)||isNaN(V)||typeof _!="string")throw Ai.error("jsPDF.context2d.fillText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillText");if(ut=isNaN(ut)?void 0:ut,!y.call(this)){var xt=lt(this.ctx.transform.rotation),At=this.ctx.transform.scaleX;at.call(this,{text:_,x:K,y:V,scale:At,angle:xt,align:this.textAlign,maxWidth:ut})}},g.prototype.strokeText=function(_,K,V,ut){if(isNaN(K)||isNaN(V)||typeof _!="string")throw Ai.error("jsPDF.context2d.strokeText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeText");if(!A.call(this)){ut=isNaN(ut)?void 0:ut;var xt=lt(this.ctx.transform.rotation),At=this.ctx.transform.scaleX;at.call(this,{text:_,x:K,y:V,scale:At,renderingMode:"stroke",angle:xt,align:this.textAlign,maxWidth:ut})}},g.prototype.measureText=function(_){if(typeof _!="string")throw Ai.error("jsPDF.context2d.measureText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.measureText");var K=this.pdf,V=this.pdf.internal.scaleFactor,ut=K.internal.getFontSize(),xt=K.getStringUnitWidth(_)*ut/K.internal.scaleFactor;return new function(At){var Ft=(At=At||{}).width||0;return Object.defineProperty(this,"width",{get:function(){return Ft}}),this}({width:xt*=Math.round(96*V/72*1e4)/1e4})},g.prototype.scale=function(_,K){if(isNaN(_)||isNaN(K))throw Ai.error("jsPDF.context2d.scale: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.scale");var V=new f(_,0,0,K,0,0);this.ctx.transform=this.ctx.transform.multiply(V)},g.prototype.rotate=function(_){if(isNaN(_))throw Ai.error("jsPDF.context2d.rotate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rotate");var K=new f(Math.cos(_),Math.sin(_),-Math.sin(_),Math.cos(_),0,0);this.ctx.transform=this.ctx.transform.multiply(K)},g.prototype.translate=function(_,K){if(isNaN(_)||isNaN(K))throw Ai.error("jsPDF.context2d.translate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.translate");var V=new f(1,0,0,1,_,K);this.ctx.transform=this.ctx.transform.multiply(V)},g.prototype.transform=function(_,K,V,ut,xt,At){if(isNaN(_)||isNaN(K)||isNaN(V)||isNaN(ut)||isNaN(xt)||isNaN(At))throw Ai.error("jsPDF.context2d.transform: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.transform");var Ft=new f(_,K,V,ut,xt,At);this.ctx.transform=this.ctx.transform.multiply(Ft)},g.prototype.setTransform=function(_,K,V,ut,xt,At){_=isNaN(_)?1:_,K=isNaN(K)?0:K,V=isNaN(V)?0:V,ut=isNaN(ut)?1:ut,xt=isNaN(xt)?0:xt,At=isNaN(At)?0:At,this.ctx.transform=new f(_,K,V,ut,xt,At)};var E=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};g.prototype.drawImage=function(_,K,V,ut,xt,At,Ft,Lt,Zt){var ve=this.pdf.getImageProperties(_),je=1,Pe=1,We=1,ct=1;ut!==void 0&&Lt!==void 0&&(We=Lt/ut,ct=Zt/xt,je=ve.width/ut*Lt/ut,Pe=ve.height/xt*Zt/xt),At===void 0&&(At=K,Ft=V,K=0,V=0),ut!==void 0&&Lt===void 0&&(Lt=ut,Zt=xt),ut===void 0&&Lt===void 0&&(Lt=ve.width,Zt=ve.height);var Le=this.ctx.transform.decompose(),Pn=lt(Le.rotate.shx),fe=new f,ye=(fe=(fe=(fe=fe.multiply(Le.translate)).multiply(Le.skew)).multiply(Le.scale)).applyToRectangle(new c(At-K*We,Ft-V*ct,ut*je,xt*Pe));if(this.autoPaging){for(var Te,Ne=L.call(this,ye),_e=[],Ue=0;Ue<Ne.length;Ue+=1)_e.indexOf(Ne[Ue])===-1&&_e.push(Ne[Ue]);H(_e);for(var cn=_e[0],In=_e[_e.length-1],Fe=cn;Fe<In+1;Fe++){this.pdf.setPage(Fe);var _n=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],dn=Fe===1?this.posY+this.margin[0]:this.margin[0],ze=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Xe=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],Ie=Fe===1?0:ze+(Fe-2)*Xe;if(this.ctx.clip_path.length!==0){var kr=this.path;Te=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=q(Te,this.posX+this.margin[3],-Ie+dn+this.ctx.prevPageLastElemOffset),ht.call(this,"fill",!0),this.path=kr}var wn=JSON.parse(JSON.stringify(ye));wn=q([wn],this.posX+this.margin[3],-Ie+dn+this.ctx.prevPageLastElemOffset)[0];var nn=(Fe>cn||Fe<In)&&E.call(this);nn&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],_n,Xe,null).clip().discardPath()),this.pdf.addImage(_,"JPEG",wn.x,wn.y,wn.w,wn.h,null,null,Pn),nn&&this.pdf.restoreGraphicsState()}}else this.pdf.addImage(_,"JPEG",ye.x,ye.y,ye.w,ye.h,null,null,Pn)};var L=function(_,K,V){var ut=[];K=K||this.pdf.internal.pageSize.width,V=V||this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var xt=this.posY+this.ctx.prevPageLastElemOffset;switch(_.type){default:case"mt":case"lt":ut.push(Math.floor((_.y+xt)/V)+1);break;case"arc":ut.push(Math.floor((_.y+xt-_.radius)/V)+1),ut.push(Math.floor((_.y+xt+_.radius)/V)+1);break;case"qct":var At=Bt(this.ctx.lastPoint.x,this.ctx.lastPoint.y,_.x1,_.y1,_.x,_.y);ut.push(Math.floor((At.y+xt)/V)+1),ut.push(Math.floor((At.y+At.h+xt)/V)+1);break;case"bct":var Ft=ee(this.ctx.lastPoint.x,this.ctx.lastPoint.y,_.x1,_.y1,_.x2,_.y2,_.x,_.y);ut.push(Math.floor((Ft.y+xt)/V)+1),ut.push(Math.floor((Ft.y+Ft.h+xt)/V)+1);break;case"rect":ut.push(Math.floor((_.y+xt)/V)+1),ut.push(Math.floor((_.y+_.h+xt)/V)+1)}for(var Lt=0;Lt<ut.length;Lt+=1)for(;this.pdf.internal.getNumberOfPages()<ut[Lt];)R.call(this);return ut},R=function(){var _=this.fillStyle,K=this.strokeStyle,V=this.font,ut=this.lineCap,xt=this.lineWidth,At=this.lineJoin;this.pdf.addPage(),this.fillStyle=_,this.strokeStyle=K,this.font=V,this.lineCap=ut,this.lineWidth=xt,this.lineJoin=At},q=function(_,K,V){for(var ut=0;ut<_.length;ut++)switch(_[ut].type){case"bct":_[ut].x2+=K,_[ut].y2+=V;case"qct":_[ut].x1+=K,_[ut].y1+=V;default:_[ut].x+=K,_[ut].y+=V}return _},H=function(_){return _.sort(function(K,V){return K-V})},$=function(_,K){var V=this.fillStyle,ut=this.strokeStyle,xt=this.lineCap,At=this.lineWidth,Ft=Math.abs(At*this.ctx.transform.scaleX),Lt=this.lineJoin;if(this.autoPaging){for(var Zt,ve,je=JSON.parse(JSON.stringify(this.path)),Pe=JSON.parse(JSON.stringify(this.path)),We=[],ct=0;ct<Pe.length;ct++)if(Pe[ct].x!==void 0)for(var Le=L.call(this,Pe[ct]),Pn=0;Pn<Le.length;Pn+=1)We.indexOf(Le[Pn])===-1&&We.push(Le[Pn]);for(var fe=0;fe<We.length;fe++)for(;this.pdf.internal.getNumberOfPages()<We[fe];)R.call(this);H(We);for(var ye=We[0],Te=We[We.length-1],Ne=ye;Ne<Te+1;Ne++){this.pdf.setPage(Ne),this.fillStyle=V,this.strokeStyle=ut,this.lineCap=xt,this.lineWidth=Ft,this.lineJoin=Lt;var _e=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Ue=Ne===1?this.posY+this.margin[0]:this.margin[0],cn=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],In=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],Fe=Ne===1?0:cn+(Ne-2)*In;if(this.ctx.clip_path.length!==0){var _n=this.path;Zt=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=q(Zt,this.posX+this.margin[3],-Fe+Ue+this.ctx.prevPageLastElemOffset),ht.call(this,_,!0),this.path=_n}if(ve=JSON.parse(JSON.stringify(je)),this.path=q(ve,this.posX+this.margin[3],-Fe+Ue+this.ctx.prevPageLastElemOffset),K===!1||Ne===0){var dn=(Ne>ye||Ne<Te)&&E.call(this);dn&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],_e,In,null).clip().discardPath()),ht.call(this,_,K),dn&&this.pdf.restoreGraphicsState()}this.lineWidth=At}this.path=je}else this.lineWidth=Ft,ht.call(this,_,K),this.lineWidth=At},ht=function(_,K){if((_!=="stroke"||K||!A.call(this))&&(_==="stroke"||K||!y.call(this))){for(var V,ut,xt=[],At=this.path,Ft=0;Ft<At.length;Ft++){var Lt=At[Ft];switch(Lt.type){case"begin":xt.push({begin:!0});break;case"close":xt.push({close:!0});break;case"mt":xt.push({start:Lt,deltas:[],abs:[]});break;case"lt":var Zt=xt.length;if(At[Ft-1]&&!isNaN(At[Ft-1].x)&&(V=[Lt.x-At[Ft-1].x,Lt.y-At[Ft-1].y],Zt>0)){for(;Zt>=0;Zt--)if(xt[Zt-1].close!==!0&&xt[Zt-1].begin!==!0){xt[Zt-1].deltas.push(V),xt[Zt-1].abs.push(Lt);break}}break;case"bct":V=[Lt.x1-At[Ft-1].x,Lt.y1-At[Ft-1].y,Lt.x2-At[Ft-1].x,Lt.y2-At[Ft-1].y,Lt.x-At[Ft-1].x,Lt.y-At[Ft-1].y],xt[xt.length-1].deltas.push(V);break;case"qct":var ve=At[Ft-1].x+2/3*(Lt.x1-At[Ft-1].x),je=At[Ft-1].y+2/3*(Lt.y1-At[Ft-1].y),Pe=Lt.x+2/3*(Lt.x1-Lt.x),We=Lt.y+2/3*(Lt.y1-Lt.y),ct=Lt.x,Le=Lt.y;V=[ve-At[Ft-1].x,je-At[Ft-1].y,Pe-At[Ft-1].x,We-At[Ft-1].y,ct-At[Ft-1].x,Le-At[Ft-1].y],xt[xt.length-1].deltas.push(V);break;case"arc":xt.push({deltas:[],abs:[],arc:!0}),Array.isArray(xt[xt.length-1].abs)&&xt[xt.length-1].abs.push(Lt)}}ut=K?null:_==="stroke"?"stroke":"fill";for(var Pn=!1,fe=0;fe<xt.length;fe++)if(xt[fe].arc)for(var ye=xt[fe].abs,Te=0;Te<ye.length;Te++){var Ne=ye[Te];Ne.type==="arc"?bt.call(this,Ne.x,Ne.y,Ne.radius,Ne.startAngle,Ne.endAngle,Ne.counterclockwise,void 0,K,!Pn):G.call(this,Ne.x,Ne.y),Pn=!0}else if(xt[fe].close===!0)this.pdf.internal.out("h"),Pn=!1;else if(xt[fe].begin!==!0){var _e=xt[fe].start.x,Ue=xt[fe].start.y;vt.call(this,xt[fe].deltas,_e,Ue),Pn=!0}ut&&ot.call(this,ut),K&&Dt.call(this)}},Mt=function(_){var K=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,V=K*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case"bottom":return _-V;case"top":return _+K-V;case"hanging":return _+K-2*V;case"middle":return _+K/2-V;default:return _}},wt=function(_){return _+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};g.prototype.createLinearGradient=function(){var _=function(){};return _.colorStops=[],_.addColorStop=function(K,V){this.colorStops.push([K,V])},_.getColor=function(){return this.colorStops.length===0?"#000000":this.colorStops[0][1]},_.isCanvasGradient=!0,_},g.prototype.createPattern=function(){return this.createLinearGradient()},g.prototype.createRadialGradient=function(){return this.createLinearGradient()};var bt=function(_,K,V,ut,xt,At,Ft,Lt,Zt){for(var ve=gt.call(this,V,ut,xt,At),je=0;je<ve.length;je++){var Pe=ve[je];je===0&&(Zt?Q.call(this,Pe.x1+_,Pe.y1+K):G.call(this,Pe.x1+_,Pe.y1+K)),Tt.call(this,_,K,Pe.x2,Pe.y2,Pe.x3,Pe.y3,Pe.x4,Pe.y4)}Lt?Dt.call(this):ot.call(this,Ft)},ot=function(_){switch(_){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f")}},Dt=function(){this.pdf.clip(),this.pdf.discardPath()},Q=function(_,K){this.pdf.internal.out(e(_)+" "+r(K)+" m")},at=function(_){var K;switch(_.align){case"right":case"end":K="right";break;case"center":K="center";break;default:K="left"}var V,ut,xt,At=this.pdf.getTextDimensions(_.text),Ft=Mt.call(this,_.y),Lt=wt.call(this,Ft)-At.h,Zt=this.ctx.transform.applyToPoint(new l(_.x,Ft));if(this.autoPaging){var ve=this.ctx.transform.decompose(),je=new f;je=(je=(je=je.multiply(ve.translate)).multiply(ve.skew)).multiply(ve.scale);for(var Pe=this.ctx.transform.applyToRectangle(new c(_.x,Ft,At.w,At.h)),We=je.applyToRectangle(new c(_.x,Lt,At.w,At.h)),ct=L.call(this,We),Le=[],Pn=0;Pn<ct.length;Pn+=1)Le.indexOf(ct[Pn])===-1&&Le.push(ct[Pn]);H(Le);for(var fe=Le[0],ye=Le[Le.length-1],Te=fe;Te<ye+1;Te++){this.pdf.setPage(Te);var Ne=Te===1?this.posY+this.margin[0]:this.margin[0],_e=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Ue=this.pdf.internal.pageSize.height-this.margin[2],cn=Ue-this.margin[0],In=this.pdf.internal.pageSize.width-this.margin[1],Fe=In-this.margin[3],_n=Te===1?0:_e+(Te-2)*cn;if(this.ctx.clip_path.length!==0){var dn=this.path;V=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=q(V,this.posX+this.margin[3],-1*_n+Ne),ht.call(this,"fill",!0),this.path=dn}var ze=q([JSON.parse(JSON.stringify(We))],this.posX+this.margin[3],-_n+Ne+this.ctx.prevPageLastElemOffset)[0];_.scale>=.01&&(ut=this.pdf.internal.getFontSize(),this.pdf.setFontSize(ut*_.scale),xt=this.lineWidth,this.lineWidth=xt*_.scale);var Xe=this.autoPaging!=="text";if(Xe||ze.y+ze.h<=Ue){if(Xe||ze.y>=Ne&&ze.x<=In){var Ie=Xe?_.text:this.pdf.splitTextToSize(_.text,_.maxWidth||In-ze.x)[0],kr=q([JSON.parse(JSON.stringify(Pe))],this.posX+this.margin[3],-_n+Ne+this.ctx.prevPageLastElemOffset)[0],wn=Xe&&(Te>fe||Te<ye)&&E.call(this);wn&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Fe,cn,null).clip().discardPath()),this.pdf.text(Ie,kr.x,kr.y,{angle:_.angle,align:K,renderingMode:_.renderingMode}),wn&&this.pdf.restoreGraphicsState()}}else ze.y<Ue&&(this.ctx.prevPageLastElemOffset+=Ue-ze.y);_.scale>=.01&&(this.pdf.setFontSize(ut),this.lineWidth=xt)}}else _.scale>=.01&&(ut=this.pdf.internal.getFontSize(),this.pdf.setFontSize(ut*_.scale),xt=this.lineWidth,this.lineWidth=xt*_.scale),this.pdf.text(_.text,Zt.x+this.posX,Zt.y+this.posY,{angle:_.angle,align:K,renderingMode:_.renderingMode,maxWidth:_.maxWidth}),_.scale>=.01&&(this.pdf.setFontSize(ut),this.lineWidth=xt)},G=function(_,K,V,ut){V=V||0,ut=ut||0,this.pdf.internal.out(e(_+V)+" "+r(K+ut)+" l")},vt=function(_,K,V){return this.pdf.lines(_,K,V,null,null)},Tt=function(_,K,V,ut,xt,At,Ft,Lt){this.pdf.internal.out([t(i(V+_)),t(s(ut+K)),t(i(xt+_)),t(s(At+K)),t(i(Ft+_)),t(s(Lt+K)),"c"].join(" "))},gt=function(_,K,V,ut){for(var xt=2*Math.PI,At=Math.PI/2;K>V;)K-=xt;var Ft=Math.abs(V-K);Ft<xt&&ut&&(Ft=xt-Ft);for(var Lt=[],Zt=ut?-1:1,ve=K;Ft>1e-5;){var je=ve+Zt*Math.min(Ft,At);Lt.push(Z.call(this,_,ve,je)),Ft-=Math.abs(je-ve),ve=je}return Lt},Z=function(_,K,V){var ut=(V-K)/2,xt=_*Math.cos(ut),At=_*Math.sin(ut),Ft=xt,Lt=-At,Zt=Ft*Ft+Lt*Lt,ve=Zt+Ft*xt+Lt*At,je=4/3*(Math.sqrt(2*Zt*ve)-ve)/(Ft*At-Lt*xt),Pe=Ft-je*Lt,We=Lt+je*Ft,ct=Pe,Le=-We,Pn=ut+K,fe=Math.cos(Pn),ye=Math.sin(Pn);return{x1:_*Math.cos(K),y1:_*Math.sin(K),x2:Pe*fe-We*ye,y2:Pe*ye+We*fe,x3:ct*fe-Le*ye,y3:ct*ye+Le*fe,x4:_*Math.cos(V),y4:_*Math.sin(V)}},lt=function(_){return 180*_/Math.PI},Bt=function(_,K,V,ut,xt,At){var Ft=_+.5*(V-_),Lt=K+.5*(ut-K),Zt=xt+.5*(V-xt),ve=At+.5*(ut-At),je=Math.min(_,xt,Ft,Zt),Pe=Math.max(_,xt,Ft,Zt),We=Math.min(K,At,Lt,ve),ct=Math.max(K,At,Lt,ve);return new c(je,We,Pe-je,ct-We)},ee=function(_,K,V,ut,xt,At,Ft,Lt){var Zt,ve,je,Pe,We,ct,Le,Pn,fe,ye,Te,Ne,_e,Ue,cn=V-_,In=ut-K,Fe=xt-V,_n=At-ut,dn=Ft-xt,ze=Lt-At;for(ve=0;ve<41;ve++)fe=(Le=(je=_+(Zt=ve/40)*cn)+Zt*((We=V+Zt*Fe)-je))+Zt*(We+Zt*(xt+Zt*dn-We)-Le),ye=(Pn=(Pe=K+Zt*In)+Zt*((ct=ut+Zt*_n)-Pe))+Zt*(ct+Zt*(At+Zt*ze-ct)-Pn),ve==0?(Te=fe,Ne=ye,_e=fe,Ue=ye):(Te=Math.min(Te,fe),Ne=Math.min(Ne,ye),_e=Math.max(_e,fe),Ue=Math.max(Ue,ye));return new c(Math.round(Te),Math.round(Ne),Math.round(_e-Te),Math.round(Ue-Ne))},J=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var _,K,V=(_=this.ctx.lineDash,K=this.ctx.lineDashOffset,JSON.stringify({lineDash:_,lineDashOffset:K}));this.prevLineDash!==V&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=V)}}})(pn.API),(function(n){var t=function(l){var c,f,d,p,g,b,y,A,E,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)-(E=g%85))/85)-(A=g%85))/85)-(y=g%85))/85)%85,f.push(b+33,y+33,A+33,E+33,L+33)):f.push(122);return(function(R,q){for(var H=q;H>0;H--)R.pop()})(f,c.length),String.fromCharCode.apply(String,f)+"~>"},e=function(l){var c,f,d,p,g,b=String,y="length",A=255,E="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[E](p)-33)+614125*(l[E](p+1)-33)+7225*(l[E](p+2)-33)+85*(l[E](p+3)-33)+(l[E](p+4)-33),d.push(A&f>>24,A&f>>16,A&f>>8,A&f);return(function(q,H){for(var $=H;$>0;$--)q.pop()})(d,c[y]),b.fromCharCode.apply(b,d)},r=function(l){return l.split("").map(function(c){return("0"+c.charCodeAt().toString(16)).slice(-2)}).join("")+">"},i=function(l){var c=new RegExp(/^([0-9A-Fa-f]{2})+$/);if((l=l.replace(/\s/g,"")).indexOf(">")!==-1&&(l=l.substr(0,l.indexOf(">"))),l.length%2&&(l+="0"),c.test(l)===!1)return"";for(var f="",d=0;d<l.length;d+=2)f+=String.fromCharCode("0x"+(l[d]+l[d+1]));return f},s=function(l){for(var c=new Uint8Array(l.length),f=l.length;f--;)c[f]=l.charCodeAt(f);return(c=M2(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(" ")}}})(pn.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(A){var E=A.length,L=[],R=String.fromCharCode;for(b=0;b<E;b+=1)L.push(R(255&A.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})(pn.API),(function(n){function t(){return(Wn.html2canvas?Promise.resolve(Wn.html2canvas):dy(()=>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(Wn.DOMPurify?Promise.resolve(Wn.DOMPurify):dy(()=>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=oi(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 A=p[y],E=A.src.find(function(L){return L.format==="truetype"});E&&d.addFont(E.url,A.ref.name,A.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||pn.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,pn.getPageSize=function(c,f,d){if(oi(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 A,E=0,L=0;if(y.hasOwnProperty(b))E=y[b][1]/g,L=y[b][0]/g;else try{E=d[1],L=d[0]}catch{throw new Error("Invalid format: "+d)}if(c==="p"||c==="portrait")c="p",L>E&&(A=L,L=E,E=A);else{if(c!=="l"&&c!=="landscape")throw"Invalid orientation: "+c;c="l",E>L&&(A=L,L=E,E=A)}return{width:L,height:E,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(_y):null;var d=new l(f);return f.worker?d:d.from(c).doCallback()}})(pn.API),pn.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}}])})(pn.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),A=g.length,E={width:0,height:0,numcomponents:1},L=4;L<A;L+=2){if(L+=y,t.indexOf(g.charCodeAt(L+1))!==-1){b=256*g.charCodeAt(L+5)+g.charCodeAt(L+6),E={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 E})(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}})(pn.API),pn.API.processPNG=function(n,t,e,r){if(this.__addimage__.isArrayBuffer(n)&&(n=new Uint8Array(n)),this.__addimage__.isArrayBufferView(n)){var i,s=e_(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 ot=bt.width,Dt=bt.height,Q=bt.data,at=bt.palette,G=bt.depth,vt=!1,Tt=[],gt=[],Z=void 0,lt=!1,Bt=0,ee=0;ee<at.length;ee++){var J=tw(at[ee],4),_=J[0],K=J[1],V=J[2],ut=J[3];Tt.push(_,K,V),ut!=null&&(ut===0?(Bt++,gt.length<1&>.push(ee)):ut<255&&(lt=!0))}if(lt||Bt>1){vt=!0,gt=void 0;var xt=ot*Dt;Z=new Uint8Array(xt);for(var At=new DataView(Q.buffer),Ft=0;Ft<xt;Ft++){var Lt=Ly(At,Ft,G),Zt=tw(at[Lt],4)[3];Z[Ft]=Zt}}else Bt===0&&(gt=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:vt?8:void 0,colorBytes:Q,alphaBytes:Z,needSMask:vt,palette:Tt,mask:gt}})(s):f===2||f===4?(function(bt){for(var ot=bt.data,Dt=bt.width,Q=bt.height,at=bt.channels,G=bt.depth,vt=at===2?"DeviceGray":"DeviceRGB",Tt=at-1,gt=Dt*Q,Z=Tt,lt=gt*Z,Bt=1*gt,ee=Math.ceil(lt*G/8),J=Math.ceil(Bt*G/8),_=new Uint8Array(ee),K=new Uint8Array(J),V=new DataView(ot.buffer),ut=new DataView(_.buffer),xt=new DataView(K.buffer),At=!1,Ft=0;Ft<gt;Ft++){for(var Lt=Ft*at,Zt=0;Zt<Z;Zt++)rS(ut,Ly(V,Lt+Zt,G),Ft*Z+Zt,G);var ve=Ly(V,Lt+Z,G);ve<(1<<G)-1&&(At=!0),rS(xt,ve,1*Ft,G)}return{colorSpace:vt,colorsPerPixel:Tt,sMaskBitsPerComponent:At?G:void 0,colorBytes:_,alphaBytes:K,needSMask:At}})(s):(function(bt){var ot=bt.data,Dt=bt.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:Dt,colorsPerPixel:Dt==="DeviceGray"?1:3,colorBytes:ot instanceof Uint16Array?(function(Q){for(var at=Q.length,G=new Uint8Array(2*at),vt=new DataView(G.buffer,G.byteOffset,G.byteLength),Tt=0;Tt<at;Tt++)vt.setUint16(2*Tt,Q[Tt],!1);return G})(ot):ot,needSMask:!1}})(s);var g,b,y,A=i,E=A.colorSpace,L=A.colorsPerPixel,R=A.sMaskBitsPerComponent,q=A.colorBytes,H=A.alphaBytes,$=A.needSMask,ht=A.palette,Mt=A.mask,wt=null;return r!==pn.API.image_compression.NONE&&typeof M2=="function"?(wt=(function(bt){var ot;switch(bt){case pn.API.image_compression.FAST:ot=11;break;case pn.API.image_compression.MEDIUM:ot=13;break;case pn.API.image_compression.SLOW:ot=14;break;default:ot=12}return ot})(r),g=this.decode.FLATE_DECODE,b="/Predictor ".concat(wt," /Colors ").concat(L," /BitsPerComponent ").concat(p," /Columns ").concat(l),n=Zw(q,Math.ceil(l*L*p/8),L,p,r),$&&(y=Zw(H,Math.ceil(l*R/8),1,R,r))):(g=void 0,b=void 0,n=q,$&&(y=H)),(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:ht,sMask:y,predictor:wt,width:l,height:c,bitsPerComponent:p,sMaskBitsPerComponent:R,colorSpace:E}}},(function(n){n.processGIF89A=function(t,e,r,i){var s=new S_(t),l=s.width,c=s.height,f=[];s.decodeAndBlitFrameRGBA(0,f);var d={data:f,width:l,height:c},p=new Ry(100).encode(d,100);return n.processJPEG.call(this,p,e,r,i)},n.processGIF87A=n.processGIF89A})(pn.API),oc.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)},oc.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){Ai.log("bit decode error:"+e)}},oc.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)}},oc.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)}},oc.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)}},oc.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}},oc.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}},oc.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}},oc.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}},oc.prototype.getData=function(){return this.data},(function(n){n.processBMP=function(t,e,r,i){var s=new oc(t,!1),l=s.width,c=s.height,f={data:s.getData(),width:l,height:c},d=new Ry(100).encode(f,100);return n.processJPEG.call(this,d,e,r,i)}})(pn.API),oS.prototype.getData=function(){return this.data},(function(n){n.processWEBP=function(t,e,r,i){var s=new oS(t),l=s.width,c=s.height,f={data:s.getData(),width:l,height:c},d=new Ry(100).encode(f,100);return n.processJPEG.call(this,d,e,r,i)}})(pn.API),pn.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 A=this.__addimage__.arrayBufferToBinaryString(s);return{alpha:this.__addimage__.arrayBufferToBinaryString(l),data:A,index:t,alias:e,colorSpace:"DeviceRGB",bitsPerComponent:8,width:n.width,height:n.height}},pn.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},Rd=pn.API,Fm=Rd.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,A=0,E=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&&oi(d[r])==="object"&&!isNaN(parseInt(d[r][A],10))?d[r][A]/p:0,L.push((c[r]||E)/f+b)),A=r;return L},Gw=Rd.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 Rd.processArabic&&(n=Rd.processArabic(n)),typeof r.metadata.widthOfString=="function"?r.metadata.widthOfString(n,e,i)/e:Fm.apply(this,arguments).reduce(function(s,l){return s+l},0)},Kw=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},Jw=function(n,t,e){e||(e={});var r,i,s,l,c,f,d,p=[],g=[p],b=e.textIndent||0,y=0,A=0,E=n.split(" "),L=Fm.apply(this,[" ",e])[0];if(f=e.lineIndent===-1?E[0].length+2:e.lineIndent||0){var R=Array(f).join(" "),q=[];E.map(function($){($=$.split(/\s*\n/)).length>1?q=q.concat($.map(function(ht,Mt){return(Mt&&ht.length?`
|
|
56
|
-
`:"")+ht})):q.push($[0])}),E=q,f=Gw.apply(this,[R,e])}for(s=0,l=E.length;s<l;s++){var H=0;if(r=E[s],f&&r[0]==`
|
|
57
|
-
`&&(r=r.substr(1),H=1),b+y+(A=(i=Fm.apply(this,[r,e])).reduce(function($,ht){return $+ht},0))>t||H){if(A>t){for(c=Kw.apply(this,[r,i,t-(b+y),t]),p.push(c.shift()),p=[c.pop()];c.length;)g.push([c.shift()]);A=i.slice(r.length-(p[0]?p[0].length:0)).reduce(function($,ht){return $+ht},0)}else p=[r];g.push(p),b=A+f,y=L}else p.push(r),b+=y+A,y=L}return d=f?function($,ht){return(ht?R:"")+$.join(" ")}:function($){return $.join(" ")},g.map(d)},Rd.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(Jw.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,A,E,L,R=["{"];for(var q in b){if(y=b[q],isNaN(parseInt(q,10))?A="'"+q+"'":(q=parseInt(q,10),A=(A=l(q).slice(2)).slice(0,-1)+i[A.slice(-1)]),typeof y=="number")y<0?(E=l(y).slice(3),L="-"):(E=l(y).slice(2),L=""),E=L+E.slice(0,-1)+i[E.slice(-1)];else{if(oi(y)!=="object")throw new Error("Don't know what to do with value type "+oi(y)+".");E=c(y)}R.push(A+E)}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,A,E,L,R={},q=1,H=R,$=[],ht="",Mt="",wt=b.length-1,bt=1;bt<wt;bt+=1)(L=b[bt])=="'"?y?(E=y.join(""),y=void 0):y=[]:y?y.push(L):L=="{"?($.push([H,E]),H={},E=void 0):L=="}"?((A=$.pop())[0][A[1]]=H,E=void 0,H=A[0]):L=="-"?q=-1:E===void 0?r.hasOwnProperty(L)?(ht+=r[L],E=parseInt(ht,16)*q,q=1,ht=""):ht+=L:r.hasOwnProperty(L)?(Mt+=r[L],H[E]=parseInt(Mt,16)*q,q=1,E=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,A=g.Unicode[y.postScriptName];A&&(y.metadata.Unicode={},y.metadata.Unicode.widths=A.widths,y.metadata.Unicode.kerning=A.kerning);var E=p.Unicode[y.postScriptName];E&&(y.metadata.Unicode.encoding=E,y.encoding=E.codePages[0])}])})(pn.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(hg(c)),l.metadata=n.API.TTFFont.open(c),l.metadata.Unicode=l.metadata.Unicode||{encoding:{},kerning:{},widths:[]},l.metadata.glyIdsUsed=[0]})(i,r)}}])})(pn),pn.API.addSvgAsImage=function(n,t,e,r,i,s,l,c){if(isNaN(t)||isNaN(e))throw Ai.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(r)||isNaN(i))throw Ai.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(Wn.canvg?Promise.resolve(Wn.canvg):dy(()=>import("./index.es-CDplo0TQ.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)})},pn.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},pn.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(A,E){var L,R=!1;for(L=0;L<A.length;L+=1)A[L]===E&&(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(oi(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 A,E=[];for(A in e)e[A].explicitSet===!0&&(e[A].type==="name"?E.push("/"+A+" /"+e[A].value):E.push("/"+A+" "+e[A].value));E.length!==0&&this.internal.write(`/ViewerPreferences
|
|
58
|
-
<<
|
|
59
|
-
`+E.join(`
|
|
60
|
-
`)+`
|
|
61
|
-
>>`)}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=e,this},pn.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",A_),this.internal.events.subscribe("postPutResources",k_)),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,A){return y-A})).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="",A=0;A<b.length;A++)y+=String.fromCharCode(b[A]);var E=d();p({data:y,addLength1:!0,objectId:E}),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 /"+Fd(c.fontName)),f("/FontFile2 "+E+" 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 q=d();f("<<"),f("/Type /Font"),f("/BaseFont /"+Fd(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 /"+Fd(c.fontName)),f("/Encoding /"+c.encoding),f("/DescendantFonts ["+q+" 0 R]"),f(">>"),f("endobj"),c.isAlreadyPutted=!0}})(s)}]),t.events.push(["putFont",function(s){(function(l){var c=l.font,f=l.out,d=l.newObject,p=l.putStream;if(c.metadata instanceof 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 A=d();p({data:b,addLength1:!0,objectId:A}),f("endobj");var E=d();p({data:r(c.metadata.toUnicode),addLength1:!0,objectId:E}),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 "+A+" 0 R"),f("/Flags 96"),f("/FontBBox "+n.API.PDFObject.convert(c.metadata.bbox)),f("/FontName /"+Fd(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 "+E+" 0 R/BaseFont/"+Fd(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,A=g.fonts,E=y,L="",R=0,q="",H=A[E].encoding;if(A[E].encoding!=="Identity-H")return{text:c,x:f,y:d,options:p,mutex:g};for(q=c,E=y,Array.isArray(c)&&(q=c[0]),R=0;R<q.length;R+=1)A[E].metadata.hasOwnProperty("cmap")&&(l=A[E].metadata.cmap.unicode.codeMap[q[R].charCodeAt(0)]),l||q[R].charCodeAt(0)<256&&A[E].metadata.hasOwnProperty("Unicode")?L+=q[R]:L+="";var $="";return parseInt(E.slice(1))<14||H==="WinAnsiEncoding"?$=b(L,E).split("").map(function(ht){return ht.charCodeAt(0).toString(16)}).join(""):H==="Identity-H"&&($=e(L,A[E])),g.isHex=!0,{text:$,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}])})(pn),(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}})(pn.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]],A={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},E={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},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)$/),q=!1,H=0;this.__bidiEngine__={};var $=function(Q){var at=Q.charCodeAt(),G=at>>8,vt=E[G];return vt!==void 0?g[256*vt+(255&at)]:G===252||G===253?"AL":R.test(G)?"L":G===8?"R":"N"},ht=function(Q){for(var at,G=0;G<Q.length;G++){if((at=$(Q.charAt(G)))==="L")return!1;if(at==="R")return!0}return!1},Mt=function(Q,at,G,vt){var Tt,gt,Z,lt,Bt=at[vt];switch(Bt){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":q=!1;break;case"N":case"AN":break;case"EN":q&&(Bt="AN");break;case"AL":q=!0,Bt="R";break;case"WS":case"BN":Bt="N";break;case"CS":vt<1||vt+1>=at.length||(Tt=G[vt-1])!=="EN"&&Tt!=="AN"||(gt=at[vt+1])!=="EN"&>!=="AN"?Bt="N":q&&(gt="AN"),Bt=gt===Tt?gt:"N";break;case"ES":Bt=(Tt=vt>0?G[vt-1]:"B")==="EN"&&vt+1<at.length&&at[vt+1]==="EN"?"EN":"N";break;case"ET":if(vt>0&&G[vt-1]==="EN"){Bt="EN";break}if(q){Bt="N";break}for(Z=vt+1,lt=at.length;Z<lt&&at[Z]==="ET";)Z++;Bt=Z<lt&&at[Z]==="EN"?"EN":"N";break;case"NSM":if(l&&!c){for(lt=at.length,Z=vt+1;Z<lt&&at[Z]==="NSM";)Z++;if(Z<lt){var ee=Q[vt],J=ee>=1425&&ee<=2303||ee===64286;if(Tt=at[Z],J&&(Tt==="R"||Tt==="AL")){Bt="R";break}}}Bt=vt<1||(Tt=at[vt-1])==="B"?"N":G[vt-1];break;case"B":q=!1,i=!0,Bt=H;break;case"S":s=!0,Bt="N"}return Bt},wt=function(Q,at,G){var vt=Q.split("");return G&&bt(vt,G,{hiLevel:H}),vt.reverse(),at&&at.reverse(),vt.join("")},bt=function(Q,at,G){var vt,Tt,gt,Z,lt,Bt=-1,ee=Q.length,J=0,_=[],K=H?y:b,V=[];for(q=!1,i=!1,s=!1,Tt=0;Tt<ee;Tt++)V[Tt]=$(Q[Tt]);for(gt=0;gt<ee;gt++){if(lt=J,_[gt]=Mt(Q,V,_,gt),vt=240&(J=K[lt][A[_[gt]]]),J&=15,at[gt]=Z=K[J][5],vt>0)if(vt===16){for(Tt=Bt;Tt<gt;Tt++)at[Tt]=1;Bt=-1}else Bt=-1;if(K[J][6])Bt===-1&&(Bt=gt);else if(Bt>-1){for(Tt=Bt;Tt<gt;Tt++)at[Tt]=Z;Bt=-1}V[gt]==="B"&&(at[gt]=0),G.hiLevel|=Z}s&&(function(ut,xt,At){for(var Ft=0;Ft<At;Ft++)if(ut[Ft]==="S"){xt[Ft]=H;for(var Lt=Ft-1;Lt>=0&&ut[Lt]==="WS";Lt--)xt[Lt]=H}})(V,at,ee)},ot=function(Q,at,G,vt,Tt){if(!(Tt.hiLevel<Q)){if(Q===1&&H===1&&!i)return at.reverse(),void(G&&G.reverse());for(var gt,Z,lt,Bt,ee=at.length,J=0;J<ee;){if(vt[J]>=Q){for(lt=J+1;lt<ee&&vt[lt]>=Q;)lt++;for(Bt=J,Z=lt-1;Bt<Z;Bt++,Z--)gt=at[Bt],at[Bt]=at[Z],at[Z]=gt,G&&(gt=G[Bt],G[Bt]=G[Z],G[Z]=gt);J=lt}J++}}},Dt=function(Q,at,G){var vt=Q.split(""),Tt={hiLevel:H};return G||(G=[]),bt(vt,G,Tt),(function(gt,Z,lt){if(lt.hiLevel!==0&&p)for(var Bt,ee=0;ee<gt.length;ee++)Z[ee]===1&&(Bt=L.indexOf(gt[ee]))>=0&&(gt[ee]=L[Bt+1])})(vt,G,Tt),ot(2,vt,at,G,Tt),ot(1,vt,at,G,Tt),vt.join("")};return this.__bidiEngine__.doBidiReorder=function(Q,at,G){if((function(Tt,gt){if(gt)for(var Z=0;Z<Tt.length;Z++)gt[Z]=Z;c===void 0&&(c=ht(Tt)),d===void 0&&(d=ht(Tt))})(Q,at),l||!f||d)if(l&&f&&c^d)H=c?1:0,Q=wt(Q,at,G);else if(!l&&f&&d)H=c?1:0,Q=Dt(Q,at,G),Q=wt(Q,at);else if(!l||c||f||d){if(l&&!f&&c^d)Q=wt(Q,at),c?(H=0,Q=Dt(Q,at,G)):(H=1,Q=Dt(Q,at,G),Q=wt(Q,at));else if(l&&c&&!f&&d)H=1,Q=Dt(Q,at,G),Q=wt(Q,at);else if(!l&&!f&&c^d){var vt=p;c?(H=1,Q=Dt(Q,at,G),H=0,p=!1,Q=Dt(Q,at,G),p=vt):(H=0,Q=Dt(Q,at,G),Q=wt(Q,at),H=1,p=!1,Q=Dt(Q,at,G),p=vt,Q=wt(Q,at))}}else H=0,Q=Dt(Q,at,G);else H=c?1:0,Q=Dt(Q,at,G);return Q},this.__bidiEngine__.setOptions=function(Q){Q&&(l=Q.isInputVisual,f=Q.isOutputVisual,c=Q.isInputRtl,d=Q.isOutputRtl,p=Q.isSymmetricSwapping)},this.__bidiEngine__.setOptions(r),this.__bidiEngine__};var t=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],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})}])})(pn),pn.API.TTFFont=(function(){function n(t){var e;if(this.rawData=t,e=this.contents=new bf(t),this.contents.pos=4,e.readString(4)==="ttcf")throw new Error("TTCF not supported.");e.pos=0,this.parse(),this.subset=new B_(this),this.registerTTF()}return n.open=function(t){return new n(t)},n.prototype.parse=function(){return this.directory=new M_(this.contents),this.head=new E_(this),this.name=new L_(this),this.cmap=new z4(this),this.toUnicode={},this.hhea=new T_(this),this.maxp=new R_(this),this.hmtx=new O_(this),this.post=new __(this),this.os2=new N_(this),this.loca=new z_(this),this.glyf=new P_(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 fc,bf=(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})(),M_=(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,A,E;for(E 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 bf).writeInt(this.scalarType),i.writeShort(y),i.writeShort(g),i.writeShort(l),i.writeShort(p),s=16*y,d=i.pos+s,c=null,A=[],e)for(b=e[E],i.writeString(E),i.writeInt(n(b)),i.writeInt(d),i.writeInt(b.length),A=A.concat(b),E==="head"&&(c=d),d+=b.length;d%4;)A.push(0),d++;return i.write(A),r=2981146554-n(i.data),i.pos=c+8,i.writeUInt32(r),i.data},n=function(e){var r,i,s,l;for(e=B4.call(e);e.length%4;)e.push(0);for(s=new bf(e),i=0,r=0,l=e.length;r<l;r=r+=4)i+=s.readUInt32();return 4294967295&i},t})(),C_={}.hasOwnProperty,Uc=function(n,t){for(var e in t)C_.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};fc=(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 E_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Uc(n,fc),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 bf).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})(),sS=(function(){function n(t,e){var r,i,s,l,c,f,d,p,g,b,y,A,E,L,R,q,H;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 $,ht;for(ht=[],f=$=0;0<=b?$<b:$>b;f=0<=b?++$:--$)ht.push(t.readUInt16());return ht})(),t.pos+=2,E=(function(){var $,ht;for(ht=[],f=$=0;0<=b?$<b:$>b;f=0<=b?++$:--$)ht.push(t.readUInt16());return ht})(),d=(function(){var $,ht;for(ht=[],f=$=0;0<=b?$<b:$>b;f=0<=b?++$:--$)ht.push(t.readUInt16());return ht})(),p=(function(){var $,ht;for(ht=[],f=$=0;0<=b?$<b:$>b;f=0<=b?++$:--$)ht.push(t.readUInt16());return ht})(),i=(this.length-t.pos+this.offset)/2,c=(function(){var $,ht;for(ht=[],f=$=0;0<=i?$<i:$>i;f=0<=i?++$:--$)ht.push(t.readUInt16());return ht})(),f=R=0,H=s.length;R<H;f=++R)for(L=s[f],r=q=A=E[f];A<=L?q<=L:q>=L;r=A<=L?++q:--q)p[f]===0?l=r+d[f]:(l=c[p[f]/2+(r-A)-(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,A,E,L,R,q,H,$,ht,Mt,wt,bt,ot,Dt,Q,at,G,vt,Tt,gt,Z,lt,Bt,ee,J,_,K,V,ut,xt,At,Ft,Lt,Zt,ve,je;switch(vt=new bf,l=Object.keys(t).sort(function(Pe,We){return Pe-We}),e){case"macroman":for(E=0,L=(function(){var Pe=[];for(A=0;A<256;++A)Pe.push(0);return Pe})(),q={0:0},s={},Tt=0,Bt=l.length;Tt<Bt;Tt++)q[Lt=t[i=l[Tt]]]==null&&(q[Lt]=++E),s[i]={old:t[i],new:q[t[i]]},L[i]=q[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:E+1};case"unicode":for(at=[],g=[],H=0,q={},r={},R=d=null,gt=0,ee=l.length;gt<ee;gt++)q[ht=t[i=l[gt]]]==null&&(q[ht]=++H),r[i]={old:ht,new:q[ht]},c=q[ht]-i,R!=null&&c===d||(R&&g.push(R),at.push(i),d=c),R=i;for(R&&g.push(R),g.push(65535),at.push(65535),Dt=2*(ot=at.length),bt=2*Math.pow(Math.log(ot)/Math.LN2,2),b=Math.log(bt/2)/Math.LN2,wt=2*ot-bt,f=[],Mt=[],y=[],A=Z=0,J=at.length;Z<J;A=++Z){if(Q=at[A],p=g[A],Q===65535){f.push(0),Mt.push(0);break}if(Q-(G=r[Q].new)>=32768)for(f.push(0),Mt.push(2*(y.length+ot-A)),i=lt=Q;Q<=p?lt<=p:lt>=p;i=Q<=p?++lt:--lt)y.push(r[i].new);else f.push(G-Q),Mt.push(0)}for(vt.writeUInt16(3),vt.writeUInt16(1),vt.writeUInt32(12),vt.writeUInt16(4),vt.writeUInt16(16+8*ot+2*y.length),vt.writeUInt16(0),vt.writeUInt16(Dt),vt.writeUInt16(bt),vt.writeUInt16(b),vt.writeUInt16(wt),At=0,_=g.length;At<_;At++)i=g[At],vt.writeUInt16(i);for(vt.writeUInt16(0),Ft=0,K=at.length;Ft<K;Ft++)i=at[Ft],vt.writeUInt16(i);for(Zt=0,V=f.length;Zt<V;Zt++)c=f[Zt],vt.writeUInt16(c);for(ve=0,ut=Mt.length;ve<ut;ve++)$=Mt[ve],vt.writeUInt16($);for(je=0,xt=y.length;je<xt;je++)E=y[je],vt.writeUInt16(E);return{charMap:r,subtable:vt.data,maxGlyphID:H+1}}},n})(),z4=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Uc(n,fc),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 sS(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=sS.encode(t,e),(i=new bf).writeUInt16(0),i.writeUInt16(1),r.table=i.data.concat(r.subtable),r},n})(),T_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Uc(n,fc),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})(),N_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Uc(n,fc),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})(),__=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Uc(n,fc),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},L_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Uc(n,fc),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})(),R_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Uc(n,fc),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})(),O_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Uc(n,fc),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})(),B4=[].slice,P_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Uc(n,fc),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 bf(e.read(i))).readShort(),d=c.readShort(),g=c.readShort(),f=c.readShort(),p=c.readShort(),this.cache[t]=l===-1?new I_(c,d,g,f,p):new j_(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})(),j_=(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})(),I_=(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 bf(B4.call(this.raw.data)),t=0,r=this.glyphIDs.length;t<r;++t)e.pos=this.glyphOffsets[t];return e.data},n})(),z_=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return Uc(n,fc),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})(),B_=(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,A,E,L,R;for(i in r=z4.encode(this.generateCmap(),"unicode"),l=this.glyphsFor(t),y={0:0},R=r.charMap)y[(f=R[i]).old]=f.new;for(A in b=r.maxGlyphID,l)A in y||(y[A]=b++);return p=(function(q){var H,$;for(H in $={},q)$[q[H]]=H;return $})(y),g=Object.keys(p).sort(function(q,H){return q-H}),E=(function(){var q,H,$;for($=[],q=0,H=g.length;q<H;q++)c=g[q],$.push(p[c]);return $})(),s=this.font.glyf.encode(l,E,y),d=this.font.loca.encode(s.offsets,E),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})();pn.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 F_=new Set(["point","polygon","polyline","rectangle","ellipse","arrow","compass","numbering","image"]);function aS(n){return F_.has(n.anchor.type)}function Um(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 R2(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 j5(n,t){return t.filter(e=>e.anchor.type==="linked"&&e.anchor.pinId===n).map(e=>e.id)}function U_(n,t){return new Set([n,...j5(n,t)])}const H_="1.17.1",ja=["#FBD710","#F0462F","#FF8D28","#4FD553","#00C0E8","#0088FF","#E246A1","#FFFFFF","#A0522D","#888888","#000000"],q_="small",$_={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}},ph=$_[q_],O2=ph.maxLogicalImageSize,Hm=ph.minZoom,qm=ph.maxZoom,lS=ph.zoomWheelFactor,$m=ph.zoomPrecision,pi=ph.contourScale,I5=1/1.25,F4=pi*I5,U4=280*pi,P2=100*pi,cS=12*pi,uS=12*pi,tp=3*pi,bg=1*pi,fS=1*pi,dS=2*pi,hS=1*pi,pS="rgba(0,0,0,0.45)",H4=2.5*pi,Rf=2.5*pi,hl=.25,Nu=4,j0=.25,z5=1,Y_=.5,V_=.6,Uf="solid",Ep="filled",W_="44",zf=[5*pi,3*pi],j2=4*pi,q4=60*pi,Pa=20,mS=10,I2="iso";function Ym(n){return n.toString().padStart(2,"0")}function Ud(n=new Date,t=I2){const e=n.getFullYear(),r=Ym(n.getMonth()+1),i=Ym(n.getDate()),s=Ym(n.getHours()),l=Ym(n.getMinutes());return t==="ua_full"?`${i}.${r}.${e} ${s}:${l}`:`${e}-${r}-${i} ${s}:${l}`}const Su="#E63946",$4=3*pi,z2=2*pi,B2=7*pi,Y4=0,Lg=1.4,X_="image/png,image/jpeg,image/svg+xml,image/webp,image/gif,image/avif,image/bmp",G_=["PNG","JPG","SVG","WebP","GIF","AVIF","BMP"],K_=2,J_=40,Z_=4,Q_=48,t8="blur",e8=.5,n8=.05,Vm=12,Oy=200*pi,Wm=16,V4=10*pi,r8=.1,i8="#ffffff",o8="#000000",Py="<p>Текст</p>",F2=6,s8=5,Rg=1,gS=4,a8=18;function Wd(){return typeof navigator>"u"?"Ctrl+V":/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"⌘+V":"Ctrl+V"}const l8=600;function id(n){return typeof n!="number"||!Number.isFinite(n)?z5:Math.min(Nu,Math.max(hl,n))}function yS(n,t){return id(n.strokeWidthScale??id(t))}function I0(n){return id(n).toFixed(2).replace(/\.?0+$/,"")}function W4(n){const t=1+(id(n)-1)*Y_;return Math.max(V_,t)}function X4(n){return n.type!=="text"}const G4=!1,K4="tyts-app-settings",U2={fontId:"road-ui",strokeWidthScale:z5,calloutPanelCollapsed:!1,showToolTooltips:!0},c8="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif";function u8(n){return`${n==="uaf-sans"&&G4?"'UAF Sans'":"'Road UI'"}, ${c8}`}function f8(n){return n==="road-ui"?n:U2.fontId}function d8(){try{const n=localStorage.getItem(K4);if(!n)return{...U2};const t=JSON.parse(n);return{fontId:f8(t.fontId),strokeWidthScale:id(t.strokeWidthScale),calloutPanelCollapsed:t.calloutPanelCollapsed===!0,showToolTooltips:t.showToolTooltips!==!1}}catch{}return{...U2}}function qh(n){localStorage.setItem(K4,JSON.stringify(n))}function h8(){const[n,t]=I.useState(()=>d8()),e=I.useMemo(()=>u8(n.fontId),[n.fontId]);I.useEffect(()=>{document.documentElement.style.setProperty("--tyts-font-family",e),document.body.style.fontFamily=e},[e]);const r=I.useCallback(f=>{t(d=>{const p={...d,fontId:f};return qh(p),p})},[]),i=I.useCallback(f=>{t(d=>{const p={...d,strokeWidthScale:id(f)};return qh(p),p})},[]),s=I.useCallback(f=>{t(d=>{const p={...d,showToolTooltips:f};return qh(p),p})},[]),l=I.useCallback(f=>{t(d=>{if(d.calloutPanelCollapsed===f)return d;const p={...d,calloutPanelCollapsed:f};return qh(p),p})},[]),c=I.useCallback(()=>{t(f=>{const d={...f,calloutPanelCollapsed:!f.calloutPanelCollapsed};return qh(d),d})},[]);return{settings:n,fontFamily:e,setFontId:r,setStrokeWidthScale:i,setShowToolTooltips:s,setCalloutPanelCollapsed:l,toggleCalloutPanelCollapsed:c}}const p8=[{id:"road-ui",label:"Road UI"}];function m8({open:n,fontId:t,fontFamily:e,strokeWidthScale:r,showToolTooltips:i,onClose:s,onFontIdChange:l,onStrokeWidthScaleChange:c,onShowToolTooltipsChange:f}){if(!n)return null;const d=(r-hl)/(Nu-hl)*100;return C.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"tyts-settings-title",style:{position:"fixed",inset:0,zIndex:5e3,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.55)"},onClick:s,children:C.jsxs("div",{onClick:p=>p.stopPropagation(),style:{width:"min(360px, calc(100vw - 32px))",background:"rgba(10,10,16,0.98)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:12,boxShadow:"0 16px 40px rgba(0,0,0,0.7)",padding:16,color:"#ddd",fontFamily:e},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:14},children:[C.jsx("h2",{id:"tyts-settings-title",style:{margin:0,fontSize:15,fontWeight:800,color:"#fff"},children:"Налаштування"}),C.jsx("button",{type:"button",onClick:s,style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.65)",cursor:"pointer",fontSize:20,lineHeight:1,padding:0},title:"Закрити","aria-label":"Закрити",children:"×"})]}),C.jsxs("fieldset",{style:{border:"none",margin:0,padding:0},children:[C.jsx("legend",{style:{fontSize:12,fontWeight:600,color:"rgba(255,255,255,0.75)",marginBottom:8},children:"Шрифт"}),C.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:p8.map(p=>C.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:8,cursor:"pointer",background:t===p.id?"rgba(255,255,255,0.08)":"transparent",border:`1px solid ${t===p.id?"rgba(255,255,255,0.2)":"rgba(255,255,255,0.08)"}`,fontFamily:p.id==="uaf-sans"?"'UAF Sans', sans-serif":"'Road UI', sans-serif",fontSize:14},children:[C.jsx("input",{type:"radio",name:"tyts-font",value:p.id,checked:t===p.id,onChange:()=>l(p.id)}),p.label]},p.id))})]}),C.jsxs("fieldset",{style:{border:"none",margin:"16px 0 0",padding:0},children:[C.jsx("legend",{style:{fontSize:12,fontWeight:600,color:"rgba(255,255,255,0.75)",marginBottom:8},children:"Товщина ліній"}),C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[C.jsx("input",{type:"range",min:hl,max:Nu,step:j0,value:r,"aria-label":"Товщина ліній",onChange:p=>c(Number(p.target.value)),className:"tyts-range",style:{flex:1,"--tyts-range-accent":Su,"--tyts-range-fill":`${d}%`}}),C.jsxs("span",{style:{minWidth:42,textAlign:"right",fontVariantNumeric:"tabular-nums",fontSize:13},children:["×",I0(r)]}),C.jsx("button",{type:"button",onClick:()=>c(z5),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:"Скинути"})]}),C.jsx("p",{style:{margin:"8px 0 0",fontSize:11,lineHeight:1.4,color:"rgba(255,255,255,0.45)"},children:"Діє на контури, лінії-виноски й маркери. Обʼєкти з власною товщиною лишаються незмінними."})]}),C.jsxs("fieldset",{style:{border:"none",margin:"16px 0 0",padding:0},children:[C.jsx("legend",{style:{fontSize:12,fontWeight:600,color:"rgba(255,255,255,0.75)",marginBottom:8},children:"Підказки"}),C.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:8,cursor:"pointer",border:"1px solid rgba(255,255,255,0.08)",fontSize:14},children:[C.jsx("input",{type:"checkbox",checked:i,onChange:p=>f(p.target.checked),style:{accentColor:Su}}),"Показувати підказки на кнопках"]}),C.jsx("p",{style:{margin:"8px 0 0",fontSize:11,lineHeight:1.4,color:"rgba(255,255,255,0.45)"},children:"Назва інструмента й гаряча клавіша при наведенні на кнопку в панелі."})]})]})})}const J4=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],g8=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"];function y8(n){return(n.getDay()+6)%7}function Bf(n){return new Date(n.getFullYear(),n.getMonth(),1)}function H2(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 bS(n,t){return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()}function q2(n,t,e){return Number.isFinite(n)?Math.min(e,Math.max(t,Math.trunc(n))):t}function b8(n,t){const e=new Date(n,t,1),r=new Date(n,t+1,0).getDate(),i=y8(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 x8(n){const t=Bf(n);return[H2(t,-1),t,H2(t,1)]}function v8(n){const t=n.getMonth(),e=J4[t];return t===0||t===11?`${e} ${n.getFullYear()}`:e}function $2(n,t,e){return new Date(n.getFullYear(),n.getMonth(),n.getDate(),q2(t,0,23),q2(e,0,59),0,0)}function w8(n,t){return $2(t,n.getHours(),n.getMinutes())}function S8({monthDate:n,value:t,today:e,onSelectDay:r}){const i=n.getFullYear(),s=n.getMonth(),l=I.useMemo(()=>b8(i,s),[i,s]);return C.jsxs("div",{style:{minWidth:168,flex:"1 1 168px"},children:[C.jsx("div",{style:{textAlign:"center",fontSize:12,fontWeight:600,color:"#cfd3dc",marginBottom:6,textTransform:"capitalize"},children:v8(n)}),C.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2,marginBottom:4},children:g8.map(c=>C.jsx("div",{style:{textAlign:"center",fontSize:10,color:"rgba(255,255,255,0.45)",padding:"2px 0"},children:c},c))}),C.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2},children:l.map((c,f)=>{if(!c.date||c.day==null)return C.jsx("div",{style:{height:24}},`empty-${f}`);const d=bS(c.date,t),p=bS(c.date,e);return C.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 xS({id:n,label:t,value:e,min:r,max:i,onChange:s}){const[l,c]=I.useState(null),f=l!==null,d=f?l:$h(e),p=b=>{const y=b.replace(/\D/g,"");if(y===""){c(null);return}const A=q2(Number(y),r,i);s(A),c(null)},g=b=>{const y=i-r+1,A=((e-r+b)%y+y)%y+r;s(A),f&&c($h(A))};return C.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:[C.jsx("label",{htmlFor:n,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"},children:t}),C.jsx("input",{id:n,className:"tyts-time-input",type:"text",inputMode:"numeric",autoComplete:"off",spellCheck:!1,value:d,onFocus:()=>c($h(e)),onBlur:()=>p(l??$h(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??$h(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"}}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",borderLeft:"1px solid rgba(255,255,255,0.1)",width:20},children:[C.jsx("button",{type:"button",tabIndex:-1,title:`${t}: +1`,onMouseDown:b=>b.preventDefault(),onClick:()=>g(1),style:SS,children:C.jsx("i",{className:"bi bi-chevron-up",style:{fontSize:9,lineHeight:1},"aria-hidden":!0})}),C.jsx("button",{type:"button",tabIndex:-1,title:`${t}: -1`,onMouseDown:b=>b.preventDefault(),onClick:()=>g(-1),style:{...SS,borderTop:"1px solid rgba(255,255,255,0.1)"},children:C.jsx("i",{className:"bi bi-chevron-down",style:{fontSize:9,lineHeight:1},"aria-hidden":!0})})]})]})}function k8({year:n,selected:t,today:e,onSelectMonth:r}){return C.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 C.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 A8({value:n,viewMonth:t,format:e,locked:r,onChange:i,onViewMonthChange:s,onFormatChange:l,onLockedChange:c,onInsert:f,onNow:d,onClose:p}){const g=I.useId(),b=I.useId(),y=I.useMemo(()=>new Date,[]),A=I.useMemo(()=>x8(t),[t]),E=Ud(n,e),[L,R]=I.useState(!1),[q,H]=I.useState(()=>t.getFullYear()),$=L?q:t.getFullYear();I.useEffect(()=>{const bt=ot=>{if(ot.key==="Escape"){if(ot.preventDefault(),ot.stopPropagation(),L){R(!1);return}p()}};return window.addEventListener("keydown",bt,!0),()=>window.removeEventListener("keydown",bt,!0)},[p,L]);const ht=()=>{H(t.getFullYear()),R(!0)},Mt=bt=>{if(L){H(ot=>ot+bt);return}s(H2(t,bt))},wt=bt=>{s(Bf(new Date(q,bt,1))),R(!1)};return C.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:[C.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:10},children:[C.jsx("button",{type:"button",title:L?"Попередній рік":"Попередній місяць",onClick:()=>Mt(-1),style:wS,children:C.jsx("i",{className:"bi bi-chevron-left","aria-hidden":!0})}),C.jsx("button",{type:"button",title:L?"Закрити вибір місяця":"Показати всі місяці року",onClick:()=>{L?R(!1):ht()},style:{border:"none",background:"transparent",color:"#e8eaed",fontSize:15,fontWeight:700,fontFamily:"inherit",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"4px 10px",borderRadius:6,textDecoration:L?"underline":"none",textUnderlineOffset:3},children:$}),C.jsx("button",{type:"button",title:L?"Наступний рік":"Наступний місяць",onClick:()=>Mt(1),style:wS,children:C.jsx("i",{className:"bi bi-chevron-right","aria-hidden":!0})})]}),L?C.jsx(k8,{year:q,selected:t,today:y,onSelectMonth:wt}):C.jsx("div",{style:{display:"flex",gap:12,flexWrap:"wrap",marginBottom:12},children:A.map(bt=>C.jsx(S8,{monthDate:bt,value:n,today:y,onSelectDay:ot=>i(w8(n,ot))},`${bt.getFullYear()}-${bt.getMonth()}`))}),C.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:[C.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("span",{style:{fontSize:12,color:"rgba(255,255,255,0.65)"},children:"Час"}),C.jsx(xS,{id:g,label:"Години",value:n.getHours(),min:0,max:23,onChange:bt=>i($2(n,bt,n.getMinutes()))}),C.jsx("span",{style:{opacity:.6,fontWeight:600},children:":"}),C.jsx(xS,{id:b,label:"Хвилини",value:n.getMinutes(),min:0,max:59,onChange:bt=>i($2(n,n.getHours(),bt))})]}),C.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[C.jsx("span",{style:{fontSize:12,color:"rgba(255,255,255,0.65)"},children:"Формат"}),C.jsx(vS,{active:e==="iso",label:"ISO",onClick:()=>l("iso")}),C.jsx(vS,{active:e==="ua_full",label:"UA",onClick:()=>l("ua_full")})]}),C.jsx(M8,{locked:r,onToggle:()=>c(!r)}),C.jsx("button",{type:"button",onClick:d,style:{...C8,marginLeft:"auto"},children:"Зараз"})]}),C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:[C.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.55)",fontVariantNumeric:"tabular-nums"},children:E}),C.jsx("button",{type:"button",onClick:f,style:E8,children:"Вставити"})]})]})}function vS({active:n,label:t,onClick:e}){return C.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 M8({locked:n,onToggle:t}){const[e,r]=I.useState(!1),i=n?"Дата й час зафіксовані — основна кнопка «Дата/час» вставляє їх. Натисніть, щоб зняти фіксацію":"Зафіксувати дату й час: основна кнопка «Дата/час» вставлятиме їх замість поточного моменту";return C.jsxs("span",{style:{position:"relative",display:"inline-flex"},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[C.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:C.jsx("i",{className:`bi ${n?"bi-lock-fill":"bi-unlock"}`,style:{fontSize:14},"aria-hidden":!0})}),e&&C.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 $h(n){return n.toString().padStart(2,"0")}const wS={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"},SS={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},C8={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"},E8={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"},T8=20,jy=12,N8=12;function _8(n,t,e){if(n.length===0)return{};const i=U4,s=P2,l=T8,c=Math.max(0,e-2*l),f=Math.max(1,Math.floor((c+jy)/(s+jy))),d={};return n.forEach((p,g)=>{const b=Math.floor(g/f),y=g%f;let A=t-l-i-b*(i+N8),E=l+y*(s+jy);A=Math.max(l,Math.min(A,t-i-l)),E=Math.max(l,Math.min(E,e-s-l)),d[p]={x:A,y:E,width:i,height:s}}),d}function D8(n,t){const e=Math.min(O2/n,O2/t,Number.POSITIVE_INFINITY);return{w:Math.round(n*e),h:Math.round(t*e)}}function B5(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 kS(n,t,e){const r=(i,s)=>B5(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 AS(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 L8(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 Xm(n,t){return L8(n,{x:0,y:0,w:t.w,h:t.h})}function MS(n,t,e){const r=B5(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 R8(n,t,e,r){const i=[],s={},l=new Set;for(const c of n){if(c.anchor.type==="linked")continue;const f=kS(c.anchor,e,r),d=t[c.id],p=d?MS(d,e,r):null;(Xm(AS(f),r)||p!==null&&Xm({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=kS(c.anchor,e,r),d=AS(f),p=c.anchor.type==="linked"?!0:Xm(d,r),g=t[c.id],b=g?MS(g,e,r):null,y=b?Xm({x:b.x,y:b.y,w:b.width,h:b.height},r):!1;if(!p&&!y)continue;const A=c.leaderPoints?.map(E=>B5(E.x,E.y,e,r));i.push(A?{...c,anchor:f,leaderPoints:A}:{...c,anchor:f}),b&&(s[c.id]=b)}return{pins:i,cardPositions:s}}function Y2(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*Lg;return Math.ceil(n*e+Rg*2)}function O8(n,t,e){const r=Y2(n),i=e?.fontSize??Pa,s=F2*2+Rg*2,l=Math.max(1,...r.map(d=>Math.ceil(t(d||" ")))),c=Math.max(24,l+s),f=Math.max(a8,Z4(r.length,i));return{width:c,height:f}}const P8=4e3,j8=1;function Q4(n,t){return n.b===t.b&&n.i===t.i&&n.u===t.u&&n.s===t.s&&n.fs===t.fs}function I8(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 z8(n){n.querySelectorAll("p,div,h1,h2,h3,h4,h5,h6,li,blockquote,pre").forEach(t=>{t.firstChild||t.appendChild(document.createElement("br"))})}function B8(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 F8(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=B8(n),s.innerHTML=t,I8(s),z8(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 q=c.get(R);if(q)return q;const H=getComputedStyle(R),$=Number.parseFloat(H.fontSize);let ht=!1,Mt=!1;for(let bt=R;bt;bt=bt.parentElement){const ot=getComputedStyle(bt).textDecorationLine||"";if(ot.includes("underline")&&(ht=!0),ot.includes("line-through")&&(Mt=!0),bt===s)break}const wt={b:(Number.parseInt(H.fontWeight,10)||400)>=600,i:H.fontStyle==="italic"||H.fontStyle.startsWith("oblique"),u:ht,s:Mt,fs:Number.isFinite($)?$:n.fontSize};return c.set(R,wt),wt},d=[];let p=null,g=null,b=0;const y=n.maxDomChars??P8,A=document.createRange(),E=document.createTreeWalker(s,NodeFilter.SHOW_TEXT);let L=E.nextNode();for(;L;){const R=L.textContent??"";if(b+=R.length,b>y)return null;const q=L.parentElement,H=f(q??s);for(let $=0;$<R.length;$+=1){const ht=R[$];if(ht===`
|
|
91
|
-
`||ht==="\r")continue;A.setStart(L,$),A.setEnd(L,$+1);const Mt=A.getClientRects()[0];if(!Mt)continue;const wt=Mt.top-l.top+Mt.height*r.ascentRatio(H);(!p||Math.abs(p.baseline-wt)>j8)&&(p={runs:[],baseline:wt},d.push(p),g=null),(!g||!Q4(g,H))&&(g={...H,text:"",x:Mt.left-l.left},p.runs.push(g)),g.text+=ht}L=E.nextNode()}return d.length===0?null:{lines:d,height:l.height,fromDom:!0}}finally{i.remove()}}function U8(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||{},A=c||b.tagName==="B"||b.tagName==="STRONG"||y.fontWeight==="bold"||Number.parseInt(y.fontWeight||"0",10)>=600,E=f||b.tagName==="I"||b.tagName==="EM"||y.fontStyle==="italic",L=typeof y.textDecoration=="string"?y.textDecoration:"",R=d||b.tagName==="U"||L.includes("underline"),q=p||b.tagName==="S"||b.tagName==="STRIKE"||L.includes("line-through"),H=y.fontSize?Number.parseFloat(y.fontSize):Number.NaN,$=Number.isFinite(H)?H:g;for(const ht of Array.from(b.childNodes))s(ht,A,E,R,q,$)};for(const l of Array.from(e.childNodes))s(l,!1,!1,!1,!1,t);return i}function H8(n){const{width:t,fontSize:e,lineHeight:r,metrics:i}=n,s=U8(n.html,e),l=[];for(const y of s)for(const A of y.text.split(/([ \n])/))A&&l.push({...y,text:A});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 A=i.measure(y.text,y);if(y.text===" "){f.push(y),d+=A;continue}if(d+A>t&&f.length>0){for(;f.length>0&&f[f.length-1].text===" ";)f.pop();p(),f=[y],d=A;continue}f.push(y),d+=A}f.length>0&&p();const g=[];let b=0;for(const y of c){const A=y.reduce((ht,Mt)=>Math.max(ht,Mt.fs),e),E={b:!1,i:!1,u:!1,s:!1,fs:A},L=A*r,R=i.contentHeight(E),q=b+(L-R)/2+R*i.ascentRatio(E),H=[];let $=0;for(const ht of y){const Mt=H[H.length-1];Mt&&Q4(Mt,ht)?Mt.text+=ht.text:H.push({...ht,x:$}),$+=i.measure(ht.text,ht)}g.push({runs:H,baseline:q}),b+=L}return{lines:g,height:b,fromDom:!1}}function q8(n){return F8(n)??H8(n)}function $8(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 tA(n,t,e,r=V4){const i=$8(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 Y8(n,t,e,r=V4){const i=Math.atan2(t.y-n.y,t.x-n.x);return tA(n,i,e,r)}function V8(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 z0(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 W8(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=z0(t,e,s.x,s.y,l.x,l.y);c.dist2<r.dist2&&(r=c)}return{x:r.x,y:r.y}}function X8(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=z0(t,e,s.x,s.y,l.x,l.y);c.dist2<r.dist2&&(r=c)}return{x:r.x,y:r.y}}function G8(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=z0(r,i,c.x,c.y,g.x,g.y);b.dist2<l.dist2&&(l=b),c=g}return{x:l.x,y:l.y}}function eA(n,t,e){const r=Math.cos(-e),i=Math.sin(-e);return{x:n*r-t*i,y:n*i+t*r}}function nA(n,t,e){const r=Math.cos(e),i=Math.sin(e);return{x:n*r-t*i,y:n*i+t*r}}function Iy(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=eA(t-f,e-d,p),b=l/2,y=c/2,A=[[[-b,-y],[b,-y]],[[b,-y],[b,y]],[[b,y],[-b,y]],[[-b,y],[-b,-y]]];let E={x:0,y:0,dist2:1/0};for(const[R,q]of A){const H=z0(g.x,g.y,R[0],R[1],q[0],q[1]);H.dist2<E.dist2&&(E=H)}const L=nA(E.x,E.y,p);return{x:f+L.x,y:d+L.y}}function CS(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=eA(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=nA(g,b,f);return{x:i+y.x,y:s+y.y}}function K8(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"?W8(n.points,e,r):n.type==="polyline"?X8(n.points,e,r):n.type==="arrow"?G8(n.start,n.control,n.end,e,r):n.type==="rectangle"?Iy(n,e,r,n.rotation??0):n.type==="image"||n.type==="redact"?Iy(n,e,r):n.type==="ellipse"?CS(n,e,r,n.rotation??0):n.type==="compass"?CS({cx:n.cx,cy:n.cy,rx:n.radius,ry:n.radius},e,r,n.rotation??0):{x:e,y:r}}function xg(n,t,e=[]){const r=(Array.isArray(e)?e:[]).filter(f=>!!f&&Number.isFinite(f.x)&&Number.isFinite(f.y)),i=r[0],s=K8(n,i?{x:i.x,y:i.y,width:0,height:0}:t),l=r.length>0?r[r.length-1]:s,c=V8(l.x,l.y,t);return[s,...r,c]}function J8(n){return n.map((t,e)=>`${e===0?"M":"L"} ${t.x} ${t.y}`).join(" ")}function Z8(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 Gm(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 Q8(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:Gm(n.x,n.y,t.x,t.y,e.x,e.y,r,e.y)||Gm(n.x,n.y,t.x,t.y,r,e.y,r,i)||Gm(n.x,n.y,t.x,t.y,r,i,e.x,i)||Gm(n.x,n.y,t.x,t.y,e.x,i,e.x,e.y)}function tD(n,t){for(let e=1;e<n.length;e+=1)if(Q8(n[e-1],n[e],t))return!0;return!1}function eD(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 Og(n){const{card:t,panel:e,gap:r,bounds:i,leader:s,margin:l}=n,c=ht=>Math.max(0,Math.min(ht,i.w-e.w)),f=ht=>Math.max(0,Math.min(ht,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 A=l?.left??0,E=l?.right??0,L=l?.top??0,R=l?.bottom??0,q=(ht,Mt)=>{const wt={x:ht-A,y:Mt-L,width:e.w+A+E,height:e.h+L+R};return eD(wt,t)||tD(s,wt)},H=b?[{y:g,above:!1},{y:p,above:!0}]:[{y:p,above:!0},{y:g,above:!1}],$=[d,c(t.x),c(t.x+t.width-e.w)];for(const ht of $)for(const Mt of H)if(!q(ht,Mt.y))return{x:ht,y:Mt.y,above:Mt.above};return y}function ES(n){return n.z??Number.POSITIVE_INFINITY}function Pg(n){return n.map((t,e)=>({pin:t,index:e})).sort((t,e)=>ES(t.pin)-ES(e.pin)||t.index-e.index).map(t=>t.pin)}function nD(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 rA(n,t){const e=n.find(i=>i.id===t);if(!e)return new Set;const r=R2(e,n)??e;return new Set([r.id,...j5(r.id,n)])}function rD(n,t,e){if(!n.some(b=>b.id===t))return[...n];const r=rA(n,t),i=Pg(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=nD(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 iD(n,t,e){if(!n.some(f=>f.id===t))return!1;const r=rA(n,t),i=Pg(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 oD(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 sD(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 TS(n,t){return{pin:{...n},card:t?{...t}:null}}function aD(n,t,e){const r=oD(n.pin.anchor),i=t.x-r.x,s=t.y-r.y;return iA(n,i,s,e)}function iA(n,t,e,r){return{pin:{...n.pin,id:r,anchor:sD(n.pin.anchor,t,e)},card:n.card?{...n.card,x:n.card.x+t,y:n.card.y+e}:null}}function B0(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 F5(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 Rc(n){return B0(n.anchor)&&(n.strokeStyle??Uf)==="dashed"}function vg(n,t){return(t??Ep)==="none"?null:`${n}${W_}`}function zy(n,t){return vg(n,t)??"transparent"}const oA=24*pi,lD=12,cD=12*pi,wg=1.25*pi;function uD(n,t,e,r=oA,i=cD){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 U5(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 fD(n,t,e){const{arcStartRad:r,arcEndRad:i}=U5(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 dD(n,t){const{cx:e,cy:r,radius:i,rotation:s=0,color:l,strokeWidth:c=wg}=t,f=s*Math.PI/180,d=U5(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 Rr="bi",mn=pi*I5,qr=Math.round(12*mn),mh="rgba(255,255,255,0.08)",eh="1px solid rgba(255,255,255,0.18)",F0="#ccc",hD="rgba(230,57,70,0.1)",pD="1px solid rgba(230,57,70,0.8)",V2="#ff6b6b",Hp=4*mn,qp=14*mn,mD=`${3*mn}px ${8*mn}px`,jg=10*mn,Ig=8*mn,uf=18*mn,sA=Math.round(10*mn),Km=7*mn,aA=8*mn,lA=4*mn,cA=12*mn,uA="rgba(20,20,32,0.95)",fA="1px solid rgba(60,60,80,0.9)",fp=6*mn,po=16*mn,zg=6*mn,ff=4*mn,Zd="2px solid #fff",dA="1px solid rgba(255,255,255,0.2)",Bg="rgba(255,255,255,0.05)",Fg="1px solid rgba(255,255,255,0.35)",Ug="1.8",hA="2.2 1.8",Hg="#fff",pA=10*mn,mA=3*mn,gA=10*mn,yA=32*mn,NS=16*mn,nh="#aaa",bA={width:NS,height:NS,padding:0,margin:0,background:"transparent",border:"none",color:nh,cursor:"pointer",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center"},$p=28*mn,gD=26*mn,xA=`${2*mn}px ${6*mn}px`,yD=4*mn,vA={minWidth:gD,height:$p,cursor:"pointer",borderRadius:Hp,fontSize:qp,padding:xA,fontFamily:"inherit",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:yD,lineHeight:1,boxSizing:"border-box"},ep={...vA,background:mh,border:eh,color:nh},np={...vA,background:hD,border:pD,color:V2},_S=22*mn,bD=26*mn,xD=12*mn,wA={display:"inline-flex",alignItems:"stretch",height:$p,background:mh,border:eh,borderRadius:Hp,overflow:"hidden",flexShrink:0,boxSizing:"border-box"},qg={width:_S,minWidth:_S,background:"transparent",border:"none",color:F0,cursor:"pointer",fontSize:qp,fontFamily:"inherit",padding:0,margin:0,lineHeight:1,display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},SA={minWidth:bD,padding:`0 ${3*mn}px`,borderLeft:eh,borderRight:eh,color:F0,fontSize:xD,fontFamily:"inherit",fontVariantNumeric:"tabular-nums",display:"inline-flex",alignItems:"center",justifyContent:"center",userSelect:"none",boxSizing:"border-box"},rh=32*mn,vD=`${3*mn}px`,wD=6,$g="rgba(20, 20, 32, 0.95)",H5="1px solid rgba(255,255,255,0.28)",q5="#cfcfcf",$5="background 0.15s, border 0.15s, color 0.15s",DS="1px solid rgba(230,57,70,0.7)",SD="rgba(230,57,70,0.95)",kD="1px solid #ff6b6b",AD="#fff",rp={position:"absolute",top:"50%",width:rh,height:rh,transform:"translateY(-50%)",background:$g,border:H5,color:q5,cursor:"pointer",borderRadius:"50%",fontSize:qp,padding:vD,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center",transition:$5},MD=Bc.memo(function({x:t,y:e,color:r,widthScale:i=1,onClick:s,onMouseDown:l,onPointerDown:c}){const f=tp*i;return C.jsx("g",{transform:`translate(${t}, ${e})`,onClick:s,onPointerDown:c,onMouseDown:l,style:{cursor:l?"grab":"pointer"},children:C.jsx("circle",{r:f,fill:r,stroke:"white",strokeWidth:bg*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),kA=(n,t,e)=>n+(t-n)*Math.min(1,Math.max(0,e));function CD(n){return kA(K_,J_,n)}function ED(n){return kA(Z_,Q_,n)}function TD(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 ND(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 _D=24;function DD(n,t,e,r){const{sx:i,sy:s,sw:l,sh:c}=TD(t,e,r),f=_D,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=ND(p.getImageData(0,0,f,f).data,f);return g?`rgb(${g.r}, ${g.g}, ${g.b})`:null}catch{return null}}function LS(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 AA(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=DD(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=CD(s),R=L*2,q=LS(t,(r.x-R)*f,(r.y-R)*d,(r.width+R*2)*f,(r.height+R*2)*d);if(!q)return;n.save(),n.beginPath(),n.rect(r.x,r.y,r.width,r.height),n.clip(),n.filter=`blur(${L}px)`,n.drawImage(q,r.x-R,r.y-R,r.width+R*2,r.height+R*2),n.filter="none",n.restore();return}const p=LS(t,r.x*f,r.y*d,r.width*f,r.height*d);if(!p)return;const g=ED(s),b=Math.max(1,Math.round(r.width/g)),y=Math.max(1,Math.round(r.height/g)),A=document.createElement("canvas");A.width=b,A.height=y;const E=A.getContext("2d");E&&(E.imageSmoothingEnabled=!0,E.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(A,0,0,b,y,r.x,r.y,r.width,r.height),n.imageSmoothingEnabled=!0,n.restore())}const LD=I.memo(function({x:t,y:e,width:r,height:i,mode:s,strength:l,source:c,imageSize:f,resolution:d=2}){const p=I.useRef(null);return I.useEffect(()=>{const g=p.current;if(!g||!c||r<=0||i<=0)return;const b={w:c.naturalWidth,h:c.naturalHeight};if(!b.w||!b.h)return;g.width=Math.max(1,Math.round(r*d)),g.height=Math.max(1,Math.round(i*d));const y=g.getContext("2d");y&&(y.setTransform(d,0,0,d,-t*d,-e*d),y.clearRect(t,e,r,i),AA(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]),C.jsx("foreignObject",{x:t,y:e,width:r,height:i,style:{overflow:"hidden"},children:C.jsx("canvas",{xmlns:"http://www.w3.org/1999/xhtml",ref:p,style:{width:"100%",height:"100%",display:"block",pointerEvents:"none"}})})});var ih=Xk();const RD=Wk(ih);var By={exports:{}},Fy={};var RS;function OD(){if(RS)return Fy;RS=1;var n=Fp();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(),A=r({inst:{value:y,getSnapshot:b}}),E=A[0].inst,L=A[1];return s(function(){E.value=y,E.getSnapshot=b,f(E)&&L({inst:E})},[g,y,b]),i(function(){return f(E)&&L({inst:E}),g(function(){f(E)&&L({inst:E})})},[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 Fy.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:p,Fy}var OS;function MA(){return OS||(OS=1,By.exports=OD()),By.exports}var CA=MA(),PS=Object.defineProperty,PD=(n,t)=>{let e={};for(var r in n)PS(e,r,{get:n[r],enumerable:!0});return PS(e,Symbol.toStringTag,{value:"Module"}),e};function Ts(n){this.content=n}Ts.prototype={constructor:Ts,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 Ts(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 Ts(e)},addToStart:function(n,t){return new Ts([n,t].concat(this.remove(n).content))},addToEnd:function(n,t){var e=this.remove(n).content.slice();return e.push(n,t),new Ts(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 Ts(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=Ts.from(n),n.size?new Ts(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ts.from(n),n.size?new Ts(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var t=this;n=Ts.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}};Ts.from=function(n){if(n instanceof Ts)return n;var t=[];if(n)for(var e in n)t.push(e,n[e]);return new Ts(t)};function EA(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&&_A(l.charCodeAt(f-1))&&NA(l.charCodeAt(f))&&e--,e}if(i.content.size||s.content.size){let l=EA(i.content,s.content,e+1);if(l!=null)return l}e+=i.nodeSize}}function TA(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&&_A(d.charCodeAt(g-1))&&NA(d.charCodeAt(g))&&(e++,r++),{a:e,b:r}}if(l.content.size||c.content.size){let d=TA(l.content,c.content,e-1,r-1);if(d)return d}e-=f,r-=f}}function NA(n){return n>=56320&&n<57344}function _A(n){return n>=55296&&n<56320}class ke{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 ke(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 ke(r,i)}cutByIndex(t,e){return t==e?ke.empty:t==0&&e==this.content.length?this:new ke(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 ke(i,s)}addToStart(t){return new ke([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new ke(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let 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 EA(this,t,e)}findDiffEnd(t,e=this.size,r=t.size){return TA(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 ke.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return ke.fromArray(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return ke.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 ke(e||t,r)}static from(t){if(!t)return ke.empty;if(t instanceof ke)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new ke([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ke.empty=new ke([],0);const Uy={index:0,offset:0};function Jm(n,t){return Uy.index=n,Uy.offset=t,Uy}function Yg(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(!Yg(n[r],t[r]))return!1}else{for(let r in n)if(!(r in t)||!Yg(n[r],t[r]))return!1;for(let r in t)if(!(r in n))return!1}return!0}let Mi=class W2{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&&Yg(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 W2.none;if(t instanceof W2)return[t];let e=t.slice();return e.sort((r,i)=>r.type.rank-i.type.rank),e}};Mi.none=[];class Tp extends Error{}class Je{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=LA(this.content,t+this.openStart,e,this.openStart+1,this.openEnd+1);return r&&new Je(r,this.openStart,this.openEnd)}removeBetween(t,e){return new Je(DA(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 Je.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 Je(ke.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 Je(t,r,i)}}Je.empty=new Je(ke.empty,0,0);function DA(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(DA(s.content,t-i-1,e-i-1)))}function LA(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=LA(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 jD(n,t,e){if(e.openStart>n.depth)throw new Tp("Inserted content deeper than insertion position");if(n.depth-e.openStart!=t.depth-e.openEnd)throw new Tp("Inconsistent open depths");return RA(n,t,e,0)}function RA(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=RA(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 Gf(l,c.cut(0,n.parentOffset).append(e.content).append(c.cut(t.parentOffset)))}else{let{start:l,end:c}=ID(e,n);return Gf(s,PA(n,l,c,t,r))}else return Gf(s,Vg(n,t,r))}function OA(n,t){if(!t.type.compatibleContent(n.type))throw new Tp("Cannot join "+t.type.name+" onto "+n.type.name)}function X2(n,t,e){let r=n.node(e);return OA(r,t.node(e)),r}function Xf(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 dp(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&&(Xf(n.nodeAfter,r),s++));for(let c=s;c<l;c++)Xf(i.child(c),r);t&&t.depth==e&&t.textOffset&&Xf(t.nodeBefore,r)}function Gf(n,t){if(!n.type.validContent(t))throw new Tp("Invalid content for node "+n.type.name);return n.copy(t)}function PA(n,t,e,r,i){let s=n.depth>i&&X2(n,t,i+1),l=r.depth>i&&X2(e,r,i+1),c=[];return dp(null,n,i,c),s&&l&&t.index(i)==e.index(i)?(OA(s,l),Xf(Gf(s,PA(n,t,e,r,i+1)),c)):(s&&Xf(Gf(s,Vg(n,t,i+1)),c),dp(t,e,i,c),l&&Xf(Gf(l,Vg(e,r,i+1)),c)),dp(r,null,i,c),new ke(c)}function Vg(n,t,e){let r=[];if(dp(null,n,e,r),n.depth>e){let i=X2(n,t,e+1);Xf(Gf(i,Vg(n,t,e+1)),r)}return dp(t,null,e,r),new ke(r)}function ID(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(ke.from(i));return{start:i.resolveNoCache(n.openStart+e),end:i.resolveNoCache(i.content.size-n.openEnd-e)}}class Np{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 Mi.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 Wg(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 Np(e,r,s)}static resolveCached(t,e){let r=jS.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 jS.set(t,r=new zD);let i=r.elts[r.i]=Np.resolve(t,e);return r.i=(r.i+1)%BD,i}}class zD{constructor(){this.elts=[],this.i=0}}const BD=12,jS=new WeakMap;class Wg{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 FD=Object.create(null);let Kf=class G2{constructor(t,e,r,i=Mi.none){this.type=t,this.attrs=e,this.marks=i,this.content=r||ke.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,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&&Yg(this.attrs,e||t.defaultAttrs||FD)&&Mi.sameSet(this.marks,r||Mi.none)}copy(t=null){return t==this.content?this:new G2(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new G2(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 Je.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 Je(d,i.depth-l,s.depth-l)}replace(t,e,r){return jD(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 Np.resolveCached(this,t)}resolveNoCache(t){return Np.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()+")"),jA(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=ke.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=Mi.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(!Mi.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=ke.fromJSON(t,e.content),s=t.nodeType(e.type).create(e.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Kf.prototype.text=void 0;class Xg extends Kf{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):jA(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 Xg(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Xg(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 jA(n,t){for(let e=n.length-1;e>=0;e--)t=n[e].type.name+"("+t+")";return t}class od{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let r=new UD(t,e);if(r.next==null)return od.empty;let i=IA(r);r.next&&r.err("Unexpected trailing text");let s=XD(WD(i));return GD(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 ke.from(c.map(d=>d.createAndFill()));for(let d=0;d<l.next.length;d++){let{type:p,next:g}=l.next[d];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(g)==-1){i.push(g);let b=s(g,c.concat(p));if(b)return b}}return null}return s(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let 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
|
-
`)}}od.empty=new od(!0);class UD{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 IA(n){let t=[];do t.push(HD(n));while(n.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function HD(n){let t=[];do t.push(qD(n));while(n.next&&n.next!=")"&&n.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function qD(n){let t=VD(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=$D(n,t);else break;return t}function IS(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let t=Number(n.next);return n.pos++,t}function $D(n,t){let e=IS(n),r=e;return n.eat(",")&&(n.next!="}"?r=IS(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:e,max:r,expr:t}}function YD(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 VD(n){if(n.eat("(")){let t=IA(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=YD(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 WD(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 zA(n,t){return t-n}function zS(n,t){let e=[];return r(t),e.sort(zA);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 XD(n){let t=Object.create(null);return e(zS(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]);zS(n,f).forEach(p=>{d||i.push([c,d=[]]),d.indexOf(p)==-1&&d.push(p)})})});let s=t[r.join(",")]=new od(r.indexOf(n.length-1)>-1);for(let l=0;l<i.length;l++){let c=i[l][1].sort(zA);s.next.push({type:i[l][0],next:t[c.join(",")]||e(c)})}return s}}function GD(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 BA(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 FA(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 HA(n,t){let e=Object.create(null);if(t)for(let r in t)e[r]=new JD(n,r,t[r]);return e}let BS=class qA{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=HA(t,r.attrs),this.defaultAttrs=BA(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==od.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:FA(this.attrs,t)}create(t=null,e,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Kf(this,this.computeAttrs(t),ke.from(e),Mi.setFrom(r))}createChecked(t=null,e,r){return e=ke.from(e),this.checkContent(e),new Kf(this,this.computeAttrs(t),e,Mi.setFrom(r))}createAndFill(t=null,e,r){if(t=this.computeAttrs(t),e=ke.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(ke.empty,!0);return s?new Kf(this,t,e.append(s),Mi.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:Mi.none:t}static compile(t,e){let r=Object.create(null);t.forEach((s,l)=>r[s]=new qA(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 KD(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 JD{constructor(t,e,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?KD(t,e,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class U0{constructor(t,e,r,i){this.name=t,this.rank=e,this.schema=r,this.spec=i,this.attrs=HA(t,i.attrs),this.excluded=null;let s=BA(this.attrs);this.instance=s?new Mi(this,s):null}create(t=null){return!t&&this.instance?this.instance:new Mi(this,FA(this.attrs,t))}static compile(t,e){let r=Object.create(null),i=0;return t.forEach((s,l)=>r[s]=new U0(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 $A{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=Ts.from(t.nodes),e.marks=Ts.from(t.marks||{}),this.nodes=BS.compile(this.spec.nodes,this),this.marks=U0.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]=od.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?FS(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==""?[]:FS(this,l.split(" "))}this.nodeFromJSON=i=>Kf.fromJSON(this,i),this.markFromJSON=i=>Mi.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 BS){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 Xg(r,r.defaultAttrs,t,Mi.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 FS(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 ZD(n){return n.tag!=null}function QD(n){return n.style!=null}let hp=class K2{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[];let r=this.matchedStyles=[];e.forEach(i=>{if(ZD(i))this.tags.push(i);else if(QD(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 HS(this,e,!1);return r.addAll(t,Mi.none,e.from,e.to),r.finish()}parseSlice(t,e={}){let r=new HS(this,e,!0);return r.addAll(t,Mi.none,e.from,e.to),Je.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(nL(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=qS(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=qS(l)),l.node||l.ignore||l.mark||(l.node=i)})}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new K2(t,K2.schemaRules(t)))}};const YA={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},tL={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},VA={ol:!0,ul:!0},_p=1,J2=2,pp=4;function US(n,t,e){return t!=null?(t?_p:0)|(t==="full"?J2:0):n&&n.whitespace=="pre"?_p|J2:e&~pp}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=Mi.none,this.match=s||(l&pp?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(ke.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&_p)){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=ke.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(ke.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&&!YA.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class HS{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=US(null,e.preserveWhitespace,0)|(r?pp:0);i?s=new Zm(i.type,i.attrs,Mi.none,!0,e.topMatch||i.type.contentMatch,l):r?s=new Zm(null,null,Mi.none,!0,null,l):s=new Zm(t.schema.topNodeType,null,Mi.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&_p)>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;VA.hasOwnProperty(l)&&this.parser.normalizeLists&&eL(t);let f=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(c=this.parser.matchTag(t,this,r));t:if(f?f.ignore:tL.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(YA.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=Mi.none;for(let c of i.concat(t.marks))(s.type?s.type.allowsMarkType(c.type):$S(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=US(t,s,l.options);l.options&pp&&l.content.length==0&&(c|=pp);let f=Mi.none;return r=r.filter(d=>(l.type?l.type.allowsMarkType(d.type):$S(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|=_p)}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 eL(n){for(let t=n.firstChild,e=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&VA.hasOwnProperty(r)&&e?(e.appendChild(t),t=e):r=="li"?e=t:r&&(e=null)}}function nL(n,t){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,t)}function qS(n){let t={};for(let e in n)t[e]=n[e];return t}function $S(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 dd{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},r){r||(r=Qm(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 Qm(e).createTextNode(t.text);let{dom:r,contentDOM:i}=Sg(Qm(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&&Sg(Qm(r),i(t,e),null,t.attrs)}static renderSpec(t,e,r=null,i){return typeof e=="string"?{dom:t.createTextNode(e)}:Sg(t,e,r,i)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new dd(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=YS(t.nodes);return e.text||(e.text=r=>r.text),e}static marksFromSchema(t){return YS(t.marks)}}function YS(n){let t={};for(let e in n){let r=n[e].spec.toDOM;r&&(t[e]=r)}return t}function Qm(n){return n.document||window.document}const VS=new WeakMap;function rL(n){let t=VS.get(n);return t===void 0&&VS.set(n,t=iL(n)),t}function iL(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 Sg(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=rL(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:A}=Sg(n,b,e,r);if(f.appendChild(y),A){if(c)throw new RangeError("Multiple content holes");c=A}}}return{dom:f,contentDOM:c}}const WA=65535,XA=Math.pow(2,16);function oL(n,t){return n+t*XA}function WS(n){return n&WA}function sL(n){return(n-(n&WA))/XA}const GA=1,KA=2,kg=4,JA=8;class Z2{constructor(t,e,r){this.pos=t,this.delInfo=e,this.recover=r}get deleted(){return(this.delInfo&JA)>0}get deletedBefore(){return(this.delInfo&(GA|kg))>0}get deletedAfter(){return(this.delInfo&(KA|kg))>0}get deletedAcross(){return(this.delInfo&kg)>0}}class fl{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&fl.empty)return fl.empty}recover(t){let e=0,r=WS(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+sL(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 A=t==(e<0?f:g)?null:oL(c/3,t-f),E=t==f?KA:t==g?GA:kg;return(e<0?t!=f:t!=g)&&(E|=JA),new Z2(y,E,A)}i+=p-d}return r?t+i:new Z2(t+i,0,null)}touches(t,e){let r=0,i=WS(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 fl(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?fl.empty:new fl(t<0?[0,-t,0]:[0,0,t])}}fl.empty=new fl([]);class Dp{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 Dp(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 Dp;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 Hy=Object.create(null);class Qs{getMap(){return fl.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Hy[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 Hy)throw new RangeError("Duplicate use of step JSON ID "+t);return Hy[t]=e,e.prototype.jsonID=t,e}}class jo{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new jo(t,null)}static fail(t){return new jo(null,t)}static fromReplace(t,e,r,i){try{return jo.ok(t.replace(e,r,i))}catch(s){if(s instanceof Tp)return jo.fail(s.message);throw s}}}function Y5(n,t,e){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(Y5(s.content,t,s))),s.isInline&&(s=t(s,e,i)),r.push(s)}return ke.fromArray(r)}class df extends Qs{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 Je(Y5(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 jo.fromReplace(t,this.from,this.to,s)}invert(){return new ac(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 df(e.pos,r.pos,this.mark)}merge(t){return t instanceof df&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new df(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 df(e.from,e.to,t.markFromJSON(e.mark))}}Qs.jsonID("addMark",df);class ac extends Qs{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 Je(Y5(e.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),e.openStart,e.openEnd);return jo.fromReplace(t,this.from,this.to,r)}invert(){return new df(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 ac(e.pos,r.pos,this.mark)}merge(t){return t instanceof ac&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ac(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 ac(e.from,e.to,t.markFromJSON(e.mark))}}Qs.jsonID("removeMark",ac);class hf extends Qs{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return jo.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return jo.fromReplace(t,this.pos,this.pos+1,new Je(ke.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 hf(this.pos,e.marks[i]);return new hf(this.pos,this.mark)}}return new sd(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new hf(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 hf(e.pos,t.markFromJSON(e.mark))}}Qs.jsonID("addNodeMark",hf);class sd extends Qs{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return jo.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return jo.fromReplace(t,this.pos,this.pos+1,new Je(ke.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return!e||!this.mark.isInSet(e.marks)?this:new hf(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new sd(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 sd(e.pos,t.markFromJSON(e.mark))}}Qs.jsonID("removeNodeMark",sd);class Ao extends Qs{constructor(t,e,r,i=!1){super(),this.from=t,this.to=e,this.slice=r,this.structure=i}apply(t){return this.structure&&Q2(t,this.from,this.to)?jo.fail("Structure replace would overwrite content"):jo.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new fl([this.from,this.to-this.from,this.slice.size])}invert(t){return new Ao(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&&Ao.MAP_BIAS<0?e:t.mapResult(this.from,1);return r.deletedAcross&&e.deletedAcross?null:new Ao(r.pos,Math.max(r.pos,e.pos),this.slice,this.structure)}merge(t){if(!(t instanceof Ao)||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?Je.empty:new Je(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Ao(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?Je.empty:new Je(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Ao(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 Ao(e.from,e.to,Je.fromJSON(t,e.slice),!!e.structure)}}Ao.MAP_BIAS=1;Qs.jsonID("replace",Ao);class rs extends Qs{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&&(Q2(t,this.from,this.gapFrom)||Q2(t,this.gapTo,this.to)))return jo.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return jo.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,e.content);return r?jo.fromReplace(t,this.from,this.to,r):jo.fail("Content does not fit in gap")}getMap(){return new fl([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 rs(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 rs(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 rs(e.from,e.to,e.gapFrom,e.gapTo,Je.fromJSON(t,e.slice),e.insert,!!e.structure)}}Qs.jsonID("replaceAround",rs);function Q2(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 aL(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),A=r.addToSet(g);for(let E=0;E<g.length;E++)g[E].isInSet(A)||(l&&l.to==b&&l.mark.eq(g[E])?l.to=y:i.push(l=new ac(b,y,g[E])));c&&c.to==b?c.to=y:s.push(c=new df(b,y,r))}}),i.forEach(f=>n.step(f)),s.forEach(f=>n.step(f))}function lL(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 U0){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 A=i[y];A.step==s-1&&g.eq(i[y].style)&&(b=A)}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 ac(l.from,l.to,l.style)))}function V5(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 Ao(c,p,Je.empty));else{r=g;for(let b=0;b<d.marks.length;b++)e.allowsMarkType(d.marks[b].type)||n.step(new ac(c,p,d.marks[b]));if(i&&d.isText&&e.whitespace!="pre"){let b,y=/\r?\n|\r/g,A;for(;b=y.exec(d.text);)A||(A=new Je(ke.from(e.schema.text(" ",e.allowedMarks(d.marks))),0,0)),l.push(new Ao(c+b.index,c+b.index+b[0].length,A))}}c=p}if(!r.validEnd){let f=r.fillBefore(ke.empty,!0);n.replace(c,c,new Je(f,0,0))}for(let f=l.length-1;f>=0;f--)n.step(l[f])}function cL(n,t,e){return(t==0||n.canReplace(t,n.childCount))&&(e==n.childCount||n.canReplace(0,e))}function gh(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||!cL(l,c,f))break;c&&(i=1),f<l.childCount&&(s=1)}return null}function uL(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=ke.empty,g=0;for(let A=s,E=!1;A>e;A--)E||r.index(A)>0?(E=!0,p=ke.from(r.node(A).copy(p)),g++):f--;let b=ke.empty,y=0;for(let A=s,E=!1;A>e;A--)E||i.after(A+1)<i.end(A)?(E=!0,b=ke.from(i.node(A).copy(b)),y++):d++;n.step(new rs(f,d,l,c,new Je(p.append(b),g,y),p.size-g,!0))}function W5(n,t,e=null,r=n){let i=fL(n,t),s=i&&dL(r,t);return s?i.map(XS).concat({type:t,attrs:e}).concat(s.map(XS)):null}function XS(n){return{type:n,attrs:null}}function fL(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 dL(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 hL(n,t,e){let r=ke.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=ke.from(e[l].type.create(e[l].attrs,r))}let i=t.start,s=t.end;n.step(new rs(i,s,i,s,new Je(r,0,0),e.length,!0))}function pL(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)&&mL(n.doc,n.mapping.slice(s).map(c),r)){let d=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",A=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!A?d=!1:!y&&A&&(d=!0)}d===!1&&QA(n,l,c,s),V5(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 rs(g,b,g+1,b-1,new Je(ke.from(r.create(f,null,l.marks)),0,0),1,!0)),d===!0&&ZA(n,l,c,s),!1}})}function ZA(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 QA(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 mL(n,t,e){let r=n.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,e)}function gL(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 rs(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new Je(ke.from(l),0,0),1,!0))}function Eu(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),A=r&&r[p+1];A&&(y=y.replaceChild(0,A.type.create(A.attrs)));let E=r&&r[p]||g;if(!g.canReplace(b+1,g.childCount)||!E.type.validContent(y))return!1}let c=i.indexAfter(s),f=r&&r[0];return i.node(s).canReplaceWith(c,c,f?f.type:i.node(s+1).type)}function yL(n,t,e=1,r){let i=n.doc.resolve(t),s=ke.empty,l=ke.empty;for(let c=i.depth,f=i.depth-e,d=e-1;c>f;c--,d--){s=ke.from(i.node(c).copy(s));let p=r&&r[d];l=ke.from(p?p.type.create(p.attrs,l):i.node(c).copy(l))}n.step(new Ao(t,t,new Je(s.append(l),e,e),!0))}function wf(n,t){let e=n.resolve(t),r=e.index();return tM(e.nodeBefore,e.nodeAfter)&&e.parent.canReplace(r,r+1)}function bL(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 tM(n,t){return!!(n&&t&&!n.isLeaf&&bL(n,t))}function H0(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&&tM(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 xL(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);QA(n,p.node(),p.before(),c)}l.inlineContent&&V5(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 Ao(d,f.map(t+e,-1),Je.empty,!0)),r===!0){let p=n.doc.resolve(d);ZA(n,p.node(),p.before(),n.steps.length)}return n}function vL(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 eM(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 q0(n,t,e=t,r=Je.empty){if(t==e&&!r.size)return null;let i=n.resolve(t),s=n.resolve(e);return nM(i,s,r)?new Ao(t,e,r):new wL(i,s,r).fit()}function nM(n,t,e){return!e.openStart&&!e.openEnd&&n.start()==t.start()&&n.parent.canReplace(n.index(),t.index(),e.content)}class wL{constructor(t,e,r){this.$from=t,this.$to=e,this.unplaced=r,this.frontier=[],this.placed=ke.empty;for(let i=0;i<=t.depth;i++){let s=t.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=ke.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),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 Je(s,l,c);return t>-1?new rs(r.pos,t,this.$to.pos,this.$to.end(),f,e):f.size||r.pos!=this.$to.pos?new Ao(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=GS(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(ke.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 KS(t,-1)<=e?!1:(this.unplaced.size>1&&KS(t,1)>r&&r++,this.unplaced=new Je(t,e+1,r),!0)}dropNode(){let{content:t,openStart:e,openEnd:r}=this.unplaced,i=GS(t,e);if(i.childCount<=1&&e>0){let s=t.size-e<=e+i.size;this.unplaced=new Je(ip(t,e-1,1),e-1,s?e-1:r)}else this.unplaced=new Je(ip(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 E=0;E<s.length;E++)this.openFrontierNode(s[E]);let l=this.unplaced,c=r?r.content:l.content,f=l.openStart-t,d=0,p=[],{match:g,type:b}=this.frontier[e];if(i){for(let E=0;E<i.childCount;E++)p.push(i.child(E));g=g.matchFragment(i)}let y=c.size+t-(l.content.size-l.openEnd);for(;d<c.childCount;){let E=c.child(d),L=g.matchType(E.type);if(!L)break;d++,(d>1||f==0||E.content.size)&&(g=L,p.push(rM(E.mark(b.allowedMarks(E.marks)),d==1?f:0,d==c.childCount?y:-1)))}let A=d==c.childCount;A||(y=-1),this.placed=op(this.placed,e,ke.from(p)),this.frontier[e].match=g,A&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let E=0,L=c;E<y;E++){let R=L.lastChild;this.frontier.push({type:R.type,match:R.contentMatchAt(R.childCount)}),L=R.content}this.unplaced=A?t==0?Je.empty:new Je(ip(l.content,t-1,1),t-1,y<0?l.openEnd:t-1):new Je(ip(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||!qy(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=qy(t,e,i,r,s);if(l){for(let c=e-1;c>=0;c--){let{match:f,type:d}=this.frontier[c],p=qy(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=op(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=op(this.placed,this.depth,ke.from(t.create(e,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(ke.empty,!0);e.childCount&&(this.placed=op(this.placed,this.frontier.length,e))}}function ip(n,t,e){return t==0?n.cutByIndex(e,n.childCount):n.replaceChild(0,n.firstChild.copy(ip(n.firstChild.content,t-1,e)))}function op(n,t,e){return t==0?n.append(e):n.replaceChild(n.childCount-1,n.lastChild.copy(op(n.lastChild.content,t-1,e)))}function GS(n,t){for(let e=0;e<t;e++)n=n.firstChild.content;return n}function rM(n,t,e){if(t<=0)return n;let r=n.content;return t>1&&(r=r.replaceChild(0,rM(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(ke.empty,!0)))),n.copy(r)}function qy(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&&!SL(e,s.content,l)?c:null}function SL(n,t,e){for(let r=e;r<t.childCount;r++)if(!n.allowsMarks(t.child(r).marks))return!0;return!1}function kL(n){return n.spec.defining||n.spec.definingForContent}function KS(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 AL(n,t,e,r){if(!r.size)return n.deleteRange(t,e);let i=n.doc.resolve(t),s=n.doc.resolve(e);if(nM(i,s,r))return n.step(new Ao(t,e,r));let l=oM(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 A=i.node(b).type.spec;if(A.defining||A.definingAsContext||A.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 A=b.firstChild;if(d.push(A),y==r.openStart)break;b=A.content}for(let b=p-1;b>=0;b--){let y=d[b],A=kL(y.type);if(A&&!y.sameMarkup(i.node(Math.abs(c)-1)))p=b;else if(A||!y.type.isTextblock)break}for(let b=r.openStart;b>=0;b--){let y=(b+p+1)%(r.openStart+1),A=d[y];if(A)for(let E=0;E<l.length;E++){let L=l[(E+f)%l.length],R=!0;L<0&&(R=!1,L=-L);let q=i.node(L-1),H=i.index(L-1);if(q.canReplaceWith(H,H,A.type,A.marks))return n.replace(i.before(L),R?s.after(L):e,new Je(iM(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 iM(n,t,e,r,i){if(t<e){let s=n.firstChild;n=n.replaceChild(0,s.copy(iM(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(ke.empty,!0))}return n}function ML(n,t,e,r){if(!r.isInline&&t==e&&n.doc.resolve(t).parent.content.size){let i=vL(n.doc,t,r.type);i!=null&&(t=e=i)}n.replaceRange(t,e,new Je(ke.from(r),0,0))}function CL(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=oM(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 oM(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 Qd extends Qs{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 jo.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 jo.fromReplace(t,this.pos,this.pos+1,new Je(ke.from(i),0,e.isLeaf?0:1))}getMap(){return fl.empty}invert(t){return new Qd(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 Qd(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 Qd(e.pos,e.attr,e.value)}}Qs.jsonID("attr",Qd);class Lp extends Qs{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 jo.ok(r)}getMap(){return fl.empty}invert(t){return new Lp(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 Lp(e.attr,e.value)}}Qs.jsonID("docAttr",Lp);let oh=class extends Error{};oh=function n(t){let e=Error.call(this,t);return e.__proto__=n.prototype,e};oh.prototype=Object.create(Error.prototype);oh.prototype.constructor=oh;oh.prototype.name="TransformError";class sM{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new Dp}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new oh(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=Je.empty){let i=q0(this.doc,t,e,r);return i&&this.step(i),this}replaceWith(t,e,r){return this.replace(t,e,new Je(ke.from(r),0,0))}delete(t,e){return this.replace(t,e,Je.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,r){return AL(this,t,e,r),this}replaceRangeWith(t,e,r){return ML(this,t,e,r),this}deleteRange(t,e){return CL(this,t,e),this}lift(t,e){return uL(this,t,e),this}join(t,e=1){return xL(this,t,e),this}wrap(t,e){return hL(this,t,e),this}setBlockType(t,e=t,r,i=null){return pL(this,t,e,r,i),this}setNodeMarkup(t,e,r=null,i){return gL(this,t,e,r,i),this}setNodeAttribute(t,e,r){return this.step(new Qd(t,e,r)),this}setDocAttribute(t,e){return this.step(new Lp(t,e)),this}addNodeMark(t,e){return this.step(new hf(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 Mi)e.isInSet(r.marks)&&this.step(new sd(t,e));else{let i=r.marks,s,l=[];for(;s=e.isInSet(i);)l.push(new sd(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 yL(this,t,e,r),this}addMark(t,e,r){return aL(this,t,e,r),this}removeMark(t,e,r){return lL(this,t,e,r),this}clearIncompatible(t,e,r){return V5(this,t,e,r),this}}const $y=Object.create(null);class ir{constructor(t,e,r){this.$anchor=t,this.$head=e,this.ranges=r||[new EL(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=Je.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?Je.empty:e),c==0&&QS(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),QS(t,r,e.isInline?-1:1))}}static findFrom(t,e,r=!1){let i=t.parent.inlineContent?new On(t):Hd(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?Hd(t.node(0),t.node(s),t.before(s+1),t.index(s),e,r):Hd(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 pl(t.node(0))}static atStart(t){return Hd(t,t,0,0,1)||new pl(t)}static atEnd(t){return Hd(t,t,t.content.size,t.childCount,-1)||new pl(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=$y[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 $y)throw new RangeError("Duplicate use of selection JSON ID "+t);return $y[t]=e,e.prototype.jsonID=t,e}getBookmark(){return On.between(this.$anchor,this.$head).getBookmark()}}ir.prototype.visible=!0;class EL{constructor(t,e){this.$from=t,this.$to=e}}let JS=!1;function ZS(n){!JS&&!n.parent.inlineContent&&(JS=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class On extends ir{constructor(t,e=t){ZS(t),ZS(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 ir.near(r);let i=t.resolve(e.map(this.anchor));return new On(i.parent.inlineContent?i:r,r)}replace(t,e=Je.empty){if(super.replace(t,e),e==Je.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof On&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new $0(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 On(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=ir.findFrom(e,r,!0)||ir.findFrom(e,-r,!0);if(s)e=s.$head;else return ir.near(e,r)}return t.parent.inlineContent||(i==0?t=e:(t=(ir.findFrom(t,-r,!0)||ir.findFrom(t,r,!0)).$anchor,t.pos<e.pos!=i<0&&(t=e))),new On(t,e)}}ir.jsonID("text",On);class $0{constructor(t,e){this.anchor=t,this.head=e}map(t){return new $0(t.map(this.anchor),t.map(this.head))}resolve(t){return On.between(t.resolve(this.anchor),t.resolve(this.head))}}class En extends ir{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?ir.near(s):new En(s)}content(){return new Je(ke.from(this.node),0,0)}eq(t){return t instanceof En&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new X5(this.anchor)}static fromJSON(t,e){if(typeof e.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new En(t.resolve(e.anchor))}static create(t,e){return new En(t.resolve(e))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}En.prototype.visible=!1;ir.jsonID("node",En);class X5{constructor(t){this.anchor=t}map(t){let{deleted:e,pos:r}=t.mapResult(this.anchor);return e?new $0(r,r):new X5(r)}resolve(t){let e=t.resolve(this.anchor),r=e.nodeAfter;return r&&En.isSelectable(r)?new En(e):ir.near(e)}}class pl extends ir{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=Je.empty){if(e==Je.empty){t.delete(0,t.doc.content.size);let r=ir.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(t){return new pl(t)}map(t){return new pl(t)}eq(t){return t instanceof pl}getBookmark(){return TL}}ir.jsonID("all",pl);const TL={map(){return this},resolve(n){return new pl(n)}};function Hd(n,t,e,r,i,s=!1){if(t.inlineContent)return On.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&&En.isSelectable(c))return En.create(n,e-(i<0?c.nodeSize:0))}else{let f=Hd(n,c,e+i,i<0?c.childCount:0,i,s);if(f)return f}e+=c.nodeSize*i}return null}function QS(n,t,e){let r=n.steps.length-1;if(r<t)return;let i=n.steps[r];if(!(i instanceof Ao||i instanceof rs))return;let s=n.mapping.maps[r],l;s.forEach((c,f,d,p)=>{l==null&&(l=p)}),n.setSelection(ir.near(n.doc.resolve(l),e))}const t3=1,tg=2,e3=4;class NL extends sM{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|t3)&~tg,this.storedMarks=null,this}get selectionSet(){return(this.updated&t3)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=tg,this}ensureMarks(t){return Mi.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&tg)>0}addStep(t,e){super.addStep(t,e),this.updated=this.updated&~tg,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)||Mi.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(ir.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|=e3,this}get scrolledIntoView(){return(this.updated&e3)>0}}function n3(n,t){return!t||!n?n:n.bind(t)}class sp{constructor(t,e,r){this.name=t,this.init=n3(e.init,r),this.apply=n3(e.apply,r)}}const _L=[new sp("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new sp("selection",{init(n,t){return n.selection||ir.atStart(t.doc)},apply(n){return n.selection}}),new sp("storedMarks",{init(n){return n.storedMarks||null},apply(n,t,e,r){return r.selection.$cursor?n.storedMarks:null}}),new sp("scrollToSelection",{init(){return 0},apply(n,t){return n.scrolledIntoView?t+1:t}})];class Yy{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=_L.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 sp(r.key,r.spec.state,r))})}}class Hf{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 Hf(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 NL(this)}static create(t){let e=new Yy(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new Hf(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 Yy(this.schema,t.plugins),r=e.fields,i=new Hf(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 Yy(t.schema,t.plugins),s=new Hf(i);return i.fields.forEach(l=>{if(l.name=="doc")s.doc=Kf.fromJSON(t.schema,e.doc);else if(l.name=="selection")s.selection=ir.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 aM(n,t,e){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(t):r=="handleDOMEvents"&&(i=aM(i,t,{})),e[r]=i}return e}class Vi{constructor(t){this.spec=t,this.props={},t.props&&aM(t.props,this,this.props),this.key=t.key?t.key.key:lM("plugin")}getState(t){return t[this.key]}}const Vy=Object.create(null);function lM(n){return n in Vy?n+"$"+ ++Vy[n]:(Vy[n]=0,n+"$")}class zo{constructor(t="key"){this.key=lM(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const cM=(n,t)=>n.selection.empty?!1:(t&&t(n.tr.deleteSelection().scrollIntoView()),!0);function uM(n,t){let{$cursor:e}=n.selection;return!e||(t?!t.endOfTextblock("backward",n):e.parentOffset>0)?null:e}const fM=(n,t,e)=>{let r=uM(n,e);if(!r)return!1;let i=G5(r);if(!i){let l=r.blockRange(),c=l&&gh(l);return c==null?!1:(t&&t(n.tr.lift(l,c).scrollIntoView()),!0)}let s=i.nodeBefore;if(vM(n,i,t,-1))return!0;if(r.parent.content.size==0&&(sh(s,"end")||En.isSelectable(s)))for(let l=r.depth;;l--){let c=q0(n.doc,r.before(l),r.after(l),Je.empty);if(c&&c.slice.size<c.to-c.from){if(t){let f=n.tr.step(c);f.setSelection(sh(s,"end")?ir.findFrom(f.doc.resolve(f.mapping.map(i.pos,-1)),-1):En.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},DL=(n,t,e)=>{let r=uM(n,e);if(!r)return!1;let i=G5(r);return i?dM(n,i,t):!1},LL=(n,t,e)=>{let r=pM(n,e);if(!r)return!1;let i=K5(r);return i?dM(n,i,t):!1};function dM(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=q0(n.doc,s,f,Je.empty);if(!d||d.from!=s||d instanceof Ao&&d.slice.size>=f-s)return!1;if(e){let p=n.tr.step(d);p.setSelection(On.create(p.doc,s)),e(p.scrollIntoView())}return!0}function sh(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 hM=(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=G5(r)}let l=s&&s.nodeBefore;return!l||!En.isSelectable(l)?!1:(t&&t(n.tr.setSelection(En.create(n.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function G5(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 pM(n,t){let{$cursor:e}=n.selection;return!e||(t?!t.endOfTextblock("forward",n):e.parentOffset<e.parent.content.size)?null:e}const mM=(n,t,e)=>{let r=pM(n,e);if(!r)return!1;let i=K5(r);if(!i)return!1;let s=i.nodeAfter;if(vM(n,i,t,1))return!0;if(r.parent.content.size==0&&(sh(s,"start")||En.isSelectable(s))){let l=q0(n.doc,r.before(),r.after(),Je.empty);if(l&&l.slice.size<l.to-l.from){if(t){let c=n.tr.step(l);c.setSelection(sh(s,"start")?ir.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):En.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},gM=(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=K5(r)}let l=s&&s.nodeAfter;return!l||!En.isSelectable(l)?!1:(t&&t(n.tr.setSelection(En.create(n.doc,s.pos)).scrollIntoView()),!0)};function K5(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 RL=(n,t)=>{let e=n.selection,r=e instanceof En,i;if(r){if(e.node.isTextblock||!wf(n.doc,e.from))return!1;i=e.from}else if(i=H0(n.doc,e.from,-1),i==null)return!1;if(t){let s=n.tr.join(i);r&&s.setSelection(En.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),t(s.scrollIntoView())}return!0},OL=(n,t)=>{let e=n.selection,r;if(e instanceof En){if(e.node.isTextblock||!wf(n.doc,e.to))return!1;r=e.to}else if(r=H0(n.doc,e.to,1),r==null)return!1;return t&&t(n.tr.join(r).scrollIntoView()),!0},PL=(n,t)=>{let{$from:e,$to:r}=n.selection,i=e.blockRange(r),s=i&&gh(i);return s==null?!1:(t&&t(n.tr.lift(i,s).scrollIntoView()),!0)},yM=(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 J5(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 jL=(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=J5(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(ir.near(f.doc.resolve(c),1)),t(f.scrollIntoView())}return!0},bM=(n,t)=>{let e=n.selection,{$from:r,$to:i}=e;if(e instanceof pl||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=J5(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(On.create(c.doc,l+1)),t(c.scrollIntoView())}return!0},xM=(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(Eu(n.doc,s))return t&&t(n.tr.split(s).scrollIntoView()),!0}let r=e.blockRange(),i=r&&gh(r);return i==null?!1:(t&&t(n.tr.lift(r,i).scrollIntoView()),!0)};function IL(n){return(t,e)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof En&&t.selection.node.isBlock)return!r.parentOffset||!Eu(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=J5(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 On||t.selection instanceof pl)&&p.deleteSelection();let g=p.mapping.map(r.pos),b=Eu(p.doc,g,s.length,s);if(b||(s[0]=c?{type:c}:null,b=Eu(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)),A=p.doc.resolve(y);c&&r.node(l-1).canReplaceWith(A.index(),A.index()+1,c)&&p.setNodeMarkup(p.mapping.map(r.before(l)),c)}return e&&e(p.scrollIntoView()),!0}}const zL=IL(),BL=(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(En.create(n.doc,i))),!0)};function FL(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||wf(n.doc,t.pos))?!1:(e&&e(n.tr.join(t.pos).scrollIntoView()),!0)}function vM(n,t,e,r){let i=t.nodeBefore,s=t.nodeAfter,l,c,f=i.type.spec.isolating||s.type.spec.isolating;if(!f&&FL(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,A=ke.empty;for(let R=l.length-1;R>=0;R--)A=ke.from(l[R].create(null,A));A=ke.from(i.copy(A));let E=n.tr.step(new rs(t.pos-1,y,t.pos,y,new Je(A,1,0),l.length,!0)),L=E.doc.resolve(y+2*l.length);L.nodeAfter&&L.nodeAfter.type==i.type&&wf(E.doc,L.pos)&&E.join(L.pos),e(E.scrollIntoView())}return!0}let p=s.type.spec.isolating||r>0&&f?null:ir.findFrom(t,1),g=p&&p.$from.blockRange(p.$to),b=g&&gh(g);if(b!=null&&b>=t.depth)return e&&e(n.tr.lift(g,b).scrollIntoView()),!0;if(d&&sh(s,"start",!0)&&sh(i,"end")){let y=i,A=[];for(;A.push(y),!y.isTextblock;)y=y.lastChild;let E=s,L=1;for(;!E.isTextblock;E=E.firstChild)L++;if(y.canReplace(y.childCount,y.childCount,E.content)){if(e){let R=ke.empty;for(let H=A.length-1;H>=0;H--)R=ke.from(A[H].copy(R));let q=n.tr.step(new rs(t.pos-A.length,t.pos+s.nodeSize,t.pos+L,t.pos+s.nodeSize-L,new Je(R,A.length,0),0,!0));e(q.scrollIntoView())}return!0}}return!1}function wM(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(On.create(t.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const UL=wM(-1),HL=wM(1);function qL(n,t=null){return function(e,r){let{$from:i,$to:s}=e.selection,l=i.blockRange(s),c=l&&W5(l,n,t);return c?(r&&r(e.tr.wrap(l,c).scrollIntoView()),!0):!1}}function r3(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 Z5(...n){return function(t,e,r){for(let i=0;i<n.length;i++)if(n[i](t,e,r))return!0;return!1}}Z5(cM,fM,hM);Z5(cM,mM,gM);Z5(yM,bM,xM,zL);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function $L(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 YL(c,l,n,t)?(r&&r(c.scrollIntoView()),!0):!1}}function YL(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 Wg(f,f,t.depth),t.endIndex<t.parent.childCount&&(t=new Wg(t.$from,l.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let c=W5(s,e,r,t);return c?(n&&VL(n,t,c,i,e),!0):!1}function VL(n,t,e,r,i){let s=ke.empty;for(let p=e.length-1;p>=0;p--)s=ke.from(e[p].type.create(e[p].attrs,s));n.step(new rs(t.start-(r?2:0),t.end,t.start,t.end,new Je(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&&Eu(n.doc,f,c)&&(n.split(f,c),f+=2*c),f+=d.child(p).nodeSize;return n}function WL(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?XL(t,e,n,s):GL(t,e,s):!0:!1}}function XL(n,t,e,r){let i=n.tr,s=r.end,l=r.$to.end(r.depth);s<l&&(i.step(new rs(s-1,l,s,l,new Je(ke.from(e.create(null,r.parent.copy())),1,0),1,!0)),r=new Wg(i.doc.resolve(r.$from.pos),i.doc.resolve(l),r.depth));const c=gh(r);if(c==null)return!1;i.lift(r,c);let f=i.doc.resolve(i.mapping.map(s,-1)-1);return wf(i.doc,f.pos)&&f.nodeBefore.type==f.nodeAfter.type&&i.join(f.pos),t(i.scrollIntoView()),!0}function GL(n,t,e){let r=n.tr,i=e.parent;for(let y=e.end,A=e.endIndex-1,E=e.startIndex;A>E;A--)y-=i.child(A).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?ke.empty:ke.from(i))))return!1;let g=s.pos,b=g+l.nodeSize;return r.step(new rs(g-(c?1:0),b+(f?1:0),g+1,b-1,new Je((c?ke.empty:ke.from(i.copy(ke.empty))).append(f?ke.empty:ke.from(i.copy(ke.empty))),c?0:1,f?0:1),c?0:1)),t(r.scrollIntoView()),!0}function KL(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=ke.from(d?n.create():null),g=new Je(ke.from(n.create(null,ke.from(c.type.create(null,p)))),d?3:1,0),b=s.start,y=s.end;e(t.tr.step(new rs(b-(d?3:1),y,b,y,g,1,!0)).scrollIntoView())}return!0}}const Ns=function(n){for(var t=0;;t++)if(n=n.previousSibling,!n)return t},ah=function(n){let t=n.assignedSlot||n.parentNode;return t&&t.nodeType==11?t.host:t};let t5=null;const ku=function(n,t,e){let r=t5||(t5=document.createRange());return r.setEnd(n,e??n.nodeValue.length),r.setStart(n,t||0),r},JL=function(){t5=null},ad=function(n,t,e,r){return e&&(i3(n,t,e,r,-1)||i3(n,t,e,r,1))},ZL=/^(img|br|input|textarea|hr)$/i;function i3(n,t,e,r,i){for(var s;;){if(n==e&&t==r)return!0;if(t==(i<0?0:Fl(n))){let l=n.parentNode;if(!l||l.nodeType!=1||Yp(n)||ZL.test(n.nodeName)||n.contentEditable=="false")return!1;t=Ns(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?Fl(n):0}else return!1}}function Fl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function QL(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=Fl(n)}else if(n.parentNode&&!Yp(n))t=Ns(n),n=n.parentNode;else return null}}function tR(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&&!Yp(n))t=Ns(n)+1,n=n.parentNode;else return null}}function eR(n,t,e){for(let r=t==0,i=t==Fl(n);r||i;){if(n==e)return!0;let s=Ns(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==Fl(n)}}function Yp(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 Y0=function(n){return n.focusNode&&ad(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Ff(n,t){let e=document.createEvent("Event");return e.initEvent("keydown",!0,!0),e.keyCode=n,e.key=e.code=t,e}function nR(n){let t=n.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function rR(n,t,e){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(t,e);if(r)return{node:r.offsetNode,offset:Math.min(Fl(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(t,e);if(r)return{node:r.startContainer,offset:Math.min(Fl(r.startContainer),r.startOffset)}}}const Fc=typeof navigator<"u"?navigator:null,o3=typeof document<"u"?document:null,Sf=Fc&&Fc.userAgent||"",e5=/Edge\/(\d+)/.exec(Sf),SM=/MSIE \d/.exec(Sf),n5=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Sf),za=!!(SM||n5||e5),pf=SM?document.documentMode:n5?+n5[1]:e5?+e5[1]:0,Ul=!za&&/gecko\/(\d+)/i.test(Sf);Ul&&+(/Firefox\/(\d+)/.exec(Sf)||[0,0])[1];const r5=!za&&/Chrome\/(\d+)/.exec(Sf),Ds=!!r5,kM=r5?+r5[1]:0,Zs=!za&&!!Fc&&/Apple Computer/.test(Fc.vendor),lh=Zs&&(/Mobile\/\w+/.test(Sf)||!!Fc&&Fc.maxTouchPoints>2),zl=lh||(Fc?/Mac/.test(Fc.platform):!1),AM=Fc?/Win/.test(Fc.platform):!1,Mu=/Android \d/.test(Sf),Vp=!!o3&&"webkitFontSmoothing"in o3.documentElement.style,iR=Vp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function oR(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 yu(n,t){return typeof n=="number"?n:n[t]}function sR(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 s3(n,t,e){if(!i5(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=ah(l);continue}let c=l,f=c==s.body,d=f?oR(s):sR(c),p=0,g=0;if(t.top<d.top+yu(r,"top")?g=-(d.top-t.top+yu(i,"top")):t.bottom>d.bottom-yu(r,"bottom")&&(g=t.bottom-t.top>d.bottom-d.top?t.top+yu(i,"top")-d.top:t.bottom-d.bottom+yu(i,"bottom")),t.left<d.left+yu(r,"left")?p=-(d.left-t.left+yu(i,"left")):t.right>d.right-yu(r,"right")&&(p=t.right-d.right+yu(i,"right")),p||g)if(f)s.defaultView.scrollBy(p,g);else{let y=c.scrollLeft,A=c.scrollTop;g&&(c.scrollTop+=g),p&&(c.scrollLeft+=p);let E=c.scrollLeft-y,L=c.scrollTop-A;t={left:t.left-E,top:t.top-L,right:t.right-E,bottom:t.bottom-L}}let b=f?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(b))break;l=b=="absolute"?l.offsetParent:ah(l)}}function aR(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:MM(n.dom)}}function MM(n){let t=[],e=n.ownerDocument;for(let r=n;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=e);r=ah(r));return t}function lR({refDOM:n,refTop:t,stack:e}){let r=n?n.getBoundingClientRect().top:0;CM(e,r==0?0:r-t)}function CM(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 Od=null;function cR(n){if(n.setActive)return n.setActive();if(Od)return n.focus(Od);let t=MM(n);n.focus(Od==null?{get preventScroll(){return Od={preventScroll:!0},!0}}:void 0),Od||(Od=!1,CM(t,0))}function EM(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=ku(p).getClientRects();else continue;for(let y=0;y<b.length;y++){let A=b[y];if(A.top<=l&&A.bottom>=c){l=Math.max(A.bottom,l),c=Math.min(A.top,c);let E=A.left>t.left?A.left-t.left:A.right<t.left?t.left-A.right:0;if(E<r){e=p,r=E,i=E&&e.nodeType==3?{left:A.right<t.left?A.right:A.left,top:t.top}:t,p.nodeType==1&&E&&(s=g+(t.left>=(A.left+A.right)/2?1:0));continue}}else A.top>t.top&&!f&&A.left<=t.left&&A.right>=t.left&&(f=p,d={left:Math.max(A.left,Math.min(A.right,t.left)),top:A.top});!e&&(t.left>=A.right&&t.top>=A.top||t.left>=A.left&&t.top>=A.bottom)&&(s=g+1)}}return!e&&f&&(e=f,i=d,r=0),e&&e.nodeType==3?uR(e,i):!e||r&&e.nodeType==1?{node:n,offset:s}:EM(e,i)}function uR(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=nf(r,1);if(l.top!=l.bottom&&Q5(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 Q5(n,t){return n.left>=t.left-1&&n.left<=t.right+1&&n.top>=t.top-1&&n.top<=t.bottom+1}function fR(n,t){let e=n.parentNode;return e&&/^li$/i.test(e.nodeName)&&t.left<n.getBoundingClientRect().left?e:n}function dR(n,t,e){let{node:r,offset:i}=EM(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 hR(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 TM(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(Q5(t,d))return TM(l,t,d)}}if((s=(s+1)%r)==i)break}return n}function pR(n,t){let e=n.dom.ownerDocument,r,i=0,s=rR(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(!Q5(t,d)||(l=TM(n.dom,t,d),!l))return null}if(Zs)for(let d=l;r&&d;d=ah(d))d.draggable&&(r=void 0);if(l=fR(l,t),r){if(Ul&&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;Vp&&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=hR(n,r,i,t))}c==null&&(c=dR(n,l,t));let f=n.docView.nearestDesc(l,!0);return{pos:c,inside:f?f.posAtStart-f.border:-1}}function i5(n){return n.top<n.bottom||n.left<n.right}function nf(n,t){let e=n.getClientRects();if(e.length){let r=e[t<0?0:e.length-1];if(i5(r))return r}return Array.prototype.find.call(e,i5)||n.getBoundingClientRect()}const mR=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function NM(n,t,e){let{node:r,offset:i,atom:s}=n.docView.domFromPos(t,e<0?-1:1),l=Vp||Ul;if(r.nodeType==3)if(l&&(mR.test(r.nodeValue)||(e<0?!i:i==r.nodeValue.length))){let f=nf(ku(r,i,i),e);if(Ul&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=nf(ku(r,i-1,i-1),-1);if(d.top==f.top){let p=nf(ku(r,i,i+1),-1);if(p.top!=f.top)return Yh(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++,Yh(nf(ku(r,f,d),p),p<0)}if(!n.state.doc.resolve(t-(s||0)).parent.inlineContent){if(s==null&&i&&(e<0||i==Fl(r))){let f=r.childNodes[i-1];if(f.nodeType==1)return Wy(f.getBoundingClientRect(),!1)}if(s==null&&i<Fl(r)){let f=r.childNodes[i];if(f.nodeType==1)return Wy(f.getBoundingClientRect(),!0)}return Wy(r.getBoundingClientRect(),e>=0)}if(s==null&&i&&(e<0||i==Fl(r))){let f=r.childNodes[i-1],d=f.nodeType==3?ku(f,Fl(f)-(l?0:1)):f.nodeType==1&&(f.nodeName!="BR"||!f.nextSibling)?f:null;if(d)return Yh(nf(d,1),!1)}if(s==null&&i<Fl(r)){let f=r.childNodes[i];for(;f.pmViewDesc&&f.pmViewDesc.ignoreForCoords;)f=f.nextSibling;let d=f?f.nodeType==3?ku(f,0,l?0:1):f.nodeType==1?f:null:null;if(d)return Yh(nf(d,-1),!0)}return Yh(nf(r.nodeType==3?ku(r):r,-e),e>=0)}function Yh(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 Wy(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 _M(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 gR(n,t,e){let r=t.selection,i=e=="up"?r.$from:r.$to;return _M(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=NM(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=ku(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 yR=/[\u0590-\u08ac]/;function bR(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?!yR.test(r.parent.textContent)||!c.modify?e=="left"||e=="backward"?s:l:_M(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:A,focusOffset:E}=n.domSelectionRange(),L=A&&!y.contains(A.nodeType==1?A:A.parentNode)||f==A&&d==E;try{c.collapse(p,g),f&&(f!=p||d!=g)&&c.extend&&c.extend(f,d)}catch{}return b!=null&&(c.caretBidiLevel=b),L}):r.pos==r.start()||r.pos==r.end()}let a3=null,l3=null,c3=!1;function xR(n,t,e){return a3==t&&l3==e?c3:(a3=t,l3=e,c3=e=="up"||e=="down"?gR(n,t,e):bR(n,t,e))}const Hl=0,u3=1,qf=2,lc=3;class Wp{constructor(t,e,r,i){this.parent=t,this.children=e,this.dom=r,this.contentDOM=i,this.dirty=Hl,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>Ns(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 LM){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 DM&&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?Ns(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?Ns(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=Ns(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=Ns(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,A=0;y<this.children.length;y++){let E=this.children[y],L=A+E.size;if(s>A&&l<L)return E.setSelection(t-A-E.border,e-A-E.border,r,i);A=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((Ul||Zs)&&t==e){let{node:y,offset:A}=c;if(y.nodeType==3){if(g=!!(A&&y.nodeValue[A-1]==`
|
|
101
|
-
`),g&&A==y.nodeValue.length)for(let E=y,L;E;E=E.parentNode){if(L=E.nextSibling){L.nodeName=="BR"&&(c=f={node:L.parentNode,offset:Ns(L)+1});break}let R=E.pmViewDesc;if(R&&R.node&&R.node.isBlock)break}}else{let E=y.childNodes[A-1];g=E&&(E.nodeName=="BR"||E.contentEditable=="false")}}if(Ul&&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&&Zs)&&ad(c.node,c.offset,p.anchorNode,p.anchorOffset)&&ad(f.node,f.offset,p.focusNode,p.focusOffset))return;let b=!1;if((d.extend||t==e)&&!(g&&Ul)){d.collapse(c.node,c.offset);try{t!=e&&d.extend(f.node,f.offset),b=!0}catch{}}if(!b){if(t>e){let A=c;c=f,f=A}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?qf:u3,t==c&&e==f&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=lc:s.markDirty(t-c,e-c);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?qf:lc}r=l}this.dirty=qf}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let r=t==1?qf:u3;e.dirty<r&&(e.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class DM extends Wp{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==Hl&&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 vR extends Wp{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 mf extends Wp{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=dd.renderSpec(document,e.type.spec.toDOM(e,r),null,e.attrs)),new mf(t,e,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&lc||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=lc&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),this.dirty!=Hl){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Hl}}slice(t,e,r){let i=mf.create(this.parent,this.mark,!0,r),s=this.children,l=this.size;e<l&&(s=s5(s,e,l,r)),t>0&&(s=s5(s,0,t,r));for(let c=0;c<s.length;c++)s[c].parent=i;return i.children=s,i}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class gf extends Wp{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}=dd.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=PM(p,r,e),d?f=new wR(t,e,r,i,p,g||null,b,d):e.isText?new V0(t,e,r,i,p,b):new gf(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=()=>ke.empty}}return e}matchesNode(t,e,r){return this.dirty==Hl&&t.eq(this.node)&&Gg(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 kR(this,l&&l.node,t);CR(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?Mi.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==qf)&&(l&&this.protectLocalComposition(t,l),RM(this.contentDOM,this.children,t),lh&&ER(this.dom))}localCompositionInfo(t,e){let{from:r,to:i}=t.state.selection;if(!(t.state.selection instanceof On)||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=TR(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 vR(this,s,e,i);t.input.compositionNodes.push(l),this.children=s5(this.children,r,r+i.length,t,l)}update(t,e,r,i){return this.dirty==lc||!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=Hl}updateOuterDeco(t){if(Gg(t,this.outerDeco))return;let e=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=OM(this.dom,this.nodeDOM,o5(this.outerDeco,this.node,e),o5(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 f3(n,t,e,r,i){PM(r,t,n);let s=new gf(void 0,n,t,e,r,r,r);return s.contentDOM&&s.updateChildren(i,0),s}class V0 extends gf{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==lc||this.dirty!=Hl&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(e),(this.dirty!=Hl||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=Hl,!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 V0(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=lc)}get domAtom(){return!1}isText(t){return this.node.text==t}}class LM extends Wp{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==Hl&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class wR extends gf{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==lc)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 RM(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=d3(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(c,r);if(l instanceof mf){let f=r?r.previousSibling:n.lastChild;RM(l.contentDOM,l.children,e),r=f?f.nextSibling:n.firstChild}}for(;r;)r=d3(r),i=!0;i&&e.trackWrites==n&&(e.trackWrites=null)}const mp=function(n){n&&(this.nodeName=n)};mp.prototype=Object.create(null);const $f=[new mp];function o5(n,t,e){if(n.length==0)return $f;let r=e?$f[0]:new mp,i=[r];for(let s=0;s<n.length;s++){let l=n[s].type.attrs;if(l){l.nodeName&&i.push(r=new mp(l.nodeName));for(let c in l){let f=l[c];f!=null&&(e&&i.length==1&&i.push(r=new mp(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 OM(n,t,e,r){if(e==$f&&r==$f)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=$f[0]),i=f}SR(i,c||$f[0],l)}return i}function SR(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 PM(n,t,e){return OM(n,n,$f,o5(t,e,n.nodeType!=1))}function Gg(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 d3(n){let t=n.nextSibling;return n.parentNode.removeChild(n),t}class kR{constructor(t,e,r){this.lock=e,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=AR(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=Hl,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 mf&&p.dirty!=lc&&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=mf.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==lc&&l.dom==l.contentDOM&&(l.dirty=qf),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 gf){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!=lc&&Gg(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=qf,g.updateChildren(i,l+1),g.dirty=Hl),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)||!Gg(r,t.outerDeco)||!i.eq(t.innerDeco))return null;let c=gf.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=gf.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 DM(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 mf;)e=t,t=e.children[e.children.length-1];(!t||!(t instanceof V0)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Zs||Ds)&&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 LM(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 AR(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 mf)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 MR(n,t){return n.type.side-t.type.side}function CR(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(MR);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 A=s+b.nodeSize;if(b.isText){let L=A;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<A&&(f=b.cut(L-s),b=b.cut(0,L-s),A=L,y=-1)}else for(;l<i.length&&i[l].to<A;)l++;let E=b.isInline&&!b.isLeaf?c.filter(L=>!L.inline):c.slice();r(b,E,t.forChild(s,b),y),s=A}}function ER(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 TR(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 s5(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 tb(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(Y0(e)){for(f=l;i&&!i.node;)i=i.parent;let g=i.node;if(i&&g.isAtom&&En.isSelectable(g)&&i.parent&&!(g.isInline&&eR(e.focusNode,e.focusOffset,i.dom))){let b=i.posBefore;d=new En(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 A=e.getRangeAt(y);g=Math.min(g,n.docView.posFromDOM(A.startContainer,A.startOffset,1)),b=Math.max(b,n.docView.posFromDOM(A.endContainer,A.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=eb(n,p,c,g)}return d}function jM(n){return n.editable?n.hasFocus():zM(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Tu(n,t=!1){let e=n.state.selection;if(IM(n,e),!jM(n))return;let r=n.input.mouseDown;if(!t&&Ds&&r){let i=n.domSelectionRange(),s=n.domObserver.currentSelection;if(i.anchorNode&&s.anchorNode&&ad(i.anchorNode,i.anchorOffset,s.anchorNode,s.anchorOffset)&&r.delaySelUpdate()){n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)_R(n);else{let{anchor:i,head:s}=e,l,c;h3&&!(e instanceof On)&&(e.$from.parent.inlineContent||(l=p3(n,e.from)),!e.empty&&!e.$from.parent.inlineContent&&(c=p3(n,e.to))),n.docView.setSelection(i,s,n,t),h3&&(l&&m3(l),c&&m3(c)),e.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&NR(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}const h3=Zs||Ds&&kM<63;function p3(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(Zs&&i&&i.contentEditable=="false")return Xy(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Xy(i);if(s)return Xy(s)}}function Xy(n){return n.contentEditable="true",Zs&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function m3(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function NR(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(()=>{(!jM(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function _R(n){let t=n.domSelection();if(!t)return;let e=n.cursorWrapper.dom,r=e.nodeName=="IMG";r?t.collapse(e.parentNode,Ns(e)+1):t.collapse(e,0),!r&&!n.state.selection.visible&&za&&pf<=11&&(e.disabled=!0,e.disabled=!1)}function IM(n,t){if(t instanceof En){let e=n.docView.descAt(t.from);e!=n.lastSelectedViewDesc&&(g3(n),e&&e.selectNode(),n.lastSelectedViewDesc=e)}else g3(n)}function g3(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function eb(n,t,e,r){return n.someProp("createSelectionBetween",i=>i(n,t,e))||On.between(t,e,r)}function y3(n){return n.editable&&!n.hasFocus()?!1:zM(n)}function zM(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 DR(n){let t=n.docView.domFromPos(n.state.selection.anchor,0),e=n.domSelectionRange();return ad(t.node,t.offset,e.anchorNode,e.anchorOffset)}function a5(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&&ir.findFrom(s,t)}function rf(n,t){return n.dispatch(n.state.tr.setSelection(t).scrollIntoView()),!0}function b3(n,t,e){let r=n.state.selection;if(r instanceof On)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 rf(n,new On(r.$anchor,l))}else if(r.empty){if(n.endOfTextblock(t>0?"forward":"backward")){let i=a5(n.state,t);return i&&i instanceof En?rf(n,i):!1}else if(!(zl&&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?En.isSelectable(s)?rf(n,new En(t<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Vp?rf(n,new On(n.state.doc.resolve(t<0?c:c+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof En&&r.node.isInline)return rf(n,new On(t>0?r.$to:r.$from));{let i=a5(n.state,t);return i?rf(n,i):!1}}}function Kg(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function gp(n,t){let e=n.pmViewDesc;return e&&e.size==0&&(t<0||n.nextSibling||n.nodeName!="BR")}function Pd(n,t){return t<0?LR(n):RR(n)}function LR(n){let t=n.domSelectionRange(),e=t.focusNode,r=t.focusOffset;if(!e)return;let i,s,l=!1;for(Ul&&e.nodeType==1&&r<Kg(e)&&gp(e.childNodes[r],-1)&&(l=!0);;)if(r>0){if(e.nodeType!=1)break;{let c=e.childNodes[r-1];if(gp(c,-1))i=e,s=--r;else if(c.nodeType==3)e=c,r=e.nodeValue.length;else break}}else{if(BM(e))break;{let c=e.previousSibling;for(;c&&gp(c,-1);)i=e.parentNode,s=Ns(c),c=c.previousSibling;if(c)e=c,r=Kg(e);else{if(e=e.parentNode,e==n.dom)break;r=0}}}l?l5(n,e,r):i&&l5(n,i,s)}function RR(n){let t=n.domSelectionRange(),e=t.focusNode,r=t.focusOffset;if(!e)return;let i=Kg(e),s,l;for(;;)if(r<i){if(e.nodeType!=1)break;let c=e.childNodes[r];if(gp(c,1))s=e,l=++r;else break}else{if(BM(e))break;{let c=e.nextSibling;for(;c&&gp(c,1);)s=c.parentNode,l=Ns(c)+1,c=c.nextSibling;if(c)e=c,r=0,i=Kg(e);else{if(e=e.parentNode,e==n.dom)break;r=i=0}}}s&&l5(n,s,l)}function BM(n){let t=n.pmViewDesc;return t&&t.node&&t.node.isBlock}function OR(n,t){for(;n&&t==n.childNodes.length&&!Yp(n);)t=Ns(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 PR(n,t){for(;n&&!t&&!Yp(n);)t=Ns(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 l5(n,t,e){if(t.nodeType!=3){let s,l;(l=OR(t,e))?(t=l,e=0):(s=PR(t,e))&&(t=s,e=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Y0(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&&Tu(n)},50)}function x3(n,t){let e=n.state.doc.resolve(t);if(!(Ds||AM)&&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 v3(n,t,e){let r=n.state.selection;if(r instanceof On&&!r.empty||e.indexOf("s")>-1||zl&&e.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(t<0?"up":"down")){let l=a5(n.state,t);if(l&&l instanceof En)return rf(n,l)}if(!i.parent.inlineContent){let l=t<0?i:s,c=r instanceof pl?ir.near(l,t):ir.findFrom(l,t);return c?rf(n,c):!1}return!1}function w3(n,t){if(!(n.state.selection instanceof On))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 S3(n,t,e){n.domObserver.stop(),t.contentEditable=e,n.domObserver.start()}function jR(n){if(!Zs||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;S3(n,r,"true"),setTimeout(()=>S3(n,r,"false"),20)}return!1}function IR(n){let t="";return n.ctrlKey&&(t+="c"),n.metaKey&&(t+="m"),n.altKey&&(t+="a"),n.shiftKey&&(t+="s"),t}function zR(n,t){let e=t.keyCode,r=IR(t);if(e==8||zl&&e==72&&r=="c")return w3(n,-1)||Pd(n,-1);if(e==46&&!t.shiftKey||zl&&e==68&&r=="c")return w3(n,1)||Pd(n,1);if(e==13||e==27)return!0;if(e==37||zl&&e==66&&r=="c"){let i=e==37?x3(n,n.state.selection.from)=="ltr"?-1:1:-1;return b3(n,i,r)||Pd(n,i)}else if(e==39||zl&&e==70&&r=="c"){let i=e==39?x3(n,n.state.selection.from)=="ltr"?1:-1:1;return b3(n,i,r)||Pd(n,i)}else{if(e==38||zl&&e==80&&r=="c")return v3(n,-1,r)||Pd(n,-1);if(e==40||zl&&e==78&&r=="c")return jR(n)||v3(n,1,r)||Pd(n,1);if(r==(zl?"m":"c")&&(e==66||e==73||e==89||e==90))return!0}return!1}function nb(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")||dd.fromSchema(n.state.schema),c=YM(),f=c.createElement("div");f.appendChild(l.serializeFragment(r,{document:c}));let d=f.firstChild,p,g=0;for(;d&&d.nodeType==1&&(p=$M[d.nodeName.toLowerCase()]);){for(let y=p.length-1;y>=0;y--){let A=c.createElement(p[y]);for(;f.firstChild;)A.appendChild(f.firstChild);f.appendChild(A),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 FM(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 Je(ke.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,A=dd.fromSchema(y);l=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(E=>{let L=l.appendChild(document.createElement("p"));E&&L.appendChild(A.serializeNode(y.text(E,b)))})}}else n.someProp("transformPastedHTML",g=>{e=g(e,n)}),l=HR(e),Vp&&qR(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")||hp.fromSchema(n.state.schema)).parseSlice(l,{preserveWhitespace:!!(f||p),context:i,ruleFromNode(b){return b.nodeName=="BR"&&!b.nextSibling&&b.parentNode&&!BR.test(b.parentNode.nodeName)?{ignore:!0}:null}})),p)c=$R(k3(c,+p[1],+p[2]),p[4]);else if(c=Je.maxOpen(FR(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=k3(c,g,b)}return n.someProp("transformPasted",g=>{c=g(c,n,f)}),c}const BR=/^(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 FR(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&&HM(f,s,c,l[l.length-1],0))l[l.length-1]=d;else{l.length&&(l[l.length-1]=qM(l[l.length-1],s.length));let p=UM(c,f);l.push(p),i=i.matchType(p.type),s=f}}),l)return ke.from(l)}return n}function UM(n,t,e=0){for(let r=t.length-1;r>=e;r--)n=t[r].create(null,ke.from(n));return n}function HM(n,t,e,r,i){if(i<n.length&&i<t.length&&n[i]==t[i]){let s=HM(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(ke.from(UM(e,n,i+1))))}}function qM(n,t){if(t==0)return n;let e=n.content.replaceChild(n.childCount-1,qM(n.lastChild,t-1)),r=n.contentMatchAt(n.childCount).fillBefore(ke.empty,!0);return n.copy(e.append(r))}function c5(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=c5(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(ke.empty,!0))),n.replaceChild(t<0?0:n.childCount-1,l.copy(c))}function k3(n,t,e){return t<n.openStart&&(n=new Je(c5(n.content,-1,t,n.openStart,0,n.openEnd),t,n.openEnd)),e<n.openEnd&&(n=new Je(c5(n.content,1,e,n.openEnd,0,0),n.openStart,e)),n}const $M={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 YM(){return document.implementation.createHTMLDocument("title")}let Vh=null;function UR(n){let t=window.trustedTypes;if(!t)return n;if(!Vh){if(Vh=t.defaultPolicy)try{return Vh.createHTML(n)}catch{}Vh=t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})}return Vh.createHTML(n)}function HR(n){let t=/^(\s*<meta [^>]*>)*/.exec(n);t&&(n=n.slice(t[0].length));let e=YM(),r=e.body,i=/<([a-z][^>\s]+)/i.exec(n),s;if((s=i&&$M[i[1].toLowerCase()])&&(n=s.map(l=>"<"+l+">").join("")+n+s.map(l=>"</"+l+">").reverse().join("")),r.innerHTML=UR(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 qR(n){let t=n.querySelectorAll(Ds?"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 $R(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=ke.from(f.create(r[c+1],i)),s++,l++}return new Je(i,s,l)}const ca={},ua={},YR={touchstart:!0,touchmove:!0};class VR{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 WR(n){for(let t in ca){let e=ca[t];n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>{GR(n,r)&&!rb(n,r)&&(n.editable||!(r.type in ua))&&e(n,r)},YR[t]?{passive:!0}:void 0)}Zs&&n.dom.addEventListener("input",()=>null),u5(n)}function Cu(n,t){n.input.lastSelectionOrigin=t,n.input.lastSelectionTime=Date.now()}function XR(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 u5(n){n.someProp("handleDOMEvents",t=>{for(let e in t)n.input.eventHandlers[e]||n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>rb(n,r))})}function rb(n,t){return n.someProp("handleDOMEvents",e=>{let r=e[t.type];return r?r(n,t)||t.defaultPrevented:!1})}function GR(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 KR(n,t){!rb(n,t)&&ca[t.type]&&(n.editable||!(t.type in ua))&&ca[t.type](n,t)}ua.keydown=(n,t)=>{let e=t;if(n.input.shiftKey=e.keyCode==16||e.shiftKey,!GM(n)&&(n.input.lastKeyCode=e.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Mu&&Ds&&e.keyCode==13)))if(e.keyCode!=229&&n.domObserver.forceFlush(),lh&&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,Ff(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,e))||zR(n,e)?e.preventDefault():Cu(n,"key")};ua.keyup=(n,t)=>{t.keyCode==16&&(n.input.shiftKey=!1)};ua.keypress=(n,t)=>{let e=t;if(GM(n)||!e.charCode||e.ctrlKey&&!e.altKey||zl&&e.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,e))){e.preventDefault();return}let r=n.state.selection;if(!(r instanceof On)||!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 Xp(n){return{left:n.clientX,top:n.clientY}}function JR(n,t){let e=t.x-n.clientX,r=t.y-n.clientY;return e*e+r*r<100}function ib(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 Gp(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 ZR(n,t){if(t==-1)return!1;let e=n.state.doc.resolve(t),r=e.nodeAfter;return r&&r.isAtom&&En.isSelectable(r)?(Gp(n,new En(e)),!0):!1}function QR(n,t){if(t==-1)return!1;let e=n.state.selection,r,i;e instanceof En&&(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(En.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?(Gp(n,En.create(n.state.doc,i)),!0):!1}function tO(n,t,e,r,i){return ib(n,"handleClickOn",t,e,r)||n.someProp("handleClick",s=>s(n,t,r))||(i?QR(n,e):ZR(n,e))}function eO(n,t,e,r){return ib(n,"handleDoubleClickOn",t,e,r)||n.someProp("handleDoubleClick",i=>i(n,t,r))}function nO(n,t,e,r){return ib(n,"handleTripleClickOn",t,e,r)||n.someProp("handleTripleClick",i=>i(n,t,r))||rO(n,e,r)}function rO(n,t,e){if(e.button!=0)return!1;let r=VM(n,t,!0),i=n.state.doc;return r?(Gp(n,r),r instanceof On&&i.eq(n.state.doc)&&(n.input.mouseDown=new oO(n,r)),!0):!1}function VM(n,t,e){let r=n.state.doc;if(t==-1)return r.inlineContent?On.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 On.create(r,c+1,c+1+l.content.size);if(e&&En.isSelectable(l))return En.create(r,c)}return null}function ob(n){return Jg(n)}const WM=zl?"metaKey":"ctrlKey";ca.mousedown=(n,t)=>{let e=t;n.input.shiftKey=e.shiftKey;let r=ob(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&JR(e,n.input.lastClick)&&!e[WM]&&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(Xp(e));l&&(s=="singleClick"?n.input.mouseDown=new iO(n,l,e,!!r):(s=="doubleClick"?eO:nO)(n,l.pos,l.inside,e)?e.preventDefault():Cu(n,"pointer"))};class XM{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 iO extends XM{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[WM],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 En&&d.from<=l&&d.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ul&&!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()),Cu(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||Tu(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(Xp(t))),this.updateAllowDefault(t),this.allowDefault||!e?Cu(this.view,"pointer"):tO(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Zs&&this.mightDrag&&!this.mightDrag.node.isAtom||Ds&&!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)?(Gp(this.view,ir.near(this.view.state.doc.resolve(e.pos))),t.preventDefault()):Cu(this.view,"pointer")}move(t){this.updateAllowDefault(t),Cu(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 oO extends XM{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(),Cu(this.view,"pointer");let e=this.view.posAtCoords(Xp(t)),r=e&&VM(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];Gp(this.view,On.create(i,l,c))}}ca.touchstart=n=>{n.input.lastTouch=Date.now(),ob(n),Cu(n,"pointer")};ca.touchmove=n=>{n.input.lastTouch=Date.now(),Cu(n,"pointer")};ca.contextmenu=n=>ob(n);function GM(n,t){return n.composing?!0:Zs&&Math.abs(Date.now()-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const sO=Mu?5e3:-1;ua.compositionstart=ua.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:t}=n,e=t.selection.$to;if(t.selection instanceof On&&(t.storedMarks||!e.textOffset&&e.parentOffset&&e.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Ds&&AM&&aO(n)))n.markCursor=n.state.storedMarks||e.marks(),Jg(n,!0),n.markCursor=null;else if(Jg(n,!t.selection.empty),Ul&&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}KM(n,sO)};function aO(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"}ua.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++,KM(n,20))};function KM(n,t){clearTimeout(n.input.composingTimeout),t>-1&&(n.input.composingTimeout=setTimeout(()=>Jg(n),t))}function JM(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function lO(n){let t=n.domSelectionRange();if(!t.focusNode)return null;let e=QL(t.focusNode,t.focusOffset),r=tR(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 Jg(n,t=!1){if(!(Mu&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),JM(n),t||n.docView&&n.docView.dirty){let e=tb(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 cO(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 Rp=za&&pf<15||lh&&iR<604;ca.copy=ua.cut=(n,t)=>{let e=t,r=n.state.selection,i=e.type=="cut";if(r.empty)return;let s=Rp?null:e.clipboardData,l=r.content(),{dom:c,text:f}=nb(n,l);s?(e.preventDefault(),s.clearData(),s.setData("text/html",c.innerHTML),s.setData("text/plain",f)):cO(n,c),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function uO(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function fO(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?Op(n,r.value,null,i,t):Op(n,r.textContent,r.innerHTML,i,t)},50)}function Op(n,t,e,r,i){let s=FM(n,t,e,r,n.state.selection.$from);if(n.someProp("handlePaste",f=>f(n,i,s||Je.empty)))return!0;if(!s)return!1;let l=uO(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 ZM(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," "):""}ua.paste=(n,t)=>{let e=t;if(n.composing&&!Mu)return;let r=Rp?null:e.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Op(n,ZM(r),r.getData("text/html"),i,e)?e.preventDefault():fO(n,e)};class QM{constructor(t,e,r){this.slice=t,this.move=e,this.node=r}}const dO=zl?"altKey":"ctrlKey";function tC(n,t){let e;return n.someProp("dragCopies",r=>{e=e||r(t)}),e!=null?!e:!t[dO]}ca.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(Xp(e)),l;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof En?i.to-1:i.to))){if(r&&r.mightDrag)l=En.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=En.create(n.state.doc,g.posBefore))}}let c=(l||n.state.selection).content(),{dom:f,text:d,slice:p}=nb(n,c);(!e.dataTransfer.files.length||!Ds||kM>120)&&e.dataTransfer.clearData(),e.dataTransfer.setData(Rp?"Text":"text/html",f.innerHTML),e.dataTransfer.effectAllowed="copyMove",Rp||e.dataTransfer.setData("text/plain",d),n.dragging=new QM(p,tC(n,e),l)};ca.dragend=n=>{let t=n.dragging;window.setTimeout(()=>{n.dragging==t&&(n.dragging=null)},50)};ua.dragover=ua.dragenter=(n,t)=>t.preventDefault();ua.drop=(n,t)=>{try{hO(n,t,n.dragging)}finally{n.dragging=null}};function hO(n,t,e){if(!t.dataTransfer)return;let r=n.posAtCoords(Xp(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=FM(n,ZM(t.dataTransfer),Rp?null:t.dataTransfer.getData("text/html"),!1,i);let l=!!(e&&tC(n,t));if(n.someProp("handleDrop",y=>y(n,t,s||Je.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let c=s?eM(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&&En.isSelectable(s.content.firstChild)&&b.nodeAfter&&b.nodeAfter.sameMarkup(s.content.firstChild))f.setSelection(new En(b));else{let y=f.mapping.map(c);f.mapping.maps[f.mapping.maps.length-1].forEach((A,E,L,R)=>y=R),f.setSelection(eb(n,b,f.doc.resolve(y)))}n.focus(),n.dispatch(f.setMeta("uiEvent","drop"))}ca.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())&&Tu(n)},20))};ca.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)};ca.beforeinput=(n,t)=>{if(Mu&&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,Ff(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 ua)ca[n]=ua[n];function Pp(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 Zg{constructor(t,e){this.toDOM=t,this.spec=e||Jf,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 la(s-r,s-r,this)}valid(){return!0}eq(t){return this==t||t instanceof Zg&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Pp(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class yf{constructor(t,e){this.attrs=t,this.spec=e||Jf}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 la(s,l,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof yf&&Pp(this.attrs,t.attrs)&&Pp(this.spec,t.spec)}static is(t){return t.type instanceof yf}destroy(){}}class sb{constructor(t,e){this.attrs=t,this.spec=e||Jf}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 la(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 sb&&Pp(this.attrs,t.attrs)&&Pp(this.spec,t.spec)}destroy(){}}class la{constructor(t,e,r){this.from=t,this.to=e,this.type=r}copy(t,e){return new la(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 la(t,t,new Zg(e,r))}static inline(t,e,r,i){return new la(t,e,new yf(r,i))}static node(t,e,r,i){return new la(t,e,new sb(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof yf}get widget(){return this.type instanceof Zg}}const qd=[],Jf={};class hi{constructor(t,e){this.local=t.length?t:qd,this.children=e.length?e:qd}static create(t,e){return e.length?Qg(e,t,0,Jf):Js}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==Js||t.maps.length==0?this:this.mapInner(t,e,0,0,r||Jf)}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?pO(this.children,l||[],t,e,r,i,s):l?new hi(l.sort(Zf),qd):Js}add(t,e){return e.length?this==Js?hi.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=nC(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,Qg(p,c,d+1,Jf)),s+=3}});let l=eC(s?rC(e):e,-r);for(let c=0;c<l.length;c++)l[c].type.valid(t,l[c])||l.splice(c--,1);return new hi(l.length?this.local.concat(l).sort(Zf):this.local,i||this.children)}remove(t){return t.length==0||this==Js?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!=Js?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 hi(i,r):Js}forChild(t,e){if(this==Js)return this;if(e.isLeaf)return hi.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 yf){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 hi(i.sort(Zf),qd);return r?new af([c,r]):c}return r||Js}eq(t){if(this==t)return!0;if(!(t instanceof hi)||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 ab(this.localsInner(t))}localsInner(t){if(this==Js)return qd;if(t.inlineContent||!this.local.some(yf.is))return this.local;let e=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof yf||e.push(this.local[r]);return e}forEachSet(t){t(this)}}hi.empty=new hi([],[]);hi.removeOverlap=ab;const Js=hi.empty;class af{constructor(t){this.members=t}map(t,e){const r=this.members.map(i=>i.map(t,e,Jf));return af.from(r)}forChild(t,e){if(e.isLeaf)return hi.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(t,e);s!=Js&&(s instanceof af?r=r.concat(s.members):r.push(s))}return af.from(r)}eq(t){if(!(t instanceof af)||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?ab(r?e:e.sort(Zf)):qd}static from(t){switch(t.length){case 0:return Js;case 1:return t[0];default:return new af(t.every(e=>e instanceof hi)?t:t.reduce((e,r)=>e.concat(r instanceof hi?r:r.members),[]))}}forEachSet(t){for(let e=0;e<this.members.length;e++)this.members[e].forEachSet(t)}}function pO(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,A,E)=>{let L=E-A-(y-b);for(let R=0;R<c.length;R+=3){let q=c[R+1];if(q<0||b>q+p-g)continue;let H=c[R]+p-g;y>=H?c[R+1]=b<=H?-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:A,offset:E}=r.content.findIndex(g),L=r.maybeChild(A);if(L&&E==g&&E+L.nodeSize==y){let R=c[d+2].mapInner(e,L,p+1,n[d]+s+1,l);R!=Js?(c[d]=g,c[d+1]=y,c[d+2]=R):(c[d+1]=-2,f=!0)}else f=!0}if(f){let d=mO(c,n,t,e,i,s,l),p=Qg(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 hi(t.sort(Zf),c)}function eC(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 la(i.from+t,i.to+t,i.type))}return e}function mO(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 nC(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 rC(n){let t=[];for(let e=0;e<n.length;e++)n[e]!=null&&t.push(n[e]);return t}function Qg(n,t,e,r){let i=[],s=!1;t.forEach((c,f)=>{let d=nC(n,c,f+e);if(d){s=!0;let p=Qg(d,c,e+f+1,r);p!=Js&&i.push(f,f+c.nodeSize,p)}});let l=eC(s?rC(n):n,-e).sort(Zf);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 hi(l,i):Js}function Zf(n,t){return n.from-t.from||n.to-t.to}function ab(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),A3(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),A3(t,i,r.copy(s.from,r.to)));break}}}return t}function A3(n,t,e){for(;t<n.length&&Zf(e,n[t])>0;)t++;n.splice(t,0,e)}function Gy(n){let t=[];return n.someProp("decorations",e=>{let r=e(n.state);r&&r!=Js&&t.push(r)}),n.cursorWrapper&&t.push(hi.create(n.state.doc,[n.cursorWrapper.deco])),af.from(t)}const gO={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},yO=za&&pf<=11;class bO{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 xO{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new bO,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]);za&&pf<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Zs&&t.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),yO&&(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,gO)),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(y3(this.view)){if(this.suppressingSelectionUpdates)return Tu(this.view);if(za&&pf<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&ad(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=ah(s))e.add(s);for(let s=t.anchorNode;s;s=ah(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)&&y3(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||Ds&&(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(Ul&&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||SO(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&&Y0(r)&&(d=tb(t))&&d.eq(ir.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Tu(t),this.currentSelection.set(r),t.scrollToSelection()):(s>-1||i)&&(s>-1&&(t.docView.markDirty(s,l),vO(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,kO(t,f)),this.handleDOMChange(s,l,c,f),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||Tu(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(za&&pf<=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?Ns(i)+1:0,c=r.localPosFromDOM(t.target,l,-1),f=s&&s.parentNode==t.target?Ns(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 M3=new WeakMap,C3=!1;function vO(n){if(!M3.has(n)&&(M3.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Ul,C3)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."),C3=!0}}function E3(n,t){let e=t.startContainer,r=t.startOffset,i=t.endContainer,s=t.endOffset,l=n.domAtPos(n.state.selection.anchor);return ad(l.node,l.offset,i,s)&&([e,r,i,s]=[i,s,e,r]),{anchorNode:e,anchorOffset:r,focusNode:i,focusOffset:s}}function wO(n,t){if(t.getComposedRanges){let i=t.getComposedRanges(n.root)[0];if(i)return E3(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?E3(n,e):null}function SO(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 kO(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 AO(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}],Y0(d)||p.push({node:d.focusNode,offset:d.focusOffset})),Ds&&n.input.lastKeyCode===8)for(let R=l;R>s;R--){let q=i.childNodes[R-1],H=q.pmViewDesc;if(q.nodeName=="BR"&&!H){l=R;break}if(!H||H.size)break}let b=n.state.doc,y=n.someProp("domParser")||hp.fromSchema(n.state.schema),A=b.resolve(c),E=null,L=y.parse(i,{topNode:A.parent,topMatch:A.parent.contentMatchAt(A.index()),topOpen:!0,from:s,to:l,preserveWhitespace:A.parent.type.whitespace=="pre"?"full":!0,findPositions:p,ruleFromNode:MO(r),context:A});if(p&&p[0].pos!=null){let R=p[0].pos,q=p[1]&&p[1].pos;q==null&&(q=R),E={anchor:R+c,head:q+c}}return{doc:L,sel:E,from:c,to:f}}const MO=n=>t=>{let e=t.pmViewDesc;if(e)return e.parseRule(n);if(t.nodeName=="BR"&&t.parentNode){if(Zs&&/^(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||Zs&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null},CO=/^(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 EO(n,t,e,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,t<0){let wt=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,bt=tb(n,wt);if(bt&&!n.state.selection.eq(bt)){if(Ds&&Mu&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",Dt=>Dt(n,Ff(13,"Enter"))))return;let ot=n.state.tr.setSelection(bt);wt=="pointer"?ot.setMeta("pointer",!0):wt=="key"&&ot.scrollIntoView(),s&&ot.setMeta("composition",s),n.dispatch(ot)}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=AO(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 A=_O(g.content,d.doc.content,d.from,b,y);if(A&&n.input.domChangeCount++,(lh&&n.input.lastIOSEnter>Date.now()-225||Mu)&&i.some(wt=>wt.nodeType==1&&!CO.test(wt.nodeName))&&(!A||A.endA>=A.endB)&&n.someProp("handleKeyDown",wt=>wt(n,Ff(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!A)if(r&&f instanceof On&&!f.empty&&f.$head.sameParent(f.$anchor)&&!n.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))A={start:f.from,endA:f.to,endB:f.to};else{if(d.sel){let wt=T3(n,n.state.doc,d.sel);if(wt&&!wt.eq(n.state.selection)){let bt=n.state.tr.setSelection(wt);s&&bt.setMeta("composition",s),n.dispatch(bt)}}return}n.state.selection.from<n.state.selection.to&&A.start==A.endB&&n.state.selection instanceof On&&(A.start>n.state.selection.from&&A.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?A.start=n.state.selection.from:A.endA<n.state.selection.to&&A.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(A.endB+=n.state.selection.to-A.endA,A.endA=n.state.selection.to)),za&&pf<=11&&A.endB==A.start+1&&A.endA==A.start&&A.start>d.from&&d.doc.textBetween(A.start-d.from-1,A.start-d.from+1)==" "&&(A.start--,A.endA--,A.endB--);let E=d.doc.resolveNoCache(A.start-d.from),L=d.doc.resolveNoCache(A.endB-d.from),R=p.resolve(A.start),q=E.sameParent(L)&&E.parent.inlineContent&&R.end()>=A.endA;if((lh&&n.input.lastIOSEnter>Date.now()-225&&(!q||i.some(wt=>wt.nodeName=="DIV"||wt.nodeName=="P"))||!q&&E.pos<d.doc.content.size&&(!E.sameParent(L)||!E.parent.inlineContent)&&E.pos<L.pos&&!/\S/.test(d.doc.textBetween(E.pos,L.pos,"","")))&&n.someProp("handleKeyDown",wt=>wt(n,Ff(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>A.start&&NO(p,A.start,A.endA,E,L)&&n.someProp("handleKeyDown",wt=>wt(n,Ff(8,"Backspace")))){Mu&&Ds&&n.domObserver.suppressSelectionUpdates();return}Ds&&A.endB==A.start&&(n.input.lastChromeDelete=Date.now()),Mu&&!q&&E.start()!=L.start()&&L.parentOffset==0&&E.depth==L.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==A.endA&&(A.endB-=2,L=d.doc.resolveNoCache(A.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(wt){return wt(n,Ff(13,"Enter"))})},20));let H=A.start,$=A.endA,ht=wt=>{let bt=wt||n.state.tr.replace(H,$,d.doc.slice(A.start-d.from,A.endB-d.from));if(d.sel){let ot=T3(n,bt.doc,d.sel);ot&&!(Ds&&n.composing&&ot.empty&&(A.start!=A.endB||n.input.lastChromeDelete<Date.now()-100)&&(ot.head==H||ot.head==bt.mapping.map($)-1)||za&&ot.empty&&ot.head==H)&&bt.setSelection(ot)}return s&&bt.setMeta("composition",s),bt.scrollIntoView()},Mt;if(q)if(E.pos==L.pos){za&&pf<=11&&E.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Tu(n),20));let wt=ht(n.state.tr.delete(H,$)),bt=p.resolve(A.start).marksAcross(p.resolve(A.endA));bt&&wt.ensureMarks(bt),n.dispatch(wt)}else if(A.endA==A.endB&&(Mt=TO(E.parent.content.cut(E.parentOffset,L.parentOffset),R.parent.content.cut(R.parentOffset,A.endA-R.start())))){let wt=ht(n.state.tr);Mt.type=="add"?wt.addMark(H,$,Mt.mark):wt.removeMark(H,$,Mt.mark),n.dispatch(wt)}else if(E.parent.child(E.index()).isText&&E.index()==L.index()-(L.textOffset?0:1)){let wt=E.parent.textBetween(E.parentOffset,L.parentOffset),bt=()=>ht(n.state.tr.insertText(wt,H,$));n.someProp("handleTextInput",ot=>ot(n,H,$,wt,bt))||n.dispatch(bt())}else n.dispatch(ht());else n.dispatch(ht())}function T3(n,t,e){return Math.max(e.anchor,e.head)>t.content.size?null:eb(n,t.resolve(e.anchor),t.resolve(e.head))}function TO(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(ke.from(d).eq(n))return{mark:c,type:l}}function NO(n,t,e,r,i){if(e-t<=i.pos-r.pos||Ky(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(Ky(s,!0,!0));return!l.parent.isTextblock||l.pos>e||Ky(l,!0,!1)<e?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function Ky(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 _O(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 iC{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 VR,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(R3),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=D3(this),_3(this),this.nodeViews=L3(this),this.docView=f3(this.state.doc,N3(this),Gy(this),this.dom,this),this.domObserver=new xO(this,(r,i,s,l)=>EO(this,r,i,s,l)),this.domObserver.start(),WR(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&&u5(this);let e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(R3),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&&(JM(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=L3(this);LO(y,this.nodeViews)&&(this.nodeViews=y,s=!0)}(c||e.handleDOMEvents!=this._props.handleDOMEvents)&&u5(this),this.editable=D3(this),_3(this);let f=Gy(this),d=N3(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&&aR(this);if(l){this.domObserver.stop();let y=g&&(za||Ds)&&!this.composing&&!i.selection.empty&&!t.selection.empty&&DO(i.selection,t.selection);if(g){let E=Ds?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=lO(this)),(s||!this.docView.update(t.doc,d,f,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=f3(t.doc,d,f,this.dom,this)),E&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}let A=this.input.mouseDown;y||!(A&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&DR(this)&&A.delaySelUpdate())?Tu(this,y):(IM(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&&lR(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 En){let e=this.docView.domAfterPos(this.state.selection.from);e.nodeType==1&&s3(this,e.getBoundingClientRect(),t)}else s3(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 QM(t.slice,t.move,i<0?void 0:En.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(za){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&&cR(this.dom),Tu(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 pR(this,t)}coordsAtPos(t,e=1){return NM(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 xR(this,e||this.state,t)}pasteHTML(t,e){return Op(this,"",t,!1,e||new ClipboardEvent("paste"))}pasteText(t,e){return Op(this,t,null,!0,e||new ClipboardEvent("paste"))}serializeForClipboard(t){return nb(this,t)}destroy(){this.docView&&(XR(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Gy(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,JL())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return KR(this,t)}domSelectionRange(){let t=this.domSelection();return t?Zs&&this.root.nodeType===11&&nR(this.dom.ownerDocument)==this.dom&&wO(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}iC.prototype.dispatch=function(n){let t=this._props.dispatchTransaction;t?t.call(this,n):this.updateState(this.state.apply(n))};function N3(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"),[la.node(0,n.state.doc.content.size,t)]}function _3(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:la.widget(n.state.selection.from,t,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function D3(n){return!n.someProp("editable",t=>t(n.state)===!1)}function DO(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 L3(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 LO(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 R3(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 xf={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:"'"},t0={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},RO=typeof navigator<"u"&&/Mac/.test(navigator.platform),OO=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var _s=0;_s<10;_s++)xf[48+_s]=xf[96+_s]=String(_s);for(var _s=1;_s<=24;_s++)xf[_s+111]="F"+_s;for(var _s=65;_s<=90;_s++)xf[_s]=String.fromCharCode(_s+32),t0[_s]=String.fromCharCode(_s);for(var Jy in xf)t0.hasOwnProperty(Jy)||(t0[Jy]=xf[Jy]);function PO(n){var t=RO&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||OO&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",e=!t&&n.key||(n.shiftKey?t0:xf)[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 jO=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),IO=typeof navigator<"u"&&/Win/.test(navigator.platform);function zO(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))jO?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 BO(n){let t=Object.create(null);for(let e in n)t[zO(e)]=n[e];return t}function Zy(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 FO(n){return new Vi({props:{handleKeyDown:oC(n)}})}function oC(n){let t=BO(n);return function(e,r){let i=PO(r),s,l=t[Zy(i,r)];if(l&&l(e.state,e.dispatch,e))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=t[Zy(i,r,!1)];if(c&&c(e.state,e.dispatch,e))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(IO&&r.ctrlKey&&r.altKey)&&(s=xf[r.keyCode])&&s!=i){let c=t[Zy(s,r)];if(c&&c(e.state,e.dispatch,e))return!0}}return!1}}function W0(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 th=class sC{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,(...E)=>{const L=this.buildProps(d,e),R=y(...E)(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=sC.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:W0({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 UO=()=>({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),HO=(n=!0)=>({commands:t})=>t.setContent("",{emitUpdate:n}),qO=()=>({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 A=gh(y);if(c.type.isTextblock){const{defaultType:E}=g.parent.contentMatchAt(g.index());t.setNodeMarkup(y.start,E)}(A||A===0)&&t.lift(y,A)})}),!0},$O=n=>t=>n(t),YO=()=>({state:n,dispatch:t})=>bM(n,t),VO=(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 On(r.doc.resolve(Math.max(l-1,0)))),!0},WO=()=>({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 Io(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 XO=n=>({tr:t,state:e,dispatch:r})=>{const i=Io(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},GO=n=>({tr:t,dispatch:e})=>{const{from:r,to:i}=n;return e&&t.delete(r,i),!0},KO=n=>n.content?/^text(\*|\+)/.test(n.content):!1,O3=(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 KO(r)?e==="left"?n.start()-1:n.end()+1:n.pos},JO=(n,t,e)=>({from:O3(n,e,"left"),to:O3(t,e,"right")}),ZO=()=>({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}=JO(c,f,n.schema);e.deleteRange(d,p)}),e.selection.empty||e.setSelection(On.near(e.doc.resolve(e.selection.from))),e.scrollIntoView(),t(e)}return!0},QO=()=>({commands:n})=>n.keyboardShortcut("Enter"),t7=()=>({state:n,dispatch:t})=>jL(n,t);function lb(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function e0(n,t,e={strict:!0}){const r=Object.keys(t);return r.length?r.every(i=>e.strict?t[i]===n[i]:lb(t[i])?t[i].test(n[i]):t[i]===n[i]):!0}function aC(n,t,e={}){return n.find(r=>r.type===t&&e0(Object.fromEntries(Object.keys(e).map(i=>[i,r.attrs[i]])),e))}function P3(n,t,e={}){return!!aC(n,t,e)}function cb(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(!aC([...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&&P3([...n.parent.child(i-1).marks],t,e);)i-=1,s-=n.parent.child(i).nodeSize;for(;l<n.parent.childCount&&P3([...n.parent.child(l).marks],t,e);)c+=n.parent.child(l).nodeSize,l+=1;return{from:s,to:c}}function _u(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 e7=(n,t)=>({tr:e,state:r,dispatch:i})=>{const s=_u(n,r.schema),{doc:l,selection:c}=e,{$from:f,from:d,to:p}=c;if(i){const g=cb(f,s,t);if(g&&g.from<=d&&g.to>=p){const b=On.create(l,g.from,g.to);e.setSelection(b)}}return!0},n7=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 lC(n){return n instanceof On}function Yf(n=0,t=0,e=0){return Math.min(Math.max(n,t),e)}function f5(n,t=null){if(!t)return null;const e=ir.atStart(n),r=ir.atEnd(n);if(t==="start"||t===!0)return e;if(t==="end")return r;const i=e.from,s=r.to;return t==="all"?On.create(n,Yf(0,i,s),Yf(n.content.size,i,s)):On.create(n,Yf(t,i,s),Yf(t,i,s))}function j3(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function n0(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function r7(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const i7=(n=null,t={})=>({editor:e,view:r,tr:i,dispatch:s})=>{t={scrollIntoView:!0,...t};const l=()=>{(n0()||j3())&&r.dom.focus(),r7()&&!n0()&&!j3()&&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&&!lC(e.state.selection))return l(),!0;const c=f5(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},o7=(n,t)=>e=>n.every((r,i)=>t(r,{...e,index:i})),s7=(n,t)=>({tr:e,commands:r})=>r.insertContentAt({from:e.selection.from,to:e.selection.to},n,t),cC=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&&cC(r)}return n};function eg(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 cC(e)}function uC(n){return typeof n?.nodesBetween=="function"}function ch(n,t,e){if(uC(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 ke.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),ch("",t,e)}if(i){if(e.errorOnInvalidContent){let l=!1,c="";const f=new $A({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?hp.fromSchema(f).parseSlice(eg(n),e.parseOptions):hp.fromSchema(f).parse(eg(n),e.parseOptions),e.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=hp.fromSchema(t);return e.slice?s.parseSlice(eg(n),e.parseOptions).content:s.parse(eg(n),e.parseOptions)}return ch("",t,e)}function fC(n){return!("type"in n)}function dC(n,t,e){const r=n.steps.length-1;if(r<t)return;const i=n.steps[r];if(!(i instanceof Ao||i instanceof rs))return;const s=n.mapping.maps[r];let l=0;s.forEach((c,f,d,p)=>{l===0&&(l=p)}),n.setSelection(ir.near(n.doc.resolve(l),e))}const a7=(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{ch(t,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(L){f(L)}try{var l;c=ch(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 A=fC(c)?c.content:[c];if(A.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 E;if(b)Array.isArray(t)?E=t.map(L=>L.text||"").join(""):uC(t)?E=A.map(L=>{var R;return(R=L.text)!==null&&R!==void 0?R:""}).join(""):typeof t=="object"&&t&&t.text?E=t.text:E=t,r.insertText(E,p,g);else{E=ke.from(A);const L=r.doc.resolve(p),R=L.node(),q=L.parentOffset===0,H=R.isText||R.isTextblock,$=R.content.size>0;q&&H&&$&&y&&(p=Math.max(0,p-1)),r.replaceWith(p,g,A)}e.updateSelection&&dC(r,r.steps.length-1,-1),e.applyInputRules&&r.setMeta("applyInputRules",{from:p,text:E}),e.applyPasteRules&&r.setMeta("applyPasteRules",{from:p,text:E})}return!0};function hC(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 l7=(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=hC(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=ch(l,r.schema);b=d.createAndFill(g,y)}else b=d.createAndFill(g);return b?(e&&(t.insert(f.pos,b),c&&dC(t,t.steps.length-1,-1)),!0):!1},c7=()=>({state:n,dispatch:t})=>RL(n,t),u7=()=>({state:n,dispatch:t})=>OL(n,t),f7=()=>({state:n,dispatch:t})=>fM(n,t),d7=()=>({state:n,dispatch:t})=>mM(n,t),h7=()=>({state:n,dispatch:t,tr:e})=>{try{const r=H0(n.doc,n.selection.$from.pos,-1);return r==null?!1:(e.join(r,2),t&&t(e),!0)}catch{return!1}},p7=()=>({state:n,dispatch:t,tr:e})=>{try{const r=H0(n.doc,n.selection.$from.pos,1);return r==null?!1:(e.join(r,2),t&&t(e),!0)}catch{return!1}},m7=()=>({state:n,dispatch:t})=>DL(n,t),g7=()=>({state:n,dispatch:t})=>LL(n,t);function pC(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function y7(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))n0()||pC()?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 b7=n=>({editor:t,view:e,tr:r,dispatch:i})=>{const s=y7(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 vf(n,t,e={}){const{from:r,to:i,empty:s}=n.selection,l=t?Io(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=>e0(p.node.attrs,e,{strict:!1}));return s?!!d.length:d.reduce((p,g)=>p+g.to-g.from,0)>=f}const x7=(n,t={})=>({state:e,dispatch:r})=>vf(e,Io(n,e.schema),t)?PL(e,r):!1,v7=()=>({state:n,dispatch:t})=>xM(n,t),w7=n=>({state:t,dispatch:e})=>{const r=Io(n,t.schema);return WL(r)(t,e)},S7=()=>({state:n,dispatch:t})=>yM(n,t);function X0(n,t){return t.nodes[n]?"node":t.marks[n]?"mark":null}function I3(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 k7=(n,t)=>({tr:e,state:r,dispatch:i})=>{let s=null,l=null;const c=X0(typeof n=="string"?n:n.name,r.schema);if(!c)return!1;c==="node"&&(s=Io(n,r.schema)),c==="mark"&&(l=_u(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,I3(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(I3(b.attrs,t))))})})}),f},A7=()=>({tr:n,dispatch:t})=>(t&&n.scrollIntoView(),!0),M7=()=>({tr:n,dispatch:t})=>{if(t){const e=new pl(n.doc);n.setSelection(e)}return!0},C7=()=>({state:n,dispatch:t})=>hM(n,t),E7=()=>({state:n,dispatch:t})=>gM(n,t),T7=()=>({state:n,dispatch:t})=>BL(n,t),N7=()=>({state:n,dispatch:t})=>HL(n,t),_7=()=>({state:n,dispatch:t})=>UL(n,t);function d5(n,t,e={},r={}){return ch(n,t,{slice:!1,parseOptions:e,errorOnInvalidContent:r.errorOnInvalidContent})}const D7=(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=d5(n,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});if(l){const p=fC(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 mC(n,t){const e=_u(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 gC(n,t){const e=new sM(n);return t.forEach(r=>{r.steps.forEach(i=>{e.step(i)})}),e}function L7(n,t,e){const r=[];return n.nodesBetween(t.from,t.to,(i,s)=>{e(i)&&r.push({node:i,pos:s})}),r}function R7(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 G0(n){return t=>R7(t.$from,n)}function hn(n,t,e){return n.config[t]===void 0&&n.parent?hn(n.parent,t,e):typeof n.config[t]=="function"?n.config[t].bind({...e,parent:n.parent?hn(n.parent,t,e):null}):n.config[t]}function ub(n){return n.map(t=>{const e=hn(t,"addExtensions",{name:t.name,options:t.options,storage:t.storage});return e?[t,...ub(e())]:t}).flat(10)}function fb(n,t){const e=dd.fromSchema(t).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(e),r.innerHTML}function yC(n){return typeof n=="function"}function ti(n,t=void 0,...e){return yC(n)?t?n.bind(t)(...e):n(...e):n}function O7(n={}){return Object.keys(n).length===0&&n.constructor===Object}function uh(n){return{baseExtensions:n.filter(t=>t.type==="extension"),nodeExtensions:n.filter(t=>t.type==="node"),markExtensions:n.filter(t=>t.type==="mark")}}function bC(n){const t=[],{nodeExtensions:e,markExtensions:r}=uh(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=hn(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(([A,E])=>{t.push({type:y,name:A,attribute:{...s,...E}})})})})}),i.forEach(d=>{const p=hn(d,"addAttributes",{name:d.name,options:d.options,storage:d.storage});if(!p)return;const g=p();Object.entries(g).forEach(([b,y])=>{const A={...s,...y};typeof A?.default=="function"&&(A.default=A.default()),A?.isRequired&&A?.default===void 0&&delete A.default,t.push({type:d.name,name:b,attribute:A})})}),t}function P7(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 z3(n){const t=[],e=P7(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 To(...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([...z3(r[i]),...z3(s)]);r[i]=Array.from(l.entries()).map(([c,f])=>`${c}: ${f}`).join("; ")}else r[i]=s}),r},{})}function jp(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)=>To(e,r),{})}function j7(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function B3(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):j7(e.getAttribute(l.name));return c==null?s:{...s,[l.name]:c}},{});return{...r,...i}}}}function F3(n){return Object.fromEntries(Object.entries(n).filter(([t,e])=>t==="attrs"&&O7(e)?!1:e!=null))}function U3(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 I7(n,t){var e;const r=bC(n),{nodeExtensions:i,markExtensions:s}=uh(n),l=(e=i.find(d=>hn(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=F3({...n.reduce((L,R)=>{const q=hn(R,"extendNodeSchema",g);return{...L,...q?q(d):{}}},{}),content:ti(hn(d,"content",g)),marks:ti(hn(d,"marks",g)),group:ti(hn(d,"group",g)),inline:ti(hn(d,"inline",g)),atom:ti(hn(d,"atom",g)),selectable:ti(hn(d,"selectable",g)),draggable:ti(hn(d,"draggable",g)),code:ti(hn(d,"code",g)),whitespace:ti(hn(d,"whitespace",g)),linebreakReplacement:ti(hn(d,"linebreakReplacement",g)),defining:ti(hn(d,"defining",g)),isolating:ti(hn(d,"isolating",g)),attrs:Object.fromEntries(p.map(U3))}),y=ti(hn(d,"parseHTML",g));y&&(b.parseDOM=y.map(L=>B3(L,p)));const A=hn(d,"renderHTML",g);A&&(b.toDOM=L=>A({node:L,HTMLAttributes:jp(L,p)}));const E=hn(d,"renderText",g);return E&&(b.toText=E),[d.name,b]})),f=Object.fromEntries(s.map(d=>{const p=r.filter(E=>E.type===d.name),g={name:d.name,options:d.options,storage:d.storage,editor:t},b=F3({...n.reduce((E,L)=>{const R=hn(L,"extendMarkSchema",g);return{...E,...R?R(d):{}}},{}),inclusive:ti(hn(d,"inclusive",g)),excludes:ti(hn(d,"excludes",g)),group:ti(hn(d,"group",g)),spanning:ti(hn(d,"spanning",g)),code:ti(hn(d,"code",g)),attrs:Object.fromEntries(p.map(U3))}),y=ti(hn(d,"parseHTML",g));y&&(b.parseDOM=y.map(E=>B3(E,p)));const A=hn(d,"renderHTML",g);return A&&(b.toDOM=E=>A({mark:E,HTMLAttributes:jp(E,p)})),[d.name,b]}));return new $A({topNode:l,nodes:c,marks:f})}function z7(n){const t=n.filter((e,r)=>n.indexOf(e)!==r);return Array.from(new Set(t))}function yp(n){return n.sort((e,r)=>{const i=hn(e,"priority")||100,s=hn(r,"priority")||100;return i>s?-1:i<s?1:0})}function xC(n){const t=yp(ub(n)),e=z7(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 vC(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 B7(n,t){return vC(n,{from:0,to:n.content.size},t)}function wC(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,t])=>t.spec.toText).map(([t,e])=>[t,e.spec.toText]))}function F7(n,t){const e=Io(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 SC(n,t){const e=X0(typeof t=="string"?t:t.name,n.schema);return e==="node"?F7(n,t):e==="mark"?mC(n,t):{}}function U7(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 H7(n){const t=U7(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 db(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}})})}),H7(r)}function hb(n,t,e){const r=[];return n===t?e.resolve(n).marks().forEach(i=>{const s=cb(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 q7=(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 jd(n,t){return t.nodes[n]||t.marks[n]||null}function Ag(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 $7=(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 h5(n,t,e={}){const{empty:r,ranges:i}=n.selection,s=t?_u(t,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(p=>s?s.name===p.type.name:!0).find(p=>e0(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,(A,E)=>{if(s&&A.inlineContent&&!A.type.allowsMarkType(s))return!1;if(!A.isText&&!A.marks.length)return;const L=Math.max(b,E),R=Math.min(y,E+A.nodeSize),q=R-L;l+=q,c.push(...A.marks.map(H=>({mark:H,from:L,to:R})))})}),l===0)return!1;const f=c.filter(p=>s?s.name===p.mark.type.name:!0).filter(p=>e0(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 Y7(n,t,e={}){if(!t)return vf(n,null,e)||h5(n,null,e);const r=X0(t,n.schema);return r==="node"?vf(n,t,e):r==="mark"?h5(n,t,e):!1}const V7=(n,t)=>{const{$from:e,$to:r,$anchor:i}=n.selection;if(t){const s=G0(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)},W7=n=>{const{$from:t,$to:e}=n.selection;return!(t.parentOffset>0||t.pos!==e.pos)};function H3(n,t){return Array.isArray(t)?t.some(e=>(typeof e=="string"?e:e.name)===n.name):t}function Qy(n,t){const{nodeExtensions:e}=uh(t),r=e.find(s=>s.name===n);if(!r)return!1;const i=ti(hn(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof i!="string"?!1:i.split(" ").includes("list")}function K0(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&&(K0(s,{ignoreWhitespace:e,checkChildren:t})||(i=!1))}),i}return!1}function kC(n){return n instanceof En}var AC=class MC{constructor(t){this.position=t}static fromJSON(t){return new MC(t.position)}toJSON(){return{position:this.position}}};function X7(n,t){const e=t.mapping.mapResult(n.position);return{position:new AC(e.pos),mapResult:e}}function G7(n){return new AC(n)}function K7(n,t,e){const{selection:r}=t;let i=null;if(lC(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),A=!!e.isInSet(p.marks)||!p.marks.some(E=>E.type.excludes(e));d=y&&A}return!d}),d})}const J7=(n,t={})=>({tr:e,state:r,dispatch:i})=>{const{selection:s}=e,{empty:l,ranges:c}=s,f=_u(n,r.schema);if(i)if(l){const d=mC(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 A=Math.max(y,p),E=Math.min(y+b.nodeSize,g);b.marks.find(L=>L.type===f)?b.marks.forEach(L=>{f===L.type&&e.addMark(A,E,f.create({...L.attrs,...t}))}):e.addMark(A,E,f.create(t))})});return K7(r,e,f)},Z7=(n,t)=>({tr:e})=>(e.setMeta(n,t),!0),Q7=(n,t={})=>({state:e,dispatch:r,chain:i})=>{const s=Io(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})=>r3(s,{...l,...t})(e)?!0:c.clearNodes()).command(({state:c})=>r3(s,{...l,...t})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},tP=n=>({tr:t,dispatch:e})=>{if(e){const{doc:r}=t,i=Yf(n,0,r.content.size),s=En.create(r,i);t.setSelection(s)}return!0},eP=(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},nP=n=>({tr:t,dispatch:e})=>{if(e){const{doc:r}=t,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,l=On.atStart(r).from,c=On.atEnd(r).to,f=Yf(i,l,c),d=Yf(s,l,c),p=On.create(r,f,d);t.setSelection(p)}return!0},rP=n=>({state:t,dispatch:e})=>{const r=Io(n,t.schema);return KL(r)(t,e)};function q3(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 iP=({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=Ag(d,c.node().type.name,c.node().attrs);if(s instanceof En&&s.node.isBlock)return!c.parentOffset||!Eu(l,c.pos)?!1:(r&&(n&&q3(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:hC(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=g&&b?[{type:b,attrs:p}]:void 0,A=Eu(t.doc,t.mapping.map(c.pos),1,y);if(!y&&!A&&Eu(t.doc,t.mapping.map(c.pos),1,b?[{type:b}]:void 0)&&(A=!0,y=b?[{type:b,attrs:p}]:void 0),r){if(A&&(s instanceof On&&t.deleteSelection(),t.split(t.mapping.map(c.pos),1,y),b&&!g&&!c.parentOffset&&c.parent.type!==b)){const E=t.mapping.map(c.before()),L=t.doc.resolve(E);c.node(-1).canReplaceWith(L.index(),L.index()+1,b)&&t.setNodeMarkup(t.mapping.map(c.before()),b)}n&&q3(e,i.extensionManager.splittableMarks),t.scrollIntoView()}return A},oP=(n,t={})=>({tr:e,state:r,dispatch:i,editor:s})=>{const l=Io(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=ke.empty;const q=c.index(-1)?1:c.index(-2)?2:3;for(let bt=c.depth-q;bt>=c.depth-3;bt-=1)R=ke.from(c.node(bt).copy(R));const H=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,$={...Ag(g,c.node().type.name,c.node().attrs),...t},ht=((b=l.contentMatch.defaultType)===null||b===void 0?void 0:b.createAndFill($))||void 0;R=R.append(ke.from(l.createAndFill(null,ht)||void 0));const Mt=c.before(c.depth-(q-1));e.replace(Mt,c.after(-H),new Je(R,4-q,0));let wt=-1;e.doc.nodesBetween(Mt,e.doc.content.size,(bt,ot)=>{if(wt>-1)return!1;bt.isTextblock&&bt.content.size===0&&(wt=ot+1)}),wt>-1&&e.setSelection(On.near(e.doc.resolve(wt))),e.scrollIntoView()}return!0}const y=f.pos===c.end()?p.contentMatchAt(0).defaultType:null,A={...Ag(g,p.type.name,p.attrs),...t},E={...Ag(g,c.node().type.name,c.node().attrs),...t};e.delete(c.pos,f.pos);const L=y?[{type:l,attrs:A},{type:y,attrs:E}]:[{type:l,attrs:A}];if(!Eu(e.doc,c.pos,2))return!1;if(i){const{selection:R,storedMarks:q}=r,{splittableMarks:H}=s.extensionManager,$=q||R.$to.parentOffset&&R.$from.marks();if(e.split(c.pos,2,L).scrollIntoView(),!$||!i)return!0;const ht=$.filter(Mt=>H.includes(Mt.type.name));e.ensureMarks(ht)}return!0};function $3(n){return!n||n==="1"?null:n}function CC(n,t){return $3(n)===$3(t)}const t2=(n,t)=>{const e=G0(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&&wf(n.doc,e.pos))||!CC(e.node.attrs.type,i?.attrs.type)||n.join(e.pos),!0},e2=(n,t)=>{const e=G0(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&&wf(n.doc,r))||!CC(e.node.attrs.type,i?.attrs.type)||n.join(r),!0};function sP(n){const t=n.doc,e=t.firstChild;if(!e)return null;const r=t.resolve(1),i=t.resolve(e.nodeSize-1);return On.between(r,i)}const aP=(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=Io(n,l.schema),A=Io(t,l.schema),{selection:E,storedMarks:L}=l,{$from:R,$to:q}=E,H=R.blockRange(q),$=L||E.$to.parentOffset&&E.$from.marks();if(!H)return!1;const ht=G0(G=>Qy(G.type.name,g))(E),Mt=E.from===0&&E.to===l.doc.content.size,wt=l.doc.content.content,bt=wt.length===1?wt[0]:null,ot=Mt&&bt&&Qy(bt.type.name,g)?{node:bt,pos:0}:null,Dt=ht??ot,Q=!!ht&&H.depth>=1&&H.depth-ht.depth<=1,at=!!ot;if((Q||at)&&Dt){if(Dt.node.type===y)return Mt&&at?f().command(({tr:G,dispatch:vt})=>{const Tt=sP(G);return Tt?(G.setSelection(Tt),vt&&vt(G),!0):!1}).liftListItem(A).run():d.liftListItem(A);if(Qy(Dt.node.type.name,g)&&y.validContent(Dt.node.content))return f().command(()=>(s.setNodeMarkup(Dt.pos,y),!0)).command(()=>t2(s,y)).command(()=>e2(s,y)).run()}return!e||!$||!c?f().command(()=>p().wrapInList(y,r)?!0:d.clearNodes()).wrapInList(y,r).command(()=>t2(s,y)).command(()=>e2(s,y)).run():f().command(()=>{const G=p().wrapInList(y,r),vt=$.filter(Tt=>b.includes(Tt.type.name));return s.ensureMarks(vt),G?!0:d.clearNodes()}).wrapInList(y,r).command(()=>t2(s,y)).command(()=>e2(s,y)).run()},lP=(n,t={},e={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=e,l=_u(n,r.schema);return h5(r,l,t)?i.unsetMark(l,{extendEmptyMarkRange:s}):i.setMark(l,t)},cP=(n,t,e={})=>({state:r,commands:i})=>{const s=Io(n,r.schema),l=Io(t,r.schema),c=vf(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})},uP=(n,t={})=>({state:e,commands:r})=>{const i=Io(n,e.schema);return vf(e,i,t)?r.lift(i):r.wrapIn(i,t)},fP=()=>({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},dP=(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},hP=(n,t={})=>({tr:e,state:r,dispatch:i})=>{const{extendEmptyMarkRange:s=!1}=t,{selection:l}=e,c=_u(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 A=cb(f,c,(g=f.marks().find(E=>E.type===c))===null||g===void 0?void 0:g.attrs);A&&(b=A.from,y=A.to),e.removeMark(b,y,c)}else p.forEach(b=>{e.removeMark(b.$from.pos,b.$to.pos,c)});return e.removeStoredMark(c),!0},pP=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},mP=(n,t={})=>({tr:e,state:r,dispatch:i})=>{let s=null,l=null;const c=X0(typeof n=="string"?n:n.name,r.schema);if(!c)return!1;c==="node"&&(s=Io(n,r.schema)),c==="mark"&&(l=_u(n,r.schema));let f=!1;return e.selection.ranges.forEach(d=>{const p=d.$from.pos,g=d.$to.pos;let b,y,A,E;e.selection.empty?r.doc.nodesBetween(p,g,(L,R)=>{s&&s===L.type&&(f=!0,A=Math.max(R,p),E=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,A=Math.max(R,p),E=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(q=>{if(l===q.type&&(f=!0,i)){const H=Math.max(R,p),$=Math.min(R+L.nodeSize,g);e.addMark(H,$,l.create({...q.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(A,E,l.create({...L.attrs,...t}))}))}),f},$d=new zo("__tiptap_decorations__"),gP=n=>({tr:t,dispatch:e})=>(e&&t.setMeta($d,{type:"force",name:n}),!0),yP=(n,t={})=>({state:e,dispatch:r})=>{const i=Io(n,e.schema);return qL(i,t)(e,r)},bP=(n,t={})=>({state:e,dispatch:r})=>{const i=Io(n,e.schema);return $L(i,t)(e,r)};var xP=PD({blur:()=>UO,clearContent:()=>HO,clearNodes:()=>qO,command:()=>$O,createParagraphNear:()=>YO,cut:()=>VO,deleteCurrentNode:()=>WO,deleteNode:()=>XO,deleteRange:()=>GO,deleteSelection:()=>ZO,enter:()=>QO,exitCode:()=>t7,extendMarkRange:()=>e7,first:()=>n7,focus:()=>i7,forEach:()=>o7,insertContent:()=>s7,insertContentAt:()=>a7,insertDefaultBlock:()=>l7,joinBackward:()=>f7,joinDown:()=>u7,joinForward:()=>d7,joinItemBackward:()=>h7,joinItemForward:()=>p7,joinTextblockBackward:()=>m7,joinTextblockForward:()=>g7,joinUp:()=>c7,keyboardShortcut:()=>b7,lift:()=>x7,liftEmptyBlock:()=>v7,liftListItem:()=>w7,newlineInCode:()=>S7,resetAttributes:()=>k7,scrollIntoView:()=>A7,selectAll:()=>M7,selectNodeBackward:()=>C7,selectNodeForward:()=>E7,selectParentNode:()=>T7,selectTextblockEnd:()=>N7,selectTextblockStart:()=>_7,setContent:()=>D7,setMark:()=>J7,setMeta:()=>Z7,setNode:()=>Q7,setNodeSelection:()=>tP,setTextDirection:()=>eP,setTextSelection:()=>nP,sinkListItem:()=>rP,splitBlock:()=>iP,splitListItem:()=>oP,toggleList:()=>aP,toggleMark:()=>lP,toggleNode:()=>cP,toggleWrap:()=>uP,undoInputRule:()=>fP,unsetAllMarks:()=>dP,unsetMark:()=>hP,unsetTextDirection:()=>pP,updateAttributes:()=>mP,updateDecorations:()=>gP,wrapIn:()=>yP,wrapInList:()=>bP});const Wh=new WeakMap;function vP(n,t){var e;Wh.set(n,((e=Wh.get(n))!==null&&e!==void 0?e:0)+1);try{return t()}finally{var r;const i=((r=Wh.get(n))!==null&&r!==void 0?r:1)-1;i>0?Wh.set(n,i):Wh.delete(n)}}var wP=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 SP(n){return n.kind==="widget"}function EC(n,t){const e=[],r=new Set;for(const i of n)i.kind==="widget"&&SP(i)&&r.add(i.key),e.push(i.toPMDecoration(t));return{decorations:e,widgetKeys:r}}function kP(n,t,e){const{decorations:r,widgetKeys:i}=EC(t,e);return{set:hi.create(n,r),widgetKeys:i}}function TC({position:n,from:t,to:e,docSize:r}){return n<t?!1:n<e?!0:n===e&&e===r}function AP({decorations:n,from:t,to:e,docSize:r,extensionName:i,warnedExtensions:s}){return n.filter(l=>TC({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 MP(n){var t;const e=(t=n.spec)===null||t===void 0?void 0:t.key;return typeof e=="string"?e:void 0}function NC(n){return n.jsonID==="attr"}function CP(n){let t=!1;if(n.getMap().forEach(()=>{t=!0}),t||NC(n))return!0;const e=n;return typeof e.from=="number"&&typeof e.to=="number"}function EP(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 TP(n,t){if(n.steps.some(s=>!CP(s)))return{type:"full"};const e=db(n).map(({newRange:s})=>s);n.steps.forEach((s,l)=>{if(!NC(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=EP(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 _C(n,t,e,r){return n.map(t,e,{onRemove:i=>{const s=i?.key;typeof s=="string"&&r.delete(s)}})}function NP(n,t,e){var r,i;const s=(r=t.decorationSetsByExtension[n])!==null&&r!==void 0?r:hi.empty,l=new Set((i=t.widgetKeysByExtension[n])!==null&&i!==void 0?i:[]);return{set:_C(s,e.mapping,e.doc,l),widgetKeys:l}}function Y3(n,t){const e=Object.values(t).flatMap(r=>r.find());return hi.create(n,e)}function V3(n){const t=new Set;for(const e of Object.values(n))for(const r of e)t.add(r);return t}function _P(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 DP(n,t,e){return e?!0:n.update==="manual"?!1:n.shouldUpdate?n.shouldUpdate(t):t.tr.docChanged}const LP=new Set;var RP=class{constructor(n){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:t})=>{const e=$d.getState(t);e&&this.warnDuplicateWidgetKeys(e)},this.editor=n.editor,this.entries=this.resolveEntries(n.entries),this.entries.forEach(({name:t,spec:e})=>_P(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=$d.getState(this.editor.state))===null||t===void 0?void 0:t.widgetKeys)!==null&&n!==void 0?n:LP}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 Vi({key:$d,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:V3(s)};return this.warnDuplicateWidgetKeys(l),l},apply:(e,r,i,s)=>{const l=e.getMeta($d),c=l?.type==="force"&&!l.name,f=l?.type==="force"?l.name:void 0,d={},p={},g=new Set;return vP(n,()=>{for(const{name:b,spec:y}of t){const A=c||f===b;if(DP(y,{editor:n,tr:e,oldState:i,newState:s},A))if(y.update==="changedRanges"&&e.docChanged&&!A){const E=this.applyChangedRangesRecompute(b,y,r,e,s);d[b]=E.set,p[b]=E.widgetKeys,g.add(b)}else{const{set:E,widgetKeys:L}=this.buildFullSet(b,y,s);d[b]=E,p[b]=L,g.add(b)}else{const E=NP(b,r,e);d[b]=E.set,p[b]=E.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:V3(p)}}},props:{decorations(e){var r,i;return(r=(i=$d.getState(e))===null||i===void 0?void 0:i.mergedDecorationSet)!==null&&r!==void 0?r:hi.empty}}})}applyChangedRangesRecompute(n,t,e,r,i){const s=TP(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:hi.empty,d=new Set((c=e.widgetKeysByExtension[n])!==null&&c!==void 0?c:[]);let p=_C(f,r.mapping,r.doc,d);const g=i.doc.content.size;for(const{from:b,to:y}of s){const A=p.find(b,y).filter(R=>TC({position:R.from,from:b,to:y,docSize:g}));for(const R of A){const q=MP(R);q&&d.delete(q)}p=p.remove(A);const{decorations:E,widgetKeys:L}=EC(AP({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,E);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 kP(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]]:Y3(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):Y3(e.doc,r)}};function OP(n,t){const{selection:e}=n,{$from:r}=e;if(e instanceof En){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 PP(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 jP(n){return typeof n=="number"}function IP(n){return Object.prototype.toString.call(n).slice(8,-1)}function ng(n){return IP(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function W3(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:A}=b;s=`${s}${p}
|
|
109
|
-
`;const E=[A];for(l+=1;l<r.length;){var f;const H=r[l];if(H.trim()===""){var d;const $=r.slice(l+1).findIndex(ht=>ht.trim()!=="");if($===-1)break;if((((d=r[l+1+$].match(/^(\s*)/))===null||d===void 0||(d=d[1])===null||d===void 0?void 0:d.length)||0)>y){E.push(H),s=`${s}${H}
|
|
110
|
-
`,l+=1;continue}else break}if((((f=H.match(/^(\s*)/))===null||f===void 0||(f=f[1])===null||f===void 0?void 0:f.length)||0)>y)E.push(H),s=`${s}${H}
|
|
111
|
-
`,l+=1;else break}let L;const R=E.slice(1);if(R.length>0){const H=R.map($=>$.slice(y+c)).join(`
|
|
112
|
-
`);H.trim()&&(t.customNestedParser?L=t.customNestedParser(H):L=e.blockTokens(H))}const q=t.createToken(b,L);i.push(q)}if(i.length!==0)return{items:i,raw:s}}function DC(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 A=L=>t.indent(L),E=y.split(`
|
|
113
|
-
`).map(L=>A(L||"")).join(`
|
|
114
|
-
`);f+=d.type==="paragraph"?`
|
|
115
|
-
|
|
116
|
-
${E}`:`
|
|
117
|
-
${E}`}}),f}function LC(n,t){const e={...n};return ng(n)&&ng(t)&&Object.keys(t).forEach(r=>{ng(t[r])&&ng(n[r])?e[r]=LC(n[r],t[r]):e[r]=t[r]}),e}function zP(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 J0=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 BP=(n,t)=>{if(lb(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 rg(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=$7(d)+s;return l.forEach(b=>{if(p)return;const y=BP(g,b.find);if(!y)return;const A=y[0].length-s.length;if(A>0){const ht=d.parentOffset-A;if(ht<0||d.parent.textBetween(ht,d.parentOffset)!==y[0].slice(0,A))return}const E=f.state.tr,L=W0({state:f.state,transaction:E}),R={from:r-(y[0].length-s.length),to:i},{commands:q,chain:H,can:$}=new th({editor:e,state:L});b.handler({state:L,range:R,match:y,commands:q,chain:H,can:$})===null||!E.steps.length||(b.undoable&&E.setMeta(c,{transform:E,from:r,to:i,text:s}),f.dispatch(E),p=!0)}),p}function FP(n){const{editor:t,rules:e}=n,r=new Vi({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=fb(ke.from(d),l.schema);const{from:p}=f,g=p+d.length;rg({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 rg({editor:t,from:s,to:l,text:c,rules:e,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&rg({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?rg({editor:t,from:l.pos,to:l.pos,text:`
|
|
118
|
-
`,rules:e,plugin:r}):!1}},isInputRules:!0});return r}var pb=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{...ti(hn(this,"addOptions",{name:this.name}))}}get storage(){return{...ti(hn(this,"addStorage",{name:this.name,options:this.options}))}}configure(n={}){const t=this.extend({...this.config,addOptions:()=>LC(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}},kf=class RC extends pb{constructor(...t){super(...t),this.type="mark"}static create(t={}){const e=typeof t=="function"?t():t;return new RC(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)}},UP=class{constructor(n){this.find=n.find,this.handler=n.handler}};const HP=(n,t,e)=>{if(lb(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 qP(n){const{editor:t,state:e,from:r,to:i,rule:s,pasteEvent:l,dropEvent:c}=n,{commands:f,chain:d,can:p}=new th({editor:t,state:e}),g=[];return e.doc.nodesBetween(r,i,(b,y)=>{var A,E,L,R;if(!((A=b.type)===null||A===void 0||(A=A.spec)===null||A===void 0)&&A.code||!(b.isText||b.isTextblock||b.isInline))return;const q=(E=(L=(R=b.content)===null||R===void 0?void 0:R.size)!==null&&L!==void 0?L:b.nodeSize)!==null&&E!==void 0?E:0,H=Math.max(r,y),$=Math.min(i,y+q);if(H>=$)return;const ht=b.isText?b.text||"":b.textBetween(H-y,$-y,void 0,"");HP(ht,s.find,l).forEach(Mt=>{if(Mt.index===void 0)return;const wt=H+Mt.index+1,bt=wt+Mt[0].length,ot={from:e.tr.mapping.map(wt),to:e.tr.mapping.map(bt)},Dt=s.handler({state:e,range:ot,match:Mt,commands:f,chain:d,can:p,pasteEvent:l,dropEvent:c});g.push(Dt)})}),g.every(b=>b!==null)}let ig=null;const $P=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 YP(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 A=d.tr,E=W0({state:d,transaction:A});if(!(!qP({editor:t,state:E,from:Math.max(p-1,0),to:g.b-1,rule:b,pasteEvent:y,dropEvent:c})||!A.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,A}};return e.map(d=>new Vi({view(p){const g=y=>{var A;r=!((A=p.dom.parentElement)===null||A===void 0)&&A.contains(y.target)?p.dom.parentElement:null,r&&(ig=t)},b=()=>{ig&&(ig=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=ig;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],A=y.getMeta("uiEvent")==="paste"&&!i,E=y.getMeta("uiEvent")==="drop"&&!s,L=y.getMeta("applyPasteRules"),R=!!L;if(!A&&!E&&!R)return;if(R){let{text:$}=L;typeof $=="string"?$=$:$=fb(ke.from($),b.schema);const{from:ht}=L,Mt=ht+$.length,wt=$P($);return f({rule:d,state:b,from:ht,to:{b:Mt},pasteEvt:wt})}const q=g.doc.content.findDiffStart(b.doc.content),H=g.doc.content.findDiffEnd(b.doc.content);if(!(!jP(q)||!H||q===H.b))return f({rule:d,state:b,from:q,to:H,pasteEvt:l})}}))}var Z0=class{constructor(n,t){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=t,this.baseExtensions=n,this.extensions=xC(n),this.schema=I7(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((n,t)=>{const e=hn(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:jd(t.name,this.schema)});return e?{...n,...e()}:n},{})}get plugins(){const{editor:n}=this,t=yp([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:jd(r.name,this.schema)},s=[],l=hn(r,"addKeyboardShortcuts",i);let c={};if(r.type==="mark"&&hn(r,"exitable",i)&&(c.ArrowRight=()=>kf.handleExit({editor:n,mark:r})),l){const b=Object.fromEntries(Object.entries(l()).map(([y,A])=>[y,()=>A({editor:n})]));c={...c,...b}}const f=FO(c);s.push(f);const d=hn(r,"addInputRules",i);if(H3(r,n.options.enableInputRules)&&d){const b=d();if(b&&b.length){const y=FP({editor:n,rules:b}),A=Array.isArray(y)?y:[y];s.push(...A)}}const p=hn(r,"addPasteRules",i);if(H3(r,n.options.enablePasteRules)&&p){const b=p();if(b&&b.length){const y=YP({editor:n,rules:b});s.push(...y)}}const g=hn(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=hn(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:jd(r.name,this.schema)});i&&e.push({name:r.name,addDecorations:i})}),this.decorationManager=new RP({editor:t,entries:e}),this.decorationManager.plugin}get attributes(){return bC(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:t}=uh(this.extensions);return Object.fromEntries(t.filter(e=>!!hn(e,"addNodeView")).map(e=>{const r=this.attributes.filter(c=>c.type===e.name),i=hn(e,"addNodeView",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:n,type:Io(e.name,this.schema)});if(!i)return[];const s=i();if(!s)return[];const l=(c,f,d,p,g)=>{const b=jp(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 yp([...this.extensions].reverse()).reduceRight((e,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:jd(r.name,this.schema)},s=hn(r,"dispatchTransaction",i);return s?l=>{s.call(i,{transaction:l,next:e})}:e},n)}transformPastedHTML(n){const{editor:t}=this;return yp([...this.extensions]).reduce((e,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:jd(r.name,this.schema)},s=hn(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}=uh(this.extensions);return Object.fromEntries(t.filter(e=>!!hn(e,"addMarkView")).map(e=>{const r=this.attributes.filter(l=>l.type===e.name),i=hn(e,"addMarkView",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:n,type:_u(e.name,this.schema)});if(!i)return[];const s=(l,c,f)=>{const d=jp(l,r);return i()({mark:l,view:c,inline:f,editor:n,extension:e,HTMLAttributes:d,updateAttributes:p=>{zP(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:jd(t.name,this.schema)};if(t.type==="mark"){var r,i;(!((r=ti(hn(t,"keepOnSplit",e)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(t.name),!((i=ti(hn(t,"clearable",e)))!==null&&i!==void 0)||i||this.nonClearableMarks.push(t.name)}const s=hn(t,"onBeforeCreate",e),l=hn(t,"onCreate",e),c=hn(t,"onUpdate",e),f=hn(t,"onSelectionUpdate",e),d=hn(t,"onTransaction",e),p=hn(t,"onFocus",e),g=hn(t,"onBlur",e),b=hn(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)})}};Z0.resolve=xC;Z0.sort=yp;Z0.flatten=ub;var Ci=class OC extends pb{constructor(...t){super(...t),this.type="extension"}static create(t={}){const e=typeof t=="function"?t():t;return new OC(e)}configure(t){return super.configure(t)}extend(t){const e=typeof t=="function"?t():t;return super.extend(e)}};const VP=Ci.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Vi({key:new zo("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:t,schema:e}=n,{doc:r,selection:i}=t,s=wC(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})=>vC(r,{from:f.pos,to:d.pos},c)).join(l??`
|
|
119
|
-
|
|
120
|
-
`)}}})]}}),WP=Ci.create({name:"commands",addCommands(){return{...xP}}}),XP=Ci.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=gC(n.before,[n,...t]);db(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,A=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:!A,editor:this.editor,transaction:n,combinedTransform:f})})});const d=f.mapping;f.steps.forEach((p,g)=>{if(p instanceof ac){var b,y;const A=d.slice(g).map(p.from,-1),E=d.slice(g).map(p.to),L=d.invert().map(A,-1),R=d.invert().map(E),q=A>0?(b=f.doc.nodeAt(A-1))===null||b===void 0?void 0:b.marks.some($=>$.eq(p.mark)):!1,H=(y=f.doc.nodeAt(E))===null||y===void 0?void 0:y.marks.some($=>$.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:A,to:E},partial:!!(H||q),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()}}),GP=Ci.create({name:"drop",addProseMirrorPlugins(){return[new Vi({key:new zo("tiptapDrop"),props:{handleDrop:(n,t,e,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:e,moved:r})}}})]}}),KP=Ci.create({name:"editable",addProseMirrorPlugins(){return[new Vi({key:new zo("editable"),props:{editable:()=>this.editor.options.editable}})]}}),JP=new zo("focusEvents"),ZP=Ci.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Vi({key:JP,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}}}})]}}),QP=Ci.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,A=g.parent.isTextblock&&b>0?c.doc.resolve(b-1):g,E=A.parent.type.spec.isolating,L=g.pos-g.parentOffset,R=E&&A.parent.childCount===1?L===g.pos:ir.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 n0()||pC()?s:i},addProseMirrorPlugins(){return[new Vi({key:new zo("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=ir.atStart(t.doc).from,d=ir.atEnd(t.doc).to;if(s||!(l===f&&c===d)||!K0(e.doc))return;const p=e.tr,g=W0({state:e,transaction:p}),{commands:b}=new th({editor:this.editor,state:g});if(b.clearNodes(),!!p.steps.length)return p}})]}}),tj=Ci.create({name:"paste",addProseMirrorPlugins(){return[new Vi({key:new zo("tiptapPaste"),props:{handlePaste:(n,t,e)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:e})}}})]}}),ej=Ci.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Vi({key:new zo("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"}}}})]}}),nj=Ci.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=uh(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 Vi({key:new zo("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}});let X3=!1;function rj(n){if(X3)return;X3=!0;let t;try{t=Ao.fromJSON(n,{from:0,to:0}).slice.content}catch{return}t instanceof ke||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}var ij=class ap{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 ap(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 ap(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 ap(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 ap(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 oj=`.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 sj=class extends wP{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:X7,createMappablePosition:G7},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=f5(t,this.options.autofocus);this.editorState=Hf.create({doc:t,schema:this.schema,selection:e||void 0})}rj(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():th.createFakeChain()}can(){return this.commandManager?this.commandManager.can():th.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=PP(oj,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=yC(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?[KP,VP.configure({blockSeparator:(n=this.options.coreExtensionOptions)===null||n===void 0||(n=n.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),WP,ZP,QP,ej.configure({value:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.tabindex)===null||t===void 0?void 0:t.value}),GP,tj,XP,nj.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 Z0(e,this)}createCommandManager(){this.commandManager=new th({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=d5(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=d5(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=Hf.create({doc:e,schema:this.schema,selection:f5(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 iC(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 SC(this.state,n)}isActive(n,t){const e=typeof n=="string"?n:null,r=typeof n=="string"?t:n;return Y7(this.state,e,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return fb(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:t=`
|
|
191
|
-
|
|
192
|
-
`,textSerializers:e={}}=n||{};return B7(this.state.doc,{blockSeparator:t,textSerializers:{...wC(this.schema),...e}})}get isEmpty(){return K0(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 ij(t,this,!1,e)}get $doc(){return this.$pos(0)}};function fh(n){return new J0({find:n.find,handler:({state:t,range:e,match:r})=>{const i=ti(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(hb(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 aj(n){return new J0({find:n.find,handler:({state:t,range:e,match:r})=>{const i=ti(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 p5(n){return new J0({find:n.find,handler:({state:t,range:e,match:r})=>{const i=t.doc.resolve(e.from),s=ti(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 dh(n){return new J0({find:n.find,handler:({state:t,range:e,match:r,chain:i})=>{const s=ti(n.getAttributes,void 0,r)||{},l=t.tr.delete(e.from,e.to),c=l.doc.resolve(e.from).blockRange(),f=c&&W5(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 A=y.filter(E=>b.includes(E.type.name));l.ensureMarks(A)}}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&&wf(l.doc,e.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&l.join(e.from-1)},undoable:n.undoable})}var ml=class PC extends pb{constructor(...t){super(...t),this.type="node"}static create(t={}){const e=typeof t=="function"?t():t;return new PC(e)}configure(t){return super.configure(t)}extend(t){const e=typeof t=="function"?t():t;return super.extend(e)}};function ld(n){return new UP({find:n.find,handler:({state:t,range:e,match:r,pasteEvent:i})=>{const s=ti(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(hb(e.from,e.to,t.doc).filter(y=>y.mark.type.excluded.find(A=>A===n.type&&A!==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:lj,getOwnPropertySymbols:cj}=Object,{hasOwnProperty:uj}=Object.prototype;function n2(n,t){return function(r,i,s){return n(r,i,s)&&t(r,i,s)}}function og(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 fj(n){return n?.[Symbol.toStringTag]}function G3(n){return lj(n).concat(cj(n))}const dj=Object.hasOwn||((n,t)=>uj.call(n,t));function hd(n,t){return n===t||!n&&!t&&n!==n&&t!==t}const hj="__v",pj="__o",mj="_owner",{getOwnPropertyDescriptor:K3,keys:J3}=Object;function gj(n,t){return n.byteLength===t.byteLength&&r0(new Uint8Array(n),new Uint8Array(t))}function yj(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 bj(n,t){return n.byteLength===t.byteLength&&r0(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function xj(n,t){return hd(n.getTime(),t.getTime())}function vj(n,t){return n.name===t.name&&n.message===t.message&&n.cause===t.cause&&n.stack===t.stack}function wj(n,t){return n===t}function Z3(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 Sj=hd;function kj(n,t,e){const r=J3(n);let i=r.length;if(J3(t).length!==i)return!1;for(;i-- >0;)if(!jC(n,t,e,r[i]))return!1;return!0}function Xh(n,t,e){const r=G3(n);let i=r.length;if(G3(t).length!==i)return!1;let s,l,c;for(;i-- >0;)if(s=r[i],!jC(n,t,e,s)||(l=K3(n,s),c=K3(t,s),(l||c)&&(!l||!c||l.configurable!==c.configurable||l.enumerable!==c.enumerable||l.writable!==c.writable)))return!1;return!0}function Aj(n,t){return hd(n.valueOf(),t.valueOf())}function Mj(n,t){return n.source===t.source&&n.flags===t.flags}function Q3(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 r0(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 Cj(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 jC(n,t,e,r){return(r===mj||r===pj||r===hj)&&(n.$$typeof||t.$$typeof)?!0:dj(t,r)&&e.equals(n[r],t[r],r,r,n,t,e)}const Ej="[object ArrayBuffer]",Tj="[object Arguments]",Nj="[object Boolean]",_j="[object DataView]",Dj="[object Date]",Lj="[object Error]",Rj="[object Map]",Oj="[object Number]",Pj="[object Object]",jj="[object RegExp]",Ij="[object Set]",zj="[object String]",Bj={"[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},Fj="[object URL]",Uj=Object.prototype.toString;function Hj({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:A}){return function(L,R,q){if(L===R)return!0;if(L==null||R==null)return!1;const H=typeof L;if(H!==typeof R)return!1;if(H!=="object")return H==="number"?c(L,R,q):H==="function"?s(L,R,q):!1;const $=L.constructor;if($!==R.constructor)return!1;if($===Object)return f(L,R,q);if(Array.isArray(L))return t(L,R,q);if($===Date)return r(L,R,q);if($===RegExp)return p(L,R,q);if($===Map)return l(L,R,q);if($===Set)return g(L,R,q);const ht=Uj.call(L);if(ht===Dj)return r(L,R,q);if(ht===jj)return p(L,R,q);if(ht===Rj)return l(L,R,q);if(ht===Ij)return g(L,R,q);if(ht===Pj)return typeof L.then!="function"&&typeof R.then!="function"&&f(L,R,q);if(ht===Fj)return y(L,R,q);if(ht===Lj)return i(L,R,q);if(ht===Tj)return f(L,R,q);if(Bj[ht])return b(L,R,q);if(ht===Ej)return n(L,R,q);if(ht===_j)return e(L,R,q);if(ht===Nj||ht===Oj||ht===zj)return d(L,R,q);if(A){let Mt=A[ht];if(!Mt){const wt=fj(L);wt&&(Mt=A[wt])}if(Mt)return Mt(L,R,q)}return!1}}function qj({circular:n,createCustomConfig:t,strict:e}){let r={areArrayBuffersEqual:gj,areArraysEqual:e?Xh:yj,areDataViewsEqual:bj,areDatesEqual:xj,areErrorsEqual:vj,areFunctionsEqual:wj,areMapsEqual:e?n2(Z3,Xh):Z3,areNumbersEqual:Sj,areObjectsEqual:e?Xh:kj,arePrimitiveWrappersEqual:Aj,areRegExpsEqual:Mj,areSetsEqual:e?n2(Q3,Xh):Q3,areTypedArraysEqual:e?n2(r0,Xh):r0,areUrlsEqual:Cj,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),n){const i=og(r.areArraysEqual),s=og(r.areMapsEqual),l=og(r.areObjectsEqual),c=og(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:l,areSetsEqual:c})}return r}function $j(n){return function(t,e,r,i,s,l,c){return n(t,e,c)}}function Yj({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 Vj=Af();Af({strict:!0});Af({circular:!0});Af({circular:!0,strict:!0});Af({createInternalComparator:()=>hd});Af({strict:!0,createInternalComparator:()=>hd});Af({circular:!0,createInternalComparator:()=>hd});Af({circular:!0,createInternalComparator:()=>hd,strict:!0});function Af(n={}){const{circular:t=!1,createInternalComparator:e,createState:r,strict:i=!1}=n,s=qj(n),l=Hj(s),c=e?e(l):$j(l);return Yj({circular:t,comparator:l,createState:r,equals:c,strict:i})}var r2={exports:{}},i2={};var tk;function Wj(){if(tk)return i2;tk=1;var n=Fp(),t=MA();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 i2.useSyncExternalStoreWithSelector=function(d,p,g,b,y){var A=s(null);if(A.current===null){var E={hasValue:!1,value:null};A.current=E}else E=A.current;A=c(function(){function R(Mt){if(!q){if(q=!0,H=Mt,Mt=b(Mt),y!==void 0&&E.hasValue){var wt=E.value;if(y(wt,Mt))return $=wt}return $=Mt}if(wt=$,r(H,Mt))return wt;var bt=b(Mt);return y!==void 0&&y(wt,bt)?(H=Mt,wt):(H=Mt,$=bt)}var q=!1,H,$,ht=g===void 0?null:g;return[function(){return R(p())},ht===null?void 0:function(){return R(ht())}]},[p,g,b,y]);var L=i(d,A[0],A[1]);return l(function(){E.hasValue=!0,E.value=L},[L]),f(L),L},i2}var ek;function Xj(){return ek||(ek=1,r2.exports=Wj()),r2.exports}var Gj=Xj(),Kj=(...n)=>t=>{n.forEach(e=>{typeof e=="function"?e(t):e&&(e.current=t)})},Jj=({contentComponent:n})=>{const t=CA.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return C.jsx(C.Fragment,{children:Object.values(t)})};function Zj(){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]:RD.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 Qj=class extends Bc.Component{constructor(n){var t;super(n),this.editorContentRef=Bc.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=Zj(),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 C.jsxs(C.Fragment,{children:[C.jsx("div",{ref:Kj(t,this.editorContentRef),...e}),n?.contentComponent&&C.jsx(Jj,{contentComponent:n.contentComponent})]})}},tI=I.forwardRef((n,t)=>{const e=Bc.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return Bc.createElement(Qj,{key:e,innerRef:t,...n})}),IC=Bc.memo(tI),eI=typeof window<"u"?I.useLayoutEffect:I.useEffect,nI=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 rI(n){var t;const[e]=I.useState(()=>new nI(n.editor)),r=Gj.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getServerSnapshot,n.selector,(t=n.equalityFn)!=null?t:Vj);return eI(()=>e.watch(n.editor),[n.editor,e]),I.useDebugValue(r),r}var iI=!1,m5=typeof window>"u",oI=m5||!!(typeof window<"u"&&window.next),sI=class zC{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?m5||oI?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 sj(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?zC.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 aI(n={},t=[]){const e=I.useRef(n);e.current=n;const[r]=I.useState(()=>new sI(e)),i=CA.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return I.useDebugValue(i),I.useEffect(r.onRender(t)),rI({editor:i,selector:({transactionNumber:s})=>n.shouldRerenderOnTransaction===!1||n.shouldRerenderOnTransaction===void 0?null:n.immediatelyRender&&s===0?0:s+1}),i}var BC=I.createContext({editor:null});BC.Consumer;var lI=I.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),cI=()=>I.useContext(lI);Bc.forwardRef((n,t)=>{const{onDragStart:e}=cI(),r=n.as||"div";return C.jsx(r,{...n,ref:t,"data-node-view-wrapper":"",onDragStart:e,style:{whiteSpace:"normal",...n.style}})});Bc.createContext({markViewContentRef:()=>{}});var mb=I.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});mb.displayName="TiptapContext";var uI=()=>I.useContext(mb);function FC({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=I.useMemo(()=>({editor:r}),[r]),s=I.useMemo(()=>({editor:r}),[r]);return C.jsx(BC.Provider,{value:s,children:C.jsx(mb.Provider,{value:i,children:e})})}FC.displayName="Tiptap";function UC({...n}){const{editor:t}=uI();return C.jsx(IC,{editor:t,...n})}UC.displayName="Tiptap.Content";Object.assign(FC,{Content:UC});const HC=new WeakSet,qC=new WeakSet;function Of(n){const t=n;return HC.add(t),t}function g5(n){return Array.isArray(n)&&HC.has(n)}function $C(n){return n.flatMap(t=>t==null?[]:Array.isArray(t)&&qC.has(t)&&!g5(t)?$C(t):[t])}function fI(n,t){if(n==="slot")return 0;if(n instanceof Function){const i=n(t);return Array.isArray(i)&&!g5(i)&&!qC.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(g5(e))return Of([n,r,e]);if(e.length===0)return Of([n,r]);const i=$C(e);return i.length===0?Of([n,r]):Of([n,r,...i])}return e!=null?Of([n,r,e]):Of([n,r])}const i0=(n,t)=>fI(n,t);var dI=/^\s*>\s$/,hI=ml.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return i0("blockquote",{...To(this.options.HTMLAttributes,n),children:i0("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[dh({find:dI,type:this.type})]}}),pI=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,mI=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,gI=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,yI=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,bI=kf.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 i0("strong",{...To(this.options.HTMLAttributes,n),children:i0("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[fh({find:pI,type:this.type}),fh({find:gI,type:this.type})]},addPasteRules(){return[ld({find:mI,type:this.type}),ld({find:yI,type:this.type})]}}),xI=/(^|[^`])`([^`]+)`(?!`)$/,vI=/(^|[^`])`([^`]+)`(?!`)/g,wI=kf.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",To(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[fh({find:xI,type:this.type})]},addPasteRules(){return[ld({find:vI,type:this.type})]}}),o2=4,SI=/^```([a-z]+)?[\s\n]$/,kI=/^~~~([a-z]+)?[\s\n]$/,AI=ml.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:o2,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",To(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:o2,{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(A=>c+A).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:o2,{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 A=0,E=0;const L=d-p;for(let Mt=0;Mt<y.length;Mt+=1){if(E+y[Mt].length>=L){A=Mt;break}E+=y[Mt].length+1}const q=((f=y[A].match(/^ */))==null?void 0:f[0])||"",H=Math.min(q.length,e);if(H===0)return!0;let $=p;for(let Mt=0;Mt<A;Mt+=1)$+=y[Mt].length+1;return c.delete($,$+H),d-$<=H&&c.setSelection(On.create(c.doc,$)),!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 A;const E=((A=y.match(/^ */))==null?void 0:A[0])||"",L=Math.min(E.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(ir.near(r.resolve(c))),!0)):n.commands.exitCode()}}},addInputRules(){return[p5({find:SI,type:this.type,getAttributes:n=>({language:n[1]})}),p5({find:kI,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Vi({key:new zo("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(On.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),n.dispatch(l),!0}}})]}}),MI=ml.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,t)=>n.content?t.renderChildren(n.content,`
|
|
214
|
-
|
|
215
|
-
`):""}),CI=ml.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",To(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()}}}),EI=ml.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]}`,To(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=>p5({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),TI=ml.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",To(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:t})=>{if(!OP(t,t.schema.nodes[this.name]))return!1;const{selection:e}=t,{$to:r}=e,i=n();return kC(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(On.create(l.doc,f.pos+1)):f.nodeAfter.isBlock?l.setSelection(En.create(l.doc,f.pos)):l.setSelection(On.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(On.create(l.doc,d+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[aj({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),NI=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,_I=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,DI=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,LI=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,RI=kf.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",To(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[fh({find:NI,type:this.type}),fh({find:DI,type:this.type})]},addPasteRules(){return[ld({find:_I,type:this.type}),ld({find:LI,type:this.type})]}});const OI="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",PI="ελ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",y5="numeric",b5="ascii",x5="alpha",bp="asciinumeric",lp="alphanumeric",v5="domain",YC="emoji",jI="scheme",II="slashscheme",s2="whitespace";function zI(n,t){return n in t||(t[n]=[]),t[n]}function Vf(n,t,e){t[y5]&&(t[bp]=!0,t[lp]=!0),t[b5]&&(t[bp]=!0,t[x5]=!0),t[bp]&&(t[lp]=!0),t[x5]&&(t[lp]=!0),t[lp]&&(t[v5]=!0),t[YC]&&(t[v5]=!0);for(const r in t){const i=zI(r,e);i.indexOf(n)<0&&i.push(n)}}function BI(n,t){const e={};for(const r in t)t[r].indexOf(n)>=0&&(e[r]=!0);return e}function Ia(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Ia.groups={};Ia.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||Ia.groups;let i;return t&&t.j?i=t:(i=new Ia(t),e&&r&&Vf(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||Ia.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 Ia,Object.assign(l.j,c.j),l.jr.push.apply(l.jr,c.jr),l.jd=c.jd,l.t=c.t):l=new Ia,s){if(r)if(l.t&&typeof l.t=="string"){const f=Object.assign(BI(l.t,r),e);Vf(s,f,r)}else e&&Vf(s,e,r);l.t=s}return i.j[n]=l,l}};const rr=(n,t,e,r,i)=>n.ta(t,e,r,i),fo=(n,t,e,r,i)=>n.tr(t,e,r,i),nk=(n,t,e,r,i)=>n.ts(t,e,r,i),Ee=(n,t,e,r,i)=>n.tt(t,e,r,i),wu="WORD",w5="UWORD",VC="ASCIINUMERICAL",WC="ALPHANUMERICAL",Ip="LOCALHOST",S5="TLD",k5="UTLD",Mg="SCHEME",Yd="SLASH_SCHEME",gb="NUM",A5="WS",yb="NL",xp="OPENBRACE",vp="CLOSEBRACE",o0="OPENBRACKET",s0="CLOSEBRACKET",a0="OPENPAREN",l0="CLOSEPAREN",c0="OPENANGLEBRACKET",u0="CLOSEANGLEBRACKET",f0="FULLWIDTHLEFTPAREN",d0="FULLWIDTHRIGHTPAREN",h0="LEFTCORNERBRACKET",p0="RIGHTCORNERBRACKET",m0="LEFTWHITECORNERBRACKET",g0="RIGHTWHITECORNERBRACKET",y0="FULLWIDTHLESSTHAN",b0="FULLWIDTHGREATERTHAN",x0="AMPERSAND",v0="APOSTROPHE",w0="ASTERISK",of="AT",S0="BACKSLASH",k0="BACKTICK",A0="CARET",lf="COLON",bb="COMMA",M0="DOLLAR",Pc="DOT",C0="EQUALS",xb="EXCLAMATION",Il="HYPHEN",wp="PERCENT",E0="PIPE",T0="PLUS",N0="POUND",Sp="QUERY",vb="QUOTE",XC="FULLWIDTHMIDDLEDOT",wb="SEMI",jc="SLASH",kp="TILDE",_0="UNDERSCORE",GC="EMOJI",D0="SYM";var KC=Object.freeze({__proto__:null,ALPHANUMERICAL:WC,AMPERSAND:x0,APOSTROPHE:v0,ASCIINUMERICAL:VC,ASTERISK:w0,AT:of,BACKSLASH:S0,BACKTICK:k0,CARET:A0,CLOSEANGLEBRACKET:u0,CLOSEBRACE:vp,CLOSEBRACKET:s0,CLOSEPAREN:l0,COLON:lf,COMMA:bb,DOLLAR:M0,DOT:Pc,EMOJI:GC,EQUALS:C0,EXCLAMATION:xb,FULLWIDTHGREATERTHAN:b0,FULLWIDTHLEFTPAREN:f0,FULLWIDTHLESSTHAN:y0,FULLWIDTHMIDDLEDOT:XC,FULLWIDTHRIGHTPAREN:d0,HYPHEN:Il,LEFTCORNERBRACKET:h0,LEFTWHITECORNERBRACKET:m0,LOCALHOST:Ip,NL:yb,NUM:gb,OPENANGLEBRACKET:c0,OPENBRACE:xp,OPENBRACKET:o0,OPENPAREN:a0,PERCENT:wp,PIPE:E0,PLUS:T0,POUND:N0,QUERY:Sp,QUOTE:vb,RIGHTCORNERBRACKET:p0,RIGHTWHITECORNERBRACKET:g0,SCHEME:Mg,SEMI:wb,SLASH:jc,SLASH_SCHEME:Yd,SYM:D0,TILDE:kp,TLD:S5,UNDERSCORE:_0,UTLD:k5,UWORD:w5,WORD:wu,WS:A5});const bu=/[a-z]/,Gh=new RegExp("\\p{L}","u"),a2=new RegExp("\\p{Emoji}","u"),xu=/\d/,l2=/\s/,rk="\r",c2=`
|
|
218
|
-
`,FI="️",UI="",u2="";let sg=null,ag=null;function HI(n=[]){const t={};Ia.groups=t;const e=new Ia;sg==null&&(sg=ik(OI)),ag==null&&(ag=ik(PI)),Ee(e,"'",v0),Ee(e,"{",xp),Ee(e,"}",vp),Ee(e,"[",o0),Ee(e,"]",s0),Ee(e,"(",a0),Ee(e,")",l0),Ee(e,"<",c0),Ee(e,">",u0),Ee(e,"(",f0),Ee(e,")",d0),Ee(e,"「",h0),Ee(e,"」",p0),Ee(e,"『",m0),Ee(e,"』",g0),Ee(e,"<",y0),Ee(e,">",b0),Ee(e,"&",x0),Ee(e,"*",w0),Ee(e,"@",of),Ee(e,"`",k0),Ee(e,"^",A0),Ee(e,":",lf),Ee(e,",",bb),Ee(e,"$",M0),Ee(e,".",Pc),Ee(e,"=",C0),Ee(e,"!",xb),Ee(e,"-",Il),Ee(e,"%",wp),Ee(e,"|",E0),Ee(e,"+",T0),Ee(e,"#",N0),Ee(e,"?",Sp),Ee(e,'"',vb),Ee(e,"/",jc),Ee(e,";",wb),Ee(e,"~",kp),Ee(e,"_",_0),Ee(e,"\\",S0),Ee(e,"・",XC);const r=fo(e,xu,gb,{[y5]:!0});fo(r,xu,r);const i=fo(r,bu,VC,{[bp]:!0}),s=fo(r,Gh,WC,{[lp]:!0}),l=fo(e,bu,wu,{[b5]:!0});fo(l,xu,i),fo(l,bu,l),fo(i,xu,i),fo(i,bu,i);const c=fo(e,Gh,w5,{[x5]:!0});fo(c,bu),fo(c,xu,s),fo(c,Gh,c),fo(s,xu,s),fo(s,bu),fo(s,Gh,s);const f=Ee(e,c2,yb,{[s2]:!0}),d=Ee(e,rk,A5,{[s2]:!0}),p=fo(e,l2,A5,{[s2]:!0});Ee(e,u2,p),Ee(d,c2,f),Ee(d,u2,p),fo(d,l2,p),Ee(p,rk),Ee(p,c2),fo(p,l2,p),Ee(p,u2,p);const g=fo(e,a2,GC,{[YC]:!0});Ee(g,"#"),fo(g,a2,g),Ee(g,FI,g);const b=Ee(g,UI);Ee(b,"#"),fo(b,a2,g);const y=[[bu,l],[xu,i]],A=[[bu,null],[Gh,c],[xu,s]];for(let E=0;E<sg.length;E++)Zu(e,sg[E],S5,wu,y);for(let E=0;E<ag.length;E++)Zu(e,ag[E],k5,w5,A);Vf(S5,{tld:!0,ascii:!0},t),Vf(k5,{utld:!0,alpha:!0},t),Zu(e,"file",Mg,wu,y),Zu(e,"mailto",Mg,wu,y),Zu(e,"http",Yd,wu,y),Zu(e,"https",Yd,wu,y),Zu(e,"ftp",Yd,wu,y),Zu(e,"ftps",Yd,wu,y),Vf(Mg,{scheme:!0,ascii:!0},t),Vf(Yd,{slashscheme:!0,ascii:!0},t),n=n.sort((E,L)=>E[0]>L[0]?1:-1);for(let E=0;E<n.length;E++){const L=n[E][0],q=n[E][1]?{[jI]:!0}:{[II]:!0};L.indexOf("-")>=0?q[v5]=!0:bu.test(L)?xu.test(L)?q[bp]=!0:q[b5]=!0:q[y5]=!0,nk(e,L,L,q)}return nk(e,"localhost",Ip,{ascii:!0}),e.jd=new Ia(D0),{start:e,tokens:Object.assign({groups:t},KC)}}function JC(n,t){const e=qI(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 qI(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 Zu(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 Ia(r),s.jr=i.slice(),n.j[f]=s),n=s}return s=new Ia(e),s.jr=i.slice(),n.j[t[l-1]]=s,s}function ik(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 zp={defaultProtocol:"http",events:null,format:ok,formatHref:ok,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Sb(n,t=null){let e=Object.assign({},zp);n&&(e=Object.assign(e,n instanceof Sb?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}Sb.prototype={o:zp,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]:zp[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 ok(n){return n}function ZC(n,t){this.t="token",this.v=n,this.tk=t}ZC.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=zp.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 Q0(n,t){class e extends ZC{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 sk=Q0("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ak=Q0("text"),$I=Q0("nl"),lg=Q0("url",{isLink:!0,toHref(n=zp.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Ip&&n[1].t===lf}}),Ol=n=>new Ia(n);function YI({groups:n}){const t=n.domain.concat([x0,w0,of,S0,k0,A0,M0,C0,Il,gb,wp,E0,T0,N0,jc,D0,kp,_0]),e=[v0,lf,bb,Pc,xb,wp,Sp,vb,wb,c0,u0,xp,vp,s0,o0,a0,l0,f0,d0,h0,p0,m0,g0,y0,b0],r=[x0,v0,w0,S0,k0,A0,M0,C0,Il,xp,vp,wp,E0,T0,N0,Sp,jc,D0,kp,_0],i=Ol(),s=Ee(i,kp);rr(s,r,s),rr(s,n.domain,s);const l=Ol(),c=Ol(),f=Ol();rr(i,n.domain,l),rr(i,n.scheme,c),rr(i,n.slashscheme,f),rr(l,r,s),rr(l,n.domain,l);const d=Ee(l,of);Ee(s,of,d),Ee(c,of,d),Ee(f,of,d);const p=Ee(s,Pc);rr(p,r,s),rr(p,n.domain,s);const g=Ol();rr(d,n.domain,g),rr(g,n.domain,g);const b=Ee(g,Pc);rr(b,n.domain,g);const y=Ol(sk);rr(b,n.tld,y),rr(b,n.utld,y),Ee(d,Ip,y);const A=Ee(g,Il);Ee(A,Il,A),rr(A,n.domain,g),rr(y,n.domain,g),Ee(y,Pc,b),Ee(y,Il,A);const E=Ee(y,lf);rr(E,n.numeric,sk);const L=Ee(l,Il),R=Ee(l,Pc);Ee(L,Il,L),rr(L,n.domain,l),rr(R,r,s),rr(R,n.domain,l);const q=Ol(lg);rr(R,n.tld,q),rr(R,n.utld,q),rr(q,n.domain,l),rr(q,r,s),Ee(q,Pc,R),Ee(q,Il,L),Ee(q,of,d);const H=Ee(q,lf),$=Ol(lg);rr(H,n.numeric,$);const ht=Ol(lg),Mt=Ol();rr(ht,t,ht),rr(ht,e,Mt),rr(Mt,t,ht),rr(Mt,e,Mt),Ee(q,jc,ht),Ee($,jc,ht);const wt=Ee(c,lf),bt=Ee(f,lf),ot=Ee(bt,jc),Dt=Ee(ot,jc);rr(c,n.domain,l),Ee(c,Pc,R),Ee(c,Il,L),rr(f,n.domain,l),Ee(f,Pc,R),Ee(f,Il,L),rr(wt,n.domain,ht),Ee(wt,jc,ht),Ee(wt,Sp,ht),rr(Dt,n.domain,ht),rr(Dt,t,ht),Ee(Dt,jc,ht);const Q=[[xp,vp],[o0,s0],[a0,l0],[c0,u0],[f0,d0],[h0,p0],[m0,g0],[y0,b0]];for(let at=0;at<Q.length;at++){const[G,vt]=Q[at],Tt=Ee(ht,G);Ee(Mt,G,Tt),Ee(Tt,vt,ht);const gt=Ol(lg);rr(Tt,t,gt);const Z=Ol();rr(Tt,e),rr(gt,t,gt),rr(gt,e,Z),rr(Z,t,gt),rr(Z,e,Z),Ee(gt,vt,ht),Ee(Z,vt,ht)}return Ee(i,Ip,q),Ee(i,yb,$I),{start:i,tokens:KC}}function VI(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(f2(ak,t,l)),l=[]),i-=b,p-=b;const y=g.t,A=e.slice(i-p,i);s.push(f2(y,t,A))}}return l.length>0&&s.push(f2(ak,t,l)),s}function f2(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 WI=typeof console<"u"&&console&&console.warn||(()=>{}),XI="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",zi={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function GI(){return Ia.groups={},zi.scanner=null,zi.parser=null,zi.tokenQueue=[],zi.pluginQueue=[],zi.customSchemes=[],zi.initialized=!1,zi}function lk(n,t=!1){if(zi.initialized&&WI(`linkifyjs: already initialized - will not register custom scheme "${n}" ${XI}`),!/^[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`);zi.customSchemes.push([n,t])}function KI(){zi.scanner=HI(zi.customSchemes);for(let n=0;n<zi.tokenQueue.length;n++)zi.tokenQueue[n][1]({scanner:zi.scanner});zi.parser=YI(zi.scanner.tokens);for(let n=0;n<zi.pluginQueue.length;n++)zi.pluginQueue[n][1]({scanner:zi.scanner,parser:zi.parser});return zi.initialized=!0,zi}function kb(n){return zi.initialized||KI(),VI(zi.parser.start,n,JC(zi.scanner.start,n))}kb.scan=JC;function QC(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 Sb(e),i=kb(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 Ab="[\0- -\u2029 ]",JI=new RegExp(Ab),ZI=new RegExp(`${Ab}$`),QI=new RegExp(Ab,"g");function tz(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function ez(n){return new Vi({key:new zo("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=gC(e.doc,[...t]);if(db(c).forEach(({newRange:d})=>{const p=L7(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(!ZI.test(y))return;g=p[0],b=r.doc.textBetween(g.pos,d.to,void 0," ")}if(g&&b){const y=b.split(JI).filter(Boolean);if(y.length<=0)return!1;const A=y[y.length-1],E=g.pos+b.lastIndexOf(A);if(!A)return!1;const L=kb(A).map(R=>R.toObject(n.defaultProtocol));if(!tz(L))return!1;L.filter(R=>R.isLink).map(R=>({...R,from:E+R.start+1,to:E+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=>{hb(R.from,R.to,r.doc).some(q=>q.mark.type===n.type)||l.addMark(R.from,R.to,n.type.create({href:R.href}))})}}),!!l.steps.length)return l}})}function nz(n){return new Vi({key:new zo("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=SC(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 rz(n){return new Vi({key:new zo("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=QC(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(QI,"").match(new RegExp(`^(?:(?:${e.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var iz=kf.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"){lk(n);return}lk(n.scheme,n.optionalSlashes)})},onDestroy(){GI()},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",To(this.options.HTMLAttributes,n),0]:["a",To(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[ld({find:n=>{const t=[];if(n){const{protocols:e,defaultProtocol:r}=this.options,i=QC(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(ez({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(nz({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(rz({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),oz=Object.defineProperty,sz=(n,t)=>{for(var e in t)oz(n,e,{get:t[e],enumerable:!0})},az="listItem",ck="textStyle",uk=/^\s*([-+*])\s$/,t6=ml.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",To(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(az,this.editor.getAttributes(ck)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=dh({find:uk,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=dh({find:uk,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ck),editor:this.editor})),[n]}}),e6=ml.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",To(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)=>DC(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)}}}),lz={};sz(lz,{findListItemPos:()=>Kp,getNextListDepth:()=>Mb,handleBackspace:()=>M5,handleDelete:()=>C5,hasListBefore:()=>n6,hasListItemAfter:()=>cz,hasListItemBefore:()=>r6,listItemHasSubList:()=>i6,nextListIsDeeper:()=>o6,nextListIsHigher:()=>s6});var Kp=(n,t)=>{const{$from:e}=t.selection,r=Io(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}},Mb=(n,t)=>{const e=Kp(n,t);if(!e)return!1;const[,r]=q7(t,n,e.$pos.pos+4);return r},n6=(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))},r6=(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)},i6=(n,t,e)=>{if(!e)return!1;const r=Io(n,t.schema);let i=!1;return e.descendants(s=>{s.type===r&&(i=!0)}),i},M5=(n,t,e)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!vf(n.state,t)&&n6(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(!vf(n.state,t)||!W7(n.state))return!1;const r=Kp(t,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),l=i6(t,n.state,s);return r6(t,n.state)&&!l?n.commands.joinItemBackward():n.chain().liftListItem(t).run()},o6=(n,t)=>{const e=Mb(n,t),r=Kp(n,t);return!r||!e?!1:e>r.depth},s6=(n,t)=>{const e=Mb(n,t),r=Kp(n,t);return!r||!e?!1:e<r.depth},C5=(n,t)=>{if(!vf(n.state,t)||!V7(n.state,t))return!1;const{selection:e}=n.state,{$from:r,$to:i}=e;return!e.empty&&r.sameParent(i)?!1:o6(t,n.state)?n.chain().focus(n.state.selection.from+4).lift(t).joinBackward().run():s6(t,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},cz=(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)},a6=Ci.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&&C5(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&&C5(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&&M5(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&&M5(n,e,r)&&(t=!0)}),t}}}}),fk=/^(\s*)(\d+)\.\s+(.*)$/,uz=/^\s/;function fz(n){const t=[];let e=0,r=0;for(;e<n.length;){const i=n[e],s=i.match(fk);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(fk))break;if(y.trim()==="")b.push(y),p+=`
|
|
223
|
-
`,g+=1;else if(y.match(uz))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 l6(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(E=>E.indent)),A=l6(b,y,e);d.push({type:"list",ordered:!0,start:b[0].number,items:A,raw:b.map(E=>E.raw).join(`
|
|
228
|
-
`)})}i.push({type:"list_item",raw:l.raw,tokens:d}),s=g}else s+=1}return i}function dz(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 hz="listItem",dk="textStyle",hk=/^(\d+)\.\s$/,c6=ml.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",To(this.options.HTMLAttributes,e),0]:["ol",To(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?dz(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]=fz(i);if(s.length===0)return;const c=l6(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(hz,this.editor.getAttributes(dk)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=dh({find:hk,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=dh({find:hk,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(dk)}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1],editor:this.editor})),[n]}}),pz=/^\s*(\[([( |x])?\])\s$/,mz=ml.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",To(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 DC(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 A=e();if(typeof A!="number")return!1;const E=y.doc.nodeAt(A);return y.setNodeMarkup(A,void 0,{...E?.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=jp(g,b),A=new Set(Object.keys(y)),E=this.options.HTMLAttributes;return p.forEach(L=>{A.has(L)||(L in E?i.setAttribute(L,E[L]):i.removeAttribute(L))}),Object.entries(y).forEach(([L,R])=>{R==null?L in E?i.setAttribute(L,E[L]):i.removeAttribute(L):i.setAttribute(L,R)}),p=A,!0}}}},addInputRules(){return[dh({find:pz,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),gz=ml.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",To(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=W3(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=W3(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()}}});Ci.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(t6.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(e6.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(a6.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(c6.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(mz.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(gz.configure(this.options.taskList)),n}});var pk=" ",yz=" ",bz=ml.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",To(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===pk||r[0].text===yz)?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?pk:t.renderChildren(e)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),xz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,vz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,wz=kf.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",To(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[fh({find:xz,type:this.type})]},addPasteRules(){return[ld({find:vz,type:this.type})]}}),Sz=ml.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),kz=kf.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",To(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 Az(n={}){return new Vi({view(t){return new Mz(t,n)}})}class Mz{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 A=y.getBoundingClientRect(),E=g?A.bottom:A.top;g&&b&&(E=(E+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let L=this.width/2*c;r={left:A.left,right:A.right,top:E-L,bottom:E+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=eM(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 mo extends ir{constructor(t){super(t,t)}map(t,e){let r=t.resolve(e.map(this.head));return mo.valid(r)?new mo(r):ir.near(r)}content(){return Je.empty}eq(t){return t instanceof mo&&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 mo(t.resolve(e.pos))}getBookmark(){return new Cb(this.anchor)}static valid(t){let e=t.parent;if(e.inlineContent||!Cz(t)||!Ez(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&&mo.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(mo.valid(f))return f}for(;;){let l=e>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!En.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(mo.valid(c))return c}return null}}}mo.prototype.visible=!1;mo.findFrom=mo.findGapCursorFrom;ir.jsonID("gapcursor",mo);class Cb{constructor(t){this.pos=t}map(t){return new Cb(t.map(this.pos))}resolve(t){let e=t.resolve(this.pos);return mo.valid(e)?new mo(e):ir.near(e)}}function u6(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function Cz(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||u6(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Ez(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||u6(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Tz(){return new Vi({props:{decorations:Lz,createSelectionBetween(n,t,e){return t.pos==e.pos&&mo.valid(e)?new mo(e):null},handleClick:_z,handleKeyDown:Nz,handleDOMEvents:{beforeinput:Dz}}})}const Nz=oC({ArrowLeft:cg("horiz",-1),ArrowRight:cg("horiz",1),ArrowUp:cg("vert",-1),ArrowDown:cg("vert",1)});function cg(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 On){if(!s.endOfTextblock(e)||c.depth==0)return!1;f=!1,c=r.doc.resolve(t>0?c.after():c.before())}let d=mo.findGapCursorFrom(c,t,f);return d?(i&&i(r.tr.setSelection(new mo(d))),!0):!1}}function _z(n,t,e){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(t);if(!mo.valid(r))return!1;let i=n.posAtCoords({left:e.clientX,top:e.clientY});return i&&i.inside>-1&&En.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new mo(r))),!0)}function Dz(n,t){if(t.inputType!="insertCompositionText"||!(n.state.selection instanceof mo))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=ke.empty;for(let l=r.length-1;l>=0;l--)i=ke.from(r[l].createAndFill(null,i));let s=n.state.tr.replace(e.pos,e.pos,new Je(i,0,0));return s.setSelection(On.near(s.doc.resolve(e.pos+1))),n.dispatch(s),!1}function Lz(n){if(!(n.selection instanceof mo))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",hi.create(n.doc,[la.widget(n.selection.head,t,{key:"gapcursor"})])}var L0=200,is=function(){};is.prototype.append=function(t){return t.length?(t=is.from(t),!this.length&&t||t.length<L0&&this.leafAppend(t)||this.length<L0&&t.leafPrepend(this)||this.appendInner(t)):this};is.prototype.prepend=function(t){return t.length?is.from(t).append(this):this};is.prototype.appendInner=function(t){return new Rz(this,t)};is.prototype.slice=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.length),t>=e?is.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))};is.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};is.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)};is.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};is.from=function(t){return t instanceof is?t:t&&t.length?new f6(t):is.empty};var f6=(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})(is);is.empty=new f6([]);var Rz=(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})(is);const Oz=500;class sc{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)),A;y&&l.maybeStep(y).doc&&(A=l.mapping.maps[l.mapping.maps.length-1],d.push(new Ic(A,void 0,void 0,d.length+p.length))),s--,A&&i.appendMap(A,s)}else l.maybeStep(g.step);if(g.selection)return c=i?g.selection.map(i.slice(s)):g.selection,f=new sc(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>jz&&(c=Pz(c,d),l-=d),new sc(c.append(s),l)}remapping(t,e){let r=new Dp;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 sc(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 A=s.maps[y];if(b.step){let E=t.steps[y].invert(t.docs[y]),L=b.selection&&b.selection.map(s.slice(f+1,y));L&&c++,r.push(new Ic(A,E,L))}else r.push(new Ic(A))},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 sc(p,c);return g.emptyItemCount()>Oz&&(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 sc(is.from(i.reverse()),s)}}sc.empty=new sc(is.empty,0);function Pz(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 sf{constructor(t,e,r,i,s){this.done=t,this.undone=e,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const jz=20;function Iz(n,t,e,r){let i=e.getMeta(Qf),s;if(i)return i.historyState;e.getMeta(Fz)&&(n=new sf(n.done,n.undone,null,0,-1));let l=e.getMeta("appendedTransaction");if(e.steps.length==0)return n;if(l&&l.getMeta(Qf))return l.getMeta(Qf).redo?new sf(n.done.addTransform(e,void 0,r,Cg(t)),n.undone,mk(e.mapping.maps),n.prevTime,n.prevComposition):new sf(n.done,n.undone.addTransform(e,void 0,r,Cg(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||!zz(e,n.prevRanges)),d=l?d2(n.prevRanges,e.mapping):mk(e.mapping.maps);return new sf(n.done.addTransform(e,f?t.selection.getBookmark():void 0,r,Cg(t)),sc.empty,d,e.time,c??n.prevComposition)}else return(s=e.getMeta("rebased"))?new sf(n.done.rebased(e,s),n.undone.rebased(e,s),d2(n.prevRanges,e.mapping),n.prevTime,n.prevComposition):new sf(n.done.addMaps(e.mapping.maps),n.undone.addMaps(e.mapping.maps),d2(n.prevRanges,e.mapping),n.prevTime,n.prevComposition)}function zz(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 mk(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 d2(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 Bz(n,t,e){let r=Cg(t),i=Qf.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 sf(e?c:s.remaining,e?s.remaining:c,null,0,-1);return s.transform.setSelection(l).setMeta(Qf,{redo:e,historyState:f})}let h2=!1,gk=null;function Cg(n){let t=n.plugins;if(gk!=t){h2=!1,gk=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){h2=!0;break}}return h2}const Qf=new zo("history"),Fz=new zo("closeHistory");function Uz(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Vi({key:Qf,state:{init(){return new sf(sc.empty,sc.empty,null,0,-1)},apply(t,e,r){return Iz(e,r,t,n)}},config:n,props:{handleDOMEvents:{beforeinput(t,e){let r=e.inputType,i=r=="historyUndo"?h6:r=="historyRedo"?p6:null;return!i||!t.editable?!1:(e.preventDefault(),i(t.state,t.dispatch))}}}})}function d6(n,t){return(e,r)=>{let i=Qf.getState(e);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=Bz(i,e,n);s&&r(t?s.scrollIntoView():s)}return!0}}const h6=d6(!1,!0),p6=d6(!0,!0);Ci.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 Vi({key:new zo("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 Hz=Ci.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Az(this.options)]}});Ci.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Vi({key:new zo("focus"),props:{decorations:({doc:n,selection:t})=>{const{isEditable:e,isFocused:r}=this.editor,{anchor:i}=t,s=[];if(!e||!r)return hi.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(la.node(d,d+f.nodeSize,{class:this.options.className}))}),hi.create(n,s)}}})]}});var qz=Ci.create({name:"gapCursor",addProseMirrorPlugins(){return[Tz()]},extendNodeSchema(n){var t;const e={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(t=ti(hn(n,"allowGapCursor",e)))!=null?t:null}}}),yk="placeholder";function $z(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}Ci.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:yk,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const n=this.options.dataAttribute?`data-${$z(this.options.dataAttribute)}`:`data-${yk}`;return[new Vi({key:new zo("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&&K0(c);if((d||!this.options.showOnlyCurrent)&&p){const g=[this.options.emptyNodeClass];l&&g.push(this.options.emptyEditorClass);const b=la.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}),hi.create(t,s)}}})]}});Ci.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:t}=this;return[new Vi({key:new zo("selection"),props:{decorations(e){return e.selection.empty||n.isFocused||!n.isEditable||kC(e.selection)||n.view.dragging?null:hi.create(e.doc,[la.inline(e.selection.from,e.selection.to,{class:t.className})])}}})]}});function bk({types:n,node:t}){return t&&Array.isArray(n)&&n.includes(t.type)||t?.type===n}var Yz=Ci.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const t=new zo(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 Vi({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!bk({node:l,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const l=i.doc.lastChild;return!bk({node:l,types:r})}}})]}}),Vz=Ci.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:t})=>h6(n,t),redo:()=>({state:n,dispatch:t})=>p6(n,t)}},addProseMirrorPlugins(){return[Uz(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()}}}),Wz=Ci.create({name:"starterKit",addExtensions(){var n,t,e,r;const i=[];return this.options.bold!==!1&&i.push(bI.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(hI.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(t6.configure(this.options.bulletList)),this.options.code!==!1&&i.push(wI.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(AI.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(MI.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(Hz.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(qz.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(CI.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(EI.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(Vz.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(TI.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(RI.configure(this.options.italic)),this.options.listItem!==!1&&i.push(e6.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(a6.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(iz.configure((t=this.options)==null?void 0:t.link)),this.options.orderedList!==!1&&i.push(c6.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(bz.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(wz.configure(this.options.strike)),this.options.text!==!1&&i.push(Sz.configure(this.options.text)),this.options.underline!==!1&&i.push(kz.configure((e=this.options)==null?void 0:e.underline)),this.options.trailingNode!==!1&&i.push(Yz.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),Xz=Wz,Gz=20,m6=(n,t=0)=>{const e=[];return!n.children.length||t>Gz||Array.from(n.children).forEach(r=>{r.tagName==="SPAN"?e.push(r):r.children.length&&e.push(...m6(r,t+1))}),e},Kz=n=>{if(!n.children.length)return;const t=m6(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}`)})},g6=kf.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Kz(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",To(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}}}}),Jz=Ci.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()}}}),Zz=Ci.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()}}}),Qz=Ci.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()}}}),tB=Ci.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()}}}),eB=Ci.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()}}});Ci.create({name:"textStyleKit",addExtensions(){const n=[];return this.options.backgroundColor!==!1&&n.push(Jz.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(Zz.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(Qz.configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(tB.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push(eB.configure(this.options.lineHeight)),this.options.textStyle!==!1&&n.push(g6.configure(this.options.textStyle)),n}});const ie={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 cd(){return/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function en(n,t){const e=t?.isMac??cd();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 y6(n,t){if(!t||t.length===0)return n;for(const e of["","+"]){const r=` (${t.join(e)})`;if(n.endsWith(r))return n.slice(0,-r.length)}return n}function Ii(n,t){const e=t?.isMac??cd();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 ul={minWidth:16,height:16,paddingV:0,paddingH:4,borderRadius:4,fontSize:11,translateY:-.5},xk={display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:ul.minWidth,height:ul.height,padding:`0 ${ul.paddingH}px`,borderRadius:ul.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:ul.fontSize,fontWeight:900,lineHeight:1,letterSpacing:"0.02em",transform:`translateY(${ul.translateY}px)`,userSelect:"none",boxShadow:"0 1px 0 0 rgba(255,255,255,0.2)"};function Bl({children:n,title:t,scale:e=1}){const r=e,i=r===1?xk:{...xk,minWidth:ul.minWidth*r,height:ul.height*r,padding:`${ul.paddingV*r}px ${ul.paddingH*r}px`,borderRadius:ul.borderRadius*r,fontSize:ul.fontSize*r,transform:`translateY(${ul.translateY*r}px)`};return C.jsx("span",{style:i,title:t,children:n})}const R0="tyts-callout-insert-plain-text",E5="application/x-tyts-media",nB=/\.(png|jpe?g|svg|webp|gif|avif|bmp)$/i;function T5(n){if(!n)return[];const t=Array.from(n.files??[]),e=Array.from(n.items??[]).filter(s=>s.kind==="file").map(s=>s.getAsFile()).filter(s=>!!s),r=new Set,i=[];for(const s of[...t,...e]){if(!s.type.startsWith("image/")&&!nB.test(s.name))continue;const l=`${s.name}|${s.size}|${s.type}|${s.lastModified}`;r.has(l)||(r.add(l),i.push(s))}return i}function rB(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function iB(n){const t=n.replace(/\r\n?/g,`
|
|
233
|
-
`).replace(/^\n+|\s+$/g,"");return t?t.split(`
|
|
234
|
-
`).map(e=>e.trim()?`<p>${rB(e)}</p>`:"<p></p>").join(""):""}function oB(n){const t={};n.image&&(t.image=n.image,t.imageAspect=n.imageAspect);const e=iB(n.text);return e&&(t.description=e),t}const b6="data-tyts-media-panel";function Eg(n){return n instanceof Element&&n.closest(`[${b6}]`)!==null}function sB(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const aB=8,Qu=18*mn,x6=5*mn,lB=Math.max(x6,18*mn),cB=1.5*mn,uB="#1a1a2e",fB=.45,dB="rgba(0,0,0,0.001)",vk="blur(12px)",wk=2*mn,hB=2*mn,pB="88",Sk="33",mB=10*mn,gB="1.5em",yB="#d0d0d0",bB="#111111",xB="rgba(10,10,16,0.88)",vB="rgba(245,245,250,0.98)",kk=4*mn,wB=4*mn,SB=`${2*mn}px ${6*mn}px`,kB=10*mn,AB=4*mn,MB="rgba(0,0,0,0.6)",CB="#ddd",Ak=8*mn,EB=14*mn,TB="#888",NB=8*mn,_B=12*mn,DB="rgba(255,255,255,0.5)",LB=2,RB=1*mn,Mk={background:mh,border:eh,color:F0,cursor:"pointer",borderRadius:Hp,fontSize:qp,padding:mD,fontFamily:"inherit",display:"inline-flex",alignItems:"center",gap:6*mn},v6=$p,OB=4*mn,ug={minWidth:v6,height:$p,background:mh,border:eh,color:F0,cursor:"pointer",borderRadius:Hp,fontSize:qp,padding:xA,fontFamily:"inherit",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,boxSizing:"border-box"},PB="1px solid rgba(255,255,255,0.4)",Ck=18*mn,jB=3*mn,IB=10*mn,zB="1px solid rgba(255,255,255,0.25)",BB="#f5f5fa",FB="#111",UB="#111",HB="#fff";function p2(n){return n*(rh+wD)}const qB=[{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 $B(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 YB=Bc.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:A,onClearImage:E,onApplyMedia:L,onDragStart:R,onResizeStart:q,onActivate:H,onUpdateColor:$,onUpdateStrokeStyle:ht,onUpdateFillStyle:Mt,onUpdateStrokeWidthScale:wt,onContextMenu:bt,onToggleDescPos:ot,onToggleTheme:Dt,onHide:Q,onAddLinked:at,onDelete:G,onUpdateTextStyle:vt,onUpdateTextFontSize:Tt}){const gt=Qt=>Qt,Z=I.useRef(null),lt=I.useRef(null),[Bt,ee]=I.useState(!1),J=I.useRef(null),[_,K]=I.useState(()=>t.description.trim().length>0),V=t.description.trim().length>0,ut=!!t.image,xt=B0(t.anchor),At=F5(t.anchor),Ft=(t.strokeStyle??Uf)==="dashed",Lt=(t.fillStyle??Ep)==="none",Zt=X4(t.anchor),ve=t.strokeWidthScale!==void 0,je=(f-hl)/(Nu-hl)*100,Pe=(t.textFontSize??Pa)*F4,We=t.anchor.type==="standalone"?"Блок виноски":`Виноска ${t.label}`,ct=t.theme==="light"&&V,Le=t.textColor??(ct?bB:yB),Pn=t.textBackgroundColor===null?"transparent":t.textBackgroundColor??(ct?vB:xB),fe=aI({extensions:[Xz,g6],content:t.description||"",autofocus:!1,editorProps:{attributes:{style:["width: 100%",`min-height: ${gB}`,"background: transparent","border: none","outline: none",`color: ${Le}`,`font-size: ${Pe}px`,`line-height: ${Lg}`,`font-family: ${c}`,"direction: ltr","unicode-bidi: plaintext","text-align: left","white-space: pre-wrap","word-break: break-word"].join("; ")}},onUpdate({editor:Qt}){let Re=Qt.getHTML();(Re==="<p></p>"||Re===`<p></p>
|
|
235
|
-
`)&&(Re=""),y(t.id,Re),!_&&Re.trim().length>0&&K(!0)}});I.useEffect(()=>{if(!fe)return;const Qt=fe.getHTML();(Qt==="<p></p>"?"":Qt)!==t.description&&fe.commands.setContent(t.description||"",{emitUpdate:!1})},[fe,t.description]);const ye=I.useCallback(Qt=>Math.max(mB,Qt),[]),Te=I.useCallback(Qt=>{if(!V||!fe)return;const Re=fe.state.selection;if(!Re.empty&&Re.from!==Re.to){const Oe=fe.getAttributes("textStyle"),Xn=Oe?.fontSize?Number.parseFloat(Oe.fontSize):Number.NaN,Bn=Number.isFinite(Xn)?Xn:Pe,or=ye(Bn+Qt*mn);fe.chain().focus().setMark("textStyle",{fontSize:`${or}px`}).run();return}Tt&&Tt(t.id,Qt)},[V,fe,Pe,ye,Tt,t.id]),[Ne,_e]=I.useState(null);I.useEffect(()=>{if(!fe)return;const Qt=()=>{const Re=fe.state.selection;if(Re.empty||Re.from===Re.to){_e(null);return}const Me=fe.getAttributes("textStyle"),Oe=Me?.fontSize?Number.parseFloat(Me.fontSize):Number.NaN;_e(Number.isFinite(Oe)?Oe:null)};return Qt(),fe.on("selectionUpdate",Qt),fe.on("transaction",Qt),()=>{fe.off("selectionUpdate",Qt),fe.off("transaction",Qt)}},[fe]);const Ue=Math.round((Ne??Pe)/mn),cn=I.useCallback(()=>{H(t.id),K(!0),requestAnimationFrame(()=>{fe?.commands.focus("end")})},[H,t.id,fe]);I.useEffect(()=>{if(fe){if(!i&&!s){fe.commands.blur();return}s&&!i&&fe.isFocused&&fe.commands.blur()}},[i,s,fe]),I.useEffect(()=>{if(!i||!fe)return;const Qt=Re=>{const Me=Re;if(Me.detail?.pinId!==t.id)return;const Oe=Me.detail.text??"";if(!Oe.trim())return;K(!0);const Xn=()=>{if(!fe||fe.isDestroyed)return;fe.isFocused||fe.commands.focus("end");const Bn=sB(Oe);fe.chain().focus().insertContent(Bn).run()};requestAnimationFrame(()=>requestAnimationFrame(Xn))};return document.addEventListener(R0,Qt),()=>document.removeEventListener(R0,Qt)},[i,fe,t.id]),I.useEffect(()=>{if(!l||!fe)return;H(t.id);const Qt=setTimeout(()=>{document.activeElement?.blur?.(),fe.commands.focus("end")},0);return()=>clearTimeout(Qt)},[l,t.id,H,fe]);const In=(i||s)&&!!fe;I.useEffect(()=>{if(!In||!fe)return;const Qt=Re=>{const Me=Re.target;Me&&(Me.tagName==="TEXTAREA"||Me.tagName==="INPUT"&&Me!==J.current||Me.getAttribute?.("contenteditable")==="true")||Re.ctrlKey||Re.metaKey||Re.altKey||Re.key.length===1&&(fe.isFocused||(Re.preventDefault(),Re.stopPropagation(),H(t.id),fe.chain().focus().insertContent(Re.key).run(),K(!0)))};return window.addEventListener("keydown",Qt,!0),()=>window.removeEventListener("keydown",Qt,!0)},[In,t.id,H,fe]);const Fe=cd();I.useEffect(()=>{if(!i||!$||!ot||!G)return;const Qt=Fe?Oe=>Oe.metaKey:Oe=>Oe.ctrlKey,Re=(Oe,Xn)=>Oe.code===`Key${Xn.toUpperCase()}`||!Oe.code&&Oe.key.toLowerCase()===Xn,Me=Oe=>{const Xn=Oe.key,Bn=Qt(Oe),or=Oe.shiftKey;if(Bn&&!or&&Re(Oe,"b")){Oe.preventDefault(),Oe.stopPropagation(),V&&fe&&fe.chain().focus().toggleBold().run();return}if(Bn&&!or&&Re(Oe,"i")){Oe.preventDefault(),Oe.stopPropagation(),V&&fe&&fe.chain().focus().toggleItalic().run();return}if(Bn&&!or&&Re(Oe,"u")){Oe.preventDefault(),Oe.stopPropagation(),V&&fe&&fe.chain().focus().toggleUnderline?.().run?.();return}if(Bn&&or&&Re(Oe,"s")){Oe.preventDefault(),Oe.stopPropagation(),V&&fe&&fe.chain().focus().toggleStrike?.().run?.();return}if(Bn&&(Xn==="-"||Xn==="Minus")){Oe.preventDefault(),Oe.stopPropagation(),Te(-2);return}if(Bn&&(Xn==="="||Xn==="+")){Oe.preventDefault(),Oe.stopPropagation(),Te(2);return}if(Bn&&or&&Re(Oe,"t")){Oe.preventDefault(),Oe.stopPropagation(),H(t.id),K(!0),requestAnimationFrame(()=>fe?.commands.focus("end"));return}if(Bn&&or&&Re(Oe,"i")){Oe.preventDefault(),Oe.stopPropagation(),lt.current?.click();return}if(Bn&&or&&Re(Oe,"x")){Oe.preventDefault(),Oe.stopPropagation(),y(t.id,""),K(!1);return}if(Bn&&or&&Re(Oe,"e")){Oe.preventDefault(),Oe.stopPropagation(),ut&&E&&E(t.id);return}if(Bn&&or&&Re(Oe,"p")){Oe.preventDefault(),Oe.stopPropagation(),ut&&(V||_)&&ot(t.id);return}if(Bn&&or&&Re(Oe,"l")){Oe.preventDefault(),Oe.stopPropagation(),V&&Dt&&Dt(t.id);return}Xn==="Delete"&&(Oe.preventDefault(),Oe.stopPropagation(),G(t.id))};return window.addEventListener("keydown",Me,!0),()=>window.removeEventListener("keydown",Me,!0)},[i,t.id,V,ut,_,Fe,H,y,ot,Dt,G,E,Tt,$,fe,Te]);const{x:_n,y:dn,width:ze,height:Xe}=e,{w:Ie,h:kr}=r,wn=p2(1),nn=p2(2),ln=p2(3),Ln=_n+ze+nn+rh>Ie,Ze=I.useCallback(Qt=>["TEXTAREA","BUTTON","INPUT","LABEL"].includes(Qt.tagName)||Qt.getAttribute("contenteditable")==="true"||!!Qt.closest('[contenteditable="true"]')||!!Qt.closest(".ProseMirror"),[]),ur=I.useCallback(Qt=>{R(t.id,gt(Qt))},[R,t.id]),[gn,xn]=I.useState(1),gr=I.useRef(null),Mn=I.useCallback(()=>{const Qt=gr.current;if(!Qt)return;const Re=Math.ceil(Qt.getBoundingClientRect().height),Me=Math.ceil(Qt.scrollHeight),Oe=Math.max(1,Re,Me);xn(Xn=>Xn!==Oe?Oe:Xn)},[]);I.useLayoutEffect(()=>{if(!i)return;const Qt=gr.current;if(!Qt)return;Mn();const Re=requestAnimationFrame(()=>{Mn(),requestAnimationFrame(Mn)}),Me=new ResizeObserver(()=>Mn());return Me.observe(Qt),()=>{cancelAnimationFrame(Re),Me.disconnect()}},[i,g,ut,V,_,t.theme,t.descPos,Mn]);const Ke=I.useCallback(()=>{},[]);I.useEffect(()=>{(_||V)&&Ke()},[_,V,Ke,Xe]);const Vn=Qt=>{const Re=Qt.target.files?.[0];if(!Re)return;const Me=new FileReader;Me.onload=Oe=>A(t.id,Oe.target?.result),Me.readAsDataURL(Re),Qt.target.value=""},ss=t.image?C.jsx("div",{style:{width:"100%",flex:V||_?"1 1 auto":"1 1 100%",minHeight:q4,background:`url(${t.image}) center/cover no-repeat`,position:"relative",borderTop:t.descPos==="above"&&(V||_)?`1px solid ${t.color}${Sk}`:"none",borderBottom:t.descPos==="below"&&(V||_)?`1px solid ${t.color}${Sk}`:"none",boxSizing:"border-box"},children:C.jsxs("label",{style:{position:"absolute",bottom:kk,right:kk,cursor:"pointer",background:MB,borderRadius:wB,padding:SB,fontSize:kB,color:CB,display:"inline-flex",alignItems:"center",gap:AB},children:[C.jsx("i",{className:`${Rr} bi-arrow-repeat`,style:{fontSize:qr},"aria-hidden":!0}),"замінити (",Wd(),")",C.jsx("input",{type:"file",accept:"image/*",style:{display:"none"},onChange:Vn})]})}):null,Ei=V||_||!ut?C.jsx("div",{style:{flex:ut?"0 0 auto":"1 1 auto",padding:`${z2}px ${B2}px ${Y4}px`,overflow:"hidden",minHeight:"1.5em",height:ut?"auto":"100%",display:"flex",flexDirection:"column",boxSizing:"border-box"},children:_||V?C.jsx("div",{style:{position:"relative",width:"100%",height:"100%",flex:"1 1 auto",display:"flex",flexDirection:"column"},children:fe&&C.jsx(IC,{editor:fe,className:"tyts-no-scrollbar",onContextMenu:Qt=>Qt.preventDefault(),onPointerDown:()=>{H(t.id)},onMouseDown:()=>{H(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"}})}):ut?null:C.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:Ak,color:TB,fontSize:EB},children:[C.jsxs("div",{style:{display:"flex",gap:Ak},children:[!ut&&C.jsxs("button",{type:"button",onPointerDown:Qt=>Qt.stopPropagation(),onMouseDown:Qt=>Qt.stopPropagation(),onClick:Qt=>{Qt.stopPropagation(),H(t.id),lt.current?.click()},style:Mk,children:[C.jsx("i",{className:`${Rr} bi-plus-lg-lg`,style:{fontSize:qr},"aria-hidden":!0}),C.jsx("i",{className:`${Rr} bi-image`,style:{fontSize:qr},"aria-hidden":!0}),"Фото"]}),C.jsxs("button",{type:"button",onPointerDown:Qt=>Qt.stopPropagation(),onMouseDown:Qt=>Qt.stopPropagation(),onClick:Qt=>{Qt.stopPropagation(),cn()},style:Mk,children:[C.jsx("i",{className:`${Rr} bi-plus-lg`,style:{fontSize:qr},"aria-hidden":!0}),C.jsx("i",{className:`${Rr} bi-type`,style:{fontSize:qr},"aria-hidden":!0}),"Текст"]})]}),C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:NB,fontSize:_B,color:DB,marginTop:LB},children:["Або вставте з буфера"," ",Ii(ie.pasteInCallout,{isMac:cd()}).map(Qt=>C.jsx(Bl,{title:Wd(),scale:RB,children:Qt},Qt))]})]})}):null;return C.jsxs("g",{onContextMenu:bt?Qt=>bt(t.id,Qt):void 0,children:[C.jsx("foreignObject",{x:_n,y:dn,width:ze,height:Xe,style:{overflow:"visible"},onPointerDown:Qt=>{Qt.stopPropagation(),H(t.id);const Re=Qt.target;if(Ze(Re)){Z.current={pointerId:Qt.pointerId,pointerType:Qt.pointerType,startX:Qt.clientX,startY:Qt.clientY};return}ur(Qt)},onPointerMove:Qt=>{const Re=Z.current;if(!Re||Re.pointerId!==Qt.pointerId)return;const Me=window.getSelection();if(Re.pointerType==="mouse"&&Me&&!Me.isCollapsed&&Me.toString().trim().length>0){Z.current=null;return}const Oe=Qt.clientX-Re.startX,Xn=Qt.clientY-Re.startY;Math.hypot(Oe,Xn)<aB||(Z.current=null,ur(Qt))},onPointerUp:Qt=>{Z.current?.pointerId===Qt.pointerId&&(Z.current=null)},onPointerCancel:Qt=>{Z.current?.pointerId===Qt.pointerId&&(Z.current=null)},onMouseDown:Qt=>{Qt.stopPropagation(),H(t.id);const Re=Qt.target;Ze(Re)||R(t.id,Qt)},children:C.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{width:"100%",height:"100%",border:`${$4*W4(f)}px solid ${t.color}`,borderRadius:j2,background:Pn,backdropFilter:vk,WebkitBackdropFilter:vk,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:c,cursor:"grab",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",outline:Bt?`${wk}px dashed ${t.color}`:i?`${wk}px solid ${t.color}${pB}`:"none",outlineOffset:hB},onDragOver:Qt=>{Qt.preventDefault(),Qt.stopPropagation(),Qt.dataTransfer.dropEffect="copy",L&&Qt.dataTransfer.types.includes(E5)&&ee(!0)},onDragLeave:Qt=>{Qt.currentTarget.contains(Qt.relatedTarget)||ee(!1)},onDrop:Qt=>{Qt.preventDefault(),Qt.stopPropagation(),ee(!1);const Re=Qt.dataTransfer.getData(E5);if(Re){L?.(t.id,Re);return}H(t.id);const Me=Qt.dataTransfer.files?.[0];if(Me?.type.startsWith("image/")){const Oe=new FileReader;Oe.onload=Xn=>{const Bn=Xn.target?.result;Bn&&A(t.id,Bn)},Oe.readAsDataURL(Me)}},children:[C.jsx("input",{ref:J,type:"text",readOnly:!0,tabIndex:0,"aria-label":We,style:{position:"absolute",left:0,top:0,width:1,height:1,opacity:0,pointerEvents:"none",padding:0,margin:0,border:"none",outline:"none"}}),C.jsx("input",{ref:lt,type:"file",accept:"image/*",style:{display:"none"},onChange:Vn}),C.jsxs("div",{style:{display:"flex",flexDirection:t.descPos==="above"?"column":"column-reverse",height:"100%"},children:[Ei,ss]}),C.jsx("div",{"data-drag-hit-zone":"top",style:{position:"absolute",top:0,left:0,right:0,height:Qu,cursor:"grab",background:"transparent"},onPointerDown:Qt=>{Qt.stopPropagation(),Qt.pointerType==="touch"&&(H(t.id),ur(Qt))}}),C.jsx("div",{"data-drag-hit-zone":"bottom",style:{position:"absolute",bottom:0,left:0,right:0,height:Qu,cursor:"grab",background:"transparent"},onPointerDown:Qt=>{Qt.stopPropagation(),Qt.pointerType==="touch"&&(H(t.id),ur(Qt))}}),C.jsx("div",{"data-drag-hit-zone":"left",style:{position:"absolute",top:Qu,bottom:Qu,left:0,width:Qu,cursor:"grab",background:"transparent"},onPointerDown:Qt=>{Qt.stopPropagation(),Qt.pointerType==="touch"&&(H(t.id),ur(Qt))}}),C.jsx("div",{"data-drag-hit-zone":"right",style:{position:"absolute",top:Qu,bottom:Qu,right:0,width:Qu,cursor:"grab",background:"transparent"},onPointerDown:Qt=>{Qt.stopPropagation(),Qt.pointerType==="touch"&&(H(t.id),ur(Qt))}})]})}),i&&$&&ot&&G&&(()=>{if(g){const Wt=rh,ai=Og({card:{x:_n,y:dn,width:ze,height:Xe},panel:{w:Wt,h:Wt},gap:jg,bounds:{w:Ie,h:kr},leader:p,margin:{top:Km,bottom:Km}}),Ar=C.jsx("foreignObject",{x:ai.x,y:ai.y,width:Wt,height:Wt,style:{overflow:"visible",outline:"none"},onPointerDown:er=>er.stopPropagation(),onMouseDown:er=>er.stopPropagation(),children:C.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",children:C.jsx("button",{type:"button",onPointerDown:er=>er.stopPropagation(),onClick:er=>{er.stopPropagation(),b?.()},title:`Показати панель (${en(ie.calloutTogglePanel,{isMac:Fe})})`,style:{...rp,position:"static",transform:"none"},children:C.jsx("i",{className:`${Rr} bi-sliders`,style:{fontSize:qr},"aria-hidden":!0})})})});return d?ih.createPortal(Ar,d):Ar}const Qt=(xt&&ht?1:0)+(At&&Mt?1:0),Re=ja.length+Qt,Oe=Re*po+(Re-1)*zg+Ig*2,Xn=ln,Bn=Og({card:{x:_n,y:dn,width:ze,height:Xe},panel:{w:Oe,h:gn},gap:jg,bounds:{w:Ie,h:kr},leader:p,margin:{left:Ln?Xn:0,right:Ln?0:Xn,top:Km,bottom:Km}}),or=Bn.above,Fn=Bn.y,si=Bn.x,mi=C.jsx("foreignObject",{x:si,y:Fn,width:Oe,height:gn,style:{overflow:"visible",outline:"none"},onPointerDown:Wt=>Wt.stopPropagation(),onMouseDown:Wt=>Wt.stopPropagation(),children:C.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{display:"flex",flexDirection:"column",justifyContent:or?"flex-end":"flex-start",width:"100%",height:"100%"},children:C.jsxs("div",{ref:gr,style:{display:"flex",flexDirection:"column",gap:aA,width:"100%",padding:Ig,boxSizing:"border-box",background:uA,borderRadius:lA,border:fA,fontFamily:c,fontSize:cA,position:"relative"},children:[b&&C.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),b()},title:`Згорнути панель (${en(ie.calloutTogglePanel,{isMac:Fe})})`,style:{position:"absolute",top:-uf/2,right:-uf/2,width:uf,height:uf,borderRadius:"50%",background:$g,border:H5,color:q5,cursor:"pointer",padding:0,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:$5},children:C.jsx("i",{className:`${Rr} bi-dash-lg`,style:{fontSize:sA},"aria-hidden":!0})}),C.jsxs("div",{style:{display:"flex",gap:zg,justifyContent:"center"},children:[ja.map(Wt=>C.jsx("button",{type:"button",onPointerDown:ai=>ai.stopPropagation(),onClick:ai=>{ai.stopPropagation(),$(t.id,Wt)},title:Wt,style:{width:po,height:po,borderRadius:"50%",background:Wt,border:t.color===Wt?Zd:dA,cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0}},Wt)),xt&&ht&&C.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),ht(t.id,Ft?"solid":"dashed")},onMouseDown:Wt=>Wt.preventDefault(),"aria-label":"Перемикач стилю обводки",title:Ft?"Змінити на суцільну обводку":"Змінити на пунктирну обводку",style:{width:po,height:po,borderRadius:"50%",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0,background:Bg,border:Ft?Zd:Fg,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:C.jsx("svg",{width:po-ff,height:po-ff,viewBox:"0 0 16 16","aria-hidden":!0,children:C.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:Hg,strokeWidth:Ug,strokeDasharray:hA})})}),At&&Mt&&C.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),Mt(t.id,Lt?"filled":"none")},onMouseDown:Wt=>Wt.preventDefault(),"aria-label":"Перемикач фону фігури",title:Lt?"Додати фон фігури":"Прибрати фон фігури",style:{width:po,height:po,borderRadius:"50%",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0,background:Bg,border:Lt?Zd:Fg,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:C.jsx("svg",{width:po-ff,height:po-ff,viewBox:"0 0 16 16","aria-hidden":!0,children:C.jsx("rect",{x:"3",y:"3",width:"10",height:"10",fill:"none",stroke:Hg,strokeWidth:Ug})})})]}),Zt&&wt&&C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:fp},children:[C.jsx("i",{className:`${Rr} bi-border-width`,style:{fontSize:qr,color:nh,flexShrink:0},"aria-hidden":!0}),C.jsx("input",{type:"range",min:hl,max:Nu,step:j0,value:f,"aria-label":"Товщина ліній виноски",title:"Товщина контуру, лінії та маркера",onPointerDown:Wt=>Wt.stopPropagation(),onMouseDown:Wt=>Wt.stopPropagation(),onChange:Wt=>wt(t.id,Number(Wt.target.value)),className:"tyts-range",style:{flex:1,minWidth:0,"--tyts-range-accent":t.color,"--tyts-range-bg":mh,"--tyts-range-track":`${mA}px`,"--tyts-range-thumb":`${pA}px`,"--tyts-range-fill":`${je}%`}}),C.jsxs("span",{style:{color:nh,fontSize:gA,fontVariantNumeric:"tabular-nums",minWidth:yA,textAlign:"right",flexShrink:0},children:["×",I0(f)]}),ve&&C.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onMouseDown:Wt=>Wt.preventDefault(),onClick:Wt=>{Wt.stopPropagation(),wt(t.id,null)},title:"Повернути глобальну товщину","aria-label":"Повернути глобальну товщину",style:bA,children:C.jsx("i",{className:`${Rr} bi-arrow-counterclockwise`,style:{fontSize:qr},"aria-hidden":!0})})]}),(ut&&!V||!ut&&V||ut&&(V||_)||V&&vt&&Tt&&fe||V&&Dt)&&C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:fp,flexShrink:0,flexWrap:"wrap",overflowX:"visible",rowGap:fp},children:[ut&&!V&&!_&&C.jsxs(C.Fragment,{children:[C.jsxs("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),H(t.id),K(!0)},title:`Додати текст (${en(ie.calloutAddText,{isMac:Fe})})`,style:ep,children:[C.jsx("i",{className:`${Rr} bi-type`,style:{fontSize:qr},"aria-hidden":!0}),C.jsx("i",{className:`${Rr} bi-plus-lg`,style:{fontSize:qr},"aria-hidden":!0})]}),E&&C.jsxs("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),E(t.id)},title:`Прибрати фото (${en(ie.calloutRemoveImage,{isMac:Fe})})`,style:np,children:[C.jsx("i",{className:`${Rr} bi-image`,style:{fontSize:qr},"aria-hidden":!0}),C.jsx("i",{className:`${Rr} bi-x-lg`,style:{fontSize:qr},"aria-hidden":!0})]})]}),!ut&&V&&C.jsxs(C.Fragment,{children:[C.jsxs("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),lt.current?.click()},onMouseDown:Wt=>Wt.preventDefault(),title:`Додати фото (${Wd()} або ${en(ie.calloutAddImage,{isMac:Fe})})`,style:ep,children:[C.jsx("i",{className:`${Rr} bi-image`,style:{fontSize:qr},"aria-hidden":!0}),C.jsx("i",{className:`${Rr} bi-plus-lg`,style:{fontSize:qr},"aria-hidden":!0})]}),C.jsxs("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),y(t.id,""),K(!1)},onMouseDown:Wt=>Wt.preventDefault(),title:`Прибрати текст (${en(ie.calloutRemoveText,{isMac:Fe})})`,style:np,children:[C.jsx("i",{className:`${Rr} bi-type`,style:{fontSize:qr},"aria-hidden":!0}),C.jsx("i",{className:`${Rr} bi-x-lg`,style:{fontSize:qr},"aria-hidden":!0})]})]}),ut&&(V||_)&&C.jsxs(C.Fragment,{children:[C.jsxs("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),lt.current?.click()},onMouseDown:Wt=>Wt.preventDefault(),title:`Змінити фото (${Wd()} або ${en(ie.calloutAddImage,{isMac:Fe})})`,style:ep,children:[C.jsx("i",{className:`${Rr} bi-image`,style:{fontSize:qr},"aria-hidden":!0}),C.jsx("i",{className:`${Rr} bi-arrow-repeat`,style:{fontSize:qr},"aria-hidden":!0})]}),C.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),ot(t.id)},onMouseDown:Wt=>Wt.preventDefault(),title:`${t.descPos==="above"?"Текст вниз":"Текст вгору"} (${en(ie.calloutToggleDescPos,{isMac:Fe})})`,style:ep,children:C.jsx("i",{className:`${Rr} ${t.descPos==="above"?"bi-arrow-bar-down":"bi-arrow-bar-up"}`,style:{fontSize:qr},"aria-hidden":!0})}),C.jsxs("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),y(t.id,""),K(!1)},onMouseDown:Wt=>Wt.preventDefault(),title:`Прибрати текст (${en(ie.calloutRemoveText,{isMac:Fe})})`,style:np,children:[C.jsx("i",{className:`${Rr} bi-type`,style:{fontSize:qr},"aria-hidden":!0}),C.jsx("i",{className:`${Rr} bi-x-lg`,style:{fontSize:qr},"aria-hidden":!0})]}),E&&C.jsxs("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),E(t.id)},title:`Прибрати фото (${en(ie.calloutRemoveImage,{isMac:Fe})})`,style:np,children:[C.jsx("i",{className:`${Rr} bi-image`,style:{fontSize:qr},"aria-hidden":!0}),C.jsx("i",{className:`${Rr} bi-x-lg`,style:{fontSize:qr},"aria-hidden":!0})]})]}),V&&vt&&Tt&&fe&&C.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:OB,flexWrap:"wrap"},children:[C.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),fe.chain().focus().toggleBold().run()},onMouseDown:Wt=>Wt.preventDefault(),title:`Жирний текст (${en(ie.calloutBold,{isMac:Fe})})`,style:{...ug,fontWeight:700},children:"B"}),C.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),fe.chain().focus().toggleItalic().run()},onMouseDown:Wt=>Wt.preventDefault(),title:`Курсив (${en(ie.calloutItalic,{isMac:Fe})})`,style:{...ug,fontStyle:"italic"},children:"I"}),C.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),fe.chain().focus().toggleUnderline?.().run?.()},onMouseDown:Wt=>Wt.preventDefault(),title:`Підкреслення (${en(ie.calloutUnderline,{isMac:Fe})})`,style:{...ug,textDecoration:"underline"},children:"U"}),C.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),fe.chain().focus().toggleStrike?.().run?.()},onMouseDown:Wt=>Wt.preventDefault(),title:`Закреслення (${en(ie.calloutStrike,{isMac:Fe})})`,style:{...ug,textDecoration:"line-through"},children:"S"}),C.jsxs("div",{style:wA,role:"group","aria-label":"Розмір шрифту",children:[C.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),Te(-2)},onMouseDown:Wt=>Wt.preventDefault(),title:`Менший шрифт (${en(ie.calloutFontSizeDown,{isMac:Fe})})`,"aria-label":"Менший шрифт",style:qg,children:"−"}),C.jsx("span",{style:SA,"aria-live":"polite",children:Ue}),C.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),Te(2)},onMouseDown:Wt=>Wt.preventDefault(),title:`Більший шрифт (${en(ie.calloutFontSizeUp,{isMac:Fe})})`,"aria-label":"Більший шрифт",style:qg,children:"+"})]})]}),V&&Dt&&C.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),Dt(t.id)},onMouseDown:Wt=>Wt.preventDefault(),title:`${ct?"Світлий фон, темний текст":"Темний фон, світлий текст"} (${en(ie.calloutToggleTheme,{isMac:Fe})})`,style:{width:v6,height:$p,borderRadius:Hp,background:"transparent",border:PB,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,cursor:"pointer",padding:0,boxSizing:"border-box"},children:C.jsx("span",{style:{width:Ck,height:Ck,borderRadius:jB,background:ct?BB:FB,color:ct?UB:HB,border:zB,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:IB,fontWeight:700,lineHeight:1},children:"Aa"})})]}),Q&&C.jsx("button",{type:"button",onPointerDown:Wt=>{Wt.stopPropagation()},onClick:Wt=>{Wt.stopPropagation(),Q(t.id)},title:"Приховати виноску",style:{...rp,right:Ln?"auto":-nn,left:Ln?-nn:"auto"},children:C.jsx("i",{className:`${Rr} bi-eye-slash`,style:{fontSize:qr},"aria-hidden":!0})}),at&&C.jsx("button",{type:"button",onPointerDown:Wt=>{Wt.stopPropagation()},onClick:Wt=>{Wt.stopPropagation(),at(t.id)},title:"Додати ще одну виноску до цієї фігури",style:{...rp,right:Ln?"auto":-ln,left:Ln?-ln:"auto"},children:C.jsx("i",{className:`${Rr} bi-plus-lg`,style:{fontSize:qr},"aria-hidden":!0})}),C.jsx("button",{type:"button",onPointerDown:Wt=>{Wt.stopPropagation()},onClick:Wt=>{Wt.stopPropagation(),G(t.id)},title:`Видалити виноску (${en(ie.calloutDelete,{isMac:Fe})})`,style:{...rp,right:Ln?"auto":-wn,left:Ln?-wn:"auto",border:DS,color:V2},onMouseEnter:Wt=>{Wt.currentTarget.style.background=SD,Wt.currentTarget.style.border=kD,Wt.currentTarget.style.color=AD},onMouseLeave:Wt=>{Wt.currentTarget.style.background=$g,Wt.currentTarget.style.border=DS,Wt.currentTarget.style.color=V2},children:C.jsx("i",{className:`${Rr} bi-trash`,style:{fontSize:qr},"aria-hidden":!0})})]})})});return d?ih.createPortal(mi,d):mi})(),qB.map(Qt=>C.jsxs("g",{children:[C.jsx("circle",{cx:_n+Qt.cx*ze,cy:dn+Qt.cy*Xe,r:lB,fill:dB,stroke:"none","data-resize-handle-hit":Qt.id,style:{cursor:Qt.cursor},onPointerDown:Re=>{Re.stopPropagation(),H(t.id),q(t.id,Qt.id,gt(Re))},onMouseDown:Re=>{Re.stopPropagation(),H(t.id),q(t.id,Qt.id,Re)}}),C.jsx("circle",{cx:_n+Qt.cx*ze,cy:dn+Qt.cy*Xe,r:x6,fill:i?t.color:uB,stroke:t.color,strokeWidth:cB,opacity:i?1:fB,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&&$B(n.leaderPath,t.leaderPath)),La=n=>n.stopPropagation(),Ek={xmlns:"http://www.w3.org/1999/xhtml"},VB=Bc.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:A}){const E=cd(),L=B0(t.anchor)&&!!p,R=F5(t.anchor)&&!!g,q=X4(t.anchor)&&!!b,H=(t.strokeStyle??Uf)==="dashed",$=(t.fillStyle??Ep)==="none",ht=t.strokeWidthScale!==void 0,Mt=(i-hl)/(Nu-hl)*100,[wt,bt]=I.useState(1),ot=I.useRef(null),Dt=I.useCallback(()=>{const Z=ot.current;if(!Z)return;const lt=Math.max(1,Math.ceil(Z.getBoundingClientRect().height),Math.ceil(Z.scrollHeight));bt(Bt=>Bt!==lt?lt:Bt)},[]);I.useLayoutEffect(()=>{const Z=ot.current;if(!Z)return;Dt();const lt=requestAnimationFrame(()=>{Dt(),requestAnimationFrame(Dt)}),Bt=new ResizeObserver(Dt);return Bt.observe(Z),()=>{cancelAnimationFrame(lt),Bt.disconnect()}},[c,q,Dt]);const Q={x:e.minX,y:e.minY,width:e.maxX-e.minX,height:e.maxY-e.minY},at={w:r.w,h:r.h};if(c){const Z=rh,lt=Og({card:Q,panel:{w:Z,h:Z},gap:jg,bounds:at}),Bt=C.jsx("foreignObject",{x:lt.x,y:lt.y,width:Z,height:Z,style:{overflow:"visible",outline:"none"},onPointerDown:La,onMouseDown:La,children:C.jsx("div",{...Ek,children:C.jsx("button",{type:"button",onPointerDown:La,onClick:ee=>{ee.stopPropagation(),f?.()},title:`Показати панель (${en(ie.calloutTogglePanel,{isMac:E})})`,style:{...rp,position:"static",transform:"none"},children:C.jsx("i",{className:`${Rr} bi-sliders`,style:{fontSize:qr},"aria-hidden":!0})})})});return l?ih.createPortal(Bt,l):Bt}const G=ja.length+(L?1:0)+(R?1:0),vt=G*po+(G-1)*zg+Ig*2,Tt=Og({card:Q,panel:{w:vt,h:wt},gap:jg,bounds:at}),gt=C.jsx("foreignObject",{x:Tt.x,y:Tt.y,width:vt,height:wt,style:{overflow:"visible",outline:"none"},onPointerDown:La,onMouseDown:La,children:C.jsx("div",{...Ek,style:{display:"flex",flexDirection:"column",justifyContent:Tt.above?"flex-end":"flex-start",width:"100%",height:"100%"},children:C.jsxs("div",{ref:ot,style:{display:"flex",flexDirection:"column",gap:aA,width:"100%",padding:Ig,boxSizing:"border-box",background:uA,borderRadius:lA,border:fA,fontFamily:s,fontSize:cA,position:"relative"},children:[f&&C.jsx("button",{type:"button",onPointerDown:La,onClick:Z=>{Z.stopPropagation(),f()},title:`Згорнути панель (${en(ie.calloutTogglePanel,{isMac:E})})`,style:{position:"absolute",top:-uf/2,right:-uf/2,width:uf,height:uf,borderRadius:"50%",background:$g,border:H5,color:q5,cursor:"pointer",padding:0,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:$5},children:C.jsx("i",{className:`${Rr} bi-dash-lg`,style:{fontSize:sA},"aria-hidden":!0})}),C.jsxs("div",{style:{display:"flex",gap:zg,justifyContent:"center"},children:[ja.map(Z=>C.jsx("button",{type:"button",onPointerDown:La,onClick:lt=>{lt.stopPropagation(),d(t.id,Z)},title:Z,style:{width:po,height:po,borderRadius:"50%",background:Z,border:t.color===Z?Zd:dA,cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0}},Z)),L&&C.jsx("button",{type:"button",onPointerDown:La,onClick:Z=>{Z.stopPropagation(),p(t.id,H?"solid":"dashed")},onMouseDown:Z=>Z.preventDefault(),"aria-label":"Перемикач стилю обводки",title:H?"Змінити на суцільну обводку":"Змінити на пунктирну обводку",style:{width:po,height:po,borderRadius:"50%",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0,background:Bg,border:H?Zd:Fg,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:C.jsx("svg",{width:po-ff,height:po-ff,viewBox:"0 0 16 16","aria-hidden":!0,children:C.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:Hg,strokeWidth:Ug,strokeDasharray:hA})})}),R&&C.jsx("button",{type:"button",onPointerDown:La,onClick:Z=>{Z.stopPropagation(),g(t.id,$?"filled":"none")},onMouseDown:Z=>Z.preventDefault(),"aria-label":"Перемикач фону фігури",title:$?"Додати фон фігури":"Прибрати фон фігури",style:{width:po,height:po,borderRadius:"50%",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0,background:Bg,border:$?Zd:Fg,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:C.jsx("svg",{width:po-ff,height:po-ff,viewBox:"0 0 16 16","aria-hidden":!0,children:C.jsx("rect",{x:"3",y:"3",width:"10",height:"10",fill:"none",stroke:Hg,strokeWidth:Ug})})})]}),q&&C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:fp},children:[C.jsx("i",{className:`${Rr} bi-border-width`,style:{fontSize:qr,color:nh,flexShrink:0},"aria-hidden":!0}),C.jsx("input",{type:"range",min:hl,max:Nu,step:j0,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":mh,"--tyts-range-track":`${mA}px`,"--tyts-range-thumb":`${pA}px`,"--tyts-range-fill":`${Mt}%`}}),C.jsxs("span",{style:{color:nh,fontSize:gA,fontVariantNumeric:"tabular-nums",minWidth:yA,textAlign:"right",flexShrink:0},children:["×",I0(i)]}),ht&&C.jsx("button",{type:"button",onPointerDown:La,onMouseDown:Z=>Z.preventDefault(),onClick:Z=>{Z.stopPropagation(),b(t.id,null)},title:"Повернути глобальну товщину","aria-label":"Повернути глобальну товщину",style:bA,children:C.jsx("i",{className:`${Rr} bi-arrow-counterclockwise`,style:{fontSize:qr},"aria-hidden":!0})})]}),C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:fp},children:[C.jsxs("button",{type:"button",onPointerDown:La,onClick:Z=>{Z.stopPropagation(),y(t.id)},title:"Показати виноску",style:{...ep,flex:1},children:[C.jsx("i",{className:`${Rr} bi-chat-square-text`,style:{fontSize:qr},"aria-hidden":!0}),C.jsx("i",{className:`${Rr} bi-plus-lg`,style:{fontSize:qr},"aria-hidden":!0})]}),C.jsx("button",{type:"button",onPointerDown:La,onClick:Z=>{Z.stopPropagation(),A(t.id)},title:`Видалити (${en(ie.calloutDelete,{isMac:E})})`,style:np,children:C.jsx("i",{className:`${Rr} bi-trash`,style:{fontSize:qr},"aria-hidden":!0})})]})]})})});return l?ih.createPortal(gt,l):gt}),WB=I.memo(function({anchor:t,card:e,color:r,widthScale:i=1,points:s}){if(t.type==="standalone")return null;const l=J8(xg(t,e,s));return C.jsx("g",{children:C.jsx("path",{d:l,fill:"none",stroke:r,strokeWidth:H4*i,strokeLinecap:"round",strokeLinejoin:"round"})})}),w6=I.createContext(!0),Tk=8,Kh=8;function N5({anchorRef:n,label:t,hint:e,hotkeyParts:r}){const i=I.useRef(null),[s,l]=I.useState(null),c=r?.join(" ")??"",f=I.useContext(w6),[d,p]=I.useState(!1);if(I.useEffect(()=>{if(!f)return;const A=window.setTimeout(()=>p(!0),l8);return()=>window.clearTimeout(A)},[f]),I.useLayoutEffect(()=>{const A=n.current,E=i.current;if(!A||!E)return;const L=A.getBoundingClientRect(),R=E.getBoundingClientRect(),q=window.innerWidth,H=window.innerHeight,$=Math.min(Math.max(L.left+L.width/2-R.width/2,Kh),Math.max(Kh,q-R.width-Kh)),ht=L.bottom+Tk,Mt=ht+R.height<=H-Kh?ht:Math.max(Kh,L.top-Tk-R.height);l(wt=>wt&&wt.left===$&&wt.top===Mt?wt:{left:$,top:Mt})},[n,t,e,c,d]),!f||!d||typeof document>"u")return null;const g=!!r&&r.length>0,b=t||e,y=t&&e&&e!==t?e:null;return ih.createPortal(C.jsxs("div",{ref:i,role:"tooltip",style:{position:"fixed",left:s?.left??0,top:s?.top??0,visibility:s?"visible":"hidden",display:"flex",flexDirection:"column",gap:4,padding:"6px 10px",background:"rgba(0,0,0,0.9)",border:"1px solid rgba(255,255,255,0.08)",color:"#fff",borderRadius:6,fontSize:12,lineHeight:1.35,width:"max-content",maxWidth:320,zIndex:1e4,pointerEvents:"none",boxShadow:"0 4px 14px rgba(0,0,0,0.4)"},children:[(b||g)&&C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,justifyContent:"space-between"},children:[b&&C.jsx("span",{style:{fontWeight:t?700:400},children:b}),g&&C.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:3},children:r.map(A=>C.jsx(Bl,{children:A},A))})]}),y&&C.jsx("div",{style:{color:"rgba(255,255,255,0.65)"},children:y})]}),document.body)}function XB({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:A,movePinZ:E,copyPin:L,duplicatePin:R,pastePinFromClipboard:q,setMode:H,setPolygonDraft:$,setPolylineDraft:ht,setShapeDraftType:Mt,setPlacementTool:wt,setShowExportMenu:bt,beginCrop:ot,insertCurrentDateTimeText:Dt,toggleCompassMenu:Q,toggleImageObjectMenu:at,toggleCalloutPanel:G,newBgFileRef:vt,replaceBgFileRef:Tt,exportMenuOpenedViaHotkeyRef:gt}){I.useEffect(()=>{const Z=["range","checkbox","radio","button","color","file","submit","reset"],lt=_=>_?_.isContentEditable||_.tagName==="TEXTAREA"||Eg(_)?!0:_.tagName==="INPUT"?!Z.includes(_.type):!1:!1,Bt=_=>_.code==="NumpadAdd"||_.key==="+"||_.key==="="||_.code==="Equal"&&_.shiftKey,ee=_=>_.code==="NumpadSubtract"||_.code==="Minus"||_.key==="-"||_.key==="_",J=_=>{const K=_.target,V=n?_.metaKey:_.ctrlKey;if(V&&_.shiftKey&&!_.altKey&&_.code==="KeyH"){_.preventDefault(),G();return}if(!lt(K)){if(r&&!V&&!_.altKey&&!_.shiftKey){const ut=/^[1-9]$/.test(_.key)?Number(_.key):null;if(ut!=null){_.preventDefault();const xt=[];i&&xt.push(()=>{const{w:Ft}=s;if(!Ft)return;const Lt=i.w/Ft/2;p("png",Lt)}),xt.push(()=>p("png",1)),xt.push(()=>p("png",2)),xt.push(()=>p("jpeg",2)),xt.push(()=>g()),xt.push(()=>{t&&window.print()});const At=xt[ut-1];At&&(bt(!1),gt.current=!1,At());return}}if(V&&_.shiftKey&&_.code==="KeyV"){_.preventDefault(),q();return}if(V&&!_.shiftKey&&(_.code==="KeyC"||_.code==="KeyJ")){const ut=c??l;if(ut){_.preventDefault(),_.code==="KeyC"?L(ut):R(ut);return}}if(V&&(_.code==="BracketRight"||_.code==="BracketLeft")){const ut=c??l;if(ut){_.preventDefault();const xt=_.code==="BracketRight",At=_.shiftKey?xt?"front":"back":xt?"up":"down";E(ut,At);return}}if(V&&(_.code==="KeyZ"||_.key.toLowerCase()==="z")){_.preventDefault(),_.shiftKey?d():f();return}if(!n&&_.ctrlKey&&(_.code==="KeyY"||_.key.toLowerCase()==="y")){_.preventDefault(),d();return}if(V&&!_.shiftKey&&(_.code==="KeyD"||_.key.toLowerCase()==="d")){_.preventDefault(),t&&p("jpeg");return}if(V&&_.shiftKey&&_.code==="KeyD"){if(_.preventDefault(),!t)return;gt.current=!0,bt(!0);return}if((_.key==="Delete"||_.key==="Backspace")&&(c||l)){_.preventDefault(),A(c??l);return}if(V&&!_.altKey&&!_.shiftKey){if(_.code==="KeyN"){_.preventDefault(),vt.current?.click();return}if(_.code==="KeyB"){_.preventDefault(),(Tt.current??vt.current)?.click();return}if(_.code==="KeyO"){_.preventDefault(),t&&y();return}}if(t){if(!V&&!_.altKey&&!_.shiftKey){if(_.code==="Digit1"||_.code==="Numpad1"){_.preventDefault(),H("place"),$(null),ht(null),Mt(null),wt("point");return}if(_.code==="Digit0"||_.code==="Numpad0"||_.key==="0"){_.preventDefault(),H("place"),$(null),ht(null),Mt(null),wt("numbering");return}if(_.code==="Digit2"||_.code==="Numpad2"){_.preventDefault(),H("place"),$([]),ht(null),Mt(null);return}if(_.code==="Digit3"||_.code==="Numpad3"){_.preventDefault(),H("place"),$(null),ht([]),Mt(null);return}if(_.code==="Digit4"||_.code==="Numpad4"){_.preventDefault(),H("place"),$(null),ht(null),Mt("rectangle");return}if(_.code==="Digit5"||_.code==="Numpad5"){_.preventDefault(),H("place"),$(null),ht(null),Mt("ellipse"),wt("point");return}if(_.code==="Digit6"||_.code==="Numpad6"){_.preventDefault(),H("place"),$(null),ht(null),Mt(null),wt("text");return}if(_.code==="Digit7"||_.code==="Numpad7"){_.preventDefault(),H("place"),$(null),ht(null),Mt(null),wt("arrow");return}if(_.code==="Digit8"||_.code==="Numpad8"){_.preventDefault(),Dt();return}if(_.code==="Digit9"||_.code==="Numpad9"){_.preventDefault(),H("place"),$(null),ht(null),Mt(null),wt("standalone");return}if(_.code==="KeyK"){_.preventDefault(),Q();return}if(_.code==="KeyP"){_.preventDefault(),H("place"),$(null),ht(null),Mt(null),wt("pointText");return}if(_.code==="KeyR"){_.preventDefault(),H("place"),$(null),ht(null),Mt("redact");return}if(_.code==="KeyI"){_.preventDefault(),at();return}if(_.code==="KeyC"){_.preventDefault(),ot();return}}if(!V&&!_.altKey){if(Bt(_)){_.preventDefault(),b("in");return}if(ee(_)){_.preventDefault(),b("out");return}}}}};return window.addEventListener("keydown",J,!0),()=>window.removeEventListener("keydown",J,!0)},[t,e,f,d,l,c,r,i,s,p,g,b,y,n,A,E,L,R,q,H,$,ht,Mt,wt,bt,ot,Dt,Q,at,G,vt,Tt,gt])}function GB(){return{past:[],future:[]}}function Eb(n){return n.map(t=>({x:t.x,y:t.y}))}function KB(n){n.past=[],n.future=[]}function JB(n,t,e=100){n.past.push(Eb(t)),n.past.length>e&&n.past.shift(),n.future=[]}function ZB(n,t){if(n.past.length===0)return null;const e=n.past.pop();return n.future.push(Eb(t)),e}function QB(n,t){if(n.future.length===0)return null;const e=n.future.pop();return n.past.push(Eb(t)),e}const t9=100;function e9(){const n=I.useRef(GB()),[t,e]=I.useState(!1),[r,i]=I.useState(!1),s=I.useCallback(()=>{e(n.current.past.length>0),i(n.current.future.length>0)},[]),l=I.useCallback(()=>{KB(n.current),e(!1),i(!1)},[]),c=I.useCallback(p=>{JB(n.current,p,t9),s()},[s]),f=I.useCallback(p=>{const g=ZB(n.current,p);return s(),g},[s]),d=I.useCallback(p=>{const g=QB(n.current,p);return s(),g},[s]);return{canUndo:t,canRedo:r,reset:l,record:c,undo:f,redo:d}}const Tb="tyts-collage-autosave",n9=2e3,r9=.82;function mr(n){return typeof n=="number"&&Number.isFinite(n)}function S6(n){if(!n||typeof n!="object")return!1;const t=n;return mr(t.w)&&mr(t.h)&&t.w>0&&t.h>0}function i9(n){return n===null?!0:S6(n)}function o9(n){if(!n||typeof n!="object")return!1;const t=n;return mr(t.x)&&mr(t.y)&&mr(t.width)&&mr(t.height)&&t.width>0&&t.height>0}function tf(n){if(!n||typeof n!="object")return!1;const t=n;return mr(t.x)&&mr(t.y)}function s9(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 tf(t);case"linked":{const e=t.pinId;return typeof e=="string"&&e.length>0}case"numbering":return tf(t.start)&&tf(t.end);case"polygon":case"polyline":{const e=t.points;return Array.isArray(e)&&e.every(tf)}case"arrow":{const e=t;return tf(e.start)&&tf(e.end)&&tf(e.control)}case"rectangle":{const e=t;return mr(e.x)&&mr(e.y)&&mr(e.width)&&mr(e.height)}case"ellipse":{const e=t;return mr(e.cx)&&mr(e.cy)&&mr(e.rx)&&mr(e.ry)}case"compass":{const e=t;return mr(e.cx)&&mr(e.cy)&&mr(e.radius)&&e.radius>0}case"redact":{const e=t;return mr(e.x)&&mr(e.y)&&mr(e.width)&&mr(e.height)&&mr(e.strength)&&(e.mode==="blur"||e.mode==="pixelate"||e.mode==="fill")}case"image":{const e=t;return mr(e.x)&&mr(e.y)&&mr(e.width)&&mr(e.height)&&mr(e.aspect)&&typeof e.src=="string"&&e.src.length>0}case"text":{const e=t;return e.point!==void 0&&!tf(e.point)?!1:mr(e.x)&&mr(e.y)&&mr(e.width)&&mr(e.height)}default:return!1}}function a9(n){if(!n||typeof n!="object")return!1;const t=n;return typeof t.id!="string"||!t.id||typeof t.color!="string"||!t.color||!mr(t.label)||t.label<1||typeof t.description!="string"||t.descPos!=="above"&&t.descPos!=="below"||t.image!==null&&typeof t.image!="string"||t.imageAspect!==null&&t.imageAspect!==void 0&&!mr(t.imageAspect)?!1:s9(t.anchor)}function k6(n){return A6(n)?n:null}function A6(n){if(!n||typeof n!="object")return!1;const t=n;return t.version!==1&&t.version!==2||!mr(t.savedAt)||t.sourceUrl!==void 0&&typeof t.sourceUrl!="string"||t.sourceTitle!==void 0&&typeof t.sourceTitle!="string"||t.capturedAt!==void 0&&!mr(t.capturedAt)||typeof t.backgroundImage!="string"||!t.backgroundImage.startsWith("data:")||!S6(t.imageSize)||!i9(t.sourceImageSize??null)||!Array.isArray(t.pins)||!t.pins.every(a9)||!t.cardPositions||typeof t.cardPositions!="object"?!1:Object.values(t.cardPositions).every(o9)}function l9(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 c9(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 u9(n){if(n.startsWith("data:"))return n;if(n.startsWith("blob:"))try{const e=await(await fetch(n)).blob();return c9(e)}catch{return null}return n}async function f9(n,t=n9,e=r9){try{const r=await l9(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 Nk(n){try{return localStorage.setItem(Tb,JSON.stringify(n)),!0}catch(t){if(t instanceof DOMException&&t.name==="QuotaExceededError")return!1;throw t}}function m2(){try{const n=localStorage.getItem(Tb);if(!n)return null;const t=JSON.parse(n);return A6(t)?t:null}catch{return null}}function d9(){localStorage.removeItem(Tb)}async function h9(n){const t=await u9(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(Nk(e))return{ok:!0,compressed:!1};const r=await f9(t);if(!r)return{ok:!1,error:"quota"};const i={...e,backgroundImage:r};return Nk(i)?{ok:!0,compressed:!0}:{ok:!1,error:"quota"}}const p9=800,m9=2e3;function _k(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 g9({state:n,onRestore:t,enabled:e=!0}){const[r,i]=I.useState("idle"),[s,l]=I.useState(null),[c,f]=I.useState(null),[d,p]=I.useState(()=>m2()),[g,b]=I.useState(!1),[y,A]=I.useState(!1),E=I.useRef(t),L=I.useRef(n),R=I.useRef(null),q=I.useRef(!1),H=I.useRef(!1),$=I.useRef(null),ht=I.useRef(null),Mt=I.useRef(async()=>!1);I.useEffect(()=>{E.current=t,L.current=n});const wt=I.useCallback(async(vt=!1)=>{if(!e)return!1;const Tt=L.current;if(!Tt.backgroundImage)return!1;const gt=_k(Tt);if(!gt)return!1;if(!vt&>===R.current)return!0;if(q.current)return H.current=!0,!1;q.current=!0,i("saving"),f(null);const Z=await h9({backgroundImage:Tt.backgroundImage,imageSize:Tt.imageSize,sourceImageSize:Tt.sourceImageSize,pins:Tt.pins,cardPositions:Tt.cardPositions,sourceUrl:Tt.sourceUrl,sourceTitle:Tt.sourceTitle,capturedAt:Tt.capturedAt});if(q.current=!1,!Z.ok){const Bt=Z.error==="quota"?"Чернетка занадто велика для localStorage":"Не вдалося зберегти чернетку";return i("error"),f(Bt),!1}R.current=gt;const lt=Date.now();return l(lt),i("saved"),p(m2()),A(!0),ht.current&&clearTimeout(ht.current),ht.current=setTimeout(()=>A(!1),m9),H.current&&(H.current=!1,queueMicrotask(()=>{Mt.current()})),!0},[e]);I.useEffect(()=>{Mt.current=wt},[wt]);const bt=I.useCallback(()=>{e&&L.current.backgroundImage&&($.current&&clearTimeout($.current),$.current=setTimeout(()=>{$.current=null,Mt.current()},p9))},[e]),ot=I.useCallback(()=>{e&&(d9(),p(null),b(!0),R.current=null,i("idle"),l(null),f(null),A(!1))},[e]),Dt=I.useCallback(()=>{const vt=m2();return vt?(E.current(vt),R.current=_k({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)},[]),Q=I.useCallback(()=>{b(!0)},[]);I.useEffect(()=>{e&&n.backgroundImage&&bt()},[e,n.backgroundImage,n.imageSize,n.sourceImageSize,n.pins,n.cardPositions,n.sourceUrl,n.sourceTitle,n.capturedAt,bt]),I.useEffect(()=>{if(!e)return;const vt=()=>{$.current&&(clearTimeout($.current),$.current=null),Mt.current()},Tt=()=>vt(),gt=()=>{document.visibilityState==="hidden"&&vt()};return window.addEventListener("beforeunload",Tt),document.addEventListener("visibilitychange",gt),()=>{window.removeEventListener("beforeunload",Tt),document.removeEventListener("visibilitychange",gt),$.current&&clearTimeout($.current),ht.current&&clearTimeout(ht.current)}},[e]);const at=e&&d!==null,G=e&&at&&!n.backgroundImage;return{status:r,lastSavedAt:s,errorMessage:c,hasStoredDraft:at,canRestore:G,showRestorePrompt:G&&!g,storedDraftSavedAt:d?.savedAt??null,saveFlash:y,saveNow:wt,restoreDraft:Dt,clearDraft:ot,dismissRestorePrompt:Q}}function y9(n){return new Promise((t,e)=>{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>e(r.error),r.readAsDataURL(n)})}function b9(n){return new Promise((t,e)=>{const r=new Image;r.onload=()=>t(r.naturalWidth/r.naturalHeight),r.onerror=()=>e(new Error("image load failed")),r.src=n})}function x9(){const[n,t]=I.useState([]),e=I.useRef(n);I.useEffect(()=>{e.current=n},[n]);const r=I.useCallback(async f=>{const p=(await Promise.all(f.map(async g=>{try{const b=await y9(g),y=await b9(b);return{id:Oa(),image:b,imageAspect:y,text:""}}catch{return null}}))).filter(g=>g!==null);p.length&&t(g=>[...g,...p])},[]),i=I.useCallback((f="")=>{const d=Oa();return t(p=>[...p,{id:d,image:null,imageAspect:null,text:f}]),d},[]),s=I.useCallback((f,d)=>{t(p=>p.map(g=>g.id===f?{...g,text:d}:g))},[]),l=I.useCallback(f=>{t(d=>d.filter(p=>p.id!==f))},[]),c=I.useCallback(f=>e.current.find(d=>d.id===f)??null,[]);return{items:n,addImageFiles:r,addText:i,updateText:s,remove:l,getItem:c}}const v9=320,w9="rgba(10,10,16,0.97)",Bp="1px solid rgba(255,255,255,0.12)",S9="rgba(255,255,255,0.04)",k9="rgb(0, 102, 204)",Ap="rgba(255,255,255,0.55)",A9=220,Dk={display:"inline-flex",alignItems:"center",gap:6,height:28,padding:"0 10px",borderRadius:6,border:Bp,background:"rgba(255,255,255,0.06)",color:"#fff",fontSize:13,cursor:"pointer"},M6={width:26,height:26,display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none",borderRadius:6,background:"transparent",color:Ap,cursor:"pointer"};function M9({items:n,onAddImageFiles:t,onAddText:e,onUpdateText:r,onRemove:i,onClose:s}){const l=I.useRef(null),c=I.useRef(null),[f,d]=I.useState(!1),p=I.useRef(null),g=I.useRef(new Map);I.useEffect(()=>{c.current?.focus({preventScroll:!0})},[]),I.useEffect(()=>{const A=p.current;if(!A)return;const E=g.current.get(A);E&&(p.current=null,E.focus())},[n]);const b=A=>{const E=T5(A.clipboardData);if(E.length){A.preventDefault(),t(E);return}if(A.target!==c.current)return;const L=A.clipboardData.getData("text/plain");A.preventDefault(),L.trim()&&e(L)},y=A=>A.dataTransfer.types.includes("Files");return C.jsxs("aside",{[b6]:"","aria-label":"Медіа",style:{width:v9,flex:"none",minHeight:0,display:"flex",flexDirection:"column",background:w9,borderLeft:Bp,color:"#fff",fontSize:13,position:"relative",outline:f?`2px dashed ${k9}`:"none",outlineOffset:-4},onClick:A=>A.stopPropagation(),onPointerDown:A=>{A.target.closest("textarea, input, button")||c.current?.focus({preventScroll:!0})},onPaste:b,onDragOver:A=>{y(A)&&(A.preventDefault(),A.stopPropagation(),A.dataTransfer.dropEffect="copy",d(!0))},onDragLeave:A=>{A.currentTarget.contains(A.relatedTarget)||d(!1)},onDrop:A=>{if(!y(A))return;A.preventDefault(),A.stopPropagation(),d(!1);const E=T5(A.dataTransfer);E.length&&t(E)},children:[C.jsx("input",{ref:c,type:"text","aria-label":"Вставте зображення або текст з буфера",value:"",onChange:()=>{},style:{position:"absolute",width:1,height:1,opacity:0,pointerEvents:"none",top:0,left:0}}),C.jsx("input",{ref:l,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:A=>{const E=Array.from(A.target.files??[]);A.target.value="",E.length&&t(E)}}),C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",borderBottom:Bp},children:[C.jsx("strong",{style:{fontSize:14,fontWeight:600},children:"Медіа"}),n.length>0&&C.jsx("span",{style:{color:Ap},children:n.length}),C.jsx("span",{style:{flex:1}}),C.jsxs("button",{type:"button",style:Dk,onClick:()=>l.current?.click(),title:"Додати картинки",children:[C.jsx("i",{className:"bi bi-image","aria-hidden":!0})," Картинка"]}),C.jsxs("button",{type:"button",style:Dk,onClick:()=>{p.current=e()},title:"Додати текст",children:[C.jsx("i",{className:"bi bi-fonts","aria-hidden":!0})," Текст"]}),C.jsx("button",{type:"button",style:M6,onClick:s,title:"Закрити панель","aria-label":"Закрити панель",children:C.jsx("i",{className:"bi bi-x-lg","aria-hidden":!0})})]}),C.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto",padding:12,display:"flex",flexDirection:"column",gap:10},children:n.length===0?C.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10,padding:20,border:"1px dashed rgba(255,255,255,0.2)",borderRadius:10,color:Ap,textAlign:"center",lineHeight:1.45},children:[C.jsx("i",{className:"bi bi-images",style:{fontSize:28},"aria-hidden":!0}),C.jsxs("div",{children:["Перетягніть сюди картинки, вставте їх (⌘V / Ctrl+V) або додайте кнопкою.",C.jsx("br",{}),"Потім перетягуйте елементи на виноски — фото й текст підставляться в картку."]})]}):C.jsxs(C.Fragment,{children:[C.jsx("div",{style:{color:Ap,lineHeight:1.4},children:"Тягніть елемент за картинку на виноску: фото й текст замінять наявні."}),n.map(A=>C.jsx(C9,{item:A,textareaRef:E=>{E?g.current.set(A.id,E):g.current.delete(A.id)},onUpdateText:r,onRemove:i},A.id))]})})]})}function C9({item:n,textareaRef:t,onUpdateText:e,onRemove:r}){const i=I.useRef(null),[s,l]=I.useState(!1);return C.jsxs("div",{ref:i,"data-testid":"media-item",style:{position:"relative",display:"flex",flexDirection:"column",gap:8,padding:8,borderRadius:8,background:S9,border:Bp,opacity:s?.5:1},children:[C.jsx("div",{draggable:!0,title:"Перетягніть на виноску",onDragStart:c=>{c.dataTransfer.setData(E5,n.id),c.dataTransfer.effectAllowed="copy",i.current&&c.dataTransfer.setDragImage(i.current,20,20),l(!0)},onDragEnd:()=>l(!1),style:{width:"100%",borderRadius:6,cursor:"grab",display:"flex",alignItems:"center",justifyContent:"center",gap:6,color:Ap,...n.image?{aspectRatio:n.imageAspect?String(n.imageAspect):"4 / 3",maxHeight:A9,background:`url("${n.image}") center/contain no-repeat, rgba(0,0,0,0.3)`}:{height:28,background:"rgba(255,255,255,0.06)"}},children:!n.image&&C.jsxs(C.Fragment,{children:[C.jsx("i",{className:"bi bi-grip-horizontal",style:{fontSize:16},"aria-hidden":!0}),C.jsx("span",{style:{fontSize:12},children:"Тягніть на виноску"})]})}),C.jsx("textarea",{ref:t,value:n.text,placeholder:n.image?"Підпис (необовʼязково)":"Текст виноски",onChange:c=>e(n.id,c.target.value),rows:2,style:{width:"100%",minHeight:44,resize:"vertical",boxSizing:"border-box",padding:"6px 8px",borderRadius:6,border:Bp,background:"rgba(0,0,0,0.35)",color:"#fff",font:"inherit",lineHeight:1.4}}),C.jsx("button",{type:"button",style:{...M6,position:"absolute",top:12,right:12,color:"#fff",background:"rgba(0,0,0,0.6)"},onClick:()=>r(n.id),title:"Прибрати з панелі","aria-label":"Прибрати з панелі",children:C.jsx("i",{className:"bi bi-trash3","aria-hidden":!0})})]})}const Nb=1;function E9(n){if(!n||typeof n!="object")return!1;const t=n;if(t.version!==Nb)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 k6(e)!==null}function Lk(n){if(E9(n))return n;const t=k6(n);return t?T9(t):null}function T9(n){return{version:Nb,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 N9(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 _9(n){return!n.backgroundImage||!n.imageSize.w?null:{version:Nb,backgroundImage:n.backgroundImage,imageSize:n.imageSize,sourceImageSize:n.sourceImageSize,pins:n.pins,cardPositions:n.cardPositions,settings:n.settings,meta:n.meta??void 0}}function D9(n){return`${n.length}:${n.slice(0,64)}:${n.slice(-64)}`}function L9(n){return JSON.stringify({...n,backgroundImage:D9(n.backgroundImage)})}async function R9(n){if(typeof n=="string")return n;const t=await O9(n);if(!t)throw new Error("Failed to read image");return t}async function O9(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 g2=1;function P9(n){if(!n||typeof n!="object")return!1;const t=n;return typeof t.type=="string"&&t.type.startsWith("tyts:")}const j9=250;function I9(){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 z9(n){return(n??[]).map(t=>t.trim()).filter(Boolean)}function Pl(n,t){return{code:n,message:t}}function Rk(n,t){return n instanceof Error?n.message:t}function B9(n){const t=n.transport===void 0?I9():n.transport,e=z9(n.config?.allowedOrigins),r=e.length===0||e.includes("*"),i=n.config?.token||void 0,s=n.changeDebounceMs??j9;let l=null,c=!1,f=null,d=null;const p=(q,H)=>{c||t?.post(q,H)},g=(q,H,$)=>{n.onError?.(H),p({type:"tyts:error",requestId:q,error:H},$)},b=q=>r||e.includes(q),y=()=>{if(f=null,!d||l===null)return;const q=d;d=null,p({type:"tyts:change",document:q.document,dirty:q.dirty},l)},A=()=>{l===null||c||(f&&clearTimeout(f),f=setTimeout(y,s))},E=(q,H)=>{if(!b(H)){g(q.requestId,Pl("origin_denied",`Origin not allowed: ${H}`),H);return}if(q.protocol!==g2){g(q.requestId,Pl("protocol_mismatch","Unsupported embed protocol version"),H);return}if(i&&q.token!==i){g(q.requestId,Pl("invalid_token","Invalid embed token"),H);return}l=H,(async()=>{try{if(q.document){const $=Lk(q.document);if(!$){g(q.requestId,Pl("invalid_document","Invalid initial document"),H);return}await n.editor.loadDocument($)}p({type:"tyts:initialized",requestId:q.requestId,protocol:g2},H),n.onReady?.(),d&&A()}catch($){g(q.requestId,Pl("init_failed",Rk($,"Init failed")),H)}})()},L=async(q,H)=>{switch(q.type){case"tyts:loadDocument":{const $=Lk(q.document);if(!$){g(q.requestId,Pl("invalid_document","Invalid document"),H);return}await n.editor.loadDocument($),q.requestId&&p({type:"tyts:done",requestId:q.requestId},H);return}case"tyts:loadImage":await n.editor.loadImage(q.dataUrl),q.requestId&&p({type:"tyts:done",requestId:q.requestId},H);return;case"tyts:getDocument":p({type:"tyts:document",requestId:q.requestId,document:n.editor.getDocument()},H);return;case"tyts:export":{if(q.format==="pdf"){const ht=await n.editor.exportPdf();if(!ht){g(q.requestId,Pl("export_failed","PDF export failed"),H);return}const Mt=await U9(ht);p({type:"tyts:exportResult",requestId:q.requestId,format:"pdf",mime:"application/pdf",dataUrl:Mt},H);return}const $=await n.editor.exportImage(q.format,q.scale??1);if(!$){g(q.requestId,Pl("export_failed","Image export failed"),H);return}p({type:"tyts:exportResult",requestId:q.requestId,format:q.format,mime:$.mime,dataUrl:$.dataUrl},H);return}case"tyts:markSaved":n.editor.markSaved(),q.requestId&&p({type:"tyts:done",requestId:q.requestId},H);return;case"tyts:reset":n.editor.reset(),q.requestId&&p({type:"tyts:done",requestId:q.requestId},H);return;case"tyts:init":return;default:{const $=q;g($.requestId,Pl("unknown_message",`Unknown message: ${$.type}`),H)}}};return{handleMessage:q=>{if(c||!t||q.source!==t.parentWindow||!P9(q.data))return;const H=q.data,$="requestId"in H?H.requestId:void 0;if(H.type==="tyts:init"){E(H,q.origin);return}if(l===null){g($,Pl("not_initialized","Editor is not initialized"),q.origin);return}if(q.origin!==l){g($,Pl("origin_denied",`Origin not allowed: ${q.origin}`),q.origin);return}L(H,l).catch(ht=>{g($,Pl("handler_error",Rk(ht,"Handler error")),q.origin)})},notifyChange(q,H){d={document:q,dirty:H},A()},announceReady(){const q={type:"tyts:ready",protocol:g2};if(r){p(q,"*");return}for(const H of e)p(q,H)},stop(){c=!0,f&&clearTimeout(f),f=null,d=null}}}function F9(n){const t=B9(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 U9(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 H9={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_TYTS_EMBED:"1",VITE_UAF_SANS:"0"};function q9(){return!0}function $9(n=H9){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 td(){return typeof window>"u"||window.location.protocol!=="chrome-extension:"?!1:!!globalThis.chrome?.runtime?.id}function Y9(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 C6(n){const t=new URL(window.location.href);t.searchParams.delete(n),window.history.replaceState(null,"",t.toString())}function V9(){return td()?new URLSearchParams(window.location.search).has("capture"):!1}function W9(){if(!td())return!1;const n=new URLSearchParams(window.location.search).get("restore")==="1";return n&&C6("restore"),n}async function X9(){if(!td())return null;const n=new URLSearchParams(window.location.search).get("capture");if(!n)return null;C6("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),Y9(i)?i:null}catch{}return null}const Ok="tyts-ext-settings",Jh={downloadSubfolder:"Tyts",saveAs:!1};function G9(n){return n.trim().replace(/[/\\]/g,"").replace(/\.\./g,"").replace(/[<>:"|?*]/g,"").slice(0,60)}async function K9(){if(!td())return{...Jh};try{const n=(await chrome.storage.sync.get(Ok))[Ok];if(!n||typeof n!="object")return{...Jh};const t=n;return{downloadSubfolder:typeof t.downloadSubfolder=="string"?G9(t.downloadSubfolder):Jh.downloadSubfolder,saveAs:typeof t.saveAs=="boolean"?t.saveAs:Jh.saveAs}}catch{return{...Jh}}}const $n="bi",tr=14,J9=2800,Z9=.5,Q9=250,tF=16*pi,eF={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},nF=400,rF=6,iF=1500,oF=150;function y2(n){return T5(n)[0]??null}const Pk=96,jk=44,ue=pi,sn=pi*I5,Zh=n=>`${zf[0]*n} ${zf[1]*n}`;async function Ik(n,t){try{const e=await K9(),r=e.downloadSubfolder?`${e.downloadSubfolder}/${t}`:t;return await chrome.downloads.download({url:n,filename:r,saveAs:e.saveAs}),!0}catch{return!1}}function zk(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 vu=ja[0];function sF(n){return n.filter(t=>t.anchor.type==="numbering").length+1}function ef(n){return n.filter(t=>t.anchor.type!=="numbering"&&t.anchor.type!=="linked").length+1}function Bk(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 aF(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 Fk(n,t){return{x:t.x-n.x,y:t.y-n.y}}const E6=5.25*ue,fg=18*sn,b2=6*sn,Uk={fontSize:12*sn,color:"#aaa",flexShrink:0},Qh={minWidth:28*sn,height:28*sn,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.18)",color:"#ccc",cursor:"pointer",borderRadius:4*sn,fontSize:16*sn,padding:`${3*sn}px ${8*sn}px`,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center"},jl=4*ue,lF=22*ue,cF=18*ue,uF=12*ue,x2=5*ue;function Id(n,t,e,r=1,i=[]){const s=lF*r,l=E6*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 v2(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>=cF*e)return l;const[f,d]=r[l.handle],p=uF*e*s(l.handle);return{...l,cx:l.cx+f*p,cy:l.cy+d*p}})}function zd({color:n,scale:t=1}){const e=E6*t,r=`M 0 ${-e} L ${e} 0 L 0 ${e} L ${-e} 0 Z`;return C.jsx("path",{d:r,fill:n,stroke:"#fff",strokeWidth:1.5*ue*t})}function Hk(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 fF=new Set(["jpg","jpeg","png","webp","gif","bmp","svg","avif","heic","heif"]),dF=15e3;function _5(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 fF.has(e)}function hF(n,t,e=dF){const r=Math.max(n,t);return r<=e?null:`Зображення завелике (${r} px по довгій стороні). Зменште до ${e} px або менше.`}async function pF(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,qk=[{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 w2(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 mF=I.forwardRef(function(t,e){const{mode:r="standalone",initialDocument:i,embedConfig:s,features:l,onReady:c,onChange:f,onError:d}=t,p=r==="embed"||q9(),g=I.useMemo(()=>({autosave:l?.autosave??!p}),[p,l]),b=cd(),y=typeof window<"u"&&(navigator.maxTouchPoints>0||window.matchMedia?.("(pointer: coarse)").matches===!0),A=typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent),[E,L]=I.useState(null),[R,q]=I.useState(null),[H,$]=I.useState(!1),[ht,Mt]=I.useState("free"),[wt,bt]=I.useState(!1),[ot,Dt]=I.useState(null),[Q,at]=I.useState(!1),[G,vt]=I.useState({w:0,h:0}),[Tt,gt]=I.useState(null),[Z,lt]=I.useState([]),[Bt,ee]=I.useState({}),[J,_]=I.useState("select"),[K,V]=I.useState(null),[ut,xt]=I.useState(null),[At,Ft]=I.useState(null),[Lt,Zt]=I.useState(null),{canUndo:ve,canRedo:je,reset:Pe,record:We,undo:ct,redo:Le}=e9(),Pn=I.useRef(We);Pn.current=We;const fe=At!==null?"polygon":Lt!==null?"polyline":"none",ye=I.useRef(fe);I.useEffect(()=>{ye.current!==fe&&(Pe(),ye.current=fe)},[fe,Pe]);const[Te,Ne]=I.useState(null),[_e,Ue]=I.useState("point"),[cn,In]=I.useState(null),[Fe,_n]=I.useState(null),dn=I.useRef(null),[ze,Xe]=I.useState(null),[Ie,kr]=I.useState(null),wn=I.useRef(null),nn=I.useRef(null);I.useEffect(()=>{nn.current=ot},[ot]);const ln=I.useRef(null),[Ln,Ze]=I.useState(!1),ur=I.useRef(!1),[gn,xn]=I.useState(!1),[gr,Mn]=I.useState(!1),[Ke,Vn]=I.useState(()=>new Date),[ss,Ei]=I.useState(()=>Bf(new Date)),[Qt,Re]=I.useState(I2),[Me,Oe]=I.useState(!1),[Xn,Bn]=I.useState(null);I.useEffect(()=>{(_e!=="numbering"||J!=="place")&&cn&&(In(null),_n(null),dn.current=null)},[_e,J,cn]);const{settings:or,fontFamily:Fn,setFontId:si,setStrokeWidthScale:mi,setShowToolTooltips:Wt,toggleCalloutPanelCollapsed:ai}=h8(),Ar=or.calloutPanelCollapsed,er=I.useRef(Fn);er.current=Fn;const Ti=or.strokeWidthScale,Yo=I.useRef(Ti);Yo.current=Ti;const li=I.useCallback(w=>yS(w,Ti),[Ti]),[Or,ta]=I.useState(!1),[ea,fa]=I.useState(!1),[as,Bo]=I.useState(!1),[gl,na]=I.useState(!1),Wr=x9(),dc=Wr.getItem;I.useEffect(()=>{if(!as)return;const w=S=>{S.key==="Escape"&&Bo(!1)};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[as]);const[Ls,da]=I.useState(!1),[ha,hc]=I.useState(!1),[yl,pc]=I.useState(!1),$l=typeof window<"u"&&!!navigator.clipboard&&"ClipboardItem"in window,[Wi,Xi]=I.useState(null),[Vo,fr]=I.useState(null),[mc,pa]=I.useState({w:420*sn,h:96*sn}),Fa=I.useRef(null),ma=I.useRef(null),Xr=I.useRef(null),Fo=I.useRef(!1),Mr=I.useRef([]),Br=I.useRef([]),Fr=I.useRef(Z),ls=I.useRef(Bt),Di=I.useRef(E),Wo=I.useRef(null),Zn=I.useRef(G),Xo=I.useRef(Tt);I.useEffect(()=>{Fr.current=Z,ls.current=Bt},[Z,Bt]),I.useEffect(()=>{Di.current=E},[E]),I.useEffect(()=>{Zn.current=G},[G]),I.useEffect(()=>{Xo.current=Tt},[Tt]);const Ua=20;function cs(w){const S=U4,N=P2,{w:D,h:j}=Zn.current;let X,tt;if(w.type==="linked")X=0,tt=0;else if(w.type==="point")X=w.x,tt=w.y;else if(w.type==="polygon"||w.type==="polyline"){const ft=w.points;X=Math.max(...ft.map(it=>it.x)),tt=Math.max(...ft.map(it=>it.y))}else w.type==="rectangle"?(X=w.x+w.width,tt=w.y+w.height):w.type==="ellipse"?(X=w.cx+w.rx,tt=w.cy+w.ry):w.type==="compass"?(X=w.cx+w.radius,tt=w.cy+w.radius):w.type==="arrow"?(X=Math.max(w.start.x,w.end.x,w.control.x),tt=Math.max(w.start.y,w.end.y,w.control.y)):w.type==="numbering"?(X=Math.max(w.start.x,w.end.x),tt=Math.max(w.start.y,w.end.y)):w.type==="text"||w.type==="image"?(X=w.x+w.width,tt=w.y+w.height):(X=w.x,tt=w.y);let U=X+Ua,nt=tt+Ua;return U=Math.max(0,Math.min(U,Math.max(0,D-S))),nt=Math.max(0,Math.min(nt,Math.max(0,j-N))),{x:U,y:nt,width:S,height:N}}const te=I.useCallback(()=>{const w={pins:structuredClone(Fr.current),cardPositions:structuredClone(ls.current),backgroundImage:Di.current,imageSize:structuredClone(Zn.current),sourceImageSize:structuredClone(Xo.current)};Mr.current=[...Mr.current.slice(-99),w],Br.current=[],bl(Mr.current.length),No(0)},[]),[Hc,bl]=I.useState(0),[Mf,No]=I.useState(0),us=At!==null||Lt!==null,ga=us?ve:Hc>0,qc=us?je:Mf>0,fs=I.useCallback(()=>{if(Mr.current.length===0)return;Br.current=[{pins:structuredClone(Fr.current),cardPositions:structuredClone(ls.current),backgroundImage:Di.current,imageSize:structuredClone(Zn.current),sourceImageSize:structuredClone(Xo.current)},...Br.current];const w=Mr.current.pop();lt(w.pins),ee(w.cardPositions),L(w.backgroundImage),vt(w.imageSize),gt(w.sourceImageSize),bl(Mr.current.length),No(Br.current.length)},[]),yn=I.useCallback(()=>{if(Br.current.length===0)return;Mr.current=[...Mr.current,{pins:structuredClone(Fr.current),cardPositions:structuredClone(ls.current),backgroundImage:Di.current,imageSize:structuredClone(Zn.current),sourceImageSize:structuredClone(Xo.current)}];const w=Br.current.shift();lt(w.pins),ee(w.cardPositions),L(w.backgroundImage),vt(w.imageSize),gt(w.sourceImageSize),bl(Mr.current.length),No(Br.current.length)},[]),Yl=I.useCallback(()=>{if(At!==null){const w=ct(At);w!==null&&Ft(w);return}if(Lt!==null){const w=ct(Lt);w!==null&&Zt(w);return}fs()},[At,Lt,fs,ct]),xl=I.useCallback(()=>{if(At!==null){const w=Le(At);w!==null&&Ft(w);return}if(Lt!==null){const w=Le(Lt);w!==null&&Zt(w);return}yn()},[At,Lt,yn,Le]),gc=I.useRef(null),ya=I.useRef(null),Rs=I.useRef(null),Os=I.useRef(()=>{}),Go=I.useRef(null),Ps=I.useRef(null),Nr=I.useRef(null),ra=I.useRef(null),Ha=I.useRef(!1),_o=I.useRef(null),qa=I.useRef(null),js=I.useRef(null),Li=I.useRef(null),Ko=I.useRef(null),Jo=I.useRef(null),Is=I.useRef(null),ia=I.useRef(null),ba=I.useRef(null),zs=I.useRef(null),oa=I.useRef(null),Bs=I.useRef(null),$a=I.useRef(null),Fs=I.useRef(null),Us=I.useRef(null),Vl=I.useRef(null),Ya=I.useRef(null),Wl=I.useRef(null),xa=I.useRef(null),Xl=I.useRef(null),M=I.useRef(null),B=I.useRef(null),dt=I.useRef(null),Et=I.useRef(null),zt=I.useRef(null),se=I.useRef(null),me=I.useRef(null),Qe=I.useRef(null),on=I.useRef(null),Rn=I.useRef(null),Un=I.useRef(null);I.useEffect(()=>{Un.current=At},[At]);const sr=I.useRef(null),Fi=I.useRef(null),Ni=I.useRef(null),Pr=I.useRef(null),ci=I.useRef(null),gi=I.useRef(null),yi=I.useRef(null),eo=I.useRef(null),Hs=I.useRef(null),yc=I.useRef(null);I.useEffect(()=>{yc.current=Lt},[Lt]),I.useEffect(()=>{ln.current=ze},[ze]),I.useEffect(()=>{dn.current=cn&&Fe?{start:cn,end:Fe}:null},[cn,Fe]);const ge=I.useRef(!1),Zo=20,ds=10,Tn=20,[Nn,Gl]=I.useState(!1),[Gi,vl]=I.useState(!1),[ar,va]=I.useState(1),[wa,no]=I.useState(!1),[$c,Va]=I.useState(null);I.useEffect(()=>{if(!E){Va(null);return}let w=!1;const S=new Image;return S.onload=()=>{w||Va(S)},S.onerror=()=>{w||Va(null)},S.src=E,()=>{w=!0}},[E]),I.useLayoutEffect(()=>{const w=Fa.current;if(!w)return;const S=()=>{const j=Math.max(1,Math.ceil(w.getBoundingClientRect().width),Math.ceil(w.scrollWidth)),X=Math.max(1,Math.ceil(w.getBoundingClientRect().height),Math.ceil(w.scrollHeight));pa(tt=>tt.w!==j||tt.h!==X?{w:j,h:X}:tt)};S();const N=requestAnimationFrame(S),D=new ResizeObserver(S);return D.observe(w),()=>{cancelAnimationFrame(N),D.disconnect()}},[K,ut,Vo]);const Wa=I.useRef(null),Ki=I.useRef(null),wl=I.useRef(null),Xa=I.useRef(null),Sl=I.useRef(null),Ga=I.useRef(null),kl=I.useRef(null),ro=I.useRef(null),[io,hs]=I.useState(!1),[Sa,ka]=I.useState(!1),Kl=I.useRef(null),Uo=I.useRef({isPanning:!1,startX:0,startY:0,startScrollLeft:0,startScrollTop:0}),yr=I.useRef(new Map),bc=I.useRef(null),_r=I.useRef(!0),go=I.useRef(null),Ka=I.useRef(1),Al=I.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];go.current="viewport-center",va(N=>{const D=Math.min(S[S.length-1],Math.max(S[0],N));let j=0;for(let U=1;U<S.length;U+=1)Math.abs(S[U]-D)<Math.abs(S[j]-D)&&(j=U);const X=w==="in"?Math.min(S.length-1,j+1):Math.max(0,j-1),tt=S[X];return _r.current=!1,tt})},[]),Se=I.useCallback((w,S)=>{if(!ra.current)return{x:0,y:0};const N=w,D=S,j=ra.current.getBoundingClientRect(),X=ar||1,tt=(N-j.left)/X,U=(D-j.top)/X;return{x:tt,y:U}},[ar]),oo=I.useCallback((w,S,N)=>{const D=new Image;D.onload=()=>{const j=O2,X=Math.min(j/D.naturalWidth,j/D.naturalHeight,Number.POSITIVE_INFINITY),tt=Math.round(D.naturalWidth*X),U=Math.round(D.naturalHeight*X);vt({w:tt,h:U}),gt({w:D.naturalWidth,h:D.naturalHeight}),L(w),V(null),xt(null),Ft(null),Zt(null),Ne(null),kr(null),$(!1),Dt(null),S&&(lt([]),ee({})),Ha.current=!0,_r.current=!0,N?.(!0)},D.onerror=()=>{N?.(!1)},D.src=w},[]);I.useEffect(()=>()=>{Wo.current&&(URL.revokeObjectURL(Wo.current),Wo.current=null)},[]),I.useEffect(()=>{if(!E||!Nr.current||!G.w||!G.h)return;const w=Nr.current,S=G.w*ar,N=G.h*ar,{clientWidth:D,clientHeight:j}=w;if(go.current==="viewport-center"){const X=Ka.current,tt=w.scrollLeft+D/2,U=w.scrollTop+j/2,nt=tt/X,ft=U/X;w.scrollLeft=Math.max(0,Math.min(S-D,nt*ar-D/2)),w.scrollTop=Math.max(0,Math.min(N-j,ft*ar-j/2)),go.current=null}else _r.current&&(w.scrollLeft=Math.max(0,(S-D)/2),w.scrollTop=Math.max(0,(N-j)/2));Ka.current=ar},[E,G.w,G.h,ar]),I.useEffect(()=>{if(!Ha.current||!E||!G.w||!G.h)return;const w=Nr.current,S=G.w,N=G.h,D=()=>{const tt=Nr.current;if(!tt?.clientWidth||!tt?.clientHeight)return!1;const U=Math.min(tt.clientWidth/S,tt.clientHeight/N);if(!U||!Number.isFinite(U))return!1;const nt=Math.max(Hm,Math.min(qm,+U.toFixed($m)));return Ha.current=!1,va(nt),!0};if(D())return;let j=0,X=null;return j=requestAnimationFrame(()=>{j=0,!D()&&w&&(X=new ResizeObserver(()=>{D()&&X?.disconnect()}),X.observe(w))}),()=>{j&&cancelAnimationFrame(j),X?.disconnect()}},[E,G.w,G.h]);const Aa=I.useCallback(()=>{if(!E||!Nr.current||!G.w||!G.h)return;const w=Nr.current,{clientWidth:S,clientHeight:N}=w;if(!S||!N)return;const D=Math.min(S/G.w,N/G.h);if(!D||!Number.isFinite(D))return;const j=Math.max(Hm,Math.min(qm,+D.toFixed($m)));_r.current=!0,va(j)},[E,G.w,G.h]);I.useEffect(()=>{const w=Nr.current;if(!w)return;const S=N=>{if(!Di.current||!(N.ctrlKey||N.metaKey))return;N.preventDefault();const D=w.getBoundingClientRect(),j=N.clientX,X=N.clientY,tt=j-D.left,U=X-D.top,nt=N.deltaY>0?1/lS:lS;va(ft=>{const it=Math.min(qm,Math.max(Hm,+(ft*nt).toFixed($m))),mt=w.scrollLeft+tt,z=w.scrollTop+U,Nt=mt/ft,jt=z/ft,St=Zn.current.w*it,Rt=Zn.current.h*it;return w.scrollLeft=Math.max(0,Math.min(St-w.clientWidth,Nt*it-tt)),w.scrollTop=Math.max(0,Math.min(Rt-w.clientHeight,jt*it-U)),_r.current=!1,it})};return w.addEventListener("wheel",S,{passive:!1}),()=>w.removeEventListener("wheel",S)},[]);const Ja=I.useCallback(async w=>{if(!_5(w))return;const S=await pF(w);if(!S){q("Не вдалося відкрити зображення. Спробуйте інший файл.");return}const N=hF(S.width,S.height);if(N){q(N);return}q(null),Bn(null);const D=URL.createObjectURL(w);oo(D,!0,j=>{if(!j){q("Не вдалося завантажити зображення. Спробуйте файл меншого розміру."),URL.revokeObjectURL(D);return}Wo.current&&Wo.current!==D&&URL.revokeObjectURL(Wo.current),Wo.current=D})},[oo]),ps=I.useCallback(w=>{if(!_5(w)||!Di.current)return;te(),Bn(null);const S=URL.createObjectURL(w);oo(S,!1,N=>{if(!N){URL.revokeObjectURL(S);return}Wo.current&&Wo.current!==S&&URL.revokeObjectURL(Wo.current),Wo.current=S})},[oo,te]),ms=w=>{const S=w.target.files?.[0];S&&(Ja(S),w.target.value="")},qs=w=>{const S=w.target.files?.[0];S&&(ps(S),w.target.value="")},Za=I.useCallback(()=>{if(!Di.current)return;const{w,h:S}=Zn.current;if(!w||!S)return;const N=w2(ht);Dt($k(w,S,N)),$(!0),bt(!1),_("select")},[ht]),yo=I.useCallback(()=>{$(!1),bt(!1),Dt(null),js.current=null,Li.current=null},[]),Do=I.useCallback(w=>{Mt(w);const{w:S,h:N}=Zn.current;!S||!N||Dt($k(S,N,w2(w)))},[]),br=I.useCallback(w=>{if(!nn.current)return;w.preventDefault(),w.stopPropagation();const S=Se(w.clientX,w.clientY);js.current={startRect:nn.current,startSvgX:S.x,startSvgY:S.y}},[Se]),jr=I.useCallback((w,S)=>{if(!nn.current)return;S.preventDefault(),S.stopPropagation();const N=Se(S.clientX,S.clientY);Li.current={corner:w,startRect:nn.current,startSvgX:N.x,startSvgY:N.y,aspect:w2(ht)}},[ht,Se]),_i=I.useCallback(async()=>{if(!nn.current||!Di.current||!Xo.current||!Zn.current.w||!Zn.current.h)return;const w=Di.current,S=nn.current,N=Xo.current,D=Zn.current,j=N.w/D.w,X=N.h/D.h,tt=Math.max(0,Math.round(S.x*j)),U=Math.max(0,Math.round(S.y*X)),nt=Math.max(1,Math.round(S.width*j)),ft=Math.max(1,Math.round(S.height*X)),it=new Image;at(!0);try{await new Promise((kt,qt)=>{it.onload=()=>kt(),it.onerror=()=>qt(new Error("Crop image load failed")),it.src=w});const mt=document.createElement("canvas");mt.width=nt,mt.height=ft;const z=mt.getContext("2d");if(!z)return;z.drawImage(it,tt,U,nt,ft,0,0,nt,ft);const Nt=mt.toDataURL("image/png"),jt=D8(nt,ft),{pins:St,cardPositions:Rt}=R8(Fr.current,ls.current,S,jt);te(),lt(St),ee(Rt),V(null),xt(null),Xi(null),oo(Nt,!1),$(!1),bt(!1),Dt(null)}finally{at(!1),js.current=null,Li.current=null}},[oo,te]);I.useEffect(()=>{const w=S=>{if(E||Eg(S.target))return;const N=S.clipboardData?.items;if(N){for(const D of N)if(D.type.startsWith("image/")){S.preventDefault();const j=D.getAsFile();if(!j)return;const X=new FileReader;X.onload=tt=>{const U=tt.target?.result;U&&(Bn(null),oo(U,!0))},X.readAsDataURL(j);return}}};return document.addEventListener("paste",w),()=>document.removeEventListener("paste",w)},[E,oo]),I.useEffect(()=>{const w=N=>{N.dataTransfer?.types?.includes("Files")&&(N.preventDefault(),N.dataTransfer.dropEffect="copy")},S=N=>{if(!N.dataTransfer?.files?.length)return;N.preventDefault();const D=N.dataTransfer.files[0];if(D){if(!Di.current){Ja(D);return}Os.current(D)}};return window.addEventListener("dragover",w),window.addEventListener("drop",S),()=>{window.removeEventListener("dragover",w),window.removeEventListener("drop",S)}},[Ja]),I.useEffect(()=>{const w=()=>{if(!Ki.current)return;const D=Ki.current,j=D.scrollWidth>D.clientWidth,X=typeof window<"u"&&window.innerWidth<(y?1280:J9),tt=j||X,U=typeof window<"u"&&window.innerWidth<(y?1040:1320),nt=D.clientWidth<(y?980:1240);Gl(tt),vl(U||j&&nt)};w(),window.addEventListener("resize",w);const S=Ki.current;let N=null;return S&&typeof ResizeObserver<"u"&&(N=new ResizeObserver(()=>w()),N.observe(S)),()=>{window.removeEventListener("resize",w),N&&N.disconnect()}},[y]),I.useEffect(()=>{G.w&&ee(w=>{const S=new Set(Z.filter(j=>j.anchor.type==="text").map(j=>j.id)),N=Object.fromEntries(Object.entries(w).filter(([j])=>!S.has(j))),D=Z.filter(j=>j.anchor.type!=="text").map(j=>j.id);return D.length===0||Object.keys(N).length>0?Object.keys(N).length===Object.keys(w).length?w:N:_8(D,G.w,G.h)})},[Z.length,G]);const Gr=I.useCallback(w=>{if(H||J!=="place"||!E)return;const S=w.target;if(S!==gc.current&&S.getAttribute?.("data-background")!=="true")return;w.preventDefault();const{x:N,y:D}=Se(w.clientX,w.clientY),{w:j,h:X}=Zn.current,tt=Math.max(0,Math.min(N,j)),U=Math.max(0,Math.min(D,X));if(_e==="arrow"&&!Te&&At===null&&Lt===null){const nt={start:{x:tt,y:U},end:{x:tt,y:U},control:{x:tt,y:U}};ln.current=nt,Xe(nt);return}if(_e==="numbering"&&!Te&&At===null&&Lt===null){const nt={start:{x:tt,y:U},end:{x:tt,y:U}};dn.current=nt,In(nt.start),_n(nt.end);return}Te&&(wn.current={shape:Te,x1:tt,y1:U,x2:tt,y2:U},kr({x1:tt,y1:U,x2:tt,y2:U}))},[J,Te,E,Se,_e,At,Lt,H]),Ho=I.useCallback(w=>{if(w&&(w.preventDefault(),w.stopPropagation()),!At||At.length<2)return;const S=Oa(),N=vu,D={type:"polygon",points:[...At],rotation:0},j=cs(D);te(),lt(X=>[...X,{id:S,anchor:D,color:N,strokeStyle:Uf,fillStyle:Ep,label:ef(X),image:null,imageAspect:null,description:"",descPos:"below"}]),ee(X=>({...X,[S]:j})),Ft(null),V(S),xt(S),_("select"),Xr.current=S,Fo.current=!0},[At,te]),Qa=I.useCallback(w=>{if(w&&(w.preventDefault(),w.stopPropagation()),!Lt||Lt.length<2)return;const S=Oa(),N=vu,D={type:"polyline",points:[...Lt],rotation:0},j=cs(D);te(),lt(X=>[...X,{id:S,anchor:D,color:N,strokeStyle:Uf,label:ef(X),image:null,imageAspect:null,description:"",descPos:"below"}]),ee(X=>({...X,[S]:j})),Zt(null),V(S),xt(S),_("select"),Xr.current=S,Fo.current=!0},[Lt,te]),Jl=I.useCallback(w=>{if(H)return;const S=w.target;if(J!=="place"&&(S===gc.current||S.getAttribute?.("data-background")==="true")){V(null),xt(null);return}if(J!=="place"||!E)return;if(ge.current){ge.current=!1;return}const{x:N,y:D}=Se(w.clientX,w.clientY),{w:j,h:X}=Zn.current;if(N<0||D<0||N>j||D>X)return;let tt=N,U=D;if(At!==null){if(w.shiftKey&&At.length>0){const kt=zk(At[At.length-1],{x:N,y:D});tt=Math.max(0,Math.min(kt.x,j)),U=Math.max(0,Math.min(kt.y,X))}if(At.length>=2){const kt=At[0];if(Math.hypot(tt-kt.x,U-kt.y)<18*ue){w.preventDefault(),w.stopPropagation(),Ho(w);return}}We(At),Ft(kt=>[...kt??[],{x:tt,y:U}]);return}if(Lt!==null){if(w.shiftKey&&Lt.length>0){const kt=zk(Lt[Lt.length-1],{x:N,y:D});tt=Math.max(0,Math.min(kt.x,j)),U=Math.max(0,Math.min(kt.y,X))}We(Lt),Zt(kt=>[...kt??[],{x:tt,y:U}]);return}if(_e==="arrow"||_e==="numbering")return;w.preventDefault(),w.stopPropagation();const nt=Oa(),ft=vu,it=_e==="pointText",mt=_e==="text"||it,z=_e==="standalone",Nt={width:Pk,height:jk},jt=it?tA({x:N,y:D},r8,Nt):{x:N,y:D},St=mt?{type:"text",x:jt.x,y:jt.y,...Nt,...it?{point:{x:N,y:D}}:{}}:z?{type:"standalone",x:N,y:D}:{type:"point",x:N,y:D},Rt=mt?null:cs(St);te(),lt(kt=>[...kt,{id:nt,anchor:St,color:ft,label:ef(kt),image:null,imageAspect:null,description:mt?Py:"",descPos:"below",textColor:it?i8:void 0,textBackgroundColor:it?o8:mt?null:void 0}]),Rt&&ee(kt=>({...kt,[nt]:Rt})),V(nt),xt(nt),_("select"),Xr.current=nt,Fo.current=!0,mt&&Xi(nt)},[J,E,Se,At,Lt,te,Ho,_e,H,We]),Yc=I.useCallback(w=>{if(!E||(zn.current=Se(w.clientX,w.clientY),J!=="place"||_e!=="numbering"||!cn))return;const{x:S,y:N}=Se(w.clientX,w.clientY),{w:D,h:j}=Zn.current;_n({x:Math.max(0,Math.min(S,D)),y:Math.max(0,Math.min(N,j))})},[E,J,_e,cn,Se]);I.useEffect(()=>{const w=S=>{S.key==="Enter"&&(At&&At.length>=2?Ho():Lt&&Lt.length>=2&&Qa()),S.key==="Escape"&&J==="place"&&(S.preventDefault(),cn&&(In(null),_n(null),dn.current=null),At&&At.length>0&&Ft(null),Lt&&Lt.length>0&&Zt(null),Te&&(Ne(null),kr(null),wn.current=null),ln.current&&(Xe(null),ln.current=null),_("select"))};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[J,cn,At,Lt,Ho,Qa,Te]);const pd=I.useCallback((w,S)=>{if(J==="place")return;S.preventDefault();const N=Bt[w];if(!N)return;te();const D=Se(S.clientX,S.clientY);ge.current=!1,_o.current={pinId:w,startCardX:N.x,startCardY:N.y,startSvgX:D.x,startSvgY:D.y}},[Bt,Se,J,te]),md=I.useCallback((w,S,N)=>{N.preventDefault();const D=Bt[w];if(!D)return;te();const j=Se(N.clientX,N.clientY);ge.current=!1,qa.current={pinId:w,handle:S,startCardX:D.x,startCardY:D.y,startCardW:D.width,startCardH:D.height,startSvgX:j.x,startSvgY:j.y}},[Bt,Se,te]);I.useEffect(()=>{const w=D=>Se(D.clientX,D.clientY),S=D=>{const{w:j,h:X}=Zn.current;if(js.current){const{startRect:tt,startSvgX:U,startSvgY:nt}=js.current,ft=w(D),it=ft.x-U,mt=ft.y-nt;Dt({x:Math.max(0,Math.min(tt.x+it,j-tt.width)),y:Math.max(0,Math.min(tt.y+mt,X-tt.height)),width:tt.width,height:tt.height});return}if(Li.current){const{corner:tt,startRect:U,startSvgX:nt,startSvgY:ft,aspect:it}=Li.current,mt=w(D),z=mt.x-nt,Nt=mt.y-ft;let jt={...U};if(it==null)if(tt==="nw"){const St=U.x+U.width,Rt=U.y+U.height,kt=Math.max(0,Math.min(U.x+z,St-Ra)),qt=Math.max(0,Math.min(U.y+Nt,Rt-Ra));jt={x:kt,y:qt,width:St-kt,height:Rt-qt}}else if(tt==="ne"){const St=U.y+U.height,Rt=Math.max(Ra,Math.min(U.width+z,j-U.x)),kt=Math.max(0,Math.min(U.y+Nt,St-Ra));jt={x:U.x,y:kt,width:Rt,height:St-kt}}else if(tt==="se"){const St=Math.max(Ra,Math.min(U.width+z,j-U.x)),Rt=Math.max(Ra,Math.min(U.height+Nt,X-U.y));jt={x:U.x,y:U.y,width:St,height:Rt}}else{const St=U.x+U.width,Rt=Math.max(0,Math.min(U.x+z,St-Ra)),kt=Math.max(Ra,Math.min(U.height+Nt,X-U.y));jt={x:Rt,y:U.y,width:St-Rt,height:kt}}else{const St=tt==="nw"?{x:U.x+U.width,y:U.y+U.height}:tt==="ne"?{x:U.x,y:U.y+U.height}:tt==="se"?{x:U.x,y:U.y}:{x:U.x+U.width,y:U.y},Rt=tt==="nw"||tt==="sw"?Math.max(0,Math.min(U.x+z,St.x-Ra)):Math.max(St.x+Ra,Math.min(U.x+U.width+z,j)),kt=tt==="nw"||tt==="ne"?Math.max(0,Math.min(U.y+Nt,St.y-Ra)):Math.max(St.y+Ra,Math.min(U.y+U.height+Nt,X)),qt=Math.abs(Rt-St.x),Ut=Math.abs(kt-St.y),oe=tt==="nw"||tt==="sw"?St.x:j-St.x,be=tt==="nw"||tt==="ne"?St.y:X-St.y;let xe=qt,$e=Ut;xe/Math.max(1,$e)>it?$e=xe/it:xe=$e*it;const vn=Math.max(Ra,Math.min(oe,be*it));xe=Math.max(Ra,Math.min(xe,vn)),$e=xe/it,jt={x:tt==="nw"||tt==="sw"?St.x-xe:St.x,y:tt==="nw"||tt==="ne"?St.y-$e:St.y,width:xe,height:$e}}Dt(jt);return}if(Rn.current){const{pointIndex:tt,startX:U,startY:nt,startSvgX:ft,startSvgY:it}=Rn.current,mt=w(D),z=mt.x-ft,Nt=mt.y-it;(Math.abs(z)>2||Math.abs(Nt)>2)&&(ge.current=!0);const jt=Math.max(0,Math.min(U+z,j)),St=Math.max(0,Math.min(nt+Nt,X));Ft(Rt=>{if(!Rt||tt<0||tt>=Rt.length)return Rt;const kt=[...Rt];return kt[tt]={x:jt,y:St},kt});return}if(ci.current){const{pointIndex:tt,startX:U,startY:nt,startSvgX:ft,startSvgY:it}=ci.current,mt=w(D),z=mt.x-ft,Nt=mt.y-it;(Math.abs(z)>2||Math.abs(Nt)>2)&&(ge.current=!0);const jt=Math.max(0,Math.min(U+z,j)),St=Math.max(0,Math.min(nt+Nt,X));Zt(Rt=>{if(!Rt||tt<0||tt>=Rt.length)return Rt;const kt=[...Rt];return kt[tt]={x:jt,y:St},kt});return}if(wn.current){const tt=w(D);let U=Math.max(0,Math.min(tt.x,j)),nt=Math.max(0,Math.min(tt.y,X));if(D.shiftKey){const ft=aF({x:wn.current.x1,y:wn.current.y1},{x:U,y:nt});U=Math.max(0,Math.min(ft.x,j)),nt=Math.max(0,Math.min(ft.y,X))}wn.current.x2=U,wn.current.y2=nt,kr({x1:wn.current.x1,y1:wn.current.y1,x2:U,y2:nt});return}if(ln.current){const tt=w(D),U=Math.max(0,Math.min(tt.x,j)),nt=Math.max(0,Math.min(tt.y,X)),ft=ln.current.start;(Math.abs(U-ft.x)>2||Math.abs(nt-ft.y)>2)&&(ge.current=!0);const it={start:ft,end:{x:U,y:nt},control:{x:(ft.x+U)/2,y:(ft.y+nt)/2}};ln.current=it,Xe(it);return}if(dn.current){const tt=w(D),U=Math.max(0,Math.min(tt.x,j)),nt=Math.max(0,Math.min(tt.y,X)),ft=dn.current.start;(Math.abs(U-ft.x)>2||Math.abs(nt-ft.y)>2)&&(ge.current=!0);const it={start:ft,end:{x:U,y:nt}};dn.current=it,In(ft),_n(it.end);return}if(Bs.current){const{pinId:tt,startCenterX:U,startCenterY:nt,startDist:ft,startFontSize:it}=Bs.current,mt=w(D),z=Math.hypot(mt.x-U,mt.y-nt);Math.abs(z-ft)>1.5&&(ge.current=!0);const Nt=Math.max(.25,z/Math.max(1,ft)),jt=Math.max(10,Math.round(it*Nt));lt(St=>St.map(Rt=>{if(Rt.id!==tt||Rt.anchor.type!=="text")return Rt;const kt=bi(Rt.description||"",{fontSize:jt,bold:Rt.textBold??!1,italic:Rt.textItalic??!1}),qt=kt.width,Ut=kt.height,oe=Math.max(0,Math.min(U-qt/2,j-qt)),be=Math.max(0,Math.min(nt-Ut/2,X-Ut));return{...Rt,textFontSize:jt,anchor:{...Rt.anchor,x:oe,y:be,width:qt,height:Ut}}}));return}if(Us.current){const{pinId:tt,startX:U,startY:nt,startSvgX:ft,startSvgY:it}=Us.current,mt=w(D),z=mt.x-ft,Nt=mt.y-it;(Math.abs(z)>2||Math.abs(Nt)>2)&&(ge.current=!0),lt(jt=>jt.map(St=>St.id!==tt||St.anchor.type!=="redact"?St:{...St,anchor:{...St.anchor,x:Math.max(0,Math.min(U+z,j-St.anchor.width)),y:Math.max(0,Math.min(nt+Nt,X-St.anchor.height))}}));return}if(Vl.current){const{pinId:tt,handle:U,startX:nt,startY:ft,startW:it,startH:mt,startSvgX:z,startSvgY:Nt}=Vl.current,jt=w(D),St=jt.x-z,Rt=jt.y-Nt;(Math.abs(St)>2||Math.abs(Rt)>2)&&(ge.current=!0);const kt=nt+it,qt=ft+mt,Ut=U==="nw"||U==="sw",oe=U==="nw"||U==="ne",be=Ut?Math.min(nt+St,kt-Vm):nt,xe=oe?Math.min(ft+Rt,qt-Vm):ft,$e=Ut?kt-be:Math.max(Vm,it+St),vn=oe?qt-xe:Math.max(Vm,mt+Rt);lt(de=>de.map(fn=>fn.id!==tt||fn.anchor.type!=="redact"?fn:{...fn,anchor:{...fn.anchor,x:be,y:xe,width:$e,height:vn}}));return}if(Ya.current){const{pinId:tt,startX:U,startY:nt,startSvgX:ft,startSvgY:it}=Ya.current,mt=w(D),z=mt.x-ft,Nt=mt.y-it;(Math.abs(z)>2||Math.abs(Nt)>2)&&(ge.current=!0),lt(jt=>jt.map(St=>St.id!==tt||St.anchor.type!=="image"?St:{...St,anchor:{...St.anchor,x:Math.max(0,Math.min(U+z,j-St.anchor.width)),y:Math.max(0,Math.min(nt+Nt,X-St.anchor.height))}}));return}if(Wl.current){const{pinId:tt,handle:U,startX:nt,startY:ft,startW:it,startH:mt,startSvgX:z,startSvgY:Nt}=Wl.current,jt=w(D),St=jt.x-z,Rt=jt.y-Nt;(Math.abs(St)>2||Math.abs(Rt)>2)&&(ge.current=!0);const qt=Math.max(Wm,it+(U==="ne"||U==="se"?1:-1)*St);lt(Ut=>Ut.map(oe=>{if(oe.id!==tt||oe.anchor.type!=="image")return oe;const be=oe.anchor.aspect||1,xe=qt,$e=Math.max(Wm,xe/be),vn=U==="nw"||U==="sw"?nt+it-xe:nt,de=U==="nw"||U==="ne"?ft+mt-$e:ft;return{...oe,anchor:{...oe.anchor,x:vn,y:de,width:xe,height:$e}}}));return}if(ba.current){const{pinId:tt,startPoint:U,startBox:nt,startSvgX:ft,startSvgY:it}=ba.current,mt=w(D),z=mt.x-ft,Nt=mt.y-it;(Math.abs(z)>2||Math.abs(Nt)>2)&&(ge.current=!0);const jt=Math.max(0,Math.min(U.x+z,j)),St=Math.max(0,Math.min(U.y+Nt,X));lt(Rt=>Rt.map(kt=>kt.id!==tt||kt.anchor.type!=="text"||!kt.anchor.point?kt:{...kt,anchor:{...kt.anchor,point:{x:jt,y:St},x:nt.x+(jt-U.x),y:nt.y+(St-U.y)}}));return}if(zs.current){const{pinId:tt,startX:U,startY:nt,startSvgX:ft,startSvgY:it}=zs.current,mt=w(D),z=mt.x-ft,Nt=mt.y-it;(Math.abs(z)>2||Math.abs(Nt)>2)&&(ge.current=!0),lt(jt=>jt.map(St=>{if(St.id!==tt||St.anchor.type!=="text")return St;const Rt={width:St.anchor.width,height:St.anchor.height};if(St.anchor.point){const Ut={x:U+z+Rt.width/2,y:nt+Nt+Rt.height/2},oe=Y8(St.anchor.point,Ut,Rt);return{...St,anchor:{...St.anchor,x:oe.x,y:oe.y}}}const kt=Math.max(0,Math.min(U+z,j-Rt.width)),qt=Math.max(0,Math.min(nt+Nt,X-Rt.height));return{...St,anchor:{...St.anchor,x:kt,y:qt}}}));return}if(Ko.current){const{pinId:tt,startPinX:U,startPinY:nt,startSvgX:ft,startSvgY:it}=Ko.current,mt=w(D),z=mt.x-ft,Nt=mt.y-it;(Math.abs(z)>2||Math.abs(Nt)>2)&&(ge.current=!0),lt(jt=>jt.map(St=>St.id!==tt||St.anchor.type!=="point"?St:{...St,anchor:{type:"point",x:Math.max(0,Math.min(U+z,j)),y:Math.max(0,Math.min(nt+Nt,X))}}));return}if(Jo.current){const{pinId:tt,startStart:U,startEnd:nt,startSvgX:ft,startSvgY:it}=Jo.current,mt=w(D),z=mt.x-ft,Nt=mt.y-it;(Math.abs(z)>2||Math.abs(Nt)>2)&&(ge.current=!0),lt(jt=>jt.map(St=>St.id!==tt||St.anchor.type!=="numbering"?St:{...St,anchor:{type:"numbering",start:{x:Math.max(0,Math.min(U.x+z,j)),y:Math.max(0,Math.min(U.y+Nt,X))},end:{x:Math.max(0,Math.min(nt.x+z,j)),y:Math.max(0,Math.min(nt.y+Nt,X))}}}));return}if(Is.current){const{pinId:tt,endpoint:U,startStart:nt,startEnd:ft,startSvgX:it,startSvgY:mt}=Is.current,z=w(D),Nt=z.x-it,jt=z.y-mt;(Math.abs(Nt)>2||Math.abs(jt)>2)&&(ge.current=!0);const St=U==="start"?{x:Math.max(0,Math.min(nt.x+Nt,j)),y:Math.max(0,Math.min(nt.y+jt,X))}:nt,Rt=U==="end"?{x:Math.max(0,Math.min(ft.x+Nt,j)),y:Math.max(0,Math.min(ft.y+jt,X))}:ft;lt(kt=>kt.map(qt=>qt.id!==tt||qt.anchor.type!=="numbering"?qt:{...qt,anchor:{type:"numbering",start:St,end:Rt}}));return}if($a.current){const{pinId:tt,pointIndex:U,startPoints:nt,startSvgX:ft,startSvgY:it}=$a.current,mt=w(D),z=mt.x-ft,Nt=mt.y-it;(Math.abs(z)>2||Math.abs(Nt)>2)&&(ge.current=!0),lt(jt=>jt.map(St=>{if(St.id!==tt||St.anchor.type!=="polygon")return St;const Rt=[...St.anchor.points];return Rt[U]={x:Math.max(0,Math.min(nt[U].x+z,j)),y:Math.max(0,Math.min(nt[U].y+Nt,X))},{...St,anchor:{type:"polygon",points:Rt,rotation:St.anchor.rotation??0}}}));return}if(Fs.current){const{pinId:tt,startPoints:U,startSvgX:nt,startSvgY:ft}=Fs.current,it=w(D),mt=it.x-nt,z=it.y-ft;(Math.abs(mt)>2||Math.abs(z)>2)&&(ge.current=!0),lt(Nt=>Nt.map(jt=>{if(jt.id!==tt||jt.anchor.type!=="polygon")return jt;const St=U.map(Rt=>({x:Math.max(0,Math.min(Rt.x+mt,j)),y:Math.max(0,Math.min(Rt.y+z,X))}));return{...jt,anchor:{type:"polygon",points:St,rotation:jt.anchor.rotation??0}}}));return}if(sr.current){const{pinId:tt,pointIndex:U,startPoints:nt,startSvgX:ft,startSvgY:it}=sr.current,mt=w(D),z=mt.x-ft,Nt=mt.y-it;(Math.abs(z)>2||Math.abs(Nt)>2)&&(ge.current=!0),lt(jt=>jt.map(St=>{if(St.id!==tt||St.anchor.type!=="polyline")return St;const Rt=[...St.anchor.points];return Rt[U]={x:Math.max(0,Math.min(nt[U].x+z,j)),y:Math.max(0,Math.min(nt[U].y+Nt,X))},{...St,anchor:{type:"polyline",points:Rt,rotation:St.anchor.rotation??0}}}));return}if(Fi.current){const{pinId:tt,startPoints:U,startSvgX:nt,startSvgY:ft}=Fi.current,it=w(D),mt=it.x-nt,z=it.y-ft;(Math.abs(mt)>2||Math.abs(z)>2)&&(ge.current=!0),lt(Nt=>Nt.map(jt=>{if(jt.id!==tt||jt.anchor.type!=="polyline")return jt;const St=U.map(Rt=>({x:Math.max(0,Math.min(Rt.x+mt,j)),y:Math.max(0,Math.min(Rt.y+z,X))}));return{...jt,anchor:{type:"polyline",points:St,rotation:jt.anchor.rotation??0}}}));return}if(Pr.current){const{pinId:tt,handle:U,startPoints:nt,startMinX:ft,startMinY:it,startMaxX:mt,startMaxY:z,startSvgX:Nt,startSvgY:jt}=Pr.current,St=w(D);(Math.abs(St.x-Nt)>2||Math.abs(St.y-jt)>2)&&(ge.current=!0);const Rt=Math.max(Tn,mt-ft),kt=Math.max(Tn,z-it);let qt=ft,Ut=it,oe=mt,be=z;switch(U){case"se":oe=Math.max(ft+Tn,St.x),be=Math.max(it+Tn,St.y);break;case"sw":qt=Math.min(mt-Tn,St.x),be=Math.max(it+Tn,St.y);break;case"nw":qt=Math.min(mt-Tn,St.x),Ut=Math.min(z-Tn,St.y);break;case"ne":oe=Math.max(ft+Tn,St.x),Ut=Math.min(z-Tn,St.y);break;case"n":Ut=Math.min(z-Tn,St.y);break;case"s":be=Math.max(it+Tn,St.y);break;case"e":oe=Math.max(ft+Tn,St.x);break;case"w":qt=Math.min(mt-Tn,St.x);break}const xe=oe-qt,$e=be-Ut,vn=nt.map(de=>({x:qt+(de.x-ft)/Rt*xe,y:Ut+(de.y-it)/kt*$e}));lt(de=>de.map(fn=>fn.id!==tt||fn.anchor.type!=="polyline"?fn:{...fn,anchor:{type:"polyline",points:vn,rotation:fn.anchor.rotation??0}}));return}if(on.current){const{pinId:tt,handle:U,startPoints:nt,startMinX:ft,startMinY:it,startMaxX:mt,startMaxY:z,startSvgX:Nt,startSvgY:jt}=on.current,St=w(D);(Math.abs(St.x-Nt)>2||Math.abs(St.y-jt)>2)&&(ge.current=!0);const Rt=Math.max(Tn,mt-ft),kt=Math.max(Tn,z-it);let qt=ft,Ut=it,oe=mt,be=z;switch(U){case"se":oe=Math.max(ft+Tn,St.x),be=Math.max(it+Tn,St.y);break;case"sw":qt=Math.min(mt-Tn,St.x),be=Math.max(it+Tn,St.y);break;case"nw":qt=Math.min(mt-Tn,St.x),Ut=Math.min(z-Tn,St.y);break;case"ne":oe=Math.max(ft+Tn,St.x),Ut=Math.min(z-Tn,St.y);break;case"n":Ut=Math.min(z-Tn,St.y);break;case"s":be=Math.max(it+Tn,St.y);break;case"e":oe=Math.max(ft+Tn,St.x);break;case"w":qt=Math.min(mt-Tn,St.x);break}const xe=oe-qt,$e=be-Ut,vn=nt.map(de=>({x:qt+(de.x-ft)/Rt*xe,y:Ut+(de.y-it)/kt*$e}));lt(de=>de.map(fn=>fn.id!==tt||fn.anchor.type!=="polygon"?fn:{...fn,anchor:{type:"polygon",points:vn,rotation:fn.anchor.rotation??0}}));return}if(xa.current){const{pinId:tt,startX:U,startY:nt,startW:ft,startH:it,startSvgX:mt,startSvgY:z}=xa.current,Nt=w(D),jt=Nt.x-mt,St=Nt.y-z;(Math.abs(jt)>2||Math.abs(St)>2)&&(ge.current=!0);const Rt=Math.max(0,Math.min(U+jt,j-ft)),kt=Math.max(0,Math.min(nt+St,X-it));lt(qt=>qt.map(Ut=>Ut.id!==tt||Ut.anchor.type!=="rectangle"?Ut:{...Ut,anchor:{type:"rectangle",x:Rt,y:kt,width:ft,height:it,rotation:Ut.anchor.rotation??0}}));return}if(Xl.current){const{pinId:tt,startCx:U,startCy:nt,startRx:ft,startRy:it,startSvgX:mt,startSvgY:z}=Xl.current,Nt=w(D),jt=Nt.x-mt,St=Nt.y-z;(Math.abs(jt)>2||Math.abs(St)>2)&&(ge.current=!0);const Rt=Math.max(ft,Math.min(U+jt,j-ft)),kt=Math.max(it,Math.min(nt+St,X-it));lt(qt=>qt.map(Ut=>Ut.id!==tt||Ut.anchor.type!=="ellipse"?Ut:{...Ut,anchor:{type:"ellipse",cx:Rt,cy:kt,rx:ft,ry:it,rotation:Ut.anchor.rotation??0}}));return}if(zt.current){const{pinId:tt,startCx:U,startCy:nt,startRadius:ft,startSvgX:it,startSvgY:mt}=zt.current,z=w(D),Nt=z.x-it,jt=z.y-mt;(Math.abs(Nt)>2||Math.abs(jt)>2)&&(ge.current=!0);const St=Math.max(ft,Math.min(U+Nt,j-ft)),Rt=Math.max(ft,Math.min(nt+jt,X-ft));lt(kt=>kt.map(qt=>qt.id!==tt||qt.anchor.type!=="compass"?qt:{...qt,anchor:{type:"compass",cx:St,cy:Rt,radius:ft,rotation:qt.anchor.rotation??0}}));return}if(gi.current){const{pinId:tt,startStart:U,startEnd:nt,startControl:ft,startSvgX:it,startSvgY:mt}=gi.current,z=w(D),Nt=z.x-it,jt=z.y-mt;(Math.abs(Nt)>2||Math.abs(jt)>2)&&(ge.current=!0),lt(St=>St.map(Rt=>Rt.id!==tt||Rt.anchor.type!=="arrow"?Rt:{...Rt,anchor:{type:"arrow",start:{x:Math.max(0,Math.min(U.x+Nt,j)),y:Math.max(0,Math.min(U.y+jt,X))},end:{x:Math.max(0,Math.min(nt.x+Nt,j)),y:Math.max(0,Math.min(nt.y+jt,X))},control:{x:Math.max(0,Math.min(ft.x+Nt,j)),y:Math.max(0,Math.min(ft.y+jt,X))}}}));return}if(yi.current){const{pinId:tt,handle:U,startStart:nt,startEnd:ft,startControl:it,startSvgX:mt,startSvgY:z}=yi.current,Nt=w(D),jt=Nt.x-mt,St=Nt.y-z;(Math.abs(jt)>2||Math.abs(St)>2)&&(ge.current=!0),lt(Rt=>Rt.map(kt=>{if(kt.id!==tt||kt.anchor.type!=="arrow")return kt;const qt={...nt},Ut={...ft},oe={...it};return U==="start"?(qt.x=Math.max(0,Math.min(qt.x+jt,j)),qt.y=Math.max(0,Math.min(qt.y+St,X))):U==="end"?(Ut.x=Math.max(0,Math.min(Ut.x+jt,j)),Ut.y=Math.max(0,Math.min(Ut.y+St,X))):(oe.x=Math.max(0,Math.min(oe.x+jt,j)),oe.y=Math.max(0,Math.min(oe.y+St,X))),{...kt,anchor:{type:"arrow",start:qt,end:Ut,control:oe}}}));return}if(Hs.current){const{pinId:tt,handle:U,startStart:nt,startEnd:ft,startControl:it,startMinX:mt,startMinY:z,startMaxX:Nt,startMaxY:jt,startSvgX:St,startSvgY:Rt}=Hs.current,kt=w(D);(Math.abs(kt.x-St)>2||Math.abs(kt.y-Rt)>2)&&(ge.current=!0);const qt=Math.max(Tn,Nt-mt),Ut=Math.max(Tn,jt-z);let oe=mt,be=z,xe=Nt,$e=jt;switch(U){case"se":xe=Math.max(mt+Tn,kt.x),$e=Math.max(z+Tn,kt.y);break;case"sw":oe=Math.min(Nt-Tn,kt.x),$e=Math.max(z+Tn,kt.y);break;case"nw":oe=Math.min(Nt-Tn,kt.x),be=Math.min(jt-Tn,kt.y);break;case"ne":xe=Math.max(mt+Tn,kt.x),be=Math.min(jt-Tn,kt.y);break;case"n":be=Math.min(jt-Tn,kt.y);break;case"s":$e=Math.max(z+Tn,kt.y);break;case"e":xe=Math.max(mt+Tn,kt.x);break;case"w":oe=Math.min(Nt-Tn,kt.x);break}const vn=xe-oe,de=$e-be,fn=Ce=>({x:oe+(Ce.x-mt)/qt*vn,y:be+(Ce.y-z)/Ut*de});lt(Ce=>Ce.map(Hn=>Hn.id!==tt||Hn.anchor.type!=="arrow"?Hn:{...Hn,anchor:{type:"arrow",start:fn(nt),end:fn(ft),control:fn(it)}}));return}if(eo.current){const{pinId:tt,startStart:U,startEnd:nt,startControl:ft,centerX:it,centerY:mt,startAngle:z,startSvgX:Nt,startSvgY:jt}=eo.current,St=w(D);(Math.abs(St.x-Nt)>2||Math.abs(St.y-jt)>2)&&(ge.current=!0);const kt=Math.atan2(St.y-mt,St.x-it)-z,qt=Math.cos(kt),Ut=Math.sin(kt),oe=be=>({x:it+(be.x-it)*qt-(be.y-mt)*Ut,y:mt+(be.x-it)*Ut+(be.y-mt)*qt});lt(be=>be.map(xe=>xe.id!==tt||xe.anchor.type!=="arrow"?xe:{...xe,anchor:{type:"arrow",start:oe(U),end:oe(nt),control:oe(ft)}}));return}if(dt.current){const{pinId:tt,startRotation:U,centerX:nt,centerY:ft,startSvgX:it,startSvgY:mt}=dt.current,z=w(D);(Math.abs(z.x-it)>2||Math.abs(z.y-mt)>2)&&(ge.current=!0);const Nt=kt=>kt*180/Math.PI,jt=Nt(Math.atan2(mt-ft,it-nt)),St=Nt(Math.atan2(z.y-ft,z.x-nt));let Rt=U+(St-jt);for(;Rt<0;)Rt+=360;for(;Rt>=360;)Rt-=360;lt(kt=>kt.map(qt=>qt.id!==tt||qt.anchor.type!=="rectangle"?qt:{...qt,anchor:{...qt.anchor,rotation:Rt}}));return}if(Et.current){const{pinId:tt,startRotation:U,centerX:nt,centerY:ft,startSvgX:it,startSvgY:mt}=Et.current,z=w(D);(Math.abs(z.x-it)>2||Math.abs(z.y-mt)>2)&&(ge.current=!0);const Nt=kt=>kt*180/Math.PI,jt=Nt(Math.atan2(mt-ft,it-nt)),St=Nt(Math.atan2(z.y-ft,z.x-nt));let Rt=U+(St-jt);for(;Rt<0;)Rt+=360;for(;Rt>=360;)Rt-=360;lt(kt=>kt.map(qt=>qt.id!==tt||qt.anchor.type!=="ellipse"?qt:{...qt,anchor:{...qt.anchor,rotation:Rt}}));return}if(me.current){const{pinId:tt,startRotation:U,centerX:nt,centerY:ft,startSvgX:it,startSvgY:mt}=me.current,z=w(D);(Math.abs(z.x-it)>2||Math.abs(z.y-mt)>2)&&(ge.current=!0);const Nt=kt=>kt*180/Math.PI,jt=Nt(Math.atan2(mt-ft,it-nt)),St=Nt(Math.atan2(z.y-ft,z.x-nt));let Rt=U+(St-jt);for(;Rt<0;)Rt+=360;for(;Rt>=360;)Rt-=360;lt(kt=>kt.map(qt=>qt.id!==tt||qt.anchor.type!=="compass"?qt:{...qt,anchor:{...qt.anchor,rotation:Rt}}));return}if(Qe.current){const{pinId:tt,startPoints:U,centerX:nt,centerY:ft,startAngle:it,startRotation:mt,startSvgX:z,startSvgY:Nt}=Qe.current,jt=w(D);(Math.abs(jt.x-z)>2||Math.abs(jt.y-Nt)>2)&&(ge.current=!0);const Rt=Math.atan2(jt.y-ft,jt.x-nt)-it,kt=Math.cos(Rt),qt=Math.sin(Rt),Ut=U.map(xe=>({x:nt+(xe.x-nt)*kt-(xe.y-ft)*qt,y:ft+(xe.x-nt)*qt+(xe.y-ft)*kt}));let be=mt+(xe=>xe*180/Math.PI)(Rt);for(;be<0;)be+=360;for(;be>=360;)be-=360;lt(xe=>xe.map($e=>$e.id!==tt||$e.anchor.type!=="polygon"?$e:{...$e,anchor:{type:"polygon",points:Ut,rotation:be}}));return}if(Ni.current){const{pinId:tt,startPoints:U,centerX:nt,centerY:ft,startAngle:it,startRotation:mt,startSvgX:z,startSvgY:Nt}=Ni.current,jt=w(D);(Math.abs(jt.x-z)>2||Math.abs(jt.y-Nt)>2)&&(ge.current=!0);const Rt=Math.atan2(jt.y-ft,jt.x-nt)-it,kt=Math.cos(Rt),qt=Math.sin(Rt),Ut=U.map(xe=>({x:nt+(xe.x-nt)*kt-(xe.y-ft)*qt,y:ft+(xe.x-nt)*qt+(xe.y-ft)*kt}));let be=mt+(xe=>xe*180/Math.PI)(Rt);for(;be<0;)be+=360;for(;be>=360;)be-=360;lt(xe=>xe.map($e=>$e.id!==tt||$e.anchor.type!=="polyline"?$e:{...$e,anchor:{type:"polyline",points:Ut,rotation:be}}));return}if(M.current){const{pinId:tt,handle:U,startX:nt,startY:ft,startW:it,startH:mt,startRotation:z,startSvgX:Nt,startSvgY:jt}=M.current,St=w(D);(Math.abs(St.x-Nt)>2||Math.abs(St.y-jt)>2)&&(ge.current=!0);const Rt=z*Math.PI/180,kt=Math.cos(Rt),qt=Math.sin(Rt),Ut=nt+it/2,oe=ft+mt/2,be=(Ve,Cn)=>({x:Ut+Ve*kt-Cn*qt,y:oe+Ve*qt+Cn*kt}),xe={nw:be(-it/2,-mt/2),ne:be(it/2,-mt/2),se:be(it/2,mt/2),sw:be(-it/2,mt/2)},$e={n:be(0,-mt/2),s:be(0,mt/2),e:be(it/2,0),w:be(-it/2,0)},vn={nw:xe.se,ne:xe.sw,se:xe.nw,sw:xe.ne},de={n:$e.s,s:$e.n,e:$e.w,w:$e.e},fn=vn[U]??de[U],Ce=(St.x+fn.x)/2,Hn=(St.y+fn.y)/2,Ir=fn.x-Ce,zr=fn.y-Hn,Ro={x:Ir*kt+zr*qt,y:-Ir*qt+zr*kt},qo=U==="n"||U==="e"||U==="s"||U==="w",It=qo?U==="e"||U==="w"?Math.max(Zo,2*Math.abs(Ro.x)):it:Math.max(Zo,2*Math.abs(Ro.x)),Ye=qo?U==="n"||U==="s"?Math.max(Zo,2*Math.abs(Ro.y)):mt:Math.max(Zo,2*Math.abs(Ro.y)),Ae=Ce-It/2,Be=Hn-Ye/2;lt(Ve=>Ve.map(Cn=>Cn.id!==tt||Cn.anchor.type!=="rectangle"?Cn:{...Cn,anchor:{type:"rectangle",x:Ae,y:Be,width:It,height:Ye,rotation:z}}));return}if(B.current){const{pinId:tt,handle:U,startCx:nt,startCy:ft,startRx:it,startRy:mt,startSvgX:z,startSvgY:Nt}=B.current,jt=w(D);(Math.abs(jt.x-z)>2||Math.abs(jt.y-Nt)>2)&&(ge.current=!0);const{startRotation:St}=B.current,Rt=St*Math.PI/180,kt=Math.cos(Rt),qt=Math.sin(Rt),Ut=(de,fn)=>({x:nt+de*kt-fn*qt,y:ft+de*qt+fn*kt}),oe=U==="nw"||U==="ne"||U==="se"||U==="sw";let be=nt,xe=ft,$e=it,vn=mt;if(oe){const de={nw:Ut(-it,-mt),ne:Ut(it,-mt),se:Ut(it,mt),sw:Ut(-it,mt)},Ce={nw:de.se,ne:de.sw,se:de.nw,sw:de.ne}[U];be=(jt.x+Ce.x)/2,xe=(jt.y+Ce.y)/2;const Hn=Ce.x-be,Ir=Ce.y-xe;$e=Math.max(ds,Math.abs(Hn*kt+Ir*qt)),vn=Math.max(ds,Math.abs(-Hn*qt+Ir*kt))}else{if(U==="n"){const de=ft+mt;vn=Math.max(ds,(de-jt.y)/2),xe=de-vn}else if(U==="s"){const de=ft-mt;vn=Math.max(ds,(jt.y-de)/2),xe=de+vn}else if(U==="e"){const de=nt-it;$e=Math.max(ds,(jt.x-de)/2),be=de+$e}else if(U==="w"){const de=nt+it;$e=Math.max(ds,(de-jt.x)/2),be=de-$e}be=Math.max($e,Math.min(be,j-$e)),xe=Math.max(vn,Math.min(xe,X-vn))}lt(de=>de.map(fn=>fn.id!==tt||fn.anchor.type!=="ellipse"?fn:{...fn,anchor:{type:"ellipse",cx:be,cy:xe,rx:$e,ry:vn,rotation:fn.anchor.rotation??0}}));return}if(se.current){const{pinId:tt,startCx:U,startCy:nt,startSvgX:ft,startSvgY:it}=se.current,mt=w(D);(Math.abs(mt.x-ft)>2||Math.abs(mt.y-it)>2)&&(ge.current=!0);const z=Math.hypot(mt.x-U,mt.y-nt),Nt=Math.min(U,nt,j-U,X-nt),jt=Math.max(lD,Math.min(z,Nt));lt(St=>St.map(Rt=>Rt.id!==tt||Rt.anchor.type!=="compass"?Rt:{...Rt,anchor:{type:"compass",cx:U,cy:nt,radius:jt,rotation:Rt.anchor.rotation??0}}));return}if(ia.current){const{pinId:tt,pointIndex:U,startPoints:nt,startSvgX:ft,startSvgY:it}=ia.current,mt=w(D),z=mt.x-ft,Nt=mt.y-it;(Math.abs(z)>2||Math.abs(Nt)>2)&&(ge.current=!0);const jt=nt.map((St,Rt)=>Rt===U?{x:Math.max(0,Math.min(St.x+z,j)),y:Math.max(0,Math.min(St.y+Nt,X))}:St);lt(St=>St.map(Rt=>Rt.id===tt?{...Rt,leaderPoints:jt}:Rt));return}if(_o.current){const{pinId:tt,startCardX:U,startCardY:nt,startSvgX:ft,startSvgY:it}=_o.current,mt=w(D),z=mt.x-ft,Nt=mt.y-it;(Math.abs(z)>2||Math.abs(Nt)>2)&&(ge.current=!0),ee(jt=>{const St=jt[tt];return St?{...jt,[tt]:{...St,x:Math.max(0,Math.min(U+z,j-St.width)),y:Math.max(0,Math.min(nt+Nt,X-St.height))}}:jt});return}if(qa.current){const{pinId:tt,handle:U,startCardX:nt,startCardY:ft,startCardW:it,startCardH:mt,startSvgX:z,startSvgY:Nt}=qa.current,jt=w(D),St=jt.x-z,Rt=jt.y-Nt;(Math.abs(St)>2||Math.abs(Rt)>2)&&(ge.current=!0);let kt=nt,qt=ft,Ut=it,oe=mt;U.includes("e")&&(Ut=Math.max(cS,it+St)),U.includes("s")&&(oe=Math.max(uS,mt+Rt)),U.includes("w")&&(Ut=Math.max(cS,it-St),kt=nt+it-Ut),U.includes("n")&&(oe=Math.max(uS,mt-Rt),qt=ft+mt-oe),kt=Math.max(0,Math.min(kt,j-Ut)),qt=Math.max(0,Math.min(qt,X-oe)),ee(be=>({...be,[tt]:{x:kt,y:qt,width:Ut,height:oe}}))}},N=()=>{if(js.current=null,Li.current=null,wn.current){const D=wn.current,j=20,X=Math.min(D.x1,D.x2),tt=Math.max(D.x1,D.x2),U=Math.min(D.y1,D.y2),nt=Math.max(D.y1,D.y2),ft=Math.max(j,tt-X),it=Math.max(j,nt-U),mt=Oa(),z=vu;te();const Nt=D.shape==="rectangle"?{type:"rectangle",x:X,y:U,width:ft,height:it}:D.shape==="redact"?{type:"redact",x:X,y:U,width:ft,height:it,mode:t8,strength:e8}:{type:"ellipse",cx:(X+tt)/2,cy:(U+nt)/2,rx:ft/2,ry:it/2},jt=D.shape==="redact"?null:cs(Nt);lt(St=>[...St,{id:mt,anchor:Nt,color:z,strokeStyle:Uf,fillStyle:Ep,label:ef(St),image:null,imageAspect:null,description:"",descPos:"below"}]),jt&&ee(St=>({...St,[mt]:jt})),V(mt),xt(mt),_("select"),kr(null),Ne(null),wn.current=null,Xr.current=mt,Fo.current=!0}if(ln.current){const D=ln.current;if(Math.hypot(D.end.x-D.start.x,D.end.y-D.start.y)>=6){const X=Oa(),tt=vu,U={type:"arrow",start:D.start,end:D.end,control:D.control},nt=cs(U);te(),lt(ft=>[...ft,{id:X,anchor:U,color:tt,strokeStyle:Uf,label:ef(ft),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),ee(ft=>({...ft,[X]:nt})),V(X),xt(null),_("select"),Xr.current=X,Fo.current=!0}Xe(null),ln.current=null}if(dn.current){const D=dn.current;if(Math.hypot(D.end.x-D.start.x,D.end.y-D.start.y)>=6){const X=Oa(),tt=vu;te(),lt(U=>[...U,{id:X,anchor:{type:"numbering",start:D.start,end:D.end},color:tt,label:sF(U),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),V(X),xt(null),_("select"),Xr.current=X,Fo.current=!0}In(null),_n(null),dn.current=null}_o.current=null,qa.current=null,Ko.current=null,Jo.current=null,Is.current=null,zs.current=null,Bs.current=null,$a.current=null,Rn.current&&ge.current&&Pn.current(Rn.current.startPoints),Rn.current=null,Fs.current=null,sr.current=null,ci.current&&ge.current&&Pn.current(ci.current.startPoints),ci.current=null,Fi.current=null,Ni.current=null,Pr.current=null,xa.current=null,Xl.current=null,zt.current=null,M.current=null,B.current=null,se.current=null,dt.current=null,Et.current=null,me.current=null,Qe.current=null,on.current=null,gi.current=null,yi.current=null,eo.current=null,Hs.current=null,dn.current=null,ia.current=null,ba.current=null,Ya.current=null,Wl.current=null,Us.current=null,Vl.current=null};return window.addEventListener("pointermove",S,{passive:!1}),window.addEventListener("pointerup",N),window.addEventListener("pointercancel",N),window.addEventListener("mousemove",S),window.addEventListener("mouseup",N),()=>{window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",N),window.removeEventListener("pointercancel",N),window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",N)}},[Se]);const Du=I.useCallback((w,S)=>{if(J==="place")return;const N=Z.find(j=>j.id===w);if(!N||N.anchor.type!=="point")return;S.preventDefault(),te();const D=Se(S.clientX,S.clientY);ge.current=!1,Ko.current={pinId:w,startPinX:N.anchor.x,startPinY:N.anchor.y,startSvgX:D.x,startSvgY:D.y}},[J,Z,Se,te]),Lu=I.useCallback((w,S)=>{if(J==="place")return;const N=Z.find(j=>j.id===w);if(!N||N.anchor.type!=="numbering")return;S.preventDefault(),S.stopPropagation(),te();const D=Se(S.clientX,S.clientY);ge.current=!1,Jo.current={pinId:w,startStart:{...N.anchor.start},startEnd:{...N.anchor.end},startSvgX:D.x,startSvgY:D.y}},[J,Z,Se,te]),Ma=I.useCallback((w,S,N)=>{if(J==="place")return;const D=Z.find(X=>X.id===w);if(!D||D.anchor.type!=="numbering")return;N.preventDefault(),N.stopPropagation(),te();const j=Se(N.clientX,N.clientY);ge.current=!1,Is.current={pinId:w,endpoint:S,startStart:{...D.anchor.start},startEnd:{...D.anchor.end},startSvgX:j.x,startSvgY:j.y}},[J,Z,Se,te]),gs=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Un.current;if(!N||w<0||w>=N.length)return;const D=N[w],{x:j,y:X}=Se(S.clientX,S.clientY);ge.current=!1,Rn.current={pointIndex:w,startX:D.x,startY:D.y,startSvgX:j,startSvgY:X,startPoints:N.map(tt=>({x:tt.x,y:tt.y}))}},[Se]),xc=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=yc.current;if(!N||w<0||w>=N.length)return;const D=N[w],{x:j,y:X}=Se(S.clientX,S.clientY);ge.current=!1,ci.current={pointIndex:w,startX:D.x,startY:D.y,startSvgX:j,startSvgY:X,startPoints:N.map(tt=>({x:tt.x,y:tt.y}))}},[Se]),Qo=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation();const D=Fr.current.find(X=>X.id===w);if(!D)return;te();const j=Se(N.clientX,N.clientY);ge.current=!1,ia.current={pinId:w,pointIndex:S,startPoints:(D.leaderPoints??[]).map(X=>({x:X.x,y:X.y})),startSvgX:j.x,startSvgY:j.y}},[Se,te]),Ml=I.useCallback((w,S,N,D)=>{D.preventDefault(),D.stopPropagation();const j=Fr.current.find(nt=>nt.id===w);if(!j)return;te();const X=Se(D.clientX,D.clientY);ge.current=!1;const tt=(j.leaderPoints??[]).map(nt=>({x:nt.x,y:nt.y})),U=[...tt.slice(0,S),{x:N.x,y:N.y},...tt.slice(S)];lt(nt=>nt.map(ft=>ft.id===w?{...ft,leaderPoints:U}:ft)),ia.current={pinId:w,pointIndex:S,startPoints:U,startSvgX:X.x,startSvgY:X.y}},[Se,te]),Ru=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation(),te(),lt(D=>D.map(j=>{if(j.id!==w||!j.leaderPoints)return j;const X=j.leaderPoints.filter((tt,U)=>U!==S);if(X.length===0){const tt={...j};return delete tt.leaderPoints,tt}return{...j,leaderPoints:X}}))},[te]),vc=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation();const D=Z.find(X=>X.id===w);if(!D||D.anchor.type!=="polygon")return;te();const j=Se(N.clientX,N.clientY);ge.current=!1,$a.current={pinId:w,pointIndex:S,startPoints:D.anchor.points.map(X=>({x:X.x,y:X.y})),startSvgX:j.x,startSvgY:j.y}},[Z,Se,te]),Vc=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation(),te(),lt(D=>D.map(j=>{if(j.id!==w||j.anchor.type!=="polygon")return j;const X=j.anchor.points;if(X.length<=3)return j;const tt=X.filter((U,nt)=>nt!==S);return{...j,anchor:{type:"polygon",points:tt,rotation:j.anchor.rotation??0}}}))},[te]),Wc=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation();const D=Z.find(mt=>mt.id===w);if(!D||D.anchor.type!=="polygon")return;const j=D.anchor.points,X=j.length,tt=j[S],U=j[(S+1)%X],nt={x:(tt.x+U.x)/2,y:(tt.y+U.y)/2},ft=[...j.slice(0,S+1),nt,...j.slice(S+1)];te(),lt(mt=>mt.map(z=>z.id!==w||z.anchor.type!=="polygon"?z:{...z,anchor:{type:"polygon",points:ft,rotation:z.anchor.rotation??0}}));const it=Se(N.clientX,N.clientY);ge.current=!1,$a.current={pinId:w,pointIndex:S+1,startPoints:ft.map(mt=>({x:mt.x,y:mt.y})),startSvgX:it.x,startSvgY:it.y}},[Z,Se,te]),Ca=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Z.find(j=>j.id===w);if(!N||N.anchor.type!=="polygon")return;te();const D=Se(S.clientX,S.clientY);ge.current=!1,Fs.current={pinId:w,startPoints:N.anchor.points.map(j=>({x:j.x,y:j.y})),startSvgX:D.x,startSvgY:D.y}},[Z,Se,te]),wc=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Z.find(j=>j.id===w);if(!N||N.anchor.type!=="rectangle")return;te();const D=Se(S.clientX,S.clientY);ge.current=!1,xa.current={pinId:w,startX:N.anchor.x,startY:N.anchor.y,startW:N.anchor.width,startH:N.anchor.height,startSvgX:D.x,startSvgY:D.y}},[Z,Se,te]),bo=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Z.find(j=>j.id===w);if(!N||N.anchor.type!=="ellipse")return;te();const D=Se(S.clientX,S.clientY);ge.current=!1,Xl.current={pinId:w,startCx:N.anchor.cx,startCy:N.anchor.cy,startRx:N.anchor.rx,startRy:N.anchor.ry,startSvgX:D.x,startSvgY:D.y}},[Z,Se,te]),so=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation();const D=Z.find(X=>X.id===w);if(!D||D.anchor.type!=="rectangle")return;te();const j=Se(N.clientX,N.clientY);ge.current=!1,M.current={pinId:w,handle:S,startX:D.anchor.x,startY:D.anchor.y,startW:D.anchor.width,startH:D.anchor.height,startRotation:D.anchor.rotation??0,startSvgX:j.x,startSvgY:j.y}},[Z,Se,te]),Xc=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation();const D=Z.find(X=>X.id===w);if(!D||D.anchor.type!=="ellipse")return;te();const j=Se(N.clientX,N.clientY);ge.current=!1,B.current={pinId:w,handle:S,startCx:D.anchor.cx,startCy:D.anchor.cy,startRx:D.anchor.rx,startRy:D.anchor.ry,startRotation:D.anchor.rotation??0,startSvgX:j.x,startSvgY:j.y}},[Z,Se,te]),xo=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation();const D=Z.find(it=>it.id===w);if(!D||D.anchor.type!=="polygon")return;const j=D.anchor.points;if(j.length<2)return;te();const X=Se(N.clientX,N.clientY),tt=Math.min(...j.map(it=>it.x)),U=Math.min(...j.map(it=>it.y)),nt=Math.max(...j.map(it=>it.x)),ft=Math.max(...j.map(it=>it.y));ge.current=!1,on.current={pinId:w,handle:S,startPoints:j.map(it=>({x:it.x,y:it.y})),startMinX:tt,startMinY:U,startMaxX:nt,startMaxY:ft,startSvgX:X.x,startSvgY:X.y}},[Z,Se,te]),Gc=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Z.find(tt=>tt.id===w);if(!N||N.anchor.type!=="rectangle")return;te();const D=Se(S.clientX,S.clientY),j=N.anchor.x+N.anchor.width/2,X=N.anchor.y+N.anchor.height/2;ge.current=!1,dt.current={pinId:w,startRotation:N.anchor.rotation??0,centerX:j,centerY:X,startSvgX:D.x,startSvgY:D.y}},[Z,Se,te]),ys=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Z.find(j=>j.id===w);if(!N||N.anchor.type!=="ellipse")return;te();const D=Se(S.clientX,S.clientY);ge.current=!1,Et.current={pinId:w,startRotation:N.anchor.rotation??0,centerX:N.anchor.cx,centerY:N.anchor.cy,startSvgX:D.x,startSvgY:D.y}},[Z,Se,te]),Sc=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Z.find(j=>j.id===w);if(!N||N.anchor.type!=="compass")return;te();const D=Se(S.clientX,S.clientY);ge.current=!1,zt.current={pinId:w,startCx:N.anchor.cx,startCy:N.anchor.cy,startRadius:N.anchor.radius,startSvgX:D.x,startSvgY:D.y}},[Z,Se,te]),Zl=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation();const D=Z.find(X=>X.id===w);if(!D||D.anchor.type!=="compass")return;te();const j=Se(N.clientX,N.clientY);ge.current=!1,se.current={pinId:w,handle:S,startCx:D.anchor.cx,startCy:D.anchor.cy,startRadius:D.anchor.radius,startRotation:D.anchor.rotation??0,startSvgX:j.x,startSvgY:j.y}},[Z,Se,te]),tl=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Z.find(j=>j.id===w);if(!N||N.anchor.type!=="compass")return;te();const D=Se(S.clientX,S.clientY);ge.current=!1,me.current={pinId:w,startRotation:N.anchor.rotation??0,centerX:N.anchor.cx,centerY:N.anchor.cy,startSvgX:D.x,startSvgY:D.y}},[Z,Se,te]),kc=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Z.find(nt=>nt.id===w);if(!N||N.anchor.type!=="polygon")return;const D=N.anchor.points;if(D.length<2)return;te();const j=Se(S.clientX,S.clientY),X=D.reduce((nt,ft)=>nt+ft.x,0)/D.length,tt=D.reduce((nt,ft)=>nt+ft.y,0)/D.length,U=Math.atan2(j.y-tt,j.x-X);ge.current=!1,Qe.current={pinId:w,startPoints:D.map(nt=>({x:nt.x,y:nt.y})),centerX:X,centerY:tt,startAngle:U,startRotation:N.anchor.rotation??0,startSvgX:j.x,startSvgY:j.y}},[Z,Se,te]),Kc=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation();const D=Z.find(X=>X.id===w);if(!D||D.anchor.type!=="polyline")return;te();const j=Se(N.clientX,N.clientY);ge.current=!1,sr.current={pinId:w,pointIndex:S,startPoints:D.anchor.points.map(X=>({x:X.x,y:X.y})),startSvgX:j.x,startSvgY:j.y}},[Z,Se,te]),Ac=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation(),te(),lt(D=>D.map(j=>{if(j.id!==w||j.anchor.type!=="polyline")return j;const X=j.anchor.points;if(X.length<=2)return j;const tt=X.filter((U,nt)=>nt!==S);return{...j,anchor:{type:"polyline",points:tt,rotation:j.anchor.rotation??0}}}))},[te]),Jc=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation();const D=Z.find(it=>it.id===w);if(!D||D.anchor.type!=="polyline")return;const j=D.anchor.points;if(S>=j.length-1)return;const X=j[S],tt=j[S+1],U={x:(X.x+tt.x)/2,y:(X.y+tt.y)/2},nt=[...j.slice(0,S+1),U,...j.slice(S+1)];te(),lt(it=>it.map(mt=>mt.id!==w||mt.anchor.type!=="polyline"?mt:{...mt,anchor:{type:"polyline",points:nt,rotation:mt.anchor.rotation??0}}));const ft=Se(N.clientX,N.clientY);ge.current=!1,sr.current={pinId:w,pointIndex:S+1,startPoints:nt.map(it=>({x:it.x,y:it.y})),startSvgX:ft.x,startSvgY:ft.y}},[Z,Se,te]),bs=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Z.find(j=>j.id===w);if(!N||N.anchor.type!=="polyline")return;te();const D=Se(S.clientX,S.clientY);ge.current=!1,Fi.current={pinId:w,startPoints:N.anchor.points.map(j=>({x:j.x,y:j.y})),startSvgX:D.x,startSvgY:D.y}},[Z,Se,te]),Ql=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Z.find(j=>j.id===w);if(!N||N.anchor.type!=="arrow")return;te();const D=Se(S.clientX,S.clientY);ge.current=!1,gi.current={pinId:w,startStart:{...N.anchor.start},startEnd:{...N.anchor.end},startControl:{...N.anchor.control},startSvgX:D.x,startSvgY:D.y}},[Z,Se,te]),$s=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation();const D=Z.find(X=>X.id===w);if(!D||D.anchor.type!=="arrow")return;te();const j=Se(N.clientX,N.clientY);ge.current=!1,yi.current={pinId:w,handle:S,startStart:{...D.anchor.start},startEnd:{...D.anchor.end},startControl:{...D.anchor.control},startSvgX:j.x,startSvgY:j.y}},[Z,Se,te]),Zc=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation();const D=Z.find(it=>it.id===w);if(!D||D.anchor.type!=="arrow")return;te();const j=[D.anchor.start,D.anchor.end,D.anchor.control],X=Math.min(...j.map(it=>it.x)),tt=Math.min(...j.map(it=>it.y)),U=Math.max(...j.map(it=>it.x)),nt=Math.max(...j.map(it=>it.y)),ft=Se(N.clientX,N.clientY);ge.current=!1,Hs.current={pinId:w,handle:S,startStart:{...D.anchor.start},startEnd:{...D.anchor.end},startControl:{...D.anchor.control},startMinX:X,startMinY:tt,startMaxX:U,startMaxY:nt,startSvgX:ft.x,startSvgY:ft.y}},[Z,Se,te]),Mc=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Z.find(nt=>nt.id===w);if(!N||N.anchor.type!=="arrow")return;te();const D=Se(S.clientX,S.clientY),j=[N.anchor.start,N.anchor.end,N.anchor.control],X=j.reduce((nt,ft)=>nt+ft.x,0)/j.length,tt=j.reduce((nt,ft)=>nt+ft.y,0)/j.length,U=Math.atan2(D.y-tt,D.x-X);ge.current=!1,eo.current={pinId:w,startStart:{...N.anchor.start},startEnd:{...N.anchor.end},startControl:{...N.anchor.control},centerX:X,centerY:tt,startAngle:U,startSvgX:D.x,startSvgY:D.y}},[Z,Se,te]),xs=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation();const D=Z.find(it=>it.id===w);if(!D||D.anchor.type!=="polyline")return;te();const j=D.anchor.points,X=Math.min(...j.map(it=>it.x)),tt=Math.min(...j.map(it=>it.y)),U=Math.max(...j.map(it=>it.x)),nt=Math.max(...j.map(it=>it.y)),ft=Se(N.clientX,N.clientY);ge.current=!1,Pr.current={pinId:w,handle:S,startPoints:j.map(it=>({x:it.x,y:it.y})),startMinX:X,startMinY:tt,startMaxX:U,startMaxY:nt,startSvgX:ft.x,startSvgY:ft.y}},[Z,Se,te]),vs=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Z.find(nt=>nt.id===w);if(!N||N.anchor.type!=="polyline")return;const D=N.anchor.points;if(D.length<2)return;te();const j=Se(S.clientX,S.clientY),X=D.reduce((nt,ft)=>nt+ft.x,0)/D.length,tt=D.reduce((nt,ft)=>nt+ft.y,0)/D.length,U=Math.atan2(j.y-tt,j.x-X);ge.current=!1,Ni.current={pinId:w,startPoints:D.map(nt=>({x:nt.x,y:nt.y})),centerX:X,centerY:tt,startAngle:U,startRotation:N.anchor.rotation??0,startSvgX:j.x,startSvgY:j.y}},[Z,Se,te]),el=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Z.find(tt=>tt.id===w);if(!N||N.anchor.type!=="text")return;V(w),xt(w);const D=performance.now(),j=oa.current;if(j&&j.pinId===w&&D-j.time<=nF&&Math.hypot(S.clientX-j.x,S.clientY-j.y)<=rF){oa.current=null,zs.current=null,Xi(w);return}oa.current={pinId:w,time:D,x:S.clientX,y:S.clientY},te();const X=Se(S.clientX,S.clientY);ge.current=!1,zs.current={pinId:w,startX:N.anchor.x,startY:N.anchor.y,startSvgX:X.x,startSvgY:X.y}},[Z,Se,te]),Lo=I.useCallback(async w=>{const S=await new Promise(mt=>{const z=new FileReader;z.onload=Nt=>mt(Nt.target?.result??null),z.onerror=()=>mt(null),z.readAsDataURL(w)});if(!S)return;const N=await new Promise(mt=>{const z=new Image;z.onload=()=>mt({w:z.naturalWidth||Oy,h:z.naturalHeight||Oy}),z.onerror=()=>mt(null),z.src=S});if(!N)return;const D=N.w/N.h,j=Oy/Math.max(N.w,N.h),X=Math.max(Wm,N.w*j),tt=Math.max(Wm,N.h*j),{w:U,h:nt}=Zn.current,ft={type:"image",x:Math.max(0,(U-X)/2),y:Math.max(0,(nt-tt)/2),width:X,height:tt,src:S,aspect:D},it=Oa();te(),lt(mt=>[...mt,{id:it,anchor:ft,color:vu,label:ef(mt),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),ee(mt=>({...mt,[it]:cs(ft)})),V(it),xt(it),_("select")},[te]);Os.current=Lo;const ws=I.useRef(0),ao=I.useCallback(w=>{const S=Date.now();S-ws.current<800||(ws.current=S,Lo(w),hs(!1))},[Lo]);I.useEffect(()=>{if(!io)return;Kl.current?.focus();const w=N=>{const D=y2(N.clipboardData);D&&(N.preventDefault(),N.stopPropagation(),ao(D))},S=N=>{if(N.key==="Escape"){hs(!1);return}!(b?N.metaKey:N.ctrlKey)||N.shiftKey||N.altKey||N.code!=="KeyV"||(async()=>{try{const j=await Promise.race([navigator.clipboard?.read?.(),new Promise(X=>setTimeout(()=>X(void 0),iF))]);for(const X of j??[]){const tt=X.types.find(nt=>nt.startsWith("image/"));if(!tt)continue;const U=await X.getType(tt);ao(new File([U],"clipboard",{type:tt}));return}}catch{}})()};return window.addEventListener("paste",w,!0),window.addEventListener("keydown",S,!0),()=>{window.removeEventListener("paste",w,!0),window.removeEventListener("keydown",S,!0)}},[io,b,ao]);const Cf=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Fr.current.find(j=>j.id===w);if(!N||N.anchor.type!=="redact")return;te();const D=Se(S.clientX,S.clientY);ge.current=!1,Us.current={pinId:w,startX:N.anchor.x,startY:N.anchor.y,startSvgX:D.x,startSvgY:D.y}},[Se,te]),Ou=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation();const D=Fr.current.find(X=>X.id===w);if(!D||D.anchor.type!=="redact")return;te();const j=Se(N.clientX,N.clientY);ge.current=!1,Vl.current={pinId:w,handle:S,startX:D.anchor.x,startY:D.anchor.y,startW:D.anchor.width,startH:D.anchor.height,startSvgX:j.x,startSvgY:j.y}},[Se,te]),Qc=I.useCallback((w,S)=>{te(),lt(N=>N.map(D=>D.id===w&&D.anchor.type==="redact"?{...D,anchor:{...D.anchor,...S}}:D))},[te]),Ef=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Fr.current.find(j=>j.id===w);if(!N||N.anchor.type!=="image")return;te();const D=Se(S.clientX,S.clientY);ge.current=!1,Ya.current={pinId:w,startX:N.anchor.x,startY:N.anchor.y,startSvgX:D.x,startSvgY:D.y}},[Se,te]),lo=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation();const D=Fr.current.find(X=>X.id===w);if(!D||D.anchor.type!=="image")return;te();const j=Se(N.clientX,N.clientY);ge.current=!1,Wl.current={pinId:w,handle:S,startX:D.anchor.x,startY:D.anchor.y,startW:D.anchor.width,startH:D.anchor.height,startSvgX:j.x,startSvgY:j.y}},[Se,te]),Kr=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation();const N=Fr.current.find(j=>j.id===w);if(!N||N.anchor.type!=="text"||!N.anchor.point)return;te();const D=Se(S.clientX,S.clientY);ge.current=!1,V(w),ba.current={pinId:w,startPoint:{...N.anchor.point},startBox:{x:N.anchor.x,y:N.anchor.y},startSvgX:D.x,startSvgY:D.y}},[Se,te]),nr=I.useCallback((w,S,N)=>{N.preventDefault(),N.stopPropagation();const D=Z.find(U=>U.id===w);if(!D||D.anchor.type!=="text")return;te();const j=Se(N.clientX,N.clientY),X=D.anchor.x+D.anchor.width/2,tt=D.anchor.y+D.anchor.height/2;Bs.current={pinId:w,handle:S,startCenterX:X,startCenterY:tt,startDist:Math.max(1,Math.hypot(j.x-X,j.y-tt)),startFontSize:D.textFontSize??Pa},ge.current=!1},[Z,te,Se]),bi=I.useCallback((w,S)=>{const N=S?.fontSize??Pa,D=S?.bold?"700":"400",j=S?.italic?"italic ":"",tt=document.createElement("canvas").getContext("2d");return tt?(tt.font=`${j}${D} ${N}px ${er.current}`,O8(w,U=>tt.measureText(U).width,S)):{width:Pk,height:jk}},[]),ei=I.useCallback((w,S)=>{const N=Fr.current.find(tt=>tt.id===w);if(!N||N.anchor.type!=="text")return;const D=bi(S,{fontSize:N.textFontSize??Pa,bold:N.textBold??!1,italic:N.textItalic??!1}),j=D.width,X=D.height;lt(tt=>tt.map(U=>{if(U.id!==w||U.anchor.type!=="text")return U;const nt=Math.max(0,Zn.current.w-j),ft=Math.max(0,Zn.current.h-X);return{...U,anchor:{...U.anchor,width:j,height:X,x:Math.max(0,Math.min(U.anchor.x,nt)),y:Math.max(0,Math.min(U.anchor.y,ft))}}}))},[bi]),Ji=I.useCallback(w=>{const S=w.trim()?w:Py;if(typeof document>"u")return S;const N=document.createElement("div");return N.innerHTML=S,N.querySelectorAll("p").forEach(D=>{D.style.margin="0",D.style.padding="0"}),N.innerHTML},[]),sa=I.useCallback((w=new Date,S=I2)=>{if(!E)return;const{w:N,h:D}=Zn.current;if(!N||!D)return;const j=Ud(w,S),X=Ji(`<p>${j}</p>`),tt=bi(X,{fontSize:Pa,bold:!1,italic:!1}),U=12*ue,nt=Math.max(0,Math.min(U,N-tt.width)),ft=Math.max(0,Math.min(D-tt.height-U,D-tt.height)),it=Oa(),mt=vu;te(),lt(z=>[...z,{id:it,anchor:{type:"text",x:nt,y:ft,width:tt.width,height:tt.height},color:mt,label:ef(z),image:null,imageAspect:null,description:X,descPos:"below",textColor:"#FFFFFF",textBackgroundColor:"#000000"}]),V(it),xt(it),Xi(it),_("select"),Xr.current=it,Fo.current=!0,xn(!1)},[E,bi,Ji,te]),Pu=I.useCallback((w,S)=>{te(),lt(N=>N.map(D=>{if(D.id!==w||D.anchor.type!=="text")return D;const j={...D,textFontSize:Math.max(mS,(D.textFontSize??Pa)+S)},X=D.anchor,tt=bi(j.description||"",{fontSize:j.textFontSize,bold:j.textBold??!1,italic:j.textItalic??!1}),U=Math.max(0,G.w-tt.width),nt=Math.max(0,G.h-tt.height);return{...j,anchor:{...X,width:tt.width,height:tt.height,x:Math.max(0,Math.min(X.x,U)),y:Math.max(0,Math.min(X.y,nt))}}}))},[G.h,G.w,bi,te]),nl=I.useCallback(w=>{if(!E)return;const{w:S,h:N}=Zn.current;if(!S||!N)return;const D=oA,{cx:j,cy:X}=uD(w,S,N,D),tt=Oa(),U=vu;te(),lt(nt=>[...nt,{id:tt,anchor:{type:"compass",cx:j,cy:X,radius:D,rotation:0},color:U,label:ef(nt),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),V(tt),xt(tt),_("select"),Xr.current=tt,Fo.current=!0,Mn(!1)},[E,te]),vo=I.useCallback(()=>{hs(w=>!w)},[]),Cl=I.useCallback(()=>{E&&(xn(!1),Mn(w=>!w))},[E]),Tf=I.useCallback(()=>{E&&(Mn(!1),xn(w=>{if(w)return!1;if(Me)Ei(Bf(Ke));else{const S=new Date;Vn(S),Ei(Bf(S))}return!0}))},[E,Ke,Me]),Cc=I.useCallback(()=>{const w=new Date;Vn(w),Ei(Bf(w))},[]),tu=I.useCallback(()=>{sa(Me?Ke:new Date,Qt)},[Ke,Qt,Me,sa]),El=I.useCallback(()=>{sa(Ke,Qt)},[Ke,Qt,sa]),Ss=I.useCallback((w,S)=>{const N=document.querySelector(`div[data-text-pin-id="${w}"]`);if(!N)return!1;const D=window.getSelection();if(!D||D.rangeCount===0)return!1;const j=D.getRangeAt(0);if(j.collapsed||!N.contains(j.commonAncestorContainer))return!1;te(),N.focus(),document.execCommand(S,!1);const X=Ji(N.innerHTML);return N.innerHTML=X,lt(tt=>tt.map(U=>U.id===w?{...U,description:X}:U)),ei(w,X),!0},[te,ei,Ji]),ks=I.useCallback((w,S)=>{const N=Fr.current.find(D=>D.id===w);!N||N.description===S||(te(),lt(D=>D.map(j=>j.id===w?{...j,description:S}:j)))},[te]),ts=I.useCallback(w=>{const S=ma.current;if(!S)return;const N=Ji(S.innerHTML);ks(w,N),ei(w,N)},[ei,Ji,ks]);I.useEffect(()=>{if(!Vo)return;const w=S=>{S.target?.closest('[data-text-bg-picker="true"]')||fr(null)};return window.addEventListener("pointerdown",w,!0),()=>window.removeEventListener("pointerdown",w,!0)},[Vo]),I.useEffect(()=>{if(!Wi){ma.current=null;return}const w=Fr.current.find(D=>D.id===Wi);if(!w||w.anchor.type!=="text")return;const S=Ji(w.description),N=!w.description.trim()||w.description===Py;requestAnimationFrame(()=>{const D=ma.current;if(!D)return;D.innerHTML!==S&&(D.innerHTML=S),D.focus();const j=document.createRange();j.selectNodeContents(D),N||j.collapse(!1);const X=window.getSelection();X?.removeAllRanges(),X?.addRange(j)})},[Wi,Ji]),I.useEffect(()=>{if(!Wi)return;const w=S=>{const N=S.target,D=ma.current;!D||N&&D.contains(N)||(ts(Wi),Xi(null))};return window.addEventListener("pointerdown",w,!0),()=>window.removeEventListener("pointerdown",w,!0)},[Wi,ts]);const Tl=I.useCallback((w,S)=>{const N=new Image;N.onload=()=>{const D=N.naturalWidth/N.naturalHeight;te(),lt(j=>j.map(X=>X.id===w?{...X,image:S,imageAspect:D}:X))},N.src=S},[te]),tc=I.useCallback((w,S)=>{const N=dc(S),D=Fr.current.find(X=>X.id===w);if(!N||!D)return;const j=oB(N);Object.keys(j).length!==0&&(te(),lt(X=>X.map(tt=>tt.id===w?{...tt,...j}:tt)),Eg(document.activeElement)&&document.activeElement.blur(),V(w),xt(w))},[dc,te]);I.useEffect(()=>{const w=S=>{if(Eg(S.target))return;const N=ut??K;if(!N){if(!Di.current)return;const it=y2(S.clipboardData);if(!it)return;S.preventDefault(),ao(it);return}const D=Fr.current.find(it=>it.id===N)??null,j=S.target,X=j?.tagName,tt=X==="TEXTAREA"||X==="INPUT"&&!j.readOnly&&!j.disabled,U=!!j&&(j.isContentEditable||j.closest(".ProseMirror")!==null||tt),nt=S.clipboardData?.items;if(nt){for(const it of nt)if(it.type.startsWith("image/")){S.preventDefault(),S.stopPropagation();const mt=it.getAsFile();if(!mt)return;const z=new FileReader;z.onload=Nt=>{const jt=Nt.target?.result;jt&&Tl(N,jt)},z.readAsDataURL(mt);return}}let ft=S.clipboardData?.getData("text/plain")??"";if(!ft&&S.clipboardData?.items?.length){for(const mt of S.clipboardData.items)if(mt.kind==="string"&&mt.type==="text/plain"){S.preventDefault();const z=N,Nt=ut;mt.getAsString(jt=>{const St=jt??"";if(St.trim()){if(Nt&&z===Nt&&D?.anchor.type!=="text"){document.dispatchEvent(new CustomEvent(R0,{detail:{pinId:Nt,text:St},bubbles:!0}));return}ks(z,St)}});return}const it=S.clipboardData.getData("text/html");if(it)try{ft=new DOMParser().parseFromString(it,"text/html").body?.textContent??""}catch{ft=""}}if(ft.trim().length>0){if(ut&&N===ut&&D?.anchor.type!=="text"){S.preventDefault(),S.stopPropagation(),document.dispatchEvent(new CustomEvent(R0,{detail:{pinId:ut,text:ft},bubbles:!0}));return}if(U)return;S.preventDefault(),ks(N,ft)}};return document.addEventListener("paste",w,!0),()=>document.removeEventListener("paste",w,!0)},[ut,K,Tl,ks,ao]);const Ys=I.useCallback((w,S)=>{te(),lt(N=>N.map(D=>D.id===w?{...D,color:S}:D))},[te]),eu=I.useCallback((w,S)=>{te(),lt(N=>N.map(D=>D.id!==w||!B0(D.anchor)?D:{...D,strokeStyle:S}))},[te]),rl=I.useCallback((w,S)=>{te(),lt(N=>N.map(D=>D.id!==w||!F5(D.anchor)?D:{...D,fillStyle:S}))},[te]),Zi=I.useCallback((w,S)=>{te(),lt(N=>N.map(D=>{if(D.id!==w)return D;if(S===null){const j={...D};return delete j.strokeWidthScale,j}return{...D,strokeWidthScale:id(S)}}))},[te]),nu=I.useCallback((w,S)=>{te(),lt(N=>rD(N,w,S))},[te]),gd=I.useCallback(w=>{te(),lt(S=>S.map(N=>N.id===w?{...N,descPos:N.descPos==="above"?"below":"above"}:N))},[te]),ec=I.useCallback(w=>{te();const S=U_(w,Fr.current);lt(N=>Bk(N.filter(D=>!S.has(D.id)))),ee(N=>{const D={...N};for(const j of S)delete D[j];return D}),V(null),xt(null),Xi(N=>N===w?null:N)},[te]),yh=I.useCallback(w=>{const S=Fr.current.find(Nt=>Nt.id===w),N=S?R2(S,Fr.current):null;if(!N||!aS(N))return;const D=N.id;te();const j=Oa(),tt=[D,...j5(D,Fr.current)].map(Nt=>ls.current[Nt]).filter(Nt=>!!Nt),U=tt.length>0?tt.reduce((Nt,jt)=>jt.y+jt.height>Nt.y+Nt.height?jt:Nt):cs(N.anchor),{w:nt,h:ft}=Zn.current,it=U.width,mt=P2,z={x:Math.max(0,Math.min(U.x+Ua,Math.max(0,nt-it))),y:Math.max(0,Math.min(U.y+U.height+Ua,Math.max(0,ft-mt))),width:it,height:mt};lt(Nt=>[...Nt,{id:j,anchor:{type:"linked",pinId:D},color:N.color,label:N.label,image:null,imageAspect:null,description:"",descPos:N.descPos,theme:N.theme,textFontSize:N.textFontSize}]),ee(Nt=>({...Nt,[j]:z})),Xr.current=j,V(j),xt(j)},[te]),Nf=I.useCallback((w,S)=>{te(),lt(N=>N.map(D=>D.id===w?{...D,calloutHidden:S}:D)),S?(V(w),xt(null)):(V(w),xt(w))},[te]),xr=I.useCallback(async(w="png",S=1,N)=>{if(!Di.current||!Zn.current.w)return;const D=It=>new Promise((Ye,Ae)=>{const Be=new Image;Be.onload=()=>Ye(Be),Be.onerror=Ae,Be.src=It});let j=null;try{j=await D(Di.current)}catch{j=null}const X=Fr.current,tt=ls.current,{w:U,h:nt}=Zn.current;if(!U)return;const it=2*(S||1),mt=document.createElement("canvas");mt.width=U*it,mt.height=nt*it;const z=mt.getContext("2d");z.scale(it,it);const Nt=(It,Ye,Ae,Be,Ve)=>{z.beginPath(),z.moveTo(It+Ve,Ye),z.lineTo(It+Ae-Ve,Ye),z.arcTo(It+Ae,Ye,It+Ae,Ye+Ve,Ve),z.lineTo(It+Ae,Ye+Be-Ve),z.arcTo(It+Ae,Ye+Be,It+Ae-Ve,Ye+Be,Ve),z.lineTo(It+Ve,Ye+Be),z.arcTo(It,Ye+Be,It,Ye+Be-Ve,Ve),z.lineTo(It,Ye+Ve),z.arcTo(It,Ye,It+Ve,Ye,Ve),z.closePath()},jt=await Promise.allSettled(X.map(It=>It.image?D(It.image):Promise.resolve(null))),St=await Promise.all(X.filter(It=>It.anchor.type==="image").map(async It=>{const Ye=It.anchor.type==="image"?It.anchor.src:"";try{return[It.id,await D(Ye)]}catch{return[It.id,null]}})),Rt=new Map(St),kt=new Map(jt.map((It,Ye)=>[X[Ye].id,It.status==="fulfilled"?It.value:null]));j&&z.drawImage(j,0,0,U,nt);const qt=It=>yS(It,Yo.current),Ut=It=>`${It.i?"italic ":""}${It.b?"700":"400"} ${It.fs}px ${er.current}`,oe=new Map,be=It=>{const Ye=Ut(It),Ae=oe.get(Ye);if(Ae)return Ae;z.font=Ye;const Be=z.measureText("Hg"),Ve=Be.fontBoundingBoxAscent||It.fs*.8,Cn=Be.fontBoundingBoxDescent||It.fs*.2,Yr={asc:Ve,desc:Cn};return oe.set(Ye,Yr),Yr},xe={measure:(It,Ye)=>(z.font=Ut(Ye),z.measureText(It).width),contentHeight:It=>{const{asc:Ye,desc:Ae}=be(It);return Ye+Ae},ascentRatio:It=>{const{asc:Ye,desc:Ae}=be(It);return Ye+Ae>0?Ye/(Ye+Ae):.8}},$e=Pg(X);z.lineCap="round";const vn=It=>{if(It.calloutHidden||It.anchor.type==="text"||It.anchor.type==="standalone"||It.anchor.type==="redact")return;const Ye=tt[It.id];if(!Ye)return;const Ae=Um(It,X);if(!Ae)return;const Be=xg(Ae,Ye,It.leaderPoints);z.beginPath(),Be.forEach((Ve,Cn)=>Cn===0?z.moveTo(Ve.x,Ve.y):z.lineTo(Ve.x,Ve.y)),z.strokeStyle=It.color,z.lineJoin="round",z.lineWidth=H4*qt(It),z.stroke()},de=It=>{const Ye=qt(It);if(It.anchor.type==="redact"){if(N?.skipRedaction)return;AA(z,mt,{rect:It.anchor,mode:It.anchor.mode,strength:It.anchor.strength,imageSize:{w:U,h:nt},sourceSize:{w:mt.width,h:mt.height}});return}if(It.anchor.type==="image"){const Ae=Rt.get(It.id);if(Ae){const{x:Be,y:Ve,width:Cn,height:Yr}=It.anchor;z.drawImage(Ae,Be,Ve,Cn,Yr)}return}if(It.anchor.type==="point"){const{x:Ae,y:Be}=It.anchor,Ve=tp*Ye;z.beginPath(),z.arc(Ae+fS*Ye,Be+dS*Ye,Ve+hS*Ye,0,Math.PI*2),z.fillStyle=pS,z.fill(),z.beginPath(),z.arc(Ae,Be,Ve,0,Math.PI*2),z.fillStyle=It.color,z.fill(),z.strokeStyle="white",z.lineWidth=bg*Ye,z.stroke()}else if(It.anchor.type==="numbering"){const{start:Ae,end:Be}=It.anchor;z.beginPath(),z.moveTo(Ae.x,Ae.y),z.lineTo(Be.x,Be.y),z.strokeStyle=It.color,z.lineWidth=Rf*Ye,z.stroke();const Ve=String(It.label),Cn=14*ue,Yr=0*Cn,co=.4*Cn,Qr=.35*Cn;z.font=`700 ${Cn}px ${er.current}`;const ui=Math.max(Cn*.62,z.measureText(Ve).width)+co*2,Lr=Cn+Yr+Qr,Er=Be.x-ui/2,Jn=Be.y-Lr/2,qi=4*ue;z.beginPath(),z.moveTo(Er+qi,Jn),z.lineTo(Er+ui-qi,Jn),z.quadraticCurveTo(Er+ui,Jn,Er+ui,Jn+qi),z.lineTo(Er+ui,Jn+Lr-qi),z.quadraticCurveTo(Er+ui,Jn+Lr,Er+ui-qi,Jn+Lr),z.lineTo(Er+qi,Jn+Lr),z.quadraticCurveTo(Er,Jn+Lr,Er,Jn+Lr-qi),z.lineTo(Er,Jn+qi),z.quadraticCurveTo(Er,Jn,Er+qi,Jn),z.closePath(),z.fillStyle="rgba(10,10,16,0.95)",z.fill(),z.strokeStyle=It.color,z.lineWidth=1.5*ue,z.stroke(),z.textAlign="center",z.textBaseline="middle",z.fillStyle="#ffffff",z.fillText(Ve,Be.x,Be.y),z.textAlign="left",z.textBaseline="alphabetic"}else if(It.anchor.type==="polygon"){const Be=It.anchor.points;if(Be.length>=2){z.beginPath(),z.moveTo(Be[0].x,Be[0].y);for(let Cn=1;Cn<Be.length;Cn++)z.lineTo(Be[Cn].x,Be[Cn].y);z.closePath();const Ve=vg(It.color,It.fillStyle);Ve&&(z.fillStyle=Ve,z.fill()),z.setLineDash(Rc(It)?zf.map(Cn=>Cn*Ye):[]),z.strokeStyle=It.color,z.lineWidth=Rf*Ye,z.stroke(),z.setLineDash([])}}else if(It.anchor.type==="polyline"){const Be=It.anchor.points;if(Be.length>=2){z.beginPath(),z.moveTo(Be[0].x,Be[0].y);for(let Ve=1;Ve<Be.length;Ve++)z.lineTo(Be[Ve].x,Be[Ve].y);z.setLineDash(Rc(It)?zf.map(Ve=>Ve*Ye):[]),z.strokeStyle=It.color,z.lineWidth=Rf*Ye,z.stroke(),z.setLineDash([])}}else if(It.anchor.type==="rectangle"){const{x:Ae,y:Be,width:Ve,height:Cn,rotation:Yr=0}=It.anchor,co=Ae+Ve/2,Qr=Be+Cn/2,So=Yr*Math.PI/180;z.save(),z.translate(co,Qr),z.rotate(So),z.translate(-Ve/2,-Cn/2),z.beginPath(),z.rect(0,0,Ve,Cn);const ui=vg(It.color,It.fillStyle);ui&&(z.fillStyle=ui,z.fill()),z.setLineDash(Rc(It)?zf.map(Lr=>Lr*Ye):[]),z.strokeStyle=It.color,z.lineWidth=Rf*Ye,z.stroke(),z.setLineDash([]),z.restore()}else if(It.anchor.type==="ellipse"){const{cx:Ae,cy:Be,rx:Ve,ry:Cn,rotation:Yr=0}=It.anchor,co=Yr*Math.PI/180;z.save(),z.translate(Ae,Be),z.rotate(co),z.beginPath(),z.ellipse(0,0,Ve,Cn,0,0,Math.PI*2);const Qr=vg(It.color,It.fillStyle);Qr&&(z.fillStyle=Qr,z.fill()),z.setLineDash(Rc(It)?zf.map(So=>So*Ye):[]),z.strokeStyle=It.color,z.lineWidth=Rf*Ye,z.stroke(),z.setLineDash([]),z.restore()}else if(It.anchor.type==="compass")dD(z,{cx:It.anchor.cx,cy:It.anchor.cy,radius:It.anchor.radius,rotation:It.anchor.rotation??0,color:It.color,strokeWidth:wg*Ye});else if(It.anchor.type==="arrow"){const{start:Ae,end:Be,control:Ve}=It.anchor;z.beginPath(),z.moveTo(Ae.x,Ae.y),z.quadraticCurveTo(Ve.x,Ve.y,Be.x,Be.y),z.setLineDash(Rc(It)?zf.map(Jn=>Jn*Ye):[]),z.strokeStyle=It.color,z.lineWidth=Rf*Ye,z.stroke(),z.setLineDash([]);const Cn=Fk(Ve,Be),Yr=Math.atan2(Cn.y,Cn.x),co=8*ue,Qr=Math.PI/7,So=Be.x-Math.cos(Yr-Qr)*co,ui=Be.y-Math.sin(Yr-Qr)*co,Lr=Be.x-Math.cos(Yr+Qr)*co,Er=Be.y-Math.sin(Yr+Qr)*co;z.beginPath(),z.moveTo(Be.x,Be.y),z.lineTo(So,ui),z.lineTo(Lr,Er),z.closePath(),z.fillStyle=It.color,z.fill(),z.stroke()}},fn=It=>{if(It.anchor.type!=="text")return;if(It.anchor.point){const Jn=qt(It),{x:qi,y:As}=It.anchor.point;z.beginPath(),z.arc(qi+fS*Jn,As+dS*Jn,tp*Jn+hS*Jn,0,Math.PI*2),z.fillStyle=pS,z.fill(),z.beginPath(),z.arc(qi,As,tp*Jn,0,Math.PI*2),z.fillStyle=It.color,z.fill(),z.strokeStyle="white",z.lineWidth=bg*Jn,z.stroke()}const{x:Ye,y:Ae,width:Be}=It.anchor,Ve=It.textBackgroundColor,Cn=It.textColor??"#ffffff",Yr=It.textFontSize??Pa,co=It.textBold?700:400,Qr=It.textItalic?"italic ":"",So=Y2(It.description||""),ui=Z4(So.length,Yr);Ve!=null&&Ve!=="transparent"&&(z.fillStyle=Ve,Nt(Ye,Ae,Be,ui,gS),z.fill()),z.font=`${Qr}${co} ${Yr}px ${er.current}`,z.fillStyle=Cn,z.textBaseline="top";const Lr=Ye+Rg+F2;let Er=Ae+Rg+s8;for(const Jn of So){z.fillText(Jn,Lr,Er);const qi=Er+Yr*.9,As=z.measureText(Jn).width;It.textUnderline&&(z.strokeStyle=Cn,z.lineWidth=1,z.beginPath(),z.moveTo(Lr,qi+1),z.lineTo(Lr+As,qi+1),z.stroke()),It.textStrike&&(z.strokeStyle=Cn,z.lineWidth=1,z.beginPath(),z.moveTo(Lr,Er+Yr*.55),z.lineTo(Lr+As,Er+Yr*.55),z.stroke()),Er+=Yr*Lg}},Ce=It=>{if(It.calloutHidden||It.anchor.type==="text"||It.anchor.type==="redact")return;const Ye=tt[It.id];if(!Ye)return;const{x:Ae,y:Be,width:Ve,height:Cn}=Ye,Yr=$4*W4(qt(It)),co=Yr,Qr=Ae+co,So=Be+co,ui=Math.max(0,Ve-2*co),Lr=Math.max(0,Cn-2*co),Er=(It.textFontSize??Pa)*F4,Jn=It.description?q8({html:It.description,width:Math.max(0,ui-B2*2),fontSize:Er,fontFamily:er.current,lineHeight:Lg,metrics:xe}):null,qi=Jn?Jn.height+z2+Y4:0,As=!!It.description,_l=It.image?q4:0;let ju=As?qi:It.image?0:Lr,aa=It.image?Lr-ju:0;It.image&&aa<_l&&(aa=_l,ju=Math.max(0,Lr-aa));const Dl=It.descPos==="above"?So+ju:So,yd=It.descPos==="above"?So:So+aa;z.save(),Nt(Ae,Be,Ve,Cn,j2),z.clip();const bd=It.theme==="light"&&As,Jp=It.textColor??(bd?"#111111":"#d0d0d0"),Zp=It.textBackgroundColor===null?"rgba(0,0,0,0)":It.textBackgroundColor??(bd?"rgba(245,245,250,0.98)":"rgba(10,10,16,0.88)");if(z.fillStyle=Zp,z.fillRect(Ae,Be,Ve,Cn),It.image){const il=kt.get(It.id)??null;if(il){const Tc=il.width/il.height,iu=ui/aa;let ou=0,ko=0,Nc=il.width,ol=il.height;Tc>iu?(Nc=ol*iu,ou=(il.width-Nc)/2):(ol=Nc/iu,ko=(il.height-ol)/2),z.drawImage(il,ou,ko,Nc,ol,Qr,Dl,ui,aa)}z.strokeStyle=It.color+"44",z.lineWidth=1*ue,z.beginPath(),It.descPos==="above"?As&&(z.moveTo(Qr,Dl),z.lineTo(Qr+ui,Dl)):As&&(z.moveTo(Qr,yd),z.lineTo(Qr+ui,yd)),z.stroke()}if(Jn){const il=yd+z2,Tc=Qr+B2;z.textAlign="left",z.textBaseline="alphabetic";for(const iu of Jn.lines){const ou=il+iu.baseline;for(const ko of iu.runs)if(z.font=Ut(ko),z.fillStyle=Jp,z.fillText(ko.text,Tc+ko.x,ou),ko.u||ko.s){const Nc=z.measureText(ko.text).width;if(z.strokeStyle=Jp,z.lineWidth=1*ue,z.beginPath(),ko.u){const ol=ou+ko.fs*.1;z.moveTo(Tc+ko.x,ol),z.lineTo(Tc+ko.x+Nc,ol)}if(ko.s){const ol=ou-ko.fs*.3;z.moveTo(Tc+ko.x,ol),z.lineTo(Tc+ko.x+Nc,ol)}z.stroke()}}}z.restore(),Nt(Ae,Be,Ve,Cn,j2),z.strokeStyle=It.color,z.lineWidth=Yr,z.stroke()};for(const It of $e)vn(It),It.anchor.type==="text"?fn(It):de(It),Ce(It);const Hn=w==="jpeg"?"image/jpeg":"image/png",Ir=mt.toDataURL(Hn,w==="jpeg"?.92:void 0);if(N?.returnDataUrl)return Ir;const zr=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),Ro=w==="jpeg"?`img_${zr}.jpg`:`img_${zr}.png`;if(td()&&await Ik(Ir,Ro))return;const qo=document.createElement("a");if(qo.href=Ir,qo.download=Ro,A){window.open(Ir,"_blank","noopener,noreferrer");return}qo.click()},[A]);Rs.current=xr;const Nl=I.useCallback(async()=>{if(!E||!G.w)return null;const w=await xr("png",1,{returnDataUrl:!0});if(!w||typeof w!="string")return null;const{w:S,h:N}=G,D=new pn({orientation:S>N?"landscape":"portrait",unit:"mm",format:"a4"}),j=D.internal.pageSize.getWidth(),X=D.internal.pageSize.getHeight(),tt=25.4/96,U=S*tt,nt=N*tt,ft=Math.min(j/U,X/nt),it=U*ft,mt=nt*ft,z=(j-it)/2,Nt=(X-mt)/2;return D.addImage(w,"PNG",z,Nt,it,mt),D.output("blob")},[E,G,xr]),Ec=I.useCallback(async()=>{const w=await Nl();if(!w)return;const N=`collage_${new Date().toISOString().replace(/[:.]/g,"-").slice(0,19)}.pdf`,D=URL.createObjectURL(w);if(setTimeout(()=>URL.revokeObjectURL(D),6e4),td()&&await Ik(D,N))return;const j=document.createElement("a");j.href=D,j.download=N,j.click()},[Nl]),ru=I.useCallback(async()=>{if(!(!E||!G.w||yl)){pc(!0);try{const S=window.ClipboardItem;if(!$l||!S)return;const N=await xr("png",1,{returnDataUrl:!0});if(!N||typeof N!="string")return;const D=Hk(N);if(!D)return;const j=new S({[D.type]:D});await navigator.clipboard.write([j]),hc(!0),setTimeout(()=>hc(!1),1500)}catch{}finally{pc(!1)}}},[E,G.w,yl,xr,$l]),nc=I.useCallback(w=>{const S=new Date(w);Vn(S),Ei(Bf(S)),Oe(!0)},[]),m=I.useCallback(w=>{Bn(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&&nc(w.capturedAt),L(w.backgroundImage),vt(w.imageSize),gt(w.sourceImageSize),lt(w.pins),ee(w.cardPositions),V(null),xt(null),Xi(null),Ft(null),Zt(null),Ne(null),kr(null),Xe(null),$(!1),Dt(null),Ha.current=!0,_r.current=!0,Mr.current=[],Br.current=[],bl(0),No(0)},[nc]),v=I.useCallback(()=>_9({backgroundImage:E,imageSize:G,sourceImageSize:Tt,pins:Z,cardPositions:Bt,settings:{fontId:or.fontId,strokeWidthScale:Ti},meta:Xn}),[E,G,Tt,Z,Bt,or.fontId,Ti,Xn]),T=I.useCallback(()=>{L(null),vt({w:0,h:0}),gt(null),lt([]),ee({}),Bn(null),V(null),xt(null),Xi(null),Ft(null),Zt(null),Ne(null),kr(null),Xe(null),$(!1),Dt(null),Mr.current=[],Br.current=[],bl(0),No(0),O.current=null,Y.current=null},[]),O=I.useRef(null),F=I.useRef(0),Y=I.useRef(null),W=I.useRef(null),rt=I.useCallback(()=>{O.current=null,F.current=performance.now()+oF},[]),st=I.useRef(f);st.current=f;const yt=I.useRef(c);yt.current=c;const _t=I.useRef(d);_t.current=d;const Vt=I.useCallback(w=>{w&&((w.fontId==="road-ui"||w.fontId==="uaf-sans"&&G4)&&si(w.fontId),typeof w.strokeWidthScale=="number"&&mi(w.strokeWidthScale))},[si,mi]),pt=I.useCallback(async w=>{m(N9(w)),Vt(w.settings),rt()},[m,Vt,rt]),Pt=I.useCallback(async w=>{const S=await R9(w);await new Promise((N,D)=>{oo(S,!0,j=>{j?N():D(new Error("Failed to load image"))})}),rt()},[oo,rt]),$t=I.useCallback(()=>{const w=Y.current;w&&(O.current=w.fingerprint,st.current?.(w.document,{dirty:!1}),W.current?.notifyChange(w.document,!1))},[]),ne=I.useRef({loadDocument:async()=>{},loadImage:async()=>{},getDocument:()=>null,exportImage:async()=>null,exportPdf:async()=>null,markSaved:()=>{},reset:()=>{}});ne.current.loadDocument=pt,ne.current.loadImage=Pt,ne.current.getDocument=v,ne.current.exportImage=async(w,S=1)=>{const N=await xr(w,S,{returnDataUrl:!0});if(!N||typeof N!="string")return null;const D=w==="jpeg"?"image/jpeg":"image/png",j=Hk(N);return j?{mime:D,dataUrl:N,blob:j}:null},ne.current.exportPdf=Nl,ne.current.markSaved=$t,ne.current.reset=T,I.useImperativeHandle(e,()=>ne.current,[]);const Yt=I.useRef(!1);I.useEffect(()=>{Yt.current||!i||(Yt.current=!0,pt(i))},[i,pt]),I.useEffect(()=>{const w=v();if(!w){Y.current=null;return}const S=L9(w);(O.current===null||performance.now()<F.current)&&(O.current=S),Y.current={document:w,fingerprint:S};const N=S!==O.current;st.current?.(w,{dirty:N}),W.current?.notifyChange(w,N)},[v]),I.useEffect(()=>{const w=F9({editor:ne.current,config:{...$9(),...s},onReady:()=>yt.current?.(),onError:S=>_t.current?.(S)});return W.current=w,()=>{w.stop(),W.current===w&&(W.current=null)}},[p,s]);const Jt=g9({state:{backgroundImage:E,imageSize:G,sourceImageSize:Tt,pins:Z,cardPositions:Bt,sourceUrl:Xn?.sourceUrl,sourceTitle:Xn?.sourceTitle,capturedAt:Xn?.capturedAt},onRestore:m,enabled:g.autosave}),{restoreDraft:ae,dismissRestorePrompt:we}=Jt,he=I.useRef(!1);I.useEffect(()=>{if(!he.current&&(he.current=!0,!!td())){if(W9()){ae();return}V9()&&(we(),X9().then(w=>{if(!w){q("Не вдалося отримати знімок від розширення.");return}oo(w.dataUrl,!0,S=>{if(!S){q("Не вдалося завантажити знімок.");return}Bn({sourceUrl:w.sourceUrl,sourceTitle:w.sourceTitle,capturedAt:w.capturedAt}),w.capturedAt!==void 0&&nc(w.capturedAt)})}))}},[ae,we,oo,nc]);const tn=Jt.errorMessage??(Jt.status==="saving"?"Збереження чернетки…":Jt.status==="saved"&&Jt.lastSavedAt?`Чернетка збережена: ${Ud(new Date(Jt.lastSavedAt))}`:Jt.canRestore&&Jt.storedDraftSavedAt?`Знайдено чернетку від ${Ud(new Date(Jt.storedDraftSavedAt))}`:null),He=Jt.status==="error"?"#E63946":"#555",[Sn,Ge]=I.useState(null),Gn=I.useRef(null),$r=I.useRef(null),zn=I.useRef(null),[qe,De]=I.useState(!1),ni=I.useCallback((w,S)=>{S.preventDefault(),S.stopPropagation(),w&&V(w),Ge({pinId:w,x:S.clientX,y:S.clientY,at:Se(S.clientX,S.clientY)})},[Se]),kn=I.useCallback(w=>{const S=Fr.current.find(j=>j.id===w);if(!S)return;Gn.current=TS(S,ls.current[w]),De(!0);const D=Y2(S.description||"").join(`
|
|
236
|
-
`).trim()||`ТИЦЬ: ${S.label}`;$r.current=null,navigator.clipboard?.writeText?.(D).then(()=>{$r.current=D}).catch(()=>{})},[]),jn=I.useCallback(w=>{te(),lt(S=>Bk([...S,w.pin])),w.card&&ee(S=>({...S,[w.pin.id]:w.card})),V(w.pin.id),xt(w.pin.id),Xr.current=null},[te]),Dr=I.useCallback(w=>{const S=Fr.current.find(D=>D.id===w);if(!S)return;const N=tF;jn(iA(TS(S,ls.current[w]),N,N,Oa()))},[jn]),Ri=I.useCallback(w=>{const S=Gn.current;S&&jn(aD(S,w,Oa()))},[jn]),Qi=I.useCallback(()=>{const{w,h:S}=Zn.current;Ri(zn.current??{x:w/2,y:S/2})},[Ri]);I.useEffect(()=>{const w=S=>{const N=$r.current;if(N===null||!Gn.current||!Di.current)return;const D=S.target;D&&(D.isContentEditable||D.closest(".ProseMirror")!==null||D.tagName==="TEXTAREA"||D.tagName==="INPUT")||(S.clipboardData?.getData("text/plain")??"")!==N||(S.preventDefault(),S.stopPropagation(),Qi())};return window.addEventListener("paste",w,!0),()=>window.removeEventListener("paste",w,!0)},[Qi]),XB({isMac:b,backgroundImage:E,pinsLength:Z.length,showExportMenu:Ln,sourceImageSize:Tt,imageSize:G,activePin:K,calloutControlPinId:ut,undo:Yl,redo:xl,handleExport:xr,handleExportPdf:Ec,stepZoom:Al,handleFitToWindow:Aa,deletePin:ec,movePinZ:nu,copyPin:kn,duplicatePin:Dr,pastePinFromClipboard:Qi,setMode:_,setPolygonDraft:Ft,setPolylineDraft:Zt,setShapeDraftType:Ne,setPlacementTool:Ue,setShowExportMenu:Ze,beginCrop:Za,insertCurrentDateTimeText:tu,toggleCompassMenu:Cl,toggleImageObjectMenu:vo,toggleCalloutPanel:ai,newBgFileRef:ya,replaceBgFileRef:Ps,exportMenuOpenedViaHotkeyRef:ur}),I.useEffect(()=>{if(!Xr.current)return;const w=setTimeout(()=>{Xr.current=null},500);return()=>clearTimeout(w)},[ut]);const Jr=I.useMemo(()=>Pg(Z),[Z]),[Ui,wo]=I.useState(null),Oi=Z.some(w=>w.anchor.type==="redact"),Kn=I.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]);I.useEffect(()=>{if(!Oi||!E||!G.w){wo(null);return}let w=!1;const S=setTimeout(async()=>{const N=await Rs.current?.("png",Z9,{returnDataUrl:!0,skipRedaction:!0});if(w||typeof N!="string")return;const D=new Image;D.onload=()=>{w||wo(D)},D.src=N},Q9);return()=>{w=!0,clearTimeout(S)}},[Oi,E,G.w,G.h,Kn,Bt]);const[dr,xi]=I.useState(null);I.useEffect(()=>{if(!Sn)return;const w=()=>Ge(null),S=N=>{N.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)}},[Sn]);const lr=I.useMemo(()=>{const w={};for(const S of Z)if(S.anchor.type==="polygon"||S.anchor.type==="polyline"){const N=S.anchor.points;if(!N.length)continue;let D=N[0].x,j=N[0].y,X=N[0].x,tt=N[0].y;for(let U=1;U<N.length;U++)N[U].x<D&&(D=N[U].x),N[U].y<j&&(j=N[U].y),N[U].x>X&&(X=N[U].x),N[U].y>tt&&(tt=N[U].y);w[S.id]={minX:D,minY:j,maxX:X,maxY:tt}}return w},[Z]),to=I.useCallback(w=>{const S=12*ue,N=S,D=S,j=Math.max(N,G.w-S),X=Math.max(D,G.h-S),tt=(ft,it,mt)=>Math.max(it,Math.min(ft,mt));let U=S,nt=S;if(w.anchor.type==="point")U=w.anchor.x+S,nt=w.anchor.y+S;else if(w.anchor.type==="image")U=w.anchor.x+w.anchor.width+S,nt=w.anchor.y+S;else if(w.anchor.type==="polygon"||w.anchor.type==="polyline"){const ft=lr[w.id];ft&&(U=ft.maxX+S,nt=ft.maxY+S)}else if(w.anchor.type==="rectangle"){const{x:ft,y:it,width:mt,height:z,rotation:Nt=0}=w.anchor,jt=ft+mt/2,St=it+z/2,Rt=Nt*Math.PI/180,kt=Math.cos(Rt),qt=Math.sin(Rt),Ut=[{lx:-mt/2,ly:-z/2},{lx:mt/2,ly:-z/2},{lx:mt/2,ly:z/2},{lx:-mt/2,ly:z/2}].map(xe=>({x:jt+xe.lx*kt-xe.ly*qt,y:St+xe.lx*qt+xe.ly*kt})),oe=Math.max(...Ut.map(xe=>xe.x)),be=Math.max(...Ut.map(xe=>xe.y));U=oe+S,nt=be+S}else if(w.anchor.type==="ellipse"){const{cx:ft,cy:it,rx:mt,ry:z,rotation:Nt=0}=w.anchor,jt=Nt*Math.PI/180,St=Math.cos(jt),Rt=Math.sin(jt),kt=Math.sqrt((mt*St)**2+(z*Rt)**2),qt=Math.sqrt((mt*Rt)**2+(z*St)**2);U=ft+kt+S,nt=it+qt+S}else if(w.anchor.type==="compass")U=w.anchor.cx+w.anchor.radius+S,nt=w.anchor.cy+w.anchor.radius+S;else if(w.anchor.type==="arrow"){const ft=[w.anchor.start,w.anchor.end,w.anchor.control],it=Math.max(...ft.map(z=>z.x)),mt=Math.max(...ft.map(z=>z.y));U=it+S,nt=mt+S}return{x:tt(U,N,j),y:tt(nt,D,X)}},[G.h,G.w,lr]),vi=w=>{const S=R2(w,Z);return S!==null&&aS(S)},cr=Gi,Pi=Gi,vr=wl.current?.getBoundingClientRect()??null,wi=Xa.current?.getBoundingClientRect()??null,Si=Sl.current?.getBoundingClientRect()??null,Cr=Ga.current?.getBoundingClientRect()??null,bn=!!E&&G.w>0,Hi=kl.current?.getBoundingClientRect()??null,Zr=ro.current?.getBoundingClientRect()??null;return C.jsx(w6.Provider,{value:or.showToolTooltips,children:C.jsxs("div",{ref:Wa,style:{display:"flex",flexDirection:"column",height:"100dvh",minHeight:"100vh",background:"#08080d",color:"#ddd",fontFamily:Fn},onClick:()=>{if(Fo.current){Fo.current=!1;return}V(null),xt(null),Ze(!1),Bo(!1),bt(!1),xn(!1),Mn(!1),hs(!1)},onDragOver:w=>{w.dataTransfer?.types?.includes("Files")&&(w.preventDefault(),w.dataTransfer.dropEffect="copy",no(!0))},onDragLeave:w=>{const S=w.relatedTarget;S&&Wa.current?.contains(S)||no(!1)},onDrop:()=>{no(!1)},children:[C.jsxs("div",{ref:Ki,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:[C.jsx("div",{className:"tyts-no-scrollbar",style:{flex:1,minWidth:0,overflowX:"auto",overflowY:"hidden",display:"flex",alignItems:"center"},children:C.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,minWidth:"100%",width:"max-content"},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[C.jsx("img",{src:"./favicon/favicon.svg",alt:"",width:24,height:24,style:{flexShrink:0},"aria-hidden":!0}),!Gi&&C.jsx("span",{style:{fontWeight:700,letterSpacing:"0.03em"},children:"Тиць"}),E?C.jsxs(C.Fragment,{children:[C.jsx(Tr,{title:"Створити новий колаж (виноски будуть видалені)",onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),Jt.clearDraft(),L(null),vt({w:0,h:0}),gt(null),lt([]),ee({}),V(null),xt(null),Xi(null),Ft(null),Zt(null),Ne(null),Xe(null),Ue("point"),Xe(null),kr(null),$(!1),bt(!1),Dt(null),Ze(!1),no(!1),Mr.current=[],Br.current=[],bl(0),No(0),_("select"),Ue("point"),va(1)},children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-file-earmark-plus`,style:{fontSize:tr},"aria-hidden":!0}),!Nn&&"Нове"]})}),C.jsx(Tr,{title:"Замінити фон, зберегти виноски",onClick:()=>Ps.current?.click(),children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-arrow-repeat`,style:{fontSize:tr},"aria-hidden":!0}),!Nn&&"Замінити"]})}),C.jsxs("div",{ref:wl,style:{position:"relative"},children:[C.jsx(Tr,{title:`Обрізати фон (${en(ie.toolCrop,{isMac:b})})`,tooltip:`Обрізати фон (${en(ie.toolCrop,{isMac:b})})`,onClick:Za,disabled:!E,active:H,tooltipLabel:"Обрізати фон",hotkeyParts:Ii(ie.toolCrop,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-crop`,style:{fontSize:tr,display:"block",lineHeight:1,transform:"translate(-1px, -1px)"},"aria-hidden":!0}),!Nn&&"Crop"]})}),H&&C.jsxs("div",{style:{position:"fixed",top:vr?vr.bottom+6:0,left:vr?vr.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:[C.jsx(Tr,{title:"Обрати формат обрізки",onClick:()=>bt(w=>!w),children:C.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:128,whiteSpace:"nowrap"},children:C.jsx("span",{children:`${qk.find(w=>w.id===ht)?.label??"Вільний формат"}`})})}),wt&&C.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:qk.map(w=>{const S=w.id===ht;return C.jsxs("button",{type:"button",onClick:()=>{Do(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:Fn,fontSize:13,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[C.jsx("span",{children:w.label}),S&&C.jsx("span",{style:{opacity:.9},children:"✓"})]},w.id)})}),C.jsx(Tr,{title:"Скасувати crop",onClick:yo,children:C.jsx("i",{className:`${$n} bi-x-lg`,style:{fontSize:tr-1},"aria-hidden":!0})}),C.jsx(Tr,{primary:!0,title:"Застосувати crop",onClick:()=>{_i()},disabled:Q,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-check-lg`,style:{fontSize:tr},"aria-hidden":!0}),!Nn&&(Q?"Обробка…":"Застосувати")]})})]})]}),C.jsx("input",{ref:ya,type:"file",accept:"image/*",style:{display:"none"},onChange:ms}),C.jsx("input",{ref:Ps,type:"file",accept:"image/*",style:{display:"none"},onChange:qs})]}):C.jsxs(C.Fragment,{children:[C.jsx(Tr,{title:"Завантажити фонове зображення",onClick:()=>ya.current?.click(),children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-image`,style:{fontSize:tr},"aria-hidden":!0}),!Nn&&"Нове зображення"]})}),C.jsx("input",{ref:ya,type:"file",accept:"image/*",style:{display:"none"},onChange:ms})]})]}),C.jsx("div",{style:{display:"flex",justifyContent:"center",flexShrink:0,margin:"0 auto"},children:C.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[C.jsx(Tr,{disabled:!E,active:J==="place"&&At===null&&Lt===null&&Te===null&&_e==="point",onClick:()=>{_("place"),Ft(null),Zt(null),Ne(null),Ue("point")},title:`${J==="place"&&At===null&&!Te?"Клікніть на фото, щоб поставити точку":"Додати точку на фото"} (${en(ie.toolPoint,{isMac:b})})`,tooltip:`${J==="place"&&At===null&&!Te?"Клікніть на фото, щоб поставити точку":"Додати точку на фото"} (${en(ie.toolPoint,{isMac:b})})`,tooltipLabel:"Точка",hotkeyParts:Ii(ie.toolPoint,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-pin-map`,style:{fontSize:tr-1},"aria-hidden":!0}),!Nn&&"Точка"]})}),C.jsxs("div",{ref:Xa,style:{position:"relative"},children:[C.jsx(Tr,{disabled:!E,active:J==="place"&&At!==null,onClick:()=>{_("place"),Ft([]),Zt(null),Ne(null),Xe(null),Ue("point")},title:`${J==="place"&&At!==null?"Клік — додати вершину; тягніть вершину — перемістити; «Готово» — закрити":"Додати район (полігон)"} (${en(ie.toolRegion,{isMac:b})})`,tooltip:`${J==="place"&&At!==null?"Клік — додати вершину; тягніть вершину — перемістити; подвійний клік, клік на першу точку або «Готово» — закрити район":"Додати район (полігон). Кліки задають вершини."} (${en(ie.toolRegion,{isMac:b})})`,tooltipLabel:"Район",hotkeyParts:Ii(ie.toolRegion,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-hexagon`,style:{fontSize:tr},"aria-hidden":!0}),!Nn&&"Район"]})}),At!==null&&C.jsxs("div",{onClick:w=>w.stopPropagation(),style:{position:"fixed",top:wi?wi.bottom+6:0,left:wi?wi.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:[C.jsx(Tr,{title:"Скасувати район",onClick:()=>Ft(null),children:C.jsx("i",{className:`${$n} bi-x-lg`,style:{fontSize:tr-1},"aria-hidden":!0})}),C.jsx(Vk,{canUndo:ve,canRedo:je,onUndo:Yl,onRedo:xl,isMac:b}),C.jsx(Tr,{accent:!0,title:"Завершити район із поточних вершин",tooltip:"Завершити район із поточних вершин",onClick:Ho,disabled:At.length<2,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-check-lg`,style:{fontSize:tr},"aria-hidden":!0}),!cr&&`Готово (${At.length})`]})})]})]}),C.jsxs("div",{ref:Sl,style:{position:"relative"},children:[C.jsx(Tr,{disabled:!E,active:J==="place"&&Lt!==null,onClick:()=>{_("place"),Ft(null),Zt([]),Ne(null),Xe(null),Ue("point")},title:`${J==="place"&&Lt!==null?"Клік — додати точку маршруту; «Готово» — завершити":"Додати маршрут (полілінія)"} (${en(ie.toolRoute,{isMac:b})})`,tooltip:`${J==="place"&&Lt!==null?"Клік — додати точку; тягніть вершину — перемістити; подвійний клік або «Готово» — завершити маршрут (без замикання)":"Додати маршрут (полілінія). Кліки задають точки; лінія не замикається."} (${en(ie.toolRoute,{isMac:b})})`,tooltipLabel:"Маршрут",hotkeyParts:Ii(ie.toolRoute,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("svg",{width:tr,height:tr,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:C.jsx("path",{d:"M1.00007 15L6 8L10 8L15 1.00002",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})}),!Nn&&"Маршрут"]})}),Lt!==null&&C.jsxs("div",{onClick:w=>w.stopPropagation(),style:{position:"fixed",top:Si?Si.bottom+6:0,left:Si?Si.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:[C.jsx(Tr,{title:"Скасувати маршрут",onClick:()=>Zt(null),children:C.jsx("i",{className:`${$n} bi-x-lg`,style:{fontSize:tr-1},"aria-hidden":!0})}),C.jsx(Vk,{canUndo:ve,canRedo:je,onUndo:Yl,onRedo:xl,isMac:b}),C.jsx(Tr,{accent:!0,title:"Завершити маршрут",tooltip:"Завершити маршрут із поточних точок",onClick:Qa,disabled:Lt.length<2,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-check-lg`,style:{fontSize:tr},"aria-hidden":!0}),!cr&&`Готово (${Lt.length})`]})})]})]}),C.jsx(Tr,{disabled:!E,active:J==="place"&&Te==="rectangle",onClick:()=>{_("place"),Ft(null),Zt(null),Ne("rectangle"),Xe(null),Ue("point")},title:`${Te==="rectangle"?"Потягніть на фото, щоб намалювати прямокутник":"Додати прямокутну область"} (${en(ie.toolRectangle,{isMac:b})})`,tooltip:`${Te==="rectangle"?"Потягніть на фото, щоб намалювати прямокутник":"Додати прямокутну область. Потягніть на фото для малювання."} (${en(ie.toolRectangle,{isMac:b})})`,tooltipLabel:"Прямокутник",hotkeyParts:Ii(ie.toolRectangle,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-square`,style:{fontSize:tr-2},"aria-hidden":!0}),!Nn&&"Прямокутник"]})}),C.jsx(Tr,{disabled:!E,active:J==="place"&&Te==="ellipse",onClick:()=>{_("place"),Ft(null),Zt(null),Ne("ellipse"),Xe(null),Ue("point")},title:`${Te==="ellipse"?"Потягніть на фото, щоб намалювати еліпс":"Додати еліптичну область"} (${en(ie.toolEllipse,{isMac:b})})`,tooltip:`${Te==="ellipse"?"Потягніть на фото, щоб намалювати еліпс":"Додати еліптичну область. Потягніть на фото для малювання."} (${en(ie.toolEllipse,{isMac:b})})`,tooltipLabel:"Еліпс",hotkeyParts:Ii(ie.toolEllipse,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-circle`,style:{fontSize:tr-2},"aria-hidden":!0}),!Nn&&"Еліпс"]})}),C.jsx(Tr,{disabled:!E,active:J==="place"&&At===null&&Lt===null&&Te===null&&_e==="arrow",onClick:()=>{_("place"),Ft(null),Zt(null),Ne(null),Xe(null),Ue("arrow")},title:`${_e==="arrow"&&J==="place"?"Потягніть на фото, щоб намалювати стрілку":"Додати стрілку"} (${en(ie.toolArrow,{isMac:b})})`,tooltip:`${_e==="arrow"&&J==="place"?"Потягніть на фото, щоб намалювати стрілку; центральний важіль згинає лінію":"Додати стрілку (drag для створення, центральний важіль для вигину)."} (${en(ie.toolArrow,{isMac:b})})`,tooltipLabel:"Стрілка",hotkeyParts:Ii(ie.toolArrow,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-arrow-right`,style:{fontSize:tr-1},"aria-hidden":!0}),!Nn&&"Стрілка"]})}),C.jsx(Tr,{disabled:!E,active:J==="place"&&At===null&&Lt===null&&Te===null&&_e==="text",onClick:()=>{_("place"),Ft(null),Zt(null),Ne(null),Xe(null),Ue("text")},title:`${_e==="text"&&J==="place"?"Клікніть на фото, щоб додати текст":"Додати текст"} (${en(ie.toolText,{isMac:b})})`,tooltip:`${_e==="text"&&J==="place"?"Клікніть на фото, щоб додати текстову виноску":"Додати текстову виноску"} (${en(ie.toolText,{isMac:b})})`,tooltipLabel:"Текст",hotkeyParts:Ii(ie.toolText,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-type`,style:{fontSize:tr-1},"aria-hidden":!0}),!Nn&&"Текст"]})}),C.jsx(Tr,{disabled:!E,active:J==="place"&&At===null&&Lt===null&&Te===null&&_e==="pointText",onClick:()=>{_("place"),Ft(null),Zt(null),Ne(null),Xe(null),Ue("pointText")},title:`${_e==="pointText"&&J==="place"?"Клікніть на фото, щоб поставити точку з текстом":"Точка з текстом"} (${en(ie.toolPointText,{isMac:b})})`,tooltip:`${_e==="pointText"&&J==="place"?"Клікніть на фото, щоб поставити точку з підписом":"Точка з підписом, без виноски"} (${en(ie.toolPointText,{isMac:b})})`,tooltipLabel:"Точка з текстом",hotkeyParts:Ii(ie.toolPointText,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsxs("svg",{width:tr,height:tr,viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,style:{display:"block",flexShrink:0},children:[C.jsx("circle",{cx:"3.4",cy:"12.6",r:"1.5",fill:"currentColor"}),C.jsx("rect",{x:"6.6",y:"1.1",width:"8.8",height:"7.4",rx:"1.6",stroke:"currentColor",strokeWidth:"1.2"}),C.jsx("text",{x:"11",y:"4.8",textAnchor:"middle",dominantBaseline:"central",fontSize:"5.6",fontWeight:"700",fill:"currentColor",children:"А"})]}),!Nn&&"Точка з текстом"]})}),C.jsx(Tr,{disabled:!E,active:J==="place"&&Te==="redact",onClick:()=>{_("place"),Ft(null),Zt(null),Xe(null),Ne("redact")},title:`Замалювати ділянку фону (${en(ie.toolRedact,{isMac:b})})`,tooltip:`Виділіть ділянку — її можна розмити, пікселізувати або залити середнім кольором (${en(ie.toolRedact,{isMac:b})})`,tooltipLabel:"Замалювати",hotkeyParts:Ii(ie.toolRedact,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-droplet-half`,style:{fontSize:tr-1},"aria-hidden":!0}),!Nn&&"Замалювати"]})}),C.jsxs("div",{ref:ro,style:{position:"relative"},onClick:w=>w.stopPropagation(),children:[C.jsx(Tr,{disabled:!E,active:io,onClick:()=>hs(w=>!w),title:`Додати зображення (${en(ie.toolImageObject,{isMac:b})})`,tooltip:`Покласти зображення поверх фото — можна совати й масштабувати (${en(ie.toolImageObject,{isMac:b})})`,tooltipLabel:"Картинка",hotkeyParts:Ii(ie.toolImageObject,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-image`,style:{fontSize:tr-1},"aria-hidden":!0}),!Nn&&"Картинка"]})}),io&&C.jsxs("div",{style:{position:"fixed",top:Zr?Zr.bottom+6:0,left:Zr?Zr.left+Zr.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:[C.jsx("input",{ref:Kl,type:"text","aria-label":"Вставте зображення з буфера",onChange:()=>{},value:"",onPaste:w=>{const S=y2(w.clipboardData);S&&(w.preventDefault(),ao(S))},style:{position:"absolute",width:1,height:1,opacity:0,border:"none",outline:"none",padding:0,margin:0}}),C.jsxs("button",{type:"button",onClick:()=>Go.current?.click(),onDragOver:w=>{w.preventDefault(),ka(!0)},onDragLeave:()=>ka(!1),onDrop:w=>{w.preventDefault(),w.stopPropagation(),ka(!1);const S=Array.from(w.dataTransfer.files).find(N=>N.type.startsWith("image/"));S&&(Lo(S),hs(!1))},style:{width:260,minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:6,padding:14,borderRadius:8,border:`2px dashed ${Sa?Su:"rgba(255,255,255,0.28)"}`,background:Sa?"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:[C.jsx("i",{className:`${$n} bi-file-earmark-image`,style:{fontSize:22},"aria-hidden":!0}),C.jsx("span",{children:"Перетягніть зображення сюди"}),C.jsx("span",{style:{color:"rgba(255,255,255,0.55)",fontSize:11,letterSpacing:.2},children:G_.join(" · ")}),C.jsxs("span",{style:{color:"rgba(255,255,255,0.45)",fontSize:11,lineHeight:1.5},children:["або клікніть, щоб вибрати файл",C.jsx("br",{}),"чи вставте з буфера (",Wd(),")"]})]})]})]}),C.jsx(Tr,{disabled:!E,active:J==="place"&&At===null&&Lt===null&&Te===null&&_e==="standalone",onClick:()=>{_("place"),Ft(null),Zt(null),Ne(null),Xe(null),Ue("standalone")},title:`${_e==="standalone"&&J==="place"?"Клікніть на фото, щоб додати блок виноски":"Додати блок виноски"} (${en(ie.toolStandaloneCallout,{isMac:b})})`,tooltip:`${_e==="standalone"&&J==="place"?"Клікніть на фото, щоб додати блок виноски без лінії та фігури":"Додати блок виноски без лінії та фігури"} (${en(ie.toolStandaloneCallout,{isMac:b})})`,tooltipLabel:"Блок",hotkeyParts:Ii(ie.toolStandaloneCallout,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-chat-square-text`,style:{fontSize:tr-1},"aria-hidden":!0}),!Nn&&"Блок"]})}),C.jsxs("div",{ref:Ga,style:{position:"relative"},children:[C.jsx(yF,{disabled:!E,menuOpen:gn,onMainClick:tu,onMenuClick:Tf,mainTitle:Me?`Вставити зафіксовані дату та час (${en(ie.toolDateTime,{isMac:b})})`:`Вставити поточні дату та час (${en(ie.toolDateTime,{isMac:b})})`,mainTooltip:Me?`Вставляє зафіксовані дату й час: ${Ud(Ke,Qt)}`:"Додає редагований текст із поточними датою й часом у лівому нижньому куті",menuTitle:"Відкрити календар і вибір часу",menuTooltip:"Відкрити календар (3 місяці) та вибрати дату й час",mainTooltipLabel:"Дата/час",hotkeyParts:Ii(ie.toolDateTime,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,whiteSpace:"nowrap"},children:[C.jsx("i",{className:`${$n} bi-clock`,style:{fontSize:tr-1},"aria-hidden":!0}),Me&&C.jsx("i",{className:`${$n} bi-lock-fill`,style:{fontSize:tr-3,opacity:.85},"aria-hidden":!0}),!Nn&&"Дата/час"]})}),gn&&C.jsx("div",{style:{position:"fixed",top:Cr?Cr.bottom+6:0,left:Cr?Cr.left+Cr.width/2:0,transform:"translateX(-50%)",zIndex:3200},onClick:w=>w.stopPropagation(),children:C.jsx(A8,{value:Ke,viewMonth:ss,format:Qt,locked:Me,onChange:Vn,onViewMonthChange:Ei,onFormatChange:Re,onLockedChange:Oe,onInsert:El,onNow:Cc,onClose:()=>xn(!1)})})]}),C.jsx(Tr,{disabled:!E,active:J==="place"&&At===null&&Lt===null&&Te===null&&_e==="numbering",onClick:()=>{_("place"),Ft(null),Zt(null),Ne(null),Xe(null),Ue("numbering")},title:`${_e==="numbering"&&J==="place"?cn?"Клікніть кінцеву точку лінії нумерації":"Клікніть початкову точку лінії нумерації":"Нумерація (2 точки: початок -> кінець)"} (${en(ie.toolNumbering,{isMac:b})})`,tooltip:`${_e==="numbering"&&J==="place"?cn?"Другий клік поставить кінець і номер на кінці":"Перший клік задає старт лінії":"Поставте старт і фініш лінії, номер буде на кінці"} (${en(ie.toolNumbering,{isMac:b})})`,tooltipLabel:"Нумерація",hotkeyParts:Ii(ie.toolNumbering,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-123`,style:{fontSize:tr-1},"aria-hidden":!0}),!Nn&&"Нумерація"]})}),C.jsxs("div",{ref:kl,style:{position:"relative"},onClick:w=>w.stopPropagation(),children:[C.jsx(Tr,{disabled:!E,active:gr,onClick:Cl,title:`Додати компас (${en(ie.toolCompass,{isMac:b})})`,tooltip:`Оберіть кут, щоб додати компас на зображення (${en(ie.toolCompass,{isMac:b})})`,tooltipLabel:"Компас",hotkeyParts:Ii(ie.toolCompass,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-compass`,style:{fontSize:tr-1},"aria-hidden":!0}),!Nn&&"Компас"]})}),gr&&C.jsx("div",{style:{position:"fixed",top:Hi?Hi.bottom+6:0,left:Hi?Hi.left+Hi.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=>C.jsx("button",{type:"button",title:S==="nw"?"Верхній лівий":S==="ne"?"Верхній правий":S==="sw"?"Нижній лівий":"Нижній правий",onClick:()=>nl(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:C.jsx(gF,{corner:S})},S)))})]}),C.jsx("span",{style:{width:1,height:20,background:"rgba(255,255,255,0.2)",flexShrink:0,marginLeft:10,marginRight:10},"aria-hidden":!0}),C.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[C.jsx(Tr,{disabled:!E,title:`Зменшити масштаб (${en(ie.zoomOut,{isMac:b})})`,onClick:()=>Al("out"),tooltipLabel:"Зменшити масштаб",hotkeyParts:Ii(ie.zoomOut,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:C.jsx("i",{className:`${$n} bi-zoom-out`,style:{fontSize:tr-2},"aria-hidden":!0})})}),!cr&&C.jsxs("span",{style:{minWidth:52,textAlign:"center",color:"#888",fontVariantNumeric:"tabular-nums"},children:[Math.round(ar*100),"%"]}),C.jsx(Tr,{disabled:!E,title:`Збільшити масштаб (${en(ie.zoomIn,{isMac:b})})`,onClick:()=>Al("in"),tooltipLabel:"Збільшити масштаб",hotkeyParts:Ii(ie.zoomIn,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:C.jsx("i",{className:`${$n} bi-zoom-in`,style:{fontSize:tr-2},"aria-hidden":!0})})}),C.jsx(Tr,{disabled:!E,title:`Припасувати розмір зображення під розмір вікна (${en(ie.fitToWindow,{isMac:b})})`,tooltip:`Припасувати розмір зображення під розмір вікна (${en(ie.fitToWindow,{isMac:b})})`,onClick:Aa,hotkeyParts:Ii(ie.fitToWindow,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:C.jsx("i",{className:`${$n} bi-aspect-ratio`,style:{fontSize:tr-2},"aria-hidden":!0})})})]}),C.jsx("span",{style:{width:1,height:20,background:"rgba(255,255,255,0.2)",flexShrink:0,marginLeft:10,marginRight:10},"aria-hidden":!0}),C.jsx(Tr,{title:`Відмінити останню дію (${en(ie.undo,{isMac:b})})`,tooltip:`Відмінити останню дію (${en(ie.undo,{isMac:b})})`,onClick:Yl,disabled:!E||!ga,hotkeyParts:Ii(ie.undo,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:C.jsx("i",{className:`${$n} bi-arrow-counterclockwise`,style:{fontSize:tr},"aria-hidden":!0})})}),C.jsx(Tr,{title:`Повернути скасовану дію (${en(ie.redo,{isMac:b})})`,tooltip:`Повернути скасовану дію (${en(ie.redo,{isMac:b})})`,onClick:xl,disabled:!E||!qc,hotkeyParts:Ii(ie.redo,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:C.jsx("i",{className:`${$n} bi-arrow-clockwise`,style:{fontSize:tr},"aria-hidden":!0})})})]})})]})}),C.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",flexShrink:0,position:"relative",zIndex:1},children:[C.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:10},children:[C.jsx(Tr,{tooltipLabel:"Медіа",tooltip:"Панель заготовок: фото й текст, які перетягують на виноски",active:gl,onClick:()=>na(w=>!w),children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsxs("svg",{width:tr,height:tr,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:[C.jsxs("g",{stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",children:[C.jsx("rect",{x:"0.5",y:"5.5",width:"10",height:"10",rx:"1.5"}),C.jsx("path",{d:"M3 3.5h8.5a1 1 0 0 1 1 1V13"}),C.jsx("path",{d:"M5 1.5h8.5a1 1 0 0 1 1 1V11"}),C.jsx("path",{d:"M0.5 13.5l3-3 2 2 2.5-3 2.5 3"})]}),C.jsx("circle",{cx:"3.5",cy:"8.5",r:"1",fill:"currentColor"})]}),!Nn&&"Медіа"]})}),C.jsx(Tr,{title:E?`Швидке збереження у форматі JPEG (${en(ie.downloadJpg,{isMac:b})})`:"Спочатку завантажте фонове зображення",onClick:()=>xr("jpeg"),disabled:!bn,hotkeyParts:Ii(ie.downloadJpg,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} bi-download`,style:{fontSize:tr},"aria-hidden":!0}),!Pi&&"JPG"]})}),C.jsx(Tr,{title:$l?"Скопіювати зображення в буфер обміну":"Ваш браузер не підтримує копіювання зображення в буфер",onClick:ru,disabled:!bn||yl||!$l,success:ha,children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[C.jsx("i",{className:`${$n} ${yl?"bi-arrow-repeat tyts-spin":ha?"bi-check-lg":"bi-clipboard-plus"}`,style:{fontSize:tr-2},"aria-hidden":!0}),!Nn&&"Копіювати"]})}),C.jsx(Tr,{title:`Більше опцій збереження (${en(ie.openExportMenu,{isMac:b})})`,onClick:()=>{Ze(w=>!w)},disabled:!bn,hotkeyParts:Ii(ie.openExportMenu,{isMac:b}),showHotkeyBadge:Or&&!Nn,children:C.jsx("i",{className:`${$n} bi-caret-down-fill`,style:{fontSize:tr-4},"aria-hidden":!0})})]}),Ln&&C.jsxs("div",{style:{position:"absolute",right:0,top:"100%",marginTop:6,background:"rgba(10,10,16,0.97)",borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",boxShadow:"0 8px 24px rgba(0,0,0,0.6)",padding:"6px 0",width:"max-content",display:"flex",flexDirection:"column",zIndex:3e3},onClick:w=>w.stopPropagation(),children:[Tt&&C.jsx("button",{type:"button",disabled:!bn,onClick:()=>{if(!Tt)return;Ze(!1);const{w}=G;if(!w)return;const S=Tt.w/w/2;xr("png",S)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:bn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Fn,fontSize:13,cursor:bn?"pointer":"not-allowed"},children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[C.jsx(Bl,{children:"1"}),C.jsxs("span",{children:["PNG оригінал"," ",C.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:[Tt.w,"×",Tt.h," px"]})]})]})}),C.jsx("button",{type:"button",disabled:!bn,onClick:()=>{Ze(!1),xr("png",1)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:bn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Fn,fontSize:13,cursor:bn?"pointer":"not-allowed"},children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[C.jsx(Bl,{children:Tt?"2":"1"}),C.jsxs("span",{children:["PNG"," ",C.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:["– ",G.w,"×",G.h," px"]})]})]})}),C.jsx("button",{type:"button",disabled:!bn,onClick:()=>{Ze(!1),xr("png",2)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:bn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Fn,fontSize:13,cursor:bn?"pointer":"not-allowed"},children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[C.jsx(Bl,{children:Tt?"3":"2"}),C.jsxs("span",{children:["PNG ×2"," ",C.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:["– ",G.w*2,"×",G.h*2," px"]})]})]})}),C.jsx("button",{type:"button",disabled:!bn,onClick:()=>{Ze(!1),xr("jpeg",2)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:bn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Fn,fontSize:13,cursor:bn?"pointer":"not-allowed"},children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[C.jsx(Bl,{children:Tt?"4":"3"}),C.jsxs("span",{children:["JPG ×2"," ",C.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:["– ",G.w*2,"×",G.h*2," px"]})]})]})}),C.jsx("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),C.jsx("button",{type:"button",disabled:!bn,onClick:()=>{Ze(!1),Ec()},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:bn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Fn,fontSize:13,cursor:bn?"pointer":"not-allowed"},children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[C.jsx(Bl,{children:Tt?"5":"4"}),C.jsx("span",{children:"PDF"})]})}),C.jsx("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),C.jsx("button",{type:"button",disabled:!bn,onClick:()=>{Ze(!1),Z.length>0&&window.print()},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:bn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Fn,fontSize:13,cursor:bn?"pointer":"not-allowed"},children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[C.jsx(Bl,{children:Tt?"6":"5"}),C.jsx("span",{children:"Друк… (діалог друку)"})]})})]})]})]}),C.jsxs("div",{style:{flex:1,minHeight:0,display:"flex"},children:[C.jsx("div",{ref:Nr,style:{flex:1,minHeight:0,minWidth:0,overflow:E?"auto":"hidden",position:"relative",touchAction:"none"},onClick:w=>w.stopPropagation(),onPointerDown:w=>{if(!E||!Nr.current)return;const S=w.target,N=y&&w.pointerType!=="mouse";if(N&&(yr.current.set(w.pointerId,{x:w.clientX,y:w.clientY}),yr.current.size>=2)){const U=Array.from(yr.current.values()),nt=U[0],ft=U[1],it=Math.hypot(ft.x-nt.x,ft.y-nt.y);if(it>0){const mt=Nr.current.getBoundingClientRect(),z=(nt.x+ft.x)/2,Nt=(nt.y+ft.y)/2,jt=z-mt.left,St=Nt-mt.top,Rt=ar||1,kt=(Nr.current.scrollLeft+jt)/Rt,qt=(Nr.current.scrollTop+St)/Rt;bc.current={active:!0,startDistance:it,startZoom:Rt,anchorImageX:kt,anchorImageY:qt},Uo.current.isPanning=!1,Nr.current.style.cursor="default",w.preventDefault();return}}const D=w.button===1,j=w.button===0&&(S.getAttribute("data-background")==="true"||!!S.closest('[data-background="true"]'));(N||D||j&&!(J==="place"&&Te))&&(w.preventDefault(),_r.current=!1,Uo.current={isPanning:!0,startX:w.clientX,startY:w.clientY,startScrollLeft:Nr.current.scrollLeft,startScrollTop:Nr.current.scrollTop},Nr.current.style.cursor="grabbing")},onPointerMove:w=>{const S=Nr.current;if(!S)return;y&&w.pointerType!=="mouse"&&yr.current.has(w.pointerId)&&yr.current.set(w.pointerId,{x:w.clientX,y:w.clientY});const D=bc.current;if(D?.active&&yr.current.size>=2){const U=Array.from(yr.current.values()),nt=U[0],ft=U[1],it=Math.hypot(ft.x-nt.x,ft.y-nt.y);if(it>0&&D.startDistance>0){const mt=S.getBoundingClientRect(),z=(nt.x+ft.x)/2-mt.left,Nt=(nt.y+ft.y)/2-mt.top,jt=it/D.startDistance,St=Math.min(qm,Math.max(Hm,+(D.startZoom*jt).toFixed($m))),Rt=Zn.current.w*St,kt=Zn.current.h*St;S.scrollLeft=Math.max(0,Math.min(Rt-S.clientWidth,D.anchorImageX*St-z)),S.scrollTop=Math.max(0,Math.min(kt-S.clientHeight,D.anchorImageY*St-Nt)),_r.current=!1,va(St)}w.preventDefault();return}const j=Uo.current;if(!j.isPanning)return;w.preventDefault();const X=w.clientX-j.startX,tt=w.clientY-j.startY;S.scrollLeft=j.startScrollLeft-X,S.scrollTop=j.startScrollTop-tt},onPointerUp:w=>{const S=Nr.current;S&&(yr.current.has(w.pointerId)&&yr.current.delete(w.pointerId),yr.current.size<2&&(bc.current=null),Uo.current.isPanning=!1,S.style.cursor="default")},onPointerCancel:w=>{const S=Nr.current;S&&(yr.current.has(w.pointerId)&&yr.current.delete(w.pointerId),yr.current.size<2&&(bc.current=null),Uo.current.isPanning=!1,S.style.cursor="default")},onMouseDown:w=>{if(!E||!Nr.current)return;const S=w.target,N=w.button===1,D=w.button===0&&(S.getAttribute("data-background")==="true"||!!S.closest('[data-background="true"]'));!N&&(!D||J==="place"&&Te)||(w.preventDefault(),_r.current=!1,Uo.current={isPanning:!0,startX:w.clientX,startY:w.clientY,startScrollLeft:Nr.current.scrollLeft,startScrollTop:Nr.current.scrollTop},Nr.current.style.cursor="grabbing")},onMouseMove:w=>{const S=Uo.current,N=Nr.current;if(!S.isPanning||!N)return;w.preventDefault();const D=w.clientX-S.startX,j=w.clientY-S.startY;N.scrollLeft=S.startScrollLeft-D,N.scrollTop=S.startScrollTop-j},onMouseUp:()=>{const w=Nr.current;w&&(Uo.current.isPanning=!1,w.style.cursor="default")},onMouseLeave:()=>{const w=Nr.current;w&&(Uo.current.isPanning=!1,w.style.cursor="default")},children:E?C.jsx(C.Fragment,{children:C.jsx("div",{style:{minWidth:"100%",minHeight:"100%",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"},children:C.jsx("div",{style:{width:G.w*ar,height:G.h*ar,position:"relative"},children:C.jsx("div",{ref:ra,style:{transform:`scale(${ar})`,transformOrigin:"top left",width:G.w,height:G.h},children:C.jsxs("svg",{ref:gc,width:G.w,height:G.h,viewBox:`0 0 ${G.w} ${G.h}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",cursor:H?"default":J==="place"?"crosshair":"default",touchAction:"none",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"},onContextMenu:w=>{H||ni(null,w)},onPointerDown:w=>Gr(w),onMouseDown:Gr,onPointerMove:w=>Yc(w),onMouseMove:Yc,onClick:Jl,onDoubleClick:()=>{At&&At.length>=2&&Ho(),Lt&&Lt.length>=2&&Qa()},children:[C.jsx("image",{href:E,x:0,y:0,width:G.w,height:G.h,preserveAspectRatio:"xMidYMid meet","data-background":"true",style:{userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"}}),C.jsx("defs",{children:C.jsxs("radialGradient",{id:"vignette",cx:"50%",cy:"50%",r:"70%",children:[C.jsx("stop",{offset:"60%",stopColor:"transparent"}),C.jsx("stop",{offset:"100%",stopColor:"rgba(0,0,0,0.18)"})]})}),C.jsx("rect",{x:0,y:0,width:G.w,height:G.h,fill:"url(#vignette)",pointerEvents:"none","data-background":"true"}),H&&ot&&C.jsxs("g",{children:[C.jsx("rect",{x:0,y:0,width:G.w,height:ot.y,fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),C.jsx("rect",{x:0,y:ot.y+ot.height,width:G.w,height:Math.max(0,G.h-ot.y-ot.height),fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),C.jsx("rect",{x:0,y:ot.y,width:ot.x,height:ot.height,fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),C.jsx("rect",{x:ot.x+ot.width,y:ot.y,width:Math.max(0,G.w-ot.x-ot.width),height:ot.height,fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),C.jsx("rect",{x:ot.x,y:ot.y,width:ot.width,height:ot.height,fill:"rgba(78,205,196,0.12)",stroke:"#4ECDC4",strokeWidth:2*ue,style:{cursor:"move"},onPointerDown:w=>br(w),onMouseDown:br}),[{key:"nw",x:ot.x,y:ot.y,cursor:"nwse-resize"},{key:"ne",x:ot.x+ot.width,y:ot.y,cursor:"nesw-resize"},{key:"se",x:ot.x+ot.width,y:ot.y+ot.height,cursor:"nwse-resize"},{key:"sw",x:ot.x,y:ot.y+ot.height,cursor:"nesw-resize"}].map(w=>C.jsx("rect",{x:w.x-6*ue,y:w.y-6*ue,width:12*ue,height:12*ue,fill:"#4ECDC4",stroke:"#fff",strokeWidth:1.2*ue,style:{cursor:w.cursor},onPointerDown:S=>jr(w.key,S),onMouseDown:S=>jr(w.key,S)},w.key))]}),At&&At.length>0&&C.jsxs("g",{stroke:"#4ECDC4",strokeWidth:2*ue,fill:"none",children:[At.length>=2&&C.jsx("polyline",{points:At.map(w=>`${w.x},${w.y}`).join(" "),strokeDasharray:`${6*ue} ${4*ue}`,pointerEvents:"none"}),At.map((w,S)=>C.jsx("circle",{cx:w.x,cy:w.y,r:8*ue,fill:"#4ECDC4",stroke:"#fff",strokeWidth:1.5*ue,style:{cursor:"move"},onPointerDown:N=>gs(S,N),onMouseDown:N=>gs(S,N)},S))]}),Lt&&Lt.length>0&&C.jsxs("g",{stroke:"#9B59B6",strokeWidth:2*ue,fill:"none",children:[Lt.length>=2&&C.jsx("polyline",{points:Lt.map(w=>`${w.x},${w.y}`).join(" "),strokeDasharray:`${6*ue} ${4*ue}`,pointerEvents:"none"}),Lt.map((w,S)=>C.jsx("circle",{cx:w.x,cy:w.y,r:8*ue,fill:"#9B59B6",stroke:"#fff",strokeWidth:1.5*ue,style:{cursor:"move"},onPointerDown:N=>xc(S,N),onMouseDown:N=>xc(S,N)},S))]}),Ie&&Te&&C.jsx("g",{stroke:"#4ECDC4",strokeWidth:2*ue,fill:"#4ECDC444",strokeDasharray:`${6*ue} ${4*ue}`,pointerEvents:"none",children:Te==="rectangle"||Te==="redact"?C.jsx("rect",{x:Math.min(Ie.x1,Ie.x2),y:Math.min(Ie.y1,Ie.y2),width:Math.abs(Ie.x2-Ie.x1),height:Math.abs(Ie.y2-Ie.y1)}):C.jsx("ellipse",{cx:(Ie.x1+Ie.x2)/2,cy:(Ie.y1+Ie.y2)/2,rx:Math.abs(Ie.x2-Ie.x1)/2,ry:Math.abs(Ie.y2-Ie.y1)/2})}),ze&&C.jsx("g",{stroke:"#4ECDC4",strokeWidth:2*ue,fill:"none",pointerEvents:"none",children:C.jsx("path",{d:`M ${ze.start.x} ${ze.start.y} Q ${ze.control.x} ${ze.control.y} ${ze.end.x} ${ze.end.y}`,strokeDasharray:`${6*ue} ${4*ue}`})}),cn&&Fe&&J==="place"&&_e==="numbering"&&C.jsx("g",{stroke:"#4ECDC4",fill:"none",pointerEvents:"none",children:C.jsx("line",{x1:cn.x,y1:cn.y,x2:Fe.x,y2:Fe.y,strokeWidth:2*ue,strokeDasharray:`${6*ue} ${4*ue}`})}),Jr.map(w=>C.jsxs("g",{onContextMenu:S=>ni(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 N=Bt[S.id];if(!N)return null;const D=Um(S,Z);return D?C.jsx(WB,{anchor:D,card:N,color:S.color,widthScale:li(S),points:S.leaderPoints},S.id+"-line"):null}),Z.filter(S=>S.id===w.id&&S.anchor.type==="point").map(S=>{const{x:N,y:D}=S.anchor;return C.jsx(MD,{x:N,y:D,color:S.color,label:S.label,widthScale:li(S),active:K===S.id,onPointerDown:j=>Du(S.id,j),onMouseDown:j=>Du(S.id,j),onClick:j=>{if(j.stopPropagation(),ge.current){ge.current=!1;return}V(X=>X===S.id?null:S.id),xt(null)}},S.id+"-pin")}),Z.filter(S=>S.id===w.id&&S.anchor.type==="numbering").map(S=>{const{start:N,end:D}=S.anchor,j=K===S.id,X=li(S),tt=String(S.label),U=14*ue,nt=.075*U,ft=.4*U,it=.35*U,z=Math.max(U*.62,tt.length*.62*U)+ft*2,Nt=U+nt+it,jt=D.x-z/2,St=D.y-Nt/2,Rt=14*ue,kt=4*ue,qt=7*ue,Ut=6*ue,oe=qt*2+Rt*ja.length+kt*Math.max(0,ja.length-1),be=Ut*2+Rt,xe=10*ue,$e=D.x-oe/2,vn=Math.max(0,Math.min($e,G.w-oe)),de=St-xe-be,fn=Math.max(0,Math.min(de,G.h-be)),Ce=24*ue,Hn=6*ue,Ir=vn+oe+Hn,zr=vn-Ce-Hn,Ro=Ir+Ce<=G.w?Ir:zr>=0?zr:Math.max(0,Math.min(Ir,G.w-Ce)),qo=Math.max(0,Math.min(fn+be/2-Ce/2,G.h-Ce));return C.jsxs("g",{style:{cursor:"pointer"},children:[C.jsx("line",{x1:N.x,y1:N.y,x2:D.x,y2:D.y,stroke:S.color,strokeWidth:(j?3*ue:Rf)*X,style:{cursor:"grab"},onPointerDown:It=>Lu(S.id,It),onMouseDown:It=>Lu(S.id,It),onClick:It=>{if(It.stopPropagation(),ge.current){ge.current=!1;return}V(Ye=>Ye===S.id?null:S.id),xt(null)}}),C.jsx("rect",{x:jt,y:St,width:z,height:Nt,rx:4*ue,ry:4*ue,fill:"rgba(10,10,16,0.95)",stroke:S.color,strokeWidth:1.5*ue,pointerEvents:"none"}),C.jsx("text",{x:D.x,y:D.y,textAnchor:"middle",dominantBaseline:"middle",fill:"#ffffff",style:{fontSize:`${U}px`,fontWeight:700,userSelect:"none",pointerEvents:"none"},children:tt}),j&&C.jsxs(C.Fragment,{children:[C.jsx("circle",{cx:N.x,cy:N.y,r:6*ue,fill:S.color,stroke:"#fff",strokeWidth:1.5*ue,style:{cursor:"grab"},onPointerDown:It=>Ma(S.id,"start",It),onMouseDown:It=>Ma(S.id,"start",It)}),C.jsx("circle",{cx:D.x,cy:D.y,r:6*ue,fill:S.color,stroke:"#fff",strokeWidth:1.5*ue,style:{cursor:"grab"},onPointerDown:It=>Ma(S.id,"end",It),onMouseDown:It=>Ma(S.id,"end",It)})]}),j&&C.jsx("foreignObject",{x:vn,y:fn,width:oe,height:be,children:C.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:It=>It.stopPropagation(),onMouseDown:It=>It.stopPropagation(),onClick:It=>It.stopPropagation(),style:{width:oe,height:be,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",padding:`${Ut}px ${qt}px`,borderRadius:8*ue,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)"},children:C.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:`${kt}px`},children:ja.map(It=>C.jsx("button",{type:"button",title:`Колір ${It}`,onClick:()=>Ys(S.id,It),style:{width:Rt,height:Rt,borderRadius:"50%",border:S.color===It?"2px solid #fff":"1px solid rgba(255,255,255,0.3)",background:It,padding:0,cursor:"pointer",boxSizing:"border-box"}},`${S.id}-num-color-${It}`))})})}),j&&C.jsx("foreignObject",{x:Ro,y:qo,width:Ce,height:Ce,children:C.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:It=>It.stopPropagation(),onMouseDown:It=>It.stopPropagation(),onClick:It=>It.stopPropagation(),children:C.jsx("button",{type:"button",title:"Видалити",onClick:()=>ec(S.id),style:{width:Ce,height:Ce,borderRadius:"50%",border:"1px solid rgba(230,57,70,0.7)",background:"rgba(20, 20, 32, 0.95)",color:"#ff6b6b",cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0},children:C.jsx("i",{className:`${$n} bi-trash`,style:{fontSize:12*ue},"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 N=S.anchor.points,D=1/Math.max(ar,1e-4),j=1.5*ue*D,X=ut===S.id,tt=li(S),{minX:U,minY:nt,maxX:ft,maxY:it}=lr[S.id],mt=ft-U,z=it-nt,Nt=Id({minX:U,minY:nt,maxX:ft,maxY:it},G.w,G.h,D),jt=[{cx:U,cy:nt,handle:"nw"},{cx:U+mt/2,cy:nt,handle:"n"},{cx:ft,cy:nt,handle:"ne"},{cx:ft,cy:nt+z/2,handle:"e"},{cx:ft,cy:it,handle:"se"},{cx:U+mt/2,cy:it,handle:"s"},{cx:U,cy:it,handle:"sw"},{cx:U,cy:nt+z/2,handle:"w"}],St=v2(jt,N,D),Rt=kt=>kt==="n"||kt==="s"?"ns-resize":kt==="e"||kt==="w"?"ew-resize":kt==="nw"||kt==="se"?"nwse-resize":"nesw-resize";return C.jsxs("g",{style:{cursor:"default"},children:[C.jsx("polygon",{points:N.map(kt=>`${kt.x},${kt.y}`).join(" "),fill:zy(S.color,S.fillStyle),stroke:S.color,strokeWidth:(X?3:2.5)*ue*tt,strokeDasharray:Rc(S)?Zh(tt):void 0,style:X?{cursor:"grab"}:void 0,onPointerDown:kt=>{X&&(kt.stopPropagation(),Ca(S.id,kt))},onMouseDown:kt=>{X&&(kt.stopPropagation(),Ca(S.id,kt))},onClick:kt=>{if(kt.stopPropagation(),ge.current){ge.current=!1;return}V(qt=>qt===S.id?null:S.id),xt(S.id)}}),X&&N.map((kt,qt)=>C.jsx("circle",{cx:kt.x,cy:kt.y,r:8*ue*D,fill:S.color,stroke:"white",strokeWidth:2*ue*D,style:{cursor:"grab"},onPointerDown:Ut=>vc(S.id,qt,Ut),onMouseDown:Ut=>vc(S.id,qt,Ut),onDoubleClick:Ut=>Vc(S.id,qt,Ut)},`v-${qt}`)),X&&N.map((kt,qt)=>{const Ut=N.length,oe=N[qt],be=N[(qt+1)%Ut],xe=(oe.x+be.x)/2,$e=(oe.y+be.y)/2;return C.jsx("circle",{cx:xe,cy:$e,r:6*ue*D,fill:"white",stroke:S.color,strokeWidth:j,style:{cursor:"pointer"},onPointerDown:vn=>Wc(S.id,qt,vn),onMouseDown:vn=>Wc(S.id,qt,vn)},`m-${qt}`)}),X&&C.jsxs(C.Fragment,{children:[C.jsx("rect",{x:U,y:nt,width:mt,height:z,fill:"none",stroke:S.color,strokeWidth:j,strokeDasharray:`${6*ue*D} ${4*ue*D}`,opacity:.8,style:{pointerEvents:"none"}}),St.map(({cx:kt,cy:qt,handle:Ut})=>C.jsx("rect",{x:kt-jl*D,y:qt-jl*D,width:jl*2*D,height:jl*2*D,fill:"white",stroke:S.color,strokeWidth:j,style:{cursor:Rt(Ut)},onPointerDown:oe=>xo(S.id,Ut,oe),onMouseDown:oe=>xo(S.id,Ut,oe)},`bbox-${Ut}`))]}),X&&C.jsx("g",{transform:`translate(${Nt.cx}, ${Nt.cy})`,style:{cursor:"move"},onPointerDown:kt=>kc(S.id,kt),onMouseDown:kt=>kc(S.id,kt),children:C.jsx(zd,{color:S.color,scale:D})})]},S.id+"-poly")}),Z.filter(S=>S.id===w.id&&S.anchor.type==="polyline"&&S.anchor.points.length>=2).map(S=>{const N=S.anchor.points,D=1/Math.max(ar,1e-4),j=1.5*ue*D,X=ut===S.id,tt=li(S),{minX:U,minY:nt,maxX:ft,maxY:it}=lr[S.id],mt=ft-U,z=it-nt,Nt=Id({minX:U,minY:nt,maxX:ft,maxY:it},G.w,G.h,D),jt=[{cx:U,cy:nt,handle:"nw"},{cx:U+mt/2,cy:nt,handle:"n"},{cx:ft,cy:nt,handle:"ne"},{cx:ft,cy:nt+z/2,handle:"e"},{cx:ft,cy:it,handle:"se"},{cx:U+mt/2,cy:it,handle:"s"},{cx:U,cy:it,handle:"sw"},{cx:U,cy:nt+z/2,handle:"w"}],St=v2(jt,N,D),Rt=kt=>kt==="n"||kt==="s"?"ns-resize":kt==="e"||kt==="w"?"ew-resize":kt==="nw"||kt==="se"?"nwse-resize":"nesw-resize";return C.jsxs("g",{style:{cursor:"default"},children:[C.jsx("polyline",{points:N.map(kt=>`${kt.x},${kt.y}`).join(" "),fill:"none",stroke:S.color,strokeWidth:(X?3:2.5)*ue*tt,strokeDasharray:Rc(S)?Zh(tt):void 0,style:X?{cursor:"grab"}:void 0,onPointerDown:kt=>{X&&(kt.stopPropagation(),bs(S.id,kt))},onMouseDown:kt=>{X&&(kt.stopPropagation(),bs(S.id,kt))},onClick:kt=>{if(kt.stopPropagation(),ge.current){ge.current=!1;return}V(qt=>qt===S.id?null:S.id),xt(S.id)}}),X&&N.map((kt,qt)=>C.jsx("circle",{cx:kt.x,cy:kt.y,r:8*ue*D,fill:S.color,stroke:"white",strokeWidth:2*ue*D,style:{cursor:"grab"},onPointerDown:Ut=>Kc(S.id,qt,Ut),onMouseDown:Ut=>Kc(S.id,qt,Ut),onDoubleClick:Ut=>Ac(S.id,qt,Ut)},`v-${qt}`)),X&&N.slice(0,-1).map((kt,qt)=>{const Ut=N[qt],oe=N[qt+1],be=(Ut.x+oe.x)/2,xe=(Ut.y+oe.y)/2;return C.jsx("circle",{cx:be,cy:xe,r:6*ue*D,fill:"white",stroke:S.color,strokeWidth:j,style:{cursor:"pointer"},onPointerDown:$e=>Jc(S.id,qt,$e),onMouseDown:$e=>Jc(S.id,qt,$e)},`m-${qt}`)}),X&&C.jsxs(C.Fragment,{children:[C.jsx("rect",{x:U,y:nt,width:mt,height:z,fill:"none",stroke:S.color,strokeWidth:j,strokeDasharray:`${6*ue*D} ${4*ue*D}`,opacity:.8,style:{pointerEvents:"none"}}),St.map(({cx:kt,cy:qt,handle:Ut})=>C.jsx("rect",{x:kt-jl*D,y:qt-jl*D,width:jl*2*D,height:jl*2*D,fill:"white",stroke:S.color,strokeWidth:j,style:{cursor:Rt(Ut)},onPointerDown:oe=>xs(S.id,Ut,oe),onMouseDown:oe=>xs(S.id,Ut,oe)},`bbox-${Ut}`))]}),X&&C.jsx("g",{transform:`translate(${Nt.cx}, ${Nt.cy})`,style:{cursor:"move"},onPointerDown:kt=>vs(S.id,kt),onMouseDown:kt=>vs(S.id,kt),children:C.jsx(zd,{color:S.color,scale:D})})]},S.id+"-polyline")}),Z.filter(S=>S.id===w.id&&S.anchor.type==="arrow").map(S=>{const{start:N,end:D,control:j}=S.anchor,X=1/Math.max(ar,1e-4),tt=ut===S.id,U=li(S),nt=[N,D,j],ft=Math.min(...nt.map(Ce=>Ce.x)),it=Math.min(...nt.map(Ce=>Ce.y)),mt=Math.max(...nt.map(Ce=>Ce.x)),z=Math.max(...nt.map(Ce=>Ce.y)),Nt=mt-ft,jt=z-it,St=Id({minX:ft,minY:it,maxX:mt,maxY:z},G.w,G.h,X),Rt=[{cx:ft,cy:it,handle:"nw"},{cx:ft+Nt/2,cy:it,handle:"n"},{cx:mt,cy:it,handle:"ne"},{cx:mt,cy:it+jt/2,handle:"e"},{cx:mt,cy:z,handle:"se"},{cx:ft+Nt/2,cy:z,handle:"s"},{cx:ft,cy:z,handle:"sw"},{cx:ft,cy:it+jt/2,handle:"w"}],kt=v2(Rt,nt,X),qt=Ce=>Ce==="n"||Ce==="s"?"ns-resize":Ce==="e"||Ce==="w"?"ew-resize":Ce==="nw"||Ce==="se"?"nwse-resize":"nesw-resize",Ut=Fk(j,D),oe=Math.atan2(Ut.y,Ut.x),be=12*ue*X,xe=Math.PI/7,$e=D.x-Math.cos(oe-xe)*be,vn=D.y-Math.sin(oe-xe)*be,de=D.x-Math.cos(oe+xe)*be,fn=D.y-Math.sin(oe+xe)*be;return C.jsxs("g",{style:{cursor:"default"},children:[C.jsx("path",{d:`M ${N.x} ${N.y} Q ${j.x} ${j.y} ${D.x} ${D.y}`,fill:"none",stroke:S.color,strokeWidth:(tt?3:2.5)*ue*U,strokeDasharray:Rc(S)?Zh(U):void 0,style:tt?{cursor:"grab"}:void 0,onPointerDown:Ce=>{tt&&Ql(S.id,Ce)},onMouseDown:Ce=>{tt&&Ql(S.id,Ce)},onClick:Ce=>{if(Ce.stopPropagation(),ge.current){ge.current=!1;return}V(Hn=>Hn===S.id?null:S.id),xt(S.id)}}),C.jsx("path",{d:`M ${D.x} ${D.y} L ${$e} ${vn} L ${de} ${fn} Z`,fill:S.color,stroke:S.color,strokeWidth:(tt?3:2.5)*ue*U,pointerEvents:"none"}),tt&&C.jsxs(C.Fragment,{children:[C.jsx("rect",{x:ft,y:it,width:Nt,height:jt,fill:"none",stroke:S.color,strokeWidth:1.5*ue*X,strokeDasharray:`${6*ue*X} ${4*ue*X}`,opacity:.8,style:{pointerEvents:"none"}}),kt.map(({cx:Ce,cy:Hn,handle:Ir})=>C.jsx("rect",{x:Ce-jl*X,y:Hn-jl*X,width:jl*2*X,height:jl*2*X,fill:"white",stroke:S.color,strokeWidth:1.5*ue*X,style:{cursor:qt(Ir)},onPointerDown:zr=>Zc(S.id,Ir,zr),onMouseDown:zr=>Zc(S.id,Ir,zr)},`arrow-bbox-${Ir}`)),C.jsx("g",{transform:`translate(${St.cx}, ${St.cy})`,style:{cursor:"move"},onPointerDown:Ce=>Mc(S.id,Ce),onMouseDown:Ce=>Mc(S.id,Ce),children:C.jsx(zd,{color:S.color,scale:X})}),C.jsx("circle",{cx:N.x,cy:N.y,r:7*ue*X,fill:S.color,stroke:"#fff",strokeWidth:1.5*ue*X,style:{cursor:"grab"},onPointerDown:Ce=>$s(S.id,"start",Ce),onMouseDown:Ce=>$s(S.id,"start",Ce)}),C.jsx("circle",{cx:D.x,cy:D.y,r:7*ue*X,fill:S.color,stroke:"#fff",strokeWidth:1.5*ue*X,style:{cursor:"grab"},onPointerDown:Ce=>$s(S.id,"end",Ce),onMouseDown:Ce=>$s(S.id,"end",Ce)}),C.jsx("circle",{cx:j.x,cy:j.y,r:6*ue*X,fill:"#fff",stroke:S.color,strokeWidth:1.5*ue*X,style:{cursor:"grab"},onPointerDown:Ce=>$s(S.id,"control",Ce),onMouseDown:Ce=>$s(S.id,"control",Ce)})]})]},S.id+"-arrow")}),Z.filter(S=>S.id===w.id&&S.anchor.type==="rectangle").map(S=>{const{x:N,y:D,width:j,height:X,rotation:tt=0}=S.anchor,U=1/Math.max(ar,1e-4),nt=ut===S.id,ft=li(S),it=N+j/2,mt=D+X/2,z=tt*Math.PI/180,Nt=Math.cos(z),jt=Math.sin(z),St=(Ut,oe)=>({cx:it+Ut*Nt-oe*jt,cy:mt+Ut*jt+oe*Nt}),Rt=[{...St(-j/2,-X/2),handle:"nw"},{...St(0,-X/2),handle:"n"},{...St(j/2,-X/2),handle:"ne"},{...St(j/2,0),handle:"e"},{...St(j/2,X/2),handle:"se"},{...St(0,X/2),handle:"s"},{...St(-j/2,X/2),handle:"sw"},{...St(-j/2,0),handle:"w"}],kt=Id({minX:Math.min(...Rt.map(Ut=>Ut.cx)),minY:Math.min(...Rt.map(Ut=>Ut.cy)),maxX:Math.max(...Rt.map(Ut=>Ut.cx)),maxY:Math.max(...Rt.map(Ut=>Ut.cy))},G.w,G.h,U),qt=Ut=>Ut==="n"||Ut==="s"?"ns-resize":Ut==="e"||Ut==="w"?"ew-resize":Ut==="nw"||Ut==="se"?"nwse-resize":"nesw-resize";return C.jsxs("g",{style:{cursor:"default"},children:[C.jsx("g",{transform:`rotate(${tt} ${it} ${mt})`,children:C.jsx("rect",{x:N,y:D,width:j,height:X,fill:zy(S.color,S.fillStyle),stroke:S.color,strokeWidth:(nt?3:2.5)*ue*ft,strokeDasharray:Rc(S)?Zh(ft):void 0,style:nt?{cursor:"grab"}:void 0,onPointerDown:Ut=>{nt&&(Ut.stopPropagation(),wc(S.id,Ut))},onMouseDown:Ut=>{nt&&(Ut.stopPropagation(),wc(S.id,Ut))},onClick:Ut=>{if(Ut.stopPropagation(),ge.current){ge.current=!1;return}V(oe=>oe===S.id?null:S.id),xt(S.id)}})}),nt&&Rt.map(({cx:Ut,cy:oe,handle:be})=>C.jsx("circle",{cx:Ut,cy:oe,r:x2*U,fill:S.color,stroke:"white",strokeWidth:1.5*ue*U,style:{cursor:qt(be)},onPointerDown:xe=>so(S.id,be,xe),onMouseDown:xe=>so(S.id,be,xe)},be)),nt&&C.jsx("g",{transform:`translate(${kt.cx}, ${kt.cy})`,style:{cursor:"move"},onPointerDown:Ut=>Gc(S.id,Ut),onMouseDown:Ut=>Gc(S.id,Ut),children:C.jsx(zd,{color:S.color,scale:U})})]},S.id+"-rect")}),Z.filter(S=>S.id===w.id&&S.anchor.type==="ellipse").map(S=>{const{cx:N,cy:D,rx:j,ry:X,rotation:tt=0}=S.anchor,U=1/Math.max(ar,1e-4),nt=ut===S.id,ft=li(S),it=tt*Math.PI/180,mt=Math.cos(it),z=Math.sin(it),Nt=(kt,qt)=>({cx:N+kt*mt-qt*z,cy:D+kt*z+qt*mt}),jt=[{...Nt(-j,-X),handle:"nw"},{...Nt(0,-X),handle:"n"},{...Nt(j,-X),handle:"ne"},{...Nt(j,0),handle:"e"},{...Nt(j,X),handle:"se"},{...Nt(0,X),handle:"s"},{...Nt(-j,X),handle:"sw"},{...Nt(-j,0),handle:"w"}],St=Id({minX:Math.min(...jt.map(kt=>kt.cx)),minY:Math.min(...jt.map(kt=>kt.cy)),maxX:Math.max(...jt.map(kt=>kt.cx)),maxY:Math.max(...jt.map(kt=>kt.cy))},G.w,G.h,U),Rt=kt=>kt==="n"||kt==="s"?"ns-resize":kt==="e"||kt==="w"?"ew-resize":kt==="nw"||kt==="se"?"nwse-resize":"nesw-resize";return C.jsxs("g",{style:{cursor:"default"},children:[C.jsx("g",{transform:`rotate(${tt} ${N} ${D})`,children:C.jsx("ellipse",{cx:N,cy:D,rx:j,ry:X,fill:zy(S.color,S.fillStyle),stroke:S.color,strokeWidth:(nt?3:2.5)*ue*ft,strokeDasharray:Rc(S)?Zh(ft):void 0,style:nt?{cursor:"grab"}:void 0,onPointerDown:kt=>{nt&&(kt.stopPropagation(),bo(S.id,kt))},onMouseDown:kt=>{nt&&(kt.stopPropagation(),bo(S.id,kt))},onClick:kt=>{if(kt.stopPropagation(),ge.current){ge.current=!1;return}V(qt=>qt===S.id?null:S.id),xt(S.id)}})}),nt&&jt.map(({cx:kt,cy:qt,handle:Ut})=>C.jsx("circle",{cx:kt,cy:qt,r:x2*U,fill:S.color,stroke:"white",strokeWidth:1.5*ue*U,style:{cursor:Rt(Ut)},onPointerDown:oe=>Xc(S.id,Ut,oe),onMouseDown:oe=>Xc(S.id,Ut,oe)},Ut)),nt&&C.jsx("g",{transform:`translate(${St.cx}, ${St.cy})`,style:{cursor:"move"},onPointerDown:kt=>ys(S.id,kt),onMouseDown:kt=>ys(S.id,kt),children:C.jsx(zd,{color:S.color,scale:U})})]},S.id+"-ellipse")}),Z.filter(S=>S.id===w.id&&S.anchor.type==="text").map(S=>{const N=K===S.id||ut===S.id,D=Wi===S.id,j=S.textColor??"#ffffff",X=S.textBackgroundColor,tt=`${S.textUnderline?" underline":""}${S.textStrike?" line-through":""}`.trim(),U=S.textBold?700:400,nt=S.textItalic?"italic":"normal",ft=S.textFontSize??Pa,{x:it,y:mt,width:z,height:Nt}=S.anchor,jt=1/Math.max(ar,1e-4),St=li(S);return C.jsxs("g",{children:[S.anchor.point&&C.jsx("circle",{cx:S.anchor.point.x,cy:S.anchor.point.y,r:tp*St,fill:S.color,stroke:"white",strokeWidth:bg*St,style:{cursor:"grab"},onPointerDown:Rt=>Kr(S.id,Rt),onMouseDown:Rt=>Kr(S.id,Rt)}),C.jsx("foreignObject",{x:it,y:mt,width:z,height:Nt,onPointerDown:Rt=>el(S.id,Rt),children:C.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",ref:D?Rt=>{ma.current=Rt}:void 0,"data-text-pin-id":S.id,contentEditable:D,suppressContentEditableWarning:!0,onContextMenu:Rt=>Rt.preventDefault(),onPointerDown:Rt=>{if(!D){el(S.id,Rt);return}Rt.stopPropagation()},onDoubleClick:Rt=>{Rt.preventDefault(),Rt.stopPropagation(),V(S.id),xt(S.id),Xi(S.id)},onBlur:()=>{D&&(ts(S.id),Xi(Rt=>Rt===S.id?null:Rt))},onInput:Rt=>{if(!D)return;const kt=Rt.currentTarget,qt=kt.innerHTML,Ut=bi(qt,{fontSize:S.textFontSize??Pa,bold:S.textBold??!1,italic:S.textItalic??!1}),oe=kt.closest("foreignObject");oe&&(oe.setAttribute("width",String(Ut.width)),oe.setAttribute("height",String(Ut.height)))},style:{width:"100%",height:"auto",overflow:"hidden",whiteSpace:"pre",wordBreak:"normal",overflowWrap:"normal",color:j,background:X??"transparent",border:N?`1px dashed ${S.color}`:"1px dashed transparent",borderRadius:gS,padding:`0 ${F2}px`,boxSizing:"border-box",fontFamily:Fn,fontSize:ft,lineHeight:1.4,fontWeight:U,fontStyle:nt,textDecoration:tt||"none",outline:"none",cursor:D?"text":"move",userSelect:"text"},...D?{}:{dangerouslySetInnerHTML:{__html:Ji(S.description)}}})}),N&&!D&&(()=>{const Rt=5*jt;return[{cx:it,cy:mt,key:"nw",cursor:"nwse-resize"},{cx:it+z,cy:mt,key:"ne",cursor:"nesw-resize"},{cx:it+z,cy:mt+Nt,key:"se",cursor:"nwse-resize"},{cx:it,cy:mt+Nt,key:"sw",cursor:"nesw-resize"}].map(qt=>C.jsx("circle",{cx:qt.cx,cy:qt.cy,r:Rt,fill:S.color,stroke:"#ffffff",strokeWidth:1.2*jt,style:{cursor:qt.cursor},onPointerDown:Ut=>nr(S.id,qt.key,Ut),onMouseDown:Ut=>nr(S.id,qt.key,Ut)},`${S.id}-text-resize-${qt.key}`))})()]},`${S.id}-text`)}),Z.filter(S=>S.id===w.id&&S.anchor.type==="redact").map(S=>{const{x:N,y:D,width:j,height:X,mode:tt,strength:U}=S.anchor,nt=K===S.id||ut===S.id,ft=1/Math.max(ar,1e-4),it=5*ue*ft,mt=[{id:"nw",cx:N,cy:D,cursor:"nwse-resize"},{id:"ne",cx:N+j,cy:D,cursor:"nesw-resize"},{id:"se",cx:N+j,cy:D+X,cursor:"nwse-resize"},{id:"sw",cx:N,cy:D+X,cursor:"nesw-resize"}];return C.jsxs("g",{children:[C.jsx(LD,{x:N,y:D,width:j,height:X,mode:tt,strength:U,source:Ui??$c,imageSize:G}),C.jsx("rect",{x:N,y:D,width:j,height:X,fill:"rgba(0,0,0,0.001)",style:{cursor:"grab"},onPointerDown:z=>Cf(S.id,z),onMouseDown:z=>Cf(S.id,z),onClick:z=>{if(z.stopPropagation(),ge.current){ge.current=!1;return}V(S.id),xt(S.id)}}),nt&&C.jsxs(C.Fragment,{children:[C.jsx("rect",{x:N,y:D,width:j,height:X,fill:"none",stroke:Su,strokeWidth:1.5*ue*ft,strokeDasharray:`${5*ue*ft} ${3*ue*ft}`,pointerEvents:"none"}),mt.map(z=>C.jsx("circle",{cx:z.cx,cy:z.cy,r:it,fill:Su,stroke:"#fff",strokeWidth:1.2*ue*ft,style:{cursor:z.cursor},onPointerDown:Nt=>Ou(S.id,z.id,Nt),onMouseDown:Nt=>Ou(S.id,z.id,Nt)},`${S.id}-redact-${z.id}`))]})]},`${S.id}-redact`)}),Z.filter(S=>S.id===w.id&&S.anchor.type==="image").map(S=>{const{x:N,y:D,width:j,height:X,src:tt}=S.anchor,U=K===S.id||ut===S.id,nt=1/Math.max(ar,1e-4),ft=5*ue*nt,it=[{id:"nw",cx:N,cy:D,cursor:"nwse-resize"},{id:"ne",cx:N+j,cy:D,cursor:"nesw-resize"},{id:"se",cx:N+j,cy:D+X,cursor:"nwse-resize"},{id:"sw",cx:N,cy:D+X,cursor:"nesw-resize"}];return C.jsxs("g",{children:[C.jsx("image",{href:tt,x:N,y:D,width:j,height:X,preserveAspectRatio:"xMidYMid meet",style:{cursor:"grab"},onPointerDown:mt=>Ef(S.id,mt),onMouseDown:mt=>Ef(S.id,mt),onClick:mt=>{if(mt.stopPropagation(),ge.current){ge.current=!1;return}V(S.id),xt(S.id)}}),U&&C.jsxs(C.Fragment,{children:[C.jsx("rect",{x:N,y:D,width:j,height:X,fill:"none",stroke:Su,strokeWidth:1.5*ue*nt,strokeDasharray:`${5*ue*nt} ${3*ue*nt}`,pointerEvents:"none"}),it.map(mt=>C.jsx("circle",{cx:mt.cx,cy:mt.cy,r:ft,fill:Su,stroke:"#fff",strokeWidth:1.2*ue*nt,style:{cursor:mt.cursor},onPointerDown:z=>lo(S.id,mt.id,z),onMouseDown:z=>lo(S.id,mt.id,z)},`${S.id}-img-${mt.id}`))]})]},`${S.id}-image`)}),Z.filter(S=>S.id===w.id&&S.anchor.type==="compass").map(S=>{const{cx:N,cy:D,radius:j,rotation:X=0}=S.anchor,tt=1/Math.max(ar,1e-4),U=ut===S.id,nt=li(S),ft=X*Math.PI/180,it=Math.cos(ft),mt=Math.sin(ft),z=(Ae,Be)=>({cx:N+Ae*it-Be*mt,cy:D+Ae*mt+Be*it}),Nt=[{...z(0,-j),handle:"n"},{...z(j,0),handle:"e"},{...z(0,j),handle:"s"},{...z(-j,0),handle:"w"}],jt=U5(j),St=Ae=>Ae==="n"||Ae==="s"?"ns-resize":"ew-resize",Rt=14*ue,kt=4*ue,qt=7*ue,Ut=6*ue,oe=qt*2+Rt*ja.length+kt*Math.max(0,ja.length-1),be=Ut*2+Rt,xe=10*ue,$e=N-oe/2,vn=Math.max(0,Math.min($e,G.w-oe)),fn=D<G.h/2?D+j+xe:D-j-xe-be,Ce=Math.max(0,Math.min(fn,G.h-be)),Hn=24*ue,Ir=6*ue,zr=vn+oe+Ir,Ro=vn-Hn-Ir,qo=zr+Hn<=G.w?zr:Ro>=0?Ro:Math.max(0,Math.min(zr,G.w-Hn)),It=Math.max(0,Math.min(Ce+be/2-Hn/2,G.h-Hn)),Ye=Id({minX:N-j,minY:D-j,maxX:N+j,maxY:D+j},G.w,G.h,tt,[{x:vn,y:Ce,w:oe,h:be},{x:qo,y:It,w:Hn,h:Hn}]);return C.jsxs("g",{style:{cursor:"default"},children:[C.jsxs("g",{transform:`rotate(${X} ${N} ${D})`,children:[C.jsx("circle",{cx:N,cy:D,r:j,fill:"transparent",stroke:"none",style:U?{cursor:"grab"}:void 0,onPointerDown:Ae=>{U&&(Ae.stopPropagation(),Sc(S.id,Ae))},onMouseDown:Ae=>{U&&(Ae.stopPropagation(),Sc(S.id,Ae))},onClick:Ae=>{if(Ae.stopPropagation(),ge.current){ge.current=!1;return}V(Be=>Be===S.id?null:S.id),xt(S.id)}}),C.jsx("path",{d:fD(N,D,j),fill:"none",stroke:S.color,strokeWidth:(U?wg*1.35:wg)*nt,strokeLinecap:"round",pointerEvents:"none"}),C.jsx("polygon",{points:jt.arrowPoints.map(Ae=>`${N+Ae.x},${D+Ae.y}`).join(" "),fill:S.color,pointerEvents:"none"}),C.jsx("text",{x:N,y:D+jt.letterY,textAnchor:"middle",dominantBaseline:"middle",fill:S.color,style:{fontSize:`${jt.fontSize}px`,fontWeight:700,userSelect:"none",pointerEvents:"none"},children:"N"})]}),U&&Nt.map(({cx:Ae,cy:Be,handle:Ve})=>C.jsx("circle",{cx:Ae,cy:Be,r:x2*tt,fill:S.color,stroke:"white",strokeWidth:1.5*ue*tt,style:{cursor:St(Ve)},onPointerDown:Cn=>Zl(S.id,Ve,Cn),onMouseDown:Cn=>Zl(S.id,Ve,Cn)},Ve)),U&&C.jsx("g",{transform:`translate(${Ye.cx}, ${Ye.cy})`,style:{cursor:"move"},onPointerDown:Ae=>tl(S.id,Ae),onMouseDown:Ae=>tl(S.id,Ae),children:C.jsx(zd,{color:S.color,scale:tt})}),U&&C.jsx("foreignObject",{x:vn,y:Ce,width:oe,height:be,children:C.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:Ae=>Ae.stopPropagation(),onMouseDown:Ae=>Ae.stopPropagation(),onClick:Ae=>Ae.stopPropagation(),style:{width:oe,height:be,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",padding:`${Ut}px ${qt}px`,borderRadius:8*ue,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)"},children:C.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:`${kt}px`},children:ja.map(Ae=>C.jsx("button",{type:"button",title:`Колір ${Ae}`,onClick:()=>Ys(S.id,Ae),style:{width:Rt,height:Rt,borderRadius:"50%",border:S.color===Ae?"2px solid #fff":"1px solid rgba(255,255,255,0.3)",background:Ae,padding:0,cursor:"pointer",boxSizing:"border-box"}},`${S.id}-compass-color-${Ae}`))})})}),U&&C.jsx("foreignObject",{x:qo,y:It,width:Hn,height:Hn,children:C.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:Ae=>Ae.stopPropagation(),onMouseDown:Ae=>Ae.stopPropagation(),onClick:Ae=>Ae.stopPropagation(),children:C.jsx("button",{type:"button",title:"Видалити",onClick:()=>ec(S.id),style:{width:Hn,height:Hn,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:C.jsx("i",{className:`${$n} bi-trash`,style:{fontSize:12*ue},"aria-hidden":!0})})})})]},S.id+"-compass")}),[w].map(S=>{if(S.anchor.type==="text"||S.anchor.type==="redact"||S.calloutHidden)return null;const N=Bt[S.id];if(!N)return null;const D=S.anchor.type==="standalone"?null:Um(S,Z),j=D?xg(D,N,S.leaderPoints):void 0;return C.jsx(YB,{pin:S,leaderPath:j,fontFamily:Fn,justCreated:Xr.current===S.id,position:N,imageSize:G,active:ut===S.id,isSelected:ut===S.id||K===S.id,onUpdateDescription:ks,onUpdateImage:Tl,onApplyMedia:tc,onClearImage:X=>{te(),lt(tt=>tt.map(U=>U.id===X?{...U,image:null,imageAspect:null}:U))},onDragStart:pd,onResizeStart:md,onActivate:X=>{V(X),xt(X)},onUpdateColor:Ys,onUpdateStrokeStyle:eu,onUpdateFillStyle:rl,strokeWidthScale:li(S),onUpdateStrokeWidthScale:Zi,onContextMenu:ni,controlsLayer:dr,controlsCollapsed:Ar,onToggleControlsCollapsed:ai,onToggleDescPos:gd,onToggleTheme:X=>{te(),lt(tt=>tt.map(U=>U.id===X?{...U,theme:U.theme==="light"?"dark":"light"}:U))},onHide:X=>Nf(X,!0),onAddLinked:vi(S)?yh:void 0,onDelete:ec,onUpdateTextStyle:(X,tt)=>{te(),lt(U=>U.map(nt=>nt.id===X?{...nt,textBold:tt.bold??nt.textBold??!1,textItalic:tt.italic??nt.textItalic??!1,textUnderline:tt.underline??nt.textUnderline??!1,textStrike:tt.strike??nt.textStrike??!1}:nt))},onUpdateTextFontSize:(X,tt)=>{te(),lt(U=>U.map(nt=>{if(nt.id!==X)return nt;let it=(nt.textFontSize??Pa)+tt;return it=Math.max(mS,it),{...nt,textFontSize:it}}))}},S.id+"-card")})]},w.id+"-z")),Z.filter(w=>w.anchor.type==="text"&&(K===w.id||ut===w.id)).map(w=>{const S=mc.w,N=mc.h,D=4*sn,j=Math.max(0,Math.min(w.anchor.x,G.w-S)),X=w.anchor.y+w.anchor.height/2,tt=G.h/2,nt=X<tt?w.anchor.y+w.anchor.height+D:w.anchor.y-N-D,ft=Math.max(0,Math.min(nt,G.h-N)),it=Vo===w.id,mt=ft,z=N,Nt=32*sn,jt=6*sn,St=j+S+jt,Rt=j-Nt-jt,kt=St+Nt<=G.w?St:Rt>=0?Rt:Math.max(0,Math.min(St,G.w-Nt)),qt=168*sn,Ut=132*sn,oe=Math.max(0,Math.min(j+S-qt,G.w-qt)),be=Math.max(0,ft-Ut-6*sn),xe=de=>{te(),lt(fn=>fn.map(Ce=>Ce.id===w.id?{...Ce,textColor:de}:Ce))},$e=de=>{te(),lt(fn=>fn.map(Ce=>Ce.id===w.id?{...Ce,textBackgroundColor:de}:Ce)),fr(null)},vn=de=>{te(),lt(fn=>fn.map(Ce=>{if(Ce.id!==w.id||Ce.anchor.type!=="text")return Ce;const Hn={...Ce,...de},Ir=Ce.anchor,zr=bi(Hn.description||"",{fontSize:Hn.textFontSize??Pa,bold:Hn.textBold??!1,italic:Hn.textItalic??!1}),Ro=Math.max(0,G.w-zr.width),qo=Math.max(0,G.h-zr.height);return{...Hn,anchor:{...Ir,width:zr.width,height:zr.height,x:Math.max(0,Math.min(Ir.x,Ro)),y:Math.max(0,Math.min(Ir.y,qo))}}}))};return C.jsxs("g",{children:[C.jsx("foreignObject",{x:j,y:mt,width:S,height:z,children:C.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:de=>de.stopPropagation(),onMouseDown:de=>de.stopPropagation(),style:{width:"100%",height:N,boxSizing:"border-box",display:"flex",alignItems:"flex-start"},children:C.jsxs("div",{ref:Fa,style:{width:"max-content",minWidth:300*sn,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)",borderRadius:10*sn,padding:`${8*sn}px ${10*sn}px`,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7*sn},children:[w.anchor.point&&(()=>{const de=li(w),fn=(de-hl)/(Nu-hl)*100;return C.jsxs(C.Fragment,{children:[C.jsxs("div",{style:{display:"flex",gap:b2,alignItems:"center",justifyContent:"center",flexWrap:"nowrap",flexShrink:0},children:[C.jsx("i",{className:`${$n} bi-record-circle`,style:Uk,"aria-hidden":!0}),ja.map(Ce=>C.jsx("button",{type:"button",title:`Колір точки ${Ce}`,onClick:()=>Ys(w.id,Ce),style:{width:fg,height:fg,borderRadius:"50%",background:Ce,border:w.color===Ce?"2px solid #fff":"1px solid rgba(255,255,255,0.25)",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0}},`${w.id}-pointc-${Ce}`))]}),C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:b2},children:[C.jsx("input",{type:"range",className:"tyts-range",min:hl,max:Nu,step:j0,value:de,"aria-label":"Розмір точки",title:"Розмір точки",onChange:Ce=>Zi(w.id,Number(Ce.target.value)),style:{flex:1,minWidth:0,"--tyts-range-accent":w.color,"--tyts-range-fill":`${fn}%`}}),C.jsxs("span",{style:{color:"#aaa",fontSize:11*sn,minWidth:30*sn,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:["×",I0(de)]})]})]})})(),C.jsxs("div",{style:{display:"flex",gap:b2,alignItems:"center",justifyContent:"center",flexWrap:"nowrap",flexShrink:0},children:[C.jsx("i",{className:`${$n} bi-type`,style:Uk,"aria-hidden":!0}),ja.map(de=>C.jsx("button",{type:"button",onClick:()=>xe(de),style:{width:fg,height:fg,borderRadius:"50%",border:w.textColor===de?"2px solid #fff":"1px solid rgba(255,255,255,0.25)",background:de,padding:0,cursor:"pointer",boxSizing:"border-box"}},`${w.id}-tc-${de}`))]}),C.jsxs("div",{style:{display:"flex",gap:4*sn,alignItems:"center",justifyContent:"space-between",position:"relative",flexWrap:"nowrap"},children:[C.jsx("button",{type:"button",style:{...Qh,fontWeight:700},onClick:()=>{Ss(w.id,"bold")||vn({textBold:!(w.textBold??!1)})},children:"B"}),C.jsx("button",{type:"button",style:{...Qh,fontStyle:"italic"},onClick:()=>{Ss(w.id,"italic")||vn({textItalic:!(w.textItalic??!1)})},children:"I"}),C.jsx("button",{type:"button",style:{...Qh,textDecoration:"underline"},onClick:()=>{Ss(w.id,"underline")||vn({textUnderline:!(w.textUnderline??!1)})},children:"U"}),C.jsx("button",{type:"button",style:{...Qh,textDecoration:"line-through"},onClick:()=>{Ss(w.id,"strikeThrough")||vn({textStrike:!(w.textStrike??!1)})},children:"S"}),C.jsxs("div",{style:wA,role:"group","aria-label":"Розмір шрифту",children:[C.jsx("button",{type:"button",style:qg,title:"Менший шрифт","aria-label":"Менший шрифт",onClick:()=>Pu(w.id,-2),children:"−"}),C.jsx("span",{style:SA,"aria-live":"polite",children:w.textFontSize??Pa}),C.jsx("button",{type:"button",style:qg,title:"Більший шрифт","aria-label":"Більший шрифт",onClick:()=>Pu(w.id,2),children:"+"})]}),C.jsx("div",{"data-text-bg-picker":"true",style:{position:"relative"},children:C.jsxs("button",{type:"button",onClick:()=>fr(de=>de===w.id?null:w.id),style:{...Qh,minWidth:42*sn,justifyContent:"space-between",gap:6*sn,padding:`0 ${7*sn}px`,color:"#e8e8e8"},title:"Колір фону тексту",children:[C.jsx("span",{style:{width:18*sn,height:18*sn,borderRadius:3*sn,border:"1px solid rgba(255,255,255,0.35)",background:w.textBackgroundColor??"transparent",boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center",color:w.textBackgroundColor?"#111":"#f0f0f0",fontSize:10*sn,fontWeight:700},children:"A"}),C.jsx("i",{className:`${$n} bi-chevron-down`,style:{fontSize:11*sn},"aria-hidden":!0})]})})]})]})})},`${w.id}-text-tools`),it&&C.jsx("foreignObject",{x:oe,y:be,width:qt,height:Ut,style:{overflow:"visible"},children:C.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml","data-text-bg-picker":"true",onPointerDown:de=>de.stopPropagation(),onMouseDown:de=>de.stopPropagation(),style:{width:"100%",background:"rgba(18, 20, 30, 0.98)",border:"1px solid rgba(255,255,255,0.18)",borderRadius:8*sn,padding:8*sn,boxSizing:"border-box",display:"grid",gridTemplateColumns:`repeat(4, ${30*sn}px)`,gap:6*sn},children:[C.jsx("button",{type:"button",onClick:()=>$e(null),style:{gridColumn:"1 / -1",height:24*sn,borderRadius:5*sn,border:"1px solid rgba(255,255,255,0.22)",background:"rgba(255,255,255,0.06)",color:"#ddd",cursor:"pointer",fontSize:12*sn},children:"Без фону"}),ja.map(de=>C.jsx("button",{type:"button",onClick:()=>$e(de),style:{width:30*sn,height:24*sn,borderRadius:5*sn,border:w.textBackgroundColor===de?"2px solid #fff":"1px solid rgba(255,255,255,0.3)",background:de,cursor:"pointer",boxSizing:"border-box"},title:de},`${w.id}-bg-${de}`))]})},`${w.id}-text-bg-picker`),C.jsx("foreignObject",{x:kt,y:Math.max(0,Math.min(ft+N/2-Nt/2,G.h-Nt)),width:Nt,height:Nt,children:C.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:de=>de.stopPropagation(),onMouseDown:de=>de.stopPropagation(),children:C.jsx("button",{type:"button",title:"Видалити",onClick:()=>ec(w.id),style:{width:Nt,height:Nt,background:"rgba(20, 20, 32, 0.95)",border:"1px solid rgba(230,57,70,0.7)",color:"#ff6b6b",cursor:"pointer",borderRadius:"50%",fontSize:16*sn,padding:`${3*sn}px`,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:C.jsx("i",{className:`${$n} bi-trash`,style:{fontSize:tr},"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||ut!==w.id&&K!==w.id)return null;const S=Bt[w.id];if(!S)return null;const N=Um(w,Z);if(!N)return null;const D=Array.isArray(w.leaderPoints)?w.leaderPoints:[],j=xg(N,S,D),X=1/Math.max(ar,1e-4),tt=5*ue*X,U=3.5*ue*X;return C.jsxs("g",{children:[Z8(j).map((nt,ft)=>C.jsx("circle",{cx:nt.x,cy:nt.y,r:U,fill:"rgba(255,255,255,0.8)",stroke:w.color,strokeWidth:1.2*ue*X,style:{cursor:"crosshair"},onPointerDown:it=>Ml(w.id,ft,nt,it),onMouseDown:it=>Ml(w.id,ft,nt,it),children:C.jsx("title",{children:"Потягніть, щоб зламати лінію"})},`${w.id}-leader-mid-${ft}`)),D.map((nt,ft)=>C.jsx("circle",{cx:nt.x,cy:nt.y,r:tt,fill:w.color,stroke:"#fff",strokeWidth:1.5*ue*X,style:{cursor:"grab"},onPointerDown:it=>Qo(w.id,ft,it),onMouseDown:it=>Qo(w.id,ft,it),onDoubleClick:it=>Ru(w.id,ft,it),children:C.jsx("title",{children:"Подвійний клік — прибрати злам"})},`${w.id}-leader-pt-${ft}`))]},w.id+"-leader-handles")}),Z.filter(w=>w.anchor.type==="redact"&&(K===w.id||ut===w.id)).map(w=>{const{x:S,y:N,width:D,height:j,mode:X,strength:tt}=w.anchor,U=250*sn,nt=8*sn,ft=24*sn,it=7*sn,mt=12*sn,z=nt*2+ft+(X==="fill"?0:it+mt),Nt=8*sn,jt=Math.max(0,Math.min(S+D/2-U/2,G.w-U)),St=N<G.h/2,Rt=Math.max(0,Math.min(St?N+j+Nt:N-Nt-z,G.h-z)),kt=32*sn,qt=6*sn,Ut=jt+U+qt,oe=jt-kt-qt,be=Ut+kt<=G.w?Ut:oe>=0?oe:Math.max(0,Math.min(Ut,G.w-kt)),xe=Math.max(0,Math.min(Rt+z/2-kt/2,G.h-kt)),$e=[{id:"blur",label:"Розмити",icon:"bi-droplet-half"},{id:"pixelate",label:"Пікселі",icon:"bi-grid-3x3"},{id:"fill",label:"Заливка",icon:"bi-square-fill"}],vn=tt*100;return C.jsxs("g",{children:[C.jsx("foreignObject",{x:jt,y:Rt,width:U,height:z,children:C.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:de=>de.stopPropagation(),onMouseDown:de=>de.stopPropagation(),onClick:de=>de.stopPropagation(),style:{width:U,height:z,boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"center",gap:it,padding:`${nt}px ${10*sn}px`,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)",borderRadius:10*sn,fontFamily:Fn},children:[C.jsx("div",{style:{display:"flex",gap:6*sn},children:$e.map(de=>C.jsxs("button",{type:"button",title:de.label,onClick:()=>Qc(w.id,{mode:de.id}),style:{flex:1,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4*sn,height:24*sn,borderRadius:6*sn,cursor:"pointer",fontFamily:"inherit",fontSize:11*sn,background:X===de.id?"rgba(255,255,255,0.14)":"rgba(255,255,255,0.06)",border:`1px solid ${X===de.id?Su:"rgba(255,255,255,0.18)"}`,color:X===de.id?"#fff":"#bbb"},children:[C.jsx("i",{className:`${$n} ${de.icon}`,style:{fontSize:11*sn},"aria-hidden":!0}),de.label]},de.id))}),X!=="fill"&&C.jsx("input",{type:"range",className:"tyts-range",min:0,max:1,step:n8,value:tt,"aria-label":"Сила ефекту",title:"Сила ефекту",onChange:de=>Qc(w.id,{strength:Number(de.target.value)}),style:{width:"100%",height:mt,minWidth:0,"--tyts-range-accent":Su,"--tyts-range-thumb":`${mt}px`,"--tyts-range-track":`${4*sn}px`,"--tyts-range-fill":`${vn}%`}})]})}),C.jsx("foreignObject",{x:be,y:xe,width:kt,height:kt,children:C.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:de=>de.stopPropagation(),onMouseDown:de=>de.stopPropagation(),onClick:de=>de.stopPropagation(),children:C.jsx("button",{type:"button",title:"Видалити ділянку","aria-label":"Видалити ділянку",onClick:()=>ec(w.id),style:{width:kt,height:kt,borderRadius:"50%",border:"1px solid rgba(230,57,70,0.7)",background:"rgba(20, 20, 32, 0.95)",color:"#ff6b6b",cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:`${3*sn}px`},children:C.jsx("i",{className:`${$n} bi-trash`,style:{fontSize:Math.round(12*sn)},"aria-hidden":!0})})})})]},`${w.id}-redact-panel`)}),C.jsx("g",{ref:xi}),Z.filter(w=>w.anchor.type==="arrow"&&!!w.calloutHidden&&(K===w.id||ut===w.id)).map(w=>{const S=[w.anchor.start,w.anchor.end,w.anchor.control];return C.jsx(VB,{pin:w,bbox:{minX:Math.min(...S.map(N=>N.x)),minY:Math.min(...S.map(N=>N.y)),maxX:Math.max(...S.map(N=>N.x)),maxY:Math.max(...S.map(N=>N.y))},imageSize:G,strokeWidthScale:li(w),fontFamily:Fn,controlsLayer:dr,controlsCollapsed:Ar,onToggleControlsCollapsed:ai,onUpdateColor:Ys,onUpdateStrokeStyle:eu,onUpdateFillStyle:rl,onUpdateStrokeWidthScale:Zi,onShowCallout:N=>Nf(N,!1),onDelete:ec},`${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"||K===w.id||ut===w.id).map(w=>{const S=to(w);return C.jsxs("g",{transform:`translate(${S.x}, ${S.y})`,style:{cursor:"pointer"},onMouseDown:N=>N.stopPropagation(),onClick:N=>{N.stopPropagation(),Nf(w.id,!1)},children:[C.jsx("circle",{cx:0,cy:0,r:11*ue,fill:"rgba(20,20,32,0.95)",stroke:w.color,strokeWidth:2*ue}),C.jsx("text",{x:0,y:1*ue,textAnchor:"middle",dominantBaseline:"middle",fill:w.color,style:{fontSize:`${14*ue}px`,fontWeight:700,userSelect:"none"},children:"+"})]},`${w.id}-restore-callout`)})]})})})})}):C.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16},children:[C.jsx(bF,{onFile:ms,highlight:wa,warning:R}),Jt.showRestorePrompt&&Jt.storedDraftSavedAt&&C.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:[C.jsxs("span",{children:["Знайдено збережену чернетку від"," ",Ud(new Date(Jt.storedDraftSavedAt))]}),C.jsx("button",{type:"button",onClick:()=>Jt.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:"Відновити"}),C.jsx("button",{type:"button",onClick:()=>Jt.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:"Відкинути"})]})]})}),gl&&C.jsx(M9,{items:Wr.items,onAddImageFiles:w=>{Wr.addImageFiles(w)},onAddText:Wr.addText,onUpdateText:Wr.updateText,onRemove:Wr.remove,onClose:()=>na(!1)})]}),C.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:[C.jsxs("div",{style:{...eF,flex:1},children:[C.jsxs("span",{title:`полотно: ${G.w} × ${G.h}px`,children:["полотно: ",G.w," × ",G.h,"px"]}),Tt&&C.jsxs("span",{title:`оригінал: ${Tt.w} × ${Tt.h}px`,style:{marginLeft:16},children:["оригінал: ",Tt.w," × ",Tt.h,"px"]}),K&&(()=>{const w=Bt[K];if(!w)return null;const S=`картка: ${Math.round(w.width)} × ${Math.round(w.height)}px`;return C.jsx("span",{title:S,style:{marginLeft:16},children:S})})(),tn&&C.jsxs("span",{title:tn,style:{color:He,display:"inline-flex",alignItems:"center",gap:5,marginLeft:16,verticalAlign:"bottom"},children:[C.jsx("i",{className:`${$n} ${Jt.status==="error"?"bi-exclamation-triangle":Jt.status==="saving"?"bi-cloud-arrow-up tyts-spin":"bi-cloud-check"}`,style:{fontSize:11,flexShrink:0},"aria-hidden":!0}),C.jsx("span",{children:tn})]})]}),C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:10,flexShrink:0},children:[!p,C.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),Bo(!0),fa(!1)},style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.55)",fontFamily:"inherit",fontSize:10,cursor:"pointer",padding:0},title:"Налаштування",children:"Налаштування"}),C.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),fa(S=>!S),Bo(!1)},style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.55)",fontFamily:"inherit",fontSize:10,cursor:"pointer",padding:0},title:"Показати список гарячих клавіш",children:"Гарячі клавіші"}),!p,C.jsxs("span",{children:["v",H_]})]}),ea&&C.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:[C.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:[C.jsx("div",{style:{fontWeight:800,color:"#fff"},children:"Гарячі клавіші"}),C.jsx("button",{type:"button",onClick:()=>fa(!1),style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.65)",cursor:"pointer",fontSize:16,lineHeight:1},title:"Закрити",children:"×"})]}),C.jsxs("div",{style:{display:"flex",gap:16,fontSize:12},children:[C.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:4},children:[ie.newImage,ie.replaceBackground,ie.toolPoint,ie.toolRegion,ie.toolRoute,ie.toolRectangle,ie.toolEllipse,ie.toolArrow,ie.toolText,ie.toolPointText,ie.toolImageObject,ie.toolRedact,ie.toolDateTime,ie.toolStandaloneCallout,ie.toolNumbering,ie.toolCompass,ie.toolCrop,ie.zoomIn,ie.zoomOut,ie.fitToWindow,ie.undo,ie.redo,ie.downloadJpg,ie.openExportMenu,ie.exportMenuChooseByNumber].map(w=>C.jsx(Yk,{shortcut:w,isMac:b},w.id))}),C.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:4},children:[ie.calloutBold,ie.calloutItalic,ie.calloutUnderline,ie.calloutStrike,ie.calloutFontSizeDown,ie.calloutFontSizeUp,ie.calloutAddText,ie.calloutAddImage,ie.calloutRemoveText,ie.calloutRemoveImage,ie.calloutToggleDescPos,ie.calloutToggleTheme,ie.calloutDelete,ie.calloutTogglePanel,ie.calloutBringForward,ie.calloutSendBackward,ie.calloutBringToFront,ie.calloutSendToBack,ie.objectCopy,ie.objectDuplicate,ie.objectPaste].map(w=>C.jsx(Yk,{shortcut:w,isMac:b},w.id))})]}),C.jsx("div",{style:{marginTop:10,paddingTop:10,borderTop:"1px solid rgba(255,255,255,0.08)"},children:C.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer",fontSize:12,color:"rgba(255,255,255,0.8)"},children:[C.jsx("input",{type:"checkbox",checked:Or,onChange:w=>ta(w.target.checked)}),"Показувати бейджі хоткеїв на кнопках"]})})]})]}),Sn&&(()=>{const w=Sn.pinId,S=[{move:"front",label:"На передній план",shortcut:"calloutBringToFront"},{move:"up",label:"На рівень вище",shortcut:"calloutBringForward"},{move:"down",label:"На рівень нижче",shortcut:"calloutSendBackward"},{move:"back",label:"На задній план",shortcut:"calloutSendToBack"}],N=[...w?[{key:"copy",label:"Копіювати",shortcut:"objectCopy",enabled:!0,run:()=>kn(w)},{key:"duplicate",label:"Дублювати",shortcut:"objectDuplicate",enabled:!0,run:()=>Dr(w)}]:[],{key:"paste",label:"Вставити сюди",shortcut:"objectPaste",enabled:qe,run:()=>Ri(Sn.at)}],D=N.length+(w?S.length:0),j=230,X=8+D*30+(w?9:0),tt=Math.max(8,Math.min(Sn.x,window.innerWidth-j-8)),U=Math.max(8,Math.min(Sn.y,window.innerHeight-X-8));return C.jsxs("div",{role:"menu",onPointerDown:nt=>nt.stopPropagation(),onContextMenu:nt=>nt.preventDefault(),style:{position:"fixed",left:tt,top:U,zIndex:6e3,width:j,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:Fn,fontSize:13},children:[N.map(({key:nt,label:ft,shortcut:it,enabled:mt,run:z})=>C.jsxs("button",{type:"button",role:"menuitem",disabled:!mt,onClick:()=>{z(),Ge(null)},style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,width:"100%",padding:"6px 8px",borderRadius:6,border:"none",background:"transparent",color:mt?"#ddd":"rgba(255,255,255,0.28)",cursor:mt?"pointer":"default",fontFamily:"inherit",fontSize:"inherit",textAlign:"left"},onMouseEnter:Nt=>{mt&&(Nt.currentTarget.style.background="rgba(255,255,255,0.08)")},onMouseLeave:Nt=>{Nt.currentTarget.style.background="transparent"},children:[C.jsx("span",{children:ft}),C.jsx("span",{style:{color:"rgba(255,255,255,0.35)",fontSize:11},children:en(ie[it],{isMac:b})})]},nt)),w&&C.jsx("div",{style:{height:1,margin:"4px 6px",background:"rgba(255,255,255,0.12)"}}),w&&S.map(({move:nt,label:ft,shortcut:it})=>{const mt=iD(Z,w,nt);return C.jsxs("button",{type:"button",role:"menuitem",disabled:!mt,onClick:()=>{nu(w,nt),Ge(null)},style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,width:"100%",padding:"6px 8px",borderRadius:6,border:"none",background:"transparent",color:mt?"#ddd":"rgba(255,255,255,0.28)",cursor:mt?"pointer":"default",fontFamily:"inherit",fontSize:"inherit",textAlign:"left"},onMouseEnter:z=>{mt&&(z.currentTarget.style.background="rgba(255,255,255,0.08)")},onMouseLeave:z=>{z.currentTarget.style.background="transparent"},children:[C.jsx("span",{children:ft}),C.jsx("span",{style:{color:"rgba(255,255,255,0.35)",fontSize:11},children:en(ie[it],{isMac:b})})]},nt)})]})})(),C.jsx("input",{ref:Go,type:"file",accept:X_,style:{display:"none"},onChange:w=>{const S=w.target.files?.[0];w.target.value="",S&&(Lo(S),hs(!1))}}),C.jsx(m8,{open:as,fontId:or.fontId,fontFamily:Fn,strokeWidthScale:Ti,showToolTooltips:or.showToolTooltips,onClose:()=>Bo(!1),onFontIdChange:si,onStrokeWidthScaleChange:mi,onShowToolTooltipsChange:Wt})]})})});function gF({corner:n}){const i=n==="nw"||n==="sw"?12:32,s=n==="nw"||n==="ne"?12:32;return C.jsx("svg",{width:44,height:44,viewBox:"0 0 44 44","aria-hidden":!0,children:C.jsx("circle",{cx:i,cy:s,r:7,fill:"none",stroke:"#F2D727",strokeWidth:1.6})})}function Yk({shortcut:n,isMac:t}){const[e,r]=I.useState(!1);return C.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:[C.jsx("span",{style:{color:"rgba(255,255,255,0.85)"},children:n.label}),C.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:Ii(n,{isMac:t}).map(i=>C.jsx(Bl,{children:i},i))})]})}function Vk({canUndo:n,canRedo:t,onUndo:e,onRedo:r,isMac:i}){return C.jsxs(C.Fragment,{children:[C.jsx(Tr,{title:`Відмінити (${en(ie.undo,{isMac:i})})`,tooltip:`Відмінити останню точку або переміщення (${en(ie.undo,{isMac:i})})`,onClick:e,disabled:!n,children:C.jsx("i",{className:`${$n} bi-arrow-counterclockwise`,style:{fontSize:tr},"aria-hidden":!0})}),C.jsx(Tr,{title:`Повернути (${en(ie.redo,{isMac:i})})`,tooltip:`Повернути скасовану дію (${en(ie.redo,{isMac:i})})`,onClick:r,disabled:!t,children:C.jsx("i",{className:`${$n} bi-arrow-clockwise`,style:{fontSize:tr},"aria-hidden":!0})})]})}function Tr({children:n,onClick:t,active:e,accent:r,primary:i,title:s,tooltip:l,tooltipLabel:c,disabled:f,hotkeyParts:d,showHotkeyBadge:p,success:g}){const[b,y]=I.useState(!1),[A,E]=I.useState(!1),L=I.useRef(null),R=typeof window<"u"&&(navigator.maxTouchPoints>0||window.matchMedia?.("(pointer: coarse)").matches===!0),q=typeof window<"u"&&window.innerWidth<(R?1040:1320),H=l!=null&&l!==""||!!c,$=A&&!f,ht=i?$?"rgb(30, 90, 180)":"rgb(0, 102, 204)":null,Mt=r?$?"rgb(210, 50, 60)":"rgb(230, 57, 70)":null,wt=!!g&&!f;return C.jsxs("span",{ref:L,style:{position:"relative",display:"inline-block"},onMouseEnter:()=>{y(!0),E(!0)},onMouseLeave:()=>{y(!1),E(!1)},children:[C.jsx("button",{onClick:t,disabled:f,title:H?void 0:s,"aria-label":H?c??s??l:void 0,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:R?40:30,boxSizing:"border-box",background:ht??Mt??(e?"linear-gradient(135deg, rgb(230, 57, 70), rgb(198, 43, 56))":$?"rgba(255,255,255,0.12)":"rgba(255,255,255,0.06)"),border:wt?"1px solid #2ecc71":`1px solid ${ht??Mt??(e?"transparent":"rgba(255,255,255,0.08)")}`,borderRadius:5,color:f?"rgba(255,255,255,0.55)":wt?"#2ecc71":i||r||e?"#fff":"#bbb",fontFamily:"inherit",fontSize:"inherit",fontWeight:600,padding:R?q?"7px 10px":"8px 14px":q?"4px 8px":"5px 12px",transition:"all 0.15s",cursor:f?"not-allowed":"pointer",opacity:f?.6:1},children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:q?6:8},children:[n,p&&d&&d.length>0&&C.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:d.map(bt=>C.jsx(Bl,{title:`Гаряча клавіша: ${bt}`,children:bt},bt))})]})}),H&&b&&C.jsx(N5,{anchorRef:L,label:c,hint:l?y6(l,d):void 0,hotkeyParts:d})]})}function yF({children:n,onMainClick:t,onMenuClick:e,menuOpen:r,disabled:i,mainTitle:s,mainTooltip:l,mainTooltipLabel:c,menuTitle:f,menuTooltip:d,hotkeyParts:p,showHotkeyBadge:g}){const[b,y]=I.useState(!1),[A,E]=I.useState(!1),[L,R]=I.useState(!1),[q,H]=I.useState(!1),$=I.useRef(null),ht=I.useRef(null),Mt=typeof window<"u"&&(navigator.maxTouchPoints>0||window.matchMedia?.("(pointer: coarse)").matches===!0),wt=typeof window<"u"&&window.innerWidth<(Mt?1040:1320),bt=Mt?40:30,ot=Mt?wt?7:8:wt?4:5,Dt=Mt?wt?10:14:wt?8:12,Q="rgba(255,255,255,0.06)",at="rgba(255,255,255,0.12)",G="linear-gradient(135deg, rgb(230, 57, 70), rgb(198, 43, 56))",vt=r?"transparent":"rgba(255,255,255,0.08)";return C.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"stretch",opacity:i?.6:1,border:`1px solid ${vt}`,borderRadius:5,overflow:"hidden",background:Q},children:[C.jsxs("span",{ref:$,style:{position:"relative",display:"inline-flex"},onMouseEnter:()=>{y(!0),R(!0)},onMouseLeave:()=>{y(!1),R(!1)},children:[C.jsx("button",{type:"button",onClick:t,disabled:i,title:l||c?void 0:s,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:bt,boxSizing:"border-box",background:b&&!i?at:"transparent",border:"none",borderRadius:0,color:i?"rgba(255,255,255,0.55)":"#bbb",fontFamily:"inherit",fontSize:"inherit",fontWeight:600,padding:`${ot}px ${Dt}px`,transition:"background 0.15s",cursor:i?"not-allowed":"pointer"},children:C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:wt?6:8},children:[n,g&&p&&p.length>0&&C.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:p.map(Tt=>C.jsx(Bl,{title:`Гаряча клавіша: ${Tt}`,children:Tt},Tt))})]})}),(l||c)&&L&&C.jsx(N5,{anchorRef:$,label:c,hint:l?y6(l,p):void 0,hotkeyParts:p})]}),C.jsxs("span",{ref:ht,style:{position:"relative",display:"inline-flex"},onMouseEnter:()=>{E(!0),H(!0)},onMouseLeave:()=>{E(!1),H(!1)},children:[C.jsx("button",{type:"button",onClick:e,disabled:i,"aria-expanded":!!r,"aria-haspopup":"dialog",title:d?void 0:f,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:bt,minWidth:Mt?32:26,boxSizing:"border-box",background:r?G:A&&!i?at:"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:`${ot}px ${wt?6:8}px`,transition:"background 0.15s, color 0.15s",cursor:i?"not-allowed":"pointer"},children:C.jsx("i",{className:"bi bi-chevron-down",style:{fontSize:tr-2},"aria-hidden":!0})}),d&&q&&C.jsx(N5,{anchorRef:ht,hint:d})]})]})}function bF({onFile:n,highlight:t=!1,warning:e=null}){const r=I.useRef(null),[i,s]=I.useState(!1),l=i||t,c=f=>{f.preventDefault(),f.stopPropagation(),s(!1);const d=f.dataTransfer.files[0];if(!_5(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 C.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:[C.jsx("div",{style:{marginBottom:14,opacity:.5,display:"flex",justifyContent:"center",color:"#555"},children:C.jsx("i",{className:`${$n} bi-image`,style:{fontSize:48},"aria-hidden":!0})}),C.jsx("p",{style:{fontSize:16,color:"#777",lineHeight:1.7,fontWeight:700,margin:0},children:"Завантажте фонове зображення"}),C.jsxs("p",{style:{fontSize:14,color:"#555",margin:0,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,flexWrap:"wrap"},children:["або вставте з буфера",Ii(ie.pasteInCallout,{isMac:cd()}).map(f=>C.jsx(Bl,{title:Wd(),children:f},f))]}),C.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&&C.jsx("p",{style:{marginTop:14,marginBottom:0,color:"#E63946",fontSize:13,lineHeight:1.5},children:e}),C.jsx("input",{ref:r,type:"file",accept:"image/*",style:{display:"none"},onChange:n})]})}HE.createRoot(document.getElementById("root")).render(C.jsx(I.StrictMode,{children:C.jsx(mF,{mode:"embed"})}));export{oi as _,xF as c,Wk as g};
|