polotno-node 3.6.0 → 3.7.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.
@@ -0,0 +1,647 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./jspdf.es.min-87BhH7b6.js","./rolldown-runtime-hePW80VL.js","./preload-helper-HclGiUj8.js","./typeof-B5XbjTb1.js","./lib-Dlaz_6fT.js","./id3-B1cFGCGS.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{At as r,Bt as i,Ft as a,It as o,Lt as s,Mt as c,Nt as l,Pt as u,Rt as d,Vt as f,g as p,h as m,i as h,jt as g,kt as _,m as v,n as y,zt as b}from"./id3-B1cFGCGS.js";import{t as x}from"./preload-helper-HclGiUj8.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var S=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function ee(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function j(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function M(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,M(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ee(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),M(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+ee(a,u),c+=M(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+ee(a,u++),c+=M(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return M(j(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function N(e,t,n){if(e==null)return e;var r=[],i=0;return M(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function P(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var F=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},I={map:N,forEach:function(e,t,n){N(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return N(e,function(){t++}),t},toArray:function(e){return N(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=I,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:P}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,F)}catch(e){F(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),C=n(((e,t)=>{t.exports=S()})),w=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ee(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ee(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function ee(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ee(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),T=n(((e,t)=>{t.exports=w()})),E=n((e=>{var t=C();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),D=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=E()})),O=n((e=>{var t=T(),n=C(),r=D();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),ee=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=ee&&e[ee]||e[`@@iterator`],typeof e==`function`?e:null)}var M=Symbol.for(`react.client.reference`);function N(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===M?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case w:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?N(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return N(e(t))}catch{}}return null}var P=Array.isArray,F=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te={pending:!1,data:null,method:null,action:null},ne=[],L=-1;function R(e){return{current:e}}function re(e){0>L||(e.current=ne[L],ne[L]=null,L--)}function ie(e,t){L++,ne[L]=e.current,e.current=t}var ae=R(null),oe=R(null),se=R(null),ce=R(null);function le(e,t){switch(ie(se,t),ie(oe,e),ie(ae,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Xd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Xd(t),e=Zd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}re(ae),ie(ae,e)}function ue(){re(ae),re(oe),re(se)}function de(e){e.memoizedState!==null&&ie(ce,e);var t=ae.current,n=Zd(t,e.type);t!==n&&(ie(oe,e),ie(ae,n))}function fe(e){oe.current===e&&(re(ae),re(oe)),ce.current===e&&(re(ce),sp._currentValue=te)}var pe,me;function he(e){if(pe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);pe=t&&t[1]||``,me=-1<e.stack.indexOf(`
3
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
+ `+pe+e+me}var ge=!1;function _e(e,t){if(!e||ge)return``;ge=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
+ `),l=s.split(`
6
+ `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
7
+ `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ge=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?he(n):``}function ve(e,t){switch(e.tag){case 26:case 27:case 5:return he(e.type);case 16:return he(`Lazy`);case 13:return e.child!==t&&t!==null?he(`Suspense Fallback`):he(`Suspense`);case 19:return he(`SuspenseList`);case 0:case 15:return _e(e.type,!1);case 11:return _e(e.type.render,!1);case 1:return _e(e.type,!0);case 31:return he(`Activity`);default:return``}}function ye(e){try{var t=``,n=null;do t+=ve(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
8
+ Error generating stack: `+e.message+`
9
+ `+e.stack}}var be=Object.prototype.hasOwnProperty,xe=t.unstable_scheduleCallback,Se=t.unstable_cancelCallback,Ce=t.unstable_shouldYield,we=t.unstable_requestPaint,Te=t.unstable_now,Ee=t.unstable_getCurrentPriorityLevel,De=t.unstable_ImmediatePriority,Oe=t.unstable_UserBlockingPriority,ke=t.unstable_NormalPriority,Ae=t.unstable_LowPriority,je=t.unstable_IdlePriority,Me=t.log,Ne=t.unstable_setDisableYieldValue,Pe=null,Fe=null;function Ie(e){if(typeof Me==`function`&&Ne(e),Fe&&typeof Fe.setStrictMode==`function`)try{Fe.setStrictMode(Pe,e)}catch{}}var Le=Math.clz32?Math.clz32:Be,Re=Math.log,ze=Math.LN2;function Be(e){return e>>>=0,e===0?32:31-(Re(e)/ze|0)|0}var Ve=256,He=262144,Ue=4194304;function We(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ge(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=We(n))):i=We(o):i=We(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=We(n))):i=We(o)):i=We(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ke(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function qe(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 Je(){var e=Ue;return Ue<<=1,!(Ue&62914560)&&(Ue=4194304),e}function z(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ye(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Xe(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Le(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ze(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ze(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Le(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Qe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Le(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function $e(e,t){var n=t&-t;return n=n&42?1:et(n),(n&(e.suspendedLanes|t))===0?n:0}function et(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function tt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function nt(){var e=I.p;return e===0?(e=window.event,e===void 0?32:Cp(e.type)):e}function rt(e,t){var n=I.p;try{return I.p=e,t()}finally{I.p=n}}var it=Math.random().toString(36).slice(2),at=`__reactFiber$`+it,ot=`__reactProps$`+it,st=`__reactContainer$`+it,ct=`__reactEvents$`+it,lt=`__reactListeners$`+it,ut=`__reactHandles$`+it,dt=`__reactResources$`+it,ft=`__reactMarker$`+it;function pt(e){delete e[at],delete e[ot],delete e[ct],delete e[lt],delete e[ut]}function mt(e){var t=e[at];if(t)return t;for(var n=e.parentNode;n;){if(t=n[st]||n[at]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=bf(e);e!==null;){if(n=e[at])return n;e=bf(e)}return t}e=n,n=e.parentNode}return null}function ht(e){if(e=e[at]||e[st]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function gt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function _t(e){var t=e[dt];return t||=e[dt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function vt(e){e[ft]=!0}var yt=new Set,bt={};function xt(e,t){St(e,t),St(e+`Capture`,t)}function St(e,t){for(bt[e]=t,e=0;e<t.length;e++)yt.add(t[e])}var Ct=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]*$`),wt={},Tt={};function Et(e){return be.call(Tt,e)?!0:be.call(wt,e)?!1:Ct.test(e)?Tt[e]=!0:(wt[e]=!0,!1)}function Dt(e,t,n){if(Et(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function Ot(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function kt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function At(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function jt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Mt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Nt(e){if(!e._valueTracker){var t=jt(e)?`checked`:`value`;e._valueTracker=Mt(e,t,``+e[t])}}function Pt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=jt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Ft(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var It=/[\n"\\]/g;function Lt(e){return e.replace(It,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Rt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+At(t)):e.value!==``+At(t)&&(e.value=``+At(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Bt(e,o,At(n)):Bt(e,o,At(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+At(s):e.removeAttribute(`name`)}function zt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Nt(e);return}n=n==null?``:``+At(n),t=t==null?n:``+At(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Nt(e)}function Bt(e,t,n){t===`number`&&Ft(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Vt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+At(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ht(e,t,n){if(t!=null&&(t=``+At(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+At(n)}function Ut(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(P(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=At(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Nt(e)}function Wt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Gt=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 Kt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Gt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function qt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Kt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Kt(e,o,t[o])}function Jt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){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 Yt=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`]]),Xt=/^[\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 Zt(e){return Xt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Qt(){}var $t=null;function en(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var tn=null,nn=null;function rn(e){var t=ht(e);if(t&&(e=t.stateNode)){var n=e[ot]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Rt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Lt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[ot]||null;if(!a)throw Error(i(90));Rt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Pt(r)}break a;case`textarea`:Ht(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Vt(e,!!n.multiple,t,!1)}}}var an=!1;function on(e,t,n){if(an)return e(t,n);an=!0;try{return e(t)}finally{if(an=!1,(tn!==null||nn!==null)&&(Ou(),tn&&(t=tn,e=nn,nn=tn=null,rn(t),e)))for(t=0;t<e.length;t++)rn(e[t])}}function sn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[ot]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var cn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),ln=!1;if(cn)try{var un={};Object.defineProperty(un,"passive",{get:function(){ln=!0}}),window.addEventListener(`test`,un,un),window.removeEventListener(`test`,un,un)}catch{ln=!1}var dn=null,fn=null,pn=null;function mn(){if(pn)return pn;var e,t=fn,n=t.length,r,i=`value`in dn?dn.value:dn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return pn=i.slice(e,1<r?1-r:void 0)}function hn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function gn(){return!0}function _n(){return!1}function vn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?gn:_n,this.isPropagationStopped=_n,this}return f(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=gn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=gn)},persist:function(){},isPersistent:gn}),t}var yn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bn=vn(yn),xn=f({},yn,{view:0,detail:0}),Sn=vn(xn),Cn,wn,Tn,En=f({},xn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:B,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Tn&&(Tn&&e.type===`mousemove`?(Cn=e.screenX-Tn.screenX,wn=e.screenY-Tn.screenY):wn=Cn=0,Tn=e),Cn)},movementY:function(e){return`movementY`in e?e.movementY:wn}}),Dn=vn(En),On=vn(f({},En,{dataTransfer:0})),kn=vn(f({},xn,{relatedTarget:0})),An=vn(f({},yn,{animationName:0,elapsedTime:0,pseudoElement:0})),jn=vn(f({},yn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Mn=vn(f({},yn,{data:0})),Nn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Pn={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`},Fn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function In(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Fn[e])?!!t[e]:!1}function B(){return In}var Ln=vn(f({},xn,{key:function(e){if(e.key){var t=Nn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=hn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Pn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:B,charCode:function(e){return e.type===`keypress`?hn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?hn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Rn=vn(f({},En,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),zn=vn(f({},xn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:B})),Bn=vn(f({},yn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Vn=vn(f({},En,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Hn=vn(f({},yn,{newState:0,oldState:0})),Un=[9,13,27,32],Wn=cn&&`CompositionEvent`in window,Gn=null;cn&&`documentMode`in document&&(Gn=document.documentMode);var Kn=cn&&`TextEvent`in window&&!Gn,qn=cn&&(!Wn||Gn&&8<Gn&&11>=Gn),Jn=` `,Yn=!1;function Xn(e,t){switch(e){case`keyup`:return Un.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Zn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Qn=!1;function $n(e,t){switch(e){case`compositionend`:return Zn(t);case`keypress`:return t.which===32?(Yn=!0,Jn):null;case`textInput`:return e=t.data,e===Jn&&Yn?null:e;default:return null}}function er(e,t){if(Qn)return e===`compositionend`||!Wn&&Xn(e,t)?(e=mn(),pn=fn=dn=null,Qn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return qn&&t.locale!==`ko`?null:t.data;default:return null}}var tr={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 nr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!tr[e.type]:t===`textarea`}function rr(e,t,n,r){tn?nn?nn.push(r):nn=[r]:tn=r,t=Pd(t,`onChange`),0<t.length&&(n=new bn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var ir=null,ar=null;function or(e){Dd(e,0)}function sr(e){if(Pt(gt(e)))return e}function cr(e,t){if(e===`change`)return t}var lr=!1;if(cn){var ur;if(cn){var dr=`oninput`in document;if(!dr){var fr=document.createElement(`div`);fr.setAttribute(`oninput`,`return;`),dr=typeof fr.oninput==`function`}ur=dr}else ur=!1;lr=ur&&(!document.documentMode||9<document.documentMode)}function pr(){ir&&(ir.detachEvent(`onpropertychange`,mr),ar=ir=null)}function mr(e){if(e.propertyName===`value`&&sr(ar)){var t=[];rr(t,ar,e,en(e)),on(or,t)}}function hr(e,t,n){e===`focusin`?(pr(),ir=t,ar=n,ir.attachEvent(`onpropertychange`,mr)):e===`focusout`&&pr()}function gr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return sr(ar)}function _r(e,t){if(e===`click`)return sr(t)}function vr(e,t){if(e===`input`||e===`change`)return sr(t)}function yr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var br=typeof Object.is==`function`?Object.is:yr;function xr(e,t){if(br(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!be.call(t,i)||!br(e[i],t[i]))return!1}return!0}function Sr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Cr(e,t){var n=Sr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Sr(n)}}function wr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ft(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ft(e.document)}return t}function Er(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Dr=cn&&`documentMode`in document&&11>=document.documentMode,Or=null,kr=null,Ar=null,jr=!1;function Mr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;jr||Or==null||Or!==Ft(r)||(r=Or,`selectionStart`in r&&Er(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ar&&xr(Ar,r)||(Ar=r,r=Pd(kr,`onSelect`),0<r.length&&(t=new bn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Or)))}function Nr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Pr={animationend:Nr(`Animation`,`AnimationEnd`),animationiteration:Nr(`Animation`,`AnimationIteration`),animationstart:Nr(`Animation`,`AnimationStart`),transitionrun:Nr(`Transition`,`TransitionRun`),transitionstart:Nr(`Transition`,`TransitionStart`),transitioncancel:Nr(`Transition`,`TransitionCancel`),transitionend:Nr(`Transition`,`TransitionEnd`)},Fr={},Ir={};cn&&(Ir=document.createElement(`div`).style,`AnimationEvent`in window||(delete Pr.animationend.animation,delete Pr.animationiteration.animation,delete Pr.animationstart.animation),`TransitionEvent`in window||delete Pr.transitionend.transition);function Lr(e){if(Fr[e])return Fr[e];if(!Pr[e])return e;var t=Pr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ir)return Fr[e]=t[n];return e}var Rr=Lr(`animationend`),zr=Lr(`animationiteration`),Br=Lr(`animationstart`),Vr=Lr(`transitionrun`),Hr=Lr(`transitionstart`),Ur=Lr(`transitioncancel`),Wr=Lr(`transitionend`),Gr=new Map,Kr=`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(` `);Kr.push(`scrollEnd`);function qr(e,t){Gr.set(e,t),xt(t,[e])}var Jr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Yr=[],Xr=0,Zr=0;function Qr(){for(var e=Xr,t=Zr=Xr=0;t<e;){var n=Yr[t];Yr[t++]=null;var r=Yr[t];Yr[t++]=null;var i=Yr[t];Yr[t++]=null;var a=Yr[t];if(Yr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ni(n,i,a)}}function $r(e,t,n,r){Yr[Xr++]=e,Yr[Xr++]=t,Yr[Xr++]=n,Yr[Xr++]=r,Zr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ei(e,t,n,r){return $r(e,t,n,r),ri(e)}function ti(e,t){return $r(e,null,null,t),ri(e)}function ni(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Le(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ri(e){if(50<yu)throw yu=0,bu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ii={};function ai(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function oi(e,t,n,r){return new ai(e,t,n,r)}function si(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ci(e,t){var n=e.alternate;return n===null?(n=oi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function li(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ui(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)si(e)&&(s=1);else if(typeof e==`string`)s=Qf(e,n,ae.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=oi(31,n,t,a),e.elementType=k,e.lanes=o,e;case g:return di(n.children,a,o,t);case _:s=8,a|=24;break;case v:return e=oi(12,n,t,a|2),e.elementType=v,e.lanes=o,e;case S:return e=oi(13,n,t,a),e.elementType=S,e.lanes=o,e;case w:return e=oi(19,n,t,a),e.elementType=w,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case b:s=10;break a;case y:s=9;break a;case x:s=11;break a;case E:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=oi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function di(e,t,n,r){return e=oi(7,e,r,t),e.lanes=n,e}function fi(e,t,n){return e=oi(6,e,null,t),e.lanes=n,e}function pi(e){var t=oi(18,null,null,0);return t.stateNode=e,t}function mi(e,t,n){return t=oi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var hi=new WeakMap;function gi(e,t){if(typeof e==`object`&&e){var n=hi.get(e);return n===void 0?(t={value:e,source:t,stack:ye(t)},hi.set(e,t),t):n}return{value:e,source:t,stack:ye(t)}}var _i=[],vi=0,yi=null,bi=0,xi=[],Si=0,Ci=null,wi=1,Ti=``;function Ei(e,t){_i[vi++]=bi,_i[vi++]=yi,yi=e,bi=t}function Di(e,t,n){xi[Si++]=wi,xi[Si++]=Ti,xi[Si++]=Ci,Ci=e;var r=wi;e=Ti;var i=32-Le(r)-1;r&=~(1<<i),n+=1;var a=32-Le(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,wi=1<<32-Le(t)+i|n<<i|r,Ti=a+e}else wi=1<<a|n<<i|r,Ti=e}function Oi(e){e.return!==null&&(Ei(e,1),Di(e,1,0))}function ki(e){for(;e===yi;)yi=_i[--vi],_i[vi]=null,bi=_i[--vi],_i[vi]=null;for(;e===Ci;)Ci=xi[--Si],xi[Si]=null,Ti=xi[--Si],xi[Si]=null,wi=xi[--Si],xi[Si]=null}function Ai(e,t){xi[Si++]=wi,xi[Si++]=Ti,xi[Si++]=Ci,wi=t.id,Ti=t.overflow,Ci=e}var ji=null,Mi=null,Ni=!1,Pi=null,Fi=!1,Ii=Error(i(519));function Li(e){throw Ui(gi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ii}function Ri(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[at]=e,t[ot]=r,n){case`dialog`:Od(`cancel`,t),Od(`close`,t);break;case`iframe`:case`object`:case`embed`:Od(`load`,t);break;case`video`:case`audio`:for(n=0;n<Td.length;n++)Od(Td[n],t);break;case`source`:Od(`error`,t);break;case`img`:case`image`:case`link`:Od(`error`,t),Od(`load`,t);break;case`details`:Od(`toggle`,t);break;case`input`:Od(`invalid`,t),zt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Od(`invalid`,t);break;case`textarea`:Od(`invalid`,t),Ut(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Bd(t.textContent,n)?(r.popover!=null&&(Od(`beforetoggle`,t),Od(`toggle`,t)),r.onScroll!=null&&Od(`scroll`,t),r.onScrollEnd!=null&&Od(`scrollend`,t),r.onClick!=null&&(t.onclick=Qt),t=!0):t=!1,t||Li(e,!0)}function zi(e){for(ji=e.return;ji;)switch(ji.tag){case 5:case 31:case 13:Fi=!1;return;case 27:case 3:Fi=!0;return;default:ji=ji.return}}function Bi(e){if(e!==ji)return!1;if(!Ni)return zi(e),Ni=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Qd(e.type,e.memoizedProps)),n=!n),n&&Mi&&Li(e),zi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Mi=yf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Mi=yf(e)}else t===27?(t=Mi,sf(e.type)?(e=vf,vf=null,Mi=e):Mi=t):Mi=ji?_f(e.stateNode.nextSibling):null;return!0}function Vi(){Mi=ji=null,Ni=!1}function Hi(){var e=Pi;return e!==null&&(au===null?au=e:au.push.apply(au,e),Pi=null),e}function Ui(e){Pi===null?Pi=[e]:Pi.push(e)}var Wi=R(null),Gi=null,Ki=null;function qi(e,t,n){ie(Wi,t._currentValue),t._currentValue=n}function Ji(e){e._currentValue=Wi.current,re(Wi)}function Yi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Xi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Yi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Yi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Zi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;br(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ce.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[sp]:e.push(sp))}a=a.return}e!==null&&Xi(t,e,n,r),t.flags|=262144}function Qi(e){for(e=e.firstContext;e!==null;){if(!br(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function $i(e){Gi=e,Ki=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ea(e){return na(Gi,e)}function ta(e,t){return Gi===null&&$i(e),na(e,t)}function na(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ki===null){if(e===null)throw Error(i(308));Ki=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ki=Ki.next=t;return n}var ra=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ia=t.unstable_scheduleCallback,aa=t.unstable_NormalPriority,oa={$$typeof:b,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function sa(){return{controller:new ra,data:new Map,refCount:0}}function ca(e){e.refCount--,e.refCount===0&&ia(aa,function(){e.controller.abort()})}var la=null,ua=0,da=0,fa=null;function pa(e,t){if(la===null){var n=la=[];ua=0,da=yd(),fa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ua++,t.then(ma,ma),t}function ma(){if(--ua===0&&la!==null){fa!==null&&(fa.status=`fulfilled`);var e=la;la=null,da=0,fa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ha(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ga=F.S;F.S=function(e,t){cu=Te(),typeof t==`object`&&t&&typeof t.then==`function`&&pa(e,t),ga!==null&&ga(e,t)};var _a=R(null);function va(){var e=_a.current;return e===null?Ul.pooledCache:e}function ya(e,t){t===null?ie(_a,_a.current):ie(_a,t.pool)}function ba(){var e=va();return e===null?null:{parent:oa._currentValue,pool:e}}var xa=Error(i(460)),Sa=Error(i(474)),Ca=Error(i(542)),wa={then:function(){}};function Ta(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ea(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Qt,Qt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Aa(e),e;default:if(typeof t.status==`string`)t.then(Qt,Qt);else{if(e=Ul,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Aa(e),e}throw Oa=t,xa}}function Da(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Oa=e,xa):e}}var Oa=null;function ka(){if(Oa===null)throw Error(i(459));var e=Oa;return Oa=null,e}function Aa(e){if(e===xa||e===Ca)throw Error(i(483))}var ja=null,Ma=0;function Na(e){var t=Ma;return Ma+=1,ja===null&&(ja=[]),Ea(ja,e,t)}function Pa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Fa(e,t){throw t.$$typeof===p?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ia(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ci(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=fi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===g?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&Da(i)===t.type)?(t=a(t,n.props),Pa(t,n),t.return=e,t):(t=ui(n.type,n.key,n.props,null,e.mode,r),Pa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=mi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=di(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=fi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case m:return n=ui(t.type,t.key,t.props,null,e.mode,n),Pa(n,t),n.return=e,n;case h:return t=mi(t,e.mode,n),t.return=e,t;case O:return t=Da(t),f(e,t,n)}if(P(t)||j(t))return t=di(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Na(t),n);if(t.$$typeof===b)return f(e,ta(e,t),n);Fa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case m:return n.key===i?l(e,t,n,r):null;case h:return n.key===i?u(e,t,n,r):null;case O:return n=Da(n),p(e,t,n,r)}if(P(n)||j(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Na(n),r);if(n.$$typeof===b)return p(e,t,ta(e,n),r);Fa(e,n)}return null}function _(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case m:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case h:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=Da(r),_(e,t,n,r,i)}if(P(r)||j(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return _(e,t,n,Na(r),i);if(r.$$typeof===b)return _(e,t,n,ta(t,r),i);Fa(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,m=a=0,h=null;d!==null&&m<s.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),Ni&&Ei(i,m),l;if(d===null){for(;m<s.length;m++)d=f(i,s[m],c),d!==null&&(a=o(d,a,m),u===null?l=d:u.sibling=d,u=d);return Ni&&Ei(i,m),l}for(d=r(d);m<s.length;m++)h=_(d,i,m,s[m],c),h!==null&&(e&&h.alternate!==null&&d.delete(h.key===null?m:h.key),a=o(h,a,m),u===null?l=h:u.sibling=h,u=h);return e&&d.forEach(function(e){return t(i,e)}),Ni&&Ei(i,m),l}function y(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,m=s,h=s=0,g=null,v=c.next();m!==null&&!v.done;h++,v=c.next()){m.index>h?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),Ni&&Ei(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return Ni&&Ei(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),Ni&&Ei(a,h),u}function x(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Da(l)===r.type){n(e,r.sibling),c=a(r,o.props),Pa(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===g?(c=di(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ui(o.type,o.key,o.props,null,e.mode,c),Pa(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=mi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Da(o),x(e,r,o,c)}if(P(o))return v(e,r,o,c);if(j(o)){if(l=j(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return x(e,r,Na(o),c);if(o.$$typeof===b)return x(e,r,ta(e,o),c);Fa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=fi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ma=0;var i=x(e,t,n,r);return ja=null,i}catch(t){if(t===xa||t===Ca)throw t;var a=oi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var La=Ia(!0),V=Ia(!1),Ra=!1;function za(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ba(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Va(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ha(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Hl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ri(e),ni(e,null,n),t}return $r(e,r,t,n),ri(e)}function Ua(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Qe(e,n)}}function Wa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ga=!1;function Ka(){if(Ga){var e=fa;if(e!==null)throw e}}function qa(e,t,n,r){Ga=!1;var i=e.updateQueue;Ra=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(Gl&p)===p:(r&p)===p){p!==0&&p===da&&(Ga=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Ra=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),$l|=o,e.lanes=o,e.memoizedState=d}}function Ja(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ya(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ja(n[e],t)}var Xa=R(null),Za=R(0);function Qa(e,t){e=Zl,ie(Za,e),ie(Xa,t),Zl=e|t.baseLanes}function $a(){ie(Za,Zl),ie(Xa,Xa.current)}function eo(){Zl=Za.current,re(Xa),re(Za)}var to=R(null),no=null;function ro(e){var t=e.alternate;ie(H,H.current&1),ie(to,e),no===null&&(t===null||Xa.current!==null||t.memoizedState!==null)&&(no=e)}function io(e){ie(H,H.current),ie(to,e),no===null&&(no=e)}function ao(e){e.tag===22?(ie(H,H.current),ie(to,e),no===null&&(no=e)):oo(e)}function oo(){ie(H,H.current),ie(to,to.current)}function so(e){re(to),no===e&&(no=null),re(H)}var H=R(0);function co(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||mf(n)||hf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var lo=0,uo=null,fo=null,po=null,mo=!1,ho=!1,go=!1,_o=0,vo=0,yo=null,bo=0;function xo(){throw Error(i(321))}function So(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!br(e[n],t[n]))return!1;return!0}function Co(e,t,n,r,i,a){return lo=a,uo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,F.H=e===null||e.memoizedState===null?Bs:Vs,go=!1,a=n(r,i),go=!1,ho&&(a=To(t,n,r,i)),wo(e),a}function wo(e){F.H=zs;var t=fo!==null&&fo.next!==null;if(lo=0,po=fo=uo=null,mo=!1,vo=0,yo=null,t)throw Error(i(300));e===null||ic||(e=e.dependencies,e!==null&&Qi(e)&&(ic=!0))}function To(e,t,n,r){uo=e;var a=0;do{if(ho&&(yo=null),vo=0,ho=!1,25<=a)throw Error(i(301));if(a+=1,po=fo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}F.H=Hs,o=t(n,r)}while(ho);return o}function Eo(){var e=F.H,t=e.useState()[0];return t=typeof t.then==`function`?No(t):t,e=e.useState()[0],(fo===null?null:fo.memoizedState)!==e&&(uo.flags|=1024),t}function Do(){var e=_o!==0;return _o=0,e}function Oo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ko(e){if(mo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}mo=!1}lo=0,po=fo=uo=null,ho=!1,vo=_o=0,yo=null}function Ao(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return po===null?uo.memoizedState=po=e:po=po.next=e,po}function jo(){if(fo===null){var e=uo.alternate;e=e===null?null:e.memoizedState}else e=fo.next;var t=po===null?uo.memoizedState:po.next;if(t!==null)po=t,fo=e;else{if(e===null)throw uo.alternate===null?Error(i(467)):Error(i(310));fo=e,e={memoizedState:fo.memoizedState,baseState:fo.baseState,baseQueue:fo.baseQueue,queue:fo.queue,next:null},po===null?uo.memoizedState=po=e:po=po.next=e}return po}function Mo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function No(e){var t=vo;return vo+=1,yo===null&&(yo=[]),e=Ea(yo,e,t),t=uo,(po===null?t.memoizedState:po.next)===null&&(t=t.alternate,F.H=t===null||t.memoizedState===null?Bs:Vs),e}function Po(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return No(e);if(e.$$typeof===b)return ea(e)}throw Error(i(438,String(e)))}function Fo(e){var t=null,n=uo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=uo.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Mo(),uo.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function Io(e,t){return typeof t==`function`?t(e):t}function Lo(e){return Ro(jo(),fo,e)}function Ro(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(lo&f)===f:(Gl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===da&&(d=!0);else if((lo&p)===p){u=u.next,p===da&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,uo.lanes|=p,$l|=p;f=u.action,go&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,uo.lanes|=f,$l|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!br(o,e.memoizedState)&&(ic=!0,d&&(n=fa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function zo(e){var t=jo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);br(o,t.memoizedState)||(ic=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Bo(e,t,n){var r=uo,a=jo(),o=Ni;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!br((fo||a).memoizedState,n);if(s&&(a.memoizedState=n,ic=!0),a=a.queue,ds(Uo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||po!==null&&po.memoizedState.tag&1){if(r.flags|=2048,os(9,{destroy:void 0},Ho.bind(null,r,a,n,t),null),Ul===null)throw Error(i(349));o||lo&127||Vo(r,t,n)}return n}function Vo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=uo.updateQueue,t===null?(t=Mo(),uo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ho(e,t,n,r){t.value=n,t.getSnapshot=r,Wo(t)&&Go(e)}function Uo(e,t,n){return n(function(){Wo(t)&&Go(e)})}function Wo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!br(e,n)}catch{return!0}}function Go(e){var t=ti(e,2);t!==null&&Cu(t,e,2)}function Ko(e){var t=Ao();if(typeof e==`function`){var n=e;if(e=n(),go){Ie(!0);try{n()}finally{Ie(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:e},t}function qo(e,t,n,r){return e.baseState=n,Ro(e,fo,typeof r==`function`?r:Io)}function Jo(e,t,n,r,a){if(Is(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};F.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Yo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Yo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=F.T,o={};F.T=o;try{var s=n(i,r),c=F.S;c!==null&&c(o,s),Xo(e,t,s)}catch(n){Qo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),F.T=a}}else try{a=n(i,r),Xo(e,t,a)}catch(n){Qo(e,t,n)}}function Xo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Zo(e,t,n)},function(n){return Qo(e,t,n)}):Zo(e,t,n)}function Zo(e,t,n){t.status=`fulfilled`,t.value=n,$o(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Yo(e,n)))}function Qo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,$o(t),t=t.next;while(t!==r)}e.action=null}function $o(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function es(e,t){return t}function ts(e,t){if(Ni){var n=Ul.formState;if(n!==null){a:{var r=uo;if(Ni){if(Mi){b:{for(var i=Mi,a=Fi;i.nodeType!==8;){if(!a){i=null;break b}if(i=_f(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Mi=_f(i.nextSibling),r=i.data===`F!`;break a}}Li(r)}r=!1}r&&(t=n[0])}}return n=Ao(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:es,lastRenderedState:t},n.queue=r,n=Ns.bind(null,uo,r),r.dispatch=n,r=Ko(!1),a=Fs.bind(null,uo,!1,r.queue),r=Ao(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Jo.bind(null,uo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function ns(e){return rs(jo(),fo,e)}function rs(e,t,n){if(t=Ro(e,t,es)[0],e=Lo(Io)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=No(t)}catch(e){throw e===xa?Ca:e}else r=t;t=jo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(uo.flags|=2048,os(9,{destroy:void 0},is.bind(null,i,n),null)),[r,a,e]}function is(e,t){e.action=t}function as(e){var t=jo(),n=fo;if(n!==null)return rs(t,n,e);jo(),t=t.memoizedState,n=jo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function os(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=uo.updateQueue,t===null&&(t=Mo(),uo.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ss(){return jo().memoizedState}function cs(e,t,n,r){var i=Ao();uo.flags|=e,i.memoizedState=os(1|t,{destroy:void 0},n,r===void 0?null:r)}function ls(e,t,n,r){var i=jo();r=r===void 0?null:r;var a=i.memoizedState.inst;fo!==null&&r!==null&&So(r,fo.memoizedState.deps)?i.memoizedState=os(t,a,n,r):(uo.flags|=e,i.memoizedState=os(1|t,a,n,r))}function us(e,t){cs(8390656,8,e,t)}function ds(e,t){ls(2048,8,e,t)}function fs(e){uo.flags|=4;var t=uo.updateQueue;if(t===null)t=Mo(),uo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ps(e){var t=jo().memoizedState;return fs({ref:t,nextImpl:e}),function(){if(Hl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ms(e,t){return ls(4,2,e,t)}function hs(e,t){return ls(4,4,e,t)}function gs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function _s(e,t,n){n=n==null?null:n.concat([e]),ls(4,4,gs.bind(null,t,e),n)}function vs(){}function ys(e,t){var n=jo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&So(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function bs(e,t){var n=jo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&So(t,r[1]))return r[0];if(r=e(),go){Ie(!0);try{e()}finally{Ie(!1)}}return n.memoizedState=[r,t],r}function xs(e,t,n){return n===void 0||lo&1073741824&&!(Gl&261930)?e.memoizedState=t:(e.memoizedState=n,e=Su(),uo.lanes|=e,$l|=e,n)}function Ss(e,t,n,r){return br(n,t)?n:Xa.current===null?!(lo&42)||lo&1073741824&&!(Gl&261930)?(ic=!0,e.memoizedState=n):(e=Su(),uo.lanes|=e,$l|=e,t):(e=xs(e,n,r),br(e,t)||(ic=!0),e)}function Cs(e,t,n,r,i){var a=I.p;I.p=a!==0&&8>a?a:8;var o=F.T,s={};F.T=s,Fs(e,!1,t,n);try{var c=i(),l=F.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ps(e,t,ha(c,r),xu(e)):Ps(e,t,r,xu(e))}catch(n){Ps(e,t,{then:function(){},status:`rejected`,reason:n},xu())}finally{I.p=a,o!==null&&s.types!==null&&(o.types=s.types),F.T=o}}function ws(){}function Ts(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Es(e).queue;Cs(e,a,t,te,n===null?ws:function(){return Ds(e),n(r)})}function Es(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:te,baseState:te,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:te},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ds(e){var t=Es(e);t.next===null&&(t=e.alternate.memoizedState),Ps(e,t.next.queue,{},xu())}function Os(){return ea(sp)}function ks(){return jo().memoizedState}function As(){return jo().memoizedState}function js(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=xu();e=Va(n);var r=Ha(t,e,n);r!==null&&(Cu(r,t,n),Ua(r,t,n)),t={cache:sa()},e.payload=t;return}t=t.return}}function Ms(e,t,n){var r=xu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Is(e)?Ls(t,n):(n=ei(e,t,n,r),n!==null&&(Cu(n,e,r),Rs(n,t,r)))}function Ns(e,t,n){Ps(e,t,n,xu())}function Ps(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Is(e))Ls(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,br(s,o))return $r(e,t,i,0),Ul===null&&Qr(),!1}catch{}if(n=ei(e,t,i,r),n!==null)return Cu(n,e,r),Rs(n,t,r),!0}return!1}function Fs(e,t,n,r){if(r={lane:2,revertLane:yd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Is(e)){if(t)throw Error(i(479))}else t=ei(e,n,r,2),t!==null&&Cu(t,e,2)}function Is(e){var t=e.alternate;return e===uo||t!==null&&t===uo}function Ls(e,t){ho=mo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Rs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Qe(e,n)}}var zs={readContext:ea,use:Po,useCallback:xo,useContext:xo,useEffect:xo,useImperativeHandle:xo,useLayoutEffect:xo,useInsertionEffect:xo,useMemo:xo,useReducer:xo,useRef:xo,useState:xo,useDebugValue:xo,useDeferredValue:xo,useTransition:xo,useSyncExternalStore:xo,useId:xo,useHostTransitionStatus:xo,useFormState:xo,useActionState:xo,useOptimistic:xo,useMemoCache:xo,useCacheRefresh:xo};zs.useEffectEvent=xo;var Bs={readContext:ea,use:Po,useCallback:function(e,t){return Ao().memoizedState=[e,t===void 0?null:t],e},useContext:ea,useEffect:us,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),cs(4194308,4,gs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return cs(4194308,4,e,t)},useInsertionEffect:function(e,t){cs(4,2,e,t)},useMemo:function(e,t){var n=Ao();t=t===void 0?null:t;var r=e();if(go){Ie(!0);try{e()}finally{Ie(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ao();if(n!==void 0){var i=n(t);if(go){Ie(!0);try{n(t)}finally{Ie(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ms.bind(null,uo,e),[r.memoizedState,e]},useRef:function(e){var t=Ao();return e={current:e},t.memoizedState=e},useState:function(e){e=Ko(e);var t=e.queue,n=Ns.bind(null,uo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:vs,useDeferredValue:function(e,t){return xs(Ao(),e,t)},useTransition:function(){var e=Ko(!1);return e=Cs.bind(null,uo,e.queue,!0,!1),Ao().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=uo,a=Ao();if(Ni){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ul===null)throw Error(i(349));Gl&127||Vo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,us(Uo.bind(null,r,o,e),[e]),r.flags|=2048,os(9,{destroy:void 0},Ho.bind(null,r,o,n,t),null),n},useId:function(){var e=Ao(),t=Ul.identifierPrefix;if(Ni){var n=Ti,r=wi;n=(r&~(1<<32-Le(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=_o++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=bo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Os,useFormState:ts,useActionState:ts,useOptimistic:function(e){var t=Ao();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Fs.bind(null,uo,!0,n),n.dispatch=t,[e,t]},useMemoCache:Fo,useCacheRefresh:function(){return Ao().memoizedState=js.bind(null,uo)},useEffectEvent:function(e){var t=Ao(),n={impl:e};return t.memoizedState=n,function(){if(Hl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Vs={readContext:ea,use:Po,useCallback:ys,useContext:ea,useEffect:ds,useImperativeHandle:_s,useInsertionEffect:ms,useLayoutEffect:hs,useMemo:bs,useReducer:Lo,useRef:ss,useState:function(){return Lo(Io)},useDebugValue:vs,useDeferredValue:function(e,t){return Ss(jo(),fo.memoizedState,e,t)},useTransition:function(){var e=Lo(Io)[0],t=jo().memoizedState;return[typeof e==`boolean`?e:No(e),t]},useSyncExternalStore:Bo,useId:ks,useHostTransitionStatus:Os,useFormState:ns,useActionState:ns,useOptimistic:function(e,t){return qo(jo(),fo,e,t)},useMemoCache:Fo,useCacheRefresh:As};Vs.useEffectEvent=ps;var Hs={readContext:ea,use:Po,useCallback:ys,useContext:ea,useEffect:ds,useImperativeHandle:_s,useInsertionEffect:ms,useLayoutEffect:hs,useMemo:bs,useReducer:zo,useRef:ss,useState:function(){return zo(Io)},useDebugValue:vs,useDeferredValue:function(e,t){var n=jo();return fo===null?xs(n,e,t):Ss(n,fo.memoizedState,e,t)},useTransition:function(){var e=zo(Io)[0],t=jo().memoizedState;return[typeof e==`boolean`?e:No(e),t]},useSyncExternalStore:Bo,useId:ks,useHostTransitionStatus:Os,useFormState:as,useActionState:as,useOptimistic:function(e,t){var n=jo();return fo===null?(n.baseState=e,[e,n.queue.dispatch]):qo(n,fo,e,t)},useMemoCache:Fo,useCacheRefresh:As};Hs.useEffectEvent=ps;function Us(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ws={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=xu(),i=Va(r);i.payload=t,n!=null&&(i.callback=n),t=Ha(e,i,r),t!==null&&(Cu(t,e,r),Ua(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=xu(),i=Va(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ha(e,i,r),t!==null&&(Cu(t,e,r),Ua(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=xu(),r=Va(n);r.tag=2,t!=null&&(r.callback=t),t=Ha(e,r,n),t!==null&&(Cu(t,e,n),Ua(t,e,n))}};function Gs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!xr(n,r)||!xr(i,a):!0}function Ks(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ws.enqueueReplaceState(t,t.state,null)}function qs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Js(e){Jr(e)}function Ys(e){console.error(e)}function Xs(e){Jr(e)}function Zs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Qs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function $s(e,t,n){return n=Va(n),n.tag=3,n.payload={element:null},n.callback=function(){Zs(e,t)},n}function ec(e){return e=Va(e),e.tag=3,e}function tc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Qs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Qs(t,n,r),typeof i!=`function`&&(du===null?du=new Set([this]):du.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function nc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Zi(t,n,a,!0),n=to.current,n!==null){switch(n.tag){case 31:case 13:return no===null?Fu():n.alternate===null&&Ql===0&&(Ql=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===wa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),ed(e,r,a)),!1;case 22:return n.flags|=65536,r===wa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),ed(e,r,a)),!1}throw Error(i(435,n.tag))}return ed(e,r,a),Fu(),!1}if(Ni)return t=to.current,t===null?(r!==Ii&&(t=Error(i(423),{cause:r}),Ui(gi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=gi(r,n),a=$s(e.stateNode,r,a),Wa(e,a),Ql!==4&&(Ql=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ii&&(e=Error(i(422),{cause:r}),Ui(gi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=gi(o,n),iu===null?iu=[o]:iu.push(o),Ql!==4&&(Ql=2),t===null)return!0;r=gi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=$s(n.stateNode,r,e),Wa(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(du===null||!du.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=ec(a),tc(a,e,n,r),Wa(n,a),!1}n=n.return}while(n!==null);return!1}var rc=Error(i(461)),ic=!1;function ac(e,t,n,r){t.child=e===null?V(t,null,n,r):La(t,e.child,n,r)}function oc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return $i(t),r=Co(e,t,n,o,a,i),s=Do(),e!==null&&!ic?(Oo(e,t,i),Ac(e,t,i)):(Ni&&s&&Oi(t),t.flags|=1,ac(e,t,r,i),t.child)}function sc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!si(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,cc(e,t,a,r,i)):(e=ui(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!jc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?xr:n,n(o,r)&&e.ref===t.ref)return Ac(e,t,i)}return t.flags|=1,e=ci(a,r),e.ref=t.ref,e.return=t,t.child=e}function cc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(xr(a,r)&&e.ref===t.ref){if(ic=!1,t.pendingProps=r=a,jc(e,i))e.flags&131072&&(ic=!0);else return t.lanes=e.lanes,Ac(e,t,i)}}return gc(e,t,n,r,i)}function lc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return dc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ya(t,a===null?null:a.cachePool),a===null?$a():Qa(t,a),ao(t);else return r=t.lanes=536870912,dc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ya(t,null),$a(),oo(t)):(ya(t,a.cachePool),Qa(t,a),oo(t),t.memoizedState=null);return ac(e,t,i,n),t.child}function uc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function dc(e,t,n,r,i){var a=va();return a=a===null?null:{parent:oa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ya(t,null),$a(),ao(t),e!==null&&Zi(e,t,r,!0),t.childLanes=i,null}function fc(e,t){return t=Tc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function pc(e,t,n){return La(t,e.child,null,n),e=fc(t,t.pendingProps),e.flags|=2,so(t),t.memoizedState=null,e}function mc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(Ni){if(r.mode===`hidden`)return e=fc(t,r),t.lanes=536870912,uc(null,e);if(io(t),(e=Mi)?(e=pf(e,Fi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ci===null?null:{id:wi,overflow:Ti},retryLane:536870912,hydrationErrors:null},n=pi(e),n.return=t,t.child=n,ji=t,Mi=null)):e=null,e===null)throw Li(t);return t.lanes=536870912,null}return fc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(io(t),a){if(t.flags&256)t.flags&=-257,t=pc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(ic||Zi(e,t,n,!1),a=(n&e.childLanes)!==0,ic||a){if(r=Ul,r!==null&&(s=$e(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ti(e,s),Cu(r,e,s),rc;Fu(),t=pc(e,t,n)}else e=o.treeContext,Mi=_f(s.nextSibling),ji=t,Ni=!0,Pi=null,Fi=!1,e!==null&&Ai(t,e),t=fc(t,r),t.flags|=4096;return t}return e=ci(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function hc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function gc(e,t,n,r,i){return $i(t),n=Co(e,t,n,r,void 0,i),r=Do(),e!==null&&!ic?(Oo(e,t,i),Ac(e,t,i)):(Ni&&r&&Oi(t),t.flags|=1,ac(e,t,n,i),t.child)}function _c(e,t,n,r,i,a){return $i(t),t.updateQueue=null,n=To(t,r,n,i),wo(e),r=Do(),e!==null&&!ic?(Oo(e,t,a),Ac(e,t,a)):(Ni&&r&&Oi(t),t.flags|=1,ac(e,t,n,a),t.child)}function vc(e,t,n,r,i){if($i(t),t.stateNode===null){var a=ii,o=n.contextType;typeof o==`object`&&o&&(a=ea(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ws,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},za(t),o=n.contextType,a.context=typeof o==`object`&&o?ea(o):ii,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Us(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ws.enqueueReplaceState(a,a.state,null),qa(t,r,a,i),Ka(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=qs(n,s);a.props=c;var l=a.context,u=n.contextType;o=ii,typeof u==`object`&&u&&(o=ea(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Ks(t,a,r,o),Ra=!1;var f=t.memoizedState;a.state=f,qa(t,r,a,i),Ka(),l=t.memoizedState,s||f!==l||Ra?(typeof d==`function`&&(Us(t,n,d,r),l=t.memoizedState),(c=Ra||Gs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ba(e,t),o=t.memoizedProps,u=qs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ii,typeof l==`object`&&l&&(c=ea(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Ks(t,a,r,c),Ra=!1,f=t.memoizedState,a.state=f,qa(t,r,a,i),Ka();var p=t.memoizedState;o!==d||f!==p||Ra||e!==null&&e.dependencies!==null&&Qi(e.dependencies)?(typeof s==`function`&&(Us(t,n,s,r),p=t.memoizedState),(u=Ra||Gs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Qi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,hc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=La(t,e.child,null,i),t.child=La(t,null,n,i)):ac(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Ac(e,t,i),e}function yc(e,t,n,r){return Vi(),t.flags|=256,ac(e,t,n,r),t.child}var bc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xc(e){return{baseLanes:e,cachePool:ba()}}function Sc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=nu),e}function Cc(e,t,n){var r=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(H.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(Ni){if(a?ro(t):oo(t),(e=Mi)?(e=pf(e,Fi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ci===null?null:{id:wi,overflow:Ti},retryLane:536870912,hydrationErrors:null},n=pi(e),n.return=t,t.child=n,ji=t,Mi=null)):e=null,e===null)throw Li(t);return hf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(oo(t),a=t.mode,c=Tc({mode:`hidden`,children:c},a),r=di(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=xc(n),r.childLanes=Sc(e,s,n),t.memoizedState=bc,uc(null,r)):(ro(t),wc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(ro(t),t.flags&=-257,t=Ec(e,t,n)):t.memoizedState===null?(oo(t),c=r.fallback,a=t.mode,r=Tc({mode:`visible`,children:r.children},a),c=di(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,La(t,e.child,null,n),r=t.child,r.memoizedState=xc(n),r.childLanes=Sc(e,s,n),t.memoizedState=bc,t=uc(null,r)):(oo(t),t.child=e.child,t.flags|=128,t=null);else if(ro(t),hf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Ui({value:r,source:null,stack:null}),t=Ec(e,t,n)}else if(ic||Zi(e,t,n,!1),s=(n&e.childLanes)!==0,ic||s){if(s=Ul,s!==null&&(r=$e(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ti(e,r),Cu(s,e,r),rc;mf(c)||Fu(),t=Ec(e,t,n)}else mf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Mi=_f(c.nextSibling),ji=t,Ni=!0,Pi=null,Fi=!1,e!==null&&Ai(t,e),t=wc(t,r.children),t.flags|=4096);return t}return a?(oo(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ci(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=di(c,a,n,null),c.flags|=2):c=ci(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,uc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=xc(n):(a=c.cachePool,a===null?a=ba():(l=oa._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=Sc(e,s,n),t.memoizedState=bc,uc(e.child,r)):(ro(t),n=e.child,e=n.sibling,n=ci(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function wc(e,t){return t=Tc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Tc(e,t){return e=oi(22,e,null,t),e.lanes=0,e}function Ec(e,t,n){return La(t,e.child,null,n),e=wc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Dc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Yi(e.return,t,n)}function Oc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function kc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=H.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,ie(H,o),ac(e,t,r,n),r=Ni?bi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Dc(e,n,t);else if(e.tag===19)Dc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&co(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Oc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&co(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Oc(t,!0,n,null,a,r);break;case`together`:Oc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ac(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),$l|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Zi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ci(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ci(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function jc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Qi(e)))}function Mc(e,t,n){switch(t.tag){case 3:le(t,t.stateNode.containerInfo),qi(t,oa,e.memoizedState.cache),Vi();break;case 27:case 5:de(t);break;case 4:le(t,t.stateNode.containerInfo);break;case 10:qi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,io(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(ro(t),e=Ac(e,t,n),e===null?null:e.sibling):Cc(e,t,n):(ro(t),t.flags|=128,null);ro(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Zi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return kc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ie(H,H.current),r)break;return null;case 22:return t.lanes=0,lc(e,t,n,t.pendingProps);case 24:qi(t,oa,e.memoizedState.cache)}return Ac(e,t,n)}function Nc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)ic=!0;else{if(!jc(e,n)&&!(t.flags&128))return ic=!1,Mc(e,t,n);ic=!!(e.flags&131072)}}else ic=!1,Ni&&t.flags&1048576&&Di(t,bi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Da(t.elementType),t.type=e,typeof e==`function`)si(e)?(r=qs(e,r),t.tag=1,t=vc(null,t,e,r,n)):(t.tag=0,t=gc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===x){t.tag=11,t=oc(null,t,e,r,n);break a}if(a===E){t.tag=14,t=sc(null,t,e,r,n);break a}}throw t=N(e)||e,Error(i(306,t,``))}}return t;case 0:return gc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=qs(r,t.pendingProps),vc(e,t,r,a,n);case 3:a:{if(le(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ba(e,t),qa(t,r,null,n);var s=t.memoizedState;if(r=s.cache,qi(t,oa,r),r!==o.cache&&Xi(t,[oa],n,!0),Ka(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=yc(e,t,r,n);break a}if(r!==a){a=gi(Error(i(424)),t),Ui(a),t=yc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Mi=_f(e.firstChild),ji=t,Ni=!0,Pi=null,Fi=!0,n=V(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Vi(),r===a){t=Ac(e,t,n);break a}ac(e,t,r,n)}t=t.child}return t;case 26:return hc(e,t),e===null?(n=Rf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ni||(n=t.type,e=t.pendingProps,r=Yd(se.current).createElement(n),r[at]=t,r[ot]=e,Ud(r,n,e),vt(r),t.stateNode=r):t.memoizedState=Rf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return de(t),e===null&&Ni&&(r=t.stateNode=xf(t.type,t.pendingProps,se.current),ji=t,Fi=!0,a=Mi,sf(t.type)?(vf=a,Mi=_f(r.firstChild)):Mi=a),ac(e,t,t.pendingProps.children,n),hc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ni&&((a=r=Mi)&&(r=df(r,t.type,t.pendingProps,Fi),r===null?a=!1:(t.stateNode=r,ji=t,Mi=_f(r.firstChild),Fi=!1,a=!0)),a||Li(t)),de(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Qd(a,o)?r=null:s!==null&&Qd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Co(e,t,Eo,null,null,n),sp._currentValue=a),hc(e,t),ac(e,t,r,n),t.child;case 6:return e===null&&Ni&&((e=n=Mi)&&(n=ff(n,t.pendingProps,Fi),n===null?e=!1:(t.stateNode=n,ji=t,Mi=null,e=!0)),e||Li(t)),null;case 13:return Cc(e,t,n);case 4:return le(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=La(t,null,r,n):ac(e,t,r,n),t.child;case 11:return oc(e,t,t.type,t.pendingProps,n);case 7:return ac(e,t,t.pendingProps,n),t.child;case 8:return ac(e,t,t.pendingProps.children,n),t.child;case 12:return ac(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,qi(t,t.type,r.value),ac(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,$i(t),a=ea(a),r=r(a),t.flags|=1,ac(e,t,r,n),t.child;case 14:return sc(e,t,t.type,t.pendingProps,n);case 15:return cc(e,t,t.type,t.pendingProps,n);case 19:return kc(e,t,n);case 31:return mc(e,t,n);case 22:return lc(e,t,n,t.pendingProps);case 24:return $i(t),r=ea(oa),e===null?(a=va(),a===null&&(a=Ul,o=sa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},za(t),qi(t,oa,a)):((e.lanes&n)!==0&&(Ba(e,t),qa(t,null,null,n),Ka()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,qi(t,oa,r),r!==a.cache&&Xi(t,[oa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),qi(t,oa,r))),ac(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Pc(e){e.flags|=4}function Fc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Mu())e.flags|=8192;else throw Oa=wa,Sa}}else e.flags&=-16777217}function Ic(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!$f(t)){if(Mu())e.flags|=8192;else throw Oa=wa,Sa}}function Lc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Je(),e.lanes|=t,ru|=t)}function Rc(e,t){if(!Ni)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function zc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Bc(e,t,n){var r=t.pendingProps;switch(ki(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zc(t),null;case 1:return zc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ji(oa),ue(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Bi(t)?Pc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Hi())),zc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Pc(t),o===null?(zc(t),Fc(t,a,null,r,n)):(zc(t),Ic(t,o))):o?o===e.memoizedState?(zc(t),t.flags&=-16777217):(Pc(t),zc(t),Ic(t,o)):(e=e.memoizedProps,e!==r&&Pc(t),zc(t),Fc(t,a,e,r,n)),null;case 27:if(fe(t),n=se.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return zc(t),null}e=ae.current,Bi(t)?Ri(t,e):(e=xf(a,r,n),t.stateNode=e,Pc(t))}return zc(t),null;case 5:if(fe(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return zc(t),null}if(o=ae.current,Bi(t))Ri(t,o);else{var s=Yd(se.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[at]=t,o[ot]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Ud(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Pc(t)}}return zc(t),Fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=se.current,Bi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ji,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[at]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Bd(e.nodeValue,n)),e||Li(t,!0)}else e=Yd(e).createTextNode(r),e[at]=t,t.stateNode=e}return zc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Bi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[at]=t}else Vi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),e=!1}else n=Hi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(so(t),t):(so(t),null);if(t.flags&128)throw Error(i(558))}return zc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Bi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[at]=t}else Vi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),a=!1}else a=Hi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(so(t),t):(so(t),null)}return so(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Lc(t,t.updateQueue),zc(t),null);case 4:return ue(),e===null&&Ad(t.stateNode.containerInfo),zc(t),null;case 10:return Ji(t.type),zc(t),null;case 19:if(re(H),r=t.memoizedState,r===null)return zc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Rc(r,!1);else{if(Ql!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=co(e),o!==null){for(t.flags|=128,Rc(r,!1),e=o.updateQueue,t.updateQueue=e,Lc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)li(n,e),n=n.sibling;return ie(H,H.current&1|2),Ni&&Ei(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Te()>lu&&(t.flags|=128,a=!0,Rc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=co(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Lc(t,e),Rc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Ni)return zc(t),null}else 2*Te()-r.renderingStartTime>lu&&n!==536870912&&(t.flags|=128,a=!0,Rc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(zc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Te(),e.sibling=null,n=H.current,ie(H,a?n&1|2:n&1),Ni&&Ei(t,r.treeForkCount),e);case 22:case 23:return so(t),eo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(zc(t),t.subtreeFlags&6&&(t.flags|=8192)):zc(t),n=t.updateQueue,n!==null&&Lc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&re(_a),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ji(oa),zc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Vc(e,t){switch(ki(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ji(oa),ue(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return fe(t),null;case 31:if(t.memoizedState!==null){if(so(t),t.alternate===null)throw Error(i(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(so(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return re(H),null;case 4:return ue(),null;case 10:return Ji(t.type),null;case 22:case 23:return so(t),eo(),e!==null&&re(_a),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ji(oa),null;case 25:return null;default:return null}}function Hc(e,t){switch(ki(t),t.tag){case 3:Ji(oa),ue();break;case 26:case 27:case 5:fe(t);break;case 4:ue();break;case 31:t.memoizedState!==null&&so(t);break;case 13:so(t);break;case 19:re(H);break;case 10:Ji(t.type);break;case 22:case 23:so(t),eo(),e!==null&&re(_a);break;case 24:Ji(oa)}}function Uc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){$u(t,t.return,e)}}function Wc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){$u(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){$u(t,t.return,e)}}function Gc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ya(t,n)}catch(t){$u(e,e.return,t)}}}function Kc(e,t,n){n.props=qs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){$u(e,t,n)}}function qc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){$u(e,t,n)}}function Jc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){$u(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){$u(e,t,n)}else n.current=null}}function Yc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){$u(e,e.return,t)}}function Xc(e,t,n){try{var r=e.stateNode;Wd(r,e.type,n,t),r[ot]=t}catch(t){$u(e,e.return,t)}}function Zc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&sf(e.type)||e.tag===4}function Qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Zc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&sf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function $c(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Qt));else if(r!==4&&(r===27&&sf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function el(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&sf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(el(e,t,n),e=e.sibling;e!==null;)el(e,t,n),e=e.sibling}function tl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Ud(t,r,n),t[at]=e,t[ot]=n}catch(t){$u(e,e.return,t)}}var nl=!1,rl=!1,il=!1,al=typeof WeakSet==`function`?WeakSet:Set,ol=null;function sl(e,t){if(e=e.containerInfo,qd=gp,e=Tr(e),Er(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Jd={focusedElem:e,selectionRange:n},gp=!1,ol=t;ol!==null;)if(t=ol,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,ol=e;else for(;ol!==null;){switch(t=ol,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=qs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){$u(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)uf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:uf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,ol=e;break}ol=t.return}}function cl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Cl(e,n),r&4&&Uc(5,n);break;case 1:if(Cl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){$u(n,n.return,e)}else{var i=qs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){$u(n,n.return,e)}}}r&64&&Gc(n),r&512&&qc(n,n.return);break;case 3:if(Cl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ya(e,t)}catch(e){$u(n,n.return,e)}}break;case 27:t===null&&r&4&&tl(n);case 26:case 5:Cl(e,n),t===null&&r&4&&Yc(n),r&512&&qc(n,n.return);break;case 12:Cl(e,n);break;case 31:Cl(e,n),r&4&&ml(e,n);break;case 13:Cl(e,n),r&4&&hl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=rd.bind(null,n),gf(e,n))));break;case 22:if(r=n.memoizedState!==null||nl,!r){t=t!==null&&t.memoizedState!==null||rl,i=nl;var a=rl;nl=r,(rl=t)&&!a?Tl(e,n,!!(n.subtreeFlags&8772)):Cl(e,n),nl=i,rl=a}break;case 30:break;default:Cl(e,n)}}function ll(e){var t=e.alternate;t!==null&&(e.alternate=null,ll(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&pt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ul=null,dl=!1;function fl(e,t,n){for(n=n.child;n!==null;)pl(e,t,n),n=n.sibling}function pl(e,t,n){if(Fe&&typeof Fe.onCommitFiberUnmount==`function`)try{Fe.onCommitFiberUnmount(Pe,n)}catch{}switch(n.tag){case 26:rl||Jc(n,t),fl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:rl||Jc(n,t);var r=ul,i=dl;sf(n.type)&&(ul=n.stateNode,dl=!1),fl(e,t,n),Sf(n.stateNode),ul=r,dl=i;break;case 5:rl||Jc(n,t);case 6:if(r=ul,i=dl,ul=null,fl(e,t,n),ul=r,dl=i,ul!==null){if(dl)try{(ul.nodeType===9?ul.body:ul.nodeName===`HTML`?ul.ownerDocument.body:ul).removeChild(n.stateNode)}catch(e){$u(n,t,e)}else try{ul.removeChild(n.stateNode)}catch(e){$u(n,t,e)}}break;case 18:ul!==null&&(dl?(e=ul,cf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Hp(e)):cf(ul,n.stateNode));break;case 4:r=ul,i=dl,ul=n.stateNode.containerInfo,dl=!0,fl(e,t,n),ul=r,dl=i;break;case 0:case 11:case 14:case 15:Wc(2,n,t),rl||Wc(4,n,t),fl(e,t,n);break;case 1:rl||(Jc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Kc(n,t,r)),fl(e,t,n);break;case 21:fl(e,t,n);break;case 22:rl=(r=rl)||n.memoizedState!==null,fl(e,t,n),rl=r;break;default:fl(e,t,n)}}function ml(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Hp(e)}catch(e){$u(t,t.return,e)}}}function hl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Hp(e)}catch(e){$u(t,t.return,e)}}function gl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new al),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new al),t;default:throw Error(i(435,e.tag))}}function _l(e,t){var n=gl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=id.bind(null,e,t);t.then(r,r)}})}function vl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(sf(c.type)){ul=c.stateNode,dl=!1;break a}break;case 5:ul=c.stateNode,dl=!1;break a;case 3:case 4:ul=c.stateNode.containerInfo,dl=!0;break a}c=c.return}if(ul===null)throw Error(i(160));pl(o,s,a),ul=null,dl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)bl(t,e),t=t.sibling}var yl=null;function bl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:vl(t,e),xl(e),r&4&&(Wc(3,e,e.return),Uc(3,e),Wc(5,e,e.return));break;case 1:vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),r&64&&nl&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=yl;if(vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[ft]||o[at]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Ud(o,r,n),o[at]=e,vt(o),r=o;break a;case`link`:var s=Xf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Ud(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Xf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Ud(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[at]=e,vt(o),r=o}e.stateNode=r}else Zf(a,e.type,e.stateNode)}else e.stateNode=Gf(a,r,e.memoizedProps)}else o===r?r===null&&e.stateNode!==null&&Xc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Zf(a,e.type,e.stateNode):Gf(a,r,e.memoizedProps))}break;case 27:vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),n!==null&&r&4&&Xc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),e.flags&32){a=e.stateNode;try{Wt(a,``)}catch(t){$u(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Xc(e,a,n===null?a:n.memoizedProps)),r&1024&&(il=!0);break;case 6:if(vl(t,e),xl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){$u(e,e.return,t)}}break;case 3:if(Yf=null,a=yl,yl=Tf(t.containerInfo),vl(t,e),yl=a,xl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Hp(t.containerInfo)}catch(t){$u(e,e.return,t)}il&&(il=!1,Sl(e));break;case 4:r=yl,yl=Tf(e.stateNode.containerInfo),vl(t,e),xl(e),yl=r;break;case 12:vl(t,e),xl(e);break;case 31:vl(t,e),xl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,_l(e,r)));break;case 13:vl(t,e),xl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(su=Te()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,_l(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=nl,d=rl;if(nl=u||a,rl=d||l,vl(t,e),rl=d,nl=u,xl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||nl||rl||wl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){$u(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){$u(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?lf(m,!0):lf(l.stateNode,!1)}catch(e){$u(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,_l(e,n))));break;case 19:vl(t,e),xl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,_l(e,r)));break;case 30:break;case 21:break;default:vl(t,e),xl(e)}}function xl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Zc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;el(e,Qc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Wt(o,``),n.flags&=-33),el(e,Qc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;$c(e,Qc(e),s);break;default:throw Error(i(161))}}catch(t){$u(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Sl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Sl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Cl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)cl(e,t.alternate,t),t=t.sibling}function wl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Wc(4,t,t.return),wl(t);break;case 1:Jc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Kc(t,t.return,n),wl(t);break;case 27:Sf(t.stateNode);case 26:case 5:Jc(t,t.return),wl(t);break;case 22:t.memoizedState===null&&wl(t);break;case 30:wl(t);break;default:wl(t)}e=e.sibling}}function Tl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Tl(i,a,n),Uc(4,a);break;case 1:if(Tl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){$u(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ja(c[i],s)}catch(e){$u(r,r.return,e)}}n&&o&64&&Gc(a),qc(a,a.return);break;case 27:tl(a);case 26:case 5:Tl(i,a,n),n&&r===null&&o&4&&Yc(a),qc(a,a.return);break;case 12:Tl(i,a,n);break;case 31:Tl(i,a,n),n&&o&4&&ml(i,a);break;case 13:Tl(i,a,n),n&&o&4&&hl(i,a);break;case 22:a.memoizedState===null&&Tl(i,a,n),qc(a,a.return);break;case 30:break;default:Tl(i,a,n)}t=t.sibling}}function El(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ca(n))}function Dl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ca(e))}function Ol(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)kl(e,t,n,r),t=t.sibling}function kl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Ol(e,t,n,r),i&2048&&Uc(9,t);break;case 1:Ol(e,t,n,r);break;case 3:Ol(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ca(e)));break;case 12:if(i&2048){Ol(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){$u(t,t.return,e)}}else Ol(e,t,n,r);break;case 31:Ol(e,t,n,r);break;case 13:Ol(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Ol(e,t,n,r):(a._visibility|=2,Al(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?Ol(e,t,n,r):jl(e,t),i&2048&&El(o,t);break;case 24:Ol(e,t,n,r),i&2048&&Dl(t.alternate,t);break;default:Ol(e,t,n,r)}}function Al(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Al(a,o,s,c,i),Uc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Al(a,o,s,c,i)):u._visibility&2?Al(a,o,s,c,i):jl(a,o),i&&l&2048&&El(o.alternate,o);break;case 24:Al(a,o,s,c,i),i&&l&2048&&Dl(o.alternate,o);break;default:Al(a,o,s,c,i)}t=t.sibling}}function jl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:jl(n,r),i&2048&&El(r.alternate,r);break;case 24:jl(n,r),i&2048&&Dl(r.alternate,r);break;default:jl(n,r)}t=t.sibling}}var Ml=8192;function Nl(e,t,n){if(e.subtreeFlags&Ml)for(e=e.child;e!==null;)Pl(e,t,n),e=e.sibling}function Pl(e,t,n){switch(e.tag){case 26:Nl(e,t,n),e.flags&Ml&&e.memoizedState!==null&&ep(n,yl,e.memoizedState,e.memoizedProps);break;case 5:Nl(e,t,n);break;case 3:case 4:var r=yl;yl=Tf(e.stateNode.containerInfo),Nl(e,t,n),yl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Ml,Ml=16777216,Nl(e,t,n),Ml=r):Nl(e,t,n));break;default:Nl(e,t,n)}}function Fl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Il(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ol=r,zl(r,e)}Fl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ll(e),e=e.sibling}function Ll(e){switch(e.tag){case 0:case 11:case 15:Il(e),e.flags&2048&&Wc(9,e,e.return);break;case 3:Il(e);break;case 12:Il(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Rl(e)):Il(e);break;default:Il(e)}}function Rl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ol=r,zl(r,e)}Fl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Wc(8,t,t.return),Rl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Rl(t));break;default:Rl(t)}e=e.sibling}}function zl(e,t){for(;ol!==null;){var n=ol;switch(n.tag){case 0:case 11:case 15:Wc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ca(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,ol=r;else a:for(n=e;ol!==null;){r=ol;var i=r.sibling,a=r.return;if(ll(r),r===n){ol=null;break a}if(i!==null){i.return=a,ol=i;break a}ol=a}}}var Bl={getCacheForType:function(e){var t=ea(oa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ea(oa).controller.signal}},Vl=typeof WeakMap==`function`?WeakMap:Map,Hl=0,Ul=null,Wl=null,Gl=0,Kl=0,ql=null,Jl=!1,Yl=!1,Xl=!1,Zl=0,Ql=0,$l=0,eu=0,tu=0,nu=0,ru=0,iu=null,au=null,ou=!1,su=0,cu=0,lu=1/0,uu=null,du=null,fu=0,pu=null,mu=null,hu=0,gu=0,_u=null,vu=null,yu=0,bu=null;function xu(){return Hl&2&&Gl!==0?Gl&-Gl:F.T===null?nt():yd()}function Su(){if(nu===0){if(!(Gl&536870912)||Ni){var e=He;He<<=1,!(He&3932160)&&(He=262144),nu=e}else nu=536870912}return e=to.current,e!==null&&(e.flags|=32),nu}function Cu(e,t,n){(e===Ul&&(Kl===2||Kl===9)||e.cancelPendingCommit!==null)&&(Au(e,0),Du(e,Gl,nu,!1)),Ye(e,n),(!(Hl&2)||e!==Ul)&&(e===Ul&&(!(Hl&2)&&(eu|=n),Ql===4&&Du(e,Gl,nu,!1)),dd(e))}function wu(e,t,n){if(Hl&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Ke(e,t),a=r?Ru(e,t):Iu(e,t,!0),o=r;do{if(a===0){Yl&&!r&&Du(e,t,0,!1);break}if(n=e.current.alternate,o&&!Eu(n)){a=Iu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=iu;var l=c.current.memoizedState.isDehydrated;if(l&&(Au(c,s).flags|=256),s=Iu(c,s,!1),s!==2){if(Xl&&!l){c.errorRecoveryDisabledLanes|=o,eu|=o,a=4;break a}o=au,au=a,o!==null&&(au===null?au=o:au.push.apply(au,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Au(e,0),Du(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Du(r,t,nu,!Jl);break a;case 2:au=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=su+300-Te(),10<a)){if(Du(r,t,nu,!Jl),Ge(r,0,!0)!==0)break a;hu=t,r.timeoutHandle=tf(Tu.bind(null,r,n,au,uu,ou,t,nu,eu,ru,Jl,o,`Throttled`,-0,0),a);break a}Tu(r,n,au,uu,ou,t,nu,eu,ru,Jl,o,null,-0,0)}break}while(1);dd(e)}function Tu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Qt},Pl(t,a,d);var m=(a&62914560)===a?su-Te():(a&4194048)===a?cu-Te():0;if(m=np(d,m),m!==null){hu=a,e.cancelPendingCommit=m(Gu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Du(e,a,o,!l);return}}Gu(e,t,a,n,r,i,o,s,c)}function Eu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!br(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Du(e,t,n,r){t&=~tu,t&=~eu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Le(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ze(e,n,t)}function Ou(){return Hl&6?!0:(fd(0,!1),!1)}function ku(){if(Wl!==null){if(Kl===0)var e=Wl.return;else e=Wl,Ki=Gi=null,ko(e),ja=null,Ma=0,e=Wl;for(;e!==null;)Hc(e.alternate,e),e=e.return;Wl=null}}function Au(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,nf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),hu=0,ku(),Ul=e,Wl=n=ci(e.current,null),Gl=t,Kl=0,ql=null,Jl=!1,Yl=Ke(e,t),Xl=!1,ru=nu=tu=eu=$l=Ql=0,au=iu=null,ou=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Le(r),a=1<<i;t|=e[i],r&=~a}return Zl=t,Qr(),n}function ju(e,t){uo=null,F.H=zs,t===xa||t===Ca?(t=ka(),Kl=3):t===Sa?(t=ka(),Kl=4):Kl=t===rc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,ql=t,Wl===null&&(Ql=1,Zs(e,gi(t,e.current)))}function Mu(){var e=to.current;return e===null?!0:(Gl&4194048)===Gl?no===null:(Gl&62914560)===Gl||Gl&536870912?e===no:!1}function Nu(){var e=F.H;return F.H=zs,e===null?zs:e}function Pu(){var e=F.A;return F.A=Bl,e}function Fu(){Ql=4,Jl||(Gl&4194048)!==Gl&&to.current!==null||(Yl=!0),!($l&134217727)&&!(eu&134217727)||Ul===null||Du(Ul,Gl,nu,!1)}function Iu(e,t,n){var r=Hl;Hl|=2;var i=Nu(),a=Pu();(Ul!==e||Gl!==t)&&(uu=null,Au(e,t)),t=!1;var o=Ql;a:do try{if(Kl!==0&&Wl!==null){var s=Wl,c=ql;switch(Kl){case 8:ku(),o=6;break a;case 3:case 2:case 9:case 6:to.current===null&&(t=!0);var l=Kl;if(Kl=0,ql=null,Hu(e,s,c,l),n&&Yl){o=0;break a}break;default:l=Kl,Kl=0,ql=null,Hu(e,s,c,l)}}Lu(),o=Ql;break}catch(t){ju(e,t)}while(1);return t&&e.shellSuspendCounter++,Ki=Gi=null,Hl=r,F.H=i,F.A=a,Wl===null&&(Ul=null,Gl=0,Qr()),o}function Lu(){for(;Wl!==null;)Bu(Wl)}function Ru(e,t){var n=Hl;Hl|=2;var r=Nu(),a=Pu();Ul!==e||Gl!==t?(uu=null,lu=Te()+500,Au(e,t)):Yl=Ke(e,t);a:do try{if(Kl!==0&&Wl!==null){t=Wl;var o=ql;b:switch(Kl){case 1:Kl=0,ql=null,Hu(e,t,o,1);break;case 2:case 9:if(Ta(o)){Kl=0,ql=null,Vu(t);break}t=function(){Kl!==2&&Kl!==9||Ul!==e||(Kl=7),dd(e)},o.then(t,t);break a;case 3:Kl=7;break a;case 4:Kl=5;break a;case 7:Ta(o)?(Kl=0,ql=null,Vu(t)):(Kl=0,ql=null,Hu(e,t,o,7));break;case 5:var s=null;switch(Wl.tag){case 26:s=Wl.memoizedState;case 5:case 27:var c=Wl;if(s?$f(s):c.stateNode.complete){Kl=0,ql=null;var l=c.sibling;if(l!==null)Wl=l;else{var u=c.return;u===null?Wl=null:(Wl=u,Uu(u))}break b}}Kl=0,ql=null,Hu(e,t,o,5);break;case 6:Kl=0,ql=null,Hu(e,t,o,6);break;case 8:ku(),Ql=6;break a;default:throw Error(i(462))}}zu();break}catch(t){ju(e,t)}while(1);return Ki=Gi=null,F.H=r,F.A=a,Hl=n,Wl===null?(Ul=null,Gl=0,Qr(),Ql):0}function zu(){for(;Wl!==null&&!Ce();)Bu(Wl)}function Bu(e){var t=Nc(e.alternate,e,Zl);e.memoizedProps=e.pendingProps,t===null?Uu(e):Wl=t}function Vu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=_c(n,t,t.pendingProps,t.type,void 0,Gl);break;case 11:t=_c(n,t,t.pendingProps,t.type.render,t.ref,Gl);break;case 5:ko(t);default:Hc(n,t),t=Wl=li(t,Zl),t=Nc(n,t,Zl)}e.memoizedProps=e.pendingProps,t===null?Uu(e):Wl=t}function Hu(e,t,n,r){Ki=Gi=null,ko(t),ja=null,Ma=0;var i=t.return;try{if(nc(e,i,t,n,Gl)){Ql=1,Zs(e,gi(n,e.current)),Wl=null;return}}catch(t){if(i!==null)throw Wl=i,t;Ql=1,Zs(e,gi(n,e.current)),Wl=null;return}t.flags&32768?(Ni||r===1?e=!0:Yl||Gl&536870912?e=!1:(Jl=e=!0,(r===2||r===9||r===3||r===6)&&(r=to.current,r!==null&&r.tag===13&&(r.flags|=16384))),Wu(t,e)):Uu(t)}function Uu(e){var t=e;do{if(t.flags&32768){Wu(t,Jl);return}e=t.return;var n=Bc(t.alternate,t,Zl);if(n!==null){Wl=n;return}if(t=t.sibling,t!==null){Wl=t;return}Wl=t=e}while(t!==null);Ql===0&&(Ql=5)}function Wu(e,t){do{var n=Vc(e.alternate,e);if(n!==null){n.flags&=32767,Wl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Wl=e;return}Wl=e=n}while(e!==null);Ql=6,Wl=null}function Gu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Xu();while(fu!==0);if(Hl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Zr,Xe(e,n,o,s,c,l),e===Ul&&(Wl=Ul=null,Gl=0),mu=t,pu=e,hu=n,gu=o,_u=a,vu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,ad(ke,function(){return Zu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=F.T,F.T=null,a=I.p,I.p=2,s=Hl,Hl|=4;try{sl(e,t,n)}finally{Hl=s,I.p=a,F.T=r}}fu=1,Ku(),qu(),Ju()}}function Ku(){if(fu===1){fu=0;var e=pu,t=mu,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=F.T,F.T=null;var r=I.p;I.p=2;var i=Hl;Hl|=4;try{bl(t,e);var a=Jd,o=Tr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&wr(s.ownerDocument.documentElement,s)){if(c!==null&&Er(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Cr(s,h),v=Cr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}gp=!!qd,Jd=qd=null}finally{Hl=i,I.p=r,F.T=n}}e.current=t,fu=2}}function qu(){if(fu===2){fu=0;var e=pu,t=mu,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=F.T,F.T=null;var r=I.p;I.p=2;var i=Hl;Hl|=4;try{cl(e,t.alternate,t)}finally{Hl=i,I.p=r,F.T=n}}fu=3}}function Ju(){if(fu===4||fu===3){fu=0,we();var e=pu,t=mu,n=hu,r=vu;t.subtreeFlags&10256||t.flags&10256?fu=5:(fu=0,mu=pu=null,Yu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(du=null),tt(n),t=t.stateNode,Fe&&typeof Fe.onCommitFiberRoot==`function`)try{Fe.onCommitFiberRoot(Pe,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=F.T,i=I.p,I.p=2,F.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{F.T=t,I.p=i}}hu&3&&Xu(),dd(e),i=e.pendingLanes,n&261930&&i&42?e===bu?yu++:(yu=0,bu=e):yu=0,fd(0,!1)}}function Yu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ca(t)))}function Xu(){return Ku(),qu(),Ju(),Zu()}function Zu(){if(fu!==5)return!1;var e=pu,t=gu;gu=0;var n=tt(hu),r=F.T,a=I.p;try{I.p=32>n?32:n,F.T=null,n=_u,_u=null;var o=pu,s=hu;if(fu=0,mu=pu=null,hu=0,Hl&6)throw Error(i(331));var c=Hl;if(Hl|=4,Ll(o.current),kl(o,o.current,s,n),Hl=c,fd(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot==`function`)try{Fe.onPostCommitFiberRoot(Pe,o)}catch{}return!0}finally{I.p=a,F.T=r,Yu(e,t)}}function Qu(e,t,n){t=gi(n,t),t=$s(e.stateNode,t,2),e=Ha(e,t,2),e!==null&&(Ye(e,2),dd(e))}function $u(e,t,n){if(e.tag===3)Qu(e,e,n);else for(;t!==null;){if(t.tag===3){Qu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(du===null||!du.has(r))){e=gi(n,e),n=ec(2),r=Ha(t,n,2),r!==null&&(tc(n,r,t,e),Ye(r,2),dd(r));break}}t=t.return}}function ed(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Vl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Xl=!0,i.add(n),e=td.bind(null,e,t,n),t.then(e,e))}function td(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ul===e&&(Gl&n)===n&&(Ql===4||Ql===3&&(Gl&62914560)===Gl&&300>Te()-su?!(Hl&2)&&Au(e,0):tu|=n,ru===Gl&&(ru=0)),dd(e)}function nd(e,t){t===0&&(t=Je()),e=ti(e,t),e!==null&&(Ye(e,t),dd(e))}function rd(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),nd(e,n)}function id(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),nd(e,n)}function ad(e,t){return xe(e,t)}var od=null,sd=null,U=!1,cd=!1,ld=!1,ud=0;function dd(e){e!==sd&&e.next===null&&(sd===null?od=sd=e:sd=sd.next=e),cd=!0,U||(U=!0,vd())}function fd(e,t){if(!ld&&cd){ld=!0;do for(var n=!1,r=od;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Le(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,_d(r,a))}else a=Gl,a=Ge(r,r===Ul?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ke(r,a)||(n=!0,_d(r,a))}r=r.next}while(n);ld=!1}}function pd(){md()}function md(){cd=U=!1;var e=0;ud!==0&&ef()&&(e=ud);for(var t=Te(),n=null,r=od;r!==null;){var i=r.next,a=hd(r,t);a===0?(r.next=null,n===null?od=i:n.next=i,i===null&&(sd=n)):(n=r,(e!==0||a&3)&&(cd=!0)),r=i}fu!==0&&fu!==5||fd(e,!1),ud!==0&&(ud=0)}function hd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Le(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=qe(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ul,n=Gl,n=Ge(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Kl===2||Kl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Se(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ke(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Se(r),tt(n)){case 2:case 8:n=Oe;break;case 32:n=ke;break;case 268435456:n=je;break;default:n=ke}return r=gd.bind(null,e),n=xe(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Se(r),e.callbackPriority=2,e.callbackNode=null,2}function gd(e,t){if(fu!==0&&fu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Xu()&&e.callbackNode!==n)return null;var r=Gl;return r=Ge(e,e===Ul?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(wu(e,r,t),hd(e,Te()),e.callbackNode!=null&&e.callbackNode===n?gd.bind(null,e):null)}function _d(e,t){if(Xu())return null;wu(e,t,!0)}function vd(){af(function(){Hl&6?xe(De,pd):md()})}function yd(){if(ud===0){var e=da;e===0&&(e=Ve,Ve<<=1,!(Ve&261888)&&(Ve=256)),ud=e}return ud}function bd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Zt(``+e)}function xd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Sd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=bd((i[ot]||null).action),o=r.submitter;o&&(t=(t=o[ot]||null)?bd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new bn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ud!==0){var e=o?xd(i,o):new FormData(i);Ts(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?xd(i,o):new FormData(i),Ts(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Cd=0;Cd<Kr.length;Cd++){var wd=Kr[Cd];qr(wd.toLowerCase(),`on`+(wd[0].toUpperCase()+wd.slice(1)))}qr(Rr,`onAnimationEnd`),qr(zr,`onAnimationIteration`),qr(Br,`onAnimationStart`),qr(`dblclick`,`onDoubleClick`),qr(`focusin`,`onFocus`),qr(`focusout`,`onBlur`),qr(Vr,`onTransitionRun`),qr(Hr,`onTransitionStart`),qr(Ur,`onTransitionCancel`),qr(Wr,`onTransitionEnd`),St(`onMouseEnter`,[`mouseout`,`mouseover`]),St(`onMouseLeave`,[`mouseout`,`mouseover`]),St(`onPointerEnter`,[`pointerout`,`pointerover`]),St(`onPointerLeave`,[`pointerout`,`pointerover`]),xt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),xt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),xt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),xt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),xt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),xt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Td=`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(` `),Ed=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Td));function Dd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Jr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Jr(e)}i.currentTarget=null,a=c}}}}function Od(e,t){var n=t[ct];n===void 0&&(n=t[ct]=new Set);var r=e+`__bubble`;n.has(r)||(jd(t,e,2,!1),n.add(r))}function W(e,t,n){var r=0;t&&(r|=4),jd(n,e,r,t)}var kd=`_reactListening`+Math.random().toString(36).slice(2);function Ad(e){if(!e[kd]){e[kd]=!0,yt.forEach(function(t){t!==`selectionchange`&&(Ed.has(t)||W(t,!1,e),W(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[kd]||(t[kd]=!0,W(`selectionchange`,!1,t))}}function jd(e,t,n,r){switch(Cp(t)){case 2:var i=_p;break;case 8:i=vp;break;default:i=yp}n=i.bind(null,t,n,e),i=void 0,!ln||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Md(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=mt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}on(function(){var r=a,i=en(n),s=[];a:{var c=Gr.get(e);if(c!==void 0){var l=bn,u=e;switch(e){case`keypress`:if(hn(n)===0)break a;case`keydown`:case`keyup`:l=Ln;break;case`focusin`:u=`focus`,l=kn;break;case`focusout`:u=`blur`,l=kn;break;case`beforeblur`:case`afterblur`:l=kn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Dn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=On;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=zn;break;case Rr:case zr:case Br:l=An;break;case Wr:l=Bn;break;case`scroll`:case`scrollend`:l=Sn;break;case`wheel`:l=Vn;break;case`copy`:case`cut`:case`paste`:l=jn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Rn;break;case`toggle`:case`beforetoggle`:l=Hn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=sn(m,p),g!=null&&d.push(Nd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==$t&&(u=n.relatedTarget||n.fromElement)&&(mt(u)||u[st]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?mt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Dn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Rn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:gt(l),h=u==null?c:gt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,mt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Fd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Id(s,c,l,d,!1),u!==null&&f!==null&&Id(s,f,u,d,!0)}}a:{if(c=r?gt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=cr;else if(nr(c)){if(lr)v=vr;else{v=gr;var y=hr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Jt(r.elementType)&&(v=cr):v=_r;if(v&&=v(e,r)){rr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Bt(c,`number`,c.value)}switch(y=r?gt(r):window,e){case`focusin`:(nr(y)||y.contentEditable===`true`)&&(Or=y,kr=r,Ar=null);break;case`focusout`:Ar=kr=Or=null;break;case`mousedown`:jr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:jr=!1,Mr(s,n,i);break;case`selectionchange`:if(Dr)break;case`keydown`:case`keyup`:Mr(s,n,i)}var b;if(Wn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Qn?Xn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(qn&&n.locale!==`ko`&&(Qn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Qn&&(b=mn()):(dn=i,fn=`value`in dn?dn.value:dn.textContent,Qn=!0)),y=Pd(r,x),0<y.length&&(x=new Mn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Zn(n),b!==null&&(x.data=b)))),(b=Kn?$n(e,n):er(e,n))&&(x=Pd(r,`onBeforeInput`),0<x.length&&(y=new Mn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),Sd(s,e,r,n,i)}Dd(s,t)})}function Nd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Pd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=sn(e,n),i!=null&&r.unshift(Nd(e,i,a)),i=sn(e,t),i!=null&&r.push(Nd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Fd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Id(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=sn(n,a),l!=null&&o.unshift(Nd(n,l,c))):i||(l=sn(n,a),l!=null&&o.push(Nd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Ld=/\r\n?/g,Rd=/\u0000|\uFFFD/g;function zd(e){return(typeof e==`string`?e:``+e).replace(Ld,`
10
+ `).replace(Rd,``)}function Bd(e,t){return t=zd(t),zd(e)===t}function Vd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Wt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Wt(e,``+r);break;case`className`:Ot(e,`class`,r);break;case`tabIndex`:Ot(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ot(e,n,r);break;case`style`:qt(e,r,o);break;case`data`:if(t!==`object`){Ot(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Zt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`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}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Vd(e,t,`name`,a.name,a,null),Vd(e,t,`formEncType`,a.formEncType,a,null),Vd(e,t,`formMethod`,a.formMethod,a,null),Vd(e,t,`formTarget`,a.formTarget,a,null)):(Vd(e,t,`encType`,a.encType,a,null),Vd(e,t,`method`,a.method,a,null),Vd(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Zt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Qt);break;case`onScroll`:r!=null&&Od(`scroll`,e);break;case`onScrollEnd`:r!=null&&Od(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Zt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Od(`beforetoggle`,e),Od(`toggle`,e),Dt(e,`popover`,r);break;case`xlinkActuate`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Dt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Yt.get(n)||n,Dt(e,n,r))}}function Hd(e,t,n,r,a,o){switch(n){case`style`:qt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Wt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Wt(e,``+r);break;case`onScroll`:r!=null&&Od(`scroll`,e);break;case`onScrollEnd`:r!=null&&Od(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Qt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!bt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[ot]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Dt(e,n,r)}}}function Ud(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Od(`error`,e),Od(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Vd(e,t,o,s,n,null)}}a&&Vd(e,t,`srcSet`,n.srcSet,n,null),r&&Vd(e,t,`src`,n.src,n,null);return;case`input`:Od(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Vd(e,t,r,d,n,null)}}zt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Od(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Vd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Vt(e,!!r,n,!0):Vt(e,!!r,t,!1);return;case`textarea`:for(s in Od(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Vd(e,t,s,c,n,null)}Ut(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Vd(e,t,l,r,n,null)}return;case`dialog`:Od(`beforetoggle`,e),Od(`toggle`,e),Od(`cancel`,e),Od(`close`,e);break;case`iframe`:case`object`:Od(`load`,e);break;case`video`:case`audio`:for(r=0;r<Td.length;r++)Od(Td[r],e);break;case`image`:Od(`error`,e),Od(`load`,e);break;case`details`:Od(`toggle`,e);break;case`embed`:case`source`:case`link`:Od(`error`,e),Od(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Vd(e,t,u,r,n,null)}return;default:if(Jt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Hd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Vd(e,t,c,r,n,null))}function Wd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Vd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Vd(e,t,p,m,r,f)}}Rt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Vd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Vd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Vt(e,!!n,n?[]:``,!1):Vt(e,!!n,t,!0)):Vt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Vd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Vd(e,t,s,a,r,o)}Ht(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Vd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Vd(e,t,l,p,r,m)}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 g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Vd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Vd(e,t,u,p,r,m)}return;default:if(Jt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Hd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Hd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Vd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Vd(e,t,f,p,r,m)}function Gd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Kd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Gd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Gd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var qd=null,Jd=null;function Yd(e){return e.nodeType===9?e:e.ownerDocument}function Xd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Zd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Qd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var $d=null;function ef(){var e=window.event;return e&&e.type===`popstate`?e!==$d&&($d=e,!0):($d=null,!1)}var tf=typeof setTimeout==`function`?setTimeout:void 0,nf=typeof clearTimeout==`function`?clearTimeout:void 0,rf=typeof Promise==`function`?Promise:void 0,af=typeof queueMicrotask==`function`?queueMicrotask:rf===void 0?tf:function(e){return rf.resolve(null).then(e).catch(of)};function of(e){setTimeout(function(){throw e})}function sf(e){return e===`head`}function cf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Hp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Sf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Sf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ft]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Sf(e.ownerDocument.body)}n=i}while(n);Hp(t)}function lf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function uf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:uf(n),pt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function df(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[ft])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=_f(e.nextSibling),e===null)break}return null}function ff(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=_f(e.nextSibling),e===null))return null;return e}function pf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=_f(e.nextSibling),e===null))return null;return e}function mf(e){return e.data===`$?`||e.data===`$~`}function hf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function gf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function _f(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var vf=null;function yf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return _f(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function bf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function xf(e,t,n){switch(t=Yd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Sf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);pt(e)}var Cf=new Map,wf=new Set;function Tf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ef=I.d;I.d={f:Df,r:Of,D:jf,C:Mf,L:Nf,m:Pf,X:If,S:Ff,M:Lf};function Df(){var e=Ef.f(),t=Ou();return e||t}function Of(e){var t=ht(e);t!==null&&t.tag===5&&t.type===`form`?Ds(t):Ef.r(e)}var kf=typeof document>`u`?null:document;function Af(e,t,n){var r=kf;if(r&&typeof t==`string`&&t){var i=Lt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),wf.has(i)||(wf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Ud(t,`link`,e),vt(t),r.head.appendChild(t)))}}function jf(e){Ef.D(e),Af(`dns-prefetch`,e,null)}function Mf(e,t){Ef.C(e,t),Af(`preconnect`,e,t)}function Nf(e,t,n){Ef.L(e,t,n);var r=kf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Lt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Lt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Lt(n.imageSizes)+`"]`)):i+=`[href="`+Lt(e)+`"]`;var a=i;switch(t){case`style`:a=zf(e);break;case`script`:a=Uf(e)}Cf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Cf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Bf(a))||t===`script`&&r.querySelector(Wf(a))||(t=r.createElement(`link`),Ud(t,`link`,e),vt(t),r.head.appendChild(t)))}}function Pf(e,t){Ef.m(e,t);var n=kf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Lt(r)+`"][href="`+Lt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Uf(e)}if(!Cf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),Cf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Wf(a)))return}r=n.createElement(`link`),Ud(r,`link`,e),vt(r),n.head.appendChild(r)}}}function Ff(e,t,n){Ef.S(e,t,n);var r=kf;if(r&&e){var i=_t(r).hoistableStyles,a=zf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Bf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Cf.get(a))&&qf(e,n);var c=o=r.createElement(`link`);vt(c),Ud(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Kf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function If(e,t){Ef.X(e,t);var n=kf;if(n&&e){var r=_t(n).hoistableScripts,i=Uf(e),a=r.get(i);a||(a=n.querySelector(Wf(i)),a||(e=f({src:e,async:!0},t),(t=Cf.get(i))&&Jf(e,t),a=n.createElement(`script`),vt(a),Ud(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Lf(e,t){Ef.M(e,t);var n=kf;if(n&&e){var r=_t(n).hoistableScripts,i=Uf(e),a=r.get(i);a||(a=n.querySelector(Wf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=Cf.get(i))&&Jf(e,t),a=n.createElement(`script`),vt(a),Ud(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Rf(e,t,n,r){var a=(a=se.current)?Tf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=zf(n.href),n=_t(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=zf(n.href);var o=_t(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Bf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Cf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Cf.set(e,n),o||Hf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Uf(n),n=_t(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function zf(e){return`href="`+Lt(e)+`"`}function Bf(e){return`link[rel="stylesheet"][`+e+`]`}function Vf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Hf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Ud(t,`link`,n),vt(t),e.head.appendChild(t))}function Uf(e){return`[src="`+Lt(e)+`"]`}function Wf(e){return`script[async]`+e}function Gf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Lt(n.href)+`"]`);if(r)return t.instance=r,vt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),vt(r),Ud(r,`style`,a),Kf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=zf(n.href);var o=e.querySelector(Bf(a));if(o)return t.state.loading|=4,t.instance=o,vt(o),o;r=Vf(n),(a=Cf.get(a))&&qf(r,a),o=(e.ownerDocument||e).createElement(`link`),vt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Ud(o,`link`,r),t.state.loading|=4,Kf(o,n.precedence,e),t.instance=o;case`script`:return o=Uf(n.src),(a=e.querySelector(Wf(o)))?(t.instance=a,vt(a),a):(r=n,(a=Cf.get(o))&&(r=f({},n),Jf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),vt(a),Ud(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Kf(r,n.precedence,e));return t.instance}function Kf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function qf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Jf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Yf=null;function Xf(e,t,n){if(Yf===null){var r=new Map,i=Yf=new Map;i.set(n,r)}else i=Yf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[ft]||a[at]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Zf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Qf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function $f(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function ep(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=zf(r.href),a=t.querySelector(Bf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=rp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,vt(a);return}a=t.ownerDocument||t,r=Vf(r),(i=Cf.get(i))&&qf(r,i),a=a.createElement(`link`),vt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Ud(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=rp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var tp=0;function np(e,t){return e.stylesheets&&e.count===0&&ap(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ap(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&tp===0&&(tp=62500*Kd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ap(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>tp?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function rp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ap(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ip=null;function ap(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ip=new Map,t.forEach(op,e),ip=null,rp.call(e))}function op(e,t){if(!(t.state.loading&4)){var n=ip.get(e);if(n)var r=n.get(null);else{n=new Map,ip.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=rp.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var sp={$$typeof:b,Provider:null,Consumer:null,_currentValue:te,_currentValue2:te,_threadCount:0};function cp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,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=z(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=z(0),this.hiddenUpdates=z(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function lp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new cp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=oi(3,null,null,t),e.current=a,a.stateNode=e,t=sa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},za(a),e}function up(e){return e?(e=ii,e):ii}function dp(e,t,n,r,i,a){i=up(i),r.context===null?r.context=i:r.pendingContext=i,r=Va(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ha(e,r,t),n!==null&&(Cu(n,e,t),Ua(n,e,t))}function fp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function pp(e,t){fp(e,t),(e=e.alternate)&&fp(e,t)}function mp(e){if(e.tag===13||e.tag===31){var t=ti(e,67108864);t!==null&&Cu(t,e,67108864),pp(e,67108864)}}function hp(e){if(e.tag===13||e.tag===31){var t=xu();t=et(t);var n=ti(e,t);n!==null&&Cu(n,e,t),pp(e,t)}}var gp=!0;function _p(e,t,n,r){var i=F.T;F.T=null;var a=I.p;try{I.p=2,yp(e,t,n,r)}finally{I.p=a,F.T=i}}function vp(e,t,n,r){var i=F.T;F.T=null;var a=I.p;try{I.p=8,yp(e,t,n,r)}finally{I.p=a,F.T=i}}function yp(e,t,n,r){if(gp){var i=bp(r);if(i===null)Md(e,t,r,xp,n),Mp(e,r);else if(Pp(i,e,t,n,r))r.stopPropagation();else if(Mp(e,r),t&4&&-1<jp.indexOf(e)){for(;i!==null;){var a=ht(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=We(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Le(o);s.entanglements[1]|=c,o&=~c}dd(a),!(Hl&6)&&(lu=Te()+500,fd(0,!1))}}break;case 31:case 13:s=ti(a,2),s!==null&&Cu(s,a,2),Ou(),pp(a,2)}if(a=bp(r),a===null&&Md(e,t,r,xp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Md(e,t,r,null,n)}}function bp(e){return e=en(e),Sp(e)}var xp=null;function Sp(e){if(xp=null,e=mt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xp=e,null}function Cp(e){switch(e){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(Ee()){case De:return 2;case Oe:return 8;case ke:case Ae:return 32;case je:return 268435456;default:return 32}default:return 32}}var wp=!1,Tp=null,Ep=null,Dp=null,Op=new Map,kp=new Map,Ap=[],jp=`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 Mp(e,t){switch(e){case`focusin`:case`focusout`:Tp=null;break;case`dragenter`:case`dragleave`:Ep=null;break;case`mouseover`:case`mouseout`:Dp=null;break;case`pointerover`:case`pointerout`:Op.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:kp.delete(t.pointerId)}}function Np(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=ht(t),t!==null&&mp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Pp(e,t,n,r,i){switch(t){case`focusin`:return Tp=Np(Tp,e,t,n,r,i),!0;case`dragenter`:return Ep=Np(Ep,e,t,n,r,i),!0;case`mouseover`:return Dp=Np(Dp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Op.set(a,Np(Op.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,kp.set(a,Np(kp.get(a)||null,e,t,n,r,i)),!0}return!1}function Fp(e){var t=mt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,rt(e.priority,function(){hp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,rt(e.priority,function(){hp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ip(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);$t=r,n.target.dispatchEvent(r),$t=null}else return t=ht(n),t!==null&&mp(t),e.blockedOn=n,!1;t.shift()}return!0}function Lp(e,t,n){Ip(e)&&n.delete(t)}function Rp(){wp=!1,Tp!==null&&Ip(Tp)&&(Tp=null),Ep!==null&&Ip(Ep)&&(Ep=null),Dp!==null&&Ip(Dp)&&(Dp=null),Op.forEach(Lp),kp.forEach(Lp)}function zp(e,n){e.blockedOn===n&&(e.blockedOn=null,wp||(wp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rp)))}var Bp=null;function Vp(e){Bp!==e&&(Bp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bp===e&&(Bp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Sp(r||n)===null)continue;break}var a=ht(n);a!==null&&(e.splice(t,3),t-=3,Ts(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Hp(e){function t(t){return zp(t,e)}Tp!==null&&zp(Tp,e),Ep!==null&&zp(Ep,e),Dp!==null&&zp(Dp,e),Op.forEach(t),kp.forEach(t);for(var n=0;n<Ap.length;n++){var r=Ap[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ap.length&&(n=Ap[0],n.blockedOn===null);)Fp(n),n.blockedOn===null&&Ap.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[ot]||null;if(typeof a==`function`)o||Vp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[ot]||null)s=o.formAction;else if(Sp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Vp(n)}}}function Up(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Wp(e){this._internalRoot=e}Gp.prototype.render=Wp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;dp(n,xu(),e,t,null,null)},Gp.prototype.unmount=Wp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dp(e.current,2,null,e,null,null),Ou(),t[st]=null}};function Gp(e){this._internalRoot=e}Gp.prototype.unstable_scheduleHydration=function(e){if(e){var t=nt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ap.length&&t!==0&&t<Ap[n].priority;n++);Ap.splice(n,0,e),n===0&&Fp(e)}};var Kp=n.version;if(Kp!==`19.2.8`)throw Error(i(527,Kp,`19.2.8`));I.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var qp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:F,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jp.isDisabled&&Jp.supportsFiber)try{Pe=Jp.inject(qp),Fe=Jp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Js,s=Ys,c=Xs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=lp(e,1,!1,null,null,n,r,null,o,s,c,Up),e[st]=t.current,Ad(e),new Wp(t)}})),k=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=O()})),A=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),ee=n(((e,t)=>{t.exports=A()})),j=t(C()),M=t(k()),N=ee();function P(e){var t=[...arguments].slice(1);throw Error(typeof e==`number`?`[MobX] minified error nr: `+e+(t.length?` `+t.map(String).join(`,`):``)+`. Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts`:`[MobX] `+e)}var F={};function I(){return typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:F}var te=Object.assign,ne=Object.getOwnPropertyDescriptor,L=Object.defineProperty,R=Object.prototype,re=[];Object.freeze(re);var ie={};Object.freeze(ie);var ae=typeof Proxy<`u`,oe=Object.toString();function se(){ae||P(`Proxy not available`)}function ce(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var le=function(){};function ue(e){return typeof e==`function`}function de(e){switch(typeof e){case`string`:case`symbol`:case`number`:return!0}return!1}function fe(e){return typeof e==`object`&&!!e}function pe(e){if(!fe(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n.toString()===oe}function me(e){var t=e?.constructor;return t?t.name===`GeneratorFunction`||t.displayName===`GeneratorFunction`:!1}function he(e,t,n){L(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function ge(e,t,n){L(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function _e(e,t){var n=`isMobX`+e;return t.prototype[n]=!0,function(e){return fe(e)&&e[n]===!0}}function ve(e){return e!=null&&Object.prototype.toString.call(e)===`[object Map]`}function ye(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t);return Object.getPrototypeOf(n)===null}function be(e){return e!=null&&Object.prototype.toString.call(e)===`[object Set]`}var xe=Object.getOwnPropertySymbols!==void 0;function Se(e){var t=Object.keys(e);if(!xe)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(t){return R.propertyIsEnumerable.call(e,t)})):t}var Ce=typeof Reflect<`u`&&Reflect.ownKeys?Reflect.ownKeys:xe?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function we(e){return e===null?null:typeof e==`object`?``+e:e}function Te(e,t){return R.hasOwnProperty.call(e,t)}var Ee=Object.getOwnPropertyDescriptors||function(e){var t={};return Ce(e).forEach(function(n){t[n]=ne(e,n)}),t};function De(e,t){return!!(e&t)}function Oe(e,t,n){return n?e|=t:e&=~t,e}function ke(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ae(e,t,n){if(Re())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&ze(i,n.prototype),i}function je(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,Ve(r.key),r)}}function Me(e,t,n){return t&&je(e.prototype,t),n&&je(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ne(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=He(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
11
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pe(){return Pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Pe.apply(null,arguments)}function Fe(e){return Fe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Fe(e)}function Ie(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ze(e,t)}function Le(e){try{return Function.toString.call(e).indexOf(`[native code]`)!==-1}catch{return typeof e==`function`}}function Re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Re=function(){return!!e})()}function ze(e,t){return ze=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ze(e,t)}function Be(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ve(e){var t=Be(e,`string`);return typeof t==`symbol`?t:t+``}function He(e,t){if(e){if(typeof e==`string`)return ke(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ke(e,t):void 0}}function Ue(e){var t=typeof Map==`function`?new Map:void 0;return Ue=function(e){if(e===null||!Le(e))return e;if(typeof e!=`function`)throw TypeError(`Super expression must either be null or a function`);if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return Ae(e,arguments,Fe(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ze(n,e)},Ue(e)}var We=Symbol(`mobx-stored-annotations`);function Ge(e){function t(t,n){if(Je(n))return e.decorate_20223_(t,n);Ke(t,n,e)}return Object.assign(t,e)}function Ke(e,t,n){Te(e,We)||he(e,We,Pe({},e[We])),ct(n)||(e[We][t]=n)}function qe(e){return Te(e,We)||he(e,We,Pe({},e[We])),e[We]}function Je(e){return typeof e==`object`&&typeof e.kind==`string`}var z=Symbol(`mobx administration`),Ye=function(){function e(e){e===void 0&&(e=`Atom`),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=bn.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.reportObserved=function(){return Wn(this)},t.reportChanged=function(){Hn(),Gn(this),Un()},t.toString=function(){return this.name_},Me(e,[{key:`isBeingObserved`,get:function(){return De(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=Oe(this.flags_,e.isBeingObservedMask_,t)}},{key:`isPendingUnobservation`,get:function(){return De(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=Oe(this.flags_,e.isPendingUnobservationMask_,t)}},{key:`diffValue`,get:function(){return+!!De(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=Oe(this.flags_,e.diffValueMask_,t===1)}}])}();Ye.isBeingObservedMask_=1,Ye.isPendingUnobservationMask_=2,Ye.diffValueMask_=4;var Xe=_e(`Atom`,Ye);function Ze(e,t,n){t===void 0&&(t=le),n===void 0&&(n=le);var r=new Ye(e);return t!==le&&wr(r,t),n!==le&&Tr(r,n),r}function Qe(e,t){return e===t}function $e(e,t){return la(e,t)}function et(e,t){return la(e,t,1)}function tt(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e==1/t:e!==e&&t!==t}var nt={identity:Qe,structural:$e,default:tt,shallow:et};function rt(e,t,n){return qr(e)?e:Array.isArray(e)?Qt.array(e,{name:n}):pe(e)?Qt.object(e,void 0,{name:n}):ve(e)?Qt.map(e,{name:n}):be(e)?Qt.set(e,{name:n}):typeof e==`function`&&!gr(e)&&!Vr(e)?me(e)?zr(e):mr(n,e):e}function it(e,t,n){if(e==null||Ki(e)||Oi(e)||Ni(e)||Ri(e))return e;if(Array.isArray(e))return Qt.array(e,{name:n,deep:!1});if(pe(e))return Qt.object(e,void 0,{name:n,deep:!1});if(ve(e))return Qt.map(e,{name:n,deep:!1});if(be(e))return Qt.set(e,{name:n,deep:!1})}function at(e){return e}function ot(e,t){return la(e,t)?t:e}var st=`override`;function ct(e){return e.annotationType_===st}function lt(e,t){return{annotationType_:e,options_:t,make_:ut,extend_:dt,decorate_20223_:ft}}function ut(e,t,n,r){var i;return(i=this.options_)!=null&&i.bound?this.extend_(e,t,n,!1)===null?0:1:r===e.target_?this.extend_(e,t,n,!1)===null?0:2:gr(n.value)?1:(L(r,t,mt(e,this,t,n,!1)),2)}function dt(e,t,n,r){var i=mt(e,this,t,n);return e.defineProperty_(t,i,r)}function ft(e,t){var n=t.kind,r=t.name,i=t.addInitializer,a=this,o=function(e){return ln(a.options_?.name??r.toString(),e,a.options_?.autoAction??!1)};if(n==`field`)return function(e){var t,n=e;return gr(n)||(n=o(n)),(t=a.options_)!=null&&t.bound&&(n=n.bind(this),n.isMobxAction=!0),n};if(n==`method`){var s;return gr(e)||(e=o(e)),(s=this.options_)!=null&&s.bound&&i(function(){var e=this,t=e[r].bind(e);t.isMobxAction=!0,e[r]=t}),e}P(`Cannot apply '`+a.annotationType_+`' to '`+String(r)+`' (kind: `+n+`):`+(`
12
+ '`+a.annotationType_+`' can only be used on properties with a function value.`))}function pt(e,t,n,r){t.annotationType_,r.value}function mt(e,t,n,r,i){var a,o;i===void 0&&(i=B.safeDescriptors),pt(e,t,n,r);var s=r.value;return(a=t.options_)!=null&&a.bound&&(s=s.bind(e.proxy_??e.target_)),{value:ln(t.options_?.name??n.toString(),s,t.options_?.autoAction??!1,(o=t.options_)!=null&&o.bound?e.proxy_??e.target_:void 0),configurable:!i||e.isPlainObject_,enumerable:!1,writable:!i}}function ht(e,t){return{annotationType_:e,options_:t,make_:gt,extend_:_t,decorate_20223_:vt}}function gt(e,t,n,r){var i;return r===e.target_?this.extend_(e,t,n,!1)===null?0:2:(i=this.options_)!=null&&i.bound&&(!Te(e.target_,t)||!Vr(e.target_[t]))&&this.extend_(e,t,n,!1)===null?0:Vr(n.value)?1:(L(r,t,bt(e,this,t,n,!1,!1)),2)}function _t(e,t,n,r){var i=bt(e,this,t,n,this.options_?.bound);return e.defineProperty_(t,i,r)}function vt(e,t){var n,r=t.name,i=t.addInitializer;return Vr(e)||(e=zr(e)),(n=this.options_)!=null&&n.bound&&i(function(){var e=this,t=e[r].bind(e);t.isMobXFlow=!0,e[r]=t}),e}function yt(e,t,n,r){t.annotationType_,r.value}function bt(e,t,n,r,i,a){a===void 0&&(a=B.safeDescriptors),yt(e,t,n,r);var o=r.value;return Vr(o)||(o=zr(o)),i&&(o=o.bind(e.proxy_??e.target_),o.isMobXFlow=!0),{value:o,configurable:!a||e.isPlainObject_,enumerable:!1,writable:!a}}function xt(e,t){return{annotationType_:e,options_:t,make_:St,extend_:Ct,decorate_20223_:wt}}function St(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function Ct(e,t,n,r){return Tt(e,this,t,n),e.defineComputedProperty_(t,Pe({},this.options_,{get:n.get,set:n.set}),r)}function wt(e,t){var n=this,r=t.name,i=t.addInitializer,a;function o(t,i){var a=Pe({},n.options_,{get:e,context:t});return a.name||=`ObservableObject.`+r.toString(),new vn(a)}return i(function(){var t=Ui(this)[z],n=this,i=t.values_.get(r);i instanceof vn&&i.derivation!==e&&t.values_.delete(r),(t.lazyComputedKeys_??=new Map).set(r,function(){return o(n,t)})}),function(){var t=this[z],n=t.values_.get(r);if(n instanceof vn&&n.derivation!==e){var i=a?.get(this);return i||(i=o(this,t),(a??=new WeakMap).set(this,i)),i.get()}return t.getObservablePropValue_(r)}}function Tt(e,t,n,r){t.annotationType_,r.get}function Et(e,t){return{annotationType_:e,options_:t,make_:Dt,extend_:Ot,decorate_20223_:kt}}function Dt(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function Ot(e,t,n,r){return At(e,this,t,n),e.defineObservableProperty_(t,n.value,this.options_?.enhancer??rt,r)}function kt(e,t){var n=this,r=t.kind,i=t.name;if(r!==`accessor`)return;function a(e,t){var r=Ui(e)[z];return(r.lazyObservableKeys_??=new Map).set(i,function(){return new gn(t,n.options_?.enhancer??rt,`ObservableObject.`+i.toString(),!1)}),r}return{get:function(){return(this[z]??a(this,e.get.call(this))).getObservablePropValue_(i)},set:function(e){return(this[z]??a(this,e)).setObservablePropValue_(i,e)},init:function(e){return a(this,e),e}}}function At(e,t,n,r){t.annotationType_}var jt=`true`,Mt=Nt();function Nt(e){return{annotationType_:jt,options_:e,make_:Pt,extend_:Ft,decorate_20223_:It}}function Pt(e,t,n,r){var i;if(n.get)return rn.make_(e,t,n,r);if(n.set){var a=gr(n.set)?n.set:ln(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:!B.safeDescriptors||e.isPlainObject_,set:a})===null?0:2:(L(r,t,{configurable:!0,set:a}),2)}if(r!==e.target_&&typeof n.value==`function`){var o;if(me(n.value)){var s;return((s=this.options_)!=null&&s.autoBind?zr.bound:zr).make_(e,t,n,r)}return((o=this.options_)!=null&&o.autoBind?mr.bound:mr).make_(e,t,n,r)}var c=this.options_?.deep===!1?Qt.ref:Qt;return typeof n.value==`function`&&(i=this.options_)!=null&&i.autoBind&&(n.value=n.value.bind(e.proxy_??e.target_)),c.make_(e,t,n,r)}function Ft(e,t,n,r){var i;return n.get?rn.extend_(e,t,n,r):n.set?e.defineProperty_(t,{configurable:!B.safeDescriptors||e.isPlainObject_,set:ln(t.toString(),n.set)},r):(typeof n.value==`function`&&(i=this.options_)!=null&&i.autoBind&&(n.value=n.value.bind(e.proxy_??e.target_)),(this.options_?.deep===!1?Qt.ref:Qt).extend_(e,t,n,r))}function It(e,t){P(`'`+this.annotationType_+`' cannot be used as a decorator`)}var Lt=`observable`,Rt=`observable.ref`,zt=`observable.shallow`,Bt=`observable.struct`,Vt={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Vt);function Ht(e){return e||Vt}var Ut=Et(Lt),Wt=Et(Rt,{enhancer:at}),Gt=Et(zt,{enhancer:it}),Kt=Et(Bt,{enhancer:ot}),qt=Ge(Ut);function Jt(e){return e.deep===!0?rt:e.deep===!1?at:Xt(e.defaultDecorator)}function Yt(e){return e?e.defaultDecorator??Nt(e):void 0}function Xt(e){return e?e.options_?.enhancer??rt:rt}function Zt(e,t,n){if(Je(t))return Ut.decorate_20223_(e,t);if(de(t)){Ke(e,t,Ut);return}return qr(e)?e:pe(e)?Qt.object(e,t,n):Array.isArray(e)?Qt.array(e,t):ve(e)?Qt.map(e,t):be(e)?Qt.set(e,t):typeof e==`object`&&e?e:Qt.box(e,t)}te(Zt,qt);var Qt=te(Zt,{box:function(e,t){var n=Ht(t);return new gn(e,Jt(n),n.name,!0,n.equals)},array:function(e,t){var n=Ht(t);return(B.useProxies===!1||n.proxy===!1?ra:xi)(e,Jt(n),n.name)},map:function(e,t){var n=Ht(t);return new Mi(e,Jt(n),n.name)},set:function(e,t){var n=Ht(t);return new Li(e,Jt(n),n.name)},object:function(e,t,n){return sa(function(){return jr(B.useProxies===!1||n?.proxy===!1?Ui({},n):ci({},n),e,t)})},ref:Ge(Wt),shallow:Ge(Gt),deep:qt,struct:Ge(Kt)}),$t=`computed`,en=`computed.struct`,tn=xt($t),nn=xt(en,{equals:nt.structural}),rn=function(e,t){if(Je(t))return tn.decorate_20223_(e,t);if(de(t))return Ke(e,t,tn);if(pe(e))return Ge(xt($t,e));var n=pe(t)?t:{};return n.get=e,n.name||=e.name||``,new vn(n)};Object.assign(rn,tn),rn.struct=Ge(nn);var an=0,on=1,sn=ne(function(){},`name`)?.configurable??!1,cn={value:`action`,configurable:!0,writable:!1,enumerable:!1};function ln(e,t,n,r){n===void 0&&(n=!1);function i(){return un(e,n,t,r||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},sn&&(cn.value=e,L(i,`name`,cn)),i}function un(e,t,n,r,i){var a=dn(e,t,r,i);try{return n.apply(r,i)}catch(e){throw a.error_=e,e}finally{fn(a)}}function dn(e,t,n,r){var i=!1,a=0,o=B.trackingDerivation,s=!t||!o;Hn();var c=B.allowStateChanges;s&&(kn(),c=mn(!0));var l=jn(!0),u={runAsAction_:s,prevDerivation_:o,prevAllowStateChanges_:c,prevAllowStateReads_:l,notifySpy_:i,startTime_:a,actionId_:on++,parentActionId_:an};return an=u.actionId_,u}function fn(e){an!==e.actionId_&&P(30),an=e.parentActionId_,e.error_!==void 0&&(B.suppressReactionErrors=!0),hn(e.prevAllowStateChanges_),Mn(e.prevAllowStateReads_),Un(),e.runAsAction_&&An(e.prevDerivation_),B.suppressReactionErrors=!1}function pn(e,t){var n=mn(e);try{return t()}finally{hn(n)}}function mn(e){var t=B.allowStateChanges;return B.allowStateChanges=e,t}function hn(e){B.allowStateChanges=e}var gn=function(e){function t(t,n,r,i,a){var o;return r===void 0&&(r=`ObservableValue`),i===void 0&&(i=!0),a===void 0&&(a=nt.default),o=e.call(this,r)||this,o.enhancer=void 0,o.name_=void 0,o.equals=void 0,o.hasUnreportedChange_=!1,o.interceptors_=void 0,o.changeListeners_=void 0,o.value_=void 0,o.dehancer=void 0,o.enhancer=n,o.name_=r,o.equals=a,o.value_=n(t,void 0,r),o}Ie(t,e);var n=t.prototype;return n.dehanceValue=function(e){return this.dehancer===void 0?e:this.dehancer(e)},n.set=function(e){this.value_,e=this.prepareNewValue_(e),e!==B.UNCHANGED&&this.setNewValue_(e)},n.prepareNewValue_=function(e){if(li(this)){var t=di(this,{object:this,type:_i,newValue:e});if(!t)return B.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?B.UNCHANGED:e},n.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),fi(this)&&mi(this,{type:_i,object:this,newValue:e,oldValue:t})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(e){return ui(this,e)},n.observe_=function(e,t){return t&&e({observableKind:`value`,debugObjectName:this.name_,object:this,type:_i,newValue:this.value_,oldValue:void 0}),pi(this,e)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+`[`+this.value_+`]`},n.valueOf=function(){return we(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Ye),_n=_e(`ObservableValue`,gn),vn=function(){function e(e){this.dependenciesState_=bn.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=bn.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Sn(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=xn.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,e.get||P(31),this.derivation=e.get,this.name_=e.name||`ComputedValue`,e.set&&(this.setter_=ln(`ComputedValue-setter`,e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?nt.structural:nt.default),this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){qn(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.get=function(){if(this.isComputing&&P(32,this.name_,this.derivation),B.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)wn(this)&&(this.warnAboutUntrackedRead_(),Hn(),this.value_=this.computeValue_(!1),Un());else if(Wn(this),wn(this)){var e=B.trackingContext;this.keepAlive_&&!e&&(B.trackingContext=this),this.trackAndCompute()&&Kn(this),B.trackingContext=e}var t=this.value_;if(Cn(t))throw t.cause;return t},t.set=function(e){if(this.setter_){this.isRunningSetter&&P(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter=!1}}else P(34,this.name_)},t.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===bn.NOT_TRACKING_,n=this.computeValue_(!0),r=t||Cn(e)||Cn(n)||!this.equals_(e,n);return r&&(this.value_=n),r},t.computeValue_=function(e){this.isComputing=!0;var t=mn(!1),n;if(e)n=Tn(this,this.derivation,this.scope_);else if(B.disableErrorBoundaries===!0)n=this.derivation.call(this.scope_);else try{n=this.derivation.call(this.scope_)}catch(e){n=new Sn(e)}return hn(t),this.isComputing=!1,n},t.suspend_=function(){this.keepAlive_||(Dn(this),this.value_=void 0)},t.observe_=function(e,t){var n=this,r=!0,i=void 0;return _r(function(){var a=n.get();if(!r||t){var o=kn();e({observableKind:`computed`,debugObjectName:n.name_,type:_i,object:n,newValue:a,oldValue:i}),An(o)}r=!1,i=a})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+`[`+this.derivation.toString()+`]`},t.valueOf=function(){return we(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},Me(e,[{key:`isComputing`,get:function(){return De(this.flags_,e.isComputingMask_)},set:function(t){this.flags_=Oe(this.flags_,e.isComputingMask_,t)}},{key:`isRunningSetter`,get:function(){return De(this.flags_,e.isRunningSetterMask_)},set:function(t){this.flags_=Oe(this.flags_,e.isRunningSetterMask_,t)}},{key:`isBeingObserved`,get:function(){return De(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=Oe(this.flags_,e.isBeingObservedMask_,t)}},{key:`isPendingUnobservation`,get:function(){return De(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=Oe(this.flags_,e.isPendingUnobservationMask_,t)}},{key:`diffValue`,get:function(){return+!!De(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=Oe(this.flags_,e.diffValueMask_,t===1)}}])}();vn.isComputingMask_=1,vn.isRunningSetterMask_=2,vn.isBeingObservedMask_=4,vn.isPendingUnobservationMask_=8,vn.diffValueMask_=16;var yn=_e(`ComputedValue`,vn),bn;(function(e){e[e.NOT_TRACKING_=-1]=`NOT_TRACKING_`,e[e.UP_TO_DATE_=0]=`UP_TO_DATE_`,e[e.POSSIBLY_STALE_=1]=`POSSIBLY_STALE_`,e[e.STALE_=2]=`STALE_`})(bn||={});var xn;(function(e){e[e.NONE=0]=`NONE`,e[e.LOG=1]=`LOG`,e[e.BREAK=2]=`BREAK`})(xn||={});var Sn=function(e){this.cause=void 0,this.cause=e};function Cn(e){return e instanceof Sn}function wn(e){switch(e.dependenciesState_){case bn.UP_TO_DATE_:return!1;case bn.NOT_TRACKING_:case bn.STALE_:return!0;case bn.POSSIBLY_STALE_:for(var t=jn(!0),n=kn(),r=e.observing_,i=r.length,a=0;a<i;a++){var o=r[a];if(yn(o)){if(B.disableErrorBoundaries)o.get();else try{o.get()}catch{return An(n),Mn(t),!0}if(e.dependenciesState_===bn.STALE_)return An(n),Mn(t),!0}}return Nn(e),An(n),Mn(t),!1}}function Tn(e,t,n){var r=jn(!0);Nn(e),e.newObserving_=Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++B.runId;var i=B.trackingDerivation;B.trackingDerivation=e,B.inBatch++;var a;if(B.disableErrorBoundaries===!0)a=t.call(n);else try{a=t.call(n)}catch(e){a=new Sn(e)}return B.inBatch--,B.trackingDerivation=i,En(e),Mn(r),a}function En(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=bn.UP_TO_DATE_,i=0,a=e.unboundDepsCount_,o=0;o<a;o++){var s=n[o];s.diffValue===0&&(s.diffValue=1,i!==o&&(n[i]=s),i++),s.dependenciesState_>r&&(r=s.dependenciesState_)}for(n.length=i,e.newObserving_=null,a=t.length;a--;){var c=t[a];c.diffValue===0&&Bn(c,e),c.diffValue=0}for(;i--;){var l=n[i];l.diffValue===1&&(l.diffValue=0,zn(l,e))}r!==bn.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function Dn(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Bn(t[n],e);e.dependenciesState_=bn.NOT_TRACKING_}function On(e){var t=kn();try{return e()}finally{An(t)}}function kn(){var e=B.trackingDerivation;return B.trackingDerivation=null,e}function An(e){B.trackingDerivation=e}function jn(e){var t=B.allowStateReads;return B.allowStateReads=e,t}function Mn(e){B.allowStateReads=e}function Nn(e){if(e.dependenciesState_!==bn.UP_TO_DATE_){e.dependenciesState_=bn.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=bn.UP_TO_DATE_}}var Pn=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},Fn=!0,In=!1,B=function(){var e=I();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Fn=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Pn().version&&(Fn=!1),Fn?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Pn):(setTimeout(function(){In||P(35)},1),new Pn)}();function Ln(){if((B.pendingReactions.length||B.inBatch||B.isRunningReactions)&&P(36),In=!0,Fn){var e=I();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),B=new Pn}}function Rn(){return B}function zn(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Bn(e,t){e.observers_.delete(t),e.observers_.size===0&&Vn(e)}function Vn(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,B.pendingUnobservations.push(e))}function Hn(){B.inBatch++}function Un(){if(--B.inBatch===0){Zn();for(var e=B.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof vn&&n.suspend_())}B.pendingUnobservations=[]}}function Wn(e){var t=B.trackingDerivation;return t===null?(e.observers_.size===0&&B.inBatch>0&&Vn(e),!1):(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&B.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved)}function Gn(e){e.lowestObserverState_!==bn.STALE_&&(e.lowestObserverState_=bn.STALE_,e.observers_.forEach(function(e){e.dependenciesState_===bn.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=bn.STALE_}))}function Kn(e){e.lowestObserverState_!==bn.STALE_&&(e.lowestObserverState_=bn.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===bn.POSSIBLY_STALE_?t.dependenciesState_=bn.STALE_:t.dependenciesState_===bn.UP_TO_DATE_&&(e.lowestObserverState_=bn.UP_TO_DATE_)}))}function qn(e){e.lowestObserverState_===bn.UP_TO_DATE_&&(e.lowestObserverState_=bn.POSSIBLY_STALE_,e.observers_.forEach(function(e){e.dependenciesState_===bn.UP_TO_DATE_&&(e.dependenciesState_=bn.POSSIBLY_STALE_,e.onBecomeStale_())}))}var Jn=function(){function e(e,t,n,r){e===void 0&&(e=`Reaction`),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=bn.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=xn.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,B.pendingReactions.push(this),Zn())},t.runReaction_=function(){if(!this.isDisposed){Hn(),this.isScheduled=!1;var e=B.trackingContext;if(B.trackingContext=this,wn(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}B.trackingContext=e,Un()}},t.track=function(e){if(!this.isDisposed){Hn(),this.isRunning=!0;var t=B.trackingContext;B.trackingContext=this;var n=Tn(this,e,void 0);B.trackingContext=t,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Dn(this),Cn(n)&&this.reportExceptionInDerivation_(n.cause),Un()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_){this.errorHandler_(e,this);return}if(B.disableErrorBoundaries)throw e;var n=`[mobx] uncaught error in '`+this+`'`;B.suppressReactionErrors||console.error(n,e),B.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Hn(),Dn(this),Un()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),e==null||e.removeEventListener==null||e.removeEventListener(`abort`,n)};return e==null||e.addEventListener==null||e.addEventListener(`abort`,n),n[z]=this,`dispose`in Symbol&&typeof Symbol.dispose==`symbol`&&(n[Symbol.dispose]=n),n},t.toString=function(){return`Reaction[`+this.name_+`]`},t.trace=function(e){e===void 0&&(e=!1)},Me(e,[{key:`isDisposed`,get:function(){return De(this.flags_,e.isDisposedMask_)},set:function(t){this.flags_=Oe(this.flags_,e.isDisposedMask_,t)}},{key:`isScheduled`,get:function(){return De(this.flags_,e.isScheduledMask_)},set:function(t){this.flags_=Oe(this.flags_,e.isScheduledMask_,t)}},{key:`isTrackPending`,get:function(){return De(this.flags_,e.isTrackPendingMask_)},set:function(t){this.flags_=Oe(this.flags_,e.isTrackPendingMask_,t)}},{key:`isRunning`,get:function(){return De(this.flags_,e.isRunningMask_)},set:function(t){this.flags_=Oe(this.flags_,e.isRunningMask_,t)}},{key:`diffValue`,get:function(){return+!!De(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=Oe(this.flags_,e.diffValueMask_,t===1)}}])}();Jn.isDisposedMask_=1,Jn.isScheduledMask_=2,Jn.isTrackPendingMask_=4,Jn.isRunningMask_=8,Jn.diffValueMask_=16;var Yn=100,Xn=function(e){return e()};function Zn(){B.inBatch>0||B.isRunningReactions||Xn(Qn)}function Qn(){B.isRunningReactions=!0;for(var e=B.pendingReactions,t=0;e.length>0;){++t===Yn&&(console.error(`[mobx] cycle in reaction: `+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r<i;r++)n[r].runReaction_()}B.isRunningReactions=!1}var $n=_e(`Reaction`,Jn);function er(e){var t=Xn;Xn=function(n){return e(function(){return t(n)})}}function tr(){return!1}function nr(e){return console.warn(`[mobx.spy] Is a no-op in production builds`),function(){}}var rr=`action`,ir=`action.bound`,ar=`autoAction`,or=`autoAction.bound`,sr=`<unnamed action>`,cr=lt(rr),lr=lt(ir,{bound:!0}),ur=lt(ar,{autoAction:!0}),dr=lt(or,{autoAction:!0,bound:!0});function fr(e){return function(t,n){if(ue(t))return ln(t.name||sr,t,e);if(ue(n))return ln(t,n,e);if(Je(n))return(e?ur:cr).decorate_20223_(t,n);if(de(n))return Ke(t,n,e?ur:cr);if(de(t))return Ge(lt(e?ar:rr,{name:t,autoAction:e}))}}var pr=fr(!1);Object.assign(pr,cr);var mr=fr(!0);Object.assign(mr,ur),pr.bound=Ge(lr),mr.bound=Ge(dr);function hr(e){return un(e.name||sr,!1,e,this,void 0)}function gr(e){return ue(e)&&e.isMobxAction===!0}function _r(e,t){var n;t===void 0&&(t=ie);var r=t?.name??`Autorun`,i=!t.scheduler&&!t.delay,a;if(i)a=new Jn(r,function(){this.track(c)},t.onError,t.requiresObservable);else{var o=yr(t),s=!1;a=new Jn(r,function(){s||(s=!0,o(function(){s=!1,a.isDisposed||a.track(c)}))},t.onError,t.requiresObservable)}function c(){e(a)}return(n=t)!=null&&(n=n.signal)!=null&&n.aborted||a.schedule_(),a.getDisposer_(t?.signal)}var vr=function(e){return e()};function yr(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:vr}function br(e,t,n){var r;n===void 0&&(n=ie);var i=n.name??`Reaction`,a=pr(i,n.onError?xr(n.onError,t):t),o=!n.scheduler&&!n.delay,s=yr(n),c=!0,l=!1,u,d=n.compareStructural?nt.structural:n.equals||nt.default,f=new Jn(i,function(){c||o?p():l||(l=!0,s(p))},n.onError,n.requiresObservable);function p(){if(l=!1,!f.isDisposed){var t=!1,r=u;f.track(function(){var n=pn(!1,function(){return e(f)});t=c||!d(u,n),u=n}),(c&&n.fireImmediately||!c&&t)&&a(u,r,f),c=!1}}return(r=n)!=null&&(r=r.signal)!=null&&r.aborted||f.schedule_(),f.getDisposer_(n?.signal)}function xr(e,t){return function(){try{return t.apply(this,arguments)}catch(t){e.call(this,t)}}}var Sr=`onBO`,Cr=`onBUO`;function wr(e,t,n){return Er(Sr,e,t,n)}function Tr(e,t,n){return Er(Cr,e,t,n)}function Er(e,t,n,r){var i=typeof r==`function`?ia(t,n):ia(t),a=ue(r)?r:n,o=e+`L`;return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),e.size===0&&delete i[o])}}var Dr=`never`,Or=`always`,kr=`observed`;function Ar(e){e.isolateGlobalState===!0&&Ln();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(B.useProxies=t===Or||t!==Dr&&typeof Proxy<`u`),t===`ifavailable`&&(B.verifyProxies=!0),n!==void 0){var r=n===Or?Or:n===kr;B.enforceActions=r,B.allowStateChanges=r!==!0&&r!==Or}[`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`disableErrorBoundaries`,`safeDescriptors`].forEach(function(t){t in e&&(B[t]=!!e[t])}),B.allowStateReads=!B.observableRequiresReaction,e.reactionScheduler&&er(e.reactionScheduler)}function jr(e,t,n,r){var i=Ee(t);return sa(function(){var t=Ui(e,r)[z];Ce(i).forEach(function(e){t.extend_(e,i[e],n&&e in n?n[e]:!0)})}),e}function Mr(e,t){return Nr(ia(e,t))}function Nr(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=Pr(e.observing_).map(Nr)),t}function Pr(e){return Array.from(new Set(e))}var Fr=0,Ir=function(e){function t(){var n=e.call(this,`FLOW_CANCELLED`)||this;return Object.setPrototypeOf(n,(this instanceof t?this.constructor:void 0).prototype),n.name=`FlowCancellationError`,n}Ie(t,e);var n=t.prototype;return n.toString=function(){return`Error: `+this.message},t}(Ue(Error)),Lr=ht(`flow`),Rr=ht(`flow.bound`,{bound:!0}),zr=Object.assign(function(e,t){if(Je(t))return Lr.decorate_20223_(e,t);if(de(t))return Ke(e,t,Lr);var n=e,r=n.name||`<unnamed flow>`,i=function(){var e=this,t=arguments,i=++Fr,a=pr(r+` - runid: `+i+` - init`,n).apply(e,t),o,s=void 0,c=new Promise(function(e,t){var n=0;o=t;function c(e){s=void 0;var o;try{o=pr(r+` - runid: `+i+` - yield `+n++,a.next).call(a,e)}catch(e){return t(e)}u(o)}function l(e){s=void 0;var o;try{o=pr(r+` - runid: `+i+` - yield `+n++,a.throw).call(a,e)}catch(e){return t(e)}u(o)}function u(n){if(ue(n?.then)){n.then(u,t);return}return n.done?e(n.value):(s=Promise.resolve(n.value),s.then(c,l))}c(void 0)});return c.cancel=pr(r+` - runid: `+i+` - cancel`,function(){try{s&&Br(s);var e=a.return(void 0),t=Promise.resolve(e.value);t.then(le,le),Br(t),o(new Ir)}catch(e){o(e)}}),c};return i.isMobXFlow=!0,i},Lr);zr.bound=Ge(Rr);function Br(e){ue(e.cancel)&&e.cancel()}function Vr(e){return e?.isMobXFlow===!0}function Hr(e,t,n){var r;return Ni(e)||Oi(e)||_n(e)?r=aa(e):Ki(e)&&(r=aa(e,t)),r.dehancer=typeof t==`function`?t:n,function(){r.dehancer=void 0}}function Ur(e,t,n){return ue(n)?Gr(e,t,n):Wr(e,t)}function Wr(e,t){return aa(e).intercept_(t)}function Gr(e,t,n){return aa(e,t).intercept_(n)}function Kr(e,t){if(!e)return!1;if(t!==void 0){if(Ki(e)){var n,r,i=e[z];return i.values_.has(t)||!!((n=i.lazyComputedKeys_)!=null&&n.has(t))||!!((r=i.lazyObservableKeys_)!=null&&r.has(t))}return!1}return Ki(e)||!!e[z]||Xe(e)||$n(e)||yn(e)}function qr(e){return Kr(e)}function Jr(e){if(Ki(e))return e[z].keys_();if(Ni(e)||Ri(e))return Array.from(e.keys());if(Oi(e))return e.map(function(e,t){return t});P(5)}function Yr(e){if(Ki(e))return Jr(e).map(function(t){return e[t]});if(Ni(e))return Jr(e).map(function(t){return e.get(t)});if(Ri(e))return Array.from(e.values());if(Oi(e))return e.slice();P(6)}function Xr(e){if(Ki(e))return Jr(e).map(function(t){return[t,e[t]]});if(Ni(e))return Jr(e).map(function(t){return[t,e.get(t)]});if(Ri(e))return Array.from(e.entries());if(Oi(e))return e.map(function(e,t){return[t,e]});P(7)}function Zr(e,t,n){if(arguments.length===2&&!Ri(e)){Hn();var r=t;try{for(var i in r)Zr(e,i,r[i])}finally{Un()}return}Ki(e)?e[z].set_(t,n):Ni(e)?e.set(t,n):Ri(e)?e.add(t):Oi(e)?(typeof t!=`number`&&(t=parseInt(t,10)),t<0&&P(`Invalid index: '`+t+`'`),Hn(),t>=e.length&&(e.length=t+1),e[t]=n,Un()):P(8)}function Qr(e,t,n){if(Ki(e))return e[z].defineProperty_(t,n);P(39)}function $r(e,t,n,r){return ue(n)?ti(e,t,n,r):ei(e,t,n)}function ei(e,t,n){return aa(e).observe_(t,n)}function ti(e,t,n,r){return aa(e,t).observe_(n,r)}function ni(e,t){t===void 0&&(t=void 0),Hn();try{return e.apply(t)}finally{Un()}}function ri(e,t,n){return arguments.length===1||t&&typeof t==`object`?ai(e,t):ii(e,t,n||{})}function ii(e,t,n){var r;if(typeof n.timeout==`number`){var i=Error(`WHEN_TIMEOUT`);r=setTimeout(function(){if(!o[z].isDisposed){if(o(),n.onError)n.onError(i);else throw i}},n.timeout)}n.name=`When`;var a=ln(`When-effect`,t),o=_r(function(t){pn(!1,e)&&(t.dispose(),r&&clearTimeout(r),a())},n);return o}function ai(e,t){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)return Object.assign(Promise.reject(Error(`WHEN_ABORTED`)),{cancel:function(){return null}});var r,i,a=new Promise(function(n,a){var o,s=ii(e,n,Pe({},t,{onError:a}));r=function(){s(),a(Error(`WHEN_CANCELLED`))},i=function(){s(),a(Error(`WHEN_ABORTED`))},t==null||(o=t.signal)==null||o.addEventListener==null||o.addEventListener(`abort`,i)}).finally(function(){var e;return t==null||(e=t.signal)==null||e.removeEventListener==null?void 0:e.removeEventListener(`abort`,i)});return a.cancel=r,a}function oi(e){return e[z]}var si={has:function(e,t){return oi(e).has_(t)},get:function(e,t){return oi(e).get_(t)},set:function(e,t,n){return de(t)?oi(e).set_(t,n,!0)??!0:!1},deleteProperty:function(e,t){return de(t)?oi(e).delete_(t,!0)??!0:!1},defineProperty:function(e,t,n){return oi(e).defineProperty_(t,n)??!0},ownKeys:function(e){return oi(e).ownKeys_()},preventExtensions:function(e){P(13)}};function ci(e,t){var n;return se(),e=Ui(e,t),(n=e[z]).proxy_??(n.proxy_=new Proxy(e,si))}function li(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function ui(e,t){var n=e.interceptors_||=[];return n.push(t),ce(function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function di(e,t){var n=kn();try{for(var r=[].concat(e.interceptors_||[]),i=0,a=r.length;i<a&&(t=r[i](t),t&&!t.type&&P(14),t);i++);return t}finally{An(n)}}function fi(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function pi(e,t){var n=e.changeListeners_||=[];return n.push(t),ce(function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function mi(e,t){var n=kn(),r=e.changeListeners_;if(r){r=r.slice();for(var i=0,a=r.length;i<a;i++)r[i](t);An(n)}}function hi(e,t,n){return sa(function(){var r=Ui(e,n)[z];t??=qe(e),Ce(t).forEach(function(e){return r.make_(e,t[e])})}),e}var gi=`splice`,_i=`update`,vi=1e4,yi={get:function(e,t){var n=e[z];return t===z?n:t===`length`?n.getArrayLength_():typeof t==`string`&&!isNaN(t)?n.get_(parseInt(t)):Te(Si,t)?Si[t]:e[t]},set:function(e,t,n){var r=e[z];return t===`length`&&r.setArrayLength_(n),typeof t==`symbol`||isNaN(t)?e[t]=n:r.set_(parseInt(t),n),!0},preventExtensions:function(){P(15)}},bi=function(){function e(e,t,n,r){e===void 0&&(e=`ObservableArray`),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=n,this.legacyMode_=r,this.atom_=new Ye(e),this.enhancer_=function(e,n){return t(e,n,`ObservableArray[..]`)}}var t=e.prototype;return t.dehanceValue_=function(e){return this.dehancer===void 0?e:this.dehancer(e)},t.dehanceValues_=function(e){return this.dehancer!==void 0&&e.length>0?e.map(this.dehancer):e},t.intercept_=function(e){return ui(this,e)},t.observe_=function(e,t){return t===void 0&&(t=!1),t&&e({observableKind:`array`,object:this.proxy_,debugObjectName:this.atom_.name_,type:`splice`,index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),pi(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){(typeof e!=`number`||isNaN(e)||e<0)&&P(`Out of range: `+e);var t=this.values_.length;if(e!==t){if(e>t){for(var n=Array(e-t),r=0;r<e-t;r++)n[r]=void 0;this.spliceWithArray_(t,0,n)}else this.spliceWithArray_(e,t-e)}},t.updateArrayLength_=function(e,t){e!==this.lastKnownLength_&&P(16),this.lastKnownLength_+=t,this.legacyMode_&&t>0&&na(e+t+1)},t.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(e===void 0?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=arguments.length===1?i-e:t==null?0:Math.max(0,Math.min(t,i-e)),n===void 0&&(n=re),li(this)){var a=di(this,{object:this.proxy_,type:gi,index:e,removedCount:t,added:n});if(!a)return re;t=a.removedCount,n=a.added}if(n=n.length===0?n:n.map(function(e){return r.enhancer_(e,void 0)}),this.legacyMode_){var o=n.length-t;this.updateArrayLength_(i,o)}var s=this.spliceItemsIntoValues_(e,t,n);return(t!==0||n.length!==0)&&this.notifyArraySplice_(e,n,s),this.dehanceValues_(s)},t.spliceItemsIntoValues_=function(e,t,n){if(n.length<vi){var r;return(r=this.values_).splice.apply(r,[e,t].concat(n))}var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var o=0;o<n.length;o++)this.values_[e+o]=n[o];for(var s=0;s<a.length;s++)this.values_[e+n.length+s]=a[s];return i},t.notifyArrayChildUpdate_=function(e,t,n){var r=!this.owned_&&tr(),i=fi(this),a=i||r?{observableKind:`array`,object:this.proxy_,type:_i,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;this.atom_.reportChanged(),i&&mi(this,a)},t.notifyArraySplice_=function(e,t,n){var r=!this.owned_&&tr(),i=fi(this),a=i||r?{observableKind:`array`,object:this.proxy_,debugObjectName:this.atom_.name_,type:gi,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;this.atom_.reportChanged(),i&&mi(this,a)},t.get_=function(e){if(this.legacyMode_&&e>=this.values_.length){console.warn(`[mobx] Out of bounds read: `+e);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e])},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&P(17,e,n.length),e<n.length){this.atom_;var r=n[e];if(li(this)){var i=di(this,{type:_i,object:this.proxy_,index:e,newValue:t});if(!i)return;t=i.newValue}t=this.enhancer_(t,r),t!==r&&(n[e]=t,this.notifyArrayChildUpdate_(e,t,r))}else{for(var a=Array(e+1-n.length),o=0;o<a.length-1;o++)a[o]=void 0;a[a.length-1]=t,this.spliceWithArray_(n.length,0,a)}},e}();function xi(e,t,n,r){return n===void 0&&(n=`ObservableArray`),r===void 0&&(r=!1),se(),sa(function(){var i=new bi(n,t,r,!1);ge(i.values_,z,i);var a=new Proxy(i.values_,yi);return i.proxy_=a,e&&e.length&&i.spliceWithArray_(0,0,e),a})}var Si={clear:function(){return this.splice(0)},replace:function(e){var t=this[z];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){var n=[...arguments].slice(2),r=this[z];switch(arguments.length){case 0:return[];case 1:return r.spliceWithArray_(e);case 2:return r.spliceWithArray_(e,t)}return r.spliceWithArray_(e,t,n)},spliceWithArray:function(e,t,n){return this[z].spliceWithArray_(e,t,n)},push:function(){var e=this[z],t=[...arguments];return e.spliceWithArray_(e.values_.length,0,t),e.values_.length},pop:function(){return this.splice(Math.max(this[z].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){var e=this[z],t=[...arguments];return e.spliceWithArray_(0,0,t),e.values_.length},reverse:function(){return B.trackingDerivation&&P(37,`reverse`),this.replace(this.slice().reverse()),this},sort:function(){B.trackingDerivation&&P(37,`sort`);var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[z],n=t.dehanceValues_(t.values_).indexOf(e);return n>-1&&(this.splice(n,1),!0)}};Ci(`at`,wi),Ci(`concat`,wi),Ci(`flat`,wi),Ci(`includes`,wi),Ci(`indexOf`,wi),Ci(`join`,wi),Ci(`lastIndexOf`,wi),Ci(`slice`,wi),Ci(`toString`,wi),Ci(`toLocaleString`,wi),Ci(`toSorted`,wi),Ci(`toSpliced`,wi),Ci(`with`,wi),Ci(`every`,Ti),Ci(`filter`,Ti),Ci(`find`,Ti),Ci(`findIndex`,Ti),Ci(`findLast`,Ti),Ci(`findLastIndex`,Ti),Ci(`flatMap`,Ti),Ci(`forEach`,Ti),Ci(`map`,Ti),Ci(`some`,Ti),Ci(`toReversed`,Ti),Ci(`reduce`,Ei),Ci(`reduceRight`,Ei);function Ci(e,t){typeof Array.prototype[e]==`function`&&(Si[e]=t(e))}function wi(e){return function(){var t=this[z];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Ti(e){return function(t,n){var r=this,i=this[z];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e](function(e,i){return t.call(n,e,i,r)})}}function Ei(e){return function(){var t=this,n=this[z];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}var Di=_e(`ObservableArrayAdministration`,bi);function Oi(e){return fe(e)&&Di(e[z])}var ki={},Ai=`add`,ji=`delete`,Mi=function(){function e(e,t,n){var r=this;t===void 0&&(t=rt),n===void 0&&(n=`ObservableMap`),this.enhancer_=void 0,this.name_=void 0,this[z]=ki,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,ue(Map)||P(18),sa(function(){r.keysAtom_=Ze(`ObservableMap.keys()`),r.data_=new Map,r.hasMap_=new Map,e&&r.merge(e)})}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!B.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new gn(this.has_(e),at,`ObservableMap.key?`,!1);this.hasMap_.set(e,r),Tr(r,function(){return t.hasMap_.delete(e)})}return n.get()},t.set=function(e,t){var n=this.has_(e);if(li(this)){var r=di(this,{type:n?_i:Ai,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,li(this)&&!di(this,{type:ji,object:this,name:e}))return!1;if(this.has_(e)){var n=tr(),r=fi(this),i=r||n?{observableKind:`map`,debugObjectName:this.name_,type:ji,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return ni(function(){var n;t.keysAtom_.reportChanged(),(n=t.hasMap_.get(e))==null||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)}),r&&mi(this,i),!0}return!1},t.updateValue_=function(e,t){var n=this.data_.get(e);if(t=n.prepareNewValue_(t),t!==B.UNCHANGED){var r=tr(),i=fi(this),a=i||r?{observableKind:`map`,debugObjectName:this.name_,type:_i,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),i&&mi(this,a)}},t.addValue_=function(e,t){var n=this;this.keysAtom_,ni(function(){var r,i=new gn(t,n.enhancer_,`ObservableMap.key`,!1);n.data_.set(e,i),t=i.value_,(r=n.hasMap_.get(e))==null||r.setNewValue_(!0),n.keysAtom_.reportChanged()});var r=tr(),i=fi(this),a=i||r?{observableKind:`map`,debugObjectName:this.name_,type:Ai,object:this,name:e,newValue:t}:null;i&&mi(this,a)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.getOrInsert=function(e,t){return this.has(e)||this.set(e,t),this.get(e)},t.getOrInsertComputed=function(e,t){return this.has(e)||this.set(e,t(e)),this.get(e)},t.dehanceValue_=function(e){return this.dehancer===void 0?e:this.dehancer(e)},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return Pi({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return Pi({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(e,t){for(var n=Ne(this),r;!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Ni(e)&&(e=new Map(e)),ni(function(){pe(e)?Se(e).forEach(function(n){return t.set(n,e[n])}):Array.isArray(e)?e.forEach(function(e){var n=e[0],r=e[1];return t.set(n,r)}):ve(e)?(ye(e)||P(19,e),e.forEach(function(e,n){return t.set(n,e)})):e!=null&&P(20,e)}),this},t.clear=function(){var e=this;ni(function(){On(function(){for(var t=Ne(e.keys()),n;!(n=t()).done;){var r=n.value;e.delete(r)}})})},t.replace=function(e){var t=this;return ni(function(){for(var n=Fi(e),r=new Map,i=!1,a=Ne(t.data_.keys()),o;!(o=a()).done;){var s=o.value;if(!n.has(s)){if(t.delete(s))i=!0;else{var c=t.data_.get(s);r.set(s,c)}}}for(var l=Ne(n.entries()),u;!(u=l()).done;){var d=u.value,f=d[0],p=d[1],m=t.data_.has(f);if(t.set(f,p),t.data_.has(f)){var h=t.data_.get(f);r.set(f,h),m||(i=!0)}}if(!i){if(t.data_.size!==r.size)t.keysAtom_.reportChanged();else for(var g=t.data_.keys(),_=r.keys(),v=g.next(),y=_.next();!v.done;){if(v.value!==y.value){t.keysAtom_.reportChanged();break}v=g.next(),y=_.next()}}t.data_=r}),this},t.toString=function(){return`[object ObservableMap]`},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return pi(this,e)},t.intercept_=function(e){return ui(this,e)},Me(e,[{key:`size`,get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return`Map`}}])}(),Ni=_e(`ObservableMap`,Mi);function Pi(e){return e[Symbol.toStringTag]=`MapIterator`,pa(e)}function Fi(e){if(ve(e)||Ni(e))return e;if(Array.isArray(e))return new Map(e);if(pe(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return P(21,e)}var Ii={},Li=function(){function e(e,t,n){var r=this;t===void 0&&(t=rt),n===void 0&&(n=`ObservableSet`),this.name_=void 0,this[z]=Ii,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,ue(Set)||P(22),this.enhancer_=function(e,r){return t(e,r,n)},sa(function(){r.atom_=Ze(r.name_),e&&r.replace(e)})}var t=e.prototype;return t.dehanceValue_=function(e){return this.dehancer===void 0?e:this.dehancer(e)},t.clear=function(){var e=this;ni(function(){On(function(){for(var t=Ne(e.data_.values()),n;!(n=t()).done;){var r=n.value;e.delete(r)}})})},t.forEach=function(e,t){for(var n=Ne(this),r;!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,li(this)){var n=di(this,{type:Ai,object:this,newValue:e});if(!n)return this;e=n.newValue}if(!this.has(e)){ni(function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()});var r=fi(this),i=r?{observableKind:`set`,debugObjectName:this.name_,type:Ai,object:this,newValue:e}:null;r&&mi(this,i)}return this},t.delete=function(e){var t=this;if(li(this)&&!di(this,{type:ji,object:this,oldValue:e}))return!1;if(this.has(e)){var n=fi(this),r=n?{observableKind:`set`,debugObjectName:this.name_,type:ji,object:this,oldValue:e}:null;return ni(function(){t.atom_.reportChanged(),t.data_.delete(e)}),n&&mi(this,r),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=this.values();return zi({next:function(){var t=e.next(),n=t.value,r=t.done;return r?{value:void 0,done:r}:{value:[n,n],done:r}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var e=this,t=this.data_.values();return zi({next:function(){var n=t.next(),r=n.value,i=n.done;return i?{value:void 0,done:i}:{value:e.dehanceValue_(r),done:i}}})},t.intersection=function(e){return be(e)&&!Ri(e)?e.intersection(this):new Set(this).intersection(e)},t.union=function(e){return be(e)&&!Ri(e)?e.union(this):new Set(this).union(e)},t.difference=function(e){return new Set(this).difference(e)},t.symmetricDifference=function(e){return be(e)&&!Ri(e)?e.symmetricDifference(this):new Set(this).symmetricDifference(e)},t.isSubsetOf=function(e){return new Set(this).isSubsetOf(e)},t.isSupersetOf=function(e){return new Set(this).isSupersetOf(e)},t.isDisjointFrom=function(e){return be(e)&&!Ri(e)?e.isDisjointFrom(this):new Set(this).isDisjointFrom(e)},t.replace=function(e){var t=this;return Ri(e)&&(e=new Set(e)),ni(function(){Array.isArray(e)||be(e)?(t.clear(),e.forEach(function(e){return t.add(e)})):e!=null&&P(`Cannot initialize set from `+e)}),this},t.observe_=function(e,t){return pi(this,e)},t.intercept_=function(e){return ui(this,e)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return`[object ObservableSet]`},t[Symbol.iterator]=function(){return this.values()},Me(e,[{key:`size`,get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return`Set`}}])}(),Ri=_e(`ObservableSet`,Li);function zi(e){return e[Symbol.toStringTag]=`SetIterator`,pa(e)}var Bi=Object.create(null),Vi=`remove`,Hi=function(){function e(e,t,n,r){t===void 0&&(t=new Map),r===void 0&&(r=Mt),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.lazyComputedKeys_=void 0,this.lazyObservableKeys_=void 0,this.target_=e,this.values_=t,this.name_=n,this.defaultAnnotation_=r,this.keysAtom_=new Ye(`ObservableObject.keys`),this.isPlainObject_=pe(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(e){return(this.values_.get(e)??this.materializeLazyComputed_(e)??this.materializeLazyObservable_(e)).get()},t.materializeLazyComputed_=function(e){var t=this.lazyComputedKeys_?.get(e);if(t){this.lazyComputedKeys_.delete(e),this.lazyComputedKeys_.size===0&&(this.lazyComputedKeys_=void 0);var n=t();return this.values_.set(e,n),n}},t.materializeLazyObservable_=function(e){var t=this.lazyObservableKeys_?.get(e);if(t){this.lazyObservableKeys_.delete(e),this.lazyObservableKeys_.size===0&&(this.lazyObservableKeys_=void 0);var n=t();return this.values_.set(e,n),n}},t.setObservablePropValue_=function(e,t){var n=this.values_.get(e)??this.materializeLazyComputed_(e)??this.materializeLazyObservable_(e);if(n instanceof vn)return n.set(t),!0;if(li(this)){var r=di(this,{type:_i,object:this.proxy_||this.target_,name:e,newValue:t});if(!r)return null;t=r.newValue}if(t=n.prepareNewValue_(t),t!==B.UNCHANGED){var i=fi(this),a=i?{type:_i,observableKind:`object`,debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),i&&mi(this,a)}return!0},t.get_=function(e){return B.trackingDerivation&&!Te(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,n){return n===void 0&&(n=!1),Te(this.target_,e)?this.values_.has(e)?this.setObservablePropValue_(e,t):n?Reflect.set(this.target_,e,t):(this.target_[e]=t,!0):this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,n)},t.has_=function(e){if(!B.trackingDerivation)return e in this.target_;this.pendingKeys_||=new Map;var t=this.pendingKeys_.get(e);return t||(t=new gn(e in this.target_,at,`ObservableObject.key?`,!1),this.pendingKeys_.set(e,t)),t.get()},t.make_=function(e,t){if(t===!0&&(t=this.defaultAnnotation_),t!==!1){if(!(e in this.target_)){var n;if((n=this.target_[We])!=null&&n[e])return;P(1,t.annotationType_,this.name_+`.`+e.toString())}for(var r=this.target_;r&&r!==R;){var i=ne(r,e);if(i){var a=t.make_(this,e,i,r);if(a===0)return;if(a===1)break}r=Object.getPrototypeOf(r)}qi(this,t,e)}},t.extend_=function(e,t,n,r){if(r===void 0&&(r=!1),n===!0&&(n=this.defaultAnnotation_),n===!1)return this.defineProperty_(e,t,r);var i=n.extend_(this,e,t,r);return i&&qi(this,n,e),i},t.defineProperty_=function(e,t,n){n===void 0&&(n=!1),this.keysAtom_;try{Hn();var r=this.delete_(e);if(!r)return r;if(li(this)){var i=di(this,{object:this.proxy_||this.target_,name:e,type:Ai,newValue:t.value});if(!i)return null;var a=i.newValue;t.value!==a&&(t=Pe({},t,{value:a}))}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else L(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{Un()}return!0},t.defineObservableProperty_=function(e,t,n,r){r===void 0&&(r=!1),this.keysAtom_;try{Hn();var i=this.delete_(e);if(!i)return i;if(li(this)){var a=di(this,{object:this.proxy_||this.target_,name:e,type:Ai,newValue:t});if(!a)return null;t=a.newValue}var o=Gi(e),s={configurable:!B.safeDescriptors||this.isPlainObject_,enumerable:!0,get:o.get,set:o.set};if(r){if(!Reflect.defineProperty(this.target_,e,s))return!1}else L(this.target_,e,s);var c=new gn(t,n,`ObservableObject.key`,!1);this.values_.set(e,c),this.notifyPropertyAddition_(e,c.value_)}finally{Un()}return!0},t.defineComputedProperty_=function(e,t,n){n===void 0&&(n=!1),this.keysAtom_;try{Hn();var r=this.delete_(e);if(!r)return r;if(li(this)&&!di(this,{object:this.proxy_||this.target_,name:e,type:Ai,newValue:void 0}))return null;t.name||=`ObservableObject.key`,t.context=this.proxy_||this.target_;var i=Gi(e),a={configurable:!B.safeDescriptors||this.isPlainObject_,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.target_,e,a))return!1}else L(this.target_,e,a);this.values_.set(e,new vn(t)),this.notifyPropertyAddition_(e,void 0)}finally{Un()}return!0},t.delete_=function(e,t){if(t===void 0&&(t=!1),this.keysAtom_,!Te(this.target_,e))return!0;if(li(this)&&!di(this,{object:this.proxy_||this.target_,name:e,type:Vi}))return null;try{var n;Hn();var r=fi(this),i=this.values_.get(e),a=void 0;if(!i&&r&&(a=ne(this.target_,e)?.value),t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(i&&(this.values_.delete(e),i instanceof gn&&(a=i.value_),Gn(i)),this.keysAtom_.reportChanged(),(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(e in this.target_),r){var o={type:Vi,observableKind:`object`,object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:a,name:e};r&&mi(this,o)}}finally{Un()}return!0},t.observe_=function(e,t){return pi(this,e)},t.intercept_=function(e){return ui(this,e)},t.notifyPropertyAddition_=function(e,t){var n,r=fi(this);if(r){var i=r?{type:Ai,observableKind:`object`,debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;r&&mi(this,i)}(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Ce(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Ui(e,t){if(Te(e,z))return e;var n=t?.name??`ObservableObject`;return he(e,z,new Hi(e,new Map,String(n),Yt(t))),e}var Wi=_e(`ObservableObjectAdministration`,Hi);function Gi(e){return Bi[e]||(Bi[e]={get:function(){return this[z].getObservablePropValue_(e)},set:function(t){return this[z].setObservablePropValue_(e,t)}})}function Ki(e){return fe(e)?Wi(e[z]):!1}function qi(e,t,n){var r;(r=e.target_[We])==null||delete r[n]}var Ji=ea(0),Yi=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Xi=0,Zi=function(){};function Qi(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__===void 0?e.prototype=t:e.prototype.__proto__=t}Qi(Zi,Array.prototype);var $i=function(e){function t(t,n,r,i){var a;return r===void 0&&(r=`ObservableArray`),i===void 0&&(i=!1),a=e.call(this)||this,sa(function(){var e=new bi(r,n,i,!0);e.proxy_=a,ge(a,z,e),t&&t.length&&a.spliceWithArray(0,0,t),Yi&&Object.defineProperty(a,"0",Ji)}),a}Ie(t,e);var n=t.prototype;return n.concat=function(){this[z].atom_.reportObserved();var e=[...arguments];return Array.prototype.concat.apply(this.slice(),e.map(function(e){return Oi(e)?e.slice():e}))},n[Symbol.iterator]=function(){var e=this,t=0;return pa({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},Me(t,[{key:`length`,get:function(){return this[z].getArrayLength_()},set:function(e){this[z].setArrayLength_(e)}},{key:Symbol.toStringTag,get:function(){return`Array`}}])}(Zi);Object.entries(Si).forEach(function(e){var t=e[0],n=e[1];t!==`concat`&&he($i.prototype,t,n)});function ea(e){return{enumerable:!1,configurable:!0,get:function(){return this[z].get_(e)},set:function(t){this[z].set_(e,t)}}}function ta(e){L($i.prototype,``+e,ea(e))}function na(e){if(e>Xi){for(var t=Xi;t<e+100;t++)ta(t);Xi=e}}na(1e3);function ra(e,t,n){return new $i(e,t,n)}function ia(e,t){if(typeof e==`object`&&e){if(Oi(e))return t!==void 0&&P(23),e[z].atom_;if(Ri(e))return e.atom_;if(Ni(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||P(25,t,oa(e)),n}if(Ki(e)){if(!t)return P(26);var r=e[z],i=r.values_.get(t)??r.materializeLazyComputed_(t)??r.materializeLazyObservable_(t);return i||P(27,t,oa(e)),i}if(Xe(e)||yn(e)||$n(e))return e}else if(ue(e)&&$n(e[z]))return e[z];P(28)}function aa(e,t){if(e||P(29),t!==void 0)return aa(ia(e,t));if(Xe(e)||yn(e)||$n(e)||Ni(e)||Ri(e))return e;if(e[z])return e[z];P(24,e)}function oa(e,t){var n;if(t!==void 0)n=ia(e,t);else if(gr(e))return e.name;else n=Ki(e)||Ni(e)||Ri(e)?aa(e):ia(e);return n.name_}function sa(e){var t=kn(),n=mn(!0);Hn();try{return e()}finally{Un(),hn(n),An(t)}}var ca=R.toString;function la(e,t,n){return n===void 0&&(n=-1),ua(e,t,n)}function ua(e,t,n,r,i){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var a=typeof e;if(a!==`function`&&a!==`object`&&typeof t!=`object`)return!1;var o=ca.call(e);if(o!==ca.call(t))return!1;switch(o){case`[object RegExp]`:case`[object String]`:return``+e==``+t;case`[object Number]`:return+e==+e?+e==0?1/e==1/t:+e==+t:+t!=+t;case`[object Date]`:case`[object Boolean]`:return+e==+t;case`[object Symbol]`:return typeof Symbol<`u`&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case`[object Map]`:case`[object Set]`:n>=0&&n++}e=da(e),t=da(t);var s=o===`[object Array]`;if(!s){if(typeof e!=`object`||typeof t!=`object`)return!1;var c=e.constructor,l=t.constructor;if(c!==l&&!(ue(c)&&c instanceof c&&ue(l)&&l instanceof l)&&`constructor`in e&&`constructor`in t)return!1}if(n===0)return!1;n<0&&(n=-1),r||=[],i||=[];for(var u=r.length;u--;)if(r[u]===e)return i[u]===t;if(r.push(e),i.push(t),s){if(u=e.length,u!==t.length)return!1;for(;u--;)if(!ua(e[u],t[u],n-1,r,i))return!1}else{var d=Object.keys(e),f=d.length;if(Object.keys(t).length!==f)return!1;for(var p=0;p<f;p++){var m=d[p];if(!(Te(t,m)&&ua(e[m],t[m],n-1,r,i)))return!1}}return r.pop(),i.pop(),!0}function da(e){return Oi(e)?e.slice():ve(e)||Ni(e)||be(e)||Ri(e)?Array.from(e.entries()):e}var fa=I().Iterator?.prototype||{};function pa(e){return e[Symbol.iterator]=ma,Object.assign(Object.create(fa),e)}function ma(){return this}if([`Symbol`,`Map`,`Set`].forEach(function(e){I()[e]===void 0&&P(`MobX requires global '`+e+`' to be available or polyfilled`)}),typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__==`object`&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:nr,extras:{getDebugName:oa},$mobx:z}),!j.useState)throw Error(`mobx-react-lite requires React with Hooks support`);if(!hi)throw Error(`mobx-react-lite@3 requires mobx at least version 6 to be available`);var ha=D();function ga(e){e()}function _a(e){e||=ga,Ar({reactionScheduler:e})}function va(e){return Mr(e)}var ya=!1;function ba(){return ya}var xa=1e4,Sa=1e4,Ca=function(){function e(e){var t=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(e){e===void 0&&(e=xa),clearTimeout(t.sweepTimeout),t.sweepTimeout=void 0;var n=Date.now();t.registrations.forEach(function(r,i){n-r.registeredAt>=e&&(t.finalize(r.value),t.registrations.delete(i))}),t.registrations.size>0&&t.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){t.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this.registrations.set(n,{value:t,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.registrations.delete(e)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,Sa))}}),e}(),wa=new(typeof FinalizationRegistry<`u`?FinalizationRegistry:Ca)(function(e){var t;(t=e.reaction)==null||t.dispose(),e.reaction=null}),Ta=n((e=>{var t=C();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Ea=n(((e,t)=>{t.exports=Ta()}))();function Da(e){e.reaction=new Jn(`observer${e.name}`,function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)==null||t.call(e)})}function Oa(e,t){if(t===void 0&&(t=`observed`),ba())return e();var n=j.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return wa.unregister(r),r.onStoreChange=e,r.reaction||(Da(r),r.stateVersion=Symbol()),function(){var e;r.onStoreChange=null,(e=r.reaction)==null||e.dispose(),r.reaction=null}},getSnapshot:function(){return r.stateVersion}};n.current=r}var i=n.current;i.reaction||(Da(i),wa.register(n,i,i)),j.useDebugValue(i.reaction,va),(0,Ea.useSyncExternalStore)(i.subscribe,i.getSnapshot,i.getSnapshot);var a,o;if(i.reaction.track(function(){try{a=e()}catch(e){o=e}}),o)throw o;return a}var ka=typeof Symbol==`function`&&Symbol.for,Aa=Object.getOwnPropertyDescriptor(function(){},`name`)?.configurable??!1,ja=ka?Symbol.for(`react.forward_ref`):typeof j.forwardRef==`function`&&(0,j.forwardRef)(function(e){return null}).$$typeof,Ma=ka?Symbol.for(`react.memo`):typeof j.memo==`function`&&(0,j.memo)(function(e){return null}).$$typeof;function Na(e,t){if(Ma&&e.$$typeof===Ma)throw Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");if(ba())return e;var n=t?.forwardRef??!1,r=e,i=e.displayName||e.name;if(ja&&e.$$typeof===ja&&(n=!0,r=e.render,typeof r!=`function`))throw Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var a=function(e,t){return Oa(function(){return r(e,t)},i)};return a.displayName=e.displayName,Aa&&Object.defineProperty(a,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(a.contextTypes=e.contextTypes),n&&(a=(0,j.forwardRef)(a)),a=(0,j.memo)(a),Fa(e,a),a}var Pa={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function Fa(e,t){Object.keys(e).forEach(function(n){Pa[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}function Ia(e,t){return(0,j.useState)(function(){return Qt(e(),t,{autoBind:!0})})[0]}_a(ha.unstable_batchedUpdates),wa.finalizeAllImmediately;var La;function V(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Ra=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},za=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(La=globalThis).__zod_globalConfig??(La.__zod_globalConfig={});var Ba=globalThis.__zod_globalConfig;function Va(e){return e&&Object.assign(Ba,e),Ba}function Ha(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ua(e,t){return typeof t==`bigint`?t.toString():t}function Wa(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ga(e){return e==null}function Ka(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function qa(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var Ja=Symbol(`evaluating`);function Ya(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ja)return r===void 0&&(r=Ja,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Xa(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Za(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Qa(e){return JSON.stringify(e)}function $a(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var eo=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function to(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var no=Wa(()=>{if(Ba.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ro(e){if(to(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return to(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function io(e){return ro(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ao=new Set([`string`,`number`,`symbol`]);function oo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function so(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function H(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function co(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var lo={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function uo(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return so(e,Za(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Xa(this,`shape`,e),e},checks:[]}))}function fo(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return so(e,Za(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Xa(this,`shape`,r),r},checks:[]}))}function po(e,t){if(!ro(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return so(e,Za(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Xa(this,`shape`,n),n}}))}function mo(e,t){if(!ro(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return so(e,Za(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Xa(this,`shape`,n),n}}))}function ho(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return so(e,Za(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Xa(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function go(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return so(t,Za(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Xa(this,`shape`,i),i},checks:[]}))}function _o(e,t,n){return so(t,Za(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Xa(this,`shape`,i),i}}))}function vo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function yo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function bo(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function xo(e){return typeof e==`string`?e:e?.message}function So(e,t,n){let r=e.message?e.message:xo(e.inst?._zod.def?.error?.(e))??xo(t?.error?.(e))??xo(n.customError?.(e))??xo(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Co(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function wo(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var To=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ua,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Eo=V(`$ZodError`,To),Do=V(`$ZodError`,To,{Parent:Error});function Oo(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ko(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var Ao=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Ra;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>So(e,a,Va())));throw eo(t,i?.callee),t}return o.value},jo=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>So(e,a,Va())));throw eo(t,i?.callee),t}return o.value},Mo=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Ra;return a.issues.length?{success:!1,error:new(e??Eo)(a.issues.map(e=>So(e,i,Va())))}:{success:!0,data:a.value}},No=Mo(Do),Po=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>So(e,i,Va())))}:{success:!0,data:a.value}},Fo=Po(Do),Io=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ao(e)(t,n,i)},Lo=e=>(t,n,r)=>Ao(e)(t,n,r),Ro=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return jo(e)(t,n,i)},zo=e=>async(t,n,r)=>jo(e)(t,n,r),Bo=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Mo(e)(t,n,i)},Vo=e=>(t,n,r)=>Mo(e)(t,n,r),Ho=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Po(e)(t,n,i)},Uo=e=>async(t,n,r)=>Po(e)(t,n,r),Wo=/^[cC][0-9a-z]{6,}$/,Go=/^[0-9a-z]+$/,Ko=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,qo=/^[0-9a-vA-V]{20}$/,Jo=/^[A-Za-z0-9]{27}$/,Yo=/^[a-zA-Z0-9_-]{21}$/,Xo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zo=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Qo=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,$o=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,es=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function ts(){return new RegExp(es,`u`)}var ns=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,is=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,as=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,os=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ss=/^[A-Za-z0-9_-]*$/,cs=/^https?$/,ls=/^\+[1-9]\d{6,14}$/,us=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,ds=RegExp(`^${us}$`);function fs(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ps(e){return RegExp(`^${fs(e)}$`)}function ms(e){let t=fs({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${us}T(?:${r})$`)}var hs=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},gs=/^-?\d+$/,_s=/^-?\d+(?:\.\d+)?$/,vs=/^(?:true|false)$/i,ys=/^[^A-Z]*$/,bs=/^[^a-z]*$/,xs=V(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ss={number:`number`,bigint:`bigint`,object:`date`},Cs=V(`$ZodCheckLessThan`,(e,t)=>{xs.init(e,t);let n=Ss[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ws=V(`$ZodCheckGreaterThan`,(e,t)=>{xs.init(e,t);let n=Ss[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ts=V(`$ZodCheckMultipleOf`,(e,t)=>{xs.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):qa(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Es=V(`$ZodCheckNumberFormat`,(e,t)=>{xs.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=lo[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=gs)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Ds=V(`$ZodCheckMaxLength`,(e,t)=>{var n;xs.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ga(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Co(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Os=V(`$ZodCheckMinLength`,(e,t)=>{var n;xs.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ga(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Co(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ks=V(`$ZodCheckLengthEquals`,(e,t)=>{var n;xs.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ga(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Co(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),As=V(`$ZodCheckStringFormat`,(e,t)=>{var n,r;xs.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),js=V(`$ZodCheckRegex`,(e,t)=>{As.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ms=V(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ys,As.init(e,t)}),Ns=V(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=bs,As.init(e,t)}),Ps=V(`$ZodCheckIncludes`,(e,t)=>{xs.init(e,t);let n=oo(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Fs=V(`$ZodCheckStartsWith`,(e,t)=>{xs.init(e,t);let n=RegExp(`^${oo(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Is=V(`$ZodCheckEndsWith`,(e,t)=>{xs.init(e,t);let n=RegExp(`.*${oo(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Ls=V(`$ZodCheckOverwrite`,(e,t)=>{xs.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Rs=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
13
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
14
+ `))}},zs={major:4,minor:4,patch:3},Bs=V(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=zs;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=vo(e),i;for(let a of t){if(a._zod.def.when){if(yo(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Ra;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=vo(e,t))});else{if(e.issues.length===t)continue;r||=vo(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(vo(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Ra;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Ra;return o.then(e=>t(e,r,a))}return t(o,r,a)}}Ya(e,`~standard`,()=>({validate:t=>{try{let n=No(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Fo(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Vs=V(`$ZodString`,(e,t)=>{Bs.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??hs(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Hs=V(`$ZodStringFormat`,(e,t)=>{As.init(e,t),Vs.init(e,t)}),Us=V(`$ZodGUID`,(e,t)=>{t.pattern??=Zo,Hs.init(e,t)}),Ws=V(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Qo(e)}else t.pattern??=Qo();Hs.init(e,t)}),Gs=V(`$ZodEmail`,(e,t)=>{t.pattern??=$o,Hs.init(e,t)}),Ks=V(`$ZodURL`,(e,t)=>{Hs.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===cs.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),n.value=t.normalize?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),qs=V(`$ZodEmoji`,(e,t)=>{t.pattern??=ts(),Hs.init(e,t)}),Js=V(`$ZodNanoID`,(e,t)=>{t.pattern??=Yo,Hs.init(e,t)}),Ys=V(`$ZodCUID`,(e,t)=>{t.pattern??=Wo,Hs.init(e,t)}),Xs=V(`$ZodCUID2`,(e,t)=>{t.pattern??=Go,Hs.init(e,t)}),Zs=V(`$ZodULID`,(e,t)=>{t.pattern??=Ko,Hs.init(e,t)}),Qs=V(`$ZodXID`,(e,t)=>{t.pattern??=qo,Hs.init(e,t)}),$s=V(`$ZodKSUID`,(e,t)=>{t.pattern??=Jo,Hs.init(e,t)}),ec=V(`$ZodISODateTime`,(e,t)=>{t.pattern??=ms(t),Hs.init(e,t)}),tc=V(`$ZodISODate`,(e,t)=>{t.pattern??=ds,Hs.init(e,t)}),nc=V(`$ZodISOTime`,(e,t)=>{t.pattern??=ps(t),Hs.init(e,t)}),rc=V(`$ZodISODuration`,(e,t)=>{t.pattern??=Xo,Hs.init(e,t)}),ic=V(`$ZodIPv4`,(e,t)=>{t.pattern??=ns,Hs.init(e,t),e._zod.bag.format=`ipv4`}),ac=V(`$ZodIPv6`,(e,t)=>{t.pattern??=rs,Hs.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),oc=V(`$ZodCIDRv4`,(e,t)=>{t.pattern??=is,Hs.init(e,t)}),sc=V(`$ZodCIDRv6`,(e,t)=>{t.pattern??=as,Hs.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function cc(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var lc=V(`$ZodBase64`,(e,t)=>{t.pattern??=os,Hs.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{cc(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function uc(e){if(!ss.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return cc(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var dc=V(`$ZodBase64URL`,(e,t)=>{t.pattern??=ss,Hs.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{uc(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),fc=V(`$ZodE164`,(e,t)=>{t.pattern??=ls,Hs.init(e,t)});function pc(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var mc=V(`$ZodJWT`,(e,t)=>{Hs.init(e,t),e._zod.check=n=>{pc(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),hc=V(`$ZodNumber`,(e,t)=>{Bs.init(e,t),e._zod.pattern=e._zod.bag.pattern??_s,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),gc=V(`$ZodNumberFormat`,(e,t)=>{Es.init(e,t),hc.init(e,t)}),_c=V(`$ZodBoolean`,(e,t)=>{Bs.init(e,t),e._zod.pattern=vs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),vc=V(`$ZodUnknown`,(e,t)=>{Bs.init(e,t),e._zod.parse=e=>e}),yc=V(`$ZodNever`,(e,t)=>{Bs.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function bc(e,t,n){e.issues.length&&t.issues.push(...bo(n,e.issues)),t.value[n]=e.value}var xc=V(`$ZodArray`,(e,t)=>{Bs.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>bc(t,n,e))):bc(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Sc(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...bo(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Cc(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=co(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function wc(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Sc(e,n,i,t,u,d))):Sc(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Tc=V(`$ZodObject`,(e,t)=>{if(Bs.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=Wa(()=>Cc(t));Ya(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=to,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Sc(n,t,e,s,r,i))):Sc(a,t,e,s,r,i)}return i?wc(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Ec=V(`$ZodObjectJIT`,(e,t)=>{Tc.init(e,t);let n=e._zod.parse,r=Wa(()=>Cc(t)),i=e=>{let t=new Rs([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Qa(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Qa(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
15
+ if (${n}.issues.length) {
16
+ if (${o} in input) {
17
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
18
+ ...iss,
19
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
20
+ })));
21
+ }
22
+ }
23
+
24
+ if (${n}.value === undefined) {
25
+ if (${o} in input) {
26
+ newResult[${o}] = undefined;
27
+ }
28
+ } else {
29
+ newResult[${o}] = ${n}.value;
30
+ }
31
+
32
+ `):c?t.write(`
33
+ if (${n}.issues.length) {
34
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
35
+ ...iss,
36
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
37
+ })));
38
+ }
39
+
40
+ if (${n}.value === undefined) {
41
+ if (${o} in input) {
42
+ newResult[${o}] = undefined;
43
+ }
44
+ } else {
45
+ newResult[${o}] = ${n}.value;
46
+ }
47
+
48
+ `):t.write(`
49
+ const ${n}_present = ${o} in input;
50
+ if (${n}.issues.length) {
51
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
52
+ ...iss,
53
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
54
+ })));
55
+ }
56
+ if (!${n}_present && !${n}.issues.length) {
57
+ payload.issues.push({
58
+ code: "invalid_type",
59
+ expected: "nonoptional",
60
+ input: undefined,
61
+ path: [${o}]
62
+ });
63
+ }
64
+
65
+ if (${n}_present) {
66
+ if (${n}.value === undefined) {
67
+ newResult[${o}] = undefined;
68
+ } else {
69
+ newResult[${o}] = ${n}.value;
70
+ }
71
+ }
72
+
73
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=to,s=!Ba.jitless,c=s&&no.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?wc([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Dc(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!vo(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>So(e,r,Va())))}),t)}var Oc=V(`$ZodUnion`,(e,t)=>{Bs.init(e,t),Ya(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Ya(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Ya(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Ya(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Ka(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Dc(t,r,e,i)):Dc(o,r,e,i)}}),kc=V(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Oc.init(e,t);let n=e._zod.parse;Ya(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Wa(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!to(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Ac=V(`$ZodIntersection`,(e,t)=>{Bs.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Mc(e,t,n)):Mc(e,i,a)}});function jc(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ro(e)&&ro(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=jc(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=jc(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Mc(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),vo(e))return e;let o=jc(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Nc=V(`$ZodRecord`,(e,t)=>{Bs.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!ro(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>So(e,r,Va())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...bo(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...bo(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&_s.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>So(e,r,Va())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...bo(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...bo(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Pc=V(`$ZodEnum`,(e,t)=>{Bs.init(e,t);let n=Ha(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ao.has(typeof e)).map(e=>typeof e==`string`?oo(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Fc=V(`$ZodLiteral`,(e,t)=>{if(Bs.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?oo(e):e?oo(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Ic=V(`$ZodTransform`,(e,t)=>{Bs.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new za(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new Ra;return n.value=i,n.fallback=!0,n}});function Lc(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Rc=V(`$ZodOptional`,(e,t)=>{Bs.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Ya(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ya(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ka(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Lc(e,r)):Lc(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),zc=V(`$ZodExactOptional`,(e,t)=>{Rc.init(e,t),Ya(e._zod,`values`,()=>t.innerType._zod.values),Ya(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Bc=V(`$ZodNullable`,(e,t)=>{Bs.init(e,t),Ya(e._zod,`optin`,()=>t.innerType._zod.optin),Ya(e._zod,`optout`,()=>t.innerType._zod.optout),Ya(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ka(e.source)}|null)$`):void 0}),Ya(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Vc=V(`$ZodDefault`,(e,t)=>{Bs.init(e,t),e._zod.optin=`optional`,Ya(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Hc(e,t)):Hc(r,t)}});function Hc(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Uc=V(`$ZodPrefault`,(e,t)=>{Bs.init(e,t),e._zod.optin=`optional`,Ya(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Wc=V(`$ZodNonOptional`,(e,t)=>{Bs.init(e,t),Ya(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Gc(t,e)):Gc(i,e)}});function Gc(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Kc=V(`$ZodCatch`,(e,t)=>{Bs.init(e,t),e._zod.optin=`optional`,Ya(e._zod,`optout`,()=>t.innerType._zod.optout),Ya(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>So(e,n,Va()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>So(e,n,Va()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),qc=V(`$ZodPipe`,(e,t)=>{Bs.init(e,t),Ya(e._zod,`values`,()=>t.in._zod.values),Ya(e._zod,`optin`,()=>t.in._zod.optin),Ya(e._zod,`optout`,()=>t.out._zod.optout),Ya(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Jc(e,t.in,n)):Jc(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Jc(e,t.out,n)):Jc(r,t.out,n)}});function Jc(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Yc=V(`$ZodReadonly`,(e,t)=>{Bs.init(e,t),Ya(e._zod,`propValues`,()=>t.innerType._zod.propValues),Ya(e._zod,`values`,()=>t.innerType._zod.values),Ya(e._zod,`optin`,()=>t.innerType?._zod?.optin),Ya(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Xc):Xc(r)}});function Xc(e){return e.value=Object.freeze(e.value),e}var Zc=V(`$ZodLazy`,(e,t)=>{Bs.init(e,t),Ya(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),Ya(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),Ya(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),Ya(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),Ya(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Qc=V(`$ZodCustom`,(e,t)=>{xs.init(e,t),Bs.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>$c(t,n,r,e));$c(i,n,r,e)}});function $c(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(wo(e))}}var el,tl=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function nl(){return new tl}(el=globalThis).__zod_globalRegistry??(el.__zod_globalRegistry=nl());var rl=globalThis.__zod_globalRegistry;function il(e,t){return new e({type:`string`,...H(t)})}function al(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...H(t)})}function ol(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...H(t)})}function sl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...H(t)})}function cl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...H(t)})}function ll(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...H(t)})}function ul(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...H(t)})}function dl(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...H(t)})}function fl(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...H(t)})}function pl(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...H(t)})}function ml(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...H(t)})}function hl(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...H(t)})}function gl(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...H(t)})}function _l(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...H(t)})}function vl(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...H(t)})}function yl(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...H(t)})}function bl(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...H(t)})}function xl(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...H(t)})}function Sl(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...H(t)})}function Cl(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...H(t)})}function wl(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...H(t)})}function Tl(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...H(t)})}function El(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...H(t)})}function Dl(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...H(t)})}function Ol(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...H(t)})}function kl(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...H(t)})}function Al(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...H(t)})}function jl(e,t){return new e({type:`number`,checks:[],...H(t)})}function Ml(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...H(t)})}function Nl(e,t){return new e({type:`boolean`,...H(t)})}function Pl(e){return new e({type:`unknown`})}function Fl(e,t){return new e({type:`never`,...H(t)})}function Il(e,t){return new Cs({check:`less_than`,...H(t),value:e,inclusive:!1})}function Ll(e,t){return new Cs({check:`less_than`,...H(t),value:e,inclusive:!0})}function Rl(e,t){return new ws({check:`greater_than`,...H(t),value:e,inclusive:!1})}function zl(e,t){return new ws({check:`greater_than`,...H(t),value:e,inclusive:!0})}function Bl(e,t){return new Ts({check:`multiple_of`,...H(t),value:e})}function Vl(e,t){return new Ds({check:`max_length`,...H(t),maximum:e})}function Hl(e,t){return new Os({check:`min_length`,...H(t),minimum:e})}function Ul(e,t){return new ks({check:`length_equals`,...H(t),length:e})}function Wl(e,t){return new js({check:`string_format`,format:`regex`,...H(t),pattern:e})}function Gl(e){return new Ms({check:`string_format`,format:`lowercase`,...H(e)})}function Kl(e){return new Ns({check:`string_format`,format:`uppercase`,...H(e)})}function ql(e,t){return new Ps({check:`string_format`,format:`includes`,...H(t),includes:e})}function Jl(e,t){return new Fs({check:`string_format`,format:`starts_with`,...H(t),prefix:e})}function Yl(e,t){return new Is({check:`string_format`,format:`ends_with`,...H(t),suffix:e})}function Xl(e){return new Ls({check:`overwrite`,tx:e})}function Zl(e){return Xl(t=>t.normalize(e))}function Ql(){return Xl(e=>e.trim())}function $l(){return Xl(e=>e.toLowerCase())}function eu(){return Xl(e=>e.toUpperCase())}function tu(){return Xl(e=>$a(e))}function nu(e,t,n){return new e({type:`array`,element:t,...H(n)})}function ru(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...H(n)})}function iu(e,t){let n=au(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(wo(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(wo(r))}},e(t.value,t)),t);return n}function au(e,t){let n=new xs({check:`custom`,...H(t)});return n._zod.check=e,n}function ou(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??rl,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function su(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,su(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&uu(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function cu(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
74
+
75
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function lu(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:fu(t,`input`,e.processors),output:fu(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function uu(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return uu(r.element,n);if(r.type===`set`)return uu(r.valueType,n);if(r.type===`lazy`)return uu(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return uu(r.innerType,n);if(r.type===`intersection`)return uu(r.left,n)||uu(r.right,n);if(r.type===`record`||r.type===`map`)return uu(r.keyType,n)||uu(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:uu(r.in,n)||uu(r.out,n);if(r.type===`object`){for(let e in r.shape)if(uu(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(uu(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(uu(e,n))return!0;return!!(r.rest&&uu(r.rest,n))}return!1}var du=(e,t={})=>n=>{let r=ou({...n,processors:t});return su(e,r),cu(r,e),lu(r,e)},fu=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ou({...i??{},target:a,io:t,processors:n});return su(e,o),cu(o,e),lu(o,e)},pu={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},mu=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=pu[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},hu=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},gu=(e,t,n,r)=>{n.type=`boolean`},_u=(e,t,n,r)=>{n.not={}},vu=(e,t,n,r)=>{let i=e._zod.def,a=Ha(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},yu=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},bu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},xu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Su=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=su(a.element,t,{...r,path:[...r.path,`items`]})},Cu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=su(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=su(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},wu=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>su(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Tu=(e,t,n,r)=>{let i=e._zod.def,a=su(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=su(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Eu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=su(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=su(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=su(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Du=(e,t,n,r)=>{let i=e._zod.def,a=su(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ou=(e,t,n,r)=>{let i=e._zod.def;su(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ku=(e,t,n,r)=>{let i=e._zod.def;su(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Au=(e,t,n,r)=>{let i=e._zod.def;su(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},ju=(e,t,n,r)=>{let i=e._zod.def;su(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Mu=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;su(o,t,r);let s=t.seen.get(e);s.ref=o},Nu=(e,t,n,r)=>{let i=e._zod.def;su(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Pu=(e,t,n,r)=>{let i=e._zod.def;su(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Fu=(e,t,n,r)=>{let i=e._zod.innerType;su(i,t,r);let a=t.seen.get(e);a.ref=i},Iu=V(`ZodISODateTime`,(e,t)=>{ec.init(e,t),cd.init(e,t)});function Lu(e){return Dl(Iu,e)}var Ru=V(`ZodISODate`,(e,t)=>{tc.init(e,t),cd.init(e,t)});function zu(e){return Ol(Ru,e)}var Bu=V(`ZodISOTime`,(e,t)=>{nc.init(e,t),cd.init(e,t)});function Vu(e){return kl(Bu,e)}var Hu=V(`ZodISODuration`,(e,t)=>{rc.init(e,t),cd.init(e,t)});function Uu(e){return Al(Hu,e)}var Wu=V(`ZodError`,(e,t)=>{Eo.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ko(e,t)},flatten:{value:t=>Oo(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ua,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ua,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Gu=Ao(Wu),Ku=jo(Wu),qu=Mo(Wu),Ju=Po(Wu),Yu=Io(Wu),Xu=Lo(Wu),Zu=Ro(Wu),Qu=zo(Wu),$u=Bo(Wu),ed=Vo(Wu),td=Ho(Wu),nd=Uo(Wu),rd=new WeakMap;function id(e,t,n){let r=Object.getPrototypeOf(e),i=rd.get(r);if(i||(i=new Set,rd.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var ad=V(`ZodType`,(e,t)=>(Bs.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:fu(e,`input`),output:fu(e,`output`)}}),e.toJSONSchema=du(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Gu(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>qu(e,t,n),e.parseAsync=async(t,n)=>Ku(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ju(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Yu(e,t,n),e.decode=(t,n)=>Xu(e,t,n),e.encodeAsync=async(t,n)=>Zu(e,t,n),e.decodeAsync=async(t,n)=>Qu(e,t,n),e.safeEncode=(t,n)=>$u(e,t,n),e.safeDecode=(t,n)=>ed(e,t,n),e.safeEncodeAsync=async(t,n)=>td(e,t,n),e.safeDecodeAsync=async(t,n)=>nd(e,t,n),id(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Za(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return so(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(wf(e,t))},superRefine(e,t){return this.check(Tf(e,t))},overwrite(e){return this.check(Xl(e))},optional(){return rf(this)},exactOptional(){return of(this)},nullable(){return cf(this)},nullish(){return rf(cf(this))},nonoptional(e){return mf(this,e)},array(){return Rd(this)},or(e){return Ud([this,e])},and(e){return qd(this,e)},transform(e){return vf(this,tf(e))},default(e){return uf(this,e)},prefault(e){return ff(this,e)},catch(e){return gf(this,e)},pipe(e){return vf(this,e)},readonly(){return bf(this)},describe(e){let t=this.clone();return rl.add(t,{description:e}),t},meta(...e){if(e.length===0)return rl.get(this);let t=this.clone();return rl.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return rl.get(e)?.description},configurable:!0}),e)),od=V(`_ZodString`,(e,t)=>{Vs.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mu(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,id(e,`_ZodString`,{regex(...e){return this.check(Wl(...e))},includes(...e){return this.check(ql(...e))},startsWith(...e){return this.check(Jl(...e))},endsWith(...e){return this.check(Yl(...e))},min(...e){return this.check(Hl(...e))},max(...e){return this.check(Vl(...e))},length(...e){return this.check(Ul(...e))},nonempty(...e){return this.check(Hl(1,...e))},lowercase(e){return this.check(Gl(e))},uppercase(e){return this.check(Kl(e))},trim(){return this.check(Ql())},normalize(...e){return this.check(Zl(...e))},toLowerCase(){return this.check($l())},toUpperCase(){return this.check(eu())},slugify(){return this.check(tu())}})}),sd=V(`ZodString`,(e,t)=>{Vs.init(e,t),od.init(e,t),e.email=t=>e.check(al(ld,t)),e.url=t=>e.check(dl(fd,t)),e.jwt=t=>e.check(El(Dd,t)),e.emoji=t=>e.check(fl(pd,t)),e.guid=t=>e.check(ol(ud,t)),e.uuid=t=>e.check(sl(dd,t)),e.uuidv4=t=>e.check(cl(dd,t)),e.uuidv6=t=>e.check(ll(dd,t)),e.uuidv7=t=>e.check(ul(dd,t)),e.nanoid=t=>e.check(pl(md,t)),e.guid=t=>e.check(ol(ud,t)),e.cuid=t=>e.check(ml(hd,t)),e.cuid2=t=>e.check(hl(gd,t)),e.ulid=t=>e.check(gl(_d,t)),e.base64=t=>e.check(Cl(wd,t)),e.base64url=t=>e.check(wl(Td,t)),e.xid=t=>e.check(_l(vd,t)),e.ksuid=t=>e.check(vl(yd,t)),e.ipv4=t=>e.check(yl(bd,t)),e.ipv6=t=>e.check(bl(xd,t)),e.cidrv4=t=>e.check(xl(Sd,t)),e.cidrv6=t=>e.check(Sl(Cd,t)),e.e164=t=>e.check(Tl(Ed,t)),e.datetime=t=>e.check(Lu(t)),e.date=t=>e.check(zu(t)),e.time=t=>e.check(Vu(t)),e.duration=t=>e.check(Uu(t))});function U(e){return il(sd,e)}var cd=V(`ZodStringFormat`,(e,t)=>{Hs.init(e,t),od.init(e,t)}),ld=V(`ZodEmail`,(e,t)=>{Gs.init(e,t),cd.init(e,t)}),ud=V(`ZodGUID`,(e,t)=>{Us.init(e,t),cd.init(e,t)}),dd=V(`ZodUUID`,(e,t)=>{Ws.init(e,t),cd.init(e,t)}),fd=V(`ZodURL`,(e,t)=>{Ks.init(e,t),cd.init(e,t)}),pd=V(`ZodEmoji`,(e,t)=>{qs.init(e,t),cd.init(e,t)}),md=V(`ZodNanoID`,(e,t)=>{Js.init(e,t),cd.init(e,t)}),hd=V(`ZodCUID`,(e,t)=>{Ys.init(e,t),cd.init(e,t)}),gd=V(`ZodCUID2`,(e,t)=>{Xs.init(e,t),cd.init(e,t)}),_d=V(`ZodULID`,(e,t)=>{Zs.init(e,t),cd.init(e,t)}),vd=V(`ZodXID`,(e,t)=>{Qs.init(e,t),cd.init(e,t)}),yd=V(`ZodKSUID`,(e,t)=>{$s.init(e,t),cd.init(e,t)}),bd=V(`ZodIPv4`,(e,t)=>{ic.init(e,t),cd.init(e,t)}),xd=V(`ZodIPv6`,(e,t)=>{ac.init(e,t),cd.init(e,t)}),Sd=V(`ZodCIDRv4`,(e,t)=>{oc.init(e,t),cd.init(e,t)}),Cd=V(`ZodCIDRv6`,(e,t)=>{sc.init(e,t),cd.init(e,t)}),wd=V(`ZodBase64`,(e,t)=>{lc.init(e,t),cd.init(e,t)}),Td=V(`ZodBase64URL`,(e,t)=>{dc.init(e,t),cd.init(e,t)}),Ed=V(`ZodE164`,(e,t)=>{fc.init(e,t),cd.init(e,t)}),Dd=V(`ZodJWT`,(e,t)=>{mc.init(e,t),cd.init(e,t)}),Od=V(`ZodNumber`,(e,t)=>{hc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hu(e,t,n,r),id(e,`ZodNumber`,{gt(e,t){return this.check(Rl(e,t))},gte(e,t){return this.check(zl(e,t))},min(e,t){return this.check(zl(e,t))},lt(e,t){return this.check(Il(e,t))},lte(e,t){return this.check(Ll(e,t))},max(e,t){return this.check(Ll(e,t))},int(e){return this.check(Ad(e))},safe(e){return this.check(Ad(e))},positive(e){return this.check(Rl(0,e))},nonnegative(e){return this.check(zl(0,e))},negative(e){return this.check(Il(0,e))},nonpositive(e){return this.check(Ll(0,e))},multipleOf(e,t){return this.check(Bl(e,t))},step(e,t){return this.check(Bl(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function W(e){return jl(Od,e)}var kd=V(`ZodNumberFormat`,(e,t)=>{gc.init(e,t),Od.init(e,t)});function Ad(e){return Ml(kd,e)}var jd=V(`ZodBoolean`,(e,t)=>{_c.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gu(e,t,n,r)});function Md(e){return Nl(jd,e)}var Nd=V(`ZodUnknown`,(e,t)=>{vc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Pd(){return Pl(Nd)}var Fd=V(`ZodNever`,(e,t)=>{yc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_u(e,t,n,r)});function Id(e){return Fl(Fd,e)}var Ld=V(`ZodArray`,(e,t)=>{xc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Su(e,t,n,r),e.element=t.element,id(e,`ZodArray`,{min(e,t){return this.check(Hl(e,t))},nonempty(e){return this.check(Hl(1,e))},max(e,t){return this.check(Vl(e,t))},length(e,t){return this.check(Ul(e,t))},unwrap(){return this.element}})});function Rd(e,t){return nu(Ld,e,t)}var zd=V(`ZodObject`,(e,t)=>{Ec.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cu(e,t,n,r),Ya(e,`shape`,()=>t.shape),id(e,`ZodObject`,{keyof(){return Zd(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Pd()})},loose(){return this.clone({...this._zod.def,catchall:Pd()})},strict(){return this.clone({...this._zod.def,catchall:Id()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return po(this,e)},safeExtend(e){return mo(this,e)},merge(e){return ho(this,e)},pick(e){return uo(this,e)},omit(e){return fo(this,e)},partial(...e){return go(nf,this,e[0])},required(...e){return _o(pf,this,e[0])}})});function Bd(e,t){return new zd({type:`object`,shape:e??{},...H(t)})}function Vd(e,t){return new zd({type:`object`,shape:e,catchall:Id(),...H(t)})}var Hd=V(`ZodUnion`,(e,t)=>{Oc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wu(e,t,n,r),e.options=t.options});function Ud(e,t){return new Hd({type:`union`,options:e,...H(t)})}var Wd=V(`ZodDiscriminatedUnion`,(e,t)=>{Hd.init(e,t),kc.init(e,t)});function Gd(e,t,n){return new Wd({type:`union`,options:t,discriminator:e,...H(n)})}var Kd=V(`ZodIntersection`,(e,t)=>{Ac.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tu(e,t,n,r)});function qd(e,t){return new Kd({type:`intersection`,left:e,right:t})}var Jd=V(`ZodRecord`,(e,t)=>{Nc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eu(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Yd(e,t,n){return!t||!t._zod?new Jd({type:`record`,keyType:U(),valueType:e,...H(t)}):new Jd({type:`record`,keyType:e,valueType:t,...H(n)})}var Xd=V(`ZodEnum`,(e,t)=>{Pc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vu(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Xd({...t,checks:[],...H(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Xd({...t,checks:[],...H(r),entries:i})}});function Zd(e,t){return new Xd({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...H(t)})}var Qd=V(`ZodLiteral`,(e,t)=>{Fc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yu(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function $d(e,t){return new Qd({type:`literal`,values:Array.isArray(e)?e:[e],...H(t)})}var ef=V(`ZodTransform`,(e,t)=>{Ic.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xu(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new za(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(wo(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(wo(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function tf(e){return new ef({type:`transform`,transform:e})}var nf=V(`ZodOptional`,(e,t)=>{Rc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rf(e){return new nf({type:`optional`,innerType:e})}var af=V(`ZodExactOptional`,(e,t)=>{zc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function of(e){return new af({type:`optional`,innerType:e})}var sf=V(`ZodNullable`,(e,t)=>{Bc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Du(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cf(e){return new sf({type:`nullable`,innerType:e})}var lf=V(`ZodDefault`,(e,t)=>{Vc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ku(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function uf(e,t){return new lf({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():io(t)}})}var df=V(`ZodPrefault`,(e,t)=>{Uc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Au(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ff(e,t){return new df({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():io(t)}})}var pf=V(`ZodNonOptional`,(e,t)=>{Wc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ou(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mf(e,t){return new pf({type:`nonoptional`,innerType:e,...H(t)})}var hf=V(`ZodCatch`,(e,t)=>{Kc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ju(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function gf(e,t){return new hf({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var _f=V(`ZodPipe`,(e,t)=>{qc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mu(e,t,n,r),e.in=t.in,e.out=t.out});function vf(e,t){return new _f({type:`pipe`,in:e,out:t})}var yf=V(`ZodReadonly`,(e,t)=>{Yc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bf(e){return new yf({type:`readonly`,innerType:e})}var xf=V(`ZodLazy`,(e,t)=>{Zc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fu(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Sf(e){return new xf({type:`lazy`,getter:e})}var Cf=V(`ZodCustom`,(e,t)=>{Qc.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bu(e,t,n,r)});function wf(e,t={}){return ru(Cf,e,t)}function Tf(e,t){return iu(e,t)}function Ef(e,t,n,r){let i=Error(t);return i.code=e,n!==void 0&&(i.details=n),r!==void 0&&(i.cause=r),i}var Df=T(),Of=[`fontSize`,`fontFamily`,`fontWeight`,`fontStyle`,`textDecoration`,`textTransform`,`fill`,`align`,`verticalAlign`,`lineHeight`,`letterSpacing`,`strokeWidth`,`stroke`,`cellBackground`,`cellPadding`],kf=e=>(e.cells||[]).map(t=>{if(!t)return t;let n={...t};for(let t of Of)n[t]===void 0&&(n[t]=e[t]);return n}),Af=(e,t,n)=>{let r=e.borders?.[n];return{width:r?.width??t.borderWidth,style:r?.style??t.borderStyle,color:r?.color??t.borderColor}},jf=(e,t)=>{let n=e.rowSpan||1,r=e.colSpan||1,i=(n,r)=>{let i=Af(e,t,n);return i.style===`none`||!i.width?0:r?i.width:i.width/2};return{top:i(`top`,e.row===0),bottom:i(`bottom`,e.row+n===t.rows),left:i(`left`,e.col===0),right:i(`right`,e.col+r===t.cols)}},Mf={fontSize:14,fontFamily:`Roboto`,fontWeight:`normal`,fontStyle:`normal`,lineHeight:1.2,letterSpacing:0,textTransform:`none`,textDecoration:``,align:`center`,fill:`black`,stroke:`black`,strokeWidth:0,strokeLineJoin:`round`,curveEnabled:!1,curvePower:.5},Nf=e=>e!=null&&e<1?1:e,Pf=[`text`,`image`,`svg`,`line`,`figure`,`gif`,`video`,`table`,`group`];function Ff(e){let t=e({delay:W().default(0).describe(`Delay before the animation starts, in milliseconds.`),duration:W().default(500).describe(`Animation duration in milliseconds.`),enabled:Md().default(!0).describe(`Whether the animation is enabled.`),type:Zd([`enter`,`exit`,`loop`]).describe(`Animation phase.`),name:U().default(`none`).describe(`Animation name identifier.`),data:Pd().default({}).describe(`Animation-specific data.`)}),n=Yd(U(),e({intensity:W().default(1).describe(`Filter intensity (-1 to 1).`)})).describe(`Applied image filters keyed by filter name.`),r={id:U().describe(`Unique identifier for the element.`),type:U().describe(`Element type identifier.`),name:U().default(``).describe(`Display name for the element.`),custom:Pd().optional().describe(`Custom data attached to the element.`),x:W().default(0).describe(`X position in pixels.`),y:W().default(0).describe(`Y position in pixels.`),width:W().default(100).describe(`Width in pixels.`),height:W().default(100).describe(`Height in pixels.`),rotation:W().default(0).describe(`Rotation angle in degrees.`),opacity:W().default(1).describe(`Opacity level (0-1).`),animations:Rd(t).default([]).describe(`Animation configurations.`),blurEnabled:Md().default(!1).describe(`Whether blur effect is enabled.`),blurRadius:W().default(10).describe(`Blur radius in pixels.`),brightnessEnabled:Md().default(!1).describe(`Whether brightness effect is enabled.`),brightness:W().default(0).describe(`Brightness level (-1 to 1).`),sepiaEnabled:Md().default(!1).describe(`Whether sepia effect is enabled.`),grayscaleEnabled:Md().default(!1).describe(`Whether grayscale effect is enabled.`),filters:n.default({}),shadowEnabled:Md().default(!1).describe(`Whether shadow is enabled.`),shadowBlur:W().default(5).describe(`Shadow blur radius in pixels.`),shadowOffsetX:W().default(0).describe(`Shadow horizontal offset in pixels.`),shadowOffsetY:W().default(0).describe(`Shadow vertical offset in pixels.`),shadowColor:U().default(`black`).describe(`Shadow color.`),shadowOpacity:W().default(1).describe(`Shadow opacity (0-1).`),visible:Md().default(!0).describe(`Whether the element is visible.`),draggable:Md().default(!0).describe(`Whether the element can be dragged.`),resizable:Md().default(!0).describe(`Whether the element can be resized.`),selectable:Md().default(!0).describe(`Whether the element can be selected.`),removable:Md().default(!0).describe(`Whether the element can be removed.`),contentEditable:Md().default(!0).describe(`Whether the element content can be edited.`),styleEditable:Md().default(!0).describe(`Whether the element style can be edited.`),alwaysOnTop:Md().default(!1).describe(`Whether the element stays on top of others.`),showInExport:Md().default(!0).describe(`Whether the element appears in exports.`)},i={src:U().default(``).describe(`URL or data URI of the image file.`),cropX:W().default(0).describe(`Crop X offset as a fraction (0-1).`),cropY:W().default(0).describe(`Crop Y offset as a fraction (0-1).`),cropWidth:W().default(1).describe(`Crop width as a fraction (0-1).`),cropHeight:W().default(1).describe(`Crop height as a fraction (0-1).`),cornerRadius:W().default(0).describe(`Corner radius in pixels.`),flipX:Md().default(!1).describe(`Whether the image is flipped horizontally.`),flipY:Md().default(!1).describe(`Whether the image is flipped vertically.`),clipSrc:U().default(``).describe(`URL or data URI for a clipping mask.`),borderColor:U().default(`black`).describe(`Border color.`),borderSize:W().default(0).describe(`Border width in pixels.`),keepRatio:Md().default(!1).describe(`Whether to maintain aspect ratio when resizing.`),stretchEnabled:Md().default(!1).describe(`Whether stretch mode is enabled.`)},a={...r,type:$d(`text`),text:U().default(``).describe(`Visible text shown on canvas.`),placeholder:U().default(``).describe(`Placeholder text shown when empty.`),fontSize:W().overwrite(Nf).default(Mf.fontSize).describe(`Font size in pixels (minimum 1).`),fontFamily:U().default(Mf.fontFamily).describe(`Font family name.`),fontStyle:U().default(Mf.fontStyle).describe(`Font style: 'normal' or 'italic'.`),fontWeight:U().default(Mf.fontWeight).describe(`Font weight: 'normal', 'bold', or numeric string.`),textDecoration:U().default(Mf.textDecoration).describe(`Text decoration (e.g. underline, line-through).`),textTransform:U().default(Mf.textTransform).describe(`Text transform: uppercase, lowercase, capitalize, none.`),fill:U().default(Mf.fill).describe(`Text color.`),align:U().default(Mf.align).describe(`Horizontal alignment (commonly left | center | right | justify).`),width:W().default(100).describe(`Width in pixels.`),height:W().default(0).describe(`Height in pixels (0 until measured/rendered).`),verticalAlign:U().default(`top`).describe(`Vertical alignment: top, middle, bottom.`),strokeWidth:W().default(Mf.strokeWidth).describe(`Stroke width in pixels.`),stroke:U().default(Mf.stroke).describe(`Stroke color.`),strokeLineJoin:U().default(Mf.strokeLineJoin).describe(`Stroke corner join: round, miter, bevel.`),lineHeight:Ud([W(),U()]).default(Mf.lineHeight).describe(`Line height multiplier or 'auto'.`),letterSpacing:W().default(Mf.letterSpacing).describe(`Letter spacing as a fraction of font size.`),backgroundEnabled:Md().default(!1).describe(`Whether the text background is enabled.`),backgroundColor:U().default(`#7ED321`).describe(`Text background color.`),backgroundOpacity:W().default(1).describe(`Text background opacity (0-1).`),backgroundCornerRadius:W().default(.5).describe(`Text background corner radius.`),backgroundPadding:W().default(.5).describe(`Text background padding.`),curveEnabled:Md().default(Mf.curveEnabled).describe(`Whether the text curve effect is enabled.`),curvePower:W().default(Mf.curvePower).describe(`Text curve power (-1 to 1, 0 = straight).`),legacyBackground:Md().optional().describe(`Internal compatibility flag stamped by the v2→v3 migration.`)},o={...r,...i,type:$d(`image`)},s={...r,type:$d(`svg`),src:U().default(``).describe(`URL or data URI of the SVG.`),maskSrc:U().default(``).describe(`URL or data URI for an SVG mask.`),cropX:W().default(0),cropY:W().default(0),cropWidth:W().default(1),cropHeight:W().default(1),keepRatio:Md().default(!0).describe(`Whether to maintain aspect ratio when resizing.`),stretchEnabled:Md().default(!0),flipX:Md().default(!1),flipY:Md().default(!1),width:W().default(100),height:W().default(100),borderColor:U().default(`black`),borderSize:W().default(0),cornerRadius:W().default(0),colorsReplace:Yd(U(),U()).default({}).describe(`Color replacement mappings (original → replacement).`)},c={...r,type:$d(`line`),width:W().default(400),height:W().default(10),color:U().default(`black`).describe(`Line color.`),dash:Rd(W()).default([]).describe(`Dash pattern array.`),startHead:U().default(``).describe(`Start arrow head: empty, arrow, circle, square, bar.`),endHead:U().default(``).describe(`End arrow head: empty, arrow, circle, square, bar.`)},l={...r,type:$d(`figure`),subType:U().default(`rect`).describe(`Figure subtype: rect, ellipse, triangle, etc.`),fill:U().default(`rgb(0, 161, 255)`).describe(`Fill color.`),dash:Rd(W()).default([]).describe(`Dash pattern array.`),strokeWidth:W().default(0),stroke:U().default(`rgba(98, 197, 255, 1)`),cornerRadius:W().default(0)},u={...r,...i,type:$d(`gif`),duration:W().default(0).describe(`GIF duration in milliseconds.`),keepRatio:Md().default(!0)},d={...r,...i,type:$d(`video`),duration:W().default(0).describe(`Video duration in milliseconds.`),startTime:W().default(0).describe(`Start offset (0-1).`),endTime:W().default(1).describe(`End offset (0-1).`),volume:W().default(1).describe(`Volume (0-1).`),speed:W().default(1).describe(`Playback speed multiplier (1 = normal).`)},f=e({color:U().optional().describe(`Border color for this side.`),width:W().optional().describe(`Border width in pixels for this side.`),style:Zd([`solid`,`dashed`,`dotted`,`none`]).optional().describe(`Border style for this side.`)}),p=e({id:U().describe(`Unique identifier for the cell.`),type:$d(`tablecell`).default(`tablecell`).describe(`Cell type identifier.`),text:U().default(``).describe(`Visible text shown in the cell.`),opacity:W().optional().describe(`Opacity level (0-1).`),rowSpan:W().optional().describe(`Number of rows this cell spans.`),colSpan:W().optional().describe(`Number of columns this cell spans.`),mergedInto:U().optional().describe(`Id of the cell this one is merged into, if any.`),name:U().optional().describe(`Display name for the cell.`),custom:Pd().optional().describe(`Custom data attached to the cell.`),borders:e({top:f.optional().describe(`Top border override for this cell.`),right:f.optional().describe(`Right border override for this cell.`),bottom:f.optional().describe(`Bottom border override for this cell.`),left:f.optional().describe(`Left border override for this cell.`)}).optional().describe(`Per-side border overrides for this cell.`),fontSize:W().overwrite(Nf).optional().describe(`Font size in pixels (inherits from the table when omitted, minimum 1).`),fontFamily:U().optional().describe(`Font family name (inherits from the table when omitted).`),fontWeight:U().optional().describe(`Font weight: 'normal', 'bold', or numeric string (inherits from the table when omitted).`),fontStyle:U().optional().describe(`Font style: 'normal' or 'italic' (inherits from the table when omitted).`),textDecoration:U().optional().describe(`Text decoration, e.g. underline, line-through (inherits from the table when omitted).`),textTransform:U().optional().describe(`Text transform: uppercase, lowercase, capitalize, none (inherits from the table when omitted).`),fill:U().optional().describe(`Text color (inherits from the table when omitted).`),align:U().optional().describe(`Horizontal alignment: left, center, right, justify (inherits from the table when omitted).`),verticalAlign:U().optional().describe(`Vertical alignment: top, middle, bottom (inherits from the table when omitted).`),lineHeight:Ud([W(),U()]).optional().describe(`Line height multiplier or 'auto' (inherits from the table when omitted).`),letterSpacing:W().optional().describe(`Letter spacing as a fraction of font size (inherits from the table when omitted).`),strokeWidth:W().optional().describe(`Stroke width in pixels (inherits from the table when omitted).`),stroke:U().optional().describe(`Stroke color (inherits from the table when omitted).`),cellBackground:U().optional().describe(`Cell background color (inherits from the table when omitted).`),cellPadding:W().optional().describe(`Cell padding in pixels (inherits from the table when omitted).`)}),{blurEnabled:m,blurRadius:h,brightnessEnabled:g,brightness:_,sepiaEnabled:v,grayscaleEnabled:y,filters:b,shadowEnabled:x,shadowBlur:S,shadowOffsetX:C,shadowOffsetY:w,shadowColor:T,shadowOpacity:E,...D}=r,O={...D,type:$d(`table`).describe(`Element type identifier.`),width:W().default(300).describe(`Width in pixels.`),height:W().default(200).describe(`Height in pixels.`),rows:W().default(3).describe(`Number of rows.`),cols:W().default(3).describe(`Number of columns.`),colWidths:Rd(W()).default([]).describe(`Column width fractions (sum to 1).`),rowHeights:Rd(W()).default([]).describe(`Row height fractions (sum to 1).`),cells:Rd(p).default([]).describe(`Flat cell array in row-major order.`),borderColor:U().default(`#000000`).describe(`Default border color for the table grid.`),borderWidth:W().default(1).describe(`Default border width in pixels.`),borderStyle:Zd([`solid`,`dashed`,`dotted`,`none`]).default(`solid`).describe(`Default border style.`),fontSize:W().overwrite(Nf).default(30).describe(`Default font size in pixels for cells (minimum 1).`),fontFamily:U().default(`Roboto`).describe(`Default font family name for cells.`),fontWeight:U().default(`normal`).describe(`Default font weight: 'normal', 'bold', or numeric string.`),fontStyle:U().default(`normal`).describe(`Default font style: 'normal' or 'italic'.`),textDecoration:U().default(``).describe(`Default text decoration (e.g. underline, line-through).`),textTransform:U().default(`none`).describe(`Default text transform: uppercase, lowercase, capitalize, none.`),fill:U().default(`black`).describe(`Default text color for cells.`),align:U().default(`center`).describe(`Default horizontal alignment: left, center, right, justify.`),verticalAlign:U().default(`middle`).describe(`Default vertical alignment: top, middle, bottom.`),lineHeight:Ud([W(),U()]).default(1.2).describe(`Default line height multiplier or 'auto'.`),letterSpacing:W().default(0).describe(`Default letter spacing as a fraction of font size.`),strokeWidth:W().default(0).describe(`Default stroke width in pixels.`),stroke:U().default(`black`).describe(`Default stroke color.`),cellBackground:U().default(`transparent`).describe(`Default cell background color.`),cellPadding:W().default(4).describe(`Default cell padding in pixels.`)},k=e=>({id:U(),type:$d(`group`),name:U().default(``),custom:Pd().optional(),opacity:W().default(1),visible:Md().default(!0),selectable:Md().default(!0),removable:Md().default(!0),alwaysOnTop:Md().default(!1),showInExport:Md().default(!0),animations:Rd(t).default([]),children:Rd(e).default([]).describe(`Child elements in this group.`)}),A=Sf(()=>Gd(`type`,[e(a),e(o),e(s),e(c),e(l),e(u),e(d),e(O),e(k(A))])),ee={fontFamily:U().describe(`Font family name.`),url:U().default(``).describe(`URL to load the font from (single-variant fonts).`),styles:Rd(e({src:U().describe(`Font source, typically in CSS url() form.`),fontStyle:U().optional(),fontWeight:U().optional()})).optional().describe(`Per-weight/style variants for multi-variant families.`)},j={id:U().describe(`Unique identifier for the audio track.`),name:U().default(``).describe(`Display name shown on the timeline.`),src:U().default(``).describe(`URL or data URI of the audio file.`),duration:W().default(0).describe(`Duration in milliseconds.`),startTime:W().default(0).describe(`Start offset (0-1).`),endTime:W().default(1).describe(`End offset (0-1).`),volume:W().default(1).describe(`Volume level (0-1).`),delay:W().default(0).describe(`Delay before playing, in milliseconds.`),speed:W().default(1).describe(`Playback speed multiplier (1 = normal).`),custom:Pd().optional()},M=e({id:U().describe(`Unique identifier for the page.`),width:Ud([W(),$d(`auto`)]).default(`auto`).describe(`Page width in pixels or 'auto'.`),height:Ud([W(),$d(`auto`)]).default(`auto`).describe(`Page height in pixels or 'auto'.`),background:U().default(`white`).describe(`Background color or image.`),bleed:W().default(0).describe(`Bleed area in pixels for print (all sides; base value for per-side overrides).`),bleedTop:W().optional().describe("Per-side bleed override (top), in pixels. Inherits `bleed` when omitted."),bleedRight:W().optional().describe("Per-side bleed override (right), in pixels. Inherits `bleed` when omitted."),bleedBottom:W().optional().describe("Per-side bleed override (bottom), in pixels. Inherits `bleed` when omitted."),bleedLeft:W().optional().describe("Per-side bleed override (left), in pixels. Inherits `bleed` when omitted."),custom:Pd().optional(),duration:W().default(5e3).describe(`Page duration in milliseconds.`),children:Rd(A).default([]).describe(`Elements on this page.`)});return{design:e({schemaVersion:W().default(4).describe(`Schema version for compatibility / migration.`),width:W().default(1080).describe(`Canvas width in pixels.`),height:W().default(1080).describe(`Canvas height in pixels.`),unit:Zd([`px`,`pt`,`mm`,`cm`,`in`]).default(`px`).describe(`Unit type for print measurements.`),dpi:W().default(72).describe(`Dots per inch for print calculations.`),custom:Pd().optional().describe(`Custom data attached to the design.`),fonts:Rd(e(ee)).default([]).describe(`Fonts used in the design.`),pages:Rd(M).default([]).describe(`Pages in the design.`),audios:Rd(e(j)).default([]).describe(`Audio tracks in the design.`)}),shapes:{text:a,image:o,svg:s,line:c,figure:l,gif:u,video:d,table:O,font:ee,audio:j}}}var If=Ff(Bd),Lf=If.design,Rf=Ff(Vd).design;Bd(If.shapes.text),Bd(If.shapes.image),Bd(If.shapes.svg),Bd(If.shapes.line),Bd(If.shapes.figure),Bd(If.shapes.gif),Bd(If.shapes.video),Bd(If.shapes.table),Bd(If.shapes.font),Bd(If.shapes.audio);function zf(e){return e.map(e=>({path:e.path.map(String).join(`.`),message:e.message}))}var Bf=new Set([`custom`,`data`]),Vf=new Set([`filters`,`colorsReplace`]);function Hf(e){if(Array.isArray(e))return e.filter(e=>e!=null).map(Hf);if(e&&typeof e==`object`){let t={};for(let n of Object.keys(e)){let r=e[n];r!=null&&(t[n]=Bf.has(n)?JSON.parse(JSON.stringify(r)):Vf.has(n)&&Array.isArray(r)?{}:Hf(r))}return t}return e}function Uf(e){throw Ef(`DESIGN_INVALID`,`Invalid Polotno design:\n${e.slice(0,10).map(e=>` ${e.path}: ${e.message}`).join(`
76
+ `)}`,{errors:e})}function Wf(e,t={}){let n=(t.mode===`canonical`?Rf:Lf).safeParse(Hf(e));return n.success||Uf(zf(n.error.issues)),n.data}var Gf=[`warm`,`cold`,`natural`],Kf=/<\/?(?:p|br|span|strong|em|ol|ul|li)\b[^>]*>/i;function qf(e){let t=!1;return Jf(e,e=>{t||e.type!==`text`||Kf.test(String(e.text??``))&&(t=!0)}),t}function Jf(e,t){if(!Array.isArray(e))return;let n=e=>{if(Array.isArray(e.children))for(let r of e.children)!r||typeof r!=`object`||(t(r),n(r));if(Array.isArray(e.cells))for(let n of e.cells)n&&typeof n==`object`&&t(n)};for(let t of e)t&&typeof t==`object`&&n(t)}function Yf(e,t={}){let{modernTextRenderer:n=!0,modernizeTextBackground:r}=t;if(!e||typeof e!=`object`)return e;let i=JSON.parse(JSON.stringify(e)),a=i.schemaVersion||0;return a<1&&n&&Jf(i.pages,e=>{if(e.type!==`text`)return;let{letterSpacing:t}=e;if(!Number.isFinite(t))return;let n=Number.isFinite(e.fontSize)?e.fontSize:Mf.fontSize;n!==0&&(e.letterSpacing=t*16/n)}),a<2&&Jf(i.pages,e=>{if(e.filters)for(let t of Object.keys(e.filters)){if(Gf.includes(t))continue;let n=e.filters[t];n&&typeof n.intensity==`number`&&(n.intensity/=100)}}),a<3&&n&&(r===void 0?qf(i.pages):!r)&&Jf(i.pages,e=>{e.type===`text`&&e.backgroundEnabled&&(e.legacyBackground=!0)}),i.schemaVersion=4,i}function Xf(e){if(!Array.isArray(e.pages))return;let t=new Set,n=e=>{e&&typeof e==`object`&&(typeof e.id==`string`&&e.id!==``&&t.add(e.id),Array.isArray(e.children)&&e.children.forEach(n),Array.isArray(e.cells)&&e.cells.forEach(n))};e.pages.forEach(n);let r=e=>{let n=e;for(let r=2;t.has(n);r++)n=`${e}_${r}`;return t.add(n),n},i=(e,t,n)=>{!e||typeof e!=`object`||((e.id==null||e.id===``)&&(e.id=r(`${t}-${n.join(`-`)}`)),Array.isArray(e.children)&&e.children.forEach((e,t)=>i(e,`el`,[...n,t])),Array.isArray(e.cells)&&e.cells.forEach((e,t)=>i(e,`cell`,[...n,t])))};e.pages.forEach((e,t)=>i(e,`page`,[t]))}var Zf=new Set(Pf);function Qf(e){let t=[],n=(e,r)=>{if(!e||!Array.isArray(e.children))return;let i=[],a=0;for(let o of e.children)o!=null&&(typeof o==`object`&&Zf.has(o.type)?(i.push(o),n(o,[...r,a])):typeof o==`object`&&typeof o.type==`string`?t.push({path:[...r,a],element:o}):i.push(o),a++);e.children=i};return Array.isArray(e.pages)&&e.pages.forEach((e,t)=>n(e,[t])),t}function $f(e,t){for(let{path:n,element:r}of t){let t=e.pages[n[0]].children;for(let e of n.slice(1,-1))t=t[e].children;t.splice(n[n.length-1],0,r)}}function ep(e,t){let n=(e,t)=>{for(let n of Object.keys(e))e[n]!=null&&!(n in t)&&(t[n]=e[n])},r=(e,t)=>{let r=0;for(let i of e){if(i==null)continue;let e=t[r++];typeof i==`object`&&e&&n(i,e)}},i=(e,t)=>{let a=0;for(let o of e){if(o==null)continue;let e=t[a++];if(!(typeof o!=`object`||!e)){if(!Zf.has(o.type)){t[a-1]={...o,id:e.id??o.id};continue}n(o,e),Array.isArray(o.children)&&Array.isArray(e.children)&&i(o.children,e.children),Array.isArray(o.cells)&&Array.isArray(e.cells)&&r(o.cells,e.cells)}}};if(n(e,t),Array.isArray(e.audios)&&Array.isArray(t.audios)&&r(e.audios,t.audios),!Array.isArray(e.pages))return;let a=0;for(let r of e.pages){if(r==null)continue;let e=t.pages[a++];typeof r!=`object`||!e||(n(r,e),Array.isArray(r.children)&&Array.isArray(e.children)&&i(r.children,e.children))}}function tp(e,t={}){let n=e,r=Yf(e),i=(t.preserveClientData||t.fillMissingIds)&&r&&typeof r==`object`,a=[];i&&(t.fillMissingIds&&Xf(r),t.preserveClientData&&(a=Qf(r)));let o=Wf(r,t);if(i&&t.preserveClientData&&(a.length&&$f(o,a),ep(n,o)),t.requirePages&&o.pages.length===0)throw Ef(`DESIGN_INVALID`,"Invalid Polotno design: no pages — did you pass `store.toJSON()`?",{errors:[{path:`pages`,message:`no pages`}]});return o}function np(e){let t=e.bleed||0;return{top:e.bleedTop??t,right:e.bleedRight??t,bottom:e.bleedBottom??t,left:e.bleedLeft??t}}var rp=Object.freeze({top:0,right:0,bottom:0,left:0}),ip=b,ap=n(((e,t)=>{t.exports=function(e){function t(e,t,n,r){return new ha(e,t,n,r)}function n(){}function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function a(e){if(i(e)!==e)throw Error(r(188))}function o(e){var t=e.alternate;if(!t){if(t=i(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,o=t;;){var s=n.return;if(s===null)break;var c=s.alternate;if(c===null){if(o=s.return,o!==null){n=o;continue}break}if(s.child===c.child){for(c=s.child;c;){if(c===n)return a(s),e;if(c===o)return a(s),t;c=c.sibling}throw Error(r(188))}if(n.return!==o.return)n=s,o=c;else{for(var l=!1,u=s.child;u;){if(u===n){l=!0,n=s,o=c;break}if(u===o){l=!0,o=s,n=c;break}u=u.sibling}if(!l){for(u=c.child;u;){if(u===n){l=!0,n=c,o=s;break}if(u===o){l=!0,o=c,n=s;break}u=u.sibling}if(!l)throw Error(r(189))}}if(n.alternate!==o)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function s(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=s(e),t!==null)return t;e=e.sibling}return null}function c(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(e.tag!==4&&(t=c(e),t!==null))return t;e=e.sibling}return null}function l(e){return typeof e!=`object`||!e?null:(e=Ya&&e[Ya]||e[`@@iterator`],typeof e==`function`?e:null)}function u(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===Xa?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case V:return`Fragment`;case za:return`Profiler`;case Ra:return`StrictMode`;case Ua:return`Suspense`;case Wa:return`SuspenseList`;case qa:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case La:return`Portal`;case Va:return e.displayName||`Context`;case Ba:return(e._context.displayName||`Context`)+`.Consumer`;case Ha:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case Ga:return t=e.displayName||null,t===null?u(e.type)||`Memo`:t;case Ka:t=e._payload,e=e._init;try{return u(e(t))}catch{}}return null}function d(e){return{current:e}}function f(e){0>_c||(e.current=gc[_c],gc[_c]=null,_c--)}function p(e,t){_c++,gc[_c]=e.current,e.current=t}function m(e){return e>>>=0,e===0?32:31-(bc(e)/xc|0)|0}function h(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function g(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=h(n))):i=h(o):i=h(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=h(n))):i=h(o)):i=h(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function _(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function v(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 y(){var e=wc;return wc<<=1,!(wc&62914560)&&(wc=4194304),e}function b(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function x(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function S(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-yc(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&w(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function w(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-yc(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function E(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-yc(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function D(e,t){var n=t&-t;return n=n&42?1:O(n),(n&(e.suspendedLanes|t))===0?n:0}function O(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function k(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function A(e){if(typeof Pc==`function`&&Fc(e),Lc&&typeof Lc.setStrictMode==`function`)try{Lc.setStrictMode(Ic,e)}catch{}}function ee(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}function j(e){if(Vc===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Vc=t&&t[1]||``,Hc=-1<e.stack.indexOf(`
77
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
78
+ `+Vc+e+Hc}function M(e,t){if(!e||Uc)return``;Uc=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
79
+ `),l=s.split(`
80
+ `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
81
+ `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Uc=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?j(n):``}function N(e,t){switch(e.tag){case 26:case 27:case 5:return j(e.type);case 16:return j(`Lazy`);case 13:return e.child!==t&&t!==null?j(`Suspense Fallback`):j(`Suspense`);case 19:return j(`SuspenseList`);case 0:case 15:return M(e.type,!1);case 11:return M(e.type.render,!1);case 1:return M(e.type,!0);case 31:return j(`Activity`);default:return``}}function P(e){try{var t=``,n=null;do t+=N(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
82
+ Error generating stack: `+e.message+`
83
+ `+e.stack}}function F(e,t){if(typeof e==`object`&&e){var n=Wc.get(e);return n===void 0?(t={value:e,source:t,stack:P(t)},Wc.set(e,t),t):n}return{value:e,source:t,stack:P(t)}}function I(e,t){Gc[Kc++]=Jc,Gc[Kc++]=qc,qc=e,Jc=t}function te(e,t,n){Yc[Xc++]=Qc,Yc[Xc++]=$c,Yc[Xc++]=Zc,Zc=e;var r=Qc;e=$c;var i=32-yc(r)-1;r&=~(1<<i),n+=1;var a=32-yc(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Qc=1<<32-yc(t)+i|n<<i|r,$c=a+e}else Qc=1<<a|n<<i|r,$c=e}function ne(e){e.return!==null&&(I(e,1),te(e,1,0))}function L(e){for(;e===qc;)qc=Gc[--Kc],Gc[Kc]=null,Jc=Gc[--Kc],Gc[Kc]=null;for(;e===Zc;)Zc=Yc[--Xc],Yc[Xc]=null,$c=Yc[--Xc],Yc[Xc]=null,Qc=Yc[--Xc],Yc[Xc]=null}function R(e,t){Yc[Xc++]=Qc,Yc[Xc++]=$c,Yc[Xc++]=Zc,Qc=t.id,$c=t.overflow,Zc=e}function re(e,t){p(nl,t),p(tl,e),p(el,null),e=ro(t),f(el),p(el,e)}function ie(){f(el),f(tl),f(nl)}function ae(e){e.memoizedState!==null&&p(rl,e);var t=el.current,n=io(t,e.type);t!==n&&(p(tl,e),p(el,n))}function oe(e){tl.current===e&&(f(el),f(tl)),rl.current===e&&(f(rl),ho?Po._currentValue=No:Po._currentValue2=No)}function se(e){throw pe(F(Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ll}function ce(e,t){if(!vo)throw Error(r(175));js(e.stateNode,e.type,e.memoizedProps,t,e)||se(e,!0)}function le(e){for(il=e.return;il;)switch(il.tag){case 5:case 31:case 13:cl=!1;return;case 27:case 3:cl=!0;return;default:il=il.return}}function ue(e){if(!vo||e!==il)return!1;if(!ol)return le(e),ol=!0,!1;var t=e.tag;if(uc?t!==3&&t!==27&&(t!==5||qs(e.type)&&!lo(e.type,e.memoizedProps))&&al&&se(e):t!==3&&(t!==5||qs(e.type)&&!lo(e.type,e.memoizedProps))&&al&&se(e),le(e),t===13){if(!vo)throw Error(r(316));if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));al=Is(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));al=Fs(e)}else al=uc&&t===27?xs(e.type,al):il?bs(e.stateNode):null;return!0}function de(){vo&&(al=il=null,ol=!1)}function fe(){var e=sl;return e!==null&&(qu===null?qu=e:qu.push.apply(qu,e),sl=null),e}function pe(e){sl===null?sl=[e]:sl.push(e)}function me(e,t,n){ho?(p(ul,t._currentValue),t._currentValue=n):(p(ul,t._currentValue2),t._currentValue2=n)}function he(e){var t=ul.current;ho?e._currentValue=t:e._currentValue2=t,f(ul)}function ge(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function _e(e,t,n,i){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),ge(o.return,n,e),i||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(r(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),ge(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function ve(e,t,n,i){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(r(387));if(s=s.memoizedProps,s!==null){var c=a.type;Rc(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===rl.current){if(s=a.alternate,s===null)throw Error(r(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[Po]:e.push(Po))}a=a.return}e!==null&&_e(t,e,n,i),t.flags|=262144}function ye(e){for(e=e.firstContext;e!==null;){var t=e.context;if(!Rc(ho?t._currentValue:t._currentValue2,e.memoizedValue))return!0;e=e.next}return!1}function be(e){dl=e,fl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function xe(e){return Ce(dl,e)}function Se(e,t){return dl===null&&be(e),Ce(e,t)}function Ce(e,t){var n=ho?t._currentValue:t._currentValue2;if(t={context:t,memoizedValue:n,next:null},fl===null){if(e===null)throw Error(r(308));fl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else fl=fl.next=t;return n}function we(){return{controller:new pl,data:new Map,refCount:0}}function Te(e){e.refCount--,e.refCount===0&&ml(hl,function(){e.controller.abort()})}function Ee(){}function De(e){e!==vl&&e.next===null&&(vl===null?_l=vl=e:vl=vl.next=e),bl=!0,yl||(yl=!0,Pe())}function Oe(e,t){if(!xl&&bl){xl=!0;do for(var n=!1,r=_l;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-yc(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Ne(r,a))}else a=Nu,a=g(r,r===ju?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==mo),!(a&3)||_(r,a)||(n=!0,Ne(r,a))}r=r.next}while(n);xl=!1}}function ke(){Ae()}function Ae(){bl=yl=!1;var e=0;Sl!==0&&wo()&&(e=Sl);for(var t=kc(),n=null,r=_l;r!==null;){var i=r.next,a=je(r,t);a===0?(r.next=null,n===null?_l=i:n.next=i,i===null&&(vl=n)):(n=r,(e!==0||a&3)&&(bl=!0)),r=i}ed!==0&&ed!==5||Oe(e,!1),Sl!==0&&(Sl=0)}function je(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-yc(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=v(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=ju,n=Nu,n=g(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==mo),r=e.callbackNode,n===0||e===t&&(Pu===2||Pu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ec(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||_(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ec(r),k(n)){case 2:case 8:n=jc;break;case 32:n=Mc;break;case 268435456:n=Nc;break;default:n=Mc}return r=Me.bind(null,e),n=Tc(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ec(r),e.callbackPriority=2,e.callbackNode=null,2}function Me(e,t){if(ed!==0&&ed!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(aa()&&e.callbackNode!==n)return null;var r=Nu;return r=g(e,e===ju?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==mo),r===0?null:(Ni(e,r,t),je(e,kc()),e.callbackNode!=null&&e.callbackNode===n?Me.bind(null,e):null)}function Ne(e,t){if(aa())return null;Ni(e,t,!0)}function Pe(){Io?Lo(function(){Au&6?Tc(Ac,ke):Ae()}):Tc(Ac,ke)}function Fe(){if(Sl===0){var e=Tl;e===0&&(e=Sc,Sc<<=1,!(Sc&261888)&&(Sc=256)),Sl=e}return Sl}function Ie(e,t){if(Cl===null){var n=Cl=[];wl=0,Tl=Fe(),El={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return wl++,t.then(Le,Le),t}function Le(){if(--wl===0&&Cl!==null){El!==null&&(El.status=`fulfilled`);var e=Cl;Cl=null,Tl=0,El=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Re(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}function ze(){var e=Ol.current;return e===null?ju.pooledCache:e}function Be(e,t){t===null?p(Ol,Ol.current):p(Ol,t.pool)}function Ve(){var e=ze();return e===null?null:{parent:ho?gl._currentValue:gl._currentValue2,pool:e}}function He(e,t){if(Rc(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Bc.call(t,i)||!Rc(e[i],t[i]))return!1}return!0}function Ue(e){return e=e.status,e===`fulfilled`||e===`rejected`}function We(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Ee,Ee),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,qe(e),e;default:if(typeof t.status==`string`)t.then(Ee,Ee);else{if(e=ju,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,qe(e),e}throw Nl=t,kl}}function Ge(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Nl=e,kl):e}}function Ke(){if(Nl===null)throw Error(r(459));var e=Nl;return Nl=null,e}function qe(e){if(e===kl||e===jl)throw Error(r(483))}function Je(e){var t=Fl;return Fl+=1,Pl===null&&(Pl=[]),We(Pl,e,t)}function z(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ye(e,t){throw t.$$typeof===Fa?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Xe(e){function n(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function i(t,r){if(!e)return null;for(;r!==null;)n(t,r),r=r.sibling;return null}function a(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function o(e,t){return e=_a(e,t),e.index=0,e.sibling=null,e}function s(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function c(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function u(e,t,n,r){return t===null||t.tag!==6?(t=xa(n,e.mode,r),t.return=e,t):(t=o(t,n),t.return=e,t)}function d(e,t,n,r){var i=n.type;return i===V?p(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===Ka&&Ge(i)===t.type)?(t=o(t,n.props),z(t,n),t.return=e,t):(t=ya(n.type,n.key,n.props,null,e.mode,r),z(t,n),t.return=e,t)}function f(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Ca(n,e.mode,r),t.return=e,t):(t=o(t,n.children||[]),t.return=e,t)}function p(e,t,n,r,i){return t===null||t.tag!==7?(t=ba(n,e.mode,r,i),t.return=e,t):(t=o(t,n),t.return=e,t)}function m(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=xa(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case Ia:return n=ya(t.type,t.key,t.props,null,e.mode,n),z(n,t),n.return=e,n;case La:return t=Ca(t,e.mode,n),t.return=e,t;case Ka:return t=Ge(t),m(e,t,n)}if(Za(t)||l(t))return t=ba(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return m(e,Je(t),n);if(t.$$typeof===Va)return m(e,Se(e,t),n);Ye(e,t)}return null}function h(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?u(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case Ia:return n.key===i?d(e,t,n,r):null;case La:return n.key===i?f(e,t,n,r):null;case Ka:return n=Ge(n),h(e,t,n,r)}if(Za(n)||l(n))return i===null?p(e,t,n,r,null):null;if(typeof n.then==`function`)return h(e,t,Je(n),r);if(n.$$typeof===Va)return h(e,t,Se(e,n),r);Ye(e,n)}return null}function g(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,u(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case Ia:return e=e.get(r.key===null?n:r.key)||null,d(t,e,r,i);case La:return e=e.get(r.key===null?n:r.key)||null,f(t,e,r,i);case Ka:return r=Ge(r),g(e,t,n,r,i)}if(Za(r)||l(r))return e=e.get(n)||null,p(t,e,r,i,null);if(typeof r.then==`function`)return g(e,t,n,Je(r),i);if(r.$$typeof===Va)return g(e,t,n,Se(t,r),i);Ye(t,r)}return null}function _(t,r,o,c){for(var l=null,u=null,d=r,f=r=0,p=null;d!==null&&f<o.length;f++){d.index>f?(p=d,d=null):p=d.sibling;var _=h(t,d,o[f],c);if(_===null){d===null&&(d=p);break}e&&d&&_.alternate===null&&n(t,d),r=s(_,r,f),u===null?l=_:u.sibling=_,u=_,d=p}if(f===o.length)return i(t,d),ol&&I(t,f),l;if(d===null){for(;f<o.length;f++)d=m(t,o[f],c),d!==null&&(r=s(d,r,f),u===null?l=d:u.sibling=d,u=d);return ol&&I(t,f),l}for(d=a(d);f<o.length;f++)p=g(d,t,f,o[f],c),p!==null&&(e&&p.alternate!==null&&d.delete(p.key===null?f:p.key),r=s(p,r,f),u===null?l=p:u.sibling=p,u=p);return e&&d.forEach(function(e){return n(t,e)}),ol&&I(t,f),l}function v(t,o,c,l){if(c==null)throw Error(r(151));for(var u=null,d=null,f=o,p=o=0,_=null,v=c.next();f!==null&&!v.done;p++,v=c.next()){f.index>p?(_=f,f=null):_=f.sibling;var y=h(t,f,v.value,l);if(y===null){f===null&&(f=_);break}e&&f&&y.alternate===null&&n(t,f),o=s(y,o,p),d===null?u=y:d.sibling=y,d=y,f=_}if(v.done)return i(t,f),ol&&I(t,p),u;if(f===null){for(;!v.done;p++,v=c.next())v=m(t,v.value,l),v!==null&&(o=s(v,o,p),d===null?u=v:d.sibling=v,d=v);return ol&&I(t,p),u}for(f=a(f);!v.done;p++,v=c.next())v=g(f,t,p,v.value,l),v!==null&&(e&&v.alternate!==null&&f.delete(v.key===null?p:v.key),o=s(v,o,p),d===null?u=v:d.sibling=v,d=v);return e&&f.forEach(function(e){return n(t,e)}),ol&&I(t,p),u}function y(e,t,a,s){if(typeof a==`object`&&a&&a.type===V&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case Ia:a:{for(var u=a.key;t!==null;){if(t.key===u){if(u=a.type,u===V){if(t.tag===7){i(e,t.sibling),s=o(t,a.props.children),s.return=e,e=s;break a}}else if(t.elementType===u||typeof u==`object`&&u&&u.$$typeof===Ka&&Ge(u)===t.type){i(e,t.sibling),s=o(t,a.props),z(s,a),s.return=e,e=s;break a}i(e,t);break}n(e,t),t=t.sibling}a.type===V?(s=ba(a.props.children,e.mode,s,a.key),s.return=e,e=s):(s=ya(a.type,a.key,a.props,null,e.mode,s),z(s,a),s.return=e,e=s)}return c(e);case La:a:{for(u=a.key;t!==null;){if(t.key===u){if(t.tag===4&&t.stateNode.containerInfo===a.containerInfo&&t.stateNode.implementation===a.implementation){i(e,t.sibling),s=o(t,a.children||[]),s.return=e,e=s;break a}i(e,t);break}n(e,t),t=t.sibling}s=Ca(a,e.mode,s),s.return=e,e=s}return c(e);case Ka:return a=Ge(a),y(e,t,a,s)}if(Za(a))return _(e,t,a,s);if(l(a)){if(u=l(a),typeof u!=`function`)throw Error(r(150));return a=u.call(a),v(e,t,a,s)}if(typeof a.then==`function`)return y(e,t,Je(a),s);if(a.$$typeof===Va)return y(e,t,Se(e,a),s);Ye(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,t!==null&&t.tag===6?(i(e,t.sibling),s=o(t,a),s.return=e,e=s):(i(e,t),s=xa(a,e.mode,s),s.return=e,e=s),c(e)):i(e,t)}return function(e,n,r,i){try{Fl=0;var a=y(e,n,r,i);return Pl=null,a}catch(n){if(n===kl||n===jl)throw n;var o=t(29,n,null,e.mode);return o.lanes=i,o.return=e,o}}}function Ze(){for(var e=zl,t=Bl=zl=0;t<e;){var n=Rl[t];Rl[t++]=null;var r=Rl[t];Rl[t++]=null;var i=Rl[t];Rl[t++]=null;var a=Rl[t];if(Rl[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&tt(n,i,a)}}function Qe(e,t,n,r){Rl[zl++]=e,Rl[zl++]=t,Rl[zl++]=n,Rl[zl++]=r,Bl|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function $e(e,t,n,r){return Qe(e,t,n,r),nt(e)}function et(e,t){return Qe(e,null,null,t),nt(e)}function tt(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-yc(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function nt(e){if(50<sd)throw sd=0,U=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}function rt(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function it(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function at(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ot(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Au&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=nt(e),tt(e,null,n),t}return Qe(e,r,t,n),nt(e)}function st(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,E(e,n)}}function ct(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function lt(){if(Hl){var e=El;if(e!==null)throw e}}function ut(e,t,n,r){Hl=!1;var i=e.updateQueue;Vl=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Nu&f)===f:(r&f)===f){f!==0&&f===Tl&&(Hl=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=Pa({},d,f);break a;case 2:Vl=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Vu|=o,e.lanes=o,e.memoizedState=d}}function dt(e,t){if(typeof e!=`function`)throw Error(r(191,e));e.call(t)}function ft(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)dt(n[e],t)}function pt(e,t){e=zu,p(Wl,e),p(Ul,t),zu=e|t.baseLanes}function mt(){p(Wl,zu),p(Ul,Ul.current)}function ht(){zu=Wl.current,f(Ul),f(Wl)}function gt(e){var t=e.alternate;p(ql,ql.current&1),p(Gl,e),Kl===null&&(t===null||Ul.current!==null||t.memoizedState!==null)&&(Kl=e)}function _t(e){p(ql,ql.current),p(Gl,e),Kl===null&&(Kl=e)}function vt(e){e.tag===22?(p(ql,ql.current),p(Gl,e),Kl===null&&(Kl=e)):yt(e)}function yt(){p(ql,ql.current),p(Gl,Gl.current)}function bt(e){f(Gl),Kl===e&&(Kl=null),f(ql)}function xt(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||ms(n)||hs(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function St(){throw Error(r(321))}function Ct(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Rc(e[n],t[n]))return!1;return!0}function wt(e,t,n,r,i,a){return Jl=a,Yl=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Qa.H=e===null||e.memoizedState===null?ou:su,eu=!1,a=n(r,i),eu=!1,$l&&(a=Et(t,n,r,i)),Tt(e),a}function Tt(e){Qa.H=au;var t=Xl!==null&&Xl.next!==null;if(Jl=0,Zl=Xl=Yl=null,Ql=!1,nu=0,ru=null,t)throw Error(r(300));e===null||du||(e=e.dependencies,e!==null&&ye(e)&&(du=!0))}function Et(e,t,n,i){Yl=e;var a=0;do{if($l&&(ru=null),nu=0,$l=!1,25<=a)throw Error(r(301));if(a+=1,Zl=Xl=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}Qa.H=cu,o=t(n,i)}while($l);return o}function Dt(){var e=Qa.H,t=e.useState()[0];return t=typeof t.then==`function`?Pt(t):t,e=e.useState()[0],(Xl===null?null:Xl.memoizedState)!==e&&(Yl.flags|=1024),t}function Ot(){var e=tu!==0;return tu=0,e}function kt(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function At(e){if(Ql){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ql=!1}Jl=0,Zl=Xl=Yl=null,$l=!1,nu=tu=0,ru=null}function jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zl===null?Yl.memoizedState=Zl=e:Zl=Zl.next=e,Zl}function Mt(){if(Xl===null){var e=Yl.alternate;e=e===null?null:e.memoizedState}else e=Xl.next;var t=Zl===null?Yl.memoizedState:Zl.next;if(t!==null)Zl=t,Xl=e;else{if(e===null)throw Yl.alternate===null?Error(r(467)):Error(r(310));Xl=e,e={memoizedState:Xl.memoizedState,baseState:Xl.baseState,baseQueue:Xl.baseQueue,queue:Xl.queue,next:null},Zl===null?Yl.memoizedState=Zl=e:Zl=Zl.next=e}return Zl}function Nt(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Pt(e){var t=nu;return nu+=1,ru===null&&(ru=[]),e=We(ru,e,t),t=Yl,(Zl===null?t.memoizedState:Zl.next)===null&&(t=t.alternate,Qa.H=t===null||t.memoizedState===null?ou:su),e}function Ft(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Pt(e);if(e.$$typeof===Va)return xe(e)}throw Error(r(438,String(e)))}function It(e){var t=null,n=Yl.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Yl.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Nt(),Yl.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=Ja;return t.index++,n}function Lt(e,t){return typeof t==`function`?t(e):t}function Rt(e){return zt(Mt(),Xl,e)}function zt(e,t,n){var i=e.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=n;var a=e.baseQueue,o=i.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,i.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Jl&f)===f:(Nu&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===Tl&&(d=!0);else if((Jl&p)===p){u=u.next,p===Tl&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,Yl.lanes|=p,Vu|=p;f=u.action,eu&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,Yl.lanes|=f,Vu|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Rc(o,e.memoizedState)&&(du=!0,d&&(n=El,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,i.lastRenderedState=o}return a===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Bt(e){var t=Mt(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Rc(o,t.memoizedState)||(du=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Vt(e,t,n){var i=Yl,a=Mt(),o=ol;if(o){if(n===void 0)throw Error(r(407));n=n()}else n=t();var s=!Rc((Xl||a).memoizedState,n);if(s&&(a.memoizedState=n,du=!0),a=a.queue,pn(Wt.bind(null,i,a,e),[e]),a.getSnapshot!==t||s||Zl!==null&&Zl.memoizedState.tag&1){if(i.flags|=2048,cn(9,{destroy:void 0},Ut.bind(null,i,a,n,t),null),ju===null)throw Error(r(349));o||Jl&127||Ht(i,t,n)}return n}function Ht(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Yl.updateQueue,t===null?(t=Nt(),Yl.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ut(e,t,n,r){t.value=n,t.getSnapshot=r,Gt(t)&&Kt(e)}function Wt(e,t,n){return n(function(){Gt(t)&&Kt(e)})}function Gt(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Rc(e,n)}catch{return!0}}function Kt(e){var t=et(e,2);t!==null&&Mi(t,e,2)}function qt(e){var t=jt();if(typeof e==`function`){var n=e;if(e=n(),eu){A(!0);try{n()}finally{A(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lt,lastRenderedState:e},t}function Jt(e,t,n,r){return e.baseState=n,zt(e,Xl,typeof r==`function`?r:Lt)}function Yt(e,t,n,i,a){if(Fn(e))throw Error(r(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};Qa.T===null?o.isTransition=!1:n(!0),i(o),n=t.pending,n===null?(o.next=t.pending=o,Xt(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Xt(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=Qa.T,o={};Qa.T=o;try{var s=n(i,r),c=Qa.S;c!==null&&c(o,s),Zt(e,t,s)}catch(n){$t(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),Qa.T=a}}else try{a=n(i,r),Zt(e,t,a)}catch(n){$t(e,t,n)}}function Zt(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Qt(e,t,n)},function(n){return $t(e,t,n)}):Qt(e,t,n)}function Qt(e,t,n){t.status=`fulfilled`,t.value=n,en(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Xt(e,n)))}function $t(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,en(t),t=t.next;while(t!==r)}e.action=null}function en(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function tn(e,t){return t}function nn(e,t){if(ol){var n=ju.formState;if(n!==null){a:{var r=Yl;if(ol){if(al){var i=vs(al,cl);if(i){al=bs(i),r=ys(i);break a}}se(r)}r=!1}r&&(t=n[0])}}n=jt(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tn,lastRenderedState:t},n.queue=r,n=Mn.bind(null,Yl,r),r.dispatch=n,r=qt(!1);var a=Pn.bind(null,Yl,!1,r.queue);return r=jt(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Yt.bind(null,Yl,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function rn(e){return an(Mt(),Xl,e)}function an(e,t,n){if(t=zt(e,t,tn)[0],e=Rt(Lt)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Pt(t)}catch(e){throw e===kl?jl:e}else r=t;t=Mt();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(Yl.flags|=2048,cn(9,{destroy:void 0},on.bind(null,i,n),null)),[r,a,e]}function on(e,t){e.action=t}function sn(e){var t=Mt(),n=Xl;if(n!==null)return an(t,n,e);Mt(),t=t.memoizedState,n=Mt();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function cn(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Yl.updateQueue,t===null&&(t=Nt(),Yl.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ln(){return Mt().memoizedState}function un(e,t,n,r){var i=jt();Yl.flags|=e,i.memoizedState=cn(1|t,{destroy:void 0},n,r===void 0?null:r)}function dn(e,t,n,r){var i=Mt();r=r===void 0?null:r;var a=i.memoizedState.inst;Xl!==null&&r!==null&&Ct(r,Xl.memoizedState.deps)?i.memoizedState=cn(t,a,n,r):(Yl.flags|=e,i.memoizedState=cn(1|t,a,n,r))}function fn(e,t){un(8390656,8,e,t)}function pn(e,t){dn(2048,8,e,t)}function mn(e){Yl.flags|=4;var t=Yl.updateQueue;if(t===null)t=Nt(),Yl.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function hn(e){var t=Mt().memoizedState;return mn({ref:t,nextImpl:e}),function(){if(Au&2)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function gn(e,t){return dn(4,2,e,t)}function _n(e,t){return dn(4,4,e,t)}function vn(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function yn(e,t,n){n=n==null?null:n.concat([e]),dn(4,4,vn.bind(null,t,e),n)}function bn(){}function xn(e,t){var n=Mt();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Ct(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Sn(e,t){var n=Mt();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Ct(t,r[1]))return r[0];if(r=e(),eu){A(!0);try{e()}finally{A(!1)}}return n.memoizedState=[r,t],r}function Cn(e,t,n){return n===void 0||Jl&1073741824&&!(Nu&261930)?e.memoizedState=t:(e.memoizedState=n,e=ji(),Yl.lanes|=e,Vu|=e,n)}function wn(e,t,n,r){return Rc(n,t)?n:Ul.current===null?!(Jl&42)||Jl&1073741824&&!(Nu&261930)?(du=!0,e.memoizedState=n):(e=ji(),Yl.lanes|=e,Vu|=e,t):(e=Cn(e,n,r),Rc(e,t)||(du=!0),e)}function Tn(e,t,n,r,i){var a=So();xo(a!==0&&8>a?a:8);var o=Qa.T,s={};Qa.T=s,Pn(e,!1,t,n);try{var c=i(),l=Qa.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Nn(e,t,Re(c,r),Ai(e)):Nn(e,t,r,Ai(e))}catch(n){Nn(e,t,{then:function(){},status:`rejected`,reason:n},Ai())}finally{xo(a),o!==null&&s.types!==null&&(o.types=s.types),Qa.T=o}}function En(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:No,baseState:No,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lt,lastRenderedState:No},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lt,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Dn(){return xe(Po)}function On(){return Mt().memoizedState}function kn(){return Mt().memoizedState}function An(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Ai();e=at(n);var r=ot(t,e,n);r!==null&&(Mi(r,t,n),st(r,t,n)),t={cache:we()},e.payload=t;return}t=t.return}}function jn(e,t,n){var r=Ai();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Fn(e)?In(t,n):(n=$e(e,t,n,r),n!==null&&(Mi(n,e,r),B(n,t,r)))}function Mn(e,t,n){Nn(e,t,n,Ai())}function Nn(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Fn(e))In(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Rc(s,o))return Qe(e,t,i,0),ju===null&&Ze(),!1}catch{}if(n=$e(e,t,i,r),n!==null)return Mi(n,e,r),B(n,t,r),!0}return!1}function Pn(e,t,n,i){if(i={lane:2,revertLane:Fe(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Fn(e)){if(t)throw Error(r(479))}else t=$e(e,n,i,2),t!==null&&Mi(t,e,2)}function Fn(e){var t=e.alternate;return e===Yl||t!==null&&t===Yl}function In(e,t){$l=Ql=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function B(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,E(e,n)}}function Ln(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Pa({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}function Rn(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!He(n,r)||!He(i,a):!0}function zn(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&lu.enqueueReplaceState(t,t.state,null)}function Bn(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=Pa({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Vn(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Hn(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Un(e,t,n){return n=at(n),n.tag=3,n.payload={element:null},n.callback=function(){Vn(e,t)},n}function Wn(e){return e=at(e),e.tag=3,e}function Gn(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Hn(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Hn(t,n,r),typeof i!=`function`&&($u===null?$u=new Set([this]):$u.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Kn(e,t,n,i,a){if(n.flags|=32768,typeof i==`object`&&i&&typeof i.then==`function`){if(t=n.alternate,t!==null&&ve(t,n,a,!0),n=Gl.current,n!==null){switch(n.tag){case 31:case 13:return Kl===null?Wi():n.alternate===null&&Bu===0&&(Bu=3),n.flags&=-257,n.flags|=65536,n.lanes=a,i===Ml?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([i]):t.add(i),la(e,i,a)),!1;case 22:return n.flags|=65536,i===Ml?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([i]):n.add(i)),la(e,i,a)),!1}throw Error(r(435,n.tag))}return la(e,i,a),Wi(),!1}if(ol)return t=Gl.current,t===null?(i!==ll&&(t=Error(r(423),{cause:i}),pe(F(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,i=F(i,n),a=Un(e.stateNode,i,a),ct(e,a),Bu!==4&&(Bu=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,i!==ll&&(e=Error(r(422),{cause:i}),pe(F(e,n)))),!1;var o=Error(r(520),{cause:i});if(o=F(o,n),Ku===null?Ku=[o]:Ku.push(o),Bu!==4&&(Bu=2),t===null)return!0;i=F(i,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Un(n.stateNode,i,e),ct(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&($u===null||!$u.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Wn(a),Gn(a,e,n,i),ct(n,a),!1}n=n.return}while(n!==null);return!1}function qn(e,t,n,r){t.child=e===null?Ll(t,null,n,r):Il(t,e.child,n,r)}function Jn(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return be(t),r=wt(e,t,n,o,a,i),s=Ot(),e!==null&&!du?(kt(e,t,i),_r(e,t,i)):(ol&&s&&ne(t),t.flags|=1,qn(e,t,r,i),t.child)}function Yn(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ga(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Xn(e,t,a,r,i)):(e=ya(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!vr(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?He:n,n(o,r)&&e.ref===t.ref)return _r(e,t,i)}return t.flags|=1,e=_a(a,r),e.ref=t.ref,e.return=t,t.child=e}function Xn(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(He(a,r)&&e.ref===t.ref){if(du=!1,t.pendingProps=r=a,vr(e,i))e.flags&131072&&(du=!0);else return t.lanes=e.lanes,_r(e,t,i)}}return ir(e,t,n,r,i)}function Zn(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return $n(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Be(t,a===null?null:a.cachePool),a===null?mt():pt(t,a),vt(t);else return r=t.lanes=536870912,$n(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Be(t,null),mt(),yt(t)):(Be(t,a.cachePool),pt(t,a),yt(t),t.memoizedState=null);return qn(e,t,i,n),t.child}function Qn(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function $n(e,t,n,r,i){var a=ze();return a=a===null?null:{parent:ho?gl._currentValue:gl._currentValue2,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Be(t,null),mt(),vt(t),e!==null&&ve(e,t,r,!0),t.childLanes=i,null}function er(e,t){return t=fr({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function tr(e,t,n){return Il(t,e.child,null,n),e=er(t,t.pendingProps),e.flags|=2,bt(t),t.memoizedState=null,e}function nr(e,t,n){var i=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(ol){if(i.mode===`hidden`)return e=er(t,i),t.lanes=536870912,Qn(null,e);if(_t(t),(e=al)?(e=ks(e,cl),e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zc===null?null:{id:Qc,overflow:$c},retryLane:536870912,hydrationErrors:null},n=Sa(e),n.return=t,t.child=n,il=t,al=null)):e=null,e===null)throw se(t);return t.lanes=536870912,null}return er(t,i)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(_t(t),a){if(t.flags&256)t.flags&=-257,t=tr(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558))}else if(du||ve(e,t,n,!1),a=(n&e.childLanes)!==0,du||a){if(i=ju,i!==null&&(s=D(i,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,et(e,s),Mi(i,e,s),uu;Wi(),t=tr(e,t,n)}else e=o.treeContext,vo&&(al=ws(s),il=t,ol=!0,sl=null,cl=!1,e!==null&&R(t,e)),t=er(t,i),t.flags|=4096;return t}return e=_a(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function rr(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(r(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function ir(e,t,n,r,i){return be(t),n=wt(e,t,n,r,void 0,i),r=Ot(),e!==null&&!du?(kt(e,t,i),_r(e,t,i)):(ol&&r&&ne(t),t.flags|=1,qn(e,t,n,i),t.child)}function ar(e,t,n,r,i,a){return be(t),t.updateQueue=null,n=Et(t,r,n,i),Tt(e),r=Ot(),e!==null&&!du?(kt(e,t,a),_r(e,t,a)):(ol&&r&&ne(t),t.flags|=1,qn(e,t,n,a),t.child)}function or(e,t,n,r,i){if(be(t),t.stateNode===null){var a=vc,o=n.contextType;typeof o==`object`&&o&&(a=xe(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=lu,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},rt(t),o=n.contextType,a.context=typeof o==`object`&&o?xe(o):vc,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ln(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&lu.enqueueReplaceState(a,a.state,null),ut(t,r,a,i),lt(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Bn(n,s);a.props=c;var l=a.context,u=n.contextType;o=vc,typeof u==`object`&&u&&(o=xe(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&zn(t,a,r,o),Vl=!1;var f=t.memoizedState;a.state=f,ut(t,r,a,i),lt(),l=t.memoizedState,s||f!==l||Vl?(typeof d==`function`&&(Ln(t,n,d,r),l=t.memoizedState),(c=Vl||Rn(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,it(e,t),o=t.memoizedProps,u=Bn(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=vc,typeof l==`object`&&l&&(c=xe(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&zn(t,a,r,c),Vl=!1,f=t.memoizedState,a.state=f,ut(t,r,a,i),lt();var p=t.memoizedState;o!==d||f!==p||Vl||e!==null&&e.dependencies!==null&&ye(e.dependencies)?(typeof s==`function`&&(Ln(t,n,s,r),p=t.memoizedState),(u=Vl||Rn(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&ye(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,rr(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Il(t,e.child,null,i),t.child=Il(t,null,n,i)):qn(e,t,n,i),t.memoizedState=a.state,e=t.child):e=_r(e,t,i),e}function sr(e,t,n,r){return de(),t.flags|=256,qn(e,t,n,r),t.child}function cr(e){return{baseLanes:e,cachePool:Ve()}}function lr(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Wu),e}function ur(e,t,n){var i=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(ql.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(ol){if(a?gt(t):yt(t),(e=al)?(e=As(e,cl),e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zc===null?null:{id:Qc,overflow:$c},retryLane:536870912,hydrationErrors:null},n=Sa(e),n.return=t,t.child=n,il=t,al=null)):e=null,e===null)throw se(t);return hs(e)?t.lanes=32:t.lanes=536870912,null}var c=i.children;return i=i.fallback,a?(yt(t),a=t.mode,c=fr({mode:`hidden`,children:c},a),i=ba(i,a,n,null),c.return=t,i.return=t,c.sibling=i,t.child=c,i=t.child,i.memoizedState=cr(n),i.childLanes=lr(e,s,n),t.memoizedState=fu,Qn(null,i)):(gt(t),dr(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(gt(t),t.flags&=-257,t=pr(e,t,n)):t.memoizedState===null?(yt(t),c=i.fallback,a=t.mode,i=fr({mode:`visible`,children:i.children},a),c=ba(c,a,n,null),c.flags|=2,i.return=t,c.return=t,i.sibling=c,t.child=i,Il(t,e.child,null,n),i=t.child,i.memoizedState=cr(n),i.childLanes=lr(e,s,n),t.memoizedState=fu,t=Qn(null,i)):(yt(t),t.child=e.child,t.flags|=128,t=null);else if(gt(t),hs(c))s=gs(c).digest,i=Error(r(419)),i.stack=``,i.digest=s,pe({value:i,source:null,stack:null}),t=pr(e,t,n);else if(du||ve(e,t,n,!1),s=(n&e.childLanes)!==0,du||s){if(s=ju,s!==null&&(i=D(s,n),i!==0&&i!==l.retryLane))throw l.retryLane=i,et(e,i),Mi(s,e,i),uu;ms(c)||Wi(),t=pr(e,t,n)}else ms(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,vo&&(al=Ts(c),il=t,ol=!0,sl=null,cl=!1,e!==null&&R(t,e)),t=dr(t,i.children),t.flags|=4096);return t}return a?(yt(t),c=i.fallback,a=t.mode,l=e.child,o=l.sibling,i=_a(l,{mode:`hidden`,children:i.children}),i.subtreeFlags=l.subtreeFlags&65011712,o===null?(c=ba(c,a,n,null),c.flags|=2):c=_a(o,c),c.return=t,i.return=t,i.sibling=c,t.child=i,Qn(null,i),i=t.child,c=e.child.memoizedState,c===null?c=cr(n):(a=c.cachePool,a===null?a=Ve():(l=ho?gl._currentValue:gl._currentValue2,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),i.memoizedState=c,i.childLanes=lr(e,s,n),t.memoizedState=fu,Qn(e.child,i)):(gt(t),n=e.child,e=n.sibling,n=_a(n,{mode:`visible`,children:i.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function dr(e,t){return t=fr({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function fr(e,n){return e=t(22,e,null,n),e.lanes=0,e}function pr(e,t,n){return Il(t,e.child,null,n),e=dr(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function mr(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ge(e.return,t,n)}function hr(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function gr(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=ql.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,p(ql,o),qn(e,t,r,n),r=ol?Jc:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&mr(e,n,t);else if(e.tag===19)mr(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&xt(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),hr(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&xt(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}hr(t,!0,n,null,a,r);break;case`together`:hr(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function _r(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Vu|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(ve(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=_a(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=_a(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function vr(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&ye(e)))}function yr(e,t,n){switch(t.tag){case 3:re(t,t.stateNode.containerInfo),me(t,gl,e.memoizedState.cache),de();break;case 27:case 5:ae(t);break;case 4:re(t,t.stateNode.containerInfo);break;case 10:me(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,_t(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(gt(t),e=_r(e,t,n),e===null?null:e.sibling):ur(e,t,n):(gt(t),t.flags|=128,null);gt(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(ve(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return gr(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),p(ql,ql.current),r)break;return null;case 22:return t.lanes=0,Zn(e,t,n,t.pendingProps);case 24:me(t,gl,e.memoizedState.cache)}return _r(e,t,n)}function br(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)du=!0;else{if(!vr(e,n)&&!(t.flags&128))return du=!1,yr(e,t,n);du=!!(e.flags&131072)}}else du=!1,ol&&t.flags&1048576&&te(t,Jc,t.index);switch(t.lanes=0,t.tag){case 16:a:{var i=t.pendingProps;if(e=Ge(t.elementType),t.type=e,typeof e==`function`)ga(e)?(i=Bn(e,i),t.tag=1,t=or(null,t,e,i,n)):(t.tag=0,t=ir(null,t,e,i,n));else{if(e!=null){var a=e.$$typeof;if(a===Ha){t.tag=11,t=Jn(null,t,e,i,n);break a}if(a===Ga){t.tag=14,t=Yn(null,t,e,i,n);break a}}throw t=u(e)||e,Error(r(306,t,``))}}return t;case 0:return ir(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,a=Bn(i,t.pendingProps),or(e,t,i,a,n);case 3:a:{if(re(t,t.stateNode.containerInfo),e===null)throw Error(r(387));var o=t.pendingProps;a=t.memoizedState,i=a.element,it(e,t),ut(t,o,null,n);var s=t.memoizedState;if(o=s.cache,me(t,gl,o),o!==a.cache&&_e(t,[gl],n,!0),lt(),o=s.element,vo&&a.isDehydrated){if(a={element:o,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=sr(e,t,o,n);break a}if(o!==i){i=F(Error(r(424)),t),pe(i),t=sr(e,t,o,n);break a}for(vo&&(al=Cs(t.stateNode.containerInfo),il=t,ol=!0,sl=null,cl=!0),n=Ll(t,null,o,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(de(),o===i){t=_r(e,t,n);break a}qn(e,t,o,n)}t=t.child}return t;case 26:if(Xs)return rr(e,t),e===null?(n=$s(t.type,null,t.pendingProps,null))?t.memoizedState=n:ol||(t.stateNode=ac(t.type,t.pendingProps,nl.current,t)):t.memoizedState=$s(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:if(uc)return ae(t),e===null&&uc&&ol&&(i=t.stateNode=dc(t.type,t.pendingProps,nl.current,el.current,!1),il=t,cl=!0,al=Es(t.type,i,al)),qn(e,t,t.pendingProps.children,n),rr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ol&&(Js(t.type,t.pendingProps,el.current),(a=i=al)&&(i=Ds(i,t.type,t.pendingProps,cl),i===null?a=!1:(t.stateNode=i,il=t,al=Ss(i),cl=!1,a=!0)),a||se(t)),ae(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,i=o.children,lo(a,o)?i=null:s!==null&&lo(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=wt(e,t,Dt,null,null,n),ho?Po._currentValue=a:Po._currentValue2=a),rr(e,t),qn(e,t,i,n),t.child;case 6:return e===null&&ol&&(Ys(t.pendingProps,el.current),(e=n=al)&&(n=Os(n,t.pendingProps,cl),n===null?e=!1:(t.stateNode=n,il=t,al=null,e=!0)),e||se(t)),null;case 13:return ur(e,t,n);case 4:return re(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Il(t,null,i,n):qn(e,t,i,n),t.child;case 11:return Jn(e,t,t.type,t.pendingProps,n);case 7:return qn(e,t,t.pendingProps,n),t.child;case 8:return qn(e,t,t.pendingProps.children,n),t.child;case 12:return qn(e,t,t.pendingProps.children,n),t.child;case 10:return i=t.pendingProps,me(t,t.type,i.value),qn(e,t,i.children,n),t.child;case 9:return a=t.type._context,i=t.pendingProps.children,be(t),a=xe(a),i=i(a),t.flags|=1,qn(e,t,i,n),t.child;case 14:return Yn(e,t,t.type,t.pendingProps,n);case 15:return Xn(e,t,t.type,t.pendingProps,n);case 19:return gr(e,t,n);case 31:return nr(e,t,n);case 22:return Zn(e,t,n,t.pendingProps);case 24:return be(t),i=xe(gl),e===null?(a=ze(),a===null&&(a=ju,o=we(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:i,cache:a},rt(t),me(t,gl,a)):((e.lanes&n)!==0&&(it(e,t),ut(t,null,null,n),lt()),a=e.memoizedState,o=t.memoizedState,a.parent===i?(i=o.cache,me(t,gl,i),i!==a.cache&&_e(t,[gl],n,!0)):(a={parent:i,cache:i},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),me(t,gl,i))),qn(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function xr(e){e.flags|=4}function Sr(e){_o&&(e.flags|=8)}function Cr(e,t){if(e!==null&&e.child===t.child)return!1;if(t.flags&16)return!0;for(e=t.child;e!==null;){if(e.flags&8218||e.subtreeFlags&8218)return!0;e=e.sibling}return!1}function wr(e,t,n,r){if(go)for(n=t.child;n!==null;){if(n.tag===5||n.tag===6)H(e,n.stateNode);else if(!(n.tag===4||uc&&n.tag===27)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}else if(_o)for(var i=t.child;i!==null;){if(i.tag===5){var a=i.stateNode;n&&r&&(a=fs(a,i.type,i.memoizedProps)),H(e,a)}else if(i.tag===6)a=i.stateNode,n&&r&&(a=ps(a,i.memoizedProps)),H(e,a);else if(i.tag!==4){if(i.tag===22&&i.memoizedState!==null)a=i.child,a!==null&&(a.return=i),wr(e,i,!0,!0);else if(i.child!==null){i.child.return=i,i=i.child;continue}}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}}function Tr(e,t,n,r){var i=!1;if(_o)for(var a=t.child;a!==null;){if(a.tag===5){var o=a.stateNode;n&&r&&(o=fs(o,a.type,a.memoizedProps)),ls(e,o)}else if(a.tag===6)o=a.stateNode,n&&r&&(o=ps(o,a.memoizedProps)),ls(e,o);else if(a.tag!==4){if(a.tag===22&&a.memoizedState!==null)i=a.child,i!==null&&(i.return=a),Tr(e,a,!0,!0),i=!0;else if(a.child!==null){a.child.return=a,a=a.child;continue}}if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return i;a=a.return}a.sibling.return=a.return,a=a.sibling}return i}function Er(e,t){if(_o&&Cr(e,t)){e=t.stateNode;var n=e.containerInfo,r=cs();Tr(r,t,!1,!1),e.pendingChildren=r,xr(t),us(n,r)}}function Dr(e,t,n,r){if(go)e.memoizedProps!==r&&xr(t);else if(_o){var i=e.stateNode,a=e.memoizedProps;if((e=Cr(e,t))||a!==r){var o=el.current;a=ss(i,n,a,r,!e,null),a===i?t.stateNode=i:(Sr(t),co(a,n,r,o)&&xr(t),t.stateNode=a,e&&wr(a,t,!1,!1))}else t.stateNode=i}}function Or(e,t,n,r,i){if(e.mode&32&&(n===null?Eo(t,r):Do(t,n,r))){if(e.flags|=16777216,(i&335544128)===i||Oo(t,r)){if(ko(e.stateNode,t,r))e.flags|=8192;else if(Vi())e.flags|=8192;else throw Nl=Ml,Al}}else e.flags&=-16777217}function kr(e,t){if(sc(t)){if(e.flags|=16777216,!cc(t)){if(Vi())e.flags|=8192;else throw Nl=Ml,Al}}else e.flags&=-16777217}function Ar(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:y(),e.lanes|=t,Gu|=t)}function jr(e,t){if(!ol)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Mr(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Nr(e,t,n){var i=t.pendingProps;switch(L(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mr(t),null;case 1:return Mr(t),null;case 3:return n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),he(gl),ie(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ue(t)?xr(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,fe())),Er(e,t),Mr(t),null;case 26:if(Xs){var a=t.type,o=t.memoizedState;return e===null?(xr(t),o===null?(Mr(t),Or(t,a,null,i,n)):(Mr(t),kr(t,o))):o?o===e.memoizedState?(Mr(t),t.flags&=-16777217):(xr(t),Mr(t),kr(t,o)):(o=e.memoizedProps,go?o!==i&&xr(t):Dr(e,t,a,i),Mr(t),Or(t,a,o,i,n)),null}case 27:if(uc){if(oe(t),n=nl.current,a=t.type,e!==null&&t.stateNode!=null)go?e.memoizedProps!==i&&xr(t):Dr(e,t,a,i);else{if(!i){if(t.stateNode===null)throw Error(r(166));return Mr(t),null}e=el.current,ue(t)?ce(t,e):(e=dc(a,i,n,e,!0),t.stateNode=e,xr(t))}return Mr(t),null}case 5:if(oe(t),a=t.type,e!==null&&t.stateNode!=null)Dr(e,t,a,i);else{if(!i){if(t.stateNode===null)throw Error(r(166));return Mr(t),null}if(o=el.current,ue(t))ce(t,o),Vs(t.stateNode,a,i,o)&&(t.flags|=64);else{var s=so(a,i,nl.current,o,t);Sr(t),wr(s,t,!1,!1),t.stateNode=s,co(s,a,i,o)&&xr(t)}}return Mr(t),Or(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)n=e.memoizedProps,go?n!==i&&xr(t):_o&&(n===i?t.stateNode=e.stateNode:(e=nl.current,n=el.current,Sr(t),t.stateNode=uo(i,e,n,t)));else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(e=nl.current,n=el.current,ue(t)){if(!vo)throw Error(r(176));if(e=t.stateNode,n=t.memoizedProps,i=null,a=il,a!==null)switch(a.tag){case 27:case 5:i=a.memoizedProps}Ms(e,n,t,i)||se(t,!0)}else Sr(t),t.stateNode=uo(i,e,n,t)}return Mr(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=ue(t),n!==null){if(e===null){if(!i)throw Error(r(318));if(!vo)throw Error(r(556));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(557));Ns(e,t)}else de(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Mr(t),e=!1}else n=fe(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(bt(t),t):(bt(t),null);if(t.flags&128)throw Error(r(558))}return Mr(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ue(t),i!==null&&i.dehydrated!==null){if(e===null){if(!a)throw Error(r(318));if(!vo)throw Error(r(344));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(r(317));Ps(a,t)}else de(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Mr(t),a=!1}else a=fe(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(bt(t),t):(bt(t),null)}return bt(t),t.flags&128?(t.lanes=n,t):(n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(i=t.child,a=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(a=i.alternate.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==a&&(i.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Ar(t,t.updateQueue),Mr(t),null);case 4:return ie(),Er(e,t),e===null&&bo(t.stateNode.containerInfo),Mr(t),null;case 10:return he(t.type),Mr(t),null;case 19:if(f(ql),i=t.memoizedState,i===null)return Mr(t),null;if(a=!!(t.flags&128),o=i.rendering,o===null){if(a)jr(i,!1);else{if(Bu!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=xt(e),o!==null){for(t.flags|=128,jr(i,!1),e=o.updateQueue,t.updateQueue=e,Ar(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)va(n,e),n=n.sibling;return p(ql,ql.current&1|2),ol&&I(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&kc()>Zu&&(t.flags|=128,a=!0,jr(i,!1),t.lanes=4194304)}}else{if(!a){if(e=xt(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Ar(t,e),jr(i,!0),i.tail===null&&i.tailMode===`hidden`&&!o.alternate&&!ol)return Mr(t),null}else 2*kc()-i.renderingStartTime>Zu&&n!==536870912&&(t.flags|=128,a=!0,jr(i,!1),t.lanes=4194304)}i.isBackwards?(o.sibling=t.child,t.child=o):(e=i.last,e===null?t.child=o:e.sibling=o,i.last=o)}return i.tail===null?(Mr(t),null):(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=kc(),e.sibling=null,n=ql.current,p(ql,a?n&1|2:n&1),ol&&I(t,i.treeForkCount),e);case 22:case 23:return bt(t),ht(),i=t.memoizedState!==null,e===null?i&&(t.flags|=8192):e.memoizedState!==null!==i&&(t.flags|=8192),i?n&536870912&&!(t.flags&128)&&(Mr(t),t.subtreeFlags&6&&(t.flags|=8192)):Mr(t),n=t.updateQueue,n!==null&&Ar(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&f(Ol),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),he(gl),Mr(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Pr(e,t){switch(L(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return he(gl),ie(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return oe(t),null;case 31:if(t.memoizedState!==null){if(bt(t),t.alternate===null)throw Error(r(340));de()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(bt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));de()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return f(ql),null;case 4:return ie(),null;case 10:return he(t.type),null;case 22:case 23:return bt(t),ht(),e!==null&&f(Ol),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return he(gl),null;case 25:return null;default:return null}}function Fr(e,t){switch(L(t),t.tag){case 3:he(gl),ie();break;case 26:case 27:case 5:oe(t);break;case 4:ie();break;case 31:t.memoizedState!==null&&bt(t);break;case 13:bt(t);break;case 19:f(ql);break;case 10:he(t.type);break;case 22:case 23:bt(t),ht(),e!==null&&f(Ol);break;case 24:he(gl)}}function Ir(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){ca(t,t.return,e)}}function Lr(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){ca(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){ca(t,t.return,e)}}function Rr(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{ft(t,n)}catch(t){ca(e,e.return,t)}}}function zr(e,t,n){n.props=Bn(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){ca(e,t,n)}}function Br(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=no(e.stateNode);break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){ca(e,t,n)}}function Vr(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){ca(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){ca(e,t,n)}else n.current=null}}function Hr(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{Yo(r,t,n,e)}catch(t){ca(e,e.return,t)}}function Ur(e,t,n){try{Xo(e.stateNode,e.type,n,t,e)}catch(t){ca(e,e.return,t)}}function Wr(e){return e.tag===5||e.tag===3||(Xs?e.tag===26:!1)||(uc?e.tag===27&&hc(e.type):!1)||e.tag===4}function Gr(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Wr(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(uc&&e.tag===27&&hc(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Kr(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?Qo(n,e,t):qo(n,e);else if(r!==4&&(uc&&r===27&&hc(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Kr(e,t,n),e=e.sibling;e!==null;)Kr(e,t,n),e=e.sibling}function qr(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?Zo(n,e,t):Ko(n,e);else if(r!==4&&(uc&&r===27&&hc(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(qr(e,t,n),e=e.sibling;e!==null;)qr(e,t,n),e=e.sibling}function Jr(e,t,n){e=e.containerInfo;try{ds(e,n)}catch(e){ca(t,t.return,e)}}function Yr(e){var t=e.stateNode,n=e.memoizedProps;try{fc(e.type,n,t,e)}catch(t){ca(e,e.return,t)}}function Xr(e,t){for(ao(e.containerInfo),_u=t;_u!==null;)if(e=_u,t=e.child,e.subtreeFlags&1028&&t!==null)t.return=e,_u=t;else for(;_u!==null;){e=_u;var n=e.alternate;switch(t=e.flags,e.tag){case 0:if(t&4&&(t=e.updateQueue,t=t===null?null:t.events,t!==null))for(var i=0;i<t.length;i++){var a=t[i];a.ref.impl=a.nextImpl}break;case 11:case 15:break;case 1:if(t&1024&&n!==null){t=void 0,i=e,a=n.memoizedProps,n=n.memoizedState;var o=i.stateNode;try{var s=Bn(i.type,a);t=o.getSnapshotBeforeUpdate(s,n),o.__reactInternalSnapshotBeforeUpdate=t}catch(e){ca(i,i.return,e)}}break;case 3:t&1024&&go&&os(e.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(t&1024)throw Error(r(163))}if(t=e.sibling,t!==null){t.return=e.return,_u=t;break}_u=e.return}}function Zr(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:li(e,n),r&4&&Ir(5,n);break;case 1:if(li(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){ca(n,n.return,e)}else{var i=Bn(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){ca(n,n.return,e)}}}r&64&&Rr(n),r&512&&Br(n,n.return);break;case 3:if(li(e,n),r&64&&(r=n.updateQueue,r!==null)){if(e=null,n.child!==null)switch(n.child.tag){case 27:case 5:e=no(n.child.stateNode);break;case 1:e=n.child.stateNode}try{ft(r,e)}catch(e){ca(n,n.return,e)}}break;case 27:uc&&t===null&&r&4&&Yr(n);case 26:case 5:if(li(e,n),t===null){if(r&4)Hr(n);else if(r&64){e=n.type,t=n.memoizedProps,i=n.stateNode;try{Ls(i,e,t,n)}catch(e){ca(n,n.return,e)}}}r&512&&Br(n,n.return);break;case 12:li(e,n);break;case 31:li(e,n),r&4&&ti(e,n);break;case 13:li(e,n),r&4&&ni(e,n),r&64&&(r=n.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(n=fa.bind(null,n),_s(r,n))));break;case 22:if(r=n.memoizedState!==null||pu,!r){t=t!==null&&t.memoizedState!==null||mu,i=pu;var a=mu;pu=r,(mu=t)&&!a?di(e,n,!!(n.subtreeFlags&8772)):li(e,n),pu=i,mu=a}break;case 30:break;default:li(e,n)}}function Qr(e){var t=e.alternate;t!==null&&(e.alternate=null,Qr(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&To(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function $r(e,t,n){for(n=n.child;n!==null;)ei(e,t,n),n=n.sibling}function ei(e,t,n){if(Lc&&typeof Lc.onCommitFiberUnmount==`function`)try{Lc.onCommitFiberUnmount(Ic,n)}catch{}switch(n.tag){case 26:if(Xs){mu||Vr(n,t),$r(e,t,n),n.memoizedState?tc(n.memoizedState):n.stateNode&&ic(n.stateNode);break}case 27:if(uc){mu||Vr(n,t);var r=vu,i=yu;hc(n.type)&&(vu=n.stateNode,yu=!1),$r(e,t,n),pc(n.stateNode),vu=r,yu=i;break}case 5:mu||Vr(n,t);case 6:if(go){if(r=vu,i=yu,vu=null,$r(e,t,n),vu=r,yu=i,vu!==null){if(yu)try{es(vu,n.stateNode)}catch(e){ca(n,t,e)}else try{$o(vu,n.stateNode)}catch(e){ca(n,t,e)}}}else $r(e,t,n);break;case 18:go&&vu!==null&&(yu?Ws(vu,n.stateNode):Us(vu,n.stateNode));break;case 4:go?(r=vu,i=yu,vu=n.stateNode.containerInfo,yu=!0,$r(e,t,n),vu=r,yu=i):(_o&&Jr(n.stateNode,n,cs()),$r(e,t,n));break;case 0:case 11:case 14:case 15:Lr(2,n,t),mu||Lr(4,n,t),$r(e,t,n);break;case 1:mu||(Vr(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&zr(n,t,r)),$r(e,t,n);break;case 21:$r(e,t,n);break;case 22:mu=(r=mu)||n.memoizedState!==null,$r(e,t,n),mu=r;break;default:$r(e,t,n)}}function ti(e,t){if(vo&&t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{zs(e)}catch(e){ca(t,t.return,e)}}}function ni(e,t){if(vo&&t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Bs(e)}catch(e){ca(t,t.return,e)}}function ri(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new gu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new gu),t;default:throw Error(r(435,e.tag))}}function ii(e,t){var n=ri(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=pa.bind(null,e,t);t.then(r,r)}})}function ai(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i],o=e,s=t;if(go){var c=s;a:for(;c!==null;){switch(c.tag){case 27:if(uc){if(hc(c.type)){vu=c.stateNode,yu=!1;break a}break}case 5:vu=c.stateNode,yu=!1;break a;case 3:case 4:vu=c.stateNode.containerInfo,yu=!0;break a}c=c.return}if(vu===null)throw Error(r(160));ei(o,s,a),vu=null,yu=!1}else ei(o,s,a);o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)oi(t,e),t=t.sibling}function oi(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ai(t,e),si(e),i&4&&(Lr(3,e,e.return),Ir(3,e),Lr(5,e,e.return));break;case 1:ai(t,e),si(e),i&512&&(mu||n===null||Vr(n,n.return)),i&64&&pu&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?i:n.concat(i))));break;case 26:if(Xs){var a=bu;if(ai(t,e),si(e),i&512&&(mu||n===null||Vr(n,n.return)),i&4){i=n===null?null:n.memoizedState;var o=e.memoizedState;n===null?o===null?e.stateNode===null?e.stateNode=nc(a,e.type,e.memoizedProps,e):rc(a,e.type,e.stateNode):e.stateNode=ec(a,o,e.memoizedProps):i===o?o===null&&e.stateNode!==null&&Ur(e,e.memoizedProps,n.memoizedProps):(i===null?n.stateNode!==null&&ic(n.stateNode):tc(i),o===null?rc(a,e.type,e.stateNode):ec(a,o,e.memoizedProps))}break}case 27:if(uc){ai(t,e),si(e),i&512&&(mu||n===null||Vr(n,n.return)),n!==null&&i&4&&Ur(e,e.memoizedProps,n.memoizedProps);break}case 5:if(ai(t,e),si(e),i&512&&(mu||n===null||Vr(n,n.return)),go){if(e.flags&32){a=e.stateNode;try{ts(a)}catch(t){ca(e,e.return,t)}}i&4&&e.stateNode!=null&&(a=e.memoizedProps,Ur(e,a,n===null?a:n.memoizedProps)),i&1024&&(hu=!0)}else _o&&e.alternate!==null&&(e.alternate.stateNode=e.stateNode);break;case 6:if(ai(t,e),si(e),i&4&&go){if(e.stateNode===null)throw Error(r(162));i=e.memoizedProps,n=n===null?i:n.memoizedProps,a=e.stateNode;try{Jo(a,n,i)}catch(t){ca(e,e.return,t)}}break;case 3:if(Xs?(oc(),a=bu,bu=Qs(t.containerInfo),ai(t,e),bu=a):ai(t,e),si(e),i&4){if(go&&vo&&n!==null&&n.memoizedState.isDehydrated)try{Rs(t.containerInfo)}catch(t){ca(e,e.return,t)}if(_o){i=t.containerInfo,n=t.pendingChildren;try{ds(i,n)}catch(t){ca(e,e.return,t)}}}hu&&(hu=!1,ci(e));break;case 4:Xs?(n=bu,bu=Qs(e.stateNode.containerInfo),ai(t,e),si(e),bu=n):(ai(t,e),si(e)),i&4&&_o&&Jr(e.stateNode,e,e.stateNode.pendingChildren);break;case 12:ai(t,e),si(e);break;case 31:ai(t,e),si(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,ii(e,i)));break;case 13:ai(t,e),si(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Yu=kc()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,ii(e,i)));break;case 22:a=e.memoizedState!==null;var s=n!==null&&n.memoizedState!==null,c=pu,l=mu;if(pu=c||a,mu=l||s,ai(t,e),mu=l,pu=c,si(e),i&8192&&(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||s||pu||mu||ui(e)),go)){a:if(n=null,go)for(t=e;;){if(t.tag===5||Xs&&t.tag===26){if(n===null){s=n=t;try{o=s.stateNode,a?ns(o):is(s.stateNode,s.memoizedProps)}catch(e){ca(s,s.return,e)}}}else if(t.tag===6){if(n===null){s=t;try{var u=s.stateNode;a?rs(u):as(u,s.memoizedProps)}catch(e){ca(s,s.return,e)}}}else if(t.tag===18){if(n===null){s=t;try{var d=s.stateNode;a?Gs(d):Ks(s.stateNode)}catch(e){ca(s,s.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}}i&4&&(i=e.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,ii(e,n))));break;case 19:ai(t,e),si(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,ii(e,i)));break;case 30:break;case 21:break;default:ai(t,e),si(e)}}function si(e){var t=e.flags;if(t&2){try{for(var n,i=e.return;i!==null;){if(Wr(i)){n=i;break}i=i.return}if(go){if(n==null)throw Error(r(160));switch(n.tag){case 27:if(uc){var a=n.stateNode;qr(e,Gr(e),a);break}case 5:var o=n.stateNode;n.flags&32&&(ts(o),n.flags&=-33),qr(e,Gr(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Kr(e,Gr(e),s);break;default:throw Error(r(161))}}}catch(t){ca(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ci(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ci(t),t.tag===5&&t.flags&1024&&Fo(t.stateNode),e=e.sibling}}function li(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Zr(e,t.alternate,t),t=t.sibling}function ui(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Lr(4,t,t.return),ui(t);break;case 1:Vr(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&zr(t,t.return,n),ui(t);break;case 27:uc&&pc(t.stateNode);case 26:case 5:Vr(t,t.return),ui(t);break;case 22:t.memoizedState===null&&ui(t);break;case 30:ui(t);break;default:ui(t)}e=e.sibling}}function di(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:di(i,a,n),Ir(4,a);break;case 1:if(di(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){ca(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)dt(c[i],s)}catch(e){ca(r,r.return,e)}}n&&o&64&&Rr(a),Br(a,a.return);break;case 27:uc&&Yr(a);case 26:case 5:di(i,a,n),n&&r===null&&o&4&&Hr(a),Br(a,a.return);break;case 12:di(i,a,n);break;case 31:di(i,a,n),n&&o&4&&ti(i,a);break;case 13:di(i,a,n),n&&o&4&&ni(i,a);break;case 22:a.memoizedState===null&&di(i,a,n),Br(a,a.return);break;case 30:break;default:di(i,a,n)}t=t.sibling}}function fi(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Te(n))}function pi(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Te(e))}function mi(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)hi(e,t,n,r),t=t.sibling}function hi(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:mi(e,t,n,r),i&2048&&Ir(9,t);break;case 1:mi(e,t,n,r);break;case 3:mi(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Te(e)));break;case 12:if(i&2048){mi(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){ca(t,t.return,e)}}else mi(e,t,n,r);break;case 31:mi(e,t,n,r);break;case 13:mi(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?mi(e,t,n,r):(a._visibility|=2,gi(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?mi(e,t,n,r):_i(e,t),i&2048&&fi(o,t);break;case 24:mi(e,t,n,r),i&2048&&pi(t.alternate,t);break;default:mi(e,t,n,r)}}function gi(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:gi(a,o,s,c,i),Ir(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,gi(a,o,s,c,i)):u._visibility&2?gi(a,o,s,c,i):_i(a,o),i&&l&2048&&fi(o.alternate,o);break;case 24:gi(a,o,s,c,i),i&&l&2048&&pi(o.alternate,o);break;default:gi(a,o,s,c,i)}t=t.sibling}}function _i(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:_i(n,r),i&2048&&fi(r.alternate,r);break;case 24:_i(n,r),i&2048&&pi(r.alternate,r);break;default:_i(n,r)}t=t.sibling}}function vi(e,t,n){if(e.subtreeFlags&xu)for(e=e.child;e!==null;)yi(e,t,n),e=e.sibling}function yi(e,t,n){switch(e.tag){case 26:if(vi(e,t,n),e.flags&xu){if(e.memoizedState!==null)lc(n,bu,e.memoizedState,e.memoizedProps);else{var r=e.stateNode,i=e.type;e=e.memoizedProps,((t&335544128)===t||Oo(i,e))&&jo(n,r,i,e)}}break;case 5:vi(e,t,n),e.flags&xu&&(r=e.stateNode,i=e.type,e=e.memoizedProps,((t&335544128)===t||Oo(i,e))&&jo(n,r,i,e));break;case 3:case 4:Xs?(r=bu,bu=Qs(e.stateNode.containerInfo),vi(e,t,n),bu=r):vi(e,t,n);break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=xu,xu=16777216,vi(e,t,n),xu=r):vi(e,t,n));break;default:vi(e,t,n)}}function bi(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function xi(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];_u=r,wi(r,e)}bi(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Si(e),e=e.sibling}function Si(e){switch(e.tag){case 0:case 11:case 15:xi(e),e.flags&2048&&Lr(9,e,e.return);break;case 3:xi(e);break;case 12:xi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ci(e)):xi(e);break;default:xi(e)}}function Ci(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];_u=r,wi(r,e)}bi(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Lr(8,t,t.return),Ci(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ci(t));break;default:Ci(t)}e=e.sibling}}function wi(e,t){for(;_u!==null;){var n=_u;switch(n.tag){case 0:case 11:case 15:Lr(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Te(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,_u=r;else a:for(n=e;_u!==null;){r=_u;var i=r.sibling,a=r.return;if(Qr(r),r===n){_u=null;break a}if(i!==null){i.return=a,_u=i;break a}_u=a}}}function Ti(e){var t=yo(e);if(t!=null){if(typeof t.memoizedProps[`data-testname`]!=`string`)throw Error(r(364));return t}if(e=zo(e),e===null)throw Error(r(362));return e.stateNode.current}function Ei(e,t){var n=e.tag;switch(t.$$typeof){case Cu:if(e.type===t.value)return!0;break;case wu:a:{for(t=t.value,e=[e,0],n=0;n<e.length;){var i=e[n++],a=i.tag,o=e[n++],s=t[o];if(a!==5&&a!==26&&a!==27||!Ho(i)){for(;s!=null&&Ei(i,s);)o++,s=t[o];if(o===t.length){t=!0;break a}for(i=i.child;i!==null;)e.push(i,o),i=i.sibling}}t=!1}return t;case Tu:if((n===5||n===26||n===27)&&Uo(e.stateNode,t.value))return!0;break;case Du:if((n===5||n===6||n===26||n===27)&&(e=Vo(e),e!==null&&0<=e.indexOf(t.value)))return!0;break;case Eu:if((n===5||n===26||n===27)&&(e=e.memoizedProps[`data-testname`],typeof e==`string`&&e.toLowerCase()===t.value.toLowerCase()))return!0;break;default:throw Error(r(365))}return!1}function Di(e){switch(e.$$typeof){case Cu:return`<`+(u(e.value)||`Unknown`)+`>`;case wu:return`:has(`+(Di(e)||``)+`)`;case Tu:return`[role="`+e.value+`"]`;case Du:return`"`+e.value+`"`;case Eu:return`[data-testname="`+e.value+`"]`;default:throw Error(r(365))}}function Oi(e,t){var n=[];e=[e,0];for(var r=0;r<e.length;){var i=e[r++],a=i.tag,o=e[r++],s=t[o];if(a!==5&&a!==26&&a!==27||!Ho(i)){for(;s!=null&&Ei(i,s);)o++,s=t[o];if(o===t.length)n.push(i);else for(i=i.child;i!==null;)e.push(i,o),i=i.sibling}}return n}function ki(e,t){if(!Ro)throw Error(r(363));e=Ti(e),e=Oi(e,t),t=[],e=Array.from(e);for(var n=0;n<e.length;){var i=e[n++],a=i.tag;if(a===5||a===26||a===27)Ho(i)||t.push(i.stateNode);else for(i=i.child;i!==null;)e.push(i),i=i.sibling}return t}function Ai(){return Au&2&&Nu!==0?Nu&-Nu:Qa.T===null?Co():Fe()}function ji(){if(Wu===0){if(!(Nu&536870912)||ol){var e=Cc;Cc<<=1,!(Cc&3932160)&&(Cc=262144),Wu=e}else Wu=536870912}return e=Gl.current,e!==null&&(e.flags|=32),Wu}function Mi(e,t,n){(e===ju&&(Pu===2||Pu===9)||e.cancelPendingCommit!==null)&&(zi(e,0),Ii(e,Nu,Wu,!1)),x(e,n),(!(Au&2)||e!==ju)&&(e===ju&&(!(Au&2)&&(Hu|=n),Bu===4&&Ii(e,Nu,Wu,!1)),De(e))}function Ni(e,t,n){if(Au&6)throw Error(r(327));var i=!n&&!(t&127)&&(t&e.expiredLanes)===0||_(e,t),a=i?qi(e,t):Gi(e,t,!0),o=i;do{if(a===0){Lu&&!i&&Ii(e,t,0,!1);break}if(n=e.current.alternate,o&&!Fi(n)){a=Gi(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Ku;var l=vo&&c.current.memoizedState.isDehydrated;if(l&&(zi(c,s).flags|=256),s=Gi(c,s,!1),s!==2){if(Ru&&!l){c.errorRecoveryDisabledLanes|=o,Hu|=o,a=4;break a}o=qu,qu=a,o!==null&&(qu===null?qu=o:qu.push.apply(qu,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){zi(e,0),Ii(e,t,0,!0);break}a:{switch(i=e,o=a,o){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:Ii(i,t,Wu,!Iu);break a;case 2:qu=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(a=Yu+300-kc(),10<a)){if(Ii(i,t,Wu,!Iu),g(i,0,!0)!==0)break a;rd=t,i.timeoutHandle=fo(Pi.bind(null,i,n,qu,Qu,Ju,t,Wu,Hu,Gu,Iu,o,`Throttled`,-0,0),a);break a}Pi(i,n,qu,Qu,Ju,t,Wu,Hu,Gu,Iu,o,null,-0,0)}break}while(1);De(e)}function Pi(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=mo,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d=Ao(),yi(t,a,d);var m=(a&62914560)===a?Yu-kc():(a&4194048)===a?Xu-kc():0;if(m=Mo(d,m),m!==null){rd=a,e.cancelPendingCommit=m(ea.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Ii(e,a,o,!l);return}}ea(e,t,a,n,r,i,o,s,c)}function Fi(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Rc(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ii(e,t,n,r){t&=~Uu,t&=~Hu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-yc(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&w(e,n,t)}function Li(){return Au&6?!0:(Oe(0,!1),!1)}function Ri(){if(Mu!==null){if(Pu===0)var e=Mu.return;else e=Mu,fl=dl=null,At(e),Pl=null,Fl=0,e=Mu;for(;e!==null;)Fr(e.alternate,e),e=e.return;Mu=null}}function zi(e,t){var n=e.timeoutHandle;n!==mo&&(e.timeoutHandle=mo,po(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),rd=0,Ri(),ju=e,Mu=n=_a(e.current,null),Nu=t,Pu=0,Fu=null,Iu=!1,Lu=_(e,t),Ru=!1,Gu=Wu=Uu=Hu=Vu=Bu=0,qu=Ku=null,Ju=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-yc(r),a=1<<i;t|=e[i],r&=~a}return zu=t,Ze(),n}function Bi(e,t){Yl=null,Qa.H=au,t===kl||t===jl?(t=Ke(),Pu=3):t===Al?(t=Ke(),Pu=4):Pu=t===uu?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Fu=t,Mu===null&&(Bu=1,Vn(e,F(t,e.current)))}function Vi(){var e=Gl.current;return e===null?!0:(Nu&4194048)===Nu?Kl===null:(Nu&62914560)===Nu||Nu&536870912?e===Kl:!1}function Hi(){var e=Qa.H;return Qa.H=au,e===null?au:e}function Ui(){var e=Qa.A;return Qa.A=Su,e}function Wi(){Bu=4,Iu||(Nu&4194048)!==Nu&&Gl.current!==null||(Lu=!0),!(Vu&134217727)&&!(Hu&134217727)||ju===null||Ii(ju,Nu,Wu,!1)}function Gi(e,t,n){var r=Au;Au|=2;var i=Hi(),a=Ui();(ju!==e||Nu!==t)&&(Qu=null,zi(e,t)),t=!1;var o=Bu;a:do try{if(Pu!==0&&Mu!==null){var s=Mu,c=Fu;switch(Pu){case 8:Ri(),o=6;break a;case 3:case 2:case 9:case 6:Gl.current===null&&(t=!0);var l=Pu;if(Pu=0,Fu=null,Zi(e,s,c,l),n&&Lu){o=0;break a}break;default:l=Pu,Pu=0,Fu=null,Zi(e,s,c,l)}}Ki(),o=Bu;break}catch(t){Bi(e,t)}while(1);return t&&e.shellSuspendCounter++,fl=dl=null,Au=r,Qa.H=i,Qa.A=a,Mu===null&&(ju=null,Nu=0,Ze()),o}function Ki(){for(;Mu!==null;)Yi(Mu)}function qi(e,t){var n=Au;Au|=2;var i=Hi(),a=Ui();ju!==e||Nu!==t?(Qu=null,Zu=kc()+500,zi(e,t)):Lu=_(e,t);a:do try{if(Pu!==0&&Mu!==null){t=Mu;var o=Fu;b:switch(Pu){case 1:Pu=0,Fu=null,Zi(e,t,o,1);break;case 2:case 9:if(Ue(o)){Pu=0,Fu=null,Xi(t);break}t=function(){Pu!==2&&Pu!==9||ju!==e||(Pu=7),De(e)},o.then(t,t);break a;case 3:Pu=7;break a;case 4:Pu=5;break a;case 7:Ue(o)?(Pu=0,Fu=null,Xi(t)):(Pu=0,Fu=null,Zi(e,t,o,7));break;case 5:var s=null;switch(Mu.tag){case 26:s=Mu.memoizedState;case 5:case 27:var c=Mu,l=c.type,u=c.pendingProps;if(s?cc(s):ko(c.stateNode,l,u)){Pu=0,Fu=null;var d=c.sibling;if(d!==null)Mu=d;else{var f=c.return;f===null?Mu=null:(Mu=f,Qi(f))}break b}}Pu=0,Fu=null,Zi(e,t,o,5);break;case 6:Pu=0,Fu=null,Zi(e,t,o,6);break;case 8:Ri(),Bu=6;break a;default:throw Error(r(462))}}Ji();break}catch(t){Bi(e,t)}while(1);return fl=dl=null,Qa.H=i,Qa.A=a,Au=n,Mu===null?(ju=null,Nu=0,Ze(),Bu):0}function Ji(){for(;Mu!==null&&!Dc();)Yi(Mu)}function Yi(e){var t=br(e.alternate,e,zu);e.memoizedProps=e.pendingProps,t===null?Qi(e):Mu=t}function Xi(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=ar(n,t,t.pendingProps,t.type,void 0,Nu);break;case 11:t=ar(n,t,t.pendingProps,t.type.render,t.ref,Nu);break;case 5:At(t);default:Fr(n,t),t=Mu=va(t,zu),t=br(n,t,zu)}e.memoizedProps=e.pendingProps,t===null?Qi(e):Mu=t}function Zi(e,t,n,r){fl=dl=null,At(t),Pl=null,Fl=0;var i=t.return;try{if(Kn(e,i,t,n,Nu)){Bu=1,Vn(e,F(n,e.current)),Mu=null;return}}catch(t){if(i!==null)throw Mu=i,t;Bu=1,Vn(e,F(n,e.current)),Mu=null;return}t.flags&32768?(ol||r===1?e=!0:Lu||Nu&536870912?e=!1:(Iu=e=!0,(r===2||r===9||r===3||r===6)&&(r=Gl.current,r!==null&&r.tag===13&&(r.flags|=16384))),$i(t,e)):Qi(t)}function Qi(e){var t=e;do{if(t.flags&32768){$i(t,Iu);return}e=t.return;var n=Nr(t.alternate,t,zu);if(n!==null){Mu=n;return}if(t=t.sibling,t!==null){Mu=t;return}Mu=t=e}while(t!==null);Bu===0&&(Bu=5)}function $i(e,t){do{var n=Pr(e.alternate,e);if(n!==null){n.flags&=32767,Mu=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Mu=e;return}Mu=e=n}while(e!==null);Bu=6,Mu=null}function ea(e,t,n,i,a,o,s,c,l){e.cancelPendingCommit=null;do aa();while(ed!==0);if(Au&6)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(o=t.lanes|t.childLanes,o|=Bl,S(e,n,o,s,c,l),e===ju&&(Mu=ju=null,Nu=0),nd=t,td=e,rd=n,id=o,ad=a,od=i,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,ma(Mc,function(){return oa(),null})):(e.callbackNode=null,e.callbackPriority=0),i=!!(t.flags&13878),t.subtreeFlags&13878||i){i=Qa.T,Qa.T=null,a=So(),xo(2),s=Au,Au|=4;try{Xr(e,t,n)}finally{Au=s,xo(a),Qa.T=i}}ed=1,ta(),na(),ra()}}function ta(){if(ed===1){ed=0;var e=td,t=nd,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=Qa.T,Qa.T=null;var r=So();xo(2);var i=Au;Au|=4;try{oi(t,e),oo(e.containerInfo)}finally{Au=i,xo(r),Qa.T=n}}e.current=t,ed=2}}function na(){if(ed===2){ed=0;var e=td,t=nd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=Qa.T,Qa.T=null;var r=So();xo(2);var i=Au;Au|=4;try{Zr(e,t.alternate,t)}finally{Au=i,xo(r),Qa.T=n}}ed=3}}function ra(){if(ed===4||ed===3){ed=0,Oc();var e=td,t=nd,n=rd,r=od;t.subtreeFlags&10256||t.flags&10256?ed=5:(ed=0,nd=td=null,ia(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&($u=null),k(n),t=t.stateNode,Lc&&typeof Lc.onCommitFiberRoot==`function`)try{Lc.onCommitFiberRoot(Ic,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=Qa.T,i=So(),xo(2),Qa.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{Qa.T=t,xo(i)}}rd&3&&aa(),De(e),i=e.pendingLanes,n&261930&&i&42?e===U?sd++:(sd=0,U=e):sd=0,vo&&Hs(),Oe(0,!1)}}function ia(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Te(t)))}function aa(){return ta(),na(),ra(),oa()}function oa(){if(ed!==5)return!1;var e=td,t=id;id=0;var n=k(rd),i=32>n?32:n;n=Qa.T;var a=So();try{xo(i),Qa.T=null,i=ad,ad=null;var o=td,s=rd;if(ed=0,nd=td=null,rd=0,Au&6)throw Error(r(331));var c=Au;if(Au|=4,Si(o.current),hi(o,o.current,s,i),Au=c,Oe(0,!1),Lc&&typeof Lc.onPostCommitFiberRoot==`function`)try{Lc.onPostCommitFiberRoot(Ic,o)}catch{}return!0}finally{xo(a),Qa.T=n,ia(e,t)}}function sa(e,t,n){t=F(n,t),t=Un(e.stateNode,t,2),e=ot(e,t,2),e!==null&&(x(e,2),De(e))}function ca(e,t,n){if(e.tag===3)sa(e,e,n);else for(;t!==null;){if(t.tag===3){sa(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&($u===null||!$u.has(r))){e=F(n,e),n=Wn(2),r=ot(t,n,2),r!==null&&(Gn(n,r,t,e),x(r,2),De(r));break}}t=t.return}}function la(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new ku;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ru=!0,i.add(n),e=ua.bind(null,e,t,n),t.then(e,e))}function ua(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ju===e&&(Nu&n)===n&&(Bu===4||Bu===3&&(Nu&62914560)===Nu&&300>kc()-Yu?!(Au&2)&&zi(e,0):Uu|=n,Gu===Nu&&(Gu=0)),De(e)}function da(e,t){t===0&&(t=y()),e=et(e,t),e!==null&&(x(e,t),De(e))}function fa(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),da(e,n)}function pa(e,t){var n=0;switch(e.tag){case 31:case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(r(314))}i!==null&&i.delete(t),da(e,n)}function ma(e,t){return Tc(e,t)}function ha(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ga(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _a(e,n){var r=e.alternate;return r===null?(r=t(e.tag,n,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=n,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,n=e.dependencies,r.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function va(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ya(e,n,i,a,o,s){var c=0;if(a=e,typeof e==`function`)ga(e)&&(c=1);else if(typeof e==`string`)c=Xs&&uc?Zs(e,i,el.current)?26:mc(e)?27:5:Xs?Zs(e,i,el.current)?26:5:uc&&mc(e)?27:5;else a:switch(e){case qa:return e=t(31,i,n,o),e.elementType=qa,e.lanes=s,e;case V:return ba(i.children,o,s,n);case Ra:c=8,o|=24;break;case za:return e=t(12,i,n,o|2),e.elementType=za,e.lanes=s,e;case Ua:return e=t(13,i,n,o),e.elementType=Ua,e.lanes=s,e;case Wa:return e=t(19,i,n,o),e.elementType=Wa,e.lanes=s,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case Va:c=10;break a;case Ba:c=9;break a;case Ha:c=11;break a;case Ga:c=14;break a;case Ka:c=16,a=null;break a}c=29,i=Error(r(130,e===null?`null`:typeof e,``)),a=null}return n=t(c,i,n,o),n.elementType=e,n.type=a,n.lanes=s,n}function ba(e,n,r,i){return e=t(7,e,i,n),e.lanes=r,e}function xa(e,n,r){return e=t(6,e,null,n),e.lanes=r,e}function Sa(e){var n=t(18,null,null,0);return n.stateNode=e,n}function Ca(e,n,r){return n=t(4,e.children===null?[]:e.children,e.key,n),n.lanes=r,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function wa(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=mo,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=b(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=b(0),this.hiddenUpdates=b(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function Ta(e,n,r,i,a,o,s,c,l,u,d,f){return e=new wa(e,n,r,s,l,u,d,f,c),n=1,!0===o&&(n|=24),o=t(3,null,null,n),e.current=o,o.stateNode=e,n=we(),n.refCount++,e.pooledCache=n,n.refCount++,o.memoizedState={element:i,isDehydrated:r,cache:n},rt(o),e}function Ea(e){return e?(e=vc,e):vc}function Da(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=o(t),e=e===null?null:s(e),e===null?null:no(e.stateNode)}function Oa(e,t,n,r,i,a){i=Ea(i),r.context===null?r.context=i:r.pendingContext=i,r=at(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=ot(e,r,t),n!==null&&(Mi(n,e,t),st(n,e,t))}function ka(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Aa(e,t){ka(e,t),(e=e.alternate)&&ka(e,t)}var ja={},Ma=C(),Na=T(),Pa=Object.assign,Fa=Symbol.for(`react.element`),Ia=Symbol.for(`react.transitional.element`),La=Symbol.for(`react.portal`),V=Symbol.for(`react.fragment`),Ra=Symbol.for(`react.strict_mode`),za=Symbol.for(`react.profiler`),Ba=Symbol.for(`react.consumer`),Va=Symbol.for(`react.context`),Ha=Symbol.for(`react.forward_ref`),Ua=Symbol.for(`react.suspense`),Wa=Symbol.for(`react.suspense_list`),Ga=Symbol.for(`react.memo`),Ka=Symbol.for(`react.lazy`),qa=Symbol.for(`react.activity`),Ja=Symbol.for(`react.memo_cache_sentinel`),Ya=Symbol.iterator,Xa=Symbol.for(`react.client.reference`),Za=Array.isArray,Qa=Ma.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$a=e.rendererVersion,eo=e.rendererPackageName,to=e.extraDevToolsConfig,no=e.getPublicInstance,ro=e.getRootHostContext,io=e.getChildHostContext,ao=e.prepareForCommit,oo=e.resetAfterCommit,so=e.createInstance;e.cloneMutableInstance;var H=e.appendInitialChild,co=e.finalizeInitialChildren,lo=e.shouldSetTextContent,uo=e.createTextInstance;e.cloneMutableTextInstance;var fo=e.scheduleTimeout,po=e.cancelTimeout,mo=e.noTimeout,ho=e.isPrimaryRenderer;e.warnsIfNotActing;var go=e.supportsMutation,_o=e.supportsPersistence,vo=e.supportsHydration,yo=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var bo=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var xo=e.setCurrentUpdatePriority,So=e.getCurrentUpdatePriority,Co=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var wo=e.shouldAttemptEagerTransition,To=e.detachDeletedInstance;e.requestPostPaintCallback;var Eo=e.maySuspendCommit,Do=e.maySuspendCommitOnUpdate,Oo=e.maySuspendCommitInSyncRender,ko=e.preloadInstance,Ao=e.startSuspendingCommit,jo=e.suspendInstance;e.suspendOnActiveViewTransition;var Mo=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var No=e.NotPendingTransition,Po=e.HostTransitionContext,Fo=e.resetFormInstance;e.bindToConsole;var Io=e.supportsMicrotasks,Lo=e.scheduleMicrotask,Ro=e.supportsTestSelectors,zo=e.findFiberRoot,Bo=e.getBoundingRect,Vo=e.getTextContent,Ho=e.isHiddenSubtree,Uo=e.matchAccessibilityRole,Wo=e.setFocusIfFocusable,Go=e.setupIntersectionObserver,Ko=e.appendChild,qo=e.appendChildToContainer,Jo=e.commitTextUpdate,Yo=e.commitMount,Xo=e.commitUpdate,Zo=e.insertBefore,Qo=e.insertInContainerBefore,$o=e.removeChild,es=e.removeChildFromContainer,ts=e.resetTextContent,ns=e.hideInstance,rs=e.hideTextInstance,is=e.unhideInstance,as=e.unhideTextInstance;e.cancelViewTransitionName,e.cancelRootViewTransitionName,e.restoreRootViewTransitionName,e.cloneRootViewTransitionContainer,e.removeRootViewTransitionClone,e.measureClonedInstance,e.hasInstanceChanged,e.hasInstanceAffectedParent,e.startViewTransition,e.startGestureTransition,e.stopViewTransition,e.getCurrentGestureOffset,e.createViewTransitionInstance;var os=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var ss=e.cloneInstance,cs=e.createContainerChildSet,ls=e.appendChildToContainerChildSet,us=e.finalizeContainerChildren,ds=e.replaceContainerChildren,fs=e.cloneHiddenInstance,ps=e.cloneHiddenTextInstance,ms=e.isSuspenseInstancePending,hs=e.isSuspenseInstanceFallback,gs=e.getSuspenseInstanceFallbackErrorDetails,_s=e.registerSuspenseInstanceRetry,vs=e.canHydrateFormStateMarker,ys=e.isFormStateMarkerMatching,bs=e.getNextHydratableSibling,xs=e.getNextHydratableSiblingAfterSingleton,Ss=e.getFirstHydratableChild,Cs=e.getFirstHydratableChildWithinContainer,ws=e.getFirstHydratableChildWithinActivityInstance,Ts=e.getFirstHydratableChildWithinSuspenseInstance,Es=e.getFirstHydratableChildWithinSingleton,Ds=e.canHydrateInstance,Os=e.canHydrateTextInstance,ks=e.canHydrateActivityInstance,As=e.canHydrateSuspenseInstance,js=e.hydrateInstance,Ms=e.hydrateTextInstance,Ns=e.hydrateActivityInstance,Ps=e.hydrateSuspenseInstance,Fs=e.getNextHydratableInstanceAfterActivityInstance,Is=e.getNextHydratableInstanceAfterSuspenseInstance,Ls=e.commitHydratedInstance,Rs=e.commitHydratedContainer,zs=e.commitHydratedActivityInstance,Bs=e.commitHydratedSuspenseInstance,Vs=e.finalizeHydratedChildren,Hs=e.flushHydrationEvents;e.clearActivityBoundary;var Us=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var Ws=e.clearSuspenseBoundaryFromContainer,Gs=e.hideDehydratedBoundary,Ks=e.unhideDehydratedBoundary,qs=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var Js=e.validateHydratableInstance,Ys=e.validateHydratableTextInstance,Xs=e.supportsResources,Zs=e.isHostHoistableType,Qs=e.getHoistableRoot,$s=e.getResource,ec=e.acquireResource,tc=e.releaseResource,nc=e.hydrateHoistable,rc=e.mountHoistable,ic=e.unmountHoistable,ac=e.createHoistableInstance,oc=e.prepareToCommitHoistables,sc=e.mayResourceSuspendCommit,cc=e.preloadResource,lc=e.suspendResource,uc=e.supportsSingletons,dc=e.resolveSingletonInstance,fc=e.acquireSingletonInstance,pc=e.releaseSingletonInstance,mc=e.isHostSingletonType,hc=e.isSingletonScope,gc=[],_c=-1,vc={},yc=Math.clz32?Math.clz32:m,bc=Math.log,xc=Math.LN2,Sc=256,Cc=262144,wc=4194304,Tc=Na.unstable_scheduleCallback,Ec=Na.unstable_cancelCallback,Dc=Na.unstable_shouldYield,Oc=Na.unstable_requestPaint,kc=Na.unstable_now,Ac=Na.unstable_ImmediatePriority,jc=Na.unstable_UserBlockingPriority,Mc=Na.unstable_NormalPriority,Nc=Na.unstable_IdlePriority,Pc=Na.log,Fc=Na.unstable_setDisableYieldValue,Ic=null,Lc=null,Rc=typeof Object.is==`function`?Object.is:ee,zc=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Bc=Object.prototype.hasOwnProperty,Vc,Hc,Uc=!1,Wc=new WeakMap,Gc=[],Kc=0,qc=null,Jc=0,Yc=[],Xc=0,Zc=null,Qc=1,$c=``,el=d(null),tl=d(null),nl=d(null),rl=d(null),il=null,al=null,ol=!1,sl=null,cl=!1,ll=Error(r(519)),ul=d(null),dl=null,fl=null,pl=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ml=Na.unstable_scheduleCallback,hl=Na.unstable_NormalPriority,gl={$$typeof:Va,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},_l=null,vl=null,yl=!1,bl=!1,xl=!1,Sl=0,Cl=null,wl=0,Tl=0,El=null,Dl=Qa.S;Qa.S=function(e,t){Xu=kc(),typeof t==`object`&&t&&typeof t.then==`function`&&Ie(e,t),Dl!==null&&Dl(e,t)};var Ol=d(null),kl=Error(r(460)),Al=Error(r(474)),jl=Error(r(542)),Ml={then:function(){}},Nl=null,Pl=null,Fl=0,Il=Xe(!0),Ll=Xe(!1),Rl=[],zl=0,Bl=0,Vl=!1,Hl=!1,Ul=d(null),Wl=d(0),Gl=d(null),Kl=null,ql=d(0),Jl=0,Yl=null,Xl=null,Zl=null,Ql=!1,$l=!1,eu=!1,tu=0,nu=0,ru=null,iu=0,au={readContext:xe,use:Ft,useCallback:St,useContext:St,useEffect:St,useImperativeHandle:St,useLayoutEffect:St,useInsertionEffect:St,useMemo:St,useReducer:St,useRef:St,useState:St,useDebugValue:St,useDeferredValue:St,useTransition:St,useSyncExternalStore:St,useId:St,useHostTransitionStatus:St,useFormState:St,useActionState:St,useOptimistic:St,useMemoCache:St,useCacheRefresh:St};au.useEffectEvent=St;var ou={readContext:xe,use:Ft,useCallback:function(e,t){return jt().memoizedState=[e,t===void 0?null:t],e},useContext:xe,useEffect:fn,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),un(4194308,4,vn.bind(null,t,e),n)},useLayoutEffect:function(e,t){return un(4194308,4,e,t)},useInsertionEffect:function(e,t){un(4,2,e,t)},useMemo:function(e,t){var n=jt();t=t===void 0?null:t;var r=e();if(eu){A(!0);try{e()}finally{A(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=jt();if(n!==void 0){var i=n(t);if(eu){A(!0);try{n(t)}finally{A(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=jn.bind(null,Yl,e),[r.memoizedState,e]},useRef:function(e){var t=jt();return e={current:e},t.memoizedState=e},useState:function(e){e=qt(e);var t=e.queue,n=Mn.bind(null,Yl,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:bn,useDeferredValue:function(e,t){return Cn(jt(),e,t)},useTransition:function(){var e=qt(!1);return e=Tn.bind(null,Yl,e.queue,!0,!1),jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=Yl,a=jt();if(ol){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),ju===null)throw Error(r(349));Nu&127||Ht(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,fn(Wt.bind(null,i,o,e),[e]),i.flags|=2048,cn(9,{destroy:void 0},Ut.bind(null,i,o,n,t),null),n},useId:function(){var e=jt(),t=ju.identifierPrefix;if(ol){var n=$c,r=Qc;n=(r&~(1<<32-yc(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=tu++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=iu++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Dn,useFormState:nn,useActionState:nn,useOptimistic:function(e){var t=jt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Pn.bind(null,Yl,!0,n),n.dispatch=t,[e,t]},useMemoCache:It,useCacheRefresh:function(){return jt().memoizedState=An.bind(null,Yl)},useEffectEvent:function(e){var t=jt(),n={impl:e};return t.memoizedState=n,function(){if(Au&2)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},su={readContext:xe,use:Ft,useCallback:xn,useContext:xe,useEffect:pn,useImperativeHandle:yn,useInsertionEffect:gn,useLayoutEffect:_n,useMemo:Sn,useReducer:Rt,useRef:ln,useState:function(){return Rt(Lt)},useDebugValue:bn,useDeferredValue:function(e,t){return wn(Mt(),Xl.memoizedState,e,t)},useTransition:function(){var e=Rt(Lt)[0],t=Mt().memoizedState;return[typeof e==`boolean`?e:Pt(e),t]},useSyncExternalStore:Vt,useId:On,useHostTransitionStatus:Dn,useFormState:rn,useActionState:rn,useOptimistic:function(e,t){return Jt(Mt(),Xl,e,t)},useMemoCache:It,useCacheRefresh:kn};su.useEffectEvent=hn;var cu={readContext:xe,use:Ft,useCallback:xn,useContext:xe,useEffect:pn,useImperativeHandle:yn,useInsertionEffect:gn,useLayoutEffect:_n,useMemo:Sn,useReducer:Bt,useRef:ln,useState:function(){return Bt(Lt)},useDebugValue:bn,useDeferredValue:function(e,t){var n=Mt();return Xl===null?Cn(n,e,t):wn(n,Xl.memoizedState,e,t)},useTransition:function(){var e=Bt(Lt)[0],t=Mt().memoizedState;return[typeof e==`boolean`?e:Pt(e),t]},useSyncExternalStore:Vt,useId:On,useHostTransitionStatus:Dn,useFormState:sn,useActionState:sn,useOptimistic:function(e,t){var n=Mt();return Xl===null?(n.baseState=e,[e,n.queue.dispatch]):Jt(n,Xl,e,t)},useMemoCache:It,useCacheRefresh:kn};cu.useEffectEvent=hn;var lu={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ai(),i=at(r);i.payload=t,n!=null&&(i.callback=n),t=ot(e,i,r),t!==null&&(Mi(t,e,r),st(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ai(),i=at(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=ot(e,i,r),t!==null&&(Mi(t,e,r),st(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ai(),r=at(n);r.tag=2,t!=null&&(r.callback=t),t=ot(e,r,n),t!==null&&(Mi(t,e,n),st(t,e,n))}},uu=Error(r(461)),du=!1,fu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},pu=!1,mu=!1,hu=!1,gu=typeof WeakSet==`function`?WeakSet:Set,_u=null,vu=null,yu=!1,bu=null,xu=8192,Su={getCacheForType:function(e){var t=xe(gl),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return xe(gl).controller.signal}},Cu=0,wu=1,Tu=2,Eu=3,Du=4;if(typeof Symbol==`function`&&Symbol.for){var Ou=Symbol.for;Cu=Ou(`selector.component`),wu=Ou(`selector.has_pseudo_class`),Tu=Ou(`selector.role`),Eu=Ou(`selector.test_id`),Du=Ou(`selector.text`)}var ku=typeof WeakMap==`function`?WeakMap:Map,Au=0,ju=null,Mu=null,Nu=0,Pu=0,Fu=null,Iu=!1,Lu=!1,Ru=!1,zu=0,Bu=0,Vu=0,Hu=0,Uu=0,Wu=0,Gu=0,Ku=null,qu=null,Ju=!1,Yu=0,Xu=0,Zu=1/0,Qu=null,$u=null,ed=0,td=null,nd=null,rd=0,id=0,ad=null,od=null,sd=0,U=null;return ja.attemptContinuousHydration=function(e){if(e.tag===13||e.tag===31){var t=et(e,67108864);t!==null&&Mi(t,e,67108864),Aa(e,67108864)}},ja.attemptHydrationAtCurrentPriority=function(e){if(e.tag===13||e.tag===31){var t=Ai();t=O(t);var n=et(e,t);n!==null&&Mi(n,e,t),Aa(e,t)}},ja.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if(e=e.stateNode,e.current.memoizedState.isDehydrated){var t=h(e.pendingLanes);if(t!==0){for(e.pendingLanes|=2,e.entangledLanes|=2;t;){var n=1<<31-yc(t);e.entanglements[1]|=n,t&=~n}De(e),!(Au&6)&&(Zu=kc()+500,Oe(0,!1))}}break;case 31:case 13:t=et(e,2),t!==null&&Mi(t,e,2),Li(),Aa(e,2)}},ja.batchedUpdates=function(e,t){return e(t)},ja.createComponentSelector=function(e){return{$$typeof:Cu,value:e}},ja.createContainer=function(e,t,n,r,i,a,o,s,c,l){return Ta(e,t,!1,null,n,r,a,null,o,s,c,l)},ja.createHasPseudoClassSelector=function(e){return{$$typeof:wu,value:e}},ja.createHydrationContainer=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p){return e=Ta(n,r,!0,e,i,a,s,p,c,l,u,d),e.context=Ea(null),n=e.current,r=Ai(),r=O(r),i=at(r),i.callback=t??null,ot(n,i,r),t=r,e.current.lanes=t,x(e,t),De(e),e},ja.createPortal=function(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:La,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}},ja.createRoleSelector=function(e){return{$$typeof:Tu,value:e}},ja.createTestNameSelector=function(e){return{$$typeof:Eu,value:e}},ja.createTextSelector=function(e){return{$$typeof:Du,value:e}},ja.defaultOnCaughtError=function(e){console.error(e)},ja.defaultOnRecoverableError=function(e){zc(e)},ja.defaultOnUncaughtError=function(e){zc(e)},ja.deferredUpdates=function(e){var t=Qa.T,n=So();try{return xo(32),Qa.T=null,e()}finally{xo(n),Qa.T=t}},ja.discreteUpdates=function(e,t,n,r,i){var a=Qa.T,o=So();try{return xo(2),Qa.T=null,e(t,n,r,i)}finally{xo(o),Qa.T=a,Au===0&&(Zu=kc()+500)}},ja.findAllNodes=ki,ja.findBoundingRects=function(e,t){if(!Ro)throw Error(r(363));t=ki(e,t),e=[];for(var n=0;n<t.length;n++)e.push(Bo(t[n]));for(t=e.length-1;0<t;t--){n=e[t];for(var i=n.x,a=i+n.width,o=n.y,s=o+n.height,c=t-1;0<=c;c--)if(t!==c){var l=e[c],u=l.x,d=u+l.width,f=l.y,p=f+l.height;if(i>=u&&o>=f&&a<=d&&s<=p){e.splice(t,1);break}if(!(i!==u||n.width!==l.width||p<o||f>s)){f>o&&(l.height+=f-o,l.y=o),p<s&&(l.height=s-f),e.splice(t,1);break}if(!(o!==f||n.height!==l.height||d<i||u>a)){u>i&&(l.width+=u-i,l.x=i),d<a&&(l.width=a-u),e.splice(t,1);break}}}return e},ja.findHostInstance=Da,ja.findHostInstanceWithNoPortals=function(e){return e=o(e),e=e===null?null:c(e),e===null?null:no(e.stateNode)},ja.findHostInstanceWithWarning=function(e){return Da(e)},ja.flushPassiveEffects=aa,ja.flushSyncFromReconciler=function(e){var t=Au;Au|=1;var n=Qa.T,r=So();try{if(xo(2),Qa.T=null,e)return e()}finally{xo(r),Qa.T=n,Au=t,!(Au&6)&&Oe(0,!1)}},ja.flushSyncWork=Li,ja.focusWithin=function(e,t){if(!Ro)throw Error(r(363));for(e=Ti(e),t=Oi(e,t),t=Array.from(t),e=0;e<t.length;){var n=t[e++],i=n.tag;if(!Ho(n)){if((i===5||i===26||i===27)&&Wo(n.stateNode))return!0;for(n=n.child;n!==null;)t.push(n),n=n.sibling}}return!1},ja.getFindAllNodesFailureDescription=function(e,t){if(!Ro)throw Error(r(363));var n=0,i=[];e=[Ti(e),0];for(var a=0;a<e.length;){var o=e[a++],s=o.tag,c=e[a++],l=t[c];if((s!==5&&s!==26&&s!==27||!Ho(o))&&(Ei(o,l)&&(i.push(Di(l)),c++,c>n&&(n=c)),c<t.length))for(o=o.child;o!==null;)e.push(o,c),o=o.sibling}if(n<t.length){for(e=[];n<t.length;n++)e.push(Di(t[n]));return`findAllNodes was able to match part of the selector:
84
+ `+(i.join(` > `)+`
85
+
86
+ No matching component was found for:
87
+ `)+e.join(` > `)}return null},ja.getPublicRootInstance=function(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 27:case 5:return no(e.child.stateNode);default:return e.child.stateNode}},ja.injectIntoDevTools=function(){var e={bundleType:0,version:$a,rendererPackageName:eo,currentDispatcherRef:Qa,reconcilerVersion:`19.2.0`};if(to!==null&&(e.rendererConfig=to),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{Ic=t.inject(e),Lc=t}catch{}e=!!t.checkDCE}}return e},ja.isAlreadyRendering=function(){return!!(Au&6)},ja.observeVisibleRects=function(e,t,n,i){if(!Ro)throw Error(r(363));e=ki(e,t);var a=Go(e,n,i).disconnect;return{disconnect:function(){a()}}},ja.shouldError=function(){return null},ja.shouldSuspend=function(){return!1},ja.startHostTransition=function(e,t,i,a){if(e.tag!==5)throw Error(r(476));var o=En(e).queue;Tn(e,o,t,No,i===null?n:function(){var t=En(e);return t.next===null&&(t=e.alternate.memoizedState),Nn(e,t.next.queue,{},Ai()),i(a)})},ja.updateContainer=function(e,t,n,r){var i=t.current,a=Ai();return Oa(i,a,e,t,n,r),a},ja.updateContainerSync=function(e,t,n,r){return Oa(t.current,2,e,t,n,r),2},ja},t.exports.default=t.exports,Object.defineProperty(t.exports,"__esModule",{value:!0})})),op=n(((e,t)=>{t.exports=ap()})),sp=n((e=>{e.ConcurrentRoot=1,e.DefaultEventPriority=32,e.DiscreteEventPriority=2})),cp=n(((e,t)=>{t.exports=sp()})),lp=t(op()),up=cp(),dp={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0},fp=!1,pp=!1,mp=`.react-konva-event`,hp=!1,gp=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.
88
+ Position of a node will be changed during drag&drop, so you should update state of the react app as well.
89
+ Consider to add onDragMove or onDragEnd events.
90
+ For more info see: https://github.com/konvajs/react-konva/issues/256
91
+ `,_p=`ReactKonva: You are using "zIndex" attribute for a Konva node.
92
+ react-konva may get confused with ordering. Just define correct order of elements in your render function of a component.
93
+ For more info see: https://github.com/konvajs/react-konva/issues/194
94
+ `,vp={},yp=()=>{};function bp(e){yp=e}var xp=!1;function Sp(e){return function(...t){let n=e.apply(this,t);if(!xp){xp=!0;try{yp()}finally{xp=!1}}return n}}function Cp(e,t,n=vp){if(!fp&&`zIndex`in t&&(console.warn(_p),fp=!0),!pp&&t.draggable){var r=t.x!==void 0||t.y!==void 0,i=t.onDragEnd||t.onDragMove;r&&!i&&(console.warn(gp),pp=!0)}for(var a in n)if(!dp[a]){var o=a.slice(0,2)===`on`,s=n[a]!==t[a];if(o&&s){var c=a.substr(2).toLowerCase();c.substr(0,7)===`content`&&(c=`content`+c.substr(7,1).toUpperCase()+c.substr(8)),e.off(c+mp)}t.hasOwnProperty(a)||e.setAttr(a,void 0)}var l=hp||t._useStrictMode,u={},d=!1;let f={};for(var a in t)if(!dp[a]){var o=a.slice(0,2)===`on`,p=n[a]!==t[a];if(o&&p){var c=a.substr(2).toLowerCase();c.substr(0,7)===`content`&&(c=`content`+c.substr(7,1).toUpperCase()+c.substr(8)),t[a]&&(f[c]=t[a])}!o&&(t[a]!==n[a]||l&&t[a]!==e.getAttr(a))&&(d=!0,u[a]=t[a])}for(var c in d&&(e.setAttrs(u),wp(e)),f)e.off(c+mp),e.on(c+mp,Sp(f[c]))}function wp(e){if(!f.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}var Tp=e({HostTransitionContext:()=>Em,NotPendingTransition:()=>null,afterActiveInstanceBlur:()=>lm,appendChild:()=>Kp,appendChildToContainer:()=>qp,appendInitialChild:()=>kp,beforeActiveInstanceBlur:()=>cm,cancelTimeout:()=>Up,clearContainer:()=>am,commitMount:()=>$p,commitTextUpdate:()=>Qp,commitUpdate:()=>em,createInstance:()=>Ap,createTextInstance:()=>jp,detachDeletedInstance:()=>om,finalizeInitialChildren:()=>Mp,getChildHostContext:()=>Vp,getCurrentEventPriority:()=>um,getCurrentUpdatePriority:()=>mm,getInstanceFromNode:()=>sm,getInstanceFromScope:()=>fm,getPublicInstance:()=>Np,getRootHostContext:()=>Bp,hideInstance:()=>tm,hideTextInstance:()=>nm,idlePriority:()=>Df.unstable_IdlePriority,insertBefore:()=>Jp,insertInContainerBefore:()=>Yp,isPrimaryRenderer:()=>!1,maySuspendCommit:()=>xm,noTimeout:()=>-1,now:()=>Df.unstable_now,preloadInstance:()=>Sm,prepareForCommit:()=>Pp,preparePortalMount:()=>Fp,prepareScopeUpdate:()=>dm,prepareUpdate:()=>Ip,removeChild:()=>Xp,removeChildFromContainer:()=>Zp,requestPostPaintCallback:()=>bm,resetAfterCommit:()=>Lp,resetFormInstance:()=>Dm,resetTextContent:()=>Rp,resolveEventTimeStamp:()=>ym,resolveEventType:()=>vm,resolveUpdatePriority:()=>hm,run:()=>Df.unstable_runWithPriority,scheduleMicrotask:()=>Wp,scheduleTimeout:()=>Hp,setCurrentUpdatePriority:()=>pm,shouldAttemptEagerTransition:()=>gm,shouldDeprioritizeSubtree:()=>zp,shouldSetTextContent:()=>Gp,startSuspendingCommit:()=>Cm,supportsHydration:()=>!1,supportsMicrotasks:()=>!0,supportsMutation:()=>!0,supportsPersistence:()=>!1,suspendInstance:()=>wm,trackSchedulerEvent:()=>_m,unhideInstance:()=>rm,unhideTextInstance:()=>im,waitForCommitToBeReady:()=>Tm,warnsIfNotActing:()=>!1}),Ep={},Dp={};ip.Node.prototype._applyProps=Cp;var Op=up.DefaultEventPriority;function kp(e,t){if(typeof t==`string`){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`);return}e.add(t),wp(e)}function Ap(e,t,n){let r=ip[e];r||=(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),ip.Group);let i={},a={};for(var o in t)o!==`ref`&&(o.slice(0,2)===`on`?a[o]=t[o]:i[o]=t[o]);let s=new r(i);return Cp(s,a),s}function jp(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function Mp(e,t,n){return!1}function Np(e){return e}function Pp(){return null}function Fp(){return null}function Ip(e,t,n,r){return Dp}function Lp(){}function Rp(e){}function zp(e,t){return!1}function Bp(){return Ep}function Vp(){return Ep}var Hp=setTimeout,Up=clearTimeout,Wp=typeof queueMicrotask==`function`?queueMicrotask:e=>Promise.resolve(null).then(e);function Gp(e,t){return!1}function Kp(e,t){t.parent===e?t.moveToTop():e.add(t),wp(e)}function qp(e,t){t.parent===e?t.moveToTop():e.add(t),wp(e)}function Jp(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),wp(e)}function Yp(e,t,n){Jp(e,t,n)}function Xp(e,t){t.destroy(),t.off(mp),wp(e)}function Zp(e,t){t.destroy(),t.off(mp),wp(e)}function Qp(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function $p(e,t,n){}function em(e,t,n,r){Cp(e,r,n)}function tm(e){e.hide(),wp(e)}function nm(e){}function rm(e,t){(t.visible==null||t.visible)&&e.show()}function im(e,t){}function am(e){}function om(){}function sm(){return null}function cm(){}function lm(){}function um(){return up.DefaultEventPriority}function dm(){}function fm(){return null}function pm(e){Op=e}function mm(){return Op}function hm(){return up.DiscreteEventPriority}function gm(){return!1}function _m(){}function vm(){return null}function ym(){return-1.1}function bm(){}function xm(){return!1}function Sm(){return!0}function Cm(){}function wm(){}function Tm(){return null}var Em=j.createContext(null);function Dm(){}typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`)?j.useLayoutEffect:j.useEffect;function Om(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){let e=Om(r,t,n);if(e)return e;r=t?null:r.sibling}}function km(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}var Am=km(j.createContext(null)),jm=class extends j.Component{render(){return j.createElement(Am.Provider,{value:this._reactInternals},this.props.children)}};function Mm(){let e=j.useContext(Am);if(e===null)throw Error(`its-fine: useFiber must be called within a <FiberProvider />!`);let t=j.useId();return j.useMemo(()=>{for(let n of[e,e?.alternate]){if(!n)continue;let e=Om(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}var Nm=Symbol.for(`react.context`),Pm=e=>typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Nm;function Fm(){let e=Mm(),[t]=j.useState(()=>new Map);t.clear();let n=e;for(;n;){let e=n.type;Pm(e)&&e!==Am&&!t.has(e)&&t.set(e,j.use(km(e))),n=n.return}return t}function Im(){let e=Fm();return j.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>j.createElement(t,null,j.createElement(n.Provider,{...r,value:e.get(n)})),e=>j.createElement(jm,{...e})),[e])}function Lm(e){let t=j.useRef({});return j.useLayoutEffect(()=>{t.current=e}),j.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}var Rm=()=>{let e=j.useRef(0);return j.useMemo(()=>{e.current++},[]),e.current>1},zm=e=>{let t=j.useRef(null),n=j.useRef(null),r=j.useRef(null),i=Lm(e),a=Im(),o=j.useRef(null),s=t=>{let{forwardedRef:n}=e;n&&(typeof n==`function`?n(t):n.current=t)},c=Rm(),l=()=>{s(null),Qm.flushSyncFromReconciler(()=>{Qm.updateContainer(null,r.current,null)}),n.current?.destroy(),n.current=null};return j.useLayoutEffect(()=>(o.current&&=(clearTimeout(o.current),null),n.current?s(n.current):(n.current=new ip.Stage({width:e.width,height:e.height,container:t.current}),s(n.current),r.current=Qm.createContainer(n.current,up.ConcurrentRoot,null,!1,null,``,console.error,console.error,console.error,null),Qm.updateContainer(j.createElement(a,{},e.children),r.current,null,()=>{})),()=>{c?o.current=setTimeout(l,0):l()}),[]),j.useLayoutEffect(()=>{s(n.current),Cp(n.current,e,i),Qm.updateContainer(j.createElement(a,{},e.children),r.current,null),Qm.flushSyncWork()}),j.createElement(`div`,{ref:t,id:e.id,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},Bm=`Layer`,Vm=`Group`,Hm=`Label`,Um=`Rect`,Wm=`Circle`,Gm=`Line`,Km=`Image`,qm=`Text`,Jm=`TextPath`,Ym=`Path`,Xm=`Shape`,Zm=`Transformer`,Qm=(0,lp.default)(Tp);bp(()=>Qm.flushSyncWork());var $m=j.forwardRef((e,t)=>j.createElement(jm,{},j.createElement(zm,{...e,forwardedRef:t}))),eh=t(n(((e,t)=>{var n=C();t.exports=function(e,t,r){let i=n.useRef(`loading`),a=n.useRef(),[o,s]=n.useState(0),c=n.useRef(),l=n.useRef(),u=n.useRef();return(c.current!==e||l.current!==t||u.current!==r)&&(i.current=`loading`,a.current=void 0,c.current=e,l.current=t,u.current=r),n.useLayoutEffect(function(){if(!e)return;var n=document.createElement(`img`);function o(){n.decode().catch(()=>{}).finally(()=>{i.current=`loaded`,a.current=n,s(Math.random())})}function c(){i.current=`failed`,a.current=void 0,s(Math.random())}return n.addEventListener(`load`,o),n.addEventListener(`error`,c),t&&(n.crossOrigin=t),r&&(n.referrerPolicy=r),n.src=e,function(){n.removeEventListener(`load`,o),n.removeEventListener(`error`,c)}},[e,t,r]),[a.current,i.current]}}))()),th=20,nh=new d.Group;nh.add(new d.Rect({width:th,height:th,fill:`white`})),nh.add(new d.Path({scaleX:.8333333333333334,scaleY:.8333333333333334,data:`M4.98313549,11.0001422 C5.49589839,10.9914935 5.92501998,11.3703506 5.99116425,11.8666444 L5.99985778,11.9831355 L6.00348884,12.2068855 C6.11245031,15.4321748 8.76323537,17.9999971 11.9999971,17.9999971 C12.1869612,17.9999971 12.3726725,17.9914753 12.5567465,17.9745765 L12.2928932,17.7071068 C11.9023689,17.3165825 11.9023689,16.6834175 12.2928932,16.2928932 C12.6834175,15.9023689 13.3165825,15.9023689 13.7071068,16.2928932 L15.7071068,18.2928932 C16.0976311,18.6834175 16.0976311,19.3165825 15.7071068,19.7071068 L13.7071068,21.7071068 C13.3165825,22.0976311 12.6834175,22.0976311 12.2928932,21.7071068 C11.9023689,21.3165825 11.9023689,20.6834175 12.2928932,20.2928932 L12.6111505,19.9769552 C12.4086045,19.9922816 12.2047796,19.9999971 11.9999971,19.9999971 C7.7687005,19.9999971 4.28886152,16.7094374 4.01666425,12.5105203 L4.00420123,12.2575143 L4.00014222,12.0168645 C3.9908282,11.4646583 4.43092928,11.0094562 4.98313549,11.0001422 Z M11.7071068,2.29289322 C12.0675907,2.65337718 12.0953203,3.22060824 11.7902954,3.61289944 L11.7071068,3.70710678 L11.3891629,4.0230186 C11.5916051,4.00770767 11.7953244,4 12,4 C16.418278,4 20,7.581722 20,12 C20,12.5522847 19.5522847,13 19,13 C18.4477153,13 18,12.5522847 18,12 C18,8.6862915 15.3137085,6 12,6 C11.8129339,6 11.6271216,6.00853145 11.4429483,6.02544919 L11.7071068,6.29289322 C12.0976311,6.68341751 12.0976311,7.31658249 11.7071068,7.70710678 C11.3466228,8.06759074 10.7793918,8.09532028 10.3871006,7.79029539 L10.2928932,7.70710678 L8.29289322,5.70710678 C7.93240926,5.34662282 7.90467972,4.77939176 8.20970461,4.38710056 L8.29289322,4.29289322 L10.2928932,2.29289322 C10.6834175,1.90236893 11.3165825,1.90236893 11.7071068,2.29289322 Z`,fill:`black`}));var rh=nh.toCanvas({pixelRatio:2,width:th,height:th}),ih={borderEnabled:!0,anchorSize:10,anchorCornerRadius:0,anchorFill:`white`,anchorStroke:`rgb(0, 161, 255)`,anchorStrokeWidth:2,borderStrokeWidth:2,rotateAnchorOffset:30,anchorStyleFunc:e=>{e.hasName(`rotater`)&&e.setAttrs({width:20,height:20,cornerRadius:10,offsetX:10,offsetY:10,fillPatternImage:rh,fillPatternScaleX:20/th/2,fillPatternScaleY:20/th/2,fillPriority:`pattern`,fillPatternRepeat:`no-repeat`})}},ah={anchorFill:`rgb(240, 240, 240)`,anchorStrokeWidth:2,borderStrokeWidth:2},oh={anchorSize:20,anchorCornerRadius:10,anchorStrokeWidth:2,borderStrokeWidth:2},sh={stroke:`rgb(0, 161, 255)`,strokeWidth:2},ch={stroke:`rgb(0, 161, 255)`,strokeWidth:1,dash:[4,6]},lh={fill:`rgba(0, 161, 255, 0.3)`,stroke:`rgb(0, 161, 255)`,strokeWidth:1},uh={fill:`rgb(0, 161, 255)`,textFill:`white`},dh={stroke:`rgb(0, 161, 255)`,labelFill:`rgb(0, 161, 255)`,labelTextFill:`white`},fh={fill:`rgba(124, 173, 212, 0.8)`,textFill:`white`},ph={fill:`rgba(223, 102, 102, 0.8)`,textFill:`white`},mh={stroke:`red`},hh={backgroundColor:`#e8e8e8`,textColor:`grey`,borderColor:`grey`,borderSize:1,tickColor:`grey`,tickSize:1},gh=`rgba(255, 0, 0, 0.1)`;function _h(e,t){if(!t)return Object.assign({},e);let n=Object.assign({},e);for(let e in t){let r=t[e];r!==void 0&&(n[e]=r)}return n}function vh(e={}){return{editorAccentColor:`rgb(0, 161, 255)`,cropOverlayFill:e.cropOverlayFill??`rgba(0,0,0,0.3)`,workspaceBackgroundColor:e.workspaceBackgroundColor??`rgba(232, 232, 232, 0.9)`,pageBorderColor:e.pageBorderColor??`lightgrey`,activePageBorderColor:e.activePageBorderColor??`rgb(0, 161, 255)`,bleedColor:e.bleedColor??gh,transparencyBackgroundColor:e.transparencyBackgroundColor,transformerStyle:_h(ih,e.transformerStyle),innerImageCropTransformerStyle:_h(ah,e.innerImageCropTransformerStyle),outerImageCropTransformerStyle:_h(oh,e.outerImageCropTransformerStyle),highlighterStyle:_h(sh,e.highlighterStyle),snapGuideStyle:_h(ch,{stroke:e.snapGuideStroke,strokeWidth:e.snapGuideStrokeWidth,dash:e.snapGuideDash}),selectionRectStyle:_h(lh,{fill:e.selectionRectFill,stroke:e.selectionRectStroke,strokeWidth:e.selectionRectStrokeWidth}),transformLabelStyle:_h(uh,{fill:e.transformLabelFill,textFill:e.transformLabelTextFill}),distanceGuideStyle:_h(dh,{stroke:e.distanceGuideStroke,labelFill:e.distanceLabelFill,labelTextFill:e.distanceLabelTextFill}),mediaLoadingStyle:_h(fh,e.mediaLoadingStyle),mediaErrorStyle:_h(ph,e.mediaErrorStyle),textOverflowIndicatorStyle:_h(mh,e.textOverflowIndicatorStyle),rulerStyle:_h(hh,{backgroundColor:e.rulerBackgroundColor,textColor:e.rulerTextColor,borderColor:e.rulerBorderColor,borderSize:e.rulerBorderSize,tickColor:e.rulerTickColor,tickSize:e.rulerTickSize})}}var yh=j.createContext(null),bh=yh.Provider;function xh(){return j.useContext(yh)||vh()}var Sh=0,Ch=new Set;function wh(e){return Ch.add(e),()=>{Ch.delete(e)}}function Th(){return Sh}function Eh(e){let t=j.useSyncExternalStore(wh,Th,Th),n=j.useRef(null);return n.current&&n.current.revision===t&&function(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Dh(e[r],t[r]))return!1;return!0}(n.current.overrides,e)||(n.current={overrides:e,revision:t,resolved:vh(e)}),n.current.resolved}function Dh(e,t){if(e===t)return!0;if(e==null||t==null)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}if(typeof e==`object`&&typeof t==`object`&&!Array.isArray(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}return!1}var Oh=`warn`;function kh(e){Oh=e}function Ah(){return Oh}var jh;(function(e){e.afterCreate=`afterCreate`,e.afterAttach=`afterAttach`,e.afterCreationFinalization=`afterCreationFinalization`,e.beforeDetach=`beforeDetach`,e.beforeDestroy=`beforeDestroy`})(jh||={});var Mh=function(e,t){return Mh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Mh(e,t)};function Nh(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);Mh(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Ph=function(){return Ph=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ph.apply(this,arguments)};function Fh(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Ih(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function Lh(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Rh(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function zh(e){return Zg(e,1),Qg(e).type}function Bh(e,t){return Zg(e,1),N_(t,2),Qg(e).onSnapshot(t)}function Vh(e,t){Zg(e,1),M_(t,function(e){return typeof e==`object`},`object or array`,2),Qg(e).applyPatches(p_(t))}function Hh(e,t){return Zg(e,1),Qg(e).applySnapshot(t)}function Uh(e,t){t===void 0&&(t=!0),Zg(e,1);var n=Qg(e);return t?n.snapshot:v_(n.type.getSnapshot(n,!1))}function Wh(e,t){t===void 0&&(t=1),Zg(e,1),P_(t,2,0);for(var n=t,r=Qg(e).parent;r;){if(--n===0)return r.storedValue;r=r.parent}throw new G(`Failed to find the parent of ${Qg(e)} at depth ${t}`)}function Gh(e,t){Zg(e,1),yg(t,2);for(var n=Qg(e).parent;n;){if(t.is(n.storedValue))return!0;n=n.parent}return!1}function Kh(e,t){Zg(e,1),yg(t,2);for(var n=Qg(e).parent;n;){if(t.is(n.storedValue))return n.storedValue;n=n.parent}throw new G(`Failed to find the parent of ${Qg(e)} of a given type`)}function qh(e){return Zg(e,1),Qg(e).root.storedValue}function Jh(e){return Zg(e,1),Qg(e).path}function Yh(e,t){Zg(e,1),F_(t,2);var n=t_(Qg(e),t);return n?n.value:void 0}function Xh(e){return Zg(e,1),Qg(e).identifier}function Zh(e){return Zg(e,1),Qg(e).detach(),e}function Qh(e){Zg(e,1);var t=Qg(e);t.isRoot?t.die():t.parent.removeChild(t.subpath)}function $h(e){return Zg(e,1),Qg(e).observableIsAlive}function eg(e){return e}var tg=function(){function e(e,t,n,r){Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"environment",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_escapedSubpath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_subpath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_subpathUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pathUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storedValue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"aliveAtom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_state",{enumerable:!0,configurable:!0,writable:!0,value:Yg.INITIALIZING}),Object.defineProperty(this,"_hookSubscribers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pathAtom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.environment=r,this.baseSetParent(t,n)}return Object.defineProperty(e.prototype,"subpath",{get:function(){return this._subpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subpathUponDeath",{get:function(){return this._subpathUponDeath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pathUponDeath",{get:function(){return this._pathUponDeath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.type.getValue(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},set:function(e){var t=this.isAlive;this._state=e;var n=this.isAlive;this.aliveAtom&&t!==n&&this.aliveAtom.reportChanged()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fireInternalHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._hookSubscribers&&this._hookSubscribers.emit(e,this,e)}}),Object.defineProperty(e.prototype,"registerHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._hookSubscribers||=new T_,this._hookSubscribers.register(e,t)}}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getReconciliationType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type}}),Object.defineProperty(e.prototype,"baseSetParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._parent=e,this._subpath=t,this._escapedSubpath=void 0,this.pathAtom&&this.pathAtom.reportChanged()}}),Object.defineProperty(e.prototype,"path",{get:function(){return this.getEscapedPath(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getEscapedPath",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e&&(this.pathAtom||=Ze(`path`),this.pathAtom.reportObserved()),this.parent?(this._escapedSubpath===void 0&&(this._escapedSubpath=this._subpath?V_(this._subpath):``),this.parent.getEscapedPath(e)+`/`+this._escapedSubpath):``}}),Object.defineProperty(e.prototype,"isRoot",{get:function(){return this.parent===null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isAlive",{get:function(){return this.state!==Yg.DEAD},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDetaching",{get:function(){return this.state===Yg.DETACHING},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"observableIsAlive",{get:function(){return this.aliveAtom||=Ze(`alive`),this.aliveAtom.reportObserved(),this.isAlive},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseFinalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(j_()&&!this.isAlive)throw new G(`assertion failed: cannot finalize the creation of a node that is already dead`);if(this.state===Yg.CREATED){if(this.parent){if(this.parent.state!==Yg.FINALIZED)return;this.fireHook(jh.afterAttach)}this.state=Yg.FINALIZED,e&&e()}}}),Object.defineProperty(e.prototype,"baseFinalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._hookSubscribers&&this._hookSubscribers.clearAll(),this._subpathUponDeath=this._subpath,this._pathUponDeath=this.getEscapedPath(!1),this.baseSetParent(null,``),this.state=Yg.DEAD}}),Object.defineProperty(e.prototype,"baseAboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.fireHook(jh.beforeDestroy)}}),e}(),ng=function(e){Nh(t,e);function t(t,n,r,i,a){var o=e.call(this,t,n,r,i)||this;try{o.storedValue=t.createNewInstance(a)}catch(e){throw o.state=Yg.DEAD,e}return o.state=Yg.CREATED,o.finalizeCreation(),o}return Object.defineProperty(t.prototype,"root",{get:function(){if(!this.parent)throw new G(`This scalar node is not part of a tree`);return this.parent.root},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.parent!==e,r=this.subpath!==t;if(!(!n&&!r)){if(j_()){if(!t)throw new G(`assertion failed: subpath expected`);if(!e)throw new G(`assertion failed: parent expected`);if(n)throw new G(`assertion failed: scalar nodes cannot change their parent`)}this.environment=void 0,this.baseSetParent(this.parent,t)}}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return v_(this.getSnapshot())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||`<root>`;return`${this.type.name}@${e}${this.isAlive?``:` [dead]`}`}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){!this.isAlive||this.state===Yg.DETACHING||(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(tg);ng.prototype.die=pr(ng.prototype.die);var rg=1,ig;(function(e){e[e.UNINITIALIZED=0]=`UNINITIALIZED`,e[e.CREATING=1]=`CREATING`,e[e.CREATED=2]=`CREATED`})(ig||={});var ag;(function(e){e.Dispose=`dispose`,e.Patch=`patch`,e.Snapshot=`snapshot`})(ag||={});var og={onError:function(e){throw e}},sg=function(e){Nh(t,e);function t(t,n,r,i,a){var o=e.call(this,t,n,r,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++rg}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"hasSnapshotPostProcessor",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_endOfActionCallbacks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:ig.UNINITIALIZED}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=rn(function(){return v_(o.getSnapshot())}),o.unbox=o.unbox.bind(o),o._initialSnapshot=v_(a),o.identifierAttribute=t.identifierAttribute,n||(o.identifierCache=new Gg),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var s=o._initialSnapshot[o.identifierAttribute];if(s===void 0){var c=o._childNodes[o.identifierAttribute];c&&(s=c.value)}if(typeof s!=`string`&&typeof s!=`number`&&typeof s!=`bigint`)throw new G(`Instance identifier '${o.identifierAttribute}' for type '${o.type.name}' must be a string, a number or a bigint`);o.identifier=gy(s),o.unnormalizedIdentifier=s}return n?n.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e===void 0&&(e=!0),this._observableInstanceState===ig.UNINITIALIZED&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;if(e===void 0&&(e=!0),j_()&&this.state!==Yg.INITIALIZING)throw new G(`assertion failed: the creation of the observable instance must be done on the initializing phase`);this._observableInstanceState=ig.CREATING;for(var a=[],o=this.parent;o&&o._observableInstanceState===ig.UNINITIALIZED;)a.unshift(o),o=o.parent;try{for(var s=Ih(a),c=s.next();!c.done;c=s.next()){var l=c.value;l.createObservableInstanceIfNeeded(!1)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}var u=this.type;try{this.storedValue=u.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,u.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Yg.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=ig.CREATED,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=o_,this.state=Yg.CREATED,e){this.fireHook(jh.afterCreate),this.finalizeCreation();try{for(var d=Ih(a.reverse()),f=d.next();!f.done;f=d.next()){var l=f.value;l.fireHook(jh.afterCreate),l.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enqueueEndOfAction",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.root;t._endOfActionCallbacks||=[],t._endOfActionCallbacks.push(e)}}),Object.defineProperty(t.prototype,"flushEndOfActionCallbacks",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=this.root;e._endOfActionCallbacks&&e._endOfActionCallbacks.length>0;){var t=e._endOfActionCallbacks;e._endOfActionCallbacks=void 0,t.forEach(function(e){e()})}}}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(jh.beforeDetach);var e=this.state;this.state=Yg.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,``),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;if(!(!n&&!r)){if(j_()){if(!t)throw new G(`assertion failed: subpath expected`);if(!e)throw new G(`assertion failed: new parent expected`);if(this.parent&&n)throw new G(`A node cannot exists twice in the state tree. Failed to add ${this} to path '${e.path}/${t}'.`);if(!this.parent&&e.root===this)throw new G(`A state tree is not allowed to contain itself. Cannot assign ${this} to path '${e.path}/${t}'`);if(!this.parent&&this.environment&&this.environment!==e.root.environment)throw new G(`A state tree cannot be made part of another state tree as long as their environments are different.`)}n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(jh.afterAttach)):r&&this.baseSetParent(this.parent,t)}}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&typeof this.storedValue==`object`&&this.storedValue[e];typeof n==`function`&&(hr?hr(function(){n.apply(t.storedValue)}):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this.hasSnapshotPostProcessor&&this.createObservableInstanceIfNeeded(),this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?this._observableInstanceState===ig.CREATED?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isRunningAction?!0:!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ah();if(!this.isAlive&&t!==`ignore`){var n=this._getAssertAliveError(e);switch(t){case`error`:throw new G(n);case`warn`:k_(n)}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||``,n=e.subpath&&V_(e.subpath)||``,r=e.actionContext||Sg();r&&r.type!==`action`&&r.parentActionEvent&&(r=r.parentActionEvent);var i=``;return r&&r.name!=null&&(i=`${r&&r.context&&Jh(r.context)||t}.${r.name}()`),`You are trying to read or write to an object that is no longer part of a state tree. (Object type: '${this.type.name}', Path upon death: '${t}', Subpath: '${n}', Action: '${i}'). Either detach nodes first, or don't use objects after removing / replacing them in the tree.`}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return this._observableInstanceState===ig.CREATED?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(o_),this._autoUnbox=!1;try{return this._observableInstanceState===ig.CREATED?this.type.getChildren(this):r_(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw new G(`Cannot modify '${this}', the object is protected and can only be modified by using an action.`)}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e&&(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e)}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||`<root>`,t=this.identifier?`(id: ${this.identifier})`:``;return`${this.type.name}@${e}${t}${this.isAlive?``:` [dead]`}`}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation(function(){var t,n;try{for(var r=Ih(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(jh.afterCreationFinalization)})}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw new G(`Error while detaching, node is not alive.`);this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Eg(this.storedValue,`@APPLY_PATCHES`,function(t){t.forEach(function(t){if(!t.path){e.type.applySnapshot(e,t.value);return}var n=W_(t.path);n_(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)})}),this._applySnapshot=Eg(this.storedValue,`@APPLY_SNAPSHOT`,function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)}),S_(this.storedValue,`$treenode`,this),S_(this.storedValue,`toJSON`,e_)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){!this.isAlive||this.state===Yg.DETACHING||(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._observableInstanceState!==ig.UNINITIALIZED&&(this.getChildren().forEach(function(e){e.aboutToDie()}),this.baseAboutToDie(),this._internalEventsEmit(ag.Dispose),this._internalEventsClear(ag.Dispose))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach(function(e){e.finalizeDeath()}),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister(ag.Snapshot,e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit(ag.Snapshot,e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister(ag.Patch,e)}}),Object.defineProperty(t.prototype,"hasPatchSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._internalEventsHasSubscribers(ag.Patch)?!0:this.parent?this.parent.hasPatchSubscribers():!1}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers(ag.Patch)){var n=Lh(L_(m_({},e,{path:t.path.substr(this.path.length)+(e.path?`/`+e.path:``)})),2),r=n[0],i=n[1];this._internalEventsEmit(ag.Patch,r,i)}this.parent&&this.parent.emitPatch(e,t)}}),Object.defineProperty(t.prototype,"hasDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsHas(ag.Dispose,e)}}),Object.defineProperty(t.prototype,"addDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this.hasDisposer(e)){this._internalEventsRegister(ag.Dispose,e,!0);return}throw new G(`cannot add a disposer when it is already registered for execution`)}}),Object.defineProperty(t.prototype,"removeDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._internalEventsHas(ag.Dispose,e))throw new G(`cannot remove a disposer which was never registered for execution`);this._internalEventsUnregister(ag.Dispose,e)}}),Object.defineProperty(t.prototype,"removeMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.middlewares){var t=this.middlewares.indexOf(e);t>=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;t===void 0&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=br(function(){return e.snapshot},function(t){return e.emitSnapshot(t)},og);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return n===void 0&&(n=!1),this._internalEvents||=new T_,this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this._internalEvents&&(t=this._internalEvents).emit.apply(t,Rh([e],Lh(n),!1))}}),Object.defineProperty(t.prototype,"_internalEventsClear",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEvents&&this._internalEvents.clear(e)}}),Object.defineProperty(t.prototype,"_internalEventsClearAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._internalEvents&&this._internalEvents.clearAll()}}),t}(tg);sg.prototype.createObservableInstance=pr(sg.prototype.createObservableInstance),sg.prototype.detach=pr(sg.prototype.detach),sg.prototype.die=pr(sg.prototype.die);var cg,lg;(function(e){e[e.String=1]=`String`,e[e.Number=2]=`Number`,e[e.Boolean=4]=`Boolean`,e[e.Date=8]=`Date`,e[e.Literal=16]=`Literal`,e[e.Array=32]=`Array`,e[e.Map=64]=`Map`,e[e.Object=128]=`Object`,e[e.Frozen=256]=`Frozen`,e[e.Optional=512]=`Optional`,e[e.Reference=1024]=`Reference`,e[e.Identifier=2048]=`Identifier`,e[e.Late=4096]=`Late`,e[e.Refinement=8192]=`Refinement`,e[e.Union=16384]=`Union`,e[e.Null=32768]=`Null`,e[e.Undefined=65536]=`Undefined`,e[e.Integer=131072]=`Integer`,e[e.Custom=262144]=`Custom`,e[e.SnapshotProcessor=524288]=`SnapshotProcessor`,e[e.Lazy=1048576]=`Lazy`,e[e.Finite=2097152]=`Finite`,e[e.Float=4194304]=`Float`,e[e.BigInt=8388608]=`BigInt`})(lg||={});var ug=`cannotDetermine`,dg=Symbol(`$type`),fg=function(){function e(e){Object.defineProperty(this,cg,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"C",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"S",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"T",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"N",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isType",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e}return Object.defineProperty(e.prototype,"create",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Vg(this,e),this.instantiate(null,``,t,e).value}}),Object.defineProperty(e.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){throw new G(`unimplemented method`)}}),Object.defineProperty(e.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e===this}}),Object.defineProperty(e.prototype,"validate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if($g(e)){var n=zh(e);return this.isAssignableFrom(n)?Rg():zg(t,e)}return this.isValidSnapshot(e,t)}}),Object.defineProperty(e.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.validate(e,[{path:``,type:this}]).length===0}}),Object.defineProperty(e.prototype,"Type",{get:function(){throw new G("Factory.Type should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.Type`")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"TypeWithoutSTN",{get:function(){throw new G("Factory.TypeWithoutSTN should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.TypeWithoutSTN`")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"SnapshotType",{get:function(){throw new G("Factory.SnapshotType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.SnapshotType`")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CreationType",{get:function(){throw new G("Factory.CreationType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.CreationType`")},enumerable:!1,configurable:!0}),e}();cg=dg,fg.prototype.create=pr(fg.prototype.create);var pg=function(e){Nh(t,e);function t(t){var n=e.call(this,t)||this;return Object.defineProperty(n,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return Object.defineProperty(t.prototype,"create",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return t===void 0&&(t=this.getDefaultSnapshot()),e.prototype.create.call(this,t,n)}}),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.createObservableInstanceIfNeeded(),e.storedValue}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!e.identifierAttribute||e.identifier===gy(t[e.identifierAttribute])}}),Object.defineProperty(t.prototype,"tryToReconcileNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return e.isDetaching?!1:e.snapshot===t||Xg(t)&&Qg(t)===e?!0:e.type===this&&g_(t)&&!Xg(t)&&this.isMatchingSnapshotId(e,t)?(e.applySnapshot(t),!0):!1}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(this.tryToReconcileNode(e,t))return e.setParent(n,r),e;if(e.die(),Xg(t)&&this.isAssignableFrom(zh(t))){var i=Qg(t);return i.setParent(n,r),i}return this.instantiate(n,r,void 0,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return null}}),t}(fg);pg.prototype.create=pr(pg.prototype.create);var mg=function(e){Nh(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e}}),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this&&e.storedValue===t)return e;var i=this.instantiate(n,r,void 0,t);return e.die(),i}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return null}}),t}(fg);function hg(e,t,n){var r=t.getReconciliationType(),i=r===gg(e);return t instanceof sg&&i&&r instanceof pg&&g_(n)&&!Xg(n)&&r.isMatchingSnapshotId(t,n)}function gg(e){var t=e.getSubTypes();return!t||Array.isArray(t)||t===ug||!_g(e)?e:gg(t)}function _g(e){var t=lg.Optional|lg.Late,n=lg.Refinement|lg.SnapshotProcessor|lg.Union;return(e.flags&t)>0&&(e.flags&n)===0}function vg(e){return typeof e==`object`&&e&&e.isType===!0}function yg(e,t){M_(e,vg,`mobx-state-tree type`,t)}(function(){function e(e,t){Object.defineProperty(this,"hooks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"call",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"flowsPending",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"running",{enumerable:!0,configurable:!0,writable:!0,value:!0}),e&&e.onStart(t)}return Object.defineProperty(e.prototype,"finish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.running&&(this.running=!1,this.hooks&&this.hooks.onFinish(this.call,e))}}),Object.defineProperty(e.prototype,"incFlowsPending",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.flowsPending++}}),Object.defineProperty(e.prototype,"decFlowsPending",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.flowsPending--}}),Object.defineProperty(e.prototype,"hasFlowsPending",{get:function(){return this.flowsPending>0},enumerable:!1,configurable:!0}),e})();var bg=1,xg;function Sg(){return xg}function Cg(){return bg++}function wg(e,t){var n=Qg(e.context);e.type===`action`&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=xg,a=!i;xg=e;try{return Og(n,e,t,a)}finally{xg=i,n._isRunningAction=r}}function Tg(e){if(e)return e.type===`action`?e:e.parentActionEvent}function Eg(e,t,n){var r=function(){var r=Cg(),i=xg,a=Tg(i);return wg({type:`action`,name:t,id:r,args:E_(arguments),context:e,tree:qh(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?Rh(Rh([],Lh(i.allParentIds),!1),[i.id],!1):[],parentEvent:i,parentActionEvent:a},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var Dg=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Og(e,t,n,r){function i(t,n){var i=function(){var i,a;try{i=n.apply(null,t.args)}catch(e){a=e}if(r||!t.parentActionEvent)try{e.root.flushEndOfActionCallbacks()}catch(e){a||=e}if(a)throw a;return i};return t.name?pr(t.name,i)():pr(i)()}var a=new Dg(e,n);if(a.isEmpty)return i(t,n);var o=null;function s(e){var t=a.getNextMiddleware(),c=t&&t.handler;if(!c)return i(e,n);if(!t.includeHooks&&jh[e.name])return s(e);var l=!1;function u(e,t){l=!0,o=s(e),t&&(o=t(o))}var d=!1;function f(e){d=!0,o=e}if(c(e,u,f),j_()){if(!l&&!d){var p=Qg(e.tree);throw new G(`Neither the next() nor the abort() callback within the middleware ${c.name} for the action: "${e.name}" on the node: ${p.type.name} was invoked.`)}if(l&&d){var p=Qg(e.tree);throw new G(`The next() and abort() callback within the middleware ${c.name} for the action: "${e.name}" on the node: ${p.type.name} were invoked.`)}}return d&&(r||!e.parentActionEvent)?i(e,function(){return o}):o}return s(t)}var kg=Ph({},{enabled:!1,indent:2,maxStringLength:100,maxArrayLength:10,maxPropertyCount:30,maxDepth:5});function Ag(){return Ph({},kg)}function jg(e,t){try{return JSON.stringify(e,null,t)}catch(e){return`<Unserializable: ${e}>`}}function Mg(e){return e.length<280?e:`${e.substring(0,272)}......${e.substring(e.length-8)}`}function Ng(e,t,n){if(typeof e==`string`)return e.length>n.maxStringLength?`${e.slice(0,n.maxStringLength)}… (${e.length-n.maxStringLength} more characters)`:e;if(Array.isArray(e)){if(t>=n.maxDepth)return`[…]`;var r=e.slice(0,n.maxArrayLength).map(function(e){return Ng(e,t+1,n)});return e.length>n.maxArrayLength&&r.push(`… ${e.length-n.maxArrayLength} more items`),r}if(h_(e)){if(t>=n.maxDepth)return`{…}`;var i={},a=Object.keys(e);return a.slice(0,n.maxPropertyCount).forEach(function(r){i[r]=Ng(e[r],t+1,n)}),a.length>n.maxPropertyCount&&(i[`…`]=`${a.length-n.maxPropertyCount} more keys`),i}return e}function Pg(e){if(typeof e==`function`)return`<function${e.name?` `+e.name:``}>`;if(Xg(e))return`<${e}>`;var t=Ag();return t.enabled?`\`${jg(Ng(e,0,t),t.indent||void 0)}\``:`\`${jg(e)}\``}function Fg(e,t){if(t<=0)return e;try{for(var n=` `.repeat(t),r=``,i=0,a=null,o=!1,s=function(){r=r.replace(/[ \t]+$/,``),r+=`
95
+ `+n.repeat(Math.max(0,i))},c=0;c<e.length;c++){var l=e[c];if(a){r+=l,o?o=!1:l===`\\`?o=!0:l===a&&(a=null);continue}switch(l){case`"`:case`'`:a=l,r+=l;break;case`{`:for(i++,r+=`{`,s();e[c+1]===` `;)c++;break;case`}`:i--,s(),r+=`}`;break;case`;`:for(r+=`;`,s();e[c+1]===` `;)c++;break;default:r+=l}}return r}catch{return e}}function Ig(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map(function(e){return e.path}).filter(function(e){return e.length>0}).join(`/`),i=r.length>0?`at path "/${r}" `:``,a=Xg(t)?`value of type ${Qg(t).type.name}:`:__(t)?`value`:`snapshot`,o=n&&Xg(t)&&n.is(Qg(t).snapshot),s=Ag();return`${i}${a} ${Pg(t)} is not assignable ${n?`to type: \`${n.name}\``:``}`+(e.message?` (${e.message})`:``)+(n?Mv(n)||__(t)?`.`:`, expected an instance of \`${n.name}\` or a snapshot like \`${function(e){return s.enabled?Fg(e.describe(),s.indent):e.describe()}(n)}\` instead.`+(o?` (Note that a snapshot of the provided value is compatible with the targeted type)`:``):`.`)}function Lg(e,t,n){return e.concat([{path:t,type:n}])}function Rg(){return a_}function zg(e,t,n){return[{context:e,value:t,message:n}]}function Bg(e){return e.reduce(function(e,t){return e.concat(t)},[])}function Vg(e,t){A_()&&Hg(e,t)}function Hg(e,t){var n=e.validate(t,[{path:``,type:e}]);if(n.length>0)throw new G(Ug(e,t,n))}function Ug(e,t,n){if(n.length!==0){var r=Pg(t);return`Error while converting ${Ag().enabled?r:Mg(r)} to \`${e.name}\`:
96
+
97
+ `+n.map(Ig).join(`
98
+ `)}}var Wg=0,Gg=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Wg++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Qt.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Qt.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,t===void 0?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return`${this.cacheId}-${t}`}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(t===void 0&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Qt.array([],s_));var r=this.cache.get(n);if(r.indexOf(e)!==-1)throw new G(`Already registered`);r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yr(e.identifierCache.cache).forEach(function(e){return e.forEach(function(e){t.addNodeToCache(e)})})}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this,r=new e,i=t.path+`/`;return Xr(this.cache).forEach(function(e){for(var a=Lh(e,2),o=a[0],s=a[1],c=!1,l=s.length-1;l>=0;l--){var u=s[l];(u===t||u.path.indexOf(i)===0)&&(r.addNodeToCache(u,!1),s.splice(l,1),s.length||n.cache.delete(o),c=!0)}c&&n.updateLastCacheModificationPerId(o)}),r}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return n?n.some(function(t){return e.isAssignableFrom(t.type)}):!1}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter(function(t){return e.isAssignableFrom(t.type)});switch(r.length){case 0:return null;case 1:return r[0];default:throw new G(`Cannot resolve a reference to type '${e.name}' with id: '${t}' unambigously, there are multiple candidates: ${r.map(function(e){return e.path}).join(`, `)}`)}}}),e}();function Kg(e,t,n,r,i){var a=$g(i);if(a){if(a.parent)throw new G(`Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '${t?t.path:``}/${n}', but it lives already at '${a.path}'`);return t&&a.setParent(t,n),a}return new sg(e,t,n,r,i)}function qg(e,t,n,r,i){return new ng(e,t,n,r,i)}function Jg(e){return e instanceof ng||e instanceof sg}var Yg;(function(e){e[e.INITIALIZING=0]=`INITIALIZING`,e[e.CREATED=1]=`CREATED`,e[e.FINALIZED=2]=`FINALIZED`,e[e.DETACHING=3]=`DETACHING`,e[e.DEAD=4]=`DEAD`})(Yg||={});function Xg(e){return!!(e&&e.$treenode)}function Zg(e,t){M_(e,Xg,`mobx-state-tree node`,t)}function Qg(e){if(!Xg(e))throw new G(`Value ${e} is no MST Node`);return e.$treenode}function $g(e){return e&&e.$treenode||null}function e_(){return Qg(this).snapshot}function t_(e,t,n){return n===void 0&&(n=!0),n_(e,W_(t),n)}function n_(e,t,n){n===void 0&&(n=!0);var r=e;try{for(var i=0;i<t.length;i++){var a=t[i];if(a===`..`){if(r=r.parent,r)continue}else if(a===`.`)continue;else if(r){if(r instanceof ng){var o=r.value;Xg(o)&&(r=Qg(o))}if(r instanceof sg&&r.getChildType(a)&&(r=r.getChildNode(a),r))continue}throw new G(`Could not resolve '${a}' in path '${U_(t.slice(0,i))||`/`}' while resolving '${U_(t)}'`)}}catch(e){if(!n)return;throw e}return r}function r_(e){if(!e)return a_;var t=Object.keys(e);if(!t.length)return a_;var n=Array(t.length);return t.forEach(function(t,r){n[r]=e[t]}),n}var i_=Object.toString(),a_=Object.freeze([]),o_=Object.freeze({}),s_=Rn().useProxies?{deep:!1}:{deep:!1,proxy:!1};Object.freeze(s_);var G=function(e){Nh(t,e);function t(t){return t===void 0&&(t=`Illegal state`),e.call(this,`[mobx-state-tree] ${t}`)||this}return t}(Error);function c_(e){return e}var l_=Number.isInteger;function u_(e){return Number(e)===e&&e%1!=0}function d_(e){return Number.isFinite(e)}function f_(e){return Array.isArray(e)||Oi(e)}function p_(e){return e?f_(e)?e:[e]:a_}function m_(e){for(var t=[...arguments].slice(1),n=0;n<t.length;n++){var r=t[n];for(var i in r)e[i]=r[i]}return e}function h_(e){if(typeof e!=`object`||!e)return!1;var t=Object.getPrototypeOf(e);return t==null||t.constructor?.toString()===i_}function g_(e){return typeof e==`object`&&!!e&&!(e instanceof Date)&&!(e instanceof RegExp)}function __(e,t){return t===void 0&&(t=!0),e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||t&&e instanceof Date}function v_(e){return j_()?__(e)||Oi(e)?e:Object.freeze(e):e}function y_(e){return j_()?(v_(e),h_(e)&&Object.keys(e).forEach(function(t){!__(e[t])&&!Object.isFrozen(e[t])&&y_(e[t])}),e):e}function b_(e){return typeof e!=`function`}function x_(e,t,n){Ki(e)?Qr(e,t,n):Object.defineProperty(e,t,n)}function S_(e,t,n){x_(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function C_(e,t,n){x_(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}var w_=function(){function e(){Object.defineProperty(this,"handlers",{enumerable:!0,configurable:!0,writable:!0,value:[]})}return Object.defineProperty(e.prototype,"hasSubscribers",{get:function(){return this.handlers.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return t===void 0&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[...arguments];this.handlers.slice().forEach(function(t){return t.apply(void 0,Rh([],Lh(e),!1))})}}),e}(),T_=function(){function e(){Object.defineProperty(this,"eventHandlers",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}return Object.defineProperty(e.prototype,"hasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.eventHandlers&&this.eventHandlers[e];return!!t&&t.hasSubscribers}}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){n===void 0&&(n=!1),this.eventHandlers||={};var r=this.eventHandlers[e];return r||=this.eventHandlers[e]=new w_,r.register(t,n)}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.eventHandlers&&this.eventHandlers[e];return!!n&&n.has(t)}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.eventHandlers&&this.eventHandlers[e];n&&n.unregister(t)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.eventHandlers&&delete this.eventHandlers[e]}}),Object.defineProperty(e.prototype,"clearAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.eventHandlers=void 0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=this.eventHandlers&&this.eventHandlers[e];i&&(t=i).emit.apply(t,Rh([],Lh(n),!1))}}),e}();function E_(e){for(var t=Array(e.length),n=0;n<e.length;n++)t[n]=e[n];return t}function D_(e,t){return e.indexOf(t)===0}var O_=function(e,t){j_()&&(O_.ids&&!O_.ids.hasOwnProperty(e)&&k_(`Deprecation warning: `+t),O_.ids&&(O_.ids[e]=!0))};O_.ids={};function k_(e){console.warn(Error(`[mobx-state-tree] ${e}`))}function A_(){return j_()||typeof process<`u`&&{}.ENABLE_TYPE_CHECK===`true`}function j_(){return!1}function M_(e,t,n,r){if(j_()&&!t(e))throw new G(`expected ${n} as argument ${p_(r).join(` or `)}, got ${e} instead`)}function N_(e,t){M_(e,function(e){return typeof e==`function`},`function`,t)}function P_(e,t,n,r){M_(e,function(e){return typeof e==`number`},`number`,t),n!==void 0&&M_(e,function(e){return e>=n},`number greater than ${n}`,t),r!==void 0&&M_(e,function(e){return e<=r},`number lesser than ${r}`,t)}function F_(e,t,n){n===void 0&&(n=!0),M_(e,function(e){return typeof e==`string`},`string`,t),n||M_(e,function(e){return e!==``},`not empty string`,t)}function I_(e){typeof queueMicrotask==`function`?queueMicrotask(e):typeof setImmediate==`function`?setImmediate(e):setTimeout(e,1)}function L_(e){if(!(`oldValue`in e))throw new G("Patches without `oldValue` field cannot be inversed");return[R_(e),z_(e)]}function R_(e){switch(e.op){case`add`:return{op:`add`,path:e.path,value:e.value};case`remove`:return{op:`remove`,path:e.path};case`replace`:return{op:`replace`,path:e.path,value:e.value}}}function z_(e){switch(e.op){case`add`:return{op:`remove`,path:e.path};case`remove`:return{op:`add`,path:e.path,value:e.oldValue};case`replace`:return{op:`replace`,path:e.path,value:e.oldValue}}}function B_(e){return typeof e==`number`}function V_(e){return B_(e)===!0?``+e:e.indexOf(`/`)===-1&&e.indexOf(`~`)===-1?e:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function H_(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function U_(e){if(e.length===0)return``;var t=function(e){return e.map(V_).join(`/`)};return e[0]===`.`||e[0]===`..`?t(e):`/`+t(e)}function W_(e){var t=e.split(`/`).map(H_);if(!(e===``||e===`.`||e===`..`||D_(e,`/`)||D_(e,`./`)||D_(e,`../`)))throw new G(`a json path must be either rooted, empty or relative, but got '${e}'`);return t[0]===``&&t.shift(),t}var G_=Symbol(`$preProcessorFailed`),K_=function(e){Nh(t,e);function t(t,n,r){var i=e.call(this,r||t.name)||this;return Object.defineProperty(i,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"_processors",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|lg.SnapshotProcessor},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return`snapshotProcessor(${this._subtype.describe()})`}}),Object.defineProperty(t.prototype,"preProcessSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._processors.preProcessor?this._processors.preProcessor.call(null,e):e}}),Object.defineProperty(t.prototype,"preProcessSnapshotSafe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this.preProcessSnapshot(e)}catch{return G_}}}),Object.defineProperty(t.prototype,"postProcessSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._processors.postProcessor?this._processors.postProcessor.call(null,e,t.storedValue):e}}),Object.defineProperty(t.prototype,"_fixNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;q_(e.type,this,`create`),e instanceof sg&&(e.hasSnapshotPostProcessor=!!this._processors.postProcessor);var n=e.getSnapshot;e.getSnapshot=function(){return t.postProcessSnapshot(n.call(e),e)},Bv(this._subtype)||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Xg(r)?r:this.preProcessSnapshot(r),a=this._subtype.instantiate(e,t,n,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Xg(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){t===void 0&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n,e):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===G_?zg(t,e,`Failed to preprocess value`):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=vg(e)?this._subtype:Xg(e)?e:this.preProcessSnapshotSafe(e);return t!==G_&&this._subtype.validate(t,[{path:``,type:this._subtype}]).length===0}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof pg))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(fg);function q_(e,t){for(var n,r,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];try{for(var o=Ih(i),s=o.next();!s.done;s=o.next()){var c=s.value;e[c]=t[c].bind(t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}function J_(e,t,n){if(yg(e,1),j_()){if(t.postProcessor&&typeof t.postProcessor!=`function`)throw new G(`postSnapshotProcessor must be a function`);if(t.preProcessor&&typeof t.preProcessor!=`function`)throw new G(`preSnapshotProcessor must be a function`)}return new K_(e,t,n)}var Y_=`Map.put can only be used to store complex values that have an identifier type attribute`;function X_(e,t){var n,r,i=e.getSubTypes();if(i===ug)return!1;if(i){var a=p_(i);try{for(var o=Ih(a),s=o.next();!s.done;s=o.next()){var c=s.value;if(!X_(c,t))return!1}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}return e instanceof mv&&t.push(e),!0}var Z_;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.YES=1]=`YES`,e[e.NO=2]=`NO`})(Z_||={});var Q_=function(e){Nh(t,e);function t(t,n){return e.call(this,t,function(e){return e},n)||this}return Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,``+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,``+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,``+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,``+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw new G(`Map.put cannot be used to set empty values`);if(Xg(e)){var t=Qg(e);if(j_()&&!t.identifierAttribute||t.identifier===null)throw new G(Y_);return this.set(t.identifier,e),e}if(g_(e)){var n=Qg(this),r=n.type;if(r.identifierMode!==Z_.YES)throw new G(Y_);var i=e[r.mapIdentifierAttribute];if(!_y(i)){var a=this.put(r.getChildType().create(e,n.environment));return this.put(Uh(a))}var o=gy(i);return this.set(o,e),this.get(o)}throw new G(`Map.put can only be used to store complex values`)}}),t}(Mi),$_=function(e){Nh(t,e);function t(t,n,r){r===void 0&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Z_.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:lg.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Kg(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Z_.UNKNOWN){var e=[];if(X_(this._subType,e)){var t=e.reduce(function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw new G(`The objects in a map should all have the same identifier attribute, expected '${e}', but child of type '${t.name}' declared attribute '${t.identifierAttribute}' as identifier`);return t.identifierAttribute},void 0);t?(this.identifierMode=Z_.YES,this.mapIdentifierAttribute=t):this.identifierMode=Z_.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){t===void 0&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach(function(i){r[i]=n.instantiate(e,i,void 0,t[i])}),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Q_(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Hr(t,e.unbox),e.type.hookInitializers.forEach(function(e){var n=e(t);Object.keys(n).forEach(function(e){var r=n[e],i=Eg(t,e,r);(j_()?C_:S_)(t,e,i)})}),Ur(t,this.willChange),$r(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yr(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(``+t);if(!n)throw new G(`Not a child `+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Qg(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case`update`:var a=e.newValue;if(a===e.object.get(n))return null;Vg(i,a),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case`add`:Vg(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Z_.YES&&t instanceof sg){var n=t.identifier;if(n!==e)throw new G(`A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '${n}', but expected: '${e}'`)}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach(function(e){t[e.subpath]=e.snapshot}),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach(function(n){t[n]=e[n].getSnapshot()}),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Qg(e.object);switch(e.type){case`update`:t.emitPatch({op:`replace`,path:V_(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);return;case`add`:t.emitPatch({op:`add`,path:V_(e.name),value:e.newValue.snapshot,oldValue:void 0},t);return;case`delete`:var n=e.oldValue.snapshot;e.oldValue.die(),t.emitPatch({op:`remove`,path:V_(e.name),oldValue:n},t);return}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case`add`:case`replace`:r.set(t,n.value);break;case`remove`:r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!h_(t)){Vg(this,t);return}var n=e.storedValue,r=this.getChildType();for(var i in Array.from(n.keys()).forEach(function(i){if(!Object.prototype.hasOwnProperty.call(t,i)){n.delete(i);return}var a=e.getChildNode(i),o=t[i];a.snapshot!==o&&(hg(r,a,o)?a.applySnapshot(o):n.set(i,o))}),t)!Object.prototype.hasOwnProperty.call(t,i)||n.has(i)||n.set(i,t[i])}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return h_(e)?Bg(Object.keys(e).map(function(r){return n._subType.validate(e[r],Lg(t,r,n._subType))})):zg(t,e,`Value is not a plain object`)}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o_}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(pg);$_.prototype.applySnapshot=pr($_.prototype.applySnapshot);function ev(e){return new $_(`Map<string, ${e.name}>`,e)}var tv=function(e){Nh(t,e);function t(t,n,r){r===void 0&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:lg.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Kg(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){t===void 0&&(t=[]);var n=e.type._subType,r={};return t.forEach(function(t,i){var a=``+i;r[a]=n.instantiate(e,a,void 0,t)}),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ph(Ph({},s_),{name:this.name});return Qt.array(r_(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){aa(t).dehancer=e.unbox,e.type.hookInitializers.forEach(function(e){var n=e(t);Object.keys(n).forEach(function(e){var r=n[e],i=Eg(t,e,r);(j_()?C_:S_)(t,e,i)})}),Ur(t,this.willChange),$r(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n<e.storedValue.length)return e.storedValue[n];throw new G(`Not a child: `+t)}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Qg(e.object);t.assertWritable({subpath:``+e.index});var n=t.type._subType,r=t.getChildren();switch(e.type){case`update`:if(e.newValue===e.object[e.index])return null;var i=ov(t,n,[r[e.index]],[e.newValue],[e.index]);if(!i)return null;e.newValue=i[0];break;case`splice`:var a=e.index,o=e.removedCount,s=e.added,c=ov(t,n,r.slice(a,a+o),s,s.map(function(e,t){return a+t}));if(!c)return null;e.added=c;for(var l=a+o;l<r.length;l++)r[l].setParent(t,``+(l+s.length-o))}return e}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.getChildren().map(function(e){return e.snapshot})}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=[];return Object.keys(e).forEach(function(n){t.push(e[n].getSnapshot())}),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Qg(e.object);switch(e.type){case`update`:t.emitPatch({op:`replace`,path:``+e.index,value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);return;case`splice`:if(e.removedCount&&e.addedCount===e.object.length){t.emitPatch({op:`replace`,path:``,value:t.snapshot,oldValue:e.removed.map(function(e){return e.snapshot})},t);return}for(var n=e.removedCount-1;n>=0;n--)t.emitPatch({op:`remove`,path:``+(e.index+n),oldValue:e.removed[n].snapshot},t);for(var n=0;n<e.addedCount;n++)t.emitPatch({op:`add`,path:``+(e.index+n),value:e.added[n].snapshot,oldValue:void 0},t);return}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue,i=t===`-`?r.length:Number(t);switch(n.op){case`replace`:r[i]=n.value;break;case`add`:r.splice(i,0,n.value);break;case`remove`:r.splice(i,1)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n,r;if(!f_(t)){Vg(this,t);return}var i=e.storedValue,a=e.getChildren(),o=a.length,s=t.length,c=this.getChildType(),l=rv(a,t,Math.min(o,s));if(l!==o||l!==s){if(o!==s||e.hasPatchSubscribers()){i.replace(t);return}if(iv(c,a,t,l)){av(a,t,l);return}for(var u=[],d=l;d<o;d++)a[d].snapshot!==t[d]&&u.push(d);try{for(var f=Ih(u),p=f.next();!p.done;p=f.next()){var m=p.value;i[m]=t[m]}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return f_(e)?Bg(e.map(function(e,r){return n._subType.validate(e,Lg(t,``+r,n._subType))})):zg(t,e,`Value is not an array`)}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a_}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.splice(Number(t),1)}}),t}(pg);tv.prototype.applySnapshot=pr(tv.prototype.applySnapshot);function nv(e){return yg(e,1),new tv(`${e.name}[]`,e)}function rv(e,t,n){for(var r=0;r<n&&e[r].snapshot===t[r];)r++;return r}function iv(e,t,n,r){for(var i=r;i<t.length;i++){var a=t[i];if(a.snapshot!==n[i]&&(!hg(e,a,n[i])||!a.identifierAttribute||a.identifier===null))return!1}return!0}function av(e,t,n){for(var r=n;r<e.length;r++){var i=e[r];i.snapshot!==t[r]&&i.applySnapshot(t[r])}}function ov(e,t,n,r,i){for(var a=!0,o=0;;o++){var s=o<=r.length-1,c=n[o],l=s?r[o]:void 0,u=``+i[o];if(Jg(l)&&(l=l.storedValue),!c&&!s)break;if(!s)a=!1,n.splice(o,1),c instanceof sg&&c.createObservableInstanceIfNeeded(),c.die(),o--;else if(!c){if(Xg(l)&&Qg(l).parent===e)throw new G(`Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '${e.path}/${u}', but it lives already at '${Qg(l).path}'`);a=!1;var d=sv(t,e,u,l);n.splice(o,0,d)}else if(cv(c,l))n[o]=sv(t,e,u,l,c);else{for(var f=void 0,p=o;p<n.length;p++)if(cv(n[p],l)){f=n.splice(p,1)[0];break}a=!1;var d=sv(t,e,u,l,f);n.splice(o,0,d)}}return a?null:n}function sv(e,t,n,r,i){Vg(e,r);function a(){if(Xg(r)){var a=Qg(r);if(a.assertAlive(o_),a.parent!==null&&a.parent===t)return a.setParent(t,n),a}return i?e.reconcile(i,r,t,n):e.instantiate(t,n,void 0,r)}var o=a();return i&&i!==o&&(i instanceof sg&&i.createObservableInstanceIfNeeded(),i.die()),o}function cv(e,t){if(!e.isAlive)return!1;if(Xg(t)){var n=Qg(t);return n.isAlive&&n===e}if(e.snapshot===t)return!0;if(!(e instanceof sg))return!1;var r=e.getReconciliationType();return e.identifier!==null&&e.identifierAttribute&&h_(t)&&r.is(t)&&r.isMatchingSnapshotId(e,t)}var lv=`preProcessSnapshot`,uv=`postProcessSnapshot`;function dv(){return Qg(this).toString()}var fv={name:`AnonymousModel`,properties:{},initializers:a_};function pv(e){var t=Object.keys(e),n=new Set;return t.forEach(function(e){if(n.has(e))throw new G(`${e} is declared twice in the model. Model should not contain the same keys`);n.add(e)}),t.reduce(function(t,n){if(n in jh)throw new G(`Hook '${n}' was defined as property. Hooks should be defined as part of the actions`);var r=Object.getOwnPropertyDescriptor(e,n);if(`get`in r)throw new G(`Getters are not supported as properties. Please use views instead`);var i=r.value;if(i==null)throw new G("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");if(__(i))t[n]=Uv(jv(i),i);else if(i instanceof $_)t[n]=Uv(i,{});else if(i instanceof tv)t[n]=Uv(i,[]);else if(!vg(i))throw j_()&&typeof i==`function`?new G(`Invalid type definition for property '${n}', it looks like you passed a function. Did you forget to invoke it, or did you intend to declare a view / action?`):j_()&&typeof i==`object`?new G(`Invalid type definition for property '${n}', it looks like you passed an object. Try passing another model type or a types.frozen.`):new G(`Invalid type definition for property '${n}', cannot infer a type from a value like '${i}' (${typeof i})`);return t},Ph({},e))}var mv=function(e){Nh(t,e);function t(t){var n=e.call(this,t.name||fv.name)||this;return Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:lg.Object}),Object.defineProperty(n,"initializers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"properties",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"preProcessor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"postProcessor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"propertyNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"named",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return n.cloneAndEnhance({name:e})}}),Object.defineProperty(n,"props",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return n.cloneAndEnhance({properties:e})}}),Object.defineProperty(n,"preProcessSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=n.preProcessor;return t?n.cloneAndEnhance({preProcessor:function(n){return t(e(n))}}):n.cloneAndEnhance({preProcessor:e})}}),Object.defineProperty(n,"postProcessSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=n.postProcessor;return t?n.cloneAndEnhance({postProcessor:function(n){return e(t(n))}}):n.cloneAndEnhance({postProcessor:e})}}),Object.assign(n,fv,t),n.properties=pv(n.properties),v_(n.properties),n.propertyNames=Object.keys(n.properties),n.identifierAttribute=n._getIdentifierAttribute(),n}return Object.defineProperty(t.prototype,"_getIdentifierAttribute",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=void 0;return this.forAllProps(function(t,n){if(n.flags&lg.Identifier){if(e)throw new G(`Cannot define property '${t}' as object identifier, property '${e}' is already defined as identifier property`);e=t}}),e}}),Object.defineProperty(t.prototype,"cloneAndEnhance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new t({name:e.name||this.name,properties:Object.assign({},this.properties,e.properties),initializers:this.initializers.concat(e.initializers||[]),preProcessor:e.preProcessor||this.preProcessor,postProcessor:e.postProcessor||this.postProcessor})}}),Object.defineProperty(t.prototype,"actions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.cloneAndEnhance({initializers:[function(n){return t.instantiateActions(n,e(n)),n}]})}}),Object.defineProperty(t.prototype,"instantiateActions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;if(!h_(t))throw new G(`actions initializer should return a plain object containing actions`);Object.getOwnPropertyNames(t).forEach(function(r){if(r in n.properties)throw new G(`'${r}' is a property and cannot be declared as an action`);if(r===lv)throw new G(`Cannot define action '${lv}', it should be defined using 'type.preProcessSnapshot(fn)' instead`);if(r===uv)throw new G(`Cannot define action '${uv}', it should be defined using 'type.postProcessSnapshot(fn)' instead`);var i=t[r],a=e[r];if(r in jh&&a){var o=i;i=function(){a.apply(null,arguments),o.apply(null,arguments)}}var s=i.$mst_middleware,c=i.bind(t);c._isFlowAction=i._isFlowAction||!1,c.$mst_middleware=s;var l=Eg(e,r,c);t[r]=l,(j_()?C_:S_)(e,r,l)})}}),Object.defineProperty(t.prototype,"volatile",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;if(typeof e!=`function`)throw new G(`You passed an ${typeof e} to volatile state as an argument, when function is expected`);return this.cloneAndEnhance({initializers:[function(n){return t.instantiateVolatileState(n,e(n)),n}]})}}),Object.defineProperty(t.prototype,"instantiateVolatileState",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;if(!h_(t))throw new G(`volatile state initializer should return a plain object containing state`);Object.getOwnPropertyNames(t).forEach(function(r){if(r in n.properties)throw new G(`'${r}' is a property and cannot be declared as volatile state`);Zr(e,r,t[r])})}}),Object.defineProperty(t.prototype,"extend",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.cloneAndEnhance({initializers:[function(n){var r=e(n),i=r.actions,a=r.views,o=r.state;for(var s in Fh(r,[`actions`,`views`,`state`]))throw new G(`The \`extend\` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '${s}'`);return o&&t.instantiateVolatileState(n,o),a&&t.instantiateViews(n,a),i&&t.instantiateActions(n,i),n}]})}}),Object.defineProperty(t.prototype,"views",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.cloneAndEnhance({initializers:[function(n){return t.instantiateViews(n,e(n)),n}]})}}),Object.defineProperty(t.prototype,"instantiateViews",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;if(!h_(t))throw new G(`views initializer should return a plain object containing views`);Object.getOwnPropertyNames(t).forEach(function(r){var i;if(r in n.properties)throw new G(`'${r}' is a property and cannot be declared as a view`);var a=Object.getOwnPropertyDescriptor(t,r);if(`get`in a)Qr(e,r,a),hi(e,(i={},i[r]=rn,i));else if(typeof a.value==`function`)(j_()?C_:S_)(e,r,a.value);else throw new G(`A view member should either be a function or getter based property`)})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Xg(r)?r:this.applySnapshotPreProcessor(r);return Kg(this,e,t,n,i)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){t===void 0&&(t={});var n=e.type,r={};return n.forAllProps(function(n,i){r[n]=i.instantiate(e,n,void 0,t[n])}),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ph(Ph({},s_),{name:this.name});return Qt.object(e,o_,t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){S_(t,`toString`,dv),this.forAllProps(function(n){Hr(t,n,e.unbox)}),this.initializers.reduce(function(e,t){return t(e)},t),Ur(t,this.willChange),$r(t,this.didChange)}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e,n=Qg(t.object),r=t.name;n.assertWritable({subpath:r});var i=n.type.properties[r];return i&&(Vg(i,t.newValue),t.newValue=i.reconcile(n.getChildNode(r),t.newValue,n,r)),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e,n=Qg(t.object);if(n.type.properties[t.name]){var r=t.oldValue?t.oldValue.snapshot:void 0;n.emitPatch({op:`replace`,path:V_(t.name),value:t.newValue.snapshot,oldValue:r},n)}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,n=[];return this.forAllProps(function(r){n.push(t.getChildNode(e,r))}),n}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(t in this.properties))throw new G(`Not a value property: `+t);var n=aa(e.storedValue,t),r=n.raw?.call(n);if(!r)throw new G(`Node not available for property `+t);return r}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;t===void 0&&(t=!0);var r={};return this.forAllProps(function(t,i){ia(e.storedValue,t).reportObserved(),r[t]=n.getChildNode(e,t).snapshot}),t?this.applySnapshotPostProcessor(r):r}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach(function(n){t[n]=e[n].getSnapshot()}),this.applySnapshotPostProcessor(t)}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){if(n.op!==`replace`&&n.op!==`add`)throw new G(`object does not support operation ${n.op}`);e.storedValue[t]=n.value}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.applySnapshotPreProcessor(t),r=!h_(n);(!h_(t)||r)&&(Vg(this,t),r)||this.forAllProps(function(t,r){var i=e.getChildNode(t),a=n[t];if(i.snapshot!==a){if(hg(r,i,a)){i.applySnapshot(a);return}e.storedValue[t]=a}})}}),Object.defineProperty(t.prototype,"applySnapshotPreProcessor",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.preProcessor;return t?t.call(null,e):e}}),Object.defineProperty(t.prototype,"applySnapshotPostProcessor",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.postProcessor;return t?t.call(null,e):e}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return F_(e,1),this.properties[e]}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.applySnapshotPreProcessor(e);return h_(r)?Bg(this.propertyNames.map(function(e){return n.properties[e].validate(r[e],Lg(t,e,n.properties[e]))})):zg(t,r,`Value is not a plain object`)}}),Object.defineProperty(t.prototype,"forAllProps",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.propertyNames.forEach(function(n){return e(n,t.properties[n])})}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return`{ `+this.propertyNames.map(function(t){return t+`: `+e.properties[t].describe()}).join(`; `)+` }`}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o_}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue[t]=void 0}}),t}(pg);mv.prototype.applySnapshot=pr(mv.prototype.applySnapshot);function hv(){var e=[...arguments];if(j_()&&typeof e[0]!=`string`&&e[1])throw new G(`Model creation failed. First argument must be a string when two arguments are provided`);return new mv({name:typeof e[0]==`string`?e.shift():`AnonymousModel`,properties:e.shift()||{}})}function gv(){var e=[...arguments],t=typeof e[0]==`string`,n=t?e[0]:`AnonymousModel`;return t&&e.shift(),j_()&&e.forEach(function(e,n){M_(e,_v,`mobx-state-tree model type`,t?n+2:n+1)}),e.reduce(function(e,t){return e.cloneAndEnhance({name:e.name+`_`+t.name,properties:t.properties,initializers:t.initializers,preProcessor:function(n){return t.applySnapshotPreProcessor(e.applySnapshotPreProcessor(n))},postProcessor:function(n){return t.applySnapshotPostProcessor(e.applySnapshotPostProcessor(n))}})}).named(n)}function _v(e){return vg(e)&&(e.flags&lg.Object)>0}var vv=function(e){Nh(t,e);function t(t,n,r,i){i===void 0&&(i=c_);var a=e.call(this,t)||this;return Object.defineProperty(a,"flags",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"checker",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"initializer",{enumerable:!0,configurable:!0,writable:!0,value:i}),a.flags=n,a}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return qg(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.initializer(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return __(e)&&this.checker(e)?Rg():zg(t,e,`Value is not a ${this.name===`Date`?`Date or a unix milliseconds timestamp`:this.name}`)}}),t}(mg),yv=new vv(`string`,lg.String,function(e){return typeof e==`string`}),bv=new vv(`number`,lg.Number,function(e){return typeof e==`number`}),xv=new vv(`integer`,lg.Integer,function(e){return l_(e)}),Sv=new vv(`float`,lg.Float,function(e){return u_(e)}),Cv=new vv(`finite`,lg.Finite,function(e){return d_(e)}),wv=new vv(`bigint`,lg.BigInt,function(e){if(typeof e==`bigint`)return!0;if(typeof e==`string`||typeof e==`number`)try{return BigInt(e),!0}catch{}return!1},function(e){return typeof e==`bigint`?e:BigInt(e)});wv.getSnapshot=function(e){return String(e.storedValue)};var Tv=wv,Ev=new vv(`boolean`,lg.Boolean,function(e){return typeof e==`boolean`}),Dv=new vv(`null`,lg.Null,function(e){return e===null}),Ov=new vv(`undefined`,lg.Undefined,function(e){return e===void 0}),kv=new vv(`Date`,lg.Date,function(e){return typeof e==`number`||e instanceof Date},function(e){return e instanceof Date?e:new Date(e)});kv.getSnapshot=function(e){return e.storedValue.getTime()};var Av=kv;function jv(e){switch(typeof e){case`string`:return yv;case`number`:return bv;case`boolean`:return Ev;case`bigint`:return Tv;case`object`:if(e instanceof Date)return Av}throw new G(`Cannot determine primitive type from value `+e)}function Mv(e){return vg(e)&&(e.flags&(lg.String|lg.Number|lg.Integer|lg.Boolean|lg.Date|lg.BigInt))>0}var Nv=function(e){Nh(t,e);function t(t){var n=e.call(this,JSON.stringify(t))||this;return Object.defineProperty(n,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:lg.Literal}),n.value=t,n}return Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return qg(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return JSON.stringify(this.value)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return __(e)&&e===this.value?Rg():zg(t,e,`Value is not a literal ${JSON.stringify(this.value)}`)}}),t}(mg);function Pv(e){return M_(e,__,`primitive`,1),new Nv(e)}var Fv=function(e){Nh(t,e);function t(t,n,r,i){var a=e.call(this,t)||this;return Object.defineProperty(a,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"_predicate",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"_message",{enumerable:!0,configurable:!0,writable:!0,value:i}),a}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|lg.Refinement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this._subtype.validate(e,t);if(n.length>0)return n;var r=Xg(e)?Qg(e).snapshot:e;return this._predicate(r)?Rg():zg(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(fg);function Iv(){var e=[...arguments],t=typeof e[0]==`string`?e.shift():vg(e[0])?e[0].name:null,n=e[0],r=e[1],i=e[2]?e[2]:function(e){return`Value does not respect the refinement predicate`};return yg(n,[1,2]),F_(t,1),N_(r,[2,3]),N_(i,[3,4]),new Fv(t,n,r,i)}function Lv(e,t){var n=typeof e==`string`?t:e;j_()&&n.forEach(function(e,t){F_(e,t+1)});var r=zv.apply(void 0,Rh([],Lh(n.map(function(e){return Pv(``+e)})),!1));return typeof e==`string`&&(r.name=e),r}var Rv=function(e){Nh(t,e);function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=Ph({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return Object.defineProperty(t.prototype,"flags",{get:function(){var e=lg.Union;return this._types.forEach(function(t){e|=t.flags}),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some(function(t){return t.isAssignableFrom(e)})}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return`(`+this._types.map(function(e){return e.describe()}).join(` | `)+`)`}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw new G(`No matching type for union `+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw new G(`No matching type for union `+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter(function(e){return e!==t}).find(function(t){return t.is(e)}):this._types.find(function(t){return t.is(e)})}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i<this._types.length;i++){var a=this._types[i].validate(e,t);if(a.length===0){if(this._eager)return Rg();r++}else n.push(a)}return r===1?Rg():zg(t,e,`No type is applicable for the union`).concat(Bg(n))}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._types}}),t}(fg);function zv(e){var t=[...arguments].slice(1),n=vg(e)?void 0:e,r=vg(e)?Rh([e],Lh(t),!1):t,i=`(`+r.map(function(e){return e.name}).join(` | `)+`)`;return j_()&&(n&&M_(n,function(e){return h_(e)},`object { eager?: boolean, dispatcher?: Function }`,1),r.forEach(function(e,t){yg(e,n?t+2:t+1)})),new Rv(i,r,n)}function Bv(e){return vg(e)&&(e.flags&lg.Union)>0}var Vv=function(e){Nh(t,e);function t(t,n,r){var i=e.call(this,t.name)||this;return Object.defineProperty(i,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"_defaultValue",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"optionalValues",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|lg.Optional},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype.describe()+`?`}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(this.optionalValues.indexOf(r)>=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=typeof this._defaultValue==`function`?this._defaultValue():this._defaultValue;return typeof this._defaultValue==`function`&&Vg(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Rg():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(fg);function Hv(e,t){if(typeof t!=`function`&&Xg(t))throw new G(`default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead`);yg(e,1),j_()&&typeof t!=`function`&&Vg(e,t)}function Uv(e,t,n){return Hv(e,t),new Vv(e,t,n||Wv)}var Wv=[void 0],Gv=Uv(Ov,void 0),Kv=Uv(Dv,null);function qv(e){return yg(e,1),zv(e,Gv)}function Jv(e){return yg(e,1),zv(e,Kv)}var Yv=function(e){Nh(t,e);function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|lg.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(e instanceof ReferenceError)t=void 0;else throw e}if(e&&t===void 0)throw new G(`Late type seems to be used too early, the definition (still) returns undefined`);if(t){if(j_()&&!vg(t))throw new G(`Failed to determine subtype, make sure types.late returns a type definition.`);this._subType=t}}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:`<uknown late type>`}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Rg()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return t?t.isAssignableFrom(e):!1}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||ug}}),t}(fg);function Xv(e,t){var n=typeof e==`string`?e:`late(${e.toString()})`,r=typeof e==`string`?t:e;if(j_()&&(typeof r!=`function`||r.length!==0))throw new G(`Invalid late type, expected a function with zero arguments that returns a type, got: `+r);return new Yv(n,r)}function Zv(e,t){return new Qv(e,t)}var Qv=function(e){Nh(t,e);function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:lg.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Qt.array()}),ri(function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some(function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)})},function(){r.options.loadType().then(pr(function(e){r.loadedType=e,r.pendingNodeList.forEach(function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:`replace`,path:`/${e.subpath}`,value:e.snapshot}])})}))}),r}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return`<lazy ${this.name}>`}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var a=qg(this,e,t,n,y_(r));return this.pendingNodeList.push(a),ri(function(){return!a.isAlive},function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)}),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):b_(e)?Rg():zg(t,e,`Value is not serializable and cannot be lazy`)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(mg),$v=function(e){Nh(t,e);function t(t){var n=e.call(this,t?`frozen(${t.name})`:`frozen`)||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:lg.Frozen}),n}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return`<any immutable value>`}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return qg(this,e,t,n,y_(r))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return b_(e)?this.subType?this.subType.validate(e,t):Rg():zg(t,e,`Value is not serializable and cannot be frozen`)}}),t}(mg),ey=new $v;function ty(e){return arguments.length===0?ey:vg(e)?new $v(e):Uv(ey,e)}function ny(e){switch(e){case jh.beforeDestroy:return`destroy`;case jh.beforeDetach:return`detach`;default:return}}var ry=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),_y(e))this.identifier=e;else if(Xg(e)){var n=Qg(e);if(!n.identifierAttribute)throw new G(`Can only store references with a defined identifier attribute.`);var r=n.unnormalizedIdentifier;if(r==null)throw new G(`Can only store references to tree nodes with a defined identifier.`);this.identifier=r}else throw new G(`Can only store references to tree nodes or identifiers, got: '${e}'`)}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=gy(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,a=n.identifierCache.resolve(i,t);if(!a)throw new iy(`[mobx-state-tree] Failed to resolve reference '${this.identifier}' to type '${this.targetType.name}' (from node: ${e.path})`);this.resolvedReference={node:a,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),iy=function(e){Nh(t,e);function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return t}(Error),ay=function(e){Nh(t,e);function t(t,n){var r=e.call(this,`reference(${t.name})`)||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:lg.Reference}),r}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return _y(e)?Rg():zg(t,e,`Value is not a valid identifier, which is a string, number or a bigint`)}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(!(!i||!i.isAlive)){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){Vh(t.root.storedValue,{op:`replace`,value:e,path:t.path})},removeRef:function(){_v(i.type)?this.replaceRef(void 0):Vh(t.root.storedValue,{op:`remove`,path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=Qg(r),a=function(r,a){var o=ny(a);o&&n.fireInvalidated(o,e,t,i)},o=i.registerHook(jh.beforeDetach,a),s=i.registerHook(jh.beforeDestroy,a);return function(){o(),s()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(jh.beforeDestroy,function(){i&&i()});var a=function(){var n=function(){e.isAlive&&r.getSnapshot(e)===t&&o(!1)};Sg()?e.root.enqueueEndOfAction(n):I_(n)},o=function(o){i&&i();var s=e.parent,c=s&&s.storedValue;if(s&&s.isAlive&&c){var l=void 0;l=n?!!n.get(t,c):e.root.identifierCache.has(r.targetType,gy(t)),l?i=r.addTargetNodeWatcher(e,t):o?a():r.fireInvalidated(`invalidSnapshotReference`,e,t,null)}};e.state===Yg.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(jh.afterCreationFinalization,function(){e.parent&&e.parent.createObservableInstanceIfNeeded()}),e.registerHook(jh.afterAttach,function(){o(!1)}))}}}),t}(mg),oy=function(e){Nh(t,e);function t(t,n){return e.call(this,t,n)||this}return Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Xg(r)?Xh(r):r,a=new ry(r,this.targetType),o=qg(this,e,t,n,a);return a.node=o,this.watchTargetNodeForInvalidations(o,i,void 0),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Xg(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(n,r),e}var o=this.instantiate(n,r,void 0,t);return e.die(),o}}),t}(ay),sy=function(e){Nh(t,e);function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Xg(r)?this.options.set(r,e?e.storedValue:null):r,a=qg(this,e,t,n,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Xg(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var a=this.instantiate(n,r,void 0,i);return e.die(),a}}),t}(ay);function cy(e,t){if(yg(e,1),j_()&&arguments.length===2&&typeof arguments[1]==`string`)throw new G(`References with base path are no longer supported. Please remove the base path.`);var n=t||void 0,r=t?t.onInvalidated:void 0;if(n&&(n.get||n.set)){if(j_()&&(!n.get||!n.set))throw new G(`reference options must either contain both a 'get' and a 'set' method or none of them`);return new sy(e,{get:n.get,set:n.set},r)}return new oy(e,r)}function ly(e,t){var n=cy(e,Ph(Ph({},t),{onInvalidated:function(e){t&&t.onInvalidated&&t.onInvalidated(e),e.removeRef()}}));return t&&t.acceptsUndefined===!1?n:qv(n)}var uy=function(e){Nh(t,e);function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:lg.Identifier}),r}return Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e||!(e.type instanceof mv))throw new G(`Identifier types can only be instantiated as direct child of a model type`);return qg(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw new G(`Tried to change identifier from '${e.storedValue}' to '${t}'. Changing identifiers is not allowed.`);return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e===this.validType?Rg():zg(t,e,`Value is not a valid ${this.describe()}, expected a ${this.validType}`)}}),t}(mg),dy=function(e){Nh(t,e);function t(){var t=e.call(this,`identifier`,`string`)||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:lg.Identifier}),t}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return`identifier`}}),t}(uy),fy=function(e){Nh(t,e);function t(){return e.call(this,`identifierNumber`,`number`)||this}return Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return`identifierNumber`}}),t}(uy),py=new dy,my=new fy,hy=new(function(e){Nh(t,e);function t(){var t=e.call(this,`identifierBigint`)||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:lg.Identifier}),t}return Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return typeof e==`bigint`?e:BigInt(e)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e||!(e.type instanceof mv))throw new G(`Identifier types can only be instantiated as direct child of a model type`);return qg(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=e.storedValue,a=typeof t==`bigint`?t:BigInt(t);if(i!==a)throw new G(`Tried to change identifier from '${i}' to '${a}'. Changing identifiers is not allowed.`);return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(typeof e==`bigint`)return Rg();if(typeof e==`string`||typeof e==`number`)try{return BigInt(e),Rg()}catch(r){var n=r instanceof Error?r.message:String(r);return zg(t,e,`Value is not a valid ${this.describe()}: ${n}`)}return zg(t,e,`Value is not a valid ${this.describe()}, expected a bigint, a string or a number`)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return String(e.storedValue)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return`identifierBigint`}}),t}(mg));function gy(e){return``+e}function _y(e){return typeof e==`string`||typeof e==`number`||typeof e==`bigint`}function vy(e){return new yy(e)}var yy=function(e){Nh(t,e);function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:lg.Custom}),n}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Rg();var n=this.options.getValidationMessage(e);return n?zg(t,e,`Invalid value for type '${this.name}': ${n}`):Rg()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment);return qg(this,e,t,n,i)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var a=i?this.options.fromSnapshot(t,n.root.environment):t,o=this.instantiate(n,r,void 0,a);return e.die(),o}}),t}(mg),K={enumeration:Lv,model:hv,compose:gv,custom:vy,reference:cy,safeReference:ly,union:zv,optional:Uv,literal:Pv,maybe:qv,maybeNull:Jv,refinement:Iv,string:yv,boolean:Ev,number:bv,integer:xv,float:Sv,finite:Cv,bigint:Tv,Date:Av,map:ev,array:nv,frozen:ty,identifier:py,identifierNumber:my,identifierBigint:hy,late:Xv,lazy:Zv,undefined:Ov,null:Dv,snapshotProcessor:J_},by=function(e,t){if(e===t)return!0;if(typeof e==`object`&&e&&typeof t==`object`&&t){if(Object.keys(e).length!=Object.keys(t).length)return!1;for(var n in e)if(!t.hasOwnProperty(n)||!by(e[n],t[n]))return!1;return!0}return!1};Object.assign(K);var xy=K.model(`UndoManager`,{history:K.array(K.frozen()),undoIdx:-1,targetPath:``}).views(e=>({get canUndo(){return e.undoIdx>0},get canRedo(){return e.undoIdx<e.history.length-1}})).actions(e=>{let t,n,r=!1,i=null,a=0,o=0,s=()=>o>0;function c(){let e=Uh(t);return{pages:e.pages,width:e.width,height:e.height,custom:e.custom,audios:e.audios}}function l(e){let n=!by(t.pages.map(e=>e.id),e.pages.map(e=>e.id)),r=!by(t.custom,e.custom);n?Hh(t.pages,e.pages):t.pages.forEach((t,n)=>{Hh(t,e.pages[n])}),r&&t.set({custom:e.custom}),t.setSize(e.width,e.height)}let u={startTransaction(){o++},endTransaction(e){o--,e||u.requestAddState(c())},async ignore(e,t=!1,n=!1){n&&await new Promise(e=>setTimeout(e,10));let r=!!a;a&&u.addUndoState();let i=s();u.startTransaction();let c=o;try{await e()}catch(e){setTimeout(()=>{throw e})}let l=c!==o,d=!l;u.endTransaction(d),t||i&&!r||u.replaceState(),l||(clearTimeout(a),a=0)},async transaction(e){await u.ignore(e,!0),u.addUndoState()},requestAddState(e){i=e,a||s()||(r?r=!1:a=setTimeout(()=>{a=0,clearTimeout(a),s()||u.addUndoState()},100))},addUndoState(){if(r){r=!1;return}let t=e.history[e.undoIdx];!by(i,t)&&(clearTimeout(a),a=0,e.history.splice(e.undoIdx+1),e.history.push(i),e.undoIdx=e.history.length-1)},afterCreate(){if(t=Yh(e,`..`),!t)throw Error("Failed to find target store for UndoManager. Please provide `targetPath` property, or a `targetStore` in the environment");n=Bh(t,()=>{u.requestAddState(c())}),e.history.length===0&&u.requestAddState(c())},clear(){clearTimeout(a),a=0,e.history.splice(0,e.history.length),e.undoIdx=-1,u.addUndoState()},beforeDestroy(){n()},undo(){a&&u.addUndoState(),s()?l(e.history[e.undoIdx]):e.canUndo?(e.undoIdx--,r=!0,l(e.history[e.undoIdx])):console.warn("No undo history. Please check `store.history.canUndo` before calling undo action.")},redo(){a&&u.addUndoState(),e.canRedo?(e.undoIdx++,r=!0,l(e.history[e.undoIdx])):console.warn("No redo history. Please check `store.history.canRedo` before calling redo action.")},replaceState(){e.history[e.undoIdx]=c()}};return u}),Sy=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,Cy=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Sy[n[e]&63];return t};async function wy(e,t){let n=await(await fetch(e)).blob(),r=document.createElement(`a`),i=URL.createObjectURL(n);r.href=i,r.download=t,document.body.appendChild(r),r.click(),setTimeout(function(){document.body.removeChild(r),window.URL.revokeObjectURL(i)},0)}var Ty=null;function Ey(){return window.jspdf?.jsPDF?Promise.resolve(window.jspdf.jsPDF):Ty||(typeof window.__polotnoLoadJspdf==`function`?(Ty=window.__polotnoLoadJspdf().then(e=>e?.jsPDF||e),Ty):(Ty=new Promise(e=>{var t=document.createElement(`script`);t.onload=function(){e(window.jspdf.jsPDF)},t.src=`https://cdnjs.cloudflare.com/ajax/libs/jspdf/3.0.1/jspdf.umd.min.js`,document.head.appendChild(t)}),Ty))}function Dy(){return window.GIF?Promise.resolve(window.GIF):new Promise(e=>{var t=document.createElement(`script`);t.onload=function(){e(window.GIF)},t.src=`https://cdnjs.cloudflare.com/ajax/libs/gif.js/0.2.0/gif.js`,document.head.appendChild(t)})}async function Oy({width:e,height:t}){return new(await(Dy()))({workers:4,width:e,height:t,workerScript:URL.createObjectURL(new Blob([`// gif.worker.js 0.2.0 - https://github.com/jnordberg/gif.js
99
+ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){var NeuQuant=require("./TypedNeuQuant.js");var LZWEncoder=require("./LZWEncoder.js");function ByteArray(){this.page=-1;this.pages=[];this.newPage()}ByteArray.pageSize=4096;ByteArray.charMap={};for(var i=0;i<256;i++)ByteArray.charMap[i]=String.fromCharCode(i);ByteArray.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(ByteArray.pageSize);this.cursor=0};ByteArray.prototype.getData=function(){var rv="";for(var p=0;p<this.pages.length;p++){for(var i=0;i<ByteArray.pageSize;i++){rv+=ByteArray.charMap[this.pages[p][i]]}}return rv};ByteArray.prototype.writeByte=function(val){if(this.cursor>=ByteArray.pageSize)this.newPage();this.pages[this.page][this.cursor++]=val};ByteArray.prototype.writeUTFBytes=function(string){for(var l=string.length,i=0;i<l;i++)this.writeByte(string.charCodeAt(i))};ByteArray.prototype.writeBytes=function(array,offset,length){for(var l=length||array.length,i=offset||0;i<l;i++)this.writeByte(array[i])};function GIFEncoder(width,height){this.width=~~width;this.height=~~height;this.transparent=null;this.transIndex=0;this.repeat=-1;this.delay=0;this.image=null;this.pixels=null;this.indexedPixels=null;this.colorDepth=null;this.colorTab=null;this.neuQuant=null;this.usedEntry=new Array;this.palSize=7;this.dispose=-1;this.firstFrame=true;this.sample=10;this.dither=false;this.globalPalette=false;this.out=new ByteArray}GIFEncoder.prototype.setDelay=function(milliseconds){this.delay=Math.round(milliseconds/10)};GIFEncoder.prototype.setFrameRate=function(fps){this.delay=Math.round(100/fps)};GIFEncoder.prototype.setDispose=function(disposalCode){if(disposalCode>=0)this.dispose=disposalCode};GIFEncoder.prototype.setRepeat=function(repeat){this.repeat=repeat};GIFEncoder.prototype.setTransparent=function(color){this.transparent=color};GIFEncoder.prototype.addFrame=function(imageData){this.image=imageData;this.colorTab=this.globalPalette&&this.globalPalette.slice?this.globalPalette:null;this.getImagePixels();this.analyzePixels();if(this.globalPalette===true)this.globalPalette=this.colorTab;if(this.firstFrame){this.writeLSD();this.writePalette();if(this.repeat>=0){this.writeNetscapeExt()}}this.writeGraphicCtrlExt();this.writeImageDesc();if(!this.firstFrame&&!this.globalPalette)this.writePalette();this.writePixels();this.firstFrame=false};GIFEncoder.prototype.finish=function(){this.out.writeByte(59)};GIFEncoder.prototype.setQuality=function(quality){if(quality<1)quality=1;this.sample=quality};GIFEncoder.prototype.setDither=function(dither){if(dither===true)dither="FloydSteinberg";this.dither=dither};GIFEncoder.prototype.setGlobalPalette=function(palette){this.globalPalette=palette};GIFEncoder.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette};GIFEncoder.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")};GIFEncoder.prototype.analyzePixels=function(){if(!this.colorTab){this.neuQuant=new NeuQuant(this.pixels,this.sample);this.neuQuant.buildColormap();this.colorTab=this.neuQuant.getColormap()}if(this.dither){this.ditherPixels(this.dither.replace("-serpentine",""),this.dither.match(/-serpentine/)!==null)}else{this.indexPixels()}this.pixels=null;this.colorDepth=8;this.palSize=7;if(this.transparent!==null){this.transIndex=this.findClosest(this.transparent,true)}};GIFEncoder.prototype.indexPixels=function(imgq){var nPix=this.pixels.length/3;this.indexedPixels=new Uint8Array(nPix);var k=0;for(var j=0;j<nPix;j++){var index=this.findClosestRGB(this.pixels[k++]&255,this.pixels[k++]&255,this.pixels[k++]&255);this.usedEntry[index]=true;this.indexedPixels[j]=index}};GIFEncoder.prototype.ditherPixels=function(kernel,serpentine){var kernels={FalseFloydSteinberg:[[3/8,1,0],[3/8,0,1],[2/8,1,1]],FloydSteinberg:[[7/16,1,0],[3/16,-1,1],[5/16,0,1],[1/16,1,1]],Stucki:[[8/42,1,0],[4/42,2,0],[2/42,-2,1],[4/42,-1,1],[8/42,0,1],[4/42,1,1],[2/42,2,1],[1/42,-2,2],[2/42,-1,2],[4/42,0,2],[2/42,1,2],[1/42,2,2]],Atkinson:[[1/8,1,0],[1/8,2,0],[1/8,-1,1],[1/8,0,1],[1/8,1,1],[1/8,0,2]]};if(!kernel||!kernels[kernel]){throw"Unknown dithering kernel: "+kernel}var ds=kernels[kernel];var index=0,height=this.height,width=this.width,data=this.pixels;var direction=serpentine?-1:1;this.indexedPixels=new Uint8Array(this.pixels.length/3);for(var y=0;y<height;y++){if(serpentine)direction=direction*-1;for(var x=direction==1?0:width-1,xend=direction==1?width:0;x!==xend;x+=direction){index=y*width+x;var idx=index*3;var r1=data[idx];var g1=data[idx+1];var b1=data[idx+2];idx=this.findClosestRGB(r1,g1,b1);this.usedEntry[idx]=true;this.indexedPixels[index]=idx;idx*=3;var r2=this.colorTab[idx];var g2=this.colorTab[idx+1];var b2=this.colorTab[idx+2];var er=r1-r2;var eg=g1-g2;var eb=b1-b2;for(var i=direction==1?0:ds.length-1,end=direction==1?ds.length:0;i!==end;i+=direction){var x1=ds[i][1];var y1=ds[i][2];if(x1+x>=0&&x1+x<width&&y1+y>=0&&y1+y<height){var d=ds[i][0];idx=index+x1+y1*width;idx*=3;data[idx]=Math.max(0,Math.min(255,data[idx]+er*d));data[idx+1]=Math.max(0,Math.min(255,data[idx+1]+eg*d));data[idx+2]=Math.max(0,Math.min(255,data[idx+2]+eb*d))}}}}};GIFEncoder.prototype.findClosest=function(c,used){return this.findClosestRGB((c&16711680)>>16,(c&65280)>>8,c&255,used)};GIFEncoder.prototype.findClosestRGB=function(r,g,b,used){if(this.colorTab===null)return-1;if(this.neuQuant&&!used){return this.neuQuant.lookupRGB(r,g,b)}var c=b|g<<8|r<<16;var minpos=0;var dmin=256*256*256;var len=this.colorTab.length;for(var i=0,index=0;i<len;index++){var dr=r-(this.colorTab[i++]&255);var dg=g-(this.colorTab[i++]&255);var db=b-(this.colorTab[i++]&255);var d=dr*dr+dg*dg+db*db;if((!used||this.usedEntry[index])&&d<dmin){dmin=d;minpos=index}}return minpos};GIFEncoder.prototype.getImagePixels=function(){var w=this.width;var h=this.height;this.pixels=new Uint8Array(w*h*3);var data=this.image;var srcPos=0;var count=0;for(var i=0;i<h;i++){for(var j=0;j<w;j++){this.pixels[count++]=data[srcPos++];this.pixels[count++]=data[srcPos++];this.pixels[count++]=data[srcPos++];srcPos++}}};GIFEncoder.prototype.writeGraphicCtrlExt=function(){this.out.writeByte(33);this.out.writeByte(249);this.out.writeByte(4);var transp,disp;if(this.transparent===null){transp=0;disp=0}else{transp=1;disp=2}if(this.dispose>=0){disp=dispose&7}disp<<=2;this.out.writeByte(0|disp|0|transp);this.writeShort(this.delay);this.out.writeByte(this.transIndex);this.out.writeByte(0)};GIFEncoder.prototype.writeImageDesc=function(){this.out.writeByte(44);this.writeShort(0);this.writeShort(0);this.writeShort(this.width);this.writeShort(this.height);if(this.firstFrame||this.globalPalette){this.out.writeByte(0)}else{this.out.writeByte(128|0|0|0|this.palSize)}};GIFEncoder.prototype.writeLSD=function(){this.writeShort(this.width);this.writeShort(this.height);this.out.writeByte(128|112|0|this.palSize);this.out.writeByte(0);this.out.writeByte(0)};GIFEncoder.prototype.writeNetscapeExt=function(){this.out.writeByte(33);this.out.writeByte(255);this.out.writeByte(11);this.out.writeUTFBytes("NETSCAPE2.0");this.out.writeByte(3);this.out.writeByte(1);this.writeShort(this.repeat);this.out.writeByte(0)};GIFEncoder.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);var n=3*256-this.colorTab.length;for(var i=0;i<n;i++)this.out.writeByte(0)};GIFEncoder.prototype.writeShort=function(pValue){this.out.writeByte(pValue&255);this.out.writeByte(pValue>>8&255)};GIFEncoder.prototype.writePixels=function(){var enc=new LZWEncoder(this.width,this.height,this.indexedPixels,this.colorDepth);enc.encode(this.out)};GIFEncoder.prototype.stream=function(){return this.out};module.exports=GIFEncoder},{"./LZWEncoder.js":2,"./TypedNeuQuant.js":3}],2:[function(require,module,exports){var EOF=-1;var BITS=12;var HSIZE=5003;var masks=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function LZWEncoder(width,height,pixels,colorDepth){var initCodeSize=Math.max(2,colorDepth);var accum=new Uint8Array(256);var htab=new Int32Array(HSIZE);var codetab=new Int32Array(HSIZE);var cur_accum,cur_bits=0;var a_count;var free_ent=0;var maxcode;var clear_flg=false;var g_init_bits,ClearCode,EOFCode;function char_out(c,outs){accum[a_count++]=c;if(a_count>=254)flush_char(outs)}function cl_block(outs){cl_hash(HSIZE);free_ent=ClearCode+2;clear_flg=true;output(ClearCode,outs)}function cl_hash(hsize){for(var i=0;i<hsize;++i)htab[i]=-1}function compress(init_bits,outs){var fcode,c,i,ent,disp,hsize_reg,hshift;g_init_bits=init_bits;clear_flg=false;n_bits=g_init_bits;maxcode=MAXCODE(n_bits);ClearCode=1<<init_bits-1;EOFCode=ClearCode+1;free_ent=ClearCode+2;a_count=0;ent=nextPixel();hshift=0;for(fcode=HSIZE;fcode<65536;fcode*=2)++hshift;hshift=8-hshift;hsize_reg=HSIZE;cl_hash(hsize_reg);output(ClearCode,outs);outer_loop:while((c=nextPixel())!=EOF){fcode=(c<<BITS)+ent;i=c<<hshift^ent;if(htab[i]===fcode){ent=codetab[i];continue}else if(htab[i]>=0){disp=hsize_reg-i;if(i===0)disp=1;do{if((i-=disp)<0)i+=hsize_reg;if(htab[i]===fcode){ent=codetab[i];continue outer_loop}}while(htab[i]>=0)}output(ent,outs);ent=c;if(free_ent<1<<BITS){codetab[i]=free_ent++;htab[i]=fcode}else{cl_block(outs)}}output(ent,outs);output(EOFCode,outs)}function encode(outs){outs.writeByte(initCodeSize);remaining=width*height;curPixel=0;compress(initCodeSize+1,outs);outs.writeByte(0)}function flush_char(outs){if(a_count>0){outs.writeByte(a_count);outs.writeBytes(accum,0,a_count);a_count=0}}function MAXCODE(n_bits){return(1<<n_bits)-1}function nextPixel(){if(remaining===0)return EOF;--remaining;var pix=pixels[curPixel++];return pix&255}function output(code,outs){cur_accum&=masks[cur_bits];if(cur_bits>0)cur_accum|=code<<cur_bits;else cur_accum=code;cur_bits+=n_bits;while(cur_bits>=8){char_out(cur_accum&255,outs);cur_accum>>=8;cur_bits-=8}if(free_ent>maxcode||clear_flg){if(clear_flg){maxcode=MAXCODE(n_bits=g_init_bits);clear_flg=false}else{++n_bits;if(n_bits==BITS)maxcode=1<<BITS;else maxcode=MAXCODE(n_bits)}}if(code==EOFCode){while(cur_bits>0){char_out(cur_accum&255,outs);cur_accum>>=8;cur_bits-=8}flush_char(outs)}}this.encode=encode}module.exports=LZWEncoder},{}],3:[function(require,module,exports){var ncycles=100;var netsize=256;var maxnetpos=netsize-1;var netbiasshift=4;var intbiasshift=16;var intbias=1<<intbiasshift;var gammashift=10;var gamma=1<<gammashift;var betashift=10;var beta=intbias>>betashift;var betagamma=intbias<<gammashift-betashift;var initrad=netsize>>3;var radiusbiasshift=6;var radiusbias=1<<radiusbiasshift;var initradius=initrad*radiusbias;var radiusdec=30;var alphabiasshift=10;var initalpha=1<<alphabiasshift;var alphadec;var radbiasshift=8;var radbias=1<<radbiasshift;var alpharadbshift=alphabiasshift+radbiasshift;var alpharadbias=1<<alpharadbshift;var prime1=499;var prime2=491;var prime3=487;var prime4=503;var minpicturebytes=3*prime4;function NeuQuant(pixels,samplefac){var network;var netindex;var bias;var freq;var radpower;function init(){network=[];netindex=new Int32Array(256);bias=new Int32Array(netsize);freq=new Int32Array(netsize);radpower=new Int32Array(netsize>>3);var i,v;for(i=0;i<netsize;i++){v=(i<<netbiasshift+8)/netsize;network[i]=new Float64Array([v,v,v,0]);freq[i]=intbias/netsize;bias[i]=0}}function unbiasnet(){for(var i=0;i<netsize;i++){network[i][0]>>=netbiasshift;network[i][1]>>=netbiasshift;network[i][2]>>=netbiasshift;network[i][3]=i}}function altersingle(alpha,i,b,g,r){network[i][0]-=alpha*(network[i][0]-b)/initalpha;network[i][1]-=alpha*(network[i][1]-g)/initalpha;network[i][2]-=alpha*(network[i][2]-r)/initalpha}function alterneigh(radius,i,b,g,r){var lo=Math.abs(i-radius);var hi=Math.min(i+radius,netsize);var j=i+1;var k=i-1;var m=1;var p,a;while(j<hi||k>lo){a=radpower[m++];if(j<hi){p=network[j++];p[0]-=a*(p[0]-b)/alpharadbias;p[1]-=a*(p[1]-g)/alpharadbias;p[2]-=a*(p[2]-r)/alpharadbias}if(k>lo){p=network[k--];p[0]-=a*(p[0]-b)/alpharadbias;p[1]-=a*(p[1]-g)/alpharadbias;p[2]-=a*(p[2]-r)/alpharadbias}}}function contest(b,g,r){var bestd=~(1<<31);var bestbiasd=bestd;var bestpos=-1;var bestbiaspos=bestpos;var i,n,dist,biasdist,betafreq;for(i=0;i<netsize;i++){n=network[i];dist=Math.abs(n[0]-b)+Math.abs(n[1]-g)+Math.abs(n[2]-r);if(dist<bestd){bestd=dist;bestpos=i}biasdist=dist-(bias[i]>>intbiasshift-netbiasshift);if(biasdist<bestbiasd){bestbiasd=biasdist;bestbiaspos=i}betafreq=freq[i]>>betashift;freq[i]-=betafreq;bias[i]+=betafreq<<gammashift}freq[bestpos]+=beta;bias[bestpos]-=betagamma;return bestbiaspos}function inxbuild(){var i,j,p,q,smallpos,smallval,previouscol=0,startpos=0;for(i=0;i<netsize;i++){p=network[i];smallpos=i;smallval=p[1];for(j=i+1;j<netsize;j++){q=network[j];if(q[1]<smallval){smallpos=j;smallval=q[1]}}q=network[smallpos];if(i!=smallpos){j=q[0];q[0]=p[0];p[0]=j;j=q[1];q[1]=p[1];p[1]=j;j=q[2];q[2]=p[2];p[2]=j;j=q[3];q[3]=p[3];p[3]=j}if(smallval!=previouscol){netindex[previouscol]=startpos+i>>1;for(j=previouscol+1;j<smallval;j++)netindex[j]=i;previouscol=smallval;startpos=i}}netindex[previouscol]=startpos+maxnetpos>>1;for(j=previouscol+1;j<256;j++)netindex[j]=maxnetpos}function inxsearch(b,g,r){var a,p,dist;var bestd=1e3;var best=-1;var i=netindex[g];var j=i-1;while(i<netsize||j>=0){if(i<netsize){p=network[i];dist=p[1]-g;if(dist>=bestd)i=netsize;else{i++;if(dist<0)dist=-dist;a=p[0]-b;if(a<0)a=-a;dist+=a;if(dist<bestd){a=p[2]-r;if(a<0)a=-a;dist+=a;if(dist<bestd){bestd=dist;best=p[3]}}}}if(j>=0){p=network[j];dist=g-p[1];if(dist>=bestd)j=-1;else{j--;if(dist<0)dist=-dist;a=p[0]-b;if(a<0)a=-a;dist+=a;if(dist<bestd){a=p[2]-r;if(a<0)a=-a;dist+=a;if(dist<bestd){bestd=dist;best=p[3]}}}}}return best}function learn(){var i;var lengthcount=pixels.length;var alphadec=30+(samplefac-1)/3;var samplepixels=lengthcount/(3*samplefac);var delta=~~(samplepixels/ncycles);var alpha=initalpha;var radius=initradius;var rad=radius>>radiusbiasshift;if(rad<=1)rad=0;for(i=0;i<rad;i++)radpower[i]=alpha*((rad*rad-i*i)*radbias/(rad*rad));var step;if(lengthcount<minpicturebytes){samplefac=1;step=3}else if(lengthcount%prime1!==0){step=3*prime1}else if(lengthcount%prime2!==0){step=3*prime2}else if(lengthcount%prime3!==0){step=3*prime3}else{step=3*prime4}var b,g,r,j;var pix=0;i=0;while(i<samplepixels){b=(pixels[pix]&255)<<netbiasshift;g=(pixels[pix+1]&255)<<netbiasshift;r=(pixels[pix+2]&255)<<netbiasshift;j=contest(b,g,r);altersingle(alpha,j,b,g,r);if(rad!==0)alterneigh(rad,j,b,g,r);pix+=step;if(pix>=lengthcount)pix-=lengthcount;i++;if(delta===0)delta=1;if(i%delta===0){alpha-=alpha/alphadec;radius-=radius/radiusdec;rad=radius>>radiusbiasshift;if(rad<=1)rad=0;for(j=0;j<rad;j++)radpower[j]=alpha*((rad*rad-j*j)*radbias/(rad*rad))}}}function buildColormap(){init();learn();unbiasnet();inxbuild()}this.buildColormap=buildColormap;function getColormap(){var map=[];var index=[];for(var i=0;i<netsize;i++)index[network[i][3]]=i;var k=0;for(var l=0;l<netsize;l++){var j=index[l];map[k++]=network[j][0];map[k++]=network[j][1];map[k++]=network[j][2]}return map}this.getColormap=getColormap;this.lookupRGB=inxsearch}module.exports=NeuQuant},{}],4:[function(require,module,exports){var GIFEncoder,renderFrame;GIFEncoder=require("./GIFEncoder.js");renderFrame=function(frame){var encoder,page,stream,transfer;encoder=new GIFEncoder(frame.width,frame.height);if(frame.index===0){encoder.writeHeader()}else{encoder.firstFrame=false}encoder.setTransparent(frame.transparent);encoder.setRepeat(frame.repeat);encoder.setDelay(frame.delay);encoder.setQuality(frame.quality);encoder.setDither(frame.dither);encoder.setGlobalPalette(frame.globalPalette);encoder.addFrame(frame.data);if(frame.last){encoder.finish()}if(frame.globalPalette===true){frame.globalPalette=encoder.getGlobalPalette()}stream=encoder.stream();frame.data=stream.pages;frame.cursor=stream.cursor;frame.pageSize=stream.constructor.pageSize;if(frame.canTransfer){transfer=function(){var i,len,ref,results;ref=frame.data;results=[];for(i=0,len=ref.length;i<len;i++){page=ref[i];results.push(page.buffer)}return results}();return self.postMessage(frame,transfer)}else{return self.postMessage(frame)}};self.onmessage=function(event){return renderFrame(event.data)}},{"./GIFEncoder.js":1}]},{},[4]);
100
+ `],{type:`application/javascript`}))})}var ky=()=>`https://api.polotno.com/api`,Ay=Qt({imageDownScalingEnabled:!0,removeBackgroundEnabled:!1,htmlRenderEnabled:!1,renderTagTextEnabled:!0,forceTextFitEnabled:!1,textVerticalResizeEnabled:!1,textOverflow:`resize`,textSplitAllowed:!1,animationsEnabled:!1,aiTextEnabled:!1,autoDeleteEmptyText:!0}),jy=typeof window<`u`&&window.location.hostname===`localhost`||typeof process<`u`&&!1,My=pr(e=>{Ay.textVerticalResizeEnabled=e}),Ny=pr(e=>{Ay.removeBackgroundEnabled=e});pr(e=>{jy&&console.warn(`useRemoveBackground is deprecated. Use setRemoveBackgroundEnabled instead.`),Ny(e)}),pr(e=>{Ay.aiTextEnabled=e}),pr(e=>{jy&&console.warn(`useHtmlTextRender is deprecated. Use setRichTextEnabled instead.`),Ay.htmlRenderEnabled=e});var Py=e=>pr(t=>{jy&&console.warn(`${e}() is a no-op: the new text rendering engine is enabled by default.`)}),Fy=e=>{hr(()=>{Ay.htmlRenderEnabled=!0,Ay.renderTagTextEnabled=!1})},Iy=Py(`setRichTextEnabled`),Ly=Py(`setRenderTagTextEnabled`),Ry=pr(e=>{Ay.imageDownScalingEnabled=e});pr(e=>{console.warn(`useDownScaling is deprecated. Use setDownScalingEnabled instead.`),Ry(e)}),pr(e=>{console.warn(`setForceTextFit is deprecated. Use setTextOverflow instead.`),Ay.textOverflow=`change-font-size`});var zy=pr(e=>{Ay.textOverflow=e}),By=pr(e=>{Ay.textSplitAllowed=e});pr(e=>{Ay.animationsEnabled=e}),pr(e=>{Ay.autoDeleteEmptyText=e});var Vy=Qt({value:!1}),Hy=Qt({value:`v1`}),Uy=()=>Hy.value,Wy=Qt({value:0}),Gy=()=>Wy.value,Ky=()=>Vy.value,qy=pr(()=>{Vy.value=!0}),Jy=``,Yy=e=>{Jy=e||``},Xy=typeof window<`u`?window.location.origin:``,Zy=typeof navigator<`u`&&navigator.userAgent.indexOf(`Headless`)>-1,Qy=typeof navigator<`u`&&navigator.userAgent.indexOf(`Electron`)>-1;Xy===`file://`&&Zy&&(Xy=`headless`),Xy===`file://`&&Qy&&(Xy=`electron`);var $y=`%cPolotno error! Current domain is not allowed. It may lead to unexpected behavior and stop working. Please add "${Xy}" here: https://polotno.com/cabinet`,eb=fetch;async function tb(e){for(let t=0;t<5;t++)try{let t=await eb(ky()+`/validate-key`,{method:`POST`,body:JSON.stringify({key:e,site:location.host,skdVersion:`4.11.0`})});if(hr(()=>{Hy.value=t.headers.get(`x-api-version`)||``}),!e)return console.error(`Polotno API is initialized without API key. It may lead to unexpected behavior and stop working. Please create API key here: https://polotno.com/cabinet`),hr(()=>{Wy.value=1}),!1;if(t.status!==200){await new Promise(e=>setTimeout(e,3e3));continue}let n=await t.json();return n.is_valid||(console.error(`Polotno API key is not valid. Please get new API key here: https://polotno.com/cabinet`),hr(()=>{Wy.value=1})),n.is_paid||(console.log(`%cPolotno Free Version. For development usage only. https://polotno.com/`,`background: rgb(0, 161, 255); color: white; padding: 5px; margin: 5px;`),hr(()=>{Wy.value===0&&(Wy.value=2)})),n.is_domain_valid||console.log($y,`background: rgba(247, 101, 68, 1); color: white; padding: 5px; margin: 5px;`),Ny(n.remove_background_enabled),n.is_paid||!1}catch{await new Promise(e=>setTimeout(e,3e3))}return console.error(`Can not validate Polotno API key. Please report to anton@polotno.com immediately.`),!0}async function nb(e){await tb(Jy)&&!e||qy()}var rb=!1,ib=(e=!rb)=>{rb=e},ab=()=>rb;function ob(e,t){let n=j.useRef(void 0);j.useLayoutEffect(()=>{n.current&&n.current.destroy()},[t]),j.useLayoutEffect(()=>{if(!rb)return;let t=e.current.opacity();return t?(e.current.opacity(0),n.current=new d.Tween({node:e.current,opacity:t,onFinish:()=>{var e;(e=n.current)==null||e.destroy()}}),n.current.play(),()=>{var e;(e=n.current)==null||e.destroy()}):void 0},[])}var sb=0,cb=[],lb=3e4,ub=e=>{lb=e},db=6e3,fb=e=>{db=e},pb=()=>db;function mb(e){sb+=1;let t=!1,n=!1,r=setTimeout(()=>{if(t)return;let n=String(e),r=n.startsWith(`image`)?`IMAGE_FAILED`:n.startsWith(`video`)||n.startsWith(`mediabunny`)?`VIDEO_FAILED`:`UNKNOWN`;yb(s(r,`Timeout loading asset ${e}`,{reason:`timeout`,label:n,timeoutMs:lb})),console.error(`Timeout triggered for loader. Some assets may not have loaded.`,e),t=!0,hb()},lb);return()=>{n?console.error(`Finish called twice! That is not expected. id: `,e):(n=!0,t||(clearTimeout(r),hb()))}}function hb(){--sb,sb===0&&(cb.forEach(e=>e()),cb=[])}function gb(){return new Promise(e=>{t=()=>{ab()?setTimeout(e,300):e(!0)},sb===0?t():cb.push(t);return;var t})}var _b=[];function vb(e){_b.push(e)}function yb(e){let t=typeof e==`string`?s(`UNKNOWN`,e):e;_b.forEach(e=>e(t))}function bb(e){throw Error(`@polotno/core: ${e} is not available in this environment. Run in a browser/jsdom, or call setPlatform() from "@polotno/core/platform" with your DOM implementation (e.g. linkedom) first.`)}var xb={createDOMParser:()=>typeof DOMParser<`u`?new DOMParser:bb(`DOMParser`),createXMLSerializer:()=>typeof XMLSerializer<`u`?new XMLSerializer:bb(`XMLSerializer`),createElement:e=>typeof document<`u`?document.createElement(e):bb(`document.createElement`)},Sb={createDOMParser:()=>xb.createDOMParser(),createXMLSerializer:()=>xb.createXMLSerializer(),createElement:e=>xb.createElement(e)};function Cb(e){return Sb.createDOMParser().parseFromString(`<!DOCTYPE html><html><head></head><body>${e}</body></html>`,`text/html`)}var wb=(e,t)=>{if(e.children)for(let n of e.children){if(t(n)===!0)break;wb(n,t)}if(e.cells){for(let n of e.cells)if(t(n)===!0)break}};function Tb(e){return`'${String(e).replace(/([\\'])/g,`\\$1`)}'`}function Eb(e){let t={};return e&&Db(e).forEach(e=>{let n=e.indexOf(`:`);if(n===-1)return;let r=e.slice(0,n).trim(),i=r.startsWith(`--`)?r:r.toLowerCase(),a=e.slice(n+1).trim();i&&a&&(t[i]=a)}),t}function Db(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`&&n>0?n--:a===`;`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t}function Ob(e){return Object.keys(e).map(t=>`${t}: ${e[t]};`).join(` `)}var kb=e=>e.replace(/\s*!\s*important\s*$/i,``);function Ab(e,t,n){let r=Eb(e.getAttribute(`style`));n===null?delete r[t]:r[t]=n;let i=Ob(r);i?e.setAttribute(`style`,i):e.removeAttribute(`style`)}var jb={"ql-font-serif":`Georgia, Times New Roman, serif`,"ql-font-monospace":`Monaco, Courier New, monospace`,"ql-font-sans":`system-ui, -apple-system, BlinkMacSystemFont, sans-serif`},Mb={"ql-size-small":.75,"ql-size-large":1.5,"ql-size-huge":2.5};function Nb(e){return e.replace(/^ql-font-/,``).split(`-`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)}function Pb(e){let t=jb[e];return t?Fb(t)||``:Nb(e)}function Fb(e){let t=e.replace(/&quot;/g,`"`).replace(/&amp;/g,`&`).trim(),n=t.match(/^(['"])((?:\\.|(?!\1).)*)\1/);return(n?n[2]:t.split(`,`)[0].trim()).replace(/\\(.)/g,`$1`)||null}function Ib(e,t){if(!e)return;let n=e.trim(),r=n.match(/^(\d+(?:\.\d+)?)px$/i);if(r)return parseFloat(r[1]);let i=n.match(/^(\d+(?:\.\d+)?)em$/i);if(i)return t*parseFloat(i[1]);let a=n.match(/^(\d+(?:\.\d+)?)rem$/i);if(a)return t*parseFloat(a[1])}function Lb(e){if(typeof e==`number`)return e;if(!e)return 400;let t=String(e).trim().toLowerCase();if(t===`normal`)return 400;if(t===`bold`||t===`bolder`)return 700;if(t===`lighter`)return 300;let n=parseInt(t,10);return Number.isNaN(n)?400:n}function Rb(e){return Lb(e)>=600}function zb(e){return Cb(`<div id="polotno-rich-root">${e}</div>`).getElementById(`polotno-rich-root`)}function Bb(e){for(let t of Array.from(e.classList))if(t.startsWith(`ql-indent-`)){let e=parseInt(t.slice(10),10);if(e>0)return e}return 0}function Vb(e){for(let t of Array.from(e.querySelectorAll(`span.ql-ui`)))t.remove();let t=e.ownerDocument,n=e=>{let t=e.children;for(let e=t.length-1;e>=0;e--)if(t[e].tagName.toLowerCase()===`li`)return t[e];return null};for(let r of Array.from(e.querySelectorAll(`ol, ul`))){let e=r.tagName.toLowerCase(),i=Array.from(r.children).filter(e=>e.tagName.toLowerCase()===`li`);if(i.length===0||!i.some(e=>e.hasAttribute(`data-list`)||Bb(e)>0))continue;let a=t=>{let n=t.getAttribute(`data-list`);return n===`ordered`?`ol`:n===`bullet`||n===`checked`||n===`unchecked`?`ul`:e===`ol`?`ol`:`ul`},o=t.createDocumentFragment(),s=[{list:o,level:-1,type:``}];for(let e of i){let r=Bb(e),i=a(e);e.removeAttribute(`data-list`);for(let t of Array.from(e.classList))t.startsWith(`ql-indent-`)&&e.classList.remove(t);for(e.getAttribute(`class`)||e.removeAttribute(`class`);s.length>1&&s[s.length-1].level>r;)s.pop();if(s[s.length-1].level===r&&s[s.length-1].type!==i&&s.pop(),s[s.length-1].level<r){let e=s[s.length-1],a=n(e.list)||e.list,o=t.createElement(i);a.appendChild(o),s.push({list:o,level:r,type:i})}s[s.length-1].list.appendChild(e)}r.replaceWith(o)}for(let t of Array.from(e.querySelectorAll(`ul, ol`))){let e=Array.from(t.children).filter(e=>e.tagName.toLowerCase()===`li`);e.length>0&&e.every(e=>e.style.direction===`rtl`||e.getAttribute(`dir`)===`rtl`)&&t.style.direction!==`rtl`&&(t.style.direction=`rtl`)}}var Hb=new Set([`SPAN`,`STRONG`,`B`,`EM`,`I`,`U`,`S`,`DEL`,`SUB`,`SUP`]);function Ub(e){if(e.tagName!==`SPAN`)return!1;for(let t of Array.from(e.attributes))if(t.value.trim())return!1;return!0}function Wb(e,t){if(e.attributes.length!==t.attributes.length)return!1;for(let n of Array.from(e.attributes))if(t.getAttribute(n.name)!==n.value)return!1;return!0}function Gb(e){let t=e=>{for(let n of Array.from(e.children))t(n);if(Ub(e)&&e.parentNode){let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}};for(let n of Array.from(e.children))t(n);let n=e=>{for(let t of Array.from(e.children))n(t);let t=e.firstElementChild;for(;t;){let e=t.nextElementSibling;if(e&&t.nextSibling===e&&Hb.has(t.tagName)&&t.tagName===e.tagName&&Wb(t,e)){for(;e.firstChild;)t.appendChild(e.firstChild);e.remove(),n(t);continue}t=e}};n(e)}function Kb(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r===`(`)t++;else if(r===`)`)t--;else if(r===`,`&&t===0)return n}return-1}function qb(e){if(!e.includes(`var(`))return e;let t=``,n=0;for(;n<e.length;){let r=e.indexOf(`var(`,n);if(r===-1){t+=e.slice(n);break}t+=e.slice(n,r);let i=0,a=-1;for(let t=r+3;t<e.length;t++)if(e[t]===`(`)i++;else if(e[t]===`)`&&(i--,i===0)){a=t;break}if(a===-1)return null;let o=e.slice(r+4,a),s=Kb(o);if(s===-1)return null;let c=qb(o.slice(s+1).trim());if(c===null||c===``)return null;t+=c,n=a+1}return t.trim()||null}function Jb(e){let t=e.getAttribute(`style`);if(!t||!t.includes(`var(`))return;let n={};for(let[e,r]of Object.entries(Eb(t))){if(!r.includes(`var(`)){n[e]=r;continue}let t=qb(r);t!==null&&(n[e]=t)}let r=Ob(n);r?e.setAttribute(`style`,r):e.removeAttribute(`style`)}function Yb(e,t){if(!e||!e.includes(`<`))return e;let n=zb(e);if(!n)return e;let r=e=>{for(let t of Array.from(e.children))r(t);let n=e.getAttribute(`class`);if(n){let r=n.split(/\s+/).filter(Boolean),i=[];for(let n of r){if(n.startsWith(`ql-font-`)){if(!e.style.fontFamily){let t=jb[n];e.style.fontFamily=t??Tb(Nb(n))}continue}let r=Mb[n];if(r!=null){e.style.fontSize||(e.style.fontSize=`${t.fontSize*r}px`);continue}if(!n.startsWith(`ql-align-`)){if(n.startsWith(`ql-indent-`)){if(e.tagName===`LI`){i.push(n);continue}let t=parseInt(n.slice(10),10);t>0&&!e.style.getPropertyValue(`margin-inline-start`)&&e.style.setProperty(`margin-inline-start`,`${t*.5}em`);continue}if(n===`ql-direction-rtl`){e.style.direction||(e.style.direction=`rtl`);continue}i.push(n)}}i.length?e.setAttribute(`class`,i.join(` `)):e.removeAttribute(`class`)}Jb(e);let i=e.style.fontSize;if(i){let n=Ib(i,t.fontSize);n!=null&&(e.style.fontSize=`${n}px`)}};r(n),Gb(n),Vb(n);for(let e of Array.from(n.querySelectorAll(`p`))){let t=e,n=``,r=``,i=``;for(;t.childNodes.length===1&&t.firstChild!=null&&t.firstChild.nodeType===1;){let e=t.firstChild;e.style.fontFamily&&(n=e.style.fontFamily),e.style.fontWeight&&(r=e.style.fontWeight),(e.tagName===`STRONG`||e.tagName===`B`)&&(r=`bold`),(e.tagName===`EM`||e.tagName===`I`||e.style?.fontStyle===`italic`)&&(i=`italic`),t=e}n&&(e.style.fontFamily=n),r&&(e.style.fontWeight=r),i&&(e.style.fontStyle=i)}return n.innerHTML}function Xb(e){let t=new Set;if(!e||!e.includes(`<`))return[];let n=zb(e);if(n){let e=n.querySelectorAll(`[style]`);for(let n of e)if(n.style.fontFamily){let e=Fb(n.style.fontFamily);e&&t.add(e)}}for(let n of e.matchAll(/\bfont-family="([^"]+)"/g)){let e=Fb(n[1]);e&&t.add(e)}for(let n of e.matchAll(/\bql-font-([a-z0-9_-]+)\b/gi)){let e=Pb(`ql-font-${n[1]}`);e&&t.add(e)}return[...t]}function Zb(e,t){if(!e||t===1||t<=0||!Number.isFinite(t))return e;let n=zb(e);if(!n)return e;let r=e=>{let n=e.style.fontSize;if(n){let r=n.match(/^(\d+(?:\.\d+)?)(px|em|rem)$/i);if(r){let n=Math.round(parseFloat(r[1])*t*1e3)/1e3;e.style.fontSize=`${n}${r[2].toLowerCase()}`}}for(let t of Array.from(e.children))r(t)};return r(n),n.innerHTML}function Qb(e){if(!e||!e.includes(`<`))return!1;let t=zb(e);if(!t)return!1;for(let e of t.querySelectorAll(`[style]`))if(e.style.fontSize)return!0;return!1}function $b(e){let t=[];return wb({children:e.pages||[]},e=>{if((e.type===`text`||e.type===`tablecell`||e.type===`table`)&&(e.fontFamily&&t.indexOf(e.fontFamily)===-1&&t.push(e.fontFamily),e.text))for(let n of Xb(e.text))t.indexOf(n)===-1&&t.push(n)}),t}function ex(e){return{...Mf,...e}}function tx(e,t){switch(t){case`uppercase`:return e.toUpperCase();case`lowercase`:return e.toLowerCase();case`capitalize`:return e.replace(/(^|[\s\p{P}])(\p{L})/gu,(e,t,n)=>t===`'`||t===`’`?e:t+n.toUpperCase());default:return e}}function nx(e){return typeof e.height==`number`&&e.height>0}function rx(e){let t=e.trim().match(/^(-?\d*\.?\d+)(%?)$/);if(!t)return null;let n=parseFloat(t[1]),r=t[2]?n/100:n;return isFinite(r)?r:null}function ix(e){let t=e.lineHeight;return typeof t==`number`?isFinite(t)?t:null:typeof t==`string`?rx(t):null}function ax(e){return ix(e)??Mf.lineHeight}function ox(e,t){return nx(e)?e.height:t}function sx(e=``){return(e.match(/<\/p>/gi)||[]).length>1&&(e=e.replace(/<\/p>/gi,(e,t,n)=>(n.slice(t+e.length).match(/<\/p>/gi)||[]).length>0?`
101
+ `:e)),e.replace(/(<([^>]+)>)/gi,``).replace(/&amp;/g,`&`).replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`).replace(/&apos;/g,`'`).replace(/&nbsp;/g,` `)}function cx(e,t){return!!e.bold==!!t.bold&&!!e.italic==!!t.italic&&!!e.underline==!!t.underline&&!!e.strike==!!t.strike&&(e.color||``)===(t.color||``)&&(e.fontFamily||``)===(t.fontFamily||``)&&(e.fontSize??-1)===(t.fontSize??-1)}function lx(e,t){let n={text:e};return t.bold&&(n.bold=!0),t.italic&&(n.italic=!0),t.underline&&(n.underline=!0),t.strike&&(n.strike=!0),t.color&&(n.color=t.color),t.fontFamily&&(n.fontFamily=t.fontFamily),t.fontSize!=null&&(n.fontSize=t.fontSize),n}var ux=e=>/<[a-z][\s\S]*>|&[a-z]+;|&#x?[0-9a-f]+;/i.test(e),dx=e=>(e.tagName||``).toLowerCase(),fx=(e,t)=>typeof e.getAttribute==`function`?e.getAttribute(t):null,px=e=>{let t=(fx(e,`class`)||``).match(/ql-indent-(\d+)/);return t?parseInt(t[1],10):0},mx=[`ul`,`ol`];function hx(e,t){if(!e)return[{segments:[]}];if(!ux(e))return e.split(`
102
+ `).map(e=>({segments:e?[{text:e}]:[]}));let n=Cb(e),r=n.body??n.documentElement,i=[],a=t.fontSize;function o(e,t,n){if(e.nodeType===3){let r=e.textContent||``;r&&n.push(lx(r,t));return}if(e.nodeType!==1)return;let r=dx(e);if(r===`br`){n.push({text:`
103
+ `});return}if(r===`style`||r===`script`||mx.includes(r))return;let i={...t};(r===`strong`||r===`b`)&&(i.bold=!0),(r===`em`||r===`i`)&&(i.italic=!0),r===`u`&&(i.underline=!0),(r===`s`||r===`strike`||r===`del`)&&(i.strike=!0);let s=Eb(fx(e,`style`));s.color&&(i.color=s.color);let c=s[`font-weight`];if(c){let e=c.trim().toLowerCase(),t=e===`normal`||e===`lighter`||/^\d/.test(e);Rb(c)?i.bold=!0:t&&(i.bold=!1)}s[`font-style`]===`italic`&&(i.italic=!0);let l=s[`text-decoration`]||s[`text-decoration-line`]||``;if(l.includes(`underline`)&&(i.underline=!0),l.includes(`line-through`)&&(i.strike=!0),s[`font-family`]){let e=Fb(s[`font-family`]);e&&(i.fontFamily=e)}if(s[`font-size`]){let e=t.fontSize??a,n=Ib(s[`font-size`],e);n!=null&&(i.fontSize=n)}for(let t of Array.from(e.childNodes||[]))o(t,i,n)}function s(e,t){let n=[];for(let t of e)t.text&&t.text.split(`
104
+ `).forEach((e,r)=>{if(r>0&&n.push({text:`
105
+ `}),!e)return;let i=lx(e,t),a=n[n.length-1];a&&a.text!==`
106
+ `&&cx(a,i)?a.text+=i.text:n.push(i)});n.length&&n[n.length-1].text===`
107
+ `&&n.pop();let r={segments:[],...t},a=[r];for(let e of n)e.text===`
108
+ `?(r={segments:[],...t},a.push(r)):r.segments.push(e);i.push(...a)}function c(e,t,n,r){let i=fx(e,`data-list`),a=i===`bullet`||t===`ul`&&i!==`ordered`?`bullet`:`ordered`,c=n+px(e),u=[];o(e,{},u),s(u,{list:a,indentLevel:c,listStart:r});for(let t of Array.from(e.childNodes||[])){let e=dx(t);mx.includes(e)&&l(t,n+1)}}function l(e,t){let n=dx(e),r=!0;for(let i of Array.from(e.childNodes||[]))dx(i)===`li`&&(c(i,n,t,r),r=!1)}let u=new Map,d=e=>{let t=u.get(e);if(t!==void 0)return t;let n=Array.from(e.childNodes||[]).some(e=>[`p`,`ul`,`ol`].includes(dx(e))||dx(e)===`div`&&d(e));return u.set(e,n),n};function f(e){let t=[],n=()=>{t.some(e=>e.text.trim())&&s(t,{}),t=[]};for(let r of e){let e=dx(r);if(e===`div`&&d(r))n(),f(Array.from(r.childNodes||[]));else if(e===`p`||e===`div`){n();let e=[];o(r,{},e),s(e,{})}else mx.includes(e)?(n(),l(r,0)):(r.nodeType===1&&![`style`,`script`].includes(e)||r.nodeType===3&&(r.textContent||``).trim())&&o(r,{},t)}n()}let p=Array.from(r.childNodes||[]);if(d(r))f(p);else{let e=[];o(r,{},e),s(e,{})}return i.length?i:[{segments:[]}]}function gx(e,t){if(!e)return[];let n=hx(e,{fontSize:t?.fontSize??Mf.fontSize,fontFamily:t?.fontFamily??``}),r=[];n.forEach((e,t)=>{r.push(...e.segments),t<n.length-1&&r.push({text:`
109
+ `})});let i=[];for(let e of r){if(!e.text)continue;let t=i[i.length-1];t&&cx(t,e)?t.text+=e.text:i.push(e)}return i}function _x(e){return e?/<br\s*\/?>/i.test(e)||/<[a-z][a-z0-9]*(\s[^>]*)?>[^<]*<\/[a-z][a-z0-9]*>/i.test(e)?(e=e.replace(/<(?![a-z/!])/gi,`&lt;`),e=e.replace(/([^a-z0-9"'\s/])>/gi,`$1&gt;`),e):e.replace(/</g,`&lt;`).replace(/>/g,`&gt;`):``}var vx=`400,400italic,700,700italic`;function yx(){return vx}function bx(e){return`https://fonts.googleapis.com/css?family=${e.replace(/ /g,`+`)}:${vx}`}var xx=s;function Sx(e,t,n,r){return xx(`FONT_FAILED`,t,{reason:e,...n},r)}function Cx(e){return e?.code===`FETCH_FAILED`}var wx=3e4;function Tx(e){let t=String.fromCharCode(e[0],e[1],e[2],e[3]);return t===`wOF2`?`font/woff2`:t===`wOFF`?`font/woff`:t===`OTTO`?`font/otf`:e[0]===0&&e[1]===1&&e[2]===0&&e[3]===0?`font/ttf`:`font/woff2`}function Ex(e){if(e.length<4)return!1;let t=(e[0]<<24|e[1]<<16|e[2]<<8|e[3])>>>0;return t===65536||t===1953658213||t===1953784678||t===1330926671||t===2001684038||t===2001684018}function Dx(e){if(!e)return;let t=Number(e);if(Number.isFinite(t))return Math.max(0,t*1e3);let n=Date.parse(e);if(!Number.isNaN(n))return Math.max(0,n-Date.now())}var Ox=(e,t)=>new Promise((n,r)=>{if(t?.aborted)return r(kx());let i=setTimeout(n,e);t?.addEventListener(`abort`,()=>{clearTimeout(i),r(kx())},{once:!0})});function kx(){let e=Error(`Font fetch aborted`);return e.name=`AbortError`,e}var Ax=class extends Error{constructor(e,t,n){super(e),this.transportReason=e,this.status=t,this.retryAfterMs=n}};async function jx(e,t={}){let{validate:n,cache:r,signal:i,timeout:a=15e3,retries:o=3,baseDelayMs:s=500}=t,c=r?.get(e);if(c&&(!n||n(c)))return c;let l,u=`network`;for(let t=1;t<=o;t++){if(i?.aborted)throw kx();let c=new AbortController,d=()=>c.abort();i?.addEventListener(`abort`,d,{once:!0});let f=!1,p=setTimeout(()=>{f=!0,c.abort()},a);try{let i=await fetch(e,{signal:c.signal});if(i.ok){let t=new Uint8Array(await i.arrayBuffer());if(clearTimeout(p),n&&!n(t))throw new Ax(`throttled-non-font`);return r?.set(e,t),t}throw clearTimeout(p),l=i.status,i.status===429||i.status===503?new Ax(`rate-limited`,i.status,Dx(i.headers.get(`retry-after`))):i.status>=500?new Ax(`server-error`,i.status):xx(`FETCH_FAILED`,`HTTP ${i.status} for ${e}`,{url:e,status:i.status,attempts:t,reason:`http-client-error`})}catch(n){if(clearTimeout(p),n?.code===`FETCH_FAILED`)throw n;if(i?.aborted)throw kx();let r=n,a=n instanceof Ax,c=f,d=n instanceof TypeError||/fetch failed|network|ENOTFOUND|ECONNREFUSED|ETIMEDOUT/i.test(n?.message??``);if(u=c?`timeout`:a?r.transportReason:`network`,a&&r.status&&(l=r.status),t===o||!(a||c||d))throw xx(`FETCH_FAILED`,`Failed to fetch ${e}`,{url:e,status:l,attempts:t,reason:u},n);let m=Math.round(2**(t-1)*s*(.75+Math.random()*.5)),h=a&&r.retryAfterMs!=null?Math.min(r.retryAfterMs,wx):void 0;await Ox(h==null?m:Math.max(h,m),i)}finally{i?.removeEventListener(`abort`,d)}}throw xx(`FETCH_FAILED`,`Failed to fetch ${e}`,{url:e,status:l,attempts:o,reason:u})}function Mx(e){let t=[];for(let n of e.split(`,`)){let e=n.trim().match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f]+))?$/i);if(e){if(e[2])t.push([parseInt(e[1],16),parseInt(e[2],16)]);else if(e[1].includes(`?`))t.push([parseInt(e[1].replace(/\?/g,`0`),16),parseInt(e[1].replace(/\?/g,`F`),16)]);else{let n=parseInt(e[1],16);t.push([n,n])}}}return t}function Nx(e,t){if(!e.length)return!0;for(let[n,r]of e)if(t>=n&&t<=r)return!0;return!1}function Px(e,t){for(let n of t)if(Nx(e,n))return!0;return!1}function Fx(e){return e.trim().replace(/\s+/g,`+`)}function Ix(e){return`https://fonts.googleapis.com/css2?family=${Fx(e)}:ital,wght@0,400;0,700;1,400;1,700`}function Lx(e){return`https://fonts.googleapis.com/css2?family=${Fx(e)}`}function Rx(e,t,n){return`https://fonts.googleapis.com/css2?family=${Fx(e)}:ital,wght@${+!!t},${n}`}function zx(e){let t=new Map,n=/@font-face\s*\{([^}]+)\}/g,r;for(;(r=n.exec(e))!==null;){let e=r[1],n=e.match(/font-style\s*:\s*(\w+)/),i=e.match(/font-weight\s*:\s*(\d+)/),a=e.match(/url\((https?:[^)]+)\)/);if(!n||!i||!a)continue;let o=e.match(/unicode-range\s*:\s*([^;}]+)/i),s=`${n[1].toLowerCase()===`italic`?`1`:`0`},${i[1]}`,c={url:a[1],ranges:o?Mx(o[1]):[]},l=t.get(s);l?l.push(c):t.set(s,[c])}return t}var Bx=new Map,Vx=new TextDecoder;function Hx(e,t){if(Cx(t)){let n=t.details?.reason;if(n===`http-client-error`)return Sx(`not-found`,`Google Fonts has no family "${e}"`,{family:e},t);if(n===`timeout`)return Sx(`timeout`,`Timed out fetching Google font "${e}"`,{family:e},t)}return Sx(`fetch-failed`,`Failed to fetch Google font "${e}"`,{family:e},t)}async function Ux(e,t){let n=``,r=e=>(n=Vx.decode(e),/@font-face/i.test(n));try{await jx(Ix(e),{...t,validate:r})}catch(n){if((Cx(n)?n.details?.reason:void 0)===`http-client-error`)await jx(Lx(e),{...t,validate:r}).catch(t=>{throw Hx(e,t)});else throw Hx(e,n)}let i=zx(n);if(i.size===0)throw Sx(`not-found`,`No usable @font-face for "${e}"`,{family:e});return i}function Wx(e,t={}){let n=Bx.get(e);if(!n){let{cache:r,retries:i,baseDelayMs:a}=t;n=Ux(e,{cache:r,retries:i,baseDelayMs:a}),Bx.set(e,n),n.catch(t=>{t?.details?.reason!==`not-found`&&Bx.delete(e)})}return Gx(n,e,t)}function Gx(e,t,{signal:n,timeout:r}){return!n&&r==null?e:new Promise((i,a)=>{let o,s=()=>{o!=null&&clearTimeout(o),n?.removeEventListener(`abort`,c)},c=()=>{s(),a(kx())};if(n?.aborted)return c();n?.addEventListener(`abort`,c,{once:!0}),r!=null&&(o=setTimeout(()=>{s(),a(Sx(`timeout`,`Timed out waiting for Google font "${t}"`,{family:t}))},r)),e.then(e=>{s(),i(e)},e=>{s(),a(e)})})}function Kx(e){return(e.styles||(e.url?[{src:`url("${e.url}")`}]:[])).map(e=>({src:e.src,fontStyle:e.fontStyle||`normal`,fontWeight:e.fontWeight||`normal`}))}Qt([`Roboto`,`Amatic SC`,`Press Start 2P`,`Marck Script`,`Rubik Mono One`]),Qt({value:!1});var qx=Qt([]);function Jx(e){qx.push(e)}var Yx=`BESbswy 0123456789 Il1Ww`,Xx=[`sans-serif`,`serif`,`monospace`];function Zx(e){let t=function(e=``){let t=sx(e).replace(/\s+/g,` `).trim();return t?Array.from(t).slice(0,10).join(``):``}(e);return t?`${Yx} ${t}`:Yx}var Qx;function $x(e){return{width:e.width,actualBoundingBoxLeft:e.actualBoundingBoxLeft||0,actualBoundingBoxRight:e.actualBoundingBoxRight||0,actualBoundingBoxAscent:e.actualBoundingBoxAscent||0,actualBoundingBoxDescent:e.actualBoundingBoxDescent||0}}function eS(e=`sans-serif`,t=`normal`,n=`normal`,r=Yx){Qx||=document.createElement(`canvas`);let i=Qx.getContext(`2d`);return i.font=`${t} ${n} 40px ${e}`,$x(i.measureText(r))}function tS(e,t,n,r,i){return Xx.some(a=>function(e,t,n=.01){return Math.abs(e.width-t.width)>n||Math.abs(e.actualBoundingBoxLeft-t.actualBoundingBoxLeft)>n||Math.abs(e.actualBoundingBoxRight-t.actualBoundingBoxRight)>n||Math.abs(e.actualBoundingBoxAscent-t.actualBoundingBoxAscent)>n||Math.abs(e.actualBoundingBoxDescent-t.actualBoundingBoxDescent)>n}(function(e,t=`sans-serif`,n=`normal`,r=`normal`,i=Yx){Qx||=document.createElement(`canvas`);let a=Qx.getContext(`2d`);return a.font=`${n} ${r} 40px ${Tb(e)}, ${t}`,$x(a.measureText(i))}(e,a,t,n,r),i[a]))}var nS={Arial:!0},rS=(e,t,n)=>t&&n?!!nS[`${e}_${t}_${n}`]:Object.keys(nS).some(t=>t.startsWith(e+`_`))||!!nS[e];async function iS(e,t,n,r){let i=`${e}_${t}_${n}`;if(nS[i])return;dS(e,t,n);let a=!!document.fonts?.load,o=Zx(r),c={"sans-serif":eS(`sans-serif`,t,n,o),serif:eS(`serif`,t,n,o),monospace:eS(`monospace`,t,n,o)};if(a)try{if(await document.fonts.load(`${t} ${n} 16px ${Tb(e)}`,o),tS(e,t,n,o,c)){lS(i,e);return}}catch{}let l=pb()/60;for(let r=0;r<l;r++){if(oS[e]===`missing`){if(!sS.has(e)){sS.add(e),setTimeout(()=>sS.delete(e),cS);let t=`Font "${e}" not found: not registered and no matching Google Font.`;console.error(t),yb(s(`FONT_FAILED`,t,{family:e,reason:`not-found`}))}return}if(e in aS&&!aS[e]&&oS[e]===`errored`&&fS(e),a)try{await document.fonts.load(`${t} ${n} 16px ${Tb(e)}`,o)}catch{}if(tS(e,t,n,o,c)){lS(i,e);return}await new Promise(e=>setTimeout(e,60))}console.warn(`Timeout for loading font "${e}". Looks like polotno can't load it. Is it a correct font family?`),yb(s(`FONT_FAILED`,`Timeout for loading font "${e}"`,{family:e,reason:`timeout`}))}var aS={},oS={},sS=new Set,cS=500;function lS(e,t){nS[e]=!0,delete oS[t]}var uS={};function dS(e,t,n){let r=parseInt(n,10);if(!Number.isFinite(r)||function(e){let t=new Set;for(let n of yx().split(`,`)){let r=n.trim().match(/^(\d+)(italic|i)?$/);r&&!!r[2]===e&&t.add(parseInt(r[1],10))}return t}(t===`italic`).has(r)||!(e in aS))return;let i=t===`italic`,a=`${e}|${+!!i}|${r}`;if(uS[a])return;uS[a]=!0;let o=document.createElement(`link`);o.type=`text/css`,o.href=Rx(e,i,r),o.rel=`stylesheet`,o.onerror=()=>{o.remove()},document.getElementsByTagName(`head`)[0].appendChild(o)}function fS(e){if(aS[e])return;let t=bx(e),n=document.createElement(`link`);n.type=`text/css`,n.href=t,n.rel=`stylesheet`,n.onerror=()=>{n.remove(),aS[e]=!1,oS[e]===`errored`?function(e){oS[e]=`probing`,fetch(bx(e),{mode:`no-cors`}).then(()=>{oS[e]=`missing`}).catch(()=>{delete oS[e]})}(e):oS[e]||(oS[e]=`errored`)},document.getElementsByTagName(`head`)[0].appendChild(n),aS[e]=!0}var pS={},mS;function hS(e){let t=e.fontFamily;if(pS[t]||!e.url&&!e.styles)return;delete oS[t];let n=Kx(e),r=(mS||(mS=document.getElementById(`polotno-font-style`),mS||(mS=document.createElement(`style`),mS.id=`polotno-font-style`,document.head.appendChild(mS)),mS)).sheet;n.forEach(e=>{r.insertRule(`\n @font-face{\n font-family:${Tb(t)};\n src:${e.src};\n font-style:${e.fontStyle};\n font-weight:${e.fontWeight};\n font-display:swap; /* optional but recommended */\n }`,r.cssRules.length)}),pS[e.fontFamily]=!0}var gS=()=>typeof globalThis<`u`?globalThis.Buffer:void 0,_S=e=>{if(typeof atob==`function`){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}let t=gS();if(t)return new Uint8Array(t.from(e,`base64`));throw Error(`No base64 decoder available`)},vS=e=>{if(typeof btoa==`function`){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}let t=gS();if(t)return t.from(e).toString(`base64`);throw Error(`No base64 encoder available`)},yS=[112,72,89,115],bS=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=1&n?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})(),xS=(e,t,n)=>{e[t]=n>>>24&255,e[t+1]=n>>>16&255,e[t+2]=n>>>8&255,e[t+3]=255&n},SS=(e,t,n)=>{let r=e.indexOf(`,`),i=_S(r>=0?e.slice(r+1):e);return`data:${t};base64,${vS(t===`image/png`?((e,t)=>{let n=(e=>{let t=new Uint8Array(9),n=new DataView(t.buffer);n.setUint32(0,e,!1),n.setUint32(4,e,!1),t[8]=1;let r=new Uint8Array(8+t.length+4);xS(r,0,t.length),r.set(yS,4),r.set(t,8);let i=new Uint8Array(4+t.length);return i.set(yS,0),i.set(t,4),xS(r,8+t.length,(e=>{let t=4294967295;for(let n=0;n<e.length;n++)t=bS[255&(t^e[n])]^t>>>8;return(4294967295^t)>>>0})(i)),r})(Math.round(t/.0254)),r=((e,t)=>{let n=8;for(;n+8<=e.length;){let r=e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3],i=n+4,a=e.subarray(i,i+4),o=8+r+4;if(t.every((e,t)=>a[t]===e))return{offset:n,totalLength:o};n+=o}return null})(e,yS);if(r){let t=new Uint8Array(e.length-r.totalLength+n.length);return t.set(e.slice(0,r.offset),0),t.set(n,r.offset),t.set(e.slice(r.offset+r.totalLength),r.offset+n.length),t}let i=16+(e[8]<<24|e[9]<<16|e[10]<<8|e[11])+4;if(i>e.length)return e;let a=new Uint8Array(e.length+n.length);return a.set(e.slice(0,i),0),a.set(n,i),a.set(e.slice(i),i+n.length),a})(i,n):((e,t)=>{let n=(e=>{let t=2;for(;t+4<e.length;){if(e[t]!==255)return-1;let n=e[t+1];if(n===216||n===217){t+=2;continue}let r=e[t+2]<<8|e[t+3];if(r<2)return-1;if(n===224&&e[t+4]===74&&e[t+5]===70&&e[t+6]===73&&e[t+7]===70&&e[t+8]===0)return t;let i=t+2+r;if(i<=t||i>e.length)return-1;t=i}return-1})(e);if(n>=0){let r=new Uint8Array(e),i=n+11;return r[i]=1,r[i+1]=t>>8&255,r[i+2]=255&t,r[i+3]=t>>8&255,r[i+4]=255&t,r}let r=(e=>{let t=new Uint8Array(18);return t[0]=255,t[1]=224,t[2]=0,t[3]=16,t[4]=74,t[5]=70,t[6]=73,t[7]=70,t[8]=0,t[9]=1,t[10]=1,t[11]=1,t[12]=e>>8&255,t[13]=255&e,t[14]=e>>8&255,t[15]=255&e,t})(t),i=new Uint8Array(e.length+r.length);return i.set(e.subarray(0,2),0),i.set(r,2),i.set(e.subarray(2),2+r.length),i})(i,n))}`},CS=({px:e,unit:t=`px`,dpi:n})=>{switch(t){case`pt`:default:return e;case`mm`:return e/(n/25.4);case`cm`:return e/(n/2.54);case`in`:return e/n}},wS=({px:e,precious:t=2,dpi:n=72,unit:r=`px`})=>parseFloat(CS({px:e,dpi:n,unit:r}).toFixed(t)),TS=({unitVal:e,dpi:t,unit:n})=>e/CS({px:1,unit:n,dpi:t}),ES=e=>{let t=parseFloat(CS(e).toFixed(1));switch(e.unit){case`pt`:return`${Math.round(t)}pt`;case`mm`:return`${t}mm`;case`cm`:return`${t}cm`;case`in`:return`${t}in`;default:return`${Math.round(t)}px`}};async function DS(e){for(let t=0;t<30;t++){let t=await e();if(t)return t;await new Promise(e=>setTimeout(e,50))}}function OS(e){"@babel/helpers - typeof";return OS=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},OS(e)}var kS=/^\s+/,AS=/\s+$/;function q(e,t){if(e||=``,t||={},e instanceof q)return e;if(!(this instanceof q))return new q(e,t);var n=jS(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}q.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t=e.r/255,n=e.g/255,r=e.b/255,i=t<=.03928?t/12.92:((t+.055)/1.055)**2.4,a=n<=.03928?n/12.92:((n+.055)/1.055)**2.4,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4;return .2126*i+.7152*a+.0722*o},setAlpha:function(e){return this._a=tC(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=FS(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=FS(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?`hsv(`+t+`, `+n+`%, `+r+`%)`:`hsva(`+t+`, `+n+`%, `+r+`%, `+this._roundA+`)`},toHsl:function(){var e=NS(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=NS(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?`hsl(`+t+`, `+n+`%, `+r+`%)`:`hsla(`+t+`, `+n+`%, `+r+`%, `+this._roundA+`)`},toHex:function(e){return LS(this._r,this._g,this._b,e)},toHexString:function(e){return`#`+this.toHex(e)},toHex8:function(e){return RS(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return`#`+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?`rgb(`+Math.round(this._r)+`, `+Math.round(this._g)+`, `+Math.round(this._b)+`)`:`rgba(`+Math.round(this._r)+`, `+Math.round(this._g)+`, `+Math.round(this._b)+`, `+this._roundA+`)`},toPercentageRgb:function(){return{r:Math.round(nC(this._r,255)*100)+`%`,g:Math.round(nC(this._g,255)*100)+`%`,b:Math.round(nC(this._b,255)*100)+`%`,a:this._a}},toPercentageRgbString:function(){return this._a==1?`rgb(`+Math.round(nC(this._r,255)*100)+`%, `+Math.round(nC(this._g,255)*100)+`%, `+Math.round(nC(this._b,255)*100)+`%)`:`rgba(`+Math.round(nC(this._r,255)*100)+`%, `+Math.round(nC(this._g,255)*100)+`%, `+Math.round(nC(this._b,255)*100)+`%, `+this._roundA+`)`},toName:function(){return this._a===0?`transparent`:this._a<1?!1:$S[LS(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t=`#`+zS(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?`GradientType = 1, `:``;if(e){var i=q(e);n=`#`+zS(i._r,i._g,i._b,i._a)}return`progid:DXImageTransform.Microsoft.gradient(`+r+`startColorstr=`+t+`,endColorstr=`+n+`)`},toString:function(e){var t=!!e;e||=this._format;var n=!1,r=this._a<1&&this._a>=0;return!t&&r&&(e===`hex`||e===`hex6`||e===`hex3`||e===`hex4`||e===`hex8`||e===`name`)?e===`name`&&this._a===0?this.toName():this.toRgbString():(e===`rgb`&&(n=this.toRgbString()),e===`prgb`&&(n=this.toPercentageRgbString()),(e===`hex`||e===`hex6`)&&(n=this.toHexString()),e===`hex3`&&(n=this.toHexString(!0)),e===`hex4`&&(n=this.toHex8String(!0)),e===`hex8`&&(n=this.toHex8String()),e===`name`&&(n=this.toName()),e===`hsl`&&(n=this.toHslString()),e===`hsv`&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return q(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(US,arguments)},brighten:function(){return this._applyModification(WS,arguments)},darken:function(){return this._applyModification(GS,arguments)},desaturate:function(){return this._applyModification(BS,arguments)},saturate:function(){return this._applyModification(VS,arguments)},greyscale:function(){return this._applyModification(HS,arguments)},spin:function(){return this._applyModification(KS,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(XS,arguments)},complement:function(){return this._applyCombination(qS,arguments)},monochromatic:function(){return this._applyCombination(ZS,arguments)},splitcomplement:function(){return this._applyCombination(YS,arguments)},triad:function(){return this._applyCombination(JS,[3])},tetrad:function(){return this._applyCombination(JS,[4])}},q.fromRatio=function(e,t){if(OS(e)==`object`){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]=r===`a`?e[r]:cC(e[r]));e=n}return q(e,t)};function jS(e){var t={r:0,g:0,b:0},n=1,r=null,i=null,a=null,o=!1,s=!1;return typeof e==`string`&&(e=pC(e)),OS(e)==`object`&&(fC(e.r)&&fC(e.g)&&fC(e.b)?(t=MS(e.r,e.g,e.b),o=!0,s=String(e.r).substr(-1)===`%`?`prgb`:`rgb`):fC(e.h)&&fC(e.s)&&fC(e.v)?(r=cC(e.s),i=cC(e.v),t=IS(e.h,r,i),o=!0,s=`hsv`):fC(e.h)&&fC(e.s)&&fC(e.l)&&(r=cC(e.s),a=cC(e.l),t=PS(e.h,r,a),o=!0,s=`hsl`),e.hasOwnProperty(`a`)&&(n=e.a)),n=tC(n),{ok:o,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}function MS(e,t,n){return{r:nC(e,255)*255,g:nC(t,255)*255,b:nC(n,255)*255}}function NS(e,t,n){e=nC(e,255),t=nC(t,255),n=nC(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a,o,s=(r+i)/2;if(r==i)a=o=0;else{var c=r-i;switch(o=s>.5?c/(2-r-i):c/(r+i),r){case e:a=(t-n)/c+(t<n?6:0);break;case t:a=(n-e)/c+2;break;case n:a=(e-t)/c+4}a/=6}return{h:a,s:o,l:s}}function PS(e,t,n){var r,i,a;e=nC(e,360),t=nC(t,100),n=nC(n,100);function o(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(t===0)r=i=a=n;else{var s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;r=o(c,s,e+1/3),i=o(c,s,e),a=o(c,s,e-1/3)}return{r:r*255,g:i*255,b:a*255}}function FS(e,t,n){e=nC(e,255),t=nC(t,255),n=nC(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a,o,s=r,c=r-i;if(o=r===0?0:c/r,r==i)a=0;else{switch(r){case e:a=(t-n)/c+(t<n?6:0);break;case t:a=(n-e)/c+2;break;case n:a=(e-t)/c+4}a/=6}return{h:a,s:o,v:s}}function IS(e,t,n){e=nC(e,360)*6,t=nC(t,100),n=nC(n,100);var r=Math.floor(e),i=e-r,a=n*(1-t),o=n*(1-i*t),s=n*(1-(1-i)*t),c=r%6,l=[n,o,a,a,s,n][c],u=[s,n,n,o,a,a][c],d=[a,a,s,n,n,o][c];return{r:l*255,g:u*255,b:d*255}}function LS(e,t,n,r){var i=[sC(Math.round(e).toString(16)),sC(Math.round(t).toString(16)),sC(Math.round(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join(``)}function RS(e,t,n,r,i){var a=[sC(Math.round(e).toString(16)),sC(Math.round(t).toString(16)),sC(Math.round(n).toString(16)),sC(lC(r))];return i&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join(``)}function zS(e,t,n,r){return[sC(lC(r)),sC(Math.round(e).toString(16)),sC(Math.round(t).toString(16)),sC(Math.round(n).toString(16))].join(``)}q.equals=function(e,t){return!e||!t?!1:q(e).toRgbString()==q(t).toRgbString()},q.random=function(){return q.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function BS(e,t){t=t===0?0:t||10;var n=q(e).toHsl();return n.s-=t/100,n.s=rC(n.s),q(n)}function VS(e,t){t=t===0?0:t||10;var n=q(e).toHsl();return n.s+=t/100,n.s=rC(n.s),q(n)}function HS(e){return q(e).desaturate(100)}function US(e,t){t=t===0?0:t||10;var n=q(e).toHsl();return n.l+=t/100,n.l=rC(n.l),q(n)}function WS(e,t){t=t===0?0:t||10;var n=q(e).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),q(n)}function GS(e,t){t=t===0?0:t||10;var n=q(e).toHsl();return n.l-=t/100,n.l=rC(n.l),q(n)}function KS(e,t){var n=q(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,q(n)}function qS(e){var t=q(e).toHsl();return t.h=(t.h+180)%360,q(t)}function JS(e,t){if(isNaN(t)||t<=0)throw Error(`Argument to polyad must be a positive number`);for(var n=q(e).toHsl(),r=[q(e)],i=360/t,a=1;a<t;a++)r.push(q({h:(n.h+a*i)%360,s:n.s,l:n.l}));return r}function YS(e){var t=q(e).toHsl(),n=t.h;return[q(e),q({h:(n+72)%360,s:t.s,l:t.l}),q({h:(n+216)%360,s:t.s,l:t.l})]}function XS(e,t,n){t||=6,n||=30;var r=q(e).toHsl(),i=360/n,a=[q(e)];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,a.push(q(r));return a}function ZS(e,t){t||=6;for(var n=q(e).toHsv(),r=n.h,i=n.s,a=n.v,o=[],s=1/t;t--;)o.push(q({h:r,s:i,v:a})),a=(a+s)%1;return o}q.mix=function(e,t,n){n=n===0?0:n||50;var r=q(e).toRgb(),i=q(t).toRgb(),a=n/100;return q({r:(i.r-r.r)*a+r.r,g:(i.g-r.g)*a+r.g,b:(i.b-r.b)*a+r.b,a:(i.a-r.a)*a+r.a})},q.readability=function(e,t){var n=q(e),r=q(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)},q.isReadable=function(e,t,n){var r=q.readability(e,t),i,a=!1;switch(i=mC(n),i.level+i.size){case`AAsmall`:case`AAAlarge`:a=r>=4.5;break;case`AAlarge`:a=r>=3;break;case`AAAsmall`:a=r>=7}return a},q.mostReadable=function(e,t,n){var r=null,i=0,a,o,s,c;n||={},o=n.includeFallbackColors,s=n.level,c=n.size;for(var l=0;l<t.length;l++)a=q.readability(e,t[l]),a>i&&(i=a,r=q(t[l]));return q.isReadable(e,r,{level:s,size:c})||!o?r:(n.includeFallbackColors=!1,q.mostReadable(e,[`#fff`,`#000`],n))};var QS=q.names={aliceblue:`f0f8ff`,antiquewhite:`faebd7`,aqua:`0ff`,aquamarine:`7fffd4`,azure:`f0ffff`,beige:`f5f5dc`,bisque:`ffe4c4`,black:`000`,blanchedalmond:`ffebcd`,blue:`00f`,blueviolet:`8a2be2`,brown:`a52a2a`,burlywood:`deb887`,burntsienna:`ea7e5d`,cadetblue:`5f9ea0`,chartreuse:`7fff00`,chocolate:`d2691e`,coral:`ff7f50`,cornflowerblue:`6495ed`,cornsilk:`fff8dc`,crimson:`dc143c`,cyan:`0ff`,darkblue:`00008b`,darkcyan:`008b8b`,darkgoldenrod:`b8860b`,darkgray:`a9a9a9`,darkgreen:`006400`,darkgrey:`a9a9a9`,darkkhaki:`bdb76b`,darkmagenta:`8b008b`,darkolivegreen:`556b2f`,darkorange:`ff8c00`,darkorchid:`9932cc`,darkred:`8b0000`,darksalmon:`e9967a`,darkseagreen:`8fbc8f`,darkslateblue:`483d8b`,darkslategray:`2f4f4f`,darkslategrey:`2f4f4f`,darkturquoise:`00ced1`,darkviolet:`9400d3`,deeppink:`ff1493`,deepskyblue:`00bfff`,dimgray:`696969`,dimgrey:`696969`,dodgerblue:`1e90ff`,firebrick:`b22222`,floralwhite:`fffaf0`,forestgreen:`228b22`,fuchsia:`f0f`,gainsboro:`dcdcdc`,ghostwhite:`f8f8ff`,gold:`ffd700`,goldenrod:`daa520`,gray:`808080`,green:`008000`,greenyellow:`adff2f`,grey:`808080`,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`,lightgray:`d3d3d3`,lightgreen:`90ee90`,lightgrey:`d3d3d3`,lightpink:`ffb6c1`,lightsalmon:`ffa07a`,lightseagreen:`20b2aa`,lightskyblue:`87cefa`,lightslategray:`789`,lightslategrey:`789`,lightsteelblue:`b0c4de`,lightyellow:`ffffe0`,lime:`0f0`,limegreen:`32cd32`,linen:`faf0e6`,magenta:`f0f`,maroon:`800000`,mediumaquamarine:`66cdaa`,mediumblue:`0000cd`,mediumorchid:`ba55d3`,mediumpurple:`9370db`,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:`db7093`,papayawhip:`ffefd5`,peachpuff:`ffdab9`,peru:`cd853f`,pink:`ffc0cb`,plum:`dda0dd`,powderblue:`b0e0e6`,purple:`800080`,rebeccapurple:`663399`,red:`f00`,rosybrown:`bc8f8f`,royalblue:`4169e1`,saddlebrown:`8b4513`,salmon:`fa8072`,sandybrown:`f4a460`,seagreen:`2e8b57`,seashell:`fff5ee`,sienna:`a0522d`,silver:`c0c0c0`,skyblue:`87ceeb`,slateblue:`6a5acd`,slategray:`708090`,slategrey:`708090`,snow:`fffafa`,springgreen:`00ff7f`,steelblue:`4682b4`,tan:`d2b48c`,teal:`008080`,thistle:`d8bfd8`,tomato:`ff6347`,turquoise:`40e0d0`,violet:`ee82ee`,wheat:`f5deb3`,white:`fff`,whitesmoke:`f5f5f5`,yellow:`ff0`,yellowgreen:`9acd32`},$S=q.hexNames=eC(QS);function eC(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function tC(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function nC(e,t){aC(e)&&(e=`100%`);var n=oC(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function rC(e){return Math.min(1,Math.max(0,e))}function iC(e){return parseInt(e,16)}function aC(e){return typeof e==`string`&&e.indexOf(`.`)!=-1&&parseFloat(e)===1}function oC(e){return typeof e==`string`&&e.indexOf(`%`)!=-1}function sC(e){return e.length==1?`0`+e:``+e}function cC(e){return e<=1&&(e=e*100+`%`),e}function lC(e){return Math.round(parseFloat(e)*255).toString(16)}function uC(e){return iC(e)/255}var dC=function(){var e=`(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)`,t=`[\\s|\\(]+(`+e+`)[,|\\s]+(`+e+`)[,|\\s]+(`+e+`)\\s*\\)?`,n=`[\\s|\\(]+(`+e+`)[,|\\s]+(`+e+`)[,|\\s]+(`+e+`)[,|\\s]+(`+e+`)\\s*\\)?`;return{CSS_UNIT:new RegExp(e),rgb:RegExp(`rgb`+t),rgba:RegExp(`rgba`+n),hsl:RegExp(`hsl`+t),hsla:RegExp(`hsla`+n),hsv:RegExp(`hsv`+t),hsva:RegExp(`hsva`+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function fC(e){return!!dC.CSS_UNIT.exec(e)}function pC(e){e=e.replace(kS,``).replace(AS,``).toLowerCase();var t=!1;if(QS[e])e=QS[e],t=!0;else if(e==`transparent`)return{r:0,g:0,b:0,a:0,format:`name`};var n;return(n=dC.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=dC.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=dC.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=dC.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=dC.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=dC.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=dC.hex8.exec(e))?{r:iC(n[1]),g:iC(n[2]),b:iC(n[3]),a:uC(n[4]),format:t?`name`:`hex8`}:(n=dC.hex6.exec(e))?{r:iC(n[1]),g:iC(n[2]),b:iC(n[3]),format:t?`name`:`hex`}:(n=dC.hex4.exec(e))?{r:iC(n[1]+``+n[1]),g:iC(n[2]+``+n[2]),b:iC(n[3]+``+n[3]),a:uC(n[4]+``+n[4]),format:t?`name`:`hex8`}:(n=dC.hex3.exec(e))?{r:iC(n[1]+``+n[1]),g:iC(n[2]+``+n[2]),b:iC(n[3]+``+n[3]),format:t?`name`:`hex`}:!1}function mC(e){var t,n;return e||={level:`AA`,size:`small`},t=(e.level||`AA`).toUpperCase(),n=(e.size||`small`).toLowerCase(),t!==`AA`&&t!==`AAA`&&(t=`AA`),n!==`small`&&n!==`large`&&(n=`small`),{level:t,size:n}}var hC=e=>{let t=globalThis.Buffer;if(t)return t.from(e.buffer,e.byteOffset,e.byteLength).toString(`base64`);let n=32768,r=``;for(let t=0;t<e.length;t+=n)r+=String.fromCharCode.apply(null,e.subarray(t,t+n));return btoa(r)},gC=gC||{};gC.stringify=(function(){var e={"visit_linear-gradient":function(t){return e.visit_gradient(t)},"visit_repeating-linear-gradient":function(t){return e.visit_gradient(t)},"visit_radial-gradient":function(t){return e.visit_gradient(t)},"visit_repeating-radial-gradient":function(t){return e.visit_gradient(t)},"visit_conic-gradient":function(t){return e.visit_gradient(t)},"visit_repeating-conic-gradient":function(t){return e.visit_gradient(t)},visit_gradient:function(t){var n=e.visit(t.orientation);return n&&(n+=`, `),t.type+`(`+n+e.visit(t.colorStops)+`)`},visit_shape:function(t){var n=t.value,r=e.visit(t.at),i=e.visit(t.style);return i&&(n+=` `+i),r&&(n+=` at `+r),n},"visit_default-radial":function(t){var n=``,r=e.visit(t.at);return r&&(t.hasAtKeyword?n+=`at `+r:n+=r),n},"visit_extent-keyword":function(t){var n=t.value,r=e.visit(t.at);return r&&(n+=` at `+r),n},"visit_position-keyword":function(e){return e.value},visit_position:function(t){return e.visit(t.value.x)+` `+e.visit(t.value.y)},"visit_%":function(e){return e.value+`%`},visit_em:function(e){return e.value+`em`},visit_px:function(e){return e.value+`px`},visit_rem:function(e){return e.value+`rem`},visit_vw:function(e){return e.value+`vw`},visit_vh:function(e){return e.value+`vh`},visit_vmin:function(e){return e.value+`vmin`},visit_vmax:function(e){return e.value+`vmax`},visit_ch:function(e){return e.value+`ch`},visit_ex:function(e){return e.value+`ex`},visit_calc:function(e){return`calc(`+e.value+`)`},visit_literal:function(t){return e.visit_color(t.value,t)},visit_hex:function(t){return e.visit_color(`#`+t.value,t)},visit_rgb:function(t){return e.visit_color(`rgb(`+t.value.join(`, `)+`)`,t)},visit_rgba:function(t){return e.visit_color(`rgba(`+t.value.join(`, `)+`)`,t)},visit_hsl:function(t){return e.visit_color(`hsl(`+t.value[0]+`, `+t.value[1]+`%, `+t.value[2]+`%)`,t)},visit_hsla:function(t){return e.visit_color(`hsla(`+t.value[0]+`, `+t.value[1]+`%, `+t.value[2]+`%, `+t.value[3]+`)`,t)},visit_var:function(t){return e.visit_color(`var(`+t.value+`)`,t)},visit_color:function(t,n){var r=t,i=e.visit(n.length);i&&(r+=` `+i);var a=e.visit(n.length2);return a&&(r+=` `+a),r},visit_angular:function(e){return e.value+(e.unit||`deg`)},visit_directional:function(e){return`to `+e.value},visit_conic:function(t){var n=``;return t.angle&&(n+=`from `+e.visit(t.angle)),t.at&&(n&&(n+=` `),n+=`at `+e.visit(t.at)),n},visit_array:function(t){var n=``,r=t.length;return t.forEach(function(t,i){n+=e.visit(t),i<r-1&&(n+=`, `)}),n},visit_object:function(t){return t.width&&t.height?e.visit(t.width)+` `+e.visit(t.height):``},visit:function(t){if(!t)return``;if(t instanceof Array)return e.visit_array(t);if(typeof t==`object`&&!t.type)return e.visit_object(t);if(t.type){var n=e[`visit_`+t.type];if(n)return n(t);throw Error(`Missing visitor visit_`+t.type)}throw Error(`Invalid node.`)}};return function(t){return e.visit(t)}})();var gC=gC||{};gC.parse=(function(){var e={linearGradient:/^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,repeatingLinearGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,radialGradient:/^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,repeatingRadialGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,conicGradient:/^(\-(webkit|o|ms|moz)\-)?(conic\-gradient)/i,repeatingConicGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,remValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))rem/,vwValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))vw/,vhValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))vh/,vminValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))vmin/,vmaxValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))vmax/,chValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))ch/,exValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))ex/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,radianValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))rad/,gradianValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))grad/,turnValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))turn/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,slash:/^\//,hexColor:/^\#([0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{4}|[0-9a-fA-F]{3})(?![0-9a-fA-F])/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-zA-Z0-9-,\s\#]+)/,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i},t=``;function n(e){var n=Error(t+`: `+e);throw n.source=t,n}function r(){var e=i();return t.length>0&&n(`Invalid input not EOF`),e}function i(){return S(a)}function a(){return o(`linear-gradient`,e.linearGradient,c)||o(`repeating-linear-gradient`,e.repeatingLinearGradient,c)||o(`radial-gradient`,e.radialGradient,m)||o(`repeating-radial-gradient`,e.repeatingRadialGradient,m)||o(`conic-gradient`,e.conicGradient,l)||o(`repeating-conic-gradient`,e.repeatingConicGradient,l)}function o(t,r,i){return s(r,function(r){var a=i();return a&&(R(e.comma)||n(`Missing comma before color stops`)),{type:t,orientation:a,colorStops:S(C)}})}function s(t,r){var i=R(t);if(i){R(e.startCall)||n(`Missing (`);var a=r(i);return R(e.endCall)||n(`Missing )`),a}}function c(){var t=d();if(t)return t;var n=L(`position-keyword`,e.positionKeywords,1);return n?{type:`directional`,value:n.value}:f()}function l(){var e=u(),t=y();if(e||t)return{type:`conic`,angle:e||void 0,at:t||void 0}}function u(){if(L(`from`,/^from/,0)){var e=f();return e||n(`Missing angle after "from" in conic-gradient`),e}}function d(){return L(`directional`,e.sideOrCorner,1)}function f(){return p(`deg`,e.angleValue)||p(`rad`,e.radianValue)||p(`grad`,e.gradianValue)||p(`turn`,e.turnValue)}function p(e,t){var n=R(t);if(n)return{type:`angular`,value:n[1],unit:e}}function m(){var n,r=h(),i;return r&&(n=[],n.push(r),i=t,R(e.comma)&&(r=h(),r?n.push(r):t=i)),n}function h(){var e=g()||_();if(e)e.at=y();else{var t=v();if(t){e=t;var n=y();n&&(e.at=n)}else{var r=y();if(r)e={type:`default-radial`,at:r,hasAtKeyword:!0};else{var i=b();i&&(e={type:`default-radial`,at:i})}}}return e}function g(){var e=L(`shape`,/^(circle)/i,0);return e&&(e.style=ne()||v()),e}function _(){var e=L(`shape`,/^(ellipse)/i,0);return e&&(e.style=b()||F()||v()),e}function v(){return L(`extent-keyword`,e.extentKeywords,1)}function y(){if(L(`position`,/^at/,0)){var e=b();return e||n(`Missing positioning value`),e}}function b(){var e=x();if(e.x||e.y)return{type:`position`,value:e}}function x(){return{x:F(),y:F()}}function S(t){var r=t(),i=[];if(r)for(i.push(r);R(e.comma);)r=t(),r?i.push(r):n(`One extra comma`);return i}function C(){var e=w();return e||n(`Expected color definition`),e.length=F(),e.length&&(e.length2=F()),e}function w(){return E()||j()||ee()||O()||D()||A()||T()}function T(){return L(`literal`,e.literalColor,0)}function E(){return L(`hex`,e.hexColor,1)}function D(){return s(e.rgbColor,function(){return k(`rgb`)})}function O(){return s(e.rgbaColor,function(){return k(`rgba`)})}function k(t){var n=P();if(R(e.comma)){var r=P();R(e.comma);var i=P(),a=[n,r,i];return R(e.comma)?(a.push(P()),{type:`rgba`,value:a}):{type:t,value:a}}var r=P(),i=P(),a=[n,r,i];return R(e.slash)?(a.push(P()),{type:`rgba`,value:a}):{type:t,value:a}}function A(){return s(e.varColor,function(){return{type:`var`,value:N()}})}function ee(){return s(e.hslColor,function(){return M(`hsl`)})}function j(){return s(e.hslaColor,function(){return M(`hsla`)})}function M(t){R(e.percentageValue)&&n(`HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage`);var r=P();if(R(e.comma)){var i=R(e.percentageValue),a=i?i[1]:null;R(e.comma),i=R(e.percentageValue);var o=i?i[1]:null;if((!a||!o)&&n(`Expected percentage value for saturation and lightness in HSL`),R(e.comma)){var s=P();return{type:`hsla`,value:[r,a,o,s]}}return{type:t,value:[r,a,o]}}var i=R(e.percentageValue),a=i?i[1]:null;i=R(e.percentageValue);var o=i?i[1]:null;if((!a||!o)&&n(`Expected percentage value for saturation and lightness in HSL`),R(e.slash)){var s=P();return{type:`hsla`,value:[r,a,o,s]}}return{type:t,value:[r,a,o]}}function N(){return R(e.variableName)[1]}function P(){return R(e.number)[1]}function F(){return L(`%`,e.percentageValue,1)||I()||te()||ne()}function I(){return L(`position-keyword`,e.positionKeywords,1)}function te(){return s(e.calcValue,function(){for(var e=1,r=0;e>0&&r<t.length;){var i=t.charAt(r);i===`(`?e++:i===`)`&&e--,r++}e>0&&n(`Missing closing parenthesis in calc() expression`);var a=t.substring(0,r-1);return re(r-1),{type:`calc`,value:a}})}function ne(){return L(`px`,e.pixelValue,1)||L(`em`,e.emValue,1)||L(`rem`,e.remValue,1)||L(`vw`,e.vwValue,1)||L(`vh`,e.vhValue,1)||L(`vmin`,e.vminValue,1)||L(`vmax`,e.vmaxValue,1)||L(`ch`,e.chValue,1)||L(`ex`,e.exValue,1)}function L(e,t,n){var r=R(t);if(r)return{type:e,value:r[n]}}function R(e){var n,r=/^[\n\r\t\s]+/.exec(t);return r&&re(r[0].length),n=e.exec(t),n&&re(n[0].length),n}function re(e){t=t.substring(e)}return function(e){return t=e.toString().trim(),t.endsWith(`;`)&&(t=t.slice(0,-1)),r()}})(),gC.parse,gC.stringify;var _C={parse:gC.parse,stringify:gC.stringify},vC=e=>typeof e==`string`&&e.indexOf(`linear-gradient`)>=0,yC={top:0,right:90,bottom:180,left:270,"top right":45,"right top":45,"bottom right":135,"right bottom":135,"bottom left":225,"left bottom":225,"top left":315,"left top":315},bC=e=>e.type===`hex`?`#`+e.value:e.type===`literal`?e.value:`${e.type}(${e.value.join(`,`)})`,xC=e=>{if(!vC(e)){let t=q(e).isValid()?e:`#000000`;return{rotation:0,stops:[{offset:0,color:t},{offset:1,color:t}]}}let t=_C.parse(e)[0],n=0;return t.orientation&&`value`in t.orientation&&(n=t.orientation.type===`directional`?yC[t.orientation.value]??0:parseFloat(t.orientation.value)||0),{rotation:n,stops:t.colorStops.map((e,n)=>({color:bC(e),offset:e.length?parseFloat(e.length.value)/100:t.colorStops.length>1?n/(t.colorStops.length-1):0}))}},SC=e=>xC(e).stops[0]?.color??`#000000`,CC=e=>{let t=e*Math.PI/180;return{x1:.5-.5*Math.sin(t),y1:.5+.5*Math.cos(t),x2:.5+.5*Math.sin(t),y2:.5-.5*Math.cos(t)}},wC=e=>{if(!vC(e))return null;let{stops:t,rotation:n}=xC(e);return{...CC(n),stops:t}},TC=(e,t)=>({x1:t.x+e.x1*t.width,y1:t.y+e.y1*t.height,x2:t.x+e.x2*t.width,y2:t.y+e.y2*t.height}),EC=n(((e,t)=>{e=t.exports=n;function n(e){return r.bind(null,e)}function r(e){var t=[].slice.call(arguments,1);t.unshift(`[`+e+`]`),process.stderr.write(t.join(` `)+`
110
+ `)}})),DC=n(((e,t)=>{EC()(`lex`),e=t.exports=n;function n(e){var t=``,n,r=0,i=-1,a=0,o=1,s=`before-selector`,c=[s],l={},u=[],d=[`media`,`keyframes`,{name:`-webkit-keyframes`,type:`keyframes`,prefix:`-webkit-`},{name:`-moz-keyframes`,type:`keyframes`,prefix:`-moz-`},{name:`-ms-keyframes`,type:`keyframes`,prefix:`-ms-`},{name:`-o-keyframes`,type:`keyframes`,prefix:`-o-`},`font-face`,{name:`import`,state:`before-at-value`},{name:`charset`,state:`before-at-value`},`supports`,`viewport`,{name:`namespace`,state:`before-at-value`},`document`,{name:`-moz-document`,type:`document`,prefix:`-moz-`},`page`];function f(){return x(),e[i]}function p(e){return e?c[c.length-1-e]:s}function m(t){var n=i+1;return t===e.slice(n,n+t.length)}function h(t){var n=e.slice(i).indexOf(t);return n>0&&n}function g(e){return e===_(1)}function _(t){return e[i+(t||1)]}function v(){var e=c.pop();return s=c[c.length-1],e}function y(e){return s=e,c.push(s),c.length}function b(e){var t=s;return c[c.length-1]=s=e,t}function x(t){if((t||1)==1)e[i]==`
111
+ `?(o++,r=1):r++,i++;else{var n=e.slice(i,i+t).split(`
112
+ `);n.length>1&&(o+=n.length-1,r=1),r+=n[n.length-1].length,i+=t}}function S(){l.end={line:o,col:r},u.push(l),t=``,l={}}function C(e){l={type:e,start:{line:o,col:r}}}for(;n=f();)switch(n){case` `:switch(p()){case`selector`:case`value`:case`value-paren`:case`at-group`:case`at-value`:case`comment`:case`double-string`:case`single-string`:t+=n}break;case`
113
+ `:case` `:case`\r`:case`\f`:switch(p()){case`value`:case`value-paren`:case`at-group`:case`comment`:case`single-string`:case`double-string`:case`selector`:t+=n;break;case`at-value`:n===`
114
+ `&&(l.value=t.trim(),S(),v())}break;case`:`:switch(p()){case`name`:l.name=t.trim(),t=``,b(`before-value`);break;case`before-selector`:t+=n,C(`selector`),y(`selector`);break;case`before-value`:b(`value`),t+=n;break;default:t+=n}break;case`;`:switch(p()){case`name`:case`before-value`:case`value`:t.trim().length>0&&(l.value=t.trim(),S()),b(`before-name`);break;case`value-paren`:t+=n;break;case`at-value`:l.value=t.trim(),S(),v();break;case`before-name`:break;default:t+=n}break;case`{`:switch(p()){case`selector`:if(_(-1)===`\\`){t+=n;break}l.text=t.trim(),S(),b(`before-name`),a+=1;break;case`at-group`:switch(l.name=t.trim(),l.type){case`font-face`:case`viewport`:case`page`:y(`before-name`);break;default:y(`before-selector`)}S(),a+=1;break;case`name`:case`at-rule`:l.name=t.trim(),S(),y(`before-name`),a+=1;break;case`comment`:case`double-string`:case`single-string`:t+=n;break;case`before-value`:b(`value`),t+=n}break;case`}`:switch(p()){case`before-name`:case`name`:case`before-value`:case`value`:t&&(l.value=t.trim()),l.name&&l.value&&S(),C(`end`),S(),v(),p()===`at-group`&&(C(`at-group-end`),S(),v()),a>0&&--a;break;case`at-group`:case`before-selector`:case`selector`:if(_(-1)===`\\`){t+=n;break}a>0&&p(1)===`at-group`&&(C(`at-group-end`),S()),a>1&&v(),a>0&&--a;break;case`double-string`:case`single-string`:case`comment`:t+=n}break;case`"`:case`'`:switch(p()){case`double-string`:n===`"`&&_(-1)!==`\\`&&v();break;case`single-string`:n===`'`&&_(-1)!==`\\`&&v();break;case`before-at-value`:b(`at-value`),y(n===`"`?`double-string`:`single-string`);break;case`before-value`:b(`value`),y(n===`"`?`double-string`:`single-string`);break;case`comment`:break;default:_(-1)!==`\\`&&y(n===`"`?`double-string`:`single-string`)}t+=n;break;case`/`:switch(p()){case`comment`:case`double-string`:case`single-string`:t+=n;break;case`before-value`:case`selector`:case`name`:case`value`:if(g(`*`)){var w=h(`*/`);w&&x(w+1)}else p()==`before-value`&&b(`value`),t+=n;break;default:g(`*`)?(C(`comment`),y(`comment`),x()):t+=n}break;case`*`:switch(p()){case`comment`:g(`/`)?(l.text=t,x(),S(),v()):t+=n;break;case`before-selector`:t+=n,C(`selector`),y(`selector`);break;case`before-value`:b(`value`),t+=n;break;default:t+=n}break;case`@`:switch(p()){case`comment`:case`double-string`:case`single-string`:t+=n;break;case`before-value`:b(`value`),t+=n;break;default:for(var T=!1,E,D,O=0,k=d.length;!T&&O<k;++O)D=d[O],E=D.name||D,m(E)&&(T=!0,C(E),y(D.state||`at-group`),x(E.length),D.prefix&&(l.prefix=D.prefix),D.type&&(l.type=D.type));T||(t+=n)}break;case`(`:switch(p()){case`value`:y(`value-paren`);break;case`before-value`:b(`value`)}t+=n;break;case`)`:switch(p()){case`value-paren`:v();break;case`before-value`:b(`value`)}t+=n;break;default:switch(p()){case`before-selector`:C(`selector`),y(`selector`);break;case`before-name`:C(`property`),b(`name`);break;case`before-value`:b(`value`);break;case`before-at-value`:b(`at-value`)}t+=n}return u}})),OC=n(((e,t)=>{EC()(`parse`);var n=DC();e=t.exports=s;var r,i,a,o;function s(e,t){t||={},r=!!t.comments,a=!!t.position,i=0,o=Array.isArray(e)?e.slice():n(e);for(var s,c=[],u;u=l();)s=_(u),s&&c.push(s);return{type:`stylesheet`,stylesheet:{rules:c}}}function c(e,t){t||={};for(var n,r=[`type`,`name`,`value`],i={},o=0;o<r.length;++o)n=r[o],e[n]&&(i[n]=t[n]||e[n]);for(r=Object.keys(t),o=0;o<r.length;++o)n=r[o],i[n]||(i[n]=t[n]);return a&&(i.position={start:e.start,end:e.end}),i}function l(){return o.shift()}function u(e){i+=1;var t={};switch(e.type){case`font-face`:case`viewport`:t.declarations=y();break;case`page`:t.prefix=e.prefix,t.declarations=y();break;default:t.prefix=e.prefix,t.rules=b()}return c(e,t)}function d(e){return c(e)}function f(e){return c(e)}function p(e){return c(e,{text:e.text})}function m(e){return c(e)}function h(e){return c(e)}function g(e){function t(e){return e.trim()}return c(e,{type:`rule`,selectors:e.text.split(`,`).map(t),declarations:y(e)})}function _(e){switch(e.type){case`property`:return h(e);case`selector`:return g(e);case`at-group-end`:--i;return;case`media`:case`keyframes`:return u(e);case`comment`:if(r)return p(e);break;case`charset`:return f(e);case`import`:return d(e);case`namespace`:return m(e);case`font-face`:case`supports`:case`viewport`:case`document`:case`page`:return u(e)}}function v(e){for(var t,n=[],r;(r=l())&&e&&e(r);)t=_(r),t&&n.push(t);return r&&r.type!==`end`&&o.unshift(r),n}function y(){return v(function(e){return e.type===`property`||e.type===`comment`})}function b(){return v(function(){return i})}})),kC=n(((e,t)=>{EC()(`stringify`);var n,r,i,a,o,s;e=t.exports=c;function c(e,t){return t||={},i=t.indentation||``,r=!!t.compress,n=!!t.comments,a=1,r?o=s=``:(o=`
115
+ `,s=` `),m(e.stylesheet.rules,v).join(`
116
+ `).trim()}function l(e){if(e){a+=e;return}return r?``:Array(a).join(i||``)}function u(e){return`@`+e.type+` `+e.value+`;`+o}function d(e){var t=``,n=e.prefix||``;e.name&&(t=` `+e.name);var r=e.type!==`page`;return`@`+n+e.type+t+s+h(e,r)+o}function f(e){return n?`/*`+(e.text||``)+`*/`+o:``}function p(e){var t;return e.selectors?t=e.selectors.join(`,`+o):(t=`@`+e.type,t+=e.name?` `+e.name:``),l()+t+s+h(e)+o}function m(e,t){return e.reduce(function(e,n){var r=n.type===`comment`?f(n):t(n);return r&&e.push(r),e},[])}function h(e,t){var n=e.declarations,r=_;return e.rules&&(n=e.rules,r=p),n=g(n,r),n&&=o+n+(t?``:o),`{`+n+l()+`}`}function g(e,t){if(!e)return``;l(1);var n=m(e,t);return l(-1),n.length?n.join(o):``}function _(e){if(e.type===`property`)return y(e)}function v(e){switch(e.type){case`rule`:return p(e);case`media`:case`keyframes`:return d(e);case`comment`:return f(e);case`import`:case`charset`:case`namespace`:return u(e);case`font-face`:case`supports`:case`viewport`:case`document`:case`page`:return d(e)}}function y(e){var t=e.name?e.name+`:`+s:``;return l()+t+e.value+`;`}})),AC=t(n(((e,t)=>{t.exports={lex:DC(),parse:OC(),stringify:kC()}}))(),1);function jC(e){for(;e.parentNode;){if(e.nodeName===`defs`)return!0;e=e.parentNode}return!1}function MC(e){let t={};return Array.from(e.getElementsByTagName(`style`)).forEach(e=>{let n=AC.default.parse(e.textContent).stylesheet.rules;for(let e of n)e.selectors&&e.selectors.forEach(n=>{let r=t[n]||{};e.declarations.forEach(e=>{r[e.name]=e.value}),t[n]=r})}),t}function NC(e){let t=e.parentNode;for(;t;){if(t.nodeName===`svg`)return t;t=t.parentNode}return null}function PC(e,t){let n={fill:``,stroke:``},r=e.getAttribute(`class`)?.split(` `)||[],i=e.getAttribute(`id`),a={};i&&t[`#${i}`]?a=t[`#${i}`]:r.forEach(e=>{t[`.${e}`]&&(a={...a,...t[`.${e}`]})}),t[e.nodeName]&&(a={...a,...t[e.nodeName]});let o=e.getAttribute(`fill`);o&&o!==`none`?n.fill=o:a.fill&&a.fill!==`none`&&(n.fill=a.fill);let s=e.getAttribute(`stroke`);s&&s!==`none`?n.stroke=s:a.stroke&&a.stroke!==`none`&&(n.stroke=a.stroke);let c=Eb(e.getAttribute(`style`)),l=kb(c.fill||``),u=kb(c.stroke||``);!n.fill&&l&&l!==`none`&&(n.fill=l),!n.stroke&&u&&u!==`none`&&(n.stroke=u);let d=!!(o||a.fill||l);if(!n.stroke&&!n.fill&&!d){let r=NC(e),i=r?PC(r,t):null;i?.fill!==`currentColor`&&i?.stroke!==`currentColor`&&(n.fill=`black`)}return n}var FC=/^url\(\s*['"]?#([^'")]+)['"]?\s*\)$/;function IC(e,t){let n=e.getElementById(t);return n&&(n.nodeName===`linearGradient`||n.nodeName===`radialGradient`)?n:null}function LC(e){let t=e.ownerDocument,n=[],r=e;for(;r&&!n.includes(r);){n.push(r);let e=r.getAttribute(`href`)||r.getAttribute(`xlink:href`)||``;r=e.startsWith(`#`)?IC(t,e.slice(1)):null}return n}function RC(e){for(let t of e){let e=Array.from(t.children).filter(e=>e.nodeName===`stop`);if(e.length)return e}return[]}function zC(e,t){for(let n of e){let e=n.getAttribute(t);if(e!==null&&e!==``)return e}return null}function BC(e,t){let n=parseFloat(e??``);return isNaN(n)?t:e.indexOf(`%`)>=0?n/100:n}function VC(e){let t=BC(zC(e,`x1`),0),n=BC(zC(e,`y1`),0),r=BC(zC(e,`x2`),1),i=BC(zC(e,`y2`),0),a=zC(e,`gradientTransform`)?.match(/matrix\(([^)]+)\)/);if(a){let e=a[1].split(/[\s,]+/).map(Number);if(e.length===6&&e.every(e=>!isNaN(e))){let[a,o,s,c,l,u]=e,d=a*t+s*n+l,f=o*t+c*n+u,p=a*r+s*i+l,m=o*r+c*i+u;t=d,n=f,r=p,i=m}}let o=r-t,s=i-n;if(o===0&&s===0)return 90;let c=Math.atan2(o,-s)*180/Math.PI;return c<0&&(c+=360),Math.round(c*100)/100}function HC(e){let t=LC(e),n=[];for(let e of RC(t)){let t=Eb(e.getAttribute(`style`)),r=kb(e.getAttribute(`stop-color`)||t[`stop-color`]||`black`),i=kb(e.getAttribute(`stop-opacity`)??t[`stop-opacity`]??``),a=parseFloat(i);isNaN(a)||(r=iw(r,a));let o=Math.min(1,Math.max(0,BC(e.getAttribute(`offset`),0)));n.push(`${r} ${Math.round(o*1e4)/100}%`)}return n.length===0?null:`linear-gradient(${VC(t)}deg, ${n.join(`, `)})`}function UC(e,t){let n=t?.match(FC)?.[1],r=n?IC(e,n):null,i=r&&HC(r);return i?{grad:r,serialized:i}:null}function WC(e,t){let n=e.ownerDocument,r=e.namespaceURI;for(let t of Array.from(e.children))t.nodeName===`stop`&&e.removeChild(t);for(let i of t){let t=n.createElementNS(r,`stop`);t.setAttribute(`offset`,i.offset*100+`%`),t.setAttribute(`stop-color`,i.color),e.appendChild(t)}}var GC=[`x1`,`y1`,`x2`,`y2`,`gradientUnits`,`gradientTransform`];function KC(e){let t=e.ownerDocument,n=[];for(let r of[`linearGradient`,`radialGradient`])for(let i of Array.from(t.getElementsByTagName(r))){if(i===e)continue;let t=LC(i);t.includes(e)&&n.push({def:i,chain:t})}return n}function qC(e){let t=[];for(let{def:n,chain:r}of KC(e)){let i=r.findIndex(e=>RC([e]).length);i!==-1&&r.indexOf(e)>i||t.push({def:n,stops:RC(r)})}for(let{def:e,stops:n}of t)for(let t of n)e.appendChild(t.cloneNode(!0))}var JC={x1:`0%`,y1:`0%`,x2:`100%`,y2:`0%`};function YC(e){let t=[];for(let{def:n,chain:r}of KC(e)){let e=[];for(let t of GC){if(n.getAttribute(t))continue;let i=zC(r,t)??JC[t];i!=null&&e.push([t,i])}t.push({def:n,values:e})}for(let{def:e,values:n}of t)for(let[t,r]of n)e.setAttribute(t,r)}function XC(e,t){let{rotation:n,stops:r}=xC(t);if(qC(e),WC(e,r),e.nodeName!==`linearGradient`)return;let i=LC(e),a=VC(i);if(Math.abs(n-a)>.01){YC(e);let{x1:t,y1:r,x2:a,y2:o}=CC(n),s=e=>String(Math.round(e*1e6)/1e6);e.setAttribute(`gradientUnits`,`objectBoundingBox`),e.removeAttribute(`gradientTransform`),zC(i,`gradientTransform`)&&e.setAttribute(`gradientTransform`,`matrix(1,0,0,1,0,0)`),e.setAttribute(`x1`,s(t)),e.setAttribute(`y1`,s(r)),e.setAttribute(`x2`,s(a)),e.setAttribute(`y2`,s(o))}}var ZC=[`path`,`rect`,`circle`,`line`,`polygon`,`polyline`,`ellipse`,`text`];function QC(e,t){let n=e.childNodes||[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===1&&(t.push(r),QC(r,t))}}function $C(e){var t=[],n=[];QC(e,n);for(var r=0,i=n.length;r<i;r++){let e=n[r];jC(e)||(e.getAttribute(`fill`)!==null&&t.push(e),e.getAttribute(`stroke`)===null?(Eb(e.getAttribute(`style`)).fill||ZC.indexOf(e.nodeName)>=0)&&t.push(e):t.push(e))}return t}var ew=(e,t)=>e?.code?e:s(`FETCH_FAILED`,`Failed to fetch ${t}`,{url:t},e),tw=e=>{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return new TextDecoder().decode(n)};async function nw(e,{cache:t=null,fetchImpl:n=e=>fetch(e),binary:r=!1}={}){let i=t?.buffers.get(e);if(i!==void 0){let e=await i;return e.startsWith(`data:`)?e:aw(e)}let a=(async()=>{try{let t=await n(e);if(r&&t.arrayBuffer){let e=new Uint8Array(await t.arrayBuffer());return`data:${(t.headers?.get?.(`content-type`)||``).split(`;`)[0]||`image/svg+xml`};base64,${hC(e)}`}return aw(await t.text())}catch(t){throw ew(t,e)}})();return t&&(t.buffers.set(e,a),a.then(n=>t.buffers.set(e,n),()=>t.buffers.delete(e))),a}async function rw(e,{cache:t=null,fetchImpl:n=e=>fetch(e,{mode:`cors`})}={}){let r=t?.buffers.get(e);if(r!==void 0){let e=await r;return e.startsWith(`data:`)?tw(e.split(`base64,`)[1]):e}let i=(async()=>{try{return(e.startsWith(`data:`)?e.slice(0,e.indexOf(`,`)+1):``).endsWith(`;base64,`)?tw(e.split(`base64,`)[1]):await(await n(e)).text()}catch(t){throw ew(t,e)}})();return t&&(t.buffers.set(e,i),i.then(n=>t.buffers.set(e,n),()=>t.buffers.delete(e))),i}function iw(e,t){if(t===1)return e;let n=d.Util.colorToRGBA(e);return n?`rgba(${n.r}, ${n.g}, ${n.b}, ${n.a*t})`:e}function aw(e){return`data:image/svg+xml;base64,`+btoa(unescape(encodeURIComponent(e)))}function ow(e){var t=Sb.createDOMParser().parseFromString(e,`image/svg+xml`);return t.documentElement.setAttribute(`preserveAspectRatio`,`none`),Sb.createXMLSerializer().serializeToString(t)}function sw(e){return e.indexOf(`data:image/svg+xml`)>=0||e.indexOf(`.svg`)>=0}var cw={"":1,px:1,pt:96/72,pc:16,in:96,cm:96/2.54,mm:96/25.4,q:96/101.6};function lw(e){let t=e?.trim().match(/^(-?[\d.]+)([a-z]*)$/i);if(!t)return null;let n=cw[t[2].toLowerCase()],r=n?parseFloat(t[1])*n:0;return r>0?r:null}function uw(e){let[,,t,n]=(e.documentElement.getAttribute(`viewBox`)?.trim()||``).split(/[\s,]+/).map(parseFloat),r=lw(e.documentElement.getAttribute(`width`)),i=lw(e.documentElement.getAttribute(`height`)),a=t>0&&n>0?t/n:NaN;return{width:r??(i===null?t:i*a),height:i??(r===null?n:r/a),derivedWidth:r===null,derivedHeight:i===null}}function dw(e){if(!e.documentElement)return;let t=uw(e);(t.derivedWidth||t.derivedHeight)&&t.width>0&&t.height>0&&(e.documentElement.setAttribute(`width`,t.width+`px`),e.documentElement.setAttribute(`height`,t.height+`px`))}async function fw(e){if(e.startsWith(`data:`))throw Error(`not an svg: ${e.slice(0,e.indexOf(`,`)+1)}`);let t=await fetch(e,{mode:`cors`}).catch(t=>{throw ew(t,e)}),n=t.headers.get(`content-type`)||``;if(n.indexOf(`svg`)===-1)throw t.body?.cancel().catch(()=>{}),Error(`not an svg: ${n||`no content-type`}`);return t.text()}async function pw(e){let t=sw(e)?await rw(e):await fw(e);return uw(Sb.createDOMParser().parseFromString(t,`image/svg+xml`))}function mw(e){var t=Sb.createDOMParser().parseFromString(e,`image/svg+xml`);return dw(t),Sb.createXMLSerializer().serializeToString(t)}var hw=(e,t)=>{if(!e||!t)return!1;if(t===`currentColor`&&e===`black`)return!0;if(vC(e)||vC(t))return e===t;let n=d.Util.colorToRGBA(e),r=d.Util.colorToRGBA(t);if(!(!n||!r))return n.r===r.r&&n.g===r.g&&n.b===r.b&&n.a===r.a};function gw(e,t,n,r){var i=e.namespaceURI,a=e.ownerDocument,o=a.createElementNS(i,`linearGradient`);let{x1:s,y1:c,x2:l,y2:u}=CC(n);return o.setAttribute(`x1`,s*100+`%`),o.setAttribute(`y1`,c*100+`%`),o.setAttribute(`x2`,l*100+`%`),o.setAttribute(`y2`,u*100+`%`),o.setAttribute(`gradientUnits`,`userSpaceOnUse`),o.setAttribute(`id`,t),WC(o,r),(e.getElementsByTagName(`defs`)[0]||e.insertBefore(a.createElementNS(i,`defs`),e.firstChild)).appendChild(o)}function _w(e){let t=new Map,n=0;return r=>{let i=t.get(r);if(i)return i;let a=`color`+n++;for(;e.getElementById(a);)a=`color`+n++;let{rotation:o,stops:s}=xC(r);return gw(e.children[0],a,o,s),t.set(r,a),a}}function vw(e,t){let n=$C(e),r=Array.from(t.keys()),i=MC(e),a=_w(e),o=[];n.forEach(n=>{let{fill:a,stroke:s}=PC(n,i);[{prop:`fill`,color:a},{prop:`stroke`,color:s}].forEach(({prop:i,color:a})=>{let s=UC(e,a),c=s?s.serialized:a,l=r.find(e=>hw(e,c));l&&o.push({el:n,prop:i,paintRef:s,newColor:t.get(l)})})}),o.forEach(({el:e,prop:t,paintRef:n,newColor:r})=>{if(vC(r)){if(n){XC(n.grad,r);return}Ab(e,t,null),e.setAttribute(t,`url('#${a(r)}')`)}else Ab(e,t,r)})}function yw(e,t){let n=Sb.createDOMParser().parseFromString(e,`image/svg+xml`);return vw(n,t),Sb.createXMLSerializer().serializeToString(n)}function bw(e,t){return aw(yw(e,t))}function xw(e,t){let n=Sb.createDOMParser().parseFromString(e,`image/svg+xml`);return dw(n),t?.size&&vw(n,t),aw(Sb.createXMLSerializer().serializeToString(n))}var Sw=(e,t)=>s(`IMAGE_FAILED`,`Failed to load image: ${e}`,{reason:`load`,src:e},t),Cw=e=>e.width===300||e.height===150&&e.width<=300;function ww(e){return new Promise((t,n)=>{let r=Sb.createElement(`img`);r.onload=async()=>{let i=r.width>0&&r.height>0?{width:r.width,height:r.height}:null;if(i&&!Cw(i)){t(i);return}let a=null,o;try{a=await pw(e)}catch(e){o=e}let s=a&&a.width>0&&a.height>0?a:null,c=s&&s.derivedWidth&&s.derivedHeight,l=s&&(!i||c)?s:i;l?t({width:l.width,height:l.height}):n(Sw(e,o??Error(`svg states no size`)))},r.onerror=t=>{n(Sw(e,t))},r.crossOrigin=`anonymous`,r.src=e})}function Tw(e){return new Promise((t,n)=>{let r=Sb.createElement(`img`);r.onload=()=>{t(r)},r.onerror=t=>{n(Sw(e,t))},r.crossOrigin=`anonymous`,r.src=e})}var Ew=e=>!!e.stretchEnabled;function Dw(e){let t=e.borderSize??0;if(t<=0||t>=Math.min(e.width,e.height))return 0;let n=q(e.borderColor??``);return n.isValid()&&n.getAlpha()===1?t/2:0}function Ow(e,t){let n=t.width*e.cropWidth,r=t.height*e.cropHeight,i=e.width/e.height,a=n/r,o,s;return Ew(e)?(o=n,s=r):i>=a?(o=n,s=n/i):(o=r*i,s=r),{x:e.cropX*t.width,y:e.cropY*t.height,width:o,height:s}}function kw(e,t){let n=Ow(e,t);return{...n,x:e.flipX?t.width-n.x-n.width:n.x,y:e.flipY?t.height-n.y-n.height:n.y}}function Aw(e,t){let n=kw(e,t),r=n.width/t.width,i=n.height/t.height,a=n.width/n.height>e.width/e.height?e.height/n.height:e.width/n.width,o=Ew(e),s=o?e.width/n.width:a,c=o?e.height/n.height:a,l=n.width*s/r,u=n.height*c/i;return{scaleX:s,scaleY:c,cropScaledX:n.x*s,cropScaledY:n.y*c,cropScaledWidth:l,cropScaledHeight:u}}async function jw(e,t,n){let r=n??await Tw(e),i=Sb.createElement(`canvas`);i.width=r.width*2,i.height=r.height*2,i.getContext(`2d`).drawImage(r,0,0,i.width,i.height);let a=Sb.createElement(`canvas`);a.width=t.width,a.height=t.height;let o=a.getContext(`2d`),s=Ow(t,i);return o.drawImage(i,s.x,s.y,s.width,s.height,0,0,a.width,a.height),a.toDataURL(`image/png`)}function Mw(e,t){let{width:n,height:r}=e,i=n/r,a,o;i>=t.width/t.height?(a=t.width,o=t.width/i):(a=t.height*i,o=t.height);let s=(t.width-a)/2,c=(t.height-o)/2;return{cropX:s/t.width,cropY:c/t.height,cropWidth:a/t.width,cropHeight:o/t.height}}var J=(e,t,...n)=>({type:e,props:t,children:n||[]}),Nw=async(e,t,n)=>e&&await e({dom:t,element:n})||t;function Pw(e,t){switch(e){case`arrow`:return{kind:`polyline`,filled:!1,points:[[t*3,-t*2],[0,0],[t*3,t*2]]};case`triangle`:return{kind:`polygon`,filled:!0,points:[[t*3,-t*2],[0,0],[t*3,t*2]]};case`bar`:return{kind:`polyline`,filled:!1,points:[[0,-t*2],[0,t*2]]};case`circle`:return{kind:`circle`,cx:t*2,cy:0,r:t*2,filled:!0};case`square`:return{kind:`polygon`,filled:!0,points:[[0,-t*2],[t*4,-t*2],[t*4,t*2],[0,t*2]]};default:return null}}var Fw=(e,t)=>{let n=Pw(t,e.height);if(!n)return null;let r={"stroke-width":e.height,stroke:e.color,"stroke-linecap":`round`,"stroke-linejoin":`round`,fill:n.filled?e.color:`none`};return n.kind===`circle`?J(`circle`,{cx:n.cx,cy:n.cy,r:n.r,...r}):J(n.kind,{points:n.points.map(([e,t])=>`${e},${t}`).join(` `),...r})},Iw=e=>[J(`line`,{x1:0,y1:e.height/2,x2:e.width,y2:e.height/2,stroke:e.color,"stroke-width":e.height,"stroke-dasharray":e.dash&&e.dash.length?e.dash.map(t=>t*e.height).join(` `):void 0}),J(`g`,{transform:`translate(0 ${e.height/2})`},Fw(e,e.startHead)),J(`g`,{transform:`translate(${e.width} ${e.height/2}) rotate(180)`},Fw(e,e.endHead))];function Lw(e){return!d.Util.colorToRGBA(e)&&!vC(e)}function Rw(e){return[...e.filter(e=>!e.alwaysOnTop),...e.filter(e=>e.alwaysOnTop)]}var zw=({width:e,height:t,cornerRadius:n=0})=>{if(n>0){let r=Math.min(n,e/2,t/2);return`M 0 ${r} A ${r} ${r} 0 0 1 ${r} 0 L ${e-r} 0 A ${r} ${r} 0 0 1 ${e} ${r} L ${e} ${t-r} A ${r} ${r} 0 0 1 ${e-r} ${t} L ${r} ${t} A ${r} ${r} 0 0 1 0 ${t-r} Z`}return`M 0 0 L ${e} 0 L ${e} ${t} L 0 ${t} Z`},Bw=({width:e,height:t})=>`M ${e/2} 0 L ${e} ${t} L 0 ${t} Z`,Vw=({width:e,height:t})=>`M 0 0 L ${e} 0 L 0 ${t} Z`,Hw=({width:e,height:t})=>`M ${e/2} ${t/2} m -${e/2}, 0 a ${e/2},${t/2} 0 1,0 ${e},0 a ${e/2},${t/2} 0 1,0 -${e},0`;function Uw({width:e,height:t}){let n=e/2,r=t/2,i=e/2,a=t/2,o=i/2,s=a/2,c=``,l=Math.PI/5;for(let e=0;e<10;e++){let t=e%2==0?i:o,u=e%2==0?a:s,d=n+t*Math.sin(e*l),f=r-u*Math.cos(e*l);e===0?c=`M ${d} ${f}`:c+=` L ${d} ${f}`}return c+` Z`}function Ww({width:e,height:t}){let n=e/2,r=t/2;return`M ${n} 0 L ${e} ${r} L ${n} ${t} L 0 ${r} Z`}function Gw({width:e,height:t}){let n=e/2,r=t/2,i=e/2,a=t/2,o=``,s=Math.PI*2/5;for(let e=0;e<5;e++){let t=i,c=a,l=n+t*Math.sin(e*s),u=r-c*Math.cos(e*s);e===0?o=`M ${l} ${u}`:o+=` L ${l} ${u}`}return o+` Z`}function Kw({width:e,height:t}){let n=e/2,r=t/2,i=e/2,a=t/2,o=``,s=Math.PI*2/6;for(let e=0;e<6;e++){let t=i,c=a,l=n+t*Math.sin(e*s),u=r-c*Math.cos(e*s);e===0?o=`M ${l} ${u}`:o+=` L ${l} ${u}`}return o+` Z`}var qw={M:[`x`,`y`],L:[`x`,`y`],T:[`x`,`y`],H:[`x`],V:[`y`],C:[`x`,`y`,`x`,`y`,`x`,`y`],S:[`x`,`y`,`x`,`y`],Q:[`x`,`y`,`x`,`y`],Z:[]};function Jw(e,t,n){let r=``,i=0;return e.replace(/[A-Za-z]|-?\d*\.?\d+(?:[eE][-+]?\d+)?/g,e=>{if(/^[A-Za-z]$/.test(e)){if(!qw[e.toUpperCase()])throw Error(`scalePathData: unsupported path command "${e}" (elliptical arcs cannot be non-uniformly scaled — use Béziers)`);return r=e,i=0,e}let a=qw[r.toUpperCase()],o=a?.length?a[i%a.length]:`x`;i+=1;let s=parseFloat(e)*(o===`x`?t:n),c=String(Number(s.toFixed(4)));return!/[0-9]/.test(e[0])&&/[0-9]/.test(c[0])?` ${c}`:c})}function Y({path:e,aspectRatio:t,width:n,height:r}){return Jw(e,n/t.width,r/t.height)}function Yw({width:e,height:t}){let n=Math.min(e,t)*.1,r=e*.2,i=t*.2,a=e*.5,o=`M ${n},0`;return o+=` H ${e-n}`,o+=` A ${n},${n} 0 0 1 ${e},${n}`,o+=` V ${t-n-i}`,o+=` A ${n},${n} 0 0 1 ${e-n},${t-i}`,o+=` H ${a+r/2}`,o+=` L ${a},${t}`,o+=` L ${a-r/2},${t-i}`,o+=` H ${n}`,o+=` A ${n},${n} 0 0 1 0,${t-n-i}`,o+=` V ${n}`,o+=` A ${n},${n} 0 0 1 ${n},0`,o+=` Z`,o}function Xw({width:e,height:t}){let n=e*.3,r=t*.3,i=e/2,a=t/2,o=i-n/2,s=i+n/2,c=a-r/2,l=a+r/2,u=`M ${o},0 `;return u+=`H ${s} `,u+=`V ${c} `,u+=`H ${e} `,u+=`V ${l} `,u+=`H ${s} `,u+=`V ${t} `,u+=`H ${o} `,u+=`V ${l} `,u+=`H 0 `,u+=`V ${c} `,u+=`H ${o} `,u+=`V 0 `,u+=`Z`,u}var Zw={rect:zw,circle:Hw,star:Uw,triangle:Bw,rightTriangle:Vw,diamond:Ww,pentagon:Gw,hexagon:Kw,speechBubble:Yw,cross:Xw,arc:({width:e,height:t})=>Y({path:`M234 117C234 85.97 221.673 56.21 199.731 34.269C177.79 12.327 148.03 0 117 0C85.97 0 56.2103 12.327 34.2685 34.268C12.3268 56.21 0 85.97 0 117H117H234Z`,aspectRatio:{width:234,height:117},width:e,height:t}),cloud:({width:e,height:t})=>Y({path:`M216.41 57.006C216.961 54.084 217.249 51.069 217.249 47.986C217.249 21.4841 195.972 0 169.725 0C153.666 0 139.467 8.043 130.865 20.3575C122.606 13.3566 111.954 9.1402 100.327 9.1402C74.3322 9.1402 53.2123 30.2136 52.8094 56.364H52.8035C23.6407 56.364 0 80.235 0 109.682C0 139.129 23.6407 163 52.8035 163H208.197C237.359 163 261 139.129 261 109.682C261 83.056 241.672 60.99 216.41 57.006Z`,aspectRatio:{width:261,height:163},width:e,height:t}),rightArrow:({width:e,height:t})=>{let n=e*.6,r=t/2;return`M 0 ${t/4} L ${n} ${t/4} L ${n} 0 L ${e} ${r} L ${n} ${t} L ${n} ${t*.75} L 0 ${t*.75} Z`},leftArrow:({width:e,height:t})=>{let n=e*.4,r=t/2;return`M ${e} ${t/4} L ${n} ${t/4} L ${n} 0 L 0 ${r} L ${n} ${t} L ${n} ${t*.75} L ${e} ${t*.75} Z`},downArrow:({width:e,height:t})=>{let n=t*.6,r=e/2;return`M ${e/4} 0 L ${e/4} ${n} L 0 ${n} L ${r} ${t} L ${e} ${n} L ${e*.75} ${n} L ${e*.75} 0 Z`},upArrow:({width:e,height:t})=>{let n=t*.4,r=e/2;return`M ${e/4} ${t} L ${e/4} ${n} L 0 ${n} L ${r} 0 L ${e} ${n} L ${e*.75} ${n} L ${e*.75} ${t} Z`},asterisk1:({width:e,height:t})=>Y({path:`M45.5265 218.498C51.5466 222.87 58.5359 224.98 65.4742 224.98C75.916 224.98 86.221 220.2 92.853 211.217C92.872 211.198 92.89 211.178 92.907 211.157C92.923 211.136 92.939 211.115 92.954 211.094L92.977 211.061C92.993 211.039 93.008 211.017 93.023 210.996L116.491 178.725L139.959 210.996C139.982 211.031 140.006 211.058 140.029 211.088C140.04 211.102 140.05 211.116 140.061 211.132C151.115 226.188 172.355 229.505 187.473 218.515C202.608 207.526 205.992 186.278 195.074 171.104L195.05 171.066C195.03 171.034 195.014 171.01 194.989 170.985L171.572 138.696L209.512 126.346C227.334 120.545 237.129 101.305 231.33 83.476C225.532 65.648 206.315 55.8493 188.476 61.6334L150.537 73.933L150.52 34.0064C150.502 15.2594 135.248 0 116.508 0C97.768 0 82.514 15.2594 82.497 34.0234L82.463 73.916L44.5233 61.6163C44.5083 61.6163 44.49 61.613 44.4716 61.6078C44.4477 61.6014 44.4232 61.5918 44.4041 61.5823C26.5992 55.8664 7.45076 65.665 1.66886 83.46C-4.11314 101.254 5.61427 120.426 23.3511 126.278C23.3675 126.283 23.3822 126.289 23.3963 126.295L23.4588 126.319L23.4873 126.329L61.4098 138.679L37.9929 170.968C37.9844 170.985 37.9718 171.002 37.9591 171.019C37.9462 171.036 37.9336 171.053 37.9251 171.07C26.9903 186.244 30.3915 207.509 45.5265 218.498Z`,aspectRatio:{width:233,height:225},width:e,height:t}),asterisk2:({width:e,height:t})=>Y({path:`M46.0556 112L0 85.388L33.9456 26.6121L80.028 53.1781L80.054 0H147.946L147.972 53.1781L194.054 26.6121L228 85.388L181.944 112L228 138.612L194.054 197.388L147.972 170.822L147.946 224H80.054L80.028 170.822L33.9456 197.388L0 138.612L46.0556 112Z`,aspectRatio:{width:228,height:224},width:e,height:t}),bookmark:({width:e,height:t})=>Y({path:`M0 0H199V238L99.5 142.8L0 238V0Z`,aspectRatio:{width:199,height:238},width:e,height:t}),butterfly:({width:e,height:t})=>Y({path:`M94.5 100.713C91.935 150.916 50.703 190.909 0 191.493V0C50.703 0.5845 91.935 40.5767 94.5 90.78C97.031 41.2385 137.217 1.6407 187 0.0438004V191.45C137.217 189.853 97.031 150.255 94.5 100.713Z`,aspectRatio:{width:187,height:192},width:e,height:t}),cylinder:({width:e,height:t})=>Y({path:`M169 36.8497V218.15C169 238.502 131.168 255 84.5 255C37.832 255 0 238.502 0 218.15V36.8497C0 16.4982 37.832 0 84.5 0C131.168 0 169 16.4982 169 36.8497Z`,aspectRatio:{width:169,height:255},width:e,height:t}),diamond2:({width:e,height:t})=>Y({path:`M0 55.5L124 185L248 55.5L189.307 0H58.6933L0 55.5Z`,aspectRatio:{width:248,height:185},width:e,height:t}),door:({width:e,height:t})=>Y({path:`M140 69.697C140 31.2044 108.66 0 70 0C31.34 0 0 31.2044 0 69.697V207H140V69.697Z`,aspectRatio:{width:140,height:207},width:e,height:t}),drop1:({width:e,height:t})=>Y({path:`M167 150.687C167 196.328 129.407 234 83.139 234C37.593 234 0 196.328 0 150.687C0 100.7 51.329 36.9474 83.139 0C114.948 39.1207 167 98.526 167 150.687Z`,aspectRatio:{width:167,height:234},width:e,height:t}),drop2:({width:e,height:t})=>Y({path:`M73 239C53.64 239 35.071 231.315 21.3812 217.634C7.691 203.954 0 185.4 0 166.054C0 136.091 13.8696 113.633 30.768 86.27C43.912 64.9877 58.888 40.7377 70.597 7.6816C71.281 5.7496 72.989 0 72.989 0C72.989 0 72.993 0.0124998 73 0.0363998C73.007 0.0124998 73.011 0 73.011 0C73.011 0 74.719 5.7496 75.403 7.6816C87.112 40.7377 102.088 64.9877 115.232 86.27C132.13 113.633 146 136.091 146 166.054C146 185.4 138.309 203.954 124.619 217.634C111.025 231.218 92.225 239 73 239Z`,aspectRatio:{width:146,height:239},width:e,height:t}),explosion:({width:e,height:t})=>Y({path:`M165.802 184.465L118.997 260L125.343 182.079L34.9058 219.45L99.164 159.817L0 163.792L78.538 134.373L0 74.7401L86.471 89.052V0L118.997 89.052L165.802 10.3364L149.143 97.798L217.368 29.419L165.802 112.905L245.927 81.101L165.802 143.914H261L165.802 184.465Z`,aspectRatio:{width:261,height:260},width:e,height:t}),flag:({width:e,height:t})=>Y({path:`M0 142.161C0 142.161 51.9956 118.626 103 137.469C159.992 158.525 206 141.31 206 141.31V11.1373C206 11.1373 160 28.3218 103.016 7.28273C52 -11.553 0 12.0974 0 12.0974V142.161Z`,aspectRatio:{width:206,height:148},width:e,height:t}),flower:({width:e,height:t})=>Y({path:`M135.351 66.1893C196.683 -5.00591 256.536 100.304 164.908 117.361C256.536 135.16 195.944 239.728 135.351 168.532C166.386 257.526 45.9394 256.785 76.975 168.532C15.643 239.728 -44.2109 135.16 47.4173 117.361C-44.9498 100.304 15.643 -4.26431 76.975 66.1893C45.2005 -22.0631 166.386 -22.0631 135.351 66.1893ZM105.793 104.012C113.183 104.012 119.833 109.945 119.833 117.361C119.833 124.777 113.183 131.452 105.793 131.452C98.404 131.452 92.492 124.777 92.492 117.361C92.492 109.945 98.404 104.012 105.793 104.012Z`,aspectRatio:{width:212,height:235},width:e,height:t}),frame:({width:e,height:t})=>Y({path:`M0 0H240L200 88L240 176H0L40 88L0 0Z`,aspectRatio:{width:240,height:176},width:e,height:t}),heart1:({width:e,height:t})=>Y({path:`M215.886 56.157C215.886 24.729 191.112 0 160.584 0C135.933 0 115.08 16.983 107.937 39.93C100.788 16.986 79.935 0.591 55.284 0.591C24.75 0.591 0 24.615 0 56.055C0 71.919 6.321 83.127 16.494 95.121L107.988 189.447L199.377 95.121C209.559 83.127 215.886 72.009 215.886 56.157Z`,aspectRatio:{width:216,height:190},width:e,height:t}),home:({width:e,height:t})=>Y({path:`M0 62.143L95.5 0L191 62.143V195H0V62.143Z`,aspectRatio:{width:191,height:195},width:e,height:t}),home2:({width:e,height:t})=>Y({path:`M206 94.076L103 0L0 94.076H31.2377V189H175.607V94.076H206Z`,aspectRatio:{width:206,height:189},width:e,height:t}),hourglass:({width:e,height:t})=>Y({path:`M0.392782 0H187.607C193.014 43.3688 140.804 53.797 140.804 97.5C140.804 141.203 193.014 151.631 187.607 195H0.392782C-5.01452 151.631 47.196 141.203 47.196 97.5C47.196 53.797 -5.01452 43.3688 0.392782 0Z`,aspectRatio:{width:188,height:195},width:e,height:t}),house:({width:e,height:t})=>Y({path:`M0 92.367L95 0L190 92.367V223H0V92.367Z`,aspectRatio:{width:190,height:223},width:e,height:t}),keyhole:({width:e,height:t})=>Y({path:`M115 57.0494C115 25.5387 89.416 0 57.863 0C26.311 0 0.726898 25.5414 0.726898 57.0494C0.726898 78.652 12.759 97.451 30.505 107.136L0 219H114.845L84.448 107.524C102.608 97.962 115 78.959 115 57.0494Z`,aspectRatio:{width:115,height:219},width:e,height:t}),kiss:({width:e,height:t})=>Y({path:`M124.5 17.1468C80.036 -36.5162 0 52.9218 0 52.9218C0 52.9218 44.4643 120 124.5 120C204.536 120 249 52.9218 249 52.9218C249 52.9218 168.964 -36.5162 124.5 17.1468Z`,aspectRatio:{width:249,height:120},width:e,height:t}),leaf:({width:e,height:t})=>Y({path:`M204.414 0.0151567C204.414 0.0151567 206.837 93.9509 150.394 150.394C93.9507 206.837 0.0151569 204.413 0.0151569 204.413C0.0151569 204.413 -2.40835 110.478 54.0347 54.0349C110.478 -2.40834 204.414 0.0151567 204.414 0.0151567Z`,aspectRatio:{width:205,height:205},width:e,height:t}),lightning1:({width:e,height:t})=>Y({path:`M111.5 0L0 142H51.433L31.5 253L143 111H91.567L111.5 0Z`,aspectRatio:{width:143,height:253},width:e,height:t}),lightning2:({width:e,height:t})=>Y({path:`M126 0H43L0 120.531H36L6 227L110 80.354H73L126 0Z`,aspectRatio:{width:126,height:227},width:e,height:t}),magnet:({width:e,height:t})=>Y({path:`M88.402 0H0V67.669H88.402C105.271 67.669 118.957 81.308 118.957 98C118.957 114.689 105.271 128.331 88.402 128.331H0V196H88.402C142.747 196 187 152.072 187 98C187 43.9279 142.747 0 88.402 0Z`,aspectRatio:{width:187,height:196},width:e,height:t}),mithosis:({width:e,height:t})=>Y({path:`M150.996 136.45C137.141 128.926 117.559 128.7 103.532 135.896C93.843 140.867 82.875 143.67 71.2577 143.67C31.9033 143.67 0 111.508 0 71.835C0 32.161 31.9033 0 71.2577 0C83.467 0 94.959 3.0955 105.004 8.5504C118.859 16.0745 138.441 16.3 152.467 9.1038C162.157 4.1328 173.125 1.3303 184.742 1.3303C224.097 1.3303 256 33.492 256 73.165C256 112.839 224.097 145 184.742 145C172.533 145 161.041 141.905 150.996 136.45Z`,aspectRatio:{width:256,height:145},width:e,height:t}),orangeRicky:({width:e,height:t})=>Y({path:`M69 0H0V69V138V207H69H138V138H69V69V0Z`,aspectRatio:{width:138,height:207},width:e,height:t}),party:({width:e,height:t})=>Y({path:`M134.622 0L144.682 68.2539L174.415 5.9977L163.91 74.1846L210.671 23.4578L180.535 85.519L240.169 50.8289L193.079 101.25L260.29 85.679L200.43 119.98L269.245 124.911L201.934 140.044L266.237 165.04L197.456 159.661L251.535 202.5L187.396 177.086L226.445 233.962L172.646 190.771L193.197 256.631L154.518 199.501L154.743 268.492L134.622 202.5L114.501 268.492L114.727 199.501L76.0482 256.631L96.5985 190.771L42.7992 233.962L81.8489 177.086L17.7091 202.5L71.7885 159.661L3.0072 165.04L67.3112 140.044L0 124.911L68.8149 119.98L8.9545 85.679L76.1658 101.25L29.0753 50.8289L88.7105 85.519L58.5743 23.4578L105.335 74.1846L94.8305 5.9977L124.562 68.2539L134.622 0Z`,aspectRatio:{width:270,height:269},width:e,height:t}),pillow:({width:e,height:t})=>Y({path:`M176 0.00169945C157.812 16.9062 125.203 28.174 88.001 28.174C50.798 28.174 18.1881 16.9054 0 0V258.421C18.1882 241.516 50.798 230.248 88 230.248C125.202 230.248 157.812 241.516 176 258.421V0.00169945Z`,aspectRatio:{width:176,height:259},width:e,height:t}),polygon:({width:e,height:t})=>Y({path:`M110 0L219.119 63V189L110 252L0.880798 189V63L110 0Z`,aspectRatio:{width:220,height:252},width:e,height:t}),rainbow:({width:e,height:t})=>Y({path:`M186.907 141H282C282 63.128 218.872 0 141 0C63.1278 0 0 63.128 0 141H95.093C95.093 115.646 115.646 95.093 141 95.093C166.354 95.093 186.907 115.646 186.907 141Z`,aspectRatio:{width:282,height:141},width:e,height:t}),rhodeIsland:({width:e,height:t})=>Y({path:`M69 0H0V69V138H69V207H138V138V69H69V0Z`,aspectRatio:{width:138,height:207},width:e,height:t}),shell:({width:e,height:t})=>Y({path:`M109 0C169.199 0 218 48.743 218 108.87C185.392 108.87 158.958 135.273 158.958 167.842C158.958 179.736 158.958 191 158.958 191H59.042C59.042 191 59.042 179.736 59.042 167.842C59.042 135.273 32.6077 108.87 0 108.87C0 48.743 48.8007 0 109 0Z`,aspectRatio:{width:218,height:191},width:e,height:t}),shield1:({width:e,height:t})=>Y({path:`M203.184 30.7277C142.457 30.7277 102.853 0 102.853 0C102.853 0 63.249 30.7277 3.05098 30.7277C3.05098 30.7277 -3.81372 128.209 3.05098 162.115C9.38758 193.902 102.853 249 102.853 249C102.853 249 196.319 193.902 203.184 162.115C209.52 128.738 203.184 30.7277 203.184 30.7277Z`,aspectRatio:{width:206,height:249},width:e,height:t}),shield2:({width:e,height:t})=>Y({path:`M0 12.9585C64.624 -4.3195 136.376 -4.3195 201 12.9585C201 51.0564 201 89.154 201 127.252C201 184.396 100.498 240 100.498 240C100.498 240 0 184.406 0 127.252C0 89.154 0 51.0564 0 12.9585Z`,aspectRatio:{width:201,height:240},width:e,height:t}),skewedRectangle:({width:e,height:t})=>Y({path:`M85.9799 0H290L204.02 141H0L85.9799 0Z`,aspectRatio:{width:290,height:141},width:e,height:t}),softFlower:({width:e,height:t})=>Y({path:`M109 0C80.073 0 56.6234 23.4498 56.6234 52.3766C56.6234 54.722 54.722 56.6234 52.3766 56.6234C23.4498 56.6234 0 80.073 0 109C0 137.927 23.4498 161.377 52.3766 161.377C54.722 161.377 56.6234 163.278 56.6234 165.623C56.6234 194.55 80.073 218 109 218C137.927 218 161.377 194.55 161.377 165.623C161.377 163.278 163.278 161.377 165.623 161.377C194.55 161.377 218 137.927 218 109C218 80.073 194.55 56.6234 165.623 56.6234C163.278 56.6234 161.377 54.722 161.377 52.3766C161.377 23.4498 137.927 0 109 0Z`,aspectRatio:{width:218,height:218},width:e,height:t}),softStar:({width:e,height:t})=>Y({path:`M130.424 3.17662C130.927 -1.05888 137.073 -1.05888 137.576 3.17662L141.792 38.7086C147.236 84.59 183.41 120.764 229.291 126.208L264.823 130.424C269.059 130.927 269.059 137.073 264.823 137.576L229.291 141.792C183.41 147.236 147.236 183.41 141.792 229.291L137.576 264.823C137.073 269.059 130.927 269.059 130.424 264.823L126.208 229.291C120.764 183.41 84.59 147.236 38.7086 141.792L3.17662 137.576C-1.05888 137.073 -1.05888 130.927 3.17662 130.424L38.7086 126.208C84.59 120.764 120.764 84.59 126.208 38.7086L130.424 3.17662Z`,aspectRatio:{width:268,height:268},width:e,height:t}),stairs1:({width:e,height:t})=>Y({path:`M0 0H67.667V67.667H135.333V135.333H203V203H0V0Z`,aspectRatio:{width:203,height:203},width:e,height:t}),stairs2:({width:e,height:t})=>Y({path:`M50 0H0V200H200V150H150V100H100V50H50V0Z`,aspectRatio:{width:200,height:200},width:e,height:t}),teewee:({width:e,height:t})=>Y({path:`M69 0H138V69H207V138H138H69H0V69H69V0Z`,aspectRatio:{width:207,height:138},width:e,height:t}),blob1:({width:e,height:t})=>Y({path:`M172.979 19.611C191.285 33.0858 204.505 54.442 210.861 78.5949C217.471 103.002 217.471 130.46 205.776 151.816C194.335 173.427 171.454 189.444 147.047 196.054C122.639 202.919 96.7069 200.631 75.3506 190.715C54.2486 180.546 37.7229 163.003 23.4855 142.155C9.5022 121.307 -2.19289 97.4087 0.349524 74.7813C3.14617 52.1538 19.9261 30.7976 40.2654 17.8313C60.6046 4.61077 84.5033 -0.474048 108.148 0.0344341C131.538 0.542916 154.928 6.13621 172.979 19.611Z`,aspectRatio:{width:216,height:200},width:e,height:t}),blob10:({width:e,height:t})=>Y({path:`M188.684 8.95173C205.601 24.3309 200.988 63.0866 191.453 99.3816C182.225 135.677 168.076 169.511 146.238 175.355C124.399 181.507 94.871 159.668 66.5733 143.059C37.9679 126.449 10.5929 115.068 2.59569 95.0754C-5.4015 75.0824 5.97912 46.1694 24.4342 30.4826C42.8893 14.7958 68.4188 12.0276 100.715 6.79864C132.704 1.5697 171.767 -6.42749 188.684 8.95173Z`,aspectRatio:{width:200,height:177},width:e,height:t}),blob11:({width:e,height:t})=>Y({path:`M137.368 29.4923C148.97 46.7605 146.542 72.1231 148.161 99.1046C149.779 126.086 155.715 154.956 144.113 174.383C132.781 193.81 103.911 203.793 80.4369 198.666C56.963 193.27 38.6156 173.034 28.3626 153.607C17.8398 134.181 15.4115 115.833 9.47555 91.5498C3.53961 67.2664 -5.63411 37.3169 4.61887 20.0488C15.1417 2.51078 45.0911 -1.80626 72.8821 0.622074C100.673 2.78059 126.036 12.2241 137.368 29.4923Z`,aspectRatio:{width:152,height:200},width:e,height:t}),blob12:({width:e,height:t})=>Y({path:`M158.391 17.923C172.491 28.5703 180.261 48.1384 187.743 70.5842C194.937 93.3177 202.419 118.641 194.649 138.785C187.167 158.928 164.146 173.317 138.535 184.54C112.923 196.05 84.4347 204.108 58.8235 197.777C33.2123 191.446 10.191 170.439 2.99688 146.267C-4.48504 121.807 3.57241 94.181 10.4788 68.282C17.0974 42.0953 22.565 17.6352 37.8166 7.27563C53.0682 -3.37171 78.1038 0.081487 100.837 2.67138C123.859 5.26127 144.29 7.27563 158.391 17.923Z`,aspectRatio:{width:198,height:200},width:e,height:t}),blob13:({width:e,height:t})=>Y({path:`M149.668 1.37595C170.663 5.22017 193.728 17.3442 198.755 34.7911C204.078 52.2379 191.363 75.3032 178.943 93.9329C166.819 112.563 154.99 126.757 140.501 145.386C126.011 164.312 108.86 187.673 92.5957 186.194C76.3317 185.011 60.9549 159.285 45.8737 140.655C30.4968 122.321 15.7114 110.788 7.43151 95.1157C-0.848339 79.4432 -2.32688 59.0392 3.5873 41.5924C9.50148 23.8498 23.1041 8.76868 38.7767 3.44592C54.745 -1.87685 73.3746 2.55879 91.7086 2.26308C110.338 2.26308 128.968 -2.17256 149.668 1.37595Z`,aspectRatio:{width:200,height:187},width:e,height:t}),blob14:({width:e,height:t})=>Y({path:`M137.838 28.6426C150.711 40.5617 165.014 46.5213 178.363 58.2021C191.474 69.8828 203.87 87.0464 198.864 99.6807C193.858 112.315 171.689 120.42 157.862 135.676C144.275 151.171 139.269 173.579 126.873 182.161C114.477 190.505 94.9294 185.022 76.8123 178.109C58.4568 171.196 41.5316 163.091 28.1822 150.456C14.5943 137.822 4.58225 120.42 1.24488 101.826C-2.09248 83.2322 1.00651 62.9697 13.8792 52.4809C26.7519 41.992 49.1598 41.0385 65.6083 30.788C82.0567 20.5376 92.0688 0.990158 103.034 0.0366268C113.762 -0.916905 125.204 16.9618 137.838 28.6426Z`,aspectRatio:{width:200,height:187},width:e,height:t}),blob15:({width:e,height:t})=>Y({path:`M185.203 1.52939C197.679 7.62217 200 32.2835 200 51.7223C200 71.1612 197.389 85.3777 197.679 100.175C198.259 114.681 201.741 129.768 198.259 143.114C194.778 156.46 184.623 168.356 171.567 173.868C158.801 179.671 143.134 179.091 130.368 174.739C117.312 170.387 106.867 162.263 86.8482 160.812C66.539 159.362 36.9454 164.294 18.9572 155.3C0.968966 146.306 -5.41395 123.095 5.03083 105.977C15.4756 88.5692 42.4579 77.5442 55.5139 59.5559C68.2798 41.8578 67.1192 17.4867 76.9837 9.6531C86.5581 2.10965 107.158 11.3939 128.627 9.6531C150.097 8.20244 172.728 -4.27327 185.203 1.52939Z`,aspectRatio:{width:200,height:179},width:e,height:t}),blob16:({width:e,height:t})=>Y({path:`M158.441 55.3221C167.253 80.2399 160.264 105.462 147.501 134.938C134.738 164.717 116.81 199.055 97.0576 199.967C77.3057 201.182 55.7305 168.668 34.4592 133.722C13.1879 99.0802 -7.77953 62.3112 2.85612 36.4818C13.4918 10.6523 56.0344 -3.93369 90.0685 0.928322C123.799 6.09421 149.324 30.7081 158.441 55.3221Z`,aspectRatio:{width:163,height:200},width:e,height:t}),blob17:({width:e,height:t})=>Y({path:`M168.917 36.7587C178.871 53.2457 175.138 76.5764 172.961 106.129C170.472 135.37 169.85 170.832 150.563 187.63C131.276 204.739 93.3252 203.495 65.0173 187.63C36.7095 172.077 18.0449 142.213 7.77943 107.373C-2.79714 72.2213 -4.35252 32.7147 14.312 14.0502C32.9765 -4.3033 72.1721 -1.50361 103.591 4.7179C135.32 10.6283 158.962 20.2717 168.917 36.7587Z`,aspectRatio:{width:176,height:200},width:e,height:t}),blob18:({width:e,height:t})=>Y({path:`M178.188 21.1464C193.012 36.3069 196.381 62.9219 198.739 88.1893C200.76 113.12 201.771 136.366 190.316 149.168C178.862 162.307 155.279 164.665 135.065 167.697C115.188 170.73 99.0168 174.098 72.4018 177.131C46.1237 180.163 9.40176 182.521 1.65309 168.371C-6.09559 154.221 15.4659 123.564 23.5515 92.9059C31.6371 62.2481 26.2467 31.2534 38.3751 15.4192C50.1665 -0.0781831 79.8136 -1.08888 107.776 0.595609C136.076 1.9432 163.028 5.64909 178.188 21.1464Z`,aspectRatio:{width:200,height:180},width:e,height:t}),blob19:({width:e,height:t})=>Y({path:`M148.621 13.3857C171.945 24.3818 194.937 41.3756 192.938 60.702C190.605 80.3615 163.282 101.687 149.953 123.346C136.958 145.005 137.958 166.664 128.295 174.661C118.631 182.325 98.3054 175.994 73.6476 181.991C48.9899 187.989 20.0004 205.983 11.0036 197.986C1.67366 189.989 12.6697 156.001 12.3365 131.343C12.0033 106.685 0.340809 91.0243 0.00759636 75.0301C-0.325616 59.0359 10.3372 42.3753 25.3318 28.7135C39.9931 15.0518 58.9863 4.05578 80.3119 1.05687C101.638 -2.27526 124.962 2.38972 148.621 13.3857Z`,aspectRatio:{width:194,height:200},width:e,height:t}),blob2:({width:e,height:t})=>Y({path:`M140.464 18.6393C156.081 28.3718 169.887 39.9149 178.714 54.853C187.541 69.5649 191.389 87.6717 189.578 104.421C187.768 121.396 180.525 137.239 172.377 153.535C164.455 169.832 155.854 186.58 142.048 194.276C128.241 201.971 109.456 200.613 92.4804 197.671C75.2789 194.502 60.1144 189.749 45.1762 182.733C30.4644 175.716 16.2052 166.21 8.28346 153.083C0.361703 139.729 -1.44898 122.527 1.04072 106.91C3.30408 91.2931 9.64147 76.8076 15.9789 60.5114C22.0899 44.2153 28.201 26.1084 40.6495 14.7916C53.0979 3.24849 71.8838 -1.27823 89.7643 0.306124C107.871 1.66414 124.846 9.13322 140.464 18.6393Z`,aspectRatio:{width:191,height:200},width:e,height:t}),blob20:({width:e,height:t})=>Y({path:`M150.035 13.2464C157.376 24.9386 153.026 48.323 157.92 65.7254C163.087 83.1277 177.498 94.2761 182.392 108.415C187.287 122.555 182.392 139.957 173.147 156.272C163.63 172.587 149.763 187.814 132.089 195.155C114.414 202.225 93.2053 201.137 73.6276 194.611C54.3219 188.357 36.9196 176.937 25.7712 161.438C14.8947 145.667 10.5441 126.09 5.92163 105.696C1.57105 85.0311 -3.05145 63.5501 2.65869 45.0601C8.64075 26.5701 24.6835 11.0711 43.1735 4.54524C61.6635 -1.98064 82.6007 0.194657 102.722 1.01039C122.844 1.82613 142.421 1.55421 150.035 13.2464Z`,aspectRatio:{width:185,height:200},width:e,height:t}),blob21:({width:e,height:t})=>Y({path:`M152.611 0.184799C172.596 -0.723643 197.73 1.39606 199.85 13.8114C201.969 26.2268 181.075 48.9379 174.716 68.0151C168.357 87.0924 176.533 102.536 174.11 114.649C171.991 127.064 159.575 136.148 146.252 139.782C132.928 143.719 118.696 141.902 105.977 139.176C93.562 136.451 82.6606 132.212 63.2805 131.909C43.9004 131.606 16.0416 135.24 5.44306 125.853C-5.15543 116.465 1.50648 94.0572 10.2881 76.4939C18.7669 59.2335 29.6682 46.8182 38.7526 35.3112C48.1398 23.5015 56.3158 12.903 66.9143 8.36078C77.5128 4.12138 91.1394 6.24108 104.766 5.63546C118.696 4.72701 132.928 1.09324 152.611 0.184799Z`,aspectRatio:{width:200,height:143},width:e,height:t}),blob22:({width:e,height:t})=>Y({path:`M195.507 15.5715C206.818 33.1668 193.622 69.3001 190.166 101.663C186.71 134.34 193.308 163.561 181.996 178.014C170.685 192.153 141.464 191.525 114.443 189.326C87.1072 187.44 62.2852 183.67 40.6052 169.531C19.2395 155.077 1.6441 130.255 0.0730908 103.862C-1.18372 77.4694 13.898 49.5054 35.2638 31.91C56.6296 14.0004 84.5936 6.45958 116.328 2.37494C148.063 -1.70969 184.196 -2.3381 195.507 15.5715Z`,aspectRatio:{width:200,height:191},width:e,height:t}),blob23:({width:e,height:t})=>Y({path:`M135.742 9.14189C157.815 19.2326 179.258 38.4681 176.105 56.7576C172.951 74.7317 145.202 92.0751 127.858 109.734C110.83 127.077 104.523 145.052 87.4953 164.918C70.4672 184.468 42.7177 206.227 27.5816 198.343C12.4455 190.46 9.60747 153.566 6.45411 126.762C2.98542 100.274 -0.798607 84.1917 0.147399 67.1636C0.77807 50.4508 6.76944 32.4767 19.0675 20.8093C31.0503 9.14189 49.6551 3.78119 70.4672 1.2585C90.964 -1.26418 113.668 -0.633508 135.742 9.14189Z`,aspectRatio:{width:177,height:200},width:e,height:t}),blob24:({width:e,height:t})=>Y({path:`M165.663 24.3715C171.555 44.4059 158.003 76.2254 151.816 96.2598C145.923 116.294 147.691 124.544 148.28 135.445C148.575 146.346 147.396 159.309 140.62 170.8C133.549 181.996 120.88 191.424 104.381 196.432C87.8821 201.441 67.553 202.03 54.8841 192.602C41.9207 183.469 36.6174 164.023 25.1271 143.105C13.3421 122.187 -4.33535 99.7953 0.967891 85.0641C6.27113 70.6275 34.2604 63.8511 56.0626 48.5307C77.5702 33.5048 92.8907 9.93489 113.22 2.56928C133.843 -4.79633 159.77 4.04241 165.663 24.3715Z`,aspectRatio:{width:168,height:200},width:e,height:t}),blob25:({width:e,height:t})=>Y({path:`M180.115 1.256C192.651 2.1962 189.83 34.163 190.771 58.2947C191.711 82.4265 196.098 98.4099 198.606 117.214C201.113 136.018 201.426 157.642 189.204 165.791C177.294 173.626 153.163 167.671 135.299 163.91C117.749 159.836 106.466 157.956 85.7818 162.97C65.0974 168.298 35.3244 180.521 18.7143 174.253C1.79068 167.985 -1.97012 142.913 0.850478 120.975C3.67107 99.0367 13.0731 79.6059 18.4009 54.8473C23.7287 30.0888 24.9823 -0.310996 40.0254 0.00240332C54.7552 0.00240332 82.9612 31.029 111.167 31.029C139.373 31.029 167.579 0.315802 180.115 1.256Z`,aspectRatio:{width:200,height:176},width:e,height:t}),blob26:({width:e,height:t})=>Y({path:`M142.571 0.586925C159.976 3.39414 176.258 15.1844 184.96 30.9048C193.662 46.6253 194.224 66.8372 189.171 83.6805C183.837 100.805 172.327 114.56 163.064 129.157C153.8 143.755 146.501 158.914 134.43 173.231C122.359 187.828 105.516 201.303 89.5146 199.899C73.2327 198.776 58.0738 182.775 42.9148 169.862C28.0366 157.23 13.7198 147.685 6.42103 134.491C-0.877729 121.297 -1.15845 103.892 1.64876 88.4528C4.45598 72.7324 10.0704 58.6963 18.4921 47.4674C27.1944 36.2386 38.4233 27.8169 50.4943 22.2025C62.846 16.3073 75.7592 13.5001 91.1989 8.72785C106.919 4.23631 125.166 -1.93957 142.571 0.586925Z`,aspectRatio:{width:193,height:200},width:e,height:t}),blob27:({width:e,height:t})=>Y({path:`M112.602 54.9337C129.225 71.8646 155.391 78.9448 158.777 89.719C162.471 100.493 143.693 114.654 127.07 135.586C110.447 156.519 96.2866 184.224 71.0442 194.998C46.1096 205.465 10.4008 199.308 2.0893 178.375C-6.22223 157.443 12.5557 121.734 18.4045 92.1817C24.5612 62.6296 17.7889 38.9263 26.4082 21.9954C34.7197 5.06454 58.423 -5.40183 73.5069 2.9097C88.8986 10.9134 95.9788 38.0028 112.602 54.9337Z`,aspectRatio:{width:160,height:200},width:e,height:t}),blob28:({width:e,height:t})=>Y({path:`M125.281 68.5835C142.15 82.9923 165.344 90.021 181.862 108.998C198.028 127.624 207.516 158.902 192.405 166.634C177.293 174.716 137.581 159.605 112.629 156.442C87.326 152.928 77.1344 161.713 59.9142 165.579C43.0453 169.445 19.1478 168.391 11.7677 157.496C4.73907 146.25 14.2278 124.813 11.4163 94.2382C8.2534 63.6634 -6.85825 23.9514 3.68476 8.48836C14.2278 -7.32615 50.4254 1.10826 73.9715 16.2199C97.5175 31.683 108.412 54.1747 125.281 68.5835Z`,aspectRatio:{width:200,height:169},width:e,height:t}),blob29:({width:e,height:t})=>Y({path:`M162.987 10.2348C169.16 25.1809 154.864 58.6471 147.066 79.4417C139.268 100.236 138.293 108.359 134.719 114.532C131.47 120.706 125.297 124.93 119.448 143.45C113.6 161.97 107.426 194.461 98.004 199.335C88.5814 204.209 75.5849 181.14 55.7651 167.494C35.6203 153.522 8.65241 148.648 1.8292 135.327C-4.994 122.33 8.65241 100.561 20.0244 82.041C31.3964 63.5208 40.1691 48.2498 53.4906 35.5782C66.8122 22.9065 84.0326 13.159 106.452 6.33584C128.871 -0.812285 156.489 -4.71127 162.987 10.2348Z`,aspectRatio:{width:165,height:200},width:e,height:t}),blob3:({width:e,height:t})=>Y({path:`M158.095 64.2637C176.543 95.19 192.277 129.1 181.697 155.686C171.117 182.001 133.951 201.533 99.4982 199.905C64.7739 198.549 33.0338 176.032 15.4004 145.377C-2.23296 114.994 -5.75963 76.2002 10.2461 46.6303C26.2518 17.0605 61.5185 -3.557 89.732 0.512241C118.217 4.58149 139.377 33.0662 158.095 64.2637Z`,aspectRatio:{width:186,height:200},width:e,height:t}),blob30:({width:e,height:t})=>Y({path:`M146.076 34.4585C157.052 54.582 155.833 80.1936 164.675 100.622C173.212 121.355 191.201 136.905 189.372 149.711C187.542 162.212 165.285 171.969 146.99 175.018C129.001 178.372 114.671 174.713 103.39 175.018C92.1083 175.018 83.876 178.982 66.8015 186.299C49.7271 193.617 23.8105 204.288 14.3586 198.19C4.90665 191.787 11.6145 168.615 10.3949 147.882C8.87037 127.148 -0.581561 108.549 0.0282404 89.3407C0.638042 70.1319 11.6145 50.6182 28.384 32.934C44.8487 15.5546 67.4113 0.309578 89.974 0.00467694C112.537 -0.300224 135.099 14.335 146.076 34.4585Z`,aspectRatio:{width:190,height:200},width:e,height:t}),blob31:({width:e,height:t})=>Y({path:`M134.218 44.0392C153.568 36.4264 184.97 26.9105 195.755 33.2544C206.222 39.9156 195.755 62.1194 181.481 76.3933C166.89 90.35 148.175 96.0596 145.638 116.36C143.1 136.661 156.74 171.235 151.664 183.923C146.589 196.928 123.434 187.413 105.036 178.531C86.6388 169.967 73.3165 161.72 52.0643 158.548C30.812 155.058 1.62986 156.644 0.0438693 145.225C-1.22492 133.806 25.4197 109.382 29.2261 86.8609C32.7152 64.3398 13.6834 44.0392 11.7802 26.9105C9.877 9.46461 24.7853 -4.80928 42.5484 1.53467C59.9942 7.87863 79.9777 34.5232 93.6172 45.308C107.257 56.4099 114.869 51.3347 134.218 44.0392Z`,aspectRatio:{width:200,height:191},width:e,height:t}),blob32:({width:e,height:t})=>Y({path:`M200 100.339C200 149.831 145.763 197.966 95.5932 197.966C45.7627 197.966 0 149.831 0 100.339C0 50.8475 45.7627 0 95.5932 0C145.763 0 200 50.8475 200 100.339Z`,aspectRatio:{width:200,height:198},width:e,height:t}),blob4:({width:e,height:t})=>Y({path:`M183.427 38.712C198.21 63.2519 196.141 95.1833 189.341 126.523C182.836 157.863 171.305 188.908 150.609 197.482C130.208 205.76 100.642 192.16 69.8936 177.968C39.4405 164.072 7.80478 150.176 1.30024 128.593C-5.2043 107.01 13.718 77.7393 35.3012 51.7211C56.5888 25.9986 81.1287 3.23272 108.921 0.276112C137.009 -2.38484 168.349 14.4678 183.427 38.712Z`,aspectRatio:{width:195,height:200},width:e,height:t}),blob5:({width:e,height:t})=>Y({path:`M166.251 30.6913C183.816 48.5185 195.875 71.8512 199.021 98.8542C202.429 125.595 197.186 155.744 179.359 169.115C161.794 182.223 131.645 178.815 103.331 176.979C75.0171 175.144 48.8006 174.882 29.6625 161.512C10.7866 148.141 -0.748681 121.925 0.0378149 96.2326C0.824311 70.8025 14.1947 46.159 33.0706 28.3318C52.2087 10.5045 76.8522 -0.5064 100.971 0.0179307C125.091 0.804426 148.423 12.864 166.251 30.6913Z`,aspectRatio:{width:200,height:179},width:e,height:t}),blob6:({width:e,height:t})=>Y({path:`M149.146 50.5452C161.911 68.0278 171.901 81.9028 176.619 97.9979C181.336 114.37 180.781 133.241 173.011 149.891C165.519 166.541 151.366 180.693 133.051 189.851C114.736 199.008 92.2586 202.893 71.446 197.621C50.6334 192.348 30.9308 177.918 18.1658 158.216C5.12323 138.791 -0.981801 113.815 0.128204 87.7304C1.51571 61.6453 10.6733 34.1726 29.2658 17.5226C48.1359 1.14999 76.996 -4.40004 98.9186 3.6475C120.841 11.695 136.381 32.7851 149.146 50.5452Z`,aspectRatio:{width:180,height:200},width:e,height:t}),blob7:({width:e,height:t})=>Y({path:`M158.662 41.8295C178.593 57.8305 204.138 64.5677 213.402 79.7266C222.666 94.6047 215.367 118.466 203.015 135.028C190.383 151.871 172.698 161.977 156.416 168.434C140.134 174.89 124.975 177.697 104.483 185.277C83.9903 192.856 58.1642 205.208 44.9704 197.629C31.4959 190.33 31.2152 163.1 21.9514 138.116C12.9684 112.851 -4.71688 90.1132 1.17822 75.5158C7.35404 61.1991 36.8295 55.5847 58.7256 40.1452C80.9024 24.7056 95.4998 -0.278374 109.816 0.00234533C124.414 0.283064 138.45 25.8285 158.662 41.8295Z`,aspectRatio:{width:218,height:200},width:e,height:t}),blob8:({width:e,height:t})=>Y({path:`M153.53 11.0108C168.179 18.1858 181.931 29.5461 192.993 44.4939C203.755 59.4417 212.425 78.2759 210.631 96.5122C209.136 114.748 197.477 132.088 182.529 142.252C167.581 152.716 148.747 156.004 128.717 168.262C108.687 180.22 87.1622 201.147 69.8228 199.951C52.7823 198.456 39.6283 174.54 32.4533 153.015C25.2784 131.49 24.0826 112.357 16.6087 91.131C9.13477 70.2041 -4.31825 46.8855 1.36191 31.9377C7.04207 16.691 31.8554 9.51607 52.7823 5.33069C73.4103 0.846349 90.4507 -0.648433 106.594 0.248435C123.037 1.1453 138.882 4.13486 153.53 11.0108Z`,aspectRatio:{width:211,height:200},width:e,height:t}),blob9:({width:e,height:t})=>Y({path:`M140.289 20.2182C156.96 27.7956 176.661 32.0895 189.29 43.9608C201.667 55.5796 206.718 75.0283 202.424 91.6987C198.131 108.622 184.491 122.766 175.651 140.952C166.81 158.885 162.769 180.607 150.393 191.216C138.016 201.824 117.052 201.572 98.866 197.025C80.6802 192.479 65.2727 183.891 48.3497 175.808C31.4268 167.726 13.2409 160.148 5.1583 146.761C-2.67172 133.122 -0.398493 113.673 4.14797 96.7504C8.69444 80.08 15.5141 65.6828 23.3442 52.296C31.4268 38.6566 40.5197 25.775 52.6436 15.6717C65.0201 5.82101 80.6802 -1.50385 95.3299 0.264221C109.98 1.77971 123.619 12.6407 140.289 20.2182Z`,aspectRatio:{width:204,height:200},width:e,height:t})};function Qw(e){return Zw[e]||zw}function $w(e,t){let{width:n,height:r,fill:i,stroke:a,strokeWidth:o,dash:s}=e,c=(s||[]).map(e=>e*o),l=t(e),u=`clip-${e.id||Math.random()}`;return`
117
+ <svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${r}">
118
+ <defs>
119
+ <clipPath id="${u}">
120
+ <path d="${l}" />
121
+ </clipPath>
122
+ </defs>
123
+
124
+ <!-- Path for the fill -->
125
+ <path d="${l}" fill="${i}"/>
126
+
127
+ <!-- Path for the stroke, clipped by the star path -->
128
+ <path d="${l}" fill="none" stroke="${a}" stroke-width="${o*2}" clip-path="url(#${u})" stroke-dasharray="${c.join(` `)}"/>
129
+ </svg>
130
+ `}function eT(e){let{subType:t}=e,n=e,r=Qw(t);return r?$w(n,r):(console.error(`Polotno error: Can not convert ${e.subType} figure to svg.`),zw(n))}function tT(e,t,n,r){let i=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return e.replace(RegExp(`${t}="${i}"`,`g`),`${t}="url(#${r})"`)}var nT=null;function rT(e){let t=typeof document<`u`,n=typeof OffscreenCanvas<`u`;if(t&&(e||!n))return document.createElement(`canvas`).getContext(`2d`);if(n)return new OffscreenCanvas(1,1).getContext(`2d`);throw Error(`render-tag: no canvas available for text measurement. In a non-browser environment, pass config.ctx (a 2D context).`)}function iT(){if(typeof DOMParser<`u`)return nT||=new DOMParser,nT;throw Error(`render-tag: no DOM parser available. In a non-browser environment, inject one via setDOMParser(new DOMParser()) using a DOM library such as linkedom or jsdom.`)}function aT(e){let t=iT().parseFromString(`<!DOCTYPE html><html><head></head><body>${e}</body></html>`,`text/html`),n=t.querySelectorAll(`style`),r=``;for(let e of n)r+=e.textContent+`
131
+ `,e.remove();t.body.normalize();let i=t.createDocumentFragment();for(;t.body.firstChild;)i.appendChild(t.body.firstChild);return{fragment:i,css:r}}var oT=1,sT=3;function cT(e){let t=[];e=e.replace(/\/\*[\s\S]*?\*\//g,``);let n=0;for(;n<e.length;){for(;n<e.length&&/\s/.test(e[n]);)n++;if(n>=e.length)break;if(e[n]===`@`){let t=0;for(;n<e.length;){if(e[n]===`{`&&t++,e[n]===`}`&&(t--,t<=0)){n++;break}n++}continue}let r=n;for(;n<e.length&&e[n]!==`{`;)n++;if(n>=e.length)break;let i=e.slice(r,n).trim();n++;let a=n;for(;n<e.length&&e[n]!==`}`;)n++;let o=e.slice(a,n).trim();if(n++,!i)continue;let s=i.split(`,`).map(e=>e.trim()).filter(Boolean),c=[];for(let e of o.split(`;`)){let t=e.indexOf(`:`);if(t===-1)continue;let n=e.slice(0,t).trim().toLowerCase(),r=e.slice(t+1).trim();n&&r&&c.push({property:n,value:r})}s.length>0&&c.length>0&&t.push({selectors:s,declarations:c})}return t}function lT(e){let t=e.replace(/::[\w-]+/g,``).split(/\s*>\s*|\s+/),n=0,r=0,i=0;for(let e of t){let t=e.match(/#[\w-]+/g);t&&(n+=t.length);let a=e.match(/\.[\w-]+/g);a&&(r+=a.length);let o=e.replace(/[#.][\w-]+/g,``).replace(/:[\w-]+/g,``).trim();o&&o!==`*`&&i++}return[n,r,i]}function uT(e){let t=e.match(/\.[\w-]+/g)||[],n=e.replace(/\.[\w-]+/g,``).replace(/:[\w-]+/g,``).trim();return{tag:n&&n!==`*`?n:``,classes:t.map(e=>e.slice(1))}}function dT(e,t){if(e.tag&&e.tag!==t.tagName)return!1;for(let n of e.classes)if(!t.classes.has(n))return!1;return!0}function fT(e){let t;if(e.includes(`::`)){if(e.replace(/::marker\b/g,``).includes(`::`))return null;if(/::marker\b/.test(e))t=`marker`,e=e.replace(/(^|[\s>])::marker\b/g,`$1*`),e=e.replace(/::marker\b/g,``);else return null}if(/:(?:nth-|hover|focus|active|visited|first-child|last-child)/.test(e))return null;let n=[],r=[],i=e.trim().split(/\s+/);for(let e=0;e<i.length;e++)i[e]===`>`?r.push(`>`):(n.length>r.length+1&&r.push(` `),n.push(i[e]));for(;r.length<n.length-1;)r.push(` `);if(n.length===0)return null;let a=n.map(uT),o=a[a.length-1],s=o.tag;return{parts:a,combinators:r,rightmost:o,rightmostIsRoot:s===`html`||s===`body`,spec:lT(e),pseudoElement:t}}function pT(e,t){if(e.rightmostIsRoot){if(t.parent!==null)return!1}else if(!dT(e.rightmost,t))return!1;if(e.parts.length===1)return!0;let n=t.parent;for(let t=e.parts.length-2;t>=0;t--){if(!n)return!1;let r=e.parts[t];if(e.combinators[t]===`>`){if(n.parent===null&&(r.tag===`html`||r.tag===`body`))n=n.parent;else if(dT(r,n))n=n.parent;else return!1}else{let e=!1;for(;n;){if(n.parent===null&&(r.tag===`html`||r.tag===`body`)){n=n.parent,e=!0;break}if(dT(r,n)){n=n.parent,e=!0;break}n=n.parent}if(!e)return!1}}return!0}function mT(){return{fontFamily:`serif`,fontSize:16,fontWeight:400,fontStyle:`normal`,fontVariantCaps:`normal`,color:`rgb(0, 0, 0)`,textAlign:`start`,textAlignLast:`auto`,textIndent:0,textTransform:`none`,textDecorationLine:`none`,textDecorationStyle:`solid`,textDecorationColor:`rgb(0, 0, 0)`,textDecorations:[],textUnderlineOffset:null,textDecorationThickness:null,textShadow:`none`,webkitTextStrokeWidth:0,webkitTextStrokeColor:``,webkitTextStrokeImage:`none`,webkitTextFillColor:``,paintOrder:`normal`,strokeLinejoin:`round`,webkitBackgroundClip:``,backgroundImage:`none`,letterSpacing:0,wordSpacing:0,fontKerning:`auto`,lineHeight:0,verticalAlign:`baseline`,whiteSpace:`normal`,wordBreak:`normal`,overflowWrap:`normal`,unicodeBidi:`normal`,direction:`ltr`,display:`block`,width:0,minWidth:null,minHeight:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,backgroundColor:`rgba(0, 0, 0, 0)`,borderTopWidth:0,borderTopColor:`rgb(0, 0, 0)`,borderTopStyle:`none`,borderRightWidth:0,borderRightColor:`rgb(0, 0, 0)`,borderRightStyle:`none`,borderBottomWidth:0,borderBottomColor:`rgb(0, 0, 0)`,borderBottomStyle:`none`,borderLeftWidth:0,borderLeftColor:`rgb(0, 0, 0)`,borderLeftStyle:`none`,borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomRightRadius:0,borderBottomLeftRadius:0,flexDirection:`row`,gap:0,flexGrow:0,flexShrink:1,flexBasis:null,listStyleType:`disc`,lineClamp:0}}var hT={span:{display:`inline`},a:{display:`inline`},strong:{display:`inline`,fontWeight:700},b:{display:`inline`,fontWeight:700},em:{display:`inline`,fontStyle:`italic`},i:{display:`inline`,fontStyle:`italic`},u:{display:`inline`,textDecorationLine:`underline`},s:{display:`inline`,textDecorationLine:`line-through`},strike:{display:`inline`,textDecorationLine:`line-through`},del:{display:`inline`,textDecorationLine:`line-through`},sub:{display:`inline`,verticalAlign:`sub`,fontSize:.83},sup:{display:`inline`,verticalAlign:`super`,fontSize:.83},code:{display:`inline`,fontFamily:`monospace`},cite:{display:`inline`,fontStyle:`italic`},bdo:{display:`inline`,unicodeBidi:`bidi-override`},bdi:{display:`inline`,unicodeBidi:`isolate`},p:{display:`block`,marginTop:-1,marginBottom:-1},div:{display:`block`},h1:{display:`block`,fontSize:2,fontWeight:700,marginTop:-.67,marginBottom:-.67},h2:{display:`block`,fontSize:1.5,fontWeight:700,marginTop:-.83,marginBottom:-.83},h3:{display:`block`,fontSize:1.17,fontWeight:700,marginTop:-1,marginBottom:-1},h4:{display:`block`,fontSize:1,fontWeight:700,marginTop:-1.33,marginBottom:-1.33},h5:{display:`block`,fontSize:.83,fontWeight:700,marginTop:-1.67,marginBottom:-1.67},h6:{display:`block`,fontSize:.67,fontWeight:700,marginTop:-2.33,marginBottom:-2.33},ul:{display:`block`,listStyleType:`disc`,marginTop:-1,marginBottom:-1},ol:{display:`block`,listStyleType:`decimal`,marginTop:-1,marginBottom:-1},li:{display:`list-item`},blockquote:{display:`block`,marginTop:-1,marginBottom:-1,marginLeft:40,marginRight:40},pre:{display:`block`,whiteSpace:`pre`,fontFamily:`monospace`,marginTop:-1,marginBottom:-1},table:{display:`table`},tr:{display:`table-row`},td:{display:`table-cell`},th:{display:`table-cell`,fontWeight:700},br:{display:`inline`},hr:{display:`block`,borderTopWidth:1,borderTopStyle:`solid`,borderTopColor:`gray`,marginTop:-.5,marginBottom:-.5}};function gT(e,t,n){if(!e||e===`normal`||e===`auto`||e===`none`)return 0;let r=e.trim();if(r.endsWith(`em`)){let e=parseFloat(r);return isNaN(e)?0:e*t}if(r.endsWith(`%`)){let e=parseFloat(r);return isNaN(e)?0:e/100*n}if(r.endsWith(`px`)){let e=parseFloat(r);return isNaN(e)?0:e}let i=parseFloat(r);return isNaN(i)?0:i}function _T(e){if(e===`bold`)return 700;if(e===`normal`)return 400;let t=parseInt(e,10);return isNaN(t)?400:t}function vT(e){let t=e.trim().toLowerCase();if(!t||t===`normal`)return!1;let n=t.split(/\s+/).filter(e=>e===`fill`||e===`stroke`),r=n.indexOf(`stroke`),i=n.indexOf(`fill`);return r===-1?!1:i===-1||r<i}function yT(e,t,n){return[{property:`flex-grow`,value:e},{property:`flex-shrink`,value:t},{property:`flex-basis`,value:n}]}function bT(e){let t=[],n=0,r=``;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?(n++,r+=a):a===`)`?(n=Math.max(0,n-1),r+=a):n===0&&/\s/.test(a)?r&&=(t.push(r),``):r+=a}return r&&t.push(r),t}function xT(e,t){if(e===`margin`||e===`padding`){let n=t.trim().split(/\s+/),r,i,a,o;return n.length===1?r=i=a=o=n[0]:n.length===2?(r=a=n[0],i=o=n[1]):n.length===3?(r=n[0],i=o=n[1],a=n[2]):(r=n[0],i=n[1],a=n[2],o=n[3]),[{property:`${e}-top`,value:r},{property:`${e}-right`,value:i},{property:`${e}-bottom`,value:a},{property:`${e}-left`,value:o}]}if(e===`border`||e===`border-top`||e===`border-right`||e===`border-bottom`||e===`border-left`){let n=bT(t.trim()),r=[`solid`,`dashed`,`dotted`,`double`,`none`,`hidden`],i=n.find(e=>e.endsWith(`px`)||/^\d/.test(e))||`0`,a=n.find(e=>r.includes(e))||`none`,o=n.find(e=>!e.endsWith(`px`)&&!/^\d/.test(e)&&!r.includes(e))||`currentColor`,s=[],c=e===`border`?[`top`,`right`,`bottom`,`left`]:[e.replace(`border-`,``)];for(let e of c)s.push({property:`border-${e}-width`,value:i}),s.push({property:`border-${e}-style`,value:a}),s.push({property:`border-${e}-color`,value:o});return s}if(e===`border-radius`){let[e,n=e,r=e,i=n]=t.split(`/`)[0].trim().split(/\s+/);return[{property:`border-top-left-radius`,value:e},{property:`border-top-right-radius`,value:n},{property:`border-bottom-right-radius`,value:r},{property:`border-bottom-left-radius`,value:i}]}if(e===`list-style`)return t===`none`?[{property:`list-style-type`,value:`none`}]:[{property:`list-style-type`,value:t}];if(e===`text-decoration`){let e=t.trim();if(e===`inherit`||e===`none`)return[{property:`text-decoration-line`,value:`none`},{property:`text-decoration-thickness`,value:`auto`}];let n=``,r=e.replace(/\b(rgba?\([^)]*\)|hsla?\([^)]*\))/i,e=>(n=e,``)).split(/\s+/).filter(Boolean),i=[`underline`,`overline`,`line-through`],a=[`solid`,`double`,`dotted`,`dashed`,`wavy`],o=[{property:`text-decoration-thickness`,value:`auto`}],s=[];for(let e of r)i.includes(e)?s.push(e):a.includes(e)?o.push({property:`text-decoration-style`,value:e}):/^[\d.+-]/.test(e)||e===`auto`||e===`from-font`?o.push({property:`text-decoration-thickness`,value:e}):o.push({property:`text-decoration-color`,value:e});return n&&o.push({property:`text-decoration-color`,value:n}),s.length>0&&o.unshift({property:`text-decoration-line`,value:s.join(` `)}),o}if(e===`-webkit-text-stroke`){let e=bT(t.trim()),n=e.find(e=>e.endsWith(`px`)||/^\d/.test(e))||`0`,r=e.find(e=>!e.endsWith(`px`)&&!/^\d/.test(e))||`currentColor`;return[{property:`-webkit-text-stroke-width`,value:n},{property:`-webkit-text-stroke-color`,value:r}]}if(e===`flex`){let e=t.trim().toLowerCase();if(e===`none`)return yT(`0`,`0`,`auto`);if(e===`auto`)return yT(`1`,`1`,`auto`);if(e===`initial`)return yT(`0`,`1`,`auto`);let n=[],r=``;for(let e of t.trim().split(/\s+/))!r&&n.length<2&&/^\d*\.?\d+$/.test(e)?n.push(e):r=e;return n.length===0&&!r?[]:yT(n[0]??`1`,n[1]??`1`,r||(n.length>0?`0`:`auto`))}return e===`border-collapse`||e===`border-spacing`?[]:[{property:e,value:t}]}function ST(e,t){let n=e.trim();if(n.endsWith(`%`)){let e=parseFloat(n);return e>0?{pct:e}:0}return Math.max(0,gT(n,t,0))}function CT(e){let t=e.trim();return t.toLowerCase()===`currentcolor`?``:t}function wT(e,t,n,r,i,a){let o=e.fontSize||r;switch(t){case`font-family`:e.fontFamily=n.trim();break;case`font-size`:{let t=n.trim();e.fontSize=t.endsWith(`em`)?parseFloat(t)*r:t.endsWith(`%`)?parseFloat(t)/100*r:parseFloat(t)||r;break}case`font-weight`:e.fontWeight=_T(n);break;case`font-style`:e.fontStyle=n.trim();break;case`font-variant`:case`font-variant-caps`:e.fontVariantCaps=/\bsmall-caps\b/.test(n)?`small-caps`:`normal`;break;case`color`:e.color=n.trim();break;case`text-align`:e.textAlign=n.trim();break;case`text-align-last`:e.textAlignLast=n.trim();break;case`text-indent`:e.textIndent=gT(n,o,i);break;case`text-transform`:e.textTransform=n.trim();break;case`text-decoration-line`:e.textDecorationLine=n.trim();break;case`text-decoration`:break;case`text-decoration-style`:e.textDecorationStyle=n.trim();break;case`text-decoration-color`:e.textDecorationColor=n.trim();break;case`text-underline-offset`:{let t=n.trim();if(t===`auto`)e._underlineOffsetPct=void 0,e.textUnderlineOffset=null;else if(!isNaN(parseFloat(t))){if(t.endsWith(`%`)){let n=parseFloat(t);e.textUnderlineOffset=n/100*o,e._underlineOffsetPct=n}else e._underlineOffsetPct=void 0,e.textUnderlineOffset=gT(t,o,i)}break}case`text-decoration-thickness`:{let t=n.trim();t===`auto`||t===`from-font`?e.textDecorationThickness=null:isNaN(parseFloat(t))||(e.textDecorationThickness=t.endsWith(`%`)?parseFloat(t)/100*o:gT(t,o,i));break}case`text-shadow`:e.textShadow=n.trim();break;case`-webkit-text-stroke-width`:e.webkitTextStrokeWidth=gT(n,o,i);break;case`-webkit-text-stroke-color`:e.webkitTextStrokeColor=CT(n);break;case`--rt-text-stroke-image`:e.webkitTextStrokeImage=n.trim();break;case`-webkit-text-fill-color`:e.webkitTextFillColor=CT(n);break;case`paint-order`:e.paintOrder=n.trim();break;case`stroke-linejoin`:e.strokeLinejoin=n.trim();break;case`-webkit-background-clip`:case`background-clip`:e.webkitBackgroundClip=n.trim();break;case`background-image`:e.backgroundImage=n.trim();break;case`letter-spacing`:e.letterSpacing=n.trim()===`normal`?0:gT(n,o,i);break;case`word-spacing`:e.wordSpacing=n.trim()===`normal`?0:gT(n,o,i);break;case`font-kerning`:e.fontKerning=n.trim();break;case`line-height`:{let t=n.trim();if(t===`normal`)e.lineHeight=0;else if(t.endsWith(`px`))e.lineHeight=parseFloat(t)||0;else if(t.endsWith(`em`))e.lineHeight=parseFloat(t)*o;else if(t.endsWith(`%`)){let n=parseFloat(t);isNaN(n)||(e.lineHeight=n/100*o)}else{let n=parseFloat(t);isNaN(n)||(e.lineHeight=n*o,e._lineHeightMultiplier=n)}break}case`-webkit-line-clamp`:case`line-clamp`:{let t=n.trim().toLowerCase();if(t===`none`||t===`auto`)e.lineClamp=0;else{let n=parseInt(t,10);e.lineClamp=Number.isFinite(n)&&n>0?n:0}break}case`vertical-align`:e.verticalAlign=n.trim();break;case`white-space`:e.whiteSpace=n.trim();break;case`word-break`:e.wordBreak=n.trim();break;case`overflow-wrap`:case`word-wrap`:e.overflowWrap=n.trim();break;case`direction`:e.direction=n.trim();break;case`unicode-bidi`:e.unicodeBidi=n.trim();break;case`display`:e.display=n.trim();break;case`width`:{let t=n.trim();t===`100%`?e.width=i:t!==`auto`&&(e.width=gT(t,o,i));break}case`min-width`:{let t=n.trim();e.minWidth=t===`auto`?null:gT(t,o,i);break}case`min-height`:e.minHeight=gT(n,o,i);break;case`padding-top`:e.paddingTop=gT(n,o,i);break;case`padding-right`:e.paddingRight=gT(n,o,i);break;case`padding-bottom`:e.paddingBottom=gT(n,o,i);break;case`padding-left`:e.paddingLeft=gT(n,o,i);break;case`margin-top`:e.marginTop=gT(n,o,i);break;case`margin-right`:e.marginRight=gT(n,o,i);break;case`margin-bottom`:e.marginBottom=gT(n,o,i);break;case`margin-left`:e.marginLeft=gT(n,o,i);break;case`background-color`:e.backgroundColor=n.trim();break;case`background`:{let t=n.trim();t.includes(`gradient(`)?e.backgroundImage=t:(t.startsWith(`#`)||t.startsWith(`rgb`)||t.startsWith(`hsl`)||[`transparent`,`none`,`inherit`].includes(t)||/^[a-z]+$/.test(t))&&(e.backgroundColor=t);break}case`padding-inline-start`:a===`rtl`?e.paddingRight=gT(n,o,i):e.paddingLeft=gT(n,o,i);break;case`padding-inline-end`:a===`rtl`?e.paddingLeft=gT(n,o,i):e.paddingRight=gT(n,o,i);break;case`margin-inline-start`:a===`rtl`?e.marginRight=gT(n,o,i):e.marginLeft=gT(n,o,i);break;case`margin-inline-end`:a===`rtl`?e.marginLeft=gT(n,o,i):e.marginRight=gT(n,o,i);break;case`border-top-width`:e.borderTopWidth=gT(n,o,i);break;case`border-top-color`:e.borderTopColor=n.trim();break;case`border-top-style`:e.borderTopStyle=n.trim();break;case`border-right-width`:e.borderRightWidth=gT(n,o,i);break;case`border-right-color`:e.borderRightColor=n.trim();break;case`border-right-style`:e.borderRightStyle=n.trim();break;case`border-bottom-width`:e.borderBottomWidth=gT(n,o,i);break;case`border-bottom-color`:e.borderBottomColor=n.trim();break;case`border-bottom-style`:e.borderBottomStyle=n.trim();break;case`border-left-width`:e.borderLeftWidth=gT(n,o,i);break;case`border-left-color`:e.borderLeftColor=n.trim();break;case`border-left-style`:e.borderLeftStyle=n.trim();break;case`border-top-left-radius`:e.borderTopLeftRadius=ST(n,o);break;case`border-top-right-radius`:e.borderTopRightRadius=ST(n,o);break;case`border-bottom-right-radius`:e.borderBottomRightRadius=ST(n,o);break;case`border-bottom-left-radius`:e.borderBottomLeftRadius=ST(n,o);break;case`flex-direction`:e.flexDirection=n.trim();break;case`gap`:e.gap=gT(n,o,i);break;case`flex-grow`:e.flexGrow=parseFloat(n)||0;break;case`flex-shrink`:{let t=parseFloat(n);e.flexShrink=Number.isFinite(t)&&t>=0?t:1;break}case`flex-basis`:{let t=n.trim();e.flexBasis=t===`auto`||t===`content`?null:gT(t,o,i);break}case`list-style-type`:e.listStyleType=n.trim()}}var TT=[[`font-family`,`fontFamily`],[`font-size`,`fontSize`],[`font-weight`,`fontWeight`],[`font-style`,`fontStyle`],[`color`,`color`],[`text-align`,`textAlign`],[`text-align-last`,`textAlignLast`],[`text-indent`,`textIndent`],[`text-transform`,`textTransform`],[`white-space`,`whiteSpace`],[`word-break`,`wordBreak`],[`overflow-wrap`,`overflowWrap`],[`direction`,`direction`],[`letter-spacing`,`letterSpacing`],[`word-spacing`,`wordSpacing`],[`line-height`,`lineHeight`],[`text-shadow`,`textShadow`],[`font-kerning`,`fontKerning`],[`list-style-type`,`listStyleType`],[`vertical-align`,`verticalAlign`],[`text-underline-offset`,`textUnderlineOffset`],[`paint-order`,`paintOrder`],[`stroke-linejoin`,`strokeLinejoin`],[`-webkit-text-stroke-width`,`webkitTextStrokeWidth`],[`-webkit-text-stroke-color`,`webkitTextStrokeColor`],[`-webkit-text-fill-color`,`webkitTextFillColor`]];function ET(e,t,n){for(let[r,i]of TT)if(e[i]===`inherit`)e[i]=t[i];else if(!n.has(r)){if(i===`lineHeight`){let n=t._lineHeightMultiplier;n===void 0?e.lineHeight=t.lineHeight:(e.lineHeight=n*e.fontSize,e._lineHeightMultiplier=n)}else if(i===`textUnderlineOffset`){let n=t._underlineOffsetPct;n===void 0?e.textUnderlineOffset=t.textUnderlineOffset:(e.textUnderlineOffset=n/100*e.fontSize,e._underlineOffsetPct=n)}else e[i]=t[i]}}function DT(e){let t=new Map,n=new Map,r=[],i=0;for(let a of e){let e=[];for(let t of a.declarations){let n=t.value.includes(`!important`),r=n?t.value.replace(/\s*!important\s*/g,``).trim():t.value,i=xT(t.property,r);for(let t of i)e.push({property:t.property,value:t.value,important:n})}for(let o of a.selectors){let a=fT(o);if(!a)continue;let s={selector:a,declarations:e,orderBase:i++},c=a.rightmost;if(c.tag&&!a.rightmostIsRoot){let e=t.get(c.tag);e?e.push(s):t.set(c.tag,[s])}if(c.classes.length>0){let e=c.classes[0],t=n.get(e);t?t.push(s):n.set(e,[s])}!c.tag&&c.classes.length===0&&r.push(s),a.rightmostIsRoot&&r.push(s)}}return{byTag:t,byClass:n,universal:r}}function OT(e,t){switch(t){case`disc`:return`•`;case`circle`:return`○`;case`square`:return`■`;case`none`:return``;case`decimal-leading-zero`:return`${e<10&&e>=0?`0`+e:e}.`;case`lower-roman`:return`${kT(e).toLowerCase()}.`;case`upper-roman`:return`${kT(e)}.`;case`lower-alpha`:case`lower-latin`:return`${AT(e).toLowerCase()}.`;case`upper-alpha`:case`upper-latin`:return`${AT(e)}.`;default:return`${e}.`}}function kT(e){if(e<1||e>3999)return`${e}`;let t=[[1e3,`M`],[900,`CM`],[500,`D`],[400,`CD`],[100,`C`],[90,`XC`],[50,`L`],[40,`XL`],[10,`X`],[9,`IX`],[5,`V`],[4,`IV`],[1,`I`]],n=``;for(let[r,i]of t)for(;e>=r;)n+=i,e-=r;return n}function AT(e){if(e<1)return`${e}`;let t=``;for(;e>0;){let n=(e-1)%26;t=String.fromCharCode(65+n)+t,e=Math.floor((e-1)/26)}return t}function jT(e,t){if(e.tagName.toLowerCase()!==`li`)return;if(t===`none`)return``;let n=e.parentElement,r=n?.tagName.toLowerCase();if(t===`disc`||t===`circle`||t===`square`)return OT(0,t);if(r===`ol`||r===`ul`||!n){let r=n?Array.from(n.children).filter(e=>e.tagName.toLowerCase()===`li`):[e],i=n?.getAttribute(`start`),a=n?.hasAttribute(`reversed`)??!1,o=i?parseInt(i,10):a?r.length:1,s=a?-1:1,c=o;for(let n of r){let r=n.getAttribute(`value`);if(r){let e=parseInt(r,10);Number.isNaN(e)||(c=e)}if(n===e)return OT(c,t||`decimal`);c+=s}return OT(c,t||`decimal`)}}function MT(e){let t=e.style;return t&&typeof t.cssText==`string`?t:null}function NT(e){let t=[];for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e===-1)continue;let r=n.slice(0,e).trim().toLowerCase(),i=n.slice(e+1).trim();r&&i&&t.push({property:r,value:i})}return t}function PT(e,t,n){let r=DT(cT(t)),i=e.ownerDocument.createElement(`div`);i.appendChild(e);function a(e,t){let n=new Set,r=e.getAttribute(`class`);if(r)for(let e of r.split(/\s+/))e&&n.add(e);return{tagName:e.tagName.toLowerCase(),classes:n,parent:t,el:e}}function o(e,t,i){let o=e.tagName.toLowerCase(),c=a(e,i),l=mT(),u=new Set,d=[],f=new Set,p=r.byTag.get(o);if(p)for(let e of p)f.add(e),d.push(e);for(let e of c.classes){let t=r.byClass.get(e);if(t)for(let e of t)f.has(e)||(f.add(e),d.push(e))}for(let e of r.universal)f.has(e)||(f.add(e),d.push(e));let m=[],h=[];for(let e of d)if(pT(e.selector,c)){let t=e.selector.pseudoElement===`marker`?h:m;for(let n of e.declarations)t.push({property:n.property,value:n.value,specificity:e.selector.spec,order:e.orderBase,important:n.important})}let g=hT[o],_=!1;if(g?.fontSize!==void 0){let e=g.fontSize;l.fontSize=e<10?e*t.fontSize:e,_=!0,u.add(`font-size`)}m.length>1&&m.sort((e,t)=>{if(e.important!==t.important)return e.important?1:-1;let n=e.specificity,r=t.specificity;return n[0]===r[0]?n[1]===r[1]?n[2]===r[2]?e.order-t.order:n[2]-r[2]:n[1]-r[1]:n[0]-r[0]});for(let e of m)e.property===`font-size`&&(wT(l,e.property,e.value,t.fontSize,n,t.direction),_=!0);let v=MT(e);if(v&&v.cssText){let e=NT(v.cssText);for(let r of e)r.property===`font-size`&&(wT(l,r.property,r.value,t.fontSize,n,t.direction),_=!0)}_||(l.fontSize=t.fontSize);let y=l.fontSize;if(g){for(let[e,t]of Object.entries(g)){if(e===`fontSize`)continue;l[e]=t;let n=e.replace(/[A-Z]/g,e=>`-`+e.toLowerCase());u.add(n)}l.marginTop<0&&(l.marginTop=Math.abs(l.marginTop)*y),l.marginBottom<0&&(l.marginBottom=Math.abs(l.marginBottom)*y),(o===`ul`||o===`ol`)&&(t.direction===`rtl`?(l.paddingRight=40,u.add(`padding-right`)):(l.paddingLeft=40,u.add(`padding-left`)))}let b=t.direction,x={"word-wrap":`overflow-wrap`};for(let e of m)e.property!==`font-size`&&(wT(l,e.property,e.value,y,n,b),u.add(x[e.property]||e.property));let S=!!v?.width;if(v&&v.cssText){let e=NT(v.cssText);for(let t of e){if(t.property===`font-size`){u.add(`font-size`);continue}let e=xT(t.property,t.value);for(let t of e)wT(l,t.property,t.value,y,n,b),u.add(x[t.property]||t.property)}}S||(l.width=0);let C=e.getAttribute(`dir`);C&&(l.direction=C,u.add(`direction`)),u.add(`font-size`),ET(l,t,u),u.has(`text-decoration-color`)?l.textDecorationColor===`currentColor`&&(l.textDecorationColor=l.color):l.textDecorationColor=l.webkitTextFillColor||l.color;for(let e of[`Top`,`Right`,`Bottom`,`Left`]){let t=`border${e}Color`,n=`border-${e.toLowerCase()}-color`;u.has(n)?l[t]===`currentColor`&&(l[t]=l.color):l[t]=l.color}let w=[];if(l.textDecorationLine&&l.textDecorationLine!==`none`)for(let e of l.textDecorationLine.split(/\s+/))e&&e!==`none`&&w.push({line:e,color:l.textDecorationColor,style:l.textDecorationStyle,declarer:l});l.textDecorations=t.textDecorations.length?[...t.textDecorations,...w]:w;let T=new Set(l.textDecorationLine.split(/\s+/).filter(e=>e&&e!==`none`));if(t.textDecorationLine&&t.textDecorationLine!==`none`)for(let e of t.textDecorationLine.split(/\s+/))e&&e!==`none`&&T.add(e);T.size>0&&(l.textDecorationLine=[...T].join(` `));let E=jT(e,l.listStyleType),D,O=!1;if(o===`li`&&h.length>0){h.length>1&&h.sort((e,t)=>{if(e.important!==t.important)return e.important?1:-1;let n=e.specificity,r=t.specificity;return n[0]===r[0]?n[1]===r[1]?n[2]===r[2]?e.order-t.order:n[2]-r[2]:n[1]-r[1]:n[0]-r[0]});let e=[`paddingLeft`,`paddingRight`,`fontSize`,`fontFamily`,`fontWeight`,`fontStyle`,`color`,`letterSpacing`],t={...l},r=new Set;for(let i of h){if(i.property===`content`){let e=i.value.trim().toLowerCase();(e===`none`||e===`""`||e===`''`||e===`normal`)&&(O=e===`none`||e===`""`||e===`''`);continue}let a=e.map(e=>t[e]);wT(t,i.property,i.value,y,n,b),e.forEach((e,n)=>{t[e]!==a[n]&&r.add(e)})}if(r.size>0){D={};for(let e of r)D[e]=t[e]}}let k=[];for(let t of e.childNodes){let e=s(t,l,c);e&&k.push(e)}return{element:e,tagName:o,style:l,children:k,textContent:null,listMarker:E,markerStyle:D,markerHidden:O||void 0}}function s(e,t,n){if(e.nodeType===sT){let n=e.textContent;if(!n)return null;if(n.trim()===``&&!n.includes(`\xA0`)){let r=t.whiteSpace,i=e.previousSibling,a=e.nextSibling,o=e=>{if(!e||e.nodeType!==oT)return e?.nodeType===sT;let t=hT[e.tagName.toLowerCase()]?.display||`block`;return t===`inline`||t===`inline-block`},s=o(i),c=o(a);if(i&&a&&!s&&!c&&r!==`pre`&&r!==`pre-wrap`&&r!==`pre-line`||r!==`pre`&&r!==`pre-wrap`&&r!==`pre-line`&&n.includes(`
132
+ `)&&!(s&&c))return null}let r={...t},i=t.whiteSpace,a=n;return i!==`pre`&&i!==`pre-wrap`&&i!==`pre-line`&&i!==`break-spaces`&&(a=n.replace(/[\n\r]/g,` `)),{element:null,tagName:`#text`,style:r,children:[],textContent:a}}if(e.nodeType!==oT)return null;let r=e,i=r.tagName.toLowerCase();return i===`style`||i===`script`?null:i===`br`?{element:null,tagName:`#text`,style:{...t},children:[],textContent:`
133
+ `}:o(r,t,n)}return o(i,mT(),null)}var FT=!0,IT,LT=[],RT=new Map,zT=new Map,BT=new Map;function VT(e,t){let n=e.font+`\0`+(e.letterSpacing||``)+`\0`+t,r=BT.get(n);if(r!==void 0)return r;let i=e.measureText(t).width;return BT.set(n,i),i}function HT(e){let t=``;for(let n of e){if(!n.text||n.isSpace)continue;let e=`${qT(n.style)}|${GT(n.style.letterSpacing)}|${WT(n.style)}`;if(t&&e!==t)return!0;t=e}return!1}function UT(e,t){e.font=qT(t),e.fontKerning=WT(t)}function WT(e){return e.fontKerning===`none`?`none`:`normal`}function GT(e){return Number.isFinite(e)&&e!==0?`${e}px`:`0px`}var KT=new Map;function qT(e){let t=`${e.fontStyle}|${e.fontVariantCaps}|${e.fontWeight}|${e.fontSize}|${e.fontFamily}`,n=KT.get(t);if(n)return n;let r=[];e.fontStyle!==`normal`&&r.push(e.fontStyle),e.fontVariantCaps===`small-caps`&&r.push(`small-caps`),e.fontWeight!==400&&r.push(String(e.fontWeight)),r.push(`${e.fontSize}px`),r.push(e.fontFamily);let i=r.join(` `);return KT.set(t,i),i}var JT=new Map,YT=null,XT=null,ZT=null,QT=new Set([`disc`,`circle`,`square`]);function $T(e,t,n=!1){let r=`${e}|${t}|${n?`ul-li`:`block`}`,i=JT.get(r);if(i!==void 0)return i;if(typeof document>`u`||!document.body)throw Error(`render-tag: accuracy 'balanced' requires a browser DOM for line-height probes; use the default 'performance' mode in non-browser environments.`);let a;n?(XT||(XT=document.createElement(`ul`),XT.style.cssText=`position:absolute;top:-9999px;left:-9999px;visibility:hidden;padding:0;margin:0;border:0;list-style:disc;`,ZT=document.createElement(`li`),ZT.style.cssText=`white-space:nowrap;padding:0;margin:0;border:0;`,ZT.textContent=`Mg`,XT.appendChild(ZT),document.body.appendChild(XT)),a=ZT):(YT||(YT=document.createElement(`div`),YT.style.cssText=`position:absolute;top:-9999px;left:-9999px;visibility:hidden;white-space:nowrap;padding:0;margin:0;border:0;`,YT.textContent=`Mg`,document.body.appendChild(YT)),a=YT),a.style.font=e,a.style.lineHeight=t;let o=a.getBoundingClientRect().height;return JT.set(r,o),o}function eE(e,t,n=!1){if(t.lineHeight>0)return FT?$T(qT(t),`${t.lineHeight}px`,n):t.lineHeight;if(FT)return $T(qT(t),`normal`,n);let{ascent:r,descent:i}=gE(e,t);return r+i}var tE=typeof navigator>`u`?``:navigator.userAgent,nE=/\bGecko\/\d/.test(tE),rE=/AppleWebKit/.test(tE)&&!/Chrome\/\d/.test(tE)&&!/\bjsdom\//.test(tE),iE=!nE&&!rE,aE=!nE&&!rE,oE=!nE;function sE(e,t,n){let r=(e-(t+n))/2+t;return aE?Math.floor(r):r}function cE(e,t){UT(e,t);let n=e.letterSpacing;e.letterSpacing=`0px`;let r=VT(e,` `);return e.letterSpacing=n,{interval:(r+(t.letterSpacing||0)+(t.wordSpacing||0))*8,halfSpace:r/2}}function lE(e){return{top:e.marginTop+e.borderTopWidth+e.paddingTop,bottom:e.paddingBottom+e.borderBottomWidth+e.marginBottom}}function uE(e,t,n=!1){let{ascent:r,descent:i}=gE(e,t),a=eE(e,t,n),o=sE(a,r,i);return{ascent:o,descent:a-o}}function dE(e,t){switch(t){case`uppercase`:return e.toUpperCase();case`lowercase`:return e.toLowerCase();case`capitalize`:return e.replace(/(^|[\s\p{P}])(\p{L})/gu,(e,t,n)=>t===`'`||t===`’`?e:t+n.toUpperCase());default:return e}}function fE(e){if(e.tagName===`#text`)return!0;let t=e.style.display;return t===`inline`||t===`inline-block`}function pE(e){return e.children.length>0&&e.children.every(fE)}function mE(e){return!e||e===`transparent`||e===`rgba(0, 0, 0, 0)`}var hE=new Map;function gE(e,t){let n=qT(t),r=hE.get(n);if(r)return r;let i=e.font;e.font=n;let a=e.measureText(`M`);e.font=i;let o={ascent:a.fontBoundingBoxAscent??a.actualBoundingBoxAscent,descent:a.fontBoundingBoxDescent??a.actualBoundingBoxDescent};return hE.set(n,o),o}function _E(e,t,n,r,i){switch(e){case`super`:return oE?-(r.fontSize/3+1):-r.fontSize*.34;case`sub`:return oE?r.fontSize/5+1:r.fontSize*.2;case`text-top`:return uE(t,n,i).ascent-gE(t,r).ascent;case`text-bottom`:return gE(t,r).descent-uE(t,n,i).descent;case`middle`:{let{ascent:e,descent:i}=gE(t,n);return-(r.fontSize*.25)-(i-e)/2}default:{let r=parseFloat(e);return Number.isFinite(r)?e.endsWith(`%`)?-(r/100)*eE(t,n,i):-r:0}}}function vE(e){return e!==`baseline`&&e!==`top`&&e!==`bottom`&&e!==``}function yE(e,t){if(e===t)return!0;let n=e.declarer,r=t.declarer;return n.fontSize===r.fontSize&&n.fontFamily===r.fontFamily&&n.fontWeight===r.fontWeight&&n.fontStyle===r.fontStyle&&n.fontVariantCaps===r.fontVariantCaps&&n.verticalAlign===r.verticalAlign&&n.textUnderlineOffset===r.textUnderlineOffset&&n.textDecorationThickness===r.textDecorationThickness}function bE(e,t){let n=e.textDecorations,r=t.textDecorations;if(n===r)return!0;if(!n||!r||n.length!==r.length)return!1;for(let e=0;e<n.length;e++)if(n[e].line!==r[e].line||n[e].color!==r[e].color||n[e].style!==r[e].style||!yE(n[e],r[e]))return!1;return!0}function xE(e,t){return e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontStyle===t.fontStyle&&e.color===t.color&&e.textDecorationLine===t.textDecorationLine&&bE(e,t)&&e.backgroundColor===t.backgroundColor}function SE(e){return!mE(e.backgroundColor)||e.borderTopWidth>0&&e.borderTopStyle!==`none`||e.borderRightWidth>0&&e.borderRightStyle!==`none`||e.borderBottomWidth>0&&e.borderBottomStyle!==`none`||e.borderLeftWidth>0&&e.borderLeftStyle!==`none`}function CE(e){return e.webkitBackgroundClip===`text`&&(!!e.backgroundImage&&e.backgroundImage!==`none`||!mE(e.backgroundColor))}function wE(e){return!!(e.boxOpen&&e.boxClose&&e.text)}function TE(e,t,n){let r=t.words.length-1;for(;r>=0&&(t.words[r].text===``||wE(t.words[r]));)r--;if(r<0)return;let i=t.words[r].style,a=t.words[r].boxStyle,o=t.words[r].parentStyle;UT(e,i),e.letterSpacing=`${i.letterSpacing||0}px`;let s=VT(e,`…`),c=()=>{for(;t.words.length>0&&t.words[t.words.length-1].isSpace;){let e=t.words.pop();t.totalWidth-=e.width}};c();let l=e=>!e.isSpace&&e.text!==``&&!e.boxOpen&&!e.boxClose;for(;t.totalWidth+s>n&&t.words.length>0;){let e=t.words[t.words.length-1];if(!l(e)&&!wE(e))break;t.totalWidth-=e.width,t.words.pop(),c()}let u={text:`…`,width:s,style:i,parentStyle:o,isSpace:!1,boxStyle:a};t.words.push(u),t.totalWidth+=s}function EE(e){let t=[];function n(e,r,i,a,o){if(e.tagName===`#text`&&e.textContent){t.push({text:e.textContent,style:e.style,parentStyle:o,boxStyle:r,clipStyle:i,strokeImageStyle:a});return}let s=e.style.display===`inline-block`,c=s||fE(e)&&SE(e.style),l=c?e.style:r,u=fE(e)&&CE(e.style)?e.style:i,d=fE(e)&&e.style.webkitTextStrokeImage&&e.style.webkitTextStrokeImage!==`none`?e.style:a,f=c&&(e.style.paddingLeft>0||e.style.paddingRight>0||e.style.borderLeftWidth>0||e.style.borderRightWidth>0);if(s){let n=e.element?.textContent||``;t.push({text:n,style:e.style,parentStyle:o,boxStyle:l,clipStyle:u,strokeImageStyle:d,boxOpen:e.style,boxClose:e.style,inlineBlock:e});return}let p=e.style.unicodeBidi,m=(p===`bidi-override`||p===`isolate-override`)&&e.style.direction===`rtl`,h=t.length;f&&t.push({text:``,style:e.style,boxStyle:l,boxOpen:e.style});for(let t of e.children)n(t,c?l:r,u,d,t.tagName===`#text`?o:e.style);if(f&&t.push({text:``,style:e.style,boxStyle:l,boxClose:e.style}),m&&t.length>h){let e=t.splice(h);for(let t of e)t.text&&(t.text=[...t.text].reverse().join(``),t.style={...t.style,direction:`ltr`});e.reverse(),t.push(...e)}}for(let t of e.children)n(t,void 0,void 0,void 0,e.style);return t}function DE(e){for(let t=0;t<e.length;t++){let n=e.codePointAt(t);if(n>=3584&&n<=3711||n>=3712&&n<=3839||n>=4096&&n<=4255||n>=6016&&n<=6143)return!0;n>65535&&t++}return!1}var OE;function kE(){return OE||(typeof Intl<`u`&&Intl.Segmenter?(OE=new Intl.Segmenter(void 0,{granularity:`word`}),OE):null)}function AE(e,t,n,r,i){if(t.includes(`​`)||t.includes(`­`)){let a=t.split(/(\u200B|\u00AD)/),o=i??{cumText:``,cumWidth:0},s=!1;for(let t of a){if(t===`­`){s=!0;continue}if(t===`​`||t===``){s=!1;continue}let i=r.length;AE(e,t,n,r,o),s&&i>0&&(r[i-1].isSoftHyphenBreak=!0),s=!1}s&&r.length>0&&(r[r.length-1].isSoftHyphenBreak=!0);return}if(n.style.whiteSpace===`pre`||n.style.whiteSpace===`pre-wrap`||n.style.whiteSpace===`break-spaces`){let i=t.split(/( +|\t)/).flatMap(e=>/^( +|\t)$/.test(e)?[e]:zE(e)),a=VT(e,` `)*8;for(let t of i){if(t===``)continue;if(t===` `){r.push({text:` `,width:a,style:n.style,parentStyle:n.parentStyle,isSpace:!0,isTab:!0,boxStyle:n.boxStyle,clipStyle:n.clipStyle,strokeImageStyle:n.strokeImageStyle});continue}let i=/^ +$/.test(t);r.push({text:t,width:VT(e,t),style:n.style,parentStyle:n.parentStyle,isSpace:i,boxStyle:n.boxStyle,clipStyle:n.clipStyle,strokeImageStyle:n.strokeImageStyle})}}else{let a=t.split(/([ \t\n\r\f\v]+)/).flatMap(e=>/^[ \t\n\r\f\v]+$/.test(e)?[e]:e.split(/(?<=\?)(?=.)|(?<=[-|\u2013\u2014])(?=\u00A0)/)).flatMap(e=>/^[ \t\n\r\f\v]+$/.test(e)?[e]:zE(e)),o=i?.cumText??``,s=i?.cumWidth??0;for(let t of a){if(t===``)continue;if(/^[ \t\n\r\f\v]+$/.test(t)){let t=s;o+=` `,s=e.measureText(o).width;let i=s-t+(n.style.wordSpacing||0);r.push({text:` `,width:i,style:n.style,parentStyle:n.parentStyle,isSpace:!0,boxStyle:n.boxStyle,clipStyle:n.clipStyle,strokeImageStyle:n.strokeImageStyle});continue}if(DE(t)){let i=kE();if(i){for(let a of i.segment(t)){let t=a.segment,i=s;o+=t,s=e.measureText(o).width,r.push({text:t,width:s-i,style:n.style,parentStyle:n.parentStyle,isSpace:!1,boxStyle:n.boxStyle,clipStyle:n.clipStyle,strokeImageStyle:n.strokeImageStyle})}continue}}let i=s;o+=t,s=e.measureText(o).width;let a=s-i,c=VT(e,t);IT&&IT({type:`measure-word`,message:`"${t}" delta=${a.toFixed(2)} direct=${c.toFixed(2)} diff=${(a-c).toFixed(2)} cumText="${o}"`,data:{text:t,deltaWidth:a,directWidth:c,cumWidth:s,prevCum:i,font:n.style.fontFamily,fontSize:n.style.fontSize}}),r.push({text:t,width:a,style:n.style,parentStyle:n.parentStyle,isSpace:!1,boxStyle:n.boxStyle,clipStyle:n.clipStyle,strokeImageStyle:n.strokeImageStyle})}i&&(i.cumText=o,i.cumWidth=s)}}function jE(e,t){let n=[];for(let r of t){if(r.text===``&&!r.boxOpen&&!r.boxClose){let e=r.style.display===`inline-block`&&(r.style.marginLeft||r.style.marginRight)||0;e>0&&n.push({text:``,width:e,style:r.style,isSpace:!1,boxStyle:r.boxStyle});continue}if(r.boxOpen&&r.boxClose&&r.text){UT(e,r.style),e.letterSpacing=GT(r.style.letterSpacing);let t=dE(r.text,r.style.textTransform),i=r.style,a=VT(e,t),o=i.marginLeft+i.borderLeftWidth+i.paddingLeft+a+i.paddingRight+i.borderRightWidth+i.marginRight;n.push({text:t,width:o,style:r.style,parentStyle:r.parentStyle,isSpace:!1,boxStyle:r.boxStyle,boxOpen:r.boxOpen,boxClose:r.boxClose,clipStyle:r.clipStyle,strokeImageStyle:r.strokeImageStyle,inlineBlock:r.inlineBlock});continue}if(r.boxOpen){let e=r.boxOpen.paddingLeft+r.boxOpen.borderLeftWidth;e>0&&n.push({text:``,width:e,style:r.style,isSpace:!1,boxStyle:r.boxStyle,boxOpen:r.boxOpen});continue}if(r.boxClose){let e=r.boxClose.paddingRight+r.boxClose.borderRightWidth;e>0&&n.push({text:``,width:e,style:r.style,isSpace:!1,boxStyle:r.boxStyle,boxClose:r.boxClose});continue}UT(e,r.style),e.letterSpacing=GT(r.style.letterSpacing);let t=dE(r.text,r.style.textTransform),i=e=>{let t=n[e];if(!t||t.isSpace||!t.text||t.text===`
134
+ `)return;let r=n[e-1];if(!r||r.isSpace||!r.text.trim()||r.boxOpen||r.boxClose)return;let i=FE(t.text)[0],a=FE(r.text),o=a[a.length-1];ME(i)||ME(o)||RE(i)||RE(o)||DE(t.text)||DE(r.text)||(t.noBreakBefore=!0)};if(t.includes(`
135
+ `)){let a=t.split(`
136
+ `);for(let t=0;t<a.length;t++)if(t>0&&n.push({text:`
137
+ `,width:0,style:r.style,isSpace:!1,boxStyle:r.boxStyle}),a[t]){let o=n.length;AE(e,a[t],r,n),i(o)}}else{let a=n.length;AE(e,t,r,n),i(a)}}return n}function ME(e){let t=e.codePointAt(0)||0;return t>=19968&&t<=40959||t>=13312&&t<=19903||t>=12288&&t<=12351||t>=12352&&t<=12447||t>=12448&&t<=12543||t>=44032&&t<=55215||t>=65280&&t<=65519||t>=131072&&t<=173791}var NE;function PE(){return NE||(typeof Intl<`u`&&Intl.Segmenter?(NE=new Intl.Segmenter(void 0,{granularity:`grapheme`}),NE):null)}function FE(e){let t=PE();return t?[...t.segment(e)].map(e=>e.segment):[...e]}var IE=/\p{Extended_Pictographic}/u,LE=/[\u{1F000}-\u{10FFFF}\u200D\uFE0F]/u;function RE(e){for(let t of e)if(t.codePointAt(0)>=126976)return!0;return e.includes(`‍`)||e.includes(`️`)?IE.test(e):!1}function zE(e){return e.split(/(?<=[^]-)/).filter(Boolean)}function BE(e,t,n,r){let i=[...t.text].some(ME),a=!!PE()&&LE.test(t.text)&&FE(t.text).some(RE),o=t.width>n&&(t.style.overflowWrap===`break-word`||t.style.wordBreak===`break-all`);if(!i&&!a&&!o)return{pieces:[t],emergency:!1};let s=o&&!i&&!a&&t.style.wordBreak!==`break-all`;e.font=qT(t.style),e.letterSpacing=GT(t.style.letterSpacing);let c=a?FE(t.text):[...t.text],l=[],u=``,d=0,f=``,p=0,m=0;for(let r of c){let i=f+r,s=VT(e,i),c=s-p;if(a&&RE(r)){u&&(l.push({...t,text:u,width:d}),u=``,d=0),l.push({...t,text:r,width:c}),m=s,f=i,p=s;continue}if(ME(r)){u&&(l.push({...t,text:u,width:d}),u=``,d=0),l.push({...t,text:r,width:c}),m=s,f=i,p=s;continue}let h=u+r,g=s-m;if(o&&g>n&&u){l.push({...t,text:u,width:d}),u=r,d=c,m=p,f=i,p=s;continue}u=h,d=g,f=i,p=s}return u&&l.push({...t,text:u,width:d}),{pieces:l,emergency:s}}var VE=/^[,.\;:!?\)\]\}'"»›」』】〕〉》”、。・!),:;?၊-၏។-៖៘-៚]+$/,HE=/^[\(\[\{«‹“‘「『【〔〈《(]+$/;function UE(e,t){let n=0;for(let r=t;r<e.length;r++){let t=e[r];if(t.isSpace||t.text===`
138
+ `)break;let i=!!t.text&&VE.test(t.text),a=!t.text&&!!t.boxClose,o=!!t.text&&!!t.noBreakBefore;if(!i&&!a&&!o)break;n+=t.width}return n}function WE(e,t,n,r,i=!1,a=0,o,s=0){let c=[],l=()=>({words:[],totalWidth:0,lineHeight:s}),u=l(),d=r===`nowrap`||r===`pre`,f=()=>n-(c.length===0?a:0),p=r===`pre-wrap`||r===`pre`||r===`pre-line`,m=r===`pre`||r===`pre-wrap`||r===`break-spaces`;function h(t=!1){let i=u.words.length>0;if(!(r===`break-spaces`||m&&!t))for(;u.words.length>0&&u.words[u.words.length-1].isSpace;)u.totalWidth-=u.words[u.words.length-1].width,u.words.pop();if(t&&u.words.length>0){let t=u.words[u.words.length-1];if(t.isSoftHyphenBreak){UT(e,t.style);let n=VT(e,`-`);u.words.push({text:`-`,width:n,style:t.style,parentStyle:t.parentStyle,isSpace:!1,clipStyle:t.clipStyle,strokeImageStyle:t.strokeImageStyle}),u.totalWidth+=n}}if(u.words.length>0||i&&p){if(IT){let e=u.words.map(e=>e.text).join(``);IT({type:`line-commit`,message:`Line ${c.length}: "${e}" width=${u.totalWidth.toFixed(2)} / ${n}`,data:{lineIndex:c.length,text:e,totalWidth:u.totalWidth,contentWidth:n}})}c.push(u)}u=l()}let g=!0;for(let r=0;r<t.length;r++){let s=t[r],p=eE(e,s.style,i);if(s.inlineBlockLayout)p=Math.max(p,s.inlineBlockLayout.marginBoxHeight);else if(s.boxStyle&&s.boxStyle.display===`inline-block`){let e=lE(s.boxStyle);p+=Math.max(0,e.top+e.bottom)}if(s.text===`
139
+ `){u.words.length===0?(u.lineHeight=Math.max(u.lineHeight,p),u.endedByHardBreak=!0,c.push(u),u=l()):(u.endedByHardBreak=!0,h()),g=!0;continue}if(d){u.words.push(s),u.totalWidth+=s.width,u.lineHeight=Math.max(u.lineHeight,p);continue}if(!s.isSpace&&s.text&&!s.noBreakBefore&&!s.boxOpen&&!s.boxClose){let n=r;for(;n+1<t.length;){let e=t[n+1];if(!e.text||e.isSpace||e.boxOpen||e.boxClose||!e.noBreakBefore)break;n++}if(n>r){let a=s.style.overflowWrap===`break-word`||s.style.wordBreak===`break-all`,o=0;for(let e=r;e<=n;e++)o+=t[e].width;let c=[];for(let e=r;e<=n;e++)for(let n of[...t[e].text])c.push({ch:n,style:t[e].style,parentStyle:t[e].parentStyle,clipStyle:t[e].clipStyle,strokeImageStyle:t[e].strokeImageStyle});let l=zE(c.map(e=>e.ch).join(``)),d=l.length>1;if(!(u.totalWidth+o<=f())&&(d||a&&o>f())){let t=[],o=0;for(let e of l){let n=[...e].length;t.push(c.slice(o,o+n)),o+=n}let s=(t,n)=>{let r=0;for(;r<t.length;){let a=t[r].style,o=t[r].clipStyle,s=t[r].strokeImageStyle,c=t[r].parentStyle;UT(e,a),e.letterSpacing=GT(a.letterSpacing);let l=eE(e,a,i),d=``,p=0;for(;r<t.length&&t[r].style===a;){let i=t[r].ch,m=VT(e,d+i);n&&u.totalWidth+m>f()&&(u.words.length>0||d)?(d&&(u.words.push({text:d,width:p,style:a,isSpace:!1,parentStyle:c,clipStyle:o,strokeImageStyle:s}),u.totalWidth+=p,u.lineHeight=Math.max(u.lineHeight,l)),h(!0),g=!1,d=i,p=VT(e,i)):(d+=i,p=m),r++}d&&(u.words.push({text:d,width:p,style:a,isSpace:!1,parentStyle:c,clipStyle:o,strokeImageStyle:s}),u.totalWidth+=p,u.lineHeight=Math.max(u.lineHeight,l),g=!1)}},p=t=>{let n=0,r=0;for(;r<t.length;){let i=t[r].style,a=``;for(;r<t.length&&t[r].style===i;)a+=t[r].ch,r++;UT(e,i),e.letterSpacing=GT(i.letterSpacing),n+=VT(e,a)}return n};!d&&u.words.length>0&&(h(!0),g=!1);for(let e of t){let t=p(e);u.words.length>0&&u.totalWidth+t>f()&&(h(!0),g=!1),s(e,a&&t>f())}r=n;continue}}}let _=!s.isSpace&&s.text.length>1?BE(e,s,f(),u.totalWidth):{pieces:[s],emergency:!1},v=_.pieces;_.emergency&&u.words.some(e=>!e.isSpace)&&(h(!0),g=!1);let y=UE(t,r+1);for(let i=0;i<v.length;i++){let s=v[i],l=i===v.length-1,d=l?y:0;for(let e=i+1;e<v.length;e++){let t=v[e];if(!t.text||!VE.test(t.text))break;d+=t.width,e===v.length-1&&(d+=y)}let _=!s.isSpace&&s.text.length>0&&VE.test(s.text)&&u.words.length>0&&!u.words[u.words.length-1].isSpace,b=u.words.length>0&&!u.words[u.words.length-1].isSpace&&(s===v[0]&&s.noBreakBefore||!s.text&&!!s.boxClose),x=0,S=HE.test(s.text);if(S&&!l)x=v[i+1].width;else if(!s.text&&s.boxOpen||S&&y===0){let n=r+1;for(;n<t.length&&!t[n].text&&t[n].boxOpen;)x+=t[n].width,n++;let i=t[n];if(i&&!i.isSpace&&i.text){let r=i.text.length>1?BE(e,i,f(),0).pieces:[i];x+=r[0].width,r.length===1&&(x+=UE(t,n+1))}}let C=0;s.isSoftHyphenBreak&&(UT(e,s.style),e.letterSpacing=GT(s.style.letterSpacing),C=VT(e,`-`));let w=u.totalWidth+s.width+C+d+x;if(!s.isSpace&&!_&&!b&&u.words.length>0&&w>f()){let t=w-f(),r=!0;if(t<1&&!u.words.some(e=>e.isTab)&&!HT([...u.words,s])){UT(e,s.style);let t=u.words.map(e=>e.text).join(``)+s.text+(s.isSoftHyphenBreak?`-`:``),n=0;for(let e of u.words)e.text?e.isSpace&&(n+=e.style.wordSpacing):n+=e.width;s.text?s.isSpace&&(n+=s.style.wordSpacing):n+=s.width,VT(e,t)+n+d+x<=f()+.02&&(r=!1)}if(r){if(IT){let e=u.words.map(e=>e.text).join(``);IT({type:`line-wrap`,message:`"${s.text}" overflow=${t.toFixed(2)} wrap=true lineWidth=${u.totalWidth.toFixed(2)} pieceWidth=${s.width.toFixed(2)} contentWidth=${n} line="${e}"`,data:{text:s.text,overflow:t,lineWidth:u.totalWidth,pieceWidth:s.width,contentWidth:n,lineText:e}})}h(!0),g=!1}}if(s.isSpace&&u.words.length===0&&(!g||!m))continue;let T=s.width;if(s.isTab){let e=o?.interval||s.width,t=o?.halfSpace??0,n=e-((c.length===0?a:0)+u.totalWidth)%e;n<t&&(n+=e),T=n,s.width=T}u.words.push(s),u.totalWidth+=T,u.lineHeight=Math.max(u.lineHeight,p),s.isSpace||(g=!1)}}return h(),c}function GE(e,t,n,r){for(let i of t){let t=i.inlineBlock;if(!t)continue;let a=t.style,o=aD(a),s=iD(a),c=Math.max(0,i.width-o-s),l=Math.max(0,n-o-s),u=a.width>0?Math.max(0,a.width-s):Math.min(c,Math.max(oD(e,t),l));a.minWidth!==null&&(u=Math.max(u,Math.max(0,a.minWidth-s)));let d=KE(e,t,0,0,u,r),f=d.height||eE(e,a,r),p=d.lines.at(-1)?.y??uE(e,a,r).ascent,m=lE(a),h=m.top+p,g=m.top+f+m.bottom;i.width=o+s+u,i.inlineBlockLayout={nodes:d.nodes,lines:d.lines,contentWidth:u,contentHeight:f,baselineOffset:h,marginBoxHeight:g}}}function KE(e,t,n,r,i,a=!1,o){let s=[],c=[],l=new Map,u=new Map;if(o&&(o.exhausted||o.remaining<=0))return o.exhausted=!0,{nodes:s,height:0,lines:c};let d=EE(t);if(d.length===0)return{nodes:s,height:0,lines:c};let f=jE(e,d);GE(e,f,i,a);let p=t.style.textIndent||0,m=cE(e,t.style),h=eE(e,t.style,a),g=WE(e,f,i,t.style.whiteSpace,a,p,m,h),_=o?o.remaining:t.style.lineClamp;if(_>0&&g.length>_){g.length=_;let t=g[_-1];TE(e,t,i-(_===1?p:0)),t.endedByHardBreak=!0,o&&(o.remaining=0,o.exhausted=!0)}else o&&(o.remaining-=g.length);let v=t.style.direction===`rtl`,y=e=>e===`start`?v?`right`:`left`:e===`end`?v?`left`:`right`:e,b=y(t.style.textAlign),x=t.style.textAlignLast||`auto`;x=x===`auto`?t.style.textAlign===`justify`?v?`right`:`left`:b:y(x);let S=t.style,C=r;for(let r=0;r<g.length;r++){let o=g[r];if(o.words.length===0){C+=o.lineHeight;continue}let d=r===g.length-1,f=r===0,m=d||o.endedByHardBreak?x:b,h=f?p:0,_=i-h,y=0;if(m===`justify`&&o.totalWidth<_){let e=o.words.filter(e=>e.isSpace).length;e>0&&(y=(_-o.totalWidth)/e)}let w=o.totalWidth>_+.5,T=n+h;w?T=v?n+_-o.totalWidth:n+h:m===`center`?T=n+h+(_-o.totalWidth)/2:m===`right`?T=(v?n+_:n+h+_)-o.totalWidth:m===`justify`&&v&&(T=n+_-o.totalWidth);let E=T,D=uE(e,t.style,a),O=D.ascent,k=D.descent,A=(e,t)=>{e.ascent-t>O&&(O=e.ascent-t),e.descent+t>k&&(k=e.descent+t)};for(let t of o.words){if(t.text===``)continue;t.parentStyle&&A(uE(e,t.parentStyle,a),_E(t.parentStyle.verticalAlign,e,t.parentStyle,S,a));let n=uE(e,t.style,a),r=t.boxStyle?.display===`inline-block`?t.boxStyle:null;if(t.inlineBlockLayout){let e=t.inlineBlockLayout;n.ascent=e.baselineOffset,n.descent=e.marginBoxHeight-e.baselineOffset}else if(r){let e=lE(r);n.ascent+=e.top,n.descent+=e.bottom}A(n,r?0:_E(t.style.verticalAlign,e,t.style,t.parentStyle??S,a))}let ee=O+k,j=C+O,M=(t,n,r,i)=>{let{ascent:o,descent:c}=t.display===`inline-block`?uE(e,t,a):gE(e,t),l=t.paddingTop+t.borderTopWidth,u=t.paddingBottom+t.borderBottomWidth,d=o+c+l+u,f=j;if(i&&t.display!==`inline-block`){let t=i.style.verticalAlign;vE(t)&&(f+=_E(t,e,i.style,i.parentStyle??S,a))}let p=f-o-l;s.push({type:`box`,style:t,x:n,y:p,width:r,height:d,tagName:`span`,children:[]})};if(!v){let e=T,t=e,n,r;for(let i of o.words){if(i.boxOpen&&i.boxClose&&i.text){n&&(r&&M(n,t,e-t,r),n=void 0,r=void 0);let a=i.style,o=e+a.marginLeft;if(i.inlineBlockLayout){let e=i.inlineBlockLayout;s.push({type:`box`,style:a,x:o,y:j-e.baselineOffset+a.marginTop,width:a.borderLeftWidth+a.paddingLeft+e.contentWidth+a.paddingRight+a.borderRightWidth,height:a.borderTopWidth+a.paddingTop+e.contentHeight+a.paddingBottom+a.borderBottomWidth,tagName:`span`,children:[]})}else{let e=i.width-aD(a)-iD(a);M(a,o,a.borderLeftWidth+a.paddingLeft+e+a.paddingRight+a.borderRightWidth,i)}r=void 0,e+=i.width;continue}i.boxStyle!==n&&(n&&r&&M(n,t,e-t,r),n=i.boxStyle,t=e,r=void 0),i.text&&!i.isSpace&&(r??=i),e+=i.width+(i.isSpace?y:0)}n&&r&&M(n,t,e-t,r)}let N=o.words.filter(e=>e.text!==``),P=N.length>0&&N.every(e=>xE(e.style,N[0].style));if(v){let t=[],n=null,r=0;for(let e of o.words){if(e.text===``){n&&=(t.push(n),null),r+=e.width;continue}if(e.isSpace&&y>0){n&&=(t.push(n),null),r+=e.width+y;continue}n&&xE(n.style,e.style)?(n.text+=e.text,n.width+=e.width):(n&&t.push(n),n={text:e.text,style:e.style,width:e.width,boxStyle:e.boxStyle,clipStyle:e.clipStyle,strokeImageStyle:e.strokeImageStyle,x:0,padBefore:r},r=0)}n&&t.push(n);let i=T+o.totalWidth;for(let n of t){i-=n.padBefore,UT(e,n.style);let t=VT(e,n.text);i-=t,n.x=i,n.width=t}for(let e of t)if(e.boxStyle&&SE(e.boxStyle)){let t=e.boxStyle,n=t.paddingLeft+t.borderLeftWidth,r=t.paddingRight+t.borderRightWidth;M(t,e.x-n,e.width+n+r)}for(let e of t){let t={type:`text`,text:e.text,x:e.x+e.width,y:j,width:e.width,style:{...e.style,direction:`rtl`}};s.push(t),e.clipStyle&&l.set(t,e.clipStyle),e.strokeImageStyle&&u.set(t,e.strokeImageStyle)}}else{let t=o.words.map(e=>e.text).join(``);if(P&&/[\u0590-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/.test(t)&&!o.words.some(e=>e.boxOpen||e.boxClose||e.style.verticalAlign===`super`||e.style.verticalAlign===`sub`)){UT(e,N[0].style);let n=VT(e,t),r={type:`text`,text:t,x:T,y:j,width:n,style:{...N[0].style,direction:`ltr`}};s.push(r),N[0].clipStyle&&l.set(r,N[0].clipStyle),N[0].strokeImageStyle&&u.set(r,N[0].strokeImageStyle)}else for(let t of o.words){if(t.text===``){T+=t.width;continue}if(t.boxOpen&&t.boxClose){let n=t.style,r=T+n.marginLeft+n.borderLeftWidth+n.paddingLeft;if(t.inlineBlockLayout){let e=t.inlineBlockLayout,i=j-e.baselineOffset+n.marginTop+n.borderTopWidth+n.paddingTop,a=e=>{if(e.x+=r,e.y+=i,e.type===`text`)e.lineBaselineY!==void 0&&(e.lineBaselineY+=i),e.clip&&(e.clip.x+=r,e.clip.y+=i),e.strokeImage&&(e.strokeImage.x+=r,e.strokeImage.y+=i);else for(let t of e.children)a(t)};for(let t of e.nodes)a(t),s.push(t);for(let t of e.lines.slice(0,-1)){let e={y:Math.round(t.y+i),text:t.text,bounds:{x:t.bounds.x+r,y:t.bounds.y+i,width:t.bounds.width,height:t.bounds.height}};c.push(e)}T+=t.width;continue}let i={type:`text`,text:t.text,x:r,y:j,width:VT(e,t.text),style:t.style};s.push(i),t.clipStyle&&l.set(i,t.clipStyle),t.strokeImageStyle&&u.set(i,t.strokeImageStyle),T+=t.width;continue}let n=j,r=t.style.verticalAlign;vE(r)&&(n+=_E(r,e,t.style,t.parentStyle??S,a));let i=t.width+(t.isSpace?y:0),o={type:`text`,text:t.text,x:T,y:n,width:i,style:t.style,...n===j?{}:{lineBaselineY:j}};s.push(o),t.clipStyle&&l.set(o,t.clipStyle),t.strokeImageStyle&&u.set(o,t.strokeImageStyle),T+=i}}let F=m===`justify`&&y>0?_:o.totalWidth,I={y:Math.round(j),text:o.words.map(e=>e.inlineBlockLayout?.lines.at(-1)?.text??e.text).join(``),bounds:{x:E,y:C,width:F,height:ee}};c.push(I),C+=ee}return qE(e,s,l,(e,t,n)=>{e.clip={image:t.backgroundImage&&t.backgroundImage!==`none`?t.backgroundImage:void 0,color:mE(t.backgroundColor)?void 0:t.backgroundColor,...n}}),qE(e,s,u,(e,t,n)=>{e.strokeImage={image:t.webkitTextStrokeImage,...n}}),{nodes:s,height:C-r,lines:c}}function qE(e,t,n,r){if(n.size===0)return;let i=e=>e.style.direction===`rtl`?{left:e.x-e.width,right:e.x}:{left:e.x,right:e.x+e.width};for(let a=0;a<t.length;){let o=t[a],s=o.type===`text`?n.get(o):void 0;if(!s){a++;continue}let c=a,l=1/0,u=-1/0;for(;c<t.length;){let e=t[c];if(e.type!==`text`||n.get(e)!==s||e.y!==o.y)break;let r=i(e);r.left<l&&(l=r.left),r.right>u&&(u=r.right),c++}let{ascent:d,descent:f}=gE(e,s),p={x:l,y:o.y-d,width:u-l,height:d+f};for(let e=a;e<c;e++)r(t[e],s,p);a=c}}function JE(e,t){return e>=0&&t>=0?Math.max(e,t):e<0&&t<0?Math.min(e,t):e+t}function YE(e){let t=e.style.display;return t===`block`||t===`list-item`||t===`flex`||t===`table`||t===`table-row`||t===`table-cell`||t===`table-row-group`||t===`table-header-group`||t===`table-footer-group`}function XE(e){let t=e.style.display;return(t===`block`||t===`list-item`)&&(e.tagName===`li`||e.tagName===`ul`||e.tagName===`ol`||e.tagName===`dd`||e.tagName===`dt`)}function ZE(e){let t=e.style.marginTop;if(!XE(e)||e.style.paddingTop!==0||e.style.borderTopWidth!==0)return t;let n=e.children[0];return n&&YE(n)?JE(t,ZE(n)):t}function QE(e,t,n,r,i,a){let o=t.style;!a&&o.lineClamp>0&&(a={remaining:o.lineClamp,exhausted:!1});let s=o.marginLeft,c=o.marginRight,l=o.borderLeftWidth,u=o.borderRightWidth,d=o.borderTopWidth,f=o.borderBottomWidth,p=o.paddingLeft,m=o.paddingRight,h=o.paddingTop,g=o.paddingBottom,_=n+s,v=o.width>0?o.width:i-s-c,y=_+l+p,b=Math.max(0,v-l-u-p-m),x=r,S=x+d+h,C={type:`box`,style:o,x:_,y:x,width:v,height:0,tagName:t.tagName,children:[],listMarker:t.listMarker};if(o.display===`flex`){let n=mD(e,t,y,S,b);return C.children=n.children,C.height=d+h+n.height+g+f,{box:C,height:C.height,marginBottomOut:o.marginBottom}}if(o.display===`table`){let n=$E(e,t,y,S,b);return C.children=n.children,C.height=d+h+n.height+g+f,{box:C,height:C.height,marginBottomOut:o.marginBottom}}if(t.children.length===0)return C.height=d+h+g+f,o.minHeight>0&&(C.height=Math.max(C.height,o.minHeight)),{box:C,height:C.height,marginBottomOut:o.marginBottom};if(pE(t)){let{nodes:n,height:r,lines:i}=KE(e,t,y,S,b,t.tagName===`li`&&QT.has(o.listStyleType),a);LT.push(...i),C.children=n,C.height=d+h+r+g+f}else{let n=S,r=0,i=!1,s=XE(t);for(let c=0;c<t.children.length;c++){let l=t.children[c];if(a&&(a.exhausted||a.remaining<=0)){a.exhausted=!0,r=0;break}if(l.tagName===`#text`||fE(l)){let s=[l];for(;c+1<t.children.length;){let e=t.children[c+1];if(e.tagName===`#text`||fE(e))s.push(e),c++;else break}n+=r,r=0;let u={element:null,tagName:`div`,style:{...t.style,display:`block`,marginTop:0,marginBottom:0,paddingTop:0,paddingBottom:0,borderTopWidth:0,borderBottomWidth:0},children:s,textContent:null},d=t.tagName===`li`&&QT.has(o.listStyleType),{nodes:f,height:p,lines:m}=KE(e,u,y,n,b,d,a);LT.push(...m),C.children.push(...f),n+=p,r=0,i=!0;continue}let u=ZE(l);if(!(!i&&h===0&&d===0&&s)){let e=JE(r,u);n+=e}let{box:f,height:p,marginBottomOut:m}=QE(e,l,y,n,b,a);C.children.push(f),n+=p,r=a?.exhausted?0:m,i=!0}let c=o.marginBottom,l=g===0&&f===0&&o.minHeight===0&&s;l&&(c=JE(o.marginBottom,r));let u=n-S;return l||(u+=r),u=Math.max(0,u),C.height=d+h+u+g+f,o.minHeight>0&&(C.height=Math.max(C.height,o.minHeight)),{box:C,height:C.height,marginBottomOut:c}}return o.minHeight>0&&(C.height=Math.max(C.height,o.minHeight)),{box:C,height:C.height,marginBottomOut:o.marginBottom}}function $E(e,t,n,r,i){let a=[],o=[];for(let e of t.children)if(e.tagName===`tr`)o.push(e);else if([`thead`,`tbody`,`tfoot`].includes(e.tagName))for(let t of e.children)t.tagName===`tr`&&o.push(t);if(o.length===0)return{children:a,height:0};let s=Math.max(...o.map(e=>e.children.filter(e=>e.tagName===`td`||e.tagName===`th`).length));if(s===0)return{children:a,height:0};let c=i/s,l=r;for(let t of o){let r=t.children.filter(e=>e.tagName===`td`||e.tagName===`th`),i=0,o=[];for(let t=0;t<r.length;t++){let a=r[t],{box:s,height:u}=QE(e,a,n+t*c,l,c);o.push(s),i=Math.max(i,u)}for(let e of o)e.height=i,a.push(e);l+=i}return{children:a,height:l-r}}var eD=new WeakMap;function tD(e){let t=eD.get(e);return t||(t={element:null,tagName:`div`,style:{...e.style,display:`block`},children:[e],textContent:null},eD.set(e,t)),t}function nD(e){return e.children.filter(e=>e.tagName!==`#text`||e.textContent?.trim()).map(e=>e.tagName===`#text`?tD(e):e)}function rD(e){return e.flexDirection===`row`||e.flexDirection===``}function iD(e){return e.borderLeftWidth+e.paddingLeft+e.paddingRight+e.borderRightWidth}function aD(e){return e.marginLeft+e.marginRight}function oD(e,t){return WE(e,jE(e,EE(t)).map(e=>e.style.overflowWrap===`break-word`&&e.style.wordBreak!==`break-all`?{...e,style:{...e.style,overflowWrap:`normal`}}:e),0,t.style.whiteSpace).reduce((e,t)=>Math.max(e,t.totalWidth),0)}function sD(e,t){let n=RT.get(t);if(n!==void 0)return n;let r=cD(e,t);return RT.set(t,r),r}function cD(e,t){let n=aD(t.style),r=iD(t.style);if(t.style.minWidth!==null)return n+Math.max(r,t.style.minWidth);let i=0;if(pE(t))i=oD(e,t);else if(t.style.display===`flex`&&rD(t.style)){let n=nD(t);i=n.reduce((t,n)=>t+sD(e,n),0)+t.style.gap*Math.max(0,n.length-1)}else for(let n of t.children)n.tagName!==`#text`&&(i=Math.max(i,sD(e,n)));let a=r+i;return t.style.width>0&&(a=Math.min(a,t.style.width)),n+a}function lD(e,t){return WE(e,jE(e,EE(t)),1/0,t.style.whiteSpace).reduce((e,t)=>Math.max(e,t.totalWidth),0)}function uD(e,t){let n=zT.get(t);if(n!==void 0)return n;let r=dD(e,t);return zT.set(t,r),r}function dD(e,t){let n=aD(t.style);if(t.style.width>0)return n+t.style.width;let r=0;if(pE(t))r=lD(e,t);else if(t.style.display===`flex`&&rD(t.style)){let n=nD(t);r=n.reduce((t,n)=>t+uD(e,n),0)+t.style.gap*Math.max(0,n.length-1)}else for(let n of t.children)n.tagName!==`#text`&&(r=Math.max(r,uD(e,n)));return n+iD(t.style)+r}function fD(e,t){return t.style.flexBasis===null?uD(e,t):aD(t.style)+t.style.flexBasis}function pD(e,t,n,r){let i=t.map((e,t)=>Math.max(e,n[t])),a=i.reduce((e,t)=>e+t,0)<r,o=t=>a?e[t].flexGrow:e[t].flexShrink,s=i.map((e,n)=>o(n)===0||!a&&t[n]<e);for(;;){let o=i.map((e,t)=>t).filter(e=>!s[e]);if(o.length===0)break;let c=r-i.reduce((e,n,r)=>e+(s[r]?n:t[r]),0),l=o.map(n=>a?e[n].flexGrow:e[n].flexShrink*t[n]),u=l.reduce((e,t)=>e+t,0);if(u<=0)break;o.forEach((e,n)=>{i[e]=t[e]+c*l[n]/u});let d=o.filter(e=>i[e]<n[e]);if(d.length===0)break;for(let e of d)i[e]=n[e],s[e]=!0}return i}function mD(e,t,n,r,i){let a=t.style,o=a.gap,s=[],c=nD(t);if(c.length===0)return{children:s,height:0};if(rD(a)){let t=o*(c.length-1),a=Math.max(0,i-t),l=pD(c.map(e=>e.style),c.map(t=>fD(e,t)),c.map(t=>sD(e,t)),a),u=n,d=0;for(let t=0;t<c.length;t++){let n=c[t],i=l[t],{box:a,height:f}=QE(e,n,u,r,i);s.push(a),d=Math.max(d,f),u+=i+o}return{children:s,height:d}}let l=r;for(let t of c){let{box:r,height:a}=QE(e,t,n,l,i);s.push(r),l+=a+o}return{children:s,height:l-r}}function hD(e,t,n){if(!n.listMarker||n.markerHidden)return;let r=n.style,i=n.markerStyle,a=i?{...r,...i}:r;e.font=qT(a);let o=uE(e,r),s=t.y+r.borderTopWidth+r.paddingTop+o.ascent,c=VT(e,n.listMarker),l=r.direction===`rtl`,u=QT.has(r.listStyleType),d=l?i?.paddingLeft:i?.paddingRight,f,p=s,m=`ltr`,h=a,g=c,_=t.x+r.borderLeftWidth+r.paddingLeft,v=t.x+t.width;if(u){let{ascent:t}=gE(e,a),r=e.measureText(n.listMarker),i=t/3,o=d===void 0?7+i:d,u=(r.actualBoundingBoxAscent??0)+(r.actualBoundingBoxDescent??0),m=u>0?i/u:1,y=(r.actualBoundingBoxRight??c)*m,b=(r.actualBoundingBoxLeft??0)*m,x=((r.actualBoundingBoxAscent??0)-(r.actualBoundingBoxDescent??0))/2*m;f=l?v+o+b:_-o-y,p=s-i+x,h={...a,fontSize:a.fontSize*m},g=c*m}else{let t=d===void 0?VT(e,` `):d;l?/\d/.test(n.listMarker)?(m=`rtl`,f=v+t+c):f=v+t:f=_-c-t}t.children.unshift({type:`text`,text:n.listMarker,x:f,y:p,width:g,style:{...h,textDecorationLine:`none`,textDecorations:[],fontWeight:i?.fontWeight??400,fontStyle:i?.fontStyle??`normal`,direction:m}});let y=m===`rtl`?f-g:f;LT.push({y:Math.round(s),text:n.listMarker,bounds:{x:y,y:t.y+r.borderTopWidth+r.paddingTop,width:g,height:o.ascent+o.descent}})}function gD(e,t,n,r=!0,i){FT=r,IT=i,JT.clear(),hE.clear(),KT.clear(),BT.clear(),RT.clear(),zT.clear(),LT=[];let{box:a,height:o}=QE(e,t,0,0,n);_D(e,a,t);let s=LT.slice().sort((e,t)=>e.y-t.y||e.bounds.x-t.bounds.x),c=[];for(let e of s){let t=c[c.length-1],n=Math.min(t?.bounds.height??1/0,e.bounds.height)*.5;if(t&&Math.abs(e.y-t.y)<n){let n=t.text.length>0&&e.text.length>0&&!/\s$/.test(t.text)&&!/^\s/.test(e.text);t.text+=(n?` `:``)+e.text,t.y=Math.max(t.y,e.y);let r=Math.min(t.bounds.x,e.bounds.x),i=Math.min(t.bounds.y,e.bounds.y),a=Math.max(t.bounds.x+t.bounds.width,e.bounds.x+e.bounds.width),o=Math.max(t.bounds.y+t.bounds.height,e.bounds.y+e.bounds.height);t.bounds={x:r,y:i,width:a-r,height:o-i}}else c.push({y:e.y,text:e.text,bounds:{...e.bounds}})}return{root:a,height:o,lines:c}}function _D(e,t,n){hD(e,t,n);let r=0;for(let i of n.children)if(!(i.tagName===`#text`||fE(i)))for(;r<t.children.length;){let n=t.children[r];if(n.type===`box`&&n.tagName===i.tagName){_D(e,n,i),r++;break}r++}}function vD(e){if(!e||e===`none`)return[];let t=[],n=e.split(/,(?![^(]*\))/);for(let e of n){let n=e.trim(),r=n.match(/(rgb[a]?\([^)]+\)|#[0-9a-fA-F]+|\b[a-z]+\b)(?:\s|$)/i),i=n.match(/-?[\d.]+px/g);if(i&&i.length>=2){let e=i.map(e=>parseFloat(e));t.push({offsetX:e[0],offsetY:e[1],blur:e[2]||0,color:r?r[1]:`rgba(0,0,0,1)`})}}return t}function yD(e,t){let n=e[`border${t}Width`],r=e[`border${t}Style`];return n>0&&r!==`none`}function bD(e,t,n){let{borderTopLeftRadius:r,borderTopRightRadius:i,borderBottomRightRadius:a,borderBottomLeftRadius:o}=e;if(r===0&&i===0&&a===0&&o===0)return null;let s=[r,i,a,o].map(e=>{if(typeof e==`number`)return{x:e,y:e};let r=e.pct/100;return{x:r*t,y:r*n}}),[c,l,u,d]=s,f=1;for(let[e,r]of[[t,c.x+l.x],[t,d.x+u.x],[n,c.y+d.y],[n,l.y+u.y]])r>e&&(f=Math.min(f,e/r));return s.map(e=>({x:e.x*f,y:e.y*f}))}function xD(e,t,n,r,i,a,o){if(n=Math.round(n-i/2)+i/2,e.save(),e.strokeStyle=o,e.lineWidth=i,a===`double`){let a=Math.max(i,2);e.lineWidth=Math.max(.5,i*.5),e.beginPath(),e.moveTo(t,n-a/2),e.lineTo(t+r,n-a/2),e.moveTo(t,n+a/2),e.lineTo(t+r,n+a/2),e.stroke()}else if(a===`wavy`){let a=Math.max(1.5,i),o=a*4;e.beginPath(),e.moveTo(t,n);for(let i=t;i<t+r;i+=o)e.quadraticCurveTo(i+o/4,n-a,i+o/2,n),e.quadraticCurveTo(i+o*3/4,n+a,i+o,n);e.stroke()}else a===`dotted`?e.setLineDash([i,i*2]):a===`dashed`&&e.setLineDash([i*3,i*2]),e.beginPath(),e.moveTo(t,n),e.lineTo(t+r,n),e.stroke();e.setLineDash([]),e.restore()}function SD(e,t,n,r,i,a){let o=t.indexOf(`linear-gradient(`);if(o===-1)return null;let s=0,c=-1;for(let e=o+16;e<t.length;e++)if(t[e]===`(`)s++;else if(t[e]===`)`){if(s===0){c=e;break}s--}if(c===-1)return null;let l=t.slice(o+16,c),u=[];s=0;let d=0,f=l;for(let e=0;e<f.length;e++)f[e]===`(`?s++:f[e]===`)`?s--:f[e]===`,`&&s===0&&(u.push(f.slice(d,e).trim()),d=e+1);u.push(f.slice(d).trim());let p=180,m=0,h=u[0];h.endsWith(`deg`)?(p=parseFloat(h),m=1):h===`to right`?(p=90,m=1):h===`to left`?(p=270,m=1):h===`to bottom`?(p=180,m=1):h===`to top`&&(p=0,m=1);let g=(p-90)*Math.PI/180,_=n+r/2,v=i+a/2,y=Math.abs(r*Math.cos(g))+Math.abs(a*Math.sin(g)),b=Math.cos(g)*y/2,x=Math.sin(g)*y/2,S=e.createLinearGradient(_-b,v-x,_+b,v+x),C=u.slice(m);for(let e=0;e<C.length;e++){let t=C[e].trim(),n=t,r=e/Math.max(1,C.length-1),i=t.match(/\s+([\d.]+%)\s*$/);i&&(r=parseFloat(i[1])/100,n=t.slice(0,t.length-i[0].length).trim());try{S.addColorStop(r,n)}catch{}}return S}function CD(e){return e.webkitTextFillColor&&e.webkitTextFillColor!==`transparent`?e.webkitTextFillColor:e.color}function wD(e){return Math.max(1,Math.floor(e/10))}function TD(e){let t=e.declarer.textDecorationThickness;return t===null?wD(e.declarer.fontSize):t<=0?0:Math.max(1,Math.round(t))}function ED(e,t){let n=e.declarer.textUnderlineOffset;return n===null?e.declarer.textDecorationThickness===null?null:Math.ceil(t/2)+t/2:n+t/2}function DD(e,t,n){e.strokeStyle=n||t.webkitTextStrokeColor||t.color,e.lineWidth=t.webkitTextStrokeWidth;let r=t.strokeLinejoin;e.lineJoin=r===`miter`||r===`bevel`?r:`round`}function OD(e,t,n,r){let{style:i}=t;e.save(),e.font=qT(i),e.textBaseline=`alphabetic`,e.fontKerning=i.fontKerning===`none`?`none`:`normal`,Number.isFinite(i.letterSpacing)&&i.letterSpacing!==0&&(e.letterSpacing=`${i.letterSpacing}px`),i.wordSpacing&&(e.wordSpacing=`${i.wordSpacing}px`),i.direction===`rtl`&&(e.direction=`rtl`,e.textAlign=`right`);let a=CE(i),o=i.webkitTextStrokeWidth>0,s=i.webkitTextFillColor===`transparent`||i.color===`transparent`,c=t.clip?(t.clip.image?SD(e,t.clip.image,t.clip.x,t.clip.width,t.clip.y,t.clip.height):null)??t.clip.color??null:null,l=a||(n!=null||c!=null)&&s,u=c??n??null,d=(t.strokeImage?SD(e,t.strokeImage.image,t.strokeImage.x,t.strokeImage.width,t.strokeImage.y,t.strokeImage.height):null)??r??null,f=vD(i.textShadow);if(f.length>0){let n=l||!s;for(let r of f)e.save(),e.shadowOffsetX=r.offsetX,e.shadowOffsetY=r.offsetY,e.shadowBlur=r.blur,e.shadowColor=r.color,n&&(e.fillStyle=l&&u?u:CD(i),e.fillText(t.text,t.x,t.y)),o&&(DD(e,i,d),e.strokeText(t.text,t.x,t.y)),e.restore()}let p=()=>{l?(e.save(),e.fillStyle=u||i.color,e.fillText(t.text,t.x,t.y),e.restore()):s||(e.fillStyle=CD(i),e.fillText(t.text,t.x,t.y))},m=()=>{o&&(e.save(),DD(e,i,d),e.strokeText(t.text,t.x,t.y),e.restore())};vT(i.paintOrder)?(m(),p()):(p(),m());let h=t.width,g=i.direction===`rtl`?t.x-h:t.x;if(i.textDecorations.length>0)for(let n of i.textDecorations){let r=TD(n);if(r<=0)continue;let a=n.color;if(mE(n.color)){if(u)a=u;else continue}let o=n.style||`solid`,s=i.webkitTextStrokeWidth>0?i.webkitTextStrokeWidth:0,c=d||i.webkitTextStrokeColor||i.color,l=t=>{let n=typeof c==`string`&&mE(c);if(s>0&&!n){xD(e,g,t,h,r+s,o,c);let n=r-s;n>0&&xD(e,g,t,h,n,o,a)}else xD(e,g,t,h,r,o,a)};if(n.line===`underline`){let e=t.lineBaselineY!==void 0&&!vE(n.declarer.verticalAlign)?t.lineBaselineY:t.y,i=ED(n,r);l(i===null?e+n.declarer.fontSize*.105-.2:e+i)}else if(n.line===`line-through`)l(t.y-i.fontSize*.33);else if(n.line===`overline`){let{ascent:n}=gE(e,i);l(Math.floor(t.y-n)-r/2)}}e.restore()}var kD=/^[\p{Script=Latin}\p{Script=Cyrillic}\p{Script=Greek}\p{Mark}\p{Number}\p{Punctuation}\p{Separator}]+$/u;function AD(e){let{style:t}=e;return t.direction===`ltr`&&t.textAlign!==`justify`&&t.textDecorations.length===0&&t.textShadow===`none`&&t.webkitTextStrokeWidth===0&&!e.clip&&!e.strokeImage&&kD.test(e.text)}function jD(e,t,n=null,r=null){let{style:i}=t,a=bD(i,t.width,t.height);if(!mE(i.backgroundColor)&&i.webkitBackgroundClip!==`text`&&(e.fillStyle=i.backgroundColor,a?(e.beginPath(),e.roundRect(t.x,t.y,t.width,t.height,a),e.fill()):e.fillRect(t.x,t.y,t.width,t.height)),a!==null&&yD(i,`Top`)&&[`Right`,`Bottom`,`Left`].every(e=>i[`border${e}Width`]===i.borderTopWidth&&i[`border${e}Style`]===i.borderTopStyle&&i[`border${e}Color`]===i.borderTopColor)){let n=i.borderTopWidth;e.strokeStyle=i.borderTopColor,e.lineWidth=n,e.beginPath(),e.roundRect(t.x+n/2,t.y+n/2,t.width-n,t.height-n,a.map(e=>({x:Math.max(0,e.x-n/2),y:Math.max(0,e.y-n/2)}))),e.stroke()}else{let n=[[`Top`,t.x,t.y+i.borderTopWidth/2,t.x+t.width,t.y+i.borderTopWidth/2],[`Right`,t.x+t.width-i.borderRightWidth/2,t.y,t.x+t.width-i.borderRightWidth/2,t.y+t.height],[`Bottom`,t.x,t.y+t.height-i.borderBottomWidth/2,t.x+t.width,t.y+t.height-i.borderBottomWidth/2],[`Left`,t.x+i.borderLeftWidth/2,t.y,t.x+i.borderLeftWidth/2,t.y+t.height]];for(let[t,r,a,o,s]of n)yD(i,t)&&(e.strokeStyle=i[`border${t}Color`],e.lineWidth=i[`border${t}Width`],e.beginPath(),e.moveTo(r,a),e.lineTo(o,s),e.stroke())}if(CE(i)){let r=i.backgroundImage&&i.backgroundImage!==`none`?SD(e,i.backgroundImage,t.x,t.width,t.y,t.height):null,a=mE(i.backgroundColor)?null:i.backgroundColor;n=r??a??n}i.webkitTextStrokeImage&&i.webkitTextStrokeImage!==`none`&&(r=SD(e,i.webkitTextStrokeImage,t.x,t.width,t.y,t.height));let o=iE&&t.children.every(e=>e.type===`text`&&AD(e))?t.children:null;if(!o){for(let i of t.children)MD(e,i,n,r);return}for(let t=0;t<o.length;t++){let i=o[t],a=i.text,s=i.width;for(;t+1<o.length&&o[t+1].style===i.style&&o[t+1].y===i.y&&Math.abs(o[t+1].x-(i.x+s))<=.01;)a+=o[t+1].text,s+=o[t+1].width,t++;OD(e,{...i,text:a,width:s},n,r)}}function MD(e,t,n,r){t.type===`text`?OD(e,t,n,r):jD(e,t,n,r)}var ND=/[MmLlHhVvCcSsQqTtAaZz]/,PD=/-?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-+]?\d+)?/g;function FD(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(ND.test(r)){let i=n+1;for(;i<e.length&&!ND.test(e[i]);)i++;let a=e.slice(n+1,i),o=[],s;for(PD.lastIndex=0;s=PD.exec(a);)o.push(Number(s[0]));t.push({cmd:r,args:o}),n=i}else n++}return t}function ID(e){let t=FD(e),n=[],r=0,i=0,a=0,o=0,s=null,c=null;for(let e of t){let t=e.cmd,l=t.toUpperCase(),u=t!==l,d=e.args,f=e=>u?r+e:e,p=e=>u?i+e:e,m=!0,h=!0;switch(l){case`M`:for(let e=0;e<d.length;e+=2){let t=u&&e>0?r+d[e]:f(d[e]),s=u&&e>0?i+d[e+1]:p(d[e+1]);e===0?(r=t,i=s,a=t,o=s):(n.push({type:`L`,x0:r,y0:i,x1:t,y1:s}),r=t,i=s)}break;case`L`:for(let e=0;e<d.length;e+=2){let t=f(d[e]),a=p(d[e+1]);n.push({type:`L`,x0:r,y0:i,x1:t,y1:a}),r=t,i=a}break;case`H`:for(let e=0;e<d.length;e++){let t=u?r+d[e]:d[e];n.push({type:`L`,x0:r,y0:i,x1:t,y1:i}),r=t}break;case`V`:for(let e=0;e<d.length;e++){let t=u?i+d[e]:d[e];n.push({type:`L`,x0:r,y0:i,x1:r,y1:t}),i=t}break;case`C`:for(let e=0;e<d.length;e+=6){let t=f(d[e]),a=p(d[e+1]),o=f(d[e+2]),c=p(d[e+3]),l=f(d[e+4]),u=p(d[e+5]);n.push({type:`C`,x0:r,y0:i,c1x:t,c1y:a,c2x:o,c2y:c,x1:l,y1:u}),s={x:o,y:c},r=l,i=u}m=!1;break;case`S`:for(let e=0;e<d.length;e+=4){let t=s?2*r-s.x:r,a=s?2*i-s.y:i,o=f(d[e]),c=p(d[e+1]),l=f(d[e+2]),u=p(d[e+3]);n.push({type:`C`,x0:r,y0:i,c1x:t,c1y:a,c2x:o,c2y:c,x1:l,y1:u}),s={x:o,y:c},r=l,i=u}m=!1;break;case`Q`:for(let e=0;e<d.length;e+=4){let t=f(d[e]),a=p(d[e+1]),o=f(d[e+2]),s=p(d[e+3]);n.push({type:`Q`,x0:r,y0:i,cx:t,cy:a,x1:o,y1:s}),c={x:t,y:a},r=o,i=s}h=!1;break;case`T`:for(let e=0;e<d.length;e+=2){let t=c?2*r-c.x:r,a=c?2*i-c.y:i,o=f(d[e]),s=p(d[e+1]);n.push({type:`Q`,x0:r,y0:i,cx:t,cy:a,x1:o,y1:s}),c={x:t,y:a},r=o,i=s}h=!1;break;case`A`:for(let e=0;e<d.length;e+=7){let t=d[e],a=d[e+1],o=d[e+2],s=d[e+3]!==0,c=d[e+4]!==0,l=f(d[e+5]),u=p(d[e+6]);t===0||a===0?(r!==l||i!==u)&&n.push({type:`L`,x0:r,y0:i,x1:l,y1:u}):r===l&&i===u||n.push({type:`A`,x0:r,y0:i,rx:t,ry:a,xAxisRotation:o,largeArc:s,sweep:c,x1:l,y1:u}),r=l,i=u}break;case`Z`:(r!==a||i!==o)&&n.push({type:`L`,x0:r,y0:i,x1:a,y1:o}),r=a,i=o}m&&(s=null),h&&(c=null)}return n}function LD(e,t){let n=1-t,r=n*n,i=t*t;return{x:n*r*e.x0+3*r*t*e.c1x+3*n*i*e.c2x+i*t*e.x1,y:n*r*e.y0+3*r*t*e.c1y+3*n*i*e.c2y+i*t*e.y1}}function RD(e,t){let n=1-t;return{x:n*n*e.x0+2*n*t*e.cx+t*t*e.x1,y:n*n*e.y0+2*n*t*e.cy+t*t*e.y1}}function zD(e){let t=Math.abs(e.rx),n=Math.abs(e.ry),r=e.xAxisRotation*Math.PI/180,i=Math.cos(r),a=Math.sin(r),o=(e.x0-e.x1)/2,s=(e.y0-e.y1)/2,c=i*o+a*s,l=-a*o+i*s,u=c*c/(t*t)+l*l/(n*n);if(u>1){let e=Math.sqrt(u);t*=e,n*=e}let d=e.largeArc===e.sweep?-1:1,f=t*t*n*n-t*t*l*l-n*n*c*c,p=t*t*l*l+n*n*c*c,m=Math.sqrt(Math.max(0,f/p)),h=d*m*(t*l/n),g=d*m*(-(n*c)/t),_=i*h-a*g+(e.x0+e.x1)/2,v=a*h+i*g+(e.y0+e.y1)/2,y=(e,t,n,r)=>{let i=e*n+t*r,a=Math.sqrt((e*e+t*t)*(n*n+r*r)),o=Math.acos(Math.min(1,Math.max(-1,i/a)));return e*r-t*n<0&&(o=-o),o},b=y(1,0,(c-h)/t,(l-g)/n),x=y((c-h)/t,(l-g)/n,(-c-h)/t,(-l-g)/n);return x%=2*Math.PI,!e.sweep&&x>0?x-=2*Math.PI:e.sweep&&x<0&&(x+=2*Math.PI),{cx:_,cy:v,rx:t,ry:n,phi:r,theta1:b,deltaTheta:x,cosPhi:i,sinPhi:a}}function BD(e,t){let{cx:n,cy:r,rx:i,ry:a,cosPhi:o,sinPhi:s,theta1:c,deltaTheta:l}=zD(e),u=c+t*l,d=i*Math.cos(u),f=a*Math.sin(u);return{x:o*d-s*f+n,y:s*d+o*f+r}}var VD=40;function HD(e){let t=[],n=0;for(let r of e){if(r.type===`L`){let e=Math.hypot(r.x1-r.x0,r.y1-r.y0);t.push({startLen:n,length:e,seg:r}),n+=e;continue}let e=[],i=0,a;a=r.type===`C`||r.type===`Q`?{x:r.x0,y:r.y0}:BD(r,0),e.push({t:0,len:0});for(let t=1;t<=VD;t++){let n=t/VD,o;o=r.type===`C`?LD(r,n):r.type===`Q`?RD(r,n):BD(r,n),i+=Math.hypot(o.x-a.x,o.y-a.y),e.push({t:n,len:i}),a=o}t.push({startLen:n,length:i,seg:r,samples:e}),n+=i}function r(e){if(!Number.isFinite(e)||e<0||e>n+1e-6)return null;if(e===0&&t.length>0){let e=t[0].seg;return e.type===`L`||e.type===`C`||e.type===`Q`?{x:e.x0,y:e.y0}:BD(e,0)}for(let n=0;n<t.length;n++){let r=t[n];if(e>r.startLen+r.length+1e-6)continue;let i=e-r.startLen;if(r.seg.type===`L`){let e=r.length===0?0:Math.max(0,Math.min(1,i/r.length));return{x:r.seg.x0+(r.seg.x1-r.seg.x0)*e,y:r.seg.y0+(r.seg.y1-r.seg.y0)*e}}let a=r.samples,o=0,s=a.length-1;for(;s-o>1;){let e=o+s>>1;a[e].len<=i?o=e:s=e}let c=a[o],l=a[s],u=l.len-c.len,d=u===0?0:(i-c.len)/u,f=Math.max(0,Math.min(1,c.t+(l.t-c.t)*d));return r.seg.type===`C`?LD(r.seg,f):r.seg.type===`Q`?RD(r.seg,f):BD(r.seg,f)}return null}return{length:n,getPointAtLength:r}}function UD(e){return HD(ID(e))}var WD;function GD(){if(WD!==void 0)return WD;if(typeof Intl<`u`&&typeof Intl.Segmenter==`function`)try{WD=new Intl.Segmenter(void 0,{granularity:`grapheme`})}catch{WD=null}else WD=null;return WD}function KD(e){if(!e)return[];let t=GD();if(t){let n=[];for(let r of t.segment(e))n.push(r.segment);return n}return Array.from(e)}function qD(e,t,n){switch(e){case`alphabetic`:return 0;case`middle`:return(t-n)/2;case`top`:return t;case`bottom`:return-n;case`hanging`:return t*.8;case`ideographic`:return-n*.5}}function JD(e){let t=[];function n(e,r,i,a){let o=e.style.direction===`rtl`||r;if(e.tagName===`#text`&&e.textContent){t.push({text:e.textContent,style:e.style,rtl:o,clipStyle:i,strokeImageStyle:a});return}let s=CE(e.style)?e.style:i,c=e.style.webkitTextStrokeImage&&e.style.webkitTextStrokeImage!==`none`?e.style:a;for(let t of e.children)n(t,o,s,c)}return n(e,!1),t}var YD=RegExp(`[\\u0590-\\u05FF\\u0600-\\u06FF\\u0700-\\u074F\\u0750-\\u077F\\u0780-\\u07BF\\u07C0-\\u07FF\\u0800-\\u083F\\u0840-\\u085F\\u0860-\\u086F\\u08A0-\\u08FF\\u0900-\\u097F\\u0980-\\u09FF\\u0A00-\\u0A7F\\u0A80-\\u0AFF\\u0B00-\\u0B7F\\u0B80-\\u0BFF\\u0C00-\\u0C7F\\u0C80-\\u0CFF\\u0D00-\\u0D7F\\u0D80-\\u0DFF\\u0E00-\\u0E7F\\u0E80-\\u0EFF\\u0F00-\\u0FFF\\u1000-\\u109F\\u1780-\\u17FF\\u1800-\\u18AF\\uFB1D-\\uFB4F\\uFB50-\\uFDFF\\uFE70-\\uFEFF]`);function XD(e){return YD.test(e)}function ZD(e,t){let n=KD(t.text);if(n.length===0)return[];UT(e,t.style),e.letterSpacing=`${t.style.letterSpacing||0}px`;let{ascent:r,descent:i}=gE(e,t.style),a=[],o=``;for(let e of n){let t=e===` `;XD(e)&&!t?o+=e:(o&&=(a.push({text:o,shaped:!0,isSpace:!1}),``),a.push({text:e,shaped:!1,isSpace:t}))}o&&a.push({text:o,shaped:!0,isSpace:!1}),t.rtl&&a.reverse();let s=[];for(let n of a){let a=e.measureText(n.text).width;s.push({text:n.text,width:a,style:t.style,isSpace:n.isSpace,ascent:r,descent:i,shaped:n.shaped,clipStyle:t.clipStyle,strokeImageStyle:t.strokeImageStyle})}return s}function QD(e){let{segments:t,path:n,ctx:r,align:i,textBaseline:a}=e,o=[],s=0,c=0;for(let e of t){if(!e.text)continue;let t=e.style.lineHeight>0?e.style.lineHeight:e.style.fontSize;t>c&&(c=t);let n=ZD(r,e);n.length!==0&&(o.push(...n),s+=r.measureText(e.text).width)}let l=0;for(let e of o)l+=e.width;o.length>0&&(l-=o[o.length-1].style.letterSpacing||0);let u=Math.max(0,l-s),d=n.length,f=0,p=0;if(i===`center`)f=Math.max(0,(d-l)/2);else if(i===`right`)f=Math.max(0,d-l);else if(i===`justify`){let e=o.filter(e=>e.isSpace).length;e>0&&d>l&&(p=(d-l)/e)}let m=[],h=f,g=0;for(let e=0;e<o.length;e++){let t=o[e],r=e===o.length-1&&t.style.letterSpacing||0,i=t.width-r+(t.isSpace?p:0),a=n.getPointAtLength(h);if(!a)break;let s=h+i,c;if(s>d){if(s-d<=u+.5)c=n.getPointAtLength(d);else break}else c=n.getPointAtLength(s);if(!c)break;let l=Math.atan2(c.y-a.y,c.x-a.x);m.push({char:t.text,x:a.x,y:a.y,rotation:l,width:t.width-r,style:t.style,ascent:t.ascent,descent:t.descent,pathOffset:g,shaped:t.shaped,clipStyle:t.clipStyle,strokeImageStyle:t.strokeImageStyle}),h=s,g+=i-(t.isSpace?p:0)}$D(m,e=>e.clipStyle,(e,t)=>{e.clipRange=t}),$D(m,e=>e.strokeImageStyle,(e,t)=>{e.strokeImageRange=t});let _=eO(m,a);return{glyphs:m,textWidth:l,pathLength:d,lineHeight:c,bounds:_,textBaseline:a}}function $D(e,t,n){for(let r=0;r<e.length;){let i=t(e[r]);if(!i){r++;continue}let a=r;for(;a<e.length&&t(e[a])===i;)a++;let o=e[r].pathOffset,s=e[a-1],c={start:o,width:s.pathOffset+s.width-o};for(let t=r;t<a;t++)n(e[t],c);r=a}}function eO(e,t){if(e.length===0)return{x:0,y:0,width:0,height:0};let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let o of e){let e=o.style.lineHeight>0?o.style.lineHeight:o.style.fontSize,s=o.ascent+o.descent,c=s>0?o.ascent/s:.75,l=e*c,u=e*(1-c),d=qD(t,o.ascent,o.descent),f=d-l,p=d+u,m=Math.cos(o.rotation),h=Math.sin(o.rotation),g=[{x:o.x+-h*f,y:o.y+m*f},{x:o.x+m*o.width+-h*f,y:o.y+h*o.width+m*f},{x:o.x+m*o.width+-h*p,y:o.y+h*o.width+m*p},{x:o.x+-h*p,y:o.y+m*p}];for(let e of g)e.x<n&&(n=e.x),e.y<r&&(r=e.y),e.x>i&&(i=e.x),e.y>a&&(a=e.y)}return{x:n,y:r,width:i-n,height:a-r}}function tO(e){let{html:t,align:n=`left`,textBaseline:r=`alphabetic`}=e,i=typeof e.path==`string`?UD(e.path):e.path,a=e.ctx??rO(),o=e.ctx===void 0,{fragment:s,css:c}=aT(t),l=PT(s,c,2**53-1);o||a.save();try{return QD({segments:JD(l),path:i,ctx:a,align:n,textBaseline:r})}finally{o||a.restore()}}function nO(e){let{layout:t,ctx:n}=e;if(t.glyphs.length===0)return;let r=t.textBaseline;n.save();try{oO(n,t.glyphs,r),pO(n,t.glyphs,t.textWidth,r),_O(n,t.glyphs,t.textWidth,r)}finally{n.restore()}}function rO(){return rT(!1)}var iO=new WeakMap;function aO(e,t){if(!t)return``;let n=iO.get(e);n||(n=new Map,iO.set(e,n));let r=n.get(t);if(r!==void 0)return r;let i=e.fillStyle;try{e.fillStyle=t;let r=typeof e.fillStyle==`string`?e.fillStyle:t;return n.set(t,r),r}catch{return n.set(t,t),t}finally{e.fillStyle=i}}function oO(e,t,n){let r=e=>!mE(e.style.backgroundColor)&&e.style.webkitBackgroundClip!==`text`,i=0;for(;i<t.length;){if(!r(t[i])){i++;continue}let a=t[i].style.backgroundColor,o=aO(e,a),s=i+1;for(;s<t.length&&r(t[s])&&aO(e,t[s].style.backgroundColor)===o;)s++;cO(e,t.slice(i,s),a,n),i=s}}function sO(e,t){let n=Math.cos(e.rotation),r=Math.sin(e.rotation),i=qD(t,e.ascent,e.descent),a=i-e.ascent,o=i+e.descent,s=e.width;return{tl:{x:e.x+-r*a,y:e.y+n*a},tr:{x:e.x+n*s+-r*a,y:e.y+r*s+n*a},br:{x:e.x+n*s+-r*o,y:e.y+r*s+n*o},bl:{x:e.x+-r*o,y:e.y+n*o}}}function cO(e,t,n,r){if(t.length===0)return;e.save(),e.fillStyle=n,e.beginPath();let i=sO(t[0],r);e.moveTo(i.tl.x,i.tl.y);for(let n=0;n<t.length;n++){let i=sO(t[n],r);e.lineTo(i.tl.x,i.tl.y),e.lineTo(i.tr.x,i.tr.y)}for(let n=t.length-1;n>=0;n--){let i=sO(t[n],r);e.lineTo(i.br.x,i.br.y),e.lineTo(i.bl.x,i.bl.y)}e.closePath(),e.fill(),e.restore()}function lO(e){return e.webkitTextFillColor===`transparent`||e.color===`transparent`||mE(CD(e))}function uO(e,t,n,r){let i=t.clipStyle??(CE(t.style)?t.style:void 0);if(!i)return null;let a=t.clipRange??{start:0,width:n};return(i.backgroundImage&&i.backgroundImage!==`none`?SD(e,i.backgroundImage,a.start-t.pathOffset,a.width,r-t.ascent,t.ascent+t.descent):null)??(mE(i.backgroundColor)?null:i.backgroundColor)}function dO(e,t,n,r){let i=t.strokeImageStyle;if(!i)return null;let a=t.strokeImageRange??{start:0,width:n};return SD(e,i.webkitTextStrokeImage,a.start-t.pathOffset,a.width,r-t.ascent,t.ascent+t.descent)}function fO(e,t,n,r){return CE(t.style)||t.clipStyle!=null&&lO(t.style)?uO(e,t,n,r):lO(t.style)?null:CD(t.style)}function pO(e,t,n,r){for(let i of t){e.save(),e.translate(i.x,i.y),e.rotate(i.rotation),UT(e,i.style),e.textBaseline=`alphabetic`,e.letterSpacing=`${i.style.letterSpacing||0}px`;let t=qD(r,i.ascent,i.descent),a=fO(e,i,n,t),o=dO(e,i,n,t),s=i.style.webkitTextStrokeWidth>0,c=vD(i.style.textShadow);if(c.length>0)for(let n=c.length-1;n>=0;n--){let r=c[n];e.save(),e.shadowOffsetX=r.offsetX,e.shadowOffsetY=r.offsetY,e.shadowBlur=r.blur,e.shadowColor=r.color,a&&(e.fillStyle=a,e.fillText(i.char,0,t)),s&&(DD(e,i.style,o),e.strokeText(i.char,0,t)),e.restore()}mO(e,i,t,a,o),e.restore()}}function mO(e,t,n,r,i){let{style:a}=t,o=a.webkitTextStrokeWidth>0,s=vT(a.paintOrder||``),c=()=>{r&&(e.fillStyle=r,e.fillText(t.char,0,n))},l=()=>{o&&(e.save(),DD(e,a,i),e.strokeText(t.char,0,n),e.restore())};s?(l(),c()):(c(),l())}function hO(e,t){let n=e.textDecorations;if(n&&n.length){for(let e=n.length-1;e>=0;e--)if(n[e].line===t)return n[e];return null}return!e.textDecorationLine||!e.textDecorationLine.includes(t)?null:{line:t,color:e.textDecorationColor||e.color,style:e.textDecorationStyle||`solid`,declarer:e}}function gO(e){return e.clipStyle??(CE(e.style)?e.style:void 0)}function _O(e,t,n,r){for(let i of[`underline`,`line-through`,`overline`]){let a=0;for(;a<t.length;){let o=hO(t[a].style,i);if(!o){a++;continue}let{color:s,style:c}=o;if(mE(s)){let s=gO(t[a]);if(!s){a++;continue}let l=a+1;for(;l<t.length;){let e=hO(t[l].style,i);if(!e||!mE(e.color)||e.style!==c||!yE(e,o)||gO(t[l])!==s)break;l++}yO(e,t.slice(a,l),i,o,n,r),a=l;continue}let l=aO(e,s),u=a+1;for(;u<t.length;){let n=hO(t[u].style,i);if(!n||aO(e,n.color)!==l||n.style!==c||!yE(n,o))break;u++}bO(e,t.slice(a,u),i,o,s,r),a=u}}}function vO(e,t,n,r,i,a){let o=qD(a,e.ascent,e.descent);if(i===`underline`){let e=ED(t,r);return o+(e===null?n*.5:e)}return i===`line-through`?o-e.ascent*.3:o-e.ascent*.9}function yO(e,t,n,r,i,a){if(t.length===0)return;let o=r.style||`solid`,s=TD(r);if(s<=0)return;let c=gE(e,r.declarer).descent;for(let l of t){e.save(),e.translate(l.x,l.y),e.rotate(l.rotation);let t=uO(e,l,i,qD(a,l.ascent,l.descent));t&&xD(e,0,vO(l,r,c,s,n,a),l.width,s,o,t),e.restore()}}function bO(e,t,n,r,i,a){if(t.length===0)return;let o=r.style||`solid`,s=TD(r);if(s<=0)return;let c=gE(e,r.declarer).descent,l=e=>vO(e,r,c,s,n,a);if(o===`double`||o===`wavy`){for(let n of t)e.save(),e.translate(n.x,n.y),e.rotate(n.rotation),xD(e,0,l(n),n.width,s,o,i),e.restore();return}e.save(),e.strokeStyle=i,e.lineWidth=s,o===`dotted`?e.setLineDash([s,s*2]):o===`dashed`&&e.setLineDash([s*3,s*2]),e.beginPath();for(let n=0;n<t.length;n++){let r=t[n],i=l(r),a=Math.cos(r.rotation),o=Math.sin(r.rotation),s={x:r.x+-o*i,y:r.y+a*i},c={x:r.x+a*r.width+-o*i,y:r.y+o*r.width+a*i};n===0?e.moveTo(s.x,s.y):e.lineTo(s.x,s.y),e.lineTo(c.x,c.y)}e.stroke(),e.setLineDash([]),e.restore()}var xO=`
140
+ p {
141
+ margin: 0;
142
+ padding: 0;
143
+ overflow-wrap: break-word; /* Canonical CSS3 — Firefox honors it; render-tag's CSS resolver only parses this canonical form */
144
+ /* a text may have several spaces, we need to preserve them */
145
+ white-space: pre-wrap;
146
+ }
147
+
148
+ /* Structural list reset. Native markers are intentionally LEFT ENABLED here
149
+ (no list-style:none) so the canonical export/canvas HTML renders the
150
+ browser's NATIVE markers.
151
+
152
+ The per-level indent is carried by the <ul>/<ol> padding (2.1em), NOT the
153
+ <li>. This matters for native markers: with list-style-position outside
154
+ the marker hangs just left of the <li> border box, so the indent must sit
155
+ on the list (the marker lands inside that padding, next to the text). If
156
+ the indent were on the <li> instead, the outside marker would hang at
157
+ x near 0 and be clipped off the element's left edge. render-tag computes
158
+ the same content-start either way (it accumulates block padding).
159
+
160
+ The live editor needs the opposite box model (indent on the <li>, so its
161
+ absolutely-positioned ::before marker has room) and overrides these two
162
+ paddings in rich-editor.tsx. */
163
+ ul, ol {
164
+ padding-inline-start: 2.1em; /* Per-level indent; native outside markers hang inside it */
165
+ margin: 0;
166
+ display: block; /* Use block instead of inline-block for better text wrapping */
167
+ width: 100%;
168
+ /* border-box so width:100% INCLUDES the indent padding — otherwise the
169
+ content box overflows the element by 2.1em and native center/right
170
+ text-align drifts right (left is unaffected). render-tag already lays the
171
+ list out border-box, so this is what keeps DOM (html export) aligned with
172
+ the canvas. Editor lists override padding to 0 (rich-editor.tsx), so this
173
+ is a no-op there. */
174
+ box-sizing: border-box;
175
+ text-decoration: inherit;
176
+ }
177
+
178
+ li {
179
+ padding-inline-start: 0;
180
+ margin: 0; /* Reset default li margins */
181
+ overflow-wrap: break-word; /* Canonical CSS3 — Firefox honors it; render-tag's CSS resolver only parses this canonical form */
182
+ white-space: pre-wrap; /* Preserve spaces and allow wrapping */
183
+ }
184
+
185
+ /* Paragraph block-indent (matches walk's <p> ql-indent → margin in
186
+ rich-text-html.ts). Small step, applied to non-list indented blocks.
187
+ Editor-only in practice: the export normalizer turns <p> ql-indent into an
188
+ inline margin, so canonical export HTML carries no ql-indent class. */
189
+ .ql-indent-1 {
190
+ margin-inline-start: 0.5em;
191
+ }
192
+ .ql-indent-2 {
193
+ margin-inline-start: 1em;
194
+ }
195
+ .ql-indent-3 {
196
+ margin-inline-start: 1.5em;
197
+ }
198
+
199
+ /* List nesting indent for the live Quill editor, which renders a list FLAT
200
+ (one container, depth via ql-indent on each <li>). Each level is indented
201
+ by the SAME 2.1em render-tag adds per nested <ul>/<ol>, to stay in sync
202
+ with the canvas. Stored/exported lists are canonical-nested and carry no
203
+ ql-indent (see canonicalizeLists), so these rules are editor/legacy-only
204
+ no-ops elsewhere. */
205
+ li.ql-indent-1 {
206
+ margin-inline-start: 2.1em;
207
+ }
208
+ li.ql-indent-2 {
209
+ margin-inline-start: 4.2em;
210
+ }
211
+ li.ql-indent-3 {
212
+ margin-inline-start: 6.3em;
213
+ }
214
+ `,SO=`
215
+ <style>
216
+ html, body {
217
+ padding: 0;
218
+ margin: 0;
219
+ }
220
+ ${xO}
221
+ </style>
222
+ `,CO=`<style>${xO}
223
+ /* render-tag draws list markers natively from the <ol>/<ul> tag + tree position
224
+ (it ignores the polotno reset's ::before + counter() markers, which only work
225
+ in real DOM — the Quill editor and the foreignObject rasterizer). The shared
226
+ reset sets list-style:none for those ::before markers, which would suppress
227
+ render-tag's native ones; restore the canonical marker types here so render-tag
228
+ paints them. element.text is canonicalized to <ul>/<ol> upstream
229
+ (normalizeRichTextHtml), so the tag alone selects bullet vs. number. */
230
+ ol { list-style-type: decimal; }
231
+ ul { list-style-type: disc; }
232
+ /* Chrome's <code>/<pre> font-size UA quirk isn't reproducible on canvas — let
233
+ them inherit so DOM and canvas line up. */
234
+ code, pre, kbd, samp { font-size: inherit; }</style>`;function wO(e){return CO+e}function TO(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}var EO=/[\u0591-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]/;function DO(e){return EO.test(e)}function OO(e){e=e.replace(/\s/g,``);let t=0;for(var n=0;n<e.length;n++){let r=e[n];DO(r)&&(t+=1)}return t>e.length/2}function kO(e){return OO(e)?`rtl`:`ltr`}function AO(e){return kO(sx(e))}function jO(e){return e===`miter`||e===`bevel`?e:`round`}function MO(e,t,n,r){let i=Math.max(-.9999,Math.min(.9999,n));if(Math.abs(i)<1e-4)return`M 0 ${t/2} L ${e} ${t/2}`;let a=r*5/(2*Math.abs(i))-r,o=e/2;if(i>0){let e=a*2+r/2;return[`M ${o} ${e}`,`A ${a} ${a} 0 1 1 ${o} ${e-2*a}`,`A ${a} ${a} 0 1 1 ${o} ${e}`].join(` `)}{let e=-(a*2-Math.round(t))-r/2;return[`M ${o} ${e}`,`A ${a} ${a} 0 1 0 ${o} ${e+2*a}`,`A ${a} ${a} 0 1 0 ${o} ${e}`].join(` `)}}function NO(e,t,n){let r=wC(e);if(!r)return``;let{x1:i,y1:a,x2:o,y2:s,stops:c}=r,l=c.map(({offset:e,color:t})=>`<stop offset="${e*100}%" stop-color="${t}" />`).join(``);if(n){let e=TC({x1:i,y1:a,x2:o,y2:s},n);return`<linearGradient id="${t}" gradientUnits="userSpaceOnUse" x1="${e.x1}" y1="${e.y1}" x2="${e.x2}" y2="${e.y2}">${l}</linearGradient>`}return`<linearGradient id="${t}" x1="${i*100}%" y1="${a*100}%" x2="${o*100}%" y2="${s*100}%">${l}</linearGradient>`}var PO=null;function FO(){return PO||=document.createElement(`canvas`).getContext(`2d`),PO}function IO(e){if(!nx(e)||e.curveEnabled)return null;let t=Math.max(1,Math.round(e.height)),n=ax(e),r=Math.max(1,n*e.fontSize),i=Math.max(1,Math.floor(t/r));return{maxHeight:`${t}px`,overflow:`hidden`,display:`-webkit-box`,WebkitBoxOrient:`vertical`,WebkitLineClamp:String(i),lineClamp:String(i)}}function LO(){return typeof OffscreenCanvas<`u`?!!new OffscreenCanvas(1,1).getContext(`2d`):typeof document<`u`&&!!document.createElement(`canvas`).getContext(`2d`)}function RO(e,t,n,r,i){let a=FO(),o=0;for(let s of e){let e=s.fontFamily||t,c=s.bold?`bold`:n;a.font=`${s.italic?`italic`:r} ${c} ${s.fontSize??i}px ${Tb(e)}`,o+=a.measureText(s.text).width}return o}function zO(e,t,n,r,i,a){if(!e.some(e=>e.fontFamily&&e.fontFamily!==n)||t.length<=1)return 0;let o=RO(e,n,r,i,a),s=FO();s.font=`${i} ${r} ${a}px ${Tb(n)}`;let c=o-s.measureText(t).width;return c<=0?0:c/(t.length-1)}function BO(e,t){let n=e.a?e.a:e,r=ex(e),i=n.fontSize??r.fontSize,a=t?.normalizedText??Yb(r.text,{fontSize:i,fontFamily:r.fontFamily}),o=t?.segments??gx(a,{fontSize:i,fontFamily:r.fontFamily}),s=Math.max(i,...o.map(e=>e.fontSize??i)),c=sx(a),l=zO(o,c,r.fontFamily,r.fontWeight||`normal`,r.fontStyle||`normal`,s),u=n.width??r.width,f=new d.TextPath({data:MO(u,n.height??r.height??0,r.curvePower,s),align:`center`,textBaseline:`middle`,text:c,fontSize:s,fontFamily:Tb(r.fontFamily),fontWeight:r.fontWeight,fontStyle:r.fontStyle,letterSpacing:r.letterSpacing*s+l,fill:r.fill}),p=f.getSelfRect();return f.destroy(),{width:p.width||u,height:p.height||s}}function VO(e){return BO(e).height}function HO(e,t){return nx(e)?e.height:BO(e,t).height}function UO(e){let t=gx(e.normalizedText,{fontSize:e.fontSize,fontFamily:e.fontFamily});return{segments:t,curveFontSize:Math.max(e.fontSize,...t.map(t=>t.fontSize??e.fontSize)),segDefaults:{fontWeight:e.fontWeight||`normal`,fontStyle:e.fontStyle||`normal`,fill:e.fill||`black`,fontFamily:e.fontFamily,fontSize:e.fontSize}}}function WO(e,t,n){return e.map(e=>{let r=[];e.bold&&t.fontWeight!==`bold`&&r.push(`font-weight="bold"`),e.italic&&t.fontStyle!==`italic`&&r.push(`font-style="italic"`);let i=[];e.underline&&i.push(`underline`),e.strike&&i.push(`line-through`),i.length&&r.push(`text-decoration="${i.join(` `)}"`),!n?.omitColors&&e.color&&e.color!==t.fill&&r.push(`fill="${TO(e.color)}"`);let a=e.fontFamily||t.fontFamily;a!==t.fontFamily&&r.push(`font-family="${TO(Tb(a))}"`);let o=e.fontSize??t.fontSize;o!==t.fontSize&&r.push(`font-size="${o}"`);let s=TO(e.text);return r.length===0?s:`<tspan ${r.join(` `)}>${s}</tspan>`}).join(``)}var GO=`change-font-size`;function KO(e){if(!e.includes(`color`))return e;let t=zb(e);if(!t)return e;let n=!1;for(let e of Array.from(t.querySelectorAll(`[style]`)))e.style.color&&(e.style.backgroundImage||e.style.getPropertyValue(`-webkit-text-fill-color`)||(e.style.setProperty(`-webkit-text-fill-color`,`currentcolor`),n=!0));return n?t.innerHTML:e}function qO(e,t){let n=ex(e),r=t||n.fontFamily;return _x(Yb(n.text,{fontSize:n.fontSize,fontFamily:r})).replace(/\n/g,`<br/>`)}function JO(e,t){return e*t}function YO(e,t,n){return Math.max(1,e+JO(t,n))}function XO(e,{fontFamily:t=``,color:n=`black`,forEditor:r=!1,textOverflow:i=`resize`,text:a,textIsNormalized:o=!1}={}){let s=ex(e),c=a??s.text,l=t||s.fontFamily,u=o?c:Yb(c,{fontSize:s.fontSize,fontFamily:l}),d=vC(s.fill),f=vC(s.stroke)&&!!s.strokeWidth;(d||f)&&(u=KO(u));let p=i===`ellipsis`&&!r,m=(()=>{let e=p?IO(s):null;return e?Object.entries(e).map(([e,t])=>`${e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}: ${t}`):[]})(),h=e=>`
235
+ background-image: ${e};
236
+ background-size: 100% 100%;
237
+ background-repeat: repeat;
238
+ -webkit-background-clip: text;
239
+ -moz-background-clip: text;
240
+ background-clip: text;
241
+ -webkit-text-fill-color: transparent;
242
+ color: transparent
243
+ `.trim(),g=`color: ${n||s.fill}`,_=``;f&&s.strokeWidth?(g=d?h(s.fill):`color: ${n||s.fill}`,_=`-webkit-text-stroke: ${s.strokeWidth}px ${SC(s.stroke)}; --rt-text-stroke-image: ${s.stroke}; paint-order: stroke fill`):d&&(g=h(s.fill));let v=YO(s.width||100,s.letterSpacing,s.fontSize),y=[`white-space: pre-wrap`,`overflow-wrap: break-word`,`width: ${v}px`,...m,g,`font-size: ${s.fontSize}px`,`font-family: ${Tb(l)}`,`text-align: ${s.align}`,`text-transform: ${s.textTransform}`,`text-decoration-skip-ink: none`,s.textDecoration?`text-decoration: ${s.textDecoration}${d?``:`; text-decoration-color: ${n||s.fill}`}; text-decoration-layer: over`:``,s.lineHeight?`line-height: ${s.lineHeight}`:``,s.letterSpacing?`letter-spacing: ${s.letterSpacing}em`:``,s.fontStyle?`font-style: ${s.fontStyle}`:``,s.fontWeight?`font-weight: ${s.fontWeight}`:``,_||(s.strokeWidth?`-webkit-text-stroke: ${s.strokeWidth}px ${s.stroke}`:``),s.strokeWidth&&!f?`paint-order: stroke fill`:``,s.strokeWidth?`stroke-linejoin: ${jO(s.strokeLineJoin)}`:``].filter(Boolean).join(`; `);if(s.curveEnabled&&!r){let{segments:t,curveFontSize:r,segDefaults:i}=UO({normalizedText:u,fontSize:s.fontSize,fontFamily:l,fontWeight:s.fontWeight,fontStyle:s.fontStyle,fill:n||s.fill}),a=BO(e,{normalizedText:u,segments:t}),o=Math.round(a.width),c=a.height,p=MO(o,c,s.curvePower,r),m=WO(t,i),h=WO(t,i,{omitColors:!0}),g=TO(s.id||`temp`),_=`curve-${g}`,v=s.strokeWidth&&(f||d&&!f),y=`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${c}" overflow="visible">
244
+ <defs>
245
+ <path id="${_}" d="${p}" fill="none" />`;if(d){let e=`curve-fill-grad-${g}`;y+=NO(s.fill,e)}if(f&&s.strokeWidth){let e=`curve-stroke-grad-${g}`;y+=NO(s.stroke,e)}y+=`</defs>`;let b=TO(Tb(l)),x=TO(s.fontWeight||`normal`),S=TO(s.fontStyle||`normal`);if(v){let e=`
246
+ font-family="${b}"
247
+ font-size="${s.fontSize}"
248
+ font-weight="${x}"
249
+ font-style="${S}"
250
+ text-anchor="middle"
251
+ dominant-baseline="central"
252
+ letter-spacing="${s.letterSpacing*r}"${s.textDecoration?` text-decoration="${s.textDecoration}"`:``}`,t=f?`url(#curve-stroke-grad-${g})`:s.stroke;y+=`
253
+ <text ${e} fill="${t}" stroke="${t}" stroke-width="${s.strokeWidth}" stroke-linejoin="${jO(s.strokeLineJoin)}">
254
+ <textPath href="#${_}" startOffset="50%">${h}</textPath>
255
+ </text>`;let i=d?`url(#curve-fill-grad-${g})`:n;y+=`
256
+ <text ${e} fill="${i}">
257
+ <textPath href="#${_}" startOffset="50%">${m}</textPath>
258
+ </text>`}else{let e=d?`url(#curve-fill-grad-${g})`:n,t=f?`url(#curve-stroke-grad-${g})`:s.stroke;y+=`
259
+ <text
260
+ font-family="${b}"
261
+ font-size="${s.fontSize}"
262
+ font-weight="${x}"
263
+ font-style="${S}"
264
+ fill="${e}"
265
+ text-anchor="middle"
266
+ dominant-baseline="central"
267
+ letter-spacing="${s.letterSpacing*r}"${s.textDecoration?` text-decoration="${s.textDecoration}"`:``}${s.strokeWidth?` stroke="${t}" stroke-width="${s.strokeWidth}" stroke-linejoin="${jO(s.strokeLineJoin)}" paint-order="stroke fill"`:``}>
268
+ <textPath href="#${_}" startOffset="50%">${m}</textPath>
269
+ </text>`}return y+=`</svg>`,y}if(s.strokeWidth&&(f||d&&!f)&&!r){let e=_x(u).replace(/\n/g,`<br/>`),t=[`white-space: pre-wrap`,`overflow-wrap: break-word`,`width: ${v}px`,...m,`font-size: ${s.fontSize}px`,`font-family: ${Tb(l)}`,`text-align: ${s.align}`,`text-transform: ${s.textTransform}`,`text-decoration-skip-ink: none`,s.textDecoration?`text-decoration: ${s.textDecoration}${d?``:`; text-decoration-color: ${n||s.fill}`}; text-decoration-layer: over`:``,s.lineHeight?`line-height: ${s.lineHeight}`:``,s.letterSpacing?`letter-spacing: ${s.letterSpacing}em`:``,s.fontStyle?`font-style: ${s.fontStyle}`:``,s.fontWeight?`font-weight: ${s.fontWeight}`:``].filter(Boolean).join(`; `),r;r=f?`${t}; ${h(s.stroke)}; -webkit-text-stroke: ${s.strokeWidth}px transparent`:`${t}; color: transparent; -webkit-text-stroke: ${s.strokeWidth}px ${s.stroke}`;let i=`${t}; ${d?h(s.fill):`color: ${n||s.fill}`}`,a=``;if(d||f){let e=[];f&&s.strokeWidth&&e.push(`.stroke-layer li, .stroke-layer li::before { ${h(s.stroke)}; }`),d&&e.push(`.fill-layer li, .fill-layer li::before { ${h(s.fill)}; }`),e.length&&(a=`<style>${e.join(`
270
+ `)}</style>`)}return`
271
+ <div style="position: relative; width: ${v}px;">
272
+ <div class="stroke-layer" style="${r}; position: absolute; top: 0; left: 0; pointer-events: none;" aria-hidden="true" dir="${AO(u)}">${e}</div>
273
+ <div class="fill-layer" style="${i}; position: relative;" contentEditable dir="${AO(u)}">${e}</div>
274
+ </div>
275
+ ${a}
276
+ `}let b=``;return d&&!f&&(b=`<style>
277
+ li, li::before {
278
+ ${h(s.fill)};
279
+ }
280
+ </style>`),`<div style="${y}" contentEditable dir="${AO(u)}">${_x(u).replace(/\n/g,`<br/>`)}</div>${b}`}function ZO({fontFamily:e,fontSize:t,lineHeight:n}){if(typeof n==`number`)return n;let r=document.createElement(`div`);r.style.fontFamily=Tb(e),r.style.fontSize=t+`px`,r.style.lineHeight=n,r.innerText=`Test text`,document.body.appendChild(r);try{return r.offsetHeight/t}finally{document.body.removeChild(r)}}var QO=e=>String(Math.round(e*100)/100),$O=e=>(e.ascent-e.descent)/2,ek=e=>!e||e===`transparent`||e===`rgba(0, 0, 0, 0)`,tk=e=>e.webkitTextFillColor===`transparent`||e.color===`transparent`||ek(e.webkitTextFillColor||e.color);function nk(e,t){let n=e.webkitTextFillColor||e.color,r={"font-family":String(e.fontFamily||``),"font-size":`${e.fontSize}px`,"font-weight":String(e.fontWeight),"font-style":String(e.fontStyle),fill:tk(e)&&t.fillOverride||n};return t.strokeWidth&&t.stroke&&(r.stroke=t.stroke,r[`stroke-width`]=String(t.strokeWidth),r[`stroke-linejoin`]=jO(t.strokeLineJoin),r[`paint-order`]=`stroke fill`),r}var rk=[{line:`underline`,a:0,d:.5},{line:`line-through`,a:-.3,d:0},{line:`overline`,a:-.9,d:0}],ik=(e,t)=>$O(e)+t.a*e.ascent+t.d*e.descent,ak=e=>Math.max(1,Math.floor(e/10)),ok=(e,t,n)=>{let r=Math.cos(e.rotation),i=Math.sin(e.rotation);return{x:e.x+r*t-i*n,y:e.y+i*t+r*n}};function sk(e,t){let n=e.textDecorations;if(n&&n.length){for(let e=n.length-1;e>=0;e--)if(n[e].line===t)return{color:n[e].color,style:n[e].style||`solid`};return null}return String(e.textDecorationLine||``).includes(t)?{color:e.textDecorationColor||e.color,style:e.textDecorationStyle||`solid`}:null}var ck=e=>{let t=q(e);return t.isValid()?t.toRgbString():String(e)};function lk(e,t){return e===`dotted`?`${QO(t)} ${QO(t*2)}`:e===`dashed`?`${QO(t*3)} ${QO(t*2)}`:null}function uk(e,t){if(!e.some(e=>sk(e.style,`underline`)||sk(e.style,`line-through`)||sk(e.style,`overline`)))return``;let n=``;for(let r of rk){let i=0;for(;i<e.length;){let a=sk(e[i].style,r.line);if(!a){i++;continue}let o=ck(a.color),s=ak(e[i].style.fontSize),c=i+1;for(;c<e.length;){let t=sk(e[c].style,r.line);if(!t||ck(t.color)!==o||t.style!==a.style)break;c++}let l=e.slice(i,c).map((e,t)=>{let n=ik(e,r),i=ok(e,0,n),a=ok(e,e.width,n);return`${t===0?`M`:`L`}${QO(i.x)} ${QO(i.y)}L${QO(a.x)} ${QO(a.y)}`}).join(``),u=lk(a.style,s);n+=`<path d="${l}" fill="none" stroke="${TO(ek(a.color)&&t||a.color)}" stroke-width="${QO(s)}"`+(u?` stroke-dasharray="${u}"`:``)+`/>`,i=c}}return n}function dk(e){let t=e=>{let t=e.style;return!ek(t.backgroundColor)&&t.webkitBackgroundClip!==`text`},n=e=>{let t=$O(e)-e.ascent,n=$O(e)+e.descent;return{tl:ok(e,0,t),tr:ok(e,e.width,t),br:ok(e,e.width,n),bl:ok(e,0,n)}},r=``,i=0;for(;i<e.length;){if(!t(e[i])){i++;continue}let a=e[i].style.backgroundColor,o=ck(a),s=i+1;for(;s<e.length&&t(e[s])&&ck(e[s].style.backgroundColor)===o;)s++;let c=e.slice(i,s).map(n),l=`M${QO(c[0].tl.x)} ${QO(c[0].tl.y)}`+c.map(e=>`L${QO(e.tl.x)} ${QO(e.tl.y)}L${QO(e.tr.x)} ${QO(e.tr.y)}`).join(``)+c.slice().reverse().map(e=>`L${QO(e.br.x)} ${QO(e.br.y)}L${QO(e.bl.x)} ${QO(e.bl.y)}`).join(``)+`Z`;r+=`<path d="${l}" fill="${TO(a)}" stroke="none"/>`,i=s}return r}function fk(e){return Object.entries(e).map(([e,t])=>` ${e}="${TO(t)}"`).join(``)}function pk(e){let t=e.element,n=tO({html:wO(XO(t,{text:e.normalizedText,textIsNormalized:!0,forEditor:!0,color:t.fill})),path:e.path,align:`center`,textBaseline:`middle`}),{bounds:r}=n,i={fillOverride:e.fillOverride,stroke:e.strokeOverride||t.stroke,strokeWidth:t.strokeWidth,strokeLineJoin:t.strokeLineJoin},a=n.glyphs.filter(e=>e.char),o=a.map(e=>nk(e.style,i)),s={};if(o.length)for(let[e,t]of Object.entries(o[0]))o.every(n=>n[e]===t)&&(s[e]=t);let c=e=>fk(Object.fromEntries(Object.entries(e).filter(([e])=>!(e in s)))),l=e=>e.shaped&&[...e.char].length>1,u=e=>({x:e.x-$O(e)*Math.sin(e.rotation),y:e.y+$O(e)*Math.cos(e.rotation),deg:e.rotation*180/Math.PI}),d=a.length>0&&a.every((e,t)=>!l(e)&&[...e.char].length===1&&c(o[t])===``),f;if(d){let e=a.map(u);f=`<text x="${e.map(e=>QO(e.x)).join(` `)}" y="${e.map(e=>QO(e.y)).join(` `)}" rotate="${e.map(e=>QO(e.deg)).join(` `)}">${TO(a.map(e=>e.char).join(``))}</text>`}else f=a.map((e,t)=>{if(l(e)){let n=e.rotation*180/Math.PI,r=e.style.letterSpacing,i=r?` letter-spacing="${QO(r)}px"`:``;return`<g transform="translate(${QO(e.x)} ${QO(e.y)}) rotate(${QO(n)})"><text y="${QO($O(e))}"${i}${c(o[t])}>${TO(e.char)}</text></g>`}let n=u(e);return`<text x="${QO(n.x)}" y="${QO(n.y)}" rotate="${QO(n.deg)}"${c(o[t])}>${TO(e.char)}</text>`}).join(``);let p={transform:`translate(${QO((t.width-r.width)/2-r.x)}, ${QO(-r.y)})`,"xml:space":`preserve`,...s};return{markup:dk(a)+f+uk(a,e.fillOverride),groupAttrs:p,groupAttrsString:fk(p),bounds:r}}var mk=new Set;function hk(e){let t=String(e?.message??e);mk.has(t)||(mk.add(t),console.warn(`curved text fell back to <textPath> (no canvas backend to measure glyphs; geometry will not match the canvas):`,e))}var gk;(function(e){e.sepia=`sepia`,e.grayscale=`grayscale`,e.natural=`natural`,e.warm=`warm`,e.cold=`cold`,e.temperature=`temperature`,e.contrast=`contrast`,e.shadows=`shadows`,e.white=`white`,e.black=`black`,e.vibrance=`vibrance`,e.saturation=`saturation`})(gk||={});function _k(e,t){let n={filter:``,html:void 0};switch(e){case gk.warm:{let e=Math.max(0,Math.min(1,t??.5)),r=1+.3*e,i=1+.15*e;return n.filter=`url(#warm-filter)`,n.html=`
281
+ <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
282
+ <filter id="warm-filter" color-interpolation-filters="sRGB">
283
+ <feColorMatrix type="matrix" values="
284
+ ${r} 0 0 0 0
285
+ 0 ${i} 0 0 0
286
+ 0 0 1 0 0
287
+ 0 0 0 1 0" />
288
+ </filter>
289
+ </svg>`,n}case gk.cold:{let e=Math.max(0,Math.min(1,t??.5)),r=1-.15*e,i=1-.1*e,a=1+.15*e;return n.filter=`url(#cold-filter)`,n.html=`
290
+ <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
291
+ <filter id="cold-filter" color-interpolation-filters="sRGB">
292
+ <feColorMatrix type="matrix" values="
293
+ ${r} 0 0 0 0
294
+ 0 ${i} 0 0 0
295
+ 0 0 ${a} 0 0
296
+ 0 0 0 1 0" />
297
+ </filter>
298
+ </svg>`,n}case`natural`:{let e=Math.max(0,Math.min(1,t??.5)),r=1+.1*e;return n.filter=`saturate(${1+.3*e}) brightness(${r}) contrast(${1+.2*e})`,n}case gk.temperature:{let e=Math.max(-1,Math.min(1,t??0)),r=1+.15*e,i=1-.15*e;return n.filter=`url(#temperature-filter)`,n.html=`
299
+ <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
300
+ <filter id="temperature-filter" color-interpolation-filters="sRGB">
301
+ <feColorMatrix type="matrix" values="
302
+ ${r} 0 0 0 0
303
+ 0 1 0 0 0
304
+ 0 0 ${i} 0 0
305
+ 0 0 0 1 0" />
306
+ </filter>
307
+ </svg>
308
+ `,n}case gk.contrast:{let e=Math.max(-1,Math.min(1,t??0))*100,r=259*(e+255)/(255*(259-e)),i=.5*(1-r);return n.filter=`url(#contrast-filter)`,n.html=`
309
+ <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
310
+ <filter id="contrast-filter" color-interpolation-filters="sRGB">
311
+ <feComponentTransfer>
312
+ <feFuncR type="linear" slope="${r}" intercept="${i}" />
313
+ <feFuncG type="linear" slope="${r}" intercept="${i}" />
314
+ <feFuncB type="linear" slope="${r}" intercept="${i}" />
315
+ </feComponentTransfer>
316
+ </filter>
317
+ </svg>
318
+ `,n}case gk.shadows:{let e=Math.min(Math.max(1-.6*Math.max(-1,Math.min(1,t??0)),.4),2.5);return n.filter=`url(#shadows-filter)`,n.html=`
319
+ <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
320
+ <filter id="shadows-filter" color-interpolation-filters="sRGB">
321
+ <feComponentTransfer>
322
+ <feFuncR type="gamma" amplitude="1" exponent="${e}" offset="0" />
323
+ <feFuncG type="gamma" amplitude="1" exponent="${e}" offset="0" />
324
+ <feFuncB type="gamma" amplitude="1" exponent="${e}" offset="0" />
325
+ </feComponentTransfer>
326
+ </filter>
327
+ </svg>
328
+ `,n}case gk.white:return null;case gk.black:return null;case gk.vibrance:{let e=Math.max(-1,Math.min(1,t??0)),r=.299,i=.587,a=.114,o;o=e>=0?1+e*1.5:1+e;let s=1-o,c=s*r+o,l=s*i,u=s*a,d=s*r,f=s*i+o,p=s*a,m=s*r,h=s*i,g=s*a+o;return n.filter=`url(#vibrance-filter)`,n.html=`
329
+ <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
330
+ <filter id="vibrance-filter" color-interpolation-filters="sRGB">
331
+ <feColorMatrix type="matrix" values="
332
+ ${c} ${l} ${u} 0 0
333
+ ${d} ${f} ${p} 0 0
334
+ ${m} ${h} ${g} 0 0
335
+ 0 0 0 1 0" />
336
+ </filter>
337
+ </svg>
338
+ `,n}case gk.saturation:{let e=Math.max(-1,Math.min(1,t??0)),r=.2126,i=.7152,a=.0722,o=1+e,s=1-o,c=s*r+o,l=s*i,u=s*a,d=s*r,f=s*i+o,p=s*a,m=s*r,h=s*i,g=s*a+o;return n.filter=`url(#saturation-filter)`,n.html=`
339
+ <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
340
+ <filter id="saturation-filter" color-interpolation-filters="sRGB">
341
+ <feColorMatrix type="matrix" values="
342
+ ${c} ${l} ${u} 0 0
343
+ ${d} ${f} ${p} 0 0
344
+ ${m} ${h} ${g} 0 0
345
+ 0 0 0 1 0" />
346
+ </filter>
347
+ </svg>
348
+ `,n}default:return null}}var vk=new Set([`image`,`svg`,`video`,`gif`,`figure`]);function yk(e){return!!e.blurEnabled&&vk.has(e.type)&&Sk(e)>0}function bk(e){let t=[],n=[],r=[];if(e.blurEnabled&&t.push(`blur(${Sk(e)/2}px)`),e.brightnessEnabled&&t.push(`brightness(${e.brightness*100+100}%)`),e.sepiaEnabled&&t.push(`sepia()`),e.grayscaleEnabled&&t.push(`grayscale()`),e.filters)for(let[n,i]of Object.entries(e.filters)){let e=_k(gk[n],i.intensity);e&&(t.push(e.filter),e.html&&r.push(e.html))}if(e.shadowEnabled){let t=iw(e.shadowColor,e.shadowOpacity??1);n.push(`drop-shadow(${e.shadowOffsetX}px ${e.shadowOffsetY}px ${e.shadowBlur/2}px ${t})`)}return{boxFilters:t,spreadFilters:n,additionalHTML:r}}function xk(e,t,n){return e/1e3*Math.min(t,n)}function Sk(e){return e.cropWidth===void 0?e.blurRadius:xk(e.blurRadius,e.width/(e.cropWidth||1),e.height/(e.cropHeight||1))}async function Ck(e){return new Promise((t,n)=>{let r=Sb.createElement(`video`);r.crossOrigin=`anonymous`,r.src=e,r.addEventListener(`loadedmetadata`,()=>{let{videoWidth:e,videoHeight:n}=r;t({width:e,height:n})}),r.addEventListener(`error`,t=>{let r=e.slice(0,100);n(s(`VIDEO_FAILED`,`Failed to load video: ${r}`,{src:r,reason:`load`}))})})}async function wk(e){return new Promise(t=>{let n=Sb.createElement(`video`);n.crossOrigin=`anonymous`,n.src=e,n.addEventListener(`loadedmetadata`,()=>{let{duration:e}=n;t(e)})})}var Tk=new Set([`p`,`div`,`br`,`ul`,`ol`,`li`,`span`,`b`,`strong`,`i`,`em`,`u`,`s`,`strike`,`del`]),Ek=new Set([`style`,`script`]),Dk=new Set([`style`,`class`,`data-list`,`dir`,`start`,`value`]);function Ok(e){if(!ux(e))return TO(e);let t;try{t=Cb(e).body}catch{return e}return t?(kk(t),t.innerHTML):e}function kk(e){for(let t of Array.from(e.children)){let n=(t.tagName||``).toLowerCase();if(Ek.has(n)){t.remove();continue}kk(t);for(let e of t.getAttributeNames())Dk.has(e.toLowerCase())||t.removeAttribute(e);if(!Tk.has(n)){let n=e.ownerDocument.createElement(`span`);for(let e of t.getAttributeNames())n.setAttribute(e,t.getAttribute(e));n.append(...t.childNodes),t.replaceWith(n)}}}function Ak(e,t){return Object.keys(e.values).forEach(n=>e.values[n]=e.values[n]&&parseFloat(e.values[n].toFixed(t))),e}function jk(e,t,n){let r=t-1,i=n[Fk(r,n.length)];return i.marker===`Z`?jk(e,r,n):i}function Mk(e,t,n){let r=t+1,i=n[Fk(r,n.length)];return i.marker===`Z`?Mk(e,r,n):i}function Nk(e,t,n){let r=n[t-1]||{values:{x:0,y:0}};if(e.marker===e.marker.toLowerCase())switch(e.marker=e.marker.toUpperCase(),e.marker){case`M`:e.values.x+=r.values.x,e.values.y+=r.values.y;break;case`L`:case`A`:e.values.x+=r.values.x,e.values.y+=r.values.y;break;case`H`:e.marker=`L`,e.values.x+=r.values.x,e.values.y=r.values.y;break;case`V`:e.marker=`L`,e.values.x=r.values.x,e.values.y+=r.values.y;break;case`C`:e.values.x+=r.values.x,e.values.y+=r.values.y,e.values.x1+=r.values.x,e.values.y1+=r.values.y,e.values.x2+=r.values.x,e.values.y2+=r.values.y;break;case`S`:e.values.x+=r.values.x,e.values.y+=r.values.y,e.values.x2+=r.values.x,e.values.y2+=r.values.y;break;case`Q`:e.values.x+=r.values.x,e.values.y+=r.values.y,e.values.x1+=r.values.x,e.values.y1+=r.values.y;break;case`T`:e.values.x+=r.values.x,e.values.y+=r.values.y}else if(e.marker===e.marker.toUpperCase())switch(e.marker){case`H`:e.marker=`L`,e.values.y=r.values.y;break;case`V`:e.marker=`L`,e.values.x=r.values.x}if(e.marker===`Z`){function r(e,t){return e[t].marker===`M`?e[t]:r(e,t-1)}let i=r(n,t);e.values.x=i.values.x,e.values.y=i.values.y}return e}function Pk(e,t){let n=[];switch(e.toUpperCase()){case`M`:for(let r=0;r<t.length;r+=2){let i;i=e===e.toUpperCase()?r===0?`M`:`L`:r===0?`m`:`l`,n.push({marker:i,values:{x:t[r],y:t[r+1]}})}break;case`L`:for(let r=0;r<t.length;r+=2)n.push({marker:e,values:{x:t[r],y:t[r+1]}});break;case`H`:for(let r=0;r<t.length;r++)n.push({marker:e,values:{x:t[r],y:0}});break;case`V`:for(let r=0;r<t.length;r++)n.push({marker:e,values:{x:0,y:t[r]}});break;case`C`:for(let r=0;r<t.length;r+=6)n.push({marker:e,values:{x1:t[r],y1:t[r+1],x2:t[r+2],y2:t[r+3],x:t[r+4],y:t[r+5]}});break;case`S`:for(let r=0;r<t.length;r+=4)n.push({marker:e,values:{x2:t[r],y2:t[r+1],x:t[r+2],y:t[r+3]}});break;case`Q`:for(let r=0;r<t.length;r+=4)n.push({marker:e,values:{x1:t[r],y1:t[r+1],x:t[r+2],y:t[r+3]}});break;case`T`:for(let r=0;r<t.length;r+=2)n.push({marker:e,values:{x:t[r],y:t[r+1]}});break;case`A`:for(let r=0;r<t.length;r+=7)n.push({marker:e,values:{radiusX:t[r],radiusY:t[r+1],rotation:t[r+2],largeArc:t[r+3],sweep:t[r+4],x:t[r+5],y:t[r+6]}});break;case`Z`:n.push({marker:e,values:{x:0,y:0}})}return n}function Fk(e,t){return(e%t+t)%t}function Ik(e,t,n){if(t!==0&&e.marker===`L`){let r=n[t-1];[`x`,`y`].every(t=>Math.round(Math.abs(r.values[t]-e.values[t]))===0)&&(e.overlap=!0)}return e}function Lk(e,t){let n=[`x`,`y`].every(n=>Math.round(Math.abs(e[t].values[n]-e[0].values[n]))===0);e[t].marker===`L`&&n&&(e[t].overlap=!0,Lk(e,t-1)),e[t].marker===`Z`&&Lk(e,t-1)}function Rk(e,t,n){let r=Bk(e.values,n.values),i=Bk(t.values,e.values);return Math.min(i,r)}function zk(e,t){return Math.atan2(t.x-e.x,t.y-e.y)}function Bk(e,t){let n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n**2+r**2)}function Vk(e,t){return Math.sin(e)*t}function Hk(e,t){return Math.cos(e)*t}function Uk(e,t){let n=t/Math.tan(e);return n===1/0||n===-1/0||isNaN(n)?t:n}function Wk(e,t){return t*Math.tan(e)}function Gk(e,t){let n,r=0,i=180/Math.PI*e;return i<0&&i>=-180||i>180&&i<360?n=Uk(e/2,-t):(n=Uk(e/2,t),r=1,n===1/0&&(n=t)),{offset:n,sweepFlag:r}}function Kk(e){let t=[`radiusX`,`radiusY`,`rotation`,`largeArc`,`sweep`,`x1`,`y1`,`x2`,`y2`,`x`,`y`];return e.map(e=>{let n=``;if(e.marker!==`Z`){let r=Object.keys(e.values);n=t.filter(e=>r.indexOf(e)!==-1).map(t=>e.values[t]).join()}return`${e.marker}${n}`}).join(``).trim()}function qk(e){let t=/[MmLlSsQqLlHhVvCcSsQqTtAaZz]/g,n=/-?[0-9]*\.?\d+/g;return[...e.matchAll(t)].map(e=>({marker:e[0],index:e.index})).reduceRight((t,n)=>{let r=e.substring(n.index,t.length?t[t.length-1].index:e.length);return t.concat([{marker:n.marker,index:n.index,chunk:r.length>0?r.substr(1,r.length-1):r}])},[]).reverse().flatMap(e=>{let t=e.chunk.match(n),r=t?t.map(parseFloat):[];return Pk(e.marker,r)}).map(Nk)}function Jk(e,t,n){let r=[],i=[];return n&&e.forEach(e=>Ak(e,n)),e.forEach(e=>{e.marker===`M`&&r.push([]),r[r.length-1].push(e)}),r.forEach(e=>{e.map(Ik),Lk(e,e.length-1);let n=e[e.length-1].marker==`Z`;e.filter(e=>!e.overlap).map((e,r,a)=>{let o=jk(e,r,a),s=Mk(e,r,a),c=zk(e.values,o.values),l=zk(e.values,s.values),u=l-c,d=180/Math.PI*u,f=Rk(e,o,s),p=Math.abs(Wk(u/2,f/2)),m=Math.min(t,p),h=Gk(u,m),g=h.offset,_=h.sweepFlag,v=(r==0||r==a.length-1)&&!n;switch(e.marker){case`M`:case`L`:let t=[e.values.x+Vk(c,g),e.values.y+Hk(c,g)],n=[e.values.x+Vk(l,g),e.values.y+Hk(l,g)];v?i.push({marker:e.marker,values:e.values}):i.push({marker:e.marker,values:{x:parseFloat(t[0].toFixed(3)),y:parseFloat(t[1].toFixed(3))}}),!v&&(s.marker===`L`||s.marker===`M`)&&i.push({marker:`A`,radius:m,values:{radiusX:parseFloat(m.toFixed(3)),radiusY:parseFloat(m.toFixed(3)),rotation:d,largeArc:0,sweep:_,x:parseFloat(n[0].toFixed(3)),y:parseFloat(n[1].toFixed(3))}});break;case`C`:case`S`:case`Q`:case`T`:case`A`:case`Z`:i.push({marker:e.marker,values:e.values})}})}),{path:Kk(i),commands:i}}function Yk(e,t){return t?{...e,right:Math.max(e.left,e.right-t)}:e}function Xk(e){if(e.length<2)return e;let t=[e[0]];for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];if(i.top-r.bottom>Math.max(r.bottom-r.top,i.bottom-i.top)*.5){let e=Math.max(r.left,i.left),n=Math.min(r.right,i.right);n>e&&t.push({left:e,right:n,top:r.bottom,bottom:i.top})}t.push(i)}return t}function Zk(e){if(e.length<2)return e;let t=.5,n=[e[0]];for(let r=1;r<e.length;r++){let i=n[n.length-1],a=e[r];Math.abs(i.left-a.left)<t&&Math.abs(i.right-a.right)<t&&Math.abs(i.bottom-a.top)<t?n[n.length-1]={...i,bottom:a.bottom}:n.push(a)}return n}function Qk({rects:e,padding:t=0,cornerRadius:n=0}){let r=Zk(Xk(e)),i=r.length;if(i===0)return``;let a=e=>e.right-e.left,o=e=>{let t=r[e-1],n=r[e];return t?n?(t.bottom+n.top)/2:t.bottom:n.top},s=`M ${(r[0].left+r[0].right)/2} ${r[0].top-t}`;for(let e=0;e<i;e++){let n=r[e],i=r[e-1],c=r[e+1],l=n.right+t,u=i?a(i)>a(n)?o(e)+t:o(e)-t:n.top-t;s+=` L ${l} ${u}`;let d=c?a(c)>a(n)?o(e+1)-t:o(e+1)+t:n.bottom+t;s+=` L ${l} ${d}`}for(let e=i-1;e>=0;e--){let n=r[e],i=r[e-1],c=r[e+1],l=n.left-t,u=c?a(c)>a(n)?o(e+1)-t:o(e+1)+t:n.bottom+t;s+=` L ${l} ${u}`;let d=i?a(i)>a(n)?o(e)+t:o(e)-t:n.top-t;s+=` L ${l} ${d}`}return s+=` Z`,Jk(qk(s),n).path}function $k({lines:e,lineHeight:t,width:n,align:r}){return e.flatMap((e,i)=>{if(e.width<=0)return[];let a=e.contentBox?.left??0,o=e.contentBox?.right??n,s=e.width,c=r;r===`justify`&&(e.lastInParagraph?c=e.alignLast??`left`:s=o-a);let l,u;c===`right`?(u=o,l=o-s):c===`center`?(l=a+(o-a-s)/2,u=l+s):(l=a,u=a+s);let d=e.box?e.box.top:i*t,f=e.box?e.box.height:t;return[{left:l,right:u,top:d,bottom:d+f}]})}var eA,tA=()=>(eA||(eA=document.createElement(`div`),eA.id=`polotno-hidden-do-not-touch`,eA.style.overflow=`hidden`,eA.style.position=`relative`,document.body.appendChild(eA),eA.innerHTML=`<style>#polotno-hidden-do-not-touch {${xO}}</style>`),eA);function nA({html:e}){let t=document.createElement(`div`);t.innerHTML=e,t.style.display=`inline-block`,t.style.position=`fixed`,t.style.top=`0px`,t.style.left=`0px`,t.style.zIndex=`1000`,t.style.whiteSpace=`nowrap`,t.style.visibility=`hidden`;let n=tA();n.appendChild(t);let r=t.innerText,i=t.childNodes[0];i.style.whiteSpace=`nowrap`;let a=r?.split(/\s+/)||[],o=!1;for(let e=0;e<a.length;e++){let n=a[e];if(i&&(i.textContent=n,o=i.scrollWidth>t.clientWidth,o))break}return n.removeChild(t),o}function rA(e){let t=document.createElement(`div`);t.innerHTML=e,t.style.display=`inline-block`,t.style.position=`fixed`,t.style.top=`0px`,t.style.left=`0px`,t.style.zIndex=`1000`;let n=tA();n.appendChild(t);let r=t.getBoundingClientRect();return n.removeChild(t),{width:r.width,height:r.height}}function iA(e){let t=document.createElement(`div`);t.innerHTML=e,t.style.display=`inline-block`,t.style.position=`fixed`,t.style.top=`0px`,t.style.left=`0px`,t.style.zIndex=`1000`;let n=tA();n.appendChild(t);let r=t.getBoundingClientRect(),i=[],a=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),o=a.nextNode();for(;o;){let e=o.nodeValue||``;if(e.length>0){let t=document.createRange();t.setStart(o,0),t.setEnd(o,e.length);let n=t.getClientRects(),a=o.parentElement,s=0;if(a){let e=parseFloat(window.getComputedStyle(a).letterSpacing);Number.isNaN(e)||(s=e)}for(let e=0;e<n.length;e++){let t=n[e];(t.width!==0||t.height!==0)&&i.push({left:t.left-r.left,right:t.right-r.left,top:t.top-r.top,bottom:t.bottom-r.top,letterSpacing:s})}}o=a.nextNode()}n.removeChild(t);let s={width:r.width,height:r.height};if(i.length===0)return{rects:[],...s};i.sort((e,t)=>e.top-t.top||e.left-t.left);let c=[];for(let e of i){let t=c[c.length-1];if(t){let n=Math.min(t.bottom,e.bottom)-Math.max(t.top,e.top),r=Math.min(t.bottom-t.top,e.bottom-e.top);if(r>0&&n>r*.5){e.right>t.right&&(t.trailingLetterSpacing=e.letterSpacing),t.left=Math.min(t.left,e.left),t.right=Math.max(t.right,e.right),t.top=Math.min(t.top,e.top),t.bottom=Math.max(t.bottom,e.bottom);continue}}c.push({left:e.left,right:e.right,top:e.top,bottom:e.bottom,trailingLetterSpacing:e.letterSpacing})}return{rects:c.map(({trailingLetterSpacing:e,...t})=>Yk(t,e)),...s}}function aA(e){return iA(e).rects}var oA=e=>rA(e).height,sA=.02,cA=.5,lA=.02,uA=.05,dA=1,fA=49;function pA(e,t={}){let{getHtmlOptions:n={},measureHeight:r=oA,textSplitAllowed:i=!1}=t,a=Yb(e.text,{fontSize:e.fontSize,fontFamily:e.fontFamily}),o=t=>nx(e)&&r(t)>e.height+.02||!i&&!e.curveEnabled&&nA({html:t});if(Qb(a)){let t=1,r;for(let i=0;i<fA;i++){let i;if(t===1?i=XO(e,{...n,text:a,textIsNormalized:!0}):(r=Zb(e.text,t),i=XO({...e,fontSize:e.fontSize*t},{...n,text:r})),!o(i))break;t-=sA,r=void 0;let s=Math.max(uA,dA/e.fontSize);if(t<s){t=s;break}}return t>=1?{fontSize:e.fontSize}:{fontSize:e.fontSize*t,text:r??Zb(e.text,t)}}let s=e.fontSize,c={...n,text:a,textIsNormalized:!0};for(let t=0;t<fA&&o(XO({...e,fontSize:s},c));t++)if(s-=cA,s<dA){s=dA;break}return{fontSize:s}}function mA({element:e,shrink:t,layoutAt:n}){let r=e.fontSize,i=n(r);if(!t||!nx(e))return{result:i,fontSize:r};let a=()=>i.height>e.height+lA;if(a()){let t=Yb(e.text,{fontSize:e.fontSize,fontFamily:e.fontFamily||`sans-serif`}),o=Qb(t),s=dA/e.fontSize,c=1;for(;a()&&!(o?c<=s:r<=dA);)o?(c=Math.max(s,c-sA),r=e.fontSize*c,i=n(r,Zb(e.text,c))):(r=Math.max(dA,r-cA),i=n(r,t,!0))}return{result:i,fontSize:r}}var hA=e=>e.borderSize>0?Math.max(1,Math.round(e.borderSize)):0,gA=e=>hA(e)>0&&vC(e.borderColor),_A=e=>{let t=hA(e);return{boxSizing:`border-box`,backgroundOrigin:`border-box`,borderRadius:e.cornerRadius+`px`,border:t?`${t}px solid ${gA(e)?`transparent`:e.borderColor}`:`none`}},vA=(e,t)=>e?J(`div`,{style:{width:`100%`,height:`100%`,...e}},t):t,yA=(e,t)=>vA(gA(e)&&{borderRadius:e.cornerRadius+`px`,background:e.borderColor},t),bA=(e,t,n=`0 0`)=>({"mask-image":`url(${e})`,"mask-size":t,"mask-position":n,"mask-repeat":`no-repeat`,"-webkit-mask-image":`url(${e})`,"-webkit-mask-size":t,"-webkit-mask-position":n,"-webkit-mask-repeat":`no-repeat`}),xA=async({element:e,page:t,store:n,cache:r})=>{let{src:i}=e,a=e.type===`svg`&&!!e.maskSrc,s=``;e.type===`svg`&&(s=await rw(i,{cache:r}).catch(e=>{throw o(e)}),Object.keys(e.colorsReplace).length&&(s=yw(s,new Map(Object.entries(e.colorsReplace)))),a||(i=aw(ow(s))));let c=``;e.flipX&&(c+=`scaleX(-1)`),e.flipY&&(c+=`scaleY(-1)`),c||=`none`;let l=null,u=null;if(a&&(l=bA(aw(e.stretchEnabled?ow(s):mw(s)),e.stretchEnabled?`100% 100%`:`cover`,`${e.flipX?`100%`:`0`} ${e.flipY?`100%`:`0`}`),i=e.maskSrc),e.clipSrc){let t=e.clipSrc;u=bA(sw(t)?aw(ow(await rw(t,{cache:r}).catch(e=>{throw o(e)}))):await nw(t,{cache:r,binary:!0}).catch(e=>{throw o(e)}),`100% 100%`)}let d=await Tw(i),{cropScaledX:f,cropScaledY:p,cropScaledWidth:m,cropScaledHeight:h}=Aw(a?{...e,...Mw(e,d),stretchEnabled:!0}:e,d),g=J(`div`,{style:{width:`100%`,height:`100%`,..._A(e),...gA(e)&&{backgroundClip:`padding-box`},backgroundRepeat:`no-repeat`,backgroundImage:`url(${i})`,transform:c,backgroundSize:`${Math.round(m)}px ${Math.round(h)}px`,backgroundPositionX:`${-Math.round(f)}px`,backgroundPositionY:`${-Math.round(p)}px`}});return yA(e,vA(u,vA(l&&{...l,transform:c},g)))},SA=(e,t,n)=>{if(t!==`change-font-size`||!nx(e)||e.curveEnabled||!e.text)return e;try{let r=pA(e,{getHtmlOptions:{textOverflow:t},textSplitAllowed:n});return r.fontSize===e.fontSize?e:{...e,fontSize:r.fontSize,...r.text===void 0?{}:{text:r.text}}}catch{return e}},CA={image:xA,svg:xA,text:async({element:e,page:t,store:n,textOverflow:r,textSplitAllowed:i})=>{e=SA({...e,text:Ok(e.text)},r,i);let a=ax(e),o=vC(e.fill),s=vC(e.stroke),c=r===`ellipsis`?IO(e):null,l=e.text;if(e.curveEnabled){let t=Yb(l,{fontSize:e.fontSize,fontFamily:e.fontFamily}),{segments:n,curveFontSize:r,segDefaults:i}=UO({normalizedText:t,fontSize:e.fontSize,fontFamily:e.fontFamily,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fill:e.fill}),c;try{c=HO(e,{normalizedText:t,segments:n})}catch{c=e.fontSize*a}let u=MO(e.width,c,e.curvePower,e.fontSize),d=null;if(LO())try{d=pk({element:e,normalizedText:t,path:u,fillOverride:o?`url(#curve-fill-grad-${e.id})`:void 0,strokeOverride:s?`url(#curve-stroke-grad-${e.id})`:void 0})}catch(e){hk(e)}let f=[];d||f.push(`<path id="curve-${e.id}" d="${u}" fill="none" />`),o&&f.push(NO(e.fill,`curve-fill-grad-${e.id}`,d?.bounds)),s&&e.strokeWidth&&f.push(NO(e.stroke,`curve-stroke-grad-${e.id}`,d?.bounds));let p=f.filter(Boolean).join(``),m=`
349
+ <svg xmlns="http://www.w3.org/2000/svg" width="${e.width}" height="${c}" style="display: block; overflow: visible;">${p?`<defs>${p}</defs>`:``}`;if(d)m+=`<g${d.groupAttrsString}>${d.markup}</g></svg>`;else{let t=WO(n,i);m+=`
350
+ <text
351
+ font-family="${Tb(e.fontFamily)}"
352
+ font-size="${e.fontSize}"
353
+ font-weight="${e.fontWeight}"
354
+ font-style="${e.fontStyle}"
355
+ fill="${o?`url(#curve-fill-grad-${e.id})`:e.fill}"
356
+ text-anchor="middle"
357
+ dominant-baseline="central"
358
+ letter-spacing="${e.letterSpacing*r}"${e.textDecoration?` text-decoration="${e.textDecoration}"`:``}${e.strokeWidth?` stroke="${s?`url(#curve-stroke-grad-${e.id})`:e.stroke}" stroke-width="${e.strokeWidth}" stroke-linejoin="${jO(e.strokeLineJoin)}" paint-order="stroke fill"`:``}>
359
+ <textPath href="#curve-${e.id}" startOffset="50%">${t}</textPath>
360
+ </text>
361
+ </svg>`}let h=e.backgroundPadding*(e.fontSize*a);return J(`div`,{style:{position:`relative`,width:`100%`,height:`100%`}},e.backgroundEnabled&&J(`div`,{style:{position:`absolute`,top:-h/2+`px`,left:-h/2+`px`,width:e.width+h+`px`,height:c+h+`px`,backgroundColor:e.backgroundColor,opacity:e.backgroundOpacity,borderRadius:e.backgroundCornerRadius*(e.fontSize*a*.5)+`px`}}),J(`div`,{style:{width:`100%`,height:`100%`,position:`absolute`,top:0,left:0},innerHTML:m}))}let u=e=>({backgroundImage:e,backgroundSize:`100% 100%`,backgroundRepeat:`repeat`,WebkitBackgroundClip:`text`,MozBackgroundClip:`text`,backgroundClip:`text`,WebkitTextFillColor:`transparent`,MozTextFillColor:`transparent`,color:`transparent`}),d=nx(e)?e.verticalAlign:`top`,f=d===`middle`?{top:`50%`,transform:`translateY(-50%)`}:d===`bottom`?{bottom:0}:{top:0},p={left:0,...f,...o?u(e.fill):{}},m=/<[a-z][\s\S]*>/i.test(l),h=m?Yb(l,{fontSize:e.fontSize,fontFamily:e.fontFamily}):null;h&&(o||s&&e.strokeWidth)&&(h=KO(h));let g=()=>h?XO(e,{textOverflow:r,text:h,textIsNormalized:!0}):XO(e,{textOverflow:r}),_=null;if(!e.backgroundEnabled)_=null;else if(e.legacyBackground){let t=e.backgroundPadding*(e.fontSize*a),n=nx(e)?e.height:(()=>{try{return iA(g()).height}catch{return e.fontSize*a}})();_=J(`div`,{style:{position:`absolute`,top:-t/2+`px`,left:-t/2+`px`,display:`block`,width:e.width+t+`px`,height:n+t+`px`,backgroundColor:e.backgroundColor,opacity:e.backgroundOpacity,borderRadius:e.backgroundCornerRadius*(e.fontSize*a*.5)+`px`}})}else{let t=[],n=0;try{let e=iA(g());t=e.rects,n=e.height}catch{t=[]}if(t.length){let r=e.backgroundPadding*(e.fontSize*a*.5),i=e.backgroundCornerRadius*(e.fontSize*a*.5),o=Qk({rects:t,padding:r,cornerRadius:i});if(o){let i=0;d===`middle`?i=(e.height-n)/2:d===`bottom`&&(i=e.height-n);let a=Math.min(...t.map(e=>e.top)),s=Math.max(...t.map(e=>e.bottom)),c=Math.min(...t.map(e=>e.left)),l=Math.max(...t.map(e=>e.right)),u=c-r,f=a-r,p=l-c+r*2,m=s-a+r*2;_=J(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:p,height:m,viewBox:`${u} ${f} ${p} ${m}`,style:{position:`absolute`,top:i+f+`px`,left:u+`px`,opacity:e.backgroundOpacity,pointerEvents:`none`},innerHTML:`<path d="${o}" fill="${e.backgroundColor}" />`})}}}let v=h??l.split(`
362
+ `).join(`<br />`),y=AO(h??l)===`rtl`?{dir:`rtl`}:null,b=YO(e.width,e.letterSpacing,e.fontSize);if(e.strokeWidth&&(s||o&&!s)){let t={position:`absolute`,width:b+`px`,whiteSpace:`pre-wrap`,overflowWrap:`break-word`,fontSize:e.fontSize+`px`,textAlign:e.align,fontFamily:Tb(e.fontFamily),textDecoration:e.textDecoration||`none`,textDecorationColor:e.textDecoration?e.fill:void 0,textDecorationSkipInk:`none`,textTransform:e.textTransform||`none`,lineHeight:e.lineHeight,letterSpacing:e.letterSpacing*e.fontSize+`px`,fontStyle:e.fontStyle,fontWeight:e.fontWeight,...c},n=s?{...t,...u(e.stroke),WebkitTextStroke:`${e.strokeWidth}px transparent`}:{...t,color:`transparent`,WebkitTextStroke:`${e.strokeWidth}px ${e.stroke}`},r=o?{...t,...u(e.fill)}:{...t,color:e.fill},i=`el-`+e.id,a=i+`-stroke`,l=m?`<style>#${i}, #${a} {${xO}}</style>`:``,d=J(`div`,{style:{...n,position:`absolute`,top:0,left:0,pointerEvents:`none`},"aria-hidden":`true`,...y,...m?{id:a}:{},innerHTML:m?`${l}${v}`:v}),p=J(`div`,{style:{...r,position:`relative`},...y,...m?{id:i}:{},innerHTML:m?`${l}${v}`:v});return J(`div`,{style:{position:`relative`,width:`100%`,height:`100%`}},_,J(`div`,{style:{position:`absolute`,width:e.width+`px`,left:0,...f}},d,p))}let x={...p,position:`absolute`,width:b+`px`,color:e.fill,whiteSpace:`pre-wrap`,overflowWrap:`break-word`,fontSize:e.fontSize+`px`,textAlign:e.align,fontFamily:Tb(e.fontFamily),textDecoration:e.textDecoration||`none`,textDecorationColor:e.textDecoration?e.fill:void 0,textDecorationSkipInk:`none`,textTransform:e.textTransform||`none`,lineHeight:e.lineHeight,letterSpacing:e.letterSpacing*e.fontSize+`px`,fontStyle:e.fontStyle,fontWeight:e.fontWeight,WebkitTextStroke:e.strokeWidth?`${e.strokeWidth}px ${e.stroke}`:void 0,paintOrder:e.strokeWidth?`stroke fill`:void 0,...c},S=`el-`+e.id,C=m?{id:S}:{},w=`<style>#${S} {${xO}}</style>`,T=J(`div`,{style:x,...y,...C,innerHTML:m?`${w}${v}`:v});return J(`div`,{style:{position:`relative`,width:`100%`,height:`100%`}},_,T)},line:async({element:e})=>J(`svg`,{style:{display:`block`,width:`100%`,height:`100%`,contain:`layout style size`,overflow:`visible`}},...Iw(e)),figure:async({element:e,page:t,store:n})=>{let r=eT(e);if(e.strokeWidth&&vC(e.stroke)){let t=`figure-stroke-grad-${e.id}`,n=NO(e.stroke,t);r=tT(r,`stroke`,e.stroke,t),r=r.replace(`</defs>`,`${n}</defs>`)}if(vC(e.fill)){let t=`figure-fill-grad-${e.id}`,n=NO(e.fill,t);r=tT(r,`fill`,e.fill,t),r=r.replace(`</defs>`,`${n}</defs>`)}return J(`div`,{innerHTML:r})},group:async({element:e,page:t,store:n,elementHook:r,textOverflow:i,textSplitAllowed:a,cache:o})=>{let s=await Promise.all(e.children.map(e=>wA({element:e,page:t,store:n,elementHook:r,textOverflow:i,textSplitAllowed:a,cache:o})));return J(`div`,{style:{transformOrigin:`top left`,opacity:e.opacity}},...s)},video:async({element:e,page:t,store:n})=>{let{cropWidth:r,cropHeight:i}=e,a=await Ck(e.src),o=Ow(e,a),s=o.width/r,c=o.height/i,l=o.x,u=o.y,d=Math.max(e.width/a.width,e.height/a.height),f=hA(e),p={position:`absolute`,width:`${Math.round(s*d)}px`,height:`${Math.round(c*d)}px`,left:`${-Math.round(l*d)-f}px`,top:`${-Math.round(u*d)-f}px`,objectFit:`fill`},m=`video-${e.id}`;return yA(e,J(`div`,{style:{position:`relative`,width:`100%`,height:`100%`,overflow:`hidden`,..._A(e)}},J(`video`,{id:m,src:e.src,style:p,controls:!0,playsInline:!0,muted:!0,volume:e.volume})))},gif:xA,table:async({element:e})=>{let t=e.rows,n=e.cols,r=e.colWidths,i=e.rowHeights,a=kf(e),o=(r,i)=>{let a=0,o=r===`top`||r===`bottom`?n:t;for(let t=0;t<o;t++){let n=i(t);if(!n||n.mergedInto)continue;let o=Af(n,e,r);o.style!==`none`&&o.width>a&&(a=o.width)}return a/2},s=o(`top`,e=>a[e]),c=o(`bottom`,e=>a[(t-1)*n+e]),l=o(`left`,e=>a[e*n]),u=o(`right`,e=>a[e*n+n-1]),d=(e,t,n,r)=>Math.max(0,e*t-n-r),f=t=>d(r[t],e.width,t===0?l:0,t===n-1?u:0),p=n=>d(i[n],e.height,n===0?s:0,n===t-1?c:0),m=Math.max(0,e.width-l-u),h=Math.max(0,e.height-s-c),g=[];for(let r=0;r<t;r++){let t=[];for(let i=0;i<n;i++){let o=a[r*n+i];if(!o||o.mergedInto)continue;let s=o.cellPadding,c=o.colSpan||1,l=o.rowSpan||1,u=t=>{if(t===`top`&&r>0||t===`left`&&i>0)return`none`;let n=Af(o,e,t);return`${n.width}px ${n.style} ${n.color}`},d={style:{padding:s+`px`,background:o.cellBackground,fontSize:o.fontSize+`px`,fontFamily:Tb(o.fontFamily),fontWeight:o.fontWeight,fontStyle:o.fontStyle,color:o.fill,textAlign:o.align,verticalAlign:o.verticalAlign,lineHeight:String(o.lineHeight),letterSpacing:o.letterSpacing?o.letterSpacing*o.fontSize+`px`:void 0,textDecoration:o.textDecoration||`none`,textDecorationSkipInk:`none`,textTransform:o.textTransform,borderTop:u(`top`),borderRight:u(`right`),borderBottom:u(`bottom`),borderLeft:u(`left`),overflow:`hidden`,overflowWrap:`break-word`,whiteSpace:`pre-wrap`,boxSizing:`border-box`,height:p(r)+`px`}};c>1&&(d.colspan=String(c)),l>1&&(d.rowspan=String(l)),t.push(J(`td`,d,sx(o.text||``)))}g.push(J(`tr`,{},...t))}let _=r.map((e,t)=>J(`col`,{style:{width:f(t)+`px`}}));return J(`table`,{style:{width:m+`px`,height:h+`px`,borderCollapse:`collapse`,tableLayout:`fixed`}},J(`colgroup`,{},..._),J(`tbody`,{},...g))}};async function wA({element:e,page:t,store:n,elementHook:r,textOverflow:i,textSplitAllowed:a,cache:o}){let s=await CA[e.type];if(s||(s=()=>J(`div`,{}),console.error(`HTML export does not support ${e.type} type...`)),!(e.visible??!0))return null;let c=await s({element:e,page:t,store:n,elementHook:r,textOverflow:i,textSplitAllowed:a,cache:o}),{boxFilters:l,spreadFilters:u,additionalHTML:d}=bk(e),f=yk(e),p=vA(f&&{filter:l.join(` `),clipPath:`inset(0)`},c);return Nw(r,J(`div`,{id:e.id,style:{position:`absolute`,left:e.x+`px`,top:e.y+`px`,width:e.width+`px`,height:e.height+`px`,transform:`rotate(${e.rotation}deg)`,transformOrigin:`top left`,opacity:e.opacity,display:(e.visible??!0)&&(e.showInExport??!0)?`block`:`none`,filter:(f?u:[...l,...u]).join(` `)||`none`}},p,...d),e)}async function TA({page:e,store:t,elementHook:n,textOverflow:r,textSplitAllowed:i,cache:a}){let o=Rw(e.children),s=await Promise.all(o.map(o=>wA({element:o,page:e,store:t,elementHook:n,textOverflow:r,textSplitAllowed:i,cache:a}))),c=e.width===`auto`?t.width:e.width,l=e.height===`auto`?t.height:e.height,u={};if(Lw(e.background)){let{width:n,height:r}=await Tw(e.background),i=await xA({element:{x:0,y:0,width:c,height:l,src:e.background,cornerRadius:0,...Mw({width:c,height:l},{width:n,height:r})},page:e,store:t,cache:a});s.unshift(i)}else u=vC(e.background)?{...u,backgroundImage:e.background}:{...u,backgroundColor:e.background};return J(`div`,{className:`page`,id:e.id,style:{...u,width:c+`px`,height:l+`px`,overflow:`hidden`,position:`relative`}},...s)}async function EA(e,t={}){let{elementHook:n,textSplitAllowed:r=!1}=t,i=t.textOverflow===`resize`||t.textOverflow===`ellipsis`?t.textOverflow:GO,a=tp(e,{mode:`partial`,requirePages:!1,fillMissingIds:!0,preserveClientData:!0}),o={buffers:new Map},s=await Promise.all(a.pages.map(e=>TA({page:e,store:a,elementHook:n,textOverflow:i,textSplitAllowed:r,cache:o})));return J(`div`,{className:`design`},...$b(a).map(e=>{let t=a.fonts.find(t=>t.fontFamily===e);return t?J(`style`,{},Kx(t).map(e=>`
363
+ @font-face {
364
+ font-family: ${Tb(t.fontFamily)};
365
+ src: ${e.src};
366
+ font-style: ${e.fontStyle};
367
+ font-weight: ${e.fontWeight};
368
+ font-display: swap;
369
+ }`).join(`
370
+ `)):J(`link`,{href:bx(e),rel:`stylesheet`})}),...s)}var DA=(e,t)=>t==null||t===``?``:typeof t==`object`?`${e}="${Object.keys(t).map(e=>`${e.replace(/-([a-z])/g,e=>e[1].toUpperCase())}:${t[e]};`).join(` `)}"`:`${e}="${t}"`,OA=({dom:e})=>{if(typeof e==`string`)return e;if(!e)return``;let{innerHTML:t,...n}=e.props,r=Object.keys(n).map(e=>e===`style`&&typeof n[e]==`object`?`style="${Object.keys(n[e]).filter(t=>n[e][t]!=null).map(t=>`${t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}: ${n[e][t]}`).join(`; `)}"`:DA(e,n[e])).filter(e=>e&&e.trim().length>0).join(` `);return`<${e.type} ${r}>${t||e.children.map(e=>OA({dom:e})).join(``)}</${e.type}>`};async function kA(e,t={}){return OA({dom:await EA(e,t)})}var AA=null;function jA(e){let{html:t,width:n,height:r,accuracy:i=`performance`,debug:a}=e;if(!n||n<=0||Number.isNaN(n))throw TypeError(`layout: width must be a positive number, got ${n}`);let o=i===`balanced`,{fragment:s,css:c}=aT(t),l=PT(s,c,n),u=e.ctx??AA??(AA=rT(!0));u.fontKerning=`normal`;let{root:d,height:f,lines:p}=gD(u,l,n,o,a);return{layoutRoot:d,height:r||f,lines:p}}function MA(e){let{layout:t,width:n,pixelRatio:r=globalThis.devicePixelRatio??1}=e;if(e.ctx&&e.canvas)throw TypeError(`drawLayout: ctx and canvas are mutually exclusive — provide one or neither`);let i=t.height,a,o;if(e.ctx)o=e.ctx,a=e.ctx.canvas;else{if(!e.canvas&&typeof document>`u`)throw Error(`render-tag: drawLayout cannot create a canvas in a non-browser environment — pass ctx or canvas.`);a=e.canvas??document.createElement(`canvas`),a.width=Math.ceil(n*r),a.height=Math.ceil(i*r),`style`in a&&(a.style.width=`${n}px`,a.style.height=`${i}px`),o=a.getContext(`2d`),o.scale(r,r)}return MD(o,t.layoutRoot),{canvas:a}}function NA(e,t,n){let r=(t.textDecorationLine||``).split(/\s+/).filter(e=>e&&!(n.textDecorationLine||``).includes(e));return{text:e,bold:Rb(t.fontWeight)||void 0,italic:t.fontStyle===`italic`||void 0,color:t.color===n.color?void 0:t.color,underline:r.includes(`underline`)||void 0,strike:r.includes(`line-through`)||void 0,fontFamily:t.fontFamily===n.fontFamily?void 0:Fb(t.fontFamily)??void 0,fontSize:t.fontSize===n.fontSize?void 0:t.fontSize}}var PA;function FA(){return PA||=typeof OffscreenCanvas<`u`?new OffscreenCanvas(1,1).getContext(`2d`):document.createElement(`canvas`).getContext(`2d`),PA}function IA(e){let t=e.lineHeight,n=gE(FA(),e),r=sE(t,n.ascent,n.descent);return{ascent:r,descent:t-r}}var LA=/[\s\u00AD\u200B-\u200D\uFEFF]/g;function RA(e){return e.replace(LA,``).length}function zA(e,t){let n=new Set,r=zb(e);if(!r)return n;let i=0,a=e=>{for(let r of Array.from(e.childNodes)){if(r.nodeType===3){i+=RA(tx(r.nodeValue||``,t));continue}if(r.nodeType!==1)continue;let e=r;e.tagName.toLowerCase()===`br`?n.add(i):a(e)}};return a(r),n}function BA(e,t,n){let r=[],i=null,a=new Map,o=e=>({left:e.x,right:e.x+e.width,isRtl:e.style.direction===`rtl`}),s=(e,t,n)=>{let r=IA(e.style);return{runs:[],baseline:t+r.ascent,top:t,height:r.ascent+r.descent,box:o(e),marker:n,lastInParagraph:!0,block:e}},c=e=>{let t=a.get(e)??null;return a.delete(e),t},l=(e,t)=>{let n=IA(e.style),i={...s(e,t-n.ascent,c(e)),baseline:t};return r.push(i),i},u=(e,t)=>{let{ascent:n,descent:r}=IA(t),i=Math.min(e.top,e.baseline-n),a=Math.max(e.top+e.height,e.baseline+r);e.top=i,e.height=a-i},d=(e,n)=>{if(e.type===`text`){if(n.listMarker&&n.children[0]===e)return a.set(n,{text:e.text,x:e.x,y:e.y,fontSize:e.style.fontSize,letterSpacing:e.style.letterSpacing,rtl:e.style.direction===`rtl`}),!1;let r=e.lineBaselineY??e.y;return(!i||i.baseline!==r||i.block!==n)&&(i=l(n,r)),u(i,e.style),i.runs.push({seg:NA(e.text,e.style,t),width:e.width}),!0}let o=!1;for(let t of e.children)d(t,e)&&(o=!0);let f=e.children.some(e=>e.type===`box`);return!o&&!f&&(e.height>0||a.has(e))?(i=null,r.push(s(e,e.y,c(e))),!0):o};d(e,e);let f=[],p=(e,t,n)=>{if(n<=t)return;let r=IA(e.style),i=r.ascent+r.descent;if(!(i>0))return;let a=n;for(let n of e.children)n.type===`box`&&n.y>=t-.5&&n.y<a&&(a=n.y);let o=t;for(;a-o>=i*.5;)f.push(s(e,o,null)),o+=i},m=e=>e.top+e.height,h=e=>e.block.y+e.block.height,g=null;for(let e of r)g&&g.block!==e.block&&p(g.block,m(g),h(g)),p(e.block,g&&g.block===e.block?m(g):e.block.y,e.top),f.push(e),g=e;g&&p(g.block,m(g),h(g));for(let e=0;e<f.length-1;e++)f[e+1].block===f[e].block&&(f[e].lastInParagraph=!1);if(n.size){let e=0;for(let t of f){for(let n of t.runs)e+=RA(n.seg.text);n.has(e)&&(t.lastInParagraph=!0)}}return f}function VA(e,{shrink:t}){let n=Math.max(1,e.width),r={...e,fill:vC(e.fill)?`black`:e.fill,stroke:vC(e.stroke)?`black`:e.stroke,align:e.align===`justify`?`left`:e.align},{result:i,fontSize:a}=mA({element:e,shrink:t,layoutAt:(t,i,a=!1)=>jA({html:wO(XO({...r,fontSize:t},{fontFamily:e.fontFamily,color:r.fill||`black`,textOverflow:`resize`,text:i,textIsNormalized:a})),width:n,accuracy:`performance`,ctx:FA()})}),o=(i.layoutRoot.children.find(e=>e.type===`box`)??i.layoutRoot).style,s=/<br|\n/i.test(e.text)?zA(qO(e),e.textTransform||`none`):new Set;return{lines:BA(i.layoutRoot,o,s),height:i.height,fontSize:a}}function HA(e,t,n){let r=wC(e);if(!r)return null;let{x1:i,y1:a,x2:o,y2:s,stops:c}=r,l=c.map(({offset:e,color:t})=>J(`stop`,{offset:`${e*100}%`,"stop-color":t}));return J(`linearGradient`,n?{id:t,gradientUnits:`userSpaceOnUse`,...TC({x1:i,y1:a,x2:o,y2:s},n)}:{id:t,x1:`${i*100}%`,y1:`${a*100}%`,x2:`${o*100}%`,y2:`${s*100}%`},...l)}var UA=(e,t)=>e===`center`?`middle`:e===`right`==(t===`rtl`)?`start`:`end`,WA=(e,t)=>nw(e,{cache:t,binary:!0}).catch(t=>(console.error(`Error converting URL to data URL:`,t),e)),GA=async({element:e,page:t,store:n,cache:r})=>{let[i,a,s]=await Promise.all([e.type===`svg`?rw(e.src,{cache:r}).then(t=>bw(t,new Map(Object.entries(e.colorsReplace)))):WA(e.src,r),e.clipSrc?WA(e.clipSrc,r):void 0,e.maskSrc?WA(e.maskSrc,r):void 0]).catch(e=>{throw o(e)}),c=``;if(e.flipX||e.flipY){let t=e.flipX?-1:1,n=e.flipY?-1:1,r=e.width/2,i=e.height/2;c=`translate(${r}, ${i}) scale(${t}, ${n}) translate(${-r}, ${-i})`}let l=e.clipSrc?`clip-img-mask-${e.id}`:void 0,u=e.maskSrc?`mask-img-${e.id}`:void 0,d=!!(u&&s),{cropScaledX:f,cropScaledY:p,cropScaledWidth:m,cropScaledHeight:h}=Aw(e,await Tw(i)),g=`clip-${e.id}`,_=e.cornerRadius||0,v=Dw(e),y=i.replace(/&/g,`&amp;`),b={x:-f,y:-p,width:m,height:h,preserveAspectRatio:`none`,"clip-path":`url(#${g})`},x=[J(`clipPath`,{id:g},J(`rect`,{x:v,y:v,width:Math.max(0,e.width-v*2),height:Math.max(0,e.height-v*2),rx:Math.max(0,_-v)||void 0,ry:Math.max(0,_-v)||void 0}))];l&&a&&x.push(J(`mask`,{id:l,maskUnits:`userSpaceOnUse`,"mask-type":`alpha`},J(`image`,{href:a.replace(/&/g,`&amp;`),x:0,y:0,width:e.width,height:e.height,preserveAspectRatio:`none`}))),d&&x.push(J(`mask`,{id:u,maskUnits:`userSpaceOnUse`,"mask-type":`alpha`},J(`image`,{href:y,...b,transform:c||void 0})));let S=y,C=b,w={};if(d){S=s.replace(/&/g,`&amp;`),w.mask=`url(#${u})`;let t=await Tw(s),n=Mw(e,t),r=Aw({...e,...n,stretchEnabled:!0},t);C={...b,x:-r.cropScaledX,y:-r.cropScaledY,width:r.cropScaledWidth,height:r.cropScaledHeight}}let T={};l&&(T.mask=`url(#${l})`);let E=e.borderSize||0,D=E>0&&vC(e.borderColor),O=D?`border-grad-${e.id}`:null;if(D){let t=HA(e.borderColor,O);t&&x.push(t)}let k=E>0?J(`rect`,{x:E/2,y:E/2,width:Math.max(0,e.width-E),height:Math.max(0,e.height-E),fill:`none`,stroke:D?`url(#${O})`:e.borderColor,"stroke-width":E,rx:Math.max(0,_-E)||void 0,ry:Math.max(0,_-E)||void 0}):null,A=J(`g`,{},J(`defs`,{},...x),J(`image`,{href:S,...C,...w}));return J(`g`,T,c&&!d?J(`g`,{transform:c},A):A,k)},KA=async({element:e,textOverflow:t})=>{let n=ax(e),r=vC(e.fill),i=vC(e.stroke),a=t===`change-font-size`,o=t=>t.forEach(t=>{t.text=tx(t.text,e.textTransform)});if(e.curveEnabled){let t=Yb(e.text,{fontSize:e.fontSize,fontFamily:e.fontFamily}),{segments:a,curveFontSize:s,segDefaults:c}=UO({normalizedText:t,fontSize:e.fontSize,fontFamily:e.fontFamily,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fill:e.fill}),l;try{l=HO(e,{normalizedText:t,segments:a})}catch{l=e.fontSize*n}let u=MO(e.width,l,e.curvePower,e.fontSize),d=TO(e.id||`temp`),f=`curve-path-${d}`,p=null;if(LO())try{p=pk({element:e,normalizedText:t,path:u,fillOverride:r?`url(#curve-fill-grad-${d})`:void 0,strokeOverride:i?`url(#curve-stroke-grad-${d})`:void 0})}catch(e){hk(e)}let m=e.backgroundPadding*(e.fontSize*n*.5),h=e.backgroundEnabled?J(`rect`,{x:-m,y:-m,width:e.width+m*2,height:l+m*2,fill:e.backgroundColor,opacity:e.backgroundOpacity,rx:e.backgroundCornerRadius*(e.fontSize*n*.5),ry:e.backgroundCornerRadius*(e.fontSize*n*.5)}):null,g=p?[]:[J(`path`,{id:f,d:u,fill:`none`})];if(r){let t=`curve-fill-grad-${d}`,n=HA(e.fill,t,p?.bounds);n&&g.push(n)}if(i&&e.strokeWidth){let t=`curve-stroke-grad-${d}`,n=HA(e.stroke,t,p?.bounds);n&&g.push(n)}if(p)return J(`g`,{},h,g.length?J(`defs`,{},...g):null,J(`g`,{...p.groupAttrs,innerHTML:p.markup}));o(a);let _=e.strokeWidth&&(i||r&&!i),v=WO(a,c),y=WO(a,c,{omitColors:!0});if(_){let t={"font-size":e.fontSize+`px`,"text-anchor":`middle`,"dominant-baseline":`central`,"font-family":Tb(e.fontFamily),"font-style":e.fontStyle,"font-weight":e.fontWeight,"text-decoration":e.textDecoration||void 0,"letter-spacing":e.letterSpacing*s},n=i?`url(#curve-stroke-grad-${d})`:e.stroke,a=J(`text`,{...t,fill:n,"stroke-width":e.strokeWidth,stroke:n,"stroke-linejoin":jO(e.strokeLineJoin)},J(`textPath`,{href:`#${f}`,startOffset:`50%`,innerHTML:y})),o=r?`url(#curve-fill-grad-${d})`:e.fill,c=J(`text`,{...t,fill:o},J(`textPath`,{href:`#${f}`,startOffset:`50%`,innerHTML:v}));return J(`g`,{},h,g.length?J(`defs`,{},...g):null,a,c)}return J(`g`,{},h,g.length?J(`defs`,{},...g):null,J(`text`,{fill:r?`url(#curve-fill-grad-${d})`:e.fill,"font-size":e.fontSize+`px`,"text-anchor":`middle`,"dominant-baseline":`central`,"font-family":Tb(e.fontFamily),"font-style":e.fontStyle,"font-weight":e.fontWeight,"text-decoration":e.textDecoration||void 0,"letter-spacing":e.letterSpacing*s,"stroke-width":e.strokeWidth||void 0,stroke:e.strokeWidth?i?`url(#curve-stroke-grad-${d})`:e.stroke:void 0,"stroke-linejoin":e.strokeWidth?jO(e.strokeLineJoin):void 0,"paint-order":e.strokeWidth?`stroke fill`:void 0},J(`textPath`,{href:`#${f}`,startOffset:`50%`,innerHTML:v})))}let s=VA(e,{shrink:a}),{lines:c,fontSize:l}=s,u=ox(e,s.height),d=e.verticalAlign===`middle`?(u-s.height)/2:e.verticalAlign===`bottom`?u-s.height:0,f=l*n,p=AO(e.text),m=UA(e.align,p),h=p===`rtl`?`rtl`:void 0,g={fontWeight:e.fontWeight||`normal`,fontStyle:e.fontStyle||`normal`,fill:e.fill||`black`,fontFamily:e.fontFamily,fontSize:l},_=e=>Math.round(e*1e3)/1e3,v=e=>{let t=e.length;for(;t>0&&e[t-1].seg.text.trim()===``;)t--;return e.slice(0,t)},y=e=>e.reduce((e,t)=>e+t.width,0),b=e=>e.some(e=>e.seg.text===` `),x=(t,n)=>{if(e.align!==`justify`||t.lastInParagraph||b(n))return;let r=n.reduce((e,t)=>e+t.seg.text.split(` `).length-1,0);if(r===0)return;let i=t.box.right-t.box.left-y(n);if(!(i<=0))return`${_(i/r)}px`},S=(e,t)=>{if(!b(e))return WO(e.map(e=>e.seg),g,t);let n=``,r=0,i=[],a=()=>{if(i.length===0)return;let e=WO(i,g,t);n+=r>0?`<tspan dx="${_(r)}">${e}</tspan>`:e,r=0,i=[]};for(let t of e){if(t.seg.text.trim()===``){a(),r+=t.width;continue}i.push(t.seg)}return a(),n},C=t=>e.align===`justify`&&t.lastInParagraph&&t.box.isRtl,w=t=>e.align===`center`?(t.box.left+t.box.right)/2:e.align===`right`?t.box.right:t.box.left,T=e=>c.map(t=>{let n=v(t.runs);return J(`tspan`,{x:C(t)?t.box.right:w(t),"text-anchor":C(t)?UA(`right`,p):void 0,y:d+t.baseline,"word-spacing":x(t,n),innerHTML:n.length===0?`​`:S(n,{omitColors:e})})}),E=c.flatMap(e=>{let t=e.marker;return t?[J(`tspan`,{x:t.x,y:d+t.y,direction:t.rtl?`rtl`:void 0,"unicode-bidi":t.rtl?`isolate`:void 0,"letter-spacing":t.letterSpacing?t.letterSpacing+`px`:void 0,"font-size":`${_(t.fontSize)}px`,innerHTML:TO(t.text)})]:[]}),D=e.strokeWidth?i?`url(#text-stroke-grad-${e.id})`:e.stroke:void 0,O=t=>E.length===0?null:J(`text`,{"font-size":l+`px`,"text-anchor":`start`,"font-family":Tb(e.fontFamily),"font-style":e.fontStyle,"font-weight":e.fontWeight,fill:t,stroke:D,"stroke-width":e.strokeWidth||void 0,"stroke-linejoin":e.strokeWidth?jO(e.strokeLineJoin):void 0,"paint-order":e.strokeWidth?`stroke fill`:void 0},...E),k=e.backgroundPadding*(f*.5),A=e.backgroundCornerRadius*(f*.5),ee=null;if(e.backgroundEnabled){if(e.legacyBackground)ee=J(`rect`,{x:-k,y:-k,width:e.width+k*2,height:u+k*2,fill:e.backgroundColor,opacity:e.backgroundOpacity,rx:A,ry:A});else{let t=Qk({rects:$k({lines:c.map(e=>{let t=v(e.runs);return{width:y(t.length?t:e.runs),lastInParagraph:e.lastInParagraph,contentBox:e.box,alignLast:e.box.isRtl?`right`:void 0,box:e}}),lineHeight:f,width:e.width,align:e.align}),padding:k,cornerRadius:A});t&&(ee=J(`path`,{d:t,fill:e.backgroundColor,opacity:e.backgroundOpacity,transform:d?`translate(0,${d})`:void 0}))}}let j=[];if(r){let t=HA(e.fill,`text-fill-grad-${e.id}`);t&&j.push(t)}if(i&&e.strokeWidth){let t=HA(e.stroke,`text-stroke-grad-${e.id}`);t&&j.push(t)}let M={"font-size":l+`px`,"text-anchor":m,direction:h,"font-family":Tb(e.fontFamily),"font-style":e.fontStyle,"font-weight":e.fontWeight,"text-decoration":e.textDecoration,"letter-spacing":e.letterSpacing*l+`px`},N=e.strokeWidth&&(i||r),P=r?`url(#text-fill-grad-${e.id})`:e.fill,F=N?(()=>{let t=T(!0),n=i?`url(#text-stroke-grad-${e.id})`:e.stroke;return[J(`text`,{...M,fill:n,"stroke-width":e.strokeWidth,stroke:n,"stroke-linejoin":jO(e.strokeLineJoin)},...t),J(`text`,{...M,fill:P},...r?t:T(!1))]})():[J(`text`,{...M,fill:P,"stroke-width":e.strokeWidth||void 0,stroke:e.strokeWidth?e.stroke:void 0,"stroke-linejoin":e.strokeWidth?jO(e.strokeLineJoin):void 0,"paint-order":e.strokeWidth?`stroke fill`:void 0},...T(r))];return J(`g`,{},ee,j.length>0?J(`defs`,{},...j):null,...F,O(P))},qA=async({element:e})=>J(`g`,{},...Iw(e)),JA=async({element:e,page:t,store:n,elementHook:r,textOverflow:i,cache:a})=>J(`g`,{style:{"transform-origin":`top left`}},...await Promise.all(e.children.map(e=>$A({element:e,page:t,store:n,elementHook:r,textOverflow:i,cache:a}))));function YA(e){let t=e.replace(/<svg[^>]*>/,``);return t=t.replace(/<\/svg>/,``),t}var XA=async({element:e,page:t,store:n})=>{let r=YA(eT(e)),i=[];if(e.strokeWidth&&vC(e.stroke)){let t=`figure-stroke-grad-${e.id}`,n=HA(e.stroke,t);n&&(i.push(n),r=tT(r,`stroke`,e.stroke,t))}if(vC(e.fill)){let t=`figure-fill-grad-${e.id}`,n=HA(e.fill,t);n&&(i.push(n),r=tT(r,`fill`,e.fill,t))}return i.length>0?J(`g`,{},i.length?J(`defs`,{},...i):null,J(`g`,{innerHTML:r})):J(`g`,{innerHTML:r})},ZA=(e,t,n)=>({...e,width:n.width,height:n.height,text:TO(t)}),QA={image:GA,svg:GA,text:KA,line:qA,figure:XA,group:JA,gif:GA,table:async({element:e,page:t,store:n,textOverflow:r})=>{let i=e.cols,a=e.colWidths,o=e.rowHeights,s=kf(e).map((e,t)=>e&&{...e,row:Math.floor(t/i),col:t%i}),c=[],l=t=>{let{row:n,col:r}=t,i=0;for(let t=0;t<r;t++)i+=a[t]*e.width;let s=0;for(let t=0;t<n;t++)s+=o[t]*e.height;let c=0;for(let n=r;n<r+(t.colSpan||1);n++)c+=(a[n]||0)*e.width;let l=0;for(let r=n;r<n+(t.rowSpan||1);r++)l+=(o[r]||0)*e.height;return{x:i,y:s,width:c,height:l}};for(let e of s)if(!e.mergedInto&&e.cellBackground&&e.cellBackground!==`transparent`){let{x:t,y:n,width:r,height:i}=l(e);c.push(J(`rect`,{x:t,y:n,width:r,height:i,fill:e.cellBackground}))}let u=(e,t)=>{if(e===`dashed`)return`${t*4},${t*2}`;if(e===`dotted`)return`${t},${t}`},d=(t,n)=>Af(t,e,n);for(let t of s){if(t.mergedInto)continue;let n=l(t),r=t.row===0,a=t.col===0,o=t.row+(t.rowSpan||1)===e.rows,s=t.col+(t.colSpan||1)===i;if(t.row===0){let e=d(t,`top`);e.style!==`none`&&e.width>0&&c.push(J(`line`,{x1:n.x-(a?0:e.width/2),y1:n.y+e.width/2,x2:n.x+n.width+(s?0:e.width/2),y2:n.y+e.width/2,stroke:e.color,"stroke-width":e.width,"stroke-dasharray":u(e.style,e.width)}))}if(t.col===0){let e=d(t,`left`);e.style!==`none`&&e.width>0&&c.push(J(`line`,{x1:n.x+e.width/2,y1:n.y-(r?0:e.width/2),x2:n.x+e.width/2,y2:n.y+n.height+(o?0:e.width/2),stroke:e.color,"stroke-width":e.width,"stroke-dasharray":u(e.style,e.width)}))}{let e=d(t,`bottom`);if(e.style!==`none`&&e.width>0){let t=o?n.y+n.height-e.width/2:n.y+n.height;c.push(J(`line`,{x1:n.x-(a?0:e.width/2),y1:t,x2:n.x+n.width+(s?0:e.width/2),y2:t,stroke:e.color,"stroke-width":e.width,"stroke-dasharray":u(e.style,e.width)}))}}{let e=d(t,`right`);if(e.style!==`none`&&e.width>0){let t=s?n.x+n.width-e.width/2:n.x+n.width;c.push(J(`line`,{x1:t,y1:n.y-(r?0:e.width/2),x2:t,y2:n.y+n.height+(o?0:e.width/2),stroke:e.color,"stroke-width":e.width,"stroke-dasharray":u(e.style,e.width)}))}}}let f=await Promise.all(s.filter(e=>!e.mergedInto).map(e=>({cell:e,text:sx(e.text||``)})).filter(({text:e})=>e).map(async({cell:t,text:n})=>{let i=l(t),a=jf(t,e),o=t.cellPadding,s={x:i.x+a.left+o,y:i.y+a.top+o,width:Math.max(0,i.width-a.left-a.right-o*2),height:Math.max(0,i.height-a.top-a.bottom-o*2)},c=await KA({element:ZA(t,n,s),textOverflow:r});return J(`g`,{transform:`translate(${s.x}, ${s.y})`},c)}));return J(`g`,{},...c,...f)}};async function $A({element:e,page:t,store:n,elementHook:r,textOverflow:i,cache:a}){let o=await QA[e.type];o||(o=()=>J(`g`,{}),console.error(`SVG export does not support ${e.type} type...`));let s=await o({element:e,page:t,store:n,elementHook:r,textOverflow:i,cache:a}),{boxFilters:c,spreadFilters:l,additionalHTML:u}=bk(e),d=u.map(e=>e.replace(/<svg([^>]*)>/,`<g$1>`).replace(/<\/svg>/,`</g>`)),f=yk(e),p=f?J(`g`,{"clip-path":`url(#blur-clip-${e.id})`,style:{filter:c.join(` `)}},J(`defs`,{},J(`clipPath`,{id:`blur-clip-${e.id}`},J(`rect`,{width:e.width,height:e.height}))),s):s;return Nw(r,J(`g`,{className:`element`,id:e.id,transform:e.type===`group`?void 0:`translate(${e.x}, ${e.y}) rotate(${e.rotation})`,display:(e.visible??!0)&&(e.showInExport??!0)?void 0:`none`,opacity:e.opacity,style:{"transform-origin":`top left`,filter:(f?l:[...c,...l]).join(` `)}},p,...d),e)}async function ej({page:e,store:t,elementHook:n,textOverflow:r,cache:i}){let a=Rw(e.children),o=await Promise.all(a.map(a=>$A({element:a,page:e,store:t,elementHook:n,textOverflow:r,cache:i}))),s={},c=Lw(e.background),l;if(c){let n=await Tw(e.background);l=J(`image`,{"xlink:href":await jw(e.background,{width:t.width,height:t.height,x:0,y:0,...Mw({width:t.width,height:t.height},{width:n.width,height:n.height})},n),x:0,y:0,width:t.width,height:t.height,preserveAspectRatio:`none`})}else if(vC(e.background)){let n=`page-bg-gradient-${e.id}`;l=J(`g`,{},J(`defs`,{},HA(e.background,n)),J(`rect`,{x:0,y:0,width:t.width,height:t.height,fill:`url(#${n})`}))}else l=J(`rect`,{x:0,y:0,width:t.width,height:t.height,fill:e.background});return J(`g`,{className:`page`,style:s},l,...o)}var tj=128,nj=new Map,rj={get:e=>nj.get(e),set:(e,t)=>{e.startsWith(`https://fonts.gstatic.com/`)&&(nj.size>=tj&&nj.delete(nj.keys().next().value),nj.set(e,t))}};async function ij(e){try{return`data:font/ttf;base64,${hC(await jx(e,{cache:rj}))}`}catch(t){return console.error(`Error embedding font:`,t),e}}async function aj(e,t){return await Promise.all(e.map(async e=>{if(e===`Arial`)return null;let n=t.find(t=>t.fontFamily===e);if(n){let t=Kx(n);return J(`style`,{},(await Promise.all(t.map(async t=>{let r=await ij(t.src?.match(/url\("?(.*?)"?\)/)?.[1]||n.url);return`@font-face {
371
+ font-family: ${Tb(e)};
372
+ font-style: ${t.fontStyle};
373
+ font-weight: ${t.fontWeight};
374
+ src: url(${r});
375
+ }`}))).join(`
376
+ `))}try{let t=await Wx(e);return J(`style`,{},(await Promise.all([...t].map(async([t,n])=>{let[r,i]=t.split(`,`),a=await ij(n[n.length-1].url);return`@font-face {
377
+ font-family: ${Tb(e)};
378
+ font-style: ${r===`1`?`italic`:`normal`};
379
+ font-weight: ${i};
380
+ src: url(${a});
381
+ }`}))).join(`
382
+ `))}catch(t){return console.error(`Error embedding Google Font:`,t),J(`defs`,{},J(`style`,{type:`text/css`,innerHTML:`@import url('${Ix(e)}');`.replace(/&/g,`&amp;`)}))}}))}async function oj(e,t={}){let{elementHook:n}=t,r=t.fontEmbedding===`none`?`none`:`inline`,i=t.textOverflow===`resize`?`resize`:GO,a=tp(e,{mode:`partial`,requirePages:!1,fillMissingIds:!0,preserveClientData:!0}),o=$b(a),s={buffers:new Map},[c,l]=await Promise.all([r===`inline`?aj(o,a.fonts):Promise.resolve([]),Promise.all(a.pages.map(e=>ej({page:e,store:a,elementHook:n,textOverflow:i,cache:s})))]);return J(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,viewBox:`0 0 ${a.width} ${a.height}`,width:a.width,height:a.height},...c,...l)}var sj=(e,t)=>typeof t==`object`?`${e}="${Object.keys(t).map(e=>`${e}:${t[e]};`).join(` `)}"`:t==null||t===``?``:`${e}="${TO(String(t))}"`,cj=({dom:e,nestLevel:t=0,inline:n=!1})=>{if(typeof e==`string`)return e;if(!e)return``;let{innerHTML:r,...i}=e.props;e.type===`text`&&(i[`xml:space`]=`preserve`);let a=Object.keys(i).map(e=>sj(e,i[e])).filter(e=>e&&e.trim().length>0).join(` `),o=n?``:` `.repeat(t),s=n?``:`
383
+ `,c=`${o}<${e.type}${a?` `+a:``}>`;if(r)return`${c}${r}</${e.type}>${s}`;let l=n||e.type===`text`,u=e.children.map(e=>cj({dom:e,nestLevel:t+1,inline:l})).join(``);return l?`${c}${u}</${e.type}>${s}`:`${c}\n${u}${o}</${e.type}>${s}`};async function lj(e,t={}){return cj({dom:await oj(e,t)})}var uj=new Set,dj=(e,t)=>{uj.has(e)||(uj.add(e),console.warn(t))},fj=K.model(`Node`,{id:K.identifier,type:`none`,name:``,opacity:1,custom:K.frozen(),visible:!0,selectable:!0,removable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(e=>{for(var t in e)e[t]===null&&(e[t]=void 0);return e}).postProcessSnapshot(e=>{let t=Object.assign({},e),n={};for(var r in t)r[0]!==`_`&&(n[r]=e[r]);return n}).views(e=>({get page(){return $h(e)?Kh(e,_M):null},get store(){return $h(e)?Kh(e,SM):null},get top(){if(!$h(e))return e;let t=e;for(;;){if(!Gh(t,mM))return t;t=Kh(t,mM)}},get parent(){if(!$h(e))return null;if(Gh(e,mM)){let t=Kh(e,mM);return t&&t.children&&t.children.length,t}if(Gh(e,_M)){let t=Kh(e,_M);return t&&t.children&&t.children.length,t}if(Gh(e,SM)){let t=Kh(e,SM);return t&&t.pages&&t.pages.length,t}return null},get zIndex(){return $h(e)?e.parent.children.indexOf(e):-1}})).actions(e=>({toJSON:()=>Object.assign({},Uh(e))})).actions(e=>({clone(t={},{skipSelect:n=!1}={}){let r=JSON.parse(JSON.stringify(e.toJSON()));t.id=t.id||Cy(10);let i=new Map;return wb(r,e=>{let t=e.id,n=Cy(10);i.set(t,n),e.id=n}),wb(r,e=>{e.mergedInto&&i.has(e.mergedInto)&&(e.mergedInto=i.get(e.mergedInto))}),Object.assign(r,t),e.page.addElement(r,{skipSelect:n})},set(t){Object.assign(e,t)},moveUp(){var t;(t=e.parent)==null||t.moveElementsUp([e.id])},moveTop(){var t;(t=e.parent)==null||t.moveElementsTop([e.id])},moveDown(){var t;(t=e.parent)==null||t.moveElementsDown([e.id])},moveBottom(){var t;(t=e.parent)==null||t.moveElementsBottom([e.id])},setZIndex(t){e.parent.setElementZIndex(e.id,t)},beforeDestroy(){}}));function pj(e){return e/180*Math.PI}function mj(e,t,n,r,i){let a=Math.sqrt(n*n+r*r);return i+=Math.atan2(r,n),{x:e+a*Math.cos(i),y:t+a*Math.sin(i)}}function hj(e){let[t,n,r,i]=gj(e),a=Math.min(t.x,n.x,r.x,i.x),o=Math.min(t.y,n.y,r.y,i.y),s=Math.max(t.x,n.x,r.x,i.x),c=Math.max(t.y,n.y,r.y,i.y);return{x:a,y:o,width:s-a,height:c-o,minX:a,minY:o,maxX:s,maxY:c}}function gj(e){let{x:t,y:n,width:r,height:i}=e,a=pj(e.rotation);return[mj(t,n,0,0,a),mj(t,n,r,0,a),mj(t,n,r,i,a),mj(t,n,0,i,a)]}function _j(e,t){let n=(e,t)=>{let n=1/0,r=-1/0;for(let i of e){let e=i.x*t.x+i.y*t.y;e<n&&(n=e),e>r&&(r=e)}return[n,r]};for(let r of[e,t])for(let i=0;i<r.length;i++){let a=r[i],o=r[(i+1)%r.length],s={x:o.y-a.y,y:a.x-o.x},[c,l]=n(e,s),[u,d]=n(t,s);if(l<u||d<c)return!1}return!0}function vj(e){let t=e.map(e=>hj(e)),n=Math.min(...t.map(e=>e.minX)),r=Math.min(...t.map(e=>e.minY)),i=Math.max(...t.map(e=>e.maxX)),a=Math.max(...t.map(e=>e.maxY));return{x:n,y:r,width:i-n,height:a-r,minX:n,minY:r,maxX:i,maxY:a}}function yj(e){let t=pj(e.rotation||0);return{x:e.x+e.width/2*Math.cos(t)+e.height/2*Math.sin(-t),y:e.y+e.height/2*Math.cos(t)+e.width/2*Math.sin(t)}}function bj(e,t,n){let r=pj(t),i=n.x+(e.x-n.x)*Math.cos(r)-(e.y-n.y)*Math.sin(r),a=n.y+(e.x-n.x)*Math.sin(r)+(e.y-n.y)*Math.cos(r);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:i,y:a})}function xj(e,t){return bj(e,t,yj(e))}var Sj={right:{from:{x:-200},to:{x:0}},left:{from:{x:200},to:{x:0}},up:{from:{y:200},to:{y:0}},down:{from:{y:-200},to:{y:0}},"bottom-right":{from:{x:-200,y:-200},to:{x:0,y:0}},"bottom-left":{from:{x:200,y:-200},to:{x:0,y:0}},"top-right":{from:{x:-200,y:200},to:{x:0,y:0}},"top-left":{from:{x:200,y:200},to:{x:0,y:0}}},Cj={right:{cropX:-1},left:{cropX:1},up:{cropY:1},down:{cropY:-1}},wj={none:()=>({}),fade:({dTime:e,element:t,animation:n})=>{let r=e/n.duration;return n.type===`enter`?{opacity:r*t.opacity}:{opacity:(1-r)*t.opacity}},rotate:({dTime:e,element:t,animation:n})=>{let r=e/n.duration*360;return xj({x:t.x,y:t.y,width:t.width,height:t.height,rotation:t.rotation},r)},blink:({dTime:e,element:t,animation:n})=>{let r=n.duration,i=e%r/(r/2),a=i<=1?i:2-i;return{opacity:t.opacity*a}},bounce:({dTime:e,element:t,animation:n})=>{let r=n.duration,i=r/2,a=n.data.strength??1,o={},s={x:t.x+t.width/3*a,y:t.y+t.height/3*a,width:t.width/3*a,height:t.height/3*a,fontSize:t.fontSize/3*a},c={x:t.x,y:t.y,width:t.width,height:t.height,fontSize:t.fontSize},l=e%r/i,u=l<=1?l:2-l;for(let e in s){let t=s[e];o[e]=t+u*(c[e]-t)}return o},move:({dTime:e,element:t,animation:n})=>{let r=Sj[n.data.direction]||Sj.right,i=n.data.strength??1,a={};for(var o in r.from){let s=r.from[o],c=r.to[o];n.type===`exit`&&(s=r.to[o],c=-r.from[o]),s*=i,c*=i;let l=t[o]+s,u=t[o]+c-l;a[o]=l+e/n.duration*u}return a},zoom:({dTime:e,element:t,animation:n})=>{let r={},i=1+(((n.data.direction||`in`)===`in`?3/4:5/4)-1)*(n.data.strength??1),a=t.rotation*Math.PI/180,o=Math.cos(a),s=Math.sin(a),c=t.width*(1-i),l=t.height*(1-i),u=(c*o-l*s)/2,d=(c*s+l*o)/2,f={x:t.x+u,y:t.y+d,width:t.width*i,height:t.height*i,fontSize:t.fontSize*i},p={x:t.x,y:t.y,width:t.width,height:t.height,fontSize:t.fontSize};for(var m in f){let t=f[m],i=p[m];if(n.type===`exit`){let e=t;t=i,i=e}let a=i-t;r[m]=t+e/n.duration*a}return r},cameraZoom:({dTime:e,element:t,animation:n})=>{let r={},i=Cj[n.data.direction||`right`]||Cj.right,a=n.data.movementStrength??.1,o=n.data.shakeStrength??.015,s=n.data.zoomStrength??.6,c=e/n.duration,l=o*(1-c),u=Math.sin(12*c)*l*.7+Math.sin(8*c)*l*.3;if(n.type===`exit`){let e=Math.max(t.cropWidth||1,t.cropHeight||1);s=Math.min(s,1-e)}n.type;let d=1-(1-c)**2,f=t.cropX||0,p=t.cropY||0,m=t.cropWidth||1,h=t.cropHeight||1,g=m,_=h,v,y,b=0,x=0;if(i.cropX){let e=i.cropX>0?1-(f+m):f;b=Math.min(e,Math.abs(a))*i.cropX}if(i.cropY){let e=i.cropY>0?1-(p+h):p;x=Math.min(e,Math.abs(a))*i.cropY}return n.type===`enter`?(v=i.cropX?f+b*(1-d):f,y=i.cropY?p+x*(1-d):p):(v=i.cropX?f+b*d:f,y=i.cropY?p+x*d:p),r.cropX=Math.max(0,Math.min(1-g,v+u*g)),r.cropY=Math.max(0,Math.min(1-_,y+u*_)),r.cropWidth=g,r.cropHeight=_,r}},Tj=({element:e,dTime:t,animation:n})=>{let r=wj[n.name];return r?r({element:e,dTime:t,animation:n}):(console.error(`Can not find animation type: `+n.name),{})},Ej=K.model(`Animation`,{delay:0,duration:500,enabled:!0,type:K.enumeration(`Type`,[`enter`,`exit`,`loop`]),name:`none`,data:K.frozen({})}),Dj=(e,t)=>{let n={};for(let r in t)if(typeof e[r]==`number`&&typeof t[r]==`number`){let i=t[r]-e[r];i!==0&&(n[r]=i)}return n},Oj=K.model(`ShapeFilter`,{intensity:1}),kj=[`temperature`,`contrast`,`highlights`,`shadows`,`white`,`black`,`saturation`,`vibrance`],Aj=fj.named(`Shape`).props({x:0,y:0,width:100,height:100,rotation:0,opacity:1,animations:K.array(Ej),blurEnabled:!1,blurRadius:10,brightnessEnabled:!1,brightness:0,sepiaEnabled:!1,grayscaleEnabled:!1,filters:K.map(Oj),shadowEnabled:!1,shadowBlur:5,shadowOffsetX:0,shadowOffsetY:0,shadowColor:`black`,shadowOpacity:1,visible:!0,draggable:!0,resizable:!0,selectable:!0,contentEditable:!0,styleEditable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(e=>{let t=Object.assign(Object.assign({},e),{x:`x`in e&&e.x||0,y:`y`in e&&e.y||0,filters:`filters`in e?Array.isArray(e.filters)?{}:e.filters:void 0});return`width`in e&&(t.width=t.width||1),`height`in e&&(t.height=t.height||1),`locked`in e&&e.locked&&(t.draggable=!1,t.contentEditable=!1,t.styleEditable=!1,t.resizable=!1,t.removable=!1),t}).views(e=>{let t=[`x`,`y`,`width`,`height`,`rotation`,`opacity`,`color`,`fontSize`,`cropX`,`cropY`,`cropWidth`,`cropHeight`],n=e,i={x:n.x??0,y:n.y??0,width:n.width??0,height:n.height??0,rotation:n.rotation??0,opacity:n.opacity??1};for(let r of t)r in e&&(i[r]=n[r]);let a=Qt(i),o=pr(e=>{for(let t in e)a[t]=e[t]}),s=pr(e=>{Object.assign(a,e)}),c=pr(e=>{for(let t in e)typeof a[t]==`number`&&(a[t]=a[t]+e[t])});return{get locked(){return!(e.draggable||e.contentEditable||e.styleEditable||e.resizable)},get a(){if(!$h(e))return a;let t={};for(let e in a)t[e]=n[e];o(t);let i=r(e);if(i===null)return a;let l=e.store.isEditingPaused&&this.isSelected,u=e.store.animatedElementsIds;if(u.length&&!u.includes(e.id))return a;let d=e.animations.find(e=>e.type===`enter`),f=d?.enabled&&i<d.delay;f&&s({opacity:0});let p=d?.enabled&&i>=d.delay&&i<=d.delay+d.duration;if(p&&!l){let t=Dj(e,Tj({element:e,animation:d,dTime:i-d.delay}));c(t)}let m=e.animations.find(e=>e.type===`exit`);if(!f&&!p&&m?.enabled&&i>=e.page.duration-m.duration-m.delay&&i<=e.page.duration-m.delay&&!l){let t=Dj(e,Tj({element:e,animation:m,dTime:i-(e.page.duration-m.duration-m.delay)}));c(t)}m!=null&&m.enabled&&i>=e.page.duration-m.delay&&s({opacity:0});let h=e.animations.find(e=>e.type===`loop`);if(h?.enabled&&!l){let t=Dj(e,Tj({element:e,animation:h,dTime:i}));c(t)}return a},animated(e){return this.a[e]},get timeRange(){return $h(e)&&e.page?_(e.animations,e.page.duration):{start:0,end:0}},get active(){if(!$h(e))return!0;let t=r(e);if(t===null)return!0;let{start:n,end:i}=this.timeRange;return t>=n&&t<i},get isSelected(){return!!$h(e)&&e.store.selectedShapes.indexOf(e)>=0&&e.selectable},get isSelectedDirectly(){return!!$h(e)&&e.store.selectedElements.indexOf(e)>=0&&e.selectable}}}).actions(e=>({setAnimation(t,n){let r=e.animations.find(e=>e.type===t);r?Object.assign(r,n):e.animations.push(Object.assign({type:t},n))},setFilter(t,n){kj.includes(t)||e.filters.forEach((t,n)=>{kj.includes(n.toString())||e.filters.delete(n.toString())}),n==null?e.filters.delete(t):e.filters.set(t,{intensity:n})}})),jj=e=>typeof e==`string`?rx(e)??e:e,Mj=Aj.named(`Text`).props({type:`text`,text:``,placeholder:``,fontSize:14,fontFamily:`Roboto`,fontStyle:`normal`,fontWeight:`normal`,textDecoration:``,textTransform:`none`,fill:`black`,align:`center`,width:100,height:0,verticalAlign:`top`,strokeWidth:0,stroke:`black`,strokeLineJoin:`round`,lineHeight:K.optional(K.union(K.number,K.string),1.2),letterSpacing:0,_editModeEnabled:!1,backgroundEnabled:!1,backgroundColor:`#7ED321`,backgroundOpacity:1,backgroundCornerRadius:.5,backgroundPadding:.5,legacyBackground:K.maybe(K.boolean),curveEnabled:!1,curvePower:.5}).preProcessSnapshot(e=>{let t=Object.assign(Object.assign({},e),{fontSize:Nf(e.fontSize),lineHeight:jj(e.lineHeight)});return nx(t)||delete t.height,t}).actions(e=>{let t=e.set;return{set(e){e.fontSize!=null&&(e=Object.assign(Object.assign({},e),{fontSize:Nf(e.fontSize)})),typeof e.lineHeight==`string`&&(e=Object.assign(Object.assign({},e),{lineHeight:jj(e.lineHeight)})),t(e)},toggleEditMode(t){let n=t??!e._editModeEnabled;n!==e._editModeEnabled&&(e._editModeEnabled=n,e._editModeEnabled?e.store.history.startTransaction():e.store.history.endTransaction())},beforeDestroy(){e._editModeEnabled&&e.store.history.endTransaction()}}}),Nj=Aj.named(`Image`).props({type:`image`,width:100,height:100,src:``,cropX:0,cropY:0,cropWidth:1,cropHeight:1,cornerRadius:0,flipX:!1,flipY:!1,clipSrc:``,borderColor:`black`,borderSize:0,keepRatio:!1,stretchEnabled:!1}).extend(e=>{let t=Qt.box(!1),n=!1;return{views:{get _cropModeEnabled(){return t.get()}},actions:{toggleCropMode(r){let i=r??!t.get();t.set(i);let a=e.store?.history;a&&(i&&!n?(a.startTransaction(),n=!0):!i&&n&&(a.endTransaction(),n=!1))},beforeDestroy(){n&&=(e.store.history.endTransaction(),!1)}}}}),Pj=Nj.named(`Video`).props({type:`video`,duration:0,startTime:0,endTime:1,volume:1,speed:1}),Fj=Aj.named(`Line`).props({type:`line`,width:400,height:10,color:`black`,dash:K.array(K.number),startHead:``,endHead:``}).actions(e=>({})),Ij=Aj.named(`SVG`).props({type:`svg`,src:``,maskSrc:``,cropX:0,cropY:0,cropWidth:1,cropHeight:1,keepRatio:!0,stretchEnabled:!0,flipX:!1,flipY:!1,width:100,height:100,borderColor:`black`,borderSize:0,cornerRadius:0,colorsReplace:K.map(K.string)}).preProcessSnapshot(e=>Object.assign(Object.assign({},e),{src:e.src||e.svgSource,colorsReplace:Array.isArray(e.colorsReplace)?{}:e.colorsReplace})).actions(e=>({replaceColor(t,n){e.colorsReplace.set(t,n)},resetColors(){e.colorsReplace.clear()}})),Lj=Aj.named(`Figure`).props({type:`figure`,subType:`rect`,fill:`rgb(0, 161, 255)`,dash:K.array(K.number),strokeWidth:0,stroke:`rgba(98, 197, 255, 1)`,cornerRadius:0}),Rj=Nj.named(`Gif`).props({type:`gif`,duration:0,keepRatio:!0}),zj=.05,Bj=K.enumeration([`solid`,`dashed`,`dotted`,`none`]);function Vj(e){return Wh(e,2)}function Hj(e,t,n){return e[`_${t}`]??($h(e)?Vj(e)[t]:n)}function Uj(e){return Wh(e,1)}var Wj=K.model(`BorderSide`,{color:K.maybe(K.string),width:K.maybe(K.number),style:K.maybe(Bj)}).postProcessSnapshot(e=>{let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=r);return t}),Gj=K.model(`CellBorders`,{top:K.maybe(Wj),right:K.maybe(Wj),bottom:K.maybe(Wj),left:K.maybe(Wj)}).postProcessSnapshot(e=>{let t={};for(let[n,r]of Object.entries(e))typeof r==`object`&&r&&Object.keys(r).length>0&&(t[n]=r);return t}),Kj=Of,qj=new Set(Kj),Jj=[`blurEnabled`,`blurRadius`,`brightnessEnabled`,`brightness`,`sepiaEnabled`,`grayscaleEnabled`,`filters`,`shadowEnabled`,`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`,`shadowColor`,`shadowOpacity`],Yj=[`id`,`type`,`text`,`opacity`,`rowSpan`,`colSpan`,`mergedInto`,`name`,`custom`,`borders`],Xj=new Set(`row.col.x.y.width.height.rotation.draggable.resizable.selectable.removable.contentEditable.visible.showInExport.alwaysOnTop.backgroundEnabled.backgroundOpacity.backgroundColor.backgroundCornerRadius.backgroundPadding.curveEnabled.curvePower.shadowEnabled.shadowBlur.shadowOffsetX.shadowOffsetY.shadowColor.shadowOpacity.blurEnabled.blurRadius.brightnessEnabled.brightness.sepiaEnabled.grayscaleEnabled.placeholder.animations.filters`.split(`.`)),Zj={opacity:1,rowSpan:1,colSpan:1,name:``},Qj=[],$j=K.model(`TableCell`,{id:K.identifier,type:K.optional(K.literal(`tablecell`),`tablecell`),text:``,_fontSize:K.maybe(K.number),_fontFamily:K.maybe(K.string),_fontWeight:K.maybe(K.string),_fontStyle:K.maybe(K.string),_textDecoration:K.maybe(K.string),_textTransform:K.maybe(K.string),_fill:K.maybe(K.string),_align:K.maybe(K.string),_verticalAlign:K.maybe(K.string),_lineHeight:K.maybe(K.union(K.number,K.string)),_letterSpacing:K.maybe(K.number),_strokeWidth:K.maybe(K.number),_stroke:K.maybe(K.string),_cellBackground:K.maybe(K.string),_cellPadding:K.maybe(K.number),opacity:1,rowSpan:1,colSpan:1,mergedInto:K.maybe(K.string),borders:K.maybe(Gj),name:``,custom:K.frozen()}).volatile(()=>({_editModeEnabled:!1,filters:Qt.map()})).preProcessSnapshot(e=>{if(!e)return e;for(let t in e)e[t]===null&&(e[t]=void 0);let t={};for(let n of Yj)n in e&&(t[n]=e[n]);for(let n of Kj)e[n]!==void 0&&(t[`_${n}`]=e[n]);return t._fontSize!==void 0&&(t._fontSize=Nf(t._fontSize)),t}).postProcessSnapshot(e=>{let t={};for(let[n,r]of Object.entries(e))if(n.startsWith(`_`))r!=null&&(t[n.slice(1)]=r);else if(n===`borders`)typeof r==`object`&&r&&Object.keys(r).length>0&&(t.borders=r);else{if(n in Zj&&r===Zj[n])continue;t[n]=r}return t}).views(e=>{let t={get row(){if(!$h(e))return 0;let t=Vj(e),n=Uj(e).indexOf(e);return n===-1?0:Math.floor(n/t.cols)},get col(){if(!$h(e))return 0;let t=Vj(e),n=Uj(e).indexOf(e);return n===-1?0:n%t.cols},get store(){return $h(e)?qh(e):null},get page(){if(!$h(e))return null;try{return Vj(e).page}catch{return null}},get fontSize(){return Hj(e,`fontSize`,30)},get fontFamily(){return Hj(e,`fontFamily`,`Roboto`)},get fontWeight(){return Hj(e,`fontWeight`,`normal`)},get fontStyle(){return Hj(e,`fontStyle`,`normal`)},get textDecoration(){return Hj(e,`textDecoration`,``)},get textTransform(){return Hj(e,`textTransform`,`none`)},get fill(){return Hj(e,`fill`,`black`)},get align(){return Hj(e,`align`,`left`)},get verticalAlign(){return Hj(e,`verticalAlign`,`top`)},get lineHeight(){return Hj(e,`lineHeight`,1.2)},get letterSpacing(){return Hj(e,`letterSpacing`,0)},get strokeWidth(){return Hj(e,`strokeWidth`,0)},get stroke(){return Hj(e,`stroke`,`black`)},get cellBackground(){return Hj(e,`cellBackground`,`transparent`)},get cellPadding(){return Hj(e,`cellPadding`,4)},get width(){if(!$h(e))return 100;try{return Vj(e).getCellRect(t.row,t.col,e.rowSpan,e.colSpan).width}catch{return 100}},get height(){if(!$h(e))return 100;try{return Vj(e).getCellRect(t.row,t.col,e.rowSpan,e.colSpan).height}catch{return 100}},get borderInsets(){if(!$h(e))return{top:0,right:0,bottom:0,left:0};let n=Vj(e),r=(e,n)=>{let r=t.getEffectiveBorder(e);return r.style===`none`||r.width===0?0:n?r.width:r.width/2};return{top:r(`top`,t.row===0),bottom:r(`bottom`,t.row+e.rowSpan===n.rows),left:r(`left`,t.col===0),right:r(`right`,t.col+e.colSpan===n.cols)}},get a(){if(!$h(e))return{x:0,y:0,width:100,height:100,rotation:0,opacity:1,fontSize:16};let n=Vj(e).getCellRect(t.row,t.col,e.rowSpan,e.colSpan),r=t.cellPadding,{top:i,right:a,bottom:o,left:s}=t.borderInsets;return{x:n.x+s+r,y:n.y+i+r,width:Math.max(0,n.width-s-a-2*r),height:Math.max(0,n.height-i-o-2*r),rotation:0,opacity:e.opacity??1,fontSize:t.fontSize}},getEffectiveBorder(t){let n=$h(e)?Vj(e):null,r=e.borders?.[t];return{color:r?.color??n?.borderColor??`#000000`,width:r?.width??n?.borderWidth??1,style:r?.style??n?.borderStyle??`solid`}},get x(){return 0},get y(){return 0},get rotation(){return 0},get draggable(){return!1},get resizable(){return!1},get selectable(){return!1},get removable(){return!1},get contentEditable(){return!0},get visible(){return!0},get showInExport(){return!0},get alwaysOnTop(){return!1},get placeholder(){return``},get backgroundEnabled(){return!1},get backgroundOpacity(){return 1},get backgroundColor(){return`transparent`},get backgroundCornerRadius(){return 0},get backgroundPadding(){return 0},get curveEnabled(){return!1},get curvePower(){return 0},get shadowEnabled(){return!1},get shadowBlur(){return 0},get shadowOffsetX(){return 0},get shadowOffsetY(){return 0},get shadowColor(){return`black`},get shadowOpacity(){return 1},get blurEnabled(){return!1},get blurRadius(){return 0},get brightnessEnabled(){return!1},get brightness(){return 0},get sepiaEnabled(){return!1},get grayscaleEnabled(){return!1},get animations(){return Qj}};return t}).actions(e=>({toJSON:()=>Object.assign({},Uh(e)),set(t){t.fontSize!=null&&(t=Object.assign(Object.assign({},t),{fontSize:Nf(t.fontSize)}));let n={};for(let[e,r]of Object.entries(t))qj.has(e)?n[`_${e}`]=r:e===`borders`?n.borders=r&&JSON.parse(JSON.stringify(r)):Xj.has(e)||(n[e]=r);Object.assign(e,n)},setBorder(t,n){let r=e.borders?Object.assign({},Uh(e.borders)):{},i=r[t]||{},a=Object.assign({},i);n.color!==void 0&&(a.color=n.color),n.width!==void 0&&(a.width=n.width),n.style!==void 0&&(a.style=n.style),r[t]=a,e.borders=eg(r)},toggleEditMode(t){let n=t??!e._editModeEnabled;n!==e._editModeEnabled&&(e._editModeEnabled=n,e._editModeEnabled?e.store.history.startTransaction():e.store.history.endTransaction())},beforeDestroy(){e._editModeEnabled&&e.store.history.endTransaction()}}));function eM(e,t){let n=[];for(let r of e){let e={id:Cy(10),text:``};if(!r){n.push(e);continue}for(let t of Kj){let n=r[`_${t}`];n!=null&&(e[t]=n)}let i=r.borders;if(i){let n={},r=t?[`left`,`right`,`top`]:[`top`,`bottom`,`left`];for(let e of r){let t=i[e];t&&(n[e]=Uh(t))}Object.keys(n).length>0&&(e.borders=n)}n.push(e)}return n}function tM(e){return Array.from({length:e},()=>1/e)}function nM(e){let t=e.reduce((e,t)=>e+t,0);return t===0?tM(e.length):e.map(e=>e/t)}var rM=Aj.named(`Table`).props({type:`table`,width:300,height:200,rows:3,cols:3,colWidths:K.array(K.number),rowHeights:K.array(K.number),cells:K.array($j),borderColor:`#000000`,borderWidth:1,borderStyle:K.optional(K.enumeration([`solid`,`dashed`,`dotted`,`none`]),`solid`),fontSize:30,fontFamily:`Roboto`,fontWeight:`normal`,fontStyle:`normal`,textDecoration:``,textTransform:`none`,fill:`black`,align:`center`,verticalAlign:`middle`,lineHeight:K.optional(K.union(K.number,K.string),1.2),letterSpacing:0,strokeWidth:0,stroke:`black`,cellBackground:`transparent`,cellPadding:4}).preProcessSnapshot(e=>e?.fontSize==null?e:Object.assign(Object.assign({},e),{fontSize:Nf(e.fontSize)})).postProcessSnapshot(e=>{e.cells&&((e=Object.assign({},e)).cells=e.cells.map(t=>{let n={};for(let[r,i]of Object.entries(t))qj.has(r)&&i===e[r]||(n[r]=i);return n}));for(let t of Jj)delete e[t];return e}).volatile(()=>({_focusedCellIds:[],_editingCellId:void 0,_anchorCellId:void 0,_cellContentHeights:Qt.map(),_baseRowHeights:null,_baseHeight:null})).actions(e=>({afterCreate(){let t=e.rows*e.cols;if(e.cells.length===0)e.cells.replace(function(e,t){let n=[];for(let r=0;r<e*t;r++)n.push({id:Cy(10),text:``});return n}(e.rows,e.cols));else if(e.cells.length<t)for(;e.cells.length<t;)e.cells.push(eg({id:Cy(10),text:``}));else e.cells.length>t&&e.cells.splice(t);e.colWidths.length===0&&e.colWidths.replace(tM(e.cols)),e.rowHeights.length===0&&e.rowHeights.replace(tM(e.rows))}})).views(e=>({get _cellMap(){let t=new Map,n=e.cols;return e.cells.forEach((e,r)=>{t.set(`${Math.floor(r/n)}:${r%n}`,e)}),t},getActualRowHeight:t=>e.rowHeights[t]*e.height})).views(e=>{let t={getCell:(t,n)=>e._cellMap.get(`${t}:${n}`),get minWidth(){return 20*e.cols},getRowContentOuterHeight(n){let r=0;for(let i=0;i<e.cols;i++){let a=t.getCell(n,i);if(!a)continue;let o=e._cellContentHeights.get(a.id);if(o===void 0)continue;let s=a.borderInsets,c=o+2*a.cellPadding+s.top+s.bottom;c>r&&(r=c)}return r},get minHeight(){let n=20*e.rows;if(e._cellContentHeights.size===0)return n;let r=0;for(let n=0;n<e.rows;n++)r+=t.getRowContentOuterHeight(n);return Math.max(n,r)},get actualHeight(){let t=0;for(let n=0;n<e.rows;n++)t+=e.getActualRowHeight(n);return t},getCellRect(t,n,r=1,i=1){let a=0;for(let t=0;t<n;t++)a+=e.colWidths[t]*e.width;let o=0;for(let n=0;n<t;n++)o+=e.getActualRowHeight(n);let s=0;for(let t=n;t<n+i;t++)s+=(e.colWidths[t]||0)*e.width;let c=0;for(let n=t;n<t+r;n++)c+=e.getActualRowHeight(n);return{x:a,y:o,width:s,height:c}},get visibleCells(){return e.cells.filter(e=>!e.mergedInto)},get focusedCells(){return e.cells.filter(t=>e._focusedCellIds.includes(t.id))},get editingCell(){if(e._editingCellId)return e.cells.find(t=>t.id===e._editingCellId)},getFocusedCellRange(){if(e._focusedCellIds.length===0)return null;let t=1/0,n=-1/0,r=1/0,i=-1/0,a=new Set(e._focusedCellIds);for(let o of e.cells)a.has(o.id)&&(o.row<t&&(t=o.row),o.row>n&&(n=o.row),o.col<r&&(r=o.col),o.col>i&&(i=o.col));return t===1/0?null:{minRow:t,maxRow:n,minCol:r,maxCol:i}},get _fitRowsToContent(){if(e._cellContentHeights.size===0)return null;let n=e._baseHeight??e.height,r=e._baseRowHeights??[...e.rowHeights],i=!1,a=[];for(let o=0;o<e.rows;o++){let s=e.rowHeights[o]*e.height,c=r[o]*n,l=t.getRowContentOuterHeight(o),u=Math.max(l,c);Math.abs(u-s)>1?(a.push(u),i=!0):a.push(s)}if(!i)return null;let o=a.reduce((e,t)=>e+t,0);return{rowHeights:a.map(e=>e/o),height:o}}};return t}).actions(e=>{let t=e.set,n={set(e){e.fontSize!=null&&(e=Object.assign(Object.assign({},e),{fontSize:Nf(e.fontSize)})),t(e)},setCellContentHeight(t,n){e._cellContentHeights.set(t,n)},_applyFitRowsToContent(){if(!$h(e))return;e._baseRowHeights===null&&(e._baseRowHeights=[...e.rowHeights],e._baseHeight=e.height);let t=e._fitRowsToContent;t&&(e.height=t.height,e.rowHeights.replace(t.rowHeights))},focusCell(t,n=!1){n?e._focusedCellIds.includes(t)||(e._focusedCellIds=[...e._focusedCellIds,t]):(e._focusedCellIds=[t],e._anchorCellId=t)},selectRowRange(t,n){let r=Math.max(0,Math.min(t,n)),i=Math.min(e.rows-1,Math.max(t,n)),a=[];for(let t=r;t<=i;t++)for(let n=0;n<e.cols;n++){let r=e.getCell(t,n);r&&a.push(r.id)}e._focusedCellIds=a,e._anchorCellId=a[0]},selectColumnRange(t,n){let r=Math.max(0,Math.min(t,n)),i=Math.min(e.cols-1,Math.max(t,n)),a=[];for(let t=0;t<e.rows;t++)for(let n=r;n<=i;n++){let r=e.getCell(t,n);r&&a.push(r.id)}e._focusedCellIds=a,e._anchorCellId=a[0]},selectRow(e){n.selectRowRange(e,e)},selectColumn(e){n.selectColumnRange(e,e)},focusCellRange(t,n){let r=e.cells.find(t=>t.id===e._anchorCellId);if(!r)return;let i=Math.min(r.row,t),a=Math.max(r.row,t),o=Math.min(r.col,n),s=Math.max(r.col,n),c=[];for(let t of e.cells)t.row>=i&&t.row<=a&&t.col>=o&&t.col<=s&&c.push(t.id);e._focusedCellIds=c},clearCellFocus(){if($h(e)){if(e._editingCellId){let t=e.cells.find(t=>t.id===e._editingCellId);t&&t.toggleEditMode(!1)}e._focusedCellIds=[],e._editingCellId=void 0,e._anchorCellId=void 0}},enterCellEdit(t){e._editingCellId=t,e._focusedCellIds.includes(t)||(e._focusedCellIds=[t]);let n=e.cells.find(e=>e.id===t);n&&n.toggleEditMode(!0)},exitCellEdit(){if(e._editingCellId){let t=e.cells.find(t=>t.id===e._editingCellId);t&&t.toggleEditMode(!1)}e._editingCellId=void 0},_resetBaseRowHeights(){e._baseRowHeights=null,e._baseHeight=null},setHeightRedistribute(t){let n=e.rows;if(n===0||t<=0){e.height=t;return}let r=e.height;if(r<=0||t>=r){e.height=t;return}let i=[],a=[],o=0;for(let t=0;t<n;t++){i.push(e.rowHeights[t]*r);let n=e.getRowContentOuterHeight(t);a.push(n),o+=n}if(t<=o||o<=0){e.height=t;return}let s=t-o,c=0,l=[];for(let e=0;e<n;e++){let t=Math.max(0,i[e]-a[e]);l.push(t),c+=t}let u=[];if(c<=0){let e=t/r;for(let t=0;t<n;t++)u.push(i[t]*e)}else for(let e=0;e<n;e++)u.push(a[e]+l[e]/c*s);let d=u.map(e=>e/t);e.height=t,e.rowHeights.replace(d)},addRow(t){n._resetBaseRowHeights();let r=t>0?t-1:0,i=(e.rowHeights[r]||1/(e.rows+1))*e.height,a=e.height+i,o=[];for(let t=0;t<e.rows;t++)o.push(e.rowHeights[t]*e.height/a);o.splice(t,0,i/a);let s=t>0?t-1:0,c=[];for(let t=0;t<e.cols;t++)c.push(e.cells[s*e.cols+t]);let l=t*e.cols,u=eM(c,!0);e.cells.splice(l,0,...u),e.rows+=1,e.height=a,e.rowHeights.replace(nM(o))},removeRow(t){if(e.rows<=1)return;n._resetBaseRowHeights();let r=t*e.cols,i=[];for(let t=r;t<r+e.cols;t++)i.push(e.cells[t].id);if(e._editingCellId&&i.includes(e._editingCellId)){let t=e.cells.find(t=>t.id===e._editingCellId);t&&t.toggleEditMode(!1),e._editingCellId=void 0}e._focusedCellIds=e._focusedCellIds.filter(e=>!i.includes(e)),i.forEach(t=>e._cellContentHeights.delete(t)),e.cells.splice(r,e.cols);let a=[...e.rowHeights];a.splice(t,1),--e.rows,e.rowHeights.replace(nM(a))},addColumn(t){let n=t>0?t-1:0,r=(e.colWidths[n]||1/(e.cols+1))*e.width,i=e.width+r,a=[];for(let t=0;t<e.cols;t++)a.push(e.colWidths[t]*e.width/i);a.splice(t,0,r/i);let o=e.cols,s=t>0?t-1:0,c=[];for(let t=0;t<e.rows;t++)c.push(e.cells[t*o+s]);let l=eM(c,!1);for(let n=e.rows-1;n>=0;n--)e.cells.splice(n*o+t,0,eg(l[n]));e.cols+=1,e.width=i,e.colWidths.replace(nM(a))},removeColumn(t){if(e.cols<=1)return;let n=e.cols,r=[];for(let i=0;i<e.rows;i++)r.push(e.cells[i*n+t].id);if(e._editingCellId&&r.includes(e._editingCellId)){let t=e.cells.find(t=>t.id===e._editingCellId);t&&t.toggleEditMode(!1),e._editingCellId=void 0}e._focusedCellIds=e._focusedCellIds.filter(e=>!r.includes(e)),r.forEach(t=>e._cellContentHeights.delete(t));for(let r=e.rows-1;r>=0;r--)e.cells.splice(r*n+t,1);let i=[...e.colWidths];i.splice(t,1),--e.cols,e.colWidths.replace(nM(i))},removeRowRange(t,r){for(let i=r;i>=t&&!(e.rows<=1);i--)n.removeRow(i)},removeColumnRange(t,r){for(let i=r;i>=t&&!(e.cols<=1);i--)n.removeColumn(i)},distributeRowsEvenly(){let t=e.rows,r=20;for(let n=0;n<t;n++)r=Math.max(r,e.getRowContentOuterHeight(n));n._resetBaseRowHeights(),e.height=Math.max(e.height,r*t),e.rowHeights.replace(tM(t))},distributeColumnsEvenly(){e.colWidths.replace(tM(e.cols))},resizeColumn(t,n){if(t>=e.cols-1)return;let r=[...e.colWidths],i=r[t]+r[t+1],a=r[t]+n,o=r[t+1]-n;a<zj?(r[t]=zj,r[t+1]=i-zj):o<zj?(r[t+1]=zj,r[t]=i-zj):(r[t]=a,r[t+1]=o),e.colWidths.replace(r)},resizeRow(t,n){if(t>=e.rows-1)return;let r=[...e.rowHeights],i=r[t]+r[t+1],a=e.height,o=a>0?e.getRowContentOuterHeight(t)/a:0,s=a>0?e.getRowContentOuterHeight(t+1)/a:0,c=Math.max(zj,o),l=Math.max(zj,s),u=r[t]+n,d=r[t+1]-n;u<c?(r[t]=c,r[t+1]=i-c):d<l?(r[t+1]=l,r[t]=i-l):(r[t]=u,r[t+1]=d),e.rowHeights.replace(r)},setCellBorders(t,n,r){let i={top:{side:`bottom`,dr:-1,dc:0},bottom:{side:`top`,dr:1,dc:0},left:{side:`right`,dr:0,dc:-1},right:{side:`left`,dr:0,dc:1}};for(let a of t){let t=e.cells.find(e=>e.id===a);if(t)for(let a of n){t.setBorder(a,r);let n=i[a],o=t.row+n.dr,s=t.col+n.dc,c=e.getCell(o,s);c&&c.setBorder(n.side,r)}}},applyBorderMode(t,r){let i=function(e,t,n){let{minRow:r,maxRow:i,minCol:a,maxCol:o}=t,s=(e,t,r,i)=>{let a=[];for(let o=e;o<=t;o++)for(let e=r;e<=i;e++){let t=n(o,e);t&&a.push(t.id)}return a};if(e===`all`)return[{cellIds:s(r,i,a,o),sides:[`top`,`right`,`bottom`,`left`]}];let c=[],l=e===`outer`||e===`topOnly`||e===`topBottom`,u=e===`outer`||e===`bottomOnly`||e===`topBottom`,d=e===`outer`||e===`leftOnly`,f=e===`outer`||e===`rightOnly`;if(l){let e=s(r,r,a,o);e.length&&c.push({cellIds:e,sides:[`top`]})}if(u){let e=s(i,i,a,o);e.length&&c.push({cellIds:e,sides:[`bottom`]})}if(d){let e=s(r,i,a,a);e.length&&c.push({cellIds:e,sides:[`left`]})}if(f){let e=s(r,i,o,o);e.length&&c.push({cellIds:e,sides:[`right`]})}if(l||u||d||f)return c;if((e===`inner`||e===`innerHorizontal`)&&i>r){let e=s(r,i-1,a,o);e.length&&c.push({cellIds:e,sides:[`bottom`]})}if((e===`inner`||e===`innerVertical`)&&o>a){let e=s(r,i,a,o-1);e.length&&c.push({cellIds:e,sides:[`right`]})}return c}(t,e.getFocusedCellRange()??{minRow:0,maxRow:e.rows-1,minCol:0,maxCol:e.cols-1},(t,n)=>e.getCell(t,n));for(let{cellIds:e,sides:t}of i)n.setCellBorders(e,t,r)}};return n}).actions(e=>({clone(t={},{skipSelect:n=!1}={}){let r=JSON.parse(JSON.stringify(e.toJSON()));if(t.id=t.id||Cy(10),r.cells){let e=new Map;r.cells.forEach(t=>{let n=t.id,r=Cy(10);e.set(n,r),t.id=r}),r.cells.forEach(t=>{t.mergedInto&&e.has(t.mergedInto)&&(t.mergedInto=e.get(t.mergedInto))})}return Object.assign(r,t),e.page.addElement(r,{skipSelect:n})}})),iM=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},aM=(e,t)=>{if(e.children)for(let n of e.children){if(!0===t(n))break;aM(n,t)}};function oM(e){let t=(t,n,r)=>{let i=t.map(t=>e.children.findIndex(e=>e.id===t)).filter(e=>e!==-1).sort((e,t)=>(t-e)*n);for(let a of i){let i=e.children[a+n];!i||t.indexOf(i.id)>=0||r(a)}},n=(e,n)=>{let r=!1;return t(e,n,()=>{r=!0}),r},r=(n,r)=>{t(n,r,t=>{let n=e.children[t];Zh(n),e.children.splice(t+r,0,n)})},i=(t,n)=>{let r=[],i=[];e.children.forEach(e=>{(t.indexOf(e.id)>=0?r:i).push(e)}),e.children.replace(n?i.concat(r):r.concat(i))};return{canMoveElementsUp:e=>n(e,1),canMoveElementsTop:e=>n(e,1),canMoveElementsDown:e=>n(e,-1),canMoveElementsBottom:e=>n(e,-1),moveElementsUp(e){r(e,1)},moveElementsDown(e){r(e,-1)},moveElementsTop(e){i(e,!0)},moveElementsBottom(e){i(e,!1)},setElementZIndex(t,n){let r=e.children.find(e=>e.id===t);r&&(Zh(r),e.children.remove(r),e.children.splice(n,0,r))}}}var sM=[...Array(20)].map((e,t)=>K.late(()=>hM[t])),cM=K.union({dispatcher:e=>{let t=gM[e.type];if(!t){let t=`Unknown element type: "${e.type}"`;throw s(`DESIGN_INVALID`,t,{errors:[{path:`type`,message:t}],knownTypes:Object.keys(gM)})}return t}},Ij,Mj,Nj,Fj,Pj,Lj,Rj,rM,K.late(()=>mM),...sM),lM=Object.freeze({x:0,y:0,offsetX:0,offsetY:0,scaleX:1,scaleY:1,rotation:0,opacity:1});function uM(e){return e===1?lM:Object.assign(Object.assign({},lM),{opacity:e})}var dM={x:0,y:0,width:0,height:0,rotation:0,opacity:1,fontSize:0,cropX:0,cropY:0,cropWidth:1,cropHeight:1},fM=(e,t)=>typeof e==`number`&&isFinite(e)?e:t;function pM(e,t,n,r){dM.x=e.x,dM.y=e.y,dM.width=e.width,dM.height=e.height,dM.opacity=r;let i=Tj({element:dM,animation:t,dTime:n})||{},a=fM(i.width,e.width),o=fM(i.height,e.height);return{x:fM(i.x,e.x),y:fM(i.y,e.y),width:a>0?a:e.width,height:o>0?o:e.height,rotation:fM(i.rotation,0),opacity:fM(i.opacity,r)}}var mM=fj.named(`Group`).props({type:`group`,children:K.array(cM),animations:K.array(Ej)}).views(e=>({get draggable(){let t=!0;return aM(e,e=>{e.draggable||(t=!1)}),t},get resizable(){let t=!0;return aM(e,e=>{e.resizable||(t=!1)}),t},get contentEditable(){let t=!0;return aM(e,e=>{e.contentEditable||(t=!1)}),t},get styleEditable(){let t=!0;return aM(e,e=>{e.styleEditable||(t=!1)}),t},get locked(){let t=!0;return aM(e,e=>{e.locked||(t=!1)}),t},get _restingBbox(){let t=[];if(aM(e,e=>{if(e.type===`group`)return;let n=e.width,r=e.height;!n||!r||n<=0||r<=0||t.push({x:e.x??0,y:e.y??0,width:n,height:r,rotation:e.rotation??0})}),!t.length)return null;let n=vj(t);return n.width<=0||n.height<=0?null:{x:n.x,y:n.y,width:n.width,height:n.height}},get a(){if(!$h(e))return lM;let t=r(e);if(t===null||e.store.isEditingPaused&&this.isSelectedDirectly)return uM(e.opacity);let n=e.page,i=e.store.animatedElementsIds;if(i.length&&!i.includes(e.id))return uM(e.opacity);let a,o,s;for(let t of e.animations)t.enabled&&(t.type===`enter`?a=t:t.type===`exit`?o=t:t.type===`loop`&&(s=t));let c=!!a&&t<a.delay,l=!!a&&t>=a.delay&&t<=a.delay+a.duration,u=!c&&!l&&!!o&&t>=n.duration-o.duration-o.delay&&t<=n.duration-o.delay,d=!!o&&t>=n.duration-o.delay;if(!(c||l||u||d||s))return uM(e.opacity);let f=this._restingBbox;if(!f)return uM(e.opacity);let p={x:f.x,y:f.y,width:f.width,height:f.height,rotation:0,opacity:e.opacity};c&&(p.opacity=0),l&&(p=pM(f,a,t-a.delay,e.opacity)),u&&(p=pM(f,o,t-(n.duration-o.duration-o.delay),e.opacity)),d&&(p.opacity=0),s&&(p=pM(p,s,t,p.opacity));let m=yj(p);return{x:m.x,y:m.y,offsetX:f.x+f.width/2,offsetY:f.y+f.height/2,scaleX:p.width/f.width,scaleY:p.height/f.height,rotation:p.rotation,opacity:p.opacity}},get isSelectedDirectly(){return!!$h(e)&&e.store.selectedElements.indexOf(e)>=0&&e.selectable},get active(){return!0}})).actions(e=>Object.assign(Object.assign({set(t){var{draggable:n,contentEditable:r,styleEditable:i,resizable:a}=t,o=iM(t,[`draggable`,`contentEditable`,`styleEditable`,`resizable`]);n!==void 0&&aM(e,e=>{e.set({draggable:n})}),r!==void 0&&aM(e,e=>{e.set({contentEditable:r})}),i!==void 0&&aM(e,e=>{e.set({styleEditable:i})}),a!==void 0&&aM(e,e=>{e.set({resizable:a})}),Object.assign(e,o)},addElement(t,{skipSelect:n=!1}={}){let r=gM[t.type];if(!r){console.error(`Can not find model with type `+t.type);return}t.children&&t.children.forEach(e=>{e.id=e.id||Cy(10)});let i=r.create(Object.assign({id:Cy(10)},t));return e.children.push(i),i.selectable&&!n&&e.store.selectElements([i.id]),i}},oM(e)),{setAnimation(t,n){let r=e.animations.find(e=>e.type===t);r?Object.assign(r,n):e.animations.push(Object.assign({type:t},n))}})),hM=[],gM={svg:Ij,text:Mj,image:Nj,group:mM,line:Fj,video:Pj,figure:Lj,gif:Rj,table:rM},_M=K.model(`Page`,{id:K.identifier,children:K.array(K.late(()=>cM)),width:K.optional(K.union(K.number,K.literal(`auto`)),`auto`),height:K.optional(K.union(K.number,K.literal(`auto`)),`auto`),background:`white`,bleed:0,bleedTop:K.maybe(K.number),bleedRight:K.maybe(K.number),bleedBottom:K.maybe(K.number),bleedLeft:K.maybe(K.number),custom:K.frozen(),duration:5e3,_exporting:!1,_rendering:!1,_forceMount:!1}).postProcessSnapshot(e=>{let t=Object.assign({},e),n={};for(var r in t)r[0]!==`_`&&(n[r]=e[r]);return n}).views(e=>({get store(){return Kh(e,SM)}})).views(e=>({get startTime(){let t=0;for(let n of e.store.pages){if(n.id===e.id)return t;t+=n.duration}return t},get _exportingOrRendering(){return e._exporting||e._rendering},get playheadLocalTime(){if(!$h(e))return null;let t=e.store;if(!t?.playheadAccurate)return null;let n=t.effectiveTime-this.startTime;return n<0||n>e.duration?null:Math.min(n,Math.max(0,e.duration-1))}})).views(e=>({get computedWidth(){return e.width===`auto`?e.store.width:e.width},get computedHeight(){return e.height===`auto`?e.store.height:e.height},get computedBleed(){return np(e)}})).actions(e=>({toJSON:()=>JSON.parse(JSON.stringify(Uh(e)))})).actions(e=>Object.assign(Object.assign({clone(t={}){let n=e.toJSON(),r=new Map;n.children.forEach(e=>{let t=e.id,n=Cy(10);r.set(t,n),e.id=n,wb(e,e=>{let t=e.id,n=Cy(10);r.set(t,n),e.id=n})}),n.children.forEach(e=>{e.cells&&e.cells.forEach(e=>{e.mergedInto&&r.has(e.mergedInto)&&(e.mergedInto=r.get(e.mergedInto))})});let i=Object.assign(Object.assign(Object.assign({},n),{id:Cy(10)}),t),a=e.store.selectedPages.includes(e),o=e.store.addPage(i),s=e.store.pages.indexOf(e);return o.setZIndex(s+1),a&&e.store.selectPages([o.id]),o},setZIndex(t){e.store.setPageZIndex(e.id,t)},set(t){Object.assign(e,t)},select(){e.store.selectPage(e.id)},addElement(t,{skipSelect:n=!1}={}){let r=gM[t.type];if(!r){console.error(`Can not find model with type `+t.type);return}`children`in t&&Array.isArray(t.children)&&wb(t,e=>{e.id=e.id||Cy(10)});let i=e.children.reduce((e,n)=>{if(n.type===`group`){let r=n.children.reduce((e,n)=>{let r=n.name?.match(RegExp(`${t.type}-(\\d+)`));if(r){let t=parseInt(r[1],10);return Math.max(e,t||0)}},0);return Math.max(e,r||0)}{let r=n.name.match(RegExp(`${t.type}-(\\d+)`));if(r){let t=parseInt(r[1],10);return Math.max(e,t||0)}}return e},0),a=r.create(Object.assign({id:Cy(10),name:`${t.type}-${i+1}`},t));return e.children.push(a),a.selectable&&!n&&e.store.selectElements([a.id]),a}},oM(e)),{setSize({width:t,height:n,useMagic:r,softChange:i}){if(r){let r=[],i=t=>t.type===`image`&&t.x<1&&t.y<1&&t.width>=e.computedWidth-2&&t.height>=e.computedHeight-2;aM(e,e=>{e.type!==`group`&&(i(e)||r.push(e))});let a=r.length?vj(r):{x:0,y:0,width:e.computedWidth,height:e.computedHeight},o=1/4,s=Math.max(0,Math.min(a.x,e.computedWidth-a.x-a.width)),c=e.computedWidth*o,l=Math.max(0,s-c),u=Math.max(0,Math.min(a.y,e.computedHeight-a.y-a.height)),d=e.computedHeight*o,f=Math.max(0,u-d),p=e.computedWidth-2*l,m=e.computedHeight-2*f,h=t/p,g=n/m,_=Math.min(h,g),v=(t-p*_)/2-l*_,y=(n-m*_)/2-f*_;aM(e,e=>{if(e.type!==`group`){if(i(e))e.set({x:e.x*_,y:e.y*_,width:e.width*h,height:e.height*g,cropX:0,cropY:0,cropWidth:1,cropHeight:1});else if(e.set({x:v+e.x*_,y:y+e.y*_,width:e.width*_,height:e.height*_}),e.type===`text`)e.set({fontSize:e.fontSize*_});else if(e.type===`figure`)e.set({strokeWidth:e.strokeWidth*_});else if(e.type===`table`){e.set({borderWidth:e.borderWidth*_});for(let t of e.cells){let e={fontSize:t.fontSize*_,cellPadding:t.cellPadding*_};if(t.borders){let n=JSON.parse(JSON.stringify(t.borders));for(let e of[`top`,`right`,`bottom`,`left`])n[e]?.width!=null&&(n[e]=Object.assign(Object.assign({},n[e]),{width:n[e].width*_}));e.borders=n}t.set(e)}}}})}i||(e.width=t),i||(e.height=n)}})).actions(e=>({moveElementUp(t){console.warn(`page.moveElementUp(id) is deprecated. Please use page.moveElementsUp([id1, id2]) instead.`),e.moveElementsUp([t])},moveElementDown(t){console.warn(`page.moveElementDown(id) is deprecated. Please use page.moveElementsDown([id1, id2]) instead.`),e.moveElementsDown([t])},moveElementTop(t){console.warn(`page.moveElementTop(id) is deprecated. Please use page.moveElementsTop([id1, id2]) instead.`),e.moveElementsTop([t])},moveElementBottom(t){console.warn(`page.moveElementBottom(id) is deprecated. Please use page.moveElementsBottom([id1, id2]) instead.`),e.moveElementsBottom([t])},play(){e.store.play({startTime:e.startTime,endTime:e.startTime+e.duration})}})),vM=K.model(`Audio`,{id:K.identifier,name:``,src:``,duration:0,startTime:0,endTime:1,volume:1,delay:0,speed:1,custom:K.frozen()}).views(e=>({get visibleDuration(){return(e.endTime-e.startTime)*e.duration/e.speed}})).actions(e=>({toJSON:()=>Object.assign({},Uh(e))})).actions(e=>({set(t){Object.assign(e,t)}})),yM=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};kh(`ignore`);var bM=K.model(`Font`,{fontFamily:K.string,url:K.optional(K.string,``),styles:K.frozen()}).preProcessSnapshot(e=>Object.assign(Object.assign({},e),{fontFamily:e.fontFamily||e.name})),xM={ADMIN:`admin`,VIEWER:`viewer`},SM=K.model(`Store`,{role:``,pages:K.array(_M),fonts:K.array(bM),audios:K.array(vM),width:1080,height:1080,currentTime:0,isPlaying:!1,scale:1,scaleToFit:1,unit:K.optional(K.enumeration(`UnitType`,[`pt`,`mm`,`cm`,`in`,`px`]),`px`),dpi:72,schemaVersion:4,bleedVisible:!1,rulesVisible:!1,distanceGuidesVisible:!1,timingPreview:K.optional(K.enumeration(`TimingPreview`,[`all`,`playhead`]),`all`),openedSidePanel:``,previousOpenedSidePanel:``,custom:K.frozen(),tool:K.optional(K.enumeration(`Tool`,[`selection`,`draw`,`pan`,`text`,`eraser`]),`selection`),toolOptions:K.optional(K.model({brushType:K.optional(K.enumeration(`BrushType`,[`brush`,`highlighter`]),`brush`),strokeWidth:K.optional(K.number,5),stroke:K.optional(K.string,`#000000`),opacity:K.optional(K.number,1)}),{}),selectedElementsIds:K.array(K.string),animatedElementsIds:K.array(K.string),history:K.optional(xy,{targetPath:`../pages`}),_elementsPixelRatio:Math.min(2,typeof window<`u`&&window.devicePixelRatio||1),_activePageId:``,_selectedPagesIds:K.array(K.string),_forceShowCredit:!1,_validated:!1}).views(e=>{let t=rn(()=>{let t={};return wb({children:e.pages},e=>(t[e.id]=e,!1)),t},{keepAlive:!0});return{get _idsMap(){return t.get()}}}).views(e=>({get _bleedVisible(){return console.warn(`store._bleedVisible is deprecated. Please use store.bleedVisible instead.`),e.bleedVisible},get selectedElements(){return e.selectedElementsIds.map(t=>e._idsMap[t]).filter(e=>!!e)},get children(){return e.pages},get selectedShapes(){let e=[];return aM({children:this.selectedElements},t=>{t.type!==`group`&&e.push(t)}),e},get activePage(){return e.pages.slice().find(t=>t.id===e._activePageId)||(e.pages.length?e.pages[0]:null)},get selectedPages(){return e._selectedPagesIds.map(t=>e.pages.find(e=>e.id===t))},get duration(){let t=0;return e.pages.forEach(e=>{t+=e.duration}),t},pageAtTime(t){for(let n of e.pages)if(t>=n.startTime&&t<n.startTime+n.duration)return n;return e.pages.length&&t>=this.duration?e.pages[e.pages.length-1]:null},get effectiveTime(){if(e.isPlaying)return e.currentTime;let t=this.activePage;return t&&this.pageAtTime(e.currentTime)!==t?t.startTime:e.currentTime},get playheadAccurate(){return e.isPlaying||e.timingPreview===`playhead`},get isEditingPaused(){return!e.isPlaying&&!this.activePage?._exportingOrRendering},get _hasCroppedImages(){return this.find(e=>e.type===`image`&&e._cropModeEnabled)},find(t){let n;return wb({children:e.pages},e=>{if(!n&&t(e))return n=e,!0}),n},getElementById:t=>e._idsMap[t]})).actions(e=>{let t=0,n=null,r=!1,i={afterCreate(){e.history.canUndo},setCurrentTime(t){e.currentTime=t},_togglePlaying(t=!e.isPlaying){e.isPlaying=t},play({animatedElementsIds:a=[],startTime:o=0,currentTime:s=0,endTime:c=e.duration,repeat:l=!1}={}){s&&(console.warn(`currentTime property of store.play() is deprecated. Please use startTime instead.`),o=s),e.animatedElementsIds=eg(a),e.currentTime=o,e.isPlaying=!0,t=Date.now(),n=c,r=l,requestAnimationFrame(()=>i.seek())},checkActivePage(){let t=e.pageAtTime(e.currentTime);t&&i.selectPage(t.id)},seek(){if(!e.isPlaying)return;let a=Date.now(),o=a-t;t=a,e.currentTime+=o;let s=n||e.duration;e.currentTime>=s&&!r&&(e.currentTime=s),i.checkActivePage(),e.isPlaying&&e.currentTime<s?requestAnimationFrame(()=>i.seek()):e.isPlaying&&r?(e.currentTime=0,requestAnimationFrame(()=>i.seek())):i.pause()},pause(){e.isPlaying=!1,e.animatedElementsIds=eg([])},stop(){i.pause(),e.currentTime=0,i.checkActivePage()},__(){e._validated||=(nb(e._forceShowCredit),!0)},set(t){Object.assign(e,t)},setUnit({unit:t,dpi:n}){e.unit=t||e.unit,e.dpi=n||e.dpi},setRole(t){e.role=t},setTool(t){e.tool=t},setToolOptions(t){Object.assign(e.toolOptions,t)},addPage(t){let n=_M.create(Object.assign({id:Cy(10)},t));return e.pages.push(n),e._activePageId=n.id,e._selectedPagesIds=eg([]),n},selectPage(t){e._activePageId=t,e._selectedPagesIds.length===1&&(e._selectedPagesIds=eg([t]))},selectPages(t){e._selectedPagesIds=eg(t),e._selectedPagesIds.length===1&&(e._activePageId=e._selectedPagesIds[0])},selectElements(t){let n=t.map(t=>e.getElementById(t)).filter(e=>!!e);n.sort((e,t)=>(e.parent?.children.indexOf(e)??0)-(t.parent?.children.indexOf(t)??0)),e.selectedElementsIds=eg(n.map(e=>e.id))},toggleBleed(t){e.bleedVisible=t??!e.bleedVisible},toggleRulers(t){e.rulesVisible=t??!e.rulesVisible},setTimingPreview(t){e.timingPreview=t},toggleDistanceGuides(t){e.distanceGuidesVisible=t??!e.distanceGuidesVisible},openSidePanel(t){e.openedSidePanel!==t&&(e.previousOpenedSidePanel=e.openedSidePanel,e.openedSidePanel=t)},restoreSidePanel(){let t=e.previousOpenedSidePanel;e.openedSidePanel=t&&t!==e.openedSidePanel?t:`photos`},setScale(t){e.scale=t},_setScaleToFit(t){e.scaleToFit=t},setElementsPixelRatio(t){e._elementsPixelRatio=t},setSize(t,n,r){e.pages.forEach(e=>{e.setSize({width:t,height:n,useMagic:r,softChange:!0})}),e.width=t,e.height=n},setPageZIndex(t,n){let r=e.pages.find(e=>e.id===t);r&&(Zh(r),e.pages.remove(r),e.pages.splice(n,0,r))},deletePages(t){let n=e.pages.indexOf(e.activePage);t.forEach(t=>{Qh(e.pages.find(e=>e.id===t))});let r=e._selectedPagesIds.filter(t=>e.pages.some(e=>e.id===t)),a=Math.min(e.pages.length-1,n),o=e.pages[a];o&&(e._activePageId=o.id),i.selectPages(r),e.selectedElementsIds=eg(e.selectedElementsIds.filter(t=>e.getElementById(t)))},groupElements(t,n={}){let r=t.map(t=>e.getElementById(t)).filter(e=>!!e);if(!r.length)return;let i=r[0].parent;if(!i)return;if(!r.every(e=>e.parent===i)){console.warn(`store.groupElements: refusing to group elements that do not share a parent. Pass ids whose elements all live under the same page or the same group.`);return}r.forEach(e=>Zh(e));let a=i.children.reduce((e,t)=>{if(t.type===`group`){let n=t.name?.match(/group-(\d+)/);if(n){let t=parseInt(n[1],10);return Math.max(e,t)}}return e},0),o=Object.assign({id:Cy(10),name:`group-${a+1}`,children:r,type:`group`},n);return i.children.push(o),e.selectedElementsIds=eg([o.id]),i.children.find(e=>e.id===o.id)},ungroupElements(t){let n=t.map(t=>e.getElementById(t)),r=[];n.forEach(e=>{if(e&&e.type===`group`){let t=e.parent;if(!t)return;let n=t.children.indexOf(e);e.children.forEach(e=>{r.push(e.id)}),e.children.slice().forEach(e=>{Zh(e),t.children.push(e)}),t.children.splice(n,1)}}),e.selectedElementsIds=eg(r)},deleteElements(t){let n=[];e.find(e=>(t.includes(e.id)&&n.push(e),!1)),n.forEach(e=>{Qh(e)}),e.selectedElementsIds=eg(e.selectedElementsIds.filter(t=>e.getElementById(t)))},on(t,n){if(t===`change`){let t=i.toJSON();return Bh(e,e=>{let r=i.toJSON();!by(t,r)&&(t=r,n(r))})}},async _toCanvas({pixelRatio:t,ignoreBackground:n,pageId:r,mimeType:a,includeBleed:o,_skipTimeout:c,quickMode:u=!1,_exportCanvases:f}={}){let p=t||1;r||=e.pages[0]?.id;let m=e.pages.find(e=>e.id===r);if(!m)throw s(`EXPORT_FAILED`,`No page for export with id ${r}`,{reason:`page-not-found`,pageId:r,availablePageIds:e.pages.map(e=>e.id)});let h=e._elementsPixelRatio;try{(u?p>e._elementsPixelRatio:p!==e._elementsPixelRatio)&&i.setElementsPixelRatio(p),u?m?.set({_forceMount:!0}):m?.set({_exporting:!0});let t=await DS(()=>{let e=d.stages.filter(e=>e.getAttr(`pageId`)===r);return e.length===0?null:e});if(!t)throw s(`EXPORT_FAILED`,`Export is failed. Can not find stage for page ${r}. Looks like <Workspace /> component is not mounted, but it is required in order to process the export.`,{reason:`workspace-not-mounted`,pageId:r});t.length>1&&console.error(`Polotno error: Detected several canvas elements for page "${r}" in the document. This is not supported and will lead to incorrect export. Make sure to use unique ids for all pages and make sure you unmount <Workspace /> when it is not needed.`);let h=t[0];await i.waitLoading({_skipTimeout:c});let g=h.findOne(`.page-container`);if(!g)throw s(`EXPORT_FAILED`,`Export is failed. Canvas was unmounted.`,{reason:`unmounted-during-export`,pageId:r});let _=h.position();h.position({x:0,y:0}),h.find(`Transformer`).forEach(e=>{e.setAttr(`oldVisible`,e.visible()),e.visible(!1)}),g.find(`.page-background`).forEach(e=>e.shadowEnabled(!1)),g.find(`.page-background`).forEach(e=>e.strokeEnabled(!1)),g.find(`.highlighter`).forEach(e=>e.visible(!1));let v=g.findOne(`.page-background-group`),y=v.clip();v.clip({x:null,y:null,width:null,height:null});let b=g.findOne(`.elements-container`),x=b.clip();b.clip({x:null,y:null,width:null,height:null});let S=g.find(e=>!e.visible()&&e.getAttr(`editModeEnabled`)&&!e.getAttr(`hideInExport`));S.forEach(e=>{e.setAttr(`oldVisible`,e.visible()),e.show()});let C=g.find(e=>e.getAttr(`hideInExport`));C.forEach(e=>{e.setAttr(`oldVisible`,e.visible()),e.hide()}),n&&g.find(`.page-background`).forEach(e=>e.hide());let w=o?m.computedBleed:rp,T=w.left,E=w.top;!e.bleedVisible&&o||(e.bleedVisible||o?e.bleedVisible&&o?(T=0,E=0):e.bleedVisible&&!o&&(T=-m.computedBleed.left,E=-m.computedBleed.top):(T=0,E=0));let D=m.computedWidth+w.left+w.right,O=m.computedHeight+w.top+w.bottom,k=g.scale();g.scale({x:1,y:1});let A=l(g,{x:g.x()-T,y:g.y()-E,width:D,height:O,pixelRatio:p,imageSmoothingQuality:Ay.imageDownScalingEnabled&&!u?`high`:void 0,sceneCanvas:f?.sceneCanvas,bufferCanvas:f?.bufferCanvas});g.scale(k);let ee=A._canvas;if(a===`image/jpeg`){let e=ee.getContext(`2d`);e.save(),e.globalCompositeOperation=`destination-over`,e.fillStyle=`white`,e.fillRect(0,0,ee.width,ee.height),e.restore()}return n&&g.find(`.page-background`).forEach(e=>e.show()),C.forEach(e=>{e.visible(e.getAttr(`oldVisible`))}),S.forEach(e=>{e.visible(e.getAttr(`oldVisible`))}),g.find(`.page-background`).forEach(e=>e.shadowEnabled(!0)),g.find(`.page-background`).forEach(e=>e.strokeEnabled(!0)),h.find(`Transformer`).forEach(e=>{e.visible(e.getAttr(`oldVisible`))}),g.find(`.highlighter`).forEach(e=>e.visible(!0)),v.clip(y),b.clip(x),h.position(_),m?.set({_exporting:!1,_forceMount:!1}),await Promise.resolve(),ee}finally{i.setElementsPixelRatio(h),m?.set({_forceMount:!1,_exporting:!1})}},async toDataURL(t={}){var{mimeType:n,quality:r,dpi:a,dpiMetadata:o=`auto`}=t,s=yM(t,[`mimeType`,`quality`,`dpi`,`dpiMetadata`]);let c=await i._toCanvas(Object.assign({mimeType:n},s)),l=n||`image/png`,u=c.toDataURL(l,r);d.Util.releaseCanvas(c);let f=a??e.dpi;return l!==`image/png`&&l!==`image/jpeg`||o===`never`||o===`auto`&&f===72?u:SS(u,l,f)},async toBlob(e={}){var{mimeType:t,quality:n}=e,r=yM(e,[`mimeType`,`quality`]);let a=await i._toCanvas(Object.assign({mimeType:t},r)),o=await new Promise(e=>{a.toBlob(e,t,n)});return d.Util.releaseCanvas(a),o},async saveAsImage(e={}){var{fileName:t}=e,n=yM(e,[`fileName`]);let r=(n.mimeType||`image/png`).split(`/`)[1];wy(await i.toDataURL(n),t||`polotno.`+r)},async _toPDF(t){let n=t.dpi||e.dpi,r=t.parallel||1,a=t.unit||(e.unit===`px`?`mm`:e.unit),o=t.pixelRatio||1,c=t.pageIds||(t.pageId?[t.pageId]:e.pages.map(e=>e.id)),l=e.pages.filter(e=>c.includes(e.id)),u=await Ey(),d=e=>CS({px:e,unit:a,dpi:n}),f=t.cropMarkSize||0,p=d(f),m=l[0]||{},h=t.includeBleed&&m.computedBleed||rp,g=d(m.computedWidth+h.left+h.right+2*p),_=d(m.computedHeight+h.top+h.bottom+2*p);var v=new u({unit:a,orientation:g>_?`landscape`:`portrait`,format:[g,_],compress:!0,putOnlyUsedFonts:!0});v.deletePage(1);let y=((e,t)=>{let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n})(l,r),b=0;for(let e of y){let n=e.map(async e=>{let n=t.includeBleed?e.computedBleed:rp,r=e.computedWidth+n.left+n.right+2*f,a=e.computedHeight+n.top+n.bottom+2*f,s=d(r),l=d(a),u=0,p=o;for(;u<10;){u+=1;let d=await i.toDataURL(Object.assign(Object.assign({},t),{pageId:e.id,pixelRatio:p,dpiMetadata:`never`}));if(d.length>20)return p!==o&&console.error(`Polotno can not export PDF with current settings. Quality is automatically reduced. pixelRatio was reduced to ${parseFloat(p.toFixed(3))}.`),t.onProgress&&t.onProgress(++b/c.length*.9),{url:d,width:s,height:l,widthPx:r,heightPx:a,cb:n};p*=.8}});(await Promise.all(n)).filter(e=>e!==void 0).forEach(({url:e,width:t,height:n,widthPx:r,heightPx:i,cb:o})=>{v.addPage([t,n],t>n?`landscape`:`portrait`);let c=v.getCurrentPageInfo();var l;switch(a){case`pt`:l=1;break;case`mm`:l=72/25.4;break;case`cm`:l=72/2.54;break;case`in`:l=72;break;case`px`:l=.75;break;default:throw s(`EXPORT_FAILED`,`Invalid unit: `+a,{reason:`invalid-options`,option:`unit`,value:a})}if(c.pageContext.cropBox={bottomLeftX:0,bottomLeftY:0,topRightX:t*l,topRightY:n*l},c.pageContext.artBox={bottomLeftX:d(f+o.left)*l,bottomLeftY:d(f+o.bottom)*l,topRightX:d(r-f-o.right)*l,topRightY:d(i-f-o.top)*l},c.pageContext.bleedBox={bottomLeftX:d(f+o.left)*l,bottomLeftY:d(f+o.bottom)*l,topRightX:d(r-f-o.right)*l,topRightY:d(i-f-o.top)*l},p){v.setLineWidth(d(1));let e=p+d(o.left),r=p+d(o.right),i=p+d(o.top),a=p+d(o.bottom);v.line(e,0,e,p),v.line(0,i,p,i),v.line(t-r,0,t-r,p),v.line(t,i,t-p,i),v.line(0,n-a,p,n-a),v.line(e,n,e,n-p),v.line(t,n-a,t-p,n-a),v.line(t-r,n,t-r,n-p)}v.addImage(e,p,p,t-2*p,n-2*p,void 0,`FAST`)})}return v},toPDFDataURL:async e=>(await i._toPDF(Object.assign({mimeType:`image/jpeg`},e))).output(`datauristring`),async toGIFDataURL(t={}){let n=t.pixelRatio||1,r=t.pageIds||(t.pageId?[t.pageId]:e.pages.map(e=>e.id)),a=e.pages.filter(e=>r.includes(e.id));if(!a.length)throw s(`EXPORT_FAILED`,`No pages found for GIF export`,{reason:`page-not-found`,pageId:t.pageId,availablePageIds:e.pages.map(e=>e.id)});let o=a[0],l=await Oy({width:o.computedWidth*n,height:o.computedHeight*n}),d=1e3/(t.fps||10),f=c(),p=e._elementsPixelRatio;i.setElementsPixelRatio(n);try{for(let t of a){let r=Math.max(1,Math.floor(t.duration/d));for(let a=0;a<r;a++){let r=t.startTime+a*d||1;i.setCurrentTime(r);for(let n of e.pages)n.set({_rendering:n.id===t.id});let o=await i._toCanvas({pixelRatio:n,pageId:t.id,_skipTimeout:!0,_exportCanvases:f});l.addFrame(o.getContext(`2d`),{delay:d,copy:!0})}}}finally{u(f),i.setElementsPixelRatio(p)}for(let t of e.pages)t.set({_rendering:!1});return i.stop(),l.render(),new Promise(e=>{l.on(`finished`,function(t){(function(e,t){var n=new FileReader;n.onload=function(e){t(e.target.result)},n.readAsDataURL(e)})(t,e)})})},async saveAsGIF(e={}){var{fileName:t}=e,n=yM(e,[`fileName`]);wy(await i.toGIFDataURL(n),t||`polotno.gif`)},async toHTML({elementHook:e}={}){return dj(`store.toHTML`,`store.toHTML()/saveAsHTML() are deprecated: install @polotno/html-export and call jsonToHTML(store.toJSON()) instead`),kA(i.toJSON(),{elementHook:e,textOverflow:Ay.textOverflow,textSplitAllowed:Ay.textSplitAllowed})},async saveAsHTML({fileName:e,elementHook:t}={}){let n=await i.toHTML({elementHook:t});wy(`data:text/html;base64,`+window.btoa(unescape(encodeURIComponent(n))),e||`polotno.html`)},async toSVG({elementHook:e,pageId:t,fontEmbedding:n=`inline`}={fontEmbedding:`inline`}){dj(`store.toSVG`,`store.toSVG()/saveAsSVG() are deprecated: install @polotno/svg-export and call jsonToSVG(store.toJSON()) instead`);let r=i.toJSON();t||=r.pages[0]?.id;let a=r.pages.find(e=>e.id===t);return lj(Object.assign(Object.assign({},r),{pages:a?[a]:[]}),{elementHook:e,fontEmbedding:n})},async saveAsSVG({fileName:e,elementHook:t,pageId:n,fontEmbedding:r=`inline`}={}){let a=await i.toSVG({elementHook:t,pageId:n,fontEmbedding:r});wy(`data:text/svg;base64,`+window.btoa(unescape(encodeURIComponent(a))),e||`polotno.svg`)},async saveAsPDF(e={}){var{fileName:t}=e,n=yM(e,[`fileName`]);(await i._toPDF(Object.assign({mimeType:`image/jpeg`},n))).save(t||`polotno.pdf`)},async waitLoading({_skipTimeout:e=!1}={}){e||await new Promise(e=>setTimeout(e,50)),await gb()},toJSON:()=>({width:e.width,height:e.height,fonts:Uh(e.fonts),pages:Uh(e.pages),audios:Uh(e.audios),unit:e.unit,dpi:e.dpi,custom:e.custom,schemaVersion:e.schemaVersion}),loadJSON(t,n=!1){var r;let i=typeof n==`boolean`?n:(r=n?.keepHistory)!=null&&r,a=typeof n==`boolean`||n==null?void 0:n.modernizeTextBackground,o=Yf(t,{modernTextRenderer:Ay.htmlRenderEnabled||Ay.renderTagTextEnabled,modernizeTextBackground:a});delete o.schemaVersion;let s=e.activePage?e.pages.indexOf(e.activePage):0;o._activePageId=(o.pages[s]||o.pages[0])?.id,o._selectedPagesIds=[];let c=Object.assign({},Uh(e));Object.assign(c,o),c.history=i?Uh(e.history):{history:[],undoIdx:-1,targetPath:``},Hh(e,c)},clear({keepHistory:t=!1}={}){let n=e.pages.map(e=>e.id);i.deletePages(n),e.custom=null,t||e.history.clear()},addFont(t){i.removeFont(t.fontFamily),e.fonts.push(t)},removeFont(t){e.fonts.filter(e=>e.fontFamily===t).forEach(e=>Qh(e))},addAudio(t){let n=vM.create(Object.assign({id:Cy(10)},t));e.audios.push(n)},removeAudio(t){let n=e.audios.find(e=>e.id===t);n&&e.audios.remove(n)},async loadFont(t,n,r,i){let a=e.fonts.find(e=>e.fontFamily===t)||qx.find(e=>e.fontFamily===t),o=[{fontStyle:`normal`,fontWeight:`normal`},{fontStyle:`normal`,fontWeight:`bold`}];return a?(a.styles&&(o=a.styles.map(e=>({fontStyle:e.fontStyle||`normal`,fontWeight:e.fontWeight||`normal`}))),hS(a)):fS(t),n&&r&&!o.some(e=>e.fontStyle===n&&e.fontWeight===r)&&o.push({fontStyle:n,fontWeight:r}),Promise.all(o.map(e=>iS(t,e.fontStyle,e.fontWeight,i)))},validate:e=>SM.validate(e,[{path:``,type:SM}]).map(e=>({path:`store`+e.context.map(e=>e.path).join(`.`),message:e.message}))};return i});function CM({key:e,showCredit:t}={key:``,showCredit:!1}){return Yy(e),SM.create({_forceShowCredit:t})}var wM=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},TM=e=>{let t=window.getComputedStyle(e).position;return t!==`absolute`&&t!==`relative`};function EM(e=()=>{}){let t=j.useRef(e);return t.current=e,j.useCallback((...e)=>t.current.apply(null,e),[])}var DM=({children:e,groupProps:t,divProps:n,transform:r,transformFunc:i,parentNodeFunc:a})=>{let o=Im(),s=j.useRef(null),[c]=j.useState(()=>document.createElement(`div`)),l=j.useMemo(()=>M.createRoot(c),[c]),u=r??!0,d=EM(()=>{if(u&&s.current){let e=s.current.getAbsoluteTransform().decompose();i&&(e=i(e)),c.style.position=`absolute`,c.style.zIndex=`10`,c.style.top=`0px`,c.style.left=`0px`,c.style.transform=`translate(${e.x}px, ${e.y}px) rotate(${e.rotation}deg) scaleX(${e.scaleX}) scaleY(${e.scaleY})`,c.style.transformOrigin=`top left`}else c.style.position=``,c.style.zIndex=``,c.style.top=``,c.style.left=``,c.style.transform=``,c.style.transformOrigin=``;let e=n||{},{style:t}=e,r=wM(e,[`style`]);Object.assign(c.style,t),Object.assign(c,r)});return j.useLayoutEffect(()=>{let e=s.current;if(!e)return;let t=a?a({stage:e.getStage()}):e.getStage()?.container();if(t)return t.appendChild(c),u&&TM(t)&&(t.style.position=`relative`),e.on(`absoluteTransformChange`,d),d(),()=>{var t;e.off(`absoluteTransformChange`,d),(t=c.parentNode)==null||t.removeChild(c)}},[u,a]),j.useLayoutEffect(()=>{d()},[n,i]),j.useLayoutEffect(()=>{queueMicrotask(()=>{(0,ha.flushSync)(()=>{l.render(j.createElement(o,null,e))})})}),j.useLayoutEffect(()=>()=>{setTimeout(()=>{l.unmount()})},[]),j.createElement(Vm,Object.assign({ref:s},t))},OM=({selector:e,enabled:t,children:n})=>{let r=j.useRef(null),i=j.useRef(null),a=j.useRef(null),o=t??!0;return j.useLayoutEffect(()=>{if(!r.current||!i.current)return;a.current=i.current;let t=r.current.getStage().findOne(e);o&&t?i.current.moveTo(t):i.current.moveTo(r.current);let n=r.current.getLayer();if(n&&(n.batchDraw(),t)){let e=t.getLayer();if(!e)return;e.batchDraw()}},[e,o]),j.useEffect(()=>()=>{var e;(e=a.current)==null||e.destroy()},[]),j.createElement(Vm,{name:`_outer_portal`,ref:r},j.createElement(Vm,{name:`_inner_portal`,ref:i},n))};function kM(e,t,n){return _r(()=>{$h(e)&&t()},n)}function AM(e,t,n,r){return br(()=>$h(e)?t():void 0,(t,r)=>{$h(e)&&n(t,r)},r)}var jM=(e,t,n)=>(t===void 0&&(t=e.fill??``),n===void 0&&(n=`fill`),j.useMemo(()=>{if(!vC(t))return{[n]:t};let{stops:r,rotation:i}=xC(t),a=e.a.width/2,o=e.a.height/2,s=(i%180+180)%180,c=s>45&&s<135?e.a.width:e.a.height,l=d.Util.degToRad(i)-Math.PI/2,u=[];return r.forEach(({offset:e,color:t})=>{u.push(e,t)}),n===`fill`?{fillLinearGradientStartPointX:a-c/2*Math.cos(l),fillLinearGradientStartPointY:o-c/2*Math.sin(l),fillLinearGradientColorStops:u,fillLinearGradientEndPointX:a+c/2*Math.cos(l),fillLinearGradientEndPointY:o+c/2*Math.sin(l),fill:r[1].color,fillPriority:`linear-gradient`}:{strokeLinearGradientStartPointX:a-c/2*Math.cos(l),strokeLinearGradientStartPointY:o-c/2*Math.sin(l),strokeLinearGradientColorStops:u,strokeLinearGradientEndPointX:a+c/2*Math.cos(l),strokeLinearGradientEndPointY:o+c/2*Math.sin(l)}},[t,e.width,e.height])),MM=class{constructor(e){this.map=new Map,this._maxEntries=e}get maxEntries(){return this._maxEntries}get size(){return this.map.size}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this._maxEntries){let e=this.map.keys().next().value;this.map.delete(e)}this.map.set(e,t)}setWithEviction(e,t,n){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this._maxEntries){let e=this.map.keys().next().value,t=this.map.get(e);this.map.delete(e),n(e,t)}this.map.set(e,t)}clear(){this.map.clear()}forEach(e){this.map.forEach(e)}resize(e){for(this._maxEntries=e;this.map.size>e;){let e=this.map.keys().next().value;this.map.delete(e)}}},NM=new MM(500);function PM(e){if(!e||!e.includes(`<`))return!1;let t=NM.get(e);if(t===void 0){t=!1;let n=zb(e);if(n){if(n.querySelector(`ol, ul`))t=!0;else for(let e of n.querySelectorAll(`[style]`))if(e.style.fontSize||e.style.letterSpacing){t=!0;break}}NM.set(e,t)}return t}function FM(e,t){return Yb(function(e){let t=(e||``).trim();if(t===`<p><br></p>`||t===`<p></p>`)return``;if(t.startsWith(`<p>`)&&t.endsWith(`</p>`)){let e=t.slice(3,-4);if(!/(<\/?(p|div|h[1-6]|ul|ol|li|table|thead|tbody|tr|td|blockquote)\b)/i.test(e))return e}return e}(e),t)}function IM(e){if(!e||!e.includes(`<p`))return e;let t=zb(e);if(!t)return e;for(let e of Array.from(t.querySelectorAll(`p`))){let n=!1,r=[],i=t.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),a=i.nextNode();for(;a;){if((a.textContent||``).length>0){let t=a.parentElement,i=null;for(;t&&t!==e;){let e=t.style?.fontSize;if(e){let t=parseFloat(e);if(!Number.isNaN(t)){i=t;break}}t=t.parentElement}if(i==null){n=!0;break}r.push(i)}a=i.nextNode()}!n&&r.length>0&&(e.style.fontSize=`${Math.min(...r)}px`)}return t.innerHTML}function LM(e,t){let n=t.fontFamily,r=String(Lb(t.fontWeight)),i=t.fontStyle===`italic`?`italic`:`normal`,a=new Map,o=(e,t,n)=>{let r=`${e}\0${t}\0${n}`;a.has(r)||a.set(r,{family:e,weight:t,style:n})};if(o(n,r,i),e&&e.includes(`<`)){let t=zb(e);if(t){let e=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT),a=e.nextNode();for(;a;){if((a.textContent||``).trim().length>0){let e=``,s=``,c=``,l=a.parentElement;for(;l&&l!==t;){if(!e){if(l.style.fontFamily)e=Fb(l.style.fontFamily)||``;else{let t=(l.getAttribute(`class`)||``).split(/\s+/).find(e=>e.startsWith(`ql-font-`));t&&(e=Pb(t))}}s||(l.style.fontWeight?s=String(Lb(l.style.fontWeight)):l.tagName!==`STRONG`&&l.tagName!==`B`||(s=`700`)),c||(l.style.fontStyle?c=l.style.fontStyle:l.tagName!==`EM`&&l.tagName!==`I`||(c=`italic`)),l=l.parentElement}o(e||n,s||r,c||i)}a=e.nextNode()}}}return[...a.values()]}function RM(e){return!!e?.style&&(e.style.getPropertyValue(`-webkit-background-clip`)||e.style.getPropertyValue(`background-clip`))===`text`&&e.style.backgroundImage.includes(`gradient`)}var zM=Symbol(`unset`);function BM(e,t){let n=zM;for(let r of e.ops){if(typeof r.insert!=`string`||r.insert===`
384
+ `)continue;let e=r.attributes?.[t];if(n===zM)n=e;else if(e!==n)return!0}return!1}var VM=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},HM=e=>e>0?Math.max(1,Math.round(e)):0,UM=e=>(e.getStage()?.findOne(`Transformer`))?.getActiveAnchor()??``,WM=e=>!(e.includes(`middle`)||e.includes(`center`)),GM=(e,t)=>e<t?1:t,KM=e=>!!e.curveEnabled||(e.letterSpacing??0)!==0||PM(e.text),qM=(e,t)=>({cornerRadius:(e.cornerRadius??0)*t,shadowBlur:e.shadowBlur*t,shadowOffsetX:e.shadowOffsetX*t,shadowOffsetY:e.shadowOffsetY*t}),JM=e=>({cornerRadius:HM(e.cornerRadius??0),shadowBlur:Math.round(e.shadowBlur),shadowOffsetX:Math.round(e.shadowOffsetX),shadowOffsetY:Math.round(e.shadowOffsetY)}),YM=(e,t)=>{let n=e.fontSize>0?t/e.fontSize:1;return{fontSize:t,strokeWidth:e.strokeWidth*n,shadowBlur:e.shadowBlur*n,shadowOffsetX:e.shadowOffsetX*n,shadowOffsetY:e.shadowOffsetY*n}},XM=e=>Math.round(1e6*e)/1e6+0,ZM=e=>Math.round(1e9*e)/1e9+0,QM=e=>({x:XM(e.x()),y:XM(e.y())}),$M=e=>({x:XM(e.x),y:XM(e.y),width:XM(e.width),height:XM(e.height),rotation:XM(e.rotation)}),eN=(e,t)=>{let n=YM(e,t);return{fontSize:Math.round(n.fontSize),strokeWidth:HM(n.strokeWidth),shadowBlur:Math.round(n.shadowBlur),shadowOffsetX:Math.round(n.shadowOffsetX),shadowOffsetY:Math.round(n.shadowOffsetY)}},tN=e=>{let t=eN(e,e.fontSize),{fontSize:n}=t;return VM(t,[`fontSize`])},nN=e=>Math.min(Math.max(e,0),255),rN={warm:e=>t=>{let n=t.data;e=Math.max(0,Math.min(1,e));for(let t=0;t<n.length;t+=4)n[t]=Math.min(n[t]+30*e,255),n[t+1]=Math.min(n[t+1]+15*e,255);return t},cold:e=>t=>{let n=t.data;e=Math.max(0,Math.min(1,e));for(let t=0;t<n.length;t+=4)n[t]=Math.min(n[t]-15*e,255),n[t+1]=Math.min(n[t+1]-10*e,255),n[t+2]=Math.min(n[t+2]+15*e,255);return t},natural:e=>t=>{let n=t.data;e=Math.max(0,Math.min(1,e));for(let t=0;t<n.length;t+=4){n[t]=Math.min(n[t]*(1+.1*e),255),n[t+1]=Math.min(n[t+1]*(1+.1*e),255),n[t+2]=Math.min(n[t+2]*(1+.1*e),255);let r=(n[t]+n[t+1]+n[t+2])/3;n[t]=Math.min((n[t]-r)*(1+.2*e)+r,255),n[t+1]=Math.min((n[t+1]-r)*(1+.2*e)+r,255),n[t+2]=Math.min((n[t+2]-r)*(1+.2*e)+r,255)}return t},temperature:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4)n[t]=nN(n[t]+15*e),n[t+2]=nN(n[t+2]-15*e);return t},contrast:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));let r=e*100,i=259*(r+255)/(255*(259-r));for(let e=0;e<n.length;e+=4)n[e]=nN(i*(n[e]-128)+128),n[e+1]=nN(i*(n[e+1]-128)+128),n[e+2]=nN(i*(n[e+2]-128)+128);return t},shadows:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=(n[t]+n[t+1]+n[t+2])/3;if(r<128){let i=1+e*(1-r/128)*2;n[t]=nN(n[t]*i),n[t+1]=nN(n[t+1]*i),n[t+2]=nN(n[t+2]*i)}}return t},white:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=(n[t]+n[t+1]+n[t+2])/3;if(r>128){let i=1+e*((r-128)/127);n[t]=nN(n[t]*i),n[t+1]=nN(n[t+1]*i),n[t+2]=nN(n[t+2]*i)}}return t},black:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=(n[t]+n[t+1]+n[t+2])/3;if(r<128){let i=1+e*((128-r)/128);n[t]=nN(n[t]*i),n[t+1]=nN(n[t+1]*i),n[t+2]=nN(n[t+2]*i)}}return t},vibrance:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=n[t],i=n[t+1],a=n[t+2],o=Math.max(r,i,a),s=(r+i+a)/3,c=o===0?0:(o-s)/o,l=e<0?(1-c)*e*1.5:e*.5;n[t]=nN(r-(o-r)*l),n[t+1]=nN(i-(o-i)*l),n[t+2]=nN(a-(o-a)*l)}return t},saturation:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=n[t],i=n[t+1],a=n[t+2],o=.2126*r+.7152*i+.0722*a;n[t]=nN(o+(r-o)*(1+e)),n[t+1]=nN(o+(i-o)*(1+e)),n[t+2]=nN(o+(a-o)*(1+e))}return t}};rN.highlights=rN.white;var iN=rN;function aN(e){let t={filters:[]};return e.brightnessEnabled&&(t.filters.push(d.Filters.Brighten),t.brightness=e.brightness),e.blurEnabled&&(t.filters.push(d.Filters.Blur),t.blurRadius=e.blurRadius),e.sepiaEnabled&&t.filters.push(d.Filters.Sepia),e.grayscaleEnabled&&t.filters.push(d.Filters.Grayscale),e.filters.forEach((e,n)=>{let r=iN[n];r&&t.filters.push(r(e.intensity))}),t}function oN(e){if(e.brightnessEnabled||e.blurEnabled||e.sepiaEnabled||e.grayscaleEnabled)return!0;for(let t of e.filters.keys())if(iN[t])return!0;return!1}function sN(e,t){if(!$h(t))return;let n=aN(t);if(!n.filters.length||!e.width||!e.height)return;let r=e.getContext(`2d`);if(!r)return;let i=r.getImageData(0,0,e.width,e.height),a={brightness:()=>n.brightness,blurRadius:()=>xk(n.blurRadius??0,e.width,e.height)};n.filters.forEach(e=>{typeof e==`function`&&e.call(a,i)}),r.putImageData(i,0,0)}function cN(e){if(!$h(e))return``;let t=[];return e.filters.forEach((e,n)=>{t.push(n+`:`+e.intensity)}),[e.brightnessEnabled&&e.brightness,e.blurEnabled&&e.blurRadius,e.sepiaEnabled,e.grayscaleEnabled,...t].join(`|`)}function lN(e,t){var n;if(!e||!$h(t))return;let r=aN(t),i={};t.blurEnabled&&t.type===`text`&&t.lineHeight<1&&(i.offset=t.fontSize),e.setAttrs(r),r.filters.length?e.cache(Object.assign(Object.assign({},i),{pixelRatio:t.store._elementsPixelRatio})):e.clearCache(),(n=e.getLayer())==null||n.batchDraw()}var uN=()=>`ontouchstart`in window||navigator.maxTouchPoints>0;function dN({oldText:e,newText:t,element:n}){if(!(t.length/Math.max(20,e.length)>=4))return n.fontSize;let r=n.width*n.page.computedHeight/t.length,i=1.5*Math.sqrt(r),a=n.fontSize;return Math.min(a,Math.max(5,Math.round(i)))}function fN(e){try{let{stops:t}=xC(e);if(t.length===0)return 127.5;let n=0,r=0;for(let e of t)try{let t=d.Util.colorToRGBA(e.color);if(!t||t.a<.5)continue;n+=(299*t.r+587*t.g+114*t.b)/1e3,r++}catch{continue}return r===0?127.5:n/r}catch(e){return console.warn(`Error calculating gradient brightness:`,e),127.5}}function pN(e){if(vC(e))return fN(e);let t=d.Util.colorToRGBA(e);if(!t)return 127.5;let{r:n,g:r,b:i}=t;return(299*n+587*r+114*i)/1e3}function mN(e){let{outlineSize:t,outlineColor:n}=function(e){let t=e.strokeWidth||0;return t>0?{outlineSize:t,outlineColor:e.stroke}:{outlineSize:e.shadowEnabled&&e.shadowBlur>0&&e.shadowOpacity>.1?e.shadowBlur*e.shadowOpacity:0,outlineColor:e.shadowColor}}(e);if(t<.001)return e.fill;let r=pN(e.fill),i=pN(n);return Math.abs(r-i)>=50?n:e.fill}function hN(e){return/<\/[a-z][a-z0-9]*>/i.test(e)&&!sx(e).trim()?``:e}var gN;function _N(){return gN||(gN=document.getElementById(`polotno-text-style`),gN||(gN=document.createElement(`style`),gN.id=`polotno-text-style`,document.head.appendChild(gN)),gN)}d._fixTextRendering=!0;var vN={border:`none`,padding:`0px`,overflow:`hidden`,background:`none`,outline:`none`,resize:`none`,overflowWrap:`break-word`,whiteSpace:`pre-wrap`,userSelect:`text`,wordBreak:`normal`,textTransform:`none`},yN=Na(({textNodeRef:e,element:t,onBlur:n,selectAll:r,cursorPosition:i})=>{let[a,o]=j.useState(vN),s=e.current;j.useLayoutEffect(()=>{if(!s)return;let e={};e.width=s.width()-2*s.padding()+`px`,e.height=s.height()-2*s.padding()+s.fontSize()*s.lineHeight()+`px`,e.fontSize=s.fontSize()+`px`,e.lineHeight=s.lineHeight()+.01,e.fontFamily=s.fontFamily(),e.textAlign=s.align(),e.color=s.fill(),e.fontWeight=t.fontWeight,e.fontStyle=t.fontStyle,e.letterSpacing=t.letterSpacing+`em`,e.opacity=Math.max(t.a.opacity,.2),e.textTransform=t.textTransform,e.caretColor=mN(t);let n=`\n .polotno-input::placeholder {\n color: ${a.color};\n opacity: 0.6;\n }\n `,r=_N();r.innerHTML=``,r.appendChild(document.createTextNode(n)),JSON.stringify(e)!==JSON.stringify(a)&&o(e)});let c=j.useRef(null);if(j.useLayoutEffect(()=>{var e;let t=c.current;t&&((e=c.current)==null||e.focus({preventScroll:!0}),t.selectionStart=t.selectionEnd=i||t.value.length,r&&(t?.select(),document.execCommand(`selectAll`,!1,void 0)))},[]),j.useEffect(()=>{window.addEventListener(`blur`,n);let e=e=>{var t;(t=c.current)!=null&&t.contains(e.target)||n()};return window.addEventListener(`touchstart`,e),()=>{window.removeEventListener(`blur`,n),window.removeEventListener(`touchstart`,e)}},[]),!s)return null;let l=0,u=s.textArr.length*s.lineHeight()*s.fontSize(),d=ox(t.a,u);t.verticalAlign===`middle`&&(l=(d-u)/2),t.verticalAlign===`bottom`&&(l=d-u);let f=sx(t.text);return(0,N.jsx)(`textarea`,{className:`polotno-input`,ref:c,dir:kO(f),style:Object.assign(Object.assign(Object.assign({},vN),a),{paddingTop:l+`px`}),value:f,onChange:e=>{let n=dN({oldText:t.text,newText:e.target.value,element:t});t.set(Object.assign({text:e.target.value},YM(t,n)))},placeholder:hN(t.placeholder),onBlur:n})}),bN=e=>(0,N.jsx)(DM,{children:(0,N.jsx)(yN,Object.assign({},e))}),xN=(e,t,n,r,i)=>{let[a,o]=j.useReducer(e=>e+1,0),s=j.useRef(rS(t,n,r)),c=j.useRef(null);return j.useLayoutEffect(()=>{if(s.current=rS(t,n,r),s.current)return;let a=!0;return(async()=>{s.current=!1,o();let l=mb(`text ${t}`);await e.loadFont(t,n,r,i),a?(c.current=l,s.current=!0,o()):l()})(),()=>{c.current&&=(c.current(),null),a=!1}},[t,n,r]),j.useEffect(()=>{s.current&&setTimeout(()=>{c.current&&=(c.current(),null)})},[s.current]),[s.current]},SN=(e,t,n,r,i)=>{let[a,o]=j.useReducer(e=>e+1,0),s=t.join(`\0`),c=j.useRef(t.every(e=>rS(e,n,r))),l=j.useRef(null);return j.useLayoutEffect(()=>{if(c.current=t.every(e=>rS(e,n,r)),c.current)return;let a=!0;return(async()=>{c.current=!1,o();let u=mb(`text fonts ${s}`);await Promise.all(t.map(t=>e.loadFont(t,n,r,i))),a?(l.current=u,c.current=!0,o()):u()})(),()=>{l.current&&=(l.current(),null),a=!1}},[s,n,r]),j.useEffect(()=>{c.current&&setTimeout(()=>{l.current&&=(l.current(),null)})},[c.current]),[c.current]},CN=({fontLoaded:e,fontFamily:t,fontSize:n,lineHeight:r})=>j.useMemo(()=>ZO({fontFamily:t,fontSize:n,lineHeight:r}),[e,t,n,r]);function wN(e){let t=j.useRef(e),n=j.useRef(e);return j.useMemo(()=>{n.current=t.current,t.current=e},[e]),n.current}function TN(e,t,n=!1){let r=e.fontSize(),i=e.height(),a=sx(t.text),o=t.a.fontSize;e.height(void 0);let s=Math.round(2*t.a.fontSize)-1;for(let r=1;r<s;r++){let r=nx(t.a)&&e.height()>t.a.height+.02,i=a.split(`
385
+ `).join(` `).split(/[\s-]+/).reduce((e,t)=>(t=t.toLowerCase(),/[\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\uFF00-\uFFEF\u4E00-\u9FAF\uAC00-\uD7AF]/.test(t)?e.concat(t.split(``)):e.concat(t)),[]),s=e.textArr.map(e=>e.text.toLowerCase()).join(`;`),c=i.find(e=>!s.includes(e)||(s=s.replace(e,``),!1));if(!(r||c&&!n))break;o-=cA,e.fontSize(o)}return e.fontSize(r),e.height(i),o}var EN=Na(({element:e,store:t})=>{let{textOverflowIndicatorStyle:n}=xh(),r=j.useRef(null),i=j.useRef(null),a=j.useRef(null),o=j.useRef([]),s=j.useRef(!0),[,c]=j.useReducer(e=>e+1,0),{editorEnabled:l,selectAll:u}=(e=>{let[t,n]=j.useState(!1),r=j.useRef(!1);return j.useEffect(()=>{var t=!0;return setTimeout(()=>{t&&(e._editModeEnabled&&(r.current=!0),n(!0),setTimeout(()=>{r.current=!1},50))},50),()=>{t=!1}},[]),{editorEnabled:t&&e._editModeEnabled,selectAll:r.current}})(e),[d,f]=j.useState(!1),[p,m]=j.useState(!1),h=j.useRef(e.a.height),g=j.useRef(0),_=j.useRef(``),v=j.useRef(0),y=e.isSelected,b=wN(y),{textVerticalResizeEnabled:x}=Ay,S=Ay.autoDeleteEmptyText,C=wN(e.fontFamily),[w,T]=j.useState([]);j.useEffect(()=>{let e=r.current?.textArr??[];JSON.stringify(e)!==JSON.stringify(w)&&T(e)}),j.useEffect(()=>{if(e.a.width||e.type===`tablecell`)return;let t=r.current;t.width(600),e.set({width:1.4*t.getTextWidth()})},[]),j.useEffect(()=>{b&&!y&&S&&e.text===``&&e.removable&&!hN(e.placeholder)&&t.deleteElements([e.id])},[S,e.placeholder,e.removable,e.text,y,b]);let E=()=>{if(e.curveEnabled){let t=r.current;t?.clearCache(),t?.setAttrs({filters:[]});let n=i.current;n&&lN(n,e)}else{let t=r.current;t&&lN(t,e)}};j.useLayoutEffect(()=>{if(!p)return kM(e,()=>{E()})}),j.useEffect(()=>{let e=o.current;e.length>0&&(o.current=[],e.forEach(e=>e()))}),j.useEffect(()=>()=>{s.current=!1;let e=o.current;e.length>0&&(o.current=[],e.forEach(e=>e()))},[]);let D=sx(e.text);e.textTransform===`uppercase`&&(D=D.toUpperCase());let[O]=xN(t,e.fontFamily,e.fontStyle,e.fontWeight,e.text||e.placeholder),k=()=>{if(e.curveEnabled){let e=i.current;return e.getSelfRect().height||e.fontSize()}let t=r.current.clone({height:void 0}),n=Math.ceil(t.fontSize()*t.lineHeight()*t.textArr.length+1);return t.destroy(),n};j.useLayoutEffect(()=>{if(!O)return;if(e.type===`tablecell`){let{textOverflow:n}=Ay;if(n===`resize`){let t=k(),n=$h(e)?Wh(e,2):null;n!=null&&n.setCellContentHeight&&n.setCellContentHeight(e.id,t)}else if(n===`change-font-size`){let n=r.current;if(n){let r=TN(n,e,Ay.textSplitAllowed);r!==e.fontSize&&t.history.ignore(()=>{e.set({fontSize:r})})}}return}let{textOverflow:n,textSplitAllowed:i}=Ay,a=(n,r,i,a)=>{let l=mb(`text ${e.id}`),u=()=>{t.history.ignore(n,r,i).then(()=>{s.current?(o.current.push(l),c()):l()})};a?queueMicrotask(u):u()};if(!nx(e)){let t=k();a(()=>{nx(e)||e.set({height:t})},void 0,void 0,!0);return}if(!t.isPlaying){if(n!==`change-font-size`||d){if(n===`resize`){let t=k();x&&e.height<t&&!d&&a(()=>{var n;$h(e)&&e.set({height:t}),(n=r.current)==null||n.height(t)},!1,!0),x||e.height===t||d||a(()=>{var n;$h(e)&&e.set({height:t}),(n=r.current)==null||n.height(t)},!1,!0)}}else{let t=r.current,n=e.curveEnabled?e.fontSize:TN(t,e,i);if(n!==e.fontSize){a(()=>{e.set(YM(e,n))},!1,!0);return}let o=k();e.height===o||x||a(()=>{e.set({height:o})},!1,!0)}}}),j.useLayoutEffect(()=>{if(O&&e.curveEnabled){let t=i.current?.getSelfRect().width;if(t){let n=t-e.a.width,r=e.a.rotation*Math.PI/180,i=-n/2*Math.cos(r),a=-n/2*Math.sin(r);e.set({width:t,x:e.a.x+i,y:e.a.y+a})}}},[O,e.curveEnabled,e.curvePower,e.text,e.fontSize,e.fontFamily,e.fontWeight,e.fontStyle,e.letterSpacing]),j.useLayoutEffect(()=>{let e=r.current;e&&(e.width(e.width()+1e-8),e.width(e.width()-1e-8),e._setTextData(),E())},[O]);let A=j.useRef(null),ee=j.useRef(e.width),M=j.useRef(0),P=n=>{n.evt.preventDefault(),t.selectedShapes.find(t=>t===e)&&e.contentEditable&&(M.current=function(e){let t=e.target,n=function(e){var t=e.getAbsoluteTransform().copy();t.invert();var n=e.getStage().getPointerPosition();return t.point(n)}(t),r=t.textArr,i=Math.floor(n.y/(t.fontSize()*t.lineHeight())),a=r.slice(0,i).reduce((e,t)=>e+t.text.length,i),o=r[i]??r[0],s=0;return t.align()===`right`?s=t.width()-o.width:t.align()===`center`&&(s=t.width()/2-o.width/2),a+Math.round((n.x-s)/o.width*o.text.length)}(n),e.toggleEditMode())},F=hN(e.placeholder),I=!D&&F?.6:e.a.opacity;ob(r,I);let te=CN({fontLoaded:O,fontFamily:e.fontFamily,fontSize:e.a.fontSize,lineHeight:e.lineHeight}),ne=e.selectable||t.role===xM.ADMIN,L=jM(e),R=jM(e,e.stroke,`stroke`),re=j.useMemo(()=>e.backgroundEnabled?e.curveEnabled?function({width:e,height:t,padding:n=0,cornerRadius:r=0}){let i=-n,a=-n,o=e+n,s=t+n;return Jk(qk(`M ${i} ${a} L ${o} ${a} L ${o} ${s} L ${i} ${s} Z`),r).path}({width:e.a.width,height:e.a.height,cornerRadius:e.backgroundCornerRadius*(e.a.fontSize*te*.5),padding:e.backgroundPadding*(e.a.fontSize*te*.5)}):function({lines:e,lineHeight:t,width:n,align:r=`left`,padding:i=0,cornerRadius:a=0}){return Qk({rects:$k({lines:e,lineHeight:t,width:n,align:r}),padding:i,cornerRadius:a})}({lines:JSON.parse(JSON.stringify(w)),cornerRadius:e.backgroundCornerRadius*(e.a.fontSize*te*.5),lineHeight:te*e.a.fontSize,padding:e.backgroundPadding*(e.a.fontSize*te*.5),width:e.a.width,align:e.align}):``,[e.backgroundEnabled,e.curveEnabled,e.backgroundCornerRadius,e.a.fontSize,e.a.height,te,e.backgroundPadding,e.a.width,e.align,w]),ie=uN(),ae=0;if(!e.curveEnabled){let t=w.length*te*e.a.fontSize,n=ox(e.a,t);e.verticalAlign===`middle`?ae=(n-t)/2:e.verticalAlign===`bottom`&&(ae=n-t)}let oe=e.curveEnabled?MO(e.a.width,e.a.height,e.curvePower,e.a.fontSize):``,se=O?Tb(e.fontFamily):C===e.fontFamily?`Arial`:Tb(C),ce=kO(D);return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(Ym,{ref:a,x:e.a.x,y:e.a.y,rotation:e.a.rotation,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled,opacity:e.backgroundOpacity*I,data:re,fill:e.backgroundColor,offsetY:-ae}),(0,N.jsx)(Ym,{data:oe,stroke:n.stroke,strokeWidth:1,x:e.a.x,y:e.a.y,rotation:e.a.rotation,visible:!1}),(0,N.jsx)(Jm,Object.assign({ref:i,visible:e.curveEnabled,data:oe,text:D||F,listening:!1,align:`center`,textBaseline:`middle`,direction:ce},L,R,{strokeWidth:e.strokeWidth,lineJoin:jO(e.strokeLineJoin),fillAfterStrokeEnabled:!0,fontSize:e.a.fontSize,fontFamily:`${Tb(e.fontFamily)}, ${Tb(C)}`,fontStyle:e.fontStyle+` `+e.fontWeight,textDecoration:e.textDecoration.trim(),letterSpacing:e.letterSpacing*e.a.fontSize,x:e.a.x,y:e.a.y,rotation:e.a.rotation,opacity:e._editModeEnabled?.3:I,hideInExport:!e.showInExport,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity})),(0,N.jsx)(qm,Object.assign({ref:r,id:e.selectable?e.id:void 0,name:e.selectable?`element`:``,hideInExport:!e.showInExport,editModeEnabled:e._editModeEnabled,x:e.a.x,y:e.a.y,rotation:e.a.rotation,width:e.a.width,height:nx(e.a)?e.a.height:void 0,text:D||F,direction:ce},L,R,{lineJoin:jO(e.strokeLineJoin),strokeWidth:e.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:e.a.fontSize,fontFamily:se,fontStyle:e.fontStyle+` `+e.fontWeight,textDecoration:e.textDecoration,align:e.align,verticalAlign:e.verticalAlign,draggable:ie?e.draggable&&y:e.draggable,preventDefault:!ie||y,opacity:e.curveEnabled?0:I,visible:!e._editModeEnabled,ellipsis:Ay.textOverflow===`ellipsis`,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,lineHeight:te,letterSpacing:e.letterSpacing*e.a.fontSize,listening:!!e.selectable&&ne,onDragStart:()=>{m(!0)},onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{m(!1),e.set(QM(t.target))},onClick:P,onTap:P,onTransformStart:()=>{f(!0);let t=r.current;h.current=t.height(),ee.current=e.a.width,A.current=t.position(),g.current=t.rotation(),v.current=t.height(),_.current=UM(t)},onTransform:t=>{var n,r;let i=t.target;(n=a.current)==null||n.setAttrs({x:i.x(),y:i.y(),rotation:i.rotation(),scale:i.scale()});let o=_.current;if(o===`middle-left`||o===`middle-right`){let t=i.scaleX(),n=i.width()*t,r=GM(ee.current,e.a.fontSize),a=n;n<r&&(a=r,A.current&&i.position(A.current)),i.width(a),i.scaleX(1),i.scaleY(1);let o=k();if(Ay.textOverflow===`ellipsis`)o=h.current;else{let t=Math.max(o,h.current);i.height(t),e.set({height:i.height()})}let s=Ay.textVerticalResizeEnabled?Math.max(o,h.current):k();e.set({x:i.x(),width:i.width(),rotation:i.rotation(),height:s}),i.skewX(0),i.skewY(0),E()}if(o===`top-center`||o===`bottom-center`){let n=Ay.textOverflow===`resize`?k():te*e.a.fontSize,r=t.target.height()*t.target.scaleY();if(r<n){if(t.target.height(n),A.current){if(_.current===`top-center`){let e=g.current*Math.PI/180,r=v.current-n;t.target.x(A.current.x-r*Math.sin(e)),t.target.y(A.current.y+r*Math.cos(e))}else t.target.position(A.current)}}else t.target.height(r);t.target.scaleY(1),t.target.scaleX(1),t.target.rotation(g.current),t.target.skewX(0),t.target.skewY(0),v.current=Math.max(n,r)}A.current=t.target.position();let s=t.target.scaleX();(r=a.current)==null||r.setAttrs({scaleX:1,scaleY:1}),t.target.scaleX(1),t.target.scaleY(1),e.set({fontSize:e.a.fontSize*s,width:t.target.width()*s,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),height:t.target.height()*s,shadowBlur:e.shadowBlur*s,shadowOffsetX:e.shadowOffsetX*s,shadowOffsetY:e.shadowOffsetY*s,strokeWidth:e.strokeWidth*s})},onTransformEnd:t=>{var n;let r=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set(Object.assign(Object.assign({},eN(e,e.fontSize*r)),{width:Math.ceil(t.target.width()*r),x:XM(t.target.x()),y:XM(t.target.y()),rotation:XM(t.target.rotation()),height:XM(t.target.height()*r)})),(n=a.current)==null||n.setAttrs({scaleX:1,scaleY:1}),f(!1)}})),l&&e.contentEditable&&(0,N.jsx)(`Group`,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,children:(0,N.jsx)(bN,{textNodeRef:r,element:e,selectAll:u,cursorPosition:M.current,onBlur:()=>{e.set(tN(e)),e.toggleEditMode(!1)}})})]})}),DN=(e,t)=>{let n=cN(e),r=$h(e)&&oN(e),i=n=>{if(!t||!$h(e))return;let r=t instanceof HTMLVideoElement?t.videoWidth:t.width,i=t instanceof HTMLVideoElement?t.videoHeight:t.height;if(!r||!i)return;a(n,r,i);let o=n.getContext(`2d`);o&&(o.drawImage(t,0,0),sN(n,e))},o=j.useMemo(()=>{if(!r||!t)return;let e=document.createElement(`canvas`);return i(e),e},[t,r,n]);return j.useEffect(()=>()=>{o&&d.Util.releaseCanvas(o)},[o]),[o||t||void 0,()=>{o&&i(o)}]},ON=(e,t=100,n=!1,r)=>{let i=j.useRef(r??e),[,a]=j.useReducer(e=>e+1,0),o=j.useCallback(e=>{i.current!==e&&(i.current=e,a())},[i]),s=j.useRef(null);return e===n&&(s.current&&=(clearTimeout(s.current),null),i.current=n),j.useEffect(()=>(s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{o(e),s.current=null},t),()=>{s.current&&clearTimeout(s.current)}),[e,t,n]),[i.current,o]};function kN(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:{width:e.width,height:e.height}}function AN(e){let t=Math.abs(e);if(t<=.5)return .75-t*t;if(t<=1.5){let e=1.5-t;return .5*e*e}return 0}function jN(e,t,n,r,i,a){let o=a/n,s=Math.max(1,1/o),c=1.5*s,l=[];for(let a=0;a<r;a++){let r=t+(a+.5-i)/o-.5,u=Math.max(0,Math.floor(t)),d=Math.min(e-1,Math.ceil(t+n)-1),f=Math.max(u,Math.floor(r-c)),p=Math.min(d,Math.ceil(r+c));if(p<f){l.push({start:u,weights:new Float32Array});continue}let m=new Float32Array(p-f+1),h=0;for(let e=f;e<=p;e++){let t=AN((e-r)/s);m[e-f]=t,h+=t}if(h>0)for(let e=0;e<m.length;e++)m[e]/=h;l.push({start:f,weights:m})}return l}function MN(e,t,n,r,i){let a=new Float32Array(r*n*4);for(let o=0;o<n;o++){let s=o*t*4;for(let t=0;t<r;t++){let{start:r,weights:c}=i[t],l=0,u=0,d=0,f=0;for(let t=0;t<c.length;t++){let n=s+4*(r+t),i=c[t];l+=e[n]*i,u+=e[n+1]*i,d+=e[n+2]*i,f+=e[n+3]*i}let p=4*(t*n+o);a[p]=l,a[p+1]=u,a[p+2]=d,a[p+3]=f}}return a}var NN=-.25;function PN(e,t,n,r,i={x:0,y:0,width:n,height:r}){let a=kN(e),o=function(e,t,n){let{width:r,height:i}=kN(e),a=e;for(;r>2*t||i>2*n;){r=Math.max(2*t,Math.round(r/2)),i=Math.max(2*n,Math.round(i/2));let o=document.createElement(`canvas`);o.width=r,o.height=i;let s=o.getContext(`2d`);s.imageSmoothingQuality=`high`,s.drawImage(a,0,0,r,i),a!==e&&d.Util.releaseCanvas(a),a=o}return a}(e,a.width*n/t.width,a.height*r/t.height),s;if(o instanceof HTMLCanvasElement)s=o;else{let e=kN(o);s=document.createElement(`canvas`),s.width=e.width,s.height=e.height,s.getContext(`2d`).drawImage(o,0,0)}let c=s.getContext(`2d`).getImageData(0,0,s.width,s.height),l=s.width/a.width,u=s.height/a.height,f={x:t.x*l,y:t.y*u,width:t.width*l,height:t.height*u};s!==e&&d.Util.releaseCanvas(s);let p=function(e,t,n,r,i){let a=function(e,t,n){let r=new ImageData(t,n),i=r.data;for(let t=0;t<i.length;t+=4){let n=e[t+3];if(n>.001){let r=1/n;i[t]=e[t]*r,i[t+1]=e[t+1]*r,i[t+2]=e[t+2]*r}i[t+3]=n}return r}(MN(MN(function(e){let t=new Uint16Array(e.length);for(let n=0;n<e.length;n+=4){let r=e[n+3];t[n]=e[n]*r,t[n+1]=e[n+1]*r,t[n+2]=e[n+2]*r,t[n+3]=r}return t}(e.data),e.width,e.height,n,jN(e.width,t.x,t.width,n,i.x,i.width)),e.height,n,r,jN(e.height,t.y,t.height,r,i.y,i.height)),n,r);return function(e){let{width:t,height:n,data:r}=e,i=new Float32Array(t*n*3);for(let e=0;e<n;e++)for(let n=0;n<t;n++){let a=4*(e*t+n),o=4*(e*t+Math.max(0,n-1)),s=4*(e*t+Math.min(t-1,n+1)),c=r[o+3]>0?NN:0,l=r[s+3]>0?NN:0,u=NN-c+1.5+(NN-l),d=3*(e*t+n);for(let e=0;e<3;e++)i[d+e]=u*r[a+e]+c*r[o+e]+l*r[s+e]}for(let e=0;e<n;e++)for(let a=0;a<t;a++){let o=4*(e*t+a);if(r[o+3]===0)continue;let s=Math.max(0,e-1)*t+a,c=Math.min(n-1,e+1)*t+a,l=r[4*s+3]>0?NN:0,u=r[4*c+3]>0?NN:0,d=NN-l+1.5+(NN-u),f=3*(e*t+a);for(let e=0;e<3;e++)r[o+e]=d*i[f+e]+l*i[3*s+e]+u*i[3*c+e]}}(a),a}(c,f,n,r,i),m=document.createElement(`canvas`);return m.width=n,m.height=r,m.getContext(`2d`).putImageData(p,0,0),m}var FN=1e4;function IN(){return document.createElement(`canvas`)}var LN=e=>e.type===`svg`||sw(e.src||``),RN=e=>{let[t,n]=j.useState(e);return j.useEffect(()=>{(async()=>{let r=sw(e)?xw(await rw(e)):e;r!==t&&n(r)})()},[e]),t};function zN(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var BN=(e,t)=>t.width<5||t.height<5?e:t,VN={keepRatio:!1,rotateEnabled:!1,boundBoxFunc:BN},HN={enabledAnchors:[`top-left`,`top-right`,`bottom-left`,`bottom-right`],rotateEnabled:!1,borderEnabled:!1,boundBoxFunc:BN};function UN(e,t){let n=Ow({stretchEnabled:t.stretchEnabled,cropX:0,cropY:0,cropWidth:1,cropHeight:1,width:Math.max(t.width,1),height:Math.max(t.height,1)},e);return{width:Math.max(Math.round(n.width),1),height:Math.max(Math.round(n.height),1)}}var WN=(e,t,n)=>Math.max(t,Math.min(n,e)),GN=(e,t,n)=>Math.max(e.a.width/t.width,e.a.height/t.height)*n,KN=(e,t,n,r,i=0,o=!1,s=!0,c=0,l)=>{let u=FN,f=FN,p=l.aligned?WN(l.deviceWidth,1,u):Math.floor(WN(e.a.width*r,1,u)),m=l.aligned?WN(l.deviceHeight,1,f):Math.floor(WN(e.a.height*r,1,f)),h=Math.min(i*r,p/2,m/2),g=Math.min(c*r,p/2,m/2),_=GN(e,n,r),v=!!e.page?._exporting&&!e.page?._rendering&&Ay.imageDownScalingEnabled&&!o&&(_<.95||l.aligned),y=n.x===0&&n.y===0&&n.width===t?.width&&n.height===t?.height,b=j.useMemo(()=>{if(t&&t.width&&t.height)return!y||h!==0||v||g?IN():void 0},[t,h,v,y,g]);return j.useLayoutEffect(()=>{var r;if(!b||!t)return;a(b,p,m);let i=b.getContext(`2d`);if(i){if((r=e.page)!=null&&r._exportingOrRendering&&(i.imageSmoothingQuality=`high`),(h||g)&&(i.beginPath(),i.roundRect(g,g,p-2*g,m-2*g,Math.max(0,h-g)),i.clip()),v){let e=b.width===p&&b.height===m&&l.aligned,r=PN(t,n,b.width,b.height,{x:e?l.phaseX:0,y:e?l.phaseY:0,width:e?l.spanX:b.width,height:e?l.spanY:b.height});i.drawImage(r,0,0),d.Util.releaseCanvas(r);return}i.drawImage(t,n.x,n.y,n.width,n.height,0,0,b.width,b.height)}},[b,e.a.width,e.a.height,n.x,n.y,n.width,n.height,i,r,o,e.page?._exportingOrRendering,v,l.phaseX,l.phaseY,g]),j.useEffect(()=>()=>{b&&b.nodeName===`CANVAS`&&d.Util.releaseCanvas(b)},[b]),b||t},qN=IN(),JN=Na(({element:e})=>{let t=Math.min(30,e.a.width/4,e.a.height/4),n=j.useRef(null);j.useEffect(()=>{let e=n.current;if(!e)return;let t=new d.Animation(t=>{e.rotate((t?.timeDiff||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}});let{mediaLoadingStyle:r}=xh();return(0,N.jsxs)(Vm,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,N.jsx)(Um,{width:e.a.width,height:e.a.height,fill:r.fill}),(0,N.jsx)(`Arc`,{ref:n,x:e.a.width/2,y:e.a.height/2,fill:r.textFill,outerRadius:Math.abs(t),innerRadius:Math.max(1,t-5),angle:270})]})}),YN=Na(({element:e})=>{let{mediaErrorStyle:t}=xh(),n=Math.max(10,Math.min(30,e.a.width/25));return(0,N.jsxs)(Vm,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,N.jsx)(Um,{width:e.a.width,height:e.a.height,fill:t.fill}),(0,N.jsx)(qm,{text:`Can not load the image...`,fontSize:n,width:e.a.width,height:e.a.height,align:`center`,fill:t.textFill,verticalAlign:`middle`,padding:5})]})}),XN=eh.default,ZN=(e,t=``,n=``)=>{let r=j.useRef(void 0),i=()=>{var e;(e=r.current)==null||e.call(r),r.current=void 0};j.useEffect(()=>i,[]),j.useLayoutEffect(()=>{let a=t.slice(0,200),o=`image with id ${n} url: ${a}`;e!==`loading`||r.current||(r.current=mb(o)),e!==`loading`&&i(),e===`failed`&&yb(s(`IMAGE_FAILED`,o,{src:a,elementId:n,reason:`load`}))},[e])},QN=Na(({element:e,store:t})=>{let n=xh(),[r,i]=j.useState(!1),o=j.useRef(null),s=j.useRef(null),c=e.isSelected,[l,u]=(e=>{let[t,n]=j.useReducer(e=>e+1,0),r=LN(e),i=r?e.src+`
386
+ `+JSON.stringify(e.colorsReplace??null):``,a=j.useRef(`loading`),o=j.useRef(``),s=j.useRef(i);return s.current!==i&&(s.current=i,a.current=`loading`),j.useEffect(()=>{if(!r||!e.src)return;let t=!1;return(async()=>{let r=xw(await rw(e.src),e.colorsReplace);t||(o.current=r,a.current=`loaded`,n())})().catch(()=>{t||(a.current=`failed`,n())}),()=>{t=!0}},[i]),r?[o.current,a.current]:[e.src,`loaded`]})(e),[f,p]=XN(l,`anonymous`),m=u===`loaded`?p:u;ZN(m,e.src,e.id);let h=e.page?._exportingOrRendering?1:Math.max(1,t.scale),g=t._elementsPixelRatio*h,_=(({image:e,status:t})=>{let n=j.useRef(void 0);return j.useEffect(()=>{n.current=e||n.current},[e]),t===`failed`?void 0:n.current})({image:f,status:m}),[v=qN]=DN(e,((e,t)=>{let n=RN(e.maskSrc||``),[r,i]=XN(n,`anonymous`);return ZN(n?i:`loaded`,n||``,e.id),j.useMemo(()=>{if(!r||!t||!t.width||!t.height)return t;let{width:n,height:i}=UN(t,{width:e.a.width,height:e.a.height,stretchEnabled:e.stretchEnabled}),a=IN();a.width=n,a.height=i;let o=a.getContext(`2d`);if(!o)return t;o.drawImage(t,0,0,n,i,0,0,n,i),o.globalCompositeOperation=`source-in`;let s=function(e,t){let n=t.width/t.height,r,i;return n>=e.width/e.height?(r=e.width,i=e.width/n):(r=e.height*n,i=e.height),{x:(e.width-r)/2,y:(e.height-i)/2,width:r,height:i}}(r,e);return o.drawImage(r,s.x,s.y,s.width,s.height,0,0,n,i),a},[t,r,e.a.width,e.a.height,e.stretchEnabled])})(e,((e,t,n)=>{let r=j.useMemo(()=>{var r,i;let{flipX:o,flipY:s}=e,c=LN(e),l=navigator.userAgent.toLowerCase().indexOf(`firefox`)>-1,u=(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||l)&&c||e.maskSrc;if(!o&&!s&&!u)return t;if(!t||!t.width||!t.height)return null;let d=IN(),f=1;e.type===`svg`&&(f=Math.max(e.a.width/t.width*n,e.a.height/t.height*n)),a(d,Math.max(t.width*f,1),Math.max(t.height*f,1));let p=o?-d.width:0,m=s?-d.height:0;return(r=d.getContext(`2d`))==null||r.scale(o?-1:1,s?-1:1),(i=d.getContext(`2d`))==null||i.drawImage(t,p,m,d.width,d.height),d},[e.maskSrc,e.flipX,e.flipY,t,e.a.width,e.a.height,n]);return j.useEffect(()=>()=>{r&&r.nodeName===`CANVAS`&&d.Util.releaseCanvas(r)},[r]),r})(e,f||_,g))||qN),{cropX:y,cropY:b,cropWidth:x,cropHeight:S}=e.a;p!==`loaded`&&(y=b=0,x=S=1);let C=Ow({stretchEnabled:e.stretchEnabled,cropX:y,cropY:b,cropWidth:x,cropHeight:S,width:e.a.width,height:e.a.height},v),w=C.width,T=C.height,E=e.stretchEnabled,D=e.cornerRadius??0,O=e.page?._exportingOrRendering?1:Math.min(2,t.scale),k=t._elementsPixelRatio*O,A=r||e._cropModeEnabled||e.type===`svg`,ee=function(e,t,n,r){let{x:i,y:a,width:o,height:s}=e.a,c={x:i,y:a,width:o,height:s,deviceWidth:0,deviceHeight:0,phaseX:0,phaseY:0,spanX:0,spanY:0,aligned:!1};if(!r)return c;let l=i*t,u=a*t,d=Math.round(l),f=Math.round(u),p=Math.max(1,Math.round(l+o*t)-d),m=Math.max(1,Math.round(u+s*t)-f),h=e=>Math.abs(e-Math.round(e))>.001;return h(l)||h(u)||h(o*t)||h(s*t)?p>FN||m>FN?c:n<.95||n<=1&&p*m<=4e6?{x:d/t,y:f/t,width:p/t,height:m/t,deviceWidth:p,deviceHeight:m,phaseX:l-d,phaseY:u-f,spanX:o*t,spanY:s*t,aligned:!0}:c:c}(e,k,GN(e,C,k),!!e.page?._exporting&&!e.page?._rendering&&Ay.imageDownScalingEnabled&&e.a.rotation===0&&e.parent?.type!==`group`&&!A),M=ee.aligned?ee:{x:e.x,y:e.y,width:e.a.width,height:e.a.height},P=((e,t,n,r)=>{let[i,a]=XN(RN(e.clipSrc||``),`anonymous`);ZN(e.clipSrc?a:`loaded`,e.clipSrc,e.id);let o=j.useMemo(()=>{if(t&&i)return IN()},[t,i]);return j.useLayoutEffect(()=>{var r;if(!i||!t||!t.width||!t.height||!i||!i.width||!i.height||!o)return;let a=IN(),s=Math.max(e.a.width/i.width*n,e.a.height/i.height*n);a.width=Math.max(i.width*s,1),a.height=Math.max(i.height*s,1),(r=a.getContext(`2d`))==null||r.drawImage(i,0,0,a.width,a.height),o.width=Math.max(t.width,1),o.height=Math.max(t.height,1);let c=o.getContext(`2d`);c&&(c.save(),c.drawImage(a,0,0,t.width,t.height),d.Util.releaseCanvas(a),c.globalCompositeOperation=`source-in`,c.drawImage(t,0,0,o.width,o.height),c.restore())},[o,t,i,e.a.width,e.a.height,n,...r]),e.clipSrc&&i?o:t})(e,KN(e,v,C,k,D,A,!0,Dw({borderSize:e.borderSize,borderColor:e.borderColor,width:e.a.width,height:e.a.height}),ee),k,[C,D,k]),F=Math.max(e.a.width/w,e.a.height/T);j.useEffect(()=>{if(!e._cropModeEnabled)return;let t=o.current?.getStage();function n(t){e._cropModeEnabled&&t.target!==s.current&&e.toggleCropMode(!1)}function r(n){e._cropModeEnabled&&n.target.parentNode!==t?.content&&e.toggleCropMode(!1)}return document.body.addEventListener(`click`,r),t?.on(`click`,n),t?.on(`tap`,n),()=>{document.body.removeEventListener(`click`,r),document.body.removeEventListener(`touchstart`,r),t?.off(`click`,n),t?.off(`click`,n)}},[e._cropModeEnabled]);let I=j.useRef(null),te=j.useRef(null),ne=j.useRef(null);j.useLayoutEffect(()=>{e._cropModeEnabled&&(te.current.nodes([I.current]),ne.current.nodes([s.current]))},[e._cropModeEnabled]);var L=j.useRef(null),R=j.useRef(0),re=j.useRef(!1);let ie=t=>{t.evt.touches?.length>2&&t.target.stopDrag(),Math.round(t.target.x())>0&&(t.target.x(0),t.target.scaleX(1)),Math.round(t.target.y())>0&&(t.target.y(0),t.target.scaleY(1));let n=t.target.width()*t.target.scaleX(),r=t.target.height()*t.target.scaleY(),i=Math.min(1,w/n),a=Math.min(1,T/r),o=1-i,s=Math.min(o,Math.max(0,Math.round(-t.target.x())/n)),c=1-a,l=Math.min(c,Math.max(0,Math.round(-t.target.y())/r));t.target.setAttrs({x:-s*v.width,y:-l*v.height,scaleX:1,scaleY:1}),e.set({cropX:s,cropY:l,cropWidth:i,cropHeight:a})},ae=()=>{e.type!==`svg`&&e.contentEditable&&(e.stretchEnabled||setTimeout(()=>{$h(e)&&e.toggleCropMode(!0)}))},oe=LN(e)&&_,[se]=ON(m===`loading`&&!oe,100,!1,!1),ce=m===`failed`,le=!se&&!ce,ue=j.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),de=j.useRef(!1),fe=le?e.a.opacity:0;ob(o,fe);let pe=e.selectable||t.role===xM.ADMIN,me=uN(),he=jM(e,e.borderColor,`stroke`);return(0,N.jsxs)(N.Fragment,{children:[se&&(0,N.jsx)(JN,{element:e}),ce&&(0,N.jsx)(YN,{element:e}),(0,N.jsx)(Km,{ref:o,name:`element`,id:e.id,image:P,x:ee.x,y:ee.y,width:ee.width||1,height:ee.height||1,rotation:e.a.rotation,opacity:fe,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:C,listening:pe,draggable:me?e.draggable&&c:e.draggable,preventDefault:!me||c,hideInExport:!e.showInExport,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set(QM(t.target))},onDblClick:ae,onDblTap:ae,onTransformStart:t=>{i(!0),de.current=WM(UM(t.target)),ue.current={cropX:e.cropX,cropY:e.cropY,cropWidth:e.cropWidth,cropHeight:e.cropHeight}},onTransform:t=>{let n=t.currentTarget,r=Math.abs(n.scaleX()-1)<1e-7?1:n.scaleX(),i=Math.abs(n.scaleY()-1)<1e-7?1:n.scaleY();n.scaleX(1),n.scaleY(1);let a=1-w/v.width,o=Math.min(a,Math.max(0,e.cropX)),s=1-T/v.height,c=Math.min(s,Math.max(0,e.cropY)),l=de.current,u=!l&&r<1&&ue.current.cropHeight>T/v.height,d=l?e.cropWidth:e.cropWidth*r;u&&(d=e.cropWidth);let f=!l&&i<1&&ue.current.cropWidth>w/v.width,p=l?e.cropHeight:e.cropHeight*i;f&&(p=e.cropHeight),E&&(d=e.cropWidth,p=e.cropHeight);let m=l?Math.min(r,i):1;e.set(Object.assign({cropX:o,cropY:c,x:n.x(),y:n.y(),width:n.width()*r,height:n.height()*i,rotation:t.target.rotation(),cropWidth:Math.min(d,1-o),cropHeight:Math.min(p,1-c)},m!==1&&Object.assign(Object.assign({},qM(e,m)),{borderSize:e.borderSize*m})))},onTransformEnd:t=>{let n=t.currentTarget;e.set(Object.assign(Object.assign({width:XM(n.width()),height:XM(n.height()),x:XM(n.x()),y:XM(n.y()),rotation:XM(t.target.rotation()),cropX:ZM(e.cropX),cropY:ZM(e.cropY),cropWidth:ZM(w/v.width),cropHeight:ZM(T/v.height)},JM(e)),{borderSize:HM(e.borderSize)})),i(!1)}}),(0,N.jsx)(Um,Object.assign({x:M.x,y:M.y,width:Math.max(M.width-e.borderSize,0),height:Math.max(M.height-e.borderSize,0),opacity:fe,offsetX:-e.borderSize/2,offsetY:-e.borderSize/2},he,{strokeWidth:e.borderSize,listening:!1,visible:!!e.borderSize,rotation:e.rotation,cornerRadius:Math.max(0,D-e.borderSize),hideInExport:!e.showInExport})),e._cropModeEnabled&&(0,N.jsxs)(OM,{selector:`.page-abs-container`,enabled:!0,children:[(0,N.jsx)(`Rect`,{x:-window.innerWidth/t.scale,y:-window.innerWidth/t.scale,width:window.innerWidth/t.scale*3,height:window.innerWidth/t.scale*3,fill:n.cropOverlayFill}),(0,N.jsx)(`Image`,{listening:!1,image:P,x:e.x,y:e.y,width:e.a.width,height:e.a.height,rotation:e.rotation,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur}),(0,N.jsxs)(`Group`,{x:e.x,y:e.y,rotation:e.rotation,scaleX:F,scaleY:F,children:[(0,N.jsx)(`Image`,{image:v,ref:s,opacity:.4,draggable:!0,x:-e.cropX*v.width,y:-e.cropY*v.height,onDragMove:ie,onTransform:ie,onTouchMove:e=>{e.evt.preventDefault();let t=e.target.getStage().getPointersPositions();var n=t[0],r=t[1];let i=e.target;if(n&&!r&&!i.isDragging()&&re.current&&(i.startDrag(),re.current=!1),n&&r){d.hitOnDragEnabled=!0,i.isDragging()&&(re.current=!0,i.stopDrag());let t=e.target.getAbsoluteTransform().copy();t.invert();var a={x:n.x,y:n.y},o={x:r.x,y:r.y};if(!L.current){L.current=zN(a,o);return}var s=zN(a,o),c=function(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}(a,o);R.current||=c;let h=i.position();var l={x:s.x-h.x,y:s.y-h.y},u=c/R.current;i.scaleX(u),i.scaleY(u);let g=t.point(s),_=t.point(L.current);var f=g.x-_.x,p=g.y-_.y,m={x:Math.min(0,s.x-l.x*u+f),y:Math.min(0,s.y-l.y*u+p)};i.position(m),R.current=c,L.current=s,ie(e)}},onTouchEnd:e=>{R.current=0,L.current=null,d.hitOnDragEnabled=!1}}),(0,N.jsx)(`Transformer`,Object.assign({ref:ne},HN,n.outerImageCropTransformerStyle)),(0,N.jsx)(`Rect`,{width:w,height:T,ref:I,listening:!1,onTransform:t=>{if(e.cropX<Math.abs(t.target.x()/v.width)&&t.target.x()<0&&e.cropX>0){let n=(e.cropWidth+e.cropX)*v.width;t.target.scaleX(1),t.target.width(n)}if(e.cropY<Math.abs(t.target.y()/v.height)&&t.target.y()<0&&e.cropY>0){let n=(e.cropHeight+e.cropY)*v.height;t.target.scaleY(1),t.target.height(n)}t.target.x()<-e.cropX*v.width-1e-9&&(t.target.x(-e.cropX*v.width),t.target.scaleX(1)),t.target.y()<-e.cropY*v.height-1e-9&&(t.target.y(-e.cropY*v.height),t.target.scaleY(1));let n=Math.min(1,Math.max(0,e.cropX+t.target.x()/v.width)),r=Math.min(1,Math.max(0,t.target.y()/v.height+e.cropY)),i=t.target.width()*t.target.scaleX(),a=t.target.height()*t.target.scaleY(),o=Math.min(1-n,i/v.width),s=Math.min(1-r,a/v.height),c=t.target.getAbsolutePosition(t.target.getParent().getParent());t.target.scale({x:1,y:1}),t.target.position({x:0,y:0}),e.set({x:c.x,y:c.y,cropX:n,cropY:r,cropWidth:o,cropHeight:s,width:Math.min(i*F,v.width*(1-n)*F),height:Math.min(a*F,v.height*(1-r)*F)})}}),(0,N.jsx)(`Transformer`,Object.assign({ref:te},VN,n.innerImageCropTransformerStyle,{visible:e.resizable}))]})]})]})});function $N(e,t){if(!e.includes(`@font-face`))return``;let n=new Set,r=new Set;t&&((t.match(/font-weight:\s*(\d+|bold|normal)/gi)||[]).forEach(e=>{let t=e.split(`:`)[1].trim();t===`bold`?n.add(`700`):t===`normal`?n.add(`400`):/^\d+$/.test(t)&&n.add(t)}),(t.match(/font-style:\s*(italic|normal)/gi)||[]).forEach(e=>{e.split(`:`)[1].trim().toLowerCase()===`italic`&&r.add(`italic`)}),/<(b|strong)\b/i.test(t)&&n.add(`700`),/<(i|em)\b/i.test(t)&&r.add(`italic`));let i=sx(t);i&&i.trim()&&n.add(`400`),n.size===0&&n.add(`400`);let a=n,o=r.has(`italic`),s=Array.from(new Set(i)).map(e=>e.codePointAt(0)).filter(e=>e!==void 0),c=e.split(/}\s*/).map(e=>e&&e+`}`).filter(e=>/@font-face/.test(e)&&(e=>{let t=(e.match(/font-weight:\s*(\d+)/)||[])[1];if(t&&!a.has(t)||/font-style:\s*italic/.test(e)&&!o)return!1;let n=e.match(/unicode-range:\s*([^;]+);/);if(!n)return!0;let r=n[1].split(`,`).map(e=>{let[t,n=t]=e.replace(`U+`,``).split(`-`).map(e=>parseInt(e,16));return[t,n]});return s.some(e=>r.some(([t,n])=>e>=t&&e<=n))})(e)).join(`
387
+ `);return c?`<style>${c}</style>`:``}var eP=new Map,tP=new Map,nP=/@font-face\s*\{[^}]*\}/g,rP=/url\(\s*(['"]?)(.*?)\1\s*\)/g,iP=/unicode-range:\s*([^;}]+)/i;function aP(e,t){if(!t)return!0;let n=e.match(iP);if(!n)return!0;let r=Mx(n[1]);return r.length===0||Px(r,t)}function oP(e,t){let n=new Set;for(let r of e.matchAll(nP))if(aP(r[0],t))for(let e of r[0].matchAll(rP)){let t=e[2];t&&!t.startsWith(`data:`)&&n.add(t)}return Array.from(n)}function sP(e){let t=eP.get(e);return t||(t=async function(e){try{let t=await jx(e,{validate:Ex});return`data:${Tx(t)};base64,${hC(t)}`}catch{return e}}(e),eP.set(e,t)),t}function cP(e,t){let n=function(e,t){let n=e.length,r=`${n}|${e.slice(0,500)}|${n>200?e.slice((n>>1)-50,50+(n>>1)):``}|${n>100?e.slice(-100):``}`;if(t&&t.size>0){let e=5381,n=[...t].sort((e,t)=>e-t);for(let t=0;t<n.length;t++)e=(e<<5)+e+n[t]|0;r+=`\0`+(e>>>0)}return r}(e,t),r=tP.get(n);if(r)return r;let i=async function(e,t){let n=oP(e,t);if(n.length===0&&!t)return e;let r=await Promise.all(n.map(async e=>[e,await sP(e)])),i=new Map(r);return e.replace(nP,e=>aP(e,t)?e.replace(rP,(e,t,n)=>{if(!n||n.startsWith(`data:`))return e;let r=i.get(n);return r?`url("${r}")`:e}):``)}(e,t);return tP.set(n,i),i}var lP=/<style[^>]*>([\s\S]*?)<\/style>/gi;function uP(e){let t=[],n=e.replace(lP,(e,n)=>(t.push(n),``));return{css:t.join(`
388
+ `),html:n}}var dP;function fP(e,t){`close`in t.image&&typeof t.image.close==`function`&&t.image.close()}async function pP(e){let t=`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(e),n=Sb.createElement(`img`);return n.src=t,await new Promise((e,t)=>{n.onload=()=>e(),n.onerror=()=>t(Error(`Failed to load SVG as image`))}),{image:n}}async function mP(e){var t;let n=!!e.cache,r=typeof e.cache==`object`&&(t=e.cache.maxEntries)!=null?t:50;if(n){let t=function(e){return dP?dP.maxEntries!==e&&dP.resize(e):dP=new MM(e),dP}(r),n=function(e){return`${e.html}\0${e.css??``}\0${e.width}\0${e.height}\0${e.pixelRatio??1}`}(e),i=t.get(n);if(i)return i.image;let a=await pP(await bP(e));return t.setWithEviction(n,a,fP),a.image}return(await pP(await bP(e))).image}var hP=RegExp(`[\0-\b\v\f-￾￿]`,`g`);function gP(e){let t=Cb(e),n=Sb.createXMLSerializer(),r=``;for(let e of Array.from(t.body.childNodes))r+=n.serializeToString(e);return r.replace(hP,``)}function _P({xhtml:e,css:t,width:n,height:r,pixelRatio:i=1}){let a=n*i,o=r*i,s=i===1?`margin: 0;`:`margin: 0; width: ${n}px; height: ${r}px; transform: scale(${i}); transform-origin: 0 0;`;return`<svg xmlns="http://www.w3.org/2000/svg" width="${a}" height="${o}"><foreignObject width="${a}" height="${o}" style="float: left;"><html xmlns="http://www.w3.org/1999/xhtml"><head><style>${function(e){return`<![CDATA[\n${e}\n]]>`}(t)}</style></head><body style="${s}">${e}</body></html></foreignObject></svg>`}var vP;async function yP({html:e,css:t=``,width:n,height:r,pixelRatio:i=1}){let a=uP(e),o=await cP([t,a.css].filter(Boolean).join(`
389
+ `),function(e){let t=Cb(e).body.textContent||``,n=new Set;for(let e=0;e<t.length;e++){let r=t.codePointAt(e);n.add(r),r>65535&&e++}return n}(a.html));return _P({xhtml:gP(a.html),css:o,width:n,height:r,pixelRatio:i})}async function bP(e){var t,n;if(e.cache){let r=(n=typeof e.cache==`object`&&(t=e.cache.maxEntries)!=null?t:50,vP?vP.maxEntries!==n&&vP.resize(n):vP=new MM(n),vP),i=`${e.html}\0${e.css??``}\0${e.width}\0${e.height}\0${e.pixelRatio??1}`,a=r.get(i);if(a)return a;let o=await yP(e);return r.set(i,o),o}return yP(e)}var xP={},SP=e=>{if(xP[e])return xP[e];let t=function(e){let t=[];for(let n=0;n<document.styleSheets.length;n++){let r=document.styleSheets[n];try{let n=r.cssRules;if(n)for(let r=0;r<n.length;r++){let i=n[r];i instanceof CSSFontFaceRule&&Fb(i.style.fontFamily)===e&&t.push(i)}}catch(e){console.warn(`Could not access stylesheet: ${r.href}`,e)}}return t}(e).map(e=>({src:e.style.getPropertyValue(`src`),fontStyle:e.style.getPropertyValue(`font-style`)||`normal`,fontWeight:e.style.getPropertyValue(`font-weight`)||`normal`}));return xP[e]=t,t},CP=new Map;async function wP(e,t){let n=`${e}|${t}`;if(CP.has(n))return CP.get(n);let r=`https://fonts.googleapis.com/css?family=${encodeURIComponent(e)}:${t}&display=swap`;try{let e=await fetch(r);if(!e.ok)return CP.set(n,``),``;let t=await e.text();return CP.set(n,t),t}catch{return CP.set(n,``),``}}async function TP({html:e,width:t,height:n,fontFamily:r,fontFamilies:i,padding:a,font:o,resolveFont:s,pixelRatio:c}){e=IM(e);let l=await async function(e,t,n,r){let i=[...new Set(e.filter(Boolean))],a=``;for(let e of i){if(e===`Arial`)continue;let i=e===t&&n||r?.(e);if(i)(i.styles||i.url?Kx(i):SP(e)).forEach(t=>{a+=`\n @font-face {\n font-family: ${Tb(e)};\n src: ${t.src};\n font-style: ${t.fontStyle||`normal`};\n font-weight: ${t.fontWeight||`normal`};\n }\n `});else{let t=yx();a+=await wP(e,t)}}return a}(i?.length?[...new Set([r,...i])]:[r],r,o,s),u=``;return l&&(u=$N(l,e)),mP({html:`<div style="padding: ${a}px;" dir="auto">${e+=u+SO}</div>`,width:t+2*a,height:n+2*a,cache:{maxEntries:100},pixelRatio:c})}function EP(e,t,n){return pA(e.toJSON(),{getHtmlOptions:Object.assign({textOverflow:Ay.textOverflow},t),measureHeight:n,textSplitAllowed:Ay.textSplitAllowed})}var DP=typeof global==`object`&&global&&global.Object===Object&&global,OP=typeof self==`object`&&self&&self.Object===Object&&self,kP=DP||OP||Function(`return this`)(),AP=kP.Symbol,jP=Object.prototype,MP=jP.hasOwnProperty,NP=jP.toString,PP=AP?AP.toStringTag:void 0;function FP(e){var t=MP.call(e,PP),n=e[PP];try{e[PP]=void 0;var r=!0}catch{}var i=NP.call(e);return r&&(t?e[PP]=n:delete e[PP]),i}var IP=Object.prototype.toString;function LP(e){return IP.call(e)}var RP=`[object Null]`,zP=`[object Undefined]`,BP=AP?AP.toStringTag:void 0;function VP(e){return e==null?e===void 0?zP:RP:BP&&BP in Object(e)?FP(e):LP(e)}function HP(e){return typeof e==`object`&&!!e}var UP=Array.isArray;function WP(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}function GP(e){return e}var KP=`[object AsyncFunction]`,qP=`[object Function]`,JP=`[object GeneratorFunction]`,YP=`[object Proxy]`;function XP(e){if(!WP(e))return!1;var t=VP(e);return t==qP||t==JP||t==KP||t==YP}var ZP=kP[`__core-js_shared__`],QP=function(){var e=/[^.]+$/.exec(ZP&&ZP.keys&&ZP.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function $P(e){return!!QP&&QP in e}var eF=Function.prototype.toString;function tF(e){if(e!=null){try{return eF.call(e)}catch{}try{return e+``}catch{}}return``}var nF=/[\\^$.*+?()[\]{}|]/g,rF=/^\[object .+?Constructor\]$/,iF=Function.prototype,aF=Object.prototype,oF=iF.toString,sF=aF.hasOwnProperty,cF=RegExp(`^`+oF.call(sF).replace(nF,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function lF(e){return!WP(e)||$P(e)?!1:(XP(e)?cF:rF).test(tF(e))}function uF(e,t){return e?.[t]}function dF(e,t){var n=uF(e,t);return lF(n)?n:void 0}var fF=dF(kP,`WeakMap`),pF=Object.create,mF=function(){function e(){}return function(t){if(!WP(t))return{};if(pF)return pF(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function hF(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function gF(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}var _F=800,vF=16,yF=Date.now;function bF(e){var t=0,n=0;return function(){var r=yF(),i=vF-(r-n);if(n=r,i>0){if(++t>=_F)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function xF(e){return function(){return e}}var SF=function(){try{var e=dF(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),CF=bF(SF?function(e,t){return SF(e,`toString`,{configurable:!0,enumerable:!1,value:xF(t),writable:!0})}:GP);function wF(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var TF=9007199254740991,EF=/^(?:0|[1-9]\d*)$/;function DF(e,t){var n=typeof e;return t??=TF,!!t&&(n==`number`||n!=`symbol`&&EF.test(e))&&e>-1&&e%1==0&&e<t}function OF(e,t,n){t==`__proto__`&&SF?SF(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function kF(e,t){return e===t||e!==e&&t!==t}var AF=Object.prototype.hasOwnProperty;function jF(e,t,n){var r=e[t];(!(AF.call(e,t)&&kF(r,n))||n===void 0&&!(t in e))&&OF(e,t,n)}function MF(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?OF(n,s,c):jF(n,s,c)}return n}var NF=Math.max;function PF(e,t,n){return t=NF(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=NF(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),hF(e,this,s)}}function FF(e,t){return CF(PF(e,t,GP),e+``)}var IF=9007199254740991;function LF(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=IF}function RF(e){return e!=null&&LF(e.length)&&!XP(e)}function zF(e,t,n){if(!WP(n))return!1;var r=typeof t;return(r==`number`?RF(n)&&DF(t,n.length):r==`string`&&t in n)?kF(n[t],e):!1}function BF(e){return FF(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&zF(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var VF=Object.prototype;function HF(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||VF)}function UF(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var WF=`[object Arguments]`;function GF(e){return HP(e)&&VP(e)==WF}var KF=Object.prototype,qF=KF.hasOwnProperty,JF=KF.propertyIsEnumerable,YF=GF(function(){return arguments}())?GF:function(e){return HP(e)&&qF.call(e,`callee`)&&!JF.call(e,`callee`)};function XF(){return!1}var ZF=typeof exports==`object`&&exports&&!exports.nodeType&&exports,QF=ZF&&typeof module==`object`&&module&&!module.nodeType&&module,$F=QF&&QF.exports===ZF?kP.Buffer:void 0,eI=($F?$F.isBuffer:void 0)||XF,tI=`[object Arguments]`,nI=`[object Array]`,rI=`[object Boolean]`,iI=`[object Date]`,aI=`[object Error]`,oI=`[object Function]`,sI=`[object Map]`,cI=`[object Number]`,lI=`[object Object]`,uI=`[object RegExp]`,dI=`[object Set]`,fI=`[object String]`,pI=`[object WeakMap]`,mI=`[object ArrayBuffer]`,hI=`[object DataView]`,gI=`[object Float32Array]`,_I=`[object Float64Array]`,vI=`[object Int8Array]`,yI=`[object Int16Array]`,bI=`[object Int32Array]`,xI=`[object Uint8Array]`,SI=`[object Uint8ClampedArray]`,CI=`[object Uint16Array]`,wI=`[object Uint32Array]`,TI={};TI[gI]=TI[_I]=TI[vI]=TI[yI]=TI[bI]=TI[xI]=TI[SI]=TI[CI]=TI[wI]=!0,TI[tI]=TI[nI]=TI[mI]=TI[rI]=TI[hI]=TI[iI]=TI[aI]=TI[oI]=TI[sI]=TI[cI]=TI[lI]=TI[uI]=TI[dI]=TI[fI]=TI[pI]=!1;function EI(e){return HP(e)&&LF(e.length)&&!!TI[VP(e)]}function DI(e){return function(t){return e(t)}}var OI=typeof exports==`object`&&exports&&!exports.nodeType&&exports,kI=OI&&typeof module==`object`&&module&&!module.nodeType&&module,AI=kI&&kI.exports===OI&&DP.process,jI=function(){try{return kI&&kI.require&&kI.require(`util`).types||AI&&AI.binding&&AI.binding(`util`)}catch{}}(),MI=jI&&jI.isTypedArray,NI=MI?DI(MI):EI,PI=Object.prototype.hasOwnProperty;function FI(e,t){var n=UP(e),r=!n&&YF(e),i=!n&&!r&&eI(e),a=!n&&!r&&!i&&NI(e),o=n||r||i||a,s=o?UF(e.length,String):[],c=s.length;for(var l in e)(t||PI.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||DF(l,c)))&&s.push(l);return s}function II(e,t){return function(n){return e(t(n))}}var LI=II(Object.keys,Object),RI=Object.prototype.hasOwnProperty;function zI(e){if(!HF(e))return LI(e);var t=[];for(var n in Object(e))RI.call(e,n)&&n!=`constructor`&&t.push(n);return t}function BI(e){return RF(e)?FI(e):zI(e)}function VI(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var HI=Object.prototype.hasOwnProperty;function UI(e){if(!WP(e))return VI(e);var t=HF(e),n=[];for(var r in e)r==`constructor`&&(t||!HI.call(e,r))||n.push(r);return n}function WI(e){return RF(e)?FI(e,!0):UI(e)}var GI=dF(Object,`create`);function KI(){this.__data__=GI?GI(null):{},this.size=0}function qI(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var JI=`__lodash_hash_undefined__`,YI=Object.prototype.hasOwnProperty;function XI(e){var t=this.__data__;if(GI){var n=t[e];return n===JI?void 0:n}return YI.call(t,e)?t[e]:void 0}var ZI=Object.prototype.hasOwnProperty;function QI(e){var t=this.__data__;return GI?t[e]!==void 0:ZI.call(t,e)}var $I=`__lodash_hash_undefined__`;function eL(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=GI&&t===void 0?$I:t,this}function tL(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}tL.prototype.clear=KI,tL.prototype.delete=qI,tL.prototype.get=XI,tL.prototype.has=QI,tL.prototype.set=eL;function nL(){this.__data__=[],this.size=0}function rL(e,t){for(var n=e.length;n--;)if(kF(e[n][0],t))return n;return-1}var iL=Array.prototype.splice;function aL(e){var t=this.__data__,n=rL(t,e);return n<0?!1:(n==t.length-1?t.pop():iL.call(t,n,1),--this.size,!0)}function oL(e){var t=this.__data__,n=rL(t,e);return n<0?void 0:t[n][1]}function sL(e){return rL(this.__data__,e)>-1}function cL(e,t){var n=this.__data__,r=rL(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function lL(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}lL.prototype.clear=nL,lL.prototype.delete=aL,lL.prototype.get=oL,lL.prototype.has=sL,lL.prototype.set=cL;var uL=dF(kP,`Map`);function dL(){this.size=0,this.__data__={hash:new tL,map:new(uL||lL),string:new tL}}function fL(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function pL(e,t){var n=e.__data__;return fL(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function mL(e){var t=pL(this,e).delete(e);return this.size-=+!!t,t}function hL(e){return pL(this,e).get(e)}function gL(e){return pL(this,e).has(e)}function _L(e,t){var n=pL(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function vL(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}vL.prototype.clear=dL,vL.prototype.delete=mL,vL.prototype.get=hL,vL.prototype.has=gL,vL.prototype.set=_L;function yL(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var bL=II(Object.getPrototypeOf,Object),xL=`[object Object]`,SL=Function.prototype,CL=Object.prototype,wL=SL.toString,TL=CL.hasOwnProperty,EL=wL.call(Object);function DL(e){if(!HP(e)||VP(e)!=xL)return!1;var t=bL(e);if(t===null)return!0;var n=TL.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&wL.call(n)==EL}function OL(){this.__data__=new lL,this.size=0}function kL(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function AL(e){return this.__data__.get(e)}function jL(e){return this.__data__.has(e)}var ML=200;function NL(e,t){var n=this.__data__;if(n instanceof lL){var r=n.__data__;if(!uL||r.length<ML-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new vL(r)}return n.set(e,t),this.size=n.size,this}function PL(e){var t=this.__data__=new lL(e);this.size=t.size}PL.prototype.clear=OL,PL.prototype.delete=kL,PL.prototype.get=AL,PL.prototype.has=jL,PL.prototype.set=NL;function FL(e,t){return e&&MF(t,BI(t),e)}function IL(e,t){return e&&MF(t,WI(t),e)}var LL=typeof exports==`object`&&exports&&!exports.nodeType&&exports,RL=LL&&typeof module==`object`&&module&&!module.nodeType&&module,zL=RL&&RL.exports===LL?kP.Buffer:void 0,BL=zL?zL.allocUnsafe:void 0;function VL(e,t){if(t)return e.slice();var n=e.length,r=BL?BL(n):new e.constructor(n);return e.copy(r),r}function HL(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function UL(){return[]}var WL=Object.prototype.propertyIsEnumerable,GL=Object.getOwnPropertySymbols,KL=GL?function(e){return e==null?[]:(e=Object(e),HL(GL(e),function(t){return WL.call(e,t)}))}:UL;function qL(e,t){return MF(e,KL(e),t)}var JL=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)yL(t,KL(e)),e=bL(e);return t}:UL;function YL(e,t){return MF(e,JL(e),t)}function XL(e,t,n){var r=t(e);return UP(e)?r:yL(r,n(e))}function ZL(e){return XL(e,BI,KL)}function QL(e){return XL(e,WI,JL)}var $L=dF(kP,`DataView`),eR=dF(kP,`Promise`),tR=dF(kP,`Set`),nR=`[object Map]`,rR=`[object Object]`,iR=`[object Promise]`,aR=`[object Set]`,oR=`[object WeakMap]`,sR=`[object DataView]`,cR=tF($L),lR=tF(uL),uR=tF(eR),dR=tF(tR),fR=tF(fF),pR=VP;($L&&pR(new $L(new ArrayBuffer(1)))!=sR||uL&&pR(new uL)!=nR||eR&&pR(eR.resolve())!=iR||tR&&pR(new tR)!=aR||fF&&pR(new fF)!=oR)&&(pR=function(e){var t=VP(e),n=t==rR?e.constructor:void 0,r=n?tF(n):``;if(r)switch(r){case cR:return sR;case lR:return nR;case uR:return iR;case dR:return aR;case fR:return oR}return t});var mR=pR,hR=Object.prototype.hasOwnProperty;function gR(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&hR.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}var _R=kP.Uint8Array;function vR(e){var t=new e.constructor(e.byteLength);return new _R(t).set(new _R(e)),t}function yR(e,t){var n=t?vR(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var bR=/\w*$/;function xR(e){var t=new e.constructor(e.source,bR.exec(e));return t.lastIndex=e.lastIndex,t}var SR=AP?AP.prototype:void 0,CR=SR?SR.valueOf:void 0;function wR(e){return CR?Object(CR.call(e)):{}}function TR(e,t){var n=t?vR(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var ER=`[object Boolean]`,DR=`[object Date]`,OR=`[object Map]`,kR=`[object Number]`,AR=`[object RegExp]`,jR=`[object Set]`,MR=`[object String]`,NR=`[object Symbol]`,PR=`[object ArrayBuffer]`,FR=`[object DataView]`,IR=`[object Float32Array]`,LR=`[object Float64Array]`,RR=`[object Int8Array]`,zR=`[object Int16Array]`,BR=`[object Int32Array]`,VR=`[object Uint8Array]`,HR=`[object Uint8ClampedArray]`,UR=`[object Uint16Array]`,WR=`[object Uint32Array]`;function GR(e,t,n){var r=e.constructor;switch(t){case PR:return vR(e);case ER:case DR:return new r(+e);case FR:return yR(e,n);case IR:case LR:case RR:case zR:case BR:case VR:case HR:case UR:case WR:return TR(e,n);case OR:return new r;case kR:case MR:return new r(e);case AR:return xR(e);case jR:return new r;case NR:return wR(e)}}function KR(e){return typeof e.constructor==`function`&&!HF(e)?mF(bL(e)):{}}var qR=`[object Map]`;function JR(e){return HP(e)&&mR(e)==qR}var YR=jI&&jI.isMap,XR=YR?DI(YR):JR,ZR=`[object Set]`;function QR(e){return HP(e)&&mR(e)==ZR}var $R=jI&&jI.isSet,ez=$R?DI($R):QR,tz=1,nz=2,rz=4,iz=`[object Arguments]`,az=`[object Array]`,oz=`[object Boolean]`,sz=`[object Date]`,cz=`[object Error]`,lz=`[object Function]`,uz=`[object GeneratorFunction]`,dz=`[object Map]`,fz=`[object Number]`,pz=`[object Object]`,mz=`[object RegExp]`,hz=`[object Set]`,gz=`[object String]`,_z=`[object Symbol]`,vz=`[object WeakMap]`,yz=`[object ArrayBuffer]`,bz=`[object DataView]`,xz=`[object Float32Array]`,Sz=`[object Float64Array]`,Cz=`[object Int8Array]`,wz=`[object Int16Array]`,Tz=`[object Int32Array]`,Ez=`[object Uint8Array]`,Dz=`[object Uint8ClampedArray]`,Oz=`[object Uint16Array]`,kz=`[object Uint32Array]`,Az={};Az[iz]=Az[az]=Az[yz]=Az[bz]=Az[oz]=Az[sz]=Az[xz]=Az[Sz]=Az[Cz]=Az[wz]=Az[Tz]=Az[dz]=Az[fz]=Az[pz]=Az[mz]=Az[hz]=Az[gz]=Az[_z]=Az[Ez]=Az[Dz]=Az[Oz]=Az[kz]=!0,Az[cz]=Az[lz]=Az[vz]=!1;function jz(e,t,n,r,i,a){var o,s=t&tz,c=t&nz,l=t&rz;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!WP(e))return e;var u=UP(e);if(u){if(o=gR(e),!s)return gF(e,o)}else{var d=mR(e),f=d==lz||d==uz;if(eI(e))return VL(e,s);if(d==pz||d==iz||f&&!i){if(o=c||f?{}:KR(e),!s)return c?YL(e,IL(o,e)):qL(e,FL(o,e))}else{if(!Az[d])return i?e:{};o=GR(e,d,s)}}a||=new PL;var p=a.get(e);if(p)return p;a.set(e,o),ez(e)?e.forEach(function(r){o.add(jz(r,t,n,r,e,a))}):XR(e)&&e.forEach(function(r,i){o.set(i,jz(r,t,n,i,e,a))});var m=u?void 0:(l?c?QL:ZL:c?WI:BI)(e);return wF(m||e,function(r,i){m&&(i=r,r=e[i]),jF(o,i,jz(r,t,n,i,e,a))}),o}var Mz=1,Nz=4;function Pz(e){return jz(e,Mz|Nz)}var Fz=`__lodash_hash_undefined__`;function Iz(e){return this.__data__.set(e,Fz),this}function Lz(e){return this.__data__.has(e)}function Rz(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new vL;++t<n;)this.add(e[t])}Rz.prototype.add=Rz.prototype.push=Iz,Rz.prototype.has=Lz;function zz(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function Bz(e,t){return e.has(t)}var Vz=1,Hz=2;function Uz(e,t,n,r,i,a){var o=n&Vz,s=e.length,c=t.length;if(s!=c&&!(o&&c>s))return!1;var l=a.get(e),u=a.get(t);if(l&&u)return l==t&&u==e;var d=-1,f=!0,p=n&Hz?new Rz:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var m=e[d],h=t[d];if(r)var g=o?r(h,m,d,t,e,a):r(m,h,d,e,t,a);if(g!==void 0){if(g)continue;f=!1;break}if(p){if(!zz(t,function(e,t){if(!Bz(p,t)&&(m===e||i(m,e,n,r,a)))return p.push(t)})){f=!1;break}}else if(!(m===h||i(m,h,n,r,a))){f=!1;break}}return a.delete(e),a.delete(t),f}function Wz(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function Gz(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var Kz=1,qz=2,Jz=`[object Boolean]`,Yz=`[object Date]`,Xz=`[object Error]`,Zz=`[object Map]`,Qz=`[object Number]`,$z=`[object RegExp]`,eB=`[object Set]`,tB=`[object String]`,nB=`[object Symbol]`,rB=`[object ArrayBuffer]`,iB=`[object DataView]`,aB=AP?AP.prototype:void 0,oB=aB?aB.valueOf:void 0;function sB(e,t,n,r,i,a,o){switch(n){case iB:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case rB:return!(e.byteLength!=t.byteLength||!a(new _R(e),new _R(t)));case Jz:case Yz:case Qz:return kF(+e,+t);case Xz:return e.name==t.name&&e.message==t.message;case $z:case tB:return e==t+``;case Zz:var s=Wz;case eB:var c=r&Kz;if(s||=Gz,e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=qz,o.set(e,t);var u=Uz(s(e),s(t),r,i,a,o);return o.delete(e),u;case nB:if(oB)return oB.call(e)==oB.call(t)}return!1}var cB=1,lB=Object.prototype.hasOwnProperty;function uB(e,t,n,r,i,a){var o=n&cB,s=ZL(e),c=s.length;if(c!=ZL(t).length&&!o)return!1;for(var l=c;l--;){var u=s[l];if(!(o?u in t:lB.call(t,u)))return!1}var d=a.get(e),f=a.get(t);if(d&&f)return d==t&&f==e;var p=!0;a.set(e,t),a.set(t,e);for(var m=o;++l<c;){u=s[l];var h=e[u],g=t[u];if(r)var _=o?r(g,h,u,t,e,a):r(h,g,u,e,t,a);if(!(_===void 0?h===g||i(h,g,n,r,a):_)){p=!1;break}m||=u==`constructor`}if(p&&!m){var v=e.constructor,y=t.constructor;v!=y&&`constructor`in e&&`constructor`in t&&!(typeof v==`function`&&v instanceof v&&typeof y==`function`&&y instanceof y)&&(p=!1)}return a.delete(e),a.delete(t),p}var dB=1,fB=`[object Arguments]`,pB=`[object Array]`,mB=`[object Object]`,hB=Object.prototype.hasOwnProperty;function gB(e,t,n,r,i,a){var o=UP(e),s=UP(t),c=o?pB:mR(e),l=s?pB:mR(t);c=c==fB?mB:c,l=l==fB?mB:l;var u=c==mB,d=l==mB,f=c==l;if(f&&eI(e)){if(!eI(t))return!1;o=!0,u=!1}if(f&&!u)return a||=new PL,o||NI(e)?Uz(e,t,n,r,i,a):sB(e,t,c,n,r,i,a);if(!(n&dB)){var p=u&&hB.call(e,`__wrapped__`),m=d&&hB.call(t,`__wrapped__`);if(p||m){var h=p?e.value():e,g=m?t.value():t;return a||=new PL,i(h,g,n,r,a)}}return f?(a||=new PL,uB(e,t,n,r,i,a)):!1}function _B(e,t,n,r,i){return e===t?!0:e==null||t==null||!HP(e)&&!HP(t)?e!==e&&t!==t:gB(e,t,n,r,_B,i)}function vB(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var yB=vB();function bB(e,t,n){(n!==void 0&&!kF(e[t],n)||n===void 0&&!(t in e))&&OF(e,t,n)}function xB(e){return HP(e)&&RF(e)}function SB(e,t){if((t!==`constructor`||typeof e[t]!=`function`)&&t!=`__proto__`)return e[t]}function CB(e){return MF(e,WI(e))}function wB(e,t,n,r,i,a,o){var s=SB(e,n),c=SB(t,n),l=o.get(c);if(l){bB(e,n,l);return}var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=UP(c),p=!f&&eI(c),m=!f&&!p&&NI(c);u=c,f||p||m?UP(s)?u=s:xB(s)?u=gF(s):p?(d=!1,u=VL(c,!0)):m?(d=!1,u=TR(c,!0)):u=[]:DL(c)||YF(c)?(u=s,YF(s)?u=CB(s):(!WP(s)||XP(s))&&(u=KR(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),bB(e,n,u)}function TB(e,t,n,r,i){e!==t&&yB(t,function(a,o){if(i||=new PL,WP(a))wB(e,t,o,n,TB,r,i);else{var s=r?r(SB(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),bB(e,o,s)}},WI)}function EB(e,t){return _B(e,t)}var DB=BF(function(e,t,n){TB(e,t,n)}),OB=e({Attributor:()=>kB,AttributorStore:()=>LB,BlockBlot:()=>XB,ClassAttributor:()=>PB,ContainerBlot:()=>QB,EmbedBlot:()=>$B,InlineBlot:()=>JB,LeafBlot:()=>VB,ParentBlot:()=>GB,Registry:()=>MB,Scope:()=>X,ScrollBlot:()=>rV,StyleAttributor:()=>IB,TextBlot:()=>aV}),X=(e=>(e[e.TYPE=3]=`TYPE`,e[e.LEVEL=12]=`LEVEL`,e[e.ATTRIBUTE=13]=`ATTRIBUTE`,e[e.BLOT=14]=`BLOT`,e[e.INLINE=7]=`INLINE`,e[e.BLOCK=11]=`BLOCK`,e[e.BLOCK_BLOT=10]=`BLOCK_BLOT`,e[e.INLINE_BLOT=6]=`INLINE_BLOT`,e[e.BLOCK_ATTRIBUTE=9]=`BLOCK_ATTRIBUTE`,e[e.INLINE_ATTRIBUTE=5]=`INLINE_ATTRIBUTE`,e[e.ANY=15]=`ANY`,e))(X||{}),kB=class{constructor(e,t,n={}){this.attrName=e,this.keyName=t;let r=X.TYPE&X.ATTRIBUTE;this.scope=n.scope==null?X.ATTRIBUTE:n.scope&X.LEVEL|r,n.whitelist!=null&&(this.whitelist=n.whitelist)}static keys(e){return Array.from(e.attributes).map(e=>e.name)}add(e,t){return this.canAdd(e,t)?(e.setAttribute(this.keyName,t),!0):!1}canAdd(e,t){return this.whitelist==null?!0:typeof t==`string`?this.whitelist.indexOf(t.replace(/["']/g,``))>-1:this.whitelist.indexOf(t)>-1}remove(e){e.removeAttribute(this.keyName)}value(e){let t=e.getAttribute(this.keyName);return this.canAdd(e,t)&&t?t:``}},AB=class extends Error{constructor(e){e=`[Parchment] `+e,super(e),this.message=e,this.name=this.constructor.name}},jB=class e{constructor(){this.attributes={},this.classes={},this.tags={},this.types={}}static find(e,t=!1){if(e==null)return null;if(this.blots.has(e))return this.blots.get(e)||null;if(t){let n=null;try{n=e.parentNode}catch{return null}return this.find(n,t)}return null}create(t,n,r){let i=this.query(n);if(i==null)throw new AB(`Unable to create ${n} blot`);let a=i,o=new a(t,n instanceof Node||n.nodeType===Node.TEXT_NODE?n:a.create(r),r);return e.blots.set(o.domNode,o),o}find(t,n=!1){return e.find(t,n)}query(e,t=X.ANY){let n;return typeof e==`string`?n=this.types[e]||this.attributes[e]:e instanceof Text||e.nodeType===Node.TEXT_NODE?n=this.types.text:typeof e==`number`?e&X.LEVEL&X.BLOCK?n=this.types.block:e&X.LEVEL&X.INLINE&&(n=this.types.inline):e instanceof Element&&((e.getAttribute(`class`)||``).split(/\s+/).some(e=>(n=this.classes[e],!!n)),n||=this.tags[e.tagName]),n==null?null:`scope`in n&&t&X.LEVEL&n.scope&&t&X.TYPE&n.scope?n:null}register(...e){return e.map(e=>{let t=`blotName`in e,n=`attrName`in e;if(!t&&!n)throw new AB(`Invalid definition`);if(t&&e.blotName===`abstract`)throw new AB(`Cannot register abstract class`);let r=t?e.blotName:n?e.attrName:void 0;return this.types[r]=e,n?typeof e.keyName==`string`&&(this.attributes[e.keyName]=e):t&&(e.className&&(this.classes[e.className]=e),e.tagName&&(e.tagName=Array.isArray(e.tagName)?e.tagName.map(e=>e.toUpperCase()):e.tagName.toUpperCase(),(Array.isArray(e.tagName)?e.tagName:[e.tagName]).forEach(t=>{(this.tags[t]==null||e.className==null)&&(this.tags[t]=e)}))),e})}};jB.blots=new WeakMap;var MB=jB;function NB(e,t){return(e.getAttribute(`class`)||``).split(/\s+/).filter(e=>e.indexOf(`${t}-`)===0)}var PB=class extends kB{static keys(e){return(e.getAttribute(`class`)||``).split(/\s+/).map(e=>e.split(`-`).slice(0,-1).join(`-`))}add(e,t){return this.canAdd(e,t)?(this.remove(e),e.classList.add(`${this.keyName}-${t}`),!0):!1}remove(e){NB(e,this.keyName).forEach(t=>{e.classList.remove(t)}),e.classList.length===0&&e.removeAttribute(`class`)}value(e){let t=(NB(e,this.keyName)[0]||``).slice(this.keyName.length+1);return this.canAdd(e,t)?t:``}};function FB(e){let t=e.split(`-`),n=t.slice(1).map(e=>e[0].toUpperCase()+e.slice(1)).join(``);return t[0]+n}var IB=class extends kB{static keys(e){return(e.getAttribute(`style`)||``).split(`;`).map(e=>e.split(`:`)[0].trim())}add(e,t){return this.canAdd(e,t)?(e.style[FB(this.keyName)]=t,!0):!1}remove(e){e.style[FB(this.keyName)]=``,e.getAttribute(`style`)||e.removeAttribute(`style`)}value(e){let t=e.style[FB(this.keyName)];return this.canAdd(e,t)?t:``}},LB=class{constructor(e){this.attributes={},this.domNode=e,this.build()}attribute(e,t){t?e.add(this.domNode,t)&&(e.value(this.domNode)==null?delete this.attributes[e.attrName]:this.attributes[e.attrName]=e):(e.remove(this.domNode),delete this.attributes[e.attrName])}build(){this.attributes={};let e=MB.find(this.domNode);if(e==null)return;let t=kB.keys(this.domNode),n=PB.keys(this.domNode),r=IB.keys(this.domNode);t.concat(n).concat(r).forEach(t=>{let n=e.scroll.query(t,X.ATTRIBUTE);n instanceof kB&&(this.attributes[n.attrName]=n)})}copy(e){Object.keys(this.attributes).forEach(t=>{let n=this.attributes[t].value(this.domNode);e.format(t,n)})}move(e){this.copy(e),Object.keys(this.attributes).forEach(e=>{this.attributes[e].remove(this.domNode)}),this.attributes={}}values(){return Object.keys(this.attributes).reduce((e,t)=>(e[t]=this.attributes[t].value(this.domNode),e),{})}},RB=class{constructor(e,t){this.scroll=e,this.domNode=t,MB.blots.set(t,this),this.prev=null,this.next=null}static create(e){if(this.tagName==null)throw new AB(`Blot definition missing tagName`);let t,n;return Array.isArray(this.tagName)?(typeof e==`string`?(n=e.toUpperCase(),parseInt(n,10).toString()===n&&(n=parseInt(n,10))):typeof e==`number`&&(n=e),t=typeof n==`number`?document.createElement(this.tagName[n-1]):n&&this.tagName.indexOf(n)>-1?document.createElement(n):document.createElement(this.tagName[0])):t=document.createElement(this.tagName),this.className&&t.classList.add(this.className),t}get statics(){return this.constructor}attach(){}clone(){let e=this.domNode.cloneNode(!1);return this.scroll.create(e)}detach(){this.parent!=null&&this.parent.removeChild(this),MB.blots.delete(this.domNode)}deleteAt(e,t){this.isolate(e,t).remove()}formatAt(e,t,n,r){let i=this.isolate(e,t);if(this.scroll.query(n,X.BLOT)!=null&&r)i.wrap(n,r);else if(this.scroll.query(n,X.ATTRIBUTE)!=null){let e=this.scroll.create(this.statics.scope);i.wrap(e),e.format(n,r)}}insertAt(e,t,n){let r=n==null?this.scroll.create(`text`,t):this.scroll.create(t,n),i=this.split(e);this.parent.insertBefore(r,i||void 0)}isolate(e,t){let n=this.split(e);if(n==null)throw Error(`Attempt to isolate at end`);return n.split(t),n}length(){return 1}offset(e=this.parent){return this.parent==null||this===e?0:this.parent.children.offset(this)+this.parent.offset(e)}optimize(e){this.statics.requiredContainer&&!(this.parent instanceof this.statics.requiredContainer)&&this.wrap(this.statics.requiredContainer.blotName)}remove(){this.domNode.parentNode!=null&&this.domNode.parentNode.removeChild(this.domNode),this.detach()}replaceWith(e,t){let n=typeof e==`string`?this.scroll.create(e,t):e;return this.parent!=null&&(this.parent.insertBefore(n,this.next||void 0),this.remove()),n}split(e,t){return e===0?this:this.next}update(e,t){}wrap(e,t){let n=typeof e==`string`?this.scroll.create(e,t):e;if(this.parent!=null&&this.parent.insertBefore(n,this.next||void 0),typeof n.appendChild!=`function`)throw new AB(`Cannot wrap ${e}`);return n.appendChild(this),n}};RB.blotName=`abstract`;var zB=RB,BB=class extends zB{static value(e){return!0}index(e,t){return this.domNode===e||this.domNode.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(t,1):-1}position(e,t){let n=Array.from(this.parent.domNode.childNodes).indexOf(this.domNode);return e>0&&(n+=1),[this.parent.domNode,n]}value(){return{[this.statics.blotName]:this.statics.value(this.domNode)||!0}}};BB.scope=X.INLINE_BLOT;var VB=BB,HB=class{constructor(){this.head=null,this.tail=null,this.length=0}append(...e){if(this.insertBefore(e[0],null),e.length>1){let t=e.slice(1);this.append(...t)}}at(e){let t=this.iterator(),n=t();for(;n&&e>0;)--e,n=t();return n}contains(e){let t=this.iterator(),n=t();for(;n;){if(n===e)return!0;n=t()}return!1}indexOf(e){let t=this.iterator(),n=t(),r=0;for(;n;){if(n===e)return r;r+=1,n=t()}return-1}insertBefore(e,t){e!=null&&(this.remove(e),e.next=t,t==null?this.tail==null?(e.prev=null,this.head=this.tail=e):(this.tail.next=e,e.prev=this.tail,this.tail=e):(e.prev=t.prev,t.prev!=null&&(t.prev.next=e),t.prev=e,t===this.head&&(this.head=e)),this.length+=1)}offset(e){let t=0,n=this.head;for(;n!=null;){if(n===e)return t;t+=n.length(),n=n.next}return-1}remove(e){this.contains(e)&&(e.prev!=null&&(e.prev.next=e.next),e.next!=null&&(e.next.prev=e.prev),e===this.head&&(this.head=e.next),e===this.tail&&(this.tail=e.prev),--this.length)}iterator(e=this.head){return()=>{let t=e;return e!=null&&(e=e.next),t}}find(e,t=!1){let n=this.iterator(),r=n();for(;r;){let i=r.length();if(e<i||t&&e===i&&(r.next==null||r.next.length()!==0))return[r,e];e-=i,r=n()}return[null,0]}forEach(e){let t=this.iterator(),n=t();for(;n;)e(n),n=t()}forEachAt(e,t,n){if(t<=0)return;let[r,i]=this.find(e),a=e-i,o=this.iterator(r),s=o();for(;s&&a<e+t;){let r=s.length();e>a?n(s,e-a,Math.min(t,a+r-e)):n(s,0,Math.min(r,e+t-a)),a+=r,s=o()}}map(e){return this.reduce((t,n)=>(t.push(e(n)),t),[])}reduce(e,t){let n=this.iterator(),r=n();for(;r;)t=e(t,r),r=n();return t}};function UB(e,t){let n=t.find(e);if(n)return n;try{return t.create(e)}catch{let n=t.create(X.INLINE);return Array.from(e.childNodes).forEach(e=>{n.domNode.appendChild(e)}),e.parentNode&&e.parentNode.replaceChild(n.domNode,e),n.attach(),n}}var WB=class e extends zB{constructor(e,t){super(e,t),this.uiNode=null,this.build()}appendChild(e){this.insertBefore(e)}attach(){super.attach(),this.children.forEach(e=>{e.attach()})}attachUI(t){this.uiNode!=null&&this.uiNode.remove(),this.uiNode=t,e.uiClass&&this.uiNode.classList.add(e.uiClass),this.uiNode.setAttribute(`contenteditable`,`false`),this.domNode.insertBefore(this.uiNode,this.domNode.firstChild)}build(){this.children=new HB,Array.from(this.domNode.childNodes).filter(e=>e!==this.uiNode).reverse().forEach(e=>{try{let t=UB(e,this.scroll);this.insertBefore(t,this.children.head||void 0)}catch(e){if(e instanceof AB)return;throw e}})}deleteAt(e,t){if(e===0&&t===this.length())return this.remove();this.children.forEachAt(e,t,(e,t,n)=>{e.deleteAt(t,n)})}descendant(t,n=0){let[r,i]=this.children.find(n);return t.blotName==null&&t(r)||t.blotName!=null&&r instanceof t?[r,i]:r instanceof e?r.descendant(t,i):[null,-1]}descendants(t,n=0,r=Number.MAX_VALUE){let i=[],a=r;return this.children.forEachAt(n,r,(n,r,o)=>{(t.blotName==null&&t(n)||t.blotName!=null&&n instanceof t)&&i.push(n),n instanceof e&&(i=i.concat(n.descendants(t,r,a))),a-=o}),i}detach(){this.children.forEach(e=>{e.detach()}),super.detach()}enforceAllowedChildren(){let t=!1;this.children.forEach(n=>{t||this.statics.allowedChildren.some(e=>n instanceof e)||(n.statics.scope===X.BLOCK_BLOT?(n.next!=null&&this.splitAfter(n),n.prev!=null&&this.splitAfter(n.prev),n.parent.unwrap(),t=!0):n instanceof e?n.unwrap():n.remove())})}formatAt(e,t,n,r){this.children.forEachAt(e,t,(e,t,i)=>{e.formatAt(t,i,n,r)})}insertAt(e,t,n){let[r,i]=this.children.find(e);if(r)r.insertAt(i,t,n);else{let e=n==null?this.scroll.create(`text`,t):this.scroll.create(t,n);this.appendChild(e)}}insertBefore(e,t){e.parent!=null&&e.parent.children.remove(e);let n=null;this.children.insertBefore(e,t||null),e.parent=this,t!=null&&(n=t.domNode),(this.domNode.parentNode!==e.domNode||this.domNode.nextSibling!==n)&&this.domNode.insertBefore(e.domNode,n),e.attach()}length(){return this.children.reduce((e,t)=>e+t.length(),0)}moveChildren(e,t){this.children.forEach(n=>{e.insertBefore(n,t)})}optimize(e){if(super.optimize(e),this.enforceAllowedChildren(),this.uiNode!=null&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),this.children.length===0){if(this.statics.defaultChild!=null){let e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e)}else this.remove()}}path(t,n=!1){let[r,i]=this.children.find(t,n),a=[[this,t]];return r instanceof e?a.concat(r.path(i,n)):(r!=null&&a.push([r,i]),a)}removeChild(e){this.children.remove(e)}replaceWith(t,n){let r=typeof t==`string`?this.scroll.create(t,n):t;return r instanceof e&&this.moveChildren(r),super.replaceWith(r)}split(e,t=!1){if(!t){if(e===0)return this;if(e===this.length())return this.next}let n=this.clone();return this.parent&&this.parent.insertBefore(n,this.next||void 0),this.children.forEachAt(e,this.length(),(e,r,i)=>{let a=e.split(r,t);a!=null&&n.appendChild(a)}),n}splitAfter(e){let t=this.clone();for(;e.next!=null;)t.appendChild(e.next);return this.parent&&this.parent.insertBefore(t,this.next||void 0),t}unwrap(){this.parent&&this.moveChildren(this.parent,this.next||void 0),this.remove()}update(e,t){let n=[],r=[];e.forEach(e=>{e.target===this.domNode&&e.type===`childList`&&(n.push(...e.addedNodes),r.push(...e.removedNodes))}),r.forEach(e=>{if(e.parentNode!=null&&e.tagName!==`IFRAME`&&document.body.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)return;let t=this.scroll.find(e);t!=null&&(t.domNode.parentNode==null||t.domNode.parentNode===this.domNode)&&t.detach()}),n.filter(e=>e.parentNode===this.domNode&&e!==this.uiNode).sort((e,t)=>e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1).forEach(e=>{let t=null;e.nextSibling!=null&&(t=this.scroll.find(e.nextSibling));let n=UB(e,this.scroll);(n.next!==t||n.next==null)&&(n.parent!=null&&n.parent.removeChild(this),this.insertBefore(n,t||void 0))}),this.enforceAllowedChildren()}};WB.uiClass=``;var GB=WB;function KB(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}var qB=class e extends GB{static create(e){return super.create(e)}static formats(t,n){let r=n.query(e.blotName);if(r==null||t.tagName!==r.tagName){if(typeof this.tagName==`string`)return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(e,t){super(e,t),this.attributes=new LB(this.domNode)}format(t,n){if(t===this.statics.blotName&&!n)this.children.forEach(t=>{t instanceof e||(t=t.wrap(e.blotName,!0)),this.attributes.copy(t)}),this.unwrap();else{let e=this.scroll.query(t,X.INLINE);if(e==null)return;e instanceof kB?this.attributes.attribute(e,n):n&&(t!==this.statics.blotName||this.formats()[t]!==n)&&this.replaceWith(t,n)}}formats(){let e=this.attributes.values(),t=this.statics.formats(this.domNode,this.scroll);return t!=null&&(e[this.statics.blotName]=t),e}formatAt(e,t,n,r){this.formats()[n]!=null||this.scroll.query(n,X.ATTRIBUTE)?this.isolate(e,t).format(n,r):super.formatAt(e,t,n,r)}optimize(t){super.optimize(t);let n=this.formats();if(Object.keys(n).length===0)return this.unwrap();let r=this.next;r instanceof e&&r.prev===this&&KB(n,r.formats())&&(r.moveChildren(this),r.remove())}replaceWith(e,t){let n=super.replaceWith(e,t);return this.attributes.copy(n),n}update(e,t){super.update(e,t),e.some(e=>e.target===this.domNode&&e.type===`attributes`)&&this.attributes.build()}wrap(t,n){let r=super.wrap(t,n);return r instanceof e&&this.attributes.move(r),r}};qB.allowedChildren=[qB,VB],qB.blotName=`inline`,qB.scope=X.INLINE_BLOT,qB.tagName=`SPAN`;var JB=qB,YB=class e extends GB{static create(e){return super.create(e)}static formats(t,n){let r=n.query(e.blotName);if(r==null||t.tagName!==r.tagName){if(typeof this.tagName==`string`)return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(e,t){super(e,t),this.attributes=new LB(this.domNode)}format(t,n){let r=this.scroll.query(t,X.BLOCK);r!=null&&(r instanceof kB?this.attributes.attribute(r,n):t===this.statics.blotName&&!n?this.replaceWith(e.blotName):n&&(t!==this.statics.blotName||this.formats()[t]!==n)&&this.replaceWith(t,n))}formats(){let e=this.attributes.values(),t=this.statics.formats(this.domNode,this.scroll);return t!=null&&(e[this.statics.blotName]=t),e}formatAt(e,t,n,r){this.scroll.query(n,X.BLOCK)==null?super.formatAt(e,t,n,r):this.format(n,r)}insertAt(e,t,n){if(n==null||this.scroll.query(t,X.INLINE)!=null)super.insertAt(e,t,n);else{let r=this.split(e);if(r!=null){let e=this.scroll.create(t,n);r.parent.insertBefore(e,r)}else throw Error(`Attempt to insertAt after block boundaries`)}}replaceWith(e,t){let n=super.replaceWith(e,t);return this.attributes.copy(n),n}update(e,t){super.update(e,t),e.some(e=>e.target===this.domNode&&e.type===`attributes`)&&this.attributes.build()}};YB.blotName=`block`,YB.scope=X.BLOCK_BLOT,YB.tagName=`P`,YB.allowedChildren=[JB,YB,VB];var XB=YB,ZB=class extends GB{checkMerge(){return this.next!==null&&this.next.statics.blotName===this.statics.blotName}deleteAt(e,t){super.deleteAt(e,t),this.enforceAllowedChildren()}formatAt(e,t,n,r){super.formatAt(e,t,n,r),this.enforceAllowedChildren()}insertAt(e,t,n){super.insertAt(e,t,n),this.enforceAllowedChildren()}optimize(e){super.optimize(e),this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}};ZB.blotName=`container`,ZB.scope=X.BLOCK_BLOT;var QB=ZB,$B=class extends VB{static formats(e,t){}format(e,t){super.formatAt(0,this.length(),e,t)}formatAt(e,t,n,r){e===0&&t===this.length()?this.format(n,r):super.formatAt(e,t,n,r)}formats(){return this.statics.formats(this.domNode,this.scroll)}},eV={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},tV=100,nV=class extends GB{constructor(e,t){super(null,t),this.registry=e,this.scroll=this,this.build(),this.observer=new MutationObserver(e=>{this.update(e)}),this.observer.observe(this.domNode,eV),this.attach()}create(e,t){return this.registry.create(this,e,t)}find(e,t=!1){let n=this.registry.find(e,t);return n?n.scroll===this?n:t?this.find(n.scroll.domNode.parentNode,!0):null:null}query(e,t=X.ANY){return this.registry.query(e,t)}register(...e){return this.registry.register(...e)}build(){this.scroll!=null&&super.build()}detach(){super.detach(),this.observer.disconnect()}deleteAt(e,t){this.update(),e===0&&t===this.length()?this.children.forEach(e=>{e.remove()}):super.deleteAt(e,t)}formatAt(e,t,n,r){this.update(),super.formatAt(e,t,n,r)}insertAt(e,t,n){this.update(),super.insertAt(e,t,n)}optimize(e=[],t={}){super.optimize(t);let n=t.mutationsMap||new WeakMap,r=Array.from(this.observer.takeRecords());for(;r.length>0;)e.push(r.pop());let i=(e,t=!0)=>{e==null||e===this||e.domNode.parentNode!=null&&(n.has(e.domNode)||n.set(e.domNode,[]),t&&i(e.parent))},a=e=>{n.has(e.domNode)&&(e instanceof GB&&e.children.forEach(a),n.delete(e.domNode),e.optimize(t))},o=e;for(let t=0;o.length>0;t+=1){if(t>=tV)throw Error(`[Parchment] Maximum optimize iterations reached`);for(o.forEach(e=>{let t=this.find(e.target,!0);t!=null&&(t.domNode===e.target&&(e.type===`childList`?(i(this.find(e.previousSibling,!1)),Array.from(e.addedNodes).forEach(e=>{let t=this.find(e,!1);i(t,!1),t instanceof GB&&t.children.forEach(e=>{i(e,!1)})})):e.type===`attributes`&&i(t.prev)),i(t))}),this.children.forEach(a),o=Array.from(this.observer.takeRecords()),r=o.slice();r.length>0;)e.push(r.pop())}}update(e,t={}){e||=this.observer.takeRecords();let n=new WeakMap;e.map(e=>{let t=this.find(e.target,!0);return t==null?null:n.has(t.domNode)?(n.get(t.domNode).push(e),null):(n.set(t.domNode,[e]),t)}).forEach(e=>{e!=null&&e!==this&&n.has(e.domNode)&&e.update(n.get(e.domNode)||[],t)}),t.mutationsMap=n,n.has(this.domNode)&&super.update(n.get(this.domNode),t),this.optimize(e,t)}};nV.blotName=`scroll`,nV.defaultChild=XB,nV.allowedChildren=[XB,QB],nV.scope=X.BLOCK_BLOT,nV.tagName=`DIV`;var rV=nV,iV=class e extends VB{static create(e){return document.createTextNode(e)}static value(e){return e.data}constructor(e,t){super(e,t),this.text=this.statics.value(this.domNode)}deleteAt(e,t){this.domNode.data=this.text=this.text.slice(0,e)+this.text.slice(e+t)}index(e,t){return this.domNode===e?t:-1}insertAt(e,t,n){n==null?(this.text=this.text.slice(0,e)+t+this.text.slice(e),this.domNode.data=this.text):super.insertAt(e,t,n)}length(){return this.text.length}optimize(t){super.optimize(t),this.text=this.statics.value(this.domNode),this.text.length===0?this.remove():this.next instanceof e&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())}position(e,t=!1){return[this.domNode,e]}split(e,t=!1){if(!t){if(e===0)return this;if(e===this.length())return this.next}let n=this.scroll.create(this.domNode.splitText(e));return this.parent.insertBefore(n,this.next||void 0),this.text=this.statics.value(this.domNode),n}update(e,t){e.some(e=>e.type===`characterData`&&e.target===this.domNode)&&(this.text=this.statics.value(this.domNode))}value(){return this.text}};iV.blotName=`text`,iV.scope=X.INLINE_BLOT;var aV=iV,oV=n(((e,t)=>{var n=-1,r=1,i=0;function a(e,t,n,r,a){if(e===t)return e?[[i,e]]:[];if(n!=null){var s=D(e,t,n);if(s)return s}var c=l(e,t),u=e.substring(0,c);e=e.substring(c),t=t.substring(c),c=d(e,t);var f=e.substring(e.length-c);e=e.substring(0,e.length-c),t=t.substring(0,t.length-c);var m=o(e,t);return u&&m.unshift([i,u]),f&&m.push([i,f]),b(m,a),r&&p(m),m}function o(e,t){var o;if(!e)return[[r,t]];if(!t)return[[n,e]];var c=e.length>t.length?e:t,l=e.length>t.length?t:e,u=c.indexOf(l);if(u!==-1)return o=[[r,c.substring(0,u)],[i,l],[r,c.substring(u+l.length)]],e.length>t.length&&(o[0][0]=o[2][0]=n),o;if(l.length===1)return[[n,e],[r,t]];var d=f(e,t);if(d){var p=d[0],m=d[1],h=d[2],g=d[3],_=d[4],v=a(p,h),y=a(m,g);return v.concat([[i,_]],y)}return s(e,t)}function s(e,t){for(var i=e.length,a=t.length,o=Math.ceil((i+a)/2),s=o,l=2*o,u=Array(l),d=Array(l),f=0;f<l;f++)u[f]=-1,d[f]=-1;u[s+1]=0,d[s+1]=0;for(var p=i-a,m=p%2!=0,h=0,g=0,_=0,v=0,y=0;y<o;y++){for(var b=-y+h;b<=y-g;b+=2){for(var x=s+b,S=b===-y||b!==y&&u[x-1]<u[x+1]?u[x+1]:u[x-1]+1,C=S-b;S<i&&C<a&&e.charAt(S)===t.charAt(C);)S++,C++;if(u[x]=S,S>i)g+=2;else if(C>a)h+=2;else if(m){var w=s+p-b;if(w>=0&&w<l&&d[w]!==-1){var T=i-d[w];if(S>=T)return c(e,t,S,C)}}}for(var E=-y+_;E<=y-v;E+=2){for(var w=s+E,T=E===-y||E!==y&&d[w-1]<d[w+1]?d[w+1]:d[w-1]+1,D=T-E;T<i&&D<a&&e.charAt(i-T-1)===t.charAt(a-D-1);)T++,D++;if(d[w]=T,T>i)v+=2;else if(D>a)_+=2;else if(!m){var x=s+p-E;if(x>=0&&x<l&&u[x]!==-1){var S=u[x],C=s+S-x;if(T=i-T,S>=T)return c(e,t,S,C)}}}}return[[n,e],[r,t]]}function c(e,t,n,r){var i=e.substring(0,n),o=t.substring(0,r),s=e.substring(n),c=t.substring(r),l=a(i,o),u=a(s,c);return l.concat(u)}function l(e,t){if(!e||!t||e.charAt(0)!==t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return x(e.charCodeAt(i-1))&&i--,i}function u(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var a=0,o=1;;){var s=e.substring(i-o),c=t.indexOf(s);if(c==-1)return a;o+=c,(c==0||e.substring(i-o)==t.substring(0,o))&&(a=o,o++)}}function d(e,t){if(!e||!t||e.slice(-1)!==t.slice(-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return S(e.charCodeAt(e.length-i))&&i--,i}function f(e,t){var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||r.length*2<n.length)return null;function i(e,t,n){for(var r=e.substring(n,n+Math.floor(e.length/4)),i=-1,a=``,o,s,c,u;(i=t.indexOf(r,i+1))!==-1;){var f=l(e.substring(n),t.substring(i)),p=d(e.substring(0,n),t.substring(0,i));a.length<p+f&&(a=t.substring(i-p,i)+t.substring(i,i+f),o=e.substring(0,n-p),s=e.substring(n+f),c=t.substring(0,i-p),u=t.substring(i+f))}return a.length*2>=e.length?[o,s,c,u,a]:null}var a=i(n,r,Math.ceil(n.length/4)),o=i(n,r,Math.ceil(n.length/2)),s;if(!a&&!o)return null;s=o?a&&a[4].length>o[4].length?a:o:a;var c,u,f,p;e.length>t.length?(c=s[0],u=s[1],f=s[2],p=s[3]):(f=s[0],p=s[1],c=s[2],u=s[3]);var m=s[4];return[c,u,f,p,m]}function p(e){for(var t=!1,a=[],o=0,s=null,c=0,l=0,d=0,f=0,p=0;c<e.length;)e[c][0]==i?(a[o++]=c,l=f,d=p,f=0,p=0,s=e[c][1]):(e[c][0]==r?f+=e[c][1].length:p+=e[c][1].length,s&&s.length<=Math.max(l,d)&&s.length<=Math.max(f,p)&&(e.splice(a[o-1],0,[n,s]),e[a[o-1]+1][0]=r,o--,o--,c=o>0?a[o-1]:-1,l=0,d=0,f=0,p=0,s=null,t=!0)),c++;for(t&&b(e),y(e),c=1;c<e.length;){if(e[c-1][0]==n&&e[c][0]==r){var m=e[c-1][1],h=e[c][1],g=u(m,h),_=u(h,m);g>=_?(g>=m.length/2||g>=h.length/2)&&(e.splice(c,0,[i,h.substring(0,g)]),e[c-1][1]=m.substring(0,m.length-g),e[c+1][1]=h.substring(g),c++):(_>=m.length/2||_>=h.length/2)&&(e.splice(c,0,[i,m.substring(0,_)]),e[c-1][0]=r,e[c-1][1]=h.substring(0,h.length-_),e[c+1][0]=n,e[c+1][1]=m.substring(_),c++),c++}c++}}var m=/[^a-zA-Z0-9]/,h=/\s/,g=/[\r\n]/,_=/\n\r?\n$/,v=/^\r?\n\r?\n/;function y(e){function t(e,t){if(!e||!t)return 6;var n=e.charAt(e.length-1),r=t.charAt(0),i=n.match(m),a=r.match(m),o=i&&n.match(h),s=a&&r.match(h),c=o&&n.match(g),l=s&&r.match(g),u=c&&e.match(_),d=l&&t.match(v);return u||d?5:c||l?4:i&&!o&&s?3:o||s?2:i||a?1:0}for(var n=1;n<e.length-1;){if(e[n-1][0]==i&&e[n+1][0]==i){var r=e[n-1][1],a=e[n][1],o=e[n+1][1],s=d(r,a);if(s){var c=a.substring(a.length-s);r=r.substring(0,r.length-s),a=c+a.substring(0,a.length-s),o=c+o}for(var l=r,u=a,f=o,p=t(r,a)+t(a,o);a.charAt(0)===o.charAt(0);){r+=a.charAt(0),a=a.substring(1)+o.charAt(0),o=o.substring(1);var y=t(r,a)+t(a,o);y>=p&&(p=y,l=r,u=a,f=o)}e[n-1][1]!=l&&(l?e[n-1][1]=l:(e.splice(n-1,1),n--),e[n][1]=u,f?e[n+1][1]=f:(e.splice(n+1,1),n--))}n++}}function b(e,t){e.push([i,``]);for(var a=0,o=0,s=0,c=``,u=``,f;a<e.length;){if(a<e.length-1&&!e[a][1]){e.splice(a,1);continue}switch(e[a][0]){case r:s++,u+=e[a][1],a++;break;case n:o++,c+=e[a][1],a++;break;case i:var p=a-s-o-1;if(t){if(p>=0&&w(e[p][1])){var m=e[p][1].slice(-1);if(e[p][1]=e[p][1].slice(0,-1),c=m+c,u=m+u,!e[p][1]){e.splice(p,1),a--;var h=p-1;e[h]&&e[h][0]===r&&(s++,u=e[h][1]+u,h--),e[h]&&e[h][0]===n&&(o++,c=e[h][1]+c,h--),p=h}}if(C(e[a][1])){var m=e[a][1].charAt(0);e[a][1]=e[a][1].slice(1),c+=m,u+=m}}if(a<e.length-1&&!e[a][1]){e.splice(a,1);break}if(c.length>0||u.length>0){c.length>0&&u.length>0&&(f=l(u,c),f!==0&&(p>=0?e[p][1]+=u.substring(0,f):(e.splice(0,0,[i,u.substring(0,f)]),a++),u=u.substring(f),c=c.substring(f)),f=d(u,c),f!==0&&(e[a][1]=u.substring(u.length-f)+e[a][1],u=u.substring(0,u.length-f),c=c.substring(0,c.length-f)));var g=s+o;c.length===0&&u.length===0?(e.splice(a-g,g),a-=g):c.length===0?(e.splice(a-g,g,[r,u]),a=a-g+1):u.length===0?(e.splice(a-g,g,[n,c]),a=a-g+1):(e.splice(a-g,g,[n,c],[r,u]),a=a-g+2)}a!==0&&e[a-1][0]===i?(e[a-1][1]+=e[a][1],e.splice(a,1)):a++,s=0,o=0,c=``,u=``}}e[e.length-1][1]===``&&e.pop();var _=!1;for(a=1;a<e.length-1;)e[a-1][0]===i&&e[a+1][0]===i&&(e[a][1].substring(e[a][1].length-e[a-1][1].length)===e[a-1][1]?(e[a][1]=e[a-1][1]+e[a][1].substring(0,e[a][1].length-e[a-1][1].length),e[a+1][1]=e[a-1][1]+e[a+1][1],e.splice(a-1,1),_=!0):e[a][1].substring(0,e[a+1][1].length)==e[a+1][1]&&(e[a-1][1]+=e[a+1][1],e[a][1]=e[a][1].substring(e[a+1][1].length)+e[a+1][1],e.splice(a+1,1),_=!0)),a++;_&&b(e,t)}function x(e){return e>=55296&&e<=56319}function S(e){return e>=56320&&e<=57343}function C(e){return S(e.charCodeAt(0))}function w(e){return x(e.charCodeAt(e.length-1))}function T(e){for(var t=[],n=0;n<e.length;n++)e[n][1].length>0&&t.push(e[n]);return t}function E(e,t,a,o){return w(e)||C(o)?null:T([[i,e],[n,t],[r,a],[i,o]])}function D(e,t,n){var r=typeof n==`number`?{index:n,length:0}:n.oldRange,i=typeof n==`number`?null:n.newRange,a=e.length,o=t.length;if(r.length===0&&(i===null||i.length===0)){var s=r.index,c=e.slice(0,s),l=e.slice(s),u=i?i.index:null;editBefore:{var d=s+o-a;if(u!==null&&u!==d||d<0||d>o)break editBefore;var f=t.slice(0,d),p=t.slice(d);if(p!==l)break editBefore;var m=Math.min(s,d),h=c.slice(0,m),g=f.slice(0,m);if(h!==g)break editBefore;var _=c.slice(m),v=f.slice(m);return E(h,_,v,l)}editAfter:{if(u!==null&&u!==s)break editAfter;var y=s,f=t.slice(0,y),p=t.slice(y);if(f!==c)break editAfter;var b=Math.min(a-y,o-y),x=l.slice(l.length-b),S=p.slice(p.length-b);if(x!==S)break editAfter;var _=l.slice(0,l.length-b),v=p.slice(0,p.length-b);return E(c,_,v,x)}}if(r.length>0&&i&&i.length===0)replaceRange:{var h=e.slice(0,r.index),x=e.slice(r.index+r.length),m=h.length,b=x.length;if(o<m+b)break replaceRange;var g=t.slice(0,m),S=t.slice(o-b);if(h!==g||x!==S)break replaceRange;var _=e.slice(m,a-b),v=t.slice(m,o-b);return E(h,_,v,x)}return null}function O(e,t,n,r){return a(e,t,n,r,!0)}O.INSERT=r,O.DELETE=n,O.EQUAL=i,t.exports=O})),sV=n(((e,t)=>{var n=`__lodash_hash_undefined__`,r=9007199254740991,i=`[object Arguments]`,a=`[object Array]`,o=`[object Boolean]`,s=`[object Date]`,c=`[object Error]`,l=`[object Function]`,u=`[object GeneratorFunction]`,d=`[object Map]`,f=`[object Number]`,p=`[object Object]`,m=`[object Promise]`,h=`[object RegExp]`,g=`[object Set]`,_=`[object String]`,v=`[object Symbol]`,y=`[object WeakMap]`,b=`[object ArrayBuffer]`,x=`[object DataView]`,S=`[object Float32Array]`,C=`[object Float64Array]`,w=`[object Int8Array]`,T=`[object Int16Array]`,E=`[object Int32Array]`,D=`[object Uint8Array]`,O=`[object Uint8ClampedArray]`,k=`[object Uint16Array]`,A=`[object Uint32Array]`,ee=/[\\^$.*+?()[\]{}|]/g,j=/\w*$/,M=/^\[object .+?Constructor\]$/,N=/^(?:0|[1-9]\d*)$/,P={};P[i]=P[a]=P[b]=P[x]=P[o]=P[s]=P[S]=P[C]=P[w]=P[T]=P[E]=P[d]=P[f]=P[p]=P[h]=P[g]=P[_]=P[v]=P[D]=P[O]=P[k]=P[A]=!0,P[c]=P[l]=P[y]=!1;var F=typeof global==`object`&&global&&global.Object===Object&&global,I=typeof self==`object`&&self&&self.Object===Object&&self,te=F||I||Function(`return this`)(),ne=typeof e==`object`&&e&&!e.nodeType&&e,L=ne&&typeof t==`object`&&t&&!t.nodeType&&t,R=L&&L.exports===ne;function re(e,t){return e.set(t[0],t[1]),e}function ie(e,t){return e.add(t),e}function ae(e,t){for(var n=-1,r=e?e.length:0;++n<r&&t(e[n],n,e)!==!1;);return e}function oe(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function se(e,t,n,r){var i=-1,a=e?e.length:0;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function ce(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function le(e,t){return e?.[t]}function ue(e){var t=!1;if(e!=null&&typeof e.toString!=`function`)try{t=!!(e+``)}catch{}return t}function de(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function fe(e,t){return function(n){return e(t(n))}}function pe(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var me=Array.prototype,he=Function.prototype,ge=Object.prototype,_e=te[`__core-js_shared__`],ve=function(){var e=/[^.]+$/.exec(_e&&_e.keys&&_e.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),ye=he.toString,be=ge.hasOwnProperty,xe=ge.toString,Se=RegExp(`^`+ye.call(be).replace(ee,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),Ce=R?te.Buffer:void 0,we=te.Symbol,Te=te.Uint8Array,Ee=fe(Object.getPrototypeOf,Object),De=Object.create,Oe=ge.propertyIsEnumerable,ke=me.splice,Ae=Object.getOwnPropertySymbols,je=Ce?Ce.isBuffer:void 0,Me=fe(Object.keys,Object),Ne=Rt(te,`DataView`),Pe=Rt(te,`Map`),Fe=Rt(te,`Promise`),Ie=Rt(te,`Set`),Le=Rt(te,`WeakMap`),Re=Rt(Object,`create`),ze=Jt(Ne),Be=Jt(Pe),Ve=Jt(Fe),He=Jt(Ie),Ue=Jt(Le),We=we?we.prototype:void 0,Ge=We?We.valueOf:void 0;function Ke(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function qe(){this.__data__=Re?Re(null):{}}function Je(e){return this.has(e)&&delete this.__data__[e]}function z(e){var t=this.__data__;if(Re){var r=t[e];return r===n?void 0:r}return be.call(t,e)?t[e]:void 0}function Ye(e){var t=this.__data__;return Re?t[e]!==void 0:be.call(t,e)}function Xe(e,t){var r=this.__data__;return r[e]=Re&&t===void 0?n:t,this}Ke.prototype.clear=qe,Ke.prototype.delete=Je,Ke.prototype.get=z,Ke.prototype.has=Ye,Ke.prototype.set=Xe;function Ze(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Qe(){this.__data__=[]}function $e(e){var t=this.__data__,n=_t(t,e);return n<0?!1:(n==t.length-1?t.pop():ke.call(t,n,1),!0)}function et(e){var t=this.__data__,n=_t(t,e);return n<0?void 0:t[n][1]}function tt(e){return _t(this.__data__,e)>-1}function nt(e,t){var n=this.__data__,r=_t(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}Ze.prototype.clear=Qe,Ze.prototype.delete=$e,Ze.prototype.get=et,Ze.prototype.has=tt,Ze.prototype.set=nt;function rt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function it(){this.__data__={hash:new Ke,map:new(Pe||Ze),string:new Ke}}function at(e){return Lt(this,e).delete(e)}function ot(e){return Lt(this,e).get(e)}function st(e){return Lt(this,e).has(e)}function ct(e,t){return Lt(this,e).set(e,t),this}rt.prototype.clear=it,rt.prototype.delete=at,rt.prototype.get=ot,rt.prototype.has=st,rt.prototype.set=ct;function lt(e){this.__data__=new Ze(e)}function ut(){this.__data__=new Ze}function dt(e){return this.__data__.delete(e)}function ft(e){return this.__data__.get(e)}function pt(e){return this.__data__.has(e)}function mt(e,t){var n=this.__data__;if(n instanceof Ze){var r=n.__data__;if(!Pe||r.length<199)return r.push([e,t]),this;n=this.__data__=new rt(r)}return n.set(e,t),this}lt.prototype.clear=ut,lt.prototype.delete=dt,lt.prototype.get=ft,lt.prototype.has=pt,lt.prototype.set=mt;function ht(e,t){var n=Qt(e)||Zt(e)?ce(e.length,String):[],r=n.length,i=!!r;for(var a in e)(t||be.call(e,a))&&!(i&&(a==`length`||Wt(a,r)))&&n.push(a);return n}function gt(e,t,n){var r=e[t];(!(be.call(e,t)&&Xt(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function _t(e,t){for(var n=e.length;n--;)if(Xt(e[n][0],t))return n;return-1}function vt(e,t){return e&&Pt(t,sn(t),e)}function yt(e,t,n,r,a,o,s){var c;if(r&&(c=o?r(e,a,o,s):r(e)),c!==void 0)return c;if(!an(e))return e;var d=Qt(e);if(d){if(c=Vt(e),!t)return Nt(e,c)}else{var f=Bt(e),m=f==l||f==u;if(tn(e))return Tt(e,t);if(f==p||f==i||m&&!o){if(ue(e))return o?e:{};if(c=Ht(m?{}:e),!t)return Ft(e,vt(c,e))}else{if(!P[f])return o?e:{};c=Ut(e,f,yt,t)}}s||=new lt;var h=s.get(e);if(h)return h;if(s.set(e,c),!d)var g=n?It(e):sn(e);return ae(g||e,function(i,a){g&&(a=i,i=e[a]),gt(c,a,yt(i,t,n,r,a,e,s))}),c}function bt(e){return an(e)?De(e):{}}function xt(e,t,n){var r=t(e);return Qt(e)?r:oe(r,n(e))}function St(e){return xe.call(e)}function Ct(e){return!an(e)||Kt(e)?!1:(nn(e)||ue(e)?Se:M).test(Jt(e))}function wt(e){if(!qt(e))return Me(e);var t=[];for(var n in Object(e))be.call(e,n)&&n!=`constructor`&&t.push(n);return t}function Tt(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}function Et(e){var t=new e.constructor(e.byteLength);return new Te(t).set(new Te(e)),t}function Dt(e,t){var n=t?Et(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Ot(e,t,n){return se(t?n(de(e),!0):de(e),re,new e.constructor)}function kt(e){var t=new e.constructor(e.source,j.exec(e));return t.lastIndex=e.lastIndex,t}function At(e,t,n){return se(t?n(pe(e),!0):pe(e),ie,new e.constructor)}function jt(e){return Ge?Object(Ge.call(e)):{}}function Mt(e,t){var n=t?Et(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Nt(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function Pt(e,t,n,r){n||={};for(var i=-1,a=t.length;++i<a;){var o=t[i],s=r?r(n[o],e[o],o,n,e):void 0;gt(n,o,s===void 0?e[o]:s)}return n}function Ft(e,t){return Pt(e,zt(e),t)}function It(e){return xt(e,sn,zt)}function Lt(e,t){var n=e.__data__;return Gt(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function Rt(e,t){var n=le(e,t);return Ct(n)?n:void 0}var zt=Ae?fe(Ae,Object):cn,Bt=St;(Ne&&Bt(new Ne(new ArrayBuffer(1)))!=x||Pe&&Bt(new Pe)!=d||Fe&&Bt(Fe.resolve())!=m||Ie&&Bt(new Ie)!=g||Le&&Bt(new Le)!=y)&&(Bt=function(e){var t=xe.call(e),n=t==p?e.constructor:void 0,r=n?Jt(n):void 0;if(r)switch(r){case ze:return x;case Be:return d;case Ve:return m;case He:return g;case Ue:return y}return t});function Vt(e){var t=e.length,n=e.constructor(t);return t&&typeof e[0]==`string`&&be.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function Ht(e){return typeof e.constructor==`function`&&!qt(e)?bt(Ee(e)):{}}function Ut(e,t,n,r){var i=e.constructor;switch(t){case b:return Et(e);case o:case s:return new i(+e);case x:return Dt(e,r);case S:case C:case w:case T:case E:case D:case O:case k:case A:return Mt(e,r);case d:return Ot(e,r,n);case f:case _:return new i(e);case h:return kt(e);case g:return At(e,r,n);case v:return jt(e)}}function Wt(e,t){return t??=r,!!t&&(typeof e==`number`||N.test(e))&&e>-1&&e%1==0&&e<t}function Gt(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function Kt(e){return!!ve&&ve in e}function qt(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||ge)}function Jt(e){if(e!=null){try{return ye.call(e)}catch{}try{return e+``}catch{}}return``}function Yt(e){return yt(e,!0,!0)}function Xt(e,t){return e===t||e!==e&&t!==t}function Zt(e){return en(e)&&be.call(e,`callee`)&&(!Oe.call(e,`callee`)||xe.call(e)==i)}var Qt=Array.isArray;function $t(e){return e!=null&&rn(e.length)&&!nn(e)}function en(e){return on(e)&&$t(e)}var tn=je||ln;function nn(e){var t=an(e)?xe.call(e):``;return t==l||t==u}function rn(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=r}function an(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function on(e){return!!e&&typeof e==`object`}function sn(e){return $t(e)?ht(e):wt(e)}function cn(){return[]}function ln(){return!1}t.exports=Yt})),cV=n(((e,t)=>{var n=`__lodash_hash_undefined__`,r=9007199254740991,i=`[object Arguments]`,a=`[object Array]`,o=`[object Boolean]`,s=`[object Date]`,c=`[object Error]`,l=`[object Function]`,u=`[object Map]`,d=`[object Number]`,f=`[object Object]`,p=`[object Promise]`,m=`[object RegExp]`,h=`[object Set]`,g=`[object String]`,_=`[object WeakMap]`,v=`[object ArrayBuffer]`,y=`[object DataView]`,b=`[object Float32Array]`,x=`[object Float64Array]`,S=`[object Int8Array]`,C=`[object Int16Array]`,w=`[object Int32Array]`,T=`[object Uint8Array]`,E=`[object Uint8ClampedArray]`,D=`[object Uint16Array]`,O=`[object Uint32Array]`,k=/[\\^$.*+?()[\]{}|]/g,A=/^\[object .+?Constructor\]$/,ee=/^(?:0|[1-9]\d*)$/,j={};j[b]=j[x]=j[S]=j[C]=j[w]=j[T]=j[E]=j[D]=j[O]=!0,j[i]=j[a]=j[v]=j[o]=j[y]=j[s]=j[c]=j[l]=j[u]=j[d]=j[f]=j[m]=j[h]=j[g]=j[_]=!1;var M=typeof global==`object`&&global&&global.Object===Object&&global,N=typeof self==`object`&&self&&self.Object===Object&&self,P=M||N||Function(`return this`)(),F=typeof e==`object`&&e&&!e.nodeType&&e,I=F&&typeof t==`object`&&t&&!t.nodeType&&t,te=I&&I.exports===F,ne=te&&M.process,L=function(){try{return ne&&ne.binding&&ne.binding(`util`)}catch{}}(),R=L&&L.isTypedArray;function re(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function ie(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function ae(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function oe(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function se(e){return function(t){return e(t)}}function ce(e,t){return e.has(t)}function le(e,t){return e?.[t]}function ue(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function de(e,t){return function(n){return e(t(n))}}function fe(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var pe=Array.prototype,me=Function.prototype,he=Object.prototype,ge=P[`__core-js_shared__`],_e=me.toString,ve=he.hasOwnProperty,ye=function(){var e=/[^.]+$/.exec(ge&&ge.keys&&ge.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),be=he.toString,xe=RegExp(`^`+_e.call(ve).replace(k,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),Se=te?P.Buffer:void 0,Ce=P.Symbol,we=P.Uint8Array,Te=he.propertyIsEnumerable,Ee=pe.splice,De=Ce?Ce.toStringTag:void 0,Oe=Object.getOwnPropertySymbols,ke=Se?Se.isBuffer:void 0,Ae=de(Object.keys,Object),je=jt(P,`DataView`),Me=jt(P,`Map`),Ne=jt(P,`Promise`),Pe=jt(P,`Set`),Fe=jt(P,`WeakMap`),Ie=jt(Object,`create`),Le=Bt(je),Re=Bt(Me),ze=Bt(Ne),Be=Bt(Pe),Ve=Bt(Fe),He=Ce?Ce.prototype:void 0,Ue=He?He.valueOf:void 0;function We(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ge(){this.__data__=Ie?Ie(null):{},this.size=0}function Ke(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}function qe(e){var t=this.__data__;if(Ie){var r=t[e];return r===n?void 0:r}return ve.call(t,e)?t[e]:void 0}function Je(e){var t=this.__data__;return Ie?t[e]!==void 0:ve.call(t,e)}function z(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=Ie&&t===void 0?n:t,this}We.prototype.clear=Ge,We.prototype.delete=Ke,We.prototype.get=qe,We.prototype.has=Je,We.prototype.set=z;function Ye(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Xe(){this.__data__=[],this.size=0}function Ze(e){var t=this.__data__,n=_t(t,e);return n<0?!1:(n==t.length-1?t.pop():Ee.call(t,n,1),--this.size,!0)}function Qe(e){var t=this.__data__,n=_t(t,e);return n<0?void 0:t[n][1]}function $e(e){return _t(this.__data__,e)>-1}function et(e,t){var n=this.__data__,r=_t(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}Ye.prototype.clear=Xe,Ye.prototype.delete=Ze,Ye.prototype.get=Qe,Ye.prototype.has=$e,Ye.prototype.set=et;function tt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function nt(){this.size=0,this.__data__={hash:new We,map:new(Me||Ye),string:new We}}function rt(e){var t=At(this,e).delete(e);return this.size-=+!!t,t}function it(e){return At(this,e).get(e)}function at(e){return At(this,e).has(e)}function ot(e,t){var n=At(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}tt.prototype.clear=nt,tt.prototype.delete=rt,tt.prototype.get=it,tt.prototype.has=at,tt.prototype.set=ot;function st(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new tt;++t<n;)this.add(e[t])}function ct(e){return this.__data__.set(e,n),this}function lt(e){return this.__data__.has(e)}st.prototype.add=st.prototype.push=ct,st.prototype.has=lt;function ut(e){var t=this.__data__=new Ye(e);this.size=t.size}function dt(){this.__data__=new Ye,this.size=0}function ft(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function pt(e){return this.__data__.get(e)}function mt(e){return this.__data__.has(e)}function ht(e,t){var n=this.__data__;if(n instanceof Ye){var r=n.__data__;if(!Me||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new tt(r)}return n.set(e,t),this.size=n.size,this}ut.prototype.clear=dt,ut.prototype.delete=ft,ut.prototype.get=pt,ut.prototype.has=mt,ut.prototype.set=ht;function gt(e,t){var n=Ut(e),r=!n&&Ht(e),i=!n&&!r&&Gt(e),a=!n&&!r&&!i&&Zt(e),o=n||r||i||a,s=o?oe(e.length,String):[],c=s.length;for(var l in e)(t||ve.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||Ft(l,c)))&&s.push(l);return s}function _t(e,t){for(var n=e.length;n--;)if(Vt(e[n][0],t))return n;return-1}function vt(e,t,n){var r=t(e);return Ut(e)?r:ie(r,n(e))}function yt(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:De&&De in Object(e)?Mt(e):zt(e)}function bt(e){return Xt(e)&&yt(e)==i}function xt(e,t,n,r,i){return e===t?!0:e==null||t==null||!Xt(e)&&!Xt(t)?e!==e&&t!==t:St(e,t,n,r,xt,i)}function St(e,t,n,r,o,s){var c=Ut(e),l=Ut(t),u=c?a:Pt(e),d=l?a:Pt(t);u=u==i?f:u,d=d==i?f:d;var p=u==f,m=d==f,h=u==d;if(h&&Gt(e)){if(!Gt(t))return!1;c=!0,p=!1}if(h&&!p)return s||=new ut,c||Zt(e)?Et(e,t,n,r,o,s):Dt(e,t,u,n,r,o,s);if(!(n&1)){var g=p&&ve.call(e,`__wrapped__`),_=m&&ve.call(t,`__wrapped__`);if(g||_){var v=g?e.value():e,y=_?t.value():t;return s||=new ut,o(v,y,n,r,s)}}return h?(s||=new ut,Ot(e,t,n,r,o,s)):!1}function Ct(e){return!Yt(e)||Lt(e)?!1:(qt(e)?xe:A).test(Bt(e))}function wt(e){return Xt(e)&&Jt(e.length)&&!!j[yt(e)]}function Tt(e){if(!Rt(e))return Ae(e);var t=[];for(var n in Object(e))ve.call(e,n)&&n!=`constructor`&&t.push(n);return t}function Et(e,t,n,r,i,a){var o=n&1,s=e.length,c=t.length;if(s!=c&&!(o&&c>s))return!1;var l=a.get(e);if(l&&a.get(t))return l==t;var u=-1,d=!0,f=n&2?new st:void 0;for(a.set(e,t),a.set(t,e);++u<s;){var p=e[u],m=t[u];if(r)var h=o?r(m,p,u,t,e,a):r(p,m,u,e,t,a);if(h!==void 0){if(h)continue;d=!1;break}if(f){if(!ae(t,function(e,t){if(!ce(f,t)&&(p===e||i(p,e,n,r,a)))return f.push(t)})){d=!1;break}}else if(!(p===m||i(p,m,n,r,a))){d=!1;break}}return a.delete(e),a.delete(t),d}function Dt(e,t,n,r,i,a,l){switch(n){case y:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case v:return!(e.byteLength!=t.byteLength||!a(new we(e),new we(t)));case o:case s:case d:return Vt(+e,+t);case c:return e.name==t.name&&e.message==t.message;case m:case g:return e==t+``;case u:var f=ue;case h:var p=r&1;if(f||=fe,e.size!=t.size&&!p)return!1;var _=l.get(e);if(_)return _==t;r|=2,l.set(e,t);var b=Et(f(e),f(t),r,i,a,l);return l.delete(e),b;case`[object Symbol]`:if(Ue)return Ue.call(e)==Ue.call(t)}return!1}function Ot(e,t,n,r,i,a){var o=n&1,s=kt(e),c=s.length;if(c!=kt(t).length&&!o)return!1;for(var l=c;l--;){var u=s[l];if(!(o?u in t:ve.call(t,u)))return!1}var d=a.get(e);if(d&&a.get(t))return d==t;var f=!0;a.set(e,t),a.set(t,e);for(var p=o;++l<c;){u=s[l];var m=e[u],h=t[u];if(r)var g=o?r(h,m,u,t,e,a):r(m,h,u,e,t,a);if(!(g===void 0?m===h||i(m,h,n,r,a):g)){f=!1;break}p||=u==`constructor`}if(f&&!p){var _=e.constructor,v=t.constructor;_!=v&&`constructor`in e&&`constructor`in t&&!(typeof _==`function`&&_ instanceof _&&typeof v==`function`&&v instanceof v)&&(f=!1)}return a.delete(e),a.delete(t),f}function kt(e){return vt(e,Qt,Nt)}function At(e,t){var n=e.__data__;return It(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function jt(e,t){var n=le(e,t);return Ct(n)?n:void 0}function Mt(e){var t=ve.call(e,De),n=e[De];try{e[De]=void 0;var r=!0}catch{}var i=be.call(e);return r&&(t?e[De]=n:delete e[De]),i}var Nt=Oe?function(e){return e==null?[]:(e=Object(e),re(Oe(e),function(t){return Te.call(e,t)}))}:$t,Pt=yt;(je&&Pt(new je(new ArrayBuffer(1)))!=y||Me&&Pt(new Me)!=u||Ne&&Pt(Ne.resolve())!=p||Pe&&Pt(new Pe)!=h||Fe&&Pt(new Fe)!=_)&&(Pt=function(e){var t=yt(e),n=t==f?e.constructor:void 0,r=n?Bt(n):``;if(r)switch(r){case Le:return y;case Re:return u;case ze:return p;case Be:return h;case Ve:return _}return t});function Ft(e,t){return t??=r,!!t&&(typeof e==`number`||ee.test(e))&&e>-1&&e%1==0&&e<t}function It(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function Lt(e){return!!ye&&ye in e}function Rt(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||he)}function zt(e){return be.call(e)}function Bt(e){if(e!=null){try{return _e.call(e)}catch{}try{return e+``}catch{}}return``}function Vt(e,t){return e===t||e!==e&&t!==t}var Ht=bt(function(){return arguments}())?bt:function(e){return Xt(e)&&ve.call(e,`callee`)&&!Te.call(e,`callee`)},Ut=Array.isArray;function Wt(e){return e!=null&&Jt(e.length)&&!qt(e)}var Gt=ke||en;function Kt(e,t){return xt(e,t)}function qt(e){if(!Yt(e))return!1;var t=yt(e);return t==l||t==`[object GeneratorFunction]`||t==`[object AsyncFunction]`||t==`[object Proxy]`}function Jt(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=r}function Yt(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}function Xt(e){return typeof e==`object`&&!!e}var Zt=R?se(R):wt;function Qt(e){return Wt(e)?gt(e):Tt(e)}function $t(){return[]}function en(){return!1}t.exports=Kt})),lV=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=sV(),n=cV(),r;(function(e){function r(e={},n={},r=!1){typeof e!=`object`&&(e={}),typeof n!=`object`&&(n={});let i=t(n);r||(i=Object.keys(i).reduce((e,t)=>(i[t]!=null&&(e[t]=i[t]),e),{}));for(let t in e)e[t]!==void 0&&n[t]===void 0&&(i[t]=e[t]);return Object.keys(i).length>0?i:void 0}e.compose=r;function i(e={},t={}){typeof e!=`object`&&(e={}),typeof t!=`object`&&(t={});let r=Object.keys(e).concat(Object.keys(t)).reduce((r,i)=>(n(e[i],t[i])||(r[i]=t[i]===void 0?null:t[i]),r),{});return Object.keys(r).length>0?r:void 0}e.diff=i;function a(e={},t={}){e||={};let n=Object.keys(t).reduce((n,r)=>(t[r]!==e[r]&&e[r]!==void 0&&(n[r]=t[r]),n),{});return Object.keys(e).reduce((n,r)=>(e[r]!==t[r]&&t[r]===void 0&&(n[r]=null),n),n)}e.invert=a;function o(e,t,n=!1){if(typeof e!=`object`)return t;if(typeof t!=`object`)return;if(!n)return t;let r=Object.keys(t).reduce((n,r)=>(e[r]===void 0&&(n[r]=t[r]),n),{});return Object.keys(r).length>0?r:void 0}e.transform=o})(r||={}),e.default=r})),uV=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t;(function(e){function t(e){return typeof e.delete==`number`?e.delete:typeof e.retain==`number`?e.retain:typeof e.retain==`object`&&e.retain!==null?1:typeof e.insert==`string`?e.insert.length:1}e.length=t})(t||={}),e.default=t})),dV=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=uV();e.default=class{constructor(e){this.ops=e,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(e){e||=1/0;let n=this.ops[this.index];if(n){let r=this.offset,i=t.default.length(n);if(e>=i-r?(e=i-r,this.index+=1,this.offset=0):this.offset+=e,typeof n.delete==`number`)return{delete:e};{let t={};return n.attributes&&(t.attributes=n.attributes),typeof n.retain==`number`?t.retain=e:typeof n.retain==`object`&&n.retain!==null?t.retain=n.retain:t.insert=typeof n.insert==`string`?n.insert.substr(r,e):n.insert,t}}return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?t.default.length(this.ops[this.index])-this.offset:1/0}peekType(){let e=this.ops[this.index];return e?typeof e.delete==`number`?`delete`:typeof e.retain==`number`||typeof e.retain==`object`&&e.retain!==null?`retain`:`insert`:`retain`}rest(){if(!this.hasNext())return[];if(this.offset===0)return this.ops.slice(this.index);{let e=this.offset,t=this.index,n=this.next(),r=this.ops.slice(this.index);return this.offset=e,this.index=t,[n].concat(r)}}}})),Z=t(n(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AttributeMap=e.OpIterator=e.Op=void 0;var n=oV(),r=sV(),i=cV(),a=lV();e.AttributeMap=a.default;var o=uV();e.Op=o.default;var s=dV();e.OpIterator=s.default;var c=`\0`,l=(e,t)=>{if(typeof e!=`object`||!e)throw Error(`cannot retain a ${typeof e}`);if(typeof t!=`object`||!t)throw Error(`cannot retain a ${typeof t}`);let n=Object.keys(e)[0];if(!n||n!==Object.keys(t)[0])throw Error(`embed types not matched: ${n} != ${Object.keys(t)[0]}`);return[n,e[n],t[n]]},u=class e{constructor(e){this.ops=Array.isArray(e)?e:e!=null&&Array.isArray(e.ops)?e.ops:[]}static registerEmbed(e,t){this.handlers[e]=t}static unregisterEmbed(e){delete this.handlers[e]}static getHandler(e){let t=this.handlers[e];if(!t)throw Error(`no handlers for embed type "${e}"`);return t}insert(e,t){let n={};return typeof e==`string`&&e.length===0?this:(n.insert=e,typeof t==`object`&&t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n))}delete(e){return e<=0?this:this.push({delete:e})}retain(e,t){if(typeof e==`number`&&e<=0)return this;let n={retain:e};return typeof t==`object`&&t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n)}push(e){let t=this.ops.length,n=this.ops[t-1];if(e=r(e),typeof n==`object`){if(typeof e.delete==`number`&&typeof n.delete==`number`)return this.ops[t-1]={delete:n.delete+e.delete},this;if(typeof n.delete==`number`&&e.insert!=null&&(--t,n=this.ops[t-1],typeof n!=`object`))return this.ops.unshift(e),this;if(i(e.attributes,n.attributes)){if(typeof e.insert==`string`&&typeof n.insert==`string`)return this.ops[t-1]={insert:n.insert+e.insert},typeof e.attributes==`object`&&(this.ops[t-1].attributes=e.attributes),this;if(typeof e.retain==`number`&&typeof n.retain==`number`)return this.ops[t-1]={retain:n.retain+e.retain},typeof e.attributes==`object`&&(this.ops[t-1].attributes=e.attributes),this}}return t===this.ops.length?this.ops.push(e):this.ops.splice(t,0,e),this}chop(){let e=this.ops[this.ops.length-1];return e&&typeof e.retain==`number`&&!e.attributes&&this.ops.pop(),this}filter(e){return this.ops.filter(e)}forEach(e){this.ops.forEach(e)}map(e){return this.ops.map(e)}partition(e){let t=[],n=[];return this.forEach(r=>{(e(r)?t:n).push(r)}),[t,n]}reduce(e,t){return this.ops.reduce(e,t)}changeLength(){return this.reduce((e,t)=>t.insert?e+o.default.length(t):t.delete?e-t.delete:e,0)}length(){return this.reduce((e,t)=>e+o.default.length(t),0)}slice(t=0,n=1/0){let r=[],i=new s.default(this.ops),a=0;for(;a<n&&i.hasNext();){let e;a<t?e=i.next(t-a):(e=i.next(n-a),r.push(e)),a+=o.default.length(e)}return new e(r)}compose(t){let n=new s.default(this.ops),r=new s.default(t.ops),o=[],c=r.peek();if(c!=null&&typeof c.retain==`number`&&c.attributes==null){let e=c.retain;for(;n.peekType()===`insert`&&n.peekLength()<=e;)e-=n.peekLength(),o.push(n.next());c.retain-e>0&&r.next(c.retain-e)}let u=new e(o);for(;n.hasNext()||r.hasNext();)if(r.peekType()===`insert`)u.push(r.next());else if(n.peekType()===`delete`)u.push(n.next());else{let t=Math.min(n.peekLength(),r.peekLength()),o=n.next(t),s=r.next(t);if(s.retain){let c={};if(typeof o.retain==`number`)c.retain=typeof s.retain==`number`?t:s.retain;else if(typeof s.retain==`number`)o.retain==null?c.insert=o.insert:c.retain=o.retain;else{let t=o.retain==null?`insert`:`retain`,[n,r,i]=l(o[t],s.retain),a=e.getHandler(n);c[t]={[n]:a.compose(r,i,t===`retain`)}}let d=a.default.compose(o.attributes,s.attributes,typeof o.retain==`number`);if(d&&(c.attributes=d),u.push(c),!r.hasNext()&&i(u.ops[u.ops.length-1],c)){let t=new e(n.rest());return u.concat(t).chop()}}else typeof s.delete==`number`&&(typeof o.retain==`number`||typeof o.retain==`object`&&o.retain!==null)&&u.push(s)}return u.chop()}concat(t){let n=new e(this.ops.slice());return t.ops.length>0&&(n.push(t.ops[0]),n.ops=n.ops.concat(t.ops.slice(1))),n}diff(t,r){if(this.ops===t.ops)return new e;let o=[this,t].map(e=>e.map(n=>{if(n.insert!=null)return typeof n.insert==`string`?n.insert:c;throw Error(`diff() called `+(e===t?`on`:`with`)+` non-document`)}).join(``)),l=new e,u=n(o[0],o[1],r,!0),d=new s.default(this.ops),f=new s.default(t.ops);return u.forEach(e=>{let t=e[1].length;for(;t>0;){let r=0;switch(e[0]){case n.INSERT:r=Math.min(f.peekLength(),t),l.push(f.next(r));break;case n.DELETE:r=Math.min(t,d.peekLength()),d.next(r),l.delete(r);break;case n.EQUAL:r=Math.min(d.peekLength(),f.peekLength(),t);let e=d.next(r),o=f.next(r);i(e.insert,o.insert)?l.retain(r,a.default.diff(e.attributes,o.attributes)):l.push(o).delete(r)}t-=r}}),l.chop()}eachLine(t,n=`
390
+ `){let r=new s.default(this.ops),i=new e,a=0;for(;r.hasNext();){if(r.peekType()!==`insert`)return;let s=r.peek(),c=o.default.length(s)-r.peekLength(),l=typeof s.insert==`string`?s.insert.indexOf(n,c)-c:-1;if(l<0)i.push(r.next());else if(l>0)i.push(r.next(l));else{if(t(i,r.next(1).attributes||{},a)===!1)return;a+=1,i=new e}}i.length()>0&&t(i,{},a)}invert(t){let n=new e;return this.reduce((r,i)=>{if(i.insert)n.delete(o.default.length(i));else if(typeof i.retain==`number`&&i.attributes==null)return n.retain(i.retain),r+i.retain;else if(i.delete||typeof i.retain==`number`){let e=i.delete||i.retain;return t.slice(r,r+e).forEach(e=>{i.delete?n.push(e):i.retain&&i.attributes&&n.retain(o.default.length(e),a.default.invert(i.attributes,e.attributes))}),r+e}else if(typeof i.retain==`object`&&i.retain!==null){let o=t.slice(r,r+1),c=new s.default(o.ops).next(),[u,d,f]=l(i.retain,c.insert),p=e.getHandler(u);return n.retain({[u]:p.invert(d,f)},a.default.invert(i.attributes,c.attributes)),r+1}return r},0),n.chop()}transform(t,n=!1){if(n=!!n,typeof t==`number`)return this.transformPosition(t,n);let r=t,i=new s.default(this.ops),c=new s.default(r.ops),l=new e;for(;i.hasNext()||c.hasNext();)if(i.peekType()===`insert`&&(n||c.peekType()!==`insert`))l.retain(o.default.length(i.next()));else if(c.peekType()===`insert`)l.push(c.next());else{let t=Math.min(i.peekLength(),c.peekLength()),r=i.next(t),o=c.next(t);if(r.delete)continue;if(o.delete)l.push(o);else{let i=r.retain,s=o.retain,c=typeof s==`object`&&s?s:t;if(typeof i==`object`&&i&&typeof s==`object`&&s){let t=Object.keys(i)[0];if(t===Object.keys(s)[0]){let r=e.getHandler(t);r&&(c={[t]:r.transform(i[t],s[t],n)})}}l.retain(c,a.default.transform(r.attributes,o.attributes,n))}}return l.chop()}transformPosition(e,t=!1){t=!!t;let n=new s.default(this.ops),r=0;for(;n.hasNext()&&r<=e;){let i=n.peekLength(),a=n.peekType();if(n.next(),a===`delete`){e-=Math.min(i,e-r);continue}a===`insert`&&(r<e||!t)&&(e+=i),r+=i}return e}};u.Op=o.default,u.OpIterator=s.default,u.AttributeMap=a.default,u.handlers={},e.default=u,typeof t==`object`&&(t.exports=u,t.exports.default=u)}))(),1),fV=class extends $B{static value(){}optimize(){(this.prev||this.next)&&this.remove()}length(){return 0}value(){return``}};fV.blotName=`break`,fV.tagName=`BR`;var pV=class extends aV{},mV={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`};function hV(e){return e.replace(/[&<>"']/g,e=>mV[e])}var gV=class e extends JB{static allowedChildren=[e,fV,$B,pV];static order=[`cursor`,`inline`,`link`,`underline`,`strike`,`italic`,`bold`,`script`,`code`];static compare(t,n){let r=e.order.indexOf(t),i=e.order.indexOf(n);return r>=0||i>=0?r-i:t===n?0:t<n?-1:1}formatAt(t,n,r,i){if(e.compare(this.statics.blotName,r)<0&&this.scroll.query(r,X.BLOT)){let e=this.isolate(t,n);i&&e.wrap(r,i)}else super.formatAt(t,n,r,i)}optimize(t){if(super.optimize(t),this.parent instanceof e&&e.compare(this.statics.blotName,this.parent.statics.blotName)>0){let e=this.parent.isolate(this.offset(),this.length());this.moveChildren(e),e.wrap(this)}}},_V=1,vV=class extends XB{cache={};delta(){return this.cache.delta??(this.cache.delta=bV(this)),this.cache.delta}deleteAt(e,t){super.deleteAt(e,t),this.cache={}}formatAt(e,t,n,r){t<=0||(this.scroll.query(n,X.BLOCK)?e+t===this.length()&&this.format(n,r):super.formatAt(e,Math.min(t,this.length()-e-1),n,r),this.cache={})}insertAt(e,t,n){if(n!=null){super.insertAt(e,t,n),this.cache={};return}if(t.length===0)return;let r=t.split(`
391
+ `),i=r.shift();i.length>0&&(e<this.length()-1||this.children.tail==null?super.insertAt(Math.min(e,this.length()-1),i):this.children.tail.insertAt(this.children.tail.length(),i),this.cache={});let a=this;r.reduce((e,t)=>(a=a.split(e,!0),a.insertAt(0,t),t.length),e+i.length)}insertBefore(e,t){let{head:n}=this.children;super.insertBefore(e,t),n instanceof fV&&n.remove(),this.cache={}}length(){return this.cache.length??(this.cache.length=super.length()+_V),this.cache.length}moveChildren(e,t){super.moveChildren(e,t),this.cache={}}optimize(e){super.optimize(e),this.cache={}}path(e){return super.path(e,!0)}removeChild(e){super.removeChild(e),this.cache={}}split(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(t&&(e===0||e>=this.length()-_V)){let t=this.clone();return e===0?(this.parent.insertBefore(t,this),this):(this.parent.insertBefore(t,this.next),t)}let n=super.split(e,t);return this.cache={},n}};vV.blotName=`block`,vV.tagName=`P`,vV.defaultChild=fV,vV.allowedChildren=[fV,gV,$B,pV];var yV=class extends $B{attach(){super.attach(),this.attributes=new LB(this.domNode)}delta(){return new Z.default().insert(this.value(),{...this.formats(),...this.attributes.values()})}format(e,t){let n=this.scroll.query(e,X.BLOCK_ATTRIBUTE);n!=null&&this.attributes.attribute(n,t)}formatAt(e,t,n,r){this.format(n,r)}insertAt(e,t,n){if(n!=null){super.insertAt(e,t,n);return}let r=t.split(`
392
+ `),i=r.pop(),a=r.map(e=>{let t=this.scroll.create(vV.blotName);return t.insertAt(0,e),t}),o=this.split(e);a.forEach(e=>{this.parent.insertBefore(e,o)}),i&&this.parent.insertBefore(this.scroll.create(`text`,i),o)}};yV.scope=X.BLOCK_BLOT;function bV(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return e.descendants(VB).reduce((e,n)=>n.length()===0?e:e.insert(n.value(),xV(n,{},t)),new Z.default).insert(`
393
+ `,xV(e))}function xV(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e==null||(`formats`in e&&typeof e.formats==`function`&&(t={...t,...e.formats()},n&&delete t[`code-token`]),e.parent==null||e.parent.statics.blotName===`scroll`||e.parent.statics.scope!==e.statics.scope)?t:xV(e.parent,t,n)}var SV=class e extends $B{static blotName=`cursor`;static className=`ql-cursor`;static tagName=`span`;static CONTENTS=``;static value(){}constructor(t,n,r){super(t,n),this.selection=r,this.textNode=document.createTextNode(e.CONTENTS),this.domNode.appendChild(this.textNode),this.savedLength=0}detach(){this.parent!=null&&this.parent.removeChild(this)}format(t,n){if(this.savedLength!==0){super.format(t,n);return}let r=this,i=0;for(;r!=null&&r.statics.scope!==X.BLOCK_BLOT;)i+=r.offset(r.parent),r=r.parent;r!=null&&(this.savedLength=e.CONTENTS.length,r.optimize(),r.formatAt(i,e.CONTENTS.length,t,n),this.savedLength=0)}index(e,t){return e===this.textNode?0:super.index(e,t)}length(){return this.savedLength}position(){return[this.textNode,this.textNode.data.length]}remove(){super.remove(),this.parent=null}restore(){if(this.selection.composing||this.parent==null)return null;let t=this.selection.getNativeRange();for(;this.domNode.lastChild!=null&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);let n=this.prev instanceof pV?this.prev:null,r=n?n.length():0,i=this.next instanceof pV?this.next:null,a=i?i.text:``,{textNode:o}=this,s=o.data.split(e.CONTENTS).join(``);o.data=e.CONTENTS;let c;if(n)c=n,(s||i)&&(n.insertAt(n.length(),s+a),i&&i.remove());else if(i)c=i,i.insertAt(0,s);else{let e=document.createTextNode(s);c=this.scroll.create(e),this.parent.insertBefore(c,this)}if(this.remove(),t){let e=(e,t)=>n&&e===n.domNode?t:e===o?r+t-1:i&&e===i.domNode?r+s.length+t:null,a=e(t.start.node,t.start.offset),l=e(t.end.node,t.end.offset);if(a!==null&&l!==null)return{startNode:c.domNode,startOffset:a,endNode:c.domNode,endOffset:l}}return null}update(e,t){if(e.some(e=>e.type===`characterData`&&e.target===this.textNode)){let e=this.restore();e&&(t.range=e)}}optimize(t){super.optimize(t);let{parent:n}=this;for(;n;){if(n.domNode.tagName===`A`){this.savedLength=e.CONTENTS.length,n.isolate(this.offset(n),this.length()).unwrap(),this.savedLength=0;break}n=n.parent}}value(){return``}},CV=t(n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))(),1),wV=new WeakMap,TV=[`error`,`warn`,`log`,`info`],EV=`warn`;function DV(e){if(EV&&TV.indexOf(e)<=TV.indexOf(EV)){var t=[...arguments].slice(1);console[e](...t)}}function OV(e){return TV.reduce((t,n)=>(t[n]=DV.bind(console,n,e),t),{})}OV.level=e=>{EV=e},DV.level=OV.level;var kV=OV(`quill:events`);[`selectionchange`,`mousedown`,`mouseup`,`click`].forEach(e=>{document.addEventListener(e,function(){var e=[...arguments];Array.from(document.querySelectorAll(`.ql-container`)).forEach(t=>{let n=wV.get(t);n&&n.emitter&&n.emitter.handleDOM(...e)})})});var Q=class extends CV.default{static events={EDITOR_CHANGE:`editor-change`,SCROLL_BEFORE_UPDATE:`scroll-before-update`,SCROLL_BLOT_MOUNT:`scroll-blot-mount`,SCROLL_BLOT_UNMOUNT:`scroll-blot-unmount`,SCROLL_OPTIMIZE:`scroll-optimize`,SCROLL_UPDATE:`scroll-update`,SCROLL_EMBED_UPDATE:`scroll-embed-update`,SELECTION_CHANGE:`selection-change`,TEXT_CHANGE:`text-change`,COMPOSITION_BEFORE_START:`composition-before-start`,COMPOSITION_START:`composition-start`,COMPOSITION_BEFORE_END:`composition-before-end`,COMPOSITION_END:`composition-end`};static sources={API:`api`,SILENT:`silent`,USER:`user`};constructor(){super(),this.domListeners={},this.on(`error`,kV.error)}emit(){var e=[...arguments];return kV.log.call(kV,...e),super.emit(...e)}handleDOM(e){var t=[...arguments].slice(1);(this.domListeners[e.type]||[]).forEach(n=>{let{node:r,handler:i}=n;(e.target===r||r.contains(e.target))&&i(e,...t)})}listenDOM(e,t,n){this.domListeners[e]||(this.domListeners[e]=[]),this.domListeners[e].push({node:t,handler:n})}},AV=OV(`quill:selection`),jV=class{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;this.index=e,this.length=t}},MV=class{constructor(e,t){this.emitter=t,this.scroll=e,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=this.scroll.create(`cursor`,this),this.savedRange=new jV(0,0),this.lastRange=this.savedRange,this.lastNative=null,this.handleComposition(),this.handleDragging(),this.emitter.listenDOM(`selectionchange`,document,()=>{!this.mouseDown&&!this.composing&&setTimeout(this.update.bind(this,Q.sources.USER),1)}),this.emitter.on(Q.events.SCROLL_BEFORE_UPDATE,()=>{if(!this.hasFocus())return;let e=this.getNativeRange();e!=null&&e.start.node!==this.cursor.textNode&&this.emitter.once(Q.events.SCROLL_UPDATE,(t,n)=>{try{this.root.contains(e.start.node)&&this.root.contains(e.end.node)&&this.setNativeRange(e.start.node,e.start.offset,e.end.node,e.end.offset);let r=n.some(e=>e.type===`characterData`||e.type===`childList`||e.type===`attributes`&&e.target===this.root);this.update(r?Q.sources.SILENT:t)}catch{}})}),this.emitter.on(Q.events.SCROLL_OPTIMIZE,(e,t)=>{if(t.range){let{startNode:e,startOffset:n,endNode:r,endOffset:i}=t.range;this.setNativeRange(e,n,r,i),this.update(Q.sources.SILENT)}}),this.update(Q.sources.SILENT)}handleComposition(){this.emitter.on(Q.events.COMPOSITION_BEFORE_START,()=>{this.composing=!0}),this.emitter.on(Q.events.COMPOSITION_END,()=>{if(this.composing=!1,this.cursor.parent){let e=this.cursor.restore();if(!e)return;setTimeout(()=>{this.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)},1)}})}handleDragging(){this.emitter.listenDOM(`mousedown`,document.body,()=>{this.mouseDown=!0}),this.emitter.listenDOM(`mouseup`,document.body,()=>{this.mouseDown=!1,this.update(Q.sources.USER)})}focus(){this.hasFocus()||(this.root.focus({preventScroll:!0}),this.setRange(this.savedRange))}format(e,t){this.scroll.update();let n=this.getNativeRange();if(!(n==null||!n.native.collapsed||this.scroll.query(e,X.BLOCK))){if(n.start.node!==this.cursor.textNode){let e=this.scroll.find(n.start.node,!1);if(e==null)return;if(e instanceof VB){let t=e.split(n.start.offset);e.parent.insertBefore(this.cursor,t)}else e.insertBefore(this.cursor,n.start.node);this.cursor.attach()}this.cursor.format(e,t),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}getBounds(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=this.scroll.length();e=Math.min(e,n-1),t=Math.min(e+t,n-1)-e;let r,[i,a]=this.scroll.leaf(e);if(i==null)return null;if(t>0&&a===i.length()){let[t]=this.scroll.leaf(e+1);if(t){let[n]=this.scroll.line(e),[r]=this.scroll.line(e+1);n===r&&(i=t,a=0)}}[r,a]=i.position(a,!0);let o=document.createRange();if(t>0)return o.setStart(r,a),[i,a]=this.scroll.leaf(e+t),i==null?null:([r,a]=i.position(a,!0),o.setEnd(r,a),o.getBoundingClientRect());let s=`left`,c;if(r instanceof Text){if(!r.data.length)return null;a<r.data.length?(o.setStart(r,a),o.setEnd(r,a+1)):(o.setStart(r,a-1),o.setEnd(r,a),s=`right`),c=o.getBoundingClientRect()}else{if(!(i.domNode instanceof Element))return null;c=i.domNode.getBoundingClientRect(),a>0&&(s=`right`)}return{bottom:c.top+c.height,height:c.height,left:c[s],right:c[s],top:c.top,width:0}}getNativeRange(){let e=document.getSelection();if(e==null||e.rangeCount<=0)return null;let t=e.getRangeAt(0);if(t==null)return null;let n=this.normalizeNative(t);return AV.info(`getNativeRange`,n),n}getRange(){let e=this.scroll.domNode;if(`isConnected`in e&&!e.isConnected)return[null,null];let t=this.getNativeRange();return t==null?[null,null]:[this.normalizedToRange(t),t]}hasFocus(){return document.activeElement===this.root||document.activeElement!=null&&NV(this.root,document.activeElement)}normalizedToRange(e){let t=[[e.start.node,e.start.offset]];e.native.collapsed||t.push([e.end.node,e.end.offset]);let n=t.map(e=>{let[t,n]=e,r=this.scroll.find(t,!0),i=r.offset(this.scroll);return n===0?i:r instanceof VB?i+r.index(t,n):i+r.length()}),r=Math.min(Math.max(...n),this.scroll.length()-1),i=Math.min(r,...n);return new jV(i,r-i)}normalizeNative(e){if(!NV(this.root,e.startContainer)||!e.collapsed&&!NV(this.root,e.endContainer))return null;let t={start:{node:e.startContainer,offset:e.startOffset},end:{node:e.endContainer,offset:e.endOffset},native:e};return[t.start,t.end].forEach(e=>{let{node:t,offset:n}=e;for(;!(t instanceof Text)&&t.childNodes.length>0;)if(t.childNodes.length>n)t=t.childNodes[n],n=0;else if(t.childNodes.length===n)t=t.lastChild,n=t instanceof Text?t.data.length:t.childNodes.length>0?t.childNodes.length:t.childNodes.length+1;else break;e.node=t,e.offset=n}),t}rangeToNative(e){let t=this.scroll.length(),n=(e,n)=>{e=Math.min(t-1,e);let[r,i]=this.scroll.leaf(e);return r?r.position(i,n):[null,-1]};return[...n(e.index,!1),...n(e.index+e.length,!0)]}setNativeRange(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:t,i=arguments.length>4&&arguments[4]!==void 0&&arguments[4];if(AV.info(`setNativeRange`,e,t,n,r),e!=null&&(this.root.parentNode==null||e.parentNode==null||n.parentNode==null))return;let a=document.getSelection();if(a!=null){if(e!=null){this.hasFocus()||this.root.focus({preventScroll:!0});let{native:o}=this.getNativeRange()||{};if(o==null||i||e!==o.startContainer||t!==o.startOffset||n!==o.endContainer||r!==o.endOffset){e instanceof Element&&e.tagName===`BR`&&(t=Array.from(e.parentNode.childNodes).indexOf(e),e=e.parentNode),n instanceof Element&&n.tagName===`BR`&&(r=Array.from(n.parentNode.childNodes).indexOf(n),n=n.parentNode);let i=document.createRange();i.setStart(e,t),i.setEnd(n,r),a.removeAllRanges(),a.addRange(i)}}else a.removeAllRanges(),this.root.blur()}}setRange(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Q.sources.API;if(typeof t==`string`&&(n=t,t=!1),AV.info(`setRange`,e),e!=null){let n=this.rangeToNative(e);this.setNativeRange(...n,t)}else this.setNativeRange(null);this.update(n)}update(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Q.sources.USER,t=this.lastRange,[n,r]=this.getRange();if(this.lastRange=n,this.lastNative=r,this.lastRange!=null&&(this.savedRange=this.lastRange),!EB(t,this.lastRange)){if(!this.composing&&r!=null&&r.native.collapsed&&r.start.node!==this.cursor.textNode){let e=this.cursor.restore();e&&this.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)}let n=[Q.events.SELECTION_CHANGE,Pz(this.lastRange),Pz(t),e];this.emitter.emit(Q.events.EDITOR_CHANGE,...n),e!==Q.sources.SILENT&&this.emitter.emit(...n)}}};function NV(e,t){try{t.parentNode}catch{return!1}return e.contains(t)}var PV=/^[ -~]*$/,FV=class{constructor(e){this.scroll=e,this.delta=this.getDelta()}applyDelta(e){this.scroll.update();let t=this.scroll.length();this.scroll.batchStart();let n=BV(e),r=new Z.default;return HV(n.ops.slice()).reduce((e,n)=>{let i=Z.Op.length(n),a=n.attributes||{},o=!1,s=!1;if(n.insert!=null){if(r.retain(i),typeof n.insert==`string`){let r=n.insert;s=!r.endsWith(`
394
+ `)&&(t<=e||!!this.scroll.descendant(yV,e)[0]),this.scroll.insertAt(e,r);let[i,o]=this.scroll.line(e),c=DB({},xV(i));if(i instanceof vV){let[e]=i.descendant(VB,o);e&&(c=DB(c,xV(e)))}a=Z.AttributeMap.diff(c,a)||{}}else if(typeof n.insert==`object`){let r=Object.keys(n.insert)[0];if(r==null)return e;let i=this.scroll.query(r,X.INLINE)!=null;if(i)(t<=e||this.scroll.descendant(yV,e)[0])&&(s=!0);else if(e>0){let[t,n]=this.scroll.descendant(VB,e-1);t instanceof pV?t.value()[n]!==`
395
+ `&&(o=!0):t instanceof $B&&t.statics.scope===X.INLINE_BLOT&&(o=!0)}if(this.scroll.insertAt(e,r,n.insert[r]),i){let[t]=this.scroll.descendant(VB,e);if(t){let e=DB({},xV(t));a=Z.AttributeMap.diff(e,a)||{}}}}t+=i}else if(r.push(n),n.retain!==null&&typeof n.retain==`object`){let t=Object.keys(n.retain)[0];if(t==null)return e;this.scroll.updateEmbedAt(e,t,n.retain[t])}Object.keys(a).forEach(t=>{this.scroll.formatAt(e,i,t,a[t])});let c=+!!o,l=+!!s;return t+=c+l,r.retain(c),r.delete(l),e+i+c+l},0),r.reduce((e,t)=>typeof t.delete==`number`?(this.scroll.deleteAt(e,t.delete),e):e+Z.Op.length(t),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(n)}deleteText(e,t){return this.scroll.deleteAt(e,t),this.update(new Z.default().retain(e).delete(t))}formatLine(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.scroll.update(),Object.keys(n).forEach(r=>{this.scroll.lines(e,Math.max(t,1)).forEach(e=>{e.format(r,n[r])})}),this.scroll.optimize();let r=new Z.default().retain(e).retain(t,Pz(n));return this.update(r)}formatText(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.keys(n).forEach(r=>{this.scroll.formatAt(e,t,r,n[r])});let r=new Z.default().retain(e).retain(t,Pz(n));return this.update(r)}getContents(e,t){return this.delta.slice(e,e+t)}getDelta(){return this.scroll.lines().reduce((e,t)=>e.concat(t.delta()),new Z.default)}getFormat(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=[],r=[];t===0?this.scroll.path(e).forEach(e=>{let[t]=e;t instanceof vV?n.push(t):t instanceof VB&&r.push(t)}):(n=this.scroll.lines(e,t),r=this.scroll.descendants(VB,e,t));let[i,a]=[n,r].map(e=>{let t=e.shift();if(t==null)return{};let n=xV(t);for(;Object.keys(n).length>0;){let t=e.shift();if(t==null)return n;n=RV(xV(t),n)}return n});return{...i,...a}}getHTML(e,t){let[n,r]=this.scroll.line(e);if(n){let i=n.length();return n.length()>=r+t&&(r!==0||t!==i)?LV(n,r,t,!0):LV(this.scroll,e,t,!0)}return``}getText(e,t){return this.getContents(e,t).filter(e=>typeof e.insert==`string`).map(e=>e.insert).join(``)}insertContents(e,t){let n=BV(t),r=new Z.default().retain(e).concat(n);return this.scroll.insertContents(e,n),this.update(r)}insertEmbed(e,t,n){return this.scroll.insertAt(e,t,n),this.update(new Z.default().retain(e).insert({[t]:n}))}insertText(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return t=t.replace(/\r\n/g,`
396
+ `).replace(/\r/g,`
397
+ `),this.scroll.insertAt(e,t),Object.keys(n).forEach(r=>{this.scroll.formatAt(e,t.length,r,n[r])}),this.update(new Z.default().retain(e).insert(t,Pz(n)))}isBlank(){if(this.scroll.children.length===0)return!0;if(this.scroll.children.length>1)return!1;let e=this.scroll.children.head;if(e?.statics.blotName!==vV.blotName)return!1;let t=e;return t.children.length>1?!1:t.children.head instanceof fV}removeFormat(e,t){let n=this.getText(e,t),[r,i]=this.scroll.line(e+t),a=0,o=new Z.default;r!=null&&(a=r.length()-i,o=r.delta().slice(i,i+a-1).insert(`
398
+ `));let s=this.getContents(e,t+a).diff(new Z.default().insert(n).concat(o)),c=new Z.default().retain(e).concat(s);return this.applyDelta(c)}update(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,r=this.delta;if(t.length===1&&t[0].type===`characterData`&&t[0].target.data.match(PV)&&this.scroll.find(t[0].target)){let i=this.scroll.find(t[0].target),a=xV(i),o=i.offset(this.scroll),s=t[0].oldValue.replace(SV.CONTENTS,``),c=new Z.default().insert(s),l=new Z.default().insert(i.value()),u=n&&{oldRange:VV(n.oldRange,-o),newRange:VV(n.newRange,-o)};e=new Z.default().retain(o).concat(c.diff(l,u)).reduce((e,t)=>t.insert?e.insert(t.insert,a):e.push(t),new Z.default),this.delta=r.compose(e)}else this.delta=this.getDelta(),(!e||!EB(r.compose(e),this.delta))&&(e=r.diff(this.delta,n));return e}};function IV(e,t,n){if(e.length===0){let[e]=zV(n.pop());return t<=0?`</li></${e}>`:`</li></${e}>${IV([],t-1,n)}`}let[{child:r,offset:i,length:a,indent:o,type:s},...c]=e,[l,u]=zV(s);if(o>t)return n.push(s),o===t+1?`<${l}><li${u}>${LV(r,i,a)}${IV(c,o,n)}`:`<${l}><li>${IV(e,t+1,n)}`;let d=n[n.length-1];if(o===t&&s===d)return`</li><li${u}>${LV(r,i,a)}${IV(c,o,n)}`;let[f]=zV(n.pop());return`</li></${f}>${IV(e,t-1,n)}`}function LV(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(`html`in e&&typeof e.html==`function`)return e.html(t,n);if(e instanceof pV)return hV(e.value().slice(t,t+n)).replaceAll(` `,`&nbsp;`);if(e instanceof GB){if(e.statics.blotName===`list-container`){let r=[];return e.children.forEachAt(t,n,(e,t,n)=>{let i=`formats`in e&&typeof e.formats==`function`?e.formats():{};r.push({child:e,offset:t,length:n,indent:i.indent||0,type:i.list})}),IV(r,-1,[])}let i=[];if(e.children.forEachAt(t,n,(e,t,n)=>{i.push(LV(e,t,n))}),r||e.statics.blotName===`list`)return i.join(``);let{outerHTML:a,innerHTML:o}=e.domNode,[s,c]=a.split(`>${o}<`);return s===`<table`?`<table style="border: 1px solid #000;">${i.join(``)}<${c}`:`${s}>${i.join(``)}<${c}`}return e.domNode instanceof Element?e.domNode.outerHTML:``}function RV(e,t){return Object.keys(t).reduce((n,r)=>{if(e[r]==null)return n;let i=t[r];return n[r]=i===e[r]?i:Array.isArray(i)?i.indexOf(e[r])<0?i.concat([e[r]]):i:[i,e[r]],n},{})}function zV(e){let t=e===`ordered`?`ol`:`ul`;switch(e){case`checked`:return[t,` data-list="checked"`];case`unchecked`:return[t,` data-list="unchecked"`];default:return[t,``]}}function BV(e){return e.reduce((e,t)=>{if(typeof t.insert==`string`){let n=t.insert.replace(/\r\n/g,`
399
+ `).replace(/\r/g,`
400
+ `);return e.insert(n,t.attributes)}return e.push(t)},new Z.default)}function VV(e,t){let{index:n,length:r}=e;return new jV(n+t,r)}function HV(e){let t=[];return e.forEach(e=>{typeof e.insert==`string`?e.insert.split(`
401
+ `).forEach((n,r)=>{r&&t.push({insert:`
402
+ `,attributes:e.attributes}),n&&t.push({insert:n,attributes:e.attributes})}):t.push(e)}),t}var UV=class{static DEFAULTS={};constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.quill=e,this.options=t}},WV=``,GV=class extends $B{constructor(e,t){super(e,t),this.contentNode=document.createElement(`span`),this.contentNode.setAttribute(`contenteditable`,`false`),Array.from(this.domNode.childNodes).forEach(e=>{this.contentNode.appendChild(e)}),this.leftGuard=document.createTextNode(WV),this.rightGuard=document.createTextNode(WV),this.domNode.appendChild(this.leftGuard),this.domNode.appendChild(this.contentNode),this.domNode.appendChild(this.rightGuard)}index(e,t){return e===this.leftGuard?0:e===this.rightGuard?1:super.index(e,t)}restore(e){let t=null,n,r=e.data.split(WV).join(``);if(e===this.leftGuard){if(this.prev instanceof pV){let e=this.prev.length();this.prev.insertAt(e,r),t={startNode:this.prev.domNode,startOffset:e+r.length}}else n=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(n),this),t={startNode:n,startOffset:r.length}}else e===this.rightGuard&&(this.next instanceof pV?(this.next.insertAt(0,r),t={startNode:this.next.domNode,startOffset:r.length}):(n=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(n),this.next),t={startNode:n,startOffset:r.length}));return e.data=WV,t}update(e,t){e.forEach(e=>{if(e.type===`characterData`&&(e.target===this.leftGuard||e.target===this.rightGuard)){let n=this.restore(e.target);n&&(t.range=n)}})}},KV=class{isComposing=!1;constructor(e,t){this.scroll=e,this.emitter=t,this.setupListeners()}setupListeners(){this.scroll.domNode.addEventListener(`compositionstart`,e=>{this.isComposing||this.handleCompositionStart(e)}),this.scroll.domNode.addEventListener(`compositionend`,e=>{this.isComposing&&queueMicrotask(()=>{this.handleCompositionEnd(e)})})}handleCompositionStart(e){let t=e.target instanceof Node?this.scroll.find(e.target,!0):null;t&&!(t instanceof GV)&&(this.emitter.emit(Q.events.COMPOSITION_BEFORE_START,e),this.scroll.batchStart(),this.emitter.emit(Q.events.COMPOSITION_START,e),this.isComposing=!0)}handleCompositionEnd(e){this.emitter.emit(Q.events.COMPOSITION_BEFORE_END,e),this.scroll.batchEnd(),this.emitter.emit(Q.events.COMPOSITION_END,e),this.isComposing=!1}},qV=class e{static DEFAULTS={modules:{}};static themes={default:e};modules={};constructor(e,t){this.quill=e,this.options=t}init(){Object.keys(this.options.modules).forEach(e=>{this.modules[e]??this.addModule(e)})}addModule(e){let t=this.quill.constructor.import(`modules/${e}`);return this.modules[e]=new t(this.quill,this.options.modules[e]||{}),this.modules[e]}},JV=e=>e.parentElement||e.getRootNode().host||null,YV=e=>{let t=e.getBoundingClientRect(),n=`offsetWidth`in e&&Math.abs(t.width)/e.offsetWidth||1,r=`offsetHeight`in e&&Math.abs(t.height)/e.offsetHeight||1;return{top:t.top,right:t.left+e.clientWidth*n,bottom:t.top+e.clientHeight*r,left:t.left}},XV=e=>{let t=parseInt(e,10);return Number.isNaN(t)?0:t},ZV=(e,t,n,r,i,a)=>e<n&&t>r?0:e<n?-(n-e+i):t>r?t-e>r-n?e+i-n:t-r+a:0,QV=(e,t)=>{let n=e.ownerDocument,r=t,i=e;for(;i;){let e=i===n.body,t=e?{top:0,right:window.visualViewport?.width??n.documentElement.clientWidth,bottom:window.visualViewport?.height??n.documentElement.clientHeight,left:0}:YV(i),a=getComputedStyle(i),o=ZV(r.left,r.right,t.left,t.right,XV(a.scrollPaddingLeft),XV(a.scrollPaddingRight)),s=ZV(r.top,r.bottom,t.top,t.bottom,XV(a.scrollPaddingTop),XV(a.scrollPaddingBottom));if(o||s){if(e)n.defaultView?.scrollBy(o,s);else{let{scrollLeft:e,scrollTop:t}=i;s&&(i.scrollTop+=s),o&&(i.scrollLeft+=o);let n=i.scrollLeft-e,a=i.scrollTop-t;r={left:r.left-n,top:r.top-a,right:r.right-n,bottom:r.bottom-a}}}i=e||a.position===`fixed`?null:JV(i)}},$V=100,eH=[`block`,`break`,`cursor`,`inline`,`scroll`,`text`],tH=(e,t,n)=>{let r=new MB;return eH.forEach(e=>{let n=t.query(e);n&&r.register(n)}),e.forEach(e=>{let i=t.query(e);i||n.error(`Cannot register "${e}" specified in "formats" config. Are you sure it was registered?`);let a=0;for(;i;)if(r.register(i),i=`blotName`in i?i.requiredContainer??null:null,a+=1,a>$V){n.error(`Cycle detected in registering blot requiredContainer: "${e}"`);break}}),r},nH=OV(`quill`),rH=new MB;GB.uiClass=`ql-ui`;var $=class e{static DEFAULTS={bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:``,readOnly:!1,registry:rH,theme:`default`};static events=Q.events;static sources=Q.sources;static version=`2.0.3`;static imports={delta:Z.default,parchment:OB,"core/module":UV,"core/theme":qV};static debug(e){e===!0&&(e=`log`),OV.level(e)}static find(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return wV.get(e)||rH.find(e,t)}static import(e){return this.imports[e]??nH.error(`Cannot import ${e}. Are you sure it was registered?`),this.imports[e]}static register(){if(typeof(arguments.length<=0?void 0:arguments[0])!=`string`){let e=arguments.length<=0?void 0:arguments[0],t=!!(!(arguments.length<=1)&&arguments[1]),n=`attrName`in e?e.attrName:e.blotName;typeof n==`string`?this.register(`formats/${n}`,e,t):Object.keys(e).forEach(n=>{this.register(n,e[n],t)})}else{let e=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1],n=!!(!(arguments.length<=2)&&arguments[2]);this.imports[e]!=null&&!n&&nH.warn(`Overwriting ${e} with`,t),this.imports[e]=t,(e.startsWith(`blots/`)||e.startsWith(`formats/`))&&t&&typeof t!=`boolean`&&t.blotName!==`abstract`&&rH.register(t),typeof t.register==`function`&&t.register(rH)}}constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.options=sH(t,n),this.container=this.options.container,this.container==null){nH.error(`Invalid Quill container`,t);return}this.options.debug&&e.debug(this.options.debug);let r=this.container.innerHTML.trim();this.container.classList.add(`ql-container`),this.container.innerHTML=``,wV.set(this.container,this),this.root=this.addContainer(`ql-editor`),this.root.classList.add(`ql-blank`),this.emitter=new Q;let i=rV.blotName,a=this.options.registry.query(i);if(!a||!(`blotName`in a))throw Error(`Cannot initialize Quill without "${i}" blot`);if(this.scroll=new a(this.options.registry,this.root,{emitter:this.emitter}),this.editor=new FV(this.scroll),this.selection=new MV(this.scroll,this.emitter),this.composition=new KV(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule(`keyboard`),this.clipboard=this.theme.addModule(`clipboard`),this.history=this.theme.addModule(`history`),this.uploader=this.theme.addModule(`uploader`),this.theme.addModule(`input`),this.theme.addModule(`uiNode`),this.theme.init(),this.emitter.on(Q.events.EDITOR_CHANGE,e=>{e===Q.events.TEXT_CHANGE&&this.root.classList.toggle(`ql-blank`,this.editor.isBlank())}),this.emitter.on(Q.events.SCROLL_UPDATE,(e,t)=>{let n=this.selection.lastRange,[r]=this.selection.getRange(),i=n&&r?{oldRange:n,newRange:r}:void 0;cH.call(this,()=>this.editor.update(null,t,i),e)}),this.emitter.on(Q.events.SCROLL_EMBED_UPDATE,(t,n)=>{let r=this.selection.lastRange,[i]=this.selection.getRange(),a=r&&i?{oldRange:r,newRange:i}:void 0;cH.call(this,()=>{let e=new Z.default().retain(t.offset(this)).retain({[t.statics.blotName]:n});return this.editor.update(e,[],a)},e.sources.USER)}),r){let e=this.clipboard.convert({html:`${r}<p><br></p>`,text:`
403
+ `});this.setContents(e)}this.history.clear(),this.options.placeholder&&this.root.setAttribute(`data-placeholder`,this.options.placeholder),this.options.readOnly&&this.disable(),this.allowReadOnlyEdits=!1}addContainer(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(typeof e==`string`){let t=e;e=document.createElement(`div`),e.classList.add(t)}return this.container.insertBefore(e,t),e}blur(){this.selection.setRange(null)}deleteText(e,t,n){return[e,t,,n]=lH(e,t,n),cH.call(this,()=>this.editor.deleteText(e,t),n,e,-1*t)}disable(){this.enable(!1)}editReadOnly(e){this.allowReadOnlyEdits=!0;let t=e();return this.allowReadOnlyEdits=!1,t}enable(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.scroll.enable(e),this.container.classList.toggle(`ql-disabled`,!e)}focus(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.selection.focus(),e.preventScroll||this.scrollSelectionIntoView()}format(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Q.sources.API;return cH.call(this,()=>{let n=this.getSelection(!0),r=new Z.default;if(n==null)return r;if(this.scroll.query(e,X.BLOCK))r=this.editor.formatLine(n.index,n.length,{[e]:t});else if(n.length===0)return this.selection.format(e,t),r;else r=this.editor.formatText(n.index,n.length,{[e]:t});return this.setSelection(n,Q.sources.SILENT),r},n)}formatLine(e,t,n,r,i){let a;return[e,t,a,i]=lH(e,t,n,r,i),cH.call(this,()=>this.editor.formatLine(e,t,a),i,e,0)}formatText(e,t,n,r,i){let a;return[e,t,a,i]=lH(e,t,n,r,i),cH.call(this,()=>this.editor.formatText(e,t,a),i,e,0)}getBounds(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=null;if(n=typeof e==`number`?this.selection.getBounds(e,t):this.selection.getBounds(e.index,e.length),!n)return null;let r=this.container.getBoundingClientRect();return{bottom:n.bottom-r.top,height:n.height,left:n.left-r.left,right:n.right-r.left,top:n.top-r.top,width:n.width}}getContents(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-e;return[e,t]=lH(e,t),this.editor.getContents(e,t)}getFormat(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.getSelection(!0),t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof e==`number`?this.editor.getFormat(e,t):this.editor.getFormat(e.index,e.length)}getIndex(e){return e.offset(this.scroll)}getLength(){return this.scroll.length()}getLeaf(e){return this.scroll.leaf(e)}getLine(e){return this.scroll.line(e)}getLines(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE;return typeof e==`number`?this.scroll.lines(e,t):this.scroll.lines(e.index,e.length)}getModule(e){return this.theme.modules[e]}getSelection(){return arguments.length>0&&arguments[0]!==void 0&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}getSemanticHTML(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;return typeof e==`number`&&(t??=this.getLength()-e),[e,t]=lH(e,t),this.editor.getHTML(e,t)}getText(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;return typeof e==`number`&&(t??=this.getLength()-e),[e,t]=lH(e,t),this.editor.getText(e,t)}hasFocus(){return this.selection.hasFocus()}insertEmbed(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:e.sources.API;return cH.call(this,()=>this.editor.insertEmbed(t,n,r),i,t)}insertText(e,t,n,r,i){let a;return[e,,a,i]=lH(e,0,n,r,i),cH.call(this,()=>this.editor.insertText(e,t,a),i,e,t.length)}isEnabled(){return this.scroll.isEnabled()}off(){return this.emitter.off(...arguments)}on(){return this.emitter.on(...arguments)}once(){return this.emitter.once(...arguments)}removeFormat(e,t,n){return[e,t,,n]=lH(e,t,n),cH.call(this,()=>this.editor.removeFormat(e,t),n,e)}scrollRectIntoView(e){QV(this.root,e)}scrollIntoView(){console.warn(`Quill#scrollIntoView() has been deprecated and will be removed in the near future. Please use Quill#scrollSelectionIntoView() instead.`),this.scrollSelectionIntoView()}scrollSelectionIntoView(){let e=this.selection.lastRange,t=e&&this.selection.getBounds(e.index,e.length);t&&this.scrollRectIntoView(t)}setContents(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Q.sources.API;return cH.call(this,()=>{e=new Z.default(e);let t=this.getLength(),n=this.editor.deleteText(0,t),r=this.editor.insertContents(0,e),i=this.editor.deleteText(this.getLength()-1,1);return n.compose(r).compose(i)},t)}setSelection(t,n,r){t==null?this.selection.setRange(null,n||e.sources.API):([t,n,,r]=lH(t,n,r),this.selection.setRange(new jV(Math.max(0,t),n),r),r!==Q.sources.SILENT&&this.scrollSelectionIntoView())}setText(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Q.sources.API,n=new Z.default().insert(e);return this.setContents(n,t)}update(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Q.sources.USER,t=this.scroll.update(e);return this.selection.update(e),t}updateContents(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Q.sources.API;return cH.call(this,()=>(e=new Z.default(e),this.editor.applyDelta(e)),t,!0)}};function iH(e){return typeof e==`string`?document.querySelector(e):e}function aH(e){return Object.entries(e??{}).reduce((e,t)=>{let[n,r]=t;return{...e,[n]:r===!0?{}:r}},{})}function oH(e){return Object.fromEntries(Object.entries(e).filter(e=>e[1]!==void 0))}function sH(e,t){let n=iH(e);if(!n)throw Error(`Invalid Quill container`);let r=!t.theme||t.theme===$.DEFAULTS.theme?qV:$.import(`themes/${t.theme}`);if(!r)throw Error(`Invalid theme ${t.theme}. Did you register it?`);let{modules:i,...a}=$.DEFAULTS,{modules:o,...s}=r.DEFAULTS,c=aH(t.modules);c!=null&&c.toolbar&&c.toolbar.constructor!==Object&&(c={...c,toolbar:{container:c.toolbar}});let l=DB({},aH(i),aH(o),c),u={...a,...oH(s),...oH(t)},d=t.registry;return d?t.formats&&nH.warn(`Ignoring "formats" option because "registry" is specified`):d=t.formats?tH(t.formats,u.registry,nH):u.registry,{...u,registry:d,container:n,theme:r,modules:Object.entries(l).reduce((e,t)=>{let[n,r]=t;if(!r)return e;let i=$.import(`modules/${n}`);return i==null?(nH.error(`Cannot load ${n} module. Are you sure you registered it?`),e):{...e,[n]:DB({},i.DEFAULTS||{},r)}},{}),bounds:iH(u.bounds)}}function cH(e,t,n,r){if(!this.isEnabled()&&t===Q.sources.USER&&!this.allowReadOnlyEdits)return new Z.default;let i=n==null?null:this.getSelection(),a=this.editor.delta,o=e();if(i!=null&&(n===!0&&(n=i.index),r==null?i=uH(i,o,t):r!==0&&(i=uH(i,n,r,t)),this.setSelection(i,Q.sources.SILENT)),o.length()>0){let e=[Q.events.TEXT_CHANGE,o,a,t];this.emitter.emit(Q.events.EDITOR_CHANGE,...e),t!==Q.sources.SILENT&&this.emitter.emit(...e)}return o}function lH(e,t,n,r,i){let a={};return typeof e.index==`number`&&typeof e.length==`number`?typeof t==`number`?(t=e.length,e=e.index):(i=r,r=n,n=t,t=e.length,e=e.index):typeof t!=`number`&&(i=r,r=n,n=t,t=0),typeof n==`object`?(a=n,i=r):typeof n==`string`&&(r==null?i=n:a[n]=r),i||=Q.sources.API,[e,t,a,i]}function uH(e,t,n,r){let i=typeof n==`number`?n:0;if(e==null)return null;let a,o;return t&&typeof t.transformPosition==`function`?[a,o]=[e.index,e.index+e.length].map(e=>t.transformPosition(e,r!==Q.sources.USER)):[a,o]=[e.index,e.index+e.length].map(e=>e<t||e===t&&r===Q.sources.USER?e:i>=0?e+i:Math.max(t,e+i)),new jV(a,o-a)}var dH=class extends QB{};function fH(e){return e instanceof vV||e instanceof yV}function pH(e){return typeof e.updateContent==`function`}var mH=class extends rV{static blotName=`scroll`;static className=`ql-editor`;static tagName=`DIV`;static defaultChild=vV;static allowedChildren=[vV,yV,dH];constructor(e,t,n){let{emitter:r}=n;super(e,t),this.emitter=r,this.batch=!1,this.optimize(),this.enable(),this.domNode.addEventListener(`dragstart`,e=>this.handleDragStart(e))}batchStart(){Array.isArray(this.batch)||(this.batch=[])}batchEnd(){if(!this.batch)return;let e=this.batch;this.batch=!1,this.update(e)}emitMount(e){this.emitter.emit(Q.events.SCROLL_BLOT_MOUNT,e)}emitUnmount(e){this.emitter.emit(Q.events.SCROLL_BLOT_UNMOUNT,e)}emitEmbedUpdate(e,t){this.emitter.emit(Q.events.SCROLL_EMBED_UPDATE,e,t)}deleteAt(e,t){let[n,r]=this.line(e),[i]=this.line(e+t);if(super.deleteAt(e,t),i!=null&&n!==i&&r>0){if(n instanceof yV||i instanceof yV){this.optimize();return}let e=i.children.head instanceof fV?null:i.children.head;n.moveChildren(i,e),n.remove()}this.optimize()}enable(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.domNode.setAttribute(`contenteditable`,e?`true`:`false`)}formatAt(e,t,n,r){super.formatAt(e,t,n,r),this.optimize()}insertAt(e,t,n){if(e>=this.length()){if(n==null||this.scroll.query(t,X.BLOCK)==null){let e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e),n==null&&t.endsWith(`
404
+ `)?e.insertAt(0,t.slice(0,-1),n):e.insertAt(0,t,n)}else{let e=this.scroll.create(t,n);this.appendChild(e)}}else super.insertAt(e,t,n);this.optimize()}insertBefore(e,t){if(e.statics.scope===X.INLINE_BLOT){let n=this.scroll.create(this.statics.defaultChild.blotName);n.appendChild(e),super.insertBefore(n,t)}else super.insertBefore(e,t)}insertContents(e,t){let n=this.deltaToRenderBlocks(t.concat(new Z.default().insert(`
405
+ `))),r=n.pop();if(r==null)return;this.batchStart();let i=n.shift();if(i){let t=i.type===`block`&&(i.delta.length()===0||!this.descendant(yV,e)[0]&&e<this.length()),n=i.type===`block`?i.delta:new Z.default().insert({[i.key]:i.value});hH(this,e,n);let r=+(i.type===`block`),a=e+n.length()+r;t&&this.insertAt(a-1,`
406
+ `);let o=xV(this.line(e)[0]),s=Z.AttributeMap.diff(o,i.attributes)||{};Object.keys(s).forEach(e=>{this.formatAt(a-1,1,e,s[e])}),e=a}let[a,o]=this.children.find(e);if(n.length&&(a&&(a=a.split(o),o=0),n.forEach(e=>{if(e.type===`block`)hH(this.createBlock(e.attributes,a||void 0),0,e.delta);else{let t=this.create(e.key,e.value);this.insertBefore(t,a||void 0),Object.keys(e.attributes).forEach(n=>{t.format(n,e.attributes[n])})}})),r.type===`block`&&r.delta.length()){let e=a?a.offset(a.scroll)+o:this.length();hH(this,e,r.delta)}this.batchEnd(),this.optimize()}isEnabled(){return this.domNode.getAttribute(`contenteditable`)===`true`}leaf(e){let t=this.path(e).pop();if(!t)return[null,-1];let[n,r]=t;return n instanceof VB?[n,r]:[null,-1]}line(e){return e===this.length()?this.line(e-1):this.descendant(fH,e)}lines(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE,n=(e,t,r)=>{let i=[],a=r;return e.children.forEachAt(t,r,(e,t,r)=>{fH(e)?i.push(e):e instanceof QB&&(i=i.concat(n(e,t,a))),a-=r}),i};return n(this,e,t)}optimize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.batch||(super.optimize(e,t),e.length>0&&this.emitter.emit(Q.events.SCROLL_OPTIMIZE,e,t))}path(e){return super.path(e).slice(1)}remove(){}update(e){if(this.batch){Array.isArray(e)&&(this.batch=this.batch.concat(e));return}let t=Q.sources.USER;typeof e==`string`&&(t=e),Array.isArray(e)||(e=this.observer.takeRecords()),e=e.filter(e=>{let{target:t}=e,n=this.find(t,!0);return n&&!pH(n)}),e.length>0&&this.emitter.emit(Q.events.SCROLL_BEFORE_UPDATE,t,e),super.update(e.concat([])),e.length>0&&this.emitter.emit(Q.events.SCROLL_UPDATE,t,e)}updateEmbedAt(e,t,n){let[r]=this.descendant(e=>e instanceof yV,e);r&&r.statics.blotName===t&&pH(r)&&r.updateContent(n)}handleDragStart(e){e.preventDefault()}deltaToRenderBlocks(e){let t=[],n=new Z.default;return e.forEach(e=>{let r=e?.insert;if(r){if(typeof r==`string`){let i=r.split(`
407
+ `);i.slice(0,-1).forEach(r=>{n.insert(r,e.attributes),t.push({type:`block`,delta:n,attributes:e.attributes??{}}),n=new Z.default});let a=i[i.length-1];a&&n.insert(a,e.attributes)}else{let i=Object.keys(r)[0];if(!i)return;this.query(i,X.INLINE)?n.push(e):(n.length()&&t.push({type:`block`,delta:n,attributes:{}}),n=new Z.default,t.push({type:`blockEmbed`,key:i,value:r[i],attributes:e.attributes??{}}))}}}),n.length()&&t.push({type:`block`,delta:n,attributes:{}}),t}createBlock(e,t){let n,r={};Object.entries(e).forEach(e=>{let[t,i]=e;this.query(t,X.BLOCK&X.BLOT)==null?r[t]=i:n=t});let i=this.create(n||this.statics.defaultChild.blotName,n?e[n]:void 0);this.insertBefore(i,t||void 0);let a=i.length();return Object.entries(r).forEach(e=>{let[t,n]=e;i.formatAt(0,a,t,n)}),i}};function hH(e,t,n){n.reduce((t,n)=>{let r=Z.Op.length(n),i=n.attributes||{};if(n.insert!=null){if(typeof n.insert==`string`){let r=n.insert;e.insertAt(t,r);let[a]=e.descendant(VB,t),o=xV(a);i=Z.AttributeMap.diff(o,i)||{}}else if(typeof n.insert==`object`){let r=Object.keys(n.insert)[0];if(r==null)return t;if(e.insertAt(t,r,n.insert[r]),e.scroll.query(r,X.INLINE)!=null){let[n]=e.descendant(VB,t),r=xV(n);i=Z.AttributeMap.diff(r,i)||{}}}}return Object.keys(i).forEach(n=>{e.formatAt(t,r,n,i[n])}),t+r},t)}var gH={scope:X.BLOCK,whitelist:[`right`,`center`,`justify`]},_H=new kB(`align`,`align`,gH),vH=new PB(`align`,`ql-align`,gH),yH=new IB(`align`,`text-align`,gH),bH=class extends IB{value(e){let t=super.value(e);return t.startsWith(`rgb(`)?(t=t.replace(/^[^\d]+/,``).replace(/[^\d]+$/,``),`#${t.split(`,`).map(e=>`00${parseInt(e,10).toString(16)}`.slice(-2)).join(``)}`):t}},xH=new PB(`color`,`ql-color`,{scope:X.INLINE}),SH=new bH(`color`,`color`,{scope:X.INLINE}),CH=new PB(`background`,`ql-bg`,{scope:X.INLINE}),wH=new bH(`background`,`background-color`,{scope:X.INLINE}),TH=class extends dH{static create(e){let t=super.create(e);return t.setAttribute(`spellcheck`,`false`),t}code(e,t){return this.children.map(e=>e.length()<=1?``:e.domNode.innerText).join(`
408
+ `).slice(e,e+t)}html(e,t){return`<pre>\n${hV(this.code(e,t))}\n</pre>`}},EH=class extends vV{static TAB=` `;static register(){$.register(TH)}},DH=class extends gV{};DH.blotName=`code`,DH.tagName=`CODE`,EH.blotName=`code-block`,EH.className=`ql-code-block`,EH.tagName=`DIV`,TH.blotName=`code-block-container`,TH.className=`ql-code-block-container`,TH.tagName=`DIV`,TH.allowedChildren=[EH],EH.allowedChildren=[pV,fV,SV],EH.requiredContainer=TH;var OH={scope:X.BLOCK,whitelist:[`rtl`]},kH=new kB(`direction`,`dir`,OH),AH=new PB(`direction`,`ql-direction`,OH),jH=new IB(`direction`,`direction`,OH),MH={scope:X.INLINE,whitelist:[`serif`,`monospace`]},NH=new PB(`font`,`ql-font`,MH),PH=new class extends IB{value(e){return super.value(e).replace(/["']/g,``)}}(`font`,`font-family`,MH),FH=new PB(`size`,`ql-size`,{scope:X.INLINE,whitelist:[`small`,`large`,`huge`]}),IH=new IB(`size`,`font-size`,{scope:X.INLINE,whitelist:[`10px`,`18px`,`32px`]}),LH=OV(`quill:keyboard`),RH=/Mac/i.test(navigator.platform)?`metaKey`:`ctrlKey`,zH=class e extends UV{static match(e,t){return[`altKey`,`ctrlKey`,`metaKey`,`shiftKey`].some(n=>!!t[n]!==e[n]&&t[n]!==null)?!1:t.key===e.key||t.key===e.which}constructor(e,t){super(e,t),this.bindings={},Object.keys(this.options.bindings).forEach(e=>{this.options.bindings[e]&&this.addBinding(this.options.bindings[e])}),this.addBinding({key:`Enter`,shiftKey:null},this.handleEnter),this.addBinding({key:`Enter`,metaKey:null,ctrlKey:null,altKey:null},()=>{}),/Firefox/i.test(navigator.userAgent)?(this.addBinding({key:`Backspace`},{collapsed:!0},this.handleBackspace),this.addBinding({key:`Delete`},{collapsed:!0},this.handleDelete)):(this.addBinding({key:`Backspace`},{collapsed:!0,prefix:/^.?$/},this.handleBackspace),this.addBinding({key:`Delete`},{collapsed:!0,suffix:/^.?$/},this.handleDelete)),this.addBinding({key:`Backspace`},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:`Delete`},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:`Backspace`,altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},this.handleBackspace),this.listen()}addBinding(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=WH(e);if(r==null){LH.warn(`Attempted to add invalid keyboard binding`,r);return}typeof t==`function`&&(t={handler:t}),typeof n==`function`&&(n={handler:n}),(Array.isArray(r.key)?r.key:[r.key]).forEach(e=>{let i={...r,key:e,...t,...n};this.bindings[i.key]=this.bindings[i.key]||[],this.bindings[i.key].push(i)})}listen(){this.quill.root.addEventListener(`keydown`,t=>{if(t.defaultPrevented||t.isComposing||t.keyCode===229&&(t.key===`Enter`||t.key===`Backspace`))return;let n=(this.bindings[t.key]||[]).concat(this.bindings[t.which]||[]).filter(n=>e.match(t,n));if(n.length===0)return;let r=$.find(t.target,!0);if(r&&r.scroll!==this.quill.scroll)return;let i=this.quill.getSelection();if(i==null||!this.quill.hasFocus())return;let[a,o]=this.quill.getLine(i.index),[s,c]=this.quill.getLeaf(i.index),[l,u]=i.length===0?[s,c]:this.quill.getLeaf(i.index+i.length),d=s instanceof aV?s.value().slice(0,c):``,f=l instanceof aV?l.value().slice(u):``,p={collapsed:i.length===0,empty:i.length===0&&a.length()<=1,format:this.quill.getFormat(i),line:a,offset:o,prefix:d,suffix:f,event:t};n.some(e=>{if(e.collapsed!=null&&e.collapsed!==p.collapsed||e.empty!=null&&e.empty!==p.empty||e.offset!=null&&e.offset!==p.offset)return!1;if(Array.isArray(e.format)){if(e.format.every(e=>p.format[e]==null))return!1}else if(typeof e.format==`object`&&!Object.keys(e.format).every(t=>e.format[t]===!0?p.format[t]!=null:e.format[t]===!1?p.format[t]==null:EB(e.format[t],p.format[t])))return!1;return e.prefix!=null&&!e.prefix.test(p.prefix)||e.suffix!=null&&!e.suffix.test(p.suffix)?!1:e.handler.call(this,i,p,e)!==!0})&&t.preventDefault()})}handleBackspace(e,t){let n=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(t.prefix)?2:1;if(e.index===0||this.quill.getLength()<=1)return;let r={},[i]=this.quill.getLine(e.index),a=new Z.default().retain(e.index-n).delete(n);if(t.offset===0){let[t]=this.quill.getLine(e.index-1);if(t&&!(t.statics.blotName===`block`&&t.length()<=1)){let t=i.formats(),n=this.quill.getFormat(e.index-1,1);if(r=Z.AttributeMap.diff(t,n)||{},Object.keys(r).length>0){let t=new Z.default().retain(e.index+i.length()-2).retain(1,r);a=a.compose(t)}}}this.quill.updateContents(a,$.sources.USER),this.quill.focus()}handleDelete(e,t){let n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(t.suffix)?2:1;if(e.index>=this.quill.getLength()-n)return;let r={},[i]=this.quill.getLine(e.index),a=new Z.default().retain(e.index).delete(n);if(t.offset>=i.length()-1){let[t]=this.quill.getLine(e.index+1);if(t){let n=i.formats(),o=this.quill.getFormat(e.index,1);r=Z.AttributeMap.diff(n,o)||{},Object.keys(r).length>0&&(a=a.retain(t.length()-1).retain(1,r))}}this.quill.updateContents(a,$.sources.USER),this.quill.focus()}handleDeleteRange(e){GH({range:e,quill:this.quill}),this.quill.focus()}handleEnter(e,t){let n=Object.keys(t.format).reduce((e,n)=>(this.quill.scroll.query(n,X.BLOCK)&&!Array.isArray(t.format[n])&&(e[n]=t.format[n]),e),{}),r=new Z.default().retain(e.index).delete(e.length).insert(`
409
+ `,n);this.quill.updateContents(r,$.sources.USER),this.quill.setSelection(e.index+1,$.sources.SILENT),this.quill.focus()}};zH.DEFAULTS={bindings:{bold:HH(`bold`),italic:HH(`italic`),underline:HH(`underline`),indent:{key:`Tab`,format:[`blockquote`,`indent`,`list`],handler(e,t){return t.collapsed&&t.offset!==0?!0:(this.quill.format(`indent`,`+1`,$.sources.USER),!1)}},outdent:{key:`Tab`,shiftKey:!0,format:[`blockquote`,`indent`,`list`],handler(e,t){return t.collapsed&&t.offset!==0?!0:(this.quill.format(`indent`,`-1`,$.sources.USER),!1)}},"outdent backspace":{key:`Backspace`,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:[`indent`,`list`],offset:0,handler(e,t){t.format.indent==null?t.format.list!=null&&this.quill.format(`list`,!1,$.sources.USER):this.quill.format(`indent`,`-1`,$.sources.USER)}},"indent code-block":BH(!0),"outdent code-block":BH(!1),"remove tab":{key:`Tab`,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(e){this.quill.deleteText(e.index-1,1,$.sources.USER)}},tab:{key:`Tab`,handler(e,t){if(t.format.table)return!0;this.quill.history.cutoff();let n=new Z.default().retain(e.index).delete(e.length).insert(` `);return this.quill.updateContents(n,$.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index+1,$.sources.SILENT),!1}},"blockquote empty enter":{key:`Enter`,collapsed:!0,format:[`blockquote`],empty:!0,handler(){this.quill.format(`blockquote`,!1,$.sources.USER)}},"list empty enter":{key:`Enter`,collapsed:!0,format:[`list`],empty:!0,handler(e,t){let n={list:!1};t.format.indent&&(n.indent=!1),this.quill.formatLine(e.index,e.length,n,$.sources.USER)}},"checklist enter":{key:`Enter`,collapsed:!0,format:{list:`checked`},handler(e){let[t,n]=this.quill.getLine(e.index),r={...t.formats(),list:`checked`},i=new Z.default().retain(e.index).insert(`
410
+ `,r).retain(t.length()-n-1).retain(1,{list:`unchecked`});this.quill.updateContents(i,$.sources.USER),this.quill.setSelection(e.index+1,$.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:`Enter`,collapsed:!0,format:[`header`],suffix:/^$/,handler(e,t){let[n,r]=this.quill.getLine(e.index),i=new Z.default().retain(e.index).insert(`
411
+ `,t.format).retain(n.length()-r-1).retain(1,{header:null});this.quill.updateContents(i,$.sources.USER),this.quill.setSelection(e.index+1,$.sources.SILENT),this.quill.scrollSelectionIntoView()}},"table backspace":{key:`Backspace`,format:[`table`],collapsed:!0,offset:0,handler(){}},"table delete":{key:`Delete`,format:[`table`],collapsed:!0,suffix:/^$/,handler(){}},"table enter":{key:`Enter`,shiftKey:null,format:[`table`],handler(e){let t=this.quill.getModule(`table`);if(t){let[n,r,i,a]=t.getTable(e),o=KH(n,r,i,a);if(o==null)return;let s=n.offset();if(o<0){let t=new Z.default().retain(s).insert(`
412
+ `);this.quill.updateContents(t,$.sources.USER),this.quill.setSelection(e.index+1,e.length,$.sources.SILENT)}else if(o>0){s+=n.length();let e=new Z.default().retain(s).insert(`
413
+ `);this.quill.updateContents(e,$.sources.USER),this.quill.setSelection(s,$.sources.USER)}}}},"table tab":{key:`Tab`,shiftKey:null,format:[`table`],handler(e,t){let{event:n,line:r}=t,i=r.offset(this.quill.scroll);n.shiftKey?this.quill.setSelection(i-1,$.sources.USER):this.quill.setSelection(i+r.length(),$.sources.USER)}},"list autofill":{key:` `,shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(e,t){if(this.quill.scroll.query(`list`)==null)return!0;let{length:n}=t.prefix,[r,i]=this.quill.getLine(e.index);if(i>n)return!0;let a;switch(t.prefix.trim()){case`[]`:case`[ ]`:a=`unchecked`;break;case`[x]`:a=`checked`;break;case`-`:case`*`:a=`bullet`;break;default:a=`ordered`}this.quill.insertText(e.index,` `,$.sources.USER),this.quill.history.cutoff();let o=new Z.default().retain(e.index-i).delete(n+1).retain(r.length()-2-i).retain(1,{list:a});return this.quill.updateContents(o,$.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index-n,$.sources.SILENT),!1}},"code exit":{key:`Enter`,collapsed:!0,format:[`code-block`],prefix:/^$/,suffix:/^\s*$/,handler(e){let[t,n]=this.quill.getLine(e.index),r=2,i=t;for(;i!=null&&i.length()<=1&&i.formats()[`code-block`];)if(i=i.prev,--r,r<=0){let r=new Z.default().retain(e.index+t.length()-n-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(r,$.sources.USER),this.quill.setSelection(e.index-1,$.sources.SILENT),!1}return!0}},"embed left":VH(`ArrowLeft`,!1),"embed left shift":VH(`ArrowLeft`,!0),"embed right":VH(`ArrowRight`,!1),"embed right shift":VH(`ArrowRight`,!0),"table down":UH(!1),"table up":UH(!0)}};function BH(e){return{key:`Tab`,shiftKey:!e,format:{"code-block":!0},handler(t,n){let{event:r}=n,{TAB:i}=this.quill.scroll.query(`code-block`);if(t.length===0&&!r.shiftKey){this.quill.insertText(t.index,i,$.sources.USER),this.quill.setSelection(t.index+i.length,$.sources.SILENT);return}let a=t.length===0?this.quill.getLines(t.index,1):this.quill.getLines(t),{index:o,length:s}=t;a.forEach((t,n)=>{e?(t.insertAt(0,i),n===0?o+=i.length:s+=i.length):t.domNode.textContent.startsWith(i)&&(t.deleteAt(0,i.length),n===0?o-=i.length:s-=i.length)}),this.quill.update($.sources.USER),this.quill.setSelection(o,s,$.sources.SILENT)}}}function VH(e,t){return{key:e,shiftKey:t,altKey:null,[e===`ArrowLeft`?`prefix`:`suffix`]:/^$/,handler(n){let{index:r}=n;e===`ArrowRight`&&(r+=n.length+1);let[i]=this.quill.getLeaf(r);return i instanceof $B?(e===`ArrowLeft`?t?this.quill.setSelection(n.index-1,n.length+1,$.sources.USER):this.quill.setSelection(n.index-1,$.sources.USER):t?this.quill.setSelection(n.index,n.length+1,$.sources.USER):this.quill.setSelection(n.index+n.length+1,$.sources.USER),!1):!0}}}function HH(e){return{key:e[0],shortKey:!0,handler(t,n){this.quill.format(e,!n.format[e],$.sources.USER)}}}function UH(e){return{key:e?`ArrowUp`:`ArrowDown`,collapsed:!0,format:[`table`],handler(t,n){let r=e?`prev`:`next`,i=n.line,a=i.parent[r];if(a!=null){if(a.statics.blotName===`table-row`){let e=a.children.head,t=i;for(;t.prev!=null;)t=t.prev,e=e.next;let r=e.offset(this.quill.scroll)+Math.min(n.offset,e.length()-1);this.quill.setSelection(r,0,$.sources.USER)}}else{let t=i.table()[r];t!=null&&(e?this.quill.setSelection(t.offset(this.quill.scroll)+t.length()-1,0,$.sources.USER):this.quill.setSelection(t.offset(this.quill.scroll),0,$.sources.USER))}return!1}}}function WH(e){if(typeof e==`string`||typeof e==`number`)e={key:e};else if(typeof e==`object`)e=Pz(e);else return null;return e.shortKey&&(e[RH]=e.shortKey,delete e.shortKey),e}function GH(e){let{quill:t,range:n}=e,r=t.getLines(n),i={};if(r.length>1){let e=r[0].formats(),t=r[r.length-1].formats();i=Z.AttributeMap.diff(t,e)||{}}t.deleteText(n,$.sources.USER),Object.keys(i).length>0&&t.formatLine(n.index,1,i,$.sources.USER),t.setSelection(n.index,$.sources.SILENT)}function KH(e,t,n,r){return t.prev==null&&t.next==null?n.prev==null&&n.next==null?r===0?-1:1:n.prev==null?-1:1:t.prev==null?-1:t.next==null?1:null}var qH=/font-weight:\s*normal/,JH=[`P`,`OL`,`UL`],YH=e=>e&&JH.includes(e.tagName),XH=e=>{Array.from(e.querySelectorAll(`br`)).filter(e=>YH(e.previousElementSibling)&&YH(e.nextElementSibling)).forEach(e=>{e.parentNode?.removeChild(e)})},ZH=e=>{Array.from(e.querySelectorAll(`b[style*="font-weight"]`)).filter(e=>e.getAttribute(`style`)?.match(qH)).forEach(t=>{let n=e.createDocumentFragment();n.append(...t.childNodes),t.parentNode?.replaceChild(n,t)})};function QH(e){e.querySelector(`[id^="docs-internal-guid-"]`)&&(ZH(e),XH(e))}var $H=/\bmso-list:[^;]*ignore/i,eU=/\bmso-list:[^;]*\bl(\d+)/i,tU=/\bmso-list:[^;]*\blevel(\d+)/i,nU=(e,t)=>{let n=e.getAttribute(`style`),r=n?.match(eU);if(!r)return null;let i=Number(r[1]),a=n?.match(tU),o=a?Number(a[1]):1,s=RegExp(`@list l${i}:level${o}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,`i`),c=t.match(s);return{id:i,indent:o,type:c&&c[1]===`bullet`?`bullet`:`ordered`,element:e}},rU=e=>{let t=Array.from(e.querySelectorAll(`[style*=mso-list]`)),n=[],r=[];t.forEach(e=>{(e.getAttribute(`style`)||``).match($H)?n.push(e):r.push(e)}),n.forEach(e=>e.parentNode?.removeChild(e));let i=e.documentElement.innerHTML,a=r.map(e=>nU(e,i)).filter(e=>e);for(;a.length;){let e=[],t=a.shift();for(;t;)e.push(t),t=a.length&&a[0]?.element===t.element.nextElementSibling&&a[0].id===t.id?a.shift():null;let n=document.createElement(`ul`);e.forEach(e=>{let t=document.createElement(`li`);t.setAttribute(`data-list`,e.type),e.indent>1&&t.setAttribute(`class`,`ql-indent-${e.indent-1}`),t.innerHTML=e.element.innerHTML,n.appendChild(t)});let r=e[0]?.element,{parentNode:i}=r??{};r&&i?.replaceChild(n,r),e.slice(1).forEach(e=>{let{element:t}=e;i?.removeChild(t)})}};function iU(e){e.documentElement.getAttribute(`xmlns:w`)===`urn:schemas-microsoft-com:office:word`&&rU(e)}var aU=[iU,QH],oU=e=>{e.documentElement&&aU.forEach(t=>{t(e)})},sU=OV(`quill:clipboard`),cU=[[Node.TEXT_NODE,AU],[Node.TEXT_NODE,DU],[`br`,SU],[Node.ELEMENT_NODE,DU],[Node.ELEMENT_NODE,xU],[Node.ELEMENT_NODE,bU],[Node.ELEMENT_NODE,OU],[`li`,TU],[`ol, ul`,EU],[`pre`,CU],[`tr`,kU],[`b`,yU(`bold`)],[`i`,yU(`italic`)],[`strike`,yU(`strike`)],[`style`,wU]],lU=[_H,kH].reduce((e,t)=>(e[t.keyName]=t,e),{}),uU=[yH,wH,SH,jH,PH,IH].reduce((e,t)=>(e[t.keyName]=t,e),{}),dU=class extends UV{static DEFAULTS={matchers:[]};constructor(e,t){super(e,t),this.quill.root.addEventListener(`copy`,e=>this.onCaptureCopy(e,!1)),this.quill.root.addEventListener(`cut`,e=>this.onCaptureCopy(e,!0)),this.quill.root.addEventListener(`paste`,this.onCapturePaste.bind(this)),this.matchers=[],cU.concat(this.options.matchers??[]).forEach(e=>{let[t,n]=e;this.addMatcher(t,n)})}addMatcher(e,t){this.matchers.push([e,t])}convert(e){let{html:t,text:n}=e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(r[EH.blotName])return new Z.default().insert(n||``,{[EH.blotName]:r[EH.blotName]});if(!t)return new Z.default().insert(n||``,r);let i=this.convertHTML(t);return pU(i,`
414
+ `)&&(i.ops[i.ops.length-1].attributes==null||r.table)?i.compose(new Z.default().retain(i.length()-1).delete(1)):i}normalizeHTML(e){oU(e)}convertHTML(e){let t=new DOMParser().parseFromString(e,`text/html`);this.normalizeHTML(t);let n=t.body,r=new WeakMap,[i,a]=this.prepareMatching(n,r);return vU(this.quill.scroll,n,i,a,r)}dangerouslyPasteHTML(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:$.sources.API;if(typeof e==`string`){let n=this.convert({html:e,text:``});this.quill.setContents(n,t),this.quill.setSelection(0,$.sources.SILENT)}else{let r=this.convert({html:t,text:``});this.quill.updateContents(new Z.default().retain(e).concat(r),n),this.quill.setSelection(e+r.length(),$.sources.SILENT)}}onCaptureCopy(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(e.defaultPrevented)return;e.preventDefault();let[n]=this.quill.selection.getRange();if(n==null)return;let{html:r,text:i}=this.onCopy(n,t);e.clipboardData?.setData(`text/plain`,i),e.clipboardData?.setData(`text/html`,r),t&&GH({range:n,quill:this.quill})}normalizeURIList(e){return e.split(/\r?\n/).filter(e=>e[0]!==`#`).join(`
415
+ `)}onCapturePaste(e){if(e.defaultPrevented||!this.quill.isEnabled())return;e.preventDefault();let t=this.quill.getSelection(!0);if(t==null)return;let n=e.clipboardData?.getData(`text/html`),r=e.clipboardData?.getData(`text/plain`);if(!n&&!r){let t=e.clipboardData?.getData(`text/uri-list`);t&&(r=this.normalizeURIList(t))}let i=Array.from(e.clipboardData?.files||[]);if(!n&&i.length>0){this.quill.uploader.upload(t,i);return}if(n&&i.length>0){let e=new DOMParser().parseFromString(n,`text/html`);if(e.body.childElementCount===1&&e.body.firstElementChild?.tagName===`IMG`){this.quill.uploader.upload(t,i);return}}this.onPaste(t,{html:n,text:r})}onCopy(e){let t=this.quill.getText(e);return{html:this.quill.getSemanticHTML(e),text:t}}onPaste(e,t){let{text:n,html:r}=t,i=this.quill.getFormat(e.index),a=this.convert({text:n,html:r},i);sU.log(`onPaste`,a,{text:n,html:r});let o=new Z.default().retain(e.index).delete(e.length).concat(a);this.quill.updateContents(o,$.sources.USER),this.quill.setSelection(o.length()-e.length,$.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(e,t){let n=[],r=[];return this.matchers.forEach(i=>{let[a,o]=i;switch(a){case Node.TEXT_NODE:r.push(o);break;case Node.ELEMENT_NODE:n.push(o);break;default:Array.from(e.querySelectorAll(a)).forEach(e=>{t.has(e)?t.get(e)?.push(o):t.set(e,[o])})}}),[n,r]}};function fU(e,t,n,r){return r.query(t)?e.reduce((e,r)=>{if(!r.insert)return e;if(r.attributes&&r.attributes[t])return e.push(r);let i=n?{[t]:n}:{};return e.insert(r.insert,{...i,...r.attributes})},new Z.default):e}function pU(e,t){let n=``;for(let r=e.ops.length-1;r>=0&&n.length<t.length;--r){let t=e.ops[r];if(typeof t.insert!=`string`)break;n=t.insert+n}return n.slice(-1*t.length)===t}function mU(e,t){if(!(e instanceof Element))return!1;let n=t.query(e);return n&&n.prototype instanceof $B?!1:`address.article.blockquote.canvas.dd.div.dl.dt.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.iframe.li.main.nav.ol.output.p.pre.section.table.td.tr.ul.video`.split(`.`).includes(e.tagName.toLowerCase())}function hU(e,t){return e.previousElementSibling&&e.nextElementSibling&&!mU(e.previousElementSibling,t)&&!mU(e.nextElementSibling,t)}var gU=new WeakMap;function _U(e){return e!=null&&(gU.has(e)||(e.tagName===`PRE`?gU.set(e,!0):gU.set(e,_U(e.parentNode))),gU.get(e))}function vU(e,t,n,r,i){return t.nodeType===t.TEXT_NODE?r.reduce((n,r)=>r(t,n,e),new Z.default):t.nodeType===t.ELEMENT_NODE?Array.from(t.childNodes||[]).reduce((a,o)=>{let s=vU(e,o,n,r,i);return o.nodeType===t.ELEMENT_NODE&&(s=n.reduce((t,n)=>n(o,t,e),s),s=(i.get(o)||[]).reduce((t,n)=>n(o,t,e),s)),a.concat(s)},new Z.default):new Z.default}function yU(e){return(t,n,r)=>fU(n,e,!0,r)}function bU(e,t,n){let r=kB.keys(e),i=PB.keys(e),a=IB.keys(e),o={};return r.concat(i).concat(a).forEach(t=>{let r=n.query(t,X.ATTRIBUTE);r!=null&&(o[r.attrName]=r.value(e),o[r.attrName])||(r=lU[t],r!=null&&(r.attrName===t||r.keyName===t)&&(o[r.attrName]=r.value(e)||void 0),r=uU[t],r!=null&&(r.attrName===t||r.keyName===t)&&(r=uU[t],o[r.attrName]=r.value(e)||void 0))}),Object.entries(o).reduce((e,t)=>{let[r,i]=t;return fU(e,r,i,n)},t)}function xU(e,t,n){let r=n.query(e);if(r==null)return t;if(r.prototype instanceof $B){let t={},i=r.value(e);if(i!=null)return t[r.blotName]=i,new Z.default().insert(t,r.formats(e,n))}else if(r.prototype instanceof XB&&!pU(t,`
416
+ `)&&t.insert(`
417
+ `),`blotName`in r&&`formats`in r&&typeof r.formats==`function`)return fU(t,r.blotName,r.formats(e,n),n);return t}function SU(e,t){return pU(t,`
418
+ `)||t.insert(`
419
+ `),t}function CU(e,t,n){let r=n.query(`code-block`);return fU(t,`code-block`,r&&`formats`in r&&typeof r.formats==`function`?r.formats(e,n):!0,n)}function wU(){return new Z.default}function TU(e,t,n){let r=n.query(e);if(r==null||r.blotName!==`list`||!pU(t,`
420
+ `))return t;let i=-1,a=e.parentNode;for(;a!=null;)[`OL`,`UL`].includes(a.tagName)&&(i+=1),a=a.parentNode;return i<=0?t:t.reduce((e,t)=>t.insert?t.attributes&&typeof t.attributes.indent==`number`?e.push(t):e.insert(t.insert,{indent:i,...t.attributes||{}}):e,new Z.default)}function EU(e,t,n){let r=e,i=r.tagName===`OL`?`ordered`:`bullet`,a=r.getAttribute(`data-checked`);return a&&(i=a===`true`?`checked`:`unchecked`),fU(t,`list`,i,n)}function DU(e,t,n){if(!pU(t,`
421
+ `)){if(mU(e,n)&&(e.childNodes.length>0||e instanceof HTMLParagraphElement))return t.insert(`
422
+ `);if(t.length()>0&&e.nextSibling){let r=e.nextSibling;for(;r!=null;){if(mU(r,n))return t.insert(`
423
+ `);let e=n.query(r);if(e&&e.prototype instanceof yV)return t.insert(`
424
+ `);r=r.firstChild}}}return t}function OU(e,t,n){let r={},i=e.style||{};return i.fontStyle===`italic`&&(r.italic=!0),i.textDecoration===`underline`&&(r.underline=!0),i.textDecoration===`line-through`&&(r.strike=!0),(i.fontWeight?.startsWith(`bold`)||parseInt(i.fontWeight,10)>=700)&&(r.bold=!0),t=Object.entries(r).reduce((e,t)=>{let[r,i]=t;return fU(e,r,i,n)},t),parseFloat(i.textIndent||0)>0?new Z.default().insert(` `).concat(t):t}function kU(e,t,n){let r=e.parentElement?.tagName===`TABLE`?e.parentElement:e.parentElement?.parentElement;return r==null?t:fU(t,`table`,Array.from(r.querySelectorAll(`tr`)).indexOf(e)+1,n)}function AU(e,t,n){let r=e.data;if(e.parentElement?.tagName===`O:P`)return t.insert(r.trim());if(!_U(e)){if(r.trim().length===0&&r.includes(`
425
+ `)&&!hU(e,n))return t;r=r.replace(/[^\S\u00a0]/g,` `),r=r.replace(/ {2,}/g,` `),(e.previousSibling==null&&e.parentElement!=null&&mU(e.parentElement,n)||e.previousSibling instanceof Element&&mU(e.previousSibling,n))&&(r=r.replace(/^ /,``)),(e.nextSibling==null&&e.parentElement!=null&&mU(e.parentElement,n)||e.nextSibling instanceof Element&&mU(e.nextSibling,n))&&(r=r.replace(/ $/,``)),r=r.replaceAll(`\xA0`,` `)}return t.insert(r)}var jU=class extends UV{static DEFAULTS={delay:1e3,maxStack:100,userOnly:!1};lastRecorded=0;ignoreChange=!1;stack={undo:[],redo:[]};currentRange=null;constructor(e,t){super(e,t),this.quill.on($.events.EDITOR_CHANGE,(e,t,n,r)=>{e===$.events.SELECTION_CHANGE?t&&r!==$.sources.SILENT&&(this.currentRange=t):e===$.events.TEXT_CHANGE&&(this.ignoreChange||(!this.options.userOnly||r===$.sources.USER?this.record(t,n):this.transform(t)),this.currentRange=FU(this.currentRange,t))}),this.quill.keyboard.addBinding({key:`z`,shortKey:!0},this.undo.bind(this)),this.quill.keyboard.addBinding({key:[`z`,`Z`],shortKey:!0,shiftKey:!0},this.redo.bind(this)),/Win/i.test(navigator.platform)&&this.quill.keyboard.addBinding({key:`y`,shortKey:!0},this.redo.bind(this)),this.quill.root.addEventListener(`beforeinput`,e=>{e.inputType===`historyUndo`?(this.undo(),e.preventDefault()):e.inputType===`historyRedo`&&(this.redo(),e.preventDefault())})}change(e,t){if(this.stack[e].length===0)return;let n=this.stack[e].pop();if(!n)return;let r=this.quill.getContents(),i=n.delta.invert(r);this.stack[t].push({delta:i,range:FU(n.range,i)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n.delta,$.sources.USER),this.ignoreChange=!1,this.restoreSelection(n)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(e,t){if(e.ops.length===0)return;this.stack.redo=[];let n=e.invert(t),r=this.currentRange,i=Date.now();if(this.lastRecorded+this.options.delay>i&&this.stack.undo.length>0){let e=this.stack.undo.pop();e&&(n=n.compose(e.delta),r=e.range)}else this.lastRecorded=i;n.length()!==0&&(this.stack.undo.push({delta:n,range:r}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift())}redo(){this.change(`redo`,`undo`)}transform(e){MU(this.stack.undo,e),MU(this.stack.redo,e)}undo(){this.change(`undo`,`redo`)}restoreSelection(e){if(e.range)this.quill.setSelection(e.range,$.sources.USER);else{let t=PU(this.quill.scroll,e.delta);this.quill.setSelection(t,$.sources.USER)}}};function MU(e,t){let n=t;for(let t=e.length-1;t>=0;--t){let r=e[t];e[t]={delta:n.transform(r.delta,!0),range:r.range&&FU(r.range,n)},n=r.delta.transform(n),e[t].delta.length()===0&&e.splice(t,1)}}function NU(e,t){let n=t.ops[t.ops.length-1];return n==null?!1:n.insert==null?n.attributes!=null&&Object.keys(n.attributes).some(t=>e.query(t,X.BLOCK)!=null):typeof n.insert==`string`&&n.insert.endsWith(`
426
+ `)}function PU(e,t){let n=t.reduce((e,t)=>e+(t.delete||0),0),r=t.length()-n;return NU(e,t)&&--r,r}function FU(e,t){if(!e)return e;let n=t.transformPosition(e.index);return{index:n,length:t.transformPosition(e.index+e.length)-n}}var IU=class extends UV{constructor(e,t){super(e,t),e.root.addEventListener(`drop`,t=>{t.preventDefault();let n=null;if(document.caretRangeFromPoint)n=document.caretRangeFromPoint(t.clientX,t.clientY);else if(document.caretPositionFromPoint){let e=document.caretPositionFromPoint(t.clientX,t.clientY);n=document.createRange(),n.setStart(e.offsetNode,e.offset),n.setEnd(e.offsetNode,e.offset)}let r=n&&e.selection.normalizeNative(n);if(r){let n=e.selection.normalizedToRange(r);t.dataTransfer?.files&&this.upload(n,t.dataTransfer.files)}})}upload(e,t){let n=[];Array.from(t).forEach(e=>{e&&this.options.mimetypes?.includes(e.type)&&n.push(e)}),n.length>0&&this.options.handler.call(this,e,n)}};IU.DEFAULTS={mimetypes:[`image/png`,`image/jpeg`],handler(e,t){if(!this.quill.scroll.query(`image`))return;let n=t.map(e=>new Promise(t=>{let n=new FileReader;n.onload=()=>{t(n.result)},n.readAsDataURL(e)}));Promise.all(n).then(t=>{let n=t.reduce((e,t)=>e.insert({image:t}),new Z.default().retain(e.index).delete(e.length));this.quill.updateContents(n,Q.sources.USER),this.quill.setSelection(e.index+t.length,Q.sources.SILENT)})}};var LU=[`insertText`,`insertReplacementText`],RU=class extends UV{constructor(e,t){super(e,t),e.root.addEventListener(`beforeinput`,e=>{this.handleBeforeInput(e)}),/Android/i.test(navigator.userAgent)||e.on($.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(e){GH({range:e,quill:this.quill})}replaceText(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:``;if(e.length===0)return!1;if(t){let n=this.quill.getFormat(e.index,1);this.deleteRange(e),this.quill.updateContents(new Z.default().retain(e.index).insert(t,n),$.sources.USER)}else this.deleteRange(e);return this.quill.setSelection(e.index+t.length,0,$.sources.SILENT),!0}handleBeforeInput(e){if(this.quill.composition.isComposing||e.defaultPrevented||!LU.includes(e.inputType))return;let t=e.getTargetRanges?e.getTargetRanges()[0]:null;if(!t||t.collapsed===!0)return;let n=zU(e);if(n==null)return;let r=this.quill.selection.normalizeNative(t),i=r?this.quill.selection.normalizedToRange(r):null;i&&this.replaceText(i,n)&&e.preventDefault()}handleCompositionStart(){let e=this.quill.getSelection();e&&this.replaceText(e)}};function zU(e){return typeof e.data==`string`?e.data:e.dataTransfer?.types.includes(`text/plain`)?e.dataTransfer.getData(`text/plain`):null}var BU=/Mac/i.test(navigator.platform),VU=e=>!!(e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Home`||BU&&e.key===`a`&&e.ctrlKey===!0),HU=class extends UV{isListening=!1;selectionChangeDeadline=0;constructor(e,t){super(e,t),this.handleArrowKeys(),this.handleNavigationShortcuts()}handleArrowKeys(){this.quill.keyboard.addBinding({key:[`ArrowLeft`,`ArrowRight`],offset:0,shiftKey:null,handler(e,t){let{line:n,event:r}=t;if(!(n instanceof GB)||!n.uiNode)return!0;let i=getComputedStyle(n.domNode).direction===`rtl`;return i&&r.key!==`ArrowRight`||!i&&r.key!==`ArrowLeft`?!0:(this.quill.setSelection(e.index-1,e.length+ +!!r.shiftKey,$.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener(`keydown`,e=>{!e.defaultPrevented&&VU(e)&&this.ensureListeningToSelectionChange()})}ensureListeningToSelectionChange(){this.selectionChangeDeadline=Date.now()+100,!this.isListening&&(this.isListening=!0,document.addEventListener(`selectionchange`,()=>{this.isListening=!1,Date.now()<=this.selectionChangeDeadline&&this.handleSelectionChange()},{once:!0}))}handleSelectionChange(){let e=document.getSelection();if(!e)return;let t=e.getRangeAt(0);if(t.collapsed!==!0||t.startOffset!==0)return;let n=this.quill.scroll.find(t.startContainer);if(!(n instanceof GB)||!n.uiNode)return;let r=document.createRange();r.setStartAfter(n.uiNode),r.setEndAfter(n.uiNode),e.removeAllRanges(),e.addRange(r)}};$.register({"blots/block":vV,"blots/block/embed":yV,"blots/break":fV,"blots/container":dH,"blots/cursor":SV,"blots/embed":GV,"blots/inline":gV,"blots/scroll":mH,"blots/text":pV,"modules/clipboard":dU,"modules/history":jU,"modules/keyboard":zH,"modules/uploader":IU,"modules/input":RU,"modules/uiNode":HU});var UU=$,WU=new class extends PB{add(e,t){let n=0;if(t===`+1`||t===`-1`){let r=this.value(e)||0;n=t===`+1`?r+1:r-1}else typeof t==`number`&&(n=t);return n===0?(this.remove(e),!0):super.add(e,n.toString())}canAdd(e,t){return super.canAdd(e,t)||super.canAdd(e,parseInt(t,10))}value(e){return parseInt(super.value(e),10)||void 0}}(`indent`,`ql-indent`,{scope:X.BLOCK,whitelist:[1,2,3,4,5,6,7,8]}),GU=class extends vV{static blotName=`blockquote`;static tagName=`blockquote`},KU=class extends vV{static blotName=`header`;static tagName=[`H1`,`H2`,`H3`,`H4`,`H5`,`H6`];static formats(e){return this.tagName.indexOf(e.tagName)+1}},qU=class extends dH{};qU.blotName=`list-container`,qU.tagName=`OL`;var JU=class extends vV{static create(e){let t=super.create();return t.setAttribute(`data-list`,e),t}static formats(e){return e.getAttribute(`data-list`)||void 0}static register(){$.register(qU)}constructor(e,t){super(e,t);let n=t.ownerDocument.createElement(`span`),r=n=>{if(!e.isEnabled())return;let r=this.statics.formats(t,e);r===`checked`?(this.format(`list`,`unchecked`),n.preventDefault()):r===`unchecked`&&(this.format(`list`,`checked`),n.preventDefault())};n.addEventListener(`mousedown`,r),n.addEventListener(`touchstart`,r),this.attachUI(n)}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute(`data-list`,t):super.format(e,t)}};JU.blotName=`list`,JU.tagName=`LI`,qU.allowedChildren=[JU],JU.requiredContainer=qU;var YU=class extends gV{static blotName=`bold`;static tagName=[`STRONG`,`B`];static create(){return super.create()}static formats(){return!0}optimize(e){super.optimize(e),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}},XU=class extends YU{static blotName=`italic`;static tagName=[`EM`,`I`]},ZU=class extends gV{static blotName=`link`;static tagName=`A`;static SANITIZED_URL=`about:blank`;static PROTOCOL_WHITELIST=[`http`,`https`,`mailto`,`tel`,`sms`];static create(e){let t=super.create(e);return t.setAttribute(`href`,this.sanitize(e)),t.setAttribute(`rel`,`noopener noreferrer`),t.setAttribute(`target`,`_blank`),t}static formats(e){return e.getAttribute(`href`)}static sanitize(e){return QU(e,this.PROTOCOL_WHITELIST)?e:this.SANITIZED_URL}format(e,t){e!==this.statics.blotName||!t?super.format(e,t):this.domNode.setAttribute(`href`,this.constructor.sanitize(t))}};function QU(e,t){let n=document.createElement(`a`);n.href=e;let r=n.href.slice(0,n.href.indexOf(`:`));return t.indexOf(r)>-1}var $U=class extends gV{static blotName=`script`;static tagName=[`SUB`,`SUP`];static create(e){return e===`super`?document.createElement(`sup`):e===`sub`?document.createElement(`sub`):super.create(e)}static formats(e){if(e.tagName===`SUB`)return`sub`;if(e.tagName===`SUP`)return`super`}},eW=class extends YU{static blotName=`strike`;static tagName=[`S`,`STRIKE`]},tW=class extends gV{static blotName=`underline`;static tagName=`U`},nW=class extends GV{static blotName=`formula`;static className=`ql-formula`;static tagName=`SPAN`;static create(e){if(window.katex==null)throw Error(`Formula module requires KaTeX.`);let t=super.create(e);return typeof e==`string`&&(window.katex.render(e,t,{throwOnError:!1,errorColor:`#f00`}),t.setAttribute(`data-value`,e)),t}static value(e){return e.getAttribute(`data-value`)}html(){let{formula:e}=this.value();return`<span>${e}</span>`}},rW=[`alt`,`height`,`width`],iW=class extends $B{static blotName=`image`;static tagName=`IMG`;static create(e){let t=super.create(e);return typeof e==`string`&&t.setAttribute(`src`,this.sanitize(e)),t}static formats(e){return rW.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t),{})}static match(e){return/\.(jpe?g|gif|png)$/.test(e)||/^data:image\/.+;base64/.test(e)}static sanitize(e){return QU(e,[`http`,`https`,`data`])?e:`//:0`}static value(e){return e.getAttribute(`src`)}format(e,t){rW.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}},aW=[`height`,`width`],oW=class extends yV{static blotName=`video`;static className=`ql-video`;static tagName=`IFRAME`;static create(e){let t=super.create(e);return t.setAttribute(`frameborder`,`0`),t.setAttribute(`allowfullscreen`,`true`),t.setAttribute(`src`,this.sanitize(e)),t}static formats(e){return aW.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t),{})}static sanitize(e){return ZU.sanitize(e)}static value(e){return e.getAttribute(`src`)}format(e,t){aW.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}html(){let{video:e}=this.value();return`<a href="${e}">${e}</a>`}},sW=new PB(`code-token`,`hljs`,{scope:X.INLINE}),cW=class e extends gV{static formats(e,t){for(;e!=null&&e!==t.domNode;){if(e.classList&&e.classList.contains(EH.className))return super.formats(e,t);e=e.parentNode}}constructor(e,t,n){super(e,t,n),sW.add(this.domNode,n)}format(t,n){t===e.blotName?n?sW.add(this.domNode,n):(sW.remove(this.domNode),this.domNode.classList.remove(this.statics.className)):super.format(t,n)}optimize(){super.optimize(...arguments),sW.value(this.domNode)||this.unwrap()}};cW.blotName=`code-token`,cW.className=`ql-token`;var lW=class extends EH{static create(e){let t=super.create(e);return typeof e==`string`&&t.setAttribute(`data-language`,e),t}static formats(e){return e.getAttribute(`data-language`)||`plain`}static register(){}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute(`data-language`,t):super.format(e,t)}replaceWith(e,t){return this.formatAt(0,this.length(),cW.blotName,!1),super.replaceWith(e,t)}},uW=class extends TH{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(e,t){e===lW.blotName&&(this.forceNext=!0,this.children.forEach(n=>{n.format(e,t)}))}formatAt(e,t,n,r){n===lW.blotName&&(this.forceNext=!0),super.formatAt(e,t,n,r)}highlight(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(this.children.head==null)return;let n=`${Array.from(this.domNode.childNodes).filter(e=>e!==this.uiNode).map(e=>e.textContent).join(`
427
+ `)}\n`,r=lW.formats(this.children.head.domNode);if(t||this.forceNext||this.cachedText!==n){if(n.trim().length>0||this.cachedText==null){let t=this.children.reduce((e,t)=>e.concat(bV(t,!1)),new Z.default),i=e(n,r);t.diff(i).reduce((e,t)=>{let{retain:n,attributes:r}=t;return n?(r&&Object.keys(r).forEach(t=>{[lW.blotName,cW.blotName].includes(t)&&this.formatAt(e,n,t,r[t])}),e+n):e},0)}this.cachedText=n,this.forceNext=!1}}html(e,t){let[n]=this.children.find(e);return`<pre data-language="${n?lW.formats(n.domNode):`plain`}">\n${hV(this.code(e,t))}\n</pre>`}optimize(e){if(super.optimize(e),this.parent!=null&&this.children.head!=null&&this.uiNode!=null){let e=lW.formats(this.children.head.domNode);e!==this.uiNode.value&&(this.uiNode.value=e)}}};uW.allowedChildren=[lW],lW.requiredContainer=uW,lW.allowedChildren=[cW,SV,pV,fV];var dW=(e,t,n)=>{if(typeof e.versionString==`string`){let r=e.versionString.split(`.`)[0];if(parseInt(r,10)>=11)return e.highlight(n,{language:t}).value}return e.highlight(t,n).value},fW=class extends UV{static register(){$.register(cW,!0),$.register(lW,!0),$.register(uW,!0)}constructor(e,t){if(super(e,t),this.options.hljs==null)throw Error(`Syntax module requires highlight.js. Please include the library on the page before Quill.`);this.languages=this.options.languages.reduce((e,t)=>{let{key:n}=t;return e[n]=!0,e},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on($.events.SCROLL_BLOT_MOUNT,e=>{if(!(e instanceof uW))return;let t=this.quill.root.ownerDocument.createElement(`select`);this.options.languages.forEach(e=>{let{key:n,label:r}=e,i=t.ownerDocument.createElement(`option`);i.textContent=r,i.setAttribute(`value`,n),t.appendChild(i)}),t.addEventListener(`change`,()=>{e.format(lW.blotName,t.value),this.quill.root.focus(),this.highlight(e,!0)}),e.uiNode??(e.attachUI(t),e.children.head&&(t.value=lW.formats(e.children.head.domNode)))})}initTimer(){let e=null;this.quill.on($.events.SCROLL_OPTIMIZE,()=>{e&&clearTimeout(e),e=setTimeout(()=>{this.highlight(),e=null},this.options.interval)})}highlight(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(this.quill.selection.composing)return;this.quill.update($.sources.USER);let n=this.quill.getSelection();(e==null?this.quill.scroll.descendants(uW):[e]).forEach(e=>{e.highlight(this.highlightBlot,t)}),this.quill.update($.sources.SILENT),n!=null&&this.quill.setSelection(n,$.sources.SILENT)}highlightBlot(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`plain`;if(t=this.languages[t]?t:`plain`,t===`plain`)return hV(e).split(`
428
+ `).reduce((e,n,r)=>(r!==0&&e.insert(`
429
+ `,{[EH.blotName]:t}),e.insert(n)),new Z.default);let n=this.quill.root.ownerDocument.createElement(`div`);return n.classList.add(EH.className),n.innerHTML=dW(this.options.hljs,t,e),vU(this.quill.scroll,n,[(e,t)=>{let n=sW.value(e);return n?t.compose(new Z.default().retain(t.length(),{[cW.blotName]:n})):t}],[(e,n)=>e.data.split(`
430
+ `).reduce((e,n,r)=>(r!==0&&e.insert(`
431
+ `,{[EH.blotName]:t}),e.insert(n)),n)],new WeakMap)}};fW.DEFAULTS={hljs:window.hljs,interval:1e3,languages:[{key:`plain`,label:`Plain`},{key:`bash`,label:`Bash`},{key:`cpp`,label:`C++`},{key:`cs`,label:`C#`},{key:`css`,label:`CSS`},{key:`diff`,label:`Diff`},{key:`xml`,label:`HTML/XML`},{key:`java`,label:`Java`},{key:`javascript`,label:`JavaScript`},{key:`markdown`,label:`Markdown`},{key:`php`,label:`PHP`},{key:`python`,label:`Python`},{key:`ruby`,label:`Ruby`},{key:`sql`,label:`SQL`}]};var pW=class e extends vV{static blotName=`table`;static tagName=`TD`;static create(e){let t=super.create();return e?t.setAttribute(`data-row`,e):t.setAttribute(`data-row`,_W()),t}static formats(e){if(e.hasAttribute(`data-row`))return e.getAttribute(`data-row`)}cellOffset(){return this.parent?this.parent.children.indexOf(this):-1}format(t,n){t===e.blotName&&n?this.domNode.setAttribute(`data-row`,n):super.format(t,n)}row(){return this.parent}rowOffset(){return this.row()?this.row().rowOffset():-1}table(){return this.row()&&this.row().table()}},mW=class extends dH{static blotName=`table-row`;static tagName=`TR`;checkMerge(){if(super.checkMerge()&&this.next.children.head!=null){let e=this.children.head.formats(),t=this.children.tail.formats(),n=this.next.children.head.formats(),r=this.next.children.tail.formats();return e.table===t.table&&e.table===n.table&&e.table===r.table}return!1}optimize(e){super.optimize(e),this.children.forEach(e=>{if(e.next==null)return;let t=e.formats(),n=e.next.formats();if(t.table!==n.table){let t=this.splitAfter(e);t&&t.optimize(),this.prev&&this.prev.optimize()}})}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}},hW=class extends dH{static blotName=`table-body`;static tagName=`TBODY`},gW=class extends dH{static blotName=`table-container`;static tagName=`TABLE`;balanceCells(){let e=this.descendants(mW),t=e.reduce((e,t)=>Math.max(t.children.length,e),0);e.forEach(e=>{Array(t-e.children.length).fill(0).forEach(()=>{let t;e.children.head!=null&&(t=pW.formats(e.children.head.domNode));let n=this.scroll.create(pW.blotName,t);e.appendChild(n),n.optimize()})})}cells(e){return this.rows().map(t=>t.children.at(e))}deleteColumn(e){let[t]=this.descendant(hW);t!=null&&t.children.head!=null&&t.children.forEach(t=>{t.children.at(e)?.remove()})}insertColumn(e){let[t]=this.descendant(hW);t!=null&&t.children.head!=null&&t.children.forEach(t=>{let n=t.children.at(e),r=pW.formats(t.children.head.domNode),i=this.scroll.create(pW.blotName,r);t.insertBefore(i,n)})}insertRow(e){let[t]=this.descendant(hW);if(t==null||t.children.head==null)return;let n=_W(),r=this.scroll.create(mW.blotName);t.children.head.children.forEach(()=>{let e=this.scroll.create(pW.blotName,n);r.appendChild(e)});let i=t.children.at(e);t.insertBefore(r,i)}rows(){let e=this.children.head;return e==null?[]:e.children.map(e=>e)}};gW.allowedChildren=[hW],hW.requiredContainer=gW,hW.allowedChildren=[mW],mW.requiredContainer=hW,mW.allowedChildren=[pW],pW.requiredContainer=mW;function _W(){return`row-${Math.random().toString(36).slice(2,6)}`}var vW=class extends UV{static register(){$.register(pW),$.register(mW),$.register(hW),$.register(gW)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(gW).forEach(e=>{e.balanceCells()})}deleteColumn(){let[e,,t]=this.getTable();t!=null&&(e.deleteColumn(t.cellOffset()),this.quill.update($.sources.USER))}deleteRow(){let[,e]=this.getTable();e!=null&&(e.remove(),this.quill.update($.sources.USER))}deleteTable(){let[e]=this.getTable();if(e==null)return;let t=e.offset();e.remove(),this.quill.update($.sources.USER),this.quill.setSelection(t,$.sources.SILENT)}getTable(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.quill.getSelection();if(e==null)return[null,null,null,-1];let[t,n]=this.quill.getLine(e.index);if(t==null||t.statics.blotName!==pW.blotName)return[null,null,null,-1];let r=t.parent;return[r.parent.parent,r,t,n]}insertColumn(e){let t=this.quill.getSelection();if(!t)return;let[n,r,i]=this.getTable(t);if(i==null)return;let a=i.cellOffset();n.insertColumn(a+e),this.quill.update($.sources.USER);let o=r.rowOffset();e===0&&(o+=1),this.quill.setSelection(t.index+o,t.length,$.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(e){let t=this.quill.getSelection();if(!t)return;let[n,r,i]=this.getTable(t);if(i==null)return;let a=r.rowOffset();n.insertRow(a+e),this.quill.update($.sources.USER),e>0?this.quill.setSelection(t,$.sources.SILENT):this.quill.setSelection(t.index+r.children.length,t.length,$.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(e,t){let n=this.quill.getSelection();if(n==null)return;let r=Array(e).fill(0).reduce(e=>{let n=Array(t).fill(`
432
+ `).join(``);return e.insert(n,{table:_W()})},new Z.default().retain(n.index));this.quill.updateContents(r,$.sources.USER),this.quill.setSelection(n.index,$.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on($.events.SCROLL_OPTIMIZE,e=>{e.some(e=>[`TD`,`TR`,`TBODY`,`TABLE`].includes(e.target.tagName)?(this.quill.once($.events.TEXT_CHANGE,(e,t,n)=>{n===$.sources.USER&&this.balanceTables()}),!0):!1)})}},yW=OV(`quill:toolbar`),bW=class extends UV{constructor(e,t){if(super(e,t),Array.isArray(this.options.container)){let t=document.createElement(`div`);t.setAttribute(`role`,`toolbar`),SW(t,this.options.container),e.container?.parentNode?.insertBefore(t,e.container),this.container=t}else this.container=typeof this.options.container==`string`?document.querySelector(this.options.container):this.options.container;if(!(this.container instanceof HTMLElement)){yW.error(`Container required for toolbar`,this.options);return}this.container.classList.add(`ql-toolbar`),this.controls=[],this.handlers={},this.options.handlers&&Object.keys(this.options.handlers).forEach(e=>{let t=this.options.handlers?.[e];t&&this.addHandler(e,t)}),Array.from(this.container.querySelectorAll(`button, select`)).forEach(e=>{this.attach(e)}),this.quill.on($.events.EDITOR_CHANGE,()=>{let[e]=this.quill.selection.getRange();this.update(e)})}addHandler(e,t){this.handlers[e]=t}attach(e){let t=Array.from(e.classList).find(e=>e.indexOf(`ql-`)===0);if(!t)return;if(t=t.slice(3),e.tagName===`BUTTON`&&e.setAttribute(`type`,`button`),this.handlers[t]==null&&this.quill.scroll.query(t)==null){yW.warn(`ignoring attaching to nonexistent format`,t,e);return}let n=e.tagName===`SELECT`?`change`:`click`;e.addEventListener(n,n=>{let r;if(e.tagName===`SELECT`){if(e.selectedIndex<0)return;let t=e.options[e.selectedIndex];r=t.hasAttribute(`selected`)?!1:t.value||!1}else r=e.classList.contains(`ql-active`)?!1:e.value||!e.hasAttribute(`value`),n.preventDefault();this.quill.focus();let[i]=this.quill.selection.getRange();if(this.handlers[t]!=null)this.handlers[t].call(this,r);else if(this.quill.scroll.query(t).prototype instanceof $B){if(r=prompt(`Enter ${t}`),!r)return;this.quill.updateContents(new Z.default().retain(i.index).delete(i.length).insert({[t]:r}),$.sources.USER)}else this.quill.format(t,r,$.sources.USER);this.update(i)}),this.controls.push([t,e])}update(e){let t=e==null?{}:this.quill.getFormat(e);this.controls.forEach(n=>{let[r,i]=n;if(i.tagName===`SELECT`){let n=null;if(e==null)n=null;else if(t[r]==null)n=i.querySelector(`option[selected]`);else if(!Array.isArray(t[r])){let e=t[r];typeof e==`string`&&(e=e.replace(/"/g,`\\"`)),n=i.querySelector(`option[value="${e}"]`)}n==null?(i.value=``,i.selectedIndex=-1):n.selected=!0}else if(e==null)i.classList.remove(`ql-active`),i.setAttribute(`aria-pressed`,`false`);else if(i.hasAttribute(`value`)){let e=t[r],n=e===i.getAttribute(`value`)||e!=null&&e.toString()===i.getAttribute(`value`)||e==null&&!i.getAttribute(`value`);i.classList.toggle(`ql-active`,n),i.setAttribute(`aria-pressed`,n.toString())}else{let e=t[r]!=null;i.classList.toggle(`ql-active`,e),i.setAttribute(`aria-pressed`,e.toString())}})}};bW.DEFAULTS={};function xW(e,t,n){let r=document.createElement(`button`);r.setAttribute(`type`,`button`),r.classList.add(`ql-${t}`),r.setAttribute(`aria-pressed`,`false`),n==null?r.setAttribute(`aria-label`,t):(r.value=n,r.setAttribute(`aria-label`,`${t}: ${n}`)),e.appendChild(r)}function SW(e,t){Array.isArray(t[0])||(t=[t]),t.forEach(t=>{let n=document.createElement(`span`);n.classList.add(`ql-formats`),t.forEach(e=>{if(typeof e==`string`)xW(n,e);else{let t=Object.keys(e)[0],r=e[t];Array.isArray(r)?CW(n,t,r):xW(n,t,r)}}),e.appendChild(n)})}function CW(e,t,n){let r=document.createElement(`select`);r.classList.add(`ql-${t}`),n.forEach(e=>{let t=document.createElement(`option`);e===!1?t.setAttribute(`selected`,`selected`):t.setAttribute(`value`,String(e)),r.appendChild(t)}),e.appendChild(r)}bW.DEFAULTS={container:null,handlers:{clean(){let e=this.quill.getSelection();if(e!=null){if(e.length===0){let e=this.quill.getFormat();Object.keys(e).forEach(e=>{this.quill.scroll.query(e,X.INLINE)!=null&&this.quill.format(e,!1,$.sources.USER)})}else this.quill.removeFormat(e.index,e.length,$.sources.USER)}},direction(e){let{align:t}=this.quill.getFormat();e===`rtl`&&t==null?this.quill.format(`align`,`right`,$.sources.USER):!e&&t===`right`&&this.quill.format(`align`,!1,$.sources.USER),this.quill.format(`direction`,e,$.sources.USER)},indent(e){let t=this.quill.getSelection(),n=this.quill.getFormat(t),r=parseInt(n.indent||0,10);if(e===`+1`||e===`-1`){let t=e===`+1`?1:-1;n.direction===`rtl`&&(t*=-1),this.quill.format(`indent`,r+t,$.sources.USER)}},link(e){e===!0&&(e=prompt(`Enter link URL:`)),this.quill.format(`link`,e,$.sources.USER)},list(e){let t=this.quill.getSelection(),n=this.quill.getFormat(t);e===`check`?n.list===`checked`||n.list===`unchecked`?this.quill.format(`list`,!1,$.sources.USER):this.quill.format(`list`,`unchecked`,$.sources.USER):this.quill.format(`list`,e,$.sources.USER)}}};var wW=`<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="13" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="9" y1="4" y2="4"/></svg>`,TW=`<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="14" x2="4" y1="14" y2="14"/><line class="ql-stroke" x1="12" x2="6" y1="4" y2="4"/></svg>`,EW=`<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="5" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="9" y1="4" y2="4"/></svg>`,DW=`<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="3" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="3" y1="4" y2="4"/></svg>`,OW=`<svg viewbox="0 0 18 18"><g class="ql-fill ql-color-label"><polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"/><rect height="1" width="1" x="4" y="4"/><polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"/><rect height="1" width="1" x="2" y="6"/><rect height="1" width="1" x="3" y="5"/><rect height="1" width="1" x="4" y="7"/><polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"/><rect height="1" width="1" x="2" y="12"/><rect height="1" width="1" x="2" y="9"/><rect height="1" width="1" x="2" y="15"/><polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"/><rect height="1" width="1" x="3" y="8"/><path d="M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z"/><path d="M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z"/><path d="M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z"/><rect height="1" width="1" x="12" y="2"/><rect height="1" width="1" x="11" y="3"/><path d="M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z"/><rect height="1" width="1" x="2" y="3"/><rect height="1" width="1" x="6" y="2"/><rect height="1" width="1" x="3" y="2"/><rect height="1" width="1" x="5" y="3"/><rect height="1" width="1" x="9" y="2"/><rect height="1" width="1" x="15" y="14"/><polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"/><rect height="1" width="1" x="13" y="7"/><rect height="1" width="1" x="15" y="5"/><rect height="1" width="1" x="14" y="6"/><rect height="1" width="1" x="15" y="8"/><rect height="1" width="1" x="14" y="9"/><path d="M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z"/><rect height="1" width="1" x="14" y="3"/><polygon points="12 6.868 12 6 11.62 6 12 6.868"/><rect height="1" width="1" x="15" y="2"/><rect height="1" width="1" x="12" y="5"/><rect height="1" width="1" x="13" y="4"/><polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"/><rect height="1" width="1" x="9" y="14"/><rect height="1" width="1" x="8" y="15"/><path d="M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z"/><rect height="1" width="1" x="5" y="15"/><path d="M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z"/><rect height="1" width="1" x="11" y="15"/><path d="M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z"/><rect height="1" width="1" x="14" y="15"/><rect height="1" width="1" x="15" y="11"/></g><polyline class="ql-stroke" points="5.5 13 9 5 12.5 13"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="11" y2="11"/></svg>`,kW=`<svg viewbox="0 0 18 18"><rect class="ql-fill ql-stroke" height="3" width="3" x="4" y="5"/><rect class="ql-fill ql-stroke" height="3" width="3" x="11" y="5"/><path class="ql-even ql-fill ql-stroke" d="M7,8c0,4.031-3,5-3,5"/><path class="ql-even ql-fill ql-stroke" d="M14,8c0,4.031-3,5-3,5"/></svg>`,AW=`<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z"/><path class="ql-stroke" d="M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z"/></svg>`,jW=`<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="5" x2="13" y1="3" y2="3"/><line class="ql-stroke" x1="6" x2="9.35" y1="12" y2="3"/><line class="ql-stroke" x1="11" x2="15" y1="11" y2="15"/><line class="ql-stroke" x1="15" x2="11" y1="11" y2="15"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="7" x="2" y="14"/></svg>`,MW=`<svg viewbox="0 0 18 18"><polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"/><polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"/><line class="ql-stroke" x1="10" x2="8" y1="5" y2="13"/></svg>`,NW={align:{"":wW,center:TW,right:EW,justify:DW},background:OW,blockquote:kW,bold:AW,clean:jW,code:MW,"code-block":MW,color:`<svg viewbox="0 0 18 18"><line class="ql-color-label ql-stroke ql-transparent" x1="3" x2="15" y1="15" y2="15"/><polyline class="ql-stroke" points="5.5 11 9 3 12.5 11"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="9" y2="9"/></svg>`,direction:{"":`<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"/><line class="ql-stroke ql-fill" x1="15" x2="11" y1="4" y2="4"/><path class="ql-fill" d="M11,3a3,3,0,0,0,0,6h1V3H11Z"/><rect class="ql-fill" height="11" width="1" x="11" y="4"/><rect class="ql-fill" height="11" width="1" x="13" y="4"/></svg>`,rtl:`<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"/><line class="ql-stroke ql-fill" x1="9" x2="5" y1="4" y2="4"/><path class="ql-fill" d="M5,3A3,3,0,0,0,5,9H6V3H5Z"/><rect class="ql-fill" height="11" width="1" x="5" y="4"/><rect class="ql-fill" height="11" width="1" x="7" y="4"/></svg>`},formula:`<svg viewbox="0 0 18 18"><path class="ql-fill" d="M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z"/><rect class="ql-fill" height="1.6" rx="0.8" ry="0.8" width="5" x="5.15" y="6.2"/><path class="ql-fill" d="M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z"/></svg>`,header:{1:`<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z"/></svg>`,2:`<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>`,3:`<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.65186,12.30664a2.6742,2.6742,0,0,1-2.915,2.68457,3.96592,3.96592,0,0,1-2.25537-.6709.56007.56007,0,0,1-.13232-.83594L11.64648,13c.209-.34082.48389-.36328.82471-.1543a2.32654,2.32654,0,0,0,1.12256.33008c.71484,0,1.12207-.35156,1.12207-.78125,0-.61523-.61621-.86816-1.46338-.86816H13.2085a.65159.65159,0,0,1-.68213-.41895l-.05518-.10937a.67114.67114,0,0,1,.14307-.78125l.71533-.86914a8.55289,8.55289,0,0,1,.68213-.7373V8.58887a3.93913,3.93913,0,0,1-.748.05469H11.9873a.54085.54085,0,0,1-.605-.60547V7.59863a.54085.54085,0,0,1,.605-.60547h3.75146a.53773.53773,0,0,1,.60547.59375v.17676a1.03723,1.03723,0,0,1-.27539.748L14.74854,10.0293A2.31132,2.31132,0,0,1,16.65186,12.30664ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>`,4:`<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm7.05371,7.96582v.38477c0,.39648-.165.60547-.46191.60547h-.47314v1.29785a.54085.54085,0,0,1-.605.60547h-.69336a.54085.54085,0,0,1-.605-.60547V12.95605H11.333a.5412.5412,0,0,1-.60547-.60547v-.15332a1.199,1.199,0,0,1,.22021-.748l2.56348-4.05957a.7819.7819,0,0,1,.72607-.39648h1.27637a.54085.54085,0,0,1,.605.60547v3.7627h.33008A.54055.54055,0,0,1,17.05371,11.96582ZM14.28125,8.7207h-.022a4.18969,4.18969,0,0,1-.38525.81348l-1.188,1.80469v.02246h1.5293V9.60059A7.04058,7.04058,0,0,1,14.28125,8.7207Z"/></svg>`,5:`<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.74023,12.18555a2.75131,2.75131,0,0,1-2.91553,2.80566,3.908,3.908,0,0,1-2.25537-.68164.54809.54809,0,0,1-.13184-.8252L11.73438,13c.209-.34082.48389-.36328.8252-.1543a2.23757,2.23757,0,0,0,1.1001.33008,1.01827,1.01827,0,0,0,1.1001-.96777c0-.61621-.53906-.97949-1.25439-.97949a2.15554,2.15554,0,0,0-.64893.09961,1.15209,1.15209,0,0,1-.814.01074l-.12109-.04395a.64116.64116,0,0,1-.45117-.71484l.231-3.00391a.56666.56666,0,0,1,.62744-.583H15.541a.54085.54085,0,0,1,.605.60547v.43945a.54085.54085,0,0,1-.605.60547H13.41748l-.04395.72559a1.29306,1.29306,0,0,1-.04395.30859h.022a2.39776,2.39776,0,0,1,.57227-.07715A2.53266,2.53266,0,0,1,16.74023,12.18555ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>`,6:`<svg viewBox="0 0 18 18"><path class="ql-fill" d="M14.51758,9.64453a1.85627,1.85627,0,0,0-1.24316.38477H13.252a1.73532,1.73532,0,0,1,1.72754-1.4082,2.66491,2.66491,0,0,1,.5498.06641c.35254.05469.57227.01074.70508-.40723l.16406-.5166a.53393.53393,0,0,0-.373-.75977,4.83723,4.83723,0,0,0-1.17773-.14258c-2.43164,0-3.7627,2.17773-3.7627,4.43359,0,2.47559,1.60645,3.69629,3.19043,3.69629A2.70585,2.70585,0,0,0,16.96,12.19727,2.43861,2.43861,0,0,0,14.51758,9.64453Zm-.23047,3.58691c-.67187,0-1.22168-.81445-1.22168-1.45215,0-.47363.30762-.583.72559-.583.96875,0,1.27734.59375,1.27734,1.12207A.82182.82182,0,0,1,14.28711,13.23145ZM10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Z"/></svg>`},italic:`<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="13" y1="4" y2="4"/><line class="ql-stroke" x1="5" x2="11" y1="14" y2="14"/><line class="ql-stroke" x1="8" x2="10" y1="14" y2="4"/></svg>`,image:`<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="10" width="12" x="3" y="4"/><circle class="ql-fill" cx="6" cy="7" r="1"/><polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"/></svg>`,indent:{"+1":`<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"/></svg>`,"-1":`<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="5 7 5 11 3 9 5 7"/></svg>`},link:`<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="11" y1="7" y2="11"/><path class="ql-even ql-stroke" d="M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z"/><path class="ql-even ql-stroke" d="M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z"/></svg>`,list:{bullet:`<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="6" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="6" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="6" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="3" y1="4" y2="4"/><line class="ql-stroke" x1="3" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="3" y1="14" y2="14"/></svg>`,check:`<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="9" x2="15" y1="4" y2="4"/><polyline class="ql-stroke" points="3 4 4 5 6 3"/><line class="ql-stroke" x1="9" x2="15" y1="14" y2="14"/><polyline class="ql-stroke" points="3 14 4 15 6 13"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="3 9 4 10 6 8"/></svg>`,ordered:`<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="7" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="7" x2="15" y1="14" y2="14"/><line class="ql-stroke ql-thin" x1="2.5" x2="4.5" y1="5.5" y2="5.5"/><path class="ql-fill" d="M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z"/><path class="ql-stroke ql-thin" d="M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156"/><path class="ql-stroke ql-thin" d="M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109"/></svg>`},script:{sub:`<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z"/><path class="ql-fill" d="M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z"/></svg>`,super:`<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z"/><path class="ql-fill" d="M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z"/></svg>`},strike:`<svg viewbox="0 0 18 18"><line class="ql-stroke ql-thin" x1="15.5" x2="2.5" y1="8.5" y2="9.5"/><path class="ql-fill" d="M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z"/><path class="ql-fill" d="M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z"/></svg>`,table:`<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="2" width="3" x="5" y="5"/><rect class="ql-fill" height="2" width="4" x="9" y="5"/><g class="ql-fill ql-transparent"><rect height="2" width="3" x="5" y="8"/><rect height="2" width="4" x="9" y="8"/><rect height="2" width="3" x="5" y="11"/><rect height="2" width="4" x="9" y="11"/></g></svg>`,underline:`<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="12" x="3" y="15"/></svg>`,video:`<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="12" width="1" x="5" y="3"/><rect class="ql-fill" height="12" width="1" x="12" y="3"/><rect class="ql-fill" height="2" width="8" x="5" y="8"/><rect class="ql-fill" height="1" width="3" x="3" y="5"/><rect class="ql-fill" height="1" width="3" x="3" y="7"/><rect class="ql-fill" height="1" width="3" x="3" y="10"/><rect class="ql-fill" height="1" width="3" x="3" y="12"/><rect class="ql-fill" height="1" width="3" x="12" y="5"/><rect class="ql-fill" height="1" width="3" x="12" y="7"/><rect class="ql-fill" height="1" width="3" x="12" y="10"/><rect class="ql-fill" height="1" width="3" x="12" y="12"/></svg>`},PW=`<svg viewbox="0 0 18 18"><polygon class="ql-stroke" points="7 11 9 13 11 11 7 11"/><polygon class="ql-stroke" points="7 7 9 5 11 7 7 7"/></svg>`,FW=0;function IW(e,t){e.setAttribute(t,`${e.getAttribute(t)!==`true`}`)}var LW=class{constructor(e){this.select=e,this.container=document.createElement(`span`),this.buildPicker(),this.select.style.display=`none`,this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener(`mousedown`,()=>{this.togglePicker()}),this.label.addEventListener(`keydown`,e=>{switch(e.key){case`Enter`:this.togglePicker();break;case`Escape`:this.escape(),e.preventDefault()}}),this.select.addEventListener(`change`,this.update.bind(this))}togglePicker(){this.container.classList.toggle(`ql-expanded`),IW(this.label,`aria-expanded`),IW(this.options,`aria-hidden`)}buildItem(e){let t=document.createElement(`span`);t.tabIndex=`0`,t.setAttribute(`role`,`button`),t.classList.add(`ql-picker-item`);let n=e.getAttribute(`value`);return n&&t.setAttribute(`data-value`,n),e.textContent&&t.setAttribute(`data-label`,e.textContent),t.addEventListener(`click`,()=>{this.selectItem(t,!0)}),t.addEventListener(`keydown`,e=>{switch(e.key){case`Enter`:this.selectItem(t,!0),e.preventDefault();break;case`Escape`:this.escape(),e.preventDefault()}}),t}buildLabel(){let e=document.createElement(`span`);return e.classList.add(`ql-picker-label`),e.innerHTML=PW,e.tabIndex=`0`,e.setAttribute(`role`,`button`),e.setAttribute(`aria-expanded`,`false`),this.container.appendChild(e),e}buildOptions(){let e=document.createElement(`span`);e.classList.add(`ql-picker-options`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=`-1`,e.id=`ql-picker-options-${FW}`,FW+=1,this.label.setAttribute(`aria-controls`,e.id),this.options=e,Array.from(this.select.options).forEach(t=>{let n=this.buildItem(t);e.appendChild(n),t.selected===!0&&this.selectItem(n)}),this.container.appendChild(e)}buildPicker(){Array.from(this.select.attributes).forEach(e=>{this.container.setAttribute(e.name,e.value)}),this.container.classList.add(`ql-picker`),this.label=this.buildLabel(),this.buildOptions()}escape(){this.close(),setTimeout(()=>this.label.focus(),1)}close(){this.container.classList.remove(`ql-expanded`),this.label.setAttribute(`aria-expanded`,`false`),this.options.setAttribute(`aria-hidden`,`true`)}selectItem(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1],n=this.container.querySelector(`.ql-selected`);e!==n&&(n?.classList.remove(`ql-selected`),e!=null&&(e.classList.add(`ql-selected`),this.select.selectedIndex=Array.from(e.parentNode.children).indexOf(e),e.hasAttribute(`data-value`)?this.label.setAttribute(`data-value`,e.getAttribute(`data-value`)):this.label.removeAttribute(`data-value`),e.hasAttribute(`data-label`)?this.label.setAttribute(`data-label`,e.getAttribute(`data-label`)):this.label.removeAttribute(`data-label`),t&&(this.select.dispatchEvent(new Event(`change`)),this.close())))}update(){let e;if(this.select.selectedIndex>-1){let t=this.container.querySelector(`.ql-picker-options`).children[this.select.selectedIndex];e=this.select.options[this.select.selectedIndex],this.selectItem(t)}else this.selectItem(null);let t=e!=null&&e!==this.select.querySelector(`option[selected]`);this.label.classList.toggle(`ql-active`,t)}},RW=class extends LW{constructor(e,t){super(e),this.label.innerHTML=t,this.container.classList.add(`ql-color-picker`),Array.from(this.container.querySelectorAll(`.ql-picker-item`)).slice(0,7).forEach(e=>{e.classList.add(`ql-primary`)})}buildItem(e){let t=super.buildItem(e);return t.style.backgroundColor=e.getAttribute(`value`)||``,t}selectItem(e,t){super.selectItem(e,t);let n=this.label.querySelector(`.ql-color-label`),r=e&&e.getAttribute(`data-value`)||``;n&&(n.tagName===`line`?n.style.stroke=r:n.style.fill=r)}},zW=class extends LW{constructor(e,t){super(e),this.container.classList.add(`ql-icon-picker`),Array.from(this.container.querySelectorAll(`.ql-picker-item`)).forEach(e=>{e.innerHTML=t[e.getAttribute(`data-value`)||``]}),this.defaultItem=this.container.querySelector(`.ql-selected`),this.selectItem(this.defaultItem)}selectItem(e,t){super.selectItem(e,t);let n=e||this.defaultItem;if(n!=null){if(this.label.innerHTML===n.innerHTML)return;this.label.innerHTML=n.innerHTML}}},BW=e=>{let{overflowY:t}=getComputedStyle(e,null);return t!==`visible`&&t!==`clip`},VW=class{constructor(e,t){this.quill=e,this.boundsContainer=t||document.body,this.root=e.addContainer(`ql-tooltip`),this.root.innerHTML=this.constructor.TEMPLATE,BW(this.quill.root)&&this.quill.root.addEventListener(`scroll`,()=>{this.root.style.marginTop=`${-1*this.quill.root.scrollTop}px`}),this.hide()}hide(){this.root.classList.add(`ql-hidden`)}position(e){let t=e.left+e.width/2-this.root.offsetWidth/2,n=e.bottom+this.quill.root.scrollTop;this.root.style.left=`${t}px`,this.root.style.top=`${n}px`,this.root.classList.remove(`ql-flip`);let r=this.boundsContainer.getBoundingClientRect(),i=this.root.getBoundingClientRect(),a=0;if(i.right>r.right&&(a=r.right-i.right,this.root.style.left=`${t+a}px`),i.left<r.left&&(a=r.left-i.left,this.root.style.left=`${t+a}px`),i.bottom>r.bottom){let t=i.bottom-i.top,r=e.bottom-e.top+t;this.root.style.top=`${n-r}px`,this.root.classList.add(`ql-flip`)}return a}show(){this.root.classList.remove(`ql-editing`),this.root.classList.remove(`ql-hidden`)}},HW=[!1,`center`,`right`,`justify`],UW=`#000000.#e60000.#ff9900.#ffff00.#008a00.#0066cc.#9933ff.#ffffff.#facccc.#ffebcc.#ffffcc.#cce8cc.#cce0f5.#ebd6ff.#bbbbbb.#f06666.#ffc266.#ffff66.#66b966.#66a3e0.#c285ff.#888888.#a10000.#b26b00.#b2b200.#006100.#0047b2.#6b24b2.#444444.#5c0000.#663d00.#666600.#003700.#002966.#3d1466`.split(`.`),WW=[!1,`serif`,`monospace`],GW=[`1`,`2`,`3`,!1],KW=[`small`,!1,`large`,`huge`],qW=class extends qV{constructor(e,t){super(e,t);let n=t=>{if(!document.body.contains(e.root)){document.body.removeEventListener(`click`,n);return}this.tooltip!=null&&!this.tooltip.root.contains(t.target)&&document.activeElement!==this.tooltip.textbox&&!this.quill.hasFocus()&&this.tooltip.hide(),this.pickers!=null&&this.pickers.forEach(e=>{e.container.contains(t.target)||e.close()})};e.emitter.listenDOM(`click`,document.body,n)}addModule(e){let t=super.addModule(e);return e===`toolbar`&&this.extendToolbar(t),t}buildButtons(e,t){Array.from(e).forEach(e=>{(e.getAttribute(`class`)||``).split(/\s+/).forEach(n=>{if(n.startsWith(`ql-`)&&(n=n.slice(3),t[n]!=null)){if(n===`direction`)e.innerHTML=t[n][``]+t[n].rtl;else if(typeof t[n]==`string`)e.innerHTML=t[n];else{let r=e.value||``;r!=null&&t[n][r]&&(e.innerHTML=t[n][r])}}})})}buildPickers(e,t){this.pickers=Array.from(e).map(e=>{if(e.classList.contains(`ql-align`)&&(e.querySelector(`option`)??XW(e,HW),typeof t.align==`object`))return new zW(e,t.align);if(e.classList.contains(`ql-background`)||e.classList.contains(`ql-color`)){let n=e.classList.contains(`ql-background`)?`background`:`color`;return e.querySelector(`option`)??XW(e,UW,n===`background`?`#ffffff`:`#000000`),new RW(e,t[n])}return e.querySelector(`option`)??(e.classList.contains(`ql-font`)?XW(e,WW):e.classList.contains(`ql-header`)?XW(e,GW):e.classList.contains(`ql-size`)&&XW(e,KW)),new LW(e)}),this.quill.on(Q.events.EDITOR_CHANGE,()=>{this.pickers.forEach(e=>{e.update()})})}};qW.DEFAULTS=DB({},qV.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit(`formula`)},image(){let e=this.container.querySelector(`input.ql-image[type=file]`);e??(e=document.createElement(`input`),e.setAttribute(`type`,`file`),e.setAttribute(`accept`,this.quill.uploader.options.mimetypes.join(`, `)),e.classList.add(`ql-image`),e.addEventListener(`change`,()=>{let t=this.quill.getSelection(!0);this.quill.uploader.upload(t,e.files),e.value=``}),this.container.appendChild(e)),e.click()},video(){this.quill.theme.tooltip.edit(`video`)}}}}});var JW=class extends VW{constructor(e,t){super(e,t),this.textbox=this.root.querySelector(`input[type="text"]`),this.listen()}listen(){this.textbox.addEventListener(`keydown`,e=>{e.key===`Enter`?(this.save(),e.preventDefault()):e.key===`Escape`&&(this.cancel(),e.preventDefault())})}cancel(){this.hide(),this.restoreFocus()}edit(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`link`,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(this.root.classList.remove(`ql-hidden`),this.root.classList.add(`ql-editing`),this.textbox==null)return;t==null?e!==this.root.getAttribute(`data-mode`)&&(this.textbox.value=``):this.textbox.value=t;let n=this.quill.getBounds(this.quill.selection.savedRange);n!=null&&this.position(n),this.textbox.select(),this.textbox.setAttribute(`placeholder`,this.textbox.getAttribute(`data-${e}`)||``),this.root.setAttribute(`data-mode`,e)}restoreFocus(){this.quill.focus({preventScroll:!0})}save(){let{value:e}=this.textbox;switch(this.root.getAttribute(`data-mode`)){case`link`:{let{scrollTop:t}=this.quill.root;this.linkRange?(this.quill.formatText(this.linkRange,`link`,e,Q.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format(`link`,e,Q.sources.USER)),this.quill.root.scrollTop=t;break}case`video`:e=YW(e);case`formula`:{if(!e)break;let t=this.quill.getSelection(!0);if(t!=null){let n=t.index+t.length;this.quill.insertEmbed(n,this.root.getAttribute(`data-mode`),e,Q.sources.USER),this.root.getAttribute(`data-mode`)===`formula`&&this.quill.insertText(n+1,` `,Q.sources.USER),this.quill.setSelection(n+2,Q.sources.USER)}break}}this.textbox.value=``,this.hide()}};function YW(e){let t=e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);return t?`${t[1]||`https`}://www.youtube.com/embed/${t[2]}?showinfo=0`:(t=e.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?`${t[1]||`https`}://player.vimeo.com/video/${t[2]}/`:e}function XW(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2];t.forEach(t=>{let r=document.createElement(`option`);t===n?r.setAttribute(`selected`,`selected`):r.setAttribute(`value`,String(t)),e.appendChild(r)})}var ZW=[[`bold`,`italic`,`link`],[{header:1},{header:2},`blockquote`]],QW=class extends JW{static TEMPLATE=[`<span class="ql-tooltip-arrow"></span>`,`<div class="ql-tooltip-editor">`,`<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">`,`<a class="ql-close"></a>`,`</div>`].join(``);constructor(e,t){super(e,t),this.quill.on(Q.events.EDITOR_CHANGE,(e,t,n,r)=>{if(e===Q.events.SELECTION_CHANGE){if(t!=null&&t.length>0&&r===Q.sources.USER){this.show(),this.root.style.left=`0px`,this.root.style.width=``,this.root.style.width=`${this.root.offsetWidth}px`;let e=this.quill.getLines(t.index,t.length);if(e.length===1){let e=this.quill.getBounds(t);e!=null&&this.position(e)}else{let n=e[e.length-1],r=this.quill.getIndex(n),i=Math.min(n.length()-1,t.index+t.length-r),a=this.quill.getBounds(new jV(r,i));a!=null&&this.position(a)}}else document.activeElement!==this.textbox&&this.quill.hasFocus()&&this.hide()}})}listen(){super.listen(),this.root.querySelector(`.ql-close`).addEventListener(`click`,()=>{this.root.classList.remove(`ql-editing`)}),this.quill.on(Q.events.SCROLL_OPTIMIZE,()=>{setTimeout(()=>{if(this.root.classList.contains(`ql-hidden`))return;let e=this.quill.getSelection();if(e!=null){let t=this.quill.getBounds(e);t!=null&&this.position(t)}},1)})}cancel(){this.show()}position(e){let t=super.position(e),n=this.root.querySelector(`.ql-tooltip-arrow`);return n.style.marginLeft=``,t!==0&&(n.style.marginLeft=`${-1*t-n.offsetWidth/2}px`),t}},$W=class extends qW{constructor(e,t){t.modules.toolbar!=null&&t.modules.toolbar.container==null&&(t.modules.toolbar.container=ZW),super(e,t),this.quill.container.classList.add(`ql-bubble`)}extendToolbar(e){this.tooltip=new QW(this.quill,this.options.bounds),e.container!=null&&(this.tooltip.root.appendChild(e.container),this.buildButtons(e.container.querySelectorAll(`button`),NW),this.buildPickers(e.container.querySelectorAll(`select`),NW))}};$W.DEFAULTS=DB({},qW.DEFAULTS,{modules:{toolbar:{handlers:{link(e){e?this.quill.theme.tooltip.edit():this.quill.format(`link`,!1,$.sources.USER)}}}}});var eG=[[{header:[`1`,`2`,`3`,!1]}],[`bold`,`italic`,`underline`,`link`],[{list:`ordered`},{list:`bullet`}],[`clean`]],tG=class extends JW{static TEMPLATE=[`<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>`,`<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">`,`<a class="ql-action"></a>`,`<a class="ql-remove"></a>`].join(``);preview=this.root.querySelector(`a.ql-preview`);listen(){super.listen(),this.root.querySelector(`a.ql-action`).addEventListener(`click`,e=>{this.root.classList.contains(`ql-editing`)?this.save():this.edit(`link`,this.preview.textContent),e.preventDefault()}),this.root.querySelector(`a.ql-remove`).addEventListener(`click`,e=>{if(this.linkRange!=null){let e=this.linkRange;this.restoreFocus(),this.quill.formatText(e,`link`,!1,Q.sources.USER),delete this.linkRange}e.preventDefault(),this.hide()}),this.quill.on(Q.events.SELECTION_CHANGE,(e,t,n)=>{if(e!=null){if(e.length===0&&n===Q.sources.USER){let[t,n]=this.quill.scroll.descendant(ZU,e.index);if(t!=null){this.linkRange=new jV(e.index-n,t.length());let r=ZU.formats(t.domNode);this.preview.textContent=r,this.preview.setAttribute(`href`,r),this.show();let i=this.quill.getBounds(this.linkRange);i!=null&&this.position(i);return}}else delete this.linkRange;this.hide()}})}show(){super.show(),this.root.removeAttribute(`data-mode`)}},nG=class extends qW{constructor(e,t){t.modules.toolbar!=null&&t.modules.toolbar.container==null&&(t.modules.toolbar.container=eG),super(e,t),this.quill.container.classList.add(`ql-snow`)}extendToolbar(e){e.container!=null&&(e.container.classList.add(`ql-snow`),this.buildButtons(e.container.querySelectorAll(`button`),NW),this.buildPickers(e.container.querySelectorAll(`select`),NW),this.tooltip=new tG(this.quill,this.options.bounds),e.container.querySelector(`.ql-link`)&&this.quill.keyboard.addBinding({key:`k`,shortKey:!0},(t,n)=>{e.handlers.link.call(e,!n.format.link)}))}};nG.DEFAULTS=DB({},qW.DEFAULTS,{modules:{toolbar:{handlers:{link(e){if(e){let e=this.quill.getSelection();if(e==null||e.length===0)return;let t=this.quill.getText(e);/^\S+@\S+\.\S+$/.test(t)&&t.indexOf(`mailto:`)!==0&&(t=`mailto:${t}`);let{tooltip:n}=this.quill.theme;n.edit(`link`,t)}else this.quill.format(`link`,!1,$.sources.USER)}}}}}),UU.register({"attributors/attribute/direction":kH,"attributors/class/align":vH,"attributors/class/background":CH,"attributors/class/color":xH,"attributors/class/direction":AH,"attributors/class/font":NH,"attributors/class/size":FH,"attributors/style/align":yH,"attributors/style/background":wH,"attributors/style/color":SH,"attributors/style/direction":jH,"attributors/style/font":PH,"attributors/style/size":IH},!0),UU.register({"formats/align":vH,"formats/direction":AH,"formats/indent":WU,"formats/background":wH,"formats/color":SH,"formats/font":NH,"formats/size":FH,"formats/blockquote":GU,"formats/code-block":EH,"formats/header":KU,"formats/list":JU,"formats/bold":YU,"formats/code":DH,"formats/italic":XU,"formats/link":ZU,"formats/script":$U,"formats/strike":eW,"formats/underline":tW,"formats/formula":nW,"formats/image":iW,"formats/video":oW,"modules/syntax":fW,"modules/table":vW,"modules/toolbar":bW,"themes/bubble":$W,"themes/snow":nG,"ui/icons":NW,"ui/picker":LW,"ui/icon-picker":zW,"ui/color-picker":RW,"ui/tooltip":VW},!0);var rG=UU,iG=!1,aG=[`background-image`,`background-size`,`-webkit-background-clip`,`background-clip`,`-webkit-text-fill-color`,`color`];function oG(){if(iG)return;iG=!0;let e=rG.import(`attributors/style/size`),t=rG.import(`attributors/style/font`);e&&(delete e.whitelist,rG.register(e,!0)),t&&(delete t.whitelist,t.add=(e,t)=>(e.style.fontFamily=Tb(t),!0),t.value=e=>Fb(e.style.fontFamily)||``,rG.register(t,!0));let n=rG.import(`parchment`);if(n?.StyleAttributor&&n?.Scope){let e=new n.StyleAttributor(`font-weight`,`font-weight`,{scope:n.Scope.INLINE});rG.register(e,!0),rG.register(function(e){class t extends e.StyleAttributor{constructor(e,t,n){super(e,t,n)}add(e,t){if(typeof t!=`string`||!t.includes(`gradient`))return!1;e.style.setProperty(`background-image`,t),e.style.setProperty(`background-size`,`100% 100%`),e.style.setProperty(`-webkit-background-clip`,`text`),e.style.setProperty(`background-clip`,`text`),e.style.setProperty(`-webkit-text-fill-color`,`transparent`);try{e.style.setProperty(`color`,SC(t))}catch{}return!0}remove(e){for(let t of aG)e.style.removeProperty(t)}value(e){return RM(e)?e.style.getPropertyValue(`background-image`):``}}return new t(`gradient`,`background-image`,{scope:e.Scope.INLINE})}(n),!0);let t=rG.import(`attributors/style/color`);if(t){let e=t.value.bind(t);t.value=t=>RM(t)?``:e(t),rG.register(t,!0)}}}var sG=[`fontSize`,`fontFamily`,`fill`,`fontWeight`,`fontStyle`,`textDecoration`],cG=Qt({active:null},{},{deep:!1});function lG(){return cG.active}function uG(e){hr(()=>{cG.active=Object.assign(Object.assign({},e),{currentFormat:{},mixedFormats:{},lastSelection:null})})}function dG(e,t,n){hr(()=>{cG.active&&=Object.assign(Object.assign({},cG.active),{currentFormat:e,mixedFormats:t,lastSelection:n||cG.active.lastSelection})})}function fG(e){hr(()=>{e&&cG.active?.instance!==e||(cG.active=null)})}var pG={fontSize:[`size`],fontFamily:[`font`],fill:[`color`,`gradient`],fontWeight:[`font-weight`],fontStyle:[`italic`],textDecoration:[`underline`,`strike`]},mG=Array.from(new Set(sG.flatMap(e=>pG[e]))),hG={data:``},gG=e=>typeof window==`object`?((e?e.querySelector(`#_goober`):window._goober)||Object.assign((e||document.head).appendChild(document.createElement(`style`)),{innerHTML:` `,id:`_goober`})).firstChild:e||hG,_G=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,vG=/\/\*[^]*?\*\/|\s\s+|\n/g,yG=(e,t)=>{let n=``,r=``,i=``;for(let a in e){let o=e[a];a[0]==`@`?a[1]==`i`?n=a+` `+o+`;`:r+=a[1]==`f`?yG(o,a):a+`{`+yG(o,a[1]==`k`?``:t)+`}`:typeof o==`object`?r+=yG(o,t?t.replace(/([^,])+/g,e=>a.replace(/(^:.*)|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+` `+t:t)):a):o!=null&&(a=a.replace(/[A-Z]/g,`-$&`).toLowerCase(),i+=yG.p?yG.p(a,o):a+`:`+o+`;`)}return n+(t&&i?t+`{`+i+`}`:i)+r},bG={},xG=e=>{if(typeof e==`object`){let t=``;for(let n in e)t+=n+xG(e[n]);return t}return e},SG=(e,t,n,r,i)=>{let a=xG(e),o=bG[a]||(bG[a]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return`go`+n})(a));if(!bG[o]){let t=a===e?(e=>{let t,n=[{}];for(;t=_G.exec(e.replace(vG,``));)t[4]?n.shift():t[3]?n.unshift(n[0][t[3]]=n[0][t[3]]||{}):n[0][t[1]]=t[2];return n[0]})(e):e;bG[o]=yG(i?{[`@keyframes `+o]:t}:t,n?``:`.`+o)}return((e,t,n)=>{t.data.indexOf(e)==-1&&(t.data=n?e+t.data:t.data+e)})(bG[o],t,r),o};function CG(e){let t=this||{},n=e.call?e(t.p):e;return SG(n.unshift?n.raw?((e,t,n)=>e.reduce((e,r,i)=>{let a=t[i];if(a&&a.call){let e=a(n),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;a=t?`.`+t:e&&typeof e==`object`?e.props?``:yG(e,``):!1===e?``:e}return e+r+(a??``)},``))(n,[].slice.call(arguments,1),t.p):n.reduce((e,n)=>Object.assign(e,n&&n.call?n(t.p):n),{}):n,gG(t.target),t.g,t.o,t.k)}var wG,TG,EG;CG.bind({g:1}),CG.bind({k:1});function DG(e,t,n,r){yG.p=t,wG=e,TG=n,EG=r}function OG(e,t){let n=this||{};return function(){let r=arguments;function i(a,o){let s=Object.assign({},a),c=s.className||i.className;n.p=Object.assign({theme:TG&&TG()},s),n.o=/ *go\d+/.test(c),s.className=CG.apply(n,r)+(c?` `+c:``),t&&(s.ref=o);let l=e;return e[0]&&(l=s.as||e,delete s.as),EG&&l[0]&&EG(s),wG(l,s)}return t?t(i):i}}DG(j.createElement,void 0,void 0,void 0);var kG=e=>OG(e,j.forwardRef),AG=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},jG=Qt({enabled:!1,currentFormat:{},pendingToolbarInteraction:!1,editor:Qt.object({instance:null},{},{deep:!1})}),MG=mG;function NG(e,t){let n=t?e.getFormat(t):{},r=function(e,t){let n={};if(!t||t.length<=0)return n;let r=e.getContents(t.index,t.length);for(let e of MG)BM(r,e)&&(n[e]=!0);return n}(e,t);hr(()=>{jG.currentFormat=n}),dG(n,r,t)}var PG=`polotno-saved-selection`;function FG(){let e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed||typeof Highlight>`u`||!CSS.highlights)return;let t=e.getRangeAt(0).cloneRange();CSS.highlights.set(PG,new Highlight(t)),LG()}function IG(){typeof CSS<`u`&&CSS.highlights&&CSS.highlights.delete(PG)}function LG(){setTimeout(()=>{typeof CSS<`u`&&CSS.highlights&&CSS.highlights.has(PG)&&(document.querySelector(`.polotno-portal`)||YG(document.activeElement)?LG():IG())},300)}if(typeof document<`u`&&typeof CSS<`u`&&CSS.highlights&&!document.querySelector(`[data-polotno-highlight]`)){let e=document.createElement(`style`);e.setAttribute(`data-polotno-highlight`,``),e.textContent=`::highlight(${PG}) { background-color: Highlight; }`,document.head.appendChild(e)}var RG=null;function zG(e,t){e.type===`text`&&t.push(e);for(let n of e.children||[])zG(n,t)}function BG(e){let t=e.fontSize;if(!t||t<=0)return null;let n=Tb(e.fontFamily),r=Rb(e.fontWeight)?700:400,i=e.fontStyle===`italic`?`italic`:`normal`,a=RG??=document.createElement(`canvas`).getContext(`2d`);a.fontKerning=`normal`,a.font=`${t}px ${n}`;let o=a.measureText(`M`),s=(o.fontBoundingBoxAscent??0)/t,c=(o.fontBoundingBoxDescent??0)/t,l=wO(`<div style="${`font-family:${n};font-size:${t}px;font-weight:${r};font-style:${i};line-height:${e.lineHeight};letter-spacing:${e.letterSpacing}em`}"><ul><li>x</li></ul><ol><li>x</li></ol></div>`),u;try{u=jA({html:l,width:Math.max(12*t,600)})}catch{return null}let d=[];zG(u.layoutRoot,d);let f=d.find(e=>e.text===`•`),p=d.find(e=>/^\d/.test(e.text));if(!f)return null;let m=f.style.fontSize,h=2.1*t;return{bulletLeft:f.x,bulletTop:f.y-sE(m,m*s,m*c),bulletFontSize:m,numberGap:p?Math.max(0,h-p.x-(p.width??0)):0}}var VG=kG(`div`,j.forwardRef)`
433
+ .ql-editor {
434
+ outline: none;
435
+ /* anchor for the absolutely-positioned ::before placeholder below */
436
+ position: relative;
437
+ /* Element-level underline/strike — text-decoration doesn't inherit, so it is
438
+ applied here on the editable root (mirrors the static getHtml render). */
439
+ text-decoration: var(--polotno-text-decoration, none);
440
+ /* Chrome would otherwise break the underline at every descender; the
441
+ canvas draws one solid band. Mirrors getHtml (@polotno/core). */
442
+ text-decoration-skip-ink: none;
443
+ }
444
+ /* Placeholder for an empty editor. Quill toggles ql-blank + data-placeholder
445
+ but its core stylesheet (which paints it) is not loaded — do it here. Same
446
+ 0.6 dim as the canvas render and the legacy textarea ::placeholder. */
447
+ .ql-editor.ql-blank::before {
448
+ content: attr(data-placeholder);
449
+ position: absolute;
450
+ inset-inline: 0;
451
+ top: 0;
452
+ opacity: 0.6;
453
+ pointer-events: none;
454
+ }
455
+ .ql-clipboard {
456
+ pointer-events: none;
457
+ opacity: 0;
458
+ }
459
+ ${xO}
460
+
461
+ /* ===== Editor-only list markers (Quill flat-DOM hack) ======================
462
+ Quill emits a FLAT <ol> with per-item data-list + ql-indent classes (not
463
+ real nested <ul>/<ol>), so the browser's native markers can't render mixed
464
+ bullet/number items or nested numbering. The editor therefore disables
465
+ native markers and draws its own via ::before — but ONLY here, so it can't
466
+ leak into the export/canvas paths (which use native markers; see
467
+ reset-style.ts). These are tuned to match render-tag (the canvas
468
+ reference): marker sized at the item font, sitting just left of the text
469
+ inside the 2.1em indent. letter-spacing is intentionally NOT reset to
470
+ normal — numbered markers track it, like render-tag/native/Canva. */
471
+ .ql-editor ul,
472
+ .ql-editor ol {
473
+ list-style: none;
474
+ /* Editor box model is the inverse of the shared reset: the indent lives on
475
+ the <li> (not the list) so the absolutely-positioned ::before marker
476
+ below has room in the li's start-padding. (The export/canvas path puts
477
+ the indent on the list for native outside markers — see reset-style.ts.) */
478
+ padding-inline-start: 0;
479
+ }
480
+ .ql-editor .ql-ui {
481
+ display: none;
482
+ }
483
+ /* Per-LEVEL ordered counters (list-0..list-3), so a nested ordered list
484
+ restarts at 1 — matching canonical HTML and the canvas. Quill's flat DOM
485
+ expresses depth via ql-indent-N, so each ordered item increments its
486
+ level's counter and RESETS all deeper levels (counter-reset applies before
487
+ counter-increment on the same element). A single global counter would make
488
+ a nested "deep" item continue the outer numbering (e.g. show 3 instead of
489
+ 1). All levels use decimal to match render-tag (which doesn't cycle
490
+ styles). Custom counter names avoid Safari's list-item counter bug. */
491
+ .ql-editor ol {
492
+ counter-reset: list-0 list-1 list-2 list-3;
493
+ }
494
+ .ql-editor li {
495
+ position: relative; /* anchor for the absolutely-positioned ::before */
496
+ padding-inline-start: 2.1em; /* marker space + per-level indent (start side) */
497
+ }
498
+ .ql-editor li[data-list='ordered'] {
499
+ counter-increment: list-0;
500
+ counter-reset: list-1 list-2 list-3;
501
+ }
502
+ .ql-editor li.ql-indent-1[data-list='ordered'] {
503
+ counter-increment: list-1;
504
+ counter-reset: list-2 list-3;
505
+ }
506
+ .ql-editor li.ql-indent-2[data-list='ordered'] {
507
+ counter-increment: list-2;
508
+ counter-reset: list-3;
509
+ }
510
+ .ql-editor li.ql-indent-3[data-list='ordered'] {
511
+ counter-increment: list-3;
512
+ }
513
+ /* Marker box spans the 2.1em indent and right-aligns the marker against the
514
+ text with a gap, so the marker's right edge ≈ render-tag's
515
+ (contentStart − gap). line-height is inherited so the marker sits on the
516
+ item's first-line baseline (matches render-tag's number baseline; bullets
517
+ are close). */
518
+ .ql-editor li::before {
519
+ position: absolute;
520
+ inset-inline-start: 0;
521
+ top: 0;
522
+ box-sizing: border-box;
523
+ width: 2.1em;
524
+ text-align: end;
525
+ font-weight: normal;
526
+ font-style: normal;
527
+ }
528
+ .ql-editor li[data-list='ordered']::before {
529
+ content: counter(list-0) '.';
530
+ /* Exact render-tag number gap (space-width) computed per element; 0.32em
531
+ fallback until the vars are set (or on layout failure). */
532
+ padding-inline-end: var(--rt-number-gap, 0.32em);
533
+ }
534
+ .ql-editor li.ql-indent-1[data-list='ordered']::before {
535
+ content: counter(list-1) '.';
536
+ }
537
+ .ql-editor li.ql-indent-2[data-list='ordered']::before {
538
+ content: counter(list-2) '.';
539
+ }
540
+ .ql-editor li.ql-indent-3[data-list='ordered']::before {
541
+ content: counter(list-3) '.';
542
+ }
543
+ .ql-editor li[data-list='bullet']::before {
544
+ content: '•';
545
+ padding-inline-end: 0.5em; /* fallback gap (RTL, or before vars are set) */
546
+ }
547
+ /* LTR: pixel-match render-tag's synthetic disc. The canvas scales the '•'
548
+ glyph to ink-diameter ascent/3 and pins its ink-right edge / vertical
549
+ center; computeMarkerVars asks render-tag for the exact numbers and sets
550
+ them here. Gated on .rt-marker-geom (LTR + vars computed) so RTL and the
551
+ pre-measure frame keep the box+text-align fallback above. */
552
+ &.rt-marker-geom .ql-editor li[data-list='bullet']::before {
553
+ inset-inline-start: var(--rt-bullet-left);
554
+ top: var(--rt-bullet-top);
555
+ font-size: var(--rt-bullet-fs);
556
+ line-height: 1;
557
+ width: auto;
558
+ padding-inline-end: 0;
559
+ text-align: left;
560
+ }
561
+
562
+ strong {
563
+ font-weight: 700;
564
+ }
565
+ .ql-direction-rtl {
566
+ direction: rtl;
567
+ }
568
+ /* Apply gradient fill to all text-bearing elements when --polotno-gradient is set */
569
+ &[style*='--polotno-gradient'] .ql-editor,
570
+ &[style*='--polotno-gradient'] .ql-editor p,
571
+ &[style*='--polotno-gradient'] .ql-editor li,
572
+ &[style*='--polotno-gradient'] .ql-editor li::before {
573
+ background-image: var(--polotno-gradient);
574
+ background-size: 100% 100%;
575
+ background-repeat: repeat;
576
+ -webkit-background-clip: text;
577
+ -moz-background-clip: text;
578
+ background-clip: text;
579
+ -webkit-text-fill-color: transparent;
580
+ color: transparent;
581
+ }
582
+ /* A span carrying its own solid color must win over the gradient: the
583
+ transparent -webkit-text-fill-color above is INHERITED, so without this
584
+ the span paints the clipped gradient instead of its chosen color
585
+ (mirrors getHtml's markInlineColorsForClip on the canvas side). */
586
+ &[style*='--polotno-gradient'] .ql-editor [style*='color:'] {
587
+ -webkit-text-fill-color: currentColor;
588
+ }
589
+ `,HG=[`background`,`font-weight`,`color`,`gradient`,`font`,`italic`,`size`,`script`,`strike`,`underline`,`indent`,`list`,`direction`],UG=!1;function WG(){UG||(UG=!0,console.warn(`[polotno] The Quill 'bold' format is deprecated. Use the numeric 'font-weight' format instead, e.g. quill.format('font-weight', '700') or applyTextFormat({ fontWeight: 700 }).`))}function GG(e){return e?`700`:`400`}var KG=(e,t)=>{oG();let n=new rG(e,{toolbar:!1,keyboard:!1,placeholder:t?.placeholder||void 0,clipboard:{matchVisual:!1},formats:HG});(function(e){let t=e.format.bind(e),n=e.formatText.bind(e),r=e.getFormat.bind(e);e.format=(e,n,r)=>e===`bold`?(WG(),t(`font-weight`,GG(n),r)):t(e,n,r),e.formatText=(e,t,r,i,a)=>{if(r&&typeof r==`object`){if(`bold`in r){WG();let{bold:a}=r,o=AG(r,[`bold`]);return n(e,t,Object.assign(Object.assign({},o),{"font-weight":GG(a)}),i)}return n(e,t,r,i)}return r===`bold`?(WG(),n(e,t,`font-weight`,GG(i),a)):n(e,t,r,i,a)},e.getFormat=(...e)=>{let t=r(...e);return t&&t[`font-weight`]!=null&&!(`bold`in t)&&(t.bold=Rb(t[`font-weight`])),t}})(n);let r=rG.import(`delta`),i=(e,t)=>t.compose(new r().retain(t.length(),{"font-weight":`700`}));return n.clipboard.addMatcher(`STRONG`,i),n.clipboard.addMatcher(`B`,i),n},qG=(e,t)=>{var n=e.clipboard.convert({html:`<div class='ql-editor' style='outline: none;'>`+t.replace(/\t/g,``)+`<p><br></p></div>`,text:``});n.ops.forEach(e=>{typeof e.insert==`string`&&e.insert.includes(``)&&(e.insert=e.insert.split(``).join(` `))}),e.setContents(n),e.history.clear()},JG=({onBlur:e,onChange:t,element:n,clickCoords:r})=>{let i=j.useRef(null),a=j.useRef(!1);j.useLayoutEffect(()=>{let o,s=!1,c=null,l=null,u=null,d=null,f=null,p=()=>{if(!s&&i.current)try{o=KG(i.current,{placeholder:hN(n.placeholder)}),hr(()=>{jG.editor.instance=o}),jG.pendingToolbarInteraction=!1,window.__polotnoQuill=o,uG({instance:o,store:n.store,element:n});let s=e=>{e&&NG(o,e)};o.on(`text-change`,()=>{let e=lG(),r=e&&e.instance===o?e.lastSelection:null;s(o.getSelection()||r),setTimeout(()=>{let e=o.root;if(!e||!e.isConnected||!$h(n))return;let r=e.innerHTML;a.current=!0,t(FM(r,{fontSize:n.fontSize,fontFamily:n.fontFamily}));let i=o.getContents(),s=n.fill,c=null,l=!0;for(let e of i.ops){if(typeof e.insert!=`string`||e.insert===`
590
+ `)continue;if(e.attributes?.gradient){l=!1;break}let t=e.attributes?.color||s;if(c===null)c=t;else if(t!==c){l=!1;break}}l&&c&&n.set({fill:c})},10)}),o.on(`selection-change`,s);let p=qO(n,n.fontFamily);qG(o,p),a.current=!0;let m=i.current.closest(`.polotno-workspace-inner`),h=m?.scrollLeft,g=m?.scrollTop;r?XG(o,r):o.setSelection(0,0,`api`),m&&h!==void 0&&g!==void 0&&(m.scrollLeft=h,m.scrollTop=g);let _=o.root;d=t=>{let n=t.relatedTarget;n!=null&&n.classList.contains(`ql-clipboard`)||(YG(n)||jG.pendingToolbarInteraction?FG():setTimeout(()=>{jG.pendingToolbarInteraction||YG(document.activeElement)?FG():(IG(),e())},0))},f=()=>{IG()},_.addEventListener(`blur`,d),_.addEventListener(`focus`,f),c=_,l=e=>{var t,n;let r=o.getSelection();if(!r||r.length===0)return;let i=o.getText(r.index,r.length).replace(/\n$/,``),a=window.getSelection(),s=``;if(a&&a.rangeCount>0){let e=a.getRangeAt(0),t=e.cloneContents(),n=e.startContainer;n&&n.nodeType===Node.TEXT_NODE&&(n=n.parentNode);let r=e.endContainer;if(r&&r.nodeType===Node.TEXT_NODE&&(r=r.parentNode),n&&n===r){let e=n;for(;e&&e!==_&&e.nodeType===Node.ELEMENT_NODE;){let n=e.tagName;if(n!==`SPAN`&&n!==`EM`&&n!==`STRONG`&&n!==`U`&&n!==`S`&&n!==`A`)break;let r=e.cloneNode(!1);r.appendChild(t),t=r,e=e.parentNode}}let i=document.createElement(`div`);i.appendChild(t),s=i.innerHTML}if((t=e.clipboardData)==null||t.setData(`text/plain`,i),s){let t=`<!DOCTYPE html><html><head><meta charset="utf-8"></head><body><!--StartFragment--><div style="white-space: pre-wrap; overflow-wrap: break-word;">`+s+`</div><!--EndFragment--></body></html>`;(n=e.clipboardData)==null||n.setData(`text/html`,t)}e.preventDefault()},u=e=>{l&&l(e);let t=o.getSelection();t&&t.length>0&&o.deleteText(t.index,t.length)},c.addEventListener(`copy`,l),c.addEventListener(`cut`,u)}catch(e){console.error(`RichEditor init failed:`,e)}};return i.current?p():queueMicrotask(p),()=>{s=!0,c&&d&&c.removeEventListener(`blur`,d),c&&f&&c.removeEventListener(`focus`,f),IG(),c&&l&&u&&(c.removeEventListener(`copy`,l),c.removeEventListener(`cut`,u)),hr(()=>{jG.editor.instance=null,jG.currentFormat={}}),fG(o),delete window.__polotnoQuill}},[]),j.useEffect(()=>AM(n,()=>`${n.text}\0${n.fontSize}\0${n.fontFamily}`,()=>{let e=jG.editor.instance;if(!e)return;if(a.current){a.current=!1;return}let t=e.getSelection();qG(e,qO(n,n.fontFamily)),a.current=!0,t&&(e.setSelection(t.index,t.length),NG(e,e.getSelection()))},{fireImmediately:!0}),[]),j.useEffect(()=>AM(n,()=>`${n.fontFamily}\0${n.fontSize}\0${n.fontWeight}\0${n.fontStyle}\0${n.lineHeight}\0${n.letterSpacing}\0${kO(sx(n.text))}`,()=>{let e=i.current;if(!e)return;let t=kO(sx(n.text))===`ltr`,r=BG(n);r&&e.style.setProperty(`--rt-number-gap`,`${r.numberGap}px`),r&&t?(e.style.setProperty(`--rt-bullet-left`,`${r.bulletLeft}px`),e.style.setProperty(`--rt-bullet-top`,`${r.bulletTop}px`),e.style.setProperty(`--rt-bullet-fs`,`${r.bulletFontSize}px`),e.classList.add(`rt-marker-geom`)):e.classList.remove(`rt-marker-geom`)},{fireImmediately:!0}),[]),j.useEffect(()=>{window.addEventListener(`blur`,e);let t=t=>{var n;let r=t.target;typeof r?.nodeType==`number`&&(n=i.current)!=null&&n.contains(r)||YG(r)||jG.pendingToolbarInteraction||(IG(),e())};return window.addEventListener(`mousedown`,t),window.addEventListener(`touchstart`,t),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`mousedown`,t),window.removeEventListener(`touchstart`,t)}},[]);let o={color:n.fill};n.fill.indexOf(`gradient`)>=0&&(o[`--polotno-gradient`]=n.fill,o.color=`transparent`),n.strokeWidth>0&&(o.WebkitTextStroke=`${n.strokeWidth}px ${SC(n.stroke)}`,o.paintOrder=`stroke fill`);let s=vC(n.fill)?SC(n.fill):mN(n),c=n.a.rotation*Math.PI/180,l=n.shadowOffsetX*Math.cos(c)+n.shadowOffsetY*Math.sin(c),u=-n.shadowOffsetX*Math.sin(c)+n.shadowOffsetY*Math.cos(c);return(0,N.jsx)(VG,{ref:i,style:Object.assign(Object.assign({},o),{fontSize:n.fontSize,fontFamily:Tb(n.fontFamily),fontWeight:n.fontWeight,fontStyle:n.fontStyle,"--polotno-text-decoration":n.textDecoration||`none`,textTransform:n.textTransform,width:YO(n.a.width,n.letterSpacing,n.fontSize),lineHeight:n.lineHeight,letterSpacing:n.letterSpacing*n.fontSize+`px`,textAlign:n.align,opacity:Math.max(n.a.opacity,.2),textShadow:n.shadowEnabled?`${l}px ${u}px ${n.shadowBlur}px ${iw(n.shadowColor,n.shadowOpacity??1)}`:void 0,caretColor:s}),dir:kO(sx(n.text))})};function YG(e){let t=e;return!(typeof t?.closest!=`function`||!t.closest(`.sketch-picker`)&&!t.closest(`[data-polotno-keep-focus]`)&&!t.closest(`.polotno-portal`)&&!t.closest(`.polotno-toolbar`))}function XG(e,t){if(!e||!t)return;let{x:n,y:r}=t;try{let t=null;if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(n,r);else if(document.caretPositionFromPoint){let e=document.caretPositionFromPoint(n,r);e&&(t=document.createRange(),t.setStart(e.offsetNode,e.offset))}if(t){let n=rG.find(t.startContainer,!0);if(n){let r=n.offset(e.scroll)+t.startOffset;e.setSelection(r,0,`api`);return}}}catch{}e.setSelection(0,0,`api`)}function ZG(e){let t=document.createElement(`canvas`);return t.getContext(`2d`)?.drawImage(e,0,0,t.width,t.height),function(e){return!function(e){let t=e.getContext(`2d`).getImageData(0,0,e.width,e.height).data;for(let e=0;e<t.length;e+=4)if(t[e+3]!==0)return!0;return!1}(e)}(t)}var QG=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),$G=navigator.userAgent.includes(`Firefox`),eK=Na(({element:e,store:t})=>{let{textOverflowIndicatorStyle:n}=xh(),r=j.useRef(null),[i,a]=j.useState(),[o,s]=j.useState(!1),[c,l]=j.useState(!1),u=j.useRef(e.height),f=e.isSelected,p=wN(f),m=e.fontSize/3,h=YO(e.a.width,e.letterSpacing,e.fontSize)+2*m,{textVerticalResizeEnabled:g}=Ay,_=Ay.autoDeleteEmptyText,v=wN(e.fontFamily),y=j.useMemo(()=>Yb(e.text,{fontSize:e.fontSize,fontFamily:e.fontFamily}),[e.text,e.fontSize,e.fontFamily]),[b]=SN(t,j.useMemo(()=>[...new Set([e.fontFamily,...Xb(y)])].filter(Boolean),[e.fontFamily,y]),e.fontStyle,e.fontWeight,e.text||e.placeholder),x=e._editModeEnabled;ob(r);let S=b?e.fontFamily:v===e.fontFamily?`Arial`:v,C=jM(e).fill,w=XO(e,{fontFamily:S,color:C,textOverflow:Ay.textOverflow}),T=j.useRef([]),E=j.useRef(!0),[,D]=j.useReducer(e=>e+1,0);j.useEffect(()=>{let e=T.current;e.length>0&&(T.current=[],e.forEach(e=>e()))}),j.useEffect(()=>()=>{E.current=!1;let e=T.current;e.length>0&&(T.current=[],e.forEach(e=>e()))},[]);let{width:O,height:k}=function(e,t,n){return j.useMemo(()=>rA(e),[e,t.width,n])}(w,e,b);j.useEffect(()=>{if(!b)return;let n=(n,r,i,a)=>{let o=mb(`text ${e.id}`),s=()=>{t.history.ignore(n,r,i).then(()=>{E.current?(T.current.push(o),D()):o()})};a?queueMicrotask(s):s()};if(e.curveEnabled&&Math.abs(O-e.width)>1&&!o&&n(()=>{if($h(e)&&Math.abs(O-e.width)>1){let t=e.x+e.width/2;e.set({width:O,x:t-O/2})}},!1,!0),!nx(e)){n(()=>{$h(e)&&(nx(e)||e.set({height:k}))},void 0,void 0,!0);return}let{textOverflow:r}=Ay;if(r!==`change-font-size`||o||x||e.curveEnabled)r===`resize`&&(g&&e.height<k&&!o&&n(()=>{$h(e)&&e.set({height:k})},!1,!0),g||e.height===k||o||n(()=>{$h(e)&&e.set({height:k})},!1,!0));else{let t=EP(e,{fontFamily:e.fontFamily,textOverflow:Ay.textOverflow});t.fontSize===e.fontSize?e.height!==k&&(g&&e.height<k?n(()=>{$h(e)&&e.set({height:k})},!1,!0):g||n(()=>{$h(e)&&e.set({height:k})},!1,!0)):n(()=>{if(!$h(e))return;let n=YM(e,t.fontSize);t.text!==void 0&&t.text!==e.text&&(n.text=t.text),e.set(n)},!1,!0)}});let A=j.useMemo(()=>{let e={lastArgs:null,lastResult:null};return async function(t){return e.lastArgs&&e.lastResult&&(n=e.lastArgs,r=t,JSON.stringify(n)===JSON.stringify(r))||(e.lastResult=await TP(t),e.lastArgs=Object.assign({},t)),e.lastResult;var n,r}},[]),ee=j.useRef(0),M=j.useRef(null);j.useEffect(()=>{o||x||(async()=>{ee.current++;let n=ee.current,r=mb(`text ${e.id} ${n}`);M.current&&M.current(),M.current=r,l(!0);let i=null,o=QG?5:1;for(let r=0;r<o;r++){let a=r>0?A:TP;try{if(i=await a({skipCache:r>0,html:w,width:O||e.width||1,height:ox(e,k)||1,fontFamily:S,fontFamilies:Xb(w),resolveFont:e=>t.fonts.find(t=>t.fontFamily===e)||qx.find(t=>t.fontFamily===e),padding:m,pixelRatio:t._elementsPixelRatio,font:t.fonts.find(e=>e.fontFamily===S)||qx.find(e=>e.fontFamily===S)}),n!==ee.current)return;if((QG||$G)&&i&&ZG(i)){await new Promise(e=>setTimeout(e,50*(r+1)));continue}break}catch(t){console.error(t),yb(`Error rendering rich text with id ${e.id}`);break}}i?a(i):r?(r(),r=null):console.error(`Finish function is called twice!`),l(!1)})()},[w,o,k,x,S,e.height,t._elementsPixelRatio,b]);let[P,F]=ON(c,300),[I]=ON(o,300,!0),te=I||P;j.useEffect(()=>{var t;if(!te)return kM(e,()=>{let t=r.current;lN(t,e)});(t=r.current)==null||t.clearCache()},[i,te,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]),j.useEffect(()=>{i&&!c&&M.current&&(M.current(),M.current=null)},[i,c]),j.useLayoutEffect(()=>{if(!b||!e.curveEnabled)return;let t=new d.TextPath({data:MO(e.a.width,e.a.height,e.curvePower,e.a.fontSize),text:sx(e.text),letterSpacing:e.letterSpacing*e.a.fontSize,fontSize:e.a.fontSize,fontFamily:Tb(e.fontFamily),fontWeight:e.fontWeight,fontStyle:e.fontStyle,align:`center`,textBaseline:`middle`,fill:e.fill}),n=t.getSelfRect().width;if(n){let t=n-e.a.width,r=e.a.rotation*Math.PI/180,i=-t/2*Math.cos(r),a=-t/2*Math.sin(r);queueMicrotask(()=>{$h(e)&&e.set({width:n,x:e.a.x+i,y:e.a.y+a})})}t.destroy()},[b,e.curveEnabled,e.curvePower,e.text,e.fontSize,e.fontFamily,e.fontWeight,e.fontStyle,e.letterSpacing]),j.useEffect(()=>()=>{M.current&&M.current()},[]),j.useEffect(()=>{p&&!f&&_&&sx(e.text)===``&&e.removable&&!hN(e.placeholder)&&t.deleteElements([e.id])},[_,e.placeholder,e.removable,e.text,f,p]);let ne=ox(e,k),L=0;e.verticalAlign===`middle`&&(L=(ne-k)/2),e.verticalAlign===`bottom`&&(L=ne-k);let R=CN({fontLoaded:b,fontFamily:e.fontFamily,fontSize:e.fontSize,lineHeight:e.lineHeight}),re=e.backgroundPadding*(e.fontSize*R*.5),ie=e.backgroundCornerRadius*(e.fontSize*R*.5),ae=j.useMemo(()=>{if(!e.backgroundEnabled||e.curveEnabled||e.legacyBackground)return``;let t=aA(w);return t.length===0?``:Qk({rects:t.map(e=>({left:e.left+m,right:e.right+m,top:e.top+m,bottom:e.bottom+m})),padding:re,cornerRadius:ie})},[e.backgroundEnabled,e.curveEnabled,e.legacyBackground,w,b,re,ie,m]),oe=uN(),se=MO(e.a.width,k,e.curvePower,e.fontSize),ce=j.useRef(null),le=j.useRef(e.width),ue=j.useRef(``),de=j.useRef(0),fe=j.useRef(0),pe=j.useRef(null),me=x&&e.strokeWidth>0&&!e.curveEnabled,he=O>0?h/(O+2*m):1;return(0,N.jsxs)(N.Fragment,{children:[e.curveEnabled||e.legacyBackground?(0,N.jsx)(Um,{x:e.a.x,y:e.a.y,offsetX:re/he,offsetY:re/he,rotation:e.a.rotation,scaleX:he,scaleY:he,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled,opacity:e.backgroundOpacity*e.a.opacity,fill:e.backgroundColor,width:e.width+2*re,height:ne+2*re,cornerRadius:ie}):(0,N.jsx)(Ym,{name:`html-background`,x:e.a.x,y:e.a.y,offsetX:m/he,offsetY:(m-L)/he,rotation:e.a.rotation,scaleX:he,scaleY:he,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled&&ae.length>0,opacity:e.backgroundOpacity*e.a.opacity,fill:e.backgroundColor,data:ae}),(0,N.jsx)(Ym,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,data:se,stroke:n.stroke,strokeWidth:1,visible:!1}),(0,N.jsx)(Um,{ref:r,name:`element`,x:e.a.x,y:e.a.y,listening:e.selectable,rotation:e.a.rotation,width:e.a.width,height:e.a.height,visible:!te,draggable:oe?e.draggable&&f:e.draggable,preventDefault:!oe||f,opacity:x?0:e.a.opacity,hideInExport:!e.showInExport,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set(QM(t.target))},id:e.id,onDblClick:t=>{e.contentEditable&&(pe.current={x:t.evt.clientX,y:t.evt.clientY},e.toggleEditMode(!0))},onDblTap:t=>{if(e.contentEditable){let n=t.evt.changedTouches?.[0];pe.current=n?{x:n.clientX,y:n.clientY}:null,e.toggleEditMode(!0)}},onTransformStart:t=>{s(!0),u.current=e.height,le.current=e.width,ce.current=t.target.position(),ue.current=UM(t.target),de.current=e.a.rotation,fe.current=e.height},onTransform:t=>{let n=t.target,r=ue.current,i=r===`middle-left`||r===`middle-right`,a=r===`top-center`||r===`bottom-center`,o=n.scaleX();if(i){let t=n.scaleX(),r=n.width()*t,i=GM(le.current,e.fontSize),a=r;r<i&&(a=i,ce.current&&n.position(ce.current)),n.width(a),n.scaleX(1),n.scaleY(1);let o=rA(XO(Object.assign(Object.assign({},e.toJSON()),{width:a}),{fontFamily:S,color:C,textOverflow:Ay.textOverflow})).height,s=Ay.textVerticalResizeEnabled?Math.max(o,u.current):o;n.height(s),e.set({width:n.width(),height:s,x:n.x(),y:n.y()})}else if(a){let t=Ay.textOverflow===`resize`,r=typeof e.lineHeight==`number`?e.lineHeight:1,i=t?k:r*e.fontSize,a=n.height()*n.scaleY();if(a<i){if(n.height(i),ce.current){if(ue.current===`top-center`){let e=de.current*Math.PI/180,t=fe.current-i;n.x(ce.current.x-t*Math.sin(e)),n.y(ce.current.y+t*Math.cos(e))}else n.position(ce.current)}}else n.height(a);n.scaleY(1),n.scaleX(1),fe.current=Math.max(i,a),e.set({x:n.x(),y:n.y(),height:n.height(),rotation:n.rotation()})}else n.scaleX(1),n.scaleY(1),e.set({fontSize:e.fontSize*o,letterSpacing:e.letterSpacing,width:n.width()*o,x:n.x(),y:n.y(),rotation:n.rotation(),height:n.height()*o,shadowBlur:e.shadowBlur*o,shadowOffsetX:e.shadowOffsetX*o,shadowOffsetY:e.shadowOffsetY*o,strokeWidth:e.strokeWidth*o,text:Zb(e.text,o)});ce.current=t.target.position()},onTransformEnd:t=>{s(!1),l(!0);let n=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set(Object.assign(Object.assign({},eN(e,e.fontSize*n)),{width:XM(t.target.width()*n),x:XM(t.target.x()),y:XM(t.target.y()),rotation:XM(t.target.rotation()),text:Zb(e.text,n)}))}}),(0,N.jsx)(Km,{ref:r,image:i,x:e.a.x,y:e.a.y,offsetX:m,offsetY:m-L,listening:!1,rotation:e.a.rotation,width:h,height:h*((i?.height??0)/(i?.width||1)||1),visible:!te&&!x,opacity:e.a.opacity,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,hideInExport:!e.showInExport,editModeEnabled:e._editModeEnabled||o||te}),(te&&!x||me)&&(0,N.jsx)(`Group`,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,offsetY:-L,children:(0,N.jsx)(DM,{divProps:{style:{pointerEvents:`none`}},children:(0,N.jsx)(VG,{dangerouslySetInnerHTML:{__html:w},style:{pointerEvents:`none`,opacity:e.a.opacity,textShadow:e.shadowEnabled?`${e.shadowOffsetX}px ${e.shadowOffsetY}px ${e.shadowBlur}px ${iw(e.shadowColor,e.shadowOpacity??1)}`:void 0}})})}),x&&(0,N.jsx)(`Group`,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,offsetY:-L,children:(0,N.jsx)(DM,{divProps:{style:{zIndex:20}},children:(0,N.jsx)(JG,{element:e,onChange:t=>{let n=dN({oldText:sx(e.text),newText:sx(t),element:e});e.set(Object.assign({text:t},YM(e,n)))},onBlur:t=>{$h(e)&&(e.set(tN(e)),e.toggleEditMode(!1),F(!0))},clickCoords:pe.current})})})]})}),tK=(e,t,n)=>{let[,r]=j.useReducer(e=>e+1,0),i=t.map(e=>`${e.family}\0${e.style}\0${e.weight}`).join(`|`),a=e=>e.every(e=>rS(e.family,e.style,e.weight)),o=j.useRef(a(t)),s=j.useRef(null);return j.useLayoutEffect(()=>{if(o.current=a(t),o.current)return;let c=!0;return(async()=>{o.current=!1,r();let a=mb(`text font specs ${i}`);await Promise.all(t.map(t=>e.loadFont(t.family,t.style,t.weight,n))),c?(s.current=a,o.current=!0,r()):a()})(),()=>{s.current&&=(s.current(),null),c=!1}},[i]),j.useEffect(()=>{o.current&&setTimeout(()=>{s.current&&=(s.current(),null)})},[o.current]),[o.current]},nK=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function rK(e,t){return e!==t&&(!Ay.textVerticalResizeEnabled||e<t)}var iK=Na(({element:e,store:t})=>{let n=j.useRef(null),r=j.useRef(null),[i,a]=j.useState(!1),o=j.useRef(e.height),s=e.isSelected,c=wN(s),{textVerticalResizeEnabled:l}=Ay,u=Ay.autoDeleteEmptyText,d=wN(e.fontFamily),f=j.useMemo(()=>Yb(e.text,{fontSize:e.fontSize,fontFamily:e.fontFamily}),[e.text,e.fontSize,e.fontFamily]),[p]=tK(t,j.useMemo(()=>LM(f,{fontFamily:e.fontFamily,fontWeight:e.fontWeight,fontStyle:e.fontStyle}),[f,e.fontFamily,e.fontWeight,e.fontStyle]),e.text||e.placeholder),m=e._editModeEnabled;ob(n);let h=p?e.fontFamily:d&&d!==e.fontFamily?d:`Arial`,g=jM(e).fill,_=vC(e.fill),v=vC(e.stroke)&&!!e.strokeWidth,y=!!e.strokeWidth&&(v||_),b=Ay.textOverflow===`ellipsis`&&!e.curveEnabled&&nx(e)&&!y,x=hN(e.placeholder),S=!!x&&!sx(e.text),C=S?TO(x):f,w=S?.6:e.a.opacity,T=XO(e,{fontFamily:h,color:g,forEditor:!b,textOverflow:Ay.textOverflow,text:C,textIsNormalized:!0}),E=e.width||1,D=JO(e.letterSpacing,e.fontSize),O=e.curveEnabled,k=function(e,t,n,r){return j.useMemo(()=>{if(r)return null;try{return jA({html:wO(e),width:Math.max(1,t),accuracy:`performance`})}catch(e){return console.error(`render-tag layout failed:`,e),null}},[e,t,n,r])}(T,E,p,O),A=function(e,t,n){return j.useMemo(()=>{if(!t.curveEnabled)return null;let n=MO(t.width||1,VO(t),t.curvePower,t.fontSize);try{return tO({html:wO(e),path:n,align:`center`,textBaseline:`middle`})}catch(e){return console.error(`render-tag/path layoutTextOnPath failed:`,e),null}},[n,t.curveEnabled,t.curvePower,t.fontSize,t.width,t.height,e])}(T,e,p),ee=CN({fontLoaded:p,fontFamily:e.fontFamily,fontSize:e.fontSize,lineHeight:e.lineHeight}),M=O?0:Math.max(k?.height??0,e.fontSize*ee),P=A?A.bounds:null,F=j.useMemo(()=>k?k.lines.map(e=>Yk({left:e.bounds.x,right:e.bounds.x+e.bounds.width,top:e.bounds.y,bottom:e.bounds.y+e.bounds.height},D)):[],[k,D]),I=j.useRef([]),te=j.useRef(null),ne=j.useRef(!0),[,L]=j.useReducer(e=>e+1,0);j.useEffect(()=>{let e=I.current;e.length>0&&(I.current=[],e.forEach(e=>e()))});let R=j.useCallback((n,r,i,a)=>{let o=mb(`text ${e.id}`),s=()=>{t.history.ignore(n,r,i).then(()=>{ne.current?(I.current.push(o),L()):o()})};a?queueMicrotask(s):s()},[e.id,t]),re=j.useCallback(t=>{let n=te.current!==null;te.current=t,n||R(()=>{let t=te.current;te.current=null,$h(e)&&rK(e.height,t)&&e.set({height:t})},!1,!0)},[e,R]);j.useEffect(()=>{if(!p||!k)return;if(!nx(e)){R(()=>{$h(e)&&(nx(e)||e.set({height:M}))},void 0,void 0,!0);return}if(t.isPlaying)return;let{textOverflow:n}=Ay,r=rK(e.height,M),a=()=>re(M);if(n!==`change-font-size`||i||m||e.curveEnabled)n===`resize`&&r&&!i&&a();else{let t=EP(S?{toJSON:()=>Object.assign(Object.assign({},e.toJSON()),{text:C})}:e,{fontFamily:h,color:g,forEditor:!0},e=>{try{return jA({html:wO(e),width:E,accuracy:`performance`}).height}catch{return rA(e).height}});t.fontSize===e.fontSize?r&&a():R(()=>{if(!$h(e))return;let n=YM(e,t.fontSize);t.text!==void 0&&t.text!==e.text&&(n.text=t.text),e.set(n)},!1,!0)}}),j.useEffect(()=>()=>{ne.current=!1;let e=I.current;e.length>0&&(I.current=[],e.forEach(e=>e()))},[]),j.useLayoutEffect(()=>{if(!p||!e.curveEnabled||i||!P||!P.width)return;let t=e=>e&&l?Math.max(e,P.height):P.height;Math.abs(P.width-e.width)<1&&Math.abs(t(e.height)-e.height)<1||R(()=>{if(!$h(e))return;let n=P.width-e.width,r=t(e.height),i=r-e.height;if(Math.abs(n)<1&&Math.abs(i)<1)return;let a=e.a.rotation*Math.PI/180,o=-n/2*Math.cos(a),s=-n/2*Math.sin(a);e.set({width:P.width,height:r,x:e.a.x+o,y:e.a.y+s})},!1,!0,!0)},[p,e.curveEnabled,P,i,l,R]),j.useEffect(()=>{c&&!s&&u&&sx(e.text)===``&&e.removable&&!hN(e.placeholder)&&t.deleteElements([e.id])},[u,e.placeholder,e.removable,e.text,s,c]),j.useEffect(()=>kM(e,()=>{let t=n.current;t&&lN(t,e)}),[k,A,e.a.width,e.a.height,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]);let ie=ox(e,M),ae=O||!p||i||t.isPlaying||Ay.textOverflow!==`resize`?e.a.height:l?Math.max(e.a.height,M):M,oe=0;O||e.verticalAlign!==`middle`?O||e.verticalAlign!==`bottom`||(oe=ie-M):oe=(ie-M)/2;let se=e.backgroundPadding*(e.fontSize*ee*.5),ce=e.backgroundCornerRadius*(e.fontSize*ee*.5),le=j.useMemo(()=>!e.backgroundEnabled||e.curveEnabled||e.legacyBackground||F.length===0?``:Qk({rects:F,padding:se,cornerRadius:ce}),[e.backgroundEnabled,e.curveEnabled,e.legacyBackground,F,se,ce]),ue=uN(),de=j.useRef(null),fe=j.useRef(e.width),pe=j.useRef(null),me=j.useRef(null),he=j.useRef(``),ge=j.useRef(0),_e=j.useRef(0),ve=e.width>0?e.a.width/e.width:1;return(0,N.jsxs)(N.Fragment,{children:[e.curveEnabled||e.legacyBackground?(0,N.jsx)(Um,{x:e.a.x,y:e.a.y,offsetX:se/ve,offsetY:se/ve,rotation:e.a.rotation,scaleX:ve,scaleY:ve,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled,opacity:e.backgroundOpacity*w,fill:e.backgroundColor,width:e.width+2*se,height:ie+2*se,cornerRadius:ce}):(0,N.jsx)(Ym,{name:`rendertag-background`,x:e.a.x,y:e.a.y,offsetY:-oe/ve,rotation:e.a.rotation,scaleX:ve,scaleY:ve,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled&&le.length>0,opacity:e.backgroundOpacity*w,fill:e.backgroundColor,data:le}),(0,N.jsx)(Xm,{ref:n,name:`rendertag-text`,x:e.a.x,y:e.a.y,rotation:e.a.rotation,scaleX:ve,scaleY:ve,offsetY:ve>0?-oe/ve:0,width:e.width,height:Math.max(e.height,M),listening:!1,visible:!m&&!!(O?A:k),editModeEnabled:m,opacity:w,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,hideInExport:!e.showInExport,sceneFunc:(t,n)=>{let r=t._context;if(r)try{if(O){if(!A||!P)return;let t=(e.width-P.width)/2-P.x;r.save(),r.translate(t,-P.y),nO({layout:A,ctx:r}),r.restore()}else{if(!k)return;MA({layout:k,width:E,ctx:r,pixelRatio:1})}}catch(e){console.error(`render-tag draw failed:`,e)}}}),(0,N.jsx)(Um,{ref:r,name:`element`,x:e.a.x,y:e.a.y,listening:e.selectable,rotation:e.a.rotation,width:e.a.width,height:ae,visible:!m,draggable:ue?e.draggable&&s:e.draggable,preventDefault:!ue||s,opacity:0,hideInExport:!0,id:e.id,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set(QM(t.target))},onDblClick:t=>{e.contentEditable&&(me.current={x:t.evt.clientX,y:t.evt.clientY},e.toggleEditMode(!0))},onDblTap:t=>{if(e.contentEditable){let n=t.evt.changedTouches?.[0];me.current=n?{x:n.clientX,y:n.clientY}:null,e.toggleEditMode(!0)}},onTransformStart:t=>{a(!0),o.current=e.height,fe.current=e.width,pe.current=null,de.current=t.target.position(),he.current=UM(t.target),ge.current=e.a.rotation,_e.current=e.height},onTransform:t=>{let n=t.target,r=he.current,i=r===`middle-left`||r===`middle-right`,a=r===`top-center`||r===`bottom-center`,s=n.scaleX();if(i){let t=n.scaleX(),r=n.width()*t,i=Math.max(r,GM(fe.current,e.fontSize)),a=e.toJSON(),s=0;if(e.curveEnabled)s=VO(Object.assign(Object.assign({},a),{width:i}));else{let{x:e,y:t,width:n,height:r}=a,o=nK(a,[`x`,`y`,`width`,`height`]),c=`${JSON.stringify(o)}|${h}|${p}|${g}`;if(pe.current&&pe.current.signature===c&&i<=pe.current.width)i=pe.current.width,s=pe.current.height;else{let e=e=>{let t=XO(Object.assign(Object.assign({},a),{width:e}),{fontFamily:h,color:g,forEditor:!0,text:C,textIsNormalized:!0});try{return jA({html:wO(t),width:e,accuracy:`performance`})}catch{return{height:rA(t).height,lines:[]}}},t=e(i),n=Math.max(0,...t.lines.map(e=>e.bounds.x+e.bounds.width-D));n>i+.5&&n<=fe.current+.5&&(i=Math.min(Math.ceil(n),fe.current),t=e(i),pe.current={signature:c,width:i,height:t.height}),s=t.height}}i>r&&de.current&&n.position(de.current),n.width(i),n.scaleX(1),n.scaleY(1);let c=Ay.textVerticalResizeEnabled?Math.max(s,o.current):s;Ay.textOverflow===`ellipsis`&&(c=o.current),n.height(c),e.set({width:n.width(),height:c,x:n.x(),y:n.y()})}else if(a){let t=Ay.textOverflow===`resize`?O?P?.height||e.fontSize:M:ee*e.fontSize,r=n.height()*n.scaleY();if(r<t){if(n.height(t),de.current){if(he.current===`top-center`){let e=ge.current*Math.PI/180,r=_e.current-t;n.x(de.current.x-r*Math.sin(e)),n.y(de.current.y+r*Math.cos(e))}else n.position(de.current)}}else n.height(r);n.scaleY(1),n.scaleX(1),_e.current=Math.max(t,r),e.set({x:n.x(),y:n.y(),height:n.height(),rotation:n.rotation()})}else n.scaleX(1),n.scaleY(1),e.set({fontSize:e.fontSize*s,letterSpacing:e.letterSpacing,width:n.width()*s,x:n.x(),y:n.y(),rotation:n.rotation(),height:n.height()*s,shadowBlur:e.shadowBlur*s,shadowOffsetX:e.shadowOffsetX*s,shadowOffsetY:e.shadowOffsetY*s,strokeWidth:e.strokeWidth*s,text:Zb(e.text,s)});de.current=t.target.position()},onTransformEnd:t=>{a(!1);let n=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set(Object.assign(Object.assign({},eN(e,e.fontSize*n)),{width:XM(t.target.width()*n),x:XM(t.target.x()),y:XM(t.target.y()),rotation:XM(t.target.rotation()),text:Zb(e.text,n)}))}}),m&&(0,N.jsx)(`Group`,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,offsetY:-oe,children:(0,N.jsx)(DM,{divProps:{style:{zIndex:20}},children:(0,N.jsx)(JG,{element:e,onChange:t=>{let n=dN({oldText:sx(e.text),newText:sx(t),element:e});e.set(Object.assign({text:t},YM(e,n)))},onBlur:()=>{$h(e)&&(e.set(tN(e)),e.toggleEditMode(!1))},clickCoords:me.current})})})]})}),aK=({targetKonvaNodes:e,guideKonvaNode:t,distance:n,snapDirection:r})=>n<5;function oK(e,t){var n=[],r=[];e.vertical.forEach(e=>{t.vertical.forEach(t=>{var r=Math.abs(e.offset-t.guide);aK({targetKonvaNodes:t.nodes,guideKonvaNode:e.node,distance:r,snapDirection:e.snap})&&n.push({lineGuide:e.offset,diff:r,snap:t.snap,offset:t.offset})})}),e.horizontal.forEach(e=>{t.horizontal.forEach(t=>{var n=Math.abs(e.offset-t.guide);aK({targetKonvaNodes:t.nodes,guideKonvaNode:e.node,distance:n,snapDirection:e.snap})&&r.push({lineGuide:e.offset,diff:n,snap:t.snap,offset:t.offset})})});var i=[];let a=n.sort((e,t)=>e.diff-t.diff),o=r.sort((e,t)=>e.diff-t.diff);var s=a[0],c=o[0];return s&&a.filter(e=>Math.abs(e.diff-s.diff)<.1).forEach(e=>{i.push(Object.assign({orientation:`V`},e))}),c&&o.filter(e=>Math.abs(e.diff-c.diff)<.1).forEach(e=>{i.push(Object.assign({orientation:`H`},e))}),i}var sK=()=>{if(d.DD._dragElements.size===0)return;let e=[...d.DD._dragElements.entries()],t=e.find(([e,t])=>t.node instanceof d.Transformer);t&&(e.splice(e.indexOf(t),1),e.unshift(t),d.DD._dragElements.clear(),e.forEach(([e,t])=>{d.DD._dragElements.set(e,t)}))};function cK(e,t,n){return new d.Line({x:-e.x(),y:-e.y(),points:n,stroke:t.stroke,strokeWidth:t.strokeWidth,name:`guid-line`,dash:t.dash})}function lK(e,t,n){let r=e?.children.find(e=>e.name()===`line-guides`),i=e.getStage();n.forEach(e=>{e.orientation===`H`?r?.add(cK(i,t,[-6e3,e.lineGuide,6e3,e.lineGuide])):e.orientation===`V`&&r?.add(cK(i,t,[e.lineGuide,-6e3,e.lineGuide,6e3]))})}function uK(e,t){let n=j.useRef(null),r=j.useRef(null),i=j.useRef(new Map),a=j.useRef(null),{snapGuideStyle:o}=xh(),s=j.useRef(o);s.current=o;let c=e=>e.hasName(`element`)||e.hasName(`page-background`)||!n.current&&e.hasName(`elements-area`);function l(t){let n=e.current?.getStage(),r=[],i=[];return n.find(c).forEach(e=>{if(!(t.indexOf(e)>=0)){var n=e.getClientRect({skipShadow:!0,skipStroke:!0});r.push({offset:n.x,node:e,snap:`start`},{offset:n.x+n.width,node:e,snap:`end`},{offset:n.x+n.width/2,node:e,snap:`center`}),i.push({offset:n.y,node:e,snap:`start`},{offset:n.y+n.height,node:e,snap:`end`},{offset:n.y+n.height/2,node:e,snap:`center`})}}),{vertical:r,horizontal:i}}function u(t){lK(e.current?.getLayer(),s.current,t)}let f=e=>{let t=e.target?.getLayer();if(!t)return;let n=t.children.find(e=>e.name()===`line-guides`);n?.destroyChildren();let o=r.current;if(e.evt?.shiftKey&&o){let r=e.target.getAbsolutePosition(),c=r.x-o.x,l=r.y-o.y,u=Math.abs(c),d=Math.abs(l);if(u>2.414*d)l=0;else if(d>2.414*u)c=0;else{let e=(u+d)/2;c=Math.sign(c)*e,l=Math.sign(l)*e}e.target.nodes().forEach(e=>{let t=i.current.get(e);t&&e.setAbsolutePosition({x:t.x+c,y:t.y+l})});let f=a.current;if(f&&(u>0||d>0)){let e=Math.sign(c),r=Math.sign(l);n?.add(cK(t.getStage(),s.current,[f.x-6e3*e,f.y-6e3*r,f.x+6e3*e,f.y+6e3*r]))}return}var c=oK(l(e.target.nodes()),function(e){let t=e.__getNodeRect(),n=hj(Object.assign(Object.assign({},t),{rotation:d.Util.radToDeg(t.rotation)})),r=e.getAbsolutePosition();return{vertical:[{guide:n.x,offset:r.x-n.x,snap:`start`,nodes:e.nodes()},{guide:n.x+n.width/2,offset:r.x-n.x-n.width/2,snap:`center`,nodes:e.nodes()},{guide:n.x+n.width,offset:r.x-n.x-n.width,snap:`end`,nodes:e.nodes()}],horizontal:[{guide:n.y,offset:r.y-n.y,snap:`start`,nodes:e.nodes()},{guide:n.y+n.height/2,offset:r.y-n.y-n.height/2,snap:`center`,nodes:e.nodes()},{guide:n.y+n.height,offset:r.y-n.y-n.height,snap:`end`,nodes:e.nodes()}]}}(e.target));if(!c.length)return;u(c);let f=e.target.getAbsolutePosition(),p=Object.assign({},f);c.forEach(e=>{switch(e.snap){case`start`:case`center`:case`end`:switch(e.orientation){case`V`:p.x=e.lineGuide+e.offset;break;case`H`:p.y=e.lineGuide+e.offset}}});let m=p.x-f.x,h=p.y-f.y;e.evt.ctrlKey||e.evt.metaKey||e.target.nodes().forEach(e=>{let t=e.getAbsolutePosition();e.setAbsolutePosition({x:t.x+m,y:t.y+h})})},p=(t,n,r)=>{let i=e.current;if(!i)return n;let a=i.getLayer();if(!a||(a.children.find(e=>e.name()===`line-guides`)?.destroyChildren(),i.getActiveAnchor()===`rotater`))return n;let o=pK[i.getActiveAnchor()],s=i.findOne(`.${o}`)?.getAbsolutePosition();if(!s)return n;let c={x:t.x-s.x,y:t.y-s.y},d=function(e,t){let n=fK(e,t)/fK(t,t);return{x:n*t.x,y:n*t.y}}({x:n.x-t.x,y:n.y-t.y},c);if(Math.sqrt(d.x**2+d.y**2)>5)return n;let f={x:t.x+d.x,y:t.y+d.y};var p=oK(l(i.nodes()),{vertical:[{guide:f.x,offset:0,snap:`start`,nodes:i.nodes()}],horizontal:[{guide:f.y,offset:0,snap:`start`,nodes:i.nodes()}]});if(!p.length||(u(p),r.ctrlKey||r.metaKey))return n;let m=[];if(p.forEach(e=>{let t=function(e,t,n){if(n.orientation===`V`){let r=n.lineGuide;if(Math.abs(t.x-e.x)<1e-4)return null;let i=(t.y-e.y)/(t.x-e.x);return{x:r,y:i*r+(e.y-i*e.x)}}{let r=n.lineGuide;if(Math.abs(t.y-e.y)<1e-4)return null;let i=(t.y-e.y)/(t.x-e.x);return{x:(r-e.y)/i+e.x,y:r}}}(f,s,{orientation:e.orientation,lineGuide:e.lineGuide});t&&m.push(t)}),m.length>0){let e=m[0],t=Math.sqrt((f.x-e.x)**2+(f.y-e.y)**2);if(m.forEach(n=>{let r=Math.sqrt((f.x-n.x)**2+(f.y-n.y)**2);r<t&&(t=r,e=n)}),t<10)return e}return f},m=e=>{if(r.current=null,i.current=new Map,a.current=null,!e.target)return;let t=e.target.getLayer();t&&(t.children.find(e=>e.name()===`line-guides`)?.destroyChildren(),t.batchDraw())};j.useEffect(()=>{e.current&&(e.current.anchorDragBoundFunc(p),e.current.on(`dragstart`,t=>{let n=e.current;if(n){r.current=n.getAbsolutePosition(),i.current=new Map(n.nodes().map(e=>[e,e.getAbsolutePosition()]));let e=n.getClientRect();a.current={x:e.x+e.width/2,y:e.y+e.height/2}}setTimeout(()=>{sK()})}),e.current.on(`dragmove`,f),e.current.on(`dragend`,m),e.current.on(`transformend`,m),e.current.on(`transform`,t=>{var n,r;t.evt.ctrlKey||t.evt.metaKey?(n=e.current)==null||n.rotationSnapTolerance(0):(r=e.current)==null||r.rotationSnapTolerance(5)}))},[])}function dK(e,t,n){let{snapGuideStyle:r}=xh(),i=j.useRef(r);i.current=r;let a=e=>e.hasName(`element`)||e.hasName(`line-anchor`)||e.hasName(`page-background`)||e.hasName(`elements-area`),o=n=>{let r=n.target?.getLayer();if(!r)return;r.children.find(e=>e.name()===`line-guides`)?.destroyChildren();var o,s=oK(function(t){let n=e.current?.getStage();var r=[],i=[];return n.find(a).forEach(e=>{if(!(t.indexOf(e)>=0)){var n=e.getClientRect({skipShadow:!0,skipStroke:!0});e.hasName(`line-anchor`)&&(n={x:e.absolutePosition().x,y:e.absolutePosition().y,width:0,height:0}),r.push({offset:n.x,node:e,snap:`start`},{offset:n.x+n.width,node:e,snap:`end`},{offset:n.x+n.width/2,node:e,snap:`center`}),i.push({offset:n.y,node:e,snap:`start`},{offset:n.y+n.height,node:e,snap:`end`},{offset:n.y+n.height/2,node:e,snap:`center`})}}),{vertical:r,horizontal:i}}([n.target,...t.map(e=>e.current)]),{vertical:[{guide:(o=n.target).absolutePosition().x,offset:0,snap:`center`,nodes:[o]}],horizontal:[{guide:o.absolutePosition().y,offset:0,snap:`center`,nodes:[o]}]});if(!s.length)return;(function(t){lK(e.current?.getLayer(),i.current,t)})(s);let c=n.target.getAbsolutePosition(),l=Object.assign({},c);s.forEach(e=>{switch(e.snap){case`start`:case`center`:case`end`:switch(e.orientation){case`V`:l.x=e.lineGuide+e.offset;break;case`H`:l.y=e.lineGuide+e.offset}}}),n.evt.ctrlKey||n.evt.metaKey||n.target.absolutePosition(l)},s=e=>{if(!e.target)return;let t=e.target.getLayer();t&&(t.children.find(e=>e.name()===`line-guides`)?.destroyChildren(),t.batchDraw())};j.useEffect(()=>{e.current&&(e.current.on(`dragmove`,o),e.current.on(`dragend`,s))},n)}function fK(e,t){return e.x*t.x+e.y*t.y}var pK={"top-left":`bottom-right`,"top-center":`bottom-center`,"top-right":`bottom-left`,"middle-right":`middle-left`,"bottom-right":`top-left`,"bottom-center":`top-center`,"bottom-left":`top-right`,"middle-left":`middle-right`};function mK(e){let{x:t,y:n,width:r,height:i,rotation:a}=e.a,o=a*Math.PI/180,s={x:t+i/2*Math.cos(o+Math.PI/2),y:n+i/2*Math.sin(o+Math.PI/2)};return{middleLeft:s,middleRight:{x:s.x+r*Math.cos(o),y:s.y+r*Math.sin(o)}}}function hK(e,t,n){let r=Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),i=Math.atan2(t.y-e.y,t.x-e.x),a=180*i/Math.PI;return{x:e.x+Math.cos(i-Math.PI/2)*n/2,y:e.y+Math.sin(i-Math.PI/2)*n/2,width:r,height:n,rotation:a}}var gK=(e,t,n)=>{let r=n.anchorSize;return{offsetX:r/2/e,offsetY:r/2/e,width:r/e,height:r/e,cornerRadius:n.anchorCornerRadius/e,fill:n.anchorFill,stroke:n.anchorStroke,strokeWidth:n.anchorStrokeWidth,strokeScaleEnabled:!1,draggable:!0,dragDistance:0,onMouseEnter:e=>{e.target.getStage().container().style.cursor=`crosshair`},onMouseLeave:e=>{e.target.getStage().container().style.cursor=``},onDragStart:e=>{t.history.startTransaction()},onDragEnd:e=>{t.history.endTransaction()}}},_K=Na(({element:e,type:t})=>{let n=jM(e,e.a.color,`fill`),r=jM(e,e.a.color,`stroke`),i=Pw(t,e.height);if(!i)return null;let a=Object.assign(Object.assign(Object.assign({strokeWidth:e.height,lineCap:`round`,lineJoin:`round`},r),n),{opacity:e.a.opacity,hideInExport:!e.showInExport});return i.kind===`circle`?(0,N.jsx)(Wm,Object.assign({x:i.cx,y:i.cy,radius:i.r},a)):(0,N.jsx)(Gm,Object.assign({points:i.points.flat(),closed:i.filled},a))}),vK=Na(({element:e,store:t})=>{let{transformerStyle:n}=xh(),r=j.useRef(null),i=j.useRef(null),a=j.useRef(null),o=e.selectable||t.role===xM.ADMIN,s=uN(),c=t.selectedElements.indexOf(e)>=0&&t.selectedElements.length===1,l=e.isSelected,{middleLeft:u,middleRight:d}=mK(e);dK(i,[r],[c]),dK(a,[r],[c]);let f=jM(e,e.a.color,`stroke`);return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(Gm,Object.assign({ref:r,name:`element`,id:e.id,x:e.a.x,y:e.a.y,points:[0,0,e.a.width,0],offsetY:-e.a.height/2,strokeWidth:e.a.height,hitStrokeWidth:Math.max(e.a.height,20),dash:e.dash.map(t=>t*e.a.height)},f,{rotation:e.a.rotation,opacity:e.animated(`opacity`),shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,listening:o,draggable:s?e.draggable&&l:e.draggable,preventDefault:!s||l,hideInExport:!e.showInExport,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set(QM(t.target))},onTransform:t=>{let n=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set({height:e.height*n,width:e.width*n,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation()})},onTransformEnd:()=>{e.set($M(e))}})),(0,N.jsx)(Vm,{x:u.x,y:u.y,rotation:e.rotation,hideInExport:!e.showInExport,onClick:e=>r.current?.fire(`click`,e),onTap:e=>r.current?.fire(`tap`,e),children:(0,N.jsx)(_K,{element:e,type:e.startHead})}),(0,N.jsx)(Vm,{x:d.x,y:d.y,rotation:e.rotation+180,onClick:e=>r.current?.fire(`click`,e),onTap:e=>r.current?.fire(`tap`,e),children:(0,N.jsx)(_K,{element:e,type:e.endHead})}),c&&e.resizable&&(0,N.jsx)(OM,{selector:`.page-abs-container`,enabled:!0,children:(0,N.jsxs)(`Group`,{visible:c,children:[(0,N.jsx)(`Rect`,Object.assign({x:u.x,y:u.y,ref:i,name:`line-anchor`},gK(t.scale,t,n),{onDragMove:t=>{let n=hK(t.target.position(),d,e.height);e.set({x:n.x,y:n.y,width:n.width,rotation:n.rotation})}})),(0,N.jsx)(`Rect`,Object.assign({x:d.x,y:d.y,ref:a,name:`line-anchor`},gK(t.scale,t,n),{onDragMove:t=>{let n=hK(u,t.target.position(),e.height);e.set({x:n.x,y:n.y,width:n.width,rotation:n.rotation})}}))]})})]})}),yK=e=>{let t=j.useRef(e);return t.current=e,j.useCallback((...e)=>t.current(...e),[])};function bK(e){return Promise.resolve(e.play()).then(()=>`started`,e=>e?.name===`NotAllowedError`?`refused`:`interrupted`)}function xK(){let e=!1,t=0;return{play(n){if(e)return;let r=t;bK(n).then(n=>{n===`refused`&&r===t&&(e=!0)})},reset(){t+=1,e=!1}}}function SK(e,t){let n=CK(e);return n>0&&t>=e.timestamp&&t<e.timestamp+n}function CK(e){let t=e.duration??0;return Number.isFinite(t)&&t>0?t:0}function wK(e){var t;(t=e?.close)==null||t.call(e)}function TK(e){for(let t of e.current)wK(t.frame);e.current=[]}var EK=(e,t,n)=>{let[r,i]=j.useState({input:null,videoSink:null,duration:0,isReady:!1,error:null,hasAlpha:!1});j.useRef(r).current=r;let a=j.useRef(0),o=j.useRef(null),c=j.useRef(null),l=j.useRef(null),u=j.useRef(null),d=j.useRef(null),f=j.useRef(null),b=j.useRef(null),x=j.useRef(!1),S=j.useRef(null),C=j.useRef([]),w=j.useRef(null),T=j.useRef(!1),[,E]=j.useReducer(e=>e+1,0);return j.useEffect(()=>{if(!n)return;let t=!0,r=++a.current,o=null;return(async()=>{try{if(!t||r!==a.current)return;o=mb(`mediabunny init ${e.id}`);let n=await async function(e){if(function(e){return e.startsWith(`data:`)}(e)){let t=function(e){let t=e.indexOf(`,`);if(t===-1)throw Error(`Invalid data URL format`);return _S(e.slice(t+1)).buffer}(e);return new m(t)}if(function(e){return e.startsWith(`file://`)}(e))try{let t=await(await fetch(e)).arrayBuffer();return new m(t)}catch(t){throw Error(`Failed to load file URL: ${e}. File URLs may not be supported in this environment. Error: ${t}`)}return new p(e)}(e.src);if(!t||r!==a.current){o&&=(o(),null);return}let c=new y({source:n,formats:v}),l=await c.computeDuration(),u=await c.getPrimaryVideoTrack();if(!u)throw s(`VIDEO_FAILED`,`No video track found`,{reason:`no-video-track`});if(u.codec===null)throw s(`VIDEO_FAILED`,`Unsupported video codec`,{reason:`unsupported-codec`});if(!await u.canDecode())throw s(`VIDEO_FAILED`,`Unable to decode the video track`,{reason:`cannot-decode`});let d=await u.canBeTransparent(),f=new h(u);if(!t||r!==a.current){c.dispose(),o&&=(o(),null);return}o&&=(o(),null),i(e=>Object.assign(Object.assign({},e),{input:c,videoSink:f,duration:l,isReady:!0,error:null,hasAlpha:d}))}catch(n){if(console.error(`Failed to initialize mediabunny:`,n),o&&=(o(),null),t&&r===a.current){let t=`Failed to initialize mediabunny for video ${e.id}: ${n}`;yb(s(`VIDEO_FAILED`,t,Object.assign({reason:`load`},n?.details),n)),i(e=>Object.assign(Object.assign({},e),{error:String(n),isReady:!1}))}}})(),()=>{t=!1,o&&=(o(),null)}},[e.src,n]),j.useEffect(()=>()=>{c.current&&=(c.current.return(),null),o.current&&=(o.current(),null),l.current=null,u.current=null,d.current=null,f.current=null,x.current=!1,S.current=null,TK(C),w.current=null,T.current=!1,i({input:null,videoSink:null,duration:0,isReady:!1,error:null,hasAlpha:!1})},[n]),j.useEffect(()=>{if(!n||!r.isReady||!r.videoSink)return;let i=++a.current,s=typeof e.src==`string`?e.src.slice(0,120):String(e.src),p=(t,n={},i=`debug`)=>{let a=``;try{a=JSON.stringify(Object.assign(Object.assign({},n),{timeCalc:b.current}))}catch(e){a=`[unserializable extras: ${String(e)}]`}let o=`mediabunny event=${t} elementId=${e.id} targetTime=${f.current} duration=${r.duration} lastFrameTimestamp=${d.current?.timestamp} hasIterator=${!!c.current} prefetchSize=${C.current.length} srcHint=${s} extras=${a}`;i===`error`?console.error(o):i===`warn`?console.warn(o):console.debug(o)},m=e=>{let t=r.duration||0;return t&&Number.isFinite(t)?Math.max(0,Math.min(e,t)):e},h=e=>{let t=e.displayWidth,n=e.displayHeight,i=l.current;i&&i.width===t&&i.height===n||(i||(i=document.createElement(`canvas`),l.current=i,u.current=i.getContext(`2d`,{alpha:r.hasAlpha})),i.width=t,i.height=n);let a=u.current,o=e.timestamp,s=CK(e);try{a&&(r.hasAlpha&&a.clearRect(0,0,i.width,i.height),e.drawWithFit(a,{fit:`contain`}))}finally{wK(e)}d.current={timestamp:o,duration:s}},v=e=>{let t=c.current;t&&(T.current||(T.current=!0,w.current=(async()=>{try{for(;C.current.length<4&&e===a.current;){let n=await t.next();if(e!==a.current){wK(n.value);return}if(n.done||!n.value)break;C.current.push({timestamp:n.value.timestamp,frame:n.value})}}catch{}finally{T.current=!1,w.current=null}})()))},y=e=>{let t=C.current,n=-1;for(let r=0;r<t.length&&!(t[r].timestamp>e);r++)n=r;if(n===-1)return null;let r=t[n];if(!(n<t.length-1||SK(r.frame,e)))return null;for(let e=0;e<n;e++)wK(t[e].frame);return C.current=t.slice(n+1),r},D=()=>TK(C),O=async(e,t,n=0)=>{let i=m(e),o=(e=>{let t=d.current;return!t||e<t.timestamp||e>t.timestamp+.5})(i)?`seek`:`iterate`;try{let n=r.videoSink,s=d.current;if(s&&SK(s,i)){f.current=e;return}let l=y(i);if(l){h(l.frame),f.current=e,v(t),E();return}if(w.current){await w.current;let n=y(i);if(n){h(n.frame),f.current=e,v(t),E();return}}D();let u=()=>p(`iterator_exhausted`,{mode:o,requestedTargetTime:e,clampedTargetTime:i},`warn`),m=async e=>{c.current&&=(await c.current.return(),null),D();let r=n.samples(e);c.current=r;let i=await r.next();return t===a.current?i.done||!i.value?`empty`:(h(i.value),v(t),`drawn`):(i.value&&wK(i.value),await r.return(),c.current===r&&(c.current=null),`cancelled`)};if(o===`seek`){let e=await m(i);if(e===`cancelled`)return;if(e===`empty`){u();return}}else{let e=c.current;if(!e)return;for(;t===a.current;){let n=await e.next();if(t!==a.current){n.value&&wK(n.value);break}if(n.done||!n.value){await m(i)===`empty`&&u();break}let r=n.value;if(SK(r,i)||r.timestamp>=i){h(r),v(t);break}wK(r)}}f.current=e,E()}catch(r){let a=r instanceof Error?{name:r.name,message:r.message,stack:r.stack}:{message:String(r)},s=r instanceof Error?`${r.name}: ${r.message}`:String(r),l=s.includes(`Unsupported configuration`)||s.includes(`isConfigSupported`)||s.includes(`OperationError`);if(p(`frame_process_failed`,{mode:o,requestedTargetTime:e,clampedTargetTime:i,unsupportedConfigAttempt:n,isUnsupportedConfig:l,error:a},`error`),l&&n<1)try{c.current&&=(await c.current.return(),null),D(),w.current=null,T.current=!1,d.current=null,await O(e,t,n+1)}catch{}}},k=kM(e,()=>{let n=r.videoSink,s=r.duration;if(!n||!s)return;let c=e.startTime*s*1e3,l=s*(e.endTime-e.startTime)*1e3,{start:u}=_(e.animations,e.page.duration),d=g(t.currentTime,e.page.startTime,u,l,c,e.speed),f=d/1e3+1e-6,p=m(f);b.current={pageStartTime:e.page.startTime,storeCurrentTime:t.currentTime,offsetMs:c,durationMs:l,restMs:d,targetTime:f,clampedTargetTime:p,startTime:e.startTime,endTime:e.endTime,videoDuration:s},((t,n)=>{x.current?S.current=t:(x.current=!0,o.current||=mb(`mediabunny video frame ${e.id}`),(async()=>{let e=t;for(;e!==null&&n===a.current;)await O(e,n),e=S.current,S.current=null;o.current&&=(o.current(),null),x.current=!1})())})(f,i)});return()=>{k(),a.current++,o.current&&=(o.current(),null)}},[n,r.isReady,r.videoSink,r.duration,t,e]),n&&r.isReady?l.current:null};function DK(){return document.createElement(`canvas`)}var OK=new window.Image;OK.src=aw(`
591
+ <svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
592
+ <path opacity="0.6" d="M4 5.49683V18.5032C4 20.05 5.68077 21.0113 7.01404 20.227L18.0694 13.7239C19.384 12.9506 19.384 11.0494 18.0694 10.2761L7.01404 3.77296C5.68077 2.98869 4 3.95 4 5.49683Z" fill="white"/>
593
+ <path d="M4 5.49683V18.5032C4 20.05 5.68077 21.0113 7.01404 20.227L18.0694 13.7239C19.384 12.9506 19.384 11.0494 18.0694 10.2761L7.01404 3.77296C5.68077 2.98869 4 3.95 4 5.49683Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
594
+ </svg>
595
+ `);var kK=new window.Image;kK.src=aw(`
596
+ <svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
597
+ <path opacity="0.6" d="M14 19L14 5C14 3.89543 14.8954 3 16 3L17 3C18.1046 3 19 3.89543 19 5L19 19C19 20.1046 18.1046 21 17 21L16 21C14.8954 21 14 20.1046 14 19Z" fill="white"/>
598
+ <path opacity="0.6" d="M10 19L10 5C10 3.89543 9.10457 3 8 3L7 3C5.89543 3 5 3.89543 5 5L5 19C5 20.1046 5.89543 21 7 21L8 21C9.10457 21 10 20.1046 10 19Z" fill="white"/>
599
+ <path d="M14 19L14 5C14 3.89543 14.8954 3 16 3L17 3C18.1046 3 19 3.89543 19 5L19 19C19 20.1046 18.1046 21 17 21L16 21C14.8954 21 14 20.1046 14 19Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
600
+ <path d="M10 19L10 5C10 3.89543 9.10457 3 8 3L7 3C5.89543 3 5 3.89543 5 5L5 19C5 20.1046 5.89543 21 7 21L8 21C9.10457 21 10 20.1046 10 19Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
601
+ </svg>
602
+ `);var AK=(e,t,n,r,i=0,a=!1)=>{let o=Math.floor(Math.max(e.width*r,1)),s=Math.floor(Math.max(e.height*r,1)),c=Math.min(i*r,o/2,s/2),l=Math.max(e.width/n.width,e.height/n.height)*r,u=e.page?._exportingOrRendering&&Ay.imageDownScalingEnabled&&l<.95&&!a,f=t instanceof HTMLVideoElement?t.videoWidth:t?.width,p=t instanceof HTMLVideoElement?t.videoHeight:t?.height,m=n.x===0&&n.y===0&&n.width===f&&n.height===p,h=j.useMemo(()=>{if(t&&f&&p)return m&&c===0&&!u?void 0:DK()},[t,c,u,m,f,p]),g=()=>{if(!h||!t)return;h.width=o,h.height=s;let e=h.getContext(`2d`);if(e){if(c&&(e.beginPath(),e.moveTo(c,0),e.lineTo(o-c,0),e.arc(o-c,c,c,3*Math.PI/2,0,!1),e.lineTo(o,s-c),e.arc(o-c,s-c,c,0,Math.PI/2,!1),e.lineTo(c,s),e.arc(c,s-c,c,Math.PI/2,Math.PI,!1),e.lineTo(0,c),e.arc(c,c,c,Math.PI,3*Math.PI/2,!1),e.clip()),u){let r=PN(t,n,h.width,h.height);e.drawImage(r,0,0),d.Util.releaseCanvas(r);return}e.drawImage(t,n.x,n.y,n.width,n.height,0,0,h.width,h.height)}};return j.useLayoutEffect(()=>{g()},[h,e.width,e.height,n.x,n.y,n.width,n.height,i,r,a,e.page?._exportingOrRendering,u]),j.useEffect(()=>()=>{h&&h.nodeName===`CANVAS`&&d.Util.releaseCanvas(h)},[h]),[h||t,g]},jK=DK(),MK=Na(({element:e})=>{let t=Math.min(30,e.width/4,e.height/4),n=j.useRef(null);j.useEffect(()=>{let e=n.current;if(!e)return;let t=new d.Animation(t=>{e.rotate((t?.timeDiff||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}});let{mediaLoadingStyle:r}=xh();return(0,N.jsxs)(Vm,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,N.jsx)(Um,{width:e.width,height:e.height,fill:r.fill}),(0,N.jsx)(`Arc`,{ref:n,x:e.width/2,y:e.height/2,fill:r.textFill,outerRadius:Math.abs(t),innerRadius:Math.max(1,t-5),angle:270})]})}),NK=Na(({element:e})=>{let{mediaErrorStyle:t}=xh(),n=Math.max(10,Math.min(30,e.width/25));return(0,N.jsxs)(Vm,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,N.jsx)(Um,{width:e.width,height:e.height,fill:t.fill}),(0,N.jsx)(qm,{text:`Can not load the video...`,fontSize:n,width:e.width,height:e.height,align:`center`,fill:t.textFill,verticalAlign:`middle`,padding:5})]})}),PK=function(e,t,n){let r=j.useRef(`loading`),i=j.useRef(void 0),[a,o]=j.useState(0),s=j.useRef(void 0),c=j.useRef(void 0),l=j.useRef(void 0);return s.current===e&&c.current===t&&l.current===n||(r.current=`loading`,i.current=void 0,s.current=e,c.current=t,l.current=n),j.useLayoutEffect(function(){if(e){var a=document.createElement(`video`);return a.addEventListener(`canplay`,s),a.addEventListener(`error`,c),t&&(a.crossOrigin=t),n&&(a.referrerPolicy=n),a.src=e,a.load(),function(){a.removeEventListener(`canplay`,s),a.removeEventListener(`error`,c)}}function s(){r.current=`loaded`,i.current=a,i.current.currentTime=0,o(Math.random()),i.current.removeEventListener(`canplay`,s)}function c(e){let t=a.readyState===4,n=a.buffered&&a.buffered.length>0&&a.buffered.end(a.buffered.length-1)/a.duration*100>=100;if(t&&n)return;let s=e.message||a.error?.message||`Unknown error`,c=Error(`Video failed to load: `+s);console.error(c),r.current=`failed`,i.current=void 0,o(Math.random())}},[e,t,n]),[i.current,r.current]};function FK(e){return e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA}var IK=(e,t,n)=>{let r=j.useRef(void 0),i=()=>{var e;(e=r.current)==null||e.call(r),r.current=void 0};j.useEffect(()=>i,[]),j.useLayoutEffect(()=>{let a=t.slice(0,200),o=`video with id ${n} url: ${a}`;e!==`loading`||r.current||(r.current=mb(o)),e!==`loading`&&i(),e===`failed`&&yb(s(`VIDEO_FAILED`,o,{src:a,elementId:n,reason:`load`}))},[e])},LK=Na(({element:e,store:t})=>{let[n,r]=j.useState(!1),i=j.useRef(null),a=j.useRef(null),o=e.isSelected,[s,c]=j.useState(!1),[l,u]=PK(e.src,`anonymous`),[f,p]=j.useState(!1),m=t.activePage===e.page,h=e.page?._exportingOrRendering&&u===`loaded`,v=EK(e,t,h);IK(u,e.src,e.id),l&&(l.playsInline=!0);let y=((e,t,n)=>{let r=j.useMemo(()=>{var r,i;let{flipX:a,flipY:o}=e,s=e.type===`svg`||sw(e.src),c=navigator.userAgent.toLowerCase().indexOf(`firefox`)>-1;if(!(a||o||c&&s))return t;if(!t)return null;let l=t instanceof HTMLVideoElement?t.videoWidth:t?.width,u=t instanceof HTMLVideoElement?t.videoHeight:t?.height;if(!l||!u)return null;let d=DK(),f=1;e.type===`svg`&&(f=Math.max(e.width/l*n,e.height/u*n)),d.width=Math.max(l*f,1),d.height=Math.max(u*f,1);let p=a?-d.width:0,m=o?-d.height:0;return(r=d.getContext(`2d`))==null||r.scale(a?-1:1,o?-1:1),(i=d.getContext(`2d`))==null||i.drawImage(t,p,m,d.width,d.height),d},[e.flipX,e.flipY,t,e.width,e.height,n]);return j.useEffect(()=>()=>{r&&r.nodeName===`CANVAS`&&d.Util.releaseCanvas(r)},[r]),r})(e,l,t._elementsPixelRatio),[b=jK,x]=DN(e,h&&v||y||jK);j.useEffect(()=>{l&&t.history.ignore(()=>{e.set({duration:1e3*l.duration})})},[l]);let S=j.useMemo(xK,[l]);j.useEffect(()=>{if(!l)return;let n=t.animatedElementsIds,r=(!n.length||n.includes(e.id))&&t.isPlaying;if(!m||!r&&!s){l.pause();return}s&&(l.muted=!1,l.currentTime=e.startTime*l.duration,bK(l).then(e=>{e===`refused`&&c(!1)}));let a=new d.Animation(()=>{re()},i.current?.getLayer());a.start();let o=()=>{c(!1),l.currentTime=e.startTime*l.duration},u=()=>{l.currentTime>=e.endTime*l.duration&&(l.pause(),l.currentTime=e.startTime*l.duration,c(!1))};return l.addEventListener(`ended`,o),l.addEventListener(`timeupdate`,u),()=>{l.pause(),a.stop(),l.removeEventListener(`ended`,o),l.removeEventListener(`timeupdate`,u)}},[l,s,t.isPlaying,m]),j.useEffect(()=>{l&&(l.volume=e.volume)},[l,e.volume]),j.useEffect(()=>{l&&(l.playbackRate=e.speed,l.preservesPitch=!1)},[l,e.speed]);let C=j.useRef(null);j.useEffect(()=>{let n=kM(e,()=>{var n;if(l){if(h&&v){re(),t.currentTime;return}let r=t.animatedElementsIds;if(r.length&&!r.includes(e.id))return;let a=t.activePage===e.page,o=t.currentTime>=e.page.startTime&&t.currentTime<e.page.startTime+e.page.duration,c=e.startTime*l.duration*1e3,u=l.duration*(e.endTime-e.startTime)*1e3,{start:d,end:f}=_(e.animations,e.page.duration),p=(t.currentTime||e.page.startTime)-e.page.startTime,m=o?g(t.currentTime,e.page.startTime,d,u,c,e.speed):0,y=m/1e3,b=o&&p>=d&&p<f;s||(l.muted=!b,b&&t.isPlaying&&a?l.paused?(l.currentTime=y,S.play(l)):Math.abs(1e3*l.currentTime-m)>500&&(l.currentTime=y):(S.reset(),l.paused||l.pause(),y!==l.currentTime&&(l.currentTime=y),!FK(l)&&!t.isPlaying&&!C.current&&(C.current=mb(`video ${e.id}`)))),re(),(n=i.current?.getLayer())==null||n.batchDraw()}});return()=>{n(),C.current&&=(C.current(),null)}},[t,l,h,v,s]),j.useEffect(()=>{var t,n;if(!l)return;if(h){(t=C.current)==null||t.call(C),C.current=null;return}let r=()=>{var t,n;!FK(l)&&(t=e.page)!=null&&t._exportingOrRendering||(C.current&&=(re(),(n=i.current?.getLayer())==null||n.batchDraw(),C.current(),null))},a;return(n=e.page)!=null&&n._exportingOrRendering&&(a=setInterval(r,20)),l.addEventListener(`timeupdate`,r),l.addEventListener(`canplay`,r),()=>{clearInterval(a),l.removeEventListener(`timeupdate`,r),l.removeEventListener(`canplay`,r)}},[e.page?._exportingOrRendering,l,e.id,mb,h]);let{cropX:w,cropY:T,cropWidth:E,cropHeight:D}=e;u!==`loaded`&&(w=T=0,E=D=1);let O=(k=b)instanceof HTMLVideoElement?k.videoWidth:k?.width||0;var k;let A=(e=>e instanceof HTMLVideoElement?e.videoHeight:e?.height||0)(b),ee=Ow({cropX:w,cropY:T,cropWidth:E,cropHeight:D,width:e.width,height:e.height},{width:O,height:A}),M=ee.width,P=ee.height,F=e.type===`svg`,I=e.cornerRadius??0,[te,ne]=AK(e,b,ee,t._elementsPixelRatio,I,!0),[L,R]=((e,t,n,r)=>{let i=RN(e.clipSrc||``),[a,o]=(0,eh.default)(i,`anonymous`);IK(e.clipSrc?o:`loaded`,e.clipSrc,e.id);let s=j.useMemo(()=>{if(t&&a)return DK()},[t,a]);function c(){var r;if(!a)return;let i=t instanceof HTMLVideoElement?t.videoWidth:t?.width,o=t instanceof HTMLVideoElement?t.videoHeight:t?.height;if(!t||!i||!o||!a||!a.width||!a.height||!s)return;let c=DK(),l=Math.max(e.width/a.width*n,e.height/a.height*n);c.width=a.width*l,c.height=a.height*l,(r=c.getContext(`2d`))==null||r.drawImage(a,0,0,c.width,c.height),s.width=Math.max(i,1),s.height=Math.max(o,1);let u=s.getContext(`2d`);u&&(u.save(),u.drawImage(c,0,0,i,o),d.Util.releaseCanvas(c),u.globalCompositeOperation=`source-in`,u.drawImage(t,0,0,s.width,s.height),u.restore())}return j.useLayoutEffect(()=>{c()},[s,t,a,e.width,e.height,n,...r]),[e.clipSrc&&a?s:t,c]})(e,te,t._elementsPixelRatio,[ee,I,t._elementsPixelRatio]),re=yK(()=>{var e;x(),ne(),R(),(e=i.current?.getLayer())==null||e.batchDraw()});j.useEffect(()=>{re()});let ie=Math.max(e.width/M,e.height/P);j.useEffect(()=>{if(!e._cropModeEnabled)return;let t=i.current?.getStage();function n(t){e._cropModeEnabled&&t.target!==a.current&&e.toggleCropMode(!1)}function r(n){e._cropModeEnabled&&n.target.parentNode!==t?.content&&e.toggleCropMode(!1)}return document.body.addEventListener(`click`,r),t?.on(`click`,n),t?.on(`tap`,n),()=>{document.body.removeEventListener(`click`,r),document.body.removeEventListener(`touchstart`,r),t?.off(`click`,n),t?.off(`click`,n)}},[e._cropModeEnabled]);let ae=j.useRef(null),oe=j.useRef(null),se=j.useRef(null);j.useLayoutEffect(()=>{e._cropModeEnabled&&(oe.current.nodes([ae.current]),se.current.nodes([a.current]))},[e._cropModeEnabled]);let ce=t=>{Math.round(t.target.x())>0&&(t.target.x(0),t.target.scaleX(1)),Math.round(t.target.y())>0&&(t.target.y(0),t.target.scaleY(1));let n=t.target.width()*t.target.scaleX(),r=t.target.height()*t.target.scaleY(),i=Math.min(1,M/n),a=Math.min(1,P/r),o=1-i,s=Math.min(o,Math.max(0,Math.round(-t.target.x())/n)),c=1-a,l=Math.min(c,Math.max(0,Math.round(-t.target.y())/r));t.target.setAttrs({x:-s*O,y:-l*A,scaleX:1,scaleY:1}),e.set({cropX:s,cropY:l,cropWidth:i,cropHeight:a})},le=()=>{e.type!==`svg`&&e.contentEditable&&setTimeout(()=>{$h(e)&&e.toggleCropMode(!0)})},ue=u===`loading`,de=u===`failed`,fe=!ue&&!de,pe=j.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),me=j.useRef(!1),he=fe?e.a.opacity:0;ob(i,he);let ge=e.selectable||t.role===xM.ADMIN,_e=uN();return(0,N.jsx)(N.Fragment,{children:(0,N.jsxs)(Vm,{onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:[ue&&(0,N.jsx)(MK,{element:e}),de&&(0,N.jsx)(NK,{element:e}),(0,N.jsx)(Km,{ref:i,name:`element`,id:e.id,image:L,x:e.a.x,y:e.a.y,width:e.a.width||1,height:e.a.height||1,rotation:e.a.rotation,opacity:he,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:ee,listening:ge,draggable:_e?e.draggable&&o:e.draggable,preventDefault:!_e||o,hideInExport:!e.showInExport,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set(QM(t.target))},onDblClick:le,onDblTap:le,onTransformStart:t=>{r(!0),me.current=WM(UM(t.target)),pe.current={cropX:e.cropX,cropY:e.cropY,cropWidth:e.cropWidth,cropHeight:e.cropHeight}},onTransform:t=>{let n=t.currentTarget,r=Math.abs(n.scaleX()-1)<1e-7?1:n.scaleX(),i=Math.abs(n.scaleY()-1)<1e-7?1:n.scaleY();n.scaleX(1),n.scaleY(1);let a=1-M/O,o=Math.min(a,Math.max(0,e.cropX)),s=1-P/A,c=Math.min(s,Math.max(0,e.cropY)),l=me.current,u=!l&&r<1&&pe.current.cropHeight>P/A,d=l?e.cropWidth:e.cropWidth*r;u&&(d=e.cropWidth);let f=!l&&i<1&&pe.current.cropWidth>M/O,p=l?e.cropHeight:e.cropHeight*i;f&&(p=e.cropHeight),F&&(d=e.cropWidth,p=e.cropHeight);let m=l?Math.min(r,i):1;e.set(Object.assign({cropX:o,cropY:c,x:n.x(),y:n.y(),width:n.width()*r,height:n.height()*i,rotation:t.target.rotation(),cropWidth:Math.min(d,1-o),cropHeight:Math.min(p,1-c)},m!==1&&Object.assign(Object.assign({},qM(e,m)),{borderSize:e.borderSize*m})))},onTransformEnd:t=>{let n=t.currentTarget;e.set(Object.assign(Object.assign({width:XM(n.width()),height:XM(n.height()),x:XM(n.x()),y:XM(n.y()),rotation:XM(t.target.rotation()),cropX:ZM(e.cropX),cropY:ZM(e.cropY),cropWidth:ZM(M/O),cropHeight:ZM(P/A)},JM(e)),{borderSize:HM(e.borderSize)})),r(!1)}}),(0,N.jsx)(Um,{x:e.a.x,y:e.a.y,width:Math.max(e.a.width-e.borderSize,0),height:Math.max(e.a.height-e.borderSize,0),opacity:he,offsetX:-e.borderSize/2,offsetY:-e.borderSize/2,stroke:e.borderColor,strokeWidth:e.borderSize,listening:!1,visible:!!e.borderSize,rotation:e.rotation,cornerRadius:Math.max(0,I-e.borderSize),hideInExport:!e.showInExport}),!t.isPlaying&&(0,N.jsx)(`Image`,{image:s?f||_e?kK:void 0:OK,x:e.a.x,y:e.a.y,offsetX:-e.a.width/2+15/t.scale,offsetY:-e.a.height/2+15/t.scale,rotation:e.a.rotation,width:30/t.scale,height:30/t.scale,hideInExport:!0,onClick:()=>c(!s),onTap:()=>c(!s)}),e._cropModeEnabled&&(0,N.jsxs)(OM,{selector:`.page-abs-container`,enabled:!0,children:[(0,N.jsx)(`Rect`,{x:-window.innerWidth/t.scale,y:-window.innerWidth/t.scale,width:window.innerWidth/t.scale*3,height:window.innerWidth/t.scale*3,fill:`rgba(0,0,0,0.3)`}),(0,N.jsx)(`Image`,{listening:!1,image:L,x:e.a.x,y:e.a.y,width:e.a.width,height:e.a.height,rotation:e.a.rotation,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur}),(0,N.jsxs)(`Group`,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,scaleX:ie,scaleY:ie,children:[(0,N.jsx)(`Image`,{image:b,ref:a,width:O,height:A,opacity:.4,draggable:!0,x:-e.cropX*O,y:-e.cropY*A,onDragMove:ce,onTransform:ce}),(0,N.jsx)(`Transformer`,{ref:se,anchorSize:20,enabledAnchors:[`top-left`,`top-right`,`bottom-left`,`bottom-right`],boundBoxFunc:(e,t)=>t.width<5||t.height<5?e:t,rotateEnabled:!1,borderEnabled:!1,anchorCornerRadius:10,anchorStrokeWidth:2,borderStrokeWidth:2}),(0,N.jsx)(`Rect`,{width:M,height:P,ref:ae,listening:!1,onTransform:t=>{t.target.x()<-e.cropX*O-1e-9&&(t.target.x(-e.cropX*O),t.target.scaleX(1)),t.target.y()<-e.cropY*A-1e-9&&(t.target.y(-e.cropY*A),t.target.scaleY(1));let n=Math.min(1,Math.max(0,e.cropX+t.target.x()/O)),r=Math.min(1,Math.max(0,t.target.y()/A+e.cropY)),i=t.target.width()*t.target.scaleX(),a=t.target.height()*t.target.scaleY(),o=Math.min(1-n,i/O),s=Math.min(1-r,a/A),c=t.target.getAbsolutePosition(t.target.getParent().getParent());t.target.scale({x:1,y:1}),t.target.position({x:0,y:0}),e.set({x:c.x,y:c.y,cropX:n,cropY:r,cropWidth:o,cropHeight:s,width:Math.min(i*ie,O*(1-n)*ie),height:Math.min(a*ie,A*(1-r)*ie)})}}),(0,N.jsx)(`Transformer`,{ref:oe,enabledAnchors:[`top-left`,`top-right`,`bottom-left`,`bottom-right`],boundBoxFunc:(e,t)=>t.width<5||t.height<5?e:t,keepRatio:!1,rotateEnabled:!1,anchorFill:`rgb(240, 240, 240)`,anchorStrokeWidth:2,borderStrokeWidth:2,visible:e.resizable})]})]})]})})}),RK={},zK=Na(({element:e,store:t})=>{let n=j.useRef(null),r=j.useRef(!1),i=e.selectable||t.role===xM.ADMIN,a=uN(),o=e.isSelected,s=Math.min(e.strokeWidth,e.width/2,e.height/2),c=Math.max(0,Math.min(e.width/2,e.height/2,e.cornerRadius)),l=jM(e,e.a.fill,`fill`),u=Object.assign(Object.assign({width:e.a.width,height:e.a.height},l),{cornerRadius:c,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,preventDefault:!a||o,hideInExport:!e.showInExport}),d=jM(e,e.stroke,`stroke`),f=Object.assign(Object.assign({visible:s>0,x:s/2,y:s/2,width:e.a.width-s,height:e.a.height-s},d),{strokeWidth:s,cornerRadius:Math.max(0,c-s),dash:e.dash.map(e=>e*s),hideInExport:!e.showInExport,listening:!1}),p=Math.max(0,10-Math.min(e.a.width,e.a.height)),m=(h=e.subType,RK[h]||(RK[h]=(g=Qw(h),Na(({element:e,fillProps:t,strokeProps:n,hitStrokeWidth:r})=>{let i=g({width:e.a.width,height:e.a.height,cornerRadius:e.cornerRadius}),a=j.useRef(null);return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`Rect`,{width:e.a.width,height:e.a.height,fill:`transparent`,hitStrokeWidth:r}),(0,N.jsx)(`Path`,Object.assign({},t,{ref:a,data:i})),(0,N.jsx)(`Group`,{clipFunc:e=>{let t=a.current;if(t){var n=t.dataArray;e.beginPath();for(var r=0;r<n.length;r++){var i=n[r].command,o=n[r].points;switch(i){case`L`:e.lineTo(o[0],o[1]);break;case`M`:e.moveTo(o[0],o[1]);break;case`C`:e.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case`Q`:e.quadraticCurveTo(o[0],o[1],o[2],o[3]);break;case`A`:var s=o[0],c=o[1],l=o[2],u=o[3],d=o[4],f=o[5],p=o[6],m=o[7],h=l>u?l:u,g=l>u?1:l/u,_=l>u?u/l:1;e.translate(s,c),e.rotate(p),e.scale(g,_),e.arc(0,0,h,d,d+f,!m),e.scale(1/g,1/_),e.rotate(-p),e.translate(-s,-c);break;case`z`:e.closePath()}}}},children:(0,N.jsx)(`Path`,Object.assign({},n,{x:0,y:0,data:i,strokeWidth:2*n.strokeWidth,dash:n.dash.map(e=>e)}))})]})}))),RK[h]||`Group`);var h,g;return(0,N.jsx)(N.Fragment,{children:(0,N.jsx)(Vm,{ref:n,id:e.id,x:e.a.x,y:e.a.y,rotation:e.a.rotation,opacity:e.a.opacity,listening:i,draggable:a?e.draggable&&o:e.draggable,name:`element`,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set(QM(t.target))},onTransformStart:e=>{r.current=WM(UM(e.target))},onTransform:t=>{let n=t.target.scale();t.target.scaleX(1),t.target.scaleY(1);let i=r.current?Math.min(n.x,n.y):1;e.set(Object.assign({width:e.width*n.x,height:e.height*n.y,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation()},i!==1&&Object.assign(Object.assign({},qM(e,i)),{strokeWidth:e.strokeWidth*i})))},onTransformEnd:()=>{e.set(Object.assign(Object.assign(Object.assign({},$M(e)),JM(e)),{strokeWidth:HM(e.strokeWidth)}))},children:(0,N.jsx)(m,{element:e,fillProps:u,strokeProps:f,hitStrokeWidth:p})})})}),BK=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loop=e.conditional=e.parse=void 0,e.parse=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:r;if(Array.isArray(n))n.forEach(function(n){return e(t,n,r,i)});else if(typeof n==`function`)n(t,r,i,e);else{var a=Object.keys(n)[0];Array.isArray(n[a])?(i[a]={},e(t,n[a],r,i[a])):i[a]=n[a](t,r,i,e)}return r},e.conditional=function(e,t){return function(n,r,i,a){t(n,r,i)&&a(n,e,r,i)}},e.loop=function(e,t){return function(n,r,i,a){for(var o=[],s=n.pos;t(n,r,i);){var c={};if(a(n,e,r,c),n.pos===s)break;s=n.pos,o.push(c)}return o}}})),VK=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.readBits=e.readArray=e.readUnsigned=e.readString=e.peekBytes=e.readBytes=e.peekByte=e.readByte=e.buildStream=void 0,e.buildStream=function(e){return{data:e,pos:0}};var t=function(){return function(e){return e.data[e.pos++]}};e.readByte=t,e.peekByte=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return function(t){return t.data[t.pos+e]}};var n=function(e){return function(t){return t.data.subarray(t.pos,t.pos+=e)}};e.readBytes=n,e.peekBytes=function(e){return function(t){return t.data.subarray(t.pos,t.pos+e)}},e.readString=function(e){return function(t){return Array.from(n(e)(t)).map(function(e){return String.fromCharCode(e)}).join(``)}},e.readUnsigned=function(e){return function(t){var r=n(2)(t);return e?(r[1]<<8)+r[0]:(r[0]<<8)+r[1]}},e.readArray=function(e,t){return function(r,i,a){for(var o=typeof t==`function`?t(r,i,a):t,s=n(e),c=Array(o),l=0;l<o;l++)c[l]=s(r);return c}};var r=function(e,t,n){for(var r=0,i=0;i<n;i++)r+=e[t+i]&&2**(n-i-1);return r};e.readBits=function(e){return function(n){for(var i=t()(n),a=Array(8),o=0;o<8;o++)a[7-o]=!!(i&1<<o);return Object.keys(e).reduce(function(t,n){var i=e[n];return t[n]=i.length?r(a,i.index,i.length):a[i.index],t},{})}}})),HK=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=BK(),n=VK(),r={blocks:function(e){for(var t=0,r=[],i=e.data.length,a=0,o=(0,n.readByte)()(e);o!==t&&o;o=(0,n.readByte)()(e)){if(e.pos+o>=i){var s=i-e.pos;r.push((0,n.readBytes)(s)(e)),a+=s;break}r.push((0,n.readBytes)(o)(e)),a+=o}for(var c=new Uint8Array(a),l=0,u=0;u<r.length;u++)c.set(r[u],l),l+=r[u].length;return c}},i=(0,t.conditional)({gce:[{codes:(0,n.readBytes)(2)},{byteSize:(0,n.readByte)()},{extras:(0,n.readBits)({future:{index:0,length:3},disposal:{index:3,length:3},userInput:{index:6},transparentColorGiven:{index:7}})},{delay:(0,n.readUnsigned)(!0)},{transparentColorIndex:(0,n.readByte)()},{terminator:(0,n.readByte)()}]},function(e){var t=(0,n.peekBytes)(2)(e);return t[0]===33&&t[1]===249}),a=(0,t.conditional)({image:[{code:(0,n.readByte)()},{descriptor:[{left:(0,n.readUnsigned)(!0)},{top:(0,n.readUnsigned)(!0)},{width:(0,n.readUnsigned)(!0)},{height:(0,n.readUnsigned)(!0)},{lct:(0,n.readBits)({exists:{index:0},interlaced:{index:1},sort:{index:2},future:{index:3,length:2},size:{index:5,length:3}})}]},(0,t.conditional)({lct:(0,n.readArray)(3,function(e,t,n){return 2**(n.descriptor.lct.size+1)})},function(e,t,n){return n.descriptor.lct.exists}),{data:[{minCodeSize:(0,n.readByte)()},r]}]},function(e){return(0,n.peekByte)()(e)===44}),o=(0,t.conditional)({text:[{codes:(0,n.readBytes)(2)},{blockSize:(0,n.readByte)()},{preData:function(e,t,r){return(0,n.readBytes)(r.text.blockSize)(e)}},r]},function(e){var t=(0,n.peekBytes)(2)(e);return t[0]===33&&t[1]===1}),s=(0,t.conditional)({application:[{codes:(0,n.readBytes)(2)},{blockSize:(0,n.readByte)()},{id:function(e,t,r){return(0,n.readString)(r.blockSize)(e)}},r]},function(e){var t=(0,n.peekBytes)(2)(e);return t[0]===33&&t[1]===255}),c=(0,t.conditional)({comment:[{codes:(0,n.readBytes)(2)},r]},function(e){var t=(0,n.peekBytes)(2)(e);return t[0]===33&&t[1]===254});e.default=[{header:[{signature:(0,n.readString)(3)},{version:(0,n.readString)(3)}]},{lsd:[{width:(0,n.readUnsigned)(!0)},{height:(0,n.readUnsigned)(!0)},{gct:(0,n.readBits)({exists:{index:0},resolution:{index:1,length:3},sort:{index:4},size:{index:5,length:3}})},{backgroundColorIndex:(0,n.readByte)()},{pixelAspectRatio:(0,n.readByte)()}]},(0,t.conditional)({gct:(0,n.readArray)(3,function(e,t){return 2**(t.lsd.gct.size+1)})},function(e,t){return t.lsd.gct.exists}),{frames:(0,t.loop)([i,s,c,a,o],function(e){var t=(0,n.peekByte)()(e);return t===33||t===44})}]})),UK=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.deinterlace=void 0,e.deinterlace=function(e,t){for(var n=Array(e.length),r=e.length/t,i=function(r,i){var a=e.slice(i*t,(i+1)*t);n.splice.apply(n,[r*t,t].concat(a))},a=[0,4,2,1],o=[8,8,4,2],s=0,c=0;c<4;c++)for(var l=a[c];l<r;l+=o[c])i(l,s),s++;return n}})),WK=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.lzw=void 0,e.lzw=function(e,t,n){var r=4096,i=-1,a=n,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S=Array(n),C=Array(r),w=Array(r),T=Array(r+1);for(_=e,s=1<<_,u=s+1,o=s+2,f=i,l=_+1,c=(1<<l)-1,m=0;m<s;m++)C[m]=0,w[m]=m;var g=p=v=y=x=b=0,p,v,y,x,b;for(h=0;h<a;){if(y===0){if(p<l){g+=t[b]<<p,p+=8,b++;continue}if(m=g&c,g>>=l,p-=l,m>o||m==u)break;if(m==s){l=_+1,c=(1<<l)-1,o=s+2,f=i;continue}if(f==i){T[y++]=w[m],f=m,v=m;continue}for(d=m,m==o&&(T[y++]=v,m=f);m>s;)T[y++]=w[m],m=C[m];v=w[m]&255,T[y++]=v,o<r&&(C[o]=f,w[o]=v,o++,(o&c)===0&&o<r&&(l++,c+=o)),f=d}y--,S[x++]=T[y],h++}for(h=x;h<a;h++)S[h]=0;return S}})),GK=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.decompressFrames=e.decompressFrame=e.parseGIF=void 0;var t=o(HK()),n=BK(),r=VK(),i=UK(),a=WK();function o(e){return e&&e.__esModule?e:{default:e}}e.parseGIF=function(e){var i=new Uint8Array(e);return(0,n.parse)((0,r.buildStream)(i),t.default)};var s=function(e){for(var t=e.pixels.length,n=new Uint8ClampedArray(t*4),r=0;r<t;r++){var i=r*4,a=e.pixels[r],o=e.colorTable[a]||[0,0,0];n[i]=o[0],n[i+1]=o[1],n[i+2]=o[2],n[i+3]=a===e.transparentIndex?0:255}return n},c=function(e,t,n){if(!e.image){console.warn(`gif frame does not have associated image.`);return}var r=e.image,o=r.descriptor.width*r.descriptor.height,c=(0,a.lzw)(r.data.minCodeSize,r.data.blocks,o);r.descriptor.lct.interlaced&&(c=(0,i.deinterlace)(c,r.descriptor.width));var l={pixels:c,dims:{top:e.image.descriptor.top,left:e.image.descriptor.left,width:e.image.descriptor.width,height:e.image.descriptor.height}};return l.colorTable=r.descriptor.lct&&r.descriptor.lct.exists?r.lct:t,e.gce&&(l.delay=(e.gce.delay||10)*10,l.disposalType=e.gce.extras.disposal,e.gce.extras.transparentColorGiven&&(l.transparentIndex=e.gce.transparentColorIndex)),n&&(l.patch=s(l)),l};e.decompressFrame=c,e.decompressFrames=function(e,t){return e.frames.filter(function(e){return e.image}).map(function(n){return c(n,e.gct,t)})}}))();function KK(e,t,n){let r=t.getContext(`2d`),i=n.getContext(`2d`);if(!r||!i)return;e.disposalType===2&&r.clearRect(0,0,t.width,t.height),n.width=e.width,n.height=e.height;let a=i.createImageData(e.width,e.height);a.data.set(e.patch),i.putImageData(a,0,0),r.drawImage(n,e.left,e.top)}var qK=Na(({element:e})=>{let t=Math.min(30,e.width/4,e.height/4),n=j.useRef(null);j.useEffect(()=>{let e=n.current;if(!e)return;let t=new d.Animation(t=>{e.rotate((t?.timeDiff||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}},[]);let{mediaLoadingStyle:r}=xh();return(0,N.jsxs)(Vm,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,N.jsx)(Um,{width:e.width,height:e.height,fill:r.fill}),(0,N.jsx)(`Arc`,{ref:n,x:e.width/2,y:e.height/2,fill:r.textFill,outerRadius:Math.abs(t),innerRadius:Math.max(1,t-5),angle:270})]})}),JK=Na(({element:e})=>{let{mediaErrorStyle:t}=xh(),n=Math.max(10,Math.min(30,e.width/22));return(0,N.jsxs)(Vm,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,N.jsx)(Um,{width:e.width,height:e.height,fill:t.fill}),(0,N.jsx)(qm,{text:`Cannot load the GIF...`,fontSize:n,width:e.width,height:e.height,align:`center`,fill:t.textFill,verticalAlign:`middle`,padding:5})]})}),YK=Na(({element:e,store:t})=>{let[n,r]=j.useState(!1),i=j.useRef(!1),a=e.isSelected,o=j.useRef(null),s=j.useRef(void 0),[c,l,u,f]=function(e){let[t,n]=j.useState([]),[r,i]=j.useState(0),[a,o]=j.useState(`loading`),[s,c]=j.useState({width:0,height:0});return j.useEffect(()=>{(async()=>{try{let t=await(await fetch(e)).arrayBuffer(),r=(0,GK.parseGIF)(t),a=(0,GK.decompressFrames)(r,!0),s=r.lsd.width,l=r.lsd.height;c({width:s,height:l});let u=a.map(e=>({patch:new Uint8ClampedArray(e.patch),delay:e.delay,width:e.dims.width,height:e.dims.height,left:e.dims.left,top:e.dims.top,disposalType:e.disposalType})),d=u.reduce((e,t)=>e+t.delay,0);n(u),i(d),o(`loaded`)}catch(e){console.error(`Failed to load GIF:`,e),o(`failed`)}})()},[e]),[t,r,s,a]}(e.src);ZN(f,e.src,e.id),j.useEffect(()=>(s.current=document.createElement(`canvas`),()=>{s.current&&d.Util.releaseCanvas(s.current)}),[]),j.useEffect(()=>{if(f===`loaded`&&s.current&&(s.current.width=u.width,s.current.height=u.height,c.length>0)){let e=s.current.getContext(`2d`);if(e){e.clearRect(0,0,u.width,u.height);let t=document.createElement(`canvas`);KK(c[0],s.current,t)}}},[u,f,c]),j.useEffect(()=>{if(!c.length||!s.current)return;let n=s.current;n.width=u.width,n.height=u.height;let r=document.createElement(`canvas`),i=n.getContext(`2d`);i&&i.clearRect(0,0,n.width,n.height);let a=-1;KK(c[0],n,r),C(),a=0;let d=e=>{let t=(e=>{let t=e%l,n=0;for(let e=0;e<c.length;e++)if(n+=c[e].delay,n>t)return e;return 0})(e);t!==a&&(KK(c[t],n,r),C(),o.current.getLayer().draw(),a=t)};if(t.isPlaying||e.page?._exportingOrRendering)return kM(e,()=>{d(t.currentTime-e.page.startTime)});{let e=window.setInterval(()=>{d(t.currentTime||performance.now())},16);return()=>{clearInterval(e)}}},[t.isPlaying,c,l,e.page?._exportingOrRendering]),j.useEffect(()=>{l&&t.history.ignore(()=>{e.set({duration:l})})},[l]);let{cropX:p,cropY:m,cropWidth:h,cropHeight:g}=e;f!==`loaded`&&(p=m=0,h=g=1);let _={x:u.width*p,y:u.height*m,width:u.width*h,height:u.height*g},v=e.cornerRadius??0,[y,b]=DN(e,s.current),[x,S]=AK(e,y,_,t._elementsPixelRatio,v,n||e._cropModeEnabled),C=yK(()=>{b(),S()}),w=f===`loading`,T=f===`failed`,E=w||T?0:e.a.opacity;ob(o,E);let D=e.selectable||t.role===xM.ADMIN,O=uN();return(0,N.jsxs)(N.Fragment,{children:[w&&(0,N.jsx)(qK,{element:e}),T&&(0,N.jsx)(JK,{element:e}),(0,N.jsx)(Km,{ref:o,name:`element`,id:e.id,image:x,x:e.a.x,y:e.a.y,width:e.a.width||1,height:e.a.height||1,rotation:e.a.rotation,opacity:E,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:_,listening:D,draggable:O?e.draggable&&a:e.draggable,preventDefault:!O||a,hideInExport:!e.showInExport,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set(QM(t.target))},onTransformStart:e=>{r(!0),i.current=WM(UM(e.target))},onTransform:t=>{let n=t.currentTarget,r=Math.abs(n.scaleX()-1)<1e-7?1:n.scaleX(),a=Math.abs(n.scaleY()-1)<1e-7?1:n.scaleY();n.scaleX(1),n.scaleY(1);let o=i.current?Math.min(r,a):1;e.set(Object.assign({x:n.x(),y:n.y(),width:n.width()*r,height:n.height()*a,rotation:n.rotation()},o!==1&&Object.assign(Object.assign({},qM(e,o)),{borderSize:e.borderSize*o})))},onTransformEnd:()=>{e.set(Object.assign(Object.assign(Object.assign({},$M(e)),JM(e)),{borderSize:HM(e.borderSize)})),r(!1)}}),(0,N.jsx)(Um,{x:e.a.x,y:e.a.y,width:Math.max(e.a.width-e.borderSize,0),height:Math.max(e.a.height-e.borderSize,0),opacity:E,offsetX:-e.borderSize/2,offsetY:-e.borderSize/2,stroke:e.borderColor,strokeWidth:e.borderSize,listening:!1,visible:!!e.borderSize,rotation:e.rotation,cornerRadius:Math.max(0,v-e.borderSize),hideInExport:!e.showInExport})]})}),XK=`#0d83dd`,ZK=(e,t)=>{let n=e.target.getStage();n&&(n.container().style.cursor=t)},QK=Na(({axis:e,hovered:t,pillX:n,pillY:r,pillW:i,pillH:a,hitX:o,hitY:s,hitW:c,hitH:l,tint:u,hoverKind:d,idx:f,onSelect:p,onHoverChange:m})=>(0,N.jsxs)(N.Fragment,{children:[t&&(0,N.jsx)(`Rect`,{x:u.x,y:u.y,width:u.width,height:u.height,fill:`rgba(13, 131, 221, 0.08)`,listening:!1}),(0,N.jsx)(Um,{x:n,y:r,width:i,height:a,cornerRadius:Math.min(i,a)/2,fill:t?XK:`#9ca3af`,opacity:t?.55:.18,listening:!1}),(0,N.jsx)(Um,{x:o,y:s,width:c,height:l,fill:`transparent`,onMouseEnter:e=>{m({kind:d,idx:f}),ZK(e,`pointer`)},onMouseLeave:e=>{m(null),ZK(e,``)},onClick:p})]})),$K=Na(({x:e,y:t,hovered:n,hoverKind:r,idx:i,isTouch:a,sizes:o,onInsert:s,onHoverChange:c})=>{let{hit:l,r:u,halo:d,stroke:f}=o,p=n||a;return(0,N.jsxs)(Vm,{x:e,y:t,onMouseEnter:e=>{c({kind:r,idx:i}),ZK(e,`pointer`)},onMouseLeave:e=>{c(null),ZK(e,``)},onClick:e=>{e.cancelBubble=!0,s()},children:[(0,N.jsx)(Um,{x:-l/2,y:-l/2,width:l,height:l,fill:`transparent`}),p&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`Circle`,{radius:u+d,fill:`white`,listening:!1}),(0,N.jsx)(`Circle`,{radius:u,fill:XK,listening:!1}),(0,N.jsx)(`Line`,{points:[.55*-u,0,.55*u,0],stroke:`white`,strokeWidth:f,lineCap:`round`,listening:!1}),(0,N.jsx)(`Line`,{points:[0,.55*-u,0,.55*u],stroke:`white`,strokeWidth:f,lineCap:`round`,listening:!1})]})]})}),eq=Na(({element:e,store:t,inv:n,isTouch:r,hover:i,setHover:a})=>{let o=16*n,s=2*n,c=10*n,l={hit:22*n,r:7*n,halo:2*n,stroke:2*n},u=(e,t)=>i!==null&&i.kind===e&&i.idx===t,d=(t,n)=>r=>{r.cancelBubble=!0;let i=e._anchorCellId?e.cells.find(t=>t.id===e._anchorCellId):void 0;r.evt.shiftKey&&i?t===`col`?e.selectColumnRange(i.col,n):e.selectRowRange(i.row,n):t===`col`?e.selectColumn(n):e.selectRow(n)},f=[0],p=[0];for(let t=0;t<e.cols;t++)f.push(f[t]+e.colWidths[t]*e.a.width);for(let t=0;t<e.rows;t++)p.push(p[t]+e.rowHeights[t]*e.a.height);let m=[];for(let t=0;t<e.cols;t++){let n=Math.max(0,f[t+1]-f[t]-6);n<=0||m.push((0,N.jsx)(QK,{axis:`col`,hovered:u(`colSelect`,t),pillX:f[t]+3,pillY:-s-c,pillW:n,pillH:s,hitX:f[t]+1,hitY:-o-c+s,hitW:n+4,hitH:o,tint:{x:f[t],y:0,width:f[t+1]-f[t],height:e.a.height},hoverKind:`colSelect`,idx:t,onSelect:d(`col`,t),onHoverChange:a},`col-pill-${t}`))}for(let n=0;n<=e.cols;n++)m.push((0,N.jsx)($K,{x:f[n],y:-c-s/2,hovered:u(`colInsert`,n),hoverKind:`colInsert`,idx:n,isTouch:r,sizes:l,onInsert:()=>t.history.transaction(()=>e.addColumn(n)),onHoverChange:a},`col-insert-${n}`));for(let t=0;t<e.rows;t++){let n=Math.max(0,p[t+1]-p[t]-6);n<=0||m.push((0,N.jsx)(QK,{axis:`row`,hovered:u(`rowSelect`,t),pillX:-s-c,pillY:p[t]+3,pillW:s,pillH:n,hitX:-o-c+s,hitY:p[t]+1,hitW:o,hitH:n+4,tint:{x:0,y:p[t],width:e.a.width,height:p[t+1]-p[t]},hoverKind:`rowSelect`,idx:t,onSelect:d(`row`,t),onHoverChange:a},`row-pill-${t}`))}for(let n=0;n<=e.rows;n++)m.push((0,N.jsx)($K,{x:-c-s/2,y:p[n],hovered:u(`rowInsert`,n),hoverKind:`rowInsert`,idx:n,isTouch:r,sizes:l,onInsert:()=>t.history.transaction(()=>e.addRow(n)),onHoverChange:a},`row-insert-${n}`));return(0,N.jsx)(N.Fragment,{children:m})}),tq=Na(({element:e,store:t})=>{let n=j.useRef(null),r=j.useRef(null),i=e.selectable||t.role===xM.ADMIN,a=uN(),o=e.isSelected,s=e._focusedCellIds.length>0,c=e.editingCell,l=1/Math.max(.01,t.scale),[u,d]=j.useState(null);j.useEffect(()=>{o||(e.clearCellFocus(),d(null))},[o]);let f=c?._editModeEnabled;j.useEffect(()=>{e._editingCellId&&c&&!c._editModeEnabled&&e.exitCellEdit()},[f]),j.useEffect(()=>{s&&!e._editingCellId&&setTimeout(()=>r.current?.focus(),0)},[s,e._editingCellId]);let p=j.useMemo(()=>Qt.box(!1),[]);j.useEffect(()=>kM(e,()=>{p.get()||e._fitRowsToContent&&t.history.ignore(()=>{e._applyFitRowsToContent()})}),[e,t,p]);let m=t=>{let r=t.target.getStage();if(!r)return;let i=r.getPointerPosition();if(!i)return;let a=n.current;if(!a)return;let o=a.getAbsoluteTransform().copy().invert().point(i);for(let t of e.visibleCells){let n=e.getCellRect(t.row,t.col,t.rowSpan,t.colSpan);if(o.x>=n.x&&o.x<=n.x+n.width&&o.y>=n.y&&o.y<=n.y+n.height)return t}},h=(e,t)=>e===`dashed`?[4*t,2*t]:e===`dotted`?[t,t]:void 0,g=[];for(let t of e.visibleCells){let n=e.getCellRect(t.row,t.col,t.rowSpan,t.colSpan),r=t.row===0,i=t.row+t.rowSpan===e.rows,a=t.col===0,o=t.col+t.colSpan===e.cols;if(t.row===0){let e=t.getEffectiveBorder(`top`);if(e.style!==`none`&&e.width>0){let r=n.y+e.width/2,i=n.x-(a?0:e.width/2),s=n.x+n.width+(o?0:e.width/2);g.push((0,N.jsx)(Gm,{points:[i,r,s,r],stroke:e.color,strokeWidth:e.width,dash:h(e.style,e.width),listening:!1},`bt-${t.id}`))}}if(t.col===0){let e=t.getEffectiveBorder(`left`);if(e.style!==`none`&&e.width>0){let a=n.x+e.width/2,o=n.y-(r?0:e.width/2),s=n.y+n.height+(i?0:e.width/2);g.push((0,N.jsx)(Gm,{points:[a,o,a,s],stroke:e.color,strokeWidth:e.width,dash:h(e.style,e.width),listening:!1},`bl-${t.id}`))}}{let e=t.getEffectiveBorder(`bottom`);if(e.style!==`none`&&e.width>0){let r=i?n.y+n.height-e.width/2:n.y+n.height,s=n.x-(a?0:e.width/2),c=n.x+n.width+(o?0:e.width/2);g.push((0,N.jsx)(Gm,{points:[s,r,c,r],stroke:e.color,strokeWidth:e.width,dash:h(e.style,e.width),listening:!1},`bb-${t.id}`))}}{let e=t.getEffectiveBorder(`right`);if(e.style!==`none`&&e.width>0){let a=o?n.x+n.width-e.width/2:n.x+n.width,s=n.y-(r?0:e.width/2),c=n.y+n.height+(i?0:e.width/2);g.push((0,N.jsx)(Gm,{points:[a,s,a,c],stroke:e.color,strokeWidth:e.width,dash:h(e.style,e.width),listening:!1},`br-${t.id}`))}}}return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(Um,{id:e.id,name:`element`,x:e.a.x,y:e.a.y,rotation:e.a.rotation,width:e.a.width,height:e.a.height,fill:`transparent`,opacity:e.a.opacity,hideInExport:!e.showInExport,listening:i,draggable:a?e.draggable&&o:e.draggable,onClick:t=>{if(!o||e.locked||!e.contentEditable)return;let n=m(t);n&&(t.evt.shiftKey&&s?(t.cancelBubble=!0,e.focusCellRange(n.row,n.col)):e.focusCell(n.id))},onDblClick:t=>{if(!o||e.locked||!e.contentEditable)return;let n=m(t);n&&e.enterCellEdit(n.id)},onDragMove:t=>{var r;let i=t.target;e.set({x:i.x(),y:i.y()}),(r=n.current)==null||r.position({x:i.x(),y:i.y()})},onDragEnd:t=>{e.set(QM(t.target))},onTransformStart:()=>{hr(()=>p.set(!0))},onTransformEnd:()=>{e.set({x:XM(e.x),y:XM(e.y),width:XM(e.width),rotation:XM(e.rotation)}),e._resetBaseRowHeights(),hr(()=>p.set(!1))},onTransform:t=>{var r,i;let a=t.target,o=a.scaleX(),s=a.scaleY();a.scaleX(1),a.scaleY(1);let c=e.width*o,l=e.height*s;a.width(c),a.height(l);let u=a.x(),d=a.y(),f=a.rotation();(r=n.current)==null||r.position({x:u,y:d}),(i=n.current)==null||i.rotation(f),e.set({width:c,x:u,y:d,rotation:f}),e.setHeightRedistribute(l)}}),(0,N.jsxs)(Vm,{ref:n,x:e.a.x,y:e.a.y,rotation:e.a.rotation,opacity:e.a.opacity,hideInExport:!e.showInExport,scaleX:e.a.width/e.width,scaleY:e.a.height/e.height,children:[e.visibleCells.map(t=>{let n=e.getCellRect(t.row,t.col,t.rowSpan,t.colSpan);return t.cellBackground===`transparent`?null:(0,N.jsx)(Um,{x:n.x,y:n.y,width:n.width,height:n.height,fill:t.cellBackground,listening:!1},`bg-${t.id}`)}),g,e.visibleCells.map(e=>(0,N.jsx)(EN,{element:e,store:t},`text-${e.id}`)),o&&e._focusedCellIds.map(t=>{let n=e.cells.find(e=>e.id===t);if(!n)return null;let r=e.getCellRect(n.row,n.col,n.rowSpan,n.colSpan),i=2*l;return(0,N.jsx)(`Rect`,{x:r.x,y:r.y,width:r.width,height:r.height,fill:`rgba(13, 131, 221, 0.1)`,stroke:`#0d83dd`,strokeWidth:i,listening:!1},`focus-${t}`)}),s&&!c&&(0,N.jsx)(DM,{children:(0,N.jsx)(`div`,{ref:r,tabIndex:-1,style:{position:`absolute`,opacity:0,width:`1px`,height:`1px`,pointerEvents:`none`,outline:`none`}})}),o&&!c&&!t.isPlaying&&(()=>{let n=[],r=0;for(let i=0;i<e.cols-1;i++){r+=e.colWidths[i]*e.a.width;let a=r,o=i;n.push((0,N.jsx)(`Line`,{x:a,points:[0,0,0,e.a.height],stroke:`transparent`,strokeWidth:1,hitStrokeWidth:16,draggable:!0,onMouseEnter:e=>{let t=e.target.getStage()?.container();t&&(t.style.cursor=`col-resize`),d({kind:`colInsert`,idx:o+1})},onMouseLeave:e=>{let t=e.target.getStage()?.container();t&&(t.style.cursor=``),d(null)},onDragStart:e=>{e.cancelBubble=!0,t.history.startTransaction()},onDragMove:t=>{t.cancelBubble=!0;let n=t.target,r=(n.x()-a)/e.width;n.x(a),e.resizeColumn(o,r)},onDragEnd:e=>{e.cancelBubble=!0,e.target.x(a),t.history.endTransaction()}},`col-resize-${i}`))}return n})(),o&&!c&&!t.isPlaying&&(()=>{let n=[],r=0;for(let i=0;i<e.rows-1;i++){r+=e.rowHeights[i]*e.a.height;let a=r,o=i;n.push((0,N.jsx)(`Line`,{y:a,points:[0,0,e.a.width,0],stroke:`transparent`,strokeWidth:1,hitStrokeWidth:16,draggable:!0,onMouseEnter:e=>{let t=e.target.getStage()?.container();t&&(t.style.cursor=`row-resize`),d({kind:`rowInsert`,idx:o+1})},onMouseLeave:e=>{let t=e.target.getStage()?.container();t&&(t.style.cursor=``),d(null)},onDragStart:e=>{e.cancelBubble=!0,hr(()=>p.set(!0)),t.history.startTransaction()},onDragMove:t=>{t.cancelBubble=!0;let n=t.target,r=(n.y()-a)/e.height;n.y(a),e.resizeRow(o,r)},onDragEnd:n=>{n.cancelBubble=!0,n.target.y(a),e._resetBaseRowHeights(),hr(()=>p.set(!1)),t.history.endTransaction()}},`row-resize-${i}`))}return n})(),o&&!c&&!t.isPlaying&&(0,N.jsx)(eq,{element:e,store:t,inv:l,isTouch:a,hover:u,setHover:d})]})]})}),nq=Na(({element:e})=>{let{highlighterStyle:t}=xh();return(0,N.jsx)(Um,Object.assign({name:`highlighter`,x:e.a.x,y:e.a.y,rotation:e.a.rotation,width:e.a.width,height:e.a.height,listening:!1,strokeScaleEnabled:!1},t))}),rq={text:EN,image:QN,svg:QN,line:vK,video:LK,figure:zK,group:Na(e=>{let{element:t,store:n}=e,r=t,{children:i}=r,a=t.selectable||n.role===xM.ADMIN,o=r.a;return(0,N.jsx)(Vm,{x:o.x,y:o.y,offsetX:o.offsetX,offsetY:o.offsetY,scaleX:o.scaleX,scaleY:o.scaleY,rotation:o.rotation,opacity:o.opacity,listening:a,hideInExport:!t.showInExport,id:t.id,children:i.map(t=>(0,j.createElement)(aq,Object.assign({},e,{key:t.id,store:n,element:t})))})}),gif:YK,table:tq},iq=(e,t)=>{let n=[];aM(e,e=>{e.type!==`group`&&n.push(e.a)});let r=[];n.forEach(e=>{let t=[{x:0,y:0},{x:0+e.width,y:0},{x:0+e.width,y:0+e.height},{x:0,y:0+e.height}],n=new d.Transform;n.translate(e.x,e.y),n.rotate(d.Util.degToRad(e.rotation)),t.forEach(e=>{let t=n.point(e);r.push(t)})});let i=new d.Transform;i.rotate(-d.Util.degToRad(t));let a=1/0,o=1/0,s=-1/0,c=-1/0;r.forEach(e=>{let t=i.point(e);a=Math.min(a,t.x),o=Math.min(o,t.y),s=Math.max(s,t.x),c=Math.max(c,t.y)}),i.invert();let l=i.point({x:a,y:o});return{x:l.x,y:l.y,width:s-a,height:c-o,rotation:t}},aq=Na(e=>{let{element:t,store:n}=e,[r,i]=j.useState(!1),a=t.isSelectedDirectly,o=t.parent?.type===`group`,s=t.type!==`group`||o?null:n.selectedElements,c=!!s&&s.length===1&&s[0]!==t&&s[0].top===t,[l,u]=j.useState(!1),[d,f]=j.useState(null),p=j.useCallback(e=>{f(e?e.getStage():null)},[]),m=j.useRef(void 0),h=()=>(m.current||=d?.findOne(`Transformer`),m.current);j.useEffect(()=>{if(d){let e=e=>{let r=e.target.findAncestor(`.element`,!0),a=n.getElementById(r?.id())?.top?.id;i(a===t.id)};d.on(`mouseover`,e);let r=()=>{i(!1)};return d.on(`mouseleave`,r),()=>{d.off(`mouseover`,e),d.off(`mouseleave`,r)}}},[d]),j.useEffect(()=>{if(!c)return;let e=h();if(!d||!e)return;u(!1);let t=()=>u(!0),n=()=>u(!1);return d.on(`dragstart`,t),d.on(`dragend`,n),e.on(`transformstart`,t),e.on(`transformend`,n),()=>{d.off(`dragstart`,t),d.off(`dragend`,n),e.off(`transformstart`,t),e.off(`transformend`,n)}},[d,c]);let g=rq[e.element.type];return e.element.type===`text`&&(Ay.renderTagTextEnabled?g=iK:Ay.htmlRenderEnabled&&(g=eK)),e.element.visible?g?(0,N.jsxs)(Vm,{name:`element-container`,ref:p,visible:t.active,listening:t.active,children:[(0,N.jsx)(g,Object.assign({},e)),(r||c)&&!a&&!o&&!l&&(0,N.jsx)(nq,{element:t.type===`group`?{a:iq(t,c?`rotation`in s[0]?s[0].rotation:0:h()?.rotation()||0)}:t})]}):(console.error(`Can not find component for `+e.element.type),null):null});function oq(e,t=.5){if(e.length<3)return e;let n=[];n.push(e[0]);for(let t=0;t<e.length-1;t++){let r=e[Math.max(0,t-1)],i=e[t],a=e[t+1],o=e[Math.min(e.length-1,t+2)];for(let e=0;e<10;e++){let t=e/10,s=t*t,c=s*t,l=.5*(2*i.x+(-r.x+a.x)*t+(2*r.x-5*i.x+4*a.x-o.x)*s+(-r.x+3*i.x-3*a.x+o.x)*c),u=.5*(2*i.y+(-r.y+a.y)*t+(2*r.y-5*i.y+4*a.y-o.y)*s+(-r.y+3*i.y-3*a.y+o.y)*c);n.push({x:l,y:u})}}return n.push(e[e.length-1]),n}function sq(e){if(e.length===0)return``;if(e.length===1){let t=e[0];return`M ${t.x},${t.y} L ${t.x+.1},${t.y}`}let t=`M ${e[0].x},${e[0].y}`;for(let n=1;n<e.length-1;n++){let r=e[n],i=e[n+1],a=(r.x+i.x)/2,o=(r.y+i.y)/2;t+=` Q ${r.x},${r.y} ${a},${o}`}if(e.length>1){let n=e[e.length-1];t+=` L ${n.x},${n.y}`}return t}function cq(e){if(e.length===0)return{x:0,y:0,width:0,height:0};let t=e[0].x,n=e[0].y,r=e[0].x,i=e[0].y;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return{x:t,y:n,width:r-t,height:i-n}}function lq(e,t){if(e.length===0)throw Error(`Cannot create SVG from empty path`);let n=t.smooth?oq(e):e,r=cq(n),i=t.strokeWidth,a=r.x-i,o=r.y-i,s=r.width+2*i,c=r.height+2*i;return{src:aw(`\n <svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${c}" viewBox="0 0 ${s} ${c}">\n <path\n d="${sq(n.map(e=>({x:e.x-a,y:e.y-o})))}"\n stroke="${t.stroke}"\n stroke-width="${t.strokeWidth}"\n stroke-linecap="round"\n stroke-linejoin="round"\n fill="none"\n />\n </svg>\n `.trim()),x:a,y:o,width:s,height:c}}var uq=Na(({store:e,page:t,width:n,height:r,scale:i,xPadding:a,yPadding:o,bleedLeft:s,bleedTop:c})=>{let[l,u]=j.useState(!1),[d,f]=j.useState([]),p=j.useRef(null),m=e.tool===`draw`,{strokeWidth:h,stroke:g,opacity:_,brushType:v}=e.toolOptions,y=j.useCallback(e=>{if(!m||(u(!0),e.cancelBubble=!0,!e.target.getStage()))return;let t=p.current.getRelativePointerPosition();t&&f([{x:t.x,y:t.y}])},[m,i,a,o,s,c]),b=j.useCallback(e=>{if(!m||!l||(e.cancelBubble=!0,!e.target.getStage()))return;let t=p.current.getRelativePointerPosition();t&&f(e=>[...e,{x:t.x,y:t.y}])},[m,l,i,a,o,s,c]),x=j.useCallback(()=>{if(m&&l){if(u(!1),d.length>=1)try{let n=lq(d,{stroke:g,strokeWidth:h,smooth:!0}),r=e.selectedElementsIds.slice();e.history.transaction(()=>{t.addElement({type:`svg`,x:n.x,y:n.y,width:n.width,height:n.height,src:n.src,opacity:_},{skipSelect:!0})}),e.selectElements(r)}catch(e){console.error(`Error creating path SVG:`,e)}f([])}},[m,l,d,g,h,_,t,e.history,e]);j.useEffect(()=>{if(!l)return;let e=()=>x();return window.addEventListener(`mouseup`,e),window.addEventListener(`touchend`,e),()=>{window.removeEventListener(`mouseup`,e),window.removeEventListener(`touchend`,e)}},[l,x]);let S=j.useMemo(()=>d.flatMap(e=>[e.x,e.y]),[d]);return j.useEffect(()=>{if(m&&p.current){let e=p.current.getStage();if(!e)return;let t=h*i;if(t>100||t<4)e.container().style.cursor=`crosshair`;else{let n=t/2,r=t/2,i=`data:image/svg+xml;base64,${btoa(`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 ${t} ${t}">\n <circle cx="${r}" cy="${r}" r="${n-1}" fill="${g}" opacity="${_}" stroke="white" stroke-width="1"/>\n <circle cx="${r}" cy="${r}" r="${n-1}" fill="none" stroke="black" stroke-width="1" opacity="0.3"/>\n </svg>`)}`;e.container().style.cursor=`url("${i}") ${r} ${r}, crosshair`}return()=>{e.container()&&(e.container().style.cursor=``)}}},[m,g,h,_,i]),m?(0,N.jsxs)(Vm,{ref:p,listening:m,x:a+s*i,y:o+c*i,scaleX:i,scaleY:i,children:[(0,N.jsx)(Um,{x:-(a+s*i)/i,y:-(o+c*i)/i,width:n/i,height:r/i,fill:`transparent`,onMouseDown:y,onMouseMove:b,onMouseUp:x,onTouchStart:y,onTouchMove:b,onTouchEnd:x}),d.length>0&&(0,N.jsx)(`Line`,{points:S,stroke:g,strokeWidth:h,lineCap:`round`,lineJoin:`round`,opacity:_,tension:.5,listening:!1})]}):null});function dq(e,t,n=`scale`){let r=t.width/t.height,i,a;r>=e.width/e.height?(i=e.width,a=e.width/r):(i=e.height*r,a=e.height);let o=0,s=0;return n===`left-top`?(o=0,s=0):n===`left-middle`?(o=0,s=(e.height-a)/2):n===`left-bottom`?(o=0,s=e.height-a):n===`center-top`?(o=(e.width-i)/2,s=0):n===`center-middle`?(o=(e.width-i)/2,s=(e.height-a)/2):n===`center-bottom`?(o=(e.width-i)/2,s=e.height-a):n===`right-top`?(o=e.width-i,s=0):n===`right-middle`?(o=e.width-i,s=(e.height-a)/2):n===`right-bottom`?(o=e.width-i,s=e.height-a):n===`scale`?(o=0,s=0,i=e.width,a=e.height):console.error(Error(`Unknown clip position property - `+n)),{cropX:o,cropY:s,cropWidth:i,cropHeight:a}}var fq=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},pq=e=>Qm.batchedUpdates(e,null);_a(e=>{Qm.isAlreadyRendering()?queueMicrotask(()=>pq(e)):pq(e)});var mq=d.DD._drag;window.removeEventListener(`mousemove`,mq),d.DD._drag=function(e){hr(()=>{mq.call(this,e)})},window.addEventListener(`mousemove`,d.DD._drag);var hq={enabledAnchors:[`top-left`,`top-center`,`top-right`,`middle-left`,`bottom-left`,`bottom-right`,`bottom-center`,`middle-right`],rotateEnabled:!0,rotationSnaps:[0,45,90,135,180,225,270,315],ignoreStroke:!0,flipEnabled:!1,keepRatio:!0},gq=e=>{let t=(e%180+180)%180;return t<.1||180-t<.1},_q=e=>{if(!e.length)return null;let t=gq(e[0].rotation)?0:e[0].rotation;return e.every(e=>gq(e.rotation-t))?t:null},vq=e=>e.selectedShapes.filter(e=>!e._cropModeEnabled),yq=(e,t,n)=>{let r=e.width!==t.width,i=e.height!==t.height;if(!r&&!i)return e;let a=Math.cos(t.rotation),o=Math.sin(t.rotation),s=t.x-n.x,c=t.y-n.y,l=r?0:s*a+c*o,u=i?0:-s*o+c*a;return e.x=n.x+l*a-u*o,e.y=n.y+l*o+u*a,e},bq={text:{enabledAnchors:[`top-left`,`top-right`,`middle-left`,`bottom-left`,`bottom-right`,`middle-right`]},svg:{enabledAnchors:[`top-left`,`top-right`,`bottom-left`,`bottom-right`]},gif:{enabledAnchors:[`top-left`,`top-right`,`bottom-left`,`bottom-right`]},line:{enabledAnchors:[],borderEnabled:!1,rotateEnabled:!1},image:{enabledAnchors:[`top-left`,`top-right`,`bottom-left`,`bottom-right`]},many:{enabledAnchors:[`top-left`,`top-right`,`bottom-left`,`bottom-right`]},group:{enabledAnchors:[`top-left`,`top-right`,`bottom-left`,`bottom-right`]},table:{keepRatio:!1,enabledAnchors:[`top-left`,`top-center`,`top-right`,`middle-left`,`middle-right`,`bottom-left`,`bottom-center`,`bottom-right`]}},xq=e=>(0,N.jsx)(Um,Object.assign({},e,{preventDefault:!1})),Sq=e=>{var{url:t}=e,n=fq(e,[`url`]);let[r,i]=(0,eh.default)(t,`anonymous`),a=r?dq(r,{width:n.width,height:n.height},`center-middle`):{};return ZN(i,t,`page background`),(0,N.jsx)(Km,Object.assign({image:r},n,a))},Cq=e=>{let t=jM({a:{width:e.width,height:e.height},width:e.width,height:e.height},e.fill);return(0,N.jsx)(Um,Object.assign({},e,t))},wq=e=>{let{background:t,scale:n,borderColor:r,transparencyBackgroundColor:i}=e,a=fq(e,[`background`,`scale`,`borderColor`,`transparencyBackgroundColor`]),o=j.useMemo(()=>!!d.Util.colorToRGBA(t)||vC(t),[t]),s=j.useMemo(()=>{if(vC(t))return!0;let e=d.Util.colorToRGBA(t);return!e||e.a<1},[t]),c=j.useMemo(()=>{if(!s||i)return null;let e=document.createElement(`canvas`);e.width=60,e.height=60;let t=e.getContext(`2d`);return t&&(t.fillStyle=`black`,t.fillRect(30,0,30,30),t.fillRect(0,30,30,30)),e},[s,i]);return(0,N.jsxs)(j.Fragment,{children:[s&&(0,N.jsx)(`Rect`,i?Object.assign({fill:i},a,{hideInExport:!0}):Object.assign({fillPatternImage:c},a,{opacity:.1,hideInExport:!0})),o?(0,N.jsx)(Cq,Object.assign({fill:t},a)):(0,N.jsx)(Sq,Object.assign({url:t},a))]})},Tq=Na(({selection:e})=>{let{selectionRectStyle:t}=xh();return e.visible?(0,N.jsx)(Um,{name:`selection`,x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),width:Math.abs(e.x1-e.x2),height:Math.abs(e.y1-e.y2),fill:t.fill,stroke:t.stroke,strokeWidth:t.strokeWidth}):null});function Eq(e){let t=180*e/Math.PI;return t%=360,t>180?t-=360:t<-180&&(t+=360),Math.round(t)}var Dq=Na(({x:e,y:t,width:n,height:r,rotation:i,anchor:a,store:o})=>{let{transformLabelStyle:s}=xh();if(e===void 0||t===void 0||n===void 0||r===void 0||i===void 0||a===void 0)return null;let c=hj({x:e,y:t,width:n,height:r,rotation:d.Util.radToDeg(i)}),l=(r/2+70)*Math.cos(i-Math.PI/2),u=(r/2+70)*Math.sin(i-Math.PI/2),f=wS({unit:o.unit,dpi:o.dpi,px:n/o.scale,precious:o.unit===`px`?0:1})+` x `+wS({unit:o.unit,dpi:o.dpi,px:r/o.scale,precious:o.unit===`px`?0:1})+(o.unit===`px`?``:` `+o.unit);return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(Hm,{x:(c.minX+c.maxX)/2+l,y:(c.minY+c.maxY)/2+u,offsetX:14,offsetY:14,visible:a===`rotater`,children:[(0,N.jsx)(`Tag`,{cornerRadius:5,fill:s.fill}),(0,N.jsx)(qm,{align:`center`,verticalAlign:`middle`,fill:s.textFill,padding:8,text:Eq(i).toString()+`°`})]}),(0,N.jsxs)(Hm,{x:(c.minX+c.maxX)/2,y:c.maxY+20,visible:a!==`rotater`,children:[(0,N.jsx)(`Tag`,{cornerRadius:5,fill:s.fill,pointerDirection:`up`,pointerHeight:0,pointerWidth:0}),(0,N.jsx)(qm,{align:`center`,verticalAlign:`middle`,fill:s.textFill,padding:8,text:f})]})]})}),Oq=Na(({elements:e,store:t})=>{let n=e.filter(e=>e.alwaysOnTop),r=e.filter(e=>!e.alwaysOnTop).concat(n);return(0,N.jsx)(j.Fragment,{children:r.map(e=>(0,N.jsx)(aq,{store:t,element:e,onClick:()=>{console.warn(`Polotno warning: onClick callback is deprecated. Just stop using it. Polotno will do selection automatically.`)}},e.id))})}),kq=({store:e})=>{let[t,n]=j.useState(!1),[r,i]=j.useState({x:0,y:0});return{open:j.useCallback(e=>{n(!0),i(e)},[]),close:j.useCallback(()=>{n(!1)},[]),props:{isOpen:t,offset:r,setIsOpen:n}}},Aq=null,jq=atob(`UG9sb3RubyBmcmVlIGxpY2Vuc2UgbGltaXRhdGlvbiBleGNlZWRlZCAtIFBsZWFzZSB1cGdyYWRlIHlvdXIgYWNjb3VudC4=`),Mq=atob(`I2MwMzkyYg==`),Nq=atob(`djAuOS4y`),Pq=e=>(0,N.jsx)(N.Fragment,{children:(0,N.jsxs)(Hm,{fill:Mq,height:200,children:[(0,N.jsx)(`Tag`,{fill:Mq}),(0,N.jsx)(qm,Object.assign({},e,{fill:`white`,text:jq,height:void 0,padding:10,fontSize:20}))]})}),Fq=atob(`RlJFRSAgVFJJQUwgIExJQ0VOU0U=`),Iq=(atob(`UG93ZXJlZCBieSBQb2xvdG5v`),atob(`TElDRU5TRSAgS0VZICBJUyAgTUlTU0lORw==`)),Lq=atob(`UGxlYXNlIGFjdGl2YXRlIHlvdXIgbGljZW5zZS4KTGljZW5zZSByZWxhdGVkIHF1ZXN0aW9uczoKcG9sb3Ruby5jb20vY29udGFjdA==`),Rq=e=>{let t=Gy()===1,n=t?Iq:Fq,r=t?230:195;return(0,N.jsxs)(Vm,Object.assign({},e,{listening:!1,children:[(0,N.jsx)(Um,{fill:Mq,width:r,height:24,cornerRadius:2}),(0,N.jsx)(qm,{text:n,fill:`white`,fontSize:13,fontFamily:`monospace`,width:r,align:`center`,y:5,listening:!1}),t&&(0,N.jsx)(`Text`,{text:Lq,fill:`rgba(0,0,0,0.6)`,fontSize:14,y:30,listening:!1})]}))},zq=Na(({store:e,page:t,width:n,height:r,pageControlsEnabled:i,components:a,altCloneEnabled:o,groupSelectionMode:s=`drill`,viewportSize:c,layout:l=`vertical`,tooltipSafeArea:u,transformerSafeArea:d})=>{let f=xh(),p=f.transformerStyle,m=hq,h=t.computedBleed,g=e.bleedVisible?h:rp,_=t.computedWidth+g.left+g.right,v=t.computedHeight+g.top+g.bottom,y=(n-_*e.scale)/2,b=(r-v*e.scale)/2,x=j.useRef(null),S=j.useRef(null),C=j.useRef(null),w=j.useRef(null),T=i==null||i,E=j.useRef(!1),[D,O]=j.useState(null),[k,A]=j.useState({}),[ee,M]=j.useState(0),P=kq({store:e}),F=e.selectedElements.find(e=>e._cropModeEnabled),I=e.selectedElements.find(e=>e.curveEnabled),te=e.selectedShapes.filter(e=>!e.resizable).length>0,ne=e.selectedShapes.filter(e=>!e.draggable).length>0,L=e.selectedElements.filter(e=>!e.visible).length>0,R=vq(e),re=e.selectedElements.length!==1||e.selectedElements[0]?.type===`group`,ie=_q(R)??0,ae=e=>re&&R.length>0&&R.every(t=>((e,t,n)=>{if(!gq(e.rotation-n))return!1;switch(e.type){case`text`:return t===`x`&&!KM(e);case`figure`:case`video`:case`table`:return!0;case`image`:case`svg`:case`gif`:return!e.keepRatio;default:return!1}})(t,e,ie)),oe=!re&&e.selectedElements[0].keepRatio,se=ae(`x`),ce=ae(`y`),le=()=>{var t;let n=x.current;if(!n)return[];let r=n.getStage();if(!r)return[];let i=vq(e),a=i.map(e=>r.findOne(`#`+e.id)).filter(e=>!!e),o=e.selectedElements.length===1,s=o&&e.selectedElements[0]?.type||`many`,c=bq[s],l=Object.assign(Object.assign({},m),c||{});c&&(s!==`svg`&&s!==`image`&&s!==`gif`||e.selectedElements[0].keepRatio||(l.enabledAnchors=m.enabledAnchors),s===`text`&&Ay.textVerticalResizeEnabled&&(l.enabledAnchors=bq.text.enabledAnchors?.concat([`bottom-center`,`top-center`])),s===`text`&&o&&e.selectedElements[0].curveEnabled&&(l.enabledAnchors=bq.many.enabledAnchors)),(se||ce)&&(l.enabledAnchors=[...l.enabledAnchors||[],...se?[`middle-left`,`middle-right`]:[],...ce?[`top-center`,`bottom-center`]:[]]),n.setAttrs(Object.assign(Object.assign({},l),p)),te&&n.enabledAnchors([]),ne&&n.rotateEnabled(!1);let u=n.nodes();if(u.length===a.length&&a.every((e,t)=>u[t]===e)||n.nodes(a),re&&a.length){let e=_q(i);e===null||gq(n.rotation()-e)||(n.rotation(e),n.forceUpdate())}return(t=n.getLayer())==null||t.batchDraw(),a};j.useLayoutEffect(()=>{if(x.current?.isTransforming())return;let e=le();e.find(e=>e?.isDragging())&&(e.forEach(e=>{e.isDragging()||e==null||e.startDrag()}),sK())},[e.selectedShapes,F,te,L,ne,I,se,ce,oe,ie,p]);let ue=()=>{let e=x.current;if(!e)return;if(!e.isTransforming()){A({});return}if(!e.nodes().length||!e.isTransforming())return;let t=e.__getNodeRect(),n=e?.getActiveAnchor(),r=e.getStage();A({anchor:n,x:t.x-(r?.x()??0),y:t.y-(r?.y()??0),rotation:t.rotation,width:t.width,height:t.height})},de=j.useCallback(()=>{if(x.current?.isTransforming())return;let e=x.current;if(!e||!e.nodes().length){M(0);return}let t=e.getClientRect();if(!e.getStage())return;let i=function(e,t,n,r=0){let i=e.x+e.width/2,a=e.y+e.height/2,o=e.width/2,s=e.height/2,c=r*Math.PI/180,l=e=>{let t=e*Math.PI/180,r=(e%360+360)%360,l;l=r===0||r===180?s:o;let u=Math.sin(t)*(l+n),d=-Math.cos(t)*(l+n),f=u*Math.cos(c)-d*Math.sin(c),p=u*Math.sin(c)+d*Math.cos(c);return{x:i+f,y:a+p}},u=e=>e.x>=t.left&&e.x<=t.right&&e.y>=t.top&&e.y<=t.bottom;if(u(l(0)))return 0;for(let e of[180,270,90])if(u(l(e)))return e;return 0}(t,{top:d?.top||0,bottom:r-(d?.bottom||0),left:d?.left||0,right:n-(d?.right||0)},p.rotateAnchorOffset,e.rotation());M(i)},[d,n,r]);j.useEffect(()=>{var e;(e=x.current)==null||e.update(),ue(),de()},[e.scale,de]),j.useEffect(()=>{de()},[e.selectedShapes,de]);let fe=Ia(()=>({visible:!1,x1:0,y1:0,x2:0,y2:0})),pe=j.useRef(!1),me=pr(t=>{if(e.role===xM.VIEWER)return;pe.current=!1;let n=t.target.findAncestor(`.elements-container`),r=t.target.findAncestor(`Transformer`),i=t.target.findAncestor(`.page-abs-container`);if(n||r||i)return;let a=t.target.getStage()?.getPointerPosition();a&&(a.x-=t.target.getStage()?.x()??0,a.y-=t.target.getStage()?.y()??0,fe.visible=!0,fe.x1=a.x,fe.y1=a.y,fe.x2=a.x,fe.y2=a.y,(t.target.getStage()?.getPointersPositions().length??0)>=2&&(fe.visible=!1))});(({stageRef:e,containerRef:t,viewportSize:n})=>{j.useEffect(()=>{let n=t.current?.closest(`.polotno-workspace-inner`);function r(){if(!e.current)return;let r=t.current?.getBoundingClientRect(),i=n?.getBoundingClientRect();if(!r||!i)return;let a=Math.max(0,i.left-r.left-100),o=Math.max(0,i.top-r.top-100);e.current.position({x:-a,y:-o}),e.current.container().style.transform=`translate(${a}px, ${o}px)`}return r(),n?.addEventListener(`scroll`,r),()=>{n?.removeEventListener(`scroll`,r)}},[n.width,n.height])})({stageRef:C,containerRef:w,viewportSize:c}),j.useEffect(()=>{let t=pr(e=>{var t;if(!fe.visible)return;(t=C.current)==null||t.setPointersPositions(e);let n=C.current?.getPointerPosition();n?(n.x-=C.current?.x()??0,n.y-=C.current?.y()??0):n={x:fe.x2,y:fe.y2},fe.x2=n.x,fe.y2=n.y}),n=pr(()=>{if(!fe.visible||!C.current)return;let t=C.current.findOne(`.selection`),n=t?t.getClientRect({skipStroke:!0}):{width:0,height:0,x:0,y:0};if(n.width&&n.height){let t=[{x:n.x,y:n.y},{x:n.x+n.width,y:n.y},{x:n.x+n.width,y:n.y+n.height},{x:n.x,y:n.y+n.height}],r=[];C.current.find(`.element`).forEach(n=>{let i=e.getElementById(n.id()),a=i?.draggable,o=i?.selectable;if(!a||!o)return;let s=n.getParent()?.getAbsoluteTransform();if(!s)return;let c=gj(i.a).map(e=>s.point(e));_j(t,c)&&r.push(i.top.id)});let i=[...new Set(r)];pe.current=!0,e.selectElements(i)}fe.visible=!1});return window.addEventListener(`mousemove`,t),window.addEventListener(`touchmove`,t),window.addEventListener(`mouseup`,n,{capture:!0}),window.addEventListener(`touchend`,n,{capture:!0}),()=>{window.removeEventListener(`mousemove`,t),window.removeEventListener(`touchmove`,t),window.removeEventListener(`mouseup`,n),window.removeEventListener(`touchend`,n)}},[]);let he=j.useCallback(n=>{if(!e.selectedElements[0]||n&&e.selectedElementsIds.includes(n))return;let r=vj(e.selectedShapes),i=hj(n?e.getElementById(n):{x:0,y:0,width:t.computedWidth,height:t.computedHeight,rotation:0}),a=[];r.minX>i.maxX&&a.push({distance:r.minX-i.maxX,box1:r,box2:i,points:[{x:r.minX,y:r.minY+r.height/2},{x:i.maxX,y:r.minY+r.height/2},{x:i.maxX,y:i.minY+i.height/2}]}),r.maxX<i.minX&&a.push({distance:i.minX-r.maxX,box1:r,box2:i,points:[{x:r.maxX,y:r.minY+r.height/2},{x:i.minX,y:r.minY+r.height/2},{x:i.minX,y:i.minY+i.height/2}]}),r.minY>i.maxY&&a.push({box1:r,box2:i,distance:r.minY-i.maxY,points:[{x:r.minX+r.width/2,y:r.minY},{x:r.minX+r.width/2,y:i.maxY},{x:i.minX+i.width/2,y:i.maxY}]}),r.maxY<i.minY&&a.push({box1:r,box2:i,distance:i.minY-r.maxY,points:[{x:r.minX+r.width/2,y:r.maxY},{x:r.minX+r.width/2,y:i.minY},{x:i.minX+i.width/2,y:i.minY}]});let o=r.minX>=i.minX&&r.maxX<=i.maxX&&r.minY>=i.minY&&r.maxY<=i.maxY;if(o&&(a.push({distance:r.minX-i.minX,box1:r,box2:i,points:[{x:r.minX,y:r.minY+r.height/2},{x:i.minX,y:r.minY+r.height/2},{x:i.minX,y:i.minY+i.height/2}]}),a.push({distance:i.maxX-r.maxX,box1:r,box2:i,points:[{x:r.maxX,y:r.minY+r.height/2},{x:i.maxX,y:r.minY+r.height/2},{x:i.maxX,y:i.minY+i.height/2}]}),a.push({box1:r,box2:i,distance:r.minY-i.minY,points:[{x:r.minX+r.width/2,y:r.minY},{x:r.minX+r.width/2,y:i.minY},{x:i.minX+i.width/2,y:i.minY}]}),a.push({box1:r,box2:i,distance:i.maxY-r.maxY,points:[{x:r.minX+r.width/2,y:r.maxY},{x:r.minX+r.width/2,y:i.maxY},{x:i.minX+i.width/2,y:i.maxY}]})),a.length===0&&!o){let e=r.minX<i.maxX&&r.maxX>i.minX,t=r.minY<i.maxY&&r.maxY>i.minY;if(e&&t){let e=(Math.max(r.minY,i.minY)+Math.min(r.maxY,i.maxY))/2,t=(Math.max(r.minX,i.minX)+Math.min(r.maxX,i.maxX))/2;r.minX<i.minX?a.push({distance:i.minX-r.minX,box1:r,box2:i,points:[{x:r.minX,y:e},{x:i.minX,y:e},{x:i.minX,y:e}]}):a.push({distance:r.minX-i.minX,box1:r,box2:i,points:[{x:r.minX,y:e},{x:i.minX,y:e},{x:i.minX,y:e}]}),r.maxX>i.maxX?a.push({distance:r.maxX-i.maxX,box1:r,box2:i,points:[{x:i.maxX,y:e},{x:r.maxX,y:e},{x:i.maxX,y:e}]}):a.push({distance:i.maxX-r.maxX,box1:r,box2:i,points:[{x:r.maxX,y:e},{x:i.maxX,y:e},{x:i.maxX,y:e}]}),r.minY<i.minY?a.push({box1:r,box2:i,distance:i.minY-r.minY,points:[{x:t,y:r.minY},{x:t,y:i.minY},{x:t,y:i.minY}]}):a.push({box1:r,box2:i,distance:r.minY-i.minY,points:[{x:t,y:r.minY},{x:t,y:i.minY},{x:t,y:i.minY}]}),r.maxY>i.maxY?a.push({box1:r,box2:i,distance:r.maxY-i.maxY,points:[{x:t,y:i.maxY},{x:t,y:r.maxY},{x:t,y:i.maxY}]}):a.push({box1:r,box2:i,distance:i.maxY-r.maxY,points:[{x:t,y:r.maxY},{x:t,y:i.maxY},{x:t,y:i.maxY}]})}}JSON.stringify(D)!==JSON.stringify(a)&&O(a)},[e,t]);j.useEffect(()=>{e.selectedElements[0]&&e.distanceGuidesVisible?he():D&&O(null)},[e.distanceGuidesVisible,he,e.selectedShapes.map(e=>`${e.x},${e.y},${e.width},${e.height},${e.rotation}`).join(`|`)]);let ge=j.useRef(!1);j.useEffect(()=>{let e,t=w.current?.closest(`.polotno-workspace-inner`),n=()=>{ge.current=!0,clearTimeout(e),e=setTimeout(()=>{ge.current=!1},300)};return t?.addEventListener(`scroll`,n),()=>{clearTimeout(e),t?.removeEventListener(`scroll`,n)}},[]),j.useEffect(()=>{let t=C.current;if(!t)return;let n=t.container(),r=new Map,i=e=>{r.set(e.target,{x:e.target.x(),y:e.target.y()})},a=e=>{r.delete(e.target)};t.on(`dragstart`,i),t.on(`dragend`,a);let o=t=>{var n,i;t.touches.length>=2&&((n=x.current)!=null&&n.isDragging()&&x.current.stopDrag(),(i=x.current)==null||i.nodes().forEach(t=>{var n;let i=r.get(t);t.isDragging()&&t.stopDrag(),i&&(t.setAttrs(i),(n=e.getElementById(t.id()))==null||n.set({x:i.x,y:i.y}))}))};return n.addEventListener(`touchstart`,o,{passive:!0}),n.addEventListener(`touchmove`,o,{passive:!0}),()=>{t.off(`dragstart`,i),t.off(`dragend`,a),n.removeEventListener(`touchstart`,o),n.removeEventListener(`touchmove`,o)}},[e]);let _e=n=>{if(e.role===xM.VIEWER||(e.activePage!==t&&t.select(),ge.current)||pe.current)return;let r=n.evt.shiftKey,i=n.evt.ctrlKey||n.evt.metaKey,a=r||i,o=n.target.findAncestor(`.elements-container`),c=n.target.findAncestor(`.page-abs-container`),l=n.target.findAncestor(`Transformer`),u=n.target.findAncestor(`.page-container`,!0);if(!(a||o||l||c||u||fe.visible)){e.selectElements([]),e.selectPages([]);return}if(i&&!r){let t=C.current,n=t?.getPointerPosition();if(!t||!n)return;let r=t.getAllIntersections(n),i=new Set,a=[];for(let t of[...r].reverse()){let n=t.findAncestor(`.element`,!0);if(!n)continue;let r=e.getElementById(n.id())?.top;r&&(i.has(r.id)||(i.add(r.id),a.push(r.id)))}if(a.length===0)return;let o;if(e.selectedElementsIds.length===1){let t=e.selectedElementsIds[0],n=a.indexOf(t);o=n===-1?a[0]:a[(n+1)%a.length]}else o=a[0];e.selectElements([o]),e.selectPages([]);return}let d=n.target.findAncestor(`.element-container`,!0)?.findOne(`.element`)||n.target.findAncestor(`.element`,!0),f=e.getElementById(d?.id()),p=f?.top,m;m=s===`group`?p?.id:p?e.selectedElements.some(e=>e.top?.id===p.id)?f?.id:p?.id:void 0;let h=f?.id;if(h&&e.selectedElementsIds.indexOf(h)>=0&&!r)return;let g=!!m&&e.selectedElementsIds.indexOf(m)>=0,_=n.target.findAncestor(`.page-container`,!0);if(m&&r&&!g){let t=e.selectedElementsIds.concat([m]),n=new Set(t),r=t.filter(t=>{let r=e.getElementById(t);if(!r)return!1;for(let e=r.parent;e;e=e?.parent)if(n.has(e.id))return!1;return!0});e.selectElements(r),e.selectPages([])}else m&&r&&g?e.selectElements(e.selectedElementsIds.filter(e=>e!==m)):!m||r||g?m&&!r&&g||(_?(r||e.selectElements([]),e.selectPages([t.id])):e.selectPages([])):(e.selectElements([m]),e.selectPages([]))};uK(x,e);let ve=e.activePage===t,ye=e._selectedPagesIds.includes(t.id),be=a?.PageControls,xe=a?.Tooltip,Se=a?.ContextMenu,Ce=1/e.scale,we=0/e.scale;return(0,N.jsxs)(`div`,{ref:w,onDragOver:e=>e.preventDefault(),onDrop:n=>{if(n.preventDefault(),e.role===xM.VIEWER||!C.current)return;C.current.setPointersPositions(n);let r=C.current.findOne(`.elements-container`)?.getRelativePointerPosition(),i=C.current.getPointerPosition(),a=C.current.getAllIntersections(i).map(e=>e.findAncestor(`.element`,!0)).filter(Boolean),o=[...new Set(a.reverse())].map(t=>e.getElementById(t.id())).filter(e=>!!e),s=o[0];Aq&&r&&(Aq(r,s,{elements:o,page:t}),Aq=null)},style:{position:`relative`,width:n+`px`,height:r+`px`,overflow:`hidden`,flexShrink:0},className:`polotno-page-container`+(ve?` active-page`:``),children:[(0,N.jsx)($m,{ref:C,width:Math.min(n,c.width+200),height:Math.min(c.height+200,r),onClick:_e,onTap:_e,onContextMenu:t=>{if(t.evt.preventDefault(),e.role===xM.VIEWER)return;let n=t.target.findAncestor(`.element`,!0),r=e.getElementById(n?.id())?.top?.id;if(!r){e.selectElements([]),P.close();return}e.selectedElementsIds.indexOf(r)>=0||e.selectElements([r]),P.open({x:t.evt.clientX,y:t.evt.clientY})},onMouseDown:me,onMouseMove:t=>{if(!e.distanceGuidesVisible&&!t.evt.altKey){D&&O(null);return}let n=t.target.findAncestor(`.element`,!0)?.id();he(n)},onDragStart:t=>{var n;let r=t.target.getStage();if(r&&r.getPointersPositions().length>=2){t.target.stopDrag();return}let i=t.target.findAncestor(`.element`,!0);if(i){let r=e.getElementById(i?.id()),a=r?.top?.id;if(!(r&&e.selectedElementsIds.indexOf(r.id)>=0||a&&e.selectedElementsIds.indexOf(a)>=0)&&a){e.selectElements([a]);let r=le();t.target.stopDrag(),r.forEach(e=>{e.isDragging()||e.startDrag(t)}),(n=x.current)==null||n.startDrag(t),sK()}}D&&O(null)},pageId:t.id,style:{position:`absolute`,overflow:`hidden`,top:0,left:0},children:(0,N.jsxs)(Bm,{children:[(0,N.jsx)(xq,{width:n,height:r,fill:f.workspaceBackgroundColor}),(0,N.jsx)(Vm,{x:y,y:b,scaleX:e.scale,scaleY:e.scale,name:`page-container`,children:(0,N.jsxs)(Vm,{name:`page-container-2`,children:[(0,N.jsx)(Vm,{name:`page-background-group`,x:g.left,y:g.top,children:(0,N.jsx)(wq,{x:-h.left,y:-h.top,width:t.computedWidth+h.left+h.right,height:t.computedHeight+h.top+h.bottom,background:t.background,transparencyBackgroundColor:f.transparencyBackgroundColor,name:`page-background`,preventDefault:!1,scale:e.scale})}),(0,N.jsxs)(Vm,{x:g.left,y:g.top,name:`elements-container`,listening:!e.isPlaying&&e.role!==xM.VIEWER,children:[(0,N.jsx)(Um,{name:`elements-area`,width:t.computedWidth,height:t.computedHeight,listening:!1}),(0,N.jsx)(Oq,{elements:t.children,store:e})]}),(0,N.jsx)(Xm,{name:`bleed`,fill:f.bleedColor,listening:!1,visible:e.bleedVisible&&(g.top>0||g.right>0||g.bottom>0||g.left>0),hideInExport:!0,sceneFunc:(e,n)=>{let{top:r,right:i,bottom:a,left:o}=h,s=t.computedWidth,c=t.computedHeight,l=e._context;l.beginPath(),l.rect(0,0,o+s+i,r+c+a),l.rect(o,r,s,c),l.fillStyle=n.fill(),l.fill(`evenodd`)}}),Uy()===Nq&&(0,N.jsx)(Pq,{name:`hit-detection`,x:-Ce/2-we,y:-Ce/2-we,width:_+Ce+2*we,height:v+Ce+2*we})]})}),(0,N.jsx)(Gm,{name:`workspace-background`,points:[0,0,n,0,n,r,0,r,0,0,y,b,y,r-b,n-y,r-b,n-y,b,y,b],listening:!1,closed:!0,fill:f.workspaceBackgroundColor}),(0,N.jsx)(Vm,{x:y,y:b,scaleX:e.scale,scaleY:e.scale,children:(0,N.jsx)(Um,{name:`page-highlight`,hideInExport:!0,x:-Ce/2-we,y:-Ce/2-we,width:_+Ce+2*we,height:v+Ce+2*we,stroke:ye?f.activePageBorderColor:f.pageBorderColor,strokeWidth:2,listening:!1,strokeScaleEnabled:!1})}),(0,N.jsxs)(Vm,{x:y+g.left*e.scale,y:b+g.top*e.scale,scaleX:e.scale,scaleY:e.scale,name:`page-abs-container`,children:[(0,N.jsx)(Zm,{ref:x,rotateAnchorAngle:ee,onDragStart:n=>{var r;let i=n.target.getStage();i&&i.getPointersPositions().length>=2?n.target.stopDrag():((r=n.evt)!=null&&r.altKey&&o&&e.selectedElements.forEach(e=>{let n=e.clone({},{skipSelect:!0}),r=t.children.indexOf(e);t.setElementZIndex(n.id,r)}),E.current||(E.current=!0,e.history.startTransaction()))},onDragEnd:()=>{E.current&&=(e.history.endTransaction(),!1),de()},onTransformStart:()=>{e.history.startTransaction(),S.current=new Map(R.map(e=>[e.id,{width:e.width,height:e.height}])),O(null)},boundBoxFunc:(t,n)=>{let r=Math.abs(n.width)<1||Math.abs(n.height)<1,i=Math.abs(t.width)<1||Math.abs(t.height)<1;if(r&&!i)return t;let a=e.selectedElements;if(a.length===1&&a[0]?.type===`table`){let e=a[0],r=Math.abs(t.width),i=Math.abs(t.height);if(r>0&&i>0){let a=Math.abs(n.width)/r,o=Math.abs(n.height)/i,s=e.width*a,c=e.height*o,l=Object.assign({},n);return s<e.minWidth&&(l.width=t.width),c<e.minHeight&&(l.height=t.height),yq(l,n,t)}}return re&&R.length>0?((e,t,n,r,i)=>{let a=Math.abs(e.width),o=Math.abs(e.height);if(a===0||o===0)return t;let s=Math.abs(t.width)/a,c=Math.abs(t.height)/o,l=!WM(n),u=e=>r.some(t=>{let n=i?.get(t.id),r=(e===`x`?n?.width:n?.height)??(e===`x`?t.width:t.height),a=e===`x`?t.width:t.height,o=e===`x`?s:c,u=((e,t,n,r)=>{if(e.type===`table`){let n=e;return t===`x`?n.minWidth:n.minHeight}return e.type===`text`&&t===`x`&&n?GM(r,e.fontSize):1})(t,e,l,r);return r>=u&&a*o<u}),d=Object.assign({},t),f=t.width*e.width<0,p=t.height*e.height<0,m=f||u(`x`),h=p||u(`y`),g=h||!l&&m;return(m||!l&&h)&&(d.width=e.width),g&&(d.height=e.height),yq(d,t,e)})(t,n,x.current?.getActiveAnchor()||``,R,S.current):n},onTransform:e=>{let t=x.current.nodes(),n=t[t.length-1];e.target===n&&setTimeout(()=>{ue()},0)},onTransformEnd:t=>{A({}),e.history.endTransaction(),S.current=null,de(),le()},visible:!e.isPlaying}),D&&D.map(({points:t,distance:n,box1:r,box2:i},a)=>(0,N.jsxs)(`Group`,{name:`distances-container`,hideInExport:!0,listening:!1,children:[(0,N.jsx)(`Rect`,Object.assign({},r,{stroke:f.distanceGuideStyle.stroke,strokeWidth:1,strokeScaleEnabled:!1})),(0,N.jsx)(`Rect`,Object.assign({},i,{stroke:f.distanceGuideStyle.stroke,strokeWidth:1,strokeScaleEnabled:!1})),(0,N.jsx)(`Line`,{points:[t[0].x,t[0].y,t[1].x,t[1].y],stroke:f.distanceGuideStyle.stroke,strokeWidth:1,strokeScaleEnabled:!1}),(0,N.jsx)(`Line`,{points:[t[1].x,t[1].y,t[2].x,t[2].y],stroke:f.distanceGuideStyle.stroke,strokeWidth:1,strokeScaleEnabled:!1}),(0,N.jsxs)(`Label`,{x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2,offsetY:-10,scaleX:1/e.scale,scaleY:1/e.scale,children:[(0,N.jsx)(`Tag`,{cornerRadius:5,fill:f.distanceGuideStyle.labelFill,pointerDirection:`down`}),(0,N.jsx)(`Text`,{align:`center`,verticalAlign:`middle`,fill:f.distanceGuideStyle.labelTextFill,padding:5,text:ES({unit:e.unit,dpi:e.dpi,px:n})})]})]},a)),t._rendering&&(0,N.jsxs)(`Group`,{children:[(0,N.jsx)(`Rect`,{width:_,height:v,fill:`rgba(255,255,255,0.9)`}),(0,N.jsx)(`Text`,{text:`Rendering...`,fontSize:60,width:_,height:v,align:`center`,verticalAlign:`middle`})]}),xe&&(0,N.jsx)(xe,{components:a,store:e,page:t,stageRef:C,tooltipSafeArea:u}),Se&&(0,N.jsx)(DM,{children:(0,N.jsx)(Se,Object.assign({components:a,store:e},P.props))})]}),(0,N.jsx)(uq,{store:e,page:t,width:n,height:r,scale:e.scale,xPadding:y,yPadding:b,bleedLeft:g.left,bleedTop:g.top}),(0,N.jsx)(Dq,Object.assign({},k,{store:e})),(0,N.jsx)(Tq,{selection:fe}),Gy()>0&&(0,N.jsxs)(`Group`,{hideInExport:!0,children:[(0,N.jsx)(Rq,{name:`cache-bounds`,x:n-(Gy()===1?250:210),y:r-(Gy()===1?95:45)}),(0,N.jsx)(Rq,{name:`cache-bounds-t`,x:10,y:10})]}),Ky()&&(0,N.jsx)(`Text`,{text:`Powered by polotno.com`,fontSize:14,fill:`rgba(0,0,0,0.6)`,x:n-170,y:r-18,onMouseEnter:e=>{e.target.getStage().container().style.cursor=`pointer`},onMouseLeave:e=>{e.target.getStage().container().style.cursor=``},onTouchStart:e=>{e.cancelBubble=!0},onMouseDown:e=>{e.cancelBubble=!0},onClick:()=>{window.open(`https://polotno.com`,`_blank`,`noopener`)},onTap:()=>{window.open(`https://polotno.com`,`_blank`,`noopener`)}}),(0,N.jsx)(Vm,{name:`line-guides`})]})}),T&&be&&(0,N.jsx)(be,{store:e,page:t,xPadding:y,yPadding:b,layout:l})]})}),Bq=OG(`div`,j.forwardRef)`
603
+ position: absolute;
604
+ top: 0;
605
+ left: 0;
606
+ pointer-events: none;
607
+ `,Vq=OG(`div`,j.forwardRef)`
608
+ height: 14px;
609
+ position: sticky;
610
+ font-size: 8px;
611
+ line-height: 14px;
612
+ top: 0;
613
+ left: 0;
614
+ color: grey;
615
+ border-bottom: 1px solid grey;
616
+ background-color: #e8e8e8;
617
+ overflow: hidden;
618
+ box-sizing: border-box;
619
+ `,Hq=OG(`div`,j.forwardRef)`
620
+ left: 0;
621
+ width: 14px;
622
+ position: sticky;
623
+ font-size: 8px;
624
+ line-height: 14px;
625
+ color: grey;
626
+ border-right: 1px solid grey;
627
+ background-color: #e8e8e8;
628
+ overflow: hidden;
629
+ box-sizing: border-box;
630
+ `,Uq=OG(`div`,j.forwardRef)`
631
+ position: absolute;
632
+ border-left: 1px solid grey;
633
+ padding-left: 2px;
634
+ `,Wq=OG(`div`,j.forwardRef)`
635
+ position: absolute;
636
+ left: 14px;
637
+ border-left: 1px solid grey;
638
+ padding-left: 2px;
639
+ transform: rotate(90deg);
640
+ transform-origin: left top;
641
+ overflow: hidden;
642
+ `,Gq=[.1,.2,.5,1,2,5,10,20,25,50,100,200,500,1e3,2e3,5e3,1e4],Kq=Na(({store:e,width:t,height:n,pageSizes:r,layout:i=`vertical`,renderOnlyActivePage:a})=>{let{rulerStyle:o}=xh(),s=j.useRef(null);if(!e.activePage)return null;let c=i===`horizontal`,l=e.activePage,u=l.computedWidth*e.scale,d=l.computedHeight*e.scale,f=(t-u)/2,p=(n-d)/2,m=(h=t=>TS({unitVal:t,dpi:e.dpi,unit:e.unit})*e.scale,Gq.find(e=>h(e)>30)||1e4);var h;let g=TS({unitVal:m,dpi:e.dpi,unit:e.unit})*e.scale,_=Math.round(u/g)+1,v=Math.round(d/g)+1,y=vj(e.selectedShapes),{backgroundColor:b,textColor:x,borderColor:S,borderSize:C,tickColor:w,tickSize:T}=o;return(0,N.jsx)(Bq,{ref:s,className:`polotno-rulers`,style:{display:`flex`,flexDirection:`column`},children:(0,N.jsxs)(N.Fragment,c?{children:[(0,N.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,position:`sticky`,top:0,zIndex:1},children:[(0,N.jsx)(`div`,{className:`polotno-ruler-corner`,style:{width:`14px`,height:`14px`,flexShrink:0,marginRight:`-14px`,boxSizing:`border-box`,backgroundColor:b,borderRight:`${C}px solid ${S}`,borderBottom:`${C}px solid ${S}`,position:`sticky`,left:0,zIndex:2}}),(a?[e.activePage]:e.pages).map((n,i)=>{if(!n)return null;let a=r?r[i]:t,o=(a-n.computedWidth*e.scale)/2;return(0,N.jsxs)(Vq,{style:{width:a+`px`,flexShrink:0,position:`relative`,backgroundColor:b,color:x,borderBottom:`${C}px solid ${S}`},className:`polotno-x-ruler`,children:[[...Array(_)].map((t,n)=>(0,N.jsx)(Uq,{className:`polotno-ruler-tick`,style:{left:o+n*g+`px`,width:g+`px`,borderLeft:`${T}px solid ${w}`},children:e.unit===`px`||m>=1?Math.round(m*n):(m*n).toFixed(1)},n)),e.selectedShapes[0]?.page===n&&(0,N.jsx)(`div`,{className:`polotno-ruler-selection`,style:{position:`absolute`,left:o+y.x*e.scale+`px`,height:`14px`,width:y.width*e.scale,backgroundColor:`rgba(0,0,0,0.15)`}})]},n.id)})]}),(0,N.jsxs)(Hq,{style:{height:n+`px`,position:`sticky`,left:0,marginTop:`-14px`,backgroundColor:b,color:x,borderRight:`${C}px solid ${S}`},className:`polotno-y-ruler`,children:[[...Array(v)].map((t,n)=>(0,N.jsx)(Wq,{className:`polotno-ruler-tick`,style:{top:p+n*g+`px`,width:g+`px`,borderLeft:`${T}px solid ${w}`},children:e.unit===`px`||m>=1?Math.round(m*n):(m*n).toFixed(1)},n)),!!e.selectedShapes.length&&(0,N.jsx)(`div`,{className:`polotno-ruler-selection`,style:{position:`absolute`,top:p+y.y*e.scale+`px`,width:`14px`,height:y.height*e.scale,backgroundColor:`rgba(0,0,0,0.15)`}})]})]}:{children:[(0,N.jsxs)(Vq,{style:{width:t+`px`,backgroundColor:b,color:x,borderBottom:`${C}px solid ${S}`},className:`polotno-x-ruler`,children:[[...Array(_)].map((t,n)=>(0,N.jsx)(Uq,{className:`polotno-ruler-tick`,style:{left:f+n*g+`px`,width:g+`px`,borderLeft:`${T}px solid ${w}`},children:e.unit===`px`||m>=1?Math.round(m*n):(m*n).toFixed(1)},n)),!!e.selectedShapes.length&&(0,N.jsx)(`div`,{className:`polotno-ruler-selection`,style:{position:`absolute`,left:f+y.x*e.scale+`px`,height:`14px`,width:y.width*e.scale,backgroundColor:`rgba(0,0,0,0.15)`}})]}),(a?[e.activePage]:e.pages).map((t,i)=>{if(!t)return null;let a=r?r[i]:n,o=(a-t.computedHeight*e.scale)/2,s=i===0?14:0;return(0,N.jsxs)(Hq,{style:{height:a-s+`px`,backgroundColor:b,color:x,borderRight:`${C}px solid ${S}`},className:`polotno-y-ruler`,children:[[...Array(v)].map((t,n)=>(0,N.jsx)(Wq,{className:`polotno-ruler-tick`,style:{top:o+n*g-s+`px`,width:g+`px`,borderLeft:`${T}px solid ${w}`},children:e.unit===`px`||m>=1?Math.round(m*n):(m*n).toFixed(1)},n)),e.selectedShapes[0]?.page===t&&(0,N.jsx)(`div`,{className:`polotno-ruler-selection`,style:{position:`absolute`,top:o+y.y*e.scale-s+`px`,width:`14px`,height:y.height*e.scale,backgroundColor:`rgba(0,0,0,0.15)`}})]},t.id)})]})})}),qq=Na(({audio:e,store:t})=>{let[n,r]=function(e){let[t,n]=j.useState(null),[r,i]=j.useState(`loading`);return j.useEffect(()=>{let t=new Audio(e),r=()=>{i(`loaded`),n(t)},a=()=>{i(`failed`),n(null)};return t.addEventListener(`canplay`,r),t.addEventListener(`error`,a),()=>{t.removeEventListener(`canplay`,r),t.removeEventListener(`error`,a)}},[e]),[t,r]}(e.src),i=j.useMemo(xK,[n]);return j.useEffect(()=>{n&&t.history.ignore(()=>{e.set({duration:1e3*n.duration})})},[n,e,t.history]),j.useEffect(()=>{if(!n)return;let r=()=>{n.currentTime=e.startTime*e.duration/1e3},a=()=>{let t=e.endTime*e.duration/1e3;n.currentTime>=t&&(n.pause(),n.currentTime=e.startTime*e.duration/1e3)};n.addEventListener(`ended`,r),n.addEventListener(`timeupdate`,a);let o=kM(e,()=>{let r=t.animatedElementsIds;if(r.length&&!r.includes(e.id))return;let a=t.currentTime-e.delay,o=e.speed,s=e.duration*(e.endTime-e.startTime),c=a>=0&&a<e.visibleDuration;if(!t.isPlaying||t.animatedElementsIds.length!==0||!c){i.reset(),n.pause();return}n.volume=e.volume,n.playbackRate=o,n.preservesPitch=!1,n.paused&&i.play(n);let l=a*o%s/1e3+e.startTime*e.duration/1e3,u=n.currentTime;Math.abs(u-l)>.5&&l!==u&&(n.currentTime=l)});return()=>{n.pause(),n.removeEventListener(`ended`,r),n.removeEventListener(`timeupdate`,a),o()}},[t.isPlaying,e.startTime,e.endTime,e.volume,e.speed,n]),null});async function Jq(e){return new Promise((t,n)=>{let r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)})}var Yq={svg:`svg`,gif:`gif`,png:`image`,jpg:`image`,jpeg:`image`,webp:`image`,avif:`image`,bmp:`image`,heic:`image`,mp4:`video`,webm:`video`,mov:`video`,m4v:`video`,mp3:`audio`,wav:`audio`,ogg:`audio`,m4a:`audio`};function Xq(e){let{type:t}=e;return t.indexOf(`svg`)>=0?`svg`:t.indexOf(`gif`)>=0?`gif`:t.indexOf(`image`)>=0?`image`:t.indexOf(`video`)>=0?`video`:t.indexOf(`audio`)>=0?`audio`:Yq[e.name.split(`.`).pop()?.toLowerCase()??``]??null}function Zq(e){return e.replace(/\.[^./\\]+$/,``)}var Qq=async e=>(console.warn(`Polotno: using data URL for file embeding. This is not recommended for production. Set upload function https://polotno.com/docs/editor-configuration#how-to-change-image-upload-behavior`),Jq(e));function $q(){return Qq}var eJ=async({src:e,droppedPos:t,targetElement:n,store:r})=>{var i;if(n&&n.type===`svg`&&n.contentEditable){let t=n.parent,i=n.zIndex,a=Object.assign({},n.toJSON());delete a.id,r.deleteElements([n.id]),t.addElement(Object.assign(Object.assign({},a),{type:`image`,src:e,clipSrc:a.src})).setZIndex(i);return}n&&n.type===`figure`&&n.contentEditable;let{width:a,height:o}=await ww(e);if(n&&n.type===`image`&&n.contentEditable){let t=Mw(n,{width:a,height:o});n.set(Object.assign({src:e},t));return}let s=Math.min(r.width/a,r.height/o,1);a*=s,o*=s;let c=(t?.x||r.width/2)-a/2,l=(t?.y||r.height/2)-o/2;(i=r.activePage)==null||i.addElement({type:`image`,src:e,width:a,height:o,x:c,y:l})},tJ=async({src:e,droppedPos:t,targetElement:n,store:r,attrs:i={}})=>{let a=i.width||300,o=i.height||200;if(n&&n.type===`video`&&n.contentEditable){let t=Mw(n,{width:a,height:o});n.set(Object.assign({src:e},t));return}let s=.8*Math.min(r.width/a,r.height/o,1);a*=s,o*=s;let c=(t?.x||r.width/2)-a/2,l=(t?.y||r.height/2)-o/2,u=r.activePage?.addElement({type:`video`,src:e,width:a,height:o,x:c,y:l});if(u&&r.activePage)try{let t=1e3*await wk(e);t>r.activePage.duration&&r.activePage.set({duration:t})}catch(e){console.warn(`Failed to get video duration:`,e)}return u},nJ=async({src:e,droppedPos:t,targetElement:n,store:r})=>{var i;if(n&&n.type===`image`&&n.contentEditable){n.set({clipSrc:e});return}if(n&&n.type===`video`&&n.contentEditable){n.set({clipSrc:e});return}let{width:a,height:o}=await ww(e),s=Math.min(r.width/a,r.height/o,1);a*=s,o*=s;let c=(t?.x||r.width/2)-a/2,l=(t?.y||r.height/2)-o/2;(i=r.activePage)==null||i.addElement({type:`svg`,width:a,height:o,x:c,y:l,src:e})},rJ=async({src:e,droppedPos:t,store:n})=>{var r;let{width:i,height:a}=await ww(e),o=(t?.x||n.width/2)-i/2,s=(t?.y||n.height/2)-a/2;(r=n.activePage)==null||r.addElement({type:`gif`,width:i,height:a,x:o,y:s,src:e})},iJ=async({url:e,type:t,store:n,droppedPos:r,targetElement:i,name:a})=>{let o=e;t===`image`?await eJ({src:o,store:n,droppedPos:r,targetElement:i}):t===`svg`?await nJ({src:o,store:n,droppedPos:r,targetElement:i}):t===`gif`?await rJ({src:o,store:n,droppedPos:r,targetElement:i}):t===`video`?await tJ({src:o,store:n,droppedPos:r,targetElement:i}):t===`audio`&&n.addAudio({src:o,name:a?Zq(a):``})},aJ=async({file:e,store:t,droppedPos:n})=>{let r=Xq(e);if(!r){console.warn(`polotno: ignoring "${e.name}" — not an image, video or audio file`);return}await iJ({url:await $q()(e),type:r,store:t,droppedPos:n,name:e.name})},oJ={data:[],pageId:``,payloadId:``},sJ=`polotno_clipboard`,cJ=(e,t,n)=>{oJ={data:JSON.parse(JSON.stringify(e)),pageId:t||``,payloadId:n||``};try{localStorage.setItem(sJ,JSON.stringify(e)),localStorage.setItem(`polotno_clipboard_page`,t||``),localStorage.setItem(`polotno_clipboard_payload`,n||``)}catch{}},lJ=()=>{try{let e=localStorage.getItem(sJ),t=localStorage.getItem(`polotno_clipboard_page`),n=localStorage.getItem(`polotno_clipboard_payload`);if(e)return{data:JSON.parse(e),pageId:t,payloadId:n}}catch{}return oJ},uJ=`data-polotno-clipboard`,dJ=(e,t)=>{e.history.transaction(()=>{let n=0,r=0,{data:i,pageId:a,payloadId:o}=t;if(a===e.activePage?.id)n=e.width/20,r=e.height/20;else{let t=[];aM({children:i},e=>{e.type!==`group`&&t.push(e)});let a=vj(t);a.maxX>e.width&&(n=-a.minX),a.maxY>e.height&&(r=-a.minY)}let s=[];aM({children:i},e=>{delete e.id,e.type!==`group`&&(e.x+=n,e.y+=r)}),i.forEach(t=>{let n=e.activePage?.addElement(t);n&&s.push(n.id)}),cJ(i,e.activePage?.id,o),e.selectElements(s)})},fJ=e=>{dJ(e,lJ())},pJ=(e,t)=>{if(!t.clipboardData||e.selectedElements.length===0)return!1;let n=e.selectedElements.map(e=>e.toJSON()),r=Cy(),i={v:1,id:r,pageId:e.activePage?.id||``,elements:n};t.clipboardData.setData(`text/html`,`<div ${uJ}="${(e=>vS(new TextEncoder().encode(JSON.stringify(e))))(i)}"></div>`);let a=[];return aM({children:n},e=>{e.type===`text`&&a.push(sx(e.text))}),t.clipboardData.setData(`text/plain`,a.join(`
643
+ `)||` `),t.preventDefault(),cJ(n,e.activePage?.id,r),!0},mJ=(e,t)=>{let n=pJ(e,t);if(n){let t=e.selectedElements.filter(e=>e.removable).map(e=>e.id);e.deleteElements(t)}return n},hJ=(e,t,n={})=>{let r=e.width/2,i=(e.width+e.height)/2160;return e.activePage?.addElement(Object.assign({type:`text`,x:e.width/2-r/2,y:e.height/2-15,width:r,fontSize:30*i,text:t},n))},gJ=(e,t,n={})=>{let r=t.clipboardData;if(!r)return!1;let i=r.getData(`text/html`);if(i&&i.includes(uJ)){let n=(e=>{try{let t=new DOMParser().parseFromString(e,`text/html`).querySelector(`[${uJ}]`)?.getAttribute(uJ);if(!t)return null;let n=JSON.parse(new TextDecoder().decode(_S(t)));return Array.isArray(n.elements)?n:null}catch{return null}})(i);if(n){t.preventDefault();let r=lJ();return n.id&&n.id===r.payloadId?dJ(e,r):dJ(e,{data:n.elements,pageId:n.pageId,payloadId:n.id}),!0}}let a=r.files?Array.from(r.files):[];if(a.length>0)return t.preventDefault(),(async()=>{for(let t of a)try{await aJ({file:t,store:e})}catch(e){console.error(`polotno: failed to insert pasted file`,e)}})(),!0;let o=r.getData(`text/plain`);if(o&&o.trim()){if(t.preventDefault(),n.onText)n.onText(o);else{let t=hJ(e,(e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`))(o));t&&e.selectElements([t.id])}return!0}return r.types.length===0&&lJ().data.length!==0&&(t.preventDefault(),fJ(e),!0)};function _J(e,t){let n=[];e.forEach(e=>{if(!1===e.removable)return;let t=e.clone();e.type===`group`?t.children.forEach(e=>{e.set({x:e.x+50,y:e.y+50})}):t.set({x:e.x+50,y:e.y+50}),n.push(t.id)}),t.selectElements(n)}var vJ=e=>{if(e.type!==`group`)return hj(e);let t=1/0,n=1/0,r=-1/0,i=-1/0;return e.children.forEach(e=>{let a=vJ(e);t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x+a.width),i=Math.max(i,a.y+a.height)}),{x:t,y:n,width:r-t,height:i-n}},yJ=(e,t,n)=>{if(e.type!==`group`){let r=hj(e),i=t-r.x,a=n-r.y;e.set({x:e.x+i,y:e.y+a})}else{let r=t-vJ(e).x,i=n-vJ(e).y;e.children.forEach(e=>{let t=vJ(e);yJ(e,t.x+r,t.y+i)})}};function bJ(e){let t=e.activePage?.computedWidth;e.selectedElements.forEach(e=>{t=Math.min(t,vJ(e).x)}),e.selectedElements.length===1&&(t=0),e.selectedElements.forEach(e=>{let n=vJ(e);yJ(e,n.x-n.x+t,n.y)})}function xJ(e){let t=0;e.selectedElements.forEach(e=>{let n=vJ(e);t=Math.max(t,n.x+n.width)}),e.selectedElements.length===1&&(t=e.activePage?.computedWidth),e.selectedElements.forEach(e=>{let n=vJ(e);yJ(e,t-n.width,n.y)})}function SJ(e){let t=e.activePage?.computedHeight;e.selectedElements.forEach(e=>{t=Math.min(t,vJ(e).y)}),e.selectedElements.length===1&&(t=0),e.selectedElements.forEach(e=>{let n=vJ(e);yJ(e,n.x,n.y-n.y+t)})}function CJ(e){let t=e.activePage?.computedHeight,n=0;e.selectedElements.forEach(e=>{let r=vJ(e);t=Math.min(t,r.y),n=Math.max(n,r.y+r.height)});let r=(n+t)/2;e.selectedElements.length===1&&(r=e.activePage?.computedHeight/2),e.selectedElements.forEach(e=>{let t=vJ(e);yJ(e,t.x,r-t.height/2)})}function wJ(e){let t=0;e.selectedElements.forEach(e=>{let n=vJ(e);t=Math.max(t,n.y+n.height)}),e.selectedElements.length===1&&(t=e.activePage?.computedHeight),e.selectedElements.forEach(e=>{let n=vJ(e);yJ(e,n.x,t-n.height)})}function TJ(e){let t=e.activePage?.computedWidth,n=0;e.selectedElements.forEach(e=>{let r=vJ(e);t=Math.min(t,r.x),n=Math.max(n,r.x+r.width)});let r=(n+t)/2;e.selectedElements.length===1&&(r=e.activePage?.computedWidth/2),e.selectedElements.forEach(e=>{let t=vJ(e);yJ(e,r-t.width/2,t.y)})}var EJ=`rgba(191, 191, 191, 100)`;function DJ(e){if(e.selectedElements.length!==1)return null;let t=e.selectedElements[0];return t.type===`table`?t:null}function OJ(e,t,n){let r=e.getCell(t,n);r&&e.focusCell(r.id)}function kJ(e,t,n){let r=e.getCell(t,n);r&&e.enterCellEdit(r.id)}function AJ(e){let t=document.activeElement,n=document.querySelector(`.polotno-workspace-container`),r=t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||!!t?.isContentEditable,i=!(!t||!n?.contains(t)),a=document.activeElement===n||i;return{workspaceContainer:n,activeIsEditable:r,activeIsInsideWorkspace:i,isWorkspaceActive:a,hasOutsideTextSelection:!a&&(window.getSelection()?.toString().length||0)>0}}function jJ(e){if(e.role===xM.VIEWER)return{handle:!1,table:null};let t=AJ();if(t.activeIsEditable||t.hasOutsideTextSelection)return{handle:!1,table:null};let n=DJ(e);return{handle:!0,table:n&&n._focusedCellIds.length>0&&!n._editingCellId?n:null}}function MJ(e,t){var n,r,i;if(t.role===xM.VIEWER)return;let a=AJ(),o=a.activeIsEditable&&!a.activeIsInsideWorkspace,s=DJ(t);if(!o&&s&&function(e,t,n){let r=t._focusedCellIds.length>0,i=!!t._editingCellId;if(!r&&!i)return!1;if(i){if(e.key===`Escape`)return e.preventDefault(),t.exitCellEdit(),!0;if(e.key===`Tab`){e.preventDefault();let n=t.editingCell;if(t.exitCellEdit(),n){if(e.shiftKey){let e=n.col-1,r=n.row;e<0&&(--r,e=t.cols-1),r<0&&(r=t.rows-1,e=t.cols-1),kJ(t,r,e)}else{let e=n.col+1,r=n.row;e>=t.cols&&(r+=1,e=0),r>=t.rows&&(r=0,e=0),kJ(t,r,e)}}return!0}if(e.metaKey||e.ctrlKey){let n=t.editingCell;if(n){if(e.key===`b`)return e.preventDefault(),n.set({fontWeight:Rb(n.fontWeight)?`normal`:`bold`}),!0;if(e.key===`i`)return e.preventDefault(),n.set({fontStyle:n.fontStyle===`italic`?`normal`:`italic`}),!0;if(e.key===`u`){e.preventDefault();let t=n.textDecoration.split(` `).filter(Boolean),r=t.includes(`underline`);return n.set({textDecoration:r?t.filter(e=>e!==`underline`).join(` `):[...t,`underline`].join(` `)}),!0}}}return!0}if(e.key===`Escape`)return e.preventDefault(),t.clearCellFocus(),!0;let a=t.focusedCells[0];if(!a)return!1;let o=a.row,s=a.col;if(e.key===`Enter`)return e.preventDefault(),t.enterCellEdit(a.id),!0;if(e.key===`Tab`){if(e.preventDefault(),e.shiftKey){let e=s-1,n=o;e<0&&(--n,e=t.cols-1),n<0&&(n=t.rows-1,e=t.cols-1),OJ(t,n,e)}else{let e=s+1,n=o;e>=t.cols&&(n+=1,e=0),n>=t.rows&&(n=0,e=0),OJ(t,n,e)}return!0}if(e.key===`ArrowRight`||e.key===`ArrowLeft`||e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),e.shiftKey){let n=function(e){let t=e.cells.find(t=>t.id===e._anchorCellId);if(!t)return null;let n=e.focusedCells;if(n.length<=1)return{row:t.row,col:t.col};let r=1/0,i=-1,a=1/0,o=-1;for(let e of n)e.row<r&&(r=e.row),e.row>i&&(i=e.row),e.col<a&&(a=e.col),e.col>o&&(o=e.col);return{row:t.row===r?i:r,col:t.col===a?o:a}}(t)||{row:o,col:s},r=n.row,i=n.col;e.key===`ArrowRight`&&(i=Math.min(n.col+1,t.cols-1)),e.key===`ArrowLeft`&&(i=Math.max(n.col-1,0)),e.key===`ArrowDown`&&(r=Math.min(n.row+1,t.rows-1)),e.key===`ArrowUp`&&(r=Math.max(n.row-1,0)),t.focusCellRange(r,i)}else e.key===`ArrowRight`&&OJ(t,o,Math.min(s+1,t.cols-1)),e.key===`ArrowLeft`&&OJ(t,o,Math.max(s-1,0)),e.key===`ArrowDown`&&OJ(t,Math.min(o+1,t.rows-1),s),e.key===`ArrowUp`&&OJ(t,Math.max(o-1,0),s);return!0}let c=e.ctrlKey||e.metaKey;if(!(c||e.shiftKey||e.altKey||e.key!==`Delete`&&e.key!==`Backspace`))return e.preventDefault(),t.focusedCells.forEach(e=>{e.set({text:``})}),!0;if(c&&e.shiftKey&&!e.altKey&&e.code===`Equal`){e.preventDefault();let r=t.getFocusedCellRange(),i=r?r.maxRow+1:o+1;return n.history.transaction(()=>{t.addRow(i)}),!0}if(c&&e.shiftKey&&e.altKey&&e.code===`Equal`){e.preventDefault();let r=t.getFocusedCellRange(),i=r?r.maxCol+1:s+1;return n.history.transaction(()=>{t.addColumn(i)}),!0}if(c&&!e.shiftKey&&e.code===`Backspace`){let r=t.getFocusedCellRange();if(r&&r.minCol===0&&r.maxCol===t.cols-1&&t.rows>1)return e.preventDefault(),n.history.transaction(()=>{t.removeRowRange(r.minRow,r.maxRow)}),!0}if(c&&e.shiftKey&&e.code===`Backspace`){let r=t.getFocusedCellRange();if(r&&r.minRow===0&&r.maxRow===t.rows-1&&t.cols>1)return e.preventDefault(),n.history.transaction(()=>{t.removeColumnRange(r.minCol,r.maxCol)}),!0}return c&&e.code===`KeyA`?(e.preventDefault(),t.cells.forEach(e=>{t.focusCell(e.id,!0)}),!0):!c||e.key.toLowerCase()!==`z`&&e.key.toLowerCase()!==`y`}(e,s,t)||a.activeIsEditable||a.hasOutsideTextSelection)return;if(e.key===`Alt`){let n=a.workspaceContainer;(a.isWorkspaceActive||t.distanceGuidesVisible||n&&n.matches(`:hover`))&&e.preventDefault();return}let c=t.selectedElements.filter(e=>e.removable).map(e=>e.id);e.keyCode!==46&&e.keyCode!==8||t.deleteElements(c);let l=e.ctrlKey||e.metaKey,u=e.shiftKey,d=e.altKey;if(e.key===`Escape`){e.preventDefault(),t.tool===`draw`?t.setTool(`selection`):t.selectElements([]);return}if(l&&!u&&e.key.toLowerCase()===`z`){e.preventDefault(),t.history.undo();return}if(l&&(u&&e.key.toLowerCase()===`z`||e.key.toLowerCase()===`y`)){e.preventDefault(),t.history.redo();return}if(l&&e.code===`KeyA`){e.preventDefault();let n=(t.activePage?.children.filter(e=>e.selectable))?.map(e=>e.id)||[];t.selectElements(n)}if(e.code===`ArrowDown`){e.preventDefault();let n=e.shiftKey?10:1;t.selectedShapes.forEach(e=>{e.draggable&&e.set({y:e.y+n})})}if(e.code===`ArrowUp`){e.preventDefault();let n=e.shiftKey?10:1;t.selectedShapes.forEach(e=>{e.draggable&&e.set({y:e.y-n})})}if(e.code===`ArrowLeft`){e.preventDefault();let n=e.shiftKey?10:1;t.selectedShapes.forEach(e=>{e.draggable&&e.set({x:e.x-n})})}if(e.code===`ArrowRight`){e.preventDefault();let n=e.shiftKey?10:1;t.selectedShapes.forEach(e=>{e.draggable&&e.set({x:e.x+n})})}if(l&&e.code===`KeyG`){e.preventDefault();let n=t.selectedElements[0];if(n&&n.type===`group`){let e=n;t.ungroupElements([e.id])}else t.groupElements(t.selectedElements.map(e=>e.id))}if(l&&e.code===`KeyD`&&(e.preventDefault(),_J(t.selectedElements,t)),e.code!==`KeyT`||l||(e.preventDefault(),hJ(t,`Sample Text`,{fontFamily:`Roboto`})),e.code===`KeyR`&&!l){e.preventDefault();let r={type:`figure`,x:t.width/4,y:t.height/4,width:300,height:300,fill:EJ,stroke:`#0c0c0c`,strokeWidth:0,subType:`rect`};(n=t.activePage)==null||n.addElement(r)}if(e.code===`KeyL`&&!l){e.preventDefault();let n=(t.activePage?.computedWidth??0)/3,i={type:`line`,x:(t.activePage?.computedWidth??0)/2-n/2,y:(t.activePage?.computedHeight??0)/2,width:n,color:EJ};(r=t.activePage)==null||r.addElement(i)}if(e.code===`KeyO`&&!l){e.preventDefault(),e.preventDefault();let n={type:`figure`,x:t.width/4,y:t.height/4,width:300,height:300,fill:EJ,stroke:`#0c0c0c`,strokeWidth:0,subType:`circle`};(i=t.activePage)==null||i.addElement(n)}l&&e.code===`Equal`&&(e.preventDefault(),t.setScale(t.scale+.1)),l&&e.code===`Minus`&&(e.preventDefault(),t.setScale(t.scale-.1)),d&&(e.code===`KeyA`&&(e.preventDefault(),bJ(t)),e.code===`KeyD`&&(e.preventDefault(),xJ(t)),e.code===`KeyS`&&(e.preventDefault(),wJ(t)),e.code===`KeyW`&&(e.preventDefault(),SJ(t)),e.code===`KeyV`&&(e.preventDefault(),CJ(t)),e.code===`KeyH`&&(e.preventDefault(),TJ(t))),e.code===`BracketRight`&&(e.preventDefault(),t.selectedElements.forEach(e=>l?e.moveUp():e.moveTop())),e.code===`BracketLeft`&&(e.preventDefault(),t.selectedElements.forEach(e=>l?e.moveDown():e.moveBottom()))}function NJ(e,t){let n=e.focusedCells.map(e=>sx(e.text)).join(`
644
+ `);t.clipboardData.setData(`text/plain`,n||` `),t.preventDefault()}function PJ(e,t){let n=jJ(t);n.handle&&e.clipboardData&&(n.table?NJ(n.table,e):pJ(t,e))}function FJ(e,t){let n=jJ(t);if(n.handle&&e.clipboardData){if(n.table){let r=n.table;NJ(r,e),t.history.transaction(()=>{r.focusedCells.forEach(e=>e.set({text:``}))});return}mJ(t,e)}}function IJ(e,t){let n=jJ(t);if(!n.handle)return;let r=n.table;gJ(t,e,{onText:r?e=>r.focusedCells[0]?.set({text:e}):void 0})}var LJ=Qt({toolbar:{duration:`Duration`,opacity:`Opacity`,effects:`Effects`,blur:`Blur`,curvedText:`Curved text`,curvePower:`Power`,temperature:`Temperature`,saturation:`Saturation`,contrast:`Contrast`,shadows:`Shadows`,white:`White`,black:`Black`,vibrance:`Vibrance`,textBackground:`Background`,backgroundCornerRadius:`Corner radius`,backgroundOpacity:`Opacity`,backgroundPadding:`Padding`,brightness:`Brightness`,filters:`Filters`,sepia:`Sepia`,grayscale:`Grayscale`,cold:`Cold`,natural:`Natural`,warm:`Warm`,textStroke:`Text Stroke`,strokeLineJoin:`Corners`,joinRound:`Round`,joinMiter:`Miter`,joinBevel:`Bevel`,shadow:`Shadow`,border:`Border`,cornerRadius:`Corner Radius`,copyStyle:`Copy style`,uppercase:`Uppercase`,position:`Position`,layering:`Layering`,toForward:`To Front`,up:`Forward`,down:`Backward`,toBottom:`To back`,alignLeft:`Align left`,alignCenter:`Align center`,alignRight:`Align right`,alignTop:`Align top`,alignMiddle:`Align middle`,alignBottom:`Align bottom`,flip:`Flip`,flipHorizontally:`Flip horizontally`,flipVertically:`Flip vertically`,fitToBackground:`Fit to page`,removeBackground:`Remove background`,removeBackgroundTitle:`Remove background from image`,cancelRemoveBackground:`Cancel`,confirmRemoveBackground:`Confirm`,crop:`Crop`,cropDone:`Done`,cropCancel:`Cancel`,clip:`Apply mask`,removeClip:`Remove mask`,removeMask:`Remove mask`,transparency:`Transparency`,lockedDescription:`Object is locked. Unlock it to allow changes from canvas.`,unlockedDescription:`Object is unlocked. Lock it to prevent changes from canvas.`,removeElements:`Remove elements`,duplicateElements:`Duplicate elements`,download:`Download`,saveAsImage:`Save as image`,saveAsPDF:`Save as PDF`,lineHeight:`Line height`,letterSpacing:`Letter spacing`,offsetX:`Offset X`,offsetY:`Offset Y`,color:`Color`,selectable:`Selectable`,draggable:`Draggable`,removable:`Removable`,resizable:`Resizable`,contentEditable:`Can change content`,styleEditable:`Can change style`,alwaysOnTop:`Always on top`,showInExport:`Show in export`,ungroupElements:`Ungroup`,groupElements:`Group`,lineSize:`Line size`,fade:`Fade`,move:`Move`,zoom:`Zoom`,animate:`Animate`,rotate:`Rotate`,none:`None`,bounce:`Bounce`,blink:`Blink`,strength:`Strength`,spaceEvenly:`Space evenly`,horizontalDistribution:`Horizontally`,verticalDistribution:`Vertically`,strokeWidth:`Stroke Width`,strokeSettings:`Stroke settings`,spacing:`Spacing`,volume:`Volume`,speed:`Speed`,seconds:`sec`,lineStyle:`Line style`,lineStartHead:`Line start`,lineEndHead:`Line end`,textDirection:`Text direction`,fontSize:`Font size`,fontFamily:`Font family`,fontFamilyMixed:`Mixed`,fontsInSelection:`Fonts in selection`,textAlign:`Text align`,verticalAlign:`Vertical align`,bold:`Bold`,italic:`Italic`,underline:`Underline`,strikethrough:`Strikethrough`,cellBackground:`Cell background`,tableBorderSettings:`Border settings`,tableBorderColor:`Border color`,tableBorderWidth:`Border width`,tableBorderStyle:`Border style`,borderModeAll:`All borders`,borderModeOuter:`Outer borders`,borderModeInner:`Inner borders`,borderModeBottomOnly:`Bottom only`,borderModeTopOnly:`Top only`,borderModeLeftOnly:`Left only`,borderModeRightOnly:`Right only`,borderModeInnerHorizontal:`Inner horizontal`,borderModeInnerVertical:`Inner vertical`,tableStructure:`Table structure`,tableRows:`Rows`,tableColumns:`Columns`,insertRowAbove:`Insert row above`,insertRowBelow:`Insert row below`,deleteRow:`Delete row`,insertColumnLeft:`Insert column left`,insertColumnRight:`Insert column right`,deleteColumn:`Delete column`,deleteRows:`Delete rows`,deleteColumns:`Delete columns`,distributeRowsEvenly:`Distribute rows evenly`,distributeColumnsEvenly:`Distribute columns evenly`,cellPadding:`Cell padding`,listFormat:`List`,colorPicker:{solid:`Solid`,linear:`Linear`,angle:`Angle`,colors:`Colors`,resetColors:`Reset`,recolorAll:`Recolor all`},aiText:{aiWrite:`AI write`,rewrite:`Rewrite`,shorten:`Shorten`,continue:`Continue writing`,proofread:`Proofread`,tones:`Tones`,friendly:`Friendly`,professional:`Professional`,humorous:`Humorous`,formal:`Formal`,customPrompt:`Custom prompt`,generatedResult:`Generated result`,cancel:`Cancel`,generate:`Generate`,back:`Back`,tryAgain:`Try Again`,insert:`Insert`,promptPlaceholder:`Describe what you want to generate`}},workspace:{noPages:`There are no pages yet...`,addPage:`Add page`,removePage:`Remove page`,duplicatePage:`Duplicate page`,moveUp:`Move up`,moveDown:`Move down`,moveLeft:`Move left`,moveRight:`Move right`},scale:{reset:`Reset`},error:{removeBackground:`Ops! Something went wrong. Background can not be removed.`},sidePanel:{templates:`Templates`,searchTemplatesWithSameSize:`Show templates with the same size`,searchPlaceholder:`Search...`,otherFormats:`Other formats`,noResults:`No results`,error:`Loading is failed...`,text:`Text`,uploadFont:`Upload font`,myFonts:`My fonts`,photos:`Photos`,videos:`Videos`,animations:`Animations`,effects:`Effects`,elements:`Elements`,shapes:`Shapes`,tables:`Tables`,lines:`Lines`,draw:`Draw`,upload:`Upload`,uploadImage:`Add file`,uploadTip:`Upload your assets`,uploadUnsupported:`Skipped some files. You can add images, video and audio.`,uploadFailed:`Upload failed. Please try again.`,background:`Background`,resize:`Resize`,layers:`Layers`,animate:`Animate`,layerTypes:{image:`Image`,text:`Text`,svg:`SVG`,line:`Line`,figure:`Figure`,group:`Group`},layersTip:`Elements on your active page:`,noLayers:`No elements on the page...`,namePlaceholder:`Type element name...`,useMagicResize:`Use magic resize`,advanced:`Advanced`,bleed:`Bleed`,showBleed:`Show bleed`,clipImage:`Mask image`,width:`Width`,height:`Height`,units:`Units`,magicResizeDescription:`Magic resize will automatically resize and move all elements on the canvas`,headerText:`Header`,createHeader:`Create header`,subHeaderText:`Sub Header`,createSubHeader:`Create sub header`,bodyText:`Body text`,createBody:`Create body text`},pagesTimeline:{pages:`Pages`,removePage:`Remove page`,addPage:`Add page`,duplicatePage:`Duplicate page`,removeAudio:`Remove audio`,duplicateAudio:`Duplicate audio`,renameAudio:`Rename audio`,muteAudio:`Mute`,unmuteAudio:`Unmute`,volume:`Volume`,speed:`Speed`,rewind:`Rewind to start`,editAsVideo:`Edit as video`,editAsVideoHint:`On: preview the frame at the playhead — timed elements hide outside their range. Off: show all elements while editing.`},contextMenu:{duplicate:`Duplicate`,split:`Split at playhead`,rename:`Rename`,remove:`Remove`,lock:`Lock`,unlock:`Unlock`,copy:`Copy`,paste:`Paste`,copyStyle:`Copy style`,moveUp:`Move up`,moveDown:`Move down`,moveBack:`Move back`,moveForward:`Move forward`}}),RJ=e=>e&&typeof e==`object`;function zJ(e,t){Object.keys(t).forEach(n=>{let r=e[n],i=t[n];RJ(i)&&RJ(r)?zJ(r,i):e[n]=i})}function BJ(e,t,n=``){Object.keys(t).forEach(r=>{let i=t[r],a=n?`${n}.${r}`:r;RJ(i)?RJ(e[r])?BJ(e[r],i,a):console.warn(`Missing nested translation object at '${a}'`):e[r]===void 0&&console.warn(`Missing translation '${a}'`)})}pr((e,{validate:t=!1}={})=>{t&&BJ(e,LJ),zJ(LJ,e)});var VJ={},HJ=e=>{let t=function(e,t){var n,r=t.split(`.`),i=e;for(n=0;n<r.length;++n){if(i[r[n]]==null)return;i=i[r[n]]}return i}(LJ,e);if(t!==void 0)return t;VJ[e]||(VJ[e]=!0,console.warn(`Missing translation '${e}'`));let n=e.split(`.`),r=n[n.length-1]||` `;return r.charAt(0).toUpperCase()+r.slice(1)},UJ=(e,t,n)=>Math.max(t,Math.min(n,e)),WJ=(e,t)=>Math.sqrt((t.clientX-e.clientX)**2+(t.clientY-e.clientY)**2),GJ=({store:e})=>(0,N.jsxs)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,textAlign:`center`},children:[(0,N.jsx)(`p`,{children:HJ(`workspace.noPages`)}),(0,N.jsx)(`button`,{onClick:()=>{e.addPage()},children:HJ(`workspace.addPage`)})]}),KJ=({width:e,height:t,xPadding:n,yPadding:r,backgroundColor:i})=>(0,N.jsx)(`div`,{style:{width:e+`px`,height:t+`px`,backgroundColor:i,paddingLeft:n+`px`,paddingRight:n+`px`,paddingTop:r+`px`,paddingBottom:r+`px`,flexShrink:0},children:(0,N.jsx)(`div`,{style:{width:` 100%`,height:`100%`,backgroundColor:`white`}})}),qJ=Na(({store:e,layout:t=`vertical`,pageControlsEnabled:n,backgroundColor:r,transparencyBackgroundColor:i,pageBorderColor:a,activePageBorderColor:o,bleedColor:s,snapGuideStroke:c,snapGuideStrokeWidth:l,snapGuideDash:u,selectionRectFill:d,selectionRectStroke:f,selectionRectStrokeWidth:p,transformLabelFill:m,transformLabelTextFill:h,cropOverlayFill:g,transformerStyle:_,innerImageCropTransformerStyle:v,outerImageCropTransformerStyle:y,highlighterStyle:b,mediaLoadingStyle:x,mediaErrorStyle:S,textOverflowIndicatorStyle:C,distanceGuideStroke:w,distanceLabelFill:T,distanceLabelTextFill:E,rulerBackgroundColor:D,rulerTextColor:O,rulerBorderColor:k,rulerBorderSize:A,rulerTickColor:ee,rulerTickSize:M,components:P,onKeyDown:F,onPaste:I,paddingX:te,paddingY:ne,pageGap:L,altCloneEnabled:R=!0,groupSelectionMode:re=`drill`,visiblePagesOffset:ie,renderOnlyActivePage:ae,scrollToPageThreshold:oe=.5,tooltipSafeArea:se})=>{let ce=t===`horizontal`,le=te??20,ue=ne??55,[de,fe]=j.useState({width:100,height:100}),pe=j.useRef(de),me=j.useRef(null),he=j.useRef(null),ge=j.useRef(0),_e=0,ve=0,ye=0,be=0;if(e.bleedVisible)for(let t of e.pages){let e=t.computedBleed;_e=Math.max(_e,e.left),ve=Math.max(ve,e.right),ye=Math.max(ye,e.top),be=Math.max(be,e.bottom)}let xe=Math.max(...e.pages.map(e=>e.computedWidth)),Se=Math.max(...e.pages.map(e=>e.computedHeight)),Ce=e.activePage?.computedHeight||0,we=xe+_e+ve,Te=(ae?Ce:Se)+ye+be,Ee=async({skipTimeout:t}={skipTimeout:!1})=>{if(t||await new Promise(e=>setTimeout(e,50)),me.current===null||!Number.isFinite(we)||!Number.isFinite(Te))return;let n=me.current.getBoundingClientRect();n.width!==0&&n.height!==0||(console.warn(`Polotno warning: <Workspace /> component can not automatically detect its size.
645
+ Width or height of parent elements is equal 0.
646
+ Please make sure it has non-zero size. You may need to adjust it with your styles. <Workspace /> will automatically fit into parent container.
647
+ For simpler debugging here is the log of the parent element:`),console.log(me.current));let r=he.current.clientWidth||n.width,i={width:r,height:n.height};(pe.current.width!==i.width||pe.current.height!==i.height)&&(fe(i),pe.current=i);let a=(r-2*le)/we,o=e.pages.length>1?3.1:2,s=(n.height-ue*o)/Te,c=e.pages.length>1?3.1:2,l=(r-le*c)/we,u=(n.height-2*ue)/Te,d=e.pages.length?Math.max(Math.min(ce?l:a,ce?u:s),.01):1;e.scaleToFit!==d&&(e.setScale(d),e._setScaleToFit(d))};j.useLayoutEffect(()=>{Ee({skipTimeout:!0})},[]),j.useEffect(()=>{Ee()},[we,Te,ne,te]),j.useLayoutEffect(()=>{Ee({skipTimeout:!0})},[e.openedSidePanel]),j.useEffect(()=>{e.__()},[]),j.useEffect(()=>{let e=me.current;if(window.ResizeObserver){let t=new ResizeObserver(()=>{Ee({skipTimeout:!0})});return t.observe(e),()=>t.unobserve(e)}{let e=setInterval(()=>{Ee({skipTimeout:!0})},100);return()=>clearInterval(e)}},[we,Te]);let De=ae?1:e.pages.length,Oe,ke;if(ce){let t=we*e.scale*De;Oe=Math.max(le,(de.width-t)/De/2),ke=Math.max(ue,(de.height-Te*e.scale)/2)}else{Oe=Math.max(le,(de.width-we*e.scale)/2);let t=Te*e.scale*De;ke=Math.max(ue,(de.height-t)/De/2)}Number.isNaN(Oe)&&(Oe=le),Number.isNaN(ke)&&(ke=ue),j.useEffect(()=>{let t=t=>{(F||MJ)(t,e)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[]),j.useEffect(()=>{let t=t=>PJ(t,e),n=t=>FJ(t,e),r=t=>(I||IJ)(t,e);return window.addEventListener(`copy`,t),window.addEventListener(`cut`,n),window.addEventListener(`paste`,r),()=>{window.removeEventListener(`copy`,t),window.removeEventListener(`cut`,n),window.removeEventListener(`paste`,r)}},[I]),j.useEffect(()=>{let t=t=>{if(t.ctrlKey||t.metaKey){t.preventDefault();let n=Math.max(5,e.scaleToFit),r=Math.min(.1,e.scaleToFit);ce&&we>0&&Number.isFinite(we)&&(r=Math.max(r,300/we)),r=Math.max(r,.01);let i=UJ(t.deltaY<0?e.scale*1.03:e.scale/1.03,r,n);e.setScale(i);return}},n=he.current;return n?.addEventListener(`wheel`,t),()=>n?.removeEventListener(`wheel`,t)},[ce,we,e]),j.useEffect(()=>{let t=he.current;if(!t)return;let n=e=>{e.touches.length===2&&(ge.current=WJ(e.touches[0],e.touches[1]))},r=n=>{if(n.touches.length===2&&ge.current>0){n.preventDefault();let r=WJ(n.touches[0],n.touches[1]),i=r/ge.current,a=Math.max(5,e.scaleToFit),o=Math.min(.1,e.scaleToFit);ce&&we>0&&Number.isFinite(we)&&(o=Math.max(o,300/we)),o=Math.max(o,.01);let s=e.scale,c=UJ(s*i,o,a),l=c/s,u=t.getBoundingClientRect(),d=(n.touches[0].clientX+n.touches[1].clientX)/2-u.left,f=(n.touches[0].clientY+n.touches[1].clientY)/2-u.top,p=t.scrollLeft+d,m=t.scrollTop+f;Ie.current=!0,e.setScale(c),t.scrollLeft=p*l-d,t.scrollTop=m*l-f,ge.current=r}},i=()=>{ge.current=0};return t.addEventListener(`touchstart`,n,{passive:!0}),t.addEventListener(`touchmove`,r,{passive:!1}),t.addEventListener(`touchend`,i,{passive:!0}),()=>{t.removeEventListener(`touchstart`,n),t.removeEventListener(`touchmove`,r),t.removeEventListener(`touchend`,i)}},[ce,we,e]);let Ae=L!==void 0,je=e.pages.map(t=>{if(ce){let n=(t.computedWidth+_e+ve)*e.scale;return Ae?n+L:n+2*Oe}{let n=(t.computedHeight+ye+be)*e.scale;return Ae?n+L:n+2*ke}}),Me=[],Ne=Ae?ce?Oe:ke:0;for(let e=0;e<je.length;e++)Me.push(Ne),Ne+=je[e];let Pe=je.reduce((e,t)=>e+t,0),Fe=Ae?Pe+(ce?2*Oe:2*ke):Pe,Ie=j.useRef(!1),[,Le]=j.useReducer(e=>e+1,0);((e,t,n,r,i)=>{let a=j.useRef(0),o=j.useRef(0),s=j.useRef(null),c=j.useRef(null),l=j.useRef(!1),u=j.useRef(r.pages.length);l.current=u.current!==r.pages.length,u.current=r.pages.length,j.useEffect(()=>{let t=e.current,n=()=>{a.current=t.scrollLeft,o.current=t.scrollTop,s.current=t.scrollWidth,c.current=t.scrollHeight};return t.addEventListener(`scroll`,n),n(),()=>{t.removeEventListener(`scroll`,n)}},[]),j.useLayoutEffect(()=>{if(!e.current)return;if(l.current){let t=e.current;s.current=t.scrollWidth,c.current=t.scrollHeight,a.current=t.scrollLeft,o.current=t.scrollTop;return}let t=e.current,n=s.current,r=c.current;if(n===null||r===null){s.current=t.scrollWidth,c.current=t.scrollHeight,a.current=t.scrollLeft,o.current=t.scrollTop;return}i.current=!0;let u=t.offsetWidth,d=t.offsetHeight,f=(a.current+u/2)/n,p=(o.current+d/2)/r,m=Math.max(0,t.scrollWidth-u),h=Math.max(0,t.scrollHeight-d);t.scrollLeft=UJ(f*t.scrollWidth-u/2,0,m),t.scrollTop=UJ(p*t.scrollHeight-d/2,0,h),s.current=t.scrollWidth,c.current=t.scrollHeight,a.current=t.scrollLeft,o.current=t.scrollTop},[n,t])})(he,Fe,e.scale,e,Ie);let{handleScroll:Re}=((e,t,n,r,i,a,o,s,c,l)=>{let u=j.useRef(!1),d=j.useRef(null),f=j.useRef(!1),p=c===`horizontal`;j.useEffect(()=>{let t=e.current,n=()=>{o.current};return t.addEventListener(`scroll`,n),()=>{t.removeEventListener(`scroll`,n)}},[]);let m=r.pages.indexOf(r.activePage);return j.useLayoutEffect(()=>{if(s||!r.activePage||!e.current||u.current)return;let a=e.current,o=r.pages.indexOf(r.activePage),c=t[o]||0,d=p?a.scrollLeft:a.scrollTop,m=p?a.scrollWidth-a.clientWidth:a.scrollHeight-a.clientHeight,h=Math.min(c,Math.max(0,m)),g=n[o]||n[0]||0,_=()=>{};return(Math.abs(h-d)>g*i||f.current)&&(f.current=!0,_=(({element:e,scrollTop:t,scrollLeft:n,duration:r=300,onFinish:i=()=>{}})=>{let a=t!==void 0,o=a?e.scrollTop:e.scrollLeft,s=a?t:n,c=s-o,l=0,u=!1;if(r===0)return a?e.scrollTop=s:e.scrollLeft=s,()=>{};let d=()=>{if(u)return;l+=20;let t=f(l,o,c,r);a?e.scrollTop=t:e.scrollLeft=t,l<r?setTimeout(d,20):i()},f=(e,t,n,r)=>(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t;return d(),()=>{u=!0}})(Object.assign(Object.assign({element:a},p?{scrollLeft:h}:{scrollTop:h}),{onFinish:()=>{f.current=!1,l?.()},duration:r.isPlaying?0:300}))),_},[r.activePage,m,r.isPlaying,s,c,t,n]),{handleScroll:e=>{if(s||f.current)return;u.current=!0,clearTimeout(d.current),d.current=setTimeout(()=>{u.current=!1},300);let n=(p?e.currentTarget.scrollLeft:e.currentTarget.scrollTop)+(p?a.width:a.height)/3,i=0;for(let e=t.length-1;e>=0;e--)if(n>=t[e]){i=e;break}let o=r.pages[i];o&&r.activePage!==o&&o.select()}}})(he,Me,je,e,oe,de,Ie,ae,t,Le),ze=de.width>=we*e.scale+2*Oe,Be=de.height>=Te*e.scale+2*ke,Ve=r||`rgba(232, 232, 232, 0.9)`,He=P?.NoPages||GJ,Ue=ce?de.width:de.height,We=he.current?ce?he.current.scrollLeft:he.current.scrollTop:0,Ge=e=>{for(let t=Me.length-1;t>=0;t--)if(e>=Me[t])return t;return 0},Ke=Math.max(0,Ge(We)),qe=Math.min(e.pages.length-1,Ge(We+Ue)),Je=ie??1,z=Math.max(0,Ke-Je),Ye=Math.min(e.pages.length-1,qe+Je),Xe=Eh({cropOverlayFill:g,workspaceBackgroundColor:r,pageBorderColor:a,activePageBorderColor:o,bleedColor:s,transparencyBackgroundColor:i,transformerStyle:_,innerImageCropTransformerStyle:v,outerImageCropTransformerStyle:y,highlighterStyle:b,snapGuideStroke:c,snapGuideStrokeWidth:l,snapGuideDash:u,selectionRectFill:d,selectionRectStroke:f,selectionRectStrokeWidth:p,transformLabelFill:m,transformLabelTextFill:h,distanceGuideStroke:w,distanceLabelFill:T,distanceLabelTextFill:E,mediaLoadingStyle:x,mediaErrorStyle:S,textOverflowIndicatorStyle:C,rulerBackgroundColor:D,rulerTextColor:O,rulerBorderColor:k,rulerBorderSize:A,rulerTickColor:ee,rulerTickSize:M});return(0,N.jsx)(bh,{value:Xe,children:(0,N.jsx)(`div`,{ref:me,style:{width:`100%`,height:`100%`,position:`relative`,outline:`none`,flex:1,backgroundColor:Ve,overflow:`hidden`},tabIndex:0,className:`polotno-workspace-container`,children:(0,N.jsxs)(`div`,{ref:he,onScroll:Re,style:Object.assign({position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,display:`flex`,flexDirection:ce?`row`:`column`,overflow:`auto`,overflowX:ce?`auto`:ze?`hidden`:`auto`,overflowY:ce&&Be?`hidden`:`auto`},Ae&&{paddingTop:ce?0:ke,paddingBottom:ce?0:ke,paddingLeft:ce?Oe:0,paddingRight:ce?Oe:0,boxSizing:`border-box`}),className:`polotno-workspace-inner`,children:[e.pages.map((r,i)=>{let a=r===e.activePage;if(ae&&!a&&!r._exportingOrRendering&&!r._forceMount)return null;let o=a||i>=z&&i<=Ye||r._exportingOrRendering||r._forceMount,s=ce?je[i]:we*e.scale+2*Oe,c=ce?Te*e.scale+2*ke:je[i];if(!o)return(0,N.jsx)(`div`,{style:{flexShrink:0},children:(0,N.jsx)(KJ,{width:s,height:c,backgroundColor:Ve,xPadding:Oe,yPadding:ke})},r.id);let l=(0,N.jsx)(zq,{page:r,xPadding:Oe,yPadding:ke,width:s,height:c,store:e,pageControlsEnabled:n,altCloneEnabled:R,groupSelectionMode:re,components:P,viewportSize:de,layout:t,tooltipSafeArea:se},r.id);return(r._exportingOrRendering||r._forceMount)&&!a&&ae?(0,N.jsx)(`div`,{style:{display:`none`,flexShrink:0},children:l},r.id):l}),e.rulesVisible&&(0,N.jsx)(Kq,{store:e,xPadding:Oe,yPadding:ke,width:we*e.scale+2*Oe,height:Te*e.scale+2*ke,pageSizes:je,layout:t,renderOnlyActivePage:ae}),e.pages.length===0&&(0,N.jsx)(He,{store:e}),e.audios.map(t=>(0,N.jsx)(qq,{audio:t,store:e},t.id))]})})})});i.prototype._requestDraw=()=>{},ib(!1),zy(`change-font-size`),My(!0);var JJ=CM({key:new URLSearchParams(location.search).get(`key`)});window.store=JJ;var YJ=null;window.__polotnoLoadJspdf=async()=>(YJ||=x(()=>import(`./jspdf.es.min-87BhH7b6.js`),__vite__mapDeps([0,1,2,3]),import.meta.url),await YJ);var XJ=null;window.__polotnoLoadVideoExport=async()=>(XJ||=x(()=>import(`./lib-Dlaz_6fT.js`),__vite__mapDeps([4,1,5]),import.meta.url),await XJ),window.config={addGlobalFont:Jx,setRichTextEnabled:Iy,setTextVerticalResizeEnabled:My,setTextOverflow:zy,onLoadError:vb,setAssetLoadTimeout:ub,setFontLoadTimeout:fb,unstable_setTextSplitAllowed:By,setRenderTagTextEnabled:Ly,setLegacyRichTextEnabled:Fy},M.createRoot(document.getElementById(`root`)).render(j.createElement(qJ,{visiblePagesOffset:0,renderOnlyActivePage:!0,store:JJ,components:{PageControls:()=>null,Tooltip:()=>null}}));