polotno-node 3.2.0 → 3.3.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/LICENSE.md +20 -6
- package/README.md +31 -15
- package/dist/assets/html2canvas-DCcDvdvP.js +5 -0
- package/dist/assets/id3-CBTtHQkE.js +16 -0
- package/dist/assets/index-Brevyr6F.js +653 -0
- package/dist/assets/index.es-5v7ubLSO.js +5 -0
- package/dist/assets/jspdf.es.min-87BhH7b6.js +79 -0
- package/dist/assets/lib-C8V7BvzS.js +1 -0
- package/dist/assets/preload-helper-HclGiUj8.js +1 -0
- package/dist/assets/purify.es-JEAr64Sr.js +3 -0
- package/dist/assets/{rolldown-runtime-QTnfLwEv.js → rolldown-runtime-hePW80VL.js} +1 -1
- package/dist/index.html +4 -2
- package/lib/index.d.ts +3 -3
- package/lib/index.js +23 -101
- package/lib/instance.d.ts +6 -1
- package/lib/instance.js +97 -36
- package/lib/launch-options.d.ts +31 -0
- package/lib/launch-options.js +124 -0
- package/lib/ssrf-guard.d.ts +15 -0
- package/lib/ssrf-guard.js +132 -0
- package/lib/types.d.ts +23 -1
- package/package.json +13 -13
- package/dist/assets/html2canvas-BfZ04V3R.js +0 -5
- package/dist/assets/index-j-YZMZrC.js +0 -668
- package/dist/assets/index.es-DYERYDqN.js +0 -5
- package/dist/assets/jspdf.es.min-EyQhoXfa.js +0 -79
- package/dist/assets/lib-BguUsusU.js +0 -1
- package/dist/assets/purify.es-BT_A-1xG.js +0 -3
|
@@ -0,0 +1,653 @@
|
|
|
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-C8V7BvzS.js","./id3-CBTtHQkE.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-CBTtHQkE.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=[],I=-1;function L(e){return{current:e}}function R(e){0>I||(e.current=re[I],re[I]=null,I--)}function ie(e,t){I++,re[I]=e.current,e.current=t}var ae=L(null),oe=L(null),se=L(null),z=L(null);function ce(e,t){switch(ie(se,t),ie(oe,e),ie(ae,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Yd(t),e=Xd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(ae),ie(ae,e)}function le(){R(ae),R(oe),R(se)}function ue(e){e.memoizedState!==null&&ie(z,e);var t=ae.current,n=Xd(t,e.type);t!==n&&(ie(oe,e),ie(ae,n))}function de(e){oe.current===e&&(R(ae),R(oe)),z.current===e&&(R(z),op._currentValue=ne)}var fe,pe;function me(e){if(fe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);fe=t&&t[1]||``,pe=-1<e.stack.indexOf(`
|
|
3
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
+
`+fe+e+pe}var he=!1;function ge(e,t){if(!e||he)return``;he=!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{he=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?me(n):``}function _e(e,t){switch(e.tag){case 26:case 27:case 5:return me(e.type);case 16:return me(`Lazy`);case 13:return e.child!==t&&t!==null?me(`Suspense Fallback`):me(`Suspense`);case 19:return me(`SuspenseList`);case 0:case 15:return ge(e.type,!1);case 11:return ge(e.type.render,!1);case 1:return ge(e.type,!0);case 31:return me(`Activity`);default:return``}}function ve(e){try{var t=``,n=null;do t+=_e(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
+
Error generating stack: `+e.message+`
|
|
9
|
+
`+e.stack}}var ye=Object.prototype.hasOwnProperty,be=t.unstable_scheduleCallback,xe=t.unstable_cancelCallback,Se=t.unstable_shouldYield,Ce=t.unstable_requestPaint,we=t.unstable_now,Te=t.unstable_getCurrentPriorityLevel,Ee=t.unstable_ImmediatePriority,De=t.unstable_UserBlockingPriority,Oe=t.unstable_NormalPriority,ke=t.unstable_LowPriority,Ae=t.unstable_IdlePriority,je=t.log,Me=t.unstable_setDisableYieldValue,Ne=null,Pe=null;function Fe(e){if(typeof je==`function`&&Me(e),Pe&&typeof Pe.setStrictMode==`function`)try{Pe.setStrictMode(Ne,e)}catch{}}var Ie=Math.clz32?Math.clz32:ze,Le=Math.log,Re=Math.LN2;function ze(e){return e>>>=0,e===0?32:31-(Le(e)/Re|0)|0}var Be=256,Ve=262144,He=4194304;function Ue(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 We(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=Ue(n))):i=Ue(o):i=Ue(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ue(n))):i=Ue(o)):i=Ue(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 Ge(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ke(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 qe(){var e=He;return He<<=1,!(He&62914560)&&(He=4194304),e}function Je(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ye(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Xe(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ie(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ze(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ze(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ie(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Qe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ie(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function $e(e,t){var n=t&-t;return n=n&42?1:et(n),(n&(e.suspendedLanes|t))===0?n:0}function et(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function tt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function nt(){var e=F.p;return e===0?(e=window.event,e===void 0?32:Sp(e.type)):e}function rt(e,t){var n=F.p;try{return F.p=e,t()}finally{F.p=n}}var it=Math.random().toString(36).slice(2),at=`__reactFiber$`+it,ot=`__reactProps$`+it,st=`__reactContainer$`+it,ct=`__reactEvents$`+it,lt=`__reactListeners$`+it,ut=`__reactHandles$`+it,dt=`__reactResources$`+it,ft=`__reactMarker$`+it;function pt(e){delete e[at],delete e[ot],delete e[ct],delete e[lt],delete e[ut]}function mt(e){var t=e[at];if(t)return t;for(var n=e.parentNode;n;){if(t=n[st]||n[at]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=yf(e);e!==null;){if(n=e[at])return n;e=yf(e)}return t}e=n,n=e.parentNode}return null}function ht(e){if(e=e[at]||e[st]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function gt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function _t(e){var t=e[dt];return t||=e[dt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function vt(e){e[ft]=!0}var yt=new Set,bt={};function xt(e,t){St(e,t),St(e+`Capture`,t)}function St(e,t){for(bt[e]=t,e=0;e<t.length;e++)yt.add(t[e])}var Ct=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),wt={},Tt={};function Et(e){return ye.call(Tt,e)?!0:ye.call(wt,e)?!1:Ct.test(e)?Tt[e]=!0:(wt[e]=!0,!1)}function Dt(e,t,n){if(Et(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function Ot(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function kt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function At(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function jt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Mt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Nt(e){if(!e._valueTracker){var t=jt(e)?`checked`:`value`;e._valueTracker=Mt(e,t,``+e[t])}}function Pt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=jt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Ft(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var It=/[\n"\\]/g;function Lt(e){return e.replace(It,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Rt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+At(t)):e.value!==``+At(t)&&(e.value=``+At(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Bt(e,o,At(n)):Bt(e,o,At(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+At(s):e.removeAttribute(`name`)}function zt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Nt(e);return}n=n==null?``:``+At(n),t=t==null?n:``+At(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Nt(e)}function Bt(e,t,n){t===`number`&&Ft(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Vt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+At(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ht(e,t,n){if(t!=null&&(t=``+At(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+At(n)}function Ut(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(N(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=At(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Nt(e)}function Wt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Gt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Kt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Gt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function qt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Kt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Kt(e,o,t[o])}function Jt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Yt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Xt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Zt(e){return Xt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Qt(){}var $t=null;function en(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var tn=null,nn=null;function rn(e){var t=ht(e);if(t&&(e=t.stateNode)){var n=e[ot]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Rt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Lt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[ot]||null;if(!a)throw Error(i(90));Rt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Pt(r)}break a;case`textarea`:Ht(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Vt(e,!!n.multiple,t,!1)}}}var an=!1;function on(e,t,n){if(an)return e(t,n);an=!0;try{return e(t)}finally{if(an=!1,(tn!==null||nn!==null)&&(Du(),tn&&(t=tn,e=nn,nn=tn=null,rn(t),e)))for(t=0;t<e.length;t++)rn(e[t])}}function sn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[ot]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var cn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),ln=!1;if(cn)try{var un={};Object.defineProperty(un,"passive",{get:function(){ln=!0}}),window.addEventListener(`test`,un,un),window.removeEventListener(`test`,un,un)}catch{ln=!1}var dn=null,fn=null,pn=null;function mn(){if(pn)return pn;var e,t=fn,n=t.length,r,i=`value`in dn?dn.value:dn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return pn=i.slice(e,1<r?1-r:void 0)}function hn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function gn(){return!0}function _n(){return!1}function vn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?gn:_n,this.isPropagationStopped=_n,this}return f(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=gn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=gn)},persist:function(){},isPersistent:gn}),t}var yn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bn=vn(yn),xn=f({},yn,{view:0,detail:0}),Sn=vn(xn),Cn,wn,Tn,En=f({},xn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:In,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Tn&&(Tn&&e.type===`mousemove`?(Cn=e.screenX-Tn.screenX,wn=e.screenY-Tn.screenY):wn=Cn=0,Tn=e),Cn)},movementY:function(e){return`movementY`in e?e.movementY:wn}}),Dn=vn(En),On=vn(f({},En,{dataTransfer:0})),kn=vn(f({},xn,{relatedTarget:0})),An=vn(f({},yn,{animationName:0,elapsedTime:0,pseudoElement:0})),jn=vn(f({},yn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Mn=vn(f({},yn,{data:0})),Nn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Pn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},B={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Fn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=B[e])?!!t[e]:!1}function In(){return Fn}var Ln=vn(f({},xn,{key:function(e){if(e.key){var t=Nn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=hn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Pn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:In,charCode:function(e){return e.type===`keypress`?hn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?hn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Rn=vn(f({},En,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),zn=vn(f({},xn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:In})),Bn=vn(f({},yn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Vn=vn(f({},En,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Hn=vn(f({},yn,{newState:0,oldState:0})),Un=[9,13,27,32],Wn=cn&&`CompositionEvent`in window,Gn=null;cn&&`documentMode`in document&&(Gn=document.documentMode);var Kn=cn&&`TextEvent`in window&&!Gn,qn=cn&&(!Wn||Gn&&8<Gn&&11>=Gn),Jn=` `,Yn=!1;function Xn(e,t){switch(e){case`keyup`:return Un.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Zn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Qn=!1;function $n(e,t){switch(e){case`compositionend`:return Zn(t);case`keypress`:return t.which===32?(Yn=!0,Jn):null;case`textInput`:return e=t.data,e===Jn&&Yn?null:e;default:return null}}function er(e,t){if(Qn)return e===`compositionend`||!Wn&&Xn(e,t)?(e=mn(),pn=fn=dn=null,Qn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return qn&&t.locale!==`ko`?null:t.data;default:return null}}var tr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function nr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!tr[e.type]:t===`textarea`}function rr(e,t,n,r){tn?nn?nn.push(r):nn=[r]:tn=r,t=Nd(t,`onChange`),0<t.length&&(n=new bn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var ir=null,ar=null;function or(e){G(e,0)}function sr(e){if(Pt(gt(e)))return e}function cr(e,t){if(e===`change`)return t}var lr=!1;if(cn){var ur;if(cn){var dr=`oninput`in document;if(!dr){var fr=document.createElement(`div`);fr.setAttribute(`oninput`,`return;`),dr=typeof fr.oninput==`function`}ur=dr}else ur=!1;lr=ur&&(!document.documentMode||9<document.documentMode)}function pr(){ir&&(ir.detachEvent(`onpropertychange`,mr),ar=ir=null)}function mr(e){if(e.propertyName===`value`&&sr(ar)){var t=[];rr(t,ar,e,en(e)),on(or,t)}}function hr(e,t,n){e===`focusin`?(pr(),ir=t,ar=n,ir.attachEvent(`onpropertychange`,mr)):e===`focusout`&&pr()}function gr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return sr(ar)}function _r(e,t){if(e===`click`)return sr(t)}function vr(e,t){if(e===`input`||e===`change`)return sr(t)}function yr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var br=typeof Object.is==`function`?Object.is:yr;function xr(e,t){if(br(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!ye.call(t,i)||!br(e[i],t[i]))return!1}return!0}function Sr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Cr(e,t){var n=Sr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Sr(n)}}function wr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ft(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ft(e.document)}return t}function Er(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Dr=cn&&`documentMode`in document&&11>=document.documentMode,Or=null,kr=null,Ar=null,jr=!1;function Mr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;jr||Or==null||Or!==Ft(r)||(r=Or,`selectionStart`in r&&Er(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ar&&xr(Ar,r)||(Ar=r,r=Nd(kr,`onSelect`),0<r.length&&(t=new bn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Or)))}function Nr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Pr={animationend:Nr(`Animation`,`AnimationEnd`),animationiteration:Nr(`Animation`,`AnimationIteration`),animationstart:Nr(`Animation`,`AnimationStart`),transitionrun:Nr(`Transition`,`TransitionRun`),transitionstart:Nr(`Transition`,`TransitionStart`),transitioncancel:Nr(`Transition`,`TransitionCancel`),transitionend:Nr(`Transition`,`TransitionEnd`)},Fr={},Ir={};cn&&(Ir=document.createElement(`div`).style,`AnimationEvent`in window||(delete Pr.animationend.animation,delete Pr.animationiteration.animation,delete Pr.animationstart.animation),`TransitionEvent`in window||delete Pr.transitionend.transition);function Lr(e){if(Fr[e])return Fr[e];if(!Pr[e])return e;var t=Pr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ir)return Fr[e]=t[n];return e}var Rr=Lr(`animationend`),zr=Lr(`animationiteration`),Br=Lr(`animationstart`),Vr=Lr(`transitionrun`),Hr=Lr(`transitionstart`),Ur=Lr(`transitioncancel`),Wr=Lr(`transitionend`),Gr=new Map,Kr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Kr.push(`scrollEnd`);function qr(e,t){Gr.set(e,t),xt(t,[e])}var Jr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Yr=[],Xr=0,Zr=0;function Qr(){for(var e=Xr,t=Zr=Xr=0;t<e;){var n=Yr[t];Yr[t++]=null;var r=Yr[t];Yr[t++]=null;var i=Yr[t];Yr[t++]=null;var a=Yr[t];if(Yr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ni(n,i,a)}}function $r(e,t,n,r){Yr[Xr++]=e,Yr[Xr++]=t,Yr[Xr++]=n,Yr[Xr++]=r,Zr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ei(e,t,n,r){return $r(e,t,n,r),ri(e)}function ti(e,t){return $r(e,null,null,t),ri(e)}function ni(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ie(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ri(e){if(50<vu)throw vu=0,yu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ii={};function ai(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function oi(e,t,n,r){return new ai(e,t,n,r)}function si(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ci(e,t){var n=e.alternate;return n===null?(n=oi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function li(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ui(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)si(e)&&(s=1);else if(typeof e==`string`)s=Zf(e,n,ae.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case ee:return e=oi(31,n,t,a),e.elementType=ee,e.lanes=o,e;case g:return di(n.children,a,o,t);case _:s=8,a|=24;break;case v:return e=oi(12,n,t,a|2),e.elementType=v,e.lanes=o,e;case w:return e=oi(13,n,t,a),e.elementType=w,e.lanes=o,e;case E:return e=oi(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=oi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function di(e,t,n,r){return e=oi(7,e,r,t),e.lanes=n,e}function fi(e,t,n){return e=oi(6,e,null,t),e.lanes=n,e}function pi(e){var t=oi(18,null,null,0);return t.stateNode=e,t}function mi(e,t,n){return t=oi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var hi=new WeakMap;function gi(e,t){if(typeof e==`object`&&e){var n=hi.get(e);return n===void 0?(t={value:e,source:t,stack:ve(t)},hi.set(e,t),t):n}return{value:e,source:t,stack:ve(t)}}var _i=[],vi=0,yi=null,bi=0,xi=[],Si=0,Ci=null,wi=1,Ti=``;function Ei(e,t){_i[vi++]=bi,_i[vi++]=yi,yi=e,bi=t}function Di(e,t,n){xi[Si++]=wi,xi[Si++]=Ti,xi[Si++]=Ci,Ci=e;var r=wi;e=Ti;var i=32-Ie(r)-1;r&=~(1<<i),n+=1;var a=32-Ie(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,wi=1<<32-Ie(t)+i|n<<i|r,Ti=a+e}else wi=1<<a|n<<i|r,Ti=e}function Oi(e){e.return!==null&&(Ei(e,1),Di(e,1,0))}function ki(e){for(;e===yi;)yi=_i[--vi],_i[vi]=null,bi=_i[--vi],_i[vi]=null;for(;e===Ci;)Ci=xi[--Si],xi[Si]=null,Ti=xi[--Si],xi[Si]=null,wi=xi[--Si],xi[Si]=null}function Ai(e,t){xi[Si++]=wi,xi[Si++]=Ti,xi[Si++]=Ci,wi=t.id,Ti=t.overflow,Ci=e}var ji=null,Mi=null,Ni=!1,Pi=null,Fi=!1,Ii=Error(i(519));function Li(e){throw Ui(gi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ii}function Ri(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[at]=e,t[ot]=r,n){case`dialog`:Ed(`cancel`,t),Ed(`close`,t);break;case`iframe`:case`object`:case`embed`:Ed(`load`,t);break;case`video`:case`audio`:for(n=0;n<wd.length;n++)Ed(wd[n],t);break;case`source`:Ed(`error`,t);break;case`img`:case`image`:case`link`:Ed(`error`,t),Ed(`load`,t);break;case`details`:Ed(`toggle`,t);break;case`input`:Ed(`invalid`,t),zt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Ed(`invalid`,t);break;case`textarea`:Ed(`invalid`,t),Ut(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||zd(t.textContent,n)?(r.popover!=null&&(Ed(`beforetoggle`,t),Ed(`toggle`,t)),r.onScroll!=null&&Ed(`scroll`,t),r.onScrollEnd!=null&&Ed(`scrollend`,t),r.onClick!=null&&(t.onclick=Qt),t=!0):t=!1,t||Li(e,!0)}function zi(e){for(ji=e.return;ji;)switch(ji.tag){case 5:case 31:case 13:Fi=!1;return;case 27:case 3:Fi=!0;return;default:ji=ji.return}}function Bi(e){if(e!==ji)return!1;if(!Ni)return zi(e),Ni=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Zd(e.type,e.memoizedProps)),n=!n),n&&Mi&&Li(e),zi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Mi=vf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Mi=vf(e)}else t===27?(t=Mi,of(e.type)?(e=_f,_f=null,Mi=e):Mi=t):Mi=ji?gf(e.stateNode.nextSibling):null;return!0}function Vi(){Mi=ji=null,Ni=!1}function Hi(){var e=Pi;return e!==null&&(iu===null?iu=e:iu.push.apply(iu,e),Pi=null),e}function Ui(e){Pi===null?Pi=[e]:Pi.push(e)}var Wi=L(null),Gi=null,Ki=null;function qi(e,t,n){ie(Wi,t._currentValue),t._currentValue=n}function Ji(e){e._currentValue=Wi.current,R(Wi)}function Yi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Xi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Yi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Yi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Zi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;br(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===z.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[op]:e.push(op))}a=a.return}e!==null&&Xi(t,e,n,r),t.flags|=262144}function Qi(e){for(e=e.firstContext;e!==null;){if(!br(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function $i(e){Gi=e,Ki=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ea(e){return na(Gi,e)}function ta(e,t){return Gi===null&&$i(e),na(e,t)}function na(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ki===null){if(e===null)throw Error(i(308));Ki=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ki=Ki.next=t;return n}var ra=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ia=t.unstable_scheduleCallback,aa=t.unstable_NormalPriority,oa={$$typeof:b,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function sa(){return{controller:new ra,data:new Map,refCount:0}}function ca(e){e.refCount--,e.refCount===0&&ia(aa,function(){e.controller.abort()})}var la=null,ua=0,da=0,fa=null;function pa(e,t){if(la===null){var n=la=[];ua=0,da=vd(),fa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ua++,t.then(ma,ma),t}function ma(){if(--ua===0&&la!==null){fa!==null&&(fa.status=`fulfilled`);var e=la;la=null,da=0,fa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ha(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ga=P.S;P.S=function(e,t){su=we(),typeof t==`object`&&t&&typeof t.then==`function`&&pa(e,t),ga!==null&&ga(e,t)};var _a=L(null);function va(){var e=_a.current;return e===null?Hl.pooledCache:e}function ya(e,t){t===null?ie(_a,_a.current):ie(_a,t.pool)}function ba(){var e=va();return e===null?null:{parent:oa._currentValue,pool:e}}var xa=Error(i(460)),Sa=Error(i(474)),Ca=Error(i(542)),wa={then:function(){}};function Ta(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ea(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Qt,Qt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Aa(e),e;default:if(typeof t.status==`string`)t.then(Qt,Qt);else{if(e=Hl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Aa(e),e}throw Oa=t,xa}}function Da(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Oa=e,xa):e}}var Oa=null;function ka(){if(Oa===null)throw Error(i(459));var e=Oa;return Oa=null,e}function Aa(e){if(e===xa||e===Ca)throw Error(i(483))}var V=null,ja=0;function Ma(e){var t=ja;return ja+=1,V===null&&(V=[]),Ea(V,e,t)}function Na(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Pa(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 H(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ci(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=fi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===g?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&Da(i)===t.type)?(t=a(t,n.props),Na(t,n),t.return=e,t):(t=ui(n.type,n.key,n.props,null,e.mode,r),Na(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=mi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=di(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=fi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case m:return n=ui(t.type,t.key,t.props,null,e.mode,n),Na(n,t),n.return=e,n;case h:return t=mi(t,e.mode,n),t.return=e,t;case O:return t=Da(t),f(e,t,n)}if(N(t)||j(t))return t=di(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ma(t),n);if(t.$$typeof===b)return f(e,ta(e,t),n);Pa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case m:return n.key===i?l(e,t,n,r):null;case h:return n.key===i?u(e,t,n,r):null;case O:return n=Da(n),p(e,t,n,r)}if(N(n)||j(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Ma(n),r);if(n.$$typeof===b)return p(e,t,ta(e,n),r);Pa(e,n)}return null}function _(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case m:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case h:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=Da(r),_(e,t,n,r,i)}if(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,Ma(r),i);if(r.$$typeof===b)return _(e,t,n,ta(t,r),i);Pa(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,m=a=0,h=null;d!==null&&m<s.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),Ni&&Ei(i,m),l;if(d===null){for(;m<s.length;m++)d=f(i,s[m],c),d!==null&&(a=o(d,a,m),u===null?l=d:u.sibling=d,u=d);return Ni&&Ei(i,m),l}for(d=r(d);m<s.length;m++)h=_(d,i,m,s[m],c),h!==null&&(e&&h.alternate!==null&&d.delete(h.key===null?m:h.key),a=o(h,a,m),u===null?l=h:u.sibling=h,u=h);return e&&d.forEach(function(e){return t(i,e)}),Ni&&Ei(i,m),l}function y(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,m=s,h=s=0,g=null,v=c.next();m!==null&&!v.done;h++,v=c.next()){m.index>h?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),Ni&&Ei(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return Ni&&Ei(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),Ni&&Ei(a,h),u}function x(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Da(l)===r.type){n(e,r.sibling),c=a(r,o.props),Na(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===g?(c=di(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ui(o.type,o.key,o.props,null,e.mode,c),Na(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=mi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Da(o),x(e,r,o,c)}if(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,Ma(o),c);if(o.$$typeof===b)return x(e,r,ta(e,o),c);Pa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=fi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ja=0;var i=x(e,t,n,r);return V=null,i}catch(t){if(t===xa||t===Ca)throw t;var a=oi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Fa=H(!0),Ia=H(!1),La=!1;function Ra(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function za(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 Ba(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Va(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Vl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ri(e),ni(e,null,n),t}return $r(e,r,t,n),ri(e)}function Ha(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Qe(e,n)}}function Ua(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 Wa=!1;function Ga(){if(Wa){var e=fa;if(e!==null)throw e}}function Ka(e,t,n,r){Wa=!1;var i=e.updateQueue;La=!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?(Wl&p)===p:(r&p)===p){p!==0&&p===da&&(Wa=!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:La=!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),Ql|=o,e.lanes=o,e.memoizedState=d}}function qa(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ja(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)qa(n[e],t)}var Ya=L(null),Xa=L(0);function Za(e,t){e=Xl,ie(Xa,e),ie(Ya,t),Xl=e|t.baseLanes}function Qa(){ie(Xa,Xl),ie(Ya,Ya.current)}function $a(){Xl=Xa.current,R(Ya),R(Xa)}var eo=L(null),to=null;function no(e){var t=e.alternate;ie(oo,oo.current&1),ie(eo,e),to===null&&(t===null||Ya.current!==null||t.memoizedState!==null)&&(to=e)}function ro(e){ie(oo,oo.current),ie(eo,e),to===null&&(to=e)}function io(e){e.tag===22?(ie(oo,oo.current),ie(eo,e),to===null&&(to=e)):U(e)}function U(){ie(oo,oo.current),ie(eo,eo.current)}function ao(e){R(eo),to===e&&(to=null),R(oo)}var oo=L(0);function so(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||pf(n)||mf(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 co=0,lo=null,uo=null,fo=null,po=!1,mo=!1,ho=!1,go=0,_o=0,vo=null,yo=0;function bo(){throw Error(i(321))}function xo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!br(e[n],t[n]))return!1;return!0}function So(e,t,n,r,i,a){return co=a,lo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,P.H=e===null||e.memoizedState===null?zs:Bs,ho=!1,a=n(r,i),ho=!1,mo&&(a=wo(t,n,r,i)),Co(e),a}function Co(e){P.H=Rs;var t=uo!==null&&uo.next!==null;if(co=0,fo=uo=lo=null,po=!1,_o=0,vo=null,t)throw Error(i(300));e===null||rc||(e=e.dependencies,e!==null&&Qi(e)&&(rc=!0))}function wo(e,t,n,r){lo=e;var a=0;do{if(mo&&(vo=null),_o=0,mo=!1,25<=a)throw Error(i(301));if(a+=1,fo=uo=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=Vs,o=t(n,r)}while(mo);return o}function To(){var e=P.H,t=e.useState()[0];return t=typeof t.then==`function`?Mo(t):t,e=e.useState()[0],(uo===null?null:uo.memoizedState)!==e&&(lo.flags|=1024),t}function Eo(){var e=go!==0;return go=0,e}function Do(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Oo(e){if(po){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}po=!1}co=0,fo=uo=lo=null,mo=!1,_o=go=0,vo=null}function ko(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return fo===null?lo.memoizedState=fo=e:fo=fo.next=e,fo}function Ao(){if(uo===null){var e=lo.alternate;e=e===null?null:e.memoizedState}else e=uo.next;var t=fo===null?lo.memoizedState:fo.next;if(t!==null)fo=t,uo=e;else{if(e===null)throw lo.alternate===null?Error(i(467)):Error(i(310));uo=e,e={memoizedState:uo.memoizedState,baseState:uo.baseState,baseQueue:uo.baseQueue,queue:uo.queue,next:null},fo===null?lo.memoizedState=fo=e:fo=fo.next=e}return fo}function jo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Mo(e){var t=_o;return _o+=1,vo===null&&(vo=[]),e=Ea(vo,e,t),t=lo,(fo===null?t.memoizedState:fo.next)===null&&(t=t.alternate,P.H=t===null||t.memoizedState===null?zs:Bs),e}function No(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Mo(e);if(e.$$typeof===b)return ea(e)}throw Error(i(438,String(e)))}function Po(e){var t=null,n=lo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=lo.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=jo(),lo.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 Fo(e,t){return typeof t==`function`?t(e):t}function Io(e){return Lo(Ao(),uo,e)}function Lo(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?(co&f)===f:(Wl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===da&&(d=!0);else if((co&p)===p){u=u.next,p===da&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,lo.lanes|=p,Ql|=p;f=u.action,ho&&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,lo.lanes|=f,Ql|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!br(o,e.memoizedState)&&(rc=!0,d&&(n=fa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Ro(e){var t=Ao(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);br(o,t.memoizedState)||(rc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function zo(e,t,n){var r=lo,a=Ao(),o=Ni;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!br((uo||a).memoizedState,n);if(s&&(a.memoizedState=n,rc=!0),a=a.queue,us(Ho.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||fo!==null&&fo.memoizedState.tag&1){if(r.flags|=2048,as(9,{destroy:void 0},Vo.bind(null,r,a,n,t),null),Hl===null)throw Error(i(349));o||co&127||Bo(r,t,n)}return n}function Bo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=lo.updateQueue,t===null?(t=jo(),lo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Vo(e,t,n,r){t.value=n,t.getSnapshot=r,Uo(t)&&Wo(e)}function Ho(e,t,n){return n(function(){Uo(t)&&Wo(e)})}function Uo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!br(e,n)}catch{return!0}}function Wo(e){var t=ti(e,2);t!==null&&Su(t,e,2)}function Go(e){var t=ko();if(typeof e==`function`){var n=e;if(e=n(),ho){Fe(!0);try{n()}finally{Fe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fo,lastRenderedState:e},t}function Ko(e,t,n,r){return e.baseState=n,Lo(e,uo,typeof r==`function`?r:Fo)}function qo(e,t,n,r,a){if(Fs(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,Jo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Jo(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),Yo(e,t,s)}catch(n){Zo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),P.T=a}}else try{a=n(i,r),Yo(e,t,a)}catch(n){Zo(e,t,n)}}function Yo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Xo(e,t,n)},function(n){return Zo(e,t,n)}):Xo(e,t,n)}function Xo(e,t,n){t.status=`fulfilled`,t.value=n,Qo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Jo(e,n)))}function Zo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Qo(t),t=t.next;while(t!==r)}e.action=null}function Qo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function $o(e,t){return t}function es(e,t){if(Ni){var n=Hl.formState;if(n!==null){a:{var r=lo;if(Ni){if(Mi){b:{for(var i=Mi,a=Fi;i.nodeType!==8;){if(!a){i=null;break b}if(i=gf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Mi=gf(i.nextSibling),r=i.data===`F!`;break a}}Li(r)}r=!1}r&&(t=n[0])}}return n=ko(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$o,lastRenderedState:t},n.queue=r,n=Ms.bind(null,lo,r),r.dispatch=n,r=Go(!1),a=Ps.bind(null,lo,!1,r.queue),r=ko(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=qo.bind(null,lo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function ts(e){return ns(Ao(),uo,e)}function ns(e,t,n){if(t=Lo(e,t,$o)[0],e=Io(Fo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Mo(t)}catch(e){throw e===xa?Ca:e}else r=t;t=Ao();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(lo.flags|=2048,as(9,{destroy:void 0},rs.bind(null,i,n),null)),[r,a,e]}function rs(e,t){e.action=t}function is(e){var t=Ao(),n=uo;if(n!==null)return ns(t,n,e);Ao(),t=t.memoizedState,n=Ao();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function as(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=lo.updateQueue,t===null&&(t=jo(),lo.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 os(){return Ao().memoizedState}function ss(e,t,n,r){var i=ko();lo.flags|=e,i.memoizedState=as(1|t,{destroy:void 0},n,r===void 0?null:r)}function cs(e,t,n,r){var i=Ao();r=r===void 0?null:r;var a=i.memoizedState.inst;uo!==null&&r!==null&&xo(r,uo.memoizedState.deps)?i.memoizedState=as(t,a,n,r):(lo.flags|=e,i.memoizedState=as(1|t,a,n,r))}function ls(e,t){ss(8390656,8,e,t)}function us(e,t){cs(2048,8,e,t)}function ds(e){lo.flags|=4;var t=lo.updateQueue;if(t===null)t=jo(),lo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function fs(e){var t=Ao().memoizedState;return ds({ref:t,nextImpl:e}),function(){if(Vl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ps(e,t){return cs(4,2,e,t)}function ms(e,t){return cs(4,4,e,t)}function hs(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 gs(e,t,n){n=n==null?null:n.concat([e]),cs(4,4,hs.bind(null,t,e),n)}function _s(){}function vs(e,t){var n=Ao();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&xo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ys(e,t){var n=Ao();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&xo(t,r[1]))return r[0];if(r=e(),ho){Fe(!0);try{e()}finally{Fe(!1)}}return n.memoizedState=[r,t],r}function bs(e,t,n){return n===void 0||co&1073741824&&!(Wl&261930)?e.memoizedState=t:(e.memoizedState=n,e=xu(),lo.lanes|=e,Ql|=e,n)}function xs(e,t,n,r){return br(n,t)?n:Ya.current===null?!(co&42)||co&1073741824&&!(Wl&261930)?(rc=!0,e.memoizedState=n):(e=xu(),lo.lanes|=e,Ql|=e,t):(e=bs(e,n,r),br(e,t)||(rc=!0),e)}function Ss(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,Ps(e,!1,t,n);try{var c=i(),l=P.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ns(e,t,ha(c,r),bu(e)):Ns(e,t,r,bu(e))}catch(n){Ns(e,t,{then:function(){},status:`rejected`,reason:n},bu())}finally{F.p=a,o!==null&&s.types!==null&&(o.types=s.types),P.T=o}}function Cs(){}function ws(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ts(e).queue;Ss(e,a,t,ne,n===null?Cs:function(){return Es(e),n(r)})}function Ts(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:Fo,lastRenderedState:ne},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Es(e){var t=Ts(e);t.next===null&&(t=e.alternate.memoizedState),Ns(e,t.next.queue,{},bu())}function Ds(){return ea(op)}function Os(){return Ao().memoizedState}function ks(){return Ao().memoizedState}function As(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=bu();e=Ba(n);var r=Va(t,e,n);r!==null&&(Su(r,t,n),Ha(r,t,n)),t={cache:sa()},e.payload=t;return}t=t.return}}function js(e,t,n){var r=bu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Fs(e)?Is(t,n):(n=ei(e,t,n,r),n!==null&&(Su(n,e,r),Ls(n,t,r)))}function Ms(e,t,n){Ns(e,t,n,bu())}function Ns(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Fs(e))Is(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,br(s,o))return $r(e,t,i,0),Hl===null&&Qr(),!1}catch{}if(n=ei(e,t,i,r),n!==null)return Su(n,e,r),Ls(n,t,r),!0}return!1}function Ps(e,t,n,r){if(r={lane:2,revertLane:vd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Fs(e)){if(t)throw Error(i(479))}else t=ei(e,n,r,2),t!==null&&Su(t,e,2)}function Fs(e){var t=e.alternate;return e===lo||t!==null&&t===lo}function Is(e,t){mo=po=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ls(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Qe(e,n)}}var Rs={readContext:ea,use:No,useCallback:bo,useContext:bo,useEffect:bo,useImperativeHandle:bo,useLayoutEffect:bo,useInsertionEffect:bo,useMemo:bo,useReducer:bo,useRef:bo,useState:bo,useDebugValue:bo,useDeferredValue:bo,useTransition:bo,useSyncExternalStore:bo,useId:bo,useHostTransitionStatus:bo,useFormState:bo,useActionState:bo,useOptimistic:bo,useMemoCache:bo,useCacheRefresh:bo};Rs.useEffectEvent=bo;var zs={readContext:ea,use:No,useCallback:function(e,t){return ko().memoizedState=[e,t===void 0?null:t],e},useContext:ea,useEffect:ls,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ss(4194308,4,hs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ss(4194308,4,e,t)},useInsertionEffect:function(e,t){ss(4,2,e,t)},useMemo:function(e,t){var n=ko();t=t===void 0?null:t;var r=e();if(ho){Fe(!0);try{e()}finally{Fe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ko();if(n!==void 0){var i=n(t);if(ho){Fe(!0);try{n(t)}finally{Fe(!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=js.bind(null,lo,e),[r.memoizedState,e]},useRef:function(e){var t=ko();return e={current:e},t.memoizedState=e},useState:function(e){e=Go(e);var t=e.queue,n=Ms.bind(null,lo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:_s,useDeferredValue:function(e,t){return bs(ko(),e,t)},useTransition:function(){var e=Go(!1);return e=Ss.bind(null,lo,e.queue,!0,!1),ko().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=lo,a=ko();if(Ni){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Hl===null)throw Error(i(349));Wl&127||Bo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ls(Ho.bind(null,r,o,e),[e]),r.flags|=2048,as(9,{destroy:void 0},Vo.bind(null,r,o,n,t),null),n},useId:function(){var e=ko(),t=Hl.identifierPrefix;if(Ni){var n=Ti,r=wi;n=(r&~(1<<32-Ie(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=go++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=yo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ds,useFormState:es,useActionState:es,useOptimistic:function(e){var t=ko();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ps.bind(null,lo,!0,n),n.dispatch=t,[e,t]},useMemoCache:Po,useCacheRefresh:function(){return ko().memoizedState=As.bind(null,lo)},useEffectEvent:function(e){var t=ko(),n={impl:e};return t.memoizedState=n,function(){if(Vl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Bs={readContext:ea,use:No,useCallback:vs,useContext:ea,useEffect:us,useImperativeHandle:gs,useInsertionEffect:ps,useLayoutEffect:ms,useMemo:ys,useReducer:Io,useRef:os,useState:function(){return Io(Fo)},useDebugValue:_s,useDeferredValue:function(e,t){return xs(Ao(),uo.memoizedState,e,t)},useTransition:function(){var e=Io(Fo)[0],t=Ao().memoizedState;return[typeof e==`boolean`?e:Mo(e),t]},useSyncExternalStore:zo,useId:Os,useHostTransitionStatus:Ds,useFormState:ts,useActionState:ts,useOptimistic:function(e,t){return Ko(Ao(),uo,e,t)},useMemoCache:Po,useCacheRefresh:ks};Bs.useEffectEvent=fs;var Vs={readContext:ea,use:No,useCallback:vs,useContext:ea,useEffect:us,useImperativeHandle:gs,useInsertionEffect:ps,useLayoutEffect:ms,useMemo:ys,useReducer:Ro,useRef:os,useState:function(){return Ro(Fo)},useDebugValue:_s,useDeferredValue:function(e,t){var n=Ao();return uo===null?bs(n,e,t):xs(n,uo.memoizedState,e,t)},useTransition:function(){var e=Ro(Fo)[0],t=Ao().memoizedState;return[typeof e==`boolean`?e:Mo(e),t]},useSyncExternalStore:zo,useId:Os,useHostTransitionStatus:Ds,useFormState:is,useActionState:is,useOptimistic:function(e,t){var n=Ao();return uo===null?(n.baseState=e,[e,n.queue.dispatch]):Ko(n,uo,e,t)},useMemoCache:Po,useCacheRefresh:ks};Vs.useEffectEvent=fs;function Hs(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 Us={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=bu(),i=Ba(r);i.payload=t,n!=null&&(i.callback=n),t=Va(e,i,r),t!==null&&(Su(t,e,r),Ha(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=bu(),i=Ba(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Va(e,i,r),t!==null&&(Su(t,e,r),Ha(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=bu(),r=Ba(n);r.tag=2,t!=null&&(r.callback=t),t=Va(e,r,n),t!==null&&(Su(t,e,n),Ha(t,e,n))}};function Ws(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!xr(n,r)||!xr(i,a):!0}function Gs(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&&Us.enqueueReplaceState(t,t.state,null)}function Ks(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 qs(e){Jr(e)}function Js(e){console.error(e)}function Ys(e){Jr(e)}function Xs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Zs(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 Qs(e,t,n){return n=Ba(n),n.tag=3,n.payload={element:null},n.callback=function(){Xs(e,t)},n}function $s(e){return e=Ba(e),e.tag=3,e}function ec(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(){Zs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Zs(t,n,r),typeof i!=`function`&&(uu===null?uu=new Set([this]):uu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function tc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Zi(t,n,a,!0),n=eo.current,n!==null){switch(n.tag){case 31:case 13:return to===null?Pu():n.alternate===null&&Zl===0&&(Zl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===wa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),$u(e,r,a)),!1;case 22:return n.flags|=65536,r===wa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),$u(e,r,a)),!1}throw Error(i(435,n.tag))}return $u(e,r,a),Pu(),!1}if(Ni)return t=eo.current,t===null?(r!==Ii&&(t=Error(i(423),{cause:r}),Ui(gi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=gi(r,n),a=Qs(e.stateNode,r,a),Ua(e,a),Zl!==4&&(Zl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ii&&(e=Error(i(422),{cause:r}),Ui(gi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=gi(o,n),ru===null?ru=[o]:ru.push(o),Zl!==4&&(Zl=2),t===null)return!0;r=gi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Qs(n.stateNode,r,e),Ua(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`&&(uu===null||!uu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=$s(a),ec(a,e,n,r),Ua(n,a),!1}n=n.return}while(n!==null);return!1}var nc=Error(i(461)),rc=!1;function ic(e,t,n,r){t.child=e===null?Ia(t,null,n,r):Fa(t,e.child,n,r)}function ac(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return $i(t),r=So(e,t,n,o,a,i),s=Eo(),e!==null&&!rc?(Do(e,t,i),kc(e,t,i)):(Ni&&s&&Oi(t),t.flags|=1,ic(e,t,r,i),t.child)}function oc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!si(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,sc(e,t,a,r,i)):(e=ui(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Ac(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?xr:n,n(o,r)&&e.ref===t.ref)return kc(e,t,i)}return t.flags|=1,e=ci(a,r),e.ref=t.ref,e.return=t,t.child=e}function sc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(xr(a,r)&&e.ref===t.ref){if(rc=!1,t.pendingProps=r=a,Ac(e,i))e.flags&131072&&(rc=!0);else return t.lanes=e.lanes,kc(e,t,i)}}return hc(e,t,n,r,i)}function cc(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 uc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ya(t,a===null?null:a.cachePool),a===null?Qa():Za(t,a),io(t);else return r=t.lanes=536870912,uc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ya(t,null),Qa(),U(t)):(ya(t,a.cachePool),Za(t,a),U(t),t.memoizedState=null);return ic(e,t,i,n),t.child}function lc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function uc(e,t,n,r,i){var a=va();return a=a===null?null:{parent:oa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ya(t,null),Qa(),io(t),e!==null&&Zi(e,t,r,!0),t.childLanes=i,null}function dc(e,t){return t=wc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function fc(e,t,n){return Fa(t,e.child,null,n),e=dc(t,t.pendingProps),e.flags|=2,ao(t),t.memoizedState=null,e}function pc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(Ni){if(r.mode===`hidden`)return e=dc(t,r),t.lanes=536870912,lc(null,e);if(ro(t),(e=Mi)?(e=ff(e,Fi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ci===null?null:{id:wi,overflow:Ti},retryLane:536870912,hydrationErrors:null},n=pi(e),n.return=t,t.child=n,ji=t,Mi=null)):e=null,e===null)throw Li(t);return t.lanes=536870912,null}return dc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(ro(t),a){if(t.flags&256)t.flags&=-257,t=fc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(rc||Zi(e,t,n,!1),a=(n&e.childLanes)!==0,rc||a){if(r=Hl,r!==null&&(s=$e(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ti(e,s),Su(r,e,s),nc;Pu(),t=fc(e,t,n)}else e=o.treeContext,Mi=gf(s.nextSibling),ji=t,Ni=!0,Pi=null,Fi=!1,e!==null&&Ai(t,e),t=dc(t,r),t.flags|=4096;return t}return e=ci(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function mc(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 hc(e,t,n,r,i){return $i(t),n=So(e,t,n,r,void 0,i),r=Eo(),e!==null&&!rc?(Do(e,t,i),kc(e,t,i)):(Ni&&r&&Oi(t),t.flags|=1,ic(e,t,n,i),t.child)}function gc(e,t,n,r,i,a){return $i(t),t.updateQueue=null,n=wo(t,r,n,i),Co(e),r=Eo(),e!==null&&!rc?(Do(e,t,a),kc(e,t,a)):(Ni&&r&&Oi(t),t.flags|=1,ic(e,t,n,a),t.child)}function _c(e,t,n,r,i){if($i(t),t.stateNode===null){var a=ii,o=n.contextType;typeof o==`object`&&o&&(a=ea(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Us,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ra(t),o=n.contextType,a.context=typeof o==`object`&&o?ea(o):ii,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Hs(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&&Us.enqueueReplaceState(a,a.state,null),Ka(t,r,a,i),Ga(),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=Ks(n,s);a.props=c;var l=a.context,u=n.contextType;o=ii,typeof u==`object`&&u&&(o=ea(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Gs(t,a,r,o),La=!1;var f=t.memoizedState;a.state=f,Ka(t,r,a,i),Ga(),l=t.memoizedState,s||f!==l||La?(typeof d==`function`&&(Hs(t,n,d,r),l=t.memoizedState),(c=La||Ws(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,za(e,t),o=t.memoizedProps,u=Ks(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ii,typeof l==`object`&&l&&(c=ea(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Gs(t,a,r,c),La=!1,f=t.memoizedState,a.state=f,Ka(t,r,a,i),Ga();var p=t.memoizedState;o!==d||f!==p||La||e!==null&&e.dependencies!==null&&Qi(e.dependencies)?(typeof s==`function`&&(Hs(t,n,s,r),p=t.memoizedState),(u=La||Ws(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Qi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,mc(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=Fa(t,e.child,null,i),t.child=Fa(t,null,n,i)):ic(e,t,n,i),t.memoizedState=a.state,e=t.child):e=kc(e,t,i),e}function vc(e,t,n,r){return Vi(),t.flags|=256,ic(e,t,n,r),t.child}var yc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bc(e){return{baseLanes:e,cachePool:ba()}}function xc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=tu),e}function Sc(e,t,n){var r=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(oo.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(Ni){if(a?no(t):U(t),(e=Mi)?(e=ff(e,Fi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ci===null?null:{id:wi,overflow:Ti},retryLane:536870912,hydrationErrors:null},n=pi(e),n.return=t,t.child=n,ji=t,Mi=null)):e=null,e===null)throw Li(t);return mf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(U(t),a=t.mode,c=wc({mode:`hidden`,children:c},a),r=di(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=bc(n),r.childLanes=xc(e,s,n),t.memoizedState=yc,lc(null,r)):(no(t),Cc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(no(t),t.flags&=-257,t=Tc(e,t,n)):t.memoizedState===null?(U(t),c=r.fallback,a=t.mode,r=wc({mode:`visible`,children:r.children},a),c=di(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Fa(t,e.child,null,n),r=t.child,r.memoizedState=bc(n),r.childLanes=xc(e,s,n),t.memoizedState=yc,t=lc(null,r)):(U(t),t.child=e.child,t.flags|=128,t=null);else if(no(t),mf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Ui({value:r,source:null,stack:null}),t=Tc(e,t,n)}else if(rc||Zi(e,t,n,!1),s=(n&e.childLanes)!==0,rc||s){if(s=Hl,s!==null&&(r=$e(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ti(e,r),Su(s,e,r),nc;pf(c)||Pu(),t=Tc(e,t,n)}else pf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Mi=gf(c.nextSibling),ji=t,Ni=!0,Pi=null,Fi=!1,e!==null&&Ai(t,e),t=Cc(t,r.children),t.flags|=4096);return t}return a?(U(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ci(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=di(c,a,n,null),c.flags|=2):c=ci(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,lc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=bc(n):(a=c.cachePool,a===null?a=ba():(l=oa._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=xc(e,s,n),t.memoizedState=yc,lc(e.child,r)):(no(t),n=e.child,e=n.sibling,n=ci(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function Cc(e,t){return t=wc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function wc(e,t){return e=oi(22,e,null,t),e.lanes=0,e}function Tc(e,t,n){return Fa(t,e.child,null,n),e=Cc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Ec(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Yi(e.return,t,n)}function Dc(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 Oc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=oo.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,ie(oo,o),ic(e,t,r,n),r=Ni?bi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ec(e,n,t);else if(e.tag===19)Ec(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&&so(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Dc(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&&so(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Dc(t,!0,n,null,a,r);break;case`together`:Dc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function kc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ql|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Zi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ci(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ci(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ac(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Qi(e)))}function jc(e,t,n){switch(t.tag){case 3:ce(t,t.stateNode.containerInfo),qi(t,oa,e.memoizedState.cache),Vi();break;case 27:case 5:ue(t);break;case 4:ce(t,t.stateNode.containerInfo);break;case 10:qi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,ro(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(no(t),e=kc(e,t,n),e===null?null:e.sibling):Sc(e,t,n):(no(t),t.flags|=128,null);no(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Zi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Oc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ie(oo,oo.current),r)break;return null;case 22:return t.lanes=0,cc(e,t,n,t.pendingProps);case 24:qi(t,oa,e.memoizedState.cache)}return kc(e,t,n)}function Mc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)rc=!0;else{if(!Ac(e,n)&&!(t.flags&128))return rc=!1,jc(e,t,n);rc=!!(e.flags&131072)}}else rc=!1,Ni&&t.flags&1048576&&Di(t,bi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Da(t.elementType),t.type=e,typeof e==`function`)si(e)?(r=Ks(e,r),t.tag=1,t=_c(null,t,e,r,n)):(t.tag=0,t=hc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===S){t.tag=11,t=ac(null,t,e,r,n);break a}if(a===D){t.tag=14,t=oc(null,t,e,r,n);break a}}throw t=te(e)||e,Error(i(306,t,``))}}return t;case 0:return hc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Ks(r,t.pendingProps),_c(e,t,r,a,n);case 3:a:{if(ce(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,za(e,t),Ka(t,r,null,n);var s=t.memoizedState;if(r=s.cache,qi(t,oa,r),r!==o.cache&&Xi(t,[oa],n,!0),Ga(),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=vc(e,t,r,n);break a}if(r!==a){a=gi(Error(i(424)),t),Ui(a),t=vc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Mi=gf(e.firstChild),ji=t,Ni=!0,Pi=null,Fi=!0,n=Ia(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Vi(),r===a){t=kc(e,t,n);break a}ic(e,t,r,n)}t=t.child}return t;case 26:return mc(e,t),e===null?(n=Lf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ni||(n=t.type,e=t.pendingProps,r=Jd(se.current).createElement(n),r[at]=t,r[ot]=e,Hd(r,n,e),vt(r),t.stateNode=r):t.memoizedState=Lf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ue(t),e===null&&Ni&&(r=t.stateNode=bf(t.type,t.pendingProps,se.current),ji=t,Fi=!0,a=Mi,of(t.type)?(_f=a,Mi=gf(r.firstChild)):Mi=a),ic(e,t,t.pendingProps.children,n),mc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ni&&((a=r=Mi)&&(r=uf(r,t.type,t.pendingProps,Fi),r===null?a=!1:(t.stateNode=r,ji=t,Mi=gf(r.firstChild),Fi=!1,a=!0)),a||Li(t)),ue(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Zd(a,o)?r=null:s!==null&&Zd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=So(e,t,To,null,null,n),op._currentValue=a),mc(e,t),ic(e,t,r,n),t.child;case 6:return e===null&&Ni&&((e=n=Mi)&&(n=df(n,t.pendingProps,Fi),n===null?e=!1:(t.stateNode=n,ji=t,Mi=null,e=!0)),e||Li(t)),null;case 13:return Sc(e,t,n);case 4:return ce(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Fa(t,null,r,n):ic(e,t,r,n),t.child;case 11:return ac(e,t,t.type,t.pendingProps,n);case 7:return ic(e,t,t.pendingProps,n),t.child;case 8:return ic(e,t,t.pendingProps.children,n),t.child;case 12:return ic(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,qi(t,t.type,r.value),ic(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,$i(t),a=ea(a),r=r(a),t.flags|=1,ic(e,t,r,n),t.child;case 14:return oc(e,t,t.type,t.pendingProps,n);case 15:return sc(e,t,t.type,t.pendingProps,n);case 19:return Oc(e,t,n);case 31:return pc(e,t,n);case 22:return cc(e,t,n,t.pendingProps);case 24:return $i(t),r=ea(oa),e===null?(a=va(),a===null&&(a=Hl,o=sa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ra(t),qi(t,oa,a)):((e.lanes&n)!==0&&(za(e,t),Ka(t,null,null,n),Ga()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,qi(t,oa,r),r!==a.cache&&Xi(t,[oa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),qi(t,oa,r))),ic(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Nc(e){e.flags|=4}function Pc(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(ju())e.flags|=8192;else throw Oa=wa,Sa}}else e.flags&=-16777217}function Fc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Qf(t)){if(ju())e.flags|=8192;else throw Oa=wa,Sa}}function Ic(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:qe(),e.lanes|=t,nu|=t)}function Lc(e,t){if(!Ni)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Rc(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 zc(e,t,n){var r=t.pendingProps;switch(ki(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rc(t),null;case 1:return Rc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ji(oa),le(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Bi(t)?Nc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Hi())),Rc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Nc(t),o===null?(Rc(t),Pc(t,a,null,r,n)):(Rc(t),Fc(t,o))):o?o===e.memoizedState?(Rc(t),t.flags&=-16777217):(Nc(t),Rc(t),Fc(t,o)):(e=e.memoizedProps,e!==r&&Nc(t),Rc(t),Pc(t,a,e,r,n)),null;case 27:if(de(t),n=se.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Nc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Rc(t),null}e=ae.current,Bi(t)?Ri(t,e):(e=bf(a,r,n),t.stateNode=e,Nc(t))}return Rc(t),null;case 5:if(de(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Nc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Rc(t),null}if(o=ae.current,Bi(t))Ri(t,o);else{var s=Jd(se.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[at]=t,o[ot]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Hd(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&&Nc(t)}}return Rc(t),Pc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Nc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=se.current,Bi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ji,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[at]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||zd(e.nodeValue,n)),e||Li(t,!0)}else e=Jd(e).createTextNode(r),e[at]=t,t.stateNode=e}return Rc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Bi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[at]=t}else Vi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Rc(t),e=!1}else n=Hi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ao(t),t):(ao(t),null);if(t.flags&128)throw Error(i(558))}return Rc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Bi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[at]=t}else Vi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Rc(t),a=!1}else a=Hi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(ao(t),t):(ao(t),null)}return ao(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),Ic(t,t.updateQueue),Rc(t),null);case 4:return le(),e===null&&kd(t.stateNode.containerInfo),Rc(t),null;case 10:return Ji(t.type),Rc(t),null;case 19:if(R(oo),r=t.memoizedState,r===null)return Rc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Lc(r,!1);else{if(Zl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=so(e),o!==null){for(t.flags|=128,Lc(r,!1),e=o.updateQueue,t.updateQueue=e,Ic(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)li(n,e),n=n.sibling;return ie(oo,oo.current&1|2),Ni&&Ei(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&we()>cu&&(t.flags|=128,a=!0,Lc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=so(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Ic(t,e),Lc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Ni)return Rc(t),null}else 2*we()-r.renderingStartTime>cu&&n!==536870912&&(t.flags|=128,a=!0,Lc(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?(Rc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=we(),e.sibling=null,n=oo.current,ie(oo,a?n&1|2:n&1),Ni&&Ei(t,r.treeForkCount),e);case 22:case 23:return ao(t),$a(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Rc(t),t.subtreeFlags&6&&(t.flags|=8192)):Rc(t),n=t.updateQueue,n!==null&&Ic(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&&R(_a),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ji(oa),Rc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Bc(e,t){switch(ki(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ji(oa),le(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return de(t),null;case 31:if(t.memoizedState!==null){if(ao(t),t.alternate===null)throw Error(i(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ao(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return R(oo),null;case 4:return le(),null;case 10:return Ji(t.type),null;case 22:case 23:return ao(t),$a(),e!==null&&R(_a),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ji(oa),null;case 25:return null;default:return null}}function Vc(e,t){switch(ki(t),t.tag){case 3:Ji(oa),le();break;case 26:case 27:case 5:de(t);break;case 4:le();break;case 31:t.memoizedState!==null&&ao(t);break;case 13:ao(t);break;case 19:R(oo);break;case 10:Ji(t.type);break;case 22:case 23:ao(t),$a(),e!==null&&R(_a);break;case 24:Ji(oa)}}function Hc(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){Qu(t,t.return,e)}}function Uc(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){Qu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Qu(t,t.return,e)}}function Wc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ja(t,n)}catch(t){Qu(e,e.return,t)}}}function Gc(e,t,n){n.props=Ks(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Qu(e,t,n)}}function Kc(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){Qu(e,t,n)}}function qc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Qu(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){Qu(e,t,n)}else n.current=null}}function Jc(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){Qu(e,e.return,t)}}function Yc(e,t,n){try{var r=e.stateNode;Ud(r,e.type,n,t),r[ot]=t}catch(t){Qu(e,e.return,t)}}function Xc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&of(e.type)||e.tag===4}function Zc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Xc(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&&of(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 Qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Qt));else if(r!==4&&(r===27&&of(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function $c(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&&of(e.type)&&(n=e.stateNode),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){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Hd(t,r,n),t[at]=e,t[ot]=n}catch(t){Qu(e,e.return,t)}}var tl=!1,nl=!1,rl=!1,il=typeof WeakSet==`function`?WeakSet:Set,al=null;function ol(e,t){if(e=e.containerInfo,Kd=hp,e=Tr(e),Er(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(qd={focusedElem:e,selectionRange:n},hp=!1,al=t;al!==null;)if(t=al,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,al=e;else for(;al!==null;){switch(t=al,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=Ks(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Qu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)lf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:lf(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,al=e;break}al=t.return}}function sl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Sl(e,n),r&4&&Hc(5,n);break;case 1:if(Sl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Qu(n,n.return,e)}else{var i=Ks(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Qu(n,n.return,e)}}}r&64&&Wc(n),r&512&&Kc(n,n.return);break;case 3:if(Sl(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{Ja(e,t)}catch(e){Qu(n,n.return,e)}}break;case 27:t===null&&r&4&&el(n);case 26:case 5:Sl(e,n),t===null&&r&4&&Jc(n),r&512&&Kc(n,n.return);break;case 12:Sl(e,n);break;case 31:Sl(e,n),r&4&&pl(e,n);break;case 13:Sl(e,n),r&4&&ml(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=nd.bind(null,n),hf(e,n))));break;case 22:if(r=n.memoizedState!==null||tl,!r){t=t!==null&&t.memoizedState!==null||nl,i=tl;var a=nl;tl=r,(nl=t)&&!a?wl(e,n,!!(n.subtreeFlags&8772)):Sl(e,n),tl=i,nl=a}break;case 30:break;default:Sl(e,n)}}function cl(e){var t=e.alternate;t!==null&&(e.alternate=null,cl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&pt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ll=null,ul=!1;function dl(e,t,n){for(n=n.child;n!==null;)fl(e,t,n),n=n.sibling}function fl(e,t,n){if(Pe&&typeof Pe.onCommitFiberUnmount==`function`)try{Pe.onCommitFiberUnmount(Ne,n)}catch{}switch(n.tag){case 26:nl||qc(n,t),dl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:nl||qc(n,t);var r=ll,i=ul;of(n.type)&&(ll=n.stateNode,ul=!1),dl(e,t,n),xf(n.stateNode),ll=r,ul=i;break;case 5:nl||qc(n,t);case 6:if(r=ll,i=ul,ll=null,dl(e,t,n),ll=r,ul=i,ll!==null){if(ul)try{(ll.nodeType===9?ll.body:ll.nodeName===`HTML`?ll.ownerDocument.body:ll).removeChild(n.stateNode)}catch(e){Qu(n,t,e)}else try{ll.removeChild(n.stateNode)}catch(e){Qu(n,t,e)}}break;case 18:ll!==null&&(ul?(e=ll,sf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Vp(e)):sf(ll,n.stateNode));break;case 4:r=ll,i=ul,ll=n.stateNode.containerInfo,ul=!0,dl(e,t,n),ll=r,ul=i;break;case 0:case 11:case 14:case 15:Uc(2,n,t),nl||Uc(4,n,t),dl(e,t,n);break;case 1:nl||(qc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Gc(n,t,r)),dl(e,t,n);break;case 21:dl(e,t,n);break;case 22:nl=(r=nl)||n.memoizedState!==null,dl(e,t,n),nl=r;break;default:dl(e,t,n)}}function pl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Vp(e)}catch(e){Qu(t,t.return,e)}}}function ml(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Vp(e)}catch(e){Qu(t,t.return,e)}}function hl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new il),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new il),t;default:throw Error(i(435,e.tag))}}function gl(e,t){var n=hl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=rd.bind(null,e,t);t.then(r,r)}})}function _l(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(of(c.type)){ll=c.stateNode,ul=!1;break a}break;case 5:ll=c.stateNode,ul=!1;break a;case 3:case 4:ll=c.stateNode.containerInfo,ul=!0;break a}c=c.return}if(ll===null)throw Error(i(160));fl(o,s,a),ll=null,ul=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)yl(t,e),t=t.sibling}var vl=null;function yl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:_l(t,e),bl(e),r&4&&(Uc(3,e,e.return),Hc(3,e),Uc(5,e,e.return));break;case 1:_l(t,e),bl(e),r&512&&(nl||n===null||qc(n,n.return)),r&64&&tl&&(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=vl;if(_l(t,e),bl(e),r&512&&(nl||n===null||qc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[ft]||o[at]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Hd(o,r,n),o[at]=e,vt(o),r=o;break a;case`link`:var s=Yf(`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),Hd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Yf(`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),Hd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[at]=e,vt(o),r=o}e.stateNode=r}else Xf(a,e.type,e.stateNode)}else e.stateNode=Wf(a,r,e.memoizedProps)}else o===r?r===null&&e.stateNode!==null&&Yc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Xf(a,e.type,e.stateNode):Wf(a,r,e.memoizedProps))}break;case 27:_l(t,e),bl(e),r&512&&(nl||n===null||qc(n,n.return)),n!==null&&r&4&&Yc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(_l(t,e),bl(e),r&512&&(nl||n===null||qc(n,n.return)),e.flags&32){a=e.stateNode;try{Wt(a,``)}catch(t){Qu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Yc(e,a,n===null?a:n.memoizedProps)),r&1024&&(rl=!0);break;case 6:if(_l(t,e),bl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Qu(e,e.return,t)}}break;case 3:if(Jf=null,a=vl,vl=wf(t.containerInfo),_l(t,e),vl=a,bl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Vp(t.containerInfo)}catch(t){Qu(e,e.return,t)}rl&&(rl=!1,xl(e));break;case 4:r=vl,vl=wf(e.stateNode.containerInfo),_l(t,e),bl(e),vl=r;break;case 12:_l(t,e),bl(e);break;case 31:_l(t,e),bl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,gl(e,r)));break;case 13:_l(t,e),bl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(ou=we()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,gl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=tl,d=nl;if(tl=u||a,nl=d||l,_l(t,e),nl=d,tl=u,bl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||tl||nl||Cl(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){Qu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Qu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?cf(m,!0):cf(l.stateNode,!1)}catch(e){Qu(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,gl(e,n))));break;case 19:_l(t,e),bl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,gl(e,r)));break;case 30:break;case 21:break;default:_l(t,e),bl(e)}}function bl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Xc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;$c(e,Zc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Wt(o,``),n.flags&=-33),$c(e,Zc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Qc(e,Zc(e),s);break;default:throw Error(i(161))}}catch(t){Qu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function xl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;xl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Sl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)sl(e,t.alternate,t),t=t.sibling}function Cl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Uc(4,t,t.return),Cl(t);break;case 1:qc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Gc(t,t.return,n),Cl(t);break;case 27:xf(t.stateNode);case 26:case 5:qc(t,t.return),Cl(t);break;case 22:t.memoizedState===null&&Cl(t);break;case 30:Cl(t);break;default:Cl(t)}e=e.sibling}}function wl(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:wl(i,a,n),Hc(4,a);break;case 1:if(wl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Qu(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++)qa(c[i],s)}catch(e){Qu(r,r.return,e)}}n&&o&64&&Wc(a),Kc(a,a.return);break;case 27:el(a);case 26:case 5:wl(i,a,n),n&&r===null&&o&4&&Jc(a),Kc(a,a.return);break;case 12:wl(i,a,n);break;case 31:wl(i,a,n),n&&o&4&&pl(i,a);break;case 13:wl(i,a,n),n&&o&4&&ml(i,a);break;case 22:a.memoizedState===null&&wl(i,a,n),Kc(a,a.return);break;case 30:break;default:wl(i,a,n)}t=t.sibling}}function Tl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ca(n))}function El(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ca(e))}function Dl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ol(e,t,n,r),t=t.sibling}function Ol(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Dl(e,t,n,r),i&2048&&Hc(9,t);break;case 1:Dl(e,t,n,r);break;case 3:Dl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ca(e)));break;case 12:if(i&2048){Dl(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){Qu(t,t.return,e)}}else Dl(e,t,n,r);break;case 31:Dl(e,t,n,r);break;case 13:Dl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Dl(e,t,n,r):(a._visibility|=2,kl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?Dl(e,t,n,r):Al(e,t),i&2048&&Tl(o,t);break;case 24:Dl(e,t,n,r),i&2048&&El(t.alternate,t);break;default:Dl(e,t,n,r)}}function kl(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:kl(a,o,s,c,i),Hc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,kl(a,o,s,c,i)):u._visibility&2?kl(a,o,s,c,i):Al(a,o),i&&l&2048&&Tl(o.alternate,o);break;case 24:kl(a,o,s,c,i),i&&l&2048&&El(o.alternate,o);break;default:kl(a,o,s,c,i)}t=t.sibling}}function Al(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:Al(n,r),i&2048&&Tl(r.alternate,r);break;case 24:Al(n,r),i&2048&&El(r.alternate,r);break;default:Al(n,r)}t=t.sibling}}var jl=8192;function Ml(e,t,n){if(e.subtreeFlags&jl)for(e=e.child;e!==null;)Nl(e,t,n),e=e.sibling}function Nl(e,t,n){switch(e.tag){case 26:Ml(e,t,n),e.flags&jl&&e.memoizedState!==null&&$f(n,vl,e.memoizedState,e.memoizedProps);break;case 5:Ml(e,t,n);break;case 3:case 4:var r=vl;vl=wf(e.stateNode.containerInfo),Ml(e,t,n),vl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=jl,jl=16777216,Ml(e,t,n),jl=r):Ml(e,t,n));break;default:Ml(e,t,n)}}function Pl(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 Fl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];al=r,Rl(r,e)}Pl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Il(e),e=e.sibling}function Il(e){switch(e.tag){case 0:case 11:case 15:Fl(e),e.flags&2048&&Uc(9,e,e.return);break;case 3:Fl(e);break;case 12:Fl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ll(e)):Fl(e);break;default:Fl(e)}}function Ll(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];al=r,Rl(r,e)}Pl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Uc(8,t,t.return),Ll(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ll(t));break;default:Ll(t)}e=e.sibling}}function Rl(e,t){for(;al!==null;){var n=al;switch(n.tag){case 0:case 11:case 15:Uc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ca(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,al=r;else a:for(n=e;al!==null;){r=al;var i=r.sibling,a=r.return;if(cl(r),r===n){al=null;break a}if(i!==null){i.return=a,al=i;break a}al=a}}}var zl={getCacheForType:function(e){var t=ea(oa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ea(oa).controller.signal}},Bl=typeof WeakMap==`function`?WeakMap:Map,Vl=0,Hl=null,Ul=null,Wl=0,Gl=0,Kl=null,ql=!1,Jl=!1,Yl=!1,Xl=0,Zl=0,Ql=0,$l=0,eu=0,tu=0,nu=0,ru=null,iu=null,au=!1,ou=0,su=0,cu=1/0,lu=null,uu=null,du=0,fu=null,pu=null,mu=0,hu=0,gu=null,_u=null,vu=0,yu=null;function bu(){return Vl&2&&Wl!==0?Wl&-Wl:P.T===null?nt():vd()}function xu(){if(tu===0){if(!(Wl&536870912)||Ni){var e=Ve;Ve<<=1,!(Ve&3932160)&&(Ve=262144),tu=e}else tu=536870912}return e=eo.current,e!==null&&(e.flags|=32),tu}function Su(e,t,n){(e===Hl&&(Gl===2||Gl===9)||e.cancelPendingCommit!==null)&&(ku(e,0),Eu(e,Wl,tu,!1)),Ye(e,n),(!(Vl&2)||e!==Hl)&&(e===Hl&&(!(Vl&2)&&($l|=n),Zl===4&&Eu(e,Wl,tu,!1)),ud(e))}function Cu(e,t,n){if(Vl&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Ge(e,t),a=r?Lu(e,t):Fu(e,t,!0),o=r;do{if(a===0){Jl&&!r&&Eu(e,t,0,!1);break}if(n=e.current.alternate,o&&!Tu(n)){a=Fu(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=ru;var l=c.current.memoizedState.isDehydrated;if(l&&(ku(c,s).flags|=256),s=Fu(c,s,!1),s!==2){if(Yl&&!l){c.errorRecoveryDisabledLanes|=o,$l|=o,a=4;break a}o=iu,iu=a,o!==null&&(iu===null?iu=o:iu.push.apply(iu,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){ku(e,0),Eu(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:Eu(r,t,tu,!ql);break a;case 2:iu=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=ou+300-we(),10<a)){if(Eu(r,t,tu,!ql),We(r,0,!0)!==0)break a;mu=t,r.timeoutHandle=ef(wu.bind(null,r,n,iu,lu,au,t,tu,$l,nu,ql,o,`Throttled`,-0,0),a);break a}wu(r,n,iu,lu,au,t,tu,$l,nu,ql,o,null,-0,0)}break}while(1);ud(e)}function wu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Qt},Nl(t,a,d);var m=(a&62914560)===a?ou-we():(a&4194048)===a?su-we():0;if(m=tp(d,m),m!==null){mu=a,e.cancelPendingCommit=m(Wu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Eu(e,a,o,!l);return}}Wu(e,t,a,n,r,i,o,s,c)}function Tu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!br(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Eu(e,t,n,r){t&=~eu,t&=~$l,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ie(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ze(e,n,t)}function Du(){return Vl&6?!0:(dd(0,!1),!1)}function Ou(){if(Ul!==null){if(Gl===0)var e=Ul.return;else e=Ul,Ki=Gi=null,Oo(e),V=null,ja=0,e=Ul;for(;e!==null;)Vc(e.alternate,e),e=e.return;Ul=null}}function ku(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,tf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),mu=0,Ou(),Hl=e,Ul=n=ci(e.current,null),Wl=t,Gl=0,Kl=null,ql=!1,Jl=Ge(e,t),Yl=!1,nu=tu=eu=$l=Ql=Zl=0,iu=ru=null,au=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ie(r),a=1<<i;t|=e[i],r&=~a}return Xl=t,Qr(),n}function Au(e,t){lo=null,P.H=Rs,t===xa||t===Ca?(t=ka(),Gl=3):t===Sa?(t=ka(),Gl=4):Gl=t===nc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Kl=t,Ul===null&&(Zl=1,Xs(e,gi(t,e.current)))}function ju(){var e=eo.current;return e===null?!0:(Wl&4194048)===Wl?to===null:(Wl&62914560)===Wl||Wl&536870912?e===to:!1}function Mu(){var e=P.H;return P.H=Rs,e===null?Rs:e}function Nu(){var e=P.A;return P.A=zl,e}function Pu(){Zl=4,ql||(Wl&4194048)!==Wl&&eo.current!==null||(Jl=!0),!(Ql&134217727)&&!($l&134217727)||Hl===null||Eu(Hl,Wl,tu,!1)}function Fu(e,t,n){var r=Vl;Vl|=2;var i=Mu(),a=Nu();(Hl!==e||Wl!==t)&&(lu=null,ku(e,t)),t=!1;var o=Zl;a:do try{if(Gl!==0&&Ul!==null){var s=Ul,c=Kl;switch(Gl){case 8:Ou(),o=6;break a;case 3:case 2:case 9:case 6:eo.current===null&&(t=!0);var l=Gl;if(Gl=0,Kl=null,Vu(e,s,c,l),n&&Jl){o=0;break a}break;default:l=Gl,Gl=0,Kl=null,Vu(e,s,c,l)}}Iu(),o=Zl;break}catch(t){Au(e,t)}while(1);return t&&e.shellSuspendCounter++,Ki=Gi=null,Vl=r,P.H=i,P.A=a,Ul===null&&(Hl=null,Wl=0,Qr()),o}function Iu(){for(;Ul!==null;)zu(Ul)}function Lu(e,t){var n=Vl;Vl|=2;var r=Mu(),a=Nu();Hl!==e||Wl!==t?(lu=null,cu=we()+500,ku(e,t)):Jl=Ge(e,t);a:do try{if(Gl!==0&&Ul!==null){t=Ul;var o=Kl;b:switch(Gl){case 1:Gl=0,Kl=null,Vu(e,t,o,1);break;case 2:case 9:if(Ta(o)){Gl=0,Kl=null,Bu(t);break}t=function(){Gl!==2&&Gl!==9||Hl!==e||(Gl=7),ud(e)},o.then(t,t);break a;case 3:Gl=7;break a;case 4:Gl=5;break a;case 7:Ta(o)?(Gl=0,Kl=null,Bu(t)):(Gl=0,Kl=null,Vu(e,t,o,7));break;case 5:var s=null;switch(Ul.tag){case 26:s=Ul.memoizedState;case 5:case 27:var c=Ul;if(s?Qf(s):c.stateNode.complete){Gl=0,Kl=null;var l=c.sibling;if(l!==null)Ul=l;else{var u=c.return;u===null?Ul=null:(Ul=u,Hu(u))}break b}}Gl=0,Kl=null,Vu(e,t,o,5);break;case 6:Gl=0,Kl=null,Vu(e,t,o,6);break;case 8:Ou(),Zl=6;break a;default:throw Error(i(462))}}Ru();break}catch(t){Au(e,t)}while(1);return Ki=Gi=null,P.H=r,P.A=a,Vl=n,Ul===null?(Hl=null,Wl=0,Qr(),Zl):0}function Ru(){for(;Ul!==null&&!Se();)zu(Ul)}function zu(e){var t=Mc(e.alternate,e,Xl);e.memoizedProps=e.pendingProps,t===null?Hu(e):Ul=t}function Bu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=gc(n,t,t.pendingProps,t.type,void 0,Wl);break;case 11:t=gc(n,t,t.pendingProps,t.type.render,t.ref,Wl);break;case 5:Oo(t);default:Vc(n,t),t=Ul=li(t,Xl),t=Mc(n,t,Xl)}e.memoizedProps=e.pendingProps,t===null?Hu(e):Ul=t}function Vu(e,t,n,r){Ki=Gi=null,Oo(t),V=null,ja=0;var i=t.return;try{if(tc(e,i,t,n,Wl)){Zl=1,Xs(e,gi(n,e.current)),Ul=null;return}}catch(t){if(i!==null)throw Ul=i,t;Zl=1,Xs(e,gi(n,e.current)),Ul=null;return}t.flags&32768?(Ni||r===1?e=!0:Jl||Wl&536870912?e=!1:(ql=e=!0,(r===2||r===9||r===3||r===6)&&(r=eo.current,r!==null&&r.tag===13&&(r.flags|=16384))),Uu(t,e)):Hu(t)}function Hu(e){var t=e;do{if(t.flags&32768){Uu(t,ql);return}e=t.return;var n=zc(t.alternate,t,Xl);if(n!==null){Ul=n;return}if(t=t.sibling,t!==null){Ul=t;return}Ul=t=e}while(t!==null);Zl===0&&(Zl=5)}function Uu(e,t){do{var n=Bc(e.alternate,e);if(n!==null){n.flags&=32767,Ul=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ul=e;return}Ul=e=n}while(e!==null);Zl=6,Ul=null}function Wu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Yu();while(du!==0);if(Vl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Zr,Xe(e,n,o,s,c,l),e===Hl&&(Ul=Hl=null,Wl=0),pu=t,fu=e,mu=n,hu=o,gu=a,_u=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,id(Oe,function(){return Xu(),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=Vl,Vl|=4;try{ol(e,t,n)}finally{Vl=s,F.p=a,P.T=r}}du=1,Gu(),Ku(),qu()}}function Gu(){if(du===1){du=0;var e=fu,t=pu,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=Vl;Vl|=4;try{yl(t,e);var a=qd,o=Tr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&wr(s.ownerDocument.documentElement,s)){if(c!==null&&Er(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Cr(s,h),v=Cr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}hp=!!Kd,qd=Kd=null}finally{Vl=i,F.p=r,P.T=n}}e.current=t,du=2}}function Ku(){if(du===2){du=0;var e=fu,t=pu,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=Vl;Vl|=4;try{sl(e,t.alternate,t)}finally{Vl=i,F.p=r,P.T=n}}du=3}}function qu(){if(du===4||du===3){du=0,Ce();var e=fu,t=pu,n=mu,r=_u;t.subtreeFlags&10256||t.flags&10256?du=5:(du=0,pu=fu=null,Ju(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(uu=null),tt(n),t=t.stateNode,Pe&&typeof Pe.onCommitFiberRoot==`function`)try{Pe.onCommitFiberRoot(Ne,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}}mu&3&&Yu(),ud(e),i=e.pendingLanes,n&261930&&i&42?e===yu?vu++:(vu=0,yu=e):vu=0,dd(0,!1)}}function Ju(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ca(t)))}function Yu(){return Gu(),Ku(),qu(),Xu()}function Xu(){if(du!==5)return!1;var e=fu,t=hu;hu=0;var n=tt(mu),r=P.T,a=F.p;try{F.p=32>n?32:n,P.T=null,n=gu,gu=null;var o=fu,s=mu;if(du=0,pu=fu=null,mu=0,Vl&6)throw Error(i(331));var c=Vl;if(Vl|=4,Il(o.current),Ol(o,o.current,s,n),Vl=c,dd(0,!1),Pe&&typeof Pe.onPostCommitFiberRoot==`function`)try{Pe.onPostCommitFiberRoot(Ne,o)}catch{}return!0}finally{F.p=a,P.T=r,Ju(e,t)}}function Zu(e,t,n){t=gi(n,t),t=Qs(e.stateNode,t,2),e=Va(e,t,2),e!==null&&(Ye(e,2),ud(e))}function Qu(e,t,n){if(e.tag===3)Zu(e,e,n);else for(;t!==null;){if(t.tag===3){Zu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(uu===null||!uu.has(r))){e=gi(n,e),n=$s(2),r=Va(t,n,2),r!==null&&(ec(n,r,t,e),Ye(r,2),ud(r));break}}t=t.return}}function $u(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Bl;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)||(Yl=!0,i.add(n),e=ed.bind(null,e,t,n),t.then(e,e))}function ed(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Hl===e&&(Wl&n)===n&&(Zl===4||Zl===3&&(Wl&62914560)===Wl&&300>we()-ou?!(Vl&2)&&ku(e,0):eu|=n,nu===Wl&&(nu=0)),ud(e)}function td(e,t){t===0&&(t=qe()),e=ti(e,t),e!==null&&(Ye(e,t),ud(e))}function nd(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),td(e,n)}function rd(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),td(e,n)}function id(e,t){return be(e,t)}var W=null,ad=null,od=!1,sd=!1,cd=!1,ld=0;function ud(e){e!==ad&&e.next===null&&(ad===null?W=ad=e:ad=ad.next=e),sd=!0,od||(od=!0,_d())}function dd(e,t){if(!cd&&sd){cd=!0;do for(var n=!1,r=W;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-Ie(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,gd(r,a))}else a=Wl,a=We(r,r===Hl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ge(r,a)||(n=!0,gd(r,a))}r=r.next}while(n);cd=!1}}function fd(){pd()}function pd(){sd=od=!1;var e=0;ld!==0&&$d()&&(e=ld);for(var t=we(),n=null,r=W;r!==null;){var i=r.next,a=md(r,t);a===0?(r.next=null,n===null?W=i:n.next=i,i===null&&(ad=n)):(n=r,(e!==0||a&3)&&(sd=!0)),r=i}du!==0&&du!==5||dd(e,!1),ld!==0&&(ld=0)}function md(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ie(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ke(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Hl,n=Wl,n=We(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Gl===2||Gl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&xe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ge(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&xe(r),tt(n)){case 2:case 8:n=De;break;case 32:n=Oe;break;case 268435456:n=Ae;break;default:n=Oe}return r=hd.bind(null,e),n=be(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&xe(r),e.callbackPriority=2,e.callbackNode=null,2}function hd(e,t){if(du!==0&&du!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Yu()&&e.callbackNode!==n)return null;var r=Wl;return r=We(e,e===Hl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Cu(e,r,t),md(e,we()),e.callbackNode!=null&&e.callbackNode===n?hd.bind(null,e):null)}function gd(e,t){if(Yu())return null;Cu(e,t,!0)}function _d(){rf(function(){Vl&6?be(Ee,fd):pd()})}function vd(){if(ld===0){var e=da;e===0&&(e=Be,Be<<=1,!(Be&261888)&&(Be=256)),ld=e}return ld}function yd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Zt(``+e)}function bd(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 xd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=yd((i[ot]||null).action),o=r.submitter;o&&(t=(t=o[ot]||null)?yd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new bn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ld!==0){var e=o?bd(i,o):new FormData(i);ws(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?bd(i,o):new FormData(i),ws(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Sd=0;Sd<Kr.length;Sd++){var Cd=Kr[Sd];qr(Cd.toLowerCase(),`on`+(Cd[0].toUpperCase()+Cd.slice(1)))}qr(Rr,`onAnimationEnd`),qr(zr,`onAnimationIteration`),qr(Br,`onAnimationStart`),qr(`dblclick`,`onDoubleClick`),qr(`focusin`,`onFocus`),qr(`focusout`,`onBlur`),qr(Vr,`onTransitionRun`),qr(Hr,`onTransitionStart`),qr(Ur,`onTransitionCancel`),qr(Wr,`onTransitionEnd`),St(`onMouseEnter`,[`mouseout`,`mouseover`]),St(`onMouseLeave`,[`mouseout`,`mouseover`]),St(`onPointerEnter`,[`pointerout`,`pointerover`]),St(`onPointerLeave`,[`pointerout`,`pointerover`]),xt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),xt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),xt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),xt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),xt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),xt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var wd=`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(` `),Td=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(wd));function G(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Jr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Jr(e)}i.currentTarget=null,a=c}}}}function Ed(e,t){var n=t[ct];n===void 0&&(n=t[ct]=new Set);var r=e+`__bubble`;n.has(r)||(Ad(t,e,2,!1),n.add(r))}function Dd(e,t,n){var r=0;t&&(r|=4),Ad(n,e,r,t)}var Od=`_reactListening`+Math.random().toString(36).slice(2);function kd(e){if(!e[Od]){e[Od]=!0,yt.forEach(function(t){t!==`selectionchange`&&(Td.has(t)||Dd(t,!1,e),Dd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Od]||(t[Od]=!0,Dd(`selectionchange`,!1,t))}}function Ad(e,t,n,r){switch(Sp(t)){case 2:var i=gp;break;case 8:i=_p;break;default:i=vp}n=i.bind(null,t,n,e),i=void 0,!ln||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function jd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=mt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}on(function(){var r=a,i=en(n),s=[];a:{var c=Gr.get(e);if(c!==void 0){var l=bn,u=e;switch(e){case`keypress`:if(hn(n)===0)break a;case`keydown`:case`keyup`:l=Ln;break;case`focusin`:u=`focus`,l=kn;break;case`focusout`:u=`blur`,l=kn;break;case`beforeblur`:case`afterblur`:l=kn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Dn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=On;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=zn;break;case Rr:case zr:case Br:l=An;break;case Wr:l=Bn;break;case`scroll`:case`scrollend`:l=Sn;break;case`wheel`:l=Vn;break;case`copy`:case`cut`:case`paste`:l=jn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Rn;break;case`toggle`:case`beforetoggle`:l=Hn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=sn(m,p),g!=null&&d.push(Md(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==$t&&(u=n.relatedTarget||n.fromElement)&&(mt(u)||u[st]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?mt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Dn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Rn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:gt(l),h=u==null?c:gt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,mt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Pd,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&&Fd(s,c,l,d,!1),u!==null&&f!==null&&Fd(s,f,u,d,!0)}}a:{if(c=r?gt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=cr;else if(nr(c)){if(lr)v=vr;else{v=gr;var y=hr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Jt(r.elementType)&&(v=cr):v=_r;if(v&&=v(e,r)){rr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Bt(c,`number`,c.value)}switch(y=r?gt(r):window,e){case`focusin`:(nr(y)||y.contentEditable===`true`)&&(Or=y,kr=r,Ar=null);break;case`focusout`:Ar=kr=Or=null;break;case`mousedown`:jr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:jr=!1,Mr(s,n,i);break;case`selectionchange`:if(Dr)break;case`keydown`:case`keyup`:Mr(s,n,i)}var b;if(Wn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Qn?Xn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(qn&&n.locale!==`ko`&&(Qn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Qn&&(b=mn()):(dn=i,fn=`value`in dn?dn.value:dn.textContent,Qn=!0)),y=Nd(r,x),0<y.length&&(x=new Mn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Zn(n),b!==null&&(x.data=b)))),(b=Kn?$n(e,n):er(e,n))&&(x=Nd(r,`onBeforeInput`),0<x.length&&(y=new Mn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),xd(s,e,r,n,i)}G(s,t)})}function Md(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Nd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=sn(e,n),i!=null&&r.unshift(Md(e,i,a)),i=sn(e,t),i!=null&&r.push(Md(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Pd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Fd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=sn(n,a),l!=null&&o.unshift(Md(n,l,c))):i||(l=sn(n,a),l!=null&&o.push(Md(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Id=/\r\n?/g,Ld=/\u0000|\uFFFD/g;function Rd(e){return(typeof e==`string`?e:``+e).replace(Id,`
|
|
10
|
+
`).replace(Ld,``)}function zd(e,t){return t=Rd(t),Rd(e)===t}function Bd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Wt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Wt(e,``+r);break;case`className`:Ot(e,`class`,r);break;case`tabIndex`:Ot(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ot(e,n,r);break;case`style`:qt(e,r,o);break;case`data`:if(t!==`object`){Ot(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Zt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Bd(e,t,`name`,a.name,a,null),Bd(e,t,`formEncType`,a.formEncType,a,null),Bd(e,t,`formMethod`,a.formMethod,a,null),Bd(e,t,`formTarget`,a.formTarget,a,null)):(Bd(e,t,`encType`,a.encType,a,null),Bd(e,t,`method`,a.method,a,null),Bd(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Zt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Qt);break;case`onScroll`:r!=null&&Ed(`scroll`,e);break;case`onScrollEnd`:r!=null&&Ed(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Zt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Ed(`beforetoggle`,e),Ed(`toggle`,e),Dt(e,`popover`,r);break;case`xlinkActuate`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Dt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Yt.get(n)||n,Dt(e,n,r))}}function Vd(e,t,n,r,a,o){switch(n){case`style`:qt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Wt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Wt(e,``+r);break;case`onScroll`:r!=null&&Ed(`scroll`,e);break;case`onScrollEnd`:r!=null&&Ed(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Qt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!bt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[ot]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Dt(e,n,r)}}}function Hd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Ed(`error`,e),Ed(`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:Bd(e,t,o,s,n,null)}}a&&Bd(e,t,`srcSet`,n.srcSet,n,null),r&&Bd(e,t,`src`,n.src,n,null);return;case`input`:Ed(`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:Bd(e,t,r,d,n,null)}}zt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Ed(`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:Bd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Vt(e,!!r,n,!0):Vt(e,!!r,t,!1);return;case`textarea`:for(s in Ed(`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:Bd(e,t,s,c,n,null)}Ut(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Bd(e,t,l,r,n,null)}return;case`dialog`:Ed(`beforetoggle`,e),Ed(`toggle`,e),Ed(`cancel`,e),Ed(`close`,e);break;case`iframe`:case`object`:Ed(`load`,e);break;case`video`:case`audio`:for(r=0;r<wd.length;r++)Ed(wd[r],e);break;case`image`:Ed(`error`,e),Ed(`load`,e);break;case`details`:Ed(`toggle`,e);break;case`embed`:case`source`:case`link`:Ed(`error`,e),Ed(`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:Bd(e,t,u,r,n,null)}return;default:if(Jt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Vd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Bd(e,t,c,r,n,null))}function Ud(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)||Bd(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&&Bd(e,t,p,m,r,f)}}Rt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Bd(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&&Bd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Vt(e,!!n,n?[]:``,!1):Vt(e,!!n,t,!0)):Vt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Bd(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&&Bd(e,t,s,a,r,o)}Ht(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Bd(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:Bd(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)&&Bd(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:Bd(e,t,u,p,r,m)}return;default:if(Jt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Vd(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||Vd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Bd(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||Bd(e,t,f,p,r,m)}function Wd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Gd(){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&&Wd(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&&Wd(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 Kd=null,qd=null;function Jd(e){return e.nodeType===9?e:e.ownerDocument}function Yd(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 Xd(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 Zd(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 Qd=null;function $d(){var e=window.event;return e&&e.type===`popstate`?e!==Qd&&(Qd=e,!0):(Qd=null,!1)}var ef=typeof setTimeout==`function`?setTimeout:void 0,tf=typeof clearTimeout==`function`?clearTimeout:void 0,nf=typeof Promise==`function`?Promise:void 0,rf=typeof queueMicrotask==`function`?queueMicrotask:nf===void 0?ef:function(e){return nf.resolve(null).then(e).catch(af)};function af(e){setTimeout(function(){throw e})}function of(e){return e===`head`}function sf(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),Vp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)xf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,xf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ft]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&xf(e.ownerDocument.body)}n=i}while(n);Vp(t)}function cf(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 lf(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`:lf(n),pt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function uf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[ft])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=gf(e.nextSibling),e===null)break}return null}function df(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=gf(e.nextSibling),e===null))return null;return e}function ff(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=gf(e.nextSibling),e===null))return null;return e}function pf(e){return e.data===`$?`||e.data===`$~`}function mf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function hf(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 gf(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 _f=null;function vf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return gf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function yf(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 bf(e,t,n){switch(t=Jd(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 xf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);pt(e)}var Sf=new Map,Cf=new Set;function wf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Tf=F.d;F.d={f:Ef,r:Df,D:Af,C:jf,L:Mf,m:Nf,X:Ff,S:Pf,M:If};function Ef(){var e=Tf.f(),t=Du();return e||t}function Df(e){var t=ht(e);t!==null&&t.tag===5&&t.type===`form`?Es(t):Tf.r(e)}var Of=typeof document>`u`?null:document;function kf(e,t,n){var r=Of;if(r&&typeof t==`string`&&t){var i=Lt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Cf.has(i)||(Cf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Hd(t,`link`,e),vt(t),r.head.appendChild(t)))}}function Af(e){Tf.D(e),kf(`dns-prefetch`,e,null)}function jf(e,t){Tf.C(e,t),kf(`preconnect`,e,t)}function Mf(e,t,n){Tf.L(e,t,n);var r=Of;if(r&&e&&t){var i=`link[rel="preload"][as="`+Lt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Lt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Lt(n.imageSizes)+`"]`)):i+=`[href="`+Lt(e)+`"]`;var a=i;switch(t){case`style`:a=Rf(e);break;case`script`:a=Hf(e)}Sf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Sf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(zf(a))||t===`script`&&r.querySelector(Uf(a))||(t=r.createElement(`link`),Hd(t,`link`,e),vt(t),r.head.appendChild(t)))}}function Nf(e,t){Tf.m(e,t);var n=Of;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Lt(r)+`"][href="`+Lt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Hf(e)}if(!Sf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),Sf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Uf(a)))return}r=n.createElement(`link`),Hd(r,`link`,e),vt(r),n.head.appendChild(r)}}}function Pf(e,t,n){Tf.S(e,t,n);var r=Of;if(r&&e){var i=_t(r).hoistableStyles,a=Rf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(zf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Sf.get(a))&&Kf(e,n);var c=o=r.createElement(`link`);vt(c),Hd(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,Gf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Ff(e,t){Tf.X(e,t);var n=Of;if(n&&e){var r=_t(n).hoistableScripts,i=Hf(e),a=r.get(i);a||(a=n.querySelector(Uf(i)),a||(e=f({src:e,async:!0},t),(t=Sf.get(i))&&qf(e,t),a=n.createElement(`script`),vt(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function If(e,t){Tf.M(e,t);var n=Of;if(n&&e){var r=_t(n).hoistableScripts,i=Hf(e),a=r.get(i);a||(a=n.querySelector(Uf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=Sf.get(i))&&qf(e,t),a=n.createElement(`script`),vt(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Lf(e,t,n,r){var a=(a=se.current)?wf(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=Rf(n.href),n=_t(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Rf(n.href);var o=_t(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(zf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Sf.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},Sf.set(e,n),o||Vf(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=Hf(n),n=_t(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Rf(e){return`href="`+Lt(e)+`"`}function zf(e){return`link[rel="stylesheet"][`+e+`]`}function Bf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Vf(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}),Hd(t,`link`,n),vt(t),e.head.appendChild(t))}function Hf(e){return`[src="`+Lt(e)+`"]`}function Uf(e){return`script[async]`+e}function Wf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Lt(n.href)+`"]`);if(r)return t.instance=r,vt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),vt(r),Hd(r,`style`,a),Gf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Rf(n.href);var o=e.querySelector(zf(a));if(o)return t.state.loading|=4,t.instance=o,vt(o),o;r=Bf(n),(a=Sf.get(a))&&Kf(r,a),o=(e.ownerDocument||e).createElement(`link`),vt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Hd(o,`link`,r),t.state.loading|=4,Gf(o,n.precedence,e),t.instance=o;case`script`:return o=Hf(n.src),(a=e.querySelector(Uf(o)))?(t.instance=a,vt(a),a):(r=n,(a=Sf.get(o))&&(r=f({},n),qf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),vt(a),Hd(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,Gf(r,n.precedence,e));return t.instance}function Gf(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 Kf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function qf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Jf=null;function Yf(e,t,n){if(Jf===null){var r=new Map,i=Jf=new Map;i.set(n,r)}else i=Jf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[ft]||a[at]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Xf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Zf(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 Qf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function $f(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=Rf(r.href),a=t.querySelector(zf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=np.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,vt(a);return}a=t.ownerDocument||t,r=Bf(r),(i=Sf.get(i))&&Kf(r,i),a=a.createElement(`link`),vt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Hd(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=np.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ep=0;function tp(e,t){return e.stylesheets&&e.count===0&&ip(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ip(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ep===0&&(ep=62500*Gd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ip(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ep?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function np(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ip(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var rp=null;function ip(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,rp=new Map,t.forEach(ap,e),rp=null,np.call(e))}function ap(e,t){if(!(t.state.loading&4)){var n=rp.get(e);if(n)var r=n.get(null);else{n=new Map,rp.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=np.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 op={$$typeof:b,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function sp(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=Je(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Je(0),this.hiddenUpdates=Je(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 cp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new sp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=oi(3,null,null,t),e.current=a,a.stateNode=e,t=sa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ra(a),e}function lp(e){return e?(e=ii,e):ii}function up(e,t,n,r,i,a){i=lp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ba(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Va(e,r,t),n!==null&&(Su(n,e,t),Ha(n,e,t))}function dp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function fp(e,t){dp(e,t),(e=e.alternate)&&dp(e,t)}function pp(e){if(e.tag===13||e.tag===31){var t=ti(e,67108864);t!==null&&Su(t,e,67108864),fp(e,67108864)}}function mp(e){if(e.tag===13||e.tag===31){var t=bu();t=et(t);var n=ti(e,t);n!==null&&Su(n,e,t),fp(e,t)}}var hp=!0;function gp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=2,vp(e,t,n,r)}finally{F.p=a,P.T=i}}function _p(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=8,vp(e,t,n,r)}finally{F.p=a,P.T=i}}function vp(e,t,n,r){if(hp){var i=yp(r);if(i===null)jd(e,t,r,bp,n),jp(e,r);else if(Np(i,e,t,n,r))r.stopPropagation();else if(jp(e,r),t&4&&-1<Ap.indexOf(e)){for(;i!==null;){var a=ht(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ue(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ie(o);s.entanglements[1]|=c,o&=~c}ud(a),!(Vl&6)&&(cu=we()+500,dd(0,!1))}}break;case 31:case 13:s=ti(a,2),s!==null&&Su(s,a,2),Du(),fp(a,2)}if(a=yp(r),a===null&&jd(e,t,r,bp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else jd(e,t,r,null,n)}}function yp(e){return e=en(e),xp(e)}var bp=null;function xp(e){if(bp=null,e=mt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return bp=e,null}function Sp(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(Te()){case Ee:return 2;case De:return 8;case Oe:case ke:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var Cp=!1,wp=null,Tp=null,Ep=null,Dp=new Map,Op=new Map,kp=[],Ap=`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 jp(e,t){switch(e){case`focusin`:case`focusout`:wp=null;break;case`dragenter`:case`dragleave`:Tp=null;break;case`mouseover`:case`mouseout`:Ep=null;break;case`pointerover`:case`pointerout`:Dp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Op.delete(t.pointerId)}}function Mp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=ht(t),t!==null&&pp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Np(e,t,n,r,i){switch(t){case`focusin`:return wp=Mp(wp,e,t,n,r,i),!0;case`dragenter`:return Tp=Mp(Tp,e,t,n,r,i),!0;case`mouseover`:return Ep=Mp(Ep,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Dp.set(a,Mp(Dp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Op.set(a,Mp(Op.get(a)||null,e,t,n,r,i)),!0}return!1}function Pp(e){var t=mt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,rt(e.priority,function(){mp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,rt(e.priority,function(){mp(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 Fp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=yp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);$t=r,n.target.dispatchEvent(r),$t=null}else return t=ht(n),t!==null&&pp(t),e.blockedOn=n,!1;t.shift()}return!0}function Ip(e,t,n){Fp(e)&&n.delete(t)}function Lp(){Cp=!1,wp!==null&&Fp(wp)&&(wp=null),Tp!==null&&Fp(Tp)&&(Tp=null),Ep!==null&&Fp(Ep)&&(Ep=null),Dp.forEach(Ip),Op.forEach(Ip)}function Rp(e,n){e.blockedOn===n&&(e.blockedOn=null,Cp||(Cp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Lp)))}var zp=null;function Bp(e){zp!==e&&(zp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){zp===e&&(zp=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(xp(r||n)===null)continue;break}var a=ht(n);a!==null&&(e.splice(t,3),t-=3,ws(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Vp(e){function t(t){return Rp(t,e)}wp!==null&&Rp(wp,e),Tp!==null&&Rp(Tp,e),Ep!==null&&Rp(Ep,e),Dp.forEach(t),Op.forEach(t);for(var n=0;n<kp.length;n++){var r=kp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<kp.length&&(n=kp[0],n.blockedOn===null);)Pp(n),n.blockedOn===null&&kp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[ot]||null;if(typeof a==`function`)o||Bp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[ot]||null)s=o.formAction;else if(xp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Bp(n)}}}function Hp(){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 Up(e){this._internalRoot=e}Wp.prototype.render=Up.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;up(n,bu(),e,t,null,null)},Wp.prototype.unmount=Up.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;up(e.current,2,null,e,null,null),Du(),t[st]=null}};function Wp(e){this._internalRoot=e}Wp.prototype.unstable_scheduleHydration=function(e){if(e){var t=nt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<kp.length&&t!==0&&t<kp[n].priority;n++);kp.splice(n,0,e),n===0&&Pp(e)}};var Gp=n.version;if(Gp!==`19.2.8`)throw Error(i(527,Gp,`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 Kp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:P,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var qp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qp.isDisabled&&qp.supportsFiber)try{Ne=qp.inject(Kp),Pe=qp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=qs,s=Js,c=Ys;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=cp(e,1,!1,null,null,n,r,null,o,s,c,Hp),e[st]=t.current,kd(e),new Up(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,I=[];Object.freeze(I);var L={};Object.freeze(L);var R=typeof Proxy<`u`,ie=Object.toString();function ae(){R||M(`Proxy not available`)}function oe(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var se=function(){};function z(e){return typeof e==`function`}function ce(e){switch(typeof e){case`string`:case`symbol`:case`number`:return!0}return!1}function le(e){return typeof e==`object`&&!!e}function ue(e){if(!le(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()===ie}function de(e){var t=e?.constructor;return t?t.name===`GeneratorFunction`||t.displayName===`GeneratorFunction`:!1}function fe(e,t,n){ne(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function pe(e,t,n){ne(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function me(e,t){var n=`isMobX`+e;return t.prototype[n]=!0,function(e){return le(e)&&e[n]===!0}}function he(e){return e!=null&&Object.prototype.toString.call(e)===`[object Map]`}function ge(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t);return Object.getPrototypeOf(n)===null}function _e(e){return e!=null&&Object.prototype.toString.call(e)===`[object Set]`}var ve=Object.getOwnPropertySymbols!==void 0;function ye(e){var t=Object.keys(e);if(!ve)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(t){return re.propertyIsEnumerable.call(e,t)})):t}var be=typeof Reflect<`u`&&Reflect.ownKeys?Reflect.ownKeys:ve?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function xe(e){return e===null?null:typeof e==`object`?``+e:e}function Se(e,t){return re.hasOwnProperty.call(e,t)}var Ce=Object.getOwnPropertyDescriptors||function(e){var t={};return be(e).forEach(function(n){t[n]=F(e,n)}),t};function we(e,t){return!!(e&t)}function Te(e,t,n){return n?e|=t:e&=~t,e}function Ee(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 De(e,t,n){if(Fe())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&Ie(i,n.prototype),i}function Oe(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,Re(r.key),r)}}function ke(e,t,n){return t&&Oe(e.prototype,t),n&&Oe(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ae(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=ze(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 je(){return je=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},je.apply(null,arguments)}function Me(e){return Me=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Me(e)}function Ne(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ie(e,t)}function Pe(e){try{return Function.toString.call(e).indexOf(`[native code]`)!==-1}catch{return typeof e==`function`}}function Fe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Fe=function(){return!!e})()}function Ie(e,t){return Ie=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ie(e,t)}function Le(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 Re(e){var t=Le(e,`string`);return typeof t==`symbol`?t:t+``}function ze(e,t){if(e){if(typeof e==`string`)return Ee(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)?Ee(e,t):void 0}}function Be(e){var t=typeof Map==`function`?new Map:void 0;return Be=function(e){if(e===null||!Pe(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 De(e,arguments,Me(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Ie(n,e)},Be(e)}var Ve=Symbol(`mobx-stored-annotations`);function He(e){function t(t,n){if(Ge(n))return e.decorate_20223_(t,n);Ue(t,n,e)}return Object.assign(t,e)}function Ue(e,t,n){Se(e,Ve)||fe(e,Ve,je({},e[Ve])),ot(n)||(e[Ve][t]=n)}function We(e){return Se(e,Ve)||fe(e,Ve,je({},e[Ve])),e[Ve]}function Ge(e){return typeof e==`object`&&typeof e.kind==`string`}var Ke=Symbol(`mobx administration`),qe=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_=vn.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 Hn(this)},t.reportChanged=function(){Bn(),Un(this),Vn()},t.toString=function(){return this.name_},ke(e,[{key:`isBeingObserved`,get:function(){return we(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=Te(this.flags_,e.isBeingObservedMask_,t)}},{key:`isPendingUnobservation`,get:function(){return we(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=Te(this.flags_,e.isPendingUnobservationMask_,t)}},{key:`diffValue`,get:function(){return+!!we(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=Te(this.flags_,e.diffValueMask_,t===1)}}])}();qe.isBeingObservedMask_=1,qe.isPendingUnobservationMask_=2,qe.diffValueMask_=4;var Je=me(`Atom`,qe);function Ye(e,t,n){t===void 0&&(t=se),n===void 0&&(n=se);var r=new qe(e);return t!==se&&Sr(r,t),n!==se&&Cr(r,n),r}function Xe(e,t){return e===t}function Ze(e,t){return sa(e,t)}function Qe(e,t){return sa(e,t,1)}function $e(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e==1/t:e!==e&&t!==t}var et={identity:Xe,structural:Ze,default:$e,shallow:Qe};function tt(e,t,n){return Gr(e)?e:Array.isArray(e)?Xt.array(e,{name:n}):ue(e)?Xt.object(e,void 0,{name:n}):he(e)?Xt.map(e,{name:n}):_e(e)?Xt.set(e,{name:n}):typeof e==`function`&&!mr(e)&&!zr(e)?de(e)?Lr(e):fr(n,e):e}function nt(e,t,n){if(e==null||Wi(e)||Ei(e)||ji(e)||Ii(e))return e;if(Array.isArray(e))return Xt.array(e,{name:n,deep:!1});if(ue(e))return Xt.object(e,void 0,{name:n,deep:!1});if(he(e))return Xt.map(e,{name:n,deep:!1});if(_e(e))return Xt.set(e,{name:n,deep:!1})}function rt(e){return e}function it(e,t){return sa(e,t)?t:e}var at=`override`;function ot(e){return e.annotationType_===at}function st(e,t){return{annotationType_:e,options_:t,make_:ct,extend_:lt,decorate_20223_:ut}}function ct(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:mr(n.value)?1:(ne(r,t,ft(e,this,t,n,!1)),2)}function lt(e,t,n,r){var i=ft(e,this,t,n);return e.defineProperty_(t,i,r)}function ut(e,t){var n=t.kind,r=t.name,i=t.addInitializer,a=this,o=function(e){return sn(a.options_?.name??r.toString(),e,a.options_?.autoAction??!1)};if(n==`field`)return function(e){var t,n=e;return mr(n)||(n=o(n)),(t=a.options_)!=null&&t.bound&&(n=n.bind(this),n.isMobxAction=!0),n};if(n==`method`){var s;return mr(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 dt(e,t,n,r){t.annotationType_,r.value}function ft(e,t,n,r,i){var a,o;i===void 0&&(i=B.safeDescriptors),dt(e,t,n,r);var s=r.value;return(a=t.options_)!=null&&a.bound&&(s=s.bind(e.proxy_??e.target_)),{value:sn(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 pt(e,t){return{annotationType_:e,options_:t,make_:mt,extend_:ht,decorate_20223_:gt}}function mt(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&&(!Se(e.target_,t)||!zr(e.target_[t]))&&this.extend_(e,t,n,!1)===null?0:zr(n.value)?1:(ne(r,t,vt(e,this,t,n,!1,!1)),2)}function ht(e,t,n,r){var i=vt(e,this,t,n,this.options_?.bound);return e.defineProperty_(t,i,r)}function gt(e,t){var n,r=t.name,i=t.addInitializer;return zr(e)||(e=Lr(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 _t(e,t,n,r){t.annotationType_,r.value}function vt(e,t,n,r,i,a){a===void 0&&(a=B.safeDescriptors),_t(e,t,n,r);var o=r.value;return zr(o)||(o=Lr(o)),i&&(o=o.bind(e.proxy_??e.target_),o.isMobXFlow=!0),{value:o,configurable:!a||e.isPlainObject_,enumerable:!1,writable:!a}}function yt(e,t){return{annotationType_:e,options_:t,make_:bt,extend_:xt,decorate_20223_:St}}function bt(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function xt(e,t,n,r){return Ct(e,this,t,n),e.defineComputedProperty_(t,je({},this.options_,{get:n.get,set:n.set}),r)}function St(e,t){var n=this,r=t.name,i=t.addInitializer,a;function o(t,i){var a=je({},n.options_,{get:e,context:t});return a.name||=`ObservableObject.`+r.toString(),new gn(a)}return i(function(){var t=Vi(this)[Ke],n=this,i=t.values_.get(r);i instanceof gn&&i.derivation!==e&&t.values_.delete(r),(t.lazyComputedKeys_??=new Map).set(r,function(){return o(n,t)})}),function(){var t=this[Ke],n=t.values_.get(r);if(n instanceof gn&&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 Ct(e,t,n,r){t.annotationType_,r.get}function wt(e,t){return{annotationType_:e,options_:t,make_:Tt,extend_:Et,decorate_20223_:Dt}}function Tt(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function Et(e,t,n,r){return Ot(e,this,t,n),e.defineObservableProperty_(t,n.value,this.options_?.enhancer??tt,r)}function Dt(e,t){var n=this,r=t.kind,i=t.name;if(r!==`accessor`)return;function a(e,t){var r=Vi(e)[Ke];return(r.lazyObservableKeys_??=new Map).set(i,function(){return new mn(t,n.options_?.enhancer??tt,`ObservableObject.`+i.toString(),!1)}),r}return{get:function(){return(this[Ke]??a(this,e.get.call(this))).getObservablePropValue_(i)},set:function(e){return(this[Ke]??a(this,e)).setObservablePropValue_(i,e)},init:function(e){return a(this,e),e}}}function Ot(e,t,n,r){t.annotationType_}var kt=`true`,At=jt();function jt(e){return{annotationType_:kt,options_:e,make_:Mt,extend_:Nt,decorate_20223_:Pt}}function Mt(e,t,n,r){var i;if(n.get)return tn.make_(e,t,n,r);if(n.set){var a=mr(n.set)?n.set:sn(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:!B.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(de(n.value)){var s;return((s=this.options_)!=null&&s.autoBind?Lr.bound:Lr).make_(e,t,n,r)}return((o=this.options_)!=null&&o.autoBind?fr.bound:fr).make_(e,t,n,r)}var c=this.options_?.deep===!1?Xt.ref:Xt;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 Nt(e,t,n,r){var i;return n.get?tn.extend_(e,t,n,r):n.set?e.defineProperty_(t,{configurable:!B.safeDescriptors||e.isPlainObject_,set:sn(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?Xt.ref:Xt).extend_(e,t,n,r))}function Pt(e,t){M(`'`+this.annotationType_+`' cannot be used as a decorator`)}var Ft=`observable`,It=`observable.ref`,Lt=`observable.shallow`,Rt=`observable.struct`,zt={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(zt);function Bt(e){return e||zt}var Vt=wt(Ft),Ht=wt(It,{enhancer:rt}),Ut=wt(Lt,{enhancer:nt}),Wt=wt(Rt,{enhancer:it}),Gt=He(Vt);function Kt(e){return e.deep===!0?tt:e.deep===!1?rt:Jt(e.defaultDecorator)}function qt(e){return e?e.defaultDecorator??jt(e):void 0}function Jt(e){return e?e.options_?.enhancer??tt:tt}function Yt(e,t,n){if(Ge(t))return Vt.decorate_20223_(e,t);if(ce(t)){Ue(e,t,Vt);return}return Gr(e)?e:ue(e)?Xt.object(e,t,n):Array.isArray(e)?Xt.array(e,t):he(e)?Xt.map(e,t):_e(e)?Xt.set(e,t):typeof e==`object`&&e?e:Xt.box(e,t)}P(Yt,Gt);var Xt=P(Yt,{box:function(e,t){var n=Bt(t);return new mn(e,Kt(n),n.name,!0,n.equals)},array:function(e,t){var n=Bt(t);return(B.useProxies===!1||n.proxy===!1?ta:yi)(e,Kt(n),n.name)},map:function(e,t){var n=Bt(t);return new Ai(e,Kt(n),n.name)},set:function(e,t){var n=Bt(t);return new Fi(e,Kt(n),n.name)},object:function(e,t,n){return aa(function(){return kr(B.useProxies===!1||n?.proxy===!1?Vi({},n):oi({},n),e,t)})},ref:He(Ht),shallow:He(Ut),deep:Gt,struct:He(Wt)}),Zt=`computed`,Qt=`computed.struct`,$t=yt(Zt),en=yt(Qt,{equals:et.structural}),tn=function(e,t){if(Ge(t))return $t.decorate_20223_(e,t);if(ce(t))return Ue(e,t,$t);if(ue(e))return He(yt(Zt,e));var n=ue(t)?t:{};return n.get=e,n.name||=e.name||``,new gn(n)};Object.assign(tn,$t),tn.struct=He(en);var nn=0,rn=1,an=F(function(){},`name`)?.configurable??!1,on={value:`action`,configurable:!0,writable:!1,enumerable:!1};function sn(e,t,n,r){n===void 0&&(n=!1);function i(){return cn(e,n,t,r||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},an&&(on.value=e,ne(i,`name`,on)),i}function cn(e,t,n,r,i){var a=ln(e,t,r,i);try{return n.apply(r,i)}catch(e){throw a.error_=e,e}finally{un(a)}}function ln(e,t,n,r){var i=!1,a=0,o=B.trackingDerivation,s=!t||!o;Bn();var c=B.allowStateChanges;s&&(Dn(),c=fn(!0));var l=kn(!0),u={runAsAction_:s,prevDerivation_:o,prevAllowStateChanges_:c,prevAllowStateReads_:l,notifySpy_:i,startTime_:a,actionId_:rn++,parentActionId_:nn};return nn=u.actionId_,u}function un(e){nn!==e.actionId_&&M(30),nn=e.parentActionId_,e.error_!==void 0&&(B.suppressReactionErrors=!0),pn(e.prevAllowStateChanges_),An(e.prevAllowStateReads_),Vn(),e.runAsAction_&&On(e.prevDerivation_),B.suppressReactionErrors=!1}function dn(e,t){var n=fn(e);try{return t()}finally{pn(n)}}function fn(e){var t=B.allowStateChanges;return B.allowStateChanges=e,t}function pn(e){B.allowStateChanges=e}var mn=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=et.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}Ne(t,e);var n=t.prototype;return n.dehanceValue=function(e){return this.dehancer===void 0?e:this.dehancer(e)},n.set=function(e){this.value_,e=this.prepareNewValue_(e),e!==B.UNCHANGED&&this.setNewValue_(e)},n.prepareNewValue_=function(e){if(si(this)){var t=li(this,{object:this,type:hi,newValue:e});if(!t)return B.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?B.UNCHANGED:e},n.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),ui(this)&&fi(this,{type:hi,object:this,newValue:e,oldValue:t})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(e){return ci(this,e)},n.observe_=function(e,t){return t&&e({observableKind:`value`,debugObjectName:this.name_,object:this,type:hi,newValue:this.value_,oldValue:void 0}),di(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 xe(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(qe),hn=me(`ObservableValue`,mn),gn=function(){function e(e){this.dependenciesState_=vn.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=vn.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new bn(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=yn.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_=sn(`ComputedValue-setter`,e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?et.structural:et.default),this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){Gn(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),B.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)Sn(this)&&(this.warnAboutUntrackedRead_(),Bn(),this.value_=this.computeValue_(!1),Vn());else if(Hn(this),Sn(this)){var e=B.trackingContext;this.keepAlive_&&!e&&(B.trackingContext=this),this.trackAndCompute()&&Wn(this),B.trackingContext=e}var t=this.value_;if(xn(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_===vn.NOT_TRACKING_,n=this.computeValue_(!0),r=t||xn(e)||xn(n)||!this.equals_(e,n);return r&&(this.value_=n),r},t.computeValue_=function(e){this.isComputing=!0;var t=fn(!1),n;if(e)n=Cn(this,this.derivation,this.scope_);else if(B.disableErrorBoundaries===!0)n=this.derivation.call(this.scope_);else try{n=this.derivation.call(this.scope_)}catch(e){n=new bn(e)}return pn(t),this.isComputing=!1,n},t.suspend_=function(){this.keepAlive_||(Tn(this),this.value_=void 0)},t.observe_=function(e,t){var n=this,r=!0,i=void 0;return hr(function(){var a=n.get();if(!r||t){var o=Dn();e({observableKind:`computed`,debugObjectName:n.name_,type:hi,object:n,newValue:a,oldValue:i}),On(o)}r=!1,i=a})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+`[`+this.derivation.toString()+`]`},t.valueOf=function(){return xe(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},ke(e,[{key:`isComputing`,get:function(){return we(this.flags_,e.isComputingMask_)},set:function(t){this.flags_=Te(this.flags_,e.isComputingMask_,t)}},{key:`isRunningSetter`,get:function(){return we(this.flags_,e.isRunningSetterMask_)},set:function(t){this.flags_=Te(this.flags_,e.isRunningSetterMask_,t)}},{key:`isBeingObserved`,get:function(){return we(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=Te(this.flags_,e.isBeingObservedMask_,t)}},{key:`isPendingUnobservation`,get:function(){return we(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=Te(this.flags_,e.isPendingUnobservationMask_,t)}},{key:`diffValue`,get:function(){return+!!we(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=Te(this.flags_,e.diffValueMask_,t===1)}}])}();gn.isComputingMask_=1,gn.isRunningSetterMask_=2,gn.isBeingObservedMask_=4,gn.isPendingUnobservationMask_=8,gn.diffValueMask_=16;var _n=me(`ComputedValue`,gn),vn;(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_`})(vn||={});var yn;(function(e){e[e.NONE=0]=`NONE`,e[e.LOG=1]=`LOG`,e[e.BREAK=2]=`BREAK`})(yn||={});var bn=function(e){this.cause=void 0,this.cause=e};function xn(e){return e instanceof bn}function Sn(e){switch(e.dependenciesState_){case vn.UP_TO_DATE_:return!1;case vn.NOT_TRACKING_:case vn.STALE_:return!0;case vn.POSSIBLY_STALE_:for(var t=kn(!0),n=Dn(),r=e.observing_,i=r.length,a=0;a<i;a++){var o=r[a];if(_n(o)){if(B.disableErrorBoundaries)o.get();else try{o.get()}catch{return On(n),An(t),!0}if(e.dependenciesState_===vn.STALE_)return On(n),An(t),!0}}return jn(e),On(n),An(t),!1}}function Cn(e,t,n){var r=kn(!0);jn(e),e.newObserving_=Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++B.runId;var i=B.trackingDerivation;B.trackingDerivation=e,B.inBatch++;var a;if(B.disableErrorBoundaries===!0)a=t.call(n);else try{a=t.call(n)}catch(e){a=new bn(e)}return B.inBatch--,B.trackingDerivation=i,wn(e),An(r),a}function wn(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=vn.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&&Rn(c,e),c.diffValue=0}for(;i--;){var l=n[i];l.diffValue===1&&(l.diffValue=0,Ln(l,e))}r!==vn.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function Tn(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Rn(t[n],e);e.dependenciesState_=vn.NOT_TRACKING_}function En(e){var t=Dn();try{return e()}finally{On(t)}}function Dn(){var e=B.trackingDerivation;return B.trackingDerivation=null,e}function On(e){B.trackingDerivation=e}function kn(e){var t=B.allowStateReads;return B.allowStateReads=e,t}function An(e){B.allowStateReads=e}function jn(e){if(e.dependenciesState_!==vn.UP_TO_DATE_){e.dependenciesState_=vn.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=vn.UP_TO_DATE_}}var Mn=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},Nn=!0,Pn=!1,B=function(){var e=N();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Nn=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Mn().version&&(Nn=!1),Nn?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Mn):(setTimeout(function(){Pn||M(35)},1),new Mn)}();function Fn(){if((B.pendingReactions.length||B.inBatch||B.isRunningReactions)&&M(36),Pn=!0,Nn){var e=N();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),B=new Mn}}function In(){return B}function Ln(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Rn(e,t){e.observers_.delete(t),e.observers_.size===0&&zn(e)}function zn(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,B.pendingUnobservations.push(e))}function Bn(){B.inBatch++}function Vn(){if(--B.inBatch===0){Yn();for(var e=B.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof gn&&n.suspend_())}B.pendingUnobservations=[]}}function Hn(e){var t=B.trackingDerivation;return t===null?(e.observers_.size===0&&B.inBatch>0&&zn(e),!1):(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&B.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved)}function Un(e){e.lowestObserverState_!==vn.STALE_&&(e.lowestObserverState_=vn.STALE_,e.observers_.forEach(function(e){e.dependenciesState_===vn.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=vn.STALE_}))}function Wn(e){e.lowestObserverState_!==vn.STALE_&&(e.lowestObserverState_=vn.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===vn.POSSIBLY_STALE_?t.dependenciesState_=vn.STALE_:t.dependenciesState_===vn.UP_TO_DATE_&&(e.lowestObserverState_=vn.UP_TO_DATE_)}))}function Gn(e){e.lowestObserverState_===vn.UP_TO_DATE_&&(e.lowestObserverState_=vn.POSSIBLY_STALE_,e.observers_.forEach(function(e){e.dependenciesState_===vn.UP_TO_DATE_&&(e.dependenciesState_=vn.POSSIBLY_STALE_,e.onBecomeStale_())}))}var Kn=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_=vn.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=yn.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,B.pendingReactions.push(this),Yn())},t.runReaction_=function(){if(!this.isDisposed){Bn(),this.isScheduled=!1;var e=B.trackingContext;if(B.trackingContext=this,Sn(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}B.trackingContext=e,Vn()}},t.track=function(e){if(!this.isDisposed){Bn(),this.isRunning=!0;var t=B.trackingContext;B.trackingContext=this;var n=Cn(this,e,void 0);B.trackingContext=t,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Tn(this),xn(n)&&this.reportExceptionInDerivation_(n.cause),Vn()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_){this.errorHandler_(e,this);return}if(B.disableErrorBoundaries)throw e;var n=`[mobx] uncaught error in '`+this+`'`;B.suppressReactionErrors||console.error(n,e),B.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Bn(),Tn(this),Vn()))},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[Ke]=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)},ke(e,[{key:`isDisposed`,get:function(){return we(this.flags_,e.isDisposedMask_)},set:function(t){this.flags_=Te(this.flags_,e.isDisposedMask_,t)}},{key:`isScheduled`,get:function(){return we(this.flags_,e.isScheduledMask_)},set:function(t){this.flags_=Te(this.flags_,e.isScheduledMask_,t)}},{key:`isTrackPending`,get:function(){return we(this.flags_,e.isTrackPendingMask_)},set:function(t){this.flags_=Te(this.flags_,e.isTrackPendingMask_,t)}},{key:`isRunning`,get:function(){return we(this.flags_,e.isRunningMask_)},set:function(t){this.flags_=Te(this.flags_,e.isRunningMask_,t)}},{key:`diffValue`,get:function(){return+!!we(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=Te(this.flags_,e.diffValueMask_,t===1)}}])}();Kn.isDisposedMask_=1,Kn.isScheduledMask_=2,Kn.isTrackPendingMask_=4,Kn.isRunningMask_=8,Kn.diffValueMask_=16;var qn=100,Jn=function(e){return e()};function Yn(){B.inBatch>0||B.isRunningReactions||Jn(Xn)}function Xn(){B.isRunningReactions=!0;for(var e=B.pendingReactions,t=0;e.length>0;){++t===qn&&(console.error(`[mobx] cycle in reaction: `+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r<i;r++)n[r].runReaction_()}B.isRunningReactions=!1}var Zn=me(`Reaction`,Kn);function Qn(e){var t=Jn;Jn=function(n){return e(function(){return t(n)})}}function $n(){return!1}function er(e){return console.warn(`[mobx.spy] Is a no-op in production builds`),function(){}}var tr=`action`,nr=`action.bound`,rr=`autoAction`,ir=`autoAction.bound`,ar=`<unnamed action>`,or=st(tr),sr=st(nr,{bound:!0}),cr=st(rr,{autoAction:!0}),lr=st(ir,{autoAction:!0,bound:!0});function ur(e){return function(t,n){if(z(t))return sn(t.name||ar,t,e);if(z(n))return sn(t,n,e);if(Ge(n))return(e?cr:or).decorate_20223_(t,n);if(ce(n))return Ue(t,n,e?cr:or);if(ce(t))return He(st(e?rr:tr,{name:t,autoAction:e}))}}var dr=ur(!1);Object.assign(dr,or);var fr=ur(!0);Object.assign(fr,cr),dr.bound=He(sr),fr.bound=He(lr);function pr(e){return cn(e.name||ar,!1,e,this,void 0)}function mr(e){return z(e)&&e.isMobxAction===!0}function hr(e,t){var n;t===void 0&&(t=L);var r=t?.name??`Autorun`,i=!t.scheduler&&!t.delay,a;if(i)a=new Kn(r,function(){this.track(c)},t.onError,t.requiresObservable);else{var o=_r(t),s=!1;a=new Kn(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 gr=function(e){return e()};function _r(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:gr}function vr(e,t,n){var r;n===void 0&&(n=L);var i=n.name??`Reaction`,a=dr(i,n.onError?yr(n.onError,t):t),o=!n.scheduler&&!n.delay,s=_r(n),c=!0,l=!1,u,d=n.compareStructural?et.structural:n.equals||et.default,f=new Kn(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=dn(!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 yr(e,t){return function(){try{return t.apply(this,arguments)}catch(t){e.call(this,t)}}}var br=`onBO`,xr=`onBUO`;function Sr(e,t,n){return wr(br,e,t,n)}function Cr(e,t,n){return wr(xr,e,t,n)}function wr(e,t,n,r){var i=typeof r==`function`?na(t,n):na(t),a=z(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 Tr=`never`,Er=`always`,Dr=`observed`;function Or(e){e.isolateGlobalState===!0&&Fn();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(B.useProxies=t===Er||t!==Tr&&typeof Proxy<`u`),t===`ifavailable`&&(B.verifyProxies=!0),n!==void 0){var r=n===Er?Er:n===Dr;B.enforceActions=r,B.allowStateChanges=r!==!0&&r!==Er}[`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`disableErrorBoundaries`,`safeDescriptors`].forEach(function(t){t in e&&(B[t]=!!e[t])}),B.allowStateReads=!B.observableRequiresReaction,e.reactionScheduler&&Qn(e.reactionScheduler)}function kr(e,t,n,r){var i=Ce(t);return aa(function(){var t=Vi(e,r)[Ke];be(i).forEach(function(e){t.extend_(e,i[e],n&&e in n?n[e]:!0)})}),e}function Ar(e,t){return jr(na(e,t))}function jr(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=Mr(e.observing_).map(jr)),t}function Mr(e){return Array.from(new Set(e))}var Nr=0,Pr=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}Ne(t,e);var n=t.prototype;return n.toString=function(){return`Error: `+this.message},t}(Be(Error)),Fr=pt(`flow`),Ir=pt(`flow.bound`,{bound:!0}),Lr=Object.assign(function(e,t){if(Ge(t))return Fr.decorate_20223_(e,t);if(ce(t))return Ue(e,t,Fr);var n=e,r=n.name||`<unnamed flow>`,i=function(){var e=this,t=arguments,i=++Nr,a=dr(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=dr(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=dr(r+` - runid: `+i+` - yield `+n++,a.throw).call(a,e)}catch(e){return t(e)}u(o)}function u(n){if(z(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=dr(r+` - runid: `+i+` - cancel`,function(){try{s&&Rr(s);var e=a.return(void 0),t=Promise.resolve(e.value);t.then(se,se),Rr(t),o(new Pr)}catch(e){o(e)}}),c};return i.isMobXFlow=!0,i},Fr);Lr.bound=He(Ir);function Rr(e){z(e.cancel)&&e.cancel()}function zr(e){return e?.isMobXFlow===!0}function Br(e,t,n){var r;return ji(e)||Ei(e)||hn(e)?r=ra(e):Wi(e)&&(r=ra(e,t)),r.dehancer=typeof t==`function`?t:n,function(){r.dehancer=void 0}}function Vr(e,t,n){return z(n)?Ur(e,t,n):Hr(e,t)}function Hr(e,t){return ra(e).intercept_(t)}function Ur(e,t,n){return ra(e,t).intercept_(n)}function Wr(e,t){if(!e)return!1;if(t!==void 0){if(Wi(e)){var n,r,i=e[Ke];return i.values_.has(t)||!!((n=i.lazyComputedKeys_)!=null&&n.has(t))||!!((r=i.lazyObservableKeys_)!=null&&r.has(t))}return!1}return Wi(e)||!!e[Ke]||Je(e)||Zn(e)||_n(e)}function Gr(e){return Wr(e)}function Kr(e){if(Wi(e))return e[Ke].keys_();if(ji(e)||Ii(e))return Array.from(e.keys());if(Ei(e))return e.map(function(e,t){return t});M(5)}function qr(e){if(Wi(e))return Kr(e).map(function(t){return e[t]});if(ji(e))return Kr(e).map(function(t){return e.get(t)});if(Ii(e))return Array.from(e.values());if(Ei(e))return e.slice();M(6)}function Jr(e){if(Wi(e))return Kr(e).map(function(t){return[t,e[t]]});if(ji(e))return Kr(e).map(function(t){return[t,e.get(t)]});if(Ii(e))return Array.from(e.entries());if(Ei(e))return e.map(function(e,t){return[t,e]});M(7)}function Yr(e,t,n){if(arguments.length===2&&!Ii(e)){Bn();var r=t;try{for(var i in r)Yr(e,i,r[i])}finally{Vn()}return}Wi(e)?e[Ke].set_(t,n):ji(e)?e.set(t,n):Ii(e)?e.add(t):Ei(e)?(typeof t!=`number`&&(t=parseInt(t,10)),t<0&&M(`Invalid index: '`+t+`'`),Bn(),t>=e.length&&(e.length=t+1),e[t]=n,Vn()):M(8)}function Xr(e,t,n){if(Wi(e))return e[Ke].defineProperty_(t,n);M(39)}function Zr(e,t,n,r){return z(n)?$r(e,t,n,r):Qr(e,t,n)}function Qr(e,t,n){return ra(e).observe_(t,n)}function $r(e,t,n,r){return ra(e,t).observe_(n,r)}function ei(e,t){t===void 0&&(t=void 0),Bn();try{return e.apply(t)}finally{Vn()}}function ti(e,t,n){return arguments.length===1||t&&typeof t==`object`?ri(e,t):ni(e,t,n||{})}function ni(e,t,n){var r;if(typeof n.timeout==`number`){var i=Error(`WHEN_TIMEOUT`);r=setTimeout(function(){if(!o[Ke].isDisposed){if(o(),n.onError)n.onError(i);else throw i}},n.timeout)}n.name=`When`;var a=sn(`When-effect`,t),o=hr(function(t){dn(!1,e)&&(t.dispose(),r&&clearTimeout(r),a())},n);return o}function ri(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=ni(e,n,je({},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 ii(e){return e[Ke]}var ai={has:function(e,t){return ii(e).has_(t)},get:function(e,t){return ii(e).get_(t)},set:function(e,t,n){return ce(t)?ii(e).set_(t,n,!0)??!0:!1},deleteProperty:function(e,t){return ce(t)?ii(e).delete_(t,!0)??!0:!1},defineProperty:function(e,t,n){return ii(e).defineProperty_(t,n)??!0},ownKeys:function(e){return ii(e).ownKeys_()},preventExtensions:function(e){M(13)}};function oi(e,t){var n;return ae(),e=Vi(e,t),(n=e[Ke]).proxy_??(n.proxy_=new Proxy(e,ai))}function si(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function ci(e,t){var n=e.interceptors_||=[];return n.push(t),oe(function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function li(e,t){var n=Dn();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{On(n)}}function ui(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function di(e,t){var n=e.changeListeners_||=[];return n.push(t),oe(function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function fi(e,t){var n=Dn(),r=e.changeListeners_;if(r){r=r.slice();for(var i=0,a=r.length;i<a;i++)r[i](t);On(n)}}function pi(e,t,n){return aa(function(){var r=Vi(e,n)[Ke];t??=We(e),be(t).forEach(function(e){return r.make_(e,t[e])})}),e}var mi=`splice`,hi=`update`,gi=1e4,_i={get:function(e,t){var n=e[Ke];return t===Ke?n:t===`length`?n.getArrayLength_():typeof t==`string`&&!isNaN(t)?n.get_(parseInt(t)):Se(bi,t)?bi[t]:e[t]},set:function(e,t,n){var r=e[Ke];return t===`length`&&r.setArrayLength_(n),typeof t==`symbol`||isNaN(t)?e[t]=n:r.set_(parseInt(t),n),!0},preventExtensions:function(){M(15)}},vi=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 qe(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 ci(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}),di(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&&ea(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=I),si(this)){var a=li(this,{object:this.proxy_,type:mi,index:e,removedCount:t,added:n});if(!a)return I;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<gi){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_&&$n(),i=ui(this),a=i||r?{observableKind:`array`,object:this.proxy_,type:hi,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;this.atom_.reportChanged(),i&&fi(this,a)},t.notifyArraySplice_=function(e,t,n){var r=!this.owned_&&$n(),i=ui(this),a=i||r?{observableKind:`array`,object:this.proxy_,debugObjectName:this.atom_.name_,type:mi,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;this.atom_.reportChanged(),i&&fi(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(si(this)){var i=li(this,{type:hi,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 yi(e,t,n,r){return n===void 0&&(n=`ObservableArray`),r===void 0&&(r=!1),ae(),aa(function(){var i=new vi(n,t,r,!1);pe(i.values_,Ke,i);var a=new Proxy(i.values_,_i);return i.proxy_=a,e&&e.length&&i.spliceWithArray_(0,0,e),a})}var bi={clear:function(){return this.splice(0)},replace:function(e){var t=this[Ke];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){var n=[...arguments].slice(2),r=this[Ke];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[Ke].spliceWithArray_(e,t,n)},push:function(){var e=this[Ke],t=[...arguments];return e.spliceWithArray_(e.values_.length,0,t),e.values_.length},pop:function(){return this.splice(Math.max(this[Ke].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){var e=this[Ke],t=[...arguments];return e.spliceWithArray_(0,0,t),e.values_.length},reverse:function(){return B.trackingDerivation&&M(37,`reverse`),this.replace(this.slice().reverse()),this},sort:function(){B.trackingDerivation&&M(37,`sort`);var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[Ke],n=t.dehanceValues_(t.values_).indexOf(e);return n>-1&&(this.splice(n,1),!0)}};xi(`at`,Si),xi(`concat`,Si),xi(`flat`,Si),xi(`includes`,Si),xi(`indexOf`,Si),xi(`join`,Si),xi(`lastIndexOf`,Si),xi(`slice`,Si),xi(`toString`,Si),xi(`toLocaleString`,Si),xi(`toSorted`,Si),xi(`toSpliced`,Si),xi(`with`,Si),xi(`every`,Ci),xi(`filter`,Ci),xi(`find`,Ci),xi(`findIndex`,Ci),xi(`findLast`,Ci),xi(`findLastIndex`,Ci),xi(`flatMap`,Ci),xi(`forEach`,Ci),xi(`map`,Ci),xi(`some`,Ci),xi(`toReversed`,Ci),xi(`reduce`,wi),xi(`reduceRight`,wi);function xi(e,t){typeof Array.prototype[e]==`function`&&(bi[e]=t(e))}function Si(e){return function(){var t=this[Ke];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Ci(e){return function(t,n){var r=this,i=this[Ke];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e](function(e,i){return t.call(n,e,i,r)})}}function wi(e){return function(){var t=this,n=this[Ke];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 Ti=me(`ObservableArrayAdministration`,vi);function Ei(e){return le(e)&&Ti(e[Ke])}var Di={},Oi=`add`,ki=`delete`,Ai=function(){function e(e,t,n){var r=this;t===void 0&&(t=tt),n===void 0&&(n=`ObservableMap`),this.enhancer_=void 0,this.name_=void 0,this[Ke]=Di,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,z(Map)||M(18),aa(function(){r.keysAtom_=Ye(`ObservableMap.keys()`),r.data_=new Map,r.hasMap_=new Map,e&&r.merge(e)})}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!B.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new mn(this.has_(e),rt,`ObservableMap.key?`,!1);this.hasMap_.set(e,r),Cr(r,function(){return t.hasMap_.delete(e)})}return n.get()},t.set=function(e,t){var n=this.has_(e);if(si(this)){var r=li(this,{type:n?hi:Oi,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_,si(this)&&!li(this,{type:ki,object:this,name:e}))return!1;if(this.has_(e)){var n=$n(),r=ui(this),i=r||n?{observableKind:`map`,debugObjectName:this.name_,type:ki,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return ei(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&&fi(this,i),!0}return!1},t.updateValue_=function(e,t){var n=this.data_.get(e);if(t=n.prepareNewValue_(t),t!==B.UNCHANGED){var r=$n(),i=ui(this),a=i||r?{observableKind:`map`,debugObjectName:this.name_,type:hi,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),i&&fi(this,a)}},t.addValue_=function(e,t){var n=this;this.keysAtom_,ei(function(){var r,i=new mn(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=$n(),i=ui(this),a=i||r?{observableKind:`map`,debugObjectName:this.name_,type:Oi,object:this,name:e,newValue:t}:null;i&&fi(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 Mi({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 Mi({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=Ae(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 ji(e)&&(e=new Map(e)),ei(function(){ue(e)?ye(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)}):he(e)?(ge(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;ei(function(){En(function(){for(var t=Ae(e.keys()),n;!(n=t()).done;){var r=n.value;e.delete(r)}})})},t.replace=function(e){var t=this;return ei(function(){for(var n=Ni(e),r=new Map,i=!1,a=Ae(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=Ae(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 di(this,e)},t.intercept_=function(e){return ci(this,e)},ke(e,[{key:`size`,get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return`Map`}}])}(),ji=me(`ObservableMap`,Ai);function Mi(e){return e[Symbol.toStringTag]=`MapIterator`,da(e)}function Ni(e){if(he(e)||ji(e))return e;if(Array.isArray(e))return new Map(e);if(ue(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return M(21,e)}var Pi={},Fi=function(){function e(e,t,n){var r=this;t===void 0&&(t=tt),n===void 0&&(n=`ObservableSet`),this.name_=void 0,this[Ke]=Pi,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,z(Set)||M(22),this.enhancer_=function(e,r){return t(e,r,n)},aa(function(){r.atom_=Ye(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;ei(function(){En(function(){for(var t=Ae(e.data_.values()),n;!(n=t()).done;){var r=n.value;e.delete(r)}})})},t.forEach=function(e,t){for(var n=Ae(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_,si(this)){var n=li(this,{type:Oi,object:this,newValue:e});if(!n)return this;e=n.newValue}if(!this.has(e)){ei(function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()});var r=ui(this),i=r?{observableKind:`set`,debugObjectName:this.name_,type:Oi,object:this,newValue:e}:null;r&&fi(this,i)}return this},t.delete=function(e){var t=this;if(si(this)&&!li(this,{type:ki,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ui(this),r=n?{observableKind:`set`,debugObjectName:this.name_,type:ki,object:this,oldValue:e}:null;return ei(function(){t.atom_.reportChanged(),t.data_.delete(e)}),n&&fi(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 Li({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 Li({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 _e(e)&&!Ii(e)?e.intersection(this):new Set(this).intersection(e)},t.union=function(e){return _e(e)&&!Ii(e)?e.union(this):new Set(this).union(e)},t.difference=function(e){return new Set(this).difference(e)},t.symmetricDifference=function(e){return _e(e)&&!Ii(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 _e(e)&&!Ii(e)?e.isDisjointFrom(this):new Set(this).isDisjointFrom(e)},t.replace=function(e){var t=this;return Ii(e)&&(e=new Set(e)),ei(function(){Array.isArray(e)||_e(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 di(this,e)},t.intercept_=function(e){return ci(this,e)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return`[object ObservableSet]`},t[Symbol.iterator]=function(){return this.values()},ke(e,[{key:`size`,get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return`Set`}}])}(),Ii=me(`ObservableSet`,Fi);function Li(e){return e[Symbol.toStringTag]=`SetIterator`,da(e)}var Ri=Object.create(null),zi=`remove`,Bi=function(){function e(e,t,n,r){t===void 0&&(t=new Map),r===void 0&&(r=At),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 qe(`ObservableObject.keys`),this.isPlainObject_=ue(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 gn)return n.set(t),!0;if(si(this)){var r=li(this,{type:hi,object:this.proxy_||this.target_,name:e,newValue:t});if(!r)return null;t=r.newValue}if(t=n.prepareNewValue_(t),t!==B.UNCHANGED){var i=ui(this),a=i?{type:hi,observableKind:`object`,debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),i&&fi(this,a)}return!0},t.get_=function(e){return B.trackingDerivation&&!Se(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,n){return n===void 0&&(n=!1),Se(this.target_,e)?this.values_.has(e)?this.setObservablePropValue_(e,t):n?Reflect.set(this.target_,e,t):(this.target_[e]=t,!0):this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,n)},t.has_=function(e){if(!B.trackingDerivation)return e in this.target_;this.pendingKeys_||=new Map;var t=this.pendingKeys_.get(e);return t||(t=new mn(e in this.target_,rt,`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_[Ve])!=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)}Gi(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&&Gi(this,n,e),i},t.defineProperty_=function(e,t,n){n===void 0&&(n=!1),this.keysAtom_;try{Bn();var r=this.delete_(e);if(!r)return r;if(si(this)){var i=li(this,{object:this.proxy_||this.target_,name:e,type:Oi,newValue:t.value});if(!i)return null;var a=i.newValue;t.value!==a&&(t=je({},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{Vn()}return!0},t.defineObservableProperty_=function(e,t,n,r){r===void 0&&(r=!1),this.keysAtom_;try{Bn();var i=this.delete_(e);if(!i)return i;if(si(this)){var a=li(this,{object:this.proxy_||this.target_,name:e,type:Oi,newValue:t});if(!a)return null;t=a.newValue}var o=Ui(e),s={configurable:!B.safeDescriptors||this.isPlainObject_,enumerable:!0,get:o.get,set:o.set};if(r){if(!Reflect.defineProperty(this.target_,e,s))return!1}else ne(this.target_,e,s);var c=new mn(t,n,`ObservableObject.key`,!1);this.values_.set(e,c),this.notifyPropertyAddition_(e,c.value_)}finally{Vn()}return!0},t.defineComputedProperty_=function(e,t,n){n===void 0&&(n=!1),this.keysAtom_;try{Bn();var r=this.delete_(e);if(!r)return r;if(si(this)&&!li(this,{object:this.proxy_||this.target_,name:e,type:Oi,newValue:void 0}))return null;t.name||=`ObservableObject.key`,t.context=this.proxy_||this.target_;var i=Ui(e),a={configurable:!B.safeDescriptors||this.isPlainObject_,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.target_,e,a))return!1}else ne(this.target_,e,a);this.values_.set(e,new gn(t)),this.notifyPropertyAddition_(e,void 0)}finally{Vn()}return!0},t.delete_=function(e,t){if(t===void 0&&(t=!1),this.keysAtom_,!Se(this.target_,e))return!0;if(si(this)&&!li(this,{object:this.proxy_||this.target_,name:e,type:zi}))return null;try{var n;Bn();var r=ui(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 mn&&(a=i.value_),Un(i)),this.keysAtom_.reportChanged(),(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(e in this.target_),r){var o={type:zi,observableKind:`object`,object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:a,name:e};r&&fi(this,o)}}finally{Vn()}return!0},t.observe_=function(e,t){return di(this,e)},t.intercept_=function(e){return ci(this,e)},t.notifyPropertyAddition_=function(e,t){var n,r=ui(this);if(r){var i=r?{type:Oi,observableKind:`object`,debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;r&&fi(this,i)}(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),be(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Vi(e,t){if(Se(e,Ke))return e;var n=t?.name??`ObservableObject`;return fe(e,Ke,new Bi(e,new Map,String(n),qt(t))),e}var Hi=me(`ObservableObjectAdministration`,Bi);function Ui(e){return Ri[e]||(Ri[e]={get:function(){return this[Ke].getObservablePropValue_(e)},set:function(t){return this[Ke].setObservablePropValue_(e,t)}})}function Wi(e){return le(e)?Hi(e[Ke]):!1}function Gi(e,t,n){var r;(r=e.target_[Ve])==null||delete r[n]}var Ki=Qi(0),qi=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Ji=0,Yi=function(){};function Xi(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__===void 0?e.prototype=t:e.prototype.__proto__=t}Xi(Yi,Array.prototype);var Zi=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,aa(function(){var e=new vi(r,n,i,!0);e.proxy_=a,pe(a,Ke,e),t&&t.length&&a.spliceWithArray(0,0,t),qi&&Object.defineProperty(a,"0",Ki)}),a}Ne(t,e);var n=t.prototype;return n.concat=function(){this[Ke].atom_.reportObserved();var e=[...arguments];return Array.prototype.concat.apply(this.slice(),e.map(function(e){return Ei(e)?e.slice():e}))},n[Symbol.iterator]=function(){var e=this,t=0;return da({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},ke(t,[{key:`length`,get:function(){return this[Ke].getArrayLength_()},set:function(e){this[Ke].setArrayLength_(e)}},{key:Symbol.toStringTag,get:function(){return`Array`}}])}(Yi);Object.entries(bi).forEach(function(e){var t=e[0],n=e[1];t!==`concat`&&fe(Zi.prototype,t,n)});function Qi(e){return{enumerable:!1,configurable:!0,get:function(){return this[Ke].get_(e)},set:function(t){this[Ke].set_(e,t)}}}function $i(e){ne(Zi.prototype,``+e,Qi(e))}function ea(e){if(e>Ji){for(var t=Ji;t<e+100;t++)$i(t);Ji=e}}ea(1e3);function ta(e,t,n){return new Zi(e,t,n)}function na(e,t){if(typeof e==`object`&&e){if(Ei(e))return t!==void 0&&M(23),e[Ke].atom_;if(Ii(e))return e.atom_;if(ji(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||M(25,t,ia(e)),n}if(Wi(e)){if(!t)return M(26);var r=e[Ke],i=r.values_.get(t)??r.materializeLazyComputed_(t)??r.materializeLazyObservable_(t);return i||M(27,t,ia(e)),i}if(Je(e)||_n(e)||Zn(e))return e}else if(z(e)&&Zn(e[Ke]))return e[Ke];M(28)}function ra(e,t){if(e||M(29),t!==void 0)return ra(na(e,t));if(Je(e)||_n(e)||Zn(e)||ji(e)||Ii(e))return e;if(e[Ke])return e[Ke];M(24,e)}function ia(e,t){var n;if(t!==void 0)n=na(e,t);else if(mr(e))return e.name;else n=Wi(e)||ji(e)||Ii(e)?ra(e):na(e);return n.name_}function aa(e){var t=Dn(),n=fn(!0);Bn();try{return e()}finally{Vn(),pn(n),On(t)}}var oa=re.toString;function sa(e,t,n){return n===void 0&&(n=-1),ca(e,t,n)}function ca(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=oa.call(e);if(o!==oa.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=la(e),t=la(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&&!(z(c)&&c instanceof c&&z(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(!ca(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(!(Se(t,m)&&ca(e[m],t[m],n-1,r,i)))return!1}}return r.pop(),i.pop(),!0}function la(e){return Ei(e)?e.slice():he(e)||ji(e)||_e(e)||Ii(e)?Array.from(e.entries()):e}var ua=N().Iterator?.prototype||{};function da(e){return e[Symbol.iterator]=fa,Object.assign(Object.create(ua),e)}function fa(){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:er,extras:{getDebugName:ia},$mobx:Ke}),!k.useState)throw Error(`mobx-react-lite requires React with Hooks support`);if(!pi)throw Error(`mobx-react-lite@3 requires mobx at least version 6 to be available`);var pa=T();function ma(e){e()}function ha(e){e||=ma,Or({reactionScheduler:e})}function ga(e){return Ar(e)}var _a=!1;function va(){return _a}var ya=1e4,ba=1e4,xa=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=ya),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,ba))}}),e}(),Sa=new(typeof FinalizationRegistry<`u`?FinalizationRegistry:xa)(function(e){var t;(t=e.reaction)==null||t.dispose(),e.reaction=null}),Ca=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})),wa=n(((e,t)=>{t.exports=Ca()}))();function Ta(e){e.reaction=new Kn(`observer${e.name}`,function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)==null||t.call(e)})}function Ea(e,t){if(t===void 0&&(t=`observed`),va())return e();var n=k.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return Sa.unregister(r),r.onStoreChange=e,r.reaction||(Ta(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||(Ta(i),Sa.register(n,i,i)),k.useDebugValue(i.reaction,ga),(0,wa.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 Da=typeof Symbol==`function`&&Symbol.for,Oa=Object.getOwnPropertyDescriptor(function(){},`name`)?.configurable??!1,ka=Da?Symbol.for(`react.forward_ref`):typeof k.forwardRef==`function`&&(0,k.forwardRef)(function(e){return null}).$$typeof,Aa=Da?Symbol.for(`react.memo`):typeof k.memo==`function`&&(0,k.memo)(function(e){return null}).$$typeof;function V(e,t){if(Aa&&e.$$typeof===Aa)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(va())return e;var n=t?.forwardRef??!1,r=e,i=e.displayName||e.name;if(ka&&e.$$typeof===ka&&(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 Ea(function(){return r(e,t)},i)};return a.displayName=e.displayName,Oa&&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),Ma(e,a),a}var ja={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function Ma(e,t){Object.keys(e).forEach(function(n){ja[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}function Na(e,t){return(0,k.useState)(function(){return Xt(e(),t,{autoBind:!0})})[0]}ha(pa.unstable_batchedUpdates),Sa.finalizeAllImmediately;var Pa;function H(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 Fa=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ia=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Pa=globalThis).__zod_globalConfig??(Pa.__zod_globalConfig={});var La=globalThis.__zod_globalConfig;function Ra(e){return e&&Object.assign(La,e),La}function za(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 Ba(e,t){return typeof t==`bigint`?t.toString():t}function Va(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ha(e){return e==null}function Ua(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Wa(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 Ga=Symbol(`evaluating`);function Ka(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ga)return r===void 0&&(r=Ga,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function qa(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ja(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Ya(e){return JSON.stringify(e)}function Xa(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Za=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Qa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var $a=Va(()=>{if(La.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function eo(e){if(Qa(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Qa(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function to(e){return eo(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var no=new Set([`string`,`number`,`symbol`]);function ro(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function io(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function U(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 ao(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var oo={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function so(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 io(e,Ja(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 qa(this,`shape`,e),e},checks:[]}))}function co(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 io(e,Ja(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 qa(this,`shape`,r),r},checks:[]}))}function lo(e,t){if(!eo(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 io(e,Ja(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return qa(this,`shape`,n),n}}))}function uo(e,t){if(!eo(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return io(e,Ja(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return qa(this,`shape`,n),n}}))}function fo(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return io(e,Ja(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return qa(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function po(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 io(t,Ja(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 qa(this,`shape`,i),i},checks:[]}))}function mo(e,t,n){return io(t,Ja(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 qa(this,`shape`,i),i}}))}function ho(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 go(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 _o(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function vo(e){return typeof e==`string`?e:e?.message}function yo(e,t,n){let r=e.message?e.message:vo(e.inst?._zod.def?.error?.(e))??vo(t?.error?.(e))??vo(n.customError?.(e))??vo(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 bo(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function xo(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var So=(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,Ba,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Co=H(`$ZodError`,So),wo=H(`$ZodError`,So,{Parent:Error});function To(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 Eo(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 Do=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 Fa;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>yo(e,a,Ra())));throw Za(t,i?.callee),t}return o.value},Oo=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=>yo(e,a,Ra())));throw Za(t,i?.callee),t}return o.value},ko=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 Fa;return a.issues.length?{success:!1,error:new(e??Co)(a.issues.map(e=>yo(e,i,Ra())))}:{success:!0,data:a.value}},Ao=ko(wo),jo=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=>yo(e,i,Ra())))}:{success:!0,data:a.value}},Mo=jo(wo),No=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Do(e)(t,n,i)},Po=e=>(t,n,r)=>Do(e)(t,n,r),Fo=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Oo(e)(t,n,i)},Io=e=>async(t,n,r)=>Oo(e)(t,n,r),Lo=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ko(e)(t,n,i)},Ro=e=>(t,n,r)=>ko(e)(t,n,r),zo=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return jo(e)(t,n,i)},Bo=e=>async(t,n,r)=>jo(e)(t,n,r),Vo=/^[cC][0-9a-z]{6,}$/,Ho=/^[0-9a-z]+$/,Uo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Wo=/^[0-9a-vA-V]{20}$/,Go=/^[A-Za-z0-9]{27}$/,Ko=/^[a-zA-Z0-9_-]{21}$/,qo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Jo=/^([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})$/,Yo=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)$/,Xo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Zo=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Qo(){return new RegExp(Zo,`u`)}var $o=/^(?:(?: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])$/,es=/^(([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}|:))$/,ts=/^((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])$/,ns=/^(([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])$/,rs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,is=/^[A-Za-z0-9_-]*$/,as=/^https?$/,os=/^\+[1-9]\d{6,14}$/,ss=`(?:(?:\\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])))`,cs=RegExp(`^${ss}$`);function ls(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 us(e){return RegExp(`^${ls(e)}$`)}function ds(e){let t=ls({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(`^${ss}T(?:${r})$`)}var fs=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ps=/^-?\d+$/,ms=/^-?\d+(?:\.\d+)?$/,hs=/^(?:true|false)$/i,gs=/^[^A-Z]*$/,_s=/^[^a-z]*$/,vs=H(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ys={number:`number`,bigint:`bigint`,object:`date`},bs=H(`$ZodCheckLessThan`,(e,t)=>{vs.init(e,t);let n=ys[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})}}),xs=H(`$ZodCheckGreaterThan`,(e,t)=>{vs.init(e,t);let n=ys[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})}}),Ss=H(`$ZodCheckMultipleOf`,(e,t)=>{vs.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):Wa(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})}}),Cs=H(`$ZodCheckNumberFormat`,(e,t)=>{vs.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=oo[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=ps)}),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})}}),ws=H(`$ZodCheckMaxLength`,(e,t)=>{var n;vs.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ha(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=bo(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ts=H(`$ZodCheckMinLength`,(e,t)=>{var n;vs.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ha(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=bo(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Es=H(`$ZodCheckLengthEquals`,(e,t)=>{var n;vs.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ha(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=bo(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})}}),Ds=H(`$ZodCheckStringFormat`,(e,t)=>{var n,r;vs.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=()=>{})}),Os=H(`$ZodCheckRegex`,(e,t)=>{Ds.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})}}),ks=H(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=gs,Ds.init(e,t)}),As=H(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=_s,Ds.init(e,t)}),js=H(`$ZodCheckIncludes`,(e,t)=>{vs.init(e,t);let n=ro(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})}}),Ms=H(`$ZodCheckStartsWith`,(e,t)=>{vs.init(e,t);let n=RegExp(`^${ro(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})}}),Ns=H(`$ZodCheckEndsWith`,(e,t)=>{vs.init(e,t);let n=RegExp(`.*${ro(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})}}),Ps=H(`$ZodCheckOverwrite`,(e,t)=>{vs.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Fs=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
|
+
`))}},Is={major:4,minor:4,patch:3},Ls=H(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Is;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=ho(e),i;for(let a of t){if(a._zod.def.when){if(go(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 Fa;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=ho(e,t))});else{if(e.issues.length===t)continue;r||=ho(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(ho(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Fa;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 Fa;return o.then(e=>t(e,r,a))}return t(o,r,a)}}Ka(e,`~standard`,()=>({validate:t=>{try{let n=Ao(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Mo(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Rs=H(`$ZodString`,(e,t)=>{Ls.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??fs(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}}),zs=H(`$ZodStringFormat`,(e,t)=>{Ds.init(e,t),Rs.init(e,t)}),Bs=H(`$ZodGUID`,(e,t)=>{t.pattern??=Jo,zs.init(e,t)}),Vs=H(`$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??=Yo(e)}else t.pattern??=Yo();zs.init(e,t)}),Hs=H(`$ZodEmail`,(e,t)=>{t.pattern??=Xo,zs.init(e,t)}),Us=H(`$ZodURL`,(e,t)=>{zs.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===as.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})}}}),Ws=H(`$ZodEmoji`,(e,t)=>{t.pattern??=Qo(),zs.init(e,t)}),Gs=H(`$ZodNanoID`,(e,t)=>{t.pattern??=Ko,zs.init(e,t)}),Ks=H(`$ZodCUID`,(e,t)=>{t.pattern??=Vo,zs.init(e,t)}),qs=H(`$ZodCUID2`,(e,t)=>{t.pattern??=Ho,zs.init(e,t)}),Js=H(`$ZodULID`,(e,t)=>{t.pattern??=Uo,zs.init(e,t)}),Ys=H(`$ZodXID`,(e,t)=>{t.pattern??=Wo,zs.init(e,t)}),Xs=H(`$ZodKSUID`,(e,t)=>{t.pattern??=Go,zs.init(e,t)}),Zs=H(`$ZodISODateTime`,(e,t)=>{t.pattern??=ds(t),zs.init(e,t)}),Qs=H(`$ZodISODate`,(e,t)=>{t.pattern??=cs,zs.init(e,t)}),$s=H(`$ZodISOTime`,(e,t)=>{t.pattern??=us(t),zs.init(e,t)}),ec=H(`$ZodISODuration`,(e,t)=>{t.pattern??=qo,zs.init(e,t)}),tc=H(`$ZodIPv4`,(e,t)=>{t.pattern??=$o,zs.init(e,t),e._zod.bag.format=`ipv4`}),nc=H(`$ZodIPv6`,(e,t)=>{t.pattern??=es,zs.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})}}}),rc=H(`$ZodCIDRv4`,(e,t)=>{t.pattern??=ts,zs.init(e,t)}),ic=H(`$ZodCIDRv6`,(e,t)=>{t.pattern??=ns,zs.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 ac(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var oc=H(`$ZodBase64`,(e,t)=>{t.pattern??=rs,zs.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{ac(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function sc(e){if(!is.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return ac(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var cc=H(`$ZodBase64URL`,(e,t)=>{t.pattern??=is,zs.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{sc(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),lc=H(`$ZodE164`,(e,t)=>{t.pattern??=os,zs.init(e,t)});function uc(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 dc=H(`$ZodJWT`,(e,t)=>{zs.init(e,t),e._zod.check=n=>{uc(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),fc=H(`$ZodNumber`,(e,t)=>{Ls.init(e,t),e._zod.pattern=e._zod.bag.pattern??ms,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}}),pc=H(`$ZodNumberFormat`,(e,t)=>{Cs.init(e,t),fc.init(e,t)}),mc=H(`$ZodBoolean`,(e,t)=>{Ls.init(e,t),e._zod.pattern=hs,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}}),hc=H(`$ZodUnknown`,(e,t)=>{Ls.init(e,t),e._zod.parse=e=>e}),gc=H(`$ZodNever`,(e,t)=>{Ls.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function _c(e,t,n){e.issues.length&&t.issues.push(..._o(n,e.issues)),t.value[n]=e.value}var vc=H(`$ZodArray`,(e,t)=>{Ls.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=>_c(t,n,e))):_c(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function yc(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(..._o(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 bc(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=ao(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function xc(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=>yc(e,n,i,t,u,d))):yc(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 Sc=H(`$ZodObject`,(e,t)=>{if(Ls.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=Va(()=>bc(t));Ka(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=Qa,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=>yc(n,t,e,s,r,i))):yc(a,t,e,s,r,i)}return i?xc(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Cc=H(`$ZodObjectJIT`,(e,t)=>{Sc.init(e,t);let n=e._zod.parse,r=Va(()=>bc(t)),i=e=>{let t=new Fs([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Ya(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=Ya(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=Qa,s=!La.jitless,c=s&&$a.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?xc([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function wc(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=>!ho(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=>yo(e,r,Ra())))}),t)}var Tc=H(`$ZodUnion`,(e,t)=>{Ls.init(e,t),Ka(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Ka(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Ka(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Ka(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=>Ua(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=>wc(t,r,e,i)):wc(o,r,e,i)}}),Ec=H(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Tc.init(e,t);let n=e._zod.parse;Ka(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=Va(()=>{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(!Qa(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)}}),Dc=H(`$ZodIntersection`,(e,t)=>{Ls.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])=>kc(e,t,n)):kc(e,i,a)}});function Oc(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(eo(e)&&eo(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=Oc(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=Oc(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 kc(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}),ho(e))return e;let o=Oc(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Ac=H(`$ZodRecord`,(e,t)=>{Ls.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!eo(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=>yo(e,r,Ra())),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(..._o(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(..._o(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`&&ms.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=>yo(e,r,Ra())),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(..._o(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(..._o(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),jc=H(`$ZodEnum`,(e,t)=>{Ls.init(e,t);let n=za(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>no.has(typeof e)).map(e=>typeof e==`string`?ro(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}}),Mc=H(`$ZodLiteral`,(e,t)=>{if(Ls.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`?ro(e):e?ro(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}}),Nc=H(`$ZodTransform`,(e,t)=>{Ls.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ia(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 Fa;return n.value=i,n.fallback=!0,n}});function Pc(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Fc=H(`$ZodOptional`,(e,t)=>{Ls.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Ka(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ka(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ua(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=>Pc(e,r)):Pc(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Ic=H(`$ZodExactOptional`,(e,t)=>{Fc.init(e,t),Ka(e._zod,`values`,()=>t.innerType._zod.values),Ka(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Lc=H(`$ZodNullable`,(e,t)=>{Ls.init(e,t),Ka(e._zod,`optin`,()=>t.innerType._zod.optin),Ka(e._zod,`optout`,()=>t.innerType._zod.optout),Ka(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ua(e.source)}|null)$`):void 0}),Ka(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)}),Rc=H(`$ZodDefault`,(e,t)=>{Ls.init(e,t),e._zod.optin=`optional`,Ka(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=>zc(e,t)):zc(r,t)}});function zc(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Bc=H(`$ZodPrefault`,(e,t)=>{Ls.init(e,t),e._zod.optin=`optional`,Ka(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))}),Vc=H(`$ZodNonOptional`,(e,t)=>{Ls.init(e,t),Ka(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=>Hc(t,e)):Hc(i,e)}});function Hc(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 Uc=H(`$ZodCatch`,(e,t)=>{Ls.init(e,t),e._zod.optin=`optional`,Ka(e._zod,`optout`,()=>t.innerType._zod.optout),Ka(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=>yo(e,n,Ra()))},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=>yo(e,n,Ra()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Wc=H(`$ZodPipe`,(e,t)=>{Ls.init(e,t),Ka(e._zod,`values`,()=>t.in._zod.values),Ka(e._zod,`optin`,()=>t.in._zod.optin),Ka(e._zod,`optout`,()=>t.out._zod.optout),Ka(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=>Gc(e,t.in,n)):Gc(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Gc(e,t.out,n)):Gc(r,t.out,n)}});function Gc(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 Kc=H(`$ZodReadonly`,(e,t)=>{Ls.init(e,t),Ka(e._zod,`propValues`,()=>t.innerType._zod.propValues),Ka(e._zod,`values`,()=>t.innerType._zod.values),Ka(e._zod,`optin`,()=>t.innerType?._zod?.optin),Ka(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(qc):qc(r)}});function qc(e){return e.value=Object.freeze(e.value),e}var Jc=H(`$ZodLazy`,(e,t)=>{Ls.init(e,t),Ka(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),Ka(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),Ka(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),Ka(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),Ka(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Yc=H(`$ZodCustom`,(e,t)=>{vs.init(e,t),Ls.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=>Xc(t,n,r,e));Xc(i,n,r,e)}});function Xc(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(xo(e))}}var Zc,Qc=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 $c(){return new Qc}(Zc=globalThis).__zod_globalRegistry??(Zc.__zod_globalRegistry=$c());var el=globalThis.__zod_globalRegistry;function tl(e,t){return new e({type:`string`,...U(t)})}function nl(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...U(t)})}function rl(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...U(t)})}function il(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...U(t)})}function al(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...U(t)})}function ol(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...U(t)})}function sl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...U(t)})}function cl(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...U(t)})}function ll(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...U(t)})}function ul(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...U(t)})}function dl(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...U(t)})}function fl(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...U(t)})}function pl(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...U(t)})}function ml(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...U(t)})}function hl(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...U(t)})}function gl(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...U(t)})}function _l(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...U(t)})}function vl(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...U(t)})}function yl(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...U(t)})}function bl(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...U(t)})}function xl(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...U(t)})}function Sl(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...U(t)})}function Cl(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...U(t)})}function wl(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...U(t)})}function Tl(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...U(t)})}function El(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...U(t)})}function Dl(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...U(t)})}function Ol(e,t){return new e({type:`number`,checks:[],...U(t)})}function kl(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...U(t)})}function Al(e,t){return new e({type:`boolean`,...U(t)})}function jl(e){return new e({type:`unknown`})}function Ml(e,t){return new e({type:`never`,...U(t)})}function Nl(e,t){return new bs({check:`less_than`,...U(t),value:e,inclusive:!1})}function Pl(e,t){return new bs({check:`less_than`,...U(t),value:e,inclusive:!0})}function Fl(e,t){return new xs({check:`greater_than`,...U(t),value:e,inclusive:!1})}function Il(e,t){return new xs({check:`greater_than`,...U(t),value:e,inclusive:!0})}function Ll(e,t){return new Ss({check:`multiple_of`,...U(t),value:e})}function Rl(e,t){return new ws({check:`max_length`,...U(t),maximum:e})}function zl(e,t){return new Ts({check:`min_length`,...U(t),minimum:e})}function Bl(e,t){return new Es({check:`length_equals`,...U(t),length:e})}function Vl(e,t){return new Os({check:`string_format`,format:`regex`,...U(t),pattern:e})}function Hl(e){return new ks({check:`string_format`,format:`lowercase`,...U(e)})}function Ul(e){return new As({check:`string_format`,format:`uppercase`,...U(e)})}function Wl(e,t){return new js({check:`string_format`,format:`includes`,...U(t),includes:e})}function Gl(e,t){return new Ms({check:`string_format`,format:`starts_with`,...U(t),prefix:e})}function Kl(e,t){return new Ns({check:`string_format`,format:`ends_with`,...U(t),suffix:e})}function ql(e){return new Ps({check:`overwrite`,tx:e})}function Jl(e){return ql(t=>t.normalize(e))}function Yl(){return ql(e=>e.trim())}function Xl(){return ql(e=>e.toLowerCase())}function Zl(){return ql(e=>e.toUpperCase())}function Ql(){return ql(e=>Xa(e))}function $l(e,t,n){return new e({type:`array`,element:t,...U(n)})}function eu(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...U(n)})}function tu(e,t){let n=nu(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(xo(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(xo(r))}},e(t.value,t)),t);return n}function nu(e,t){let n=new vs({check:`custom`,...U(t)});return n._zod.check=e,n}function ru(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??el,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 iu(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,iu(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`&&su(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 au(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 ou(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:lu(t,`input`,e.processors),output:lu(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function su(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 su(r.element,n);if(r.type===`set`)return su(r.valueType,n);if(r.type===`lazy`)return su(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 su(r.innerType,n);if(r.type===`intersection`)return su(r.left,n)||su(r.right,n);if(r.type===`record`||r.type===`map`)return su(r.keyType,n)||su(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:su(r.in,n)||su(r.out,n);if(r.type===`object`){for(let e in r.shape)if(su(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(su(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(su(e,n))return!0;return!!(r.rest&&su(r.rest,n))}return!1}var cu=(e,t={})=>n=>{let r=ru({...n,processors:t});return iu(e,r),au(r,e),ou(r,e)},lu=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ru({...i??{},target:a,io:t,processors:n});return iu(e,o),au(o,e),ou(o,e)},uu={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},du=(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=uu[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}))])}},fu=(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)},pu=(e,t,n,r)=>{n.type=`boolean`},mu=(e,t,n,r)=>{n.not={}},hu=(e,t,n,r)=>{let i=e._zod.def,a=za(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},gu=(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}},_u=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},vu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},yu=(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=iu(a.element,t,{...r,path:[...r.path,`items`]})},bu=(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]=iu(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=iu(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},xu=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>iu(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Su=(e,t,n,r)=>{let i=e._zod.def,a=iu(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=iu(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]]},Cu=(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=iu(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=iu(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=iu(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)}},wu=(e,t,n,r)=>{let i=e._zod.def,a=iu(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`}]},Tu=(e,t,n,r)=>{let i=e._zod.def;iu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Eu=(e,t,n,r)=>{let i=e._zod.def;iu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Du=(e,t,n,r)=>{let i=e._zod.def;iu(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)))},Ou=(e,t,n,r)=>{let i=e._zod.def;iu(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},ku=(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;iu(o,t,r);let s=t.seen.get(e);s.ref=o},Au=(e,t,n,r)=>{let i=e._zod.def;iu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ju=(e,t,n,r)=>{let i=e._zod.def;iu(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Mu=(e,t,n,r)=>{let i=e._zod.innerType;iu(i,t,r);let a=t.seen.get(e);a.ref=i},Nu=H(`ZodISODateTime`,(e,t)=>{Zs.init(e,t),ad.init(e,t)});function Pu(e){return wl(Nu,e)}var Fu=H(`ZodISODate`,(e,t)=>{Qs.init(e,t),ad.init(e,t)});function Iu(e){return Tl(Fu,e)}var Lu=H(`ZodISOTime`,(e,t)=>{$s.init(e,t),ad.init(e,t)});function Ru(e){return El(Lu,e)}var zu=H(`ZodISODuration`,(e,t)=>{ec.init(e,t),ad.init(e,t)});function Bu(e){return Dl(zu,e)}var Vu=H(`ZodError`,(e,t)=>{Co.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Eo(e,t)},flatten:{value:t=>To(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ba,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ba,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Hu=Do(Vu),Uu=Oo(Vu),Wu=ko(Vu),Gu=jo(Vu),Ku=No(Vu),qu=Po(Vu),Ju=Fo(Vu),Yu=Io(Vu),Xu=Lo(Vu),Zu=Ro(Vu),Qu=zo(Vu),$u=Bo(Vu),ed=new WeakMap;function td(e,t,n){let r=Object.getPrototypeOf(e),i=ed.get(r);if(i||(i=new Set,ed.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 nd=H(`ZodType`,(e,t)=>(Ls.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:lu(e,`input`),output:lu(e,`output`)}}),e.toJSONSchema=cu(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Hu(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Wu(e,t,n),e.parseAsync=async(t,n)=>Uu(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Gu(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ku(e,t,n),e.decode=(t,n)=>qu(e,t,n),e.encodeAsync=async(t,n)=>Ju(e,t,n),e.decodeAsync=async(t,n)=>Yu(e,t,n),e.safeEncode=(t,n)=>Xu(e,t,n),e.safeDecode=(t,n)=>Zu(e,t,n),e.safeEncodeAsync=async(t,n)=>Qu(e,t,n),e.safeDecodeAsync=async(t,n)=>$u(e,t,n),td(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Ja(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 io(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(xf(e,t))},superRefine(e,t){return this.check(Sf(e,t))},overwrite(e){return this.check(ql(e))},optional(){return ef(this)},exactOptional(){return nf(this)},nullable(){return af(this)},nullish(){return ef(af(this))},nonoptional(e){return df(this,e)},array(){return Fd(this)},or(e){return Bd([this,e])},and(e){return Wd(this,e)},transform(e){return hf(this,Qd(e))},default(e){return sf(this,e)},prefault(e){return lf(this,e)},catch(e){return pf(this,e)},pipe(e){return hf(this,e)},readonly(){return _f(this)},describe(e){let t=this.clone();return el.add(t,{description:e}),t},meta(...e){if(e.length===0)return el.get(this);let t=this.clone();return el.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 el.get(e)?.description},configurable:!0}),e)),rd=H(`_ZodString`,(e,t)=>{Rs.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>du(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,td(e,`_ZodString`,{regex(...e){return this.check(Vl(...e))},includes(...e){return this.check(Wl(...e))},startsWith(...e){return this.check(Gl(...e))},endsWith(...e){return this.check(Kl(...e))},min(...e){return this.check(zl(...e))},max(...e){return this.check(Rl(...e))},length(...e){return this.check(Bl(...e))},nonempty(...e){return this.check(zl(1,...e))},lowercase(e){return this.check(Hl(e))},uppercase(e){return this.check(Ul(e))},trim(){return this.check(Yl())},normalize(...e){return this.check(Jl(...e))},toLowerCase(){return this.check(Xl())},toUpperCase(){return this.check(Zl())},slugify(){return this.check(Ql())}})}),id=H(`ZodString`,(e,t)=>{Rs.init(e,t),rd.init(e,t),e.email=t=>e.check(nl(od,t)),e.url=t=>e.check(cl(ld,t)),e.jwt=t=>e.check(Cl(wd,t)),e.emoji=t=>e.check(ll(ud,t)),e.guid=t=>e.check(rl(sd,t)),e.uuid=t=>e.check(il(cd,t)),e.uuidv4=t=>e.check(al(cd,t)),e.uuidv6=t=>e.check(ol(cd,t)),e.uuidv7=t=>e.check(sl(cd,t)),e.nanoid=t=>e.check(ul(dd,t)),e.guid=t=>e.check(rl(sd,t)),e.cuid=t=>e.check(dl(fd,t)),e.cuid2=t=>e.check(fl(pd,t)),e.ulid=t=>e.check(pl(md,t)),e.base64=t=>e.check(bl(xd,t)),e.base64url=t=>e.check(xl(Sd,t)),e.xid=t=>e.check(ml(hd,t)),e.ksuid=t=>e.check(hl(gd,t)),e.ipv4=t=>e.check(gl(_d,t)),e.ipv6=t=>e.check(_l(vd,t)),e.cidrv4=t=>e.check(vl(yd,t)),e.cidrv6=t=>e.check(yl(bd,t)),e.e164=t=>e.check(Sl(Cd,t)),e.datetime=t=>e.check(Pu(t)),e.date=t=>e.check(Iu(t)),e.time=t=>e.check(Ru(t)),e.duration=t=>e.check(Bu(t))});function W(e){return tl(id,e)}var ad=H(`ZodStringFormat`,(e,t)=>{zs.init(e,t),rd.init(e,t)}),od=H(`ZodEmail`,(e,t)=>{Hs.init(e,t),ad.init(e,t)}),sd=H(`ZodGUID`,(e,t)=>{Bs.init(e,t),ad.init(e,t)}),cd=H(`ZodUUID`,(e,t)=>{Vs.init(e,t),ad.init(e,t)}),ld=H(`ZodURL`,(e,t)=>{Us.init(e,t),ad.init(e,t)}),ud=H(`ZodEmoji`,(e,t)=>{Ws.init(e,t),ad.init(e,t)}),dd=H(`ZodNanoID`,(e,t)=>{Gs.init(e,t),ad.init(e,t)}),fd=H(`ZodCUID`,(e,t)=>{Ks.init(e,t),ad.init(e,t)}),pd=H(`ZodCUID2`,(e,t)=>{qs.init(e,t),ad.init(e,t)}),md=H(`ZodULID`,(e,t)=>{Js.init(e,t),ad.init(e,t)}),hd=H(`ZodXID`,(e,t)=>{Ys.init(e,t),ad.init(e,t)}),gd=H(`ZodKSUID`,(e,t)=>{Xs.init(e,t),ad.init(e,t)}),_d=H(`ZodIPv4`,(e,t)=>{tc.init(e,t),ad.init(e,t)}),vd=H(`ZodIPv6`,(e,t)=>{nc.init(e,t),ad.init(e,t)}),yd=H(`ZodCIDRv4`,(e,t)=>{rc.init(e,t),ad.init(e,t)}),bd=H(`ZodCIDRv6`,(e,t)=>{ic.init(e,t),ad.init(e,t)}),xd=H(`ZodBase64`,(e,t)=>{oc.init(e,t),ad.init(e,t)}),Sd=H(`ZodBase64URL`,(e,t)=>{cc.init(e,t),ad.init(e,t)}),Cd=H(`ZodE164`,(e,t)=>{lc.init(e,t),ad.init(e,t)}),wd=H(`ZodJWT`,(e,t)=>{dc.init(e,t),ad.init(e,t)}),Td=H(`ZodNumber`,(e,t)=>{fc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fu(e,t,n,r),td(e,`ZodNumber`,{gt(e,t){return this.check(Fl(e,t))},gte(e,t){return this.check(Il(e,t))},min(e,t){return this.check(Il(e,t))},lt(e,t){return this.check(Nl(e,t))},lte(e,t){return this.check(Pl(e,t))},max(e,t){return this.check(Pl(e,t))},int(e){return this.check(Dd(e))},safe(e){return this.check(Dd(e))},positive(e){return this.check(Fl(0,e))},nonnegative(e){return this.check(Il(0,e))},negative(e){return this.check(Nl(0,e))},nonpositive(e){return this.check(Pl(0,e))},multipleOf(e,t){return this.check(Ll(e,t))},step(e,t){return this.check(Ll(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 G(e){return Ol(Td,e)}var Ed=H(`ZodNumberFormat`,(e,t)=>{pc.init(e,t),Td.init(e,t)});function Dd(e){return kl(Ed,e)}var Od=H(`ZodBoolean`,(e,t)=>{mc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pu(e,t,n,r)});function kd(e){return Al(Od,e)}var Ad=H(`ZodUnknown`,(e,t)=>{hc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function jd(){return jl(Ad)}var Md=H(`ZodNever`,(e,t)=>{gc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mu(e,t,n,r)});function Nd(e){return Ml(Md,e)}var Pd=H(`ZodArray`,(e,t)=>{vc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yu(e,t,n,r),e.element=t.element,td(e,`ZodArray`,{min(e,t){return this.check(zl(e,t))},nonempty(e){return this.check(zl(1,e))},max(e,t){return this.check(Rl(e,t))},length(e,t){return this.check(Bl(e,t))},unwrap(){return this.element}})});function Fd(e,t){return $l(Pd,e,t)}var Id=H(`ZodObject`,(e,t)=>{Cc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bu(e,t,n,r),Ka(e,`shape`,()=>t.shape),td(e,`ZodObject`,{keyof(){return Jd(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:jd()})},loose(){return this.clone({...this._zod.def,catchall:jd()})},strict(){return this.clone({...this._zod.def,catchall:Nd()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return lo(this,e)},safeExtend(e){return uo(this,e)},merge(e){return fo(this,e)},pick(e){return so(this,e)},omit(e){return co(this,e)},partial(...e){return po($d,this,e[0])},required(...e){return mo(uf,this,e[0])}})});function Ld(e,t){return new Id({type:`object`,shape:e??{},...U(t)})}function Rd(e,t){return new Id({type:`object`,shape:e,catchall:Nd(),...U(t)})}var zd=H(`ZodUnion`,(e,t)=>{Tc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xu(e,t,n,r),e.options=t.options});function Bd(e,t){return new zd({type:`union`,options:e,...U(t)})}var Vd=H(`ZodDiscriminatedUnion`,(e,t)=>{zd.init(e,t),Ec.init(e,t)});function Hd(e,t,n){return new Vd({type:`union`,options:t,discriminator:e,...U(n)})}var Ud=H(`ZodIntersection`,(e,t)=>{Dc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Su(e,t,n,r)});function Wd(e,t){return new Ud({type:`intersection`,left:e,right:t})}var Gd=H(`ZodRecord`,(e,t)=>{Ac.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cu(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Kd(e,t,n){return!t||!t._zod?new Gd({type:`record`,keyType:W(),valueType:e,...U(t)}):new Gd({type:`record`,keyType:e,valueType:t,...U(n)})}var qd=H(`ZodEnum`,(e,t)=>{jc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hu(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 qd({...t,checks:[],...U(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 qd({...t,checks:[],...U(r),entries:i})}});function Jd(e,t){return new qd({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...U(t)})}var Yd=H(`ZodLiteral`,(e,t)=>{Mc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gu(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 Xd(e,t){return new Yd({type:`literal`,values:Array.isArray(e)?e:[e],...U(t)})}var Zd=H(`ZodTransform`,(e,t)=>{Nc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vu(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ia(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(xo(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(xo(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 Qd(e){return new Zd({type:`transform`,transform:e})}var $d=H(`ZodOptional`,(e,t)=>{Fc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ju(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ef(e){return new $d({type:`optional`,innerType:e})}var tf=H(`ZodExactOptional`,(e,t)=>{Ic.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ju(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function nf(e){return new tf({type:`optional`,innerType:e})}var rf=H(`ZodNullable`,(e,t)=>{Lc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function af(e){return new rf({type:`nullable`,innerType:e})}var of=H(`ZodDefault`,(e,t)=>{Rc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function sf(e,t){return new of({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():to(t)}})}var cf=H(`ZodPrefault`,(e,t)=>{Bc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Du(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lf(e,t){return new cf({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():to(t)}})}var uf=H(`ZodNonOptional`,(e,t)=>{Vc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function df(e,t){return new uf({type:`nonoptional`,innerType:e,...U(t)})}var ff=H(`ZodCatch`,(e,t)=>{Uc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ou(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function pf(e,t){return new ff({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var mf=H(`ZodPipe`,(e,t)=>{Wc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ku(e,t,n,r),e.in=t.in,e.out=t.out});function hf(e,t){return new mf({type:`pipe`,in:e,out:t})}var gf=H(`ZodReadonly`,(e,t)=>{Kc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Au(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _f(e){return new gf({type:`readonly`,innerType:e})}var vf=H(`ZodLazy`,(e,t)=>{Jc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mu(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function yf(e){return new vf({type:`lazy`,getter:e})}var bf=H(`ZodCustom`,(e,t)=>{Yc.init(e,t),nd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_u(e,t,n,r)});function xf(e,t={}){return eu(bf,e,t)}function Sf(e,t){return tu(e,t)}function Cf(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 wf=C(),Tf=[`fontSize`,`fontFamily`,`fontWeight`,`fontStyle`,`textDecoration`,`textTransform`,`fill`,`align`,`verticalAlign`,`lineHeight`,`letterSpacing`,`strokeWidth`,`stroke`,`cellBackground`,`cellPadding`],Ef=e=>(e.cells||[]).map(t=>{if(!t)return t;let n={...t};for(let t of Tf)n[t]===void 0&&(n[t]=e[t]);return n}),Df=(e,t,n)=>{let r=e.borders?.[n];return{width:r?.width??t.borderWidth,style:r?.style??t.borderStyle,color:r?.color??t.borderColor}},Of=(e,t)=>{let n=e.rowSpan||1,r=e.colSpan||1,i=(n,r)=>{let i=Df(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)}},kf={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},Af=[`text`,`image`,`svg`,`line`,`figure`,`gif`,`video`,`table`,`group`];function jf(e){let t=e({delay:G().default(0).describe(`Delay before the animation starts, in milliseconds.`),duration:G().default(500).describe(`Animation duration in milliseconds.`),enabled:kd().default(!0).describe(`Whether the animation is enabled.`),type:Jd([`enter`,`exit`,`loop`]).describe(`Animation phase.`),name:W().default(`none`).describe(`Animation name identifier.`),data:jd().default({}).describe(`Animation-specific data.`)}),n=Kd(W(),e({intensity:G().default(1).describe(`Filter intensity (-1 to 1).`)})).describe(`Applied image filters keyed by filter name.`),r={id:W().describe(`Unique identifier for the element.`),type:W().describe(`Element type identifier.`),name:W().default(``).describe(`Display name for the element.`),custom:jd().optional().describe(`Custom data attached to the element.`),x:G().default(0).describe(`X position in pixels.`),y:G().default(0).describe(`Y position in pixels.`),width:G().default(100).describe(`Width in pixels.`),height:G().default(100).describe(`Height in pixels.`),rotation:G().default(0).describe(`Rotation angle in degrees.`),opacity:G().default(1).describe(`Opacity level (0-1).`),animations:Fd(t).default([]).describe(`Animation configurations.`),blurEnabled:kd().default(!1).describe(`Whether blur effect is enabled.`),blurRadius:G().default(10).describe(`Blur radius in pixels.`),brightnessEnabled:kd().default(!1).describe(`Whether brightness effect is enabled.`),brightness:G().default(0).describe(`Brightness level (-1 to 1).`),sepiaEnabled:kd().default(!1).describe(`Whether sepia effect is enabled.`),grayscaleEnabled:kd().default(!1).describe(`Whether grayscale effect is enabled.`),filters:n.default({}),shadowEnabled:kd().default(!1).describe(`Whether shadow is enabled.`),shadowBlur:G().default(5).describe(`Shadow blur radius in pixels.`),shadowOffsetX:G().default(0).describe(`Shadow horizontal offset in pixels.`),shadowOffsetY:G().default(0).describe(`Shadow vertical offset in pixels.`),shadowColor:W().default(`black`).describe(`Shadow color.`),shadowOpacity:G().default(1).describe(`Shadow opacity (0-1).`),visible:kd().default(!0).describe(`Whether the element is visible.`),draggable:kd().default(!0).describe(`Whether the element can be dragged.`),resizable:kd().default(!0).describe(`Whether the element can be resized.`),selectable:kd().default(!0).describe(`Whether the element can be selected.`),removable:kd().default(!0).describe(`Whether the element can be removed.`),contentEditable:kd().default(!0).describe(`Whether the element content can be edited.`),styleEditable:kd().default(!0).describe(`Whether the element style can be edited.`),alwaysOnTop:kd().default(!1).describe(`Whether the element stays on top of others.`),showInExport:kd().default(!0).describe(`Whether the element appears in exports.`)},i={src:W().default(``).describe(`URL or data URI of the image file.`),cropX:G().default(0).describe(`Crop X offset as a fraction (0-1).`),cropY:G().default(0).describe(`Crop Y offset as a fraction (0-1).`),cropWidth:G().default(1).describe(`Crop width as a fraction (0-1).`),cropHeight:G().default(1).describe(`Crop height as a fraction (0-1).`),cornerRadius:G().default(0).describe(`Corner radius in pixels.`),flipX:kd().default(!1).describe(`Whether the image is flipped horizontally.`),flipY:kd().default(!1).describe(`Whether the image is flipped vertically.`),clipSrc:W().default(``).describe(`URL or data URI for a clipping mask.`),borderColor:W().default(`black`).describe(`Border color.`),borderSize:G().default(0).describe(`Border width in pixels.`),keepRatio:kd().default(!1).describe(`Whether to maintain aspect ratio when resizing.`),stretchEnabled:kd().default(!1).describe(`Whether stretch mode is enabled.`)},a={...r,type:Xd(`text`),text:W().default(``).describe(`Visible text shown on canvas.`),placeholder:W().default(``).describe(`Placeholder text shown when empty.`),fontSize:G().default(kf.fontSize).describe(`Font size in pixels.`),fontFamily:W().default(kf.fontFamily).describe(`Font family name.`),fontStyle:W().default(kf.fontStyle).describe(`Font style: 'normal' or 'italic'.`),fontWeight:W().default(kf.fontWeight).describe(`Font weight: 'normal', 'bold', or numeric string.`),textDecoration:W().default(kf.textDecoration).describe(`Text decoration (e.g. underline, line-through).`),textTransform:W().default(kf.textTransform).describe(`Text transform: uppercase, lowercase, capitalize, none.`),fill:W().default(kf.fill).describe(`Text color.`),align:W().default(kf.align).describe(`Horizontal alignment (commonly left | center | right | justify).`),width:G().default(100).describe(`Width in pixels.`),height:G().default(0).describe(`Height in pixels (0 until measured/rendered).`),verticalAlign:W().default(`top`).describe(`Vertical alignment: top, middle, bottom.`),strokeWidth:G().default(kf.strokeWidth).describe(`Stroke width in pixels.`),stroke:W().default(kf.stroke).describe(`Stroke color.`),strokeLineJoin:W().default(kf.strokeLineJoin).describe(`Stroke corner join: round, miter, bevel.`),lineHeight:Bd([G(),W()]).default(kf.lineHeight).describe(`Line height multiplier or 'auto'.`),letterSpacing:G().default(kf.letterSpacing).describe(`Letter spacing as a fraction of font size.`),backgroundEnabled:kd().default(!1).describe(`Whether the text background is enabled.`),backgroundColor:W().default(`#7ED321`).describe(`Text background color.`),backgroundOpacity:G().default(1).describe(`Text background opacity (0-1).`),backgroundCornerRadius:G().default(.5).describe(`Text background corner radius.`),backgroundPadding:G().default(.5).describe(`Text background padding.`),curveEnabled:kd().default(kf.curveEnabled).describe(`Whether the text curve effect is enabled.`),curvePower:G().default(kf.curvePower).describe(`Text curve power (-1 to 1, 0 = straight).`),legacyBackground:kd().optional().describe(`Internal compatibility flag stamped by the v2→v3 migration.`)},o={...r,...i,type:Xd(`image`)},s={...r,type:Xd(`svg`),src:W().default(``).describe(`URL or data URI of the SVG.`),maskSrc:W().default(``).describe(`URL or data URI for an SVG mask.`),cropX:G().default(0),cropY:G().default(0),cropWidth:G().default(1),cropHeight:G().default(1),keepRatio:kd().default(!0),stretchEnabled:kd().default(!0),flipX:kd().default(!1),flipY:kd().default(!1),width:G().default(100),height:G().default(100),borderColor:W().default(`black`),borderSize:G().default(0),cornerRadius:G().default(0),colorsReplace:Kd(W(),W()).default({}).describe(`Color replacement mappings (original → replacement).`)},c={...r,type:Xd(`line`),width:G().default(400),height:G().default(10),color:W().default(`black`).describe(`Line color.`),dash:Fd(G()).default([]).describe(`Dash pattern array.`),startHead:W().default(``).describe(`Start arrow head: empty, arrow, circle, square, bar.`),endHead:W().default(``).describe(`End arrow head: empty, arrow, circle, square, bar.`)},l={...r,type:Xd(`figure`),subType:W().default(`rect`).describe(`Figure subtype: rect, ellipse, triangle, etc.`),fill:W().default(`rgb(0, 161, 255)`).describe(`Fill color.`),dash:Fd(G()).default([]).describe(`Dash pattern array.`),strokeWidth:G().default(0),stroke:W().default(`rgba(98, 197, 255, 1)`),cornerRadius:G().default(0)},u={...r,...i,type:Xd(`gif`),duration:G().default(0).describe(`GIF duration in milliseconds.`),keepRatio:kd().default(!0)},d={...r,...i,type:Xd(`video`),duration:G().default(0).describe(`Video duration in milliseconds.`),startTime:G().default(0).describe(`Start offset (0-1).`),endTime:G().default(1).describe(`End offset (0-1).`),volume:G().default(1).describe(`Volume (0-1).`),speed:G().default(1).describe(`Playback speed multiplier (1 = normal).`)},f=e({color:W().optional().describe(`Border color for this side.`),width:G().optional().describe(`Border width in pixels for this side.`),style:Jd([`solid`,`dashed`,`dotted`,`none`]).optional().describe(`Border style for this side.`)}),p=e({id:W().describe(`Unique identifier for the cell.`),type:Xd(`tablecell`).default(`tablecell`).describe(`Cell type identifier.`),text:W().default(``).describe(`Visible text shown in the cell.`),opacity:G().optional().describe(`Opacity level (0-1).`),rowSpan:G().optional().describe(`Number of rows this cell spans.`),colSpan:G().optional().describe(`Number of columns this cell spans.`),mergedInto:W().optional().describe(`Id of the cell this one is merged into, if any.`),name:W().optional().describe(`Display name for the cell.`),custom:jd().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:G().optional().describe(`Font size in pixels (inherits from the table when omitted).`),fontFamily:W().optional().describe(`Font family name (inherits from the table when omitted).`),fontWeight:W().optional().describe(`Font weight: 'normal', 'bold', or numeric string (inherits from the table when omitted).`),fontStyle:W().optional().describe(`Font style: 'normal' or 'italic' (inherits from the table when omitted).`),textDecoration:W().optional().describe(`Text decoration, e.g. underline, line-through (inherits from the table when omitted).`),textTransform:W().optional().describe(`Text transform: uppercase, lowercase, capitalize, none (inherits from the table when omitted).`),fill:W().optional().describe(`Text color (inherits from the table when omitted).`),align:W().optional().describe(`Horizontal alignment: left, center, right, justify (inherits from the table when omitted).`),verticalAlign:W().optional().describe(`Vertical alignment: top, middle, bottom (inherits from the table when omitted).`),lineHeight:Bd([G(),W()]).optional().describe(`Line height multiplier or 'auto' (inherits from the table when omitted).`),letterSpacing:G().optional().describe(`Letter spacing as a fraction of font size (inherits from the table when omitted).`),strokeWidth:G().optional().describe(`Stroke width in pixels (inherits from the table when omitted).`),stroke:W().optional().describe(`Stroke color (inherits from the table when omitted).`),cellBackground:W().optional().describe(`Cell background color (inherits from the table when omitted).`),cellPadding:G().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:Xd(`table`).describe(`Element type identifier.`),width:G().default(300).describe(`Width in pixels.`),height:G().default(200).describe(`Height in pixels.`),rows:G().default(3).describe(`Number of rows.`),cols:G().default(3).describe(`Number of columns.`),colWidths:Fd(G()).default([]).describe(`Column width fractions (sum to 1).`),rowHeights:Fd(G()).default([]).describe(`Row height fractions (sum to 1).`),cells:Fd(p).default([]).describe(`Flat cell array in row-major order.`),borderColor:W().default(`#000000`).describe(`Default border color for the table grid.`),borderWidth:G().default(1).describe(`Default border width in pixels.`),borderStyle:Jd([`solid`,`dashed`,`dotted`,`none`]).default(`solid`).describe(`Default border style.`),fontSize:G().default(30).describe(`Default font size in pixels for cells.`),fontFamily:W().default(`Roboto`).describe(`Default font family name for cells.`),fontWeight:W().default(`normal`).describe(`Default font weight: 'normal', 'bold', or numeric string.`),fontStyle:W().default(`normal`).describe(`Default font style: 'normal' or 'italic'.`),textDecoration:W().default(``).describe(`Default text decoration (e.g. underline, line-through).`),textTransform:W().default(`none`).describe(`Default text transform: uppercase, lowercase, capitalize, none.`),fill:W().default(`black`).describe(`Default text color for cells.`),align:W().default(`center`).describe(`Default horizontal alignment: left, center, right, justify.`),verticalAlign:W().default(`middle`).describe(`Default vertical alignment: top, middle, bottom.`),lineHeight:Bd([G(),W()]).default(1.2).describe(`Default line height multiplier or 'auto'.`),letterSpacing:G().default(0).describe(`Default letter spacing as a fraction of font size.`),strokeWidth:G().default(0).describe(`Default stroke width in pixels.`),stroke:W().default(`black`).describe(`Default stroke color.`),cellBackground:W().default(`transparent`).describe(`Default cell background color.`),cellPadding:G().default(4).describe(`Default cell padding in pixels.`)},ee=e=>({id:W(),type:Xd(`group`),name:W().default(``),custom:jd().optional(),opacity:G().default(1),visible:kd().default(!0),selectable:kd().default(!0),removable:kd().default(!0),alwaysOnTop:kd().default(!1),showInExport:kd().default(!0),animations:Fd(t).default([]),children:Fd(e).default([]).describe(`Child elements in this group.`)}),k=yf(()=>Hd(`type`,[e(a),e(o),e(s),e(c),e(l),e(u),e(d),e(O),e(ee(k))])),A={fontFamily:W().describe(`Font family name.`),url:W().default(``).describe(`URL to load the font from (single-variant fonts).`),styles:Fd(e({src:W().describe(`Font source, typically in CSS url() form.`),fontStyle:W().optional(),fontWeight:W().optional()})).optional().describe(`Per-weight/style variants for multi-variant families.`)},j={id:W().describe(`Unique identifier for the audio track.`),name:W().default(``).describe(`Display name shown on the timeline.`),src:W().default(``).describe(`URL or data URI of the audio file.`),duration:G().default(0).describe(`Duration in milliseconds.`),startTime:G().default(0).describe(`Start offset (0-1).`),endTime:G().default(1).describe(`End offset (0-1).`),volume:G().default(1).describe(`Volume level (0-1).`),delay:G().default(0).describe(`Delay before playing, in milliseconds.`),speed:G().default(1).describe(`Playback speed multiplier (1 = normal).`),custom:jd().optional()},M=e({id:W().describe(`Unique identifier for the page.`),width:Bd([G(),Xd(`auto`)]).default(`auto`).describe(`Page width in pixels or 'auto'.`),height:Bd([G(),Xd(`auto`)]).default(`auto`).describe(`Page height in pixels or 'auto'.`),background:W().default(`white`).describe(`Background color or image.`),bleed:G().default(0).describe(`Bleed area in pixels for print (all sides; base value for per-side overrides).`),bleedTop:G().optional().describe("Per-side bleed override (top), in pixels. Inherits `bleed` when omitted."),bleedRight:G().optional().describe("Per-side bleed override (right), in pixels. Inherits `bleed` when omitted."),bleedBottom:G().optional().describe("Per-side bleed override (bottom), in pixels. Inherits `bleed` when omitted."),bleedLeft:G().optional().describe("Per-side bleed override (left), in pixels. Inherits `bleed` when omitted."),custom:jd().optional(),duration:G().default(5e3).describe(`Page duration in milliseconds.`),children:Fd(k).default([]).describe(`Elements on this page.`)});return{design:e({schemaVersion:G().default(4).describe(`Schema version for compatibility / migration.`),width:G().default(1080).describe(`Canvas width in pixels.`),height:G().default(1080).describe(`Canvas height in pixels.`),unit:Jd([`px`,`pt`,`mm`,`cm`,`in`]).default(`px`).describe(`Unit type for print measurements.`),dpi:G().default(72).describe(`Dots per inch for print calculations.`),custom:jd().optional().describe(`Custom data attached to the design.`),fonts:Fd(e(A)).default([]).describe(`Fonts used in the design.`),pages:Fd(M).default([]).describe(`Pages in the design.`),audios:Fd(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 Mf=jf(Ld),Nf=Mf.design,Pf=jf(Rd).design;Ld(Mf.shapes.text),Ld(Mf.shapes.image),Ld(Mf.shapes.svg),Ld(Mf.shapes.line),Ld(Mf.shapes.figure),Ld(Mf.shapes.gif),Ld(Mf.shapes.video),Ld(Mf.shapes.table),Ld(Mf.shapes.font),Ld(Mf.shapes.audio);function Ff(e){return e.map(e=>({path:e.path.map(String).join(`.`),message:e.message}))}var If=new Set([`custom`,`data`]),Lf=new Set([`filters`,`colorsReplace`]);function Rf(e){if(Array.isArray(e))return e.filter(e=>e!=null).map(Rf);if(e&&typeof e==`object`){let t={};for(let n of Object.keys(e)){let r=e[n];r!=null&&(t[n]=If.has(n)?JSON.parse(JSON.stringify(r)):Lf.has(n)&&Array.isArray(r)?{}:Rf(r))}return t}return e}function zf(e){throw Cf(`DESIGN_INVALID`,`Invalid Polotno design:\n${e.slice(0,10).map(e=>` ${e.path}: ${e.message}`).join(`
|
|
76
|
+
`)}`,{errors:e})}function Bf(e,t={}){let n=(t.mode===`canonical`?Pf:Nf).safeParse(Rf(e));return n.success||zf(Ff(n.error.issues)),n.data}var Vf=[`warm`,`cold`,`natural`],Hf=/<\/?(?:p|br|span|strong|em|ol|ul|li)\b[^>]*>/i;function Uf(e){let t=!1;return Wf(e,e=>{t||e.type!==`text`||Hf.test(String(e.text??``))&&(t=!0)}),t}function Wf(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 Gf(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&&Wf(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:kf.fontSize;n!==0&&(e.letterSpacing=t*16/n)}),a<2&&Wf(i.pages,e=>{if(e.filters)for(let t of Object.keys(e.filters)){if(Vf.includes(t))continue;let n=e.filters[t];n&&typeof n.intensity==`number`&&(n.intensity/=100)}}),a<3&&n&&(r===void 0?Uf(i.pages):!r)&&Wf(i.pages,e=>{e.type===`text`&&e.backgroundEnabled&&(e.legacyBackground=!0)}),i.schemaVersion=4,i}function Kf(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 qf=new Set(Af);function Jf(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`&&qf.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 Yf(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 Xf(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(!qf.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 Zf(e,t={}){let n=e,r=Gf(e),i=(t.preserveClientData||t.fillMissingIds)&&r&&typeof r==`object`,a=[];i&&(t.fillMissingIds&&Kf(r),t.preserveClientData&&(a=Jf(r)));let o=Bf(r,t);if(i&&t.preserveClientData&&(a.length&&Yf(o,a),Xf(n,o)),t.requirePages&&o.pages.length===0)throw Cf(`DESIGN_INVALID`,"Invalid Polotno design: no pages — did you pass `store.toJSON()`?",{errors:[{path:`pages`,message:`no pages`}]});return o}function Qf(e){let t=e.bleed||0;return{top:e.bleedTop??t,right:e.bleedRight??t,bottom:e.bleedBottom??t,left:e.bleedLeft??t}}var $f=Object.freeze({top:0,right:0,bottom:0,left:0}),ep=u,tp=n(((e,t)=>{t.exports=function(e){function t(e,t,n,r){return new ha(e,t,n,r)}function n(){}function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function a(e){if(i(e)!==e)throw Error(r(188))}function o(e){var t=e.alternate;if(!t){if(t=i(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,o=t;;){var s=n.return;if(s===null)break;var c=s.alternate;if(c===null){if(o=s.return,o!==null){n=o;continue}break}if(s.child===c.child){for(c=s.child;c;){if(c===n)return a(s),e;if(c===o)return a(s),t;c=c.sibling}throw Error(r(188))}if(n.return!==o.return)n=s,o=c;else{for(var l=!1,u=s.child;u;){if(u===n){l=!0,n=s,o=c;break}if(u===o){l=!0,o=s,n=c;break}u=u.sibling}if(!l){for(u=c.child;u;){if(u===n){l=!0,n=c,o=s;break}if(u===o){l=!0,o=c,n=s;break}u=u.sibling}if(!l)throw Error(r(189))}}if(n.alternate!==o)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function s(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=s(e),t!==null)return t;e=e.sibling}return null}function c(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(e.tag!==4&&(t=c(e),t!==null))return t;e=e.sibling}return null}function l(e){return typeof e!=`object`||!e?null:(e=Ja&&e[Ja]||e[`@@iterator`],typeof e==`function`?e:null)}function u(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===Ya?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case Ia:return`Fragment`;case Ra:return`Profiler`;case La:return`StrictMode`;case Ha:return`Suspense`;case Ua:return`SuspenseList`;case Ka:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case Fa:return`Portal`;case Ba:return e.displayName||`Context`;case za:return(e._context.displayName||`Context`)+`.Consumer`;case Va:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case Wa:return t=e.displayName||null,t===null?u(e.type)||`Memo`:t;case Ga:t=e._payload,e=e._init;try{return u(e(t))}catch{}}return null}function d(e){return{current:e}}function f(e){0>gc||(e.current=hc[gc],hc[gc]=null,gc--)}function p(e,t){gc++,hc[gc]=e.current,e.current=t}function m(e){return e>>>=0,e===0?32:31-(yc(e)/bc|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=Cc;return Cc<<=1,!(Cc&62914560)&&(Cc=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-vc(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-vc(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-vc(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 Nc==`function`&&Pc(e),Ic&&typeof Ic.setStrictMode==`function`)try{Ic.setStrictMode(Fc,e)}catch{}}function A(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}function j(e){if(Bc===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Bc=t&&t[1]||``,Vc=-1<e.stack.indexOf(`
|
|
77
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
78
|
+
`+Bc+e+Vc}function M(e,t){if(!e||Hc)return``;Hc=!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{Hc=!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=Uc.get(e);return n===void 0?(t={value:e,source:t,stack:N(t)},Uc.set(e,t),t):n}return{value:e,source:t,stack:N(t)}}function F(e,t){Wc[Gc++]=qc,Wc[Gc++]=Kc,Kc=e,qc=t}function ne(e,t,n){Jc[Yc++]=Zc,Jc[Yc++]=Qc,Jc[Yc++]=Xc,Xc=e;var r=Zc;e=Qc;var i=32-vc(r)-1;r&=~(1<<i),n+=1;var a=32-vc(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Zc=1<<32-vc(t)+i|n<<i|r,Qc=a+e}else Zc=1<<a|n<<i|r,Qc=e}function re(e){e.return!==null&&(F(e,1),ne(e,1,0))}function I(e){for(;e===Kc;)Kc=Wc[--Gc],Wc[Gc]=null,qc=Wc[--Gc],Wc[Gc]=null;for(;e===Xc;)Xc=Jc[--Yc],Jc[Yc]=null,Qc=Jc[--Yc],Jc[Yc]=null,Zc=Jc[--Yc],Jc[Yc]=null}function L(e,t){Jc[Yc++]=Zc,Jc[Yc++]=Qc,Jc[Yc++]=Xc,Zc=t.id,Qc=t.overflow,Xc=e}function R(e,t){p(tl,t),p(el,e),p($c,null),e=no(t),f($c),p($c,e)}function ie(){f($c),f(el),f(tl)}function ae(e){e.memoizedState!==null&&p(nl,e);var t=$c.current,n=ro(t,e.type);t!==n&&(p(el,e),p($c,n))}function oe(e){el.current===e&&(f($c),f(el)),nl.current===e&&(f(nl),mo?No._currentValue=Mo:No._currentValue2=Mo)}function se(e){throw fe(P(Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),cl}function z(e,t){if(!_o)throw Error(r(175));As(e.stateNode,e.type,e.memoizedProps,t,e)||se(e,!0)}function ce(e){for(rl=e.return;rl;)switch(rl.tag){case 5:case 31:case 13:sl=!1;return;case 27:case 3:sl=!0;return;default:rl=rl.return}}function le(e){if(!_o||e!==rl)return!1;if(!al)return ce(e),al=!0,!1;var t=e.tag;if(lc?t!==3&&t!==27&&(t!==5||Ks(e.type)&&!co(e.type,e.memoizedProps))&&il&&se(e):t!==3&&(t!==5||Ks(e.type)&&!co(e.type,e.memoizedProps))&&il&&se(e),ce(e),t===13){if(!_o)throw Error(r(316));if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));il=Fs(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));il=Ps(e)}else il=lc&&t===27?bs(e.type,il):rl?ys(e.stateNode):null;return!0}function ue(){_o&&(il=rl=null,al=!1)}function de(){var e=ol;return e!==null&&(Ku===null?Ku=e:Ku.push.apply(Ku,e),ol=null),e}function fe(e){ol===null?ol=[e]:ol.push(e)}function pe(e,t,n){mo?(p(ll,t._currentValue),t._currentValue=n):(p(ll,t._currentValue2),t._currentValue2=n)}function me(e){var t=ll.current;mo?e._currentValue=t:e._currentValue2=t,f(ll)}function he(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 ge(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),he(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),he(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 _e(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;Lc(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===nl.current){if(s=a.alternate,s===null)throw Error(r(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[No]:e.push(No))}a=a.return}e!==null&&ge(t,e,n,i),t.flags|=262144}function ve(e){for(e=e.firstContext;e!==null;){var t=e.context;if(!Lc(mo?t._currentValue:t._currentValue2,e.memoizedValue))return!0;e=e.next}return!1}function ye(e){ul=e,dl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function be(e){return Se(ul,e)}function xe(e,t){return ul===null&&ye(e),Se(e,t)}function Se(e,t){var n=mo?t._currentValue:t._currentValue2;if(t={context:t,memoizedValue:n,next:null},dl===null){if(e===null)throw Error(r(308));dl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else dl=dl.next=t;return n}function Ce(){return{controller:new fl,data:new Map,refCount:0}}function we(e){e.refCount--,e.refCount===0&&pl(ml,function(){e.controller.abort()})}function Te(){}function Ee(e){e!==_l&&e.next===null&&(_l===null?gl=_l=e:_l=_l.next=e),yl=!0,vl||(vl=!0,Ne())}function De(e,t){if(!bl&&yl){bl=!0;do for(var n=!1,r=gl;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-vc(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Me(r,a))}else a=Mu,a=g(r,r===Au?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==po),!(a&3)||_(r,a)||(n=!0,Me(r,a))}r=r.next}while(n);bl=!1}}function Oe(){ke()}function ke(){yl=vl=!1;var e=0;xl!==0&&Co()&&(e=xl);for(var t=Oc(),n=null,r=gl;r!==null;){var i=r.next,a=Ae(r,t);a===0?(r.next=null,n===null?gl=i:n.next=i,i===null&&(_l=n)):(n=r,(e!==0||a&3)&&(yl=!0)),r=i}$u!==0&&$u!==5||De(e,!1),xl!==0&&(xl=0)}function Ae(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-vc(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=Au,n=Mu,n=g(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==po),r=e.callbackNode,n===0||e===t&&(Nu===2||Nu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Tc(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||_(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Tc(r),ee(n)){case 2:case 8:n=Ac;break;case 32:n=jc;break;case 268435456:n=Mc;break;default:n=jc}return r=je.bind(null,e),n=wc(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Tc(r),e.callbackPriority=2,e.callbackNode=null,2}function je(e,t){if($u!==0&&$u!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(aa()&&e.callbackNode!==n)return null;var r=Mu;return r=g(e,e===Au?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==po),r===0?null:(Ni(e,r,t),Ae(e,Oc()),e.callbackNode!=null&&e.callbackNode===n?je.bind(null,e):null)}function Me(e,t){if(aa())return null;Ni(e,t,!0)}function Ne(){Fo?Io(function(){ku&6?wc(kc,Oe):ke()}):wc(kc,Oe)}function Pe(){if(xl===0){var e=wl;e===0&&(e=xc,xc<<=1,!(xc&261888)&&(xc=256)),xl=e}return xl}function Fe(e,t){if(Sl===null){var n=Sl=[];Cl=0,wl=Pe(),Tl={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Cl++,t.then(Ie,Ie),t}function Ie(){if(--Cl===0&&Sl!==null){Tl!==null&&(Tl.status=`fulfilled`);var e=Sl;Sl=null,wl=0,Tl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Le(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 Re(){var e=Dl.current;return e===null?Au.pooledCache:e}function ze(e,t){t===null?p(Dl,Dl.current):p(Dl,t.pool)}function Be(){var e=Re();return e===null?null:{parent:mo?hl._currentValue:hl._currentValue2,pool:e}}function Ve(e,t){if(Lc(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(!zc.call(t,i)||!Lc(e[i],t[i]))return!1}return!0}function He(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ue(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Te,Te),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ke(e),e;default:if(typeof t.status==`string`)t.then(Te,Te);else{if(e=Au,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,Ke(e),e}throw Ml=t,Ol}}function We(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ml=e,Ol):e}}function Ge(){if(Ml===null)throw Error(r(459));var e=Ml;return Ml=null,e}function Ke(e){if(e===Ol||e===Al)throw Error(r(483))}function qe(e){var t=Pl;return Pl+=1,Nl===null&&(Nl=[]),Ue(Nl,e,t)}function Je(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ye(e,t){throw t.$$typeof===Pa?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Xe(e){function n(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function i(t,r){if(!e)return null;for(;r!==null;)n(t,r),r=r.sibling;return null}function a(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function o(e,t){return e=_a(e,t),e.index=0,e.sibling=null,e}function s(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function c(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function u(e,t,n,r){return t===null||t.tag!==6?(t=xa(n,e.mode,r),t.return=e,t):(t=o(t,n),t.return=e,t)}function d(e,t,n,r){var i=n.type;return i===Ia?p(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===Ga&&We(i)===t.type)?(t=o(t,n.props),Je(t,n),t.return=e,t):(t=ya(n.type,n.key,n.props,null,e.mode,r),Je(t,n),t.return=e,t)}function f(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Ca(n,e.mode,r),t.return=e,t):(t=o(t,n.children||[]),t.return=e,t)}function p(e,t,n,r,i){return t===null||t.tag!==7?(t=ba(n,e.mode,r,i),t.return=e,t):(t=o(t,n),t.return=e,t)}function m(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=xa(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case H:return n=ya(t.type,t.key,t.props,null,e.mode,n),Je(n,t),n.return=e,n;case Fa:return t=Ca(t,e.mode,n),t.return=e,t;case Ga:return t=We(t),m(e,t,n)}if(Xa(t)||l(t))return t=ba(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return m(e,qe(t),n);if(t.$$typeof===Ba)return m(e,xe(e,t),n);Ye(e,t)}return null}function h(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?u(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case H:return n.key===i?d(e,t,n,r):null;case Fa:return n.key===i?f(e,t,n,r):null;case Ga:return n=We(n),h(e,t,n,r)}if(Xa(n)||l(n))return i===null?p(e,t,n,r,null):null;if(typeof n.then==`function`)return h(e,t,qe(n),r);if(n.$$typeof===Ba)return h(e,t,xe(e,n),r);Ye(e,n)}return null}function g(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,u(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case H:return e=e.get(r.key===null?n:r.key)||null,d(t,e,r,i);case Fa:return e=e.get(r.key===null?n:r.key)||null,f(t,e,r,i);case Ga:return r=We(r),g(e,t,n,r,i)}if(Xa(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,qe(r),i);if(r.$$typeof===Ba)return g(e,t,n,xe(t,r),i);Ye(t,r)}return null}function _(t,r,o,c){for(var l=null,u=null,d=r,f=r=0,p=null;d!==null&&f<o.length;f++){d.index>f?(p=d,d=null):p=d.sibling;var _=h(t,d,o[f],c);if(_===null){d===null&&(d=p);break}e&&d&&_.alternate===null&&n(t,d),r=s(_,r,f),u===null?l=_:u.sibling=_,u=_,d=p}if(f===o.length)return i(t,d),al&&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 al&&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)}),al&&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),al&&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 al&&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)}),al&&F(t,p),u}function y(e,t,a,s){if(typeof a==`object`&&a&&a.type===Ia&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case H:a:{for(var u=a.key;t!==null;){if(t.key===u){if(u=a.type,u===Ia){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===Ga&&We(u)===t.type){i(e,t.sibling),s=o(t,a.props),Je(s,a),s.return=e,e=s;break a}i(e,t);break}n(e,t),t=t.sibling}a.type===Ia?(s=ba(a.props.children,e.mode,s,a.key),s.return=e,e=s):(s=ya(a.type,a.key,a.props,null,e.mode,s),Je(s,a),s.return=e,e=s)}return c(e);case Fa:a:{for(u=a.key;t!==null;){if(t.key===u){if(t.tag===4&&t.stateNode.containerInfo===a.containerInfo&&t.stateNode.implementation===a.implementation){i(e,t.sibling),s=o(t,a.children||[]),s.return=e,e=s;break a}i(e,t);break}n(e,t),t=t.sibling}s=Ca(a,e.mode,s),s.return=e,e=s}return c(e);case Ga:return a=We(a),y(e,t,a,s)}if(Xa(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,qe(a),s);if(a.$$typeof===Ba)return y(e,t,xe(e,a),s);Ye(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,t!==null&&t.tag===6?(i(e,t.sibling),s=o(t,a),s.return=e,e=s):(i(e,t),s=xa(a,e.mode,s),s.return=e,e=s),c(e)):i(e,t)}return function(e,n,r,i){try{Pl=0;var a=y(e,n,r,i);return Nl=null,a}catch(n){if(n===Ol||n===Al)throw n;var o=t(29,n,null,e.mode);return o.lanes=i,o.return=e,o}}}function Ze(){for(var e=Rl,t=zl=Rl=0;t<e;){var n=Ll[t];Ll[t++]=null;var r=Ll[t];Ll[t++]=null;var i=Ll[t];Ll[t++]=null;var a=Ll[t];if(Ll[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&tt(n,i,a)}}function Qe(e,t,n,r){Ll[Rl++]=e,Ll[Rl++]=t,Ll[Rl++]=n,Ll[Rl++]=r,zl|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function $e(e,t,n,r){return Qe(e,t,n,r),nt(e)}function et(e,t){return Qe(e,null,null,t),nt(e)}function tt(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-vc(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function nt(e){if(50<ad)throw ad=0,od=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}function rt(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function it(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function at(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ot(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ku&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=nt(e),tt(e,null,n),t}return Qe(e,r,t,n),nt(e)}function st(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,E(e,n)}}function ct(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function lt(){if(Vl){var e=Tl;if(e!==null)throw e}}function ut(e,t,n,r){Vl=!1;var i=e.updateQueue;Bl=!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?(Mu&f)===f:(r&f)===f){f!==0&&f===wl&&(Vl=!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=Na({},d,f);break a;case 2:Bl=!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),Bu|=o,e.lanes=o,e.memoizedState=d}}function dt(e,t){if(typeof e!=`function`)throw Error(r(191,e));e.call(t)}function ft(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)dt(n[e],t)}function pt(e,t){e=Ru,p(Ul,e),p(Hl,t),Ru=e|t.baseLanes}function mt(){p(Ul,Ru),p(Hl,Hl.current)}function ht(){Ru=Ul.current,f(Hl),f(Ul)}function gt(e){var t=e.alternate;p(Kl,Kl.current&1),p(Wl,e),Gl===null&&(t===null||Hl.current!==null||t.memoizedState!==null)&&(Gl=e)}function _t(e){p(Kl,Kl.current),p(Wl,e),Gl===null&&(Gl=e)}function vt(e){e.tag===22?(p(Kl,Kl.current),p(Wl,e),Gl===null&&(Gl=e)):yt(e)}function yt(){p(Kl,Kl.current),p(Wl,Wl.current)}function bt(e){f(Wl),Gl===e&&(Gl=null),f(Kl)}function xt(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||ps(n)||ms(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function St(){throw Error(r(321))}function Ct(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Lc(e[n],t[n]))return!1;return!0}function wt(e,t,n,r,i,a){return ql=a,Jl=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Za.H=e===null||e.memoizedState===null?au:ou,$l=!1,a=n(r,i),$l=!1,Ql&&(a=Et(t,n,r,i)),Tt(e),a}function Tt(e){Za.H=iu;var t=Yl!==null&&Yl.next!==null;if(ql=0,Xl=Yl=Jl=null,Zl=!1,tu=0,nu=null,t)throw Error(r(300));e===null||uu||(e=e.dependencies,e!==null&&ve(e)&&(uu=!0))}function Et(e,t,n,i){Jl=e;var a=0;do{if(Ql&&(nu=null),tu=0,Ql=!1,25<=a)throw Error(r(301));if(a+=1,Xl=Yl=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}Za.H=su,o=t(n,i)}while(Ql);return o}function Dt(){var e=Za.H,t=e.useState()[0];return t=typeof t.then==`function`?Pt(t):t,e=e.useState()[0],(Yl===null?null:Yl.memoizedState)!==e&&(Jl.flags|=1024),t}function Ot(){var e=eu!==0;return eu=0,e}function kt(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function At(e){if(Zl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Zl=!1}ql=0,Xl=Yl=Jl=null,Ql=!1,tu=eu=0,nu=null}function jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xl===null?Jl.memoizedState=Xl=e:Xl=Xl.next=e,Xl}function Mt(){if(Yl===null){var e=Jl.alternate;e=e===null?null:e.memoizedState}else e=Yl.next;var t=Xl===null?Jl.memoizedState:Xl.next;if(t!==null)Xl=t,Yl=e;else{if(e===null)throw Jl.alternate===null?Error(r(467)):Error(r(310));Yl=e,e={memoizedState:Yl.memoizedState,baseState:Yl.baseState,baseQueue:Yl.baseQueue,queue:Yl.queue,next:null},Xl===null?Jl.memoizedState=Xl=e:Xl=Xl.next=e}return Xl}function Nt(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Pt(e){var t=tu;return tu+=1,nu===null&&(nu=[]),e=Ue(nu,e,t),t=Jl,(Xl===null?t.memoizedState:Xl.next)===null&&(t=t.alternate,Za.H=t===null||t.memoizedState===null?au:ou),e}function Ft(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Pt(e);if(e.$$typeof===Ba)return be(e)}throw Error(r(438,String(e)))}function It(e){var t=null,n=Jl.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Jl.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Nt(),Jl.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]=qa;return t.index++,n}function Lt(e,t){return typeof t==`function`?t(e):t}function Rt(e){return zt(Mt(),Yl,e)}function zt(e,t,n){var i=e.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=n;var a=e.baseQueue,o=i.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,i.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(ql&f)===f:(Mu&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===wl&&(d=!0);else if((ql&p)===p){u=u.next,p===wl&&(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,Jl.lanes|=p,Bu|=p;f=u.action,$l&&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,Jl.lanes|=f,Bu|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Lc(o,e.memoizedState)&&(uu=!0,d&&(n=Tl,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,i.lastRenderedState=o}return a===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Bt(e){var t=Mt(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Lc(o,t.memoizedState)||(uu=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Vt(e,t,n){var i=Jl,a=Mt(),o=al;if(o){if(n===void 0)throw Error(r(407));n=n()}else n=t();var s=!Lc((Yl||a).memoizedState,n);if(s&&(a.memoizedState=n,uu=!0),a=a.queue,pn(Wt.bind(null,i,a,e),[e]),a.getSnapshot!==t||s||Xl!==null&&Xl.memoizedState.tag&1){if(i.flags|=2048,cn(9,{destroy:void 0},Ut.bind(null,i,a,n,t),null),Au===null)throw Error(r(349));o||ql&127||Ht(i,t,n)}return n}function Ht(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Jl.updateQueue,t===null?(t=Nt(),Jl.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ut(e,t,n,r){t.value=n,t.getSnapshot=r,Gt(t)&&Kt(e)}function Wt(e,t,n){return n(function(){Gt(t)&&Kt(e)})}function Gt(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Lc(e,n)}catch{return!0}}function Kt(e){var t=et(e,2);t!==null&&Mi(t,e,2)}function qt(e){var t=jt();if(typeof e==`function`){var n=e;if(e=n(),$l){k(!0);try{n()}finally{k(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lt,lastRenderedState:e},t}function Jt(e,t,n,r){return e.baseState=n,zt(e,Yl,typeof r==`function`?r:Lt)}function Yt(e,t,n,i,a){if(B(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)}};Za.T===null?o.isTransition=!1:n(!0),i(o),n=t.pending,n===null?(o.next=t.pending=o,Xt(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Xt(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=Za.T,o={};Za.T=o;try{var s=n(i,r),c=Za.S;c!==null&&c(o,s),Zt(e,t,s)}catch(n){$t(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),Za.T=a}}else try{a=n(i,r),Zt(e,t,a)}catch(n){$t(e,t,n)}}function Zt(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Qt(e,t,n)},function(n){return $t(e,t,n)}):Qt(e,t,n)}function Qt(e,t,n){t.status=`fulfilled`,t.value=n,en(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Xt(e,n)))}function $t(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,en(t),t=t.next;while(t!==r)}e.action=null}function en(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function tn(e,t){return t}function nn(e,t){if(al){var n=Au.formState;if(n!==null){a:{var r=Jl;if(al){if(il){var i=_s(il,sl);if(i){il=ys(i),r=vs(i);break a}}se(r)}r=!1}r&&(t=n[0])}}n=jt(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tn,lastRenderedState:t},n.queue=r,n=Mn.bind(null,Jl,r),r.dispatch=n,r=qt(!1);var a=Pn.bind(null,Jl,!1,r.queue);return r=jt(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Yt.bind(null,Jl,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function rn(e){return an(Mt(),Yl,e)}function an(e,t,n){if(t=zt(e,t,tn)[0],e=Rt(Lt)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Pt(t)}catch(e){throw e===Ol?Al:e}else r=t;t=Mt();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(Jl.flags|=2048,cn(9,{destroy:void 0},on.bind(null,i,n),null)),[r,a,e]}function on(e,t){e.action=t}function sn(e){var t=Mt(),n=Yl;if(n!==null)return an(t,n,e);Mt(),t=t.memoizedState,n=Mt();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function cn(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Jl.updateQueue,t===null&&(t=Nt(),Jl.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ln(){return Mt().memoizedState}function un(e,t,n,r){var i=jt();Jl.flags|=e,i.memoizedState=cn(1|t,{destroy:void 0},n,r===void 0?null:r)}function dn(e,t,n,r){var i=Mt();r=r===void 0?null:r;var a=i.memoizedState.inst;Yl!==null&&r!==null&&Ct(r,Yl.memoizedState.deps)?i.memoizedState=cn(t,a,n,r):(Jl.flags|=e,i.memoizedState=cn(1|t,a,n,r))}function fn(e,t){un(8390656,8,e,t)}function pn(e,t){dn(2048,8,e,t)}function mn(e){Jl.flags|=4;var t=Jl.updateQueue;if(t===null)t=Nt(),Jl.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function hn(e){var t=Mt().memoizedState;return mn({ref:t,nextImpl:e}),function(){if(ku&2)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function gn(e,t){return dn(4,2,e,t)}function _n(e,t){return dn(4,4,e,t)}function vn(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function yn(e,t,n){n=n==null?null:n.concat([e]),dn(4,4,vn.bind(null,t,e),n)}function bn(){}function xn(e,t){var n=Mt();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Ct(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Sn(e,t){var n=Mt();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Ct(t,r[1]))return r[0];if(r=e(),$l){k(!0);try{e()}finally{k(!1)}}return n.memoizedState=[r,t],r}function Cn(e,t,n){return n===void 0||ql&1073741824&&!(Mu&261930)?e.memoizedState=t:(e.memoizedState=n,e=ji(),Jl.lanes|=e,Bu|=e,n)}function wn(e,t,n,r){return Lc(n,t)?n:Hl.current===null?!(ql&42)||ql&1073741824&&!(Mu&261930)?(uu=!0,e.memoizedState=n):(e=ji(),Jl.lanes|=e,Bu|=e,t):(e=Cn(e,n,r),Lc(e,t)||(uu=!0),e)}function Tn(e,t,n,r,i){var a=xo();bo(a!==0&&8>a?a:8);var o=Za.T,s={};Za.T=s,Pn(e,!1,t,n);try{var c=i(),l=Za.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Nn(e,t,Le(c,r),Ai(e)):Nn(e,t,r,Ai(e))}catch(n){Nn(e,t,{then:function(){},status:`rejected`,reason:n},Ai())}finally{bo(a),o!==null&&s.types!==null&&(o.types=s.types),Za.T=o}}function En(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Mo,baseState:Mo,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lt,lastRenderedState:Mo},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lt,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Dn(){return be(No)}function On(){return Mt().memoizedState}function kn(){return Mt().memoizedState}function An(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Ai();e=at(n);var r=ot(t,e,n);r!==null&&(Mi(r,t,n),st(r,t,n)),t={cache:Ce()},e.payload=t;return}t=t.return}}function jn(e,t,n){var r=Ai();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},B(e)?Fn(t,n):(n=$e(e,t,n,r),n!==null&&(Mi(n,e,r),In(n,t,r)))}function Mn(e,t,n){Nn(e,t,n,Ai())}function Nn(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(B(e))Fn(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,Lc(s,o))return Qe(e,t,i,0),Au===null&&Ze(),!1}catch{}if(n=$e(e,t,i,r),n!==null)return Mi(n,e,r),In(n,t,r),!0}return!1}function Pn(e,t,n,i){if(i={lane:2,revertLane:Pe(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},B(e)){if(t)throw Error(r(479))}else t=$e(e,n,i,2),t!==null&&Mi(t,e,2)}function B(e){var t=e.alternate;return e===Jl||t!==null&&t===Jl}function Fn(e,t){Ql=Zl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function In(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,E(e,n)}}function Ln(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Na({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}function Rn(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Ve(n,r)||!Ve(i,a):!0}function zn(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&cu.enqueueReplaceState(t,t.state,null)}function Bn(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=Na({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Vn(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Hn(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Un(e,t,n){return n=at(n),n.tag=3,n.payload={element:null},n.callback=function(){Vn(e,t)},n}function Wn(e){return e=at(e),e.tag=3,e}function Gn(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Hn(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Hn(t,n,r),typeof i!=`function`&&(Qu===null?Qu=new Set([this]):Qu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Kn(e,t,n,i,a){if(n.flags|=32768,typeof i==`object`&&i&&typeof i.then==`function`){if(t=n.alternate,t!==null&&_e(t,n,a,!0),n=Wl.current,n!==null){switch(n.tag){case 31:case 13:return Gl===null?Wi():n.alternate===null&&zu===0&&(zu=3),n.flags&=-257,n.flags|=65536,n.lanes=a,i===jl?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([i]):t.add(i),la(e,i,a)),!1;case 22:return n.flags|=65536,i===jl?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([i]):n.add(i)),la(e,i,a)),!1}throw Error(r(435,n.tag))}return la(e,i,a),Wi(),!1}if(al)return t=Wl.current,t===null?(i!==cl&&(t=Error(r(423),{cause:i}),fe(P(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,i=P(i,n),a=Un(e.stateNode,i,a),ct(e,a),zu!==4&&(zu=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,i!==cl&&(e=Error(r(422),{cause:i}),fe(P(e,n)))),!1;var o=Error(r(520),{cause:i});if(o=P(o,n),Gu===null?Gu=[o]:Gu.push(o),zu!==4&&(zu=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=Un(n.stateNode,i,e),ct(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(Qu===null||!Qu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Wn(a),Gn(a,e,n,i),ct(n,a),!1}n=n.return}while(n!==null);return!1}function qn(e,t,n,r){t.child=e===null?Il(t,null,n,r):Fl(t,e.child,n,r)}function Jn(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ye(t),r=wt(e,t,n,o,a,i),s=Ot(),e!==null&&!uu?(kt(e,t,i),_r(e,t,i)):(al&&s&&re(t),t.flags|=1,qn(e,t,r,i),t.child)}function Yn(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ga(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Xn(e,t,a,r,i)):(e=ya(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!vr(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Ve:n,n(o,r)&&e.ref===t.ref)return _r(e,t,i)}return t.flags|=1,e=_a(a,r),e.ref=t.ref,e.return=t,t.child=e}function Xn(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Ve(a,r)&&e.ref===t.ref){if(uu=!1,t.pendingProps=r=a,vr(e,i))e.flags&131072&&(uu=!0);else return t.lanes=e.lanes,_r(e,t,i)}}return ir(e,t,n,r,i)}function Zn(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return $n(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ze(t,a===null?null:a.cachePool),a===null?mt():pt(t,a),vt(t);else return r=t.lanes=536870912,$n(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ze(t,null),mt(),yt(t)):(ze(t,a.cachePool),pt(t,a),yt(t),t.memoizedState=null);return qn(e,t,i,n),t.child}function Qn(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function $n(e,t,n,r,i){var a=Re();return a=a===null?null:{parent:mo?hl._currentValue:hl._currentValue2,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ze(t,null),mt(),vt(t),e!==null&&_e(e,t,r,!0),t.childLanes=i,null}function er(e,t){return t=fr({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function tr(e,t,n){return Fl(t,e.child,null,n),e=er(t,t.pendingProps),e.flags|=2,bt(t),t.memoizedState=null,e}function nr(e,t,n){var i=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(al){if(i.mode===`hidden`)return e=er(t,i),t.lanes=536870912,Qn(null,e);if(_t(t),(e=il)?(e=Os(e,sl),e!==null&&(t.memoizedState={dehydrated:e,treeContext:Xc===null?null:{id:Zc,overflow:Qc},retryLane:536870912,hydrationErrors:null},n=Sa(e),n.return=t,t.child=n,rl=t,il=null)):e=null,e===null)throw se(t);return t.lanes=536870912,null}return er(t,i)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(_t(t),a){if(t.flags&256)t.flags&=-257,t=tr(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558))}else if(uu||_e(e,t,n,!1),a=(n&e.childLanes)!==0,uu||a){if(i=Au,i!==null&&(s=D(i,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,et(e,s),Mi(i,e,s),lu;Wi(),t=tr(e,t,n)}else e=o.treeContext,_o&&(il=Cs(s),rl=t,al=!0,ol=null,sl=!1,e!==null&&L(t,e)),t=er(t,i),t.flags|=4096;return t}return e=_a(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function rr(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(r(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function ir(e,t,n,r,i){return ye(t),n=wt(e,t,n,r,void 0,i),r=Ot(),e!==null&&!uu?(kt(e,t,i),_r(e,t,i)):(al&&r&&re(t),t.flags|=1,qn(e,t,n,i),t.child)}function ar(e,t,n,r,i,a){return ye(t),t.updateQueue=null,n=Et(t,r,n,i),Tt(e),r=Ot(),e!==null&&!uu?(kt(e,t,a),_r(e,t,a)):(al&&r&&re(t),t.flags|=1,qn(e,t,n,a),t.child)}function or(e,t,n,r,i){if(ye(t),t.stateNode===null){var a=_c,o=n.contextType;typeof o==`object`&&o&&(a=be(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=cu,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},rt(t),o=n.contextType,a.context=typeof o==`object`&&o?be(o):_c,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ln(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&cu.enqueueReplaceState(a,a.state,null),ut(t,r,a,i),lt(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Bn(n,s);a.props=c;var l=a.context,u=n.contextType;o=_c,typeof u==`object`&&u&&(o=be(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&zn(t,a,r,o),Bl=!1;var f=t.memoizedState;a.state=f,ut(t,r,a,i),lt(),l=t.memoizedState,s||f!==l||Bl?(typeof d==`function`&&(Ln(t,n,d,r),l=t.memoizedState),(c=Bl||Rn(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,it(e,t),o=t.memoizedProps,u=Bn(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=_c,typeof l==`object`&&l&&(c=be(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&zn(t,a,r,c),Bl=!1,f=t.memoizedState,a.state=f,ut(t,r,a,i),lt();var p=t.memoizedState;o!==d||f!==p||Bl||e!==null&&e.dependencies!==null&&ve(e.dependencies)?(typeof s==`function`&&(Ln(t,n,s,r),p=t.memoizedState),(u=Bl||Rn(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&ve(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,rr(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Fl(t,e.child,null,i),t.child=Fl(t,null,n,i)):qn(e,t,n,i),t.memoizedState=a.state,e=t.child):e=_r(e,t,i),e}function sr(e,t,n,r){return ue(),t.flags|=256,qn(e,t,n,r),t.child}function cr(e){return{baseLanes:e,cachePool:Be()}}function lr(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Uu),e}function ur(e,t,n){var i=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(Kl.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(al){if(a?gt(t):yt(t),(e=il)?(e=ks(e,sl),e!==null&&(t.memoizedState={dehydrated:e,treeContext:Xc===null?null:{id:Zc,overflow:Qc},retryLane:536870912,hydrationErrors:null},n=Sa(e),n.return=t,t.child=n,rl=t,il=null)):e=null,e===null)throw se(t);return ms(e)?t.lanes=32:t.lanes=536870912,null}var c=i.children;return i=i.fallback,a?(yt(t),a=t.mode,c=fr({mode:`hidden`,children:c},a),i=ba(i,a,n,null),c.return=t,i.return=t,c.sibling=i,t.child=c,i=t.child,i.memoizedState=cr(n),i.childLanes=lr(e,s,n),t.memoizedState=du,Qn(null,i)):(gt(t),dr(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(gt(t),t.flags&=-257,t=pr(e,t,n)):t.memoizedState===null?(yt(t),c=i.fallback,a=t.mode,i=fr({mode:`visible`,children:i.children},a),c=ba(c,a,n,null),c.flags|=2,i.return=t,c.return=t,i.sibling=c,t.child=i,Fl(t,e.child,null,n),i=t.child,i.memoizedState=cr(n),i.childLanes=lr(e,s,n),t.memoizedState=du,t=Qn(null,i)):(yt(t),t.child=e.child,t.flags|=128,t=null);else if(gt(t),ms(c))s=hs(c).digest,i=Error(r(419)),i.stack=``,i.digest=s,fe({value:i,source:null,stack:null}),t=pr(e,t,n);else if(uu||_e(e,t,n,!1),s=(n&e.childLanes)!==0,uu||s){if(s=Au,s!==null&&(i=D(s,n),i!==0&&i!==l.retryLane))throw l.retryLane=i,et(e,i),Mi(s,e,i),lu;ps(c)||Wi(),t=pr(e,t,n)}else ps(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,_o&&(il=ws(c),rl=t,al=!0,ol=null,sl=!1,e!==null&&L(t,e)),t=dr(t,i.children),t.flags|=4096);return t}return a?(yt(t),c=i.fallback,a=t.mode,l=e.child,o=l.sibling,i=_a(l,{mode:`hidden`,children:i.children}),i.subtreeFlags=l.subtreeFlags&65011712,o===null?(c=ba(c,a,n,null),c.flags|=2):c=_a(o,c),c.return=t,i.return=t,i.sibling=c,t.child=i,Qn(null,i),i=t.child,c=e.child.memoizedState,c===null?c=cr(n):(a=c.cachePool,a===null?a=Be():(l=mo?hl._currentValue:hl._currentValue2,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),i.memoizedState=c,i.childLanes=lr(e,s,n),t.memoizedState=du,Qn(e.child,i)):(gt(t),n=e.child,e=n.sibling,n=_a(n,{mode:`visible`,children:i.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function dr(e,t){return t=fr({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function fr(e,n){return e=t(22,e,null,n),e.lanes=0,e}function pr(e,t,n){return Fl(t,e.child,null,n),e=dr(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function mr(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),he(e.return,t,n)}function hr(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function gr(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Kl.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,p(Kl,o),qn(e,t,r,n),r=al?qc:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&mr(e,n,t);else if(e.tag===19)mr(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&xt(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),hr(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&xt(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}hr(t,!0,n,null,a,r);break;case`together`:hr(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function _r(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Bu|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(_e(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=_a(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=_a(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function vr(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&ve(e)))}function yr(e,t,n){switch(t.tag){case 3:R(t,t.stateNode.containerInfo),pe(t,hl,e.memoizedState.cache),ue();break;case 27:case 5:ae(t);break;case 4:R(t,t.stateNode.containerInfo);break;case 10:pe(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,_t(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(gt(t),e=_r(e,t,n),e===null?null:e.sibling):ur(e,t,n):(gt(t),t.flags|=128,null);gt(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(_e(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return gr(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),p(Kl,Kl.current),r)break;return null;case 22:return t.lanes=0,Zn(e,t,n,t.pendingProps);case 24:pe(t,hl,e.memoizedState.cache)}return _r(e,t,n)}function br(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)uu=!0;else{if(!vr(e,n)&&!(t.flags&128))return uu=!1,yr(e,t,n);uu=!!(e.flags&131072)}}else uu=!1,al&&t.flags&1048576&&ne(t,qc,t.index);switch(t.lanes=0,t.tag){case 16:a:{var i=t.pendingProps;if(e=We(t.elementType),t.type=e,typeof e==`function`)ga(e)?(i=Bn(e,i),t.tag=1,t=or(null,t,e,i,n)):(t.tag=0,t=ir(null,t,e,i,n));else{if(e!=null){var a=e.$$typeof;if(a===Va){t.tag=11,t=Jn(null,t,e,i,n);break a}if(a===Wa){t.tag=14,t=Yn(null,t,e,i,n);break a}}throw t=u(e)||e,Error(r(306,t,``))}}return t;case 0:return ir(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,a=Bn(i,t.pendingProps),or(e,t,i,a,n);case 3:a:{if(R(t,t.stateNode.containerInfo),e===null)throw Error(r(387));var o=t.pendingProps;a=t.memoizedState,i=a.element,it(e,t),ut(t,o,null,n);var s=t.memoizedState;if(o=s.cache,pe(t,hl,o),o!==a.cache&&ge(t,[hl],n,!0),lt(),o=s.element,_o&&a.isDehydrated){if(a={element:o,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=sr(e,t,o,n);break a}if(o!==i){i=P(Error(r(424)),t),fe(i),t=sr(e,t,o,n);break a}for(_o&&(il=Ss(t.stateNode.containerInfo),rl=t,al=!0,ol=null,sl=!0),n=Il(t,null,o,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(ue(),o===i){t=_r(e,t,n);break a}qn(e,t,o,n)}t=t.child}return t;case 26:if(Ys)return rr(e,t),e===null?(n=Qs(t.type,null,t.pendingProps,null))?t.memoizedState=n:al||(t.stateNode=ic(t.type,t.pendingProps,tl.current,t)):t.memoizedState=Qs(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:if(lc)return ae(t),e===null&&lc&&al&&(i=t.stateNode=uc(t.type,t.pendingProps,tl.current,$c.current,!1),rl=t,sl=!0,il=Ts(t.type,i,il)),qn(e,t,t.pendingProps.children,n),rr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&al&&(qs(t.type,t.pendingProps,$c.current),(a=i=il)&&(i=Es(i,t.type,t.pendingProps,sl),i===null?a=!1:(t.stateNode=i,rl=t,il=xs(i),sl=!1,a=!0)),a||se(t)),ae(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,i=o.children,co(a,o)?i=null:s!==null&&co(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=wt(e,t,Dt,null,null,n),mo?No._currentValue=a:No._currentValue2=a),rr(e,t),qn(e,t,i,n),t.child;case 6:return e===null&&al&&(Js(t.pendingProps,$c.current),(e=n=il)&&(n=Ds(n,t.pendingProps,sl),n===null?e=!1:(t.stateNode=n,rl=t,il=null,e=!0)),e||se(t)),null;case 13:return ur(e,t,n);case 4:return R(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Fl(t,null,i,n):qn(e,t,i,n),t.child;case 11:return Jn(e,t,t.type,t.pendingProps,n);case 7:return qn(e,t,t.pendingProps,n),t.child;case 8:return qn(e,t,t.pendingProps.children,n),t.child;case 12:return qn(e,t,t.pendingProps.children,n),t.child;case 10:return i=t.pendingProps,pe(t,t.type,i.value),qn(e,t,i.children,n),t.child;case 9:return a=t.type._context,i=t.pendingProps.children,ye(t),a=be(a),i=i(a),t.flags|=1,qn(e,t,i,n),t.child;case 14:return Yn(e,t,t.type,t.pendingProps,n);case 15:return Xn(e,t,t.type,t.pendingProps,n);case 19:return gr(e,t,n);case 31:return nr(e,t,n);case 22:return Zn(e,t,n,t.pendingProps);case 24:return ye(t),i=be(hl),e===null?(a=Re(),a===null&&(a=Au,o=Ce(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:i,cache:a},rt(t),pe(t,hl,a)):((e.lanes&n)!==0&&(it(e,t),ut(t,null,null,n),lt()),a=e.memoizedState,o=t.memoizedState,a.parent===i?(i=o.cache,pe(t,hl,i),i!==a.cache&&ge(t,[hl],n,!0)):(a={parent:i,cache:i},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),pe(t,hl,i))),qn(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function xr(e){e.flags|=4}function Sr(e){go&&(e.flags|=8)}function Cr(e,t){if(e!==null&&e.child===t.child)return!1;if(t.flags&16)return!0;for(e=t.child;e!==null;){if(e.flags&8218||e.subtreeFlags&8218)return!0;e=e.sibling}return!1}function wr(e,t,n,r){if(ho)for(n=t.child;n!==null;){if(n.tag===5||n.tag===6)oo(e,n.stateNode);else if(!(n.tag===4||lc&&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(go)for(var i=t.child;i!==null;){if(i.tag===5){var a=i.stateNode;n&&r&&(a=ds(a,i.type,i.memoizedProps)),oo(e,a)}else if(i.tag===6)a=i.stateNode,n&&r&&(a=fs(a,i.memoizedProps)),oo(e,a);else if(i.tag!==4){if(i.tag===22&&i.memoizedState!==null)a=i.child,a!==null&&(a.return=i),wr(e,i,!0,!0);else if(i.child!==null){i.child.return=i,i=i.child;continue}}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}}function Tr(e,t,n,r){var i=!1;if(go)for(var a=t.child;a!==null;){if(a.tag===5){var o=a.stateNode;n&&r&&(o=ds(o,a.type,a.memoizedProps)),cs(e,o)}else if(a.tag===6)o=a.stateNode,n&&r&&(o=fs(o,a.memoizedProps)),cs(e,o);else if(a.tag!==4){if(a.tag===22&&a.memoizedState!==null)i=a.child,i!==null&&(i.return=a),Tr(e,a,!0,!0),i=!0;else if(a.child!==null){a.child.return=a,a=a.child;continue}}if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return i;a=a.return}a.sibling.return=a.return,a=a.sibling}return i}function Er(e,t){if(go&&Cr(e,t)){e=t.stateNode;var n=e.containerInfo,r=ss();Tr(r,t,!1,!1),e.pendingChildren=r,xr(t),ls(n,r)}}function Dr(e,t,n,r){if(ho)e.memoizedProps!==r&&xr(t);else if(go){var i=e.stateNode,a=e.memoizedProps;if((e=Cr(e,t))||a!==r){var o=$c.current;a=os(i,n,a,r,!e,null),a===i?t.stateNode=i:(Sr(t),so(a,n,r,o)&&xr(t),t.stateNode=a,e&&wr(a,t,!1,!1))}else t.stateNode=i}}function Or(e,t,n,r,i){if(e.mode&32&&(n===null?To(t,r):Eo(t,n,r))){if(e.flags|=16777216,(i&335544128)===i||Do(t,r)){if(Oo(e.stateNode,t,r))e.flags|=8192;else if(Vi())e.flags|=8192;else throw Ml=jl,kl}}else e.flags&=-16777217}function kr(e,t){if(oc(t)){if(e.flags|=16777216,!sc(t)){if(Vi())e.flags|=8192;else throw Ml=jl,kl}}else e.flags&=-16777217}function Ar(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:y(),e.lanes|=t,Wu|=t)}function jr(e,t){if(!al)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Mr(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Nr(e,t,n){var i=t.pendingProps;switch(I(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mr(t),null;case 1:return Mr(t),null;case 3:return n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),me(hl),ie(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(le(t)?xr(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,de())),Er(e,t),Mr(t),null;case 26:if(Ys){var a=t.type,o=t.memoizedState;return e===null?(xr(t),o===null?(Mr(t),Or(t,a,null,i,n)):(Mr(t),kr(t,o))):o?o===e.memoizedState?(Mr(t),t.flags&=-16777217):(xr(t),Mr(t),kr(t,o)):(o=e.memoizedProps,ho?o!==i&&xr(t):Dr(e,t,a,i),Mr(t),Or(t,a,o,i,n)),null}case 27:if(lc){if(oe(t),n=tl.current,a=t.type,e!==null&&t.stateNode!=null)ho?e.memoizedProps!==i&&xr(t):Dr(e,t,a,i);else{if(!i){if(t.stateNode===null)throw Error(r(166));return Mr(t),null}e=$c.current,le(t)?z(t,e):(e=uc(a,i,n,e,!0),t.stateNode=e,xr(t))}return Mr(t),null}case 5:if(oe(t),a=t.type,e!==null&&t.stateNode!=null)Dr(e,t,a,i);else{if(!i){if(t.stateNode===null)throw Error(r(166));return Mr(t),null}if(o=$c.current,le(t))z(t,o),Bs(t.stateNode,a,i,o)&&(t.flags|=64);else{var s=ao(a,i,tl.current,o,t);Sr(t),wr(s,t,!1,!1),t.stateNode=s,so(s,a,i,o)&&xr(t)}}return Mr(t),Or(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)n=e.memoizedProps,ho?n!==i&&xr(t):go&&(n===i?t.stateNode=e.stateNode:(e=tl.current,n=$c.current,Sr(t),t.stateNode=lo(i,e,n,t)));else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(e=tl.current,n=$c.current,le(t)){if(!_o)throw Error(r(176));if(e=t.stateNode,n=t.memoizedProps,i=null,a=rl,a!==null)switch(a.tag){case 27:case 5:i=a.memoizedProps}js(e,n,t,i)||se(t,!0)}else Sr(t),t.stateNode=lo(i,e,n,t)}return Mr(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=le(t),n!==null){if(e===null){if(!i)throw Error(r(318));if(!_o)throw Error(r(556));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(557));Ms(e,t)}else ue(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Mr(t),e=!1}else n=de(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(bt(t),t):(bt(t),null);if(t.flags&128)throw Error(r(558))}return Mr(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=le(t),i!==null&&i.dehydrated!==null){if(e===null){if(!a)throw Error(r(318));if(!_o)throw Error(r(344));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(r(317));Ns(a,t)}else ue(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Mr(t),a=!1}else a=de(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(bt(t),t):(bt(t),null)}return bt(t),t.flags&128?(t.lanes=n,t):(n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(i=t.child,a=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(a=i.alternate.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==a&&(i.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Ar(t,t.updateQueue),Mr(t),null);case 4:return ie(),Er(e,t),e===null&&yo(t.stateNode.containerInfo),Mr(t),null;case 10:return me(t.type),Mr(t),null;case 19:if(f(Kl),i=t.memoizedState,i===null)return Mr(t),null;if(a=!!(t.flags&128),o=i.rendering,o===null){if(a)jr(i,!1);else{if(zu!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=xt(e),o!==null){for(t.flags|=128,jr(i,!1),e=o.updateQueue,t.updateQueue=e,Ar(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)va(n,e),n=n.sibling;return p(Kl,Kl.current&1|2),al&&F(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&Oc()>Xu&&(t.flags|=128,a=!0,jr(i,!1),t.lanes=4194304)}}else{if(!a){if(e=xt(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Ar(t,e),jr(i,!0),i.tail===null&&i.tailMode===`hidden`&&!o.alternate&&!al)return Mr(t),null}else 2*Oc()-i.renderingStartTime>Xu&&n!==536870912&&(t.flags|=128,a=!0,jr(i,!1),t.lanes=4194304)}i.isBackwards?(o.sibling=t.child,t.child=o):(e=i.last,e===null?t.child=o:e.sibling=o,i.last=o)}return i.tail===null?(Mr(t),null):(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Oc(),e.sibling=null,n=Kl.current,p(Kl,a?n&1|2:n&1),al&&F(t,i.treeForkCount),e);case 22:case 23:return bt(t),ht(),i=t.memoizedState!==null,e===null?i&&(t.flags|=8192):e.memoizedState!==null!==i&&(t.flags|=8192),i?n&536870912&&!(t.flags&128)&&(Mr(t),t.subtreeFlags&6&&(t.flags|=8192)):Mr(t),n=t.updateQueue,n!==null&&Ar(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&f(Dl),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),me(hl),Mr(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Pr(e,t){switch(I(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return me(hl),ie(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return oe(t),null;case 31:if(t.memoizedState!==null){if(bt(t),t.alternate===null)throw Error(r(340));ue()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(bt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));ue()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return f(Kl),null;case 4:return ie(),null;case 10:return me(t.type),null;case 22:case 23:return bt(t),ht(),e!==null&&f(Dl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return me(hl),null;case 25:return null;default:return null}}function Fr(e,t){switch(I(t),t.tag){case 3:me(hl),ie();break;case 26:case 27:case 5:oe(t);break;case 4:ie();break;case 31:t.memoizedState!==null&&bt(t);break;case 13:bt(t);break;case 19:f(Kl);break;case 10:me(t.type);break;case 22:case 23:bt(t),ht(),e!==null&&f(Dl);break;case 24:me(hl)}}function Ir(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){ca(t,t.return,e)}}function Lr(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){ca(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){ca(t,t.return,e)}}function Rr(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{ft(t,n)}catch(t){ca(e,e.return,t)}}}function zr(e,t,n){n.props=Bn(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){ca(e,t,n)}}function Br(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=to(e.stateNode);break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){ca(e,t,n)}}function Vr(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){ca(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){ca(e,t,n)}else n.current=null}}function Hr(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{Jo(r,t,n,e)}catch(t){ca(e,e.return,t)}}function Ur(e,t,n){try{Yo(e.stateNode,e.type,n,t,e)}catch(t){ca(e,e.return,t)}}function Wr(e){return e.tag===5||e.tag===3||(Ys?e.tag===26:!1)||(lc?e.tag===27&&mc(e.type):!1)||e.tag===4}function Gr(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Wr(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(lc&&e.tag===27&&mc(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Kr(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?Zo(n,e,t):Ko(n,e);else if(r!==4&&(lc&&r===27&&mc(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Kr(e,t,n),e=e.sibling;e!==null;)Kr(e,t,n),e=e.sibling}function qr(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?Xo(n,e,t):Go(n,e);else if(r!==4&&(lc&&r===27&&mc(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(qr(e,t,n),e=e.sibling;e!==null;)qr(e,t,n),e=e.sibling}function Jr(e,t,n){e=e.containerInfo;try{us(e,n)}catch(e){ca(t,t.return,e)}}function Yr(e){var t=e.stateNode,n=e.memoizedProps;try{dc(e.type,n,t,e)}catch(t){ca(e,e.return,t)}}function Xr(e,t){for(io(e.containerInfo),gu=t;gu!==null;)if(e=gu,t=e.child,e.subtreeFlags&1028&&t!==null)t.return=e,gu=t;else for(;gu!==null;){e=gu;var n=e.alternate;switch(t=e.flags,e.tag){case 0:if(t&4&&(t=e.updateQueue,t=t===null?null:t.events,t!==null))for(var i=0;i<t.length;i++){var a=t[i];a.ref.impl=a.nextImpl}break;case 11:case 15:break;case 1:if(t&1024&&n!==null){t=void 0,i=e,a=n.memoizedProps,n=n.memoizedState;var o=i.stateNode;try{var s=Bn(i.type,a);t=o.getSnapshotBeforeUpdate(s,n),o.__reactInternalSnapshotBeforeUpdate=t}catch(e){ca(i,i.return,e)}}break;case 3:t&1024&&ho&&as(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,gu=t;break}gu=e.return}}function Zr(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:li(e,n),r&4&&Ir(5,n);break;case 1:if(li(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){ca(n,n.return,e)}else{var i=Bn(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){ca(n,n.return,e)}}}r&64&&Rr(n),r&512&&Br(n,n.return);break;case 3:if(li(e,n),r&64&&(r=n.updateQueue,r!==null)){if(e=null,n.child!==null)switch(n.child.tag){case 27:case 5:e=to(n.child.stateNode);break;case 1:e=n.child.stateNode}try{ft(r,e)}catch(e){ca(n,n.return,e)}}break;case 27:lc&&t===null&&r&4&&Yr(n);case 26:case 5:if(li(e,n),t===null){if(r&4)Hr(n);else if(r&64){e=n.type,t=n.memoizedProps,i=n.stateNode;try{Is(i,e,t,n)}catch(e){ca(n,n.return,e)}}}r&512&&Br(n,n.return);break;case 12:li(e,n);break;case 31:li(e,n),r&4&&ti(e,n);break;case 13:li(e,n),r&4&&ni(e,n),r&64&&(r=n.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(n=fa.bind(null,n),gs(r,n))));break;case 22:if(r=n.memoizedState!==null||fu,!r){t=t!==null&&t.memoizedState!==null||pu,i=fu;var a=pu;fu=r,(pu=t)&&!a?di(e,n,!!(n.subtreeFlags&8772)):li(e,n),fu=i,pu=a}break;case 30:break;default:li(e,n)}}function Qr(e){var t=e.alternate;t!==null&&(e.alternate=null,Qr(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&wo(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function $r(e,t,n){for(n=n.child;n!==null;)ei(e,t,n),n=n.sibling}function ei(e,t,n){if(Ic&&typeof Ic.onCommitFiberUnmount==`function`)try{Ic.onCommitFiberUnmount(Fc,n)}catch{}switch(n.tag){case 26:if(Ys){pu||Vr(n,t),$r(e,t,n),n.memoizedState?ec(n.memoizedState):n.stateNode&&rc(n.stateNode);break}case 27:if(lc){pu||Vr(n,t);var r=_u,i=vu;mc(n.type)&&(_u=n.stateNode,vu=!1),$r(e,t,n),fc(n.stateNode),_u=r,vu=i;break}case 5:pu||Vr(n,t);case 6:if(ho){if(r=_u,i=vu,_u=null,$r(e,t,n),_u=r,vu=i,_u!==null){if(vu)try{$o(_u,n.stateNode)}catch(e){ca(n,t,e)}else try{Qo(_u,n.stateNode)}catch(e){ca(n,t,e)}}}else $r(e,t,n);break;case 18:ho&&_u!==null&&(vu?Us(_u,n.stateNode):Hs(_u,n.stateNode));break;case 4:ho?(r=_u,i=vu,_u=n.stateNode.containerInfo,vu=!0,$r(e,t,n),_u=r,vu=i):(go&&Jr(n.stateNode,n,ss()),$r(e,t,n));break;case 0:case 11:case 14:case 15:Lr(2,n,t),pu||Lr(4,n,t),$r(e,t,n);break;case 1:pu||(Vr(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&zr(n,t,r)),$r(e,t,n);break;case 21:$r(e,t,n);break;case 22:pu=(r=pu)||n.memoizedState!==null,$r(e,t,n),pu=r;break;default:$r(e,t,n)}}function ti(e,t){if(_o&&t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Rs(e)}catch(e){ca(t,t.return,e)}}}function ni(e,t){if(_o&&t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{zs(e)}catch(e){ca(t,t.return,e)}}function ri(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new hu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new hu),t;default:throw Error(r(435,e.tag))}}function ii(e,t){var n=ri(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=pa.bind(null,e,t);t.then(r,r)}})}function ai(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i],o=e,s=t;if(ho){var c=s;a:for(;c!==null;){switch(c.tag){case 27:if(lc){if(mc(c.type)){_u=c.stateNode,vu=!1;break a}break}case 5:_u=c.stateNode,vu=!1;break a;case 3:case 4:_u=c.stateNode.containerInfo,vu=!0;break a}c=c.return}if(_u===null)throw Error(r(160));ei(o,s,a),_u=null,vu=!1}else ei(o,s,a);o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)oi(t,e),t=t.sibling}function oi(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ai(t,e),si(e),i&4&&(Lr(3,e,e.return),Ir(3,e),Lr(5,e,e.return));break;case 1:ai(t,e),si(e),i&512&&(pu||n===null||Vr(n,n.return)),i&64&&fu&&(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(Ys){var a=yu;if(ai(t,e),si(e),i&512&&(pu||n===null||Vr(n,n.return)),i&4){i=n===null?null:n.memoizedState;var o=e.memoizedState;n===null?o===null?e.stateNode===null?e.stateNode=tc(a,e.type,e.memoizedProps,e):nc(a,e.type,e.stateNode):e.stateNode=$s(a,o,e.memoizedProps):i===o?o===null&&e.stateNode!==null&&Ur(e,e.memoizedProps,n.memoizedProps):(i===null?n.stateNode!==null&&rc(n.stateNode):ec(i),o===null?nc(a,e.type,e.stateNode):$s(a,o,e.memoizedProps))}break}case 27:if(lc){ai(t,e),si(e),i&512&&(pu||n===null||Vr(n,n.return)),n!==null&&i&4&&Ur(e,e.memoizedProps,n.memoizedProps);break}case 5:if(ai(t,e),si(e),i&512&&(pu||n===null||Vr(n,n.return)),ho){if(e.flags&32){a=e.stateNode;try{es(a)}catch(t){ca(e,e.return,t)}}i&4&&e.stateNode!=null&&(a=e.memoizedProps,Ur(e,a,n===null?a:n.memoizedProps)),i&1024&&(mu=!0)}else go&&e.alternate!==null&&(e.alternate.stateNode=e.stateNode);break;case 6:if(ai(t,e),si(e),i&4&&ho){if(e.stateNode===null)throw Error(r(162));i=e.memoizedProps,n=n===null?i:n.memoizedProps,a=e.stateNode;try{qo(a,n,i)}catch(t){ca(e,e.return,t)}}break;case 3:if(Ys?(ac(),a=yu,yu=Zs(t.containerInfo),ai(t,e),yu=a):ai(t,e),si(e),i&4){if(ho&&_o&&n!==null&&n.memoizedState.isDehydrated)try{Ls(t.containerInfo)}catch(t){ca(e,e.return,t)}if(go){i=t.containerInfo,n=t.pendingChildren;try{us(i,n)}catch(t){ca(e,e.return,t)}}}mu&&(mu=!1,ci(e));break;case 4:Ys?(n=yu,yu=Zs(e.stateNode.containerInfo),ai(t,e),si(e),yu=n):(ai(t,e),si(e)),i&4&&go&&Jr(e.stateNode,e,e.stateNode.pendingChildren);break;case 12:ai(t,e),si(e);break;case 31:ai(t,e),si(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,ii(e,i)));break;case 13:ai(t,e),si(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Ju=Oc()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,ii(e,i)));break;case 22:a=e.memoizedState!==null;var s=n!==null&&n.memoizedState!==null,c=fu,l=pu;if(fu=c||a,pu=l||s,ai(t,e),pu=l,fu=c,si(e),i&8192&&(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||s||fu||pu||ui(e)),ho)){a:if(n=null,ho)for(t=e;;){if(t.tag===5||Ys&&t.tag===26){if(n===null){s=n=t;try{o=s.stateNode,a?ts(o):rs(s.stateNode,s.memoizedProps)}catch(e){ca(s,s.return,e)}}}else if(t.tag===6){if(n===null){s=t;try{var u=s.stateNode;a?ns(u):is(u,s.memoizedProps)}catch(e){ca(s,s.return,e)}}}else if(t.tag===18){if(n===null){s=t;try{var d=s.stateNode;a?Ws(d):Gs(s.stateNode)}catch(e){ca(s,s.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}}i&4&&(i=e.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,ii(e,n))));break;case 19:ai(t,e),si(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,ii(e,i)));break;case 30:break;case 21:break;default:ai(t,e),si(e)}}function si(e){var t=e.flags;if(t&2){try{for(var n,i=e.return;i!==null;){if(Wr(i)){n=i;break}i=i.return}if(ho){if(n==null)throw Error(r(160));switch(n.tag){case 27:if(lc){var a=n.stateNode;qr(e,Gr(e),a);break}case 5:var o=n.stateNode;n.flags&32&&(es(o),n.flags&=-33),qr(e,Gr(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Kr(e,Gr(e),s);break;default:throw Error(r(161))}}}catch(t){ca(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ci(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ci(t),t.tag===5&&t.flags&1024&&Po(t.stateNode),e=e.sibling}}function li(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Zr(e,t.alternate,t),t=t.sibling}function ui(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Lr(4,t,t.return),ui(t);break;case 1:Vr(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&zr(t,t.return,n),ui(t);break;case 27:lc&&fc(t.stateNode);case 26:case 5:Vr(t,t.return),ui(t);break;case 22:t.memoizedState===null&&ui(t);break;case 30:ui(t);break;default:ui(t)}e=e.sibling}}function di(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:di(i,a,n),Ir(4,a);break;case 1:if(di(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){ca(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)dt(c[i],s)}catch(e){ca(r,r.return,e)}}n&&o&64&&Rr(a),Br(a,a.return);break;case 27:lc&&Yr(a);case 26:case 5:di(i,a,n),n&&r===null&&o&4&&Hr(a),Br(a,a.return);break;case 12:di(i,a,n);break;case 31:di(i,a,n),n&&o&4&&ti(i,a);break;case 13:di(i,a,n),n&&o&4&&ni(i,a);break;case 22:a.memoizedState===null&&di(i,a,n),Br(a,a.return);break;case 30:break;default:di(i,a,n)}t=t.sibling}}function fi(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&we(n))}function pi(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&we(e))}function mi(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)hi(e,t,n,r),t=t.sibling}function hi(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:mi(e,t,n,r),i&2048&&Ir(9,t);break;case 1:mi(e,t,n,r);break;case 3:mi(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&we(e)));break;case 12:if(i&2048){mi(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){ca(t,t.return,e)}}else mi(e,t,n,r);break;case 31:mi(e,t,n,r);break;case 13:mi(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?mi(e,t,n,r):(a._visibility|=2,gi(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?mi(e,t,n,r):_i(e,t),i&2048&&fi(o,t);break;case 24:mi(e,t,n,r),i&2048&&pi(t.alternate,t);break;default:mi(e,t,n,r)}}function gi(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:gi(a,o,s,c,i),Ir(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,gi(a,o,s,c,i)):u._visibility&2?gi(a,o,s,c,i):_i(a,o),i&&l&2048&&fi(o.alternate,o);break;case 24:gi(a,o,s,c,i),i&&l&2048&&pi(o.alternate,o);break;default:gi(a,o,s,c,i)}t=t.sibling}}function _i(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:_i(n,r),i&2048&&fi(r.alternate,r);break;case 24:_i(n,r),i&2048&&pi(r.alternate,r);break;default:_i(n,r)}t=t.sibling}}function vi(e,t,n){if(e.subtreeFlags&bu)for(e=e.child;e!==null;)yi(e,t,n),e=e.sibling}function yi(e,t,n){switch(e.tag){case 26:if(vi(e,t,n),e.flags&bu){if(e.memoizedState!==null)cc(n,yu,e.memoizedState,e.memoizedProps);else{var r=e.stateNode,i=e.type;e=e.memoizedProps,((t&335544128)===t||Do(i,e))&&Ao(n,r,i,e)}}break;case 5:vi(e,t,n),e.flags&bu&&(r=e.stateNode,i=e.type,e=e.memoizedProps,((t&335544128)===t||Do(i,e))&&Ao(n,r,i,e));break;case 3:case 4:Ys?(r=yu,yu=Zs(e.stateNode.containerInfo),vi(e,t,n),yu=r):vi(e,t,n);break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=bu,bu=16777216,vi(e,t,n),bu=r):vi(e,t,n));break;default:vi(e,t,n)}}function bi(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function xi(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];gu=r,wi(r,e)}bi(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Si(e),e=e.sibling}function Si(e){switch(e.tag){case 0:case 11:case 15:xi(e),e.flags&2048&&Lr(9,e,e.return);break;case 3:xi(e);break;case 12:xi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ci(e)):xi(e);break;default:xi(e)}}function Ci(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];gu=r,wi(r,e)}bi(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Lr(8,t,t.return),Ci(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ci(t));break;default:Ci(t)}e=e.sibling}}function wi(e,t){for(;gu!==null;){var n=gu;switch(n.tag){case 0:case 11:case 15:Lr(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:we(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,gu=r;else a:for(n=e;gu!==null;){r=gu;var i=r.sibling,a=r.return;if(Qr(r),r===n){gu=null;break a}if(i!==null){i.return=a,gu=i;break a}gu=a}}}function Ti(e){var t=vo(e);if(t!=null){if(typeof t.memoizedProps[`data-testname`]!=`string`)throw Error(r(364));return t}if(e=Ro(e),e===null)throw Error(r(362));return e.stateNode.current}function Ei(e,t){var n=e.tag;switch(t.$$typeof){case Su:if(e.type===t.value)return!0;break;case Cu: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||!Vo(i)){for(;s!=null&&Ei(i,s);)o++,s=t[o];if(o===t.length){t=!0;break a}for(i=i.child;i!==null;)e.push(i,o),i=i.sibling}}t=!1}return t;case wu:if((n===5||n===26||n===27)&&Ho(e.stateNode,t.value))return!0;break;case Eu:if((n===5||n===6||n===26||n===27)&&(e=Bo(e),e!==null&&0<=e.indexOf(t.value)))return!0;break;case Tu:if((n===5||n===26||n===27)&&(e=e.memoizedProps[`data-testname`],typeof e==`string`&&e.toLowerCase()===t.value.toLowerCase()))return!0;break;default:throw Error(r(365))}return!1}function Di(e){switch(e.$$typeof){case Su:return`<`+(u(e.value)||`Unknown`)+`>`;case Cu:return`:has(`+(Di(e)||``)+`)`;case wu:return`[role="`+e.value+`"]`;case Eu:return`"`+e.value+`"`;case Tu:return`[data-testname="`+e.value+`"]`;default:throw Error(r(365))}}function Oi(e,t){var n=[];e=[e,0];for(var r=0;r<e.length;){var i=e[r++],a=i.tag,o=e[r++],s=t[o];if(a!==5&&a!==26&&a!==27||!Vo(i)){for(;s!=null&&Ei(i,s);)o++,s=t[o];if(o===t.length)n.push(i);else for(i=i.child;i!==null;)e.push(i,o),i=i.sibling}}return n}function ki(e,t){if(!Lo)throw Error(r(363));e=Ti(e),e=Oi(e,t),t=[],e=Array.from(e);for(var n=0;n<e.length;){var i=e[n++],a=i.tag;if(a===5||a===26||a===27)Vo(i)||t.push(i.stateNode);else for(i=i.child;i!==null;)e.push(i),i=i.sibling}return t}function Ai(){return ku&2&&Mu!==0?Mu&-Mu:Za.T===null?So():Pe()}function ji(){if(Uu===0){if(!(Mu&536870912)||al){var e=Sc;Sc<<=1,!(Sc&3932160)&&(Sc=262144),Uu=e}else Uu=536870912}return e=Wl.current,e!==null&&(e.flags|=32),Uu}function Mi(e,t,n){(e===Au&&(Nu===2||Nu===9)||e.cancelPendingCommit!==null)&&(zi(e,0),Ii(e,Mu,Uu,!1)),S(e,n),(!(ku&2)||e!==Au)&&(e===Au&&(!(ku&2)&&(Vu|=n),zu===4&&Ii(e,Mu,Uu,!1)),Ee(e))}function Ni(e,t,n){if(ku&6)throw Error(r(327));var i=!n&&!(t&127)&&(t&e.expiredLanes)===0||_(e,t),a=i?qi(e,t):Gi(e,t,!0),o=i;do{if(a===0){Iu&&!i&&Ii(e,t,0,!1);break}if(n=e.current.alternate,o&&!Fi(n)){a=Gi(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Gu;var l=_o&&c.current.memoizedState.isDehydrated;if(l&&(zi(c,s).flags|=256),s=Gi(c,s,!1),s!==2){if(Lu&&!l){c.errorRecoveryDisabledLanes|=o,Vu|=o,a=4;break a}o=Ku,Ku=a,o!==null&&(Ku===null?Ku=o:Ku.push.apply(Ku,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){zi(e,0),Ii(e,t,0,!0);break}a:{switch(i=e,o=a,o){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:Ii(i,t,Uu,!Fu);break a;case 2:Ku=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(a=Ju+300-Oc(),10<a)){if(Ii(i,t,Uu,!Fu),g(i,0,!0)!==0)break a;nd=t,i.timeoutHandle=uo(Pi.bind(null,i,n,Ku,Zu,qu,t,Uu,Vu,Wu,Fu,o,`Throttled`,-0,0),a);break a}Pi(i,n,Ku,Zu,qu,t,Uu,Vu,Wu,Fu,o,null,-0,0)}break}while(1);Ee(e)}function Pi(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=po,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d=ko(),yi(t,a,d);var m=(a&62914560)===a?Ju-Oc():(a&4194048)===a?Yu-Oc():0;if(m=jo(d,m),m!==null){nd=a,e.cancelPendingCommit=m(ea.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Ii(e,a,o,!l);return}}ea(e,t,a,n,r,i,o,s,c)}function Fi(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Lc(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ii(e,t,n,r){t&=~Hu,t&=~Vu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-vc(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&T(e,n,t)}function Li(){return ku&6?!0:(De(0,!1),!1)}function Ri(){if(ju!==null){if(Nu===0)var e=ju.return;else e=ju,dl=ul=null,At(e),Nl=null,Pl=0,e=ju;for(;e!==null;)Fr(e.alternate,e),e=e.return;ju=null}}function zi(e,t){var n=e.timeoutHandle;n!==po&&(e.timeoutHandle=po,fo(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),nd=0,Ri(),Au=e,ju=n=_a(e.current,null),Mu=t,Nu=0,Pu=null,Fu=!1,Iu=_(e,t),Lu=!1,Wu=Uu=Hu=Vu=Bu=zu=0,Ku=Gu=null,qu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-vc(r),a=1<<i;t|=e[i],r&=~a}return Ru=t,Ze(),n}function Bi(e,t){Jl=null,Za.H=iu,t===Ol||t===Al?(t=Ge(),Nu=3):t===kl?(t=Ge(),Nu=4):Nu=t===lu?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Pu=t,ju===null&&(zu=1,Vn(e,P(t,e.current)))}function Vi(){var e=Wl.current;return e===null?!0:(Mu&4194048)===Mu?Gl===null:(Mu&62914560)===Mu||Mu&536870912?e===Gl:!1}function Hi(){var e=Za.H;return Za.H=iu,e===null?iu:e}function Ui(){var e=Za.A;return Za.A=xu,e}function Wi(){zu=4,Fu||(Mu&4194048)!==Mu&&Wl.current!==null||(Iu=!0),!(Bu&134217727)&&!(Vu&134217727)||Au===null||Ii(Au,Mu,Uu,!1)}function Gi(e,t,n){var r=ku;ku|=2;var i=Hi(),a=Ui();(Au!==e||Mu!==t)&&(Zu=null,zi(e,t)),t=!1;var o=zu;a:do try{if(Nu!==0&&ju!==null){var s=ju,c=Pu;switch(Nu){case 8:Ri(),o=6;break a;case 3:case 2:case 9:case 6:Wl.current===null&&(t=!0);var l=Nu;if(Nu=0,Pu=null,Zi(e,s,c,l),n&&Iu){o=0;break a}break;default:l=Nu,Nu=0,Pu=null,Zi(e,s,c,l)}}Ki(),o=zu;break}catch(t){Bi(e,t)}while(1);return t&&e.shellSuspendCounter++,dl=ul=null,ku=r,Za.H=i,Za.A=a,ju===null&&(Au=null,Mu=0,Ze()),o}function Ki(){for(;ju!==null;)Yi(ju)}function qi(e,t){var n=ku;ku|=2;var i=Hi(),a=Ui();Au!==e||Mu!==t?(Zu=null,Xu=Oc()+500,zi(e,t)):Iu=_(e,t);a:do try{if(Nu!==0&&ju!==null){t=ju;var o=Pu;b:switch(Nu){case 1:Nu=0,Pu=null,Zi(e,t,o,1);break;case 2:case 9:if(He(o)){Nu=0,Pu=null,Xi(t);break}t=function(){Nu!==2&&Nu!==9||Au!==e||(Nu=7),Ee(e)},o.then(t,t);break a;case 3:Nu=7;break a;case 4:Nu=5;break a;case 7:He(o)?(Nu=0,Pu=null,Xi(t)):(Nu=0,Pu=null,Zi(e,t,o,7));break;case 5:var s=null;switch(ju.tag){case 26:s=ju.memoizedState;case 5:case 27:var c=ju,l=c.type,u=c.pendingProps;if(s?sc(s):Oo(c.stateNode,l,u)){Nu=0,Pu=null;var d=c.sibling;if(d!==null)ju=d;else{var f=c.return;f===null?ju=null:(ju=f,Qi(f))}break b}}Nu=0,Pu=null,Zi(e,t,o,5);break;case 6:Nu=0,Pu=null,Zi(e,t,o,6);break;case 8:Ri(),zu=6;break a;default:throw Error(r(462))}}Ji();break}catch(t){Bi(e,t)}while(1);return dl=ul=null,Za.H=i,Za.A=a,ku=n,ju===null?(Au=null,Mu=0,Ze(),zu):0}function Ji(){for(;ju!==null&&!Ec();)Yi(ju)}function Yi(e){var t=br(e.alternate,e,Ru);e.memoizedProps=e.pendingProps,t===null?Qi(e):ju=t}function Xi(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=ar(n,t,t.pendingProps,t.type,void 0,Mu);break;case 11:t=ar(n,t,t.pendingProps,t.type.render,t.ref,Mu);break;case 5:At(t);default:Fr(n,t),t=ju=va(t,Ru),t=br(n,t,Ru)}e.memoizedProps=e.pendingProps,t===null?Qi(e):ju=t}function Zi(e,t,n,r){dl=ul=null,At(t),Nl=null,Pl=0;var i=t.return;try{if(Kn(e,i,t,n,Mu)){zu=1,Vn(e,P(n,e.current)),ju=null;return}}catch(t){if(i!==null)throw ju=i,t;zu=1,Vn(e,P(n,e.current)),ju=null;return}t.flags&32768?(al||r===1?e=!0:Iu||Mu&536870912?e=!1:(Fu=e=!0,(r===2||r===9||r===3||r===6)&&(r=Wl.current,r!==null&&r.tag===13&&(r.flags|=16384))),$i(t,e)):Qi(t)}function Qi(e){var t=e;do{if(t.flags&32768){$i(t,Fu);return}e=t.return;var n=Nr(t.alternate,t,Ru);if(n!==null){ju=n;return}if(t=t.sibling,t!==null){ju=t;return}ju=t=e}while(t!==null);zu===0&&(zu=5)}function $i(e,t){do{var n=Pr(e.alternate,e);if(n!==null){n.flags&=32767,ju=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ju=e;return}ju=e=n}while(e!==null);zu=6,ju=null}function ea(e,t,n,i,a,o,s,c,l){e.cancelPendingCommit=null;do aa();while($u!==0);if(ku&6)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(o=t.lanes|t.childLanes,o|=zl,w(e,n,o,s,c,l),e===Au&&(ju=Au=null,Mu=0),td=t,ed=e,nd=n,rd=o,id=a,W=i,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,ma(jc,function(){return oa(),null})):(e.callbackNode=null,e.callbackPriority=0),i=!!(t.flags&13878),t.subtreeFlags&13878||i){i=Za.T,Za.T=null,a=xo(),bo(2),s=ku,ku|=4;try{Xr(e,t,n)}finally{ku=s,bo(a),Za.T=i}}$u=1,ta(),na(),ra()}}function ta(){if($u===1){$u=0;var e=ed,t=td,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=Za.T,Za.T=null;var r=xo();bo(2);var i=ku;ku|=4;try{oi(t,e),U(e.containerInfo)}finally{ku=i,bo(r),Za.T=n}}e.current=t,$u=2}}function na(){if($u===2){$u=0;var e=ed,t=td,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=Za.T,Za.T=null;var r=xo();bo(2);var i=ku;ku|=4;try{Zr(e,t.alternate,t)}finally{ku=i,bo(r),Za.T=n}}$u=3}}function ra(){if($u===4||$u===3){$u=0,Dc();var e=ed,t=td,n=nd,r=W;t.subtreeFlags&10256||t.flags&10256?$u=5:($u=0,td=ed=null,ia(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(Qu=null),ee(n),t=t.stateNode,Ic&&typeof Ic.onCommitFiberRoot==`function`)try{Ic.onCommitFiberRoot(Fc,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=Za.T,i=xo(),bo(2),Za.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{Za.T=t,bo(i)}}nd&3&&aa(),Ee(e),i=e.pendingLanes,n&261930&&i&42?e===od?ad++:(ad=0,od=e):ad=0,_o&&Vs(),De(0,!1)}}function ia(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,we(t)))}function aa(){return ta(),na(),ra(),oa()}function oa(){if($u!==5)return!1;var e=ed,t=rd;rd=0;var n=ee(nd),i=32>n?32:n;n=Za.T;var a=xo();try{bo(i),Za.T=null,i=id,id=null;var o=ed,s=nd;if($u=0,td=ed=null,nd=0,ku&6)throw Error(r(331));var c=ku;if(ku|=4,Si(o.current),hi(o,o.current,s,i),ku=c,De(0,!1),Ic&&typeof Ic.onPostCommitFiberRoot==`function`)try{Ic.onPostCommitFiberRoot(Fc,o)}catch{}return!0}finally{bo(a),Za.T=n,ia(e,t)}}function sa(e,t,n){t=P(n,t),t=Un(e.stateNode,t,2),e=ot(e,t,2),e!==null&&(S(e,2),Ee(e))}function ca(e,t,n){if(e.tag===3)sa(e,e,n);else for(;t!==null;){if(t.tag===3){sa(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Qu===null||!Qu.has(r))){e=P(n,e),n=Wn(2),r=ot(t,n,2),r!==null&&(Gn(n,r,t,e),S(r,2),Ee(r));break}}t=t.return}}function la(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ou;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)||(Lu=!0,i.add(n),e=ua.bind(null,e,t,n),t.then(e,e))}function ua(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Au===e&&(Mu&n)===n&&(zu===4||zu===3&&(Mu&62914560)===Mu&&300>Oc()-Ju?!(ku&2)&&zi(e,0):Hu|=n,Wu===Mu&&(Wu=0)),Ee(e)}function da(e,t){t===0&&(t=y()),e=et(e,t),e!==null&&(S(e,t),Ee(e))}function fa(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),da(e,n)}function pa(e,t){var n=0;switch(e.tag){case 31:case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(r(314))}i!==null&&i.delete(t),da(e,n)}function ma(e,t){return wc(e,t)}function ha(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ga(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _a(e,n){var r=e.alternate;return r===null?(r=t(e.tag,n,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=n,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,n=e.dependencies,r.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function va(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ya(e,n,i,a,o,s){var c=0;if(a=e,typeof e==`function`)ga(e)&&(c=1);else if(typeof e==`string`)c=Ys&&lc?Xs(e,i,$c.current)?26:pc(e)?27:5:Ys?Xs(e,i,$c.current)?26:5:lc&&pc(e)?27:5;else a:switch(e){case Ka:return e=t(31,i,n,o),e.elementType=Ka,e.lanes=s,e;case Ia:return ba(i.children,o,s,n);case La:c=8,o|=24;break;case Ra:return e=t(12,i,n,o|2),e.elementType=Ra,e.lanes=s,e;case Ha:return e=t(13,i,n,o),e.elementType=Ha,e.lanes=s,e;case Ua:return e=t(19,i,n,o),e.elementType=Ua,e.lanes=s,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case Ba:c=10;break a;case za:c=9;break a;case Va:c=11;break a;case Wa:c=14;break a;case Ga:c=16,a=null;break a}c=29,i=Error(r(130,e===null?`null`:typeof e,``)),a=null}return n=t(c,i,n,o),n.elementType=e,n.type=a,n.lanes=s,n}function ba(e,n,r,i){return e=t(7,e,i,n),e.lanes=r,e}function xa(e,n,r){return e=t(6,e,null,n),e.lanes=r,e}function Sa(e){var n=t(18,null,null,0);return n.stateNode=e,n}function Ca(e,n,r){return n=t(4,e.children===null?[]:e.children,e.key,n),n.lanes=r,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function wa(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=po,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=b(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=b(0),this.hiddenUpdates=b(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function Ta(e,n,r,i,a,o,s,c,l,u,d,f){return e=new wa(e,n,r,s,l,u,d,f,c),n=1,!0===o&&(n|=24),o=t(3,null,null,n),e.current=o,o.stateNode=e,n=Ce(),n.refCount++,e.pooledCache=n,n.refCount++,o.memoizedState={element:i,isDehydrated:r,cache:n},rt(o),e}function Ea(e){return e?(e=_c,e):_c}function Da(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=o(t),e=e===null?null:s(e),e===null?null:to(e.stateNode)}function Oa(e,t,n,r,i,a){i=Ea(i),r.context===null?r.context=i:r.pendingContext=i,r=at(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=ot(e,r,t),n!==null&&(Mi(n,e,t),st(n,e,t))}function ka(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Aa(e,t){ka(e,t),(e=e.alternate)&&ka(e,t)}var V={},ja=x(),Ma=C(),Na=Object.assign,Pa=Symbol.for(`react.element`),H=Symbol.for(`react.transitional.element`),Fa=Symbol.for(`react.portal`),Ia=Symbol.for(`react.fragment`),La=Symbol.for(`react.strict_mode`),Ra=Symbol.for(`react.profiler`),za=Symbol.for(`react.consumer`),Ba=Symbol.for(`react.context`),Va=Symbol.for(`react.forward_ref`),Ha=Symbol.for(`react.suspense`),Ua=Symbol.for(`react.suspense_list`),Wa=Symbol.for(`react.memo`),Ga=Symbol.for(`react.lazy`),Ka=Symbol.for(`react.activity`),qa=Symbol.for(`react.memo_cache_sentinel`),Ja=Symbol.iterator,Ya=Symbol.for(`react.client.reference`),Xa=Array.isArray,Za=ja.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Qa=e.rendererVersion,$a=e.rendererPackageName,eo=e.extraDevToolsConfig,to=e.getPublicInstance,no=e.getRootHostContext,ro=e.getChildHostContext,io=e.prepareForCommit,U=e.resetAfterCommit,ao=e.createInstance;e.cloneMutableInstance;var oo=e.appendInitialChild,so=e.finalizeInitialChildren,co=e.shouldSetTextContent,lo=e.createTextInstance;e.cloneMutableTextInstance;var uo=e.scheduleTimeout,fo=e.cancelTimeout,po=e.noTimeout,mo=e.isPrimaryRenderer;e.warnsIfNotActing;var ho=e.supportsMutation,go=e.supportsPersistence,_o=e.supportsHydration,vo=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var yo=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var bo=e.setCurrentUpdatePriority,xo=e.getCurrentUpdatePriority,So=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var Co=e.shouldAttemptEagerTransition,wo=e.detachDeletedInstance;e.requestPostPaintCallback;var To=e.maySuspendCommit,Eo=e.maySuspendCommitOnUpdate,Do=e.maySuspendCommitInSyncRender,Oo=e.preloadInstance,ko=e.startSuspendingCommit,Ao=e.suspendInstance;e.suspendOnActiveViewTransition;var jo=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var Mo=e.NotPendingTransition,No=e.HostTransitionContext,Po=e.resetFormInstance;e.bindToConsole;var Fo=e.supportsMicrotasks,Io=e.scheduleMicrotask,Lo=e.supportsTestSelectors,Ro=e.findFiberRoot,zo=e.getBoundingRect,Bo=e.getTextContent,Vo=e.isHiddenSubtree,Ho=e.matchAccessibilityRole,Uo=e.setFocusIfFocusable,Wo=e.setupIntersectionObserver,Go=e.appendChild,Ko=e.appendChildToContainer,qo=e.commitTextUpdate,Jo=e.commitMount,Yo=e.commitUpdate,Xo=e.insertBefore,Zo=e.insertInContainerBefore,Qo=e.removeChild,$o=e.removeChildFromContainer,es=e.resetTextContent,ts=e.hideInstance,ns=e.hideTextInstance,rs=e.unhideInstance,is=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 as=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var os=e.cloneInstance,ss=e.createContainerChildSet,cs=e.appendChildToContainerChildSet,ls=e.finalizeContainerChildren,us=e.replaceContainerChildren,ds=e.cloneHiddenInstance,fs=e.cloneHiddenTextInstance,ps=e.isSuspenseInstancePending,ms=e.isSuspenseInstanceFallback,hs=e.getSuspenseInstanceFallbackErrorDetails,gs=e.registerSuspenseInstanceRetry,_s=e.canHydrateFormStateMarker,vs=e.isFormStateMarkerMatching,ys=e.getNextHydratableSibling,bs=e.getNextHydratableSiblingAfterSingleton,xs=e.getFirstHydratableChild,Ss=e.getFirstHydratableChildWithinContainer,Cs=e.getFirstHydratableChildWithinActivityInstance,ws=e.getFirstHydratableChildWithinSuspenseInstance,Ts=e.getFirstHydratableChildWithinSingleton,Es=e.canHydrateInstance,Ds=e.canHydrateTextInstance,Os=e.canHydrateActivityInstance,ks=e.canHydrateSuspenseInstance,As=e.hydrateInstance,js=e.hydrateTextInstance,Ms=e.hydrateActivityInstance,Ns=e.hydrateSuspenseInstance,Ps=e.getNextHydratableInstanceAfterActivityInstance,Fs=e.getNextHydratableInstanceAfterSuspenseInstance,Is=e.commitHydratedInstance,Ls=e.commitHydratedContainer,Rs=e.commitHydratedActivityInstance,zs=e.commitHydratedSuspenseInstance,Bs=e.finalizeHydratedChildren,Vs=e.flushHydrationEvents;e.clearActivityBoundary;var Hs=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var Us=e.clearSuspenseBoundaryFromContainer,Ws=e.hideDehydratedBoundary,Gs=e.unhideDehydratedBoundary,Ks=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var qs=e.validateHydratableInstance,Js=e.validateHydratableTextInstance,Ys=e.supportsResources,Xs=e.isHostHoistableType,Zs=e.getHoistableRoot,Qs=e.getResource,$s=e.acquireResource,ec=e.releaseResource,tc=e.hydrateHoistable,nc=e.mountHoistable,rc=e.unmountHoistable,ic=e.createHoistableInstance,ac=e.prepareToCommitHoistables,oc=e.mayResourceSuspendCommit,sc=e.preloadResource,cc=e.suspendResource,lc=e.supportsSingletons,uc=e.resolveSingletonInstance,dc=e.acquireSingletonInstance,fc=e.releaseSingletonInstance,pc=e.isHostSingletonType,mc=e.isSingletonScope,hc=[],gc=-1,_c={},vc=Math.clz32?Math.clz32:m,yc=Math.log,bc=Math.LN2,xc=256,Sc=262144,Cc=4194304,wc=Ma.unstable_scheduleCallback,Tc=Ma.unstable_cancelCallback,Ec=Ma.unstable_shouldYield,Dc=Ma.unstable_requestPaint,Oc=Ma.unstable_now,kc=Ma.unstable_ImmediatePriority,Ac=Ma.unstable_UserBlockingPriority,jc=Ma.unstable_NormalPriority,Mc=Ma.unstable_IdlePriority,Nc=Ma.log,Pc=Ma.unstable_setDisableYieldValue,Fc=null,Ic=null,Lc=typeof Object.is==`function`?Object.is:A,Rc=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)},zc=Object.prototype.hasOwnProperty,Bc,Vc,Hc=!1,Uc=new WeakMap,Wc=[],Gc=0,Kc=null,qc=0,Jc=[],Yc=0,Xc=null,Zc=1,Qc=``,$c=d(null),el=d(null),tl=d(null),nl=d(null),rl=null,il=null,al=!1,ol=null,sl=!1,cl=Error(r(519)),ll=d(null),ul=null,dl=null,fl=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()})}},pl=Ma.unstable_scheduleCallback,ml=Ma.unstable_NormalPriority,hl={$$typeof:Ba,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},gl=null,_l=null,vl=!1,yl=!1,bl=!1,xl=0,Sl=null,Cl=0,wl=0,Tl=null,El=Za.S;Za.S=function(e,t){Yu=Oc(),typeof t==`object`&&t&&typeof t.then==`function`&&Fe(e,t),El!==null&&El(e,t)};var Dl=d(null),Ol=Error(r(460)),kl=Error(r(474)),Al=Error(r(542)),jl={then:function(){}},Ml=null,Nl=null,Pl=0,Fl=Xe(!0),Il=Xe(!1),Ll=[],Rl=0,zl=0,Bl=!1,Vl=!1,Hl=d(null),Ul=d(0),Wl=d(null),Gl=null,Kl=d(0),ql=0,Jl=null,Yl=null,Xl=null,Zl=!1,Ql=!1,$l=!1,eu=0,tu=0,nu=null,ru=0,iu={readContext:be,use:Ft,useCallback:St,useContext:St,useEffect:St,useImperativeHandle:St,useLayoutEffect:St,useInsertionEffect:St,useMemo:St,useReducer:St,useRef:St,useState:St,useDebugValue:St,useDeferredValue:St,useTransition:St,useSyncExternalStore:St,useId:St,useHostTransitionStatus:St,useFormState:St,useActionState:St,useOptimistic:St,useMemoCache:St,useCacheRefresh:St};iu.useEffectEvent=St;var au={readContext:be,use:Ft,useCallback:function(e,t){return jt().memoizedState=[e,t===void 0?null:t],e},useContext:be,useEffect:fn,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),un(4194308,4,vn.bind(null,t,e),n)},useLayoutEffect:function(e,t){return un(4194308,4,e,t)},useInsertionEffect:function(e,t){un(4,2,e,t)},useMemo:function(e,t){var n=jt();t=t===void 0?null:t;var r=e();if($l){k(!0);try{e()}finally{k(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=jt();if(n!==void 0){var i=n(t);if($l){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=jn.bind(null,Jl,e),[r.memoizedState,e]},useRef:function(e){var t=jt();return e={current:e},t.memoizedState=e},useState:function(e){e=qt(e);var t=e.queue,n=Mn.bind(null,Jl,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:bn,useDeferredValue:function(e,t){return Cn(jt(),e,t)},useTransition:function(){var e=qt(!1);return e=Tn.bind(null,Jl,e.queue,!0,!1),jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=Jl,a=jt();if(al){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Au===null)throw Error(r(349));Mu&127||Ht(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,fn(Wt.bind(null,i,o,e),[e]),i.flags|=2048,cn(9,{destroy:void 0},Ut.bind(null,i,o,n,t),null),n},useId:function(){var e=jt(),t=Au.identifierPrefix;if(al){var n=Qc,r=Zc;n=(r&~(1<<32-vc(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=eu++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=ru++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Dn,useFormState:nn,useActionState:nn,useOptimistic:function(e){var t=jt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Pn.bind(null,Jl,!0,n),n.dispatch=t,[e,t]},useMemoCache:It,useCacheRefresh:function(){return jt().memoizedState=An.bind(null,Jl)},useEffectEvent:function(e){var t=jt(),n={impl:e};return t.memoizedState=n,function(){if(ku&2)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},ou={readContext:be,use:Ft,useCallback:xn,useContext:be,useEffect:pn,useImperativeHandle:yn,useInsertionEffect:gn,useLayoutEffect:_n,useMemo:Sn,useReducer:Rt,useRef:ln,useState:function(){return Rt(Lt)},useDebugValue:bn,useDeferredValue:function(e,t){return wn(Mt(),Yl.memoizedState,e,t)},useTransition:function(){var e=Rt(Lt)[0],t=Mt().memoizedState;return[typeof e==`boolean`?e:Pt(e),t]},useSyncExternalStore:Vt,useId:On,useHostTransitionStatus:Dn,useFormState:rn,useActionState:rn,useOptimistic:function(e,t){return Jt(Mt(),Yl,e,t)},useMemoCache:It,useCacheRefresh:kn};ou.useEffectEvent=hn;var su={readContext:be,use:Ft,useCallback:xn,useContext:be,useEffect:pn,useImperativeHandle:yn,useInsertionEffect:gn,useLayoutEffect:_n,useMemo:Sn,useReducer:Bt,useRef:ln,useState:function(){return Bt(Lt)},useDebugValue:bn,useDeferredValue:function(e,t){var n=Mt();return Yl===null?Cn(n,e,t):wn(n,Yl.memoizedState,e,t)},useTransition:function(){var e=Bt(Lt)[0],t=Mt().memoizedState;return[typeof e==`boolean`?e:Pt(e),t]},useSyncExternalStore:Vt,useId:On,useHostTransitionStatus:Dn,useFormState:sn,useActionState:sn,useOptimistic:function(e,t){var n=Mt();return Yl===null?(n.baseState=e,[e,n.queue.dispatch]):Jt(n,Yl,e,t)},useMemoCache:It,useCacheRefresh:kn};su.useEffectEvent=hn;var cu={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ai(),i=at(r);i.payload=t,n!=null&&(i.callback=n),t=ot(e,i,r),t!==null&&(Mi(t,e,r),st(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ai(),i=at(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=ot(e,i,r),t!==null&&(Mi(t,e,r),st(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ai(),r=at(n);r.tag=2,t!=null&&(r.callback=t),t=ot(e,r,n),t!==null&&(Mi(t,e,n),st(t,e,n))}},lu=Error(r(461)),uu=!1,du={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},fu=!1,pu=!1,mu=!1,hu=typeof WeakSet==`function`?WeakSet:Set,gu=null,_u=null,vu=!1,yu=null,bu=8192,xu={getCacheForType:function(e){var t=be(hl),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return be(hl).controller.signal}},Su=0,Cu=1,wu=2,Tu=3,Eu=4;if(typeof Symbol==`function`&&Symbol.for){var Du=Symbol.for;Su=Du(`selector.component`),Cu=Du(`selector.has_pseudo_class`),wu=Du(`selector.role`),Tu=Du(`selector.test_id`),Eu=Du(`selector.text`)}var Ou=typeof WeakMap==`function`?WeakMap:Map,ku=0,Au=null,ju=null,Mu=0,Nu=0,Pu=null,Fu=!1,Iu=!1,Lu=!1,Ru=0,zu=0,Bu=0,Vu=0,Hu=0,Uu=0,Wu=0,Gu=null,Ku=null,qu=!1,Ju=0,Yu=0,Xu=1/0,Zu=null,Qu=null,$u=0,ed=null,td=null,nd=0,rd=0,id=null,W=null,ad=0,od=null;return V.attemptContinuousHydration=function(e){if(e.tag===13||e.tag===31){var t=et(e,67108864);t!==null&&Mi(t,e,67108864),Aa(e,67108864)}},V.attemptHydrationAtCurrentPriority=function(e){if(e.tag===13||e.tag===31){var t=Ai();t=O(t);var n=et(e,t);n!==null&&Mi(n,e,t),Aa(e,t)}},V.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-vc(t);e.entanglements[1]|=n,t&=~n}Ee(e),!(ku&6)&&(Xu=Oc()+500,De(0,!1))}}break;case 31:case 13:t=et(e,2),t!==null&&Mi(t,e,2),Li(),Aa(e,2)}},V.batchedUpdates=function(e,t){return e(t)},V.createComponentSelector=function(e){return{$$typeof:Su,value:e}},V.createContainer=function(e,t,n,r,i,a,o,s,c,l){return Ta(e,t,!1,null,n,r,a,null,o,s,c,l)},V.createHasPseudoClassSelector=function(e){return{$$typeof:Cu,value:e}},V.createHydrationContainer=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p){return e=Ta(n,r,!0,e,i,a,s,p,c,l,u,d),e.context=Ea(null),n=e.current,r=Ai(),r=O(r),i=at(r),i.callback=t??null,ot(n,i,r),t=r,e.current.lanes=t,S(e,t),Ee(e),e},V.createPortal=function(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Fa,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}},V.createRoleSelector=function(e){return{$$typeof:wu,value:e}},V.createTestNameSelector=function(e){return{$$typeof:Tu,value:e}},V.createTextSelector=function(e){return{$$typeof:Eu,value:e}},V.defaultOnCaughtError=function(e){console.error(e)},V.defaultOnRecoverableError=function(e){Rc(e)},V.defaultOnUncaughtError=function(e){Rc(e)},V.deferredUpdates=function(e){var t=Za.T,n=xo();try{return bo(32),Za.T=null,e()}finally{bo(n),Za.T=t}},V.discreteUpdates=function(e,t,n,r,i){var a=Za.T,o=xo();try{return bo(2),Za.T=null,e(t,n,r,i)}finally{bo(o),Za.T=a,ku===0&&(Xu=Oc()+500)}},V.findAllNodes=ki,V.findBoundingRects=function(e,t){if(!Lo)throw Error(r(363));t=ki(e,t),e=[];for(var n=0;n<t.length;n++)e.push(zo(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},V.findHostInstance=Da,V.findHostInstanceWithNoPortals=function(e){return e=o(e),e=e===null?null:c(e),e===null?null:to(e.stateNode)},V.findHostInstanceWithWarning=function(e){return Da(e)},V.flushPassiveEffects=aa,V.flushSyncFromReconciler=function(e){var t=ku;ku|=1;var n=Za.T,r=xo();try{if(bo(2),Za.T=null,e)return e()}finally{bo(r),Za.T=n,ku=t,!(ku&6)&&De(0,!1)}},V.flushSyncWork=Li,V.focusWithin=function(e,t){if(!Lo)throw Error(r(363));for(e=Ti(e),t=Oi(e,t),t=Array.from(t),e=0;e<t.length;){var n=t[e++],i=n.tag;if(!Vo(n)){if((i===5||i===26||i===27)&&Uo(n.stateNode))return!0;for(n=n.child;n!==null;)t.push(n),n=n.sibling}}return!1},V.getFindAllNodesFailureDescription=function(e,t){if(!Lo)throw Error(r(363));var n=0,i=[];e=[Ti(e),0];for(var a=0;a<e.length;){var o=e[a++],s=o.tag,c=e[a++],l=t[c];if((s!==5&&s!==26&&s!==27||!Vo(o))&&(Ei(o,l)&&(i.push(Di(l)),c++,c>n&&(n=c)),c<t.length))for(o=o.child;o!==null;)e.push(o,c),o=o.sibling}if(n<t.length){for(e=[];n<t.length;n++)e.push(Di(t[n]));return`findAllNodes was able to match part of the selector:
|
|
84
|
+
`+(i.join(` > `)+`
|
|
85
|
+
|
|
86
|
+
No matching component was found for:
|
|
87
|
+
`)+e.join(` > `)}return null},V.getPublicRootInstance=function(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 27:case 5:return to(e.child.stateNode);default:return e.child.stateNode}},V.injectIntoDevTools=function(){var e={bundleType:0,version:Qa,rendererPackageName:$a,currentDispatcherRef:Za,reconcilerVersion:`19.2.0`};if(eo!==null&&(e.rendererConfig=eo),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{Fc=t.inject(e),Ic=t}catch{}e=!!t.checkDCE}}return e},V.isAlreadyRendering=function(){return!!(ku&6)},V.observeVisibleRects=function(e,t,n,i){if(!Lo)throw Error(r(363));e=ki(e,t);var a=Wo(e,n,i).disconnect;return{disconnect:function(){a()}}},V.shouldError=function(){return null},V.shouldSuspend=function(){return!1},V.startHostTransition=function(e,t,i,a){if(e.tag!==5)throw Error(r(476));var o=En(e).queue;Tn(e,o,t,Mo,i===null?n:function(){var t=En(e);return t.next===null&&(t=e.alternate.memoizedState),Nn(e,t.next.queue,{},Ai()),i(a)})},V.updateContainer=function(e,t,n,r){var i=t.current,a=Ai();return Oa(i,a,e,t,n,r),a},V.updateContainerSync=function(e,t,n,r){return Oa(t.current,2,e,t,n,r),2},V},t.exports.default=t.exports,Object.defineProperty(t.exports,"__esModule",{value:!0})})),np=n(((e,t)=>{t.exports=tp()})),rp=n((e=>{e.ConcurrentRoot=1,e.DefaultEventPriority=32,e.DiscreteEventPriority=2})),ip=n(((e,t)=>{t.exports=rp()})),ap=t(np()),op=ip(),sp={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0},cp=!1,lp=!1,up=`.react-konva-event`,dp=!1,fp=`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
|
+
`,pp=`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
|
+
`,mp={},hp=()=>{};function gp(e){hp=e}var _p=!1;function vp(e){return function(...t){let n=e.apply(this,t);if(!_p){_p=!0;try{hp()}finally{_p=!1}}return n}}function yp(e,t,n=mp){if(!cp&&`zIndex`in t&&(console.warn(pp),cp=!0),!lp&&t.draggable){var r=t.x!==void 0||t.y!==void 0,i=t.onDragEnd||t.onDragMove;r&&!i&&(console.warn(fp),lp=!0)}for(var a in n)if(!sp[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+up)}t.hasOwnProperty(a)||e.setAttr(a,void 0)}var l=dp||t._useStrictMode,u={},d=!1;let f={};for(var a in t)if(!sp[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),bp(e)),f)e.off(c+up),e.on(c+up,vp(f[c]))}function bp(e){if(!i.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}var xp=e({HostTransitionContext:()=>Sm,NotPendingTransition:()=>null,afterActiveInstanceBlur:()=>am,appendChild:()=>Hp,appendChildToContainer:()=>Up,appendInitialChild:()=>Tp,beforeActiveInstanceBlur:()=>im,cancelTimeout:()=>zp,clearContainer:()=>tm,commitMount:()=>Yp,commitTextUpdate:()=>Jp,commitUpdate:()=>Xp,createInstance:()=>Ep,createTextInstance:()=>Dp,detachDeletedInstance:()=>nm,finalizeInitialChildren:()=>Op,getChildHostContext:()=>Lp,getCurrentEventPriority:()=>om,getCurrentUpdatePriority:()=>um,getInstanceFromNode:()=>rm,getInstanceFromScope:()=>cm,getPublicInstance:()=>kp,getRootHostContext:()=>Ip,hideInstance:()=>Zp,hideTextInstance:()=>Qp,idlePriority:()=>wf.unstable_IdlePriority,insertBefore:()=>Wp,insertInContainerBefore:()=>Gp,isPrimaryRenderer:()=>!1,maySuspendCommit:()=>_m,noTimeout:()=>-1,now:()=>wf.unstable_now,preloadInstance:()=>vm,prepareForCommit:()=>Ap,preparePortalMount:()=>jp,prepareScopeUpdate:()=>sm,prepareUpdate:()=>Mp,removeChild:()=>Kp,removeChildFromContainer:()=>qp,requestPostPaintCallback:()=>gm,resetAfterCommit:()=>Np,resetFormInstance:()=>Cm,resetTextContent:()=>Pp,resolveEventTimeStamp:()=>hm,resolveEventType:()=>mm,resolveUpdatePriority:()=>dm,run:()=>wf.unstable_runWithPriority,scheduleMicrotask:()=>Bp,scheduleTimeout:()=>Rp,setCurrentUpdatePriority:()=>lm,shouldAttemptEagerTransition:()=>fm,shouldDeprioritizeSubtree:()=>Fp,shouldSetTextContent:()=>Vp,startSuspendingCommit:()=>ym,supportsHydration:()=>!1,supportsMicrotasks:()=>!0,supportsMutation:()=>!0,supportsPersistence:()=>!1,suspendInstance:()=>bm,trackSchedulerEvent:()=>pm,unhideInstance:()=>$p,unhideTextInstance:()=>em,waitForCommitToBeReady:()=>xm,warnsIfNotActing:()=>!1}),Sp={},Cp={};ep.Node.prototype._applyProps=yp;var wp=op.DefaultEventPriority;function Tp(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),bp(e)}function Ep(e,t,n){let r=ep[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`),ep.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 yp(s,a),s}function Dp(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function Op(e,t,n){return!1}function kp(e){return e}function Ap(){return null}function jp(){return null}function Mp(e,t,n,r){return Cp}function Np(){}function Pp(e){}function Fp(e,t){return!1}function Ip(){return Sp}function Lp(){return Sp}var Rp=setTimeout,zp=clearTimeout,Bp=typeof queueMicrotask==`function`?queueMicrotask:e=>Promise.resolve(null).then(e);function Vp(e,t){return!1}function Hp(e,t){t.parent===e?t.moveToTop():e.add(t),bp(e)}function Up(e,t){t.parent===e?t.moveToTop():e.add(t),bp(e)}function Wp(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),bp(e)}function Gp(e,t,n){Wp(e,t,n)}function Kp(e,t){t.destroy(),t.off(up),bp(e)}function qp(e,t){t.destroy(),t.off(up),bp(e)}function Jp(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function Yp(e,t,n){}function Xp(e,t,n,r){yp(e,r,n)}function Zp(e){e.hide(),bp(e)}function Qp(e){}function $p(e,t){(t.visible==null||t.visible)&&e.show()}function em(e,t){}function tm(e){}function nm(){}function rm(){return null}function im(){}function am(){}function om(){return op.DefaultEventPriority}function sm(){}function cm(){return null}function lm(e){wp=e}function um(){return wp}function dm(){return op.DiscreteEventPriority}function fm(){return!1}function pm(){}function mm(){return null}function hm(){return-1.1}function gm(){}function _m(){return!1}function vm(){return!0}function ym(){}function bm(){}function xm(){return null}var Sm=k.createContext(null);function Cm(){}typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`)?k.useLayoutEffect:k.useEffect;function wm(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){let e=wm(r,t,n);if(e)return e;r=t?null:r.sibling}}function Tm(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}var Em=Tm(k.createContext(null)),Dm=class extends k.Component{render(){return k.createElement(Em.Provider,{value:this._reactInternals},this.props.children)}};function Om(){let e=k.useContext(Em);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=wm(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 km=Symbol.for(`react.context`),Am=e=>typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===km;function jm(){let e=Om(),[t]=k.useState(()=>new Map);t.clear();let n=e;for(;n;){let e=n.type;Am(e)&&e!==Em&&!t.has(e)&&t.set(e,k.use(Tm(e))),n=n.return}return t}function Mm(){let e=jm();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(Dm,{...e})),[e])}function Nm(e){let t=k.useRef({});return k.useLayoutEffect(()=>{t.current=e}),k.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}var Pm=()=>{let e=k.useRef(0);return k.useMemo(()=>{e.current++},[]),e.current>1},Fm=e=>{let t=k.useRef(null),n=k.useRef(null),r=k.useRef(null),i=Nm(e),a=Mm(),o=k.useRef(null),s=t=>{let{forwardedRef:n}=e;n&&(typeof n==`function`?n(t):n.current=t)},c=Pm(),l=()=>{s(null),Jm.flushSyncFromReconciler(()=>{Jm.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 ep.Stage({width:e.width,height:e.height,container:t.current}),s(n.current),r.current=Jm.createContainer(n.current,op.ConcurrentRoot,null,!1,null,``,console.error,console.error,console.error,null),Jm.updateContainer(k.createElement(a,{},e.children),r.current,null,()=>{})),()=>{c?o.current=setTimeout(l,0):l()}),[]),k.useLayoutEffect(()=>{s(n.current),yp(n.current,e,i),Jm.updateContainer(k.createElement(a,{},e.children),r.current,null),Jm.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})},Im=`Layer`,Lm=`Group`,Rm=`Label`,zm=`Rect`,Bm=`Circle`,Vm=`Line`,Hm=`Image`,Um=`Text`,Wm=`TextPath`,Gm=`Path`,Km=`Shape`,qm=`Transformer`,Jm=(0,ap.default)(xp);gp(()=>Jm.flushSyncWork());var Ym=k.forwardRef((e,t)=>k.createElement(Dm,{},k.createElement(Fm,{...e,forwardedRef:t}))),Xm=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]}}))()),Zm=20,Qm=new s.Group;Qm.add(new s.Rect({width:Zm,height:Zm,fill:`white`})),Qm.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 $m=Qm.toCanvas({pixelRatio:2,width:Zm,height:Zm}),eh={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:$m,fillPatternScaleX:20/Zm/2,fillPatternScaleY:20/Zm/2,fillPriority:`pattern`,fillPatternRepeat:`no-repeat`})}},th={anchorFill:`rgb(240, 240, 240)`,anchorStrokeWidth:2,borderStrokeWidth:2},nh={anchorSize:20,anchorCornerRadius:10,anchorStrokeWidth:2,borderStrokeWidth:2},rh={stroke:`rgb(0, 161, 255)`,strokeWidth:2},ih={stroke:`rgb(0, 161, 255)`,strokeWidth:1,dash:[4,6]},ah={fill:`rgba(0, 161, 255, 0.3)`,stroke:`rgb(0, 161, 255)`,strokeWidth:1},oh={fill:`rgb(0, 161, 255)`,textFill:`white`},sh={stroke:`rgb(0, 161, 255)`,labelFill:`rgb(0, 161, 255)`,labelTextFill:`white`},ch={fill:`rgba(124, 173, 212, 0.8)`,textFill:`white`},lh={fill:`rgba(223, 102, 102, 0.8)`,textFill:`white`},uh={stroke:`red`},dh={backgroundColor:`#e8e8e8`,textColor:`grey`,borderColor:`grey`,borderSize:1,tickColor:`grey`,tickSize:1},fh=`rgba(255, 0, 0, 0.1)`;function ph(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 mh(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??fh,transparencyBackgroundColor:e.transparencyBackgroundColor,transformerStyle:ph(eh,e.transformerStyle),innerImageCropTransformerStyle:ph(th,e.innerImageCropTransformerStyle),outerImageCropTransformerStyle:ph(nh,e.outerImageCropTransformerStyle),highlighterStyle:ph(rh,e.highlighterStyle),snapGuideStyle:ph(ih,{stroke:e.snapGuideStroke,strokeWidth:e.snapGuideStrokeWidth,dash:e.snapGuideDash}),selectionRectStyle:ph(ah,{fill:e.selectionRectFill,stroke:e.selectionRectStroke,strokeWidth:e.selectionRectStrokeWidth}),transformLabelStyle:ph(oh,{fill:e.transformLabelFill,textFill:e.transformLabelTextFill}),distanceGuideStyle:ph(sh,{stroke:e.distanceGuideStroke,labelFill:e.distanceLabelFill,labelTextFill:e.distanceLabelTextFill}),mediaLoadingStyle:ph(ch,e.mediaLoadingStyle),mediaErrorStyle:ph(lh,e.mediaErrorStyle),textOverflowIndicatorStyle:ph(uh,e.textOverflowIndicatorStyle),rulerStyle:ph(dh,{backgroundColor:e.rulerBackgroundColor,textColor:e.rulerTextColor,borderColor:e.rulerBorderColor,borderSize:e.rulerBorderSize,tickColor:e.rulerTickColor,tickSize:e.rulerTickSize})}}var hh=k.createContext(null),gh=hh.Provider;function _h(){return k.useContext(hh)||mh()}var vh=0,yh=new Set;function bh(e){return yh.add(e),()=>{yh.delete(e)}}function xh(){return vh}function Sh(e){let t=k.useSyncExternalStore(bh,xh,xh),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(!Ch(e[r],t[r]))return!1;return!0}(n.current.overrides,e)||(n.current={overrides:e,revision:t,resolved:mh(e)}),n.current.resolved}function Ch(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 wh=`warn`;function Th(e){wh=e}function Eh(){return wh}var Dh;(function(e){e.afterCreate=`afterCreate`,e.afterAttach=`afterAttach`,e.afterCreationFinalization=`afterCreationFinalization`,e.beforeDetach=`beforeDetach`,e.beforeDestroy=`beforeDestroy`})(Dh||={});var Oh=function(e,t){return Oh=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])},Oh(e,t)};function kh(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);Oh(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Ah=function(){return Ah=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},Ah.apply(this,arguments)};function jh(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 Mh(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 Nh(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 Ph(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 Fh(e){return qg(e,1),Jg(e).type}function Ih(e,t){return qg(e,1),k_(t,2),Jg(e).onSnapshot(t)}function Lh(e,t){qg(e,1),O_(t,function(e){return typeof e==`object`},`object or array`,2),Jg(e).applyPatches(l_(t))}function Rh(e,t){return qg(e,1),Jg(e).applySnapshot(t)}function zh(e,t){t===void 0&&(t=!0),qg(e,1);var n=Jg(e);return t?n.snapshot:m_(n.type.getSnapshot(n,!1))}function Bh(e,t){t===void 0&&(t=1),qg(e,1),A_(t,2,0);for(var n=t,r=Jg(e).parent;r;){if(--n===0)return r.storedValue;r=r.parent}throw new K(`Failed to find the parent of ${Jg(e)} at depth ${t}`)}function Vh(e,t){qg(e,1),hg(t,2);for(var n=Jg(e).parent;n;){if(t.is(n.storedValue))return!0;n=n.parent}return!1}function Hh(e,t){qg(e,1),hg(t,2);for(var n=Jg(e).parent;n;){if(t.is(n.storedValue))return n.storedValue;n=n.parent}throw new K(`Failed to find the parent of ${Jg(e)} of a given type`)}function Uh(e){return qg(e,1),Jg(e).root.storedValue}function Wh(e){return qg(e,1),Jg(e).path}function Gh(e,t){qg(e,1),j_(t,2);var n=Zg(Jg(e),t);return n?n.value:void 0}function Kh(e){return qg(e,1),Jg(e).identifier}function qh(e){return qg(e,1),Jg(e).detach(),e}function Jh(e){qg(e,1);var t=Jg(e);t.isRoot?t.die():t.parent.removeChild(t.subpath)}function Yh(e){return qg(e,1),Jg(e).observableIsAlive}function Xh(e){return e}var Zh=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:Gg.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 x_,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||=Ye(`path`),this.pathAtom.reportObserved()),this.parent?(this._escapedSubpath===void 0&&(this._escapedSubpath=this._subpath?L_(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!==Gg.DEAD},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDetaching",{get:function(){return this.state===Gg.DETACHING},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"observableIsAlive",{get:function(){return this.aliveAtom||=Ye(`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(D_()&&!this.isAlive)throw new K(`assertion failed: cannot finalize the creation of a node that is already dead`);if(this.state===Gg.CREATED){if(this.parent){if(this.parent.state!==Gg.FINALIZED)return;this.fireHook(Dh.afterAttach)}this.state=Gg.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=Gg.DEAD}}),Object.defineProperty(e.prototype,"baseAboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.fireHook(Dh.beforeDestroy)}}),e}(),Qh=function(e){kh(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=Gg.DEAD,e}return o.state=Gg.CREATED,o.finalizeCreation(),o}return Object.defineProperty(t.prototype,"root",{get:function(){if(!this.parent)throw new K(`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(D_()){if(!t)throw new K(`assertion failed: subpath expected`);if(!e)throw new K(`assertion failed: parent expected`);if(n)throw new K(`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 m_(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===Gg.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}(Zh);Qh.prototype.die=dr(Qh.prototype.die);var $h=1,eg;(function(e){e[e.UNINITIALIZED=0]=`UNINITIALIZED`,e[e.CREATING=1]=`CREATING`,e[e.CREATED=2]=`CREATED`})(eg||={});var tg;(function(e){e.Dispose=`dispose`,e.Patch=`patch`,e.Snapshot=`snapshot`})(tg||={});var ng={onError:function(e){throw e}},rg=function(e){kh(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:++$h}),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:eg.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=tn(function(){return m_(o.getSnapshot())}),o.unbox=o.unbox.bind(o),o._initialSnapshot=m_(a),o.identifierAttribute=t.identifierAttribute,n||(o.identifierCache=new Vg),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 K(`Instance identifier '${o.identifierAttribute}' for type '${o.type.name}' must be a string, a number or a bigint`);o.identifier=fy(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===eg.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),D_()&&this.state!==Gg.INITIALIZING)throw new K(`assertion failed: the creation of the observable instance must be done on the initializing phase`);this._observableInstanceState=eg.CREATING;for(var a=[],o=this.parent;o&&o._observableInstanceState===eg.UNINITIALIZED;)a.unshift(o),o=o.parent;try{for(var s=Mh(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=Gg.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=eg.CREATED,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=n_,this.state=Gg.CREATED,e){this.fireHook(Dh.afterCreate),this.finalizeCreation();try{for(var d=Mh(a.reverse()),f=d.next();!f.done;f=d.next()){var l=f.value;l.fireHook(Dh.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(Dh.beforeDetach);var e=this.state;this.state=Gg.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(D_()){if(!t)throw new K(`assertion failed: subpath expected`);if(!e)throw new K(`assertion failed: new parent expected`);if(this.parent&&n)throw new K(`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 K(`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 K(`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(Dh.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`&&(pr?pr(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===eg.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=Eh();if(!this.isAlive&&t!==`ignore`){var n=this._getAssertAliveError(e);switch(t){case`error`:throw new K(n);case`warn`:T_(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&&L_(e.subpath)||``,r=e.actionContext||vg();r&&r.type!==`action`&&r.parentActionEvent&&(r=r.parentActionEvent);var i=``;return r&&r.name!=null&&(i=`${r&&r.context&&Wh(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===eg.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(n_),this._autoUnbox=!1;try{return this._observableInstanceState===eg.CREATED?this.type.getChildren(this):$g(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 K(`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=Mh(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(Dh.afterCreationFinalization)})}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw new K(`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=Sg(this.storedValue,`@APPLY_PATCHES`,function(t){t.forEach(function(t){if(!t.path){e.type.applySnapshot(e,t.value);return}var n=B_(t.path);Qg(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)})}),this._applySnapshot=Sg(this.storedValue,`@APPLY_SNAPSHOT`,function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)}),v_(this.storedValue,`$treenode`,this),v_(this.storedValue,`toJSON`,Xg)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){!this.isAlive||this.state===Gg.DETACHING||(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._observableInstanceState!==eg.UNINITIALIZED&&(this.getChildren().forEach(function(e){e.aboutToDie()}),this.baseAboutToDie(),this._internalEventsEmit(tg.Dispose),this._internalEventsClear(tg.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(tg.Snapshot,e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit(tg.Snapshot,e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister(tg.Patch,e)}}),Object.defineProperty(t.prototype,"hasPatchSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._internalEventsHasSubscribers(tg.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(tg.Patch)){var n=Nh(N_(u_({},e,{path:t.path.substr(this.path.length)+(e.path?`/`+e.path:``)})),2),r=n[0],i=n[1];this._internalEventsEmit(tg.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(tg.Dispose,e)}}),Object.defineProperty(t.prototype,"addDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this.hasDisposer(e)){this._internalEventsRegister(tg.Dispose,e,!0);return}throw new K(`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(tg.Dispose,e))throw new K(`cannot remove a disposer which was never registered for execution`);this._internalEventsUnregister(tg.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=vr(function(){return e.snapshot},function(t){return e.emitSnapshot(t)},ng);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 x_,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,Ph([e],Nh(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}(Zh);rg.prototype.createObservableInstance=dr(rg.prototype.createObservableInstance),rg.prototype.detach=dr(rg.prototype.detach),rg.prototype.die=dr(rg.prototype.die);var ig,ag;(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`})(ag||={});var og=`cannotDetermine`,sg=Symbol(`$type`),cg=function(){function e(e){Object.defineProperty(this,ig,{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 Lg(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 K(`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(Yg(e)){var n=Fh(e);return this.isAssignableFrom(n)?Pg():Fg(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 K("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 K("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 K("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 K("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}();ig=sg,cg.prototype.create=dr(cg.prototype.create);var lg=function(e){kh(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===fy(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||Kg(t)&&Jg(t)===e?!0:e.type===this&&f_(t)&&!Kg(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(),Kg(t)&&this.isAssignableFrom(Fh(t))){var i=Jg(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}(cg);lg.prototype.create=dr(lg.prototype.create);var ug=function(e){kh(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}(cg);function dg(e,t,n){var r=t.getReconciliationType(),i=r===fg(e);return t instanceof rg&&i&&r instanceof lg&&f_(n)&&!Kg(n)&&r.isMatchingSnapshotId(t,n)}function fg(e){var t=e.getSubTypes();return!t||Array.isArray(t)||t===og||!pg(e)?e:fg(t)}function pg(e){var t=ag.Optional|ag.Late,n=ag.Refinement|ag.SnapshotProcessor|ag.Union;return(e.flags&t)>0&&(e.flags&n)===0}function mg(e){return typeof e==`object`&&e&&e.isType===!0}function hg(e,t){O_(e,mg,`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 gg=1,_g;function vg(){return _g}function yg(){return gg++}function bg(e,t){var n=Jg(e.context);e.type===`action`&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=_g,a=!i;_g=e;try{return wg(n,e,t,a)}finally{_g=i,n._isRunningAction=r}}function xg(e){if(e)return e.type===`action`?e:e.parentActionEvent}function Sg(e,t,n){var r=function(){var r=yg(),i=_g,a=xg(i);return bg({type:`action`,name:t,id:r,args:S_(arguments),context:e,tree:Uh(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?Ph(Ph([],Nh(i.allParentIds),!1),[i.id],!1):[],parentEvent:i,parentActionEvent:a},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var Cg=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 wg(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?dr(t.name,i)():dr(i)()}var a=new Cg(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&&Dh[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),D_()){if(!l&&!d){var p=Jg(e.tree);throw new K(`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=Jg(e.tree);throw new K(`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 Tg=Ah({},{enabled:!1,indent:2,maxStringLength:100,maxArrayLength:10,maxPropertyCount:30,maxDepth:5});function Eg(){return Ah({},Tg)}function Dg(e,t){try{return JSON.stringify(e,null,t)}catch(e){return`<Unserializable: ${e}>`}}function Og(e){return e.length<280?e:`${e.substring(0,272)}......${e.substring(e.length-8)}`}function kg(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 kg(e,t+1,n)});return e.length>n.maxArrayLength&&r.push(`… ${e.length-n.maxArrayLength} more items`),r}if(d_(e)){if(t>=n.maxDepth)return`{…}`;var i={},a=Object.keys(e);return a.slice(0,n.maxPropertyCount).forEach(function(r){i[r]=kg(e[r],t+1,n)}),a.length>n.maxPropertyCount&&(i[`…`]=`${a.length-n.maxPropertyCount} more keys`),i}return e}function Ag(e){if(typeof e==`function`)return`<function${e.name?` `+e.name:``}>`;if(Kg(e))return`<${e}>`;var t=Eg();return t.enabled?`\`${Dg(kg(e,0,t),t.indent||void 0)}\``:`\`${Dg(e)}\``}function jg(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 Mg(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=Kg(t)?`value of type ${Jg(t).type.name}:`:p_(t)?`value`:`snapshot`,o=n&&Kg(t)&&n.is(Jg(t).snapshot),s=Eg();return`${i}${a} ${Ag(t)} is not assignable ${n?`to type: \`${n.name}\``:``}`+(e.message?` (${e.message})`:``)+(n?Ov(n)||p_(t)?`.`:`, expected an instance of \`${n.name}\` or a snapshot like \`${function(e){return s.enabled?jg(e.describe(),s.indent):e.describe()}(n)}\` instead.`+(o?` (Note that a snapshot of the provided value is compatible with the targeted type)`:``):`.`)}function Ng(e,t,n){return e.concat([{path:t,type:n}])}function Pg(){return t_}function Fg(e,t,n){return[{context:e,value:t,message:n}]}function Ig(e){return e.reduce(function(e,t){return e.concat(t)},[])}function Lg(e,t){E_()&&Rg(e,t)}function Rg(e,t){var n=e.validate(t,[{path:``,type:e}]);if(n.length>0)throw new K(zg(e,t,n))}function zg(e,t,n){if(n.length!==0){var r=Ag(t);return`Error while converting ${Eg().enabled?r:Og(r)} to \`${e.name}\`:
|
|
96
|
+
|
|
97
|
+
`+n.map(Mg).join(`
|
|
98
|
+
`)}}var Bg=0,Vg=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Bg++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Xt.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Xt.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,Xt.array([],r_));var r=this.cache.get(n);if(r.indexOf(e)!==-1)throw new K(`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;qr(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 Jr(this.cache).forEach(function(e){for(var a=Nh(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 K(`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 Hg(e,t,n,r,i){var a=Yg(i);if(a){if(a.parent)throw new K(`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 rg(e,t,n,r,i)}function Ug(e,t,n,r,i){return new Qh(e,t,n,r,i)}function Wg(e){return e instanceof Qh||e instanceof rg}var Gg;(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`})(Gg||={});function Kg(e){return!!(e&&e.$treenode)}function qg(e,t){O_(e,Kg,`mobx-state-tree node`,t)}function Jg(e){if(!Kg(e))throw new K(`Value ${e} is no MST Node`);return e.$treenode}function Yg(e){return e&&e.$treenode||null}function Xg(){return Jg(this).snapshot}function Zg(e,t,n){return n===void 0&&(n=!0),Qg(e,B_(t),n)}function Qg(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 Qh){var o=r.value;Kg(o)&&(r=Jg(o))}if(r instanceof rg&&r.getChildType(a)&&(r=r.getChildNode(a),r))continue}throw new K(`Could not resolve '${a}' in path '${z_(t.slice(0,i))||`/`}' while resolving '${z_(t)}'`)}}catch(e){if(!n)return;throw e}return r}function $g(e){if(!e)return t_;var t=Object.keys(e);if(!t.length)return t_;var n=Array(t.length);return t.forEach(function(t,r){n[r]=e[t]}),n}var e_=Object.toString(),t_=Object.freeze([]),n_=Object.freeze({}),r_=In().useProxies?{deep:!1}:{deep:!1,proxy:!1};Object.freeze(r_);var K=function(e){kh(t,e);function t(t){return t===void 0&&(t=`Illegal state`),e.call(this,`[mobx-state-tree] ${t}`)||this}return t}(Error);function i_(e){return e}var a_=Number.isInteger;function o_(e){return Number(e)===e&&e%1!=0}function s_(e){return Number.isFinite(e)}function c_(e){return Array.isArray(e)||Ei(e)}function l_(e){return e?c_(e)?e:[e]:t_}function u_(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 d_(e){if(typeof e!=`object`||!e)return!1;var t=Object.getPrototypeOf(e);return t==null||t.constructor?.toString()===e_}function f_(e){return typeof e==`object`&&!!e&&!(e instanceof Date)&&!(e instanceof RegExp)}function p_(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 m_(e){return D_()?p_(e)||Ei(e)?e:Object.freeze(e):e}function h_(e){return D_()?(m_(e),d_(e)&&Object.keys(e).forEach(function(t){!p_(e[t])&&!Object.isFrozen(e[t])&&h_(e[t])}),e):e}function g_(e){return typeof e!=`function`}function __(e,t,n){Wi(e)?Xr(e,t,n):Object.defineProperty(e,t,n)}function v_(e,t,n){__(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function y_(e,t,n){__(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}var b_=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,Ph([],Nh(e),!1))})}}),e}(),x_=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 b_,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,Ph([],Nh(n),!1))}}),e}();function S_(e){for(var t=Array(e.length),n=0;n<e.length;n++)t[n]=e[n];return t}function C_(e,t){return e.indexOf(t)===0}var w_=function(e,t){D_()&&(w_.ids&&!w_.ids.hasOwnProperty(e)&&T_(`Deprecation warning: `+t),w_.ids&&(w_.ids[e]=!0))};w_.ids={};function T_(e){console.warn(Error(`[mobx-state-tree] ${e}`))}function E_(){return D_()||typeof process<`u`&&{}.ENABLE_TYPE_CHECK===`true`}function D_(){return!1}function O_(e,t,n,r){if(D_()&&!t(e))throw new K(`expected ${n} as argument ${l_(r).join(` or `)}, got ${e} instead`)}function k_(e,t){O_(e,function(e){return typeof e==`function`},`function`,t)}function A_(e,t,n,r){O_(e,function(e){return typeof e==`number`},`number`,t),n!==void 0&&O_(e,function(e){return e>=n},`number greater than ${n}`,t),r!==void 0&&O_(e,function(e){return e<=r},`number lesser than ${r}`,t)}function j_(e,t,n){n===void 0&&(n=!0),O_(e,function(e){return typeof e==`string`},`string`,t),n||O_(e,function(e){return e!==``},`not empty string`,t)}function M_(e){typeof queueMicrotask==`function`?queueMicrotask(e):typeof setImmediate==`function`?setImmediate(e):setTimeout(e,1)}function N_(e){if(!(`oldValue`in e))throw new K("Patches without `oldValue` field cannot be inversed");return[P_(e),F_(e)]}function P_(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 F_(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 I_(e){return typeof e==`number`}function L_(e){return I_(e)===!0?``+e:e.indexOf(`/`)===-1&&e.indexOf(`~`)===-1?e:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function R_(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function z_(e){if(e.length===0)return``;var t=function(e){return e.map(L_).join(`/`)};return e[0]===`.`||e[0]===`..`?t(e):`/`+t(e)}function B_(e){var t=e.split(`/`).map(R_);if(!(e===``||e===`.`||e===`..`||C_(e,`/`)||C_(e,`./`)||C_(e,`../`)))throw new K(`a json path must be either rooted, empty or relative, but got '${e}'`);return t[0]===``&&t.shift(),t}var V_=Symbol(`$preProcessorFailed`),H_=function(e){kh(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|ag.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 V_}}}),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;U_(e.type,this,`create`),e instanceof rg&&(e.hasSnapshotPostProcessor=!!this._processors.postProcessor);var n=e.getSnapshot;e.getSnapshot=function(){return t.postProcessSnapshot(n.call(e),e)},Iv(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=Kg(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,Kg(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===V_?Fg(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=mg(e)?this._subtype:Kg(e)?e:this.preProcessSnapshotSafe(e);return t!==V_&&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 lg))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(cg);function U_(e,t){for(var n,r,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];try{for(var o=Mh(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 W_(e,t,n){if(hg(e,1),D_()){if(t.postProcessor&&typeof t.postProcessor!=`function`)throw new K(`postSnapshotProcessor must be a function`);if(t.preProcessor&&typeof t.preProcessor!=`function`)throw new K(`preSnapshotProcessor must be a function`)}return new H_(e,t,n)}var G_=`Map.put can only be used to store complex values that have an identifier type attribute`;function K_(e,t){var n,r,i=e.getSubTypes();if(i===og)return!1;if(i){var a=l_(i);try{for(var o=Mh(a),s=o.next();!s.done;s=o.next()){var c=s.value;if(!K_(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 uv&&t.push(e),!0}var q_;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.YES=1]=`YES`,e[e.NO=2]=`NO`})(q_||={});var J_=function(e){kh(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 K(`Map.put cannot be used to set empty values`);if(Kg(e)){var t=Jg(e);if(D_()&&!t.identifierAttribute||t.identifier===null)throw new K(G_);return this.set(t.identifier,e),e}if(f_(e)){var n=Jg(this),r=n.type;if(r.identifierMode!==q_.YES)throw new K(G_);var i=e[r.mapIdentifierAttribute];if(!py(i)){var a=this.put(r.getChildType().create(e,n.environment));return this.put(zh(a))}var o=fy(i);return this.set(o,e),this.get(o)}throw new K(`Map.put can only be used to store complex values`)}}),t}(Ai),Y_=function(e){kh(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:q_.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:ag.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(),Hg(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===q_.UNKNOWN){var e=[];if(K_(this._subType,e)){var t=e.reduce(function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw new K(`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=q_.YES,this.mapIdentifierAttribute=t):this.identifierMode=q_.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 J_(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Br(t,e.unbox),e.type.hookInitializers.forEach(function(e){var n=e(t);Object.keys(n).forEach(function(e){var r=n[e],i=Sg(t,e,r);(D_()?y_:v_)(t,e,i)})}),Vr(t,this.willChange),Zr(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 qr(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 K(`Not a child `+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Jg(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;Lg(i,a),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case`add`:Lg(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===q_.YES&&t instanceof rg){var n=t.identifier;if(n!==e)throw new K(`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=Jg(e.object);switch(e.type){case`update`:t.emitPatch({op:`replace`,path:L_(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);return;case`add`:t.emitPatch({op:`add`,path:L_(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:L_(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(!d_(t)){Lg(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&&(dg(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 d_(e)?Ig(Object.keys(e).map(function(r){return n._subType.validate(e[r],Ng(t,r,n._subType))})):Fg(t,e,`Value is not a plain object`)}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return n_}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(lg);Y_.prototype.applySnapshot=dr(Y_.prototype.applySnapshot);function X_(e){return new Y_(`Map<string, ${e.name}>`,e)}var Z_=function(e){kh(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:ag.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 Hg(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=Ah(Ah({},r_),{name:this.name});return Xt.array($g(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){ra(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=Sg(t,e,r);(D_()?y_:v_)(t,e,i)})}),Vr(t,this.willChange),Zr(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 K(`Not a child: `+t)}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Jg(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=nv(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=nv(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=Jg(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(!c_(t)){Lg(this,t);return}var i=e.storedValue,a=e.getChildren(),o=a.length,s=t.length,c=this.getChildType(),l=$_(a,t,Math.min(o,s));if(l!==o||l!==s){if(o!==s||e.hasPatchSubscribers()){i.replace(t);return}if(ev(c,a,t,l)){tv(a,t,l);return}for(var u=[],d=l;d<o;d++)a[d].snapshot!==t[d]&&u.push(d);try{for(var f=Mh(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 c_(e)?Ig(e.map(function(e,r){return n._subType.validate(e,Ng(t,``+r,n._subType))})):Fg(t,e,`Value is not an array`)}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return t_}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.splice(Number(t),1)}}),t}(lg);Z_.prototype.applySnapshot=dr(Z_.prototype.applySnapshot);function Q_(e){return hg(e,1),new Z_(`${e.name}[]`,e)}function $_(e,t,n){for(var r=0;r<n&&e[r].snapshot===t[r];)r++;return r}function ev(e,t,n,r){for(var i=r;i<t.length;i++){var a=t[i];if(a.snapshot!==n[i]&&(!dg(e,a,n[i])||!a.identifierAttribute||a.identifier===null))return!1}return!0}function tv(e,t,n){for(var r=n;r<e.length;r++){var i=e[r];i.snapshot!==t[r]&&i.applySnapshot(t[r])}}function nv(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(Wg(l)&&(l=l.storedValue),!c&&!s)break;if(!s)a=!1,n.splice(o,1),c instanceof rg&&c.createObservableInstanceIfNeeded(),c.die(),o--;else if(!c){if(Kg(l)&&Jg(l).parent===e)throw new K(`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 '${Jg(l).path}'`);a=!1;var d=rv(t,e,u,l);n.splice(o,0,d)}else if(iv(c,l))n[o]=rv(t,e,u,l,c);else{for(var f=void 0,p=o;p<n.length;p++)if(iv(n[p],l)){f=n.splice(p,1)[0];break}a=!1;var d=rv(t,e,u,l,f);n.splice(o,0,d)}}return a?null:n}function rv(e,t,n,r,i){Lg(e,r);function a(){if(Kg(r)){var a=Jg(r);if(a.assertAlive(n_),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 rg&&i.createObservableInstanceIfNeeded(),i.die()),o}function iv(e,t){if(!e.isAlive)return!1;if(Kg(t)){var n=Jg(t);return n.isAlive&&n===e}if(e.snapshot===t)return!0;if(!(e instanceof rg))return!1;var r=e.getReconciliationType();return e.identifier!==null&&e.identifierAttribute&&d_(t)&&r.is(t)&&r.isMatchingSnapshotId(e,t)}var av=`preProcessSnapshot`,ov=`postProcessSnapshot`;function sv(){return Jg(this).toString()}var cv={name:`AnonymousModel`,properties:{},initializers:t_};function lv(e){var t=Object.keys(e),n=new Set;return t.forEach(function(e){if(n.has(e))throw new K(`${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 Dh)throw new K(`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 K(`Getters are not supported as properties. Please use views instead`);var i=r.value;if(i==null)throw new K("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");if(p_(i))t[n]=zv(Dv(i),i);else if(i instanceof Y_)t[n]=zv(i,{});else if(i instanceof Z_)t[n]=zv(i,[]);else if(!mg(i))throw D_()&&typeof i==`function`?new K(`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?`):D_()&&typeof i==`object`?new K(`Invalid type definition for property '${n}', it looks like you passed an object. Try passing another model type or a types.frozen.`):new K(`Invalid type definition for property '${n}', cannot infer a type from a value like '${i}' (${typeof i})`);return t},Ah({},e))}var uv=function(e){kh(t,e);function t(t){var n=e.call(this,t.name||cv.name)||this;return Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ag.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,cv,t),n.properties=lv(n.properties),m_(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&ag.Identifier){if(e)throw new K(`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(!d_(t))throw new K(`actions initializer should return a plain object containing actions`);Object.getOwnPropertyNames(t).forEach(function(r){if(r in n.properties)throw new K(`'${r}' is a property and cannot be declared as an action`);if(r===av)throw new K(`Cannot define action '${av}', it should be defined using 'type.preProcessSnapshot(fn)' instead`);if(r===ov)throw new K(`Cannot define action '${ov}', it should be defined using 'type.postProcessSnapshot(fn)' instead`);var i=t[r],a=e[r];if(r in Dh&&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=Sg(e,r,c);t[r]=l,(D_()?y_:v_)(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 K(`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(!d_(t))throw new K(`volatile state initializer should return a plain object containing state`);Object.getOwnPropertyNames(t).forEach(function(r){if(r in n.properties)throw new K(`'${r}' is a property and cannot be declared as volatile state`);Yr(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 jh(r,[`actions`,`views`,`state`]))throw new K(`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(!d_(t))throw new K(`views initializer should return a plain object containing views`);Object.getOwnPropertyNames(t).forEach(function(r){var i;if(r in n.properties)throw new K(`'${r}' is a property and cannot be declared as a view`);var a=Object.getOwnPropertyDescriptor(t,r);if(`get`in a)Xr(e,r,a),pi(e,(i={},i[r]=tn,i));else if(typeof a.value==`function`)(D_()?y_:v_)(e,r,a.value);else throw new K(`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=Kg(r)?r:this.applySnapshotPreProcessor(r);return Hg(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=Ah(Ah({},r_),{name:this.name});return Xt.object(e,n_,t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){v_(t,`toString`,sv),this.forAllProps(function(n){Br(t,n,e.unbox)}),this.initializers.reduce(function(e,t){return t(e)},t),Vr(t,this.willChange),Zr(t,this.didChange)}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e,n=Jg(t.object),r=t.name;n.assertWritable({subpath:r});var i=n.type.properties[r];return i&&(Lg(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=Jg(t.object);if(n.type.properties[t.name]){var r=t.oldValue?t.oldValue.snapshot:void 0;n.emitPatch({op:`replace`,path:L_(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 K(`Not a value property: `+t);var n=ra(e.storedValue,t),r=n.raw?.call(n);if(!r)throw new K(`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){na(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 K(`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=!d_(n);(!d_(t)||r)&&(Lg(this,t),r)||this.forAllProps(function(t,r){var i=e.getChildNode(t),a=n[t];if(i.snapshot!==a){if(dg(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 j_(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 d_(r)?Ig(this.propertyNames.map(function(e){return n.properties[e].validate(r[e],Ng(t,e,n.properties[e]))})):Fg(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 n_}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue[t]=void 0}}),t}(lg);uv.prototype.applySnapshot=dr(uv.prototype.applySnapshot);function dv(){var e=[...arguments];if(D_()&&typeof e[0]!=`string`&&e[1])throw new K(`Model creation failed. First argument must be a string when two arguments are provided`);return new uv({name:typeof e[0]==`string`?e.shift():`AnonymousModel`,properties:e.shift()||{}})}function fv(){var e=[...arguments],t=typeof e[0]==`string`,n=t?e[0]:`AnonymousModel`;return t&&e.shift(),D_()&&e.forEach(function(e,n){O_(e,pv,`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 pv(e){return mg(e)&&(e.flags&ag.Object)>0}var mv=function(e){kh(t,e);function t(t,n,r,i){i===void 0&&(i=i_);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 Ug(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 p_(e)&&this.checker(e)?Pg():Fg(t,e,`Value is not a ${this.name===`Date`?`Date or a unix milliseconds timestamp`:this.name}`)}}),t}(ug),hv=new mv(`string`,ag.String,function(e){return typeof e==`string`}),gv=new mv(`number`,ag.Number,function(e){return typeof e==`number`}),_v=new mv(`integer`,ag.Integer,function(e){return a_(e)}),vv=new mv(`float`,ag.Float,function(e){return o_(e)}),yv=new mv(`finite`,ag.Finite,function(e){return s_(e)}),bv=new mv(`bigint`,ag.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)});bv.getSnapshot=function(e){return String(e.storedValue)};var xv=bv,Sv=new mv(`boolean`,ag.Boolean,function(e){return typeof e==`boolean`}),Cv=new mv(`null`,ag.Null,function(e){return e===null}),wv=new mv(`undefined`,ag.Undefined,function(e){return e===void 0}),Tv=new mv(`Date`,ag.Date,function(e){return typeof e==`number`||e instanceof Date},function(e){return e instanceof Date?e:new Date(e)});Tv.getSnapshot=function(e){return e.storedValue.getTime()};var Ev=Tv;function Dv(e){switch(typeof e){case`string`:return hv;case`number`:return gv;case`boolean`:return Sv;case`bigint`:return xv;case`object`:if(e instanceof Date)return Ev}throw new K(`Cannot determine primitive type from value `+e)}function Ov(e){return mg(e)&&(e.flags&(ag.String|ag.Number|ag.Integer|ag.Boolean|ag.Date|ag.BigInt))>0}var kv=function(e){kh(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:ag.Literal}),n.value=t,n}return Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Ug(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 p_(e)&&e===this.value?Pg():Fg(t,e,`Value is not a literal ${JSON.stringify(this.value)}`)}}),t}(ug);function Av(e){return O_(e,p_,`primitive`,1),new kv(e)}var jv=function(e){kh(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|ag.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=Kg(e)?Jg(e).snapshot:e;return this._predicate(r)?Pg():Fg(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}(cg);function Mv(){var e=[...arguments],t=typeof e[0]==`string`?e.shift():mg(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 hg(n,[1,2]),j_(t,1),k_(r,[2,3]),k_(i,[3,4]),new jv(t,n,r,i)}function Nv(e,t){var n=typeof e==`string`?t:e;D_()&&n.forEach(function(e,t){j_(e,t+1)});var r=Fv.apply(void 0,Ph([],Nh(n.map(function(e){return Av(``+e)})),!1));return typeof e==`string`&&(r.name=e),r}var Pv=function(e){kh(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=Ah({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=ag.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 K(`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 K(`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 Pg();r++}else n.push(a)}return r===1?Pg():Fg(t,e,`No type is applicable for the union`).concat(Ig(n))}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._types}}),t}(cg);function Fv(e){var t=[...arguments].slice(1),n=mg(e)?void 0:e,r=mg(e)?Ph([e],Nh(t),!1):t,i=`(`+r.map(function(e){return e.name}).join(` | `)+`)`;return D_()&&(n&&O_(n,function(e){return d_(e)},`object { eager?: boolean, dispatcher?: Function }`,1),r.forEach(function(e,t){hg(e,n?t+2:t+1)})),new Pv(i,r,n)}function Iv(e){return mg(e)&&(e.flags&ag.Union)>0}var Lv=function(e){kh(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|ag.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`&&Lg(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Pg():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}(cg);function Rv(e,t){if(typeof t!=`function`&&Kg(t))throw new K(`default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead`);hg(e,1),D_()&&typeof t!=`function`&&Lg(e,t)}function zv(e,t,n){return Rv(e,t),new Lv(e,t,n||Bv)}var Bv=[void 0],Vv=zv(wv,void 0),Hv=zv(Cv,null);function Uv(e){return hg(e,1),Fv(e,Vv)}function Wv(e){return hg(e,1),Fv(e,Hv)}var Gv=function(e){kh(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)|ag.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 K(`Late type seems to be used too early, the definition (still) returns undefined`);if(t){if(D_()&&!mg(t))throw new K(`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):Pg()}}),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)||og}}),t}(cg);function Kv(e,t){var n=typeof e==`string`?e:`late(${e.toString()})`,r=typeof e==`string`?t:e;if(D_()&&(typeof r!=`function`||r.length!==0))throw new K(`Invalid late type, expected a function with zero arguments that returns a type, got: `+r);return new Gv(n,r)}function qv(e,t){return new Jv(e,t)}var Jv=function(e){kh(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:ag.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Xt.array()}),ti(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(dr(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=Ug(this,e,t,n,h_(r));return this.pendingNodeList.push(a),ti(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):g_(e)?Pg():Fg(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}(ug),Yv=function(e){kh(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:ag.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 Ug(this,e,t,n,h_(r))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return g_(e)?this.subType?this.subType.validate(e,t):Pg():Fg(t,e,`Value is not serializable and cannot be frozen`)}}),t}(ug),Xv=new Yv;function Zv(e){return arguments.length===0?Xv:mg(e)?new Yv(e):zv(Xv,e)}function Qv(e){switch(e){case Dh.beforeDestroy:return`destroy`;case Dh.beforeDetach:return`detach`;default:return}}var $v=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}),py(e))this.identifier=e;else if(Kg(e)){var n=Jg(e);if(!n.identifierAttribute)throw new K(`Can only store references with a defined identifier attribute.`);var r=n.unnormalizedIdentifier;if(r==null)throw new K(`Can only store references to tree nodes with a defined identifier.`);this.identifier=r}else throw new K(`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=fy(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 ey(`[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}(),ey=function(e){kh(t,e);function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return t}(Error),ty=function(e){kh(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:ag.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 py(e)?Pg():Fg(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){Lh(t.root.storedValue,{op:`replace`,value:e,path:t.path})},removeRef:function(){pv(i.type)?this.replaceRef(void 0):Lh(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=Jg(r),a=function(r,a){var o=Qv(a);o&&n.fireInvalidated(o,e,t,i)},o=i.registerHook(Dh.beforeDetach,a),s=i.registerHook(Dh.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(Dh.beforeDestroy,function(){i&&i()});var a=function(){var n=function(){e.isAlive&&r.getSnapshot(e)===t&&o(!1)};vg()?e.root.enqueueEndOfAction(n):M_(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,fy(t)),l?i=r.addTargetNodeWatcher(e,t):o?a():r.fireInvalidated(`invalidSnapshotReference`,e,t,null)}};e.state===Gg.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(Dh.afterCreationFinalization,function(){e.parent&&e.parent.createObservableInstanceIfNeeded()}),e.registerHook(Dh.afterAttach,function(){o(!1)}))}}}),t}(ug),ny=function(e){kh(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=Kg(r)?Kh(r):r,a=new $v(r,this.targetType),o=Ug(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=Kg(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}(ty),ry=function(e){kh(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=Kg(r)?this.options.set(r,e?e.storedValue:null):r,a=Ug(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=Kg(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}(ty);function iy(e,t){if(hg(e,1),D_()&&arguments.length===2&&typeof arguments[1]==`string`)throw new K(`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(D_()&&(!n.get||!n.set))throw new K(`reference options must either contain both a 'get' and a 'set' method or none of them`);return new ry(e,{get:n.get,set:n.set},r)}return new ny(e,r)}function ay(e,t){var n=iy(e,Ah(Ah({},t),{onInvalidated:function(e){t&&t.onInvalidated&&t.onInvalidated(e),e.removeRef()}}));return t&&t.acceptsUndefined===!1?n:Uv(n)}var oy=function(e){kh(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:ag.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 uv))throw new K(`Identifier types can only be instantiated as direct child of a model type`);return Ug(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 K(`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?Pg():Fg(t,e,`Value is not a valid ${this.describe()}, expected a ${this.validType}`)}}),t}(ug),sy=function(e){kh(t,e);function t(){var t=e.call(this,`identifier`,`string`)||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ag.Identifier}),t}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return`identifier`}}),t}(oy),cy=function(e){kh(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}(oy),ly=new sy,uy=new cy,dy=new(function(e){kh(t,e);function t(){var t=e.call(this,`identifierBigint`)||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ag.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 uv))throw new K(`Identifier types can only be instantiated as direct child of a model type`);return Ug(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 K(`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 Pg();if(typeof e==`string`||typeof e==`number`)try{return BigInt(e),Pg()}catch(r){var n=r instanceof Error?r.message:String(r);return Fg(t,e,`Value is not a valid ${this.describe()}: ${n}`)}return Fg(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}(ug));function fy(e){return``+e}function py(e){return typeof e==`string`||typeof e==`number`||typeof e==`bigint`}function my(e){return new hy(e)}var hy=function(e){kh(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:ag.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 Pg();var n=this.options.getValidationMessage(e);return n?Fg(t,e,`Invalid value for type '${this.name}': ${n}`):Pg()}}),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 Ug(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}(ug),q={enumeration:Nv,model:dv,compose:fv,custom:my,reference:iy,safeReference:ay,union:Fv,optional:zv,literal:Av,maybe:Uv,maybeNull:Wv,refinement:Mv,string:hv,boolean:Sv,number:gv,integer:_v,float:vv,finite:yv,bigint:xv,Date:Ev,map:X_,array:Q_,frozen:Zv,identifier:ly,identifierNumber:uy,identifierBigint:dy,late:Kv,lazy:qv,undefined:wv,null:Cv,snapshotProcessor:W_},gy=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)||!gy(e[n],t[n]))return!1;return!0}return!1};Object.assign(q);var _y=q.model(`UndoManager`,{history:q.array(q.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=zh(t);return{pages:e.pages,width:e.width,height:e.height,custom:e.custom,audios:e.audios}}function l(e){let n=!gy(t.pages.map(e=>e.id),e.pages.map(e=>e.id)),r=!gy(t.custom,e.custom);n?Rh(t.pages,e.pages):t.pages.forEach((t,n)=>{Rh(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];!gy(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=Gh(e,`..`),!t)throw Error("Failed to find target store for UndoManager. Please provide `targetPath` property, or a `targetStore` in the environment");n=Ih(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}),vy=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,yy=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=vy[n[e]&63];return t};async function by(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 xy=null;function Sy(){return window.jspdf?.jsPDF?Promise.resolve(window.jspdf.jsPDF):xy||(typeof window.__polotnoLoadJspdf==`function`?(xy=window.__polotnoLoadJspdf().then(e=>e?.jsPDF||e),xy):(xy=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)}),xy))}function Cy(){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 wy({width:e,height:t}){return new(await(Cy()))({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 Ty=()=>`https://api.polotno.com/api`,Ey=Xt({imageDownScalingEnabled:!0,removeBackgroundEnabled:!1,htmlRenderEnabled:!1,renderTagTextEnabled:!0,forceTextFitEnabled:!1,textVerticalResizeEnabled:!1,textOverflow:`resize`,textSplitAllowed:!1,animationsEnabled:!1,aiTextEnabled:!1,autoDeleteEmptyText:!0}),Dy=typeof window<`u`&&window.location.hostname===`localhost`||typeof process<`u`&&!1,Oy=dr(e=>{Ey.textVerticalResizeEnabled=e}),ky=dr(e=>{Ey.removeBackgroundEnabled=e});dr(e=>{Dy&&console.warn(`useRemoveBackground is deprecated. Use setRemoveBackgroundEnabled instead.`),ky(e)}),dr(e=>{Ey.aiTextEnabled=e}),dr(e=>{Dy&&console.warn(`useHtmlTextRender is deprecated. Use setRichTextEnabled instead.`),Ey.htmlRenderEnabled=e});var Ay=e=>dr(t=>{Dy&&console.warn(`${e}() is a no-op: the new text rendering engine is enabled by default.`)}),jy=e=>{pr(()=>{Ey.htmlRenderEnabled=!0,Ey.renderTagTextEnabled=!1})},My=Ay(`setRichTextEnabled`),Ny=Ay(`setRenderTagTextEnabled`),Py=dr(e=>{Ey.imageDownScalingEnabled=e});dr(e=>{console.warn(`useDownScaling is deprecated. Use setDownScalingEnabled instead.`),Py(e)}),dr(e=>{console.warn(`setForceTextFit is deprecated. Use setTextOverflow instead.`),Ey.textOverflow=`change-font-size`});var Fy=dr(e=>{Ey.textOverflow=e}),Iy=dr(e=>{Ey.textSplitAllowed=e});dr(e=>{Ey.animationsEnabled=e}),dr(e=>{Ey.autoDeleteEmptyText=e});var Ly=Xt({value:!1}),Ry=Xt({value:`v1`}),zy=()=>Ry.value,By=Xt({value:0}),Vy=()=>By.value,Hy=()=>Ly.value,Uy=dr(()=>{Ly.value=!0}),Wy=``,Gy=e=>{Wy=e||``},Ky=typeof window<`u`?window.location.origin:``,qy=typeof navigator<`u`&&navigator.userAgent.indexOf(`Headless`)>-1,Jy=typeof navigator<`u`&&navigator.userAgent.indexOf(`Electron`)>-1;Ky===`file://`&&qy&&(Ky=`headless`),Ky===`file://`&&Jy&&(Ky=`electron`);var Yy=`%cPolotno error! Current domain is not allowed. It may lead to unexpected behavior and stop working. Please add "${Ky}" here: https://polotno.com/cabinet`,Xy=fetch;async function Zy(e){for(let t=0;t<5;t++)try{let t=await Xy(Ty()+`/validate-key`,{method:`POST`,body:JSON.stringify({key:e,site:location.host,skdVersion:`4.7.0`})});if(pr(()=>{Ry.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`),pr(()=>{By.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`),pr(()=>{By.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;`),pr(()=>{By.value===0&&(By.value=2)})),n.is_domain_valid||console.log(Yy,`background: rgba(247, 101, 68, 1); color: white; padding: 5px; margin: 5px;`),ky(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 Qy(e){await Zy(Wy)&&!e||Uy()}var $y=!1,eb=(e=!$y)=>{$y=e},tb=()=>$y;function nb(e,t){let n=k.useRef(void 0);k.useLayoutEffect(()=>{n.current&&n.current.destroy()},[t]),k.useLayoutEffect(()=>{if(!$y)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 rb=0,ib=[],ab=3e4,ob=e=>{ab=e},sb=6e3,cb=e=>{sb=e},lb=()=>sb;function ub(e){rb+=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`;hb(o(r,`Timeout loading asset ${e}`,{reason:`timeout`,label:n,timeoutMs:ab})),console.error(`Timeout triggered for loader. Some assets may not have loaded.`,e),t=!0,db()},ab);return()=>{n?console.error(`Finish called twice! That is not expected. id: `,e):(n=!0,t||(clearTimeout(r),db()))}}function db(){--rb,rb===0&&(ib.forEach(e=>e()),ib=[])}function fb(){return new Promise(e=>{t=()=>{tb()?setTimeout(e,300):e(!0)},rb===0?t():ib.push(t);return;var t})}var pb=[];function mb(e){pb.push(e)}function hb(e){let t=typeof e==`string`?o(`UNKNOWN`,e):e;pb.forEach(e=>e(t))}function gb(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 _b={createDOMParser:()=>typeof DOMParser<`u`?new DOMParser:gb(`DOMParser`),createXMLSerializer:()=>typeof XMLSerializer<`u`?new XMLSerializer:gb(`XMLSerializer`),createElement:e=>typeof document<`u`?document.createElement(e):gb(`document.createElement`)},vb={createDOMParser:()=>_b.createDOMParser(),createXMLSerializer:()=>_b.createXMLSerializer(),createElement:e=>_b.createElement(e)};function yb(e){return vb.createDOMParser().parseFromString(`<!DOCTYPE html><html><head></head><body>${e}</body></html>`,`text/html`)}var bb=(e,t)=>{if(e.children)for(let n of e.children){if(t(n)===!0)break;bb(n,t)}if(e.cells){for(let n of e.cells)if(t(n)===!0)break}},xb={"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`},Sb={"ql-size-small":.75,"ql-size-large":1.5,"ql-size-huge":2.5};function Cb(e){return e.replace(/^ql-font-/,``).split(`-`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)}function wb(e){return e.replace(/"/g,`"`).replace(/&/g,`&`).split(`,`)[0].trim().replace(/^["']|["']$/g,``)||null}function Tb(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 Eb(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 Db(e){return Eb(e)>=600}function Ob(e){return yb(`<div id="polotno-rich-root">${e}</div>`).getElementById(`polotno-rich-root`)}function kb(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 Ab(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`)||kb(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=kb(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 jb=new Set([`SPAN`,`STRONG`,`B`,`EM`,`I`,`U`,`S`,`DEL`,`SUB`,`SUP`]);function Mb(e){if(e.tagName!==`SPAN`)return!1;for(let t of Array.from(e.attributes))if(t.value.trim())return!1;return!0}function Nb(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 Pb(e){let t=e=>{for(let n of Array.from(e.children))t(n);if(Mb(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&&jb.has(t.tagName)&&t.tagName===e.tagName&&Nb(t,e)){for(;e.firstChild;)t.appendChild(e.firstChild);e.remove(),n(t);continue}t=e}};n(e)}function Fb(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 Ib(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=Fb(o);if(s===-1)return null;let c=Ib(o.slice(s+1).trim());if(c===null||c===``)return null;t+=c,n=a+1}return t.trim()||null}function Lb(e){let t=e.getAttribute(`style`);if(!t||!t.includes(`var(`))return;let n=[],r=0,i=0;for(let e=0;e<t.length;e++){let a=t[e];a===`(`?r++:a===`)`?r--:a===`;`&&r===0&&(n.push(t.slice(i,e)),i=e+1)}n.push(t.slice(i));let a=[];for(let e of n){let t=e.indexOf(`:`);if(t===-1)continue;let n=e.slice(0,t).trim(),r=e.slice(t+1).trim();if(!n||!r)continue;if(!r.includes(`var(`)){a.push(`${n}: ${r}`);continue}let i=Ib(r);i!==null&&a.push(`${n}: ${i}`)}a.length?e.setAttribute(`style`,a.join(`; `)+`;`):e.removeAttribute(`style`)}function Rb(e,t){if(!e||!e.includes(`<`))return e;let n=Ob(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=xb[n]||Cb(n);e.style.fontFamily=t}continue}let r=Sb[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`)}Lb(e);let i=e.style.fontSize;if(i){let n=Tb(i,t.fontSize);n!=null&&(e.style.fontSize=`${n}px`)}};r(n),Pb(n),Ab(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 zb(e){let t=new Set;if(!e||!e.includes(`<`))return[];let n=Ob(e);if(n){let e=n.querySelectorAll(`[style]`);for(let n of e)if(n.style.fontFamily){let e=wb(n.style.fontFamily);e&&t.add(e)}}for(let n of e.matchAll(/\bfont-family="([^"]+)"/g)){let e=wb(n[1]);e&&t.add(e)}for(let n of e.matchAll(/\bql-font-([a-z0-9_-]+)\b/gi)){let e=`ql-font-${n[1]}`,r=wb(xb[e]||Cb(e));r&&t.add(r)}return[...t]}function Bb(e,t){if(!e||t===1||t<=0||!Number.isFinite(t))return e;let n=Ob(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 Vb(e){if(!e||!e.includes(`<`))return!1;let t=Ob(e);if(!t)return!1;for(let e of t.querySelectorAll(`[style]`))if(e.style.fontSize)return!0;return!1}function Hb(e){let t=[];return bb({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 zb(e.text))t.indexOf(n)===-1&&t.push(n)}),t}function Ub(e){return{...kf,...e}}function Wb(e){return typeof e.height==`number`&&e.height>0}function Gb(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 Kb(e){let t=e.lineHeight;return typeof t==`number`?isFinite(t)?t:null:typeof t==`string`?Gb(t):null}function qb(e){return Kb(e)??kf.lineHeight}function Jb(e,t){return Wb(e)?e.height:t}function Yb(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 Xb(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 Zb(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}function Qb(e){if(!e)return{};let t={};return e.split(`;`).forEach(e=>{let n=e.indexOf(`:`);if(n===-1)return;let r=e.slice(0,n).trim().toLowerCase(),i=e.slice(n+1).trim();r&&i&&(t[r]=i)}),t}var $b=e=>/<[a-z][\s\S]*>|&[a-z]+;|&#x?[0-9a-f]+;/i.test(e),ex=e=>(e.tagName||``).toLowerCase(),tx=(e,t)=>typeof e.getAttribute==`function`?e.getAttribute(t):null,nx=e=>{let t=(tx(e,`class`)||``).match(/ql-indent-(\d+)/);return t?parseInt(t[1],10):0},rx=[`ul`,`ol`];function ix(e,t){if(!e)return[{segments:[]}];if(!$b(e))return e.split(`
|
|
102
|
+
`).map(e=>({segments:e?[{text:e}]:[]}));let n=yb(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(Zb(r,t));return}if(e.nodeType!==1)return;let r=ex(e);if(r===`br`){n.push({text:`
|
|
103
|
+
`});return}if(r===`style`||r===`script`||rx.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=Qb(tx(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);Db(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=wb(s[`font-family`]);e&&(i.fontFamily=e)}if(s[`font-size`]){let e=t.fontSize??a,n=Tb(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=Zb(e,t),a=n[n.length-1];a&&a.text!==`
|
|
106
|
+
`&&Xb(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=tx(e,`data-list`),a=i===`bullet`||t===`ul`&&i!==`ordered`?`bullet`:`ordered`,c=n+nx(e),u=[];o(e,{},u),s(u,{list:a,indentLevel:c,listStart:r});for(let t of Array.from(e.childNodes||[])){let e=ex(t);rx.includes(e)&&l(t,n+1)}}function l(e,t){let n=ex(e),r=!0;for(let i of Array.from(e.childNodes||[]))ex(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(ex(e))||ex(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=ex(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 rx.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 ax(e,t){if(!e)return[];let n=ix(e,{fontSize:t?.fontSize??kf.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&&Xb(t,e)?t.text+=e.text:i.push(e)}return i}function ox(e){return 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 sx=`400,400italic,700,700italic`;function cx(){return sx}function lx(e){return`https://fonts.googleapis.com/css?family=${e.replace(/ /g,`+`)}:${sx}`}var ux=o;function dx(e,t,n,r){return ux(`FONT_FAILED`,t,{reason:e,...n},r)}function fx(e){return e?.code===`FETCH_FAILED`}var px=3e4;function mx(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 hx(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 gx(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 _x=(e,t)=>new Promise((n,r)=>{if(t?.aborted)return r(vx());let i=setTimeout(n,e);t?.addEventListener(`abort`,()=>{clearTimeout(i),r(vx())},{once:!0})});function vx(){let e=Error(`Font fetch aborted`);return e.name=`AbortError`,e}var yx=class extends Error{constructor(e,t,n){super(e),this.transportReason=e,this.status=t,this.retryAfterMs=n}};async function bx(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 vx();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 yx(`throttled-non-font`);return r?.set(e,t),t}throw clearTimeout(p),l=i.status,i.status===429||i.status===503?new yx(`rate-limited`,i.status,gx(i.headers.get(`retry-after`))):i.status>=500?new yx(`server-error`,i.status):ux(`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 vx();let r=n,a=n instanceof yx,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 ux(`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,px):void 0;await _x(h==null?m:Math.max(h,m),i)}finally{i?.removeEventListener(`abort`,d)}}throw ux(`FETCH_FAILED`,`Failed to fetch ${e}`,{url:e,status:l,attempts:o,reason:u})}function xx(e){return e.trim().replace(/\s+/g,`+`)}function Sx(e){return`https://fonts.googleapis.com/css2?family=${xx(e)}:ital,wght@0,400;0,700;1,400;1,700`}function Cx(e){return`https://fonts.googleapis.com/css2?family=${xx(e)}`}function wx(e,t,n){return`https://fonts.googleapis.com/css2?family=${xx(e)}:ital,wght@${+!!t},${n}`}function Tx(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=n[1].toLowerCase()===`italic`?`1`:`0`;t.set(`${o},${i[1]}`,a[1])}return t}var Ex=new Map,Dx=new TextDecoder;function Ox(e,t){if(fx(t)){let n=t.details?.reason;if(n===`http-client-error`)return dx(`not-found`,`Google Fonts has no family "${e}"`,{family:e},t);if(n===`timeout`)return dx(`timeout`,`Timed out fetching Google font "${e}"`,{family:e},t)}return dx(`fetch-failed`,`Failed to fetch Google font "${e}"`,{family:e},t)}async function kx(e,t){let n=``,r=e=>(n=Dx.decode(e),/@font-face/i.test(n));try{await bx(Sx(e),{...t,validate:r})}catch(n){if((fx(n)?n.details?.reason:void 0)===`http-client-error`)await bx(Cx(e),{...t,validate:r}).catch(t=>{throw Ox(e,t)});else throw Ox(e,n)}let i=Tx(n);if(i.size===0)throw dx(`not-found`,`No usable @font-face for "${e}"`,{family:e});return i}function Ax(e,t={}){let n=Ex.get(e);if(!n){let{cache:r,retries:i,baseDelayMs:a}=t;n=kx(e,{cache:r,retries:i,baseDelayMs:a}),Ex.set(e,n),n.catch(t=>{t?.details?.reason!==`not-found`&&Ex.delete(e)})}return jx(n,e,t)}function jx(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(vx())};if(n?.aborted)return c();n?.addEventListener(`abort`,c,{once:!0}),r!=null&&(o=setTimeout(()=>{s(),a(dx(`timeout`,`Timed out waiting for Google font "${t}"`,{family:t}))},r)),e.then(e=>{s(),i(e)},e=>{s(),a(e)})})}function Mx(e){return(e.styles||(e.url?[{src:`url("${e.url}")`}]:[])).map(e=>({src:e.src,fontStyle:e.fontStyle||`normal`,fontWeight:e.fontWeight||`normal`}))}Xt([`Roboto`,`Amatic SC`,`Press Start 2P`,`Marck Script`,`Rubik Mono One`]),Xt({value:!1});var Nx=Xt([]);function Px(e){Nx.push(e)}var Fx=`BESbswy 0123456789 Il1Ww`,Ix=[`sans-serif`,`serif`,`monospace`];function Lx(e){let t=function(e=``){let t=Yb(e).replace(/\s+/g,` `).trim();return t?Array.from(t).slice(0,10).join(``):``}(e);return t?`${Fx} ${t}`:Fx}var Rx;function zx(e){return{width:e.width,actualBoundingBoxLeft:e.actualBoundingBoxLeft||0,actualBoundingBoxRight:e.actualBoundingBoxRight||0,actualBoundingBoxAscent:e.actualBoundingBoxAscent||0,actualBoundingBoxDescent:e.actualBoundingBoxDescent||0}}function Bx(e=`sans-serif`,t=`normal`,n=`normal`,r=Fx){Rx||=document.createElement(`canvas`);let i=Rx.getContext(`2d`);return i.font=`${t} ${n} 40px ${e}`,zx(i.measureText(r))}function Vx(e,t,n,r,i){return Ix.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=Fx){Rx||=document.createElement(`canvas`);let a=Rx.getContext(`2d`);return a.font=`${n} ${r} 40px '${e}', ${t}`,zx(a.measureText(i))}(e,a,t,n,r),i[a]))}var Hx={Arial:!0},Ux=(e,t,n)=>t&&n?!!Hx[`${e}_${t}_${n}`]:Object.keys(Hx).some(t=>t.startsWith(e+`_`))||!!Hx[e];async function Wx(e,t,n,r){let i=`${e}_${t}_${n}`;if(Hx[i])return;Zx(e,t,n);let a=!!document.fonts?.load,s=Lx(r),c={"sans-serif":Bx(`sans-serif`,t,n,s),serif:Bx(`serif`,t,n,s),monospace:Bx(`monospace`,t,n,s)};if(a)try{if(await document.fonts.load(`${t} ${n} 16px '${e}'`,s),Vx(e,t,n,s,c)){Yx(i,e);return}}catch{}let l=lb()/60;for(let r=0;r<l;r++){if(Kx[e]===`missing`){if(!qx.has(e)){qx.add(e),setTimeout(()=>qx.delete(e),Jx);let t=`Font "${e}" not found: not registered and no matching Google Font.`;console.error(t),hb(o(`FONT_FAILED`,t,{family:e,reason:`not-found`}))}return}if(e in Gx&&!Gx[e]&&Kx[e]===`errored`&&Qx(e),a)try{await document.fonts.load(`${t} ${n} 16px '${e}'`,s)}catch{}if(Vx(e,t,n,s,c)){Yx(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?`),hb(o(`FONT_FAILED`,`Timeout for loading font "${e}"`,{family:e,reason:`timeout`}))}var Gx={},Kx={},qx=new Set,Jx=500;function Yx(e,t){Hx[e]=!0,delete Kx[t]}var Xx={};function Zx(e,t,n){let r=parseInt(n,10);if(!Number.isFinite(r)||function(e){let t=new Set;for(let n of cx().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 Gx))return;let i=t===`italic`,a=`${e}|${+!!i}|${r}`;if(Xx[a])return;Xx[a]=!0;let o=document.createElement(`link`);o.type=`text/css`,o.href=wx(e,i,r),o.rel=`stylesheet`,o.onerror=()=>{o.remove()},document.getElementsByTagName(`head`)[0].appendChild(o)}function Qx(e){if(Gx[e])return;let t=lx(e),n=document.createElement(`link`);n.type=`text/css`,n.href=t,n.rel=`stylesheet`,n.onerror=()=>{n.remove(),Gx[e]=!1,Kx[e]===`errored`?function(e){Kx[e]=`probing`,fetch(lx(e),{mode:`no-cors`}).then(()=>{Kx[e]=`missing`}).catch(()=>{delete Kx[e]})}(e):Kx[e]||(Kx[e]=`errored`)},document.getElementsByTagName(`head`)[0].appendChild(n),Gx[e]=!0}var $x={},eS;function tS(e){let t=e.fontFamily;if($x[t]||!e.url&&!e.styles)return;delete Kx[t];let n=Mx(e),r=(eS||(eS=document.getElementById(`polotno-font-style`),eS||(eS=document.createElement(`style`),eS.id=`polotno-font-style`,document.head.appendChild(eS)),eS)).sheet;n.forEach(e=>{r.insertRule(`\n @font-face{\n font-family:'${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)}),$x[e.fontFamily]=!0}var nS=()=>typeof globalThis<`u`?globalThis.Buffer:void 0,rS=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=nS();if(t)return new Uint8Array(t.from(e,`base64`));throw Error(`No base64 decoder available`)},iS=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=nS();if(t)return t.from(e).toString(`base64`);throw Error(`No base64 encoder available`)},aS=[112,72,89,115],oS=(()=>{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})(),sS=(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},cS=(e,t,n)=>{let r=e.indexOf(`,`),i=rS(r>=0?e.slice(r+1):e);return`data:${t};base64,${iS(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);sS(r,0,t.length),r.set(aS,4),r.set(t,8);let i=new Uint8Array(4+t.length);return i.set(aS,0),i.set(t,4),sS(r,8+t.length,(e=>{let t=4294967295;for(let n=0;n<e.length;n++)t=oS[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,aS);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))}`},lS=({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}},uS=({px:e,precious:t=2,dpi:n=72,unit:r=`px`})=>parseFloat(lS({px:e,dpi:n,unit:r}).toFixed(t)),dS=({unitVal:e,dpi:t,unit:n})=>e/lS({px:1,unit:n,dpi:t}),fS=e=>{let t=parseFloat(lS(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 pS(e){for(let t=0;t<30;t++){let t=await e();if(t)return t;await new Promise(e=>setTimeout(e,50))}}var mS=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)},hS=hS||{};hS.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 hS=hS||{};hS.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&&(L(e.comma)||n(`Missing comma before color stops`)),{type:t,orientation:a,colorStops:S(C)}})}function s(t,r){var i=L(t);if(i){L(e.startCall)||n(`Missing (`);var a=r(i);return L(e.endCall)||n(`Missing )`),a}}function c(){var t=d();if(t)return t;var n=I(`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(I(`from`,/^from/,0)){var e=f();return e||n(`Missing angle after "from" in conic-gradient`),e}}function d(){return I(`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=L(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,L(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=I(`shape`,/^(circle)/i,0);return e&&(e.style=re()||v()),e}function _(){var e=I(`shape`,/^(ellipse)/i,0);return e&&(e.style=b()||P()||v()),e}function v(){return I(`extent-keyword`,e.extentKeywords,1)}function y(){if(I(`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);L(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 I(`literal`,e.literalColor,0)}function E(){return I(`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(L(e.comma)){var r=N();L(e.comma);var i=N(),a=[n,r,i];return L(e.comma)?(a.push(N()),{type:`rgba`,value:a}):{type:t,value:a}}var r=N(),i=N(),a=[n,r,i];return L(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){L(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(L(e.comma)){var i=L(e.percentageValue),a=i?i[1]:null;L(e.comma),i=L(e.percentageValue);var o=i?i[1]:null;if((!a||!o)&&n(`Expected percentage value for saturation and lightness in HSL`),L(e.comma)){var s=N();return{type:`hsla`,value:[r,a,o,s]}}return{type:t,value:[r,a,o]}}var i=L(e.percentageValue),a=i?i[1]:null;i=L(e.percentageValue);var o=i?i[1]:null;if((!a||!o)&&n(`Expected percentage value for saturation and lightness in HSL`),L(e.slash)){var s=N();return{type:`hsla`,value:[r,a,o,s]}}return{type:t,value:[r,a,o]}}function te(){return L(e.variableName)[1]}function N(){return L(e.number)[1]}function P(){return I(`%`,e.percentageValue,1)||F()||ne()||re()}function F(){return I(`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 R(r-1),{type:`calc`,value:a}})}function re(){return I(`px`,e.pixelValue,1)||I(`em`,e.emValue,1)||I(`rem`,e.remValue,1)||I(`vw`,e.vwValue,1)||I(`vh`,e.vhValue,1)||I(`vmin`,e.vminValue,1)||I(`vmax`,e.vmaxValue,1)||I(`ch`,e.chValue,1)||I(`ex`,e.exValue,1)}function I(e,t,n){var r=L(t);if(r)return{type:e,value:r[n]}}function L(e){var n,r=/^[\n\r\t\s]+/.exec(t);return r&&R(r[0].length),n=e.exec(t),n&&R(n[0].length),n}function R(e){t=t.substring(e)}return function(e){return t=e.toString().trim(),t.endsWith(`;`)&&(t=t.slice(0,-1)),r()}})(),hS.parse,hS.stringify;var gS={parse:hS.parse,stringify:hS.stringify};function _S(e){"@babel/helpers - typeof";return _S=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},_S(e)}var vS=/^\s+/,yS=/\s+$/;function bS(e,t){if(e||=``,t||={},e instanceof bS)return e;if(!(this instanceof bS))return new bS(e,t);var n=xS(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}bS.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=GS(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=TS(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=TS(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=CS(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=CS(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 DS(this._r,this._g,this._b,e)},toHexString:function(e){return`#`+this.toHex(e)},toHex8:function(e){return OS(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(KS(this._r,255)*100)+`%`,g:Math.round(KS(this._g,255)*100)+`%`,b:Math.round(KS(this._b,255)*100)+`%`,a:this._a}},toPercentageRgbString:function(){return this._a==1?`rgb(`+Math.round(KS(this._r,255)*100)+`%, `+Math.round(KS(this._g,255)*100)+`%, `+Math.round(KS(this._b,255)*100)+`%)`:`rgba(`+Math.round(KS(this._r,255)*100)+`%, `+Math.round(KS(this._g,255)*100)+`%, `+Math.round(KS(this._b,255)*100)+`%, `+this._roundA+`)`},toName:function(){return this._a===0?`transparent`:this._a<1?!1:US[DS(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t=`#`+kS(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?`GradientType = 1, `:``;if(e){var i=bS(e);n=`#`+kS(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 bS(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(NS,arguments)},brighten:function(){return this._applyModification(PS,arguments)},darken:function(){return this._applyModification(FS,arguments)},desaturate:function(){return this._applyModification(AS,arguments)},saturate:function(){return this._applyModification(jS,arguments)},greyscale:function(){return this._applyModification(MS,arguments)},spin:function(){return this._applyModification(IS,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(BS,arguments)},complement:function(){return this._applyCombination(LS,arguments)},monochromatic:function(){return this._applyCombination(VS,arguments)},splitcomplement:function(){return this._applyCombination(zS,arguments)},triad:function(){return this._applyCombination(RS,[3])},tetrad:function(){return this._applyCombination(RS,[4])}},bS.fromRatio=function(e,t){if(_S(e)==`object`){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]=r===`a`?e[r]:QS(e[r]));e=n}return bS(e,t)};function xS(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=rC(e)),_S(e)==`object`&&(nC(e.r)&&nC(e.g)&&nC(e.b)?(t=SS(e.r,e.g,e.b),o=!0,s=String(e.r).substr(-1)===`%`?`prgb`:`rgb`):nC(e.h)&&nC(e.s)&&nC(e.v)?(r=QS(e.s),i=QS(e.v),t=ES(e.h,r,i),o=!0,s=`hsv`):nC(e.h)&&nC(e.s)&&nC(e.l)&&(r=QS(e.s),a=QS(e.l),t=wS(e.h,r,a),o=!0,s=`hsl`),e.hasOwnProperty(`a`)&&(n=e.a)),n=GS(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 SS(e,t,n){return{r:KS(e,255)*255,g:KS(t,255)*255,b:KS(n,255)*255}}function CS(e,t,n){e=KS(e,255),t=KS(t,255),n=KS(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 wS(e,t,n){var r,i,a;e=KS(e,360),t=KS(t,100),n=KS(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 TS(e,t,n){e=KS(e,255),t=KS(t,255),n=KS(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 ES(e,t,n){e=KS(e,360)*6,t=KS(t,100),n=KS(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 DS(e,t,n,r){var i=[ZS(Math.round(e).toString(16)),ZS(Math.round(t).toString(16)),ZS(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 OS(e,t,n,r,i){var a=[ZS(Math.round(e).toString(16)),ZS(Math.round(t).toString(16)),ZS(Math.round(n).toString(16)),ZS($S(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 kS(e,t,n,r){return[ZS($S(r)),ZS(Math.round(e).toString(16)),ZS(Math.round(t).toString(16)),ZS(Math.round(n).toString(16))].join(``)}bS.equals=function(e,t){return!e||!t?!1:bS(e).toRgbString()==bS(t).toRgbString()},bS.random=function(){return bS.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function AS(e,t){t=t===0?0:t||10;var n=bS(e).toHsl();return n.s-=t/100,n.s=qS(n.s),bS(n)}function jS(e,t){t=t===0?0:t||10;var n=bS(e).toHsl();return n.s+=t/100,n.s=qS(n.s),bS(n)}function MS(e){return bS(e).desaturate(100)}function NS(e,t){t=t===0?0:t||10;var n=bS(e).toHsl();return n.l+=t/100,n.l=qS(n.l),bS(n)}function PS(e,t){t=t===0?0:t||10;var n=bS(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)))),bS(n)}function FS(e,t){t=t===0?0:t||10;var n=bS(e).toHsl();return n.l-=t/100,n.l=qS(n.l),bS(n)}function IS(e,t){var n=bS(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,bS(n)}function LS(e){var t=bS(e).toHsl();return t.h=(t.h+180)%360,bS(t)}function RS(e,t){if(isNaN(t)||t<=0)throw Error(`Argument to polyad must be a positive number`);for(var n=bS(e).toHsl(),r=[bS(e)],i=360/t,a=1;a<t;a++)r.push(bS({h:(n.h+a*i)%360,s:n.s,l:n.l}));return r}function zS(e){var t=bS(e).toHsl(),n=t.h;return[bS(e),bS({h:(n+72)%360,s:t.s,l:t.l}),bS({h:(n+216)%360,s:t.s,l:t.l})]}function BS(e,t,n){t||=6,n||=30;var r=bS(e).toHsl(),i=360/n,a=[bS(e)];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,a.push(bS(r));return a}function VS(e,t){t||=6;for(var n=bS(e).toHsv(),r=n.h,i=n.s,a=n.v,o=[],s=1/t;t--;)o.push(bS({h:r,s:i,v:a})),a=(a+s)%1;return o}bS.mix=function(e,t,n){n=n===0?0:n||50;var r=bS(e).toRgb(),i=bS(t).toRgb(),a=n/100;return bS({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})},bS.readability=function(e,t){var n=bS(e),r=bS(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)},bS.isReadable=function(e,t,n){var r=bS.readability(e,t),i,a=!1;switch(i=iC(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},bS.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=bS.readability(e,t[l]),a>i&&(i=a,r=bS(t[l]));return bS.isReadable(e,r,{level:s,size:c})||!o?r:(n.includeFallbackColors=!1,bS.mostReadable(e,[`#fff`,`#000`],n))};var HS=bS.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`},US=bS.hexNames=WS(HS);function WS(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function GS(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function KS(e,t){YS(e)&&(e=`100%`);var n=XS(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 qS(e){return Math.min(1,Math.max(0,e))}function JS(e){return parseInt(e,16)}function YS(e){return typeof e==`string`&&e.indexOf(`.`)!=-1&&parseFloat(e)===1}function XS(e){return typeof e==`string`&&e.indexOf(`%`)!=-1}function ZS(e){return e.length==1?`0`+e:``+e}function QS(e){return e<=1&&(e=e*100+`%`),e}function $S(e){return Math.round(parseFloat(e)*255).toString(16)}function eC(e){return JS(e)/255}var tC=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 nC(e){return!!tC.CSS_UNIT.exec(e)}function rC(e){e=e.replace(vS,``).replace(yS,``).toLowerCase();var t=!1;if(HS[e])e=HS[e],t=!0;else if(e==`transparent`)return{r:0,g:0,b:0,a:0,format:`name`};var n;return(n=tC.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=tC.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=tC.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=tC.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=tC.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=tC.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=tC.hex8.exec(e))?{r:JS(n[1]),g:JS(n[2]),b:JS(n[3]),a:eC(n[4]),format:t?`name`:`hex8`}:(n=tC.hex6.exec(e))?{r:JS(n[1]),g:JS(n[2]),b:JS(n[3]),format:t?`name`:`hex`}:(n=tC.hex4.exec(e))?{r:JS(n[1]+``+n[1]),g:JS(n[2]+``+n[2]),b:JS(n[3]+``+n[3]),a:eC(n[4]+``+n[4]),format:t?`name`:`hex8`}:(n=tC.hex3.exec(e))?{r:JS(n[1]+``+n[1]),g:JS(n[2]+``+n[2]),b:JS(n[3]+``+n[3]),format:t?`name`:`hex`}:!1}function iC(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 aC=e=>typeof e==`string`&&e.indexOf(`linear-gradient`)>=0,oC={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},sC=e=>e.type===`hex`?`#`+e.value:e.type===`literal`?e.value:`${e.type}(${e.value.join(`,`)})`,cC=e=>{if(!aC(e)){let t=bS(e).isValid()?e:`#000000`;return{rotation:0,stops:[{offset:0,color:t},{offset:1,color:t}]}}let t=gS.parse(e)[0],n=0;return t.orientation&&`value`in t.orientation&&(n=t.orientation.type===`directional`?oC[t.orientation.value]??0:parseFloat(t.orientation.value)||0),{rotation:n,stops:t.colorStops.map((e,n)=>({color:sC(e),offset:e.length?parseFloat(e.length.value)/100:t.colorStops.length>1?n/(t.colorStops.length-1):0}))}},lC=e=>cC(e).stops[0]?.color??`#000000`,uC=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)}},dC=e=>{if(!aC(e))return null;let{stops:t,rotation:n}=cC(e);return{...uC(n),stops:t}},fC=(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}),pC=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
|
+
`)}})),mC=n(((e,t)=>{pC()(`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}})),hC=n(((e,t)=>{pC()(`parse`);var n=mC();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})}})),gC=n(((e,t)=>{pC()(`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+`;`}})),_C=t(n(((e,t)=>{t.exports={lex:mC(),parse:hC(),stringify:gC()}}))(),1);function vC(e){for(;e.parentNode;){if(e.nodeName===`defs`)return!0;e=e.parentNode}return!1}function yC(e){let t={};return e.querySelectorAll(`style`).forEach(e=>{let n=_C.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 bC(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`);if(s&&s!==`none`?n.stroke=s:a.stroke&&a.stroke!==`none`&&(n.stroke=a.stroke),!n.fill&&e.style?.fill&&e.style.fill!==`none`&&(n.fill=e.style.fill),!n.stroke&&e.style?.stroke&&e.style.stroke!==`none`&&(n.stroke=e.style.stroke),!n.stroke&&!n.fill){let r=e.ownerSVGElement,i=r&&r!==e?bC(r,t):null;i?.fill!==`currentColor`&&i?.stroke!==`currentColor`&&(n.fill=`black`)}return n}var xC=/^url\(\s*['"]?#([^'")]+)['"]?\s*\)$/;function SC(e){return e.match(xC)?.[1]??null}function CC(e,t){let n=e.getElementById(t);return n&&n.nodeName===`linearGradient`?n:null}function wC(e,t){let n=parseFloat(e??``);return isNaN(n)?t:e.indexOf(`%`)>=0?n/100:n}function TC(e){let t=wC(e.getAttribute(`x1`),0),n=wC(e.getAttribute(`y1`),0),r=wC(e.getAttribute(`x2`),1),i=wC(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 EC(e){let t=[];for(let n of Array.from(e.children)){if(n.nodeName!==`stop`)continue;let e=n.getAttribute(`stop-color`)||n.style?.getPropertyValue(`stop-color`)||`black`,r=n.getAttribute(`stop-opacity`)??n.style?.getPropertyValue(`stop-opacity`),i=parseFloat(r);isNaN(i)||(e=IC(e,i));let a=Math.min(1,Math.max(0,wC(n.getAttribute(`offset`),0)));t.push(`${e} ${Math.round(a*1e4)/100}%`)}return t.length===0?null:`linear-gradient(${TC(e)}deg, ${t.join(`, `)})`}function DC(e,t){let n=CC(e,t),r=n&&EC(n);return r?{grad:n,serialized:r}:null}function OC(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 kC(e,t){let n=TC(e),{rotation:r,stops:i}=cC(t);if(OC(e,i),Math.abs(r-n)>.01){let{x1:t,y1:n,x2:i,y2:a}=uC(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 AC=[`path`,`rect`,`circle`,`line`,`polygon`,`polyline`,`ellipse`,`text`];function jC(e){for(var t=[],n=e.getElementsByTagName(`*`),r=0,i=n.length;r<i;r++){let e=n[r];vC(e)||(e.getAttribute(`fill`)!==null&&t.push(e),e.getAttribute(`stroke`)===null?(e.style&&e.style.fill||AC.indexOf(e.nodeName)>=0)&&t.push(e):t.push(e))}return t}var MC=(e,t)=>e?.code?e:o(`FETCH_FAILED`,`Failed to fetch ${t}`,{url:t},e),NC=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 PC(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:LC(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,${mS(e)}`}return LC(await t.text())}catch(t){throw MC(t,e)}})();return t&&(t.buffers.set(e,a),a.then(n=>t.buffers.set(e,n),()=>t.buffers.delete(e))),a}async function FC(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:`)?NC(e.split(`base64,`)[1]):e}let i=(async()=>{try{return(e.startsWith(`data:`)?e.slice(0,e.indexOf(`,`)+1):``).endsWith(`;base64,`)?NC(e.split(`base64,`)[1]):await(await n(e)).text()}catch(t){throw MC(t,e)}})();return t&&(t.buffers.set(e,i),i.then(n=>t.buffers.set(e,n),()=>t.buffers.delete(e))),i}function IC(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 LC(e){return`data:image/svg+xml;base64,`+btoa(unescape(encodeURIComponent(e)))}function RC(e){var t=vb.createDOMParser().parseFromString(e,`image/svg+xml`);return t.documentElement.setAttribute(`preserveAspectRatio`,`none`),vb.createXMLSerializer().serializeToString(t)}async function zC(e){let t=await FC(e),[n,r,i,a]=vb.createDOMParser().parseFromString(t,`image/svg+xml`).documentElement.getAttribute(`viewBox`)?.split(` `)||[];return{width:parseFloat(i),height:parseFloat(a)}}function BC(e){var t=vb.createDOMParser().parseFromString(e,`image/svg+xml`);let[n,r,i,a]=t.documentElement.getAttribute(`viewBox`)?.split(` `)||[],o=t.documentElement.getAttribute(`width`);o||t.documentElement.setAttribute(`width`,i+`px`);let s=t.documentElement.getAttribute(`height`);if((!s||s.indexOf(`%`)>=0)&&t.documentElement.setAttribute(`height`,a+`px`),o&&o.indexOf(`%`)>=0&&s&&s.indexOf(`%`)===-1){let e=parseFloat(s)/parseFloat(a);t.documentElement.setAttribute(`width`,e*parseFloat(i)+`px`)}if(s&&s.indexOf(`%`)>=0&&o&&o.indexOf(`%`)===-1){let e=parseFloat(o)/parseFloat(i);t.documentElement.setAttribute(`height`,e*parseFloat(a)+`px`)}return o===`100%`&&s===`100%`&&(t.documentElement.setAttribute(`width`,i+`px`),t.documentElement.setAttribute(`height`,a+`px`)),vb.createXMLSerializer().serializeToString(t)}var VC=(e,t)=>{if(!e||!t)return!1;if(t===`currentColor`&&e===`black`)return!0;if(aC(e)||aC(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 HC(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}=uC(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),OC(o,r),(e.querySelector(`defs`)||e.insertBefore(a.createElementNS(i,`defs`),e.firstChild)).appendChild(o)}function UC(e,t){var n=vb.createDOMParser().parseFromString(e,`image/svg+xml`);let r=jC(n),i=Array.from(t.keys()),a=yC(n);return r.forEach(e=>{let{fill:r,stroke:o}=bC(e,a);[{prop:`fill`,color:r},{prop:`stroke`,color:o}].forEach(({prop:r,color:a})=>{if(!e.style)return;let o=a&&SC(a),s=o?DC(n,o):null;if(o&&!s)return;s&&(a=s.serialized);let c=i.find(e=>VC(e,a));if(c){let i=t.get(c);if(aC(i)){if(s){kC(s.grad,i);return}let{rotation:t,stops:a}=cC(i),o=`color`+Math.round(Math.random()*1e8);HC(n.children[0],o,t,a),e.style[r]=null,e.setAttribute(r,`url('#${o}')`)}else e.style[r]=i}else return})}),vb.createXMLSerializer().serializeToString(n)}function WC(e,t){return LC(UC(e,t))}var GC=(e,t)=>o(`IMAGE_FAILED`,`Failed to load image: ${e}`,{reason:`load`,src:e},t);function KC(e){return new Promise((t,n)=>{let r=vb.createElement(`img`);r.onload=async()=>{if(r.width===0||r.height===0)try{t(await zC(e))}catch(t){n(GC(e,t))}else t({width:r.width,height:r.height})},r.onerror=t=>{n(GC(e,t))},r.crossOrigin=`anonymous`,r.src=e})}function qC(e){return new Promise((t,n)=>{let r=vb.createElement(`img`);r.onload=()=>{t(r)},r.onerror=t=>{n(GC(e,t))},r.crossOrigin=`anonymous`,r.src=e})}var JC=e=>!!e.stretchEnabled;function YC(e,t){let n=t.width*e.cropWidth,r=t.height*e.cropHeight,i=e.width/e.height,a=n/r,o,s;return JC(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 XC(e,t){let n=YC(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=JC(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,d=e.cropX*t.width*s,f=e.cropY*t.height*c;return e.flipX&&(d=(1-e.cropX-e.cropWidth)*t.width*s),e.flipY&&(f=(1-e.cropY-e.cropHeight)*t.height*c),{scaleX:s,scaleY:c,cropScaledX:d,cropScaledY:f,cropScaledWidth:l,cropScaledHeight:u}}async function ZC(e,t,n){let r=n??await qC(e),i=vb.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=vb.createElement(`canvas`);a.width=t.width,a.height=t.height;let o=a.getContext(`2d`),s=YC(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 QC(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||[]}),$C=async(e,t,n)=>e&&await e({dom:t,element:n})||t;function ew(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 tw=(e,t)=>{let n=ew(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})},nw=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})`},tw(e,e.startHead)),J(`g`,{transform:`translate(${e.width} ${e.height/2}) rotate(180)`},tw(e,e.endHead))];function rw(e){return!s.Util.colorToRGBA(e)&&!aC(e)}function iw(e){return[...e.filter(e=>!e.alwaysOnTop),...e.filter(e=>e.alwaysOnTop)]}var aw=({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`},ow=({width:e,height:t})=>`M ${e/2} 0 L ${e} ${t} L 0 ${t} Z`,sw=({width:e,height:t})=>`M 0 0 L ${e} 0 L 0 ${t} Z`,cw=({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 lw({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 uw({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 dw({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 pw={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 mw(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(!pw[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=pw[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 mw(e,n/t.width,r/t.height)}function hw({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 gw({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 _w={rect:aw,circle:cw,star:lw,triangle:ow,rightTriangle:sw,diamond:uw,pentagon:dw,hexagon:fw,speechBubble:hw,cross:gw,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 _w[e]||aw}function yw(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 bw(e){let{subType:t}=e,n=e,r=vw(t);return r?yw(n,r):(console.error(`Polotno error: Can not convert ${e.subType} figure to svg.`),aw(n))}function xw(e,t,n,r){let i=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return e.replace(RegExp(`${t}="${i}"`,`g`),`${t}="url(#${r})"`)}var Sw=null;function Cw(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 ww(){if(typeof DOMParser<`u`)return Sw||=new DOMParser,Sw;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 Tw(e){let t=ww().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 Ew=1,Dw=3;function Ow(e){let t=[],n=[];e=e.replace(/\/\*[\s\S]*?\*\//g,``);let r=0;for(;r<e.length;){for(;r<e.length&&/\s/.test(e[r]);)r++;if(r>=e.length)break;if(e[r]===`@`){let t=r,i=0;for(;r<e.length;){if(e[r]===`{`&&i++,e[r]===`}`&&(i--,i<=0)){r++;break}r++}let a=e.slice(t,r);a.startsWith(`@font-face`)&&n.push(a);continue}let i=r;for(;r<e.length&&e[r]!==`{`;)r++;if(r>=e.length)break;let a=e.slice(i,r).trim();r++;let o=r;for(;r<e.length&&e[r]!==`}`;)r++;let s=e.slice(o,r).trim();if(r++,!a)continue;let c=a.split(`,`).map(e=>e.trim()).filter(Boolean),l=[];for(let e of s.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&&l.push({property:n,value:r})}c.length>0&&l.length>0&&t.push({selectors:c,declarations:l})}return{rules:t,fontFaceRules:n}}function kw(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 Aw(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 jw(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 Mw(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(Aw),o=a[a.length-1],s=o.tag;return{parts:a,combinators:r,rightmost:o,rightmostIsRoot:s===`html`||s===`body`,spec:kw(e),pseudoElement:t}}function Nw(e,t){if(e.rightmostIsRoot){if(t.parent!==null)return!1}else if(!jw(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(jw(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(jw(r,n)){n=n.parent,e=!0;break}n=n.parent}if(!e)return!1}}return!0}function Pw(){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:[],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,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`,flexDirection:`row`,gap:0,flexGrow:0,listStyleType:`disc`,lineClamp:0}}var Fw={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 Iw(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 Lw(e){if(e===`bold`)return 700;if(e===`normal`)return 400;let t=parseInt(e,10);return isNaN(t)?400:t}function Rw(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 zw(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 Bw(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=t.trim().split(/\s+/),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===`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`}];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=[],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-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=zw(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().split(/\s+/),n=parseFloat(e[0]);return isNaN(n)?[]:[{property:`flex-grow`,value:String(n)}]}return e===`border-collapse`||e===`border-spacing`?[]:[{property:e,value:t}]}function Vw(e){let t=e.trim();return t.toLowerCase()===`currentcolor`?``:t}function Hw(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=Lw(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=Iw(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-shadow`:e.textShadow=n.trim();break;case`-webkit-text-stroke-width`:e.webkitTextStrokeWidth=Iw(n,o,i);break;case`-webkit-text-stroke-color`:e.webkitTextStrokeColor=Vw(n);break;case`--rt-text-stroke-image`:e.webkitTextStrokeImage=n.trim();break;case`-webkit-text-fill-color`:e.webkitTextFillColor=Vw(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:Iw(n,o,i);break;case`word-spacing`:e.wordSpacing=n.trim()===`normal`?0:Iw(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=Iw(t,o,i));break}case`min-height`:e.minHeight=Iw(n,o,i);break;case`padding-top`:e.paddingTop=Iw(n,o,i);break;case`padding-right`:e.paddingRight=Iw(n,o,i);break;case`padding-bottom`:e.paddingBottom=Iw(n,o,i);break;case`padding-left`:e.paddingLeft=Iw(n,o,i);break;case`margin-top`:e.marginTop=Iw(n,o,i);break;case`margin-right`:e.marginRight=Iw(n,o,i);break;case`margin-bottom`:e.marginBottom=Iw(n,o,i);break;case`margin-left`:e.marginLeft=Iw(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=Iw(n,o,i):e.paddingLeft=Iw(n,o,i);break;case`padding-inline-end`:a===`rtl`?e.paddingLeft=Iw(n,o,i):e.paddingRight=Iw(n,o,i);break;case`margin-inline-start`:a===`rtl`?e.marginRight=Iw(n,o,i):e.marginLeft=Iw(n,o,i);break;case`margin-inline-end`:a===`rtl`?e.marginLeft=Iw(n,o,i):e.marginRight=Iw(n,o,i);break;case`border-top-width`:e.borderTopWidth=Iw(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=Iw(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=Iw(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=Iw(n,o,i);break;case`border-left-color`:e.borderLeftColor=n.trim();break;case`border-left-style`:e.borderLeftStyle=n.trim();break;case`flex-direction`:e.flexDirection=n.trim();break;case`gap`:e.gap=Iw(n,o,i);break;case`flex-grow`:e.flexGrow=parseFloat(n)||0;break;case`list-style-type`:e.listStyleType=n.trim()}}var Uw=[[`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`],[`paint-order`,`paintOrder`],[`stroke-linejoin`,`strokeLinejoin`],[`-webkit-text-stroke-width`,`webkitTextStrokeWidth`],[`-webkit-text-stroke-color`,`webkitTextStrokeColor`],[`-webkit-text-fill-color`,`webkitTextFillColor`]];function Ww(e,t,n){for(let[r,i]of Uw)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 e[i]=t[i]}}function Gw(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=Bw(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=Mw(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 Kw(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`${qw(e).toLowerCase()}.`;case`upper-roman`:return`${qw(e)}.`;case`lower-alpha`:case`lower-latin`:return`${Jw(e).toLowerCase()}.`;case`upper-alpha`:case`upper-latin`:return`${Jw(e)}.`;default:return`${e}.`}}function qw(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 Jw(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 Yw(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 Kw(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 Kw(c,t||`decimal`);c+=s}return Kw(c,t||`decimal`)}}function Xw(e){let t=e.style;return t&&typeof t.cssText==`string`?t:null}function Zw(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 Qw(e,t,n){let{rules:r,fontFaceRules:i}=Ow(t),a=null;i.length>0&&typeof document<`u`&&document.head&&(a=document.createElement(`style`),a.textContent=i.join(`
|
|
132
|
+
`),document.head.appendChild(a));let o=Gw(r),s=e.ownerDocument.createElement(`div`);s.appendChild(e);function c(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 l(e,t,r){let i=e.tagName.toLowerCase(),a=c(e,r),s=Pw(),l=new Set,d=[],f=new Set,p=o.byTag.get(i);if(p)for(let e of p)f.add(e),d.push(e);for(let e of a.classes){let t=o.byClass.get(e);if(t)for(let e of t)f.has(e)||(f.add(e),d.push(e))}for(let e of o.universal)f.has(e)||(f.add(e),d.push(e));let m=[],h=[];for(let e of d)if(Nw(e.selector,a)){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=Fw[i],_=!1;if(g?.fontSize!==void 0){let e=g.fontSize;s.fontSize=e<10?e*t.fontSize:e,_=!0,l.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`&&(Hw(s,e.property,e.value,t.fontSize,n,t.direction),_=!0);let v=Xw(e);if(v&&v.cssText){let e=Zw(v.cssText);for(let r of e)r.property===`font-size`&&(Hw(s,r.property,r.value,t.fontSize,n,t.direction),_=!0)}_||(s.fontSize=t.fontSize);let y=s.fontSize;if(g){for(let[e,t]of Object.entries(g)){if(e===`fontSize`)continue;s[e]=t;let n=e.replace(/[A-Z]/g,e=>`-`+e.toLowerCase());l.add(n)}s.marginTop<0&&(s.marginTop=Math.abs(s.marginTop)*y),s.marginBottom<0&&(s.marginBottom=Math.abs(s.marginBottom)*y),(i===`ul`||i===`ol`)&&(t.direction===`rtl`?(s.paddingRight=40,l.add(`padding-right`)):(s.paddingLeft=40,l.add(`padding-left`)))}let b=t.direction,x={"word-wrap":`overflow-wrap`};for(let e of m)e.property!==`font-size`&&(Hw(s,e.property,e.value,y,n,b),l.add(x[e.property]||e.property));let S=!!v?.width;if(v&&v.cssText){let e=Zw(v.cssText);for(let t of e){if(t.property===`font-size`){l.add(`font-size`);continue}let e=Bw(t.property,t.value);for(let t of e)Hw(s,t.property,t.value,y,n,b),l.add(x[t.property]||t.property)}}S||(s.width=0);let C=e.getAttribute(`dir`);C&&(s.direction=C,l.add(`direction`)),l.add(`font-size`),Ww(s,t,l),l.has(`text-decoration-color`)?s.textDecorationColor===`currentColor`&&(s.textDecorationColor=s.color):s.textDecorationColor=s.webkitTextFillColor||s.color;for(let e of[`Top`,`Right`,`Bottom`,`Left`]){let t=`border${e}Color`,n=`border-${e.toLowerCase()}-color`;l.has(n)?s[t]===`currentColor`&&(s[t]=s.color):s[t]=s.color}let w=[];if(s.textDecorationLine&&s.textDecorationLine!==`none`)for(let e of s.textDecorationLine.split(/\s+/))e&&e!==`none`&&w.push({line:e,color:s.textDecorationColor,style:s.textDecorationStyle});s.textDecorations=t.textDecorations.length?[...t.textDecorations,...w]:w;let T=new Set(s.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&&(s.textDecorationLine=[...T].join(` `));let E=Yw(e,s.listStyleType),D,O=!1;if(i===`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={...s},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]);Hw(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=u(t,s,a);e&&ee.push(e)}return{element:e,tagName:i,style:s,children:ee,textContent:null,listMarker:E,markerStyle:D,markerHidden:O||void 0}}function u(e,t,n){if(e.nodeType===Dw){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!==Ew)return e?.nodeType===Dw;let t=Fw[e.tagName.toLowerCase()]?.display||`block`;return t===`inline`||t===`inline-block`};if(i&&a&&!o(i)&&!o(a)&&r!==`pre`&&r!==`pre-wrap`&&r!==`pre-line`||r!==`pre`&&r!==`pre-wrap`&&r!==`pre-line`&&n.includes(`
|
|
133
|
+
`))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!==Ew)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:`
|
|
134
|
+
`}:l(r,t,n)}return{tree:l(s,Pw(),null),cleanup:()=>{a&&a.remove()}}}var $w=!0,eT,tT=[],nT=new Map;function rT(e,t){let n=e.font+`\0`+(e.letterSpacing||``)+`\0`+t,r=nT.get(n);if(r!==void 0)return r;let i=e.measureText(t).width;return nT.set(n,i),i}function iT(e){let t=``;for(let n of e){if(!n.text||n.isSpace)continue;let e=cT(n.style);if(t&&e!==t)return!0;t=e}return!1}function aT(e,t){e.font=cT(t),e.fontKerning=t.fontKerning===`none`?`none`:`normal`}function oT(e){return Number.isFinite(e)&&e!==0?`${e}px`:`0px`}var sT=new Map;function cT(e){let t=`${e.fontStyle}|${e.fontVariantCaps}|${e.fontWeight}|${e.fontSize}|${e.fontFamily}`,n=sT.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 sT.set(t,i),i}var lT=new Map,uT=null,dT=null,fT=null,pT=new Set([`disc`,`circle`,`square`]);function mT(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?(dT||(dT=document.createElement(`ul`),dT.style.cssText=`position:absolute;top:-9999px;left:-9999px;visibility:hidden;padding:0;margin:0;border:0;list-style:disc;`,fT=document.createElement(`li`),fT.style.cssText=`white-space:nowrap;padding:0;margin:0;border:0;`,fT.textContent=`Mg`,dT.appendChild(fT),document.body.appendChild(dT)),a=fT):(uT||(uT=document.createElement(`div`),uT.style.cssText=`position:absolute;top:-9999px;left:-9999px;visibility:hidden;white-space:nowrap;padding:0;margin:0;border:0;`,uT.textContent=`Mg`,document.body.appendChild(uT)),a=uT),a.style.font=e,a.style.lineHeight=t;let o=a.getBoundingClientRect().height;return lT.set(r,o),o}function hT(e,t,n=!1){if(t.lineHeight>0)return $w?mT(cT(t),`${t.lineHeight}px`,n):t.lineHeight;if($w)return mT(cT(t),`normal`,n);let{ascent:r,descent:i}=ST(e,t);return r+i}function gT(e,t,n){let{ascent:r,descent:i}=ST(e,t);return(r-i)/2+n/2}function _T(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 vT(e){if(e.tagName===`#text`)return!0;let t=e.style.display;return t===`inline`||t===`inline-block`}function yT(e){return e.children.length>0&&e.children.every(vT)}function bT(e){return!e||e===`transparent`||e===`rgba(0, 0, 0, 0)`}var xT=new Map;function ST(e,t){let n=cT(t),r=xT.get(n);if(r)return r;e.font=n;let i=e.measureText(`M`),a={ascent:i.fontBoundingBoxAscent??i.actualBoundingBoxAscent,descent:i.fontBoundingBoxDescent??i.actualBoundingBoxDescent};return xT.set(n,a),a}function CT(e,t,n,r,i,a,o){switch(e){case`super`:return-r*.4;case`sub`:return r*.26;case`text-top`:return-(i-t);case`text-bottom`:return a-n;case`middle`:return-(r*.25)-(n-t)/2;default:{let t=parseFloat(e);return Number.isFinite(t)?e.endsWith(`%`)?-(t/100)*o:-t:0}}}function wT(e){return e!==`baseline`&&e!==`top`&&e!==`bottom`&&e!==``}function TT(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)return!1;return!0}function ET(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&&TT(e,t)&&e.backgroundColor===t.backgroundColor}function DT(e){return!bT(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 OT(e){return e.webkitBackgroundClip===`text`&&(!!e.backgroundImage&&e.backgroundImage!==`none`||!bT(e.backgroundColor))}function kT(e){return!!(e.boxOpen&&e.boxClose&&e.text)}function AT(e,t,n){let r=t.words.length-1;for(;r>=0&&(t.words[r].text===``||kT(t.words[r]));)r--;if(r<0)return;let i=t.words[r].style,a=t.words[r].boxStyle;aT(e,i),e.letterSpacing=`${i.letterSpacing||0}px`;let o=rT(e,`…`),s=()=>{for(;t.words.length>0&&t.words[t.words.length-1].isSpace;){let e=t.words.pop();t.totalWidth-=e.width}};s();let c=e=>!e.isSpace&&e.text!==``&&!e.boxOpen&&!e.boxClose;for(;t.totalWidth+o>n&&t.words.length>0;){let e=t.words[t.words.length-1];if(!c(e)&&!kT(e))break;t.totalWidth-=e.width,t.words.pop(),s()}let l={text:`…`,width:o,style:i,isSpace:!1,boxStyle:a};t.words.push(l),t.totalWidth+=o}function jT(e){let t=[];function n(e,r,i,a){if(e.tagName===`#text`&&e.textContent){t.push({text:e.textContent,style:e.style,boxStyle:r,clipStyle:i,strokeImageStyle:a});return}let o=e.style.display===`inline-block`,s=o||vT(e)&&DT(e.style),c=s?e.style:r,l=vT(e)&&OT(e.style)?e.style:i,u=vT(e)&&e.style.webkitTextStrokeImage&&e.style.webkitTextStrokeImage!==`none`?e.style:a,d=s&&(e.style.paddingLeft>0||e.style.paddingRight>0||e.style.borderLeftWidth>0||e.style.borderRightWidth>0);if(o){let n=e.element?.textContent||``;t.push({text:n,style:e.style,boxStyle:c,clipStyle:l,strokeImageStyle:u,boxOpen:e.style,boxClose:e.style});return}let f=e.style.unicodeBidi,p=(f===`bidi-override`||f===`isolate-override`)&&e.style.direction===`rtl`,m=t.length;d&&t.push({text:``,style:e.style,boxStyle:c,boxOpen:e.style});for(let t of e.children)n(t,s?c:r,l,u);if(d&&t.push({text:``,style:e.style,boxStyle:c,boxClose:e.style}),p&&t.length>m){let e=t.splice(m);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);return t}function MT(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 NT;function PT(){return NT||(typeof Intl<`u`&&Intl.Segmenter?(NT=new Intl.Segmenter(void 0,{granularity:`word`}),NT):null)}function FT(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;FT(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)/),a=rT(e,` `)*8;for(let t of i){if(t===``)continue;if(t===` `){r.push({text:` `,width:a,style:n.style,isSpace:!0,isTab:!0,boxStyle:n.boxStyle,clipStyle:n.clipStyle,strokeImageStyle:n.strokeImageStyle});continue}let i=/^ +$/.test(t);r.push({text:t,width:rT(e,t),style:n.style,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(/(?<=\?)(?=.)/)),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,isSpace:!0,boxStyle:n.boxStyle,clipStyle:n.clipStyle,strokeImageStyle:n.strokeImageStyle});continue}if(MT(t)){let i=PT();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,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=rT(e,t);eT&&eT({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,isSpace:!1,boxStyle:n.boxStyle,clipStyle:n.clipStyle,strokeImageStyle:n.strokeImageStyle})}i&&(i.cumText=o,i.cumWidth=s)}}function IT(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){aT(e,r.style),e.letterSpacing=oT(r.style.letterSpacing);let t=_T(r.text,r.style.textTransform),i=r.style,a=rT(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,isSpace:!1,boxStyle:r.boxStyle,boxOpen:r.boxOpen,boxClose:r.boxClose,clipStyle:r.clipStyle,strokeImageStyle:r.strokeImageStyle});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}aT(e,r.style),e.letterSpacing=oT(r.style.letterSpacing);let t=_T(r.text,r.style.textTransform),i=e=>{let t=n[e];if(!t||t.isSpace||!t.text||t.text===`
|
|
135
|
+
`)return;let r=n[e-1];if(!r||r.isSpace||!r.text.trim()||r.boxOpen||r.boxClose)return;let i=BT(t.text)[0],a=BT(r.text),o=a[a.length-1];LT(i)||LT(o)||HT(i)||HT(o)||MT(t.text)||MT(r.text)||(t.noBreakBefore=!0)};if(t.includes(`
|
|
136
|
+
`)){let a=t.split(`
|
|
137
|
+
`);for(let t=0;t<a.length;t++)if(t>0&&n.push({text:`
|
|
138
|
+
`,width:0,style:r.style,isSpace:!1,boxStyle:r.boxStyle}),a[t]){let o=n.length;FT(e,a[t],r,n),i(o)}}else{let a=n.length;FT(e,t,r,n),i(a)}}return n}function LT(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 RT;function zT(){return RT||(typeof Intl<`u`&&Intl.Segmenter?(RT=new Intl.Segmenter(void 0,{granularity:`grapheme`}),RT):null)}function BT(e){let t=zT();return t?[...t.segment(e)].map(e=>e.segment):[...e]}var VT=/\p{Extended_Pictographic}/u;function HT(e){for(let t of e)if(t.codePointAt(0)>=126976)return!0;return e.includes(``)||e.includes(`️`)?VT.test(e):!1}function UT(e,t,n,r){let i=[...t.text].some(LT),a=VT.test(t.text)&&!!zT(),o=t.width>n&&(t.style.overflowWrap===`break-word`||t.style.wordBreak===`break-all`);if(!i&&!a&&!o)return[t];if(o&&t.style.wordBreak!==`break-all`&&t.style.overflowWrap===`break-word`){let r=t.text.split(/(?<=-)(?!\d)|(?<=[^\d]-)/).filter(e=>e.length);if(r.length>1){e.font=cT(t.style),e.letterSpacing=oT(t.style.letterSpacing);let i=[];for(let a of r){let r=rT(e,a);r<=n?i.push({...t,text:a,width:r}):i.push(...UT(e,{...t,text:a,width:r},n,0))}return i}}e.font=cT(t.style),e.letterSpacing=oT(t.style.letterSpacing);let s=a?BT(t.text):[...t.text],c=[],l=``,u=0;for(let r of s){if(a&&HT(r)){l&&(c.push({...t,text:l,width:u}),l=``,u=0),c.push({...t,text:r,width:rT(e,r)});continue}if(LT(r)){l&&(c.push({...t,text:l,width:u}),l=``,u=0);let n=rT(e,r);c.push({...t,text:r,width:n});continue}let i=l+r,s=rT(e,i);if(o&&s>n&&l){c.push({...t,text:l,width:u}),l=r,u=rT(e,r);continue}l=i,u=s}return l&&c.push({...t,text:l,width:u}),c}var WT=/^[,.\;:!?\)\]\}'"»›]+$/;function GT(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){aT(e,t.style);let n=rT(e,`-`);u.words.push({text:`-`,width:n,style:t.style,isSpace:!1,clipStyle:t.clipStyle,strokeImageStyle:t.strokeImageStyle}),u.totalWidth+=n}}if(u.words.length>0||i&&p){if(eT){let e=u.words.map(e=>e.text).join(``);eT({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=hT(e,s.style,i);if(s.boxStyle&&s.boxStyle.display===`inline-block`){let e=s.boxStyle;p=Math.max(p,p+e.paddingTop+e.paddingBottom+e.marginTop+e.marginBottom+e.borderTopWidth+e.borderBottomWidth)}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,clipStyle:t[e].clipStyle,strokeImageStyle:t[e].strokeImageStyle});let l=c.map(e=>e.ch).join(``).split(/(?<=-)(?!\d)|(?<=[^\d]-)/).filter(e=>e.length),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;aT(e,a),e.letterSpacing=oT(a.letterSpacing);let c=hT(e,a,i),l=``,d=0;for(;r<t.length&&t[r].style===a;){let i=t[r].ch,p=rT(e,l+i);n&&u.totalWidth+p>f()&&(u.words.length>0||l)?(l&&(u.words.push({text:l,width:d,style:a,isSpace:!1,clipStyle:o,strokeImageStyle:s}),u.totalWidth+=d,u.lineHeight=Math.max(u.lineHeight,c)),h(!0),g=!1,l=i,d=rT(e,i)):(l+=i,d=p),r++}l&&(u.words.push({text:l,width:d,style:a,isSpace:!1,clipStyle:o,strokeImageStyle:s}),u.totalWidth+=d,u.lineHeight=Math.max(u.lineHeight,c),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++;aT(e,i),e.letterSpacing=oT(i.letterSpacing),n+=rT(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?UT(e,s,f(),u.totalWidth):[s],v=0;for(let e=r+1;e<t.length;e++){let n=t[e];if(n.isSpace||n.text===`
|
|
140
|
+
`)break;let r=!!n.text&&WT.test(n.text),i=!n.text&&!!n.boxClose,a=!!n.text&&!!n.noBreakBefore;if(r||i||a){v+=n.width;continue}break}for(let i of _){let s=i===_[_.length-1]?v:0,l=!i.isSpace&&i.text.length>0&&WT.test(i.text)&&u.words.length>0&&!u.words[u.words.length-1].isSpace,d=i===_[0]&&i.noBreakBefore&&u.words.length>0&&!u.words[u.words.length-1].isSpace,y=0;if(!i.text&&i.boxOpen){let n=t[r+1];n&&!n.isSpace&&n.text&&(y=(n.text.length>1?UT(e,n,f(),0):[n])[0].width)}let b=0;if(i.isSoftHyphenBreak&&(aT(e,i.style),e.letterSpacing=oT(i.style.letterSpacing),b=rT(e,`-`)),!i.isSpace&&!l&&!d&&u.words.length>0&&u.totalWidth+i.width+b+s+y>f()){let t=u.totalWidth+i.width+b+s+y-f(),r=!0;if(t<1&&!iT([...u.words,i])){aT(e,i.style);let t=u.words.map(e=>e.text).join(``)+i.text+(i.isSoftHyphenBreak?`-`:``),n=0;for(let e of u.words)e.text||(n+=e.width);i.text||(n+=i.width),rT(e,t)+n+s+y<=f()+.02&&(r=!1)}if(r&&i.text.includes(`-`)){let t=i.text.split(/(?<=-)(?!\d)|(?<=[^\d]-)/);if(t.length>1){aT(e,i.style);let n=``,r=0,a=0,o=f()-u.totalWidth;for(;a<t.length;a++){let i=n+t[a],s=rT(e,i);if(s>o)break;n=i,r=s}if(a>0&&a<t.length){u.words.push({...i,text:n,width:r}),u.totalWidth+=r,u.lineHeight=Math.max(u.lineHeight,p),h(!0),g=!1;let o=t.slice(a).join(``),s=rT(e,o);u.words.push({...i,text:o,width:s}),u.totalWidth+=s,u.lineHeight=Math.max(u.lineHeight,p);continue}}}if(r){if(eT){let e=u.words.map(e=>e.text).join(``);eT({type:`line-wrap`,message:`"${i.text}" overflow=${t.toFixed(2)} wrap=true lineWidth=${u.totalWidth.toFixed(2)} pieceWidth=${i.width.toFixed(2)} contentWidth=${n} line="${e}"`,data:{text:i.text,overflow:t,lineWidth:u.totalWidth,pieceWidth:i.width,contentWidth:n,lineText:e}})}h(!0),g=!1}}if(i.isSpace&&u.words.length===0&&(!g||!m))continue;let x=i.width;if(i.isTab){let e=o?.interval||i.width,t=o?.halfSpace??0,n=e-((c.length===0?a:0)+u.totalWidth)%e;n<t&&(n+=e),x=n,i.width=x}if(u.words.length===0&&x>f()&&!i.isSpace&&i.text.includes(`-`)){let t=i.text.split(/(?<=-)(?!\d)|(?<=[^\d]-)/);if(t.length>1){aT(e,i.style);let n=t.filter(e=>e).map(t=>({...i,text:t,width:rT(e,t)})),r=!0;for(let e of n)r?(r=!1,u.words.push(e),u.totalWidth+=e.width,u.lineHeight=Math.max(u.lineHeight,p)):u.totalWidth+e.width>f()?(h(!0),g=!1,u.words.push(e),u.totalWidth+=e.width,u.lineHeight=Math.max(u.lineHeight,p)):(u.words.push(e),u.totalWidth+=e.width,u.lineHeight=Math.max(u.lineHeight,p));continue}}u.words.push(i),u.totalWidth+=x,u.lineHeight=Math.max(u.lineHeight,p),i.isSpace||(g=!1)}}return h(),c}function KT(e,t,n,r,i,a=!1,o){let s=[],c=new Map,l=new Map;if(o&&(o.exhausted||o.remaining<=0))return o.exhausted=!0,{nodes:s,height:0};let u=jT(t);if(u.length===0)return{nodes:s,height:0};let d=IT(e,u),f=t.style.textIndent||0;aT(e,t.style);let p=e.letterSpacing;e.letterSpacing=`0px`;let m=rT(e,` `);e.letterSpacing=p;let h={interval:(m+(t.style.letterSpacing||0)+(t.style.wordSpacing||0))*8,halfSpace:m/2},g=hT(e,t.style,a),_=GT(e,d,i,t.style.whiteSpace,a,f,h,g),v=o?o.remaining:t.style.lineClamp;if(v>0&&_.length>v){_.length=v;let t=_[v-1];AT(e,t,i-(v===1?f:0)),t.endedByHardBreak=!0,o&&(o.remaining=0,o.exhausted=!0)}else o&&(o.remaining-=_.length);let y=t.style.direction===`rtl`,b=e=>e===`start`?y?`right`:`left`:e===`end`?y?`left`:`right`:e,x=b(t.style.textAlign),S=t.style.textAlignLast||`auto`;S=S===`auto`?t.style.textAlign===`justify`?y?`right`:`left`:x:b(S);let C=ST(e,t.style),w=r;for(let t=0;t<_.length;t++){let r=_[t];if(r.words.length===0){w+=r.lineHeight;continue}let a=r.lineHeight,o=t===_.length-1,u=t===0,d=o||r.endedByHardBreak?S:x,p=u?f:0,m=i-p,h=0;if(d===`justify`&&r.totalWidth<m){let e=r.words.filter(e=>e.isSpace).length;e>0&&(h=(m-r.totalWidth)/e)}let g=r.totalWidth>m+.5,v=n+p;g?v=y?n+m-r.totalWidth:n+p:d===`center`?v=n+p+(m-r.totalWidth)/2:d===`right`?v=(y?n+m:n+p+m)-r.totalWidth:d===`justify`&&y&&(v=n+m-r.totalWidth);let b=v,T=C.ascent,E=C.descent;for(let t of r.words){if(t.text===``||wT(t.style.verticalAlign))continue;let{ascent:n,descent:r}=ST(e,t.style);n>T&&(T=n),r>E&&(E=r)}if(T===0)for(let t of r.words){if(t.text===``)continue;let{ascent:n,descent:r}=ST(e,t.style);T=n,E=r;break}let D=T+E,O=w+(a-D)/2+T,ee=r.words.filter(e=>e.text!==``&&!wT(e.style.verticalAlign)),k=ee.length>0?Math.max(...ee.map(e=>e.style.fontSize)):0,A=w,j=w+a;for(let t of r.words){if(t.text===``)continue;let n=t.style.verticalAlign;if(!wT(n))continue;if(k===0)break;let{ascent:r,descent:i}=ST(e,t.style),o=O+CT(n,r,i,k,T,E,a),s=o-r,c=o+i;s<A&&(A=s),c>j&&(j=c)}let M=j-A,te=(t,n,r)=>{let{ascent:i,descent:a}=ST(e,t),o=t.paddingTop+t.borderTopWidth,c=t.paddingBottom+t.borderBottomWidth,l=i+a+o+c,u;u=t.display===`inline-block`?w+t.marginTop:O-i-o,s.push({type:`box`,style:t,x:n,y:u,width:r,height:l,tagName:`span`,children:[]})};if(!y){let e=v,t=e,n,i=!1;for(let a of r.words){if(a.boxOpen&&a.boxClose&&a.text){n&&(i&&te(n,t,e-t),n=void 0,i=!1);let r=a.style,o=a.width-r.marginLeft-r.borderLeftWidth-r.paddingLeft-r.paddingRight-r.borderRightWidth-r.marginRight;te(r,e+r.marginLeft,r.borderLeftWidth+r.paddingLeft+o+r.paddingRight+r.borderRightWidth),i=!1,e+=a.width;continue}a.boxStyle!==n&&(n&&i&&te(n,t,e-t),n=a.boxStyle,t=e,i=!1),a.text&&!a.isSpace&&(i=!0),e+=a.width+(a.isSpace?h:0)}n&&i&&te(n,t,e-t)}let N=r.words.filter(e=>e.text!==``),P=N.length>0&&N.every(e=>ET(e.style,N[0].style));if(y){let t=[],n=null,i=0;for(let e of r.words){if(e.text===``){n&&=(t.push(n),null),i+=e.width;continue}if(e.isSpace&&h>0){n&&=(t.push(n),null),i+=e.width+h;continue}n&&ET(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:i},i=0)}n&&t.push(n);let a=v+r.totalWidth;for(let n of t){a-=n.padBefore,aT(e,n.style);let t=rT(e,n.text);a-=t,n.x=a,n.width=t}for(let e of t)if(e.boxStyle&&DT(e.boxStyle)){let t=e.boxStyle,n=t.paddingLeft+t.borderLeftWidth,r=t.paddingRight+t.borderRightWidth;te(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:O,width:e.width,style:{...e.style,direction:`rtl`}};s.push(t),e.clipStyle&&c.set(t,e.clipStyle),e.strokeImageStyle&&l.set(t,e.strokeImageStyle)}}else{let t=r.words.map(e=>e.text).join(``);if(P&&/[\u0590-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/.test(t)&&!r.words.some(e=>e.boxOpen||e.boxClose||e.style.verticalAlign===`super`||e.style.verticalAlign===`sub`)){aT(e,N[0].style);let n=rT(e,t),r={type:`text`,text:t,x:v,y:O,width:n,style:{...N[0].style,direction:`ltr`}};s.push(r),N[0].clipStyle&&c.set(r,N[0].clipStyle),N[0].strokeImageStyle&&l.set(r,N[0].strokeImageStyle)}else for(let t of r.words){if(t.text===``){v+=t.width;continue}if(t.boxOpen&&t.boxClose){let n=t.style,r=v+n.marginLeft+n.borderLeftWidth+n.paddingLeft,i={type:`text`,text:t.text,x:r,y:O,width:rT(e,t.text),style:t.style};s.push(i),t.clipStyle&&c.set(i,t.clipStyle),t.strokeImageStyle&&l.set(i,t.strokeImageStyle),v+=t.width;continue}let n=O,r=t.style.verticalAlign;if(wT(r)){let i=k||t.style.fontSize,{ascent:o,descent:s}=ST(e,t.style);n+=CT(r,o,s,i,T,E,a)}let i=t.width+(t.isSpace?h:0),o={type:`text`,text:t.text,x:v,y:n,width:i,style:t.style};s.push(o),t.clipStyle&&c.set(o,t.clipStyle),t.strokeImageStyle&&l.set(o,t.strokeImageStyle),v+=i}}let F=d===`justify`&&h>0?m:r.totalWidth;tT.push({y:Math.round(O),text:r.words.map(e=>e.text).join(``),bounds:{x:b,y:A,width:F,height:M}}),w+=M}return qT(e,s,c,(e,t,n)=>{e.clip={image:t.backgroundImage&&t.backgroundImage!==`none`?t.backgroundImage:void 0,color:bT(t.backgroundColor)?void 0:t.backgroundColor,...n}}),qT(e,s,l,(e,t,n)=>{e.strokeImage={image:t.webkitTextStrokeImage,...n}}),{nodes:s,height:w-r}}function qT(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}=ST(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 JT(e,t){return e>=0&&t>=0?Math.max(e,t):e<0&&t<0?Math.min(e,t):e+t}function YT(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=ZT(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=XT(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(yT(t)){let{nodes:n,height:r}=KT(e,t,y,S,b,t.tagName===`li`&&pT.has(o.listStyleType),a);C.children=n,C.height=d+h+r+g+f}else{let n=S,r=0,i=!1,s=t.tagName===`li`||t.tagName===`ul`||t.tagName===`ol`||t.tagName===`dd`||t.tagName===`dt`;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`||vT(l)){let s=[l];for(;c+1<t.children.length;){let e=t.children[c+1];if(e.tagName===`#text`||vT(e))s.push(e),c++;else break}r>0&&(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`&&pT.has(o.listStyleType),{nodes:f,height:p}=KT(e,u,y,n,b,d,a);C.children.push(...f),n+=p,r=0,i=!0;continue}let u=l.style.marginTop;if(!(!i&&h===0&&d===0&&s)){let e=JT(r,u);n+=e}let{box:f,height:p,marginBottomOut:m}=YT(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&&s;l&&r>0&&(c=Math.max(o.marginBottom,r));let u=n-S;return!l&&r>0&&(u+=r),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 XT(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}=YT(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}}function ZT(e,t,n,r,i){let a=t.style,o=a.gap,s=[],c=t.children.filter(e=>e.tagName!==`#text`||e.textContent?.trim());if(c.length===0)return{children:s,height:0};if(a.flexDirection===`row`||a.flexDirection===``){let t=o*(c.length-1),a=c.reduce((e,t)=>e+(t.style.flexGrow||0),0),l=(i-t)/(a||c.length),u=n,d=0;for(let t of c){if(t.tagName===`#text`)continue;let n=l*(t.style.flexGrow||+(a===0)),{box:i,height:c}=YT(e,t,u,r,n);s.push(i),d=Math.max(d,c),u+=n+o}return{children:s,height:d}}let l=r;for(let t of c){if(t.tagName===`#text`)continue;let{box:r,height:a}=YT(e,t,n,l,i);s.push(r),l+=a+o}return{children:s,height:l-r}}function QT(e,t,n){if(!n.listMarker||n.markerHidden)return;let r=n.style,i=n.markerStyle,a=i?{...r,...i}:r;e.font=cT(a);let o=hT(e,r),s=t.y+r.borderTopWidth+r.paddingTop+gT(e,r,o),c=rT(e,n.listMarker),l=r.direction===`rtl`,u=pT.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}=ST(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?rT(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;tT.push({y:Math.round(s),text:n.listMarker,bounds:{x:y,y:t.y+r.borderTopWidth+r.paddingTop,width:g,height:o}})}function $T(e,t,n,r=!0,i){$w=r,eT=i,lT.clear(),xT.clear(),sT.clear(),nT.clear(),tT=[];let{box:a,height:o}=YT(e,t,0,0,n);eE(e,a,t);let s=tT.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=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 eE(e,t,n){QT(e,t,n);let r=0;for(let i of n.children)if(!(i.tagName===`#text`||vT(i)))for(;r<t.children.length;){let n=t.children[r];if(n.type===`box`&&n.tagName===i.tagName){eE(e,n,i),r++;break}r++}}function tE(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 nE(e,t){let n=e[`border${t}Width`],r=e[`border${t}Style`];return n>0&&r!==`none`}function rE(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 iE(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 aE(e){return e.webkitTextFillColor&&e.webkitTextFillColor!==`transparent`?e.webkitTextFillColor:e.color}function oE(e){return Math.max(1,Math.floor(e/10))}function sE(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 cE(e,t,n,r){let{style:i}=t;e.save(),e.font=cT(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=OT(i),o=i.webkitTextStrokeWidth>0,s=i.webkitTextFillColor===`transparent`||i.color===`transparent`,c=t.clip?(t.clip.image?iE(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?iE(e,t.strokeImage.image,t.strokeImage.x,t.strokeImage.width,t.strokeImage.y,t.strokeImage.height):null)??r??null,f=tE(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:aE(i),e.fillText(t.text,t.x,t.y)),o&&(sE(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=aE(i),e.fillText(t.text,t.x,t.y))},m=()=>{o&&(e.save(),sE(e,i,d),e.strokeText(t.text,t.x,t.y),e.restore())};Rw(i.paintOrder)?(m(),p()):(p(),m());let h=t.width,g=i.fontSize,_=oE(g),v=i.direction===`rtl`?t.x-h:t.x;if(i.textDecorations.length>0){let{ascent:n}=ST(e,i);for(let r of i.textDecorations){let a=r.color;if(bT(r.color)){if(u)a=u;else continue}let o=r.style||`solid`,s=i.webkitTextStrokeWidth>0?i.webkitTextStrokeWidth:0,c=d||i.webkitTextStrokeColor||i.color,l=t=>{let n=typeof c==`string`&&bT(c);if(s>0&&!n){rE(e,v,t,h,_+s,o,c);let n=_-s;n>0&&rE(e,v,t,h,n,o,a)}else rE(e,v,t,h,_,o,a)};if(r.line===`underline`){let e=g*.105-.2;l(t.y+e)}else if(r.line===`line-through`){let e=-(g*.33);l(t.y+e)}else r.line===`overline`&&l(Math.floor(t.y-n)-_/2)}}e.restore()}function lE(e,t,n=null,r=null){let{style:i}=t;!bT(i.backgroundColor)&&i.webkitBackgroundClip!==`text`&&(e.fillStyle=i.backgroundColor,e.fillRect(t.x,t.y,t.width,t.height));let a=[[`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,n,r,o,s]of a)nE(i,t)&&(e.strokeStyle=i[`border${t}Color`],e.lineWidth=i[`border${t}Width`],e.beginPath(),e.moveTo(n,r),e.lineTo(o,s),e.stroke());if(OT(i)){let r=i.backgroundImage&&i.backgroundImage!==`none`?iE(e,i.backgroundImage,t.x,t.width,t.y,t.height):null,a=bT(i.backgroundColor)?null:i.backgroundColor;n=r??a??n}i.webkitTextStrokeImage&&i.webkitTextStrokeImage!==`none`&&(r=iE(e,i.webkitTextStrokeImage,t.x,t.width,t.y,t.height));for(let i of t.children)uE(e,i,n,r)}function uE(e,t,n,r){t.type===`text`?cE(e,t,n,r):lE(e,t,n,r)}var dE=/[MmLlHhVvCcSsQqTtAaZz]/,fE=/-?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-+]?\d+)?/g;function pE(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(dE.test(r)){let i=n+1;for(;i<e.length&&!dE.test(e[i]);)i++;let a=e.slice(n+1,i),o=[],s;for(fE.lastIndex=0;s=fE.exec(a);)o.push(Number(s[0]));t.push({cmd:r,args:o}),n=i}else n++}return t}function mE(e){let t=pE(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 hE(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 gE(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 _E(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 vE(e,t){let{cx:n,cy:r,rx:i,ry:a,cosPhi:o,sinPhi:s,theta1:c,deltaTheta:l}=_E(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 yE=40;function bE(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}:vE(r,0),e.push({t:0,len:0});for(let t=1;t<=yE;t++){let n=t/yE,o;o=r.type===`C`?hE(r,n):r.type===`Q`?gE(r,n):vE(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}:vE(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`?hE(r.seg,f):r.seg.type===`Q`?gE(r.seg,f):vE(r.seg,f)}return null}return{length:n,getPointAtLength:r}}function xE(e){return bE(mE(e))}var SE;function CE(){if(SE!==void 0)return SE;if(typeof Intl<`u`&&typeof Intl.Segmenter==`function`)try{SE=new Intl.Segmenter(void 0,{granularity:`grapheme`})}catch{SE=null}else SE=null;return SE}function wE(e){if(!e)return[];let t=CE();if(t){let n=[];for(let r of t.segment(e))n.push(r.segment);return n}return Array.from(e)}function TE(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 EE(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=OT(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 DE=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 OE(e){return DE.test(e)}function kE(e,t){let n=wE(t.text);if(n.length===0)return[];aT(e,t.style),e.letterSpacing=`${t.style.letterSpacing||0}px`;let{ascent:r,descent:i}=ST(e,t.style),a=[],o=``;for(let e of n){let t=e===` `;OE(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 AE(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=kE(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)}jE(m,e=>e.clipStyle,(e,t)=>{e.clipRange=t}),jE(m,e=>e.strokeImageStyle,(e,t)=>{e.strokeImageRange=t});let _=ME(m,a);return{glyphs:m,textWidth:l,pathLength:d,lineHeight:c,bounds:_,textBaseline:a}}function jE(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 ME(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=TE(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 NE(e){let{html:t,align:n=`left`,textBaseline:r=`alphabetic`}=e,i=typeof e.path==`string`?xE(e.path):e.path,a=e.ctx??FE(),o=e.ctx===void 0,{fragment:s,css:c}=Tw(t),{tree:l,cleanup:u}=Qw(s,c,2**53-1);o||a.save();try{return AE({segments:EE(l),path:i,ctx:a,align:n,textBaseline:r})}finally{o||a.restore(),u()}}function PE(e){let{layout:t,ctx:n}=e;if(t.glyphs.length===0)return;let r=t.textBaseline;n.save();try{RE(n,t.glyphs,r),GE(n,t.glyphs,t.textWidth,r),YE(n,t.glyphs,t.textWidth,r)}finally{n.restore()}}function FE(){return Cw(!1)}var IE=new WeakMap;function LE(e,t){if(!t)return``;let n=IE.get(e);n||(n=new Map,IE.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 RE(e,t,n){let r=e=>!bT(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=LE(e,a),s=i+1;for(;s<t.length&&r(t[s])&&LE(e,t[s].style.backgroundColor)===o;)s++;BE(e,t.slice(i,s),a,n),i=s}}function zE(e,t){let n=Math.cos(e.rotation),r=Math.sin(e.rotation),i=TE(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 BE(e,t,n,r){if(t.length===0)return;e.save(),e.fillStyle=n,e.beginPath();let i=zE(t[0],r);e.moveTo(i.tl.x,i.tl.y);for(let n=0;n<t.length;n++){let i=zE(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=zE(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 VE(e){return e.webkitTextFillColor===`transparent`||e.color===`transparent`||bT(aE(e))}function HE(e,t,n,r){let i=t.clipStyle??(OT(t.style)?t.style:void 0);if(!i)return null;let a=t.clipRange??{start:0,width:n};return(i.backgroundImage&&i.backgroundImage!==`none`?iE(e,i.backgroundImage,a.start-t.pathOffset,a.width,r-t.ascent,t.ascent+t.descent):null)??(bT(i.backgroundColor)?null:i.backgroundColor)}function UE(e,t,n,r){let i=t.strokeImageStyle;if(!i)return null;let a=t.strokeImageRange??{start:0,width:n};return iE(e,i.webkitTextStrokeImage,a.start-t.pathOffset,a.width,r-t.ascent,t.ascent+t.descent)}function WE(e,t,n,r){return OT(t.style)||t.clipStyle!=null&&VE(t.style)?HE(e,t,n,r):VE(t.style)?null:aE(t.style)}function GE(e,t,n,r){for(let i of t){e.save(),e.translate(i.x,i.y),e.rotate(i.rotation),aT(e,i.style),e.textBaseline=`alphabetic`,e.letterSpacing=`${i.style.letterSpacing||0}px`;let t=TE(r,i.ascent,i.descent),a=WE(e,i,n,t),o=UE(e,i,n,t),s=i.style.webkitTextStrokeWidth>0,c=tE(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&&(sE(e,i.style,o),e.strokeText(i.char,0,t)),e.restore()}KE(e,i,t,a,o),e.restore()}}function KE(e,t,n,r,i){let{style:a}=t,o=a.webkitTextStrokeWidth>0,s=Rw(a.paintOrder||``),c=()=>{r&&(e.fillStyle=r,e.fillText(t.char,0,n))},l=()=>{o&&(e.save(),sE(e,a,i),e.strokeText(t.char,0,n),e.restore())};s?(l(),c()):(c(),l())}function qE(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!e.textDecorationLine||!e.textDecorationLine.includes(t)?null:{color:e.textDecorationColor||e.color,style:e.textDecorationStyle||`solid`}}function JE(e){return e.clipStyle??(OT(e.style)?e.style:void 0)}function YE(e,t,n,r){for(let i of[`underline`,`line-through`,`overline`]){let a=0;for(;a<t.length;){let o=qE(t[a].style,i);if(!o){a++;continue}let{color:s,style:c}=o;if(bT(s)){let o=JE(t[a]);if(!o){a++;continue}let s=a+1;for(;s<t.length;){let e=qE(t[s].style,i);if(!e||!bT(e.color)||e.style!==c||JE(t[s])!==o)break;s++}ZE(e,t.slice(a,s),i,c,n,r),a=s;continue}let l=LE(e,s),u=a+1;for(;u<t.length;){let n=qE(t[u].style,i);if(!n||LE(e,n.color)!==l||n.style!==c)break;u++}QE(e,t.slice(a,u),i,c,s,r),a=u}}}function XE(e,t,n){let r=TE(n,e.ascent,e.descent);return t===`underline`?r+e.descent*.5:t===`line-through`?r-e.ascent*.3:r-e.ascent*.9}function ZE(e,t,n,r,i,a){if(t.length===0)return;let o=oE(t[0].style.fontSize);for(let s of t){e.save(),e.translate(s.x,s.y),e.rotate(s.rotation);let t=HE(e,s,i,TE(a,s.ascent,s.descent));t&&rE(e,0,XE(s,n,a),s.width,o,r,t),e.restore()}}function QE(e,t,n,r,i,a){if(t.length===0)return;let o=oE(t[0].style.fontSize),s=e=>XE(e,n,a);if(r===`double`||r===`wavy`){for(let n of t)e.save(),e.translate(n.x,n.y),e.rotate(n.rotation),rE(e,0,s(n),n.width,o,r,i),e.restore();return}e.save(),e.strokeStyle=i,e.lineWidth=o,r===`dotted`?e.setLineDash([o,o*2]):r===`dashed`&&e.setLineDash([o*3,o*2]),e.beginPath();for(let n=0;n<t.length;n++){let r=t[n],i=s(r),a=Math.cos(r.rotation),o=Math.sin(r.rotation),c={x:r.x+-o*i,y:r.y+a*i},l={x:r.x+a*r.width+-o*i,y:r.y+o*r.width+a*i};n===0?e.moveTo(c.x,c.y):e.lineTo(c.x,c.y),e.lineTo(l.x,l.y)}e.stroke(),e.setLineDash([]),e.restore()}var $E=`
|
|
141
|
+
p {
|
|
142
|
+
margin: 0;
|
|
143
|
+
padding: 0;
|
|
144
|
+
overflow-wrap: break-word; /* Canonical CSS3 — Firefox honors it; render-tag's CSS resolver only parses this canonical form */
|
|
145
|
+
/* a text may have several spaces, we need to preserve them */
|
|
146
|
+
white-space: pre-wrap;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* Structural list reset. Native markers are intentionally LEFT ENABLED here
|
|
150
|
+
(no list-style:none) so the canonical export/canvas HTML renders the
|
|
151
|
+
browser's NATIVE markers.
|
|
152
|
+
|
|
153
|
+
The per-level indent is carried by the <ul>/<ol> padding (2.1em), NOT the
|
|
154
|
+
<li>. This matters for native markers: with list-style-position outside
|
|
155
|
+
the marker hangs just left of the <li> border box, so the indent must sit
|
|
156
|
+
on the list (the marker lands inside that padding, next to the text). If
|
|
157
|
+
the indent were on the <li> instead, the outside marker would hang at
|
|
158
|
+
x near 0 and be clipped off the element's left edge. render-tag computes
|
|
159
|
+
the same content-start either way (it accumulates block padding).
|
|
160
|
+
|
|
161
|
+
The live editor needs the opposite box model (indent on the <li>, so its
|
|
162
|
+
absolutely-positioned ::before marker has room) and overrides these two
|
|
163
|
+
paddings in rich-editor.tsx. */
|
|
164
|
+
ul, ol {
|
|
165
|
+
padding-inline-start: 2.1em; /* Per-level indent; native outside markers hang inside it */
|
|
166
|
+
margin: 0;
|
|
167
|
+
display: block; /* Use block instead of inline-block for better text wrapping */
|
|
168
|
+
width: 100%;
|
|
169
|
+
/* border-box so width:100% INCLUDES the indent padding — otherwise the
|
|
170
|
+
content box overflows the element by 2.1em and native center/right
|
|
171
|
+
text-align drifts right (left is unaffected). render-tag already lays the
|
|
172
|
+
list out border-box, so this is what keeps DOM (html export) aligned with
|
|
173
|
+
the canvas. Editor lists override padding to 0 (rich-editor.tsx), so this
|
|
174
|
+
is a no-op there. */
|
|
175
|
+
box-sizing: border-box;
|
|
176
|
+
text-decoration: inherit;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
li {
|
|
180
|
+
padding-inline-start: 0;
|
|
181
|
+
margin: 0; /* Reset default li margins */
|
|
182
|
+
overflow-wrap: break-word; /* Canonical CSS3 — Firefox honors it; render-tag's CSS resolver only parses this canonical form */
|
|
183
|
+
white-space: pre-wrap; /* Preserve spaces and allow wrapping */
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* Paragraph block-indent (matches walk's <p> ql-indent → margin in
|
|
187
|
+
rich-text-html.ts). Small step, applied to non-list indented blocks.
|
|
188
|
+
Editor-only in practice: the export normalizer turns <p> ql-indent into an
|
|
189
|
+
inline margin, so canonical export HTML carries no ql-indent class. */
|
|
190
|
+
.ql-indent-1 {
|
|
191
|
+
margin-inline-start: 0.5em;
|
|
192
|
+
}
|
|
193
|
+
.ql-indent-2 {
|
|
194
|
+
margin-inline-start: 1em;
|
|
195
|
+
}
|
|
196
|
+
.ql-indent-3 {
|
|
197
|
+
margin-inline-start: 1.5em;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/* List nesting indent for the live Quill editor, which renders a list FLAT
|
|
201
|
+
(one container, depth via ql-indent on each <li>). Each level is indented
|
|
202
|
+
by the SAME 2.1em render-tag adds per nested <ul>/<ol>, to stay in sync
|
|
203
|
+
with the canvas. Stored/exported lists are canonical-nested and carry no
|
|
204
|
+
ql-indent (see canonicalizeLists), so these rules are editor/legacy-only
|
|
205
|
+
no-ops elsewhere. */
|
|
206
|
+
li.ql-indent-1 {
|
|
207
|
+
margin-inline-start: 2.1em;
|
|
208
|
+
}
|
|
209
|
+
li.ql-indent-2 {
|
|
210
|
+
margin-inline-start: 4.2em;
|
|
211
|
+
}
|
|
212
|
+
li.ql-indent-3 {
|
|
213
|
+
margin-inline-start: 6.3em;
|
|
214
|
+
}
|
|
215
|
+
`,eD=`
|
|
216
|
+
<style>
|
|
217
|
+
html, body {
|
|
218
|
+
padding: 0;
|
|
219
|
+
margin: 0;
|
|
220
|
+
}
|
|
221
|
+
${$E}
|
|
222
|
+
</style>
|
|
223
|
+
`,tD=`<style>${$E}
|
|
224
|
+
/* render-tag draws list markers natively from the <ol>/<ul> tag + tree position
|
|
225
|
+
(it ignores the polotno reset's ::before + counter() markers, which only work
|
|
226
|
+
in real DOM — the Quill editor and the foreignObject rasterizer). The shared
|
|
227
|
+
reset sets list-style:none for those ::before markers, which would suppress
|
|
228
|
+
render-tag's native ones; restore the canonical marker types here so render-tag
|
|
229
|
+
paints them. element.text is canonicalized to <ul>/<ol> upstream
|
|
230
|
+
(normalizeRichTextHtml), so the tag alone selects bullet vs. number. */
|
|
231
|
+
ol { list-style-type: decimal; }
|
|
232
|
+
ul { list-style-type: disc; }
|
|
233
|
+
/* Chrome's <code>/<pre> font-size UA quirk isn't reproducible on canvas — let
|
|
234
|
+
them inherit so DOM and canvas line up. */
|
|
235
|
+
code, pre, kbd, samp { font-size: inherit; }</style>`;function nD(e){return tD+e}function rD(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}var iD=/[\u0591-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]/;function aD(e){return iD.test(e)}function oD(e){e=e.replace(/\s/g,``);let t=0;for(var n=0;n<e.length;n++){let r=e[n];aD(r)&&(t+=1)}return t>e.length/2}function sD(e){return oD(e)?`rtl`:`ltr`}function cD(e){return sD(Yb(e))}function lD(e){return e===`miter`||e===`bevel`?e:`round`}function uD(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 dD(e,t,n){let r=dC(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=fC({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 fD=null;function pD(){return fD||=document.createElement(`canvas`).getContext(`2d`),fD}function mD(e){if(!Wb(e)||e.curveEnabled)return null;let t=Math.max(1,Math.round(e.height)),n=qb(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 hD(){return typeof OffscreenCanvas<`u`?!!new OffscreenCanvas(1,1).getContext(`2d`):typeof document<`u`&&!!document.createElement(`canvas`).getContext(`2d`)}function gD(e,t){let n=pD();return n.font=e,n.measureText(t)}function _D(e,t,n,r,i){let a=pD(),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 '${e.replace(/'/g,``)}'`,o+=a.measureText(s.text).width}return o}function vD(e,t,n,r,i,a){if(!e.some(e=>e.fontFamily&&e.fontFamily!==n)||t.length<=1)return 0;let o=_D(e,n,r,i,a),s=pD();s.font=`${i} ${r} ${a}px '${n}'`;let c=o-s.measureText(t).width;return c<=0?0:c/(t.length-1)}function yD(e,t){let n=e.a?e.a:e,r=Ub(e),i=n.fontSize??r.fontSize,a=t?.normalizedText??Rb(r.text,{fontSize:i,fontFamily:r.fontFamily}),o=t?.segments??ax(a,{fontSize:i,fontFamily:r.fontFamily}),c=Math.max(i,...o.map(e=>e.fontSize??i)),l=Yb(a),u=vD(o,l,r.fontFamily,r.fontWeight||`normal`,r.fontStyle||`normal`,c),d=n.width??r.width,f=new s.TextPath({data:uD(d,n.height??r.height??0,r.curvePower,c),align:`center`,textBaseline:`middle`,text:l,fontSize:c,fontFamily: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 bD(e){return yD(e).height}function xD(e,t){return Wb(e)?e.height:yD(e,t).height}function SD(e){let t=ax(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 CD(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="${rD(e.color)}"`);let a=e.fontFamily||t.fontFamily;a!==t.fontFamily&&r.push(`font-family="${rD(a)}"`);let o=e.fontSize??t.fontSize;o!==t.fontSize&&r.push(`font-size="${o}"`);let s=rD(e.text);return r.length===0?s:`<tspan ${r.join(` `)}>${s}</tspan>`}).join(``)}var wD=`change-font-size`;function TD(e){if(!e.includes(`color`))return e;let t=Ob(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 ED(e,t){let n=Ub(e),r=t||n.fontFamily;return ox(Rb(n.text,{fontSize:n.fontSize,fontFamily:r})).replace(/\n/g,`<br/>`)}function DD(e,{fontFamily:t=``,color:n=`black`,forEditor:r=!1,textOverflow:i=`resize`,textIsNormalized:a=!1}={}){let o=Ub(e),s=t||o.fontFamily,c=a?o.text:Rb(o.text,{fontSize:o.fontSize,fontFamily:s}),l=aC(o.fill),u=aC(o.stroke)&&!!o.strokeWidth;(l||u)&&(c=TD(c));let d=i===`ellipsis`&&!r,f=(()=>{let e=d?mD(o):null;return e?Object.entries(e).map(([e,t])=>`${e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}: ${t}`):[]})(),p=e=>`
|
|
236
|
+
background-image: ${e};
|
|
237
|
+
background-size: 100% 100%;
|
|
238
|
+
background-repeat: repeat;
|
|
239
|
+
-webkit-background-clip: text;
|
|
240
|
+
-moz-background-clip: text;
|
|
241
|
+
background-clip: text;
|
|
242
|
+
-webkit-text-fill-color: transparent;
|
|
243
|
+
color: transparent
|
|
244
|
+
`.trim(),m=`color: ${n||o.fill}`,h=``;u&&o.strokeWidth?(m=l?p(o.fill):`color: ${n||o.fill}`,h=`-webkit-text-stroke: ${o.strokeWidth}px ${lC(o.stroke)}; --rt-text-stroke-image: ${o.stroke}; paint-order: stroke fill`):l&&(m=p(o.fill));let g=[`white-space: pre-wrap`,`overflow-wrap: break-word`,`width: ${Math.round(o.width||100)}px`,...f,m,`font-size: ${o.fontSize}px`,`font-family: '${s}'`,`text-align: ${o.align}`,`text-transform: ${o.textTransform}`,o.textDecoration?`text-decoration: ${o.textDecoration}${l?``:`; text-decoration-color: ${n||o.fill}`}; text-decoration-layer: over`:``,o.lineHeight?`line-height: ${o.lineHeight}`:``,o.letterSpacing?`letter-spacing: ${o.letterSpacing}em`:``,o.fontStyle?`font-style: ${o.fontStyle}`:``,o.fontWeight?`font-weight: ${o.fontWeight}`:``,h||(o.strokeWidth?`-webkit-text-stroke: ${o.strokeWidth}px ${o.stroke}`:``),o.strokeWidth&&!u?`paint-order: stroke fill`:``,o.strokeWidth?`stroke-linejoin: ${lD(o.strokeLineJoin)}`:``].filter(Boolean).join(`; `);if(o.curveEnabled&&!r){let{segments:t,curveFontSize:r,segDefaults:i}=SD({normalizedText:c,fontSize:o.fontSize,fontFamily:s,fontWeight:o.fontWeight,fontStyle:o.fontStyle,fill:n||o.fill}),a=yD(e,{normalizedText:c,segments:t}),d=Math.round(a.width),f=a.height,p=uD(d,f,o.curvePower,r),m=CD(t,i),h=CD(t,i,{omitColors:!0}),g=rD(o.id||`temp`),_=`curve-${g}`,v=o.strokeWidth&&(u||l&&!u),y=`<svg xmlns="http://www.w3.org/2000/svg" width="${d}" height="${f}" overflow="visible">
|
|
245
|
+
<defs>
|
|
246
|
+
<path id="${_}" d="${p}" fill="none" />`;if(l){let e=`curve-fill-grad-${g}`;y+=dD(o.fill,e)}if(u&&o.strokeWidth){let e=`curve-stroke-grad-${g}`;y+=dD(o.stroke,e)}y+=`</defs>`;let b=rD(s),x=rD(o.fontWeight||`normal`),S=rD(o.fontStyle||`normal`);if(v){let e=`
|
|
247
|
+
font-family="'${b}'"
|
|
248
|
+
font-size="${o.fontSize}"
|
|
249
|
+
font-weight="${x}"
|
|
250
|
+
font-style="${S}"
|
|
251
|
+
text-anchor="middle"
|
|
252
|
+
dominant-baseline="central"
|
|
253
|
+
letter-spacing="${o.letterSpacing*r}"${o.textDecoration?` text-decoration="${o.textDecoration}"`:``}`,t=u?`url(#curve-stroke-grad-${g})`:o.stroke;y+=`
|
|
254
|
+
<text ${e} fill="${t}" stroke="${t}" stroke-width="${o.strokeWidth}" stroke-linejoin="${lD(o.strokeLineJoin)}">
|
|
255
|
+
<textPath href="#${_}" startOffset="50%">${h}</textPath>
|
|
256
|
+
</text>`;let i=l?`url(#curve-fill-grad-${g})`:n;y+=`
|
|
257
|
+
<text ${e} fill="${i}">
|
|
258
|
+
<textPath href="#${_}" startOffset="50%">${m}</textPath>
|
|
259
|
+
</text>`}else{let e=l?`url(#curve-fill-grad-${g})`:n,t=u?`url(#curve-stroke-grad-${g})`:o.stroke;y+=`
|
|
260
|
+
<text
|
|
261
|
+
font-family="'${b}'"
|
|
262
|
+
font-size="${o.fontSize}"
|
|
263
|
+
font-weight="${x}"
|
|
264
|
+
font-style="${S}"
|
|
265
|
+
fill="${e}"
|
|
266
|
+
text-anchor="middle"
|
|
267
|
+
dominant-baseline="central"
|
|
268
|
+
letter-spacing="${o.letterSpacing*r}"${o.textDecoration?` text-decoration="${o.textDecoration}"`:``}${o.strokeWidth?` stroke="${t}" stroke-width="${o.strokeWidth}" stroke-linejoin="${lD(o.strokeLineJoin)}" paint-order="stroke fill"`:``}>
|
|
269
|
+
<textPath href="#${_}" startOffset="50%">${m}</textPath>
|
|
270
|
+
</text>`}return y+=`</svg>`,y}if(o.strokeWidth&&(u||l&&!u)&&!r){let e=ox(c).replace(/\n/g,`<br/>`),t=Math.round(o.width||100),r=[`white-space: pre-wrap`,`overflow-wrap: break-word`,`width: ${t}px`,...f,`font-size: ${o.fontSize}px`,`font-family: '${s}'`,`text-align: ${o.align}`,`text-transform: ${o.textTransform}`,o.textDecoration?`text-decoration: ${o.textDecoration}${l?``:`; text-decoration-color: ${n||o.fill}`}; text-decoration-layer: over`:``,o.lineHeight?`line-height: ${o.lineHeight}`:``,o.letterSpacing?`letter-spacing: ${o.letterSpacing}em`:``,o.fontStyle?`font-style: ${o.fontStyle}`:``,o.fontWeight?`font-weight: ${o.fontWeight}`:``].filter(Boolean).join(`; `),i;i=u?`${r}; ${p(o.stroke)}; -webkit-text-stroke: ${o.strokeWidth}px transparent`:`${r}; color: transparent; -webkit-text-stroke: ${o.strokeWidth}px ${o.stroke}`;let a=`${r}; ${l?p(o.fill):`color: ${n||o.fill}`}`,d=``;if(l||u){let e=[];u&&o.strokeWidth&&e.push(`.stroke-layer li, .stroke-layer li::before { ${p(o.stroke)}; }`),l&&e.push(`.fill-layer li, .fill-layer li::before { ${p(o.fill)}; }`),e.length&&(d=`<style>${e.join(`
|
|
271
|
+
`)}</style>`)}return`
|
|
272
|
+
<div style="position: relative; width: ${t}px;">
|
|
273
|
+
<div class="stroke-layer" style="${i}; position: absolute; top: 0; left: 0; pointer-events: none;" aria-hidden="true" dir="${cD(c)}">${e}</div>
|
|
274
|
+
<div class="fill-layer" style="${a}; position: relative;" contentEditable dir="${cD(c)}">${e}</div>
|
|
275
|
+
</div>
|
|
276
|
+
${d}
|
|
277
|
+
`}let _=``;return l&&!u&&(_=`<style>
|
|
278
|
+
li, li::before {
|
|
279
|
+
${p(o.fill)};
|
|
280
|
+
}
|
|
281
|
+
</style>`),`<div style="${g}" contentEditable dir="${cD(c)}">${ox(c).replace(/\n/g,`<br/>`)}</div>${_}`}function OD({fontFamily:e,fontSize:t,lineHeight:n}){if(typeof n==`number`)return n;let r=document.createElement(`div`);r.style.fontFamily=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 kD=e=>String(Math.round(e*100)/100),AD=e=>(e.ascent-e.descent)/2,jD=e=>!e||e===`transparent`||e===`rgba(0, 0, 0, 0)`,MD=e=>e.webkitTextFillColor===`transparent`||e.color===`transparent`||jD(e.webkitTextFillColor||e.color);function ND(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:MD(e)&&t.fillOverride||n};return t.strokeWidth&&t.stroke&&(r.stroke=t.stroke,r[`stroke-width`]=String(t.strokeWidth),r[`stroke-linejoin`]=lD(t.strokeLineJoin),r[`paint-order`]=`stroke fill`),r}var PD=[{line:`underline`,a:0,d:.5},{line:`line-through`,a:-.3,d:0},{line:`overline`,a:-.9,d:0}],FD=(e,t)=>AD(e)+t.a*e.ascent+t.d*e.descent,ID=e=>Math.max(1,Math.floor(e/10));function LD(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}function RD(e,t){return e===`dotted`?`${kD(t)} ${kD(t*2)}`:e===`dashed`?`${kD(t*3)} ${kD(t*2)}`:null}function zD(e,t){if(!e.some(e=>LD(e.style,`underline`)||LD(e.style,`line-through`)||LD(e.style,`overline`)))return``;let n=``;for(let r of PD){let i=0;for(;i<e.length;){let a=LD(e[i].style,r.line);if(!a){i++;continue}let o=e=>{let t=bS(e);return t.isValid()?t.toRgbString():String(e)},s=o(a.color),c=ID(e[i].style.fontSize),l=i+1;for(;l<e.length;){let t=LD(e[l].style,r.line);if(!t||o(t.color)!==s||t.style!==a.style)break;l++}let u=e.slice(i,l).map((e,t)=>{let n=FD(e,r),i=Math.cos(e.rotation),a=Math.sin(e.rotation),o=e.x+-a*n,s=e.y+i*n,c=e.x+i*e.width+-a*n,l=e.y+a*e.width+i*n;return`${t===0?`M`:`L`}${kD(o)} ${kD(s)}L${kD(c)} ${kD(l)}`}).join(``),d=RD(a.style,c);n+=`<path d="${u}" fill="none" stroke="${rD(jD(a.color)&&t||a.color)}" stroke-width="${kD(c)}"`+(d?` stroke-dasharray="${d}"`:``)+`/>`,i=l}}return n}function BD(e){return Object.entries(e).map(([e,t])=>` ${e}="${rD(t)}"`).join(``)}function VD(e){let t=e.element,n=NE({html:nD(DD({...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=>ND(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=>BD(Object.fromEntries(Object.entries(e).filter(([e])=>!(e in s)))),l=e=>e.shaped&&[...e.char].length>1,u=e=>({x:e.x-AD(e)*Math.sin(e.rotation),y:e.y+AD(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=>kD(e.x)).join(` `)}" y="${e.map(e=>kD(e.y)).join(` `)}" rotate="${e.map(e=>kD(e.deg)).join(` `)}">${rD(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="${kD(r)}px"`:``;return`<g transform="translate(${kD(e.x)} ${kD(e.y)}) rotate(${kD(n)})"><text y="${kD(AD(e))}"${i}${c(o[t])}>${rD(e.char)}</text></g>`}let n=u(e);return`<text x="${kD(n.x)}" y="${kD(n.y)}" rotate="${kD(n.deg)}"${c(o[t])}>${rD(e.char)}</text>`}).join(``);let p={transform:`translate(${kD((t.width-r.width)/2-r.x)}, ${kD(-r.y)})`,"xml:space":`preserve`,...s};return{markup:f+zD(a,e.fillOverride),groupAttrs:p,groupAttrsString:BD(p),bounds:r}}var HD=new Set;function UD(e){let t=String(e?.message??e);HD.has(t)||(HD.add(t),console.warn(`curved text fell back to <textPath> (no canvas backend to measure glyphs; geometry will not match the canvas):`,e))}var WD;(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`})(WD||={});function GD(e,t){let n={filter:``,html:void 0};switch(e){case WD.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=`
|
|
282
|
+
<svg xmlns="http://www.w3.org/2000/svg" style="display:none">
|
|
283
|
+
<filter id="warm-filter" color-interpolation-filters="sRGB">
|
|
284
|
+
<feColorMatrix type="matrix" values="
|
|
285
|
+
${r} 0 0 0 0
|
|
286
|
+
0 ${i} 0 0 0
|
|
287
|
+
0 0 1 0 0
|
|
288
|
+
0 0 0 1 0" />
|
|
289
|
+
</filter>
|
|
290
|
+
</svg>`,n}case WD.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=`
|
|
291
|
+
<svg xmlns="http://www.w3.org/2000/svg" style="display:none">
|
|
292
|
+
<filter id="cold-filter" color-interpolation-filters="sRGB">
|
|
293
|
+
<feColorMatrix type="matrix" values="
|
|
294
|
+
${r} 0 0 0 0
|
|
295
|
+
0 ${i} 0 0 0
|
|
296
|
+
0 0 ${a} 0 0
|
|
297
|
+
0 0 0 1 0" />
|
|
298
|
+
</filter>
|
|
299
|
+
</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 WD.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=`
|
|
300
|
+
<svg xmlns="http://www.w3.org/2000/svg" style="display:none">
|
|
301
|
+
<filter id="temperature-filter" color-interpolation-filters="sRGB">
|
|
302
|
+
<feColorMatrix type="matrix" values="
|
|
303
|
+
${r} 0 0 0 0
|
|
304
|
+
0 1 0 0 0
|
|
305
|
+
0 0 ${i} 0 0
|
|
306
|
+
0 0 0 1 0" />
|
|
307
|
+
</filter>
|
|
308
|
+
</svg>
|
|
309
|
+
`,n}case WD.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=`
|
|
310
|
+
<svg xmlns="http://www.w3.org/2000/svg" style="display:none">
|
|
311
|
+
<filter id="contrast-filter" color-interpolation-filters="sRGB">
|
|
312
|
+
<feComponentTransfer>
|
|
313
|
+
<feFuncR type="linear" slope="${r}" intercept="${i}" />
|
|
314
|
+
<feFuncG type="linear" slope="${r}" intercept="${i}" />
|
|
315
|
+
<feFuncB type="linear" slope="${r}" intercept="${i}" />
|
|
316
|
+
</feComponentTransfer>
|
|
317
|
+
</filter>
|
|
318
|
+
</svg>
|
|
319
|
+
`,n}case WD.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=`
|
|
320
|
+
<svg xmlns="http://www.w3.org/2000/svg" style="display:none">
|
|
321
|
+
<filter id="shadows-filter" color-interpolation-filters="sRGB">
|
|
322
|
+
<feComponentTransfer>
|
|
323
|
+
<feFuncR type="gamma" amplitude="1" exponent="${e}" offset="0" />
|
|
324
|
+
<feFuncG type="gamma" amplitude="1" exponent="${e}" offset="0" />
|
|
325
|
+
<feFuncB type="gamma" amplitude="1" exponent="${e}" offset="0" />
|
|
326
|
+
</feComponentTransfer>
|
|
327
|
+
</filter>
|
|
328
|
+
</svg>
|
|
329
|
+
`,n}case WD.white:return null;case WD.black:return null;case WD.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=`
|
|
330
|
+
<svg xmlns="http://www.w3.org/2000/svg" style="display:none">
|
|
331
|
+
<filter id="vibrance-filter" color-interpolation-filters="sRGB">
|
|
332
|
+
<feColorMatrix type="matrix" values="
|
|
333
|
+
${c} ${l} ${u} 0 0
|
|
334
|
+
${d} ${f} ${p} 0 0
|
|
335
|
+
${m} ${h} ${g} 0 0
|
|
336
|
+
0 0 0 1 0" />
|
|
337
|
+
</filter>
|
|
338
|
+
</svg>
|
|
339
|
+
`,n}case WD.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=`
|
|
340
|
+
<svg xmlns="http://www.w3.org/2000/svg" style="display:none">
|
|
341
|
+
<filter id="saturation-filter" color-interpolation-filters="sRGB">
|
|
342
|
+
<feColorMatrix type="matrix" values="
|
|
343
|
+
${c} ${l} ${u} 0 0
|
|
344
|
+
${d} ${f} ${p} 0 0
|
|
345
|
+
${m} ${h} ${g} 0 0
|
|
346
|
+
0 0 0 1 0" />
|
|
347
|
+
</filter>
|
|
348
|
+
</svg>
|
|
349
|
+
`,n}default:return null}}function KD(e){let t=[],n=[];if(e.blurEnabled&&t.push(`blur(${JD(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[r,i]of Object.entries(e.filters)){let e=GD(WD[r],i.intensity);e&&(t.push(e.filter),e.html&&n.push(e.html))}if(e.shadowEnabled){let n=IC(e.shadowColor,e.shadowOpacity??1);t.push(`drop-shadow(${e.shadowOffsetX}px ${e.shadowOffsetY}px ${e.shadowBlur/2}px ${n})`)}return{filters:t,additionalHTML:n}}function qD(e,t,n){return e/1e3*Math.min(t,n)}function JD(e){return e.cropWidth===void 0?e.blurRadius:qD(e.blurRadius,e.width/(e.cropWidth||1),e.height/(e.cropHeight||1))}async function YD(e){return new Promise((t,n)=>{let r=vb.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 XD(e){return new Promise(t=>{let n=vb.createElement(`video`);n.crossOrigin=`anonymous`,n.src=e,n.addEventListener(`loadedmetadata`,()=>{let{duration:e}=n;t(e)})})}function ZD(e,t){return Object.keys(e.values).forEach(n=>e.values[n]=e.values[n]&&parseFloat(e.values[n].toFixed(t))),e}function QD(e,t,n){let r=t-1,i=n[nO(r,n.length)];return i.marker===`Z`?QD(e,r,n):i}function $D(e,t,n){let r=t+1,i=n[nO(r,n.length)];return i.marker===`Z`?$D(e,r,n):i}function eO(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 tO(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 nO(e,t){return(e%t+t)%t}function rO(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 iO(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,iO(e,t-1)),e[t].marker===`Z`&&iO(e,t-1)}function aO(e,t,n){let r=sO(e.values,n.values),i=sO(t.values,e.values);return Math.min(i,r)}function oO(e,t){return Math.atan2(t.x-e.x,t.y-e.y)}function sO(e,t){let n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n**2+r**2)}function cO(e,t){return Math.sin(e)*t}function lO(e,t){return Math.cos(e)*t}function uO(e,t){let n=t/Math.tan(e);return n===1/0||n===-1/0||isNaN(n)?t:n}function dO(e,t){return t*Math.tan(e)}function fO(e,t){let n,r=0,i=180/Math.PI*e;return i<0&&i>=-180||i>180&&i<360?n=uO(e/2,-t):(n=uO(e/2,t),r=1,n===1/0&&(n=t)),{offset:n,sweepFlag:r}}function pO(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 mO(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 tO(e.marker,r)}).map(eO)}function hO(e,t,n){let r=[],i=[];return n&&e.forEach(e=>ZD(e,n)),e.forEach(e=>{e.marker===`M`&&r.push([]),r[r.length-1].push(e)}),r.forEach(e=>{e.map(rO),iO(e,e.length-1);let n=e[e.length-1].marker==`Z`;e.filter(e=>!e.overlap).map((e,r,a)=>{let o=QD(e,r,a),s=$D(e,r,a),c=oO(e.values,o.values),l=oO(e.values,s.values),u=l-c,d=180/Math.PI*u,f=aO(e,o,s),p=Math.abs(dO(u/2,f/2)),m=Math.min(t,p),h=fO(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+cO(c,g),e.values.y+lO(c,g)],n=[e.values.x+cO(l,g),e.values.y+lO(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:pO(i),commands:i}}function gO(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 _O(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 vO({rects:e,padding:t=0,cornerRadius:n=0}){let r=_O(gO(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`,hO(mO(s),n).path}function yO({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 bO,xO=()=>(bO||(bO=document.createElement(`div`),bO.id=`polotno-hidden-do-not-touch`,bO.style.overflow=`hidden`,bO.style.position=`relative`,document.body.appendChild(bO),bO.innerHTML=`<style>#polotno-hidden-do-not-touch {${$E}}</style>`),bO);function SO({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=xO();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 CO(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=xO();n.appendChild(t);let r=t.getBoundingClientRect();return n.removeChild(t),{width:r.width,height:r.height}}function wO(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=xO();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 TO(e){return wO(e).rects}var EO=e=>CO(e).height,DO=.02,OO=.5,kO=.05,AO=49;function jO(e,t={}){let{getHtmlOptions:n={},measureHeight:r=EO,textSplitAllowed:i=!1}=t,a=Rb(e.text,{fontSize:e.fontSize,fontFamily:e.fontFamily}),o=t=>{let n=r(t);return!!(Wb(e)&&n>e.height||!i&&!e.curveEnabled&&SO({html:t}))};if(Vb(a)){let t=1,r;for(let i=0;i<AO;i++){let i;if(t===1?i=DD({...e,text:a},{...n,textIsNormalized:!0}):(r=Bb(e.text,t),i=DD({...e,fontSize:e.fontSize*t,text:r},n)),!o(i))break;t-=DO,r=void 0;let s=Math.max(kO,1/e.fontSize);if(t<s){t=s;break}}return t>=1?{fontSize:e.fontSize}:{fontSize:e.fontSize*t,text:r??Bb(e.text,t)}}let s=e.fontSize,c={...n,textIsNormalized:!0};for(let t=0;t<AO&&o(DD({...e,fontSize:s,text:a},c));t++)if(s-=OO,s<1){s=1;break}return{fontSize:s}}var MO=e=>e.borderSize>0?Math.max(1,Math.round(e.borderSize)):0,NO=e=>MO(e)>0&&aC(e.borderColor),PO=e=>{let t=MO(e);return{boxSizing:`border-box`,backgroundOrigin:`border-box`,borderRadius:e.cornerRadius+`px`,border:t?`${t}px solid ${NO(e)?`transparent`:e.borderColor}`:`none`}},FO=(e,t)=>NO(e)?J(`div`,{style:{width:`100%`,height:`100%`,borderRadius:e.cornerRadius+`px`,background:e.borderColor}},t):t,IO=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 FC(i,{cache:r}).catch(e=>{throw a(e)}),Object.keys(e.colorsReplace).length&&(s=UC(s,new Map(Object.entries(e.colorsReplace)))),o||(i=LC(RC(s))));let c=``;e.flipX&&(c+=`scaleX(-1)`),e.flipY&&(c+=`scaleY(-1)`),c||=`none`;let l={};if(o){let t=LC(e.stretchEnabled?RC(s):BC(s)),n=e.stretchEnabled?`100% 100%`:`cover`;l[`mask-image`]=`url(${t})`,l[`mask-size`]=n,l[`mask-position`]=`0 0`,l[`mask-repeat`]=`no-repeat`,l[`-webkit-mask-image`]=`url(${t})`,l[`-webkit-mask-size`]=n,l[`-webkit-mask-position`]=`0 0`,l[`-webkit-mask-repeat`]=`no-repeat`,i=e.maskSrc}else if(e.clipSrc){let t=e.clipSrc,n=t.indexOf(`data:image/svg+xml`)>=0||t.indexOf(`.svg`)>=0?LC(RC(await FC(t,{cache:r}).catch(e=>{throw a(e)}))):await PC(t,{cache:r,binary:!0}).catch(e=>{throw a(e)});l[`mask-image`]=`url(${n})`,l[`mask-size`]=`100% 100%`,l[`mask-position`]=`0 0`,l[`mask-repeat`]=`no-repeat`,l[`-webkit-mask-image`]=`url(${n})`,l[`-webkit-mask-size`]=`100% 100%`,l[`-webkit-mask-position`]=`0 0`,l[`-webkit-mask-repeat`]=`no-repeat`}let u=await qC(i),{cropScaledX:d,cropScaledY:f,cropScaledWidth:p,cropScaledHeight:m}=XC(o?{...e,...QC(e,u),stretchEnabled:!0}:e,u);return FO(e,J(`div`,{style:{...l,width:`100%`,height:`100%`,...PO(e),...NO(e)&&{backgroundClip:`padding-box`},backgroundRepeat:`no-repeat`,backgroundImage:`url(${i})`,transform:c,backgroundSize:`${Math.round(p)}px ${Math.round(m)}px`,backgroundPositionX:`${-Math.round(d)}px`,backgroundPositionY:`${-Math.round(f)}px`}}))},LO=(e,t,n)=>{if(t!==`change-font-size`||!Wb(e)||e.curveEnabled||!e.text)return e;try{let r=jO(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}},RO={image:IO,svg:IO,text:async({element:e,page:t,store:n,textOverflow:r,textSplitAllowed:i})=>{e=LO(e,r,i);let a=qb(e),o=aC(e.fill),s=aC(e.stroke),c=r===`ellipsis`?mD(e):null;if(e.curveEnabled){let t=Rb(e.text,{fontSize:e.fontSize,fontFamily:e.fontFamily}),{segments:n,curveFontSize:r,segDefaults:i}=SD({normalizedText:t,fontSize:e.fontSize,fontFamily:e.fontFamily,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fill:e.fill}),c;try{c=xD(e,{normalizedText:t,segments:n})}catch{c=e.fontSize*a}let l=uD(e.width,c,e.curvePower,e.fontSize),u=null;if(hD())try{u=VD({element:e,normalizedText:t,path:l,fillOverride:o?`url(#curve-fill-grad-${e.id})`:void 0,strokeOverride:s?`url(#curve-stroke-grad-${e.id})`:void 0})}catch(e){UD(e)}let d=[];u||d.push(`<path id="curve-${e.id}" d="${l}" fill="none" />`),o&&d.push(dD(e.fill,`curve-fill-grad-${e.id}`,u?.bounds)),s&&e.strokeWidth&&d.push(dD(e.stroke,`curve-stroke-grad-${e.id}`,u?.bounds));let f=d.filter(Boolean).join(``),p=`
|
|
350
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="${e.width}" height="${c}" style="display: block; overflow: visible;">${f?`<defs>${f}</defs>`:``}`;if(u)p+=`<g${u.groupAttrsString}>${u.markup}</g></svg>`;else{let t=CD(n,i);p+=`
|
|
351
|
+
<text
|
|
352
|
+
font-family="'${e.fontFamily}'"
|
|
353
|
+
font-size="${e.fontSize}"
|
|
354
|
+
font-weight="${e.fontWeight}"
|
|
355
|
+
font-style="${e.fontStyle}"
|
|
356
|
+
fill="${o?`url(#curve-fill-grad-${e.id})`:e.fill}"
|
|
357
|
+
text-anchor="middle"
|
|
358
|
+
dominant-baseline="central"
|
|
359
|
+
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="${lD(e.strokeLineJoin)}" paint-order="stroke fill"`:``}>
|
|
360
|
+
<textPath href="#curve-${e.id}" startOffset="50%">${t}</textPath>
|
|
361
|
+
</text>
|
|
362
|
+
</svg>`}let m=e.backgroundPadding*(e.fontSize*a);return J(`div`,{style:{position:`relative`,width:`100%`,height:`100%`}},e.backgroundEnabled&&J(`div`,{style:{position:`absolute`,top:-m/2+`px`,left:-m/2+`px`,width:e.width+m+`px`,height:c+m+`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:p}))}let l=e=>({backgroundImage:e,backgroundSize:`100% 100%`,backgroundRepeat:`repeat`,WebkitBackgroundClip:`text`,MozBackgroundClip:`text`,backgroundClip:`text`,WebkitTextFillColor:`transparent`,MozTextFillColor:`transparent`,color:`transparent`}),u=Wb(e)?e.verticalAlign:`top`,d=u===`middle`?{top:`50%`,transform:`translateY(-50%)`}:u===`bottom`?{bottom:0}:{top:0},f={left:0,...d,...o?l(e.fill):{}},p=/<[a-z][\s\S]*>/i.test(e.text),m=p?Rb(e.text,{fontSize:e.fontSize,fontFamily:e.fontFamily}):null;m&&(o||s&&e.strokeWidth)&&(m=TD(m));let h=()=>m?DD({...e,text:m},{textOverflow:r,textIsNormalized:!0}):DD(e,{textOverflow:r}),g=null;if(!e.backgroundEnabled)g=null;else if(e.legacyBackground){let t=e.backgroundPadding*(e.fontSize*a),n=Wb(e)?e.height:(()=>{try{return wO(h()).height}catch{return e.fontSize*a}})();g=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=wO(h());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=vO({rects:t,padding:r,cornerRadius:i});if(o){let i=0;u===`middle`?i=(e.height-n)/2:u===`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)),d=c-r,f=a-r,p=l-c+r*2,m=s-a+r*2;g=J(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:p,height:m,viewBox:`${d} ${f} ${p} ${m}`,style:{position:`absolute`,top:i+f+`px`,left:d+`px`,opacity:e.backgroundOpacity,pointerEvents:`none`},innerHTML:`<path d="${o}" fill="${e.backgroundColor}" />`})}}}let _=m??e.text.split(`
|
|
363
|
+
`).join(`<br />`),v=cD(m??e.text)===`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:`'${e.fontFamily}'`,textDecoration:e.textDecoration||`none`,textDecorationColor:e.textDecoration?e.fill:void 0,textTransform:e.textTransform||`none`,lineHeight:e.lineHeight,letterSpacing:e.letterSpacing*e.fontSize+`px`,fontStyle:e.fontStyle,fontWeight:e.fontWeight,...c},n=s?{...t,...l(e.stroke),WebkitTextStroke:`${e.strokeWidth}px transparent`}:{...t,color:`transparent`,WebkitTextStroke:`${e.strokeWidth}px ${e.stroke}`},r=o?{...t,...l(e.fill)}:{...t,color:e.fill},i=`el-`+e.id,a=i+`-stroke`,u=p?`<style>#${i}, #${a} {${$E}}</style>`:``,f=J(`div`,{style:{...n,position:`absolute`,top:0,left:0,pointerEvents:`none`},"aria-hidden":`true`,...v,...p?{id:a}:{},innerHTML:p?`${u}${_}`:_}),m=J(`div`,{style:{...r,position:`relative`},...v,...p?{id:i}:{},innerHTML:p?`${u}${_}`:_});return J(`div`,{style:{position:`relative`,width:`100%`,height:`100%`}},g,J(`div`,{style:{position:`absolute`,width:e.width+`px`,left:0,...d}},f,m))}let y={...f,position:`absolute`,width:e.width+`px`,color:e.fill,whiteSpace:`pre-wrap`,overflowWrap:`break-word`,fontSize:e.fontSize+`px`,textAlign:e.align,fontFamily:`'${e.fontFamily}'`,textDecoration:e.textDecoration||`none`,textDecorationColor:e.textDecoration?e.fill:void 0,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},b=`el-`+e.id,x=p?{id:b}:{},S=`<style>#${b} {${$E}}</style>`,C=J(`div`,{style:y,...v,...x,innerHTML:p?`${S}${_}`:_});return J(`div`,{style:{position:`relative`,width:`100%`,height:`100%`}},g,C)},line:async({element:e})=>J(`svg`,{style:{display:`block`,width:`100%`,height:`100%`,contain:`layout style size`,overflow:`visible`}},...nw(e)),figure:async({element:e,page:t,store:n})=>{let r=bw(e);if(e.strokeWidth&&aC(e.stroke)){let t=`figure-stroke-grad-${e.id}`,n=dD(e.stroke,t);r=xw(r,`stroke`,e.stroke,t),r=r.replace(`</defs>`,`${n}</defs>`)}if(aC(e.fill)){let t=`figure-fill-grad-${e.id}`,n=dD(e.fill,t);r=xw(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=>zO({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 YD(e.src),o=YC(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=MO(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 FO(e,J(`div`,{style:{position:`relative`,width:`100%`,height:`100%`,overflow:`hidden`,...PO(e)}},J(`video`,{id:m,src:e.src,style:p,controls:!0,playsInline:!0,muted:!0,volume:e.volume})))},gif:IO,table:async({element:e})=>{let t=e.rows,n=e.cols,r=e.colWidths,i=e.rowHeights,a=Ef(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=Df(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=Df(o,e,t);return`${n.width}px ${n.style} ${n.color}`},d={style:{padding:s+`px`,background:o.cellBackground,fontSize:o.fontSize+`px`,fontFamily:`'${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`,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,Yb(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 zO({element:e,page:t,store:n,elementHook:r,textOverflow:i,textSplitAllowed:a,cache:o}){let s=await RO[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}),{filters:l,additionalHTML:u}=KD(e);return $C(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:l.join(` `)||`none`}},c,...u),e)}async function BO({page:e,store:t,elementHook:n,textOverflow:r,textSplitAllowed:i,cache:a}){let o=iw(e.children),s=await Promise.all(o.map(o=>zO({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(rw(e.background)){let{width:n,height:r}=await qC(e.background),i=await IO({element:{x:0,y:0,width:c,height:l,src:e.background,cornerRadius:0,...QC({width:c,height:l},{width:n,height:r})},page:e,store:t,cache:a});s.unshift(i)}else u=aC(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 VO(e,t={}){let{elementHook:n,textSplitAllowed:r=!1}=t,i=t.textOverflow===`resize`||t.textOverflow===`ellipsis`?t.textOverflow:wD,a=Zf(e,{mode:`partial`,requirePages:!1,fillMissingIds:!0,preserveClientData:!0}),o={buffers:new Map},s=await Promise.all(a.pages.map(e=>BO({page:e,store:a,elementHook:n,textOverflow:i,textSplitAllowed:r,cache:o})));return J(`div`,{className:`design`},...Hb(a).map(e=>{let t=a.fonts.find(t=>t.fontFamily===e);return t?J(`style`,{},Mx(t).map(e=>`
|
|
364
|
+
@font-face {
|
|
365
|
+
font-family: '${t.fontFamily}';
|
|
366
|
+
src: ${e.src};
|
|
367
|
+
font-style: ${e.fontStyle};
|
|
368
|
+
font-weight: ${e.fontWeight};
|
|
369
|
+
font-display: swap;
|
|
370
|
+
}`).join(`
|
|
371
|
+
`)):J(`link`,{href:lx(e),rel:`stylesheet`})}),...s)}var HO=(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}"`,UO=({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(`; `)}"`:HO(e,n[e])).filter(e=>e&&e.trim().length>0).join(` `);return`<${e.type} ${r}>${t||e.children.map(e=>UO({dom:e})).join(``)}</${e.type}>`};async function WO(e,t={}){return UO({dom:await VO(e,t)})}function GO(e,t,n){let r=n.ascent/3,i=7+r,a=n.inkAscent+n.inkDescent,o=a>0?r/a:1;return{x:e.isRtl?e.right+i+n.inkLeft*o:e.left-i-n.inkRight*o,y:t-r+(n.inkAscent-n.inkDescent)/2*o,scale:o}}function KO(e,t,n){return{x:e.isRtl?e.right+n.spaceWidth+n.markerWidth:e.left-n.markerWidth-n.spaceWidth,y:t,direction:e.isRtl?`rtl`:void 0}}function qO(e,t,n){let r=dC(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`,...fC({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 JO=(e,t)=>e===`center`?`middle`:e===`right`==(t===`rtl`)?`start`:`end`,YO=(e,t)=>{let n=gD(e,`M`);return{ascent:n.fontBoundingBoxAscent??t*.8,descent:n.fontBoundingBoxDescent??t*.2}},XO=(e,t,n)=>(e-(t+n))/2+t,ZO=e=>{let t=e.length;for(;t>0&&e[t-1].text.trim()===``;)t--;return e.slice(0,t)},QO=(e,t)=>PC(e,{cache:t,binary:!0}).catch(t=>(console.error(`Error converting URL to data URL:`,t),e)),$O=async({element:e,page:t,store:n,cache:r})=>{let[i,o,s]=await Promise.all([e.type===`svg`?FC(e.src,{cache:r}).then(t=>WC(t,new Map(Object.entries(e.colorsReplace)))):QO(e.src,r),e.clipSrc?QO(e.clipSrc,r):void 0,e.maskSrc?QO(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,{cropScaledX:d,cropScaledY:f,cropScaledWidth:p,cropScaledHeight:m}=XC(e,await qC(i)),h=`clip-${e.id}`,g=e.cornerRadius||0,_=i.replace(/&/g,`&`),v={x:-d,y:-f,width:p,height:m,preserveAspectRatio:`none`,"clip-path":`url(#${h})`},y=[J(`clipPath`,{id:h},J(`rect`,{x:0,y:0,width:e.width,height:e.height,rx:g||void 0,ry:g||void 0}))];l&&o&&y.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`}))),u&&y.push(J(`mask`,{id:u,maskUnits:`userSpaceOnUse`,"mask-type":`alpha`},J(`image`,{href:_,...v})));let b=_,x=v,S={};if(u&&s&&(b=s.replace(/&/g,`&`),S.mask=`url(#${u})`),u&&s){let t=await qC(s),n=QC(e,t),r=XC({...e,...n,stretchEnabled:!0},t);x={...v,x:-r.cropScaledX,y:-r.cropScaledY,width:r.cropScaledWidth,height:r.cropScaledHeight}}let C={};l&&(C.mask=`url(#${l})`);let w=e.borderSize||0,T=w>0&&aC(e.borderColor),E=T?`border-grad-${e.id}`:null;if(T){let t=qO(e.borderColor,E);t&&y.push(t)}let D=w>0?J(`rect`,{x:w/2,y:w/2,width:Math.max(0,e.width-w),height:Math.max(0,e.height-w),fill:`none`,stroke:T?`url(#${E})`:e.borderColor,"stroke-width":w,rx:Math.max(0,g-w)||void 0,ry:Math.max(0,g-w)||void 0}):null,O=J(`g`,{},J(`defs`,{},...y),J(`image`,{href:b,...x,...S}),D);return c?J(`g`,C,J(`g`,{transform:c},O)):J(`g`,C,O)},ek=async({element:e,page:t,store:n,textOverflow:r})=>{let i=qb(e),a=aC(e.fill),o=aC(e.stroke),s=r===`change-font-size`;if(e.curveEnabled){let t=Rb(e.text,{fontSize:e.fontSize,fontFamily:e.fontFamily}),{segments:n,curveFontSize:r,segDefaults:s}=SD({normalizedText:t,fontSize:e.fontSize,fontFamily:e.fontFamily,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fill:e.fill}),c;try{c=xD(e,{normalizedText:t,segments:n})}catch{c=e.fontSize*i}let l=uD(e.width,c,e.curvePower,e.fontSize),u=rD(e.id||`temp`),d=`curve-path-${u}`,f=null;if(hD())try{f=VD({element:e,normalizedText:t,path:l,fillOverride:a?`url(#curve-fill-grad-${u})`:void 0,strokeOverride:o?`url(#curve-stroke-grad-${u})`:void 0})}catch(e){UD(e)}let p=e.backgroundPadding*(e.fontSize*i*.5),m=e.backgroundEnabled?J(`rect`,{x:-p,y:-p,width:e.width+p*2,height:c+p*2,fill:e.backgroundColor,opacity:e.backgroundOpacity,rx:e.backgroundCornerRadius*(e.fontSize*i*.5),ry:e.backgroundCornerRadius*(e.fontSize*i*.5)}):null,h=f?[]:[J(`path`,{id:d,d:l,fill:`none`})];if(a){let t=`curve-fill-grad-${u}`,n=qO(e.fill,t,f?.bounds);n&&h.push(n)}if(o&&e.strokeWidth){let t=`curve-stroke-grad-${u}`,n=qO(e.stroke,t,f?.bounds);n&&h.push(n)}if(f)return J(`g`,{},m,h.length?J(`defs`,{},...h):null,J(`g`,{...f.groupAttrs,innerHTML:f.markup}));let g=e.strokeWidth&&(o||a&&!o),_=CD(n,s),v=CD(n,s,{omitColors:!0});if(g){let t={"font-size":e.fontSize+`px`,"text-anchor":`middle`,"dominant-baseline":`central`,"font-family":e.fontFamily,"font-style":e.fontStyle,"font-weight":e.fontWeight,"text-decoration":e.textDecoration||void 0,"letter-spacing":e.letterSpacing*r},n=o?`url(#curve-stroke-grad-${u})`:e.stroke,i=J(`text`,{...t,fill:n,"stroke-width":e.strokeWidth,stroke:n,"stroke-linejoin":lD(e.strokeLineJoin)},J(`textPath`,{href:`#${d}`,startOffset:`50%`,innerHTML:v})),s=a?`url(#curve-fill-grad-${u})`:e.fill,c=J(`text`,{...t,fill:s},J(`textPath`,{href:`#${d}`,startOffset:`50%`,innerHTML:_}));return J(`g`,{},m,h.length?J(`defs`,{},...h):null,i,c)}return J(`g`,{},m,h.length?J(`defs`,{},...h):null,J(`text`,{fill:a?`url(#curve-fill-grad-${u})`:e.fill,"font-size":e.fontSize+`px`,"text-anchor":`middle`,"dominant-baseline":`central`,"font-family":e.fontFamily,"font-style":e.fontStyle,"font-weight":e.fontWeight,"text-decoration":e.textDecoration||void 0,"letter-spacing":e.letterSpacing*r,"stroke-width":e.strokeWidth||void 0,stroke:e.strokeWidth?o?`url(#curve-stroke-grad-${u})`:e.stroke:void 0,"stroke-linejoin":e.strokeWidth?lD(e.strokeLineJoin):void 0,"paint-order":e.strokeWidth?`stroke fill`:void 0},J(`textPath`,{href:`#${d}`,startOffset:`50%`,innerHTML:_})))}let c=(e,t,n,r=0)=>gD(e,t).width+Math.max(0,(t?t.length:0)-1)*r*n,l=new Map,u=(e,t)=>{let n=l.get(e);return n||l.set(e,n=YO(e,t)),n},d=(t,n)=>t.fontSize!=null&&t.fontSize!==e.fontSize&&e.fontSize>0?t.fontSize*(n/e.fontSize):n,f=(t,n)=>`${t.italic?`italic`:e.fontStyle||`normal`} ${t.bold?`bold`:e.fontWeight||`normal`} ${n}px ${t.fontFamily||e.fontFamily}`,p=e=>f({text:``},e),m=(e,t,n)=>{let r=d(e,t);return c(f(e,r),e.text,r,n)},h=(e,t,n)=>{let r=t*i;for(let t of e)t.text&&(r=Math.max(r,n(t)*i));return r},g=(e,t)=>{let n=e=>e.fontSize??t,r=h(e,t,n),{ascent:i,descent:a}=u(p(t),t);for(let t of e){if(!t.text)continue;let e=n(t),r=u(f(t,e),e);i=Math.max(i,r.ascent),a=Math.max(a,r.descent)}return{height:r,baseline:XO(r,i,a)}},_=e=>Math.round(e*1e3)/1e3,v=(t,n)=>{let r=[],i=0;for(let e of t){let t=g(e,n);r.push({top:i,height:t.height,baseline:i+t.baseline}),i+=t.height}let a=Jb(e,i);return{stacked:r,boxHeight:a,offsetY:e.verticalAlign===`middle`?(a-i)/2:e.verticalAlign===`bottom`?a-i:0}},y=(e,t)=>e.reduce((e,n)=>e+h(n,t,e=>d(e,t)),0),b=(e,t,n)=>m(e,t,n)+(e.text?n*d(e,t):0),x=t=>{let n=gD(p(t),` `).width;return{interval:(n+(e.letterSpacing||0)*t)*8,halfSpace:n/2}},S=new Map,C=e=>{let t=S.get(e);return t||S.set(e,t=x(e)),t},w=e=>e.some(e=>e.text===` `),T=(e,{interval:t,halfSpace:n})=>{if(!(t>0))return 0;let r=t-e%t;return r<n?r+t:r},E=/<[a-z][\s\S]*>/i.test(e.text),D=e.text;!E&&D.includes(`
|
|
372
|
+
`)&&(D=D.split(`
|
|
373
|
+
`).map(e=>`<p>${e}</p>`).join(``));let O=Rb(D,{fontSize:e.fontSize,fontFamily:e.fontFamily}),ee={fontSize:e.fontSize,fontFamily:e.fontFamily},k=[],A=new DOMParser().parseFromString(O,`text/html`),j=A.body.querySelectorAll(`p`);j.length>0?j.forEach((e,t)=>{let n=e.innerHTML,r=ax(n,ee);k.push(...r),t<j.length-1&&k.push({text:`
|
|
374
|
+
`})}):k.push(...ax(O,ee)),e.textTransform===`uppercase`&&k.forEach(e=>{e.text!==`
|
|
375
|
+
`&&(e.text=e.text.toUpperCase())});let M=e=>{let t=[],n=[];for(let r of e){if(r.text===`
|
|
376
|
+
`){n.length>0&&(t.push(n),n=[]),t.push([{...r,text:`
|
|
377
|
+
`}]);continue}let e=r.text.split(/(\n| |\t)/);for(let i of e)i!==``&&(i===` `||i===`
|
|
378
|
+
`||i===` `?(n.length>0&&(t.push(n),n=[]),t.push([{...r,text:i}])):n.push({...r,text:i}))}return n.length>0&&t.push(n),t},te=(e,t,n)=>{let r=C(t),i=0;for(let a of e)i+=a.text===` `?T(i,r):b(a,t,n);return i},N=(e,t,n)=>w(e)?te(e,t,n):e.reduce((e,r)=>e+m(r,t,n),0),P=(t,n,r,i)=>{if(e.align!==`justify`||n)return;let a=ZO(t);if(w(a))return;let o=a.filter(e=>e.text===` `).length;if(o===0)return;let s=r-te(a,i,e.letterSpacing);if(!(s<=0))return`${Math.round(s/o*1e3)/1e3}px`},F=(e,t,n,r)=>{let i=[[]],a=new Set,o=.5,s=0;for(let c of e){if(c.length===1&&c[0].text===`
|
|
379
|
+
`){i.push([]),a.add(i.length-1),s=0;continue}if(c.length===1&&c[0].text===` `){let e=te(i[i.length-1],n,r),a=T(e,C(n));e+a<=t+o&&(i[i.length-1].push(...c),s=e+a);continue}let e=c.reduce((e,t)=>e+m(t,n,r),0);if(c.length===1&&c[0].text===` `){s+e<=t+o&&(i[i.length-1].push(...c),s+=e);continue}if(s+e>t+o&&i[i.length-1].length>0&&(i.push([]),s=0),e>t+o){for(let e of c){let a=Array.from(e.text),c=0;for(;c<a.length;){let l=t+o-s,u=t=>m({...e,text:a.slice(c,c+t).join(``)},n,r),d=0,f=a.length-c;for(;d<f;){let e=Math.ceil((d+f)/2);u(e)<=l?d=e:f=e-1}if(d===0){if(i[i.length-1].length>0){i.push([]),s=0;continue}d=1}i[i.length-1].push({...e,text:a.slice(c,c+d).join(``)}),s+=u(d),c+=d,c<a.length&&(i.push([]),s=0)}}continue}i[i.length-1].push(...c),s+=e}return{lines:i,lastInParagraph:i.map((e,t)=>t===i.length-1||a.has(t+1))}},ne=(e,t,n,r,i)=>{if(!w(e))return CD(e,t,i);let a=e=>{let t=e.fontSize??n;return c(f(e,t),e.text,t,r)+(e.text?r*t:0)},o=C(n),s=``,l=[],u=0,d=0,p=()=>{if(l.length===0)return;let e=CD(l,t,i);s+=d>0?`<tspan dx="${Math.round(d*1e3)/1e3}">${e}</tspan>`:e,u+=l.reduce((e,t)=>e+a(t),0),d=0,l=[]};for(let t of e){if(t.text!==` `&&t.text!==` `){l.push(t);continue}p();let e=t.text===` `?T(u,o):a(t);d+=e,u+=e}return p(),s},re=(e,t)=>t===1?e:e.map(e=>e.map(e=>e.fontSize?{...e,fontSize:Math.round(e.fontSize*t*1e3)/1e3}:e));if(A.body.querySelector(`ul, ol`)){let t=[],n=cD(e.text),r=t=>{let n=t.cloneNode(!0);n.querySelectorAll(`ul, ol`).forEach(e=>e.remove());let r=ax(n.innerHTML,ee);return e.textTransform===`uppercase`&&r.forEach(e=>{e.text!==`
|
|
380
|
+
`&&(e.text=e.text.toUpperCase())}),r},l=(e,t)=>{let n=e.getAttribute(`dir`)||e.style?.direction||``;return n===`rtl`||n!==`ltr`&&t},u=(e,n,i,a)=>{let o=e.tagName.toLowerCase()===`ol`,s=i?a:a+1,c=l(e,i),d=parseInt(e.getAttribute(`start`)||`1`,10)||1;for(let i of Array.from(e.children)){if(i.tagName.toLowerCase()!==`li`)continue;let e=i.getAttribute(`value`);e&&!Number.isNaN(parseInt(e,10))&&(d=parseInt(e,10));let a=o?{text:`${d}.`,isOrdered:!0}:{text:`•`,isOrdered:!1},f=l(i,c);t.push({segments:r(i),depth:n,marker:a,isRtl:f,padLeftLevels:s}),o&&(d+=1);for(let e of Array.from(i.children)){let t=e.tagName.toLowerCase();(t===`ul`||t===`ol`)&&u(e,n+1,f,s)}}},d=n===`rtl`;for(let e of Array.from(A.body.children)){let n=e.tagName.toLowerCase();n===`ul`||n===`ol`?u(e,1,d,0):t.push({segments:n===`p`||n===`div`?r(e):ax(e.outerHTML,ee),depth:0,marker:null,isRtl:l(e,d),padLeftLevels:0})}let f=t=>Math.max(1,e.width-t),m=n=>{let r=[],i=[],a=2.1*n;for(let o of t){let t=f(o.depth*a),s=o.padLeftLevels*a,c={left:s,right:s+t,isRtl:o.isRtl},{lines:l,lastInParagraph:u}=F(M(o.segments),t,n,e.letterSpacing);l.forEach((e,t)=>{r.push(e),i.push({contentBox:c,marker:t===0?o.marker:null,lastInParagraph:u[t]})})}return{L:r,M:i}},h=e.fontSize,_=[],b=[];for(;;){let t=m(h);_=t.L,b=t.M;let n=Math.max(0,..._.map((t,n)=>b[n].contentBox.left+N(t,h,e.letterSpacing))),r=y(_,h);if(n<=e.width&&(!Wb(e)||r<=e.height)||!s||(--h,h<4))break}let x=_.map((e,t)=>P(e,b[t].lastInParagraph,b[t].contentBox.right-b[t].contentBox.left,h));_=re(_,h/e.fontSize);let S=h*i,{stacked:C,boxHeight:w,offsetY:T}=v(_,h),E={fontWeight:e.fontWeight||`normal`,fontStyle:e.fontStyle||`normal`,fill:e.fill||`black`,fontFamily:e.fontFamily,fontSize:h},D=e=>T+C[e].baseline,O=g([],h).baseline,k=e=>T+C[e].top+O,j=JO(e.align,n),te=t=>e.align===`justify`&&t.lastInParagraph&&t.contentBox.isRtl,I=t=>e.align===`center`?(t.left+t.right)/2:e.align===`right`?t.right:t.left,L=p(h),R=gD(L,` `).width,ie=b.map((t,n)=>{if(!t.marker)return null;let r=k(n),i;if(t.marker.isOrdered){let n=c(L,t.marker.text,h,e.letterSpacing);i=KO(t.contentBox,r,{markerWidth:n,spaceWidth:R})}else{let e=gD(L,t.marker.text);i=GO(t.contentBox,r,{ascent:e.fontBoundingBoxAscent??e.actualBoundingBoxAscent??h*.8,inkLeft:e.actualBoundingBoxLeft??0,inkRight:e.actualBoundingBoxRight??0,inkAscent:e.actualBoundingBoxAscent??0,inkDescent:e.actualBoundingBoxDescent??0})}return J(`tspan`,{x:i.x,y:i.y,direction:i.direction,"unicode-bidi":i.direction?`isolate`:void 0,"letter-spacing":t.marker.isOrdered?e.letterSpacing*h+`px`:void 0,"font-size":i.scale==null?void 0:`${h*i.scale}px`,innerHTML:rD(t.marker.text)})}),ae=t=>{let r=[];return _.forEach((i,a)=>{let o=ZO(i);o.length>0&&r.push(J(`tspan`,{x:te(b[a])?b[a].contentBox.right:I(b[a].contentBox),"text-anchor":te(b[a])?JO(`right`,n):void 0,y:D(a),"word-spacing":x[a],innerHTML:ne(o,E,h,e.letterSpacing,{omitColors:t})}))}),r},oe=e.strokeWidth?o?`url(#text-stroke-grad-${e.id})`:e.stroke:void 0,se=ie.filter(Boolean),z=t=>se.length===0?null:J(`text`,{"font-size":h+`px`,"text-anchor":`start`,"font-family":e.fontFamily,"font-style":e.fontStyle,"font-weight":e.fontWeight,fill:t,stroke:oe,"stroke-width":e.strokeWidth||void 0,"stroke-linejoin":e.strokeWidth?lD(e.strokeLineJoin):void 0,"paint-order":e.strokeWidth?`stroke fill`:void 0},...se.map(e=>J(`tspan`,e.props,e.props.innerHTML))),ce=null;if(e.backgroundEnabled){let t=e.backgroundPadding*(S*.5),n=e.backgroundCornerRadius*(S*.5);if(e.legacyBackground)ce=J(`rect`,{x:-t,y:-t,width:e.width+t*2,height:w+t*2,fill:e.backgroundColor,opacity:e.backgroundOpacity,rx:n,ry:n});else{let r=vO({rects:yO({lines:_.map((t,n)=>{let r=ZO(t);return{width:r.length===0?0:N(r,h,e.letterSpacing),lastInParagraph:b[n].lastInParagraph,contentBox:b[n].contentBox,alignLast:b[n].contentBox.isRtl?`right`:void 0,box:C[n]}}),lineHeight:S,width:e.width,align:e.align===`justify`?`justify`:e.align}),padding:t,cornerRadius:n});r&&(ce=J(`path`,{d:r,fill:e.backgroundColor,opacity:e.backgroundOpacity,transform:T?`translate(0,${T})`:void 0}))}}let le=[];if(a){let t=qO(e.fill,`text-fill-grad-${e.id}`);t&&le.push(t)}if(o&&e.strokeWidth){let t=qO(e.stroke,`text-stroke-grad-${e.id}`);t&&le.push(t)}let ue=e.strokeWidth&&(o||a&&!o),de={"font-size":h+`px`,"text-anchor":j,direction:n===`rtl`?`rtl`:void 0,"font-family":e.fontFamily,"font-style":e.fontStyle,"font-weight":e.fontWeight,"text-decoration":e.textDecoration,"letter-spacing":e.letterSpacing*h+`px`};if(ue){let t=ae(!0),n=o?`url(#text-stroke-grad-${e.id})`:e.stroke,r=J(`text`,{...de,fill:n,"stroke-width":e.strokeWidth,stroke:n,"stroke-linejoin":lD(e.strokeLineJoin)},...t.map(e=>J(`tspan`,e.props,e.props.innerHTML))),i=a?`url(#text-fill-grad-${e.id})`:e.fill,s=a?t:ae(!1),c=J(`text`,{...de,fill:i},...s.map(e=>J(`tspan`,e.props,e.props.innerHTML)));return J(`g`,{},ce,le.length>0?J(`defs`,{},...le):null,r,c,z(i))}let fe=a?`url(#text-fill-grad-${e.id})`:e.fill;return J(`g`,{},ce,le.length>0?J(`defs`,{},...le):null,J(`text`,{...de,fill:fe,"stroke-width":e.strokeWidth||void 0,stroke:e.strokeWidth?e.stroke:void 0,"stroke-linejoin":e.strokeWidth?lD(e.strokeLineJoin):void 0,"paint-order":e.strokeWidth?`stroke fill`:void 0},...ae(!1)),z(fe))}let I=e.fontSize,L=M(k),R=[],ie=[];for(;;){({lines:R,lastInParagraph:ie}=F(L,e.width,I,e.letterSpacing));let t=Math.max(...R.map(t=>N(t,I,e.letterSpacing)),0),n=y(R,I);if(t<=e.width&&(!Wb(e)||n<=e.height)||!s||(--I,I<4))break}let ae=R.map((t,n)=>P(t,ie[n],e.width,I));R=re(R,I/e.fontSize);let oe=I*i,{stacked:se,boxHeight:z,offsetY:ce}=v(R,I),le=cD(e.text),ue=JO(e.align,le),de=le===`rtl`?`rtl`:void 0,fe={fontWeight:e.fontWeight||`normal`,fontStyle:e.fontStyle||`normal`,fill:e.fill||`black`,fontFamily:e.fontFamily,fontSize:I},pe=ce+(se[0]?.baseline??0),me=e=>e===0?0:_(se[e].baseline-se[e-1].baseline),he=e.align===`center`?e.width/2:e.align===`right`?e.width:0,ge=R.map((t,n)=>{let r=ZO(t),i=r.length===0?``:ne(r,fe,I,e.letterSpacing);return J(`tspan`,{x:he,dy:me(n),"word-spacing":ae[n],innerHTML:i})}),_e=e.backgroundPadding*(oe*.5),ve=e.backgroundCornerRadius*(oe*.5),ye=()=>J(`rect`,{x:-_e,y:-_e,width:e.width+_e*2,height:z+_e*2,fill:e.backgroundColor,opacity:e.backgroundOpacity,rx:ve,ry:ve}),be=null;if(e.backgroundEnabled){if(e.legacyBackground)be=ye();else{let t=vO({rects:yO({lines:R.map((t,n)=>({width:t.length===0?0:N(ZO(t),I,e.letterSpacing),lastInParagraph:ie[n],box:se[n]})),lineHeight:oe,width:e.width,align:e.align===`justify`?`justify`:e.align}),padding:_e,cornerRadius:ve});t&&(be=J(`path`,{d:t,fill:e.backgroundColor,opacity:e.backgroundOpacity,transform:ce?`translate(0,${ce})`:void 0}))}}let xe=[],Se=e.strokeWidth&&(o||a&&!o);if(a){let t=`text-fill-grad-${e.id}`,n=qO(e.fill,t);n&&xe.push(n)}if(o&&e.strokeWidth){let t=`text-stroke-grad-${e.id}`,n=qO(e.stroke,t);n&&xe.push(n)}if(Se){let t=R.map((t,n)=>{let r=ZO(t),i=ne(r,fe,I,e.letterSpacing,{omitColors:!0});return J(`tspan`,{x:he,dy:me(n),"word-spacing":ae[n],innerHTML:i})}),n={y:pe,"font-size":I+`px`,"text-anchor":ue,direction:de,"font-family":e.fontFamily,"font-style":e.fontStyle,"font-weight":e.fontWeight,"text-decoration":e.textDecoration,"letter-spacing":e.letterSpacing*I+`px`},r=o?`url(#text-stroke-grad-${e.id})`:e.stroke,i=J(`text`,{...n,fill:r,"stroke-width":e.strokeWidth,stroke:r,"stroke-linejoin":lD(e.strokeLineJoin)},...t.map(e=>J(`tspan`,e.props,e.props.innerHTML))),s=a?`url(#text-fill-grad-${e.id})`:e.fill,c=a?t:ge,l=J(`text`,{...n,fill:s},...c.map(e=>J(`tspan`,e.props,e.props.innerHTML)));return J(`g`,{},be,xe.length>0?J(`defs`,{},...xe):null,i,l)}return J(`g`,{},be,xe.length>0?J(`defs`,{},...xe):null,J(`text`,{fill:a?`url(#text-fill-grad-${e.id})`:e.fill,y:pe,"font-size":I+`px`,"text-anchor":ue,direction:de,"font-family":e.fontFamily,"font-style":e.fontStyle,"font-weight":e.fontWeight,"text-decoration":e.textDecoration,"letter-spacing":e.letterSpacing*I+`px`,"stroke-width":e.strokeWidth||void 0,stroke:e.strokeWidth?e.stroke:void 0,"stroke-linejoin":e.strokeWidth?lD(e.strokeLineJoin):void 0,"paint-order":e.strokeWidth?`stroke fill`:void 0},...ge))},tk=async({element:e})=>J(`g`,{},...nw(e)),nk=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=>sk({element:e,page:t,store:n,elementHook:r,textOverflow:i,cache:a}))));function rk(e){let t=e.replace(/<svg[^>]*>/,``);return t=t.replace(/<\/svg>/,``),t}var ik=async({element:e,page:t,store:n})=>{let r=rk(bw(e)),i=[];if(e.strokeWidth&&aC(e.stroke)){let t=`figure-stroke-grad-${e.id}`,n=qO(e.stroke,t);n&&(i.push(n),r=xw(r,`stroke`,e.stroke,t))}if(aC(e.fill)){let t=`figure-fill-grad-${e.id}`,n=qO(e.fill,t);n&&(i.push(n),r=xw(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})},ak=(e,t,n)=>({...e,width:n.width,height:n.height,text:rD(t)}),ok={image:$O,svg:$O,text:ek,line:tk,figure:ik,group:nk,gif:$O,table:async({element:e,page:t,store:n,textOverflow:r})=>{let i=e.cols,a=e.colWidths,o=e.rowHeights,s=Ef(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)=>Df(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:Yb(e.text||``)})).filter(({text:e})=>e).map(async({cell:i,text:a})=>{let o=l(i),s=Of(i,e),c=i.cellPadding,u={x:o.x+s.left+c,y:o.y+s.top+c,width:Math.max(0,o.width-s.left-s.right-c*2),height:Math.max(0,o.height-s.top-s.bottom-c*2)},d=await ek({element:ak(i,a,u),page:t,store:n,textOverflow:r});return J(`g`,{transform:`translate(${u.x}, ${u.y})`},d)}));return J(`g`,{},...c,...f)}};async function sk({element:e,page:t,store:n,elementHook:r,textOverflow:i,cache:a}){let o=await ok[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}),{filters:c,additionalHTML:l}=KD(e),u=l.map(e=>e.replace(/<svg([^>]*)>/,`<g$1>`).replace(/<\/svg>/,`</g>`));return $C(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?void 0:`none`,opacity:e.opacity,style:{"transform-origin":`top left`,filter:c.join(` `)}},s,...u),e)}async function ck({page:e,store:t,elementHook:n,textOverflow:r,cache:i}){let a=iw(e.children),o=await Promise.all(a.map(a=>sk({element:a,page:e,store:t,elementHook:n,textOverflow:r,cache:i}))),s={},c=rw(e.background),l;if(c){let n=await qC(e.background);l=J(`image`,{"xlink:href":await ZC(e.background,{width:t.width,height:t.height,x:0,y:0,...QC({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(aC(e.background)){let n=`page-bg-gradient-${e.id}`;l=J(`g`,{},J(`defs`,{},qO(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 lk(e){try{return`data:font/ttf;base64,${mS(await bx(e))}`}catch(t){return console.error(`Error embedding font:`,t),e}}async function uk(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=Mx(n);return J(`style`,{},(await Promise.all(t.map(async t=>{let r=await lk(t.src?.match(/url\("?(.*?)"?\)/)?.[1]||n.url);return`@font-face {
|
|
381
|
+
font-family: '${e}';
|
|
382
|
+
font-style: ${t.fontStyle};
|
|
383
|
+
font-weight: ${t.fontWeight};
|
|
384
|
+
src: url(${r});
|
|
385
|
+
}`}))).join(`
|
|
386
|
+
`))}try{let t=await Ax(e);return J(`style`,{},(await Promise.all([...t].map(async([t,n])=>{let[r,i]=t.split(`,`),a=await lk(n);return`@font-face {
|
|
387
|
+
font-family: '${e}';
|
|
388
|
+
font-style: ${r===`1`?`italic`:`normal`};
|
|
389
|
+
font-weight: ${i};
|
|
390
|
+
src: url(${a});
|
|
391
|
+
}`}))).join(`
|
|
392
|
+
`))}catch(t){return console.error(`Error embedding Google Font:`,t),J(`defs`,{},J(`style`,{type:`text/css`,innerHTML:`@import url('${Sx(e)}');`.replace(/&/g,`&`)}))}}))}async function dk(e,t={}){let{elementHook:n}=t,r=t.fontEmbedding===`none`?`none`:`inline`,i=t.textOverflow===`resize`?`resize`:wD,a=Zf(e,{mode:`partial`,requirePages:!1,fillMissingIds:!0,preserveClientData:!0}),o=Hb(a),s={buffers:new Map},[c,l]=await Promise.all([r===`inline`?uk(o,a.fonts):Promise.resolve([]),Promise.all(a.pages.map(e=>ck({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 fk=(e,t)=>typeof t==`object`?`${e}="${Object.keys(t).map(e=>`${e}:${t[e]};`).join(` `)}"`:t==null||t===``?``:`${e}="${rD(String(t))}"`,pk=({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=>fk(e,i[e])).filter(e=>e&&e.trim().length>0).join(` `),o=n?``:` `.repeat(t),s=n?``:`
|
|
393
|
+
`,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=>pk({dom:e,nestLevel:t+1,inline:l})).join(``);return l?`${c}${u}</${e.type}>${s}`:`${c}\n${u}${o}</${e.type}>${s}`};async function mk(e,t={}){return pk({dom:await dk(e,t)})}var hk=new Set,gk=(e,t)=>{hk.has(e)||(hk.add(e),console.warn(t))},_k=q.model(`Node`,{id:q.identifier,type:`none`,name:``,opacity:1,custom:q.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 Yh(e)?Hh(e,SA):null},get store(){return Yh(e)?Hh(e,DA):null},get top(){if(!Yh(e))return e;let t=e;for(;;){if(!Vh(t,yA))return t;t=Hh(t,yA)}},get parent(){if(!Yh(e))return null;if(Vh(e,yA)){let t=Hh(e,yA);return t&&t.children&&t.children.length,t}if(Vh(e,SA)){let t=Hh(e,SA);return t&&t.children&&t.children.length,t}if(Vh(e,DA)){let t=Hh(e,DA);return t&&t.pages&&t.pages.length,t}return null},get zIndex(){return Yh(e)?e.parent.children.indexOf(e):-1}})).actions(e=>({toJSON:()=>Object.assign({},zh(e))})).actions(e=>({clone(t={},{skipSelect:n=!1}={}){let r=JSON.parse(JSON.stringify(e.toJSON()));t.id=t.id||yy(10);let i=new Map;return bb(r,e=>{let t=e.id,n=yy(10);i.set(t,n),e.id=n}),bb(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 vk(e){return e/180*Math.PI}function yk(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 bk(e){let[t,n,r,i]=xk(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 xk(e){let{x:t,y:n,width:r,height:i}=e,a=vk(e.rotation);return[yk(t,n,0,0,a),yk(t,n,r,0,a),yk(t,n,r,i,a),yk(t,n,0,i,a)]}function Sk(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 Ck(e){let t=e.map(e=>bk(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 wk(e){let t=vk(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 Tk(e,t,n){let r=vk(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 Ek(e,t){return Tk(e,t,wk(e))}var Dk={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}}},Ok={right:{cropX:-1},left:{cropX:1},up:{cropY:1},down:{cropY:-1}},kk={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 Ek({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=Dk[n.data.direction]||Dk.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=Ok[n.data.direction||`right`]||Ok.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}},Ak=({element:e,dTime:t,animation:n})=>{let r=kk[n.name];return r?r({element:e,dTime:t,animation:n}):(console.error(`Can not find animation type: `+n.name),{})},jk=q.model(`Animation`,{delay:0,duration:500,enabled:!0,type:q.enumeration(`Type`,[`enter`,`exit`,`loop`]),name:`none`,data:q.frozen({})}),Mk=(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},Nk=q.model(`ShapeFilter`,{intensity:1}),Pk=[`temperature`,`contrast`,`highlights`,`shadows`,`white`,`black`,`saturation`,`vibrance`],Fk=_k.named(`Shape`).props({x:0,y:0,width:100,height:100,rotation:0,opacity:1,animations:q.array(jk),blurEnabled:!1,blurRadius:10,brightnessEnabled:!1,brightness:0,sepiaEnabled:!1,grayscaleEnabled:!1,filters:q.map(Nk),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=Xt(i),o=dr(e=>{for(let t in e)a[t]=e[t]}),s=dr(e=>{Object.assign(a,e)}),c=dr(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(!Yh(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=Mk(e,Ak({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=Mk(e,Ak({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=Mk(e,Ak({element:e,animation:h,dTime:i}));c(t)}return a},animated(e){return this.a[e]},get timeRange(){return Yh(e)&&e.page?h(e.animations,e.page.duration):{start:0,end:0}},get active(){if(!Yh(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!!Yh(e)&&e.store.selectedShapes.indexOf(e)>=0&&e.selectable},get isSelectedDirectly(){return!!Yh(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){Pk.includes(t)||e.filters.forEach((t,n)=>{Pk.includes(n.toString())||e.filters.delete(n.toString())}),n==null?e.filters.delete(t):e.filters.set(t,{intensity:n})}})),Ik=e=>typeof e==`string`?Gb(e)??e:e,Lk=Fk.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:q.optional(q.union(q.number,q.string),1.2),letterSpacing:0,_editModeEnabled:!1,backgroundEnabled:!1,backgroundColor:`#7ED321`,backgroundOpacity:1,backgroundCornerRadius:.5,backgroundPadding:.5,legacyBackground:q.maybe(q.boolean),curveEnabled:!1,curvePower:.5}).preProcessSnapshot(e=>{let t=Object.assign(Object.assign({},e),{fontSize:e.fontSize!=null&&e.fontSize<1?1:e.fontSize,lineHeight:Ik(e.lineHeight)});return Wb(t)||delete t.height,t}).actions(e=>{let t=e.set;return{set(e){e.fontSize!=null&&e.fontSize<1&&(e=Object.assign(Object.assign({},e),{fontSize:1})),typeof e.lineHeight==`string`&&(e=Object.assign(Object.assign({},e),{lineHeight:Ik(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()}}}),Rk=Fk.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=Xt.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)}}}}),zk=Rk.named(`Video`).props({type:`video`,duration:0,startTime:0,endTime:1,volume:1,speed:1}),Bk=Fk.named(`Line`).props({type:`line`,width:400,height:10,color:`black`,dash:q.array(q.number),startHead:``,endHead:``}).actions(e=>({})),Vk=Fk.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:q.map(q.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()}})),Hk=Fk.named(`Figure`).props({type:`figure`,subType:`rect`,fill:`rgb(0, 161, 255)`,dash:q.array(q.number),strokeWidth:0,stroke:`rgba(98, 197, 255, 1)`,cornerRadius:0}),Uk=Rk.named(`Gif`).props({type:`gif`,duration:0,keepRatio:!0}),Wk=.05,Gk=q.enumeration([`solid`,`dashed`,`dotted`,`none`]);function Kk(e){return Bh(e,2)}function qk(e,t,n){return e[`_${t}`]??(Yh(e)?Kk(e)[t]:n)}function Jk(e){return Bh(e,1)}var Yk=q.model(`BorderSide`,{color:q.maybe(q.string),width:q.maybe(q.number),style:q.maybe(Gk)}).postProcessSnapshot(e=>{let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=r);return t}),Xk=q.model(`CellBorders`,{top:q.maybe(Yk),right:q.maybe(Yk),bottom:q.maybe(Yk),left:q.maybe(Yk)}).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}),Zk=Tf,Qk=new Set(Zk),$k=[`blurEnabled`,`blurRadius`,`brightnessEnabled`,`brightness`,`sepiaEnabled`,`grayscaleEnabled`,`filters`,`shadowEnabled`,`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`,`shadowColor`,`shadowOpacity`],eA=[`id`,`type`,`text`,`opacity`,`rowSpan`,`colSpan`,`mergedInto`,`name`,`custom`,`borders`],tA=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(`.`)),nA={opacity:1,rowSpan:1,colSpan:1,name:``},rA=[],iA=q.model(`TableCell`,{id:q.identifier,type:q.optional(q.literal(`tablecell`),`tablecell`),text:``,_fontSize:q.maybe(q.number),_fontFamily:q.maybe(q.string),_fontWeight:q.maybe(q.string),_fontStyle:q.maybe(q.string),_textDecoration:q.maybe(q.string),_textTransform:q.maybe(q.string),_fill:q.maybe(q.string),_align:q.maybe(q.string),_verticalAlign:q.maybe(q.string),_lineHeight:q.maybe(q.union(q.number,q.string)),_letterSpacing:q.maybe(q.number),_strokeWidth:q.maybe(q.number),_stroke:q.maybe(q.string),_cellBackground:q.maybe(q.string),_cellPadding:q.maybe(q.number),opacity:1,rowSpan:1,colSpan:1,mergedInto:q.maybe(q.string),borders:q.maybe(Xk),name:``,custom:q.frozen()}).volatile(()=>({_editModeEnabled:!1,filters:Xt.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 eA)n in e&&(t[n]=e[n]);for(let n of Zk)e[n]!==void 0&&(t[`_${n}`]=e[n]);return 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 nA&&r===nA[n])continue;t[n]=r}return t}).views(e=>{let t={get row(){if(!Yh(e))return 0;let t=Kk(e),n=Jk(e).indexOf(e);return n===-1?0:Math.floor(n/t.cols)},get col(){if(!Yh(e))return 0;let t=Kk(e),n=Jk(e).indexOf(e);return n===-1?0:n%t.cols},get store(){return Yh(e)?Uh(e):null},get page(){if(!Yh(e))return null;try{return Kk(e).page}catch{return null}},get fontSize(){return qk(e,`fontSize`,30)},get fontFamily(){return qk(e,`fontFamily`,`Roboto`)},get fontWeight(){return qk(e,`fontWeight`,`normal`)},get fontStyle(){return qk(e,`fontStyle`,`normal`)},get textDecoration(){return qk(e,`textDecoration`,``)},get textTransform(){return qk(e,`textTransform`,`none`)},get fill(){return qk(e,`fill`,`black`)},get align(){return qk(e,`align`,`left`)},get verticalAlign(){return qk(e,`verticalAlign`,`top`)},get lineHeight(){return qk(e,`lineHeight`,1.2)},get letterSpacing(){return qk(e,`letterSpacing`,0)},get strokeWidth(){return qk(e,`strokeWidth`,0)},get stroke(){return qk(e,`stroke`,`black`)},get cellBackground(){return qk(e,`cellBackground`,`transparent`)},get cellPadding(){return qk(e,`cellPadding`,4)},get width(){if(!Yh(e))return 100;try{return Kk(e).getCellRect(t.row,t.col,e.rowSpan,e.colSpan).width}catch{return 100}},get height(){if(!Yh(e))return 100;try{return Kk(e).getCellRect(t.row,t.col,e.rowSpan,e.colSpan).height}catch{return 100}},get borderInsets(){if(!Yh(e))return{top:0,right:0,bottom:0,left:0};let n=Kk(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(!Yh(e))return{x:0,y:0,width:100,height:100,rotation:0,opacity:1,fontSize:16};let n=Kk(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=Yh(e)?Kk(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 rA}};return t}).actions(e=>({toJSON:()=>Object.assign({},zh(e)),set(t){t.fontSize!=null&&t.fontSize<1&&(t=Object.assign(Object.assign({},t),{fontSize:1}));let n={};for(let[e,r]of Object.entries(t))Qk.has(e)?n[`_${e}`]=r:e===`borders`?n.borders=r&&JSON.parse(JSON.stringify(r)):tA.has(e)||(n[e]=r);Object.assign(e,n)},setBorder(t,n){let r=e.borders?Object.assign({},zh(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=Xh(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 aA(e,t){let n=[];for(let r of e){let e={id:yy(10),text:``};if(!r){n.push(e);continue}for(let t of Zk){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]=zh(t))}Object.keys(n).length>0&&(e.borders=n)}n.push(e)}return n}function oA(e){return Array.from({length:e},()=>1/e)}function sA(e){let t=e.reduce((e,t)=>e+t,0);return t===0?oA(e.length):e.map(e=>e/t)}var cA=Fk.named(`Table`).props({type:`table`,width:300,height:200,rows:3,cols:3,colWidths:q.array(q.number),rowHeights:q.array(q.number),cells:q.array(iA),borderColor:`#000000`,borderWidth:1,borderStyle:q.optional(q.enumeration([`solid`,`dashed`,`dotted`,`none`]),`solid`),fontSize:30,fontFamily:`Roboto`,fontWeight:`normal`,fontStyle:`normal`,textDecoration:``,textTransform:`none`,fill:`black`,align:`center`,verticalAlign:`middle`,lineHeight:q.optional(q.union(q.number,q.string),1.2),letterSpacing:0,strokeWidth:0,stroke:`black`,cellBackground:`transparent`,cellPadding:4}).postProcessSnapshot(e=>{e.cells&&((e=Object.assign({},e)).cells=e.cells.map(t=>{let n={};for(let[r,i]of Object.entries(t))Qk.has(r)&&i===e[r]||(n[r]=i);return n}));for(let t of $k)delete e[t];return e}).volatile(()=>({_focusedCellIds:[],_editingCellId:void 0,_anchorCellId:void 0,_cellContentHeights:Xt.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:yy(10),text:``});return n}(e.rows,e.cols));else if(e.cells.length<t)for(;e.cells.length<t;)e.cells.push(Xh({id:yy(10),text:``}));else e.cells.length>t&&e.cells.splice(t);e.colWidths.length===0&&e.colWidths.replace(oA(e.cols)),e.rowHeights.length===0&&e.rowHeights.replace(oA(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={setCellContentHeight(t,n){e._cellContentHeights.set(t,n)},_applyFitRowsToContent(){if(!Yh(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){t.selectRowRange(e,e)},selectColumn(e){t.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(Yh(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(n){t._resetBaseRowHeights();let r=n>0?n-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(n,0,i/a);let s=n>0?n-1:0,c=[];for(let t=0;t<e.cols;t++)c.push(e.cells[s*e.cols+t]);let l=n*e.cols,u=aA(c,!0);e.cells.splice(l,0,...u),e.rows+=1,e.height=a,e.rowHeights.replace(sA(o))},removeRow(n){if(e.rows<=1)return;t._resetBaseRowHeights();let r=n*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(n,1),--e.rows,e.rowHeights.replace(sA(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=aA(c,!1);for(let n=e.rows-1;n>=0;n--)e.cells.splice(n*o+t,0,Xh(l[n]));e.cols+=1,e.width=i,e.colWidths.replace(sA(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(sA(i))},removeRowRange(n,r){for(let i=r;i>=n&&!(e.rows<=1);i--)t.removeRow(i)},removeColumnRange(n,r){for(let i=r;i>=n&&!(e.cols<=1);i--)t.removeColumn(i)},distributeRowsEvenly(){let n=e.rows,r=20;for(let t=0;t<n;t++)r=Math.max(r,e.getRowContentOuterHeight(t));t._resetBaseRowHeights(),e.height=Math.max(e.height,r*n),e.rowHeights.replace(oA(n))},distributeColumnsEvenly(){e.colWidths.replace(oA(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<Wk?(r[t]=Wk,r[t+1]=i-Wk):o<Wk?(r[t+1]=Wk,r[t]=i-Wk):(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(Wk,o),l=Math.max(Wk,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(n,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}(n,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:n}of i)t.setCellBorders(e,n,r)}};return t}).actions(e=>({clone(t={},{skipSelect:n=!1}={}){let r=JSON.parse(JSON.stringify(e.toJSON()));if(t.id=t.id||yy(10),r.cells){let e=new Map;r.cells.forEach(t=>{let n=t.id,r=yy(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})}})),lA=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},uA=(e,t)=>{if(e.children)for(let n of e.children){if(!0===t(n))break;uA(n,t)}};function dA(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];qh(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&&(qh(r),e.children.remove(r),e.children.splice(n,0,r))}}}var fA=[...Array(20)].map((e,t)=>q.late(()=>bA[t])),pA=q.union({dispatcher:e=>{let t=xA[e.type];if(!t){let t=`Unknown element type: "${e.type}"`;throw o(`DESIGN_INVALID`,t,{errors:[{path:`type`,message:t}],knownTypes:Object.keys(xA)})}return t}},Vk,Lk,Rk,Bk,zk,Hk,Uk,cA,q.late(()=>yA),...fA),mA=Object.freeze({x:0,y:0,offsetX:0,offsetY:0,scaleX:1,scaleY:1,rotation:0,opacity:1});function hA(e){return e===1?mA:Object.assign(Object.assign({},mA),{opacity:e})}var gA={x:0,y:0,width:0,height:0,rotation:0,opacity:1,fontSize:0,cropX:0,cropY:0,cropWidth:1,cropHeight:1},_A=(e,t)=>typeof e==`number`&&isFinite(e)?e:t;function vA(e,t,n,r){gA.x=e.x,gA.y=e.y,gA.width=e.width,gA.height=e.height,gA.opacity=r;let i=Ak({element:gA,animation:t,dTime:n})||{},a=_A(i.width,e.width),o=_A(i.height,e.height);return{x:_A(i.x,e.x),y:_A(i.y,e.y),width:a>0?a:e.width,height:o>0?o:e.height,rotation:_A(i.rotation,0),opacity:_A(i.opacity,r)}}var yA=_k.named(`Group`).props({type:`group`,children:q.array(pA),animations:q.array(jk)}).views(e=>({get draggable(){let t=!0;return uA(e,e=>{e.draggable||(t=!1)}),t},get resizable(){let t=!0;return uA(e,e=>{e.resizable||(t=!1)}),t},get contentEditable(){let t=!0;return uA(e,e=>{e.contentEditable||(t=!1)}),t},get styleEditable(){let t=!0;return uA(e,e=>{e.styleEditable||(t=!1)}),t},get locked(){let t=!0;return uA(e,e=>{e.locked||(t=!1)}),t},get _restingBbox(){let t=[];if(uA(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=Ck(t);return n.width<=0||n.height<=0?null:{x:n.x,y:n.y,width:n.width,height:n.height}},get a(){if(!Yh(e))return mA;let t=r(e);if(t===null||e.store.isEditingPaused&&this.isSelectedDirectly)return hA(e.opacity);let n=e.page,i=e.store.animatedElementsIds;if(i.length&&!i.includes(e.id))return hA(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 hA(e.opacity);let f=this._restingBbox;if(!f)return hA(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=vA(f,a,t-a.delay,e.opacity)),u&&(p=vA(f,o,t-(n.duration-o.duration-o.delay),e.opacity)),d&&(p.opacity=0),s&&(p=vA(p,s,t,p.opacity));let m=wk(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!!Yh(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=lA(t,[`draggable`,`contentEditable`,`styleEditable`,`resizable`]);n!==void 0&&uA(e,e=>{e.set({draggable:n})}),r!==void 0&&uA(e,e=>{e.set({contentEditable:r})}),i!==void 0&&uA(e,e=>{e.set({styleEditable:i})}),a!==void 0&&uA(e,e=>{e.set({resizable:a})}),Object.assign(e,o)},addElement(t,{skipSelect:n=!1}={}){let r=xA[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||yy(10)});let i=r.create(Object.assign({id:yy(10)},t));return e.children.push(i),i.selectable&&!n&&e.store.selectElements([i.id]),i}},dA(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))}})),bA=[],xA={svg:Vk,text:Lk,image:Rk,group:yA,line:Bk,video:zk,figure:Hk,gif:Uk,table:cA},SA=q.model(`Page`,{id:q.identifier,children:q.array(q.late(()=>pA)),width:q.optional(q.union(q.number,q.literal(`auto`)),`auto`),height:q.optional(q.union(q.number,q.literal(`auto`)),`auto`),background:`white`,bleed:0,bleedTop:q.maybe(q.number),bleedRight:q.maybe(q.number),bleedBottom:q.maybe(q.number),bleedLeft:q.maybe(q.number),custom:q.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 Hh(e,DA)}})).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(!Yh(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 Qf(e)}})).actions(e=>({toJSON:()=>JSON.parse(JSON.stringify(zh(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=yy(10);r.set(t,n),e.id=n,bb(e,e=>{let t=e.id,n=yy(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:yy(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=xA[t.type];if(!r){console.error(`Can not find model with type `+t.type);return}`children`in t&&Array.isArray(t.children)&&bb(t,e=>{e.id=e.id||yy(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:yy(10),name:`${t.type}-${i+1}`},t));return e.children.push(a),a.selectable&&!n&&e.store.selectElements([a.id]),a}},dA(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;uA(e,e=>{e.type!==`group`&&(i(e)||r.push(e))});let a=r.length?Ck(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*_;uA(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})}})),CA=q.model(`Audio`,{id:q.identifier,name:``,src:``,duration:0,startTime:0,endTime:1,volume:1,delay:0,speed:1,custom:q.frozen()}).views(e=>({get visibleDuration(){return(e.endTime-e.startTime)*e.duration/e.speed}})).actions(e=>({toJSON:()=>Object.assign({},zh(e))})).actions(e=>({set(t){Object.assign(e,t)}})),wA=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};Th(`ignore`);var TA=q.model(`Font`,{fontFamily:q.string,url:q.optional(q.string,``),styles:q.frozen()}).preProcessSnapshot(e=>Object.assign(Object.assign({},e),{fontFamily:e.fontFamily||e.name})),EA={ADMIN:`admin`,VIEWER:`viewer`},DA=q.model(`Store`,{role:``,pages:q.array(SA),fonts:q.array(TA),audios:q.array(CA),width:1080,height:1080,currentTime:0,isPlaying:!1,scale:1,scaleToFit:1,unit:q.optional(q.enumeration(`UnitType`,[`pt`,`mm`,`cm`,`in`,`px`]),`px`),dpi:72,schemaVersion:4,bleedVisible:!1,rulesVisible:!1,distanceGuidesVisible:!1,timingPreview:q.optional(q.enumeration(`TimingPreview`,[`all`,`playhead`]),`all`),openedSidePanel:``,previousOpenedSidePanel:``,custom:q.frozen(),tool:q.optional(q.enumeration(`Tool`,[`selection`,`draw`,`pan`,`text`,`eraser`]),`selection`),toolOptions:q.optional(q.model({brushType:q.optional(q.enumeration(`BrushType`,[`brush`,`highlighter`]),`brush`),strokeWidth:q.optional(q.number,5),stroke:q.optional(q.string,`#000000`),opacity:q.optional(q.number,1)}),{}),selectedElementsIds:q.array(q.string),animatedElementsIds:q.array(q.string),history:q.optional(_y,{targetPath:`../pages`}),_elementsPixelRatio:Math.min(2,typeof window<`u`&&window.devicePixelRatio||1),_activePageId:``,_selectedPagesIds:q.array(q.string),_forceShowCredit:!1,_validated:!1}).views(e=>{let t=tn(()=>{let t={};return bb({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 uA({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 bb({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=Xh(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=Xh([])},stop(){i.pause(),e.currentTime=0,i.checkActivePage()},__(){e._validated||=(Qy(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=SA.create(Object.assign({id:yy(10)},t));return e.pages.push(n),e._activePageId=n.id,e._selectedPagesIds=Xh([]),n},selectPage(t){e._activePageId=t,e._selectedPagesIds.length===1&&(e._selectedPagesIds=Xh([t]))},selectPages(t){e._selectedPagesIds=Xh(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=Xh(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&&(qh(r),e.pages.remove(r),e.pages.splice(n,0,r))},deletePages(t){let n=e.pages.indexOf(e.activePage);t.forEach(t=>{Jh(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=Xh(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=>qh(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:yy(10),name:`group-${a+1}`,children:r,type:`group`},n);return i.children.push(o),e.selectedElementsIds=Xh([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=>{qh(e),t.children.push(e)}),t.children.splice(n,1)}}),e.selectedElementsIds=Xh(r)},deleteElements(t){let n=[];e.find(e=>(t.includes(e.id)&&n.push(e),!1)),n.forEach(e=>{Jh(e)}),e.selectedElementsIds=Xh(e.selectedElementsIds.filter(t=>e.getElementById(t)))},on(t,n){if(t===`change`){let t=i.toJSON();return Ih(e,e=>{let r=i.toJSON();!gy(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 pS(()=>{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:$f,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=wA(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:cS(d,u,f)},async toBlob(e={}){var{mimeType:t,quality:n}=e,r=wA(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=wA(e,[`fileName`]);let r=(n.mimeType||`image/png`).split(`/`)[1];by(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 Sy(),d=e=>lS({px:e,unit:a,dpi:n}),f=t.cropMarkSize||0,p=d(f),m=l[0]||{},h=t.includeBleed&&m.computedBleed||$f,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:$f,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 wy({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=wA(e,[`fileName`]);by(await i.toGIFDataURL(n),t||`polotno.gif`)},async toHTML({elementHook:e}={}){return gk(`store.toHTML`,`store.toHTML()/saveAsHTML() are deprecated: install @polotno/html-export and call jsonToHTML(store.toJSON()) instead`),WO(i.toJSON(),{elementHook:e,textOverflow:Ey.textOverflow,textSplitAllowed:Ey.textSplitAllowed})},async saveAsHTML({fileName:e,elementHook:t}={}){let n=await i.toHTML({elementHook:t});by(`data:text/html;base64,`+window.btoa(unescape(encodeURIComponent(n))),e||`polotno.html`)},async toSVG({elementHook:e,pageId:t,fontEmbedding:n=`inline`}={fontEmbedding:`inline`}){gk(`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 mk(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});by(`data:text/svg;base64,`+window.btoa(unescape(encodeURIComponent(a))),e||`polotno.svg`)},async saveAsPDF(e={}){var{fileName:t}=e,n=wA(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 fb()},toJSON:()=>({width:e.width,height:e.height,fonts:zh(e.fonts),pages:zh(e.pages),audios:zh(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=Gf(t,{modernTextRenderer:Ey.htmlRenderEnabled||Ey.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({},zh(e));Object.assign(c,o),c.history=i?zh(e.history):{history:[],undoIdx:-1,targetPath:``},Rh(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=>Jh(e))},addAudio(t){let n=CA.create(Object.assign({id:yy(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)||Nx.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`}))),tS(a)):Qx(t),n&&r&&!o.some(e=>e.fontStyle===n&&e.fontWeight===r)&&o.push({fontStyle:n,fontWeight:r}),Promise.all(o.map(e=>Wx(t,e.fontStyle,e.fontWeight,i)))},validate:e=>DA.validate(e,[{path:``,type:DA}]).map(e=>({path:`store`+e.context.map(e=>e.path).join(`.`),message:e.message}))};return i});function OA({key:e,showCredit:t}={key:``,showCredit:!1}){return Gy(e),DA.create({_forceShowCredit:t})}var kA=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},AA=e=>{let t=window.getComputedStyle(e).position;return t!==`absolute`&&t!==`relative`};function jA(e=()=>{}){let t=k.useRef(e);return t.current=e,k.useCallback((...e)=>t.current.apply(null,e),[])}var MA=({children:e,groupProps:t,divProps:n,transform:r,transformFunc:i,parentNodeFunc:a})=>{let o=Mm(),s=k.useRef(null),[c]=k.useState(()=>document.createElement(`div`)),l=k.useMemo(()=>A.createRoot(c),[c]),u=r??!0,d=jA(()=>{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=kA(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&&AA(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,pa.flushSync)(()=>{l.render(k.createElement(o,null,e))})})}),k.useLayoutEffect(()=>()=>{setTimeout(()=>{l.unmount()})},[]),k.createElement(Lm,Object.assign({ref:s},t))},NA=({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(Lm,{name:`_outer_portal`,ref:r},k.createElement(Lm,{name:`_inner_portal`,ref:i},n))};function PA(e,t,n){return hr(()=>{Yh(e)&&t()},n)}function FA(e,t,n,r){return vr(()=>Yh(e)?t():void 0,(t,r)=>{Yh(e)&&n(t,r)},r)}var IA=(e,t,n)=>(t===void 0&&(t=e.fill??``),n===void 0&&(n=`fill`),k.useMemo(()=>{if(!aC(t))return{[n]:t};let{stops:r,rotation:i}=cC(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])),LA=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)}}},RA=new LA(500);function zA(e){if(!e||!e.includes(`<`))return!1;let t=RA.get(e);if(t===void 0){t=!1;let n=Ob(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}}RA.set(e,t)}return t}function BA(e,t){return Rb(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 VA(e){if(!e||!e.includes(`<p`))return e;let t=Ob(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 HA(e,t){let n=wb(t.fontFamily)||t.fontFamily,r=String(Eb(t.fontWeight)),i=t.fontStyle===`italic`?`italic`:`normal`,a=new Map,o=(e,t,r)=>{let i=wb(e)||e||n,o=`${i}\0${t}\0${r}`;a.has(o)||a.set(o,{family:i,weight:t,style:r})};if(o(n,r,i),e&&e.includes(`<`)){let t=Ob(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=l.style.fontFamily;else{let t=(l.getAttribute(`class`)||``).split(/\s+/).find(e=>e.startsWith(`ql-font-`));t&&(e=xb[t]||Cb(t))}}s||(l.style.fontWeight?s=String(Eb(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 UA(e){return!!e?.style&&(e.style.getPropertyValue(`-webkit-background-clip`)||e.style.getPropertyValue(`background-clip`))===`text`&&e.style.backgroundImage.includes(`gradient`)}var WA=Symbol(`unset`);function GA(e,t){let n=WA;for(let r of e.ops){if(typeof r.insert!=`string`||r.insert===`
|
|
394
|
+
`)continue;let e=r.attributes?.[t];if(n===WA)n=e;else if(e!==n)return!0}return!1}var KA=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},qA=e=>e>0?Math.max(1,Math.round(e)):0,JA=e=>(e.getStage()?.findOne(`Transformer`))?.getActiveAnchor()??``,YA=e=>!(e.includes(`middle`)||e.includes(`center`)),XA=(e,t)=>e<t?1:t,ZA=e=>!!e.curveEnabled||(e.letterSpacing??0)>0||zA(e.text),QA=(e,t)=>({cornerRadius:(e.cornerRadius??0)*t,shadowBlur:e.shadowBlur*t,shadowOffsetX:e.shadowOffsetX*t,shadowOffsetY:e.shadowOffsetY*t}),$A=e=>({cornerRadius:qA(e.cornerRadius??0),shadowBlur:Math.round(e.shadowBlur),shadowOffsetX:Math.round(e.shadowOffsetX),shadowOffsetY:Math.round(e.shadowOffsetY)}),ej=(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}},tj=(e,t)=>{let n=ej(e,t);return{fontSize:Math.round(n.fontSize),strokeWidth:qA(n.strokeWidth),shadowBlur:Math.round(n.shadowBlur),shadowOffsetX:Math.round(n.shadowOffsetX),shadowOffsetY:Math.round(n.shadowOffsetY)}},nj=e=>{let t=tj(e,e.fontSize),{fontSize:n}=t;return KA(t,[`fontSize`])},rj=e=>Math.min(Math.max(e,0),255),ij={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]=rj(n[t]+15*e),n[t+2]=rj(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]=rj(i*(n[e]-128)+128),n[e+1]=rj(i*(n[e+1]-128)+128),n[e+2]=rj(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]=rj(n[t]*i),n[t+1]=rj(n[t+1]*i),n[t+2]=rj(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]=rj(n[t]*i),n[t+1]=rj(n[t+1]*i),n[t+2]=rj(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]=rj(n[t]*i),n[t+1]=rj(n[t+1]*i),n[t+2]=rj(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]=rj(r-(o-r)*l),n[t+1]=rj(i-(o-i)*l),n[t+2]=rj(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]=rj(o+(r-o)*(1+e)),n[t+1]=rj(o+(i-o)*(1+e)),n[t+2]=rj(o+(a-o)*(1+e))}return t}};ij.highlights=ij.white;var aj=ij;function oj(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=aj[n];r&&t.filters.push(r(e.intensity))}),t}function sj(e){if(e.brightnessEnabled||e.blurEnabled||e.sepiaEnabled||e.grayscaleEnabled)return!0;for(let t of e.filters.keys())if(aj[t])return!0;return!1}function cj(e,t){if(!Yh(t))return;let n=oj(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:()=>qD(n.blurRadius??0,e.width,e.height)};n.filters.forEach(e=>{typeof e==`function`&&e.call(a,i)}),r.putImageData(i,0,0)}function lj(e){if(!Yh(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 uj(e,t){var n;if(!e||!Yh(t))return;let r=oj(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 dj=()=>`ontouchstart`in window||navigator.maxTouchPoints>0;function fj({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 pj(e){try{let{stops:t}=cC(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 mj(e){if(aC(e))return pj(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 hj(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=mj(e.fill),i=mj(n);return Math.abs(r-i)>=50?n:e.fill}function gj(e){return/<\/[a-z][a-z0-9]*>/i.test(e)&&!Yb(e).trim()?``:e}var _j;function vj(){return _j||(_j=document.getElementById(`polotno-text-style`),_j||(_j=document.createElement(`style`),_j.id=`polotno-text-style`,document.head.appendChild(_j)),_j)}s._fixTextRendering=!0;var yj={border:`none`,padding:`0px`,overflow:`hidden`,background:`none`,outline:`none`,resize:`none`,overflowWrap:`break-word`,whiteSpace:`pre-wrap`,userSelect:`text`,wordBreak:`normal`,textTransform:`none`},bj=V(({textNodeRef:e,element:t,onBlur:n,selectAll:r,cursorPosition:i})=>{let[a,o]=k.useState(yj),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=hj(t);let n=`\n .polotno-input::placeholder {\n color: ${a.color};\n opacity: 0.6;\n }\n `,r=vj();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=Jb(t.a,u);t.verticalAlign===`middle`&&(l=(d-u)/2),t.verticalAlign===`bottom`&&(l=d-u);let f=Yb(t.text);return(0,j.jsx)(`textarea`,{className:`polotno-input`,ref:c,dir:sD(f),style:Object.assign(Object.assign(Object.assign({},yj),a),{paddingTop:l+`px`}),value:f,onChange:e=>{let n=fj({oldText:t.text,newText:e.target.value,element:t});t.set(Object.assign({text:e.target.value},ej(t,n)))},placeholder:gj(t.placeholder),onBlur:n})}),xj=e=>(0,j.jsx)(MA,{children:(0,j.jsx)(bj,Object.assign({},e))}),Sj=(e,t,n,r,i)=>{let[a,o]=k.useReducer(e=>e+1,0),s=k.useRef(Ux(t,n,r)),c=k.useRef(null);return k.useLayoutEffect(()=>{if(s.current=Ux(t,n,r),s.current)return;let a=!0;return(async()=>{s.current=!1,o();let l=ub(`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]},Cj=(e,t,n,r,i)=>{let[a,o]=k.useReducer(e=>e+1,0),s=t.join(`\0`),c=k.useRef(t.every(e=>Ux(e,n,r))),l=k.useRef(null);return k.useLayoutEffect(()=>{if(c.current=t.every(e=>Ux(e,n,r)),c.current)return;let a=!0;return(async()=>{c.current=!1,o();let u=ub(`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]},wj=({fontLoaded:e,fontFamily:t,fontSize:n,lineHeight:r})=>k.useMemo(()=>OD({fontFamily:t,fontSize:n,lineHeight:r}),[e,t,n,r]);function Tj(e){let t=k.useRef(e),n=k.useRef(e);return k.useMemo(()=>{n.current=t.current,t.current=e},[e]),n.current}function Ej(e,t,n=!1){let r=e.fontSize(),i=e.height(),a=Yb(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=Wb(t.a)&&e.height()>t.a.height,i=a.split(`
|
|
395
|
+
`).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-=.5,e.fontSize(o)}return e.fontSize(r),e.height(i),o}var Dj=V(({element:e,store:t})=>{let{textOverflowIndicatorStyle:n}=_h(),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=Tj(y),{textVerticalResizeEnabled:x}=Ey,S=Ey.autoDeleteEmptyText,C=Tj(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&&!gj(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&&uj(n,e)}else{let t=r.current;t&&uj(t,e)}};k.useLayoutEffect(()=>{if(!p)return PA(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=Yb(e.text);e.textTransform===`uppercase`&&(D=D.toUpperCase());let[O]=Sj(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}=Ey;if(n===`resize`){let t=ee(),n=Yh(e)?Bh(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=Ej(n,e,Ey.textSplitAllowed);r!==e.fontSize&&t.history.ignore(()=>{e.set({fontSize:r})})}}return}let{textOverflow:n,textSplitAllowed:i}=Ey,a=(n,r,i,a)=>{let l=ub(`text ${e.id}`),u=()=>{t.history.ignore(n,r,i).then(()=>{s.current?(o.current.push(l),c()):l()})};a?queueMicrotask(u):u()};if(!Wb(e)){let t=ee();a(()=>{Wb(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;Yh(e)&&e.set({height:t}),(n=r.current)==null||n.height(t)},!1,!0),x||e.height===t||d||a(()=>{var n;Yh(e)&&e.set({height:t}),(n=r.current)==null||n.height(t)},!1,!0)}}else{let t=r.current,n=e.curveEnabled?e.fontSize:Ej(t,e,i);if(n!==e.fontSize){a(()=>{e.set(ej(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=gj(e.placeholder),F=!D&&P?.6:e.a.opacity;nb(r,F);let ne=wj({fontLoaded:O,fontFamily:e.fontFamily,fontSize:e.a.fontSize,lineHeight:e.lineHeight}),re=e.selectable||t.role===EA.ADMIN,I=IA(e),L=IA(e,e.stroke,`stroke`),R=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 hO(mO(`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 vO({rects:yO({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]),ie=dj(),ae=0;if(!e.curveEnabled){let t=w.length*ne*e.a.fontSize,n=Jb(e.a,t);e.verticalAlign===`middle`?ae=(n-t)/2:e.verticalAlign===`bottom`&&(ae=n-t)}let oe=e.curveEnabled?uD(e.a.width,e.a.height,e.curvePower,e.a.fontSize):``,se=O?`"`+e.fontFamily+`"`:C===e.fontFamily?`Arial`:`"`+C+`"`,z=sD(D);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Gm,{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:R,fill:e.backgroundColor,offsetY:-ae}),(0,j.jsx)(Gm,{data:oe,stroke:n.stroke,strokeWidth:1,x:e.a.x,y:e.a.y,rotation:e.a.rotation,visible:!1}),(0,j.jsx)(Wm,Object.assign({ref:i,visible:e.curveEnabled,data:oe,text:D||P,listening:!1,align:`center`,textBaseline:`middle`,direction:z},I,L,{strokeWidth:e.strokeWidth,lineJoin:lD(e.strokeLineJoin),fillAfterStrokeEnabled:!0,fontSize:e.a.fontSize,fontFamily:`"${e.fontFamily}", "${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)(Um,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:Wb(e.a)?e.a.height:void 0,text:D||P,direction:z},I,L,{lineJoin:lD(e.strokeLineJoin),strokeWidth:e.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:e.a.fontSize,fontFamily:se,fontStyle:e.fontStyle+` `+e.fontWeight,textDecoration:e.textDecoration,align:e.align,verticalAlign:e.verticalAlign,draggable:ie?e.draggable&&y:e.draggable,preventDefault:!ie||y,opacity:e.curveEnabled?0:F,visible:!e._editModeEnabled,ellipsis:Ey.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=JA(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=XA(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(Ey.textOverflow===`ellipsis`)o=h.current;else{let t=Math.max(o,h.current);i.height(t),e.set({height:i.height()})}let s=Ey.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=Ey.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({},tj(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)(xj,{textNodeRef:r,element:e,selectAll:u,cursorPosition:te.current,onBlur:()=>{e.set(nj(e)),e.toggleEditMode(!1)}})})]})}),Oj=(e,t)=>{let n=lj(e),r=Yh(e)&&sj(e),i=n=>{if(!t||!Yh(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),cj(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)}]},kj=(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 Aj(){return document.createElement(`canvas`)}var jj=e=>e.indexOf(`data:image/svg+xml`)>=0||e.indexOf(`.svg`)>=0,Mj=e=>{let[t,n]=k.useState(e);return k.useEffect(()=>{(async()=>{let r=await async function(e){return jj(e)?LC(BC(await FC(e))):e}(e);r!==t&&n(r)})()},[e]),t};function Nj(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Pj=(e,t)=>t.width<5||t.height<5?e:t,Fj={keepRatio:!1,rotateEnabled:!1,boundBoxFunc:Pj},Ij={enabledAnchors:[`top-left`,`top-right`,`bottom-left`,`bottom-right`],rotateEnabled:!1,borderEnabled:!1,boundBoxFunc:Pj};function Lj(e,t){let n=YC({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 Rj=(e,t,n)=>Math.max(t,Math.min(n,e)),zj=(e,t,n,r,i=0,a=!1,o=!0)=>{let c=Math.floor(Rj(e.a.width*r,1,1e4)),u=Math.floor(Rj(e.a.height*r,1,1e4)),d=Math.min(i*r,c/2,u/2),f=Math.max(e.a.width/n.width,e.a.height/n.height)*r,p=e.page?._exportingOrRendering&&Ey.imageDownScalingEnabled&&f<1&&!a,m=n.x===0&&n.y===0&&n.width===t?.width&&n.height===t?.height,h=k.useMemo(()=>{if(t&&t.width&&t.height)return m&&d===0&&!p?void 0:Aj()},[t,d,p,m]);return k.useLayoutEffect(()=>{if(!h||!t)return;l(h,c,u);let e=h.getContext(`2d`);if(!e)return;d&&(e.beginPath(),e.moveTo(d,0),e.lineTo(c-d,0),e.arc(c-d,d,d,3*Math.PI/2,0,!1),e.lineTo(c,u-d),e.arc(c-d,u-d,d,0,Math.PI/2,!1),e.lineTo(d,u),e.arc(d,u-d,d,Math.PI/2,Math.PI,!1),e.lineTo(0,d),e.arc(d,d,d,Math.PI,3*Math.PI/2,!1),e.clip());let r=p?function(e,t){var n,r;let i=Aj();i.width=e.width,i.height=e.height;let a=Math.max(1,Math.floor(i.width*t)),o=Math.max(1,Math.floor(i.height*t));(n=i.getContext(`2d`))==null||n.drawImage(e,0,0,i.width,i.height);let s=function(e,t,n,r,i,a,o){for(var s=new ImageData(t,n),c=new Int32Array(e.data.buffer),l=e.width,u=new Int32Array(s.data.buffer),d=s.width,f=t/a,p=n/o,m=Math.round(1/f),h=Math.round(1/p),g=m*h,_=0;_<s.height;_++)for(var v=0;v<d;v++){for(var y=0+Math.round(v/f)+(0+Math.round(_/p))*l,b=0,x=0,S=0,C=0,w=0;w<h;w++)for(var T=0;T<m;T++){var E=c[y+T+w*l];b+=E<<24>>>24,x+=E<<16>>>24,S+=E<<8>>>24,C+=E>>>24}b=Math.round(b/g),x=Math.round(x/g),S=Math.round(S/g),C=Math.round(C/g),u[v+_*d]=C<<24|S<<16|x<<8|b}return s}(i.getContext(`2d`).getImageData(0,0,i.width,i.height),a,o,0,0,i.width,i.height);return i.width=a,i.height=o,(r=i.getContext(`2d`))==null||r.putImageData(s,0,0),i}(t,f):t,i=p?{x:Math.floor(n.x*f),y:Math.floor(n.y*f),width:Math.floor(n.width*f),height:Math.floor(n.height*f)}:n;e.drawImage(r,i.x,i.y,i.width,i.height,0,0,h.width,h.height)},[h,e.a.width,e.a.height,n.x,n.y,n.width,n.height,i,r,a,e.page?._exportingOrRendering,p]),k.useEffect(()=>()=>{h&&h.nodeName===`CANVAS`&&s.Util.releaseCanvas(h)},[h]),h||t},Bj=Aj(),Vj=V(({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}=_h();return(0,j.jsxs)(Lm,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,j.jsx)(zm,{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})]})}),Hj=V(({element:e})=>{let{mediaErrorStyle:t}=_h(),n=Math.max(10,Math.min(30,e.a.width/25));return(0,j.jsxs)(Lm,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,j.jsx)(zm,{width:e.a.width,height:e.a.height,fill:t.fill}),(0,j.jsx)(Um,{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})]})}),Uj=Xm.default,Wj=(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=ub(s)),e!==`loading`&&i(),e===`failed`&&hb(o(`IMAGE_FAILED`,s,{src:a,elementId:n,reason:`load`}))},[e])},Gj=V(({element:e,store:t})=>{let n=_h(),[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(()=>jj(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=BC(await FC(e.src)),o;o=e.colorsReplace?WC(a,e.colorsReplace||new Map):LC(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]=Uj(u,`anonymous`);Wj(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}),[_=Bj]=Oj(e,((e,t)=>{let n=Mj(e.maskSrc||``),[r,i]=Uj(n,`anonymous`);return Wj(n?i:`loaded`,n||``,e.id),k.useMemo(()=>{if(!r||!t||!t.width||!t.height)return t;let{width:n,height:i}=Lj(t,{width:e.a.width,height:e.a.height,stretchEnabled:e.stretchEnabled}),a=Aj();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`||e.src.indexOf(`data:image/svg+xml`)>=0||e.src.indexOf(`.svg`)>=0,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=Aj(),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))||Bj),{cropX:v,cropY:y,cropWidth:b,cropHeight:x}=e.a;p!==`loaded`&&(v=y=0,b=x=1);let S=YC({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]=Uj(Mj(e.clipSrc||``),`anonymous`);Wj(e.clipSrc?a:`loaded`,e.clipSrc,e.id);let o=k.useMemo(()=>{if(t&&i)return Aj()},[t,i]);return k.useLayoutEffect(()=>{var r;if(!i||!t||!t.width||!t.height||!i||!i.width||!i.height||!o)return;let a=Aj(),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,zj(e,_,S,O,E,r||e._cropModeEnabled||e.type===`svg`,!0),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})},I=()=>{e.type!==`svg`&&e.contentEditable&&(e.stretchEnabled||setTimeout(()=>{Yh(e)&&e.toggleCropMode(!0)}))},L=e.type===`svg`&&g,[R]=kj(p===`loading`&&!L,100,!1,!1),ie=p===`failed`,ae=!R&&!ie,oe=k.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),se=k.useRef(!1),z=ae?e.a.opacity:0;nb(a,z);let ce=e.selectable||t.role===EA.ADMIN,le=dj(),ue=IA(e,e.borderColor,`stroke`);return(0,j.jsxs)(j.Fragment,{children:[R&&(0,j.jsx)(Vj,{element:e}),ie&&(0,j.jsx)(Hj,{element:e}),(0,j.jsx)(Hm,{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:z,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:S,listening:ce,draggable:le?e.draggable&&c:e.draggable,preventDefault:!le||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:I,onDblTap:I,onTransformStart:t=>{i(!0),se.current=YA(JA(t.target)),oe.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=se.current,u=!l&&r<1&&oe.current.cropHeight>w/_.height,d=l?e.cropWidth:e.cropWidth*r;u&&(d=e.cropWidth);let f=!l&&i<1&&oe.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({},QA(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},$A(e)),{borderSize:qA(e.borderSize)})),i(!1)}}),(0,j.jsx)(zm,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:z,offsetX:-e.borderSize/2,offsetY:-e.borderSize/2},ue,{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)(NA,{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=Nj(a,o);return}var c=Nj(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},Ij,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},Fj,n.innerImageCropTransformerStyle,{visible:e.resizable}))]})]})]})});function Kj(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=Yb(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(`
|
|
396
|
+
`);return c?`<style>${c}</style>`:``}var qj=new Map,Jj=new Map,Yj=/@font-face\s*\{[^}]*\}/g,Xj=/url\(\s*(['"]?)(.*?)\1\s*\)/g,Zj=/unicode-range:\s*([^;}]+)/i;function Qj(e,t){if(!t)return!0;let n=e.match(Zj);if(!n)return!0;let r=function(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}(n[1]);return r.length===0||function(e,t){for(let n of t)for(let[t,r]of e)if(n>=t&&n<=r)return!0;return!1}(r,t)}function $j(e,t){let n=new Set;for(let r of e.matchAll(Yj))if(Qj(r[0],t))for(let e of r[0].matchAll(Xj)){let t=e[2];t&&!t.startsWith(`data:`)&&n.add(t)}return Array.from(n)}function eM(e){let t=qj.get(e);return t||(t=async function(e){try{let t=await bx(e,{validate:hx});return`data:${mx(t)};base64,${mS(t)}`}catch{return e}}(e),qj.set(e,t)),t}function tM(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=Jj.get(n);if(r)return r;let i=async function(e,t){let n=$j(e,t);if(n.length===0&&!t)return e;let r=await Promise.all(n.map(async e=>[e,await eM(e)])),i=new Map(r);return e.replace(Yj,e=>Qj(e,t)?e.replace(Xj,(e,t,n)=>{if(!n||n.startsWith(`data:`))return e;let r=i.get(n);return r?`url("${r}")`:e}):``)}(e,t);return Jj.set(n,i),i}var nM=/<style[^>]*>([\s\S]*?)<\/style>/gi;function rM(e){let t=[],n=e.replace(nM,(e,n)=>(t.push(n),``));return{css:t.join(`
|
|
397
|
+
`),html:n}}var iM;function aM(e,t){`close`in t.image&&typeof t.image.close==`function`&&t.image.close()}async function oM(e){let t=`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(e),n=vb.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 sM(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 iM?iM.maxEntries!==e&&iM.resize(e):iM=new LA(e),iM}(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 oM(await pM(e));return t.setWithEviction(n,a,aM),a.image}return(await oM(await pM(e))).image}var cM=RegExp(`[\0-\b\v\f-]`,`g`);function lM(e){let t=yb(e),n=vb.createXMLSerializer(),r=``;for(let e of Array.from(t.body.childNodes))r+=n.serializeToString(e);return r.replace(cM,``)}function uM({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 dM;async function fM({html:e,css:t=``,width:n,height:r,pixelRatio:i=1}){let a=rM(e),o=await tM([t,a.css].filter(Boolean).join(`
|
|
398
|
+
`),function(e){let t=yb(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 uM({xhtml:lM(a.html),css:o,width:n,height:r,pixelRatio:i})}async function pM(e){var t,n;if(e.cache){let r=(n=typeof e.cache==`object`&&(t=e.cache.maxEntries)!=null?t:50,dM?dM.maxEntries!==n&&dM.resize(n):dM=new LA(n),dM),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 fM(e);return r.set(i,o),o}return fM(e)}var mM={},hM=e=>{if(mM[e])return mM[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&&i.style.fontFamily.replace(/['"]/g,``)===e&&t.push(i)}}catch(e){console.warn(`Could not access stylesheet: ${r.href}`,e)}}return t}(e).filter(t=>t.style.fontFamily.replace(/['"]/g,``)===e).map(e=>({src:e.style.getPropertyValue(`src`),fontStyle:e.style.getPropertyValue(`font-style`)||`normal`,fontWeight:e.style.getPropertyValue(`font-weight`)||`normal`}));return mM[e]=t,t},gM=new Map;async function _M(e,t){let n=`${e}|${t}`;if(gM.has(n))return gM.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 gM.set(n,``),``;let t=await e.text();return gM.set(n,t),t}catch{return gM.set(n,``),``}}async function vM({html:e,width:t,height:n,fontFamily:r,fontFamilies:i,padding:a,font:o,resolveFont:s,pixelRatio:c}){e=VA(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?Mx(i):hM(e)).forEach(t=>{a+=`\n @font-face {\n font-family: '${e.replace(/'/g,`\\'`)}';\n src: ${t.src};\n font-style: ${t.fontStyle||`normal`};\n font-weight: ${t.fontWeight||`normal`};\n }\n `});else{let t=cx();a+=await _M(e,t)}}return a}(i?.length?[...new Set([r,...i])]:[r],r,o,s),u=``;return l&&(u=Kj(l,e)),sM({html:`<div style="padding: ${a}px;" dir="auto">${e+=u+eD}</div>`,width:t+2*a,height:n+2*a,cache:{maxEntries:100},pixelRatio:c})}function yM(e,t,n){return jO(e.toJSON(),{getHtmlOptions:Object.assign({textOverflow:Ey.textOverflow},t),measureHeight:n,textSplitAllowed:Ey.textSplitAllowed})}var bM=typeof global==`object`&&global&&global.Object===Object&&global,xM=typeof self==`object`&&self&&self.Object===Object&&self,SM=bM||xM||Function(`return this`)(),CM=SM.Symbol,wM=Object.prototype,TM=wM.hasOwnProperty,EM=wM.toString,DM=CM?CM.toStringTag:void 0;function OM(e){var t=TM.call(e,DM),n=e[DM];try{e[DM]=void 0;var r=!0}catch{}var i=EM.call(e);return r&&(t?e[DM]=n:delete e[DM]),i}var kM=Object.prototype.toString;function AM(e){return kM.call(e)}var jM=`[object Null]`,MM=`[object Undefined]`,NM=CM?CM.toStringTag:void 0;function PM(e){return e==null?e===void 0?MM:jM:NM&&NM in Object(e)?OM(e):AM(e)}function FM(e){return typeof e==`object`&&!!e}var IM=Array.isArray;function LM(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}function RM(e){return e}var zM=`[object AsyncFunction]`,BM=`[object Function]`,VM=`[object GeneratorFunction]`,HM=`[object Proxy]`;function UM(e){if(!LM(e))return!1;var t=PM(e);return t==BM||t==VM||t==zM||t==HM}var WM=SM[`__core-js_shared__`],GM=function(){var e=/[^.]+$/.exec(WM&&WM.keys&&WM.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function KM(e){return!!GM&&GM in e}var qM=Function.prototype.toString;function JM(e){if(e!=null){try{return qM.call(e)}catch{}try{return e+``}catch{}}return``}var YM=/[\\^$.*+?()[\]{}|]/g,XM=/^\[object .+?Constructor\]$/,ZM=Function.prototype,QM=Object.prototype,$M=ZM.toString,eN=QM.hasOwnProperty,tN=RegExp(`^`+$M.call(eN).replace(YM,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function nN(e){return!LM(e)||KM(e)?!1:(UM(e)?tN:XM).test(JM(e))}function rN(e,t){return e?.[t]}function iN(e,t){var n=rN(e,t);return nN(n)?n:void 0}var aN=iN(SM,`WeakMap`),oN=Object.create,sN=function(){function e(){}return function(t){if(!LM(t))return{};if(oN)return oN(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function cN(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 lN(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}var uN=800,dN=16,fN=Date.now;function pN(e){var t=0,n=0;return function(){var r=fN(),i=dN-(r-n);if(n=r,i>0){if(++t>=uN)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function mN(e){return function(){return e}}var hN=function(){try{var e=iN(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),gN=pN(hN?function(e,t){return hN(e,`toString`,{configurable:!0,enumerable:!1,value:mN(t),writable:!0})}:RM);function _N(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var vN=9007199254740991,yN=/^(?:0|[1-9]\d*)$/;function bN(e,t){var n=typeof e;return t??=vN,!!t&&(n==`number`||n!=`symbol`&&yN.test(e))&&e>-1&&e%1==0&&e<t}function xN(e,t,n){t==`__proto__`&&hN?hN(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function SN(e,t){return e===t||e!==e&&t!==t}var CN=Object.prototype.hasOwnProperty;function wN(e,t,n){var r=e[t];(!(CN.call(e,t)&&SN(r,n))||n===void 0&&!(t in e))&&xN(e,t,n)}function TN(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?xN(n,s,c):wN(n,s,c)}return n}var EN=Math.max;function DN(e,t,n){return t=EN(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=EN(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),cN(e,this,s)}}function ON(e,t){return gN(DN(e,t,RM),e+``)}var kN=9007199254740991;function AN(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=kN}function jN(e){return e!=null&&AN(e.length)&&!UM(e)}function MN(e,t,n){if(!LM(n))return!1;var r=typeof t;return(r==`number`?jN(n)&&bN(t,n.length):r==`string`&&t in n)?SN(n[t],e):!1}function NN(e){return ON(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&&MN(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 PN=Object.prototype;function FN(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||PN)}function IN(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var LN=`[object Arguments]`;function RN(e){return FM(e)&&PM(e)==LN}var zN=Object.prototype,BN=zN.hasOwnProperty,VN=zN.propertyIsEnumerable,HN=RN(function(){return arguments}())?RN:function(e){return FM(e)&&BN.call(e,`callee`)&&!VN.call(e,`callee`)};function UN(){return!1}var WN=typeof exports==`object`&&exports&&!exports.nodeType&&exports,GN=WN&&typeof module==`object`&&module&&!module.nodeType&&module,KN=GN&&GN.exports===WN?SM.Buffer:void 0,qN=(KN?KN.isBuffer:void 0)||UN,JN=`[object Arguments]`,YN=`[object Array]`,XN=`[object Boolean]`,ZN=`[object Date]`,QN=`[object Error]`,$N=`[object Function]`,eP=`[object Map]`,tP=`[object Number]`,nP=`[object Object]`,rP=`[object RegExp]`,iP=`[object Set]`,aP=`[object String]`,oP=`[object WeakMap]`,sP=`[object ArrayBuffer]`,cP=`[object DataView]`,lP=`[object Float32Array]`,uP=`[object Float64Array]`,dP=`[object Int8Array]`,fP=`[object Int16Array]`,pP=`[object Int32Array]`,mP=`[object Uint8Array]`,hP=`[object Uint8ClampedArray]`,gP=`[object Uint16Array]`,_P=`[object Uint32Array]`,vP={};vP[lP]=vP[uP]=vP[dP]=vP[fP]=vP[pP]=vP[mP]=vP[hP]=vP[gP]=vP[_P]=!0,vP[JN]=vP[YN]=vP[sP]=vP[XN]=vP[cP]=vP[ZN]=vP[QN]=vP[$N]=vP[eP]=vP[tP]=vP[nP]=vP[rP]=vP[iP]=vP[aP]=vP[oP]=!1;function yP(e){return FM(e)&&AN(e.length)&&!!vP[PM(e)]}function bP(e){return function(t){return e(t)}}var xP=typeof exports==`object`&&exports&&!exports.nodeType&&exports,SP=xP&&typeof module==`object`&&module&&!module.nodeType&&module,CP=SP&&SP.exports===xP&&bM.process,wP=function(){try{return SP&&SP.require&&SP.require(`util`).types||CP&&CP.binding&&CP.binding(`util`)}catch{}}(),TP=wP&&wP.isTypedArray,EP=TP?bP(TP):yP,DP=Object.prototype.hasOwnProperty;function OP(e,t){var n=IM(e),r=!n&&HN(e),i=!n&&!r&&qN(e),a=!n&&!r&&!i&&EP(e),o=n||r||i||a,s=o?IN(e.length,String):[],c=s.length;for(var l in e)(t||DP.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||bN(l,c)))&&s.push(l);return s}function kP(e,t){return function(n){return e(t(n))}}var AP=kP(Object.keys,Object),jP=Object.prototype.hasOwnProperty;function MP(e){if(!FN(e))return AP(e);var t=[];for(var n in Object(e))jP.call(e,n)&&n!=`constructor`&&t.push(n);return t}function NP(e){return jN(e)?OP(e):MP(e)}function PP(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var FP=Object.prototype.hasOwnProperty;function IP(e){if(!LM(e))return PP(e);var t=FN(e),n=[];for(var r in e)r==`constructor`&&(t||!FP.call(e,r))||n.push(r);return n}function LP(e){return jN(e)?OP(e,!0):IP(e)}var RP=iN(Object,`create`);function zP(){this.__data__=RP?RP(null):{},this.size=0}function BP(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var VP=`__lodash_hash_undefined__`,HP=Object.prototype.hasOwnProperty;function UP(e){var t=this.__data__;if(RP){var n=t[e];return n===VP?void 0:n}return HP.call(t,e)?t[e]:void 0}var WP=Object.prototype.hasOwnProperty;function GP(e){var t=this.__data__;return RP?t[e]!==void 0:WP.call(t,e)}var KP=`__lodash_hash_undefined__`;function qP(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=RP&&t===void 0?KP:t,this}function JP(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])}}JP.prototype.clear=zP,JP.prototype.delete=BP,JP.prototype.get=UP,JP.prototype.has=GP,JP.prototype.set=qP;function YP(){this.__data__=[],this.size=0}function XP(e,t){for(var n=e.length;n--;)if(SN(e[n][0],t))return n;return-1}var ZP=Array.prototype.splice;function QP(e){var t=this.__data__,n=XP(t,e);return n<0?!1:(n==t.length-1?t.pop():ZP.call(t,n,1),--this.size,!0)}function $P(e){var t=this.__data__,n=XP(t,e);return n<0?void 0:t[n][1]}function eF(e){return XP(this.__data__,e)>-1}function tF(e,t){var n=this.__data__,r=XP(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function nF(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])}}nF.prototype.clear=YP,nF.prototype.delete=QP,nF.prototype.get=$P,nF.prototype.has=eF,nF.prototype.set=tF;var rF=iN(SM,`Map`);function iF(){this.size=0,this.__data__={hash:new JP,map:new(rF||nF),string:new JP}}function aF(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function oF(e,t){var n=e.__data__;return aF(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function sF(e){var t=oF(this,e).delete(e);return this.size-=+!!t,t}function cF(e){return oF(this,e).get(e)}function lF(e){return oF(this,e).has(e)}function uF(e,t){var n=oF(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function dF(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])}}dF.prototype.clear=iF,dF.prototype.delete=sF,dF.prototype.get=cF,dF.prototype.has=lF,dF.prototype.set=uF;function fF(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var pF=kP(Object.getPrototypeOf,Object),mF=`[object Object]`,hF=Function.prototype,gF=Object.prototype,_F=hF.toString,vF=gF.hasOwnProperty,yF=_F.call(Object);function bF(e){if(!FM(e)||PM(e)!=mF)return!1;var t=pF(e);if(t===null)return!0;var n=vF.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&_F.call(n)==yF}function xF(){this.__data__=new nF,this.size=0}function SF(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function CF(e){return this.__data__.get(e)}function wF(e){return this.__data__.has(e)}var TF=200;function EF(e,t){var n=this.__data__;if(n instanceof nF){var r=n.__data__;if(!rF||r.length<TF-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new dF(r)}return n.set(e,t),this.size=n.size,this}function DF(e){var t=this.__data__=new nF(e);this.size=t.size}DF.prototype.clear=xF,DF.prototype.delete=SF,DF.prototype.get=CF,DF.prototype.has=wF,DF.prototype.set=EF;function OF(e,t){return e&&TN(t,NP(t),e)}function kF(e,t){return e&&TN(t,LP(t),e)}var AF=typeof exports==`object`&&exports&&!exports.nodeType&&exports,jF=AF&&typeof module==`object`&&module&&!module.nodeType&&module,MF=jF&&jF.exports===AF?SM.Buffer:void 0,NF=MF?MF.allocUnsafe:void 0;function PF(e,t){if(t)return e.slice();var n=e.length,r=NF?NF(n):new e.constructor(n);return e.copy(r),r}function FF(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 IF(){return[]}var LF=Object.prototype.propertyIsEnumerable,RF=Object.getOwnPropertySymbols,zF=RF?function(e){return e==null?[]:(e=Object(e),FF(RF(e),function(t){return LF.call(e,t)}))}:IF;function BF(e,t){return TN(e,zF(e),t)}var VF=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)fF(t,zF(e)),e=pF(e);return t}:IF;function HF(e,t){return TN(e,VF(e),t)}function UF(e,t,n){var r=t(e);return IM(e)?r:fF(r,n(e))}function WF(e){return UF(e,NP,zF)}function GF(e){return UF(e,LP,VF)}var KF=iN(SM,`DataView`),qF=iN(SM,`Promise`),JF=iN(SM,`Set`),YF=`[object Map]`,XF=`[object Object]`,ZF=`[object Promise]`,QF=`[object Set]`,$F=`[object WeakMap]`,eI=`[object DataView]`,tI=JM(KF),nI=JM(rF),rI=JM(qF),iI=JM(JF),aI=JM(aN),oI=PM;(KF&&oI(new KF(new ArrayBuffer(1)))!=eI||rF&&oI(new rF)!=YF||qF&&oI(qF.resolve())!=ZF||JF&&oI(new JF)!=QF||aN&&oI(new aN)!=$F)&&(oI=function(e){var t=PM(e),n=t==XF?e.constructor:void 0,r=n?JM(n):``;if(r)switch(r){case tI:return eI;case nI:return YF;case rI:return ZF;case iI:return QF;case aI:return $F}return t});var sI=oI,cI=Object.prototype.hasOwnProperty;function lI(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&cI.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}var uI=SM.Uint8Array;function dI(e){var t=new e.constructor(e.byteLength);return new uI(t).set(new uI(e)),t}function fI(e,t){var n=t?dI(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var pI=/\w*$/;function mI(e){var t=new e.constructor(e.source,pI.exec(e));return t.lastIndex=e.lastIndex,t}var hI=CM?CM.prototype:void 0,gI=hI?hI.valueOf:void 0;function _I(e){return gI?Object(gI.call(e)):{}}function vI(e,t){var n=t?dI(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var yI=`[object Boolean]`,bI=`[object Date]`,xI=`[object Map]`,SI=`[object Number]`,CI=`[object RegExp]`,wI=`[object Set]`,TI=`[object String]`,EI=`[object Symbol]`,DI=`[object ArrayBuffer]`,OI=`[object DataView]`,kI=`[object Float32Array]`,AI=`[object Float64Array]`,jI=`[object Int8Array]`,MI=`[object Int16Array]`,NI=`[object Int32Array]`,PI=`[object Uint8Array]`,FI=`[object Uint8ClampedArray]`,II=`[object Uint16Array]`,LI=`[object Uint32Array]`;function RI(e,t,n){var r=e.constructor;switch(t){case DI:return dI(e);case yI:case bI:return new r(+e);case OI:return fI(e,n);case kI:case AI:case jI:case MI:case NI:case PI:case FI:case II:case LI:return vI(e,n);case xI:return new r;case SI:case TI:return new r(e);case CI:return mI(e);case wI:return new r;case EI:return _I(e)}}function zI(e){return typeof e.constructor==`function`&&!FN(e)?sN(pF(e)):{}}var BI=`[object Map]`;function VI(e){return FM(e)&&sI(e)==BI}var HI=wP&&wP.isMap,UI=HI?bP(HI):VI,WI=`[object Set]`;function GI(e){return FM(e)&&sI(e)==WI}var KI=wP&&wP.isSet,qI=KI?bP(KI):GI,JI=1,YI=2,XI=4,ZI=`[object Arguments]`,QI=`[object Array]`,$I=`[object Boolean]`,eL=`[object Date]`,tL=`[object Error]`,nL=`[object Function]`,rL=`[object GeneratorFunction]`,iL=`[object Map]`,aL=`[object Number]`,oL=`[object Object]`,sL=`[object RegExp]`,cL=`[object Set]`,lL=`[object String]`,uL=`[object Symbol]`,dL=`[object WeakMap]`,fL=`[object ArrayBuffer]`,pL=`[object DataView]`,mL=`[object Float32Array]`,hL=`[object Float64Array]`,gL=`[object Int8Array]`,_L=`[object Int16Array]`,vL=`[object Int32Array]`,yL=`[object Uint8Array]`,bL=`[object Uint8ClampedArray]`,xL=`[object Uint16Array]`,SL=`[object Uint32Array]`,CL={};CL[ZI]=CL[QI]=CL[fL]=CL[pL]=CL[$I]=CL[eL]=CL[mL]=CL[hL]=CL[gL]=CL[_L]=CL[vL]=CL[iL]=CL[aL]=CL[oL]=CL[sL]=CL[cL]=CL[lL]=CL[uL]=CL[yL]=CL[bL]=CL[xL]=CL[SL]=!0,CL[tL]=CL[nL]=CL[dL]=!1;function wL(e,t,n,r,i,a){var o,s=t&JI,c=t&YI,l=t&XI;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!LM(e))return e;var u=IM(e);if(u){if(o=lI(e),!s)return lN(e,o)}else{var d=sI(e),f=d==nL||d==rL;if(qN(e))return PF(e,s);if(d==oL||d==ZI||f&&!i){if(o=c||f?{}:zI(e),!s)return c?HF(e,kF(o,e)):BF(e,OF(o,e))}else{if(!CL[d])return i?e:{};o=RI(e,d,s)}}a||=new DF;var p=a.get(e);if(p)return p;a.set(e,o),qI(e)?e.forEach(function(r){o.add(wL(r,t,n,r,e,a))}):UI(e)&&e.forEach(function(r,i){o.set(i,wL(r,t,n,i,e,a))});var m=u?void 0:(l?c?GF:WF:c?LP:NP)(e);return _N(m||e,function(r,i){m&&(i=r,r=e[i]),wN(o,i,wL(r,t,n,i,e,a))}),o}var TL=1,EL=4;function DL(e){return wL(e,TL|EL)}var OL=`__lodash_hash_undefined__`;function kL(e){return this.__data__.set(e,OL),this}function AL(e){return this.__data__.has(e)}function jL(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new dF;++t<n;)this.add(e[t])}jL.prototype.add=jL.prototype.push=kL,jL.prototype.has=AL;function ML(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 NL(e,t){return e.has(t)}var PL=1,FL=2;function IL(e,t,n,r,i,a){var o=n&PL,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&FL?new jL: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(!ML(t,function(e,t){if(!NL(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 LL(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function RL(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var zL=1,BL=2,VL=`[object Boolean]`,HL=`[object Date]`,UL=`[object Error]`,WL=`[object Map]`,GL=`[object Number]`,KL=`[object RegExp]`,qL=`[object Set]`,JL=`[object String]`,YL=`[object Symbol]`,XL=`[object ArrayBuffer]`,ZL=`[object DataView]`,QL=CM?CM.prototype:void 0,$L=QL?QL.valueOf:void 0;function eR(e,t,n,r,i,a,o){switch(n){case ZL:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case XL:return!(e.byteLength!=t.byteLength||!a(new uI(e),new uI(t)));case VL:case HL:case GL:return SN(+e,+t);case UL:return e.name==t.name&&e.message==t.message;case KL:case JL:return e==t+``;case WL:var s=LL;case qL:var c=r&zL;if(s||=RL,e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=BL,o.set(e,t);var u=IL(s(e),s(t),r,i,a,o);return o.delete(e),u;case YL:if($L)return $L.call(e)==$L.call(t)}return!1}var tR=1,nR=Object.prototype.hasOwnProperty;function rR(e,t,n,r,i,a){var o=n&tR,s=WF(e),c=s.length;if(c!=WF(t).length&&!o)return!1;for(var l=c;l--;){var u=s[l];if(!(o?u in t:nR.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 iR=1,aR=`[object Arguments]`,oR=`[object Array]`,sR=`[object Object]`,cR=Object.prototype.hasOwnProperty;function lR(e,t,n,r,i,a){var o=IM(e),s=IM(t),c=o?oR:sI(e),l=s?oR:sI(t);c=c==aR?sR:c,l=l==aR?sR:l;var u=c==sR,d=l==sR,f=c==l;if(f&&qN(e)){if(!qN(t))return!1;o=!0,u=!1}if(f&&!u)return a||=new DF,o||EP(e)?IL(e,t,n,r,i,a):eR(e,t,c,n,r,i,a);if(!(n&iR)){var p=u&&cR.call(e,`__wrapped__`),m=d&&cR.call(t,`__wrapped__`);if(p||m){var h=p?e.value():e,g=m?t.value():t;return a||=new DF,i(h,g,n,r,a)}}return f?(a||=new DF,rR(e,t,n,r,i,a)):!1}function uR(e,t,n,r,i){return e===t?!0:e==null||t==null||!FM(e)&&!FM(t)?e!==e&&t!==t:lR(e,t,n,r,uR,i)}function dR(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 fR=dR();function pR(e,t,n){(n!==void 0&&!SN(e[t],n)||n===void 0&&!(t in e))&&xN(e,t,n)}function mR(e){return FM(e)&&jN(e)}function hR(e,t){if((t!==`constructor`||typeof e[t]!=`function`)&&t!=`__proto__`)return e[t]}function gR(e){return TN(e,LP(e))}function _R(e,t,n,r,i,a,o){var s=hR(e,n),c=hR(t,n),l=o.get(c);if(l){pR(e,n,l);return}var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=IM(c),p=!f&&qN(c),m=!f&&!p&&EP(c);u=c,f||p||m?IM(s)?u=s:mR(s)?u=lN(s):p?(d=!1,u=PF(c,!0)):m?(d=!1,u=vI(c,!0)):u=[]:bF(c)||HN(c)?(u=s,HN(s)?u=gR(s):(!LM(s)||UM(s))&&(u=zI(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),pR(e,n,u)}function vR(e,t,n,r,i){e!==t&&fR(t,function(a,o){if(i||=new DF,LM(a))_R(e,t,o,n,vR,r,i);else{var s=r?r(hR(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),pR(e,o,s)}},LP)}function yR(e,t){return uR(e,t)}var bR=NN(function(e,t,n){vR(e,t,n)}),xR=e({Attributor:()=>SR,AttributorStore:()=>AR,BlockBlot:()=>UR,ClassAttributor:()=>DR,ContainerBlot:()=>GR,EmbedBlot:()=>KR,InlineBlot:()=>VR,LeafBlot:()=>PR,ParentBlot:()=>RR,Registry:()=>TR,Scope:()=>X,ScrollBlot:()=>XR,StyleAttributor:()=>kR,TextBlot:()=>QR}),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||{}),SR=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:``}},CR=class extends Error{constructor(e){e=`[Parchment] `+e,super(e),this.message=e,this.name=this.constructor.name}},wR=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 CR(`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 CR(`Invalid definition`);if(t&&e.blotName===`abstract`)throw new CR(`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})}};wR.blots=new WeakMap;var TR=wR;function ER(e,t){return(e.getAttribute(`class`)||``).split(/\s+/).filter(e=>e.indexOf(`${t}-`)===0)}var DR=class extends SR{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){ER(e,this.keyName).forEach(t=>{e.classList.remove(t)}),e.classList.length===0&&e.removeAttribute(`class`)}value(e){let t=(ER(e,this.keyName)[0]||``).slice(this.keyName.length+1);return this.canAdd(e,t)?t:``}};function OR(e){let t=e.split(`-`),n=t.slice(1).map(e=>e[0].toUpperCase()+e.slice(1)).join(``);return t[0]+n}var kR=class extends SR{static keys(e){return(e.getAttribute(`style`)||``).split(`;`).map(e=>e.split(`:`)[0].trim())}add(e,t){return this.canAdd(e,t)?(e.style[OR(this.keyName)]=t,!0):!1}remove(e){e.style[OR(this.keyName)]=``,e.getAttribute(`style`)||e.removeAttribute(`style`)}value(e){let t=e.style[OR(this.keyName)];return this.canAdd(e,t)?t:``}},AR=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=TR.find(this.domNode);if(e==null)return;let t=SR.keys(this.domNode),n=DR.keys(this.domNode),r=kR.keys(this.domNode);t.concat(n).concat(r).forEach(t=>{let n=e.scroll.query(t,X.ATTRIBUTE);n instanceof SR&&(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),{})}},jR=class{constructor(e,t){this.scroll=e,this.domNode=t,TR.blots.set(t,this),this.prev=null,this.next=null}static create(e){if(this.tagName==null)throw new CR(`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),TR.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 CR(`Cannot wrap ${e}`);return n.appendChild(this),n}};jR.blotName=`abstract`;var MR=jR,NR=class extends MR{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}}};NR.scope=X.INLINE_BLOT;var PR=NR,FR=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 IR(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 LR=class e extends MR{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 FR,Array.from(this.domNode.childNodes).filter(e=>e!==this.uiNode).reverse().forEach(e=>{try{let t=IR(e,this.scroll);this.insertBefore(t,this.children.head||void 0)}catch(e){if(e instanceof CR)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=IR(e,this.scroll);(n.next!==t||n.next==null)&&(n.parent!=null&&n.parent.removeChild(this),this.insertBefore(n,t||void 0))}),this.enforceAllowedChildren()}};LR.uiClass=``;var RR=LR;function zR(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 BR=class e extends RR{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 AR(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 SR?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&&zR(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}};BR.allowedChildren=[BR,PR],BR.blotName=`inline`,BR.scope=X.INLINE_BLOT,BR.tagName=`SPAN`;var VR=BR,HR=class e extends RR{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 AR(this.domNode)}format(t,n){let r=this.scroll.query(t,X.BLOCK);r!=null&&(r instanceof SR?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()}};HR.blotName=`block`,HR.scope=X.BLOCK_BLOT,HR.tagName=`P`,HR.allowedChildren=[VR,HR,PR];var UR=HR,WR=class extends RR{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())}};WR.blotName=`container`,WR.scope=X.BLOCK_BLOT;var GR=WR,KR=class extends PR{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)}},qR={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},JR=100,YR=class extends RR{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,qR),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 RR&&e.children.forEach(a),n.delete(e.domNode),e.optimize(t))},o=e;for(let t=0;o.length>0;t+=1){if(t>=JR)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 RR&&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)}};YR.blotName=`scroll`,YR.defaultChild=UR,YR.allowedChildren=[UR,GR],YR.scope=X.BLOCK_BLOT,YR.tagName=`DIV`;var XR=YR,ZR=class e extends PR{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}};ZR.blotName=`text`,ZR.scope=X.INLINE_BLOT;var QR=ZR,$R=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})),ez=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,I=re&&typeof t==`object`&&t&&!t.nodeType&&t,L=I&&I.exports===re;function R(e,t){return e.set(t[0],t[1]),e}function ie(e,t){return e.add(t),e}function ae(e,t){for(var n=-1,r=e?e.length:0;++n<r&&t(e[n],n,e)!==!1;);return e}function oe(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function se(e,t,n,r){var i=-1,a=e?e.length:0;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function z(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function ce(e,t){return e?.[t]}function le(e){var t=!1;if(e!=null&&typeof e.toString!=`function`)try{t=!!(e+``)}catch{}return t}function ue(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function de(e,t){return function(n){return e(t(n))}}function fe(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var pe=Array.prototype,me=Function.prototype,he=Object.prototype,ge=ne[`__core-js_shared__`],_e=function(){var e=/[^.]+$/.exec(ge&&ge.keys&&ge.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),ve=me.toString,ye=he.hasOwnProperty,be=he.toString,xe=RegExp(`^`+ve.call(ye).replace(A,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),Se=L?ne.Buffer:void 0,Ce=ne.Symbol,we=ne.Uint8Array,Te=de(Object.getPrototypeOf,Object),Ee=Object.create,De=he.propertyIsEnumerable,Oe=pe.splice,ke=Object.getOwnPropertySymbols,Ae=Se?Se.isBuffer:void 0,je=de(Object.keys,Object),Me=Rt(ne,`DataView`),Ne=Rt(ne,`Map`),Pe=Rt(ne,`Promise`),Fe=Rt(ne,`Set`),Ie=Rt(ne,`WeakMap`),Le=Rt(Object,`create`),Re=Jt(Me),ze=Jt(Ne),Be=Jt(Pe),Ve=Jt(Fe),He=Jt(Ie),Ue=Ce?Ce.prototype:void 0,We=Ue?Ue.valueOf:void 0;function Ge(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 Ke(){this.__data__=Le?Le(null):{}}function qe(e){return this.has(e)&&delete this.__data__[e]}function Je(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 Ye(e){var t=this.__data__;return Le?t[e]!==void 0:ye.call(t,e)}function Xe(e,t){var r=this.__data__;return r[e]=Le&&t===void 0?n:t,this}Ge.prototype.clear=Ke,Ge.prototype.delete=qe,Ge.prototype.get=Je,Ge.prototype.has=Ye,Ge.prototype.set=Xe;function Ze(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Qe(){this.__data__=[]}function $e(e){var t=this.__data__,n=_t(t,e);return n<0?!1:(n==t.length-1?t.pop():Oe.call(t,n,1),!0)}function et(e){var t=this.__data__,n=_t(t,e);return n<0?void 0:t[n][1]}function tt(e){return _t(this.__data__,e)>-1}function nt(e,t){var n=this.__data__,r=_t(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}Ze.prototype.clear=Qe,Ze.prototype.delete=$e,Ze.prototype.get=et,Ze.prototype.has=tt,Ze.prototype.set=nt;function rt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function it(){this.__data__={hash:new Ge,map:new(Ne||Ze),string:new Ge}}function at(e){return Lt(this,e).delete(e)}function ot(e){return Lt(this,e).get(e)}function st(e){return Lt(this,e).has(e)}function ct(e,t){return Lt(this,e).set(e,t),this}rt.prototype.clear=it,rt.prototype.delete=at,rt.prototype.get=ot,rt.prototype.has=st,rt.prototype.set=ct;function lt(e){this.__data__=new Ze(e)}function ut(){this.__data__=new Ze}function dt(e){return this.__data__.delete(e)}function ft(e){return this.__data__.get(e)}function pt(e){return this.__data__.has(e)}function mt(e,t){var n=this.__data__;if(n instanceof Ze){var r=n.__data__;if(!Ne||r.length<199)return r.push([e,t]),this;n=this.__data__=new rt(r)}return n.set(e,t),this}lt.prototype.clear=ut,lt.prototype.delete=dt,lt.prototype.get=ft,lt.prototype.has=pt,lt.prototype.set=mt;function ht(e,t){var n=Qt(e)||Zt(e)?z(e.length,String):[],r=n.length,i=!!r;for(var a in e)(t||ye.call(e,a))&&!(i&&(a==`length`||Wt(a,r)))&&n.push(a);return n}function gt(e,t,n){var r=e[t];(!(ye.call(e,t)&&Xt(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function _t(e,t){for(var n=e.length;n--;)if(Xt(e[n][0],t))return n;return-1}function vt(e,t){return e&&Pt(t,sn(t),e)}function yt(e,t,n,r,a,o,s){var c;if(r&&(c=o?r(e,a,o,s):r(e)),c!==void 0)return c;if(!an(e))return e;var d=Qt(e);if(d){if(c=Vt(e),!t)return Nt(e,c)}else{var f=Bt(e),m=f==l||f==u;if(tn(e))return Tt(e,t);if(f==p||f==i||m&&!o){if(le(e))return o?e:{};if(c=Ht(m?{}:e),!t)return Ft(e,vt(c,e))}else{if(!N[f])return o?e:{};c=Ut(e,f,yt,t)}}s||=new lt;var h=s.get(e);if(h)return h;if(s.set(e,c),!d)var g=n?It(e):sn(e);return ae(g||e,function(i,a){g&&(a=i,i=e[a]),gt(c,a,yt(i,t,n,r,a,e,s))}),c}function bt(e){return an(e)?Ee(e):{}}function xt(e,t,n){var r=t(e);return Qt(e)?r:oe(r,n(e))}function St(e){return be.call(e)}function Ct(e){return!an(e)||Kt(e)?!1:(nn(e)||le(e)?xe:M).test(Jt(e))}function wt(e){if(!qt(e))return je(e);var t=[];for(var n in Object(e))ye.call(e,n)&&n!=`constructor`&&t.push(n);return t}function Tt(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}function Et(e){var t=new e.constructor(e.byteLength);return new we(t).set(new we(e)),t}function Dt(e,t){var n=t?Et(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Ot(e,t,n){return se(t?n(ue(e),!0):ue(e),R,new e.constructor)}function kt(e){var t=new e.constructor(e.source,j.exec(e));return t.lastIndex=e.lastIndex,t}function At(e,t,n){return se(t?n(fe(e),!0):fe(e),ie,new e.constructor)}function jt(e){return We?Object(We.call(e)):{}}function Mt(e,t){var n=t?Et(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Nt(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function Pt(e,t,n,r){n||={};for(var i=-1,a=t.length;++i<a;){var o=t[i],s=r?r(n[o],e[o],o,n,e):void 0;gt(n,o,s===void 0?e[o]:s)}return n}function Ft(e,t){return Pt(e,zt(e),t)}function It(e){return xt(e,sn,zt)}function Lt(e,t){var n=e.__data__;return Gt(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function Rt(e,t){var n=ce(e,t);return Ct(n)?n:void 0}var zt=ke?de(ke,Object):cn,Bt=St;(Me&&Bt(new Me(new ArrayBuffer(1)))!=x||Ne&&Bt(new Ne)!=d||Pe&&Bt(Pe.resolve())!=m||Fe&&Bt(new Fe)!=g||Ie&&Bt(new Ie)!=y)&&(Bt=function(e){var t=be.call(e),n=t==p?e.constructor:void 0,r=n?Jt(n):void 0;if(r)switch(r){case Re:return x;case ze:return d;case Be:return m;case Ve:return g;case He:return y}return t});function Vt(e){var t=e.length,n=e.constructor(t);return t&&typeof e[0]==`string`&&ye.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function Ht(e){return typeof e.constructor==`function`&&!qt(e)?bt(Te(e)):{}}function Ut(e,t,n,r){var i=e.constructor;switch(t){case b:return Et(e);case o:case s:return new i(+e);case x:return Dt(e,r);case S:case C:case w:case T:case E:case D:case O:case ee:case k:return Mt(e,r);case d:return Ot(e,r,n);case f:case _:return new i(e);case h:return kt(e);case g:return At(e,r,n);case v:return jt(e)}}function Wt(e,t){return t??=r,!!t&&(typeof e==`number`||te.test(e))&&e>-1&&e%1==0&&e<t}function Gt(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function Kt(e){return!!_e&&_e in e}function qt(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||he)}function Jt(e){if(e!=null){try{return ve.call(e)}catch{}try{return e+``}catch{}}return``}function Yt(e){return yt(e,!0,!0)}function Xt(e,t){return e===t||e!==e&&t!==t}function Zt(e){return en(e)&&ye.call(e,`callee`)&&(!De.call(e,`callee`)||be.call(e)==i)}var Qt=Array.isArray;function $t(e){return e!=null&&rn(e.length)&&!nn(e)}function en(e){return on(e)&&$t(e)}var tn=Ae||ln;function nn(e){var t=an(e)?be.call(e):``;return t==l||t==u}function rn(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=r}function an(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function on(e){return!!e&&typeof e==`object`}function sn(e){return $t(e)?ht(e):wt(e)}function cn(){return[]}function ln(){return!1}t.exports=Yt})),tz=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,I=function(){try{return re&&re.binding&&re.binding(`util`)}catch{}}(),L=I&&I.isTypedArray;function R(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function ie(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function ae(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function oe(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function se(e){return function(t){return e(t)}}function z(e,t){return e.has(t)}function ce(e,t){return e?.[t]}function le(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function ue(e,t){return function(n){return e(t(n))}}function de(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var fe=Array.prototype,pe=Function.prototype,me=Object.prototype,he=N[`__core-js_shared__`],ge=pe.toString,_e=me.hasOwnProperty,ve=function(){var e=/[^.]+$/.exec(he&&he.keys&&he.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),ye=me.toString,be=RegExp(`^`+ge.call(_e).replace(ee,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),xe=ne?N.Buffer:void 0,Se=N.Symbol,Ce=N.Uint8Array,we=me.propertyIsEnumerable,Te=fe.splice,Ee=Se?Se.toStringTag:void 0,De=Object.getOwnPropertySymbols,Oe=xe?xe.isBuffer:void 0,ke=ue(Object.keys,Object),Ae=jt(N,`DataView`),je=jt(N,`Map`),Me=jt(N,`Promise`),Ne=jt(N,`Set`),Pe=jt(N,`WeakMap`),Fe=jt(Object,`create`),Ie=Bt(Ae),Le=Bt(je),Re=Bt(Me),ze=Bt(Ne),Be=Bt(Pe),Ve=Se?Se.prototype:void 0,He=Ve?Ve.valueOf:void 0;function Ue(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 We(){this.__data__=Fe?Fe(null):{},this.size=0}function Ge(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}function Ke(e){var t=this.__data__;if(Fe){var r=t[e];return r===n?void 0:r}return _e.call(t,e)?t[e]:void 0}function qe(e){var t=this.__data__;return Fe?t[e]!==void 0:_e.call(t,e)}function Je(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=Fe&&t===void 0?n:t,this}Ue.prototype.clear=We,Ue.prototype.delete=Ge,Ue.prototype.get=Ke,Ue.prototype.has=qe,Ue.prototype.set=Je;function Ye(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Xe(){this.__data__=[],this.size=0}function Ze(e){var t=this.__data__,n=_t(t,e);return n<0?!1:(n==t.length-1?t.pop():Te.call(t,n,1),--this.size,!0)}function Qe(e){var t=this.__data__,n=_t(t,e);return n<0?void 0:t[n][1]}function $e(e){return _t(this.__data__,e)>-1}function et(e,t){var n=this.__data__,r=_t(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}Ye.prototype.clear=Xe,Ye.prototype.delete=Ze,Ye.prototype.get=Qe,Ye.prototype.has=$e,Ye.prototype.set=et;function tt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function nt(){this.size=0,this.__data__={hash:new Ue,map:new(je||Ye),string:new Ue}}function rt(e){var t=At(this,e).delete(e);return this.size-=+!!t,t}function it(e){return At(this,e).get(e)}function at(e){return At(this,e).has(e)}function ot(e,t){var n=At(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}tt.prototype.clear=nt,tt.prototype.delete=rt,tt.prototype.get=it,tt.prototype.has=at,tt.prototype.set=ot;function st(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new tt;++t<n;)this.add(e[t])}function ct(e){return this.__data__.set(e,n),this}function lt(e){return this.__data__.has(e)}st.prototype.add=st.prototype.push=ct,st.prototype.has=lt;function ut(e){var t=this.__data__=new Ye(e);this.size=t.size}function dt(){this.__data__=new Ye,this.size=0}function ft(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function pt(e){return this.__data__.get(e)}function mt(e){return this.__data__.has(e)}function ht(e,t){var n=this.__data__;if(n instanceof Ye){var r=n.__data__;if(!je||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new tt(r)}return n.set(e,t),this.size=n.size,this}ut.prototype.clear=dt,ut.prototype.delete=ft,ut.prototype.get=pt,ut.prototype.has=mt,ut.prototype.set=ht;function gt(e,t){var n=Ut(e),r=!n&&Ht(e),i=!n&&!r&&Gt(e),a=!n&&!r&&!i&&Zt(e),o=n||r||i||a,s=o?oe(e.length,String):[],c=s.length;for(var l in e)(t||_e.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||Ft(l,c)))&&s.push(l);return s}function _t(e,t){for(var n=e.length;n--;)if(Vt(e[n][0],t))return n;return-1}function vt(e,t,n){var r=t(e);return Ut(e)?r:ie(r,n(e))}function yt(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Ee&&Ee in Object(e)?Mt(e):zt(e)}function bt(e){return Xt(e)&&yt(e)==i}function xt(e,t,n,r,i){return e===t?!0:e==null||t==null||!Xt(e)&&!Xt(t)?e!==e&&t!==t:St(e,t,n,r,xt,i)}function St(e,t,n,r,o,s){var c=Ut(e),l=Ut(t),u=c?a:Pt(e),d=l?a:Pt(t);u=u==i?f:u,d=d==i?f:d;var p=u==f,m=d==f,h=u==d;if(h&&Gt(e)){if(!Gt(t))return!1;c=!0,p=!1}if(h&&!p)return s||=new ut,c||Zt(e)?Et(e,t,n,r,o,s):Dt(e,t,u,n,r,o,s);if(!(n&1)){var g=p&&_e.call(e,`__wrapped__`),_=m&&_e.call(t,`__wrapped__`);if(g||_){var v=g?e.value():e,y=_?t.value():t;return s||=new ut,o(v,y,n,r,s)}}return h?(s||=new ut,Ot(e,t,n,r,o,s)):!1}function Ct(e){return!Yt(e)||Lt(e)?!1:(qt(e)?be:k).test(Bt(e))}function wt(e){return Xt(e)&&Jt(e.length)&&!!j[yt(e)]}function Tt(e){if(!Rt(e))return ke(e);var t=[];for(var n in Object(e))_e.call(e,n)&&n!=`constructor`&&t.push(n);return t}function Et(e,t,n,r,i,a){var o=n&1,s=e.length,c=t.length;if(s!=c&&!(o&&c>s))return!1;var l=a.get(e);if(l&&a.get(t))return l==t;var u=-1,d=!0,f=n&2?new st:void 0;for(a.set(e,t),a.set(t,e);++u<s;){var p=e[u],m=t[u];if(r)var h=o?r(m,p,u,t,e,a):r(p,m,u,e,t,a);if(h!==void 0){if(h)continue;d=!1;break}if(f){if(!ae(t,function(e,t){if(!z(f,t)&&(p===e||i(p,e,n,r,a)))return f.push(t)})){d=!1;break}}else if(!(p===m||i(p,m,n,r,a))){d=!1;break}}return a.delete(e),a.delete(t),d}function Dt(e,t,n,r,i,a,l){switch(n){case y:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case v:return!(e.byteLength!=t.byteLength||!a(new Ce(e),new Ce(t)));case o:case s:case d:return Vt(+e,+t);case c:return e.name==t.name&&e.message==t.message;case m:case g:return e==t+``;case u:var f=le;case h:var p=r&1;if(f||=de,e.size!=t.size&&!p)return!1;var _=l.get(e);if(_)return _==t;r|=2,l.set(e,t);var b=Et(f(e),f(t),r,i,a,l);return l.delete(e),b;case`[object Symbol]`:if(He)return He.call(e)==He.call(t)}return!1}function Ot(e,t,n,r,i,a){var o=n&1,s=kt(e),c=s.length;if(c!=kt(t).length&&!o)return!1;for(var l=c;l--;){var u=s[l];if(!(o?u in t:_e.call(t,u)))return!1}var d=a.get(e);if(d&&a.get(t))return d==t;var f=!0;a.set(e,t),a.set(t,e);for(var p=o;++l<c;){u=s[l];var m=e[u],h=t[u];if(r)var g=o?r(h,m,u,t,e,a):r(m,h,u,e,t,a);if(!(g===void 0?m===h||i(m,h,n,r,a):g)){f=!1;break}p||=u==`constructor`}if(f&&!p){var _=e.constructor,v=t.constructor;_!=v&&`constructor`in e&&`constructor`in t&&!(typeof _==`function`&&_ instanceof _&&typeof v==`function`&&v instanceof v)&&(f=!1)}return a.delete(e),a.delete(t),f}function kt(e){return vt(e,Qt,Nt)}function At(e,t){var n=e.__data__;return It(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function jt(e,t){var n=ce(e,t);return Ct(n)?n:void 0}function Mt(e){var t=_e.call(e,Ee),n=e[Ee];try{e[Ee]=void 0;var r=!0}catch{}var i=ye.call(e);return r&&(t?e[Ee]=n:delete e[Ee]),i}var Nt=De?function(e){return e==null?[]:(e=Object(e),R(De(e),function(t){return we.call(e,t)}))}:$t,Pt=yt;(Ae&&Pt(new Ae(new ArrayBuffer(1)))!=y||je&&Pt(new je)!=u||Me&&Pt(Me.resolve())!=p||Ne&&Pt(new Ne)!=h||Pe&&Pt(new Pe)!=_)&&(Pt=function(e){var t=yt(e),n=t==f?e.constructor:void 0,r=n?Bt(n):``;if(r)switch(r){case Ie:return y;case Le:return u;case Re:return p;case ze:return h;case Be:return _}return t});function Ft(e,t){return t??=r,!!t&&(typeof e==`number`||A.test(e))&&e>-1&&e%1==0&&e<t}function It(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function Lt(e){return!!ve&&ve in e}function Rt(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||me)}function zt(e){return ye.call(e)}function Bt(e){if(e!=null){try{return ge.call(e)}catch{}try{return e+``}catch{}}return``}function Vt(e,t){return e===t||e!==e&&t!==t}var Ht=bt(function(){return arguments}())?bt:function(e){return Xt(e)&&_e.call(e,`callee`)&&!we.call(e,`callee`)},Ut=Array.isArray;function Wt(e){return e!=null&&Jt(e.length)&&!qt(e)}var Gt=Oe||en;function Kt(e,t){return xt(e,t)}function qt(e){if(!Yt(e))return!1;var t=yt(e);return t==l||t==`[object GeneratorFunction]`||t==`[object AsyncFunction]`||t==`[object Proxy]`}function Jt(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=r}function Yt(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}function Xt(e){return typeof e==`object`&&!!e}var Zt=L?se(L):wt;function Qt(e){return Wt(e)?gt(e):Tt(e)}function $t(){return[]}function en(){return!1}t.exports=Kt})),nz=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ez(),n=tz(),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})),rz=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})),iz=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=rz();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=$R(),r=ez(),i=tz(),a=nz();e.AttributeMap=a.default;var o=rz();e.Op=o.default;var s=iz();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=`
|
|
399
|
+
`){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),az=class extends KR{static value(){}optimize(){(this.prev||this.next)&&this.remove()}length(){return 0}value(){return``}};az.blotName=`break`,az.tagName=`BR`;var oz=class extends QR{},sz={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};function cz(e){return e.replace(/[&<>"']/g,e=>sz[e])}var lz=class e extends VR{static allowedChildren=[e,az,KR,oz];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)}}},uz=1,dz=class extends UR{cache={};delta(){return this.cache.delta??(this.cache.delta=pz(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(`
|
|
400
|
+
`),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 az&&n.remove(),this.cache={}}length(){return this.cache.length??(this.cache.length=super.length()+uz),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()-uz)){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}};dz.blotName=`block`,dz.tagName=`P`,dz.defaultChild=az,dz.allowedChildren=[az,lz,KR,oz];var fz=class extends KR{attach(){super.attach(),this.attributes=new AR(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(`
|
|
401
|
+
`),i=r.pop(),a=r.map(e=>{let t=this.scroll.create(dz.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)}};fz.scope=X.BLOCK_BLOT;function pz(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return e.descendants(PR).reduce((e,n)=>n.length()===0?e:e.insert(n.value(),mz(n,{},t)),new Z.default).insert(`
|
|
402
|
+
`,mz(e))}function mz(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:mz(e.parent,t,n)}var hz=class e extends KR{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 oz?this.prev:null,r=n?n.length():0,i=this.next instanceof oz?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``}},gz=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),_z=new WeakMap,vz=[`error`,`warn`,`log`,`info`],yz=`warn`;function bz(e){if(yz&&vz.indexOf(e)<=vz.indexOf(yz)){var t=[...arguments].slice(1);console[e](...t)}}function xz(e){return vz.reduce((t,n)=>(t[n]=bz.bind(console,n,e),t),{})}xz.level=e=>{yz=e},bz.level=xz.level;var Sz=xz(`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=_z.get(t);n&&n.emitter&&n.emitter.handleDOM(...e)})})});var Q=class extends gz.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`,Sz.error)}emit(){var e=[...arguments];return Sz.log.call(Sz,...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})}},Cz=xz(`quill:selection`),wz=class{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;this.index=e,this.length=t}},Tz=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 wz(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 PR){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 Cz.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&&Ez(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 PR?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 wz(i,r-i)}normalizeNative(e){if(!Ez(this.root,e.startContainer)||!e.collapsed&&!Ez(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(Cz.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),Cz.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),!yR(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,DL(this.lastRange),DL(t),e];this.emitter.emit(Q.events.EDITOR_CHANGE,...n),e!==Q.sources.SILENT&&this.emitter.emit(...n)}}};function Ez(e,t){try{t.parentNode}catch{return!1}return e.contains(t)}var Dz=/^[ -~]*$/,Oz=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=Nz(e),r=new Z.default;return Fz(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(`
|
|
403
|
+
`)&&(t<=e||!!this.scroll.descendant(fz,e)[0]),this.scroll.insertAt(e,r);let[i,o]=this.scroll.line(e),c=bR({},mz(i));if(i instanceof dz){let[e]=i.descendant(PR,o);e&&(c=bR(c,mz(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(fz,e)[0])&&(s=!0);else if(e>0){let[t,n]=this.scroll.descendant(PR,e-1);t instanceof oz?t.value()[n]!==`
|
|
404
|
+
`&&(o=!0):t instanceof KR&&t.statics.scope===X.INLINE_BLOT&&(o=!0)}if(this.scroll.insertAt(e,r,n.insert[r]),i){let[t]=this.scroll.descendant(PR,e);if(t){let e=bR({},mz(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,DL(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,DL(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 dz?n.push(t):t instanceof PR&&r.push(t)}):(n=this.scroll.lines(e,t),r=this.scroll.descendants(PR,e,t));let[i,a]=[n,r].map(e=>{let t=e.shift();if(t==null)return{};let n=mz(t);for(;Object.keys(n).length>0;){let t=e.shift();if(t==null)return n;n=jz(mz(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)?Az(n,r,t,!0):Az(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=Nz(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,`
|
|
405
|
+
`).replace(/\r/g,`
|
|
406
|
+
`),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,DL(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!==dz.blotName)return!1;let t=e;return t.children.length>1?!1:t.children.head instanceof az}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(`
|
|
407
|
+
`));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(Dz)&&this.scroll.find(t[0].target)){let i=this.scroll.find(t[0].target),a=mz(i),o=i.offset(this.scroll),s=t[0].oldValue.replace(hz.CONTENTS,``),c=new Z.default().insert(s),l=new Z.default().insert(i.value()),u=n&&{oldRange:Pz(n.oldRange,-o),newRange:Pz(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||!yR(r.compose(e),this.delta))&&(e=r.diff(this.delta,n));return e}};function kz(e,t,n){if(e.length===0){let[e]=Mz(n.pop());return t<=0?`</li></${e}>`:`</li></${e}>${kz([],t-1,n)}`}let[{child:r,offset:i,length:a,indent:o,type:s},...c]=e,[l,u]=Mz(s);if(o>t)return n.push(s),o===t+1?`<${l}><li${u}>${Az(r,i,a)}${kz(c,o,n)}`:`<${l}><li>${kz(e,t+1,n)}`;let d=n[n.length-1];if(o===t&&s===d)return`</li><li${u}>${Az(r,i,a)}${kz(c,o,n)}`;let[f]=Mz(n.pop());return`</li></${f}>${kz(e,t-1,n)}`}function Az(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 oz)return cz(e.value().slice(t,t+n)).replaceAll(` `,` `);if(e instanceof RR){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})}),kz(r,-1,[])}let i=[];if(e.children.forEachAt(t,n,(e,t,n)=>{i.push(Az(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 jz(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 Mz(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 Nz(e){return e.reduce((e,t)=>{if(typeof t.insert==`string`){let n=t.insert.replace(/\r\n/g,`
|
|
408
|
+
`).replace(/\r/g,`
|
|
409
|
+
`);return e.insert(n,t.attributes)}return e.push(t)},new Z.default)}function Pz(e,t){let{index:n,length:r}=e;return new wz(n+t,r)}function Fz(e){let t=[];return e.forEach(e=>{typeof e.insert==`string`?e.insert.split(`
|
|
410
|
+
`).forEach((n,r)=>{r&&t.push({insert:`
|
|
411
|
+
`,attributes:e.attributes}),n&&t.push({insert:n,attributes:e.attributes})}):t.push(e)}),t}var Iz=class{static DEFAULTS={};constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.quill=e,this.options=t}},Lz=``,Rz=class extends KR{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(Lz),this.rightGuard=document.createTextNode(Lz),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(Lz).join(``);if(e===this.leftGuard){if(this.prev instanceof oz){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 oz?(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=Lz,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)}})}},zz=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 Rz)&&(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}},Bz=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]}},Vz=e=>e.parentElement||e.getRootNode().host||null,Hz=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}},Uz=e=>{let t=parseInt(e,10);return Number.isNaN(t)?0:t},Wz=(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,Gz=(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}:Hz(i),a=getComputedStyle(i),o=Wz(r.left,r.right,t.left,t.right,Uz(a.scrollPaddingLeft),Uz(a.scrollPaddingRight)),s=Wz(r.top,r.bottom,t.top,t.bottom,Uz(a.scrollPaddingTop),Uz(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:Vz(i)}},Kz=100,qz=[`block`,`break`,`cursor`,`inline`,`scroll`,`text`],Jz=(e,t,n)=>{let r=new TR;return qz.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>Kz){n.error(`Cycle detected in registering blot requiredContainer: "${e}"`);break}}),r},Yz=xz(`quill`),Xz=new TR;RR.uiClass=`ql-ui`;var $=class e{static DEFAULTS={bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:``,readOnly:!1,registry:Xz,theme:`default`};static events=Q.events;static sources=Q.sources;static version=`2.0.3`;static imports={delta:Z.default,parchment:xR,"core/module":Iz,"core/theme":Bz};static debug(e){e===!0&&(e=`log`),xz.level(e)}static find(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return _z.get(e)||Xz.find(e,t)}static import(e){return this.imports[e]??Yz.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&&Yz.warn(`Overwriting ${e} with`,t),this.imports[e]=t,(e.startsWith(`blots/`)||e.startsWith(`formats/`))&&t&&typeof t!=`boolean`&&t.blotName!==`abstract`&&Xz.register(t),typeof t.register==`function`&&t.register(Xz)}}constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.options=eB(t,n),this.container=this.options.container,this.container==null){Yz.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=``,_z.set(this.container,this),this.root=this.addContainer(`ql-editor`),this.root.classList.add(`ql-blank`),this.emitter=new Q;let i=XR.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 Oz(this.scroll),this.selection=new Tz(this.scroll,this.emitter),this.composition=new zz(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;tB.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;tB.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:`
|
|
412
|
+
`});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]=nB(e,t,n),tB.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 tB.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]=nB(e,t,n,r,i),tB.call(this,()=>this.editor.formatLine(e,t,a),i,e,0)}formatText(e,t,n,r,i){let a;return[e,t,a,i]=nB(e,t,n,r,i),tB.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]=nB(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]=nB(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]=nB(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 tB.call(this,()=>this.editor.insertEmbed(t,n,r),i,t)}insertText(e,t,n,r,i){let a;return[e,,a,i]=nB(e,0,n,r,i),tB.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]=nB(e,t,n),tB.call(this,()=>this.editor.removeFormat(e,t),n,e)}scrollRectIntoView(e){Gz(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 tB.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]=nB(t,n,r),this.selection.setRange(new wz(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 tB.call(this,()=>(e=new Z.default(e),this.editor.applyDelta(e)),t,!0)}};function Zz(e){return typeof e==`string`?document.querySelector(e):e}function Qz(e){return Object.entries(e??{}).reduce((e,t)=>{let[n,r]=t;return{...e,[n]:r===!0?{}:r}},{})}function $z(e){return Object.fromEntries(Object.entries(e).filter(e=>e[1]!==void 0))}function eB(e,t){let n=Zz(e);if(!n)throw Error(`Invalid Quill container`);let r=!t.theme||t.theme===$.DEFAULTS.theme?Bz:$.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=Qz(t.modules);c!=null&&c.toolbar&&c.toolbar.constructor!==Object&&(c={...c,toolbar:{container:c.toolbar}});let l=bR({},Qz(i),Qz(o),c),u={...a,...$z(s),...$z(t)},d=t.registry;return d?t.formats&&Yz.warn(`Ignoring "formats" option because "registry" is specified`):d=t.formats?Jz(t.formats,u.registry,Yz):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?(Yz.error(`Cannot load ${n} module. Are you sure you registered it?`),e):{...e,[n]:bR({},i.DEFAULTS||{},r)}},{}),bounds:Zz(u.bounds)}}function tB(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=rB(i,o,t):r!==0&&(i=rB(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 nB(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 rB(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 wz(a,o-a)}var iB=class extends GR{};function aB(e){return e instanceof dz||e instanceof fz}function oB(e){return typeof e.updateContent==`function`}var sB=class extends XR{static blotName=`scroll`;static className=`ql-editor`;static tagName=`DIV`;static defaultChild=dz;static allowedChildren=[dz,fz,iB];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 fz||i instanceof fz){this.optimize();return}let e=i.children.head instanceof az?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(`
|
|
413
|
+
`)?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(`
|
|
414
|
+
`))),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(fz,e)[0]&&e<this.length()),n=i.type===`block`?i.delta:new Z.default().insert({[i.key]:i.value});cB(this,e,n);let r=+(i.type===`block`),a=e+n.length()+r;t&&this.insertAt(a-1,`
|
|
415
|
+
`);let o=mz(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`)cB(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();cB(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 PR?[n,r]:[null,-1]}line(e){return e===this.length()?this.line(e-1):this.descendant(aB,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)=>{aB(e)?i.push(e):e instanceof GR&&(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&&!oB(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 fz,e);r&&r.statics.blotName===t&&oB(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(`
|
|
416
|
+
`);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 cB(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(PR,t),o=mz(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(PR,t),r=mz(n);i=Z.AttributeMap.diff(r,i)||{}}}}return Object.keys(i).forEach(n=>{e.formatAt(t,r,n,i[n])}),t+r},t)}var lB={scope:X.BLOCK,whitelist:[`right`,`center`,`justify`]},uB=new SR(`align`,`align`,lB),dB=new DR(`align`,`ql-align`,lB),fB=new kR(`align`,`text-align`,lB),pB=class extends kR{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}},mB=new DR(`color`,`ql-color`,{scope:X.INLINE}),hB=new pB(`color`,`color`,{scope:X.INLINE}),gB=new DR(`background`,`ql-bg`,{scope:X.INLINE}),_B=new pB(`background`,`background-color`,{scope:X.INLINE}),vB=class extends iB{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(`
|
|
417
|
+
`).slice(e,e+t)}html(e,t){return`<pre>\n${cz(this.code(e,t))}\n</pre>`}},yB=class extends dz{static TAB=` `;static register(){$.register(vB)}},bB=class extends lz{};bB.blotName=`code`,bB.tagName=`CODE`,yB.blotName=`code-block`,yB.className=`ql-code-block`,yB.tagName=`DIV`,vB.blotName=`code-block-container`,vB.className=`ql-code-block-container`,vB.tagName=`DIV`,vB.allowedChildren=[yB],yB.allowedChildren=[oz,az,hz],yB.requiredContainer=vB;var xB={scope:X.BLOCK,whitelist:[`rtl`]},SB=new SR(`direction`,`dir`,xB),CB=new DR(`direction`,`ql-direction`,xB),wB=new kR(`direction`,`direction`,xB),TB={scope:X.INLINE,whitelist:[`serif`,`monospace`]},EB=new DR(`font`,`ql-font`,TB),DB=new class extends kR{value(e){return super.value(e).replace(/["']/g,``)}}(`font`,`font-family`,TB),OB=new DR(`size`,`ql-size`,{scope:X.INLINE,whitelist:[`small`,`large`,`huge`]}),kB=new kR(`size`,`font-size`,{scope:X.INLINE,whitelist:[`10px`,`18px`,`32px`]}),AB=xz(`quill:keyboard`),jB=/Mac/i.test(navigator.platform)?`metaKey`:`ctrlKey`,MB=class e extends Iz{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=LB(e);if(r==null){AB.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 QR?s.value().slice(0,c):``,f=l instanceof QR?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:yR(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){RB({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(`
|
|
418
|
+
`,n);this.quill.updateContents(r,$.sources.USER),this.quill.setSelection(e.index+1,$.sources.SILENT),this.quill.focus()}};MB.DEFAULTS={bindings:{bold:FB(`bold`),italic:FB(`italic`),underline:FB(`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":NB(!0),"outdent code-block":NB(!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(`
|
|
419
|
+
`,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(`
|
|
420
|
+
`,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=zB(n,r,i,a);if(o==null)return;let s=n.offset();if(o<0){let t=new Z.default().retain(s).insert(`
|
|
421
|
+
`);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(`
|
|
422
|
+
`);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":PB(`ArrowLeft`,!1),"embed left shift":PB(`ArrowLeft`,!0),"embed right":PB(`ArrowRight`,!1),"embed right shift":PB(`ArrowRight`,!0),"table down":IB(!1),"table up":IB(!0)}};function NB(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 PB(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 KR?(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 FB(e){return{key:e[0],shortKey:!0,handler(t,n){this.quill.format(e,!n.format[e],$.sources.USER)}}}function IB(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 LB(e){if(typeof e==`string`||typeof e==`number`)e={key:e};else if(typeof e==`object`)e=DL(e);else return null;return e.shortKey&&(e[jB]=e.shortKey,delete e.shortKey),e}function RB(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 zB(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 BB=/font-weight:\s*normal/,VB=[`P`,`OL`,`UL`],HB=e=>e&&VB.includes(e.tagName),UB=e=>{Array.from(e.querySelectorAll(`br`)).filter(e=>HB(e.previousElementSibling)&&HB(e.nextElementSibling)).forEach(e=>{e.parentNode?.removeChild(e)})},WB=e=>{Array.from(e.querySelectorAll(`b[style*="font-weight"]`)).filter(e=>e.getAttribute(`style`)?.match(BB)).forEach(t=>{let n=e.createDocumentFragment();n.append(...t.childNodes),t.parentNode?.replaceChild(n,t)})};function GB(e){e.querySelector(`[id^="docs-internal-guid-"]`)&&(WB(e),UB(e))}var KB=/\bmso-list:[^;]*ignore/i,qB=/\bmso-list:[^;]*\bl(\d+)/i,JB=/\bmso-list:[^;]*\blevel(\d+)/i,YB=(e,t)=>{let n=e.getAttribute(`style`),r=n?.match(qB);if(!r)return null;let i=Number(r[1]),a=n?.match(JB),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}},XB=e=>{let t=Array.from(e.querySelectorAll(`[style*=mso-list]`)),n=[],r=[];t.forEach(e=>{(e.getAttribute(`style`)||``).match(KB)?n.push(e):r.push(e)}),n.forEach(e=>e.parentNode?.removeChild(e));let i=e.documentElement.innerHTML,a=r.map(e=>YB(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 ZB(e){e.documentElement.getAttribute(`xmlns:w`)===`urn:schemas-microsoft-com:office:word`&&XB(e)}var QB=[ZB,GB],$B=e=>{e.documentElement&&QB.forEach(t=>{t(e)})},eV=xz(`quill:clipboard`),tV=[[Node.TEXT_NODE,CV],[Node.TEXT_NODE,bV],[`br`,hV],[Node.ELEMENT_NODE,bV],[Node.ELEMENT_NODE,mV],[Node.ELEMENT_NODE,pV],[Node.ELEMENT_NODE,xV],[`li`,vV],[`ol, ul`,yV],[`pre`,gV],[`tr`,SV],[`b`,fV(`bold`)],[`i`,fV(`italic`)],[`strike`,fV(`strike`)],[`style`,_V]],nV=[uB,SB].reduce((e,t)=>(e[t.keyName]=t,e),{}),rV=[fB,_B,hB,wB,DB,kB].reduce((e,t)=>(e[t.keyName]=t,e),{}),iV=class extends Iz{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=[],tV.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[yB.blotName])return new Z.default().insert(n||``,{[yB.blotName]:r[yB.blotName]});if(!t)return new Z.default().insert(n||``,r);let i=this.convertHTML(t);return oV(i,`
|
|
423
|
+
`)&&(i.ops[i.ops.length-1].attributes==null||r.table)?i.compose(new Z.default().retain(i.length()-1).delete(1)):i}normalizeHTML(e){$B(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 dV(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&&RB({range:n,quill:this.quill})}normalizeURIList(e){return e.split(/\r?\n/).filter(e=>e[0]!==`#`).join(`
|
|
424
|
+
`)}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);eV.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 aV(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 oV(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 sV(e,t){if(!(e instanceof Element))return!1;let n=t.query(e);return n&&n.prototype instanceof KR?!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 cV(e,t){return e.previousElementSibling&&e.nextElementSibling&&!sV(e.previousElementSibling,t)&&!sV(e.nextElementSibling,t)}var lV=new WeakMap;function uV(e){return e!=null&&(lV.has(e)||(e.tagName===`PRE`?lV.set(e,!0):lV.set(e,uV(e.parentNode))),lV.get(e))}function dV(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=dV(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 fV(e){return(t,n,r)=>aV(n,e,!0,r)}function pV(e,t,n){let r=SR.keys(e),i=DR.keys(e),a=kR.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=nV[t],r!=null&&(r.attrName===t||r.keyName===t)&&(o[r.attrName]=r.value(e)||void 0),r=rV[t],r!=null&&(r.attrName===t||r.keyName===t)&&(r=rV[t],o[r.attrName]=r.value(e)||void 0))}),Object.entries(o).reduce((e,t)=>{let[r,i]=t;return aV(e,r,i,n)},t)}function mV(e,t,n){let r=n.query(e);if(r==null)return t;if(r.prototype instanceof KR){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 UR&&!oV(t,`
|
|
425
|
+
`)&&t.insert(`
|
|
426
|
+
`),`blotName`in r&&`formats`in r&&typeof r.formats==`function`)return aV(t,r.blotName,r.formats(e,n),n);return t}function hV(e,t){return oV(t,`
|
|
427
|
+
`)||t.insert(`
|
|
428
|
+
`),t}function gV(e,t,n){let r=n.query(`code-block`);return aV(t,`code-block`,r&&`formats`in r&&typeof r.formats==`function`?r.formats(e,n):!0,n)}function _V(){return new Z.default}function vV(e,t,n){let r=n.query(e);if(r==null||r.blotName!==`list`||!oV(t,`
|
|
429
|
+
`))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 yV(e,t,n){let r=e,i=r.tagName===`OL`?`ordered`:`bullet`,a=r.getAttribute(`data-checked`);return a&&(i=a===`true`?`checked`:`unchecked`),aV(t,`list`,i,n)}function bV(e,t,n){if(!oV(t,`
|
|
430
|
+
`)){if(sV(e,n)&&(e.childNodes.length>0||e instanceof HTMLParagraphElement))return t.insert(`
|
|
431
|
+
`);if(t.length()>0&&e.nextSibling){let r=e.nextSibling;for(;r!=null;){if(sV(r,n))return t.insert(`
|
|
432
|
+
`);let e=n.query(r);if(e&&e.prototype instanceof fz)return t.insert(`
|
|
433
|
+
`);r=r.firstChild}}}return t}function xV(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 aV(e,r,i,n)},t),parseFloat(i.textIndent||0)>0?new Z.default().insert(` `).concat(t):t}function SV(e,t,n){let r=e.parentElement?.tagName===`TABLE`?e.parentElement:e.parentElement?.parentElement;return r==null?t:aV(t,`table`,Array.from(r.querySelectorAll(`tr`)).indexOf(e)+1,n)}function CV(e,t,n){let r=e.data;if(e.parentElement?.tagName===`O:P`)return t.insert(r.trim());if(!uV(e)){if(r.trim().length===0&&r.includes(`
|
|
434
|
+
`)&&!cV(e,n))return t;r=r.replace(/[^\S\u00a0]/g,` `),r=r.replace(/ {2,}/g,` `),(e.previousSibling==null&&e.parentElement!=null&&sV(e.parentElement,n)||e.previousSibling instanceof Element&&sV(e.previousSibling,n))&&(r=r.replace(/^ /,``)),(e.nextSibling==null&&e.parentElement!=null&&sV(e.parentElement,n)||e.nextSibling instanceof Element&&sV(e.nextSibling,n))&&(r=r.replace(/ $/,``)),r=r.replaceAll(`\xA0`,` `)}return t.insert(r)}var wV=class extends Iz{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=OV(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:OV(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){TV(this.stack.undo,e),TV(this.stack.redo,e)}undo(){this.change(`undo`,`redo`)}restoreSelection(e){if(e.range)this.quill.setSelection(e.range,$.sources.USER);else{let t=DV(this.quill.scroll,e.delta);this.quill.setSelection(t,$.sources.USER)}}};function TV(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&&OV(r.range,n)},n=r.delta.transform(n),e[t].delta.length()===0&&e.splice(t,1)}}function EV(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(`
|
|
435
|
+
`)}function DV(e,t){let n=t.reduce((e,t)=>e+(t.delete||0),0),r=t.length()-n;return EV(e,t)&&--r,r}function OV(e,t){if(!e)return e;let n=t.transformPosition(e.index);return{index:n,length:t.transformPosition(e.index+e.length)-n}}var kV=class extends Iz{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)}};kV.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 AV=[`insertText`,`insertReplacementText`],jV=class extends Iz{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){RB({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||!AV.includes(e.inputType))return;let t=e.getTargetRanges?e.getTargetRanges()[0]:null;if(!t||t.collapsed===!0)return;let n=MV(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 MV(e){return typeof e.data==`string`?e.data:e.dataTransfer?.types.includes(`text/plain`)?e.dataTransfer.getData(`text/plain`):null}var NV=/Mac/i.test(navigator.platform),PV=e=>!!(e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Home`||NV&&e.key===`a`&&e.ctrlKey===!0),FV=class extends Iz{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 RR)||!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&&PV(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 RR)||!n.uiNode)return;let r=document.createRange();r.setStartAfter(n.uiNode),r.setEndAfter(n.uiNode),e.removeAllRanges(),e.addRange(r)}};$.register({"blots/block":dz,"blots/block/embed":fz,"blots/break":az,"blots/container":iB,"blots/cursor":hz,"blots/embed":Rz,"blots/inline":lz,"blots/scroll":sB,"blots/text":oz,"modules/clipboard":iV,"modules/history":wV,"modules/keyboard":MB,"modules/uploader":kV,"modules/input":jV,"modules/uiNode":FV});var IV=$,LV=new class extends DR{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]}),RV=class extends dz{static blotName=`blockquote`;static tagName=`blockquote`},zV=class extends dz{static blotName=`header`;static tagName=[`H1`,`H2`,`H3`,`H4`,`H5`,`H6`];static formats(e){return this.tagName.indexOf(e.tagName)+1}},BV=class extends iB{};BV.blotName=`list-container`,BV.tagName=`OL`;var VV=class extends dz{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(BV)}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)}};VV.blotName=`list`,VV.tagName=`LI`,BV.allowedChildren=[VV],VV.requiredContainer=BV;var HV=class extends lz{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)}},UV=class extends HV{static blotName=`italic`;static tagName=[`EM`,`I`]},WV=class extends lz{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 GV(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 GV(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 KV=class extends lz{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`}},qV=class extends HV{static blotName=`strike`;static tagName=[`S`,`STRIKE`]},JV=class extends lz{static blotName=`underline`;static tagName=`U`},YV=class extends Rz{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>`}},XV=[`alt`,`height`,`width`],ZV=class extends KR{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 XV.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 GV(e,[`http`,`https`,`data`])?e:`//:0`}static value(e){return e.getAttribute(`src`)}format(e,t){XV.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}},QV=[`height`,`width`],$V=class extends fz{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 QV.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t),{})}static sanitize(e){return WV.sanitize(e)}static value(e){return e.getAttribute(`src`)}format(e,t){QV.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>`}},eH=new DR(`code-token`,`hljs`,{scope:X.INLINE}),tH=class e extends lz{static formats(e,t){for(;e!=null&&e!==t.domNode;){if(e.classList&&e.classList.contains(yB.className))return super.formats(e,t);e=e.parentNode}}constructor(e,t,n){super(e,t,n),eH.add(this.domNode,n)}format(t,n){t===e.blotName?n?eH.add(this.domNode,n):(eH.remove(this.domNode),this.domNode.classList.remove(this.statics.className)):super.format(t,n)}optimize(){super.optimize(...arguments),eH.value(this.domNode)||this.unwrap()}};tH.blotName=`code-token`,tH.className=`ql-token`;var nH=class extends yB{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(),tH.blotName,!1),super.replaceWith(e,t)}},rH=class extends vB{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(e,t){e===nH.blotName&&(this.forceNext=!0,this.children.forEach(n=>{n.format(e,t)}))}formatAt(e,t,n,r){n===nH.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(`
|
|
436
|
+
`)}\n`,r=nH.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(pz(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=>{[nH.blotName,tH.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?nH.formats(n.domNode):`plain`}">\n${cz(this.code(e,t))}\n</pre>`}optimize(e){if(super.optimize(e),this.parent!=null&&this.children.head!=null&&this.uiNode!=null){let e=nH.formats(this.children.head.domNode);e!==this.uiNode.value&&(this.uiNode.value=e)}}};rH.allowedChildren=[nH],nH.requiredContainer=rH,nH.allowedChildren=[tH,hz,oz,az];var iH=(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},aH=class extends Iz{static register(){$.register(tH,!0),$.register(nH,!0),$.register(rH,!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 rH))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(nH.blotName,t.value),this.quill.root.focus(),this.highlight(e,!0)}),e.uiNode??(e.attachUI(t),e.children.head&&(t.value=nH.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(rH):[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 cz(e).split(`
|
|
437
|
+
`).reduce((e,n,r)=>(r!==0&&e.insert(`
|
|
438
|
+
`,{[yB.blotName]:t}),e.insert(n)),new Z.default);let n=this.quill.root.ownerDocument.createElement(`div`);return n.classList.add(yB.className),n.innerHTML=iH(this.options.hljs,t,e),dV(this.quill.scroll,n,[(e,t)=>{let n=eH.value(e);return n?t.compose(new Z.default().retain(t.length(),{[tH.blotName]:n})):t}],[(e,n)=>e.data.split(`
|
|
439
|
+
`).reduce((e,n,r)=>(r!==0&&e.insert(`
|
|
440
|
+
`,{[yB.blotName]:t}),e.insert(n)),n)],new WeakMap)}};aH.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 oH=class e extends dz{static blotName=`table`;static tagName=`TD`;static create(e){let t=super.create();return e?t.setAttribute(`data-row`,e):t.setAttribute(`data-row`,uH()),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()}},sH=class extends iB{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}},cH=class extends iB{static blotName=`table-body`;static tagName=`TBODY`},lH=class extends iB{static blotName=`table-container`;static tagName=`TABLE`;balanceCells(){let e=this.descendants(sH),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=oH.formats(e.children.head.domNode));let n=this.scroll.create(oH.blotName,t);e.appendChild(n),n.optimize()})})}cells(e){return this.rows().map(t=>t.children.at(e))}deleteColumn(e){let[t]=this.descendant(cH);t!=null&&t.children.head!=null&&t.children.forEach(t=>{t.children.at(e)?.remove()})}insertColumn(e){let[t]=this.descendant(cH);t!=null&&t.children.head!=null&&t.children.forEach(t=>{let n=t.children.at(e),r=oH.formats(t.children.head.domNode),i=this.scroll.create(oH.blotName,r);t.insertBefore(i,n)})}insertRow(e){let[t]=this.descendant(cH);if(t==null||t.children.head==null)return;let n=uH(),r=this.scroll.create(sH.blotName);t.children.head.children.forEach(()=>{let e=this.scroll.create(oH.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)}};lH.allowedChildren=[cH],cH.requiredContainer=lH,cH.allowedChildren=[sH],sH.requiredContainer=cH,sH.allowedChildren=[oH],oH.requiredContainer=sH;function uH(){return`row-${Math.random().toString(36).slice(2,6)}`}var dH=class extends Iz{static register(){$.register(oH),$.register(sH),$.register(cH),$.register(lH)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(lH).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!==oH.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(`
|
|
441
|
+
`).join(``);return e.insert(n,{table:uH()})},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)})}},fH=xz(`quill:toolbar`),pH=class extends Iz{constructor(e,t){if(super(e,t),Array.isArray(this.options.container)){let t=document.createElement(`div`);t.setAttribute(`role`,`toolbar`),hH(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)){fH.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){fH.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 KR){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())}})}};pH.DEFAULTS={};function mH(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 hH(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`)mH(n,e);else{let t=Object.keys(e)[0],r=e[t];Array.isArray(r)?gH(n,t,r):mH(n,t,r)}}),e.appendChild(n)})}function gH(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)}pH.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 _H=`<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>`,vH=`<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>`,yH=`<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>`,bH=`<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>`,xH=`<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>`,SH=`<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>`,CH=`<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>`,wH=`<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>`,TH=`<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>`,EH={align:{"":_H,center:vH,right:yH,justify:bH},background:xH,blockquote:SH,bold:CH,clean:wH,code:TH,"code-block":TH,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>`},DH=`<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>`,OH=0;function kH(e,t){e.setAttribute(t,`${e.getAttribute(t)!==`true`}`)}var AH=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`),kH(this.label,`aria-expanded`),kH(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=DH,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-${OH}`,OH+=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)}},jH=class extends AH{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)}},MH=class extends AH{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}}},NH=e=>{let{overflowY:t}=getComputedStyle(e,null);return t!==`visible`&&t!==`clip`},PH=class{constructor(e,t){this.quill=e,this.boundsContainer=t||document.body,this.root=e.addContainer(`ql-tooltip`),this.root.innerHTML=this.constructor.TEMPLATE,NH(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`)}},FH=[!1,`center`,`right`,`justify`],IH=`#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(`.`),LH=[!1,`serif`,`monospace`],RH=[`1`,`2`,`3`,!1],zH=[`small`,!1,`large`,`huge`],BH=class extends Bz{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`)??UH(e,FH),typeof t.align==`object`))return new MH(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`)??UH(e,IH,n===`background`?`#ffffff`:`#000000`),new jH(e,t[n])}return e.querySelector(`option`)??(e.classList.contains(`ql-font`)?UH(e,LH):e.classList.contains(`ql-header`)?UH(e,RH):e.classList.contains(`ql-size`)&&UH(e,zH)),new AH(e)}),this.quill.on(Q.events.EDITOR_CHANGE,()=>{this.pickers.forEach(e=>{e.update()})})}};BH.DEFAULTS=bR({},Bz.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 VH=class extends PH{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=HH(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 HH(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 UH(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 WH=[[`bold`,`italic`,`link`],[{header:1},{header:2},`blockquote`]],GH=class extends VH{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 wz(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}},KH=class extends BH{constructor(e,t){t.modules.toolbar!=null&&t.modules.toolbar.container==null&&(t.modules.toolbar.container=WH),super(e,t),this.quill.container.classList.add(`ql-bubble`)}extendToolbar(e){this.tooltip=new GH(this.quill,this.options.bounds),e.container!=null&&(this.tooltip.root.appendChild(e.container),this.buildButtons(e.container.querySelectorAll(`button`),EH),this.buildPickers(e.container.querySelectorAll(`select`),EH))}};KH.DEFAULTS=bR({},BH.DEFAULTS,{modules:{toolbar:{handlers:{link(e){e?this.quill.theme.tooltip.edit():this.quill.format(`link`,!1,$.sources.USER)}}}}});var qH=[[{header:[`1`,`2`,`3`,!1]}],[`bold`,`italic`,`underline`,`link`],[{list:`ordered`},{list:`bullet`}],[`clean`]],JH=class extends VH{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(WV,e.index);if(t!=null){this.linkRange=new wz(e.index-n,t.length());let r=WV.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`)}},YH=class extends BH{constructor(e,t){t.modules.toolbar!=null&&t.modules.toolbar.container==null&&(t.modules.toolbar.container=qH),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`),EH),this.buildPickers(e.container.querySelectorAll(`select`),EH),this.tooltip=new JH(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)}))}};YH.DEFAULTS=bR({},BH.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)}}}}}),IV.register({"attributors/attribute/direction":SB,"attributors/class/align":dB,"attributors/class/background":gB,"attributors/class/color":mB,"attributors/class/direction":CB,"attributors/class/font":EB,"attributors/class/size":OB,"attributors/style/align":fB,"attributors/style/background":_B,"attributors/style/color":hB,"attributors/style/direction":wB,"attributors/style/font":DB,"attributors/style/size":kB},!0),IV.register({"formats/align":dB,"formats/direction":CB,"formats/indent":LV,"formats/background":_B,"formats/color":hB,"formats/font":EB,"formats/size":OB,"formats/blockquote":RV,"formats/code-block":yB,"formats/header":zV,"formats/list":VV,"formats/bold":HV,"formats/code":bB,"formats/italic":UV,"formats/link":WV,"formats/script":KV,"formats/strike":qV,"formats/underline":JV,"formats/formula":YV,"formats/image":ZV,"formats/video":$V,"modules/syntax":aH,"modules/table":dH,"modules/toolbar":pH,"themes/bubble":KH,"themes/snow":YH,"ui/icons":EH,"ui/picker":AH,"ui/icon-picker":MH,"ui/color-picker":jH,"ui/tooltip":PH},!0);var XH=IV,ZH=null;function QH(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}=Tw(t),{tree:l,cleanup:u}=Qw(s,c,n),d=e.ctx??ZH??(ZH=Cw(!0));d.fontKerning=`normal`;let{root:f,height:p,lines:m}=$T(d,l,n,o,a),h=r||p;return u(),{layoutRoot:f,height:h,lines:m}}function $H(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 uE(o,t.layoutRoot),{canvas:a}}var eU=!1,tU=[`background-image`,`background-size`,`-webkit-background-clip`,`background-clip`,`-webkit-text-fill-color`,`color`];function nU(){if(eU)return;eU=!0;let e=XH.import(`attributors/style/size`),t=XH.import(`attributors/style/font`);e&&(delete e.whitelist,XH.register(e,!0)),t&&(delete t.whitelist,XH.register(t,!0));let n=XH.import(`parchment`);if(n?.StyleAttributor&&n?.Scope){let e=new n.StyleAttributor(`font-weight`,`font-weight`,{scope:n.Scope.INLINE});XH.register(e,!0),XH.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`,lC(t))}catch{}return!0}remove(e){for(let t of tU)e.style.removeProperty(t)}value(e){return UA(e)?e.style.getPropertyValue(`background-image`):``}}return new t(`gradient`,`background-image`,{scope:e.Scope.INLINE})}(n),!0);let t=XH.import(`attributors/style/color`);if(t){let e=t.value.bind(t);t.value=t=>UA(t)?``:e(t),XH.register(t,!0)}}}var rU=[`fontSize`,`fontFamily`,`fill`,`fontWeight`,`fontStyle`,`textDecoration`],iU=Xt({active:null},{},{deep:!1});function aU(){return iU.active}function oU(e){pr(()=>{iU.active=Object.assign(Object.assign({},e),{currentFormat:{},mixedFormats:{},lastSelection:null})})}function sU(e,t,n){pr(()=>{iU.active&&=Object.assign(Object.assign({},iU.active),{currentFormat:e,mixedFormats:t,lastSelection:n||iU.active.lastSelection})})}function cU(e){pr(()=>{e&&iU.active?.instance!==e||(iU.active=null)})}var lU={fontSize:[`size`],fontFamily:[`font`],fill:[`color`,`gradient`],fontWeight:[`font-weight`],fontStyle:[`italic`],textDecoration:[`underline`,`strike`]},uU=Array.from(new Set(rU.flatMap(e=>lU[e]))),dU={data:``},fU=e=>typeof window==`object`?((e?e.querySelector(`#_goober`):window._goober)||Object.assign((e||document.head).appendChild(document.createElement(`style`)),{innerHTML:` `,id:`_goober`})).firstChild:e||dU,pU=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,mU=/\/\*[^]*?\*\/|\s\s+|\n/g,hU=(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`?hU(o,a):a+`{`+hU(o,a[1]==`k`?``:t)+`}`:typeof o==`object`?r+=hU(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+=hU.p?hU.p(a,o):a+`:`+o+`;`)}return n+(t&&i?t+`{`+i+`}`:i)+r},gU={},_U=e=>{if(typeof e==`object`){let t=``;for(let n in e)t+=n+_U(e[n]);return t}return e},vU=(e,t,n,r,i)=>{let a=_U(e),o=gU[a]||(gU[a]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return`go`+n})(a));if(!gU[o]){let t=a===e?(e=>{let t,n=[{}];for(;t=pU.exec(e.replace(mU,``));)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;gU[o]=hU(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)})(gU[o],t,r),o};function yU(e){let t=this||{},n=e.call?e(t.p):e;return vU(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?``:hU(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,fU(t.target),t.g,t.o,t.k)}var bU,xU,SU;yU.bind({g:1}),yU.bind({k:1});function CU(e,t,n,r){hU.p=t,bU=e,xU=n,SU=r}function wU(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:xU&&xU()},s),n.o=/ *go\d+/.test(c),s.className=yU.apply(n,r)+(c?` `+c:``),t&&(s.ref=o);let l=e;return e[0]&&(l=s.as||e,delete s.as),SU&&l[0]&&SU(s),bU(l,s)}return t?t(i):i}}CU(k.createElement,void 0,void 0,void 0);var TU=e=>wU(e,k.forwardRef),EU=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},DU=Xt({enabled:!1,currentFormat:{},pendingToolbarInteraction:!1,editor:Xt.object({instance:null},{},{deep:!1})}),OU=uU;function kU(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 OU)GA(r,e)&&(n[e]=!0);return n}(e,t);pr(()=>{DU.currentFormat=n}),sU(n,r,t)}var AU=`polotno-saved-selection`;function jU(){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(AU,new Highlight(t)),NU()}function MU(){typeof CSS<`u`&&CSS.highlights&&CSS.highlights.delete(AU)}function NU(){setTimeout(()=>{typeof CSS<`u`&&CSS.highlights&&CSS.highlights.has(AU)&&(document.querySelector(`.polotno-portal`)||GU(document.activeElement)?NU():MU())},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(${AU}) { background-color: Highlight; }`,document.head.appendChild(e)}var PU=null;function FU(e,t){e.type===`text`&&t.push(e);for(let n of e.children||[])FU(n,t)}function IU(e){let t=e.fontSize;if(!t||t<=0)return null;let n=/\s/.test(e.fontFamily)?`'${e.fontFamily}'`:e.fontFamily,r=Db(e.fontWeight)?700:400,i=e.fontStyle===`italic`?`italic`:`normal`,a=PU??=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=nD(`<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=QH({html:l,width:Math.max(12*t,600)})}catch{return null}let d=[];FU(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=m*(1+s-c)/2,g=2.1*t;return{bulletLeft:f.x,bulletTop:f.y-h,bulletFontSize:m,numberGap:p?Math.max(0,g-p.x-(p.width??0)):0}}var LU=TU(`div`,k.forwardRef)`
|
|
442
|
+
.ql-editor {
|
|
443
|
+
outline: none;
|
|
444
|
+
/* anchor for the absolutely-positioned ::before placeholder below */
|
|
445
|
+
position: relative;
|
|
446
|
+
/* Element-level underline/strike — text-decoration doesn't inherit, so it is
|
|
447
|
+
applied here on the editable root (mirrors the static getHtml render). */
|
|
448
|
+
text-decoration: var(--polotno-text-decoration, none);
|
|
449
|
+
}
|
|
450
|
+
/* Placeholder for an empty editor. Quill toggles ql-blank + data-placeholder
|
|
451
|
+
but its core stylesheet (which paints it) is not loaded — do it here. Same
|
|
452
|
+
0.6 dim as the canvas render and the legacy textarea ::placeholder. */
|
|
453
|
+
.ql-editor.ql-blank::before {
|
|
454
|
+
content: attr(data-placeholder);
|
|
455
|
+
position: absolute;
|
|
456
|
+
inset-inline: 0;
|
|
457
|
+
top: 0;
|
|
458
|
+
opacity: 0.6;
|
|
459
|
+
pointer-events: none;
|
|
460
|
+
}
|
|
461
|
+
.ql-clipboard {
|
|
462
|
+
pointer-events: none;
|
|
463
|
+
opacity: 0;
|
|
464
|
+
}
|
|
465
|
+
${$E}
|
|
466
|
+
|
|
467
|
+
/* ===== Editor-only list markers (Quill flat-DOM hack) ======================
|
|
468
|
+
Quill emits a FLAT <ol> with per-item data-list + ql-indent classes (not
|
|
469
|
+
real nested <ul>/<ol>), so the browser's native markers can't render mixed
|
|
470
|
+
bullet/number items or nested numbering. The editor therefore disables
|
|
471
|
+
native markers and draws its own via ::before — but ONLY here, so it can't
|
|
472
|
+
leak into the export/canvas paths (which use native markers; see
|
|
473
|
+
reset-style.ts). These are tuned to match render-tag (the canvas
|
|
474
|
+
reference): marker sized at the item font, sitting just left of the text
|
|
475
|
+
inside the 2.1em indent. letter-spacing is intentionally NOT reset to
|
|
476
|
+
normal — numbered markers track it, like render-tag/native/Canva. */
|
|
477
|
+
.ql-editor ul,
|
|
478
|
+
.ql-editor ol {
|
|
479
|
+
list-style: none;
|
|
480
|
+
/* Editor box model is the inverse of the shared reset: the indent lives on
|
|
481
|
+
the <li> (not the list) so the absolutely-positioned ::before marker
|
|
482
|
+
below has room in the li's start-padding. (The export/canvas path puts
|
|
483
|
+
the indent on the list for native outside markers — see reset-style.ts.) */
|
|
484
|
+
padding-inline-start: 0;
|
|
485
|
+
}
|
|
486
|
+
.ql-editor .ql-ui {
|
|
487
|
+
display: none;
|
|
488
|
+
}
|
|
489
|
+
/* Per-LEVEL ordered counters (list-0..list-3), so a nested ordered list
|
|
490
|
+
restarts at 1 — matching canonical HTML and the canvas. Quill's flat DOM
|
|
491
|
+
expresses depth via ql-indent-N, so each ordered item increments its
|
|
492
|
+
level's counter and RESETS all deeper levels (counter-reset applies before
|
|
493
|
+
counter-increment on the same element). A single global counter would make
|
|
494
|
+
a nested "deep" item continue the outer numbering (e.g. show 3 instead of
|
|
495
|
+
1). All levels use decimal to match render-tag (which doesn't cycle
|
|
496
|
+
styles). Custom counter names avoid Safari's list-item counter bug. */
|
|
497
|
+
.ql-editor ol {
|
|
498
|
+
counter-reset: list-0 list-1 list-2 list-3;
|
|
499
|
+
}
|
|
500
|
+
.ql-editor li {
|
|
501
|
+
position: relative; /* anchor for the absolutely-positioned ::before */
|
|
502
|
+
padding-inline-start: 2.1em; /* marker space + per-level indent (start side) */
|
|
503
|
+
}
|
|
504
|
+
.ql-editor li[data-list='ordered'] {
|
|
505
|
+
counter-increment: list-0;
|
|
506
|
+
counter-reset: list-1 list-2 list-3;
|
|
507
|
+
}
|
|
508
|
+
.ql-editor li.ql-indent-1[data-list='ordered'] {
|
|
509
|
+
counter-increment: list-1;
|
|
510
|
+
counter-reset: list-2 list-3;
|
|
511
|
+
}
|
|
512
|
+
.ql-editor li.ql-indent-2[data-list='ordered'] {
|
|
513
|
+
counter-increment: list-2;
|
|
514
|
+
counter-reset: list-3;
|
|
515
|
+
}
|
|
516
|
+
.ql-editor li.ql-indent-3[data-list='ordered'] {
|
|
517
|
+
counter-increment: list-3;
|
|
518
|
+
}
|
|
519
|
+
/* Marker box spans the 2.1em indent and right-aligns the marker against the
|
|
520
|
+
text with a gap, so the marker's right edge ≈ render-tag's
|
|
521
|
+
(contentStart − gap). line-height is inherited so the marker sits on the
|
|
522
|
+
item's first-line baseline (matches render-tag's number baseline; bullets
|
|
523
|
+
are close). */
|
|
524
|
+
.ql-editor li::before {
|
|
525
|
+
position: absolute;
|
|
526
|
+
inset-inline-start: 0;
|
|
527
|
+
top: 0;
|
|
528
|
+
box-sizing: border-box;
|
|
529
|
+
width: 2.1em;
|
|
530
|
+
text-align: end;
|
|
531
|
+
font-weight: normal;
|
|
532
|
+
font-style: normal;
|
|
533
|
+
}
|
|
534
|
+
.ql-editor li[data-list='ordered']::before {
|
|
535
|
+
content: counter(list-0) '.';
|
|
536
|
+
/* Exact render-tag number gap (space-width) computed per element; 0.32em
|
|
537
|
+
fallback until the vars are set (or on layout failure). */
|
|
538
|
+
padding-inline-end: var(--rt-number-gap, 0.32em);
|
|
539
|
+
}
|
|
540
|
+
.ql-editor li.ql-indent-1[data-list='ordered']::before {
|
|
541
|
+
content: counter(list-1) '.';
|
|
542
|
+
}
|
|
543
|
+
.ql-editor li.ql-indent-2[data-list='ordered']::before {
|
|
544
|
+
content: counter(list-2) '.';
|
|
545
|
+
}
|
|
546
|
+
.ql-editor li.ql-indent-3[data-list='ordered']::before {
|
|
547
|
+
content: counter(list-3) '.';
|
|
548
|
+
}
|
|
549
|
+
.ql-editor li[data-list='bullet']::before {
|
|
550
|
+
content: '•';
|
|
551
|
+
padding-inline-end: 0.5em; /* fallback gap (RTL, or before vars are set) */
|
|
552
|
+
}
|
|
553
|
+
/* LTR: pixel-match render-tag's synthetic disc. The canvas scales the '•'
|
|
554
|
+
glyph to ink-diameter ascent/3 and pins its ink-right edge / vertical
|
|
555
|
+
center; computeMarkerVars asks render-tag for the exact numbers and sets
|
|
556
|
+
them here. Gated on .rt-marker-geom (LTR + vars computed) so RTL and the
|
|
557
|
+
pre-measure frame keep the box+text-align fallback above. */
|
|
558
|
+
&.rt-marker-geom .ql-editor li[data-list='bullet']::before {
|
|
559
|
+
inset-inline-start: var(--rt-bullet-left);
|
|
560
|
+
top: var(--rt-bullet-top);
|
|
561
|
+
font-size: var(--rt-bullet-fs);
|
|
562
|
+
line-height: 1;
|
|
563
|
+
width: auto;
|
|
564
|
+
padding-inline-end: 0;
|
|
565
|
+
text-align: left;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
strong {
|
|
569
|
+
font-weight: 700;
|
|
570
|
+
}
|
|
571
|
+
.ql-direction-rtl {
|
|
572
|
+
direction: rtl;
|
|
573
|
+
}
|
|
574
|
+
/* Apply gradient fill to all text-bearing elements when --polotno-gradient is set */
|
|
575
|
+
&[style*='--polotno-gradient'] .ql-editor,
|
|
576
|
+
&[style*='--polotno-gradient'] .ql-editor p,
|
|
577
|
+
&[style*='--polotno-gradient'] .ql-editor li,
|
|
578
|
+
&[style*='--polotno-gradient'] .ql-editor li::before {
|
|
579
|
+
background-image: var(--polotno-gradient);
|
|
580
|
+
background-size: 100% 100%;
|
|
581
|
+
background-repeat: repeat;
|
|
582
|
+
-webkit-background-clip: text;
|
|
583
|
+
-moz-background-clip: text;
|
|
584
|
+
background-clip: text;
|
|
585
|
+
-webkit-text-fill-color: transparent;
|
|
586
|
+
color: transparent;
|
|
587
|
+
}
|
|
588
|
+
/* A span carrying its own solid color must win over the gradient: the
|
|
589
|
+
transparent -webkit-text-fill-color above is INHERITED, so without this
|
|
590
|
+
the span paints the clipped gradient instead of its chosen color
|
|
591
|
+
(mirrors getHtml's markInlineColorsForClip on the canvas side). */
|
|
592
|
+
&[style*='--polotno-gradient'] .ql-editor [style*='color:'] {
|
|
593
|
+
-webkit-text-fill-color: currentColor;
|
|
594
|
+
}
|
|
595
|
+
`,RU=[`background`,`font-weight`,`color`,`gradient`,`font`,`italic`,`size`,`script`,`strike`,`underline`,`indent`,`list`,`direction`],zU=!1;function BU(){zU||(zU=!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 VU(e){return e?`700`:`400`}var HU=(e,t)=>{nU();let n=new XH(e,{toolbar:!1,keyboard:!1,placeholder:t?.placeholder||void 0,clipboard:{matchVisual:!1},formats:RU});(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`?(BU(),t(`font-weight`,VU(n),r)):t(e,n,r),e.formatText=(e,t,r,i,a)=>{if(r&&typeof r==`object`){if(`bold`in r){BU();let{bold:a}=r,o=EU(r,[`bold`]);return n(e,t,Object.assign(Object.assign({},o),{"font-weight":VU(a)}),i)}return n(e,t,r,i)}return r===`bold`?(BU(),n(e,t,`font-weight`,VU(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=Db(t[`font-weight`])),t}})(n);let r=XH.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},UU=(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()},WU=({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=HU(i.current,{placeholder:gj(n.placeholder)}),pr(()=>{DU.editor.instance=o}),DU.pendingToolbarInteraction=!1,window.__polotnoQuill=o,oU({instance:o,store:n.store,element:n});let s=e=>{e&&kU(o,e)};o.on(`text-change`,()=>{let e=aU(),r=e&&e.instance===o?e.lastSelection:null;s(o.getSelection()||r),setTimeout(()=>{let e=o.root;if(!e||!e.isConnected||!Yh(n))return;let r=e.innerHTML;a.current=!0,t(BA(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===`
|
|
596
|
+
`)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=ED(n,n.fontFamily);UU(o,p),a.current=!0;let m=i.current.closest(`.polotno-workspace-inner`),h=m?.scrollLeft,g=m?.scrollTop;r?KU(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`)||(GU(n)||DU.pendingToolbarInteraction?jU():setTimeout(()=>{DU.pendingToolbarInteraction||GU(document.activeElement)?jU():(MU(),e())},0))},f=()=>{MU()},_.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),MU(),c&&l&&u&&(c.removeEventListener(`copy`,l),c.removeEventListener(`cut`,u)),pr(()=>{DU.editor.instance=null,DU.currentFormat={}}),cU(o),delete window.__polotnoQuill}},[]),k.useEffect(()=>FA(n,()=>`${n.text}\0${n.fontSize}\0${n.fontFamily}`,()=>{let e=DU.editor.instance;if(!e)return;if(a.current){a.current=!1;return}let t=e.getSelection();UU(e,ED(n,n.fontFamily)),a.current=!0,t&&(e.setSelection(t.index,t.length),kU(e,e.getSelection()))},{fireImmediately:!0}),[]),k.useEffect(()=>FA(n,()=>`${n.fontFamily}\0${n.fontSize}\0${n.fontWeight}\0${n.fontStyle}\0${n.lineHeight}\0${n.letterSpacing}\0${sD(Yb(n.text))}`,()=>{let e=i.current;if(!e)return;let t=sD(Yb(n.text))===`ltr`,r=IU(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)||GU(r)||DU.pendingToolbarInteraction||(MU(),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 ${lC(n.stroke)}`,o.paintOrder=`stroke fill`);let s=aC(n.fill)?lC(n.fill):hj(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)(LU,{ref:i,style:Object.assign(Object.assign({},o),{fontSize:n.fontSize,fontFamily: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 ${IC(n.shadowColor,n.shadowOpacity??1)}`:void 0,caretColor:s}),dir:sD(Yb(n.text))})};function GU(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 KU(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=XH.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 qU(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 JU=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),YU=navigator.userAgent.includes(`Firefox`),XU=V(({element:e,store:t})=>{let{textOverflowIndicatorStyle:n}=_h(),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=Tj(f),m=e.fontSize/3,{textVerticalResizeEnabled:h}=Ey,g=Ey.autoDeleteEmptyText,_=Tj(e.fontFamily),v=k.useMemo(()=>Rb(e.text,{fontSize:e.fontSize,fontFamily:e.fontFamily}),[e.text,e.fontSize,e.fontFamily]),[y]=Cj(t,k.useMemo(()=>[...new Set([e.fontFamily,...zb(v)])].filter(Boolean),[e.fontFamily,v]),e.fontStyle,e.fontWeight,e.text||e.placeholder),b=e._editModeEnabled;nb(r);let x=y?e.fontFamily:_===e.fontFamily?`Arial`:_,S=IA(e).fill,C=DD(e,{fontFamily:x,color:S,textOverflow:Ey.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(()=>CO(e),[e,t.width,n])}(C,e,y);k.useEffect(()=>{if(!y)return;let n=(n,r,i,a)=>{let o=ub(`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(Yh(e)&&Math.abs(D-e.width)>1){let t=e.x+e.width/2;e.set({width:D,x:t-D/2})}},!1,!0),!Wb(e)){n(()=>{Yh(e)&&(Wb(e)||e.set({height:O}))},void 0,void 0,!0);return}let{textOverflow:r}=Ey;if(r!==`change-font-size`||o||b||e.curveEnabled)r===`resize`&&(h&&e.height<O&&!o&&n(()=>{Yh(e)&&e.set({height:O})},!1,!0),h||e.height===O||o||n(()=>{Yh(e)&&e.set({height:O})},!1,!0));else{let t=yM(e,{fontFamily:e.fontFamily,textOverflow:Ey.textOverflow});t.fontSize===e.fontSize?e.height!==O&&(h&&e.height<O?n(()=>{Yh(e)&&e.set({height:O})},!1,!0):h||n(()=>{Yh(e)&&e.set({height:O})},!1,!0)):n(()=>{if(!Yh(e))return;let n=ej(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 vM(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=ub(`text ${e.id} ${n}`);M.current&&M.current(),M.current=r,u(!0);let i=null,o=JU?5:1;for(let r=0;r<o;r++){let a=r>0?ee:vM;try{if(i=await a({skipCache:r>0,html:C,width:D||e.width||1,height:Jb(e,O)||1,fontFamily:x,fontFamilies:zb(C),resolveFont:e=>t.fonts.find(t=>t.fontFamily===e)||Nx.find(t=>t.fontFamily===e),padding:m,pixelRatio:t._elementsPixelRatio,font:t.fonts.find(e=>e.fontFamily===x)||Nx.find(e=>e.fontFamily===x)}),n!==A.current)return;if((JU||YU)&&i&&qU(i)){await new Promise(e=>setTimeout(e,50*(r+1)));continue}break}catch(t){console.error(t),hb(`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]=kj(l,300),[P]=kj(o,300,!0),F=P||te;k.useEffect(()=>{var t;if(!F)return PA(e,()=>{let t=r.current;uj(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:uD(e.a.width,e.a.height,e.curvePower,e.a.fontSize),text:Yb(e.text),letterSpacing:e.letterSpacing*e.a.fontSize,fontSize:e.a.fontSize,fontFamily: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(()=>{Yh(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&&Yb(e.text)===``&&e.removable&&!gj(e.placeholder)&&t.deleteElements([e.id])},[g,e.placeholder,e.removable,e.text,f,p]);let ne=Jb(e,O),re=0;e.verticalAlign===`middle`&&(re=(ne-O)/2),e.verticalAlign===`bottom`&&(re=ne-O);let I=wj({fontLoaded:y,fontFamily:e.fontFamily,fontSize:e.fontSize,lineHeight:e.lineHeight}),L=e.backgroundPadding*(e.fontSize*I*.5),R=e.backgroundCornerRadius*(e.fontSize*I*.5),ie=k.useMemo(()=>{if(!e.backgroundEnabled||e.curveEnabled||e.legacyBackground)return``;let t=TO(C);return t.length===0?``:vO({rects:t.map(e=>({left:e.left+m,right:e.right+m,top:e.top+m,bottom:e.bottom+m})),padding:L,cornerRadius:R})},[e.backgroundEnabled,e.curveEnabled,e.legacyBackground,C,y,L,R,m]),ae=dj(),oe=uD(e.a.width,O,e.curvePower,e.fontSize),se=k.useRef(null),z=k.useRef(e.width),ce=k.useRef(``),le=k.useRef(0),ue=k.useRef(0),de=k.useRef(null),fe=b&&e.strokeWidth>0&&!e.curveEnabled,pe=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)(zm,{x:e.a.x,y:e.a.y,offsetX:L/pe,offsetY:L/pe,rotation:e.a.rotation,scaleX:pe,scaleY:pe,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled,opacity:e.backgroundOpacity*e.a.opacity,fill:e.backgroundColor,width:e.width+2*L,height:ne+2*L,cornerRadius:R}):(0,j.jsx)(Gm,{name:`html-background`,x:e.a.x,y:e.a.y,offsetX:m/pe,offsetY:(m-re)/pe,rotation:e.a.rotation,scaleX:pe,scaleY:pe,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled&&ie.length>0,opacity:e.backgroundOpacity*e.a.opacity,fill:e.backgroundColor,data:ie}),(0,j.jsx)(Gm,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,data:oe,stroke:n.stroke,strokeWidth:1,visible:!1}),(0,j.jsx)(zm,{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:ae?e.draggable&&f:e.draggable,preventDefault:!ae||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&&(de.current={x:t.evt.clientX,y:t.evt.clientY},e.toggleEditMode(!0))},onDblTap:t=>{if(e.contentEditable){let n=t.evt.changedTouches?.[0];de.current=n?{x:n.clientX,y:n.clientY}:null,e.toggleEditMode(!0)}},onTransformStart:t=>{c(!0),d.current=e.height,z.current=e.width,se.current=t.target.position(),ce.current=JA(t.target),le.current=e.a.rotation,ue.current=e.height},onTransform:t=>{let n=t.target,r=ce.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=XA(z.current,e.fontSize),a=r;r<i&&(a=i,se.current&&n.position(se.current)),n.width(a),n.scaleX(1),n.scaleY(1);let o=CO(DD(Object.assign(Object.assign({},e.toJSON()),{width:a}),{fontFamily:x,color:S,textOverflow:Ey.textOverflow})).height,s=Ey.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=Ey.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),se.current){if(ce.current===`top-center`){let e=le.current*Math.PI/180,t=ue.current-i;n.x(se.current.x-t*Math.sin(e)),n.y(se.current.y+t*Math.cos(e))}else n.position(se.current)}}else n.height(a);n.scaleY(1),n.scaleX(1),ue.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:Bb(e.text,o)});se.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({},tj(e,e.fontSize*n)),{width:t.target.width()*n,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),text:Bb(e.text,n)}))}}),(0,j.jsx)(Hm,{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||fe)&&(0,j.jsx)(`Group`,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,offsetY:-re,children:(0,j.jsx)(MA,{divProps:{style:{pointerEvents:`none`}},children:(0,j.jsx)(LU,{dangerouslySetInnerHTML:{__html:C},style:{pointerEvents:`none`,opacity:e.a.opacity,textShadow:e.shadowEnabled?`${e.shadowOffsetX}px ${e.shadowOffsetY}px ${e.shadowBlur}px ${IC(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)(MA,{divProps:{style:{zIndex:20}},children:(0,j.jsx)(WU,{element:e,onChange:t=>{let n=fj({oldText:Yb(e.text),newText:Yb(t),element:e});e.set(Object.assign({text:t},ej(e,n)))},onBlur:t=>{Yh(e)&&(e.set(nj(e)),e.toggleEditMode(!1),N(!0))},clickCoords:de.current})})})]})}),ZU=(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=>Ux(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=ub(`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]},QU=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},$U=V(({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=Tj(s),{textVerticalResizeEnabled:l}=Ey,u=Ey.autoDeleteEmptyText,d=Tj(e.fontFamily),f=k.useMemo(()=>Rb(e.text,{fontSize:e.fontSize,fontFamily:e.fontFamily}),[e.text,e.fontSize,e.fontFamily]),[p]=ZU(t,k.useMemo(()=>HA(f,{fontFamily:e.fontFamily,fontWeight:e.fontWeight,fontStyle:e.fontStyle}),[f,e.fontFamily,e.fontWeight,e.fontStyle]),e.text||e.placeholder),m=e._editModeEnabled;nb(n);let h=p?e.fontFamily:d&&d!==e.fontFamily?d:`Arial`,g=IA(e).fill,_=aC(e.fill),v=aC(e.stroke)&&!!e.strokeWidth,y=!!e.strokeWidth&&(v||_),b=Ey.textOverflow===`ellipsis`&&!e.curveEnabled&&Wb(e)&&!y,x=gj(e.placeholder),S=!Yb(e.text)&&!!x,C=S?rD(x):e.text,w=S?.6:e.a.opacity,T=DD(S?Object.assign(Object.assign({},e.toJSON()),{text:C}):e,{fontFamily:h,color:g,forEditor:!b,textOverflow:Ey.textOverflow}),E=e.width||1,D=e.curveEnabled,O=function(e,t,n,r){return k.useMemo(()=>{if(r)return null;try{return QH({html:nD(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=uD(t.width||1,bD(t),t.curvePower,t.fontSize);try{return NE({html:nD(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=wj({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(!0),[,ne]=k.useReducer(e=>e+1,0);k.useEffect(()=>{let e=P.current;e.length>0&&(P.current=[],e.forEach(e=>e()))});let re=k.useCallback((n,r,i,a)=>{let o=ub(`text ${e.id}`),s=()=>{t.history.ignore(n,r,i).then(()=>{F.current?(P.current.push(o),ne()):o()})};a?queueMicrotask(s):s()},[e.id,t]);k.useEffect(()=>{if(!p||!O)return;if(!Wb(e)){re(()=>{Yh(e)&&(Wb(e)||e.set({height:M}))},void 0,void 0,!0);return}if(t.isPlaying)return;let{textOverflow:n}=Ey,r=e.height!==M&&(!l||e.height<M),a=()=>re(()=>{Yh(e)&&e.set({height:M})},!1,!0);if(n!==`change-font-size`||i||m||e.curveEnabled)n===`resize`&&r&&!i&&a();else{let t=yM(S?Object.assign(Object.assign({},e.toJSON()),{text:C,toJSON:()=>Object.assign(Object.assign({},e.toJSON()),{text:C})}):e,{fontFamily:h,color:g,forEditor:!0},e=>{try{return QH({html:nD(e),width:E,accuracy:`performance`}).height}catch{return CO(e).height}});t.fontSize===e.fontSize?r&&a():re(()=>{if(!Yh(e))return;let n=ej(e,t.fontSize);t.text!==void 0&&t.text!==e.text&&(n.text=t.text),e.set(n)},!1,!0)}}),k.useEffect(()=>()=>{F.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||re(()=>{if(!Yh(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,re]),k.useEffect(()=>{c&&!s&&u&&Yb(e.text)===``&&e.removable&&!gj(e.placeholder)&&t.deleteElements([e.id])},[u,e.placeholder,e.removable,e.text,s,c]),k.useEffect(()=>PA(e,()=>{let t=n.current;t&&uj(t,e)}),[O,ee,e.a.width,e.a.height,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]);let I=Jb(e,M),L=0;D||e.verticalAlign!==`middle`?D||e.verticalAlign!==`bottom`||(L=I-M):L=(I-M)/2;let R=e.backgroundPadding*(e.fontSize*A*.5),ie=e.backgroundCornerRadius*(e.fontSize*A*.5),ae=k.useMemo(()=>!e.backgroundEnabled||e.curveEnabled||e.legacyBackground||N.length===0?``:vO({rects:N,padding:R,cornerRadius:ie}),[e.backgroundEnabled,e.curveEnabled,e.legacyBackground,N,R,ie]),oe=dj(),se=k.useRef(null),z=k.useRef(e.width),ce=k.useRef(null),le=k.useRef(null),ue=k.useRef(``),de=k.useRef(0),fe=k.useRef(0),pe=e.width>0?e.a.width/e.width:1;return(0,j.jsxs)(j.Fragment,{children:[e.curveEnabled||e.legacyBackground?(0,j.jsx)(zm,{x:e.a.x,y:e.a.y,offsetX:R/pe,offsetY:R/pe,rotation:e.a.rotation,scaleX:pe,scaleY:pe,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled,opacity:e.backgroundOpacity*w,fill:e.backgroundColor,width:e.width+2*R,height:I+2*R,cornerRadius:ie}):(0,j.jsx)(Gm,{name:`rendertag-background`,x:e.a.x,y:e.a.y,offsetY:-L/pe,rotation:e.a.rotation,scaleX:pe,scaleY:pe,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled&&ae.length>0,opacity:e.backgroundOpacity*w,fill:e.backgroundColor,data:ae}),(0,j.jsx)(Km,{ref:n,name:`rendertag-text`,x:e.a.x,y:e.a.y,rotation:e.a.rotation,scaleX:pe,scaleY:pe,offsetY:pe>0?-L/pe:0,width:e.width,height:Math.max(e.height,M),listening:!1,visible:!m&&!!(D?ee:O),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),PE({layout:ee,ctx:r}),r.restore()}else{if(!O)return;$H({layout:O,width:E,ctx:r,pixelRatio:1})}}catch(e){console.error(`render-tag draw failed:`,e)}}}),(0,j.jsx)(zm,{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:!m,draggable:oe?e.draggable&&s:e.draggable,preventDefault:!oe||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&&(le.current={x:t.evt.clientX,y:t.evt.clientY},e.toggleEditMode(!0))},onDblTap:t=>{if(e.contentEditable){let n=t.evt.changedTouches?.[0];le.current=n?{x:n.clientX,y:n.clientY}:null,e.toggleEditMode(!0)}},onTransformStart:t=>{a(!0),o.current=e.height,z.current=e.width,ce.current=null,se.current=t.target.position(),ue.current=JA(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`,s=n.scaleX();if(i){let t=n.scaleX(),r=n.width()*t,i=Math.max(r,XA(z.current,e.fontSize)),a=e.toJSON(),s=0;if(e.curveEnabled)s=bD(Object.assign(Object.assign({},a),{width:i}));else{let{x:e,y:t,width:n,height:r}=a,o=QU(a,[`x`,`y`,`width`,`height`]),c=`${JSON.stringify(o)}|${h}|${p}|${g}`;if(ce.current&&ce.current.signature===c&&i<=ce.current.width)i=ce.current.width,s=ce.current.height;else{let e=e=>{let t=DD(Object.assign(Object.assign({},a),{text:C,width:e}),{fontFamily:h,color:g,forEditor:!0});try{return QH({html:nD(t),width:e,accuracy:`performance`})}catch{return{height:CO(t).height,lines:[]}}},t=e(i),n=Math.max(0,...t.lines.map(e=>e.bounds.x+e.bounds.width));n>i+.5&&n<=z.current+.5&&(i=Math.min(Math.ceil(n),z.current),t=e(i),ce.current={signature:c,width:i,height:t.height}),s=t.height}}i>r&&se.current&&n.position(se.current),n.width(i),n.scaleX(1),n.scaleY(1);let c=Ey.textVerticalResizeEnabled?Math.max(s,o.current):s;Ey.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=Ey.textOverflow===`resize`?D?te?.height||e.fontSize:M:A*e.fontSize,r=n.height()*n.scaleY();if(r<t){if(n.height(t),se.current){if(ue.current===`top-center`){let e=de.current*Math.PI/180,r=fe.current-t;n.x(se.current.x-r*Math.sin(e)),n.y(se.current.y+r*Math.cos(e))}else n.position(se.current)}}else n.height(r);n.scaleY(1),n.scaleX(1),fe.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:Bb(e.text,s)});se.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({},tj(e,e.fontSize*n)),{width:t.target.width()*n,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),text:Bb(e.text,n)}))}}),m&&(0,j.jsx)(`Group`,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,offsetY:-L,children:(0,j.jsx)(MA,{divProps:{style:{zIndex:20}},children:(0,j.jsx)(WU,{element:e,onChange:t=>{let n=fj({oldText:Yb(e.text),newText:Yb(t),element:e});e.set(Object.assign({text:t},ej(e,n)))},onBlur:()=>{Yh(e)&&(e.set(nj(e)),e.toggleEditMode(!1))},clickCoords:le.current})})})]})}),eW=({targetKonvaNodes:e,guideKonvaNode:t,distance:n,snapDirection:r})=>n<5;function tW(e,t){var n=[],r=[];e.vertical.forEach(e=>{t.vertical.forEach(t=>{var r=Math.abs(e.offset-t.guide);eW({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);eW({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 nW=()=>{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 rW(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 iW(e,t,n){let r=e?.children.find(e=>e.name()===`line-guides`),i=e.getStage();n.forEach(e=>{e.orientation===`H`?r?.add(rW(i,t,[-6e3,e.lineGuide,6e3,e.lineGuide])):e.orientation===`V`&&r?.add(rW(i,t,[e.lineGuide,-6e3,e.lineGuide,6e3]))})}function aW(e,t){let n=k.useRef(null),r=k.useRef(null),i=k.useRef(new Map),a=k.useRef(null),{snapGuideStyle:o}=_h(),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){iW(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(rW(t.getStage(),c.current,[f.x-6e3*e,f.y-6e3*r,f.x+6e3*e,f.y+6e3*r]))}return}var l=tW(u(e.target.nodes()),function(e){let t=e.__getNodeRect(),n=bk(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=cW[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=sW(e,t)/sW(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=tW(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(()=>{nW()})}),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 oW(e,t,n){let{snapGuideStyle:r}=_h(),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=tW(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){iW(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 sW(e,t){return e.x*t.x+e.y*t.y}var cW={"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 lW(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 uW(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 dW=(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()}}},fW=V(({element:e,type:t})=>{let n=IA(e,e.a.color,`fill`),r=IA(e,e.a.color,`stroke`),i=ew(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)(Bm,Object.assign({x:i.cx,y:i.cy,radius:i.r},a)):(0,j.jsx)(Vm,Object.assign({points:i.points.flat(),closed:i.filled},a))}),pW=V(({element:e,store:t})=>{let{transformerStyle:n}=_h(),r=k.useRef(null),i=k.useRef(null),a=k.useRef(null),o=e.selectable||t.role===EA.ADMIN,s=dj(),c=t.selectedElements.indexOf(e)>=0&&t.selectedElements.length===1,l=e.isSelected,{middleLeft:u,middleRight:d}=lW(e);oW(i,[r],[c]),oW(a,[r],[c]);let f=IA(e,e.a.color,`stroke`);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Vm,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)(Lm,{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)(fW,{element:e,type:e.startHead})}),(0,j.jsx)(Lm,{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)(fW,{element:e,type:e.endHead})}),c&&e.resizable&&(0,j.jsx)(NA,{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`},dW(t.scale,t,n),{onDragMove:t=>{let n=uW(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`},dW(t.scale,t,n),{onDragMove:t=>{let n=uW(u,t.target.position(),e.height);e.set({x:n.x,y:n.y,width:n.width,rotation:n.rotation})}}))]})})]})}),mW=e=>{let t=k.useRef(e);return t.current=e,k.useCallback((...e)=>t.current(...e),[])};function hW(e){return Promise.resolve(e.play()).then(()=>`started`,e=>e?.name===`NotAllowedError`?`refused`:`interrupted`)}function gW(){let e=!1,t=0;return{play(n){if(e)return;let r=t;hW(n).then(n=>{n===`refused`&&r===t&&(e=!0)})},reset(){t+=1,e=!1}}}function _W(e,t){let n=vW(e);return n>0&&t>=e.timestamp&&t<e.timestamp+n}function vW(e){let t=e.duration??0;return Number.isFinite(t)&&t>0?t:0}var yW=(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=ub(`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 rS(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}`;hb(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:vW(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||_W(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&&_W(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),_W(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=PA(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||=ub(`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 bW(){return document.createElement(`canvas`)}var xW=new window.Image;xW.src=LC(`
|
|
597
|
+
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
598
|
+
<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"/>
|
|
599
|
+
<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"/>
|
|
600
|
+
</svg>
|
|
601
|
+
`);var SW=new window.Image;SW.src=LC(`
|
|
602
|
+
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
603
|
+
<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"/>
|
|
604
|
+
<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"/>
|
|
605
|
+
<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"/>
|
|
606
|
+
<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"/>
|
|
607
|
+
</svg>
|
|
608
|
+
`);var CW=(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&&Ey.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:bW()},[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?function(e,t){var n,r;let i=bW(),a=e instanceof HTMLVideoElement?e.videoWidth:e.width,o=e instanceof HTMLVideoElement?e.videoHeight:e.height;i.width=a,i.height=o,(n=i.getContext(`2d`))==null||n.drawImage(e,0,0,i.width,i.height);let s=function(e,t,n,r,i,a,o){for(var s=new ImageData(t,n),c=new Int32Array(e.data.buffer),l=e.width,u=new Int32Array(s.data.buffer),d=s.width,f=t/a,p=n/o,m=Math.round(1/f),h=Math.round(1/p),g=m*h,_=0;_<s.height;_++)for(var v=0;v<d;v++){for(var y=0+Math.round(v/f)+(0+Math.round(_/p))*l,b=0,x=0,S=0,C=0,w=0;w<h;w++)for(var T=0;T<m;T++){var E=c[y+T+w*l];b+=E<<24>>>24,x+=E<<16>>>24,S+=E<<8>>>24,C+=E>>>24}b=Math.round(b/g),x=Math.round(x/g),S=Math.round(S/g),C=Math.round(C/g),u[v+_*d]=C<<24|S<<16|x<<8|b}return s}(i.getContext(`2d`).getImageData(0,0,i.width,i.height),Math.floor(i.width*t),Math.floor(i.height*t),0,0,i.width,i.height);return i.width=Math.floor(i.width*t),i.height=Math.floor(i.height*t),(r=i.getContext(`2d`))==null||r.putImageData(s,0,0),i}(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]},wW=bW(),TW=V(({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}=_h();return(0,j.jsxs)(Lm,{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)(zm,{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})]})}),EW=V(({element:e})=>{let{mediaErrorStyle:t}=_h(),n=Math.max(10,Math.min(30,e.width/25));return(0,j.jsxs)(Lm,{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)(zm,{width:e.width,height:e.height,fill:t.fill}),(0,j.jsx)(Um,{text:`Can not load the video...`,fontSize:n,width:e.width,height:e.height,align:`center`,fill:t.textFill,verticalAlign:`middle`,padding:5})]})}),DW=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 OW(e){return e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA}var kW=(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=ub(s)),e!==`loading`&&i(),e===`failed`&&hb(o(`VIDEO_FAILED`,s,{src:a,elementId:n,reason:`load`}))},[e])},AW=V(({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]=DW(e.src,`anonymous`),[f,p]=k.useState(!1),g=t.activePage===e.page,_=e.page?._exportingOrRendering&&d===`loaded`,v=yW(e,t,_);kW(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`||e.src.indexOf(`data:image/svg+xml`)>=0||e.src.indexOf(`.svg`)>=0,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=bW(),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=wW,x]=Oj(e,_&&v||y||wW);k.useEffect(()=>{u&&t.history.ignore(()=>{e.set({duration:1e3*u.duration})})},[u]);let S=k.useMemo(gW,[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,hW(u).then(e=>{e===`refused`&&l(!1)}));let a=new s.Animation(()=>{R()},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=PA(e,()=>{var n;if(u){if(_&&v){R(),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),!OW(u)&&!t.isPlaying&&!C.current&&(C.current=ub(`video ${e.id}`)))),R(),(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;!OW(u)&&(t=e.page)!=null&&t._exportingOrRendering||(C.current&&=(R(),(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,ub,_]);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=YC({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]=CW(e,b,M,t._elementsPixelRatio,F,!0),[I,L]=((e,t,n,r)=>{let i=(e=>{let[t,n]=k.useState(e);return k.useEffect(()=>{(async()=>{let r=await async function(e){return e.indexOf(`data:image/svg+xml`)>=0||e.indexOf(`.svg`)>=0?LC(BC(await FC(e))):e}(e);r!==t&&n(r)})()},[e]),t})(e.clipSrc||``),[a,o]=(0,Xm.default)(i,`anonymous`);kW(e.clipSrc?o:`loaded`,e.clipSrc,e.id);let c=k.useMemo(()=>{if(t&&a)return bW()},[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=bW(),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]),R=mW(()=>{var e;x(),re(),L(),(e=i.current?.getLayer())==null||e.batchDraw()});k.useEffect(()=>{R()});let ie=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 ae=k.useRef(null),oe=k.useRef(null),se=k.useRef(null);k.useLayoutEffect(()=>{e._cropModeEnabled&&(oe.current.nodes([ae.current]),se.current.nodes([a.current]))},[e._cropModeEnabled]);let z=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})},ce=()=>{e.type!==`svg`&&e.contentEditable&&setTimeout(()=>{Yh(e)&&e.toggleCropMode(!0)})},le=d===`loading`,ue=d===`failed`,de=!le&&!ue,fe=k.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),pe=k.useRef(!1),me=de?e.a.opacity:0;nb(i,me);let he=e.selectable||t.role===EA.ADMIN,ge=dj();return(0,j.jsx)(j.Fragment,{children:(0,j.jsxs)(Lm,{onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:[le&&(0,j.jsx)(TW,{element:e}),ue&&(0,j.jsx)(EW,{element:e}),(0,j.jsx)(Hm,{ref:i,name:`element`,id:e.id,image:I,x:e.a.x,y:e.a.y,width:e.a.width||1,height:e.a.height||1,rotation:e.a.rotation,opacity:me,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:M,listening:he,draggable:ge?e.draggable&&o:e.draggable,preventDefault:!ge||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:ce,onDblTap:ce,onTransformStart:t=>{r(!0),pe.current=YA(JA(t.target)),fe.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=pe.current,u=!l&&r<1&&fe.current.cropHeight>N/A,d=l?e.cropWidth:e.cropWidth*r;u&&(d=e.cropWidth);let f=!l&&i<1&&fe.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({},QA(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},$A(e)),{borderSize:qA(e.borderSize)})),r(!1)}}),(0,j.jsx)(zm,{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:me,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||ge?SW:void 0:xW,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)(NA,{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:I,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:ie,scaleY:ie,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:z,onTransform:z}),(0,j.jsx)(`Transformer`,{ref:se,anchorSize:20,enabledAnchors:[`top-left`,`top-right`,`bottom-left`,`bottom-right`],boundBoxFunc:(e,t)=>t.width<5||t.height<5?e:t,rotateEnabled:!1,borderEnabled:!1,anchorCornerRadius:10,anchorStrokeWidth:2,borderStrokeWidth:2}),(0,j.jsx)(`Rect`,{width:te,height:N,ref:ae,listening:!1,onTransform:t=>{t.target.x()<-e.cropX*O-1e-9&&(t.target.x(-e.cropX*O),t.target.scaleX(1)),t.target.y()<-e.cropY*A-1e-9&&(t.target.y(-e.cropY*A),t.target.scaleY(1));let n=Math.min(1,Math.max(0,e.cropX+t.target.x()/O)),r=Math.min(1,Math.max(0,t.target.y()/A+e.cropY)),i=t.target.width()*t.target.scaleX(),a=t.target.height()*t.target.scaleY(),o=Math.min(1-n,i/O),s=Math.min(1-r,a/A),c=t.target.getAbsolutePosition(t.target.getParent().getParent());t.target.scale({x:1,y:1}),t.target.position({x:0,y:0}),e.set({x:c.x,y:c.y,cropX:n,cropY:r,cropWidth:o,cropHeight:s,width:Math.min(i*ie,O*(1-n)*ie),height:Math.min(a*ie,A*(1-r)*ie)})}}),(0,j.jsx)(`Transformer`,{ref:oe,enabledAnchors:[`top-left`,`top-right`,`bottom-left`,`bottom-right`],boundBoxFunc:(e,t)=>t.width<5||t.height<5?e:t,keepRatio:!1,rotateEnabled:!1,anchorFill:`rgb(240, 240, 240)`,anchorStrokeWidth:2,borderStrokeWidth:2,visible:e.resizable})]})]})]})})}),jW={},MW=V(({element:e,store:t})=>{let n=k.useRef(null),r=k.useRef(!1),i=e.selectable||t.role===EA.ADMIN,a=dj(),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=IA(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=IA(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,jW[h]||(jW[h]=(g=vw(h),V(({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)}))})]})}))),jW[h]||`Group`);var h,g;return(0,j.jsx)(j.Fragment,{children:(0,j.jsx)(Lm,{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=YA(JA(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({},QA(e,i)),{strokeWidth:e.strokeWidth*i})))},onTransformEnd:()=>{e.set(Object.assign(Object.assign({},$A(e)),{strokeWidth:qA(e.strokeWidth)}))},children:(0,j.jsx)(m,{element:e,fillProps:u,strokeProps:f,hitStrokeWidth:p})})})}),NW=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}}})),PW=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},{})}}})),FW=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=NW(),n=PW(),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})}]})),IW=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}})),LW=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}})),RW=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.decompressFrames=e.decompressFrame=e.parseGIF=void 0;var t=o(FW()),n=NW(),r=PW(),i=IW(),a=LW();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 zW(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 BW=V(({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}=_h();return(0,j.jsxs)(Lm,{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)(zm,{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})]})}),VW=V(({element:e})=>{let{mediaErrorStyle:t}=_h(),n=Math.max(10,Math.min(30,e.width/22));return(0,j.jsxs)(Lm,{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)(zm,{width:e.width,height:e.height,fill:t.fill}),(0,j.jsx)(Um,{text:`Cannot load the GIF...`,fontSize:n,width:e.width,height:e.height,align:`center`,fill:t.textFill,verticalAlign:`middle`,padding:5})]})}),HW=V(({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,RW.parseGIF)(t),a=(0,RW.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);Wj(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`);zW(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;zW(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&&(zW(l[t],n,r),C(),o.current.getLayer().draw(),a=t)};if(t.isPlaying||e.page?._exportingOrRendering)return PA(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]=Oj(e,c.current),[x,S]=CW(e,y,_,t._elementsPixelRatio,v,n||e._cropModeEnabled),C=mW(()=>{b(),S()}),w=f===`loading`,T=f===`failed`,E=w||T?0:e.a.opacity;nb(o,E);let D=e.selectable||t.role===EA.ADMIN,O=dj();return(0,j.jsxs)(j.Fragment,{children:[w&&(0,j.jsx)(BW,{element:e}),T&&(0,j.jsx)(VW,{element:e}),(0,j.jsx)(Hm,{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=YA(JA(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({},QA(e,o)),{borderSize:e.borderSize*o})))},onTransformEnd:()=>{e.set(Object.assign(Object.assign({},$A(e)),{borderSize:qA(e.borderSize)})),r(!1)}}),(0,j.jsx)(zm,{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})]})}),UW=`#0d83dd`,WW=(e,t)=>{let n=e.target.getStage();n&&(n.container().style.cursor=t)},GW=V(({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)(zm,{x:n,y:r,width:i,height:a,cornerRadius:Math.min(i,a)/2,fill:t?UW:`#9ca3af`,opacity:t?.55:.18,listening:!1}),(0,j.jsx)(zm,{x:o,y:s,width:c,height:l,fill:`transparent`,onMouseEnter:e=>{m({kind:d,idx:f}),WW(e,`pointer`)},onMouseLeave:e=>{m(null),WW(e,``)},onClick:p})]})),KW=V(({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)(Lm,{x:e,y:t,onMouseEnter:e=>{c({kind:r,idx:i}),WW(e,`pointer`)},onMouseLeave:e=>{c(null),WW(e,``)},onClick:e=>{e.cancelBubble=!0,s()},children:[(0,j.jsx)(zm,{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:UW,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})]})]})}),qW=V(({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)(GW,{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)(KW,{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)(GW,{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)(KW,{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})}),JW=V(({element:e,store:t})=>{let n=k.useRef(null),r=k.useRef(null),i=e.selectable||t.role===EA.ADMIN,a=dj(),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(()=>Xt.box(!1),[]);k.useEffect(()=>PA(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)(Vm,{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)(Vm,{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)(Vm,{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)(Vm,{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)(zm,{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:()=>{pr(()=>p.set(!0))},onTransformEnd:()=>{e._resetBaseRowHeights(),pr(()=>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)(Lm,{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)(zm,{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)(Dj,{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)(MA,{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,pr(()=>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(),pr(()=>p.set(!1)),t.history.endTransaction()}},`row-resize-${i}`))}return n})(),o&&!c&&!t.isPlaying&&(0,j.jsx)(qW,{element:e,store:t,inv:l,isTouch:a,hover:u,setHover:d})]})]})}),YW=V(({element:e})=>{let{highlighterStyle:t}=_h();return(0,j.jsx)(zm,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))}),XW={text:Dj,image:Gj,svg:Gj,line:pW,video:AW,figure:MW,group:V(e=>{let{element:t,store:n}=e,r=t,{children:i}=r,a=t.selectable||n.role===EA.ADMIN,o=r.a;return(0,j.jsx)(Lm,{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)(QW,Object.assign({},e,{key:t.id,store:n,element:t})))})}),gif:HW,table:JW},ZW=(e,t)=>{let n=[];uA(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}},QW=V(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=XW[e.element.type];return e.element.type===`text`&&(Ey.renderTagTextEnabled?g=$U:Ey.htmlRenderEnabled&&(g=XU)),e.element.visible?g?(0,j.jsxs)(Lm,{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)(YW,{element:t.type===`group`?{a:ZW(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 $W(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 eG(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 tG(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 nG(e,t){if(e.length===0)throw Error(`Cannot create SVG from empty path`);let n=t.smooth?$W(e):e,r=tG(n),i=t.strokeWidth,a=r.x-i,o=r.y-i,s=r.width+2*i,c=r.height+2*i;return{src:LC(`\n <svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${c}" viewBox="0 0 ${s} ${c}">\n <path\n d="${eG(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 rG=V(({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=nG(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)(Lm,{ref:p,listening:m,x:a+s*i,y:o+c*i,scaleX:i,scaleY:i,children:[(0,j.jsx)(zm,{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 iG(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 aG=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},oG=e=>Jm.batchedUpdates(e,null);ha(e=>{Jm.isAlreadyRendering()?queueMicrotask(()=>oG(e)):oG(e)});var sG=s.DD._drag;window.removeEventListener(`mousemove`,sG),s.DD._drag=function(e){pr(()=>{sG.call(this,e)})},window.addEventListener(`mousemove`,s.DD._drag);var cG={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},lG=e=>{let t=(e%180+180)%180;return t<.1||180-t<.1},uG=e=>{if(!e.length)return null;let t=lG(e[0].rotation)?0:e[0].rotation;return e.every(e=>lG(e.rotation-t))?t:null},dG=e=>e.selectedShapes.filter(e=>!e._cropModeEnabled),fG=(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},pG={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`]}},mG=e=>(0,j.jsx)(zm,Object.assign({},e,{preventDefault:!1})),hG=e=>{var{url:t}=e,n=aG(e,[`url`]);let[r,i]=(0,Xm.default)(t,`anonymous`),a=r?iG(r,{width:n.width,height:n.height},`center-middle`):{};return Wj(i,t,`page background`),(0,j.jsx)(Hm,Object.assign({image:r},n,a))},gG=e=>{let t=IA({a:{width:e.width,height:e.height},width:e.width,height:e.height},e.fill);return(0,j.jsx)(zm,Object.assign({},e,t))},_G=e=>{let{background:t,scale:n,borderColor:r,transparencyBackgroundColor:i}=e,a=aG(e,[`background`,`scale`,`borderColor`,`transparencyBackgroundColor`]),o=k.useMemo(()=>!!s.Util.colorToRGBA(t)||aC(t),[t]),c=k.useMemo(()=>{if(aC(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)(gG,Object.assign({fill:t},a)):(0,j.jsx)(hG,Object.assign({url:t},a))]})},vG=V(({selection:e})=>{let{selectionRectStyle:t}=_h();return e.visible?(0,j.jsx)(zm,{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 yG(e){let t=180*e/Math.PI;return t%=360,t>180?t-=360:t<-180&&(t+=360),Math.round(t)}var bG=V(({x:e,y:t,width:n,height:r,rotation:i,anchor:a,store:o})=>{let{transformLabelStyle:c}=_h();if(e===void 0||t===void 0||n===void 0||r===void 0||i===void 0||a===void 0)return null;let l=bk({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=uS({unit:o.unit,dpi:o.dpi,px:n/o.scale,precious:o.unit===`px`?0:1})+` x `+uS({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)(Rm,{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)(Um,{align:`center`,verticalAlign:`middle`,fill:c.textFill,padding:8,text:yG(i).toString()+`°`})]}),(0,j.jsxs)(Rm,{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)(Um,{align:`center`,verticalAlign:`middle`,fill:c.textFill,padding:8,text:f})]})]})}),xG=V(({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)(QW,{store:t,element:e,onClick:()=>{console.warn(`Polotno warning: onClick callback is deprecated. Just stop using it. Polotno will do selection automatically.`)}},e.id))})}),SG=({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}}},CG=null,wG=atob(`UG9sb3RubyBmcmVlIGxpY2Vuc2UgbGltaXRhdGlvbiBleGNlZWRlZCAtIFBsZWFzZSB1cGdyYWRlIHlvdXIgYWNjb3VudC4=`),TG=atob(`I2MwMzkyYg==`),EG=atob(`djAuOS4y`),DG=e=>(0,j.jsx)(j.Fragment,{children:(0,j.jsxs)(Rm,{fill:TG,height:200,children:[(0,j.jsx)(`Tag`,{fill:TG}),(0,j.jsx)(Um,Object.assign({},e,{fill:`white`,text:wG,height:void 0,padding:10,fontSize:20}))]})}),OG=atob(`RlJFRSAgVFJJQUwgIExJQ0VOU0U=`),kG=(atob(`UG93ZXJlZCBieSBQb2xvdG5v`),atob(`TElDRU5TRSAgS0VZICBJUyAgTUlTU0lORw==`)),AG=atob(`UGxlYXNlIGFjdGl2YXRlIHlvdXIgbGljZW5zZS4KTGljZW5zZSByZWxhdGVkIHF1ZXN0aW9uczoKcG9sb3Ruby5jb20vY29udGFjdA==`),jG=e=>{let t=Vy()===1,n=t?kG:OG,r=t?230:195;return(0,j.jsxs)(Lm,Object.assign({},e,{listening:!1,children:[(0,j.jsx)(zm,{fill:TG,width:r,height:24,cornerRadius:2}),(0,j.jsx)(Um,{text:n,fill:`white`,fontSize:13,fontFamily:`monospace`,width:r,align:`center`,y:5,listening:!1}),t&&(0,j.jsx)(`Text`,{text:AG,fill:`rgba(0,0,0,0.6)`,fontSize:14,y:30,listening:!1})]}))},MG=V(({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=_h(),p=f.transformerStyle,m=cG,h=t.computedBleed,g=e.bleedVisible?h:$f,_=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=SG({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,I=e.selectedElements.filter(e=>!e.visible).length>0,L=dG(e),R=e.selectedElements.length!==1||e.selectedElements[0]?.type===`group`,ie=uG(L)??0,ae=e=>R&&L.length>0&&L.every(t=>((e,t,n)=>{if(!lG(e.rotation-n))return!1;switch(e.type){case`text`:return t===`x`&&!ZA(e);case`figure`:case`video`:case`table`:return!0;case`image`:case`svg`:case`gif`:return!e.keepRatio;default:return!1}})(t,e,ie)),oe=ae(`x`),se=ae(`y`),z=()=>{var t;let n=x.current;if(!n)return[];let r=n.getStage();if(!r)return[];let i=dG(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=pG[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`&&Ey.textVerticalResizeEnabled&&(l.enabledAnchors=pG.text.enabledAnchors?.concat([`bottom-center`,`top-center`])),s===`text`&&o&&e.selectedElements[0].curveEnabled&&(l.enabledAnchors=pG.many.enabledAnchors)),(oe||se)&&(l.enabledAnchors=[...l.enabledAnchors||[],...oe?[`middle-left`,`middle-right`]:[],...se?[`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),R&&a.length){let e=uG(i);e===null||lG(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=z();e.find(e=>e?.isDragging())&&(e.forEach(e=>{e.isDragging()||e==null||e.startDrag()}),nW())},[e.selectedShapes,P,ne,I,re,F,oe,se,ie,p]);let ce=()=>{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})},le=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(),ce(),le()},[e.scale,le]),k.useEffect(()=>{le()},[e.selectedShapes,le]);let ue=Na(()=>({visible:!1,x1:0,y1:0,x2:0,y2:0})),de=k.useRef(!1),fe=dr(t=>{if(e.role===EA.VIEWER)return;de.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,ue.visible=!0,ue.x1=a.x,ue.y1=a.y,ue.x2=a.x,ue.y2=a.y,(t.target.getStage()?.getPointersPositions().length??0)>=2&&(ue.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=dr(e=>{var t;if(!ue.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:ue.x2,y:ue.y2},ue.x2=n.x,ue.y2=n.y}),n=dr(()=>{if(!ue.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=xk(i.a).map(e=>s.point(e));Sk(t,c)&&r.push(i.top.id)});let i=[...new Set(r)];de.current=!0,e.selectElements(i)}ue.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 pe=k.useCallback(n=>{if(!e.selectedElements[0]||n&&e.selectedElementsIds.includes(n))return;let r=Ck(e.selectedShapes),i=bk(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?pe():D&&O(null)},[e.distanceGuidesVisible,pe,e.selectedShapes.map(e=>`${e.x},${e.y},${e.width},${e.height},${e.rotation}`).join(`|`)]);let me=k.useRef(!1);k.useEffect(()=>{let e,t=w.current?.closest(`.polotno-workspace-inner`),n=()=>{me.current=!0,clearTimeout(e),e=setTimeout(()=>{me.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 he=n=>{if(e.role===EA.VIEWER||(e.activePage!==t&&t.select(),me.current)||de.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||ue.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([]))};aW(x,e);let ge=e.activePage===t,_e=e._selectedPagesIds.includes(t.id),ve=a?.PageControls,ye=a?.Tooltip,be=a?.ContextMenu,xe=1/e.scale,Se=0/e.scale;return(0,j.jsxs)(`div`,{ref:w,onDragOver:e=>e.preventDefault(),onDrop:n=>{if(n.preventDefault(),e.role===EA.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];CG&&r&&(CG(r,s,{elements:o,page:t}),CG=null)},style:{position:`relative`,width:n+`px`,height:r+`px`,overflow:`hidden`,flexShrink:0},className:`polotno-page-container`+(ge?` active-page`:``),children:[(0,j.jsx)(Ym,{ref:C,width:Math.min(n,c.width+200),height:Math.min(c.height+200,r),onClick:he,onTap:he,onContextMenu:t=>{if(t.evt.preventDefault(),e.role===EA.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:fe,onMouseMove:t=>{if(!e.distanceGuidesVisible&&!t.evt.altKey){D&&O(null);return}let n=t.target.findAncestor(`.element`,!0)?.id();pe(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=z();t.target.stopDrag(),r.forEach(e=>{e.isDragging()||e.startDrag(t)}),(n=x.current)==null||n.startDrag(t),nW()}}D&&O(null)},pageId:t.id,style:{position:`absolute`,overflow:`hidden`,top:0,left:0},children:(0,j.jsxs)(Im,{children:[(0,j.jsx)(mG,{width:n,height:r,fill:f.workspaceBackgroundColor}),(0,j.jsx)(Lm,{x:y,y:b,scaleX:e.scale,scaleY:e.scale,name:`page-container`,children:(0,j.jsxs)(Lm,{name:`page-container-2`,children:[(0,j.jsx)(Lm,{name:`page-background-group`,x:g.left,y:g.top,children:(0,j.jsx)(_G,{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)(Lm,{x:g.left,y:g.top,name:`elements-container`,listening:!e.isPlaying&&e.role!==EA.VIEWER,children:[(0,j.jsx)(zm,{name:`elements-area`,width:t.computedWidth,height:t.computedHeight,listening:!1}),(0,j.jsx)(xG,{elements:t.children,store:e})]}),(0,j.jsx)(Km,{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`)}}),zy()===EG&&(0,j.jsx)(DG,{name:`hit-detection`,x:-xe/2-Se,y:-xe/2-Se,width:_+xe+2*Se,height:v+xe+2*Se})]})}),(0,j.jsx)(Vm,{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)(Lm,{x:y,y:b,scaleX:e.scale,scaleY:e.scale,children:(0,j.jsx)(zm,{name:`page-highlight`,hideInExport:!0,x:-xe/2-Se,y:-xe/2-Se,width:_+xe+2*Se,height:v+xe+2*Se,stroke:_e?f.activePageBorderColor:f.pageBorderColor,strokeWidth:2,listening:!1,strokeScaleEnabled:!1})}),(0,j.jsxs)(Lm,{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)(qm,{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),le()},onTransformStart:()=>{e.history.startTransaction(),S.current=new Map(L.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),fG(l,n,t)}}return R&&L.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=!YA(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?XA(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),fG(d,t,e)})(t,n,x.current?.getActiveAnchor()||``,L,S.current):n},onTransform:e=>{let t=x.current.nodes(),n=t[t.length-1];e.target===n&&setTimeout(()=>{ce()},0)},onTransformEnd:t=>{A({}),e.history.endTransaction(),S.current=null,le(),z()},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:fS({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`})]}),ye&&(0,j.jsx)(ye,{components:a,store:e,page:t,stageRef:C,tooltipSafeArea:u}),be&&(0,j.jsx)(MA,{children:(0,j.jsx)(be,Object.assign({components:a,store:e},N.props))})]}),(0,j.jsx)(rG,{store:e,page:t,width:n,height:r,scale:e.scale,xPadding:y,yPadding:b,bleedLeft:g.left,bleedTop:g.top}),(0,j.jsx)(bG,Object.assign({},ee,{store:e})),(0,j.jsx)(vG,{selection:ue}),Vy()>0&&(0,j.jsxs)(`Group`,{hideInExport:!0,children:[(0,j.jsx)(jG,{name:`cache-bounds`,x:n-(Vy()===1?250:210),y:r-(Vy()===1?95:45)}),(0,j.jsx)(jG,{name:`cache-bounds-t`,x:10,y:10})]}),Hy()&&(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)(Lm,{name:`line-guides`})]})}),T&&ve&&(0,j.jsx)(ve,{store:e,page:t,xPadding:y,yPadding:b,layout:l})]})}),NG=wU(`div`,k.forwardRef)`
|
|
609
|
+
position: absolute;
|
|
610
|
+
top: 0;
|
|
611
|
+
left: 0;
|
|
612
|
+
pointer-events: none;
|
|
613
|
+
`,PG=wU(`div`,k.forwardRef)`
|
|
614
|
+
height: 14px;
|
|
615
|
+
position: sticky;
|
|
616
|
+
font-size: 8px;
|
|
617
|
+
line-height: 14px;
|
|
618
|
+
top: 0;
|
|
619
|
+
left: 0;
|
|
620
|
+
color: grey;
|
|
621
|
+
border-bottom: 1px solid grey;
|
|
622
|
+
background-color: #e8e8e8;
|
|
623
|
+
overflow: hidden;
|
|
624
|
+
box-sizing: border-box;
|
|
625
|
+
`,FG=wU(`div`,k.forwardRef)`
|
|
626
|
+
left: 0;
|
|
627
|
+
width: 14px;
|
|
628
|
+
position: sticky;
|
|
629
|
+
font-size: 8px;
|
|
630
|
+
line-height: 14px;
|
|
631
|
+
color: grey;
|
|
632
|
+
border-right: 1px solid grey;
|
|
633
|
+
background-color: #e8e8e8;
|
|
634
|
+
overflow: hidden;
|
|
635
|
+
box-sizing: border-box;
|
|
636
|
+
`,IG=wU(`div`,k.forwardRef)`
|
|
637
|
+
position: absolute;
|
|
638
|
+
border-left: 1px solid grey;
|
|
639
|
+
padding-left: 2px;
|
|
640
|
+
`,LG=wU(`div`,k.forwardRef)`
|
|
641
|
+
position: absolute;
|
|
642
|
+
left: 14px;
|
|
643
|
+
border-left: 1px solid grey;
|
|
644
|
+
padding-left: 2px;
|
|
645
|
+
transform: rotate(90deg);
|
|
646
|
+
transform-origin: left top;
|
|
647
|
+
overflow: hidden;
|
|
648
|
+
`,RG=[.1,.2,.5,1,2,5,10,20,25,50,100,200,500,1e3,2e3,5e3,1e4],zG=V(({store:e,width:t,height:n,pageSizes:r,layout:i=`vertical`,renderOnlyActivePage:a})=>{let{rulerStyle:o}=_h(),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=>dS({unitVal:t,dpi:e.dpi,unit:e.unit})*e.scale,RG.find(e=>h(e)>30)||1e4);var h;let g=dS({unitVal:m,dpi:e.dpi,unit:e.unit})*e.scale,_=Math.round(u/g)+1,v=Math.round(d/g)+1,y=Ck(e.selectedShapes),{backgroundColor:b,textColor:x,borderColor:S,borderSize:C,tickColor:w,tickSize:T}=o;return(0,j.jsx)(NG,{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)(PG,{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)(IG,{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)(FG,{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)(LG,{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)(PG,{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)(IG,{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)(FG,{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)(LG,{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)})]})})}),BG=V(({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(gW,[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=PA(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 VG(e){return new Promise((t,n)=>{let r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)})}var HG={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 UG(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`:HG[e.name.split(`.`).pop()?.toLowerCase()??``]??null}function WG(e){return e.replace(/\.[^./\\]+$/,``)}var GG=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`),VG(e));function KG(){return GG}var qG=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 KC(e);if(n&&n.type===`image`&&n.contentEditable){let t=QC(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})},JG=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=QC(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 XD(e);t>r.activePage.duration&&r.activePage.set({duration:t})}catch(e){console.warn(`Failed to get video duration:`,e)}return u},YG=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 KC(e),s=(t?.x||r.width/2)-a/2,c=(t?.y||r.height/2)-o/2;(i=r.activePage)==null||i.addElement({type:`svg`,width:a,height:o,x:s,y:c,src:e})},XG=async({src:e,droppedPos:t,store:n})=>{var r;let{width:i,height:a}=await KC(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})},ZG=async({url:e,type:t,store:n,droppedPos:r,targetElement:i,name:a})=>{let o=e;t===`image`?await qG({src:o,store:n,droppedPos:r,targetElement:i}):t===`svg`?await YG({src:o,store:n,droppedPos:r,targetElement:i}):t===`gif`?await XG({src:o,store:n,droppedPos:r,targetElement:i}):t===`video`?await JG({src:o,store:n,droppedPos:r,targetElement:i}):t===`audio`&&n.addAudio({src:o,name:a?WG(a):``})},QG=async({file:e,store:t,droppedPos:n})=>{let r=UG(e);if(!r){console.warn(`polotno: ignoring "${e.name}" — not an image, video or audio file`);return}await ZG({url:await KG()(e),type:r,store:t,droppedPos:n,name:e.name})},$G={data:[],pageId:``,payloadId:``},eK=`polotno_clipboard`,tK=(e,t,n)=>{$G={data:JSON.parse(JSON.stringify(e)),pageId:t||``,payloadId:n||``};try{localStorage.setItem(eK,JSON.stringify(e)),localStorage.setItem(`polotno_clipboard_page`,t||``),localStorage.setItem(`polotno_clipboard_payload`,n||``)}catch{}},nK=()=>{try{let e=localStorage.getItem(eK),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 $G},rK=`data-polotno-clipboard`,iK=(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=[];uA({children:i},e=>{e.type!==`group`&&t.push(e)});let a=Ck(t);a.maxX>e.width&&(n=-a.minX),a.maxY>e.height&&(r=-a.minY)}let s=[];uA({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)}),tK(i,e.activePage?.id,o),e.selectElements(s)})},aK=e=>{iK(e,nK())},oK=(e,t)=>{if(!t.clipboardData||e.selectedElements.length===0)return!1;let n=e.selectedElements.map(e=>e.toJSON()),r=yy(),i={v:1,id:r,pageId:e.activePage?.id||``,elements:n};t.clipboardData.setData(`text/html`,`<div ${rK}="${(e=>iS(new TextEncoder().encode(JSON.stringify(e))))(i)}"></div>`);let a=[];return uA({children:n},e=>{e.type===`text`&&a.push(Yb(e.text))}),t.clipboardData.setData(`text/plain`,a.join(`
|
|
649
|
+
`)||` `),t.preventDefault(),tK(n,e.activePage?.id,r),!0},sK=(e,t)=>{let n=oK(e,t);if(n){let t=e.selectedElements.filter(e=>e.removable).map(e=>e.id);e.deleteElements(t)}return n},cK=(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))},lK=(e,t,n={})=>{let r=t.clipboardData;if(!r)return!1;let i=r.getData(`text/html`);if(i&&i.includes(rK)){let n=(e=>{try{let t=new DOMParser().parseFromString(e,`text/html`).querySelector(`[${rK}]`)?.getAttribute(rK);if(!t)return null;let n=JSON.parse(new TextDecoder().decode(rS(t)));return Array.isArray(n.elements)?n:null}catch{return null}})(i);if(n){t.preventDefault();let r=nK();return n.id&&n.id===r.payloadId?iK(e,r):iK(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 QG({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=cK(e,(e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`))(o));t&&e.selectElements([t.id])}return!0}return r.types.length===0&&nK().data.length!==0&&(t.preventDefault(),aK(e),!0)};function uK(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 dK=e=>{if(e.type!==`group`)return bk(e);let t=1/0,n=1/0,r=-1/0,i=-1/0;return e.children.forEach(e=>{let a=dK(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}},fK=(e,t,n)=>{if(e.type!==`group`){let r=bk(e),i=t-r.x,a=n-r.y;e.set({x:e.x+i,y:e.y+a})}else{let r=t-dK(e).x,i=n-dK(e).y;e.children.forEach(e=>{let t=dK(e);fK(e,t.x+r,t.y+i)})}};function pK(e){let t=e.activePage?.computedWidth;e.selectedElements.forEach(e=>{t=Math.min(t,dK(e).x)}),e.selectedElements.length===1&&(t=0),e.selectedElements.forEach(e=>{let n=dK(e);fK(e,n.x-n.x+t,n.y)})}function mK(e){let t=0;e.selectedElements.forEach(e=>{let n=dK(e);t=Math.max(t,n.x+n.width)}),e.selectedElements.length===1&&(t=e.activePage?.computedWidth),e.selectedElements.forEach(e=>{let n=dK(e);fK(e,t-n.width,n.y)})}function hK(e){let t=e.activePage?.computedHeight;e.selectedElements.forEach(e=>{t=Math.min(t,dK(e).y)}),e.selectedElements.length===1&&(t=0),e.selectedElements.forEach(e=>{let n=dK(e);fK(e,n.x,n.y-n.y+t)})}function gK(e){let t=e.activePage?.computedHeight,n=0;e.selectedElements.forEach(e=>{let r=dK(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=dK(e);fK(e,t.x,r-t.height/2)})}function _K(e){let t=0;e.selectedElements.forEach(e=>{let n=dK(e);t=Math.max(t,n.y+n.height)}),e.selectedElements.length===1&&(t=e.activePage?.computedHeight),e.selectedElements.forEach(e=>{let n=dK(e);fK(e,n.x,t-n.height)})}function vK(e){let t=e.activePage?.computedWidth,n=0;e.selectedElements.forEach(e=>{let r=dK(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=dK(e);fK(e,r-t.width/2,t.y)})}var yK=`rgba(191, 191, 191, 100)`;function bK(e){if(e.selectedElements.length!==1)return null;let t=e.selectedElements[0];return t.type===`table`?t:null}function xK(e,t,n){let r=e.getCell(t,n);r&&e.focusCell(r.id)}function SK(e,t,n){let r=e.getCell(t,n);r&&e.enterCellEdit(r.id)}function CK(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 wK(e){if(e.role===EA.VIEWER)return{handle:!1,table:null};let t=CK();if(t.activeIsEditable||t.hasOutsideTextSelection)return{handle:!1,table:null};let n=bK(e);return{handle:!0,table:n&&n._focusedCellIds.length>0&&!n._editingCellId?n:null}}function TK(e,t){var n,r,i;if(t.role===EA.VIEWER)return;let a=CK(),o=a.activeIsEditable&&!a.activeIsInsideWorkspace,s=bK(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),SK(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),SK(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:Db(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),xK(t,n,e)}else{let e=s+1,n=o;e>=t.cols&&(n+=1,e=0),n>=t.rows&&(n=0,e=0),xK(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`&&xK(t,o,Math.min(s+1,t.cols-1)),e.key===`ArrowLeft`&&xK(t,o,Math.max(s-1,0)),e.key===`ArrowDown`&&xK(t,Math.min(o+1,t.rows-1),s),e.key===`ArrowUp`&&xK(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(),uK(t.selectedElements,t)),e.code!==`KeyT`||l||(e.preventDefault(),cK(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:yK,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:yK};(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:yK,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(),pK(t)),e.code===`KeyD`&&(e.preventDefault(),mK(t)),e.code===`KeyS`&&(e.preventDefault(),_K(t)),e.code===`KeyW`&&(e.preventDefault(),hK(t)),e.code===`KeyV`&&(e.preventDefault(),gK(t)),e.code===`KeyH`&&(e.preventDefault(),vK(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 EK(e,t){let n=e.focusedCells.map(e=>Yb(e.text)).join(`
|
|
650
|
+
`);t.clipboardData.setData(`text/plain`,n||` `),t.preventDefault()}function DK(e,t){let n=wK(t);n.handle&&e.clipboardData&&(n.table?EK(n.table,e):oK(t,e))}function OK(e,t){let n=wK(t);if(n.handle&&e.clipboardData){if(n.table){let r=n.table;EK(r,e),t.history.transaction(()=>{r.focusedCells.forEach(e=>e.set({text:``}))});return}sK(t,e)}}function kK(e,t){let n=wK(t);if(!n.handle)return;let r=n.table;lK(t,e,{onText:r?e=>r.focusedCells[0]?.set({text:e}):void 0})}var AK=Xt({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`}}),jK=e=>e&&typeof e==`object`;function MK(e,t){Object.keys(t).forEach(n=>{let r=e[n],i=t[n];jK(i)&&jK(r)?MK(r,i):e[n]=i})}function NK(e,t,n=``){Object.keys(t).forEach(r=>{let i=t[r],a=n?`${n}.${r}`:r;jK(i)?jK(e[r])?NK(e[r],i,a):console.warn(`Missing nested translation object at '${a}'`):e[r]===void 0&&console.warn(`Missing translation '${a}'`)})}dr((e,{validate:t=!1}={})=>{t&&NK(e,AK),MK(AK,e)});var PK={},FK=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}(AK,e);if(t!==void 0)return t;PK[e]||(PK[e]=!0,console.warn(`Missing translation '${e}'`));let n=e.split(`.`),r=n[n.length-1]||` `;return r.charAt(0).toUpperCase()+r.slice(1)},IK=(e,t,n)=>Math.max(t,Math.min(n,e)),LK=(e,t)=>Math.sqrt((t.clientX-e.clientX)**2+(t.clientY-e.clientY)**2),RK=({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:FK(`workspace.noPages`)}),(0,j.jsx)(`button`,{onClick:()=>{e.addPage()},children:FK(`workspace.addPage`)})]}),zK=({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`}})}),BK=V(({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:I,altCloneEnabled:L=!0,groupSelectionMode:R=`drill`,visiblePagesOffset:ie,renderOnlyActivePage:ae,scrollToPageThreshold:oe=.5,tooltipSafeArea:se})=>{let z=t===`horizontal`,ce=ne??20,le=re??55,[ue,de]=k.useState({width:100,height:100}),fe=k.useRef(ue),pe=k.useRef(null),me=k.useRef(null),he=k.useRef(0),ge=0,_e=0,ve=0,ye=0;if(e.bleedVisible)for(let t of e.pages){let e=t.computedBleed;ge=Math.max(ge,e.left),_e=Math.max(_e,e.right),ve=Math.max(ve,e.top),ye=Math.max(ye,e.bottom)}let be=Math.max(...e.pages.map(e=>e.computedWidth)),xe=Math.max(...e.pages.map(e=>e.computedHeight)),Se=e.activePage?.computedHeight||0,Ce=be+ge+_e,we=(ae?Se:xe)+ve+ye,Te=async({skipTimeout:t}={skipTimeout:!1})=>{if(t||await new Promise(e=>setTimeout(e,50)),pe.current===null||!Number.isFinite(Ce)||!Number.isFinite(we))return;let n=pe.current.getBoundingClientRect();n.width!==0&&n.height!==0||(console.warn(`Polotno warning: <Workspace /> component can not automatically detect its size.
|
|
651
|
+
Width or height of parent elements is equal 0.
|
|
652
|
+
Please make sure it has non-zero size. You may need to adjust it with your styles. <Workspace /> will automatically fit into parent container.
|
|
653
|
+
For simpler debugging here is the log of the parent element:`),console.log(pe.current));let r=me.current.clientWidth||n.width,i={width:r,height:n.height};(fe.current.width!==i.width||fe.current.height!==i.height)&&(de(i),fe.current=i);let a=(r-2*ce)/Ce,o=e.pages.length>1?3.1:2,s=(n.height-le*o)/we,c=e.pages.length>1?3.1:2,l=(r-ce*c)/Ce,u=(n.height-2*le)/we,d=e.pages.length?Math.max(Math.min(z?l:a,z?u:s),.01):1;e.scaleToFit!==d&&(e.setScale(d),e._setScaleToFit(d))};k.useLayoutEffect(()=>{Te({skipTimeout:!0})},[]),k.useEffect(()=>{Te()},[Ce,we,re,ne]),k.useLayoutEffect(()=>{Te({skipTimeout:!0})},[e.openedSidePanel]),k.useEffect(()=>{e.__()},[]),k.useEffect(()=>{let e=pe.current;if(window.ResizeObserver){let t=new ResizeObserver(()=>{Te({skipTimeout:!0})});return t.observe(e),()=>t.unobserve(e)}{let e=setInterval(()=>{Te({skipTimeout:!0})},100);return()=>clearInterval(e)}},[Ce,we]);let Ee=ae?1:e.pages.length,De,Oe;if(z){let t=Ce*e.scale*Ee;De=Math.max(ce,(ue.width-t)/Ee/2),Oe=Math.max(le,(ue.height-we*e.scale)/2)}else{De=Math.max(ce,(ue.width-Ce*e.scale)/2);let t=we*e.scale*Ee;Oe=Math.max(le,(ue.height-t)/Ee/2)}Number.isNaN(De)&&(De=ce),Number.isNaN(Oe)&&(Oe=le),k.useEffect(()=>{let t=t=>{(P||TK)(t,e)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[]),k.useEffect(()=>{let t=t=>DK(t,e),n=t=>OK(t,e),r=t=>(F||kK)(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);z&&Ce>0&&Number.isFinite(Ce)&&(r=Math.max(r,300/Ce)),r=Math.max(r,.01);let i=IK(t.deltaY<0?e.scale*1.03:e.scale/1.03,r,n);e.setScale(i);return}},n=me.current;return n?.addEventListener(`wheel`,t),()=>n?.removeEventListener(`wheel`,t)},[z,Ce,e]),k.useEffect(()=>{let t=me.current;if(!t)return;let n=e=>{e.touches.length===2&&(he.current=LK(e.touches[0],e.touches[1]))},r=n=>{if(n.touches.length===2&&he.current>0){n.preventDefault();let r=LK(n.touches[0],n.touches[1]),i=r/he.current,a=Math.max(5,e.scaleToFit),o=Math.min(.1,e.scaleToFit);z&&Ce>0&&Number.isFinite(Ce)&&(o=Math.max(o,300/Ce)),o=Math.max(o,.01);let s=e.scale,c=IK(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;Fe.current=!0,e.setScale(c),t.scrollLeft=p*l-d,t.scrollTop=m*l-f,he.current=r}},i=()=>{he.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)}},[z,Ce,e]);let ke=I!==void 0,Ae=e.pages.map(t=>{if(z){let n=(t.computedWidth+ge+_e)*e.scale;return ke?n+I:n+2*De}{let n=(t.computedHeight+ve+ye)*e.scale;return ke?n+I:n+2*Oe}}),je=[],Me=ke?z?De:Oe:0;for(let e=0;e<Ae.length;e++)je.push(Me),Me+=Ae[e];let Ne=Ae.reduce((e,t)=>e+t,0),Pe=ke?Ne+(z?2*De:2*Oe):Ne,Fe=k.useRef(!1),[,Ie]=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=IK(f*t.scrollWidth-u/2,0,m),t.scrollTop=IK(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])})(me,Pe,e.scale,e,Fe);let{handleScroll:Le}=((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()}}})(me,je,Ae,e,oe,ue,Fe,ae,t,Ie),Re=ue.width>=Ce*e.scale+2*De,ze=ue.height>=we*e.scale+2*Oe,Be=r||`rgba(232, 232, 232, 0.9)`,Ve=N?.NoPages||RK,He=z?ue.width:ue.height,Ue=me.current?z?me.current.scrollLeft:me.current.scrollTop:0,We=e=>{for(let t=je.length-1;t>=0;t--)if(e>=je[t])return t;return 0},Ge=Math.max(0,We(Ue)),Ke=Math.min(e.pages.length-1,We(Ue+He)),qe=ie??1,Je=Math.max(0,Ge-qe),Ye=Math.min(e.pages.length-1,Ke+qe),Xe=Sh({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)(gh,{value:Xe,children:(0,j.jsx)(`div`,{ref:pe,style:{width:`100%`,height:`100%`,position:`relative`,outline:`none`,flex:1,backgroundColor:Be,overflow:`hidden`},tabIndex:0,className:`polotno-workspace-container`,children:(0,j.jsxs)(`div`,{ref:me,onScroll:Le,style:Object.assign({position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,display:`flex`,flexDirection:z?`row`:`column`,overflow:`auto`,overflowX:z?`auto`:Re?`hidden`:`auto`,overflowY:z&&ze?`hidden`:`auto`},ke&&{paddingTop:z?0:Oe,paddingBottom:z?0:Oe,paddingLeft:z?De:0,paddingRight:z?De:0,boxSizing:`border-box`}),className:`polotno-workspace-inner`,children:[e.pages.map((r,i)=>{let a=r===e.activePage;if(ae&&!a&&!r._exportingOrRendering&&!r._forceMount)return null;let o=a||i>=Je&&i<=Ye||r._exportingOrRendering||r._forceMount,s=z?Ae[i]:Ce*e.scale+2*De,c=z?we*e.scale+2*Oe:Ae[i];if(!o)return(0,j.jsx)(`div`,{style:{flexShrink:0},children:(0,j.jsx)(zK,{width:s,height:c,backgroundColor:Be,xPadding:De,yPadding:Oe})},r.id);let l=(0,j.jsx)(MG,{page:r,xPadding:De,yPadding:Oe,width:s,height:c,store:e,pageControlsEnabled:n,altCloneEnabled:L,groupSelectionMode:R,components:N,viewportSize:ue,layout:t,tooltipSafeArea:se},r.id);return(r._exportingOrRendering||r._forceMount)&&!a&&ae?(0,j.jsx)(`div`,{style:{display:`none`,flexShrink:0},children:l},r.id):l}),e.rulesVisible&&(0,j.jsx)(zG,{store:e,xPadding:De,yPadding:Oe,width:Ce*e.scale+2*De,height:we*e.scale+2*Oe,pageSizes:Ae,layout:t,renderOnlyActivePage:ae}),e.pages.length===0&&(0,j.jsx)(Ve,{store:e}),e.audios.map(t=>(0,j.jsx)(BG,{audio:t,store:e},t.id))]})})})});v.prototype._requestDraw=()=>{},eb(!1),Fy(`change-font-size`),Oy(!0);var VK=OA({key:new URLSearchParams(location.search).get(`key`)});window.store=VK;var HK=null;window.__polotnoLoadJspdf=async()=>(HK||=y(()=>import(`./jspdf.es.min-87BhH7b6.js`),__vite__mapDeps([0,1,2,3]),import.meta.url),await HK);var UK=null;window.__polotnoLoadVideoExport=async()=>(UK||=y(()=>import(`./lib-C8V7BvzS.js`),__vite__mapDeps([4,1,5]),import.meta.url),await UK),window.config={addGlobalFont:Px,setRichTextEnabled:My,setTextVerticalResizeEnabled:Oy,setTextOverflow:Fy,onLoadError:mb,setAssetLoadTimeout:ob,setFontLoadTimeout:cb,unstable_setTextSplitAllowed:Iy,setRenderTagTextEnabled:Ny,setLegacyRichTextEnabled:jy},A.createRoot(document.getElementById(`root`)).render(k.createElement(BK,{visiblePagesOffset:0,renderOnlyActivePage:!0,store:VK,components:{PageControls:()=>null,Tooltip:()=>null}}));
|