polotno-node 3.5.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index-DJaU6riF.js +646 -0
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/index-DPXoKCa_.js +0 -654
|
@@ -0,0 +1,646 @@
|
|
|
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-BEzl6SFD.js","./id3-Brg-Xwuw.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,Nt as c,Pt as l,Rt as u,g as d,h as f,i as p,jt as m,kt as h,m as g,n as _,zt as v}from"./id3-Brg-Xwuw.js";import{t as y}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 b=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 ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+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===``?`.`+A(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(k,`$&/`)+`/`),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(k,`$&/`)+`/`)+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+A(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+A(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 te(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 N(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 P=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)},F={map:te,forEach:function(e,t,n){te(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return te(e,function(){t++}),t},toArray:function(e){return te(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=F,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:N}},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,P)}catch(e){P(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`})),x=n(((e,t)=>{t.exports=b()})),S=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&&A(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&&A(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 ee=new MessageChannel,k=ee.port2;ee.port1.onmessage=D,O=function(){k.postMessage(null)}}else O=function(){_(D,0)};function A(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,A(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}}}})),C=n(((e,t)=>{t.exports=S()})),w=n((e=>{var t=x();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`})),T=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=w()})),E=n((e=>{var t=C(),n=x(),r=T();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`),S=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),ee=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var M=Symbol.for(`react.client.reference`);function te(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 w:return`Suspense`;case E:return`SuspenseList`;case ee: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 S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?te(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},re=[],ie=-1;function I(e){return{current:e}}function ae(e){0>ie||(e.current=re[ie],re[ie]=null,ie--)}function oe(e,t){ie++,re[ie]=e.current,e.current=t}var se=I(null),ce=I(null),le=I(null),L=I(null);function ue(e,t){switch(oe(le,t),oe(ce,e),oe(se,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}}ae(se),oe(se,e)}function de(){ae(se),ae(ce),ae(le)}function fe(e){e.memoizedState!==null&&oe(L,e);var t=se.current,n=Zd(t,e.type);t!==n&&(oe(ce,e),oe(se,n))}function pe(e){ce.current===e&&(ae(se),ae(ce)),L.current===e&&(ae(L),sp._currentValue=ne)}var me,he;function ge(e){if(me===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);me=t&&t[1]||``,he=-1<e.stack.indexOf(`
|
|
3
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
+
`+me+e+he}var _e=!1;function ve(e,t){if(!e||_e)return``;_e=!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{_e=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ge(n):``}function ye(e,t){switch(e.tag){case 26:case 27:case 5:return ge(e.type);case 16:return ge(`Lazy`);case 13:return e.child!==t&&t!==null?ge(`Suspense Fallback`):ge(`Suspense`);case 19:return ge(`SuspenseList`);case 0:case 15:return ve(e.type,!1);case 11:return ve(e.type.render,!1);case 1:return ve(e.type,!0);case 31:return ge(`Activity`);default:return``}}function be(e){try{var t=``,n=null;do t+=ye(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
+
Error generating stack: `+e.message+`
|
|
9
|
+
`+e.stack}}var xe=Object.prototype.hasOwnProperty,Se=t.unstable_scheduleCallback,Ce=t.unstable_cancelCallback,we=t.unstable_shouldYield,Te=t.unstable_requestPaint,Ee=t.unstable_now,De=t.unstable_getCurrentPriorityLevel,Oe=t.unstable_ImmediatePriority,ke=t.unstable_UserBlockingPriority,Ae=t.unstable_NormalPriority,je=t.unstable_LowPriority,Me=t.unstable_IdlePriority,Ne=t.log,Pe=t.unstable_setDisableYieldValue,Fe=null,Ie=null;function Le(e){if(typeof Ne==`function`&&Pe(e),Ie&&typeof Ie.setStrictMode==`function`)try{Ie.setStrictMode(Fe,e)}catch{}}var Re=Math.clz32?Math.clz32:Ve,ze=Math.log,Be=Math.LN2;function Ve(e){return e>>>=0,e===0?32:31-(ze(e)/Be|0)|0}var He=256,Ue=262144,We=4194304;function Ge(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 Ke(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=Ge(n))):i=Ge(o):i=Ge(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ge(n))):i=Ge(o)):i=Ge(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 qe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function R(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=We;return We<<=1,!(We&62914560)&&(We=4194304),e}function Ye(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ze(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-Re(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&&Qe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Qe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Re(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-Re(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function et(e,t){var n=t&-t;return n=n&42?1:tt(n),(n&(e.suspendedLanes|t))===0?n:0}function tt(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 nt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function rt(){var e=F.p;return e===0?(e=window.event,e===void 0?32:Cp(e.type)):e}function it(e,t){var n=F.p;try{return F.p=e,t()}finally{F.p=n}}var at=Math.random().toString(36).slice(2),ot=`__reactFiber$`+at,st=`__reactProps$`+at,ct=`__reactContainer$`+at,lt=`__reactEvents$`+at,ut=`__reactListeners$`+at,dt=`__reactHandles$`+at,ft=`__reactResources$`+at,pt=`__reactMarker$`+at;function mt(e){delete e[ot],delete e[st],delete e[lt],delete e[ut],delete e[dt]}function ht(e){var t=e[ot];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ct]||n[ot]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=bf(e);e!==null;){if(n=e[ot])return n;e=bf(e)}return t}e=n,n=e.parentNode}return null}function gt(e){if(e=e[ot]||e[ct]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _t(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function vt(e){var t=e[ft];return t||=e[ft]={hoistableStyles:new Map,hoistableScripts:new Map},t}function yt(e){e[pt]=!0}var bt=new Set,xt={};function St(e,t){Ct(e,t),Ct(e+`Capture`,t)}function Ct(e,t){for(xt[e]=t,e=0;e<t.length;e++)bt.add(t[e])}var wt=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]*$`),Tt={},Et={};function Dt(e){return xe.call(Et,e)?!0:xe.call(Tt,e)?!1:wt.test(e)?Et[e]=!0:(Tt[e]=!0,!1)}function Ot(e,t,n){if(Dt(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 kt(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 At(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 jt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Mt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Nt(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 Pt(e){if(!e._valueTracker){var t=Mt(e)?`checked`:`value`;e._valueTracker=Nt(e,t,``+e[t])}}function Ft(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Mt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function It(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 Lt=/[\n"\\]/g;function Rt(e){return e.replace(Lt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function zt(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=``+jt(t)):e.value!==``+jt(t)&&(e.value=``+jt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Vt(e,o,jt(n)):Vt(e,o,jt(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=``+jt(s):e.removeAttribute(`name`)}function Bt(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)){Pt(e);return}n=n==null?``:``+jt(n),t=t==null?n:``+jt(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),Pt(e)}function Vt(e,t,n){t===`number`&&It(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Ht(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=``+jt(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 Ut(e,t,n){if(t!=null&&(t=``+jt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+jt(n)}function Wt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(N(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=jt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Pt(e)}function Gt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Kt=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 qt(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||Kt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Jt(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&&qt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&qt(e,o,t[o])}function Yt(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 Xt=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`]]),Zt=/^[\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 Qt(e){return Zt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function $t(){}var en=null;function tn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var nn=null,rn=null;function an(e){var t=gt(e);if(t&&(e=t.stateNode)){var n=e[st]||null;a:switch(e=t.stateNode,t.type){case`input`:if(zt(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="`+Rt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[st]||null;if(!a)throw Error(i(90));zt(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&&Ft(r)}break a;case`textarea`:Ut(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Ht(e,!!n.multiple,t,!1)}}}var on=!1;function sn(e,t,n){if(on)return e(t,n);on=!0;try{return e(t)}finally{if(on=!1,(nn!==null||rn!==null)&&(Ou(),nn&&(t=nn,e=rn,rn=nn=null,an(t),e)))for(t=0;t<e.length;t++)an(e[t])}}function cn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[st]||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 ln=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),un=!1;if(ln)try{var dn={};Object.defineProperty(dn,"passive",{get:function(){un=!0}}),window.addEventListener(`test`,dn,dn),window.removeEventListener(`test`,dn,dn)}catch{un=!1}var fn=null,pn=null,mn=null;function hn(){if(mn)return mn;var e,t=pn,n=t.length,r,i=`value`in fn?fn.value:fn.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 mn=i.slice(e,1<r?1-r:void 0)}function gn(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 _n(){return!0}function vn(){return!1}function yn(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)?_n:vn,this.isPropagationStopped=vn,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=_n)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=_n)},persist:function(){},isPersistent:_n}),t}var bn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xn=yn(bn),Sn=f({},bn,{view:0,detail:0}),Cn=yn(Sn),wn,Tn,En,Dn=f({},Sn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ln,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!==En&&(En&&e.type===`mousemove`?(wn=e.screenX-En.screenX,Tn=e.screenY-En.screenY):Tn=wn=0,En=e),wn)},movementY:function(e){return`movementY`in e?e.movementY:Tn}}),On=yn(Dn),kn=yn(f({},Dn,{dataTransfer:0})),An=yn(f({},Sn,{relatedTarget:0})),jn=yn(f({},bn,{animationName:0,elapsedTime:0,pseudoElement:0})),Mn=yn(f({},bn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Nn=yn(f({},bn,{data:0})),Pn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Fn={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`},z={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function In(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=z[e])?!!t[e]:!1}function Ln(){return In}var Rn=yn(f({},Sn,{key:function(e){if(e.key){var t=Pn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=gn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Fn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ln,charCode:function(e){return e.type===`keypress`?gn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?gn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),zn=yn(f({},Dn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Bn=yn(f({},Sn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ln})),Vn=yn(f({},bn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Hn=yn(f({},Dn,{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})),Un=yn(f({},bn,{newState:0,oldState:0})),Wn=[9,13,27,32],Gn=ln&&`CompositionEvent`in window,Kn=null;ln&&`documentMode`in document&&(Kn=document.documentMode);var qn=ln&&`TextEvent`in window&&!Kn,Jn=ln&&(!Gn||Kn&&8<Kn&&11>=Kn),Yn=` `,Xn=!1;function Zn(e,t){switch(e){case`keyup`:return Wn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var $n=!1;function er(e,t){switch(e){case`compositionend`:return Qn(t);case`keypress`:return t.which===32?(Xn=!0,Yn):null;case`textInput`:return e=t.data,e===Yn&&Xn?null:e;default:return null}}function tr(e,t){if($n)return e===`compositionend`||!Gn&&Zn(e,t)?(e=hn(),mn=pn=fn=null,$n=!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 Jn&&t.locale!==`ko`?null:t.data;default:return null}}var nr={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 rr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!nr[e.type]:t===`textarea`}function ir(e,t,n,r){nn?rn?rn.push(r):rn=[r]:nn=r,t=Pd(t,`onChange`),0<t.length&&(n=new xn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var ar=null,or=null;function sr(e){W(e,0)}function cr(e){if(Ft(_t(e)))return e}function lr(e,t){if(e===`change`)return t}var ur=!1;if(ln){var dr;if(ln){var fr=`oninput`in document;if(!fr){var pr=document.createElement(`div`);pr.setAttribute(`oninput`,`return;`),fr=typeof pr.oninput==`function`}dr=fr}else dr=!1;ur=dr&&(!document.documentMode||9<document.documentMode)}function mr(){ar&&(ar.detachEvent(`onpropertychange`,hr),or=ar=null)}function hr(e){if(e.propertyName===`value`&&cr(or)){var t=[];ir(t,or,e,tn(e)),sn(sr,t)}}function gr(e,t,n){e===`focusin`?(mr(),ar=t,or=n,ar.attachEvent(`onpropertychange`,hr)):e===`focusout`&&mr()}function _r(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return cr(or)}function vr(e,t){if(e===`click`)return cr(t)}function yr(e,t){if(e===`input`||e===`change`)return cr(t)}function br(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var xr=typeof Object.is==`function`?Object.is:br;function Sr(e,t){if(xr(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(!xe.call(t,i)||!xr(e[i],t[i]))return!1}return!0}function Cr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function wr(e,t){var n=Cr(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=Cr(n)}}function Tr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Tr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Er(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=It(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=It(e.document)}return t}function Dr(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 Or=ln&&`documentMode`in document&&11>=document.documentMode,kr=null,Ar=null,jr=null,Mr=!1;function Nr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mr||kr==null||kr!==It(r)||(r=kr,`selectionStart`in r&&Dr(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}),jr&&Sr(jr,r)||(jr=r,r=Pd(Ar,`onSelect`),0<r.length&&(t=new xn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=kr)))}function Pr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Fr={animationend:Pr(`Animation`,`AnimationEnd`),animationiteration:Pr(`Animation`,`AnimationIteration`),animationstart:Pr(`Animation`,`AnimationStart`),transitionrun:Pr(`Transition`,`TransitionRun`),transitionstart:Pr(`Transition`,`TransitionStart`),transitioncancel:Pr(`Transition`,`TransitionCancel`),transitionend:Pr(`Transition`,`TransitionEnd`)},Ir={},Lr={};ln&&(Lr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Fr.animationend.animation,delete Fr.animationiteration.animation,delete Fr.animationstart.animation),`TransitionEvent`in window||delete Fr.transitionend.transition);function Rr(e){if(Ir[e])return Ir[e];if(!Fr[e])return e;var t=Fr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Lr)return Ir[e]=t[n];return e}var zr=Rr(`animationend`),Br=Rr(`animationiteration`),Vr=Rr(`animationstart`),Hr=Rr(`transitionrun`),Ur=Rr(`transitionstart`),Wr=Rr(`transitioncancel`),Gr=Rr(`transitionend`),Kr=new Map,qr=`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(` `);qr.push(`scrollEnd`);function Jr(e,t){Kr.set(e,t),St(t,[e])}var Yr=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)},Xr=[],Zr=0,Qr=0;function $r(){for(var e=Zr,t=Qr=Zr=0;t<e;){var n=Xr[t];Xr[t++]=null;var r=Xr[t];Xr[t++]=null;var i=Xr[t];Xr[t++]=null;var a=Xr[t];if(Xr[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&&ri(n,i,a)}}function ei(e,t,n,r){Xr[Zr++]=e,Xr[Zr++]=t,Xr[Zr++]=n,Xr[Zr++]=r,Qr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ti(e,t,n,r){return ei(e,t,n,r),ii(e)}function ni(e,t){return ei(e,null,null,t),ii(e)}function ri(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-Re(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ii(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 ai={};function oi(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 si(e,t,n,r){return new oi(e,t,n,r)}function ci(e){return e=e.prototype,!(!e||!e.isReactComponent)}function li(e,t){var n=e.alternate;return n===null?(n=si(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 ui(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 di(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ci(e)&&(s=1);else if(typeof e==`string`)s=Qf(e,n,se.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case ee:return e=si(31,n,t,a),e.elementType=ee,e.lanes=o,e;case g:return fi(n.children,a,o,t);case _:s=8,a|=24;break;case v:return e=si(12,n,t,a|2),e.elementType=v,e.lanes=o,e;case w:return e=si(13,n,t,a),e.elementType=w,e.lanes=o,e;case E:return e=si(19,n,t,a),e.elementType=E,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 S:s=11;break a;case D: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=si(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function fi(e,t,n,r){return e=si(7,e,r,t),e.lanes=n,e}function pi(e,t,n){return e=si(6,e,null,t),e.lanes=n,e}function mi(e){var t=si(18,null,null,0);return t.stateNode=e,t}function hi(e,t,n){return t=si(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var gi=new WeakMap;function _i(e,t){if(typeof e==`object`&&e){var n=gi.get(e);return n===void 0?(t={value:e,source:t,stack:be(t)},gi.set(e,t),t):n}return{value:e,source:t,stack:be(t)}}var vi=[],yi=0,bi=null,xi=0,Si=[],Ci=0,wi=null,Ti=1,Ei=``;function Di(e,t){vi[yi++]=xi,vi[yi++]=bi,bi=e,xi=t}function Oi(e,t,n){Si[Ci++]=Ti,Si[Ci++]=Ei,Si[Ci++]=wi,wi=e;var r=Ti;e=Ei;var i=32-Re(r)-1;r&=~(1<<i),n+=1;var a=32-Re(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ti=1<<32-Re(t)+i|n<<i|r,Ei=a+e}else Ti=1<<a|n<<i|r,Ei=e}function ki(e){e.return!==null&&(Di(e,1),Oi(e,1,0))}function Ai(e){for(;e===bi;)bi=vi[--yi],vi[yi]=null,xi=vi[--yi],vi[yi]=null;for(;e===wi;)wi=Si[--Ci],Si[Ci]=null,Ei=Si[--Ci],Si[Ci]=null,Ti=Si[--Ci],Si[Ci]=null}function ji(e,t){Si[Ci++]=Ti,Si[Ci++]=Ei,Si[Ci++]=wi,Ti=t.id,Ei=t.overflow,wi=e}var Mi=null,Ni=null,Pi=!1,Fi=null,Ii=!1,Li=Error(i(519));function Ri(e){throw Wi(_i(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Li}function zi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ot]=e,t[st]=r,n){case`dialog`:Dd(`cancel`,t),Dd(`close`,t);break;case`iframe`:case`object`:case`embed`:Dd(`load`,t);break;case`video`:case`audio`:for(n=0;n<Td.length;n++)Dd(Td[n],t);break;case`source`:Dd(`error`,t);break;case`img`:case`image`:case`link`:Dd(`error`,t),Dd(`load`,t);break;case`details`:Dd(`toggle`,t);break;case`input`:Dd(`invalid`,t),Bt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Dd(`invalid`,t);break;case`textarea`:Dd(`invalid`,t),Wt(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&&(Dd(`beforetoggle`,t),Dd(`toggle`,t)),r.onScroll!=null&&Dd(`scroll`,t),r.onScrollEnd!=null&&Dd(`scrollend`,t),r.onClick!=null&&(t.onclick=$t),t=!0):t=!1,t||Ri(e,!0)}function Bi(e){for(Mi=e.return;Mi;)switch(Mi.tag){case 5:case 31:case 13:Ii=!1;return;case 27:case 3:Ii=!0;return;default:Mi=Mi.return}}function Vi(e){if(e!==Mi)return!1;if(!Pi)return Bi(e),Pi=!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&&Ni&&Ri(e),Bi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ni=yf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ni=yf(e)}else t===27?(t=Ni,sf(e.type)?(e=vf,vf=null,Ni=e):Ni=t):Ni=Mi?_f(e.stateNode.nextSibling):null;return!0}function Hi(){Ni=Mi=null,Pi=!1}function Ui(){var e=Fi;return e!==null&&(au===null?au=e:au.push.apply(au,e),Fi=null),e}function Wi(e){Fi===null?Fi=[e]:Fi.push(e)}var Gi=I(null),Ki=null,qi=null;function Ji(e,t,n){oe(Gi,t._currentValue),t._currentValue=n}function Yi(e){e._currentValue=Gi.current,ae(Gi)}function Xi(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 Zi(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),Xi(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),Xi(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 Qi(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;xr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===L.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&&Zi(t,e,n,r),t.flags|=262144}function $i(e){for(e=e.firstContext;e!==null;){if(!xr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ea(e){Ki=e,qi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ta(e){return ra(Ki,e)}function na(e,t){return Ki===null&&ea(e),ra(e,t)}function ra(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},qi===null){if(e===null)throw Error(i(308));qi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else qi=qi.next=t;return n}var ia=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()})}},aa=t.unstable_scheduleCallback,oa=t.unstable_NormalPriority,sa={$$typeof:b,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ca(){return{controller:new ia,data:new Map,refCount:0}}function la(e){e.refCount--,e.refCount===0&&aa(oa,function(){e.controller.abort()})}var ua=null,da=0,fa=0,pa=null;function ma(e,t){if(ua===null){var n=ua=[];da=0,fa=yd(),pa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return da++,t.then(ha,ha),t}function ha(){if(--da===0&&ua!==null){pa!==null&&(pa.status=`fulfilled`);var e=ua;ua=null,fa=0,pa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ga(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 _a=P.S;P.S=function(e,t){cu=Ee(),typeof t==`object`&&t&&typeof t.then==`function`&&ma(e,t),_a!==null&&_a(e,t)};var va=I(null);function ya(){var e=va.current;return e===null?Ul.pooledCache:e}function ba(e,t){t===null?oe(va,va.current):oe(va,t.pool)}function xa(){var e=ya();return e===null?null:{parent:sa._currentValue,pool:e}}var Sa=Error(i(460)),Ca=Error(i(474)),wa=Error(i(542)),Ta={then:function(){}};function Ea(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Da(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then($t,$t),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ja(e),e;default:if(typeof t.status==`string`)t.then($t,$t);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,ja(e),e}throw ka=t,Sa}}function Oa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ka=e,Sa):e}}var ka=null;function Aa(){if(ka===null)throw Error(i(459));var e=ka;return ka=null,e}function ja(e){if(e===Sa||e===wa)throw Error(i(483))}var B=null,Ma=0;function Na(e){var t=Ma;return Ma+=1,B===null&&(B=[]),Da(B,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 V(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=li(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=pi(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&&Oa(i)===t.type)?(t=a(t,n.props),Pa(t,n),t.return=e,t):(t=di(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=hi(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=fi(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=pi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case m:return n=di(t.type,t.key,t.props,null,e.mode,n),Pa(n,t),n.return=e,n;case h:return t=hi(t,e.mode,n),t.return=e,t;case O:return t=Oa(t),f(e,t,n)}if(N(t)||j(t))return t=fi(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,na(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=Oa(n),p(e,t,n,r)}if(N(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,na(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=Oa(r),_(e,t,n,r,i)}if(N(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,na(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),Pi&&Di(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 Pi&&Di(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)}),Pi&&Di(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),Pi&&Di(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 Pi&&Di(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)}),Pi&&Di(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&&Oa(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=fi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=di(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=hi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Oa(o),x(e,r,o,c)}if(N(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,na(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=pi(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 B=null,i}catch(t){if(t===Sa||t===wa)throw t;var a=si(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ia=V(!0),La=V(!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=ii(e),ri(e,null,n),t}return ei(e,r,t,n),ii(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,$e(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=pa;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===fa&&(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=I(null),Za=I(0);function Qa(e,t){e=Zl,oe(Za,e),oe(Xa,t),Zl=e|t.baseLanes}function $a(){oe(Za,Zl),oe(Xa,Xa.current)}function eo(){Zl=Za.current,ae(Xa),ae(Za)}var to=I(null),no=null;function ro(e){var t=e.alternate;oe(so,so.current&1),oe(to,e),no===null&&(t===null||Xa.current!==null||t.memoizedState!==null)&&(no=e)}function io(e){oe(so,so.current),oe(to,e),no===null&&(no=e)}function ao(e){e.tag===22?(oe(so,so.current),oe(to,e),no===null&&(no=e)):H(e)}function H(){oe(so,so.current),oe(to,to.current)}function oo(e){ae(to),no===e&&(no=null),ae(so)}var so=I(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(!xr(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,P.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){P.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&&$i(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)}P.H=Hs,o=t(n,r)}while(ho);return o}function Eo(){var e=P.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=Da(yo,e,t),t=uo,(po===null?t.memoizedState:po.next)===null&&(t=t.alternate,P.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 ta(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]=k;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===fa&&(d=!0);else if((lo&p)===p){u=u.next,p===fa&&(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,!xr(o,e.memoizedState)&&(ic=!0,d&&(n=pa,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);xr(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=Pi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!xr((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!xr(e,n)}catch{return!0}}function Go(e){var t=ni(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){Le(!0);try{n()}finally{Le(!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)}};P.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=P.T,o={};P.T=o;try{var s=n(i,r),c=P.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),P.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(Pi){var n=Ul.formState;if(n!==null){a:{var r=uo;if(Pi){if(Ni){b:{for(var i=Ni,a=Ii;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){Ni=_f(i.nextSibling),r=i.data===`F!`;break a}}Ri(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===Sa?wa: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){Le(!0);try{e()}finally{Le(!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 xr(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),xr(e,t)||(ic=!0),e)}function Cs(e,t,n,r,i){var a=F.p;F.p=a!==0&&8>a?a:8;var o=P.T,s={};P.T=s,Fs(e,!1,t,n);try{var c=i(),l=P.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ps(e,t,ga(c,r),xu(e)):Ps(e,t,r,xu(e))}catch(n){Ps(e,t,{then:function(){},status:`rejected`,reason:n},xu())}finally{F.p=a,o!==null&&s.types!==null&&(o.types=s.types),P.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,ne,n===null?ws:function(){return Ds(e),n(r)})}function Es(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:ne},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 ta(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:ca()},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=ti(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,xr(s,o))return ei(e,t,i,0),Ul===null&&$r(),!1}catch{}if(n=ti(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=ti(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,$e(e,n)}}var zs={readContext:ta,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:ta,use:Po,useCallback:function(e,t){return Ao().memoizedState=[e,t===void 0?null:t],e},useContext:ta,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){Le(!0);try{e()}finally{Le(!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){Le(!0);try{n(t)}finally{Le(!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(Pi){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(Pi){var n=Ei,r=Ti;n=(r&~(1<<32-Re(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:ta,use:Po,useCallback:ys,useContext:ta,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:ta,use:Po,useCallback:ys,useContext:ta,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?!Sr(n,r)||!Sr(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){Yr(e)}function Ys(e){console.error(e)}function Xs(e){Yr(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&&Qi(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===Ta?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===Ta?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(Pi)return t=to.current,t===null?(r!==Li&&(t=Error(i(423),{cause:r}),Wi(_i(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=_i(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!==Li&&(e=Error(i(422),{cause:r}),Wi(_i(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=_i(o,n),iu===null?iu=[o]:iu.push(o),Ql!==4&&(Ql=2),t===null)return!0;r=_i(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?La(t,null,n,r):Ia(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 ea(t),r=Co(e,t,n,o,a,i),s=Do(),e!==null&&!ic?(Oo(e,t,i),Ac(e,t,i)):(Pi&&s&&ki(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`&&!ci(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,cc(e,t,a,r,i)):(e=di(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?Sr:n,n(o,r)&&e.ref===t.ref)return Ac(e,t,i)}return t.flags|=1,e=li(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(Sr(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&&ba(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&&ba(t,null),$a(),H(t)):(ba(t,a.cachePool),Qa(t,a),H(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=ya();return a=a===null?null:{parent:sa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ba(t,null),$a(),ao(t),e!==null&&Qi(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 Ia(t,e.child,null,n),e=fc(t,t.pendingProps),e.flags|=2,oo(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(Pi){if(r.mode===`hidden`)return e=fc(t,r),t.lanes=536870912,uc(null,e);if(io(t),(e=Ni)?(e=pf(e,Ii),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:wi===null?null:{id:Ti,overflow:Ei},retryLane:536870912,hydrationErrors:null},n=mi(e),n.return=t,t.child=n,Mi=t,Ni=null)):e=null,e===null)throw Ri(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||Qi(e,t,n,!1),a=(n&e.childLanes)!==0,ic||a){if(r=Ul,r!==null&&(s=et(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ni(e,s),Cu(r,e,s),rc;Fu(),t=pc(e,t,n)}else e=o.treeContext,Ni=_f(s.nextSibling),Mi=t,Pi=!0,Fi=null,Ii=!1,e!==null&&ji(t,e),t=fc(t,r),t.flags|=4096;return t}return e=li(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 ea(t),n=Co(e,t,n,r,void 0,i),r=Do(),e!==null&&!ic?(Oo(e,t,i),Ac(e,t,i)):(Pi&&r&&ki(t),t.flags|=1,ac(e,t,n,i),t.child)}function _c(e,t,n,r,i,a){return ea(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)):(Pi&&r&&ki(t),t.flags|=1,ac(e,t,n,a),t.child)}function vc(e,t,n,r,i){if(ea(t),t.stateNode===null){var a=ai,o=n.contextType;typeof o==`object`&&o&&(a=ta(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?ta(o):ai,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=ai,typeof u==`object`&&u&&(o=ta(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=ai,typeof l==`object`&&l&&(c=ta(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&&$i(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&&$i(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=Ia(t,e.child,null,i),t.child=Ia(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 Hi(),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:xa()}}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:!!(so.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(Pi){if(a?ro(t):H(t),(e=Ni)?(e=pf(e,Ii),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:wi===null?null:{id:Ti,overflow:Ei},retryLane:536870912,hydrationErrors:null},n=mi(e),n.return=t,t.child=n,Mi=t,Ni=null)):e=null,e===null)throw Ri(t);return hf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(H(t),a=t.mode,c=Tc({mode:`hidden`,children:c},a),r=fi(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?(H(t),c=r.fallback,a=t.mode,r=Tc({mode:`visible`,children:r.children},a),c=fi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ia(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)):(H(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,Wi({value:r,source:null,stack:null}),t=Ec(e,t,n)}else if(ic||Qi(e,t,n,!1),s=(n&e.childLanes)!==0,ic||s){if(s=Ul,s!==null&&(r=et(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ni(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,Ni=_f(c.nextSibling),Mi=t,Pi=!0,Fi=null,Ii=!1,e!==null&&ji(t,e),t=wc(t,r.children),t.flags|=4096);return t}return a?(H(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=li(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=fi(c,a,n,null),c.flags|=2):c=li(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=xa():(l=sa._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=li(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=si(22,e,null,t),e.lanes=0,e}function Ec(e,t,n){return Ia(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),Xi(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=so.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,oe(so,o),ac(e,t,r,n),r=Pi?xi: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(Qi(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=li(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=li(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&&$i(e)))}function Mc(e,t,n){switch(t.tag){case 3:ue(t,t.stateNode.containerInfo),Ji(t,sa,e.memoizedState.cache),Hi();break;case 27:case 5:fe(t);break;case 4:ue(t,t.stateNode.containerInfo);break;case 10:Ji(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||=(Qi(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),oe(so,so.current),r)break;return null;case 22:return t.lanes=0,lc(e,t,n,t.pendingProps);case 24:Ji(t,sa,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,Pi&&t.flags&1048576&&Oi(t,xi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Oa(t.elementType),t.type=e,typeof e==`function`)ci(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===S){t.tag=11,t=oc(null,t,e,r,n);break a}if(a===D){t.tag=14,t=sc(null,t,e,r,n);break a}}throw t=te(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(ue(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,Ji(t,sa,r),r!==o.cache&&Zi(t,[sa],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=_i(Error(i(424)),t),Wi(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(Ni=_f(e.firstChild),Mi=t,Pi=!0,Fi=null,Ii=!0,n=La(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Hi(),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:Pi||(n=t.type,e=t.pendingProps,r=Yd(le.current).createElement(n),r[ot]=t,r[st]=e,Ud(r,n,e),yt(r),t.stateNode=r):t.memoizedState=Rf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return fe(t),e===null&&Pi&&(r=t.stateNode=xf(t.type,t.pendingProps,le.current),Mi=t,Ii=!0,a=Ni,sf(t.type)?(vf=a,Ni=_f(r.firstChild)):Ni=a),ac(e,t,t.pendingProps.children,n),hc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Pi&&((a=r=Ni)&&(r=df(r,t.type,t.pendingProps,Ii),r===null?a=!1:(t.stateNode=r,Mi=t,Ni=_f(r.firstChild),Ii=!1,a=!0)),a||Ri(t)),fe(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&&Pi&&((e=n=Ni)&&(n=ff(n,t.pendingProps,Ii),n===null?e=!1:(t.stateNode=n,Mi=t,Ni=null,e=!0)),e||Ri(t)),null;case 13:return Cc(e,t,n);case 4:return ue(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ia(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,Ji(t,t.type,r.value),ac(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,ea(t),a=ta(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 ea(t),r=ta(sa),e===null?(a=ya(),a===null&&(a=Ul,o=ca(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},za(t),Ji(t,sa,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,Ji(t,sa,r),r!==a.cache&&Zi(t,[sa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ji(t,sa,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 ka=Ta,Ca}}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 ka=Ta,Ca}}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(!Pi)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(Ai(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),Yi(sa),de(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Vi(t)?Pc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ui())),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(pe(t),n=le.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=se.current,Vi(t)?zi(t,e):(e=xf(a,r,n),t.stateNode=e,Pc(t))}return zc(t),null;case 5:if(pe(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=se.current,Vi(t))zi(t,o);else{var s=Yd(le.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[ot]=t,o[st]=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=le.current,Vi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Mi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Bd(e.nodeValue,n)),e||Ri(t,!0)}else e=Yd(e).createTextNode(r),e[ot]=t,t.stateNode=e}return zc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Vi(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[ot]=t}else Hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),e=!1}else n=Ui(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(oo(t),t):(oo(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=Vi(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[ot]=t}else Hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),a=!1}else a=Ui(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(oo(t),t):(oo(t),null)}return oo(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 de(),e===null&&Ad(t.stateNode.containerInfo),zc(t),null;case 10:return Yi(t.type),zc(t),null;case 19:if(ae(so),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;)ui(n,e),n=n.sibling;return oe(so,so.current&1|2),Pi&&Di(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ee()>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&&!Pi)return zc(t),null}else 2*Ee()-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=Ee(),e.sibling=null,n=so.current,oe(so,a?n&1|2:n&1),Pi&&Di(t,r.treeForkCount),e);case 22:case 23:return oo(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&&ae(va),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Yi(sa),zc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Vc(e,t){switch(Ai(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Yi(sa),de(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pe(t),null;case 31:if(t.memoizedState!==null){if(oo(t),t.alternate===null)throw Error(i(340));Hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(oo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ae(so),null;case 4:return de(),null;case 10:return Yi(t.type),null;case 22:case 23:return oo(t),eo(),e!==null&&ae(va),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Yi(sa),null;case 25:return null;default:return null}}function Hc(e,t){switch(Ai(t),t.tag){case 3:Yi(sa),de();break;case 26:case 27:case 5:pe(t);break;case 4:de();break;case 31:t.memoizedState!==null&&oo(t);break;case 13:oo(t);break;case 19:ae(so);break;case 10:Yi(t.type);break;case 22:case 23:oo(t),eo(),e!==null&&ae(va);break;case 24:Yi(sa)}}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[st]=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=$t));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[ot]=e,t[st]=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=Er(e),Dr(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&&mt(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(Ie&&typeof Ie.onCommitFiberUnmount==`function`)try{Ie.onCommitFiberUnmount(Fe,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[pt]||o[ot]||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[ot]=e,yt(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[ot]=e,yt(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{Gt(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=Ee()),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&&(Gt(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&&la(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&&la(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&&la(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:la(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=ta(sa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ta(sa).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:P.T===null?rt():yd()}function Su(){if(nu===0){if(!(Gl&536870912)||Pi){var e=Ue;Ue<<=1,!(Ue&3932160)&&(Ue=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)),Xe(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||qe(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-Ee(),10<a)){if(Du(r,t,nu,!Jl),Ke(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:$t},Pl(t,a,d);var m=(a&62914560)===a?su-Ee():(a&4194048)===a?cu-Ee():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(!xr(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-Re(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Qe(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,qi=Ki=null,ko(e),B=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=li(e.current,null),Gl=t,Kl=0,ql=null,Jl=!1,Yl=qe(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-Re(r),a=1<<i;t|=e[i],r&=~a}return Zl=t,$r(),n}function ju(e,t){uo=null,P.H=zs,t===Sa||t===wa?(t=Aa(),Kl=3):t===Ca?(t=Aa(),Kl=4):Kl=t===rc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,ql=t,Wl===null&&(Ql=1,Zs(e,_i(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=P.H;return P.H=zs,e===null?zs:e}function Pu(){var e=P.A;return P.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++,qi=Ki=null,Hl=r,P.H=i,P.A=a,Wl===null&&(Ul=null,Gl=0,$r()),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=Ee()+500,Au(e,t)):Yl=qe(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(Ea(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:Ea(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 qi=Ki=null,P.H=r,P.A=a,Hl=n,Wl===null?(Ul=null,Gl=0,$r(),Ql):0}function zu(){for(;Wl!==null&&!we();)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=ui(t,Zl),t=Nc(n,t,Zl)}e.memoizedProps=e.pendingProps,t===null?Uu(e):Wl=t}function Hu(e,t,n,r){qi=Ki=null,ko(t),B=null,Ma=0;var i=t.return;try{if(nc(e,i,t,n,Gl)){Ql=1,Zs(e,_i(n,e.current)),Wl=null;return}}catch(t){if(i!==null)throw Wl=i,t;Ql=1,Zs(e,_i(n,e.current)),Wl=null;return}t.flags&32768?(Pi||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|=Qr,Ze(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(Ae,function(){return Zu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=P.T,P.T=null,a=F.p,F.p=2,s=Hl,Hl|=4;try{sl(e,t,n)}finally{Hl=s,F.p=a,P.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=P.T,P.T=null;var r=F.p;F.p=2;var i=Hl;Hl|=4;try{bl(t,e);var a=Jd,o=Er(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Tr(s.ownerDocument.documentElement,s)){if(c!==null&&Dr(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 _=wr(s,h),v=wr(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,F.p=r,P.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=P.T,P.T=null;var r=F.p;F.p=2;var i=Hl;Hl|=4;try{cl(e,t.alternate,t)}finally{Hl=i,F.p=r,P.T=n}}fu=3}}function Ju(){if(fu===4||fu===3){fu=0,Te();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),nt(n),t=t.stateNode,Ie&&typeof Ie.onCommitFiberRoot==`function`)try{Ie.onCommitFiberRoot(Fe,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=P.T,i=F.p,F.p=2,P.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{P.T=t,F.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,la(t)))}function Xu(){return Ku(),qu(),Ju(),Zu()}function Zu(){if(fu!==5)return!1;var e=pu,t=gu;gu=0;var n=nt(hu),r=P.T,a=F.p;try{F.p=32>n?32:n,P.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),Ie&&typeof Ie.onPostCommitFiberRoot==`function`)try{Ie.onPostCommitFiberRoot(Fe,o)}catch{}return!0}finally{F.p=a,P.T=r,Yu(e,t)}}function Qu(e,t,n){t=_i(n,t),t=$s(e.stateNode,t,2),e=Ha(e,t,2),e!==null&&(Xe(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=_i(n,e),n=ec(2),r=Ha(t,n,2),r!==null&&(tc(n,r,t,e),Xe(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>Ee()-su?!(Hl&2)&&Au(e,0):tu|=n,ru===Gl&&(ru=0)),dd(e)}function nd(e,t){t===0&&(t=Je()),e=ni(e,t),e!==null&&(Xe(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 Se(e,t)}var U=null,od=null,sd=!1,cd=!1,ld=!1,ud=0;function dd(e){e!==od&&e.next===null&&(od===null?U=od=e:od=od.next=e),cd=!0,sd||(sd=!0,vd())}function fd(e,t){if(!ld&&cd){ld=!0;do for(var n=!1,r=U;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-Re(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=Ke(r,r===Ul?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||qe(r,a)||(n=!0,_d(r,a))}r=r.next}while(n);ld=!1}}function pd(){md()}function md(){cd=sd=!1;var e=0;ud!==0&&ef()&&(e=ud);for(var t=Ee(),n=null,r=U;r!==null;){var i=r.next,a=hd(r,t);a===0?(r.next=null,n===null?U=i:n.next=i,i===null&&(od=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-Re(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=R(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ul,n=Gl,n=Ke(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&&Ce(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||qe(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ce(r),nt(n)){case 2:case 8:n=ke;break;case 32:n=Ae;break;case 268435456:n=Me;break;default:n=Ae}return r=gd.bind(null,e),n=Se(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ce(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=Ke(e,e===Ul?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(wu(e,r,t),hd(e,Ee()),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?Se(Oe,pd):md()})}function yd(){if(ud===0){var e=fa;e===0&&(e=He,He<<=1,!(He&261888)&&(He=256)),ud=e}return ud}function bd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Qt(``+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[st]||null).action),o=r.submitter;o&&(t=(t=o[st]||null)?bd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new xn(`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<qr.length;Cd++){var wd=qr[Cd];Jr(wd.toLowerCase(),`on`+(wd[0].toUpperCase()+wd.slice(1)))}Jr(zr,`onAnimationEnd`),Jr(Br,`onAnimationIteration`),Jr(Vr,`onAnimationStart`),Jr(`dblclick`,`onDoubleClick`),Jr(`focusin`,`onFocus`),Jr(`focusout`,`onBlur`),Jr(Hr,`onTransitionRun`),Jr(Ur,`onTransitionStart`),Jr(Wr,`onTransitionCancel`),Jr(Gr,`onTransitionEnd`),Ct(`onMouseEnter`,[`mouseout`,`mouseover`]),Ct(`onMouseLeave`,[`mouseout`,`mouseover`]),Ct(`onPointerEnter`,[`pointerout`,`pointerover`]),Ct(`onPointerLeave`,[`pointerout`,`pointerover`]),St(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),St(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),St(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),St(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),St(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),St(`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 W(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){Yr(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){Yr(e)}i.currentTarget=null,a=c}}}}function Dd(e,t){var n=t[lt];n===void 0&&(n=t[lt]=new Set);var r=e+`__bubble`;n.has(r)||(jd(t,e,2,!1),n.add(r))}function Od(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,bt.forEach(function(t){t!==`selectionchange`&&(Ed.has(t)||Od(t,!1,e),Od(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[kd]||(t[kd]=!0,Od(`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,!un||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=ht(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}sn(function(){var r=a,i=tn(n),s=[];a:{var c=Kr.get(e);if(c!==void 0){var l=xn,u=e;switch(e){case`keypress`:if(gn(n)===0)break a;case`keydown`:case`keyup`:l=Rn;break;case`focusin`:u=`focus`,l=An;break;case`focusout`:u=`blur`,l=An;break;case`beforeblur`:case`afterblur`:l=An;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=On;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=kn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Bn;break;case zr:case Br:case Vr:l=jn;break;case Gr:l=Vn;break;case`scroll`:case`scrollend`:l=Cn;break;case`wheel`:l=Hn;break;case`copy`:case`cut`:case`paste`:l=Mn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=zn;break;case`toggle`:case`beforetoggle`:l=Un}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=cn(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!==en&&(u=n.relatedTarget||n.fromElement)&&(ht(u)||u[ct]))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?ht(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=On,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=zn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:_t(l),h=u==null?c:_t(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,ht(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?_t(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=lr;else if(rr(c)){if(ur)v=yr;else{v=_r;var y=gr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Yt(r.elementType)&&(v=lr):v=vr;if(v&&=v(e,r)){ir(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Vt(c,`number`,c.value)}switch(y=r?_t(r):window,e){case`focusin`:(rr(y)||y.contentEditable===`true`)&&(kr=y,Ar=r,jr=null);break;case`focusout`:jr=Ar=kr=null;break;case`mousedown`:Mr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Mr=!1,Nr(s,n,i);break;case`selectionchange`:if(Or)break;case`keydown`:case`keyup`:Nr(s,n,i)}var b;if(Gn)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 $n?Zn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Jn&&n.locale!==`ko`&&($n||x!==`onCompositionStart`?x===`onCompositionEnd`&&$n&&(b=hn()):(fn=i,pn=`value`in fn?fn.value:fn.textContent,$n=!0)),y=Pd(r,x),0<y.length&&(x=new Nn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Qn(n),b!==null&&(x.data=b)))),(b=qn?er(e,n):tr(e,n))&&(x=Pd(r,`onBeforeInput`),0<x.length&&(y=new Nn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),Sd(s,e,r,n,i)}W(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=cn(e,n),i!=null&&r.unshift(Nd(e,i,a)),i=cn(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=cn(n,a),l!=null&&o.unshift(Nd(n,l,c))):i||(l=cn(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===``||Gt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Gt(e,``+r);break;case`className`:kt(e,`class`,r);break;case`tabIndex`:kt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:kt(e,n,r);break;case`style`:Jt(e,r,o);break;case`data`:if(t!==`object`){kt(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=Qt(``+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=Qt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`onScroll`:r!=null&&Dd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Dd(`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=Qt(``+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`:Dd(`beforetoggle`,e),Dd(`toggle`,e),Ot(e,`popover`,r);break;case`xlinkActuate`:At(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:At(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:At(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:At(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:At(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:At(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ot(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=Xt.get(n)||n,Ot(e,n,r))}}function Hd(e,t,n,r,a,o){switch(n){case`style`:Jt(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`?Gt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Gt(e,``+r);break;case`onScroll`:r!=null&&Dd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Dd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!xt.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[st]||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,``):Ot(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`:Dd(`error`,e),Dd(`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`:Dd(`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)}}Bt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Dd(`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&&Ht(e,!!r,n,!0):Ht(e,!!r,t,!1);return;case`textarea`:for(s in Dd(`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)}Wt(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`:Dd(`beforetoggle`,e),Dd(`toggle`,e),Dd(`cancel`,e),Dd(`close`,e);break;case`iframe`:case`object`:Dd(`load`,e);break;case`video`:case`audio`:for(r=0;r<Td.length;r++)Dd(Td[r],e);break;case`image`:Dd(`error`,e),Dd(`load`,e);break;case`details`:Dd(`toggle`,e);break;case`embed`:case`source`:case`link`:Dd(`error`,e),Dd(`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(Yt(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)}}zt(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?Ht(e,!!n,n?[]:``,!1):Ht(e,!!n,t,!0)):Ht(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)}Ut(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(Yt(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[pt]||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),mt(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[pt])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]);mt(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=F.d;F.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=gt(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=Rt(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),yt(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="`+Rt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Rt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Rt(n.imageSizes)+`"]`)):i+=`[href="`+Rt(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),yt(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="`+Rt(r)+`"][href="`+Rt(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),yt(r),n.head.appendChild(r)}}}function Ff(e,t,n){Ef.S(e,t,n);var r=kf;if(r&&e){var i=vt(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`);yt(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=vt(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`),yt(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=vt(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`),yt(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=le.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=vt(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=vt(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=vt(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="`+Rt(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),yt(t),e.head.appendChild(t))}function Uf(e){return`[src="`+Rt(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~="`+Rt(n.href)+`"]`);if(r)return t.instance=r,yt(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`),yt(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,yt(o),o;r=Vf(n),(a=Cf.get(a))&&qf(r,a),o=(e.ownerDocument||e).createElement(`link`),yt(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,yt(a),a):(r=n,(a=Cf.get(o))&&(r=f({},n),Jf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),yt(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[pt]||a[ot]||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,yt(a);return}a=t.ownerDocument||t,r=Vf(r),(i=Cf.get(i))&&qf(r,i),a=a.createElement(`link`),yt(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:ne,_currentValue2:ne,_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=Ye(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ye(0),this.hiddenUpdates=Ye(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=si(3,null,null,t),e.current=a,a.stateNode=e,t=ca(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},za(a),e}function up(e){return e?(e=ai,e):ai}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=ni(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=tt(t);var n=ni(e,t);n!==null&&Cu(n,e,t),pp(e,t)}}var gp=!0;function _p(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=2,yp(e,t,n,r)}finally{F.p=a,P.T=i}}function vp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=8,yp(e,t,n,r)}finally{F.p=a,P.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=gt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ge(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Re(o);s.entanglements[1]|=c,o&=~c}dd(a),!(Hl&6)&&(lu=Ee()+500,fd(0,!1))}}break;case 31:case 13:s=ni(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=tn(e),Sp(e)}var xp=null;function Sp(e){if(xp=null,e=ht(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(De()){case Oe:return 2;case ke:return 8;case Ae:case je:return 32;case Me: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=gt(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=ht(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,it(e.priority,function(){hp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,it(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);en=r,n.target.dispatchEvent(r),en=null}else return t=gt(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=gt(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[st]||null;if(typeof a==`function`)o||Vp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[st]||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[ct]=null}};function Gp(e){this._internalRoot=e}Gp.prototype.unstable_scheduleHydration=function(e){if(e){var t=rt();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`));F.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:P,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jp.isDisabled&&Jp.supportsFiber)try{Fe=Jp.inject(qp),Ie=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[ct]=t.current,Ad(e),new Wp(t)}})),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=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=O()})),k=t(x()),A=t(D()),j=ee();function M(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 te={};function N(){return typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:te}var P=Object.assign,F=Object.getOwnPropertyDescriptor,ne=Object.defineProperty,re=Object.prototype,ie=[];Object.freeze(ie);var I={};Object.freeze(I);var ae=typeof Proxy<`u`,oe=Object.toString();function se(){ae||M(`Proxy not available`)}function ce(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var le=function(){};function L(e){return typeof e==`function`}function ue(e){switch(typeof e){case`string`:case`symbol`:case`number`:return!0}return!1}function de(e){return typeof e==`object`&&!!e}function fe(e){if(!de(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 pe(e){var t=e?.constructor;return t?t.name===`GeneratorFunction`||t.displayName===`GeneratorFunction`:!1}function me(e,t,n){ne(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function he(e,t,n){ne(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function ge(e,t){var n=`isMobX`+e;return t.prototype[n]=!0,function(e){return de(e)&&e[n]===!0}}function _e(e){return e!=null&&Object.prototype.toString.call(e)===`[object Map]`}function ve(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t);return Object.getPrototypeOf(n)===null}function ye(e){return e!=null&&Object.prototype.toString.call(e)===`[object Set]`}var be=Object.getOwnPropertySymbols!==void 0;function xe(e){var t=Object.keys(e);if(!be)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(t){return re.propertyIsEnumerable.call(e,t)})):t}var Se=typeof Reflect<`u`&&Reflect.ownKeys?Reflect.ownKeys:be?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Ce(e){return e===null?null:typeof e==`object`?``+e:e}function we(e,t){return re.hasOwnProperty.call(e,t)}var Te=Object.getOwnPropertyDescriptors||function(e){var t={};return Se(e).forEach(function(n){t[n]=F(e,n)}),t};function Ee(e,t){return!!(e&t)}function De(e,t,n){return n?e|=t:e&=~t,e}function Oe(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 ke(e,t,n){if(Le())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&Re(i,n.prototype),i}function Ae(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,Be(r.key),r)}}function je(e,t,n){return t&&Ae(e.prototype,t),n&&Ae(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Me(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=Ve(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 Ne(){return Ne=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},Ne.apply(null,arguments)}function Pe(e){return Pe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Pe(e)}function Fe(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Re(e,t)}function Ie(e){try{return Function.toString.call(e).indexOf(`[native code]`)!==-1}catch{return typeof e==`function`}}function Le(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Le=function(){return!!e})()}function Re(e,t){return Re=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Re(e,t)}function ze(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 Be(e){var t=ze(e,`string`);return typeof t==`symbol`?t:t+``}function Ve(e,t){if(e){if(typeof e==`string`)return Oe(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)?Oe(e,t):void 0}}function He(e){var t=typeof Map==`function`?new Map:void 0;return He=function(e){if(e===null||!Ie(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 ke(e,arguments,Pe(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Re(n,e)},He(e)}var Ue=Symbol(`mobx-stored-annotations`);function We(e){function t(t,n){if(qe(n))return e.decorate_20223_(t,n);Ge(t,n,e)}return Object.assign(t,e)}function Ge(e,t,n){we(e,Ue)||me(e,Ue,Ne({},e[Ue])),st(n)||(e[Ue][t]=n)}function Ke(e){return we(e,Ue)||me(e,Ue,Ne({},e[Ue])),e[Ue]}function qe(e){return typeof e==`object`&&typeof e.kind==`string`}var R=Symbol(`mobx administration`),Je=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_=yn.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 Un(this)},t.reportChanged=function(){Vn(),Wn(this),Hn()},t.toString=function(){return this.name_},je(e,[{key:`isBeingObserved`,get:function(){return Ee(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=De(this.flags_,e.isBeingObservedMask_,t)}},{key:`isPendingUnobservation`,get:function(){return Ee(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=De(this.flags_,e.isPendingUnobservationMask_,t)}},{key:`diffValue`,get:function(){return+!!Ee(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=De(this.flags_,e.diffValueMask_,t===1)}}])}();Je.isBeingObservedMask_=1,Je.isPendingUnobservationMask_=2,Je.diffValueMask_=4;var Ye=ge(`Atom`,Je);function Xe(e,t,n){t===void 0&&(t=le),n===void 0&&(n=le);var r=new Je(e);return t!==le&&Cr(r,t),n!==le&&wr(r,n),r}function Ze(e,t){return e===t}function Qe(e,t){return ca(e,t)}function $e(e,t){return ca(e,t,1)}function et(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e==1/t:e!==e&&t!==t}var tt={identity:Ze,structural:Qe,default:et,shallow:$e};function nt(e,t,n){return Kr(e)?e:Array.isArray(e)?Zt.array(e,{name:n}):fe(e)?Zt.object(e,void 0,{name:n}):_e(e)?Zt.map(e,{name:n}):ye(e)?Zt.set(e,{name:n}):typeof e==`function`&&!hr(e)&&!Br(e)?pe(e)?Rr(e):pr(n,e):e}function rt(e,t,n){if(e==null||Gi(e)||Di(e)||Mi(e)||Li(e))return e;if(Array.isArray(e))return Zt.array(e,{name:n,deep:!1});if(fe(e))return Zt.object(e,void 0,{name:n,deep:!1});if(_e(e))return Zt.map(e,{name:n,deep:!1});if(ye(e))return Zt.set(e,{name:n,deep:!1})}function it(e){return e}function at(e,t){return ca(e,t)?t:e}var ot=`override`;function st(e){return e.annotationType_===ot}function ct(e,t){return{annotationType_:e,options_:t,make_:lt,extend_:ut,decorate_20223_:dt}}function lt(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:hr(n.value)?1:(ne(r,t,pt(e,this,t,n,!1)),2)}function ut(e,t,n,r){var i=pt(e,this,t,n);return e.defineProperty_(t,i,r)}function dt(e,t){var n=t.kind,r=t.name,i=t.addInitializer,a=this,o=function(e){return cn(a.options_?.name??r.toString(),e,a.options_?.autoAction??!1)};if(n==`field`)return function(e){var t,n=e;return hr(n)||(n=o(n)),(t=a.options_)!=null&&t.bound&&(n=n.bind(this),n.isMobxAction=!0),n};if(n==`method`){var s;return hr(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}M(`Cannot apply '`+a.annotationType_+`' to '`+String(r)+`' (kind: `+n+`):`+(`
|
|
12
|
+
'`+a.annotationType_+`' can only be used on properties with a function value.`))}function ft(e,t,n,r){t.annotationType_,r.value}function pt(e,t,n,r,i){var a,o;i===void 0&&(i=z.safeDescriptors),ft(e,t,n,r);var s=r.value;return(a=t.options_)!=null&&a.bound&&(s=s.bind(e.proxy_??e.target_)),{value:cn(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 mt(e,t){return{annotationType_:e,options_:t,make_:ht,extend_:gt,decorate_20223_:_t}}function ht(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&&(!we(e.target_,t)||!Br(e.target_[t]))&&this.extend_(e,t,n,!1)===null?0:Br(n.value)?1:(ne(r,t,yt(e,this,t,n,!1,!1)),2)}function gt(e,t,n,r){var i=yt(e,this,t,n,this.options_?.bound);return e.defineProperty_(t,i,r)}function _t(e,t){var n,r=t.name,i=t.addInitializer;return Br(e)||(e=Rr(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 vt(e,t,n,r){t.annotationType_,r.value}function yt(e,t,n,r,i,a){a===void 0&&(a=z.safeDescriptors),vt(e,t,n,r);var o=r.value;return Br(o)||(o=Rr(o)),i&&(o=o.bind(e.proxy_??e.target_),o.isMobXFlow=!0),{value:o,configurable:!a||e.isPlainObject_,enumerable:!1,writable:!a}}function bt(e,t){return{annotationType_:e,options_:t,make_:xt,extend_:St,decorate_20223_:Ct}}function xt(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function St(e,t,n,r){return wt(e,this,t,n),e.defineComputedProperty_(t,Ne({},this.options_,{get:n.get,set:n.set}),r)}function Ct(e,t){var n=this,r=t.name,i=t.addInitializer,a;function o(t,i){var a=Ne({},n.options_,{get:e,context:t});return a.name||=`ObservableObject.`+r.toString(),new _n(a)}return i(function(){var t=Hi(this)[R],n=this,i=t.values_.get(r);i instanceof _n&&i.derivation!==e&&t.values_.delete(r),(t.lazyComputedKeys_??=new Map).set(r,function(){return o(n,t)})}),function(){var t=this[R],n=t.values_.get(r);if(n instanceof _n&&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 wt(e,t,n,r){t.annotationType_,r.get}function Tt(e,t){return{annotationType_:e,options_:t,make_:Et,extend_:Dt,decorate_20223_:Ot}}function Et(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function Dt(e,t,n,r){return kt(e,this,t,n),e.defineObservableProperty_(t,n.value,this.options_?.enhancer??nt,r)}function Ot(e,t){var n=this,r=t.kind,i=t.name;if(r!==`accessor`)return;function a(e,t){var r=Hi(e)[R];return(r.lazyObservableKeys_??=new Map).set(i,function(){return new hn(t,n.options_?.enhancer??nt,`ObservableObject.`+i.toString(),!1)}),r}return{get:function(){return(this[R]??a(this,e.get.call(this))).getObservablePropValue_(i)},set:function(e){return(this[R]??a(this,e)).setObservablePropValue_(i,e)},init:function(e){return a(this,e),e}}}function kt(e,t,n,r){t.annotationType_}var At=`true`,jt=Mt();function Mt(e){return{annotationType_:At,options_:e,make_:Nt,extend_:Pt,decorate_20223_:Ft}}function Nt(e,t,n,r){var i;if(n.get)return nn.make_(e,t,n,r);if(n.set){var a=hr(n.set)?n.set:cn(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:!z.safeDescriptors||e.isPlainObject_,set:a})===null?0:2:(ne(r,t,{configurable:!0,set:a}),2)}if(r!==e.target_&&typeof n.value==`function`){var o;if(pe(n.value)){var s;return((s=this.options_)!=null&&s.autoBind?Rr.bound:Rr).make_(e,t,n,r)}return((o=this.options_)!=null&&o.autoBind?pr.bound:pr).make_(e,t,n,r)}var c=this.options_?.deep===!1?Zt.ref:Zt;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 Pt(e,t,n,r){var i;return n.get?nn.extend_(e,t,n,r):n.set?e.defineProperty_(t,{configurable:!z.safeDescriptors||e.isPlainObject_,set:cn(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?Zt.ref:Zt).extend_(e,t,n,r))}function Ft(e,t){M(`'`+this.annotationType_+`' cannot be used as a decorator`)}var It=`observable`,Lt=`observable.ref`,Rt=`observable.shallow`,zt=`observable.struct`,Bt={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Bt);function Vt(e){return e||Bt}var Ht=Tt(It),Ut=Tt(Lt,{enhancer:it}),Wt=Tt(Rt,{enhancer:rt}),Gt=Tt(zt,{enhancer:at}),Kt=We(Ht);function qt(e){return e.deep===!0?nt:e.deep===!1?it:Yt(e.defaultDecorator)}function Jt(e){return e?e.defaultDecorator??Mt(e):void 0}function Yt(e){return e?e.options_?.enhancer??nt:nt}function Xt(e,t,n){if(qe(t))return Ht.decorate_20223_(e,t);if(ue(t)){Ge(e,t,Ht);return}return Kr(e)?e:fe(e)?Zt.object(e,t,n):Array.isArray(e)?Zt.array(e,t):_e(e)?Zt.map(e,t):ye(e)?Zt.set(e,t):typeof e==`object`&&e?e:Zt.box(e,t)}P(Xt,Kt);var Zt=P(Xt,{box:function(e,t){var n=Vt(t);return new hn(e,qt(n),n.name,!0,n.equals)},array:function(e,t){var n=Vt(t);return(z.useProxies===!1||n.proxy===!1?na:bi)(e,qt(n),n.name)},map:function(e,t){var n=Vt(t);return new ji(e,qt(n),n.name)},set:function(e,t){var n=Vt(t);return new Ii(e,qt(n),n.name)},object:function(e,t,n){return oa(function(){return Ar(z.useProxies===!1||n?.proxy===!1?Hi({},n):si({},n),e,t)})},ref:We(Ut),shallow:We(Wt),deep:Kt,struct:We(Gt)}),Qt=`computed`,$t=`computed.struct`,en=bt(Qt),tn=bt($t,{equals:tt.structural}),nn=function(e,t){if(qe(t))return en.decorate_20223_(e,t);if(ue(t))return Ge(e,t,en);if(fe(e))return We(bt(Qt,e));var n=fe(t)?t:{};return n.get=e,n.name||=e.name||``,new _n(n)};Object.assign(nn,en),nn.struct=We(tn);var rn=0,an=1,on=F(function(){},`name`)?.configurable??!1,sn={value:`action`,configurable:!0,writable:!1,enumerable:!1};function cn(e,t,n,r){n===void 0&&(n=!1);function i(){return ln(e,n,t,r||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},on&&(sn.value=e,ne(i,`name`,sn)),i}function ln(e,t,n,r,i){var a=un(e,t,r,i);try{return n.apply(r,i)}catch(e){throw a.error_=e,e}finally{dn(a)}}function un(e,t,n,r){var i=!1,a=0,o=z.trackingDerivation,s=!t||!o;Vn();var c=z.allowStateChanges;s&&(On(),c=pn(!0));var l=An(!0),u={runAsAction_:s,prevDerivation_:o,prevAllowStateChanges_:c,prevAllowStateReads_:l,notifySpy_:i,startTime_:a,actionId_:an++,parentActionId_:rn};return rn=u.actionId_,u}function dn(e){rn!==e.actionId_&&M(30),rn=e.parentActionId_,e.error_!==void 0&&(z.suppressReactionErrors=!0),mn(e.prevAllowStateChanges_),jn(e.prevAllowStateReads_),Hn(),e.runAsAction_&&kn(e.prevDerivation_),z.suppressReactionErrors=!1}function fn(e,t){var n=pn(e);try{return t()}finally{mn(n)}}function pn(e){var t=z.allowStateChanges;return z.allowStateChanges=e,t}function mn(e){z.allowStateChanges=e}var hn=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=tt.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}Fe(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!==z.UNCHANGED&&this.setNewValue_(e)},n.prepareNewValue_=function(e){if(ci(this)){var t=ui(this,{object:this,type:gi,newValue:e});if(!t)return z.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?z.UNCHANGED:e},n.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),di(this)&&pi(this,{type:gi,object:this,newValue:e,oldValue:t})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(e){return li(this,e)},n.observe_=function(e,t){return t&&e({observableKind:`value`,debugObjectName:this.name_,object:this,type:gi,newValue:this.value_,oldValue:void 0}),fi(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 Ce(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Je),gn=ge(`ObservableValue`,hn),_n=function(){function e(e){this.dependenciesState_=yn.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=yn.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new xn(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=bn.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||M(31),this.derivation=e.get,this.name_=e.name||`ComputedValue`,e.set&&(this.setter_=cn(`ComputedValue-setter`,e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?tt.structural:tt.default),this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){Kn(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&&M(32,this.name_,this.derivation),z.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)Cn(this)&&(this.warnAboutUntrackedRead_(),Vn(),this.value_=this.computeValue_(!1),Hn());else if(Un(this),Cn(this)){var e=z.trackingContext;this.keepAlive_&&!e&&(z.trackingContext=this),this.trackAndCompute()&&Gn(this),z.trackingContext=e}var t=this.value_;if(Sn(t))throw t.cause;return t},t.set=function(e){if(this.setter_){this.isRunningSetter&&M(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter=!1}}else M(34,this.name_)},t.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===yn.NOT_TRACKING_,n=this.computeValue_(!0),r=t||Sn(e)||Sn(n)||!this.equals_(e,n);return r&&(this.value_=n),r},t.computeValue_=function(e){this.isComputing=!0;var t=pn(!1),n;if(e)n=wn(this,this.derivation,this.scope_);else if(z.disableErrorBoundaries===!0)n=this.derivation.call(this.scope_);else try{n=this.derivation.call(this.scope_)}catch(e){n=new xn(e)}return mn(t),this.isComputing=!1,n},t.suspend_=function(){this.keepAlive_||(En(this),this.value_=void 0)},t.observe_=function(e,t){var n=this,r=!0,i=void 0;return gr(function(){var a=n.get();if(!r||t){var o=On();e({observableKind:`computed`,debugObjectName:n.name_,type:gi,object:n,newValue:a,oldValue:i}),kn(o)}r=!1,i=a})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+`[`+this.derivation.toString()+`]`},t.valueOf=function(){return Ce(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},je(e,[{key:`isComputing`,get:function(){return Ee(this.flags_,e.isComputingMask_)},set:function(t){this.flags_=De(this.flags_,e.isComputingMask_,t)}},{key:`isRunningSetter`,get:function(){return Ee(this.flags_,e.isRunningSetterMask_)},set:function(t){this.flags_=De(this.flags_,e.isRunningSetterMask_,t)}},{key:`isBeingObserved`,get:function(){return Ee(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=De(this.flags_,e.isBeingObservedMask_,t)}},{key:`isPendingUnobservation`,get:function(){return Ee(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=De(this.flags_,e.isPendingUnobservationMask_,t)}},{key:`diffValue`,get:function(){return+!!Ee(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=De(this.flags_,e.diffValueMask_,t===1)}}])}();_n.isComputingMask_=1,_n.isRunningSetterMask_=2,_n.isBeingObservedMask_=4,_n.isPendingUnobservationMask_=8,_n.diffValueMask_=16;var vn=ge(`ComputedValue`,_n),yn;(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_`})(yn||={});var bn;(function(e){e[e.NONE=0]=`NONE`,e[e.LOG=1]=`LOG`,e[e.BREAK=2]=`BREAK`})(bn||={});var xn=function(e){this.cause=void 0,this.cause=e};function Sn(e){return e instanceof xn}function Cn(e){switch(e.dependenciesState_){case yn.UP_TO_DATE_:return!1;case yn.NOT_TRACKING_:case yn.STALE_:return!0;case yn.POSSIBLY_STALE_:for(var t=An(!0),n=On(),r=e.observing_,i=r.length,a=0;a<i;a++){var o=r[a];if(vn(o)){if(z.disableErrorBoundaries)o.get();else try{o.get()}catch{return kn(n),jn(t),!0}if(e.dependenciesState_===yn.STALE_)return kn(n),jn(t),!0}}return Mn(e),kn(n),jn(t),!1}}function wn(e,t,n){var r=An(!0);Mn(e),e.newObserving_=Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++z.runId;var i=z.trackingDerivation;z.trackingDerivation=e,z.inBatch++;var a;if(z.disableErrorBoundaries===!0)a=t.call(n);else try{a=t.call(n)}catch(e){a=new xn(e)}return z.inBatch--,z.trackingDerivation=i,Tn(e),jn(r),a}function Tn(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=yn.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&&zn(c,e),c.diffValue=0}for(;i--;){var l=n[i];l.diffValue===1&&(l.diffValue=0,Rn(l,e))}r!==yn.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function En(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)zn(t[n],e);e.dependenciesState_=yn.NOT_TRACKING_}function Dn(e){var t=On();try{return e()}finally{kn(t)}}function On(){var e=z.trackingDerivation;return z.trackingDerivation=null,e}function kn(e){z.trackingDerivation=e}function An(e){var t=z.allowStateReads;return z.allowStateReads=e,t}function jn(e){z.allowStateReads=e}function Mn(e){if(e.dependenciesState_!==yn.UP_TO_DATE_){e.dependenciesState_=yn.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=yn.UP_TO_DATE_}}var Nn=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},Pn=!0,Fn=!1,z=function(){var e=N();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Pn=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Nn().version&&(Pn=!1),Pn?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Nn):(setTimeout(function(){Fn||M(35)},1),new Nn)}();function In(){if((z.pendingReactions.length||z.inBatch||z.isRunningReactions)&&M(36),Fn=!0,Pn){var e=N();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),z=new Nn}}function Ln(){return z}function Rn(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function zn(e,t){e.observers_.delete(t),e.observers_.size===0&&Bn(e)}function Bn(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,z.pendingUnobservations.push(e))}function Vn(){z.inBatch++}function Hn(){if(--z.inBatch===0){Xn();for(var e=z.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 _n&&n.suspend_())}z.pendingUnobservations=[]}}function Un(e){var t=z.trackingDerivation;return t===null?(e.observers_.size===0&&z.inBatch>0&&Bn(e),!1):(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&z.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved)}function Wn(e){e.lowestObserverState_!==yn.STALE_&&(e.lowestObserverState_=yn.STALE_,e.observers_.forEach(function(e){e.dependenciesState_===yn.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=yn.STALE_}))}function Gn(e){e.lowestObserverState_!==yn.STALE_&&(e.lowestObserverState_=yn.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===yn.POSSIBLY_STALE_?t.dependenciesState_=yn.STALE_:t.dependenciesState_===yn.UP_TO_DATE_&&(e.lowestObserverState_=yn.UP_TO_DATE_)}))}function Kn(e){e.lowestObserverState_===yn.UP_TO_DATE_&&(e.lowestObserverState_=yn.POSSIBLY_STALE_,e.observers_.forEach(function(e){e.dependenciesState_===yn.UP_TO_DATE_&&(e.dependenciesState_=yn.POSSIBLY_STALE_,e.onBecomeStale_())}))}var qn=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_=yn.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=bn.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,z.pendingReactions.push(this),Xn())},t.runReaction_=function(){if(!this.isDisposed){Vn(),this.isScheduled=!1;var e=z.trackingContext;if(z.trackingContext=this,Cn(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}z.trackingContext=e,Hn()}},t.track=function(e){if(!this.isDisposed){Vn(),this.isRunning=!0;var t=z.trackingContext;z.trackingContext=this;var n=wn(this,e,void 0);z.trackingContext=t,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&En(this),Sn(n)&&this.reportExceptionInDerivation_(n.cause),Hn()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_){this.errorHandler_(e,this);return}if(z.disableErrorBoundaries)throw e;var n=`[mobx] uncaught error in '`+this+`'`;z.suppressReactionErrors||console.error(n,e),z.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Vn(),En(this),Hn()))},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[R]=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)},je(e,[{key:`isDisposed`,get:function(){return Ee(this.flags_,e.isDisposedMask_)},set:function(t){this.flags_=De(this.flags_,e.isDisposedMask_,t)}},{key:`isScheduled`,get:function(){return Ee(this.flags_,e.isScheduledMask_)},set:function(t){this.flags_=De(this.flags_,e.isScheduledMask_,t)}},{key:`isTrackPending`,get:function(){return Ee(this.flags_,e.isTrackPendingMask_)},set:function(t){this.flags_=De(this.flags_,e.isTrackPendingMask_,t)}},{key:`isRunning`,get:function(){return Ee(this.flags_,e.isRunningMask_)},set:function(t){this.flags_=De(this.flags_,e.isRunningMask_,t)}},{key:`diffValue`,get:function(){return+!!Ee(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=De(this.flags_,e.diffValueMask_,t===1)}}])}();qn.isDisposedMask_=1,qn.isScheduledMask_=2,qn.isTrackPendingMask_=4,qn.isRunningMask_=8,qn.diffValueMask_=16;var Jn=100,Yn=function(e){return e()};function Xn(){z.inBatch>0||z.isRunningReactions||Yn(Zn)}function Zn(){z.isRunningReactions=!0;for(var e=z.pendingReactions,t=0;e.length>0;){++t===Jn&&(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_()}z.isRunningReactions=!1}var Qn=ge(`Reaction`,qn);function $n(e){var t=Yn;Yn=function(n){return e(function(){return t(n)})}}function er(){return!1}function tr(e){return console.warn(`[mobx.spy] Is a no-op in production builds`),function(){}}var nr=`action`,rr=`action.bound`,ir=`autoAction`,ar=`autoAction.bound`,or=`<unnamed action>`,sr=ct(nr),cr=ct(rr,{bound:!0}),lr=ct(ir,{autoAction:!0}),ur=ct(ar,{autoAction:!0,bound:!0});function dr(e){return function(t,n){if(L(t))return cn(t.name||or,t,e);if(L(n))return cn(t,n,e);if(qe(n))return(e?lr:sr).decorate_20223_(t,n);if(ue(n))return Ge(t,n,e?lr:sr);if(ue(t))return We(ct(e?ir:nr,{name:t,autoAction:e}))}}var fr=dr(!1);Object.assign(fr,sr);var pr=dr(!0);Object.assign(pr,lr),fr.bound=We(cr),pr.bound=We(ur);function mr(e){return ln(e.name||or,!1,e,this,void 0)}function hr(e){return L(e)&&e.isMobxAction===!0}function gr(e,t){var n;t===void 0&&(t=I);var r=t?.name??`Autorun`,i=!t.scheduler&&!t.delay,a;if(i)a=new qn(r,function(){this.track(c)},t.onError,t.requiresObservable);else{var o=vr(t),s=!1;a=new qn(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 _r=function(e){return e()};function vr(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:_r}function yr(e,t,n){var r;n===void 0&&(n=I);var i=n.name??`Reaction`,a=fr(i,n.onError?br(n.onError,t):t),o=!n.scheduler&&!n.delay,s=vr(n),c=!0,l=!1,u,d=n.compareStructural?tt.structural:n.equals||tt.default,f=new qn(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=fn(!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 br(e,t){return function(){try{return t.apply(this,arguments)}catch(t){e.call(this,t)}}}var xr=`onBO`,Sr=`onBUO`;function Cr(e,t,n){return Tr(xr,e,t,n)}function wr(e,t,n){return Tr(Sr,e,t,n)}function Tr(e,t,n,r){var i=typeof r==`function`?ra(t,n):ra(t),a=L(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 Er=`never`,Dr=`always`,Or=`observed`;function kr(e){e.isolateGlobalState===!0&&In();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(z.useProxies=t===Dr||t!==Er&&typeof Proxy<`u`),t===`ifavailable`&&(z.verifyProxies=!0),n!==void 0){var r=n===Dr?Dr:n===Or;z.enforceActions=r,z.allowStateChanges=r!==!0&&r!==Dr}[`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`disableErrorBoundaries`,`safeDescriptors`].forEach(function(t){t in e&&(z[t]=!!e[t])}),z.allowStateReads=!z.observableRequiresReaction,e.reactionScheduler&&$n(e.reactionScheduler)}function Ar(e,t,n,r){var i=Te(t);return oa(function(){var t=Hi(e,r)[R];Se(i).forEach(function(e){t.extend_(e,i[e],n&&e in n?n[e]:!0)})}),e}function jr(e,t){return Mr(ra(e,t))}function Mr(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=Nr(e.observing_).map(Mr)),t}function Nr(e){return Array.from(new Set(e))}var Pr=0,Fr=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}Fe(t,e);var n=t.prototype;return n.toString=function(){return`Error: `+this.message},t}(He(Error)),Ir=mt(`flow`),Lr=mt(`flow.bound`,{bound:!0}),Rr=Object.assign(function(e,t){if(qe(t))return Ir.decorate_20223_(e,t);if(ue(t))return Ge(e,t,Ir);var n=e,r=n.name||`<unnamed flow>`,i=function(){var e=this,t=arguments,i=++Pr,a=fr(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=fr(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=fr(r+` - runid: `+i+` - yield `+n++,a.throw).call(a,e)}catch(e){return t(e)}u(o)}function u(n){if(L(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=fr(r+` - runid: `+i+` - cancel`,function(){try{s&&zr(s);var e=a.return(void 0),t=Promise.resolve(e.value);t.then(le,le),zr(t),o(new Fr)}catch(e){o(e)}}),c};return i.isMobXFlow=!0,i},Ir);Rr.bound=We(Lr);function zr(e){L(e.cancel)&&e.cancel()}function Br(e){return e?.isMobXFlow===!0}function Vr(e,t,n){var r;return Mi(e)||Di(e)||gn(e)?r=ia(e):Gi(e)&&(r=ia(e,t)),r.dehancer=typeof t==`function`?t:n,function(){r.dehancer=void 0}}function Hr(e,t,n){return L(n)?Wr(e,t,n):Ur(e,t)}function Ur(e,t){return ia(e).intercept_(t)}function Wr(e,t,n){return ia(e,t).intercept_(n)}function Gr(e,t){if(!e)return!1;if(t!==void 0){if(Gi(e)){var n,r,i=e[R];return i.values_.has(t)||!!((n=i.lazyComputedKeys_)!=null&&n.has(t))||!!((r=i.lazyObservableKeys_)!=null&&r.has(t))}return!1}return Gi(e)||!!e[R]||Ye(e)||Qn(e)||vn(e)}function Kr(e){return Gr(e)}function qr(e){if(Gi(e))return e[R].keys_();if(Mi(e)||Li(e))return Array.from(e.keys());if(Di(e))return e.map(function(e,t){return t});M(5)}function Jr(e){if(Gi(e))return qr(e).map(function(t){return e[t]});if(Mi(e))return qr(e).map(function(t){return e.get(t)});if(Li(e))return Array.from(e.values());if(Di(e))return e.slice();M(6)}function Yr(e){if(Gi(e))return qr(e).map(function(t){return[t,e[t]]});if(Mi(e))return qr(e).map(function(t){return[t,e.get(t)]});if(Li(e))return Array.from(e.entries());if(Di(e))return e.map(function(e,t){return[t,e]});M(7)}function Xr(e,t,n){if(arguments.length===2&&!Li(e)){Vn();var r=t;try{for(var i in r)Xr(e,i,r[i])}finally{Hn()}return}Gi(e)?e[R].set_(t,n):Mi(e)?e.set(t,n):Li(e)?e.add(t):Di(e)?(typeof t!=`number`&&(t=parseInt(t,10)),t<0&&M(`Invalid index: '`+t+`'`),Vn(),t>=e.length&&(e.length=t+1),e[t]=n,Hn()):M(8)}function Zr(e,t,n){if(Gi(e))return e[R].defineProperty_(t,n);M(39)}function Qr(e,t,n,r){return L(n)?ei(e,t,n,r):$r(e,t,n)}function $r(e,t,n){return ia(e).observe_(t,n)}function ei(e,t,n,r){return ia(e,t).observe_(n,r)}function ti(e,t){t===void 0&&(t=void 0),Vn();try{return e.apply(t)}finally{Hn()}}function ni(e,t,n){return arguments.length===1||t&&typeof t==`object`?ii(e,t):ri(e,t,n||{})}function ri(e,t,n){var r;if(typeof n.timeout==`number`){var i=Error(`WHEN_TIMEOUT`);r=setTimeout(function(){if(!o[R].isDisposed){if(o(),n.onError)n.onError(i);else throw i}},n.timeout)}n.name=`When`;var a=cn(`When-effect`,t),o=gr(function(t){fn(!1,e)&&(t.dispose(),r&&clearTimeout(r),a())},n);return o}function ii(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=ri(e,n,Ne({},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 ai(e){return e[R]}var oi={has:function(e,t){return ai(e).has_(t)},get:function(e,t){return ai(e).get_(t)},set:function(e,t,n){return ue(t)?ai(e).set_(t,n,!0)??!0:!1},deleteProperty:function(e,t){return ue(t)?ai(e).delete_(t,!0)??!0:!1},defineProperty:function(e,t,n){return ai(e).defineProperty_(t,n)??!0},ownKeys:function(e){return ai(e).ownKeys_()},preventExtensions:function(e){M(13)}};function si(e,t){var n;return se(),e=Hi(e,t),(n=e[R]).proxy_??(n.proxy_=new Proxy(e,oi))}function ci(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function li(e,t){var n=e.interceptors_||=[];return n.push(t),ce(function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function ui(e,t){var n=On();try{for(var r=[].concat(e.interceptors_||[]),i=0,a=r.length;i<a&&(t=r[i](t),t&&!t.type&&M(14),t);i++);return t}finally{kn(n)}}function di(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function fi(e,t){var n=e.changeListeners_||=[];return n.push(t),ce(function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function pi(e,t){var n=On(),r=e.changeListeners_;if(r){r=r.slice();for(var i=0,a=r.length;i<a;i++)r[i](t);kn(n)}}function mi(e,t,n){return oa(function(){var r=Hi(e,n)[R];t??=Ke(e),Se(t).forEach(function(e){return r.make_(e,t[e])})}),e}var hi=`splice`,gi=`update`,_i=1e4,vi={get:function(e,t){var n=e[R];return t===R?n:t===`length`?n.getArrayLength_():typeof t==`string`&&!isNaN(t)?n.get_(parseInt(t)):we(xi,t)?xi[t]:e[t]},set:function(e,t,n){var r=e[R];return t===`length`&&r.setArrayLength_(n),typeof t==`symbol`||isNaN(t)?e[t]=n:r.set_(parseInt(t),n),!0},preventExtensions:function(){M(15)}},yi=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 Je(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 li(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}),fi(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){(typeof e!=`number`||isNaN(e)||e<0)&&M(`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_&&M(16),this.lastKnownLength_+=t,this.legacyMode_&&t>0&&ta(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=ie),ci(this)){var a=ui(this,{object:this.proxy_,type:hi,index:e,removedCount:t,added:n});if(!a)return ie;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<_i){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_&&er(),i=di(this),a=i||r?{observableKind:`array`,object:this.proxy_,type:gi,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;this.atom_.reportChanged(),i&&pi(this,a)},t.notifyArraySplice_=function(e,t,n){var r=!this.owned_&&er(),i=di(this),a=i||r?{observableKind:`array`,object:this.proxy_,debugObjectName:this.atom_.name_,type:hi,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;this.atom_.reportChanged(),i&&pi(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&&M(17,e,n.length),e<n.length){this.atom_;var r=n[e];if(ci(this)){var i=ui(this,{type:gi,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 bi(e,t,n,r){return n===void 0&&(n=`ObservableArray`),r===void 0&&(r=!1),se(),oa(function(){var i=new yi(n,t,r,!1);he(i.values_,R,i);var a=new Proxy(i.values_,vi);return i.proxy_=a,e&&e.length&&i.spliceWithArray_(0,0,e),a})}var xi={clear:function(){return this.splice(0)},replace:function(e){var t=this[R];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){var n=[...arguments].slice(2),r=this[R];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[R].spliceWithArray_(e,t,n)},push:function(){var e=this[R],t=[...arguments];return e.spliceWithArray_(e.values_.length,0,t),e.values_.length},pop:function(){return this.splice(Math.max(this[R].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){var e=this[R],t=[...arguments];return e.spliceWithArray_(0,0,t),e.values_.length},reverse:function(){return z.trackingDerivation&&M(37,`reverse`),this.replace(this.slice().reverse()),this},sort:function(){z.trackingDerivation&&M(37,`sort`);var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[R],n=t.dehanceValues_(t.values_).indexOf(e);return n>-1&&(this.splice(n,1),!0)}};Si(`at`,Ci),Si(`concat`,Ci),Si(`flat`,Ci),Si(`includes`,Ci),Si(`indexOf`,Ci),Si(`join`,Ci),Si(`lastIndexOf`,Ci),Si(`slice`,Ci),Si(`toString`,Ci),Si(`toLocaleString`,Ci),Si(`toSorted`,Ci),Si(`toSpliced`,Ci),Si(`with`,Ci),Si(`every`,wi),Si(`filter`,wi),Si(`find`,wi),Si(`findIndex`,wi),Si(`findLast`,wi),Si(`findLastIndex`,wi),Si(`flatMap`,wi),Si(`forEach`,wi),Si(`map`,wi),Si(`some`,wi),Si(`toReversed`,wi),Si(`reduce`,Ti),Si(`reduceRight`,Ti);function Si(e,t){typeof Array.prototype[e]==`function`&&(xi[e]=t(e))}function Ci(e){return function(){var t=this[R];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function wi(e){return function(t,n){var r=this,i=this[R];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e](function(e,i){return t.call(n,e,i,r)})}}function Ti(e){return function(){var t=this,n=this[R];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 Ei=ge(`ObservableArrayAdministration`,yi);function Di(e){return de(e)&&Ei(e[R])}var Oi={},ki=`add`,Ai=`delete`,ji=function(){function e(e,t,n){var r=this;t===void 0&&(t=nt),n===void 0&&(n=`ObservableMap`),this.enhancer_=void 0,this.name_=void 0,this[R]=Oi,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,L(Map)||M(18),oa(function(){r.keysAtom_=Xe(`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(!z.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new hn(this.has_(e),it,`ObservableMap.key?`,!1);this.hasMap_.set(e,r),wr(r,function(){return t.hasMap_.delete(e)})}return n.get()},t.set=function(e,t){var n=this.has_(e);if(ci(this)){var r=ui(this,{type:n?gi:ki,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_,ci(this)&&!ui(this,{type:Ai,object:this,name:e}))return!1;if(this.has_(e)){var n=er(),r=di(this),i=r||n?{observableKind:`map`,debugObjectName:this.name_,type:Ai,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return ti(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&&pi(this,i),!0}return!1},t.updateValue_=function(e,t){var n=this.data_.get(e);if(t=n.prepareNewValue_(t),t!==z.UNCHANGED){var r=er(),i=di(this),a=i||r?{observableKind:`map`,debugObjectName:this.name_,type:gi,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),i&&pi(this,a)}},t.addValue_=function(e,t){var n=this;this.keysAtom_,ti(function(){var r,i=new hn(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=er(),i=di(this),a=i||r?{observableKind:`map`,debugObjectName:this.name_,type:ki,object:this,name:e,newValue:t}:null;i&&pi(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 Ni({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 Ni({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=Me(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 Mi(e)&&(e=new Map(e)),ti(function(){fe(e)?xe(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)}):_e(e)?(ve(e)||M(19,e),e.forEach(function(e,n){return t.set(n,e)})):e!=null&&M(20,e)}),this},t.clear=function(){var e=this;ti(function(){Dn(function(){for(var t=Me(e.keys()),n;!(n=t()).done;){var r=n.value;e.delete(r)}})})},t.replace=function(e){var t=this;return ti(function(){for(var n=Pi(e),r=new Map,i=!1,a=Me(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=Me(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 fi(this,e)},t.intercept_=function(e){return li(this,e)},je(e,[{key:`size`,get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return`Map`}}])}(),Mi=ge(`ObservableMap`,ji);function Ni(e){return e[Symbol.toStringTag]=`MapIterator`,fa(e)}function Pi(e){if(_e(e)||Mi(e))return e;if(Array.isArray(e))return new Map(e);if(fe(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return M(21,e)}var Fi={},Ii=function(){function e(e,t,n){var r=this;t===void 0&&(t=nt),n===void 0&&(n=`ObservableSet`),this.name_=void 0,this[R]=Fi,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,L(Set)||M(22),this.enhancer_=function(e,r){return t(e,r,n)},oa(function(){r.atom_=Xe(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;ti(function(){Dn(function(){for(var t=Me(e.data_.values()),n;!(n=t()).done;){var r=n.value;e.delete(r)}})})},t.forEach=function(e,t){for(var n=Me(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_,ci(this)){var n=ui(this,{type:ki,object:this,newValue:e});if(!n)return this;e=n.newValue}if(!this.has(e)){ti(function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()});var r=di(this),i=r?{observableKind:`set`,debugObjectName:this.name_,type:ki,object:this,newValue:e}:null;r&&pi(this,i)}return this},t.delete=function(e){var t=this;if(ci(this)&&!ui(this,{type:Ai,object:this,oldValue:e}))return!1;if(this.has(e)){var n=di(this),r=n?{observableKind:`set`,debugObjectName:this.name_,type:Ai,object:this,oldValue:e}:null;return ti(function(){t.atom_.reportChanged(),t.data_.delete(e)}),n&&pi(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 Ri({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 Ri({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 ye(e)&&!Li(e)?e.intersection(this):new Set(this).intersection(e)},t.union=function(e){return ye(e)&&!Li(e)?e.union(this):new Set(this).union(e)},t.difference=function(e){return new Set(this).difference(e)},t.symmetricDifference=function(e){return ye(e)&&!Li(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 ye(e)&&!Li(e)?e.isDisjointFrom(this):new Set(this).isDisjointFrom(e)},t.replace=function(e){var t=this;return Li(e)&&(e=new Set(e)),ti(function(){Array.isArray(e)||ye(e)?(t.clear(),e.forEach(function(e){return t.add(e)})):e!=null&&M(`Cannot initialize set from `+e)}),this},t.observe_=function(e,t){return fi(this,e)},t.intercept_=function(e){return li(this,e)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return`[object ObservableSet]`},t[Symbol.iterator]=function(){return this.values()},je(e,[{key:`size`,get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return`Set`}}])}(),Li=ge(`ObservableSet`,Ii);function Ri(e){return e[Symbol.toStringTag]=`SetIterator`,fa(e)}var zi=Object.create(null),Bi=`remove`,Vi=function(){function e(e,t,n,r){t===void 0&&(t=new Map),r===void 0&&(r=jt),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 Je(`ObservableObject.keys`),this.isPlainObject_=fe(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 _n)return n.set(t),!0;if(ci(this)){var r=ui(this,{type:gi,object:this.proxy_||this.target_,name:e,newValue:t});if(!r)return null;t=r.newValue}if(t=n.prepareNewValue_(t),t!==z.UNCHANGED){var i=di(this),a=i?{type:gi,observableKind:`object`,debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),i&&pi(this,a)}return!0},t.get_=function(e){return z.trackingDerivation&&!we(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,n){return n===void 0&&(n=!1),we(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(!z.trackingDerivation)return e in this.target_;this.pendingKeys_||=new Map;var t=this.pendingKeys_.get(e);return t||(t=new hn(e in this.target_,it,`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_[Ue])!=null&&n[e])return;M(1,t.annotationType_,this.name_+`.`+e.toString())}for(var r=this.target_;r&&r!==re;){var i=F(r,e);if(i){var a=t.make_(this,e,i,r);if(a===0)return;if(a===1)break}r=Object.getPrototypeOf(r)}Ki(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&&Ki(this,n,e),i},t.defineProperty_=function(e,t,n){n===void 0&&(n=!1),this.keysAtom_;try{Vn();var r=this.delete_(e);if(!r)return r;if(ci(this)){var i=ui(this,{object:this.proxy_||this.target_,name:e,type:ki,newValue:t.value});if(!i)return null;var a=i.newValue;t.value!==a&&(t=Ne({},t,{value:a}))}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else ne(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{Hn()}return!0},t.defineObservableProperty_=function(e,t,n,r){r===void 0&&(r=!1),this.keysAtom_;try{Vn();var i=this.delete_(e);if(!i)return i;if(ci(this)){var a=ui(this,{object:this.proxy_||this.target_,name:e,type:ki,newValue:t});if(!a)return null;t=a.newValue}var o=Wi(e),s={configurable:!z.safeDescriptors||this.isPlainObject_,enumerable:!0,get:o.get,set:o.set};if(r){if(!Reflect.defineProperty(this.target_,e,s))return!1}else ne(this.target_,e,s);var c=new hn(t,n,`ObservableObject.key`,!1);this.values_.set(e,c),this.notifyPropertyAddition_(e,c.value_)}finally{Hn()}return!0},t.defineComputedProperty_=function(e,t,n){n===void 0&&(n=!1),this.keysAtom_;try{Vn();var r=this.delete_(e);if(!r)return r;if(ci(this)&&!ui(this,{object:this.proxy_||this.target_,name:e,type:ki,newValue:void 0}))return null;t.name||=`ObservableObject.key`,t.context=this.proxy_||this.target_;var i=Wi(e),a={configurable:!z.safeDescriptors||this.isPlainObject_,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.target_,e,a))return!1}else ne(this.target_,e,a);this.values_.set(e,new _n(t)),this.notifyPropertyAddition_(e,void 0)}finally{Hn()}return!0},t.delete_=function(e,t){if(t===void 0&&(t=!1),this.keysAtom_,!we(this.target_,e))return!0;if(ci(this)&&!ui(this,{object:this.proxy_||this.target_,name:e,type:Bi}))return null;try{var n;Vn();var r=di(this),i=this.values_.get(e),a=void 0;if(!i&&r&&(a=F(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 hn&&(a=i.value_),Wn(i)),this.keysAtom_.reportChanged(),(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(e in this.target_),r){var o={type:Bi,observableKind:`object`,object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:a,name:e};r&&pi(this,o)}}finally{Hn()}return!0},t.observe_=function(e,t){return fi(this,e)},t.intercept_=function(e){return li(this,e)},t.notifyPropertyAddition_=function(e,t){var n,r=di(this);if(r){var i=r?{type:ki,observableKind:`object`,debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;r&&pi(this,i)}(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Se(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Hi(e,t){if(we(e,R))return e;var n=t?.name??`ObservableObject`;return me(e,R,new Vi(e,new Map,String(n),Jt(t))),e}var Ui=ge(`ObservableObjectAdministration`,Vi);function Wi(e){return zi[e]||(zi[e]={get:function(){return this[R].getObservablePropValue_(e)},set:function(t){return this[R].setObservablePropValue_(e,t)}})}function Gi(e){return de(e)?Ui(e[R]):!1}function Ki(e,t,n){var r;(r=e.target_[Ue])==null||delete r[n]}var qi=$i(0),Ji=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Yi=0,Xi=function(){};function Zi(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__===void 0?e.prototype=t:e.prototype.__proto__=t}Zi(Xi,Array.prototype);var Qi=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,oa(function(){var e=new yi(r,n,i,!0);e.proxy_=a,he(a,R,e),t&&t.length&&a.spliceWithArray(0,0,t),Ji&&Object.defineProperty(a,"0",qi)}),a}Fe(t,e);var n=t.prototype;return n.concat=function(){this[R].atom_.reportObserved();var e=[...arguments];return Array.prototype.concat.apply(this.slice(),e.map(function(e){return Di(e)?e.slice():e}))},n[Symbol.iterator]=function(){var e=this,t=0;return fa({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},je(t,[{key:`length`,get:function(){return this[R].getArrayLength_()},set:function(e){this[R].setArrayLength_(e)}},{key:Symbol.toStringTag,get:function(){return`Array`}}])}(Xi);Object.entries(xi).forEach(function(e){var t=e[0],n=e[1];t!==`concat`&&me(Qi.prototype,t,n)});function $i(e){return{enumerable:!1,configurable:!0,get:function(){return this[R].get_(e)},set:function(t){this[R].set_(e,t)}}}function ea(e){ne(Qi.prototype,``+e,$i(e))}function ta(e){if(e>Yi){for(var t=Yi;t<e+100;t++)ea(t);Yi=e}}ta(1e3);function na(e,t,n){return new Qi(e,t,n)}function ra(e,t){if(typeof e==`object`&&e){if(Di(e))return t!==void 0&&M(23),e[R].atom_;if(Li(e))return e.atom_;if(Mi(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||M(25,t,aa(e)),n}if(Gi(e)){if(!t)return M(26);var r=e[R],i=r.values_.get(t)??r.materializeLazyComputed_(t)??r.materializeLazyObservable_(t);return i||M(27,t,aa(e)),i}if(Ye(e)||vn(e)||Qn(e))return e}else if(L(e)&&Qn(e[R]))return e[R];M(28)}function ia(e,t){if(e||M(29),t!==void 0)return ia(ra(e,t));if(Ye(e)||vn(e)||Qn(e)||Mi(e)||Li(e))return e;if(e[R])return e[R];M(24,e)}function aa(e,t){var n;if(t!==void 0)n=ra(e,t);else if(hr(e))return e.name;else n=Gi(e)||Mi(e)||Li(e)?ia(e):ra(e);return n.name_}function oa(e){var t=On(),n=pn(!0);Vn();try{return e()}finally{Hn(),mn(n),kn(t)}}var sa=re.toString;function ca(e,t,n){return n===void 0&&(n=-1),la(e,t,n)}function la(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=sa.call(e);if(o!==sa.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=ua(e),t=ua(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&&!(L(c)&&c instanceof c&&L(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(!la(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(!(we(t,m)&&la(e[m],t[m],n-1,r,i)))return!1}}return r.pop(),i.pop(),!0}function ua(e){return Di(e)?e.slice():_e(e)||Mi(e)||ye(e)||Li(e)?Array.from(e.entries()):e}var da=N().Iterator?.prototype||{};function fa(e){return e[Symbol.iterator]=pa,Object.assign(Object.create(da),e)}function pa(){return this}if([`Symbol`,`Map`,`Set`].forEach(function(e){N()[e]===void 0&&M(`MobX requires global '`+e+`' to be available or polyfilled`)}),typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__==`object`&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:tr,extras:{getDebugName:aa},$mobx:R}),!k.useState)throw Error(`mobx-react-lite requires React with Hooks support`);if(!mi)throw Error(`mobx-react-lite@3 requires mobx at least version 6 to be available`);var ma=T();function ha(e){e()}function ga(e){e||=ha,kr({reactionScheduler:e})}function _a(e){return jr(e)}var va=!1;function ya(){return va}var ba=1e4,xa=1e4,Sa=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=ba),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,xa))}}),e}(),Ca=new(typeof FinalizationRegistry<`u`?FinalizationRegistry:Sa)(function(e){var t;(t=e.reaction)==null||t.dispose(),e.reaction=null}),wa=n((e=>{var t=x();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})),Ta=n(((e,t)=>{t.exports=wa()}))();function Ea(e){e.reaction=new qn(`observer${e.name}`,function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)==null||t.call(e)})}function Da(e,t){if(t===void 0&&(t=`observed`),ya())return e();var n=k.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return Ca.unregister(r),r.onStoreChange=e,r.reaction||(Ea(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||(Ea(i),Ca.register(n,i,i)),k.useDebugValue(i.reaction,_a),(0,Ta.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 Oa=typeof Symbol==`function`&&Symbol.for,ka=Object.getOwnPropertyDescriptor(function(){},`name`)?.configurable??!1,Aa=Oa?Symbol.for(`react.forward_ref`):typeof k.forwardRef==`function`&&(0,k.forwardRef)(function(e){return null}).$$typeof,ja=Oa?Symbol.for(`react.memo`):typeof k.memo==`function`&&(0,k.memo)(function(e){return null}).$$typeof;function B(e,t){if(ja&&e.$$typeof===ja)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(ya())return e;var n=t?.forwardRef??!1,r=e,i=e.displayName||e.name;if(Aa&&e.$$typeof===Aa&&(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 Da(function(){return r(e,t)},i)};return a.displayName=e.displayName,ka&&Object.defineProperty(a,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(a.contextTypes=e.contextTypes),n&&(a=(0,k.forwardRef)(a)),a=(0,k.memo)(a),Na(e,a),a}var Ma={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function Na(e,t){Object.keys(e).forEach(function(n){Ma[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}function Pa(e,t){return(0,k.useState)(function(){return Zt(e(),t,{autoBind:!0})})[0]}ga(ma.unstable_batchedUpdates),Ca.finalizeAllImmediately;var Fa;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 Ia=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},La=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Fa=globalThis).__zod_globalConfig??(Fa.__zod_globalConfig={});var Ra=globalThis.__zod_globalConfig;function za(e){return e&&Object.assign(Ra,e),Ra}function Ba(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 Va(e,t){return typeof t==`bigint`?t.toString():t}function Ha(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ua(e){return e==null}function Wa(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ga(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 Ka=Symbol(`evaluating`);function qa(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ka)return r===void 0&&(r=Ka,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ja(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ya(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Xa(e){return JSON.stringify(e)}function Za(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Qa=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function $a(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var eo=Ha(()=>{if(Ra.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function to(e){if($a(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return $a(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function no(e){return to(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ro=new Set([`string`,`number`,`symbol`]);function io(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ao(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 oo(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var so={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function co(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 ao(e,Ya(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 Ja(this,`shape`,e),e},checks:[]}))}function lo(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 ao(e,Ya(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 Ja(this,`shape`,r),r},checks:[]}))}function uo(e,t){if(!to(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 ao(e,Ya(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ja(this,`shape`,n),n}}))}function fo(e,t){if(!to(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return ao(e,Ya(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ja(this,`shape`,n),n}}))}function po(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return ao(e,Ya(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ja(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function mo(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 ao(t,Ya(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 Ja(this,`shape`,i),i},checks:[]}))}function ho(e,t,n){return ao(t,Ya(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 Ja(this,`shape`,i),i}}))}function go(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 _o(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 vo(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function yo(e){return typeof e==`string`?e:e?.message}function bo(e,t,n){let r=e.message?e.message:yo(e.inst?._zod.def?.error?.(e))??yo(t?.error?.(e))??yo(n.customError?.(e))??yo(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 xo(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function So(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Co=(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,Va,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},wo=V(`$ZodError`,Co),To=V(`$ZodError`,Co,{Parent:Error});function Eo(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 Do(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 Oo=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 Ia;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>bo(e,a,za())));throw Qa(t,i?.callee),t}return o.value},ko=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=>bo(e,a,za())));throw Qa(t,i?.callee),t}return o.value},Ao=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 Ia;return a.issues.length?{success:!1,error:new(e??wo)(a.issues.map(e=>bo(e,i,za())))}:{success:!0,data:a.value}},jo=Ao(To),Mo=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=>bo(e,i,za())))}:{success:!0,data:a.value}},No=Mo(To),Po=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Oo(e)(t,n,i)},Fo=e=>(t,n,r)=>Oo(e)(t,n,r),Io=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ko(e)(t,n,i)},Lo=e=>async(t,n,r)=>ko(e)(t,n,r),Ro=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ao(e)(t,n,i)},zo=e=>(t,n,r)=>Ao(e)(t,n,r),Bo=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Mo(e)(t,n,i)},Vo=e=>async(t,n,r)=>Mo(e)(t,n,r),Ho=/^[cC][0-9a-z]{6,}$/,Uo=/^[0-9a-z]+$/,Wo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Go=/^[0-9a-vA-V]{20}$/,Ko=/^[A-Za-z0-9]{27}$/,qo=/^[a-zA-Z0-9_-]{21}$/,Jo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Yo=/^([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})$/,Xo=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)$/,Zo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Qo=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function $o(){return new RegExp(Qo,`u`)}var es=/^(?:(?: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])$/,ts=/^(([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}|:))$/,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])\/([0-9]|[1-2][0-9]|3[0-2])$/,rs=/^(([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])$/,is=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,as=/^[A-Za-z0-9_-]*$/,os=/^https?$/,ss=/^\+[1-9]\d{6,14}$/,cs=`(?:(?:\\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])))`,ls=RegExp(`^${cs}$`);function us(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 ds(e){return RegExp(`^${us(e)}$`)}function fs(e){let t=us({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(`^${cs}T(?:${r})$`)}var ps=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ms=/^-?\d+$/,hs=/^-?\d+(?:\.\d+)?$/,gs=/^(?:true|false)$/i,_s=/^[^A-Z]*$/,vs=/^[^a-z]*$/,ys=V(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),bs={number:`number`,bigint:`bigint`,object:`date`},xs=V(`$ZodCheckLessThan`,(e,t)=>{ys.init(e,t);let n=bs[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})}}),Ss=V(`$ZodCheckGreaterThan`,(e,t)=>{ys.init(e,t);let n=bs[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})}}),Cs=V(`$ZodCheckMultipleOf`,(e,t)=>{ys.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):Ga(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})}}),ws=V(`$ZodCheckNumberFormat`,(e,t)=>{ys.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=so[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=ms)}),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})}}),Ts=V(`$ZodCheckMaxLength`,(e,t)=>{var n;ys.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ua(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=xo(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Es=V(`$ZodCheckMinLength`,(e,t)=>{var n;ys.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ua(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=xo(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ds=V(`$ZodCheckLengthEquals`,(e,t)=>{var n;ys.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ua(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=xo(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})}}),Os=V(`$ZodCheckStringFormat`,(e,t)=>{var n,r;ys.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=()=>{})}),ks=V(`$ZodCheckRegex`,(e,t)=>{Os.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})}}),As=V(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=_s,Os.init(e,t)}),js=V(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=vs,Os.init(e,t)}),Ms=V(`$ZodCheckIncludes`,(e,t)=>{ys.init(e,t);let n=io(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})}}),Ns=V(`$ZodCheckStartsWith`,(e,t)=>{ys.init(e,t);let n=RegExp(`^${io(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})}}),Ps=V(`$ZodCheckEndsWith`,(e,t)=>{ys.init(e,t);let n=RegExp(`.*${io(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})}}),Fs=V(`$ZodCheckOverwrite`,(e,t)=>{ys.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Is=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
|
+
`))}},Ls={major:4,minor:4,patch:3},Rs=V(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ls;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=go(e),i;for(let a of t){if(a._zod.def.when){if(_o(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 Ia;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=go(e,t))});else{if(e.issues.length===t)continue;r||=go(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(go(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Ia;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 Ia;return o.then(e=>t(e,r,a))}return t(o,r,a)}}qa(e,`~standard`,()=>({validate:t=>{try{let n=jo(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return No(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),zs=V(`$ZodString`,(e,t)=>{Rs.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ps(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}}),Bs=V(`$ZodStringFormat`,(e,t)=>{Os.init(e,t),zs.init(e,t)}),Vs=V(`$ZodGUID`,(e,t)=>{t.pattern??=Yo,Bs.init(e,t)}),Hs=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??=Xo(e)}else t.pattern??=Xo();Bs.init(e,t)}),Us=V(`$ZodEmail`,(e,t)=>{t.pattern??=Zo,Bs.init(e,t)}),Ws=V(`$ZodURL`,(e,t)=>{Bs.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===os.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})}}}),Gs=V(`$ZodEmoji`,(e,t)=>{t.pattern??=$o(),Bs.init(e,t)}),Ks=V(`$ZodNanoID`,(e,t)=>{t.pattern??=qo,Bs.init(e,t)}),qs=V(`$ZodCUID`,(e,t)=>{t.pattern??=Ho,Bs.init(e,t)}),Js=V(`$ZodCUID2`,(e,t)=>{t.pattern??=Uo,Bs.init(e,t)}),Ys=V(`$ZodULID`,(e,t)=>{t.pattern??=Wo,Bs.init(e,t)}),Xs=V(`$ZodXID`,(e,t)=>{t.pattern??=Go,Bs.init(e,t)}),Zs=V(`$ZodKSUID`,(e,t)=>{t.pattern??=Ko,Bs.init(e,t)}),Qs=V(`$ZodISODateTime`,(e,t)=>{t.pattern??=fs(t),Bs.init(e,t)}),$s=V(`$ZodISODate`,(e,t)=>{t.pattern??=ls,Bs.init(e,t)}),ec=V(`$ZodISOTime`,(e,t)=>{t.pattern??=ds(t),Bs.init(e,t)}),tc=V(`$ZodISODuration`,(e,t)=>{t.pattern??=Jo,Bs.init(e,t)}),nc=V(`$ZodIPv4`,(e,t)=>{t.pattern??=es,Bs.init(e,t),e._zod.bag.format=`ipv4`}),rc=V(`$ZodIPv6`,(e,t)=>{t.pattern??=ts,Bs.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})}}}),ic=V(`$ZodCIDRv4`,(e,t)=>{t.pattern??=ns,Bs.init(e,t)}),ac=V(`$ZodCIDRv6`,(e,t)=>{t.pattern??=rs,Bs.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 oc(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var sc=V(`$ZodBase64`,(e,t)=>{t.pattern??=is,Bs.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{oc(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function cc(e){if(!as.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return oc(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var lc=V(`$ZodBase64URL`,(e,t)=>{t.pattern??=as,Bs.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{cc(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),uc=V(`$ZodE164`,(e,t)=>{t.pattern??=ss,Bs.init(e,t)});function dc(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 fc=V(`$ZodJWT`,(e,t)=>{Bs.init(e,t),e._zod.check=n=>{dc(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),pc=V(`$ZodNumber`,(e,t)=>{Rs.init(e,t),e._zod.pattern=e._zod.bag.pattern??hs,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}}),mc=V(`$ZodNumberFormat`,(e,t)=>{ws.init(e,t),pc.init(e,t)}),hc=V(`$ZodBoolean`,(e,t)=>{Rs.init(e,t),e._zod.pattern=gs,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}}),gc=V(`$ZodUnknown`,(e,t)=>{Rs.init(e,t),e._zod.parse=e=>e}),_c=V(`$ZodNever`,(e,t)=>{Rs.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function vc(e,t,n){e.issues.length&&t.issues.push(...vo(n,e.issues)),t.value[n]=e.value}var yc=V(`$ZodArray`,(e,t)=>{Rs.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=>vc(t,n,e))):vc(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function bc(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...vo(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 xc(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=oo(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Sc(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=>bc(e,n,i,t,u,d))):bc(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 Cc=V(`$ZodObject`,(e,t)=>{if(Rs.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=Ha(()=>xc(t));qa(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=$a,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=>bc(n,t,e,s,r,i))):bc(a,t,e,s,r,i)}return i?Sc(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),wc=V(`$ZodObjectJIT`,(e,t)=>{Cc.init(e,t);let n=e._zod.parse,r=Ha(()=>xc(t)),i=e=>{let t=new Is([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Xa(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=Xa(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=$a,s=!Ra.jitless,c=s&&eo.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?Sc([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Tc(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=>!go(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=>bo(e,r,za())))}),t)}var Ec=V(`$ZodUnion`,(e,t)=>{Rs.init(e,t),qa(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),qa(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),qa(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),qa(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=>Wa(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=>Tc(t,r,e,i)):Tc(o,r,e,i)}}),Dc=V(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Ec.init(e,t);let n=e._zod.parse;qa(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=Ha(()=>{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(!$a(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)}}),Oc=V(`$ZodIntersection`,(e,t)=>{Rs.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])=>Ac(e,t,n)):Ac(e,i,a)}});function kc(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(to(e)&&to(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=kc(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=kc(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 Ac(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}),go(e))return e;let o=kc(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var jc=V(`$ZodRecord`,(e,t)=>{Rs.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!to(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=>bo(e,r,za())),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(...vo(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...vo(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`&&hs.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=>bo(e,r,za())),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(...vo(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...vo(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Mc=V(`$ZodEnum`,(e,t)=>{Rs.init(e,t);let n=Ba(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ro.has(typeof e)).map(e=>typeof e==`string`?io(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}}),Nc=V(`$ZodLiteral`,(e,t)=>{if(Rs.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`?io(e):e?io(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}}),Pc=V(`$ZodTransform`,(e,t)=>{Rs.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new La(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 Ia;return n.value=i,n.fallback=!0,n}});function Fc(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Ic=V(`$ZodOptional`,(e,t)=>{Rs.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,qa(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),qa(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Wa(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=>Fc(e,r)):Fc(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Lc=V(`$ZodExactOptional`,(e,t)=>{Ic.init(e,t),qa(e._zod,`values`,()=>t.innerType._zod.values),qa(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Rc=V(`$ZodNullable`,(e,t)=>{Rs.init(e,t),qa(e._zod,`optin`,()=>t.innerType._zod.optin),qa(e._zod,`optout`,()=>t.innerType._zod.optout),qa(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Wa(e.source)}|null)$`):void 0}),qa(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)}),zc=V(`$ZodDefault`,(e,t)=>{Rs.init(e,t),e._zod.optin=`optional`,qa(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=>Bc(e,t)):Bc(r,t)}});function Bc(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Vc=V(`$ZodPrefault`,(e,t)=>{Rs.init(e,t),e._zod.optin=`optional`,qa(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))}),Hc=V(`$ZodNonOptional`,(e,t)=>{Rs.init(e,t),qa(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=>Uc(t,e)):Uc(i,e)}});function Uc(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 Wc=V(`$ZodCatch`,(e,t)=>{Rs.init(e,t),e._zod.optin=`optional`,qa(e._zod,`optout`,()=>t.innerType._zod.optout),qa(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=>bo(e,n,za()))},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=>bo(e,n,za()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Gc=V(`$ZodPipe`,(e,t)=>{Rs.init(e,t),qa(e._zod,`values`,()=>t.in._zod.values),qa(e._zod,`optin`,()=>t.in._zod.optin),qa(e._zod,`optout`,()=>t.out._zod.optout),qa(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=>Kc(e,t.in,n)):Kc(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Kc(e,t.out,n)):Kc(r,t.out,n)}});function Kc(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 qc=V(`$ZodReadonly`,(e,t)=>{Rs.init(e,t),qa(e._zod,`propValues`,()=>t.innerType._zod.propValues),qa(e._zod,`values`,()=>t.innerType._zod.values),qa(e._zod,`optin`,()=>t.innerType?._zod?.optin),qa(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(Jc):Jc(r)}});function Jc(e){return e.value=Object.freeze(e.value),e}var Yc=V(`$ZodLazy`,(e,t)=>{Rs.init(e,t),qa(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),qa(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),qa(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),qa(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),qa(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Xc=V(`$ZodCustom`,(e,t)=>{ys.init(e,t),Rs.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=>Zc(t,n,r,e));Zc(i,n,r,e)}});function Zc(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(So(e))}}var Qc,$c=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 el(){return new $c}(Qc=globalThis).__zod_globalRegistry??(Qc.__zod_globalRegistry=el());var tl=globalThis.__zod_globalRegistry;function nl(e,t){return new e({type:`string`,...H(t)})}function rl(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...H(t)})}function il(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...H(t)})}function al(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...H(t)})}function ol(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...H(t)})}function sl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...H(t)})}function cl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...H(t)})}function ll(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...H(t)})}function ul(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...H(t)})}function dl(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...H(t)})}function fl(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...H(t)})}function pl(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...H(t)})}function ml(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...H(t)})}function hl(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...H(t)})}function gl(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...H(t)})}function _l(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...H(t)})}function vl(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...H(t)})}function yl(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...H(t)})}function bl(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...H(t)})}function xl(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...H(t)})}function Sl(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...H(t)})}function Cl(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...H(t)})}function wl(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...H(t)})}function Tl(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...H(t)})}function El(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...H(t)})}function Dl(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...H(t)})}function Ol(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...H(t)})}function kl(e,t){return new e({type:`number`,checks:[],...H(t)})}function Al(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...H(t)})}function jl(e,t){return new e({type:`boolean`,...H(t)})}function Ml(e){return new e({type:`unknown`})}function Nl(e,t){return new e({type:`never`,...H(t)})}function Pl(e,t){return new xs({check:`less_than`,...H(t),value:e,inclusive:!1})}function Fl(e,t){return new xs({check:`less_than`,...H(t),value:e,inclusive:!0})}function Il(e,t){return new Ss({check:`greater_than`,...H(t),value:e,inclusive:!1})}function Ll(e,t){return new Ss({check:`greater_than`,...H(t),value:e,inclusive:!0})}function Rl(e,t){return new Cs({check:`multiple_of`,...H(t),value:e})}function zl(e,t){return new Ts({check:`max_length`,...H(t),maximum:e})}function Bl(e,t){return new Es({check:`min_length`,...H(t),minimum:e})}function Vl(e,t){return new Ds({check:`length_equals`,...H(t),length:e})}function Hl(e,t){return new ks({check:`string_format`,format:`regex`,...H(t),pattern:e})}function Ul(e){return new As({check:`string_format`,format:`lowercase`,...H(e)})}function Wl(e){return new js({check:`string_format`,format:`uppercase`,...H(e)})}function Gl(e,t){return new Ms({check:`string_format`,format:`includes`,...H(t),includes:e})}function Kl(e,t){return new Ns({check:`string_format`,format:`starts_with`,...H(t),prefix:e})}function ql(e,t){return new Ps({check:`string_format`,format:`ends_with`,...H(t),suffix:e})}function Jl(e){return new Fs({check:`overwrite`,tx:e})}function Yl(e){return Jl(t=>t.normalize(e))}function Xl(){return Jl(e=>e.trim())}function Zl(){return Jl(e=>e.toLowerCase())}function Ql(){return Jl(e=>e.toUpperCase())}function $l(){return Jl(e=>Za(e))}function eu(e,t,n){return new e({type:`array`,element:t,...H(n)})}function tu(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...H(n)})}function nu(e,t){let n=ru(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(So(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(So(r))}},e(t.value,t)),t);return n}function ru(e,t){let n=new ys({check:`custom`,...H(t)});return n._zod.check=e,n}function iu(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??tl,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 au(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,au(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`&&cu(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 ou(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 su(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:uu(t,`input`,e.processors),output:uu(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function cu(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 cu(r.element,n);if(r.type===`set`)return cu(r.valueType,n);if(r.type===`lazy`)return cu(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 cu(r.innerType,n);if(r.type===`intersection`)return cu(r.left,n)||cu(r.right,n);if(r.type===`record`||r.type===`map`)return cu(r.keyType,n)||cu(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:cu(r.in,n)||cu(r.out,n);if(r.type===`object`){for(let e in r.shape)if(cu(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(cu(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(cu(e,n))return!0;return!!(r.rest&&cu(r.rest,n))}return!1}var lu=(e,t={})=>n=>{let r=iu({...n,processors:t});return au(e,r),ou(r,e),su(r,e)},uu=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=iu({...i??{},target:a,io:t,processors:n});return au(e,o),ou(o,e),su(o,e)},du={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},fu=(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=du[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}))])}},pu=(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)},mu=(e,t,n,r)=>{n.type=`boolean`},hu=(e,t,n,r)=>{n.not={}},gu=(e,t,n,r)=>{let i=e._zod.def,a=Ba(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},_u=(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}},vu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},yu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},bu=(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=au(a.element,t,{...r,path:[...r.path,`items`]})},xu=(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]=au(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=au(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Su=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>au(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Cu=(e,t,n,r)=>{let i=e._zod.def,a=au(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=au(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]]},wu=(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=au(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=au(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=au(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)}},Tu=(e,t,n,r)=>{let i=e._zod.def,a=au(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`}]},Eu=(e,t,n,r)=>{let i=e._zod.def;au(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Du=(e,t,n,r)=>{let i=e._zod.def;au(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ou=(e,t,n,r)=>{let i=e._zod.def;au(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)))},ku=(e,t,n,r)=>{let i=e._zod.def;au(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},Au=(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;au(o,t,r);let s=t.seen.get(e);s.ref=o},ju=(e,t,n,r)=>{let i=e._zod.def;au(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Mu=(e,t,n,r)=>{let i=e._zod.def;au(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Nu=(e,t,n,r)=>{let i=e._zod.innerType;au(i,t,r);let a=t.seen.get(e);a.ref=i},Pu=V(`ZodISODateTime`,(e,t)=>{Qs.init(e,t),od.init(e,t)});function Fu(e){return Tl(Pu,e)}var Iu=V(`ZodISODate`,(e,t)=>{$s.init(e,t),od.init(e,t)});function Lu(e){return El(Iu,e)}var Ru=V(`ZodISOTime`,(e,t)=>{ec.init(e,t),od.init(e,t)});function zu(e){return Dl(Ru,e)}var Bu=V(`ZodISODuration`,(e,t)=>{tc.init(e,t),od.init(e,t)});function Vu(e){return Ol(Bu,e)}var Hu=V(`ZodError`,(e,t)=>{wo.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Do(e,t)},flatten:{value:t=>Eo(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Va,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Va,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Uu=Oo(Hu),Wu=ko(Hu),Gu=Ao(Hu),Ku=Mo(Hu),qu=Po(Hu),Ju=Fo(Hu),Yu=Io(Hu),Xu=Lo(Hu),Zu=Ro(Hu),Qu=zo(Hu),$u=Bo(Hu),ed=Vo(Hu),td=new WeakMap;function nd(e,t,n){let r=Object.getPrototypeOf(e),i=td.get(r);if(i||(i=new Set,td.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 rd=V(`ZodType`,(e,t)=>(Rs.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:uu(e,`input`),output:uu(e,`output`)}}),e.toJSONSchema=lu(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Uu(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Gu(e,t,n),e.parseAsync=async(t,n)=>Wu(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ku(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>qu(e,t,n),e.decode=(t,n)=>Ju(e,t,n),e.encodeAsync=async(t,n)=>Yu(e,t,n),e.decodeAsync=async(t,n)=>Xu(e,t,n),e.safeEncode=(t,n)=>Zu(e,t,n),e.safeDecode=(t,n)=>Qu(e,t,n),e.safeEncodeAsync=async(t,n)=>$u(e,t,n),e.safeDecodeAsync=async(t,n)=>ed(e,t,n),nd(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Ya(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 ao(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Sf(e,t))},superRefine(e,t){return this.check(Cf(e,t))},overwrite(e){return this.check(Jl(e))},optional(){return tf(this)},exactOptional(){return rf(this)},nullable(){return of(this)},nullish(){return tf(of(this))},nonoptional(e){return ff(this,e)},array(){return Id(this)},or(e){return Vd([this,e])},and(e){return Gd(this,e)},transform(e){return gf(this,$d(e))},default(e){return cf(this,e)},prefault(e){return uf(this,e)},catch(e){return mf(this,e)},pipe(e){return gf(this,e)},readonly(){return vf(this)},describe(e){let t=this.clone();return tl.add(t,{description:e}),t},meta(...e){if(e.length===0)return tl.get(this);let t=this.clone();return tl.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 tl.get(e)?.description},configurable:!0}),e)),id=V(`_ZodString`,(e,t)=>{zs.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fu(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,nd(e,`_ZodString`,{regex(...e){return this.check(Hl(...e))},includes(...e){return this.check(Gl(...e))},startsWith(...e){return this.check(Kl(...e))},endsWith(...e){return this.check(ql(...e))},min(...e){return this.check(Bl(...e))},max(...e){return this.check(zl(...e))},length(...e){return this.check(Vl(...e))},nonempty(...e){return this.check(Bl(1,...e))},lowercase(e){return this.check(Ul(e))},uppercase(e){return this.check(Wl(e))},trim(){return this.check(Xl())},normalize(...e){return this.check(Yl(...e))},toLowerCase(){return this.check(Zl())},toUpperCase(){return this.check(Ql())},slugify(){return this.check($l())}})}),ad=V(`ZodString`,(e,t)=>{zs.init(e,t),id.init(e,t),e.email=t=>e.check(rl(sd,t)),e.url=t=>e.check(ll(ud,t)),e.jwt=t=>e.check(wl(Td,t)),e.emoji=t=>e.check(ul(dd,t)),e.guid=t=>e.check(il(cd,t)),e.uuid=t=>e.check(al(ld,t)),e.uuidv4=t=>e.check(ol(ld,t)),e.uuidv6=t=>e.check(sl(ld,t)),e.uuidv7=t=>e.check(cl(ld,t)),e.nanoid=t=>e.check(dl(fd,t)),e.guid=t=>e.check(il(cd,t)),e.cuid=t=>e.check(fl(pd,t)),e.cuid2=t=>e.check(pl(md,t)),e.ulid=t=>e.check(ml(hd,t)),e.base64=t=>e.check(xl(Sd,t)),e.base64url=t=>e.check(Sl(Cd,t)),e.xid=t=>e.check(hl(gd,t)),e.ksuid=t=>e.check(gl(_d,t)),e.ipv4=t=>e.check(_l(vd,t)),e.ipv6=t=>e.check(vl(yd,t)),e.cidrv4=t=>e.check(yl(bd,t)),e.cidrv6=t=>e.check(bl(xd,t)),e.e164=t=>e.check(Cl(wd,t)),e.datetime=t=>e.check(Fu(t)),e.date=t=>e.check(Lu(t)),e.time=t=>e.check(zu(t)),e.duration=t=>e.check(Vu(t))});function U(e){return nl(ad,e)}var od=V(`ZodStringFormat`,(e,t)=>{Bs.init(e,t),id.init(e,t)}),sd=V(`ZodEmail`,(e,t)=>{Us.init(e,t),od.init(e,t)}),cd=V(`ZodGUID`,(e,t)=>{Vs.init(e,t),od.init(e,t)}),ld=V(`ZodUUID`,(e,t)=>{Hs.init(e,t),od.init(e,t)}),ud=V(`ZodURL`,(e,t)=>{Ws.init(e,t),od.init(e,t)}),dd=V(`ZodEmoji`,(e,t)=>{Gs.init(e,t),od.init(e,t)}),fd=V(`ZodNanoID`,(e,t)=>{Ks.init(e,t),od.init(e,t)}),pd=V(`ZodCUID`,(e,t)=>{qs.init(e,t),od.init(e,t)}),md=V(`ZodCUID2`,(e,t)=>{Js.init(e,t),od.init(e,t)}),hd=V(`ZodULID`,(e,t)=>{Ys.init(e,t),od.init(e,t)}),gd=V(`ZodXID`,(e,t)=>{Xs.init(e,t),od.init(e,t)}),_d=V(`ZodKSUID`,(e,t)=>{Zs.init(e,t),od.init(e,t)}),vd=V(`ZodIPv4`,(e,t)=>{nc.init(e,t),od.init(e,t)}),yd=V(`ZodIPv6`,(e,t)=>{rc.init(e,t),od.init(e,t)}),bd=V(`ZodCIDRv4`,(e,t)=>{ic.init(e,t),od.init(e,t)}),xd=V(`ZodCIDRv6`,(e,t)=>{ac.init(e,t),od.init(e,t)}),Sd=V(`ZodBase64`,(e,t)=>{sc.init(e,t),od.init(e,t)}),Cd=V(`ZodBase64URL`,(e,t)=>{lc.init(e,t),od.init(e,t)}),wd=V(`ZodE164`,(e,t)=>{uc.init(e,t),od.init(e,t)}),Td=V(`ZodJWT`,(e,t)=>{fc.init(e,t),od.init(e,t)}),Ed=V(`ZodNumber`,(e,t)=>{pc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pu(e,t,n,r),nd(e,`ZodNumber`,{gt(e,t){return this.check(Il(e,t))},gte(e,t){return this.check(Ll(e,t))},min(e,t){return this.check(Ll(e,t))},lt(e,t){return this.check(Pl(e,t))},lte(e,t){return this.check(Fl(e,t))},max(e,t){return this.check(Fl(e,t))},int(e){return this.check(Od(e))},safe(e){return this.check(Od(e))},positive(e){return this.check(Il(0,e))},nonnegative(e){return this.check(Ll(0,e))},negative(e){return this.check(Pl(0,e))},nonpositive(e){return this.check(Fl(0,e))},multipleOf(e,t){return this.check(Rl(e,t))},step(e,t){return this.check(Rl(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 kl(Ed,e)}var Dd=V(`ZodNumberFormat`,(e,t)=>{mc.init(e,t),Ed.init(e,t)});function Od(e){return Al(Dd,e)}var kd=V(`ZodBoolean`,(e,t)=>{hc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mu(e,t,n,r)});function Ad(e){return jl(kd,e)}var jd=V(`ZodUnknown`,(e,t)=>{gc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Md(){return Ml(jd)}var Nd=V(`ZodNever`,(e,t)=>{_c.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hu(e,t,n,r)});function Pd(e){return Nl(Nd,e)}var Fd=V(`ZodArray`,(e,t)=>{yc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bu(e,t,n,r),e.element=t.element,nd(e,`ZodArray`,{min(e,t){return this.check(Bl(e,t))},nonempty(e){return this.check(Bl(1,e))},max(e,t){return this.check(zl(e,t))},length(e,t){return this.check(Vl(e,t))},unwrap(){return this.element}})});function Id(e,t){return eu(Fd,e,t)}var Ld=V(`ZodObject`,(e,t)=>{wc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xu(e,t,n,r),qa(e,`shape`,()=>t.shape),nd(e,`ZodObject`,{keyof(){return Yd(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Md()})},loose(){return this.clone({...this._zod.def,catchall:Md()})},strict(){return this.clone({...this._zod.def,catchall:Pd()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return uo(this,e)},safeExtend(e){return fo(this,e)},merge(e){return po(this,e)},pick(e){return co(this,e)},omit(e){return lo(this,e)},partial(...e){return mo(ef,this,e[0])},required(...e){return ho(df,this,e[0])}})});function Rd(e,t){return new Ld({type:`object`,shape:e??{},...H(t)})}function zd(e,t){return new Ld({type:`object`,shape:e,catchall:Pd(),...H(t)})}var Bd=V(`ZodUnion`,(e,t)=>{Ec.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Su(e,t,n,r),e.options=t.options});function Vd(e,t){return new Bd({type:`union`,options:e,...H(t)})}var Hd=V(`ZodDiscriminatedUnion`,(e,t)=>{Bd.init(e,t),Dc.init(e,t)});function Ud(e,t,n){return new Hd({type:`union`,options:t,discriminator:e,...H(n)})}var Wd=V(`ZodIntersection`,(e,t)=>{Oc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cu(e,t,n,r)});function Gd(e,t){return new Wd({type:`intersection`,left:e,right:t})}var Kd=V(`ZodRecord`,(e,t)=>{jc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wu(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function qd(e,t,n){return!t||!t._zod?new Kd({type:`record`,keyType:U(),valueType:e,...H(t)}):new Kd({type:`record`,keyType:e,valueType:t,...H(n)})}var Jd=V(`ZodEnum`,(e,t)=>{Mc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gu(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 Jd({...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 Jd({...t,checks:[],...H(r),entries:i})}});function Yd(e,t){return new Jd({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...H(t)})}var Xd=V(`ZodLiteral`,(e,t)=>{Nc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_u(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 Zd(e,t){return new Xd({type:`literal`,values:Array.isArray(e)?e:[e],...H(t)})}var Qd=V(`ZodTransform`,(e,t)=>{Pc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yu(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new La(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(So(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(So(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 $d(e){return new Qd({type:`transform`,transform:e})}var ef=V(`ZodOptional`,(e,t)=>{Ic.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function tf(e){return new ef({type:`optional`,innerType:e})}var nf=V(`ZodExactOptional`,(e,t)=>{Lc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rf(e){return new nf({type:`optional`,innerType:e})}var af=V(`ZodNullable`,(e,t)=>{Rc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function of(e){return new af({type:`nullable`,innerType:e})}var sf=V(`ZodDefault`,(e,t)=>{zc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Du(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function cf(e,t){return new sf({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():no(t)}})}var lf=V(`ZodPrefault`,(e,t)=>{Vc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ou(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uf(e,t){return new lf({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():no(t)}})}var df=V(`ZodNonOptional`,(e,t)=>{Hc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ff(e,t){return new df({type:`nonoptional`,innerType:e,...H(t)})}var pf=V(`ZodCatch`,(e,t)=>{Wc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ku(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function mf(e,t){return new pf({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var hf=V(`ZodPipe`,(e,t)=>{Gc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Au(e,t,n,r),e.in=t.in,e.out=t.out});function gf(e,t){return new hf({type:`pipe`,in:e,out:t})}var _f=V(`ZodReadonly`,(e,t)=>{qc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ju(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vf(e){return new _f({type:`readonly`,innerType:e})}var yf=V(`ZodLazy`,(e,t)=>{Yc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nu(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function bf(e){return new yf({type:`lazy`,getter:e})}var xf=V(`ZodCustom`,(e,t)=>{Xc.init(e,t),rd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vu(e,t,n,r)});function Sf(e,t={}){return tu(xf,e,t)}function Cf(e,t){return nu(e,t)}function wf(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 Tf=C(),Ef=[`fontSize`,`fontFamily`,`fontWeight`,`fontStyle`,`textDecoration`,`textTransform`,`fill`,`align`,`verticalAlign`,`lineHeight`,`letterSpacing`,`strokeWidth`,`stroke`,`cellBackground`,`cellPadding`],Df=e=>(e.cells||[]).map(t=>{if(!t)return t;let n={...t};for(let t of Ef)n[t]===void 0&&(n[t]=e[t]);return n}),Of=(e,t,n)=>{let r=e.borders?.[n];return{width:r?.width??t.borderWidth,style:r?.style??t.borderStyle,color:r?.color??t.borderColor}},kf=(e,t)=>{let n=e.rowSpan||1,r=e.colSpan||1,i=(n,r)=>{let i=Of(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)}},Af={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},jf=e=>e!=null&&e<1?1:e,Mf=[`text`,`image`,`svg`,`line`,`figure`,`gif`,`video`,`table`,`group`];function Nf(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:Ad().default(!0).describe(`Whether the animation is enabled.`),type:Yd([`enter`,`exit`,`loop`]).describe(`Animation phase.`),name:U().default(`none`).describe(`Animation name identifier.`),data:Md().default({}).describe(`Animation-specific data.`)}),n=qd(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:Md().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:Id(t).default([]).describe(`Animation configurations.`),blurEnabled:Ad().default(!1).describe(`Whether blur effect is enabled.`),blurRadius:W().default(10).describe(`Blur radius in pixels.`),brightnessEnabled:Ad().default(!1).describe(`Whether brightness effect is enabled.`),brightness:W().default(0).describe(`Brightness level (-1 to 1).`),sepiaEnabled:Ad().default(!1).describe(`Whether sepia effect is enabled.`),grayscaleEnabled:Ad().default(!1).describe(`Whether grayscale effect is enabled.`),filters:n.default({}),shadowEnabled:Ad().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:Ad().default(!0).describe(`Whether the element is visible.`),draggable:Ad().default(!0).describe(`Whether the element can be dragged.`),resizable:Ad().default(!0).describe(`Whether the element can be resized.`),selectable:Ad().default(!0).describe(`Whether the element can be selected.`),removable:Ad().default(!0).describe(`Whether the element can be removed.`),contentEditable:Ad().default(!0).describe(`Whether the element content can be edited.`),styleEditable:Ad().default(!0).describe(`Whether the element style can be edited.`),alwaysOnTop:Ad().default(!1).describe(`Whether the element stays on top of others.`),showInExport:Ad().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:Ad().default(!1).describe(`Whether the image is flipped horizontally.`),flipY:Ad().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:Ad().default(!1).describe(`Whether to maintain aspect ratio when resizing.`),stretchEnabled:Ad().default(!1).describe(`Whether stretch mode is enabled.`)},a={...r,type:Zd(`text`),text:U().default(``).describe(`Visible text shown on canvas.`),placeholder:U().default(``).describe(`Placeholder text shown when empty.`),fontSize:W().overwrite(jf).default(Af.fontSize).describe(`Font size in pixels (minimum 1).`),fontFamily:U().default(Af.fontFamily).describe(`Font family name.`),fontStyle:U().default(Af.fontStyle).describe(`Font style: 'normal' or 'italic'.`),fontWeight:U().default(Af.fontWeight).describe(`Font weight: 'normal', 'bold', or numeric string.`),textDecoration:U().default(Af.textDecoration).describe(`Text decoration (e.g. underline, line-through).`),textTransform:U().default(Af.textTransform).describe(`Text transform: uppercase, lowercase, capitalize, none.`),fill:U().default(Af.fill).describe(`Text color.`),align:U().default(Af.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(Af.strokeWidth).describe(`Stroke width in pixels.`),stroke:U().default(Af.stroke).describe(`Stroke color.`),strokeLineJoin:U().default(Af.strokeLineJoin).describe(`Stroke corner join: round, miter, bevel.`),lineHeight:Vd([W(),U()]).default(Af.lineHeight).describe(`Line height multiplier or 'auto'.`),letterSpacing:W().default(Af.letterSpacing).describe(`Letter spacing as a fraction of font size.`),backgroundEnabled:Ad().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:Ad().default(Af.curveEnabled).describe(`Whether the text curve effect is enabled.`),curvePower:W().default(Af.curvePower).describe(`Text curve power (-1 to 1, 0 = straight).`),legacyBackground:Ad().optional().describe(`Internal compatibility flag stamped by the v2→v3 migration.`)},o={...r,...i,type:Zd(`image`)},s={...r,type:Zd(`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:Ad().default(!0).describe(`Whether to maintain aspect ratio when resizing.`),stretchEnabled:Ad().default(!0),flipX:Ad().default(!1),flipY:Ad().default(!1),width:W().default(100),height:W().default(100),borderColor:U().default(`black`),borderSize:W().default(0),cornerRadius:W().default(0),colorsReplace:qd(U(),U()).default({}).describe(`Color replacement mappings (original → replacement).`)},c={...r,type:Zd(`line`),width:W().default(400),height:W().default(10),color:U().default(`black`).describe(`Line color.`),dash:Id(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:Zd(`figure`),subType:U().default(`rect`).describe(`Figure subtype: rect, ellipse, triangle, etc.`),fill:U().default(`rgb(0, 161, 255)`).describe(`Fill color.`),dash:Id(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:Zd(`gif`),duration:W().default(0).describe(`GIF duration in milliseconds.`),keepRatio:Ad().default(!0)},d={...r,...i,type:Zd(`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:Yd([`solid`,`dashed`,`dotted`,`none`]).optional().describe(`Border style for this side.`)}),p=e({id:U().describe(`Unique identifier for the cell.`),type:Zd(`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:Md().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(jf).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:Vd([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:Zd(`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:Id(W()).default([]).describe(`Column width fractions (sum to 1).`),rowHeights:Id(W()).default([]).describe(`Row height fractions (sum to 1).`),cells:Id(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:Yd([`solid`,`dashed`,`dotted`,`none`]).default(`solid`).describe(`Default border style.`),fontSize:W().overwrite(jf).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:Vd([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.`)},ee=e=>({id:U(),type:Zd(`group`),name:U().default(``),custom:Md().optional(),opacity:W().default(1),visible:Ad().default(!0),selectable:Ad().default(!0),removable:Ad().default(!0),alwaysOnTop:Ad().default(!1),showInExport:Ad().default(!0),animations:Id(t).default([]),children:Id(e).default([]).describe(`Child elements in this group.`)}),k=bf(()=>Ud(`type`,[e(a),e(o),e(s),e(c),e(l),e(u),e(d),e(O),e(ee(k))])),A={fontFamily:U().describe(`Font family name.`),url:U().default(``).describe(`URL to load the font from (single-variant fonts).`),styles:Id(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:Md().optional()},M=e({id:U().describe(`Unique identifier for the page.`),width:Vd([W(),Zd(`auto`)]).default(`auto`).describe(`Page width in pixels or 'auto'.`),height:Vd([W(),Zd(`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:Md().optional(),duration:W().default(5e3).describe(`Page duration in milliseconds.`),children:Id(k).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:Yd([`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:Md().optional().describe(`Custom data attached to the design.`),fonts:Id(e(A)).default([]).describe(`Fonts used in the design.`),pages:Id(M).default([]).describe(`Pages in the design.`),audios:Id(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:A,audio:j}}}var Pf=Nf(Rd),Ff=Pf.design,If=Nf(zd).design;Rd(Pf.shapes.text),Rd(Pf.shapes.image),Rd(Pf.shapes.svg),Rd(Pf.shapes.line),Rd(Pf.shapes.figure),Rd(Pf.shapes.gif),Rd(Pf.shapes.video),Rd(Pf.shapes.table),Rd(Pf.shapes.font),Rd(Pf.shapes.audio);function Lf(e){return e.map(e=>({path:e.path.map(String).join(`.`),message:e.message}))}var Rf=new Set([`custom`,`data`]),zf=new Set([`filters`,`colorsReplace`]);function Bf(e){if(Array.isArray(e))return e.filter(e=>e!=null).map(Bf);if(e&&typeof e==`object`){let t={};for(let n of Object.keys(e)){let r=e[n];r!=null&&(t[n]=Rf.has(n)?JSON.parse(JSON.stringify(r)):zf.has(n)&&Array.isArray(r)?{}:Bf(r))}return t}return e}function Vf(e){throw wf(`DESIGN_INVALID`,`Invalid Polotno design:\n${e.slice(0,10).map(e=>` ${e.path}: ${e.message}`).join(`
|
|
76
|
+
`)}`,{errors:e})}function Hf(e,t={}){let n=(t.mode===`canonical`?If:Ff).safeParse(Bf(e));return n.success||Vf(Lf(n.error.issues)),n.data}var Uf=[`warm`,`cold`,`natural`],Wf=/<\/?(?:p|br|span|strong|em|ol|ul|li)\b[^>]*>/i;function Gf(e){let t=!1;return Kf(e,e=>{t||e.type!==`text`||Wf.test(String(e.text??``))&&(t=!0)}),t}function Kf(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 qf(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&&Kf(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:Af.fontSize;n!==0&&(e.letterSpacing=t*16/n)}),a<2&&Kf(i.pages,e=>{if(e.filters)for(let t of Object.keys(e.filters)){if(Uf.includes(t))continue;let n=e.filters[t];n&&typeof n.intensity==`number`&&(n.intensity/=100)}}),a<3&&n&&(r===void 0?Gf(i.pages):!r)&&Kf(i.pages,e=>{e.type===`text`&&e.backgroundEnabled&&(e.legacyBackground=!0)}),i.schemaVersion=4,i}function Jf(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 Yf=new Set(Mf);function Xf(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`&&Yf.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 Zf(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 Qf(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(!Yf.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 $f(e,t={}){let n=e,r=qf(e),i=(t.preserveClientData||t.fillMissingIds)&&r&&typeof r==`object`,a=[];i&&(t.fillMissingIds&&Jf(r),t.preserveClientData&&(a=Xf(r)));let o=Hf(r,t);if(i&&t.preserveClientData&&(a.length&&Zf(o,a),Qf(n,o)),t.requirePages&&o.pages.length===0)throw wf(`DESIGN_INVALID`,"Invalid Polotno design: no pages — did you pass `store.toJSON()`?",{errors:[{path:`pages`,message:`no pages`}]});return o}function ep(e){let t=e.bleed||0;return{top:e.bleedTop??t,right:e.bleedRight??t,bottom:e.bleedBottom??t,left:e.bleedLeft??t}}var tp=Object.freeze({top:0,right:0,bottom:0,left:0}),np=u,rp=n(((e,t)=>{t.exports=function(e){function t(e,t,n,r){return new ga(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 La: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 Ia: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 S(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function w(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&&T(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function T(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 ee(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function k(e){if(typeof Pc==`function`&&Fc(e),Lc&&typeof Lc.setStrictMode==`function`)try{Lc.setStrictMode(Ic,e)}catch{}}function A(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 te(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 N(e){try{var t=``,n=null;do t+=te(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
82
|
+
Error generating stack: `+e.message+`
|
|
83
|
+
`+e.stack}}function P(e,t){if(typeof e==`object`&&e){var n=Wc.get(e);return n===void 0?(t={value:e,source:t,stack:N(t)},Wc.set(e,t),t):n}return{value:e,source:t,stack:N(t)}}function F(e,t){Gc[Kc++]=Jc,Gc[Kc++]=qc,qc=e,Jc=t}function ne(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 re(e){e.return!==null&&(F(e,1),ne(e,1,0))}function ie(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 I(e,t){Yc[Xc++]=Qc,Yc[Xc++]=$c,Yc[Xc++]=Zc,Qc=t.id,$c=t.overflow,Zc=e}function ae(e,t){p(nl,t),p(tl,e),p(el,null),e=ro(t),f(el),p(el,e)}function oe(){f(el),f(tl),f(nl)}function se(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 ce(e){tl.current===e&&(f(el),f(tl)),rl.current===e&&(f(rl),ho?Po._currentValue=No:Po._currentValue2=No)}function le(e){throw me(P(Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ll}function L(e,t){if(!vo)throw Error(r(175));js(e.stateNode,e.type,e.memoizedProps,t,e)||le(e,!0)}function ue(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 de(e){if(!vo||e!==il)return!1;if(!ol)return ue(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&&le(e):t!==3&&(t!==5||qs(e.type)&&!lo(e.type,e.memoizedProps))&&al&&le(e),ue(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 fe(){vo&&(al=il=null,ol=!1)}function pe(){var e=sl;return e!==null&&(qu===null?qu=e:qu.push.apply(qu,e),sl=null),e}function me(e){sl===null?sl=[e]:sl.push(e)}function he(e,t,n){ho?(p(ul,t._currentValue),t._currentValue=n):(p(ul,t._currentValue2),t._currentValue2=n)}function ge(e){var t=ul.current;ho?e._currentValue=t:e._currentValue2=t,f(ul)}function _e(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 ve(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),_e(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),_e(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 ye(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&&ve(t,e,n,i),t.flags|=262144}function be(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 xe(e){dl=e,fl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Se(e){return we(dl,e)}function Ce(e,t){return dl===null&&xe(e),we(e,t)}function we(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 Te(){return{controller:new pl,data:new Map,refCount:0}}function Ee(e){e.refCount--,e.refCount===0&&ml(hl,function(){e.controller.abort()})}function De(){}function Oe(e){e!==vl&&e.next===null&&(vl===null?_l=vl=e:vl=vl.next=e),bl=!0,yl||(yl=!0,Fe())}function ke(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,Pe(r,a))}else a=Nu,a=g(r,r===ju?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==mo),!(a&3)||_(r,a)||(n=!0,Pe(r,a))}r=r.next}while(n);xl=!1}}function Ae(){je()}function je(){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=Me(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||ke(e,!1),Sl!==0&&(Sl=0)}function Me(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),ee(n)){case 2:case 8:n=jc;break;case 32:n=Mc;break;case 268435456:n=Nc;break;default:n=Mc}return r=Ne.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 Ne(e,t){if(ed!==0&&ed!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(oa()&&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:(Pi(e,r,t),Me(e,kc()),e.callbackNode!=null&&e.callbackNode===n?Ne.bind(null,e):null)}function Pe(e,t){if(oa())return null;Pi(e,t,!0)}function Fe(){Io?Lo(function(){Au&6?Tc(Ac,Ae):je()}):Tc(Ac,Ae)}function Ie(){if(Sl===0){var e=Tl;e===0&&(e=Sc,Sc<<=1,!(Sc&261888)&&(Sc=256)),Sl=e}return Sl}function Le(e,t){if(Cl===null){var n=Cl=[];wl=0,Tl=Ie(),El={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return wl++,t.then(Re,Re),t}function Re(){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 ze(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 Be(){var e=Ol.current;return e===null?ju.pooledCache:e}function Ve(e,t){t===null?p(Ol,Ol.current):p(Ol,t.pool)}function He(){var e=Be();return e===null?null:{parent:ho?gl._currentValue:gl._currentValue2,pool:e}}function Ue(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 We(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ge(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(De,De),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,R(e),e;default:if(typeof t.status==`string`)t.then(De,De);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,R(e),e}throw Nl=t,kl}}function Ke(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 qe(){if(Nl===null)throw Error(r(459));var e=Nl;return Nl=null,e}function R(e){if(e===kl||e===jl)throw Error(r(483))}function Je(e){var t=Fl;return Fl+=1,Pl===null&&(Pl=[]),Ge(Pl,e,t)}function Ye(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Xe(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 Ze(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=va(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=Sa(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===La?p(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===Ka&&Ke(i)===t.type)?(t=o(t,n.props),Ye(t,n),t.return=e,t):(t=ba(n.type,n.key,n.props,null,e.mode,r),Ye(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=wa(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=xa(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=Sa(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case V:return n=ba(t.type,t.key,t.props,null,e.mode,n),Ye(n,t),n.return=e,n;case Ia:return t=wa(t,e.mode,n),t.return=e,t;case Ka:return t=Ke(t),m(e,t,n)}if(Za(t)||l(t))return t=xa(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,Ce(e,t),n);Xe(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 V:return n.key===i?d(e,t,n,r):null;case Ia:return n.key===i?f(e,t,n,r):null;case Ka:return n=Ke(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,Ce(e,n),r);Xe(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 V:return e=e.get(r.key===null?n:r.key)||null,d(t,e,r,i);case Ia:return e=e.get(r.key===null?n:r.key)||null,f(t,e,r,i);case Ka:return r=Ke(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,Ce(t,r),i);Xe(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&&F(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&&F(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&&F(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&&F(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&&F(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&&F(t,p),u}function y(e,t,a,s){if(typeof a==`object`&&a&&a.type===La&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case V:a:{for(var u=a.key;t!==null;){if(t.key===u){if(u=a.type,u===La){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&&Ke(u)===t.type){i(e,t.sibling),s=o(t,a.props),Ye(s,a),s.return=e,e=s;break a}i(e,t);break}n(e,t),t=t.sibling}a.type===La?(s=xa(a.props.children,e.mode,s,a.key),s.return=e,e=s):(s=ba(a.type,a.key,a.props,null,e.mode,s),Ye(s,a),s.return=e,e=s)}return c(e);case Ia: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=wa(a,e.mode,s),s.return=e,e=s}return c(e);case Ka:return a=Ke(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,Ce(e,a),s);Xe(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=Sa(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 Qe(){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&&nt(n,i,a)}}function $e(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 et(e,t,n,r){return $e(e,t,n,r),rt(e)}function tt(e,t){return $e(e,null,null,t),rt(e)}function nt(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 rt(e){if(50<od)throw od=0,sd=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}function it(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function at(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 ot(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function st(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=rt(e),nt(e,null,n),t}return $e(e,r,t,n),rt(e)}function ct(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 lt(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 ut(){if(Hl){var e=El;if(e!==null)throw e}}function dt(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 ft(e,t){if(typeof e!=`function`)throw Error(r(191,e));e.call(t)}function pt(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)ft(n[e],t)}function mt(e,t){e=zu,p(Wl,e),p(Ul,t),zu=e|t.baseLanes}function ht(){p(Wl,zu),p(Ul,Ul.current)}function gt(){zu=Wl.current,f(Ul),f(Wl)}function _t(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 vt(e){p(ql,ql.current),p(Gl,e),Kl===null&&(Kl=e)}function yt(e){e.tag===22?(p(ql,ql.current),p(Gl,e),Kl===null&&(Kl=e)):bt(e)}function bt(){p(ql,ql.current),p(Gl,Gl.current)}function xt(e){f(Gl),Kl===e&&(Kl=null),f(ql)}function St(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 Ct(){throw Error(r(321))}function wt(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 Tt(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=Dt(t,n,r,i)),Et(e),a}function Et(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&&be(e)&&(du=!0))}function Dt(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 Ot(){var e=Qa.H,t=e.useState()[0];return t=typeof t.then==`function`?Ft(t):t,e=e.useState()[0],(Xl===null?null:Xl.memoizedState)!==e&&(Yl.flags|=1024),t}function kt(){var e=tu!==0;return tu=0,e}function At(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function jt(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 Mt(){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 Nt(){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 Pt(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ft(e){var t=nu;return nu+=1,ru===null&&(ru=[]),e=Ge(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 It(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Ft(e);if(e.$$typeof===Va)return Se(e)}throw Error(r(438,String(e)))}function Lt(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=Pt(),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 Rt(e,t){return typeof t==`function`?t(e):t}function zt(e){return Bt(Nt(),Xl,e)}function Bt(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 Vt(e){var t=Nt(),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 Ht(e,t,n){var i=Yl,a=Nt(),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,mn(Gt.bind(null,i,a,e),[e]),a.getSnapshot!==t||s||Zl!==null&&Zl.memoizedState.tag&1){if(i.flags|=2048,ln(9,{destroy:void 0},Wt.bind(null,i,a,n,t),null),ju===null)throw Error(r(349));o||Jl&127||Ut(i,t,n)}return n}function Ut(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Yl.updateQueue,t===null?(t=Pt(),Yl.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Wt(e,t,n,r){t.value=n,t.getSnapshot=r,Kt(t)&&qt(e)}function Gt(e,t,n){return n(function(){Kt(t)&&qt(e)})}function Kt(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Rc(e,n)}catch{return!0}}function qt(e){var t=tt(e,2);t!==null&&Ni(t,e,2)}function Jt(e){var t=Mt();if(typeof e==`function`){var n=e;if(e=n(),eu){k(!0);try{n()}finally{k(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rt,lastRenderedState:e},t}function Yt(e,t,n,r){return e.baseState=n,Bt(e,Xl,typeof r==`function`?r:Rt)}function Xt(e,t,n,i,a){if(z(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,Zt(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Zt(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),Qt(e,t,s)}catch(n){en(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),Qa.T=a}}else try{a=n(i,r),Qt(e,t,a)}catch(n){en(e,t,n)}}function Qt(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){$t(e,t,n)},function(n){return en(e,t,n)}):$t(e,t,n)}function $t(e,t,n){t.status=`fulfilled`,t.value=n,tn(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Zt(e,n)))}function en(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,tn(t),t=t.next;while(t!==r)}e.action=null}function tn(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function nn(e,t){return t}function rn(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}}le(r)}r=!1}r&&(t=n[0])}}n=Mt(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nn,lastRenderedState:t},n.queue=r,n=Nn.bind(null,Yl,r),r.dispatch=n,r=Jt(!1);var a=Fn.bind(null,Yl,!1,r.queue);return r=Mt(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Xt.bind(null,Yl,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function an(e){return on(Nt(),Xl,e)}function on(e,t,n){if(t=Bt(e,t,nn)[0],e=zt(Rt)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Ft(t)}catch(e){throw e===kl?jl:e}else r=t;t=Nt();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(Yl.flags|=2048,ln(9,{destroy:void 0},sn.bind(null,i,n),null)),[r,a,e]}function sn(e,t){e.action=t}function cn(e){var t=Nt(),n=Xl;if(n!==null)return on(t,n,e);Nt(),t=t.memoizedState,n=Nt();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ln(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Yl.updateQueue,t===null&&(t=Pt(),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 un(){return Nt().memoizedState}function dn(e,t,n,r){var i=Mt();Yl.flags|=e,i.memoizedState=ln(1|t,{destroy:void 0},n,r===void 0?null:r)}function fn(e,t,n,r){var i=Nt();r=r===void 0?null:r;var a=i.memoizedState.inst;Xl!==null&&r!==null&&wt(r,Xl.memoizedState.deps)?i.memoizedState=ln(t,a,n,r):(Yl.flags|=e,i.memoizedState=ln(1|t,a,n,r))}function pn(e,t){dn(8390656,8,e,t)}function mn(e,t){fn(2048,8,e,t)}function hn(e){Yl.flags|=4;var t=Yl.updateQueue;if(t===null)t=Pt(),Yl.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function gn(e){var t=Nt().memoizedState;return hn({ref:t,nextImpl:e}),function(){if(Au&2)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function _n(e,t){return fn(4,2,e,t)}function vn(e,t){return fn(4,4,e,t)}function yn(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 bn(e,t,n){n=n==null?null:n.concat([e]),fn(4,4,yn.bind(null,t,e),n)}function xn(){}function Sn(e,t){var n=Nt();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&wt(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Cn(e,t){var n=Nt();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&wt(t,r[1]))return r[0];if(r=e(),eu){k(!0);try{e()}finally{k(!1)}}return n.memoizedState=[r,t],r}function wn(e,t,n){return n===void 0||Jl&1073741824&&!(Nu&261930)?e.memoizedState=t:(e.memoizedState=n,e=Mi(),Yl.lanes|=e,Vu|=e,n)}function Tn(e,t,n,r){return Rc(n,t)?n:Ul.current===null?!(Jl&42)||Jl&1073741824&&!(Nu&261930)?(du=!0,e.memoizedState=n):(e=Mi(),Yl.lanes|=e,Vu|=e,t):(e=wn(e,n,r),Rc(e,t)||(du=!0),e)}function En(e,t,n,r,i){var a=So();xo(a!==0&&8>a?a:8);var o=Qa.T,s={};Qa.T=s,Fn(e,!1,t,n);try{var c=i(),l=Qa.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Pn(e,t,ze(c,r),ji(e)):Pn(e,t,r,ji(e))}catch(n){Pn(e,t,{then:function(){},status:`rejected`,reason:n},ji())}finally{xo(a),o!==null&&s.types!==null&&(o.types=s.types),Qa.T=o}}function Dn(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:Rt,lastRenderedState:No},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rt,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function On(){return Se(Po)}function kn(){return Nt().memoizedState}function An(){return Nt().memoizedState}function jn(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=ji();e=ot(n);var r=st(t,e,n);r!==null&&(Ni(r,t,n),ct(r,t,n)),t={cache:Te()},e.payload=t;return}t=t.return}}function Mn(e,t,n){var r=ji();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},z(e)?In(t,n):(n=et(e,t,n,r),n!==null&&(Ni(n,e,r),Ln(n,t,r)))}function Nn(e,t,n){Pn(e,t,n,ji())}function Pn(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(z(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 $e(e,t,i,0),ju===null&&Qe(),!1}catch{}if(n=et(e,t,i,r),n!==null)return Ni(n,e,r),Ln(n,t,r),!0}return!1}function Fn(e,t,n,i){if(i={lane:2,revertLane:Ie(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},z(e)){if(t)throw Error(r(479))}else t=et(e,n,i,2),t!==null&&Ni(t,e,2)}function z(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 Ln(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,E(e,n)}}function Rn(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 zn(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?!Ue(n,r)||!Ue(i,a):!0}function Bn(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 Vn(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 Hn(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Un(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 Wn(e,t,n){return n=ot(n),n.tag=3,n.payload={element:null},n.callback=function(){Hn(e,t)},n}function Gn(e){return e=ot(e),e.tag=3,e}function Kn(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(){Un(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Un(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 qn(e,t,n,i,a){if(n.flags|=32768,typeof i==`object`&&i&&typeof i.then==`function`){if(t=n.alternate,t!==null&&ye(t,n,a,!0),n=Gl.current,n!==null){switch(n.tag){case 31:case 13:return Kl===null?Gi():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),ua(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)),ua(e,i,a)),!1}throw Error(r(435,n.tag))}return ua(e,i,a),Gi(),!1}if(ol)return t=Gl.current,t===null?(i!==ll&&(t=Error(r(423),{cause:i}),me(P(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,i=P(i,n),a=Wn(e.stateNode,i,a),lt(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}),me(P(e,n)))),!1;var o=Error(r(520),{cause:i});if(o=P(o,n),Ku===null?Ku=[o]:Ku.push(o),Bu!==4&&(Bu=2),t===null)return!0;i=P(i,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Wn(n.stateNode,i,e),lt(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=Gn(a),Kn(a,e,n,i),lt(n,a),!1}n=n.return}while(n!==null);return!1}function Jn(e,t,n,r){t.child=e===null?Ll(t,null,n,r):Il(t,e.child,n,r)}function Yn(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 xe(t),r=Tt(e,t,n,o,a,i),s=kt(),e!==null&&!du?(At(e,t,i),vr(e,t,i)):(ol&&s&&re(t),t.flags|=1,Jn(e,t,r,i),t.child)}function Xn(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!_a(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Zn(e,t,a,r,i)):(e=ba(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!yr(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Ue:n,n(o,r)&&e.ref===t.ref)return vr(e,t,i)}return t.flags|=1,e=va(a,r),e.ref=t.ref,e.return=t,t.child=e}function Zn(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Ue(a,r)&&e.ref===t.ref){if(du=!1,t.pendingProps=r=a,yr(e,i))e.flags&131072&&(du=!0);else return t.lanes=e.lanes,vr(e,t,i)}}return ar(e,t,n,r,i)}function Qn(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 er(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ve(t,a===null?null:a.cachePool),a===null?ht():mt(t,a),yt(t);else return r=t.lanes=536870912,er(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ve(t,null),ht(),bt(t)):(Ve(t,a.cachePool),mt(t,a),bt(t),t.memoizedState=null);return Jn(e,t,i,n),t.child}function $n(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function er(e,t,n,r,i){var a=Be();return a=a===null?null:{parent:ho?gl._currentValue:gl._currentValue2,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ve(t,null),ht(),yt(t),e!==null&&ye(e,t,r,!0),t.childLanes=i,null}function tr(e,t){return t=pr({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function nr(e,t,n){return Il(t,e.child,null,n),e=tr(t,t.pendingProps),e.flags|=2,xt(t),t.memoizedState=null,e}function rr(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=tr(t,i),t.lanes=536870912,$n(null,e);if(vt(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=Ca(e),n.return=t,t.child=n,il=t,al=null)):e=null,e===null)throw le(t);return t.lanes=536870912,null}return tr(t,i)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(vt(t),a){if(t.flags&256)t.flags&=-257,t=nr(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||ye(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,tt(e,s),Ni(i,e,s),uu;Gi(),t=nr(e,t,n)}else e=o.treeContext,vo&&(al=ws(s),il=t,ol=!0,sl=null,cl=!1,e!==null&&I(t,e)),t=tr(t,i),t.flags|=4096;return t}return e=va(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ir(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 ar(e,t,n,r,i){return xe(t),n=Tt(e,t,n,r,void 0,i),r=kt(),e!==null&&!du?(At(e,t,i),vr(e,t,i)):(ol&&r&&re(t),t.flags|=1,Jn(e,t,n,i),t.child)}function or(e,t,n,r,i,a){return xe(t),t.updateQueue=null,n=Dt(t,r,n,i),Et(e),r=kt(),e!==null&&!du?(At(e,t,a),vr(e,t,a)):(ol&&r&&re(t),t.flags|=1,Jn(e,t,n,a),t.child)}function sr(e,t,n,r,i){if(xe(t),t.stateNode===null){var a=vc,o=n.contextType;typeof o==`object`&&o&&(a=Se(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={},it(t),o=n.contextType,a.context=typeof o==`object`&&o?Se(o):vc,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Rn(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),dt(t,r,a,i),ut(),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=Vn(n,s);a.props=c;var l=a.context,u=n.contextType;o=vc,typeof u==`object`&&u&&(o=Se(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)&&Bn(t,a,r,o),Vl=!1;var f=t.memoizedState;a.state=f,dt(t,r,a,i),ut(),l=t.memoizedState,s||f!==l||Vl?(typeof d==`function`&&(Rn(t,n,d,r),l=t.memoizedState),(c=Vl||zn(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,at(e,t),o=t.memoizedProps,u=Vn(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=vc,typeof l==`object`&&l&&(c=Se(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)&&Bn(t,a,r,c),Vl=!1,f=t.memoizedState,a.state=f,dt(t,r,a,i),ut();var p=t.memoizedState;o!==d||f!==p||Vl||e!==null&&e.dependencies!==null&&be(e.dependencies)?(typeof s==`function`&&(Rn(t,n,s,r),p=t.memoizedState),(u=Vl||zn(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&be(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,ir(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)):Jn(e,t,n,i),t.memoizedState=a.state,e=t.child):e=vr(e,t,i),e}function cr(e,t,n,r){return fe(),t.flags|=256,Jn(e,t,n,r),t.child}function lr(e){return{baseLanes:e,cachePool:He()}}function ur(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Wu),e}function dr(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?_t(t):bt(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=Ca(e),n.return=t,t.child=n,il=t,al=null)):e=null,e===null)throw le(t);return hs(e)?t.lanes=32:t.lanes=536870912,null}var c=i.children;return i=i.fallback,a?(bt(t),a=t.mode,c=pr({mode:`hidden`,children:c},a),i=xa(i,a,n,null),c.return=t,i.return=t,c.sibling=i,t.child=c,i=t.child,i.memoizedState=lr(n),i.childLanes=ur(e,s,n),t.memoizedState=fu,$n(null,i)):(_t(t),fr(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(_t(t),t.flags&=-257,t=mr(e,t,n)):t.memoizedState===null?(bt(t),c=i.fallback,a=t.mode,i=pr({mode:`visible`,children:i.children},a),c=xa(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=lr(n),i.childLanes=ur(e,s,n),t.memoizedState=fu,t=$n(null,i)):(bt(t),t.child=e.child,t.flags|=128,t=null);else if(_t(t),hs(c))s=gs(c).digest,i=Error(r(419)),i.stack=``,i.digest=s,me({value:i,source:null,stack:null}),t=mr(e,t,n);else if(du||ye(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,tt(e,i),Ni(s,e,i),uu;ms(c)||Gi(),t=mr(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&&I(t,e)),t=fr(t,i.children),t.flags|=4096);return t}return a?(bt(t),c=i.fallback,a=t.mode,l=e.child,o=l.sibling,i=va(l,{mode:`hidden`,children:i.children}),i.subtreeFlags=l.subtreeFlags&65011712,o===null?(c=xa(c,a,n,null),c.flags|=2):c=va(o,c),c.return=t,i.return=t,i.sibling=c,t.child=i,$n(null,i),i=t.child,c=e.child.memoizedState,c===null?c=lr(n):(a=c.cachePool,a===null?a=He():(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=ur(e,s,n),t.memoizedState=fu,$n(e.child,i)):(_t(t),n=e.child,e=n.sibling,n=va(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 fr(e,t){return t=pr({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function pr(e,n){return e=t(22,e,null,n),e.lanes=0,e}function mr(e,t,n){return Il(t,e.child,null,n),e=fr(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function hr(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),_e(e.return,t,n)}function gr(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 _r(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),Jn(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&&hr(e,n,t);else if(e.tag===19)hr(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&&St(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),gr(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&&St(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}gr(t,!0,n,null,a,r);break;case`together`:gr(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function vr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Vu|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(ye(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=va(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=va(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function yr(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&be(e)))}function br(e,t,n){switch(t.tag){case 3:ae(t,t.stateNode.containerInfo),he(t,gl,e.memoizedState.cache),fe();break;case 27:case 5:se(t);break;case 4:ae(t,t.stateNode.containerInfo);break;case 10:he(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,vt(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(_t(t),e=vr(e,t,n),e===null?null:e.sibling):dr(e,t,n):(_t(t),t.flags|=128,null);_t(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(ye(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return _r(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,Qn(e,t,n,t.pendingProps);case 24:he(t,gl,e.memoizedState.cache)}return vr(e,t,n)}function xr(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)du=!0;else{if(!yr(e,n)&&!(t.flags&128))return du=!1,br(e,t,n);du=!!(e.flags&131072)}}else du=!1,ol&&t.flags&1048576&&ne(t,Jc,t.index);switch(t.lanes=0,t.tag){case 16:a:{var i=t.pendingProps;if(e=Ke(t.elementType),t.type=e,typeof e==`function`)_a(e)?(i=Vn(e,i),t.tag=1,t=sr(null,t,e,i,n)):(t.tag=0,t=ar(null,t,e,i,n));else{if(e!=null){var a=e.$$typeof;if(a===Ha){t.tag=11,t=Yn(null,t,e,i,n);break a}if(a===Ga){t.tag=14,t=Xn(null,t,e,i,n);break a}}throw t=u(e)||e,Error(r(306,t,``))}}return t;case 0:return ar(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,a=Vn(i,t.pendingProps),sr(e,t,i,a,n);case 3:a:{if(ae(t,t.stateNode.containerInfo),e===null)throw Error(r(387));var o=t.pendingProps;a=t.memoizedState,i=a.element,at(e,t),dt(t,o,null,n);var s=t.memoizedState;if(o=s.cache,he(t,gl,o),o!==a.cache&&ve(t,[gl],n,!0),ut(),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=cr(e,t,o,n);break a}if(o!==i){i=P(Error(r(424)),t),me(i),t=cr(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(fe(),o===i){t=vr(e,t,n);break a}Jn(e,t,o,n)}t=t.child}return t;case 26:if(Xs)return ir(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 se(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)),Jn(e,t,t.pendingProps.children,n),ir(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||le(t)),se(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=Tt(e,t,Ot,null,null,n),ho?Po._currentValue=a:Po._currentValue2=a),ir(e,t),Jn(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||le(t)),null;case 13:return dr(e,t,n);case 4:return ae(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Il(t,null,i,n):Jn(e,t,i,n),t.child;case 11:return Yn(e,t,t.type,t.pendingProps,n);case 7:return Jn(e,t,t.pendingProps,n),t.child;case 8:return Jn(e,t,t.pendingProps.children,n),t.child;case 12:return Jn(e,t,t.pendingProps.children,n),t.child;case 10:return i=t.pendingProps,he(t,t.type,i.value),Jn(e,t,i.children,n),t.child;case 9:return a=t.type._context,i=t.pendingProps.children,xe(t),a=Se(a),i=i(a),t.flags|=1,Jn(e,t,i,n),t.child;case 14:return Xn(e,t,t.type,t.pendingProps,n);case 15:return Zn(e,t,t.type,t.pendingProps,n);case 19:return _r(e,t,n);case 31:return rr(e,t,n);case 22:return Qn(e,t,n,t.pendingProps);case 24:return xe(t),i=Se(gl),e===null?(a=Be(),a===null&&(a=ju,o=Te(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:i,cache:a},it(t),he(t,gl,a)):((e.lanes&n)!==0&&(at(e,t),dt(t,null,null,n),ut()),a=e.memoizedState,o=t.memoizedState,a.parent===i?(i=o.cache,he(t,gl,i),i!==a.cache&&ve(t,[gl],n,!0)):(a={parent:i,cache:i},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),he(t,gl,i))),Jn(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function Sr(e){e.flags|=4}function Cr(e){_o&&(e.flags|=8)}function wr(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 Tr(e,t,n,r){if(go)for(n=t.child;n!==null;){if(n.tag===5||n.tag===6)so(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)),so(e,a)}else if(i.tag===6)a=i.stateNode,n&&r&&(a=ps(a,i.memoizedProps)),so(e,a);else if(i.tag!==4){if(i.tag===22&&i.memoizedState!==null)a=i.child,a!==null&&(a.return=i),Tr(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 Er(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),Er(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 Dr(e,t){if(_o&&wr(e,t)){e=t.stateNode;var n=e.containerInfo,r=cs();Er(r,t,!1,!1),e.pendingChildren=r,Sr(t),us(n,r)}}function Or(e,t,n,r){if(go)e.memoizedProps!==r&&Sr(t);else if(_o){var i=e.stateNode,a=e.memoizedProps;if((e=wr(e,t))||a!==r){var o=el.current;a=ss(i,n,a,r,!e,null),a===i?t.stateNode=i:(Cr(t),co(a,n,r,o)&&Sr(t),t.stateNode=a,e&&Tr(a,t,!1,!1))}else t.stateNode=i}}function kr(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(Hi())e.flags|=8192;else throw Nl=Ml,Al}}else e.flags&=-16777217}function Ar(e,t){if(sc(t)){if(e.flags|=16777216,!cc(t)){if(Hi())e.flags|=8192;else throw Nl=Ml,Al}}else e.flags&=-16777217}function jr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:y(),e.lanes|=t,Gu|=t)}function Mr(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 Nr(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 Pr(e,t,n){var i=t.pendingProps;switch(ie(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Nr(t),null;case 1:return Nr(t),null;case 3:return n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),ge(gl),oe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(de(t)?Sr(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,pe())),Dr(e,t),Nr(t),null;case 26:if(Xs){var a=t.type,o=t.memoizedState;return e===null?(Sr(t),o===null?(Nr(t),kr(t,a,null,i,n)):(Nr(t),Ar(t,o))):o?o===e.memoizedState?(Nr(t),t.flags&=-16777217):(Sr(t),Nr(t),Ar(t,o)):(o=e.memoizedProps,go?o!==i&&Sr(t):Or(e,t,a,i),Nr(t),kr(t,a,o,i,n)),null}case 27:if(uc){if(ce(t),n=nl.current,a=t.type,e!==null&&t.stateNode!=null)go?e.memoizedProps!==i&&Sr(t):Or(e,t,a,i);else{if(!i){if(t.stateNode===null)throw Error(r(166));return Nr(t),null}e=el.current,de(t)?L(t,e):(e=dc(a,i,n,e,!0),t.stateNode=e,Sr(t))}return Nr(t),null}case 5:if(ce(t),a=t.type,e!==null&&t.stateNode!=null)Or(e,t,a,i);else{if(!i){if(t.stateNode===null)throw Error(r(166));return Nr(t),null}if(o=el.current,de(t))L(t,o),Vs(t.stateNode,a,i,o)&&(t.flags|=64);else{var s=oo(a,i,nl.current,o,t);Cr(t),Tr(s,t,!1,!1),t.stateNode=s,co(s,a,i,o)&&Sr(t)}}return Nr(t),kr(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&&Sr(t):_o&&(n===i?t.stateNode=e.stateNode:(e=nl.current,n=el.current,Cr(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,de(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)||le(t,!0)}else Cr(t),t.stateNode=uo(i,e,n,t)}return Nr(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=de(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 fe(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nr(t),e=!1}else n=pe(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(xt(t),t):(xt(t),null);if(t.flags&128)throw Error(r(558))}return Nr(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=de(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 fe(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nr(t),a=!1}else a=pe(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(xt(t),t):(xt(t),null)}return xt(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),jr(t,t.updateQueue),Nr(t),null);case 4:return oe(),Dr(e,t),e===null&&bo(t.stateNode.containerInfo),Nr(t),null;case 10:return ge(t.type),Nr(t),null;case 19:if(f(ql),i=t.memoizedState,i===null)return Nr(t),null;if(a=!!(t.flags&128),o=i.rendering,o===null){if(a)Mr(i,!1);else{if(Bu!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=St(e),o!==null){for(t.flags|=128,Mr(i,!1),e=o.updateQueue,t.updateQueue=e,jr(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ya(n,e),n=n.sibling;return p(ql,ql.current&1|2),ol&&F(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&kc()>Zu&&(t.flags|=128,a=!0,Mr(i,!1),t.lanes=4194304)}}else{if(!a){if(e=St(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,jr(t,e),Mr(i,!0),i.tail===null&&i.tailMode===`hidden`&&!o.alternate&&!ol)return Nr(t),null}else 2*kc()-i.renderingStartTime>Zu&&n!==536870912&&(t.flags|=128,a=!0,Mr(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?(Nr(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&&F(t,i.treeForkCount),e);case 22:case 23:return xt(t),gt(),i=t.memoizedState!==null,e===null?i&&(t.flags|=8192):e.memoizedState!==null!==i&&(t.flags|=8192),i?n&536870912&&!(t.flags&128)&&(Nr(t),t.subtreeFlags&6&&(t.flags|=8192)):Nr(t),n=t.updateQueue,n!==null&&jr(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),ge(gl),Nr(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Fr(e,t){switch(ie(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ge(gl),oe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ce(t),null;case 31:if(t.memoizedState!==null){if(xt(t),t.alternate===null)throw Error(r(340));fe()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(xt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));fe()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return f(ql),null;case 4:return oe(),null;case 10:return ge(t.type),null;case 22:case 23:return xt(t),gt(),e!==null&&f(Ol),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ge(gl),null;case 25:return null;default:return null}}function Ir(e,t){switch(ie(t),t.tag){case 3:ge(gl),oe();break;case 26:case 27:case 5:ce(t);break;case 4:oe();break;case 31:t.memoizedState!==null&&xt(t);break;case 13:xt(t);break;case 19:f(ql);break;case 10:ge(t.type);break;case 22:case 23:xt(t),gt(),e!==null&&f(Ol);break;case 24:ge(gl)}}function Lr(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){la(t,t.return,e)}}function Rr(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){la(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){la(t,t.return,e)}}function zr(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{pt(t,n)}catch(t){la(e,e.return,t)}}}function Br(e,t,n){n.props=Vn(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){la(e,t,n)}}function Vr(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){la(e,t,n)}}function Hr(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){la(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){la(e,t,n)}else n.current=null}}function Ur(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{Yo(r,t,n,e)}catch(t){la(e,e.return,t)}}function Wr(e,t,n){try{Xo(e.stateNode,e.type,n,t,e)}catch(t){la(e,e.return,t)}}function Gr(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 Kr(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Gr(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 qr(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(qr(e,t,n),e=e.sibling;e!==null;)qr(e,t,n),e=e.sibling}function Jr(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(Jr(e,t,n),e=e.sibling;e!==null;)Jr(e,t,n),e=e.sibling}function Yr(e,t,n){e=e.containerInfo;try{ds(e,n)}catch(e){la(t,t.return,e)}}function Xr(e){var t=e.stateNode,n=e.memoizedProps;try{fc(e.type,n,t,e)}catch(t){la(e,e.return,t)}}function Zr(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=Vn(i.type,a);t=o.getSnapshotBeforeUpdate(s,n),o.__reactInternalSnapshotBeforeUpdate=t}catch(e){la(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 Qr(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:ui(e,n),r&4&&Lr(5,n);break;case 1:if(ui(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){la(n,n.return,e)}else{var i=Vn(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){la(n,n.return,e)}}}r&64&&zr(n),r&512&&Vr(n,n.return);break;case 3:if(ui(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{pt(r,e)}catch(e){la(n,n.return,e)}}break;case 27:uc&&t===null&&r&4&&Xr(n);case 26:case 5:if(ui(e,n),t===null){if(r&4)Ur(n);else if(r&64){e=n.type,t=n.memoizedProps,i=n.stateNode;try{Ls(i,e,t,n)}catch(e){la(n,n.return,e)}}}r&512&&Vr(n,n.return);break;case 12:ui(e,n);break;case 31:ui(e,n),r&4&&ni(e,n);break;case 13:ui(e,n),r&4&&ri(e,n),r&64&&(r=n.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(n=pa.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?fi(e,n,!!(n.subtreeFlags&8772)):ui(e,n),pu=i,mu=a}break;case 30:break;default:ui(e,n)}}function $r(e){var t=e.alternate;t!==null&&(e.alternate=null,$r(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 ei(e,t,n){for(n=n.child;n!==null;)ti(e,t,n),n=n.sibling}function ti(e,t,n){if(Lc&&typeof Lc.onCommitFiberUnmount==`function`)try{Lc.onCommitFiberUnmount(Ic,n)}catch{}switch(n.tag){case 26:if(Xs){mu||Hr(n,t),ei(e,t,n),n.memoizedState?tc(n.memoizedState):n.stateNode&&ic(n.stateNode);break}case 27:if(uc){mu||Hr(n,t);var r=vu,i=yu;hc(n.type)&&(vu=n.stateNode,yu=!1),ei(e,t,n),pc(n.stateNode),vu=r,yu=i;break}case 5:mu||Hr(n,t);case 6:if(go){if(r=vu,i=yu,vu=null,ei(e,t,n),vu=r,yu=i,vu!==null){if(yu)try{es(vu,n.stateNode)}catch(e){la(n,t,e)}else try{$o(vu,n.stateNode)}catch(e){la(n,t,e)}}}else ei(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,ei(e,t,n),vu=r,yu=i):(_o&&Yr(n.stateNode,n,cs()),ei(e,t,n));break;case 0:case 11:case 14:case 15:Rr(2,n,t),mu||Rr(4,n,t),ei(e,t,n);break;case 1:mu||(Hr(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Br(n,t,r)),ei(e,t,n);break;case 21:ei(e,t,n);break;case 22:mu=(r=mu)||n.memoizedState!==null,ei(e,t,n),mu=r;break;default:ei(e,t,n)}}function ni(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){la(t,t.return,e)}}}function ri(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){la(t,t.return,e)}}function ii(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 ai(e,t){var n=ii(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=ma.bind(null,e,t);t.then(r,r)}})}function oi(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));ti(o,s,a),vu=null,yu=!1}else ti(o,s,a);o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)si(t,e),t=t.sibling}function si(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:oi(t,e),ci(e),i&4&&(Rr(3,e,e.return),Lr(3,e),Rr(5,e,e.return));break;case 1:oi(t,e),ci(e),i&512&&(mu||n===null||Hr(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(oi(t,e),ci(e),i&512&&(mu||n===null||Hr(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&&Wr(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){oi(t,e),ci(e),i&512&&(mu||n===null||Hr(n,n.return)),n!==null&&i&4&&Wr(e,e.memoizedProps,n.memoizedProps);break}case 5:if(oi(t,e),ci(e),i&512&&(mu||n===null||Hr(n,n.return)),go){if(e.flags&32){a=e.stateNode;try{ts(a)}catch(t){la(e,e.return,t)}}i&4&&e.stateNode!=null&&(a=e.memoizedProps,Wr(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(oi(t,e),ci(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){la(e,e.return,t)}}break;case 3:if(Xs?(oc(),a=bu,bu=Qs(t.containerInfo),oi(t,e),bu=a):oi(t,e),ci(e),i&4){if(go&&vo&&n!==null&&n.memoizedState.isDehydrated)try{Rs(t.containerInfo)}catch(t){la(e,e.return,t)}if(_o){i=t.containerInfo,n=t.pendingChildren;try{ds(i,n)}catch(t){la(e,e.return,t)}}}hu&&(hu=!1,li(e));break;case 4:Xs?(n=bu,bu=Qs(e.stateNode.containerInfo),oi(t,e),ci(e),bu=n):(oi(t,e),ci(e)),i&4&&_o&&Yr(e.stateNode,e,e.stateNode.pendingChildren);break;case 12:oi(t,e),ci(e);break;case 31:oi(t,e),ci(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,ai(e,i)));break;case 13:oi(t,e),ci(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,ai(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,oi(t,e),mu=l,pu=c,ci(e),i&8192&&(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||s||pu||mu||di(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){la(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){la(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){la(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,ai(e,n))));break;case 19:oi(t,e),ci(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,ai(e,i)));break;case 30:break;case 21:break;default:oi(t,e),ci(e)}}function ci(e){var t=e.flags;if(t&2){try{for(var n,i=e.return;i!==null;){if(Gr(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;Jr(e,Kr(e),a);break}case 5:var o=n.stateNode;n.flags&32&&(ts(o),n.flags&=-33),Jr(e,Kr(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;qr(e,Kr(e),s);break;default:throw Error(r(161))}}}catch(t){la(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function li(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;li(t),t.tag===5&&t.flags&1024&&Fo(t.stateNode),e=e.sibling}}function ui(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Qr(e,t.alternate,t),t=t.sibling}function di(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Rr(4,t,t.return),di(t);break;case 1:Hr(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Br(t,t.return,n),di(t);break;case 27:uc&&pc(t.stateNode);case 26:case 5:Hr(t,t.return),di(t);break;case 22:t.memoizedState===null&&di(t);break;case 30:di(t);break;default:di(t)}e=e.sibling}}function fi(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:fi(i,a,n),Lr(4,a);break;case 1:if(fi(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){la(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++)ft(c[i],s)}catch(e){la(r,r.return,e)}}n&&o&64&&zr(a),Vr(a,a.return);break;case 27:uc&&Xr(a);case 26:case 5:fi(i,a,n),n&&r===null&&o&4&&Ur(a),Vr(a,a.return);break;case 12:fi(i,a,n);break;case 31:fi(i,a,n),n&&o&4&&ni(i,a);break;case 13:fi(i,a,n),n&&o&4&&ri(i,a);break;case 22:a.memoizedState===null&&fi(i,a,n),Vr(a,a.return);break;case 30:break;default:fi(i,a,n)}t=t.sibling}}function pi(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&&Ee(n))}function mi(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ee(e))}function hi(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)gi(e,t,n,r),t=t.sibling}function gi(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:hi(e,t,n,r),i&2048&&Lr(9,t);break;case 1:hi(e,t,n,r);break;case 3:hi(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&&Ee(e)));break;case 12:if(i&2048){hi(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){la(t,t.return,e)}}else hi(e,t,n,r);break;case 31:hi(e,t,n,r);break;case 13:hi(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?hi(e,t,n,r):(a._visibility|=2,_i(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?hi(e,t,n,r):vi(e,t),i&2048&&pi(o,t);break;case 24:hi(e,t,n,r),i&2048&&mi(t.alternate,t);break;default:hi(e,t,n,r)}}function _i(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:_i(a,o,s,c,i),Lr(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,_i(a,o,s,c,i)):u._visibility&2?_i(a,o,s,c,i):vi(a,o),i&&l&2048&&pi(o.alternate,o);break;case 24:_i(a,o,s,c,i),i&&l&2048&&mi(o.alternate,o);break;default:_i(a,o,s,c,i)}t=t.sibling}}function vi(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:vi(n,r),i&2048&&pi(r.alternate,r);break;case 24:vi(n,r),i&2048&&mi(r.alternate,r);break;default:vi(n,r)}t=t.sibling}}function yi(e,t,n){if(e.subtreeFlags&xu)for(e=e.child;e!==null;)bi(e,t,n),e=e.sibling}function bi(e,t,n){switch(e.tag){case 26:if(yi(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:yi(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),yi(e,t,n),bu=r):yi(e,t,n);break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=xu,xu=16777216,yi(e,t,n),xu=r):yi(e,t,n));break;default:yi(e,t,n)}}function xi(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 Si(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,Ti(r,e)}xi(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ci(e),e=e.sibling}function Ci(e){switch(e.tag){case 0:case 11:case 15:Si(e),e.flags&2048&&Rr(9,e,e.return);break;case 3:Si(e);break;case 12:Si(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,wi(e)):Si(e);break;default:Si(e)}}function wi(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,Ti(r,e)}xi(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Rr(8,t,t.return),wi(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,wi(t));break;default:wi(t)}e=e.sibling}}function Ti(e,t){for(;_u!==null;){var n=_u;switch(n.tag){case 0:case 11:case 15:Rr(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:Ee(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($r(r),r===n){_u=null;break a}if(i!==null){i.return=a,_u=i;break a}_u=a}}}function Ei(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 Di(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&&Di(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 Oi(e){switch(e.$$typeof){case Cu:return`<`+(u(e.value)||`Unknown`)+`>`;case wu:return`:has(`+(Oi(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 ki(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&&Di(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 Ai(e,t){if(!Ro)throw Error(r(363));e=Ei(e),e=ki(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 ji(){return Au&2&&Nu!==0?Nu&-Nu:Qa.T===null?Co():Ie()}function Mi(){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 Ni(e,t,n){(e===ju&&(Pu===2||Pu===9)||e.cancelPendingCommit!==null)&&(Bi(e,0),Li(e,Nu,Wu,!1)),S(e,n),(!(Au&2)||e!==ju)&&(e===ju&&(!(Au&2)&&(Hu|=n),Bu===4&&Li(e,Nu,Wu,!1)),Oe(e))}function Pi(e,t,n){if(Au&6)throw Error(r(327));var i=!n&&!(t&127)&&(t&e.expiredLanes)===0||_(e,t),a=i?Ji(e,t):Ki(e,t,!0),o=i;do{if(a===0){Lu&&!i&&Li(e,t,0,!1);break}if(n=e.current.alternate,o&&!Ii(n)){a=Ki(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&&(Bi(c,s).flags|=256),s=Ki(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){Bi(e,0),Li(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:Li(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(Li(i,t,Wu,!Iu),g(i,0,!0)!==0)break a;rd=t,i.timeoutHandle=fo(Fi.bind(null,i,n,qu,Qu,Ju,t,Wu,Hu,Gu,Iu,o,`Throttled`,-0,0),a);break a}Fi(i,n,qu,Qu,Ju,t,Wu,Hu,Gu,Iu,o,null,-0,0)}break}while(1);Oe(e)}function Fi(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(),bi(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(ta.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Li(e,a,o,!l);return}}ta(e,t,a,n,r,i,o,s,c)}function Ii(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 Li(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&&T(e,n,t)}function Ri(){return Au&6?!0:(ke(0,!1),!1)}function zi(){if(Mu!==null){if(Pu===0)var e=Mu.return;else e=Mu,fl=dl=null,jt(e),Pl=null,Fl=0,e=Mu;for(;e!==null;)Ir(e.alternate,e),e=e.return;Mu=null}}function Bi(e,t){var n=e.timeoutHandle;n!==mo&&(e.timeoutHandle=mo,po(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),rd=0,zi(),ju=e,Mu=n=va(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,Qe(),n}function Vi(e,t){Yl=null,Qa.H=au,t===kl||t===jl?(t=qe(),Pu=3):t===Al?(t=qe(),Pu=4):Pu=t===uu?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Fu=t,Mu===null&&(Bu=1,Hn(e,P(t,e.current)))}function Hi(){var e=Gl.current;return e===null?!0:(Nu&4194048)===Nu?Kl===null:(Nu&62914560)===Nu||Nu&536870912?e===Kl:!1}function Ui(){var e=Qa.H;return Qa.H=au,e===null?au:e}function Wi(){var e=Qa.A;return Qa.A=Su,e}function Gi(){Bu=4,Iu||(Nu&4194048)!==Nu&&Gl.current!==null||(Lu=!0),!(Vu&134217727)&&!(Hu&134217727)||ju===null||Li(ju,Nu,Wu,!1)}function Ki(e,t,n){var r=Au;Au|=2;var i=Ui(),a=Wi();(ju!==e||Nu!==t)&&(Qu=null,Bi(e,t)),t=!1;var o=Bu;a:do try{if(Pu!==0&&Mu!==null){var s=Mu,c=Fu;switch(Pu){case 8:zi(),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,Qi(e,s,c,l),n&&Lu){o=0;break a}break;default:l=Pu,Pu=0,Fu=null,Qi(e,s,c,l)}}qi(),o=Bu;break}catch(t){Vi(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,Qe()),o}function qi(){for(;Mu!==null;)Xi(Mu)}function Ji(e,t){var n=Au;Au|=2;var i=Ui(),a=Wi();ju!==e||Nu!==t?(Qu=null,Zu=kc()+500,Bi(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,Qi(e,t,o,1);break;case 2:case 9:if(We(o)){Pu=0,Fu=null,Zi(t);break}t=function(){Pu!==2&&Pu!==9||ju!==e||(Pu=7),Oe(e)},o.then(t,t);break a;case 3:Pu=7;break a;case 4:Pu=5;break a;case 7:We(o)?(Pu=0,Fu=null,Zi(t)):(Pu=0,Fu=null,Qi(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,$i(f))}break b}}Pu=0,Fu=null,Qi(e,t,o,5);break;case 6:Pu=0,Fu=null,Qi(e,t,o,6);break;case 8:zi(),Bu=6;break a;default:throw Error(r(462))}}Yi();break}catch(t){Vi(e,t)}while(1);return fl=dl=null,Qa.H=i,Qa.A=a,Au=n,Mu===null?(ju=null,Nu=0,Qe(),Bu):0}function Yi(){for(;Mu!==null&&!Dc();)Xi(Mu)}function Xi(e){var t=xr(e.alternate,e,zu);e.memoizedProps=e.pendingProps,t===null?$i(e):Mu=t}function Zi(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=or(n,t,t.pendingProps,t.type,void 0,Nu);break;case 11:t=or(n,t,t.pendingProps,t.type.render,t.ref,Nu);break;case 5:jt(t);default:Ir(n,t),t=Mu=ya(t,zu),t=xr(n,t,zu)}e.memoizedProps=e.pendingProps,t===null?$i(e):Mu=t}function Qi(e,t,n,r){fl=dl=null,jt(t),Pl=null,Fl=0;var i=t.return;try{if(qn(e,i,t,n,Nu)){Bu=1,Hn(e,P(n,e.current)),Mu=null;return}}catch(t){if(i!==null)throw Mu=i,t;Bu=1,Hn(e,P(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))),ea(t,e)):$i(t)}function $i(e){var t=e;do{if(t.flags&32768){ea(t,Iu);return}e=t.return;var n=Pr(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 ea(e,t){do{var n=Fr(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 ta(e,t,n,i,a,o,s,c,l){e.cancelPendingCommit=null;do oa();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,w(e,n,o,s,c,l),e===ju&&(Mu=ju=null,Nu=0),nd=t,td=e,rd=n,id=o,ad=a,U=i,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,ha(Mc,function(){return sa(),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{Zr(e,t,n)}finally{Au=s,xo(a),Qa.T=i}}ed=1,na(),ra(),ia()}}function na(){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{si(t,e),H(e.containerInfo)}finally{Au=i,xo(r),Qa.T=n}}e.current=t,ed=2}}function ra(){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{Qr(e,t.alternate,t)}finally{Au=i,xo(r),Qa.T=n}}ed=3}}function ia(){if(ed===4||ed===3){ed=0,Oc();var e=td,t=nd,n=rd,r=U;t.subtreeFlags&10256||t.flags&10256?ed=5:(ed=0,nd=td=null,aa(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&($u=null),ee(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&&oa(),Oe(e),i=e.pendingLanes,n&261930&&i&42?e===sd?od++:(od=0,sd=e):od=0,vo&&Hs(),ke(0,!1)}}function aa(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ee(t)))}function oa(){return na(),ra(),ia(),sa()}function sa(){if(ed!==5)return!1;var e=td,t=id;id=0;var n=ee(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,Ci(o.current),gi(o,o.current,s,i),Au=c,ke(0,!1),Lc&&typeof Lc.onPostCommitFiberRoot==`function`)try{Lc.onPostCommitFiberRoot(Ic,o)}catch{}return!0}finally{xo(a),Qa.T=n,aa(e,t)}}function ca(e,t,n){t=P(n,t),t=Wn(e.stateNode,t,2),e=st(e,t,2),e!==null&&(S(e,2),Oe(e))}function la(e,t,n){if(e.tag===3)ca(e,e,n);else for(;t!==null;){if(t.tag===3){ca(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=P(n,e),n=Gn(2),r=st(t,n,2),r!==null&&(Kn(n,r,t,e),S(r,2),Oe(r));break}}t=t.return}}function ua(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=da.bind(null,e,t,n),t.then(e,e))}function da(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)&&Bi(e,0):Uu|=n,Gu===Nu&&(Gu=0)),Oe(e)}function fa(e,t){t===0&&(t=y()),e=tt(e,t),e!==null&&(S(e,t),Oe(e))}function pa(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),fa(e,n)}function ma(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),fa(e,n)}function ha(e,t){return Tc(e,t)}function ga(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 _a(e){return e=e.prototype,!(!e||!e.isReactComponent)}function va(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 ya(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 ba(e,n,i,a,o,s){var c=0;if(a=e,typeof e==`function`)_a(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 La:return xa(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 xa(e,n,r,i){return e=t(7,e,i,n),e.lanes=r,e}function Sa(e,n,r){return e=t(6,e,null,n),e.lanes=r,e}function Ca(e){var n=t(18,null,null,0);return n.stateNode=e,n}function wa(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 Ta(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 Ea(e,n,r,i,a,o,s,c,l,u,d,f){return e=new Ta(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=Te(),n.refCount++,e.pooledCache=n,n.refCount++,o.memoizedState={element:i,isDehydrated:r,cache:n},it(o),e}function Da(e){return e?(e=vc,e):vc}function Oa(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 ka(e,t,n,r,i,a){i=Da(i),r.context===null?r.context=i:r.pendingContext=i,r=ot(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=st(e,r,t),n!==null&&(Ni(n,e,t),ct(n,e,t))}function Aa(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ja(e,t){Aa(e,t),(e=e.alternate)&&Aa(e,t)}var B={},Ma=x(),Na=C(),Pa=Object.assign,Fa=Symbol.for(`react.element`),V=Symbol.for(`react.transitional.element`),Ia=Symbol.for(`react.portal`),La=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,H=e.resetAfterCommit,oo=e.createInstance;e.cloneMutableInstance;var so=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:A,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`&&Le(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=Ze(!0),Ll=Ze(!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:Se,use:It,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useLayoutEffect:Ct,useInsertionEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useSyncExternalStore:Ct,useId:Ct,useHostTransitionStatus:Ct,useFormState:Ct,useActionState:Ct,useOptimistic:Ct,useMemoCache:Ct,useCacheRefresh:Ct};au.useEffectEvent=Ct;var ou={readContext:Se,use:It,useCallback:function(e,t){return Mt().memoizedState=[e,t===void 0?null:t],e},useContext:Se,useEffect:pn,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),dn(4194308,4,yn.bind(null,t,e),n)},useLayoutEffect:function(e,t){return dn(4194308,4,e,t)},useInsertionEffect:function(e,t){dn(4,2,e,t)},useMemo:function(e,t){var n=Mt();t=t===void 0?null:t;var r=e();if(eu){k(!0);try{e()}finally{k(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Mt();if(n!==void 0){var i=n(t);if(eu){k(!0);try{n(t)}finally{k(!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=Mn.bind(null,Yl,e),[r.memoizedState,e]},useRef:function(e){var t=Mt();return e={current:e},t.memoizedState=e},useState:function(e){e=Jt(e);var t=e.queue,n=Nn.bind(null,Yl,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:xn,useDeferredValue:function(e,t){return wn(Mt(),e,t)},useTransition:function(){var e=Jt(!1);return e=En.bind(null,Yl,e.queue,!0,!1),Mt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=Yl,a=Mt();if(ol){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),ju===null)throw Error(r(349));Nu&127||Ut(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,pn(Gt.bind(null,i,o,e),[e]),i.flags|=2048,ln(9,{destroy:void 0},Wt.bind(null,i,o,n,t),null),n},useId:function(){var e=Mt(),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:On,useFormState:rn,useActionState:rn,useOptimistic:function(e){var t=Mt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Fn.bind(null,Yl,!0,n),n.dispatch=t,[e,t]},useMemoCache:Lt,useCacheRefresh:function(){return Mt().memoizedState=jn.bind(null,Yl)},useEffectEvent:function(e){var t=Mt(),n={impl:e};return t.memoizedState=n,function(){if(Au&2)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},su={readContext:Se,use:It,useCallback:Sn,useContext:Se,useEffect:mn,useImperativeHandle:bn,useInsertionEffect:_n,useLayoutEffect:vn,useMemo:Cn,useReducer:zt,useRef:un,useState:function(){return zt(Rt)},useDebugValue:xn,useDeferredValue:function(e,t){return Tn(Nt(),Xl.memoizedState,e,t)},useTransition:function(){var e=zt(Rt)[0],t=Nt().memoizedState;return[typeof e==`boolean`?e:Ft(e),t]},useSyncExternalStore:Ht,useId:kn,useHostTransitionStatus:On,useFormState:an,useActionState:an,useOptimistic:function(e,t){return Yt(Nt(),Xl,e,t)},useMemoCache:Lt,useCacheRefresh:An};su.useEffectEvent=gn;var cu={readContext:Se,use:It,useCallback:Sn,useContext:Se,useEffect:mn,useImperativeHandle:bn,useInsertionEffect:_n,useLayoutEffect:vn,useMemo:Cn,useReducer:Vt,useRef:un,useState:function(){return Vt(Rt)},useDebugValue:xn,useDeferredValue:function(e,t){var n=Nt();return Xl===null?wn(n,e,t):Tn(n,Xl.memoizedState,e,t)},useTransition:function(){var e=Vt(Rt)[0],t=Nt().memoizedState;return[typeof e==`boolean`?e:Ft(e),t]},useSyncExternalStore:Ht,useId:kn,useHostTransitionStatus:On,useFormState:cn,useActionState:cn,useOptimistic:function(e,t){var n=Nt();return Xl===null?(n.baseState=e,[e,n.queue.dispatch]):Yt(n,Xl,e,t)},useMemoCache:Lt,useCacheRefresh:An};cu.useEffectEvent=gn;var lu={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ji(),i=ot(r);i.payload=t,n!=null&&(i.callback=n),t=st(e,i,r),t!==null&&(Ni(t,e,r),ct(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ji(),i=ot(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=st(e,i,r),t!==null&&(Ni(t,e,r),ct(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ji(),r=ot(n);r.tag=2,t!=null&&(r.callback=t),t=st(e,r,n),t!==null&&(Ni(t,e,n),ct(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=Se(gl),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Se(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,U=null,od=0,sd=null;return B.attemptContinuousHydration=function(e){if(e.tag===13||e.tag===31){var t=tt(e,67108864);t!==null&&Ni(t,e,67108864),ja(e,67108864)}},B.attemptHydrationAtCurrentPriority=function(e){if(e.tag===13||e.tag===31){var t=ji();t=O(t);var n=tt(e,t);n!==null&&Ni(n,e,t),ja(e,t)}},B.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}Oe(e),!(Au&6)&&(Zu=kc()+500,ke(0,!1))}}break;case 31:case 13:t=tt(e,2),t!==null&&Ni(t,e,2),Ri(),ja(e,2)}},B.batchedUpdates=function(e,t){return e(t)},B.createComponentSelector=function(e){return{$$typeof:Cu,value:e}},B.createContainer=function(e,t,n,r,i,a,o,s,c,l){return Ea(e,t,!1,null,n,r,a,null,o,s,c,l)},B.createHasPseudoClassSelector=function(e){return{$$typeof:wu,value:e}},B.createHydrationContainer=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p){return e=Ea(n,r,!0,e,i,a,s,p,c,l,u,d),e.context=Da(null),n=e.current,r=ji(),r=O(r),i=ot(r),i.callback=t??null,st(n,i,r),t=r,e.current.lanes=t,S(e,t),Oe(e),e},B.createPortal=function(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ia,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}},B.createRoleSelector=function(e){return{$$typeof:Tu,value:e}},B.createTestNameSelector=function(e){return{$$typeof:Eu,value:e}},B.createTextSelector=function(e){return{$$typeof:Du,value:e}},B.defaultOnCaughtError=function(e){console.error(e)},B.defaultOnRecoverableError=function(e){zc(e)},B.defaultOnUncaughtError=function(e){zc(e)},B.deferredUpdates=function(e){var t=Qa.T,n=So();try{return xo(32),Qa.T=null,e()}finally{xo(n),Qa.T=t}},B.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)}},B.findAllNodes=Ai,B.findBoundingRects=function(e,t){if(!Ro)throw Error(r(363));t=Ai(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},B.findHostInstance=Oa,B.findHostInstanceWithNoPortals=function(e){return e=o(e),e=e===null?null:c(e),e===null?null:no(e.stateNode)},B.findHostInstanceWithWarning=function(e){return Oa(e)},B.flushPassiveEffects=oa,B.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)&&ke(0,!1)}},B.flushSyncWork=Ri,B.focusWithin=function(e,t){if(!Ro)throw Error(r(363));for(e=Ei(e),t=ki(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},B.getFindAllNodesFailureDescription=function(e,t){if(!Ro)throw Error(r(363));var n=0,i=[];e=[Ei(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))&&(Di(o,l)&&(i.push(Oi(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(Oi(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},B.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}},B.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},B.isAlreadyRendering=function(){return!!(Au&6)},B.observeVisibleRects=function(e,t,n,i){if(!Ro)throw Error(r(363));e=Ai(e,t);var a=Go(e,n,i).disconnect;return{disconnect:function(){a()}}},B.shouldError=function(){return null},B.shouldSuspend=function(){return!1},B.startHostTransition=function(e,t,i,a){if(e.tag!==5)throw Error(r(476));var o=Dn(e).queue;En(e,o,t,No,i===null?n:function(){var t=Dn(e);return t.next===null&&(t=e.alternate.memoizedState),Pn(e,t.next.queue,{},ji()),i(a)})},B.updateContainer=function(e,t,n,r){var i=t.current,a=ji();return ka(i,a,e,t,n,r),a},B.updateContainerSync=function(e,t,n,r){return ka(t.current,2,e,t,n,r),2},B},t.exports.default=t.exports,Object.defineProperty(t.exports,"__esModule",{value:!0})})),ip=n(((e,t)=>{t.exports=rp()})),ap=n((e=>{e.ConcurrentRoot=1,e.DefaultEventPriority=32,e.DiscreteEventPriority=2})),op=n(((e,t)=>{t.exports=ap()})),sp=t(ip()),cp=op(),lp={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0},up=!1,dp=!1,fp=`.react-konva-event`,pp=!1,mp=`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
|
+
`,hp=`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
|
+
`,gp={},_p=()=>{};function vp(e){_p=e}var yp=!1;function bp(e){return function(...t){let n=e.apply(this,t);if(!yp){yp=!0;try{_p()}finally{yp=!1}}return n}}function xp(e,t,n=gp){if(!up&&`zIndex`in t&&(console.warn(hp),up=!0),!dp&&t.draggable){var r=t.x!==void 0||t.y!==void 0,i=t.onDragEnd||t.onDragMove;r&&!i&&(console.warn(mp),dp=!0)}for(var a in n)if(!lp[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+fp)}t.hasOwnProperty(a)||e.setAttr(a,void 0)}var l=pp||t._useStrictMode,u={},d=!1;let f={};for(var a in t)if(!lp[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),Sp(e)),f)e.off(c+fp),e.on(c+fp,bp(f[c]))}function Sp(e){if(!i.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}var Cp=e({HostTransitionContext:()=>wm,NotPendingTransition:()=>null,afterActiveInstanceBlur:()=>sm,appendChild:()=>Wp,appendChildToContainer:()=>Gp,appendInitialChild:()=>Dp,beforeActiveInstanceBlur:()=>om,cancelTimeout:()=>Vp,clearContainer:()=>rm,commitMount:()=>Zp,commitTextUpdate:()=>Xp,commitUpdate:()=>Qp,createInstance:()=>Op,createTextInstance:()=>kp,detachDeletedInstance:()=>im,finalizeInitialChildren:()=>Ap,getChildHostContext:()=>zp,getCurrentEventPriority:()=>cm,getCurrentUpdatePriority:()=>fm,getInstanceFromNode:()=>am,getInstanceFromScope:()=>um,getPublicInstance:()=>jp,getRootHostContext:()=>Rp,hideInstance:()=>$p,hideTextInstance:()=>em,idlePriority:()=>Tf.unstable_IdlePriority,insertBefore:()=>Kp,insertInContainerBefore:()=>qp,isPrimaryRenderer:()=>!1,maySuspendCommit:()=>ym,noTimeout:()=>-1,now:()=>Tf.unstable_now,preloadInstance:()=>bm,prepareForCommit:()=>Mp,preparePortalMount:()=>Np,prepareScopeUpdate:()=>lm,prepareUpdate:()=>Pp,removeChild:()=>Jp,removeChildFromContainer:()=>Yp,requestPostPaintCallback:()=>vm,resetAfterCommit:()=>Fp,resetFormInstance:()=>Tm,resetTextContent:()=>Ip,resolveEventTimeStamp:()=>_m,resolveEventType:()=>gm,resolveUpdatePriority:()=>pm,run:()=>Tf.unstable_runWithPriority,scheduleMicrotask:()=>Hp,scheduleTimeout:()=>Bp,setCurrentUpdatePriority:()=>dm,shouldAttemptEagerTransition:()=>mm,shouldDeprioritizeSubtree:()=>Lp,shouldSetTextContent:()=>Up,startSuspendingCommit:()=>xm,supportsHydration:()=>!1,supportsMicrotasks:()=>!0,supportsMutation:()=>!0,supportsPersistence:()=>!1,suspendInstance:()=>Sm,trackSchedulerEvent:()=>hm,unhideInstance:()=>tm,unhideTextInstance:()=>nm,waitForCommitToBeReady:()=>Cm,warnsIfNotActing:()=>!1}),wp={},Tp={};np.Node.prototype._applyProps=xp;var Ep=cp.DefaultEventPriority;function Dp(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),Sp(e)}function Op(e,t,n){let r=np[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`),np.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 xp(s,a),s}function kp(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function Ap(e,t,n){return!1}function jp(e){return e}function Mp(){return null}function Np(){return null}function Pp(e,t,n,r){return Tp}function Fp(){}function Ip(e){}function Lp(e,t){return!1}function Rp(){return wp}function zp(){return wp}var Bp=setTimeout,Vp=clearTimeout,Hp=typeof queueMicrotask==`function`?queueMicrotask:e=>Promise.resolve(null).then(e);function Up(e,t){return!1}function Wp(e,t){t.parent===e?t.moveToTop():e.add(t),Sp(e)}function Gp(e,t){t.parent===e?t.moveToTop():e.add(t),Sp(e)}function Kp(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),Sp(e)}function qp(e,t,n){Kp(e,t,n)}function Jp(e,t){t.destroy(),t.off(fp),Sp(e)}function Yp(e,t){t.destroy(),t.off(fp),Sp(e)}function Xp(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function Zp(e,t,n){}function Qp(e,t,n,r){xp(e,r,n)}function $p(e){e.hide(),Sp(e)}function em(e){}function tm(e,t){(t.visible==null||t.visible)&&e.show()}function nm(e,t){}function rm(e){}function im(){}function am(){return null}function om(){}function sm(){}function cm(){return cp.DefaultEventPriority}function lm(){}function um(){return null}function dm(e){Ep=e}function fm(){return Ep}function pm(){return cp.DiscreteEventPriority}function mm(){return!1}function hm(){}function gm(){return null}function _m(){return-1.1}function vm(){}function ym(){return!1}function bm(){return!0}function xm(){}function Sm(){}function Cm(){return null}var wm=k.createContext(null);function Tm(){}typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`)?k.useLayoutEffect:k.useEffect;function Em(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){let e=Em(r,t,n);if(e)return e;r=t?null:r.sibling}}function Dm(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}var Om=Dm(k.createContext(null)),km=class extends k.Component{render(){return k.createElement(Om.Provider,{value:this._reactInternals},this.props.children)}};function Am(){let e=k.useContext(Om);if(e===null)throw Error(`its-fine: useFiber must be called within a <FiberProvider />!`);let t=k.useId();return k.useMemo(()=>{for(let n of[e,e?.alternate]){if(!n)continue;let e=Em(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 jm=Symbol.for(`react.context`),Mm=e=>typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===jm;function Nm(){let e=Am(),[t]=k.useState(()=>new Map);t.clear();let n=e;for(;n;){let e=n.type;Mm(e)&&e!==Om&&!t.has(e)&&t.set(e,k.use(Dm(e))),n=n.return}return t}function Pm(){let e=Nm();return k.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>k.createElement(t,null,k.createElement(n.Provider,{...r,value:e.get(n)})),e=>k.createElement(km,{...e})),[e])}function Fm(e){let t=k.useRef({});return k.useLayoutEffect(()=>{t.current=e}),k.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}var Im=()=>{let e=k.useRef(0);return k.useMemo(()=>{e.current++},[]),e.current>1},Lm=e=>{let t=k.useRef(null),n=k.useRef(null),r=k.useRef(null),i=Fm(e),a=Pm(),o=k.useRef(null),s=t=>{let{forwardedRef:n}=e;n&&(typeof n==`function`?n(t):n.current=t)},c=Im(),l=()=>{s(null),Xm.flushSyncFromReconciler(()=>{Xm.updateContainer(null,r.current,null)}),n.current?.destroy(),n.current=null};return k.useLayoutEffect(()=>(o.current&&=(clearTimeout(o.current),null),n.current?s(n.current):(n.current=new np.Stage({width:e.width,height:e.height,container:t.current}),s(n.current),r.current=Xm.createContainer(n.current,cp.ConcurrentRoot,null,!1,null,``,console.error,console.error,console.error,null),Xm.updateContainer(k.createElement(a,{},e.children),r.current,null,()=>{})),()=>{c?o.current=setTimeout(l,0):l()}),[]),k.useLayoutEffect(()=>{s(n.current),xp(n.current,e,i),Xm.updateContainer(k.createElement(a,{},e.children),r.current,null),Xm.flushSyncWork()}),k.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})},Rm=`Layer`,zm=`Group`,Bm=`Label`,Vm=`Rect`,Hm=`Circle`,Um=`Line`,Wm=`Image`,Gm=`Text`,Km=`TextPath`,qm=`Path`,Jm=`Shape`,Ym=`Transformer`,Xm=(0,sp.default)(Cp);vp(()=>Xm.flushSyncWork());var Zm=k.forwardRef((e,t)=>k.createElement(km,{},k.createElement(Lm,{...e,forwardedRef:t}))),Qm=t(n(((e,t)=>{var n=x();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]}}))()),$m=20,eh=new s.Group;eh.add(new s.Rect({width:$m,height:$m,fill:`white`})),eh.add(new s.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 th=eh.toCanvas({pixelRatio:2,width:$m,height:$m}),nh={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:th,fillPatternScaleX:20/$m/2,fillPatternScaleY:20/$m/2,fillPriority:`pattern`,fillPatternRepeat:`no-repeat`})}},rh={anchorFill:`rgb(240, 240, 240)`,anchorStrokeWidth:2,borderStrokeWidth:2},ih={anchorSize:20,anchorCornerRadius:10,anchorStrokeWidth:2,borderStrokeWidth:2},ah={stroke:`rgb(0, 161, 255)`,strokeWidth:2},oh={stroke:`rgb(0, 161, 255)`,strokeWidth:1,dash:[4,6]},sh={fill:`rgba(0, 161, 255, 0.3)`,stroke:`rgb(0, 161, 255)`,strokeWidth:1},ch={fill:`rgb(0, 161, 255)`,textFill:`white`},lh={stroke:`rgb(0, 161, 255)`,labelFill:`rgb(0, 161, 255)`,labelTextFill:`white`},uh={fill:`rgba(124, 173, 212, 0.8)`,textFill:`white`},dh={fill:`rgba(223, 102, 102, 0.8)`,textFill:`white`},fh={stroke:`red`},ph={backgroundColor:`#e8e8e8`,textColor:`grey`,borderColor:`grey`,borderSize:1,tickColor:`grey`,tickSize:1},mh=`rgba(255, 0, 0, 0.1)`;function hh(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 gh(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??mh,transparencyBackgroundColor:e.transparencyBackgroundColor,transformerStyle:hh(nh,e.transformerStyle),innerImageCropTransformerStyle:hh(rh,e.innerImageCropTransformerStyle),outerImageCropTransformerStyle:hh(ih,e.outerImageCropTransformerStyle),highlighterStyle:hh(ah,e.highlighterStyle),snapGuideStyle:hh(oh,{stroke:e.snapGuideStroke,strokeWidth:e.snapGuideStrokeWidth,dash:e.snapGuideDash}),selectionRectStyle:hh(sh,{fill:e.selectionRectFill,stroke:e.selectionRectStroke,strokeWidth:e.selectionRectStrokeWidth}),transformLabelStyle:hh(ch,{fill:e.transformLabelFill,textFill:e.transformLabelTextFill}),distanceGuideStyle:hh(lh,{stroke:e.distanceGuideStroke,labelFill:e.distanceLabelFill,labelTextFill:e.distanceLabelTextFill}),mediaLoadingStyle:hh(uh,e.mediaLoadingStyle),mediaErrorStyle:hh(dh,e.mediaErrorStyle),textOverflowIndicatorStyle:hh(fh,e.textOverflowIndicatorStyle),rulerStyle:hh(ph,{backgroundColor:e.rulerBackgroundColor,textColor:e.rulerTextColor,borderColor:e.rulerBorderColor,borderSize:e.rulerBorderSize,tickColor:e.rulerTickColor,tickSize:e.rulerTickSize})}}var _h=k.createContext(null),vh=_h.Provider;function yh(){return k.useContext(_h)||gh()}var bh=0,xh=new Set;function Sh(e){return xh.add(e),()=>{xh.delete(e)}}function Ch(){return bh}function wh(e){let t=k.useSyncExternalStore(Sh,Ch,Ch),n=k.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(!Th(e[r],t[r]))return!1;return!0}(n.current.overrides,e)||(n.current={overrides:e,revision:t,resolved:gh(e)}),n.current.resolved}function Th(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 Eh=`warn`;function Dh(e){Eh=e}function Oh(){return Eh}var kh;(function(e){e.afterCreate=`afterCreate`,e.afterAttach=`afterAttach`,e.afterCreationFinalization=`afterCreationFinalization`,e.beforeDetach=`beforeDetach`,e.beforeDestroy=`beforeDestroy`})(kh||={});var Ah=function(e,t){return Ah=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])},Ah(e,t)};function jh(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);Ah(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Mh=function(){return Mh=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},Mh.apply(this,arguments)};function Nh(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 Ph(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 Fh(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 Ih(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 Lh(e){return Yg(e,1),Xg(e).type}function Rh(e,t){return Yg(e,1),j_(t,2),Xg(e).onSnapshot(t)}function zh(e,t){Yg(e,1),A_(t,function(e){return typeof e==`object`},`object or array`,2),Xg(e).applyPatches(d_(t))}function Bh(e,t){return Yg(e,1),Xg(e).applySnapshot(t)}function Vh(e,t){t===void 0&&(t=!0),Yg(e,1);var n=Xg(e);return t?n.snapshot:g_(n.type.getSnapshot(n,!1))}function Hh(e,t){t===void 0&&(t=1),Yg(e,1),M_(t,2,0);for(var n=t,r=Xg(e).parent;r;){if(--n===0)return r.storedValue;r=r.parent}throw new G(`Failed to find the parent of ${Xg(e)} at depth ${t}`)}function Uh(e,t){Yg(e,1),_g(t,2);for(var n=Xg(e).parent;n;){if(t.is(n.storedValue))return!0;n=n.parent}return!1}function Wh(e,t){Yg(e,1),_g(t,2);for(var n=Xg(e).parent;n;){if(t.is(n.storedValue))return n.storedValue;n=n.parent}throw new G(`Failed to find the parent of ${Xg(e)} of a given type`)}function Gh(e){return Yg(e,1),Xg(e).root.storedValue}function Kh(e){return Yg(e,1),Xg(e).path}function qh(e,t){Yg(e,1),N_(t,2);var n=$g(Xg(e),t);return n?n.value:void 0}function Jh(e){return Yg(e,1),Xg(e).identifier}function Yh(e){return Yg(e,1),Xg(e).detach(),e}function Xh(e){Yg(e,1);var t=Xg(e);t.isRoot?t.die():t.parent.removeChild(t.subpath)}function Zh(e){return Yg(e,1),Xg(e).observableIsAlive}function Qh(e){return e}var $h=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:qg.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 C_,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||=Xe(`path`),this.pathAtom.reportObserved()),this.parent?(this._escapedSubpath===void 0&&(this._escapedSubpath=this._subpath?z_(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!==qg.DEAD},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDetaching",{get:function(){return this.state===qg.DETACHING},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"observableIsAlive",{get:function(){return this.aliveAtom||=Xe(`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(k_()&&!this.isAlive)throw new G(`assertion failed: cannot finalize the creation of a node that is already dead`);if(this.state===qg.CREATED){if(this.parent){if(this.parent.state!==qg.FINALIZED)return;this.fireHook(kh.afterAttach)}this.state=qg.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=qg.DEAD}}),Object.defineProperty(e.prototype,"baseAboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.fireHook(kh.beforeDestroy)}}),e}(),eg=function(e){jh(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=qg.DEAD,e}return o.state=qg.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(k_()){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 g_(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===qg.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}($h);eg.prototype.die=fr(eg.prototype.die);var tg=1,ng;(function(e){e[e.UNINITIALIZED=0]=`UNINITIALIZED`,e[e.CREATING=1]=`CREATING`,e[e.CREATED=2]=`CREATED`})(ng||={});var rg;(function(e){e.Dispose=`dispose`,e.Patch=`patch`,e.Snapshot=`snapshot`})(rg||={});var ig={onError:function(e){throw e}},ag=function(e){jh(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:++tg}),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:ng.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=nn(function(){return g_(o.getSnapshot())}),o.unbox=o.unbox.bind(o),o._initialSnapshot=g_(a),o.identifierAttribute=t.identifierAttribute,n||(o.identifierCache=new Ug),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=my(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===ng.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),k_()&&this.state!==qg.INITIALIZING)throw new G(`assertion failed: the creation of the observable instance must be done on the initializing phase`);this._observableInstanceState=ng.CREATING;for(var a=[],o=this.parent;o&&o._observableInstanceState===ng.UNINITIALIZED;)a.unshift(o),o=o.parent;try{for(var s=Ph(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=qg.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=ng.CREATED,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=i_,this.state=qg.CREATED,e){this.fireHook(kh.afterCreate),this.finalizeCreation();try{for(var d=Ph(a.reverse()),f=d.next();!f.done;f=d.next()){var l=f.value;l.fireHook(kh.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(kh.beforeDetach);var e=this.state;this.state=qg.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(k_()){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(kh.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`&&(mr?mr(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===ng.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=Oh();if(!this.isAlive&&t!==`ignore`){var n=this._getAssertAliveError(e);switch(t){case`error`:throw new G(n);case`warn`:D_(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&&z_(e.subpath)||``,r=e.actionContext||bg();r&&r.type!==`action`&&r.parentActionEvent&&(r=r.parentActionEvent);var i=``;return r&&r.name!=null&&(i=`${r&&r.context&&Kh(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===ng.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(i_),this._autoUnbox=!1;try{return this._observableInstanceState===ng.CREATED?this.type.getChildren(this):t_(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=Ph(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(kh.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=wg(this.storedValue,`@APPLY_PATCHES`,function(t){t.forEach(function(t){if(!t.path){e.type.applySnapshot(e,t.value);return}var n=H_(t.path);e_(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)})}),this._applySnapshot=wg(this.storedValue,`@APPLY_SNAPSHOT`,function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)}),b_(this.storedValue,`$treenode`,this),b_(this.storedValue,`toJSON`,Qg)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){!this.isAlive||this.state===qg.DETACHING||(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._observableInstanceState!==ng.UNINITIALIZED&&(this.getChildren().forEach(function(e){e.aboutToDie()}),this.baseAboutToDie(),this._internalEventsEmit(rg.Dispose),this._internalEventsClear(rg.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(rg.Snapshot,e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit(rg.Snapshot,e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister(rg.Patch,e)}}),Object.defineProperty(t.prototype,"hasPatchSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._internalEventsHasSubscribers(rg.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(rg.Patch)){var n=Fh(F_(f_({},e,{path:t.path.substr(this.path.length)+(e.path?`/`+e.path:``)})),2),r=n[0],i=n[1];this._internalEventsEmit(rg.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(rg.Dispose,e)}}),Object.defineProperty(t.prototype,"addDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this.hasDisposer(e)){this._internalEventsRegister(rg.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(rg.Dispose,e))throw new G(`cannot remove a disposer which was never registered for execution`);this._internalEventsUnregister(rg.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=yr(function(){return e.snapshot},function(t){return e.emitSnapshot(t)},ig);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 C_,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,Ih([e],Fh(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}($h);ag.prototype.createObservableInstance=fr(ag.prototype.createObservableInstance),ag.prototype.detach=fr(ag.prototype.detach),ag.prototype.die=fr(ag.prototype.die);var og,sg;(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`})(sg||={});var cg=`cannotDetermine`,lg=Symbol(`$type`),ug=function(){function e(e){Object.defineProperty(this,og,{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 zg(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(Zg(e)){var n=Lh(e);return this.isAssignableFrom(n)?Ig():Lg(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}();og=lg,ug.prototype.create=fr(ug.prototype.create);var dg=function(e){jh(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===my(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||Jg(t)&&Xg(t)===e?!0:e.type===this&&m_(t)&&!Jg(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(),Jg(t)&&this.isAssignableFrom(Lh(t))){var i=Xg(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}(ug);dg.prototype.create=fr(dg.prototype.create);var fg=function(e){jh(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}(ug);function pg(e,t,n){var r=t.getReconciliationType(),i=r===mg(e);return t instanceof ag&&i&&r instanceof dg&&m_(n)&&!Jg(n)&&r.isMatchingSnapshotId(t,n)}function mg(e){var t=e.getSubTypes();return!t||Array.isArray(t)||t===cg||!hg(e)?e:mg(t)}function hg(e){var t=sg.Optional|sg.Late,n=sg.Refinement|sg.SnapshotProcessor|sg.Union;return(e.flags&t)>0&&(e.flags&n)===0}function gg(e){return typeof e==`object`&&e&&e.isType===!0}function _g(e,t){A_(e,gg,`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 vg=1,yg;function bg(){return yg}function xg(){return vg++}function Sg(e,t){var n=Xg(e.context);e.type===`action`&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=yg,a=!i;yg=e;try{return Eg(n,e,t,a)}finally{yg=i,n._isRunningAction=r}}function Cg(e){if(e)return e.type===`action`?e:e.parentActionEvent}function wg(e,t,n){var r=function(){var r=xg(),i=yg,a=Cg(i);return Sg({type:`action`,name:t,id:r,args:w_(arguments),context:e,tree:Gh(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?Ih(Ih([],Fh(i.allParentIds),!1),[i.id],!1):[],parentEvent:i,parentActionEvent:a},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var Tg=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 Eg(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?fr(t.name,i)():fr(i)()}var a=new Tg(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&&kh[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),k_()){if(!l&&!d){var p=Xg(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=Xg(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 Dg=Mh({},{enabled:!1,indent:2,maxStringLength:100,maxArrayLength:10,maxPropertyCount:30,maxDepth:5});function Og(){return Mh({},Dg)}function kg(e,t){try{return JSON.stringify(e,null,t)}catch(e){return`<Unserializable: ${e}>`}}function Ag(e){return e.length<280?e:`${e.substring(0,272)}......${e.substring(e.length-8)}`}function jg(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 jg(e,t+1,n)});return e.length>n.maxArrayLength&&r.push(`… ${e.length-n.maxArrayLength} more items`),r}if(p_(e)){if(t>=n.maxDepth)return`{…}`;var i={},a=Object.keys(e);return a.slice(0,n.maxPropertyCount).forEach(function(r){i[r]=jg(e[r],t+1,n)}),a.length>n.maxPropertyCount&&(i[`…`]=`${a.length-n.maxPropertyCount} more keys`),i}return e}function Mg(e){if(typeof e==`function`)return`<function${e.name?` `+e.name:``}>`;if(Jg(e))return`<${e}>`;var t=Og();return t.enabled?`\`${kg(jg(e,0,t),t.indent||void 0)}\``:`\`${kg(e)}\``}function Ng(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 Pg(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=Jg(t)?`value of type ${Xg(t).type.name}:`:h_(t)?`value`:`snapshot`,o=n&&Jg(t)&&n.is(Xg(t).snapshot),s=Og();return`${i}${a} ${Mg(t)} is not assignable ${n?`to type: \`${n.name}\``:``}`+(e.message?` (${e.message})`:``)+(n?Av(n)||h_(t)?`.`:`, expected an instance of \`${n.name}\` or a snapshot like \`${function(e){return s.enabled?Ng(e.describe(),s.indent):e.describe()}(n)}\` instead.`+(o?` (Note that a snapshot of the provided value is compatible with the targeted type)`:``):`.`)}function Fg(e,t,n){return e.concat([{path:t,type:n}])}function Ig(){return r_}function Lg(e,t,n){return[{context:e,value:t,message:n}]}function Rg(e){return e.reduce(function(e,t){return e.concat(t)},[])}function zg(e,t){O_()&&Bg(e,t)}function Bg(e,t){var n=e.validate(t,[{path:``,type:e}]);if(n.length>0)throw new G(Vg(e,t,n))}function Vg(e,t,n){if(n.length!==0){var r=Mg(t);return`Error while converting ${Og().enabled?r:Ag(r)} to \`${e.name}\`:
|
|
96
|
+
|
|
97
|
+
`+n.map(Pg).join(`
|
|
98
|
+
`)}}var Hg=0,Ug=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Hg++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Zt.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Zt.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,Zt.array([],a_));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;Jr(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 Yr(this.cache).forEach(function(e){for(var a=Fh(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 Wg(e,t,n,r,i){var a=Zg(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 ag(e,t,n,r,i)}function Gg(e,t,n,r,i){return new eg(e,t,n,r,i)}function Kg(e){return e instanceof eg||e instanceof ag}var qg;(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`})(qg||={});function Jg(e){return!!(e&&e.$treenode)}function Yg(e,t){A_(e,Jg,`mobx-state-tree node`,t)}function Xg(e){if(!Jg(e))throw new G(`Value ${e} is no MST Node`);return e.$treenode}function Zg(e){return e&&e.$treenode||null}function Qg(){return Xg(this).snapshot}function $g(e,t,n){return n===void 0&&(n=!0),e_(e,H_(t),n)}function e_(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 eg){var o=r.value;Jg(o)&&(r=Xg(o))}if(r instanceof ag&&r.getChildType(a)&&(r=r.getChildNode(a),r))continue}throw new G(`Could not resolve '${a}' in path '${V_(t.slice(0,i))||`/`}' while resolving '${V_(t)}'`)}}catch(e){if(!n)return;throw e}return r}function t_(e){if(!e)return r_;var t=Object.keys(e);if(!t.length)return r_;var n=Array(t.length);return t.forEach(function(t,r){n[r]=e[t]}),n}var n_=Object.toString(),r_=Object.freeze([]),i_=Object.freeze({}),a_=Ln().useProxies?{deep:!1}:{deep:!1,proxy:!1};Object.freeze(a_);var G=function(e){jh(t,e);function t(t){return t===void 0&&(t=`Illegal state`),e.call(this,`[mobx-state-tree] ${t}`)||this}return t}(Error);function o_(e){return e}var s_=Number.isInteger;function c_(e){return Number(e)===e&&e%1!=0}function l_(e){return Number.isFinite(e)}function u_(e){return Array.isArray(e)||Di(e)}function d_(e){return e?u_(e)?e:[e]:r_}function f_(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 p_(e){if(typeof e!=`object`||!e)return!1;var t=Object.getPrototypeOf(e);return t==null||t.constructor?.toString()===n_}function m_(e){return typeof e==`object`&&!!e&&!(e instanceof Date)&&!(e instanceof RegExp)}function h_(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 g_(e){return k_()?h_(e)||Di(e)?e:Object.freeze(e):e}function __(e){return k_()?(g_(e),p_(e)&&Object.keys(e).forEach(function(t){!h_(e[t])&&!Object.isFrozen(e[t])&&__(e[t])}),e):e}function v_(e){return typeof e!=`function`}function y_(e,t,n){Gi(e)?Zr(e,t,n):Object.defineProperty(e,t,n)}function b_(e,t,n){y_(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function x_(e,t,n){y_(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}var S_=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,Ih([],Fh(e),!1))})}}),e}(),C_=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 S_,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,Ih([],Fh(n),!1))}}),e}();function w_(e){for(var t=Array(e.length),n=0;n<e.length;n++)t[n]=e[n];return t}function T_(e,t){return e.indexOf(t)===0}var E_=function(e,t){k_()&&(E_.ids&&!E_.ids.hasOwnProperty(e)&&D_(`Deprecation warning: `+t),E_.ids&&(E_.ids[e]=!0))};E_.ids={};function D_(e){console.warn(Error(`[mobx-state-tree] ${e}`))}function O_(){return k_()||typeof process<`u`&&{}.ENABLE_TYPE_CHECK===`true`}function k_(){return!1}function A_(e,t,n,r){if(k_()&&!t(e))throw new G(`expected ${n} as argument ${d_(r).join(` or `)}, got ${e} instead`)}function j_(e,t){A_(e,function(e){return typeof e==`function`},`function`,t)}function M_(e,t,n,r){A_(e,function(e){return typeof e==`number`},`number`,t),n!==void 0&&A_(e,function(e){return e>=n},`number greater than ${n}`,t),r!==void 0&&A_(e,function(e){return e<=r},`number lesser than ${r}`,t)}function N_(e,t,n){n===void 0&&(n=!0),A_(e,function(e){return typeof e==`string`},`string`,t),n||A_(e,function(e){return e!==``},`not empty string`,t)}function P_(e){typeof queueMicrotask==`function`?queueMicrotask(e):typeof setImmediate==`function`?setImmediate(e):setTimeout(e,1)}function F_(e){if(!(`oldValue`in e))throw new G("Patches without `oldValue` field cannot be inversed");return[I_(e),L_(e)]}function I_(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 L_(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 R_(e){return typeof e==`number`}function z_(e){return R_(e)===!0?``+e:e.indexOf(`/`)===-1&&e.indexOf(`~`)===-1?e:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function B_(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function V_(e){if(e.length===0)return``;var t=function(e){return e.map(z_).join(`/`)};return e[0]===`.`||e[0]===`..`?t(e):`/`+t(e)}function H_(e){var t=e.split(`/`).map(B_);if(!(e===``||e===`.`||e===`..`||T_(e,`/`)||T_(e,`./`)||T_(e,`../`)))throw new G(`a json path must be either rooted, empty or relative, but got '${e}'`);return t[0]===``&&t.shift(),t}var U_=Symbol(`$preProcessorFailed`),W_=function(e){jh(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|sg.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 U_}}}),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;G_(e.type,this,`create`),e instanceof ag&&(e.hasSnapshotPostProcessor=!!this._processors.postProcessor);var n=e.getSnapshot;e.getSnapshot=function(){return t.postProcessSnapshot(n.call(e),e)},Rv(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=Jg(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,Jg(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===U_?Lg(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=gg(e)?this._subtype:Jg(e)?e:this.preProcessSnapshotSafe(e);return t!==U_&&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 dg))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(ug);function G_(e,t){for(var n,r,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];try{for(var o=Ph(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 K_(e,t,n){if(_g(e,1),k_()){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 W_(e,t,n)}var q_=`Map.put can only be used to store complex values that have an identifier type attribute`;function J_(e,t){var n,r,i=e.getSubTypes();if(i===cg)return!1;if(i){var a=d_(i);try{for(var o=Ph(a),s=o.next();!s.done;s=o.next()){var c=s.value;if(!J_(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 fv&&t.push(e),!0}var Y_;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.YES=1]=`YES`,e[e.NO=2]=`NO`})(Y_||={});var X_=function(e){jh(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(Jg(e)){var t=Xg(e);if(k_()&&!t.identifierAttribute||t.identifier===null)throw new G(q_);return this.set(t.identifier,e),e}if(m_(e)){var n=Xg(this),r=n.type;if(r.identifierMode!==Y_.YES)throw new G(q_);var i=e[r.mapIdentifierAttribute];if(!hy(i)){var a=this.put(r.getChildType().create(e,n.environment));return this.put(Vh(a))}var o=my(i);return this.set(o,e),this.get(o)}throw new G(`Map.put can only be used to store complex values`)}}),t}(ji),Z_=function(e){jh(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:Y_.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:sg.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(),Wg(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Y_.UNKNOWN){var e=[];if(J_(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=Y_.YES,this.mapIdentifierAttribute=t):this.identifierMode=Y_.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 X_(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Vr(t,e.unbox),e.type.hookInitializers.forEach(function(e){var n=e(t);Object.keys(n).forEach(function(e){var r=n[e],i=wg(t,e,r);(k_()?x_:b_)(t,e,i)})}),Hr(t,this.willChange),Qr(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 Jr(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=Xg(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;zg(i,a),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case`add`:zg(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===Y_.YES&&t instanceof ag){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=Xg(e.object);switch(e.type){case`update`:t.emitPatch({op:`replace`,path:z_(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);return;case`add`:t.emitPatch({op:`add`,path:z_(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:z_(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(!p_(t)){zg(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&&(pg(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 p_(e)?Rg(Object.keys(e).map(function(r){return n._subType.validate(e[r],Fg(t,r,n._subType))})):Lg(t,e,`Value is not a plain object`)}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return i_}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(dg);Z_.prototype.applySnapshot=fr(Z_.prototype.applySnapshot);function Q_(e){return new Z_(`Map<string, ${e.name}>`,e)}var $_=function(e){jh(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:sg.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 Wg(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=Mh(Mh({},a_),{name:this.name});return Zt.array(t_(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){ia(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=wg(t,e,r);(k_()?x_:b_)(t,e,i)})}),Hr(t,this.willChange),Qr(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=Xg(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=iv(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=iv(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=Xg(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(!u_(t)){zg(this,t);return}var i=e.storedValue,a=e.getChildren(),o=a.length,s=t.length,c=this.getChildType(),l=tv(a,t,Math.min(o,s));if(l!==o||l!==s){if(o!==s||e.hasPatchSubscribers()){i.replace(t);return}if(nv(c,a,t,l)){rv(a,t,l);return}for(var u=[],d=l;d<o;d++)a[d].snapshot!==t[d]&&u.push(d);try{for(var f=Ph(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 u_(e)?Rg(e.map(function(e,r){return n._subType.validate(e,Fg(t,``+r,n._subType))})):Lg(t,e,`Value is not an array`)}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return r_}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.splice(Number(t),1)}}),t}(dg);$_.prototype.applySnapshot=fr($_.prototype.applySnapshot);function ev(e){return _g(e,1),new $_(`${e.name}[]`,e)}function tv(e,t,n){for(var r=0;r<n&&e[r].snapshot===t[r];)r++;return r}function nv(e,t,n,r){for(var i=r;i<t.length;i++){var a=t[i];if(a.snapshot!==n[i]&&(!pg(e,a,n[i])||!a.identifierAttribute||a.identifier===null))return!1}return!0}function rv(e,t,n){for(var r=n;r<e.length;r++){var i=e[r];i.snapshot!==t[r]&&i.applySnapshot(t[r])}}function iv(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(Kg(l)&&(l=l.storedValue),!c&&!s)break;if(!s)a=!1,n.splice(o,1),c instanceof ag&&c.createObservableInstanceIfNeeded(),c.die(),o--;else if(!c){if(Jg(l)&&Xg(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 '${Xg(l).path}'`);a=!1;var d=av(t,e,u,l);n.splice(o,0,d)}else if(ov(c,l))n[o]=av(t,e,u,l,c);else{for(var f=void 0,p=o;p<n.length;p++)if(ov(n[p],l)){f=n.splice(p,1)[0];break}a=!1;var d=av(t,e,u,l,f);n.splice(o,0,d)}}return a?null:n}function av(e,t,n,r,i){zg(e,r);function a(){if(Jg(r)){var a=Xg(r);if(a.assertAlive(i_),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 ag&&i.createObservableInstanceIfNeeded(),i.die()),o}function ov(e,t){if(!e.isAlive)return!1;if(Jg(t)){var n=Xg(t);return n.isAlive&&n===e}if(e.snapshot===t)return!0;if(!(e instanceof ag))return!1;var r=e.getReconciliationType();return e.identifier!==null&&e.identifierAttribute&&p_(t)&&r.is(t)&&r.isMatchingSnapshotId(e,t)}var sv=`preProcessSnapshot`,cv=`postProcessSnapshot`;function lv(){return Xg(this).toString()}var uv={name:`AnonymousModel`,properties:{},initializers:r_};function dv(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 kh)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(h_(i))t[n]=Vv(kv(i),i);else if(i instanceof Z_)t[n]=Vv(i,{});else if(i instanceof $_)t[n]=Vv(i,[]);else if(!gg(i))throw k_()&&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?`):k_()&&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},Mh({},e))}var fv=function(e){jh(t,e);function t(t){var n=e.call(this,t.name||uv.name)||this;return Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:sg.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,uv,t),n.properties=dv(n.properties),g_(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&sg.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(!p_(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===sv)throw new G(`Cannot define action '${sv}', it should be defined using 'type.preProcessSnapshot(fn)' instead`);if(r===cv)throw new G(`Cannot define action '${cv}', it should be defined using 'type.postProcessSnapshot(fn)' instead`);var i=t[r],a=e[r];if(r in kh&&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=wg(e,r,c);t[r]=l,(k_()?x_:b_)(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(!p_(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`);Xr(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 Nh(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(!p_(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)Zr(e,r,a),mi(e,(i={},i[r]=nn,i));else if(typeof a.value==`function`)(k_()?x_:b_)(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=Jg(r)?r:this.applySnapshotPreProcessor(r);return Wg(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=Mh(Mh({},a_),{name:this.name});return Zt.object(e,i_,t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){b_(t,`toString`,lv),this.forAllProps(function(n){Vr(t,n,e.unbox)}),this.initializers.reduce(function(e,t){return t(e)},t),Hr(t,this.willChange),Qr(t,this.didChange)}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e,n=Xg(t.object),r=t.name;n.assertWritable({subpath:r});var i=n.type.properties[r];return i&&(zg(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=Xg(t.object);if(n.type.properties[t.name]){var r=t.oldValue?t.oldValue.snapshot:void 0;n.emitPatch({op:`replace`,path:z_(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=ia(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){ra(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=!p_(n);(!p_(t)||r)&&(zg(this,t),r)||this.forAllProps(function(t,r){var i=e.getChildNode(t),a=n[t];if(i.snapshot!==a){if(pg(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 N_(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 p_(r)?Rg(this.propertyNames.map(function(e){return n.properties[e].validate(r[e],Fg(t,e,n.properties[e]))})):Lg(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 i_}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue[t]=void 0}}),t}(dg);fv.prototype.applySnapshot=fr(fv.prototype.applySnapshot);function pv(){var e=[...arguments];if(k_()&&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 fv({name:typeof e[0]==`string`?e.shift():`AnonymousModel`,properties:e.shift()||{}})}function mv(){var e=[...arguments],t=typeof e[0]==`string`,n=t?e[0]:`AnonymousModel`;return t&&e.shift(),k_()&&e.forEach(function(e,n){A_(e,hv,`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 hv(e){return gg(e)&&(e.flags&sg.Object)>0}var gv=function(e){jh(t,e);function t(t,n,r,i){i===void 0&&(i=o_);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 Gg(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 h_(e)&&this.checker(e)?Ig():Lg(t,e,`Value is not a ${this.name===`Date`?`Date or a unix milliseconds timestamp`:this.name}`)}}),t}(fg),_v=new gv(`string`,sg.String,function(e){return typeof e==`string`}),vv=new gv(`number`,sg.Number,function(e){return typeof e==`number`}),yv=new gv(`integer`,sg.Integer,function(e){return s_(e)}),bv=new gv(`float`,sg.Float,function(e){return c_(e)}),xv=new gv(`finite`,sg.Finite,function(e){return l_(e)}),Sv=new gv(`bigint`,sg.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)});Sv.getSnapshot=function(e){return String(e.storedValue)};var Cv=Sv,wv=new gv(`boolean`,sg.Boolean,function(e){return typeof e==`boolean`}),Tv=new gv(`null`,sg.Null,function(e){return e===null}),Ev=new gv(`undefined`,sg.Undefined,function(e){return e===void 0}),Dv=new gv(`Date`,sg.Date,function(e){return typeof e==`number`||e instanceof Date},function(e){return e instanceof Date?e:new Date(e)});Dv.getSnapshot=function(e){return e.storedValue.getTime()};var Ov=Dv;function kv(e){switch(typeof e){case`string`:return _v;case`number`:return vv;case`boolean`:return wv;case`bigint`:return Cv;case`object`:if(e instanceof Date)return Ov}throw new G(`Cannot determine primitive type from value `+e)}function Av(e){return gg(e)&&(e.flags&(sg.String|sg.Number|sg.Integer|sg.Boolean|sg.Date|sg.BigInt))>0}var jv=function(e){jh(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:sg.Literal}),n.value=t,n}return Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Gg(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 h_(e)&&e===this.value?Ig():Lg(t,e,`Value is not a literal ${JSON.stringify(this.value)}`)}}),t}(fg);function Mv(e){return A_(e,h_,`primitive`,1),new jv(e)}var Nv=function(e){jh(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|sg.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=Jg(e)?Xg(e).snapshot:e;return this._predicate(r)?Ig():Lg(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}(ug);function Pv(){var e=[...arguments],t=typeof e[0]==`string`?e.shift():gg(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 _g(n,[1,2]),N_(t,1),j_(r,[2,3]),j_(i,[3,4]),new Nv(t,n,r,i)}function Fv(e,t){var n=typeof e==`string`?t:e;k_()&&n.forEach(function(e,t){N_(e,t+1)});var r=Lv.apply(void 0,Ih([],Fh(n.map(function(e){return Mv(``+e)})),!1));return typeof e==`string`&&(r.name=e),r}var Iv=function(e){jh(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=Mh({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=sg.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 Ig();r++}else n.push(a)}return r===1?Ig():Lg(t,e,`No type is applicable for the union`).concat(Rg(n))}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._types}}),t}(ug);function Lv(e){var t=[...arguments].slice(1),n=gg(e)?void 0:e,r=gg(e)?Ih([e],Fh(t),!1):t,i=`(`+r.map(function(e){return e.name}).join(` | `)+`)`;return k_()&&(n&&A_(n,function(e){return p_(e)},`object { eager?: boolean, dispatcher?: Function }`,1),r.forEach(function(e,t){_g(e,n?t+2:t+1)})),new Iv(i,r,n)}function Rv(e){return gg(e)&&(e.flags&sg.Union)>0}var zv=function(e){jh(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|sg.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`&&zg(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Ig():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}(ug);function Bv(e,t){if(typeof t!=`function`&&Jg(t))throw new G(`default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead`);_g(e,1),k_()&&typeof t!=`function`&&zg(e,t)}function Vv(e,t,n){return Bv(e,t),new zv(e,t,n||Hv)}var Hv=[void 0],Uv=Vv(Ev,void 0),Wv=Vv(Tv,null);function Gv(e){return _g(e,1),Lv(e,Uv)}function Kv(e){return _g(e,1),Lv(e,Wv)}var qv=function(e){jh(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)|sg.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(k_()&&!gg(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):Ig()}}),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)||cg}}),t}(ug);function Jv(e,t){var n=typeof e==`string`?e:`late(${e.toString()})`,r=typeof e==`string`?t:e;if(k_()&&(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 qv(n,r)}function Yv(e,t){return new Xv(e,t)}var Xv=function(e){jh(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:sg.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Zt.array()}),ni(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(fr(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=Gg(this,e,t,n,__(r));return this.pendingNodeList.push(a),ni(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):v_(e)?Ig():Lg(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}(fg),Zv=function(e){jh(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:sg.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 Gg(this,e,t,n,__(r))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return v_(e)?this.subType?this.subType.validate(e,t):Ig():Lg(t,e,`Value is not serializable and cannot be frozen`)}}),t}(fg),Qv=new Zv;function $v(e){return arguments.length===0?Qv:gg(e)?new Zv(e):Vv(Qv,e)}function ey(e){switch(e){case kh.beforeDestroy:return`destroy`;case kh.beforeDetach:return`detach`;default:return}}var ty=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}),hy(e))this.identifier=e;else if(Jg(e)){var n=Xg(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=my(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 ny(`[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}(),ny=function(e){jh(t,e);function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return t}(Error),ry=function(e){jh(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:sg.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 hy(e)?Ig():Lg(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){zh(t.root.storedValue,{op:`replace`,value:e,path:t.path})},removeRef:function(){hv(i.type)?this.replaceRef(void 0):zh(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=Xg(r),a=function(r,a){var o=ey(a);o&&n.fireInvalidated(o,e,t,i)},o=i.registerHook(kh.beforeDetach,a),s=i.registerHook(kh.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(kh.beforeDestroy,function(){i&&i()});var a=function(){var n=function(){e.isAlive&&r.getSnapshot(e)===t&&o(!1)};bg()?e.root.enqueueEndOfAction(n):P_(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,my(t)),l?i=r.addTargetNodeWatcher(e,t):o?a():r.fireInvalidated(`invalidSnapshotReference`,e,t,null)}};e.state===qg.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(kh.afterCreationFinalization,function(){e.parent&&e.parent.createObservableInstanceIfNeeded()}),e.registerHook(kh.afterAttach,function(){o(!1)}))}}}),t}(fg),iy=function(e){jh(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=Jg(r)?Jh(r):r,a=new ty(r,this.targetType),o=Gg(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=Jg(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}(ry),ay=function(e){jh(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=Jg(r)?this.options.set(r,e?e.storedValue:null):r,a=Gg(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=Jg(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}(ry);function oy(e,t){if(_g(e,1),k_()&&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(k_()&&(!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 ay(e,{get:n.get,set:n.set},r)}return new iy(e,r)}function sy(e,t){var n=oy(e,Mh(Mh({},t),{onInvalidated:function(e){t&&t.onInvalidated&&t.onInvalidated(e),e.removeRef()}}));return t&&t.acceptsUndefined===!1?n:Gv(n)}var cy=function(e){jh(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:sg.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 fv))throw new G(`Identifier types can only be instantiated as direct child of a model type`);return Gg(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?Ig():Lg(t,e,`Value is not a valid ${this.describe()}, expected a ${this.validType}`)}}),t}(fg),ly=function(e){jh(t,e);function t(){var t=e.call(this,`identifier`,`string`)||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:sg.Identifier}),t}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return`identifier`}}),t}(cy),uy=function(e){jh(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}(cy),dy=new ly,fy=new uy,py=new(function(e){jh(t,e);function t(){var t=e.call(this,`identifierBigint`)||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:sg.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 fv))throw new G(`Identifier types can only be instantiated as direct child of a model type`);return Gg(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 Ig();if(typeof e==`string`||typeof e==`number`)try{return BigInt(e),Ig()}catch(r){var n=r instanceof Error?r.message:String(r);return Lg(t,e,`Value is not a valid ${this.describe()}: ${n}`)}return Lg(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}(fg));function my(e){return``+e}function hy(e){return typeof e==`string`||typeof e==`number`||typeof e==`bigint`}function gy(e){return new _y(e)}var _y=function(e){jh(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:sg.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 Ig();var n=this.options.getValidationMessage(e);return n?Lg(t,e,`Invalid value for type '${this.name}': ${n}`):Ig()}}),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 Gg(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}(fg),K={enumeration:Fv,model:pv,compose:mv,custom:gy,reference:oy,safeReference:sy,union:Lv,optional:Vv,literal:Mv,maybe:Gv,maybeNull:Kv,refinement:Pv,string:_v,boolean:wv,number:vv,integer:yv,float:bv,finite:xv,bigint:Cv,Date:Ov,map:Q_,array:ev,frozen:$v,identifier:dy,identifierNumber:fy,identifierBigint:py,late:Jv,lazy:Yv,undefined:Ev,null:Tv,snapshotProcessor:K_},vy=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)||!vy(e[n],t[n]))return!1;return!0}return!1};Object.assign(K);var yy=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=Vh(t);return{pages:e.pages,width:e.width,height:e.height,custom:e.custom,audios:e.audios}}function l(e){let n=!vy(t.pages.map(e=>e.id),e.pages.map(e=>e.id)),r=!vy(t.custom,e.custom);n?Bh(t.pages,e.pages):t.pages.forEach((t,n)=>{Bh(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];!vy(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=qh(e,`..`),!t)throw Error("Failed to find target store for UndoManager. Please provide `targetPath` property, or a `targetStore` in the environment");n=Rh(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}),by=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,xy=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=by[n[e]&63];return t};async function Sy(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 Cy=null;function wy(){return window.jspdf?.jsPDF?Promise.resolve(window.jspdf.jsPDF):Cy||(typeof window.__polotnoLoadJspdf==`function`?(Cy=window.__polotnoLoadJspdf().then(e=>e?.jsPDF||e),Cy):(Cy=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)}),Cy))}function Ty(){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 Ey({width:e,height:t}){return new(await(Ty()))({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 Dy=()=>`https://api.polotno.com/api`,Oy=Zt({imageDownScalingEnabled:!0,removeBackgroundEnabled:!1,htmlRenderEnabled:!1,renderTagTextEnabled:!0,forceTextFitEnabled:!1,textVerticalResizeEnabled:!1,textOverflow:`resize`,textSplitAllowed:!1,animationsEnabled:!1,aiTextEnabled:!1,autoDeleteEmptyText:!0}),ky=typeof window<`u`&&window.location.hostname===`localhost`||typeof process<`u`&&!1,Ay=fr(e=>{Oy.textVerticalResizeEnabled=e}),jy=fr(e=>{Oy.removeBackgroundEnabled=e});fr(e=>{ky&&console.warn(`useRemoveBackground is deprecated. Use setRemoveBackgroundEnabled instead.`),jy(e)}),fr(e=>{Oy.aiTextEnabled=e}),fr(e=>{ky&&console.warn(`useHtmlTextRender is deprecated. Use setRichTextEnabled instead.`),Oy.htmlRenderEnabled=e});var My=e=>fr(t=>{ky&&console.warn(`${e}() is a no-op: the new text rendering engine is enabled by default.`)}),Ny=e=>{mr(()=>{Oy.htmlRenderEnabled=!0,Oy.renderTagTextEnabled=!1})},Py=My(`setRichTextEnabled`),Fy=My(`setRenderTagTextEnabled`),Iy=fr(e=>{Oy.imageDownScalingEnabled=e});fr(e=>{console.warn(`useDownScaling is deprecated. Use setDownScalingEnabled instead.`),Iy(e)}),fr(e=>{console.warn(`setForceTextFit is deprecated. Use setTextOverflow instead.`),Oy.textOverflow=`change-font-size`});var Ly=fr(e=>{Oy.textOverflow=e}),Ry=fr(e=>{Oy.textSplitAllowed=e});fr(e=>{Oy.animationsEnabled=e}),fr(e=>{Oy.autoDeleteEmptyText=e});var zy=Zt({value:!1}),By=Zt({value:`v1`}),Vy=()=>By.value,Hy=Zt({value:0}),Uy=()=>Hy.value,Wy=()=>zy.value,Gy=fr(()=>{zy.value=!0}),Ky=``,qy=e=>{Ky=e||``},Jy=typeof window<`u`?window.location.origin:``,Yy=typeof navigator<`u`&&navigator.userAgent.indexOf(`Headless`)>-1,Xy=typeof navigator<`u`&&navigator.userAgent.indexOf(`Electron`)>-1;Jy===`file://`&&Yy&&(Jy=`headless`),Jy===`file://`&&Xy&&(Jy=`electron`);var Zy=`%cPolotno error! Current domain is not allowed. It may lead to unexpected behavior and stop working. Please add "${Jy}" here: https://polotno.com/cabinet`,Qy=fetch;async function $y(e){for(let t=0;t<5;t++)try{let t=await Qy(Dy()+`/validate-key`,{method:`POST`,body:JSON.stringify({key:e,site:location.host,skdVersion:`4.10.0`})});if(mr(()=>{By.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`),mr(()=>{Hy.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`),mr(()=>{Hy.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;`),mr(()=>{Hy.value===0&&(Hy.value=2)})),n.is_domain_valid||console.log(Zy,`background: rgba(247, 101, 68, 1); color: white; padding: 5px; margin: 5px;`),jy(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 eb(e){await $y(Ky)&&!e||Gy()}var tb=!1,nb=(e=!tb)=>{tb=e},rb=()=>tb;function ib(e,t){let n=k.useRef(void 0);k.useLayoutEffect(()=>{n.current&&n.current.destroy()},[t]),k.useLayoutEffect(()=>{if(!tb)return;let t=e.current.opacity();return t?(e.current.opacity(0),n.current=new s.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 ab=0,ob=[],sb=3e4,cb=e=>{sb=e},lb=6e3,ub=e=>{lb=e},db=()=>lb;function fb(e){ab+=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`;_b(o(r,`Timeout loading asset ${e}`,{reason:`timeout`,label:n,timeoutMs:sb})),console.error(`Timeout triggered for loader. Some assets may not have loaded.`,e),t=!0,pb()},sb);return()=>{n?console.error(`Finish called twice! That is not expected. id: `,e):(n=!0,t||(clearTimeout(r),pb()))}}function pb(){--ab,ab===0&&(ob.forEach(e=>e()),ob=[])}function mb(){return new Promise(e=>{t=()=>{rb()?setTimeout(e,300):e(!0)},ab===0?t():ob.push(t);return;var t})}var hb=[];function gb(e){hb.push(e)}function _b(e){let t=typeof e==`string`?o(`UNKNOWN`,e):e;hb.forEach(e=>e(t))}function vb(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 yb={createDOMParser:()=>typeof DOMParser<`u`?new DOMParser:vb(`DOMParser`),createXMLSerializer:()=>typeof XMLSerializer<`u`?new XMLSerializer:vb(`XMLSerializer`),createElement:e=>typeof document<`u`?document.createElement(e):vb(`document.createElement`)},bb={createDOMParser:()=>yb.createDOMParser(),createXMLSerializer:()=>yb.createXMLSerializer(),createElement:e=>yb.createElement(e)};function xb(e){return bb.createDOMParser().parseFromString(`<!DOCTYPE html><html><head></head><body>${e}</body></html>`,`text/html`)}var Sb=(e,t)=>{if(e.children)for(let n of e.children){if(t(n)===!0)break;Sb(n,t)}if(e.cells){for(let n of e.cells)if(t(n)===!0)break}};function Cb(e){return`'${String(e).replace(/([\\'])/g,`\\$1`)}'`}function wb(e){let t={};return e&&Tb(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 Tb(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 Eb(e){return Object.keys(e).map(t=>`${t}: ${e[t]};`).join(` `)}var Db=e=>e.replace(/\s*!\s*important\s*$/i,``);function Ob(e,t,n){let r=wb(e.getAttribute(`style`));n===null?delete r[t]:r[t]=n;let i=Eb(r);i?e.setAttribute(`style`,i):e.removeAttribute(`style`)}var kb={"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`},Ab={"ql-size-small":.75,"ql-size-large":1.5,"ql-size-huge":2.5};function jb(e){return e.replace(/^ql-font-/,``).split(`-`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)}function Mb(e){let t=kb[e];return t?Nb(t)||``:jb(e)}function Nb(e){let t=e.replace(/"/g,`"`).replace(/&/g,`&`).trim(),n=t.match(/^(['"])((?:\\.|(?!\1).)*)\1/);return(n?n[2]:t.split(`,`)[0].trim()).replace(/\\(.)/g,`$1`)||null}function Pb(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 Fb(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 Ib(e){return Fb(e)>=600}function Lb(e){return xb(`<div id="polotno-rich-root">${e}</div>`).getElementById(`polotno-rich-root`)}function Rb(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 zb(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`)||Rb(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=Rb(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 Bb=new Set([`SPAN`,`STRONG`,`B`,`EM`,`I`,`U`,`S`,`DEL`,`SUB`,`SUP`]);function Vb(e){if(e.tagName!==`SPAN`)return!1;for(let t of Array.from(e.attributes))if(t.value.trim())return!1;return!0}function Hb(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 Ub(e){let t=e=>{for(let n of Array.from(e.children))t(n);if(Vb(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&&Bb.has(t.tagName)&&t.tagName===e.tagName&&Hb(t,e)){for(;e.firstChild;)t.appendChild(e.firstChild);e.remove(),n(t);continue}t=e}};n(e)}function Wb(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 Gb(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=Wb(o);if(s===-1)return null;let c=Gb(o.slice(s+1).trim());if(c===null||c===``)return null;t+=c,n=a+1}return t.trim()||null}function Kb(e){let t=e.getAttribute(`style`);if(!t||!t.includes(`var(`))return;let n={};for(let[e,r]of Object.entries(wb(t))){if(!r.includes(`var(`)){n[e]=r;continue}let t=Gb(r);t!==null&&(n[e]=t)}let r=Eb(n);r?e.setAttribute(`style`,r):e.removeAttribute(`style`)}function qb(e,t){if(!e||!e.includes(`<`))return e;let n=Lb(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=kb[n];e.style.fontFamily=t??Cb(jb(n))}continue}let r=Ab[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`)}Kb(e);let i=e.style.fontSize;if(i){let n=Pb(i,t.fontSize);n!=null&&(e.style.fontSize=`${n}px`)}};r(n),Ub(n),zb(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 Jb(e){let t=new Set;if(!e||!e.includes(`<`))return[];let n=Lb(e);if(n){let e=n.querySelectorAll(`[style]`);for(let n of e)if(n.style.fontFamily){let e=Nb(n.style.fontFamily);e&&t.add(e)}}for(let n of e.matchAll(/\bfont-family="([^"]+)"/g)){let e=Nb(n[1]);e&&t.add(e)}for(let n of e.matchAll(/\bql-font-([a-z0-9_-]+)\b/gi)){let e=Mb(`ql-font-${n[1]}`);e&&t.add(e)}return[...t]}function Yb(e,t){if(!e||t===1||t<=0||!Number.isFinite(t))return e;let n=Lb(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 Xb(e){if(!e||!e.includes(`<`))return!1;let t=Lb(e);if(!t)return!1;for(let e of t.querySelectorAll(`[style]`))if(e.style.fontSize)return!0;return!1}function Zb(e){let t=[];return Sb({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 Jb(e.text))t.indexOf(n)===-1&&t.push(n)}),t}function Qb(e){return{...Af,...e}}function $b(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 ex(e){return typeof e.height==`number`&&e.height>0}function tx(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 nx(e){let t=e.lineHeight;return typeof t==`number`?isFinite(t)?t:null:typeof t==`string`?tx(t):null}function rx(e){return nx(e)??Af.lineHeight}function ix(e,t){return ex(e)?e.height:t}function ax(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(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/ /g,` `)}function ox(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 sx(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 cx=e=>/<[a-z][\s\S]*>|&[a-z]+;|&#x?[0-9a-f]+;/i.test(e),lx=e=>(e.tagName||``).toLowerCase(),ux=(e,t)=>typeof e.getAttribute==`function`?e.getAttribute(t):null,dx=e=>{let t=(ux(e,`class`)||``).match(/ql-indent-(\d+)/);return t?parseInt(t[1],10):0},fx=[`ul`,`ol`];function px(e,t){if(!e)return[{segments:[]}];if(!cx(e))return e.split(`
|
|
102
|
+
`).map(e=>({segments:e?[{text:e}]:[]}));let n=xb(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(sx(r,t));return}if(e.nodeType!==1)return;let r=lx(e);if(r===`br`){n.push({text:`
|
|
103
|
+
`});return}if(r===`style`||r===`script`||fx.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=wb(ux(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);Ib(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=Nb(s[`font-family`]);e&&(i.fontFamily=e)}if(s[`font-size`]){let e=t.fontSize??a,n=Pb(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=sx(e,t),a=n[n.length-1];a&&a.text!==`
|
|
106
|
+
`&&ox(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=ux(e,`data-list`),a=i===`bullet`||t===`ul`&&i!==`ordered`?`bullet`:`ordered`,c=n+dx(e),u=[];o(e,{},u),s(u,{list:a,indentLevel:c,listStart:r});for(let t of Array.from(e.childNodes||[])){let e=lx(t);fx.includes(e)&&l(t,n+1)}}function l(e,t){let n=lx(e),r=!0;for(let i of Array.from(e.childNodes||[]))lx(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(lx(e))||lx(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=lx(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 fx.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 mx(e,t){if(!e)return[];let n=px(e,{fontSize:t?.fontSize??Af.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&&ox(t,e)?t.text+=e.text:i.push(e)}return i}function hx(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,`<`),e=e.replace(/([^a-z0-9"'\s/])>/gi,`$1>`),e):e.replace(/</g,`<`).replace(/>/g,`>`):``}var gx=`400,400italic,700,700italic`;function _x(){return gx}function vx(e){return`https://fonts.googleapis.com/css?family=${e.replace(/ /g,`+`)}:${gx}`}var yx=o;function bx(e,t,n,r){return yx(`FONT_FAILED`,t,{reason:e,...n},r)}function xx(e){return e?.code===`FETCH_FAILED`}var Sx=3e4;function Cx(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 wx(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 Tx(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 Ex=(e,t)=>new Promise((n,r)=>{if(t?.aborted)return r(Dx());let i=setTimeout(n,e);t?.addEventListener(`abort`,()=>{clearTimeout(i),r(Dx())},{once:!0})});function Dx(){let e=Error(`Font fetch aborted`);return e.name=`AbortError`,e}var Ox=class extends Error{constructor(e,t,n){super(e),this.transportReason=e,this.status=t,this.retryAfterMs=n}};async function kx(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 Dx();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 Ox(`throttled-non-font`);return r?.set(e,t),t}throw clearTimeout(p),l=i.status,i.status===429||i.status===503?new Ox(`rate-limited`,i.status,Tx(i.headers.get(`retry-after`))):i.status>=500?new Ox(`server-error`,i.status):yx(`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 Dx();let r=n,a=n instanceof Ox,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 yx(`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,Sx):void 0;await Ex(h==null?m:Math.max(h,m),i)}finally{i?.removeEventListener(`abort`,d)}}throw yx(`FETCH_FAILED`,`Failed to fetch ${e}`,{url:e,status:l,attempts:o,reason:u})}function Ax(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 jx(e,t){if(!e.length)return!0;for(let[n,r]of e)if(t>=n&&t<=r)return!0;return!1}function Mx(e,t){for(let n of t)if(jx(e,n))return!0;return!1}function Nx(e){return e.trim().replace(/\s+/g,`+`)}function Px(e){return`https://fonts.googleapis.com/css2?family=${Nx(e)}:ital,wght@0,400;0,700;1,400;1,700`}function Fx(e){return`https://fonts.googleapis.com/css2?family=${Nx(e)}`}function Ix(e,t,n){return`https://fonts.googleapis.com/css2?family=${Nx(e)}:ital,wght@${+!!t},${n}`}function Lx(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?Ax(o[1]):[]},l=t.get(s);l?l.push(c):t.set(s,[c])}return t}var Rx=new Map,zx=new TextDecoder;function Bx(e,t){if(xx(t)){let n=t.details?.reason;if(n===`http-client-error`)return bx(`not-found`,`Google Fonts has no family "${e}"`,{family:e},t);if(n===`timeout`)return bx(`timeout`,`Timed out fetching Google font "${e}"`,{family:e},t)}return bx(`fetch-failed`,`Failed to fetch Google font "${e}"`,{family:e},t)}async function Vx(e,t){let n=``,r=e=>(n=zx.decode(e),/@font-face/i.test(n));try{await kx(Px(e),{...t,validate:r})}catch(n){if((xx(n)?n.details?.reason:void 0)===`http-client-error`)await kx(Fx(e),{...t,validate:r}).catch(t=>{throw Bx(e,t)});else throw Bx(e,n)}let i=Lx(n);if(i.size===0)throw bx(`not-found`,`No usable @font-face for "${e}"`,{family:e});return i}function Hx(e,t={}){let n=Rx.get(e);if(!n){let{cache:r,retries:i,baseDelayMs:a}=t;n=Vx(e,{cache:r,retries:i,baseDelayMs:a}),Rx.set(e,n),n.catch(t=>{t?.details?.reason!==`not-found`&&Rx.delete(e)})}return Ux(n,e,t)}function Ux(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(Dx())};if(n?.aborted)return c();n?.addEventListener(`abort`,c,{once:!0}),r!=null&&(o=setTimeout(()=>{s(),a(bx(`timeout`,`Timed out waiting for Google font "${t}"`,{family:t}))},r)),e.then(e=>{s(),i(e)},e=>{s(),a(e)})})}function Wx(e){return(e.styles||(e.url?[{src:`url("${e.url}")`}]:[])).map(e=>({src:e.src,fontStyle:e.fontStyle||`normal`,fontWeight:e.fontWeight||`normal`}))}Zt([`Roboto`,`Amatic SC`,`Press Start 2P`,`Marck Script`,`Rubik Mono One`]),Zt({value:!1});var Gx=Zt([]);function Kx(e){Gx.push(e)}var qx=`BESbswy 0123456789 Il1Ww`,Jx=[`sans-serif`,`serif`,`monospace`];function Yx(e){let t=function(e=``){let t=ax(e).replace(/\s+/g,` `).trim();return t?Array.from(t).slice(0,10).join(``):``}(e);return t?`${qx} ${t}`:qx}var Xx;function Zx(e){return{width:e.width,actualBoundingBoxLeft:e.actualBoundingBoxLeft||0,actualBoundingBoxRight:e.actualBoundingBoxRight||0,actualBoundingBoxAscent:e.actualBoundingBoxAscent||0,actualBoundingBoxDescent:e.actualBoundingBoxDescent||0}}function Qx(e=`sans-serif`,t=`normal`,n=`normal`,r=qx){Xx||=document.createElement(`canvas`);let i=Xx.getContext(`2d`);return i.font=`${t} ${n} 40px ${e}`,Zx(i.measureText(r))}function $x(e,t,n,r,i){return Jx.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=qx){Xx||=document.createElement(`canvas`);let a=Xx.getContext(`2d`);return a.font=`${n} ${r} 40px ${Cb(e)}, ${t}`,Zx(a.measureText(i))}(e,a,t,n,r),i[a]))}var eS={Arial:!0},tS=(e,t,n)=>t&&n?!!eS[`${e}_${t}_${n}`]:Object.keys(eS).some(t=>t.startsWith(e+`_`))||!!eS[e];async function nS(e,t,n,r){let i=`${e}_${t}_${n}`;if(eS[i])return;lS(e,t,n);let a=!!document.fonts?.load,s=Yx(r),c={"sans-serif":Qx(`sans-serif`,t,n,s),serif:Qx(`serif`,t,n,s),monospace:Qx(`monospace`,t,n,s)};if(a)try{if(await document.fonts.load(`${t} ${n} 16px ${Cb(e)}`,s),$x(e,t,n,s,c)){sS(i,e);return}}catch{}let l=db()/60;for(let r=0;r<l;r++){if(iS[e]===`missing`){if(!aS.has(e)){aS.add(e),setTimeout(()=>aS.delete(e),oS);let t=`Font "${e}" not found: not registered and no matching Google Font.`;console.error(t),_b(o(`FONT_FAILED`,t,{family:e,reason:`not-found`}))}return}if(e in rS&&!rS[e]&&iS[e]===`errored`&&uS(e),a)try{await document.fonts.load(`${t} ${n} 16px ${Cb(e)}`,s)}catch{}if($x(e,t,n,s,c)){sS(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?`),_b(o(`FONT_FAILED`,`Timeout for loading font "${e}"`,{family:e,reason:`timeout`}))}var rS={},iS={},aS=new Set,oS=500;function sS(e,t){eS[e]=!0,delete iS[t]}var cS={};function lS(e,t,n){let r=parseInt(n,10);if(!Number.isFinite(r)||function(e){let t=new Set;for(let n of _x().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 rS))return;let i=t===`italic`,a=`${e}|${+!!i}|${r}`;if(cS[a])return;cS[a]=!0;let o=document.createElement(`link`);o.type=`text/css`,o.href=Ix(e,i,r),o.rel=`stylesheet`,o.onerror=()=>{o.remove()},document.getElementsByTagName(`head`)[0].appendChild(o)}function uS(e){if(rS[e])return;let t=vx(e),n=document.createElement(`link`);n.type=`text/css`,n.href=t,n.rel=`stylesheet`,n.onerror=()=>{n.remove(),rS[e]=!1,iS[e]===`errored`?function(e){iS[e]=`probing`,fetch(vx(e),{mode:`no-cors`}).then(()=>{iS[e]=`missing`}).catch(()=>{delete iS[e]})}(e):iS[e]||(iS[e]=`errored`)},document.getElementsByTagName(`head`)[0].appendChild(n),rS[e]=!0}var dS={},fS;function pS(e){let t=e.fontFamily;if(dS[t]||!e.url&&!e.styles)return;delete iS[t];let n=Wx(e),r=(fS||(fS=document.getElementById(`polotno-font-style`),fS||(fS=document.createElement(`style`),fS.id=`polotno-font-style`,document.head.appendChild(fS)),fS)).sheet;n.forEach(e=>{r.insertRule(`\n @font-face{\n font-family:${Cb(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)}),dS[e.fontFamily]=!0}var mS=()=>typeof globalThis<`u`?globalThis.Buffer:void 0,hS=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=mS();if(t)return new Uint8Array(t.from(e,`base64`));throw Error(`No base64 decoder available`)},gS=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=mS();if(t)return t.from(e).toString(`base64`);throw Error(`No base64 encoder available`)},_S=[112,72,89,115],vS=(()=>{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})(),yS=(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},bS=(e,t,n)=>{let r=e.indexOf(`,`),i=hS(r>=0?e.slice(r+1):e);return`data:${t};base64,${gS(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);yS(r,0,t.length),r.set(_S,4),r.set(t,8);let i=new Uint8Array(4+t.length);return i.set(_S,0),i.set(t,4),yS(r,8+t.length,(e=>{let t=4294967295;for(let n=0;n<e.length;n++)t=vS[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,_S);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))}`},xS=({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}},SS=({px:e,precious:t=2,dpi:n=72,unit:r=`px`})=>parseFloat(xS({px:e,dpi:n,unit:r}).toFixed(t)),CS=({unitVal:e,dpi:t,unit:n})=>e/xS({px:1,unit:n,dpi:t}),wS=e=>{let t=parseFloat(xS(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 TS(e){for(let t=0;t<30;t++){let t=await e();if(t)return t;await new Promise(e=>setTimeout(e,50))}}function ES(e){"@babel/helpers - typeof";return ES=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},ES(e)}var DS=/^\s+/,OS=/\s+$/;function q(e,t){if(e||=``,t||={},e instanceof q)return e;if(!(this instanceof q))return new q(e,t);var n=kS(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=$S(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=NS(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString: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.v*100);return this._a==1?`hsv(`+t+`, `+n+`%, `+r+`%)`:`hsva(`+t+`, `+n+`%, `+r+`%, `+this._roundA+`)`},toHsl:function(){var e=jS(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=jS(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 FS(this._r,this._g,this._b,e)},toHexString:function(e){return`#`+this.toHex(e)},toHex8:function(e){return IS(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(eC(this._r,255)*100)+`%`,g:Math.round(eC(this._g,255)*100)+`%`,b:Math.round(eC(this._b,255)*100)+`%`,a:this._a}},toPercentageRgbString:function(){return this._a==1?`rgb(`+Math.round(eC(this._r,255)*100)+`%, `+Math.round(eC(this._g,255)*100)+`%, `+Math.round(eC(this._b,255)*100)+`%)`:`rgba(`+Math.round(eC(this._r,255)*100)+`%, `+Math.round(eC(this._g,255)*100)+`%, `+Math.round(eC(this._b,255)*100)+`%, `+this._roundA+`)`},toName:function(){return this._a===0?`transparent`:this._a<1?!1:ZS[FS(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t=`#`+LS(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?`GradientType = 1, `:``;if(e){var i=q(e);n=`#`+LS(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(VS,arguments)},brighten:function(){return this._applyModification(HS,arguments)},darken:function(){return this._applyModification(US,arguments)},desaturate:function(){return this._applyModification(RS,arguments)},saturate:function(){return this._applyModification(zS,arguments)},greyscale:function(){return this._applyModification(BS,arguments)},spin:function(){return this._applyModification(WS,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(JS,arguments)},complement:function(){return this._applyCombination(GS,arguments)},monochromatic:function(){return this._applyCombination(YS,arguments)},splitcomplement:function(){return this._applyCombination(qS,arguments)},triad:function(){return this._applyCombination(KS,[3])},tetrad:function(){return this._applyCombination(KS,[4])}},q.fromRatio=function(e,t){if(ES(e)==`object`){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]=r===`a`?e[r]:oC(e[r]));e=n}return q(e,t)};function kS(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=dC(e)),ES(e)==`object`&&(uC(e.r)&&uC(e.g)&&uC(e.b)?(t=AS(e.r,e.g,e.b),o=!0,s=String(e.r).substr(-1)===`%`?`prgb`:`rgb`):uC(e.h)&&uC(e.s)&&uC(e.v)?(r=oC(e.s),i=oC(e.v),t=PS(e.h,r,i),o=!0,s=`hsv`):uC(e.h)&&uC(e.s)&&uC(e.l)&&(r=oC(e.s),a=oC(e.l),t=MS(e.h,r,a),o=!0,s=`hsl`),e.hasOwnProperty(`a`)&&(n=e.a)),n=$S(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 AS(e,t,n){return{r:eC(e,255)*255,g:eC(t,255)*255,b:eC(n,255)*255}}function jS(e,t,n){e=eC(e,255),t=eC(t,255),n=eC(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 MS(e,t,n){var r,i,a;e=eC(e,360),t=eC(t,100),n=eC(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 NS(e,t,n){e=eC(e,255),t=eC(t,255),n=eC(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 PS(e,t,n){e=eC(e,360)*6,t=eC(t,100),n=eC(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 FS(e,t,n,r){var i=[aC(Math.round(e).toString(16)),aC(Math.round(t).toString(16)),aC(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 IS(e,t,n,r,i){var a=[aC(Math.round(e).toString(16)),aC(Math.round(t).toString(16)),aC(Math.round(n).toString(16)),aC(sC(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 LS(e,t,n,r){return[aC(sC(r)),aC(Math.round(e).toString(16)),aC(Math.round(t).toString(16)),aC(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 RS(e,t){t=t===0?0:t||10;var n=q(e).toHsl();return n.s-=t/100,n.s=tC(n.s),q(n)}function zS(e,t){t=t===0?0:t||10;var n=q(e).toHsl();return n.s+=t/100,n.s=tC(n.s),q(n)}function BS(e){return q(e).desaturate(100)}function VS(e,t){t=t===0?0:t||10;var n=q(e).toHsl();return n.l+=t/100,n.l=tC(n.l),q(n)}function HS(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 US(e,t){t=t===0?0:t||10;var n=q(e).toHsl();return n.l-=t/100,n.l=tC(n.l),q(n)}function WS(e,t){var n=q(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,q(n)}function GS(e){var t=q(e).toHsl();return t.h=(t.h+180)%360,q(t)}function KS(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 qS(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 JS(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 YS(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=fC(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 XS=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`},ZS=q.hexNames=QS(XS);function QS(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function $S(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function eC(e,t){rC(e)&&(e=`100%`);var n=iC(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 tC(e){return Math.min(1,Math.max(0,e))}function nC(e){return parseInt(e,16)}function rC(e){return typeof e==`string`&&e.indexOf(`.`)!=-1&&parseFloat(e)===1}function iC(e){return typeof e==`string`&&e.indexOf(`%`)!=-1}function aC(e){return e.length==1?`0`+e:``+e}function oC(e){return e<=1&&(e=e*100+`%`),e}function sC(e){return Math.round(parseFloat(e)*255).toString(16)}function cC(e){return nC(e)/255}var lC=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 uC(e){return!!lC.CSS_UNIT.exec(e)}function dC(e){e=e.replace(DS,``).replace(OS,``).toLowerCase();var t=!1;if(XS[e])e=XS[e],t=!0;else if(e==`transparent`)return{r:0,g:0,b:0,a:0,format:`name`};var n;return(n=lC.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=lC.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=lC.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=lC.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=lC.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=lC.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=lC.hex8.exec(e))?{r:nC(n[1]),g:nC(n[2]),b:nC(n[3]),a:cC(n[4]),format:t?`name`:`hex8`}:(n=lC.hex6.exec(e))?{r:nC(n[1]),g:nC(n[2]),b:nC(n[3]),format:t?`name`:`hex`}:(n=lC.hex4.exec(e))?{r:nC(n[1]+``+n[1]),g:nC(n[2]+``+n[2]),b:nC(n[3]+``+n[3]),a:cC(n[4]+``+n[4]),format:t?`name`:`hex8`}:(n=lC.hex3.exec(e))?{r:nC(n[1]+``+n[1]),g:nC(n[2]+``+n[2]),b:nC(n[3]+``+n[3]),format:t?`name`:`hex`}:!1}function fC(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 pC=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)},mC=mC||{};mC.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 mC=mC||{};mC.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&&(I(e.comma)||n(`Missing comma before color stops`)),{type:t,orientation:a,colorStops:S(C)}})}function s(t,r){var i=I(t);if(i){I(e.startCall)||n(`Missing (`);var a=r(i);return I(e.endCall)||n(`Missing )`),a}}function c(){var t=d();if(t)return t;var n=ie(`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(ie(`from`,/^from/,0)){var e=f();return e||n(`Missing angle after "from" in conic-gradient`),e}}function d(){return ie(`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=I(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,I(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=ie(`shape`,/^(circle)/i,0);return e&&(e.style=re()||v()),e}function _(){var e=ie(`shape`,/^(ellipse)/i,0);return e&&(e.style=b()||P()||v()),e}function v(){return ie(`extent-keyword`,e.extentKeywords,1)}function y(){if(ie(`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:P(),y:P()}}function S(t){var r=t(),i=[];if(r)for(i.push(r);I(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=P(),e.length&&(e.length2=P()),e}function w(){return E()||j()||A()||O()||D()||k()||T()}function T(){return ie(`literal`,e.literalColor,0)}function E(){return ie(`hex`,e.hexColor,1)}function D(){return s(e.rgbColor,function(){return ee(`rgb`)})}function O(){return s(e.rgbaColor,function(){return ee(`rgba`)})}function ee(t){var n=N();if(I(e.comma)){var r=N();I(e.comma);var i=N(),a=[n,r,i];return I(e.comma)?(a.push(N()),{type:`rgba`,value:a}):{type:t,value:a}}var r=N(),i=N(),a=[n,r,i];return I(e.slash)?(a.push(N()),{type:`rgba`,value:a}):{type:t,value:a}}function k(){return s(e.varColor,function(){return{type:`var`,value:te()}})}function A(){return s(e.hslColor,function(){return M(`hsl`)})}function j(){return s(e.hslaColor,function(){return M(`hsla`)})}function M(t){I(e.percentageValue)&&n(`HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage`);var r=N();if(I(e.comma)){var i=I(e.percentageValue),a=i?i[1]:null;I(e.comma),i=I(e.percentageValue);var o=i?i[1]:null;if((!a||!o)&&n(`Expected percentage value for saturation and lightness in HSL`),I(e.comma)){var s=N();return{type:`hsla`,value:[r,a,o,s]}}return{type:t,value:[r,a,o]}}var i=I(e.percentageValue),a=i?i[1]:null;i=I(e.percentageValue);var o=i?i[1]:null;if((!a||!o)&&n(`Expected percentage value for saturation and lightness in HSL`),I(e.slash)){var s=N();return{type:`hsla`,value:[r,a,o,s]}}return{type:t,value:[r,a,o]}}function te(){return I(e.variableName)[1]}function N(){return I(e.number)[1]}function P(){return ie(`%`,e.percentageValue,1)||F()||ne()||re()}function F(){return ie(`position-keyword`,e.positionKeywords,1)}function ne(){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 ae(r-1),{type:`calc`,value:a}})}function re(){return ie(`px`,e.pixelValue,1)||ie(`em`,e.emValue,1)||ie(`rem`,e.remValue,1)||ie(`vw`,e.vwValue,1)||ie(`vh`,e.vhValue,1)||ie(`vmin`,e.vminValue,1)||ie(`vmax`,e.vmaxValue,1)||ie(`ch`,e.chValue,1)||ie(`ex`,e.exValue,1)}function ie(e,t,n){var r=I(t);if(r)return{type:e,value:r[n]}}function I(e){var n,r=/^[\n\r\t\s]+/.exec(t);return r&&ae(r[0].length),n=e.exec(t),n&&ae(n[0].length),n}function ae(e){t=t.substring(e)}return function(e){return t=e.toString().trim(),t.endsWith(`;`)&&(t=t.slice(0,-1)),r()}})(),mC.parse,mC.stringify;var hC={parse:mC.parse,stringify:mC.stringify},gC=e=>typeof e==`string`&&e.indexOf(`linear-gradient`)>=0,_C={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},vC=e=>e.type===`hex`?`#`+e.value:e.type===`literal`?e.value:`${e.type}(${e.value.join(`,`)})`,yC=e=>{if(!gC(e)){let t=q(e).isValid()?e:`#000000`;return{rotation:0,stops:[{offset:0,color:t},{offset:1,color:t}]}}let t=hC.parse(e)[0],n=0;return t.orientation&&`value`in t.orientation&&(n=t.orientation.type===`directional`?_C[t.orientation.value]??0:parseFloat(t.orientation.value)||0),{rotation:n,stops:t.colorStops.map((e,n)=>({color:vC(e),offset:e.length?parseFloat(e.length.value)/100:t.colorStops.length>1?n/(t.colorStops.length-1):0}))}},bC=e=>yC(e).stops[0]?.color??`#000000`,xC=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)}},SC=e=>{if(!gC(e))return null;let{stops:t,rotation:n}=yC(e);return{...xC(n),stops:t}},CC=(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}),wC=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
|
+
`)}})),TC=n(((e,t)=>{wC()(`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,ee=d.length;!T&&O<ee;++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}})),EC=n(((e,t)=>{wC()(`parse`);var n=TC();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})}})),DC=n(((e,t)=>{wC()(`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+`;`}})),OC=t(n(((e,t)=>{t.exports={lex:TC(),parse:EC(),stringify:DC()}}))(),1);function kC(e){for(;e.parentNode;){if(e.nodeName===`defs`)return!0;e=e.parentNode}return!1}function AC(e){let t={};return Array.from(e.getElementsByTagName(`style`)).forEach(e=>{let n=OC.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 jC(e){let t=e.parentNode;for(;t;){if(t.nodeName===`svg`)return t;t=t.parentNode}return null}function MC(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=wb(e.getAttribute(`style`)),l=Db(c.fill||``),u=Db(c.stroke||``);if(!n.fill&&l&&l!==`none`&&(n.fill=l),!n.stroke&&u&&u!==`none`&&(n.stroke=u),!n.stroke&&!n.fill){let r=jC(e),i=r?MC(r,t):null;i?.fill!==`currentColor`&&i?.stroke!==`currentColor`&&(n.fill=`black`)}return n}var NC=/^url\(\s*['"]?#([^'")]+)['"]?\s*\)$/;function PC(e){return e.match(NC)?.[1]??null}function FC(e,t){let n=e.getElementById(t);return n&&n.nodeName===`linearGradient`?n:null}function IC(e,t){let n=parseFloat(e??``);return isNaN(n)?t:e.indexOf(`%`)>=0?n/100:n}function LC(e){let t=IC(e.getAttribute(`x1`),0),n=IC(e.getAttribute(`y1`),0),r=IC(e.getAttribute(`x2`),1),i=IC(e.getAttribute(`y2`),0),a=e.getAttribute(`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 RC(e){let t=[];for(let n of Array.from(e.children)){if(n.nodeName!==`stop`)continue;let e=wb(n.getAttribute(`style`)),r=Db(n.getAttribute(`stop-color`)||e[`stop-color`]||`black`),i=Db(n.getAttribute(`stop-opacity`)??e[`stop-opacity`]??``),a=parseFloat(i);isNaN(a)||(r=YC(r,a));let o=Math.min(1,Math.max(0,IC(n.getAttribute(`offset`),0)));t.push(`${r} ${Math.round(o*1e4)/100}%`)}return t.length===0?null:`linear-gradient(${LC(e)}deg, ${t.join(`, `)})`}function zC(e,t){let n=FC(e,t),r=n&&RC(n);return r?{grad:n,serialized:r}:null}function BC(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)}}function VC(e,t){let n=LC(e),{rotation:r,stops:i}=yC(t);if(BC(e,i),Math.abs(r-n)>.01){let{x1:t,y1:n,x2:i,y2:a}=xC(r),o=e=>String(Math.round(e*1e6)/1e6);e.setAttribute(`gradientUnits`,`objectBoundingBox`),e.removeAttribute(`gradientTransform`),e.setAttribute(`x1`,o(t)),e.setAttribute(`y1`,o(n)),e.setAttribute(`x2`,o(i)),e.setAttribute(`y2`,o(a))}}var HC=[`path`,`rect`,`circle`,`line`,`polygon`,`polyline`,`ellipse`,`text`];function UC(e,t){let n=e.childNodes||[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===1&&(t.push(r),UC(r,t))}}function WC(e){var t=[],n=[];UC(e,n);for(var r=0,i=n.length;r<i;r++){let e=n[r];kC(e)||(e.getAttribute(`fill`)!==null&&t.push(e),e.getAttribute(`stroke`)===null?(wb(e.getAttribute(`style`)).fill||HC.indexOf(e.nodeName)>=0)&&t.push(e):t.push(e))}return t}var GC=(e,t)=>e?.code?e:o(`FETCH_FAILED`,`Failed to fetch ${t}`,{url:t},e),KC=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 qC(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:XC(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,${pC(e)}`}return XC(await t.text())}catch(t){throw GC(t,e)}})();return t&&(t.buffers.set(e,a),a.then(n=>t.buffers.set(e,n),()=>t.buffers.delete(e))),a}async function JC(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:`)?KC(e.split(`base64,`)[1]):e}let i=(async()=>{try{return(e.startsWith(`data:`)?e.slice(0,e.indexOf(`,`)+1):``).endsWith(`;base64,`)?KC(e.split(`base64,`)[1]):await(await n(e)).text()}catch(t){throw GC(t,e)}})();return t&&(t.buffers.set(e,i),i.then(n=>t.buffers.set(e,n),()=>t.buffers.delete(e))),i}function YC(e,t){if(t===1)return e;let n=s.Util.colorToRGBA(e);return n?`rgba(${n.r}, ${n.g}, ${n.b}, ${n.a*t})`:e}function XC(e){return`data:image/svg+xml;base64,`+btoa(unescape(encodeURIComponent(e)))}function ZC(e){var t=bb.createDOMParser().parseFromString(e,`image/svg+xml`);return t.documentElement.setAttribute(`preserveAspectRatio`,`none`),bb.createXMLSerializer().serializeToString(t)}function QC(e){return e.indexOf(`data:image/svg+xml`)>=0||e.indexOf(`.svg`)>=0}var $C={"":1,px:1,pt:96/72,pc:16,in:96,cm:96/2.54,mm:96/25.4,q:96/101.6};function ew(e){let t=e?.trim().match(/^(-?[\d.]+)([a-z]*)$/i);if(!t)return null;let n=$C[t[2].toLowerCase()],r=n?parseFloat(t[1])*n:0;return r>0?r:null}function tw(e){let[,,t,n]=(e.documentElement.getAttribute(`viewBox`)?.trim()||``).split(/[\s,]+/).map(parseFloat),r=ew(e.documentElement.getAttribute(`width`)),i=ew(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 nw(e){if(!e.documentElement)return;let t=tw(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 rw(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 GC(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 iw(e){let t=QC(e)?await JC(e):await rw(e);return tw(bb.createDOMParser().parseFromString(t,`image/svg+xml`))}function aw(e){var t=bb.createDOMParser().parseFromString(e,`image/svg+xml`);return nw(t),bb.createXMLSerializer().serializeToString(t)}var ow=(e,t)=>{if(!e||!t)return!1;if(t===`currentColor`&&e===`black`)return!0;if(gC(e)||gC(t))return e===t;let n=s.Util.colorToRGBA(e),r=s.Util.colorToRGBA(t);if(!(!n||!r))return n.r===r.r&&n.g===r.g&&n.b===r.b&&n.a===r.a};function sw(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}=xC(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),BC(o,r),(e.getElementsByTagName(`defs`)[0]||e.insertBefore(a.createElementNS(i,`defs`),e.firstChild)).appendChild(o)}function cw(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}=yC(r);return sw(e.children[0],a,o,s),t.set(r,a),a}}function lw(e,t){var n=bb.createDOMParser().parseFromString(e,`image/svg+xml`);let r=WC(n),i=Array.from(t.keys()),a=AC(n),o=cw(n);return r.forEach(e=>{let{fill:r,stroke:s}=MC(e,a);[{prop:`fill`,color:r},{prop:`stroke`,color:s}].forEach(({prop:r,color:a})=>{let s=a&&PC(a),c=s?zC(n,s):null;if(s&&!c)return;c&&(a=c.serialized);let l=i.find(e=>ow(e,a));if(l){let n=t.get(l);if(gC(n)){if(c){VC(c.grad,n);return}Ob(e,r,null),e.setAttribute(r,`url('#${o(n)}')`)}else Ob(e,r,n)}else return})}),bb.createXMLSerializer().serializeToString(n)}function uw(e,t){return XC(lw(e,t))}var dw=(e,t)=>o(`IMAGE_FAILED`,`Failed to load image: ${e}`,{reason:`load`,src:e},t),fw=e=>e.width===300||e.height===150&&e.width<=300;function pw(e){return new Promise((t,n)=>{let r=bb.createElement(`img`);r.onload=async()=>{let i=r.width>0&&r.height>0?{width:r.width,height:r.height}:null;if(i&&!fw(i)){t(i);return}let a=null,o;try{a=await iw(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(dw(e,o??Error(`svg states no size`)))},r.onerror=t=>{n(dw(e,t))},r.crossOrigin=`anonymous`,r.src=e})}function mw(e){return new Promise((t,n)=>{let r=bb.createElement(`img`);r.onload=()=>{t(r)},r.onerror=t=>{n(dw(e,t))},r.crossOrigin=`anonymous`,r.src=e})}var hw=e=>!!e.stretchEnabled;function gw(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 _w(e,t){let n=t.width*e.cropWidth,r=t.height*e.cropHeight,i=e.width/e.height,a=n/r,o,s;return hw(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 vw(e,t){let n=_w(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 yw(e,t){let n=vw(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=hw(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 bw(e,t,n){let r=n??await mw(e),i=bb.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=bb.createElement(`canvas`);a.width=t.width,a.height=t.height;let o=a.getContext(`2d`),s=_w(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 xw(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||[]}),Sw=async(e,t,n)=>e&&await e({dom:t,element:n})||t;function Cw(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 ww=(e,t)=>{let n=Cw(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})},Tw=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})`},ww(e,e.startHead)),J(`g`,{transform:`translate(${e.width} ${e.height/2}) rotate(180)`},ww(e,e.endHead))];function Ew(e){return!s.Util.colorToRGBA(e)&&!gC(e)}function Dw(e){return[...e.filter(e=>!e.alwaysOnTop),...e.filter(e=>e.alwaysOnTop)]}var Ow=({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`},kw=({width:e,height:t})=>`M ${e/2} 0 L ${e} ${t} L 0 ${t} Z`,Aw=({width:e,height:t})=>`M 0 0 L ${e} 0 L 0 ${t} Z`,jw=({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 Mw({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 Nw({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 Pw({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 Fw({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 Iw={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 Lw(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(!Iw[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=Iw[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 Lw(e,n/t.width,r/t.height)}function Rw({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 zw({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 Bw={rect:Ow,circle:jw,star:Mw,triangle:kw,rightTriangle:Aw,diamond:Nw,pentagon:Pw,hexagon:Fw,speechBubble:Rw,cross:zw,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 Vw(e){return Bw[e]||Ow}function Hw(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 Uw(e){let{subType:t}=e,n=e,r=Vw(t);return r?Hw(n,r):(console.error(`Polotno error: Can not convert ${e.subType} figure to svg.`),Ow(n))}function Ww(e,t,n,r){let i=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return e.replace(RegExp(`${t}="${i}"`,`g`),`${t}="url(#${r})"`)}var Gw=null;function Kw(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 qw(){if(typeof DOMParser<`u`)return Gw||=new DOMParser,Gw;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 Jw(e){let t=qw().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 Yw=1,Xw=3;function Zw(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 Qw(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 $w(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 eT(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 tT(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($w),o=a[a.length-1],s=o.tag;return{parts:a,combinators:r,rightmost:o,rightmostIsRoot:s===`html`||s===`body`,spec:Qw(e),pseudoElement:t}}function nT(e,t){if(e.rightmostIsRoot){if(t.parent!==null)return!1}else if(!eT(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(eT(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(eT(r,n)){n=n.parent,e=!0;break}n=n.parent}if(!e)return!1}}return!0}function rT(){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 iT={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 aT(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 oT(e){if(e===`bold`)return 700;if(e===`normal`)return 400;let t=parseInt(e,10);return isNaN(t)?400:t}function sT(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 cT(e,t,n){return[{property:`flex-grow`,value:e},{property:`flex-shrink`,value:t},{property:`flex-basis`,value:n}]}function lT(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 uT(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=lT(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=lT(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 cT(`0`,`0`,`auto`);if(e===`auto`)return cT(`1`,`1`,`auto`);if(e===`initial`)return cT(`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?[]:cT(n[0]??`1`,n[1]??`1`,r||(n.length>0?`0`:`auto`))}return e===`border-collapse`||e===`border-spacing`?[]:[{property:e,value:t}]}function dT(e,t){let n=e.trim();if(n.endsWith(`%`)){let e=parseFloat(n);return e>0?{pct:e}:0}return Math.max(0,aT(n,t,0))}function fT(e){let t=e.trim();return t.toLowerCase()===`currentcolor`?``:t}function pT(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=oT(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=aT(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=aT(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:aT(t,o,i));break}case`text-shadow`:e.textShadow=n.trim();break;case`-webkit-text-stroke-width`:e.webkitTextStrokeWidth=aT(n,o,i);break;case`-webkit-text-stroke-color`:e.webkitTextStrokeColor=fT(n);break;case`--rt-text-stroke-image`:e.webkitTextStrokeImage=n.trim();break;case`-webkit-text-fill-color`:e.webkitTextFillColor=fT(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:aT(n,o,i);break;case`word-spacing`:e.wordSpacing=n.trim()===`normal`?0:aT(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=aT(t,o,i));break}case`min-width`:{let t=n.trim();e.minWidth=t===`auto`?null:aT(t,o,i);break}case`min-height`:e.minHeight=aT(n,o,i);break;case`padding-top`:e.paddingTop=aT(n,o,i);break;case`padding-right`:e.paddingRight=aT(n,o,i);break;case`padding-bottom`:e.paddingBottom=aT(n,o,i);break;case`padding-left`:e.paddingLeft=aT(n,o,i);break;case`margin-top`:e.marginTop=aT(n,o,i);break;case`margin-right`:e.marginRight=aT(n,o,i);break;case`margin-bottom`:e.marginBottom=aT(n,o,i);break;case`margin-left`:e.marginLeft=aT(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=aT(n,o,i):e.paddingLeft=aT(n,o,i);break;case`padding-inline-end`:a===`rtl`?e.paddingLeft=aT(n,o,i):e.paddingRight=aT(n,o,i);break;case`margin-inline-start`:a===`rtl`?e.marginRight=aT(n,o,i):e.marginLeft=aT(n,o,i);break;case`margin-inline-end`:a===`rtl`?e.marginLeft=aT(n,o,i):e.marginRight=aT(n,o,i);break;case`border-top-width`:e.borderTopWidth=aT(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=aT(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=aT(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=aT(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=dT(n,o);break;case`border-top-right-radius`:e.borderTopRightRadius=dT(n,o);break;case`border-bottom-right-radius`:e.borderBottomRightRadius=dT(n,o);break;case`border-bottom-left-radius`:e.borderBottomLeftRadius=dT(n,o);break;case`flex-direction`:e.flexDirection=n.trim();break;case`gap`:e.gap=aT(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:aT(t,o,i);break}case`list-style-type`:e.listStyleType=n.trim()}}var mT=[[`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 hT(e,t,n){for(let[r,i]of mT)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 gT(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=uT(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=tT(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 _T(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`${vT(e).toLowerCase()}.`;case`upper-roman`:return`${vT(e)}.`;case`lower-alpha`:case`lower-latin`:return`${yT(e).toLowerCase()}.`;case`upper-alpha`:case`upper-latin`:return`${yT(e)}.`;default:return`${e}.`}}function vT(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 yT(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 bT(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 _T(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 _T(c,t||`decimal`);c+=s}return _T(c,t||`decimal`)}}function xT(e){let t=e.style;return t&&typeof t.cssText==`string`?t:null}function ST(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 CT(e,t,n){let r=gT(Zw(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=rT(),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(nT(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=iT[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`&&(pT(l,e.property,e.value,t.fontSize,n,t.direction),_=!0);let v=xT(e);if(v&&v.cssText){let e=ST(v.cssText);for(let r of e)r.property===`font-size`&&(pT(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`&&(pT(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=ST(v.cssText);for(let t of e){if(t.property===`font-size`){u.add(`font-size`);continue}let e=uT(t.property,t.value);for(let t of e)pT(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`),hT(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=bT(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]);pT(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 ee=[];for(let t of e.childNodes){let e=s(t,l,c);e&&ee.push(e)}return{element:e,tagName:o,style:l,children:ee,textContent:null,listMarker:E,markerStyle:D,markerHidden:O||void 0}}function s(e,t,n){if(e.nodeType===Xw){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!==Yw)return e?.nodeType===Xw;let t=iT[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!==Yw)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,rT(),null)}var wT=!0,TT,ET=[],DT=new Map,OT=new Map,kT=new Map;function AT(e,t){let n=e.font+`\0`+(e.letterSpacing||``)+`\0`+t,r=kT.get(n);if(r!==void 0)return r;let i=e.measureText(t).width;return kT.set(n,i),i}function jT(e){let t=``;for(let n of e){if(!n.text||n.isSpace)continue;let e=`${IT(n.style)}|${PT(n.style.letterSpacing)}|${NT(n.style)}`;if(t&&e!==t)return!0;t=e}return!1}function MT(e,t){e.font=IT(t),e.fontKerning=NT(t)}function NT(e){return e.fontKerning===`none`?`none`:`normal`}function PT(e){return Number.isFinite(e)&&e!==0?`${e}px`:`0px`}var FT=new Map;function IT(e){let t=`${e.fontStyle}|${e.fontVariantCaps}|${e.fontWeight}|${e.fontSize}|${e.fontFamily}`,n=FT.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 FT.set(t,i),i}var LT=new Map,RT=null,zT=null,BT=null,VT=new Set([`disc`,`circle`,`square`]);function HT(e,t,n=!1){let r=`${e}|${t}|${n?`ul-li`:`block`}`,i=LT.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?(zT||(zT=document.createElement(`ul`),zT.style.cssText=`position:absolute;top:-9999px;left:-9999px;visibility:hidden;padding:0;margin:0;border:0;list-style:disc;`,BT=document.createElement(`li`),BT.style.cssText=`white-space:nowrap;padding:0;margin:0;border:0;`,BT.textContent=`Mg`,zT.appendChild(BT),document.body.appendChild(zT)),a=BT):(RT||(RT=document.createElement(`div`),RT.style.cssText=`position:absolute;top:-9999px;left:-9999px;visibility:hidden;white-space:nowrap;padding:0;margin:0;border:0;`,RT.textContent=`Mg`,document.body.appendChild(RT)),a=RT),a.style.font=e,a.style.lineHeight=t;let o=a.getBoundingClientRect().height;return LT.set(r,o),o}function UT(e,t,n=!1){if(t.lineHeight>0)return wT?HT(IT(t),`${t.lineHeight}px`,n):t.lineHeight;if(wT)return HT(IT(t),`normal`,n);let{ascent:r,descent:i}=aE(e,t);return r+i}var WT=typeof navigator>`u`?``:navigator.userAgent,GT=/\bGecko\/\d/.test(WT),KT=/AppleWebKit/.test(WT)&&!/Chrome\/\d/.test(WT)&&!/\bjsdom\//.test(WT),qT=!GT&&!KT,JT=!GT&&!KT,YT=!GT;function XT(e,t,n){let r=(e-(t+n))/2+t;return JT?Math.floor(r):r}function ZT(e,t){MT(e,t);let n=e.letterSpacing;e.letterSpacing=`0px`;let r=AT(e,` `);return e.letterSpacing=n,{interval:(r+(t.letterSpacing||0)+(t.wordSpacing||0))*8,halfSpace:r/2}}function QT(e){return{top:e.marginTop+e.borderTopWidth+e.paddingTop,bottom:e.paddingBottom+e.borderBottomWidth+e.marginBottom}}function $T(e,t,n=!1){let{ascent:r,descent:i}=aE(e,t),a=UT(e,t,n),o=XT(a,r,i);return{ascent:o,descent:a-o}}function eE(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 tE(e){if(e.tagName===`#text`)return!0;let t=e.style.display;return t===`inline`||t===`inline-block`}function nE(e){return e.children.length>0&&e.children.every(tE)}function rE(e){return!e||e===`transparent`||e===`rgba(0, 0, 0, 0)`}var iE=new Map;function aE(e,t){let n=IT(t),r=iE.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 iE.set(n,o),o}function oE(e,t,n,r,i){switch(e){case`super`:return YT?-(r.fontSize/3+1):-r.fontSize*.34;case`sub`:return YT?r.fontSize/5+1:r.fontSize*.2;case`text-top`:return $T(t,n,i).ascent-aE(t,r).ascent;case`text-bottom`:return aE(t,r).descent-$T(t,n,i).descent;case`middle`:{let{ascent:e,descent:i}=aE(t,n);return-(r.fontSize*.25)-(i-e)/2}default:{let r=parseFloat(e);return Number.isFinite(r)?e.endsWith(`%`)?-(r/100)*UT(t,n,i):-r:0}}}function sE(e){return e!==`baseline`&&e!==`top`&&e!==`bottom`&&e!==``}function cE(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 lE(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||!cE(n[e],r[e]))return!1;return!0}function uE(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&&lE(e,t)&&e.backgroundColor===t.backgroundColor}function dE(e){return!rE(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 fE(e){return e.webkitBackgroundClip===`text`&&(!!e.backgroundImage&&e.backgroundImage!==`none`||!rE(e.backgroundColor))}function pE(e){return!!(e.boxOpen&&e.boxClose&&e.text)}function mE(e,t,n){let r=t.words.length-1;for(;r>=0&&(t.words[r].text===``||pE(t.words[r]));)r--;if(r<0)return;let i=t.words[r].style,a=t.words[r].boxStyle,o=t.words[r].parentStyle;MT(e,i),e.letterSpacing=`${i.letterSpacing||0}px`;let s=AT(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)&&!pE(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 hE(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||tE(e)&&dE(e.style),l=c?e.style:r,u=tE(e)&&fE(e.style)?e.style:i,d=tE(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 gE(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 _E;function vE(){return _E||(typeof Intl<`u`&&Intl.Segmenter?(_E=new Intl.Segmenter(void 0,{granularity:`word`}),_E):null)}function yE(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;yE(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]:OE(e)),a=AT(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:AT(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]:OE(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(gE(t)){let i=vE();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=AT(e,t);TT&&TT({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 bE(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){MT(e,r.style),e.letterSpacing=PT(r.style.letterSpacing);let t=eE(r.text,r.style.textTransform),i=r.style,a=AT(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}MT(e,r.style),e.letterSpacing=PT(r.style.letterSpacing);let t=eE(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=wE(t.text)[0],a=wE(r.text),o=a[a.length-1];xE(i)||xE(o)||DE(i)||DE(o)||gE(t.text)||gE(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;yE(e,a[t],r,n),i(o)}}else{let a=n.length;yE(e,t,r,n),i(a)}}return n}function xE(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 SE;function CE(){return SE||(typeof Intl<`u`&&Intl.Segmenter?(SE=new Intl.Segmenter(void 0,{granularity:`grapheme`}),SE):null)}function wE(e){let t=CE();return t?[...t.segment(e)].map(e=>e.segment):[...e]}var TE=/\p{Extended_Pictographic}/u,EE=/[\u{1F000}-\u{10FFFF}\u200D\uFE0F]/u;function DE(e){for(let t of e)if(t.codePointAt(0)>=126976)return!0;return e.includes(``)||e.includes(`️`)?TE.test(e):!1}function OE(e){return e.split(/(?<=[^]-)/).filter(Boolean)}function kE(e,t,n,r){let i=[...t.text].some(xE),a=!!CE()&&EE.test(t.text)&&wE(t.text).some(DE),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=IT(t.style),e.letterSpacing=PT(t.style.letterSpacing);let c=a?wE(t.text):[...t.text],l=[],u=``,d=0,f=``,p=0,m=0;for(let r of c){let i=f+r,s=AT(e,i),c=s-p;if(a&&DE(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(xE(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 AE=/^[,.\;:!?\)\]\}'"»›」』】〕〉》”、。・!),:;?၊-၏។-៖៘-៚]+$/,jE=/^[\(\[\{«‹“‘「『【〔〈《(]+$/;function ME(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&&AE.test(t.text),a=!t.text&&!!t.boxClose,o=!!t.text&&!!t.noBreakBefore;if(!i&&!a&&!o)break;n+=t.width}return n}function NE(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){MT(e,t.style);let n=AT(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(TT){let e=u.words.map(e=>e.text).join(``);TT({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=UT(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=QT(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=OE(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;MT(e,a),e.letterSpacing=PT(a.letterSpacing);let l=UT(e,a,i),d=``,p=0;for(;r<t.length&&t[r].style===a;){let i=t[r].ch,m=AT(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=AT(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++;MT(e,i),e.letterSpacing=PT(i.letterSpacing),n+=AT(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?kE(e,s,f(),u.totalWidth):{pieces:[s],emergency:!1},v=_.pieces;_.emergency&&u.words.some(e=>!e.isSpace)&&(h(!0),g=!1);let y=ME(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||!AE.test(t.text))break;d+=t.width,e===v.length-1&&(d+=y)}let _=!s.isSpace&&s.text.length>0&&AE.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=jE.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?kE(e,i,f(),0).pieces:[i];x+=r[0].width,r.length===1&&(x+=ME(t,n+1))}}let C=0;s.isSoftHyphenBreak&&(MT(e,s.style),e.letterSpacing=PT(s.style.letterSpacing),C=AT(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)&&!jT([...u.words,s])){MT(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,AT(e,t)+n+d+x<=f()+.02&&(r=!1)}if(r){if(TT){let e=u.words.map(e=>e.text).join(``);TT({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 PE(e,t,n,r){for(let i of t){let t=i.inlineBlock;if(!t)continue;let a=t.style,o=JE(a),s=qE(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(YE(e,t),l));a.minWidth!==null&&(u=Math.max(u,Math.max(0,a.minWidth-s)));let d=FE(e,t,0,0,u,r),f=d.height||UT(e,a,r),p=d.lines.at(-1)?.y??$T(e,a,r).ascent,m=QT(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 FE(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=hE(t);if(d.length===0)return{nodes:s,height:0,lines:c};let f=bE(e,d);PE(e,f,i,a);let p=t.style.textIndent||0,m=ZT(e,t.style),h=UT(e,t.style,a),g=NE(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];mE(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=$T(e,t.style,a),O=D.ascent,ee=D.descent,k=(e,t)=>{e.ascent-t>O&&(O=e.ascent-t),e.descent+t>ee&&(ee=e.descent+t)};for(let t of o.words){if(t.text===``)continue;t.parentStyle&&k($T(e,t.parentStyle,a),oE(t.parentStyle.verticalAlign,e,t.parentStyle,S,a));let n=$T(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=QT(r);n.ascent+=e.top,n.descent+=e.bottom}k(n,r?0:oE(t.style.verticalAlign,e,t.style,t.parentStyle??S,a))}let A=O+ee,j=C+O,M=(t,n,r,i)=>{let{ascent:o,descent:c}=t.display===`inline-block`?$T(e,t,a):aE(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;sE(t)&&(f+=oE(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-JE(a)-qE(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 te=o.words.filter(e=>e.text!==``),N=te.length>0&&te.every(e=>uE(e.style,te[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&&uE(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,MT(e,n.style);let t=AT(e,n.text);i-=t,n.x=i,n.width=t}for(let e of t)if(e.boxStyle&&dE(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(N&&/[\u0590-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/.test(t)&&!o.words.some(e=>e.boxOpen||e.boxClose||e.style.verticalAlign===`super`||e.style.verticalAlign===`sub`)){MT(e,te[0].style);let n=AT(e,t),r={type:`text`,text:t,x:T,y:j,width:n,style:{...te[0].style,direction:`ltr`}};s.push(r),te[0].clipStyle&&l.set(r,te[0].clipStyle),te[0].strokeImageStyle&&u.set(r,te[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:AT(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;sE(r)&&(n+=oE(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 P=m===`justify`&&y>0?_:o.totalWidth,F={y:Math.round(j),text:o.words.map(e=>e.inlineBlockLayout?.lines.at(-1)?.text??e.text).join(``),bounds:{x:E,y:C,width:P,height:A}};c.push(F),C+=A}return IE(e,s,l,(e,t,n)=>{e.clip={image:t.backgroundImage&&t.backgroundImage!==`none`?t.backgroundImage:void 0,color:rE(t.backgroundColor)?void 0:t.backgroundColor,...n}}),IE(e,s,u,(e,t,n)=>{e.strokeImage={image:t.webkitTextStrokeImage,...n}}),{nodes:s,height:C-r,lines:c}}function IE(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}=aE(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 LE(e,t){return e>=0&&t>=0?Math.max(e,t):e<0&&t<0?Math.min(e,t):e+t}function RE(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 zE(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 BE(e){let t=e.style.marginTop;if(!zE(e)||e.style.paddingTop!==0||e.style.borderTopWidth!==0)return t;let n=e.children[0];return n&&RE(n)?LE(t,BE(n)):t}function VE(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=rD(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=HE(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(nE(t)){let{nodes:n,height:r,lines:i}=FE(e,t,y,S,b,t.tagName===`li`&&VT.has(o.listStyleType),a);ET.push(...i),C.children=n,C.height=d+h+r+g+f}else{let n=S,r=0,i=!1,s=zE(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`||tE(l)){let s=[l];for(;c+1<t.children.length;){let e=t.children[c+1];if(e.tagName===`#text`||tE(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`&&VT.has(o.listStyleType),{nodes:f,height:p,lines:m}=FE(e,u,y,n,b,d,a);ET.push(...m),C.children.push(...f),n+=p,r=0,i=!0;continue}let u=BE(l);if(!(!i&&h===0&&d===0&&s)){let e=LE(r,u);n+=e}let{box:f,height:p,marginBottomOut:m}=VE(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=LE(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 HE(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}=VE(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 UE=new WeakMap;function WE(e){let t=UE.get(e);return t||(t={element:null,tagName:`div`,style:{...e.style,display:`block`},children:[e],textContent:null},UE.set(e,t)),t}function GE(e){return e.children.filter(e=>e.tagName!==`#text`||e.textContent?.trim()).map(e=>e.tagName===`#text`?WE(e):e)}function KE(e){return e.flexDirection===`row`||e.flexDirection===``}function qE(e){return e.borderLeftWidth+e.paddingLeft+e.paddingRight+e.borderRightWidth}function JE(e){return e.marginLeft+e.marginRight}function YE(e,t){return NE(e,bE(e,hE(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 XE(e,t){let n=DT.get(t);if(n!==void 0)return n;let r=ZE(e,t);return DT.set(t,r),r}function ZE(e,t){let n=JE(t.style),r=qE(t.style);if(t.style.minWidth!==null)return n+Math.max(r,t.style.minWidth);let i=0;if(nE(t))i=YE(e,t);else if(t.style.display===`flex`&&KE(t.style)){let n=GE(t);i=n.reduce((t,n)=>t+XE(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,XE(e,n)));let a=r+i;return t.style.width>0&&(a=Math.min(a,t.style.width)),n+a}function QE(e,t){return NE(e,bE(e,hE(t)),1/0,t.style.whiteSpace).reduce((e,t)=>Math.max(e,t.totalWidth),0)}function $E(e,t){let n=OT.get(t);if(n!==void 0)return n;let r=eD(e,t);return OT.set(t,r),r}function eD(e,t){let n=JE(t.style);if(t.style.width>0)return n+t.style.width;let r=0;if(nE(t))r=QE(e,t);else if(t.style.display===`flex`&&KE(t.style)){let n=GE(t);r=n.reduce((t,n)=>t+$E(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,$E(e,n)));return n+qE(t.style)+r}function tD(e,t){return t.style.flexBasis===null?$E(e,t):JE(t.style)+t.style.flexBasis}function nD(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 rD(e,t,n,r,i){let a=t.style,o=a.gap,s=[],c=GE(t);if(c.length===0)return{children:s,height:0};if(KE(a)){let t=o*(c.length-1),a=Math.max(0,i-t),l=nD(c.map(e=>e.style),c.map(t=>tD(e,t)),c.map(t=>XE(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}=VE(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}=VE(e,t,n,l,i);s.push(r),l+=a+o}return{children:s,height:l-r}}function iD(e,t,n){if(!n.listMarker||n.markerHidden)return;let r=n.style,i=n.markerStyle,a=i?{...r,...i}:r;e.font=IT(a);let o=$T(e,r),s=t.y+r.borderTopWidth+r.paddingTop+o.ascent,c=AT(e,n.listMarker),l=r.direction===`rtl`,u=VT.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}=aE(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?AT(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;ET.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 aD(e,t,n,r=!0,i){wT=r,TT=i,LT.clear(),iE.clear(),FT.clear(),kT.clear(),DT.clear(),OT.clear(),ET=[];let{box:a,height:o}=VE(e,t,0,0,n);oD(e,a,t);let s=ET.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 oD(e,t,n){iD(e,t,n);let r=0;for(let i of n.children)if(!(i.tagName===`#text`||tE(i)))for(;r<t.children.length;){let n=t.children[r];if(n.type===`box`&&n.tagName===i.tagName){oD(e,n,i),r++;break}r++}}function sD(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 cD(e,t){let n=e[`border${t}Width`],r=e[`border${t}Style`];return n>0&&r!==`none`}function lD(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 uD(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 dD(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 fD(e){return e.webkitTextFillColor&&e.webkitTextFillColor!==`transparent`?e.webkitTextFillColor:e.color}function pD(e){return Math.max(1,Math.floor(e/10))}function mD(e){let t=e.declarer.textDecorationThickness;return t===null?pD(e.declarer.fontSize):t<=0?0:Math.max(1,Math.round(t))}function hD(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 gD(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 _D(e,t,n,r){let{style:i}=t;e.save(),e.font=IT(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=fE(i),o=i.webkitTextStrokeWidth>0,s=i.webkitTextFillColor===`transparent`||i.color===`transparent`,c=t.clip?(t.clip.image?dD(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?dD(e,t.strokeImage.image,t.strokeImage.x,t.strokeImage.width,t.strokeImage.y,t.strokeImage.height):null)??r??null,f=sD(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:fD(i),e.fillText(t.text,t.x,t.y)),o&&(gD(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=fD(i),e.fillText(t.text,t.x,t.y))},m=()=>{o&&(e.save(),gD(e,i,d),e.strokeText(t.text,t.x,t.y),e.restore())};sT(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=mD(n);if(r<=0)continue;let a=n.color;if(rE(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`&&rE(c);if(s>0&&!n){uD(e,g,t,h,r+s,o,c);let n=r-s;n>0&&uD(e,g,t,h,n,o,a)}else uD(e,g,t,h,r,o,a)};if(n.line===`underline`){let e=t.lineBaselineY!==void 0&&!sE(n.declarer.verticalAlign)?t.lineBaselineY:t.y,i=hD(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}=aE(e,i);l(Math.floor(t.y-n)-r/2)}}e.restore()}var vD=/^[\p{Script=Latin}\p{Script=Cyrillic}\p{Script=Greek}\p{Mark}\p{Number}\p{Punctuation}\p{Separator}]+$/u;function yD(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&&vD.test(e.text)}function bD(e,t,n=null,r=null){let{style:i}=t,a=lD(i,t.width,t.height);if(!rE(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&&cD(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)cD(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(fE(i)){let r=i.backgroundImage&&i.backgroundImage!==`none`?dD(e,i.backgroundImage,t.x,t.width,t.y,t.height):null,a=rE(i.backgroundColor)?null:i.backgroundColor;n=r??a??n}i.webkitTextStrokeImage&&i.webkitTextStrokeImage!==`none`&&(r=dD(e,i.webkitTextStrokeImage,t.x,t.width,t.y,t.height));let o=qT&&t.children.every(e=>e.type===`text`&&yD(e))?t.children:null;if(!o){for(let i of t.children)xD(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++;_D(e,{...i,text:a,width:s},n,r)}}function xD(e,t,n,r){t.type===`text`?_D(e,t,n,r):bD(e,t,n,r)}var SD=/[MmLlHhVvCcSsQqTtAaZz]/,CD=/-?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-+]?\d+)?/g;function wD(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(SD.test(r)){let i=n+1;for(;i<e.length&&!SD.test(e[i]);)i++;let a=e.slice(n+1,i),o=[],s;for(CD.lastIndex=0;s=CD.exec(a);)o.push(Number(s[0]));t.push({cmd:r,args:o}),n=i}else n++}return t}function TD(e){let t=wD(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 ED(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 DD(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 OD(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 kD(e,t){let{cx:n,cy:r,rx:i,ry:a,cosPhi:o,sinPhi:s,theta1:c,deltaTheta:l}=OD(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 AD=40;function jD(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}:kD(r,0),e.push({t:0,len:0});for(let t=1;t<=AD;t++){let n=t/AD,o;o=r.type===`C`?ED(r,n):r.type===`Q`?DD(r,n):kD(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}:kD(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`?ED(r.seg,f):r.seg.type===`Q`?DD(r.seg,f):kD(r.seg,f)}return null}return{length:n,getPointAtLength:r}}function MD(e){return jD(TD(e))}var ND;function PD(){if(ND!==void 0)return ND;if(typeof Intl<`u`&&typeof Intl.Segmenter==`function`)try{ND=new Intl.Segmenter(void 0,{granularity:`grapheme`})}catch{ND=null}else ND=null;return ND}function FD(e){if(!e)return[];let t=PD();if(t){let n=[];for(let r of t.segment(e))n.push(r.segment);return n}return Array.from(e)}function ID(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 LD(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=fE(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 RD=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 zD(e){return RD.test(e)}function BD(e,t){let n=FD(t.text);if(n.length===0)return[];MT(e,t.style),e.letterSpacing=`${t.style.letterSpacing||0}px`;let{ascent:r,descent:i}=aE(e,t.style),a=[],o=``;for(let e of n){let t=e===` `;zD(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 VD(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=BD(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+(e.style.letterSpacing||0);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=t.width+(t.isSpace?p:0),i=n.getPointAtLength(h);if(!i)break;let a=h+r,s;if(a>d){if(a-d<=u+.5)s=n.getPointAtLength(d);else break}else s=n.getPointAtLength(a);if(!s)break;let c=Math.atan2(s.y-i.y,s.x-i.x);m.push({char:t.text,x:i.x,y:i.y,rotation:c,width:t.width,style:t.style,ascent:t.ascent,descent:t.descent,pathOffset:g,shaped:t.shaped,clipStyle:t.clipStyle,strokeImageStyle:t.strokeImageStyle}),h=a+(t.style.letterSpacing||0),g+=t.width+(t.style.letterSpacing||0)}HD(m,e=>e.clipStyle,(e,t)=>{e.clipRange=t}),HD(m,e=>e.strokeImageStyle,(e,t)=>{e.strokeImageRange=t});let _=UD(m,a);return{glyphs:m,textWidth:l,pathLength:d,lineHeight:c,bounds:_,textBaseline:a}}function HD(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 UD(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=ID(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 WD(e){let{html:t,align:n=`left`,textBaseline:r=`alphabetic`}=e,i=typeof e.path==`string`?MD(e.path):e.path,a=e.ctx??KD(),o=e.ctx===void 0,{fragment:s,css:c}=Jw(t),l=CT(s,c,2**53-1);o||a.save();try{return VD({segments:LD(l),path:i,ctx:a,align:n,textBaseline:r})}finally{o||a.restore()}}function GD(e){let{layout:t,ctx:n}=e;if(t.glyphs.length===0)return;let r=t.textBaseline;n.save();try{YD(n,t.glyphs,r),nO(n,t.glyphs,t.textWidth,r),oO(n,t.glyphs,t.textWidth,r)}finally{n.restore()}}function KD(){return Kw(!1)}var qD=new WeakMap;function JD(e,t){if(!t)return``;let n=qD.get(e);n||(n=new Map,qD.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 YD(e,t,n){let r=e=>!rE(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=JD(e,a),s=i+1;for(;s<t.length&&r(t[s])&&JD(e,t[s].style.backgroundColor)===o;)s++;ZD(e,t.slice(i,s),a,n),i=s}}function XD(e,t){let n=Math.cos(e.rotation),r=Math.sin(e.rotation),i=ID(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 ZD(e,t,n,r){if(t.length===0)return;e.save(),e.fillStyle=n,e.beginPath();let i=XD(t[0],r);e.moveTo(i.tl.x,i.tl.y);for(let n=0;n<t.length;n++){let i=XD(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=XD(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 QD(e){return e.webkitTextFillColor===`transparent`||e.color===`transparent`||rE(fD(e))}function $D(e,t,n,r){let i=t.clipStyle??(fE(t.style)?t.style:void 0);if(!i)return null;let a=t.clipRange??{start:0,width:n};return(i.backgroundImage&&i.backgroundImage!==`none`?dD(e,i.backgroundImage,a.start-t.pathOffset,a.width,r-t.ascent,t.ascent+t.descent):null)??(rE(i.backgroundColor)?null:i.backgroundColor)}function eO(e,t,n,r){let i=t.strokeImageStyle;if(!i)return null;let a=t.strokeImageRange??{start:0,width:n};return dD(e,i.webkitTextStrokeImage,a.start-t.pathOffset,a.width,r-t.ascent,t.ascent+t.descent)}function tO(e,t,n,r){return fE(t.style)||t.clipStyle!=null&&QD(t.style)?$D(e,t,n,r):QD(t.style)?null:fD(t.style)}function nO(e,t,n,r){for(let i of t){e.save(),e.translate(i.x,i.y),e.rotate(i.rotation),MT(e,i.style),e.textBaseline=`alphabetic`,e.letterSpacing=`${i.style.letterSpacing||0}px`;let t=ID(r,i.ascent,i.descent),a=tO(e,i,n,t),o=eO(e,i,n,t),s=i.style.webkitTextStrokeWidth>0,c=sD(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&&(gD(e,i.style,o),e.strokeText(i.char,0,t)),e.restore()}rO(e,i,t,a,o),e.restore()}}function rO(e,t,n,r,i){let{style:a}=t,o=a.webkitTextStrokeWidth>0,s=sT(a.paintOrder||``),c=()=>{r&&(e.fillStyle=r,e.fillText(t.char,0,n))},l=()=>{o&&(e.save(),gD(e,a,i),e.strokeText(t.char,0,n),e.restore())};s?(l(),c()):(c(),l())}function iO(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 aO(e){return e.clipStyle??(fE(e.style)?e.style:void 0)}function oO(e,t,n,r){for(let i of[`underline`,`line-through`,`overline`]){let a=0;for(;a<t.length;){let o=iO(t[a].style,i);if(!o){a++;continue}let{color:s,style:c}=o;if(rE(s)){let s=aO(t[a]);if(!s){a++;continue}let l=a+1;for(;l<t.length;){let e=iO(t[l].style,i);if(!e||!rE(e.color)||e.style!==c||!cE(e,o)||aO(t[l])!==s)break;l++}cO(e,t.slice(a,l),i,o,n,r),a=l;continue}let l=JD(e,s),u=a+1;for(;u<t.length;){let n=iO(t[u].style,i);if(!n||JD(e,n.color)!==l||n.style!==c||!cE(n,o))break;u++}lO(e,t.slice(a,u),i,o,s,r),a=u}}}function sO(e,t,n,r,i,a){let o=ID(a,e.ascent,e.descent);if(i===`underline`){let e=hD(t,r);return o+(e===null?n*.5:e)}return i===`line-through`?o-e.ascent*.3:o-e.ascent*.9}function cO(e,t,n,r,i,a){if(t.length===0)return;let o=r.style||`solid`,s=mD(r);if(s<=0)return;let c=aE(e,r.declarer).descent;for(let l of t){e.save(),e.translate(l.x,l.y),e.rotate(l.rotation);let t=$D(e,l,i,ID(a,l.ascent,l.descent));t&&uD(e,0,sO(l,r,c,s,n,a),l.width,s,o,t),e.restore()}}function lO(e,t,n,r,i,a){if(t.length===0)return;let o=r.style||`solid`,s=mD(r);if(s<=0)return;let c=aE(e,r.declarer).descent,l=e=>sO(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),uD(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 uO=`
|
|
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
|
+
`,dO=`
|
|
215
|
+
<style>
|
|
216
|
+
html, body {
|
|
217
|
+
padding: 0;
|
|
218
|
+
margin: 0;
|
|
219
|
+
}
|
|
220
|
+
${uO}
|
|
221
|
+
</style>
|
|
222
|
+
`,fO=`<style>${uO}
|
|
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 pO(e){return fO+e}function mO(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}var hO=/[\u0591-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]/;function gO(e){return hO.test(e)}function _O(e){e=e.replace(/\s/g,``);let t=0;for(var n=0;n<e.length;n++){let r=e[n];gO(r)&&(t+=1)}return t>e.length/2}function vO(e){return _O(e)?`rtl`:`ltr`}function yO(e){return vO(ax(e))}function bO(e){return e===`miter`||e===`bevel`?e:`round`}function xO(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 SO(e,t,n){let r=SC(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=CC({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 CO=null;function wO(){return CO||=document.createElement(`canvas`).getContext(`2d`),CO}function TO(e){if(!ex(e)||e.curveEnabled)return null;let t=Math.max(1,Math.round(e.height)),n=rx(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 EO(){return typeof OffscreenCanvas<`u`?!!new OffscreenCanvas(1,1).getContext(`2d`):typeof document<`u`&&!!document.createElement(`canvas`).getContext(`2d`)}function DO(e,t,n,r,i){let a=wO(),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 ${Cb(e)}`,o+=a.measureText(s.text).width}return o}function OO(e,t,n,r,i,a){if(!e.some(e=>e.fontFamily&&e.fontFamily!==n)||t.length<=1)return 0;let o=DO(e,n,r,i,a),s=wO();s.font=`${i} ${r} ${a}px ${Cb(n)}`;let c=o-s.measureText(t).width;return c<=0?0:c/(t.length-1)}function kO(e,t){let n=e.a?e.a:e,r=Qb(e),i=n.fontSize??r.fontSize,a=t?.normalizedText??qb(r.text,{fontSize:i,fontFamily:r.fontFamily}),o=t?.segments??mx(a,{fontSize:i,fontFamily:r.fontFamily}),c=Math.max(i,...o.map(e=>e.fontSize??i)),l=ax(a),u=OO(o,l,r.fontFamily,r.fontWeight||`normal`,r.fontStyle||`normal`,c),d=n.width??r.width,f=new s.TextPath({data:xO(d,n.height??r.height??0,r.curvePower,c),align:`center`,textBaseline:`middle`,text:l,fontSize:c,fontFamily:Cb(r.fontFamily),fontWeight:r.fontWeight,fontStyle:r.fontStyle,letterSpacing:r.letterSpacing*c+u,fill:r.fill}),p=f.getSelfRect();return f.destroy(),{width:p.width||d,height:p.height||c}}function AO(e){return kO(e).height}function jO(e,t){return ex(e)?e.height:kO(e,t).height}function MO(e){let t=mx(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 NO(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="${mO(e.color)}"`);let a=e.fontFamily||t.fontFamily;a!==t.fontFamily&&r.push(`font-family="${mO(Cb(a))}"`);let o=e.fontSize??t.fontSize;o!==t.fontSize&&r.push(`font-size="${o}"`);let s=mO(e.text);return r.length===0?s:`<tspan ${r.join(` `)}>${s}</tspan>`}).join(``)}var PO=`change-font-size`;function FO(e){if(!e.includes(`color`))return e;let t=Lb(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 IO(e,t){let n=Qb(e),r=t||n.fontFamily;return hx(qb(n.text,{fontSize:n.fontSize,fontFamily:r})).replace(/\n/g,`<br/>`)}function LO(e,{fontFamily:t=``,color:n=`black`,forEditor:r=!1,textOverflow:i=`resize`,text:a,textIsNormalized:o=!1}={}){let s=Qb(e),c=a??s.text,l=t||s.fontFamily,u=o?c:qb(c,{fontSize:s.fontSize,fontFamily:l}),d=gC(s.fill),f=gC(s.stroke)&&!!s.strokeWidth;(d||f)&&(u=FO(u));let p=i===`ellipsis`&&!r,m=(()=>{let e=p?TO(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 ${bC(s.stroke)}; --rt-text-stroke-image: ${s.stroke}; paint-order: stroke fill`):d&&(g=h(s.fill));let v=s.width||100,y=[`white-space: pre-wrap`,`overflow-wrap: break-word`,`width: ${v}px`,...m,g,`font-size: ${s.fontSize}px`,`font-family: ${Cb(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: ${bO(s.strokeLineJoin)}`:``].filter(Boolean).join(`; `);if(s.curveEnabled&&!r){let{segments:t,curveFontSize:r,segDefaults:i}=MO({normalizedText:u,fontSize:s.fontSize,fontFamily:l,fontWeight:s.fontWeight,fontStyle:s.fontStyle,fill:n||s.fill}),a=kO(e,{normalizedText:u,segments:t}),o=Math.round(a.width),c=a.height,p=xO(o,c,s.curvePower,r),m=NO(t,i),h=NO(t,i,{omitColors:!0}),g=mO(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+=SO(s.fill,e)}if(f&&s.strokeWidth){let e=`curve-stroke-grad-${g}`;y+=SO(s.stroke,e)}y+=`</defs>`;let b=mO(Cb(l)),x=mO(s.fontWeight||`normal`),S=mO(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="${bO(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="${bO(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=hx(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: ${Cb(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="${yO(u)}">${e}</div>
|
|
273
|
+
<div class="fill-layer" style="${i}; position: relative;" contentEditable dir="${yO(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="${yO(u)}">${hx(u).replace(/\n/g,`<br/>`)}</div>${b}`}function RO({fontFamily:e,fontSize:t,lineHeight:n}){if(typeof n==`number`)return n;let r=document.createElement(`div`);r.style.fontFamily=Cb(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 zO=e=>String(Math.round(e*100)/100),BO=e=>(e.ascent-e.descent)/2,VO=e=>!e||e===`transparent`||e===`rgba(0, 0, 0, 0)`,HO=e=>e.webkitTextFillColor===`transparent`||e.color===`transparent`||VO(e.webkitTextFillColor||e.color);function UO(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:HO(e)&&t.fillOverride||n};return t.strokeWidth&&t.stroke&&(r.stroke=t.stroke,r[`stroke-width`]=String(t.strokeWidth),r[`stroke-linejoin`]=bO(t.strokeLineJoin),r[`paint-order`]=`stroke fill`),r}var WO=[{line:`underline`,a:0,d:.5},{line:`line-through`,a:-.3,d:0},{line:`overline`,a:-.9,d:0}],GO=(e,t)=>BO(e)+t.a*e.ascent+t.d*e.descent,KO=e=>Math.max(1,Math.floor(e/10)),qO=(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 JO(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 YO=e=>{let t=q(e);return t.isValid()?t.toRgbString():String(e)};function XO(e,t){return e===`dotted`?`${zO(t)} ${zO(t*2)}`:e===`dashed`?`${zO(t*3)} ${zO(t*2)}`:null}function ZO(e,t){if(!e.some(e=>JO(e.style,`underline`)||JO(e.style,`line-through`)||JO(e.style,`overline`)))return``;let n=``;for(let r of WO){let i=0;for(;i<e.length;){let a=JO(e[i].style,r.line);if(!a){i++;continue}let o=YO(a.color),s=KO(e[i].style.fontSize),c=i+1;for(;c<e.length;){let t=JO(e[c].style,r.line);if(!t||YO(t.color)!==o||t.style!==a.style)break;c++}let l=e.slice(i,c).map((e,t)=>{let n=GO(e,r),i=qO(e,0,n),a=qO(e,e.width,n);return`${t===0?`M`:`L`}${zO(i.x)} ${zO(i.y)}L${zO(a.x)} ${zO(a.y)}`}).join(``),u=XO(a.style,s);n+=`<path d="${l}" fill="none" stroke="${mO(VO(a.color)&&t||a.color)}" stroke-width="${zO(s)}"`+(u?` stroke-dasharray="${u}"`:``)+`/>`,i=c}}return n}function QO(e){let t=e=>{let t=e.style;return!VO(t.backgroundColor)&&t.webkitBackgroundClip!==`text`},n=e=>{let t=BO(e)-e.ascent,n=BO(e)+e.descent;return{tl:qO(e,0,t),tr:qO(e,e.width,t),br:qO(e,e.width,n),bl:qO(e,0,n)}},r=``,i=0;for(;i<e.length;){if(!t(e[i])){i++;continue}let a=e[i].style.backgroundColor,o=YO(a),s=i+1;for(;s<e.length&&t(e[s])&&YO(e[s].style.backgroundColor)===o;)s++;let c=e.slice(i,s).map(n),l=`M${zO(c[0].tl.x)} ${zO(c[0].tl.y)}`+c.map(e=>`L${zO(e.tl.x)} ${zO(e.tl.y)}L${zO(e.tr.x)} ${zO(e.tr.y)}`).join(``)+c.slice().reverse().map(e=>`L${zO(e.br.x)} ${zO(e.br.y)}L${zO(e.bl.x)} ${zO(e.bl.y)}`).join(``)+`Z`;r+=`<path d="${l}" fill="${mO(a)}" stroke="none"/>`,i=s}return r}function $O(e){return Object.entries(e).map(([e,t])=>` ${e}="${mO(t)}"`).join(``)}function ek(e){let t=e.element,n=WD({html:pO(LO(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=>UO(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=>$O(Object.fromEntries(Object.entries(e).filter(([e])=>!(e in s)))),l=e=>e.shaped&&[...e.char].length>1,u=e=>({x:e.x-BO(e)*Math.sin(e.rotation),y:e.y+BO(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=>zO(e.x)).join(` `)}" y="${e.map(e=>zO(e.y)).join(` `)}" rotate="${e.map(e=>zO(e.deg)).join(` `)}">${mO(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="${zO(r)}px"`:``;return`<g transform="translate(${zO(e.x)} ${zO(e.y)}) rotate(${zO(n)})"><text y="${zO(BO(e))}"${i}${c(o[t])}>${mO(e.char)}</text></g>`}let n=u(e);return`<text x="${zO(n.x)}" y="${zO(n.y)}" rotate="${zO(n.deg)}"${c(o[t])}>${mO(e.char)}</text>`}).join(``);let p={transform:`translate(${zO((t.width-r.width)/2-r.x)}, ${zO(-r.y)})`,"xml:space":`preserve`,...s};return{markup:QO(a)+f+ZO(a,e.fillOverride),groupAttrs:p,groupAttrsString:$O(p),bounds:r}}var tk=new Set;function nk(e){let t=String(e?.message??e);tk.has(t)||(tk.add(t),console.warn(`curved text fell back to <textPath> (no canvas backend to measure glyphs; geometry will not match the canvas):`,e))}var rk;(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`})(rk||={});function ik(e,t){let n={filter:``,html:void 0};switch(e){case rk.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 rk.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 rk.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 rk.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 rk.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 rk.white:return null;case rk.black:return null;case rk.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 rk.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 ak=new Set([`image`,`svg`,`video`,`gif`,`figure`]);function ok(e){return!!e.blurEnabled&&ak.has(e.type)&&lk(e)>0}function sk(e){let t=[],n=[],r=[];if(e.blurEnabled&&t.push(`blur(${lk(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=ik(rk[n],i.intensity);e&&(t.push(e.filter),e.html&&r.push(e.html))}if(e.shadowEnabled){let t=YC(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 ck(e,t,n){return e/1e3*Math.min(t,n)}function lk(e){return e.cropWidth===void 0?e.blurRadius:ck(e.blurRadius,e.width/(e.cropWidth||1),e.height/(e.cropHeight||1))}async function uk(e){return new Promise((t,n)=>{let r=bb.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(o(`VIDEO_FAILED`,`Failed to load video: ${r}`,{src:r,reason:`load`}))})})}async function dk(e){return new Promise(t=>{let n=bb.createElement(`video`);n.crossOrigin=`anonymous`,n.src=e,n.addEventListener(`loadedmetadata`,()=>{let{duration:e}=n;t(e)})})}var fk=new Set([`p`,`div`,`br`,`ul`,`ol`,`li`,`span`,`b`,`strong`,`i`,`em`,`u`,`s`,`strike`,`del`]),pk=new Set([`style`,`script`]),mk=new Set([`style`,`class`,`data-list`,`dir`,`start`,`value`]);function hk(e){if(!cx(e))return mO(e);let t;try{t=xb(e).body}catch{return e}return t?(gk(t),t.innerHTML):e}function gk(e){for(let t of Array.from(e.children)){let n=(t.tagName||``).toLowerCase();if(pk.has(n)){t.remove();continue}gk(t);for(let e of t.getAttributeNames())mk.has(e.toLowerCase())||t.removeAttribute(e);if(!fk.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 _k(e,t){return Object.keys(e.values).forEach(n=>e.values[n]=e.values[n]&&parseFloat(e.values[n].toFixed(t))),e}function vk(e,t,n){let r=t-1,i=n[Sk(r,n.length)];return i.marker===`Z`?vk(e,r,n):i}function yk(e,t,n){let r=t+1,i=n[Sk(r,n.length)];return i.marker===`Z`?yk(e,r,n):i}function bk(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 xk(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 Sk(e,t){return(e%t+t)%t}function Ck(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 wk(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,wk(e,t-1)),e[t].marker===`Z`&&wk(e,t-1)}function Tk(e,t,n){let r=Dk(e.values,n.values),i=Dk(t.values,e.values);return Math.min(i,r)}function Ek(e,t){return Math.atan2(t.x-e.x,t.y-e.y)}function Dk(e,t){let n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n**2+r**2)}function Ok(e,t){return Math.sin(e)*t}function kk(e,t){return Math.cos(e)*t}function Ak(e,t){let n=t/Math.tan(e);return n===1/0||n===-1/0||isNaN(n)?t:n}function jk(e,t){return t*Math.tan(e)}function Mk(e,t){let n,r=0,i=180/Math.PI*e;return i<0&&i>=-180||i>180&&i<360?n=Ak(e/2,-t):(n=Ak(e/2,t),r=1,n===1/0&&(n=t)),{offset:n,sweepFlag:r}}function Nk(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 Pk(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 xk(e.marker,r)}).map(bk)}function Fk(e,t,n){let r=[],i=[];return n&&e.forEach(e=>_k(e,n)),e.forEach(e=>{e.marker===`M`&&r.push([]),r[r.length-1].push(e)}),r.forEach(e=>{e.map(Ck),wk(e,e.length-1);let n=e[e.length-1].marker==`Z`;e.filter(e=>!e.overlap).map((e,r,a)=>{let o=vk(e,r,a),s=yk(e,r,a),c=Ek(e.values,o.values),l=Ek(e.values,s.values),u=l-c,d=180/Math.PI*u,f=Tk(e,o,s),p=Math.abs(jk(u/2,f/2)),m=Math.min(t,p),h=Mk(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+Ok(c,g),e.values.y+kk(c,g)],n=[e.values.x+Ok(l,g),e.values.y+kk(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:Nk(i),commands:i}}function Ik(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 Lk(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 Rk({rects:e,padding:t=0,cornerRadius:n=0}){let r=Lk(Ik(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`,Fk(Pk(s),n).path}function zk({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 Bk,Vk=()=>(Bk||(Bk=document.createElement(`div`),Bk.id=`polotno-hidden-do-not-touch`,Bk.style.overflow=`hidden`,Bk.style.position=`relative`,document.body.appendChild(Bk),Bk.innerHTML=`<style>#polotno-hidden-do-not-touch {${uO}}</style>`),Bk);function Hk({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=Vk();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 Uk(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=Vk();n.appendChild(t);let r=t.getBoundingClientRect();return n.removeChild(t),{width:r.width,height:r.height}}function Wk(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=Vk();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,c=!1;if(a){let e=window.getComputedStyle(a),t=parseFloat(e.letterSpacing);Number.isNaN(t)||(s=t),c=e.direction===`rtl`}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,isRtl:c})}}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){let n=!t.isRtl&&e.right>t.right,r=t.isRtl&&e.left<t.left;(n||r)&&(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,isRtl:e.isRtl})}return{rects:c.map(e=>{let{trailingLetterSpacing:t,isRtl:n}=e,{left:r,right:i,top:a,bottom:o}=e;if(t!==0){if(n){let e=r+t;r=t>0?Math.min(i,e):e}else{let e=i-t;i=t>0?Math.max(r,e):e}}return{left:r,right:i,top:a,bottom:o}}),...s}}function Gk(e){return Wk(e).rects}var Kk=e=>Uk(e).height,qk=.02,Jk=.5,Yk=.02,Xk=.05,Zk=1,Qk=49;function $k(e,t={}){let{getHtmlOptions:n={},measureHeight:r=Kk,textSplitAllowed:i=!1}=t,a=qb(e.text,{fontSize:e.fontSize,fontFamily:e.fontFamily}),o=t=>ex(e)&&r(t)>e.height+.02||!i&&!e.curveEnabled&&Hk({html:t});if(Xb(a)){let t=1,r;for(let i=0;i<Qk;i++){let i;if(t===1?i=LO(e,{...n,text:a,textIsNormalized:!0}):(r=Yb(e.text,t),i=LO({...e,fontSize:e.fontSize*t},{...n,text:r})),!o(i))break;t-=qk,r=void 0;let s=Math.max(Xk,Zk/e.fontSize);if(t<s){t=s;break}}return t>=1?{fontSize:e.fontSize}:{fontSize:e.fontSize*t,text:r??Yb(e.text,t)}}let s=e.fontSize,c={...n,text:a,textIsNormalized:!0};for(let t=0;t<Qk&&o(LO({...e,fontSize:s},c));t++)if(s-=Jk,s<Zk){s=Zk;break}return{fontSize:s}}function eA({element:e,shrink:t,layoutAt:n}){let r=e.fontSize,i=n(r);if(!t||!ex(e))return{result:i,fontSize:r};let a=()=>i.height>e.height+Yk;if(a()){let t=qb(e.text,{fontSize:e.fontSize,fontFamily:e.fontFamily||`sans-serif`}),o=Xb(t),s=Zk/e.fontSize,c=1;for(;a()&&!(o?c<=s:r<=Zk);)o?(c=Math.max(s,c-qk),r=e.fontSize*c,i=n(r,Yb(e.text,c))):(r=Math.max(Zk,r-Jk),i=n(r,t,!0))}return{result:i,fontSize:r}}var tA=e=>e.borderSize>0?Math.max(1,Math.round(e.borderSize)):0,nA=e=>tA(e)>0&&gC(e.borderColor),rA=e=>{let t=tA(e);return{boxSizing:`border-box`,backgroundOrigin:`border-box`,borderRadius:e.cornerRadius+`px`,border:t?`${t}px solid ${nA(e)?`transparent`:e.borderColor}`:`none`}},iA=(e,t)=>e?J(`div`,{style:{width:`100%`,height:`100%`,...e}},t):t,aA=(e,t)=>iA(nA(e)&&{borderRadius:e.cornerRadius+`px`,background:e.borderColor},t),oA=(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`}),sA=async({element:e,page:t,store:n,cache:r})=>{let{src:i}=e,o=e.type===`svg`&&!!e.maskSrc,s=``;e.type===`svg`&&(s=await JC(i,{cache:r}).catch(e=>{throw a(e)}),Object.keys(e.colorsReplace).length&&(s=lw(s,new Map(Object.entries(e.colorsReplace)))),o||(i=XC(ZC(s))));let c=``;e.flipX&&(c+=`scaleX(-1)`),e.flipY&&(c+=`scaleY(-1)`),c||=`none`;let l=null,u=null;if(o&&(l=oA(XC(e.stretchEnabled?ZC(s):aw(s)),e.stretchEnabled?`100% 100%`:`cover`,`${e.flipX?`100%`:`0`} ${e.flipY?`100%`:`0`}`),i=e.maskSrc),e.clipSrc){let t=e.clipSrc;u=oA(QC(t)?XC(ZC(await JC(t,{cache:r}).catch(e=>{throw a(e)}))):await qC(t,{cache:r,binary:!0}).catch(e=>{throw a(e)}),`100% 100%`)}let d=await mw(i),{cropScaledX:f,cropScaledY:p,cropScaledWidth:m,cropScaledHeight:h}=yw(o?{...e,...xw(e,d),stretchEnabled:!0}:e,d),g=J(`div`,{style:{width:`100%`,height:`100%`,...rA(e),...nA(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 aA(e,iA(u,iA(l&&{...l,transform:c},g)))},cA=(e,t,n)=>{if(t!==`change-font-size`||!ex(e)||e.curveEnabled||!e.text)return e;try{let r=$k(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}},lA={image:sA,svg:sA,text:async({element:e,page:t,store:n,textOverflow:r,textSplitAllowed:i})=>{e=cA({...e,text:hk(e.text)},r,i);let a=rx(e),o=gC(e.fill),s=gC(e.stroke),c=r===`ellipsis`?TO(e):null,l=e.text;if(e.curveEnabled){let t=qb(l,{fontSize:e.fontSize,fontFamily:e.fontFamily}),{segments:n,curveFontSize:r,segDefaults:i}=MO({normalizedText:t,fontSize:e.fontSize,fontFamily:e.fontFamily,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fill:e.fill}),c;try{c=jO(e,{normalizedText:t,segments:n})}catch{c=e.fontSize*a}let u=xO(e.width,c,e.curvePower,e.fontSize),d=null;if(EO())try{d=ek({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){nk(e)}let f=[];d||f.push(`<path id="curve-${e.id}" d="${u}" fill="none" />`),o&&f.push(SO(e.fill,`curve-fill-grad-${e.id}`,d?.bounds)),s&&e.strokeWidth&&f.push(SO(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=NO(n,i);m+=`
|
|
350
|
+
<text
|
|
351
|
+
font-family="${Cb(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="${bO(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=ex(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?qb(l,{fontSize:e.fontSize,fontFamily:e.fontFamily}):null;h&&(o||s&&e.strokeWidth)&&(h=FO(h));let g=()=>h?LO(e,{textOverflow:r,text:h,textIsNormalized:!0}):LO(e,{textOverflow:r}),_=null;if(!e.backgroundEnabled)_=null;else if(e.legacyBackground){let t=e.backgroundPadding*(e.fontSize*a),n=ex(e)?e.height:(()=>{try{return Wk(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=Wk(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=Rk({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=yO(h??l)===`rtl`?{dir:`rtl`}:null;if(e.strokeWidth&&(s||o&&!s)){let t={position:`absolute`,width:e.width+`px`,whiteSpace:`pre-wrap`,overflowWrap:`break-word`,fontSize:e.fontSize+`px`,textAlign:e.align,fontFamily:Cb(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} {${uO}}</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 b={...p,position:`absolute`,width:e.width+`px`,color:e.fill,whiteSpace:`pre-wrap`,overflowWrap:`break-word`,fontSize:e.fontSize+`px`,textAlign:e.align,fontFamily:Cb(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},x=`el-`+e.id,S=m?{id:x}:{},C=`<style>#${x} {${uO}}</style>`,w=J(`div`,{style:b,...y,...S,innerHTML:m?`${C}${v}`:v});return J(`div`,{style:{position:`relative`,width:`100%`,height:`100%`}},_,w)},line:async({element:e})=>J(`svg`,{style:{display:`block`,width:`100%`,height:`100%`,contain:`layout style size`,overflow:`visible`}},...Tw(e)),figure:async({element:e,page:t,store:n})=>{let r=Uw(e);if(e.strokeWidth&&gC(e.stroke)){let t=`figure-stroke-grad-${e.id}`,n=SO(e.stroke,t);r=Ww(r,`stroke`,e.stroke,t),r=r.replace(`</defs>`,`${n}</defs>`)}if(gC(e.fill)){let t=`figure-fill-grad-${e.id}`,n=SO(e.fill,t);r=Ww(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=>uA({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 uk(e.src),o=_w(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=tA(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 aA(e,J(`div`,{style:{position:`relative`,width:`100%`,height:`100%`,overflow:`hidden`,...rA(e)}},J(`video`,{id:m,src:e.src,style:p,controls:!0,playsInline:!0,muted:!0,volume:e.volume})))},gif:sA,table:async({element:e})=>{let t=e.rows,n=e.cols,r=e.colWidths,i=e.rowHeights,a=Df(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=Of(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=Of(o,e,t);return`${n.width}px ${n.style} ${n.color}`},d={style:{padding:s+`px`,background:o.cellBackground,fontSize:o.fontSize+`px`,fontFamily:Cb(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,ax(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 uA({element:e,page:t,store:n,elementHook:r,textOverflow:i,textSplitAllowed:a,cache:o}){let s=await lA[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}=sk(e),f=ok(e),p=iA(f&&{filter:l.join(` `),clipPath:`inset(0)`},c);return Sw(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 dA({page:e,store:t,elementHook:n,textOverflow:r,textSplitAllowed:i,cache:a}){let o=Dw(e.children),s=await Promise.all(o.map(o=>uA({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(Ew(e.background)){let{width:n,height:r}=await mw(e.background),i=await sA({element:{x:0,y:0,width:c,height:l,src:e.background,cornerRadius:0,...xw({width:c,height:l},{width:n,height:r})},page:e,store:t,cache:a});s.unshift(i)}else u=gC(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 fA(e,t={}){let{elementHook:n,textSplitAllowed:r=!1}=t,i=t.textOverflow===`resize`||t.textOverflow===`ellipsis`?t.textOverflow:PO,a=$f(e,{mode:`partial`,requirePages:!1,fillMissingIds:!0,preserveClientData:!0}),o={buffers:new Map},s=await Promise.all(a.pages.map(e=>dA({page:e,store:a,elementHook:n,textOverflow:i,textSplitAllowed:r,cache:o})));return J(`div`,{className:`design`},...Zb(a).map(e=>{let t=a.fonts.find(t=>t.fontFamily===e);return t?J(`style`,{},Wx(t).map(e=>`
|
|
363
|
+
@font-face {
|
|
364
|
+
font-family: ${Cb(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:vx(e),rel:`stylesheet`})}),...s)}var pA=(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}"`,mA=({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(`; `)}"`:pA(e,n[e])).filter(e=>e&&e.trim().length>0).join(` `);return`<${e.type} ${r}>${t||e.children.map(e=>mA({dom:e})).join(``)}</${e.type}>`};async function hA(e,t={}){return mA({dom:await fA(e,t)})}var gA=null;function _A(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}=Jw(t),l=CT(s,c,n),u=e.ctx??gA??(gA=Kw(!0));u.fontKerning=`normal`;let{root:d,height:f,lines:p}=aD(u,l,n,o,a);return{layoutRoot:d,height:r||f,lines:p}}function vA(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 xD(o,t.layoutRoot),{canvas:a}}function yA(e,t,n){let r=(t.textDecorationLine||``).split(/\s+/).filter(e=>e&&!(n.textDecorationLine||``).includes(e));return{text:e,bold:Ib(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:Nb(t.fontFamily)??void 0,fontSize:t.fontSize===n.fontSize?void 0:t.fontSize}}var bA;function xA(){return bA||=typeof OffscreenCanvas<`u`?new OffscreenCanvas(1,1).getContext(`2d`):document.createElement(`canvas`).getContext(`2d`),bA}function SA(e){let t=e.lineHeight,n=aE(xA(),e),r=XT(t,n.ascent,n.descent);return{ascent:r,descent:t-r}}var CA=/[\s\u00AD\u200B-\u200D\uFEFF]/g;function wA(e){return e.replace(CA,``).length}function TA(e,t){let n=new Set,r=Lb(e);if(!r)return n;let i=0,a=e=>{for(let r of Array.from(e.childNodes)){if(r.nodeType===3){i+=wA($b(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 EA(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=SA(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=SA(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}=SA(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:yA(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=SA(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+=wA(n.seg.text);n.has(e)&&(t.lastInParagraph=!0)}}return f}function DA(e,{shrink:t}){let n=Math.max(1,e.width),r={...e,fill:gC(e.fill)?`black`:e.fill,stroke:gC(e.stroke)?`black`:e.stroke,align:e.align===`justify`?`left`:e.align},{result:i,fontSize:a}=eA({element:e,shrink:t,layoutAt:(t,i,a=!1)=>_A({html:pO(LO({...r,fontSize:t},{fontFamily:e.fontFamily,color:r.fill||`black`,textOverflow:`resize`,text:i,textIsNormalized:a})),width:n,accuracy:`performance`,ctx:xA()})}),o=(i.layoutRoot.children.find(e=>e.type===`box`)??i.layoutRoot).style,s=/<br|\n/i.test(e.text)?TA(IO(e),e.textTransform||`none`):new Set;return{lines:EA(i.layoutRoot,o,s),height:i.height,fontSize:a}}function OA(e,t,n){let r=SC(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`,...CC({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 kA=(e,t)=>e===`center`?`middle`:e===`right`==(t===`rtl`)?`start`:`end`,AA=(e,t)=>qC(e,{cache:t,binary:!0}).catch(t=>(console.error(`Error converting URL to data URL:`,t),e)),jA=async({element:e,page:t,store:n,cache:r})=>{let[i,o,s]=await Promise.all([e.type===`svg`?JC(e.src,{cache:r}).then(t=>uw(t,new Map(Object.entries(e.colorsReplace)))):AA(e.src,r),e.clipSrc?AA(e.clipSrc,r):void 0,e.maskSrc?AA(e.maskSrc,r):void 0]).catch(e=>{throw a(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}=yw(e,await mw(i)),g=`clip-${e.id}`,_=e.cornerRadius||0,v=gw(e),y=i.replace(/&/g,`&`),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&&o&&x.push(J(`mask`,{id:l,maskUnits:`userSpaceOnUse`,"mask-type":`alpha`},J(`image`,{href:o.replace(/&/g,`&`),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,`&`),w.mask=`url(#${u})`;let t=await mw(s),n=xw(e,t),r=yw({...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&&gC(e.borderColor),O=D?`border-grad-${e.id}`:null;if(D){let t=OA(e.borderColor,O);t&&x.push(t)}let ee=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,k=J(`g`,{},J(`defs`,{},...x),J(`image`,{href:S,...C,...w}));return J(`g`,T,c&&!d?J(`g`,{transform:c},k):k,ee)},MA=async({element:e,textOverflow:t})=>{let n=rx(e),r=gC(e.fill),i=gC(e.stroke),a=t===`change-font-size`,o=t=>t.forEach(t=>{t.text=$b(t.text,e.textTransform)});if(e.curveEnabled){let t=qb(e.text,{fontSize:e.fontSize,fontFamily:e.fontFamily}),{segments:a,curveFontSize:s,segDefaults:c}=MO({normalizedText:t,fontSize:e.fontSize,fontFamily:e.fontFamily,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fill:e.fill}),l;try{l=jO(e,{normalizedText:t,segments:a})}catch{l=e.fontSize*n}let u=xO(e.width,l,e.curvePower,e.fontSize),d=mO(e.id||`temp`),f=`curve-path-${d}`,p=null;if(EO())try{p=ek({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){nk(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=OA(e.fill,t,p?.bounds);n&&g.push(n)}if(i&&e.strokeWidth){let t=`curve-stroke-grad-${d}`,n=OA(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=NO(a,c),y=NO(a,c,{omitColors:!0});if(_){let t={"font-size":e.fontSize+`px`,"text-anchor":`middle`,"dominant-baseline":`central`,"font-family":Cb(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":bO(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":Cb(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?bO(e.strokeLineJoin):void 0,"paint-order":e.strokeWidth?`stroke fill`:void 0},J(`textPath`,{href:`#${f}`,startOffset:`50%`,innerHTML:v})))}let s=DA(e,{shrink:a}),{lines:c,fontSize:l}=s,u=ix(e,s.height),d=e.verticalAlign===`middle`?(u-s.height)/2:e.verticalAlign===`bottom`?u-s.height:0,f=l*n,p=yO(e.text),m=kA(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 NO(e.map(e=>e.seg),g,t);let n=``,r=0,i=[],a=()=>{if(i.length===0)return;let e=NO(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)?kA(`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:mO(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":Cb(e.fontFamily),"font-style":e.fontStyle,"font-weight":e.fontWeight,fill:t,stroke:D,"stroke-width":e.strokeWidth||void 0,"stroke-linejoin":e.strokeWidth?bO(e.strokeLineJoin):void 0,"paint-order":e.strokeWidth?`stroke fill`:void 0},...E),ee=e.backgroundPadding*(f*.5),k=e.backgroundCornerRadius*(f*.5),A=null;if(e.backgroundEnabled){if(e.legacyBackground)A=J(`rect`,{x:-ee,y:-ee,width:e.width+ee*2,height:u+ee*2,fill:e.backgroundColor,opacity:e.backgroundOpacity,rx:k,ry:k});else{let t=Rk({rects:zk({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:ee,cornerRadius:k});t&&(A=J(`path`,{d:t,fill:e.backgroundColor,opacity:e.backgroundOpacity,transform:d?`translate(0,${d})`:void 0}))}}let j=[];if(r){let t=OA(e.fill,`text-fill-grad-${e.id}`);t&&j.push(t)}if(i&&e.strokeWidth){let t=OA(e.stroke,`text-stroke-grad-${e.id}`);t&&j.push(t)}let M={"font-size":l+`px`,"text-anchor":m,direction:h,"font-family":Cb(e.fontFamily),"font-style":e.fontStyle,"font-weight":e.fontWeight,"text-decoration":e.textDecoration,"letter-spacing":e.letterSpacing*l+`px`},te=e.strokeWidth&&(i||r),N=r?`url(#text-fill-grad-${e.id})`:e.fill,P=te?(()=>{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":bO(e.strokeLineJoin)},...t),J(`text`,{...M,fill:N},...r?t:T(!1))]})():[J(`text`,{...M,fill:N,"stroke-width":e.strokeWidth||void 0,stroke:e.strokeWidth?e.stroke:void 0,"stroke-linejoin":e.strokeWidth?bO(e.strokeLineJoin):void 0,"paint-order":e.strokeWidth?`stroke fill`:void 0},...T(r))];return J(`g`,{},A,j.length>0?J(`defs`,{},...j):null,...P,O(N))},NA=async({element:e})=>J(`g`,{},...Tw(e)),PA=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=>zA({element:e,page:t,store:n,elementHook:r,textOverflow:i,cache:a}))));function FA(e){let t=e.replace(/<svg[^>]*>/,``);return t=t.replace(/<\/svg>/,``),t}var IA=async({element:e,page:t,store:n})=>{let r=FA(Uw(e)),i=[];if(e.strokeWidth&&gC(e.stroke)){let t=`figure-stroke-grad-${e.id}`,n=OA(e.stroke,t);n&&(i.push(n),r=Ww(r,`stroke`,e.stroke,t))}if(gC(e.fill)){let t=`figure-fill-grad-${e.id}`,n=OA(e.fill,t);n&&(i.push(n),r=Ww(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})},LA=(e,t,n)=>({...e,width:n.width,height:n.height,text:mO(t)}),RA={image:jA,svg:jA,text:MA,line:NA,figure:IA,group:PA,gif:jA,table:async({element:e,page:t,store:n,textOverflow:r})=>{let i=e.cols,a=e.colWidths,o=e.rowHeights,s=Df(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)=>Of(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:ax(e.text||``)})).filter(({text:e})=>e).map(async({cell:t,text:n})=>{let i=l(t),a=kf(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 MA({element:LA(t,n,s),textOverflow:r});return J(`g`,{transform:`translate(${s.x}, ${s.y})`},c)}));return J(`g`,{},...c,...f)}};async function zA({element:e,page:t,store:n,elementHook:r,textOverflow:i,cache:a}){let o=await RA[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}=sk(e),d=u.map(e=>e.replace(/<svg([^>]*)>/,`<g$1>`).replace(/<\/svg>/,`</g>`)),f=ok(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 Sw(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 BA({page:e,store:t,elementHook:n,textOverflow:r,cache:i}){let a=Dw(e.children),o=await Promise.all(a.map(a=>zA({element:a,page:e,store:t,elementHook:n,textOverflow:r,cache:i}))),s={},c=Ew(e.background),l;if(c){let n=await mw(e.background);l=J(`image`,{"xlink:href":await bw(e.background,{width:t.width,height:t.height,x:0,y:0,...xw({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(gC(e.background)){let n=`page-bg-gradient-${e.id}`;l=J(`g`,{},J(`defs`,{},OA(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)}async function VA(e){try{return`data:font/ttf;base64,${pC(await kx(e))}`}catch(t){return console.error(`Error embedding font:`,t),e}}async function HA(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=Wx(n);return J(`style`,{},(await Promise.all(t.map(async t=>{let r=await VA(t.src?.match(/url\("?(.*?)"?\)/)?.[1]||n.url);return`@font-face {
|
|
371
|
+
font-family: ${Cb(e)};
|
|
372
|
+
font-style: ${t.fontStyle};
|
|
373
|
+
font-weight: ${t.fontWeight};
|
|
374
|
+
src: url(${r});
|
|
375
|
+
}`}))).join(`
|
|
376
|
+
`))}try{let t=await Hx(e);return J(`style`,{},(await Promise.all([...t].map(async([t,n])=>{let[r,i]=t.split(`,`),a=await VA(n[n.length-1].url);return`@font-face {
|
|
377
|
+
font-family: ${Cb(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('${Px(e)}');`.replace(/&/g,`&`)}))}}))}async function UA(e,t={}){let{elementHook:n}=t,r=t.fontEmbedding===`none`?`none`:`inline`,i=t.textOverflow===`resize`?`resize`:PO,a=$f(e,{mode:`partial`,requirePages:!1,fillMissingIds:!0,preserveClientData:!0}),o=Zb(a),s={buffers:new Map},[c,l]=await Promise.all([r===`inline`?HA(o,a.fonts):Promise.resolve([]),Promise.all(a.pages.map(e=>BA({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 WA=(e,t)=>typeof t==`object`?`${e}="${Object.keys(t).map(e=>`${e}:${t[e]};`).join(` `)}"`:t==null||t===``?``:`${e}="${mO(String(t))}"`,GA=({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=>WA(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=>GA({dom:e,nestLevel:t+1,inline:l})).join(``);return l?`${c}${u}</${e.type}>${s}`:`${c}\n${u}${o}</${e.type}>${s}`};async function KA(e,t={}){return GA({dom:await UA(e,t)})}var qA=new Set,JA=(e,t)=>{qA.has(e)||(qA.add(e),console.warn(t))},YA=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 Zh(e)?Wh(e,eM):null},get store(){return Zh(e)?Wh(e,aM):null},get top(){if(!Zh(e))return e;let t=e;for(;;){if(!Uh(t,Zj))return t;t=Wh(t,Zj)}},get parent(){if(!Zh(e))return null;if(Uh(e,Zj)){let t=Wh(e,Zj);return t&&t.children&&t.children.length,t}if(Uh(e,eM)){let t=Wh(e,eM);return t&&t.children&&t.children.length,t}if(Uh(e,aM)){let t=Wh(e,aM);return t&&t.pages&&t.pages.length,t}return null},get zIndex(){return Zh(e)?e.parent.children.indexOf(e):-1}})).actions(e=>({toJSON:()=>Object.assign({},Vh(e))})).actions(e=>({clone(t={},{skipSelect:n=!1}={}){let r=JSON.parse(JSON.stringify(e.toJSON()));t.id=t.id||xy(10);let i=new Map;return Sb(r,e=>{let t=e.id,n=xy(10);i.set(t,n),e.id=n}),Sb(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 XA(e){return e/180*Math.PI}function ZA(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 QA(e){let[t,n,r,i]=$A(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 $A(e){let{x:t,y:n,width:r,height:i}=e,a=XA(e.rotation);return[ZA(t,n,0,0,a),ZA(t,n,r,0,a),ZA(t,n,r,i,a),ZA(t,n,0,i,a)]}function ej(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 tj(e){let t=e.map(e=>QA(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 nj(e){let t=XA(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 rj(e,t,n){let r=XA(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 ij(e,t){return rj(e,t,nj(e))}var aj={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}}},oj={right:{cropX:-1},left:{cropX:1},up:{cropY:1},down:{cropY:-1}},sj={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 ij({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=aj[n.data.direction]||aj.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=oj[n.data.direction||`right`]||oj.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}},cj=({element:e,dTime:t,animation:n})=>{let r=sj[n.name];return r?r({element:e,dTime:t,animation:n}):(console.error(`Can not find animation type: `+n.name),{})},lj=K.model(`Animation`,{delay:0,duration:500,enabled:!0,type:K.enumeration(`Type`,[`enter`,`exit`,`loop`]),name:`none`,data:K.frozen({})}),uj=(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},dj=K.model(`ShapeFilter`,{intensity:1}),fj=[`temperature`,`contrast`,`highlights`,`shadows`,`white`,`black`,`saturation`,`vibrance`],pj=YA.named(`Shape`).props({x:0,y:0,width:100,height:100,rotation:0,opacity:1,animations:K.array(lj),blurEnabled:!1,blurRadius:10,brightnessEnabled:!1,brightness:0,sepiaEnabled:!1,grayscaleEnabled:!1,filters:K.map(dj),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=Zt(i),o=fr(e=>{for(let t in e)a[t]=e[t]}),s=fr(e=>{Object.assign(a,e)}),c=fr(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(!Zh(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=uj(e,cj({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=uj(e,cj({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=uj(e,cj({element:e,animation:h,dTime:i}));c(t)}return a},animated(e){return this.a[e]},get timeRange(){return Zh(e)&&e.page?h(e.animations,e.page.duration):{start:0,end:0}},get active(){if(!Zh(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!!Zh(e)&&e.store.selectedShapes.indexOf(e)>=0&&e.selectable},get isSelectedDirectly(){return!!Zh(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){fj.includes(t)||e.filters.forEach((t,n)=>{fj.includes(n.toString())||e.filters.delete(n.toString())}),n==null?e.filters.delete(t):e.filters.set(t,{intensity:n})}})),mj=e=>typeof e==`string`?tx(e)??e:e,hj=pj.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:jf(e.fontSize),lineHeight:mj(e.lineHeight)});return ex(t)||delete t.height,t}).actions(e=>{let t=e.set;return{set(e){e.fontSize!=null&&(e=Object.assign(Object.assign({},e),{fontSize:jf(e.fontSize)})),typeof e.lineHeight==`string`&&(e=Object.assign(Object.assign({},e),{lineHeight:mj(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()}}}),gj=pj.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=Zt.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)}}}}),_j=gj.named(`Video`).props({type:`video`,duration:0,startTime:0,endTime:1,volume:1,speed:1}),vj=pj.named(`Line`).props({type:`line`,width:400,height:10,color:`black`,dash:K.array(K.number),startHead:``,endHead:``}).actions(e=>({})),yj=pj.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()}})),bj=pj.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}),xj=gj.named(`Gif`).props({type:`gif`,duration:0,keepRatio:!0}),Sj=.05,Cj=K.enumeration([`solid`,`dashed`,`dotted`,`none`]);function wj(e){return Hh(e,2)}function Tj(e,t,n){return e[`_${t}`]??(Zh(e)?wj(e)[t]:n)}function Ej(e){return Hh(e,1)}var Dj=K.model(`BorderSide`,{color:K.maybe(K.string),width:K.maybe(K.number),style:K.maybe(Cj)}).postProcessSnapshot(e=>{let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=r);return t}),Oj=K.model(`CellBorders`,{top:K.maybe(Dj),right:K.maybe(Dj),bottom:K.maybe(Dj),left:K.maybe(Dj)}).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=Ef,Aj=new Set(kj),jj=[`blurEnabled`,`blurRadius`,`brightnessEnabled`,`brightness`,`sepiaEnabled`,`grayscaleEnabled`,`filters`,`shadowEnabled`,`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`,`shadowColor`,`shadowOpacity`],Mj=[`id`,`type`,`text`,`opacity`,`rowSpan`,`colSpan`,`mergedInto`,`name`,`custom`,`borders`],Nj=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(`.`)),Pj={opacity:1,rowSpan:1,colSpan:1,name:``},Fj=[],Ij=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(Oj),name:``,custom:K.frozen()}).volatile(()=>({_editModeEnabled:!1,filters:Zt.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 Mj)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=jf(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 Pj&&r===Pj[n])continue;t[n]=r}return t}).views(e=>{let t={get row(){if(!Zh(e))return 0;let t=wj(e),n=Ej(e).indexOf(e);return n===-1?0:Math.floor(n/t.cols)},get col(){if(!Zh(e))return 0;let t=wj(e),n=Ej(e).indexOf(e);return n===-1?0:n%t.cols},get store(){return Zh(e)?Gh(e):null},get page(){if(!Zh(e))return null;try{return wj(e).page}catch{return null}},get fontSize(){return Tj(e,`fontSize`,30)},get fontFamily(){return Tj(e,`fontFamily`,`Roboto`)},get fontWeight(){return Tj(e,`fontWeight`,`normal`)},get fontStyle(){return Tj(e,`fontStyle`,`normal`)},get textDecoration(){return Tj(e,`textDecoration`,``)},get textTransform(){return Tj(e,`textTransform`,`none`)},get fill(){return Tj(e,`fill`,`black`)},get align(){return Tj(e,`align`,`left`)},get verticalAlign(){return Tj(e,`verticalAlign`,`top`)},get lineHeight(){return Tj(e,`lineHeight`,1.2)},get letterSpacing(){return Tj(e,`letterSpacing`,0)},get strokeWidth(){return Tj(e,`strokeWidth`,0)},get stroke(){return Tj(e,`stroke`,`black`)},get cellBackground(){return Tj(e,`cellBackground`,`transparent`)},get cellPadding(){return Tj(e,`cellPadding`,4)},get width(){if(!Zh(e))return 100;try{return wj(e).getCellRect(t.row,t.col,e.rowSpan,e.colSpan).width}catch{return 100}},get height(){if(!Zh(e))return 100;try{return wj(e).getCellRect(t.row,t.col,e.rowSpan,e.colSpan).height}catch{return 100}},get borderInsets(){if(!Zh(e))return{top:0,right:0,bottom:0,left:0};let n=wj(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(!Zh(e))return{x:0,y:0,width:100,height:100,rotation:0,opacity:1,fontSize:16};let n=wj(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=Zh(e)?wj(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 Fj}};return t}).actions(e=>({toJSON:()=>Object.assign({},Vh(e)),set(t){t.fontSize!=null&&(t=Object.assign(Object.assign({},t),{fontSize:jf(t.fontSize)}));let n={};for(let[e,r]of Object.entries(t))Aj.has(e)?n[`_${e}`]=r:e===`borders`?n.borders=r&&JSON.parse(JSON.stringify(r)):Nj.has(e)||(n[e]=r);Object.assign(e,n)},setBorder(t,n){let r=e.borders?Object.assign({},Vh(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=Qh(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 Lj(e,t){let n=[];for(let r of e){let e={id:xy(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]=Vh(t))}Object.keys(n).length>0&&(e.borders=n)}n.push(e)}return n}function Rj(e){return Array.from({length:e},()=>1/e)}function zj(e){let t=e.reduce((e,t)=>e+t,0);return t===0?Rj(e.length):e.map(e=>e/t)}var Bj=pj.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(Ij),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:jf(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))Aj.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:Zt.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:xy(10),text:``});return n}(e.rows,e.cols));else if(e.cells.length<t)for(;e.cells.length<t;)e.cells.push(Qh({id:xy(10),text:``}));else e.cells.length>t&&e.cells.splice(t);e.colWidths.length===0&&e.colWidths.replace(Rj(e.cols)),e.rowHeights.length===0&&e.rowHeights.replace(Rj(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:jf(e.fontSize)})),t(e)},setCellContentHeight(t,n){e._cellContentHeights.set(t,n)},_applyFitRowsToContent(){if(!Zh(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(Zh(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=Lj(c,!0);e.cells.splice(l,0,...u),e.rows+=1,e.height=a,e.rowHeights.replace(zj(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(zj(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=Lj(c,!1);for(let n=e.rows-1;n>=0;n--)e.cells.splice(n*o+t,0,Qh(l[n]));e.cols+=1,e.width=i,e.colWidths.replace(zj(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(zj(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(Rj(t))},distributeColumnsEvenly(){e.colWidths.replace(Rj(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<Sj?(r[t]=Sj,r[t+1]=i-Sj):o<Sj?(r[t+1]=Sj,r[t]=i-Sj):(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(Sj,o),l=Math.max(Sj,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||xy(10),r.cells){let e=new Map;r.cells.forEach(t=>{let n=t.id,r=xy(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})}})),Vj=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},Hj=(e,t)=>{if(e.children)for(let n of e.children){if(!0===t(n))break;Hj(n,t)}};function Uj(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];Yh(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&&(Yh(r),e.children.remove(r),e.children.splice(n,0,r))}}}var Wj=[...Array(20)].map((e,t)=>K.late(()=>Qj[t])),Gj=K.union({dispatcher:e=>{let t=$j[e.type];if(!t){let t=`Unknown element type: "${e.type}"`;throw o(`DESIGN_INVALID`,t,{errors:[{path:`type`,message:t}],knownTypes:Object.keys($j)})}return t}},yj,hj,gj,vj,_j,bj,xj,Bj,K.late(()=>Zj),...Wj),Kj=Object.freeze({x:0,y:0,offsetX:0,offsetY:0,scaleX:1,scaleY:1,rotation:0,opacity:1});function qj(e){return e===1?Kj:Object.assign(Object.assign({},Kj),{opacity:e})}var Jj={x:0,y:0,width:0,height:0,rotation:0,opacity:1,fontSize:0,cropX:0,cropY:0,cropWidth:1,cropHeight:1},Yj=(e,t)=>typeof e==`number`&&isFinite(e)?e:t;function Xj(e,t,n,r){Jj.x=e.x,Jj.y=e.y,Jj.width=e.width,Jj.height=e.height,Jj.opacity=r;let i=cj({element:Jj,animation:t,dTime:n})||{},a=Yj(i.width,e.width),o=Yj(i.height,e.height);return{x:Yj(i.x,e.x),y:Yj(i.y,e.y),width:a>0?a:e.width,height:o>0?o:e.height,rotation:Yj(i.rotation,0),opacity:Yj(i.opacity,r)}}var Zj=YA.named(`Group`).props({type:`group`,children:K.array(Gj),animations:K.array(lj)}).views(e=>({get draggable(){let t=!0;return Hj(e,e=>{e.draggable||(t=!1)}),t},get resizable(){let t=!0;return Hj(e,e=>{e.resizable||(t=!1)}),t},get contentEditable(){let t=!0;return Hj(e,e=>{e.contentEditable||(t=!1)}),t},get styleEditable(){let t=!0;return Hj(e,e=>{e.styleEditable||(t=!1)}),t},get locked(){let t=!0;return Hj(e,e=>{e.locked||(t=!1)}),t},get _restingBbox(){let t=[];if(Hj(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=tj(t);return n.width<=0||n.height<=0?null:{x:n.x,y:n.y,width:n.width,height:n.height}},get a(){if(!Zh(e))return Kj;let t=r(e);if(t===null||e.store.isEditingPaused&&this.isSelectedDirectly)return qj(e.opacity);let n=e.page,i=e.store.animatedElementsIds;if(i.length&&!i.includes(e.id))return qj(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 qj(e.opacity);let f=this._restingBbox;if(!f)return qj(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=Xj(f,a,t-a.delay,e.opacity)),u&&(p=Xj(f,o,t-(n.duration-o.duration-o.delay),e.opacity)),d&&(p.opacity=0),s&&(p=Xj(p,s,t,p.opacity));let m=nj(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!!Zh(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=Vj(t,[`draggable`,`contentEditable`,`styleEditable`,`resizable`]);n!==void 0&&Hj(e,e=>{e.set({draggable:n})}),r!==void 0&&Hj(e,e=>{e.set({contentEditable:r})}),i!==void 0&&Hj(e,e=>{e.set({styleEditable:i})}),a!==void 0&&Hj(e,e=>{e.set({resizable:a})}),Object.assign(e,o)},addElement(t,{skipSelect:n=!1}={}){let r=$j[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||xy(10)});let i=r.create(Object.assign({id:xy(10)},t));return e.children.push(i),i.selectable&&!n&&e.store.selectElements([i.id]),i}},Uj(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))}})),Qj=[],$j={svg:yj,text:hj,image:gj,group:Zj,line:vj,video:_j,figure:bj,gif:xj,table:Bj},eM=K.model(`Page`,{id:K.identifier,children:K.array(K.late(()=>Gj)),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 Wh(e,aM)}})).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(!Zh(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 ep(e)}})).actions(e=>({toJSON:()=>JSON.parse(JSON.stringify(Vh(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=xy(10);r.set(t,n),e.id=n,Sb(e,e=>{let t=e.id,n=xy(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:xy(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=$j[t.type];if(!r){console.error(`Can not find model with type `+t.type);return}`children`in t&&Array.isArray(t.children)&&Sb(t,e=>{e.id=e.id||xy(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:xy(10),name:`${t.type}-${i+1}`},t));return e.children.push(a),a.selectable&&!n&&e.store.selectElements([a.id]),a}},Uj(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;Hj(e,e=>{e.type!==`group`&&(i(e)||r.push(e))});let a=r.length?tj(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*_;Hj(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})}})),tM=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({},Vh(e))})).actions(e=>({set(t){Object.assign(e,t)}})),nM=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};Dh(`ignore`);var rM=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})),iM={ADMIN:`admin`,VIEWER:`viewer`},aM=K.model(`Store`,{role:``,pages:K.array(eM),fonts:K.array(rM),audios:K.array(tM),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(yy,{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=nn(()=>{let t={};return Sb({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 Hj({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 Sb({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=Qh(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=Qh([])},stop(){i.pause(),e.currentTime=0,i.checkActivePage()},__(){e._validated||=(eb(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=eM.create(Object.assign({id:xy(10)},t));return e.pages.push(n),e._activePageId=n.id,e._selectedPagesIds=Qh([]),n},selectPage(t){e._activePageId=t,e._selectedPagesIds.length===1&&(e._selectedPagesIds=Qh([t]))},selectPages(t){e._selectedPagesIds=Qh(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=Qh(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&&(Yh(r),e.pages.remove(r),e.pages.splice(n,0,r))},deletePages(t){let n=e.pages.indexOf(e.activePage);t.forEach(t=>{Xh(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=Qh(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=>Yh(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:xy(10),name:`group-${a+1}`,children:r,type:`group`},n);return i.children.push(o),e.selectedElementsIds=Qh([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=>{Yh(e),t.children.push(e)}),t.children.splice(n,1)}}),e.selectedElementsIds=Qh(r)},deleteElements(t){let n=[];e.find(e=>(t.includes(e.id)&&n.push(e),!1)),n.forEach(e=>{Xh(e)}),e.selectedElementsIds=Qh(e.selectedElementsIds.filter(t=>e.getElementById(t)))},on(t,n){if(t===`change`){let t=i.toJSON();return Rh(e,e=>{let r=i.toJSON();!vy(t,r)&&(t=r,n(r))})}},async _toCanvas({pixelRatio:t,ignoreBackground:n,pageId:r,mimeType:a,includeBleed:l,_skipTimeout:u,quickMode:d=!1,_exportCanvases:f}={}){let p=t||1;r||=e.pages[0]?.id;let m=e.pages.find(e=>e.id===r);if(!m)throw o(`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;p>e._elementsPixelRatio&&i.setElementsPixelRatio(p),d?m?.set({_forceMount:!0}):m?.set({_exporting:!0});let g=await TS(()=>{let e=s.stages.filter(e=>e.getAttr(`pageId`)===r);return e.length===0?null:e});if(!g)throw m?.set({_forceMount:!1,_exporting:!1}),i.setElementsPixelRatio(h),o(`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});g.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 _=g[0];await i.waitLoading({_skipTimeout:u});let v=_.findOne(`.page-container`);if(!v)throw i.setElementsPixelRatio(h),m?.set({_forceMount:!1,_exporting:!1}),o(`EXPORT_FAILED`,`Export is failed. Canvas was unmounted.`,{reason:`unmounted-during-export`,pageId:r});let y=_.position();_.position({x:0,y:0}),_.find(`Transformer`).forEach(e=>{e.setAttr(`oldVisible`,e.visible()),e.visible(!1)}),v.find(`.page-background`).forEach(e=>e.shadowEnabled(!1)),v.find(`.page-background`).forEach(e=>e.strokeEnabled(!1)),v.find(`.highlighter`).forEach(e=>e.visible(!1));let b=v.findOne(`.page-background-group`),x=b.clip();b.clip({x:null,y:null,width:null,height:null});let S=v.findOne(`.elements-container`),C=S.clip();S.clip({x:null,y:null,width:null,height:null});let w=v.find(e=>!e.visible()&&e.getAttr(`editModeEnabled`)&&!e.getAttr(`hideInExport`));w.forEach(e=>{e.setAttr(`oldVisible`,e.visible()),e.show()});let T=v.find(e=>e.getAttr(`hideInExport`));T.forEach(e=>{e.setAttr(`oldVisible`,e.visible()),e.hide()}),n&&v.find(`.page-background`).forEach(e=>e.hide());let E=l?m.computedBleed:tp,D=E.left,O=E.top;!e.bleedVisible&&l||(e.bleedVisible||l?e.bleedVisible&&l?(D=0,O=0):e.bleedVisible&&!l&&(D=-m.computedBleed.left,O=-m.computedBleed.top):(D=0,O=0));let ee=m.computedWidth+E.left+E.right,k=m.computedHeight+E.top+E.bottom,A=v.scale();v.scale({x:1,y:1});let j=c(v,{x:v.x()-D,y:v.y()-O,width:ee,height:k,pixelRatio:p,sceneCanvas:f?.sceneCanvas,bufferCanvas:f?.bufferCanvas});v.scale(A);let M=j._canvas;if(a===`image/jpeg`){let e=M.getContext(`2d`);e.save(),e.globalCompositeOperation=`destination-over`,e.fillStyle=`white`,e.fillRect(0,0,M.width,M.height),e.restore()}return n&&v.find(`.page-background`).forEach(e=>e.show()),T.forEach(e=>{e.visible(e.getAttr(`oldVisible`))}),w.forEach(e=>{e.visible(e.getAttr(`oldVisible`))}),v.find(`.page-background`).forEach(e=>e.shadowEnabled(!0)),v.find(`.page-background`).forEach(e=>e.strokeEnabled(!0)),_.find(`Transformer`).forEach(e=>{e.visible(e.getAttr(`oldVisible`))}),v.find(`.highlighter`).forEach(e=>e.visible(!0)),b.clip(x),S.clip(C),_.position(y),m?.set({_exporting:!1,_forceMount:!1}),await Promise.resolve(),i.setElementsPixelRatio(h),M},async toDataURL(t={}){var{mimeType:n,quality:r,dpi:a,dpiMetadata:o=`auto`}=t,c=nM(t,[`mimeType`,`quality`,`dpi`,`dpiMetadata`]);let l=await i._toCanvas(Object.assign({mimeType:n},c)),u=n||`image/png`,d=l.toDataURL(u,r);s.Util.releaseCanvas(l);let f=a??e.dpi;return u!==`image/png`&&u!==`image/jpeg`||o===`never`||o===`auto`&&f===72?d:bS(d,u,f)},async toBlob(e={}){var{mimeType:t,quality:n}=e,r=nM(e,[`mimeType`,`quality`]);let a=await i._toCanvas(Object.assign({mimeType:t},r)),o=await new Promise(e=>{a.toBlob(e,t,n)});return s.Util.releaseCanvas(a),o},async saveAsImage(e={}){var{fileName:t}=e,n=nM(e,[`fileName`]);let r=(n.mimeType||`image/png`).split(`/`)[1];Sy(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),s=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 wy(),d=e=>xS({px:e,unit:a,dpi:n}),f=t.cropMarkSize||0,p=d(f),m=l[0]||{},h=t.includeBleed&&m.computedBleed||tp,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:tp,r=e.computedWidth+n.left+n.right+2*f,a=e.computedHeight+n.top+n.bottom+2*f,o=d(r),l=d(a),u=0,p=s;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!==s&&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:o,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:s})=>{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 o(`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+s.left)*l,bottomLeftY:d(f+s.bottom)*l,topRightX:d(r-f-s.right)*l,topRightY:d(i-f-s.top)*l},c.pageContext.bleedBox={bottomLeftX:d(f+s.left)*l,bottomLeftY:d(f+s.bottom)*l,topRightX:d(r-f-s.right)*l,topRightY:d(i-f-s.top)*l},p){v.setLineWidth(d(1));let e=p+d(s.left),r=p+d(s.right),i=p+d(s.top),a=p+d(s.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 o(`EXPORT_FAILED`,`No pages found for GIF export`,{reason:`page-not-found`,pageId:t.pageId,availablePageIds:e.pages.map(e=>e.id)});let s=a[0],c=await Ey({width:s.computedWidth*n,height:s.computedHeight*n}),l=1e3/(t.fps||10);for(let t of a){let r=Math.max(1,Math.floor(t.duration/l));for(let a=0;a<r;a++){let r=t.startTime+a*l||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});c.addFrame(o.getContext(`2d`),{delay:l,copy:!0})}}for(let t of e.pages)t.set({_rendering:!1});return i.stop(),c.render(),new Promise(e=>{c.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=nM(e,[`fileName`]);Sy(await i.toGIFDataURL(n),t||`polotno.gif`)},async toHTML({elementHook:e}={}){return JA(`store.toHTML`,`store.toHTML()/saveAsHTML() are deprecated: install @polotno/html-export and call jsonToHTML(store.toJSON()) instead`),hA(i.toJSON(),{elementHook:e,textOverflow:Oy.textOverflow,textSplitAllowed:Oy.textSplitAllowed})},async saveAsHTML({fileName:e,elementHook:t}={}){let n=await i.toHTML({elementHook:t});Sy(`data:text/html;base64,`+window.btoa(unescape(encodeURIComponent(n))),e||`polotno.html`)},async toSVG({elementHook:e,pageId:t,fontEmbedding:n=`inline`}={fontEmbedding:`inline`}){JA(`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 KA(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});Sy(`data:text/svg;base64,`+window.btoa(unescape(encodeURIComponent(a))),e||`polotno.svg`)},async saveAsPDF(e={}){var{fileName:t}=e,n=nM(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 mb()},toJSON:()=>({width:e.width,height:e.height,fonts:Vh(e.fonts),pages:Vh(e.pages),audios:Vh(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=qf(t,{modernTextRenderer:Oy.htmlRenderEnabled||Oy.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({},Vh(e));Object.assign(c,o),c.history=i?Vh(e.history):{history:[],undoIdx:-1,targetPath:``},Bh(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=>Xh(e))},addAudio(t){let n=tM.create(Object.assign({id:xy(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)||Gx.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`}))),pS(a)):uS(t),n&&r&&!o.some(e=>e.fontStyle===n&&e.fontWeight===r)&&o.push({fontStyle:n,fontWeight:r}),Promise.all(o.map(e=>nS(t,e.fontStyle,e.fontWeight,i)))},validate:e=>aM.validate(e,[{path:``,type:aM}]).map(e=>({path:`store`+e.context.map(e=>e.path).join(`.`),message:e.message}))};return i});function oM({key:e,showCredit:t}={key:``,showCredit:!1}){return qy(e),aM.create({_forceShowCredit:t})}var sM=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},cM=e=>{let t=window.getComputedStyle(e).position;return t!==`absolute`&&t!==`relative`};function lM(e=()=>{}){let t=k.useRef(e);return t.current=e,k.useCallback((...e)=>t.current.apply(null,e),[])}var uM=({children:e,groupProps:t,divProps:n,transform:r,transformFunc:i,parentNodeFunc:a})=>{let o=Pm(),s=k.useRef(null),[c]=k.useState(()=>document.createElement(`div`)),l=k.useMemo(()=>A.createRoot(c),[c]),u=r??!0,d=lM(()=>{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=sM(e,[`style`]);Object.assign(c.style,t),Object.assign(c,r)});return k.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&&cM(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]),k.useLayoutEffect(()=>{d()},[n,i]),k.useLayoutEffect(()=>{queueMicrotask(()=>{(0,ma.flushSync)(()=>{l.render(k.createElement(o,null,e))})})}),k.useLayoutEffect(()=>()=>{setTimeout(()=>{l.unmount()})},[]),k.createElement(zm,Object.assign({ref:s},t))},dM=({selector:e,enabled:t,children:n})=>{let r=k.useRef(null),i=k.useRef(null),a=k.useRef(null),o=t??!0;return k.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]),k.useEffect(()=>()=>{var e;(e=a.current)==null||e.destroy()},[]),k.createElement(zm,{name:`_outer_portal`,ref:r},k.createElement(zm,{name:`_inner_portal`,ref:i},n))};function fM(e,t,n){return gr(()=>{Zh(e)&&t()},n)}function pM(e,t,n,r){return yr(()=>Zh(e)?t():void 0,(t,r)=>{Zh(e)&&n(t,r)},r)}var mM=(e,t,n)=>(t===void 0&&(t=e.fill??``),n===void 0&&(n=`fill`),k.useMemo(()=>{if(!gC(t))return{[n]:t};let{stops:r,rotation:i}=yC(t),a=e.a.width/2,o=e.a.height/2,c=(i%180+180)%180,l=c>45&&c<135?e.a.width:e.a.height,u=s.Util.degToRad(i)-Math.PI/2,d=[];return r.forEach(({offset:e,color:t})=>{d.push(e,t)}),n===`fill`?{fillLinearGradientStartPointX:a-l/2*Math.cos(u),fillLinearGradientStartPointY:o-l/2*Math.sin(u),fillLinearGradientColorStops:d,fillLinearGradientEndPointX:a+l/2*Math.cos(u),fillLinearGradientEndPointY:o+l/2*Math.sin(u),fill:r[1].color,fillPriority:`linear-gradient`}:{strokeLinearGradientStartPointX:a-l/2*Math.cos(u),strokeLinearGradientStartPointY:o-l/2*Math.sin(u),strokeLinearGradientColorStops:d,strokeLinearGradientEndPointX:a+l/2*Math.cos(u),strokeLinearGradientEndPointY:o+l/2*Math.sin(u)}},[t,e.width,e.height])),hM=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)}}},gM=new hM(500);function _M(e){if(!e||!e.includes(`<`))return!1;let t=gM.get(e);if(t===void 0){t=!1;let n=Lb(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}}gM.set(e,t)}return t}function vM(e,t){return qb(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 yM(e){if(!e||!e.includes(`<p`))return e;let t=Lb(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 bM(e,t){let n=t.fontFamily,r=String(Fb(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=Lb(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=Nb(l.style.fontFamily)||``;else{let t=(l.getAttribute(`class`)||``).split(/\s+/).find(e=>e.startsWith(`ql-font-`));t&&(e=Mb(t))}}s||(l.style.fontWeight?s=String(Fb(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 xM(e){return!!e?.style&&(e.style.getPropertyValue(`-webkit-background-clip`)||e.style.getPropertyValue(`background-clip`))===`text`&&e.style.backgroundImage.includes(`gradient`)}var SM=Symbol(`unset`);function CM(e,t){let n=SM;for(let r of e.ops){if(typeof r.insert!=`string`||r.insert===`
|
|
384
|
+
`)continue;let e=r.attributes?.[t];if(n===SM)n=e;else if(e!==n)return!0}return!1}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`){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},TM=e=>e>0?Math.max(1,Math.round(e)):0,EM=e=>(e.getStage()?.findOne(`Transformer`))?.getActiveAnchor()??``,DM=e=>!(e.includes(`middle`)||e.includes(`center`)),OM=(e,t)=>e<t?1:t,kM=e=>!!e.curveEnabled||(e.letterSpacing??0)>0||_M(e.text),AM=(e,t)=>({cornerRadius:(e.cornerRadius??0)*t,shadowBlur:e.shadowBlur*t,shadowOffsetX:e.shadowOffsetX*t,shadowOffsetY:e.shadowOffsetY*t}),jM=e=>({cornerRadius:TM(e.cornerRadius??0),shadowBlur:Math.round(e.shadowBlur),shadowOffsetX:Math.round(e.shadowOffsetX),shadowOffsetY:Math.round(e.shadowOffsetY)}),MM=(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}},NM=(e,t)=>{let n=MM(e,t);return{fontSize:Math.round(n.fontSize),strokeWidth:TM(n.strokeWidth),shadowBlur:Math.round(n.shadowBlur),shadowOffsetX:Math.round(n.shadowOffsetX),shadowOffsetY:Math.round(n.shadowOffsetY)}},PM=e=>{let t=NM(e,e.fontSize),{fontSize:n}=t;return wM(t,[`fontSize`])},FM=e=>Math.min(Math.max(e,0),255),IM={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]=FM(n[t]+15*e),n[t+2]=FM(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]=FM(i*(n[e]-128)+128),n[e+1]=FM(i*(n[e+1]-128)+128),n[e+2]=FM(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]=FM(n[t]*i),n[t+1]=FM(n[t+1]*i),n[t+2]=FM(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]=FM(n[t]*i),n[t+1]=FM(n[t+1]*i),n[t+2]=FM(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]=FM(n[t]*i),n[t+1]=FM(n[t+1]*i),n[t+2]=FM(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]=FM(r-(o-r)*l),n[t+1]=FM(i-(o-i)*l),n[t+2]=FM(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]=FM(o+(r-o)*(1+e)),n[t+1]=FM(o+(i-o)*(1+e)),n[t+2]=FM(o+(a-o)*(1+e))}return t}};IM.highlights=IM.white;var LM=IM;function RM(e){let t={filters:[]};return e.brightnessEnabled&&(t.filters.push(s.Filters.Brighten),t.brightness=e.brightness),e.blurEnabled&&(t.filters.push(s.Filters.Blur),t.blurRadius=e.blurRadius),e.sepiaEnabled&&t.filters.push(s.Filters.Sepia),e.grayscaleEnabled&&t.filters.push(s.Filters.Grayscale),e.filters.forEach((e,n)=>{let r=LM[n];r&&t.filters.push(r(e.intensity))}),t}function zM(e){if(e.brightnessEnabled||e.blurEnabled||e.sepiaEnabled||e.grayscaleEnabled)return!0;for(let t of e.filters.keys())if(LM[t])return!0;return!1}function BM(e,t){if(!Zh(t))return;let n=RM(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:()=>ck(n.blurRadius??0,e.width,e.height)};n.filters.forEach(e=>{typeof e==`function`&&e.call(a,i)}),r.putImageData(i,0,0)}function VM(e){if(!Zh(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 HM(e,t){var n;if(!e||!Zh(t))return;let r=RM(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 UM=()=>`ontouchstart`in window||navigator.maxTouchPoints>0;function WM({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 GM(e){try{let{stops:t}=yC(e);if(t.length===0)return 127.5;let n=0,r=0;for(let e of t)try{let t=s.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 KM(e){if(gC(e))return GM(e);let t=s.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 qM(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=KM(e.fill),i=KM(n);return Math.abs(r-i)>=50?n:e.fill}function JM(e){return/<\/[a-z][a-z0-9]*>/i.test(e)&&!ax(e).trim()?``:e}var YM;function XM(){return YM||(YM=document.getElementById(`polotno-text-style`),YM||(YM=document.createElement(`style`),YM.id=`polotno-text-style`,document.head.appendChild(YM)),YM)}s._fixTextRendering=!0;var ZM={border:`none`,padding:`0px`,overflow:`hidden`,background:`none`,outline:`none`,resize:`none`,overflowWrap:`break-word`,whiteSpace:`pre-wrap`,userSelect:`text`,wordBreak:`normal`,textTransform:`none`},QM=B(({textNodeRef:e,element:t,onBlur:n,selectAll:r,cursorPosition:i})=>{let[a,o]=k.useState(ZM),s=e.current;k.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=qM(t);let n=`\n .polotno-input::placeholder {\n color: ${a.color};\n opacity: 0.6;\n }\n `,r=XM();r.innerHTML=``,r.appendChild(document.createTextNode(n)),JSON.stringify(e)!==JSON.stringify(a)&&o(e)});let c=k.useRef(null);if(k.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)))},[]),k.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=ix(t.a,u);t.verticalAlign===`middle`&&(l=(d-u)/2),t.verticalAlign===`bottom`&&(l=d-u);let f=ax(t.text);return(0,j.jsx)(`textarea`,{className:`polotno-input`,ref:c,dir:vO(f),style:Object.assign(Object.assign(Object.assign({},ZM),a),{paddingTop:l+`px`}),value:f,onChange:e=>{let n=WM({oldText:t.text,newText:e.target.value,element:t});t.set(Object.assign({text:e.target.value},MM(t,n)))},placeholder:JM(t.placeholder),onBlur:n})}),$M=e=>(0,j.jsx)(uM,{children:(0,j.jsx)(QM,Object.assign({},e))}),eN=(e,t,n,r,i)=>{let[a,o]=k.useReducer(e=>e+1,0),s=k.useRef(tS(t,n,r)),c=k.useRef(null);return k.useLayoutEffect(()=>{if(s.current=tS(t,n,r),s.current)return;let a=!0;return(async()=>{s.current=!1,o();let l=fb(`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]),k.useEffect(()=>{s.current&&setTimeout(()=>{c.current&&=(c.current(),null)})},[s.current]),[s.current]},tN=(e,t,n,r,i)=>{let[a,o]=k.useReducer(e=>e+1,0),s=t.join(`\0`),c=k.useRef(t.every(e=>tS(e,n,r))),l=k.useRef(null);return k.useLayoutEffect(()=>{if(c.current=t.every(e=>tS(e,n,r)),c.current)return;let a=!0;return(async()=>{c.current=!1,o();let u=fb(`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]),k.useEffect(()=>{c.current&&setTimeout(()=>{l.current&&=(l.current(),null)})},[c.current]),[c.current]},nN=({fontLoaded:e,fontFamily:t,fontSize:n,lineHeight:r})=>k.useMemo(()=>RO({fontFamily:t,fontSize:n,lineHeight:r}),[e,t,n,r]);function rN(e){let t=k.useRef(e),n=k.useRef(e);return k.useMemo(()=>{n.current=t.current,t.current=e},[e]),n.current}function iN(e,t,n=!1){let r=e.fontSize(),i=e.height(),a=ax(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=ex(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-=Jk,e.fontSize(o)}return e.fontSize(r),e.height(i),o}var aN=B(({element:e,store:t})=>{let{textOverflowIndicatorStyle:n}=yh(),r=k.useRef(null),i=k.useRef(null),a=k.useRef(null),o=k.useRef([]),s=k.useRef(!0),[,c]=k.useReducer(e=>e+1,0),{editorEnabled:l,selectAll:u}=(e=>{let[t,n]=k.useState(!1),r=k.useRef(!1);return k.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]=k.useState(!1),[p,m]=k.useState(!1),h=k.useRef(e.a.height),g=k.useRef(0),_=k.useRef(``),v=k.useRef(0),y=e.isSelected,b=rN(y),{textVerticalResizeEnabled:x}=Oy,S=Oy.autoDeleteEmptyText,C=rN(e.fontFamily),[w,T]=k.useState([]);k.useEffect(()=>{let e=r.current?.textArr??[];JSON.stringify(e)!==JSON.stringify(w)&&T(e)}),k.useEffect(()=>{if(e.a.width||e.type===`tablecell`)return;let t=r.current;t.width(600),e.set({width:1.4*t.getTextWidth()})},[]),k.useEffect(()=>{b&&!y&&S&&e.text===``&&e.removable&&!JM(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&&HM(n,e)}else{let t=r.current;t&&HM(t,e)}};k.useLayoutEffect(()=>{if(!p)return fM(e,()=>{E()})}),k.useEffect(()=>{let e=o.current;e.length>0&&(o.current=[],e.forEach(e=>e()))}),k.useEffect(()=>()=>{s.current=!1;let e=o.current;e.length>0&&(o.current=[],e.forEach(e=>e()))},[]);let D=ax(e.text);e.textTransform===`uppercase`&&(D=D.toUpperCase());let[O]=eN(t,e.fontFamily,e.fontStyle,e.fontWeight,e.text||e.placeholder),ee=()=>{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};k.useLayoutEffect(()=>{if(!O)return;if(e.type===`tablecell`){let{textOverflow:n}=Oy;if(n===`resize`){let t=ee(),n=Zh(e)?Hh(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=iN(n,e,Oy.textSplitAllowed);r!==e.fontSize&&t.history.ignore(()=>{e.set({fontSize:r})})}}return}let{textOverflow:n,textSplitAllowed:i}=Oy,a=(n,r,i,a)=>{let l=fb(`text ${e.id}`),u=()=>{t.history.ignore(n,r,i).then(()=>{s.current?(o.current.push(l),c()):l()})};a?queueMicrotask(u):u()};if(!ex(e)){let t=ee();a(()=>{ex(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=ee();x&&e.height<t&&!d&&a(()=>{var n;Zh(e)&&e.set({height:t}),(n=r.current)==null||n.height(t)},!1,!0),x||e.height===t||d||a(()=>{var n;Zh(e)&&e.set({height:t}),(n=r.current)==null||n.height(t)},!1,!0)}}else{let t=r.current,n=e.curveEnabled?e.fontSize:iN(t,e,i);if(n!==e.fontSize){a(()=>{e.set(MM(e,n))},!1,!0);return}let o=ee();e.height===o||x||a(()=>{e.set({height:o})},!1,!0)}}}),k.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]),k.useLayoutEffect(()=>{let e=r.current;e&&(e.width(e.width()+1e-8),e.width(e.width()-1e-8),e._setTextData(),E())},[O]);let A=k.useRef(null),M=k.useRef(e.width),te=k.useRef(0),N=n=>{n.evt.preventDefault(),t.selectedShapes.find(t=>t===e)&&e.contentEditable&&(te.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())},P=JM(e.placeholder),F=!D&&P?.6:e.a.opacity;ib(r,F);let ne=nN({fontLoaded:O,fontFamily:e.fontFamily,fontSize:e.a.fontSize,lineHeight:e.lineHeight}),re=e.selectable||t.role===iM.ADMIN,ie=mM(e),I=mM(e,e.stroke,`stroke`),ae=k.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 Fk(Pk(`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*ne*.5),padding:e.backgroundPadding*(e.a.fontSize*ne*.5)}):function({lines:e,lineHeight:t,width:n,align:r=`left`,padding:i=0,cornerRadius:a=0}){return Rk({rects:zk({lines:e,lineHeight:t,width:n,align:r}),padding:i,cornerRadius:a})}({lines:JSON.parse(JSON.stringify(w)),cornerRadius:e.backgroundCornerRadius*(e.a.fontSize*ne*.5),lineHeight:ne*e.a.fontSize,padding:e.backgroundPadding*(e.a.fontSize*ne*.5),width:e.a.width,align:e.align}):``,[e.backgroundEnabled,e.curveEnabled,e.backgroundCornerRadius,e.a.fontSize,e.a.height,ne,e.backgroundPadding,e.a.width,e.align,w]),oe=UM(),se=0;if(!e.curveEnabled){let t=w.length*ne*e.a.fontSize,n=ix(e.a,t);e.verticalAlign===`middle`?se=(n-t)/2:e.verticalAlign===`bottom`&&(se=n-t)}let ce=e.curveEnabled?xO(e.a.width,e.a.height,e.curvePower,e.a.fontSize):``,le=O?Cb(e.fontFamily):C===e.fontFamily?`Arial`:Cb(C),L=vO(D);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(qm,{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*F,data:ae,fill:e.backgroundColor,offsetY:-se}),(0,j.jsx)(qm,{data:ce,stroke:n.stroke,strokeWidth:1,x:e.a.x,y:e.a.y,rotation:e.a.rotation,visible:!1}),(0,j.jsx)(Km,Object.assign({ref:i,visible:e.curveEnabled,data:ce,text:D||P,listening:!1,align:`center`,textBaseline:`middle`,direction:L},ie,I,{strokeWidth:e.strokeWidth,lineJoin:bO(e.strokeLineJoin),fillAfterStrokeEnabled:!0,fontSize:e.a.fontSize,fontFamily:`${Cb(e.fontFamily)}, ${Cb(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:F,hideInExport:!e.showInExport,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity})),(0,j.jsx)(Gm,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:ex(e.a)?e.a.height:void 0,text:D||P,direction:L},ie,I,{lineJoin:bO(e.strokeLineJoin),strokeWidth:e.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:e.a.fontSize,fontFamily:le,fontStyle:e.fontStyle+` `+e.fontWeight,textDecoration:e.textDecoration,align:e.align,verticalAlign:e.verticalAlign,draggable:oe?e.draggable&&y:e.draggable,preventDefault:!oe||y,opacity:e.curveEnabled?0:F,visible:!e._editModeEnabled,ellipsis:Oy.textOverflow===`ellipsis`,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,lineHeight:ne,letterSpacing:e.letterSpacing*e.a.fontSize,listening:!!e.selectable&&re,onDragStart:()=>{m(!0)},onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{m(!1),e.set({x:t.target.x(),y:t.target.y()})},onClick:N,onTap:N,onTransformStart:()=>{f(!0);let t=r.current;h.current=t.height(),M.current=e.a.width,A.current=t.position(),g.current=t.rotation(),v.current=t.height(),_.current=EM(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=OM(M.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=ee();if(Oy.textOverflow===`ellipsis`)o=h.current;else{let t=Math.max(o,h.current);i.height(t),e.set({height:i.height()})}let s=Oy.textVerticalResizeEnabled?Math.max(o,h.current):ee();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=Oy.textOverflow===`resize`?ee():ne*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({},NM(e,e.fontSize*r)),{width:Math.ceil(t.target.width()*r),x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),height:t.target.height()*r})),(n=a.current)==null||n.setAttrs({scaleX:1,scaleY:1}),f(!1)}})),l&&e.contentEditable&&(0,j.jsx)(`Group`,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,children:(0,j.jsx)($M,{textNodeRef:r,element:e,selectAll:u,cursorPosition:te.current,onBlur:()=>{e.set(PM(e)),e.toggleEditMode(!1)}})})]})}),oN=(e,t)=>{let n=VM(e),r=Zh(e)&&zM(e),i=n=>{if(!t||!Zh(e))return;let r=t instanceof HTMLVideoElement?t.videoWidth:t.width,i=t instanceof HTMLVideoElement?t.videoHeight:t.height;if(!r||!i)return;l(n,r,i);let a=n.getContext(`2d`);a&&(a.drawImage(t,0,0),BM(n,e))},a=k.useMemo(()=>{if(!r||!t)return;let e=document.createElement(`canvas`);return i(e),e},[t,r,n]);return k.useEffect(()=>()=>{a&&s.Util.releaseCanvas(a)},[a]),[a||t||void 0,()=>{a&&i(a)}]},sN=(e,t=100,n=!1,r)=>{let i=k.useRef(r??e),[,a]=k.useReducer(e=>e+1,0),o=k.useCallback(e=>{i.current!==e&&(i.current=e,a())},[i]),s=k.useRef(null);return e===n&&(s.current&&=(clearTimeout(s.current),null),i.current=n),k.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 cN(e,t){let n=document.createElement(`canvas`),{width:r,height:i}=function(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:{width:e.width,height:e.height}}(e);n.width=r,n.height=i;let a=n.getContext(`2d`);a.drawImage(e,0,0,r,i);let o=Math.max(1,Math.floor(r*t)),s=Math.max(1,Math.floor(i*t)),c=function(e,t,n){let r=new ImageData(t,n),i=new Int32Array(e.data.buffer),a=new Int32Array(r.data.buffer),o=t/e.width,s=n/e.height,c=Math.round(1/o),l=Math.round(1/s),u=c*l;for(let r=0;r<n;r++)for(let n=0;n<t;n++){let d=Math.round(n/o)+Math.round(r/s)*e.width,f=0,p=0,m=0,h=0;for(let t=0;t<l;t++)for(let n=0;n<c;n++){let r=i[d+n+t*e.width],a=r>>>24;f+=(r<<24>>>24)*a,p+=(r<<16>>>24)*a,m+=(r<<8>>>24)*a,h+=a}let g=h||1;f=Math.round(f/g),p=Math.round(p/g),m=Math.round(m/g),h=Math.round(h/u),a[n+r*t]=h<<24|m<<16|p<<8|f}return r}(a.getImageData(0,0,r,i),o,s);return n.width=o,n.height=s,a.putImageData(c,0,0),n}function lN(){return document.createElement(`canvas`)}var uN=e=>{let[t,n]=k.useState(e);return k.useEffect(()=>{(async()=>{let r=await async function(e){return QC(e)?XC(aw(await JC(e))):e}(e);r!==t&&n(r)})()},[e]),t};function dN(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var fN=(e,t)=>t.width<5||t.height<5?e:t,pN={keepRatio:!1,rotateEnabled:!1,boundBoxFunc:fN},mN={enabledAnchors:[`top-left`,`top-right`,`bottom-left`,`bottom-right`],rotateEnabled:!1,borderEnabled:!1,boundBoxFunc:fN};function hN(e,t){let n=_w({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 gN=(e,t,n)=>Math.max(t,Math.min(n,e)),_N=(e,t,n,r,i=0,a=!1,o=!0,c=0)=>{let u=Math.floor(gN(e.a.width*r,1,1e4)),d=Math.floor(gN(e.a.height*r,1,1e4)),f=Math.min(i*r,u/2,d/2),p=Math.min(c*r,u/2,d/2),m=Math.max(e.a.width/n.width,e.a.height/n.height)*r,h=e.page?._exportingOrRendering&&Oy.imageDownScalingEnabled&&m<1&&!a,g=n.x===0&&n.y===0&&n.width===t?.width&&n.height===t?.height,_=k.useMemo(()=>{if(t&&t.width&&t.height)return!g||f!==0||h||p?lN():void 0},[t,f,h,g,p]);return k.useLayoutEffect(()=>{if(!_||!t)return;l(_,u,d);let e=_.getContext(`2d`);if(!e)return;(f||p)&&(e.beginPath(),e.roundRect(p,p,u-2*p,d-2*p,Math.max(0,f-p)),e.clip());let r=h?cN(t,m):t,i=h?{x:Math.floor(n.x*m),y:Math.floor(n.y*m),width:Math.floor(n.width*m),height:Math.floor(n.height*m)}:n;e.drawImage(r,i.x,i.y,i.width,i.height,0,0,_.width,_.height)},[_,e.a.width,e.a.height,n.x,n.y,n.width,n.height,i,r,a,e.page?._exportingOrRendering,h,p]),k.useEffect(()=>()=>{_&&_.nodeName===`CANVAS`&&s.Util.releaseCanvas(_)},[_]),_||t},vN=lN(),yN=B(({element:e})=>{let t=Math.min(30,e.a.width/4,e.a.height/4),n=k.useRef(null);k.useEffect(()=>{let e=n.current;if(!e)return;let t=new s.Animation(t=>{e.rotate((t?.timeDiff||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}});let{mediaLoadingStyle:r}=yh();return(0,j.jsxs)(zm,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,j.jsx)(Vm,{width:e.a.width,height:e.a.height,fill:r.fill}),(0,j.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})]})}),bN=B(({element:e})=>{let{mediaErrorStyle:t}=yh(),n=Math.max(10,Math.min(30,e.a.width/25));return(0,j.jsxs)(zm,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,j.jsx)(Vm,{width:e.a.width,height:e.a.height,fill:t.fill}),(0,j.jsx)(Gm,{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=Qm.default,SN=(e,t=``,n=``)=>{let r=k.useRef(void 0),i=()=>{var e;(e=r.current)==null||e.call(r),r.current=void 0};k.useEffect(()=>i,[]),k.useLayoutEffect(()=>{let a=t.slice(0,200),s=`image with id ${n} url: ${a}`;e!==`loading`||r.current||(r.current=fb(s)),e!==`loading`&&i(),e===`failed`&&_b(o(`IMAGE_FAILED`,s,{src:a,elementId:n,reason:`load`}))},[e])},CN=B(({element:e,store:t})=>{let n=yh(),[r,i]=k.useState(!1),a=k.useRef(null),o=k.useRef(null),c=e.isSelected,[u,d]=(e=>{let[t,n]=k.useReducer(e=>e+1,0),r=k.useRef(`loading`),i=k.useRef(e.src),a=k.useRef(e.src);a.current!==e.src&&(a.current=e.src,r.current=`loading`);let o=k.useMemo(()=>QC(e.src)||e.type===`svg`,[e.src,e.type]);return k.useEffect(()=>{if(!o||!e.src)return;let t=!1;return(async()=>{r.current=`loading`,n();let a=aw(await JC(e.src)),o;o=e.colorsReplace?uw(a,e.colorsReplace||new Map):XC(a),t||(i.current=o,r.current=`loaded`,n())})(),()=>{t=!0}},[e.src,JSON.stringify(e.colorsReplace)]),o?[i.current,r.current]:[e.src,`loaded`]})(e),[f,p]=xN(u,`anonymous`);SN(e.type!==`svg`||d===`loaded`?p:`loading`,e.src,e.id);let m=e.page?._exportingOrRendering?1:Math.max(1,t.scale),h=t._elementsPixelRatio*m,g=(({image:e,status:t,type:n})=>{let r=k.useRef(void 0);return k.useEffect(()=>{r.current=e||r.current},[e]),t!==`failed`||t!==`failed`&&n===`svg`?r.current:void 0})({image:f,status:p,type:e.type}),[_=vN]=oN(e,((e,t)=>{let n=uN(e.maskSrc||``),[r,i]=xN(n,`anonymous`);return SN(n?i:`loaded`,n||``,e.id),k.useMemo(()=>{if(!r||!t||!t.width||!t.height)return t;let{width:n,height:i}=hN(t,{width:e.a.width,height:e.a.height,stretchEnabled:e.stretchEnabled}),a=lN();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=k.useMemo(()=>{var r,i;let{flipX:a,flipY:o}=e,s=e.type===`svg`||QC(e.src),c=navigator.userAgent.toLowerCase().indexOf(`firefox`)>-1,u=(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||c)&&s||e.maskSrc;if(!a&&!o&&!u)return t;if(!t||!t.width||!t.height)return null;let d=lN(),f=1;e.type===`svg`&&(f=Math.max(e.a.width/t.width*n,e.a.height/t.height*n)),l(d,Math.max(t.width*f,1),Math.max(t.height*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.maskSrc,e.flipX,e.flipY,t,e.a.width,e.a.height,n]);return k.useEffect(()=>()=>{r&&r.nodeName===`CANVAS`&&s.Util.releaseCanvas(r)},[r]),r})(e,f||g,h))||vN),{cropX:v,cropY:y,cropWidth:b,cropHeight:x}=e.a;p!==`loaded`&&(v=y=0,b=x=1);let S=_w({stretchEnabled:e.stretchEnabled,cropX:v,cropY:y,cropWidth:b,cropHeight:x,width:e.a.width,height:e.a.height},_),C=S.width,w=S.height,T=e.stretchEnabled,E=e.cornerRadius??0,D=e.page?._exportingOrRendering?1:Math.min(2,t.scale),O=t._elementsPixelRatio*D,ee=((e,t,n,r)=>{let[i,a]=xN(uN(e.clipSrc||``),`anonymous`);SN(e.clipSrc?a:`loaded`,e.clipSrc,e.id);let o=k.useMemo(()=>{if(t&&i)return lN()},[t,i]);return k.useLayoutEffect(()=>{var r;if(!i||!t||!t.width||!t.height||!i||!i.width||!i.height||!o)return;let a=lN(),c=Math.max(e.a.width/i.width*n,e.a.height/i.height*n);a.width=Math.max(i.width*c,1),a.height=Math.max(i.height*c,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 l=o.getContext(`2d`);l&&(l.save(),l.drawImage(a,0,0,t.width,t.height),s.Util.releaseCanvas(a),l.globalCompositeOperation=`source-in`,l.drawImage(t,0,0,o.width,o.height),l.restore())},[o,t,i,e.a.width,e.a.height,n,...r]),e.clipSrc&&i?o:t})(e,_N(e,_,S,O,E,r||e._cropModeEnabled||e.type===`svg`,!0,gw({borderSize:e.borderSize,borderColor:e.borderColor,width:e.a.width,height:e.a.height})),O,[S,E,O]),A=Math.max(e.a.width/C,e.a.height/w);k.useEffect(()=>{if(!e._cropModeEnabled)return;let t=a.current?.getStage();function n(t){e._cropModeEnabled&&t.target!==o.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 M=k.useRef(null),te=k.useRef(null),N=k.useRef(null);k.useLayoutEffect(()=>{e._cropModeEnabled&&(te.current.nodes([M.current]),N.current.nodes([o.current]))},[e._cropModeEnabled]);var P=k.useRef(null),F=k.useRef(0),ne=k.useRef(!1);let re=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,C/n),a=Math.min(1,w/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*_.width,y:-l*_.height,scaleX:1,scaleY:1}),e.set({cropX:s,cropY:l,cropWidth:i,cropHeight:a})},ie=()=>{e.type!==`svg`&&e.contentEditable&&(e.stretchEnabled||setTimeout(()=>{Zh(e)&&e.toggleCropMode(!0)}))},I=e.type===`svg`&&g,[ae]=sN(p===`loading`&&!I,100,!1,!1),oe=p===`failed`,se=!ae&&!oe,ce=k.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),le=k.useRef(!1),L=se?e.a.opacity:0;ib(a,L);let ue=e.selectable||t.role===iM.ADMIN,de=UM(),fe=mM(e,e.borderColor,`stroke`);return(0,j.jsxs)(j.Fragment,{children:[ae&&(0,j.jsx)(yN,{element:e}),oe&&(0,j.jsx)(bN,{element:e}),(0,j.jsx)(Wm,{ref:a,name:`element`,id:e.id,image:ee,x:e.a.x,y:e.a.y,width:e.a.width||1,height:e.a.height||1,rotation:e.a.rotation,opacity:L,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:S,listening:ue,draggable:de?e.draggable&&c:e.draggable,preventDefault:!de||c,hideInExport:!e.showInExport,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDblClick:ie,onDblTap:ie,onTransformStart:t=>{i(!0),le.current=DM(EM(t.target)),ce.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-C/_.width,o=Math.min(a,Math.max(0,e.cropX)),s=1-w/_.height,c=Math.min(s,Math.max(0,e.cropY)),l=le.current,u=!l&&r<1&&ce.current.cropHeight>w/_.height,d=l?e.cropWidth:e.cropWidth*r;u&&(d=e.cropWidth);let f=!l&&i<1&&ce.current.cropWidth>C/_.width,p=l?e.cropHeight:e.cropHeight*i;f&&(p=e.cropHeight),T&&(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({},AM(e,m)),{borderSize:e.borderSize*m})))},onTransformEnd:t=>{let n=t.currentTarget;e.set(Object.assign(Object.assign({width:n.width(),height:n.height(),x:n.x(),y:n.y(),rotation:t.target.rotation(),cropWidth:C/_.width,cropHeight:w/_.height},jM(e)),{borderSize:TM(e.borderSize)})),i(!1)}}),(0,j.jsx)(Vm,Object.assign({x:e.x,y:e.y,width:Math.max(e.a.width-e.borderSize,0),height:Math.max(e.a.height-e.borderSize,0),opacity:L,offsetX:-e.borderSize/2,offsetY:-e.borderSize/2},fe,{strokeWidth:e.borderSize,listening:!1,visible:!!e.borderSize,rotation:e.rotation,cornerRadius:Math.max(0,E-e.borderSize),hideInExport:!e.showInExport})),e._cropModeEnabled&&(0,j.jsxs)(dM,{selector:`.page-abs-container`,enabled:!0,children:[(0,j.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,j.jsx)(`Image`,{listening:!1,image:ee,x:e.x,y:e.y,width:e.a.width,height:e.a.height,rotation:e.rotation,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur}),(0,j.jsxs)(`Group`,{x:e.x,y:e.y,rotation:e.rotation,scaleX:A,scaleY:A,children:[(0,j.jsx)(`Image`,{image:_,ref:o,opacity:.4,draggable:!0,x:-e.cropX*_.width,y:-e.cropY*_.height,onDragMove:re,onTransform:re,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()&&ne.current&&(i.startDrag(),ne.current=!1),n&&r){s.hitOnDragEnabled=!0,i.isDragging()&&(ne.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(!P.current){P.current=dN(a,o);return}var c=dN(a,o),l=function(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}(a,o);F.current||=l;let h=i.position();var u={x:c.x-h.x,y:c.y-h.y},d=l/F.current;i.scaleX(d),i.scaleY(d);let g=t.point(c),_=t.point(P.current);var f=g.x-_.x,p=g.y-_.y,m={x:Math.min(0,c.x-u.x*d+f),y:Math.min(0,c.y-u.y*d+p)};i.position(m),F.current=l,P.current=c,re(e)}},onTouchEnd:e=>{F.current=0,P.current=null,s.hitOnDragEnabled=!1}}),(0,j.jsx)(`Transformer`,Object.assign({ref:N},mN,n.outerImageCropTransformerStyle)),(0,j.jsx)(`Rect`,{width:C,height:w,ref:M,listening:!1,onTransform:t=>{if(e.cropX<Math.abs(t.target.x()/_.width)&&t.target.x()<0&&e.cropX>0){let n=(e.cropWidth+e.cropX)*_.width;t.target.scaleX(1),t.target.width(n)}if(e.cropY<Math.abs(t.target.y()/_.height)&&t.target.y()<0&&e.cropY>0){let n=(e.cropHeight+e.cropY)*_.height;t.target.scaleY(1),t.target.height(n)}t.target.x()<-e.cropX*_.width-1e-9&&(t.target.x(-e.cropX*_.width),t.target.scaleX(1)),t.target.y()<-e.cropY*_.height-1e-9&&(t.target.y(-e.cropY*_.height),t.target.scaleY(1));let n=Math.min(1,Math.max(0,e.cropX+t.target.x()/_.width)),r=Math.min(1,Math.max(0,t.target.y()/_.height+e.cropY)),i=t.target.width()*t.target.scaleX(),a=t.target.height()*t.target.scaleY(),o=Math.min(1-n,i/_.width),s=Math.min(1-r,a/_.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*A,_.width*(1-n)*A),height:Math.min(a*A,_.height*(1-r)*A)})}}),(0,j.jsx)(`Transformer`,Object.assign({ref:te},pN,n.innerImageCropTransformerStyle,{visible:e.resizable}))]})]})]})});function wN(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=ax(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(`
|
|
386
|
+
`);return c?`<style>${c}</style>`:``}var TN=new Map,EN=new Map,DN=/@font-face\s*\{[^}]*\}/g,ON=/url\(\s*(['"]?)(.*?)\1\s*\)/g,kN=/unicode-range:\s*([^;}]+)/i;function AN(e,t){if(!t)return!0;let n=e.match(kN);if(!n)return!0;let r=Ax(n[1]);return r.length===0||Mx(r,t)}function jN(e,t){let n=new Set;for(let r of e.matchAll(DN))if(AN(r[0],t))for(let e of r[0].matchAll(ON)){let t=e[2];t&&!t.startsWith(`data:`)&&n.add(t)}return Array.from(n)}function MN(e){let t=TN.get(e);return t||(t=async function(e){try{let t=await kx(e,{validate:wx});return`data:${Cx(t)};base64,${pC(t)}`}catch{return e}}(e),TN.set(e,t)),t}function NN(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=EN.get(n);if(r)return r;let i=async function(e,t){let n=jN(e,t);if(n.length===0&&!t)return e;let r=await Promise.all(n.map(async e=>[e,await MN(e)])),i=new Map(r);return e.replace(DN,e=>AN(e,t)?e.replace(ON,(e,t,n)=>{if(!n||n.startsWith(`data:`))return e;let r=i.get(n);return r?`url("${r}")`:e}):``)}(e,t);return EN.set(n,i),i}var PN=/<style[^>]*>([\s\S]*?)<\/style>/gi;function FN(e){let t=[],n=e.replace(PN,(e,n)=>(t.push(n),``));return{css:t.join(`
|
|
387
|
+
`),html:n}}var IN;function LN(e,t){`close`in t.image&&typeof t.image.close==`function`&&t.image.close()}async function RN(e){let t=`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(e),n=bb.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 zN(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 IN?IN.maxEntries!==e&&IN.resize(e):IN=new hM(e),IN}(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 RN(await GN(e));return t.setWithEviction(n,a,LN),a.image}return(await RN(await GN(e))).image}var BN=RegExp(`[\0-\b\v\f-]`,`g`);function VN(e){let t=xb(e),n=bb.createXMLSerializer(),r=``;for(let e of Array.from(t.body.childNodes))r+=n.serializeToString(e);return r.replace(BN,``)}function HN({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 UN;async function WN({html:e,css:t=``,width:n,height:r,pixelRatio:i=1}){let a=FN(e),o=await NN([t,a.css].filter(Boolean).join(`
|
|
388
|
+
`),function(e){let t=xb(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 HN({xhtml:VN(a.html),css:o,width:n,height:r,pixelRatio:i})}async function GN(e){var t,n;if(e.cache){let r=(n=typeof e.cache==`object`&&(t=e.cache.maxEntries)!=null?t:50,UN?UN.maxEntries!==n&&UN.resize(n):UN=new hM(n),UN),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 WN(e);return r.set(i,o),o}return WN(e)}var KN={},qN=e=>{if(KN[e])return KN[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&&Nb(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 KN[e]=t,t},JN=new Map;async function YN(e,t){let n=`${e}|${t}`;if(JN.has(n))return JN.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 JN.set(n,``),``;let t=await e.text();return JN.set(n,t),t}catch{return JN.set(n,``),``}}async function XN({html:e,width:t,height:n,fontFamily:r,fontFamilies:i,padding:a,font:o,resolveFont:s,pixelRatio:c}){e=yM(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?Wx(i):qN(e)).forEach(t=>{a+=`\n @font-face {\n font-family: ${Cb(e)};\n src: ${t.src};\n font-style: ${t.fontStyle||`normal`};\n font-weight: ${t.fontWeight||`normal`};\n }\n `});else{let t=_x();a+=await YN(e,t)}}return a}(i?.length?[...new Set([r,...i])]:[r],r,o,s),u=``;return l&&(u=wN(l,e)),zN({html:`<div style="padding: ${a}px;" dir="auto">${e+=u+dO}</div>`,width:t+2*a,height:n+2*a,cache:{maxEntries:100},pixelRatio:c})}function ZN(e,t,n){return $k(e.toJSON(),{getHtmlOptions:Object.assign({textOverflow:Oy.textOverflow},t),measureHeight:n,textSplitAllowed:Oy.textSplitAllowed})}var QN=typeof global==`object`&&global&&global.Object===Object&&global,$N=typeof self==`object`&&self&&self.Object===Object&&self,eP=QN||$N||Function(`return this`)(),tP=eP.Symbol,nP=Object.prototype,rP=nP.hasOwnProperty,iP=nP.toString,aP=tP?tP.toStringTag:void 0;function oP(e){var t=rP.call(e,aP),n=e[aP];try{e[aP]=void 0;var r=!0}catch{}var i=iP.call(e);return r&&(t?e[aP]=n:delete e[aP]),i}var sP=Object.prototype.toString;function cP(e){return sP.call(e)}var lP=`[object Null]`,uP=`[object Undefined]`,dP=tP?tP.toStringTag:void 0;function fP(e){return e==null?e===void 0?uP:lP:dP&&dP in Object(e)?oP(e):cP(e)}function pP(e){return typeof e==`object`&&!!e}var mP=Array.isArray;function hP(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}function gP(e){return e}var _P=`[object AsyncFunction]`,vP=`[object Function]`,yP=`[object GeneratorFunction]`,bP=`[object Proxy]`;function xP(e){if(!hP(e))return!1;var t=fP(e);return t==vP||t==yP||t==_P||t==bP}var SP=eP[`__core-js_shared__`],CP=function(){var e=/[^.]+$/.exec(SP&&SP.keys&&SP.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function wP(e){return!!CP&&CP in e}var TP=Function.prototype.toString;function EP(e){if(e!=null){try{return TP.call(e)}catch{}try{return e+``}catch{}}return``}var DP=/[\\^$.*+?()[\]{}|]/g,OP=/^\[object .+?Constructor\]$/,kP=Function.prototype,AP=Object.prototype,jP=kP.toString,MP=AP.hasOwnProperty,NP=RegExp(`^`+jP.call(MP).replace(DP,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function PP(e){return!hP(e)||wP(e)?!1:(xP(e)?NP:OP).test(EP(e))}function FP(e,t){return e?.[t]}function IP(e,t){var n=FP(e,t);return PP(n)?n:void 0}var LP=IP(eP,`WeakMap`),RP=Object.create,zP=function(){function e(){}return function(t){if(!hP(t))return{};if(RP)return RP(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function BP(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 VP(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}var HP=800,UP=16,WP=Date.now;function GP(e){var t=0,n=0;return function(){var r=WP(),i=UP-(r-n);if(n=r,i>0){if(++t>=HP)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function KP(e){return function(){return e}}var qP=function(){try{var e=IP(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),JP=GP(qP?function(e,t){return qP(e,`toString`,{configurable:!0,enumerable:!1,value:KP(t),writable:!0})}:gP);function YP(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var XP=9007199254740991,ZP=/^(?:0|[1-9]\d*)$/;function QP(e,t){var n=typeof e;return t??=XP,!!t&&(n==`number`||n!=`symbol`&&ZP.test(e))&&e>-1&&e%1==0&&e<t}function $P(e,t,n){t==`__proto__`&&qP?qP(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function eF(e,t){return e===t||e!==e&&t!==t}var tF=Object.prototype.hasOwnProperty;function nF(e,t,n){var r=e[t];(!(tF.call(e,t)&&eF(r,n))||n===void 0&&!(t in e))&&$P(e,t,n)}function rF(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?$P(n,s,c):nF(n,s,c)}return n}var iF=Math.max;function aF(e,t,n){return t=iF(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=iF(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),BP(e,this,s)}}function oF(e,t){return JP(aF(e,t,gP),e+``)}var sF=9007199254740991;function cF(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=sF}function lF(e){return e!=null&&cF(e.length)&&!xP(e)}function uF(e,t,n){if(!hP(n))return!1;var r=typeof t;return(r==`number`?lF(n)&&QP(t,n.length):r==`string`&&t in n)?eF(n[t],e):!1}function dF(e){return oF(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&&uF(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 fF=Object.prototype;function pF(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||fF)}function mF(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var hF=`[object Arguments]`;function gF(e){return pP(e)&&fP(e)==hF}var _F=Object.prototype,vF=_F.hasOwnProperty,yF=_F.propertyIsEnumerable,bF=gF(function(){return arguments}())?gF:function(e){return pP(e)&&vF.call(e,`callee`)&&!yF.call(e,`callee`)};function xF(){return!1}var SF=typeof exports==`object`&&exports&&!exports.nodeType&&exports,CF=SF&&typeof module==`object`&&module&&!module.nodeType&&module,wF=CF&&CF.exports===SF?eP.Buffer:void 0,TF=(wF?wF.isBuffer:void 0)||xF,EF=`[object Arguments]`,DF=`[object Array]`,OF=`[object Boolean]`,kF=`[object Date]`,AF=`[object Error]`,jF=`[object Function]`,MF=`[object Map]`,NF=`[object Number]`,PF=`[object Object]`,FF=`[object RegExp]`,IF=`[object Set]`,LF=`[object String]`,RF=`[object WeakMap]`,zF=`[object ArrayBuffer]`,BF=`[object DataView]`,VF=`[object Float32Array]`,HF=`[object Float64Array]`,UF=`[object Int8Array]`,WF=`[object Int16Array]`,GF=`[object Int32Array]`,KF=`[object Uint8Array]`,qF=`[object Uint8ClampedArray]`,JF=`[object Uint16Array]`,YF=`[object Uint32Array]`,XF={};XF[VF]=XF[HF]=XF[UF]=XF[WF]=XF[GF]=XF[KF]=XF[qF]=XF[JF]=XF[YF]=!0,XF[EF]=XF[DF]=XF[zF]=XF[OF]=XF[BF]=XF[kF]=XF[AF]=XF[jF]=XF[MF]=XF[NF]=XF[PF]=XF[FF]=XF[IF]=XF[LF]=XF[RF]=!1;function ZF(e){return pP(e)&&cF(e.length)&&!!XF[fP(e)]}function QF(e){return function(t){return e(t)}}var $F=typeof exports==`object`&&exports&&!exports.nodeType&&exports,eI=$F&&typeof module==`object`&&module&&!module.nodeType&&module,tI=eI&&eI.exports===$F&&QN.process,nI=function(){try{return eI&&eI.require&&eI.require(`util`).types||tI&&tI.binding&&tI.binding(`util`)}catch{}}(),rI=nI&&nI.isTypedArray,iI=rI?QF(rI):ZF,aI=Object.prototype.hasOwnProperty;function oI(e,t){var n=mP(e),r=!n&&bF(e),i=!n&&!r&&TF(e),a=!n&&!r&&!i&&iI(e),o=n||r||i||a,s=o?mF(e.length,String):[],c=s.length;for(var l in e)(t||aI.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||QP(l,c)))&&s.push(l);return s}function sI(e,t){return function(n){return e(t(n))}}var cI=sI(Object.keys,Object),lI=Object.prototype.hasOwnProperty;function uI(e){if(!pF(e))return cI(e);var t=[];for(var n in Object(e))lI.call(e,n)&&n!=`constructor`&&t.push(n);return t}function dI(e){return lF(e)?oI(e):uI(e)}function fI(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var pI=Object.prototype.hasOwnProperty;function mI(e){if(!hP(e))return fI(e);var t=pF(e),n=[];for(var r in e)r==`constructor`&&(t||!pI.call(e,r))||n.push(r);return n}function hI(e){return lF(e)?oI(e,!0):mI(e)}var gI=IP(Object,`create`);function _I(){this.__data__=gI?gI(null):{},this.size=0}function vI(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var yI=`__lodash_hash_undefined__`,bI=Object.prototype.hasOwnProperty;function xI(e){var t=this.__data__;if(gI){var n=t[e];return n===yI?void 0:n}return bI.call(t,e)?t[e]:void 0}var SI=Object.prototype.hasOwnProperty;function CI(e){var t=this.__data__;return gI?t[e]!==void 0:SI.call(t,e)}var wI=`__lodash_hash_undefined__`;function TI(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=gI&&t===void 0?wI:t,this}function EI(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])}}EI.prototype.clear=_I,EI.prototype.delete=vI,EI.prototype.get=xI,EI.prototype.has=CI,EI.prototype.set=TI;function DI(){this.__data__=[],this.size=0}function OI(e,t){for(var n=e.length;n--;)if(eF(e[n][0],t))return n;return-1}var kI=Array.prototype.splice;function AI(e){var t=this.__data__,n=OI(t,e);return n<0?!1:(n==t.length-1?t.pop():kI.call(t,n,1),--this.size,!0)}function jI(e){var t=this.__data__,n=OI(t,e);return n<0?void 0:t[n][1]}function MI(e){return OI(this.__data__,e)>-1}function NI(e,t){var n=this.__data__,r=OI(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function PI(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])}}PI.prototype.clear=DI,PI.prototype.delete=AI,PI.prototype.get=jI,PI.prototype.has=MI,PI.prototype.set=NI;var FI=IP(eP,`Map`);function II(){this.size=0,this.__data__={hash:new EI,map:new(FI||PI),string:new EI}}function LI(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function RI(e,t){var n=e.__data__;return LI(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function zI(e){var t=RI(this,e).delete(e);return this.size-=+!!t,t}function BI(e){return RI(this,e).get(e)}function VI(e){return RI(this,e).has(e)}function HI(e,t){var n=RI(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function UI(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])}}UI.prototype.clear=II,UI.prototype.delete=zI,UI.prototype.get=BI,UI.prototype.has=VI,UI.prototype.set=HI;function WI(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var GI=sI(Object.getPrototypeOf,Object),KI=`[object Object]`,qI=Function.prototype,JI=Object.prototype,YI=qI.toString,XI=JI.hasOwnProperty,ZI=YI.call(Object);function QI(e){if(!pP(e)||fP(e)!=KI)return!1;var t=GI(e);if(t===null)return!0;var n=XI.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&YI.call(n)==ZI}function $I(){this.__data__=new PI,this.size=0}function eL(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function tL(e){return this.__data__.get(e)}function nL(e){return this.__data__.has(e)}var rL=200;function iL(e,t){var n=this.__data__;if(n instanceof PI){var r=n.__data__;if(!FI||r.length<rL-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new UI(r)}return n.set(e,t),this.size=n.size,this}function aL(e){var t=this.__data__=new PI(e);this.size=t.size}aL.prototype.clear=$I,aL.prototype.delete=eL,aL.prototype.get=tL,aL.prototype.has=nL,aL.prototype.set=iL;function oL(e,t){return e&&rF(t,dI(t),e)}function sL(e,t){return e&&rF(t,hI(t),e)}var cL=typeof exports==`object`&&exports&&!exports.nodeType&&exports,lL=cL&&typeof module==`object`&&module&&!module.nodeType&&module,uL=lL&&lL.exports===cL?eP.Buffer:void 0,dL=uL?uL.allocUnsafe:void 0;function fL(e,t){if(t)return e.slice();var n=e.length,r=dL?dL(n):new e.constructor(n);return e.copy(r),r}function pL(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 mL(){return[]}var hL=Object.prototype.propertyIsEnumerable,gL=Object.getOwnPropertySymbols,_L=gL?function(e){return e==null?[]:(e=Object(e),pL(gL(e),function(t){return hL.call(e,t)}))}:mL;function vL(e,t){return rF(e,_L(e),t)}var yL=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)WI(t,_L(e)),e=GI(e);return t}:mL;function bL(e,t){return rF(e,yL(e),t)}function xL(e,t,n){var r=t(e);return mP(e)?r:WI(r,n(e))}function SL(e){return xL(e,dI,_L)}function CL(e){return xL(e,hI,yL)}var wL=IP(eP,`DataView`),TL=IP(eP,`Promise`),EL=IP(eP,`Set`),DL=`[object Map]`,OL=`[object Object]`,kL=`[object Promise]`,AL=`[object Set]`,jL=`[object WeakMap]`,ML=`[object DataView]`,NL=EP(wL),PL=EP(FI),FL=EP(TL),IL=EP(EL),LL=EP(LP),RL=fP;(wL&&RL(new wL(new ArrayBuffer(1)))!=ML||FI&&RL(new FI)!=DL||TL&&RL(TL.resolve())!=kL||EL&&RL(new EL)!=AL||LP&&RL(new LP)!=jL)&&(RL=function(e){var t=fP(e),n=t==OL?e.constructor:void 0,r=n?EP(n):``;if(r)switch(r){case NL:return ML;case PL:return DL;case FL:return kL;case IL:return AL;case LL:return jL}return t});var zL=RL,BL=Object.prototype.hasOwnProperty;function VL(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&BL.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}var HL=eP.Uint8Array;function UL(e){var t=new e.constructor(e.byteLength);return new HL(t).set(new HL(e)),t}function WL(e,t){var n=t?UL(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var GL=/\w*$/;function KL(e){var t=new e.constructor(e.source,GL.exec(e));return t.lastIndex=e.lastIndex,t}var qL=tP?tP.prototype:void 0,JL=qL?qL.valueOf:void 0;function YL(e){return JL?Object(JL.call(e)):{}}function XL(e,t){var n=t?UL(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var ZL=`[object Boolean]`,QL=`[object Date]`,$L=`[object Map]`,eR=`[object Number]`,tR=`[object RegExp]`,nR=`[object Set]`,rR=`[object String]`,iR=`[object Symbol]`,aR=`[object ArrayBuffer]`,oR=`[object DataView]`,sR=`[object Float32Array]`,cR=`[object Float64Array]`,lR=`[object Int8Array]`,uR=`[object Int16Array]`,dR=`[object Int32Array]`,fR=`[object Uint8Array]`,pR=`[object Uint8ClampedArray]`,mR=`[object Uint16Array]`,hR=`[object Uint32Array]`;function gR(e,t,n){var r=e.constructor;switch(t){case aR:return UL(e);case ZL:case QL:return new r(+e);case oR:return WL(e,n);case sR:case cR:case lR:case uR:case dR:case fR:case pR:case mR:case hR:return XL(e,n);case $L:return new r;case eR:case rR:return new r(e);case tR:return KL(e);case nR:return new r;case iR:return YL(e)}}function _R(e){return typeof e.constructor==`function`&&!pF(e)?zP(GI(e)):{}}var vR=`[object Map]`;function yR(e){return pP(e)&&zL(e)==vR}var bR=nI&&nI.isMap,xR=bR?QF(bR):yR,SR=`[object Set]`;function CR(e){return pP(e)&&zL(e)==SR}var wR=nI&&nI.isSet,TR=wR?QF(wR):CR,ER=1,DR=2,OR=4,kR=`[object Arguments]`,AR=`[object Array]`,jR=`[object Boolean]`,MR=`[object Date]`,NR=`[object Error]`,PR=`[object Function]`,FR=`[object GeneratorFunction]`,IR=`[object Map]`,LR=`[object Number]`,RR=`[object Object]`,zR=`[object RegExp]`,BR=`[object Set]`,VR=`[object String]`,HR=`[object Symbol]`,UR=`[object WeakMap]`,WR=`[object ArrayBuffer]`,GR=`[object DataView]`,KR=`[object Float32Array]`,qR=`[object Float64Array]`,JR=`[object Int8Array]`,YR=`[object Int16Array]`,XR=`[object Int32Array]`,ZR=`[object Uint8Array]`,QR=`[object Uint8ClampedArray]`,$R=`[object Uint16Array]`,ez=`[object Uint32Array]`,tz={};tz[kR]=tz[AR]=tz[WR]=tz[GR]=tz[jR]=tz[MR]=tz[KR]=tz[qR]=tz[JR]=tz[YR]=tz[XR]=tz[IR]=tz[LR]=tz[RR]=tz[zR]=tz[BR]=tz[VR]=tz[HR]=tz[ZR]=tz[QR]=tz[$R]=tz[ez]=!0,tz[NR]=tz[PR]=tz[UR]=!1;function nz(e,t,n,r,i,a){var o,s=t&ER,c=t&DR,l=t&OR;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!hP(e))return e;var u=mP(e);if(u){if(o=VL(e),!s)return VP(e,o)}else{var d=zL(e),f=d==PR||d==FR;if(TF(e))return fL(e,s);if(d==RR||d==kR||f&&!i){if(o=c||f?{}:_R(e),!s)return c?bL(e,sL(o,e)):vL(e,oL(o,e))}else{if(!tz[d])return i?e:{};o=gR(e,d,s)}}a||=new aL;var p=a.get(e);if(p)return p;a.set(e,o),TR(e)?e.forEach(function(r){o.add(nz(r,t,n,r,e,a))}):xR(e)&&e.forEach(function(r,i){o.set(i,nz(r,t,n,i,e,a))});var m=u?void 0:(l?c?CL:SL:c?hI:dI)(e);return YP(m||e,function(r,i){m&&(i=r,r=e[i]),nF(o,i,nz(r,t,n,i,e,a))}),o}var rz=1,iz=4;function az(e){return nz(e,rz|iz)}var oz=`__lodash_hash_undefined__`;function sz(e){return this.__data__.set(e,oz),this}function cz(e){return this.__data__.has(e)}function lz(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new UI;++t<n;)this.add(e[t])}lz.prototype.add=lz.prototype.push=sz,lz.prototype.has=cz;function uz(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 dz(e,t){return e.has(t)}var fz=1,pz=2;function mz(e,t,n,r,i,a){var o=n&fz,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&pz?new lz: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(!uz(t,function(e,t){if(!dz(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 hz(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 _z=1,vz=2,yz=`[object Boolean]`,bz=`[object Date]`,xz=`[object Error]`,Sz=`[object Map]`,Cz=`[object Number]`,wz=`[object RegExp]`,Tz=`[object Set]`,Ez=`[object String]`,Dz=`[object Symbol]`,Oz=`[object ArrayBuffer]`,kz=`[object DataView]`,Az=tP?tP.prototype:void 0,jz=Az?Az.valueOf:void 0;function Mz(e,t,n,r,i,a,o){switch(n){case kz:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Oz:return!(e.byteLength!=t.byteLength||!a(new HL(e),new HL(t)));case yz:case bz:case Cz:return eF(+e,+t);case xz:return e.name==t.name&&e.message==t.message;case wz:case Ez:return e==t+``;case Sz:var s=hz;case Tz:var c=r&_z;if(s||=gz,e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=vz,o.set(e,t);var u=mz(s(e),s(t),r,i,a,o);return o.delete(e),u;case Dz:if(jz)return jz.call(e)==jz.call(t)}return!1}var Nz=1,Pz=Object.prototype.hasOwnProperty;function Fz(e,t,n,r,i,a){var o=n&Nz,s=SL(e),c=s.length;if(c!=SL(t).length&&!o)return!1;for(var l=c;l--;){var u=s[l];if(!(o?u in t:Pz.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 Iz=1,Lz=`[object Arguments]`,Rz=`[object Array]`,zz=`[object Object]`,Bz=Object.prototype.hasOwnProperty;function Vz(e,t,n,r,i,a){var o=mP(e),s=mP(t),c=o?Rz:zL(e),l=s?Rz:zL(t);c=c==Lz?zz:c,l=l==Lz?zz:l;var u=c==zz,d=l==zz,f=c==l;if(f&&TF(e)){if(!TF(t))return!1;o=!0,u=!1}if(f&&!u)return a||=new aL,o||iI(e)?mz(e,t,n,r,i,a):Mz(e,t,c,n,r,i,a);if(!(n&Iz)){var p=u&&Bz.call(e,`__wrapped__`),m=d&&Bz.call(t,`__wrapped__`);if(p||m){var h=p?e.value():e,g=m?t.value():t;return a||=new aL,i(h,g,n,r,a)}}return f?(a||=new aL,Fz(e,t,n,r,i,a)):!1}function Hz(e,t,n,r,i){return e===t?!0:e==null||t==null||!pP(e)&&!pP(t)?e!==e&&t!==t:Vz(e,t,n,r,Hz,i)}function Uz(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 Wz=Uz();function Gz(e,t,n){(n!==void 0&&!eF(e[t],n)||n===void 0&&!(t in e))&&$P(e,t,n)}function Kz(e){return pP(e)&&lF(e)}function qz(e,t){if((t!==`constructor`||typeof e[t]!=`function`)&&t!=`__proto__`)return e[t]}function Jz(e){return rF(e,hI(e))}function Yz(e,t,n,r,i,a,o){var s=qz(e,n),c=qz(t,n),l=o.get(c);if(l){Gz(e,n,l);return}var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=mP(c),p=!f&&TF(c),m=!f&&!p&&iI(c);u=c,f||p||m?mP(s)?u=s:Kz(s)?u=VP(s):p?(d=!1,u=fL(c,!0)):m?(d=!1,u=XL(c,!0)):u=[]:QI(c)||bF(c)?(u=s,bF(s)?u=Jz(s):(!hP(s)||xP(s))&&(u=_R(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),Gz(e,n,u)}function Xz(e,t,n,r,i){e!==t&&Wz(t,function(a,o){if(i||=new aL,hP(a))Yz(e,t,o,n,Xz,r,i);else{var s=r?r(qz(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),Gz(e,o,s)}},hI)}function Zz(e,t){return Hz(e,t)}var Qz=dF(function(e,t,n){Xz(e,t,n)}),$z=e({Attributor:()=>eB,AttributorStore:()=>cB,BlockBlot:()=>xB,ClassAttributor:()=>aB,ContainerBlot:()=>CB,EmbedBlot:()=>wB,InlineBlot:()=>yB,LeafBlot:()=>fB,ParentBlot:()=>gB,Registry:()=>rB,Scope:()=>X,ScrollBlot:()=>OB,StyleAttributor:()=>sB,TextBlot:()=>AB}),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||{}),eB=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:``}},tB=class extends Error{constructor(e){e=`[Parchment] `+e,super(e),this.message=e,this.name=this.constructor.name}},nB=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 tB(`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 tB(`Invalid definition`);if(t&&e.blotName===`abstract`)throw new tB(`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})}};nB.blots=new WeakMap;var rB=nB;function iB(e,t){return(e.getAttribute(`class`)||``).split(/\s+/).filter(e=>e.indexOf(`${t}-`)===0)}var aB=class extends eB{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){iB(e,this.keyName).forEach(t=>{e.classList.remove(t)}),e.classList.length===0&&e.removeAttribute(`class`)}value(e){let t=(iB(e,this.keyName)[0]||``).slice(this.keyName.length+1);return this.canAdd(e,t)?t:``}};function oB(e){let t=e.split(`-`),n=t.slice(1).map(e=>e[0].toUpperCase()+e.slice(1)).join(``);return t[0]+n}var sB=class extends eB{static keys(e){return(e.getAttribute(`style`)||``).split(`;`).map(e=>e.split(`:`)[0].trim())}add(e,t){return this.canAdd(e,t)?(e.style[oB(this.keyName)]=t,!0):!1}remove(e){e.style[oB(this.keyName)]=``,e.getAttribute(`style`)||e.removeAttribute(`style`)}value(e){let t=e.style[oB(this.keyName)];return this.canAdd(e,t)?t:``}},cB=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=rB.find(this.domNode);if(e==null)return;let t=eB.keys(this.domNode),n=aB.keys(this.domNode),r=sB.keys(this.domNode);t.concat(n).concat(r).forEach(t=>{let n=e.scroll.query(t,X.ATTRIBUTE);n instanceof eB&&(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),{})}},lB=class{constructor(e,t){this.scroll=e,this.domNode=t,rB.blots.set(t,this),this.prev=null,this.next=null}static create(e){if(this.tagName==null)throw new tB(`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),rB.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 tB(`Cannot wrap ${e}`);return n.appendChild(this),n}};lB.blotName=`abstract`;var uB=lB,dB=class extends uB{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}}};dB.scope=X.INLINE_BLOT;var fB=dB,pB=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 mB(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 hB=class e extends uB{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 pB,Array.from(this.domNode.childNodes).filter(e=>e!==this.uiNode).reverse().forEach(e=>{try{let t=mB(e,this.scroll);this.insertBefore(t,this.children.head||void 0)}catch(e){if(e instanceof tB)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=mB(e,this.scroll);(n.next!==t||n.next==null)&&(n.parent!=null&&n.parent.removeChild(this),this.insertBefore(n,t||void 0))}),this.enforceAllowedChildren()}};hB.uiClass=``;var gB=hB;function _B(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 vB=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 cB(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 eB?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&&_B(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}};vB.allowedChildren=[vB,fB],vB.blotName=`inline`,vB.scope=X.INLINE_BLOT,vB.tagName=`SPAN`;var yB=vB,bB=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 cB(this.domNode)}format(t,n){let r=this.scroll.query(t,X.BLOCK);r!=null&&(r instanceof eB?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()}};bB.blotName=`block`,bB.scope=X.BLOCK_BLOT,bB.tagName=`P`,bB.allowedChildren=[yB,bB,fB];var xB=bB,SB=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())}};SB.blotName=`container`,SB.scope=X.BLOCK_BLOT;var CB=SB,wB=class extends fB{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)}},TB={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},EB=100,DB=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,TB),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>=EB)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)}};DB.blotName=`scroll`,DB.defaultChild=xB,DB.allowedChildren=[xB,CB],DB.scope=X.BLOCK_BLOT,DB.tagName=`DIV`;var OB=DB,kB=class e extends fB{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}};kB.blotName=`text`,kB.scope=X.INLINE_BLOT;var AB=kB,jB=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})),MB=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]`,ee=`[object Uint16Array]`,k=`[object Uint32Array]`,A=/[\\^$.*+?()[\]{}|]/g,j=/\w*$/,M=/^\[object .+?Constructor\]$/,te=/^(?:0|[1-9]\d*)$/,N={};N[i]=N[a]=N[b]=N[x]=N[o]=N[s]=N[S]=N[C]=N[w]=N[T]=N[E]=N[d]=N[f]=N[p]=N[h]=N[g]=N[_]=N[v]=N[D]=N[O]=N[ee]=N[k]=!0,N[c]=N[l]=N[y]=!1;var P=typeof global==`object`&&global&&global.Object===Object&&global,F=typeof self==`object`&&self&&self.Object===Object&&self,ne=P||F||Function(`return this`)(),re=typeof e==`object`&&e&&!e.nodeType&&e,ie=re&&typeof t==`object`&&t&&!t.nodeType&&t,I=ie&&ie.exports===re;function ae(e,t){return e.set(t[0],t[1]),e}function oe(e,t){return e.add(t),e}function se(e,t){for(var n=-1,r=e?e.length:0;++n<r&&t(e[n],n,e)!==!1;);return e}function ce(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function le(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 L(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function ue(e,t){return e?.[t]}function de(e){var t=!1;if(e!=null&&typeof e.toString!=`function`)try{t=!!(e+``)}catch{}return t}function fe(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function pe(e,t){return function(n){return e(t(n))}}function me(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var he=Array.prototype,ge=Function.prototype,_e=Object.prototype,ve=ne[`__core-js_shared__`],ye=function(){var e=/[^.]+$/.exec(ve&&ve.keys&&ve.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),be=ge.toString,xe=_e.hasOwnProperty,Se=_e.toString,Ce=RegExp(`^`+be.call(xe).replace(A,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),we=I?ne.Buffer:void 0,Te=ne.Symbol,Ee=ne.Uint8Array,De=pe(Object.getPrototypeOf,Object),Oe=Object.create,ke=_e.propertyIsEnumerable,Ae=he.splice,je=Object.getOwnPropertySymbols,Me=we?we.isBuffer:void 0,Ne=pe(Object.keys,Object),Pe=zt(ne,`DataView`),Fe=zt(ne,`Map`),Ie=zt(ne,`Promise`),Le=zt(ne,`Set`),Re=zt(ne,`WeakMap`),ze=zt(Object,`create`),Be=Yt(Pe),Ve=Yt(Fe),He=Yt(Ie),Ue=Yt(Le),We=Yt(Re),Ge=Te?Te.prototype:void 0,Ke=Ge?Ge.valueOf:void 0;function qe(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 R(){this.__data__=ze?ze(null):{}}function Je(e){return this.has(e)&&delete this.__data__[e]}function Ye(e){var t=this.__data__;if(ze){var r=t[e];return r===n?void 0:r}return xe.call(t,e)?t[e]:void 0}function Xe(e){var t=this.__data__;return ze?t[e]!==void 0:xe.call(t,e)}function Ze(e,t){var r=this.__data__;return r[e]=ze&&t===void 0?n:t,this}qe.prototype.clear=R,qe.prototype.delete=Je,qe.prototype.get=Ye,qe.prototype.has=Xe,qe.prototype.set=Ze;function Qe(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 $e(){this.__data__=[]}function et(e){var t=this.__data__,n=vt(t,e);return n<0?!1:(n==t.length-1?t.pop():Ae.call(t,n,1),!0)}function tt(e){var t=this.__data__,n=vt(t,e);return n<0?void 0:t[n][1]}function nt(e){return vt(this.__data__,e)>-1}function rt(e,t){var n=this.__data__,r=vt(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}Qe.prototype.clear=$e,Qe.prototype.delete=et,Qe.prototype.get=tt,Qe.prototype.has=nt,Qe.prototype.set=rt;function it(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 at(){this.__data__={hash:new qe,map:new(Fe||Qe),string:new qe}}function ot(e){return Rt(this,e).delete(e)}function st(e){return Rt(this,e).get(e)}function ct(e){return Rt(this,e).has(e)}function lt(e,t){return Rt(this,e).set(e,t),this}it.prototype.clear=at,it.prototype.delete=ot,it.prototype.get=st,it.prototype.has=ct,it.prototype.set=lt;function ut(e){this.__data__=new Qe(e)}function dt(){this.__data__=new Qe}function ft(e){return this.__data__.delete(e)}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 Qe){var r=n.__data__;if(!Fe||r.length<199)return r.push([e,t]),this;n=this.__data__=new it(r)}return n.set(e,t),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=$t(e)||Qt(e)?L(e.length,String):[],r=n.length,i=!!r;for(var a in e)(t||xe.call(e,a))&&!(i&&(a==`length`||Gt(a,r)))&&n.push(a);return n}function _t(e,t,n){var r=e[t];(!(xe.call(e,t)&&Zt(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function vt(e,t){for(var n=e.length;n--;)if(Zt(e[n][0],t))return n;return-1}function yt(e,t){return e&&Ft(t,cn(t),e)}function bt(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(!on(e))return e;var d=$t(e);if(d){if(c=Ht(e),!t)return Pt(e,c)}else{var f=Vt(e),m=f==l||f==u;if(nn(e))return Et(e,t);if(f==p||f==i||m&&!o){if(de(e))return o?e:{};if(c=Ut(m?{}:e),!t)return It(e,yt(c,e))}else{if(!N[f])return o?e:{};c=Wt(e,f,bt,t)}}s||=new ut;var h=s.get(e);if(h)return h;if(s.set(e,c),!d)var g=n?Lt(e):cn(e);return se(g||e,function(i,a){g&&(a=i,i=e[a]),_t(c,a,bt(i,t,n,r,a,e,s))}),c}function xt(e){return on(e)?Oe(e):{}}function St(e,t,n){var r=t(e);return $t(e)?r:ce(r,n(e))}function Ct(e){return Se.call(e)}function wt(e){return!on(e)||qt(e)?!1:(rn(e)||de(e)?Ce:M).test(Yt(e))}function Tt(e){if(!Jt(e))return Ne(e);var t=[];for(var n in Object(e))xe.call(e,n)&&n!=`constructor`&&t.push(n);return t}function Et(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}function Dt(e){var t=new e.constructor(e.byteLength);return new Ee(t).set(new Ee(e)),t}function Ot(e,t){var n=t?Dt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function kt(e,t,n){return le(t?n(fe(e),!0):fe(e),ae,new e.constructor)}function At(e){var t=new e.constructor(e.source,j.exec(e));return t.lastIndex=e.lastIndex,t}function jt(e,t,n){return le(t?n(me(e),!0):me(e),oe,new e.constructor)}function Mt(e){return Ke?Object(Ke.call(e)):{}}function Nt(e,t){var n=t?Dt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Pt(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function Ft(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;_t(n,o,s===void 0?e[o]:s)}return n}function It(e,t){return Ft(e,Bt(e),t)}function Lt(e){return St(e,cn,Bt)}function Rt(e,t){var n=e.__data__;return Kt(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function zt(e,t){var n=ue(e,t);return wt(n)?n:void 0}var Bt=je?pe(je,Object):ln,Vt=Ct;(Pe&&Vt(new Pe(new ArrayBuffer(1)))!=x||Fe&&Vt(new Fe)!=d||Ie&&Vt(Ie.resolve())!=m||Le&&Vt(new Le)!=g||Re&&Vt(new Re)!=y)&&(Vt=function(e){var t=Se.call(e),n=t==p?e.constructor:void 0,r=n?Yt(n):void 0;if(r)switch(r){case Be:return x;case Ve:return d;case He:return m;case Ue:return g;case We:return y}return t});function Ht(e){var t=e.length,n=e.constructor(t);return t&&typeof e[0]==`string`&&xe.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function Ut(e){return typeof e.constructor==`function`&&!Jt(e)?xt(De(e)):{}}function Wt(e,t,n,r){var i=e.constructor;switch(t){case b:return Dt(e);case o:case s:return new i(+e);case x:return Ot(e,r);case S:case C:case w:case T:case E:case D:case O:case ee:case k:return Nt(e,r);case d:return kt(e,r,n);case f:case _:return new i(e);case h:return At(e);case g:return jt(e,r,n);case v:return Mt(e)}}function Gt(e,t){return t??=r,!!t&&(typeof e==`number`||te.test(e))&&e>-1&&e%1==0&&e<t}function Kt(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function qt(e){return!!ye&&ye in e}function Jt(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||_e)}function Yt(e){if(e!=null){try{return be.call(e)}catch{}try{return e+``}catch{}}return``}function Xt(e){return bt(e,!0,!0)}function Zt(e,t){return e===t||e!==e&&t!==t}function Qt(e){return tn(e)&&xe.call(e,`callee`)&&(!ke.call(e,`callee`)||Se.call(e)==i)}var $t=Array.isArray;function en(e){return e!=null&&an(e.length)&&!rn(e)}function tn(e){return sn(e)&&en(e)}var nn=Me||un;function rn(e){var t=on(e)?Se.call(e):``;return t==l||t==u}function an(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=r}function on(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function sn(e){return!!e&&typeof e==`object`}function cn(e){return en(e)?gt(e):Tt(e)}function ln(){return[]}function un(){return!1}t.exports=Xt})),NB=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]`,ee=/[\\^$.*+?()[\]{}|]/g,k=/^\[object .+?Constructor\]$/,A=/^(?: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,te=typeof self==`object`&&self&&self.Object===Object&&self,N=M||te||Function(`return this`)(),P=typeof e==`object`&&e&&!e.nodeType&&e,F=P&&typeof t==`object`&&t&&!t.nodeType&&t,ne=F&&F.exports===P,re=ne&&M.process,ie=function(){try{return re&&re.binding&&re.binding(`util`)}catch{}}(),I=ie&&ie.isTypedArray;function ae(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 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){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function ce(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function le(e){return function(t){return e(t)}}function L(e,t){return e.has(t)}function ue(e,t){return e?.[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=N[`__core-js_shared__`],ve=he.toString,ye=ge.hasOwnProperty,be=function(){var e=/[^.]+$/.exec(_e&&_e.keys&&_e.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),xe=ge.toString,Se=RegExp(`^`+ve.call(ye).replace(ee,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),Ce=ne?N.Buffer:void 0,we=N.Symbol,Te=N.Uint8Array,Ee=ge.propertyIsEnumerable,De=me.splice,Oe=we?we.toStringTag:void 0,ke=Object.getOwnPropertySymbols,Ae=Ce?Ce.isBuffer:void 0,je=fe(Object.keys,Object),Me=Mt(N,`DataView`),Ne=Mt(N,`Map`),Pe=Mt(N,`Promise`),Fe=Mt(N,`Set`),Ie=Mt(N,`WeakMap`),Le=Mt(Object,`create`),Re=Vt(Me),ze=Vt(Ne),Be=Vt(Pe),Ve=Vt(Fe),He=Vt(Ie),Ue=we?we.prototype:void 0,We=Ue?Ue.valueOf:void 0;function Ge(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 Ke(){this.__data__=Le?Le(null):{},this.size=0}function qe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}function R(e){var t=this.__data__;if(Le){var r=t[e];return r===n?void 0:r}return ye.call(t,e)?t[e]:void 0}function Je(e){var t=this.__data__;return Le?t[e]!==void 0:ye.call(t,e)}function Ye(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=Le&&t===void 0?n:t,this}Ge.prototype.clear=Ke,Ge.prototype.delete=qe,Ge.prototype.get=R,Ge.prototype.has=Je,Ge.prototype.set=Ye;function Xe(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 Ze(){this.__data__=[],this.size=0}function Qe(e){var t=this.__data__,n=vt(t,e);return n<0?!1:(n==t.length-1?t.pop():De.call(t,n,1),--this.size,!0)}function $e(e){var t=this.__data__,n=vt(t,e);return n<0?void 0:t[n][1]}function et(e){return vt(this.__data__,e)>-1}function tt(e,t){var n=this.__data__,r=vt(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}Xe.prototype.clear=Ze,Xe.prototype.delete=Qe,Xe.prototype.get=$e,Xe.prototype.has=et,Xe.prototype.set=tt;function nt(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 rt(){this.size=0,this.__data__={hash:new Ge,map:new(Ne||Xe),string:new Ge}}function it(e){var t=jt(this,e).delete(e);return this.size-=+!!t,t}function at(e){return jt(this,e).get(e)}function ot(e){return jt(this,e).has(e)}function st(e,t){var n=jt(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}nt.prototype.clear=rt,nt.prototype.delete=it,nt.prototype.get=at,nt.prototype.has=ot,nt.prototype.set=st;function ct(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new nt;++t<n;)this.add(e[t])}function lt(e){return this.__data__.set(e,n),this}function ut(e){return this.__data__.has(e)}ct.prototype.add=ct.prototype.push=lt,ct.prototype.has=ut;function dt(e){var t=this.__data__=new Xe(e);this.size=t.size}function ft(){this.__data__=new Xe,this.size=0}function pt(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function mt(e){return this.__data__.get(e)}function ht(e){return this.__data__.has(e)}function gt(e,t){var n=this.__data__;if(n instanceof Xe){var r=n.__data__;if(!Ne||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new nt(r)}return n.set(e,t),this.size=n.size,this}dt.prototype.clear=ft,dt.prototype.delete=pt,dt.prototype.get=mt,dt.prototype.has=ht,dt.prototype.set=gt;function _t(e,t){var n=Wt(e),r=!n&&Ut(e),i=!n&&!r&&Kt(e),a=!n&&!r&&!i&&Qt(e),o=n||r||i||a,s=o?ce(e.length,String):[],c=s.length;for(var l in e)(t||ye.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||It(l,c)))&&s.push(l);return s}function vt(e,t){for(var n=e.length;n--;)if(Ht(e[n][0],t))return n;return-1}function yt(e,t,n){var r=t(e);return Wt(e)?r:oe(r,n(e))}function bt(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Oe&&Oe in Object(e)?Nt(e):Bt(e)}function xt(e){return Zt(e)&&bt(e)==i}function St(e,t,n,r,i){return e===t?!0:e==null||t==null||!Zt(e)&&!Zt(t)?e!==e&&t!==t:Ct(e,t,n,r,St,i)}function Ct(e,t,n,r,o,s){var c=Wt(e),l=Wt(t),u=c?a:Ft(e),d=l?a:Ft(t);u=u==i?f:u,d=d==i?f:d;var p=u==f,m=d==f,h=u==d;if(h&&Kt(e)){if(!Kt(t))return!1;c=!0,p=!1}if(h&&!p)return s||=new dt,c||Qt(e)?Dt(e,t,n,r,o,s):Ot(e,t,u,n,r,o,s);if(!(n&1)){var g=p&&ye.call(e,`__wrapped__`),_=m&&ye.call(t,`__wrapped__`);if(g||_){var v=g?e.value():e,y=_?t.value():t;return s||=new dt,o(v,y,n,r,s)}}return h?(s||=new dt,kt(e,t,n,r,o,s)):!1}function wt(e){return!Xt(e)||Rt(e)?!1:(Jt(e)?Se:k).test(Vt(e))}function Tt(e){return Zt(e)&&Yt(e.length)&&!!j[bt(e)]}function Et(e){if(!zt(e))return je(e);var t=[];for(var n in Object(e))ye.call(e,n)&&n!=`constructor`&&t.push(n);return t}function Dt(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 ct: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(!se(t,function(e,t){if(!L(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 Ot(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 Te(e),new Te(t)));case o:case s:case d:return Ht(+e,+t);case c:return e.name==t.name&&e.message==t.message;case m:case g:return e==t+``;case u:var f=de;case h:var p=r&1;if(f||=pe,e.size!=t.size&&!p)return!1;var _=l.get(e);if(_)return _==t;r|=2,l.set(e,t);var b=Dt(f(e),f(t),r,i,a,l);return l.delete(e),b;case`[object Symbol]`:if(We)return We.call(e)==We.call(t)}return!1}function kt(e,t,n,r,i,a){var o=n&1,s=At(e),c=s.length;if(c!=At(t).length&&!o)return!1;for(var l=c;l--;){var u=s[l];if(!(o?u in t:ye.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 At(e){return yt(e,$t,Pt)}function jt(e,t){var n=e.__data__;return Lt(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function Mt(e,t){var n=ue(e,t);return wt(n)?n:void 0}function Nt(e){var t=ye.call(e,Oe),n=e[Oe];try{e[Oe]=void 0;var r=!0}catch{}var i=xe.call(e);return r&&(t?e[Oe]=n:delete e[Oe]),i}var Pt=ke?function(e){return e==null?[]:(e=Object(e),ae(ke(e),function(t){return Ee.call(e,t)}))}:en,Ft=bt;(Me&&Ft(new Me(new ArrayBuffer(1)))!=y||Ne&&Ft(new Ne)!=u||Pe&&Ft(Pe.resolve())!=p||Fe&&Ft(new Fe)!=h||Ie&&Ft(new Ie)!=_)&&(Ft=function(e){var t=bt(e),n=t==f?e.constructor:void 0,r=n?Vt(n):``;if(r)switch(r){case Re:return y;case ze:return u;case Be:return p;case Ve:return h;case He:return _}return t});function It(e,t){return t??=r,!!t&&(typeof e==`number`||A.test(e))&&e>-1&&e%1==0&&e<t}function Lt(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function Rt(e){return!!be&&be in e}function zt(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||ge)}function Bt(e){return xe.call(e)}function Vt(e){if(e!=null){try{return ve.call(e)}catch{}try{return e+``}catch{}}return``}function Ht(e,t){return e===t||e!==e&&t!==t}var Ut=xt(function(){return arguments}())?xt:function(e){return Zt(e)&&ye.call(e,`callee`)&&!Ee.call(e,`callee`)},Wt=Array.isArray;function Gt(e){return e!=null&&Yt(e.length)&&!Jt(e)}var Kt=Ae||tn;function qt(e,t){return St(e,t)}function Jt(e){if(!Xt(e))return!1;var t=bt(e);return t==l||t==`[object GeneratorFunction]`||t==`[object AsyncFunction]`||t==`[object Proxy]`}function Yt(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=r}function Xt(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}function Zt(e){return typeof e==`object`&&!!e}var Qt=I?le(I):Tt;function $t(e){return Gt(e)?_t(e):Et(e)}function en(){return[]}function tn(){return!1}t.exports=qt})),PB=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=MB(),n=NB(),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})),FB=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})),IB=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=FB();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=jB(),r=MB(),i=NB(),a=PB();e.AttributeMap=a.default;var o=FB();e.Op=o.default;var s=IB();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=`
|
|
389
|
+
`){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),LB=class extends wB{static value(){}optimize(){(this.prev||this.next)&&this.remove()}length(){return 0}value(){return``}};LB.blotName=`break`,LB.tagName=`BR`;var RB=class extends AB{},zB={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};function BB(e){return e.replace(/[&<>"']/g,e=>zB[e])}var VB=class e extends yB{static allowedChildren=[e,LB,wB,RB];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)}}},HB=1,UB=class extends xB{cache={};delta(){return this.cache.delta??(this.cache.delta=GB(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(`
|
|
390
|
+
`),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 LB&&n.remove(),this.cache={}}length(){return this.cache.length??(this.cache.length=super.length()+HB),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()-HB)){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}};UB.blotName=`block`,UB.tagName=`P`,UB.defaultChild=LB,UB.allowedChildren=[LB,VB,wB,RB];var WB=class extends wB{attach(){super.attach(),this.attributes=new cB(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(`
|
|
391
|
+
`),i=r.pop(),a=r.map(e=>{let t=this.scroll.create(UB.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)}};WB.scope=X.BLOCK_BLOT;function GB(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return e.descendants(fB).reduce((e,n)=>n.length()===0?e:e.insert(n.value(),KB(n,{},t)),new Z.default).insert(`
|
|
392
|
+
`,KB(e))}function KB(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:KB(e.parent,t,n)}var qB=class e extends wB{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 RB?this.prev:null,r=n?n.length():0,i=this.next instanceof RB?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``}},JB=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),YB=new WeakMap,XB=[`error`,`warn`,`log`,`info`],ZB=`warn`;function QB(e){if(ZB&&XB.indexOf(e)<=XB.indexOf(ZB)){var t=[...arguments].slice(1);console[e](...t)}}function $B(e){return XB.reduce((t,n)=>(t[n]=QB.bind(console,n,e),t),{})}$B.level=e=>{ZB=e},QB.level=$B.level;var eV=$B(`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=YB.get(t);n&&n.emitter&&n.emitter.handleDOM(...e)})})});var Q=class extends JB.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`,eV.error)}emit(){var e=[...arguments];return eV.log.call(eV,...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})}},tV=$B(`quill:selection`),nV=class{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;this.index=e,this.length=t}},rV=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 nV(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 fB){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 tV.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&&iV(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 fB?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 nV(i,r-i)}normalizeNative(e){if(!iV(this.root,e.startContainer)||!e.collapsed&&!iV(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(tV.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),tV.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),!Zz(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,az(this.lastRange),az(t),e];this.emitter.emit(Q.events.EDITOR_CHANGE,...n),e!==Q.sources.SILENT&&this.emitter.emit(...n)}}};function iV(e,t){try{t.parentNode}catch{return!1}return e.contains(t)}var aV=/^[ -~]*$/,oV=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=dV(e),r=new Z.default;return pV(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(`
|
|
393
|
+
`)&&(t<=e||!!this.scroll.descendant(WB,e)[0]),this.scroll.insertAt(e,r);let[i,o]=this.scroll.line(e),c=Qz({},KB(i));if(i instanceof UB){let[e]=i.descendant(fB,o);e&&(c=Qz(c,KB(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(WB,e)[0])&&(s=!0);else if(e>0){let[t,n]=this.scroll.descendant(fB,e-1);t instanceof RB?t.value()[n]!==`
|
|
394
|
+
`&&(o=!0):t instanceof wB&&t.statics.scope===X.INLINE_BLOT&&(o=!0)}if(this.scroll.insertAt(e,r,n.insert[r]),i){let[t]=this.scroll.descendant(fB,e);if(t){let e=Qz({},KB(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,az(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,az(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 UB?n.push(t):t instanceof fB&&r.push(t)}):(n=this.scroll.lines(e,t),r=this.scroll.descendants(fB,e,t));let[i,a]=[n,r].map(e=>{let t=e.shift();if(t==null)return{};let n=KB(t);for(;Object.keys(n).length>0;){let t=e.shift();if(t==null)return n;n=lV(KB(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)?cV(n,r,t,!0):cV(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=dV(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,`
|
|
395
|
+
`).replace(/\r/g,`
|
|
396
|
+
`),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,az(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!==UB.blotName)return!1;let t=e;return t.children.length>1?!1:t.children.head instanceof LB}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(`
|
|
397
|
+
`));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(aV)&&this.scroll.find(t[0].target)){let i=this.scroll.find(t[0].target),a=KB(i),o=i.offset(this.scroll),s=t[0].oldValue.replace(qB.CONTENTS,``),c=new Z.default().insert(s),l=new Z.default().insert(i.value()),u=n&&{oldRange:fV(n.oldRange,-o),newRange:fV(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||!Zz(r.compose(e),this.delta))&&(e=r.diff(this.delta,n));return e}};function sV(e,t,n){if(e.length===0){let[e]=uV(n.pop());return t<=0?`</li></${e}>`:`</li></${e}>${sV([],t-1,n)}`}let[{child:r,offset:i,length:a,indent:o,type:s},...c]=e,[l,u]=uV(s);if(o>t)return n.push(s),o===t+1?`<${l}><li${u}>${cV(r,i,a)}${sV(c,o,n)}`:`<${l}><li>${sV(e,t+1,n)}`;let d=n[n.length-1];if(o===t&&s===d)return`</li><li${u}>${cV(r,i,a)}${sV(c,o,n)}`;let[f]=uV(n.pop());return`</li></${f}>${sV(e,t-1,n)}`}function cV(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 RB)return BB(e.value().slice(t,t+n)).replaceAll(` `,` `);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})}),sV(r,-1,[])}let i=[];if(e.children.forEachAt(t,n,(e,t,n)=>{i.push(cV(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 lV(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 uV(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 dV(e){return e.reduce((e,t)=>{if(typeof t.insert==`string`){let n=t.insert.replace(/\r\n/g,`
|
|
398
|
+
`).replace(/\r/g,`
|
|
399
|
+
`);return e.insert(n,t.attributes)}return e.push(t)},new Z.default)}function fV(e,t){let{index:n,length:r}=e;return new nV(n+t,r)}function pV(e){let t=[];return e.forEach(e=>{typeof e.insert==`string`?e.insert.split(`
|
|
400
|
+
`).forEach((n,r)=>{r&&t.push({insert:`
|
|
401
|
+
`,attributes:e.attributes}),n&&t.push({insert:n,attributes:e.attributes})}):t.push(e)}),t}var mV=class{static DEFAULTS={};constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.quill=e,this.options=t}},hV=``,gV=class extends wB{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(hV),this.rightGuard=document.createTextNode(hV),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(hV).join(``);if(e===this.leftGuard){if(this.prev instanceof RB){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 RB?(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=hV,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)}})}},_V=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}},vV=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]}},yV=e=>e.parentElement||e.getRootNode().host||null,bV=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},SV=(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,CV=(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}:bV(i),a=getComputedStyle(i),o=SV(r.left,r.right,t.left,t.right,xV(a.scrollPaddingLeft),xV(a.scrollPaddingRight)),s=SV(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:yV(i)}},wV=100,TV=[`block`,`break`,`cursor`,`inline`,`scroll`,`text`],EV=(e,t,n)=>{let r=new rB;return TV.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>wV){n.error(`Cycle detected in registering blot requiredContainer: "${e}"`);break}}),r},DV=$B(`quill`),OV=new rB;gB.uiClass=`ql-ui`;var $=class e{static DEFAULTS={bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:``,readOnly:!1,registry:OV,theme:`default`};static events=Q.events;static sources=Q.sources;static version=`2.0.3`;static imports={delta:Z.default,parchment:$z,"core/module":mV,"core/theme":vV};static debug(e){e===!0&&(e=`log`),$B.level(e)}static find(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return YB.get(e)||OV.find(e,t)}static import(e){return this.imports[e]??DV.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&&DV.warn(`Overwriting ${e} with`,t),this.imports[e]=t,(e.startsWith(`blots/`)||e.startsWith(`formats/`))&&t&&typeof t!=`boolean`&&t.blotName!==`abstract`&&OV.register(t),typeof t.register==`function`&&t.register(OV)}}constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.options=MV(t,n),this.container=this.options.container,this.container==null){DV.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=``,YB.set(this.container,this),this.root=this.addContainer(`ql-editor`),this.root.classList.add(`ql-blank`),this.emitter=new Q;let i=OB.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 oV(this.scroll),this.selection=new rV(this.scroll,this.emitter),this.composition=new _V(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;NV.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;NV.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:`
|
|
402
|
+
`});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]=PV(e,t,n),NV.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 NV.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]=PV(e,t,n,r,i),NV.call(this,()=>this.editor.formatLine(e,t,a),i,e,0)}formatText(e,t,n,r,i){let a;return[e,t,a,i]=PV(e,t,n,r,i),NV.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]=PV(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]=PV(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]=PV(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 NV.call(this,()=>this.editor.insertEmbed(t,n,r),i,t)}insertText(e,t,n,r,i){let a;return[e,,a,i]=PV(e,0,n,r,i),NV.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]=PV(e,t,n),NV.call(this,()=>this.editor.removeFormat(e,t),n,e)}scrollRectIntoView(e){CV(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 NV.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]=PV(t,n,r),this.selection.setRange(new nV(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 NV.call(this,()=>(e=new Z.default(e),this.editor.applyDelta(e)),t,!0)}};function kV(e){return typeof e==`string`?document.querySelector(e):e}function AV(e){return Object.entries(e??{}).reduce((e,t)=>{let[n,r]=t;return{...e,[n]:r===!0?{}:r}},{})}function jV(e){return Object.fromEntries(Object.entries(e).filter(e=>e[1]!==void 0))}function MV(e,t){let n=kV(e);if(!n)throw Error(`Invalid Quill container`);let r=!t.theme||t.theme===$.DEFAULTS.theme?vV:$.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=AV(t.modules);c!=null&&c.toolbar&&c.toolbar.constructor!==Object&&(c={...c,toolbar:{container:c.toolbar}});let l=Qz({},AV(i),AV(o),c),u={...a,...jV(s),...jV(t)},d=t.registry;return d?t.formats&&DV.warn(`Ignoring "formats" option because "registry" is specified`):d=t.formats?EV(t.formats,u.registry,DV):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?(DV.error(`Cannot load ${n} module. Are you sure you registered it?`),e):{...e,[n]:Qz({},i.DEFAULTS||{},r)}},{}),bounds:kV(u.bounds)}}function NV(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=FV(i,o,t):r!==0&&(i=FV(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 PV(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 FV(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 nV(a,o-a)}var IV=class extends CB{};function LV(e){return e instanceof UB||e instanceof WB}function RV(e){return typeof e.updateContent==`function`}var zV=class extends OB{static blotName=`scroll`;static className=`ql-editor`;static tagName=`DIV`;static defaultChild=UB;static allowedChildren=[UB,WB,IV];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 WB||i instanceof WB){this.optimize();return}let e=i.children.head instanceof LB?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(`
|
|
403
|
+
`)?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(`
|
|
404
|
+
`))),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(WB,e)[0]&&e<this.length()),n=i.type===`block`?i.delta:new Z.default().insert({[i.key]:i.value});BV(this,e,n);let r=+(i.type===`block`),a=e+n.length()+r;t&&this.insertAt(a-1,`
|
|
405
|
+
`);let o=KB(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`)BV(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();BV(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 fB?[n,r]:[null,-1]}line(e){return e===this.length()?this.line(e-1):this.descendant(LV,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)=>{LV(e)?i.push(e):e instanceof CB&&(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&&!RV(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 WB,e);r&&r.statics.blotName===t&&RV(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(`
|
|
406
|
+
`);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 BV(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(fB,t),o=KB(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(fB,t),r=KB(n);i=Z.AttributeMap.diff(r,i)||{}}}}return Object.keys(i).forEach(n=>{e.formatAt(t,r,n,i[n])}),t+r},t)}var VV={scope:X.BLOCK,whitelist:[`right`,`center`,`justify`]},HV=new eB(`align`,`align`,VV),UV=new aB(`align`,`ql-align`,VV),WV=new sB(`align`,`text-align`,VV),GV=class extends sB{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}},KV=new aB(`color`,`ql-color`,{scope:X.INLINE}),qV=new GV(`color`,`color`,{scope:X.INLINE}),JV=new aB(`background`,`ql-bg`,{scope:X.INLINE}),YV=new GV(`background`,`background-color`,{scope:X.INLINE}),XV=class extends IV{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(`
|
|
407
|
+
`).slice(e,e+t)}html(e,t){return`<pre>\n${BB(this.code(e,t))}\n</pre>`}},ZV=class extends UB{static TAB=` `;static register(){$.register(XV)}},QV=class extends VB{};QV.blotName=`code`,QV.tagName=`CODE`,ZV.blotName=`code-block`,ZV.className=`ql-code-block`,ZV.tagName=`DIV`,XV.blotName=`code-block-container`,XV.className=`ql-code-block-container`,XV.tagName=`DIV`,XV.allowedChildren=[ZV],ZV.allowedChildren=[RB,LB,qB],ZV.requiredContainer=XV;var $V={scope:X.BLOCK,whitelist:[`rtl`]},eH=new eB(`direction`,`dir`,$V),tH=new aB(`direction`,`ql-direction`,$V),nH=new sB(`direction`,`direction`,$V),rH={scope:X.INLINE,whitelist:[`serif`,`monospace`]},iH=new aB(`font`,`ql-font`,rH),aH=new class extends sB{value(e){return super.value(e).replace(/["']/g,``)}}(`font`,`font-family`,rH),oH=new aB(`size`,`ql-size`,{scope:X.INLINE,whitelist:[`small`,`large`,`huge`]}),sH=new sB(`size`,`font-size`,{scope:X.INLINE,whitelist:[`10px`,`18px`,`32px`]}),cH=$B(`quill:keyboard`),lH=/Mac/i.test(navigator.platform)?`metaKey`:`ctrlKey`,uH=class e extends mV{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=hH(e);if(r==null){cH.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 AB?s.value().slice(0,c):``,f=l instanceof AB?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:Zz(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(`
|
|
408
|
+
`,n);this.quill.updateContents(r,$.sources.USER),this.quill.setSelection(e.index+1,$.sources.SILENT),this.quill.focus()}};uH.DEFAULTS={bindings:{bold:pH(`bold`),italic:pH(`italic`),underline:pH(`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":dH(!0),"outdent code-block":dH(!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(`
|
|
409
|
+
`,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(`
|
|
410
|
+
`,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=_H(n,r,i,a);if(o==null)return;let s=n.offset();if(o<0){let t=new Z.default().retain(s).insert(`
|
|
411
|
+
`);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(`
|
|
412
|
+
`);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":fH(`ArrowLeft`,!1),"embed left shift":fH(`ArrowLeft`,!0),"embed right":fH(`ArrowRight`,!1),"embed right shift":fH(`ArrowRight`,!0),"table down":mH(!1),"table up":mH(!0)}};function dH(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 fH(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 wB?(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 pH(e){return{key:e[0],shortKey:!0,handler(t,n){this.quill.format(e,!n.format[e],$.sources.USER)}}}function mH(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 hH(e){if(typeof e==`string`||typeof e==`number`)e={key:e};else if(typeof e==`object`)e=az(e);else return null;return e.shortKey&&(e[lH]=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 _H(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 vH=/font-weight:\s*normal/,yH=[`P`,`OL`,`UL`],bH=e=>e&&yH.includes(e.tagName),xH=e=>{Array.from(e.querySelectorAll(`br`)).filter(e=>bH(e.previousElementSibling)&&bH(e.nextElementSibling)).forEach(e=>{e.parentNode?.removeChild(e)})},SH=e=>{Array.from(e.querySelectorAll(`b[style*="font-weight"]`)).filter(e=>e.getAttribute(`style`)?.match(vH)).forEach(t=>{let n=e.createDocumentFragment();n.append(...t.childNodes),t.parentNode?.replaceChild(n,t)})};function CH(e){e.querySelector(`[id^="docs-internal-guid-"]`)&&(SH(e),xH(e))}var wH=/\bmso-list:[^;]*ignore/i,TH=/\bmso-list:[^;]*\bl(\d+)/i,EH=/\bmso-list:[^;]*\blevel(\d+)/i,DH=(e,t)=>{let n=e.getAttribute(`style`),r=n?.match(TH);if(!r)return null;let i=Number(r[1]),a=n?.match(EH),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}},OH=e=>{let t=Array.from(e.querySelectorAll(`[style*=mso-list]`)),n=[],r=[];t.forEach(e=>{(e.getAttribute(`style`)||``).match(wH)?n.push(e):r.push(e)}),n.forEach(e=>e.parentNode?.removeChild(e));let i=e.documentElement.innerHTML,a=r.map(e=>DH(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 kH(e){e.documentElement.getAttribute(`xmlns:w`)===`urn:schemas-microsoft-com:office:word`&&OH(e)}var AH=[kH,CH],jH=e=>{e.documentElement&&AH.forEach(t=>{t(e)})},MH=$B(`quill:clipboard`),NH=[[Node.TEXT_NODE,tU],[Node.TEXT_NODE,QH],[`br`,qH],[Node.ELEMENT_NODE,QH],[Node.ELEMENT_NODE,KH],[Node.ELEMENT_NODE,GH],[Node.ELEMENT_NODE,$H],[`li`,XH],[`ol, ul`,ZH],[`pre`,JH],[`tr`,eU],[`b`,WH(`bold`)],[`i`,WH(`italic`)],[`strike`,WH(`strike`)],[`style`,YH]],PH=[HV,eH].reduce((e,t)=>(e[t.keyName]=t,e),{}),FH=[WV,YV,qV,nH,aH,sH].reduce((e,t)=>(e[t.keyName]=t,e),{}),IH=class extends mV{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=[],NH.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[ZV.blotName])return new Z.default().insert(n||``,{[ZV.blotName]:r[ZV.blotName]});if(!t)return new Z.default().insert(n||``,r);let i=this.convertHTML(t);return RH(i,`
|
|
413
|
+
`)&&(i.ops[i.ops.length-1].attributes==null||r.table)?i.compose(new Z.default().retain(i.length()-1).delete(1)):i}normalizeHTML(e){jH(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 UH(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(`
|
|
414
|
+
`)}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);MH.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 LH(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 RH(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 zH(e,t){if(!(e instanceof Element))return!1;let n=t.query(e);return n&&n.prototype instanceof wB?!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 BH(e,t){return e.previousElementSibling&&e.nextElementSibling&&!zH(e.previousElementSibling,t)&&!zH(e.nextElementSibling,t)}var VH=new WeakMap;function HH(e){return e!=null&&(VH.has(e)||(e.tagName===`PRE`?VH.set(e,!0):VH.set(e,HH(e.parentNode))),VH.get(e))}function UH(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=UH(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 WH(e){return(t,n,r)=>LH(n,e,!0,r)}function GH(e,t,n){let r=eB.keys(e),i=aB.keys(e),a=sB.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=PH[t],r!=null&&(r.attrName===t||r.keyName===t)&&(o[r.attrName]=r.value(e)||void 0),r=FH[t],r!=null&&(r.attrName===t||r.keyName===t)&&(r=FH[t],o[r.attrName]=r.value(e)||void 0))}),Object.entries(o).reduce((e,t)=>{let[r,i]=t;return LH(e,r,i,n)},t)}function KH(e,t,n){let r=n.query(e);if(r==null)return t;if(r.prototype instanceof wB){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&&!RH(t,`
|
|
415
|
+
`)&&t.insert(`
|
|
416
|
+
`),`blotName`in r&&`formats`in r&&typeof r.formats==`function`)return LH(t,r.blotName,r.formats(e,n),n);return t}function qH(e,t){return RH(t,`
|
|
417
|
+
`)||t.insert(`
|
|
418
|
+
`),t}function JH(e,t,n){let r=n.query(`code-block`);return LH(t,`code-block`,r&&`formats`in r&&typeof r.formats==`function`?r.formats(e,n):!0,n)}function YH(){return new Z.default}function XH(e,t,n){let r=n.query(e);if(r==null||r.blotName!==`list`||!RH(t,`
|
|
419
|
+
`))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 ZH(e,t,n){let r=e,i=r.tagName===`OL`?`ordered`:`bullet`,a=r.getAttribute(`data-checked`);return a&&(i=a===`true`?`checked`:`unchecked`),LH(t,`list`,i,n)}function QH(e,t,n){if(!RH(t,`
|
|
420
|
+
`)){if(zH(e,n)&&(e.childNodes.length>0||e instanceof HTMLParagraphElement))return t.insert(`
|
|
421
|
+
`);if(t.length()>0&&e.nextSibling){let r=e.nextSibling;for(;r!=null;){if(zH(r,n))return t.insert(`
|
|
422
|
+
`);let e=n.query(r);if(e&&e.prototype instanceof WB)return t.insert(`
|
|
423
|
+
`);r=r.firstChild}}}return t}function $H(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 LH(e,r,i,n)},t),parseFloat(i.textIndent||0)>0?new Z.default().insert(` `).concat(t):t}function eU(e,t,n){let r=e.parentElement?.tagName===`TABLE`?e.parentElement:e.parentElement?.parentElement;return r==null?t:LH(t,`table`,Array.from(r.querySelectorAll(`tr`)).indexOf(e)+1,n)}function tU(e,t,n){let r=e.data;if(e.parentElement?.tagName===`O:P`)return t.insert(r.trim());if(!HH(e)){if(r.trim().length===0&&r.includes(`
|
|
424
|
+
`)&&!BH(e,n))return t;r=r.replace(/[^\S\u00a0]/g,` `),r=r.replace(/ {2,}/g,` `),(e.previousSibling==null&&e.parentElement!=null&&zH(e.parentElement,n)||e.previousSibling instanceof Element&&zH(e.previousSibling,n))&&(r=r.replace(/^ /,``)),(e.nextSibling==null&&e.parentElement!=null&&zH(e.parentElement,n)||e.nextSibling instanceof Element&&zH(e.nextSibling,n))&&(r=r.replace(/ $/,``)),r=r.replaceAll(`\xA0`,` `)}return t.insert(r)}var nU=class extends mV{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=oU(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:oU(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){rU(this.stack.undo,e),rU(this.stack.redo,e)}undo(){this.change(`undo`,`redo`)}restoreSelection(e){if(e.range)this.quill.setSelection(e.range,$.sources.USER);else{let t=aU(this.quill.scroll,e.delta);this.quill.setSelection(t,$.sources.USER)}}};function rU(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&&oU(r.range,n)},n=r.delta.transform(n),e[t].delta.length()===0&&e.splice(t,1)}}function iU(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(`
|
|
425
|
+
`)}function aU(e,t){let n=t.reduce((e,t)=>e+(t.delete||0),0),r=t.length()-n;return iU(e,t)&&--r,r}function oU(e,t){if(!e)return e;let n=t.transformPosition(e.index);return{index:n,length:t.transformPosition(e.index+e.length)-n}}var sU=class extends mV{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)}};sU.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 cU=[`insertText`,`insertReplacementText`],lU=class extends mV{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||!cU.includes(e.inputType))return;let t=e.getTargetRanges?e.getTargetRanges()[0]:null;if(!t||t.collapsed===!0)return;let n=uU(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 uU(e){return typeof e.data==`string`?e.data:e.dataTransfer?.types.includes(`text/plain`)?e.dataTransfer.getData(`text/plain`):null}var dU=/Mac/i.test(navigator.platform),fU=e=>!!(e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Home`||dU&&e.key===`a`&&e.ctrlKey===!0),pU=class extends mV{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&&fU(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":UB,"blots/block/embed":WB,"blots/break":LB,"blots/container":IV,"blots/cursor":qB,"blots/embed":gV,"blots/inline":VB,"blots/scroll":zV,"blots/text":RB,"modules/clipboard":IH,"modules/history":nU,"modules/keyboard":uH,"modules/uploader":sU,"modules/input":lU,"modules/uiNode":pU});var mU=$,hU=new class extends aB{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 UB{static blotName=`blockquote`;static tagName=`blockquote`},_U=class extends UB{static blotName=`header`;static tagName=[`H1`,`H2`,`H3`,`H4`,`H5`,`H6`];static formats(e){return this.tagName.indexOf(e.tagName)+1}},vU=class extends IV{};vU.blotName=`list-container`,vU.tagName=`OL`;var yU=class extends UB{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(vU)}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)}};yU.blotName=`list`,yU.tagName=`LI`,vU.allowedChildren=[yU],yU.requiredContainer=vU;var bU=class extends VB{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 bU{static blotName=`italic`;static tagName=[`EM`,`I`]},SU=class extends VB{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 CU(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 CU(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 wU=class extends VB{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`}},TU=class extends bU{static blotName=`strike`;static tagName=[`S`,`STRIKE`]},EU=class extends VB{static blotName=`underline`;static tagName=`U`},DU=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>`}},OU=[`alt`,`height`,`width`],kU=class extends wB{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 OU.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 CU(e,[`http`,`https`,`data`])?e:`//:0`}static value(e){return e.getAttribute(`src`)}format(e,t){OU.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}},AU=[`height`,`width`],jU=class extends WB{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 AU.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t),{})}static sanitize(e){return SU.sanitize(e)}static value(e){return e.getAttribute(`src`)}format(e,t){AU.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>`}},MU=new aB(`code-token`,`hljs`,{scope:X.INLINE}),NU=class e extends VB{static formats(e,t){for(;e!=null&&e!==t.domNode;){if(e.classList&&e.classList.contains(ZV.className))return super.formats(e,t);e=e.parentNode}}constructor(e,t,n){super(e,t,n),MU.add(this.domNode,n)}format(t,n){t===e.blotName?n?MU.add(this.domNode,n):(MU.remove(this.domNode),this.domNode.classList.remove(this.statics.className)):super.format(t,n)}optimize(){super.optimize(...arguments),MU.value(this.domNode)||this.unwrap()}};NU.blotName=`code-token`,NU.className=`ql-token`;var PU=class extends ZV{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(),NU.blotName,!1),super.replaceWith(e,t)}},FU=class extends XV{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(e,t){e===PU.blotName&&(this.forceNext=!0,this.children.forEach(n=>{n.format(e,t)}))}formatAt(e,t,n,r){n===PU.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(`
|
|
426
|
+
`)}\n`,r=PU.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(GB(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=>{[PU.blotName,NU.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?PU.formats(n.domNode):`plain`}">\n${BB(this.code(e,t))}\n</pre>`}optimize(e){if(super.optimize(e),this.parent!=null&&this.children.head!=null&&this.uiNode!=null){let e=PU.formats(this.children.head.domNode);e!==this.uiNode.value&&(this.uiNode.value=e)}}};FU.allowedChildren=[PU],PU.requiredContainer=FU,PU.allowedChildren=[NU,qB,RB,LB];var IU=(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},LU=class extends mV{static register(){$.register(NU,!0),$.register(PU,!0),$.register(FU,!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 FU))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(PU.blotName,t.value),this.quill.root.focus(),this.highlight(e,!0)}),e.uiNode??(e.attachUI(t),e.children.head&&(t.value=PU.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(FU):[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 BB(e).split(`
|
|
427
|
+
`).reduce((e,n,r)=>(r!==0&&e.insert(`
|
|
428
|
+
`,{[ZV.blotName]:t}),e.insert(n)),new Z.default);let n=this.quill.root.ownerDocument.createElement(`div`);return n.classList.add(ZV.className),n.innerHTML=IU(this.options.hljs,t,e),UH(this.quill.scroll,n,[(e,t)=>{let n=MU.value(e);return n?t.compose(new Z.default().retain(t.length(),{[NU.blotName]:n})):t}],[(e,n)=>e.data.split(`
|
|
429
|
+
`).reduce((e,n,r)=>(r!==0&&e.insert(`
|
|
430
|
+
`,{[ZV.blotName]:t}),e.insert(n)),n)],new WeakMap)}};LU.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 RU=class e extends UB{static blotName=`table`;static tagName=`TD`;static create(e){let t=super.create();return e?t.setAttribute(`data-row`,e):t.setAttribute(`data-row`,HU()),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()}},zU=class extends IV{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}},BU=class extends IV{static blotName=`table-body`;static tagName=`TBODY`},VU=class extends IV{static blotName=`table-container`;static tagName=`TABLE`;balanceCells(){let e=this.descendants(zU),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=RU.formats(e.children.head.domNode));let n=this.scroll.create(RU.blotName,t);e.appendChild(n),n.optimize()})})}cells(e){return this.rows().map(t=>t.children.at(e))}deleteColumn(e){let[t]=this.descendant(BU);t!=null&&t.children.head!=null&&t.children.forEach(t=>{t.children.at(e)?.remove()})}insertColumn(e){let[t]=this.descendant(BU);t!=null&&t.children.head!=null&&t.children.forEach(t=>{let n=t.children.at(e),r=RU.formats(t.children.head.domNode),i=this.scroll.create(RU.blotName,r);t.insertBefore(i,n)})}insertRow(e){let[t]=this.descendant(BU);if(t==null||t.children.head==null)return;let n=HU(),r=this.scroll.create(zU.blotName);t.children.head.children.forEach(()=>{let e=this.scroll.create(RU.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)}};VU.allowedChildren=[BU],BU.requiredContainer=VU,BU.allowedChildren=[zU],zU.requiredContainer=BU,zU.allowedChildren=[RU],RU.requiredContainer=zU;function HU(){return`row-${Math.random().toString(36).slice(2,6)}`}var UU=class extends mV{static register(){$.register(RU),$.register(zU),$.register(BU),$.register(VU)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(VU).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!==RU.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(`
|
|
431
|
+
`).join(``);return e.insert(n,{table:HU()})},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)})}},WU=$B(`quill:toolbar`),GU=class extends mV{constructor(e,t){if(super(e,t),Array.isArray(this.options.container)){let t=document.createElement(`div`);t.setAttribute(`role`,`toolbar`),qU(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)){WU.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){WU.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 wB){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())}})}};GU.DEFAULTS={};function KU(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 qU(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`)KU(n,e);else{let t=Object.keys(e)[0],r=e[t];Array.isArray(r)?JU(n,t,r):KU(n,t,r)}}),e.appendChild(n)})}function JU(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)}GU.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 YU=`<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>`,XU=`<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>`,ZU=`<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>`,QU=`<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>`,$U=`<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>`,eW=`<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>`,tW=`<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>`,nW=`<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>`,rW=`<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>`,iW={align:{"":YU,center:XU,right:ZU,justify:QU},background:$U,blockquote:eW,bold:tW,clean:nW,code:rW,"code-block":rW,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>`},aW=`<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>`,oW=0;function sW(e,t){e.setAttribute(t,`${e.getAttribute(t)!==`true`}`)}var cW=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`),sW(this.label,`aria-expanded`),sW(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=aW,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-${oW}`,oW+=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)}},lW=class extends cW{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)}},uW=class extends cW{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}}},dW=e=>{let{overflowY:t}=getComputedStyle(e,null);return t!==`visible`&&t!==`clip`},fW=class{constructor(e,t){this.quill=e,this.boundsContainer=t||document.body,this.root=e.addContainer(`ql-tooltip`),this.root.innerHTML=this.constructor.TEMPLATE,dW(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`)}},pW=[!1,`center`,`right`,`justify`],mW=`#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(`.`),hW=[!1,`serif`,`monospace`],gW=[`1`,`2`,`3`,!1],_W=[`small`,!1,`large`,`huge`],vW=class extends vV{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,pW),typeof t.align==`object`))return new uW(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,mW,n===`background`?`#ffffff`:`#000000`),new lW(e,t[n])}return e.querySelector(`option`)??(e.classList.contains(`ql-font`)?xW(e,hW):e.classList.contains(`ql-header`)?xW(e,gW):e.classList.contains(`ql-size`)&&xW(e,_W)),new cW(e)}),this.quill.on(Q.events.EDITOR_CHANGE,()=>{this.pickers.forEach(e=>{e.update()})})}};vW.DEFAULTS=Qz({},vV.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 yW=class extends fW{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=bW(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 bW(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 SW=[[`bold`,`italic`,`link`],[{header:1},{header:2},`blockquote`]],CW=class extends yW{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 nV(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}},wW=class extends vW{constructor(e,t){t.modules.toolbar!=null&&t.modules.toolbar.container==null&&(t.modules.toolbar.container=SW),super(e,t),this.quill.container.classList.add(`ql-bubble`)}extendToolbar(e){this.tooltip=new CW(this.quill,this.options.bounds),e.container!=null&&(this.tooltip.root.appendChild(e.container),this.buildButtons(e.container.querySelectorAll(`button`),iW),this.buildPickers(e.container.querySelectorAll(`select`),iW))}};wW.DEFAULTS=Qz({},vW.DEFAULTS,{modules:{toolbar:{handlers:{link(e){e?this.quill.theme.tooltip.edit():this.quill.format(`link`,!1,$.sources.USER)}}}}});var TW=[[{header:[`1`,`2`,`3`,!1]}],[`bold`,`italic`,`underline`,`link`],[{list:`ordered`},{list:`bullet`}],[`clean`]],EW=class extends yW{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(SU,e.index);if(t!=null){this.linkRange=new nV(e.index-n,t.length());let r=SU.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`)}},DW=class extends vW{constructor(e,t){t.modules.toolbar!=null&&t.modules.toolbar.container==null&&(t.modules.toolbar.container=TW),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`),iW),this.buildPickers(e.container.querySelectorAll(`select`),iW),this.tooltip=new EW(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)}))}};DW.DEFAULTS=Qz({},vW.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)}}}}}),mU.register({"attributors/attribute/direction":eH,"attributors/class/align":UV,"attributors/class/background":JV,"attributors/class/color":KV,"attributors/class/direction":tH,"attributors/class/font":iH,"attributors/class/size":oH,"attributors/style/align":WV,"attributors/style/background":YV,"attributors/style/color":qV,"attributors/style/direction":nH,"attributors/style/font":aH,"attributors/style/size":sH},!0),mU.register({"formats/align":UV,"formats/direction":tH,"formats/indent":hU,"formats/background":YV,"formats/color":qV,"formats/font":iH,"formats/size":oH,"formats/blockquote":gU,"formats/code-block":ZV,"formats/header":_U,"formats/list":yU,"formats/bold":bU,"formats/code":QV,"formats/italic":xU,"formats/link":SU,"formats/script":wU,"formats/strike":TU,"formats/underline":EU,"formats/formula":DU,"formats/image":kU,"formats/video":jU,"modules/syntax":LU,"modules/table":UU,"modules/toolbar":GU,"themes/bubble":wW,"themes/snow":DW,"ui/icons":iW,"ui/picker":cW,"ui/icon-picker":uW,"ui/color-picker":lW,"ui/tooltip":fW},!0);var OW=mU,kW=!1,AW=[`background-image`,`background-size`,`-webkit-background-clip`,`background-clip`,`-webkit-text-fill-color`,`color`];function jW(){if(kW)return;kW=!0;let e=OW.import(`attributors/style/size`),t=OW.import(`attributors/style/font`);e&&(delete e.whitelist,OW.register(e,!0)),t&&(delete t.whitelist,t.add=(e,t)=>(e.style.fontFamily=Cb(t),!0),t.value=e=>Nb(e.style.fontFamily)||``,OW.register(t,!0));let n=OW.import(`parchment`);if(n?.StyleAttributor&&n?.Scope){let e=new n.StyleAttributor(`font-weight`,`font-weight`,{scope:n.Scope.INLINE});OW.register(e,!0),OW.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`,bC(t))}catch{}return!0}remove(e){for(let t of AW)e.style.removeProperty(t)}value(e){return xM(e)?e.style.getPropertyValue(`background-image`):``}}return new t(`gradient`,`background-image`,{scope:e.Scope.INLINE})}(n),!0);let t=OW.import(`attributors/style/color`);if(t){let e=t.value.bind(t);t.value=t=>xM(t)?``:e(t),OW.register(t,!0)}}}var MW=[`fontSize`,`fontFamily`,`fill`,`fontWeight`,`fontStyle`,`textDecoration`],NW=Zt({active:null},{},{deep:!1});function PW(){return NW.active}function FW(e){mr(()=>{NW.active=Object.assign(Object.assign({},e),{currentFormat:{},mixedFormats:{},lastSelection:null})})}function IW(e,t,n){mr(()=>{NW.active&&=Object.assign(Object.assign({},NW.active),{currentFormat:e,mixedFormats:t,lastSelection:n||NW.active.lastSelection})})}function LW(e){mr(()=>{e&&NW.active?.instance!==e||(NW.active=null)})}var RW={fontSize:[`size`],fontFamily:[`font`],fill:[`color`,`gradient`],fontWeight:[`font-weight`],fontStyle:[`italic`],textDecoration:[`underline`,`strike`]},zW=Array.from(new Set(MW.flatMap(e=>RW[e]))),BW={data:``},VW=e=>typeof window==`object`?((e?e.querySelector(`#_goober`):window._goober)||Object.assign((e||document.head).appendChild(document.createElement(`style`)),{innerHTML:` `,id:`_goober`})).firstChild:e||BW,HW=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,UW=/\/\*[^]*?\*\/|\s\s+|\n/g,WW=(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`?WW(o,a):a+`{`+WW(o,a[1]==`k`?``:t)+`}`:typeof o==`object`?r+=WW(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+=WW.p?WW.p(a,o):a+`:`+o+`;`)}return n+(t&&i?t+`{`+i+`}`:i)+r},GW={},KW=e=>{if(typeof e==`object`){let t=``;for(let n in e)t+=n+KW(e[n]);return t}return e},qW=(e,t,n,r,i)=>{let a=KW(e),o=GW[a]||(GW[a]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return`go`+n})(a));if(!GW[o]){let t=a===e?(e=>{let t,n=[{}];for(;t=HW.exec(e.replace(UW,``));)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;GW[o]=WW(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)})(GW[o],t,r),o};function JW(e){let t=this||{},n=e.call?e(t.p):e;return qW(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?``:WW(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,VW(t.target),t.g,t.o,t.k)}var YW,XW,ZW;JW.bind({g:1}),JW.bind({k:1});function QW(e,t,n,r){WW.p=t,YW=e,XW=n,ZW=r}function $W(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:XW&&XW()},s),n.o=/ *go\d+/.test(c),s.className=JW.apply(n,r)+(c?` `+c:``),t&&(s.ref=o);let l=e;return e[0]&&(l=s.as||e,delete s.as),ZW&&l[0]&&ZW(s),YW(l,s)}return t?t(i):i}}QW(k.createElement,void 0,void 0,void 0);var eG=e=>$W(e,k.forwardRef),tG=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},nG=Zt({enabled:!1,currentFormat:{},pendingToolbarInteraction:!1,editor:Zt.object({instance:null},{},{deep:!1})}),rG=zW;function iG(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 rG)CM(r,e)&&(n[e]=!0);return n}(e,t);mr(()=>{nG.currentFormat=n}),IW(n,r,t)}var aG=`polotno-saved-selection`;function oG(){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(aG,new Highlight(t)),cG()}function sG(){typeof CSS<`u`&&CSS.highlights&&CSS.highlights.delete(aG)}function cG(){setTimeout(()=>{typeof CSS<`u`&&CSS.highlights&&CSS.highlights.has(aG)&&(document.querySelector(`.polotno-portal`)||bG(document.activeElement)?cG():sG())},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(${aG}) { background-color: Highlight; }`,document.head.appendChild(e)}var lG=null;function uG(e,t){e.type===`text`&&t.push(e);for(let n of e.children||[])uG(n,t)}function dG(e){let t=e.fontSize;if(!t||t<=0)return null;let n=Cb(e.fontFamily),r=Ib(e.fontWeight)?700:400,i=e.fontStyle===`italic`?`italic`:`normal`,a=lG??=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=pO(`<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=_A({html:l,width:Math.max(12*t,600)})}catch{return null}let d=[];uG(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-XT(m,m*s,m*c),bulletFontSize:m,numberGap:p?Math.max(0,h-p.x-(p.width??0)):0}}var fG=eG(`div`,k.forwardRef)`
|
|
432
|
+
.ql-editor {
|
|
433
|
+
outline: none;
|
|
434
|
+
/* anchor for the absolutely-positioned ::before placeholder below */
|
|
435
|
+
position: relative;
|
|
436
|
+
/* Element-level underline/strike — text-decoration doesn't inherit, so it is
|
|
437
|
+
applied here on the editable root (mirrors the static getHtml render). */
|
|
438
|
+
text-decoration: var(--polotno-text-decoration, none);
|
|
439
|
+
/* Chrome would otherwise break the underline at every descender; the
|
|
440
|
+
canvas draws one solid band. Mirrors getHtml (@polotno/core). */
|
|
441
|
+
text-decoration-skip-ink: none;
|
|
442
|
+
}
|
|
443
|
+
/* Placeholder for an empty editor. Quill toggles ql-blank + data-placeholder
|
|
444
|
+
but its core stylesheet (which paints it) is not loaded — do it here. Same
|
|
445
|
+
0.6 dim as the canvas render and the legacy textarea ::placeholder. */
|
|
446
|
+
.ql-editor.ql-blank::before {
|
|
447
|
+
content: attr(data-placeholder);
|
|
448
|
+
position: absolute;
|
|
449
|
+
inset-inline: 0;
|
|
450
|
+
top: 0;
|
|
451
|
+
opacity: 0.6;
|
|
452
|
+
pointer-events: none;
|
|
453
|
+
}
|
|
454
|
+
.ql-clipboard {
|
|
455
|
+
pointer-events: none;
|
|
456
|
+
opacity: 0;
|
|
457
|
+
}
|
|
458
|
+
${uO}
|
|
459
|
+
|
|
460
|
+
/* ===== Editor-only list markers (Quill flat-DOM hack) ======================
|
|
461
|
+
Quill emits a FLAT <ol> with per-item data-list + ql-indent classes (not
|
|
462
|
+
real nested <ul>/<ol>), so the browser's native markers can't render mixed
|
|
463
|
+
bullet/number items or nested numbering. The editor therefore disables
|
|
464
|
+
native markers and draws its own via ::before — but ONLY here, so it can't
|
|
465
|
+
leak into the export/canvas paths (which use native markers; see
|
|
466
|
+
reset-style.ts). These are tuned to match render-tag (the canvas
|
|
467
|
+
reference): marker sized at the item font, sitting just left of the text
|
|
468
|
+
inside the 2.1em indent. letter-spacing is intentionally NOT reset to
|
|
469
|
+
normal — numbered markers track it, like render-tag/native/Canva. */
|
|
470
|
+
.ql-editor ul,
|
|
471
|
+
.ql-editor ol {
|
|
472
|
+
list-style: none;
|
|
473
|
+
/* Editor box model is the inverse of the shared reset: the indent lives on
|
|
474
|
+
the <li> (not the list) so the absolutely-positioned ::before marker
|
|
475
|
+
below has room in the li's start-padding. (The export/canvas path puts
|
|
476
|
+
the indent on the list for native outside markers — see reset-style.ts.) */
|
|
477
|
+
padding-inline-start: 0;
|
|
478
|
+
}
|
|
479
|
+
.ql-editor .ql-ui {
|
|
480
|
+
display: none;
|
|
481
|
+
}
|
|
482
|
+
/* Per-LEVEL ordered counters (list-0..list-3), so a nested ordered list
|
|
483
|
+
restarts at 1 — matching canonical HTML and the canvas. Quill's flat DOM
|
|
484
|
+
expresses depth via ql-indent-N, so each ordered item increments its
|
|
485
|
+
level's counter and RESETS all deeper levels (counter-reset applies before
|
|
486
|
+
counter-increment on the same element). A single global counter would make
|
|
487
|
+
a nested "deep" item continue the outer numbering (e.g. show 3 instead of
|
|
488
|
+
1). All levels use decimal to match render-tag (which doesn't cycle
|
|
489
|
+
styles). Custom counter names avoid Safari's list-item counter bug. */
|
|
490
|
+
.ql-editor ol {
|
|
491
|
+
counter-reset: list-0 list-1 list-2 list-3;
|
|
492
|
+
}
|
|
493
|
+
.ql-editor li {
|
|
494
|
+
position: relative; /* anchor for the absolutely-positioned ::before */
|
|
495
|
+
padding-inline-start: 2.1em; /* marker space + per-level indent (start side) */
|
|
496
|
+
}
|
|
497
|
+
.ql-editor li[data-list='ordered'] {
|
|
498
|
+
counter-increment: list-0;
|
|
499
|
+
counter-reset: list-1 list-2 list-3;
|
|
500
|
+
}
|
|
501
|
+
.ql-editor li.ql-indent-1[data-list='ordered'] {
|
|
502
|
+
counter-increment: list-1;
|
|
503
|
+
counter-reset: list-2 list-3;
|
|
504
|
+
}
|
|
505
|
+
.ql-editor li.ql-indent-2[data-list='ordered'] {
|
|
506
|
+
counter-increment: list-2;
|
|
507
|
+
counter-reset: list-3;
|
|
508
|
+
}
|
|
509
|
+
.ql-editor li.ql-indent-3[data-list='ordered'] {
|
|
510
|
+
counter-increment: list-3;
|
|
511
|
+
}
|
|
512
|
+
/* Marker box spans the 2.1em indent and right-aligns the marker against the
|
|
513
|
+
text with a gap, so the marker's right edge ≈ render-tag's
|
|
514
|
+
(contentStart − gap). line-height is inherited so the marker sits on the
|
|
515
|
+
item's first-line baseline (matches render-tag's number baseline; bullets
|
|
516
|
+
are close). */
|
|
517
|
+
.ql-editor li::before {
|
|
518
|
+
position: absolute;
|
|
519
|
+
inset-inline-start: 0;
|
|
520
|
+
top: 0;
|
|
521
|
+
box-sizing: border-box;
|
|
522
|
+
width: 2.1em;
|
|
523
|
+
text-align: end;
|
|
524
|
+
font-weight: normal;
|
|
525
|
+
font-style: normal;
|
|
526
|
+
}
|
|
527
|
+
.ql-editor li[data-list='ordered']::before {
|
|
528
|
+
content: counter(list-0) '.';
|
|
529
|
+
/* Exact render-tag number gap (space-width) computed per element; 0.32em
|
|
530
|
+
fallback until the vars are set (or on layout failure). */
|
|
531
|
+
padding-inline-end: var(--rt-number-gap, 0.32em);
|
|
532
|
+
}
|
|
533
|
+
.ql-editor li.ql-indent-1[data-list='ordered']::before {
|
|
534
|
+
content: counter(list-1) '.';
|
|
535
|
+
}
|
|
536
|
+
.ql-editor li.ql-indent-2[data-list='ordered']::before {
|
|
537
|
+
content: counter(list-2) '.';
|
|
538
|
+
}
|
|
539
|
+
.ql-editor li.ql-indent-3[data-list='ordered']::before {
|
|
540
|
+
content: counter(list-3) '.';
|
|
541
|
+
}
|
|
542
|
+
.ql-editor li[data-list='bullet']::before {
|
|
543
|
+
content: '•';
|
|
544
|
+
padding-inline-end: 0.5em; /* fallback gap (RTL, or before vars are set) */
|
|
545
|
+
}
|
|
546
|
+
/* LTR: pixel-match render-tag's synthetic disc. The canvas scales the '•'
|
|
547
|
+
glyph to ink-diameter ascent/3 and pins its ink-right edge / vertical
|
|
548
|
+
center; computeMarkerVars asks render-tag for the exact numbers and sets
|
|
549
|
+
them here. Gated on .rt-marker-geom (LTR + vars computed) so RTL and the
|
|
550
|
+
pre-measure frame keep the box+text-align fallback above. */
|
|
551
|
+
&.rt-marker-geom .ql-editor li[data-list='bullet']::before {
|
|
552
|
+
inset-inline-start: var(--rt-bullet-left);
|
|
553
|
+
top: var(--rt-bullet-top);
|
|
554
|
+
font-size: var(--rt-bullet-fs);
|
|
555
|
+
line-height: 1;
|
|
556
|
+
width: auto;
|
|
557
|
+
padding-inline-end: 0;
|
|
558
|
+
text-align: left;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
strong {
|
|
562
|
+
font-weight: 700;
|
|
563
|
+
}
|
|
564
|
+
.ql-direction-rtl {
|
|
565
|
+
direction: rtl;
|
|
566
|
+
}
|
|
567
|
+
/* Apply gradient fill to all text-bearing elements when --polotno-gradient is set */
|
|
568
|
+
&[style*='--polotno-gradient'] .ql-editor,
|
|
569
|
+
&[style*='--polotno-gradient'] .ql-editor p,
|
|
570
|
+
&[style*='--polotno-gradient'] .ql-editor li,
|
|
571
|
+
&[style*='--polotno-gradient'] .ql-editor li::before {
|
|
572
|
+
background-image: var(--polotno-gradient);
|
|
573
|
+
background-size: 100% 100%;
|
|
574
|
+
background-repeat: repeat;
|
|
575
|
+
-webkit-background-clip: text;
|
|
576
|
+
-moz-background-clip: text;
|
|
577
|
+
background-clip: text;
|
|
578
|
+
-webkit-text-fill-color: transparent;
|
|
579
|
+
color: transparent;
|
|
580
|
+
}
|
|
581
|
+
/* A span carrying its own solid color must win over the gradient: the
|
|
582
|
+
transparent -webkit-text-fill-color above is INHERITED, so without this
|
|
583
|
+
the span paints the clipped gradient instead of its chosen color
|
|
584
|
+
(mirrors getHtml's markInlineColorsForClip on the canvas side). */
|
|
585
|
+
&[style*='--polotno-gradient'] .ql-editor [style*='color:'] {
|
|
586
|
+
-webkit-text-fill-color: currentColor;
|
|
587
|
+
}
|
|
588
|
+
`,pG=[`background`,`font-weight`,`color`,`gradient`,`font`,`italic`,`size`,`script`,`strike`,`underline`,`indent`,`list`,`direction`],mG=!1;function hG(){mG||(mG=!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 _G=(e,t)=>{jW();let n=new OW(e,{toolbar:!1,keyboard:!1,placeholder:t?.placeholder||void 0,clipboard:{matchVisual:!1},formats:pG});(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`?(hG(),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){hG();let{bold:a}=r,o=tG(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`?(hG(),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=Ib(t[`font-weight`])),t}})(n);let r=OW.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},vG=(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()},yG=({onBlur:e,onChange:t,element:n,clickCoords:r})=>{let i=k.useRef(null),a=k.useRef(!1);k.useLayoutEffect(()=>{let o,s=!1,c=null,l=null,u=null,d=null,f=null,p=()=>{if(!s&&i.current)try{o=_G(i.current,{placeholder:JM(n.placeholder)}),mr(()=>{nG.editor.instance=o}),nG.pendingToolbarInteraction=!1,window.__polotnoQuill=o,FW({instance:o,store:n.store,element:n});let s=e=>{e&&iG(o,e)};o.on(`text-change`,()=>{let e=PW(),r=e&&e.instance===o?e.lastSelection:null;s(o.getSelection()||r),setTimeout(()=>{let e=o.root;if(!e||!e.isConnected||!Zh(n))return;let r=e.innerHTML;a.current=!0,t(vM(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===`
|
|
589
|
+
`)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=IO(n,n.fontFamily);vG(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`)||(bG(n)||nG.pendingToolbarInteraction?oG():setTimeout(()=>{nG.pendingToolbarInteraction||bG(document.activeElement)?oG():(sG(),e())},0))},f=()=>{sG()},_.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),sG(),c&&l&&u&&(c.removeEventListener(`copy`,l),c.removeEventListener(`cut`,u)),mr(()=>{nG.editor.instance=null,nG.currentFormat={}}),LW(o),delete window.__polotnoQuill}},[]),k.useEffect(()=>pM(n,()=>`${n.text}\0${n.fontSize}\0${n.fontFamily}`,()=>{let e=nG.editor.instance;if(!e)return;if(a.current){a.current=!1;return}let t=e.getSelection();vG(e,IO(n,n.fontFamily)),a.current=!0,t&&(e.setSelection(t.index,t.length),iG(e,e.getSelection()))},{fireImmediately:!0}),[]),k.useEffect(()=>pM(n,()=>`${n.fontFamily}\0${n.fontSize}\0${n.fontWeight}\0${n.fontStyle}\0${n.lineHeight}\0${n.letterSpacing}\0${vO(ax(n.text))}`,()=>{let e=i.current;if(!e)return;let t=vO(ax(n.text))===`ltr`,r=dG(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}),[]),k.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)||bG(r)||nG.pendingToolbarInteraction||(sG(),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 ${bC(n.stroke)}`,o.paintOrder=`stroke fill`);let s=gC(n.fill)?bC(n.fill):qM(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,j.jsx)(fG,{ref:i,style:Object.assign(Object.assign({},o),{fontSize:n.fontSize,fontFamily:Cb(n.fontFamily),fontWeight:n.fontWeight,fontStyle:n.fontStyle,"--polotno-text-decoration":n.textDecoration||`none`,textTransform:n.textTransform,width:n.a.width,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 ${YC(n.shadowColor,n.shadowOpacity??1)}`:void 0,caretColor:s}),dir:vO(ax(n.text))})};function bG(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=OW.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 SG(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 CG=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),wG=navigator.userAgent.includes(`Firefox`),TG=B(({element:e,store:t})=>{let{textOverflowIndicatorStyle:n}=yh(),r=k.useRef(null),[i,a]=k.useState(),[o,c]=k.useState(!1),[l,u]=k.useState(!1),d=k.useRef(e.height),f=e.isSelected,p=rN(f),m=e.fontSize/3,{textVerticalResizeEnabled:h}=Oy,g=Oy.autoDeleteEmptyText,_=rN(e.fontFamily),v=k.useMemo(()=>qb(e.text,{fontSize:e.fontSize,fontFamily:e.fontFamily}),[e.text,e.fontSize,e.fontFamily]),[y]=tN(t,k.useMemo(()=>[...new Set([e.fontFamily,...Jb(v)])].filter(Boolean),[e.fontFamily,v]),e.fontStyle,e.fontWeight,e.text||e.placeholder),b=e._editModeEnabled;ib(r);let x=y?e.fontFamily:_===e.fontFamily?`Arial`:_,S=mM(e).fill,C=LO(e,{fontFamily:x,color:S,textOverflow:Oy.textOverflow}),w=k.useRef([]),T=k.useRef(!0),[,E]=k.useReducer(e=>e+1,0);k.useEffect(()=>{let e=w.current;e.length>0&&(w.current=[],e.forEach(e=>e()))}),k.useEffect(()=>()=>{T.current=!1;let e=w.current;e.length>0&&(w.current=[],e.forEach(e=>e()))},[]);let{width:D,height:O}=function(e,t,n){return k.useMemo(()=>Uk(e),[e,t.width,n])}(C,e,y);k.useEffect(()=>{if(!y)return;let n=(n,r,i,a)=>{let o=fb(`text ${e.id}`),s=()=>{t.history.ignore(n,r,i).then(()=>{T.current?(w.current.push(o),E()):o()})};a?queueMicrotask(s):s()};if(e.curveEnabled&&Math.abs(D-e.width)>1&&!o&&n(()=>{if(Zh(e)&&Math.abs(D-e.width)>1){let t=e.x+e.width/2;e.set({width:D,x:t-D/2})}},!1,!0),!ex(e)){n(()=>{Zh(e)&&(ex(e)||e.set({height:O}))},void 0,void 0,!0);return}let{textOverflow:r}=Oy;if(r!==`change-font-size`||o||b||e.curveEnabled)r===`resize`&&(h&&e.height<O&&!o&&n(()=>{Zh(e)&&e.set({height:O})},!1,!0),h||e.height===O||o||n(()=>{Zh(e)&&e.set({height:O})},!1,!0));else{let t=ZN(e,{fontFamily:e.fontFamily,textOverflow:Oy.textOverflow});t.fontSize===e.fontSize?e.height!==O&&(h&&e.height<O?n(()=>{Zh(e)&&e.set({height:O})},!1,!0):h||n(()=>{Zh(e)&&e.set({height:O})},!1,!0)):n(()=>{if(!Zh(e))return;let n=MM(e,t.fontSize);t.text!==void 0&&t.text!==e.text&&(n.text=t.text),e.set(n)},!1,!0)}});let ee=k.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 XN(t),e.lastArgs=Object.assign({},t)),e.lastResult;var n,r}},[]),A=k.useRef(0),M=k.useRef(null);k.useEffect(()=>{o||b||(async()=>{A.current++;let n=A.current,r=fb(`text ${e.id} ${n}`);M.current&&M.current(),M.current=r,u(!0);let i=null,o=CG?5:1;for(let r=0;r<o;r++){let a=r>0?ee:XN;try{if(i=await a({skipCache:r>0,html:C,width:D||e.width||1,height:ix(e,O)||1,fontFamily:x,fontFamilies:Jb(C),resolveFont:e=>t.fonts.find(t=>t.fontFamily===e)||Gx.find(t=>t.fontFamily===e),padding:m,pixelRatio:t._elementsPixelRatio,font:t.fonts.find(e=>e.fontFamily===x)||Gx.find(e=>e.fontFamily===x)}),n!==A.current)return;if((CG||wG)&&i&&SG(i)){await new Promise(e=>setTimeout(e,50*(r+1)));continue}break}catch(t){console.error(t),_b(`Error rendering rich text with id ${e.id}`);break}}i?a(i):r?(r(),r=null):console.error(`Finish function is called twice!`),u(!1)})()},[C,o,O,b,x,e.height,t._elementsPixelRatio,y]);let[te,N]=sN(l,300),[P]=sN(o,300,!0),F=P||te;k.useEffect(()=>{var t;if(!F)return fM(e,()=>{let t=r.current;HM(t,e)});(t=r.current)==null||t.clearCache()},[i,F,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]),k.useEffect(()=>{i&&!l&&M.current&&(M.current(),M.current=null)},[i,l]),k.useLayoutEffect(()=>{if(!y||!e.curveEnabled)return;let t=new s.TextPath({data:xO(e.a.width,e.a.height,e.curvePower,e.a.fontSize),text:ax(e.text),letterSpacing:e.letterSpacing*e.a.fontSize,fontSize:e.a.fontSize,fontFamily:Cb(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(()=>{Zh(e)&&e.set({width:n,x:e.a.x+i,y:e.a.y+a})})}t.destroy()},[y,e.curveEnabled,e.curvePower,e.text,e.fontSize,e.fontFamily,e.fontWeight,e.fontStyle,e.letterSpacing]),k.useEffect(()=>()=>{M.current&&M.current()},[]),k.useEffect(()=>{p&&!f&&g&&ax(e.text)===``&&e.removable&&!JM(e.placeholder)&&t.deleteElements([e.id])},[g,e.placeholder,e.removable,e.text,f,p]);let ne=ix(e,O),re=0;e.verticalAlign===`middle`&&(re=(ne-O)/2),e.verticalAlign===`bottom`&&(re=ne-O);let ie=nN({fontLoaded:y,fontFamily:e.fontFamily,fontSize:e.fontSize,lineHeight:e.lineHeight}),I=e.backgroundPadding*(e.fontSize*ie*.5),ae=e.backgroundCornerRadius*(e.fontSize*ie*.5),oe=k.useMemo(()=>{if(!e.backgroundEnabled||e.curveEnabled||e.legacyBackground)return``;let t=Gk(C);return t.length===0?``:Rk({rects:t.map(e=>({left:e.left+m,right:e.right+m,top:e.top+m,bottom:e.bottom+m})),padding:I,cornerRadius:ae})},[e.backgroundEnabled,e.curveEnabled,e.legacyBackground,C,y,I,ae,m]),se=UM(),ce=xO(e.a.width,O,e.curvePower,e.fontSize),le=k.useRef(null),L=k.useRef(e.width),ue=k.useRef(``),de=k.useRef(0),fe=k.useRef(0),pe=k.useRef(null),me=b&&e.strokeWidth>0&&!e.curveEnabled,he=D>0?(e.a.width+2*m)/(D+2*m):1;return(0,j.jsxs)(j.Fragment,{children:[e.curveEnabled||e.legacyBackground?(0,j.jsx)(Vm,{x:e.a.x,y:e.a.y,offsetX:I/he,offsetY:I/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*I,height:ne+2*I,cornerRadius:ae}):(0,j.jsx)(qm,{name:`html-background`,x:e.a.x,y:e.a.y,offsetX:m/he,offsetY:(m-re)/he,rotation:e.a.rotation,scaleX:he,scaleY:he,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled&&oe.length>0,opacity:e.backgroundOpacity*e.a.opacity,fill:e.backgroundColor,data:oe}),(0,j.jsx)(qm,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,data:ce,stroke:n.stroke,strokeWidth:1,visible:!1}),(0,j.jsx)(Vm,{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:!F,draggable:se?e.draggable&&f:e.draggable,preventDefault:!se||f,opacity:b?0:e.a.opacity,hideInExport:!e.showInExport,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},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=>{c(!0),d.current=e.height,L.current=e.width,le.current=t.target.position(),ue.current=EM(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=OM(L.current,e.fontSize),a=r;r<i&&(a=i,le.current&&n.position(le.current)),n.width(a),n.scaleX(1),n.scaleY(1);let o=Uk(LO(Object.assign(Object.assign({},e.toJSON()),{width:a}),{fontFamily:x,color:S,textOverflow:Oy.textOverflow})).height,s=Oy.textVerticalResizeEnabled?Math.max(o,d.current):o;n.height(s),e.set({width:n.width(),height:s,x:n.x(),y:n.y()})}else if(a){let t=Oy.textOverflow===`resize`,r=typeof e.lineHeight==`number`?e.lineHeight:1,i=t?O:r*e.fontSize,a=n.height()*n.scaleY();if(a<i){if(n.height(i),le.current){if(ue.current===`top-center`){let e=de.current*Math.PI/180,t=fe.current-i;n.x(le.current.x-t*Math.sin(e)),n.y(le.current.y+t*Math.cos(e))}else n.position(le.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:Yb(e.text,o)});le.current=t.target.position()},onTransformEnd:t=>{c(!1),u(!0);let n=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set(Object.assign(Object.assign({},NM(e,e.fontSize*n)),{width:t.target.width()*n,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),text:Yb(e.text,n)}))}}),(0,j.jsx)(Wm,{ref:r,image:i,x:e.a.x,y:e.a.y,offsetX:m,offsetY:m-re,listening:!1,rotation:e.a.rotation,width:e.a.width+2*m,height:(e.a.width+2*m)*((i?.height??0)/(i?.width||1)||1),visible:!F&&!b,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||F}),(F&&!b||me)&&(0,j.jsx)(`Group`,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,offsetY:-re,children:(0,j.jsx)(uM,{divProps:{style:{pointerEvents:`none`}},children:(0,j.jsx)(fG,{dangerouslySetInnerHTML:{__html:C},style:{pointerEvents:`none`,opacity:e.a.opacity,textShadow:e.shadowEnabled?`${e.shadowOffsetX}px ${e.shadowOffsetY}px ${e.shadowBlur}px ${YC(e.shadowColor,e.shadowOpacity??1)}`:void 0}})})}),b&&(0,j.jsx)(`Group`,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,offsetY:-re,children:(0,j.jsx)(uM,{divProps:{style:{zIndex:20}},children:(0,j.jsx)(yG,{element:e,onChange:t=>{let n=WM({oldText:ax(e.text),newText:ax(t),element:e});e.set(Object.assign({text:t},MM(e,n)))},onBlur:t=>{Zh(e)&&(e.set(PM(e)),e.toggleEditMode(!1),N(!0))},clickCoords:pe.current})})})]})}),EG=(e,t,n)=>{let[,r]=k.useReducer(e=>e+1,0),i=t.map(e=>`${e.family}\0${e.style}\0${e.weight}`).join(`|`),a=e=>e.every(e=>tS(e.family,e.style,e.weight)),o=k.useRef(a(t)),s=k.useRef(null);return k.useLayoutEffect(()=>{if(o.current=a(t),o.current)return;let c=!0;return(async()=>{o.current=!1,r();let a=fb(`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]),k.useEffect(()=>{o.current&&setTimeout(()=>{s.current&&=(s.current(),null)})},[o.current]),[o.current]},DG=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 OG(e,t){return e!==t&&(!Oy.textVerticalResizeEnabled||e<t)}var kG=B(({element:e,store:t})=>{let n=k.useRef(null),r=k.useRef(null),[i,a]=k.useState(!1),o=k.useRef(e.height),s=e.isSelected,c=rN(s),{textVerticalResizeEnabled:l}=Oy,u=Oy.autoDeleteEmptyText,d=rN(e.fontFamily),f=k.useMemo(()=>qb(e.text,{fontSize:e.fontSize,fontFamily:e.fontFamily}),[e.text,e.fontSize,e.fontFamily]),[p]=EG(t,k.useMemo(()=>bM(f,{fontFamily:e.fontFamily,fontWeight:e.fontWeight,fontStyle:e.fontStyle}),[f,e.fontFamily,e.fontWeight,e.fontStyle]),e.text||e.placeholder),m=e._editModeEnabled;ib(n);let h=p?e.fontFamily:d&&d!==e.fontFamily?d:`Arial`,g=mM(e).fill,_=gC(e.fill),v=gC(e.stroke)&&!!e.strokeWidth,y=!!e.strokeWidth&&(v||_),b=Oy.textOverflow===`ellipsis`&&!e.curveEnabled&&ex(e)&&!y,x=JM(e.placeholder),S=!!x&&!ax(e.text),C=S?mO(x):f,w=S?.6:e.a.opacity,T=LO(e,{fontFamily:h,color:g,forEditor:!b,textOverflow:Oy.textOverflow,text:C,textIsNormalized:!0}),E=e.width||1,D=e.curveEnabled,O=function(e,t,n,r){return k.useMemo(()=>{if(r)return null;try{return _A({html:pO(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,D),ee=function(e,t,n){return k.useMemo(()=>{if(!t.curveEnabled)return null;let n=xO(t.width||1,AO(t),t.curvePower,t.fontSize);try{return WD({html:pO(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),A=nN({fontLoaded:p,fontFamily:e.fontFamily,fontSize:e.fontSize,lineHeight:e.lineHeight}),M=D?0:Math.max(O?.height??0,e.fontSize*A),te=ee?ee.bounds:null,N=k.useMemo(()=>O?O.lines.map(e=>({left:e.bounds.x,right:e.bounds.x+e.bounds.width,top:e.bounds.y,bottom:e.bounds.y+e.bounds.height})):[],[O]),P=k.useRef([]),F=k.useRef(null),ne=k.useRef(!0),[,re]=k.useReducer(e=>e+1,0);k.useEffect(()=>{let e=P.current;e.length>0&&(P.current=[],e.forEach(e=>e()))});let ie=k.useCallback((n,r,i,a)=>{let o=fb(`text ${e.id}`),s=()=>{t.history.ignore(n,r,i).then(()=>{ne.current?(P.current.push(o),re()):o()})};a?queueMicrotask(s):s()},[e.id,t]),I=k.useCallback(t=>{let n=F.current!==null;F.current=t,n||ie(()=>{let t=F.current;F.current=null,Zh(e)&&OG(e.height,t)&&e.set({height:t})},!1,!0)},[e,ie]);k.useEffect(()=>{if(!p||!O)return;if(!ex(e)){ie(()=>{Zh(e)&&(ex(e)||e.set({height:M}))},void 0,void 0,!0);return}if(t.isPlaying)return;let{textOverflow:n}=Oy,r=OG(e.height,M),a=()=>I(M);if(n!==`change-font-size`||i||m||e.curveEnabled)n===`resize`&&r&&!i&&a();else{let t=ZN(S?{toJSON:()=>Object.assign(Object.assign({},e.toJSON()),{text:C})}:e,{fontFamily:h,color:g,forEditor:!0},e=>{try{return _A({html:pO(e),width:E,accuracy:`performance`}).height}catch{return Uk(e).height}});t.fontSize===e.fontSize?r&&a():ie(()=>{if(!Zh(e))return;let n=MM(e,t.fontSize);t.text!==void 0&&t.text!==e.text&&(n.text=t.text),e.set(n)},!1,!0)}}),k.useEffect(()=>()=>{ne.current=!1;let e=P.current;e.length>0&&(P.current=[],e.forEach(e=>e()))},[]),k.useLayoutEffect(()=>{if(!p||!e.curveEnabled||i||!te||!te.width)return;let t=e=>e&&l?Math.max(e,te.height):te.height;Math.abs(te.width-e.width)<1&&Math.abs(t(e.height)-e.height)<1||ie(()=>{if(!Zh(e))return;let n=te.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:te.width,height:r,x:e.a.x+o,y:e.a.y+s})},!1,!0,!0)},[p,e.curveEnabled,te,i,l,ie]),k.useEffect(()=>{c&&!s&&u&&ax(e.text)===``&&e.removable&&!JM(e.placeholder)&&t.deleteElements([e.id])},[u,e.placeholder,e.removable,e.text,s,c]),k.useEffect(()=>fM(e,()=>{let t=n.current;t&&HM(t,e)}),[O,ee,e.a.width,e.a.height,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]);let ae=ix(e,M),oe=D||!p||i||t.isPlaying||Oy.textOverflow!==`resize`?e.a.height:l?Math.max(e.a.height,M):M,se=0;D||e.verticalAlign!==`middle`?D||e.verticalAlign!==`bottom`||(se=ae-M):se=(ae-M)/2;let ce=e.backgroundPadding*(e.fontSize*A*.5),le=e.backgroundCornerRadius*(e.fontSize*A*.5),L=k.useMemo(()=>!e.backgroundEnabled||e.curveEnabled||e.legacyBackground||N.length===0?``:Rk({rects:N,padding:ce,cornerRadius:le}),[e.backgroundEnabled,e.curveEnabled,e.legacyBackground,N,ce,le]),ue=UM(),de=k.useRef(null),fe=k.useRef(e.width),pe=k.useRef(null),me=k.useRef(null),he=k.useRef(``),ge=k.useRef(0),_e=k.useRef(0),ve=e.width>0?e.a.width/e.width:1;return(0,j.jsxs)(j.Fragment,{children:[e.curveEnabled||e.legacyBackground?(0,j.jsx)(Vm,{x:e.a.x,y:e.a.y,offsetX:ce/ve,offsetY:ce/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*ce,height:ae+2*ce,cornerRadius:le}):(0,j.jsx)(qm,{name:`rendertag-background`,x:e.a.x,y:e.a.y,offsetY:-se/ve,rotation:e.a.rotation,scaleX:ve,scaleY:ve,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled&&L.length>0,opacity:e.backgroundOpacity*w,fill:e.backgroundColor,data:L}),(0,j.jsx)(Jm,{ref:n,name:`rendertag-text`,x:e.a.x,y:e.a.y,rotation:e.a.rotation,scaleX:ve,scaleY:ve,offsetY:ve>0?-se/ve:0,width:e.width,height:Math.max(e.height,M),listening:!1,visible:!m&&!!(D?ee:O),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(D){if(!ee||!te)return;let t=(e.width-te.width)/2-te.x;r.save(),r.translate(t,-te.y),GD({layout:ee,ctx:r}),r.restore()}else{if(!O)return;vA({layout:O,width:E,ctx:r,pixelRatio:1})}}catch(e){console.error(`render-tag draw failed:`,e)}}}),(0,j.jsx)(Vm,{ref:r,name:`element`,x:e.a.x,y:e.a.y,listening:e.selectable,rotation:e.a.rotation,width:e.a.width,height:oe,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({x:t.target.x(),y:t.target.y()})},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=EM(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,OM(fe.current,e.fontSize)),a=e.toJSON(),s=0;if(e.curveEnabled)s=AO(Object.assign(Object.assign({},a),{width:i}));else{let{x:e,y:t,width:n,height:r}=a,o=DG(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=LO(Object.assign(Object.assign({},a),{width:e}),{fontFamily:h,color:g,forEditor:!0,text:C,textIsNormalized:!0});try{return _A({html:pO(t),width:e,accuracy:`performance`})}catch{return{height:Uk(t).height,lines:[]}}},t=e(i),n=Math.max(0,...t.lines.map(e=>e.bounds.x+e.bounds.width));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=Oy.textVerticalResizeEnabled?Math.max(s,o.current):s;Oy.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=Oy.textOverflow===`resize`?D?te?.height||e.fontSize:M:A*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:Yb(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({},NM(e,e.fontSize*n)),{width:t.target.width()*n,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),text:Yb(e.text,n)}))}}),m&&(0,j.jsx)(`Group`,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,offsetY:-se,children:(0,j.jsx)(uM,{divProps:{style:{zIndex:20}},children:(0,j.jsx)(yG,{element:e,onChange:t=>{let n=WM({oldText:ax(e.text),newText:ax(t),element:e});e.set(Object.assign({text:t},MM(e,n)))},onBlur:()=>{Zh(e)&&(e.set(PM(e)),e.toggleEditMode(!1))},clickCoords:me.current})})})]})}),AG=({targetKonvaNodes:e,guideKonvaNode:t,distance:n,snapDirection:r})=>n<5;function jG(e,t){var n=[],r=[];e.vertical.forEach(e=>{t.vertical.forEach(t=>{var r=Math.abs(e.offset-t.guide);AG({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);AG({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 MG=()=>{if(s.DD._dragElements.size===0)return;let e=[...s.DD._dragElements.entries()],t=e.find(([e,t])=>t.node instanceof s.Transformer);t&&(e.splice(e.indexOf(t),1),e.unshift(t),s.DD._dragElements.clear(),e.forEach(([e,t])=>{s.DD._dragElements.set(e,t)}))};function NG(e,t,n){return new s.Line({x:-e.x(),y:-e.y(),points:n,stroke:t.stroke,strokeWidth:t.strokeWidth,name:`guid-line`,dash:t.dash})}function PG(e,t,n){let r=e?.children.find(e=>e.name()===`line-guides`),i=e.getStage();n.forEach(e=>{e.orientation===`H`?r?.add(NG(i,t,[-6e3,e.lineGuide,6e3,e.lineGuide])):e.orientation===`V`&&r?.add(NG(i,t,[e.lineGuide,-6e3,e.lineGuide,6e3]))})}function FG(e,t){let n=k.useRef(null),r=k.useRef(null),i=k.useRef(new Map),a=k.useRef(null),{snapGuideStyle:o}=yh(),c=k.useRef(o);c.current=o;let l=e=>e.hasName(`element`)||e.hasName(`page-background`)||!n.current&&e.hasName(`elements-area`);function u(t){let n=e.current?.getStage(),r=[],i=[];return n.find(l).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 d(t){PG(e.current?.getLayer(),c.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(),s=r.x-o.x,l=r.y-o.y,u=Math.abs(s),d=Math.abs(l);if(u>2.414*d)l=0;else if(d>2.414*u)s=0;else{let e=(u+d)/2;s=Math.sign(s)*e,l=Math.sign(l)*e}e.target.nodes().forEach(e=>{let t=i.current.get(e);t&&e.setAbsolutePosition({x:t.x+s,y:t.y+l})});let f=a.current;if(f&&(u>0||d>0)){let e=Math.sign(s),r=Math.sign(l);n?.add(NG(t.getStage(),c.current,[f.x-6e3*e,f.y-6e3*r,f.x+6e3*e,f.y+6e3*r]))}return}var l=jG(u(e.target.nodes()),function(e){let t=e.__getNodeRect(),n=QA(Object.assign(Object.assign({},t),{rotation:s.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(!l.length)return;d(l);let f=e.target.getAbsolutePosition(),p=(e.target.nodes().map(e=>e.getAbsolutePosition()),Object.assign({},f));l.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=RG[i.getActiveAnchor()],s=i.findOne(`.${o}`)?.getAbsolutePosition();if(!s)return n;let c={x:t.x-s.x,y:t.y-s.y},l=function(e,t){let n=LG(e,t)/LG(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(l.x**2+l.y**2)>5)return n;let f={x:t.x+l.x,y:t.y+l.y};var p=jG(u(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||(d(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())};k.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(()=>{MG()})}),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 IG(e,t,n){let{snapGuideStyle:r}=yh(),i=k.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=jG(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){PG(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}}});let u=l.x-c.x,d=l.y-c.y;if(!n.evt.ctrlKey&&!n.evt.metaKey){let e=n.target.getAbsolutePosition();n.target.absolutePosition({x:e.x+u,y:e.y+d})}},s=e=>{if(!e.target)return;let t=e.target.getLayer();t&&(t.children.find(e=>e.name()===`line-guides`)?.destroyChildren(),t.batchDraw())};k.useEffect(()=>{e.current&&(e.current.on(`dragmove`,o),e.current.on(`dragend`,s))},n)}function LG(e,t){return e.x*t.x+e.y*t.y}var RG={"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 zG(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 BG(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 VG=(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()}}},HG=B(({element:e,type:t})=>{let n=mM(e,e.a.color,`fill`),r=mM(e,e.a.color,`stroke`),i=Cw(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,j.jsx)(Hm,Object.assign({x:i.cx,y:i.cy,radius:i.r},a)):(0,j.jsx)(Um,Object.assign({points:i.points.flat(),closed:i.filled},a))}),UG=B(({element:e,store:t})=>{let{transformerStyle:n}=yh(),r=k.useRef(null),i=k.useRef(null),a=k.useRef(null),o=e.selectable||t.role===iM.ADMIN,s=UM(),c=t.selectedElements.indexOf(e)>=0&&t.selectedElements.length===1,l=e.isSelected,{middleLeft:u,middleRight:d}=zG(e);IG(i,[r],[c]),IG(a,[r],[c]);let f=mM(e,e.a.color,`stroke`);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Um,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({x:t.target.x(),y:t.target.y()})},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()})}})),(0,j.jsx)(zm,{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,j.jsx)(HG,{element:e,type:e.startHead})}),(0,j.jsx)(zm,{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,j.jsx)(HG,{element:e,type:e.endHead})}),c&&e.resizable&&(0,j.jsx)(dM,{selector:`.page-abs-container`,enabled:!0,children:(0,j.jsxs)(`Group`,{visible:c,children:[(0,j.jsx)(`Rect`,Object.assign({x:u.x,y:u.y,ref:i,name:`line-anchor`},VG(t.scale,t,n),{onDragMove:t=>{let n=BG(t.target.position(),d,e.height);e.set({x:n.x,y:n.y,width:n.width,rotation:n.rotation})}})),(0,j.jsx)(`Rect`,Object.assign({x:d.x,y:d.y,ref:a,name:`line-anchor`},VG(t.scale,t,n),{onDragMove:t=>{let n=BG(u,t.target.position(),e.height);e.set({x:n.x,y:n.y,width:n.width,rotation:n.rotation})}}))]})})]})}),WG=e=>{let t=k.useRef(e);return t.current=e,k.useCallback((...e)=>t.current(...e),[])};function GG(e){return Promise.resolve(e.play()).then(()=>`started`,e=>e?.name===`NotAllowedError`?`refused`:`interrupted`)}function KG(){let e=!1,t=0;return{play(n){if(e)return;let r=t;GG(n).then(n=>{n===`refused`&&r===t&&(e=!0)})},reset(){t+=1,e=!1}}}function qG(e,t){let n=JG(e);return n>0&&t>=e.timestamp&&t<e.timestamp+n}function JG(e){let t=e.duration??0;return Number.isFinite(t)&&t>0?t:0}var YG=(e,t,n)=>{let[r,i]=k.useState({input:null,videoSink:null,duration:0,isReady:!1,error:null});k.useRef(r).current=r;let a=k.useRef(0),s=k.useRef(null),c=k.useRef(null),l=k.useRef(null),u=k.useRef(null),v=k.useRef(null),y=k.useRef(null),b=k.useRef(!1),x=k.useRef(null),S=k.useRef([]),C=k.useRef(null),w=k.useRef(!1),[,T]=k.useReducer(e=>e+1,0);return k.useEffect(()=>{if(!n)return;let t=!0,r=++a.current,s=null;return(async()=>{try{if(!t||r!==a.current)return;s=fb(`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 hS(e.slice(t+1)).buffer}(e);return new f(t)}if(function(e){return e.startsWith(`file://`)}(e))try{let t=await(await fetch(e)).arrayBuffer();return new f(t)}catch(t){throw Error(`Failed to load file URL: ${e}. File URLs may not be supported in this environment. Error: ${t}`)}return new d(e)}(e.src);if(!t||r!==a.current){s&&=(s(),null);return}let c=new _({source:n,formats:g}),l=await c.computeDuration(),u=await c.getPrimaryVideoTrack();if(!u)throw o(`VIDEO_FAILED`,`No video track found`,{reason:`no-video-track`});if(u.codec===null)throw o(`VIDEO_FAILED`,`Unsupported video codec`,{reason:`unsupported-codec`});if(!await u.canDecode())throw o(`VIDEO_FAILED`,`Unable to decode the video track`,{reason:`cannot-decode`});let m=await u.canBeTransparent(),h=new p(u,{poolSize:5,fit:`contain`,alpha:m});if(!t||r!==a.current){c.dispose(),s&&=(s(),null);return}s&&=(s(),null),i(e=>Object.assign(Object.assign({},e),{input:c,videoSink:h,duration:l,isReady:!0,error:null}))}catch(n){if(console.error(`Failed to initialize mediabunny:`,n),s&&=(s(),null),t&&r===a.current){let t=`Failed to initialize mediabunny for video ${e.id}: ${n}`;_b(o(`VIDEO_FAILED`,t,Object.assign({reason:`load`},n?.details),n)),i(e=>Object.assign(Object.assign({},e),{error:String(n),isReady:!1}))}}})(),()=>{t=!1,s&&=(s(),null)}},[e.src,n]),k.useEffect(()=>()=>{c.current&&=(c.current.return(),null),s.current&&=(s.current(),null),l.current=null,u.current=null,v.current=null,b.current=!1,x.current=null,S.current=[],C.current=null,w.current=!1,i({input:null,videoSink:null,duration:0,isReady:!1,error:null})},[n]),k.useEffect(()=>{if(!n||!r.isReady||!r.videoSink)return;let i=++a.current,o=typeof e.src==`string`?e.src.slice(0,120):String(e.src),d=(t,n={},i=`debug`)=>{let a=``;try{a=JSON.stringify(Object.assign(Object.assign({},n),{timeCalc:y.current}))}catch(e){a=`[unserializable extras: ${String(e)}]`}let s=`mediabunny event=${t} elementId=${e.id} targetTime=${v.current} duration=${r.duration} lastFrameTimestamp=${u.current?.timestamp} hasIterator=${!!c.current} prefetchSize=${S.current.length} srcHint=${o} extras=${a}`;i===`error`?console.error(s):i===`warn`?console.warn(s):console.debug(s)},f=e=>{let t=r.duration||0;return t&&Number.isFinite(t)?Math.max(0,Math.min(e,t)):e},p=e=>{let t=l.current;t&&t.width===e.canvas.width&&t.height===e.canvas.height||(t||(t=document.createElement(`canvas`),l.current=t),t.width=e.canvas.width,t.height=e.canvas.height);let n=t.getContext(`2d`);n&&(n.clearRect(0,0,t.width,t.height),n.drawImage(e.canvas,0,0)),u.current={timestamp:e.timestamp,duration:JG(e)}},g=e=>{let t=c.current;t&&(w.current||(w.current=!0,C.current=(async()=>{try{for(;S.current.length<4&&e===a.current;){let n=await t.next();if(e!==a.current)return;if(n.done||!n.value)break;S.current.push({timestamp:n.value.timestamp,frame:n.value})}}catch{}finally{w.current=!1,C.current=null}})()))},_=e=>{let t=S.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];return n<t.length-1||qG(r.frame,e)?(S.current=t.slice(n+1),r):null},E=()=>{S.current=[]},D=async(e,t,n=0)=>{let i=f(e),o=(e=>{let t=u.current;return!t||e<t.timestamp||e>t.timestamp+.5})(i)?`seek`:`iterate`;try{let n=r.videoSink,s=u.current;if(s&&qG(s,i)){v.current=e;return}let l=_(i);if(l){p(l.frame),v.current=e,g(t),T();return}if(C.current){await C.current;let n=_(i);if(n){p(n.frame),v.current=e,g(t),T();return}}E();let f=()=>d(`iterator_exhausted`,{mode:o,requestedTargetTime:e,clampedTargetTime:i},`warn`),m=async e=>{c.current&&=(await c.current.return(),null),E();let r=n.canvases(e);c.current=r;let i=await r.next();return t===a.current?i.done||!i.value?`empty`:(p(i.value),g(t),`drawn`):(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`){f();return}}else{let e=c.current;if(!e)return;for(;t===a.current;){let n=await e.next();if(t!==a.current)break;if(n.done||!n.value){await m(i)===`empty`&&f();break}let r=n.value;if(p(r),qG(r,i)||r.timestamp>=i){g(t);break}}}v.current=e,T()}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(d(`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),E(),C.current=null,w.current=!1,u.current=null,await D(e,t,n+1)}catch{}}},O=fM(e,()=>{let n=r.videoSink,o=r.duration;if(!n||!o)return;let c=e.startTime*o*1e3,l=o*(e.endTime-e.startTime)*1e3,{start:u}=h(e.animations,e.page.duration),d=m(t.currentTime,e.page.startTime,u,l,c,e.speed),p=d/1e3+1e-6,g=f(p);y.current={pageStartTime:e.page.startTime,storeCurrentTime:t.currentTime,offsetMs:c,durationMs:l,restMs:d,targetTime:p,clampedTargetTime:g,startTime:e.startTime,endTime:e.endTime,videoDuration:o},((t,n)=>{b.current?x.current=t:(b.current=!0,s.current||=fb(`mediabunny video frame ${e.id}`),(async()=>{let e=t;for(;e!==null&&n===a.current;)await D(e,n),e=x.current,x.current=null;s.current&&=(s.current(),null),b.current=!1})())})(p,i)});return()=>{O(),a.current++,s.current&&=(s.current(),null)}},[n,r.isReady,r.videoSink,r.duration,t,e]),n&&r.isReady?l.current:null};function XG(){return document.createElement(`canvas`)}var ZG=new window.Image;ZG.src=XC(`
|
|
590
|
+
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
591
|
+
<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"/>
|
|
592
|
+
<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"/>
|
|
593
|
+
</svg>
|
|
594
|
+
`);var QG=new window.Image;QG.src=XC(`
|
|
595
|
+
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
596
|
+
<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"/>
|
|
597
|
+
<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"/>
|
|
598
|
+
<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"/>
|
|
599
|
+
<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"/>
|
|
600
|
+
</svg>
|
|
601
|
+
`);var $G=(e,t,n,r,i=0,a=!1)=>{let o=Math.floor(Math.max(e.width*r,1)),c=Math.floor(Math.max(e.height*r,1)),l=Math.min(i*r,o/2,c/2),u=Math.max(e.width/n.width,e.height/n.height)*r,d=e.page?._exportingOrRendering&&Oy.imageDownScalingEnabled&&u<1&&!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=k.useMemo(()=>{if(t&&f&&p)return m&&l===0&&!d?void 0:XG()},[t,l,d,m,f,p]),g=()=>{if(!h||!t)return;h.width=o,h.height=c;let e=h.getContext(`2d`);if(!e)return;l&&(e.beginPath(),e.moveTo(l,0),e.lineTo(o-l,0),e.arc(o-l,l,l,3*Math.PI/2,0,!1),e.lineTo(o,c-l),e.arc(o-l,c-l,l,0,Math.PI/2,!1),e.lineTo(l,c),e.arc(l,c-l,l,Math.PI/2,Math.PI,!1),e.lineTo(0,l),e.arc(l,l,l,Math.PI,3*Math.PI/2,!1),e.clip());let r=d?cN(t,u):t,i=d?{x:Math.floor(n.x*u),y:Math.floor(n.y*u),width:Math.floor(n.width*u),height:Math.floor(n.height*u)}:n;e.drawImage(r,i.x,i.y,i.width,i.height,0,0,h.width,h.height)};return k.useLayoutEffect(()=>{g()},[h,e.width,e.height,n.x,n.y,n.width,n.height,i,r,a,e.page?._exportingOrRendering,d]),k.useEffect(()=>()=>{h&&h.nodeName===`CANVAS`&&s.Util.releaseCanvas(h)},[h]),[h||t,g]},eK=XG(),tK=B(({element:e})=>{let t=Math.min(30,e.width/4,e.height/4),n=k.useRef(null);k.useEffect(()=>{let e=n.current;if(!e)return;let t=new s.Animation(t=>{e.rotate((t?.timeDiff||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}});let{mediaLoadingStyle:r}=yh();return(0,j.jsxs)(zm,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,j.jsx)(Vm,{width:e.width,height:e.height,fill:r.fill}),(0,j.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=B(({element:e})=>{let{mediaErrorStyle:t}=yh(),n=Math.max(10,Math.min(30,e.width/25));return(0,j.jsxs)(zm,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,j.jsx)(Vm,{width:e.width,height:e.height,fill:t.fill}),(0,j.jsx)(Gm,{text:`Can not load the video...`,fontSize:n,width:e.width,height:e.height,align:`center`,fill:t.textFill,verticalAlign:`middle`,padding:5})]})}),rK=function(e,t,n){let r=k.useRef(`loading`),i=k.useRef(void 0),[a,o]=k.useState(0),s=k.useRef(void 0),c=k.useRef(void 0),l=k.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),k.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 iK(e){return e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA}var aK=(e,t,n)=>{let r=k.useRef(void 0),i=()=>{var e;(e=r.current)==null||e.call(r),r.current=void 0};k.useEffect(()=>i,[]),k.useLayoutEffect(()=>{let a=t.slice(0,200),s=`video with id ${n} url: ${a}`;e!==`loading`||r.current||(r.current=fb(s)),e!==`loading`&&i(),e===`failed`&&_b(o(`VIDEO_FAILED`,s,{src:a,elementId:n,reason:`load`}))},[e])},oK=B(({element:e,store:t})=>{let[n,r]=k.useState(!1),i=k.useRef(null),a=k.useRef(null),o=e.isSelected,[c,l]=k.useState(!1),[u,d]=rK(e.src,`anonymous`),[f,p]=k.useState(!1),g=t.activePage===e.page,_=e.page?._exportingOrRendering&&d===`loaded`,v=YG(e,t,_);aK(d,e.src,e.id),u&&(u.playsInline=!0);let y=((e,t,n)=>{let r=k.useMemo(()=>{var r,i;let{flipX:a,flipY:o}=e,s=e.type===`svg`||QC(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=XG(),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 k.useEffect(()=>()=>{r&&r.nodeName===`CANVAS`&&s.Util.releaseCanvas(r)},[r]),r})(e,u,t._elementsPixelRatio),[b=eK,x]=oN(e,_&&v||y||eK);k.useEffect(()=>{u&&t.history.ignore(()=>{e.set({duration:1e3*u.duration})})},[u]);let S=k.useMemo(KG,[u]);k.useEffect(()=>{if(!u)return;let n=t.animatedElementsIds,r=(!n.length||n.includes(e.id))&&t.isPlaying;if(!g||!r&&!c){u.pause();return}c&&(u.muted=!1,u.currentTime=e.startTime*u.duration,GG(u).then(e=>{e===`refused`&&l(!1)}));let a=new s.Animation(()=>{ae()},i.current?.getLayer());a.start();let o=()=>{l(!1),u.currentTime=e.startTime*u.duration},d=()=>{u.currentTime>=e.endTime*u.duration&&(u.pause(),u.currentTime=e.startTime*u.duration,l(!1))};return u.addEventListener(`ended`,o),u.addEventListener(`timeupdate`,d),()=>{u.pause(),a.stop(),u.removeEventListener(`ended`,o),u.removeEventListener(`timeupdate`,d)}},[u,c,t.isPlaying,g]),k.useEffect(()=>{u&&(u.volume=e.volume)},[u,e.volume]),k.useEffect(()=>{u&&(u.playbackRate=e.speed,u.preservesPitch=!1)},[u,e.speed]);let C=k.useRef(null);k.useEffect(()=>{let n=fM(e,()=>{var n;if(u){if(_&&v){ae(),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,s=e.startTime*u.duration*1e3,l=u.duration*(e.endTime-e.startTime)*1e3,{start:d,end:f}=h(e.animations,e.page.duration),p=(t.currentTime||e.page.startTime)-e.page.startTime,g=o?m(t.currentTime,e.page.startTime,d,l,s,e.speed):0,y=g/1e3,b=o&&p>=d&&p<f;c||(u.muted=!b,b&&t.isPlaying&&a?u.paused?(u.currentTime=y,S.play(u)):Math.abs(1e3*u.currentTime-g)>500&&(u.currentTime=y):(S.reset(),u.paused||u.pause(),y!==u.currentTime&&(u.currentTime=y),!iK(u)&&!t.isPlaying&&!C.current&&(C.current=fb(`video ${e.id}`)))),ae(),(n=i.current?.getLayer())==null||n.batchDraw()}});return()=>{n(),C.current&&=(C.current(),null)}},[t,u,_,v,c]),k.useEffect(()=>{var t,n;if(!u)return;if(_){(t=C.current)==null||t.call(C),C.current=null;return}let r=()=>{var t,n;!iK(u)&&(t=e.page)!=null&&t._exportingOrRendering||(C.current&&=(ae(),(n=i.current?.getLayer())==null||n.batchDraw(),C.current(),null))},a;return(n=e.page)!=null&&n._exportingOrRendering&&(a=setInterval(r,20)),u.addEventListener(`timeupdate`,r),u.addEventListener(`canplay`,r),()=>{clearInterval(a),u.removeEventListener(`timeupdate`,r),u.removeEventListener(`canplay`,r)}},[e.page?._exportingOrRendering,u,e.id,fb,_]);let{cropX:w,cropY:T,cropWidth:E,cropHeight:D}=e;d!==`loaded`&&(w=T=0,E=D=1);let O=(ee=b)instanceof HTMLVideoElement?ee.videoWidth:ee?.width||0;var ee;let A=(e=>e instanceof HTMLVideoElement?e.videoHeight:e?.height||0)(b),M=_w({cropX:w,cropY:T,cropWidth:E,cropHeight:D,width:e.width,height:e.height},{width:O,height:A}),te=M.width,N=M.height,P=e.type===`svg`,F=e.cornerRadius??0,[ne,re]=$G(e,b,M,t._elementsPixelRatio,F,!0),[ie,I]=((e,t,n,r)=>{let i=(e=>{let[t,n]=k.useState(e);return k.useEffect(()=>{(async()=>{let r=await async function(e){return QC(e)?XC(aw(await JC(e))):e}(e);r!==t&&n(r)})()},[e]),t})(e.clipSrc||``),[a,o]=(0,Qm.default)(i,`anonymous`);aK(e.clipSrc?o:`loaded`,e.clipSrc,e.id);let c=k.useMemo(()=>{if(t&&a)return XG()},[t,a]);function l(){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||!c)return;let l=XG(),u=Math.max(e.width/a.width*n,e.height/a.height*n);l.width=a.width*u,l.height=a.height*u,(r=l.getContext(`2d`))==null||r.drawImage(a,0,0,l.width,l.height),c.width=Math.max(i,1),c.height=Math.max(o,1);let d=c.getContext(`2d`);d&&(d.save(),d.drawImage(l,0,0,i,o),s.Util.releaseCanvas(l),d.globalCompositeOperation=`source-in`,d.drawImage(t,0,0,c.width,c.height),d.restore())}return k.useLayoutEffect(()=>{l()},[c,t,a,e.width,e.height,n,...r]),[e.clipSrc&&a?c:t,l]})(e,ne,t._elementsPixelRatio,[M,F,t._elementsPixelRatio]),ae=WG(()=>{var e;x(),re(),I(),(e=i.current?.getLayer())==null||e.batchDraw()});k.useEffect(()=>{ae()});let oe=Math.max(e.width/te,e.height/N);k.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 se=k.useRef(null),ce=k.useRef(null),le=k.useRef(null);k.useLayoutEffect(()=>{e._cropModeEnabled&&(ce.current.nodes([se.current]),le.current.nodes([a.current]))},[e._cropModeEnabled]);let L=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,te/n),a=Math.min(1,N/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})},ue=()=>{e.type!==`svg`&&e.contentEditable&&setTimeout(()=>{Zh(e)&&e.toggleCropMode(!0)})},de=d===`loading`,fe=d===`failed`,pe=!de&&!fe,me=k.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),he=k.useRef(!1),ge=pe?e.a.opacity:0;ib(i,ge);let _e=e.selectable||t.role===iM.ADMIN,ve=UM();return(0,j.jsx)(j.Fragment,{children:(0,j.jsxs)(zm,{onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:[de&&(0,j.jsx)(tK,{element:e}),fe&&(0,j.jsx)(nK,{element:e}),(0,j.jsx)(Wm,{ref:i,name:`element`,id:e.id,image:ie,x:e.a.x,y:e.a.y,width:e.a.width||1,height:e.a.height||1,rotation:e.a.rotation,opacity:ge,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:M,listening:_e,draggable:ve?e.draggable&&o:e.draggable,preventDefault:!ve||o,hideInExport:!e.showInExport,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDblClick:ue,onDblTap:ue,onTransformStart:t=>{r(!0),he.current=DM(EM(t.target)),me.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-te/O,o=Math.min(a,Math.max(0,e.cropX)),s=1-N/A,c=Math.min(s,Math.max(0,e.cropY)),l=he.current,u=!l&&r<1&&me.current.cropHeight>N/A,d=l?e.cropWidth:e.cropWidth*r;u&&(d=e.cropWidth);let f=!l&&i<1&&me.current.cropWidth>te/O,p=l?e.cropHeight:e.cropHeight*i;f&&(p=e.cropHeight),P&&(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({},AM(e,m)),{borderSize:e.borderSize*m})))},onTransformEnd:t=>{let n=t.currentTarget;e.set(Object.assign(Object.assign({width:n.width(),height:n.height(),x:n.x(),y:n.y(),rotation:t.target.rotation(),cropWidth:te/O,cropHeight:N/A},jM(e)),{borderSize:TM(e.borderSize)})),r(!1)}}),(0,j.jsx)(Vm,{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:ge,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,F-e.borderSize),hideInExport:!e.showInExport}),!t.isPlaying&&(0,j.jsx)(`Image`,{image:c?f||ve?QG:void 0:ZG,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:()=>l(!c),onTap:()=>l(!c)}),e._cropModeEnabled&&(0,j.jsxs)(dM,{selector:`.page-abs-container`,enabled:!0,children:[(0,j.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,j.jsx)(`Image`,{listening:!1,image:ie,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,j.jsxs)(`Group`,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,scaleX:oe,scaleY:oe,children:[(0,j.jsx)(`Image`,{image:b,ref:a,width:O,height:A,opacity:.4,draggable:!0,x:-e.cropX*O,y:-e.cropY*A,onDragMove:L,onTransform:L}),(0,j.jsx)(`Transformer`,{ref:le,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,j.jsx)(`Rect`,{width:te,height:N,ref:se,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*oe,O*(1-n)*oe),height:Math.min(a*oe,A*(1-r)*oe)})}}),(0,j.jsx)(`Transformer`,{ref:ce,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})]})]})]})})}),sK={},cK=B(({element:e,store:t})=>{let n=k.useRef(null),r=k.useRef(!1),i=e.selectable||t.role===iM.ADMIN,a=UM(),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=mM(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=mM(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,sK[h]||(sK[h]=(g=Vw(h),B(({element:e,fillProps:t,strokeProps:n,hitStrokeWidth:r})=>{let i=g({width:e.a.width,height:e.a.height,cornerRadius:e.cornerRadius}),a=k.useRef(null);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`Rect`,{width:e.a.width,height:e.a.height,fill:`transparent`,hitStrokeWidth:r}),(0,j.jsx)(`Path`,Object.assign({},t,{ref:a,data:i})),(0,j.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,j.jsx)(`Path`,Object.assign({},n,{x:0,y:0,data:i,strokeWidth:2*n.strokeWidth,dash:n.dash.map(e=>e)}))})]})}))),sK[h]||`Group`);var h,g;return(0,j.jsx)(j.Fragment,{children:(0,j.jsx)(zm,{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({x:t.target.x(),y:t.target.y()})},onTransformStart:e=>{r.current=DM(EM(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({},AM(e,i)),{strokeWidth:e.strokeWidth*i})))},onTransformEnd:()=>{e.set(Object.assign(Object.assign({},jM(e)),{strokeWidth:TM(e.strokeWidth)}))},children:(0,j.jsx)(m,{element:e,fillProps:u,strokeProps:f,hitStrokeWidth:p})})})}),lK=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}}})),uK=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},{})}}})),dK=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=lK(),n=uK(),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})}]})),fK=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}})),pK=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}})),mK=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.decompressFrames=e.decompressFrame=e.parseGIF=void 0;var t=o(dK()),n=lK(),r=uK(),i=fK(),a=pK();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 hK(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 gK=B(({element:e})=>{let t=Math.min(30,e.width/4,e.height/4),n=k.useRef(null);k.useEffect(()=>{let e=n.current;if(!e)return;let t=new s.Animation(t=>{e.rotate((t?.timeDiff||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}},[]);let{mediaLoadingStyle:r}=yh();return(0,j.jsxs)(zm,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,j.jsx)(Vm,{width:e.width,height:e.height,fill:r.fill}),(0,j.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})]})}),_K=B(({element:e})=>{let{mediaErrorStyle:t}=yh(),n=Math.max(10,Math.min(30,e.width/22));return(0,j.jsxs)(zm,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,j.jsx)(Vm,{width:e.width,height:e.height,fill:t.fill}),(0,j.jsx)(Gm,{text:`Cannot load the GIF...`,fontSize:n,width:e.width,height:e.height,align:`center`,fill:t.textFill,verticalAlign:`middle`,padding:5})]})}),vK=B(({element:e,store:t})=>{let[n,r]=k.useState(!1),i=k.useRef(!1),a=e.isSelected,o=k.useRef(null),c=k.useRef(void 0),[l,u,d,f]=function(e){let[t,n]=k.useState([]),[r,i]=k.useState(0),[a,o]=k.useState(`loading`),[s,c]=k.useState({width:0,height:0});return k.useEffect(()=>{(async()=>{try{let t=await(await fetch(e)).arrayBuffer(),r=(0,mK.parseGIF)(t),a=(0,mK.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);SN(f,e.src,e.id),k.useEffect(()=>(c.current=document.createElement(`canvas`),()=>{c.current&&s.Util.releaseCanvas(c.current)}),[]),k.useEffect(()=>{if(f===`loaded`&&c.current&&(c.current.width=d.width,c.current.height=d.height,l.length>0)){let e=c.current.getContext(`2d`);if(e){e.clearRect(0,0,d.width,d.height);let t=document.createElement(`canvas`);hK(l[0],c.current,t)}}},[d,f,l]),k.useEffect(()=>{if(!l.length||!c.current)return;let n=c.current;n.width=d.width,n.height=d.height;let r=document.createElement(`canvas`),i=n.getContext(`2d`);i&&i.clearRect(0,0,n.width,n.height);let a=-1;hK(l[0],n,r),C(),a=0;let s=e=>{let t=(e=>{let t=e%u,n=0;for(let e=0;e<l.length;e++)if(n+=l[e].delay,n>t)return e;return 0})(e);t!==a&&(hK(l[t],n,r),C(),o.current.getLayer().draw(),a=t)};if(t.isPlaying||e.page?._exportingOrRendering)return fM(e,()=>{s(t.currentTime-e.page.startTime)});{let e=window.setInterval(()=>{s(t.currentTime||performance.now())},16);return()=>{clearInterval(e)}}},[t.isPlaying,l,u,e.page?._exportingOrRendering]),k.useEffect(()=>{u&&t.history.ignore(()=>{e.set({duration:u})})},[u]);let{cropX:p,cropY:m,cropWidth:h,cropHeight:g}=e;f!==`loaded`&&(p=m=0,h=g=1);let _={x:d.width*p,y:d.height*m,width:d.width*h,height:d.height*g},v=e.cornerRadius??0,[y,b]=oN(e,c.current),[x,S]=$G(e,y,_,t._elementsPixelRatio,v,n||e._cropModeEnabled),C=WG(()=>{b(),S()}),w=f===`loading`,T=f===`failed`,E=w||T?0:e.a.opacity;ib(o,E);let D=e.selectable||t.role===iM.ADMIN,O=UM();return(0,j.jsxs)(j.Fragment,{children:[w&&(0,j.jsx)(gK,{element:e}),T&&(0,j.jsx)(_K,{element:e}),(0,j.jsx)(Wm,{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({x:t.target.x(),y:t.target.y()})},onTransformStart:e=>{r(!0),i.current=DM(EM(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({},AM(e,o)),{borderSize:e.borderSize*o})))},onTransformEnd:()=>{e.set(Object.assign(Object.assign({},jM(e)),{borderSize:TM(e.borderSize)})),r(!1)}}),(0,j.jsx)(Vm,{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})]})}),yK=`#0d83dd`,bK=(e,t)=>{let n=e.target.getStage();n&&(n.container().style.cursor=t)},xK=B(({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,j.jsxs)(j.Fragment,{children:[t&&(0,j.jsx)(`Rect`,{x:u.x,y:u.y,width:u.width,height:u.height,fill:`rgba(13, 131, 221, 0.08)`,listening:!1}),(0,j.jsx)(Vm,{x:n,y:r,width:i,height:a,cornerRadius:Math.min(i,a)/2,fill:t?yK:`#9ca3af`,opacity:t?.55:.18,listening:!1}),(0,j.jsx)(Vm,{x:o,y:s,width:c,height:l,fill:`transparent`,onMouseEnter:e=>{m({kind:d,idx:f}),bK(e,`pointer`)},onMouseLeave:e=>{m(null),bK(e,``)},onClick:p})]})),SK=B(({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,j.jsxs)(zm,{x:e,y:t,onMouseEnter:e=>{c({kind:r,idx:i}),bK(e,`pointer`)},onMouseLeave:e=>{c(null),bK(e,``)},onClick:e=>{e.cancelBubble=!0,s()},children:[(0,j.jsx)(Vm,{x:-l/2,y:-l/2,width:l,height:l,fill:`transparent`}),p&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`Circle`,{radius:u+d,fill:`white`,listening:!1}),(0,j.jsx)(`Circle`,{radius:u,fill:yK,listening:!1}),(0,j.jsx)(`Line`,{points:[.55*-u,0,.55*u,0],stroke:`white`,strokeWidth:f,lineCap:`round`,listening:!1}),(0,j.jsx)(`Line`,{points:[0,.55*-u,0,.55*u],stroke:`white`,strokeWidth:f,lineCap:`round`,listening:!1})]})]})}),CK=B(({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,j.jsx)(xK,{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,j.jsx)(SK,{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,j.jsx)(xK,{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,j.jsx)(SK,{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,j.jsx)(j.Fragment,{children:m})}),wK=B(({element:e,store:t})=>{let n=k.useRef(null),r=k.useRef(null),i=e.selectable||t.role===iM.ADMIN,a=UM(),o=e.isSelected,s=e._focusedCellIds.length>0,c=e.editingCell,l=1/Math.max(.01,t.scale),[u,d]=k.useState(null);k.useEffect(()=>{o||(e.clearCellFocus(),d(null))},[o]);let f=c?._editModeEnabled;k.useEffect(()=>{e._editingCellId&&c&&!c._editModeEnabled&&e.exitCellEdit()},[f]),k.useEffect(()=>{s&&!e._editingCellId&&setTimeout(()=>r.current?.focus(),0)},[s,e._editingCellId]);let p=k.useMemo(()=>Zt.box(!1),[]);k.useEffect(()=>fM(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,j.jsx)(Um,{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,j.jsx)(Um,{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,j.jsx)(Um,{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,j.jsx)(Um,{points:[a,s,a,c],stroke:e.color,strokeWidth:e.width,dash:h(e.style,e.width),listening:!1},`br-${t.id}`))}}}return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Vm,{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=>{let n=t.target;e.set({x:n.x(),y:n.y()})},onTransformStart:()=>{mr(()=>p.set(!0))},onTransformEnd:()=>{e._resetBaseRowHeights(),mr(()=>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,j.jsxs)(zm,{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,j.jsx)(Vm,{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,j.jsx)(aN,{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,j.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,j.jsx)(uM,{children:(0,j.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,j.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,j.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,mr(()=>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(),mr(()=>p.set(!1)),t.history.endTransaction()}},`row-resize-${i}`))}return n})(),o&&!c&&!t.isPlaying&&(0,j.jsx)(CK,{element:e,store:t,inv:l,isTouch:a,hover:u,setHover:d})]})]})}),TK=B(({element:e})=>{let{highlighterStyle:t}=yh();return(0,j.jsx)(Vm,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))}),EK={text:aN,image:CN,svg:CN,line:UG,video:oK,figure:cK,group:B(e=>{let{element:t,store:n}=e,r=t,{children:i}=r,a=t.selectable||n.role===iM.ADMIN,o=r.a;return(0,j.jsx)(zm,{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,k.createElement)(OK,Object.assign({},e,{key:t.id,store:n,element:t})))})}),gif:vK,table:wK},DK=(e,t)=>{let n=[];Hj(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 s.Transform;n.translate(e.x,e.y),n.rotate(s.Util.degToRad(e.rotation)),t.forEach(e=>{let t=n.point(e);r.push(t)})});let i=new s.Transform;i.rotate(-s.Util.degToRad(t));let a=1/0,o=1/0,c=-1/0,l=-1/0;r.forEach(e=>{let t=i.point(e);a=Math.min(a,t.x),o=Math.min(o,t.y),c=Math.max(c,t.x),l=Math.max(l,t.y)}),i.invert();let u=i.point({x:a,y:o});return{x:u.x,y:u.y,width:c-a,height:l-o,rotation:t}},OK=B(e=>{let{element:t,store:n}=e,[r,i]=k.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]=k.useState(!1),[d,f]=k.useState(null),p=k.useCallback(e=>{f(e?e.getStage():null)},[]),m=k.useRef(void 0),h=()=>(m.current||=d?.findOne(`Transformer`),m.current);k.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]),k.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=EK[e.element.type];return e.element.type===`text`&&(Oy.renderTagTextEnabled?g=kG:Oy.htmlRenderEnabled&&(g=TG)),e.element.visible?g?(0,j.jsxs)(zm,{name:`element-container`,ref:p,visible:t.active,listening:t.active,children:[(0,j.jsx)(g,Object.assign({},e)),(r||c)&&!a&&!o&&!l&&(0,j.jsx)(TK,{element:t.type===`group`?{a:DK(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 kK(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 AK(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 jK(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 MK(e,t){if(e.length===0)throw Error(`Cannot create SVG from empty path`);let n=t.smooth?kK(e):e,r=jK(n),i=t.strokeWidth,a=r.x-i,o=r.y-i,s=r.width+2*i,c=r.height+2*i;return{src:XC(`\n <svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${c}" viewBox="0 0 ${s} ${c}">\n <path\n d="${AK(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 NK=B(({store:e,page:t,width:n,height:r,scale:i,xPadding:a,yPadding:o,bleedLeft:s,bleedTop:c})=>{let[l,u]=k.useState(!1),[d,f]=k.useState([]),p=k.useRef(null),m=e.tool===`draw`,{strokeWidth:h,stroke:g,opacity:_,brushType:v}=e.toolOptions,y=k.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=k.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=k.useCallback(()=>{if(m&&l){if(u(!1),d.length>=1)try{let n=MK(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]);k.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=k.useMemo(()=>d.flatMap(e=>[e.x,e.y]),[d]);return k.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,j.jsxs)(zm,{ref:p,listening:m,x:a+s*i,y:o+c*i,scaleX:i,scaleY:i,children:[(0,j.jsx)(Vm,{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,j.jsx)(`Line`,{points:S,stroke:g,strokeWidth:h,lineCap:`round`,lineJoin:`round`,opacity:_,tension:.5,listening:!1})]}):null});function PK(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 FK=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},IK=e=>Xm.batchedUpdates(e,null);ga(e=>{Xm.isAlreadyRendering()?queueMicrotask(()=>IK(e)):IK(e)});var LK=s.DD._drag;window.removeEventListener(`mousemove`,LK),s.DD._drag=function(e){mr(()=>{LK.call(this,e)})},window.addEventListener(`mousemove`,s.DD._drag);var RK={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},zK=e=>{let t=(e%180+180)%180;return t<.1||180-t<.1},BK=e=>{if(!e.length)return null;let t=zK(e[0].rotation)?0:e[0].rotation;return e.every(e=>zK(e.rotation-t))?t:null},VK=e=>e.selectedShapes.filter(e=>!e._cropModeEnabled),HK=(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},UK={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`]}},WK=e=>(0,j.jsx)(Vm,Object.assign({},e,{preventDefault:!1})),GK=e=>{var{url:t}=e,n=FK(e,[`url`]);let[r,i]=(0,Qm.default)(t,`anonymous`),a=r?PK(r,{width:n.width,height:n.height},`center-middle`):{};return SN(i,t,`page background`),(0,j.jsx)(Wm,Object.assign({image:r},n,a))},KK=e=>{let t=mM({a:{width:e.width,height:e.height},width:e.width,height:e.height},e.fill);return(0,j.jsx)(Vm,Object.assign({},e,t))},qK=e=>{let{background:t,scale:n,borderColor:r,transparencyBackgroundColor:i}=e,a=FK(e,[`background`,`scale`,`borderColor`,`transparencyBackgroundColor`]),o=k.useMemo(()=>!!s.Util.colorToRGBA(t)||gC(t),[t]),c=k.useMemo(()=>{if(gC(t))return!0;let e=s.Util.colorToRGBA(t);return!e||e.a<1},[t]),l=k.useMemo(()=>{if(!c||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},[c,i]);return(0,j.jsxs)(k.Fragment,{children:[c&&(0,j.jsx)(`Rect`,i?Object.assign({fill:i},a,{hideInExport:!0}):Object.assign({fillPatternImage:l},a,{opacity:.1,hideInExport:!0})),o?(0,j.jsx)(KK,Object.assign({fill:t},a)):(0,j.jsx)(GK,Object.assign({url:t},a))]})},JK=B(({selection:e})=>{let{selectionRectStyle:t}=yh();return e.visible?(0,j.jsx)(Vm,{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 YK(e){let t=180*e/Math.PI;return t%=360,t>180?t-=360:t<-180&&(t+=360),Math.round(t)}var XK=B(({x:e,y:t,width:n,height:r,rotation:i,anchor:a,store:o})=>{let{transformLabelStyle:c}=yh();if(e===void 0||t===void 0||n===void 0||r===void 0||i===void 0||a===void 0)return null;let l=QA({x:e,y:t,width:n,height:r,rotation:s.Util.radToDeg(i)}),u=(r/2+70)*Math.cos(i-Math.PI/2),d=(r/2+70)*Math.sin(i-Math.PI/2),f=SS({unit:o.unit,dpi:o.dpi,px:n/o.scale,precious:o.unit===`px`?0:1})+` x `+SS({unit:o.unit,dpi:o.dpi,px:r/o.scale,precious:o.unit===`px`?0:1})+(o.unit===`px`?``:` `+o.unit);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(Bm,{x:(l.minX+l.maxX)/2+u,y:(l.minY+l.maxY)/2+d,offsetX:14,offsetY:14,visible:a===`rotater`,children:[(0,j.jsx)(`Tag`,{cornerRadius:5,fill:c.fill}),(0,j.jsx)(Gm,{align:`center`,verticalAlign:`middle`,fill:c.textFill,padding:8,text:YK(i).toString()+`°`})]}),(0,j.jsxs)(Bm,{x:(l.minX+l.maxX)/2,y:l.maxY+20,visible:a!==`rotater`,children:[(0,j.jsx)(`Tag`,{cornerRadius:5,fill:c.fill,pointerDirection:`up`,pointerHeight:0,pointerWidth:0}),(0,j.jsx)(Gm,{align:`center`,verticalAlign:`middle`,fill:c.textFill,padding:8,text:f})]})]})}),ZK=B(({elements:e,store:t})=>{let n=e.filter(e=>e.alwaysOnTop),r=e.filter(e=>!e.alwaysOnTop).concat(n);return(0,j.jsx)(k.Fragment,{children:r.map(e=>(0,j.jsx)(OK,{store:t,element:e,onClick:()=>{console.warn(`Polotno warning: onClick callback is deprecated. Just stop using it. Polotno will do selection automatically.`)}},e.id))})}),QK=({store:e})=>{let[t,n]=k.useState(!1),[r,i]=k.useState({x:0,y:0});return{open:k.useCallback(e=>{n(!0),i(e)},[]),close:k.useCallback(()=>{n(!1)},[]),props:{isOpen:t,offset:r,setIsOpen:n}}},$K=null,eq=atob(`UG9sb3RubyBmcmVlIGxpY2Vuc2UgbGltaXRhdGlvbiBleGNlZWRlZCAtIFBsZWFzZSB1cGdyYWRlIHlvdXIgYWNjb3VudC4=`),tq=atob(`I2MwMzkyYg==`),nq=atob(`djAuOS4y`),rq=e=>(0,j.jsx)(j.Fragment,{children:(0,j.jsxs)(Bm,{fill:tq,height:200,children:[(0,j.jsx)(`Tag`,{fill:tq}),(0,j.jsx)(Gm,Object.assign({},e,{fill:`white`,text:eq,height:void 0,padding:10,fontSize:20}))]})}),iq=atob(`RlJFRSAgVFJJQUwgIExJQ0VOU0U=`),aq=(atob(`UG93ZXJlZCBieSBQb2xvdG5v`),atob(`TElDRU5TRSAgS0VZICBJUyAgTUlTU0lORw==`)),oq=atob(`UGxlYXNlIGFjdGl2YXRlIHlvdXIgbGljZW5zZS4KTGljZW5zZSByZWxhdGVkIHF1ZXN0aW9uczoKcG9sb3Ruby5jb20vY29udGFjdA==`),sq=e=>{let t=Uy()===1,n=t?aq:iq,r=t?230:195;return(0,j.jsxs)(zm,Object.assign({},e,{listening:!1,children:[(0,j.jsx)(Vm,{fill:tq,width:r,height:24,cornerRadius:2}),(0,j.jsx)(Gm,{text:n,fill:`white`,fontSize:13,fontFamily:`monospace`,width:r,align:`center`,y:5,listening:!1}),t&&(0,j.jsx)(`Text`,{text:oq,fill:`rgba(0,0,0,0.6)`,fontSize:14,y:30,listening:!1})]}))},cq=B(({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=yh(),p=f.transformerStyle,m=RK,h=t.computedBleed,g=e.bleedVisible?h:tp,_=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=k.useRef(null),S=k.useRef(null),C=k.useRef(null),w=k.useRef(null),T=i==null||i,E=k.useRef(!1),[D,O]=k.useState(null),[ee,A]=k.useState({}),[M,te]=k.useState(0),N=QK({store:e}),P=e.selectedElements.find(e=>e._cropModeEnabled),F=e.selectedElements.find(e=>e.curveEnabled),ne=e.selectedShapes.filter(e=>!e.resizable).length>0,re=e.selectedShapes.filter(e=>!e.draggable).length>0,ie=e.selectedElements.filter(e=>!e.visible).length>0,I=VK(e),ae=e.selectedElements.length!==1||e.selectedElements[0]?.type===`group`,oe=BK(I)??0,se=e=>ae&&I.length>0&&I.every(t=>((e,t,n)=>{if(!zK(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,oe)),ce=!ae&&e.selectedElements[0].keepRatio,le=se(`x`),L=se(`y`),ue=()=>{var t;let n=x.current;if(!n)return[];let r=n.getStage();if(!r)return[];let i=VK(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=UK[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`&&Oy.textVerticalResizeEnabled&&(l.enabledAnchors=UK.text.enabledAnchors?.concat([`bottom-center`,`top-center`])),s===`text`&&o&&e.selectedElements[0].curveEnabled&&(l.enabledAnchors=UK.many.enabledAnchors)),(le||L)&&(l.enabledAnchors=[...l.enabledAnchors||[],...le?[`middle-left`,`middle-right`]:[],...L?[`top-center`,`bottom-center`]:[]]),n.setAttrs(Object.assign(Object.assign({},l),p)),ne&&n.enabledAnchors([]),re&&n.rotateEnabled(!1);let u=n.nodes();if(u.length===a.length&&a.every((e,t)=>u[t]===e)||n.nodes(a),ae&&a.length){let e=BK(i);e===null||zK(n.rotation()-e)||(n.rotation(e),n.forceUpdate())}return(t=n.getLayer())==null||t.batchDraw(),a};k.useLayoutEffect(()=>{if(x.current?.isTransforming())return;let e=ue();e.find(e=>e?.isDragging())&&(e.forEach(e=>{e.isDragging()||e==null||e.startDrag()}),MG())},[e.selectedShapes,P,ne,ie,re,F,le,L,ce,oe,p]);let de=()=>{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})},fe=k.useCallback(()=>{if(x.current?.isTransforming())return;let e=x.current;if(!e||!e.nodes().length){te(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());te(i)},[d,n,r]);k.useEffect(()=>{var e;(e=x.current)==null||e.update(),de(),fe()},[e.scale,fe]),k.useEffect(()=>{fe()},[e.selectedShapes,fe]);let pe=Pa(()=>({visible:!1,x1:0,y1:0,x2:0,y2:0})),me=k.useRef(!1),he=fr(t=>{if(e.role===iM.VIEWER)return;me.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,pe.visible=!0,pe.x1=a.x,pe.y1=a.y,pe.x2=a.x,pe.y2=a.y,(t.target.getStage()?.getPointersPositions().length??0)>=2&&(pe.visible=!1))});(({stageRef:e,containerRef:t,viewportSize:n})=>{k.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}),k.useEffect(()=>{let t=fr(e=>{var t;if(!pe.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:pe.x2,y:pe.y2},pe.x2=n.x,pe.y2=n.y}),n=fr(()=>{if(!pe.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=$A(i.a).map(e=>s.point(e));ej(t,c)&&r.push(i.top.id)});let i=[...new Set(r)];me.current=!0,e.selectElements(i)}pe.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 ge=k.useCallback(n=>{if(!e.selectedElements[0]||n&&e.selectedElementsIds.includes(n))return;let r=tj(e.selectedShapes),i=QA(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]);k.useEffect(()=>{e.selectedElements[0]&&e.distanceGuidesVisible?ge():D&&O(null)},[e.distanceGuidesVisible,ge,e.selectedShapes.map(e=>`${e.x},${e.y},${e.width},${e.height},${e.rotation}`).join(`|`)]);let _e=k.useRef(!1);k.useEffect(()=>{let e,t=w.current?.closest(`.polotno-workspace-inner`),n=()=>{_e.current=!0,clearTimeout(e),e=setTimeout(()=>{_e.current=!1},300)};return t?.addEventListener(`scroll`,n),()=>{clearTimeout(e),t?.removeEventListener(`scroll`,n)}},[]),k.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 ve=n=>{if(e.role===iM.VIEWER||(e.activePage!==t&&t.select(),_e.current)||me.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||pe.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([]))};FG(x,e);let ye=e.activePage===t,be=e._selectedPagesIds.includes(t.id),xe=a?.PageControls,Se=a?.Tooltip,Ce=a?.ContextMenu,we=1/e.scale,Te=0/e.scale;return(0,j.jsxs)(`div`,{ref:w,onDragOver:e=>e.preventDefault(),onDrop:n=>{if(n.preventDefault(),e.role===iM.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];$K&&r&&($K(r,s,{elements:o,page:t}),$K=null)},style:{position:`relative`,width:n+`px`,height:r+`px`,overflow:`hidden`,flexShrink:0},className:`polotno-page-container`+(ye?` active-page`:``),children:[(0,j.jsx)(Zm,{ref:C,width:Math.min(n,c.width+200),height:Math.min(c.height+200,r),onClick:ve,onTap:ve,onContextMenu:t=>{if(t.evt.preventDefault(),e.role===iM.VIEWER)return;let n=t.target.findAncestor(`.element`,!0),r=e.getElementById(n?.id())?.top?.id;if(!r){e.selectElements([]),N.close();return}e.selectedElementsIds.indexOf(r)>=0||e.selectElements([r]),N.open({x:t.evt.clientX,y:t.evt.clientY})},onMouseDown:he,onMouseMove:t=>{if(!e.distanceGuidesVisible&&!t.evt.altKey){D&&O(null);return}let n=t.target.findAncestor(`.element`,!0)?.id();ge(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=ue();t.target.stopDrag(),r.forEach(e=>{e.isDragging()||e.startDrag(t)}),(n=x.current)==null||n.startDrag(t),MG()}}D&&O(null)},pageId:t.id,style:{position:`absolute`,overflow:`hidden`,top:0,left:0},children:(0,j.jsxs)(Rm,{children:[(0,j.jsx)(WK,{width:n,height:r,fill:f.workspaceBackgroundColor}),(0,j.jsx)(zm,{x:y,y:b,scaleX:e.scale,scaleY:e.scale,name:`page-container`,children:(0,j.jsxs)(zm,{name:`page-container-2`,children:[(0,j.jsx)(zm,{name:`page-background-group`,x:g.left,y:g.top,children:(0,j.jsx)(qK,{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,j.jsxs)(zm,{x:g.left,y:g.top,name:`elements-container`,listening:!e.isPlaying&&e.role!==iM.VIEWER,children:[(0,j.jsx)(Vm,{name:`elements-area`,width:t.computedWidth,height:t.computedHeight,listening:!1}),(0,j.jsx)(ZK,{elements:t.children,store:e})]}),(0,j.jsx)(Jm,{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`)}}),Vy()===nq&&(0,j.jsx)(rq,{name:`hit-detection`,x:-we/2-Te,y:-we/2-Te,width:_+we+2*Te,height:v+we+2*Te})]})}),(0,j.jsx)(Um,{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,j.jsx)(zm,{x:y,y:b,scaleX:e.scale,scaleY:e.scale,children:(0,j.jsx)(Vm,{name:`page-highlight`,hideInExport:!0,x:-we/2-Te,y:-we/2-Te,width:_+we+2*Te,height:v+we+2*Te,stroke:be?f.activePageBorderColor:f.pageBorderColor,strokeWidth:2,listening:!1,strokeScaleEnabled:!1})}),(0,j.jsxs)(zm,{x:y+g.left*e.scale,y:b+g.top*e.scale,scaleX:e.scale,scaleY:e.scale,name:`page-abs-container`,children:[(0,j.jsx)(Ym,{ref:x,rotateAnchorAngle:M,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),fe()},onTransformStart:()=>{e.history.startTransaction(),S.current=new Map(I.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),HK(l,n,t)}}return ae&&I.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=!DM(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?OM(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),HK(d,t,e)})(t,n,x.current?.getActiveAnchor()||``,I,S.current):n},onTransform:e=>{let t=x.current.nodes(),n=t[t.length-1];e.target===n&&setTimeout(()=>{de()},0)},onTransformEnd:t=>{A({}),e.history.endTransaction(),S.current=null,fe(),ue()},visible:!e.isPlaying}),D&&D.map(({points:t,distance:n,box1:r,box2:i},a)=>(0,j.jsxs)(`Group`,{name:`distances-container`,hideInExport:!0,listening:!1,children:[(0,j.jsx)(`Rect`,Object.assign({},r,{stroke:f.distanceGuideStyle.stroke,strokeWidth:1,strokeScaleEnabled:!1})),(0,j.jsx)(`Rect`,Object.assign({},i,{stroke:f.distanceGuideStyle.stroke,strokeWidth:1,strokeScaleEnabled:!1})),(0,j.jsx)(`Line`,{points:[t[0].x,t[0].y,t[1].x,t[1].y],stroke:f.distanceGuideStyle.stroke,strokeWidth:1,strokeScaleEnabled:!1}),(0,j.jsx)(`Line`,{points:[t[1].x,t[1].y,t[2].x,t[2].y],stroke:f.distanceGuideStyle.stroke,strokeWidth:1,strokeScaleEnabled:!1}),(0,j.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,j.jsx)(`Tag`,{cornerRadius:5,fill:f.distanceGuideStyle.labelFill,pointerDirection:`down`}),(0,j.jsx)(`Text`,{align:`center`,verticalAlign:`middle`,fill:f.distanceGuideStyle.labelTextFill,padding:5,text:wS({unit:e.unit,dpi:e.dpi,px:n})})]})]},a)),t._rendering&&(0,j.jsxs)(`Group`,{children:[(0,j.jsx)(`Rect`,{width:_,height:v,fill:`rgba(255,255,255,0.9)`}),(0,j.jsx)(`Text`,{text:`Rendering...`,fontSize:60,width:_,height:v,align:`center`,verticalAlign:`middle`})]}),Se&&(0,j.jsx)(Se,{components:a,store:e,page:t,stageRef:C,tooltipSafeArea:u}),Ce&&(0,j.jsx)(uM,{children:(0,j.jsx)(Ce,Object.assign({components:a,store:e},N.props))})]}),(0,j.jsx)(NK,{store:e,page:t,width:n,height:r,scale:e.scale,xPadding:y,yPadding:b,bleedLeft:g.left,bleedTop:g.top}),(0,j.jsx)(XK,Object.assign({},ee,{store:e})),(0,j.jsx)(JK,{selection:pe}),Uy()>0&&(0,j.jsxs)(`Group`,{hideInExport:!0,children:[(0,j.jsx)(sq,{name:`cache-bounds`,x:n-(Uy()===1?250:210),y:r-(Uy()===1?95:45)}),(0,j.jsx)(sq,{name:`cache-bounds-t`,x:10,y:10})]}),Wy()&&(0,j.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,j.jsx)(zm,{name:`line-guides`})]})}),T&&xe&&(0,j.jsx)(xe,{store:e,page:t,xPadding:y,yPadding:b,layout:l})]})}),lq=$W(`div`,k.forwardRef)`
|
|
602
|
+
position: absolute;
|
|
603
|
+
top: 0;
|
|
604
|
+
left: 0;
|
|
605
|
+
pointer-events: none;
|
|
606
|
+
`,uq=$W(`div`,k.forwardRef)`
|
|
607
|
+
height: 14px;
|
|
608
|
+
position: sticky;
|
|
609
|
+
font-size: 8px;
|
|
610
|
+
line-height: 14px;
|
|
611
|
+
top: 0;
|
|
612
|
+
left: 0;
|
|
613
|
+
color: grey;
|
|
614
|
+
border-bottom: 1px solid grey;
|
|
615
|
+
background-color: #e8e8e8;
|
|
616
|
+
overflow: hidden;
|
|
617
|
+
box-sizing: border-box;
|
|
618
|
+
`,dq=$W(`div`,k.forwardRef)`
|
|
619
|
+
left: 0;
|
|
620
|
+
width: 14px;
|
|
621
|
+
position: sticky;
|
|
622
|
+
font-size: 8px;
|
|
623
|
+
line-height: 14px;
|
|
624
|
+
color: grey;
|
|
625
|
+
border-right: 1px solid grey;
|
|
626
|
+
background-color: #e8e8e8;
|
|
627
|
+
overflow: hidden;
|
|
628
|
+
box-sizing: border-box;
|
|
629
|
+
`,fq=$W(`div`,k.forwardRef)`
|
|
630
|
+
position: absolute;
|
|
631
|
+
border-left: 1px solid grey;
|
|
632
|
+
padding-left: 2px;
|
|
633
|
+
`,pq=$W(`div`,k.forwardRef)`
|
|
634
|
+
position: absolute;
|
|
635
|
+
left: 14px;
|
|
636
|
+
border-left: 1px solid grey;
|
|
637
|
+
padding-left: 2px;
|
|
638
|
+
transform: rotate(90deg);
|
|
639
|
+
transform-origin: left top;
|
|
640
|
+
overflow: hidden;
|
|
641
|
+
`,mq=[.1,.2,.5,1,2,5,10,20,25,50,100,200,500,1e3,2e3,5e3,1e4],hq=B(({store:e,width:t,height:n,pageSizes:r,layout:i=`vertical`,renderOnlyActivePage:a})=>{let{rulerStyle:o}=yh(),s=k.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=>CS({unitVal:t,dpi:e.dpi,unit:e.unit})*e.scale,mq.find(e=>h(e)>30)||1e4);var h;let g=CS({unitVal:m,dpi:e.dpi,unit:e.unit})*e.scale,_=Math.round(u/g)+1,v=Math.round(d/g)+1,y=tj(e.selectedShapes),{backgroundColor:b,textColor:x,borderColor:S,borderSize:C,tickColor:w,tickSize:T}=o;return(0,j.jsx)(lq,{ref:s,className:`polotno-rulers`,style:{display:`flex`,flexDirection:`column`},children:(0,j.jsxs)(j.Fragment,c?{children:[(0,j.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,position:`sticky`,top:0,zIndex:1},children:[(0,j.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,j.jsxs)(uq,{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,j.jsx)(fq,{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,j.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,j.jsxs)(dq,{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,j.jsx)(pq,{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,j.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,j.jsxs)(uq,{style:{width:t+`px`,backgroundColor:b,color:x,borderBottom:`${C}px solid ${S}`},className:`polotno-x-ruler`,children:[[...Array(_)].map((t,n)=>(0,j.jsx)(fq,{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,j.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,j.jsxs)(dq,{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,j.jsx)(pq,{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,j.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)})]})})}),gq=B(({audio:e,store:t})=>{let[n,r]=function(e){let[t,n]=k.useState(null),[r,i]=k.useState(`loading`);return k.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=k.useMemo(KG,[n]);return k.useEffect(()=>{n&&t.history.ignore(()=>{e.set({duration:1e3*n.duration})})},[n,e,t.history]),k.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=fM(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 _q(e){return new Promise((t,n)=>{let r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)})}var vq={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 yq(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`:vq[e.name.split(`.`).pop()?.toLowerCase()??``]??null}function bq(e){return e.replace(/\.[^./\\]+$/,``)}var xq=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`),_q(e));function Sq(){return xq}var Cq=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 pw(e);if(n&&n.type===`image`&&n.contentEditable){let t=xw(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})},wq=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=xw(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 dk(e);t>r.activePage.duration&&r.activePage.set({duration:t})}catch(e){console.warn(`Failed to get video duration:`,e)}return u},Tq=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 pw(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})},Eq=async({src:e,droppedPos:t,store:n})=>{var r;let{width:i,height:a}=await pw(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})},Dq=async({url:e,type:t,store:n,droppedPos:r,targetElement:i,name:a})=>{let o=e;t===`image`?await Cq({src:o,store:n,droppedPos:r,targetElement:i}):t===`svg`?await Tq({src:o,store:n,droppedPos:r,targetElement:i}):t===`gif`?await Eq({src:o,store:n,droppedPos:r,targetElement:i}):t===`video`?await wq({src:o,store:n,droppedPos:r,targetElement:i}):t===`audio`&&n.addAudio({src:o,name:a?bq(a):``})},Oq=async({file:e,store:t,droppedPos:n})=>{let r=yq(e);if(!r){console.warn(`polotno: ignoring "${e.name}" — not an image, video or audio file`);return}await Dq({url:await Sq()(e),type:r,store:t,droppedPos:n,name:e.name})},kq={data:[],pageId:``,payloadId:``},Aq=`polotno_clipboard`,jq=(e,t,n)=>{kq={data:JSON.parse(JSON.stringify(e)),pageId:t||``,payloadId:n||``};try{localStorage.setItem(Aq,JSON.stringify(e)),localStorage.setItem(`polotno_clipboard_page`,t||``),localStorage.setItem(`polotno_clipboard_payload`,n||``)}catch{}},Mq=()=>{try{let e=localStorage.getItem(Aq),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 kq},Nq=`data-polotno-clipboard`,Pq=(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=[];Hj({children:i},e=>{e.type!==`group`&&t.push(e)});let a=tj(t);a.maxX>e.width&&(n=-a.minX),a.maxY>e.height&&(r=-a.minY)}let s=[];Hj({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)}),jq(i,e.activePage?.id,o),e.selectElements(s)})},Fq=e=>{Pq(e,Mq())},Iq=(e,t)=>{if(!t.clipboardData||e.selectedElements.length===0)return!1;let n=e.selectedElements.map(e=>e.toJSON()),r=xy(),i={v:1,id:r,pageId:e.activePage?.id||``,elements:n};t.clipboardData.setData(`text/html`,`<div ${Nq}="${(e=>gS(new TextEncoder().encode(JSON.stringify(e))))(i)}"></div>`);let a=[];return Hj({children:n},e=>{e.type===`text`&&a.push(ax(e.text))}),t.clipboardData.setData(`text/plain`,a.join(`
|
|
642
|
+
`)||` `),t.preventDefault(),jq(n,e.activePage?.id,r),!0},Lq=(e,t)=>{let n=Iq(e,t);if(n){let t=e.selectedElements.filter(e=>e.removable).map(e=>e.id);e.deleteElements(t)}return n},Rq=(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))},zq=(e,t,n={})=>{let r=t.clipboardData;if(!r)return!1;let i=r.getData(`text/html`);if(i&&i.includes(Nq)){let n=(e=>{try{let t=new DOMParser().parseFromString(e,`text/html`).querySelector(`[${Nq}]`)?.getAttribute(Nq);if(!t)return null;let n=JSON.parse(new TextDecoder().decode(hS(t)));return Array.isArray(n.elements)?n:null}catch{return null}})(i);if(n){t.preventDefault();let r=Mq();return n.id&&n.id===r.payloadId?Pq(e,r):Pq(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 Oq({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=Rq(e,(e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`))(o));t&&e.selectElements([t.id])}return!0}return r.types.length===0&&Mq().data.length!==0&&(t.preventDefault(),Fq(e),!0)};function Bq(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 Vq=e=>{if(e.type!==`group`)return QA(e);let t=1/0,n=1/0,r=-1/0,i=-1/0;return e.children.forEach(e=>{let a=Vq(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}},Hq=(e,t,n)=>{if(e.type!==`group`){let r=QA(e),i=t-r.x,a=n-r.y;e.set({x:e.x+i,y:e.y+a})}else{let r=t-Vq(e).x,i=n-Vq(e).y;e.children.forEach(e=>{let t=Vq(e);Hq(e,t.x+r,t.y+i)})}};function Uq(e){let t=e.activePage?.computedWidth;e.selectedElements.forEach(e=>{t=Math.min(t,Vq(e).x)}),e.selectedElements.length===1&&(t=0),e.selectedElements.forEach(e=>{let n=Vq(e);Hq(e,n.x-n.x+t,n.y)})}function Wq(e){let t=0;e.selectedElements.forEach(e=>{let n=Vq(e);t=Math.max(t,n.x+n.width)}),e.selectedElements.length===1&&(t=e.activePage?.computedWidth),e.selectedElements.forEach(e=>{let n=Vq(e);Hq(e,t-n.width,n.y)})}function Gq(e){let t=e.activePage?.computedHeight;e.selectedElements.forEach(e=>{t=Math.min(t,Vq(e).y)}),e.selectedElements.length===1&&(t=0),e.selectedElements.forEach(e=>{let n=Vq(e);Hq(e,n.x,n.y-n.y+t)})}function Kq(e){let t=e.activePage?.computedHeight,n=0;e.selectedElements.forEach(e=>{let r=Vq(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=Vq(e);Hq(e,t.x,r-t.height/2)})}function qq(e){let t=0;e.selectedElements.forEach(e=>{let n=Vq(e);t=Math.max(t,n.y+n.height)}),e.selectedElements.length===1&&(t=e.activePage?.computedHeight),e.selectedElements.forEach(e=>{let n=Vq(e);Hq(e,n.x,t-n.height)})}function Jq(e){let t=e.activePage?.computedWidth,n=0;e.selectedElements.forEach(e=>{let r=Vq(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=Vq(e);Hq(e,r-t.width/2,t.y)})}var Yq=`rgba(191, 191, 191, 100)`;function Xq(e){if(e.selectedElements.length!==1)return null;let t=e.selectedElements[0];return t.type===`table`?t:null}function Zq(e,t,n){let r=e.getCell(t,n);r&&e.focusCell(r.id)}function Qq(e,t,n){let r=e.getCell(t,n);r&&e.enterCellEdit(r.id)}function $q(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 eJ(e){if(e.role===iM.VIEWER)return{handle:!1,table:null};let t=$q();if(t.activeIsEditable||t.hasOutsideTextSelection)return{handle:!1,table:null};let n=Xq(e);return{handle:!0,table:n&&n._focusedCellIds.length>0&&!n._editingCellId?n:null}}function tJ(e,t){var n,r,i;if(t.role===iM.VIEWER)return;let a=$q(),o=a.activeIsEditable&&!a.activeIsInsideWorkspace,s=Xq(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),Qq(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),Qq(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:Ib(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),Zq(t,n,e)}else{let e=s+1,n=o;e>=t.cols&&(n+=1,e=0),n>=t.rows&&(n=0,e=0),Zq(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`&&Zq(t,o,Math.min(s+1,t.cols-1)),e.key===`ArrowLeft`&&Zq(t,o,Math.max(s-1,0)),e.key===`ArrowDown`&&Zq(t,Math.min(o+1,t.rows-1),s),e.key===`ArrowUp`&&Zq(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(),Bq(t.selectedElements,t)),e.code!==`KeyT`||l||(e.preventDefault(),Rq(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:Yq,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:Yq};(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:Yq,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(),Uq(t)),e.code===`KeyD`&&(e.preventDefault(),Wq(t)),e.code===`KeyS`&&(e.preventDefault(),qq(t)),e.code===`KeyW`&&(e.preventDefault(),Gq(t)),e.code===`KeyV`&&(e.preventDefault(),Kq(t)),e.code===`KeyH`&&(e.preventDefault(),Jq(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=>ax(e.text)).join(`
|
|
643
|
+
`);t.clipboardData.setData(`text/plain`,n||` `),t.preventDefault()}function rJ(e,t){let n=eJ(t);n.handle&&e.clipboardData&&(n.table?nJ(n.table,e):Iq(t,e))}function iJ(e,t){let n=eJ(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}Lq(t,e)}}function aJ(e,t){let n=eJ(t);if(!n.handle)return;let r=n.table;zq(t,e,{onText:r?e=>r.focusedCells[0]?.set({text:e}):void 0})}var oJ=Zt({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`}}),sJ=e=>e&&typeof e==`object`;function cJ(e,t){Object.keys(t).forEach(n=>{let r=e[n],i=t[n];sJ(i)&&sJ(r)?cJ(r,i):e[n]=i})}function lJ(e,t,n=``){Object.keys(t).forEach(r=>{let i=t[r],a=n?`${n}.${r}`:r;sJ(i)?sJ(e[r])?lJ(e[r],i,a):console.warn(`Missing nested translation object at '${a}'`):e[r]===void 0&&console.warn(`Missing translation '${a}'`)})}fr((e,{validate:t=!1}={})=>{t&&lJ(e,oJ),cJ(oJ,e)});var uJ={},dJ=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}(oJ,e);if(t!==void 0)return t;uJ[e]||(uJ[e]=!0,console.warn(`Missing translation '${e}'`));let n=e.split(`.`),r=n[n.length-1]||` `;return r.charAt(0).toUpperCase()+r.slice(1)},fJ=(e,t,n)=>Math.max(t,Math.min(n,e)),pJ=(e,t)=>Math.sqrt((t.clientX-e.clientX)**2+(t.clientY-e.clientY)**2),mJ=({store:e})=>(0,j.jsxs)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,textAlign:`center`},children:[(0,j.jsx)(`p`,{children:dJ(`workspace.noPages`)}),(0,j.jsx)(`button`,{onClick:()=>{e.addPage()},children:dJ(`workspace.addPage`)})]}),hJ=({width:e,height:t,xPadding:n,yPadding:r,backgroundColor:i})=>(0,j.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,j.jsx)(`div`,{style:{width:` 100%`,height:`100%`,backgroundColor:`white`}})}),gJ=B(({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:ee,rulerBorderSize:A,rulerTickColor:M,rulerTickSize:te,components:N,onKeyDown:P,onPaste:F,paddingX:ne,paddingY:re,pageGap:ie,altCloneEnabled:I=!0,groupSelectionMode:ae=`drill`,visiblePagesOffset:oe,renderOnlyActivePage:se,scrollToPageThreshold:ce=.5,tooltipSafeArea:le})=>{let L=t===`horizontal`,ue=ne??20,de=re??55,[fe,pe]=k.useState({width:100,height:100}),me=k.useRef(fe),he=k.useRef(null),ge=k.useRef(null),_e=k.useRef(0),ve=0,ye=0,be=0,xe=0;if(e.bleedVisible)for(let t of e.pages){let e=t.computedBleed;ve=Math.max(ve,e.left),ye=Math.max(ye,e.right),be=Math.max(be,e.top),xe=Math.max(xe,e.bottom)}let Se=Math.max(...e.pages.map(e=>e.computedWidth)),Ce=Math.max(...e.pages.map(e=>e.computedHeight)),we=e.activePage?.computedHeight||0,Te=Se+ve+ye,Ee=(se?we:Ce)+be+xe,De=async({skipTimeout:t}={skipTimeout:!1})=>{if(t||await new Promise(e=>setTimeout(e,50)),he.current===null||!Number.isFinite(Te)||!Number.isFinite(Ee))return;let n=he.current.getBoundingClientRect();n.width!==0&&n.height!==0||(console.warn(`Polotno warning: <Workspace /> component can not automatically detect its size.
|
|
644
|
+
Width or height of parent elements is equal 0.
|
|
645
|
+
Please make sure it has non-zero size. You may need to adjust it with your styles. <Workspace /> will automatically fit into parent container.
|
|
646
|
+
For simpler debugging here is the log of the parent element:`),console.log(he.current));let r=ge.current.clientWidth||n.width,i={width:r,height:n.height};(me.current.width!==i.width||me.current.height!==i.height)&&(pe(i),me.current=i);let a=(r-2*ue)/Te,o=e.pages.length>1?3.1:2,s=(n.height-de*o)/Ee,c=e.pages.length>1?3.1:2,l=(r-ue*c)/Te,u=(n.height-2*de)/Ee,d=e.pages.length?Math.max(Math.min(L?l:a,L?u:s),.01):1;e.scaleToFit!==d&&(e.setScale(d),e._setScaleToFit(d))};k.useLayoutEffect(()=>{De({skipTimeout:!0})},[]),k.useEffect(()=>{De()},[Te,Ee,re,ne]),k.useLayoutEffect(()=>{De({skipTimeout:!0})},[e.openedSidePanel]),k.useEffect(()=>{e.__()},[]),k.useEffect(()=>{let e=he.current;if(window.ResizeObserver){let t=new ResizeObserver(()=>{De({skipTimeout:!0})});return t.observe(e),()=>t.unobserve(e)}{let e=setInterval(()=>{De({skipTimeout:!0})},100);return()=>clearInterval(e)}},[Te,Ee]);let Oe=se?1:e.pages.length,ke,Ae;if(L){let t=Te*e.scale*Oe;ke=Math.max(ue,(fe.width-t)/Oe/2),Ae=Math.max(de,(fe.height-Ee*e.scale)/2)}else{ke=Math.max(ue,(fe.width-Te*e.scale)/2);let t=Ee*e.scale*Oe;Ae=Math.max(de,(fe.height-t)/Oe/2)}Number.isNaN(ke)&&(ke=ue),Number.isNaN(Ae)&&(Ae=de),k.useEffect(()=>{let t=t=>{(P||tJ)(t,e)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[]),k.useEffect(()=>{let t=t=>rJ(t,e),n=t=>iJ(t,e),r=t=>(F||aJ)(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)}},[F]),k.useEffect(()=>{let t=t=>{if(t.ctrlKey||t.metaKey){t.preventDefault();let n=Math.max(5,e.scaleToFit),r=Math.min(.1,e.scaleToFit);L&&Te>0&&Number.isFinite(Te)&&(r=Math.max(r,300/Te)),r=Math.max(r,.01);let i=fJ(t.deltaY<0?e.scale*1.03:e.scale/1.03,r,n);e.setScale(i);return}},n=ge.current;return n?.addEventListener(`wheel`,t),()=>n?.removeEventListener(`wheel`,t)},[L,Te,e]),k.useEffect(()=>{let t=ge.current;if(!t)return;let n=e=>{e.touches.length===2&&(_e.current=pJ(e.touches[0],e.touches[1]))},r=n=>{if(n.touches.length===2&&_e.current>0){n.preventDefault();let r=pJ(n.touches[0],n.touches[1]),i=r/_e.current,a=Math.max(5,e.scaleToFit),o=Math.min(.1,e.scaleToFit);L&&Te>0&&Number.isFinite(Te)&&(o=Math.max(o,300/Te)),o=Math.max(o,.01);let s=e.scale,c=fJ(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;Le.current=!0,e.setScale(c),t.scrollLeft=p*l-d,t.scrollTop=m*l-f,_e.current=r}},i=()=>{_e.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)}},[L,Te,e]);let je=ie!==void 0,Me=e.pages.map(t=>{if(L){let n=(t.computedWidth+ve+ye)*e.scale;return je?n+ie:n+2*ke}{let n=(t.computedHeight+be+xe)*e.scale;return je?n+ie:n+2*Ae}}),Ne=[],Pe=je?L?ke:Ae:0;for(let e=0;e<Me.length;e++)Ne.push(Pe),Pe+=Me[e];let Fe=Me.reduce((e,t)=>e+t,0),Ie=je?Fe+(L?2*ke:2*Ae):Fe,Le=k.useRef(!1),[,Re]=k.useReducer(e=>e+1,0);((e,t,n,r,i)=>{let a=k.useRef(0),o=k.useRef(0),s=k.useRef(null),c=k.useRef(null),l=k.useRef(!1),u=k.useRef(r.pages.length);l.current=u.current!==r.pages.length,u.current=r.pages.length,k.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)}},[]),k.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=fJ(f*t.scrollWidth-u/2,0,m),t.scrollTop=fJ(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])})(ge,Ie,e.scale,e,Le);let{handleScroll:ze}=((e,t,n,r,i,a,o,s,c,l)=>{let u=k.useRef(!1),d=k.useRef(null),f=k.useRef(!1),p=c===`horizontal`;k.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 k.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()}}})(ge,Ne,Me,e,ce,fe,Le,se,t,Re),Be=fe.width>=Te*e.scale+2*ke,Ve=fe.height>=Ee*e.scale+2*Ae,He=r||`rgba(232, 232, 232, 0.9)`,Ue=N?.NoPages||mJ,We=L?fe.width:fe.height,Ge=ge.current?L?ge.current.scrollLeft:ge.current.scrollTop:0,Ke=e=>{for(let t=Ne.length-1;t>=0;t--)if(e>=Ne[t])return t;return 0},qe=Math.max(0,Ke(Ge)),R=Math.min(e.pages.length-1,Ke(Ge+We)),Je=oe??1,Ye=Math.max(0,qe-Je),Xe=Math.min(e.pages.length-1,R+Je),Ze=wh({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:ee,rulerBorderSize:A,rulerTickColor:M,rulerTickSize:te});return(0,j.jsx)(vh,{value:Ze,children:(0,j.jsx)(`div`,{ref:he,style:{width:`100%`,height:`100%`,position:`relative`,outline:`none`,flex:1,backgroundColor:He,overflow:`hidden`},tabIndex:0,className:`polotno-workspace-container`,children:(0,j.jsxs)(`div`,{ref:ge,onScroll:ze,style:Object.assign({position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,display:`flex`,flexDirection:L?`row`:`column`,overflow:`auto`,overflowX:L?`auto`:Be?`hidden`:`auto`,overflowY:L&&Ve?`hidden`:`auto`},je&&{paddingTop:L?0:Ae,paddingBottom:L?0:Ae,paddingLeft:L?ke:0,paddingRight:L?ke:0,boxSizing:`border-box`}),className:`polotno-workspace-inner`,children:[e.pages.map((r,i)=>{let a=r===e.activePage;if(se&&!a&&!r._exportingOrRendering&&!r._forceMount)return null;let o=a||i>=Ye&&i<=Xe||r._exportingOrRendering||r._forceMount,s=L?Me[i]:Te*e.scale+2*ke,c=L?Ee*e.scale+2*Ae:Me[i];if(!o)return(0,j.jsx)(`div`,{style:{flexShrink:0},children:(0,j.jsx)(hJ,{width:s,height:c,backgroundColor:He,xPadding:ke,yPadding:Ae})},r.id);let l=(0,j.jsx)(cq,{page:r,xPadding:ke,yPadding:Ae,width:s,height:c,store:e,pageControlsEnabled:n,altCloneEnabled:I,groupSelectionMode:ae,components:N,viewportSize:fe,layout:t,tooltipSafeArea:le},r.id);return(r._exportingOrRendering||r._forceMount)&&!a&&se?(0,j.jsx)(`div`,{style:{display:`none`,flexShrink:0},children:l},r.id):l}),e.rulesVisible&&(0,j.jsx)(hq,{store:e,xPadding:ke,yPadding:Ae,width:Te*e.scale+2*ke,height:Ee*e.scale+2*Ae,pageSizes:Me,layout:t,renderOnlyActivePage:se}),e.pages.length===0&&(0,j.jsx)(Ue,{store:e}),e.audios.map(t=>(0,j.jsx)(gq,{audio:t,store:e},t.id))]})})})});v.prototype._requestDraw=()=>{},nb(!1),Ly(`change-font-size`),Ay(!0);var _J=oM({key:new URLSearchParams(location.search).get(`key`)});window.store=_J;var vJ=null;window.__polotnoLoadJspdf=async()=>(vJ||=y(()=>import(`./jspdf.es.min-87BhH7b6.js`),__vite__mapDeps([0,1,2,3]),import.meta.url),await vJ);var yJ=null;window.__polotnoLoadVideoExport=async()=>(yJ||=y(()=>import(`./lib-BEzl6SFD.js`),__vite__mapDeps([4,1,5]),import.meta.url),await yJ),window.config={addGlobalFont:Kx,setRichTextEnabled:Py,setTextVerticalResizeEnabled:Ay,setTextOverflow:Ly,onLoadError:gb,setAssetLoadTimeout:cb,setFontLoadTimeout:ub,unstable_setTextSplitAllowed:Ry,setRenderTagTextEnabled:Fy,setLegacyRichTextEnabled:Ny},A.createRoot(document.getElementById(`root`)).render(k.createElement(gJ,{visiblePagesOffset:0,renderOnlyActivePage:!0,store:_J,components:{PageControls:()=>null,Tooltip:()=>null}}));
|