polotno-node 2.15.19 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -15
- package/dist/assets/{html2canvas-DyNBkGVl.js → html2canvas-CfrNTgDn.js} +1 -1
- package/dist/assets/index-oYy3TsOk.js +464 -0
- package/dist/assets/{index.es-Ci1IK4T_.js → index.es-C7BBG6KT.js} +5 -5
- package/dist/assets/jspdf.es.min-D1g0nHTs.js +79 -0
- package/dist/assets/lib-U0NRl5MI.js +65 -0
- package/dist/assets/purify.es-DlxR2Lg_.js +3 -0
- package/dist/index.html +1 -1
- package/font-cache.js +109 -0
- package/index.d.ts +7 -0
- package/index.js +2 -0
- package/instance.js +205 -223
- package/package.json +20 -16
- package/dist/assets/index-zOfyRUBK.js +0 -344
- package/dist/assets/jspdf.es.min-kwORMdcW.js +0 -79
- package/dist/assets/lib-BagY_77q.js +0 -65
- package/dist/assets/purify.es-D7J7JQWp.js +0 -3
- package/video-parallel.js +0 -414
- /package/dist/assets/{typeof-DmQ5kzpc.js → typeof-B5XbjTb1.js} +0 -0
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./jspdf.es.min-kwORMdcW.js","./typeof-DmQ5kzpc.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.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.provider`),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.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): 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`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(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 O=/\/+/g;function k(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function A(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`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+k(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(O,`$&/`)+`/`),A(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(O,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+k(s,l);c+=A(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+k(s,l++),c+=A(s,r,i,u,o);else if(s===`object`)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 A(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ne(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 j={current:null},M={transition:null},re={ReactCurrentDispatcher:j,ReactCurrentBatchConfig:M,ReactCurrentOwner:C};function ie(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={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(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=re,e.act=ie,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ne}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=M.transition;M.transition={};try{e()}finally{M.transition=t}},e.unstable_act=ie,e.useCallback=function(e,t){return j.current.useCallback(e,t)},e.useContext=function(e){return j.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return j.current.useDeferredValue(e)},e.useEffect=function(e,t){return j.current.useEffect(e,t)},e.useId=function(){return j.current.useId()},e.useImperativeHandle=function(e,t,n){return j.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return j.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return j.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return j.current.useMemo(e,t)},e.useReducer=function(e,t,n){return j.current.useReducer(e,t,n)},e.useRef=function(e){return j.current.useRef(e)},e.useState=function(e){return j.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return j.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return j.current.useTransition()},e.version=`18.3.1`})),d=o(((e,t)=>{t.exports=u()})),f=o((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(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=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(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 b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,te(x);else{var t=n(l);t!==null&&ne(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&ne(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function ee(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?O():(S=!1,C=null)}}else S=!1}var O;if(typeof v==`function`)O=function(){v(ee)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=ee,O=function(){A.postMessage(null)}}else O=function(){g(ee,0)};function te(e){C=e,S||(S=!0,O())}function ne(t,n){w=g(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_continueExecution=function(){m||p||(m=!0,te(x))},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`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},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_pauseExecution=function(){},e.unstable_requestPaint=function(){},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?(_(w),w=-1):h=!0,ne(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,te(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d(),n=p();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;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.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[: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]*$/,f={},m={};function h(e){return l.call(m,e)?!0:l.call(f,e)?!1:u.test(e)?m[e]=!0:(f[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(_(t,n,i,r)&&(n=null),r||i===null?h(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,w=Symbol.for(`react.element`),T=Symbol.for(`react.portal`),E=Symbol.for(`react.fragment`),D=Symbol.for(`react.strict_mode`),ee=Symbol.for(`react.profiler`),O=Symbol.for(`react.provider`),k=Symbol.for(`react.context`),A=Symbol.for(`react.forward_ref`),te=Symbol.for(`react.suspense`),ne=Symbol.for(`react.suspense_list`),j=Symbol.for(`react.memo`),M=Symbol.for(`react.lazy`),re=Symbol.for(`react.offscreen`),ie=Symbol.iterator;function ae(e){return typeof e!=`object`||!e?null:(e=ie&&e[ie]||e[`@@iterator`],typeof e==`function`?e:null)}var oe=Object.assign,N;function se(e){if(N===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);N=t&&t[1]||``}return`
|
|
3
|
-
`+N+e}var ce=!1;function le(e,t){if(!e||ce)return``;ce=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
|
|
4
|
-
`),a=r.stack.split(`
|
|
5
|
-
`),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
|
|
6
|
-
`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ce=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?se(e):``}function ue(e){switch(e.tag){case 5:return se(e.type);case 16:return se(`Lazy`);case 13:return se(`Suspense`);case 19:return se(`SuspenseList`);case 0:case 2:case 15:return e=le(e.type,!1),e;case 11:return e=le(e.type.render,!1),e;case 1:return e=le(e.type,!0),e;default:return``}}function de(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case ee:return`Profiler`;case D:return`StrictMode`;case te:return`Suspense`;case ne:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case k:return(e.displayName||`Context`)+`.Consumer`;case O:return(e._context.displayName||`Context`)+`.Provider`;case A:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case j:return t=e.displayName||null,t===null?de(e.type)||`Memo`:t;case M:t=e._payload,e=e._init;try{return de(e(t))}catch{}}return null}function fe(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return de(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function pe(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function me(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function he(e){var t=me(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ge(e){e._valueTracker||=he(e)}function _e(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=me(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function ve(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function ye(e,t){var n=t.checked;return oe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function be(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=pe(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function xe(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function Se(e,t){xe(e,t);var n=pe(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?we(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&we(e,t.type,pe(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ce(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function we(e,t,n){(t!==`number`||ve(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var Te=Array.isArray;function Ee(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=``+pe(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 De(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return oe({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function Oe(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(Te(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:pe(n)}}function ke(e,t){var n=pe(t.value),r=pe(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function Ae(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function je(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function Me(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?je(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var P,Ne=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(P||=document.createElement(`div`),P.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=P.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Pe(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Fe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ie=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Fe).forEach(function(e){Ie.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Fe[t]=Fe[e]})});function Le(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Fe.hasOwnProperty(e)&&Fe[e]?(``+t).trim():t+`px`}function Re(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Le(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var ze=oe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Be(e,t){if(t){if(ze[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Ve(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;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 He=null;function Ue(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var We=null,Ge=null,Ke=null;function qe(e){if(e=Ki(e)){if(typeof We!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Ji(t),We(e.stateNode,e.type,t))}}function Je(e){Ge?Ke?Ke.push(e):Ke=[e]:Ge=e}function Ye(){if(Ge){var e=Ge,t=Ke;if(Ke=Ge=null,qe(e),t)for(e=0;e<t.length;e++)qe(t[e])}}function Xe(e,t){return e(t)}function Ze(){}var Qe=!1;function $e(e,t,n){if(Qe)return e(t,n);Qe=!0;try{return Xe(e,t,n)}finally{Qe=!1,(Ge!==null||Ke!==null)&&(Ze(),Ye())}}function et(e,t){var n=e.stateNode;if(n===null)return null;var i=Ji(n);if(i===null)return null;n=i[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`:(i=!i.disabled)||(e=e.type,i=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var tt=!1;if(c)try{var nt={};Object.defineProperty(nt,`passive`,{get:function(){tt=!0}}),window.addEventListener(`test`,nt,nt),window.removeEventListener(`test`,nt,nt)}catch{tt=!1}function rt(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var it=!1,at=null,ot=!1,st=null,ct={onError:function(e){it=!0,at=e}};function lt(e,t,n,r,i,a,o,s,c){it=!1,at=null,rt.apply(ct,arguments)}function ut(e,t,n,i,a,o,s,c,l){if(lt.apply(this,arguments),it){if(it){var u=at;it=!1,at=null}else throw Error(r(198));ot||(ot=!0,st=u)}}function dt(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 ft(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 pt(e){if(dt(e)!==e)throw Error(r(188))}function mt(e){var t=e.alternate;if(!t){if(t=dt(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return pt(a),e;if(o===i)return pt(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function ht(e){return e=mt(e),e===null?null:gt(e)}function gt(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=gt(e);if(t!==null)return t;e=e.sibling}return null}var _t=n.unstable_scheduleCallback,vt=n.unstable_cancelCallback,yt=n.unstable_shouldYield,bt=n.unstable_requestPaint,xt=n.unstable_now,St=n.unstable_getCurrentPriorityLevel,Ct=n.unstable_ImmediatePriority,wt=n.unstable_UserBlockingPriority,Tt=n.unstable_NormalPriority,Et=n.unstable_LowPriority,Dt=n.unstable_IdlePriority,Ot=null,kt=null;function At(e){if(kt&&typeof kt.onCommitFiberRoot==`function`)try{kt.onCommitFiberRoot(Ot,e,void 0,(e.current.flags&128)==128)}catch{}}var jt=Math.clz32?Math.clz32:Pt,Mt=Math.log,Nt=Math.LN2;function Pt(e){return e>>>=0,e===0?32:31-(Mt(e)/Nt|0)|0}var Ft=64,It=4194304;function Lt(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Rt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Lt(a))):r=Lt(s)}else o=n&~i,o===0?a!==0&&(r=Lt(a)):r=Lt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-jt(t),i=1<<n,r|=e[n],t&=~i;return r}function zt(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Bt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-jt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=zt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Vt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function Ht(){var e=Ft;return Ft<<=1,!(Ft&4194240)&&(Ft=64),e}function Ut(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Wt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-jt(t),e[t]=n}function Gt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-jt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Kt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-jt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var qt=0;function Jt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Yt,Xt,Zt,Qt,$t,en=!1,tn=[],nn=null,F=null,rn=null,an=new Map,on=new Map,sn=[],cn=`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 submit`.split(` `);function ln(e,t){switch(e){case`focusin`:case`focusout`:nn=null;break;case`dragenter`:case`dragleave`:F=null;break;case`mouseover`:case`mouseout`:rn=null;break;case`pointerover`:case`pointerout`:an.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:on.delete(t.pointerId)}}function un(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=Ki(t),t!==null&&Xt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function dn(e,t,n,r,i){switch(t){case`focusin`:return nn=un(nn,e,t,n,r,i),!0;case`dragenter`:return F=un(F,e,t,n,r,i),!0;case`mouseover`:return rn=un(rn,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return an.set(a,un(an.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,on.set(a,un(on.get(a)||null,e,t,n,r,i)),!0}return!1}function fn(e){var t=Gi(e.target);if(t!==null){var n=dt(t);if(n!==null){if(t=n.tag,t===13){if(t=ft(n),t!==null){e.blockedOn=t,$t(e.priority,function(){Zt(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 pn(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Cn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);He=r,n.target.dispatchEvent(r),He=null}else return t=Ki(n),t!==null&&Xt(t),e.blockedOn=n,!1;t.shift()}return!0}function mn(e,t,n){pn(e)&&n.delete(t)}function hn(){en=!1,nn!==null&&pn(nn)&&(nn=null),F!==null&&pn(F)&&(F=null),rn!==null&&pn(rn)&&(rn=null),an.forEach(mn),on.forEach(mn)}function gn(e,t){e.blockedOn===t&&(e.blockedOn=null,en||(en=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,hn)))}function _n(e){function t(t){return gn(t,e)}if(0<tn.length){gn(tn[0],e);for(var n=1;n<tn.length;n++){var r=tn[n];r.blockedOn===e&&(r.blockedOn=null)}}for(nn!==null&&gn(nn,e),F!==null&&gn(F,e),rn!==null&&gn(rn,e),an.forEach(t),on.forEach(t),n=0;n<sn.length;n++)r=sn[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<sn.length&&(n=sn[0],n.blockedOn===null);)fn(n),n.blockedOn===null&&sn.shift()}var vn=C.ReactCurrentBatchConfig,yn=!0;function I(e,t,n,r){var i=qt,a=vn.transition;vn.transition=null;try{qt=1,xn(e,t,n,r)}finally{qt=i,vn.transition=a}}function bn(e,t,n,r){var i=qt,a=vn.transition;vn.transition=null;try{qt=4,xn(e,t,n,r)}finally{qt=i,vn.transition=a}}function xn(e,t,n,r){if(yn){var i=Cn(e,t,n,r);if(i===null)_i(e,t,r,Sn,n),ln(e,r);else if(dn(i,e,t,n,r))r.stopPropagation();else if(ln(e,r),t&4&&-1<cn.indexOf(e)){for(;i!==null;){var a=Ki(i);if(a!==null&&Yt(a),a=Cn(e,t,n,r),a===null&&_i(e,t,r,Sn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else _i(e,t,r,null,n)}}var Sn=null;function Cn(e,t,n,r){if(Sn=null,e=Ue(r),e=Gi(e),e!==null)if(t=dt(e),t===null)e=null;else if(n=t.tag,n===13){if(e=ft(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 Sn=e,null}function wn(e){switch(e){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`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 1;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`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(St()){case Ct:return 1;case wt:return 4;case Tt:case Et:return 16;case Dt:return 536870912;default:return 16}default:return 16}}var Tn=null,En=null,Dn=null;function On(){if(Dn)return Dn;var e,t=En,n=t.length,r,i=`value`in Tn?Tn.value:Tn.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 Dn=i.slice(e,1<r?1-r:void 0)}function kn(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 An(){return!0}function jn(){return!1}function Mn(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)?An:jn,this.isPropagationStopped=jn,this}return oe(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=An)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=An)},persist:function(){},isPersistent:An}),t}var Nn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Pn=Mn(Nn),Fn=oe({},Nn,{view:0,detail:0}),In=Mn(Fn),Ln,Rn,zn,Bn=oe({},Fn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zn,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!==zn&&(zn&&e.type===`mousemove`?(Ln=e.screenX-zn.screenX,Rn=e.screenY-zn.screenY):Rn=Ln=0,zn=e),Ln)},movementY:function(e){return`movementY`in e?e.movementY:Rn}}),Vn=Mn(Bn),Hn=Mn(oe({},Bn,{dataTransfer:0})),Un=Mn(oe({},Fn,{relatedTarget:0})),Wn=Mn(oe({},Nn,{animationName:0,elapsedTime:0,pseudoElement:0})),Gn=Mn(oe({},Nn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Kn=Mn(oe({},Nn,{data:0})),qn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Jn={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`},Yn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Xn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Yn[e])?!!t[e]:!1}function Zn(){return Xn}var Qn=Mn(oe({},Fn,{key:function(e){if(e.key){var t=qn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=kn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Jn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zn,charCode:function(e){return e.type===`keypress`?kn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?kn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),$n=Mn(oe({},Bn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),er=Mn(oe({},Fn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zn})),tr=Mn(oe({},Nn,{propertyName:0,elapsedTime:0,pseudoElement:0})),nr=Mn(oe({},Bn,{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})),rr=[9,13,27,32],ir=c&&`CompositionEvent`in window,ar=null;c&&`documentMode`in document&&(ar=document.documentMode);var or=c&&`TextEvent`in window&&!ar,sr=c&&(!ir||ar&&8<ar&&11>=ar),cr=` `,lr=!1;function ur(e,t){switch(e){case`keyup`:return rr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function dr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var fr=!1;function pr(e,t){switch(e){case`compositionend`:return dr(t);case`keypress`:return t.which===32?(lr=!0,cr):null;case`textInput`:return e=t.data,e===cr&&lr?null:e;default:return null}}function mr(e,t){if(fr)return e===`compositionend`||!ir&&ur(e,t)?(e=On(),Dn=En=Tn=null,fr=!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 sr&&t.locale!==`ko`?null:t.data;default:return null}}var hr={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 gr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!hr[e.type]:t===`textarea`}function _r(e,t,n,r){Je(r),t=yi(t,`onChange`),0<t.length&&(n=new Pn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var vr=null,yr=null;function br(e){di(e,0)}function xr(e){if(_e(qi(e)))return e}function Sr(e,t){if(e===`change`)return t}var Cr=!1;if(c){var wr;if(c){var Tr=`oninput`in document;if(!Tr){var Er=document.createElement(`div`);Er.setAttribute(`oninput`,`return;`),Tr=typeof Er.oninput==`function`}wr=Tr}else wr=!1;Cr=wr&&(!document.documentMode||9<document.documentMode)}function Dr(){vr&&(vr.detachEvent(`onpropertychange`,Or),yr=vr=null)}function Or(e){if(e.propertyName===`value`&&xr(yr)){var t=[];_r(t,yr,e,Ue(e)),$e(br,t)}}function kr(e,t,n){e===`focusin`?(Dr(),vr=t,yr=n,vr.attachEvent(`onpropertychange`,Or)):e===`focusout`&&Dr()}function Ar(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return xr(yr)}function jr(e,t){if(e===`click`)return xr(t)}function Mr(e,t){if(e===`input`||e===`change`)return xr(t)}function Nr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Pr=typeof Object.is==`function`?Object.is:Nr;function Fr(e,t){if(Pr(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(!l.call(t,i)||!Pr(e[i],t[i]))return!1}return!0}function Ir(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Lr(e,t){var n=Ir(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=Ir(n)}}function Rr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Rr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zr(){for(var e=window,t=ve();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ve(e.document)}return t}function Br(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`)}function Vr(e){var t=zr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Rr(n.ownerDocument.documentElement,n)){if(r!==null&&Br(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Lr(n,a);var o=Lr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Hr=c&&`documentMode`in document&&11>=document.documentMode,Ur=null,Wr=null,Gr=null,Kr=!1;function qr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Kr||Ur==null||Ur!==ve(r)||(r=Ur,`selectionStart`in r&&Br(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}),Gr&&Fr(Gr,r)||(Gr=r,r=yi(Wr,`onSelect`),0<r.length&&(t=new Pn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Ur)))}function Jr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Yr={animationend:Jr(`Animation`,`AnimationEnd`),animationiteration:Jr(`Animation`,`AnimationIteration`),animationstart:Jr(`Animation`,`AnimationStart`),transitionend:Jr(`Transition`,`TransitionEnd`)},Xr={},Zr={};c&&(Zr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Yr.animationend.animation,delete Yr.animationiteration.animation,delete Yr.animationstart.animation),`TransitionEvent`in window||delete Yr.transitionend.transition);function Qr(e){if(Xr[e])return Xr[e];if(!Yr[e])return e;var t=Yr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Zr)return Xr[e]=t[n];return e}var $r=Qr(`animationend`),ei=Qr(`animationiteration`),ti=Qr(`animationstart`),ni=Qr(`transitionend`),ri=new Map,ii=`abort auxClick 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(` `);function ai(e,t){ri.set(e,t),o(t,[e])}for(var oi=0;oi<ii.length;oi++){var si=ii[oi];ai(si.toLowerCase(),`on`+(si[0].toUpperCase()+si.slice(1)))}ai($r,`onAnimationEnd`),ai(ei,`onAnimationIteration`),ai(ti,`onAnimationStart`),ai(`dblclick`,`onDoubleClick`),ai(`focusin`,`onFocus`),ai(`focusout`,`onBlur`),ai(ni,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var ci=`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(` `),li=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(ci));function ui(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,ut(r,t,void 0,e),e.currentTarget=null}function di(e,t){t=(t&4)!=0;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;ui(i,s,l),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;ui(i,s,l),a=c}}}if(ot)throw e=st,ot=!1,st=null,e}function fi(e,t){var n=t[Hi];n===void 0&&(n=t[Hi]=new Set);var r=e+`__bubble`;n.has(r)||(gi(t,e,2,!1),n.add(r))}function pi(e,t,n){var r=0;t&&(r|=4),gi(n,e,r,t)}var mi=`_reactListening`+Math.random().toString(36).slice(2);function hi(e){if(!e[mi]){e[mi]=!0,i.forEach(function(t){t!==`selectionchange`&&(li.has(t)||pi(t,!1,e),pi(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[mi]||(t[mi]=!0,pi(`selectionchange`,!1,t))}}function gi(e,t,n,r){switch(wn(t)){case 1:var i=I;break;case 4:i=bn;break;default:i=xn}n=i.bind(null,t,n,e),i=void 0,!tt||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 _i(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=Gi(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}$e(function(){var r=a,i=Ue(n),o=[];a:{var s=ri.get(e);if(s!==void 0){var c=Pn,l=e;switch(e){case`keypress`:if(kn(n)===0)break a;case`keydown`:case`keyup`:c=Qn;break;case`focusin`:l=`focus`,c=Un;break;case`focusout`:l=`blur`,c=Un;break;case`beforeblur`:case`afterblur`:c=Un;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`:c=Vn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Hn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=er;break;case $r:case ei:case ti:c=Wn;break;case ni:c=tr;break;case`scroll`:c=In;break;case`wheel`:c=nr;break;case`copy`:case`cut`:case`paste`:c=Gn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=$n}var u=(t&4)!=0,d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=et(p,f),h!=null&&u.push(vi(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==He&&(l=n.relatedTarget||n.fromElement)&&(Gi(l)||l[Vi]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Gi(l):null,l!==null&&(d=dt(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=Vn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=$n,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:qi(c),m=l==null?s:qi(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Gi(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=bi(m))p++;for(m=0,h=f;h;h=bi(h))m++;for(;0<p-m;)u=bi(u),p--;for(;0<m-p;)f=bi(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=bi(u),f=bi(f)}u=null}else u=null;c!==null&&xi(o,s,c,u,!1),l!==null&&d!==null&&xi(o,d,l,u,!0)}}a:{if(s=r?qi(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=Sr;else if(gr(s))if(Cr)g=Mr;else{g=Ar;var _=kr}else (c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=jr);if(g&&=g(e,r)){_r(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&we(s,`number`,s.value)}switch(_=r?qi(r):window,e){case`focusin`:(gr(_)||_.contentEditable===`true`)&&(Ur=_,Wr=r,Gr=null);break;case`focusout`:Gr=Wr=Ur=null;break;case`mousedown`:Kr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Kr=!1,qr(o,n,i);break;case`selectionchange`:if(Hr)break;case`keydown`:case`keyup`:qr(o,n,i)}var v;if(ir)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else fr?ur(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(sr&&n.locale!==`ko`&&(fr||y!==`onCompositionStart`?y===`onCompositionEnd`&&fr&&(v=On()):(Tn=i,En=`value`in Tn?Tn.value:Tn.textContent,fr=!0)),_=yi(r,y),0<_.length&&(y=new Kn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=dr(n),v!==null&&(y.data=v)))),(v=or?pr(e,n):mr(e,n))&&(r=yi(r,`onBeforeInput`),0<r.length&&(i=new Kn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}di(o,t)})}function vi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function yi(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=et(e,n),a!=null&&r.unshift(vi(e,a,i)),a=et(e,t),a!=null&&r.push(vi(e,a,i))),e=e.return}return r}function bi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function xi(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(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=et(n,a),c!=null&&o.unshift(vi(n,c,s))):i||(c=et(n,a),c!=null&&o.push(vi(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Si=/\r\n?/g,Ci=/\u0000|\uFFFD/g;function wi(e){return(typeof e==`string`?e:``+e).replace(Si,`
|
|
7
|
-
`).replace(Ci,``)}function Ti(e,t,n){if(t=wi(t),wi(e)!==t&&n)throw Error(r(425))}function Ei(){}var Di=null,Oi=null;function ki(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ai=typeof setTimeout==`function`?setTimeout:void 0,ji=typeof clearTimeout==`function`?clearTimeout:void 0,Mi=typeof Promise==`function`?Promise:void 0,Ni=typeof queueMicrotask==`function`?queueMicrotask:Mi===void 0?Ai:function(e){return Mi.resolve(null).then(e).catch(Pi)};function Pi(e){setTimeout(function(){throw e})}function Fi(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===`/$`){if(r===0){e.removeChild(i),_n(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++;n=i}while(n);_n(t)}function Ii(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===`$?`)break;if(t===`/$`)return null}}return e}function Li(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var Ri=Math.random().toString(36).slice(2),zi=`__reactFiber$`+Ri,Bi=`__reactProps$`+Ri,Vi=`__reactContainer$`+Ri,Hi=`__reactEvents$`+Ri,Ui=`__reactListeners$`+Ri,Wi=`__reactHandles$`+Ri;function Gi(e){var t=e[zi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Vi]||n[zi]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Li(e);e!==null;){if(n=e[zi])return n;e=Li(e)}return t}e=n,n=e.parentNode}return null}function Ki(e){return e=e[zi]||e[Vi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function qi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Ji(e){return e[Bi]||null}var Yi=[],Xi=-1;function Zi(e){return{current:e}}function Qi(e){0>Xi||(e.current=Yi[Xi],Yi[Xi]=null,Xi--)}function $i(e,t){Xi++,Yi[Xi]=e.current,e.current=t}var ea={},ta=Zi(ea),na=Zi(!1),ra=ea;function ia(e,t){var n=e.type.contextTypes;if(!n)return ea;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function aa(e){return e=e.childContextTypes,e!=null}function oa(){Qi(na),Qi(ta)}function sa(e,t,n){if(ta.current!==ea)throw Error(r(168));$i(ta,t),$i(na,n)}function ca(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,fe(e)||`Unknown`,a));return oe({},n,i)}function la(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ea,ra=ta.current,$i(ta,e),$i(na,na.current),!0}function ua(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=ca(e,t,ra),i.__reactInternalMemoizedMergedChildContext=e,Qi(na),Qi(ta),$i(ta,e)):Qi(na),$i(na,n)}var da=null,fa=!1,pa=!1;function ma(e){da===null?da=[e]:da.push(e)}function ha(e){fa=!0,ma(e)}function ga(){if(!pa&&da!==null){pa=!0;var e=0,t=qt;try{var n=da;for(qt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}da=null,fa=!1}catch(t){throw da!==null&&(da=da.slice(e+1)),_t(Ct,ga),t}finally{qt=t,pa=!1}}return null}var _a=[],va=0,ya=null,ba=0,xa=[],Sa=0,Ca=null,L=1,wa=``;function Ta(e,t){_a[va++]=ba,_a[va++]=ya,ya=e,ba=t}function Ea(e,t,n){xa[Sa++]=L,xa[Sa++]=wa,xa[Sa++]=Ca,Ca=e;var r=L;e=wa;var i=32-jt(r)-1;r&=~(1<<i),n+=1;var a=32-jt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,L=1<<32-jt(t)+i|n<<i|r,wa=a+e}else L=1<<a|n<<i|r,wa=e}function Da(e){e.return!==null&&(Ta(e,1),Ea(e,1,0))}function Oa(e){for(;e===ya;)ya=_a[--va],_a[va]=null,ba=_a[--va],_a[va]=null;for(;e===Ca;)Ca=xa[--Sa],xa[Sa]=null,wa=xa[--Sa],xa[Sa]=null,L=xa[--Sa],xa[Sa]=null}var ka=null,Aa=null,ja=!1,Ma=null;function Na(e,t){var n=tu(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Pa(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t===null?!1:(e.stateNode=t,ka=e,Aa=Ii(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t===null?!1:(e.stateNode=t,ka=e,Aa=null,!0);case 13:return t=t.nodeType===8?t:null,t===null?!1:(n=Ca===null?null:{id:L,overflow:wa},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=tu(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ka=e,Aa=null,!0);default:return!1}}function Fa(e){return(e.mode&1)!=0&&(e.flags&128)==0}function Ia(e){if(ja){var t=Aa;if(t){var n=t;if(!Pa(e,t)){if(Fa(e))throw Error(r(418));t=Ii(n.nextSibling);var i=ka;t&&Pa(e,t)?Na(i,n):(e.flags=e.flags&-4097|2,ja=!1,ka=e)}}else{if(Fa(e))throw Error(r(418));e.flags=e.flags&-4097|2,ja=!1,ka=e}}}function La(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ka=e}function Ra(e){if(e!==ka)return!1;if(!ja)return La(e),ja=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!ki(e.type,e.memoizedProps)),t&&=Aa){if(Fa(e))throw za(),Error(r(418));for(;t;)Na(e,t),t=Ii(t.nextSibling)}if(La(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){Aa=Ii(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}Aa=null}}else Aa=ka?Ii(e.stateNode.nextSibling):null;return!0}function za(){for(var e=Aa;e;)e=Ii(e.nextSibling)}function R(){Aa=ka=null,ja=!1}function Ba(e){Ma===null?Ma=[e]:Ma.push(e)}var Va=C.ReactCurrentBatchConfig;function Ha(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function Ua(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function z(e){var t=e._init;return t(e._payload)}function Wa(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 i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=iu(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|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=cu(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===E?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===M&&z(i)===t.type)?(r=a(t,n.props),r.ref=Ha(e,t,n),r.return=e,r):(r=au(n.type,n.key,n.props,null,e.mode,r),r.ref=Ha(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=lu(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=ou(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`)return t=cu(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=au(t.type,t.key,t.props,null,e.mode,n),n.ref=Ha(e,null,t),n.return=e,n;case T:return t=lu(t,e.mode,n),t.return=e,t;case M:var r=t._init;return f(e,r(t._payload),n)}if(Te(t)||ae(t))return t=ou(t,e.mode,n,null),t.return=e,t;Ua(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`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case w:return n.key===i?l(e,t,n,r):null;case T:return n.key===i?u(e,t,n,r):null;case M:return i=n._init,p(e,t,i(n._payload),r)}if(Te(n)||ae(n))return i===null?d(e,t,n,r,null):null;Ua(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case w:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case T:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case M:var a=r._init;return m(e,t,n,a(r._payload),i)}if(Te(r)||ae(r))return e=e.get(n)||null,d(t,e,r,i,null);Ua(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),ja&&Ta(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return ja&&Ta(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),ja&&Ta(r,h),l}function g(a,s,c,l){var u=ae(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),ja&&Ta(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return ja&&Ta(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),ja&&Ta(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===M&&z(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Ha(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=ou(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=au(i.type,i.key,i.props,null,e.mode,o),o.ref=Ha(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=lu(i,e.mode,o),r.return=e,e=r}return s(e);case M:return l=i._init,_(e,r,l(i._payload),o)}if(Te(i))return h(e,r,i,o);if(ae(i))return g(e,r,i,o);Ua(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=cu(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ga=Wa(!0),Ka=Wa(!1),qa=Zi(null),Ja=null,Ya=null,Xa=null;function Za(){Xa=Ya=Ja=null}function Qa(e){var t=qa.current;Qi(qa),e._currentValue=t}function $a(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 eo(e,t){Ja=e,Xa=Ya=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Vs=!0),e.firstContext=null)}function to(e){var t=e._currentValue;if(Xa!==e)if(e={context:e,memoizedValue:t,next:null},Ya===null){if(Ja===null)throw Error(r(308));Ya=e,Ja.dependencies={lanes:0,firstContext:e}}else Ya=Ya.next=e;return t}var no=null;function ro(e){no===null?no=[e]:no.push(e)}function io(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,ro(t)):(n.next=i.next,i.next=n),t.interleaved=n,ao(e,r)}function ao(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var oo=!1;function so(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function co(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function lo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function uo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Yc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,ao(e,n)}return i=r.interleaved,i===null?(t.next=t,ro(r)):(t.next=i.next,i.next=t),r.interleaved=t,ao(e,n)}function fo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Kt(e,n)}}function po(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={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,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,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function mo(e,t,n,r){var i=e.updateQueue;oo=!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,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,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(p,d,f):m,f==null)break a;d=oe({},d,f);break a;case 2:oo=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime: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;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);rl|=o,e.lanes=o,e.memoizedState=d}}function ho(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var B={},go=Zi(B),_o=Zi(B),vo=Zi(B);function yo(e){if(e===B)throw Error(r(174));return e}function bo(e,t){switch($i(vo,t),$i(_o,e),$i(go,B),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Me(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Me(t,e)}Qi(go),$i(go,t)}function xo(){Qi(go),Qi(_o),Qi(vo)}function So(e){yo(vo.current);var t=yo(go.current),n=Me(t,e.type);t!==n&&($i(_o,e),$i(go,n))}function Co(e){_o.current===e&&(Qi(go),Qi(_o))}var wo=Zi(0);function V(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){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 To=[];function Eo(){for(var e=0;e<To.length;e++)To[e]._workInProgressVersionPrimary=null;To.length=0}var Do=C.ReactCurrentDispatcher,Oo=C.ReactCurrentBatchConfig,ko=0,Ao=null,jo=null,Mo=null,No=!1,Po=!1,Fo=0,Io=0;function Lo(){throw Error(r(321))}function Ro(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Pr(e[n],t[n]))return!1;return!0}function zo(e,t,n,i,a,o){if(ko=o,Ao=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Do.current=e===null||e.memoizedState===null?xs:Ss,e=n(i,a),Po){o=0;do{if(Po=!1,Fo=0,25<=o)throw Error(r(301));o+=1,Mo=jo=null,t.updateQueue=null,Do.current=Cs,e=n(i,a)}while(Po)}if(Do.current=bs,t=jo!==null&&jo.next!==null,ko=0,Mo=jo=Ao=null,No=!1,t)throw Error(r(300));return e}function Bo(){var e=Fo!==0;return Fo=0,e}function Vo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mo===null?Ao.memoizedState=Mo=e:Mo=Mo.next=e,Mo}function Ho(){if(jo===null){var e=Ao.alternate;e=e===null?null:e.memoizedState}else e=jo.next;var t=Mo===null?Ao.memoizedState:Mo.next;if(t!==null)Mo=t,jo=e;else{if(e===null)throw Error(r(310));jo=e,e={memoizedState:jo.memoizedState,baseState:jo.baseState,baseQueue:jo.baseQueue,queue:jo.queue,next:null},Mo===null?Ao.memoizedState=Mo=e:Mo=Mo.next=e}return Mo}function Uo(e,t){return typeof t==`function`?t(e):t}function Wo(e){var t=Ho(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=jo,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((ko&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,Ao.lanes|=d,rl|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Pr(i,t.memoizedState)||(Vs=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,Ao.lanes|=o,rl|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Go(e){var t=Ho(),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);Pr(o,t.memoizedState)||(Vs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Ko(){}function qo(e,t){var n=Ao,i=Ho(),a=t(),o=!Pr(i.memoizedState,a);if(o&&(i.memoizedState=a,Vs=!0),i=i.queue,is(H.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||Mo!==null&&Mo.memoizedState.tag&1){if(n.flags|=2048,$o(9,Yo.bind(null,n,i,a,t),void 0,null),Xc===null)throw Error(r(349));ko&30||Jo(n,t,a)}return a}function Jo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ao.updateQueue,t===null?(t={lastEffect:null,stores:null},Ao.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Yo(e,t,n,r){t.value=n,t.getSnapshot=r,Xo(t)&&Zo(e)}function H(e,t,n){return n(function(){Xo(t)&&Zo(e)})}function Xo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Pr(e,n)}catch{return!0}}function Zo(e){var t=ao(e,1);t!==null&&Cl(t,e,1,-1)}function Qo(e){var t=Vo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Uo,lastRenderedState:e},t.queue=e,e=e.dispatch=gs.bind(null,Ao,e),[t.memoizedState,e]}function $o(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ao.updateQueue,t===null?(t={lastEffect:null,stores:null},Ao.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function es(){return Ho().memoizedState}function ts(e,t,n,r){var i=Vo();Ao.flags|=e,i.memoizedState=$o(1|t,n,void 0,r===void 0?null:r)}function ns(e,t,n,r){var i=Ho();r=r===void 0?null:r;var a=void 0;if(jo!==null){var o=jo.memoizedState;if(a=o.destroy,r!==null&&Ro(r,o.deps)){i.memoizedState=$o(t,n,a,r);return}}Ao.flags|=e,i.memoizedState=$o(1|t,n,a,r)}function rs(e,t){return ts(8390656,8,e,t)}function is(e,t){return ns(2048,8,e,t)}function as(e,t){return ns(4,2,e,t)}function os(e,t){return ns(4,4,e,t)}function ss(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function cs(e,t,n){return n=n==null?null:n.concat([e]),ns(4,4,ss.bind(null,t,e),n)}function ls(){}function us(e,t){var n=Ho();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ro(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ds(e,t){var n=Ho();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ro(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function fs(e,t,n){return ko&21?(Pr(n,t)||(n=Ht(),Ao.lanes|=n,rl|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Vs=!0),e.memoizedState=n)}function ps(e,t){var n=qt;qt=n!==0&&4>n?n:4,e(!0);var r=Oo.transition;Oo.transition={};try{e(!1),t()}finally{qt=n,Oo.transition=r}}function ms(){return Ho().memoizedState}function hs(e,t,n){var r=Sl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},_s(e))vs(t,n);else if(n=io(e,t,n,r),n!==null){var i=xl();Cl(n,e,r,i),ys(n,t,r)}}function gs(e,t,n){var r=Sl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(_s(e))vs(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,Pr(s,o)){var c=t.interleaved;c===null?(i.next=i,ro(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=io(e,t,i,r),n!==null&&(i=xl(),Cl(n,e,r,i),ys(n,t,r))}}function _s(e){var t=e.alternate;return e===Ao||t!==null&&t===Ao}function vs(e,t){Po=No=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ys(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Kt(e,n)}}var bs={readContext:to,useCallback:Lo,useContext:Lo,useEffect:Lo,useImperativeHandle:Lo,useInsertionEffect:Lo,useLayoutEffect:Lo,useMemo:Lo,useReducer:Lo,useRef:Lo,useState:Lo,useDebugValue:Lo,useDeferredValue:Lo,useTransition:Lo,useMutableSource:Lo,useSyncExternalStore:Lo,useId:Lo,unstable_isNewReconciler:!1},xs={readContext:to,useCallback:function(e,t){return Vo().memoizedState=[e,t===void 0?null:t],e},useContext:to,useEffect:rs,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),ts(4194308,4,ss.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ts(4194308,4,e,t)},useInsertionEffect:function(e,t){return ts(4,2,e,t)},useMemo:function(e,t){var n=Vo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Vo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=hs.bind(null,Ao,e),[r.memoizedState,e]},useRef:function(e){var t=Vo();return e={current:e},t.memoizedState=e},useState:Qo,useDebugValue:ls,useDeferredValue:function(e){return Vo().memoizedState=e},useTransition:function(){var e=Qo(!1),t=e[0];return e=ps.bind(null,e[1]),Vo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=Ao,a=Vo();if(ja){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Xc===null)throw Error(r(349));ko&30||Jo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,rs(H.bind(null,i,o,e),[e]),i.flags|=2048,$o(9,Yo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Vo(),t=Xc.identifierPrefix;if(ja){var n=wa,r=L;n=(r&~(1<<32-jt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Fo++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Io++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},Ss={readContext:to,useCallback:us,useContext:to,useEffect:is,useImperativeHandle:cs,useInsertionEffect:as,useLayoutEffect:os,useMemo:ds,useReducer:Wo,useRef:es,useState:function(){return Wo(Uo)},useDebugValue:ls,useDeferredValue:function(e){return fs(Ho(),jo.memoizedState,e)},useTransition:function(){return[Wo(Uo)[0],Ho().memoizedState]},useMutableSource:Ko,useSyncExternalStore:qo,useId:ms,unstable_isNewReconciler:!1},Cs={readContext:to,useCallback:us,useContext:to,useEffect:is,useImperativeHandle:cs,useInsertionEffect:as,useLayoutEffect:os,useMemo:ds,useReducer:Go,useRef:es,useState:function(){return Go(Uo)},useDebugValue:ls,useDeferredValue:function(e){var t=Ho();return jo===null?t.memoizedState=e:fs(t,jo.memoizedState,e)},useTransition:function(){return[Go(Uo)[0],Ho().memoizedState]},useMutableSource:Ko,useSyncExternalStore:qo,useId:ms,unstable_isNewReconciler:!1};function ws(e,t){if(e&&e.defaultProps){for(var n in t=oe({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ts(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:oe({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Es={isMounted:function(e){return(e=e._reactInternals)?dt(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=xl(),i=Sl(e),a=lo(r,i);a.payload=t,n!=null&&(a.callback=n),t=uo(e,a,i),t!==null&&(Cl(t,e,i,r),fo(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=xl(),i=Sl(e),a=lo(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=uo(e,a,i),t!==null&&(Cl(t,e,i,r),fo(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=xl(),r=Sl(e),i=lo(n,r);i.tag=2,t!=null&&(i.callback=t),t=uo(e,i,r),t!==null&&(Cl(t,e,r,n),fo(t,e,r))}};function Ds(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?!Fr(n,r)||!Fr(i,a):!0}function Os(e,t,n){var r=!1,i=ea,a=t.contextType;return typeof a==`object`&&a?a=to(a):(i=aa(t)?ra:ta.current,r=t.contextTypes,a=(r=r!=null)?ia(e,i):ea),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Es,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function ks(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Es.enqueueReplaceState(t,t.state,null)}function As(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},so(e);var a=t.contextType;typeof a==`object`&&a?i.context=to(a):(a=aa(t)?ra:ta.current,i.context=ia(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(Ts(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&Es.enqueueReplaceState(i,i.state,null),mo(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function js(e,t){try{var n=``,r=t;do n+=ue(r),r=r.return;while(r);var i=n}catch(e){i=`
|
|
8
|
-
Error generating stack: `+e.message+`
|
|
9
|
-
`+e.stack}return{value:e,source:t,stack:i,digest:null}}function Ms(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ns(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Ps=typeof WeakMap==`function`?WeakMap:Map;function Fs(e,t,n){n=lo(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){dl||(dl=!0,fl=r),Ns(e,t)},n}function Is(e,t,n){n=lo(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Ns(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Ns(e,t),typeof r!=`function`&&(pl===null?pl=new Set([this]):pl.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Ls(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ps;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)||(i.add(n),e=Jl.bind(null,e,t,n),t.then(e,e))}function Rs(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null?!0:t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function zs(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=lo(-1,1),t.tag=2,uo(n,t,1))),n.lanes|=1),e)}var Bs=C.ReactCurrentOwner,Vs=!1;function Hs(e,t,n,r){t.child=e===null?Ka(t,null,n,r):Ga(t,e.child,n,r)}function Us(e,t,n,r,i){n=n.render;var a=t.ref;return eo(t,i),r=zo(e,t,n,r,a,i),n=Bo(),e!==null&&!Vs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,cc(e,t,i)):(ja&&n&&Da(t),t.flags|=1,Hs(e,t,r,i),t.child)}function Ws(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!nu(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Gs(e,t,a,r,i)):(e=au(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Fr:n,n(o,r)&&e.ref===t.ref)return cc(e,t,i)}return t.flags|=1,e=iu(a,r),e.ref=t.ref,e.return=t,t.child=e}function Gs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Fr(a,r)&&e.ref===t.ref)if(Vs=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Vs=!0);else return t.lanes=e.lanes,cc(e,t,i)}return Js(e,t,n,r,i)}function Ks(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`)if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},$i(el,$c),$c|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,$i(el,$c),$c|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,$i(el,$c),$c|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),$i(el,$c),$c|=r;return Hs(e,t,i,n),t.child}function qs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Js(e,t,n,r,i){var a=aa(n)?ra:ta.current;return a=ia(t,a),eo(t,i),n=zo(e,t,n,r,a,i),r=Bo(),e!==null&&!Vs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,cc(e,t,i)):(ja&&r&&Da(t),t.flags|=1,Hs(e,t,n,i),t.child)}function Ys(e,t,n,r,i){if(aa(n)){var a=!0;la(t)}else a=!1;if(eo(t,i),t.stateNode===null)sc(e,t),Os(t,n,r),As(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=to(l):(l=aa(n)?ra:ta.current,l=ia(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&ks(t,o,r,l),oo=!1;var f=t.memoizedState;o.state=f,mo(t,r,o,i),c=t.memoizedState,s!==r||f!==c||na.current||oo?(typeof u==`function`&&(Ts(t,n,u,r),c=t.memoizedState),(s=oo||Ds(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,co(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:ws(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=to(c):(c=aa(n)?ra:ta.current,c=ia(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&ks(t,o,r,c),oo=!1,f=t.memoizedState,o.state=f,mo(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||na.current||oo?(typeof p==`function`&&(Ts(t,n,p,r),m=t.memoizedState),(l=oo||Ds(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Xs(e,t,n,r,a,i)}function Xs(e,t,n,r,i,a){qs(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&ua(t,n,!1),cc(e,t,a);r=t.stateNode,Bs.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ga(t,e.child,null,a),t.child=Ga(t,null,s,a)):Hs(e,t,s,a),t.memoizedState=r.state,i&&ua(t,n,!0),t.child}function Zs(e){var t=e.stateNode;t.pendingContext?sa(e,t.pendingContext,t.pendingContext!==t.context):t.context&&sa(e,t.context,!1),bo(e,t.containerInfo)}function Qs(e,t,n,r,i){return R(),Ba(i),t.flags|=256,Hs(e,t,n,r),t.child}var $s={dehydrated:null,treeContext:null,retryLane:0};function ec(e){return{baseLanes:e,cachePool:null,transitions:null}}function tc(e,t,n){var r=t.pendingProps,i=wo.current,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(i&2)!=0),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),$i(wo,i&1),e===null)return Ia(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data===`$!`?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=su(o,r,0,null),e=ou(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=ec(n),t.memoizedState=$s,e):U(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return rc(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=iu(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=ou(a,o,n,null),a.flags|=2):a=iu(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?ec(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=$s,r}return a=e.child,e=a.sibling,r=iu(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function U(e,t){return t=su({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function nc(e,t,n,r){return r!==null&&Ba(r),Ga(t,e.child,null,n),e=U(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function rc(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Ms(Error(r(422))),nc(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=su({mode:`visible`,children:i.children},a,0,null),o=ou(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ga(t,e.child,null,s),t.child.memoizedState=ec(s),t.memoizedState=$s,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return nc(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Ms(o,i,void 0),nc(e,t,s,i)}if(c=(s&e.childLanes)!==0,Vs||c){if(i=Xc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,ao(e,a),Cl(i,e,a,-1))}return Ll(),i=Ms(Error(r(421))),nc(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Xl.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Aa=Ii(a.nextSibling),ka=t,ja=!0,Ma=null,e!==null&&(xa[Sa++]=L,xa[Sa++]=wa,xa[Sa++]=Ca,L=e.id,wa=e.overflow,Ca=t),t=U(t,i.children),t.flags|=4096,t)}function ic(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),$a(e.return,t,n)}function ac(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function oc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Hs(e,t,r.children,n),r=wo.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ic(e,n,t);else if(e.tag===19)ic(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}r&=1}if($i(wo,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&V(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ac(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&V(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ac(t,!0,n,null,a);break;case`together`:ac(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function sc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function cc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),rl|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=iu(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=iu(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function lc(e,t,n){switch(t.tag){case 3:Zs(t),R();break;case 5:So(t);break;case 1:aa(t.type)&&la(t);break;case 4:bo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;$i(qa,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?($i(wo,wo.current&1),e=cc(e,t,n),e===null?null:e.sibling):tc(e,t,n):($i(wo,wo.current&1),t.flags|=128,null);$i(wo,wo.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){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),$i(wo,wo.current),r)break;return null;case 22:case 23:return t.lanes=0,Ks(e,t,n)}return cc(e,t,n)}var uc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&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}},dc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,yo(go.current);var o=null;switch(n){case`input`:i=ye(e,i),r=ye(e,r),o=[];break;case`select`:i=oe({},i,{value:void 0}),r=oe({},r,{value:void 0}),o=[];break;case`textarea`:i=De(e,i),r=De(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=Ei)}Be(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null));for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null))if(u===`style`)if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l;else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&fi(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},fc=function(e,t,n,r){n!==r&&(t.flags|=4)};function pc(e,t){if(!ja)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 mc(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&14680064,r|=i.flags&14680064,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 hc(e,t,n){var i=t.pendingProps;switch(Oa(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mc(t),null;case 1:return aa(t.type)&&oa(),mc(t),null;case 3:return i=t.stateNode,xo(),Qi(na),Qi(ta),Eo(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Ra(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ma!==null&&(Dl(Ma),Ma=null))),mc(t),null;case 5:Co(t);var o=yo(vo.current);if(n=t.type,e!==null&&t.stateNode!=null)dc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return mc(t),null}if(e=yo(go.current),Ra(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[zi]=t,i[Bi]=s,e=(t.mode&1)!=0,n){case`dialog`:fi(`cancel`,i),fi(`close`,i);break;case`iframe`:case`object`:case`embed`:fi(`load`,i);break;case`video`:case`audio`:for(o=0;o<ci.length;o++)fi(ci[o],i);break;case`source`:fi(`error`,i);break;case`img`:case`image`:case`link`:fi(`error`,i),fi(`load`,i);break;case`details`:fi(`toggle`,i);break;case`input`:be(i,s),fi(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},fi(`invalid`,i);break;case`textarea`:Oe(i,s),fi(`invalid`,i)}for(var c in Be(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&Ti(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&Ti(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&fi(`scroll`,i)}switch(n){case`input`:ge(i),Ce(i,s,!0);break;case`textarea`:ge(i),Ae(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=Ei)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=je(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[zi]=t,e[Bi]=i,uc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ve(n,i),n){case`dialog`:fi(`cancel`,e),fi(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:fi(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<ci.length;o++)fi(ci[o],e);o=i;break;case`source`:fi(`error`,e),o=i;break;case`img`:case`image`:case`link`:fi(`error`,e),fi(`load`,e),o=i;break;case`details`:fi(`toggle`,e),o=i;break;case`input`:be(e,i),o=ye(e,i),fi(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=oe({},i,{value:void 0}),fi(`invalid`,e);break;case`textarea`:Oe(e,i),o=De(e,i),fi(`invalid`,e);break;default:o=i}for(s in Be(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Re(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&Ne(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Pe(e,u):typeof u==`number`&&Pe(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&fi(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:ge(e),Ce(e,i,!1);break;case`textarea`:ge(e),Ae(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+pe(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&Ee(e,!!i.multiple,i.defaultValue,!0):Ee(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=Ei)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return mc(t),null;case 6:if(e&&t.stateNode!=null)fc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=yo(vo.current),yo(go.current),Ra(t)){if(i=t.stateNode,n=t.memoizedProps,i[zi]=t,(s=i.nodeValue!==n)&&(e=ka,e!==null))switch(e.tag){case 3:Ti(i.nodeValue,n,(e.mode&1)!=0);break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Ti(i.nodeValue,n,(e.mode&1)!=0)}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[zi]=t,t.stateNode=i}return mc(t),null;case 13:if(Qi(wo),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ja&&Aa!==null&&t.mode&1&&!(t.flags&128))za(),R(),t.flags|=98560,s=!1;else if(s=Ra(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[zi]=t}else R(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;mc(t),s=!1}else Ma!==null&&(Dl(Ma),Ma=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||wo.current&1?tl===0&&(tl=3):Ll())),t.updateQueue!==null&&(t.flags|=4),mc(t),null);case 4:return xo(),e===null&&hi(t.stateNode.containerInfo),mc(t),null;case 10:return Qa(t.type._context),mc(t),null;case 17:return aa(t.type)&&oa(),mc(t),null;case 19:if(Qi(wo),s=t.memoizedState,s===null)return mc(t),null;if(i=(t.flags&128)!=0,c=s.rendering,c===null)if(i)pc(s,!1);else{if(tl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=V(e),c!==null){for(t.flags|=128,pc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return $i(wo,wo.current&1|2),t.child}e=e.sibling}s.tail!==null&&xt()>ll&&(t.flags|=128,i=!0,pc(s,!1),t.lanes=4194304)}else{if(!i)if(e=V(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),pc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!ja)return mc(t),null}else 2*xt()-s.renderingStartTime>ll&&n!==1073741824&&(t.flags|=128,i=!0,pc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(mc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=xt(),t.sibling=null,n=wo.current,$i(wo,i?n&1|2:n&1),t);case 22:case 23:return Nl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?$c&1073741824&&(mc(t),t.subtreeFlags&6&&(t.flags|=8192)):mc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function gc(e,t){switch(Oa(t),t.tag){case 1:return aa(t.type)&&oa(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return xo(),Qi(na),Qi(ta),Eo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Co(t),null;case 13:if(Qi(wo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));R()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Qi(wo),null;case 4:return xo(),null;case 10:return Qa(t.type._context),null;case 22:case 23:return Nl(),null;case 24:return null;default:return null}}var _c=!1,vc=!1,yc=typeof WeakSet==`function`?WeakSet:Set,W=null;function bc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){ql(e,t,n)}else n.current=null}function xc(e,t,n){try{n()}catch(n){ql(e,t,n)}}var Sc=!1;function Cc(e,t){if(Di=yn,e=zr(),Br(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.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||i!==0&&f.nodeType!==3||(l=s+i),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===i&&(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(Oi={focusedElem:e,selectionRange:n},yn=!1,W=t;W!==null;)if(t=W,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,W=e;else for(;W!==null;){t=W;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:ws(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){ql(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,W=e;break}W=t.return}return h=Sc,Sc=!1,h}function wc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&xc(t,n,a)}i=i.next}while(i!==r)}}function Tc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ec(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Dc(e){var t=e.alternate;t!==null&&(e.alternate=null,Dc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[zi],delete t[Bi],delete t[Hi],delete t[Ui],delete t[Wi])),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 Oc(e){return e.tag===5||e.tag===3||e.tag===4}function kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Oc(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.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 Ac(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ei));else if(r!==4&&(e=e.child,e!==null))for(Ac(e,t,n),e=e.sibling;e!==null;)Ac(e,t,n),e=e.sibling}function jc(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&&(e=e.child,e!==null))for(jc(e,t,n),e=e.sibling;e!==null;)jc(e,t,n),e=e.sibling}var Mc=null,Nc=!1;function Pc(e,t,n){for(n=n.child;n!==null;)Fc(e,t,n),n=n.sibling}function Fc(e,t,n){if(kt&&typeof kt.onCommitFiberUnmount==`function`)try{kt.onCommitFiberUnmount(Ot,n)}catch{}switch(n.tag){case 5:vc||bc(n,t);case 6:var r=Mc,i=Nc;Mc=null,Pc(e,t,n),Mc=r,Nc=i,Mc!==null&&(Nc?(e=Mc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Mc.removeChild(n.stateNode));break;case 18:Mc!==null&&(Nc?(e=Mc,n=n.stateNode,e.nodeType===8?Fi(e.parentNode,n):e.nodeType===1&&Fi(e,n),_n(e)):Fi(Mc,n.stateNode));break;case 4:r=Mc,i=Nc,Mc=n.stateNode.containerInfo,Nc=!0,Pc(e,t,n),Mc=r,Nc=i;break;case 0:case 11:case 14:case 15:if(!vc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&xc(n,t,o),i=i.next}while(i!==r)}Pc(e,t,n);break;case 1:if(!vc&&(bc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){ql(n,t,e)}Pc(e,t,n);break;case 21:Pc(e,t,n);break;case 22:n.mode&1?(vc=(r=vc)||n.memoizedState!==null,Pc(e,t,n),vc=r):Pc(e,t,n);break;default:Pc(e,t,n)}}function Ic(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new yc),t.forEach(function(t){var r=Zl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Lc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:Mc=c.stateNode,Nc=!1;break a;case 3:Mc=c.stateNode.containerInfo,Nc=!0;break a;case 4:Mc=c.stateNode.containerInfo,Nc=!0;break a}c=c.return}if(Mc===null)throw Error(r(160));Fc(o,s,a),Mc=null,Nc=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){ql(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Rc(t,e),t=t.sibling}function Rc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Lc(t,e),zc(e),i&4){try{wc(3,e,e.return),Tc(3,e)}catch(t){ql(e,e.return,t)}try{wc(5,e,e.return)}catch(t){ql(e,e.return,t)}}break;case 1:Lc(t,e),zc(e),i&512&&n!==null&&bc(n,n.return);break;case 5:if(Lc(t,e),zc(e),i&512&&n!==null&&bc(n,n.return),e.flags&32){var a=e.stateNode;try{Pe(a,``)}catch(t){ql(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&xe(a,o),Ve(c,s);var u=Ve(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Re(a,f):d===`dangerouslySetInnerHTML`?Ne(a,f):d===`children`?Pe(a,f):S(a,d,f,u)}switch(c){case`input`:Se(a,o);break;case`textarea`:ke(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?Ee(a,!!o.multiple,o.multiple?[]:``,!1):Ee(a,!!o.multiple,o.defaultValue,!0)):Ee(a,!!o.multiple,m,!1)}a[Bi]=o}catch(t){ql(e,e.return,t)}}break;case 6:if(Lc(t,e),zc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){ql(e,e.return,t)}}break;case 3:if(Lc(t,e),zc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{_n(t.containerInfo)}catch(t){ql(e,e.return,t)}break;case 4:Lc(t,e),zc(e);break;case 13:Lc(t,e),zc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(cl=xt())),i&4&&Ic(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(vc=(u=vc)||d,Lc(t,e),vc=u):Lc(t,e),zc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(W=e,d=e.child;d!==null;){for(f=W=d;W!==null;){switch(p=W,m=p.child,p.tag){case 0:case 11:case 14:case 15:wc(4,p,p.return);break;case 1:bc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){ql(i,n,e)}}break;case 5:bc(p,p.return);break;case 22:if(p.memoizedState!==null){Uc(f);continue}}m===null?Uc(f):(m.return=p,W=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=Le(`display`,s))}catch(t){ql(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){ql(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Lc(t,e),zc(e),i&4&&Ic(e);break;case 21:break;default:Lc(t,e),zc(e)}}function zc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Oc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(Pe(a,``),i.flags&=-33),jc(e,kc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Ac(e,kc(e),o);break;default:throw Error(r(161))}}catch(t){ql(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Bc(e,t,n){W=e,Vc(e,t,n)}function Vc(e,t,n){for(var r=(e.mode&1)!=0;W!==null;){var i=W,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||_c;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||vc;s=_c;var l=vc;if(_c=o,(vc=c)&&!l)for(W=i;W!==null;)o=W,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Wc(i):(c.return=o,W=c);for(;a!==null;)W=a,Vc(a,t,n),a=a.sibling;W=i,_c=s,vc=l}Hc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,W=a):Hc(e,t,n)}}function Hc(e){for(;W!==null;){var t=W;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:vc||Tc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!vc)if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:ws(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&ho(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}ho(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&_n(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}vc||t.flags&512&&Ec(t)}catch(e){ql(t,t.return,e)}}if(t===e){W=null;break}if(n=t.sibling,n!==null){n.return=t.return,W=n;break}W=t.return}}function Uc(e){for(;W!==null;){var t=W;if(t===e){W=null;break}var n=t.sibling;if(n!==null){n.return=t.return,W=n;break}W=t.return}}function Wc(e){for(;W!==null;){var t=W;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Tc(4,t)}catch(e){ql(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){ql(t,i,e)}}var a=t.return;try{Ec(t)}catch(e){ql(t,a,e)}break;case 5:var o=t.return;try{Ec(t)}catch(e){ql(t,o,e)}}}catch(e){ql(t,t.return,e)}if(t===e){W=null;break}var s=t.sibling;if(s!==null){s.return=t.return,W=s;break}W=t.return}}var Gc=Math.ceil,Kc=C.ReactCurrentDispatcher,qc=C.ReactCurrentOwner,Jc=C.ReactCurrentBatchConfig,Yc=0,Xc=null,Zc=null,Qc=0,$c=0,el=Zi(0),tl=0,nl=null,rl=0,il=0,al=0,ol=null,sl=null,cl=0,ll=1/0,ul=null,dl=!1,fl=null,pl=null,ml=!1,hl=null,gl=0,_l=0,vl=null,yl=-1,bl=0;function xl(){return Yc&6?xt():yl===-1?yl=xt():yl}function Sl(e){return e.mode&1?Yc&2&&Qc!==0?Qc&-Qc:Va.transition===null?(e=qt,e===0?(e=window.event,e=e===void 0?16:wn(e.type),e):e):(bl===0&&(bl=Ht()),bl):1}function Cl(e,t,n,i){if(50<_l)throw _l=0,vl=null,Error(r(185));Wt(e,n,i),(!(Yc&2)||e!==Xc)&&(e===Xc&&(!(Yc&2)&&(il|=n),tl===4&&kl(e,Qc)),wl(e,i),n===1&&Yc===0&&!(t.mode&1)&&(ll=xt()+500,fa&&ga()))}function wl(e,t){var n=e.callbackNode;Bt(e,t);var r=Rt(e,e===Xc?Qc:0);if(r===0)n!==null&&vt(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&vt(n),t===1)e.tag===0?ha(Al.bind(null,e)):ma(Al.bind(null,e)),Ni(function(){!(Yc&6)&&ga()}),n=null;else{switch(Jt(r)){case 1:n=Ct;break;case 4:n=wt;break;case 16:n=Tt;break;case 536870912:n=Dt;break;default:n=Tt}n=$l(n,Tl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Tl(e,t){if(yl=-1,bl=0,Yc&6)throw Error(r(327));var n=e.callbackNode;if(Gl()&&e.callbackNode!==n)return null;var i=Rt(e,e===Xc?Qc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Rl(e,i);else{t=i;var a=Yc;Yc|=2;var o=Il();(Xc!==e||Qc!==t)&&(ul=null,ll=xt()+500,Pl(e,t));do try{Bl();break}catch(t){Fl(e,t)}while(1);Za(),Kc.current=o,Yc=a,Zc===null?(Xc=null,Qc=0,t=tl):t=0}if(t!==0){if(t===2&&(a=Vt(e),a!==0&&(i=a,t=El(e,a))),t===1)throw n=nl,Pl(e,0),kl(e,i),wl(e,xt()),n;if(t===6)kl(e,i);else{if(a=e.current.alternate,!(i&30)&&!Ol(a)&&(t=Rl(e,i),t===2&&(o=Vt(e),o!==0&&(i=o,t=El(e,o))),t===1))throw n=nl,Pl(e,0),kl(e,i),wl(e,xt()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Ul(e,sl,ul);break;case 3:if(kl(e,i),(i&130023424)===i&&(t=cl+500-xt(),10<t)){if(Rt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){xl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Ai(Ul.bind(null,e,sl,ul),t);break}Ul(e,sl,ul);break;case 4:if(kl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-jt(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=xt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Gc(i/1960))-i,10<i){e.timeoutHandle=Ai(Ul.bind(null,e,sl,ul),i);break}Ul(e,sl,ul);break;case 5:Ul(e,sl,ul);break;default:throw Error(r(329))}}}return wl(e,xt()),e.callbackNode===n?Tl.bind(null,e):null}function El(e,t){var n=ol;return e.current.memoizedState.isDehydrated&&(Pl(e,t).flags|=256),e=Rl(e,t),e!==2&&(t=sl,sl=n,t!==null&&Dl(t)),e}function Dl(e){sl===null?sl=e:sl.push.apply(sl,e)}function Ol(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(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(!Pr(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 kl(e,t){for(t&=~al,t&=~il,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-jt(t),r=1<<n;e[n]=-1,t&=~r}}function Al(e){if(Yc&6)throw Error(r(327));Gl();var t=Rt(e,0);if(!(t&1))return wl(e,xt()),null;var n=Rl(e,t);if(e.tag!==0&&n===2){var i=Vt(e);i!==0&&(t=i,n=El(e,i))}if(n===1)throw n=nl,Pl(e,0),kl(e,t),wl(e,xt()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ul(e,sl,ul),wl(e,xt()),null}function jl(e,t){var n=Yc;Yc|=1;try{return e(t)}finally{Yc=n,Yc===0&&(ll=xt()+500,fa&&ga())}}function Ml(e){hl!==null&&hl.tag===0&&!(Yc&6)&&Gl();var t=Yc;Yc|=1;var n=Jc.transition,r=qt;try{if(Jc.transition=null,qt=1,e)return e()}finally{qt=r,Jc.transition=n,Yc=t,!(Yc&6)&&ga()}}function Nl(){$c=el.current,Qi(el)}function Pl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,ji(n)),Zc!==null)for(n=Zc.return;n!==null;){var r=n;switch(Oa(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&oa();break;case 3:xo(),Qi(na),Qi(ta),Eo();break;case 5:Co(r);break;case 4:xo();break;case 13:Qi(wo);break;case 19:Qi(wo);break;case 10:Qa(r.type._context);break;case 22:case 23:Nl()}n=n.return}if(Xc=e,Zc=e=iu(e.current,null),Qc=$c=t,tl=0,nl=null,al=il=rl=0,sl=ol=null,no!==null){for(t=0;t<no.length;t++)if(n=no[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}no=null}return e}function Fl(e,t){do{var n=Zc;try{if(Za(),Do.current=bs,No){for(var i=Ao.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}No=!1}if(ko=0,Mo=jo=Ao=null,Po=!1,Fo=0,qc.current=null,n===null||n.return===null){tl=1,nl=t,Zc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Qc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=Rs(s);if(m!==null){m.flags&=-257,zs(m,s,c,o,t),m.mode&1&&Ls(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}else{if(!(t&1)){Ls(o,u,t),Ll();break a}l=Error(r(426))}}else if(ja&&c.mode&1){var _=Rs(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),zs(_,s,c,o,t),Ba(js(l,c));break a}}o=l=js(l,c),tl!==4&&(tl=2),ol===null?ol=[o]:ol.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Fs(o,l,t);po(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(pl===null||!pl.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Is(o,c,t);po(o,x);break a}}o=o.return}while(o!==null)}Hl(n)}catch(e){t=e,Zc===n&&n!==null&&(Zc=n=n.return);continue}break}while(1)}function Il(){var e=Kc.current;return Kc.current=bs,e===null?bs:e}function Ll(){(tl===0||tl===3||tl===2)&&(tl=4),Xc===null||!(rl&268435455)&&!(il&268435455)||kl(Xc,Qc)}function Rl(e,t){var n=Yc;Yc|=2;var i=Il();(Xc!==e||Qc!==t)&&(ul=null,Pl(e,t));do try{zl();break}catch(t){Fl(e,t)}while(1);if(Za(),Yc=n,Kc.current=i,Zc!==null)throw Error(r(261));return Xc=null,Qc=0,tl}function zl(){for(;Zc!==null;)Vl(Zc)}function Bl(){for(;Zc!==null&&!yt();)Vl(Zc)}function Vl(e){var t=Ql(e.alternate,e,$c);e.memoizedProps=e.pendingProps,t===null?Hl(e):Zc=t,qc.current=null}function Hl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=gc(n,t),n!==null){n.flags&=32767,Zc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{tl=6,Zc=null;return}}else if(n=hc(n,t,$c),n!==null){Zc=n;return}if(t=t.sibling,t!==null){Zc=t;return}Zc=t=e}while(t!==null);tl===0&&(tl=5)}function Ul(e,t,n){var r=qt,i=Jc.transition;try{Jc.transition=null,qt=1,Wl(e,t,n,r)}finally{Jc.transition=i,qt=r}return null}function Wl(e,t,n,i){do Gl();while(hl!==null);if(Yc&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Gt(e,o),e===Xc&&(Zc=Xc=null,Qc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ml||(ml=!0,$l(Tt,function(){return Gl(),null})),o=(n.flags&15990)!=0,n.subtreeFlags&15990||o){o=Jc.transition,Jc.transition=null;var s=qt;qt=1;var c=Yc;Yc|=4,qc.current=null,Cc(e,n),Rc(n,e),Vr(Oi),yn=!!Di,Oi=Di=null,e.current=n,Bc(n,e,a),bt(),Yc=c,qt=s,Jc.transition=o}else e.current=n;if(ml&&(ml=!1,hl=e,gl=a),o=e.pendingLanes,o===0&&(pl=null),At(n.stateNode,i),wl(e,xt()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(dl)throw dl=!1,e=fl,fl=null,e;return gl&1&&e.tag!==0&&Gl(),o=e.pendingLanes,o&1?e===vl?_l++:(_l=0,vl=e):_l=0,ga(),null}function Gl(){if(hl!==null){var e=Jt(gl),t=Jc.transition,n=qt;try{if(Jc.transition=null,qt=16>e?16:e,hl===null)var i=!1;else{if(e=hl,hl=null,gl=0,Yc&6)throw Error(r(331));var a=Yc;for(Yc|=4,W=e.current;W!==null;){var o=W,s=o.child;if(W.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(W=u;W!==null;){var d=W;switch(d.tag){case 0:case 11:case 15:wc(8,d,o)}var f=d.child;if(f!==null)f.return=d,W=f;else for(;W!==null;){d=W;var p=d.sibling,m=d.return;if(Dc(d),d===u){W=null;break}if(p!==null){p.return=m,W=p;break}W=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}W=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,W=s;else b:for(;W!==null;){if(o=W,o.flags&2048)switch(o.tag){case 0:case 11:case 15:wc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,W=v;break b}W=o.return}}var y=e.current;for(W=y;W!==null;){s=W;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,W=b;else b:for(s=y;W!==null;){if(c=W,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Tc(9,c)}}catch(e){ql(c,c.return,e)}if(c===s){W=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,W=x;break b}W=c.return}}if(Yc=a,ga(),kt&&typeof kt.onPostCommitFiberRoot==`function`)try{kt.onPostCommitFiberRoot(Ot,e)}catch{}i=!0}return i}finally{qt=n,Jc.transition=t}}return!1}function Kl(e,t,n){t=js(n,t),t=Fs(e,t,1),e=uo(e,t,1),t=xl(),e!==null&&(Wt(e,1,t),wl(e,t))}function ql(e,t,n){if(e.tag===3)Kl(e,e,n);else for(;t!==null;){if(t.tag===3){Kl(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(pl===null||!pl.has(r))){e=js(n,e),e=Is(t,e,1),t=uo(t,e,1),e=xl(),t!==null&&(Wt(t,1,e),wl(t,e));break}}t=t.return}}function Jl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=xl(),e.pingedLanes|=e.suspendedLanes&n,Xc===e&&(Qc&n)===n&&(tl===4||tl===3&&(Qc&130023424)===Qc&&500>xt()-cl?Pl(e,0):al|=n),wl(e,t)}function Yl(e,t){t===0&&(e.mode&1?(t=It,It<<=1,!(It&130023424)&&(It=4194304)):t=1);var n=xl();e=ao(e,t),e!==null&&(Wt(e,t,n),wl(e,n))}function Xl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yl(e,n)}function Zl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Yl(e,n)}var Ql=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||na.current)Vs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Vs=!1,lc(e,t,n);Vs=!!(e.flags&131072)}else Vs=!1,ja&&t.flags&1048576&&Ea(t,ba,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;sc(e,t),e=t.pendingProps;var a=ia(t,ta.current);eo(t,n),a=zo(null,t,i,e,a,n);var o=Bo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,aa(i)?(o=!0,la(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,so(t),a.updater=Es,t.stateNode=a,a._reactInternals=t,As(t,i,e,n),t=Xs(null,t,i,!0,o,n)):(t.tag=0,ja&&o&&Da(t),Hs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(sc(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=ru(i),e=ws(i,e),a){case 0:t=Js(null,t,i,e,n);break a;case 1:t=Ys(null,t,i,e,n);break a;case 11:t=Us(null,t,i,e,n);break a;case 14:t=Ws(null,t,i,ws(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ws(i,a),Js(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ws(i,a),Ys(e,t,i,a,n);case 3:a:{if(Zs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,co(e,t),mo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=js(Error(r(423)),t),t=Qs(e,t,i,n,a);break a}else if(i!==a){a=js(Error(r(424)),t),t=Qs(e,t,i,n,a);break a}else for(Aa=Ii(t.stateNode.containerInfo.firstChild),ka=t,ja=!0,Ma=null,n=Ka(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(R(),i===a){t=cc(e,t,n);break a}Hs(e,t,i,n)}t=t.child}return t;case 5:return So(t),e===null&&Ia(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,ki(i,a)?s=null:o!==null&&ki(i,o)&&(t.flags|=32),qs(e,t),Hs(e,t,s,n),t.child;case 6:return e===null&&Ia(t),null;case 13:return tc(e,t,n);case 4:return bo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ga(t,null,i,n):Hs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ws(i,a),Us(e,t,i,a,n);case 7:return Hs(e,t,t.pendingProps,n),t.child;case 8:return Hs(e,t,t.pendingProps.children,n),t.child;case 12:return Hs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,$i(qa,i._currentValue),i._currentValue=s,o!==null)if(Pr(o.value,s)){if(o.children===a.children&&!na.current){t=cc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=lo(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),$a(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),$a(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Hs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,eo(t,n),a=to(a),i=i(a),t.flags|=1,Hs(e,t,i,n),t.child;case 14:return i=t.type,a=ws(i,t.pendingProps),a=ws(i.type,a),Ws(e,t,i,a,n);case 15:return Gs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ws(i,a),sc(e,t),t.tag=1,aa(i)?(e=!0,la(t)):e=!1,eo(t,n),Os(t,i,a),As(t,i,a,n),Xs(null,t,i,!0,e,n);case 19:return oc(e,t,n);case 22:return Ks(e,t,n)}throw Error(r(156,t.tag))};function $l(e,t){return _t(e,t)}function eu(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.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 tu(e,t,n,r){return new eu(e,t,n,r)}function nu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ru(e){if(typeof e==`function`)return+!!nu(e);if(e!=null){if(e=e.$$typeof,e===A)return 11;if(e===j)return 14}return 2}function iu(e,t){var n=e.alternate;return n===null?(n=tu(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&14680064,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}function au(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)nu(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return ou(n.children,a,o,t);case D:s=8,a|=8;break;case ee:return e=tu(12,n,t,a|2),e.elementType=ee,e.lanes=o,e;case te:return e=tu(13,n,t,a),e.elementType=te,e.lanes=o,e;case ne:return e=tu(19,n,t,a),e.elementType=ne,e.lanes=o,e;case re:return su(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case O:s=10;break a;case k:s=9;break a;case A:s=11;break a;case j:s=14;break a;case M:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=tu(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function ou(e,t,n,r){return e=tu(7,e,r,t),e.lanes=n,e}function su(e,t,n,r){return e=tu(22,e,r,t),e.elementType=re,e.lanes=n,e.stateNode={isHidden:!1},e}function cu(e,t,n){return e=tu(6,e,null,t),e.lanes=n,e}function lu(e,t,n){return t=tu(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function uu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ut(0),this.expirationTimes=Ut(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ut(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function du(e,t,n,r,i,a,o,s,c){return e=new uu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=tu(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},so(a),e}function fu(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function pu(e){if(!e)return ea;e=e._reactInternals;a:{if(dt(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(aa(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(aa(n))return ca(e,n,t)}return t}function mu(e,t,n,r,i,a,o,s,c){return e=du(n,r,!0,e,i,a,o,s,c),e.context=pu(null),n=e.current,r=xl(),i=Sl(n),a=lo(r,i),a.callback=t??null,uo(n,a,i),e.current.lanes=i,Wt(e,i,r),wl(e,r),e}function hu(e,t,n,r){var i=t.current,a=xl(),o=Sl(i);return n=pu(n),t.context===null?t.context=n:t.pendingContext=n,t=lo(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=uo(i,t,o),e!==null&&(Cl(e,i,o,a),fo(e,i,o)),o}function gu(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function _u(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function vu(e,t){_u(e,t),(e=e.alternate)&&_u(e,t)}function yu(){return null}var bu=typeof reportError==`function`?reportError:function(e){console.error(e)};function xu(e){this._internalRoot=e}Su.prototype.render=xu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));hu(e,t,null,null)},Su.prototype.unmount=xu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ml(function(){hu(null,e,null,null)}),t[Vi]=null}};function Su(e){this._internalRoot=e}Su.prototype.unstable_scheduleHydration=function(e){if(e){var t=Qt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<sn.length&&t!==0&&t<sn[n].priority;n++);sn.splice(n,0,e),n===0&&fn(e)}};function Cu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function wu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function Tu(){}function Eu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=gu(o);a.call(e)}}var o=mu(t,r,e,0,null,!1,!1,``,Tu);return e._reactRootContainer=o,e[Vi]=o.current,hi(e.nodeType===8?e.parentNode:e),Ml(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=gu(c);s.call(e)}}var c=du(e,0,!1,null,null,!1,!1,``,Tu);return e._reactRootContainer=c,e[Vi]=c.current,hi(e.nodeType===8?e.parentNode:e),Ml(function(){hu(t,c,n,r)}),c}function Du(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=gu(o);s.call(e)}}hu(t,o,e,i)}else o=Eu(n,t,e,i,r);return gu(o)}Yt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Lt(t.pendingLanes);n!==0&&(Kt(t,n|1),wl(t,xt()),!(Yc&6)&&(ll=xt()+500,ga()))}break;case 13:Ml(function(){var t=ao(e,1);t!==null&&Cl(t,e,1,xl())}),vu(e,1)}},Xt=function(e){if(e.tag===13){var t=ao(e,134217728);t!==null&&Cl(t,e,134217728,xl()),vu(e,134217728)}},Zt=function(e){if(e.tag===13){var t=Sl(e),n=ao(e,t);n!==null&&Cl(n,e,t,xl()),vu(e,t)}},Qt=function(){return qt},$t=function(e,t){var n=qt;try{return qt=e,t()}finally{qt=n}},We=function(e,t,n){switch(t){case`input`:if(Se(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Ji(i);if(!a)throw Error(r(90));_e(i),Se(i,a)}}}break;case`textarea`:ke(e,n);break;case`select`:t=n.value,t!=null&&Ee(e,!!n.multiple,t,!1)}},Xe=jl,Ze=Ml;var Ou={usingClientEntryPoint:!1,Events:[Ki,qi,Ji,Je,Ye,jl]},ku={findFiberByHostInstance:Gi,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},Au={bundleType:ku.bundleType,version:ku.version,rendererPackageName:ku.rendererPackageName,rendererConfig:ku.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ht(e),e===null?null:e.stateNode},findFiberByHostInstance:ku.findFiberByHostInstance||yu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var ju=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ju.isDisabled&&ju.supportsFiber)try{Ot=ju.inject(Au),kt=ju}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ou,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Cu(t))throw Error(r(200));return fu(e,t,null,n)},e.createRoot=function(e,t){if(!Cu(e))throw Error(r(299));var n=!1,i=``,a=bu;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=du(e,1,!1,null,null,n,!1,i,a),e[Vi]=t.current,hi(e.nodeType===8?e.parentNode:e),new xu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return 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=ht(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return Ml(e)},e.hydrate=function(e,t,n){if(!wu(t))throw Error(r(200));return Du(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!Cu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=bu;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=mu(t,null,e,1,n??null,a,!1,o,s),e[Vi]=t.current,hi(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new Su(t)},e.render=function(e,t,n){if(!wu(t))throw Error(r(200));return Du(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!wu(e))throw Error(r(40));return e._reactRootContainer?(Ml(function(){Du(null,null,e,!1,function(){e._reactRootContainer=null,e[Vi]=null})}),!0):!1},e.unstable_batchedUpdates=jl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!wu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return Du(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),h=o(((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=m()})),g=o((e=>{var t=h();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),_=l(d()),v=l(g());function y(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 b={};function x(){return typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:b}var S=Object.assign,C=Object.getOwnPropertyDescriptor,w=Object.defineProperty,T=Object.prototype,E=[];Object.freeze(E);var D={};Object.freeze(D);var ee=typeof Proxy<`u`,O=Object.toString();function k(){ee||y(`Proxy not available`)}function A(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var te=function(){};function ne(e){return typeof e==`function`}function j(e){switch(typeof e){case`string`:case`symbol`:case`number`:return!0}return!1}function M(e){return typeof e==`object`&&!!e}function re(e){if(!M(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()===O}function ie(e){var t=e?.constructor;return t?t.name===`GeneratorFunction`||t.displayName===`GeneratorFunction`:!1}function ae(e,t,n){w(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function oe(e,t,n){w(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function N(e,t){var n=`isMobX`+e;return t.prototype[n]=!0,function(e){return M(e)&&e[n]===!0}}function se(e){return e!=null&&Object.prototype.toString.call(e)===`[object Map]`}function ce(e){return Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(e)))===null}function le(e){return e!=null&&Object.prototype.toString.call(e)===`[object Set]`}var ue=Object.getOwnPropertySymbols!==void 0;function de(e){var t=Object.keys(e);if(!ue)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(t){return T.propertyIsEnumerable.call(e,t)})):t}var fe=typeof Reflect<`u`&&Reflect.ownKeys?Reflect.ownKeys:ue?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function pe(e){return e===null?null:typeof e==`object`?``+e:e}function me(e,t){return T.hasOwnProperty.call(e,t)}var he=Object.getOwnPropertyDescriptors||function(e){var t={};return fe(e).forEach(function(n){t[n]=C(e,n)}),t};function ge(e,t){return!!(e&t)}function _e(e,t,n){return n?e|=t:e&=~t,e}function ve(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 ye(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,Ee(r.key),r)}}function be(e,t,n){return t&&ye(e.prototype,t),n&&ye(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function xe(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=De(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.
|
|
10
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Se(){return Se=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},Se.apply(null,arguments)}function Ce(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,we(e,t)}function we(e,t){return we=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},we(e,t)}function Te(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 Ee(e){var t=Te(e,`string`);return typeof t==`symbol`?t:t+``}function De(e,t){if(e){if(typeof e==`string`)return ve(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)?ve(e,t):void 0}}var Oe=Symbol(`mobx-stored-annotations`);function ke(e){function t(t,n){if(Me(n))return e.decorate_20223_(t,n);Ae(t,n,e)}return Object.assign(t,e)}function Ae(e,t,n){me(e,Oe)||ae(e,Oe,Se({},e[Oe])),Ke(n)||(e[Oe][t]=n)}function je(e){return me(e,Oe)||ae(e,Oe,Se({},e[Oe])),e[Oe]}function Me(e){return typeof e==`object`&&typeof e.kind==`string`}var P=Symbol(`mobx administration`),Ne=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_=F.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 Dn(this)},t.reportChanged=function(){Tn(),On(this),En()},t.toString=function(){return this.name_},be(e,[{key:`isBeingObserved`,get:function(){return ge(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=_e(this.flags_,e.isBeingObservedMask_,t)}},{key:`isPendingUnobservation`,get:function(){return ge(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=_e(this.flags_,e.isPendingUnobservationMask_,t)}},{key:`diffValue`,get:function(){return+!!ge(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=_e(this.flags_,e.diffValueMask_,t===1)}}])}();Ne.isBeingObservedMask_=1,Ne.isPendingUnobservationMask_=2,Ne.diffValueMask_=4;var Pe=N(`Atom`,Ne);function Fe(e,t,n){t===void 0&&(t=te),n===void 0&&(n=te);var r=new Ne(e);return t!==te&&sr(r,t),n!==te&&cr(r,n),r}function Ie(e,t){return e===t}function Le(e,t){return Ki(e,t)}function Re(e,t){return Ki(e,t,1)}function ze(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e==1/t:e!==e&&t!==t}var Be={identity:Ie,structural:Le,default:ze,shallow:Re};function Ve(e,t,n){return Ar(e)?e:Array.isArray(e)?It.array(e,{name:n}):re(e)?It.object(e,void 0,{name:n}):se(e)?It.map(e,{name:n}):le(e)?It.set(e,{name:n}):typeof e==`function`&&!$n(e)&&!wr(e)?ie(e)?Sr(e):Zn(n,e):e}function He(e,t,n){if(e==null||ki(e)||di(e)||gi(e)||xi(e))return e;if(Array.isArray(e))return It.array(e,{name:n,deep:!1});if(re(e))return It.object(e,void 0,{name:n,deep:!1});if(se(e))return It.map(e,{name:n,deep:!1});if(le(e))return It.set(e,{name:n,deep:!1})}function Ue(e){return e}function We(e,t){return Ki(e,t)?t:e}var Ge=`override`;function Ke(e){return e.annotationType_===Ge}function qe(e,t){return{annotationType_:e,options_:t,make_:Je,extend_:Ye,decorate_20223_:Xe}}function Je(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:$n(n.value)?1:(w(r,t,Qe(e,this,t,n,!1)),2)}function Ye(e,t,n,r){var i=Qe(e,this,t,n);return e.defineProperty_(t,i,r)}function Xe(e,t){var n=t.kind,r=t.name,i=t.addInitializer,a=this,o=function(e){return Kt(a.options_?.name??r.toString(),e,a.options_?.autoAction??!1)};if(n==`field`)return function(e){var t,n=e;return $n(n)||(n=o(n)),(t=a.options_)!=null&&t.bound&&(n=n.bind(this),n.isMobxAction=!0),n};if(n==`method`){var s;return $n(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}y(`Cannot apply '`+a.annotationType_+`' to '`+String(r)+`' (kind: `+n+`):`+(`
|
|
11
|
-
'`+a.annotationType_+`' can only be used on properties with a function value.`))}function Ze(e,t,n,r){t.annotationType_,r.value}function Qe(e,t,n,r,i){var a,o;i===void 0&&(i=I.safeDescriptors),Ze(e,t,n,r);var s=r.value;return(a=t.options_)!=null&&a.bound&&(s=s.bind(e.proxy_??e.target_)),{value:Kt(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_:!0,enumerable:!1,writable:!i}}function $e(e,t){return{annotationType_:e,options_:t,make_:et,extend_:tt,decorate_20223_:nt}}function et(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&&(!me(e.target_,t)||!wr(e.target_[t]))&&this.extend_(e,t,n,!1)===null?0:wr(n.value)?1:(w(r,t,it(e,this,t,n,!1,!1)),2)}function tt(e,t,n,r){var i=it(e,this,t,n,this.options_?.bound);return e.defineProperty_(t,i,r)}function nt(e,t){var n,r=t.name,i=t.addInitializer;return wr(e)||(e=Sr(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 rt(e,t,n,r){t.annotationType_,r.value}function it(e,t,n,r,i,a){a===void 0&&(a=I.safeDescriptors),rt(e,t,n,r);var o=r.value;return wr(o)||(o=Sr(o)),i&&(o=o.bind(e.proxy_??e.target_),o.isMobXFlow=!0),{value:o,configurable:a?e.isPlainObject_:!0,enumerable:!1,writable:!a}}function at(e,t){return{annotationType_:e,options_:t,make_:ot,extend_:st,decorate_20223_:ct}}function ot(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function st(e,t,n,r){return lt(e,this,t,n),e.defineComputedProperty_(t,Se({},this.options_,{get:n.get,set:n.set}),r)}function ct(e,t){var n=this,r=t.name,i=t.addInitializer;return i(function(){var t=Ei(this)[P],i=Se({},n.options_,{get:e,context:this});i.name||=`ObservableObject.`+r.toString(),t.values_.set(r,new tn(i))}),function(){return this[P].getObservablePropValue_(r)}}function lt(e,t,n,r){t.annotationType_,r.get}function ut(e,t){return{annotationType_:e,options_:t,make_:dt,extend_:ft,decorate_20223_:pt}}function dt(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function ft(e,t,n,r){return mt(e,this,t,n),e.defineObservableProperty_(t,n.value,this.options_?.enhancer??Ve,r)}function pt(e,t){var n=this,r=t.kind,i=t.name,a=new WeakSet;function o(e,t){var r=Ei(e)[P],o=new $t(t,n.options_?.enhancer??Ve,`ObservableObject.`+i.toString(),!1);r.values_.set(i,o),a.add(e)}if(r==`accessor`)return{get:function(){return a.has(this)||o(this,e.get.call(this)),this[P].getObservablePropValue_(i)},set:function(e){return a.has(this)||o(this,e),this[P].setObservablePropValue_(i,e)},init:function(e){return a.has(this)||o(this,e),e}}}function mt(e,t,n,r){t.annotationType_}var ht=`true`,gt=_t();function _t(e){return{annotationType_:ht,options_:e,make_:vt,extend_:yt,decorate_20223_:bt}}function vt(e,t,n,r){var i;if(n.get)return Vt.make_(e,t,n,r);if(n.set){var a=$n(n.set)?n.set:Kt(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:I.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(w(r,t,{configurable:!0,set:a}),2)}if(r!==e.target_&&typeof n.value==`function`){var o;if(ie(n.value)){var s;return((s=this.options_)!=null&&s.autoBind?Sr.bound:Sr).make_(e,t,n,r)}return((o=this.options_)!=null&&o.autoBind?Zn.bound:Zn).make_(e,t,n,r)}var c=this.options_?.deep===!1?It.ref:It;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 yt(e,t,n,r){var i;return n.get?Vt.extend_(e,t,n,r):n.set?e.defineProperty_(t,{configurable:I.safeDescriptors?e.isPlainObject_:!0,set:Kt(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?It.ref:It).extend_(e,t,n,r))}function bt(e,t){y(`'`+this.annotationType_+`' cannot be used as a decorator`)}var xt=`observable`,St=`observable.ref`,Ct=`observable.shallow`,wt=`observable.struct`,Tt={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Tt);function Et(e){return e||Tt}var Dt=ut(xt),Ot=ut(St,{enhancer:Ue}),kt=ut(Ct,{enhancer:He}),At=ut(wt,{enhancer:We}),jt=ke(Dt);function Mt(e){return e.deep===!0?Ve:e.deep===!1?Ue:Pt(e.defaultDecorator)}function Nt(e){return e?e.defaultDecorator??_t(e):void 0}function Pt(e){return e?e.options_?.enhancer??Ve:Ve}function Ft(e,t,n){if(Me(t))return Dt.decorate_20223_(e,t);if(j(t)){Ae(e,t,Dt);return}return Ar(e)?e:re(e)?It.object(e,t,n):Array.isArray(e)?It.array(e,t):se(e)?It.map(e,t):le(e)?It.set(e,t):typeof e==`object`&&e?e:It.box(e,t)}S(Ft,jt);var It=S(Ft,{box:function(e,t){var n=Et(t);return new $t(e,Mt(n),n.name,!0,n.equals)},array:function(e,t){var n=Et(t);return(I.useProxies===!1||n.proxy===!1?Bi:ii)(e,Mt(n),n.name)},map:function(e,t){var n=Et(t);return new hi(e,Mt(n),n.name)},set:function(e,t){var n=Et(t);return new bi(e,Mt(n),n.name)},object:function(e,t,n){return Wi(function(){return mr(I.useProxies===!1||n?.proxy===!1?Ei({},n):Gr({},n),e,t)})},ref:ke(Ot),shallow:ke(kt),deep:jt,struct:ke(At)}),Lt=`computed`,Rt=`computed.struct`,zt=at(Lt),Bt=at(Rt,{equals:Be.structural}),Vt=function(e,t){if(Me(t))return zt.decorate_20223_(e,t);if(j(t))return Ae(e,t,zt);if(re(e))return ke(at(Lt,e));var n=re(t)?t:{};return n.get=e,n.name||=e.name||``,new tn(n)};Object.assign(Vt,zt),Vt.struct=ke(Bt);var Ht=0,Ut=1,Wt=C(function(){},`name`)?.configurable??!1,Gt={value:`action`,configurable:!0,writable:!1,enumerable:!1};function Kt(e,t,n,r){n===void 0&&(n=!1);function i(){return qt(e,n,t,r||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},Wt&&(Gt.value=e,w(i,`name`,Gt)),i}function qt(e,t,n,r,i){var a=Jt(e,t,r,i);try{return n.apply(r,i)}catch(e){throw a.error_=e,e}finally{Yt(a)}}function Jt(e,t,n,r){var i=!1,a=0,o=I.trackingDerivation,s=!t||!o;Tn();var c=I.allowStateChanges;s&&(fn(),c=Zt(!0));var l=mn(!0),u={runAsAction_:s,prevDerivation_:o,prevAllowStateChanges_:c,prevAllowStateReads_:l,notifySpy_:i,startTime_:a,actionId_:Ut++,parentActionId_:Ht};return Ht=u.actionId_,u}function Yt(e){Ht!==e.actionId_&&y(30),Ht=e.parentActionId_,e.error_!==void 0&&(I.suppressReactionErrors=!0),Qt(e.prevAllowStateChanges_),hn(e.prevAllowStateReads_),En(),e.runAsAction_&&pn(e.prevDerivation_),I.suppressReactionErrors=!1}function Xt(e,t){var n=Zt(e);try{return t()}finally{Qt(n)}}function Zt(e){var t=I.allowStateChanges;return I.allowStateChanges=e,t}function Qt(e){I.allowStateChanges=e}var $t=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=Be.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}Ce(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!==I.UNCHANGED&&this.setNewValue_(e)},n.prepareNewValue_=function(e){if(Kr(this)){var t=Jr(this,{object:this,type:ei,newValue:e});if(!t)return I.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?I.UNCHANGED:e},n.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),Yr(this)&&Zr(this,{type:ei,object:this,newValue:e,oldValue:t})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(e){return qr(this,e)},n.observe_=function(e,t){return t&&e({observableKind:`value`,debugObjectName:this.name_,object:this,type:ei,newValue:this.value_,oldValue:void 0}),Xr(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 pe(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Ne),en=N(`ObservableValue`,$t),tn=function(){function e(e){this.dependenciesState_=F.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=F.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new an(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=rn.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||y(31),this.derivation=e.get,this.name_=e.name||`ComputedValue`,e.set&&(this.setter_=Kt(`ComputedValue-setter`,e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?Be.structural:Be.default),this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){An(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&&y(32,this.name_,this.derivation),I.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)sn(this)&&(this.warnAboutUntrackedRead_(),Tn(),this.value_=this.computeValue_(!1),En());else if(Dn(this),sn(this)){var e=I.trackingContext;this.keepAlive_&&!e&&(I.trackingContext=this),this.trackAndCompute()&&kn(this),I.trackingContext=e}var t=this.value_;if(on(t))throw t.cause;return t},t.set=function(e){if(this.setter_){this.isRunningSetter&&y(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter=!1}}else y(34,this.name_)},t.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===F.NOT_TRACKING_,n=this.computeValue_(!0),r=t||on(e)||on(n)||!this.equals_(e,n);return r&&(this.value_=n),r},t.computeValue_=function(e){this.isComputing=!0;var t=Zt(!1),n;if(e)n=cn(this,this.derivation,this.scope_);else if(I.disableErrorBoundaries===!0)n=this.derivation.call(this.scope_);else try{n=this.derivation.call(this.scope_)}catch(e){n=new an(e)}return Qt(t),this.isComputing=!1,n},t.suspend_=function(){this.keepAlive_||(un(this),this.value_=void 0)},t.observe_=function(e,t){var n=this,r=!0,i=void 0;return er(function(){var a=n.get();if(!r||t){var o=fn();e({observableKind:`computed`,debugObjectName:n.name_,type:ei,object:n,newValue:a,oldValue:i}),pn(o)}r=!1,i=a})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+`[`+this.derivation.toString()+`]`},t.valueOf=function(){return pe(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},be(e,[{key:`isComputing`,get:function(){return ge(this.flags_,e.isComputingMask_)},set:function(t){this.flags_=_e(this.flags_,e.isComputingMask_,t)}},{key:`isRunningSetter`,get:function(){return ge(this.flags_,e.isRunningSetterMask_)},set:function(t){this.flags_=_e(this.flags_,e.isRunningSetterMask_,t)}},{key:`isBeingObserved`,get:function(){return ge(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=_e(this.flags_,e.isBeingObservedMask_,t)}},{key:`isPendingUnobservation`,get:function(){return ge(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=_e(this.flags_,e.isPendingUnobservationMask_,t)}},{key:`diffValue`,get:function(){return+!!ge(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=_e(this.flags_,e.diffValueMask_,t===1)}}])}();tn.isComputingMask_=1,tn.isRunningSetterMask_=2,tn.isBeingObservedMask_=4,tn.isPendingUnobservationMask_=8,tn.diffValueMask_=16;var nn=N(`ComputedValue`,tn),F;(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_`})(F||={});var rn;(function(e){e[e.NONE=0]=`NONE`,e[e.LOG=1]=`LOG`,e[e.BREAK=2]=`BREAK`})(rn||={});var an=function(e){this.cause=void 0,this.cause=e};function on(e){return e instanceof an}function sn(e){switch(e.dependenciesState_){case F.UP_TO_DATE_:return!1;case F.NOT_TRACKING_:case F.STALE_:return!0;case F.POSSIBLY_STALE_:for(var t=mn(!0),n=fn(),r=e.observing_,i=r.length,a=0;a<i;a++){var o=r[a];if(nn(o)){if(I.disableErrorBoundaries)o.get();else try{o.get()}catch{return pn(n),hn(t),!0}if(e.dependenciesState_===F.STALE_)return pn(n),hn(t),!0}}return gn(e),pn(n),hn(t),!1}}function cn(e,t,n){var r=mn(!0);gn(e),e.newObserving_=Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++I.runId;var i=I.trackingDerivation;I.trackingDerivation=e,I.inBatch++;var a;if(I.disableErrorBoundaries===!0)a=t.call(n);else try{a=t.call(n)}catch(e){a=new an(e)}return I.inBatch--,I.trackingDerivation=i,ln(e),hn(r),a}function ln(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=F.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&&Cn(c,e),c.diffValue=0}for(;i--;){var l=n[i];l.diffValue===1&&(l.diffValue=0,Sn(l,e))}r!==F.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function un(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Cn(t[n],e);e.dependenciesState_=F.NOT_TRACKING_}function dn(e){var t=fn();try{return e()}finally{pn(t)}}function fn(){var e=I.trackingDerivation;return I.trackingDerivation=null,e}function pn(e){I.trackingDerivation=e}function mn(e){var t=I.allowStateReads;return I.allowStateReads=e,t}function hn(e){I.allowStateReads=e}function gn(e){if(e.dependenciesState_!==F.UP_TO_DATE_){e.dependenciesState_=F.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=F.UP_TO_DATE_}}var _n=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},vn=!0,yn=!1,I=function(){var e=x();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(vn=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new _n().version&&(vn=!1),vn?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new _n):(setTimeout(function(){yn||y(35)},1),new _n)}();function bn(){if((I.pendingReactions.length||I.inBatch||I.isRunningReactions)&&y(36),yn=!0,vn){var e=x();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),I=new _n}}function xn(){return I}function Sn(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Cn(e,t){e.observers_.delete(t),e.observers_.size===0&&wn(e)}function wn(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,I.pendingUnobservations.push(e))}function Tn(){I.inBatch++}function En(){if(--I.inBatch===0){Pn();for(var e=I.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 tn&&n.suspend_())}I.pendingUnobservations=[]}}function Dn(e){var t=I.trackingDerivation;return t===null?(e.observers_.size===0&&I.inBatch>0&&wn(e),!1):(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&I.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved)}function On(e){e.lowestObserverState_!==F.STALE_&&(e.lowestObserverState_=F.STALE_,e.observers_.forEach(function(e){e.dependenciesState_===F.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=F.STALE_}))}function kn(e){e.lowestObserverState_!==F.STALE_&&(e.lowestObserverState_=F.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===F.POSSIBLY_STALE_?t.dependenciesState_=F.STALE_:t.dependenciesState_===F.UP_TO_DATE_&&(e.lowestObserverState_=F.UP_TO_DATE_)}))}function An(e){e.lowestObserverState_===F.UP_TO_DATE_&&(e.lowestObserverState_=F.POSSIBLY_STALE_,e.observers_.forEach(function(e){e.dependenciesState_===F.UP_TO_DATE_&&(e.dependenciesState_=F.POSSIBLY_STALE_,e.onBecomeStale_())}))}var jn=function(){function e(e,t,n,r){e===void 0&&(e=`Reaction`),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=F.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=rn.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,I.pendingReactions.push(this),Pn())},t.runReaction_=function(){if(!this.isDisposed){Tn(),this.isScheduled=!1;var e=I.trackingContext;if(I.trackingContext=this,sn(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}I.trackingContext=e,En()}},t.track=function(e){if(!this.isDisposed){Tn(),this.isRunning=!0;var t=I.trackingContext;I.trackingContext=this;var n=cn(this,e,void 0);I.trackingContext=t,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&un(this),on(n)&&this.reportExceptionInDerivation_(n.cause),En()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_){this.errorHandler_(e,this);return}if(I.disableErrorBoundaries)throw e;var n=`[mobx] uncaught error in '`+this+`'`;I.suppressReactionErrors||console.error(n,e),I.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Tn(),un(this),En()))},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[P]=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)},be(e,[{key:`isDisposed`,get:function(){return ge(this.flags_,e.isDisposedMask_)},set:function(t){this.flags_=_e(this.flags_,e.isDisposedMask_,t)}},{key:`isScheduled`,get:function(){return ge(this.flags_,e.isScheduledMask_)},set:function(t){this.flags_=_e(this.flags_,e.isScheduledMask_,t)}},{key:`isTrackPending`,get:function(){return ge(this.flags_,e.isTrackPendingMask_)},set:function(t){this.flags_=_e(this.flags_,e.isTrackPendingMask_,t)}},{key:`isRunning`,get:function(){return ge(this.flags_,e.isRunningMask_)},set:function(t){this.flags_=_e(this.flags_,e.isRunningMask_,t)}},{key:`diffValue`,get:function(){return+!!ge(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=_e(this.flags_,e.diffValueMask_,t===1)}}])}();jn.isDisposedMask_=1,jn.isScheduledMask_=2,jn.isTrackPendingMask_=4,jn.isRunningMask_=8,jn.diffValueMask_=16;var Mn=100,Nn=function(e){return e()};function Pn(){I.inBatch>0||I.isRunningReactions||Nn(Fn)}function Fn(){I.isRunningReactions=!0;for(var e=I.pendingReactions,t=0;e.length>0;){++t===Mn&&(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_()}I.isRunningReactions=!1}var In=N(`Reaction`,jn);function Ln(e){var t=Nn;Nn=function(n){return e(function(){return t(n)})}}function Rn(){return!1}function zn(e){return console.warn(`[mobx.spy] Is a no-op in production builds`),function(){}}var Bn=`action`,Vn=`action.bound`,Hn=`autoAction`,Un=`autoAction.bound`,Wn=`<unnamed action>`,Gn=qe(Bn),Kn=qe(Vn,{bound:!0}),qn=qe(Hn,{autoAction:!0}),Jn=qe(Un,{autoAction:!0,bound:!0});function Yn(e){return function(t,n){if(ne(t))return Kt(t.name||Wn,t,e);if(ne(n))return Kt(t,n,e);if(Me(n))return(e?qn:Gn).decorate_20223_(t,n);if(j(n))return Ae(t,n,e?qn:Gn);if(j(t))return ke(qe(e?Hn:Bn,{name:t,autoAction:e}))}}var Xn=Yn(!1);Object.assign(Xn,Gn);var Zn=Yn(!0);Object.assign(Zn,qn),Xn.bound=ke(Kn),Zn.bound=ke(Jn);function Qn(e){return qt(e.name||Wn,!1,e,this,void 0)}function $n(e){return ne(e)&&e.isMobxAction===!0}function er(e,t){var n;t===void 0&&(t=D);var r=t?.name??`Autorun`,i=!t.scheduler&&!t.delay,a;if(i)a=new jn(r,function(){this.track(c)},t.onError,t.requiresObservable);else{var o=nr(t),s=!1;a=new jn(r,function(){s||(s=!0,o(function(){s=!1,a.isDisposed||a.track(c)}))},t.onError,t.requiresObservable)}function c(){e(a)}return(n=t)!=null&&(n=n.signal)!=null&&n.aborted||a.schedule_(),a.getDisposer_(t?.signal)}var tr=function(e){return e()};function nr(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:tr}function rr(e,t,n){var r;n===void 0&&(n=D);var i=n.name??`Reaction`,a=Xn(i,n.onError?ir(n.onError,t):t),o=!n.scheduler&&!n.delay,s=nr(n),c=!0,l=!1,u,d=n.compareStructural?Be.structural:n.equals||Be.default,f=new jn(i,function(){c||o?p():l||(l=!0,s(p))},n.onError,n.requiresObservable);function p(){if(l=!1,!f.isDisposed){var t=!1,r=u;f.track(function(){var n=Xt(!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 ir(e,t){return function(){try{return t.apply(this,arguments)}catch(t){e.call(this,t)}}}var ar=`onBO`,or=`onBUO`;function sr(e,t,n){return lr(ar,e,t,n)}function cr(e,t,n){return lr(or,e,t,n)}function lr(e,t,n,r){var i=typeof r==`function`?Vi(t,n):Vi(t),a=ne(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 ur=`never`,dr=`always`,fr=`observed`;function pr(e){e.isolateGlobalState===!0&&bn();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(I.useProxies=t===dr?!0:t===ur?!1:typeof Proxy<`u`),t===`ifavailable`&&(I.verifyProxies=!0),n!==void 0){var r=n===dr?dr:n===fr;I.enforceActions=r,I.allowStateChanges=!(r===!0||r===dr)}[`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`disableErrorBoundaries`,`safeDescriptors`].forEach(function(t){t in e&&(I[t]=!!e[t])}),I.allowStateReads=!I.observableRequiresReaction,e.reactionScheduler&&Ln(e.reactionScheduler)}function mr(e,t,n,r){var i=he(t);return Wi(function(){var t=Ei(e,r)[P];fe(i).forEach(function(e){t.extend_(e,i[e],n&&e in n?n[e]:!0)})}),e}function hr(e,t){return gr(Vi(e,t))}function gr(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=_r(e.observing_).map(gr)),t}function _r(e){return Array.from(new Set(e))}var vr=0;function yr(){this.message=`FLOW_CANCELLED`}yr.prototype=Object.create(Error.prototype);var br=$e(`flow`),xr=$e(`flow.bound`,{bound:!0}),Sr=Object.assign(function(e,t){if(Me(t))return br.decorate_20223_(e,t);if(j(t))return Ae(e,t,br);var n=e,r=n.name||`<unnamed flow>`,i=function(){var e=this,t=arguments,i=++vr,a=Xn(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=Xn(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=Xn(r+` - runid: `+i+` - yield `+ n++,a.throw).call(a,e)}catch(e){return t(e)}u(o)}function u(n){if(ne(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=Xn(r+` - runid: `+i+` - cancel`,function(){try{s&&Cr(s);var e=a.return(void 0),t=Promise.resolve(e.value);t.then(te,te),Cr(t),o(new yr)}catch(e){o(e)}}),c};return i.isMobXFlow=!0,i},br);Sr.bound=ke(xr);function Cr(e){ne(e.cancel)&&e.cancel()}function wr(e){return e?.isMobXFlow===!0}function Tr(e,t,n){var r;return gi(e)||di(e)||en(e)?r=Hi(e):ki(e)&&(r=Hi(e,t)),r.dehancer=typeof t==`function`?t:n,function(){r.dehancer=void 0}}function Er(e,t,n){return ne(n)?Or(e,t,n):Dr(e,t)}function Dr(e,t){return Hi(e).intercept_(t)}function Or(e,t,n){return Hi(e,t).intercept_(n)}function kr(e,t){return e?t===void 0?ki(e)||!!e[P]||Pe(e)||In(e)||nn(e):ki(e)?e[P].values_.has(t):!1:!1}function Ar(e){return kr(e)}function jr(e){if(ki(e))return e[P].keys_();if(gi(e)||xi(e))return Array.from(e.keys());if(di(e))return e.map(function(e,t){return t});y(5)}function Mr(e){if(ki(e))return jr(e).map(function(t){return e[t]});if(gi(e))return jr(e).map(function(t){return e.get(t)});if(xi(e))return Array.from(e.values());if(di(e))return e.slice();y(6)}function Nr(e){if(ki(e))return jr(e).map(function(t){return[t,e[t]]});if(gi(e))return jr(e).map(function(t){return[t,e.get(t)]});if(xi(e))return Array.from(e.entries());if(di(e))return e.map(function(e,t){return[t,e]});y(7)}function Pr(e,t,n){if(arguments.length===2&&!xi(e)){Tn();var r=t;try{for(var i in r)Pr(e,i,r[i])}finally{En()}return}ki(e)?e[P].set_(t,n):gi(e)?e.set(t,n):xi(e)?e.add(t):di(e)?(typeof t!=`number`&&(t=parseInt(t,10)),t<0&&y(`Invalid index: '`+t+`'`),Tn(),t>=e.length&&(e.length=t+1),e[t]=n,En()):y(8)}function Fr(e,t,n){if(ki(e))return e[P].defineProperty_(t,n);y(39)}function Ir(e,t,n,r){return ne(n)?Rr(e,t,n,r):Lr(e,t,n)}function Lr(e,t,n){return Hi(e).observe_(t,n)}function Rr(e,t,n,r){return Hi(e,t).observe_(n,r)}function zr(e,t){t===void 0&&(t=void 0),Tn();try{return e.apply(t)}finally{En()}}function Br(e,t,n){return arguments.length===1||t&&typeof t==`object`?Hr(e,t):Vr(e,t,n||{})}function Vr(e,t,n){var r;if(typeof n.timeout==`number`){var i=Error(`WHEN_TIMEOUT`);r=setTimeout(function(){if(!o[P].isDisposed)if(o(),n.onError)n.onError(i);else throw i},n.timeout)}n.name=`When`;var a=Kt(`When-effect`,t),o=er(function(t){Xt(!1,e)&&(t.dispose(),r&&clearTimeout(r),a())},n);return o}function Hr(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=Vr(e,n,Se({},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 Ur(e){return e[P]}var Wr={has:function(e,t){return Ur(e).has_(t)},get:function(e,t){return Ur(e).get_(t)},set:function(e,t,n){return j(t)?Ur(e).set_(t,n,!0)??!0:!1},deleteProperty:function(e,t){return j(t)?Ur(e).delete_(t,!0)??!0:!1},defineProperty:function(e,t,n){return Ur(e).defineProperty_(t,n)??!0},ownKeys:function(e){return Ur(e).ownKeys_()},preventExtensions:function(e){y(13)}};function Gr(e,t){var n;return k(),e=Ei(e,t),(n=e[P]).proxy_??(n.proxy_=new Proxy(e,Wr))}function Kr(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function qr(e,t){var n=e.interceptors_||=[];return n.push(t),A(function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function Jr(e,t){var n=fn();try{for(var r=[].concat(e.interceptors_||[]),i=0,a=r.length;i<a&&(t=r[i](t),t&&!t.type&&y(14),t);i++);return t}finally{pn(n)}}function Yr(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function Xr(e,t){var n=e.changeListeners_||=[];return n.push(t),A(function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function Zr(e,t){var n=fn(),r=e.changeListeners_;if(r){r=r.slice();for(var i=0,a=r.length;i<a;i++)r[i](t);pn(n)}}function Qr(e,t,n){return Wi(function(){var r=Ei(e,n)[P];t??=je(e),fe(t).forEach(function(e){return r.make_(e,t[e])})}),e}var $r=`splice`,ei=`update`,ti=1e4,ni={get:function(e,t){var n=e[P];return t===P?n:t===`length`?n.getArrayLength_():typeof t==`string`&&!isNaN(t)?n.get_(parseInt(t)):me(ai,t)?ai[t]:e[t]},set:function(e,t,n){var r=e[P];return t===`length`&&r.setArrayLength_(n),typeof t==`symbol`||isNaN(t)?e[t]=n:r.set_(parseInt(t),n),!0},preventExtensions:function(){y(15)}},ri=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 Ne(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 qr(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}),Xr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){(typeof e!=`number`||isNaN(e)||e<0)&&y(`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_&&y(16),this.lastKnownLength_+=t,this.legacyMode_&&t>0&&zi(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=E),Kr(this)){var a=Jr(this,{object:this.proxy_,type:$r,index:e,removedCount:t,added:n});if(!a)return E;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<ti){var r;return(r=this.values_).splice.apply(r,[e,t].concat(n))}else{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_&&Rn(),i=Yr(this),a=i||r?{observableKind:`array`,object:this.proxy_,type:ei,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;this.atom_.reportChanged(),i&&Zr(this,a)},t.notifyArraySplice_=function(e,t,n){var r=!this.owned_&&Rn(),i=Yr(this),a=i||r?{observableKind:`array`,object:this.proxy_,debugObjectName:this.atom_.name_,type:$r,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;this.atom_.reportChanged(),i&&Zr(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&&y(17,e,n.length),e<n.length){this.atom_;var r=n[e];if(Kr(this)){var i=Jr(this,{type:ei,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 ii(e,t,n,r){return n===void 0&&(n=`ObservableArray`),r===void 0&&(r=!1),k(),Wi(function(){var i=new ri(n,t,r,!1);oe(i.values_,P,i);var a=new Proxy(i.values_,ni);return i.proxy_=a,e&&e.length&&i.spliceWithArray_(0,0,e),a})}var ai={clear:function(){return this.splice(0)},replace:function(e){var t=this[P];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){var n=[...arguments].slice(2),r=this[P];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[P].spliceWithArray_(e,t,n)},push:function(){var e=this[P],t=[...arguments];return e.spliceWithArray_(e.values_.length,0,t),e.values_.length},pop:function(){return this.splice(Math.max(this[P].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){var e=this[P],t=[...arguments];return e.spliceWithArray_(0,0,t),e.values_.length},reverse:function(){return I.trackingDerivation&&y(37,`reverse`),this.replace(this.slice().reverse()),this},sort:function(){I.trackingDerivation&&y(37,`sort`);var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[P],n=t.dehanceValues_(t.values_).indexOf(e);return n>-1?(this.splice(n,1),!0):!1}};oi(`at`,si),oi(`concat`,si),oi(`flat`,si),oi(`includes`,si),oi(`indexOf`,si),oi(`join`,si),oi(`lastIndexOf`,si),oi(`slice`,si),oi(`toString`,si),oi(`toLocaleString`,si),oi(`toSorted`,si),oi(`toSpliced`,si),oi(`with`,si),oi(`every`,ci),oi(`filter`,ci),oi(`find`,ci),oi(`findIndex`,ci),oi(`findLast`,ci),oi(`findLastIndex`,ci),oi(`flatMap`,ci),oi(`forEach`,ci),oi(`map`,ci),oi(`some`,ci),oi(`toReversed`,ci),oi(`reduce`,li),oi(`reduceRight`,li);function oi(e,t){typeof Array.prototype[e]==`function`&&(ai[e]=t(e))}function si(e){return function(){var t=this[P];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[P];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e](function(e,i){return t.call(n,e,i,r)})}}function li(e){return function(){var t=this,n=this[P];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 ui=N(`ObservableArrayAdministration`,ri);function di(e){return M(e)&&ui(e[P])}var fi={},pi=`add`,mi=`delete`,hi=function(){function e(e,t,n){var r=this;t===void 0&&(t=Ve),n===void 0&&(n=`ObservableMap`),this.enhancer_=void 0,this.name_=void 0,this[P]=fi,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,ne(Map)||y(18),Wi(function(){r.keysAtom_=Fe(`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(!I.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new $t(this.has_(e),Ue,`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(Kr(this)){var r=Jr(this,{type:n?ei:pi,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_,Kr(this)&&!Jr(this,{type:mi,object:this,name:e}))return!1;if(this.has_(e)){var n=Rn(),r=Yr(this),i=r||n?{observableKind:`map`,debugObjectName:this.name_,type:mi,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return zr(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&&Zr(this,i),!0}return!1},t.updateValue_=function(e,t){var n=this.data_.get(e);if(t=n.prepareNewValue_(t),t!==I.UNCHANGED){var r=Rn(),i=Yr(this),a=i||r?{observableKind:`map`,debugObjectName:this.name_,type:ei,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),i&&Zr(this,a)}},t.addValue_=function(e,t){var n=this;this.keysAtom_,zr(function(){var r,i=new $t(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=Rn(),i=Yr(this),a=i||r?{observableKind:`map`,debugObjectName:this.name_,type:pi,object:this,name:e,newValue:t}:null;i&&Zr(this,a)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},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 _i({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 _i({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=xe(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 gi(e)&&(e=new Map(e)),zr(function(){re(e)?de(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)}):se(e)?(ce(e)||y(19,e),e.forEach(function(e,n){return t.set(n,e)})):e!=null&&y(20,e)}),this},t.clear=function(){var e=this;zr(function(){dn(function(){for(var t=xe(e.keys()),n;!(n=t()).done;){var r=n.value;e.delete(r)}})})},t.replace=function(e){var t=this;return zr(function(){for(var n=vi(e),r=new Map,i=!1,a=xe(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=xe(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 Xr(this,e)},t.intercept_=function(e){return qr(this,e)},be(e,[{key:`size`,get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return`Map`}}])}(),gi=N(`ObservableMap`,hi);function _i(e){return e[Symbol.toStringTag]=`MapIterator`,Xi(e)}function vi(e){if(se(e)||gi(e))return e;if(Array.isArray(e))return new Map(e);if(re(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return y(21,e)}var yi={},bi=function(){function e(e,t,n){var r=this;t===void 0&&(t=Ve),n===void 0&&(n=`ObservableSet`),this.name_=void 0,this[P]=yi,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,ne(Set)||y(22),this.enhancer_=function(e,r){return t(e,r,n)},Wi(function(){r.atom_=Fe(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;zr(function(){dn(function(){for(var t=xe(e.data_.values()),n;!(n=t()).done;){var r=n.value;e.delete(r)}})})},t.forEach=function(e,t){for(var n=xe(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_,Kr(this)){var n=Jr(this,{type:pi,object:this,newValue:e});if(!n)return this;e=n.newValue}if(!this.has(e)){zr(function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()});var r=!1,i=Yr(this),a=i||r?{observableKind:`set`,debugObjectName:this.name_,type:pi,object:this,newValue:e}:null;i&&Zr(this,a)}return this},t.delete=function(e){var t=this;if(Kr(this)&&!Jr(this,{type:mi,object:this,oldValue:e}))return!1;if(this.has(e)){var n=!1,r=Yr(this),i=r||n?{observableKind:`set`,debugObjectName:this.name_,type:mi,object:this,oldValue:e}:null;return zr(function(){t.atom_.reportChanged(),t.data_.delete(e)}),r&&Zr(this,i),!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 Si({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 Si({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 le(e)&&!xi(e)?e.intersection(this):new Set(this).intersection(e)},t.union=function(e){return le(e)&&!xi(e)?e.union(this):new Set(this).union(e)},t.difference=function(e){return new Set(this).difference(e)},t.symmetricDifference=function(e){return le(e)&&!xi(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 le(e)&&!xi(e)?e.isDisjointFrom(this):new Set(this).isDisjointFrom(e)},t.replace=function(e){var t=this;return xi(e)&&(e=new Set(e)),zr(function(){Array.isArray(e)||le(e)?(t.clear(),e.forEach(function(e){return t.add(e)})):e!=null&&y(`Cannot initialize set from `+e)}),this},t.observe_=function(e,t){return Xr(this,e)},t.intercept_=function(e){return qr(this,e)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return`[object ObservableSet]`},t[Symbol.iterator]=function(){return this.values()},be(e,[{key:`size`,get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return`Set`}}])}(),xi=N(`ObservableSet`,bi);function Si(e){return e[Symbol.toStringTag]=`SetIterator`,Xi(e)}var Ci=Object.create(null),wi=`remove`,Ti=function(){function e(e,t,n,r){t===void 0&&(t=new Map),r===void 0&&(r=gt),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.target_=e,this.values_=t,this.name_=n,this.defaultAnnotation_=r,this.keysAtom_=new Ne(`ObservableObject.keys`),this.isPlainObject_=re(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(e){return this.values_.get(e).get()},t.setObservablePropValue_=function(e,t){var n=this.values_.get(e);if(n instanceof tn)return n.set(t),!0;if(Kr(this)){var r=Jr(this,{type:ei,object:this.proxy_||this.target_,name:e,newValue:t});if(!r)return null;t=r.newValue}if(t=n.prepareNewValue_(t),t!==I.UNCHANGED){var i=Yr(this),a=i?{type:ei,observableKind:`object`,debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),i&&Zr(this,a)}return!0},t.get_=function(e){return I.trackingDerivation&&!me(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,n){return n===void 0&&(n=!1),me(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(!I.trackingDerivation)return e in this.target_;this.pendingKeys_||=new Map;var t=this.pendingKeys_.get(e);return t||(t=new $t(e in this.target_,Ue,`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_[Oe])!=null&&n[e])return;y(1,t.annotationType_,this.name_+`.`+e.toString())}for(var r=this.target_;r&&r!==T;){var i=C(r,e);if(i){var a=t.make_(this,e,i,r);if(a===0)return;if(a===1)break}r=Object.getPrototypeOf(r)}Ai(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&&Ai(this,n,e),i},t.defineProperty_=function(e,t,n){n===void 0&&(n=!1),this.keysAtom_;try{Tn();var r=this.delete_(e);if(!r)return r;if(Kr(this)){var i=Jr(this,{object:this.proxy_||this.target_,name:e,type:pi,newValue:t.value});if(!i)return null;var a=i.newValue;t.value!==a&&(t=Se({},t,{value:a}))}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else w(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{En()}return!0},t.defineObservableProperty_=function(e,t,n,r){r===void 0&&(r=!1),this.keysAtom_;try{Tn();var i=this.delete_(e);if(!i)return i;if(Kr(this)){var a=Jr(this,{object:this.proxy_||this.target_,name:e,type:pi,newValue:t});if(!a)return null;t=a.newValue}var o=Oi(e),s={configurable:I.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:o.get,set:o.set};if(r){if(!Reflect.defineProperty(this.target_,e,s))return!1}else w(this.target_,e,s);var c=new $t(t,n,`ObservableObject.key`,!1);this.values_.set(e,c),this.notifyPropertyAddition_(e,c.value_)}finally{En()}return!0},t.defineComputedProperty_=function(e,t,n){n===void 0&&(n=!1),this.keysAtom_;try{Tn();var r=this.delete_(e);if(!r)return r;if(Kr(this)&&!Jr(this,{object:this.proxy_||this.target_,name:e,type:pi,newValue:void 0}))return null;t.name||=`ObservableObject.key`,t.context=this.proxy_||this.target_;var i=Oi(e),a={configurable:I.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.target_,e,a))return!1}else w(this.target_,e,a);this.values_.set(e,new tn(t)),this.notifyPropertyAddition_(e,void 0)}finally{En()}return!0},t.delete_=function(e,t){if(t===void 0&&(t=!1),this.keysAtom_,!me(this.target_,e))return!0;if(Kr(this)&&!Jr(this,{object:this.proxy_||this.target_,name:e,type:wi}))return null;try{var n;Tn();var r=Yr(this),i=!1,a=this.values_.get(e),o=void 0;if(!a&&(r||i)&&(o=C(this.target_,e)?.value),t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(a&&(this.values_.delete(e),a instanceof $t&&(o=a.value_),On(a)),this.keysAtom_.reportChanged(),(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(e in this.target_),r||i){var s={type:wi,observableKind:`object`,object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:o,name:e};r&&Zr(this,s)}}finally{En()}return!0},t.observe_=function(e,t){return Xr(this,e)},t.intercept_=function(e){return qr(this,e)},t.notifyPropertyAddition_=function(e,t){var n,r=Yr(this),i=!1;if(r||i){var a=r||i?{type:pi,observableKind:`object`,debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;r&&Zr(this,a)}(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),fe(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Ei(e,t){if(me(e,P))return e;var n=t?.name??`ObservableObject`;return ae(e,P,new Ti(e,new Map,String(n),Nt(t))),e}var Di=N(`ObservableObjectAdministration`,Ti);function Oi(e){return Ci[e]||(Ci[e]={get:function(){return this[P].getObservablePropValue_(e)},set:function(t){return this[P].setObservablePropValue_(e,t)}})}function ki(e){return M(e)?Di(e[P]):!1}function Ai(e,t,n){var r;(r=e.target_[Oe])==null||delete r[n]}var ji=Li(0),Mi=function(){var e=!1,t={};return Object.defineProperty(t,`0`,{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Ni=0,Pi=function(){};function Fi(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__===void 0?e.prototype=t:e.prototype.__proto__=t}Fi(Pi,Array.prototype);var Ii=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,Wi(function(){var e=new ri(r,n,i,!0);e.proxy_=a,oe(a,P,e),t&&t.length&&a.spliceWithArray(0,0,t),Mi&&Object.defineProperty(a,`0`,ji)}),a}Ce(t,e);var n=t.prototype;return n.concat=function(){this[P].atom_.reportObserved();var e=[...arguments];return Array.prototype.concat.apply(this.slice(),e.map(function(e){return di(e)?e.slice():e}))},n[Symbol.iterator]=function(){var e=this,t=0;return Xi({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},be(t,[{key:`length`,get:function(){return this[P].getArrayLength_()},set:function(e){this[P].setArrayLength_(e)}},{key:Symbol.toStringTag,get:function(){return`Array`}}])}(Pi);Object.entries(ai).forEach(function(e){var t=e[0],n=e[1];t!==`concat`&&ae(Ii.prototype,t,n)});function Li(e){return{enumerable:!1,configurable:!0,get:function(){return this[P].get_(e)},set:function(t){this[P].set_(e,t)}}}function Ri(e){w(Ii.prototype,``+e,Li(e))}function zi(e){if(e>Ni){for(var t=Ni;t<e+100;t++)Ri(t);Ni=e}}zi(1e3);function Bi(e,t,n){return new Ii(e,t,n)}function Vi(e,t){if(typeof e==`object`&&e){if(di(e))return t!==void 0&&y(23),e[P].atom_;if(xi(e))return e.atom_;if(gi(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||y(25,t,Ui(e)),n}if(ki(e)){if(!t)return y(26);var r=e[P].values_.get(t);return r||y(27,t,Ui(e)),r}if(Pe(e)||nn(e)||In(e))return e}else if(ne(e)&&In(e[P]))return e[P];y(28)}function Hi(e,t){if(e||y(29),t!==void 0)return Hi(Vi(e,t));if(Pe(e)||nn(e)||In(e)||gi(e)||xi(e))return e;if(e[P])return e[P];y(24,e)}function Ui(e,t){var n;if(t!==void 0)n=Vi(e,t);else if($n(e))return e.name;else n=ki(e)||gi(e)||xi(e)?Hi(e):Vi(e);return n.name_}function Wi(e){var t=fn(),n=Zt(!0);Tn();try{return e()}finally{En(),Qt(n),pn(t)}}var Gi=T.toString;function Ki(e,t,n){return n===void 0&&(n=-1),qi(e,t,n)}function qi(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=Gi.call(e);if(o!==Gi.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++;break}e=Ji(e),t=Ji(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&&!(ne(c)&&c instanceof c&&ne(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(!qi(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(!(me(t,m)&&qi(e[m],t[m],n-1,r,i)))return!1}}return r.pop(),i.pop(),!0}function Ji(e){return di(e)?e.slice():se(e)||gi(e)||le(e)||xi(e)?Array.from(e.entries()):e}var Yi=x().Iterator?.prototype||{};function Xi(e){return e[Symbol.iterator]=Zi,Object.assign(Object.create(Yi),e)}function Zi(){return this}if([`Symbol`,`Map`,`Set`].forEach(function(e){x()[e]===void 0&&y(`MobX requires global '`+e+`' to be available or polyfilled`)}),typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__==`object`&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:zn,extras:{getDebugName:Ui},$mobx:P}),!_.useState)throw Error(`mobx-react-lite requires React with Hooks support`);if(!Qr)throw Error(`mobx-react-lite@3 requires mobx at least version 6 to be available`);var Qi=h();function $i(e){e()}function ea(e){e||=$i,pr({reactionScheduler:e})}function ta(e){return hr(e)}var na=!1;function ra(){return na}var ia=1e4,aa=1e4,oa=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=ia),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,aa))}}),e}(),sa=new(typeof FinalizationRegistry<`u`?FinalizationRegistry:oa)(function(e){var t;(t=e.reaction)==null||t.dispose(),e.reaction=null}),ca=o((e=>{var t=d();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 f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),la=o(((e,t)=>{t.exports=ca()}))();function ua(e){e.reaction=new jn(`observer${e.name}`,function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)==null||t.call(e)})}function da(e,t){if(t===void 0&&(t=`observed`),ra())return e();var n=_.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||(ua(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||(ua(i),sa.register(n,i,i)),_.useDebugValue(i.reaction,ta),(0,la.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 fa=typeof Symbol==`function`&&Symbol.for,pa=Object.getOwnPropertyDescriptor(function(){},`name`)?.configurable??!1,ma=fa?Symbol.for(`react.forward_ref`):typeof _.forwardRef==`function`&&(0,_.forwardRef)(function(e){return null}).$$typeof,ha=fa?Symbol.for(`react.memo`):typeof _.memo==`function`&&(0,_.memo)(function(e){return null}).$$typeof;function ga(e,t){if(ha&&e.$$typeof===ha)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(ra())return e;var n=t?.forwardRef??!1,r=e,i=e.displayName||e.name;if(ma&&e.$$typeof===ma&&(n=!0,r=e.render,typeof r!=`function`))throw Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var a=function(e,t){return da(function(){return r(e,t)},i)};return a.displayName=e.displayName,pa&&Object.defineProperty(a,`name`,{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(a.contextTypes=e.contextTypes),n&&(a=(0,_.forwardRef)(a)),a=(0,_.memo)(a),va(e,a),a}var _a={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function va(e,t){Object.keys(e).forEach(function(n){_a[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}function ya(e){var t=e.children,n=e.render;t&&n&&console.error("MobX Observer: Do not use children and render in the same time in `Observer`");var r=t||n;return typeof r==`function`?da(r):null}ya.displayName=`Observer`;function ba(e,t){return(0,_.useState)(function(){return It(e(),t,{autoBind:!0})})[0]}ea(Qi.unstable_batchedUpdates),sa.finalizeAllImmediately;var xa=Math.PI/180;function Sa(){return typeof window<`u`&&({}.toString.call(window)===`[object Window]`||{}.toString.call(window)===`[object global]`)}var Ca=typeof global<`u`?global:typeof window<`u`?window:typeof WorkerGlobalScope<`u`?self:{},L={_global:Ca,version:`10.3.0`,isBrowser:Sa(),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle(e){return L.angleDeg?e*xa:e},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_renderBackend:`web`,legacyTextRendering:!1,pixelRatio:typeof window<`u`&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return L.DD.isDragging},isTransforming(){return L.Transformer?.isTransforming()??!1},isDragReady(){return!!L.DD.node},releaseCanvasOnDestroy:!0,document:Ca.document,_injectGlobal(e){Ca.Konva!==void 0&&console.error(`Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment.`),Ca.Konva=e}},wa=e=>{L[e.prototype.getClassName()]=e};L._injectGlobal(L);var Ta=`Konva.js unsupported environment.
|
|
12
|
-
|
|
13
|
-
Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
|
|
14
|
-
|
|
15
|
-
To use Konva.js in Node.js environment, you need to use the "canvas-backend" or "skia-backend" module.
|
|
16
|
-
|
|
17
|
-
bash: npm install canvas
|
|
18
|
-
js: import "konva/canvas-backend";
|
|
19
|
-
|
|
20
|
-
or
|
|
21
|
-
|
|
22
|
-
bash: npm install skia-canvas
|
|
23
|
-
js: import "konva/skia-backend";
|
|
24
|
-
`,Ea=()=>{if(typeof document>`u`)throw Error(Ta)},Da=class e{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new e(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){let t=this.m;return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}translate(e,t){return this.m[4]+=this.m[0]*e+this.m[2]*t,this.m[5]+=this.m[1]*e+this.m[3]*t,this}scale(e,t){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=t,this.m[3]*=t,this}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.m[0]*t+this.m[2]*n,i=this.m[1]*t+this.m[3]*n,a=this.m[0]*-n+this.m[2]*t,o=this.m[1]*-n+this.m[3]*t;return this.m[0]=r,this.m[1]=i,this.m[2]=a,this.m[3]=o,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,t){let n=this.m[0]+this.m[2]*t,r=this.m[1]+this.m[3]*t,i=this.m[2]+this.m[0]*e,a=this.m[3]+this.m[1]*e;return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=a,this}multiply(e){let t=this.m[0]*e.m[0]+this.m[2]*e.m[1],n=this.m[1]*e.m[0]+this.m[3]*e.m[1],r=this.m[0]*e.m[2]+this.m[2]*e.m[3],i=this.m[1]*e.m[2]+this.m[3]*e.m[3],a=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],o=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=i,this.m[4]=a,this.m[5]=o,this}invert(){let e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,n=-this.m[1]*e,r=-this.m[2]*e,i=this.m[0]*e,a=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),o=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=i,this.m[4]=a,this.m[5]=o,this}getMatrix(){return this.m}decompose(){let e=this.m[0],t=this.m[1],n=this.m[2],r=this.m[3],i=this.m[4],a=this.m[5],o=e*r-t*n,s={x:i,y:a,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!=0||t!=0){let i=Math.sqrt(e*e+t*t);s.rotation=t>0?Math.acos(e/i):-Math.acos(e/i),s.scaleX=i,s.scaleY=o/i,s.skewX=(e*n+t*r)/o,s.skewY=0}else if(n!=0||r!=0){let i=Math.sqrt(n*n+r*r);s.rotation=Math.PI/2-(r>0?Math.acos(-n/i):-Math.acos(n/i)),s.scaleX=o/i,s.scaleY=i,s.skewX=0,s.skewY=(e*n+t*r)/o}return s.rotation=z._getRotation(s.rotation),s}},Oa=`[object Array]`,ka=`[object Number]`,Aa=`[object String]`,ja=`[object Boolean]`,Ma=Math.PI/180,Na=180/Math.PI,Pa=`#`,Fa=``,Ia=`0`,La=`Konva warning: `,Ra=`Konva error: `,za=`rgb(`,R={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},Ba=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,Va=[],Ha=null,Ua=typeof requestAnimationFrame<`u`&&requestAnimationFrame||function(e){setTimeout(e,16)},z={_isElement(e){return!!(e&&e.nodeType==1)},_isFunction(e){return!!(e&&e.constructor&&e.call&&e.apply)},_isPlainObject(e){return!!e&&e.constructor===Object},_isArray(e){return Object.prototype.toString.call(e)===Oa},_isNumber(e){return Object.prototype.toString.call(e)===ka&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===Aa},_isBoolean(e){return Object.prototype.toString.call(e)===ja},isObject(e){return e instanceof Object},isValidSelector(e){if(typeof e!=`string`)return!1;let t=e[0];return t===`#`||t===`.`||t===t.toUpperCase()},_sign(e){return e===0||e>0?1:-1},requestAnimFrame(e){Va.push(e),Va.length===1&&Ua(function(){let e=Va;Va=[],e.forEach(function(e){e()})})},createCanvasElement(){Ea();let e=document.createElement(`canvas`);try{e.style=e.style||{}}catch{}return e},createImageElement(){return Ea(),document.createElement(`img`)},_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){let n=z.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex(e,t,n){return((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)},_hexToRgb(e){e=e.replace(Pa,Fa);let t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:t&255}},getRandomColor(){let e=(Math.random()*16777215<<0).toString(16);for(;e.length<6;)e=Ia+e;return Pa+e},isCanvasFarblingActive(){if(Ha!==null)return Ha;if(typeof document>`u`)return Ha=!1,!1;let e=this.createCanvasElement();e.width=10,e.height=10;let t=e.getContext(`2d`,{willReadFrequently:!0});t.clearRect(0,0,10,10),t.fillStyle=`#282828`,t.fillRect(0,0,10,10);let n=t.getImageData(0,0,10,10).data,r=!1;for(let e=0;e<100;e++)if(n[e*4]!==40||n[e*4+1]!==40||n[e*4+2]!==40||n[e*4+3]!==255){r=!0;break}return Ha=r,this.releaseCanvas(e),Ha},getHitColor(){let e=this.getRandomColor();return this.isCanvasFarblingActive()?this.getSnappedHexColor(e):e},getHitColorKey(e,t,n){return this.isCanvasFarblingActive()&&(e=Math.round(e/5)*5,t=Math.round(t/5)*5,n=Math.round(n/5)*5),Pa+this._rgbToHex(e,t,n)},getSnappedHexColor(e){let t=this._hexToRgb(e);return Pa+this._rgbToHex(Math.round(t.r/5)*5,Math.round(t.g/5)*5,Math.round(t.b/5)*5)},getRGB(e){let t;return e in R?(t=R[e],{r:t[0],g:t[1],b:t[2]}):e[0]===Pa?this._hexToRgb(e.substring(1)):e.substr(0,4)===za?(t=Ba.exec(e.replace(/ /g,``)),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA(e){return e||=`black`,z._namedColorToRBA(e)||z._hex3ColorToRGBA(e)||z._hex4ColorToRGBA(e)||z._hex6ColorToRGBA(e)||z._hex8ColorToRGBA(e)||z._rgbColorToRGBA(e)||z._rgbaColorToRGBA(e)||z._hslColorToRGBA(e)},_namedColorToRBA(e){let t=R[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(e.indexOf(`rgb(`)===0){e=e.match(/rgb\(([^)]+)\)/)[1];let t=e.split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(e.indexOf(`rgba(`)===0){e=e.match(/rgba\(([^)]+)\)/)[1];let t=e.split(/ *, */).map((e,t)=>e.slice(-1)===`%`?t===3?parseInt(e)/100:parseInt(e)/100*255:Number(e));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex8ColorToRGBA(e){if(e[0]===`#`&&e.length===9)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if(e[0]===`#`&&e.length===7)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if(e[0]===`#`&&e.length===5)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if(e[0]===`#`&&e.length===4)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){let[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,i=Number(n[1])/100,a=Number(n[2])/100,o,s,c;if(i===0)return c=a*255,{r:Math.round(c),g:Math.round(c),b:Math.round(c),a:1};o=a<.5?a*(1+i):a+i-a*i;let l=2*a-o,u=[0,0,0];for(let e=0;e<3;e++)s=r+1/3*-(e-1),s<0&&s++,s>1&&s--,c=6*s<1?l+(o-l)*6*s:2*s<1?o:3*s<2?l+(o-l)*(2/3-s)*6:l,u[e]=c*255;return{r:Math.round(u[0]),g:Math.round(u[1]),b:Math.round(u[2]),a:1}}},haveIntersection(e,t){return!(t.x>e.x+e.width||t.x+t.width<e.x||t.y>e.y+e.height||t.y+t.height<e.y)},cloneObject(e){let t={};for(let n in e)this._isPlainObject(e[n])?t[n]=this.cloneObject(e[n]):this._isArray(e[n])?t[n]=this.cloneArray(e[n]):t[n]=e[n];return t},cloneArray(e){return e.slice(0)},degToRad(e){return e*Ma},radToDeg(e){return e*Na},_degToRad(e){return z.warn(`Util._degToRad is removed. Please use public Util.degToRad instead.`),z.degToRad(e)},_radToDeg(e){return z.warn(`Util._radToDeg is removed. Please use public Util.radToDeg instead.`),z.radToDeg(e)},_getRotation(e){return L.angleDeg?z.radToDeg(e):e},_capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)},throw(e){throw Error(Ra+e)},error(e){console.error(Ra+e)},warn(e){L.showWarnings&&console.warn(La+e)},each(e,t){for(let n in e)t(n,e[n])},_inRange(e,t,n){return t<=e&&e<n},_getProjectionToSegment(e,t,n,r,i,a){let o,s,c,l=(e-n)*(e-n)+(t-r)*(t-r);if(l==0)o=e,s=t,c=(i-n)*(i-n)+(a-r)*(a-r);else{let u=((i-e)*(n-e)+(a-t)*(r-t))/l;u<0?(o=e,s=t,c=(e-i)*(e-i)+(t-a)*(t-a)):u>1?(o=n,s=r,c=(n-i)*(n-i)+(r-a)*(r-a)):(o=e+u*(n-e),s=t+u*(r-t),c=(o-i)*(o-i)+(s-a)*(s-a))}return[o,s,c]},_getProjectionToLine(e,t,n){let r=z.cloneObject(e),i=Number.MAX_VALUE;return t.forEach(function(a,o){if(!n&&o===t.length-1)return;let s=t[(o+1)%t.length],c=z._getProjectionToSegment(a.x,a.y,s.x,s.y,e.x,e.y),l=c[0],u=c[1],d=c[2];d<i&&(r.x=l,r.y=u,i=d)}),r},_prepareArrayForTween(e,t,n){let r=[],i=[];if(e.length>t.length){let n=t;t=e,e=n}for(let t=0;t<e.length;t+=2)r.push({x:e[t],y:e[t+1]});for(let e=0;e<t.length;e+=2)i.push({x:t[e],y:t[e+1]});let a=[];return i.forEach(function(e){let t=z._getProjectionToLine(e,r,n);a.push(t.x),a.push(t.y)}),a},_prepareToStringify(e){let t;e.visitedByCircularReferenceRemoval=!0;for(let n in e)if(e.hasOwnProperty(n)&&e[n]&&typeof e[n]==`object`){if(t=Object.getOwnPropertyDescriptor(e,n),e[n].visitedByCircularReferenceRemoval||z._isElement(e[n]))if(t.configurable)delete e[n];else return null;else if(z._prepareToStringify(e[n])===null)if(t.configurable)delete e[n];else return null}return delete e.visitedByCircularReferenceRemoval,e},_assign(e,t){for(let n in t)e[n]=t[n];return e},_getFirstPointerId(e){return e.touches?e.changedTouches[0].identifier:e.pointerId||999},releaseCanvas(...e){L.releaseCanvasOnDestroy&&e.forEach(e=>{e.width=0,e.height=0})},drawRoundedRectPath(e,t,n,r){let i=t<0?t:0,a=n<0?n:0;t=Math.abs(t),n=Math.abs(n);let o=0,s=0,c=0,l=0;typeof r==`number`?o=s=c=l=Math.min(r,t/2,n/2):(o=Math.min(r[0]||0,t/2,n/2),s=Math.min(r[1]||0,t/2,n/2),l=Math.min(r[2]||0,t/2,n/2),c=Math.min(r[3]||0,t/2,n/2)),e.moveTo(i+o,a),e.lineTo(i+t-s,a),e.arc(i+t-s,a+s,s,Math.PI*3/2,0,!1),e.lineTo(i+t,a+n-l),e.arc(i+t-l,a+n-l,l,0,Math.PI/2,!1),e.lineTo(i+c,a+n),e.arc(i+c,a+n-c,c,Math.PI/2,Math.PI,!1),e.lineTo(i,a+o),e.arc(i+o,a+o,o,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(e,t,n,r,i){r=Math.abs(r);for(let a=0;a<n;a++){let o=t[(a-1+n)%n],s=t[a],c=t[(a+1)%n],l={x:s.x-o.x,y:s.y-o.y},u={x:c.x-s.x,y:c.y-s.y},d=Math.hypot(l.x,l.y),f=Math.hypot(u.x,u.y),p;p=typeof i==`number`?i:a<i.length?i[a]:0,p=r*Math.cos(Math.PI/n)*Math.min(1,p/r*2);let m={x:l.x/d,y:l.y/d},h={x:u.x/f,y:u.y/f},g={x:s.x-m.x*p,y:s.y-m.y*p},_={x:s.x+h.x*p,y:s.y+h.y*p};a===0?e.moveTo(g.x,g.y):e.lineTo(g.x,g.y),e.arcTo(s.x,s.y,_.x,_.y,p)}}};function Wa(e){let t=[],n=e.length,r=z;for(let i=0;i<n;i++){let n=e[i];r._isNumber(n)?n=Math.round(n*1e3)/1e3:r._isString(n)||(n+=``),t.push(n)}return t}var Ga=`,`,Ka=`(`,qa=`)`,Ja=`([`,Ya=`])`,Xa=`;`,Za=`()`,Qa=`=`,$a=`arc.arcTo.beginPath.bezierCurveTo.clearRect.clip.closePath.createLinearGradient.createPattern.createRadialGradient.drawImage.ellipse.fill.fillText.getImageData.createImageData.lineTo.moveTo.putImageData.quadraticCurveTo.rect.roundRect.restore.rotate.save.scale.setLineDash.setTransform.stroke.strokeText.transform.translate`.split(`.`),eo=[`fillStyle`,`strokeStyle`,`shadowColor`,`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`,`letterSpacing`,`lineCap`,`lineDashOffset`,`lineJoin`,`lineWidth`,`miterLimit`,`direction`,`font`,`textAlign`,`textBaseline`,`globalAlpha`,`globalCompositeOperation`,`imageSmoothingEnabled`,`filter`],to=100,no=null;function ro(){if(no!==null)return no;try{let e=z.createCanvasElement().getContext(`2d`);return e?!!e&&`filter`in e:(no=!1,!1)}catch{return no=!1,!1}}var io=class{constructor(e){this.canvas=e,L.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,t){let n=this.traceArr,r=n.length,i=``,a,o,s,c;for(a=0;a<r;a++)o=n[a],s=o.method,s?(c=o.args,i+=s,e?i+=Za:z._isArray(c[0])?i+=Ja+c.join(Ga)+Ya:(t&&(c=c.map(e=>typeof e==`number`?Math.floor(e):e)),i+=Ka+c.join(Ga)+qa)):(i+=o.property,e||(i+=Qa+o.val)),i+=Xa;return i}clearTrace(){this.traceArr=[]}_trace(e){let t=this.traceArr,n;t.push(e),n=t.length,n>=to&&t.shift()}reset(){let e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){let t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){let t=e.attrs.lineCap;t&&this.setAttr(`lineCap`,t)}_applyOpacity(e){let t=e.getAbsoluteOpacity();t!==1&&this.setAttr(`globalAlpha`,t)}_applyLineJoin(e){let t=e.attrs.lineJoin;t&&this.setAttr(`lineJoin`,t)}_applyMiterLimit(e){let t=e.attrs.miterLimit;t!=null&&this.setAttr(`miterLimit`,t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,r,i,a){this._context.arc(e,t,n,r,i,a)}arcTo(e,t,n,r,i){this._context.arcTo(e,t,n,r,i)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,r,i,a){this._context.bezierCurveTo(e,t,n,r,i,a)}clearRect(e,t,n,r){this._context.clearRect(e,t,n,r)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,t){let n=arguments;if(n.length===2)return this._context.createImageData(e,t);if(n.length===1)return this._context.createImageData(e)}createLinearGradient(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,r,i,a){return this._context.createRadialGradient(e,t,n,r,i,a)}drawImage(e,t,n,r,i,a,o,s,c){let l=arguments,u=this._context;l.length===3?u.drawImage(e,t,n):l.length===5?u.drawImage(e,t,n,r,i):l.length===9&&u.drawImage(e,t,n,r,i,a,o,s,c)}ellipse(e,t,n,r,i,a,o,s){this._context.ellipse(e,t,n,r,i,a,o,s)}isPointInPath(e,t,n,r){return n?this._context.isPointInPath(n,e,t,r):this._context.isPointInPath(e,t,r)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,t,n,r){this._context.fillRect(e,t,n,r)}strokeRect(e,t,n,r){this._context.strokeRect(e,t,n,r)}fillText(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,r){return this._context.getImageData(e,t,n,r)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,r){this._context.rect(e,t,n,r)}roundRect(e,t,n,r,i){this._context.roundRect(e,t,n,r,i)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):`mozDash`in this._context?this._context.mozDash=e:`webkitLineDash`in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,r,i,a){this._context.setTransform(e,t,n,r,i,a)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,r){this._context.strokeText(e,t,n,r)}transform(e,t,n,r,i,a){this._context.transform(e,t,n,r,i,a)}translate(e,t){this._context.translate(e,t)}_enableTrace(){let e=this,t=$a.length,n=this.setAttr,r,i,a=function(t){let n=e[t],r;e[t]=function(){return i=Wa(Array.prototype.slice.call(arguments,0)),r=n.apply(e,arguments),e._trace({method:t,args:i}),r}};for(r=0;r<t;r++)a($a[r]);e.setAttr=function(){n.apply(e,arguments);let t=arguments[0],r=arguments[1];(t===`shadowOffsetX`||t===`shadowOffsetY`||t===`shadowBlur`)&&(r/=this.canvas.getPixelRatio()),e._trace({property:t,val:r})}}_applyGlobalCompositeOperation(e){let t=e.attrs.globalCompositeOperation;!t||t===`source-over`||this.setAttr(`globalCompositeOperation`,t)}};eo.forEach(function(e){Object.defineProperty(io.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})});var ao=class extends io{constructor(e,{willReadFrequently:t=!1}={}){super(e),this._context=e._canvas.getContext(`2d`,{willReadFrequently:t})}_fillColor(e){let t=e.fill();this.setAttr(`fillStyle`,t),e._fillFunc(this)}_fillPattern(e){this.setAttr(`fillStyle`,e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){let t=e._getLinearGradient();t&&(this.setAttr(`fillStyle`,t),e._fillFunc(this))}_fillRadialGradient(e){let t=e._getRadialGradient();t&&(this.setAttr(`fillStyle`,t),e._fillFunc(this))}_fill(e){let t=e.fill(),n=e.getFillPriority();if(t&&n===`color`){this._fillColor(e);return}let r=e.getFillPatternImage();if(r&&n===`pattern`){this._fillPattern(e);return}let i=e.getFillLinearGradientColorStops();if(i&&n===`linear-gradient`){this._fillLinearGradient(e);return}let a=e.getFillRadialGradientColorStops();if(a&&n===`radial-gradient`){this._fillRadialGradient(e);return}t?this._fillColor(e):r?this._fillPattern(e):i?this._fillLinearGradient(e):a&&this._fillRadialGradient(e)}_strokeLinearGradient(e){let t=e.getStrokeLinearGradientStartPoint(),n=e.getStrokeLinearGradientEndPoint(),r=e.getStrokeLinearGradientColorStops(),i=this.createLinearGradient(t.x,t.y,n.x,n.y);if(r){for(let e=0;e<r.length;e+=2)i.addColorStop(r[e],r[e+1]);this.setAttr(`strokeStyle`,i)}}_stroke(e){let t=e.dash(),n=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!n){this.save();let e=this.getCanvas().getPixelRatio();this.setTransform(e,0,0,e,0,0)}this._applyLineCap(e),t&&e.dashEnabled()&&(this.setLineDash(t),this.setAttr(`lineDashOffset`,e.dashOffset())),this.setAttr(`lineWidth`,e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr(`shadowColor`,`rgba(0,0,0,0)`),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr(`strokeStyle`,e.stroke()),e._strokeFunc(this),n||this.restore()}}_applyShadow(e){let t=e.getShadowRGBA()??`black`,n=e.getShadowBlur()??5,r=e.getShadowOffset()??{x:0,y:0},i=e.getAbsoluteScale(),a=this.canvas.getPixelRatio(),o=i.x*a,s=i.y*a;this.setAttr(`shadowColor`,t),this.setAttr(`shadowBlur`,n*Math.min(Math.abs(o),Math.abs(s))),this.setAttr(`shadowOffsetX`,r.x*o),this.setAttr(`shadowOffsetY`,r.y*s)}},oo=class extends io{constructor(e){super(e),this._context=e._canvas.getContext(`2d`,{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr(`fillStyle`,e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){let t=e.getStrokeScaleEnabled();if(!t){this.save();let e=this.getCanvas().getPixelRatio();this.setTransform(e,0,0,e,0,0)}this._applyLineCap(e);let n=e.hitStrokeWidth(),r=n===`auto`?e.strokeWidth():n;this.setAttr(`lineWidth`,r),this.setAttr(`strokeStyle`,e.colorKey),e._strokeFuncHit(this),t||this.restore()}}},so;function co(){if(so)return so;let e=z.createCanvasElement(),t=e.getContext(`2d`);return so=(function(){return(L._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)})(),z.releaseCanvas(e),so}var lo=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;let t=(e||{}).pixelRatio||L.pixelRatio||co();this.pixelRatio=t,this._canvas=z.createCanvasElement(),this._canvas.style.padding=`0`,this._canvas.style.margin=`0`,this._canvas.style.border=`0`,this._canvas.style.background=`transparent`,this._canvas.style.position=`absolute`,this._canvas.style.top=`0`,this._canvas.style.left=`0`}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){let t=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/t,this.getHeight()/t)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+`px`;let t=this.pixelRatio;this.getContext()._context.scale(t,t)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+`px`;let t=this.pixelRatio;this.getContext()._context.scale(t,t)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,t){this.setWidth(e||0),this.setHeight(t||0)}toDataURL(e,t){try{return this._canvas.toDataURL(e,t)}catch{try{return this._canvas.toDataURL()}catch(e){return z.error(`Unable to get data URL. `+e.message+` For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html.`),``}}}},uo=class extends lo{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new ao(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},fo=class extends lo{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new oo(this),this.setSize(e.width,e.height)}},po={get isDragging(){let e=!1;return po._dragElements.forEach(t=>{t.dragStatus===`dragging`&&(e=!0)}),e},justDragged:!1,get node(){let e;return po._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){let t=[];po._dragElements.forEach((n,r)=>{let{node:i}=n,a=i.getStage();a.setPointersPositions(e),n.pointerId===void 0&&(n.pointerId=z._getFirstPointerId(e));let o=a._changedPointerPositions.find(e=>e.id===n.pointerId);if(o){if(n.dragStatus!==`dragging`){let t=i.dragDistance();if(Math.max(Math.abs(o.x-n.startPointerPos.x),Math.abs(o.y-n.startPointerPos.y))<t||(i.startDrag({evt:e}),!i.isDragging()))return}i._setDragPosition(e,n),t.push(i)}}),t.forEach(t=>{t.getStage()&&t.fire(`dragmove`,{type:`dragmove`,target:t,evt:e},!0)})},_endDragBefore(e){let t=[];po._dragElements.forEach(n=>{let{node:r}=n,i=r.getStage();if(e&&i.setPointersPositions(e),!i._changedPointerPositions.find(e=>e.id===n.pointerId))return;(n.dragStatus===`dragging`||n.dragStatus===`stopped`)&&(po.justDragged=!0,L._mouseListenClick=!1,L._touchListenClick=!1,L._pointerListenClick=!1,n.dragStatus=`stopped`);let a=n.node.getLayer()||n.node instanceof L.Stage&&n.node;a&&t.indexOf(a)===-1&&t.push(a)}),t.forEach(e=>{e.draw()})},_endDragAfter(e){po._dragElements.forEach((t,n)=>{t.dragStatus===`stopped`&&t.node.fire(`dragend`,{type:`dragend`,target:t.node,evt:e},!0),t.dragStatus!==`dragging`&&po._dragElements.delete(n)})}};L.isBrowser&&(window.addEventListener(`mouseup`,po._endDragBefore,!0),window.addEventListener(`touchend`,po._endDragBefore,!0),window.addEventListener(`touchcancel`,po._endDragBefore,!0),window.addEventListener(`mousemove`,po._drag),window.addEventListener(`touchmove`,po._drag),window.addEventListener(`mouseup`,po._endDragAfter,!1),window.addEventListener(`touchend`,po._endDragAfter,!1),window.addEventListener(`touchcancel`,po._endDragAfter,!1));function mo(e){return z._isString(e)?`"`+e+`"`:Object.prototype.toString.call(e)===`[object Number]`||z._isBoolean(e)?e:Object.prototype.toString.call(e)}function ho(e){return e>255?255:e<0?0:Math.round(e)}function B(){if(L.isUnminified)return function(e,t){return z._isNumber(e)||z.warn(mo(e)+` is a not valid value for "`+t+`" attribute. The value should be a number.`),e}}function go(e){if(L.isUnminified)return function(t,n){let r=z._isNumber(t),i=z._isArray(t)&&t.length==e;return!r&&!i&&z.warn(mo(t)+` is a not valid value for "`+n+`" attribute. The value should be a number or Array<number>(`+e+`)`),t}}function _o(){if(L.isUnminified)return function(e,t){return z._isNumber(e)||e===`auto`||z.warn(mo(e)+` is a not valid value for "`+t+`" attribute. The value should be a number or "auto".`),e}}function vo(){if(L.isUnminified)return function(e,t){return z._isString(e)||z.warn(mo(e)+` is a not valid value for "`+t+`" attribute. The value should be a string.`),e}}function yo(){if(L.isUnminified)return function(e,t){let n=z._isString(e),r=Object.prototype.toString.call(e)===`[object CanvasGradient]`||e&&e.addColorStop;return n||r||z.warn(mo(e)+` is a not valid value for "`+t+`" attribute. The value should be a string or a native gradient.`),e}}function bo(){if(L.isUnminified)return function(e,t){let n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(z._isArray(e)?e.forEach(function(e){z._isNumber(e)||z.warn(`"`+t+`" attribute has non numeric element `+e+`. Make sure that all elements are numbers.`)}):z.warn(mo(e)+` is a not valid value for "`+t+`" attribute. The value should be a array of numbers.`)),e}}function xo(){if(L.isUnminified)return function(e,t){return e===!0||e===!1||z.warn(mo(e)+` is a not valid value for "`+t+`" attribute. The value should be a boolean.`),e}}function So(e){if(L.isUnminified)return function(t,n){return t==null||z.isObject(t)||z.warn(mo(t)+` is a not valid value for "`+n+`" attribute. The value should be an object with properties `+e),t}}var Co=`get`,wo=`set`,V={addGetterSetter(e,t,n,r,i){V.addGetter(e,t,n),V.addSetter(e,t,r,i),V.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){let r=Co+z._capitalize(t);e.prototype[r]=e.prototype[r]||function(){let e=this.attrs[t];return e===void 0?n:e}},addSetter(e,t,n,r){let i=wo+z._capitalize(t);e.prototype[i]||V.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){let i=wo+z._capitalize(t);e.prototype[i]=function(e){return n&&e!=null&&(e=n.call(this,e,t)),this._setAttr(t,e),r&&r.call(this),this}},addComponentsGetterSetter(e,t,n,r,i){let a=n.length,o=z._capitalize,s=Co+o(t),c=wo+o(t);e.prototype[s]=function(){let e={};for(let r=0;r<a;r++){let i=n[r];e[i]=this.getAttr(t+o(i))}return e};let l=So(n);e.prototype[c]=function(e){let a=this.attrs[t];r&&(e=r.call(this,e,t)),l&&l.call(this,e,t);for(let n in e)e.hasOwnProperty(n)&&this._setAttr(t+o(n),e[n]);return e||n.forEach(e=>{this._setAttr(t+o(e),void 0)}),this._fireChangeEvent(t,a,e),i&&i.call(this),this},V.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){let n=z._capitalize(t),r=wo+n,i=Co+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[i]()}},addDeprecatedGetterSetter(e,t,n,r){z.error(`Adding deprecated `+t);let i=Co+z._capitalize(t),a=t+` property is deprecated and will be removed soon. Look at Konva change log for more information.`;e.prototype[i]=function(){z.error(a);let e=this.attrs[t];return e===void 0?n:e},V.addSetter(e,t,r,function(){z.error(a)}),V.addOverloadedGetterSetter(e,t)},backCompat(e,t){z.each(t,function(t,n){let r=e.prototype[n],i=Co+z._capitalize(t),a=wo+z._capitalize(t);function o(){r.apply(this,arguments),z.error(`"`+t+`" method is deprecated and will be removed soon. Use ""`+n+`" instead.`)}e.prototype[t]=o,e.prototype[i]=o,e.prototype[a]=o})},afterSetFilter(){this._filterUpToDate=!1}};function To(e){let t=/(\w+)\(([^)]+)\)/g,n;for(;(n=t.exec(e))!==null;){let[,e,t]=n;switch(e){case`blur`:{let e=parseFloat(t.replace(`px`,``));return function(t){this.blurRadius(e*.5);let n=L.Filters;n&&n.Blur&&n.Blur.call(this,t)}}case`brightness`:{let e=t.includes(`%`)?parseFloat(t)/100:parseFloat(t);return function(t){this.brightness(e);let n=L.Filters;n&&n.Brightness&&n.Brightness.call(this,t)}}case`contrast`:{let e=parseFloat(t);return function(t){let n=100*(Math.sqrt(e)-1);this.contrast(n);let r=L.Filters;r&&r.Contrast&&r.Contrast.call(this,t)}}case`grayscale`:return function(e){let t=L.Filters;t&&t.Grayscale&&t.Grayscale.call(this,e)};case`sepia`:return function(e){let t=L.Filters;t&&t.Sepia&&t.Sepia.call(this,e)};case`invert`:return function(e){let t=L.Filters;t&&t.Invert&&t.Invert.call(this,e)};default:z.warn(`CSS filter "${e}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}var Eo=`absoluteOpacity`,Do=`allEventListeners`,Oo=`absoluteTransform`,ko=`absoluteScale`,Ao=`canvas`,jo=`Change`,Mo=`children`,No=`konva`,Po=`listening`,Fo=`mouseenter`,Io=`mouseleave`,Lo=`pointerenter`,Ro=`pointerleave`,zo=`touchenter`,Bo=`touchleave`,Vo=`set`,Ho=`Shape`,Uo=` `,Wo=`stage`,Go=`transform`,Ko=`Stage`,qo=`visible`,Jo=[`xChange.konva`,`yChange.konva`,`scaleXChange.konva`,`scaleYChange.konva`,`skewXChange.konva`,`skewYChange.konva`,`rotationChange.konva`,`offsetXChange.konva`,`offsetYChange.konva`,`transformsEnabledChange.konva`].join(Uo),Yo=1,H=class e{constructor(e){this._id=Yo++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===Go||e===Oo)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,t){let n=this._cache.get(e);return(n===void 0||(e===Go||e===Oo)&&n.dirty===!0)&&(n=t.call(this),this._cache.set(e,n)),n}_calculate(e,t,n){if(!this._attachedDepsListeners.get(e)){let n=t.map(e=>e+`Change.konva`).join(Uo);this.on(n,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,n)}_getCanvasCache(){return this._cache.get(Ao)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Oo&&this.fire(`absoluteTransformChange`)}clearCache(){if(this._cache.has(Ao)){let{scene:e,filter:t,hit:n}=this._cache.get(Ao);z.releaseCanvas(e._canvas,t._canvas,n._canvas),this._cache.delete(Ao)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){let t=e||{},n={};(t.x===void 0||t.y===void 0||t.width===void 0||t.height===void 0)&&(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let r=Math.ceil(t.width||n.width),i=Math.ceil(t.height||n.height),a=t.pixelRatio,o=t.x===void 0?Math.floor(n.x):t.x,s=t.y===void 0?Math.floor(n.y):t.y,c=t.offset||0,l=t.drawBorder||!1,u=t.hitCanvasPixelRatio||1;if(!r||!i){z.error(`Can not cache the node. Width or height of the node equals 0. Caching is skipped.`);return}let d=+(Math.abs(Math.round(n.x)-o)>.5),f=+(Math.abs(Math.round(n.y)-s)>.5);r+=c*2+d,i+=c*2+f,o-=c,s-=c;let p=new uo({pixelRatio:a,width:r,height:i}),m=new uo({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),h=new fo({pixelRatio:u,width:r,height:i}),g=p.getContext(),_=h.getContext(),v=new uo({width:p.width/p.pixelRatio+Math.abs(o),height:p.height/p.pixelRatio+Math.abs(s),pixelRatio:p.pixelRatio}),y=v.getContext();return h.isCache=!0,p.isCache=!0,this._cache.delete(Ao),this._filterUpToDate=!1,t.imageSmoothingEnabled===!1&&(p.getContext()._context.imageSmoothingEnabled=!1,m.getContext()._context.imageSmoothingEnabled=!1),g.save(),_.save(),y.save(),g.translate(-o,-s),_.translate(-o,-s),y.translate(-o,-s),v.x=o,v.y=s,this._isUnderCache=!0,this._clearSelfAndDescendantCache(Eo),this._clearSelfAndDescendantCache(ko),this.drawScene(p,this,v),this.drawHit(h,this),this._isUnderCache=!1,g.restore(),_.restore(),l&&(g.save(),g.beginPath(),g.rect(0,0,r,i),g.closePath(),g.setAttr(`strokeStyle`,`red`),g.setAttr(`lineWidth`,5),g.stroke(),g.restore()),z.releaseCanvas(v._canvas),this._cache.set(Ao,{scene:p,filter:m,hit:h,x:o,y:s}),this._requestDraw(),this}isCached(){return this._cache.has(Ao)}getClientRect(e){throw Error(`abstract "getClientRect" method call`)}_transformedRect(e,t){let n=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],r=1/0,i=1/0,a=-1/0,o=-1/0,s=this.getAbsoluteTransform(t);return n.forEach(function(e){let t=s.point(e);r===void 0&&(r=a=t.x,i=o=t.y),r=Math.min(r,t.x),i=Math.min(i,t.y),a=Math.max(a,t.x),o=Math.max(o,t.y)}),{x:r,y:i,width:a-r,height:o-i}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);let t=this._getCanvasCache();e.translate(t.x,t.y);let n=this._getCachedSceneCanvas(),r=n.pixelRatio;e.drawImage(n._canvas,0,0,n.width/r,n.height/r),e.restore()}_drawCachedHitCanvas(e){let t=this._getCanvasCache(),n=t.hit;e.save(),e.translate(t.x,t.y),e.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),e.restore()}_getCachedSceneCanvas(){let e=this.filters(),t=this._getCanvasCache(),n=t.scene,r=t.filter,i=r.getContext(),a,o,s,c;if(!e||e.length===0)return n;if(this._filterUpToDate)return r;let l=!0;for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&ro(),typeof e[t]!=`string`||!ro()){l=!1;break}let u=n.pixelRatio;if(r.setSize(n.width/n.pixelRatio,n.height/n.pixelRatio),l){let t=e.join(` `);return i.save(),i.setAttr(`filter`,t),i.drawImage(n._canvas,0,0,n.getWidth()/u,n.getHeight()/u),i.restore(),this._filterUpToDate=!0,r}try{for(a=e.length,i.clear(),i.drawImage(n._canvas,0,0,n.getWidth()/u,n.getHeight()/u),o=i.getImageData(0,0,r.getWidth(),r.getHeight()),s=0;s<a;s++)c=e[s],typeof c==`string`&&(c=To(c)),c.call(this,o),i.putImageData(o,0,0)}catch(e){z.error(`Unable to apply filter. `+e.message+` This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.`)}return this._filterUpToDate=!0,r}on(...e){let t=e[0],n=e[1];if(e[2],this._cache&&this._cache.delete(Do),e.length===3)return this._delegate.apply(this,e);let r=t.split(Uo);for(let e=0;e<r.length;e++){let t=r[e].split(`.`),i=t[0],a=t[1]||``;this.eventListeners[i]||(this.eventListeners[i]=[]),this.eventListeners[i].push({name:a,handler:n})}return this}off(e,t){let n=(e||``).split(Uo),r=n.length,i,a,o,s,c,l;if(this._cache&&this._cache.delete(Do),!e)for(a in this.eventListeners)this._off(a);for(i=0;i<r;i++)if(o=n[i],s=o.split(`.`),c=s[0],l=s[1],c)this.eventListeners[c]&&this._off(c,l,t);else for(a in this.eventListeners)this._off(a,l,t);return this}dispatchEvent(e){let t={target:this,type:e.type,evt:e};return this.fire(e.type,t),this}addEventListener(e,t){return this.on(e,function(e){t.call(this,e.evt)}),this}removeEventListener(e){return this.off(e),this}_delegate(e,t,n){let r=this;return this.on(e,function(e){let i=e.target.findAncestors(t,!0,r);for(let t=0;t<i.length;t++)e=z.cloneObject(e),e.currentTarget=i[t],n.call(i[t],e)}),this}remove(){return this.isDragging()&&this.stopDrag(),po._dragElements.delete(this._id),po._dragElements.forEach((e,t)=>{this.isAncestorOf(e.node)&&po._dragElements.delete(t)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Oo),this._clearSelfAndDescendantCache(Eo),this._clearSelfAndDescendantCache(ko),this._clearSelfAndDescendantCache(Wo),this._clearSelfAndDescendantCache(qo),this._clearSelfAndDescendantCache(Po)}_remove(){this._clearCaches();let e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){let t=`get`+z._capitalize(e);return z._isFunction(this[t])?this[t]():this.attrs[e]}getAncestors(){let e=this.getParent(),t=[];for(;e;)t.push(e),e=e.getParent();return t}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges(()=>{let t,n;if(!e)return this;for(t in e)t!==Mo&&(n=Vo+z._capitalize(t),z._isFunction(this[n])?this[n](e[t]):this._setAttr(t,e[t]))}),this}isListening(){return this._getCache(Po,this._isListening)}_isListening(e){if(!this.listening())return!1;let t=this.getParent();return t&&t!==e&&this!==e?t._isListening(e):!0}isVisible(){return this._getCache(qo,this._isVisible)}_isVisible(e){if(!this.visible())return!1;let t=this.getParent();return t&&t!==e&&this!==e?t._isVisible(e):!0}shouldDrawHit(e,t=!1){if(e)return this._isVisible(e)&&this._isListening(e);let n=this.getLayer(),r=!1;po._dragElements.forEach(e=>{e.dragStatus===`dragging`&&(e.node.nodeType===`Stage`||e.node.getLayer()===n)&&(r=!0)});let i=!t&&!L.hitOnDragEnabled&&(r||L.isTransforming());return this.isListening()&&this.isVisible()&&!i}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let e=this.getDepth(),t=this,n=0,r,i,a,o;function s(c){for(r=[],i=c.length,a=0;a<i;a++)o=c[a],n++,o.nodeType!==Ho&&(r=r.concat(o.getChildren().slice())),o._id===t._id&&(a=i);r.length>0&&r[0].getDepth()<=e&&s(r)}let c=this.getStage();return t.nodeType!==Ko&&c&&s(c.getChildren()),n}getDepth(){let e=0,t=this.parent;for(;t;)e++,t=t.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(Go),this._clearSelfAndDescendantCache(Oo)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){let e=this.getStage();if(!e)return null;let t=e.getPointerPosition();if(!t)return null;let n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(e){let t=!1,n=this.parent;for(;n;){if(n.isCached()){t=!0;break}n=n.parent}t&&!e&&(e=!0);let r=this.getAbsoluteTransform(e).getMatrix(),i=new Da,a=this.offset();return i.m=r.slice(),i.translate(a.x,a.y),i.getTranslation()}setAbsolutePosition(e){let{x:t,y:n,...r}=this._clearTransform();this.attrs.x=t,this.attrs.y=n,this._clearCache(Go);let i=this._getAbsoluteTransform().copy();return i.invert(),i.translate(e.x,e.y),e={x:this.attrs.x+i.getTranslation().x,y:this.attrs.y+i.getTranslation().y},this._setTransform(r),this.setPosition({x:e.x,y:e.y}),this._clearCache(Go),this._clearSelfAndDescendantCache(Oo),this}_setTransform(e){let t;for(t in e)this.attrs[t]=e[t]}_clearTransform(){let e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){let t=e.x,n=e.y,r=this.x(),i=this.y();return t!==void 0&&(r+=t),n!==void 0&&(i+=n),this.setPosition({x:r,y:i}),this}_eachAncestorReverse(e,t){let n=[],r=this.getParent(),i,a;if(!(t&&t._id===this._id)){for(n.unshift(this);r&&(!t||r._id!==t._id);)n.unshift(r),r=r.parent;for(i=n.length,a=0;a<i;a++)e(n[a])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return z.warn(`Node has no parent. moveToTop function is ignored.`),!1;let e=this.index;return e<this.parent.getChildren().length-1?(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return z.warn(`Node has no parent. moveUp function is ignored.`),!1;let e=this.index;return e<this.parent.getChildren().length-1?(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return z.warn(`Node has no parent. moveDown function is ignored.`),!1;let e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return z.warn(`Node has no parent. moveToBottom function is ignored.`),!1;let e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return z.warn(`Node has no parent. zIndex parameter is ignored.`),this;(e<0||e>=this.parent.children.length)&&z.warn(`Unexpected value `+e+` for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to `+(this.parent.children.length-1)+`.`);let t=this.index;return this.parent.children.splice(t,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Eo,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let e=this.opacity(),t=this.getParent();return t&&!t._isUnderCache&&(e*=t.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){let e=this.getAttrs(),t,n,r,i,a,o={attrs:{},className:this.getClassName()};for(t in e)n=e[t],a=z.isObject(n)&&!z._isPlainObject(n)&&!z._isArray(n),!a&&(r=typeof this[t]==`function`&&this[t],delete e[t],i=r?r.call(this):null,e[t]=n,i!==n&&(o.attrs[t]=n));return z._prepareToStringify(o)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,t,n){let r=[];t&&this._isMatch(e)&&r.push(this);let i=this.parent;for(;i;){if(i===n)return r;i._isMatch(e)&&r.push(i),i=i.parent}return r}isAncestorOf(e){return!1}findAncestor(e,t,n){return this.findAncestors(e,t,n)[0]}_isMatch(e){if(!e)return!1;if(typeof e==`function`)return e(this);let t=e.replace(/ /g,``).split(`,`),n=t.length,r,i;for(r=0;r<n;r++)if(i=t[r],z.isValidSelector(i)||(z.warn(`Selector "`+i+`" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".`),z.warn(`If you have a custom shape with such className, please change it to start with upper letter like "Triangle".`),z.warn(`Konva is awesome, right?`)),i.charAt(0)===`#`){if(this.id()===i.slice(1))return!0}else if(i.charAt(0)===`.`){if(this.hasName(i.slice(1)))return!0}else if(this.className===i||this.nodeType===i)return!0;return!1}getLayer(){let e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(Wo,this._getStage)}_getStage(){let e=this.getParent();return e?e.getStage():null}fire(e,t={},n){return t.target=t.target||this,n?this._fireAndBubble(e,t):this._fire(e,t),this}getAbsoluteTransform(e){return e?this._getAbsoluteTransform(e):this._getCache(Oo,this._getAbsoluteTransform)}_getAbsoluteTransform(e){let t;if(e)return t=new Da,this._eachAncestorReverse(function(e){let n=e.transformsEnabled();n===`all`?t.multiply(e.getTransform()):n===`position`&&t.translate(e.x()-e.offsetX(),e.y()-e.offsetY())},e),t;{t=this._cache.get(Oo)||new Da,this.parent?this.parent.getAbsoluteTransform().copyInto(t):t.reset();let e=this.transformsEnabled();if(e===`all`)t.multiply(this.getTransform());else if(e===`position`){let e=this.attrs.x||0,n=this.attrs.y||0,r=this.attrs.offsetX||0,i=this.attrs.offsetY||0;t.translate(e-r,n-i)}return t.dirty=!1,t}}getAbsoluteScale(e){let t=this;for(;t;)t._isUnderCache&&(e=t),t=t.getParent();let n=this.getAbsoluteTransform(e).decompose();return{x:n.scaleX,y:n.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Go,this._getTransform)}_getTransform(){let e=this._cache.get(Go)||new Da;e.reset();let t=this.x(),n=this.y(),r=L.getAngle(this.rotation()),i=this.attrs.scaleX??1,a=this.attrs.scaleY??1,o=this.attrs.skewX||0,s=this.attrs.skewY||0,c=this.attrs.offsetX||0,l=this.attrs.offsetY||0;return(t!==0||n!==0)&&e.translate(t,n),r!==0&&e.rotate(r),(o!==0||s!==0)&&e.skew(o,s),(i!==1||a!==1)&&e.scale(i,a),(c!==0||l!==0)&&e.translate(-1*c,-1*l),e.dirty=!1,e}clone(e){let t=z.cloneObject(this.attrs),n,r,i,a,o;for(n in e)t[n]=e[n];let s=new this.constructor(t);for(n in this.eventListeners)for(r=this.eventListeners[n],i=r.length,a=0;a<i;a++)o=r[a],o.name.indexOf(No)<0&&(s.eventListeners[n]||(s.eventListeners[n]=[]),s.eventListeners[n].push(o));return s}_toKonvaCanvas(e){e||={};let t=this.getClientRect(),n=this.getStage(),r=e.x===void 0?Math.floor(t.x):e.x,i=e.y===void 0?Math.floor(t.y):e.y,a=e.pixelRatio||1,o=new uo({width:e.width||Math.ceil(t.width)||(n?n.width():0),height:e.height||Math.ceil(t.height)||(n?n.height():0),pixelRatio:a}),s=o.getContext(),c=new uo({width:o.width/o.pixelRatio+Math.abs(r),height:o.height/o.pixelRatio+Math.abs(i),pixelRatio:o.pixelRatio});return e.imageSmoothingEnabled===!1&&(s._context.imageSmoothingEnabled=!1),s.save(),(r||i)&&s.translate(-1*r,-1*i),this.drawScene(o,void 0,c),s.restore(),o}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){e||={};let t=e.mimeType||null,n=e.quality||null,r=this._toKonvaCanvas(e).toDataURL(t,n);return e.callback&&e.callback(r),r}toImage(e){return new Promise((t,n)=>{try{let n=e?.callback;n&&delete e.callback,z._urlToImage(this.toDataURL(e),function(e){t(e),n?.(e)})}catch(e){n(e)}})}toBlob(e){return new Promise((t,n)=>{try{let n=e?.callback;n&&delete e.callback,this.toCanvas(e).toBlob(e=>{t(e),n?.(e)},e?.mimeType,e?.quality)}catch(e){n(e)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance===void 0?this.parent?this.parent.getDragDistance():L.dragDistance:this.attrs.dragDistance}_off(e,t,n){let r=this.eventListeners[e],i,a,o;for(i=0;i<r.length;i++)if(a=r[i].name,o=r[i].handler,(a!==`konva`||t===`konva`)&&(!t||a===t)&&(!n||n===o)){if(r.splice(i,1),r.length===0){delete this.eventListeners[e];break}i--}}_fireChangeEvent(e,t,n){this._fire(e+jo,{oldVal:t,newVal:n})}addName(e){if(!this.hasName(e)){let t=this.name(),n=t?t+` `+e:e;this.name(n)}return this}hasName(e){if(!e)return!1;let t=this.name();return t?(t||``).split(/\s/g).indexOf(e)!==-1:!1}removeName(e){let t=(this.name()||``).split(/\s/g),n=t.indexOf(e);return n!==-1&&(t.splice(n,1),this.name(t.join(` `))),this}setAttr(e,t){let n=this[Vo+z._capitalize(e)];return z._isFunction(n)?n.call(this,t):this._setAttr(e,t),this}_requestDraw(){L.autoDrawEnabled&&(this.getLayer()||this.getStage())?.batchDraw()}_setAttr(e,t){let n=this.attrs[e];n===t&&!z.isObject(t)||(t==null?delete this.attrs[e]:this.attrs[e]=t,this._shouldFireChangeEvents&&this._fireChangeEvent(e,n,t),this._requestDraw())}_setComponentAttr(e,t,n){let r;n!==void 0&&(r=this.attrs[e],r||(this.attrs[e]=this.getAttr(e)),this.attrs[e][t]=n,this._fireChangeEvent(e,r,n))}_fireAndBubble(e,t,n){t&&this.nodeType===Ho&&(t.target=this);let r=[Fo,Io,Lo,Ro,zo,Bo];if(!(r.indexOf(e)!==-1&&(n&&(this===n||this.isAncestorOf&&this.isAncestorOf(n))||this.nodeType===`Stage`&&!n))){this._fire(e,t);let i=r.indexOf(e)!==-1&&n&&n.isAncestorOf&&n.isAncestorOf(this)&&!n.isAncestorOf(this.parent);(t&&!t.cancelBubble||!t)&&this.parent&&this.parent.isListening()&&!i&&(n&&n.parent?this._fireAndBubble.call(this.parent,e,t,n):this._fireAndBubble.call(this.parent,e,t))}}_getProtoListeners(t){let{nodeType:n}=this,r=e.protoListenerMap.get(n)||{},i=r?.[t];if(i===void 0){i=[];let a=Object.getPrototypeOf(this);for(;a;){let e=a.eventListeners?.[t]??[];i.push(...e),a=Object.getPrototypeOf(a)}r[t]=i,e.protoListenerMap.set(n,r)}return i}_fire(e,t){t||={},t.currentTarget=this,t.type=e;let n=this._getProtoListeners(e);if(n){let e=n.slice();for(let n=0;n<e.length;n++)e[n].handler.call(this,t)}let r=this.eventListeners[e];if(r){let n=r.slice(),i=n.length;for(let e=0;e<n.length;e++)n[e].handler.call(this,t);let a=this.eventListeners[e];if(a)for(let e=i;e<a.length;e++)a[e].handler.call(this,t)}}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){let t=e?e.pointerId:void 0,n=this.getStage(),r=this.getAbsolutePosition();if(!n)return;let i=n._getPointerById(t)||n._changedPointerPositions[0]||r;po._dragElements.set(this._id,{node:this,startPointerPos:i,offset:{x:i.x-r.x,y:i.y-r.y},dragStatus:`ready`,pointerId:t,startEvent:e})}startDrag(e,t=!0){po._dragElements.has(this._id)||this._createDragElement(e);let n=po._dragElements.get(this._id);n.dragStatus=`dragging`,this.fire(`dragstart`,{type:`dragstart`,target:this,evt:n.startEvent&&n.startEvent.evt||e&&e.evt},t)}_setDragPosition(e,t){let n=this.getStage()._getPointerById(t.pointerId);if(!n)return;let r={x:n.x-t.offset.x,y:n.y-t.offset.y},i=this.dragBoundFunc();if(i!==void 0){let t=i.call(this,r,e);t?r=t:z.warn(`dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.`)}(!this._lastPos||this._lastPos.x!==r.x||this._lastPos.y!==r.y)&&(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}stopDrag(e){let t=po._dragElements.get(this._id);t&&(t.dragStatus=`stopped`),po._endDragBefore(e),po._endDragAfter(e)}setDraggable(e){this._setAttr(`draggable`,e),this._dragChange()}isDragging(){let e=po._dragElements.get(this._id);return e?e.dragStatus===`dragging`:!1}_listenDrag(){this._dragCleanup(),this.on(`mousedown.konva touchstart.konva`,function(e){if(!(e.evt.button===void 0||L.dragButtons.indexOf(e.evt.button)>=0)||this.isDragging())return;let t=!1;po._dragElements.forEach(e=>{this.isAncestorOf(e.node)&&(t=!0)}),t||this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;let e=po._dragElements.get(this._id),t=e&&e.dragStatus===`dragging`,n=e&&e.dragStatus===`ready`;t?this.stopDrag():n&&po._dragElements.delete(this._id)}}_dragCleanup(){this.off(`mousedown.konva`),this.off(`touchstart.konva`)}isClientRectOnScreen(e={x:0,y:0}){let t=this.getStage();if(!t)return!1;let n={x:-e.x,y:-e.y,width:t.width()+2*e.x,height:t.height()+2*e.y};return z.haveIntersection(n,this.getClientRect())}static create(e,t){return z._isString(e)&&(e=JSON.parse(e)),this._createNode(e,t)}static _createNode(t,n){let r=e.prototype.getClassName.call(t),i=t.children,a,o,s;n&&(t.attrs.container=n),L[r]||(z.warn(`Can not find a node with class name "`+r+`". Fallback to "Shape".`),r=`Shape`);let c=L[r];if(a=new c(t.attrs),i)for(o=i.length,s=0;s<o;s++)a.add(e._createNode(i[s]));return a}};H.protoListenerMap=new Map,H.prototype.nodeType=`Node`,H.prototype._attrsAffectingSize=[],H.prototype.eventListeners={},H.prototype.on(Jo,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Go),this._clearSelfAndDescendantCache(Oo)}),H.prototype.on(`visibleChange.konva`,function(){this._clearSelfAndDescendantCache(qo)}),H.prototype.on(`listeningChange.konva`,function(){this._clearSelfAndDescendantCache(Po)}),H.prototype.on(`opacityChange.konva`,function(){this._clearSelfAndDescendantCache(Eo)});var Xo=V.addGetterSetter;Xo(H,`zIndex`),Xo(H,`absolutePosition`),Xo(H,`position`),Xo(H,`x`,0,B()),Xo(H,`y`,0,B()),Xo(H,`globalCompositeOperation`,`source-over`,vo()),Xo(H,`opacity`,1,B()),Xo(H,`name`,``,vo()),Xo(H,`id`,``,vo()),Xo(H,`rotation`,0,B()),V.addComponentsGetterSetter(H,`scale`,[`x`,`y`]),Xo(H,`scaleX`,1,B()),Xo(H,`scaleY`,1,B()),V.addComponentsGetterSetter(H,`skew`,[`x`,`y`]),Xo(H,`skewX`,0,B()),Xo(H,`skewY`,0,B()),V.addComponentsGetterSetter(H,`offset`,[`x`,`y`]),Xo(H,`offsetX`,0,B()),Xo(H,`offsetY`,0,B()),Xo(H,`dragDistance`,void 0,B()),Xo(H,`width`,0,B()),Xo(H,`height`,0,B()),Xo(H,`listening`,!0,xo()),Xo(H,`preventDefault`,!0,xo()),Xo(H,`filters`,void 0,function(e){return this._filterUpToDate=!1,e}),Xo(H,`visible`,!0,xo()),Xo(H,`transformsEnabled`,`all`,vo()),Xo(H,`size`),Xo(H,`dragBoundFunc`),Xo(H,`draggable`,!1,xo()),V.backCompat(H,{rotateDeg:`rotate`,setRotationDeg:`setRotation`,getRotationDeg:`getRotation`});var Zo=class extends H{constructor(){super(...arguments),this.children=[]}getChildren(e){let t=this.children||[];return e?t.filter(e):t}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(let t=0;t<e.length;t++)this.add(e[t]);return this}let t=e[0];return t.getParent()?(t.moveTo(this),this):(this._validateAdd(t),t.index=this.getChildren().length,t.parent=this,t._clearCaches(),this.getChildren().push(t),this._fire(`add`,{child:t}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){let t=this._generalFind(e,!0);return t.length>0?t[0]:void 0}_generalFind(e,t){let n=[];return this._descendants(r=>{let i=r._isMatch(e);return i&&n.push(r),!!(i&&t)}),n}_descendants(e){let t=!1,n=this.getChildren();for(let r of n)if(t=e(r),t||r.hasChildren()&&(t=r._descendants(e),t))return!0;return!1}toObject(){let e=H.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(t=>{e.children.push(t.toObject())}),e}isAncestorOf(e){let t=e.getParent();for(;t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){let t=H.prototype.clone.call(this,e);return this.getChildren().forEach(function(e){t.add(e.clone())}),t}getAllIntersections(e){let t=[];return this.find(`Shape`).forEach(n=>{n.isVisible()&&n.intersects(e)&&t.push(n)}),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),!this.isCached()&&((t=this.children)==null||t.forEach(function(t){t._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)==null||e.forEach(function(e,t){e.index=t}),this._requestDraw()}drawScene(e,t,n){let r=this.getLayer(),i=e||r&&r.getCanvas(),a=i&&i.getContext(),o=this._getCanvasCache(),s=o&&o.scene,c=i&&i.isCache;if(!this.isVisible()&&!c)return this;if(s){a.save();let e=this.getAbsoluteTransform(t).getMatrix();a.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren(`drawScene`,i,t,n);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;let n=this.getLayer(),r=e||n&&n.hitCanvas,i=r&&r.getContext(),a=this._getCanvasCache();if(a&&a.hit){i.save();let e=this.getAbsoluteTransform(t).getMatrix();i.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedHitCanvas(i),i.restore()}else this._drawChildren(`drawHit`,r,t);return this}_drawChildren(e,t,n,r){var i;let a=t&&t.getContext(),o=this.clipWidth(),s=this.clipHeight(),c=this.clipFunc(),l=typeof o==`number`&&typeof s==`number`||c,u=n===this;if(l){a.save();let e=this.getAbsoluteTransform(n),t=e.getMatrix();a.transform(t[0],t[1],t[2],t[3],t[4],t[5]),a.beginPath();let r;if(c)r=c.call(this,a,this);else{let e=this.clipX(),t=this.clipY();a.rect(e||0,t||0,o,s)}a.clip.apply(a,r),t=e.copy().invert().getMatrix(),a.transform(t[0],t[1],t[2],t[3],t[4],t[5])}let d=!u&&this.globalCompositeOperation()!==`source-over`&&e===`drawScene`;d&&(a.save(),a._applyGlobalCompositeOperation(this)),(i=this.children)==null||i.forEach(function(i){i[e](t,n,r)}),d&&a.restore(),l&&a.restore()}getClientRect(e={}){var t;let n=e.skipTransform,r=e.relativeTo,i,a,o,s,c={x:1/0,y:1/0,width:0,height:0},l=this;(t=this.children)==null||t.forEach(function(t){if(!t.visible())return;let n=t.getClientRect({relativeTo:l,skipShadow:e.skipShadow,skipStroke:e.skipStroke});n.width===0&&n.height===0||(i===void 0?(i=n.x,a=n.y,o=n.x+n.width,s=n.y+n.height):(i=Math.min(i,n.x),a=Math.min(a,n.y),o=Math.max(o,n.x+n.width),s=Math.max(s,n.y+n.height)))});let u=this.find(`Shape`),d=!1;for(let e=0;e<u.length;e++)if(u[e]._isVisible(this)){d=!0;break}return c=d&&i!==void 0?{x:i,y:a,width:o-i,height:s-a}:{x:0,y:0,width:0,height:0},n?c:this._transformedRect(c,r)}};V.addComponentsGetterSetter(Zo,`clip`,[`x`,`y`,`width`,`height`]),V.addGetterSetter(Zo,`clipX`,void 0,B()),V.addGetterSetter(Zo,`clipY`,void 0,B()),V.addGetterSetter(Zo,`clipWidth`,void 0,B()),V.addGetterSetter(Zo,`clipHeight`,void 0,B()),V.addGetterSetter(Zo,`clipFunc`);var Qo=new Map,$o=L._global.PointerEvent!==void 0;function es(e){return Qo.get(e)}function ts(e){return{evt:e,pointerId:e.pointerId}}function ns(e,t){return Qo.get(e)===t}function rs(e,t){is(e),t.getStage()&&(Qo.set(e,t),$o&&t._fire(`gotpointercapture`,ts(new PointerEvent(`gotpointercapture`))))}function is(e,t){let n=Qo.get(e);if(!n)return;let r=n.getStage();r&&r.content,Qo.delete(e),$o&&n._fire(`lostpointercapture`,ts(new PointerEvent(`lostpointercapture`)))}var as=`Stage`,os=`string`,ss=`px`,cs=`mouseout`,ls=`mouseleave`,us=`mouseover`,ds=`mouseenter`,fs=`mousemove`,ps=`mousedown`,ms=`mouseup`,hs=`pointermove`,gs=`pointerdown`,_s=`pointerup`,vs=`pointercancel`,ys=`lostpointercapture`,bs=`pointerout`,xs=`pointerleave`,Ss=`pointerover`,Cs=`pointerenter`,ws=`contextmenu`,Ts=`touchstart`,Es=`touchend`,Ds=`touchmove`,Os=`touchcancel`,ks=`wheel`,As=5,js=[[ds,`_pointerenter`],[ps,`_pointerdown`],[fs,`_pointermove`],[ms,`_pointerup`],[ls,`_pointerleave`],[Ts,`_pointerdown`],[Ds,`_pointermove`],[Es,`_pointerup`],[Os,`_pointercancel`],[us,`_pointerover`],[ks,`_wheel`],[ws,`_contextmenu`],[gs,`_pointerdown`],[hs,`_pointermove`],[_s,`_pointerup`],[vs,`_pointercancel`],[xs,`_pointerleave`],[ys,`_lostpointercapture`]],Ms={mouse:{[bs]:cs,[xs]:ls,[Ss]:us,[Cs]:ds,[hs]:fs,[gs]:ps,[_s]:ms,[vs]:`mousecancel`,pointerclick:`click`,pointerdblclick:`dblclick`},touch:{[bs]:`touchout`,[xs]:`touchleave`,[Ss]:`touchover`,[Cs]:`touchenter`,[hs]:Ds,[gs]:Ts,[_s]:Es,[vs]:Os,pointerclick:`tap`,pointerdblclick:`dbltap`},pointer:{[bs]:bs,[xs]:xs,[Ss]:Ss,[Cs]:Cs,[hs]:hs,[gs]:gs,[_s]:_s,[vs]:vs,pointerclick:`pointerclick`,pointerdblclick:`pointerdblclick`}},Ns=e=>e.indexOf(`pointer`)>=0?`pointer`:e.indexOf(`touch`)>=0?`touch`:`mouse`,Ps=e=>{let t=Ns(e);if(t===`pointer`)return L.pointerEventsEnabled&&Ms.pointer;if(t===`touch`)return Ms.touch;if(t===`mouse`)return Ms.mouse};function Fs(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&z.warn(`Stage does not support clipping. Please use clip for Layers or Groups.`),e}var Is=`Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);`,Ls=[],Rs=class extends Zo{constructor(e){super(Fs(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Ls.push(this),this.on(`widthChange.konva heightChange.konva`,this._resizeDOM),this.on(`visibleChange.konva`,this._checkVisibility),this.on(`clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva`,()=>{Fs(this.attrs)}),this._checkVisibility()}_validateAdd(e){let t=e.getType()===`Layer`,n=e.getType()===`FastLayer`;t||n||z.throw(`You may only add layers to the stage.`)}_checkVisibility(){if(!this.content)return;let e=this.visible()?``:`none`;this.content.style.display=e}setContainer(e){if(typeof e===os){let t;if(e.charAt(0)===`.`){let t=e.slice(1);e=document.getElementsByClassName(t)[0]}else t=e.charAt(0)===`#`?e.slice(1):e,e=document.getElementById(t);if(!e)throw`Can not find container in document with id `+t}return this._setAttr(`container`,e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){let e=this.children,t=e.length;for(let n=0;n<t;n++)e[n].clear();return this}clone(e){return e||={},e.container=typeof document<`u`&&document.createElement(`div`),Zo.prototype.clone.call(this,e)}destroy(){super.destroy();let e=this.content;e&&z._isInDocument(e)&&this.container().removeChild(e);let t=Ls.indexOf(this);return t>-1&&Ls.splice(t,1),z.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){let e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(z.warn(Is),null)}_getPointerById(e){return this._pointerPositions.find(t=>t.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e={...e},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();let t=new uo({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,r=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),r.forEach(function(t){if(!t.isVisible())return;let r=t._toKonvaCanvas(e);n.drawImage(r._canvas,e.x,e.y,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}),t}getIntersection(e){if(!e)return null;let t=this.children,n=t.length-1;for(let r=n;r>=0;r--){let n=t[r].getIntersection(e);if(n)return n}return null}_resizeDOM(){let e=this.width(),t=this.height();this.content&&(this.content.style.width=e+ss,this.content.style.height=t+ss),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach(n=>{n.setSize({width:e,height:t}),n.draw()})}add(e,...t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}super.add(e);let n=this.children.length;return n>As&&z.warn(`The stage has `+n+` layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group.`),e.setSize({width:this.width(),height:this.height()}),e.draw(),L.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return ns(e,this)}setPointerCapture(e){rs(e,this)}releaseCapture(e){is(e,this)}getLayers(){return this.children}_bindContentEvents(){L.isBrowser&&js.forEach(([e,t])=>{this.content.addEventListener(e,e=>{this[t](e)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);let t=Ps(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);let t=Ps(e.type);t&&this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+`targetShape`];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){let t=Ps(e.type),n=Ns(e.type);if(!t)return;this.setPointersPositions(e);let r=this._getTargetShape(n),i=!(L.isDragging()||L.isTransforming())||L.hitOnDragEnabled;r&&i?(r._fireAndBubble(t.pointerout,{evt:e}),r._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+`targetShape`]=null):i&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(e){let t=Ps(e.type),n=Ns(e.type);if(!t)return;this.setPointersPositions(e);let r=!1;this._changedPointerPositions.forEach(i=>{let a=this.getIntersection(i);if(po.justDragged=!1,L[`_`+n+`ListenClick`]=!0,!a||!a.isListening()){this[n+`ClickStartShape`]=void 0;return}L.capturePointerEventsEnabled&&a.setPointerCapture(i.id),this[n+`ClickStartShape`]=a,a._fireAndBubble(t.pointerdown,{evt:e,pointerId:i.id}),r=!0;let o=e.type.indexOf(`touch`)>=0;a.preventDefault()&&e.cancelable&&o&&e.preventDefault()}),r||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(e){let t=Ps(e.type),n=Ns(e.type);if(!t)return;let r=e.type.indexOf(`touch`)>=0||e.pointerType===`touch`;if(L.isDragging()&&po.node.preventDefault()&&e.cancelable&&r&&e.preventDefault(),this.setPointersPositions(e),!(!(L.isDragging()||L.isTransforming())||L.hitOnDragEnabled))return;let i={},a=!1,o=this._getTargetShape(n);this._changedPointerPositions.forEach(r=>{let s=es(r.id)||this.getIntersection(r),c=r.id,l={evt:e,pointerId:c},u=o!==s;if(u&&o&&(o._fireAndBubble(t.pointerout,{...l},s),o._fireAndBubble(t.pointerleave,{...l},s)),s){if(i[s._id])return;i[s._id]=!0}s&&s.isListening()?(a=!0,u&&(s._fireAndBubble(t.pointerover,{...l},o),s._fireAndBubble(t.pointerenter,{...l},o),this[n+`targetShape`]=s),s._fireAndBubble(t.pointermove,{...l})):o&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:c}),this[n+`targetShape`]=null)}),a||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){let t=Ps(e.type),n=Ns(e.type);if(!t)return;this.setPointersPositions(e);let r=this[n+`ClickStartShape`],i=this[n+`ClickEndShape`],a={},o=!1;this._changedPointerPositions.forEach(s=>{let c=es(s.id)||this.getIntersection(s);if(c){if(c.releaseCapture(s.id),a[c._id])return;a[c._id]=!0}let l=s.id,u={evt:e,pointerId:l},d=!1;L[`_`+n+`InDblClickWindow`]?(d=!0,clearTimeout(this[n+`DblTimeout`])):po.justDragged||(L[`_`+n+`InDblClickWindow`]=!0,clearTimeout(this[n+`DblTimeout`])),this[n+`DblTimeout`]=setTimeout(function(){L[`_`+n+`InDblClickWindow`]=!1},L.dblClickWindow),c&&c.isListening()?(o=!0,this[n+`ClickEndShape`]=c,c._fireAndBubble(t.pointerup,{...u}),L[`_`+n+`ListenClick`]&&r&&r===c&&(c._fireAndBubble(t.pointerclick,{...u}),d&&i&&i===c&&c._fireAndBubble(t.pointerdblclick,{...u}))):(this[n+`ClickEndShape`]=null,o||=(this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),!0),L[`_`+n+`ListenClick`]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:l}),d&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:l}))}),o||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),L[`_`+n+`ListenClick`]=!1,e.cancelable&&n!==`touch`&&n!==`pointer`&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);let t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(ws,{evt:e}):this._fire(ws,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);let t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(ks,{evt:e}):this._fire(ks,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);let t=es(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(_s,ts(e)),is(e.pointerId)}_lostpointercapture(e){is(e.pointerId)}setPointersPositions(e){let t=this._getContentPosition(),n=null,r=null;e||=window.event,e.touches===void 0?(n=(e.clientX-t.left)/t.scaleX,r=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:z._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:z._getFirstPointerId(e)}]):(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,e=>{this._pointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,e=>{this._changedPointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}))}_setPointerPosition(e){z.warn(`Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.`),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};let e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new uo({width:this.width(),height:this.height()}),this.bufferHitCanvas=new fo({pixelRatio:1,width:this.width(),height:this.height()}),!L.isBrowser)return;let e=this.container();if(!e)throw`Stage has no container. A container is required.`;e.innerHTML=``,this.content=document.createElement(`div`),this.content.style.position=`relative`,this.content.style.userSelect=`none`,this.content.className=`konvajs-content`,this.content.setAttribute(`role`,`presentation`),e.appendChild(this.content),this._resizeDOM()}cache(){return z.warn(`Cache function is not allowed for stage. You may use cache only for layers, groups and shapes.`),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(e){e.batchDraw()}),this}};Rs.prototype.nodeType=as,wa(Rs),V.addGetterSetter(Rs,`container`),L.isBrowser&&document.addEventListener(`visibilitychange`,()=>{Ls.forEach(e=>{e.batchDraw()})});var zs=`hasShadow`,Bs=`shadowRGBA`,Vs=`patternImage`,Hs=`linearGradient`,Us=`radialGradient`,Ws;function Gs(){return Ws||(Ws=z.createCanvasElement().getContext(`2d`),Ws)}var Ks={};function qs(e){let t=this.attrs.fillRule;t?e.fill(t):e.fill()}function Js(e){e.stroke()}function Ys(e){let t=this.attrs.fillRule;t?e.fill(t):e.fill()}function Xs(e){e.stroke()}function Zs(){this._clearCache(zs)}function Qs(){this._clearCache(Bs)}function $s(){this._clearCache(Vs)}function ec(){this._clearCache(Hs)}function tc(){this._clearCache(Us)}var U=class extends H{constructor(e){super(e);let t,n=0;for(;t=z.getHitColor(),!(t&&!(t in Ks));)if(n++,n>=1e4){z.warn(`Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it.`),t=z.getRandomColor();break}this.colorKey=t,Ks[t]=this}getContext(){return z.warn(`shape.getContext() method is deprecated. Please do not use it.`),this.getLayer().getContext()}getCanvas(){return z.warn(`shape.getCanvas() method is deprecated. Please do not use it.`),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(zs,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(Vs,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){let e=Gs().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||`repeat`);if(e&&e.setTransform){let t=new Da;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(L.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());let n=t.getMatrix(),r=typeof DOMMatrix>`u`?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(r)}return e}}_getLinearGradient(){return this._getCache(Hs,this.__getLinearGradient)}__getLinearGradient(){let e=this.fillLinearGradientColorStops();if(e){let t=Gs(),n=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),i=t.createLinearGradient(n.x,n.y,r.x,r.y);for(let t=0;t<e.length;t+=2)i.addColorStop(e[t],e[t+1]);return i}}_getRadialGradient(){return this._getCache(Us,this.__getRadialGradient)}__getRadialGradient(){let e=this.fillRadialGradientColorStops();if(e){let t=Gs(),n=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),i=t.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius());for(let t=0;t<e.length;t+=2)i.addColorStop(e[t],e[t+1]);return i}}getShadowRGBA(){return this._getCache(Bs,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;let e=z.colorToRGBA(this.shadowColor());if(e)return`rgba(`+e.r+`,`+e.g+`,`+e.b+`,`+e.a*(this.shadowOpacity()||1)+`)`}hasFill(){return this._calculate(`hasFill`,[`fillEnabled`,`fill`,`fillPatternImage`,`fillLinearGradientColorStops`,`fillRadialGradientColorStops`],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate(`hasStroke`,[`strokeEnabled`,`strokeWidth`,`stroke`,`strokeLinearGradientColorStops`],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){let e=this.hitStrokeWidth();return e===`auto`?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){let t=this.getStage();if(!t)return!1;let n=t.bufferHitCanvas;return n.getContext().clear(),this.drawHit(n,void 0,!0),n.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return H.prototype.destroy.call(this),delete Ks[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){if(!(this.attrs.perfectDrawEnabled??!0))return!1;let t=e||this.hasFill(),n=this.hasStroke(),r=this.getAbsoluteOpacity()!==1;if(t&&n&&r)return!0;let i=this.hasShadow(),a=this.shadowForStrokeEnabled();return!!(t&&n&&i&&a)}setStrokeHitEnabled(e){z.warn(`strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead.`),e?this.hitStrokeWidth(`auto`):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){let e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let t=!1,n=this.getParent();for(;n;){if(n.isCached()){t=!0;break}n=n.getParent()}let r=e.skipTransform,i=e.relativeTo||t&&this.getStage()||void 0,a=this.getSelfRect(),o=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,s=a.width+o,c=a.height+o,l=!e.skipShadow&&this.hasShadow(),u=l?this.shadowOffsetX():0,d=l?this.shadowOffsetY():0,f=s+Math.abs(u),p=c+Math.abs(d),m=l&&this.shadowBlur()||0,h={width:f+m*2,height:p+m*2,x:-(o/2+m)+Math.min(u,0)+a.x,y:-(o/2+m)+Math.min(d,0)+a.y};return r?h:this._transformedRect(h,i)}drawScene(e,t,n){let r=this.getLayer(),i=(e||r.getCanvas()).getContext(),a=this._getCanvasCache(),o=this.getSceneFunc(),s=this.hasShadow(),c,l=t===this;if(!this.isVisible()&&!l)return this;if(a){i.save();let e=this.getAbsoluteTransform(t).getMatrix();return i.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedSceneCanvas(i),i.restore(),this}if(!o)return this;if(i.save(),this._useBufferCanvas()){c=this.getStage();let e=n||c.bufferCanvas,r=e.getContext();n?(r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,e.width,e.height),r.restore()):r.clear(),r.save(),r._applyLineJoin(this),r._applyMiterLimit(this);let a=this.getAbsoluteTransform(t).getMatrix();r.transform(a[0],a[1],a[2],a[3],a[4],a[5]),o.call(this,r,this),r.restore();let u=e.pixelRatio;s&&i._applyShadow(this),l||(i._applyOpacity(this),i._applyGlobalCompositeOperation(this)),i.drawImage(e._canvas,e.x||0,e.y||0,e.width/u,e.height/u)}else{if(i._applyLineJoin(this),i._applyMiterLimit(this),!l){let e=this.getAbsoluteTransform(t).getMatrix();i.transform(e[0],e[1],e[2],e[3],e[4],e[5]),i._applyOpacity(this),i._applyGlobalCompositeOperation(this)}s&&i._applyShadow(this),o.call(this,i,this)}return i.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;let r=this.getLayer(),i=e||r.hitCanvas,a=i&&i.getContext(),o=this.hitFunc()||this.sceneFunc(),s=this._getCanvasCache(),c=s&&s.hit;if(this.colorKey||z.warn(`Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()`),c){a.save();let e=this.getAbsoluteTransform(t).getMatrix();return a.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedHitCanvas(a),a.restore(),this}if(!o)return this;if(a.save(),a._applyLineJoin(this),a._applyMiterLimit(this),this!==t){let e=this.getAbsoluteTransform(t).getMatrix();a.transform(e[0],e[1],e[2],e[3],e[4],e[5])}return o.call(this,a,this),a.restore(),this}drawHitFromCache(e=0){let t=this._getCanvasCache(),n=this._getCachedSceneCanvas(),r=t.hit,i=r.getContext(),a=r.getWidth(),o=r.getHeight();i.clear(),i.drawImage(n._canvas,0,0,a,o);try{let t=i.getImageData(0,0,a,o),n=t.data,r=n.length,s=z._hexToRgb(this.colorKey);for(let t=0;t<r;t+=4)n[t+3]>e?(n[t]=s.r,n[t+1]=s.g,n[t+2]=s.b,n[t+3]=255):n[t+3]=0;i.putImageData(t,0,0)}catch(e){z.error(`Unable to draw hit graph from cached scene canvas. `+e.message)}return this}hasPointerCapture(e){return ns(e,this)}setPointerCapture(e){rs(e,this)}releaseCapture(e){is(e,this)}};U.prototype._fillFunc=qs,U.prototype._strokeFunc=Js,U.prototype._fillFuncHit=Ys,U.prototype._strokeFuncHit=Xs,U.prototype._centroid=!1,U.prototype.nodeType=`Shape`,wa(U),U.prototype.eventListeners={},U.prototype.on(`shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva`,Zs),U.prototype.on(`shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva`,Qs),U.prototype.on(`fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva`,$s),U.prototype.on(`fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva`,ec),U.prototype.on(`fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva`,tc),V.addGetterSetter(U,`stroke`,void 0,yo()),V.addGetterSetter(U,`strokeWidth`,2,B()),V.addGetterSetter(U,`fillAfterStrokeEnabled`,!1),V.addGetterSetter(U,`hitStrokeWidth`,`auto`,_o()),V.addGetterSetter(U,`strokeHitEnabled`,!0,xo()),V.addGetterSetter(U,`perfectDrawEnabled`,!0,xo()),V.addGetterSetter(U,`shadowForStrokeEnabled`,!0,xo()),V.addGetterSetter(U,`lineJoin`),V.addGetterSetter(U,`lineCap`),V.addGetterSetter(U,`miterLimit`),V.addGetterSetter(U,`sceneFunc`),V.addGetterSetter(U,`hitFunc`),V.addGetterSetter(U,`dash`),V.addGetterSetter(U,`dashOffset`,0,B()),V.addGetterSetter(U,`shadowColor`,void 0,vo()),V.addGetterSetter(U,`shadowBlur`,0,B()),V.addGetterSetter(U,`shadowOpacity`,1,B()),V.addComponentsGetterSetter(U,`shadowOffset`,[`x`,`y`]),V.addGetterSetter(U,`shadowOffsetX`,0,B()),V.addGetterSetter(U,`shadowOffsetY`,0,B()),V.addGetterSetter(U,`fillPatternImage`),V.addGetterSetter(U,`fill`,void 0,yo()),V.addGetterSetter(U,`fillPatternX`,0,B()),V.addGetterSetter(U,`fillPatternY`,0,B()),V.addGetterSetter(U,`fillLinearGradientColorStops`),V.addGetterSetter(U,`strokeLinearGradientColorStops`),V.addGetterSetter(U,`fillRadialGradientStartRadius`,0),V.addGetterSetter(U,`fillRadialGradientEndRadius`,0),V.addGetterSetter(U,`fillRadialGradientColorStops`),V.addGetterSetter(U,`fillPatternRepeat`,`repeat`),V.addGetterSetter(U,`fillEnabled`,!0),V.addGetterSetter(U,`strokeEnabled`,!0),V.addGetterSetter(U,`shadowEnabled`,!0),V.addGetterSetter(U,`dashEnabled`,!0),V.addGetterSetter(U,`strokeScaleEnabled`,!0),V.addGetterSetter(U,`fillPriority`,`color`),V.addComponentsGetterSetter(U,`fillPatternOffset`,[`x`,`y`]),V.addGetterSetter(U,`fillPatternOffsetX`,0,B()),V.addGetterSetter(U,`fillPatternOffsetY`,0,B()),V.addComponentsGetterSetter(U,`fillPatternScale`,[`x`,`y`]),V.addGetterSetter(U,`fillPatternScaleX`,1,B()),V.addGetterSetter(U,`fillPatternScaleY`,1,B()),V.addComponentsGetterSetter(U,`fillLinearGradientStartPoint`,[`x`,`y`]),V.addComponentsGetterSetter(U,`strokeLinearGradientStartPoint`,[`x`,`y`]),V.addGetterSetter(U,`fillLinearGradientStartPointX`,0),V.addGetterSetter(U,`strokeLinearGradientStartPointX`,0),V.addGetterSetter(U,`fillLinearGradientStartPointY`,0),V.addGetterSetter(U,`strokeLinearGradientStartPointY`,0),V.addComponentsGetterSetter(U,`fillLinearGradientEndPoint`,[`x`,`y`]),V.addComponentsGetterSetter(U,`strokeLinearGradientEndPoint`,[`x`,`y`]),V.addGetterSetter(U,`fillLinearGradientEndPointX`,0),V.addGetterSetter(U,`strokeLinearGradientEndPointX`,0),V.addGetterSetter(U,`fillLinearGradientEndPointY`,0),V.addGetterSetter(U,`strokeLinearGradientEndPointY`,0),V.addComponentsGetterSetter(U,`fillRadialGradientStartPoint`,[`x`,`y`]),V.addGetterSetter(U,`fillRadialGradientStartPointX`,0),V.addGetterSetter(U,`fillRadialGradientStartPointY`,0),V.addComponentsGetterSetter(U,`fillRadialGradientEndPoint`,[`x`,`y`]),V.addGetterSetter(U,`fillRadialGradientEndPointX`,0),V.addGetterSetter(U,`fillRadialGradientEndPointY`,0),V.addGetterSetter(U,`fillPatternRotation`,0),V.addGetterSetter(U,`fillRule`,void 0,vo()),V.backCompat(U,{dashArray:`dash`,getDashArray:`getDash`,setDashArray:`getDash`,drawFunc:`sceneFunc`,getDrawFunc:`getSceneFunc`,setDrawFunc:`setSceneFunc`,drawHitFunc:`hitFunc`,getDrawHitFunc:`getHitFunc`,setDrawHitFunc:`setHitFunc`});var nc=`beforeDraw`,rc=`draw`,ic=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],ac=ic.length,oc=class extends Zo{constructor(e){super(e),this.canvas=new uo,this.hitCanvas=new fo({pixelRatio:1}),this._waitingForDraw=!1,this.on(`visibleChange.konva`,this._checkVisibility),this._checkVisibility(),this.on(`imageSmoothingEnabledChange.konva`,this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);let t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[e+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){H.prototype.moveToTop.call(this);let e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!H.prototype.moveUp.call(this))return!1;let e=this.getStage();return!e||!e.content?!1:(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(H.prototype.moveDown.call(this)){let e=this.getStage();if(e){let t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(H.prototype.moveToBottom.call(this)){let e=this.getStage();if(e){let t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){let e=this.getNativeCanvasElement();return H.prototype.remove.call(this),e&&e.parentNode&&z._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:t}){return this.canvas.setSize(e,t),this.hitCanvas.setSize(e,t),this._setSmoothEnabled(),this}_validateAdd(e){let t=e.getType();t!==`Group`&&t!==`Shape`&&z.throw(`You may only add groups and shapes to a layer.`)}_toKonvaCanvas(e){return e={...e},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x===void 0?this.x():e.x,e.y=e.y===void 0?this.y():e.y,H.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display=`block`:this.canvas._canvas.style.display=`none`}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){z.warn(`Can not change width of layer. Use "stage.width(value)" function instead.`)}getHeight(){if(this.parent)return this.parent.height()}setHeight(){z.warn(`Can not change height of layer. Use "stage.height(value)" function instead.`)}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,z.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let t=1,n=!1;for(;;){for(let r=0;r<ac;r++){let i=ic[r],a=this._getIntersection({x:e.x+i.x*t,y:e.y+i.y*t}),o=a.shape;if(o)return o;if(n=!!a.antialiased,!a.antialiased)break}if(n)t+=1;else return null}}_getIntersection(e){let t=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(e.x*t),Math.round(e.y*t),1,1).data,r=n[3];if(r===255){let e=Ks[z.getHitColorKey(n[0],n[1],n[2])];return e?{shape:e}:{antialiased:!0}}else if(r>0)return{antialiased:!0};return{}}drawScene(e,t,n){let r=this.getLayer(),i=e||r&&r.getCanvas();return this._fire(nc,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),Zo.prototype.drawScene.call(this,i,t,n),this._fire(rc,{node:this}),this}drawHit(e,t){let n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),Zo.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){z.warn(`hitGraphEnabled method is deprecated. Please use layer.listening() instead.`),this.listening(e)}getHitGraphEnabled(e){return z.warn(`hitGraphEnabled method is deprecated. Please use layer.listening() instead.`),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;let e=this.parent;this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return z.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};oc.prototype.nodeType=`Layer`,wa(oc),V.addGetterSetter(oc,`imageSmoothingEnabled`,!0),V.addGetterSetter(oc,`clearBeforeDraw`,!0),V.addGetterSetter(oc,`hitGraphEnabled`,!0,xo());var sc=class extends oc{constructor(e){super(e),this.listening(!1),z.warn(`Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.`)}};sc.prototype.nodeType=`FastLayer`,wa(sc);var cc=class extends Zo{_validateAdd(e){let t=e.getType();t!==`Group`&&t!==`Shape`&&z.throw(`You may only add groups and shapes to groups.`)}};cc.prototype.nodeType=`Group`,wa(cc);var lc=(function(){return Ca.performance&&Ca.performance.now?function(){return Ca.performance.now()}:function(){return new Date().getTime()}})(),uc=class e{constructor(t,n){this.id=e.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:lc(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(e){let t=[];return e&&(t=Array.isArray(e)?e:[e]),this.layers=t,this}getLayers(){return this.layers}addLayer(e){let t=this.layers,n=t.length;for(let r=0;r<n;r++)if(t[r]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){let t=e.animations,n=t.length;for(let e=0;e<n;e++)if(t[e].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=lc(),e._addAnimation(this),this}stop(){return e._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){let t=e.id,n=this.animations,r=n.length;for(let e=0;e<r;e++)if(n[e].id===t){this.animations.splice(e,1);break}}static _runFrames(){let e={},t=this.animations;for(let n=0;n<t.length;n++){let r=t[n],i=r.layers,a=r.func;r._updateFrameObject(lc());let o=i.length,s;if(s=a?a.call(r,r.frame)!==!1:!0,s)for(let t=0;t<o;t++){let n=i[t];n._id!==void 0&&(e[n._id]=n)}}for(let t in e)e.hasOwnProperty(t)&&e[t].batchDraw()}static _animationLoop(){let t=e;t.animations.length?(t._runFrames(),z.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,z.requestAnimFrame(this._animationLoop))}};uc.animations=[],uc.animIdCounter=0,uc.animRunning=!1;var dc={node:1,duration:1,easing:1,onFinish:1,yoyo:1},fc=1,pc=2,mc=3,hc=[`fill`,`stroke`,`shadowColor`],gc=0,_c=class{constructor(e,t,n,r,i,a,o){this.prop=e,this.propFunc=t,this.begin=r,this._pos=r,this.duration=a,this._change=0,this.prevPos=0,this.yoyo=o,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=i-this.begin,this.pause()}fire(e){let t=this[e];t&&t()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=pc,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire(`onPlay`)}reverse(){this.state=mc,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire(`onReverse`)}seek(e){this.pause(),this._time=e,this.update(),this.fire(`onSeek`)}reset(){this.pause(),this._time=0,this.update(),this.fire(`onReset`)}finish(){this.pause(),this._time=this.duration,this.update(),this.fire(`onFinish`)}update(){this.setPosition(this.getPosition(this._time)),this.fire(`onUpdate`)}onEnterFrame(){let e=this.getTimer()-this._startTime;this.state===pc?this.setTime(e):this.state===mc&&this.setTime(this.duration-e)}pause(){this.state=fc,this.fire(`onPause`)}getTimer(){return new Date().getTime()}},vc=class e{constructor(t){let n=this,r=t.node,i=r._id,a=t.easing||yc.Linear,o=!!t.yoyo,s,c;s=t.duration===void 0?.3:t.duration===0?.001:t.duration,this.node=r,this._id=gc++;let l=r.getLayer()||(r instanceof L.Stage?r.getLayers():null);for(c in l||z.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new uc(function(){n.tween.onEnterFrame()},l),this.tween=new _c(c,function(e){n._tweenFunc(e)},a,0,1,s*1e3,o),this._addListeners(),e.attrs[i]||(e.attrs[i]={}),e.attrs[i][this._id]||(e.attrs[i][this._id]={}),e.tweens[i]||(e.tweens[i]={}),t)dc[c]===void 0&&this._addAttr(c,t[c]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,n){let r=this.node,i=r._id,a,o,s,c,l,u=e.tweens[i][t];u&&delete e.attrs[i][u][t];let d=r.getAttr(t);if(z._isArray(n))if(a=[],o=Math.max(n.length,d.length),t===`points`&&n.length!==d.length&&(n.length>d.length?(c=d,d=z._prepareArrayForTween(d,n,r.closed())):(s=n,n=z._prepareArrayForTween(n,d,r.closed()))),t.indexOf(`fill`)===0)for(let e=0;e<o;e++)if(e%2==0)a.push(n[e]-d[e]);else{let t=z.colorToRGBA(d[e]);l=z.colorToRGBA(n[e]),d[e]=t,a.push({r:l.r-t.r,g:l.g-t.g,b:l.b-t.b,a:l.a-t.a})}else for(let e=0;e<o;e++)a.push(n[e]-d[e]);else hc.indexOf(t)===-1?a=n-d:(d=z.colorToRGBA(d),l=z.colorToRGBA(n),a={r:l.r-d.r,g:l.g-d.g,b:l.b-d.b,a:l.a-d.a});e.attrs[i][this._id][t]={start:d,diff:a,end:n,trueEnd:s,trueStart:c},e.tweens[i][t]=this._id}_tweenFunc(t){let n=this.node,r=e.attrs[n._id][this._id],i,a,o,s,c,l,u,d;for(i in r){if(a=r[i],o=a.start,s=a.diff,d=a.end,z._isArray(o))if(c=[],u=Math.max(o.length,d.length),i.indexOf(`fill`)===0)for(l=0;l<u;l++)l%2==0?c.push((o[l]||0)+s[l]*t):c.push(`rgba(`+Math.round(o[l].r+s[l].r*t)+`,`+Math.round(o[l].g+s[l].g*t)+`,`+Math.round(o[l].b+s[l].b*t)+`,`+(o[l].a+s[l].a*t)+`)`);else for(l=0;l<u;l++)c.push((o[l]||0)+s[l]*t);else c=hc.indexOf(i)===-1?o+s*t:`rgba(`+Math.round(o.r+s.r*t)+`,`+Math.round(o.g+s.g*t)+`,`+Math.round(o.b+s.b*t)+`,`+(o.a+s.a*t)+`)`;n.setAttr(i,c)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{let t=this.node,n=e.attrs[t._id][this._id];n.points&&n.points.trueEnd&&t.setAttr(`points`,n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{let t=this.node,n=e.attrs[t._id][this._id];n.points&&n.points.trueStart&&t.points(n.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(e*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){let t=this.node._id,n=this._id,r=e.tweens[t];this.pause(),this.anim&&this.anim.stop();for(let n in r)delete e.tweens[t][n];delete e.attrs[t][n],e.tweens[t]&&(Object.keys(e.tweens[t]).length===0&&delete e.tweens[t],Object.keys(e.attrs[t]).length===0&&delete e.attrs[t])}};vc.attrs={},vc.tweens={},H.prototype.to=function(e){let t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new vc(e).play()};var yc={BackEaseIn(e,t,n,r){let i=1.70158;return n*(e/=r)*e*((i+1)*e-i)+t},BackEaseOut(e,t,n,r){let i=1.70158;return n*((e=e/r-1)*e*((i+1)*e+i)+1)+t},BackEaseInOut(e,t,n,r){let i=1.70158;return(e/=r/2)<1?n/2*(e*e*(((i*=1.525)+1)*e-i))+t:n/2*((e-=2)*e*(((i*=1.525)+1)*e+i)+2)+t},ElasticEaseIn(e,t,n,r,i,a){let o=0;return e===0?t:(e/=r)===1?t+n:(a||=r*.3,!i||i<Math.abs(n)?(i=n,o=a/4):o=a/(2*Math.PI)*Math.asin(n/i),-(i*2**(10*--e)*Math.sin((e*r-o)*(2*Math.PI)/a))+t)},ElasticEaseOut(e,t,n,r,i,a){let o=0;return e===0?t:(e/=r)===1?t+n:(a||=r*.3,!i||i<Math.abs(n)?(i=n,o=a/4):o=a/(2*Math.PI)*Math.asin(n/i),i*2**(-10*e)*Math.sin((e*r-o)*(2*Math.PI)/a)+n+t)},ElasticEaseInOut(e,t,n,r,i,a){let o=0;return e===0?t:(e/=r/2)==2?t+n:(a||=.3*1.5*r,!i||i<Math.abs(n)?(i=n,o=a/4):o=a/(2*Math.PI)*Math.asin(n/i),e<1?-.5*(i*2**(10*--e)*Math.sin((e*r-o)*(2*Math.PI)/a))+t:i*2**(-10*--e)*Math.sin((e*r-o)*(2*Math.PI)/a)*.5+n+t)},BounceEaseOut(e,t,n,r){return(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},BounceEaseIn(e,t,n,r){return n-yc.BounceEaseOut(r-e,0,n,r)+t},BounceEaseInOut(e,t,n,r){return e<r/2?yc.BounceEaseIn(e*2,0,n,r)*.5+t:yc.BounceEaseOut(e*2-r,0,n,r)*.5+n*.5+t},EaseIn(e,t,n,r){return n*(e/=r)*e+t},EaseOut(e,t,n,r){return-n*(e/=r)*(e-2)+t},EaseInOut(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},StrongEaseIn(e,t,n,r){return n*(e/=r)*e*e*e*e+t},StrongEaseOut(e,t,n,r){return n*((e=e/r-1)*e*e*e*e+1)+t},StrongEaseInOut(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t},Linear(e,t,n,r){return n*e/r+t}},W=z._assign(L,{Util:z,Transform:Da,Node:H,Container:Zo,Stage:Rs,stages:Ls,Layer:oc,FastLayer:sc,Group:cc,DD:po,Shape:U,shapes:Ks,Animation:uc,Tween:vc,Easings:yc,Context:io,Canvas:lo}),bc=class extends U{_sceneFunc(e){let t=L.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,t,n),e.arc(0,0,this.innerRadius(),t,0,!n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){let e=this.innerRadius(),t=this.outerRadius(),n=this.clockwise(),r=L.getAngle(n?360-this.angle():this.angle()),i=Math.cos(Math.min(r,Math.PI)),a=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),o=Math.sin(Math.min(r,Math.PI/2)),s=i*(i>0?e:t),c=1*t,l=a*(a>0?e:t),u=o*(o>0?t:e);return{x:s,y:n?-1*u:l,width:c-s,height:u-l}}};bc.prototype._centroid=!0,bc.prototype.className=`Arc`,bc.prototype._attrsAffectingSize=[`innerRadius`,`outerRadius`,`angle`,`clockwise`],wa(bc),V.addGetterSetter(bc,`innerRadius`,0,B()),V.addGetterSetter(bc,`outerRadius`,0,B()),V.addGetterSetter(bc,`angle`,0,B()),V.addGetterSetter(bc,`clockwise`,!1,xo());function xc(e,t,n,r,i,a,o){let s=Math.sqrt((n-e)**2+(r-t)**2),c=Math.sqrt((i-n)**2+(a-r)**2),l=o*s/(s+c),u=o*c/(s+c);return[n-l*(i-e),r-l*(a-t),n+u*(i-e),r+u*(a-t)]}function Sc(e,t){let n=e.length,r=[];for(let i=2;i<n-2;i+=2){let n=xc(e[i-2],e[i-1],e[i],e[i+1],e[i+2],e[i+3],t);isNaN(n[0])||(r.push(n[0]),r.push(n[1]),r.push(e[i]),r.push(e[i+1]),r.push(n[2]),r.push(n[3]))}return r}function Cc(e){let t=[[e[0],e[2],e[4],e[6]],[e[1],e[3],e[5],e[7]]],n=[];for(let e of t){let t=-3*e[0]+9*e[1]-9*e[2]+3*e[3];if(t!==0){let r=6*e[0]-12*e[1]+6*e[2],i=-3*e[0]+3*e[1],a=r*r-4*t*i;if(a>=0){let e=Math.sqrt(a);n.push((-r+e)/(2*t)),n.push((-r-e)/(2*t))}}}return n.filter(e=>e>0&&e<1).flatMap(e=>t.map(t=>{let n=1-e;return n*n*n*t[0]+3*n*n*e*t[1]+3*n*e*e*t[2]+e*e*e*t[3]}))}var wc=class extends U{constructor(e){super(e),this.on(`pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva`,function(){this._clearCache(`tensionPoints`)})}_sceneFunc(e){let t=this.points(),n=t.length,r=this.tension(),i=this.closed(),a=this.bezier();if(!n)return;let o=0;if(e.beginPath(),e.moveTo(t[0],t[1]),r!==0&&n>4){let r=this.getTensionPoints(),a=r.length;for(o=i?0:4,i||e.quadraticCurveTo(r[0],r[1],r[2],r[3]);o<a-2;)e.bezierCurveTo(r[o++],r[o++],r[o++],r[o++],r[o++],r[o++]);i||e.quadraticCurveTo(r[a-2],r[a-1],t[n-2],t[n-1])}else if(a)for(o=2;o<n;)e.bezierCurveTo(t[o++],t[o++],t[o++],t[o++],t[o++],t[o++]);else for(o=2;o<n;o+=2)e.lineTo(t[o],t[o+1]);i?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}getTensionPoints(){return this._getCache(`tensionPoints`,this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():Sc(this.points(),this.tension())}_getTensionPointsClosed(){let e=this.points(),t=e.length,n=this.tension(),r=xc(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),i=xc(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),a=Sc(e,n);return[r[2],r[3]].concat(a,[i[0],i[1],e[t-2],e[t-1],i[2],i[3],r[0],r[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};e=this.tension()===0?this.bezier()?[e[0],e[1],...Cc(this.points()),e[e.length-2],e[e.length-1]]:this.points():[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]];let t=e[0],n=e[0],r=e[1],i=e[1],a,o;for(let s=0;s<e.length/2;s++)a=e[s*2],o=e[s*2+1],t=Math.min(t,a),n=Math.max(n,a),r=Math.min(r,o),i=Math.max(i,o);return{x:t,y:r,width:n-t,height:i-r}}};wc.prototype.className=`Line`,wc.prototype._attrsAffectingSize=[`points`,`bezier`,`tension`],wa(wc),V.addGetterSetter(wc,`closed`,!1),V.addGetterSetter(wc,`bezier`,!1),V.addGetterSetter(wc,`tension`,0,B()),V.addGetterSetter(wc,`points`,[],bo());var Tc=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],Ec=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],Dc=[[1],[1,1],[1,2,1],[1,3,3,1]],Oc=(e,t,n)=>{let r,i,a=n/2;r=0;for(let n=0;n<20;n++)i=a*Tc[20][n]+a,r+=Ec[20][n]*Ac(e,t,i);return a*r},kc=(e,t,n)=>{n===void 0&&(n=1);let r=e[0]-2*e[1]+e[2],i=t[0]-2*t[1]+t[2],a=2*e[1]-2*e[0],o=2*t[1]-2*t[0],s=4*(r*r+i*i),c=4*(r*a+i*o),l=a*a+o*o;if(s===0)return n*Math.sqrt((e[2]-e[0])**2+(t[2]-t[0])**2);let u=c/(2*s),d=l/s,f=n+u,p=d-u*u,m=f*f+p>0?Math.sqrt(f*f+p):0,h=u*u+p>0?Math.sqrt(u*u+p):0,g=u+Math.sqrt(u*u+p)===0?0:p*Math.log(Math.abs((f+m)/(u+h)));return Math.sqrt(s)/2*(f*m-u*h+g)};function Ac(e,t,n){let r=jc(1,n,e),i=jc(1,n,t),a=r*r+i*i;return Math.sqrt(a)}var jc=(e,t,n)=>{let r=n.length-1,i,a;if(r===0)return 0;if(e===0){a=0;for(let e=0;e<=r;e++)a+=Dc[r][e]*(1-t)**(r-e)*t**+e*n[e];return a}else{i=Array(r);for(let e=0;e<r;e++)i[e]=r*(n[e+1]-n[e]);return jc(e-1,t,i)}},Mc=(e,t,n)=>{let r=1,i=e/t,a=(e-n(i))/t,o=0;for(;r>.001;){let s=n(i+a),c=Math.abs(e-s)/t;if(c<r)r=c,i+=a;else{let o=n(i-a),s=Math.abs(e-o)/t;s<r?(r=s,i-=a):a/=2}if(o++,o>500)break}return i},Nc=class e extends U{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on(`dataChange.konva`,function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=e.parsePathData(this.data()),this.pathLength=e.getPathLength(this.dataArray)}_sceneFunc(e){let t=this.dataArray;e.beginPath();let n=!1;for(let r=0;r<t.length;r++){let i=t[r].command,a=t[r].points;switch(i){case`L`:e.lineTo(a[0],a[1]);break;case`M`:e.moveTo(a[0],a[1]);break;case`C`:e.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case`Q`:e.quadraticCurveTo(a[0],a[1],a[2],a[3]);break;case`A`:let t=a[0],r=a[1],i=a[2],o=a[3],s=a[4],c=a[5],l=a[6],u=a[7],d=i>o?i:o,f=i>o?1:i/o,p=i>o?o/i:1;e.translate(t,r),e.rotate(l),e.scale(f,p),e.arc(0,0,d,s,s+c,1-u),e.scale(1/f,1/p),e.rotate(-l),e.translate(-t,-r);break;case`z`:n=!0,e.closePath();break}}!n&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){let t=[];this.dataArray.forEach(function(n){if(n.command===`A`){let r=n.points[4],i=n.points[5],a=n.points[4]+i,o=Math.PI/180;if(Math.abs(r-a)<o&&(o=Math.abs(r-a)),i<0)for(let i=r-o;i>a;i-=o){let r=e.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],i,0);t.push(r.x,r.y)}else for(let i=r+o;i<a;i+=o){let r=e.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],i,0);t.push(r.x,r.y)}}else if(n.command===`C`)for(let r=0;r<=1;r+=.01){let i=e.getPointOnCubicBezier(r,n.start.x,n.start.y,n.points[0],n.points[1],n.points[2],n.points[3],n.points[4],n.points[5]);t.push(i.x,i.y)}else t=t.concat(n.points)});let n=t[0],r=t[0],i=t[1],a=t[1],o,s;for(let e=0;e<t.length/2;e++)o=t[e*2],s=t[e*2+1],isNaN(o)||(n=Math.min(n,o),r=Math.max(r,o)),isNaN(s)||(i=Math.min(i,s),a=Math.max(a,s));return{x:n,y:i,width:r-n,height:a-i}}getLength(){return this.pathLength}getPointAtLength(t){return e.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}static getPathLength(e){let t=0;for(let n=0;n<e.length;++n)t+=e[n].pathLength;return t}static getPointAtLengthOfDataArray(t,n){let r,i=0,a=n.length;if(!a)return null;for(;i<a&&t>n[i].pathLength;)t-=n[i].pathLength,++i;if(i===a)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return n[i].command===`M`?(r=n[i].points.slice(0,2),{x:r[0],y:r[1]}):{x:n[i].start.x,y:n[i].start.y};let o=n[i],s=o.points;switch(o.command){case`L`:return e.getPointOnLine(t,o.start.x,o.start.y,s[0],s[1]);case`C`:return e.getPointOnCubicBezier(Mc(t,e.getPathLength(n),e=>Oc([o.start.x,s[0],s[2],s[4]],[o.start.y,s[1],s[3],s[5]],e)),o.start.x,o.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case`Q`:return e.getPointOnQuadraticBezier(Mc(t,e.getPathLength(n),e=>kc([o.start.x,s[0],s[2]],[o.start.y,s[1],s[3]],e)),o.start.x,o.start.y,s[0],s[1],s[2],s[3]);case`A`:let r=s[0],i=s[1],a=s[2],c=s[3],l=s[5],u=s[6],d=s[4];return d+=l*t/o.pathLength,e.getPointOnEllipticalArc(r,i,a,c,d,u)}return null}static getPointOnLine(e,t,n,r,i,a,o){a??=t,o??=n;let s=this.getLineLength(t,n,r,i);if(s<1e-10)return{x:t,y:n};if(r===t)return{x:a,y:o+(i>n?e:-e)};let c=(i-n)/(r-t),l=Math.sqrt(e*e/(1+c*c))*(r<t?-1:1),u=c*l;if(Math.abs(o-n-c*(a-t))<1e-10)return{x:a+l,y:o+u};let d=((a-t)*(r-t)+(o-n)*(i-n))/(s*s),f=t+d*(r-t),p=n+d*(i-n),m=this.getLineLength(a,o,f,p),h=Math.sqrt(e*e-m*m),g=Math.sqrt(h*h/(1+c*c))*(r<t?-1:1),_=c*g;return{x:f+g,y:p+_}}static getPointOnCubicBezier(e,t,n,r,i,a,o,s,c){function l(e){return e*e*e}function u(e){return 3*e*e*(1-e)}function d(e){return 3*e*(1-e)*(1-e)}function f(e){return(1-e)*(1-e)*(1-e)}return{x:s*l(e)+a*u(e)+r*d(e)+t*f(e),y:c*l(e)+o*u(e)+i*d(e)+n*f(e)}}static getPointOnQuadraticBezier(e,t,n,r,i,a,o){function s(e){return e*e}function c(e){return 2*e*(1-e)}function l(e){return(1-e)*(1-e)}return{x:a*s(e)+r*c(e)+t*l(e),y:o*s(e)+i*c(e)+n*l(e)}}static getPointOnEllipticalArc(e,t,n,r,i,a){let o=Math.cos(a),s=Math.sin(a),c={x:n*Math.cos(i),y:r*Math.sin(i)};return{x:e+(c.x*o-c.y*s),y:t+(c.x*s+c.y*o)}}static parsePathData(e){if(!e)return[];let t=e,n=[`m`,`M`,`l`,`L`,`v`,`V`,`h`,`H`,`z`,`Z`,`c`,`C`,`q`,`Q`,`t`,`T`,`s`,`S`,`a`,`A`];t=t.replace(RegExp(` `,`g`),`,`);for(let e=0;e<n.length;e++)t=t.replace(new RegExp(n[e],`g`),`|`+n[e]);let r=t.split(`|`),i=[],a=[],o=0,s=0,c=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,l;for(let e=1;e<r.length;e++){let t=r[e],n=t.charAt(0);for(t=t.slice(1),a.length=0;l=c.exec(t);)a.push(l[0]);let u=[],d=n===`A`||n===`a`?0:-1;for(let e=0,t=a.length;e<t;e++){let t=a[e];if(t===`00`){u.push(0,0),d>=0&&(d+=2,d>=7&&(d-=7));continue}if(d>=0){if(d===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(t)){u.push(parseInt(t[0],10)),u.push(parseInt(t[1],10)),u.push(parseFloat(t.slice(2))),d+=3,d>=7&&(d-=7);continue}if(t===`11`||t===`10`||t===`01`){u.push(parseInt(t[0],10)),u.push(parseInt(t[1],10)),d+=2,d>=7&&(d-=7);continue}if(t===`0`||t===`1`){u.push(parseInt(t,10)),d+=1,d>=7&&(d-=7);continue}}else if(d===4){if(/^[01]\d+(?:\.\d+)?$/.test(t)){u.push(parseInt(t[0],10)),u.push(parseFloat(t.slice(1))),d+=2,d>=7&&(d-=7);continue}if(t===`0`||t===`1`){u.push(parseInt(t,10)),d+=1,d>=7&&(d-=7);continue}}let e=parseFloat(t);isNaN(e)?u.push(0):u.push(e),d+=1,d>=7&&(d-=7)}else{let e=parseFloat(t);isNaN(e)?u.push(0):u.push(e)}}for(;u.length>0&&!isNaN(u[0]);){let e=``,t=[],r=o,a=s,c,l,d,f,p,m,h,g,_,v;switch(n){case`l`:o+=u.shift(),s+=u.shift(),e=`L`,t.push(o,s);break;case`L`:o=u.shift(),s=u.shift(),t.push(o,s);break;case`m`:let r=u.shift(),a=u.shift();if(o+=r,s+=a,e=`M`,i.length>2&&i[i.length-1].command===`z`){for(let e=i.length-2;e>=0;e--)if(i[e].command===`M`){o=i[e].points[0]+r,s=i[e].points[1]+a;break}}t.push(o,s),n=`l`;break;case`M`:o=u.shift(),s=u.shift(),e=`M`,t.push(o,s),n=`L`;break;case`h`:o+=u.shift(),e=`L`,t.push(o,s);break;case`H`:o=u.shift(),e=`L`,t.push(o,s);break;case`v`:s+=u.shift(),e=`L`,t.push(o,s);break;case`V`:s=u.shift(),e=`L`,t.push(o,s);break;case`C`:t.push(u.shift(),u.shift(),u.shift(),u.shift()),o=u.shift(),s=u.shift(),t.push(o,s);break;case`c`:t.push(o+u.shift(),s+u.shift(),o+u.shift(),s+u.shift()),o+=u.shift(),s+=u.shift(),e=`C`,t.push(o,s);break;case`S`:l=o,d=s,c=i[i.length-1],c.command===`C`&&(l=o+(o-c.points[2]),d=s+(s-c.points[3])),t.push(l,d,u.shift(),u.shift()),o=u.shift(),s=u.shift(),e=`C`,t.push(o,s);break;case`s`:l=o,d=s,c=i[i.length-1],c.command===`C`&&(l=o+(o-c.points[2]),d=s+(s-c.points[3])),t.push(l,d,o+u.shift(),s+u.shift()),o+=u.shift(),s+=u.shift(),e=`C`,t.push(o,s);break;case`Q`:t.push(u.shift(),u.shift()),o=u.shift(),s=u.shift(),t.push(o,s);break;case`q`:t.push(o+u.shift(),s+u.shift()),o+=u.shift(),s+=u.shift(),e=`Q`,t.push(o,s);break;case`T`:l=o,d=s,c=i[i.length-1],c.command===`Q`&&(l=o+(o-c.points[0]),d=s+(s-c.points[1])),o=u.shift(),s=u.shift(),e=`Q`,t.push(l,d,o,s);break;case`t`:l=o,d=s,c=i[i.length-1],c.command===`Q`&&(l=o+(o-c.points[0]),d=s+(s-c.points[1])),o+=u.shift(),s+=u.shift(),e=`Q`,t.push(l,d,o,s);break;case`A`:f=u.shift(),p=u.shift(),m=u.shift(),h=u.shift(),g=u.shift(),_=o,v=s,o=u.shift(),s=u.shift(),e=`A`,t=this.convertEndpointToCenterParameterization(_,v,o,s,h,g,f,p,m);break;case`a`:f=u.shift(),p=u.shift(),m=u.shift(),h=u.shift(),g=u.shift(),_=o,v=s,o+=u.shift(),s+=u.shift(),e=`A`,t=this.convertEndpointToCenterParameterization(_,v,o,s,h,g,f,p,m);break}i.push({command:e||n,points:t,start:{x:r,y:a},pathLength:this.calcLength(r,a,e||n,t)})}(n===`z`||n===`Z`)&&i.push({command:`z`,points:[],start:void 0,pathLength:0})}return i}static calcLength(t,n,r,i){let a,o,s,c,l=e;switch(r){case`L`:return l.getLineLength(t,n,i[0],i[1]);case`C`:return Oc([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case`Q`:return kc([t,i[0],i[2]],[n,i[1],i[3]],1);case`A`:a=0;let e=i[4],r=i[5],u=i[4]+r,d=Math.PI/180;if(Math.abs(e-u)<d&&(d=Math.abs(e-u)),o=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],e,0),r<0)for(c=e-d;c>u;c-=d)s=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],c,0),a+=l.getLineLength(o.x,o.y,s.x,s.y),o=s;else for(c=e+d;c<u;c+=d)s=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],c,0),a+=l.getLineLength(o.x,o.y,s.x,s.y),o=s;return s=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],u,0),a+=l.getLineLength(o.x,o.y,s.x,s.y),a}return 0}static convertEndpointToCenterParameterization(e,t,n,r,i,a,o,s,c){let l=Math.PI/180*c,u=Math.cos(l)*(e-n)/2+Math.sin(l)*(t-r)/2,d=-1*Math.sin(l)*(e-n)/2+Math.cos(l)*(t-r)/2,f=u*u/(o*o)+d*d/(s*s);f>1&&(o*=Math.sqrt(f),s*=Math.sqrt(f));let p=Math.sqrt((o*o*(s*s)-o*o*(d*d)-s*s*(u*u))/(o*o*(d*d)+s*s*(u*u)));i===a&&(p*=-1),isNaN(p)&&(p=0);let m=p*o*d/s,h=p*-s*u/o,g=(e+n)/2+Math.cos(l)*m-Math.sin(l)*h,_=(t+r)/2+Math.sin(l)*m+Math.cos(l)*h,v=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])},y=function(e,t){return(e[0]*t[0]+e[1]*t[1])/(v(e)*v(t))},b=function(e,t){return(e[0]*t[1]<e[1]*t[0]?-1:1)*Math.acos(y(e,t))},x=b([1,0],[(u-m)/o,(d-h)/s]),S=[(u-m)/o,(d-h)/s],C=[(-1*u-m)/o,(-1*d-h)/s],w=b(S,C);return y(S,C)<=-1&&(w=Math.PI),y(S,C)>=1&&(w=0),a===0&&w>0&&(w-=2*Math.PI),a===1&&w<0&&(w+=2*Math.PI),[g,_,o,s,x,w,l,a]}};Nc.prototype.className=`Path`,Nc.prototype._attrsAffectingSize=[`data`],wa(Nc),V.addGetterSetter(Nc,`data`);var Pc=class extends wc{_sceneFunc(e){super._sceneFunc(e);let t=Math.PI*2,n=this.points(),r=n,i=this.tension()!==0&&n.length>4;i&&(r=this.getTensionPoints());let a=this.pointerLength(),o=n.length,s,c;if(i){let e=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[o-2],n[o-1]],t=Nc.calcLength(r[r.length-4],r[r.length-3],`C`,e),i=Nc.getPointOnQuadraticBezier(Math.min(1,1-a/t),e[0],e[1],e[2],e[3],e[4],e[5]);s=n[o-2]-i.x,c=n[o-1]-i.y}else s=n[o-2]-n[o-4],c=n[o-1]-n[o-3];let l=(Math.atan2(c,s)+t)%t,u=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[o-2],n[o-1]),e.rotate(l),e.moveTo(0,0),e.lineTo(-a,u/2),e.lineTo(-a,-u/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),i?(s=(r[0]+r[2])/2-n[0],c=(r[1]+r[3])/2-n[1]):(s=n[2]-n[0],c=n[3]-n[1]),e.rotate((Math.atan2(-c,-s)+t)%t),e.moveTo(0,0),e.lineTo(-a,u/2),e.lineTo(-a,-u/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){let t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){let e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x,y:e.y-t,width:e.width,height:e.height+t*2}}};Pc.prototype.className=`Arrow`,wa(Pc),V.addGetterSetter(Pc,`pointerLength`,10,B()),V.addGetterSetter(Pc,`pointerWidth`,10,B()),V.addGetterSetter(Pc,`pointerAtBeginning`,!1),V.addGetterSetter(Pc,`pointerAtEnding`,!0);var Fc=class extends U{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}};Fc.prototype._centroid=!0,Fc.prototype.className=`Circle`,Fc.prototype._attrsAffectingSize=[`radius`],wa(Fc),V.addGetterSetter(Fc,`radius`,0,B());var Ic=class extends U{_sceneFunc(e){let t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}};Ic.prototype.className=`Ellipse`,Ic.prototype._centroid=!0,Ic.prototype._attrsAffectingSize=[`radiusX`,`radiusY`],wa(Ic),V.addComponentsGetterSetter(Ic,`radius`,[`x`,`y`]),V.addGetterSetter(Ic,`radiusX`,0,B()),V.addGetterSetter(Ic,`radiusY`,0,B());var Lc=class e extends U{constructor(e){super(e),this._loadListener=()=>{this._requestDraw()},this.on(`imageChange.konva`,e=>{this._removeImageLoad(e.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){let e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener(`load`,this._loadListener)}_removeImageLoad(e){e&&e.removeEventListener&&e.removeEventListener(`load`,this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){let e=!!this.cornerRadius(),t=this.hasShadow();return e&&t?!0:super._useBufferCanvas(!0)}_sceneFunc(e){let t=this.getWidth(),n=this.getHeight(),r=this.cornerRadius(),i=this.attrs.image,a;if(i){let e=this.attrs.cropWidth,r=this.attrs.cropHeight;a=e&&r?[i,this.cropX(),this.cropY(),e,r,0,0,t,n]:[i,0,0,t,n]}(this.hasFill()||this.hasStroke()||r)&&(e.beginPath(),r?z.drawRoundedRectPath(e,t,n,r):e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)),i&&(r&&e.clip(),e.drawImage.apply(e,a))}_hitFunc(e){let t=this.width(),n=this.height(),r=this.cornerRadius();e.beginPath(),r?z.drawRoundedRectPath(e,t,n,r):e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.attrs.width??this.image()?.width??0}getHeight(){return this.attrs.height??this.image()?.height??0}static fromURL(t,n,r=null){let i=z.createImageElement();i.onload=function(){n(new e({image:i}))},i.onerror=r,i.crossOrigin=`Anonymous`,i.src=t}};Lc.prototype.className=`Image`,Lc.prototype._attrsAffectingSize=[`image`],wa(Lc),V.addGetterSetter(Lc,`cornerRadius`,0,go(4)),V.addGetterSetter(Lc,`image`),V.addComponentsGetterSetter(Lc,`crop`,[`x`,`y`,`width`,`height`]),V.addGetterSetter(Lc,`cropX`,0,B()),V.addGetterSetter(Lc,`cropY`,0,B()),V.addGetterSetter(Lc,`cropWidth`,0,B()),V.addGetterSetter(Lc,`cropHeight`,0,B());var Rc=[`fontFamily`,`fontSize`,`fontStyle`,`padding`,`lineHeight`,`text`,`width`,`height`,`pointerDirection`,`pointerWidth`,`pointerHeight`],zc=`Change.konva`,Bc=`none`,Vc=`up`,Hc=`right`,Uc=`down`,Wc=`left`,Gc=Rc.length,Kc=class extends cc{constructor(e){super(e),this.on(`add.konva`,function(e){this._addListeners(e.child),this._sync()})}getText(){return this.find(`Text`)[0]}getTag(){return this.find(`Tag`)[0]}_addListeners(e){let t=this,n,r=function(){t._sync()};for(n=0;n<Gc;n++)e.on(Rc[n]+zc,r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let e=this.getText(),t=this.getTag(),n,r,i,a,o,s,c;if(e&&t){switch(n=e.width(),r=e.height(),i=t.pointerDirection(),a=t.pointerWidth(),c=t.pointerHeight(),o=0,s=0,i){case Vc:o=n/2,s=-1*c;break;case Hc:o=n+a,s=r/2;break;case Uc:o=n/2,s=r+c;break;case Wc:o=-1*a,s=r/2;break}t.setAttrs({x:-1*o,y:-1*s,width:n,height:r}),e.setAttrs({x:-1*o,y:-1*s})}}};Kc.prototype.className=`Label`,wa(Kc);var qc=class extends U{_sceneFunc(e){let t=this.width(),n=this.height(),r=this.pointerDirection(),i=this.pointerWidth(),a=this.pointerHeight(),o=this.cornerRadius(),s=0,c=0,l=0,u=0;typeof o==`number`?s=c=l=u=Math.min(o,t/2,n/2):(s=Math.min(o[0]||0,t/2,n/2),c=Math.min(o[1]||0,t/2,n/2),u=Math.min(o[2]||0,t/2,n/2),l=Math.min(o[3]||0,t/2,n/2)),e.beginPath(),e.moveTo(s,0),r===Vc&&(e.lineTo((t-i)/2,0),e.lineTo(t/2,-1*a),e.lineTo((t+i)/2,0)),e.lineTo(t-c,0),e.arc(t-c,c,c,Math.PI*3/2,0,!1),r===Hc&&(e.lineTo(t,(n-a)/2),e.lineTo(t+i,n/2),e.lineTo(t,(n+a)/2)),e.lineTo(t,n-u),e.arc(t-u,n-u,u,0,Math.PI/2,!1),r===Uc&&(e.lineTo((t+i)/2,n),e.lineTo(t/2,n+a),e.lineTo((t-i)/2,n)),e.lineTo(l,n),e.arc(l,n-l,l,Math.PI/2,Math.PI,!1),r===Wc&&(e.lineTo(0,(n+a)/2),e.lineTo(-1*i,n/2),e.lineTo(0,(n-a)/2)),e.lineTo(0,s),e.arc(s,s,s,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=0,t=0,n=this.pointerWidth(),r=this.pointerHeight(),i=this.pointerDirection(),a=this.width(),o=this.height();return i===Vc?(t-=r,o+=r):i===Uc?o+=r:i===Wc?(e-=n*1.5,a+=n):i===Hc&&(a+=n*1.5),{x:e,y:t,width:a,height:o}}};qc.prototype.className=`Tag`,wa(qc),V.addGetterSetter(qc,`pointerDirection`,Bc),V.addGetterSetter(qc,`pointerWidth`,0,B()),V.addGetterSetter(qc,`pointerHeight`,0,B()),V.addGetterSetter(qc,`cornerRadius`,0,go(4));var Jc=class extends U{_sceneFunc(e){let t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?z.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}};Jc.prototype.className=`Rect`,wa(Jc),V.addGetterSetter(Jc,`cornerRadius`,0,go(4));var Yc=class extends U{_sceneFunc(e){let t=this._getPoints(),n=this.radius(),r=this.sides(),i=this.cornerRadius();if(e.beginPath(),i)z.drawRoundedPolygonPath(e,t,r,n,i);else{e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length;n++)e.lineTo(t[n].x,t[n].y)}e.closePath(),e.fillStrokeShape(this)}_getPoints(){let e=this.attrs.sides,t=this.attrs.radius||0,n=[];for(let r=0;r<e;r++)n.push({x:t*Math.sin(r*2*Math.PI/e),y:-1*t*Math.cos(r*2*Math.PI/e)});return n}getSelfRect(){let e=this._getPoints(),t=e[0].x,n=e[0].x,r=e[0].y,i=e[0].y;return e.forEach(e=>{t=Math.min(t,e.x),n=Math.max(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.y)}),{x:t,y:r,width:n-t,height:i-r}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};Yc.prototype.className=`RegularPolygon`,Yc.prototype._centroid=!0,Yc.prototype._attrsAffectingSize=[`radius`],wa(Yc),V.addGetterSetter(Yc,`radius`,0,B()),V.addGetterSetter(Yc,`sides`,0,B()),V.addGetterSetter(Yc,`cornerRadius`,0,go(4));var Xc=Math.PI*2,Zc=class extends U{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,Xc,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),Xc,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}};Zc.prototype.className=`Ring`,Zc.prototype._centroid=!0,Zc.prototype._attrsAffectingSize=[`innerRadius`,`outerRadius`],wa(Zc),V.addGetterSetter(Zc,`innerRadius`,0,B()),V.addGetterSetter(Zc,`outerRadius`,0,B());var Qc=class extends U{constructor(e){super(e),this._updated=!0,this.anim=new uc(()=>{let e=this._updated;return this._updated=!1,e}),this.on(`animationChange.konva`,function(){this.frameIndex(0)}),this.on(`frameIndexChange.konva`,function(){this._updated=!0}),this.on(`frameRateChange.konva`,function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){let t=this.animation(),n=this.frameIndex(),r=n*4,i=this.animations()[t],a=this.frameOffsets(),o=i[r+0],s=i[r+1],c=i[r+2],l=i[r+3],u=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,c,l),e.closePath(),e.fillStrokeShape(this)),u)if(a){let r=a[t],i=n*2;e.drawImage(u,o,s,c,l,r[i+0],r[i+1],c,l)}else e.drawImage(u,o,s,c,l,0,0,c,l)}_hitFunc(e){let t=this.animation(),n=this.frameIndex(),r=n*4,i=this.animations()[t],a=this.frameOffsets(),o=i[r+2],s=i[r+3];if(e.beginPath(),a){let r=a[t],i=n*2;e.rect(r[i+0],r[i+1],o,s)}else e.rect(0,0,o,s);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){let e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;let e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){let e=this.frameIndex(),t=this.animation();e<this.animations()[t].length/4-1?this.frameIndex(e+1):this.frameIndex(0)}};Qc.prototype.className=`Sprite`,wa(Qc),V.addGetterSetter(Qc,`animation`),V.addGetterSetter(Qc,`animations`),V.addGetterSetter(Qc,`frameOffsets`),V.addGetterSetter(Qc,`image`),V.addGetterSetter(Qc,`frameIndex`,0,B()),V.addGetterSetter(Qc,`frameRate`,17,B()),V.backCompat(Qc,{index:`frameIndex`,getIndex:`getFrameIndex`,setIndex:`setFrameIndex`});var $c=class extends U{_sceneFunc(e){let t=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();e.beginPath(),e.moveTo(0,0-n);for(let i=1;i<r*2;i++){let a=i%2==0?n:t,o=a*Math.sin(i*Math.PI/r),s=-1*a*Math.cos(i*Math.PI/r);e.lineTo(o,s)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}};$c.prototype.className=`Star`,$c.prototype._centroid=!0,$c.prototype._attrsAffectingSize=[`innerRadius`,`outerRadius`],wa($c),V.addGetterSetter($c,`numPoints`,5,B()),V.addGetterSetter($c,`innerRadius`,0,B()),V.addGetterSetter($c,`outerRadius`,0,B());function el(e){return[...e].reduce((e,t,n,r)=>{if(/\p{Emoji}/u.test(t)){let i=r[n+1];i&&/\p{Emoji_Modifier}|\u200D/u.test(i)?(e.push(t+i),r[n+1]=``):e.push(t)}else /\p{Regional_Indicator}{2}/u.test(t+(r[n+1]||``))?e.push(t+r[n+1]):n>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(t)?e[e.length-1]+=t:t&&e.push(t);return e},[])}var tl=`auto`,nl=`center`,rl=`inherit`,il=`justify`,al=`Change.konva`,ol=`2d`,sl=`-`,cl=`left`,ll=`text`,ul=`Text`,dl=`top`,fl=`bottom`,pl=`middle`,ml=`normal`,hl=`px `,gl=` `,_l=`right`,vl=`rtl`,yl=`word`,bl=`char`,xl=`none`,Sl=`…`,Cl=[`direction`,`fontFamily`,`fontSize`,`fontStyle`,`fontVariant`,`padding`,`align`,`verticalAlign`,`lineHeight`,`text`,`width`,`height`,`wrap`,`ellipsis`,`letterSpacing`],wl=Cl.length,Tl=null;function El(){if(Tl!==null)return Tl;Tl=!1;try{let e=document.createElement(`canvas`);e.width=10,e.height=10;let t=e.getContext(ol);if(t){t.globalAlpha=0,t.shadowColor=`black`,t.shadowBlur=5,t.shadowOffsetX=5,t.shadowOffsetY=5,t.fillStyle=`black`,t.font=`10px Arial`,t.fillText(`X`,0,10);let e=t.getImageData(0,0,10,10).data;for(let t=3;t<e.length;t+=4)if(e[t]>0){Tl=!0;break}}}catch{}return Tl}function Dl(e){return e.split(`,`).map(e=>{e=e.trim();let t=e.indexOf(` `)>=0,n=e.indexOf(`"`)>=0||e.indexOf(`'`)>=0;return t&&!n&&(e=`"${e}"`),e}).join(`, `)}var Ol;function kl(){return Ol||(Ol=z.createCanvasElement().getContext(ol),Ol)}function Al(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function jl(e){e.setAttr(`miterLimit`,2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function Ml(e){return e||={},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||`black`),e}var Nl=class extends U{constructor(e){super(Ml(e)),this._partialTextX=0,this._partialTextY=0;for(let e=0;e<wl;e++)this.on(Cl[e]+al,this._setTextData);this._setTextData()}_sceneFunc(e){let t=this.textArr,n=t.length;if(!this.text())return;let r=this.padding(),i=this.fontSize(),a=this.lineHeight()*i,o=this.verticalAlign(),s=this.direction(),c=0,l=this.align(),u=this.getWidth(),d=this.letterSpacing(),f=this.charRenderFunc(),p=this.fill(),m=this.textDecoration(),h=this.underlineOffset(),g=m.indexOf(`underline`)!==-1,_=m.indexOf(`line-through`)!==-1,v;s=s===rl?e.direction:s;let y=a/2,b=pl;if(!L.legacyTextRendering){let e=this.measureSize(`M`);b=`alphabetic`,y=((e.fontBoundingBoxAscent??e.actualBoundingBoxAscent)-(e.fontBoundingBoxDescent??e.actualBoundingBoxDescent))/2+a/2}for(s===vl&&e.setAttr(`direction`,s),e.setAttr(`font`,this._getContextFont()),e.setAttr(`textBaseline`,b),e.setAttr(`textAlign`,cl),o===pl?c=(this.getHeight()-n*a-r*2)/2:o===fl&&(c=this.getHeight()-n*a-r*2),e.translate(r,c+r),v=0;v<n;v++){let o=0,c=t[v],m=c.text,b=c.width,x=c.lastInParagraph;if(e.save(),l===_l?o+=u-b-r*2:l===nl&&(o+=(u-b-r*2)/2),g){e.save(),e.beginPath();let t=h??(L.legacyTextRendering?Math.round(i/2):Math.round(i/4)),n=o,a=y+0+t;e.moveTo(n,a);let s=l===il&&!x?u-r*2:b;e.lineTo(n+Math.round(s),a),e.lineWidth=i/15,e.strokeStyle=this._getLinearGradient()||p,e.stroke(),e.restore()}let S=o;if(s!==vl&&(d!==0||l===il||f)){let n=m.split(` `).length-1,i=el(m);for(let a=0;a<i.length;a++){let s=i[a];if(s===` `&&!x&&l===il&&(o+=(u-r*2-b)/n),this._partialTextX=o,this._partialTextY=y+0,this._partialText=s,f){e.save();let n=t.slice(0,v).reduce((e,t)=>e+el(t.text).length,0);f({char:s,index:a+n,x:o,y:y+0,lineIndex:v,column:a,isLastInLine:x,width:this.measureSize(s).width,context:e})}e.fillStrokeShape(this),f&&e.restore(),o+=this.measureSize(s).width+d}}else d!==0&&e.setAttr(`letterSpacing`,`${d}px`),this._partialTextX=o,this._partialTextY=y+0,this._partialText=m,e.fillStrokeShape(this);if(_){e.save(),e.beginPath();let t=L.legacyTextRendering?0:-Math.round(i/4),n=S;e.moveTo(n,y+0+t);let a=l===il&&!x?u-r*2:b;e.lineTo(n+Math.round(a),y+0+t),e.lineWidth=i/15,e.strokeStyle=this._getLinearGradient()||p,e.stroke(),e.restore()}e.restore(),n>1&&(y+=a)}}_hitFunc(e){let t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){let t=z._isString(e)?e:e==null?``:e+``;return this._setAttr(ll,t),this}getWidth(){return this.attrs.width===tl||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===tl||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return z.warn(`text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height.`),this.textHeight}measureSize(e){let t=kl(),n=this.fontSize(),r;t.save(),t.font=this._getContextFont(),r=t.measureText(e),t.restore();let i=n/100;return{actualBoundingBoxAscent:r.actualBoundingBoxAscent??71.58203125*i,actualBoundingBoxDescent:r.actualBoundingBoxDescent??0,actualBoundingBoxLeft:r.actualBoundingBoxLeft??-7.421875*i,actualBoundingBoxRight:r.actualBoundingBoxRight??75.732421875*i,alphabeticBaseline:r.alphabeticBaseline??0,emHeightAscent:r.emHeightAscent??100*i,emHeightDescent:r.emHeightDescent??-20*i,fontBoundingBoxAscent:r.fontBoundingBoxAscent??91*i,fontBoundingBoxDescent:r.fontBoundingBoxDescent??21*i,hangingBaseline:r.hangingBaseline??72.80000305175781*i,ideographicBaseline:r.ideographicBaseline??-21*i,width:r.width,height:n}}_getContextFont(){return this.fontStyle()+gl+this.fontVariant()+gl+(this.fontSize()+hl)+Dl(this.fontFamily())}_addTextLine(e){this.align()===il&&(e=e.trim());let t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){let t=this.letterSpacing(),n=e.length;return kl().measureText(e).width+t*n}_setTextData(){let e=this.text().split(`
|
|
25
|
-
`),t=+this.fontSize(),n=0,r=this.lineHeight()*t,i=this.attrs.width,a=this.attrs.height,o=i!==tl&&i!==void 0,s=a!==tl&&a!==void 0,c=this.padding(),l=i-c*2,u=a-c*2,d=0,f=this.wrap(),p=f!==bl&&f!==xl,m=this.ellipsis();this.textArr=[],kl().font=this._getContextFont();let h=m?this._getTextWidth(Sl):0;for(let t=0,i=e.length;t<i;++t){let a=e[t],c=this._getTextWidth(a);if(o&&c>l)for(;a.length>0;){let e=0,t=el(a).length,i=``,o=0;for(;e<t;){let n=e+t>>>1,c=el(a).slice(0,n+1).join(``),f=this._getTextWidth(c);(m&&s&&d+r>u?f+h:f)<=l?(e=n+1,i=c,o=f):t=n}if(i){if(p){let t=el(a),n=el(i),r=t[n.length],s=r===gl||r===sl,c;if(s&&o<=l)c=n.length;else{let e=n.lastIndexOf(gl),t=n.lastIndexOf(sl);c=Math.max(e,t)+1}c>0&&(e=c,i=t.slice(0,e).join(``),o=this._getTextWidth(i))}if(i=i.trimRight(),this._addTextLine(i),n=Math.max(n,o),d+=r,this._shouldHandleEllipsis(d)){this._tryToAddEllipsisToLastLine();break}if(a=el(a).slice(e).join(``).trimLeft(),a.length>0&&(c=this._getTextWidth(a),c<=l)){this._addTextLine(a),d+=r,n=Math.max(n,c);break}}else break}else this._addTextLine(a),d+=r,n=Math.max(n,c),this._shouldHandleEllipsis(d)&&t<i-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),s&&d+r>u)break}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){let t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,i=r!==tl&&r!==void 0,a=r-this.padding()*2;return this.wrap()===xl||i&&e+n>a}_tryToAddEllipsisToLastLine(){let e=this.attrs.width,t=e!==tl&&e!==void 0,n=e-this.padding()*2,r=this.ellipsis(),i=this.textArr[this.textArr.length-1];!i||!r||(t&&(this._getTextWidth(i.text+Sl)<n||(i.text=i.text.slice(0,i.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(i.text+Sl))}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){let e=this.textDecoration().indexOf(`underline`)!==-1||this.textDecoration().indexOf(`line-through`)!==-1,t=this.hasShadow();return e&&t||t&&this.getAbsoluteOpacity()!==1&&El()?!0:super._useBufferCanvas()}};Nl.prototype._fillFunc=Al,Nl.prototype._strokeFunc=jl,Nl.prototype.className=ul,Nl.prototype._attrsAffectingSize=[`text`,`fontSize`,`padding`,`wrap`,`lineHeight`,`letterSpacing`],wa(Nl),V.overWriteSetter(Nl,`width`,_o()),V.overWriteSetter(Nl,`height`,_o()),V.addGetterSetter(Nl,`direction`,rl),V.addGetterSetter(Nl,`fontFamily`,`Arial`),V.addGetterSetter(Nl,`fontSize`,12,B()),V.addGetterSetter(Nl,`fontStyle`,ml),V.addGetterSetter(Nl,`fontVariant`,ml),V.addGetterSetter(Nl,`padding`,0,B()),V.addGetterSetter(Nl,`align`,cl),V.addGetterSetter(Nl,`verticalAlign`,dl),V.addGetterSetter(Nl,`lineHeight`,1,B()),V.addGetterSetter(Nl,`wrap`,yl),V.addGetterSetter(Nl,`ellipsis`,!1,xo()),V.addGetterSetter(Nl,`letterSpacing`,0,B()),V.addGetterSetter(Nl,`text`,``,vo()),V.addGetterSetter(Nl,`textDecoration`,``),V.addGetterSetter(Nl,`underlineOffset`,void 0,B()),V.addGetterSetter(Nl,`charRenderFunc`,void 0);var Pl=``,Fl=`normal`;function Il(e){e.fillText(this.partialText,0,0)}function Ll(e){e.strokeText(this.partialText,0,0)}var Rl=class extends U{constructor(e){super(e),this.dummyCanvas=z.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on(`dataChange.konva`,function(){this._readDataAttribute(),this._setTextData()}),this.on(`textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva directionChange.konva`,this._setTextData),this._setTextData()}_getTextPathLength(){return Nc.getPathLength(this.dataArray)}_getPointAtLength(e){return!this.attrs.data||e>this.pathLength?null:Nc.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=Nc.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr(`font`,this._getContextFont()),e.setAttr(`textBaseline`,this.textBaseline()),e.setAttr(`textAlign`,`left`),e.save();let t=this.textDecoration(),n=this.fill(),r=this.fontSize(),i=this.glyphInfo,a=t.indexOf(`underline`)!==-1,o=t.indexOf(`line-through`)!==-1;a&&e.beginPath();for(let t=0;t<i.length;t++){e.save();let n=i[t].p0;e.translate(n.x,n.y),e.rotate(i[t].rotation),this.partialText=i[t].text,e.fillStrokeShape(this),a&&(t===0&&e.moveTo(0,r/2+1),e.lineTo(i[t].width,r/2+1)),e.restore()}if(a&&(e.strokeStyle=n,e.lineWidth=r/20,e.stroke()),o){e.beginPath();for(let t=0;t<i.length;t++){e.save();let n=i[t].p0;e.translate(n.x,n.y),e.rotate(i[t].rotation),t===0&&e.moveTo(0,0),e.lineTo(i[t].width,0),e.restore()}e.strokeStyle=n,e.lineWidth=r/20,e.stroke()}e.restore()}_hitFunc(e){e.beginPath();let t=this.glyphInfo;if(t.length>=1){let n=t[0].p0;e.moveTo(n.x,n.y)}for(let n=0;n<t.length;n++){let r=t[n].p1;e.lineTo(r.x,r.y)}e.setAttr(`lineWidth`,this.fontSize()),e.setAttr(`strokeStyle`,this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return z.warn(`text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height.`),this.textHeight}setText(e){return Nl.prototype.setText.call(this,e)}_getContextFont(){return Nl.prototype._getContextFont.call(this)}_getTextSize(e){let t=this.dummyCanvas.getContext(`2d`);t.save(),t.font=this._getContextFont();let n=t.measureText(e);return t.restore(),{width:n.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){let e=el(this.text());this.direction()===`rtl`&&e.reverse();let t=[],n=0;for(let r=0;r<e.length;r++)t.push({char:e[r],width:this._getTextSize(e[r]).width}),n+=t[r].width;let{width:r,height:i}=this._getTextSize(this.attrs.text);if(this.textWidth=n,this.textHeight=i,this.glyphInfo=[],!this.attrs.data)return null;let a=this.letterSpacing(),o=this.align(),s=this.kerningFunc(),c=Math.max(0,n-r),l=Math.max(this.textWidth+((this.attrs.text||``).length-1)*a,0),u=0;o===`center`&&(u=Math.max(0,this.pathLength/2-l/2)),o===`right`&&(u=Math.max(0,this.pathLength-l));let d=u;for(let n=0;n<t.length;n++){let r=this._getPointAtLength(d);if(!r)return;let i=t[n].char,u=t[n].width+a;if(i===` `&&o===`justify`){let e=this.text().split(` `).length-1;u+=(this.pathLength-l)/e}let f=d+u,p=this._getPointAtLength(f>this.pathLength&&f-this.pathLength<=c?this.pathLength:f);if(!p)return;let m=Nc.getLineLength(r.x,r.y,p.x,p.y),h=0;if(s)try{h=s(t[n-1].char,i)*this.fontSize()}catch{h=0}r.x+=h,p.x+=h,this.textWidth+=h;let g=Nc.getPointOnLine(h+m/2,r.x,r.y,p.x,p.y),_=Math.atan2(p.y-r.y,p.x-r.x);this.glyphInfo.push({transposeX:g.x,transposeY:g.y,text:e[n],rotation:_,p0:r,p1:p,width:m}),d+=u}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};let e=[];this.glyphInfo.forEach(function(t){e.push(t.p0.x),e.push(t.p0.y),e.push(t.p1.x),e.push(t.p1.y)});let t=e[0]||0,n=e[0]||0,r=e[1]||0,i=e[1]||0,a,o;for(let s=0;s<e.length/2;s++)a=e[s*2],o=e[s*2+1],t=Math.min(t,a),n=Math.max(n,a),r=Math.min(r,o),i=Math.max(i,o);let s=this.fontSize();return{x:t-s/2,y:r-s/2,width:n-t+s,height:i-r+s}}destroy(){return z.releaseCanvas(this.dummyCanvas),super.destroy()}};Rl.prototype._fillFunc=Il,Rl.prototype._strokeFunc=Ll,Rl.prototype._fillFuncHit=Il,Rl.prototype._strokeFuncHit=Ll,Rl.prototype.className=`TextPath`,Rl.prototype._attrsAffectingSize=[`text`,`fontSize`,`data`],wa(Rl),V.addGetterSetter(Rl,`data`),V.addGetterSetter(Rl,`fontFamily`,`Arial`),V.addGetterSetter(Rl,`fontSize`,12,B()),V.addGetterSetter(Rl,`fontStyle`,Fl),V.addGetterSetter(Rl,`align`,`left`),V.addGetterSetter(Rl,`letterSpacing`,0,B()),V.addGetterSetter(Rl,`textBaseline`,`middle`),V.addGetterSetter(Rl,`fontVariant`,Fl),V.addGetterSetter(Rl,`text`,Pl),V.addGetterSetter(Rl,`textDecoration`,``),V.addGetterSetter(Rl,`kerningFunc`,void 0),V.addGetterSetter(Rl,`direction`,`inherit`);var zl=`tr-konva`,Bl=[`resizeEnabledChange`,`rotateAnchorOffsetChange`,`rotateAnchorAngleChange`,`rotateEnabledChange`,`enabledAnchorsChange`,`anchorSizeChange`,`borderEnabledChange`,`borderStrokeChange`,`borderStrokeWidthChange`,`borderDashChange`,`anchorStrokeChange`,`anchorStrokeWidthChange`,`anchorFillChange`,`anchorCornerRadiusChange`,`ignoreStrokeChange`,`anchorStyleFuncChange`].map(e=>e+`.${zl}`).join(` `),Vl=`nodesRect`,Hl=[`widthChange`,`heightChange`,`scaleXChange`,`scaleYChange`,`skewXChange`,`skewYChange`,`rotationChange`,`offsetXChange`,`offsetYChange`,`transformsEnabledChange`,`strokeWidthChange`,`draggableChange`],Ul={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},Wl=`ontouchstart`in L._global;function Gl(e,t,n){if(e===`rotater`)return n;t+=z.degToRad(Ul[e]||0);let r=(z.radToDeg(t)%360+360)%360;return z._inRange(r,337.5,360)||z._inRange(r,0,22.5)?`ns-resize`:z._inRange(r,22.5,67.5)?`nesw-resize`:z._inRange(r,67.5,112.5)?`ew-resize`:z._inRange(r,112.5,157.5)?`nwse-resize`:z._inRange(r,157.5,202.5)?`ns-resize`:z._inRange(r,202.5,247.5)?`nesw-resize`:z._inRange(r,247.5,292.5)?`ew-resize`:z._inRange(r,292.5,337.5)?`nwse-resize`:(z.error(`Transformer has unknown angle for cursor detection: `+r),`pointer`)}var Kl=[`top-left`,`top-center`,`top-right`,`middle-right`,`middle-left`,`bottom-left`,`bottom-center`,`bottom-right`],ql=1e8;function Jl(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function Yl(e,t,n){let r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return{...e,rotation:e.rotation+t,x:r,y:i}}function Xl(e,t){return Yl(e,t,Jl(e))}function Zl(e,t,n){let r=t;for(let i=0;i<e.length;i++){let a=L.getAngle(e[i]),o=Math.abs(a-t)%(Math.PI*2);Math.min(o,Math.PI*2-o)<n&&(r=a)}return r}var Ql=0,$l=class extends cc{constructor(e){super(e),this._movingAnchorName=null,this._transforming=!1,this._elementsCreated=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(Bl,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return z.warn(`tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead.`),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return zl+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();let t=e.filter(e=>e.isAncestorOf(this)?(z.error(`Konva.Transformer cannot be an a child of the node you are trying to attach`),!1):!0);return this._nodes=e=t,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(e=>{let t=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(e._attrsAffectingSize.length){let n=e._attrsAffectingSize.map(e=>e+`Change.`+this._getEventNamespace()).join(` `);e.on(n,t)}e.on(Hl.map(e=>e+`.${this._getEventNamespace()}`).join(` `),t),e.on(`absoluteTransformChange.${this._getEventNamespace()}`,t),this._proxyDrag(e)}),this._resetTransformCache(),this.findOne(`.top-left`)&&this.update(),this}_proxyDrag(e){let t;e.on(`dragstart.${this._getEventNamespace()}`,n=>{t=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(`.back`)&&this.startDrag(n,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,n=>{if(!t)return;let r=e.getAbsolutePosition(),i=r.x-t.x,a=r.y-t.y;this.nodes().forEach(t=>{if(t===e||t.isDragging())return;let r=t.getAbsolutePosition();t.setAbsolutePosition({x:r.x+i,y:r.y+a}),t.startDrag(n)}),t=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off(`.`+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(Vl),this._clearCache(`transform`),this._clearSelfAndDescendantCache(`absoluteTransform`)}_getNodeRect(){return this._getCache(Vl,this.__getNodeRect)}__getNodeShape(e,t=this.rotation(),n){let r=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),i=e.getAbsoluteScale(n),a=e.getAbsolutePosition(n),o=r.x*i.x-e.offsetX()*i.x,s=r.y*i.y-e.offsetY()*i.y,c=(L.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2);return Yl({x:a.x+o*Math.cos(c)+s*Math.sin(-c),y:a.y+s*Math.cos(c)+o*Math.sin(c),width:r.width*i.x,height:r.height*i.y,rotation:c},-L.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-ql,y:-ql,width:0,height:0,rotation:0};let e=[];this.nodes().map(t=>{let n=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),r=[{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}],i=t.getAbsoluteTransform();r.forEach(function(t){let n=i.point(t);e.push(n)})});let t=new Da;t.rotate(-L.getAngle(this.rotation()));let n=1/0,r=1/0,i=-1/0,a=-1/0;e.forEach(function(e){let o=t.point(e);n===void 0&&(n=i=o.x,r=a=o.y),n=Math.min(n,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x),a=Math.max(a,o.y)}),t.invert();let o=t.point({x:n,y:r});return{x:o.x,y:o.y,width:i-n,height:a-r,rotation:L.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),Kl.forEach(e=>{this._createAnchor(e)}),this._createAnchor(`rotater`),this._elementsCreated=!0}_createAnchor(e){let t=new Jc({stroke:`rgb(0, 161, 255)`,fill:`white`,strokeWidth:1,name:e+` _anchor`,dragDistance:0,draggable:!0,hitStrokeWidth:Wl?10:`auto`}),n=this;t.on(`mousedown touchstart`,function(e){n._handleMouseDown(e)}),t.on(`dragstart`,e=>{t.stopDrag(),e.cancelBubble=!0}),t.on(`dragend`,e=>{e.cancelBubble=!0}),t.on(`mouseenter`,()=>{let n=Gl(e,L.getAngle(this.rotation()),this.rotateAnchorCursor());t.getStage().content&&(t.getStage().content.style.cursor=n),this._cursorChange=!0}),t.on(`mouseout`,()=>{t.getStage().content&&(t.getStage().content.style.cursor=``),this._cursorChange=!1}),this.add(t)}_createBack(){let e=new U({name:`back`,width:0,height:0,sceneFunc(e,t){let n=t.getParent(),r=n.padding(),i=t.width(),a=t.height();if(e.beginPath(),e.rect(-r,-r,i+r*2,a+r*2),n.rotateEnabled()&&n.rotateLineVisible()){let t=n.rotateAnchorAngle(),r=n.rotateAnchorOffset(),o=z.degToRad(t),s=Math.sin(o),c=-Math.cos(o),l=i/2,u=a/2,d=1/0;c<0?d=Math.min(d,-u/c):c>0&&(d=Math.min(d,(a-u)/c)),s<0?d=Math.min(d,-l/s):s>0&&(d=Math.min(d,(i-l)/s));let f=l+s*d,p=u+c*d,m=z._sign(a),h=f+s*r*m,g=p+c*r*m;e.moveTo(f,p),e.lineTo(h,g)}e.fillStrokeShape(t)},hitFunc:(e,t)=>{if(!this.shouldOverdrawWholeArea())return;let n=this.padding();e.beginPath(),e.rect(-n,-n,t.width()+n*2,t.height()+n*2),e.fillStrokeShape(t)}});this.add(e),this._proxyDrag(e),e.on(`dragstart`,e=>{e.cancelBubble=!0}),e.on(`dragmove`,e=>{e.cancelBubble=!0}),e.on(`dragend`,e=>{e.cancelBubble=!0}),this.on(`dragmove`,e=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(` `)[0];let t=this._getNodeRect(),n=t.width,r=t.height,i=Math.sqrt(n**2+r**2);this.sin=Math.abs(r/i),this.cos=Math.abs(n/i),typeof window<`u`&&(window.addEventListener(`mousemove`,this._handleMouseMove),window.addEventListener(`touchmove`,this._handleMouseMove),window.addEventListener(`mouseup`,this._handleMouseUp,!0),window.addEventListener(`touchend`,this._handleMouseUp,!0)),this._transforming=!0;let a=e.target.getAbsolutePosition(),o=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:o.x-a.x,y:o.y-a.y},Ql++,this._fire(`transformstart`,{evt:e.evt,target:this.getNode()}),this._nodes.forEach(t=>{t._fire(`transformstart`,{evt:e.evt,target:t})})}_handleMouseMove(e){let t,n,r,i=this.findOne(`.`+this._movingAnchorName),a=i.getStage();a.setPointersPositions(e);let o=a.getPointerPosition(),s={x:o.x-this._anchorDragOffset.x,y:o.y-this._anchorDragOffset.y},c=i.getAbsolutePosition();this.anchorDragBoundFunc()&&(s=this.anchorDragBoundFunc()(c,s,e)),i.setAbsolutePosition(s);let l=i.getAbsolutePosition();if(c.x===l.x&&c.y===l.y)return;if(this._movingAnchorName===`rotater`){let r=this._getNodeRect();t=i.x()-r.width/2,n=-i.y()+r.height/2;let a=L.getAngle(this.rotateAnchorAngle()),o=Math.atan2(-n,t)+Math.PI/2-a;r.height<0&&(o-=Math.PI);let s=L.getAngle(this.rotation())+o,c=L.getAngle(this.rotationSnapTolerance()),l=Xl(r,Zl(this.rotationSnaps(),s,c)-r.rotation);this._fitNodesInto(l,e);return}let u=this.shiftBehavior(),d;d=u===`inverted`?this.keepRatio()&&!e.shiftKey:u===`none`?this.keepRatio():this.keepRatio()||e.shiftKey;let f=this.centeredScaling()||e.altKey;if(this._movingAnchorName===`top-left`){if(d){let e=f?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(`.bottom-right`).x(),y:this.findOne(`.bottom-right`).y()};r=Math.sqrt((e.x-i.x())**2+(e.y-i.y())**2);let a=this.findOne(`.top-left`).x()>e.x?-1:1,o=this.findOne(`.top-left`).y()>e.y?-1:1;t=r*this.cos*a,n=r*this.sin*o,this.findOne(`.top-left`).x(e.x-t),this.findOne(`.top-left`).y(e.y-n)}}else if(this._movingAnchorName===`top-center`)this.findOne(`.top-left`).y(i.y());else if(this._movingAnchorName===`top-right`){if(d){let e=f?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(`.bottom-left`).x(),y:this.findOne(`.bottom-left`).y()};r=Math.sqrt((i.x()-e.x)**2+(e.y-i.y())**2);let a=this.findOne(`.top-right`).x()<e.x?-1:1,o=this.findOne(`.top-right`).y()>e.y?-1:1;t=r*this.cos*a,n=r*this.sin*o,this.findOne(`.top-right`).x(e.x+t),this.findOne(`.top-right`).y(e.y-n)}var p=i.position();this.findOne(`.top-left`).y(p.y),this.findOne(`.bottom-right`).x(p.x)}else if(this._movingAnchorName===`middle-left`)this.findOne(`.top-left`).x(i.x());else if(this._movingAnchorName===`middle-right`)this.findOne(`.bottom-right`).x(i.x());else if(this._movingAnchorName===`bottom-left`){if(d){let e=f?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(`.top-right`).x(),y:this.findOne(`.top-right`).y()};r=Math.sqrt((e.x-i.x())**2+(i.y()-e.y)**2);let a=e.x<i.x()?-1:1,o=i.y()<e.y?-1:1;t=r*this.cos*a,n=r*this.sin*o,i.x(e.x-t),i.y(e.y+n)}p=i.position(),this.findOne(`.top-left`).x(p.x),this.findOne(`.bottom-right`).y(p.y)}else if(this._movingAnchorName===`bottom-center`)this.findOne(`.bottom-right`).y(i.y());else if(this._movingAnchorName===`bottom-right`){if(d){let e=f?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(`.top-left`).x(),y:this.findOne(`.top-left`).y()};r=Math.sqrt((i.x()-e.x)**2+(i.y()-e.y)**2);let a=this.findOne(`.bottom-right`).x()<e.x?-1:1,o=this.findOne(`.bottom-right`).y()<e.y?-1:1;t=r*this.cos*a,n=r*this.sin*o,this.findOne(`.bottom-right`).x(e.x+t),this.findOne(`.bottom-right`).y(e.y+n)}}else console.error(Error(`Wrong position argument of selection resizer: `+this._movingAnchorName));if(f=this.centeredScaling()||e.altKey,f){let e=this.findOne(`.top-left`),t=this.findOne(`.bottom-right`),n=e.x(),r=e.y(),i=this.getWidth()-t.x(),a=this.getHeight()-t.y();t.move({x:-n,y:-r}),e.move({x:i,y:a})}let m=this.findOne(`.top-left`).getAbsolutePosition();t=m.x,n=m.y;let h=this.findOne(`.bottom-right`).x()-this.findOne(`.top-left`).x(),g=this.findOne(`.bottom-right`).y()-this.findOne(`.top-left`).y();this._fitNodesInto({x:t,y:n,width:h,height:g,rotation:L.getAngle(this.rotation())},e)}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){var t;if(this._transforming){this._transforming=!1,typeof window<`u`&&(window.removeEventListener(`mousemove`,this._handleMouseMove),window.removeEventListener(`touchmove`,this._handleMouseMove),window.removeEventListener(`mouseup`,this._handleMouseUp,!0),window.removeEventListener(`touchend`,this._handleMouseUp,!0));let n=this.getNode();Ql--,this._fire(`transformend`,{evt:e,target:n}),(t=this.getLayer())==null||t.batchDraw(),n&&this._nodes.forEach(t=>{var n;t._fire(`transformend`,{evt:e,target:t}),(n=t.getLayer())==null||n.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,t){let n=this._getNodeRect();if(z._inRange(e.width,-this.padding()*2-1,1)){this.update();return}if(z._inRange(e.height,-this.padding()*2-1,1)){this.update();return}let r=new Da;if(r.rotate(L.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf(`left`)>=0){let t=r.point({x:-this.padding()*2,y:0});e.x+=t.x,e.y+=t.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace(`left`,`right`),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf(`right`)>=0){let t=r.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace(`right`,`left`),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf(`top`)>=0){let t=r.point({x:0,y:-this.padding()*2});e.x+=t.x,e.y+=t.y,this._movingAnchorName=this._movingAnchorName.replace(`top`,`bottom`),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf(`bottom`)>=0){let t=r.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace(`bottom`,`top`),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){let t=this.boundBoxFunc()(n,e);t?e=t:z.warn(`boundBoxFunc returned falsy. You should return new bound rect from it!`)}let i=1e7,a=new Da;a.translate(n.x,n.y),a.rotate(n.rotation),a.scale(n.width/i,n.height/i);let o=new Da,s=e.width/i,c=e.height/i;this.flipEnabled()===!1?(o.translate(e.x,e.y),o.rotate(e.rotation),o.translate(e.width<0?e.width:0,e.height<0?e.height:0),o.scale(Math.abs(s),Math.abs(c))):(o.translate(e.x,e.y),o.rotate(e.rotation),o.scale(s,c));let l=o.multiply(a.invert());this._nodes.forEach(e=>{var t;if(!e.getStage())return;let n=e.getParent().getAbsoluteTransform(),r=e.getTransform().copy();r.translate(e.offsetX(),e.offsetY());let i=new Da;i.multiply(n.copy().invert()).multiply(l).multiply(n).multiply(r);let a=i.decompose();e.setAttrs(a),(t=e.getLayer())==null||t.batchDraw()}),this.rotation(z._getRotation(e.rotation)),this._nodes.forEach(e=>{this._fire(`transform`,{evt:t,target:e}),e._fire(`transform`,{evt:t,target:e})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e;let t=this._getNodeRect();this.rotation(z._getRotation(t.rotation));let n=t.width,r=t.height,i=this.enabledAnchors(),a=this.resizeEnabled(),o=this.padding(),s=this.anchorSize(),c=this.find(`._anchor`);c.forEach(e=>{e.setAttrs({width:s,height:s,offsetX:s/2,offsetY:s/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(`.top-left`,{x:0,y:0,offsetX:s/2+o,offsetY:s/2+o,visible:a&&i.indexOf(`top-left`)>=0}),this._batchChangeChild(`.top-center`,{x:n/2,y:0,offsetY:s/2+o,visible:a&&i.indexOf(`top-center`)>=0}),this._batchChangeChild(`.top-right`,{x:n,y:0,offsetX:s/2-o,offsetY:s/2+o,visible:a&&i.indexOf(`top-right`)>=0}),this._batchChangeChild(`.middle-left`,{x:0,y:r/2,offsetX:s/2+o,visible:a&&i.indexOf(`middle-left`)>=0}),this._batchChangeChild(`.middle-right`,{x:n,y:r/2,offsetX:s/2-o,visible:a&&i.indexOf(`middle-right`)>=0}),this._batchChangeChild(`.bottom-left`,{x:0,y:r,offsetX:s/2+o,offsetY:s/2-o,visible:a&&i.indexOf(`bottom-left`)>=0}),this._batchChangeChild(`.bottom-center`,{x:n/2,y:r,offsetY:s/2-o,visible:a&&i.indexOf(`bottom-center`)>=0}),this._batchChangeChild(`.bottom-right`,{x:n,y:r,offsetX:s/2-o,offsetY:s/2-o,visible:a&&i.indexOf(`bottom-right`)>=0});let l=this.rotateAnchorAngle(),u=this.rotateAnchorOffset(),d=z.degToRad(l),f=Math.sin(d),p=-Math.cos(d),m=n/2,h=r/2,g=1/0;p<0?g=Math.min(g,-h/p):p>0&&(g=Math.min(g,(r-h)/p)),f<0?g=Math.min(g,-m/f):f>0&&(g=Math.min(g,(n-m)/f));let _=m+f*g,v=h+p*g,y=z._sign(r);this._batchChangeChild(`.rotater`,{x:_+f*u*y,y:v+p*u*y-o*p,visible:this.rotateEnabled()}),this._batchChangeChild(`.back`,{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some(e=>e.draggable()),x:0,y:0});let b=this.anchorStyleFunc();b&&c.forEach(e=>{b(e)}),(e=this.getLayer())==null||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();let e=this.findOne(`.`+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=``),cc.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...e){return this._elementsCreated?(z.error(`You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead.`),this):super.add(...e)}toObject(){return H.prototype.toObject.call(this)}clone(e){return H.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};$l.isTransforming=()=>Ql>0;function eu(e){return e instanceof Array||z.warn(`enabledAnchors value should be an array`),e instanceof Array&&e.forEach(function(e){Kl.indexOf(e)===-1&&z.warn(`Unknown anchor name: `+e+`. Available names are: `+Kl.join(`, `))}),e||[]}$l.prototype.className=`Transformer`,wa($l),V.addGetterSetter($l,`enabledAnchors`,Kl,eu),V.addGetterSetter($l,`flipEnabled`,!0,xo()),V.addGetterSetter($l,`resizeEnabled`,!0),V.addGetterSetter($l,`anchorSize`,10,B()),V.addGetterSetter($l,`rotateEnabled`,!0),V.addGetterSetter($l,`rotateLineVisible`,!0),V.addGetterSetter($l,`rotationSnaps`,[]),V.addGetterSetter($l,`rotateAnchorOffset`,50,B()),V.addGetterSetter($l,`rotateAnchorAngle`,0,B()),V.addGetterSetter($l,`rotateAnchorCursor`,`crosshair`),V.addGetterSetter($l,`rotationSnapTolerance`,5,B()),V.addGetterSetter($l,`borderEnabled`,!0),V.addGetterSetter($l,`anchorStroke`,`rgb(0, 161, 255)`),V.addGetterSetter($l,`anchorStrokeWidth`,1,B()),V.addGetterSetter($l,`anchorFill`,`white`),V.addGetterSetter($l,`anchorCornerRadius`,0,B()),V.addGetterSetter($l,`borderStroke`,`rgb(0, 161, 255)`),V.addGetterSetter($l,`borderStrokeWidth`,1,B()),V.addGetterSetter($l,`borderDash`),V.addGetterSetter($l,`keepRatio`,!0),V.addGetterSetter($l,`shiftBehavior`,`default`),V.addGetterSetter($l,`centeredScaling`,!1),V.addGetterSetter($l,`ignoreStroke`,!1),V.addGetterSetter($l,`padding`,0,B()),V.addGetterSetter($l,`nodes`),V.addGetterSetter($l,`node`),V.addGetterSetter($l,`boundBoxFunc`),V.addGetterSetter($l,`anchorDragBoundFunc`),V.addGetterSetter($l,`anchorStyleFunc`),V.addGetterSetter($l,`shouldOverdrawWholeArea`,!1),V.addGetterSetter($l,`useSingleNodeRotation`,!0),V.backCompat($l,{lineEnabled:`borderEnabled`,rotateHandlerOffset:`rotateAnchorOffset`,enabledHandlers:`enabledAnchors`});var tu=class extends U{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,L.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};tu.prototype.className=`Wedge`,tu.prototype._centroid=!0,tu.prototype._attrsAffectingSize=[`radius`],wa(tu),V.addGetterSetter(tu,`radius`,0,B()),V.addGetterSetter(tu,`angle`,0,B()),V.addGetterSetter(tu,`clockwise`,!1),V.backCompat(tu,{angleDeg:`angle`,getAngleDeg:`getAngle`,setAngleDeg:`setAngle`});function nu(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var ru=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],iu=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function au(e,t){let n=e.data,r=e.width,i=e.height,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T=t+t+1,E=r-1,D=i-1,ee=t+1,O=ee*(ee+1)/2,k=new nu,A=ru[t],te=iu[t],ne=null,j=k,M=null,re=null;for(let e=1;e<T;e++)j=j.next=new nu,e===ee&&(ne=j);j.next=k,s=o=0;for(let e=0;e<i;e++){g=_=v=y=c=l=u=d=0,f=ee*(b=n[o]),p=ee*(x=n[o+1]),m=ee*(S=n[o+2]),h=ee*(C=n[o+3]),c+=O*b,l+=O*x,u+=O*S,d+=O*C,j=k;for(let e=0;e<ee;e++)j.r=b,j.g=x,j.b=S,j.a=C,j=j.next;for(let e=1;e<ee;e++)a=o+((E<e?E:e)<<2),c+=(j.r=b=n[a])*(w=ee-e),l+=(j.g=x=n[a+1])*w,u+=(j.b=S=n[a+2])*w,d+=(j.a=C=n[a+3])*w,g+=b,_+=x,v+=S,y+=C,j=j.next;M=k,re=ne;for(let e=0;e<r;e++)n[o+3]=C=d*A>>te,C===0?n[o]=n[o+1]=n[o+2]=0:(C=255/C,n[o]=(c*A>>te)*C,n[o+1]=(l*A>>te)*C,n[o+2]=(u*A>>te)*C),c-=f,l-=p,u-=m,d-=h,f-=M.r,p-=M.g,m-=M.b,h-=M.a,a=s+((a=e+t+1)<E?a:E)<<2,g+=M.r=n[a],_+=M.g=n[a+1],v+=M.b=n[a+2],y+=M.a=n[a+3],c+=g,l+=_,u+=v,d+=y,M=M.next,f+=b=re.r,p+=x=re.g,m+=S=re.b,h+=C=re.a,g-=b,_-=x,v-=S,y-=C,re=re.next,o+=4;s+=r}for(let e=0;e<r;e++){_=v=y=g=l=u=d=c=0,o=e<<2,f=ee*(b=n[o]),p=ee*(x=n[o+1]),m=ee*(S=n[o+2]),h=ee*(C=n[o+3]),c+=O*b,l+=O*x,u+=O*S,d+=O*C,j=k;for(let e=0;e<ee;e++)j.r=b,j.g=x,j.b=S,j.a=C,j=j.next;let s=r;for(let i=1;i<=t;i++)o=s+e<<2,c+=(j.r=b=n[o])*(w=ee-i),l+=(j.g=x=n[o+1])*w,u+=(j.b=S=n[o+2])*w,d+=(j.a=C=n[o+3])*w,g+=b,_+=x,v+=S,y+=C,j=j.next,i<D&&(s+=r);o=e,M=k,re=ne;for(let t=0;t<i;t++)a=o<<2,n[a+3]=C=d*A>>te,C>0?(C=255/C,n[a]=(c*A>>te)*C,n[a+1]=(l*A>>te)*C,n[a+2]=(u*A>>te)*C):n[a]=n[a+1]=n[a+2]=0,c-=f,l-=p,u-=m,d-=h,f-=M.r,p-=M.g,m-=M.b,h-=M.a,a=e+((a=t+ee)<D?a:D)*r<<2,c+=g+=M.r=n[a],l+=_+=M.g=n[a+1],u+=v+=M.b=n[a+2],d+=y+=M.a=n[a+3],M=M.next,f+=b=re.r,p+=x=re.g,m+=S=re.b,h+=C=re.a,g-=b,_-=x,v-=S,y-=C,re=re.next,o+=r}}var ou=function(e){let t=Math.round(this.blurRadius());t>0&&au(e,t)};V.addGetterSetter(H,`blurRadius`,0,B(),V.afterSetFilter);var su=function(e){let t=this.brightness()*255,n=e.data,r=n.length;for(let e=0;e<r;e+=4)n[e]+=t,n[e+1]+=t,n[e+2]+=t};V.addGetterSetter(H,`brightness`,0,B(),V.afterSetFilter);var cu=function(e){let t=this.brightness(),n=e.data,r=n.length;for(let e=0;e<r;e+=4)n[e]=Math.min(255,n[e]*t),n[e+1]=Math.min(255,n[e+1]*t),n[e+2]=Math.min(255,n[e+2]*t)},lu=function(e){let t=((this.contrast()+100)/100)**2,n=e.data,r=n.length,i=150,a=150,o=150;for(let e=0;e<r;e+=4)i=n[e],a=n[e+1],o=n[e+2],i/=255,i-=.5,i*=t,i+=.5,i*=255,a/=255,a-=.5,a*=t,a+=.5,a*=255,o/=255,o-=.5,o*=t,o+=.5,o*=255,i=i<0?0:i>255?255:i,a=a<0?0:a>255?255:a,o=o<0?0:o>255?255:o,n[e]=i,n[e+1]=a,n[e+2]=o};V.addGetterSetter(H,`contrast`,0,B(),V.afterSetFilter);var uu=function(e){let t=e.data,n=e.width,r=e.height,i=Math.min(1,Math.max(0,this.embossStrength?.call(this)??.5)),a=Math.min(1,Math.max(0,this.embossWhiteLevel?.call(this)??.5)),o={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[this.embossDirection?.call(this)??`top-left`]??315,s=!!(this.embossBlend?.call(this)??!1),c=i*10,l=a*255,u=o*Math.PI/180,d=Math.cos(u),f=Math.sin(u),p=128/1020*c,m=new Uint8ClampedArray(t),h=new Float32Array(n*r);for(let e=0,n=0;n<t.length;n+=4,e++)h[e]=.2126*m[n]+.7152*m[n+1]+.0722*m[n+2];let g=[-1,0,1,-2,0,2,-1,0,1],_=[-1,-2,-1,0,0,0,1,2,1],v=[-n-1,-n,-n+1,-1,0,1,n-1,n,n+1],y=e=>e<0?0:e>255?255:e;for(let e=1;e<r-1;e++)for(let r=1;r<n-1;r++){let i=e*n+r,a=0,o=0;a+=h[i+v[0]]*g[0],o+=h[i+v[0]]*_[0],a+=h[i+v[1]]*g[1],o+=h[i+v[1]]*_[1],a+=h[i+v[2]]*g[2],o+=h[i+v[2]]*_[2],a+=h[i+v[3]]*g[3],o+=h[i+v[3]]*_[3],a+=h[i+v[5]]*g[5],o+=h[i+v[5]]*_[5],a+=h[i+v[6]]*g[6],o+=h[i+v[6]]*_[6],a+=h[i+v[7]]*g[7],o+=h[i+v[7]]*_[7],a+=h[i+v[8]]*g[8],o+=h[i+v[8]]*_[8];let c=y(l+(d*a+f*o)*p),u=i*4;if(s){let e=c-l;t[u]=y(m[u]+e),t[u+1]=y(m[u+1]+e),t[u+2]=y(m[u+2]+e),t[u+3]=m[u+3]}else t[u]=t[u+1]=t[u+2]=c,t[u+3]=m[u+3]}for(let e=0;e<n;e++){let i=e*4,a=((r-1)*n+e)*4;t[i]=m[i],t[i+1]=m[i+1],t[i+2]=m[i+2],t[i+3]=m[i+3],t[a]=m[a],t[a+1]=m[a+1],t[a+2]=m[a+2],t[a+3]=m[a+3]}for(let e=1;e<r-1;e++){let r=e*n*4,i=(e*n+(n-1))*4;t[r]=m[r],t[r+1]=m[r+1],t[r+2]=m[r+2],t[r+3]=m[r+3],t[i]=m[i],t[i+1]=m[i+1],t[i+2]=m[i+2],t[i+3]=m[i+3]}return e};V.addGetterSetter(H,`embossStrength`,.5,B(),V.afterSetFilter),V.addGetterSetter(H,`embossWhiteLevel`,.5,B(),V.afterSetFilter),V.addGetterSetter(H,`embossDirection`,`top-left`,void 0,V.afterSetFilter),V.addGetterSetter(H,`embossBlend`,!1,void 0,V.afterSetFilter);function du(e,t,n,r,i){let a=n-t,o=i-r;if(a===0)return r+o/2;if(o===0)return r;let s=(e-t)/a;return s=o*s+r,s}var fu=function(e){let t=e.data,n=t.length,r=t[0],i=r,a,o=t[1],s=o,c,l=t[2],u=l,d,f=this.enhance();if(f===0)return;for(let e=0;e<n;e+=4)a=t[e+0],a<r?r=a:a>i&&(i=a),c=t[e+1],c<o?o=c:c>s&&(s=c),d=t[e+2],d<l?l=d:d>u&&(u=d);i===r&&(i=255,r=0),s===o&&(s=255,o=0),u===l&&(u=255,l=0);let p,m,h,g,_,v;if(f>0)p=i+f*(255-i),m=r-f*(r-0),h=s+f*(255-s),g=o-f*(o-0),_=u+f*(255-u),v=l-f*(l-0);else{let e=(i+r)*.5;p=i+f*(i-e),m=r+f*(r-e);let t=(s+o)*.5;h=s+f*(s-t),g=o+f*(o-t);let n=(u+l)*.5;_=u+f*(u-n),v=l+f*(l-n)}for(let e=0;e<n;e+=4)t[e+0]=du(t[e+0],r,i,m,p),t[e+1]=du(t[e+1],o,s,g,h),t[e+2]=du(t[e+2],l,u,v,_)};V.addGetterSetter(H,`enhance`,0,B(),V.afterSetFilter);var pu=function(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4){let n=.34*t[e]+.5*t[e+1]+.16*t[e+2];t[e]=n,t[e+1]=n,t[e+2]=n}};V.addGetterSetter(H,`hue`,0,B(),V.afterSetFilter),V.addGetterSetter(H,`saturation`,0,B(),V.afterSetFilter),V.addGetterSetter(H,`luminance`,0,B(),V.afterSetFilter);var mu=function(e){let t=e.data,n=t.length,r=2**this.saturation(),i=Math.abs(this.hue()+360)%360,a=this.luminance()*127,o=1*r*Math.cos(i*Math.PI/180),s=1*r*Math.sin(i*Math.PI/180),c=.299*1+.701*o+.167*s,l=.587*1-.587*o+.33*s,u=.114*1-.114*o-.497*s,d=.299*1-.299*o-.328*s,f=.587*1+.413*o+.035*s,p=.114*1-.114*o+.293*s,m=.299*1-.3*o+1.25*s,h=.587*1-.586*o-1.05*s,g=.114*1+.886*o-.2*s,_,v,y,b;for(let e=0;e<n;e+=4)_=t[e+0],v=t[e+1],y=t[e+2],b=t[e+3],t[e+0]=c*_+l*v+u*y+a,t[e+1]=d*_+f*v+p*y+a,t[e+2]=m*_+h*v+g*y+a,t[e+3]=b},hu=function(e){let t=e.data,n=t.length,r=2**this.value(),i=2**this.saturation(),a=Math.abs(this.hue()+360)%360,o=r*i*Math.cos(a*Math.PI/180),s=r*i*Math.sin(a*Math.PI/180),c=.299*r+.701*o+.167*s,l=.587*r-.587*o+.33*s,u=.114*r-.114*o-.497*s,d=.299*r-.299*o-.328*s,f=.587*r+.413*o+.035*s,p=.114*r-.114*o+.293*s,m=.299*r-.3*o+1.25*s,h=.587*r-.586*o-1.05*s,g=.114*r+.886*o-.2*s;for(let e=0;e<n;e+=4){let n=t[e+0],r=t[e+1],i=t[e+2],a=t[e+3];t[e+0]=c*n+l*r+u*i,t[e+1]=d*n+f*r+p*i,t[e+2]=m*n+h*r+g*i,t[e+3]=a}};V.addGetterSetter(H,`hue`,0,B(),V.afterSetFilter),V.addGetterSetter(H,`saturation`,0,B(),V.afterSetFilter),V.addGetterSetter(H,`value`,0,B(),V.afterSetFilter);var gu=function(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4)t[e]=255-t[e],t[e+1]=255-t[e+1],t[e+2]=255-t[e+2]},_u=function(e,t,n){let r=e.data,i=t.data,a=e.width,o=e.height,s=n.polarCenterX||a/2,c=n.polarCenterY||o/2,l=Math.sqrt(s*s+c*c),u=a-s,d=o-c,f=Math.sqrt(u*u+d*d);l=f>l?f:l;let p=o,m=a,h=360/m*Math.PI/180;for(let e=0;e<m;e+=1){let t=Math.sin(e*h),n=Math.cos(e*h);for(let o=0;o<p;o+=1){u=Math.floor(s+l*o/p*n),d=Math.floor(c+l*o/p*t);let f=(d*a+u)*4,m=r[f+0],h=r[f+1],g=r[f+2],_=r[f+3];f=(e+o*a)*4,i[f+0]=m,i[f+1]=h,i[f+2]=g,i[f+3]=_}}},vu=function(e,t,n){let r=e.data,i=t.data,a=e.width,o=e.height,s=n.polarCenterX||a/2,c=n.polarCenterY||o/2,l=Math.sqrt(s*s+c*c),u=a-s,d=o-c,f=Math.sqrt(u*u+d*d);l=f>l?f:l;let p=o,m=a,h=n.polarRotation||0,g,_;for(u=0;u<a;u+=1)for(d=0;d<o;d+=1){let e=u-s,t=d-c,n=Math.sqrt(e*e+t*t)*p/l,o=(Math.atan2(t,e)*180/Math.PI+360+h)%360;o=o*m/360,g=Math.floor(o),_=Math.floor(n);let f=(_*a+g)*4,v=r[f+0],y=r[f+1],b=r[f+2],x=r[f+3];f=(d*a+u)*4,i[f+0]=v,i[f+1]=y,i[f+2]=b,i[f+3]=x}},yu=function(e){let t=e.width,n=e.height,r,i,a,o,s,c,l,u,d,f,p=Math.round(this.kaleidoscopePower()),m=Math.round(this.kaleidoscopeAngle()),h=Math.floor(m%360*t/360);if(p<1)return;let g=z.createCanvasElement();g.width=t,g.height=n;let _=g.getContext(`2d`).getImageData(0,0,t,n);z.releaseCanvas(g),_u(e,_,{polarCenterX:t/2,polarCenterY:n/2});let v=t/2**p;for(;v<=8;)v*=2,--p;v=Math.ceil(v);let y=v,b=0,x=y,S=1;for(h+v>t&&(b=y,x=0,S=-1),i=0;i<n;i+=1)for(r=b;r!==x;r+=S)a=Math.round(r+h)%t,d=(t*i+a)*4,s=_.data[d+0],c=_.data[d+1],l=_.data[d+2],u=_.data[d+3],f=(t*i+r)*4,_.data[f+0]=s,_.data[f+1]=c,_.data[f+2]=l,_.data[f+3]=u;for(i=0;i<n;i+=1)for(y=Math.floor(v),o=0;o<p;o+=1){for(r=0;r<y+1;r+=1)d=(t*i+r)*4,s=_.data[d+0],c=_.data[d+1],l=_.data[d+2],u=_.data[d+3],f=(t*i+y*2-r-1)*4,_.data[f+0]=s,_.data[f+1]=c,_.data[f+2]=l,_.data[f+3]=u;y*=2}vu(_,e,{polarRotation:0})};V.addGetterSetter(H,`kaleidoscopePower`,2,B(),V.afterSetFilter),V.addGetterSetter(H,`kaleidoscopeAngle`,0,B(),V.afterSetFilter);function bu(e,t,n){let r=(n*e.width+t)*4,i=[];return i.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),i}function xu(e,t){return Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2)}function Su(e){let t=[0,0,0];for(let n=0;n<e.length;n++)t[0]+=e[n][0],t[1]+=e[n][1],t[2]+=e[n][2];return t[0]/=e.length,t[1]/=e.length,t[2]/=e.length,t}function Cu(e,t){let n=bu(e,0,0),r=bu(e,e.width-1,0),i=bu(e,0,e.height-1),a=bu(e,e.width-1,e.height-1),o=t||10;if(xu(n,r)<o&&xu(r,a)<o&&xu(a,i)<o&&xu(i,n)<o){let t=Su([r,n,a,i]),s=[];for(let n=0;n<e.width*e.height;n++)s[n]=xu(t,[e.data[n*4],e.data[n*4+1],e.data[n*4+2]])<o?0:255;return s}}function wu(e,t){for(let n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}function Tu(e,t,n){let r=[1,1,1,1,0,1,1,1,1],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),o=[];for(let s=0;s<n;s++)for(let c=0;c<t;c++){let l=s*t+c,u=0;for(let o=0;o<i;o++)for(let l=0;l<i;l++){let d=s+o-a,f=c+l-a;if(d>=0&&d<n&&f>=0&&f<t){let n=d*t+f,a=r[o*i+l];u+=e[n]*a}}o[l]=u===2040?255:0}return o}function Eu(e,t,n){let r=[1,1,1,1,1,1,1,1,1],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),o=[];for(let s=0;s<n;s++)for(let c=0;c<t;c++){let l=s*t+c,u=0;for(let o=0;o<i;o++)for(let l=0;l<i;l++){let d=s+o-a,f=c+l-a;if(d>=0&&d<n&&f>=0&&f<t){let n=d*t+f,a=r[o*i+l];u+=e[n]*a}}o[l]=u>=1020?255:0}return o}function Du(e,t,n){let r=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),o=[];for(let s=0;s<n;s++)for(let c=0;c<t;c++){let l=s*t+c,u=0;for(let o=0;o<i;o++)for(let l=0;l<i;l++){let d=s+o-a,f=c+l-a;if(d>=0&&d<n&&f>=0&&f<t){let n=d*t+f,a=r[o*i+l];u+=e[n]*a}}o[l]=u}return o}var Ou=function(e){let t=Cu(e,this.threshold());return t&&(t=Tu(t,e.width,e.height),t=Eu(t,e.width,e.height),t=Du(t,e.width,e.height),wu(e,t)),e};V.addGetterSetter(H,`threshold`,0,B(),V.afterSetFilter);var ku=function(e){let t=this.noise()*255,n=e.data,r=n.length,i=t/2;for(let e=0;e<r;e+=4)n[e+0]+=i-2*i*Math.random(),n[e+1]+=i-2*i*Math.random(),n[e+2]+=i-2*i*Math.random()};V.addGetterSetter(H,`noise`,.2,B(),V.afterSetFilter);var Au=function(e){let t=Math.ceil(this.pixelSize()),n=e.width,r=e.height,i=Math.ceil(n/t),a=Math.ceil(r/t),o=e.data;if(t<=0){z.error(`pixelSize value can not be <= 0`);return}for(let e=0;e<i;e+=1)for(let i=0;i<a;i+=1){let a=0,s=0,c=0,l=0,u=e*t,d=u+t,f=i*t,p=f+t,m=0;for(let e=u;e<d;e+=1)if(!(e>=n))for(let t=f;t<p;t+=1){if(t>=r)continue;let i=(n*t+e)*4;a+=o[i+0],s+=o[i+1],c+=o[i+2],l+=o[i+3],m+=1}a/=m,s/=m,c/=m,l/=m;for(let e=u;e<d;e+=1)if(!(e>=n))for(let t=f;t<p;t+=1){if(t>=r)continue;let i=(n*t+e)*4;o[i+0]=a,o[i+1]=s,o[i+2]=c,o[i+3]=l}}};V.addGetterSetter(H,`pixelSize`,8,B(),V.afterSetFilter);var ju=function(e){let t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,i=255/t;for(let e=0;e<r;e+=1)n[e]=Math.floor(n[e]/i)*i};V.addGetterSetter(H,`levels`,.5,B(),V.afterSetFilter);var Mu=function(e){let t=e.data,n=t.length,r=this.red(),i=this.green(),a=this.blue();for(let e=0;e<n;e+=4){let n=(.34*t[e]+.5*t[e+1]+.16*t[e+2])/255;t[e]=n*r,t[e+1]=n*i,t[e+2]=n*a,t[e+3]=t[e+3]}};V.addGetterSetter(H,`red`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),V.addGetterSetter(H,`green`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),V.addGetterSetter(H,`blue`,0,ho,V.afterSetFilter);var Nu=function(e){let t=e.data,n=t.length,r=this.red(),i=this.green(),a=this.blue(),o=this.alpha();for(let e=0;e<n;e+=4){let n=1-o;t[e]=r*o+t[e]*n,t[e+1]=i*o+t[e+1]*n,t[e+2]=a*o+t[e+2]*n}};V.addGetterSetter(H,`red`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),V.addGetterSetter(H,`green`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),V.addGetterSetter(H,`blue`,0,ho,V.afterSetFilter),V.addGetterSetter(H,`alpha`,1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var Pu=function(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4){let n=t[e+0],r=t[e+1],i=t[e+2];t[e+0]=Math.min(255,n*.393+r*.769+i*.189),t[e+1]=Math.min(255,n*.349+r*.686+i*.168),t[e+2]=Math.min(255,n*.272+r*.534+i*.131)}},Fu=function(e){let t=e.data;for(let e=0;e<t.length;e+=4){let n=t[e],r=t[e+1],i=t[e+2];.2126*n+.7152*r+.0722*i>=128&&(t[e]=255-n,t[e+1]=255-r,t[e+2]=255-i)}return e},Iu=function(e){let t=this.threshold()*255,n=e.data,r=n.length;for(let e=0;e<r;e+=1)n[e]=n[e]<t?0:255};V.addGetterSetter(H,`threshold`,.5,B(),V.afterSetFilter);var G=W.Util._assign(W,{Arc:bc,Arrow:Pc,Circle:Fc,Ellipse:Ic,Image:Lc,Label:Kc,Tag:qc,Line:wc,Path:Nc,Rect:Jc,RegularPolygon:Yc,Ring:Zc,Sprite:Qc,Star:$c,Text:Nl,TextPath:Rl,Transformer:$l,Wedge:tu,Filters:{Blur:ou,Brightness:cu,Brighten:su,Contrast:lu,Emboss:uu,Enhance:fu,Grayscale:pu,HSL:mu,HSV:hu,Invert:gu,Kaleidoscope:yu,Mask:Ou,Noise:ku,Pixelate:Au,Posterize:ju,RGB:Mu,RGBA:Nu,Sepia:Pu,Solarize:Fu,Threshold:Iu}}),Lu=W,Ru=o(((e,t)=>{t.exports=function(e){var t={},n=d(),r=p(),i=Object.assign;function a(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;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.`}var o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,s=Symbol.for(`react.element`),c=Symbol.for(`react.portal`),l=Symbol.for(`react.fragment`),u=Symbol.for(`react.strict_mode`),f=Symbol.for(`react.profiler`),m=Symbol.for(`react.provider`),h=Symbol.for(`react.context`),g=Symbol.for(`react.forward_ref`),_=Symbol.for(`react.suspense`),v=Symbol.for(`react.suspense_list`),y=Symbol.for(`react.memo`),b=Symbol.for(`react.lazy`),x=Symbol.for(`react.offscreen`),S=Symbol.iterator;function C(e){return typeof e!=`object`||!e?null:(e=S&&e[S]||e[`@@iterator`],typeof e==`function`?e:null)}function w(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case l:return`Fragment`;case c:return`Portal`;case f:return`Profiler`;case u:return`StrictMode`;case _:return`Suspense`;case v:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case h:return(e.displayName||`Context`)+`.Consumer`;case m:return(e._context.displayName||`Context`)+`.Provider`;case g:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case y:return t=e.displayName||null,t===null?w(e.type)||`Memo`:t;case b:t=e._payload,e=e._init;try{return w(e(t))}catch{}}return null}function T(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return w(t);case 8:return t===u?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function E(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 D(e){if(E(e)!==e)throw Error(a(188))}function ee(e){var t=e.alternate;if(!t){if(t=E(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return D(i),e;if(o===r)return D(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var s=!1,c=i.child;c;){if(c===n){s=!0,n=i,r=o;break}if(c===r){s=!0,r=i,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,r=i;break}if(c===r){s=!0,r=o,n=i;break}c=c.sibling}if(!s)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function O(e){return e=ee(e),e===null?null:k(e)}function k(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=k(e);if(t!==null)return t;e=e.sibling}return null}function A(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){if(e.tag!==4){var t=A(e);if(t!==null)return t}e=e.sibling}return null}var te=Array.isArray,ne=e.getPublicInstance,j=e.getRootHostContext,M=e.getChildHostContext,re=e.prepareForCommit,ie=e.resetAfterCommit,ae=e.createInstance,oe=e.appendInitialChild,N=e.finalizeInitialChildren,se=e.prepareUpdate,ce=e.shouldSetTextContent,le=e.createTextInstance,ue=e.scheduleTimeout,de=e.cancelTimeout,fe=e.noTimeout,pe=e.isPrimaryRenderer,me=e.supportsMutation,he=e.supportsPersistence,ge=e.supportsHydration,_e=e.getInstanceFromNode,ve=e.preparePortalMount,ye=e.getCurrentEventPriority,be=e.detachDeletedInstance,xe=e.supportsMicrotasks,Se=e.scheduleMicrotask,Ce=e.supportsTestSelectors,we=e.findFiberRoot,Te=e.getBoundingRect,Ee=e.getTextContent,De=e.isHiddenSubtree,Oe=e.matchAccessibilityRole,ke=e.setFocusIfFocusable,Ae=e.setupIntersectionObserver,je=e.appendChild,Me=e.appendChildToContainer,P=e.commitTextUpdate,Ne=e.commitMount,Pe=e.commitUpdate,Fe=e.insertBefore,Ie=e.insertInContainerBefore,Le=e.removeChild,Re=e.removeChildFromContainer,ze=e.resetTextContent,Be=e.hideInstance,Ve=e.hideTextInstance,He=e.unhideInstance,Ue=e.unhideTextInstance,We=e.clearContainer,Ge=e.cloneInstance,Ke=e.createContainerChildSet,qe=e.appendChildToContainerChildSet,Je=e.finalizeContainerChildren,Ye=e.replaceContainerChildren,Xe=e.cloneHiddenInstance,Ze=e.cloneHiddenTextInstance,Qe=e.canHydrateInstance,$e=e.canHydrateTextInstance,et=e.canHydrateSuspenseInstance,tt=e.isSuspenseInstancePending,nt=e.isSuspenseInstanceFallback,rt=e.getSuspenseInstanceFallbackErrorDetails,it=e.registerSuspenseInstanceRetry,at=e.getNextHydratableSibling,ot=e.getFirstHydratableChild,st=e.getFirstHydratableChildWithinContainer,ct=e.getFirstHydratableChildWithinSuspenseInstance,lt=e.hydrateInstance,ut=e.hydrateTextInstance,dt=e.hydrateSuspenseInstance,ft=e.getNextHydratableInstanceAfterSuspenseInstance,pt=e.commitHydratedContainer,mt=e.commitHydratedSuspenseInstance,ht=e.clearSuspenseBoundary,gt=e.clearSuspenseBoundaryFromContainer,_t=e.shouldDeleteUnhydratedTailInstances,vt=e.didNotMatchHydratedContainerTextInstance,yt=e.didNotMatchHydratedTextInstance,bt;function xt(e){if(bt===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);bt=t&&t[1]||``}return`
|
|
26
|
-
`+bt+e}var St=!1;function Ct(e,t){if(!e||St)return``;St=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
|
|
27
|
-
`),a=r.stack.split(`
|
|
28
|
-
`),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
|
|
29
|
-
`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{St=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?xt(e):``}var wt=Object.prototype.hasOwnProperty,Tt=[],Et=-1;function Dt(e){return{current:e}}function Ot(e){0>Et||(e.current=Tt[Et],Tt[Et]=null,Et--)}function kt(e,t){Et++,Tt[Et]=e.current,e.current=t}var At={},jt=Dt(At),Mt=Dt(!1),Nt=At;function Pt(e,t){var n=e.type.contextTypes;if(!n)return At;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Ft(e){return e=e.childContextTypes,e!=null}function It(){Ot(Mt),Ot(jt)}function Lt(e,t,n){if(jt.current!==At)throw Error(a(168));kt(jt,t),kt(Mt,n)}function Rt(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!=`function`)return n;for(var o in r=r.getChildContext(),r)if(!(o in t))throw Error(a(108,T(e)||`Unknown`,o));return i({},n,r)}function zt(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||At,Nt=jt.current,kt(jt,e),kt(Mt,Mt.current),!0}function Bt(e,t,n){var r=e.stateNode;if(!r)throw Error(a(169));n?(e=Rt(e,t,Nt),r.__reactInternalMemoizedMergedChildContext=e,Ot(Mt),Ot(jt),kt(jt,e)):Ot(Mt),kt(Mt,n)}var Vt=Math.clz32?Math.clz32:Wt,Ht=Math.log,Ut=Math.LN2;function Wt(e){return e>>>=0,e===0?32:31-(Ht(e)/Ut|0)|0}var Gt=64,Kt=4194304;function qt(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Jt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=qt(a))):r=qt(s)}else o=n&~i,o===0?a!==0&&(r=qt(a)):r=qt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Vt(t),i=1<<n,r|=e[n],t&=~i;return r}function Yt(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Xt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-Vt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Yt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Zt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function Qt(){var e=Gt;return Gt<<=1,!(Gt&4194240)&&(Gt=64),e}function $t(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function en(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Vt(t),e[t]=n}function tn(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-Vt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function nn(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Vt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var F=0;function rn(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var an=r.unstable_scheduleCallback,on=r.unstable_cancelCallback,sn=r.unstable_shouldYield,cn=r.unstable_requestPaint,ln=r.unstable_now,un=r.unstable_ImmediatePriority,dn=r.unstable_UserBlockingPriority,fn=r.unstable_NormalPriority,pn=r.unstable_IdlePriority,mn=null,hn=null;function gn(e){if(hn&&typeof hn.onCommitFiberRoot==`function`)try{hn.onCommitFiberRoot(mn,e,void 0,(e.current.flags&128)==128)}catch{}}function _n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var vn=typeof Object.is==`function`?Object.is:_n,yn=null,I=!1,bn=!1;function xn(e){yn===null?yn=[e]:yn.push(e)}function Sn(e){I=!0,xn(e)}function Cn(){if(!bn&&yn!==null){bn=!0;var e=0,t=F;try{var n=yn;for(F=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}yn=null,I=!1}catch(t){throw yn!==null&&(yn=yn.slice(e+1)),an(un,Cn),t}finally{F=t,bn=!1}}return null}var wn=[],Tn=0,En=null,Dn=0,On=[],kn=0,An=null,jn=1,Mn=``;function Nn(e,t){wn[Tn++]=Dn,wn[Tn++]=En,En=e,Dn=t}function Pn(e,t,n){On[kn++]=jn,On[kn++]=Mn,On[kn++]=An,An=e;var r=jn;e=Mn;var i=32-Vt(r)-1;r&=~(1<<i),n+=1;var a=32-Vt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,jn=1<<32-Vt(t)+i|n<<i|r,Mn=a+e}else jn=1<<a|n<<i|r,Mn=e}function Fn(e){e.return!==null&&(Nn(e,1),Pn(e,1,0))}function In(e){for(;e===En;)En=wn[--Tn],wn[Tn]=null,Dn=wn[--Tn],wn[Tn]=null;for(;e===An;)An=On[--kn],On[kn]=null,Mn=On[--kn],On[kn]=null,jn=On[--kn],On[kn]=null}var Ln=null,Rn=null,zn=!1,Bn=!1,Vn=null;function Hn(e,t){var n=ks(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Un(e,t){switch(e.tag){case 5:return t=Qe(t,e.type,e.pendingProps),t===null?!1:(e.stateNode=t,Ln=e,Rn=ot(t),!0);case 6:return t=$e(t,e.pendingProps),t===null?!1:(e.stateNode=t,Ln=e,Rn=null,!0);case 13:if(t=et(t),t!==null){var n=An===null?null:{id:jn,overflow:Mn};return e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=ks(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Ln=e,Rn=null,!0}return!1;default:return!1}}function Wn(e){return(e.mode&1)!=0&&(e.flags&128)==0}function Gn(e){if(zn){var t=Rn;if(t){var n=t;if(!Un(e,t)){if(Wn(e))throw Error(a(418));t=at(n);var r=Ln;t&&Un(e,t)?Hn(r,n):(e.flags=e.flags&-4097|2,zn=!1,Ln=e)}}else{if(Wn(e))throw Error(a(418));e.flags=e.flags&-4097|2,zn=!1,Ln=e}}}function Kn(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ln=e}function qn(e){if(!ge||e!==Ln)return!1;if(!zn)return Kn(e),zn=!0,!1;if(e.tag!==3&&(e.tag!==5||_t(e.type)&&!ce(e.type,e.memoizedProps))){var t=Rn;if(t){if(Wn(e))throw Jn(),Error(a(418));for(;t;)Hn(e,t),t=at(t)}}if(Kn(e),e.tag===13){if(!ge)throw Error(a(316));if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(317));Rn=ft(e)}else Rn=Ln?at(e.stateNode):null;return!0}function Jn(){for(var e=Rn;e;)e=at(e)}function Yn(){ge&&(Rn=Ln=null,Bn=zn=!1)}function Xn(e){Vn===null?Vn=[e]:Vn.push(e)}var Zn=o.ReactCurrentBatchConfig;function Qn(e,t){if(vn(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(!wt.call(t,i)||!vn(e[i],t[i]))return!1}return!0}function $n(e){switch(e.tag){case 5:return xt(e.type);case 16:return xt(`Lazy`);case 13:return xt(`Suspense`);case 19:return xt(`SuspenseList`);case 0:case 2:case 15:return e=Ct(e.type,!1),e;case 11:return e=Ct(e.type.render,!1),e;case 1:return e=Ct(e.type,!0),e;default:return``}}function er(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(a(309));var r=n.stateNode}if(!r)throw Error(a(147,e));var i=r,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=i.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(a(284));if(!n._owner)throw Error(a(290,e))}return e}function tr(e,t){throw e=Object.prototype.toString.call(t),Error(a(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function nr(e){var t=e._init;return t(e._payload)}function rr(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,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function i(e,t){return e=Ms(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|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function u(t){return e&&t.alternate===null&&(t.flags|=2),t}function d(e,t,n,r){return t===null||t.tag!==6?(t=Is(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n,r){var a=n.type;return a===l?m(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===b&&nr(a)===t.type)?(r=i(t,n.props),r.ref=er(e,t,n),r.return=e,r):(r=Ns(n.type,n.key,n.props,null,e.mode,r),r.ref=er(e,t,n),r.return=e,r)}function p(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Ls(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function m(e,t,n,r,a){return t===null||t.tag!==7?(t=Ps(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function h(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=Is(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case s:return n=Ns(t.type,t.key,t.props,null,e.mode,n),n.ref=er(e,null,t),n.return=e,n;case c:return t=Ls(t,e.mode,n),t.return=e,t;case b:var r=t._init;return h(e,r(t._payload),n)}if(te(t)||C(t))return t=Ps(t,e.mode,n,null),t.return=e,t;tr(e,t)}return null}function g(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`)return i===null?d(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case s:return n.key===i?f(e,t,n,r):null;case c:return n.key===i?p(e,t,n,r):null;case b:return i=n._init,g(e,t,i(n._payload),r)}if(te(n)||C(n))return i===null?m(e,t,n,r,null):null;tr(e,n)}return null}function _(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,d(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case s:return e=e.get(r.key===null?n:r.key)||null,f(t,e,r,i);case c:return e=e.get(r.key===null?n:r.key)||null,p(t,e,r,i);case b:var a=r._init;return _(e,t,n,a(r._payload),i)}if(te(r)||C(r))return e=e.get(n)||null,m(t,e,r,i,null);tr(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,f=a=0,p=null;d!==null&&f<s.length;f++){d.index>f?(p=d,d=null):p=d.sibling;var m=g(i,d,s[f],c);if(m===null){d===null&&(d=p);break}e&&d&&m.alternate===null&&t(i,d),a=o(m,a,f),u===null?l=m:u.sibling=m,u=m,d=p}if(f===s.length)return n(i,d),zn&&Nn(i,f),l;if(d===null){for(;f<s.length;f++)d=h(i,s[f],c),d!==null&&(a=o(d,a,f),u===null?l=d:u.sibling=d,u=d);return zn&&Nn(i,f),l}for(d=r(i,d);f<s.length;f++)p=_(d,i,f,s[f],c),p!==null&&(e&&p.alternate!==null&&d.delete(p.key===null?f:p.key),a=o(p,a,f),u===null?l=p:u.sibling=p,u=p);return e&&d.forEach(function(e){return t(i,e)}),zn&&Nn(i,f),l}function y(i,s,c,l){var u=C(c);if(typeof u!=`function`)throw Error(a(150));if(c=u.call(c),c==null)throw Error(a(151));for(var d=u=null,f=s,p=s=0,m=null,v=c.next();f!==null&&!v.done;p++,v=c.next()){f.index>p?(m=f,f=null):m=f.sibling;var y=g(i,f,v.value,l);if(y===null){f===null&&(f=m);break}e&&f&&y.alternate===null&&t(i,f),s=o(y,s,p),d===null?u=y:d.sibling=y,d=y,f=m}if(v.done)return n(i,f),zn&&Nn(i,p),u;if(f===null){for(;!v.done;p++,v=c.next())v=h(i,v.value,l),v!==null&&(s=o(v,s,p),d===null?u=v:d.sibling=v,d=v);return zn&&Nn(i,p),u}for(f=r(i,f);!v.done;p++,v=c.next())v=_(f,i,p,v.value,l),v!==null&&(e&&v.alternate!==null&&f.delete(v.key===null?p:v.key),s=o(v,s,p),d===null?u=v:d.sibling=v,d=v);return e&&f.forEach(function(e){return t(i,e)}),zn&&Nn(i,p),u}function x(e,r,a,o){if(typeof a==`object`&&a&&a.type===l&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case s:a:{for(var d=a.key,f=r;f!==null;){if(f.key===d){if(d=a.type,d===l){if(f.tag===7){n(e,f.sibling),r=i(f,a.props.children),r.return=e,e=r;break a}}else if(f.elementType===d||typeof d==`object`&&d&&d.$$typeof===b&&nr(d)===f.type){n(e,f.sibling),r=i(f,a.props),r.ref=er(e,f,a),r.return=e,e=r;break a}n(e,f);break}else t(e,f);f=f.sibling}a.type===l?(r=Ps(a.props.children,e.mode,o,a.key),r.return=e,e=r):(o=Ns(a.type,a.key,a.props,null,e.mode,o),o.ref=er(e,r,a),o.return=e,e=o)}return u(e);case c:a:{for(f=a.key;r!==null;){if(r.key===f)if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),r=i(r,a.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=Ls(a,e.mode,o),r.return=e,e=r}return u(e);case b:return f=a._init,x(e,r,f(a._payload),o)}if(te(a))return v(e,r,a,o);if(C(a))return y(e,r,a,o);tr(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),r=i(r,a),r.return=e,e=r):(n(e,r),r=Is(a,e.mode,o),r.return=e,e=r),u(e)):n(e,r)}return x}var ir=rr(!0),ar=rr(!1),or=Dt(null),sr=null,cr=null,lr=null;function ur(){lr=cr=sr=null}function dr(e,t,n){pe?(kt(or,t._currentValue),t._currentValue=n):(kt(or,t._currentValue2),t._currentValue2=n)}function fr(e){var t=or.current;Ot(or),pe?e._currentValue=t:e._currentValue2=t}function pr(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 mr(e,t){sr=e,lr=cr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(ra=!0),e.firstContext=null)}function hr(e){var t=pe?e._currentValue:e._currentValue2;if(lr!==e)if(e={context:e,memoizedValue:t,next:null},cr===null){if(sr===null)throw Error(a(308));cr=e,sr.dependencies={lanes:0,firstContext:e}}else cr=cr.next=e;return t}var gr=null;function _r(e){gr===null?gr=[e]:gr.push(e)}function vr(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,_r(t)):(n.next=i.next,i.next=n),t.interleaved=n,yr(e,r)}function yr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var br=!1;function xr(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Sr(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Cr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function wr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,V&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,yr(e,n)}return i=r.interleaved,i===null?(t.next=t,_r(r)):(t.next=i.next,i.next=t),r.interleaved=t,yr(e,n)}function Tr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nn(e,n)}}function Er(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={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,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,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Dr(e,t,n,r){var a=e.updateQueue;br=!1;var o=a.firstBaseUpdate,s=a.lastBaseUpdate,c=a.shared.pending;if(c!==null){a.shared.pending=null;var l=c,u=l.next;l.next=null,s===null?o=u:s.next=u,s=l;var d=e.alternate;d!==null&&(d=d.updateQueue,c=d.lastBaseUpdate,c!==s&&(c===null?d.firstBaseUpdate=u:c.next=u,d.lastBaseUpdate=l))}if(o!==null){var f=a.baseState;s=0,d=u=l=null,c=o;do{var p=c.lane,m=c.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:m,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});a:{var h=e,g=c;switch(p=t,m=n,g.tag){case 1:if(h=g.payload,typeof h==`function`){f=h.call(m,f,p);break a}f=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(m,f,p):h,p==null)break a;f=i({},f,p);break a;case 2:br=!0}}c.callback!==null&&c.lane!==0&&(e.flags|=64,p=a.effects,p===null?a.effects=[c]:p.push(c))}else m={eventTime:m,lane:p,tag:c.tag,payload:c.payload,callback:c.callback,next:null},d===null?(u=d=m,l=f):d=d.next=m,s|=p;if(c=c.next,c===null){if(c=a.shared.pending,c===null)break;p=c,c=p.next,p.next=null,a.lastBaseUpdate=p,a.shared.pending=null}}while(1);if(d===null&&(l=f),a.baseState=l,a.firstBaseUpdate=u,a.lastBaseUpdate=d,t=a.shared.interleaved,t!==null){a=t;do s|=a.lane,a=a.next;while(a!==t)}else o===null&&(a.shared.lanes=0);Mo|=s,e.lanes=s,e.memoizedState=f}}function Or(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!=`function`)throw Error(a(191,i));i.call(r)}}}var kr={},Ar=Dt(kr),jr=Dt(kr),Mr=Dt(kr);function Nr(e){if(e===kr)throw Error(a(174));return e}function Pr(e,t){kt(Mr,t),kt(jr,e),kt(Ar,kr),e=j(t),Ot(Ar),kt(Ar,e)}function Fr(){Ot(Ar),Ot(jr),Ot(Mr)}function Ir(e){var t=Nr(Mr.current),n=Nr(Ar.current);t=M(n,e.type,t),n!==t&&(kt(jr,e),kt(Ar,t))}function Lr(e){jr.current===e&&(Ot(Ar),Ot(jr))}var Rr=Dt(0);function zr(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||tt(n)||nt(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){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 Br=[];function Vr(){for(var e=0;e<Br.length;e++){var t=Br[e];pe?t._workInProgressVersionPrimary=null:t._workInProgressVersionSecondary=null}Br.length=0}var Hr=o.ReactCurrentDispatcher,Ur=o.ReactCurrentBatchConfig,Wr=0,Gr=null,Kr=null,qr=null,Jr=!1,Yr=!1,Xr=0,Zr=0;function Qr(){throw Error(a(321))}function $r(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!vn(e[n],t[n]))return!1;return!0}function ei(e,t,n,r,i,o){if(Wr=o,Gr=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Hr.current=e===null||e.memoizedState===null?Li:Ri,e=n(r,i),Yr){o=0;do{if(Yr=!1,Xr=0,25<=o)throw Error(a(301));o+=1,qr=Kr=null,t.updateQueue=null,Hr.current=zi,e=n(r,i)}while(Yr)}if(Hr.current=Ii,t=Kr!==null&&Kr.next!==null,Wr=0,qr=Kr=Gr=null,Jr=!1,t)throw Error(a(300));return e}function ti(){var e=Xr!==0;return Xr=0,e}function ni(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qr===null?Gr.memoizedState=qr=e:qr=qr.next=e,qr}function ri(){if(Kr===null){var e=Gr.alternate;e=e===null?null:e.memoizedState}else e=Kr.next;var t=qr===null?Gr.memoizedState:qr.next;if(t!==null)qr=t,Kr=e;else{if(e===null)throw Error(a(310));Kr=e,e={memoizedState:Kr.memoizedState,baseState:Kr.baseState,baseQueue:Kr.baseQueue,queue:Kr.queue,next:null},qr===null?Gr.memoizedState=qr=e:qr=qr.next=e}return qr}function ii(e,t){return typeof t==`function`?t(e):t}function ai(e){var t=ri(),n=t.queue;if(n===null)throw Error(a(311));n.lastRenderedReducer=e;var r=Kr,i=r.baseQueue,o=n.pending;if(o!==null){if(i!==null){var s=i.next;i.next=o.next,o.next=s}r.baseQueue=i=o,n.pending=null}if(i!==null){o=i.next,r=r.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((Wr&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=r):l=l.next=f,Gr.lanes|=d,Mo|=d}u=u.next}while(u!==null&&u!==o);l===null?s=r:l.next=c,vn(r,t.memoizedState)||(ra=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do o=i.lane,Gr.lanes|=o,Mo|=o,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function oi(e){var t=ri(),n=t.queue;if(n===null)throw Error(a(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do o=e(o,s.action),s=s.next;while(s!==i);vn(o,t.memoizedState)||(ra=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function si(){}function ci(e,t){var n=Gr,r=ri(),i=t(),o=!vn(r.memoizedState,i);if(o&&(r.memoizedState=i,ra=!0),r=r.queue,bi(di.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||qr!==null&&qr.memoizedState.tag&1){if(n.flags|=2048,hi(9,ui.bind(null,n,r,i,t),void 0,null),To===null)throw Error(a(349));Wr&30||li(n,t,i)}return i}function li(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Gr.updateQueue,t===null?(t={lastEffect:null,stores:null},Gr.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ui(e,t,n,r){t.value=n,t.getSnapshot=r,fi(t)&&pi(e)}function di(e,t,n){return n(function(){fi(t)&&pi(e)})}function fi(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!vn(e,n)}catch{return!0}}function pi(e){var t=yr(e,1);t!==null&&Qo(t,e,1,-1)}function mi(e){var t=ni();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ii,lastRenderedState:e},t.queue=e,e=e.dispatch=Mi.bind(null,Gr,e),[t.memoizedState,e]}function hi(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Gr.updateQueue,t===null?(t={lastEffect:null,stores:null},Gr.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function gi(){return ri().memoizedState}function _i(e,t,n,r){var i=ni();Gr.flags|=e,i.memoizedState=hi(1|t,n,void 0,r===void 0?null:r)}function vi(e,t,n,r){var i=ri();r=r===void 0?null:r;var a=void 0;if(Kr!==null){var o=Kr.memoizedState;if(a=o.destroy,r!==null&&$r(r,o.deps)){i.memoizedState=hi(t,n,a,r);return}}Gr.flags|=e,i.memoizedState=hi(1|t,n,a,r)}function yi(e,t){return _i(8390656,8,e,t)}function bi(e,t){return vi(2048,8,e,t)}function xi(e,t){return vi(4,2,e,t)}function Si(e,t){return vi(4,4,e,t)}function Ci(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function wi(e,t,n){return n=n==null?null:n.concat([e]),vi(4,4,Ci.bind(null,t,e),n)}function Ti(){}function Ei(e,t){var n=ri();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&$r(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Di(e,t){var n=ri();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&$r(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Oi(e,t,n){return Wr&21?(vn(n,t)||(n=Qt(),Gr.lanes|=n,Mo|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ra=!0),e.memoizedState=n)}function ki(e,t){var n=F;F=n!==0&&4>n?n:4,e(!0);var r=Ur.transition;Ur.transition={};try{e(!1),t()}finally{F=n,Ur.transition=r}}function Ai(){return ri().memoizedState}function ji(e,t,n){var r=Zo(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Ni(e))Pi(t,n);else if(n=vr(e,t,n,r),n!==null){var i=Xo();Qo(n,e,r,i),Fi(n,t,r)}}function Mi(e,t,n){var r=Zo(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ni(e))Pi(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,vn(s,o)){var c=t.interleaved;c===null?(i.next=i,_r(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=vr(e,t,i,r),n!==null&&(i=Xo(),Qo(n,e,r,i),Fi(n,t,r))}}function Ni(e){var t=e.alternate;return e===Gr||t!==null&&t===Gr}function Pi(e,t){Yr=Jr=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Fi(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nn(e,n)}}var Ii={readContext:hr,useCallback:Qr,useContext:Qr,useEffect:Qr,useImperativeHandle:Qr,useInsertionEffect:Qr,useLayoutEffect:Qr,useMemo:Qr,useReducer:Qr,useRef:Qr,useState:Qr,useDebugValue:Qr,useDeferredValue:Qr,useTransition:Qr,useMutableSource:Qr,useSyncExternalStore:Qr,useId:Qr,unstable_isNewReconciler:!1},Li={readContext:hr,useCallback:function(e,t){return ni().memoizedState=[e,t===void 0?null:t],e},useContext:hr,useEffect:yi,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),_i(4194308,4,Ci.bind(null,t,e),n)},useLayoutEffect:function(e,t){return _i(4194308,4,e,t)},useInsertionEffect:function(e,t){return _i(4,2,e,t)},useMemo:function(e,t){var n=ni();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ni();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ji.bind(null,Gr,e),[r.memoizedState,e]},useRef:function(e){var t=ni();return e={current:e},t.memoizedState=e},useState:mi,useDebugValue:Ti,useDeferredValue:function(e){return ni().memoizedState=e},useTransition:function(){var e=mi(!1),t=e[0];return e=ki.bind(null,e[1]),ni().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Gr,i=ni();if(zn){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),To===null)throw Error(a(349));Wr&30||li(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,yi(di.bind(null,r,o,e),[e]),r.flags|=2048,hi(9,ui.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=ni(),t=To.identifierPrefix;if(zn){var n=Mn,r=jn;n=(r&~(1<<32-Vt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Xr++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Zr++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},Ri={readContext:hr,useCallback:Ei,useContext:hr,useEffect:bi,useImperativeHandle:wi,useInsertionEffect:xi,useLayoutEffect:Si,useMemo:Di,useReducer:ai,useRef:gi,useState:function(){return ai(ii)},useDebugValue:Ti,useDeferredValue:function(e){return Oi(ri(),Kr.memoizedState,e)},useTransition:function(){return[ai(ii)[0],ri().memoizedState]},useMutableSource:si,useSyncExternalStore:ci,useId:Ai,unstable_isNewReconciler:!1},zi={readContext:hr,useCallback:Ei,useContext:hr,useEffect:bi,useImperativeHandle:wi,useInsertionEffect:xi,useLayoutEffect:Si,useMemo:Di,useReducer:oi,useRef:gi,useState:function(){return oi(ii)},useDebugValue:Ti,useDeferredValue:function(e){var t=ri();return Kr===null?t.memoizedState=e:Oi(t,Kr.memoizedState,e)},useTransition:function(){return[oi(ii)[0],ri().memoizedState]},useMutableSource:si,useSyncExternalStore:ci,useId:Ai,unstable_isNewReconciler:!1};function Bi(e,t){if(e&&e.defaultProps){for(var n in t=i({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Vi(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:i({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Hi={isMounted:function(e){return(e=e._reactInternals)?E(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Xo(),i=Zo(e),a=Cr(r,i);a.payload=t,n!=null&&(a.callback=n),t=wr(e,a,i),t!==null&&(Qo(t,e,i,r),Tr(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Xo(),i=Zo(e),a=Cr(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=wr(e,a,i),t!==null&&(Qo(t,e,i,r),Tr(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Xo(),r=Zo(e),i=Cr(n,r);i.tag=2,t!=null&&(i.callback=t),t=wr(e,i,r),t!==null&&(Qo(t,e,r,n),Tr(t,e,r))}};function Ui(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?!Qn(n,r)||!Qn(i,a):!0}function Wi(e,t,n){var r=!1,i=At,a=t.contextType;return typeof a==`object`&&a?a=hr(a):(i=Ft(t)?Nt:jt.current,r=t.contextTypes,a=(r=r!=null)?Pt(e,i):At),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Hi,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function Gi(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&&Hi.enqueueReplaceState(t,t.state,null)}function Ki(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},xr(e);var a=t.contextType;typeof a==`object`&&a?i.context=hr(a):(a=Ft(t)?Nt:jt.current,i.context=Pt(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(Vi(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&Hi.enqueueReplaceState(i,i.state,null),Dr(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function qi(e,t){try{var n=``,r=t;do n+=$n(r),r=r.return;while(r);var i=n}catch(e){i=`
|
|
30
|
-
Error generating stack: `+e.message+`
|
|
31
|
-
`+e.stack}return{value:e,source:t,stack:i,digest:null}}function Ji(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Yi(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Xi=typeof WeakMap==`function`?WeakMap:Map;function Zi(e,t,n){n=Cr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Vo||(Vo=!0,Ho=r),Yi(e,t)},n}function Qi(e,t,n){n=Cr(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Yi(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Yi(e,t),typeof r!=`function`&&(Uo===null?Uo=new Set([this]):Uo.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function $i(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Xi;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)||(i.add(n),e=Ss.bind(null,e,t,n),t.then(e,e))}function ea(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null?!0:t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function ta(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Cr(-1,1),t.tag=2,wr(n,t,1))),n.lanes|=1),e)}var na=o.ReactCurrentOwner,ra=!1;function ia(e,t,n,r){t.child=e===null?ar(t,null,n,r):ir(t,e.child,n,r)}function aa(e,t,n,r,i){n=n.render;var a=t.ref;return mr(t,i),r=ei(e,t,n,r,a,i),n=ti(),e!==null&&!ra?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,wa(e,t,i)):(zn&&n&&Fn(t),t.flags|=1,ia(e,t,r,i),t.child)}function oa(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!As(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,sa(e,t,a,r,i)):(e=Ns(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Qn:n,n(o,r)&&e.ref===t.ref)return wa(e,t,i)}return t.flags|=1,e=Ms(a,r),e.ref=t.ref,e.return=t,t.child=e}function sa(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Qn(a,r)&&e.ref===t.ref)if(ra=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(ra=!0);else return t.lanes=e.lanes,wa(e,t,i)}return ua(e,t,n,r,i)}function ca(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`)if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},kt(ko,Oo),Oo|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,kt(ko,Oo),Oo|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,kt(ko,Oo),Oo|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),kt(ko,Oo),Oo|=r;return ia(e,t,i,n),t.child}function la(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ua(e,t,n,r,i){var a=Ft(n)?Nt:jt.current;return a=Pt(t,a),mr(t,i),n=ei(e,t,n,r,a,i),r=ti(),e!==null&&!ra?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,wa(e,t,i)):(zn&&r&&Fn(t),t.flags|=1,ia(e,t,n,i),t.child)}function da(e,t,n,r,i){if(Ft(n)){var a=!0;zt(t)}else a=!1;if(mr(t,i),t.stateNode===null)L(e,t),Wi(t,n,r),Ki(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=hr(l):(l=Ft(n)?Nt:jt.current,l=Pt(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&Gi(t,o,r,l),br=!1;var f=t.memoizedState;o.state=f,Dr(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Mt.current||br?(typeof u==`function`&&(Vi(t,n,u,r),c=t.memoizedState),(s=br||Ui(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Sr(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:Bi(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=hr(c):(c=Ft(n)?Nt:jt.current,c=Pt(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&Gi(t,o,r,c),br=!1,f=t.memoizedState,o.state=f,Dr(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Mt.current||br?(typeof p==`function`&&(Vi(t,n,p,r),m=t.memoizedState),(l=br||Ui(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return fa(e,t,n,r,a,i)}function fa(e,t,n,r,i,a){la(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&Bt(t,n,!1),wa(e,t,a);r=t.stateNode,na.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=ir(t,e.child,null,a),t.child=ir(t,null,s,a)):ia(e,t,s,a),t.memoizedState=r.state,i&&Bt(t,n,!0),t.child}function pa(e){var t=e.stateNode;t.pendingContext?Lt(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Lt(e,t.context,!1),Pr(e,t.containerInfo)}function ma(e,t,n,r,i){return Yn(),Xn(i),t.flags|=256,ia(e,t,n,r),t.child}var ha={dehydrated:null,treeContext:null,retryLane:0};function ga(e){return{baseLanes:e,cachePool:null,transitions:null}}function _a(e,t,n){var r=t.pendingProps,i=Rr.current,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(i&2)!=0),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),kt(Rr,i&1),e===null)return Gn(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?nt(e)?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=Fs(o,r,0,null),e=Ps(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=ga(n),t.memoizedState=ha,e):va(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return ba(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Ms(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=Ps(a,o,n,null),a.flags|=2):a=Ms(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?ga(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=ha,r}return a=e.child,e=a.sibling,r=Ms(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function va(e,t){return t=Fs({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function ya(e,t,n,r){return r!==null&&Xn(r),ir(t,e.child,null,n),e=va(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ba(e,t,n,r,i,o,s){if(n)return t.flags&256?(t.flags&=-257,r=Ji(Error(a(422))),ya(e,t,s,r)):t.memoizedState===null?(o=r.fallback,i=t.mode,r=Fs({mode:`visible`,children:r.children},i,0,null),o=Ps(o,i,s,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&ir(t,e.child,null,s),t.child.memoizedState=ga(s),t.memoizedState=ha,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return ya(e,t,s,null);if(nt(i))return r=rt(i).digest,o=Error(a(419)),r=Ji(o,r,void 0),ya(e,t,s,r);if(n=(s&e.childLanes)!==0,ra||n){if(r=To,r!==null){switch(s&-s){case 4:i=2;break;case 16:i=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=(i&(r.suspendedLanes|s))===0?i:0,i!==0&&i!==o.retryLane&&(o.retryLane=i,yr(e,i),Qo(r,e,i,-1))}return ds(),r=Ji(Error(a(421))),ya(e,t,s,r)}return tt(i)?(t.flags|=128,t.child=e.child,t=ws.bind(null,e),it(i,t),null):(e=o.treeContext,ge&&(Rn=ct(i),Ln=t,zn=!0,Vn=null,Bn=!1,e!==null&&(On[kn++]=jn,On[kn++]=Mn,On[kn++]=An,jn=e.id,Mn=e.overflow,An=t)),t=va(t,r.children),t.flags|=4096,t)}function xa(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),pr(e.return,t,n)}function Sa(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function Ca(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(ia(e,t,r.children,n),r=Rr.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&xa(e,n,t);else if(e.tag===19)xa(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}r&=1}if(kt(Rr,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&zr(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Sa(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&zr(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Sa(t,!0,n,null,a);break;case`together`:Sa(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function L(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function wa(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Mo|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,n=Ms(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ms(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ta(e,t,n){switch(t.tag){case 3:pa(t),Yn();break;case 5:Ir(t);break;case 1:Ft(t.type)&&zt(t);break;case 4:Pr(t,t.stateNode.containerInfo);break;case 10:dr(t,t.type._context,t.memoizedProps.value);break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(kt(Rr,Rr.current&1),e=wa(e,t,n),e===null?null:e.sibling):_a(e,t,n):(kt(Rr,Rr.current&1),t.flags|=128,null);kt(Rr,Rr.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Ca(e,t,n);t.flags|=128}var i=t.memoizedState;if(i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),kt(Rr,Rr.current),r)break;return null;case 22:case 23:return t.lanes=0,ca(e,t,n)}return wa(e,t,n)}function Ea(e){e.flags|=4}function Da(e,t){if(e!==null&&e.child===t.child)return!0;if(t.flags&16)return!1;for(e=t.child;e!==null;){if(e.flags&12854||e.subtreeFlags&12854)return!1;e=e.sibling}return!0}var Oa,ka,Aa,ja;if(me)Oa=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)oe(e,n.stateNode);else if(n.tag!==4&&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}},ka=function(){},Aa=function(e,t,n,r,i){if(e=e.memoizedProps,e!==r){var a=t.stateNode,o=Nr(Ar.current);n=se(a,n,e,r,i,o),(t.updateQueue=n)&&Ea(t)}},ja=function(e,t,n,r){n!==r&&Ea(t)};else if(he){Oa=function(e,t,n,r){for(var i=t.child;i!==null;){if(i.tag===5){var a=i.stateNode;n&&r&&(a=Xe(a,i.type,i.memoizedProps,i)),oe(e,a)}else if(i.tag===6)a=i.stateNode,n&&r&&(a=Ze(a,i.memoizedProps,i)),oe(e,a);else if(i.tag!==4){if(i.tag===22&&i.memoizedState!==null)a=i.child,a!==null&&(a.return=i),Oa(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}};var Ma=function(e,t,n,r){for(var i=t.child;i!==null;){if(i.tag===5){var a=i.stateNode;n&&r&&(a=Xe(a,i.type,i.memoizedProps,i)),qe(e,a)}else if(i.tag===6)a=i.stateNode,n&&r&&(a=Ze(a,i.memoizedProps,i)),qe(e,a);else if(i.tag!==4){if(i.tag===22&&i.memoizedState!==null)a=i.child,a!==null&&(a.return=i),Ma(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}};ka=function(e,t){var n=t.stateNode;if(!Da(e,t)){e=n.containerInfo;var r=Ke(e);Ma(r,t,!1,!1),n.pendingChildren=r,Ea(t),Je(e,r)}},Aa=function(e,t,n,r,i){var a=e.stateNode,o=e.memoizedProps;if((e=Da(e,t))&&o===r)t.stateNode=a;else{var s=t.stateNode,c=Nr(Ar.current),l=null;o!==r&&(l=se(s,n,o,r,i,c)),e&&l===null?t.stateNode=a:(a=Ge(a,l,n,o,r,t,e,s),N(a,n,r,i,c)&&Ea(t),t.stateNode=a,e?Ea(t):Oa(a,t,!1,!1))}},ja=function(e,t,n,r){n===r?t.stateNode=e.stateNode:(e=Nr(Mr.current),n=Nr(Ar.current),t.stateNode=le(r,e,n,t),Ea(t))}}else ka=function(){},Aa=function(){},ja=function(){};function Na(e,t){if(!zn)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 Pa(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&14680064,r|=i.flags&14680064,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 Fa(e,t,n){var r=t.pendingProps;switch(In(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pa(t),null;case 1:return Ft(t.type)&&It(),Pa(t),null;case 3:return n=t.stateNode,Fr(),Ot(Mt),Ot(jt),Vr(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(qn(t)?Ea(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Vn!==null&&(ns(Vn),Vn=null))),ka(e,t),Pa(t),null;case 5:Lr(t),n=Nr(Mr.current);var i=t.type;if(e!==null&&t.stateNode!=null)Aa(e,t,i,r,n),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(a(166));return Pa(t),null}if(e=Nr(Ar.current),qn(t)){if(!ge)throw Error(a(175));e=lt(t.stateNode,t.type,t.memoizedProps,n,e,t,!Bn),t.updateQueue=e,e!==null&&Ea(t)}else{var o=ae(i,r,n,e,t);Oa(o,t,!1,!1),t.stateNode=o,N(o,i,r,n,e)&&Ea(t)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Pa(t),null;case 6:if(e&&t.stateNode!=null)ja(e,t,e.memoizedProps,r);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=Nr(Mr.current),n=Nr(Ar.current),qn(t)){if(!ge)throw Error(a(176));if(e=t.stateNode,n=t.memoizedProps,(r=ut(e,n,t,!Bn))&&(i=Ln,i!==null))switch(i.tag){case 3:vt(i.stateNode.containerInfo,e,n,(i.mode&1)!=0);break;case 5:yt(i.type,i.memoizedProps,i.stateNode,e,n,(i.mode&1)!=0)}r&&Ea(t)}else t.stateNode=le(r,e,n,t)}return Pa(t),null;case 13:if(Ot(Rr),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(zn&&Rn!==null&&t.mode&1&&!(t.flags&128))Jn(),Yn(),t.flags|=98560,i=!1;else if(i=qn(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(!ge)throw Error(a(344));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));dt(i,t)}else Yn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pa(t),i=!1}else Vn!==null&&(ns(Vn),Vn=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(n=r!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||Rr.current&1?Ao===0&&(Ao=3):ds())),t.updateQueue!==null&&(t.flags|=4),Pa(t),null);case 4:return Fr(),ka(e,t),e===null&&ve(t.stateNode.containerInfo),Pa(t),null;case 10:return fr(t.type._context),Pa(t),null;case 17:return Ft(t.type)&&It(),Pa(t),null;case 19:if(Ot(Rr),i=t.memoizedState,i===null)return Pa(t),null;if(r=(t.flags&128)!=0,o=i.rendering,o===null)if(r)Na(i,!1);else{if(Ao!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=zr(e),o!==null){for(t.flags|=128,Na(i,!1),e=o.updateQueue,e!==null&&(t.updateQueue=e,t.flags|=4),t.subtreeFlags=0,e=n,n=t.child;n!==null;)r=n,i=e,r.flags&=14680066,o=r.alternate,o===null?(r.childLanes=0,r.lanes=i,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=o.childLanes,r.lanes=o.lanes,r.child=o.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=o.memoizedProps,r.memoizedState=o.memoizedState,r.updateQueue=o.updateQueue,r.type=o.type,i=o.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),n=n.sibling;return kt(Rr,Rr.current&1|2),t.child}e=e.sibling}i.tail!==null&&ln()>Ro&&(t.flags|=128,r=!0,Na(i,!1),t.lanes=4194304)}else{if(!r)if(e=zr(o),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,e!==null&&(t.updateQueue=e,t.flags|=4),Na(i,!0),i.tail===null&&i.tailMode===`hidden`&&!o.alternate&&!zn)return Pa(t),null}else 2*ln()-i.renderingStartTime>Ro&&n!==1073741824&&(t.flags|=128,r=!0,Na(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?(Pa(t),null):(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ln(),t.sibling=null,e=Rr.current,kt(Rr,r?e&1|2:e&1),t);case 22:case 23:return ss(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Oo&1073741824&&(Pa(t),me&&t.subtreeFlags&6&&(t.flags|=8192)):Pa(t),null;case 24:return null;case 25:return null}throw Error(a(156,t.tag))}function Ia(e,t){switch(In(t),t.tag){case 1:return Ft(t.type)&&It(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Fr(),Ot(Mt),Ot(jt),Vr(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Lr(t),null;case 13:if(Ot(Rr),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));Yn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ot(Rr),null;case 4:return Fr(),null;case 10:return fr(t.type._context),null;case 22:case 23:return ss(),null;case 24:return null;default:return null}}var La=!1,Ra=!1,za=typeof WeakSet==`function`?WeakSet:Set,R=null;function Ba(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){xs(e,t,n)}else n.current=null}function Va(e,t,n){try{n()}catch(n){xs(e,t,n)}}var Ha=!1;function Ua(e,t){for(re(e.containerInfo),R=t;R!==null;)if(e=R,t=e.child,e.subtreeFlags&1028&&t!==null)t.return=e,R=t;else for(;R!==null;){e=R;try{var n=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(n!==null){var r=n.memoizedProps,i=n.memoizedState,o=e.stateNode;o.__reactInternalSnapshotBeforeUpdate=o.getSnapshotBeforeUpdate(e.elementType===e.type?r:Bi(e.type,r),i)}break;case 3:me&&We(e.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(t){xs(e,e.return,t)}if(t=e.sibling,t!==null){t.return=e.return,R=t;break}R=e.return}return n=Ha,Ha=!1,n}function z(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&Va(t,n,a)}i=i.next}while(i!==r)}}function Wa(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ga(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=ne(n);break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Ka(e){var t=e.alternate;t!==null&&(e.alternate=null,Ka(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&be(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 qa(e){return e.tag===5||e.tag===3||e.tag===4}function Ja(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||qa(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.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 Ya(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?Ie(n,e,t):Me(n,e);else if(r!==4&&(e=e.child,e!==null))for(Ya(e,t,n),e=e.sibling;e!==null;)Ya(e,t,n),e=e.sibling}function Xa(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?Fe(n,e,t):je(n,e);else if(r!==4&&(e=e.child,e!==null))for(Xa(e,t,n),e=e.sibling;e!==null;)Xa(e,t,n),e=e.sibling}var Za=null,Qa=!1;function $a(e,t,n){for(n=n.child;n!==null;)eo(e,t,n),n=n.sibling}function eo(e,t,n){if(hn&&typeof hn.onCommitFiberUnmount==`function`)try{hn.onCommitFiberUnmount(mn,n)}catch{}switch(n.tag){case 5:Ra||Ba(n,t);case 6:if(me){var r=Za,i=Qa;Za=null,$a(e,t,n),Za=r,Qa=i,Za!==null&&(Qa?Re(Za,n.stateNode):Le(Za,n.stateNode))}else $a(e,t,n);break;case 18:me&&Za!==null&&(Qa?gt(Za,n.stateNode):ht(Za,n.stateNode));break;case 4:me?(r=Za,i=Qa,Za=n.stateNode.containerInfo,Qa=!0,$a(e,t,n),Za=r,Qa=i):(he&&(r=n.stateNode.containerInfo,i=Ke(r),Ye(r,i)),$a(e,t,n));break;case 0:case 11:case 14:case 15:if(!Ra&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&Va(n,t,o),i=i.next}while(i!==r)}$a(e,t,n);break;case 1:if(!Ra&&(Ba(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){xs(n,t,e)}$a(e,t,n);break;case 21:$a(e,t,n);break;case 22:n.mode&1?(Ra=(r=Ra)||n.memoizedState!==null,$a(e,t,n),Ra=r):$a(e,t,n);break;default:$a(e,t,n)}}function to(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new za),t.forEach(function(t){var r=Ts.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function no(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var o=e,s=t;if(me){var c=s;a:for(;c!==null;){switch(c.tag){case 5:Za=c.stateNode,Qa=!1;break a;case 3:Za=c.stateNode.containerInfo,Qa=!0;break a;case 4:Za=c.stateNode.containerInfo,Qa=!0;break a}c=c.return}if(Za===null)throw Error(a(160));eo(o,s,i),Za=null,Qa=!1}else eo(o,s,i);var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(e){xs(i,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)ro(t,e),t=t.sibling}function ro(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(no(t,e),io(e),r&4){try{z(3,e,e.return),Wa(3,e)}catch(t){xs(e,e.return,t)}try{z(5,e,e.return)}catch(t){xs(e,e.return,t)}}break;case 1:no(t,e),io(e),r&512&&n!==null&&Ba(n,n.return);break;case 5:if(no(t,e),io(e),r&512&&n!==null&&Ba(n,n.return),me){if(e.flags&32){var i=e.stateNode;try{ze(i)}catch(t){xs(e,e.return,t)}}if(r&4&&(i=e.stateNode,i!=null)){var o=e.memoizedProps;if(n=n===null?o:n.memoizedProps,r=e.type,t=e.updateQueue,e.updateQueue=null,t!==null)try{Pe(i,t,r,n,o,e)}catch(t){xs(e,e.return,t)}}}break;case 6:if(no(t,e),io(e),r&4&&me){if(e.stateNode===null)throw Error(a(162));i=e.stateNode,o=e.memoizedProps,n=n===null?o:n.memoizedProps;try{P(i,n,o)}catch(t){xs(e,e.return,t)}}break;case 3:if(no(t,e),io(e),r&4){if(me&&ge&&n!==null&&n.memoizedState.isDehydrated)try{pt(t.containerInfo)}catch(t){xs(e,e.return,t)}if(he){i=t.containerInfo,o=t.pendingChildren;try{Ye(i,o)}catch(t){xs(e,e.return,t)}}}break;case 4:if(no(t,e),io(e),r&4&&he){o=e.stateNode,i=o.containerInfo,o=o.pendingChildren;try{Ye(i,o)}catch(t){xs(e,e.return,t)}}break;case 13:no(t,e),io(e),i=e.child,i.flags&8192&&(o=i.memoizedState!==null,i.stateNode.isHidden=o,!o||i.alternate!==null&&i.alternate.memoizedState!==null||(Lo=ln())),r&4&&to(e);break;case 22:var s=n!==null&&n.memoizedState!==null;if(e.mode&1?(Ra=(n=Ra)||s,no(t,e),Ra=n):no(t,e),io(e),r&8192){if(n=e.memoizedState!==null,(e.stateNode.isHidden=n)&&!s&&e.mode&1)for(R=e,r=e.child;r!==null;){for(t=R=r;R!==null;){s=R;var c=s.child;switch(s.tag){case 0:case 11:case 14:case 15:z(4,s,s.return);break;case 1:Ba(s,s.return);var l=s.stateNode;if(typeof l.componentWillUnmount==`function`){var u=s,d=s.return;try{var f=u;l.props=f.memoizedProps,l.state=f.memoizedState,l.componentWillUnmount()}catch(e){xs(u,d,e)}}break;case 5:Ba(s,s.return);break;case 22:if(s.memoizedState!==null){co(t);continue}}c===null?co(t):(c.return=s,R=c)}r=r.sibling}if(me){a:if(r=null,me)for(t=e;;){if(t.tag===5){if(r===null){r=t;try{i=t.stateNode,n?Be(i):He(t.stateNode,t.memoizedProps)}catch(t){xs(e,e.return,t)}}}else if(t.tag===6){if(r===null)try{o=t.stateNode,n?Ve(o):Ue(o,t.memoizedProps)}catch(t){xs(e,e.return,t)}}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;r===t&&(r=null),t=t.return}r===t&&(r=null),t.sibling.return=t.return,t=t.sibling}}}break;case 19:no(t,e),io(e),r&4&&to(e);break;case 21:break;default:no(t,e),io(e)}}function io(e){var t=e.flags;if(t&2){try{if(me){b:{for(var n=e.return;n!==null;){if(qa(n)){var r=n;break b}n=n.return}throw Error(a(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(ze(i),r.flags&=-33),Xa(e,Ja(e),i);break;case 3:case 4:var o=r.stateNode.containerInfo;Ya(e,Ja(e),o);break;default:throw Error(a(161))}}}catch(t){xs(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ao(e,t,n){R=e,oo(e,t,n)}function oo(e,t,n){for(var r=(e.mode&1)!=0;R!==null;){var i=R,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||La;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||Ra;s=La;var l=Ra;if(La=o,(Ra=c)&&!l)for(R=i;R!==null;)o=R,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?lo(i):(c.return=o,R=c);for(;a!==null;)R=a,oo(a,t,n),a=a.sibling;R=i,La=s,Ra=l}so(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,R=a):so(e,t,n)}}function so(e){for(;R!==null;){var t=R;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Ra||Wa(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Ra)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:Bi(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&Or(t,o,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=ne(t.child.stateNode);break;case 1:n=t.child.stateNode}Or(t,s,n)}break;case 5:var c=t.stateNode;n===null&&t.flags&4&&Ne(c,t.type,t.memoizedProps,t);break;case 6:break;case 4:break;case 12:break;case 13:if(ge&&t.memoizedState===null){var l=t.alternate;if(l!==null){var u=l.memoizedState;if(u!==null){var d=u.dehydrated;d!==null&&mt(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(a(163))}Ra||t.flags&512&&Ga(t)}catch(e){xs(t,t.return,e)}}if(t===e){R=null;break}if(n=t.sibling,n!==null){n.return=t.return,R=n;break}R=t.return}}function co(e){for(;R!==null;){var t=R;if(t===e){R=null;break}var n=t.sibling;if(n!==null){n.return=t.return,R=n;break}R=t.return}}function lo(e){for(;R!==null;){var t=R;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Wa(4,t)}catch(e){xs(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){xs(t,i,e)}}var a=t.return;try{Ga(t)}catch(e){xs(t,a,e)}break;case 5:var o=t.return;try{Ga(t)}catch(e){xs(t,o,e)}}}catch(e){xs(t,t.return,e)}if(t===e){R=null;break}var s=t.sibling;if(s!==null){s.return=t.return,R=s;break}R=t.return}}var uo=0,fo=1,po=2,mo=3,ho=4;if(typeof Symbol==`function`&&Symbol.for){var B=Symbol.for;uo=B(`selector.component`),fo=B(`selector.has_pseudo_class`),po=B(`selector.role`),mo=B(`selector.test_id`),ho=B(`selector.text`)}function go(e){var t=_e(e);if(t!=null){if(typeof t.memoizedProps[`data-testname`]!=`string`)throw Error(a(364));return t}if(e=we(e),e===null)throw Error(a(362));return e.stateNode.current}function _o(e,t){switch(t.$$typeof){case uo:if(e.type===t.value)return!0;break;case fo:a:{t=t.value,e=[e,0];for(var n=0;n<e.length;){var r=e[n++],i=e[n++],o=t[i];if(r.tag!==5||!De(r)){for(;o!=null&&_o(r,o);)i++,o=t[i];if(i===t.length){t=!0;break a}else for(r=r.child;r!==null;)e.push(r,i),r=r.sibling}}t=!1}return t;case po:if(e.tag===5&&Oe(e.stateNode,t.value))return!0;break;case ho:if((e.tag===5||e.tag===6)&&(e=Ee(e),e!==null&&0<=e.indexOf(t.value)))return!0;break;case mo:if(e.tag===5&&(e=e.memoizedProps[`data-testname`],typeof e==`string`&&e.toLowerCase()===t.value.toLowerCase()))return!0;break;default:throw Error(a(365))}return!1}function vo(e){switch(e.$$typeof){case uo:return`<`+(w(e.value)||`Unknown`)+`>`;case fo:return`:has(`+(vo(e)||``)+`)`;case po:return`[role="`+e.value+`"]`;case ho:return`"`+e.value+`"`;case mo:return`[data-testname="`+e.value+`"]`;default:throw Error(a(365))}}function yo(e,t){var n=[];e=[e,0];for(var r=0;r<e.length;){var i=e[r++],a=e[r++],o=t[a];if(i.tag!==5||!De(i)){for(;o!=null&&_o(i,o);)a++,o=t[a];if(a===t.length)n.push(i);else for(i=i.child;i!==null;)e.push(i,a),i=i.sibling}}return n}function bo(e,t){if(!Ce)throw Error(a(363));e=go(e),e=yo(e,t),t=[],e=Array.from(e);for(var n=0;n<e.length;){var r=e[n++];if(r.tag===5)De(r)||t.push(r.stateNode);else for(r=r.child;r!==null;)e.push(r),r=r.sibling}return t}var xo=Math.ceil,So=o.ReactCurrentDispatcher,Co=o.ReactCurrentOwner,wo=o.ReactCurrentBatchConfig,V=0,To=null,Eo=null,Do=0,Oo=0,ko=Dt(0),Ao=0,jo=null,Mo=0,No=0,Po=0,Fo=null,Io=null,Lo=0,Ro=1/0,zo=null;function Bo(){Ro=ln()+500}var Vo=!1,Ho=null,Uo=null,Wo=!1,Go=null,Ko=0,qo=0,Jo=null,Yo=-1,H=0;function Xo(){return V&6?ln():Yo===-1?Yo=ln():Yo}function Zo(e){return e.mode&1?V&2&&Do!==0?Do&-Do:Zn.transition===null?(e=F,e===0?ye():e):(H===0&&(H=Qt()),H):1}function Qo(e,t,n,r){if(50<qo)throw qo=0,Jo=null,Error(a(185));en(e,n,r),(!(V&2)||e!==To)&&(e===To&&(!(V&2)&&(No|=n),Ao===4&&is(e,Do)),$o(e,r),n===1&&V===0&&!(t.mode&1)&&(Bo(),I&&Cn()))}function $o(e,t){var n=e.callbackNode;Xt(e,t);var r=Jt(e,e===To?Do:0);if(r===0)n!==null&&on(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&on(n),t===1)e.tag===0?Sn(as.bind(null,e)):xn(as.bind(null,e)),xe?Se(function(){!(V&6)&&Cn()}):an(un,Cn),n=null;else{switch(rn(r)){case 1:n=un;break;case 4:n=dn;break;case 16:n=fn;break;case 536870912:n=pn;break;default:n=fn}n=Ds(n,es.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function es(e,t){if(Yo=-1,H=0,V&6)throw Error(a(327));var n=e.callbackNode;if(ys()&&e.callbackNode!==n)return null;var r=Jt(e,e===To?Do:0);if(r===0)return null;if(r&30||(r&e.expiredLanes)!==0||t)t=fs(e,r);else{t=r;var i=V;V|=2;var o=us();(To!==e||Do!==t)&&(zo=null,Bo(),cs(e,t));do try{ms();break}catch(t){ls(e,t)}while(1);ur(),So.current=o,V=i,Eo===null?(To=null,Do=0,t=Ao):t=0}if(t!==0){if(t===2&&(i=Zt(e),i!==0&&(r=i,t=ts(e,i))),t===1)throw n=jo,cs(e,0),is(e,r),$o(e,ln()),n;if(t===6)is(e,r);else{if(i=e.current.alternate,!(r&30)&&!rs(i)&&(t=fs(e,r),t===2&&(o=Zt(e),o!==0&&(r=o,t=ts(e,o))),t===1))throw n=jo,cs(e,0),is(e,r),$o(e,ln()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(a(345));case 2:_s(e,Io,zo);break;case 3:if(is(e,r),(r&130023424)===r&&(t=Lo+500-ln(),10<t)){if(Jt(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Xo(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=ue(_s.bind(null,e,Io,zo),t);break}_s(e,Io,zo);break;case 4:if(is(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var s=31-Vt(r);o=1<<s,s=t[s],s>i&&(i=s),r&=~o}if(r=i,r=ln()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*xo(r/1960))-r,10<r){e.timeoutHandle=ue(_s.bind(null,e,Io,zo),r);break}_s(e,Io,zo);break;case 5:_s(e,Io,zo);break;default:throw Error(a(329))}}}return $o(e,ln()),e.callbackNode===n?es.bind(null,e):null}function ts(e,t){var n=Fo;return e.current.memoizedState.isDehydrated&&(cs(e,t).flags|=256),e=fs(e,t),e!==2&&(t=Io,Io=n,t!==null&&ns(t)),e}function ns(e){Io===null?Io=e:Io.push.apply(Io,e)}function rs(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(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(!vn(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 is(e,t){for(t&=~Po,t&=~No,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Vt(t),r=1<<n;e[n]=-1,t&=~r}}function as(e){if(V&6)throw Error(a(327));ys();var t=Jt(e,0);if(!(t&1))return $o(e,ln()),null;var n=fs(e,t);if(e.tag!==0&&n===2){var r=Zt(e);r!==0&&(t=r,n=ts(e,r))}if(n===1)throw n=jo,cs(e,0),is(e,t),$o(e,ln()),n;if(n===6)throw Error(a(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,_s(e,Io,zo),$o(e,ln()),null}function os(e){Go!==null&&Go.tag===0&&!(V&6)&&ys();var t=V;V|=1;var n=wo.transition,r=F;try{if(wo.transition=null,F=1,e)return e()}finally{F=r,wo.transition=n,V=t,!(V&6)&&Cn()}}function ss(){Oo=ko.current,Ot(ko)}function cs(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==fe&&(e.timeoutHandle=fe,de(n)),Eo!==null)for(n=Eo.return;n!==null;){var r=n;switch(In(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&It();break;case 3:Fr(),Ot(Mt),Ot(jt),Vr();break;case 5:Lr(r);break;case 4:Fr();break;case 13:Ot(Rr);break;case 19:Ot(Rr);break;case 10:fr(r.type._context);break;case 22:case 23:ss()}n=n.return}if(To=e,Eo=e=Ms(e.current,null),Do=Oo=t,Ao=0,jo=null,Po=No=Mo=0,Io=Fo=null,gr!==null){for(t=0;t<gr.length;t++)if(n=gr[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}gr=null}return e}function ls(e,t){do{var n=Eo;try{if(ur(),Hr.current=Ii,Jr){for(var r=Gr.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Jr=!1}if(Wr=0,qr=Kr=Gr=null,Yr=!1,Xr=0,Co.current=null,n===null||n.return===null){Ao=1,jo=t,Eo=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Do,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=ea(s);if(m!==null){m.flags&=-257,ta(m,s,c,o,t),m.mode&1&&$i(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}else{if(!(t&1)){$i(o,u,t),ds();break a}l=Error(a(426))}}else if(zn&&c.mode&1){var _=ea(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),ta(_,s,c,o,t),Xn(qi(l,c));break a}}o=l=qi(l,c),Ao!==4&&(Ao=2),Fo===null?Fo=[o]:Fo.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Zi(o,l,t);Er(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(Uo===null||!Uo.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Qi(o,c,t);Er(o,x);break a}}o=o.return}while(o!==null)}gs(n)}catch(e){t=e,Eo===n&&n!==null&&(Eo=n=n.return);continue}break}while(1)}function us(){var e=So.current;return So.current=Ii,e===null?Ii:e}function ds(){(Ao===0||Ao===3||Ao===2)&&(Ao=4),To===null||!(Mo&268435455)&&!(No&268435455)||is(To,Do)}function fs(e,t){var n=V;V|=2;var r=us();(To!==e||Do!==t)&&(zo=null,cs(e,t));do try{ps();break}catch(t){ls(e,t)}while(1);if(ur(),V=n,So.current=r,Eo!==null)throw Error(a(261));return To=null,Do=0,Ao}function ps(){for(;Eo!==null;)hs(Eo)}function ms(){for(;Eo!==null&&!sn();)hs(Eo)}function hs(e){var t=Es(e.alternate,e,Oo);e.memoizedProps=e.pendingProps,t===null?gs(e):Eo=t,Co.current=null}function gs(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Ia(n,t),n!==null){n.flags&=32767,Eo=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ao=6,Eo=null;return}}else if(n=Fa(n,t,Oo),n!==null){Eo=n;return}if(t=t.sibling,t!==null){Eo=t;return}Eo=t=e}while(t!==null);Ao===0&&(Ao=5)}function _s(e,t,n){var r=F,i=wo.transition;try{wo.transition=null,F=1,vs(e,t,n,r)}finally{wo.transition=i,F=r}return null}function vs(e,t,n,r){do ys();while(Go!==null);if(V&6)throw Error(a(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(a(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(tn(e,o),e===To&&(Eo=To=null,Do=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Wo||(Wo=!0,Ds(fn,function(){return ys(),null})),o=(n.flags&15990)!=0,n.subtreeFlags&15990||o){o=wo.transition,wo.transition=null;var s=F;F=1;var c=V;V|=4,Co.current=null,Ua(e,n),ro(n,e),ie(e.containerInfo),e.current=n,ao(n,e,i),cn(),V=c,F=s,wo.transition=o}else e.current=n;if(Wo&&(Wo=!1,Go=e,Ko=i),o=e.pendingLanes,o===0&&(Uo=null),gn(n.stateNode,r),$o(e,ln()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Vo)throw Vo=!1,e=Ho,Ho=null,e;return Ko&1&&e.tag!==0&&ys(),o=e.pendingLanes,o&1?e===Jo?qo++:(qo=0,Jo=e):qo=0,Cn(),null}function ys(){if(Go!==null){var e=rn(Ko),t=wo.transition,n=F;try{if(wo.transition=null,F=16>e?16:e,Go===null)var r=!1;else{if(e=Go,Go=null,Ko=0,V&6)throw Error(a(331));var i=V;for(V|=4,R=e.current;R!==null;){var o=R,s=o.child;if(R.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(R=u;R!==null;){var d=R;switch(d.tag){case 0:case 11:case 15:z(8,d,o)}var f=d.child;if(f!==null)f.return=d,R=f;else for(;R!==null;){d=R;var p=d.sibling,m=d.return;if(Ka(d),d===u){R=null;break}if(p!==null){p.return=m,R=p;break}R=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}R=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,R=s;else b:for(;R!==null;){if(o=R,o.flags&2048)switch(o.tag){case 0:case 11:case 15:z(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,R=v;break b}R=o.return}}var y=e.current;for(R=y;R!==null;){s=R;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,R=b;else b:for(s=y;R!==null;){if(c=R,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Wa(9,c)}}catch(e){xs(c,c.return,e)}if(c===s){R=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,R=x;break b}R=c.return}}if(V=i,Cn(),hn&&typeof hn.onPostCommitFiberRoot==`function`)try{hn.onPostCommitFiberRoot(mn,e)}catch{}r=!0}return r}finally{F=n,wo.transition=t}}return!1}function bs(e,t,n){t=qi(n,t),t=Zi(e,t,1),e=wr(e,t,1),t=Xo(),e!==null&&(en(e,1,t),$o(e,t))}function xs(e,t,n){if(e.tag===3)bs(e,e,n);else for(;t!==null;){if(t.tag===3){bs(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Uo===null||!Uo.has(r))){e=qi(n,e),e=Qi(t,e,1),t=wr(t,e,1),e=Xo(),t!==null&&(en(t,1,e),$o(t,e));break}}t=t.return}}function Ss(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Xo(),e.pingedLanes|=e.suspendedLanes&n,To===e&&(Do&n)===n&&(Ao===4||Ao===3&&(Do&130023424)===Do&&500>ln()-Lo?cs(e,0):Po|=n),$o(e,t)}function Cs(e,t){t===0&&(e.mode&1?(t=Kt,Kt<<=1,!(Kt&130023424)&&(Kt=4194304)):t=1);var n=Xo();e=yr(e,t),e!==null&&(en(e,t,n),$o(e,n))}function ws(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Cs(e,n)}function Ts(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(a(314))}r!==null&&r.delete(t),Cs(e,n)}var Es=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Mt.current)ra=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return ra=!1,Ta(e,t,n);ra=!!(e.flags&131072)}else ra=!1,zn&&t.flags&1048576&&Pn(t,Dn,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;L(e,t),e=t.pendingProps;var i=Pt(t,jt.current);mr(t,n),i=ei(null,t,r,e,i,n);var o=ti();return t.flags|=1,typeof i==`object`&&i&&typeof i.render==`function`&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ft(r)?(o=!0,zt(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,xr(t),i.updater=Hi,t.stateNode=i,i._reactInternals=t,Ki(t,r,e,n),t=fa(null,t,r,!0,o,n)):(t.tag=0,zn&&o&&Fn(t),ia(null,t,i,n),t=t.child),t;case 16:r=t.elementType;a:{switch(L(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=js(r),e=Bi(r,e),i){case 0:t=ua(null,t,r,e,n);break a;case 1:t=da(null,t,r,e,n);break a;case 11:t=aa(null,t,r,e,n);break a;case 14:t=oa(null,t,r,Bi(r.type,e),n);break a}throw Error(a(306,r,``))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bi(r,i),ua(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bi(r,i),da(e,t,r,i,n);case 3:a:{if(pa(t),e===null)throw Error(a(387));r=t.pendingProps,o=t.memoizedState,i=o.element,Sr(e,t),Dr(t,r,null,n);var s=t.memoizedState;if(r=s.element,ge&&o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=qi(Error(a(423)),t),t=ma(e,t,r,n,i);break a}else if(r!==i){i=qi(Error(a(424)),t),t=ma(e,t,r,n,i);break a}else for(ge&&(Rn=st(t.stateNode.containerInfo),Ln=t,zn=!0,Vn=null,Bn=!1),n=ar(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Yn(),r===i){t=wa(e,t,n);break a}ia(e,t,r,n)}t=t.child}return t;case 5:return Ir(t),e===null&&Gn(t),r=t.type,i=t.pendingProps,o=e===null?null:e.memoizedProps,s=i.children,ce(r,i)?s=null:o!==null&&ce(r,o)&&(t.flags|=32),la(e,t),ia(e,t,s,n),t.child;case 6:return e===null&&Gn(t),null;case 13:return _a(e,t,n);case 4:return Pr(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ir(t,null,r,n):ia(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bi(r,i),aa(e,t,r,i,n);case 7:return ia(e,t,t.pendingProps,n),t.child;case 8:return ia(e,t,t.pendingProps.children,n),t.child;case 12:return ia(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,s=i.value,dr(t,r,s),o!==null)if(vn(o.value,s)){if(o.children===i.children&&!Mt.current){t=wa(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=Cr(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),pr(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(a(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),pr(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}ia(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,mr(t,n),i=hr(i),r=r(i),t.flags|=1,ia(e,t,r,n),t.child;case 14:return r=t.type,i=Bi(r,t.pendingProps),i=Bi(r.type,i),oa(e,t,r,i,n);case 15:return sa(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Bi(r,i),L(e,t),t.tag=1,Ft(r)?(e=!0,zt(t)):e=!1,mr(t,n),Wi(t,r,i),Ki(t,r,i,n),fa(null,t,r,!0,e,n);case 19:return Ca(e,t,n);case 22:return ca(e,t,n)}throw Error(a(156,t.tag))};function Ds(e,t){return an(e,t)}function Os(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.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 ks(e,t,n,r){return new Os(e,t,n,r)}function As(e){return e=e.prototype,!(!e||!e.isReactComponent)}function js(e){if(typeof e==`function`)return+!!As(e);if(e!=null){if(e=e.$$typeof,e===g)return 11;if(e===y)return 14}return 2}function Ms(e,t){var n=e.alternate;return n===null?(n=ks(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&14680064,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}function Ns(e,t,n,r,i,o){var s=2;if(r=e,typeof e==`function`)As(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case l:return Ps(n.children,i,o,t);case u:s=8,i|=8;break;case f:return e=ks(12,n,t,i|2),e.elementType=f,e.lanes=o,e;case _:return e=ks(13,n,t,i),e.elementType=_,e.lanes=o,e;case v:return e=ks(19,n,t,i),e.elementType=v,e.lanes=o,e;case x:return Fs(n,i,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case m:s=10;break a;case h:s=9;break a;case g:s=11;break a;case y:s=14;break a;case b:s=16,r=null;break a}throw Error(a(130,e==null?e:typeof e,``))}return t=ks(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function Ps(e,t,n,r){return e=ks(7,e,r,t),e.lanes=n,e}function Fs(e,t,n,r){return e=ks(22,e,r,t),e.elementType=x,e.lanes=n,e.stateNode={isHidden:!1},e}function Is(e,t,n){return e=ks(6,e,null,t),e.lanes=n,e}function Ls(e,t,n){return t=ks(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Rs(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=fe,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=$t(0),this.expirationTimes=$t(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$t(0),this.identifierPrefix=r,this.onRecoverableError=i,ge&&(this.mutableSourceEagerHydrationData=null)}function zs(e,t,n,r,i,a,o,s,c){return e=new Rs(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=ks(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},xr(a),e}function Bs(e){if(!e)return At;e=e._reactInternals;a:{if(E(e)!==e||e.tag!==1)throw Error(a(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(Ft(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(a(171))}if(e.tag===1){var n=e.type;if(Ft(n))return Rt(e,n,t)}return t}function Vs(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(a(188)):(e=Object.keys(e).join(`,`),Error(a(268,e)));return e=O(t),e===null?null:e.stateNode}function Hs(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Us(e,t){Hs(e,t),(e=e.alternate)&&Hs(e,t)}function Ws(e){return e=O(e),e===null?null:e.stateNode}function Gs(){return null}return t.attemptContinuousHydration=function(e){if(e.tag===13){var t=yr(e,134217728);t!==null&&Qo(t,e,134217728,Xo()),Us(e,134217728)}},t.attemptDiscreteHydration=function(e){if(e.tag===13){var t=yr(e,1);t!==null&&Qo(t,e,1,Xo()),Us(e,1)}},t.attemptHydrationAtCurrentPriority=function(e){if(e.tag===13){var t=Zo(e),n=yr(e,t);n!==null&&Qo(n,e,t,Xo()),Us(e,t)}},t.attemptSynchronousHydration=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=qt(t.pendingLanes);n!==0&&(nn(t,n|1),$o(t,ln()),!(V&6)&&(Bo(),Cn()))}break;case 13:os(function(){var t=yr(e,1);t!==null&&Qo(t,e,1,Xo())}),Us(e,1)}},t.batchedUpdates=function(e,t){var n=V;V|=1;try{return e(t)}finally{V=n,V===0&&(Bo(),I&&Cn())}},t.createComponentSelector=function(e){return{$$typeof:uo,value:e}},t.createContainer=function(e,t,n,r,i,a,o){return zs(e,t,!1,null,n,r,i,a,o)},t.createHasPseudoClassSelector=function(e){return{$$typeof:fo,value:e}},t.createHydrationContainer=function(e,t,n,r,i,a,o,s,c){return e=zs(n,r,!0,e,i,a,o,s,c),e.context=Bs(null),n=e.current,r=Xo(),i=Zo(n),a=Cr(r,i),a.callback=t??null,wr(n,a,i),e.current.lanes=i,en(e,i,r),$o(e,r),e},t.createPortal=function(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}},t.createRoleSelector=function(e){return{$$typeof:po,value:e}},t.createTestNameSelector=function(e){return{$$typeof:mo,value:e}},t.createTextSelector=function(e){return{$$typeof:ho,value:e}},t.deferredUpdates=function(e){var t=F,n=wo.transition;try{return wo.transition=null,F=16,e()}finally{F=t,wo.transition=n}},t.discreteUpdates=function(e,t,n,r,i){var a=F,o=wo.transition;try{return wo.transition=null,F=1,e(t,n,r,i)}finally{F=a,wo.transition=o,V===0&&Bo()}},t.findAllNodes=bo,t.findBoundingRects=function(e,t){if(!Ce)throw Error(a(363));t=bo(e,t),e=[];for(var n=0;n<t.length;n++)e.push(Te(t[n]));for(t=e.length-1;0<t;t--){n=e[t];for(var r=n.x,i=r+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(r>=u&&o>=f&&i<=d&&s<=p){e.splice(t,1);break}else if(!(r!==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}else if(!(o!==f||n.height!==l.height||d<r||u>i)){u>r&&(l.width+=u-r,l.x=r),d<i&&(l.width=i-u),e.splice(t,1);break}}}return e},t.findHostInstance=Vs,t.findHostInstanceWithNoPortals=function(e){return e=ee(e),e=e===null?null:A(e),e===null?null:e.stateNode},t.findHostInstanceWithWarning=function(e){return Vs(e)},t.flushControlled=function(e){var t=V;V|=1;var n=wo.transition,r=F;try{wo.transition=null,F=1,e()}finally{F=r,wo.transition=n,V=t,V===0&&(Bo(),Cn())}},t.flushPassiveEffects=ys,t.flushSync=os,t.focusWithin=function(e,t){if(!Ce)throw Error(a(363));for(e=go(e),t=yo(e,t),t=Array.from(t),e=0;e<t.length;){var n=t[e++];if(!De(n)){if(n.tag===5&&ke(n.stateNode))return!0;for(n=n.child;n!==null;)t.push(n),n=n.sibling}}return!1},t.getCurrentUpdatePriority=function(){return F},t.getFindAllNodesFailureDescription=function(e,t){if(!Ce)throw Error(a(363));var n=0,r=[];e=[go(e),0];for(var i=0;i<e.length;){var o=e[i++],s=e[i++],c=t[s];if((o.tag!==5||!De(o))&&(_o(o,c)&&(r.push(vo(c)),s++,s>n&&(n=s)),s<t.length))for(o=o.child;o!==null;)e.push(o,s),o=o.sibling}if(n<t.length){for(e=[];n<t.length;n++)e.push(vo(t[n]));return`findAllNodes was able to match part of the selector:
|
|
32
|
-
`+(r.join(` > `)+`
|
|
33
|
-
|
|
34
|
-
No matching component was found for:
|
|
35
|
-
`)+e.join(` > `)}return null},t.getPublicRootInstance=function(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return ne(e.child.stateNode);default:return e.child.stateNode}},t.injectIntoDevTools=function(e){if(e={bundleType:e.bundleType,version:e.version,rendererPackageName:e.rendererPackageName,rendererConfig:e.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:o.ReactCurrentDispatcher,findHostInstanceByFiber:Ws,findFiberByHostInstance:e.findFiberByHostInstance||Gs,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1`},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{mn=t.inject(e),hn=t}catch{}e=!!t.checkDCE}}return e},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(e,t,n,r){if(!Ce)throw Error(a(363));e=bo(e,t);var i=Ae(e,n,r).disconnect;return{disconnect:function(){i()}}},t.registerMutableSourceForHydration=function(e,t){var n=t._getVersion;n=n(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,n]:e.mutableSourceEagerHydrationData.push(t,n)},t.runWithPriority=function(e,t){var n=F;try{return F=e,t()}finally{F=n}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(e,t,n,r){var i=t.current,a=Xo(),o=Zo(i);return n=Bs(n),t.context===null?t.context=n:t.pendingContext=n,t=Cr(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=wr(i,t,o),e!==null&&(Qo(e,i,o,a),Tr(e,i,o)),o},t}})),zu=o(((e,t)=>{t.exports=Ru()})),Bu=o((e=>{e.DefaultEventPriority=16,e.LegacyRoot=0})),Vu=o(((e,t)=>{t.exports=Bu()})),Hu=l(zu()),Uu=Vu(),Wu={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0},Gu=!1,Ku=!1,qu=`.react-konva-event`,Ju=!1,Yu=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.
|
|
36
|
-
Position of a node will be changed during drag&drop, so you should update state of the react app as well.
|
|
37
|
-
Consider to add onDragMove or onDragEnd events.
|
|
38
|
-
For more info see: https://github.com/konvajs/react-konva/issues/256
|
|
39
|
-
`,Xu=`ReactKonva: You are using "zIndex" attribute for a Konva node.
|
|
40
|
-
react-konva may get confused with ordering. Just define correct order of elements in your render function of a component.
|
|
41
|
-
For more info see: https://github.com/konvajs/react-konva/issues/194
|
|
42
|
-
`,Zu={};function Qu(e,t,n=Zu){if(!Gu&&`zIndex`in t&&(console.warn(Xu),Gu=!0),!Ku&&t.draggable){var r=t.x!==void 0||t.y!==void 0,i=t.onDragEnd||t.onDragMove;r&&!i&&(console.warn(Yu),Ku=!0)}for(var a in n)if(!Wu[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,n[a])}t.hasOwnProperty(a)||e.setAttr(a,void 0)}var l=Ju||t._useStrictMode,u={},d=!1;let f={};for(var a in t)if(!Wu[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),$u(e)),f)e.on(c+qu,f[c])}function $u(e){if(!L.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}var ed=s({appendChild:()=>bd,appendChildToContainer:()=>xd,appendInitialChild:()=>id,cancelTimeout:()=>vd,clearContainer:()=>Nd,commitMount:()=>Dd,commitTextUpdate:()=>Ed,commitUpdate:()=>Od,createInstance:()=>ad,createTextInstance:()=>od,detachDeletedInstance:()=>Pd,finalizeInitialChildren:()=>sd,getChildHostContext:()=>gd,getCurrentEventPriority:()=>Fd,getPublicInstance:()=>cd,getRootHostContext:()=>hd,hideInstance:()=>kd,hideTextInstance:()=>Ad,idlePriority:()=>td.unstable_IdlePriority,insertBefore:()=>Sd,insertInContainerBefore:()=>Cd,isPrimaryRenderer:()=>!1,noTimeout:()=>-1,now:()=>td.unstable_now,prepareForCommit:()=>ld,preparePortalMount:()=>ud,prepareUpdate:()=>dd,removeChild:()=>wd,removeChildFromContainer:()=>Td,resetAfterCommit:()=>fd,resetTextContent:()=>pd,run:()=>td.unstable_runWithPriority,scheduleTimeout:()=>_d,shouldDeprioritizeSubtree:()=>md,shouldSetTextContent:()=>yd,supportsMutation:()=>!0,unhideInstance:()=>jd,unhideTextInstance:()=>Md,warnsIfNotActing:()=>!0}),td=p(),nd={},rd={};Lu.Node.prototype._applyProps=Qu;function id(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),$u(e)}function ad(e,t,n){let r=Lu[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`),Lu.Group);let i={},a={};for(var o in t)o.slice(0,2)===`on`?a[o]=t[o]:i[o]=t[o];let s=new r(i);return Qu(s,a),s}function od(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function sd(e,t,n){return!1}function cd(e){return e}function ld(){return null}function ud(){return null}function dd(e,t,n,r){return rd}function fd(){}function pd(e){}function md(e,t){return!1}function hd(){return nd}function gd(){return nd}var _d=setTimeout,vd=clearTimeout;function yd(e,t){return!1}function bd(e,t){t.parent===e?t.moveToTop():e.add(t),$u(e)}function xd(e,t){t.parent===e?t.moveToTop():e.add(t),$u(e)}function Sd(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),$u(e)}function Cd(e,t,n){Sd(e,t,n)}function wd(e,t){t.destroy(),t.off(qu),$u(e)}function Td(e,t){t.destroy(),t.off(qu),$u(e)}function Ed(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function Dd(e,t,n){}function Od(e,t,n,r,i){Qu(e,i,r)}function kd(e){e.hide(),$u(e)}function Ad(e){}function jd(e,t){(t.visible==null||t.visible)&&e.show()}function Md(e,t){}function Nd(e){}function Pd(){}var Fd=()=>Uu.DefaultEventPriority,Id=Object.defineProperty,Ld=Object.defineProperties,Rd=Object.getOwnPropertyDescriptors,zd=Object.getOwnPropertySymbols,Bd=Object.prototype.hasOwnProperty,Vd=Object.prototype.propertyIsEnumerable,Hd=(e,t,n)=>t in e?Id(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ud=(e,t)=>{for(var n in t||={})Bd.call(t,n)&&Hd(e,n,t[n]);if(zd)for(var n of zd(t))Vd.call(t,n)&&Hd(e,n,t[n]);return e},Wd=(e,t)=>Ld(e,Rd(t));typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`)?_.useLayoutEffect:_.useEffect;function Gd(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){let e=Gd(r,t,n);if(e)return e;r=t?null:r.sibling}}function Kd(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}var qd=console.error;console.error=function(){let e=[...arguments].join(``);if(e?.startsWith(`Warning:`)&&e.includes(`useContext`)){console.error=qd;return}return qd.apply(this,arguments)};var Jd=Kd(_.createContext(null)),Yd=class extends _.Component{render(){return _.createElement(Jd.Provider,{value:this._reactInternals},this.props.children)}};function Xd(){let e=_.useContext(Jd);if(e===null)throw Error(`its-fine: useFiber must be called within a <FiberProvider />!`);let t=_.useId();return _.useMemo(()=>{for(let n of[e,e?.alternate]){if(!n)continue;let e=Gd(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}function Zd(){let e=Xd(),[t]=_.useState(()=>new Map);t.clear();let n=e;for(;n;){if(n.type&&typeof n.type==`object`){let e=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;e&&e!==Jd&&!t.has(e)&&t.set(e,_.useContext(Kd(e)))}n=n.return}return t}function Qd(){let e=Zd();return _.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>_.createElement(t,null,_.createElement(n.Provider,Wd(Ud({},r),{value:e.get(n)}))),e=>_.createElement(Yd,Ud({},e))),[e])}function $d(e){let t=_.useRef({});return _.useLayoutEffect(()=>{t.current=e}),_.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}var ef=e=>{let t=_.useRef(null),n=_.useRef(null),r=_.useRef(null),i=$d(e),a=Qd(),o=t=>{let{forwardedRef:n}=e;n&&(typeof n==`function`?n(t):n.current=t)};return _.useLayoutEffect(()=>(n.current=new Lu.Stage({width:e.width,height:e.height,container:t.current}),o(n.current),r.current=ff.createContainer(n.current,Uu.LegacyRoot,!1,null),ff.updateContainer(_.createElement(a,{},e.children),r.current),()=>{Lu.isBrowser&&(o(null),ff.updateContainer(null,r.current,null),n.current.destroy())}),[]),_.useLayoutEffect(()=>{o(n.current),Qu(n.current,e,i),ff.updateContainer(_.createElement(a,{},e.children),r.current,null)}),_.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})},tf=`Layer`,nf=`Group`,rf=`Label`,af=`Rect`,of=`Line`,sf=`Image`,cf=`Text`,lf=`TextPath`,uf=`Path`,df=`Transformer`,ff=(0,Hu.default)(ed);ff.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:`18.3.1`,rendererPackageName:`react-konva`});var pf=_.forwardRef((e,t)=>_.createElement(Yd,{},_.createElement(ef,{...e,forwardedRef:t}))),mf=l(o(((e,t)=>{var n=d();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]}}))()),hf=20,gf=new G.Group;gf.add(new G.Rect({width:hf,height:hf,fill:`white`})),gf.add(new G.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 _f=gf.toCanvas({pixelRatio:2,width:hf,height:hf}),vf={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:20/2,offsetX:20/2,offsetY:20/2,fillPatternImage:_f,fillPatternScaleX:20/hf/2,fillPatternScaleY:20/hf/2,fillPriority:`pattern`,fillPatternRepeat:`no-repeat`})}},yf={anchorFill:`rgb(240, 240, 240)`,anchorStrokeWidth:2,borderStrokeWidth:2},bf={anchorSize:20,anchorCornerRadius:10,anchorStrokeWidth:2,borderStrokeWidth:2},xf={stroke:`rgb(0, 161, 255)`,strokeWidth:2},Sf={stroke:`rgb(0, 161, 255)`,strokeWidth:1,dash:[4,6]},Cf={fill:`rgba(0, 161, 255, 0.3)`,stroke:`rgb(0, 161, 255)`,strokeWidth:1},wf={fill:`rgb(0, 161, 255)`,textFill:`white`},Tf={stroke:`rgb(0, 161, 255)`,labelFill:`rgb(0, 161, 255)`,labelTextFill:`white`},Ef={fill:`rgba(124, 173, 212, 0.8)`,textFill:`white`},Df={fill:`rgba(223, 102, 102, 0.8)`,textFill:`white`},Of={stroke:`red`},kf={backgroundColor:`#e8e8e8`,textColor:`grey`,borderColor:`grey`,borderSize:1,tickColor:`grey`,tickSize:1},Af=`rgba(255, 0, 0, 0.1)`;function jf(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 Mf(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??Af,transparencyBackgroundColor:e.transparencyBackgroundColor,transformerStyle:jf(vf,e.transformerStyle),innerImageCropTransformerStyle:jf(yf,e.innerImageCropTransformerStyle),outerImageCropTransformerStyle:jf(bf,e.outerImageCropTransformerStyle),highlighterStyle:jf(xf,e.highlighterStyle),snapGuideStyle:jf(Sf,{stroke:e.snapGuideStroke,strokeWidth:e.snapGuideStrokeWidth,dash:e.snapGuideDash}),selectionRectStyle:jf(Cf,{fill:e.selectionRectFill,stroke:e.selectionRectStroke,strokeWidth:e.selectionRectStrokeWidth}),transformLabelStyle:jf(wf,{fill:e.transformLabelFill,textFill:e.transformLabelTextFill}),distanceGuideStyle:jf(Tf,{stroke:e.distanceGuideStroke,labelFill:e.distanceLabelFill,labelTextFill:e.distanceLabelTextFill}),mediaLoadingStyle:jf(Ef,e.mediaLoadingStyle),mediaErrorStyle:jf(Df,e.mediaErrorStyle),textOverflowIndicatorStyle:jf(Of,e.textOverflowIndicatorStyle),rulerStyle:jf(kf,{backgroundColor:e.rulerBackgroundColor,textColor:e.rulerTextColor,borderColor:e.rulerBorderColor,borderSize:e.rulerBorderSize,tickColor:e.rulerTickColor,tickSize:e.rulerTickSize})}}var Nf=_.createContext(null),Pf=Nf.Provider;function Ff(){return _.useContext(Nf)||Mf()}var If=0,Lf=new Set;function Rf(e){return Lf.add(e),()=>{Lf.delete(e)}}function zf(){return If}function Bf(e){let t=_.useSyncExternalStore(Rf,zf,zf),n=_.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(e[r]!==t[r])return!1;return!0}(n.current.overrides,e)||(n.current={overrides:e,revision:t,resolved:Mf(e)}),n.current.resolved}var Vf=`warn`;function Hf(e){Vf=e}function Uf(){return Vf}var Wf;(function(e){e.afterCreate=`afterCreate`,e.afterAttach=`afterAttach`,e.afterCreationFinalization=`afterCreationFinalization`,e.beforeDetach=`beforeDetach`,e.beforeDestroy=`beforeDestroy`})(Wf||={});var Gf=function(e,t){return Gf=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])},Gf(e,t)};function Kf(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);Gf(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var qf=function(){return qf=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},qf.apply(this,arguments)};function Jf(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 Yf(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 Xf(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 Zf(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 Qf(e){return rm(e,1),im(e).type}function $f(e,t){return rm(e,1),zm(t,2),im(e).onSnapshot(t)}function ep(e,t){rm(e,1),Rm(t,function(e){return typeof e==`object`},`object or array`,2),im(e).applyPatches(ym(t))}function tp(e,t){return rm(e,1),im(e).applySnapshot(t)}function np(e,t){t===void 0&&(t=!0),rm(e,1);var n=im(e);return t?n.snapshot:wm(n.type.getSnapshot(n,!1))}function rp(e,t){t===void 0&&(t=1),rm(e,1),Bm(t,2,0);for(var n=t,r=im(e).parent;r;){if(--n===0)return r.storedValue;r=r.parent}throw new K(`Failed to find the parent of ${im(e)} at depth ${t}`)}function ip(e,t){rm(e,1),kp(t,2);for(var n=im(e).parent;n;){if(t.is(n.storedValue))return!0;n=n.parent}return!1}function ap(e,t){rm(e,1),kp(t,2);for(var n=im(e).parent;n;){if(t.is(n.storedValue))return n.storedValue;n=n.parent}throw new K(`Failed to find the parent of ${im(e)} of a given type`)}function op(e){return rm(e,1),im(e).root.storedValue}function sp(e){return rm(e,1),im(e).path}function cp(e,t){rm(e,1),Vm(t,2);var n=sm(im(e),t);return n?n.value:void 0}function lp(e){return rm(e,1),im(e).identifier}function up(e){return rm(e,1),im(e).detach(),e}function dp(e){rm(e,1);var t=im(e);t.isRoot?t.die():t.parent.removeChild(t.subpath)}function fp(e){return rm(e,1),im(e).observableIsAlive}function pp(e){return e}var mp=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:tm.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 jm,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||=Fe(`path`),this.pathAtom.reportObserved()),this.parent?(this._escapedSubpath===void 0&&(this._escapedSubpath=this._subpath?Km(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!==tm.DEAD},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`isDetaching`,{get:function(){return this.state===tm.DETACHING},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`observableIsAlive`,{get:function(){return this.aliveAtom||=Fe(`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(Lm()&&!this.isAlive)throw new K(`assertion failed: cannot finalize the creation of a node that is already dead`);if(this.state===tm.CREATED){if(this.parent){if(this.parent.state!==tm.FINALIZED)return;this.fireHook(Wf.afterAttach)}this.state=tm.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=tm.DEAD}}),Object.defineProperty(e.prototype,`baseAboutToDie`,{enumerable:!1,configurable:!0,writable:!0,value:function(){this.fireHook(Wf.beforeDestroy)}}),e}(),hp=function(e){Kf(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=tm.DEAD,e}return o.state=tm.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(Lm()){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 wm(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===tm.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}(mp);hp.prototype.die=Xn(hp.prototype.die);var gp=1,_p;(function(e){e[e.UNINITIALIZED=0]=`UNINITIALIZED`,e[e.CREATING=1]=`CREATING`,e[e.CREATED=2]=`CREATED`})(_p||={});var vp;(function(e){e.Dispose=`dispose`,e.Patch=`patch`,e.Snapshot=`snapshot`})(vp||={});var yp={onError:function(e){throw e}},bp=function(e){Kf(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:++gp}),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,`_observableInstanceState`,{enumerable:!0,configurable:!0,writable:!0,value:_p.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=Vt(function(){return wm(o.getSnapshot())}),o.unbox=o.unbox.bind(o),o._initialSnapshot=wm(a),o.identifierAttribute=t.identifierAttribute,n||(o.identifierCache=new Zp),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`)throw new K(`Instance identifier '${o.identifierAttribute}' for type '${o.type.name}' must be a string or a number`);o.identifier=hg(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===_p.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),Lm()&&this.state!==tm.INITIALIZING)throw new K(`assertion failed: the creation of the observable instance must be done on the initializing phase`);this._observableInstanceState=_p.CREATING;for(var a=[],o=this.parent;o&&o._observableInstanceState===_p.UNINITIALIZED;)a.unshift(o),o=o.parent;try{for(var s=Yf(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=tm.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=_p.CREATED,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=fm,this.state=tm.CREATED,e){this.fireHook(Wf.afterCreate),this.finalizeCreation();try{for(var d=Yf(a.reverse()),f=d.next();!f.done;f=d.next()){var l=f.value;l.fireHook(Wf.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,`clearParent`,{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(Wf.beforeDetach);var e=this.state;this.state=tm.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(Lm()){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(Wf.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`&&(Qn?Qn(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===_p.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?!1:this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,`assertAlive`,{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Uf();if(!this.isAlive&&t!==`ignore`){var n=this._getAssertAliveError(e);switch(t){case`error`:throw new K(n);case`warn`:Fm(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&&Km(e.subpath)||``,r=e.actionContext||Mp();r&&r.type!==`action`&&r.parentActionEvent&&(r=r.parentActionEvent);var i=``;return r&&r.name!=null&&(i=`${r&&r.context&&sp(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===_p.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(fm),this._autoUnbox=!1;try{return this._observableInstanceState===_p.CREATED?this.type.getChildren(this):lm(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=Yf(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(Wf.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=Ip(this.storedValue,`@APPLY_PATCHES`,function(t){t.forEach(function(t){if(!t.path){e.type.applySnapshot(e,t.value);return}var n=Ym(t.path);cm(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)})}),this._applySnapshot=Ip(this.storedValue,`@APPLY_SNAPSHOT`,function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)}),Om(this.storedValue,`$treenode`,this),Om(this.storedValue,`toJSON`,om)}}),Object.defineProperty(t.prototype,`die`,{enumerable:!1,configurable:!0,writable:!0,value:function(){!this.isAlive||this.state===tm.DETACHING||(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,`aboutToDie`,{enumerable:!1,configurable:!0,writable:!0,value:function(){this._observableInstanceState!==_p.UNINITIALIZED&&(this.getChildren().forEach(function(e){e.aboutToDie()}),this.baseAboutToDie(),this._internalEventsEmit(vp.Dispose),this._internalEventsClear(vp.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(vp.Snapshot,e)}}),Object.defineProperty(t.prototype,`emitSnapshot`,{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit(vp.Snapshot,e)}}),Object.defineProperty(t.prototype,`onPatch`,{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister(vp.Patch,e)}}),Object.defineProperty(t.prototype,`emitPatch`,{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers(vp.Patch)){var n=Xf(Hm(bm({},e,{path:t.path.substr(this.path.length)+(e.path?`/`+e.path:``)})),2),r=n[0],i=n[1];this._internalEventsEmit(vp.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(vp.Dispose,e)}}),Object.defineProperty(t.prototype,`addDisposer`,{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this.hasDisposer(e)){this._internalEventsRegister(vp.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(vp.Dispose,e))throw new K(`cannot remove a disposer which was never registered for execution`);this._internalEventsUnregister(vp.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=rr(function(){return e.snapshot},function(t){return e.emitSnapshot(t)},yp);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 jm,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,Zf([e],Xf(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}(mp);bp.prototype.createObservableInstance=Xn(bp.prototype.createObservableInstance),bp.prototype.detach=Xn(bp.prototype.detach),bp.prototype.die=Xn(bp.prototype.die);var xp,Sp;(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`})(Sp||={});var Cp=`cannotDetermine`,wp=Symbol(`$type`),Tp=function(){function e(e){Object.defineProperty(this,xp,{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 qp(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(am(e)){var n=Qf(e);return this.isAssignableFrom(n)?Wp():Gp(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}();xp=wp,Tp.prototype.create=Xn(Tp.prototype.create);var Ep=function(e){Kf(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===hg(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||nm(t)&&im(t)===e?!0:e.type===this&&Sm(t)&&!nm(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(),nm(t)&&this.isAssignableFrom(Qf(t))){var i=im(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}(Tp);Ep.prototype.create=Xn(Ep.prototype.create);var Dp=function(e){Kf(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}(Tp);function Op(e){return typeof e==`object`&&e&&e.isType===!0}function kp(e,t){Rm(e,Op,`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 Ap=1,jp;function Mp(){return jp}function Np(){return Ap++}function Pp(e,t){var n=im(e.context);e.type===`action`&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=jp;jp=e;try{return Rp(n,e,t)}finally{jp=i,n._isRunningAction=r}}function Fp(e){if(e)return e.type===`action`?e:e.parentActionEvent}function Ip(e,t,n){var r=function(){var r=Np(),i=jp,a=Fp(i);return Pp({type:`action`,name:t,id:r,args:Mm(arguments),context:e,tree:op(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?Zf(Zf([],Xf(i.allParentIds),!1),[i.id],!1):[],parentEvent:i,parentActionEvent:a},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var Lp=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 Rp(e,t,n){var r=new Lp(e,n);if(r.isEmpty)return Xn(n).apply(null,t.args);var i=null;function a(e){var t=r.getNextMiddleware(),o=t&&t.handler;if(!o)return Xn(n).apply(null,e.args);if(!t.includeHooks&&Wf[e.name])return a(e);var s=!1;function c(e,t){s=!0,i=a(e),t&&(i=t(i))}var l=!1;function u(e){l=!0,i=e}if(o(e,c,u),Lm()){if(!s&&!l){var d=im(e.tree);throw new K(`Neither the next() nor the abort() callback within the middleware ${o.name} for the action: "${e.name}" on the node: ${d.type.name} was invoked.`)}else if(s&&l){var d=im(e.tree);throw new K(`The next() and abort() callback within the middleware ${o.name} for the action: "${e.name}" on the node: ${d.type.name} were invoked.`)}}return i}return a(t)}function zp(e){try{return JSON.stringify(e)}catch(e){return`<Unserializable: ${e}>`}}function Bp(e){return typeof e==`function`?`<function${e.name?` `+e.name:``}>`:nm(e)?`<${e}>`:`\`${zp(e)}\``}function Vp(e){return e.length<280?e:`${e.substring(0,272)}......${e.substring(e.length-8)}`}function Hp(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=nm(t)?`value of type ${im(t).type.name}:`:Cm(t)?`value`:`snapshot`,o=n&&nm(t)&&n.is(im(t).snapshot);return`${i}${a} ${Bp(t)} is not assignable ${n?`to type: \`${n.name}\``:``}`+(e.message?` (${e.message})`:``)+(n?Mh(n)||Cm(t)?`.`:`, expected an instance of \`${n.name}\` or a snapshot like \`${n.describe()}\` instead.`+(o?` (Note that a snapshot of the provided value is compatible with the targeted type)`:``):`.`)}function Up(e,t,n){return e.concat([{path:t,type:n}])}function Wp(){return dm}function Gp(e,t,n){return[{context:e,value:t,message:n}]}function Kp(e){return e.reduce(function(e,t){return e.concat(t)},[])}function qp(e,t){Im()&&Jp(e,t)}function Jp(e,t){var n=e.validate(t,[{path:``,type:e}]);if(n.length>0)throw new K(Yp(e,t,n))}function Yp(e,t,n){if(n.length!==0)return`Error while converting ${Vp(Bp(t))} to \`${e.name}\`:
|
|
43
|
-
|
|
44
|
-
`+n.map(Hp).join(`
|
|
45
|
-
`)}var Xp=0,Zp=function(){function e(){Object.defineProperty(this,`cacheId`,{enumerable:!0,configurable:!0,writable:!0,value:Xp++}),Object.defineProperty(this,`cache`,{enumerable:!0,configurable:!0,writable:!0,value:It.map()}),Object.defineProperty(this,`lastCacheModificationPerId`,{enumerable:!0,configurable:!0,writable:!0,value:It.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,It.array([],pm));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;Mr(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 Nr(this.cache).forEach(function(e){for(var a=Xf(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 Qp(e,t,n,r,i){var a=am(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 bp(e,t,n,r,i)}function $p(e,t,n,r,i){return new hp(e,t,n,r,i)}function em(e){return e instanceof hp||e instanceof bp}var tm;(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`})(tm||={});function nm(e){return!!(e&&e.$treenode)}function rm(e,t){Rm(e,nm,`mobx-state-tree node`,t)}function im(e){if(!nm(e))throw new K(`Value ${e} is no MST Node`);return e.$treenode}function am(e){return e&&e.$treenode||null}function om(){return im(this).snapshot}function sm(e,t,n){return n===void 0&&(n=!0),cm(e,Ym(t),n)}function cm(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 hp){var o=r.value;nm(o)&&(r=im(o))}if(r instanceof bp&&r.getChildType(a)&&(r=r.getChildNode(a),r))continue}throw new K(`Could not resolve '${a}' in path '${Jm(t.slice(0,i))||`/`}' while resolving '${Jm(t)}'`)}}catch(e){if(!n)return;throw e}return r}function lm(e){if(!e)return dm;var t=Object.keys(e);if(!t.length)return dm;var n=Array(t.length);return t.forEach(function(t,r){n[r]=e[t]}),n}var um=Object.toString(),dm=Object.freeze([]),fm=Object.freeze({}),pm=xn().useProxies?{deep:!1}:{deep:!1,proxy:!1};Object.freeze(pm);var K=function(e){Kf(t,e);function t(t){return t===void 0&&(t=`Illegal state`),e.call(this,`[mobx-state-tree] ${t}`)||this}return t}(Error);function mm(e){return e}var hm=Number.isInteger;function gm(e){return Number(e)===e&&e%1!=0}function _m(e){return Number.isFinite(e)}function vm(e){return Array.isArray(e)||di(e)}function ym(e){return e?vm(e)?e:[e]:dm}function bm(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 xm(e){if(typeof e!=`object`||!e)return!1;var t=Object.getPrototypeOf(e);return t==null?!0:t.constructor?.toString()===um}function Sm(e){return typeof e==`object`&&!!e&&!(e instanceof Date)&&!(e instanceof RegExp)}function Cm(e,t){return t===void 0&&(t=!0),e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||t&&e instanceof Date}function wm(e){return Lm()?Cm(e)||di(e)?e:Object.freeze(e):e}function Tm(e){return Lm()?(wm(e),xm(e)&&Object.keys(e).forEach(function(t){!Cm(e[t])&&!Object.isFrozen(e[t])&&Tm(e[t])}),e):e}function Em(e){return typeof e!=`function`}function Dm(e,t,n){ki(e)?Fr(e,t,n):Object.defineProperty(e,t,n)}function Om(e,t,n){Dm(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function km(e,t,n){Dm(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}var Am=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,Zf([],Xf(e),!1))})}}),e}(),jm=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 Am,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,Zf([],Xf(n),!1))}}),e}();function Mm(e){for(var t=Array(e.length),n=0;n<e.length;n++)t[n]=e[n];return t}function Nm(e,t){return e.indexOf(t)===0}var Pm=function(e,t){Lm()&&(Pm.ids&&!Pm.ids.hasOwnProperty(e)&&Fm(`Deprecation warning: `+t),Pm.ids&&(Pm.ids[e]=!0))};Pm.ids={};function Fm(e){console.warn(Error(`[mobx-state-tree] ${e}`))}function Im(){return Lm()||typeof process<`u`&&{}.ENABLE_TYPE_CHECK===`true`}function Lm(){return!1}function Rm(e,t,n,r){if(Lm()&&!t(e))throw new K(`expected ${n} as argument ${ym(r).join(` or `)}, got ${e} instead`)}function zm(e,t){Rm(e,function(e){return typeof e==`function`},`function`,t)}function Bm(e,t,n,r){Rm(e,function(e){return typeof e==`number`},`number`,t),n!==void 0&&Rm(e,function(e){return e>=n},`number greater than ${n}`,t),r!==void 0&&Rm(e,function(e){return e<=r},`number lesser than ${r}`,t)}function Vm(e,t,n){n===void 0&&(n=!0),Rm(e,function(e){return typeof e==`string`},`string`,t),n||Rm(e,function(e){return e!==``},`not empty string`,t)}function Hm(e){if(!(`oldValue`in e))throw new K("Patches without `oldValue` field cannot be inversed");return[Um(e),Wm(e)]}function Um(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 Wm(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 Gm(e){return typeof e==`number`}function Km(e){return Gm(e)===!0?``+e:e.indexOf(`/`)===-1&&e.indexOf(`~`)===-1?e:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function qm(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function Jm(e){if(e.length===0)return``;var t=function(e){return e.map(Km).join(`/`)};return e[0]===`.`||e[0]===`..`?t(e):`/`+t(e)}function Ym(e){var t=e.split(`/`).map(qm);if(!(e===``||e===`.`||e===`..`||Nm(e,`/`)||Nm(e,`./`)||Nm(e,`../`)))throw new K(`a json path must be either rooted, empty or relative, but got '${e}'`);return t[0]===``&&t.shift(),t}var Xm=Symbol(`$preProcessorFailed`),Zm=function(e){Kf(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|Sp.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 Xm}}}),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;Qm(e.type,this,`create`),e instanceof bp&&(e.hasSnapshotPostProcessor=!!this._processors.postProcessor);var n=e.getSnapshot;e.getSnapshot=function(){return t.postProcessSnapshot(n.call(e),e)},Bh(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=nm(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,nm(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===Xm?Gp(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=Op(e)?this._subtype:nm(e)?e:this.preProcessSnapshotSafe(e);return t===Xm?!1: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 Ep))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Tp);function Qm(e,t){for(var n,r,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];try{for(var o=Yf(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 $m(e,t,n){if(kp(e,1),Lm()){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 Zm(e,t,n)}var eh=`Map.put can only be used to store complex values that have an identifier type attribute`;function th(e,t){var n,r,i=e.getSubTypes();if(i===Cp)return!1;if(i){var a=ym(i);try{for(var o=Yf(a),s=o.next();!s.done;s=o.next()){var c=s.value;if(!th(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 gh&&t.push(e),!0}var nh;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.YES=1]=`YES`,e[e.NO=2]=`NO`})(nh||={});var rh=function(e){Kf(t,e);function t(t,n){return e.call(this,t,It.ref.enhancer,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(nm(e)){var t=im(e);if(Lm()&&!t.identifierAttribute||t.identifier===null)throw new K(eh);return this.set(t.identifier,e),e}else if(Sm(e)){var n=im(this),r=n.type;if(r.identifierMode!==nh.YES)throw new K(eh);var i=e[r.mapIdentifierAttribute];if(!gg(i)){var a=this.put(r.getChildType().create(e,n.environment));return this.put(np(a))}var o=hg(i);return this.set(o,e),this.get(o)}else throw new K(`Map.put can only be used to store complex values`)}}),t}(hi),ih=function(e){Kf(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:nh.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:Sp.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(),Qp(this,e,t,n,r)}}),Object.defineProperty(t.prototype,`_determineIdentifierMode`,{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===nh.UNKNOWN){var e=[];if(th(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=nh.YES,this.mapIdentifierAttribute=t):this.identifierMode=nh.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 rh(e,this.name)}}),Object.defineProperty(t.prototype,`finalizeNewInstance`,{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Tr(t,e.unbox),e.type.hookInitializers.forEach(function(e){var n=e(t);Object.keys(n).forEach(function(e){var r=n[e],i=Ip(t,e,r);(Lm()?km:Om)(t,e,i)})}),Er(t,this.willChange),Ir(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 Mr(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=im(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;qp(i,a),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case`add`:qp(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue);break}return e}}),Object.defineProperty(t.prototype,`processIdentifier`,{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===nh.YES&&t instanceof bp){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=im(e.object);switch(e.type){case`update`:t.emitPatch({op:`replace`,path:Km(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);return;case`add`:t.emitPatch({op:`add`,path:Km(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:Km(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);break}}}),Object.defineProperty(t.prototype,`applySnapshot`,{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){qp(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach(function(e){r[e]=!1}),t)for(var i in t)n.set(i,t[i]),r[``+i]=!0;Object.keys(r).forEach(function(e){r[e]===!1&&n.delete(e)})}}),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 xm(e)?Kp(Object.keys(e).map(function(r){return n._subType.validate(e[r],Up(t,r,n._subType))})):Gp(t,e,`Value is not a plain object`)}}),Object.defineProperty(t.prototype,`getDefaultSnapshot`,{enumerable:!1,configurable:!0,writable:!0,value:function(){return fm}}),Object.defineProperty(t.prototype,`removeChild`,{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Ep);ih.prototype.applySnapshot=Xn(ih.prototype.applySnapshot);function ah(e){return new ih(`Map<string, ${e.name}>`,e)}var oh=function(e){Kf(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:Sp.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 Qp(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=qf(qf({},pm),{name:this.name});return It.array(lm(e),t)}}),Object.defineProperty(t.prototype,`finalizeNewInstance`,{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Hi(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=Ip(t,e,r);(Lm()?km:Om)(t,e,i)})}),Er(t,this.willChange),Ir(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=im(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=ch(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=ch(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));break}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=im(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);break}}}),Object.defineProperty(t.prototype,`applySnapshot`,{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){qp(this,t),e.storedValue.replace(t)}}),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 vm(e)?Kp(e.map(function(e,r){return n._subType.validate(e,Up(t,``+r,n._subType))})):Gp(t,e,`Value is not an array`)}}),Object.defineProperty(t.prototype,`getDefaultSnapshot`,{enumerable:!1,configurable:!0,writable:!0,value:function(){return dm}}),Object.defineProperty(t.prototype,`removeChild`,{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.splice(Number(t),1)}}),t}(Ep);oh.prototype.applySnapshot=Xn(oh.prototype.applySnapshot);function sh(e){return kp(e,1),new oh(`${e.name}[]`,e)}function ch(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(em(l)&&(l=l.storedValue),!c&&!s)break;if(!s)a=!1,n.splice(o,1),c instanceof bp&&c.createObservableInstanceIfNeeded(),c.die(),o--;else if(!c){if(nm(l)&&im(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 '${im(l).path}'`);a=!1;var d=lh(t,e,u,l);n.splice(o,0,d)}else if(uh(c,l))n[o]=lh(t,e,u,l,c);else{for(var f=void 0,p=o;p<n.length;p++)if(uh(n[p],l)){f=n.splice(p,1)[0];break}a=!1;var d=lh(t,e,u,l,f);n.splice(o,0,d)}}return a?null:n}function lh(e,t,n,r,i){qp(e,r);function a(){if(nm(r)){var a=im(r);if(a.assertAlive(fm),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 bp&&i.createObservableInstanceIfNeeded(),i.die()),o}function uh(e,t){if(!e.isAlive)return!1;if(nm(t)){var n=im(t);return n.isAlive&&n===e}if(e.snapshot===t)return!0;if(!(e instanceof bp))return!1;var r=e.getReconciliationType();return e.identifier!==null&&e.identifierAttribute&&xm(t)&&r.is(t)&&r.isMatchingSnapshotId(e,t)}var dh=`preProcessSnapshot`,fh=`postProcessSnapshot`;function ph(){return im(this).toString()}var mh={name:`AnonymousModel`,properties:{},initializers:dm};function hh(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 Wf)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(Cm(i))t[n]=Uh(jh(i),i);else if(i instanceof ih)t[n]=Uh(i,{});else if(i instanceof oh)t[n]=Uh(i,[]);else if(!Op(i))throw Lm()&&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?`):Lm()&&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},qf({},e))}var gh=function(e){Kf(t,e);function t(t){var n=e.call(this,t.name||mh.name)||this;return Object.defineProperty(n,`flags`,{enumerable:!0,configurable:!0,writable:!0,value:Sp.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,mh,t),n.properties=hh(n.properties),wm(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&Sp.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(!xm(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===dh)throw new K(`Cannot define action '${dh}', it should be defined using 'type.preProcessSnapshot(fn)' instead`);if(r===fh)throw new K(`Cannot define action '${fh}', it should be defined using 'type.postProcessSnapshot(fn)' instead`);var i=t[r],a=e[r];if(r in Wf&&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=Ip(e,r,c);t[r]=l,(Lm()?km:Om)(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(!xm(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`);Pr(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 Jf(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(!xm(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)Fr(e,r,a),Qr(e,(i={},i[r]=Vt,i));else if(typeof a.value==`function`)(Lm()?km:Om)(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=nm(r)?r:this.applySnapshotPreProcessor(r);return Qp(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=qf(qf({},pm),{name:this.name});return It.object(e,fm,t)}}),Object.defineProperty(t.prototype,`finalizeNewInstance`,{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Om(t,`toString`,ph),this.forAllProps(function(n){Tr(t,n,e.unbox)}),this.initializers.reduce(function(e,t){return t(e)},t),Er(t,this.willChange),Ir(t,this.didChange)}}),Object.defineProperty(t.prototype,`willChange`,{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e,n=im(t.object),r=t.name;n.assertWritable({subpath:r});var i=n.type.properties[r];return i&&(qp(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=im(t.object);if(n.type.properties[t.name]){var r=t.oldValue?t.oldValue.snapshot:void 0;n.emitPatch({op:`replace`,path:Km(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=Hi(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){Vi(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){qp(this,t);var n=this.applySnapshotPreProcessor(t);this.forAllProps(function(t){e.storedValue[t]=n[t]})}}),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 Vm(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 xm(r)?Kp(this.propertyNames.map(function(e){return n.properties[e].validate(r[e],Up(t,e,n.properties[e]))})):Gp(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 fm}}),Object.defineProperty(t.prototype,`removeChild`,{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue[t]=void 0}}),t}(Ep);gh.prototype.applySnapshot=Xn(gh.prototype.applySnapshot);function _h(){var e=[...arguments];if(Lm()&&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 gh({name:typeof e[0]==`string`?e.shift():`AnonymousModel`,properties:e.shift()||{}})}function vh(){var e=[...arguments],t=typeof e[0]==`string`,n=t?e[0]:`AnonymousModel`;return t&&e.shift(),Lm()&&e.forEach(function(e,n){Rm(e,yh,`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 yh(e){return Op(e)&&(e.flags&Sp.Object)>0}var bh=function(e){Kf(t,e);function t(t,n,r,i){i===void 0&&(i=mm);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 $p(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 Cm(e)&&this.checker(e)?Wp():Gp(t,e,`Value is not a ${this.name===`Date`?`Date or a unix milliseconds timestamp`:this.name}`)}}),t}(Dp),xh=new bh(`string`,Sp.String,function(e){return typeof e==`string`}),Sh=new bh(`number`,Sp.Number,function(e){return typeof e==`number`}),Ch=new bh(`integer`,Sp.Integer,function(e){return hm(e)}),wh=new bh(`float`,Sp.Float,function(e){return gm(e)}),Th=new bh(`finite`,Sp.Finite,function(e){return _m(e)}),Eh=new bh(`boolean`,Sp.Boolean,function(e){return typeof e==`boolean`}),Dh=new bh(`null`,Sp.Null,function(e){return e===null}),Oh=new bh(`undefined`,Sp.Undefined,function(e){return e===void 0}),kh=new bh(`Date`,Sp.Date,function(e){return typeof e==`number`||e instanceof Date},function(e){return e instanceof Date?e:new Date(e)});kh.getSnapshot=function(e){return e.storedValue.getTime()};var Ah=kh;function jh(e){switch(typeof e){case`string`:return xh;case`number`:return Sh;case`boolean`:return Eh;case`object`:if(e instanceof Date)return Ah}throw new K(`Cannot determine primitive type from value `+e)}function Mh(e){return Op(e)&&(e.flags&(Sp.String|Sp.Number|Sp.Integer|Sp.Boolean|Sp.Date))>0}var Nh=function(e){Kf(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:Sp.Literal}),n.value=t,n}return Object.defineProperty(t.prototype,`instantiate`,{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return $p(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 Cm(e)&&e===this.value?Wp():Gp(t,e,`Value is not a literal ${JSON.stringify(this.value)}`)}}),t}(Dp);function Ph(e){return Rm(e,Cm,`primitive`,1),new Nh(e)}var Fh=function(e){Kf(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|Sp.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=nm(e)?im(e).snapshot:e;return this._predicate(r)?Wp():Gp(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}(Tp);function Ih(){var e=[...arguments],t=typeof e[0]==`string`?e.shift():Op(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 kp(n,[1,2]),Vm(t,1),zm(r,[2,3]),zm(i,[3,4]),new Fh(t,n,r,i)}function Lh(e,t){var n=typeof e==`string`?t:e;Lm()&&n.forEach(function(e,t){Vm(e,t+1)});var r=zh.apply(void 0,Zf([],Xf(n.map(function(e){return Ph(``+e)})),!1));return typeof e==`string`&&(r.name=e),r}var Rh=function(e){Kf(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=qf({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=Sp.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 Wp();r++}else n.push(a)}return r===1?Wp():Gp(t,e,`No type is applicable for the union`).concat(Kp(n))}}),Object.defineProperty(t.prototype,`getSubTypes`,{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._types}}),t}(Tp);function zh(e){var t=[...arguments].slice(1),n=Op(e)?void 0:e,r=Op(e)?Zf([e],Xf(t),!1):t,i=`(`+r.map(function(e){return e.name}).join(` | `)+`)`;return Lm()&&(n&&Rm(n,function(e){return xm(e)},`object { eager?: boolean, dispatcher?: Function }`,1),r.forEach(function(e,t){kp(e,n?t+2:t+1)})),new Rh(i,r,n)}function Bh(e){return Op(e)&&(e.flags&Sp.Union)>0}var Vh=function(e){Kf(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|Sp.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`&&qp(this,e),e}}),Object.defineProperty(t.prototype,`isValidSnapshot`,{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wp():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}(Tp);function Hh(e,t){if(typeof t!=`function`&&nm(t))throw new K(`default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead`);kp(e,1),Lm()&&typeof t!=`function`&&qp(e,t)}function Uh(e,t,n){return Hh(e,t),new Vh(e,t,n||Wh)}var Wh=[void 0],Gh=Uh(Oh,void 0),Kh=Uh(Dh,null);function qh(e){return kp(e,1),zh(e,Gh)}function Jh(e){return kp(e,1),zh(e,Kh)}var Yh=function(e){Kf(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)|Sp.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(Lm()&&!Op(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):Wp()}}),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)||Cp}}),t}(Tp);function Xh(e,t){var n=typeof e==`string`?e:`late(${e.toString()})`,r=typeof e==`string`?t:e;if(Lm()&&!(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 Yh(n,r)}function Zh(e,t){return new Qh(e,t)}var Qh=function(e){Kf(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:Sp.Lazy}),Object.defineProperty(r,`loadedType`,{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,`pendingNodeList`,{enumerable:!0,configurable:!0,writable:!0,value:It.array()}),Br(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(Xn(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=$p(this,e,t,n,Tm(r));return this.pendingNodeList.push(a),Br(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):Em(e)?Wp():Gp(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}(Dp),$h=function(e){Kf(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:Sp.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 $p(this,e,t,n,Tm(r))}}),Object.defineProperty(t.prototype,`isValidSnapshot`,{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Em(e)?this.subType?this.subType.validate(e,t):Wp():Gp(t,e,`Value is not serializable and cannot be frozen`)}}),t}(Dp),eg=new $h;function tg(e){return arguments.length===0?eg:Op(e)?new $h(e):Uh(eg,e)}function ng(e){switch(e){case Wf.beforeDestroy:return`destroy`;case Wf.beforeDetach:return`detach`;default:return}}var rg=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}),gg(e))this.identifier=e;else if(nm(e)){var n=im(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=hg(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 ig(`[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}(),ig=function(e){Kf(t,e);function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return t}(Error),ag=function(e){Kf(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:Sp.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 gg(e)?Wp():Gp(t,e,`Value is not a valid identifier, which is a string or a number`)}}),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){ep(t.root.storedValue,{op:`replace`,value:e,path:t.path})},removeRef:function(){yh(i.type)?this.replaceRef(void 0):ep(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=im(r),a=function(r,a){var o=ng(a);o&&n.fireInvalidated(o,e,t,i)},o=i.registerHook(Wf.beforeDetach,a),s=i.registerHook(Wf.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(Wf.beforeDestroy,function(){i&&i()});var a=function(a){i&&i();var o=e.parent,s=o&&o.storedValue;if(o&&o.isAlive&&s){var c=void 0;c=n?!!n.get(t,s):e.root.identifierCache.has(r.targetType,hg(t)),c?i=r.addTargetNodeWatcher(e,t):a||r.fireInvalidated(`invalidSnapshotReference`,e,t,null)}};e.state===tm.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(Wf.afterCreationFinalization,function(){e.parent&&e.parent.createObservableInstanceIfNeeded()}),e.registerHook(Wf.afterAttach,function(){a(!1)}))}}}),t}(Dp),og=function(e){Kf(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=nm(r)?lp(r):r,a=new rg(r,this.targetType),o=$p(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=nm(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}(ag),sg=function(e){Kf(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=nm(r)?this.options.set(r,e?e.storedValue:null):r,a=$p(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=nm(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}(ag);function cg(e,t){if(kp(e,1),Lm()&&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(Lm()&&(!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 sg(e,{get:n.get,set:n.set},r)}else return new og(e,r)}function lg(e,t){var n=cg(e,qf(qf({},t),{onInvalidated:function(e){t&&t.onInvalidated&&t.onInvalidated(e),e.removeRef()}}));return t&&t.acceptsUndefined===!1?n:qh(n)}var ug=function(e){Kf(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:Sp.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 gh))throw new K(`Identifier types can only be instantiated as direct child of a model type`);return $p(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?Wp():Gp(t,e,`Value is not a valid ${this.describe()}, expected a ${this.validType}`)}}),t}(Dp),dg=function(e){Kf(t,e);function t(){var t=e.call(this,`identifier`,`string`)||this;return Object.defineProperty(t,`flags`,{enumerable:!0,configurable:!0,writable:!0,value:Sp.Identifier}),t}return Object.defineProperty(t.prototype,`describe`,{enumerable:!1,configurable:!0,writable:!0,value:function(){return`identifier`}}),t}(ug),fg=function(e){Kf(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}(ug),pg=new dg,mg=new fg;function hg(e){return``+e}function gg(e){return typeof e==`string`||typeof e==`number`}function _g(e){return new vg(e)}var vg=function(e){Kf(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:Sp.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 Wp();var n=this.options.getValidationMessage(e);return n?Gp(t,e,`Invalid value for type '${this.name}': ${n}`):Wp()}}),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 $p(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}(Dp),q={enumeration:Lh,model:_h,compose:vh,custom:_g,reference:cg,safeReference:lg,union:zh,optional:Uh,literal:Ph,maybe:qh,maybeNull:Jh,refinement:Ih,string:xh,boolean:Eh,number:Sh,integer:Ch,float:wh,finite:Th,Date:Ah,map:ah,array:sh,frozen:tg,identifier:pg,identifierNumber:mg,late:Xh,lazy:Zh,undefined:Oh,null:Dh,snapshotProcessor:$m},yg=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)||!yg(e[n],t[n]))return!1;return!0}return!1};Object.assign(q);var bg=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=np(t);return{pages:e.pages,width:e.width,height:e.height,custom:e.custom,audios:e.audios}}function l(e){let n=!yg(t.pages.map(e=>e.id),e.pages.map(e=>e.id)),r=!yg(t.custom,e.custom);n?tp(t.pages,e.pages):t.pages.forEach((t,n)=>{tp(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];!yg(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=cp(e,`..`),!t)throw Error("Failed to find target store for UndoManager. Please provide `targetPath` property, or a `targetStore` in the environment");n=$f(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}),xg=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+=`-`:e+=`_`,e),``);async function Sg(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 Cg=null;function wg(){return window.jspdf?.jsPDF?Promise.resolve(window.jspdf.jsPDF):Cg||(typeof window.__polotnoLoadJspdf==`function`?(Cg=window.__polotnoLoadJspdf().then(e=>e?.jsPDF||e),Cg):(Cg=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)}),Cg))}function Tg(){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 Eg({width:e,height:t}){return new(await(Tg()))({workers:4,width:e,height:t,workerScript:URL.createObjectURL(new Blob([`// gif.worker.js 0.2.0 - https://github.com/jnordberg/gif.js
|
|
46
|
-
(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]);
|
|
47
|
-
`],{type:`application/javascript`}))})}var Dg=`https://api.polotno.com`;`${Dg}`;var Og=()=>Dg+`/api`,kg=It({imageDownScalingEnabled:!0,removeBackgroundEnabled:!1,htmlRenderEnabled:!1,forceTextFitEnabled:!1,textVerticalResizeEnabled:!1,textOverflow:`resize`,textSplitAllowed:!1,animationsEnabled:!1,aiTextEnabled:!1,autoDeleteEmptyText:!0}),Ag=typeof window<`u`&&window.location.hostname===`localhost`||typeof process<`u`&&!1,jg=Xn(e=>{kg.textVerticalResizeEnabled=e}),Mg=Xn(e=>{kg.removeBackgroundEnabled=e});Xn(e=>{Ag&&console.warn(`useRemoveBackground is deprecated. Use setRemoveBackgroundEnabled instead.`),Mg(e)}),Xn(e=>{kg.aiTextEnabled=e}),Xn(e=>{Ag&&console.warn(`useHtmlTextRender is deprecated. Use setRichTextEnabled instead.`),kg.htmlRenderEnabled=e});var Ng=Xn(e=>{kg.htmlRenderEnabled=e}),Pg=Xn(e=>{kg.imageDownScalingEnabled=e});Xn(e=>{console.warn(`useDownScaling is deprecated. Use setDownScalingEnabled instead.`),Pg(e)}),Xn(e=>{console.warn(`setForceTextFit is deprecated. Use setTextOverflow instead.`),kg.textOverflow=`change-font-size`});var Fg=Xn(e=>{kg.textOverflow=e}),Ig=Xn(e=>{kg.textSplitAllowed=e});Xn(e=>{kg.animationsEnabled=e}),Xn(e=>{kg.autoDeleteEmptyText=e});var Lg=It({value:!1}),Rg=It({value:`v1`}),zg=()=>Rg.value,Bg=It({value:0}),Vg=()=>Bg.value,Hg=()=>Lg.value,Ug=Xn(()=>{Lg.value=!0}),Wg=typeof window<`u`?window.location.origin:``,Gg=typeof navigator<`u`&&navigator.userAgent.indexOf(`Headless`)>-1,Kg=typeof navigator<`u`&&navigator.userAgent.indexOf(`Electron`)>-1;Wg===`file://`&&Gg&&(Wg=`headless`),Wg===`file://`&&Kg&&(Wg=`electron`);var qg=`%cPolotno error! Current domain is not allowed. It may lead to unexpected behavior and stop working. Please add "${Wg}" here: https://polotno.com/cabinet`,Jg=fetch;async function Yg(e){for(let t=0;t<5;t++)try{let t=await Jg(Og()+`/validate-key`,{method:`POST`,body:JSON.stringify({key:e,site:location.host,skdVersion:`2.41.0`})});if(Qn(()=>{Rg.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`),Qn(()=>{Bg.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`),Qn(()=>{Bg.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;`),Qn(()=>{Bg.value===0&&(Bg.value=2)})),n.is_domain_valid||console.log(qg,`background: rgba(247, 101, 68, 1); color: white; padding: 5px; margin: 5px;`),Mg(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 Xg(e,t){await Yg(e)&&!t||Ug()}var Zg=!1,Qg=(e=!Zg)=>{Zg=e},$g=()=>Zg;function e_(e,t){let n=_.useRef();_.useLayoutEffect(()=>{n.current&&n.current.destroy()},[t]),_.useLayoutEffect(()=>{if(!Zg)return;let t=e.current.opacity();return t?(e.current.opacity(0),n.current=new G.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 t_=0,n_=[],r_=3e4,i_=e=>{r_=e},a_=6e3,o_=e=>{a_=e},s_=()=>a_;function c_(e){t_+=1;let t=!1,n=!1,r=setTimeout(()=>{t||(p_(`Timeout loading asset ${e}`),console.error(`Timeout triggered for loader. Some assets may not have loaded.`,e),t=!0,l_())},r_);return()=>{n?console.error(`Finish called twice! That is not expected. id: `,e):(n=!0,t||(clearTimeout(r),l_()))}}function l_(){--t_,t_===0&&(n_.forEach(e=>e()),n_=[])}function u_(){return new Promise(e=>{t=()=>{$g()?setTimeout(e,300):e(!0)},t_===0?t():n_.push(t);return;var t})}var d_=[];function f_(e){d_.push(e)}function p_(e){d_.forEach(t=>t(e))}function m_(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?`
|
|
48
|
-
`:e)),e.replace(/(<([^>]+)>)/gi,``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/ /g,` `)}function h_(e,t){return!!e.bold==!!t.bold&&!!e.italic==!!t.italic&&!!e.underline==!!t.underline&&!!e.strike==!!t.strike&&(e.color||``)===(t.color||``)}function g_(e){if(!e)return[];let t=new DOMParser().parseFromString(e,`text/html`),n=[],r=t.body.querySelectorAll(`p`);function i(e,t){if(e.nodeType===Node.TEXT_NODE){let r=e.textContent||``;r&&n.push(function(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),n}(r,t));return}if(e.nodeType!==Node.ELEMENT_NODE)return;let r=e,a=r.tagName.toLowerCase(),o=Object.assign({},t);a!==`strong`&&a!==`b`||(o.bold=!0),a!==`em`&&a!==`i`||(o.italic=!0),a===`u`&&(o.underline=!0),a===`s`&&(o.strike=!0);let s=r.style;s.color&&(o.color=s.color),(s.fontWeight===`bold`||parseInt(s.fontWeight)>=700)&&(o.bold=!0),s.fontStyle===`italic`&&(o.italic=!0);let c=s.textDecoration||s.textDecorationLine||``;c.includes(`underline`)&&(o.underline=!0),c.includes(`line-through`)&&(o.strike=!0);for(let e of Array.from(r.childNodes))i(e,o)}r.length>0?r.forEach((e,t)=>{i(e,{}),t<r.length-1&&n.push({text:` `})}):i(t.body,{});let a=[];for(let e of n){if(!e.text)continue;let t=a[a.length-1];t&&h_(t,e)?t.text+=e.text:a.push(e)}return a}function __(e){return e?/<[a-z][a-z0-9]*(\s[^>]*)?>[^<]*<\/[a-z][a-z0-9]*>/i.test(e)?e=(e=e.replace(/<(?![a-z/!])/gi,`<`)).replace(/([^a-z0-9"'\s/])>/gi,`$1>`):e.replace(/</g,`<`).replace(/>/g,`>`):``}It([`Roboto`,`Amatic SC`,`Press Start 2P`,`Marck Script`,`Rubik Mono One`]),It({value:!1});var v_=It([]);function y_(e){v_.push(e)}var b_=`BESbswy 0123456789 Il1Ww`,x_=[`sans-serif`,`serif`,`monospace`];function S_(e){let t=function(e=``){let t=m_(e).replace(/\s+/g,` `).trim();return t?Array.from(t).slice(0,10).join(``):``}(e);return t?`${b_} ${t}`:b_}var C_;function w_(e){return{width:e.width,actualBoundingBoxLeft:e.actualBoundingBoxLeft||0,actualBoundingBoxRight:e.actualBoundingBoxRight||0,actualBoundingBoxAscent:e.actualBoundingBoxAscent||0,actualBoundingBoxDescent:e.actualBoundingBoxDescent||0}}function T_(e=`sans-serif`,t=`normal`,n=`normal`,r=b_){C_||=document.createElement(`canvas`);let i=C_.getContext(`2d`);return i.font=`${t} ${n} 40px ${e}`,w_(i.measureText(r))}function E_(e,t,n,r,i){return x_.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=b_){C_||=document.createElement(`canvas`);let a=C_.getContext(`2d`);return a.font=`${n} ${r} 40px '${e}', ${t}`,w_(a.measureText(i))}(e,a,t,n,r),i[a]))}var D_={Arial:!0},O_=(e,t,n)=>t&&n?!!D_[`${e}_${t}_${n}`]:Object.keys(D_).some(t=>t.startsWith(e+`_`))||!!D_[e];async function k_(e,t,n,r){let i=`${e}_${t}_${n}`;if(D_[i])return;let a=!!document.fonts?.load,o=S_(r),s={"sans-serif":T_(`sans-serif`,t,n,o),serif:T_(`serif`,t,n,o),monospace:T_(`monospace`,t,n,o)};if(a)try{if(await document.fonts.load(`${t} ${n} 16px '${e}'`,o),E_(e,t,n,o,s)){D_[i]=!0;return}}catch{}let c=Math.min(6e3,s_())/60;for(let r=0;r<c;r++){if(E_(e,t,n,o,s)){D_[i]=!0;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?`),p_(`Timeout for loading font "${e}"`)}var A_={},j_=`400,400italic,700,700italic`;function M_(){return j_}function N_(e){return`https://fonts.googleapis.com/css?family=${e.replace(/ /g,`+`)}:${j_}`}function P_(e){if(A_[e])return;let t=N_(e),n=document.createElement(`link`);n.type=`text/css`,n.href=t,n.rel=`stylesheet`,document.getElementsByTagName(`head`)[0].appendChild(n),A_[e]=!0}var F_={},I_;function L_(e){let t=e.fontFamily;if(F_[t]||!e.url&&!e.styles)return;let n=e.styles||(e.url?[{src:`url("${e.url}")`}]:[]),r=(I_||(I_=document.getElementById(`polotno-font-style`),I_||(I_=document.createElement(`style`),I_.id=`polotno-font-style`,document.head.appendChild(I_)),I_)).sheet;n.forEach(e=>{r.insertRule(`\n @font-face{\n font-family:'${t}';\n src:${e.src};\n font-style:${e.fontStyle||`normal`};\n font-weight:${e.fontWeight||`normal`};\n font-display:swap; /* optional but recommended */\n }`,r.cssRules.length)}),F_[e.fontFamily]=!0}var R_=[112,72,89,115],z_=(()=>{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})(),B_=()=>typeof globalThis<`u`?globalThis.Buffer:void 0,V_=(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},H_=(e,t,n)=>{let r=e.indexOf(`,`),i=(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=B_();if(t)return new Uint8Array(t.from(e,`base64`));throw Error(`No base64 decoder available`)})(r>=0?e.slice(r+1):e);return`data:${t};base64,${(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=B_();if(t)return t.from(e).toString(`base64`);throw Error(`No base64 encoder available`)})(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);V_(r,0,t.length),r.set(R_,4),r.set(t,8);let i=new Uint8Array(4+t.length);return i.set(R_,0),i.set(t,4),V_(r,8+t.length,(e=>{let t=4294967295;for(let n=0;n<e.length;n++)t=z_[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,R_);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))}`},U_=(e,t,n)=>{let r=t,i=n,a=1;for(;r>0&&i>0;){if(e.width=r,e.height=i,r+i<4e3)return;let o=e.getContext(`2d`);if(!o)return;if(o.fillStyle=`rgba(0,0,0,0.1)`,o.fillRect(0,0,1,1),o.getImageData(0,0,1,1).data[3]!==0){o.clearRect(0,0,e.width,e.height);return}if(a*=.9,r=Math.floor(t*a),i=Math.floor(n*a),r=Math.max(r,1),i=Math.max(i,1),r<=1&&i<=1){e.width=1,e.height=1;return}}};function W_(e,t){let n=t.x??0,r=t.y??0,i=t.pixelRatio||1,a=Math.round(t.width*i),o=Math.round(t.height*i),s=a/i,c=o/i,l=t.sceneCanvas;l?(l.width!==a||l.height!==o||l.pixelRatio!==i)&&(l.setSize(s,c),l.setPixelRatio(i)):l=new uo({width:s,height:c,pixelRatio:i});let u=l.getContext(),d=l.width/l.pixelRatio+Math.abs(n),f=l.height/l.pixelRatio+Math.abs(r),p=t.bufferCanvas;if(p){let e=Math.round(d*l.pixelRatio),t=Math.round(f*l.pixelRatio);(p.width!==e||p.height!==t||p.pixelRatio!==l.pixelRatio)&&(p.setSize(d,f),p.setPixelRatio(l.pixelRatio))}else p=new uo({width:d,height:f,pixelRatio:l.pixelRatio});return!1===t.imageSmoothingEnabled&&(u._context.imageSmoothingEnabled=!1),u.save(),(n||r)&&u.translate(-1*n,-1*r),e.drawScene(l,void 0,p),u.restore(),l}function G_(){return{sceneCanvas:new uo({width:1,height:1,pixelRatio:1}),bufferCanvas:new uo({width:1,height:1,pixelRatio:1})}}var K_=({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}},q_=({px:e,precious:t=2,dpi:n=72,unit:r=`px`})=>parseFloat(K_({px:e,dpi:n,unit:r}).toFixed(t)),J_=({unitVal:e,dpi:t,unit:n})=>e/K_({px:1,unit:n,dpi:t}),Y_=e=>{let t=parseFloat(K_(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 X_(e){for(let t=0;t<30;t++){let t=await e();if(t)return t;await new Promise(e=>setTimeout(e,50))}}var Z_=Z_||{};Z_.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)}else throw Error(`Invalid node.`)}};return function(t){return e.visit(t)}})();var Z_=Z_||{};Z_.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&&(se(e.comma)||n(`Missing comma before color stops`)),{type:t,orientation:a,colorStops:S(C)}})}function s(t,r){var i=se(t);if(i){se(e.startCall)||n(`Missing (`);var a=r(i);return se(e.endCall)||n(`Missing )`),a}}function c(){var t=d();if(t)return t;var n=N(`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(N(`from`,/^from/,0)){var e=f();return e||n(`Missing angle after "from" in conic-gradient`),e}}function d(){return N(`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=se(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,se(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=N(`shape`,/^(circle)/i,0);return e&&(e.style=oe()||v()),e}function _(){var e=N(`shape`,/^(ellipse)/i,0);return e&&(e.style=b()||re()||v()),e}function v(){return N(`extent-keyword`,e.extentKeywords,1)}function y(){if(N(`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:re(),y:re()}}function S(t){var r=t(),i=[];if(r)for(i.push(r);se(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=re(),e.length&&(e.length2=re()),e}function w(){return E()||te()||A()||ee()||D()||k()||T()}function T(){return N(`literal`,e.literalColor,0)}function E(){return N(`hex`,e.hexColor,1)}function D(){return s(e.rgbColor,function(){return O(`rgb`)})}function ee(){return s(e.rgbaColor,function(){return O(`rgba`)})}function O(t){var n=M();if(se(e.comma)){var r=M();se(e.comma);var i=M(),a=[n,r,i];return se(e.comma)?(a.push(M()),{type:`rgba`,value:a}):{type:t,value:a}}else{var r=M(),i=M(),a=[n,r,i];return se(e.slash)?(a.push(M()),{type:`rgba`,value:a}):{type:t,value:a}}}function k(){return s(e.varColor,function(){return{type:`var`,value:j()}})}function A(){return s(e.hslColor,function(){return ne(`hsl`)})}function te(){return s(e.hslaColor,function(){return ne(`hsla`)})}function ne(t){se(e.percentageValue)&&n(`HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage`);var r=M();if(se(e.comma)){var i=se(e.percentageValue),a=i?i[1]:null;se(e.comma),i=se(e.percentageValue);var o=i?i[1]:null;if((!a||!o)&&n(`Expected percentage value for saturation and lightness in HSL`),se(e.comma)){var s=M();return{type:`hsla`,value:[r,a,o,s]}}return{type:t,value:[r,a,o]}}else{var i=se(e.percentageValue),a=i?i[1]:null;i=se(e.percentageValue);var o=i?i[1]:null;if((!a||!o)&&n(`Expected percentage value for saturation and lightness in HSL`),se(e.slash)){var s=M();return{type:`hsla`,value:[r,a,o,s]}}return{type:t,value:[r,a,o]}}}function j(){return se(e.variableName)[1]}function M(){return se(e.number)[1]}function re(){return N(`%`,e.percentageValue,1)||ie()||ae()||oe()}function ie(){return N(`position-keyword`,e.positionKeywords,1)}function ae(){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 ce(r-1),{type:`calc`,value:a}})}function oe(){return N(`px`,e.pixelValue,1)||N(`em`,e.emValue,1)||N(`rem`,e.remValue,1)||N(`vw`,e.vwValue,1)||N(`vh`,e.vhValue,1)||N(`vmin`,e.vminValue,1)||N(`vmax`,e.vmaxValue,1)||N(`ch`,e.chValue,1)||N(`ex`,e.exValue,1)}function N(e,t,n){var r=se(t);if(r)return{type:e,value:r[n]}}function se(e){var n,r=/^[\n\r\t\s]+/.exec(t);return r&&ce(r[0].length),n=e.exec(t),n&&ce(n[0].length),n}function ce(e){t=t.substring(e)}return function(e){return t=e.toString().trim(),t.endsWith(`;`)&&(t=t.slice(0,-1)),r()}})(),Z_.parse,Z_.stringify;var Q_={parse:Z_.parse,stringify:Z_.stringify},$_=e=>e.indexOf(`linear-gradient`)>=0,ev=e=>e.type===`hex`?`#`+e.value:e.type===`literal`?e.value:`${e.type}(${e.value.join(`,`)})`,tv=e=>{if(!$_(e))return{rotation:0,stops:[{offset:0,color:e},{offset:1,color:e}]};let t=Q_.parse(e)[0];return{rotation:t.orientation&&`value`in t.orientation?parseFloat(t.orientation.value):0,stops:t.colorStops.map((e,n)=>({color:ev(e),offset:e.length?parseFloat(e.length.value)/100:n/(t.colorStops.length-1)}))}},nv=o(((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(` `)+`
|
|
49
|
-
`)}})),rv=o(((e,t)=>{var n=!1,r=!1,i=nv()(`lex`);e=t.exports=a;function a(e){var t,a=``,o,s=0,c=-1,l=0,u=1,d=`before-selector`,f=[d],p={},m=[],h=[`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 g(){return T(),e[c]}function _(e){return e?f[f.length-1-e]:d}function v(t){var n=c+1;return t===e.slice(n,n+t.length)}function y(t){var n=e.slice(c).indexOf(t);return n>0?n:!1}function b(e){return e===x(1)}function x(t){return e[c+(t||1)]}function S(){var e=f.pop();return d=f[f.length-1],e}function C(e){return d=e,f.push(d),f.length}function w(e){var t=d;return f[f.length-1]=d=e,t}function T(t){if((t||1)==1)e[c]==`
|
|
50
|
-
`?(u++,s=1):s++,c++;else{var n=e.slice(c,c+t).split(`
|
|
51
|
-
`);n.length>1&&(u+=n.length-1,s=1),s+=n[n.length-1].length,c+=t}}function E(){p.end={line:u,col:s},n&&i(`addToken:`,JSON.stringify(p,null,2)),m.push(p),a=``,p={}}function D(e){p={type:e,start:{line:u,col:s}}}for(r&&(t=Date.now());o=g();)switch(n&&i(o,_()),o){case` `:switch(_()){case`selector`:case`value`:case`value-paren`:case`at-group`:case`at-value`:case`comment`:case`double-string`:case`single-string`:a+=o;break}break;case`
|
|
52
|
-
`:case` `:case`\r`:case`\f`:switch(_()){case`value`:case`value-paren`:case`at-group`:case`comment`:case`single-string`:case`double-string`:case`selector`:a+=o;break;case`at-value`:o===`
|
|
53
|
-
`&&(p.value=a.trim(),E(),S());break}break;case`:`:switch(_()){case`name`:p.name=a.trim(),a=``,w(`before-value`);break;case`before-selector`:a+=o,D(`selector`),C(`selector`);break;case`before-value`:w(`value`),a+=o;break;default:a+=o;break}break;case`;`:switch(_()){case`name`:case`before-value`:case`value`:a.trim().length>0&&(p.value=a.trim(),E()),w(`before-name`);break;case`value-paren`:a+=o;break;case`at-value`:p.value=a.trim(),E(),S();break;case`before-name`:break;default:a+=o;break}break;case`{`:switch(_()){case`selector`:if(x(-1)===`\\`){a+=o;break}p.text=a.trim(),E(),w(`before-name`),l+=1;break;case`at-group`:switch(p.name=a.trim(),p.type){case`font-face`:case`viewport`:case`page`:C(`before-name`);break;default:C(`before-selector`)}E(),l+=1;break;case`name`:case`at-rule`:p.name=a.trim(),E(),C(`before-name`),l+=1;break;case`comment`:case`double-string`:case`single-string`:a+=o;break;case`before-value`:w(`value`),a+=o;break}break;case`}`:switch(_()){case`before-name`:case`name`:case`before-value`:case`value`:a&&(p.value=a.trim()),p.name&&p.value&&E(),D(`end`),E(),S(),_()===`at-group`&&(D(`at-group-end`),E(),S()),l>0&&--l;break;case`at-group`:case`before-selector`:case`selector`:if(x(-1)===`\\`){a+=o;break}l>0&&_(1)===`at-group`&&(D(`at-group-end`),E()),l>1&&S(),l>0&&--l;break;case`double-string`:case`single-string`:case`comment`:a+=o;break}break;case`"`:case`'`:switch(_()){case`double-string`:o===`"`&&x(-1)!==`\\`&&S();break;case`single-string`:o===`'`&&x(-1)!==`\\`&&S();break;case`before-at-value`:w(`at-value`),C(o===`"`?`double-string`:`single-string`);break;case`before-value`:w(`value`),C(o===`"`?`double-string`:`single-string`);break;case`comment`:break;default:x(-1)!==`\\`&&C(o===`"`?`double-string`:`single-string`)}a+=o;break;case`/`:switch(_()){case`comment`:case`double-string`:case`single-string`:a+=o;break;case`before-value`:case`selector`:case`name`:case`value`:if(b(`*`)){var ee=y(`*/`);ee&&T(ee+1)}else _()==`before-value`&&w(`value`),a+=o;break;default:b(`*`)?(D(`comment`),C(`comment`),T()):a+=o;break}break;case`*`:switch(_()){case`comment`:b(`/`)?(p.text=a,T(),E(),S()):a+=o;break;case`before-selector`:a+=o,D(`selector`),C(`selector`);break;case`before-value`:w(`value`),a+=o;break;default:a+=o}break;case`@`:switch(_()){case`comment`:case`double-string`:case`single-string`:a+=o;break;case`before-value`:w(`value`),a+=o;break;default:for(var O=!1,k,A,te=0,ne=h.length;!O&&te<ne;++te)A=h[te],k=A.name||A,v(k)&&(O=!0,D(k),C(A.state||`at-group`),T(k.length),A.prefix&&(p.prefix=A.prefix),A.type&&(p.type=A.type));O||(a+=o);break}break;case`(`:switch(_()){case`value`:C(`value-paren`);break;case`before-value`:w(`value`);break}a+=o;break;case`)`:switch(_()){case`value-paren`:S();break;case`before-value`:w(`value`);break}a+=o;break;default:switch(_()){case`before-selector`:D(`selector`),C(`selector`);break;case`before-name`:D(`property`),w(`name`);break;case`before-value`:w(`value`);break;case`before-at-value`:w(`at-value`);break}a+=o;break}return r&&i(`ran in`,Date.now()-t+`ms`),m}})),iv=o(((e,t)=>{var n=!1,r=!1,i=nv()(`parse`),a=rv();e=t.exports=u;var o,s,c,l;function u(e,t){var n;t||={},o=!!t.comments,c=!!t.position,s=0,l=Array.isArray(e)?e.slice():a(e);var u,d=[],p;for(r&&(n=Date.now());p=f();)u=b(p),u&&d.push(u);return r&&i(`ran in`,Date.now()-n+`ms`),{type:`stylesheet`,stylesheet:{rules:d}}}function d(e,t){t||={};for(var r,a=[`type`,`name`,`value`],o={},s=0;s<a.length;++s)r=a[s],e[r]&&(o[r]=t[r]||e[r]);for(a=Object.keys(t),s=0;s<a.length;++s)r=a[s],o[r]||(o[r]=t[r]);return c&&(o.position={start:e.start,end:e.end}),n&&i(`astNode:`,JSON.stringify(o,null,2)),o}function f(){var e=l.shift();return n&&i(`next:`,JSON.stringify(e,null,2)),e}function p(e){s+=1;var t={};switch(e.type){case`font-face`:case`viewport`:t.declarations=S();break;case`page`:t.prefix=e.prefix,t.declarations=S();break;default:t.prefix=e.prefix,t.rules=C()}return d(e,t)}function m(e){return d(e)}function h(e){return d(e)}function g(e){return d(e,{text:e.text})}function _(e){return d(e)}function v(e){return d(e)}function y(e){function t(e){return e.trim()}return d(e,{type:`rule`,selectors:e.text.split(`,`).map(t),declarations:S(e)})}function b(e){switch(e.type){case`property`:return v(e);case`selector`:return y(e);case`at-group-end`:--s;return;case`media`:case`keyframes`:return p(e);case`comment`:if(o)return g(e);break;case`charset`:return h(e);case`import`:return m(e);case`namespace`:return _(e);case`font-face`:case`supports`:case`viewport`:case`document`:case`page`:return p(e)}n&&i(`parseToken: unexpected token:`,JSON.stringify(e))}function x(e){for(var t,n=[],r;(r=f())&&e&&e(r);)t=b(r),t&&n.push(t);return r&&r.type!==`end`&&l.unshift(r),n}function S(){return x(function(e){return e.type===`property`||e.type===`comment`})}function C(){return x(function(){return s})}})),av=o(((e,t)=>{var n=!1,r=!1,i=nv()(`stringify`),a,o,s,c,l,u;e=t.exports=d;function d(e,t){var n;t||={},s=t.indentation||``,o=!!t.compress,a=!!t.comments,c=1,o?l=u=``:(l=`
|
|
54
|
-
`,u=` `),r&&(n=Date.now());var d=_(e.stylesheet.rules,x).join(`
|
|
55
|
-
`).trim();return r&&i(`ran in`,Date.now()-n+`ms`),d}function f(e){if(e){c+=e;return}return o?``:Array(c).join(s||``)}function p(e){return`@`+e.type+` `+e.value+`;`+l}function m(e){var t=``,n=e.prefix||``;e.name&&(t=` `+e.name);var r=e.type!==`page`;return`@`+n+e.type+t+u+v(e,r)+l}function h(e){return a?`/*`+(e.text||``)+`*/`+l:``}function g(e){var t;return e.selectors?t=e.selectors.join(`,`+l):(t=`@`+e.type,t+=e.name?` `+e.name:``),f()+t+u+v(e)+l}function _(e,t){return e.reduce(function(e,n){var r=n.type===`comment`?h(n):t(n);return r&&e.push(r),e},[])}function v(e,t){var n=e.declarations,r=b;return e.rules&&(n=e.rules,r=g),n=y(n,r),n&&=l+n+(t?``:l),`{`+n+f()+`}`}function y(e,t){if(!e)return``;f(1);var n=_(e,t);return f(-1),n.length?n.join(l):``}function b(e){if(e.type===`property`)return S(e);n&&i(`stringifyDeclaration: unexpected node:`,JSON.stringify(e))}function x(e){switch(e.type){case`rule`:return g(e);case`media`:case`keyframes`:return m(e);case`comment`:return h(e);case`import`:case`charset`:case`namespace`:return p(e);case`font-face`:case`supports`:case`viewport`:case`document`:case`page`:return m(e)}n&&i(`stringifyNode: unexpected node: `+JSON.stringify(e))}function S(e){var t=e.name?e.name+`:`+u:``;return f()+t+e.value+`;`}})),ov=l(o(((e,t)=>{t.exports={lex:rv(),parse:iv(),stringify:av()}}))(),1);function sv(e){for(;e.parentNode;){if(e.nodeName===`defs`)return!0;e=e.parentNode}return!1}function cv(e){let t={};return e.querySelectorAll(`style`).forEach(e=>{let n=ov.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 lv(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=Object.assign(Object.assign({},a),t[`.${e}`]))}),t[e.nodeName]&&(a=Object.assign(Object.assign({},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?lv(r,t):null;i?.fill===`currentColor`||i?.stroke===`currentColor`||(n.fill=`black`)}return n}var uv=[`path`,`rect`,`circle`,`line`,`polygon`,`polyline`,`ellipse`,`text`];function dv(e){for(var t=[],n=e.getElementsByTagName(`*`),r=0,i=n.length;r<i;r++){let e=n[r];sv(e)||(e.getAttribute(`fill`)!==null&&t.push(e),(e.getAttribute(`stroke`)!==null||e.style&&e.style.fill||uv.indexOf(e.nodeName)>=0)&&t.push(e))}return t}async function fv(e){return mv(await(await fetch(e)).text())}async function pv(e){return await(await fetch(e,{mode:`cors`})).text()}function mv(e){return`data:image/svg+xml;base64,`+window.btoa(unescape(encodeURIComponent(e)))}function hv(e){var t=new DOMParser().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`)),new XMLSerializer().serializeToString(t)}var gv=(e,t)=>{if(!e||!t)return!1;if(t===`currentColor`&&e===`black`)return!0;let n=G.Util.colorToRGBA(e),r=G.Util.colorToRGBA(t);return n&&r?n.r===r.r&&n.g===r.g&&n.b===r.b&&n.a===r.a:void 0};function _v(e,t){var n=new DOMParser().parseFromString(e,`image/svg+xml`);let r=dv(n),i=Array.from(t.keys()),a=cv(n);return r.forEach(e=>{let{fill:r,stroke:o}=lv(e,a);[{prop:`fill`,color:r},{prop:`stroke`,color:o}].forEach(({prop:r,color:a})=>{let o=i.find(e=>gv(e,a));if(o){let i=t.get(o);if($_(i)){let{rotation:t,stops:a}=tv(i),o=a.map(e=>({offset:100*e.offset+`%`,"stop-color":e.color})),s=`color`+Math.round(1e8*Math.random());(function(e,t,n,r){var i=e.namespaceURI,a=document.createElementNS(i,`linearGradient`);let o=G.Util.degToRad(n+90),s=(Math.cos(o)+1)/2,c=(Math.sin(o)+1)/2,l=(Math.cos(o+Math.PI)+1)/2,u=(Math.sin(o+Math.PI)+1)/2;a.setAttribute(`x1`,100*s+`%`),a.setAttribute(`y1`,100*c+`%`),a.setAttribute(`x2`,100*l+`%`),a.setAttribute(`y2`,100*u+`%`),a.setAttribute(`gradientUnits`,`userSpaceOnUse`),a.setAttribute(`id`,t);for(var d=0;d<r.length;d++){var f=r[d],p=document.createElementNS(i,`stop`);for(var m in f)f.hasOwnProperty(m)&&p.setAttribute(m,f[m]);a.appendChild(p)}(e.querySelector(`defs`)||e.insertBefore(document.createElementNS(i,`defs`),e.firstChild)).appendChild(a)})(n.children[0],s,t,o),e.style[r]=null,e.setAttribute(r,`url('#${s}')`)}else e.style[r]=t.get(o)}})}),mv(new XMLSerializer().serializeToString(n))}function vv(e){return new Promise((t,n)=>{let r=document.createElement(`img`);r.onload=()=>{t(r)},r.onerror=e=>{n(e)},r.crossOrigin=`anonymous`,r.src=e})}async function yv(e,t){let n=await vv(e),r=document.createElement(`canvas`);r.width=2*n.width,r.height=2*n.height,r.getContext(`2d`).drawImage(n,0,0,r.width,r.height);let i=document.createElement(`canvas`);i.width=t.width,i.height=t.height;let a=i.getContext(`2d`),{cropX:o,cropY:s}=t,c=r.width*t.cropWidth,l=r.height*t.cropHeight,u=t.width/t.height,d,f,p=c/l;return t.type===`svg`?(d=c,f=l):u>=p?(d=c,f=c/u):(d=l*u,f=l),a.drawImage(r,o*r.width,s*r.height,d,f,0,0,i.width,i.height),i.toDataURL(`image/png`)}function bv(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 xv=({width:e,height:t,cornerRadius:n})=>{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`},Sv=({width:e,height:t})=>`M ${e/2} 0 L ${e} ${t} L 0 ${t} Z`,Cv=({width:e,height:t})=>`M 0 0 L ${e} 0 L 0 ${t} Z`,wv=({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 Tv({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?a:s,u=n+(e%2==0?i:o)*Math.sin(e*l),d=r-t*Math.cos(e*l);e===0?c=`M ${u} ${d}`:c+=` L ${u} ${d}`}return c+` Z`}function Ev({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 Dv({width:e,height:t}){let n=e/2,r=t/2,i=e/2,a=t/2,o=``,s=2*Math.PI/5;for(let e=0;e<5;e++){let t=a,c=n+i*Math.sin(e*s),l=r-t*Math.cos(e*s);e===0?o=`M ${c} ${l}`:o+=` L ${c} ${l}`}return o+` Z`}function Ov({width:e,height:t}){let n=e/2,r=t/2,i=e/2,a=t/2,o=``,s=2*Math.PI/6;for(let e=0;e<6;e++){let t=a,c=n+i*Math.sin(e*s),l=r-t*Math.cos(e*s);e===0?o=`M ${c} ${l}`:o+=` L ${c} ${l}`}return o+` Z`}function J({path:e,aspectRatio:t,width:n,height:r}){return{path:e,scaleX:n/t.width,scaleY:r/t.height}}function kv({width:e,height:t}){let n=.1*Math.min(e,t),r=.2*e,i=.2*t,a=.5*e,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 Av({width:e,height:t}){let n=.3*e,r=.3*t,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 jv={rect:xv,circle:wv,star:Tv,triangle:Sv,rightTriangle:Cv,diamond:Ev,pentagon:Dv,hexagon:Ov,speechBubble:kv,cross:Av,arc:({width:e,height:t})=>J({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})=>J({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=.6*e;return`M 0 ${t/4} L ${n} ${t/4} L ${n} 0 L ${e} ${t/2} L ${n} ${t} L ${n} ${.75*t} L 0 ${.75*t} Z`},leftArrow:({width:e,height:t})=>{let n=.4*e;return`M ${e} ${t/4} L ${n} ${t/4} L ${n} 0 L 0 ${t/2} L ${n} ${t} L ${n} ${.75*t} L ${e} ${.75*t} Z`},downArrow:({width:e,height:t})=>{let n=.6*t;return`M ${e/4} 0 L ${e/4} ${n} L 0 ${n} L ${e/2} ${t} L ${e} ${n} L ${.75*e} ${n} L ${.75*e} 0 Z`},upArrow:({width:e,height:t})=>{let n=.4*t;return`M ${e/4} ${t} L ${e/4} ${n} L 0 ${n} L ${e/2} 0 L ${e} ${n} L ${.75*e} ${n} L ${.75*e} ${t} Z`},asterisk1:({width:e,height:t})=>J({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})=>J({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})=>J({path:`M0 0H199V238L99.5 142.8L0 238V0Z`,aspectRatio:{width:199,height:238},width:e,height:t}),butterfly:({width:e,height:t})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({path:`M0 0H240L200 88L240 176H0L40 88L0 0Z`,aspectRatio:{width:240,height:176},width:e,height:t}),heart1:({width:e,height:t})=>J({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})=>J({path:`M0 62.143L95.5 0L191 62.143V195H0V62.143Z`,aspectRatio:{width:191,height:195},width:e,height:t}),home2:({width:e,height:t})=>J({path:`M206 94.076L103 0L0 94.076H31.2377V189H175.607V94.076H206Z`,aspectRatio:{width:206,height:189},width:e,height:t}),hourglass:({width:e,height:t})=>J({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})=>J({path:`M0 92.367L95 0L190 92.367V223H0V92.367Z`,aspectRatio:{width:190,height:223},width:e,height:t}),keyhole:({width:e,height:t})=>J({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})=>J({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})=>J({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})=>J({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})=>J({path:`M126 0H43L0 120.531H36L6 227L110 80.354H73L126 0Z`,aspectRatio:{width:126,height:227},width:e,height:t}),magnet:({width:e,height:t})=>J({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})=>J({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})=>J({path:`M69 0H0V69V138V207H69H138V138H69V69V0Z`,aspectRatio:{width:138,height:207},width:e,height:t}),party:({width:e,height:t})=>J({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})=>J({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})=>J({path:`M110 0L219.119 63V189L110 252L0.880798 189V63L110 0Z`,aspectRatio:{width:220,height:252},width:e,height:t}),rainbow:({width:e,height:t})=>J({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})=>J({path:`M69 0H0V69V138H69V207H138V138V69H69V0Z`,aspectRatio:{width:138,height:207},width:e,height:t}),shell:({width:e,height:t})=>J({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})=>J({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})=>J({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})=>J({path:`M85.9799 0H290L204.02 141H0L85.9799 0Z`,aspectRatio:{width:290,height:141},width:e,height:t}),softFlower:({width:e,height:t})=>J({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})=>J({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})=>J({path:`M0 0H67.667V67.667H135.333V135.333H203V203H0V0Z`,aspectRatio:{width:203,height:203},width:e,height:t}),stairs2:({width:e,height:t})=>J({path:`M50 0H0V200H200V150H150V100H100V50H50V0Z`,aspectRatio:{width:200,height:200},width:e,height:t}),teewee:({width:e,height:t})=>J({path:`M69 0H138V69H207V138H138H69H0V69H69V0Z`,aspectRatio:{width:207,height:138},width:e,height:t}),blob1:({width:e,height:t})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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})=>J({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 Mv(e){return jv[e]||xv}function Nv(e){let{subType:t}=e,n=e,r=Mv(t);return r?function(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=1,d=1;typeof l!=`string`&&(u=l.scaleX,d=l.scaleY,l=l.path);let f=`clip-${e.id||Math.random()}`;return`\n <svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${r}">\n <defs>\n <clipPath id="${f}">\n <path d="${l}" />\n </clipPath>\n </defs>\n\n \x3c!-- Path for the fill --\x3e\n <path d="${l}" fill="${i}" transform="scale(${u}, ${d})"/>\n\n \x3c!-- Path for the stroke, clipped by the star path --\x3e\n <path d="${l}" fill="none" stroke="${a}" stroke-width="${2*o}" clip-path="url(#${f})" transform="scale(${u}, ${d})" stroke-dasharray="${c.join(` `)}"/>\n </svg>\n `}(n,r):(console.error(`Polotno error: Can not convert ${e.subType} figure to svg.`),xv(n))}var Pv=`
|
|
56
|
-
p {
|
|
57
|
-
margin: 0;
|
|
58
|
-
padding: 0;
|
|
59
|
-
word-wrap: break-word; /* Required for Firefox */
|
|
60
|
-
/* a text may have several spaces, we need to preserve them */
|
|
61
|
-
white-space: pre-wrap;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/* Reset default list styles and setup counters */
|
|
65
|
-
ul, ol {
|
|
66
|
-
list-style: none; /* Remove default markers */
|
|
67
|
-
padding-inline-start: 0; /* Reset padding */
|
|
68
|
-
margin: 0;
|
|
69
|
-
display: block; /* Use block instead of inline-block for better text wrapping */
|
|
70
|
-
width: 100%;
|
|
71
|
-
text-decoration: inherit;
|
|
72
|
-
counter-reset: ol-counter; /* Initialize counter for ol */
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
li {
|
|
76
|
-
position: relative; /* Needed for absolute positioning of ::before */
|
|
77
|
-
padding-inline-start: 2.1em; /* Space for the marker (start side) */
|
|
78
|
-
margin: 0; /* Reset default li margins */
|
|
79
|
-
word-wrap: break-word; /* Required for Firefox text wrapping */
|
|
80
|
-
white-space: pre-wrap; /* Preserve spaces and allow wrapping */
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
li::before {
|
|
84
|
-
content: ''; /* Base content */
|
|
85
|
-
position: absolute;
|
|
86
|
-
/* Use logical properties for positioning */
|
|
87
|
-
inset-inline-start: 0; /* Position marker at the start edge (left in LTR, right in RTL) */
|
|
88
|
-
top: 0; /* Adjust vertical alignment */
|
|
89
|
-
/* Prevent letter-spacing from affecting the marker */
|
|
90
|
-
letter-spacing: normal;
|
|
91
|
-
/* Define width to ensure consistent spacing and alignment */
|
|
92
|
-
display: inline-block;
|
|
93
|
-
width: 2em; /* Width for the marker container */
|
|
94
|
-
/* Align multi-digit numbers to the end (right in LTR, left in RTL) */
|
|
95
|
-
text-align: end;
|
|
96
|
-
/* Space between marker and text (using logical property) */
|
|
97
|
-
margin-inline-end: 0.8em; /* Pushes text away from marker (2.5em total = 1.7em width + 0.8em margin)*/
|
|
98
|
-
/* Prevent marker style from inheriting list item styles */
|
|
99
|
-
font-weight: normal;
|
|
100
|
-
font-style: normal;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/* Style for bullet points */
|
|
104
|
-
ul > li::before {
|
|
105
|
-
content: '•'; /* Literal bullet character */
|
|
106
|
-
/* Center the bullet within its allocated width */
|
|
107
|
-
text-align: center; /* Override text-align: end for bullets */
|
|
108
|
-
font-size: 1.2em;
|
|
109
|
-
top: 0em; /* Re-adjust vertical alignment for bullet */
|
|
110
|
-
/* Bullets don't need number alignment, width can be tighter */
|
|
111
|
-
width: 2em;
|
|
112
|
-
/* Adjust margin to maintain overall padding */
|
|
113
|
-
margin-inline-end: 1.5em; /* 2.5em total padding = 1em width + 1.5em margin */
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/* Style for numbers using counter */
|
|
117
|
-
ol > li {
|
|
118
|
-
counter-increment: ol-counter; /* Increment counter for each li in ol */
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
ol > li::before {
|
|
122
|
-
content: counter(ol-counter) "."; /* Display counter value + dot */
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.ql-indent-1 {
|
|
126
|
-
margin-inline-start: 0.5em;
|
|
127
|
-
}
|
|
128
|
-
.ql-indent-2 {
|
|
129
|
-
margin-inline-start: 1em;
|
|
130
|
-
}
|
|
131
|
-
.ql-indent-3 {
|
|
132
|
-
margin-inline-start: 1.5em;
|
|
133
|
-
}
|
|
134
|
-
`,Fv=`\n<style>\n html, body {\n padding: 0;\n margin: 0;\n }\n ${Pv}\n</style>\n`,Iv;(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`})(Iv||={});function Lv(e,t){let n={filter:``,html:void 0};switch(e){case Iv.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=`\n <svg xmlns="http://www.w3.org/2000/svg" style="display:none">\n <filter id="warm-filter" color-interpolation-filters="sRGB">\n <feColorMatrix type="matrix" values="\n ${r} 0 0 0 0\n 0 ${i} 0 0 0\n 0 0 1 0 0\n 0 0 0 1 0" />\n </filter>\n </svg>`,n}case Iv.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=`\n <svg xmlns="http://www.w3.org/2000/svg" style="display:none">\n <filter id="cold-filter" color-interpolation-filters="sRGB">\n <feColorMatrix type="matrix" values="\n ${r} 0 0 0 0\n 0 ${i} 0 0 0\n 0 0 ${a} 0 0\n 0 0 0 1 0" />\n </filter>\n </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 Iv.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=`\n <svg xmlns="http://www.w3.org/2000/svg" style="display:none">\n <filter id="temperature-filter" color-interpolation-filters="sRGB">\n <feColorMatrix type="matrix" values="\n ${r} 0 0 0 0\n 0 1 0 0 0\n 0 0 ${i} 0 0\n 0 0 0 1 0" />\n </filter>\n </svg>\n `,n}case Iv.contrast:{let e=100*Math.max(-1,Math.min(1,t??0)),r=259*(e+255)/(255*(259-e)),i=.5*(1-r);return n.filter=`url(#contrast-filter)`,n.html=`\n <svg xmlns="http://www.w3.org/2000/svg" style="display:none">\n <filter id="contrast-filter" color-interpolation-filters="sRGB">\n <feComponentTransfer>\n <feFuncR type="linear" slope="${r}" intercept="${i}" />\n <feFuncG type="linear" slope="${r}" intercept="${i}" />\n <feFuncB type="linear" slope="${r}" intercept="${i}" />\n </feComponentTransfer>\n </filter>\n </svg>\n `,n}case Iv.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=`\n <svg xmlns="http://www.w3.org/2000/svg" style="display:none">\n <filter id="shadows-filter" color-interpolation-filters="sRGB">\n <feComponentTransfer>\n <feFuncR type="gamma" amplitude="1" exponent="${e}" offset="0" />\n <feFuncG type="gamma" amplitude="1" exponent="${e}" offset="0" />\n <feFuncB type="gamma" amplitude="1" exponent="${e}" offset="0" />\n </feComponentTransfer>\n </filter>\n </svg>\n `,n}case Iv.white:case Iv.black:return null;case Iv.vibrance:{let e=Math.max(-1,Math.min(1,t??0)),r=.299,i=.587,a=.114,o;o=e>=0?1+1.5*e: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=`\n <svg xmlns="http://www.w3.org/2000/svg" style="display:none">\n <filter id="vibrance-filter" color-interpolation-filters="sRGB">\n <feColorMatrix type="matrix" values="\n ${c} ${l} ${u} 0 0\n ${d} ${f} ${p} 0 0\n ${m} ${h} ${g} 0 0\n 0 0 0 1 0" />\n </filter>\n </svg>\n `,n}case Iv.saturation:{let e=.2126,r=.7152,i=.0722,a=1+Math.max(-1,Math.min(1,t??0)),o=1-a,s=o*e+a,c=o*r,l=o*i,u=o*e,d=o*r+a,f=o*i,p=o*e,m=o*r,h=o*i+a;return n.filter=`url(#saturation-filter)`,n.html=`\n <svg xmlns="http://www.w3.org/2000/svg" style="display:none">\n <filter id="saturation-filter" color-interpolation-filters="sRGB">\n <feColorMatrix type="matrix" values="\n ${s} ${c} ${l} 0 0\n ${u} ${d} ${f} 0 0\n ${p} ${m} ${h} 0 0\n 0 0 0 1 0" />\n </filter>\n </svg>\n `,n}default:return null}}async function Rv(e){return new Promise((t,n)=>{let r=document.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(Error(`Failed to load video: ${r}`))})})}function zv(e){return e/180*Math.PI}function Bv(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 Vv(e){let{x:t,y:n,width:r,height:i}=e,a=zv(e.rotation),o=Bv(t,n,0,0,a),s=Bv(t,n,r,0,a),c=Bv(t,n,r,i,a),l=Bv(t,n,0,i,a),u=Math.min(o.x,s.x,c.x,l.x),d=Math.min(o.y,s.y,c.y,l.y),f=Math.max(o.x,s.x,c.x,l.x),p=Math.max(o.y,s.y,c.y,l.y);return{x:u,y:d,width:f-u,height:p-d,minX:u,minY:d,maxX:f,maxY:p}}function Hv(e){let t=e.map(e=>Vv(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 Uv(e){let t=zv(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 Wv(e,t,n){let r=zv(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 Gv(e,t){return Wv(e,t,Uv(e))}var Kv=q.model(`Page`,{id:q.identifier,children:q.array(q.late(()=>Py)),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,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 ap(e,Ux)}})).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}})).views(e=>({get computedWidth(){return e.width===`auto`?e.store.width:e.width},get computedHeight(){return e.height===`auto`?e.store.height:e.height}})).actions(e=>({toJSON:()=>JSON.parse(JSON.stringify(np(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=xg(10);r.set(t,n),e.id=n,jy(e,e=>{let t=e.id,n=xg(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:xg(10)}),t),a=e.store.addPage(i),o=e.store.pages.indexOf(e);return a.setZIndex(o+1),a.select(),a},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=Ly[t.type];if(!r){console.error(`Can not find model with type `+t.type);return}`children`in t&&Array.isArray(t.children)&&jy(t,e=>{e.id=e.id||xg(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:xg(10),name:`${t.type}-${i+1}`},t));return e.children.push(a),a.selectable&&!n&&e.store.selectElements([a.id]),a}},My(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;Ay(e,e=>{e.type!==`group`&&(i(e)||r.push(e))});let a=r.length?Hv(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*_;Ay(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})}})),qv=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 ap(e,Kv)},get store(){return ap(e,Ux)},get top(){let t=e;for(;;){if(!ip(t,Fy))return t;t=ap(t,Fy)}},get parent(){if(ip(e,Fy)){let t=ap(e,Fy);return t&&t.children&&t.children.length,t}if(ip(e,Kv)){let t=ap(e,Kv);return t&&t.children&&t.children.length,t}if(ip(e,Ux)){let t=ap(e,Ux);return t&&t.pages&&t.pages.length,t}return null},get zIndex(){return e.parent.children.indexOf(e)}})).actions(e=>({toJSON:()=>Object.assign({},np(e))})).actions(e=>({clone(t={},{skipSelect:n=!1}={}){let r=JSON.parse(JSON.stringify(e.toJSON()));t.id=t.id||xg(10);let i=new Map;return jy(r,e=>{let t=e.id,n=xg(10);i.set(t,n),e.id=n}),jy(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(){}})),Jv={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}}},Yv={right:{cropX:-1},left:{cropX:1},up:{cropY:1},down:{cropY:-1}},Xv={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 Gv({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=Jv[n.data.direction]||Jv.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=Yv[n.data.direction||`right`]||Yv.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}},Zv=({element:e,dTime:t,animation:n})=>{let r=Xv[n.name];return r?r({element:e,dTime:t,animation:n}):(console.error(`Can not find animation type: `+n.name),{})},Qv=q.model(`Animation`,{delay:0,duration:500,enabled:!0,type:q.enumeration(`Type`,[`enter`,`exit`,`loop`]),name:`none`,data:q.frozen({})}),$v=(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},ey=q.model(`ShapeFilter`,{intensity:1}),ty=[`temperature`,`contrast`,`highlights`,`shadows`,`white`,`black`,`saturation`,`vibrance`],ny=qv.named(`Shape`).props({x:0,y:0,width:100,height:100,rotation:0,opacity:1,animations:q.array(Qv),blurEnabled:!1,blurRadius:10,brightnessEnabled:!1,brightness:0,sepiaEnabled:!1,grayscaleEnabled:!1,filters:q.map(ey),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,r={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 i of t)i in e&&(r[i]=n[i]);let i=It(r),a=Xn(e=>{for(let t in e)i[t]=e[t]}),o=Xn(e=>{Object.assign(i,e)}),s=Xn(e=>{for(let t in e)typeof i[t]==`number`&&(i[t]=i[t]+e[t])});return{get locked(){return!(e.draggable||e.contentEditable||e.styleEditable||e.resizable)},get a(){let{currentTime:t}=e.store,r={};for(let e in i)r[e]=n[e];if(a(r),t===0)return i;let c=t-e.page.startTime;if(c>e.page.duration||c<0)return i;let l=e.store.animatedElementsIds;if(l.length&&!l.includes(e.id))return i;let u=e.animations.find(e=>e.type===`enter`),d=u?.enabled&&c<u.delay;d&&o({opacity:0});let f=u?.enabled&&c>=u.delay&&c<=u.delay+u.duration;f&&s($v(e,Zv({element:e,animation:u,dTime:c-u.delay})));let p=e.animations.find(e=>e.type===`exit`);!d&&!f&&p?.enabled&&c>=e.page.duration-p.duration-p.delay&&c<=e.page.duration-p.delay&&s($v(e,Zv({element:e,animation:p,dTime:c-(e.page.duration-p.duration-p.delay)}))),p!=null&&p.enabled&&c>=e.page.duration-p.delay&&o({opacity:0});let m=e.animations.find(e=>e.type===`loop`);return m?.enabled&&s($v(e,Zv({element:e,animation:m,dTime:c}))),i},animated(e){return this.a[e]},get isSelected(){return!!fp(e)&&e.store.selectedShapes.indexOf(e)>=0&&e.selectable},get isSelectedDirectly(){return!!fp(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){ty.includes(t)||e.filters.forEach((t,n)=>{ty.includes(n.toString())||e.filters.delete(n.toString())}),n==null?e.filters.delete(t):e.filters.set(t,{intensity:n})}})),ry=ny.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`,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=>Object.assign(Object.assign({},e),{fontSize:e.fontSize!=null&&e.fontSize<1?1:e.fontSize})).actions(e=>{let t=e.set;return{set(e){e.fontSize!=null&&e.fontSize<1&&(e=Object.assign(Object.assign({},e),{fontSize:1})),t(e)},afterCreate(){if(!e.height){let t=e.lineHeight,n=typeof t==`number`?t:parseFloat(t)||1.2;e.height=Math.round(e.fontSize*n)}},toggleEditMode(t){let n=t??!e._editModeEnabled;n!==e._editModeEnabled&&(e._editModeEnabled=n,e._editModeEnabled?e.store.history.startTransaction():e.store.history.endTransaction())}}}),iy=ny.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=It.box(!1),n=!1;return{views:{get _cropModeEnabled(){return t.get()}},actions:{toggleCropMode(r){let i=r??!t.get();t.set(i),i&&!n?(e.store.history.startTransaction(),n=!0):!i&&n&&(e.store.history.endTransaction(),n=!1)},beforeDestroy(){n&&=(e.store.history.endTransaction(),!1)}}}}),ay=iy.named(`Video`).props({type:`video`,duration:0,startTime:0,endTime:1,volume:1}),oy=ny.named(`Line`).props({type:`line`,width:400,height:10,color:`black`,dash:q.array(q.number),startHead:``,endHead:``}).actions(e=>({})),sy=ny.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)}})),cy=ny.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}),ly=iy.named(`Gif`).props({type:`gif`,duration:0,keepRatio:!0}),uy=.05,dy=q.enumeration([`solid`,`dashed`,`dotted`,`none`]);function fy(e){return rp(e,2)}function py(e,t,n){return e[`_${t}`]??(fp(e)?fy(e)[t]:n)}function my(e){return rp(e,1)}var hy=q.model(`BorderSide`,{color:q.maybe(q.string),width:q.maybe(q.number),style:q.maybe(dy)}).postProcessSnapshot(e=>{let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=r);return t}),gy=q.model(`CellBorders`,{top:q.maybe(hy),right:q.maybe(hy),bottom:q.maybe(hy),left:q.maybe(hy)}).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}),_y=[`fontSize`,`fontFamily`,`fontWeight`,`fontStyle`,`textDecoration`,`textTransform`,`fill`,`align`,`verticalAlign`,`lineHeight`,`letterSpacing`,`strokeWidth`,`stroke`,`cellBackground`,`cellPadding`],vy=new Set(_y),yy=[`blurEnabled`,`blurRadius`,`brightnessEnabled`,`brightness`,`sepiaEnabled`,`grayscaleEnabled`,`filters`,`shadowEnabled`,`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`,`shadowColor`,`shadowOpacity`],by=[`id`,`type`,`text`,`opacity`,`rowSpan`,`colSpan`,`mergedInto`,`name`,`custom`,`borders`],xy=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(`.`)),Sy={opacity:1,rowSpan:1,colSpan:1,name:``},Cy=[],wy=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(gy),name:``,custom:q.frozen()}).volatile(()=>({_editModeEnabled:!1,filters:It.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 by)n in e&&(t[n]=e[n]);for(let n of _y)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 Sy&&r===Sy[n])continue;t[n]=r}return t}).views(e=>{let t={get row(){if(!fp(e))return 0;let t=fy(e),n=my(e).indexOf(e);return n===-1?0:Math.floor(n/t.cols)},get col(){if(!fp(e))return 0;let t=fy(e),n=my(e).indexOf(e);return n===-1?0:n%t.cols},get store(){return fp(e)?op(e):null},get page(){if(!fp(e))return null;try{return fy(e).page}catch{return null}},get fontSize(){return py(e,`fontSize`,30)},get fontFamily(){return py(e,`fontFamily`,`Roboto`)},get fontWeight(){return py(e,`fontWeight`,`normal`)},get fontStyle(){return py(e,`fontStyle`,`normal`)},get textDecoration(){return py(e,`textDecoration`,``)},get textTransform(){return py(e,`textTransform`,`none`)},get fill(){return py(e,`fill`,`black`)},get align(){return py(e,`align`,`left`)},get verticalAlign(){return py(e,`verticalAlign`,`top`)},get lineHeight(){return py(e,`lineHeight`,1.2)},get letterSpacing(){return py(e,`letterSpacing`,0)},get strokeWidth(){return py(e,`strokeWidth`,0)},get stroke(){return py(e,`stroke`,`black`)},get cellBackground(){return py(e,`cellBackground`,`transparent`)},get cellPadding(){return py(e,`cellPadding`,4)},get width(){if(!fp(e))return 100;try{return fy(e).getCellRect(t.row,t.col,e.rowSpan,e.colSpan).width}catch{return 100}},get height(){if(!fp(e))return 100;try{return fy(e).getCellRect(t.row,t.col,e.rowSpan,e.colSpan).height}catch{return 100}},get borderInsets(){if(!fp(e))return{top:0,right:0,bottom:0,left:0};let n=fy(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(!fp(e))return{x:0,y:0,width:100,height:100,rotation:0,opacity:1,fontSize:16};let n=fy(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=fp(e)?fy(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 Cy}};return t}).actions(e=>({toJSON:()=>Object.assign({},np(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))vy.has(e)?n[`_${e}`]=r:e===`borders`?n.borders=r&&JSON.parse(JSON.stringify(r)):xy.has(e)||(n[e]=r);Object.assign(e,n)},setBorder(t,n){let r=e.borders?Object.assign({},np(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=pp(r)},toggleEditMode(t){let n=t??!e._editModeEnabled;n!==e._editModeEnabled&&(e._editModeEnabled=n,e._editModeEnabled?e.store.history.startTransaction():e.store.history.endTransaction())}}));function Ty(e,t){let n=[];for(let r of e){let e={id:xg(10),text:``};if(!r){n.push(e);continue}for(let t of _y){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]=np(t))}Object.keys(n).length>0&&(e.borders=n)}n.push(e)}return n}function Ey(e){return Array.from({length:e},()=>1/e)}function Dy(e){let t=e.reduce((e,t)=>e+t,0);return t===0?Ey(e.length):e.map(e=>e/t)}var Oy=ny.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(wy),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))vy.has(r)&&i===e[r]||(n[r]=i);return n}));for(let t of yy)delete e[t];return e}).volatile(()=>({_focusedCellIds:[],_editingCellId:void 0,_anchorCellId:void 0,_cellContentHeights:It.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:xg(10),text:``});return n}(e.rows,e.cols));else if(e.cells.length<t)for(;e.cells.length<t;)e.cells.push(pp({id:xg(10),text:``}));else e.cells.length>t&&e.cells.splice(t);e.colWidths.length===0&&e.colWidths.replace(Ey(e.cols)),e.rowHeights.length===0&&e.rowHeights.replace(Ey(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(){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(fp(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=Ty(c,!0);e.cells.splice(l,0,...u),e.rows+=1,e.height=a,e.rowHeights.replace(Dy(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(Dy(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=Ty(c,!1);for(let n=e.rows-1;n>=0;n--)e.cells.splice(n*o+t,0,pp(l[n]));e.cols+=1,e.width=i,e.colWidths.replace(Dy(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(Dy(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(){t._resetBaseRowHeights(),e.rowHeights.replace(Ey(e.rows))},distributeColumnsEvenly(){e.colWidths.replace(Ey(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<uy?(r[t]=uy,r[t+1]=i-uy):o<uy?(r[t+1]=uy,r[t]=i-uy):(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(uy,o),l=Math.max(uy,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||xg(10),r.cells){let e=new Map;r.cells.forEach(t=>{let n=t.id,r=xg(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})}})),ky=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},Ay=(e,t)=>{if(e.children)for(let n of e.children){if(!0===t(n))break;Ay(n,t)}},jy=(e,t)=>{if(e.children)for(let n of e.children){if(!0===t(n))break;jy(n,t)}if(e.cells){for(let n of e.cells)if(!0===t(n))break}};function My(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];up(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&&(up(r),e.children.remove(r),e.children.splice(n,0,r))}}}var Ny=[...Array(20)].map((e,t)=>q.late(()=>Iy[t])),Py=q.union({dispatcher:e=>{let t=Ly[e.type];if(!t)throw Error(`Unknown element type: "${e.type}"`);return t}},sy,ry,iy,oy,ay,cy,ly,Oy,q.late(()=>Fy),...Ny),Fy=qv.named(`Group`).props({type:`group`,children:q.array(Py)}).views(e=>({get draggable(){let t=!0;return Ay(e,e=>{e.draggable||(t=!1)}),t},get resizable(){let t=!0;return Ay(e,e=>{e.resizable||(t=!1)}),t},get contentEditable(){let t=!0;return Ay(e,e=>{e.contentEditable||(t=!1)}),t},get styleEditable(){let t=!0;return Ay(e,e=>{e.styleEditable||(t=!1)}),t},get locked(){let t=!0;return Ay(e,e=>{e.locked||(t=!1)}),t}})).actions(e=>Object.assign(Object.assign({set(t){var{draggable:n,contentEditable:r,styleEditable:i,resizable:a}=t,o=ky(t,[`draggable`,`contentEditable`,`styleEditable`,`resizable`]);n!==void 0&&Ay(e,e=>{e.set({draggable:n})}),r!==void 0&&Ay(e,e=>{e.set({contentEditable:r})}),i!==void 0&&Ay(e,e=>{e.set({styleEditable:i})}),a!==void 0&&Ay(e,e=>{e.set({resizable:a})}),Object.assign(e,o)},addElement(t,{skipSelect:n=!1}={}){let r=Ly[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||xg(10)});let i=r.create(Object.assign({id:xg(10)},t));return e.children.push(i),i.selectable&&!n&&e.store.selectElements([i.id]),i}},My(e)),{setAnimation(t,n){Ay(e,e=>{e.setAnimation(t,n)})}})),Iy=[],Ly={svg:sy,text:ry,image:iy,group:Fy,line:oy,video:ay,figure:cy,gif:ly,table:Oy},Ry=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},zy=e=>{let t=window.getComputedStyle(e).position;return!(t===`absolute`||t===`relative`)};function By(e=()=>{}){let t=_.useRef(e);return t.current=e,_.useCallback((...e)=>t.current.apply(null,e),[])}var Vy=({children:e,groupProps:t,divProps:n,transform:r,transformFunc:i,parentNodeFunc:a})=>{let o=Qd(),s=_.useRef(null),[c]=_.useState(()=>document.createElement(`div`)),l=_.useMemo(()=>v.createRoot(c),[c]),u=r??!0,d=By(()=>{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=Ry(e,[`style`]);Object.assign(c.style,t),Object.assign(c,r)});return _.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&&zy(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]),_.useLayoutEffect(()=>{d()},[n,i]),_.useLayoutEffect(()=>{queueMicrotask(()=>{(0,Qi.flushSync)(()=>{l.render(_.createElement(o,null,e))})})}),_.useLayoutEffect(()=>()=>{setTimeout(()=>{l.unmount()})},[]),_.createElement(nf,Object.assign({ref:s},t))},Hy=({selector:e,enabled:t,children:n})=>{let r=_.useRef(null),i=_.useRef(null),a=_.useRef(null),o=t??!0;return _.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]),_.useEffect(()=>()=>{var e;(e=a.current)==null||e.destroy()},[]),_.createElement(nf,{name:`_outer_portal`,ref:r},_.createElement(nf,{name:`_inner_portal`,ref:i},n))};function Uy(e,t){return Object.keys(e.values).forEach(n=>e.values[n]=e.values[n]&&parseFloat(e.values[n].toFixed(t))),e}function Wy(e,t,n){let r=t-1,i=n[Jy(r,n.length)];return i.marker===`Z`?Wy(e,r,n):i}function Gy(e,t,n){let r=t+1,i=n[Jy(r,n.length)];return i.marker===`Z`?Gy(e,r,n):i}function Ky(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;break;case`Z`:break}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;break}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 qy(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}});break}return n}function Jy(e,t){return(e%t+t)%t}function Yy(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 Xy(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,Xy(e,t-1)),e[t].marker===`Z`&&Xy(e,t-1)}function Zy(e,t,n){let r=$y(e.values,n.values),i=$y(t.values,e.values);return Math.min(i,r)}function Qy(e,t){return Math.atan2(t.x-e.x,t.y-e.y)}function $y(e,t){let n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n**2+r**2)}function eb(e,t){return Math.sin(e)*t}function tb(e,t){return Math.cos(e)*t}function nb(e,t){let n=t/Math.tan(e);return n===1/0||n===-1/0||isNaN(n)?t:n}function rb(e,t){return t*Math.tan(e)}function ib(e,t){let n,r=0,i=180/Math.PI*e;return i<0&&i>=-180||i>180&&i<360?n=nb(e/2,-t):(n=nb(e/2,t),r=1,n===1/0&&(n=t)),{offset:n,sweepFlag:r}}function ab(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 ob(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 qy(e.marker,r)}).map(Ky)}function sb(e,t,n){let r=[],i=[];return n&&e.forEach(e=>Uy(e,n)),e.forEach(e=>{e.marker===`M`&&r.push([]),r[r.length-1].push(e)}),r.forEach(e=>{e.map(Yy),Xy(e,e.length-1);let n=e[e.length-1].marker==`Z`;e.filter(e=>!e.overlap).map((e,r,a)=>{let o=Wy(e,r,a),s=Gy(e,r,a),c=Qy(e.values,o.values),l=Qy(e.values,s.values),u=l-c,d=180/Math.PI*u,f=Zy(e,o,s),p=Math.abs(rb(u/2,f/2)),m=Math.min(t,p),h=ib(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+eb(c,g),e.values.y+tb(c,g)],n=[e.values.x+eb(l,g),e.values.y+tb(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});break}})}),{path:ab(i),commands:i}}function cb({rects:e,padding:t=0,cornerRadius:n=0}){let r=function(e){if(e.length<2)return e;let t=[e[0]];for(let n=1;n<e.length;n++){let r=t[t.length-1],i=e[n];Math.abs(r.left-i.left)<.5&&Math.abs(r.right-i.right)<.5&&Math.abs(r.bottom-i.top)<.5?t[t.length-1]=Object.assign(Object.assign({},r),{bottom:i.bottom}):t.push(i)}return t}(function(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>.5*Math.max(r.bottom-r.top,i.bottom-i.top)){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}(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;s+=` L ${l} ${i?a(i)>a(n)?o(e)+t:o(e)-t:n.top-t}`,s+=` L ${l} ${c?a(c)>a(n)?o(e+1)-t:o(e+1)+t:n.bottom+t}`}for(let e=i-1;e>=0;e--){let n=r[e],i=r[e-1],c=r[e+1],l=n.left-t;s+=` L ${l} ${c?a(c)>a(n)?o(e+1)-t:o(e+1)+t:n.bottom+t}`,s+=` L ${l} ${i?a(i)>a(n)?o(e)+t:o(e)-t:n.top-t}`}return s+=` Z`,sb(ob(s),n).path}function lb({lines:e,lineHeight:t,width:n,align:r}){return e.flatMap((e,i)=>{if(e.width<=0)return[];let a,o,s=e.width;return r!==`justify`||e.lastInParagraph||(s=n),r===`right`?(o=n,a=n-s):r===`center`?(a=(n-s)/2,o=a+s):(a=0,o=s),[{left:a,right:o,top:i*t,bottom:(i+1)*t}]})}var ub=(e,t,n)=>(t===void 0&&(t=e.fill??``),n===void 0&&(n=`fill`),_.useMemo(()=>{if(!$_(t))return{[n]:t};let{stops:r,rotation:i}=tv(t),a=e.a.width/2,o=e.a.height/2,s=(i%180+180)%180,c=s>45&&s<135?e.a.width:e.a.height,l=G.Util.degToRad(i)-Math.PI/2,u=[];return r.forEach(({offset:e,color:t})=>{u.push(e,t)}),n===`fill`?{fillLinearGradientStartPointX:a-c/2*Math.cos(l),fillLinearGradientStartPointY:o-c/2*Math.sin(l),fillLinearGradientColorStops:u,fillLinearGradientEndPointX:a+c/2*Math.cos(l),fillLinearGradientEndPointY:o+c/2*Math.sin(l),fill:r[1].color,fillPriority:`linear-gradient`}:{strokeLinearGradientStartPointX:a-c/2*Math.cos(l),strokeLinearGradientStartPointY:o-c/2*Math.sin(l),strokeLinearGradientColorStops:u,strokeLinearGradientEndPointX:a+c/2*Math.cos(l),strokeLinearGradientEndPointY:o+c/2*Math.sin(l)}},[t,e.width,e.height]));function db(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}var fb={fontSize:14,fontFamily:`Roboto`,fontWeight:`normal`,fontStyle:`normal`,lineHeight:1.2,letterSpacing:0,textTransform:`none`,textDecoration:``,align:`center`,fill:`black`,stroke:`black`,strokeWidth:0,curveEnabled:!1,curvePower:.5};function pb(e){return Object.assign(Object.assign({},fb),e)}function mb(e){var t=`֑-߿יִ-﷽ﹰ-ﻼ`;return RegExp(`^[^`+t+`]*?[`+t+`]`).test(e)}function hb(e){return function(e){e=e.replace(/\s/g,``);let t=0;for(var n=0;n<e.length;n++)mb(e[n])&&(t+=1);return t>e.length/2}(e)?`rtl`:`ltr`}function gb(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=5*r/(2*Math.abs(i))-r,o=e/2;if(i>0){let e=2*a+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=-(2*a-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 _b(e,t,n,r){if(!$_(e))return``;let{stops:i,rotation:a}=tv(e),o=a*Math.PI/180;return`<linearGradient id="${t}" x1="${100*(.5-.5*Math.sin(o))}%" y1="${100*(.5+.5*Math.cos(o))}%" x2="${100*(.5+.5*Math.sin(o))}%" y2="${100*(.5-.5*Math.cos(o))}%">${i.map(({offset:e,color:t})=>`<stop offset="${100*e}%" stop-color="${t}" />`).join(``)}</linearGradient>`}function vb(e){let t=e.a?e.a:e,n=pb(e),r=t.fontSize??n.fontSize,i=new G.TextPath({data:gb(t.width??n.width,t.height??n.height??0,n.curvePower,r),align:`center`,textBaseline:`middle`,text:m_(n.text),fontSize:r,fontFamily:n.fontFamily,fontWeight:n.fontWeight,fontStyle:n.fontStyle,letterSpacing:n.letterSpacing*r,fill:n.fill}),a=i.getSelfRect().height||r;return i.destroy(),a}function yb(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"`),e.underline&&r.push(`text-decoration="underline"`),e.strike&&r.push(`text-decoration="line-through"`),!n?.omitColors&&e.color&&e.color!==t.fill&&r.push(`fill="${db(e.color)}"`);let i=db(e.text);return r.length===0?i:`<tspan ${r.join(` `)}>${i}</tspan>`}).join(``)}function bb(e,{fontFamily:t=``,color:n=`black`,forEditor:r=!1}={}){let i=pb(e),a=t||i.fontFamily,o=$_(i.fill),s=$_(i.stroke)&&!!i.strokeWidth,c=kg.textOverflow===`ellipsis`&&!r&&!i.curveEnabled&&!!i.height,l=(()=>{if(!c)return[];let e=Math.max(1,Math.round(i.height)),t=typeof i.lineHeight==`number`?i.lineHeight:1.2,n=Math.max(1,t*i.fontSize),r=Math.max(1,Math.floor(e/n));return[`max-height: ${e}px`,`overflow: hidden`,`display: -webkit-box`,`-webkit-box-orient: vertical`,`-webkit-line-clamp: ${r}`,`line-clamp: ${r}`]})(),u=e=>`\n background-image: ${e};\n background-size: 100% 100%;\n background-repeat: repeat;\n -webkit-background-clip: text;\n -moz-background-clip: text;\n background-clip: text;\n -webkit-text-fill-color: transparent;\n color: transparent\n `.trim(),d=`color: ${n||i.fill}`,f=``;s&&i.strokeWidth?(d=`color: ${n||i.fill}; ${u(i.stroke)}`,f=`-webkit-text-stroke: ${i.strokeWidth}px transparent`):o&&(d=u(i.fill));let p=[`white-space: pre-wrap`,`word-break: break-word`,`width: ${Math.round(i.width||100)}px`,...l,d,`font-size: ${i.fontSize}px`,`font-family: '${a}'`,`text-align: ${i.align}`,`text-transform: ${i.textTransform}`,i.textDecoration?`text-decoration: ${i.textDecoration}; text-decoration-color: ${n||i.fill}; text-decoration-layer: over`:``,i.lineHeight?`line-height: ${i.lineHeight}`:``,i.letterSpacing?`letter-spacing: ${i.letterSpacing*i.fontSize}px`:``,i.fontStyle?`font-style: ${i.fontStyle}`:``,i.fontWeight?`font-weight: ${i.fontWeight}`:``,f||(i.strokeWidth?`-webkit-text-stroke: ${i.strokeWidth}px ${i.stroke}`:``),i.strokeWidth&&!s?`paint-order: stroke fill`:``].filter(Boolean).join(`; `);if(i.curveEnabled&&!r){let t=vb(e),r=Math.round(i.width||100),c=gb(r,t,i.curvePower,i.fontSize),l=g_(i.text),u={fontWeight:i.fontWeight||`normal`,fontStyle:i.fontStyle||`normal`,fill:n||i.fill||`black`},d=yb(l,u),f=yb(l,u,{omitColors:!0}),p=`curve-${i.id||`temp`}`,m=i.strokeWidth&&(s||o&&!s),h=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${t}" overflow="visible">\n <defs>\n <path id="${p}" d="${c}" fill="none" />`;if(o){let e=`curve-fill-grad-${i.id||`temp`}`;h+=_b(i.fill,e,r,t)}if(s&&i.strokeWidth){let e=`curve-stroke-grad-${i.id||`temp`}`;h+=_b(i.stroke,e,r,t)}if(h+=`</defs>`,m){let e=`\n font-family="'${a}'"\n font-size="${i.fontSize}"\n font-weight="${i.fontWeight}"\n font-style="${i.fontStyle}"\n text-anchor="middle"\n dominant-baseline="central"\n letter-spacing="${i.letterSpacing*i.fontSize}px"${i.textDecoration?` text-decoration="${i.textDecoration}"`:``}`,t=s?`url(#curve-stroke-grad-${i.id||`temp`})`:i.stroke;h+=`\n <text ${e} fill="${t}" stroke="${t}" stroke-width="${i.strokeWidth}">\n <textPath href="#${p}" startOffset="50%">${f}</textPath>\n </text>`,h+=`\n <text ${e} fill="${o?`url(#curve-fill-grad-${i.id||`temp`})`:n}">\n <textPath href="#${p}" startOffset="50%">${d}</textPath>\n </text>`}else{let e=o?`url(#curve-fill-grad-${i.id||`temp`})`:n,t=s?`url(#curve-stroke-grad-${i.id||`temp`})`:i.stroke;h+=`\n <text\n font-family="'${a}'"\n font-size="${i.fontSize}"\n font-weight="${i.fontWeight}"\n font-style="${i.fontStyle}"\n fill="${e}"\n text-anchor="middle"\n dominant-baseline="central"\n letter-spacing="${i.letterSpacing*i.fontSize}px"${i.textDecoration?` text-decoration="${i.textDecoration}"`:``}${i.strokeWidth?` stroke="${t}" stroke-width="${i.strokeWidth}" paint-order="stroke fill"`:``}>\n <textPath href="#${p}" startOffset="50%">${d}</textPath>\n </text>`}return h+=`</svg>`,h}if(i.strokeWidth&&(s||o&&!s)&&!r){let e=__(i.text).replace(/\n/g,`<br/>`),t=Math.round(i.width||100),r=[`white-space: pre-wrap`,`word-break: break-word`,`width: ${t}px`,...l,`font-size: ${i.fontSize}px`,`font-family: '${a}'`,`text-align: ${i.align}`,`text-transform: ${i.textTransform}`,i.textDecoration?`text-decoration: ${i.textDecoration}; text-decoration-color: ${n||i.fill}; text-decoration-layer: over`:``,i.lineHeight?`line-height: ${i.lineHeight}`:``,i.letterSpacing?`letter-spacing: ${i.letterSpacing*i.fontSize}px`:``,i.fontStyle?`font-style: ${i.fontStyle}`:``,i.fontWeight?`font-weight: ${i.fontWeight}`:``].filter(Boolean).join(`; `),c;c=s?`${r}; ${u(i.stroke)}; -webkit-text-stroke: ${i.strokeWidth}px transparent`:`${r}; color: transparent; -webkit-text-stroke: ${i.strokeWidth}px ${i.stroke}`;let d=`${r}; ${o?u(i.fill):`color: ${n||i.fill}`}`,f=``;if(o||s){let e=[];s&&i.strokeWidth&&e.push(`.stroke-layer li, .stroke-layer li::before { ${u(i.stroke)}; }`),o&&e.push(`.fill-layer li, .fill-layer li::before { ${u(i.fill)}; }`),e.length&&(f=`<style>${e.join(`
|
|
135
|
-
`)}</style>`)}return`\n <div style="position: relative; width: ${t}px;">\n <div class="stroke-layer" style="${c}; position: absolute; top: 0; left: 0; pointer-events: none;" aria-hidden="true">${e}</div>\n <div class="fill-layer" style="${d}; position: relative;" contentEditable dir="${hb(m_(i.text))}">${e}</div>\n </div>\n ${f}\n `}let m=``;return o&&!s&&(m=`<style>\n li, li::before {\n ${u(i.fill)};\n }\n </style>`),`<div style="${p}" contentEditable dir="${hb(m_(i.text))}">${__(i.text).replace(/\n/g,`</br>`)}</div>${m}`}function xb({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);let i=r.offsetHeight;return document.body.removeChild(r),i/t}var Sb={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){let r=n[t],i=(n[t+1],n[t+2]);n[t]=Math.min(Math.max(r+15*e,0),255),n[t+2]=Math.min(Math.max(i-15*e,0),255)}return t},contrast:e=>t=>{let n=t.data,r=100*(e=Math.max(-1,Math.min(1,e))),i=259*(r+255)/(255*(259-r));for(let e=0;e<n.length;e+=4)n[e]=Math.min(Math.max(i*(n[e]-128)+128,0),255),n[e+1]=Math.min(Math.max(i*(n[e+1]-128)+128,0),255),n[e+2]=Math.min(Math.max(i*(n[e+2]-128)+128,0),255);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]=Math.min(Math.max(n[t]*i,0),255),n[t+1]=Math.min(Math.max(n[t+1]*i,0),255),n[t+2]=Math.min(Math.max(n[t+2]*i,0),255)}}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],i=n[t+1],a=n[t+2],o=(r+i+a)/3;if(o>128){let s=1+e*((o-128)/127);n[t]=Math.min(Math.max(r*s,0),255),n[t+1]=Math.min(Math.max(i*s,0),255),n[t+2]=Math.min(Math.max(a*s,0),255)}}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],i=n[t+1],a=n[t+2],o=(r+i+a)/3;if(o<128){let s=1+e*((128-o)/128);n[t]=Math.min(Math.max(r*s,0),255),n[t+1]=Math.min(Math.max(i*s,0),255),n[t+2]=Math.min(Math.max(a*s,0),255)}}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=e<0?(1-(o===0?0:(o-(r+i+a)/3)/o))*e*1.5:.5*e;n[t]=Math.min(Math.max(r-(o-r)*s,0),255),n[t+1]=Math.min(Math.max(i-(o-i)*s,0),255),n[t+2]=Math.min(Math.max(a-(o-a)*s,0),255)}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]=Math.min(Math.max(o+(r-o)*(1+e),0),255),n[t+1]=Math.min(Math.max(o+(i-o)*(1+e),0),255),n[t+2]=Math.min(Math.max(o+(a-o)*(1+e),0),255)}return t}};function Cb(e,t){var n;let r={filters:[]},i={};t.brightnessEnabled&&(r.filters.push(G.Filters.Brighten),r.brightness=t.brightness),t.blurEnabled&&(r.filters.push(G.Filters.Blur),r.blurRadius=t.blurRadius,t.type===`text`&&t.lineHeight<1&&(i.offset=t.fontSize)),t.sepiaEnabled&&r.filters.push(G.Filters.Sepia),t.grayscaleEnabled&&r.filters.push(G.Filters.Grayscale),t.filters.forEach((e,t)=>{let n=Sb[t];n&&r.filters.push(n(e.intensity))}),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 wb=()=>`ontouchstart`in window||navigator.maxTouchPoints>0;function Tb({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 Eb(e){try{let{stops:t}=tv(e);if(t.length===0)return 127.5;let n=0,r=0;for(let e of t)try{let t=G.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 Db(e){if($_(e))return Eb(e);let t=G.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 Ob(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=Db(e.fill),i=Db(n);return Math.abs(r-i)>=50?n:e.fill}var kb;function Ab(){return kb||(kb=document.getElementById(`polotno-text-style`),kb||(kb=document.createElement(`style`),kb.id=`polotno-text-style`,document.head.appendChild(kb)),kb)}G._fixTextRendering=!0;var jb={border:`none`,padding:`0px`,overflow:`hidden`,background:`none`,outline:`none`,resize:`none`,overflowWrap:`break-word`,whiteSpace:`pre-wrap`,userSelect:`text`,wordBreak:`normal`,textTransform:`none`},Mb=ga(({textNodeRef:e,element:t,onBlur:n,selectAll:r,cursorPosition:i})=>{let[a,o]=_.useState(jb),s=e.current;_.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=Ob(t);let n=`\n .polotno-input::placeholder {\n color: ${a.color};\n opacity: 0.6;\n }\n `,r=Ab();r.innerHTML=``,r.appendChild(document.createTextNode(n)),JSON.stringify(e)!==JSON.stringify(a)&&o(e)});let c=_.useRef(null);if(_.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)))},[]),_.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();t.verticalAlign===`middle`&&(l=(t.a.height-u)/2),t.verticalAlign===`bottom`&&(l=t.a.height-u);let d=m_(t.text);return _.createElement(`textarea`,{className:`polotno-input`,ref:c,dir:hb(d),style:Object.assign(Object.assign(Object.assign({},jb),a),{paddingTop:l+`px`}),value:d,onChange:e=>{let n=Tb({oldText:t.text,newText:e.target.value,element:t});t.set({text:e.target.value,fontSize:n})},placeholder:t.placeholder,onBlur:n})}),Nb=e=>_.createElement(Vy,null,_.createElement(Mb,Object.assign({},e))),Pb=(e,t,n,r,i)=>{let[a,o]=_.useReducer(e=>e+1,0),s=_.useRef(O_(t,n,r)),c=_.useRef(null);return _.useLayoutEffect(()=>{if(s.current=O_(t,n,r),s.current)return;let a=!0;return(async()=>{s.current=!1,o();let l=c_(`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]),_.useEffect(()=>{s.current&&setTimeout(()=>{c.current&&=(c.current(),null)})},[s.current]),[s.current]},Fb=({fontLoaded:e,fontFamily:t,fontSize:n,lineHeight:r})=>_.useMemo(()=>xb({fontFamily:t,fontSize:n,lineHeight:r}),[e,t,n,r]);function Ib(e){let t=_.useRef(e),n=_.useRef(e);return _.useMemo(()=>{n.current=t.current,t.current=e},[e]),n.current}function Lb(e,t,n=!1){let r=e.fontSize(),i=e.height(),a=m_(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=t.a.height&&e.height()>t.a.height,i=a.split(`
|
|
136
|
-
`).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 Rb=ga(({element:e,store:t})=>{let{textOverflowIndicatorStyle:n}=Ff(),r=_.useRef(null),i=_.useRef(null),a=_.useRef(null),o=_.useRef([]),[,s]=_.useReducer(e=>e+1,0),{editorEnabled:c,selectAll:l}=(e=>{let[t,n]=_.useState(!1),r=_.useRef(!1);return _.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),[u,d]=_.useState(!1),[f,p]=_.useState(!1),m=_.useRef(e.a.height),h=_.useRef(0),g=_.useRef(``),v=_.useRef(0),y=e.isSelected,b=Ib(y),{textVerticalResizeEnabled:x}=kg,S=kg.autoDeleteEmptyText,C=Ib(e.fontFamily),[w,T]=_.useState([]);_.useEffect(()=>{let e=r.current?.textArr??[];JSON.stringify(e)!==JSON.stringify(w)&&T(e)}),_.useEffect(()=>{if(e.a.width||e.type===`tablecell`)return;let t=r.current;t.width(600),e.set({width:1.4*t.getTextWidth()})},[]),_.useEffect(()=>{b&&!y&&S&&e.text===``&&e.removable&&!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&&Cb(n,e)}else{let t=r.current;t&&Cb(t,e)}};_.useLayoutEffect(()=>{if(!f)return er(()=>{E()})}),_.useEffect(()=>{let e=o.current;e.length>0&&(o.current=[],e.forEach(e=>e()))});let D=m_(e.text);e.textTransform===`uppercase`&&(D=D.toUpperCase());let[ee]=Pb(t,e.fontFamily,e.fontStyle,e.fontWeight,e.text||e.placeholder),O=()=>{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};_.useLayoutEffect(()=>{if(!ee)return;if(e.type===`tablecell`){let{textOverflow:n}=kg;if(n===`resize`){let t=O(),n=fp(e)?rp(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=Lb(n,e,kg.textSplitAllowed);r!==e.fontSize&&t.history.ignore(()=>{e.set({fontSize:r})})}}return}let{textOverflow:n,textSplitAllowed:i}=kg,a=(n,r,i,a)=>{let c=c_(`text ${e.id}`),l=()=>{t.history.ignore(n,r,i).then(()=>{o.current.push(c),s()})};a?queueMicrotask(l):l()};if(!e.height){let t=O();a(()=>{e.height||e.set({height:t})},void 0,void 0,!0);return}if(!t.isPlaying)if(n!==`change-font-size`||u){if(n===`resize`){let t=O();x&&e.height<t&&!u&&a(()=>{var n;fp(e)&&e.set({height:t}),(n=r.current)==null||n.height(t)},!1,!0),x||e.height===t||u||a(()=>{var n;fp(e)&&e.set({height:t}),(n=r.current)==null||n.height(t)},!1,!0)}}else{let t=r.current,n=e.curveEnabled?e.fontSize:Lb(t,e,i);if(n!==e.fontSize){a(()=>{e.set({fontSize:n})},!1,!0);return}let o=O();e.height===o||x||a(()=>{e.set({height:o})},!1,!0)}}),_.useLayoutEffect(()=>{if(ee&&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})}}},[ee,e.curveEnabled,e.curvePower,e.text,e.fontSize,e.fontFamily,e.fontWeight,e.fontStyle,e.letterSpacing]),_.useLayoutEffect(()=>{let e=r.current;e&&(e.width(e.width()+1e-8),e.width(e.width()-1e-8),e._setTextData(),E())},[ee]);let k=_.useRef(null),A=_.useRef(0),te=n=>{n.evt.preventDefault(),t.selectedShapes.find(t=>t===e)&&e.contentEditable&&(A.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())},ne=!D&&e.placeholder?.6:e.a.opacity;e_(r,ne);let j=Fb({fontLoaded:ee,fontFamily:e.fontFamily,fontSize:e.a.fontSize,lineHeight:e.lineHeight}),M=e.selectable||t.role===Hx.ADMIN,re=ub(e),ie=ub(e,e.stroke,`stroke`),ae=_.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 sb(ob(`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*j*.5),padding:e.backgroundPadding*(e.a.fontSize*j*.5)}):function({lines:e,lineHeight:t,width:n,align:r=`left`,padding:i=0,cornerRadius:a=0}){return cb({rects:lb({lines:e,lineHeight:t,width:n,align:r}),padding:i,cornerRadius:a})}({lines:JSON.parse(JSON.stringify(w)),cornerRadius:e.backgroundCornerRadius*(e.a.fontSize*j*.5),lineHeight:j*e.a.fontSize,padding:e.backgroundPadding*(e.a.fontSize*j*.5),width:e.a.width,align:e.align}):``,[e.backgroundEnabled,e.curveEnabled,e.backgroundCornerRadius,e.a.fontSize,e.a.height,j,e.backgroundPadding,e.a.width,e.align,w]),oe=wb(),N=0;e.curveEnabled||(e.verticalAlign===`middle`?N=(e.a.height-w.length*j*e.a.fontSize)/2:e.verticalAlign===`bottom`&&(N=e.a.height-w.length*j*e.a.fontSize));let se=e.curveEnabled?gb(e.a.width,e.a.height,e.curvePower,e.a.fontSize):``,ce=ee?`"`+e.fontFamily+`"`:C===e.fontFamily?`Arial`:`"`+C+`"`,le=hb(D);return _.createElement(_.Fragment,null,_.createElement(uf,{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*ne,data:ae,fill:e.backgroundColor,offsetY:-N}),_.createElement(uf,{data:se,stroke:n.stroke,strokeWidth:1,x:e.a.x,y:e.a.y,rotation:e.a.rotation,visible:!1}),_.createElement(lf,Object.assign({ref:i,visible:e.curveEnabled,data:se,text:D||e.placeholder,listening:!1,align:`center`,textBaseline:`middle`,direction:le},re,ie,{strokeWidth:e.strokeWidth,lineJoin:`round`,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:ne,hideInExport:!e.showInExport,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity})),_.createElement(cf,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:e.a.height,text:D||e.placeholder,direction:le},re,ie,{lineJoin:`round`,strokeWidth:e.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:e.a.fontSize,fontFamily:ce,fontStyle:e.fontStyle+` `+e.fontWeight,textDecoration:e.textDecoration,align:e.align,verticalAlign:e.verticalAlign,draggable:oe?e.draggable&&y:e.draggable,preventDefault:!oe||y,opacity:e.curveEnabled?0:ne,visible:!e._editModeEnabled,ellipsis:kg.textOverflow===`ellipsis`,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,lineHeight:j,letterSpacing:e.letterSpacing*e.a.fontSize,listening:!!e.selectable&&M,onDragStart:()=>{p(!0)},onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{p(!1),e.set({x:t.target.x(),y:t.target.y()})},onClick:te,onTap:te,onTransformStart:()=>{d(!0);let e=r.current;m.current=e.height(),h.current=e.rotation(),v.current=e.height(),g.current=(e.getStage()?.findOne(`Transformer`))?.getActiveAnchor()??``},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=(i.getStage()?.findOne(`Transformer`)).getActiveAnchor();if(o===`middle-left`||o===`middle-right`){let t=i.scaleX(),n=i.width()*t,r=e.a.fontSize,a=n;n<r&&(a=r,k.current&&i.position(k.current)),i.width(a),i.scaleX(1),i.scaleY(1);let o=O();if(kg.textOverflow===`ellipsis`)o=m.current;else{let t=Math.max(o,m.current);i.height(t),e.set({height:i.height()})}let s=kg.textVerticalResizeEnabled?Math.max(o,m.current):O();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=kg.textOverflow===`resize`?O():j*e.a.fontSize,r=t.target.height()*t.target.scaleY();if(r<n){if(t.target.height(n),k.current)if(g.current===`top-center`){let e=h.current*Math.PI/180,r=v.current-n;t.target.x(k.current.x-r*Math.sin(e)),t.target.y(k.current.y+r*Math.cos(e))}else t.target.position(k.current)}else t.target.height(r);t.target.scaleY(1),t.target.scaleX(1),t.target.rotation(h.current),t.target.skewX(0),t.target.skewY(0),v.current=Math.max(n,r)}k.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({fontSize:Math.round(e.a.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,shadowBlur:e.shadowBlur*r,shadowOffsetX:e.shadowOffsetX*r,shadowOffsetY:e.shadowOffsetY*r,strokeWidth:e.strokeWidth*r}),(n=a.current)==null||n.setAttrs({scaleX:1,scaleY:1}),d(!1)}})),c&&e.contentEditable&&_.createElement(`Group`,{x:e.a.x,y:e.a.y,rotation:e.a.rotation},_.createElement(Nb,{textNodeRef:r,element:e,selectAll:l,cursorPosition:A.current,onBlur:()=>{e.toggleEditMode(!1)}})))});function zb(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=m_(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(`
|
|
137
|
-
`);return c?`<style>${c}</style>`:``}var Bb=new Map,Vb=new Map,Hb=/@font-face\s*\{[^}]*\}/g,Ub=/url\(\s*(['"]?)(.*?)\1\s*\)/g,Wb=/unicode-range:\s*([^;}]+)/i;function Gb(e,t){if(!t)return!0;let n=e.match(Wb);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 Kb(e,t){let n=new Set;for(let r of e.matchAll(Hb))if(Gb(r[0],t))for(let e of r[0].matchAll(Ub)){let t=e[2];t&&!t.startsWith(`data:`)&&n.add(t)}return Array.from(n)}function qb(e){let t=Bb.get(e);return t||(t=async function(e){try{let t=await fetch(e);if(!t.ok)return e;let n=t.headers.get(`Content-Type`)||`font/woff2`,r=await t.arrayBuffer(),i=new Uint8Array(r),a=``;for(let e=0;e<i.length;e++)a+=String.fromCharCode(i[e]);return`data:${n};base64,${btoa(a)}`}catch{return e}}(e),Bb.set(e,t)),t}function Jb(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=Vb.get(n);if(r)return r;let i=async function(e,t){let n=Kb(e,t);if(n.length===0&&!t)return e;let r=await Promise.all(n.map(async e=>[e,await qb(e)])),i=new Map(r);return e.replace(Hb,e=>Gb(e,t)?e.replace(Ub,(e,t,n)=>{if(!n||n.startsWith(`data:`))return e;let r=i.get(n);return r?`url("${r}")`:e}):``)}(e,t);return Vb.set(n,i),i}var Yb=/<style[^>]*>([\s\S]*?)<\/style>/gi;function Xb(e){let t=[],n=e.replace(Yb,(e,n)=>(t.push(n),``));return{css:t.join(`
|
|
138
|
-
`),html:n}}var Zb=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)}}},Qb;function $b(e,t){`close`in t.image&&typeof t.image.close==`function`&&t.image.close()}async function ex(e){let t=`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(e),n=new Image;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 tx(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 Qb?Qb.maxEntries!==e&&Qb.resize(e):Qb=new Zb(e),Qb}(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 ex(await sx(e));return t.setWithEviction(n,a,$b),a.image}return(await ex(await sx(e))).image}var nx=RegExp(`[\0-\b\v\f-]`,`g`);function rx(e){let t=new DOMParser().parseFromString(e,`text/html`),n=new XMLSerializer,r=``;for(let e of Array.from(t.body.childNodes))r+=n.serializeToString(e);return r.replace(nx,``)}function ix({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 e.replace(/<\/style/gi,`\\3c /style`)}(t)}</style></head><body style="${s}">${e}</body></html></foreignObject></svg>`}var ax;async function ox({html:e,css:t=``,width:n,height:r,pixelRatio:i=1}){let a=Xb(e),o=await Jb([t,a.css].filter(Boolean).join(`
|
|
139
|
-
`),function(e){let t=new DOMParser().parseFromString(e,`text/html`).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 ix({xhtml:rx(a.html),css:o,width:n,height:r,pixelRatio:i})}async function sx(e){var t,n;if(e.cache){let r=(n=typeof e.cache==`object`&&(t=e.cache.maxEntries)!=null?t:50,ax?ax.maxEntries!==n&&ax.resize(n):ax=new Zb(n),ax),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 ox(e);return r.set(i,o),o}return ox(e)}var cx,lx=()=>(cx||(cx=document.createElement(`div`),cx.id=`polotno-hidden-do-not-touch`,cx.style.overflow=`hidden`,cx.style.position=`relative`,document.body.appendChild(cx),cx.innerHTML=`<style>#polotno-hidden-do-not-touch {
|
|
140
|
-
p {
|
|
141
|
-
margin: 0;
|
|
142
|
-
padding: 0;
|
|
143
|
-
word-wrap: break-word; /* Required for Firefox */
|
|
144
|
-
/* a text may have several spaces, we need to preserve them */
|
|
145
|
-
white-space: pre-wrap;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/* Reset default list styles and setup counters */
|
|
149
|
-
ul, ol {
|
|
150
|
-
list-style: none; /* Remove default markers */
|
|
151
|
-
padding-inline-start: 0; /* Reset padding */
|
|
152
|
-
margin: 0;
|
|
153
|
-
display: block; /* Use block instead of inline-block for better text wrapping */
|
|
154
|
-
width: 100%;
|
|
155
|
-
text-decoration: inherit;
|
|
156
|
-
counter-reset: ol-counter; /* Initialize counter for ol */
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
li {
|
|
160
|
-
position: relative; /* Needed for absolute positioning of ::before */
|
|
161
|
-
padding-inline-start: 2.1em; /* Space for the marker (start side) */
|
|
162
|
-
margin: 0; /* Reset default li margins */
|
|
163
|
-
word-wrap: break-word; /* Required for Firefox text wrapping */
|
|
164
|
-
white-space: pre-wrap; /* Preserve spaces and allow wrapping */
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
li::before {
|
|
168
|
-
content: ''; /* Base content */
|
|
169
|
-
position: absolute;
|
|
170
|
-
/* Use logical properties for positioning */
|
|
171
|
-
inset-inline-start: 0; /* Position marker at the start edge (left in LTR, right in RTL) */
|
|
172
|
-
top: 0; /* Adjust vertical alignment */
|
|
173
|
-
/* Prevent letter-spacing from affecting the marker */
|
|
174
|
-
letter-spacing: normal;
|
|
175
|
-
/* Define width to ensure consistent spacing and alignment */
|
|
176
|
-
display: inline-block;
|
|
177
|
-
width: 2em; /* Width for the marker container */
|
|
178
|
-
/* Align multi-digit numbers to the end (right in LTR, left in RTL) */
|
|
179
|
-
text-align: end;
|
|
180
|
-
/* Space between marker and text (using logical property) */
|
|
181
|
-
margin-inline-end: 0.8em; /* Pushes text away from marker (2.5em total = 1.7em width + 0.8em margin)*/
|
|
182
|
-
/* Prevent marker style from inheriting list item styles */
|
|
183
|
-
font-weight: normal;
|
|
184
|
-
font-style: normal;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/* Style for bullet points */
|
|
188
|
-
ul > li::before {
|
|
189
|
-
content: '•'; /* Literal bullet character */
|
|
190
|
-
/* Center the bullet within its allocated width */
|
|
191
|
-
text-align: center; /* Override text-align: end for bullets */
|
|
192
|
-
font-size: 1.2em;
|
|
193
|
-
top: 0em; /* Re-adjust vertical alignment for bullet */
|
|
194
|
-
/* Bullets don't need number alignment, width can be tighter */
|
|
195
|
-
width: 2em;
|
|
196
|
-
/* Adjust margin to maintain overall padding */
|
|
197
|
-
margin-inline-end: 1.5em; /* 2.5em total padding = 1em width + 1.5em margin */
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/* Style for numbers using counter */
|
|
201
|
-
ol > li {
|
|
202
|
-
counter-increment: ol-counter; /* Increment counter for each li in ol */
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
ol > li::before {
|
|
206
|
-
content: counter(ol-counter) "."; /* Display counter value + dot */
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
.ql-indent-1 {
|
|
210
|
-
margin-inline-start: 0.5em;
|
|
211
|
-
}
|
|
212
|
-
.ql-indent-2 {
|
|
213
|
-
margin-inline-start: 1em;
|
|
214
|
-
}
|
|
215
|
-
.ql-indent-3 {
|
|
216
|
-
margin-inline-start: 1.5em;
|
|
217
|
-
}
|
|
218
|
-
}</style>`),cx);navigator.userAgent.includes(`Firefox`);function ux({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=lx();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 dx(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=lx();n.appendChild(t);let r=t.getBoundingClientRect();return n.removeChild(t),{width:r.width,height:r.height}}function fx(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=lx();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()}if(n.removeChild(t),i.length===0)return[];i.sort((e,t)=>e.top-t.top||e.left-t.left);let s=[];for(let e of i){let t=s[s.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>.5*r){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}}s.push({left:e.left,right:e.right,top:e.top,bottom:e.bottom,trailingLetterSpacing:e.letterSpacing,isRtl:e.isRtl})}return s.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}})}var px={},mx=new Map;async function hx({html:e,width:t,height:n,fontFamily:r,padding:i,font:a,pixelRatio:o}){let s=``;if(r!==`Arial`&&!a&&(s=await async function(e,t){let n=`${e}|${t}`;if(mx.has(n))return mx.get(n);let r=`https://fonts.googleapis.com/css?family=${e}:${t}&display=swap`,i=await(await fetch(r)).text();return mx.set(n,i),i}(r,M_())),a){let e=a.styles||(a.url?[{src:`url("${a.url}")`}]:(e=>{if(px[e])return px[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 px[e]=t,t})(r));s=``,e.forEach(e=>{s+=`\n @font-face {\n font-family: '${r}';\n src: ${e.src};\n font-style: ${e.fontStyle||`normal`};\n font-weight: ${e.fontWeight||`normal`};\n }\n `})}let c=``;return s&&(c=zb(s,e)),tx({html:`<div style="padding: ${i}px;" dir="auto">${e+=c+Fv}</div>`,width:t+2*i,height:n+2*i,cache:{maxEntries:100},pixelRatio:o})}var gx=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},_x=(e,t,...n)=>({type:e,props:t,children:n||[]});function vx(e){return $_(e),e}function yx(e){var t=new DOMParser().parseFromString(e,`image/svg+xml`);return t.documentElement.setAttribute(`preserveAspectRatio`,`none`),new XMLSerializer().serializeToString(t)}var bx=async({element:e,page:t,store:n})=>{let{src:r}=e;if(e.type===`svg`){let t=await pv(r);t=yx(t),r=Object.keys(e.colorsReplace).length?_v(t,new Map(Object.entries(e.colorsReplace))):mv(t)}let i=``;e.flipX&&(i+=`scaleX(-1)`),e.flipY&&(i+=`scaleY(-1)`),i||=`none`;let a={};if(e.type===`svg`&&e.maskSrc){let t=await fv(r);a[`mask-image`]=`url(${t})`,a[`mask-size`]=`100% 100%`,a[`mask-position`]=`0 0`,a[`mask-repeat`]=`no-repeat`,a[`-webkit-mask-image`]=`url(${t})`,a[`-webkit-mask-size`]=`100% 100%`,a[`-webkit-mask-position`]=`0 0`,a[`-webkit-mask-repeat`]=`no-repeat`,r=e.maskSrc}else if(e.clipSrc){let t=e.clipSrc,n=await fv(t);a[`mask-image`]=`url(${n})`,a[`mask-size`]=`100% 100%`,a[`mask-position`]=`0 0`,a[`mask-repeat`]=`no-repeat`,a[`-webkit-mask-image`]=`url(${n})`,a[`-webkit-mask-size`]=`100% 100%`,a[`-webkit-mask-position`]=`0 0`,a[`-webkit-mask-repeat`]=`no-repeat`}let o=await vv(r),s=o.width*e.cropWidth,c=o.height*e.cropHeight,l=e.width/e.height,u,d,f=s/c,p=e.type===`svg`||e.stretchEnabled;p?(u=s,d=c):l>=f?(u=s,d=s/l):(u=c*l,d=c);let m=u/o.width,h=d/o.height,g=u/d>e.width/e.height?e.height/d:e.width/u,_=p?e.width/u:g,v=p?e.height/d:g,y=u*_/m,b=d*v/h,x=e.cropX*_*o.width,S=e.cropY*v*o.height;e.flipX&&(x=(1-e.cropX-e.cropWidth)*_*o.width),e.flipY&&(S=(1-e.cropY-e.cropHeight)*v*o.height);let C=e.borderSize&&$_(e.borderColor),w=C?Math.max(0,e.cornerRadius-e.borderSize):e.cornerRadius,T=_x(`div`,{style:Object.assign(Object.assign({},a),{width:`100%`,height:`100%`,borderRadius:w+`px`,border:e.borderSize&&!C?`${e.borderSize}px solid ${e.borderColor}`:`none`,backgroundRepeat:`no-repeat`,backgroundImage:`url(${r})`,transform:i,backgroundSize:`${Math.round(y)}px ${Math.round(b)}px`,backgroundPositionX:-Math.round(x)+`px`,backgroundPositionY:-Math.round(S)+`px`})});return C?_x(`div`,{style:{width:`100%`,height:`100%`,borderRadius:e.cornerRadius+`px`,background:vx(e.borderColor),padding:e.borderSize+`px`,boxSizing:`border-box`}},T):T},xx=({element:e,type:t})=>{let n={"stroke-width":e.height,stroke:e.color,"stroke-linecap":`round`,"stroke-linejoin":`round`,opacity:e.opacity},r=Object.assign(Object.assign({},n),{fill:e.color}),i=Object.assign(Object.assign({},n),{fill:`none`});return t===`arrow`?_x(`polyline`,Object.assign({points:`${3*e.height},${2*-e.height} 0,0 ${3*e.height},${2*e.height}`},i)):t===`triangle`?_x(`polygon`,Object.assign({points:`${3*e.height},${2*-e.height} 0,0 ${3*e.height},${2*e.height}`},r)):t===`bar`?_x(`polyline`,Object.assign({points:`0,${2*-e.height} 0,${2*e.height}`},i)):t===`circle`?_x(`circle`,Object.assign({cx:2*e.height,cy:0,r:2*e.height},r)):t===`square`?_x(`polygon`,Object.assign({points:`0,${2*-e.height} ${4*e.height},${2*-e.height} ${4*e.height},${2*e.height} 0,${2*e.height}`},r)):null},Sx={image:bx,svg:bx,text:async({element:e,page:t,store:n})=>{let r=$_(e.fill),i=$_(e.stroke);if(e.curveEnabled){let t=gb(e.width,e.height,e.curvePower,e.fontSize),n=yb(g_(e.text),{fontWeight:e.fontWeight||`normal`,fontStyle:e.fontStyle||`normal`,fill:e.fill||`black`}),a=`\n <svg xmlns="http://www.w3.org/2000/svg" width="${e.width}" height="${e.height}" style="display: block;">\n <defs>\n <path id="curve-${e.id}" d="${t}" fill="none" />`;if(r){let t=`curve-fill-grad-${e.id}`;a+=_b(e.fill,t)}if(i&&e.strokeWidth){let t=`curve-stroke-grad-${e.id}`;a+=_b(e.stroke,t)}a+=`</defs>\n <text\n font-family="'${e.fontFamily}'"\n font-size="${e.fontSize}"\n font-weight="${e.fontWeight}"\n font-style="${e.fontStyle}"\n fill="${r?`url(#curve-fill-grad-${e.id})`:e.fill}"\n text-anchor="middle"\n dominant-baseline="central"\n letter-spacing="${e.letterSpacing*e.fontSize}px"${e.textDecoration?` text-decoration="${e.textDecoration}"`:``}${e.strokeWidth?` stroke="${i?`url(#curve-stroke-grad-${e.id})`:e.stroke}" stroke-width="${e.strokeWidth}" paint-order="stroke fill"`:``}>\n <textPath href="#curve-${e.id}" startOffset="50%">${n}</textPath>\n </text>\n </svg>`;let o=e.backgroundPadding*(e.fontSize*e.lineHeight);return _x(`div`,{style:{position:`relative`,width:`100%`,height:`100%`}},e.backgroundEnabled&&_x(`div`,{style:{position:`absolute`,top:-o/2+`px`,left:-o/2+`px`,width:e.width+o+`px`,height:e.height+o+`px`,backgroundColor:e.backgroundColor,opacity:e.backgroundOpacity,borderRadius:e.backgroundCornerRadius*(e.fontSize*e.lineHeight*.5)+`px`}}),_x(`div`,{style:{width:`100%`,height:`100%`,position:`absolute`,top:0,left:0},innerHTML:a}))}let a=e=>({backgroundImage:e,backgroundSize:`100% 100%`,backgroundRepeat:`repeat`,WebkitBackgroundClip:`text`,MozBackgroundClip:`text`,backgroundClip:`text`,WebkitTextFillColor:`transparent`,MozTextFillColor:`transparent`,color:`transparent`}),o=e.verticalAlign===`middle`?{top:`50%`,transform:`translateY(-50%)`}:e.verticalAlign===`bottom`?{bottom:0}:{top:0},s=Object.assign(Object.assign({left:0},o),r?a(e.fill):{}),c=null;if(e.backgroundEnabled)if(e.legacyBackground){let t=e.backgroundPadding*(e.fontSize*e.lineHeight);c=_x(`div`,{style:{position:`absolute`,top:-t/2+`px`,left:-t/2+`px`,display:`block`,width:e.width+t+`px`,height:e.height+t+`px`,backgroundColor:e.backgroundColor,opacity:e.backgroundOpacity,borderRadius:e.backgroundCornerRadius*(e.fontSize*e.lineHeight*.5)+`px`}})}else{let t=bb(e),n=[];try{n=fx(t)}catch{n=[]}if(n.length){let r=e.backgroundPadding*(e.fontSize*e.lineHeight*.5),i=e.backgroundCornerRadius*(e.fontSize*e.lineHeight*.5),a=cb({rects:n,padding:r,cornerRadius:i});if(a){let i=0;try{let{height:n}=dx(t);e.verticalAlign===`middle`?i=(e.height-n)/2:e.verticalAlign===`bottom`&&(i=e.height-n)}catch{}let o=Math.min(...n.map(e=>e.top)),s=Math.max(...n.map(e=>e.bottom)),l=Math.min(...n.map(e=>e.left)),u=l-r,d=o-r,f=Math.max(...n.map(e=>e.right))-l+2*r,p=s-o+2*r;c=_x(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:f,height:p,viewBox:`${u} ${d} ${f} ${p}`,style:{position:`absolute`,top:i+d+`px`,left:u+`px`,opacity:e.backgroundOpacity,pointerEvents:`none`},innerHTML:`<path d="${a}" fill="${e.backgroundColor}" />`})}}}else c=null;let l=/<[a-z][\s\S]*>/i.test(e.text),u=l?e.text:e.text.split(`
|
|
219
|
-
`).join(`<br />`);if(e.strokeWidth&&(i||r&&!i)){let t={position:`absolute`,width:e.width+`px`,whiteSpace:`pre-wrap`,wordBreak:`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},n=i?Object.assign(Object.assign(Object.assign({},t),a(e.stroke)),{WebkitTextStroke:`${e.strokeWidth}px transparent`}):Object.assign(Object.assign({},t),{color:`transparent`,WebkitTextStroke:`${e.strokeWidth}px ${e.stroke}`}),s=r?Object.assign(Object.assign({},t),a(e.fill)):Object.assign(Object.assign({},t),{color:e.fill}),d=`el-`+e.id,f=l?`<style>#${d} {${Pv}}</style>`:``,p=_x(`div`,{style:Object.assign(Object.assign({},n),{position:`absolute`,top:0,left:0,pointerEvents:`none`}),"aria-hidden":`true`,innerHTML:l?`${f}${u}`:u}),m=_x(`div`,Object.assign(Object.assign({style:Object.assign(Object.assign({},s),{position:`relative`})},l?{id:d}:{}),{innerHTML:l?`${f}${u}`:u}));return _x(`div`,{style:{position:`relative`,width:`100%`,height:`100%`}},c,_x(`div`,{style:Object.assign({position:`absolute`,width:e.width+`px`,left:0},o)},p,m))}let d=Object.assign(Object.assign({},s),{position:`absolute`,width:e.width+`px`,color:e.fill,whiteSpace:`pre-wrap`,wordBreak:`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}),f=`el-`+e.id,p=l?{id:f}:{},m=`<style>#${f} {${Pv}}</style>`,h=_x(`div`,Object.assign(Object.assign({style:d},p),{innerHTML:l?`${m}${u}`:u}));return _x(`div`,{style:{position:`relative`,width:`100%`,height:`100%`}},c,h)},line:async({element:e,page:t,store:n})=>_x(`svg`,{style:{width:`100%`,height:`100%`,contain:`layout style size`,overflow:`visible`}},_x(`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}),_x(`g`,{transform:`translate(0 ${e.height/2})`},xx({element:e,type:e.startHead})),_x(`g`,{transform:`translate(${e.width} ${e.height/2}) rotate(180)`},xx({element:e,type:e.endHead}))),figure:async({element:e,page:t,store:n,elementHook:r})=>{let i=Nv(e);if(e.strokeWidth&&$_(e.stroke)){let t=`figure-stroke-grad-${e.id}`,n=_b(e.stroke,t);i=i.replace(RegExp(`stroke="${e.stroke.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}"`,`g`),`stroke="url(#${t})"`),i=i.replace(`</defs>`,`${n}</defs>`)}if($_(e.fill)){let t=`figure-fill-grad-${e.id}`,n=_b(e.fill,t);i=i.replace(RegExp(`fill="${e.fill.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}"`,`g`),`fill="url(#${t})"`),i=i.replace(`</defs>`,`${n}</defs>`)}let a=_x(`div`,{innerHTML:i});return r&&r({dom:a,element:e})||a},group:async({element:e,page:t,store:n,elementHook:r})=>{let i=await Promise.all(e.children.map(e=>Cx({element:e,page:t,store:n,elementHook:r}))),a=_x(`div`,{style:{transformOrigin:`top left`,opacity:e.opacity}},...i);return r&&r({dom:a,element:e})||a},video:async({element:e,page:t,store:n,elementHook:r})=>{let{cropX:i,cropY:a,cropWidth:o,cropHeight:s}=e,c=await Rv(e.src),l=c.width*o,u=c.height*s,d=e.width/e.height,f,p;d>=l/u?(f=l,p=l/d):(f=u*d,p=u);let m=f/o,h=p/s,g=i*c.width,_=a*c.height,v=Math.max(e.width/c.width,e.height/c.height),y={position:`absolute`,width:`${Math.round(m*v)}px`,height:`${Math.round(h*v)}px`,left:-Math.round(g*v)+`px`,top:-Math.round(_*v)+`px`,objectFit:`fill`},b=`video-${e.id}`,x=e.borderSize&&$_(e.borderColor),S=_x(`div`,{style:{position:`relative`,width:`100%`,height:`100%`,overflow:`hidden`,borderRadius:(x?Math.max(0,e.cornerRadius-e.borderSize):e.cornerRadius)+`px`,border:e.borderSize&&!x?`${e.borderSize}px solid ${e.borderColor}`:`none`}},_x(`video`,{id:b,src:e.src,style:y,controls:!0,playsInline:!0,muted:!0,volume:e.volume}));if(x){let t=_x(`div`,{style:{width:`100%`,height:`100%`,borderRadius:e.cornerRadius+`px`,background:vx(e.borderColor),padding:e.borderSize+`px`,boxSizing:`border-box`}},S);return r&&r({dom:t,element:e})||t}return r&&r({dom:S,element:e})||S},gif:bx,table:async({element:e})=>{let t=e.rows,n=e.cols,r=e.colWidths,i=e.rowHeights,a=[`fontSize`,`fontFamily`,`fontWeight`,`fontStyle`,`textDecoration`,`textTransform`,`fill`,`align`,`verticalAlign`,`lineHeight`,`letterSpacing`,`strokeWidth`,`stroke`,`cellBackground`,`cellPadding`],o=(e.cells||[]).map(t=>{if(!t)return t;let n=Object.assign({},t);for(let t of a)n[t]===void 0&&(n[t]=e[t]);return n}),s=[];for(let r=0;r<t;r++){let t=[];for(let a=0;a<n;a++){let s=o[r*n+a];if(!s||s.mergedInto)continue;let c=s.cellPadding||4,l=s.colSpan||1,u=s.rowSpan||1,d=t=>{let n=s.borders?.[t];return`${n?.width??e.borderWidth}px ${n?.style??e.borderStyle??`solid`} ${n?.color??e.borderColor}`},f={style:{padding:c+`px`,background:s.cellBackground||`transparent`,fontSize:(s.fontSize||12)+`px`,fontFamily:`'${s.fontFamily||`Roboto`}'`,fontWeight:s.fontWeight||`normal`,fontStyle:s.fontStyle||`normal`,color:s.fill||`black`,textAlign:s.align||`left`,verticalAlign:s.verticalAlign||`top`,lineHeight:String(s.lineHeight||1.2),letterSpacing:s.letterSpacing?s.letterSpacing*(s.fontSize||12)+`px`:void 0,textDecoration:s.textDecoration||`none`,textTransform:s.textTransform||`none`,borderTop:d(`top`),borderRight:d(`right`),borderBottom:d(`bottom`),borderLeft:d(`left`),overflow:`hidden`,wordBreak:`break-word`,whiteSpace:`pre-wrap`,height:i[r]*e.height+`px`}};l>1&&(f.colspan=String(l)),u>1&&(f.rowspan=String(u)),t.push(_x(`td`,f,m_(s.text||``)))}s.push(_x(`tr`,{},...t))}return _x(`table`,{style:{width:`100%`,height:`100%`,borderCollapse:`collapse`,tableLayout:`fixed`}},_x(`colgroup`,{},...r.map(e=>_x(`col`,{style:{width:100*e+`%`}}))),_x(`tbody`,{},...s))}};async function Cx({element:e,page:t,store:n,elementHook:r}){let i=await Sx[e.type];if(i||(i=()=>_x(`div`,{}),console.error(`HTML export does not support ${e.type} type...`)),!e.visible)return null;let a=await i({element:e,page:t,store:n}),o=[],s=[];if(e.blurEnabled&&o.push(`blur(${e.blurRadius/2}px)`),e.brightnessEnabled&&o.push(`brightness(${100*e.brightness+100}%)`),e.sepiaEnabled&&o.push(`sepia()`),e.grayscaleEnabled&&o.push(`grayscale()`),e.filters)for(let[t,n]of Object.entries(e.filters)){let e=Lv(Iv[t],n.intensity);e&&(o.push(e.filter),e.html&&s.push(e.html))}if(e.shadowEnabled){let t=function(e,t){if(t===1)return e;let n=G.Util.colorToRGBA(e);return n?`rgba(${n.r}, ${n.g}, ${n.b}, ${n.a*t})`:e}(e.shadowColor,e.shadowOpacity??1);o.push(`drop-shadow(${e.shadowOffsetX}px ${e.shadowOffsetY}px ${e.shadowBlur/2}px ${t})`)}let c=_x(`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&&e.showInExport?`block`:`none`,filter:o.join(` `)||`none`}},a,...s);return r&&r({dom:c,element:e})||c}async function wx({json:e,elementHook:t}){let n=await Promise.all(e.pages.map(n=>async function({page:e,store:t,elementHook:n}){let r=await Promise.all(e.children.map(r=>Cx({element:r,page:e,store:t,elementHook:n}))),i=e.width===`auto`?t.width:e.width,a=e.height===`auto`?t.height:e.height,o={};if(e.background.indexOf(`url`)>=0||e.background.indexOf(`http`)>=0||e.background.indexOf(`.jpg`)>=0||e.background.indexOf(`.png`)>=0||e.background.indexOf(`.jpeg`)>=0){let{width:n,height:o}=await vv(e.background),s=await bx({element:Object.assign({x:0,y:0,width:i,height:a,src:e.background,cornerRadius:0},bv({width:i,height:a},{width:n,height:o})),page:e,store:t});r.unshift(s)}else o=$_(e.background)?Object.assign(Object.assign({},o),{backgroundImage:e.background}):Object.assign(Object.assign({},o),{backgroundColor:e.background});return _x(`div`,{className:`page`,id:e.id,style:Object.assign(Object.assign({},o),{width:i+`px`,height:a+`px`,overflow:`hidden`,position:`relative`})},...r)}({page:n,store:e,elementHook:t}))),r=[];return jy({children:e.pages},e=>{e.type!==`text`&&e.type!==`tablecell`&&e.type!==`table`||!e.fontFamily||r.indexOf(e.fontFamily)!==-1||r.push(e.fontFamily)}),_x(`div`,{className:`design`},...r.map(t=>{let n=e.fonts.find(e=>e.fontFamily===t);return n?_x(`style`,{},(n.styles||(n.url?[{src:`url("${n.url}")`}]:[])).map(e=>`\n @font-face {\n font-family: '${n.fontFamily}';\n src: ${e.src};\n font-style: ${e.fontStyle||`normal`};\n font-weight: ${e.fontWeight||`normal`};\n font-display: swap;\n }`).join(`
|
|
220
|
-
`)):_x(`link`,{href:N_(t),rel:`stylesheet`})}),...n)}var Tx=({dom:e})=>{if(typeof e==`string`)return e;if(!e)return``;let t=e.props,{innerHTML:n}=t,r=gx(t,[`innerHTML`]),i=Object.keys(r).map(e=>e===`style`&&typeof r[e]==`object`?`style="${Object.keys(r[e]).filter(t=>r[e][t]!=null).map(t=>`${t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}: ${r[e][t]}`).join(`; `)}"`:((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}"`)(e,r[e])).filter(e=>e&&e.trim().length>0).join(` `);return`<${e.type} ${i}>${n||e.children.map(e=>Tx({dom:e})).join(``)}</${e.type}>`};async function Ex({json:e,elementHook:t}){return Tx({dom:await wx({json:e,elementHook:t})})}var Dx=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},Ox=(e,t)=>{if(e.children)for(let n of e.children){if(!0===t(n))break;Ox(n,t)}if(e.cells){for(let n of e.cells)if(!0===t(n))break}},Y=(e,t,...n)=>({type:e,props:t,children:n||[]});function kx(e,t){if(!$_(e))return null;let{stops:n,rotation:r}=tv(e),i=r*Math.PI/180,a=.5-.5*Math.sin(i),o=.5+.5*Math.cos(i),s=.5+.5*Math.sin(i),c=.5-.5*Math.cos(i),l=n.map(({offset:e,color:t})=>Y(`stop`,{offset:100*e+`%`,"stop-color":t}));return Y(`linearGradient`,{id:t,x1:100*a+`%`,y1:100*o+`%`,x2:100*s+`%`,y2:100*c+`%`},...l)}var Ax=async e=>{try{let t=await fetch(e);if(typeof Buffer<`u`){let e=await t.arrayBuffer(),n=Buffer.from(e).toString(`base64`);return`data:${t.headers.get(`content-type`)||`image/png`};base64,${n}`}{let e=await t.blob();return new Promise((t,n)=>{let r=new FileReader;r.onloadend=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})}}catch(t){return console.error(`Error converting URL to data URL:`,t),e}},jx=async({element:e,page:t,store:n})=>{let{src:r}=e;r=e.type===`svg`?_v(await pv(r),new Map(Object.entries(e.colorsReplace))):await Ax(r);let i,a,o,s,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})`}e.clipSrc&&(i=`clip-img-mask-${e.id}`,a=await Ax(e.clipSrc)),e.maskSrc&&(o=`mask-img-${e.id}`,s=await Ax(e.maskSrc));let l=await vv(r),u=l.width*e.cropWidth,d=l.height*e.cropHeight,f=e.width/e.height,p,m,h=u/d,g=typeof e.stretchEnabled==`boolean`&&e.stretchEnabled||e.type===`svg`;g?(p=u,m=d):f>=h?(p=u,m=u/f):(p=d*f,m=d);let _=p/l.width,v=m/l.height,y=p/m>e.width/e.height?e.height/m:e.width/p,b=g?e.width/p:y,x=g?e.height/m:y,S=p*b/_,C=m*x/v,w=e.cropX*l.width*b,T=e.cropY*l.height*x;e.flipX&&(w=(1-e.cropX-e.cropWidth)*l.width*b),e.flipY&&(T=(1-e.cropY-e.cropHeight)*l.height*x);let E=`clip-${e.id}`,D=e.cornerRadius||0,ee=r.replace(/&/g,`&`),O={x:-w,y:-T,width:S,height:C,preserveAspectRatio:`none`,"clip-path":`url(#${E})`},k=[Y(`clipPath`,{id:E},Y(`rect`,{x:0,y:0,width:e.width,height:e.height,rx:D||void 0,ry:D||void 0}))];i&&a&&k.push(Y(`mask`,{id:i,maskUnits:`userSpaceOnUse`,"mask-type":`alpha`},Y(`image`,{href:a.replace(/&/g,`&`),x:0,y:0,width:e.width,height:e.height,preserveAspectRatio:`none`}))),o&&k.push(Y(`mask`,{id:o,maskUnits:`userSpaceOnUse`,"mask-type":`alpha`},Y(`image`,Object.assign({href:ee},O))));let A=ee,te={};o&&s&&(A=s.replace(/&/g,`&`),te.mask=`url(#${o})`);let ne={};i&&(ne.mask=`url(#${i})`);let j=e.borderSize||0,M=j>0&&$_(e.borderColor),re=M?`border-grad-${e.id}`:null;if(M){let t=kx(e.borderColor,re);t&&k.push(t)}let ie=j>0?Y(`rect`,{x:j/2,y:j/2,width:Math.max(0,e.width-j),height:Math.max(0,e.height-j),fill:`none`,stroke:M?`url(#${re})`:e.borderColor,"stroke-width":j,rx:Math.max(0,D-j)||void 0,ry:Math.max(0,D-j)||void 0}):null,ae=Y(`g`,{},Y(`defs`,{},...k),Y(`image`,Object.assign(Object.assign({href:A},O),te)),ie);return Y(`g`,ne,c?Y(`g`,{transform:c},ae):ae)},Mx=({element:e,type:t})=>{let n={"stroke-width":e.height,stroke:e.color,"stroke-linecap":`round`,"stroke-linejoin":`round`},r=Object.assign(Object.assign({},n),{fill:e.color}),i=Object.assign(Object.assign({},n),{fill:`none`});return t===`arrow`?Y(`polyline`,Object.assign({points:`${3*e.height},${2*-e.height} 0,0 ${3*e.height},${2*e.height}`},i)):t===`triangle`?Y(`polygon`,Object.assign({points:`${3*e.height},${2*-e.height} 0,0 ${3*e.height},${2*e.height}`},r)):t===`bar`?Y(`polyline`,Object.assign({points:`0,${2*-e.height} 0,${2*e.height}`},i)):t===`circle`?Y(`circle`,Object.assign({cx:2*e.height,cy:0,r:2*e.height},r)):t===`square`?Y(`polygon`,Object.assign({points:`0,${2*-e.height} ${4*e.height},${2*-e.height} ${4*e.height},${2*e.height} 0,${2*e.height}`},r)):null},Nx={image:jx,svg:jx,text:async({element:e,page:t,store:n})=>{let r=$_(e.fill),i=$_(e.stroke);if(e.curveEnabled){let t=gb(e.width,e.height,e.curvePower,e.fontSize),n=`curve-path-${e.id}`,a=(m_(e.text).replace(/\n/g,` `),g_(e.text)),o={fontWeight:e.fontWeight||`normal`,fontStyle:e.fontStyle||`normal`,fill:e.fill||`black`},s=yb(a,o),c=yb(a,o,{omitColors:!0}),l=e.backgroundPadding*(e.fontSize*e.lineHeight*.5),u=e.backgroundEnabled?Y(`rect`,{x:-l,y:-l,width:e.width+2*l,height:e.height+2*l,fill:e.backgroundColor,opacity:e.backgroundOpacity,rx:e.backgroundCornerRadius*(e.fontSize*e.lineHeight*.5),ry:e.backgroundCornerRadius*(e.fontSize*e.lineHeight*.5)}):null,d=[Y(`path`,{id:n,d:t,fill:`none`})],f=e.strokeWidth&&(i||r&&!i);if(r){let t=`curve-fill-grad-${e.id}`,n=kx(e.fill,t);n&&d.push(n)}if(i&&e.strokeWidth){let t=`curve-stroke-grad-${e.id}`,n=kx(e.stroke,t);n&&d.push(n)}if(f){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*e.fontSize+`px`},a=i?`url(#curve-stroke-grad-${e.id})`:e.stroke,o=Y(`text`,Object.assign(Object.assign({},t),{fill:a,"stroke-width":e.strokeWidth,stroke:a}),Y(`textPath`,{href:`#${n}`,startOffset:`50%`,innerHTML:c})),l=r?`url(#curve-fill-grad-${e.id})`:e.fill,f=Y(`text`,Object.assign(Object.assign({},t),{fill:l}),Y(`textPath`,{href:`#${n}`,startOffset:`50%`,innerHTML:s}));return Y(`g`,{},u,Y(`defs`,{},...d),o,f)}return Y(`g`,{},u,Y(`defs`,{},...d),Y(`text`,{fill:r?`url(#curve-fill-grad-${e.id})`: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*e.fontSize+`px`,"stroke-width":e.strokeWidth||void 0,stroke:e.strokeWidth?i?`url(#curve-stroke-grad-${e.id})`:e.stroke:void 0,"paint-order":e.strokeWidth?`stroke fill`:void 0},Y(`textPath`,{href:`#${n}`,startOffset:`50%`,innerHTML:s})))}let a=(e,t,n,r,i,a=0)=>{let o=document.createElement(`canvas`).getContext(`2d`);return o.font=`${i} ${r} ${t}px ${n}`,o.measureText(e).width+Math.max(0,(e?e.length:0)-1)*a*t},o=(e,t,n,r,i,o,s=0)=>{let c=[];return e.split(`
|
|
221
|
-
`).forEach(e=>{let l=e.split(` `),u=``;for(let e=0;e<l.length;e++){let d=u+l[e]+` `;a(d,n,r,i,o,s)>t+.5&&e>0?(c.push(u.trim()),u=l[e]+` `):u=d}c.push(u.trim())}),c},s=m_(e.text);e.textTransform==`uppercase`&&(s=s.toUpperCase());let c=e.fontSize,l=[];for(;;){l=o(s,e.width,c,e.fontFamily,e.fontWeight,e.fontStyle,e.letterSpacing);let t=Math.max(...l.map(t=>a(t,c,e.fontFamily,e.fontWeight,e.fontStyle,e.letterSpacing))),n=l.length*c*e.lineHeight;if(t<=e.width&&n<=e.height||(--c,c<4))break}let u=c*e.lineHeight,d=l.length*u,f=c;e.verticalAlign===`middle`?f=(e.height-d)/2+c:e.verticalAlign===`bottom`&&(f=e.height-d+c);let p=e.align===`center`?`middle`:e.align===`right`?`end`:`start`,m=l.map((t,n)=>Y(`tspan`,{x:e.align===`center`?e.width/2:e.align===`right`?e.width:0,dy:n===0?0:u,innerHTML:t===``?``:db(t)})),h=e.backgroundPadding*(c*e.lineHeight*.5),g=e.backgroundCornerRadius*(c*e.lineHeight*.5),_=null;if(e.backgroundEnabled)if(e.legacyBackground)_=Y(`rect`,{x:-h,y:-h,width:e.width+2*h,height:e.height+2*h,fill:e.backgroundColor,opacity:e.backgroundOpacity,rx:g,ry:g});else{let t=lb({lines:l.map(t=>({width:t===``?0:a(t,c,e.fontFamily,e.fontWeight,e.fontStyle,e.letterSpacing)})),lineHeight:u,width:e.width,align:e.align===`justify`?`justify`:e.align}),n=0;e.verticalAlign===`middle`?n=(e.height-l.length*u)/2:e.verticalAlign===`bottom`&&(n=e.height-l.length*u);let r=cb({rects:t,padding:h,cornerRadius:g});r&&(_=Y(`path`,{d:r,fill:e.backgroundColor,opacity:e.backgroundOpacity,transform:n?`translate(0,${n})`:void 0}))}let v=[],y=e.strokeWidth&&(i||r&&!i);if(r){let t=`text-fill-grad-${e.id}`,n=kx(e.fill,t);n&&v.push(n)}if(i&&e.strokeWidth){let t=`text-stroke-grad-${e.id}`,n=kx(e.stroke,t);n&&v.push(n)}if(y){let t={y:f,"font-size":c+`px`,"text-anchor":p,"font-family":e.fontFamily,"font-style":e.fontStyle,"font-weight":e.fontWeight,"text-decoration":e.textDecoration,"line-height":e.lineHeight,"letter-spacing":e.letterSpacing*c+`px`},n=i?`url(#text-stroke-grad-${e.id})`:e.stroke,a=Y(`text`,Object.assign(Object.assign({},t),{fill:n,"stroke-width":e.strokeWidth,stroke:n}),...m.map(e=>Y(`tspan`,e.props,e.props.innerHTML))),o=r?`url(#text-fill-grad-${e.id})`:e.fill,s=Y(`text`,Object.assign(Object.assign({},t),{fill:o}),...m.map(e=>Y(`tspan`,e.props,e.props.innerHTML)));return Y(`g`,{},_,v.length>0?Y(`defs`,{},...v):null,a,s)}return Y(`g`,{},_,v.length>0?Y(`defs`,{},...v):null,Y(`text`,{fill:r?`url(#text-fill-grad-${e.id})`:e.fill,y:f,"font-size":c+`px`,"text-anchor":p,"font-family":e.fontFamily,"font-style":e.fontStyle,"font-weight":e.fontWeight,"text-decoration":e.textDecoration,"line-height":e.lineHeight,"letter-spacing":e.letterSpacing*c+`px`,"stroke-width":e.strokeWidth||void 0,stroke:e.strokeWidth?e.stroke:void 0,"paint-order":e.strokeWidth?`stroke fill`:void 0},...m))},line:async({element:e,page:t,store:n})=>Y(`g`,{},Y(`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}),Y(`g`,{transform:`translate(0 ${e.height/2})`},Mx({element:e,type:e.startHead})),Y(`g`,{transform:`translate(${e.width} ${e.height/2}) rotate(180)`},Mx({element:e,type:e.endHead}))),figure:async({element:e,page:t,store:n,elementHook:r})=>{let i=function(e){let t=e.replace(/<svg[^>]*>/,``);return t=t.replace(/<\/svg>/,``),t}(Nv(e)),a=[];if(e.strokeWidth&&$_(e.stroke)){let t=`figure-stroke-grad-${e.id}`,n=kx(e.stroke,t);if(n){a.push(n);let r=e.stroke.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);i=i.replace(RegExp(`stroke="${r}"`,`g`),`stroke="url(#${t})"`)}}if($_(e.fill)){let t=`figure-fill-grad-${e.id}`,n=kx(e.fill,t);if(n){a.push(n);let r=e.fill.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);i=i.replace(RegExp(`fill="${r}"`,`g`),`fill="url(#${t})"`)}}if(a.length>0){let t=Y(`g`,{},Y(`defs`,{},...a),Y(`g`,{innerHTML:i}));return r&&r({dom:t,element:e})||t}let o=Y(`g`,{innerHTML:i});return r&&r({dom:o,element:e})||o},group:async({element:e,page:t,store:n,elementHook:r})=>{let i=Y(`g`,{style:{"transform-origin":`top left`}},...await Promise.all(e.children.map(e=>Px({element:e,page:t,store:n,elementHook:r}))));return r&&r({dom:i,element:e})||i},gif:jx,table:async({element:e})=>{e.rows;let t=e.cols,n=e.colWidths,r=e.rowHeights,i=[`fontSize`,`fontFamily`,`fontWeight`,`fontStyle`,`textDecoration`,`textTransform`,`fill`,`align`,`verticalAlign`,`lineHeight`,`letterSpacing`,`strokeWidth`,`stroke`,`cellBackground`,`cellPadding`],a=(e.cells||[]).map((n,r)=>{let a=Object.assign(Object.assign({},n),{row:Math.floor(r/t),col:r%t});for(let t of i)a[t]===void 0&&(a[t]=e[t]);return a}),o=[],s=(t,i,a,o)=>{let s=0;for(let t=0;t<i;t++)s+=n[t]*e.width;let c=0;for(let n=0;n<t;n++)c+=r[n]*e.height;let l=0;for(let t=i;t<i+o;t++)l+=(n[t]||0)*e.width;let u=0;for(let n=t;n<t+a;n++)u+=(r[n]||0)*e.height;return{x:s,y:c,width:l,height:u}};for(let e of a)if(!e.mergedInto&&e.cellBackground&&e.cellBackground!==`transparent`){s(e.row,e.col,e.colSpan||1,e.colSpan||1);let{x:t,y:n,width:r,height:i}=s(e.row,e.col,e.rowSpan||1,e.colSpan||1);o.push(Y(`rect`,{x:t,y:n,width:r,height:i,fill:e.cellBackground}))}let c=(e,t)=>e===`dashed`?`${4*t},${2*t}`:e===`dotted`?`${t},${t}`:void 0,l=(t,n)=>{let r=t.borders?.[n];return{width:r?.width??e.borderWidth,style:r?.style??e.borderStyle??`solid`,color:r?.color??e.borderColor}};for(let e of a){if(e.mergedInto)continue;let t=s(e.row,e.col,e.rowSpan||1,e.colSpan||1);if(e.row===0){let n=l(e,`top`);n.style!==`none`&&n.width>0&&o.push(Y(`line`,{x1:t.x,y1:t.y+n.width/2,x2:t.x+t.width,y2:t.y+n.width/2,stroke:n.color,"stroke-width":n.width,"stroke-dasharray":c(n.style,n.width)}))}if(e.col===0){let n=l(e,`left`);n.style!==`none`&&n.width>0&&o.push(Y(`line`,{x1:t.x+n.width/2,y1:t.y,x2:t.x+n.width/2,y2:t.y+t.height,stroke:n.color,"stroke-width":n.width,"stroke-dasharray":c(n.style,n.width)}))}{let n=l(e,`bottom`);n.style!==`none`&&n.width>0&&o.push(Y(`line`,{x1:t.x,y1:t.y+t.height-n.width/2,x2:t.x+t.width,y2:t.y+t.height-n.width/2,stroke:n.color,"stroke-width":n.width,"stroke-dasharray":c(n.style,n.width)}))}{let n=l(e,`right`);n.style!==`none`&&n.width>0&&o.push(Y(`line`,{x1:t.x+t.width-n.width/2,y1:t.y,x2:t.x+t.width-n.width/2,y2:t.y+t.height,stroke:n.color,"stroke-width":n.width,"stroke-dasharray":c(n.style,n.width)}))}}for(let t of a){if(t.mergedInto)continue;let i=m_(t.text||``);if(!i)continue;t.textTransform===`uppercase`&&(i=i.toUpperCase());let a=t.cellPadding||4,s=0;for(let r=0;r<t.col;r++)s+=n[r]*e.width;let c=0;for(let n=0;n<t.row;n++)c+=r[n]*e.height;let l=n[t.col]*e.width,u=r[t.row]*e.height,d=t.fontSize||12,f=t.align||`left`,p=s+a,m=`start`;f===`center`?(p=s+l/2,m=`middle`):f===`right`&&(p=s+l-a,m=`end`);let h=c+a+d,g=t.verticalAlign||`top`;g===`middle`?h=c+u/2+d/3:g===`bottom`&&(h=c+u-a),o.push(Y(`text`,{x:p,y:h,"font-size":d,"font-family":t.fontFamily||`Roboto`,"font-weight":t.fontWeight||`normal`,"font-style":t.fontStyle||`normal`,fill:t.fill||`black`,"text-anchor":m,"text-decoration":t.textDecoration||`none`,"letter-spacing":t.letterSpacing?t.letterSpacing*d+`px`:void 0},db(i)))}return Y(`g`,{},...o)}};async function Px({element:e,page:t,store:n,elementHook:r}){var i;let a=await Nx[e.type];a||(a=()=>Y(`g`,{}),console.error(`SVG export does not support ${e.type} type...`));let o=await a({element:e,page:t,store:n}),s=[],c=[];if(e.blurEnabled&&s.push(`blur(${e.blurRadius/2}px)`),e.brightnessEnabled&&s.push(`brightness(${100*e.brightness+100}%)`),e.sepiaEnabled&&s.push(`sepia()`),e.grayscaleEnabled&&s.push(`grayscale()`),e.shadowEnabled&&s.push(`drop-shadow(${e.shadowOffsetX}px ${e.shadowOffsetY}px ${e.shadowBlur}px ${e.shadowColor})`),e.filters)for(let[t,n]of Object.entries(e.filters)){let e=Lv(Iv[t],n.intensity);if(e&&(s.push(e.filter),e.html)){let t=e.html.replace(/<svg([^>]*)>/,`<g$1>`).replace(/<\/svg>/,`</g>`);c.push(t)}}let l=Y(`g`,{className:`element`,id:e.id,transform:e.type===`group`?void 0:`translate(${e.x}, ${e.y}) rotate(${e.rotation})`,display:(i=e.visible)==null||i?void 0:`none`,opacity:e.opacity,style:{"transform-origin":`top left`,filter:s.join(` `)}},o,...c);return r&&r({dom:l,element:e})||l}async function Fx(e){try{let t=await fetch(e),n=t.headers.get(`content-type`)||`font/ttf`,r=await t.arrayBuffer();return`data:${n};base64,${typeof Buffer<`u`?Buffer.from(r).toString(`base64`):function(e){let t=new Uint8Array(e),n=``;for(let e=0;e<t.length;e+=32768){let r=t.subarray(e,e+32768);n+=String.fromCharCode(...r)}if(typeof btoa<`u`)return btoa(n);if(typeof Buffer<`u`)return Buffer.from(t).toString(`base64`);throw Error(`No base64 encoder available in this environment`)}(r)}`}catch(t){return console.error(`Error embedding font:`,t),e}}async function Ix({json:e,elementHook:t,fontEmbedding:n=`inline`}){let r=[];Ox({children:e.pages},e=>{e.type!==`text`&&e.type!==`tablecell`&&e.type!==`table`||!e.fontFamily||r.indexOf(e.fontFamily)!==-1||r.push(e.fontFamily)});let i=n===`inline`?await async function(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)return Y(`style`,{},`@font-face { font-family: ${e}; src: url(${await Fx(n.url)}); }`);{let t=`https://fonts.googleapis.com/css?family=${e}:bi,normal,i,b`;try{let n=await(await fetch(t)).text(),r=(n.match(/url\((.*?)\)/g)?.map(e=>e.replace(/url\((.*?)\)/,`$1`)))?.filter(e=>e.startsWith(`https`));if(!r?.length)throw Error(`No font URLs found`);return Y(`style`,{},(await Promise.all(r.map(async t=>{let r=await Fx(t),i=n.match(/font-style:\s*(.*?);/),a=n.match(/font-weight:\s*(.*?);/);return`@font-face {\n font-family: ${e};\n font-style: ${i?i[1]:`normal`};\n font-weight: ${a?a[1]:`normal`};\n src: url(${r});\n }`}))).join(`
|
|
222
|
-
`))}catch(e){return console.error(`Error embedding Google Font:`,e),Y(`defs`,{},Y(`style`,{type:`text/css`,innerHTML:`@import url('${t}');`.replace(/&/g,`&`)}))}}}))}(r,e.fonts):[],a=await Promise.all(e.pages.map(n=>async function({page:e,store:t,elementHook:n}){let r=await Promise.all(e.children.map(r=>Px({element:r,page:e,store:t,elementHook:n}))),i=e.background.indexOf(`url`)>=0||e.background.indexOf(`http`)>=0||e.background.indexOf(`.jpg`)>=0||e.background.indexOf(`.png`)>=0||e.background.indexOf(`.jpeg`)>=0,a;if(i){let n=await vv(e.background);a=await yv(e.background,Object.assign({width:t.width,height:t.height,x:0,y:0},bv({width:t.width,height:t.height},{width:n.width,height:n.height})))}return Y(`g`,{className:`page`,style:{}},i?Y(`image`,{"xlink:href":a,x:0,y:0,width:t.width,height:t.height,preserveAspectRatio:`none`}):Y(`rect`,{x:0,y:0,width:t.width,height:t.height,fill:i?void 0:e.background}),...r)}({page:n,store:e,elementHook:t})));return Y(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,viewBox:`0 0 ${e.width} ${e.height}`,width:e.width,height:e.height},...i,...a)}var Lx=({dom:e,nestLevel:t=0})=>{if(typeof e==`string`)return e;if(!e)return``;let n=e.props,{innerHTML:r}=n,i=Dx(n,[`innerHTML`]),a=Object.keys(i).map(e=>((e,t)=>typeof t==`object`?`${e}="${Object.keys(t).map(e=>`${e}:${t[e]};`).join(` `)}"`:t==null||t===``?``:`${e}="${t}"`)(e,i[e])).filter(e=>e&&e.trim().length>0).join(` `),o=` `.repeat(t);return`${o}<${e.type}${a?` `+a:``}>${r||`
|
|
223
|
-
`+e.children.map(e=>Lx({dom:e,nestLevel:t+1})).join(``)}${o}</${e.type}>\n`};async function Rx({json:e,elementHook:t,fontEmbedding:n=`inline`}){return Lx({dom:await Ix({json:e,elementHook:t,fontEmbedding:n})})}var zx=q.model(`Audio`,{id:q.identifier,src:``,duration:0,startTime:0,endTime:1,volume:1,delay:0,custom:q.frozen()}).actions(e=>({toJSON:()=>Object.assign({},np(e))})).actions(e=>({set(t){Object.assign(e,t)}})),Bx=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};Hf(`ignore`);var Vx=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})),Hx={ADMIN:`admin`,VIEWER:`viewer`},Ux=q.model(`Store`,{role:``,pages:q.array(Kv),fonts:q.array(Vx),audios:q.array(zx),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:3,bleedVisible:!1,rulesVisible:!1,distanceGuidesVisible:!1,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(bg,{targetPath:`../pages`}),_elementsPixelRatio:Math.min(2,typeof window<`u`&&window.devicePixelRatio||1),_activePageId:``,_selectedPagesIds:q.array(q.string),_forceShowCredit:!1,_key:``,_validated:!1}).views(e=>{let t=Vt(()=>{let t={};return jy({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 Ay({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},get _hasCroppedImages(){return this.find(e=>e.type===`image`&&e._cropModeEnabled)},find(t){let n;return jy({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=pp(a),e.currentTime=o,e.isPlaying=!0,t=Date.now(),n=c,r=l,requestAnimationFrame(()=>i.seek())},checkActivePage(){let t=0;for(let n of e.pages){if(e.currentTime>=n.startTime&&e.currentTime<n.startTime+n.duration){i.selectPage(n.id);break}t+=n.duration}},seek(){if(!e.isPlaying)return;let a=Date.now(),o=a-t;t=a,e.currentTime+=o,i.checkActivePage();let s=n||e.duration;e.isPlaying&&e.currentTime<s?requestAnimationFrame(()=>i.seek()):e.isPlaying&&r?(e.currentTime=0,requestAnimationFrame(()=>i.seek())):i.stop()},stop(){e.isPlaying=!1,e.currentTime=0,e.animatedElementsIds=pp([]),i.checkActivePage()},__(){e._validated||=(Xg(e._key,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=Kv.create(Object.assign({id:xg(10)},t));return e.pages.push(n),e._activePageId=n.id,n},selectPage(t){e._activePageId=t,e._selectedPagesIds.length===1&&(e._selectedPagesIds=pp([t]))},selectPages(t){e._selectedPagesIds=pp(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=pp(n.map(e=>e.id))},toggleBleed(t){e.bleedVisible=t??!e.bleedVisible},toggleRulers(t){e.rulesVisible=t??!e.rulesVisible},toggleDistanceGuides(t){e.distanceGuidesVisible=t??!e.distanceGuidesVisible},openSidePanel(t){e.openedSidePanel!==t&&(e.previousOpenedSidePanel=e.openedSidePanel,e.openedSidePanel=t)},restoreSidePanel(){let t=e.previousOpenedSidePanel;t&&t!==e.openedSidePanel?e.openedSidePanel=t:e.openedSidePanel=`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&&(up(r),e.pages.remove(r),e.pages.splice(n,0,r))},deletePages(t){let n=e.pages.indexOf(e.activePage);t.forEach(t=>{dp(e.pages.find(e=>e.id===t))});let r=Math.min(e.pages.length-1,n),i=e.pages[r];i&&(e._activePageId=i.id),e.selectedElementsIds=pp(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=>up(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:xg(10),name:`group-${a+1}`,children:r,type:`group`},n);return i.children.push(o),e.selectedElementsIds=pp([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=>{up(e),t.children.push(e)}),t.children.splice(n,1)}}),e.selectedElementsIds=pp(r)},deleteElements(t){let n=[];e.find(e=>(t.includes(e.id)&&n.push(e),!1)),n.forEach(e=>{dp(e)}),e.selectedElementsIds=pp(e.selectedElementsIds.filter(t=>e.getElementById(t)))},on(t,n){if(t===`change`){let t=i.toJSON();return $f(e,e=>{let r=i.toJSON();!yg(t,r)&&(t=r,n(r))})}},async _toCanvas({pixelRatio:t,ignoreBackground:n,pageId:r,mimeType:a,includeBleed:o,_skipTimeout:s,quickMode:c=!1,_exportCanvases:l}={}){let u=t||1;r||=e.pages[0]?.id;let d=e.pages.find(e=>e.id===r);if(!d)throw Error(`No page for export with id ${r}`);let f=e._elementsPixelRatio;u>e._elementsPixelRatio&&i.setElementsPixelRatio(u),c?d?.set({_forceMount:!0}):d?.set({_exporting:!0});let p=await X_(()=>{let e=G.stages.filter(e=>e.getAttr(`pageId`)===r);return e.length===0?null:e});if(!p)throw d?.set({_forceMount:!1,_exporting:!1}),i.setElementsPixelRatio(f),Error(`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.`);p.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 m=p[0];await i.waitLoading({_skipTimeout:s});let h=m.findOne(`.page-container`);if(!h)throw i.setElementsPixelRatio(f),d?.set({_forceMount:!1,_exporting:!1}),Error(`Export is failed. Canvas was unmounted.`);let g=m.position();m.position({x:0,y:0}),m.find(`Transformer`).forEach(e=>{e.setAttr(`oldVisible`,e.visible()),e.visible(!1)}),h.find(`.page-background`).forEach(e=>e.shadowEnabled(!1)),h.find(`.page-background`).forEach(e=>e.strokeEnabled(!1)),h.find(`.highlighter`).forEach(e=>e.visible(!1));let _=h.findOne(`.page-background-group`),v=_.clip();_.clip({x:null,y:null,width:null,height:null});let y=h.findOne(`.elements-container`),b=y.clip();y.clip({x:null,y:null,width:null,height:null});let x=h.find(e=>!e.visible()&&e.getAttr(`editModeEnabled`)&&!e.getAttr(`hideInExport`));x.forEach(e=>{e.setAttr(`oldVisible`,e.visible()),e.show()});let S=h.find(e=>e.getAttr(`hideInExport`));S.forEach(e=>{e.setAttr(`oldVisible`,e.visible()),e.hide()}),n&&h.find(`.page-background`).forEach(e=>e.hide());let C=o?d.bleed:0,w=C;!e.bleedVisible&&o||(e.bleedVisible||o?e.bleedVisible&&o?w=0:e.bleedVisible&&!o&&(w=-d.bleed):w=0);let T=d.computedWidth+2*C,E=d.computedHeight+2*C,D=h.scale();h.scale({x:1,y:1});let ee=W_(h,{x:h.x()-w,y:h.y()-w,width:T,height:E,pixelRatio:u,sceneCanvas:l?.sceneCanvas,bufferCanvas:l?.bufferCanvas});h.scale(D);let O=ee._canvas;if(a===`image/jpeg`){let e=O.getContext(`2d`);e.save(),e.globalCompositeOperation=`destination-over`,e.fillStyle=`white`,e.fillRect(0,0,O.width,O.height),e.restore()}return n&&h.find(`.page-background`).forEach(e=>e.show()),S.forEach(e=>{e.visible(e.getAttr(`oldVisible`))}),x.forEach(e=>{e.visible(e.getAttr(`oldVisible`))}),h.find(`.page-background`).forEach(e=>e.shadowEnabled(!0)),h.find(`.page-background`).forEach(e=>e.strokeEnabled(!0)),m.find(`Transformer`).forEach(e=>{e.visible(e.getAttr(`oldVisible`))}),h.find(`.highlighter`).forEach(e=>e.visible(!0)),_.clip(v),y.clip(b),m.position(g),d?.set({_exporting:!1,_forceMount:!1}),await Promise.resolve(),i.setElementsPixelRatio(f),O},async toDataURL(t={}){var{mimeType:n,quality:r,dpi:a,dpiMetadata:o=`auto`}=t,s=Bx(t,[`mimeType`,`quality`,`dpi`,`dpiMetadata`]);let c=await i._toCanvas(Object.assign({mimeType:n},s)),l=n||`image/png`,u=c.toDataURL(l,r);G.Util.releaseCanvas(c);let d=a??e.dpi;return l!==`image/png`&&l!==`image/jpeg`||o===`never`||o===`auto`&&d===72?u:H_(u,l,d)},async toBlob(e={}){var{mimeType:t,quality:n}=e,r=Bx(e,[`mimeType`,`quality`]);let a=await i._toCanvas(Object.assign({mimeType:t},r)),o=await new Promise(e=>{a.toBlob(e,t,n)});return G.Util.releaseCanvas(a),o},async saveAsImage(e={}){var{fileName:t}=e,n=Bx(e,[`fileName`]);let r=(n.mimeType||`image/png`).split(`/`)[1];Sg(await i.toDataURL(n),t||`polotno.`+r)},async _toPDF(t){let n=t.dpi||e.dpi,r=t.parallel||1,a=t.unit||(e.unit===`px`?`mm`:e.unit),o=t.pixelRatio||1,s=t.pageIds||(t.pageId?[t.pageId]:e.pages.map(e=>e.id)),c=e.pages.filter(e=>s.includes(e.id)),l=await wg(),u=e=>K_({px:e,unit:a,dpi:n}),d=t.cropMarkSize||0,f=u(d),p=c[0]||{},m=t.includeBleed?p.bleed:0,h=u(p.computedWidth+2*m+2*f),g=u(p.computedHeight+2*m+2*f);var _=new l({unit:a,orientation:h>g?`landscape`:`portrait`,format:[h,g],compress:!0,putOnlyUsedFonts:!0});_.deletePage(1);let v=((e,t)=>{let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n})(c,r),y=0;for(let e of v){let n=e.map(async e=>{let n=t.includeBleed?e.bleed:0,r=e.computedWidth+2*n+2*d,a=e.computedHeight+2*n+2*d,c=u(r),l=u(a),f=0,p=o;for(;f<10;){f+=1;let n=await i.toDataURL(Object.assign(Object.assign({},t),{pageId:e.id,pixelRatio:p,dpiMetadata:`never`}));if(n.length>20)return p!==o&&console.error(`Polotno can not export PDF with current settings. Quality is automatically reduced. pixelRatio was reduced to ${parseFloat(p.toFixed(3))}.`),t.onProgress&&t.onProgress(++y/s.length*.9),{url:n,width:c,height:l,widthPx:r,heightPx:a};p*=.8}});(await Promise.all(n)).filter(e=>e!==void 0).forEach(({url:e,width:t,height:n,widthPx:r,heightPx:i})=>{_.addPage([t,n],t>n?`landscape`:`portrait`);let o=_.getCurrentPageInfo();var s;switch(a){case`pt`:s=1;break;case`mm`:s=72/25.4;break;case`cm`:s=72/2.54;break;case`in`:s=72;break;case`px`:s=.75;break;default:throw`Invalid unit: `+a}if(o.pageContext.cropBox={bottomLeftX:0,bottomLeftY:0,topRightX:t*s,topRightY:n*s},o.pageContext.artBox={bottomLeftX:u(d+m)*s,bottomLeftY:u(d+m)*s,topRightX:u(r-d-m)*s,topRightY:u(i-d-m)*s},o.pageContext.bleedBox={bottomLeftX:u(d+m)*s,bottomLeftY:u(d+m)*s,topRightX:u(r-d-m)*s,topRightY:u(i-d-m)*s},f){_.setLineWidth(u(1));let e=f+u(m);_.line(e,0,e,f),_.line(0,e,f,e),_.line(t-e,0,t-e,f),_.line(t,e,t-f,e),_.line(0,n-e,f,n-e),_.line(e,n,e,n-f),_.line(t,n-e,t-f,n-e),_.line(t-e,n,t-e,n-f)}_.addImage(e,f,f,t-2*f,n-2*f,void 0,`FAST`)})}return _},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 Error(`No pages found for GIF export`);let o=a[0],s=await Eg({width:o.computedWidth*n,height:o.computedHeight*n}),c=1e3/(t.fps||10);for(let t of a){let r=Math.max(1,Math.floor(t.duration/c));for(let a=0;a<r;a++){let r=t.startTime+a*c||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});s.addFrame(o.getContext(`2d`),{delay:c,copy:!0})}}for(let t of e.pages)t.set({_rendering:!1});return i.stop(),s.render(),new Promise(e=>{s.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=Bx(e,[`fileName`]);Sg(await i.toGIFDataURL(n),t||`polotno.gif`)},async toHTML({elementHook:e}={}){return Ex({json:i.toJSON(),elementHook:e})},async saveAsHTML({fileName:e,elementHook:t}={}){let n=await i.toHTML({elementHook:t});Sg(`data:text/html;base64,`+window.btoa(unescape(encodeURIComponent(n))),e||`polotno.html`)},async toSVG({elementHook:e,pageId:t,fontEmbedding:n=`inline`}={fontEmbedding:`inline`}){let r=i.toJSON();t||=r.pages[0]?.id;let a=r.pages.find(e=>e.id===t);return Rx({json: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});Sg(`data:text/svg;base64,`+window.btoa(unescape(encodeURIComponent(a))),e||`polotno.svg`)},async saveAsPDF(e={}){var{fileName:t}=e,n=Bx(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 u_()},toJSON:()=>({width:e.width,height:e.height,fonts:np(e.fonts),pages:np(e.pages),audios:np(e.audios),unit:e.unit,dpi:e.dpi,custom:e.custom,schemaVersion:e.schemaVersion}),loadJSON(t,n=!1){var r,i;let a=typeof n==`boolean`?n:(r=n?.keepHistory)!=null&&r,o=typeof n!=`boolean`&&(i=n?.modernizeTextBackground)!=null&&i,s=JSON.parse(JSON.stringify(t)),c=s.schemaVersion||0;c<1&&kg.htmlRenderEnabled&&jy({children:s.pages},e=>{e.type===`text`&&(e.letterSpacing=e.letterSpacing*16/e.fontSize)}),c<2&&jy({children:s.pages},e=>{e.filters&&Object.keys(e.filters).forEach(t=>{if([`warm`,`cold`,`natural`].includes(t))return;let n=e.filters[t];n&&typeof n.intensity==`number`&&(n.intensity/=100)})}),c<3&&kg.htmlRenderEnabled&&!o&&jy({children:s.pages},e=>{e.type===`text`&&e.backgroundEnabled&&(e.legacyBackground=!0)}),delete s.schemaVersion;let l=e.activePage?e.pages.indexOf(e.activePage):0;s._activePageId=(s.pages[l]||s.pages[0])?.id;let u=Object.assign({},np(e));Object.assign(u,s),u.history=a?np(e.history):{history:[],undoIdx:-1,targetPath:``},tp(e,u)},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=>dp(e))},addAudio(t){let n=zx.create(Object.assign({id:xg(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)||v_.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`}))),L_(a)):P_(t),n&&r&&!o.some(e=>e.fontStyle===n&&e.fontWeight===r)&&o.push({fontStyle:n,fontWeight:r}),Promise.all(o.map(e=>k_(t,e.fontStyle,e.fontWeight,i)))},validate:e=>Ux.validate(e,[{path:``,type:Ux}]).map(e=>({path:`store`+e.context.map(e=>e.path).join(`.`),message:e.message}))};return i});function Wx({key:e,showCredit:t}={key:``,showCredit:!1}){return Ux.create({_forceShowCredit:t,_key:e})}var Gx=(e,t=100,n=!1,r)=>{let i=_.useRef(r??e),[,a]=_.useReducer(e=>e+1,0),o=_.useCallback(e=>{i.current!==e&&(i.current=e,a())},[i]),s=_.useRef(null);return e===n&&(s.current&&=(clearTimeout(s.current),null),i.current=n),_.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 Kx(){return document.createElement(`canvas`)}var qx=e=>e.indexOf(`data:image/svg+xml`)>=0||e.indexOf(`.svg`)>=0,Jx=e=>{let[t,n]=_.useState(e);return _.useEffect(()=>{(async()=>{let r=await async function(e){return qx(e)?mv(hv(await pv(e))):e}(e);r!==t&&n(r)})()},[e]),t};function Yx(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Xx=(e,t)=>t.width<5||t.height<5?e:t,Zx={keepRatio:!1,rotateEnabled:!1,boundBoxFunc:Xx},Qx={enabledAnchors:[`top-left`,`top-right`,`bottom-left`,`bottom-right`],rotateEnabled:!1,borderEnabled:!1,boundBoxFunc:Xx},$x=(e,t,n)=>Math.max(t,Math.min(n,e)),eS=(e,t,n,r,i=0,a=!1,o=!0)=>{let s=Math.floor($x(e.a.width*r,1,1e4)),c=Math.floor($x(e.a.height*r,1,1e4)),l=Math.min(i*r,s/2,c/2),u=Math.max(e.a.width/n.width,e.a.height/n.height)*r,d=e.page._exportingOrRendering&&kg.imageDownScalingEnabled&&u<1&&!a,f=n.x===0&&n.y===0&&n.width===t?.width&&n.height===t?.height,p=_.useMemo(()=>{if(t&&t.width&&t.height)return f&&l===0&&!d?void 0:Kx()},[t,l,d,f]);return _.useLayoutEffect(()=>{if(!p||!t)return;U_(p,s,c);let e=p.getContext(`2d`);if(!e)return;l&&(e.beginPath(),e.moveTo(l,0),e.lineTo(s-l,0),e.arc(s-l,l,l,3*Math.PI/2,0,!1),e.lineTo(s,c-l),e.arc(s-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=Kx();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,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,p.width,p.height)},[p,e.a.width,e.a.height,n.x,n.y,n.width,n.height,i,r,a,e.page._exportingOrRendering,d]),_.useEffect(()=>()=>{p&&p.nodeName===`CANVAS`&&G.Util.releaseCanvas(p)},[p]),p||t},tS=Kx(),nS=ga(({element:e})=>{let t=Math.min(30,e.a.width/4,e.a.height/4),n=_.useRef(null);_.useEffect(()=>{let e=n.current;if(!e)return;let t=new G.Animation(t=>{e.rotate((t?.timeDiff||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}});let{mediaLoadingStyle:r}=Ff();return _.createElement(nf,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport},_.createElement(af,{width:e.a.width,height:e.a.height,fill:r.fill}),_.createElement(`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}))}),rS=ga(({element:e})=>{let{mediaErrorStyle:t}=Ff(),n=Math.max(10,Math.min(30,e.a.width/25));return _.createElement(nf,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport},_.createElement(af,{width:e.a.width,height:e.a.height,fill:t.fill}),_.createElement(cf,{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}))}),iS=mf.default,aS=(e,t=``,n=``)=>{let r=_.useRef(),i=()=>{var e;(e=r.current)==null||e.call(r),r.current=void 0};_.useEffect(()=>i,[]),_.useLayoutEffect(()=>{let a=`image with id ${n} url: ${t.slice(0,200)}`;e!==`loading`||r.current||(r.current=c_(a)),e!==`loading`&&i(),e===`failed`&&p_(a)},[e])},oS=ga(({element:e,store:t})=>{let n=Ff(),[r,i]=_.useState(!1),a=_.useRef(null),o=_.useRef(null),s=e.isSelected,[c,l]=(e=>{let[t,n]=_.useReducer(e=>e+1,0),r=_.useRef(`loading`),i=_.useRef(e.src),a=_.useRef(e.src);a.current!==e.src&&(a.current=e.src,r.current=`loading`);let o=_.useMemo(()=>qx(e.src)||e.type===`svg`,[e.src,e.type]);return _.useEffect(()=>{if(!o||!e.src)return;let t=!1;return(async()=>{r.current=`loading`,n();let a=hv(await pv(e.src)),o;o=e.colorsReplace?_v(a,e.colorsReplace||new Map):mv(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),[u,d]=iS(c,`anonymous`);aS(e.type!==`svg`||l===`loaded`?d:`loading`,e.src,e.id);let f=e.page._exportingOrRendering?1:Math.max(1,t.scale),p=t._elementsPixelRatio*f,m=(({image:e,status:t,type:n})=>{let r=_.useRef();return _.useEffect(()=>{r.current=e||r.current},[e]),t!==`failed`||t!==`failed`&&n===`svg`?r.current:void 0})({image:u,status:d,type:e.type}),h=((e,t)=>{let n=Jx(e.maskSrc||``),[r,i]=iS(n,`anonymous`);return aS(n?i:`loaded`,n||``,e.id),_.useMemo(()=>{if(!r||!t||!t.width||!t.height)return t;let n=Kx();n.width=Math.max(t.width,1),n.height=Math.max(t.height,1);let i=n.getContext(`2d`);if(!i)return t;i.drawImage(t,0,0),i.globalCompositeOperation=`source-in`;let a=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 i.drawImage(r,a.x,a.y,a.width,a.height,0,0,t.width,t.height),n},[t,r,e.a.width,e.a.height])})(e,((e,t,n)=>{let r=_.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,l=(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||c)&&s||e.maskSrc;if(!a&&!o&&!l)return t;if(!t||!t.width||!t.height)return null;let u=Kx(),d=1;e.type===`svg`&&(d=Math.max(e.a.width/t.width*n,e.a.height/t.height*n)),U_(u,Math.max(t.width*d,1),Math.max(t.height*d,1));let f=a?-u.width:0,p=o?-u.height:0;return(r=u.getContext(`2d`))==null||r.scale(a?-1:1,o?-1:1),(i=u.getContext(`2d`))==null||i.drawImage(t,f,p,u.width,u.height),u},[e.maskSrc,e.flipX,e.flipY,t,e.a.width,e.a.height,n]);return _.useEffect(()=>()=>{r&&r.nodeName===`CANVAS`&&G.Util.releaseCanvas(r)},[r]),r})(e,u||m,p))||tS,{cropX:g,cropY:v,cropWidth:y,cropHeight:b}=e.a;d!==`loaded`&&(g=v=0,y=b=1);let x=h.width*y,S=h.height*b,C=e.a.width/e.a.height,w,T,E=x/S,D=e.stretchEnabled;D?(w=x,T=S):C>=E?(w=x,T=x/C):(w=S*C,T=S);let ee={x:h.width*g,y:h.height*v,width:w,height:T},O=e.cornerRadius??0,k=e.page._exportingOrRendering?1:Math.min(2,t.scale),A=t._elementsPixelRatio*k,te=((e,t,n,r)=>{let[i,a]=iS(Jx(e.clipSrc||``),`anonymous`);aS(e.clipSrc?a:`loaded`,e.clipSrc,e.id);let o=_.useMemo(()=>{if(t&&i)return Kx()},[t,i]);return _.useLayoutEffect(()=>{var r;if(!i||!t||!t.width||!t.height||!i||!i.width||!i.height||!o)return;let a=Kx(),s=Math.max(e.a.width/i.width*n,e.a.height/i.height*n);a.width=Math.max(i.width*s,1),a.height=Math.max(i.height*s,1),(r=a.getContext(`2d`))==null||r.drawImage(i,0,0,a.width,a.height),o.width=Math.max(t.width,1),o.height=Math.max(t.height,1);let c=o.getContext(`2d`);c&&(c.save(),c.drawImage(a,0,0,t.width,t.height),G.Util.releaseCanvas(a),c.globalCompositeOperation=`source-in`,c.drawImage(t,0,0,o.width,o.height),c.restore())},[o,t,i,e.a.width,e.a.height,n,...r]),e.clipSrc&&i?o:t})(e,eS(e,h,ee,A,O,r||e._cropModeEnabled||e.type===`svg`,!0),A,[ee,O,A]),ne=Math.max(e.a.width/w,e.a.height/T);_.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]),_.useLayoutEffect(()=>{if(!r&&!e._cropModeEnabled)return Cb(a.current,e),er(()=>{Cb(a.current,e)},{delay:100})},[te,e.page._exportingOrRendering,r,y,b,e._cropModeEnabled]),_.useLayoutEffect(()=>{var t;r||e._cropModeEnabled?(t=a.current)==null||t.clearCache():Cb(a.current,e)},[r,e.a.width,e.a.height,e._cropModeEnabled]),_.useEffect(()=>{Cb(a.current,e)},[e.shadowEnabled,e.shadowBlur,e.cornerRadius,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]);let j=_.useRef(null),M=_.useRef(null),re=_.useRef(null);_.useLayoutEffect(()=>{e._cropModeEnabled&&(M.current.nodes([j.current]),re.current.nodes([o.current]))},[e._cropModeEnabled]);var ie=_.useRef(null),ae=_.useRef(0),oe=_.useRef(!1);let N=t=>{t.evt.touches?.length>2&&t.target.stopDrag(),Math.round(t.target.x())>0&&(t.target.x(0),t.target.scaleX(1)),Math.round(t.target.y())>0&&(t.target.y(0),t.target.scaleY(1));let n=t.target.width()*t.target.scaleX(),r=t.target.height()*t.target.scaleY(),i=Math.min(1,w/n),a=Math.min(1,T/r),o=1-i,s=Math.min(o,Math.max(0,Math.round(-t.target.x())/n)),c=1-a,l=Math.min(c,Math.max(0,Math.round(-t.target.y())/r));t.target.setAttrs({x:-s*h.width,y:-l*h.height,scaleX:1,scaleY:1}),e.set({cropX:s,cropY:l,cropWidth:i,cropHeight:a})},se=()=>{e.type!==`svg`&&e.contentEditable&&(e.stretchEnabled||setTimeout(()=>{e.toggleCropMode(!0)}))},ce=e.type===`svg`&&m,[le]=Gx(d===`loading`&&!ce,100,!1,!1),ue=d===`failed`,de=!le&&!ue,fe=_.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),pe=de?e.a.opacity:0;e_(a,pe);let me=e.selectable||t.role===Hx.ADMIN,he=wb(),ge=ub(e,e.borderColor,`stroke`);return _.createElement(_.Fragment,null,le&&_.createElement(nS,{element:e}),ue&&_.createElement(rS,{element:e}),_.createElement(sf,{ref:a,name:`element`,id:e.id,image:te,x:e.a.x,y:e.a.y,width:e.a.width||1,height:e.a.height||1,rotation:e.a.rotation,opacity:pe,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:ee,listening:me,draggable:he?e.draggable&&s:e.draggable,preventDefault:!he||s,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:se,onDblTap:se,onTransformStart:()=>{i(!0),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=t.target.getStage()?.findOne(`Transformer`),o=1-w/h.width,s=Math.min(o,Math.max(0,e.cropX)),c=1-T/h.height,l=Math.min(c,Math.max(0,e.cropY)),u=a.getActiveAnchor(),d=!(u.indexOf(`middle`)>=0||u.indexOf(`center`)>=0),f=!d&&r<1&&fe.current.cropHeight>T/h.height,p=d?e.cropWidth:e.cropWidth*r;f&&(p=e.cropWidth);let m=!d&&i<1&&fe.current.cropWidth>w/h.width,g=d?e.cropHeight:e.cropHeight*i;m&&(g=e.cropHeight),D&&(p=e.cropWidth,g=e.cropHeight),e.set({cropX:s,cropY:l,x:n.x(),y:n.y(),width:n.width()*r,height:n.height()*i,rotation:t.target.rotation(),cropWidth:Math.min(p,1-s),cropHeight:Math.min(g,1-l)})},onTransformEnd:t=>{let n=t.currentTarget;e.set({width:n.width(),height:n.height(),x:n.x(),y:n.y(),rotation:t.target.rotation(),cropWidth:w/h.width,cropHeight:T/h.height}),i(!1)}}),_.createElement(af,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:pe,offsetX:-e.borderSize/2,offsetY:-e.borderSize/2},ge,{strokeWidth:e.borderSize,listening:!1,visible:!!e.borderSize,rotation:e.rotation,cornerRadius:Math.max(0,O-e.borderSize),hideInExport:!e.showInExport})),e._cropModeEnabled&&_.createElement(Hy,{selector:`.page-abs-container`,enabled:!0},_.createElement(`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}),_.createElement(`Image`,{listening:!1,image:te,x:e.x,y:e.y,width:e.a.width,height:e.a.height,rotation:e.rotation,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur}),_.createElement(`Group`,{x:e.x,y:e.y,rotation:e.rotation,scaleX:ne,scaleY:ne},_.createElement(`Image`,{image:h,ref:o,opacity:.4,draggable:!0,x:-e.cropX*h.width,y:-e.cropY*h.height,onDragMove:N,onTransform:N,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()&&oe.current&&(i.startDrag(),oe.current=!1),n&&r){G.hitOnDragEnabled=!0,i.isDragging()&&(oe.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(!ie.current){ie.current=Yx(a,o);return}var s=Yx(a,o),c=function(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}(a,o);ae.current||=c;let m=i.position();var l={x:s.x-m.x,y:s.y-m.y},u=c/ae.current;i.scaleX(u),i.scaleY(u);let h=t.point(s),g=t.point(ie.current);var d=h.x-g.x,f=h.y-g.y,p={x:Math.min(0,s.x-l.x*u+d),y:Math.min(0,s.y-l.y*u+f)};i.position(p),ae.current=c,ie.current=s,N(e)}},onTouchEnd:e=>{ae.current=0,ie.current=null,G.hitOnDragEnabled=!1}}),_.createElement(`Transformer`,Object.assign({ref:re},Qx,n.outerImageCropTransformerStyle)),_.createElement(`Rect`,{width:w,height:T,ref:j,listening:!1,onTransform:t=>{if(e.cropX<Math.abs(t.target.x()/h.width)&&t.target.x()<0&&e.cropX>0){let n=(e.cropWidth+e.cropX)*h.width;t.target.scaleX(1),t.target.width(n)}if(e.cropY<Math.abs(t.target.y()/h.height)&&t.target.y()<0&&e.cropY>0){let n=(e.cropHeight+e.cropY)*h.height;t.target.scaleY(1),t.target.height(n)}t.target.x()<-e.cropX*h.width-1e-9&&(t.target.x(-e.cropX*h.width),t.target.scaleX(1)),t.target.y()<-e.cropY*h.height-1e-9&&(t.target.y(-e.cropY*h.height),t.target.scaleY(1));let n=Math.min(1,Math.max(0,e.cropX+t.target.x()/h.width)),r=Math.min(1,Math.max(0,t.target.y()/h.height+e.cropY)),i=t.target.width()*t.target.scaleX(),a=t.target.height()*t.target.scaleY(),o=Math.min(1-n,i/h.width),s=Math.min(1-r,a/h.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*ne,h.width*(1-n)*ne),height:Math.min(a*ne,h.height*(1-r)*ne)})}}),_.createElement(`Transformer`,Object.assign({ref:M},Zx,n.innerImageCropTransformerStyle,{visible:e.resizable})))))}),sS=l(o(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.Quill=r():n.Quill=r()})(typeof self<`u`?self:e,function(){return(function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=109)})([(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=n(17),i=n(18),a=n(19),o=n(45),s=n(46),c=n(47),l=n(48),u=n(49),d=n(12),f=n(32),p=n(33),m=n(31),h=n(1);t.default={Scope:h.Scope,create:h.create,find:h.find,query:h.query,register:h.register,Container:r.default,Format:i.default,Leaf:a.default,Embed:l.default,Scroll:o.default,Block:c.default,Inline:s.default,Text:u.default,Attributor:{Attribute:d.default,Class:f.default,Style:p.default,Store:m.default}}}),(function(e,t,n){var r=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(t,`__esModule`,{value:!0});var i=function(e){r(t,e);function t(t){var n=this;return t=`[Parchment] `+t,n=e.call(this,t)||this,n.message=t,n.name=n.constructor.name,n}return t}(Error);t.ParchmentError=i;var a={},o={},s={},c={};t.DATA_KEY=`__blot`;var l;(function(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`})(l=t.Scope||={});function u(e,t){var n=f(e);if(n==null)throw new i(`Unable to create `+e+` blot`);var r=n;return new r(e instanceof Node||e.nodeType===Node.TEXT_NODE?e:r.create(t),t)}t.create=u;function d(e,n){return n===void 0&&(n=!1),e==null?null:e[t.DATA_KEY]==null?n?d(e.parentNode,n):null:e[t.DATA_KEY].blot}t.find=d;function f(e,t){t===void 0&&(t=l.ANY);var n;if(typeof e==`string`)n=c[e]||a[e];else if(e instanceof Text||e.nodeType===Node.TEXT_NODE)n=c.text;else if(typeof e==`number`)e&l.LEVEL&l.BLOCK?n=c.block:e&l.LEVEL&l.INLINE&&(n=c.inline);else if(e instanceof HTMLElement){var r=(e.getAttribute(`class`)||``).split(/\s+/);for(var i in r)if(n=o[r[i]],n)break;n||=s[e.tagName]}return n==null?null:t&l.LEVEL&n.scope&&t&l.TYPE&n.scope?n:null}t.query=f;function p(){var e=[...arguments];if(e.length>1)return e.map(function(e){return p(e)});var t=e[0];if(typeof t.blotName!=`string`&&typeof t.attrName!=`string`)throw new i(`Invalid definition`);if(t.blotName===`abstract`)throw new i(`Cannot register abstract class`);return c[t.blotName||t.attrName]=t,typeof t.keyName==`string`?a[t.keyName]=t:(t.className!=null&&(o[t.className]=t),t.tagName!=null&&(Array.isArray(t.tagName)?t.tagName=t.tagName.map(function(e){return e.toUpperCase()}):t.tagName=t.tagName.toUpperCase(),(Array.isArray(t.tagName)?t.tagName:[t.tagName]).forEach(function(e){(s[e]==null||t.className==null)&&(s[e]=t)}))),t}t.register=p}),(function(e,t,n){var r=n(51),i=n(11),a=n(3),o=n(20),s=`\0`,c=function(e){Array.isArray(e)?this.ops=e:e!=null&&Array.isArray(e.ops)?this.ops=e.ops:this.ops=[]};c.prototype.insert=function(e,t){var n={};return e.length===0?this:(n.insert=e,typeof t==`object`&&t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n))},c.prototype.delete=function(e){return e<=0?this:this.push({delete:e})},c.prototype.retain=function(e,t){if(e<=0)return this;var n={retain:e};return typeof t==`object`&&t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n)},c.prototype.push=function(e){var t=this.ops.length,n=this.ops[t-1];if(e=a(!0,{},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},c.prototype.chop=function(){var e=this.ops[this.ops.length-1];return e&&e.retain&&!e.attributes&&this.ops.pop(),this},c.prototype.filter=function(e){return this.ops.filter(e)},c.prototype.forEach=function(e){this.ops.forEach(e)},c.prototype.map=function(e){return this.ops.map(e)},c.prototype.partition=function(e){var t=[],n=[];return this.forEach(function(r){(e(r)?t:n).push(r)}),[t,n]},c.prototype.reduce=function(e,t){return this.ops.reduce(e,t)},c.prototype.changeLength=function(){return this.reduce(function(e,t){return t.insert?e+o.length(t):t.delete?e-t.delete:e},0)},c.prototype.length=function(){return this.reduce(function(e,t){return e+o.length(t)},0)},c.prototype.slice=function(e,t){e||=0,typeof t!=`number`&&(t=1/0);for(var n=[],r=o.iterator(this.ops),i=0;i<t&&r.hasNext();){var a;i<e?a=r.next(e-i):(a=r.next(t-i),n.push(a)),i+=o.length(a)}return new c(n)},c.prototype.compose=function(e){var t=o.iterator(this.ops),n=o.iterator(e.ops),r=[],a=n.peek();if(a!=null&&typeof a.retain==`number`&&a.attributes==null){for(var s=a.retain;t.peekType()===`insert`&&t.peekLength()<=s;)s-=t.peekLength(),r.push(t.next());a.retain-s>0&&n.next(a.retain-s)}for(var l=new c(r);t.hasNext()||n.hasNext();)if(n.peekType()===`insert`)l.push(n.next());else if(t.peekType()===`delete`)l.push(t.next());else{var u=Math.min(t.peekLength(),n.peekLength()),d=t.next(u),f=n.next(u);if(typeof f.retain==`number`){var p={};typeof d.retain==`number`?p.retain=u:p.insert=d.insert;var m=o.attributes.compose(d.attributes,f.attributes,typeof d.retain==`number`);if(m&&(p.attributes=m),l.push(p),!n.hasNext()&&i(l.ops[l.ops.length-1],p)){var h=new c(t.rest());return l.concat(h).chop()}}else typeof f.delete==`number`&&typeof d.retain==`number`&&l.push(f)}return l.chop()},c.prototype.concat=function(e){var t=new c(this.ops.slice());return e.ops.length>0&&(t.push(e.ops[0]),t.ops=t.ops.concat(e.ops.slice(1))),t},c.prototype.diff=function(e,t){if(this.ops===e.ops)return new c;var n=[this,e].map(function(t){return t.map(function(n){if(n.insert!=null)return typeof n.insert==`string`?n.insert:s;throw Error(`diff() called `+(t===e?`on`:`with`)+` non-document`)}).join(``)}),a=new c,l=r(n[0],n[1],t),u=o.iterator(this.ops),d=o.iterator(e.ops);return l.forEach(function(e){for(var t=e[1].length;t>0;){var n=0;switch(e[0]){case r.INSERT:n=Math.min(d.peekLength(),t),a.push(d.next(n));break;case r.DELETE:n=Math.min(t,u.peekLength()),u.next(n),a.delete(n);break;case r.EQUAL:n=Math.min(u.peekLength(),d.peekLength(),t);var s=u.next(n),c=d.next(n);i(s.insert,c.insert)?a.retain(n,o.attributes.diff(s.attributes,c.attributes)):a.push(c).delete(n);break}t-=n}}),a.chop()},c.prototype.eachLine=function(e,t){t||=`
|
|
224
|
-
`;for(var n=o.iterator(this.ops),r=new c,i=0;n.hasNext();){if(n.peekType()!==`insert`)return;var a=n.peek(),s=o.length(a)-n.peekLength(),l=typeof a.insert==`string`?a.insert.indexOf(t,s)-s:-1;if(l<0)r.push(n.next());else if(l>0)r.push(n.next(l));else{if(e(r,n.next(1).attributes||{},i)===!1)return;i+=1,r=new c}}r.length()>0&&e(r,{},i)},c.prototype.transform=function(e,t){if(t=!!t,typeof e==`number`)return this.transformPosition(e,t);for(var n=o.iterator(this.ops),r=o.iterator(e.ops),i=new c;n.hasNext()||r.hasNext();)if(n.peekType()===`insert`&&(t||r.peekType()!==`insert`))i.retain(o.length(n.next()));else if(r.peekType()===`insert`)i.push(r.next());else{var a=Math.min(n.peekLength(),r.peekLength()),s=n.next(a),l=r.next(a);if(s.delete)continue;l.delete?i.push(l):i.retain(a,o.attributes.transform(s.attributes,l.attributes,t))}return i.chop()},c.prototype.transformPosition=function(e,t){t=!!t;for(var n=o.iterator(this.ops),r=0;n.hasNext()&&r<=e;){var i=n.peekLength(),a=n.peekType();if(n.next(),a===`delete`){e-=Math.min(i,e-r);continue}else a===`insert`&&(r<e||!t)&&(e+=i);r+=i}return e},e.exports=c}),(function(e,t){var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};e.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.default=t.BlockEmbed=t.bubbleFormats=void 0;var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=d(n(3)),o=d(n(2)),s=d(n(0)),c=d(n(16)),l=d(n(6)),u=d(n(7));function d(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function p(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function m(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var h=1,g=function(e){m(t,e);function t(){return f(this,t),p(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return r(t,[{key:`attach`,value:function(){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`attach`,this).call(this),this.attributes=new s.default.Attributor.Store(this.domNode)}},{key:`delta`,value:function(){return new o.default().insert(this.value(),(0,a.default)(this.formats(),this.attributes.values()))}},{key:`format`,value:function(e,t){var n=s.default.query(e,s.default.Scope.BLOCK_ATTRIBUTE);n!=null&&this.attributes.attribute(n,t)}},{key:`formatAt`,value:function(e,t,n,r){this.format(n,r)}},{key:`insertAt`,value:function(e,n,r){if(typeof n==`string`&&n.endsWith(`
|
|
225
|
-
`)){var a=s.default.create(_.blotName);this.parent.insertBefore(a,e===0?this:this.next),a.insertAt(0,n.slice(0,-1))}else i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`insertAt`,this).call(this,e,n,r)}}]),t}(s.default.Embed);g.scope=s.default.Scope.BLOCK_BLOT;var _=function(e){m(t,e);function t(e){f(this,t);var n=p(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.cache={},n}return r(t,[{key:`delta`,value:function(){return this.cache.delta??(this.cache.delta=this.descendants(s.default.Leaf).reduce(function(e,t){return t.length()===0?e:e.insert(t.value(),v(t))},new o.default).insert(`
|
|
226
|
-
`,v(this))),this.cache.delta}},{key:`deleteAt`,value:function(e,n){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`deleteAt`,this).call(this,e,n),this.cache={}}},{key:`formatAt`,value:function(e,n,r,a){n<=0||(s.default.query(r,s.default.Scope.BLOCK)?e+n===this.length()&&this.format(r,a):i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`formatAt`,this).call(this,e,Math.min(n,this.length()-e-1),r,a),this.cache={})}},{key:`insertAt`,value:function(e,n,r){if(r!=null)return i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`insertAt`,this).call(this,e,n,r);if(n.length!==0){var a=n.split(`
|
|
227
|
-
`),o=a.shift();o.length>0&&(e<this.length()-1||this.children.tail==null?i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`insertAt`,this).call(this,Math.min(e,this.length()-1),o):this.children.tail.insertAt(this.children.tail.length(),o),this.cache={});var s=this;a.reduce(function(e,t){return s=s.split(e,!0),s.insertAt(0,t),t.length},e+o.length)}}},{key:`insertBefore`,value:function(e,n){var r=this.children.head;i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`insertBefore`,this).call(this,e,n),r instanceof c.default&&r.remove(),this.cache={}}},{key:`length`,value:function(){return this.cache.length??(this.cache.length=i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`length`,this).call(this)+h),this.cache.length}},{key:`moveChildren`,value:function(e,n){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`moveChildren`,this).call(this,e,n),this.cache={}}},{key:`optimize`,value:function(e){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`optimize`,this).call(this,e),this.cache={}}},{key:`path`,value:function(e){return i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`path`,this).call(this,e,!0)}},{key:`removeChild`,value:function(e){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`removeChild`,this).call(this,e),this.cache={}}},{key:`split`,value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(n&&(e===0||e>=this.length()-h)){var r=this.clone();return e===0?(this.parent.insertBefore(r,this),this):(this.parent.insertBefore(r,this.next),r)}else{var a=i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`split`,this).call(this,e,n);return this.cache={},a}}}]),t}(s.default.Block);_.blotName=`block`,_.tagName=`P`,_.defaultChild=`break`,_.allowedChildren=[l.default,s.default.Embed,u.default];function v(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e==null||(typeof e.formats==`function`&&(t=(0,a.default)(t,e.formats())),e.parent==null||e.parent.blotName==`scroll`||e.parent.statics.scope!==e.statics.scope)?t:v(e.parent,t)}t.bubbleFormats=v,t.BlockEmbed=g,t.default=_}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.default=t.overload=t.expandConfig=void 0;var r=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},i=function(){function e(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return&&o.return()}finally{if(i)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw TypeError(`Invalid attempt to destructure non-iterable instance`)}}(),a=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();n(50);var o=g(n(2)),s=g(n(14)),c=g(n(8)),l=g(n(9)),u=g(n(0)),d=n(15),f=g(d),p=g(n(3)),m=g(n(10)),h=g(n(34));function g(e){return e&&e.__esModule?e:{default:e}}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var y=(0,m.default)(`quill`),b=function(){a(e,null,[{key:`debug`,value:function(e){e===!0&&(e=`log`),m.default.level(e)}},{key:`find`,value:function(e){return e.__quill||u.default.find(e)}},{key:`import`,value:function(e){return this.imports[e]??y.error(`Cannot import `+e+`. Are you sure it was registered?`),this.imports[e]}},{key:`register`,value:function(e,t){var n=this,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(typeof e!=`string`){var i=e.attrName||e.blotName;typeof i==`string`?this.register(`formats/`+i,e,t):Object.keys(e).forEach(function(r){n.register(r,e[r],t)})}else this.imports[e]!=null&&!r&&y.warn(`Overwriting `+e+` with`,t),this.imports[e]=t,(e.startsWith(`blots/`)||e.startsWith(`formats/`))&&t.blotName!==`abstract`?u.default.register(t):e.startsWith(`modules`)&&typeof t.register==`function`&&t.register()}}]);function e(t){var n=this,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(v(this,e),this.options=x(t,r),this.container=this.options.container,this.container==null)return y.error(`Invalid Quill container`,t);this.options.debug&&e.debug(this.options.debug);var i=this.container.innerHTML.trim();this.container.classList.add(`ql-container`),this.container.innerHTML=``,this.container.__quill=this,this.root=this.addContainer(`ql-editor`),this.root.classList.add(`ql-blank`),this.root.setAttribute(`data-gramm`,!1),this.scrollingContainer=this.options.scrollingContainer||this.root,this.emitter=new c.default,this.scroll=u.default.create(this.root,{emitter:this.emitter,whitelist:this.options.formats}),this.editor=new s.default(this.scroll),this.selection=new f.default(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.theme.init(),this.emitter.on(c.default.events.EDITOR_CHANGE,function(e){e===c.default.events.TEXT_CHANGE&&n.root.classList.toggle(`ql-blank`,n.editor.isBlank())}),this.emitter.on(c.default.events.SCROLL_UPDATE,function(e,t){var r=n.selection.lastRange,i=r&&r.length===0?r.index:void 0;S.call(n,function(){return n.editor.update(null,t,i)},e)});var a=this.clipboard.convert(`<div class='ql-editor' style="white-space: normal;">`+i+`<p><br></p></div>`);this.setContents(a),this.history.clear(),this.options.placeholder&&this.root.setAttribute(`data-placeholder`,this.options.placeholder),this.options.readOnly&&this.disable()}return a(e,[{key:`addContainer`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(typeof e==`string`){var n=e;e=document.createElement(`div`),e.classList.add(n)}return this.container.insertBefore(e,t),e}},{key:`blur`,value:function(){this.selection.setRange(null)}},{key:`deleteText`,value:function(e,t,n){var r=this,a=i(C(e,t,n),4);return e=a[0],t=a[1],n=a[3],S.call(this,function(){return r.editor.deleteText(e,t)},n,e,-1*t)}},{key:`disable`,value:function(){this.enable(!1)}},{key:`enable`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.scroll.enable(e),this.container.classList.toggle(`ql-disabled`,!e)}},{key:`focus`,value:function(){var e=this.scrollingContainer.scrollTop;this.selection.focus(),this.scrollingContainer.scrollTop=e,this.scrollIntoView()}},{key:`format`,value:function(e,t){var n=this,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c.default.sources.API;return S.call(this,function(){var r=n.getSelection(!0),i=new o.default;if(r==null)return i;if(u.default.query(e,u.default.Scope.BLOCK))i=n.editor.formatLine(r.index,r.length,_({},e,t));else if(r.length===0)return n.selection.format(e,t),i;else i=n.editor.formatText(r.index,r.length,_({},e,t));return n.setSelection(r,c.default.sources.SILENT),i},r)}},{key:`formatLine`,value:function(e,t,n,r,a){var o=this,s=void 0,c=i(C(e,t,n,r,a),4);return e=c[0],t=c[1],s=c[2],a=c[3],S.call(this,function(){return o.editor.formatLine(e,t,s)},a,e,0)}},{key:`formatText`,value:function(e,t,n,r,a){var o=this,s=void 0,c=i(C(e,t,n,r,a),4);return e=c[0],t=c[1],s=c[2],a=c[3],S.call(this,function(){return o.editor.formatText(e,t,s)},a,e,0)}},{key:`getBounds`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=void 0;n=typeof e==`number`?this.selection.getBounds(e,t):this.selection.getBounds(e.index,e.length);var 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}}},{key:`getContents`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-e,n=i(C(e,t),2);return e=n[0],t=n[1],this.editor.getContents(e,t)}},{key:`getFormat`,value:function(){var 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)}},{key:`getIndex`,value:function(e){return e.offset(this.scroll)}},{key:`getLength`,value:function(){return this.scroll.length()}},{key:`getLeaf`,value:function(e){return this.scroll.leaf(e)}},{key:`getLine`,value:function(e){return this.scroll.line(e)}},{key:`getLines`,value:function(){var 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)}},{key:`getModule`,value:function(e){return this.theme.modules[e]}},{key:`getSelection`,value:function(){return arguments.length>0&&arguments[0]!==void 0&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}},{key:`getText`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-e,n=i(C(e,t),2);return e=n[0],t=n[1],this.editor.getText(e,t)}},{key:`hasFocus`,value:function(){return this.selection.hasFocus()}},{key:`insertEmbed`,value:function(t,n,r){var i=this,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:e.sources.API;return S.call(this,function(){return i.editor.insertEmbed(t,n,r)},a,t)}},{key:`insertText`,value:function(e,t,n,r,a){var o=this,s=void 0,c=i(C(e,0,n,r,a),4);return e=c[0],s=c[2],a=c[3],S.call(this,function(){return o.editor.insertText(e,t,s)},a,e,t.length)}},{key:`isEnabled`,value:function(){return!this.container.classList.contains(`ql-disabled`)}},{key:`off`,value:function(){return this.emitter.off.apply(this.emitter,arguments)}},{key:`on`,value:function(){return this.emitter.on.apply(this.emitter,arguments)}},{key:`once`,value:function(){return this.emitter.once.apply(this.emitter,arguments)}},{key:`pasteHTML`,value:function(e,t,n){this.clipboard.dangerouslyPasteHTML(e,t,n)}},{key:`removeFormat`,value:function(e,t,n){var r=this,a=i(C(e,t,n),4);return e=a[0],t=a[1],n=a[3],S.call(this,function(){return r.editor.removeFormat(e,t)},n,e)}},{key:`scrollIntoView`,value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:`setContents`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c.default.sources.API;return S.call(this,function(){e=new o.default(e);var n=t.getLength(),r=t.editor.deleteText(0,n),i=t.editor.applyDelta(e),a=i.ops[i.ops.length-1];return a!=null&&typeof a.insert==`string`&&a.insert[a.insert.length-1]===`
|
|
228
|
-
`&&(t.editor.deleteText(t.getLength()-1,1),i.delete(1)),r.compose(i)},n)}},{key:`setSelection`,value:function(t,n,r){if(t==null)this.selection.setRange(null,n||e.sources.API);else{var a=i(C(t,n,r),4);t=a[0],n=a[1],r=a[3],this.selection.setRange(new d.Range(t,n),r),r!==c.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:`setText`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c.default.sources.API,n=new o.default().insert(e);return this.setContents(n,t)}},{key:`update`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c.default.sources.USER,t=this.scroll.update(e);return this.selection.update(e),t}},{key:`updateContents`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c.default.sources.API;return S.call(this,function(){return e=new o.default(e),t.editor.applyDelta(e,n)},n,!0)}}]),e}();b.DEFAULTS={bounds:null,formats:null,modules:{},placeholder:``,readOnly:!1,scrollingContainer:null,strict:!0,theme:`default`},b.events=c.default.events,b.sources=c.default.sources,b.version=`1.3.7`,b.imports={delta:o.default,parchment:u.default,"core/module":l.default,"core/theme":h.default};function x(e,t){if(t=(0,p.default)(!0,{container:e,modules:{clipboard:!0,keyboard:!0,history:!0}},t),!t.theme||t.theme===b.DEFAULTS.theme)t.theme=h.default;else if(t.theme=b.import(`themes/`+t.theme),t.theme==null)throw Error(`Invalid theme `+t.theme+`. Did you register it?`);var n=(0,p.default)(!0,{},t.theme.DEFAULTS);[n,t].forEach(function(e){e.modules=e.modules||{},Object.keys(e.modules).forEach(function(t){e.modules[t]===!0&&(e.modules[t]={})})});var r=Object.keys(n.modules).concat(Object.keys(t.modules)).reduce(function(e,t){var n=b.import(`modules/`+t);return n==null?y.error(`Cannot load `+t+` module. Are you sure you registered it?`):e[t]=n.DEFAULTS||{},e},{});return t.modules!=null&&t.modules.toolbar&&t.modules.toolbar.constructor!==Object&&(t.modules.toolbar={container:t.modules.toolbar}),t=(0,p.default)(!0,{},b.DEFAULTS,{modules:r},n,t),[`bounds`,`container`,`scrollingContainer`].forEach(function(e){typeof t[e]==`string`&&(t[e]=document.querySelector(t[e]))}),t.modules=Object.keys(t.modules).reduce(function(e,n){return t.modules[n]&&(e[n]=t.modules[n]),e},{}),t}function S(e,t,n,r){if(this.options.strict&&!this.isEnabled()&&t===c.default.sources.USER)return new o.default;var i=n==null?null:this.getSelection(),a=this.editor.delta,s=e();if(i!=null&&(n===!0&&(n=i.index),r==null?i=w(i,s,t):r!==0&&(i=w(i,n,r,t)),this.setSelection(i,c.default.sources.SILENT)),s.length()>0){var l,u=[c.default.events.TEXT_CHANGE,s,a,t];if((l=this.emitter).emit.apply(l,[c.default.events.EDITOR_CHANGE].concat(u)),t!==c.default.sources.SILENT){var d;(d=this.emitter).emit.apply(d,u)}}return s}function C(e,t,n,i,a){var o={};return typeof e.index==`number`&&typeof e.length==`number`?typeof t==`number`?(t=e.length,e=e.index):(a=i,i=n,n=t,t=e.length,e=e.index):typeof t!=`number`&&(a=i,i=n,n=t,t=0),(n===void 0?`undefined`:r(n))===`object`?(o=n,a=i):typeof n==`string`&&(i==null?a=n:o[n]=i),a||=c.default.sources.API,[e,t,o,a]}function w(e,t,n,r){if(e==null)return null;var a=void 0,s=void 0;if(t instanceof o.default){var l=i([e.index,e.index+e.length].map(function(e){return t.transformPosition(e,r!==c.default.sources.USER)}),2);a=l[0],s=l[1]}else{var u=i([e.index,e.index+e.length].map(function(e){return e<t||e===t&&r===c.default.sources.USER?e:n>=0?e+n:Math.max(t,e+n)}),2);a=u[0],s=u[1]}return new d.Range(a,s-a)}t.expandConfig=x,t.overload=C,t.default=b}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=s(n(7)),o=s(n(0));function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function l(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function u(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var d=function(e){u(t,e);function t(){return c(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return r(t,[{key:`formatAt`,value:function(e,n,r,a){if(t.compare(this.statics.blotName,r)<0&&o.default.query(r,o.default.Scope.BLOT)){var s=this.isolate(e,n);a&&s.wrap(r,a)}else i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`formatAt`,this).call(this,e,n,r,a)}},{key:`optimize`,value:function(e){if(i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`optimize`,this).call(this,e),this.parent instanceof t&&t.compare(this.statics.blotName,this.parent.statics.blotName)>0){var n=this.parent.isolate(this.offset(),this.length());this.moveChildren(n),n.wrap(this)}}}],[{key:`compare`,value:function(e,n){var r=t.order.indexOf(e),i=t.order.indexOf(n);return r>=0||i>=0?r-i:e===n?0:e<n?-1:1}}]),t}(o.default.Inline);d.allowedChildren=[d,o.default.Embed,a.default],d.order=[`cursor`,`inline`,`underline`,`strike`,`italic`,`bold`,`script`,`link`,`code`],t.default=d}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=i(n(0));function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.default=function(e){s(t,e);function t(){return a(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return t}(r.default.Text)}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=s(n(54)),o=s(n(10));function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function l(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function u(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var d=(0,o.default)(`quill:events`);[`selectionchange`,`mousedown`,`mouseup`,`click`].forEach(function(e){document.addEventListener(e,function(){var e=[...arguments];[].slice.call(document.querySelectorAll(`.ql-container`)).forEach(function(t){if(t.__quill&&t.__quill.emitter){var n;(n=t.__quill.emitter).handleDOM.apply(n,e)}})})});var f=function(e){u(t,e);function t(){c(this,t);var e=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.listeners={},e.on(`error`,d.error),e}return r(t,[{key:`emit`,value:function(){d.log.apply(d,arguments),i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`emit`,this).apply(this,arguments)}},{key:`handleDOM`,value:function(e){var t=[...arguments].slice(1);(this.listeners[e.type]||[]).forEach(function(n){var r=n.node,i=n.handler;(e.target===r||r.contains(e.target))&&i.apply(void 0,[e].concat(t))})}},{key:`listenDOM`,value:function(e,t,n){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push({node:t,handler:n})}}]),t}(a.default);f.events={EDITOR_CHANGE:`editor-change`,SCROLL_BEFORE_UPDATE:`scroll-before-update`,SCROLL_OPTIMIZE:`scroll-optimize`,SCROLL_UPDATE:`scroll-update`,SELECTION_CHANGE:`selection-change`,TEXT_CHANGE:`text-change`},f.sources={API:`api`,SILENT:`silent`,USER:`user`},t.default=f}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});function r(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var i=function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};r(this,e),this.quill=t,this.options=n};i.DEFAULTS={},t.default=i}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=[`error`,`warn`,`log`,`info`],i=`warn`;function a(e){if(r.indexOf(e)<=r.indexOf(i)){var t,n=[...arguments].slice(1);(t=console)[e].apply(t,n)}}function o(e){return r.reduce(function(t,n){return t[n]=a.bind(console,n,e),t},{})}a.level=o.level=function(e){i=e},t.default=o}),(function(e,t,n){var r=Array.prototype.slice,i=n(52),a=n(53),o=e.exports=function(e,t,n){return n||={},e===t?!0:e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():!e||!t||typeof e!=`object`&&typeof t!=`object`?n.strict?e===t:e==t:l(e,t,n)};function s(e){return e==null}function c(e){return!(!e||typeof e!=`object`||typeof e.length!=`number`||typeof e.copy!=`function`||typeof e.slice!=`function`||e.length>0&&typeof e[0]!=`number`)}function l(e,t,n){var l,u;if(s(e)||s(t)||e.prototype!==t.prototype)return!1;if(a(e))return a(t)?(e=r.call(e),t=r.call(t),o(e,t,n)):!1;if(c(e)){if(!c(t)||e.length!==t.length)return!1;for(l=0;l<e.length;l++)if(e[l]!==t[l])return!1;return!0}try{var d=i(e),f=i(t)}catch{return!1}if(d.length!=f.length)return!1;for(d.sort(),f.sort(),l=d.length-1;l>=0;l--)if(d[l]!=f[l])return!1;for(l=d.length-1;l>=0;l--)if(u=d[l],!o(e[u],t[u],n))return!1;return typeof e==typeof t}}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=n(1);t.default=function(){function e(e,t,n){n===void 0&&(n={}),this.attrName=e,this.keyName=t;var i=r.Scope.TYPE&r.Scope.ATTRIBUTE;n.scope==null?this.scope=r.Scope.ATTRIBUTE:this.scope=n.scope&r.Scope.LEVEL|i,n.whitelist!=null&&(this.whitelist=n.whitelist)}return e.keys=function(e){return[].map.call(e.attributes,function(e){return e.name})},e.prototype.add=function(e,t){return this.canAdd(e,t)?(e.setAttribute(this.keyName,t),!0):!1},e.prototype.canAdd=function(e,t){return r.query(e,r.Scope.BLOT&(this.scope|r.Scope.TYPE))==null?!1:this.whitelist==null?!0:typeof t==`string`?this.whitelist.indexOf(t.replace(/["']/g,``))>-1:this.whitelist.indexOf(t)>-1},e.prototype.remove=function(e){e.removeAttribute(this.keyName)},e.prototype.value=function(e){var t=e.getAttribute(this.keyName);return this.canAdd(e,t)&&t?t:``},e}()}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.default=t.Code=void 0;var r=function(){function e(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return&&o.return()}finally{if(i)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw TypeError(`Invalid attempt to destructure non-iterable instance`)}}(),i=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},o=d(n(2)),s=d(n(0)),c=d(n(4)),l=d(n(6)),u=d(n(7));function d(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function p(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function m(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var h=function(e){m(t,e);function t(){return f(this,t),p(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return t}(l.default);h.blotName=`code`,h.tagName=`CODE`;var g=function(e){m(t,e);function t(){return f(this,t),p(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,[{key:`delta`,value:function(){var e=this,t=this.domNode.textContent;return t.endsWith(`
|
|
229
|
-
`)&&(t=t.slice(0,-1)),t.split(`
|
|
230
|
-
`).reduce(function(t,n){return t.insert(n).insert(`
|
|
231
|
-
`,e.formats())},new o.default)}},{key:`format`,value:function(e,n){if(!(e===this.statics.blotName&&n)){var i=r(this.descendant(u.default,this.length()-1),1)[0];i?.deleteAt(i.length()-1,1),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`format`,this).call(this,e,n)}}},{key:`formatAt`,value:function(e,n,r,i){if(n!==0&&!(s.default.query(r,s.default.Scope.BLOCK)==null||r===this.statics.blotName&&i===this.statics.formats(this.domNode))){var a=this.newlineIndex(e);if(!(a<0||a>=e+n)){var o=this.newlineIndex(e,!0)+1,c=a-o+1,l=this.isolate(o,c),u=l.next;l.format(r,i),u instanceof t&&u.formatAt(0,e-o+n-c,r,i)}}}},{key:`insertAt`,value:function(e,t,n){if(n==null){var i=r(this.descendant(u.default,e),2),a=i[0],o=i[1];a.insertAt(o,t)}}},{key:`length`,value:function(){var e=this.domNode.textContent.length;return this.domNode.textContent.endsWith(`
|
|
232
|
-
`)?e:e+1}},{key:`newlineIndex`,value:function(e){if(arguments.length>1&&arguments[1]!==void 0&&arguments[1])return this.domNode.textContent.slice(0,e).lastIndexOf(`
|
|
233
|
-
`);var t=this.domNode.textContent.slice(e).indexOf(`
|
|
234
|
-
`);return t>-1?e+t:-1}},{key:`optimize`,value:function(e){this.domNode.textContent.endsWith(`
|
|
235
|
-
`)||this.appendChild(s.default.create(`text`,`
|
|
236
|
-
`)),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`optimize`,this).call(this,e);var n=this.next;n!=null&&n.prev===this&&n.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===n.statics.formats(n.domNode)&&(n.optimize(e),n.moveChildren(this),n.remove())}},{key:`replace`,value:function(e){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`replace`,this).call(this,e),[].slice.call(this.domNode.querySelectorAll(`*`)).forEach(function(e){var t=s.default.find(e);t==null?e.parentNode.removeChild(e):t instanceof s.default.Embed?t.remove():t.unwrap()})}}],[{key:`create`,value:function(e){var n=a(t.__proto__||Object.getPrototypeOf(t),`create`,this).call(this,e);return n.setAttribute(`spellcheck`,!1),n}},{key:`formats`,value:function(){return!0}}]),t}(c.default);g.blotName=`code-block`,g.tagName=`PRE`,g.TAB=` `,t.Code=h,t.default=g}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=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},i=function(){function e(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return&&o.return()}finally{if(i)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw TypeError(`Invalid attempt to destructure non-iterable instance`)}}(),a=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=_(n(2)),s=_(n(20)),c=_(n(0)),l=_(n(13)),u=_(n(24)),d=n(4),f=_(d),p=_(n(16)),m=_(n(21)),h=_(n(11)),g=_(n(3));function _(e){return e&&e.__esModule?e:{default:e}}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var b=/^[ -~]*$/,x=function(){function e(t){y(this,e),this.scroll=t,this.delta=this.getDelta()}return a(e,[{key:`applyDelta`,value:function(e){var t=this,n=!1;this.scroll.update();var a=this.scroll.length();return this.scroll.batchStart(),e=C(e),e.reduce(function(e,o){var l=o.retain||o.delete||o.insert.length||1,u=o.attributes||{};if(o.insert!=null){if(typeof o.insert==`string`){var p=o.insert;p.endsWith(`
|
|
237
|
-
`)&&n&&(n=!1,p=p.slice(0,-1)),e>=a&&!p.endsWith(`
|
|
238
|
-
`)&&(n=!0),t.scroll.insertAt(e,p);var m=i(t.scroll.line(e),2),h=m[0],_=m[1],v=(0,g.default)({},(0,d.bubbleFormats)(h));if(h instanceof f.default){var y=i(h.descendant(c.default.Leaf,_),1)[0];v=(0,g.default)(v,(0,d.bubbleFormats)(y))}u=s.default.attributes.diff(v,u)||{}}else if(r(o.insert)===`object`){var b=Object.keys(o.insert)[0];if(b==null)return e;t.scroll.insertAt(e,b,o.insert[b])}a+=l}return Object.keys(u).forEach(function(n){t.scroll.formatAt(e,l,n,u[n])}),e+l},0),e.reduce(function(e,n){return typeof n.delete==`number`?(t.scroll.deleteAt(e,n.delete),e):e+(n.retain||n.insert.length||1)},0),this.scroll.batchEnd(),this.update(e)}},{key:`deleteText`,value:function(e,t){return this.scroll.deleteAt(e,t),this.update(new o.default().retain(e).delete(t))}},{key:`formatLine`,value:function(e,t){var n=this,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.scroll.update(),Object.keys(r).forEach(function(i){if(!(n.scroll.whitelist!=null&&!n.scroll.whitelist[i])){var a=n.scroll.lines(e,Math.max(t,1)),o=t;a.forEach(function(t){var a=t.length();if(!(t instanceof l.default))t.format(i,r[i]);else{var s=e-t.offset(n.scroll),c=t.newlineIndex(s+o)-s+1;t.formatAt(s,c,i,r[i])}o-=a})}}),this.scroll.optimize(),this.update(new o.default().retain(e).retain(t,(0,m.default)(r)))}},{key:`formatText`,value:function(e,t){var n=this,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Object.keys(r).forEach(function(i){n.scroll.formatAt(e,t,i,r[i])}),this.update(new o.default().retain(e).retain(t,(0,m.default)(r)))}},{key:`getContents`,value:function(e,t){return this.delta.slice(e,e+t)}},{key:`getDelta`,value:function(){return this.scroll.lines().reduce(function(e,t){return e.concat(t.delta())},new o.default)}},{key:`getFormat`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=[],r=[];t===0?this.scroll.path(e).forEach(function(e){var t=i(e,1)[0];t instanceof f.default?n.push(t):t instanceof c.default.Leaf&&r.push(t)}):(n=this.scroll.lines(e,t),r=this.scroll.descendants(c.default.Leaf,e,t));var a=[n,r].map(function(e){if(e.length===0)return{};for(var t=(0,d.bubbleFormats)(e.shift());Object.keys(t).length>0;){var n=e.shift();if(n==null)return t;t=S((0,d.bubbleFormats)(n),t)}return t});return g.default.apply(g.default,a)}},{key:`getText`,value:function(e,t){return this.getContents(e,t).filter(function(e){return typeof e.insert==`string`}).map(function(e){return e.insert}).join(``)}},{key:`insertEmbed`,value:function(e,t,n){return this.scroll.insertAt(e,t,n),this.update(new o.default().retain(e).insert(v({},t,n)))}},{key:`insertText`,value:function(e,t){var n=this,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return t=t.replace(/\r\n/g,`
|
|
239
|
-
`).replace(/\r/g,`
|
|
240
|
-
`),this.scroll.insertAt(e,t),Object.keys(r).forEach(function(i){n.scroll.formatAt(e,t.length,i,r[i])}),this.update(new o.default().retain(e).insert(t,(0,m.default)(r)))}},{key:`isBlank`,value:function(){if(this.scroll.children.length==0)return!0;if(this.scroll.children.length>1)return!1;var e=this.scroll.children.head;return e.statics.blotName!==f.default.blotName||e.children.length>1?!1:e.children.head instanceof p.default}},{key:`removeFormat`,value:function(e,t){var n=this.getText(e,t),r=i(this.scroll.line(e+t),2),a=r[0],s=r[1],c=0,u=new o.default;a!=null&&(c=a instanceof l.default?a.newlineIndex(s)-s+1:a.length()-s,u=a.delta().slice(s,s+c-1).insert(`
|
|
241
|
-
`));var d=this.getContents(e,t+c).diff(new o.default().insert(n).concat(u)),f=new o.default().retain(e).concat(d);return this.applyDelta(f)}},{key:`update`,value:function(e){var 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(b)&&c.default.find(t[0].target)){var i=c.default.find(t[0].target),a=(0,d.bubbleFormats)(i),s=i.offset(this.scroll),l=t[0].oldValue.replace(u.default.CONTENTS,``),f=new o.default().insert(l),p=new o.default().insert(i.value());e=new o.default().retain(s).concat(f.diff(p,n)).reduce(function(e,t){return t.insert?e.insert(t.insert,a):e.push(t)},new o.default),this.delta=r.compose(e)}else this.delta=this.getDelta(),(!e||!(0,h.default)(r.compose(e),this.delta))&&(e=r.diff(this.delta,n));return e}}]),e}();function S(e,t){return Object.keys(t).reduce(function(n,r){return e[r]==null||(t[r]===e[r]?n[r]=t[r]:Array.isArray(t[r])?t[r].indexOf(e[r])<0&&(n[r]=t[r].concat([e[r]])):n[r]=[t[r],e[r]]),n},{})}function C(e){return e.reduce(function(e,t){if(t.insert===1){var n=(0,m.default)(t.attributes);return delete n.image,e.insert({image:t.attributes.image},n)}if(t.attributes!=null&&(t.attributes.list===!0||t.attributes.bullet===!0)&&(t=(0,m.default)(t),t.attributes.list?t.attributes.list=`ordered`:(t.attributes.list=`bullet`,delete t.attributes.bullet)),typeof t.insert==`string`){var r=t.insert.replace(/\r\n/g,`
|
|
242
|
-
`).replace(/\r/g,`
|
|
243
|
-
`);return e.insert(r,t.attributes)}return e.push(t)},new o.default)}t.default=x}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.default=t.Range=void 0;var r=function(){function e(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return&&o.return()}finally{if(i)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw TypeError(`Invalid attempt to destructure non-iterable instance`)}}(),i=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=u(n(0)),o=u(n(21)),s=u(n(11)),c=u(n(8)),l=u(n(10));function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}else return Array.from(e)}function f(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var p=(0,l.default)(`quill:selection`),m=function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;f(this,e),this.index=t,this.length=n},h=function(){function e(t,n){var r=this;f(this,e),this.emitter=n,this.scroll=t,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=a.default.create(`cursor`,this),this.lastRange=this.savedRange=new m(0,0),this.handleComposition(),this.handleDragging(),this.emitter.listenDOM(`selectionchange`,document,function(){r.mouseDown||setTimeout(r.update.bind(r,c.default.sources.USER),1)}),this.emitter.on(c.default.events.EDITOR_CHANGE,function(e,t){e===c.default.events.TEXT_CHANGE&&t.length()>0&&r.update(c.default.sources.SILENT)}),this.emitter.on(c.default.events.SCROLL_BEFORE_UPDATE,function(){if(r.hasFocus()){var e=r.getNativeRange();e!=null&&e.start.node!==r.cursor.textNode&&r.emitter.once(c.default.events.SCROLL_UPDATE,function(){try{r.setNativeRange(e.start.node,e.start.offset,e.end.node,e.end.offset)}catch{}})}}),this.emitter.on(c.default.events.SCROLL_OPTIMIZE,function(e,t){if(t.range){var n=t.range,i=n.startNode,a=n.startOffset,o=n.endNode,s=n.endOffset;r.setNativeRange(i,a,o,s)}}),this.update(c.default.sources.SILENT)}return i(e,[{key:`handleComposition`,value:function(){var e=this;this.root.addEventListener(`compositionstart`,function(){e.composing=!0}),this.root.addEventListener(`compositionend`,function(){if(e.composing=!1,e.cursor.parent){var t=e.cursor.restore();if(!t)return;setTimeout(function(){e.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)},1)}})}},{key:`handleDragging`,value:function(){var e=this;this.emitter.listenDOM(`mousedown`,document.body,function(){e.mouseDown=!0}),this.emitter.listenDOM(`mouseup`,document.body,function(){e.mouseDown=!1,e.update(c.default.sources.USER)})}},{key:`focus`,value:function(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}},{key:`format`,value:function(e,t){if(!(this.scroll.whitelist!=null&&!this.scroll.whitelist[e])){this.scroll.update();var n=this.getNativeRange();if(!(n==null||!n.native.collapsed||a.default.query(e,a.default.Scope.BLOCK))){if(n.start.node!==this.cursor.textNode){var r=a.default.find(n.start.node,!1);if(r==null)return;if(r instanceof a.default.Leaf){var i=r.split(n.start.offset);r.parent.insertBefore(this.cursor,i)}else r.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()}}}},{key:`getBounds`,value:function(e){var 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;var i=void 0,a=r(this.scroll.leaf(e),2),o=a[0],s=a[1];if(o==null)return null;var c=r(o.position(s,!0),2);i=c[0],s=c[1];var l=document.createRange();if(t>0){l.setStart(i,s);var u=r(this.scroll.leaf(e+t),2);if(o=u[0],s=u[1],o==null)return null;var d=r(o.position(s,!0),2);return i=d[0],s=d[1],l.setEnd(i,s),l.getBoundingClientRect()}else{var f=`left`,p=void 0;return i instanceof Text?(s<i.data.length?(l.setStart(i,s),l.setEnd(i,s+1)):(l.setStart(i,s-1),l.setEnd(i,s),f=`right`),p=l.getBoundingClientRect()):(p=o.domNode.getBoundingClientRect(),s>0&&(f=`right`)),{bottom:p.top+p.height,height:p.height,left:p[f],right:p[f],top:p.top,width:0}}}},{key:`getNativeRange`,value:function(){var e=document.getSelection();if(e==null||e.rangeCount<=0)return null;var t=e.getRangeAt(0);if(t==null)return null;var n=this.normalizeNative(t);return p.info(`getNativeRange`,n),n}},{key:`getRange`,value:function(){var e=this.getNativeRange();return e==null?[null,null]:[this.normalizedToRange(e),e]}},{key:`hasFocus`,value:function(){return document.activeElement===this.root}},{key:`normalizedToRange`,value:function(e){var t=this,n=[[e.start.node,e.start.offset]];e.native.collapsed||n.push([e.end.node,e.end.offset]);var i=n.map(function(e){var n=r(e,2),i=n[0],o=n[1],s=a.default.find(i,!0),c=s.offset(t.scroll);return o===0?c:s instanceof a.default.Container?c+s.length():c+s.index(i,o)}),o=Math.min(Math.max.apply(Math,d(i)),this.scroll.length()-1),s=Math.min.apply(Math,[o].concat(d(i)));return new m(s,o-s)}},{key:`normalizeNative`,value:function(e){if(!g(this.root,e.startContainer)||!e.collapsed&&!g(this.root,e.endContainer))return null;var t={start:{node:e.startContainer,offset:e.startOffset},end:{node:e.endContainer,offset:e.endOffset},native:e};return[t.start,t.end].forEach(function(e){for(var t=e.node,n=e.offset;!(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+1;else break;e.node=t,e.offset=n}),t}},{key:`rangeToNative`,value:function(e){var t=this,n=e.collapsed?[e.index]:[e.index,e.index+e.length],i=[],a=this.scroll.length();return n.forEach(function(e,n){e=Math.min(a-1,e);var o=void 0,s=r(t.scroll.leaf(e),2),c=s[0],l=s[1],u=r(c.position(l,n!==0),2);o=u[0],l=u[1],i.push(o,l)}),i.length<2&&(i=i.concat(i)),i}},{key:`scrollIntoView`,value:function(e){var t=this.lastRange;if(t!=null){var n=this.getBounds(t.index,t.length);if(n!=null){var i=this.scroll.length()-1,a=r(this.scroll.line(Math.min(t.index,i)),1)[0],o=a;if(t.length>0&&(o=r(this.scroll.line(Math.min(t.index+t.length,i)),1)[0]),!(a==null||o==null)){var s=e.getBoundingClientRect();n.top<s.top?e.scrollTop-=s.top-n.top:n.bottom>s.bottom&&(e.scrollTop+=n.bottom-s.bottom)}}}}},{key:`setNativeRange`,value:function(e,t){var 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]:!1;if(p.info(`setNativeRange`,e,t,n,r),!(e!=null&&(this.root.parentNode==null||e.parentNode==null||n.parentNode==null))){var a=document.getSelection();if(a!=null)if(e!=null){this.hasFocus()||this.root.focus();var o=(this.getNativeRange()||{}).native;if(o==null||i||e!==o.startContainer||t!==o.startOffset||n!==o.endContainer||r!==o.endOffset){e.tagName==`BR`&&(t=[].indexOf.call(e.parentNode.childNodes,e),e=e.parentNode),n.tagName==`BR`&&(r=[].indexOf.call(n.parentNode.childNodes,n),n=n.parentNode);var s=document.createRange();s.setStart(e,t),s.setEnd(n,r),a.removeAllRanges(),a.addRange(s)}}else a.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:`setRange`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c.default.sources.API;if(typeof t==`string`&&(n=t,t=!1),p.info(`setRange`,e),e!=null){var r=this.rangeToNative(e);this.setNativeRange.apply(this,d(r).concat([t]))}else this.setNativeRange(null);this.update(n)}},{key:`update`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c.default.sources.USER,t=this.lastRange,n=r(this.getRange(),2),i=n[0],a=n[1];if(this.lastRange=i,this.lastRange!=null&&(this.savedRange=this.lastRange),!(0,s.default)(t,this.lastRange)){var l;!this.composing&&a!=null&&a.native.collapsed&&a.start.node!==this.cursor.textNode&&this.cursor.restore();var u=[c.default.events.SELECTION_CHANGE,(0,o.default)(this.lastRange),(0,o.default)(t),e];if((l=this.emitter).emit.apply(l,[c.default.events.EDITOR_CHANGE].concat(u)),e!==c.default.sources.SILENT){var d;(d=this.emitter).emit.apply(d,u)}}}}]),e}();function g(e,t){try{t.parentNode}catch{return!1}return t instanceof Text&&(t=t.parentNode),e.contains(t)}t.Range=m,t.default=h}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=o(n(0));function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function c(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function l(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(e){l(t,e);function t(){return s(this,t),c(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return r(t,[{key:`insertInto`,value:function(e,n){e.children.length===0?i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`insertInto`,this).call(this,e,n):this.remove()}},{key:`length`,value:function(){return 0}},{key:`value`,value:function(){return``}}],[{key:`value`,value:function(){}}]),t}(a.default.Embed);u.blotName=`break`,u.tagName=`BR`,t.default=u}),(function(e,t,n){var r=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(t,`__esModule`,{value:!0});var i=n(44),a=n(30),o=n(1),s=function(e){r(t,e);function t(t){var n=e.call(this,t)||this;return n.build(),n}return t.prototype.appendChild=function(e){this.insertBefore(e)},t.prototype.attach=function(){e.prototype.attach.call(this),this.children.forEach(function(e){e.attach()})},t.prototype.build=function(){var e=this;this.children=new i.default,[].slice.call(this.domNode.childNodes).reverse().forEach(function(t){try{var n=c(t);e.insertBefore(n,e.children.head||void 0)}catch(e){if(e instanceof o.ParchmentError)return;throw e}})},t.prototype.deleteAt=function(e,t){if(e===0&&t===this.length())return this.remove();this.children.forEachAt(e,t,function(e,t,n){e.deleteAt(t,n)})},t.prototype.descendant=function(e,n){var r=this.children.find(n),i=r[0],a=r[1];return e.blotName==null&&e(i)||e.blotName!=null&&i instanceof e?[i,a]:i instanceof t?i.descendant(e,a):[null,-1]},t.prototype.descendants=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=Number.MAX_VALUE);var i=[],a=r;return this.children.forEachAt(n,r,function(n,r,o){(e.blotName==null&&e(n)||e.blotName!=null&&n instanceof e)&&i.push(n),n instanceof t&&(i=i.concat(n.descendants(e,r,a))),a-=o}),i},t.prototype.detach=function(){this.children.forEach(function(e){e.detach()}),e.prototype.detach.call(this)},t.prototype.formatAt=function(e,t,n,r){this.children.forEachAt(e,t,function(e,t,i){e.formatAt(t,i,n,r)})},t.prototype.insertAt=function(e,t,n){var r=this.children.find(e),i=r[0],a=r[1];if(i)i.insertAt(a,t,n);else{var s=n==null?o.create(`text`,t):o.create(t,n);this.appendChild(s)}},t.prototype.insertBefore=function(e,t){if(this.statics.allowedChildren!=null&&!this.statics.allowedChildren.some(function(t){return e instanceof t}))throw new o.ParchmentError(`Cannot insert `+e.statics.blotName+` into `+this.statics.blotName);e.insertInto(this,t)},t.prototype.length=function(){return this.children.reduce(function(e,t){return e+t.length()},0)},t.prototype.moveChildren=function(e,t){this.children.forEach(function(n){e.insertBefore(n,t)})},t.prototype.optimize=function(t){if(e.prototype.optimize.call(this,t),this.children.length===0)if(this.statics.defaultChild!=null){var n=o.create(this.statics.defaultChild);this.appendChild(n),n.optimize(t)}else this.remove()},t.prototype.path=function(e,n){n===void 0&&(n=!1);var r=this.children.find(e,n),i=r[0],a=r[1],o=[[this,e]];return i instanceof t?o.concat(i.path(a,n)):(i!=null&&o.push([i,a]),o)},t.prototype.removeChild=function(e){this.children.remove(e)},t.prototype.replace=function(n){n instanceof t&&n.moveChildren(this),e.prototype.replace.call(this,n)},t.prototype.split=function(e,t){if(t===void 0&&(t=!1),!t){if(e===0)return this;if(e===this.length())return this.next}var n=this.clone();return this.parent.insertBefore(n,this.next),this.children.forEachAt(e,this.length(),function(e,r,i){e=e.split(r,t),n.appendChild(e)}),n},t.prototype.unwrap=function(){this.moveChildren(this.parent,this.next),this.remove()},t.prototype.update=function(e,t){var n=this,r=[],i=[];e.forEach(function(e){e.target===n.domNode&&e.type===`childList`&&(r.push.apply(r,e.addedNodes),i.push.apply(i,e.removedNodes))}),i.forEach(function(e){if(!(e.parentNode!=null&&e.tagName!==`IFRAME`&&document.body.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)){var t=o.find(e);t!=null&&(t.domNode.parentNode==null||t.domNode.parentNode===n.domNode)&&t.detach()}}),r.filter(function(e){return e.parentNode==n.domNode}).sort(function(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1}).forEach(function(e){var t=null;e.nextSibling!=null&&(t=o.find(e.nextSibling));var r=c(e);(r.next!=t||r.next==null)&&(r.parent!=null&&r.parent.removeChild(n),n.insertBefore(r,t||void 0))})},t}(a.default);function c(e){var t=o.find(e);if(t==null)try{t=o.create(e)}catch{t=o.create(o.Scope.INLINE),[].slice.call(e.childNodes).forEach(function(e){t.domNode.appendChild(e)}),e.parentNode&&e.parentNode.replaceChild(t.domNode,e),t.attach()}return t}t.default=s}),(function(e,t,n){var r=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(t,`__esModule`,{value:!0});var i=n(12),a=n(31),o=n(17),s=n(1);t.default=function(e){r(t,e);function t(t){var n=e.call(this,t)||this;return n.attributes=new a.default(n.domNode),n}return t.formats=function(e){if(typeof this.tagName==`string`)return!0;if(Array.isArray(this.tagName))return e.tagName.toLowerCase()},t.prototype.format=function(e,t){var n=s.query(e);n instanceof i.default?this.attributes.attribute(n,t):t&&n!=null&&(e!==this.statics.blotName||this.formats()[e]!==t)&&this.replaceWith(e,t)},t.prototype.formats=function(){var e=this.attributes.values(),t=this.statics.formats(this.domNode);return t!=null&&(e[this.statics.blotName]=t),e},t.prototype.replaceWith=function(t,n){var r=e.prototype.replaceWith.call(this,t,n);return this.attributes.copy(r),r},t.prototype.update=function(t,n){var r=this;e.prototype.update.call(this,t,n),t.some(function(e){return e.target===r.domNode&&e.type===`attributes`})&&this.attributes.build()},t.prototype.wrap=function(n,r){var i=e.prototype.wrap.call(this,n,r);return i instanceof t&&i.statics.scope===this.statics.scope&&this.attributes.move(i),i},t}(o.default)}),(function(e,t,n){var r=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(t,`__esModule`,{value:!0});var i=n(30),a=n(1);t.default=function(e){r(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.value=function(e){return!0},t.prototype.index=function(e,t){return this.domNode===e||this.domNode.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(t,1):-1},t.prototype.position=function(e,t){var n=[].indexOf.call(this.parent.domNode.childNodes,this.domNode);return e>0&&(n+=1),[this.parent.domNode,n]},t.prototype.value=function(){var e;return e={},e[this.statics.blotName]=this.statics.value(this.domNode)||!0,e},t.scope=a.Scope.INLINE_BLOT,t}(i.default)}),(function(e,t,n){var r=n(11),i=n(3),a={attributes:{compose:function(e,t,n){typeof e!=`object`&&(e={}),typeof t!=`object`&&(t={});var r=i(!0,{},t);for(var a in n||(r=Object.keys(r).reduce(function(e,t){return r[t]!=null&&(e[t]=r[t]),e},{})),e)e[a]!==void 0&&t[a]===void 0&&(r[a]=e[a]);return Object.keys(r).length>0?r:void 0},diff:function(e,t){typeof e!=`object`&&(e={}),typeof t!=`object`&&(t={});var n=Object.keys(e).concat(Object.keys(t)).reduce(function(n,i){return r(e[i],t[i])||(n[i]=t[i]===void 0?null:t[i]),n},{});return Object.keys(n).length>0?n:void 0},transform:function(e,t,n){if(typeof e!=`object`)return t;if(typeof t==`object`){if(!n)return t;var r=Object.keys(t).reduce(function(n,r){return e[r]===void 0&&(n[r]=t[r]),n},{});return Object.keys(r).length>0?r:void 0}}},iterator:function(e){return new o(e)},length:function(e){return typeof e.delete==`number`?e.delete:typeof e.retain==`number`?e.retain:typeof e.insert==`string`?e.insert.length:1}};function o(e){this.ops=e,this.index=0,this.offset=0}o.prototype.hasNext=function(){return this.peekLength()<1/0},o.prototype.next=function(e){e||=1/0;var t=this.ops[this.index];if(t){var n=this.offset,r=a.length(t);if(e>=r-n?(e=r-n,this.index+=1,this.offset=0):this.offset+=e,typeof t.delete==`number`)return{delete:e};var i={};return t.attributes&&(i.attributes=t.attributes),typeof t.retain==`number`?i.retain=e:typeof t.insert==`string`?i.insert=t.insert.substr(n,e):i.insert=t.insert,i}else return{retain:1/0}},o.prototype.peek=function(){return this.ops[this.index]},o.prototype.peekLength=function(){return this.ops[this.index]?a.length(this.ops[this.index])-this.offset:1/0},o.prototype.peekType=function(){return this.ops[this.index]?typeof this.ops[this.index].delete==`number`?`delete`:typeof this.ops[this.index].retain==`number`?`retain`:`insert`:`retain`},o.prototype.rest=function(){if(!this.hasNext())return[];if(this.offset===0)return this.ops.slice(this.index);var 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)},e.exports=a}),(function(e,t){var n=(function(){function e(e,t){return t!=null&&e instanceof t}var t;try{t=Map}catch{t=function(){}}var n;try{n=Set}catch{n=function(){}}var r;try{r=Promise}catch{r=function(){}}function i(a,o,s,c,u){typeof o==`object`&&(s=o.depth,c=o.prototype,u=o.includeNonEnumerable,o=o.circular);var d=[],f=[],p=typeof Buffer<`u`;o===void 0&&(o=!0),s===void 0&&(s=1/0);function m(a,s){if(a===null)return null;if(s===0)return a;var h,g;if(typeof a!=`object`)return a;if(e(a,t))h=new t;else if(e(a,n))h=new n;else if(e(a,r))h=new r(function(e,t){a.then(function(t){e(m(t,s-1))},function(e){t(m(e,s-1))})});else if(i.__isArray(a))h=[];else if(i.__isRegExp(a))h=new RegExp(a.source,l(a)),a.lastIndex&&(h.lastIndex=a.lastIndex);else if(i.__isDate(a))h=new Date(a.getTime());else if(p&&Buffer.isBuffer(a))return h=Buffer.allocUnsafe?Buffer.allocUnsafe(a.length):new Buffer(a.length),a.copy(h),h;else e(a,Error)?h=Object.create(a):c===void 0?(g=Object.getPrototypeOf(a),h=Object.create(g)):(h=Object.create(c),g=c);if(o){var _=d.indexOf(a);if(_!=-1)return f[_];d.push(a),f.push(h)}for(var v in e(a,t)&&a.forEach(function(e,t){var n=m(t,s-1),r=m(e,s-1);h.set(n,r)}),e(a,n)&&a.forEach(function(e){var t=m(e,s-1);h.add(t)}),a){var y;g&&(y=Object.getOwnPropertyDescriptor(g,v)),!(y&&y.set==null)&&(h[v]=m(a[v],s-1))}if(Object.getOwnPropertySymbols)for(var b=Object.getOwnPropertySymbols(a),v=0;v<b.length;v++){var x=b[v],S=Object.getOwnPropertyDescriptor(a,x);S&&!S.enumerable&&!u||(h[x]=m(a[x],s-1),S.enumerable||Object.defineProperty(h,x,{enumerable:!1}))}if(u)for(var C=Object.getOwnPropertyNames(a),v=0;v<C.length;v++){var w=C[v],S=Object.getOwnPropertyDescriptor(a,w);S&&S.enumerable||(h[w]=m(a[w],s-1),Object.defineProperty(h,w,{enumerable:!1}))}return h}return m(a,s)}i.clonePrototype=function(e){if(e===null)return null;var t=function(){};return t.prototype=e,new t};function a(e){return Object.prototype.toString.call(e)}i.__objToStr=a;function o(e){return typeof e==`object`&&a(e)===`[object Date]`}i.__isDate=o;function s(e){return typeof e==`object`&&a(e)===`[object Array]`}i.__isArray=s;function c(e){return typeof e==`object`&&a(e)===`[object RegExp]`}i.__isRegExp=c;function l(e){var t=``;return e.global&&(t+=`g`),e.ignoreCase&&(t+=`i`),e.multiline&&(t+=`m`),t}return i.__getRegExpFlags=l,i})();typeof e==`object`&&e.exports&&(e.exports=n)}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=function(){function e(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return&&o.return()}finally{if(i)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw TypeError(`Invalid attempt to destructure non-iterable instance`)}}(),i=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},o=p(n(0)),s=p(n(8)),c=n(4),l=p(c),u=p(n(16)),d=p(n(13)),f=p(n(25));function p(e){return e&&e.__esModule?e:{default:e}}function m(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function h(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function g(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function _(e){return e instanceof l.default||e instanceof c.BlockEmbed}var v=function(e){g(t,e);function t(e,n){m(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.emitter=n.emitter,Array.isArray(n.whitelist)&&(r.whitelist=n.whitelist.reduce(function(e,t){return e[t]=!0,e},{})),r.domNode.addEventListener(`DOMNodeInserted`,function(){}),r.optimize(),r.enable(),r}return i(t,[{key:`batchStart`,value:function(){this.batch=!0}},{key:`batchEnd`,value:function(){this.batch=!1,this.optimize()}},{key:`deleteAt`,value:function(e,n){var i=r(this.line(e),2),o=i[0],s=i[1],l=r(this.line(e+n),1)[0];if(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`deleteAt`,this).call(this,e,n),l!=null&&o!==l&&s>0){if(o instanceof c.BlockEmbed||l instanceof c.BlockEmbed){this.optimize();return}if(o instanceof d.default){var f=o.newlineIndex(o.length(),!0);if(f>-1&&(o=o.split(f+1),o===l)){this.optimize();return}}else if(l instanceof d.default){var p=l.newlineIndex(0);p>-1&&l.split(p+1)}var m=l.children.head instanceof u.default?null:l.children.head;o.moveChildren(l,m),o.remove()}this.optimize()}},{key:`enable`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.domNode.setAttribute(`contenteditable`,e)}},{key:`formatAt`,value:function(e,n,r,i){this.whitelist!=null&&!this.whitelist[r]||(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`formatAt`,this).call(this,e,n,r,i),this.optimize())}},{key:`insertAt`,value:function(e,n,r){if(!(r!=null&&this.whitelist!=null&&!this.whitelist[n])){if(e>=this.length())if(r==null||o.default.query(n,o.default.Scope.BLOCK)==null){var i=o.default.create(this.statics.defaultChild);this.appendChild(i),r==null&&n.endsWith(`
|
|
244
|
-
`)&&(n=n.slice(0,-1)),i.insertAt(0,n,r)}else{var s=o.default.create(n,r);this.appendChild(s)}else a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`insertAt`,this).call(this,e,n,r);this.optimize()}}},{key:`insertBefore`,value:function(e,n){if(e.statics.scope===o.default.Scope.INLINE_BLOT){var r=o.default.create(this.statics.defaultChild);r.appendChild(e),e=r}a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`insertBefore`,this).call(this,e,n)}},{key:`leaf`,value:function(e){return this.path(e).pop()||[null,-1]}},{key:`line`,value:function(e){return e===this.length()?this.line(e-1):this.descendant(_,e)}},{key:`lines`,value:function(){var 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 function e(t,n,r){var i=[],a=r;return t.children.forEachAt(n,r,function(t,n,r){_(t)?i.push(t):t instanceof o.default.Container&&(i=i.concat(e(t,n,a))),a-=r}),i}(this,e,t)}},{key:`optimize`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.batch!==!0&&(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`optimize`,this).call(this,e,n),e.length>0&&this.emitter.emit(s.default.events.SCROLL_OPTIMIZE,e,n))}},{key:`path`,value:function(e){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`path`,this).call(this,e).slice(1)}},{key:`update`,value:function(e){if(this.batch!==!0){var n=s.default.sources.USER;typeof e==`string`&&(n=e),Array.isArray(e)||(e=this.observer.takeRecords()),e.length>0&&this.emitter.emit(s.default.events.SCROLL_BEFORE_UPDATE,n,e),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`update`,this).call(this,e.concat([])),e.length>0&&this.emitter.emit(s.default.events.SCROLL_UPDATE,n,e)}}}]),t}(o.default.Scroll);v.blotName=`scroll`,v.className=`ql-editor`,v.tagName=`DIV`,v.defaultChild=`block`,v.allowedChildren=[l.default,c.BlockEmbed,f.default],t.default=v}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.SHORTKEY=t.default=void 0;var r=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},i=function(){function e(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return&&o.return()}finally{if(i)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw TypeError(`Invalid attempt to destructure non-iterable instance`)}}(),a=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=h(n(21)),s=h(n(11)),c=h(n(3)),l=h(n(2)),u=h(n(20)),d=h(n(0)),f=h(n(5)),p=h(n(10)),m=h(n(9));function h(e){return e&&e.__esModule?e:{default:e}}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function v(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function y(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var b=(0,p.default)(`quill:keyboard`),x=/Mac/i.test(navigator.platform)?`metaKey`:`ctrlKey`,S=function(e){y(t,e),a(t,null,[{key:`match`,value:function(e,t){return t=k(t),[`altKey`,`ctrlKey`,`metaKey`,`shiftKey`].some(function(n){return!!t[n]!==e[n]&&t[n]!==null})?!1:t.key===(e.which||e.keyCode)}}]);function t(e,n){_(this,t);var r=v(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.bindings={},Object.keys(r.options.bindings).forEach(function(t){t===`list autofill`&&e.scroll.whitelist!=null&&!e.scroll.whitelist.list||r.options.bindings[t]&&r.addBinding(r.options.bindings[t])}),r.addBinding({key:t.keys.ENTER,shiftKey:null},D),r.addBinding({key:t.keys.ENTER,metaKey:null,ctrlKey:null,altKey:null},function(){}),/Firefox/i.test(navigator.userAgent)?(r.addBinding({key:t.keys.BACKSPACE},{collapsed:!0},w),r.addBinding({key:t.keys.DELETE},{collapsed:!0},T)):(r.addBinding({key:t.keys.BACKSPACE},{collapsed:!0,prefix:/^.?$/},w),r.addBinding({key:t.keys.DELETE},{collapsed:!0,suffix:/^.?$/},T)),r.addBinding({key:t.keys.BACKSPACE},{collapsed:!1},E),r.addBinding({key:t.keys.DELETE},{collapsed:!1},E),r.addBinding({key:t.keys.BACKSPACE,altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},w),r.listen(),r}return a(t,[{key:`addBinding`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=k(e);if(r==null||r.key==null)return b.warn(`Attempted to add invalid keyboard binding`,r);typeof t==`function`&&(t={handler:t}),typeof n==`function`&&(n={handler:n}),r=(0,c.default)(r,t,n),this.bindings[r.key]=this.bindings[r.key]||[],this.bindings[r.key].push(r)}},{key:`listen`,value:function(){var e=this;this.quill.root.addEventListener(`keydown`,function(n){if(!n.defaultPrevented){var a=n.which||n.keyCode,o=(e.bindings[a]||[]).filter(function(e){return t.match(n,e)});if(o.length!==0){var c=e.quill.getSelection();if(!(c==null||!e.quill.hasFocus())){var l=i(e.quill.getLine(c.index),2),u=l[0],f=l[1],p=i(e.quill.getLeaf(c.index),2),m=p[0],h=p[1],g=i(c.length===0?[m,h]:e.quill.getLeaf(c.index+c.length),2),_=g[0],v=g[1],y=m instanceof d.default.Text?m.value().slice(0,h):``,b=_ instanceof d.default.Text?_.value().slice(v):``,x={collapsed:c.length===0,empty:c.length===0&&u.length()<=1,format:e.quill.getFormat(c),offset:f,prefix:y,suffix:b};o.some(function(t){if(t.collapsed!=null&&t.collapsed!==x.collapsed||t.empty!=null&&t.empty!==x.empty||t.offset!=null&&t.offset!==x.offset)return!1;if(Array.isArray(t.format)){if(t.format.every(function(e){return x.format[e]==null}))return!1}else if(r(t.format)===`object`&&!Object.keys(t.format).every(function(e){return t.format[e]===!0?x.format[e]!=null:t.format[e]===!1?x.format[e]==null:(0,s.default)(t.format[e],x.format[e])}))return!1;return t.prefix!=null&&!t.prefix.test(x.prefix)||t.suffix!=null&&!t.suffix.test(x.suffix)?!1:t.handler.call(e,c,x)!==!0})&&n.preventDefault()}}}})}}]),t}(m.default);S.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},S.DEFAULTS={bindings:{bold:O(`bold`),italic:O(`italic`),underline:O(`underline`),indent:{key:S.keys.TAB,format:[`blockquote`,`indent`,`list`],handler:function(e,t){if(t.collapsed&&t.offset!==0)return!0;this.quill.format(`indent`,`+1`,f.default.sources.USER)}},outdent:{key:S.keys.TAB,shiftKey:!0,format:[`blockquote`,`indent`,`list`],handler:function(e,t){if(t.collapsed&&t.offset!==0)return!0;this.quill.format(`indent`,`-1`,f.default.sources.USER)}},"outdent backspace":{key:S.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:[`indent`,`list`],offset:0,handler:function(e,t){t.format.indent==null?t.format.list!=null&&this.quill.format(`list`,!1,f.default.sources.USER):this.quill.format(`indent`,`-1`,f.default.sources.USER)}},"indent code-block":ee(!0),"outdent code-block":ee(!1),"remove tab":{key:S.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(e){this.quill.deleteText(e.index-1,1,f.default.sources.USER)}},tab:{key:S.keys.TAB,handler:function(e){this.quill.history.cutoff();var t=new l.default().retain(e.index).delete(e.length).insert(` `);this.quill.updateContents(t,f.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index+1,f.default.sources.SILENT)}},"list empty enter":{key:S.keys.ENTER,collapsed:!0,format:[`list`],empty:!0,handler:function(e,t){this.quill.format(`list`,!1,f.default.sources.USER),t.format.indent&&this.quill.format(`indent`,!1,f.default.sources.USER)}},"checklist enter":{key:S.keys.ENTER,collapsed:!0,format:{list:`checked`},handler:function(e){var t=i(this.quill.getLine(e.index),2),n=t[0],r=t[1],a=(0,c.default)({},n.formats(),{list:`checked`}),o=new l.default().retain(e.index).insert(`
|
|
245
|
-
`,a).retain(n.length()-r-1).retain(1,{list:`unchecked`});this.quill.updateContents(o,f.default.sources.USER),this.quill.setSelection(e.index+1,f.default.sources.SILENT),this.quill.scrollIntoView()}},"header enter":{key:S.keys.ENTER,collapsed:!0,format:[`header`],suffix:/^$/,handler:function(e,t){var n=i(this.quill.getLine(e.index),2),r=n[0],a=n[1],o=new l.default().retain(e.index).insert(`
|
|
246
|
-
`,t.format).retain(r.length()-a-1).retain(1,{header:null});this.quill.updateContents(o,f.default.sources.USER),this.quill.setSelection(e.index+1,f.default.sources.SILENT),this.quill.scrollIntoView()}},"list autofill":{key:` `,collapsed:!0,format:{list:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler:function(e,t){var n=t.prefix.length,r=i(this.quill.getLine(e.index),2),a=r[0],o=r[1];if(o>n)return!0;var s=void 0;switch(t.prefix.trim()){case`[]`:case`[ ]`:s=`unchecked`;break;case`[x]`:s=`checked`;break;case`-`:case`*`:s=`bullet`;break;default:s=`ordered`}this.quill.insertText(e.index,` `,f.default.sources.USER),this.quill.history.cutoff();var c=new l.default().retain(e.index-o).delete(n+1).retain(a.length()-2-o).retain(1,{list:s});this.quill.updateContents(c,f.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index-n,f.default.sources.SILENT)}},"code exit":{key:S.keys.ENTER,collapsed:!0,format:[`code-block`],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(e){var t=i(this.quill.getLine(e.index),2),n=t[0],r=t[1],a=new l.default().retain(e.index+n.length()-r-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(a,f.default.sources.USER)}},"embed left":C(S.keys.LEFT,!1),"embed left shift":C(S.keys.LEFT,!0),"embed right":C(S.keys.RIGHT,!1),"embed right shift":C(S.keys.RIGHT,!0)}};function C(e,t){var n,r=e===S.keys.LEFT?`prefix`:`suffix`;return n={key:e,shiftKey:t,altKey:null},g(n,r,/^$/),g(n,`handler`,function(n){var r=n.index;return e===S.keys.RIGHT&&(r+=n.length+1),i(this.quill.getLeaf(r),1)[0]instanceof d.default.Embed?(e===S.keys.LEFT?t?this.quill.setSelection(n.index-1,n.length+1,f.default.sources.USER):this.quill.setSelection(n.index-1,f.default.sources.USER):t?this.quill.setSelection(n.index,n.length+1,f.default.sources.USER):this.quill.setSelection(n.index+n.length+1,f.default.sources.USER),!1):!0}),n}function w(e,t){if(!(e.index===0||this.quill.getLength()<=1)){var n=i(this.quill.getLine(e.index),1)[0],r={};if(t.offset===0){var a=i(this.quill.getLine(e.index-1),1)[0];if(a!=null&&a.length()>1){var o=n.formats(),s=this.quill.getFormat(e.index-1,1);r=u.default.attributes.diff(o,s)||{}}}var c=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(t.prefix)?2:1;this.quill.deleteText(e.index-c,c,f.default.sources.USER),Object.keys(r).length>0&&this.quill.formatLine(e.index-c,c,r,f.default.sources.USER),this.quill.focus()}}function T(e,t){var n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(t.suffix)?2:1;if(!(e.index>=this.quill.getLength()-n)){var r={},a=0,o=i(this.quill.getLine(e.index),1)[0];if(t.offset>=o.length()-1){var s=i(this.quill.getLine(e.index+1),1)[0];if(s){var c=o.formats(),l=this.quill.getFormat(e.index,1);r=u.default.attributes.diff(c,l)||{},a=s.length()}}this.quill.deleteText(e.index,n,f.default.sources.USER),Object.keys(r).length>0&&this.quill.formatLine(e.index+a-1,n,r,f.default.sources.USER)}}function E(e){var t=this.quill.getLines(e),n={};if(t.length>1){var r=t[0].formats(),i=t[t.length-1].formats();n=u.default.attributes.diff(i,r)||{}}this.quill.deleteText(e,f.default.sources.USER),Object.keys(n).length>0&&this.quill.formatLine(e.index,1,n,f.default.sources.USER),this.quill.setSelection(e.index,f.default.sources.SILENT),this.quill.focus()}function D(e,t){var n=this;e.length>0&&this.quill.scroll.deleteAt(e.index,e.length);var r=Object.keys(t.format).reduce(function(e,n){return d.default.query(n,d.default.Scope.BLOCK)&&!Array.isArray(t.format[n])&&(e[n]=t.format[n]),e},{});this.quill.insertText(e.index,`
|
|
247
|
-
`,r,f.default.sources.USER),this.quill.setSelection(e.index+1,f.default.sources.SILENT),this.quill.focus(),Object.keys(t.format).forEach(function(e){r[e]??(Array.isArray(t.format[e])||e!==`link`&&n.quill.format(e,t.format[e],f.default.sources.USER))})}function ee(e){return{key:S.keys.TAB,shiftKey:!e,format:{"code-block":!0},handler:function(t){var n=d.default.query(`code-block`),r=t.index,a=t.length,o=i(this.quill.scroll.descendant(n,r),2),s=o[0],c=o[1];if(s!=null){var l=this.quill.getIndex(s),u=s.newlineIndex(c,!0)+1,p=s.newlineIndex(l+c+a),m=s.domNode.textContent.slice(u,p).split(`
|
|
248
|
-
`);c=0,m.forEach(function(t,i){e?(s.insertAt(u+c,n.TAB),c+=n.TAB.length,i===0?r+=n.TAB.length:a+=n.TAB.length):t.startsWith(n.TAB)&&(s.deleteAt(u+c,n.TAB.length),c-=n.TAB.length,i===0?r-=n.TAB.length:a-=n.TAB.length),c+=t.length+1}),this.quill.update(f.default.sources.USER),this.quill.setSelection(r,a,f.default.sources.SILENT)}}}}function O(e){return{key:e[0].toUpperCase(),shortKey:!0,handler:function(t,n){this.quill.format(e,!n.format[e],f.default.sources.USER)}}}function k(e){if(typeof e==`string`||typeof e==`number`)return k({key:e});if((e===void 0?`undefined`:r(e))===`object`&&(e=(0,o.default)(e,!1)),typeof e.key==`string`)if(S.keys[e.key.toUpperCase()]!=null)e.key=S.keys[e.key.toUpperCase()];else if(e.key.length===1)e.key=e.key.toUpperCase().charCodeAt(0);else return null;return e.shortKey&&(e[x]=e.shortKey,delete e.shortKey),e}t.default=S,t.SHORTKEY=x}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=function(){function e(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return&&o.return()}finally{if(i)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw TypeError(`Invalid attempt to destructure non-iterable instance`)}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=c(n(0)),s=c(n(7));function c(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function u(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function d(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var f=function(e){d(t,e),a(t,null,[{key:`value`,value:function(){}}]);function t(e,n){l(this,t);var r=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.selection=n,r.textNode=document.createTextNode(t.CONTENTS),r.domNode.appendChild(r.textNode),r._length=0,r}return a(t,[{key:`detach`,value:function(){this.parent!=null&&this.parent.removeChild(this)}},{key:`format`,value:function(e,n){if(this._length!==0)return i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`format`,this).call(this,e,n);for(var r=this,a=0;r!=null&&r.statics.scope!==o.default.Scope.BLOCK_BLOT;)a+=r.offset(r.parent),r=r.parent;r!=null&&(this._length=t.CONTENTS.length,r.optimize(),r.formatAt(a,t.CONTENTS.length,e,n),this._length=0)}},{key:`index`,value:function(e,n){return e===this.textNode?0:i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`index`,this).call(this,e,n)}},{key:`length`,value:function(){return this._length}},{key:`position`,value:function(){return[this.textNode,this.textNode.data.length]}},{key:`remove`,value:function(){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`remove`,this).call(this),this.parent=null}},{key:`restore`,value:function(){if(!(this.selection.composing||this.parent==null)){var e=this.textNode,n=this.selection.getNativeRange(),i=void 0,a=void 0,c=void 0;if(n!=null&&n.start.node===e&&n.end.node===e){var l=[e,n.start.offset,n.end.offset];i=l[0],a=l[1],c=l[2]}for(;this.domNode.lastChild!=null&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);if(this.textNode.data!==t.CONTENTS){var u=this.textNode.data.split(t.CONTENTS).join(``);this.next instanceof s.default?(i=this.next.domNode,this.next.insertAt(0,u),this.textNode.data=t.CONTENTS):(this.textNode.data=u,this.parent.insertBefore(o.default.create(this.textNode),this),this.textNode=document.createTextNode(t.CONTENTS),this.domNode.appendChild(this.textNode))}if(this.remove(),a!=null){var d=r([a,c].map(function(e){return Math.max(0,Math.min(i.data.length,e-1))}),2);return a=d[0],c=d[1],{startNode:i,startOffset:a,endNode:i,endOffset:c}}}}},{key:`update`,value:function(e,t){var n=this;if(e.some(function(e){return e.type===`characterData`&&e.target===n.textNode})){var r=this.restore();r&&(t.range=r)}}},{key:`value`,value:function(){return``}}]),t}(o.default.Embed);f.blotName=`cursor`,f.className=`ql-cursor`,f.tagName=`span`,f.CONTENTS=``,t.default=f}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=o(n(0)),i=n(4),a=o(i);function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function c(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function l(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(e){l(t,e);function t(){return s(this,t),c(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return t}(r.default.Container);u.allowedChildren=[a.default,i.BlockEmbed,u],t.default=u}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.ColorStyle=t.ColorClass=t.ColorAttributor=void 0;var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=o(n(0));function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function c(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function l(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(e){l(t,e);function t(){return s(this,t),c(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return r(t,[{key:`value`,value:function(e){var n=i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`value`,this).call(this,e);return n.startsWith(`rgb(`)?(n=n.replace(/^[^\d]+/,``).replace(/[^\d]+$/,``),`#`+n.split(`,`).map(function(e){return(`00`+parseInt(e).toString(16)).slice(-2)}).join(``)):n}}]),t}(a.default.Attributor.Style),d=new a.default.Attributor.Class(`color`,`ql-color`,{scope:a.default.Scope.INLINE}),f=new u(`color`,`color`,{scope:a.default.Scope.INLINE});t.ColorAttributor=u,t.ColorClass=d,t.ColorStyle=f}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.sanitize=t.default=void 0;var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=o(n(6));function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function c(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function l(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(e){l(t,e);function t(){return s(this,t),c(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return r(t,[{key:`format`,value:function(e,n){if(e!==this.statics.blotName||!n)return i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`format`,this).call(this,e,n);n=this.constructor.sanitize(n),this.domNode.setAttribute(`href`,n)}}],[{key:`create`,value:function(e){var n=i(t.__proto__||Object.getPrototypeOf(t),`create`,this).call(this,e);return e=this.sanitize(e),n.setAttribute(`href`,e),n.setAttribute(`rel`,`noopener noreferrer`),n.setAttribute(`target`,`_blank`),n}},{key:`formats`,value:function(e){return e.getAttribute(`href`)}},{key:`sanitize`,value:function(e){return d(e,this.PROTOCOL_WHITELIST)?e:this.SANITIZED_URL}}]),t}(a.default);u.blotName=`link`,u.tagName=`A`,u.SANITIZED_URL=`about:blank`,u.PROTOCOL_WHITELIST=[`http`,`https`,`mailto`,`tel`];function d(e,t){var n=document.createElement(`a`);n.href=e;var r=n.href.slice(0,n.href.indexOf(`:`));return t.indexOf(r)>-1}t.default=u,t.sanitize=d}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=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},i=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=s(n(23)),o=s(n(107));function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var l=0;function u(e,t){e.setAttribute(t,e.getAttribute(t)!==`true`)}t.default=function(){function e(t){var n=this;c(this,e),this.select=t,this.container=document.createElement(`span`),this.buildPicker(),this.select.style.display=`none`,this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener(`mousedown`,function(){n.togglePicker()}),this.label.addEventListener(`keydown`,function(e){switch(e.keyCode){case a.default.keys.ENTER:n.togglePicker();break;case a.default.keys.ESCAPE:n.escape(),e.preventDefault();break;default:}}),this.select.addEventListener(`change`,this.update.bind(this))}return i(e,[{key:`togglePicker`,value:function(){this.container.classList.toggle(`ql-expanded`),u(this.label,`aria-expanded`),u(this.options,`aria-hidden`)}},{key:`buildItem`,value:function(e){var t=this,n=document.createElement(`span`);return n.tabIndex=`0`,n.setAttribute(`role`,`button`),n.classList.add(`ql-picker-item`),e.hasAttribute(`value`)&&n.setAttribute(`data-value`,e.getAttribute(`value`)),e.textContent&&n.setAttribute(`data-label`,e.textContent),n.addEventListener(`click`,function(){t.selectItem(n,!0)}),n.addEventListener(`keydown`,function(e){switch(e.keyCode){case a.default.keys.ENTER:t.selectItem(n,!0),e.preventDefault();break;case a.default.keys.ESCAPE:t.escape(),e.preventDefault();break;default:}}),n}},{key:`buildLabel`,value:function(){var e=document.createElement(`span`);return e.classList.add(`ql-picker-label`),e.innerHTML=o.default,e.tabIndex=`0`,e.setAttribute(`role`,`button`),e.setAttribute(`aria-expanded`,`false`),this.container.appendChild(e),e}},{key:`buildOptions`,value:function(){var e=this,t=document.createElement(`span`);t.classList.add(`ql-picker-options`),t.setAttribute(`aria-hidden`,`true`),t.tabIndex=`-1`,t.id=`ql-picker-options-`+l,l+=1,this.label.setAttribute(`aria-controls`,t.id),this.options=t,[].slice.call(this.select.options).forEach(function(n){var r=e.buildItem(n);t.appendChild(r),n.selected===!0&&e.selectItem(r)}),this.container.appendChild(t)}},{key:`buildPicker`,value:function(){var e=this;[].slice.call(this.select.attributes).forEach(function(t){e.container.setAttribute(t.name,t.value)}),this.container.classList.add(`ql-picker`),this.label=this.buildLabel(),this.buildOptions()}},{key:`escape`,value:function(){var e=this;this.close(),setTimeout(function(){return e.label.focus()},1)}},{key:`close`,value:function(){this.container.classList.remove(`ql-expanded`),this.label.setAttribute(`aria-expanded`,`false`),this.options.setAttribute(`aria-hidden`,`true`)}},{key:`selectItem`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.container.querySelector(`.ql-selected`);if(e!==n&&(n?.classList.remove(`ql-selected`),e!=null&&(e.classList.add(`ql-selected`),this.select.selectedIndex=[].indexOf.call(e.parentNode.children,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))){if(typeof Event==`function`)this.select.dispatchEvent(new Event(`change`));else if((typeof Event>`u`?`undefined`:r(Event))===`object`){var i=document.createEvent(`Event`);i.initEvent(`change`,!0,!0),this.select.dispatchEvent(i)}this.close()}}},{key:`update`,value:function(){var e=void 0;if(this.select.selectedIndex>-1){var 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);var n=e!=null&&e!==this.select.querySelector(`option[selected]`);this.label.classList.toggle(`ql-active`,n)}}]),e}()}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=_(n(0)),i=_(n(5)),a=n(4),o=_(a),s=_(n(16)),c=_(n(25)),l=_(n(24)),u=_(n(35)),d=_(n(6)),f=_(n(22)),p=_(n(7)),m=_(n(55)),h=_(n(42)),g=_(n(23));function _(e){return e&&e.__esModule?e:{default:e}}i.default.register({"blots/block":o.default,"blots/block/embed":a.BlockEmbed,"blots/break":s.default,"blots/container":c.default,"blots/cursor":l.default,"blots/embed":u.default,"blots/inline":d.default,"blots/scroll":f.default,"blots/text":p.default,"modules/clipboard":m.default,"modules/history":h.default,"modules/keyboard":g.default}),r.default.register(o.default,s.default,l.default,d.default,f.default,p.default),t.default=i.default}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=n(1);t.default=function(){function e(e){this.domNode=e,this.domNode[r.DATA_KEY]={blot:this}}return Object.defineProperty(e.prototype,`statics`,{get:function(){return this.constructor},enumerable:!0,configurable:!0}),e.create=function(e){if(this.tagName==null)throw new r.ParchmentError(`Blot definition missing tagName`);var t;return Array.isArray(this.tagName)?(typeof e==`string`&&(e=e.toUpperCase(),parseInt(e).toString()===e&&(e=parseInt(e))),t=typeof e==`number`?document.createElement(this.tagName[e-1]):this.tagName.indexOf(e)>-1?document.createElement(e):document.createElement(this.tagName[0])):t=document.createElement(this.tagName),this.className&&t.classList.add(this.className),t},e.prototype.attach=function(){this.parent!=null&&(this.scroll=this.parent.scroll)},e.prototype.clone=function(){var e=this.domNode.cloneNode(!1);return r.create(e)},e.prototype.detach=function(){this.parent!=null&&this.parent.removeChild(this),delete this.domNode[r.DATA_KEY]},e.prototype.deleteAt=function(e,t){this.isolate(e,t).remove()},e.prototype.formatAt=function(e,t,n,i){var a=this.isolate(e,t);if(r.query(n,r.Scope.BLOT)!=null&&i)a.wrap(n,i);else if(r.query(n,r.Scope.ATTRIBUTE)!=null){var o=r.create(this.statics.scope);a.wrap(o),o.format(n,i)}},e.prototype.insertAt=function(e,t,n){var i=n==null?r.create(`text`,t):r.create(t,n),a=this.split(e);this.parent.insertBefore(i,a)},e.prototype.insertInto=function(e,t){t===void 0&&(t=null),this.parent!=null&&this.parent.children.remove(this);var n=null;e.children.insertBefore(this,t),t!=null&&(n=t.domNode),(this.domNode.parentNode!=e.domNode||this.domNode.nextSibling!=n)&&e.domNode.insertBefore(this.domNode,n),this.parent=e,this.attach()},e.prototype.isolate=function(e,t){var n=this.split(e);return n.split(t),n},e.prototype.length=function(){return 1},e.prototype.offset=function(e){return e===void 0&&(e=this.parent),this.parent==null||this==e?0:this.parent.children.offset(this)+this.parent.offset(e)},e.prototype.optimize=function(e){this.domNode[r.DATA_KEY]!=null&&delete this.domNode[r.DATA_KEY].mutations},e.prototype.remove=function(){this.domNode.parentNode!=null&&this.domNode.parentNode.removeChild(this.domNode),this.detach()},e.prototype.replace=function(e){e.parent!=null&&(e.parent.insertBefore(this,e.next),e.remove())},e.prototype.replaceWith=function(e,t){var n=typeof e==`string`?r.create(e,t):e;return n.replace(this),n},e.prototype.split=function(e,t){return e===0?this:this.next},e.prototype.update=function(e,t){},e.prototype.wrap=function(e,t){var n=typeof e==`string`?r.create(e,t):e;return this.parent!=null&&this.parent.insertBefore(n,this.next),n.appendChild(this),n},e.blotName=`abstract`,e}()}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=n(12),i=n(32),a=n(33),o=n(1);t.default=function(){function e(e){this.attributes={},this.domNode=e,this.build()}return e.prototype.attribute=function(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])},e.prototype.build=function(){var e=this;this.attributes={};var t=r.default.keys(this.domNode),n=i.default.keys(this.domNode),s=a.default.keys(this.domNode);t.concat(n).concat(s).forEach(function(t){var n=o.query(t,o.Scope.ATTRIBUTE);n instanceof r.default&&(e.attributes[n.attrName]=n)})},e.prototype.copy=function(e){var t=this;Object.keys(this.attributes).forEach(function(n){var r=t.attributes[n].value(t.domNode);e.format(n,r)})},e.prototype.move=function(e){var t=this;this.copy(e),Object.keys(this.attributes).forEach(function(e){t.attributes[e].remove(t.domNode)}),this.attributes={}},e.prototype.values=function(){var e=this;return Object.keys(this.attributes).reduce(function(t,n){return t[n]=e.attributes[n].value(e.domNode),t},{})},e}()}),(function(e,t,n){var r=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(t,`__esModule`,{value:!0});var i=n(12);function a(e,t){return(e.getAttribute(`class`)||``).split(/\s+/).filter(function(e){return e.indexOf(t+`-`)===0})}t.default=function(e){r(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.keys=function(e){return(e.getAttribute(`class`)||``).split(/\s+/).map(function(e){return e.split(`-`).slice(0,-1).join(`-`)})},t.prototype.add=function(e,t){return this.canAdd(e,t)?(this.remove(e),e.classList.add(this.keyName+`-`+t),!0):!1},t.prototype.remove=function(e){a(e,this.keyName).forEach(function(t){e.classList.remove(t)}),e.classList.length===0&&e.removeAttribute(`class`)},t.prototype.value=function(e){var t=(a(e,this.keyName)[0]||``).slice(this.keyName.length+1);return this.canAdd(e,t)?t:``},t}(i.default)}),(function(e,t,n){var r=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(t,`__esModule`,{value:!0});var i=n(12);function a(e){var t=e.split(`-`),n=t.slice(1).map(function(e){return e[0].toUpperCase()+e.slice(1)}).join(``);return t[0]+n}t.default=function(e){r(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.keys=function(e){return(e.getAttribute(`style`)||``).split(`;`).map(function(e){return e.split(`:`)[0].trim()})},t.prototype.add=function(e,t){return this.canAdd(e,t)?(e.style[a(this.keyName)]=t,!0):!1},t.prototype.remove=function(e){e.style[a(this.keyName)]=``,e.getAttribute(`style`)||e.removeAttribute(`style`)},t.prototype.value=function(e){var t=e.style[a(this.keyName)];return this.canAdd(e,t)?t:``},t}(i.default)}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var a=function(){function e(t,n){i(this,e),this.quill=t,this.options=n,this.modules={}}return r(e,[{key:`init`,value:function(){var e=this;Object.keys(this.options.modules).forEach(function(t){e.modules[t]??e.addModule(t)})}},{key:`addModule`,value:function(e){var t=this.quill.constructor.import(`modules/`+e);return this.modules[e]=new t(this.quill,this.options.modules[e]||{}),this.modules[e]}}]),e}();a.DEFAULTS={modules:{}},a.themes={default:a},t.default=a}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=s(n(0)),o=s(n(7));function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function l(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function u(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var d=``;t.default=function(e){u(t,e);function t(e){c(this,t);var n=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.contentNode=document.createElement(`span`),n.contentNode.setAttribute(`contenteditable`,!1),[].slice.call(n.domNode.childNodes).forEach(function(e){n.contentNode.appendChild(e)}),n.leftGuard=document.createTextNode(d),n.rightGuard=document.createTextNode(d),n.domNode.appendChild(n.leftGuard),n.domNode.appendChild(n.contentNode),n.domNode.appendChild(n.rightGuard),n}return r(t,[{key:`index`,value:function(e,n){return e===this.leftGuard?0:e===this.rightGuard?1:i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`index`,this).call(this,e,n)}},{key:`restore`,value:function(e){var t=void 0,n=void 0,r=e.data.split(d).join(``);if(e===this.leftGuard)if(this.prev instanceof o.default){var i=this.prev.length();this.prev.insertAt(i,r),t={startNode:this.prev.domNode,startOffset:i+r.length}}else n=document.createTextNode(r),this.parent.insertBefore(a.default.create(n),this),t={startNode:n,startOffset:r.length};else e===this.rightGuard&&(this.next instanceof o.default?(this.next.insertAt(0,r),t={startNode:this.next.domNode,startOffset:r.length}):(n=document.createTextNode(r),this.parent.insertBefore(a.default.create(n),this.next),t={startNode:n,startOffset:r.length}));return e.data=d,t}},{key:`update`,value:function(e,t){var n=this;e.forEach(function(e){if(e.type===`characterData`&&(e.target===n.leftGuard||e.target===n.rightGuard)){var r=n.restore(e.target);r&&(t.range=r)}})}}]),t}(a.default.Embed)}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.AlignStyle=t.AlignClass=t.AlignAttribute=void 0;var r=i(n(0));function i(e){return e&&e.__esModule?e:{default:e}}var a={scope:r.default.Scope.BLOCK,whitelist:[`right`,`center`,`justify`]},o=new r.default.Attributor.Attribute(`align`,`align`,a),s=new r.default.Attributor.Class(`align`,`ql-align`,a),c=new r.default.Attributor.Style(`align`,`text-align`,a);t.AlignAttribute=o,t.AlignClass=s,t.AlignStyle=c}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.BackgroundStyle=t.BackgroundClass=void 0;var r=a(n(0)),i=n(26);function a(e){return e&&e.__esModule?e:{default:e}}var o=new r.default.Attributor.Class(`background`,`ql-bg`,{scope:r.default.Scope.INLINE}),s=new i.ColorAttributor(`background`,`background-color`,{scope:r.default.Scope.INLINE});t.BackgroundClass=o,t.BackgroundStyle=s}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.DirectionStyle=t.DirectionClass=t.DirectionAttribute=void 0;var r=i(n(0));function i(e){return e&&e.__esModule?e:{default:e}}var a={scope:r.default.Scope.BLOCK,whitelist:[`rtl`]},o=new r.default.Attributor.Attribute(`direction`,`dir`,a),s=new r.default.Attributor.Class(`direction`,`ql-direction`,a),c=new r.default.Attributor.Style(`direction`,`direction`,a);t.DirectionAttribute=o,t.DirectionClass=s,t.DirectionStyle=c}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.FontClass=t.FontStyle=void 0;var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=o(n(0));function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function c(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function l(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u={scope:a.default.Scope.INLINE,whitelist:[`serif`,`monospace`]},d=new a.default.Attributor.Class(`font`,`ql-font`,u);t.FontStyle=new(function(e){l(t,e);function t(){return s(this,t),c(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return r(t,[{key:`value`,value:function(e){return i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`value`,this).call(this,e).replace(/["']/g,``)}}]),t}(a.default.Attributor.Style))(`font`,`font-family`,u),t.FontClass=d}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.SizeStyle=t.SizeClass=void 0;var r=i(n(0));function i(e){return e&&e.__esModule?e:{default:e}}var a=new r.default.Attributor.Class(`size`,`ql-size`,{scope:r.default.Scope.INLINE,whitelist:[`small`,`large`,`huge`]}),o=new r.default.Attributor.Style(`size`,`font-size`,{scope:r.default.Scope.INLINE,whitelist:[`10px`,`18px`,`32px`]});t.SizeClass=a,t.SizeStyle=o}),(function(e,t,n){e.exports={align:{"":n(76),center:n(77),right:n(78),justify:n(79)},background:n(80),blockquote:n(81),bold:n(82),clean:n(83),code:n(58),"code-block":n(58),color:n(84),direction:{"":n(85),rtl:n(86)},float:{center:n(87),full:n(88),left:n(89),right:n(90)},formula:n(91),header:{1:n(92),2:n(93)},italic:n(94),image:n(95),indent:{"+1":n(96),"-1":n(97)},link:n(98),list:{ordered:n(99),bullet:n(100),check:n(101)},script:{sub:n(102),super:n(103)},strike:n(104),underline:n(105),video:n(106)}}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.getLastChangeIndex=t.default=void 0;var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=s(n(0)),a=s(n(5)),o=s(n(9));function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function l(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function u(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var d=function(e){u(t,e);function t(e,n){c(this,t);var r=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.lastRecorded=0,r.ignoreChange=!1,r.clear(),r.quill.on(a.default.events.EDITOR_CHANGE,function(e,t,n,i){e!==a.default.events.TEXT_CHANGE||r.ignoreChange||(!r.options.userOnly||i===a.default.sources.USER?r.record(t,n):r.transform(t))}),r.quill.keyboard.addBinding({key:`Z`,shortKey:!0},r.undo.bind(r)),r.quill.keyboard.addBinding({key:`Z`,shortKey:!0,shiftKey:!0},r.redo.bind(r)),/Win/i.test(navigator.platform)&&r.quill.keyboard.addBinding({key:`Y`,shortKey:!0},r.redo.bind(r)),r}return r(t,[{key:`change`,value:function(e,t){if(this.stack[e].length!==0){var n=this.stack[e].pop();this.stack[t].push(n),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n[e],a.default.sources.USER),this.ignoreChange=!1;var r=p(n[e]);this.quill.setSelection(r)}}},{key:`clear`,value:function(){this.stack={undo:[],redo:[]}}},{key:`cutoff`,value:function(){this.lastRecorded=0}},{key:`record`,value:function(e,t){if(e.ops.length!==0){this.stack.redo=[];var n=this.quill.getContents().diff(t),r=Date.now();if(this.lastRecorded+this.options.delay>r&&this.stack.undo.length>0){var i=this.stack.undo.pop();n=n.compose(i.undo),e=i.redo.compose(e)}else this.lastRecorded=r;this.stack.undo.push({redo:e,undo:n}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift()}}},{key:`redo`,value:function(){this.change(`redo`,`undo`)}},{key:`transform`,value:function(e){this.stack.undo.forEach(function(t){t.undo=e.transform(t.undo,!0),t.redo=e.transform(t.redo,!0)}),this.stack.redo.forEach(function(t){t.undo=e.transform(t.undo,!0),t.redo=e.transform(t.redo,!0)})}},{key:`undo`,value:function(){this.change(`undo`,`redo`)}}]),t}(o.default);d.DEFAULTS={delay:1e3,maxStack:100,userOnly:!1};function f(e){var t=e.ops[e.ops.length-1];return t==null?!1:t.insert==null?t.attributes==null?!1:Object.keys(t.attributes).some(function(e){return i.default.query(e,i.default.Scope.BLOCK)!=null}):typeof t.insert==`string`&&t.insert.endsWith(`
|
|
249
|
-
`)}function p(e){var t=e.reduce(function(e,t){return e+=t.delete||0,e},0),n=e.length()-t;return f(e)&&--n,n}t.default=d,t.getLastChangeIndex=p}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.default=t.BaseTooltip=void 0;var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=m(n(3)),o=m(n(2)),s=m(n(8)),c=m(n(23)),l=m(n(34)),u=m(n(59)),d=m(n(60)),f=m(n(28)),p=m(n(61));function m(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function g(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function _(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var v=[!1,`center`,`right`,`justify`],y=`#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(`.`),b=[!1,`serif`,`monospace`],x=[`1`,`2`,`3`,!1],S=[`small`,!1,`large`,`huge`],C=function(e){_(t,e);function t(e,n){h(this,t);var r=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return e.emitter.listenDOM(`click`,document.body,function t(n){if(!document.body.contains(e.root))return document.body.removeEventListener(`click`,t);r.tooltip!=null&&!r.tooltip.root.contains(n.target)&&document.activeElement!==r.tooltip.textbox&&!r.quill.hasFocus()&&r.tooltip.hide(),r.pickers!=null&&r.pickers.forEach(function(e){e.container.contains(n.target)||e.close()})}),r}return r(t,[{key:`addModule`,value:function(e){var n=i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`addModule`,this).call(this,e);return e===`toolbar`&&this.extendToolbar(n),n}},{key:`buildButtons`,value:function(e,t){e.forEach(function(e){(e.getAttribute(`class`)||``).split(/\s+/).forEach(function(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{var r=e.value||``;r!=null&&t[n][r]&&(e.innerHTML=t[n][r])}})})}},{key:`buildPickers`,value:function(e,t){var n=this;this.pickers=e.map(function(e){if(e.classList.contains(`ql-align`))return e.querySelector(`option`)??E(e,v),new d.default(e,t.align);if(e.classList.contains(`ql-background`)||e.classList.contains(`ql-color`)){var n=e.classList.contains(`ql-background`)?`background`:`color`;return e.querySelector(`option`)??E(e,y,n===`background`?`#ffffff`:`#000000`),new u.default(e,t[n])}else return e.querySelector(`option`)??(e.classList.contains(`ql-font`)?E(e,b):e.classList.contains(`ql-header`)?E(e,x):e.classList.contains(`ql-size`)&&E(e,S)),new f.default(e)}),this.quill.on(s.default.events.EDITOR_CHANGE,function(){n.pickers.forEach(function(e){e.update()})})}}]),t}(l.default);C.DEFAULTS=(0,a.default)(!0,{},l.default.DEFAULTS,{modules:{toolbar:{handlers:{formula:function(){this.quill.theme.tooltip.edit(`formula`)},image:function(){var e=this,t=this.container.querySelector(`input.ql-image[type=file]`);t??(t=document.createElement(`input`),t.setAttribute(`type`,`file`),t.setAttribute(`accept`,`image/png, image/gif, image/jpeg, image/bmp, image/x-icon`),t.classList.add(`ql-image`),t.addEventListener(`change`,function(){if(t.files!=null&&t.files[0]!=null){var n=new FileReader;n.onload=function(n){var r=e.quill.getSelection(!0);e.quill.updateContents(new o.default().retain(r.index).delete(r.length).insert({image:n.target.result}),s.default.sources.USER),e.quill.setSelection(r.index+1,s.default.sources.SILENT),t.value=``},n.readAsDataURL(t.files[0])}}),this.container.appendChild(t)),t.click()},video:function(){this.quill.theme.tooltip.edit(`video`)}}}}});var w=function(e){_(t,e);function t(e,n){h(this,t);var r=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.textbox=r.root.querySelector(`input[type="text"]`),r.listen(),r}return r(t,[{key:`listen`,value:function(){var e=this;this.textbox.addEventListener(`keydown`,function(t){c.default.match(t,`enter`)?(e.save(),t.preventDefault()):c.default.match(t,`escape`)&&(e.cancel(),t.preventDefault())})}},{key:`cancel`,value:function(){this.hide()}},{key:`edit`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`link`,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;this.root.classList.remove(`ql-hidden`),this.root.classList.add(`ql-editing`),t==null?e!==this.root.getAttribute(`data-mode`)&&(this.textbox.value=``):this.textbox.value=t,this.position(this.quill.getBounds(this.quill.selection.savedRange)),this.textbox.select(),this.textbox.setAttribute(`placeholder`,this.textbox.getAttribute(`data-`+e)||``),this.root.setAttribute(`data-mode`,e)}},{key:`restoreFocus`,value:function(){var e=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=e}},{key:`save`,value:function(){var e=this.textbox.value;switch(this.root.getAttribute(`data-mode`)){case`link`:var t=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,`link`,e,s.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format(`link`,e,s.default.sources.USER)),this.quill.root.scrollTop=t;break;case`video`:e=T(e);case`formula`:if(!e)break;var n=this.quill.getSelection(!0);if(n!=null){var r=n.index+n.length;this.quill.insertEmbed(r,this.root.getAttribute(`data-mode`),e,s.default.sources.USER),this.root.getAttribute(`data-mode`)===`formula`&&this.quill.insertText(r+1,` `,s.default.sources.USER),this.quill.setSelection(r+2,s.default.sources.USER)}break;default:}this.textbox.value=``,this.hide()}}]),t}(p.default);function T(e){var 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 E(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t.forEach(function(t){var r=document.createElement(`option`);t===n?r.setAttribute(`selected`,`selected`):r.setAttribute(`value`,t),e.appendChild(r)})}t.BaseTooltip=w,t.default=C}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.default=function(){function e(){this.head=this.tail=null,this.length=0}return e.prototype.append=function(){var e=[...arguments];this.insertBefore(e[0],null),e.length>1&&this.append.apply(this,e.slice(1))},e.prototype.contains=function(e){for(var t,n=this.iterator();t=n();)if(t===e)return!0;return!1},e.prototype.insertBefore=function(e,t){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)},e.prototype.offset=function(e){for(var t=0,n=this.head;n!=null;){if(n===e)return t;t+=n.length(),n=n.next}return-1},e.prototype.remove=function(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)},e.prototype.iterator=function(e){return e===void 0&&(e=this.head),function(){var t=e;return e!=null&&(e=e.next),t}},e.prototype.find=function(e,t){t===void 0&&(t=!1);for(var n,r=this.iterator();n=r();){var i=n.length();if(e<i||t&&e===i&&(n.next==null||n.next.length()!==0))return[n,e];e-=i}return[null,0]},e.prototype.forEach=function(e){for(var t,n=this.iterator();t=n();)e(t)},e.prototype.forEachAt=function(e,t,n){if(!(t<=0))for(var r=this.find(e),i=r[0],a=r[1],o,s=e-a,c=this.iterator(i);(o=c())&&s<e+t;){var l=o.length();e>s?n(o,e-s,Math.min(t,s+l-e)):n(o,0,Math.min(l,e+t-s)),s+=l}},e.prototype.map=function(e){return this.reduce(function(t,n){return t.push(e(n)),t},[])},e.prototype.reduce=function(e,t){for(var n,r=this.iterator();n=r();)t=e(t,n);return t},e}()}),(function(e,t,n){var r=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(t,`__esModule`,{value:!0});var i=n(17),a=n(1),o={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},s=100;t.default=function(e){r(t,e);function t(t){var n=e.call(this,t)||this;return n.scroll=n,n.observer=new MutationObserver(function(e){n.update(e)}),n.observer.observe(n.domNode,o),n.attach(),n}return t.prototype.detach=function(){e.prototype.detach.call(this),this.observer.disconnect()},t.prototype.deleteAt=function(t,n){this.update(),t===0&&n===this.length()?this.children.forEach(function(e){e.remove()}):e.prototype.deleteAt.call(this,t,n)},t.prototype.formatAt=function(t,n,r,i){this.update(),e.prototype.formatAt.call(this,t,n,r,i)},t.prototype.insertAt=function(t,n,r){this.update(),e.prototype.insertAt.call(this,t,n,r)},t.prototype.optimize=function(t,n){var r=this;t===void 0&&(t=[]),n===void 0&&(n={}),e.prototype.optimize.call(this,n);for(var o=[].slice.call(this.observer.takeRecords());o.length>0;)t.push(o.pop());for(var c=function(e,t){t===void 0&&(t=!0),!(e==null||e===r)&&e.domNode.parentNode!=null&&(e.domNode[a.DATA_KEY].mutations??(e.domNode[a.DATA_KEY].mutations=[]),t&&c(e.parent))},l=function(e){e.domNode[a.DATA_KEY]==null||e.domNode[a.DATA_KEY].mutations==null||(e instanceof i.default&&e.children.forEach(l),e.optimize(n))},u=t,d=0;u.length>0;d+=1){if(d>=s)throw Error(`[Parchment] Maximum optimize iterations reached`);for(u.forEach(function(e){var t=a.find(e.target,!0);t!=null&&(t.domNode===e.target&&(e.type===`childList`?(c(a.find(e.previousSibling,!1)),[].forEach.call(e.addedNodes,function(e){var t=a.find(e,!1);c(t,!1),t instanceof i.default&&t.children.forEach(function(e){c(e,!1)})})):e.type===`attributes`&&c(t.prev)),c(t))}),this.children.forEach(l),u=[].slice.call(this.observer.takeRecords()),o=u.slice();o.length>0;)t.push(o.pop())}},t.prototype.update=function(t,n){var r=this;n===void 0&&(n={}),t||=this.observer.takeRecords(),t.map(function(e){var t=a.find(e.target,!0);return t==null?null:t.domNode[a.DATA_KEY].mutations==null?(t.domNode[a.DATA_KEY].mutations=[e],t):(t.domNode[a.DATA_KEY].mutations.push(e),null)}).forEach(function(e){e==null||e===r||e.domNode[a.DATA_KEY]==null||e.update(e.domNode[a.DATA_KEY].mutations||[],n)}),this.domNode[a.DATA_KEY].mutations!=null&&e.prototype.update.call(this,this.domNode[a.DATA_KEY].mutations,n),this.optimize(t,n)},t.blotName=`scroll`,t.defaultChild=`block`,t.scope=a.Scope.BLOCK_BLOT,t.tagName=`DIV`,t}(i.default)}),(function(e,t,n){var r=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(t,`__esModule`,{value:!0});var i=n(18),a=n(1);function o(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(e[n]!==t[n])return!1;return!0}t.default=function(e){r(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.formats=function(n){if(n.tagName!==t.tagName)return e.formats.call(this,n)},t.prototype.format=function(n,r){var a=this;n===this.statics.blotName&&!r?(this.children.forEach(function(e){e instanceof i.default||(e=e.wrap(t.blotName,!0)),a.attributes.copy(e)}),this.unwrap()):e.prototype.format.call(this,n,r)},t.prototype.formatAt=function(t,n,r,i){this.formats()[r]!=null||a.query(r,a.Scope.ATTRIBUTE)?this.isolate(t,n).format(r,i):e.prototype.formatAt.call(this,t,n,r,i)},t.prototype.optimize=function(n){e.prototype.optimize.call(this,n);var r=this.formats();if(Object.keys(r).length===0)return this.unwrap();var i=this.next;i instanceof t&&i.prev===this&&o(r,i.formats())&&(i.moveChildren(this),i.remove())},t.blotName=`inline`,t.scope=a.Scope.INLINE_BLOT,t.tagName=`SPAN`,t}(i.default)}),(function(e,t,n){var r=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(t,`__esModule`,{value:!0});var i=n(18),a=n(1);t.default=function(e){r(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.formats=function(n){var r=a.query(t.blotName).tagName;if(n.tagName!==r)return e.formats.call(this,n)},t.prototype.format=function(n,r){a.query(n,a.Scope.BLOCK)!=null&&(n===this.statics.blotName&&!r?this.replaceWith(t.blotName):e.prototype.format.call(this,n,r))},t.prototype.formatAt=function(t,n,r,i){a.query(r,a.Scope.BLOCK)==null?e.prototype.formatAt.call(this,t,n,r,i):this.format(r,i)},t.prototype.insertAt=function(t,n,r){if(r==null||a.query(n,a.Scope.INLINE)!=null)e.prototype.insertAt.call(this,t,n,r);else{var i=this.split(t),o=a.create(n,r);i.parent.insertBefore(o,i)}},t.prototype.update=function(t,n){navigator.userAgent.match(/Trident/)?this.build():e.prototype.update.call(this,t,n)},t.blotName=`block`,t.scope=a.Scope.BLOCK_BLOT,t.tagName=`P`,t}(i.default)}),(function(e,t,n){var r=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(t,`__esModule`,{value:!0}),t.default=function(e){r(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.formats=function(e){},t.prototype.format=function(t,n){e.prototype.formatAt.call(this,0,this.length(),t,n)},t.prototype.formatAt=function(t,n,r,i){t===0&&n===this.length()?this.format(r,i):e.prototype.formatAt.call(this,t,n,r,i)},t.prototype.formats=function(){return this.statics.formats(this.domNode)},t}(n(19).default)}),(function(e,t,n){var r=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(t,`__esModule`,{value:!0});var i=n(19),a=n(1);t.default=function(e){r(t,e);function t(t){var n=e.call(this,t)||this;return n.text=n.statics.value(n.domNode),n}return t.create=function(e){return document.createTextNode(e)},t.value=function(e){var t=e.data;return t.normalize&&(t=t.normalize()),t},t.prototype.deleteAt=function(e,t){this.domNode.data=this.text=this.text.slice(0,e)+this.text.slice(e+t)},t.prototype.index=function(e,t){return this.domNode===e?t:-1},t.prototype.insertAt=function(t,n,r){r==null?(this.text=this.text.slice(0,t)+n+this.text.slice(t),this.domNode.data=this.text):e.prototype.insertAt.call(this,t,n,r)},t.prototype.length=function(){return this.text.length},t.prototype.optimize=function(n){e.prototype.optimize.call(this,n),this.text=this.statics.value(this.domNode),this.text.length===0?this.remove():this.next instanceof t&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())},t.prototype.position=function(e,t){return t===void 0&&(t=!1),[this.domNode,e]},t.prototype.split=function(e,t){if(t===void 0&&(t=!1),!t){if(e===0)return this;if(e===this.length())return this.next}var n=a.create(this.domNode.splitText(e));return this.parent.insertBefore(n,this.next),this.text=this.statics.value(this.domNode),n},t.prototype.update=function(e,t){var n=this;e.some(function(e){return e.type===`characterData`&&e.target===n.domNode})&&(this.text=this.statics.value(this.domNode))},t.prototype.value=function(){return this.text},t.blotName=`text`,t.scope=a.Scope.INLINE_BLOT,t}(i.default)}),(function(e,t,n){var r=document.createElement(`div`);if(r.classList.toggle(`test-class`,!1),r.classList.contains(`test-class`)){var i=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return arguments.length>1&&!this.contains(e)==!t?t:i.call(this,e)}}String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t||=0,this.substr(t,e.length)===e}),String.prototype.endsWith||(String.prototype.endsWith=function(e,t){var n=this.toString();(typeof t!=`number`||!isFinite(t)||Math.floor(t)!==t||t>n.length)&&(t=n.length),t-=e.length;var r=n.indexOf(e,t);return r!==-1&&r===t}),Array.prototype.find||Object.defineProperty(Array.prototype,`find`,{value:function(e){if(this===null)throw TypeError(`Array.prototype.find called on null or undefined`);if(typeof e!=`function`)throw TypeError(`predicate must be a function`);for(var t=Object(this),n=t.length>>>0,r=arguments[1],i,a=0;a<n;a++)if(i=t[a],e.call(r,i,a,t))return i}}),document.addEventListener(`DOMContentLoaded`,function(){document.execCommand(`enableObjectResizing`,!1,!1),document.execCommand(`autoUrlDetect`,!1,!1)})}),(function(e,t){var n=-1,r=1,i=0;function a(e,t,n){if(e==t)return e?[[i,e]]:[];(n<0||e.length<n)&&(n=null);var r=l(e,t),a=e.substring(0,r);e=e.substring(r),t=t.substring(r),r=u(e,t);var s=e.substring(e.length-r);e=e.substring(0,e.length-r),t=t.substring(0,t.length-r);var c=o(e,t);return a&&c.unshift([i,a]),s&&c.push([i,s]),f(c),n!=null&&(c=h(c,n)),c=g(c),c}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 f=d(e,t);if(f){var p=f[0],m=f[1],h=f[2],g=f[3],_=f[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 i}function u(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-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 i}function d(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,d;(i=t.indexOf(r,i+1))!=-1;){var f=l(e.substring(n),t.substring(i)),p=u(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),d=t.substring(i+f))}return a.length*2>=e.length?[o,s,c,d,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,d,f,p;e.length>t.length?(c=s[0],d=s[1],f=s[2],p=s[3]):(f=s[0],p=s[1],c=s[2],d=s[3]);var m=s[4];return[c,d,f,p,m]}function f(e){e.push([i,``]);for(var t=0,a=0,o=0,s=``,c=``,d;t<e.length;)switch(e[t][0]){case r:o++,c+=e[t][1],t++;break;case n:a++,s+=e[t][1],t++;break;case i:a+o>1?(a!==0&&o!==0&&(d=l(c,s),d!==0&&(t-a-o>0&&e[t-a-o-1][0]==i?e[t-a-o-1][1]+=c.substring(0,d):(e.splice(0,0,[i,c.substring(0,d)]),t++),c=c.substring(d),s=s.substring(d)),d=u(c,s),d!==0&&(e[t][1]=c.substring(c.length-d)+e[t][1],c=c.substring(0,c.length-d),s=s.substring(0,s.length-d))),a===0?e.splice(t-o,a+o,[r,c]):o===0?e.splice(t-a,a+o,[n,s]):e.splice(t-a-o,a+o,[n,s],[r,c]),t=t-a-o+ +!!a+ +!!o+1):t!==0&&e[t-1][0]==i?(e[t-1][1]+=e[t][1],e.splice(t,1)):t++,o=0,a=0,s=``,c=``;break}e[e.length-1][1]===``&&e.pop();var p=!1;for(t=1;t<e.length-1;)e[t-1][0]==i&&e[t+1][0]==i&&(e[t][1].substring(e[t][1].length-e[t-1][1].length)==e[t-1][1]?(e[t][1]=e[t-1][1]+e[t][1].substring(0,e[t][1].length-e[t-1][1].length),e[t+1][1]=e[t-1][1]+e[t+1][1],e.splice(t-1,1),p=!0):e[t][1].substring(0,e[t+1][1].length)==e[t+1][1]&&(e[t-1][1]+=e[t+1][1],e[t][1]=e[t][1].substring(e[t+1][1].length)+e[t+1][1],e.splice(t+1,1),p=!0)),t++;p&&f(e)}var p=a;p.INSERT=r,p.DELETE=n,p.EQUAL=i,e.exports=p;function m(e,t){if(t===0)return[i,e];for(var r=0,a=0;a<e.length;a++){var o=e[a];if(o[0]===n||o[0]===i){var s=r+o[1].length;if(t===s)return[a+1,e];if(t<s){e=e.slice();var c=t-r,l=[o[0],o[1].slice(0,c)],u=[o[0],o[1].slice(c)];return e.splice(a,1,l,u),[a+1,e]}else r=s}}throw Error(`cursor_pos is out of bounds!`)}function h(e,t){var n=m(e,t),r=n[1],a=n[0],o=r[a],s=r[a+1];if(o==null||o[0]!==i)return e;if(s!=null&&o[1]+s[1]===s[1]+o[1])return r.splice(a,2,s,o),_(r,a,2);if(s!=null&&s[1].indexOf(o[1])===0){r.splice(a,2,[s[0],o[1]],[0,o[1]]);var c=s[1].slice(o[1].length);return c.length>0&&r.splice(a+2,0,[s[0],c]),_(r,a,3)}else return e}function g(e){for(var t=!1,a=function(e){return e.charCodeAt(0)>=56320&&e.charCodeAt(0)<=57343},o=function(e){return e.charCodeAt(e.length-1)>=55296&&e.charCodeAt(e.length-1)<=56319},s=2;s<e.length;s+=1)e[s-2][0]===i&&o(e[s-2][1])&&e[s-1][0]===n&&a(e[s-1][1])&&e[s][0]===r&&a(e[s][1])&&(t=!0,e[s-1][1]=e[s-2][1].slice(-1)+e[s-1][1],e[s][1]=e[s-2][1].slice(-1)+e[s][1],e[s-2][1]=e[s-2][1].slice(0,-1));if(!t)return e;for(var c=[],s=0;s<e.length;s+=1)e[s][1].length>0&&c.push(e[s]);return c}function _(e,t,n){for(var r=t+n-1;r>=0&&r>=t-1;r--)if(r+1<e.length){var i=e[r],a=e[r+1];i[0]===a[1]&&e.splice(r,2,[i[0],i[1]+a[1]])}return e}}),(function(e,t){t=e.exports=typeof Object.keys==`function`?Object.keys:n,t.shim=n;function n(e){var t=[];for(var n in e)t.push(n);return t}}),(function(e,t){t=e.exports=(function(){return Object.prototype.toString.call(arguments)})()==`[object Arguments]`?n:r,t.supported=n;function n(e){return Object.prototype.toString.call(e)==`[object Arguments]`}t.unsupported=r;function r(e){return e&&typeof e==`object`&&typeof e.length==`number`&&Object.prototype.hasOwnProperty.call(e,`callee`)&&!Object.prototype.propertyIsEnumerable.call(e,`callee`)||!1}}),(function(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(){this._events=new i,this._eventsCount=0}o.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},o.prototype.listeners=function(e,t){var n=r?r+e:e,i=this._events[n];if(t)return!!i;if(!i)return[];if(i.fn)return[i.fn];for(var a=0,o=i.length,s=Array(o);a<o;a++)s[a]=i[a].fn;return s},o.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},o.prototype.on=function(e,t,n){var i=new a(t,n||this),o=r?r+e:e;return this._events[o]?this._events[o].fn?this._events[o]=[this._events[o],i]:this._events[o].push(i):(this._events[o]=i,this._eventsCount++),this},o.prototype.once=function(e,t,n){var i=new a(t,n||this,!0),o=r?r+e:e;return this._events[o]?this._events[o].fn?this._events[o]=[this._events[o],i]:this._events[o].push(i):(this._events[o]=i,this._eventsCount++),this},o.prototype.removeListener=function(e,t,n,a){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return--this._eventsCount===0?this._events=new i:delete this._events[o],this;var s=this._events[o];if(s.fn)s.fn===t&&(!a||s.once)&&(!n||s.context===n)&&(--this._eventsCount===0?this._events=new i:delete this._events[o]);else{for(var c=0,l=[],u=s.length;c<u;c++)(s[c].fn!==t||a&&!s[c].once||n&&s[c].context!==n)&&l.push(s[c]);l.length?this._events[o]=l.length===1?l[0]:l:--this._eventsCount===0?this._events=new i:delete this._events[o]}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&(--this._eventsCount===0?this._events=new i:delete this._events[t])):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prototype.setMaxListeners=function(){return this},o.prefixed=r,o.EventEmitter=o,e!==void 0&&(e.exports=o)}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.matchText=t.matchSpacing=t.matchNewline=t.matchBlot=t.matchAttributor=t.default=void 0;var r=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},i=function(){function e(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return&&o.return()}finally{if(i)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw TypeError(`Invalid attempt to destructure non-iterable instance`)}}(),a=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=y(n(3)),s=y(n(2)),c=y(n(0)),l=y(n(5)),u=y(n(10)),d=y(n(9)),f=n(36),p=n(37),m=y(n(13)),h=n(26),g=n(38),_=n(39),v=n(40);function y(e){return e&&e.__esModule?e:{default:e}}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function S(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function C(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var w=(0,u.default)(`quill:clipboard`),T=`__ql-matcher`,E=[[Node.TEXT_NODE,ue],[Node.TEXT_NODE,se],[`br`,ae],[Node.ELEMENT_NODE,se],[Node.ELEMENT_NODE,ie],[Node.ELEMENT_NODE,ce],[Node.ELEMENT_NODE,re],[Node.ELEMENT_NODE,le],[`li`,N],[`b`,M.bind(M,`bold`)],[`i`,M.bind(M,`italic`)],[`style`,oe]],D=[f.AlignAttribute,g.DirectionAttribute].reduce(function(e,t){return e[t.keyName]=t,e},{}),ee=[f.AlignStyle,p.BackgroundStyle,h.ColorStyle,g.DirectionStyle,_.FontStyle,v.SizeStyle].reduce(function(e,t){return e[t.keyName]=t,e},{}),O=function(e){C(t,e);function t(e,n){x(this,t);var r=S(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.quill.root.addEventListener(`paste`,r.onPaste.bind(r)),r.container=r.quill.addContainer(`ql-clipboard`),r.container.setAttribute(`contenteditable`,!0),r.container.setAttribute(`tabindex`,-1),r.matchers=[],E.concat(r.options.matchers).forEach(function(e){var t=i(e,2),a=t[0],o=t[1];!n.matchVisual&&o===ce||r.addMatcher(a,o)}),r}return a(t,[{key:`addMatcher`,value:function(e,t){this.matchers.push([e,t])}},{key:`convert`,value:function(e){if(typeof e==`string`)return this.container.innerHTML=e.replace(/\>\r?\n +\</g,`><`),this.convert();var t=this.quill.getFormat(this.quill.selection.savedRange.index);if(t[m.default.blotName]){var n=this.container.innerText;return this.container.innerHTML=``,new s.default().insert(n,b({},m.default.blotName,t[m.default.blotName]))}var r=i(this.prepareMatching(),2),a=r[0],o=r[1],c=j(this.container,a,o);return te(c,`
|
|
250
|
-
`)&&c.ops[c.ops.length-1].attributes==null&&(c=c.compose(new s.default().retain(c.length()-1).delete(1))),w.log(`convert`,this.container.innerHTML,c),this.container.innerHTML=``,c}},{key:`dangerouslyPasteHTML`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l.default.sources.API;if(typeof e==`string`)this.quill.setContents(this.convert(e),t),this.quill.setSelection(0,l.default.sources.SILENT);else{var r=this.convert(t);this.quill.updateContents(new s.default().retain(e).concat(r),n),this.quill.setSelection(e+r.length(),l.default.sources.SILENT)}}},{key:`onPaste`,value:function(e){var t=this;if(!(e.defaultPrevented||!this.quill.isEnabled())){var n=this.quill.getSelection(),r=new s.default().retain(n.index),i=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(l.default.sources.SILENT),setTimeout(function(){r=r.concat(t.convert()).delete(n.length),t.quill.updateContents(r,l.default.sources.USER),t.quill.setSelection(r.length()-n.length,l.default.sources.SILENT),t.quill.scrollingContainer.scrollTop=i,t.quill.focus()},1)}}},{key:`prepareMatching`,value:function(){var e=this,t=[],n=[];return this.matchers.forEach(function(r){var a=i(r,2),o=a[0],s=a[1];switch(o){case Node.TEXT_NODE:n.push(s);break;case Node.ELEMENT_NODE:t.push(s);break;default:[].forEach.call(e.container.querySelectorAll(o),function(e){e[T]=e[T]||[],e[T].push(s)});break}}),[t,n]}}]),t}(d.default);O.DEFAULTS={matchers:[],matchVisual:!0};function k(e,t,n){return(t===void 0?`undefined`:r(t))===`object`?Object.keys(t).reduce(function(e,n){return k(e,n,t[n])},e):e.reduce(function(e,r){return r.attributes&&r.attributes[t]?e.push(r):e.insert(r.insert,(0,o.default)({},b({},t,n),r.attributes))},new s.default)}function A(e){if(e.nodeType!==Node.ELEMENT_NODE)return{};var t=`__ql-computed-style`;return e[t]||(e[t]=window.getComputedStyle(e))}function te(e,t){for(var n=``,r=e.ops.length-1;r>=0&&n.length<t.length;--r){var i=e.ops[r];if(typeof i.insert!=`string`)break;n=i.insert+n}return n.slice(-1*t.length)===t}function ne(e){if(e.childNodes.length===0)return!1;var t=A(e);return[`block`,`list-item`].indexOf(t.display)>-1}function j(e,t,n){return e.nodeType===e.TEXT_NODE?n.reduce(function(t,n){return n(e,t)},new s.default):e.nodeType===e.ELEMENT_NODE?[].reduce.call(e.childNodes||[],function(r,i){var a=j(i,t,n);return i.nodeType===e.ELEMENT_NODE&&(a=t.reduce(function(e,t){return t(i,e)},a),a=(i[T]||[]).reduce(function(e,t){return t(i,e)},a)),r.concat(a)},new s.default):new s.default}function M(e,t,n){return k(n,e,!0)}function re(e,t){var n=c.default.Attributor.Attribute.keys(e),r=c.default.Attributor.Class.keys(e),i=c.default.Attributor.Style.keys(e),a={};return n.concat(r).concat(i).forEach(function(t){var n=c.default.query(t,c.default.Scope.ATTRIBUTE);n!=null&&(a[n.attrName]=n.value(e),a[n.attrName])||(n=D[t],n!=null&&(n.attrName===t||n.keyName===t)&&(a[n.attrName]=n.value(e)||void 0),n=ee[t],n!=null&&(n.attrName===t||n.keyName===t)&&(n=ee[t],a[n.attrName]=n.value(e)||void 0))}),Object.keys(a).length>0&&(t=k(t,a)),t}function ie(e,t){var n=c.default.query(e);if(n==null)return t;if(n.prototype instanceof c.default.Embed){var r={},i=n.value(e);i!=null&&(r[n.blotName]=i,t=new s.default().insert(r,n.formats(e)))}else typeof n.formats==`function`&&(t=k(t,n.blotName,n.formats(e)));return t}function ae(e,t){return te(t,`
|
|
251
|
-
`)||t.insert(`
|
|
252
|
-
`),t}function oe(){return new s.default}function N(e,t){var n=c.default.query(e);if(n==null||n.blotName!==`list-item`||!te(t,`
|
|
253
|
-
`))return t;for(var r=-1,i=e.parentNode;!i.classList.contains(`ql-clipboard`);)(c.default.query(i)||{}).blotName===`list`&&(r+=1),i=i.parentNode;return r<=0?t:t.compose(new s.default().retain(t.length()-1).retain(1,{indent:r}))}function se(e,t){return te(t,`
|
|
254
|
-
`)||(ne(e)||t.length()>0&&e.nextSibling&&ne(e.nextSibling))&&t.insert(`
|
|
255
|
-
`),t}function ce(e,t){if(ne(e)&&e.nextElementSibling!=null&&!te(t,`
|
|
256
|
-
|
|
257
|
-
`)){var n=e.offsetHeight+parseFloat(A(e).marginTop)+parseFloat(A(e).marginBottom);e.nextElementSibling.offsetTop>e.offsetTop+n*1.5&&t.insert(`
|
|
258
|
-
`)}return t}function le(e,t){var n={},r=e.style||{};return r.fontStyle&&A(e).fontStyle===`italic`&&(n.italic=!0),r.fontWeight&&(A(e).fontWeight.startsWith(`bold`)||parseInt(A(e).fontWeight)>=700)&&(n.bold=!0),Object.keys(n).length>0&&(t=k(t,n)),parseFloat(r.textIndent||0)>0&&(t=new s.default().insert(` `).concat(t)),t}function ue(e,t){var n=e.data;if(e.parentNode.tagName===`O:P`)return t.insert(n.trim());if(n.trim().length===0&&e.parentNode.classList.contains(`ql-clipboard`))return t;if(!A(e.parentNode).whiteSpace.startsWith(`pre`)){var r=function(e,t){return t=t.replace(/[^\u00a0]/g,``),t.length<1&&e?` `:t};n=n.replace(/\r\n/g,` `).replace(/\n/g,` `),n=n.replace(/\s\s+/g,r.bind(r,!0)),(e.previousSibling==null&&ne(e.parentNode)||e.previousSibling!=null&&ne(e.previousSibling))&&(n=n.replace(/^\s+/,r.bind(r,!1))),(e.nextSibling==null&&ne(e.parentNode)||e.nextSibling!=null&&ne(e.nextSibling))&&(n=n.replace(/\s+$/,r.bind(r,!1)))}return t.insert(n)}t.default=O,t.matchAttributor=re,t.matchBlot=ie,t.matchNewline=se,t.matchSpacing=ce,t.matchText=ue}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=o(n(6));function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function c(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function l(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(e){l(t,e);function t(){return s(this,t),c(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return r(t,[{key:`optimize`,value:function(e){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`optimize`,this).call(this,e),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}],[{key:`create`,value:function(){return i(t.__proto__||Object.getPrototypeOf(t),`create`,this).call(this)}},{key:`formats`,value:function(){return!0}}]),t}(a.default);u.blotName=`bold`,u.tagName=[`STRONG`,`B`],t.default=u}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.addControls=t.default=void 0;var r=function(){function e(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return&&o.return()}finally{if(i)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw TypeError(`Invalid attempt to destructure non-iterable instance`)}}(),i=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=u(n(2)),o=u(n(0)),s=u(n(5)),c=u(n(10)),l=u(n(9));function u(e){return e&&e.__esModule?e:{default:e}}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function p(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function m(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var h=(0,c.default)(`quill:toolbar`),g=function(e){m(t,e);function t(e,n){f(this,t);var i=p(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));if(Array.isArray(i.options.container)){var a=document.createElement(`div`);v(a,i.options.container),e.container.parentNode.insertBefore(a,e.container),i.container=a}else typeof i.options.container==`string`?i.container=document.querySelector(i.options.container):i.container=i.options.container;if(!(i.container instanceof HTMLElement)){var o;return o=h.error(`Container required for toolbar`,i.options),p(i,o)}return i.container.classList.add(`ql-toolbar`),i.controls=[],i.handlers={},Object.keys(i.options.handlers).forEach(function(e){i.addHandler(e,i.options.handlers[e])}),[].forEach.call(i.container.querySelectorAll(`button, select`),function(e){i.attach(e)}),i.quill.on(s.default.events.EDITOR_CHANGE,function(e,t){e===s.default.events.SELECTION_CHANGE&&i.update(t)}),i.quill.on(s.default.events.SCROLL_OPTIMIZE,function(){var e=r(i.quill.selection.getRange(),1)[0];i.update(e)}),i}return i(t,[{key:`addHandler`,value:function(e,t){this.handlers[e]=t}},{key:`attach`,value:function(e){var t=this,n=[].find.call(e.classList,function(e){return e.indexOf(`ql-`)===0});if(n){if(n=n.slice(3),e.tagName===`BUTTON`&&e.setAttribute(`type`,`button`),this.handlers[n]==null){if(this.quill.scroll.whitelist!=null&&this.quill.scroll.whitelist[n]==null){h.warn(`ignoring attaching to disabled format`,n,e);return}if(o.default.query(n)==null){h.warn(`ignoring attaching to nonexistent format`,n,e);return}}var i=e.tagName===`SELECT`?`change`:`click`;e.addEventListener(i,function(i){var c=void 0;if(e.tagName===`SELECT`){if(e.selectedIndex<0)return;var l=e.options[e.selectedIndex];c=l.hasAttribute(`selected`)?!1:l.value||!1}else c=e.classList.contains(`ql-active`)?!1:e.value||!e.hasAttribute(`value`),i.preventDefault();t.quill.focus();var u=r(t.quill.selection.getRange(),1)[0];if(t.handlers[n]!=null)t.handlers[n].call(t,c);else if(o.default.query(n).prototype instanceof o.default.Embed){if(c=prompt(`Enter `+n),!c)return;t.quill.updateContents(new a.default().retain(u.index).delete(u.length).insert(d({},n,c)),s.default.sources.USER)}else t.quill.format(n,c,s.default.sources.USER);t.update(u)}),this.controls.push([n,e])}}},{key:`update`,value:function(e){var t=e==null?{}:this.quill.getFormat(e);this.controls.forEach(function(n){var i=r(n,2),a=i[0],o=i[1];if(o.tagName===`SELECT`){var s=void 0;if(e==null)s=null;else if(t[a]==null)s=o.querySelector(`option[selected]`);else if(!Array.isArray(t[a])){var c=t[a];typeof c==`string`&&(c=c.replace(/\"/g,`\\"`)),s=o.querySelector(`option[value="`+c+`"]`)}s==null?(o.value=``,o.selectedIndex=-1):s.selected=!0}else if(e==null)o.classList.remove(`ql-active`);else if(o.hasAttribute(`value`)){var l=t[a]===o.getAttribute(`value`)||t[a]!=null&&t[a].toString()===o.getAttribute(`value`)||t[a]==null&&!o.getAttribute(`value`);o.classList.toggle(`ql-active`,l)}else o.classList.toggle(`ql-active`,t[a]!=null)})}}]),t}(l.default);g.DEFAULTS={};function _(e,t,n){var r=document.createElement(`button`);r.setAttribute(`type`,`button`),r.classList.add(`ql-`+t),n!=null&&(r.value=n),e.appendChild(r)}function v(e,t){Array.isArray(t[0])||(t=[t]),t.forEach(function(t){var n=document.createElement(`span`);n.classList.add(`ql-formats`),t.forEach(function(e){if(typeof e==`string`)_(n,e);else{var t=Object.keys(e)[0],r=e[t];Array.isArray(r)?y(n,t,r):_(n,t,r)}}),e.appendChild(n)})}function y(e,t,n){var r=document.createElement(`select`);r.classList.add(`ql-`+t),n.forEach(function(e){var t=document.createElement(`option`);e===!1?t.setAttribute(`selected`,`selected`):t.setAttribute(`value`,e),r.appendChild(t)}),e.appendChild(r)}g.DEFAULTS={container:null,handlers:{clean:function(){var e=this,t=this.quill.getSelection();if(t!=null)if(t.length==0){var n=this.quill.getFormat();Object.keys(n).forEach(function(t){o.default.query(t,o.default.Scope.INLINE)!=null&&e.quill.format(t,!1)})}else this.quill.removeFormat(t,s.default.sources.USER)},direction:function(e){var t=this.quill.getFormat().align;e===`rtl`&&t==null?this.quill.format(`align`,`right`,s.default.sources.USER):!e&&t===`right`&&this.quill.format(`align`,!1,s.default.sources.USER),this.quill.format(`direction`,e,s.default.sources.USER)},indent:function(e){var t=this.quill.getSelection(),n=this.quill.getFormat(t),r=parseInt(n.indent||0);if(e===`+1`||e===`-1`){var i=e===`+1`?1:-1;n.direction===`rtl`&&(i*=-1),this.quill.format(`indent`,r+i,s.default.sources.USER)}},link:function(e){e===!0&&(e=prompt(`Enter link URL:`)),this.quill.format(`link`,e,s.default.sources.USER)},list:function(e){var t=this.quill.getSelection(),n=this.quill.getFormat(t);e===`check`?n.list===`checked`||n.list===`unchecked`?this.quill.format(`list`,!1,s.default.sources.USER):this.quill.format(`list`,`unchecked`,s.default.sources.USER):this.quill.format(`list`,e,s.default.sources.USER)}}},t.default=g,t.addControls=v}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"></polyline> <polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"></polyline> <line class=ql-stroke x1=10 x2=8 y1=5 y2=13></line> </svg>`}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=o(n(28));function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function c(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function l(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.default=function(e){l(t,e);function t(e,n){s(this,t);var r=c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.label.innerHTML=n,r.container.classList.add(`ql-color-picker`),[].slice.call(r.container.querySelectorAll(`.ql-picker-item`),0,7).forEach(function(e){e.classList.add(`ql-primary`)}),r}return r(t,[{key:`buildItem`,value:function(e){var n=i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`buildItem`,this).call(this,e);return n.style.backgroundColor=e.getAttribute(`value`)||``,n}},{key:`selectItem`,value:function(e,n){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`selectItem`,this).call(this,e,n);var r=this.label.querySelector(`.ql-color-label`),a=e&&e.getAttribute(`data-value`)||``;r&&(r.tagName===`line`?r.style.stroke=a:r.style.fill=a)}}]),t}(a.default)}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=o(n(28));function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function c(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function l(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.default=function(e){l(t,e);function t(e,n){s(this,t);var r=c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.container.classList.add(`ql-icon-picker`),[].forEach.call(r.container.querySelectorAll(`.ql-picker-item`),function(e){e.innerHTML=n[e.getAttribute(`data-value`)||``]}),r.defaultItem=r.container.querySelector(`.ql-selected`),r.selectItem(r.defaultItem),r}return r(t,[{key:`selectItem`,value:function(e,n){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`selectItem`,this).call(this,e,n),e||=this.defaultItem,this.label.innerHTML=e.innerHTML}}]),t}(a.default)}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}t.default=function(){function e(t,n){var r=this;i(this,e),this.quill=t,this.boundsContainer=n||document.body,this.root=t.addContainer(`ql-tooltip`),this.root.innerHTML=this.constructor.TEMPLATE,this.quill.root===this.quill.scrollingContainer&&this.quill.root.addEventListener(`scroll`,function(){r.root.style.marginTop=-1*r.quill.root.scrollTop+`px`}),this.hide()}return r(e,[{key:`hide`,value:function(){this.root.classList.add(`ql-hidden`)}},{key:`position`,value:function(e){var 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`);var 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){var o=i.bottom-i.top,s=e.bottom-e.top+o;this.root.style.top=n-s+`px`,this.root.classList.add(`ql-flip`)}return a}},{key:`show`,value:function(){this.root.classList.remove(`ql-editing`),this.root.classList.remove(`ql-hidden`)}}]),e}()}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=function(){function e(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return&&o.return()}finally{if(i)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw TypeError(`Invalid attempt to destructure non-iterable instance`)}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=p(n(3)),s=p(n(8)),c=n(43),l=p(c),u=p(n(27)),d=n(15),f=p(n(41));function p(e){return e&&e.__esModule?e:{default:e}}function m(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function h(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function g(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _=[[{header:[`1`,`2`,`3`,!1]}],[`bold`,`italic`,`underline`,`link`],[{list:`ordered`},{list:`bullet`}],[`clean`]],v=function(e){g(t,e);function t(e,n){m(this,t),n.modules.toolbar!=null&&n.modules.toolbar.container==null&&(n.modules.toolbar.container=_);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.quill.container.classList.add(`ql-snow`),r}return a(t,[{key:`extendToolbar`,value:function(e){e.container.classList.add(`ql-snow`),this.buildButtons([].slice.call(e.container.querySelectorAll(`button`)),f.default),this.buildPickers([].slice.call(e.container.querySelectorAll(`select`)),f.default),this.tooltip=new y(this.quill,this.options.bounds),e.container.querySelector(`.ql-link`)&&this.quill.keyboard.addBinding({key:`K`,shortKey:!0},function(t,n){e.handlers.link.call(e,!n.format.link)})}}]),t}(l.default);v.DEFAULTS=(0,o.default)(!0,{},l.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(e){if(e){var t=this.quill.getSelection();if(t==null||t.length==0)return;var n=this.quill.getText(t);/^\S+@\S+\.\S+$/.test(n)&&n.indexOf(`mailto:`)!==0&&(n=`mailto:`+n),this.quill.theme.tooltip.edit(`link`,n)}else this.quill.format(`link`,!1)}}}}});var y=function(e){g(t,e);function t(e,n){m(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.preview=r.root.querySelector(`a.ql-preview`),r}return a(t,[{key:`listen`,value:function(){var e=this;i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`listen`,this).call(this),this.root.querySelector(`a.ql-action`).addEventListener(`click`,function(t){e.root.classList.contains(`ql-editing`)?e.save():e.edit(`link`,e.preview.textContent),t.preventDefault()}),this.root.querySelector(`a.ql-remove`).addEventListener(`click`,function(t){if(e.linkRange!=null){var n=e.linkRange;e.restoreFocus(),e.quill.formatText(n,`link`,!1,s.default.sources.USER),delete e.linkRange}t.preventDefault(),e.hide()}),this.quill.on(s.default.events.SELECTION_CHANGE,function(t,n,i){if(t!=null){if(t.length===0&&i===s.default.sources.USER){var a=r(e.quill.scroll.descendant(u.default,t.index),2),o=a[0],c=a[1];if(o!=null){e.linkRange=new d.Range(t.index-c,o.length());var l=u.default.formats(o.domNode);e.preview.textContent=l,e.preview.setAttribute(`href`,l),e.show(),e.position(e.quill.getBounds(e.linkRange));return}}else delete e.linkRange;e.hide()}})}},{key:`show`,value:function(){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`show`,this).call(this),this.root.removeAttribute(`data-mode`)}}]),t}(c.BaseTooltip);y.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(``),t.default=v}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=M(n(29)),i=n(36),a=n(38),o=n(64),s=M(n(65)),c=M(n(66)),l=n(67),u=M(l),d=n(37),f=n(26),p=n(39),m=n(40),h=M(n(56)),g=M(n(68)),_=M(n(27)),v=M(n(69)),y=M(n(70)),b=M(n(71)),x=M(n(72)),S=M(n(73)),C=n(13),w=M(C),T=M(n(74)),E=M(n(75)),D=M(n(57)),ee=M(n(41)),O=M(n(28)),k=M(n(59)),A=M(n(60)),te=M(n(61)),ne=M(n(108)),j=M(n(62));function M(e){return e&&e.__esModule?e:{default:e}}r.default.register({"attributors/attribute/direction":a.DirectionAttribute,"attributors/class/align":i.AlignClass,"attributors/class/background":d.BackgroundClass,"attributors/class/color":f.ColorClass,"attributors/class/direction":a.DirectionClass,"attributors/class/font":p.FontClass,"attributors/class/size":m.SizeClass,"attributors/style/align":i.AlignStyle,"attributors/style/background":d.BackgroundStyle,"attributors/style/color":f.ColorStyle,"attributors/style/direction":a.DirectionStyle,"attributors/style/font":p.FontStyle,"attributors/style/size":m.SizeStyle},!0),r.default.register({"formats/align":i.AlignClass,"formats/direction":a.DirectionClass,"formats/indent":o.IndentClass,"formats/background":d.BackgroundStyle,"formats/color":f.ColorStyle,"formats/font":p.FontClass,"formats/size":m.SizeClass,"formats/blockquote":s.default,"formats/code-block":w.default,"formats/header":c.default,"formats/list":u.default,"formats/bold":h.default,"formats/code":C.Code,"formats/italic":g.default,"formats/link":_.default,"formats/script":v.default,"formats/strike":y.default,"formats/underline":b.default,"formats/image":x.default,"formats/video":S.default,"formats/list/item":l.ListItem,"modules/formula":T.default,"modules/syntax":E.default,"modules/toolbar":D.default,"themes/bubble":ne.default,"themes/snow":j.default,"ui/icons":ee.default,"ui/picker":O.default,"ui/icon-picker":A.default,"ui/color-picker":k.default,"ui/tooltip":te.default},!0),t.default=r.default}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.IndentClass=void 0;var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=o(n(0));function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function c(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function l(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.IndentClass=new(function(e){l(t,e);function t(){return s(this,t),c(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return r(t,[{key:`add`,value:function(e,n){if(n===`+1`||n===`-1`){var r=this.value(e)||0;n=n===`+1`?r+1:r-1}return n===0?(this.remove(e),!0):i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`add`,this).call(this,e,n)}},{key:`canAdd`,value:function(e,n){return i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`canAdd`,this).call(this,e,n)||i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`canAdd`,this).call(this,e,parseInt(n))}},{key:`value`,value:function(e){return parseInt(i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`value`,this).call(this,e))||void 0}}]),t}(a.default.Attributor.Class))(`indent`,`ql-indent`,{scope:a.default.Scope.BLOCK,whitelist:[1,2,3,4,5,6,7,8]})}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=i(n(4));function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=function(e){s(t,e);function t(){return a(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return t}(r.default);c.blotName=`blockquote`,c.tagName=`blockquote`,t.default=c}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=a(n(4));function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l=function(e){c(t,e);function t(){return o(this,t),s(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return r(t,null,[{key:`formats`,value:function(e){return this.tagName.indexOf(e.tagName)+1}}]),t}(i.default);l.blotName=`header`,l.tagName=[`H1`,`H2`,`H3`,`H4`,`H5`,`H6`],t.default=l}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.default=t.ListItem=void 0;var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=c(n(0)),o=c(n(4)),s=c(n(25));function c(e){return e&&e.__esModule?e:{default:e}}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function d(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function f(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var p=function(e){f(t,e);function t(){return u(this,t),d(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return r(t,[{key:`format`,value:function(e,n){e===m.blotName&&!n?this.replaceWith(a.default.create(this.statics.scope)):i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`format`,this).call(this,e,n)}},{key:`remove`,value:function(){this.prev==null&&this.next==null?this.parent.remove():i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`remove`,this).call(this)}},{key:`replaceWith`,value:function(e,n){return this.parent.isolate(this.offset(this.parent),this.length()),e===this.parent.statics.blotName?(this.parent.replaceWith(e,n),this):(this.parent.unwrap(),i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`replaceWith`,this).call(this,e,n))}}],[{key:`formats`,value:function(e){return e.tagName===this.tagName?void 0:i(t.__proto__||Object.getPrototypeOf(t),`formats`,this).call(this,e)}}]),t}(o.default);p.blotName=`list-item`,p.tagName=`LI`;var m=function(e){f(t,e),r(t,null,[{key:`create`,value:function(e){var n=e===`ordered`?`OL`:`UL`,r=i(t.__proto__||Object.getPrototypeOf(t),`create`,this).call(this,n);return(e===`checked`||e===`unchecked`)&&r.setAttribute(`data-checked`,e===`checked`),r}},{key:`formats`,value:function(e){if(e.tagName===`OL`)return`ordered`;if(e.tagName===`UL`)return e.hasAttribute(`data-checked`)?e.getAttribute(`data-checked`)===`true`?`checked`:`unchecked`:`bullet`}}]);function t(e){u(this,t);var n=d(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),r=function(t){if(t.target.parentNode===e){var r=n.statics.formats(e),i=a.default.find(t.target);r===`checked`?i.format(`list`,`unchecked`):r===`unchecked`&&i.format(`list`,`checked`)}};return e.addEventListener(`touchstart`,r),e.addEventListener(`mousedown`,r),n}return r(t,[{key:`format`,value:function(e,t){this.children.length>0&&this.children.tail.format(e,t)}},{key:`formats`,value:function(){return l({},this.statics.blotName,this.statics.formats(this.domNode))}},{key:`insertBefore`,value:function(e,n){if(e instanceof p)i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`insertBefore`,this).call(this,e,n);else{var r=n==null?this.length():n.offset(this),a=this.split(r);a.parent.insertBefore(e,a)}}},{key:`optimize`,value:function(e){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`optimize`,this).call(this,e);var n=this.next;n!=null&&n.prev===this&&n.statics.blotName===this.statics.blotName&&n.domNode.tagName===this.domNode.tagName&&n.domNode.getAttribute(`data-checked`)===this.domNode.getAttribute(`data-checked`)&&(n.moveChildren(this),n.remove())}},{key:`replace`,value:function(e){if(e.statics.blotName!==this.statics.blotName){var n=a.default.create(this.statics.defaultChild);e.moveChildren(n),this.appendChild(n)}i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`replace`,this).call(this,e)}}]),t}(s.default);m.blotName=`list`,m.scope=a.default.Scope.BLOCK_BLOT,m.tagName=[`OL`,`UL`],m.defaultChild=`list-item`,m.allowedChildren=[p],t.ListItem=p,t.default=m}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=i(n(56));function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=function(e){s(t,e);function t(){return a(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return t}(r.default);c.blotName=`italic`,c.tagName=[`EM`,`I`],t.default=c}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=o(n(6));function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function c(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function l(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(e){l(t,e);function t(){return s(this,t),c(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return r(t,null,[{key:`create`,value:function(e){return e===`super`?document.createElement(`sup`):e===`sub`?document.createElement(`sub`):i(t.__proto__||Object.getPrototypeOf(t),`create`,this).call(this,e)}},{key:`formats`,value:function(e){if(e.tagName===`SUB`)return`sub`;if(e.tagName===`SUP`)return`super`}}]),t}(a.default);u.blotName=`script`,u.tagName=[`SUB`,`SUP`],t.default=u}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=i(n(6));function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=function(e){s(t,e);function t(){return a(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return t}(r.default);c.blotName=`strike`,c.tagName=`S`,t.default=c}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=i(n(6));function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=function(e){s(t,e);function t(){return a(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return t}(r.default);c.blotName=`underline`,c.tagName=`U`,t.default=c}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=s(n(0)),o=n(27);function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function l(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function u(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var d=[`alt`,`height`,`width`],f=function(e){u(t,e);function t(){return c(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return r(t,[{key:`format`,value:function(e,n){d.indexOf(e)>-1?n?this.domNode.setAttribute(e,n):this.domNode.removeAttribute(e):i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`format`,this).call(this,e,n)}}],[{key:`create`,value:function(e){var n=i(t.__proto__||Object.getPrototypeOf(t),`create`,this).call(this,e);return typeof e==`string`&&n.setAttribute(`src`,this.sanitize(e)),n}},{key:`formats`,value:function(e){return d.reduce(function(t,n){return e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t},{})}},{key:`match`,value:function(e){return/\.(jpe?g|gif|png)$/.test(e)||/^data:image\/.+;base64/.test(e)}},{key:`sanitize`,value:function(e){return(0,o.sanitize)(e,[`http`,`https`,`data`])?e:`//:0`}},{key:`value`,value:function(e){return e.getAttribute(`src`)}}]),t}(a.default.Embed);f.blotName=`image`,f.tagName=`IMG`,t.default=f}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0});var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=n(4),o=s(n(27));function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function l(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function u(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var d=[`height`,`width`],f=function(e){u(t,e);function t(){return c(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return r(t,[{key:`format`,value:function(e,n){d.indexOf(e)>-1?n?this.domNode.setAttribute(e,n):this.domNode.removeAttribute(e):i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`format`,this).call(this,e,n)}}],[{key:`create`,value:function(e){var n=i(t.__proto__||Object.getPrototypeOf(t),`create`,this).call(this,e);return n.setAttribute(`frameborder`,`0`),n.setAttribute(`allowfullscreen`,!0),n.setAttribute(`src`,this.sanitize(e)),n}},{key:`formats`,value:function(e){return d.reduce(function(t,n){return e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t},{})}},{key:`sanitize`,value:function(e){return o.default.sanitize(e)}},{key:`value`,value:function(e){return e.getAttribute(`src`)}}]),t}(a.BlockEmbed);f.blotName=`video`,f.className=`ql-video`,f.tagName=`IFRAME`,t.default=f}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.default=t.FormulaBlot=void 0;var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=c(n(35)),o=c(n(5)),s=c(n(9));function c(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function u(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function d(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var f=function(e){d(t,e);function t(){return l(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return r(t,null,[{key:`create`,value:function(e){var n=i(t.__proto__||Object.getPrototypeOf(t),`create`,this).call(this,e);return typeof e==`string`&&(window.katex.render(e,n,{throwOnError:!1,errorColor:`#f00`}),n.setAttribute(`data-value`,e)),n}},{key:`value`,value:function(e){return e.getAttribute(`data-value`)}}]),t}(a.default);f.blotName=`formula`,f.className=`ql-formula`,f.tagName=`SPAN`;var p=function(e){d(t,e),r(t,null,[{key:`register`,value:function(){o.default.register(f,!0)}}]);function t(){l(this,t);var e=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(window.katex==null)throw Error(`Formula module requires KaTeX.`);return e}return t}(s.default);t.FormulaBlot=f,t.default=p}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.default=t.CodeToken=t.CodeBlock=void 0;var r=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},a=l(n(0)),o=l(n(5)),s=l(n(9)),c=l(n(13));function l(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function d(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function f(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var p=function(e){f(t,e);function t(){return u(this,t),d(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return r(t,[{key:`replaceWith`,value:function(e){this.domNode.textContent=this.domNode.textContent,this.attach(),i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`replaceWith`,this).call(this,e)}},{key:`highlight`,value:function(e){var t=this.domNode.textContent;this.cachedText!==t&&((t.trim().length>0||this.cachedText==null)&&(this.domNode.innerHTML=e(t),this.domNode.normalize(),this.attach()),this.cachedText=t)}}]),t}(c.default);p.className=`ql-syntax`;var m=new a.default.Attributor.Class(`token`,`hljs`,{scope:a.default.Scope.INLINE}),h=function(e){f(t,e),r(t,null,[{key:`register`,value:function(){o.default.register(m,!0),o.default.register(p,!0)}}]);function t(e,n){u(this,t);var r=d(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));if(typeof r.options.highlight!=`function`)throw Error(`Syntax module requires highlight.js. Please include the library on the page before Quill.`);var i=null;return r.quill.on(o.default.events.SCROLL_OPTIMIZE,function(){clearTimeout(i),i=setTimeout(function(){r.highlight(),i=null},r.options.interval)}),r.highlight(),r}return r(t,[{key:`highlight`,value:function(){var e=this;if(!this.quill.selection.composing){this.quill.update(o.default.sources.USER);var t=this.quill.getSelection();this.quill.scroll.descendants(p).forEach(function(t){t.highlight(e.options.highlight)}),this.quill.update(o.default.sources.SILENT),t!=null&&this.quill.setSelection(t,o.default.sources.SILENT)}}}]),t}(s.default);h.DEFAULTS={highlight:function(){return window.hljs==null?null:function(e){return window.hljs.highlightAuto(e).value}}(),interval:1e3},t.CodeBlock=p,t.CodeToken=m,t.default=h}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=13 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=9 y1=4 y2=4></line> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=14 x2=4 y1=14 y2=14></line> <line class=ql-stroke x1=12 x2=6 y1=4 y2=4></line> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=5 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=9 y1=4 y2=4></line> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=3 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=3 y1=4 y2=4></line> </svg>`}),(function(e,t){e.exports=`<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"></polygon> <rect height=1 width=1 x=4 y=4></rect> <polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"></polygon> <rect height=1 width=1 x=2 y=6></rect> <rect height=1 width=1 x=3 y=5></rect> <rect height=1 width=1 x=4 y=7></rect> <polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"></polygon> <rect height=1 width=1 x=2 y=12></rect> <rect height=1 width=1 x=2 y=9></rect> <rect height=1 width=1 x=2 y=15></rect> <polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"></polygon> <rect height=1 width=1 x=3 y=8></rect> <path d=M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z></path> <path d=M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z></path> <path d=M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z></path> <rect height=1 width=1 x=12 y=2></rect> <rect height=1 width=1 x=11 y=3></rect> <path d=M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z></path> <rect height=1 width=1 x=2 y=3></rect> <rect height=1 width=1 x=6 y=2></rect> <rect height=1 width=1 x=3 y=2></rect> <rect height=1 width=1 x=5 y=3></rect> <rect height=1 width=1 x=9 y=2></rect> <rect height=1 width=1 x=15 y=14></rect> <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"></polygon> <rect height=1 width=1 x=13 y=7></rect> <rect height=1 width=1 x=15 y=5></rect> <rect height=1 width=1 x=14 y=6></rect> <rect height=1 width=1 x=15 y=8></rect> <rect height=1 width=1 x=14 y=9></rect> <path d=M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z></path> <rect height=1 width=1 x=14 y=3></rect> <polygon points="12 6.868 12 6 11.62 6 12 6.868"></polygon> <rect height=1 width=1 x=15 y=2></rect> <rect height=1 width=1 x=12 y=5></rect> <rect height=1 width=1 x=13 y=4></rect> <polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"></polygon> <rect height=1 width=1 x=9 y=14></rect> <rect height=1 width=1 x=8 y=15></rect> <path d=M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z></path> <rect height=1 width=1 x=5 y=15></rect> <path d=M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z></path> <rect height=1 width=1 x=11 y=15></rect> <path d=M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z></path> <rect height=1 width=1 x=14 y=15></rect> <rect height=1 width=1 x=15 y=11></rect> </g> <polyline class=ql-stroke points="5.5 13 9 5 12.5 13"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=11 y2=11></line> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <rect class="ql-fill ql-stroke" height=3 width=3 x=4 y=5></rect> <rect class="ql-fill ql-stroke" height=3 width=3 x=11 y=5></rect> <path class="ql-even ql-fill ql-stroke" d=M7,8c0,4.031-3,5-3,5></path> <path class="ql-even ql-fill ql-stroke" d=M14,8c0,4.031-3,5-3,5></path> </svg>`}),(function(e,t){e.exports=`<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> <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></path> </svg>`}),(function(e,t){e.exports=`<svg class="" viewbox="0 0 18 18"> <line class=ql-stroke x1=5 x2=13 y1=3 y2=3></line> <line class=ql-stroke x1=6 x2=9.35 y1=12 y2=3></line> <line class=ql-stroke x1=11 x2=15 y1=11 y2=15></line> <line class=ql-stroke x1=15 x2=11 y1=11 y2=15></line> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=7 x=2 y=14></rect> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <line class="ql-color-label ql-stroke ql-transparent" x1=3 x2=15 y1=15 y2=15></line> <polyline class=ql-stroke points="5.5 11 9 3 12.5 11"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=9 y2=9></line> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"></polygon> <line class="ql-stroke ql-fill" x1=15 x2=11 y1=4 y2=4></line> <path class=ql-fill d=M11,3a3,3,0,0,0,0,6h1V3H11Z></path> <rect class=ql-fill height=11 width=1 x=11 y=4></rect> <rect class=ql-fill height=11 width=1 x=13 y=4></rect> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"></polygon> <line class="ql-stroke ql-fill" x1=9 x2=5 y1=4 y2=4></line> <path class=ql-fill d=M5,3A3,3,0,0,0,5,9H6V3H5Z></path> <rect class=ql-fill height=11 width=1 x=5 y=4></rect> <rect class=ql-fill height=11 width=1 x=7 y=4></rect> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <path class=ql-fill d=M14,16H4a1,1,0,0,1,0-2H14A1,1,0,0,1,14,16Z /> <path class=ql-fill d=M14,4H4A1,1,0,0,1,4,2H14A1,1,0,0,1,14,4Z /> <rect class=ql-fill x=3 y=6 width=12 height=6 rx=1 ry=1 /> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <path class=ql-fill d=M13,16H5a1,1,0,0,1,0-2h8A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H5A1,1,0,0,1,5,2h8A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=2 y=6 width=14 height=6 rx=1 ry=1 /> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15,8H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,8Z /> <path class=ql-fill d=M15,12H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,12Z /> <path class=ql-fill d=M15,16H5a1,1,0,0,1,0-2H15A1,1,0,0,1,15,16Z /> <path class=ql-fill d=M15,4H5A1,1,0,0,1,5,2H15A1,1,0,0,1,15,4Z /> <rect class=ql-fill x=2 y=6 width=8 height=6 rx=1 ry=1 /> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <path class=ql-fill d=M5,8H3A1,1,0,0,1,3,6H5A1,1,0,0,1,5,8Z /> <path class=ql-fill d=M5,12H3a1,1,0,0,1,0-2H5A1,1,0,0,1,5,12Z /> <path class=ql-fill d=M13,16H3a1,1,0,0,1,0-2H13A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H3A1,1,0,0,1,3,2H13A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=8 y=6 width=8 height=6 rx=1 ry=1 transform="translate(24 18) rotate(-180)"/> </svg>`}),(function(e,t){e.exports=`<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></path> <rect class=ql-fill height=1.6 rx=0.8 ry=0.8 width=5 x=5.15 y=6.2></rect> <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></path> </svg>`}),(function(e,t){e.exports=`<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>`}),(function(e,t){e.exports=`<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>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=13 y1=4 y2=4></line> <line class=ql-stroke x1=5 x2=11 y1=14 y2=14></line> <line class=ql-stroke x1=8 x2=10 y1=14 y2=4></line> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <rect class=ql-stroke height=10 width=12 x=3 y=4></rect> <circle class=ql-fill cx=6 cy=7 r=1></circle> <polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"></polyline> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"></polyline> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points="5 7 5 11 3 9 5 7"></polyline> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=11 y1=7 y2=11></line> <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> <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></path> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=7 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=7 x2=15 y1=14 y2=14></line> <line class="ql-stroke ql-thin" x1=2.5 x2=4.5 y1=5.5 y2=5.5></line> <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> <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> <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></path> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=6 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=6 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=6 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=3 y1=4 y2=4></line> <line class=ql-stroke x1=3 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=3 y1=14 y2=14></line> </svg>`}),(function(e,t){e.exports=`<svg class="" viewbox="0 0 18 18"> <line class=ql-stroke x1=9 x2=15 y1=4 y2=4></line> <polyline class=ql-stroke points="3 4 4 5 6 3"></polyline> <line class=ql-stroke x1=9 x2=15 y1=14 y2=14></line> <polyline class=ql-stroke points="3 14 4 15 6 13"></polyline> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points="3 9 4 10 6 8"></polyline> </svg>`}),(function(e,t){e.exports=`<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>`}),(function(e,t){e.exports=`<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>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <line class="ql-stroke ql-thin" x1=15.5 x2=2.5 y1=8.5 y2=9.5></line> <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> <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></path> </svg>`}),(function(e,t){e.exports=`<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></path> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=12 x=3 y=15></rect> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <rect class=ql-stroke height=12 width=12 x=3 y=3></rect> <rect class=ql-fill height=12 width=1 x=5 y=3></rect> <rect class=ql-fill height=12 width=1 x=12 y=3></rect> <rect class=ql-fill height=2 width=8 x=5 y=8></rect> <rect class=ql-fill height=1 width=3 x=3 y=5></rect> <rect class=ql-fill height=1 width=3 x=3 y=7></rect> <rect class=ql-fill height=1 width=3 x=3 y=10></rect> <rect class=ql-fill height=1 width=3 x=3 y=12></rect> <rect class=ql-fill height=1 width=3 x=12 y=5></rect> <rect class=ql-fill height=1 width=3 x=12 y=7></rect> <rect class=ql-fill height=1 width=3 x=12 y=10></rect> <rect class=ql-fill height=1 width=3 x=12 y=12></rect> </svg>`}),(function(e,t){e.exports=`<svg viewbox="0 0 18 18"> <polygon class=ql-stroke points="7 11 9 13 11 11 7 11"></polygon> <polygon class=ql-stroke points="7 7 9 5 11 7 7 7"></polygon> </svg>`}),(function(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.default=t.BubbleTooltip=void 0;var r=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},i=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=d(n(3)),o=d(n(8)),s=n(43),c=d(s),l=n(15),u=d(n(41));function d(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function p(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function m(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var h=[[`bold`,`italic`,`link`],[{header:1},{header:2},`blockquote`]],g=function(e){m(t,e);function t(e,n){f(this,t),n.modules.toolbar!=null&&n.modules.toolbar.container==null&&(n.modules.toolbar.container=h);var r=p(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.quill.container.classList.add(`ql-bubble`),r}return i(t,[{key:`extendToolbar`,value:function(e){this.tooltip=new _(this.quill,this.options.bounds),this.tooltip.root.appendChild(e.container),this.buildButtons([].slice.call(e.container.querySelectorAll(`button`)),u.default),this.buildPickers([].slice.call(e.container.querySelectorAll(`select`)),u.default)}}]),t}(c.default);g.DEFAULTS=(0,a.default)(!0,{},c.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(e){e?this.quill.theme.tooltip.edit():this.quill.format(`link`,!1)}}}}});var _=function(e){m(t,e);function t(e,n){f(this,t);var r=p(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.quill.on(o.default.events.EDITOR_CHANGE,function(e,t,n,i){if(e===o.default.events.SELECTION_CHANGE)if(t!=null&&t.length>0&&i===o.default.sources.USER){r.show(),r.root.style.left=`0px`,r.root.style.width=``,r.root.style.width=r.root.offsetWidth+`px`;var a=r.quill.getLines(t.index,t.length);if(a.length===1)r.position(r.quill.getBounds(t));else{var s=a[a.length-1],c=r.quill.getIndex(s),u=Math.min(s.length()-1,t.index+t.length-c),d=r.quill.getBounds(new l.Range(c,u));r.position(d)}}else document.activeElement!==r.textbox&&r.quill.hasFocus()&&r.hide()}),r}return i(t,[{key:`listen`,value:function(){var e=this;r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`listen`,this).call(this),this.root.querySelector(`.ql-close`).addEventListener(`click`,function(){e.root.classList.remove(`ql-editing`)}),this.quill.on(o.default.events.SCROLL_OPTIMIZE,function(){setTimeout(function(){if(!e.root.classList.contains(`ql-hidden`)){var t=e.quill.getSelection();t!=null&&e.position(e.quill.getBounds(t))}},1)})}},{key:`cancel`,value:function(){this.show()}},{key:`position`,value:function(e){var n=r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),`position`,this).call(this,e),i=this.root.querySelector(`.ql-tooltip-arrow`);if(i.style.marginLeft=``,n===0)return n;i.style.marginLeft=-1*n-i.offsetWidth/2+`px`}}]),t}(s.BaseTooltip);_.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(``),t.BubbleTooltip=_,t.default=g}),(function(e,t,n){e.exports=n(63)})]).default})}))(),1),cS={data:``},lS=e=>typeof window==`object`?((e?e.querySelector(`#_goober`):window._goober)||Object.assign((e||document.head).appendChild(document.createElement(`style`)),{innerHTML:` `,id:`_goober`})).firstChild:e||cS,uS=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,dS=/\/\*[^]*?\*\/|\s\s+|\n/g,fS=(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`?fS(o,a):a+`{`+fS(o,a[1]==`k`?``:t)+`}`:typeof o==`object`?r+=fS(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+=fS.p?fS.p(a,o):a+`:`+o+`;`)}return n+(t&&i?t+`{`+i+`}`:i)+r},pS={},mS=e=>{if(typeof e==`object`){let t=``;for(let n in e)t+=n+mS(e[n]);return t}return e},hS=(e,t,n,r,i)=>{let a=mS(e),o=pS[a]||(pS[a]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return`go`+n})(a));if(!pS[o]){let t=a===e?(e=>{let t,n=[{}];for(;t=uS.exec(e.replace(dS,``));)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;pS[o]=fS(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)})(pS[o],t,r),o};function gS(e){let t=this||{},n=e.call?e(t.p):e;return hS(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?``:fS(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,lS(t.target),t.g,t.o,t.k)}var _S,vS,yS;gS.bind({g:1}),gS.bind({k:1});function bS(e,t,n,r){fS.p=t,_S=e,vS=n,yS=r}function xS(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:vS&&vS()},s),n.o=/ *go\d+/.test(c),s.className=gS.apply(n,r)+(c?` `+c:``),t&&(s.ref=o);let l=e;return e[0]&&(l=s.as||e,delete s.as),yS&&l[0]&&yS(s),_S(l,s)}return t?t(i):i}}bS(_.createElement,void 0,void 0,void 0);var SS=xS;function CS(e,t){if(t===1)return e;let n=G.Util.colorToRGBA(e);return n?`rgba(${n.r}, ${n.g}, ${n.b}, ${n.a*t})`:e}function wS(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}var TS=It({enabled:!1,currentFormat:{},editor:It.object({instance:null},{},{deep:!1})}),ES=SS(`div`,_.forwardRef)`
|
|
259
|
-
.ql-editor {
|
|
260
|
-
outline: none;
|
|
261
|
-
}
|
|
262
|
-
.ql-clipboard {
|
|
263
|
-
pointer-events: none;
|
|
264
|
-
opacity: 0;
|
|
265
|
-
}
|
|
266
|
-
${Pv}
|
|
267
|
-
strong {
|
|
268
|
-
font-weight: 700;
|
|
269
|
-
}
|
|
270
|
-
.ql-direction-rtl {
|
|
271
|
-
direction: rtl;
|
|
272
|
-
}
|
|
273
|
-
/* Apply gradient fill to all text-bearing elements when --polotno-gradient is set */
|
|
274
|
-
&[style*='--polotno-gradient'] .ql-editor,
|
|
275
|
-
&[style*='--polotno-gradient'] .ql-editor p,
|
|
276
|
-
&[style*='--polotno-gradient'] .ql-editor li,
|
|
277
|
-
&[style*='--polotno-gradient'] .ql-editor li::before {
|
|
278
|
-
background-image: var(--polotno-gradient);
|
|
279
|
-
background-size: 100% 100%;
|
|
280
|
-
background-repeat: repeat;
|
|
281
|
-
-webkit-background-clip: text;
|
|
282
|
-
-moz-background-clip: text;
|
|
283
|
-
background-clip: text;
|
|
284
|
-
-webkit-text-fill-color: transparent;
|
|
285
|
-
color: transparent;
|
|
286
|
-
}
|
|
287
|
-
`,DS=[`background`,`bold`,`color`,`font`,`italic`,`size`,`strike`,`underline`,`indent`,`list`,`direction`],OS=(e,t)=>{var n=e.clipboard.convert(`<div class='ql-editor' style='outline: none;'>`+t+`<p><br></p></div>`);e.setContents(n),e.history.clear()},kS=({html:e,onBlur:t,onChange:n,element:r,clickCoords:i})=>{let a=_.useRef(null);_.useEffect(()=>{if(!a.current)return;let o=(s=a.current,new sS.default(s,{toolbar:!1,keyboard:!1,clipboard:{matchVisual:!1},formats:DS}));var s;Qn(()=>{TS.editor.instance=o}),window.__polotnoQuill=o,o.on(`text-change`,()=>{o.getSelection()&&Qn(()=>{TS.currentFormat=o.getFormat(o.getSelection())}),setTimeout(()=>{let e=a.current?.childNodes[0];if(!e)return;let t=e.innerHTML;n(wS(t));let i=o.getContents(),s=r.fill,c=null,l=!0;for(let e of i.ops){if(typeof e.insert!=`string`||e.insert===`
|
|
288
|
-
`)continue;let t=e.attributes?.color||s;if(c===null)c=t;else if(t!==c){l=!1;break}}l&&c&&r.set({fill:c})},10)}),OS(o,e);let c=a.current.closest(`.polotno-workspace-inner`),l=c?.scrollLeft,u=c?.scrollTop;i?PS(o,i):o.setSelection(0,0,`api`),c&&l!==void 0&&u!==void 0&&(c.scrollLeft=l,c.scrollTop=u),o.on(`selection-change`,(e,t,n)=>{e&&Qn(()=>{TS.currentFormat=o.getFormat(o.getSelection())})}),a.current.childNodes[0].addEventListener(`blur`,e=>{let n=e.relatedTarget;n?.classList.contains(`ql-clipboard`)||(function(e){return!!e&&!!e.closest(`.sketch-picker`)})(n)||t()});let d=a.current.childNodes[0],f=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=document.createElement(`div`);t.appendChild(e.cloneContents()),s=t.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; word-wrap: break-word;">`+s+`</div><!--EndFragment--></body></html>`;(n=e.clipboardData)==null||n.setData(`text/html`,t)}e.preventDefault()},p=e=>{f(e);let t=o.getSelection();t&&t.length>0&&o.deleteText(t.index,t.length)};return d.addEventListener(`copy`,f),d.addEventListener(`cut`,p),()=>{d.removeEventListener(`copy`,f),d.removeEventListener(`cut`,p),Qn(()=>{TS.editor.instance=null,TS.currentFormat={}}),delete window.__polotnoQuill}},[]),_.useEffect(()=>rr(()=>r.text,()=>{let e=TS.editor.instance;if(!e)return;let t=e.getSelection(),n=a.current?.childNodes?.[0];wS(n?.innerHTML||``)===r.text||(OS(e,bb(r,{forEditor:!0})),t&&(e.setSelection(t.index,t.length),Qn(()=>{TS.currentFormat=e.getFormat(e.getSelection())})))},{fireImmediately:!0}),[]),_.useEffect(()=>{window.addEventListener(`blur`,t);let e=e=>{var n;(n=a.current)!=null&&n.contains(e.target)||t()};return window.addEventListener(`touchstart`,e),()=>{window.removeEventListener(`blur`,t),window.removeEventListener(`touchstart`,e)}},[]);let o={color:r.fill};r.fill.indexOf(`gradient`)>=0&&(o[`--polotno-gradient`]=r.fill,o.color=`transparent`);let s=Ob(r);return _.createElement(ES,{ref:a,style:Object.assign(Object.assign({},o),{fontSize:r.fontSize,fontWeight:r.fontWeight,textTransform:r.textTransform,width:r.a.width,fontFamily:`"`+r.fontFamily+`"`,lineHeight:r.lineHeight,letterSpacing:r.letterSpacing*r.fontSize+`px`,textAlign:r.align,opacity:Math.max(r.a.opacity,.2),textShadow:r.shadowEnabled?`${r.shadowOffsetX}px ${r.shadowOffsetY}px ${r.shadowBlur}px ${CS(r.shadowColor,r.shadowOpacity??1)}`:void 0,caretColor:s}),dir:hb(m_(r.text))})};function AS(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 jS=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),MS=navigator.userAgent.includes(`Firefox`),NS=ga(({element:e,store:t})=>{let{textOverflowIndicatorStyle:n}=Ff(),r=_.useRef(null),[i,a]=_.useState(),[o,s]=_.useState(!1),[c,l]=_.useState(!1),u=_.useRef(e.height),d=e.isSelected,f=Ib(d),p=e.fontSize/3,{textVerticalResizeEnabled:m}=kg,h=kg.autoDeleteEmptyText,g=Ib(e.fontFamily),[v]=Pb(t,e.fontFamily,e.fontStyle,e.fontWeight,e.text||e.placeholder),y=e._editModeEnabled;e_(r);let b=v?e.fontFamily:g===e.fontFamily?`Arial`:g,x=ub(e).fill,S=bb(e,{fontFamily:b,color:x}),C=bb(e,{fontFamily:b,color:x,forEditor:!0}),w=_.useRef([]),[,T]=_.useReducer(e=>e+1,0);_.useEffect(()=>{let e=w.current;e.length>0&&(w.current=[],e.forEach(e=>e()))});let{width:E,height:D}=function(e,t,n){return _.useMemo(()=>dx(e),[e,t.width,n])}(S,e,v);_.useEffect(()=>{if(!v)return;let n=(n,r,i,a)=>{let o=c_(`text ${e.id}`),s=()=>{t.history.ignore(n,r,i).then(()=>{w.current.push(o),T()})};a?queueMicrotask(s):s()};if(!e.height){n(()=>{e.height||e.set({height:D})},void 0,void 0,!0);return}let{textOverflow:r}=kg;if(r!==`change-font-size`||o)r===`resize`&&(m&&e.height<D&&!o&&n(()=>{e.set({height:D})},!1,!0),m||e.height===D||o||n(()=>{e.set({height:D})},!1,!0));else{let t=(e=>{let t=e.fontSize;for(let n=1;n<50;n++){let n=bb(Object.assign(Object.assign({},e.toJSON()),{fontSize:t}),{fontFamily:e.fontFamily}),{height:r}=dx(n);if(!(e.height&&r>e.height||!kg.textSplitAllowed&&!e.curveEnabled&&ux({html:n})))break;t-=.5}return t})(e);t===e.fontSize?e.height!==D&&(m&&e.height<D?n(()=>{e.set({height:D})},!1,!0):m||n(()=>{e.set({height:D})},!1,!0)):n(()=>{e.set({fontSize:t})},!1,!0)}});let ee=_.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 hx(t),e.lastArgs=Object.assign({},t)),e.lastResult;var n,r}},[]),O=_.useRef(0),k=_.useRef(null);_.useEffect(()=>{o||y||(async()=>{O.current++;let n=O.current,r=c_(`text ${e.id} ${n}`);k.current&&k.current(),k.current=r,l(!0);let i=null,o=jS?5:1;for(let r=0;r<o;r++){let a=r>0?ee:hx;try{if(i=await a({skipCache:r>0,html:S,width:e.width||1,height:e.height||D||1,fontFamily:b,padding:p,pixelRatio:t._elementsPixelRatio,font:t.fonts.find(e=>e.fontFamily===b)||v_.find(e=>e.fontFamily===b)}),n!==O.current)return;if((jS||MS)&&i&&AS(i)){await new Promise(e=>setTimeout(e,50*(r+1)));continue}break}catch(t){console.error(t),p_(`Error rendering rich text with id ${e.id}`);break}}i?a(i):r?(r(),r=null):console.error(`Finish function is called twice!`),l(!1)})()},[S,o,D,y,b,e.height,t._elementsPixelRatio,v]);let[A,te]=Gx(c,300),[ne]=Gx(o,300,!0),j=ne||A;_.useEffect(()=>{var t;if(!j)return er(()=>{let t=r.current;Cb(t,e)});(t=r.current)==null||t.clearCache()},[i,j,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]),_.useEffect(()=>{i&&!c&&k.current&&(k.current(),k.current=null)},[i,c]),_.useLayoutEffect(()=>{if(!v||!e.curveEnabled)return;let t=new G.TextPath({data:gb(e.a.width,e.a.height,e.curvePower,e.a.fontSize),text:m_(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(()=>{e.set({width:n,x:e.a.x+i,y:e.a.y+a})})}t.destroy()},[v,e.curveEnabled,e.curvePower,e.text,e.fontSize,e.fontFamily,e.fontWeight,e.fontStyle,e.letterSpacing]),_.useEffect(()=>()=>{k.current&&k.current()},[]),_.useEffect(()=>{f&&!d&&h&&m_(e.text)===``&&e.removable&&!e.placeholder&&t.deleteElements([e.id])},[h,e.placeholder,e.removable,e.text,d,f]);let M=0;e.verticalAlign===`middle`&&(M=(e.height-D)/2),e.verticalAlign===`bottom`&&(M=e.height-D);let re=Fb({fontLoaded:v,fontFamily:e.fontFamily,fontSize:e.fontSize,lineHeight:e.lineHeight}),ie=e.backgroundPadding*(e.fontSize*re*.5),ae=e.backgroundCornerRadius*(e.fontSize*re*.5),oe=_.useMemo(()=>{if(!e.backgroundEnabled||e.curveEnabled||e.legacyBackground)return``;let t=fx(S);return t.length===0?``:cb({rects:t.map(e=>({left:e.left+p,right:e.right+p,top:e.top+p,bottom:e.bottom+p})),padding:ie,cornerRadius:ae})},[e.backgroundEnabled,e.curveEnabled,e.legacyBackground,S,v,ie,ae,p]),N=wb(),se=gb(e.a.width,D,e.curvePower,e.fontSize),ce=_.useRef(null),le=_.useRef(null),ue=y&&e.strokeWidth>0&&!e.curveEnabled,de=E>0?(e.a.width+2*p)/(E+2*p):1;return _.createElement(_.Fragment,null,e.curveEnabled||e.legacyBackground?_.createElement(af,{x:e.a.x,y:e.a.y,offsetX:ie/de,offsetY:ie/de,rotation:e.a.rotation,scaleX:de,scaleY:de,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled,opacity:e.backgroundOpacity*e.a.opacity,fill:e.backgroundColor,width:e.width+2*ie,height:e.height+2*ie,cornerRadius:ae}):_.createElement(uf,{name:`html-background`,x:e.a.x,y:e.a.y,offsetX:p/de,offsetY:(p-M)/de,rotation:e.a.rotation,scaleX:de,scaleY:de,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled&&oe.length>0,opacity:e.backgroundOpacity*e.a.opacity,fill:e.backgroundColor,data:oe}),_.createElement(uf,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,data:se,stroke:n.stroke,strokeWidth:1,visible:!1}),_.createElement(af,{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:!j,draggable:N?e.draggable&&d:e.draggable,preventDefault:!N||d,opacity:y?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&&(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=>{s(!0),u.current=e.height},onTransform:t=>{let n=t.target,r=(n.getStage()?.findOne(`Transformer`)).getActiveAnchor(),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=e.fontSize,a=r;r<i&&(a=i,ce.current&&n.position(ce.current)),n.width(a),n.scaleX(1),n.scaleY(1);let o=dx(bb(Object.assign(Object.assign({},e.toJSON()),{width:a}),{fontFamily:b,color:x})).height,s=kg.textVerticalResizeEnabled?Math.max(o,u.current):o;n.height(s),e.set({width:n.width(),height:s,x:n.x(),y:n.y()})}else if(a){let r=kg.textOverflow===`resize`,i=typeof e.lineHeight==`number`?e.lineHeight:1,a=r?D:i*e.fontSize,o=Math.max(a,t.target.height()*t.target.scaleY());n.scaleY(1),e.set({x:n.x(),y:n.y(),height:o,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});ce.current=t.target.position()},onTransformEnd:t=>{s(!1),l(!0);let n=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set({fontSize:e.fontSize*n,width:t.target.width()*n,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),shadowBlur:e.shadowBlur*n,shadowOffsetX:e.shadowOffsetX*n,shadowOffsetY:e.shadowOffsetY*n,strokeWidth:e.strokeWidth*n})}}),_.createElement(sf,{ref:r,image:i,x:e.a.x,y:e.a.y,offsetX:p,offsetY:p-M,listening:!1,rotation:e.a.rotation,width:e.a.width+2*p,height:(e.a.width+2*p)*((i?.height??0)/(i?.width||1)||1),visible:!j&&!y,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||j}),(j||ue)&&_.createElement(`Group`,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,offsetY:-M},_.createElement(Vy,{divProps:{style:{pointerEvents:`none`}}},_.createElement(ES,{dangerouslySetInnerHTML:{__html:S},style:{pointerEvents:`none`,opacity:e.a.opacity,textShadow:e.shadowEnabled?`${e.shadowOffsetX}px ${e.shadowOffsetY}px ${e.shadowBlur}px ${CS(e.shadowColor,e.shadowOpacity??1)}`:void 0}}))),y&&_.createElement(`Group`,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,offsetY:-M},_.createElement(Vy,null,_.createElement(kS,{html:C,element:e,onChange:t=>{let n=Tb({oldText:m_(e.text),newText:m_(t),element:e});e.set({text:t,fontSize:n})},onBlur:t=>{e.toggleEditMode(!1),te(!0)},clickCoords:le.current}))))});function PS(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=sS.default.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`)}var FS=({targetKonvaNodes:e,guideKonvaNode:t,distance:n,snapDirection:r})=>n<5;function IS(e,t){var n=[],r=[];e.vertical.forEach(e=>{t.vertical.forEach(t=>{var r=Math.abs(e.offset-t.guide);FS({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);FS({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 LS=()=>{if(G.DD._dragElements.size===0)return;let e=[...G.DD._dragElements.entries()],t=e.find(([e,t])=>t.node instanceof G.Transformer);t&&(e.splice(e.indexOf(t),1),e.unshift(t),G.DD._dragElements.clear(),e.forEach(([e,t])=>{G.DD._dragElements.set(e,t)}))};function RS(e,t){let n=_.useRef(null),{snapGuideStyle:r}=Ff(),i=_.useRef(r);i.current=r;let a=e=>e.hasName(`element`)||e.hasName(`page-background`)||!n.current&&e.hasName(`elements-area`);function o(t){let n=e.current?.getStage(),r=[],i=[];return n.find(a).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 s(t){let n=e.current?.getLayer(),r=n?.children.find(e=>e.name()===`line-guides`);t.forEach(e=>{if(e.orientation===`H`){var t=new G.Line({x:-n.getStage().x(),y:-n.getStage().y(),points:[-6e3,e.lineGuide,6e3,e.lineGuide],stroke:i.current.stroke,strokeWidth:i.current.strokeWidth,name:`guid-line`,dash:i.current.dash});r?.add(t),n.batchDraw()}else e.orientation===`V`&&(t=new G.Line({x:-n.getStage().x(),y:-n.getStage().y(),points:[e.lineGuide,-6e3,e.lineGuide,6e3],stroke:i.current.stroke,strokeWidth:i.current.strokeWidth,name:`guid-line`,dash:i.current.dash}),r?.add(t))})}let c=e=>{e.target.getLayer().children.find(e=>e.name()===`line-guides`)?.destroyChildren();var t=IS(o(e.target.nodes()),function(e){let t=e.__getNodeRect(),n=Vv(Object.assign(Object.assign({},t),{rotation:G.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(!t.length)return;s(t);let n=e.target.getAbsolutePosition(),r=(e.target.nodes().map(e=>e.getAbsolutePosition()),Object.assign({},n));t.forEach(e=>{switch(e.snap){case`start`:case`center`:case`end`:switch(e.orientation){case`V`:r.x=e.lineGuide+e.offset;break;case`H`:r.y=e.lineGuide+e.offset}}});let i=r.x-n.x,a=r.y-n.y;e.evt.ctrlKey||e.evt.metaKey||e.target.nodes().forEach(e=>{let t=e.getAbsolutePosition();e.setAbsolutePosition({x:t.x+i,y:t.y+a})})},l=(t,n,r)=>{let i=e.current;if(i.getLayer().children.find(e=>e.name()===`line-guides`)?.destroyChildren(),i.getActiveAnchor()===`rotater`)return n;let a=VS[i.getActiveAnchor()],c=i.findOne(`.${a}`)?.getAbsolutePosition();if(!c)return n;let l={x:t.x-c.x,y:t.y-c.y},u=function(e,t){let n=BS(e,t)/BS(t,t);return{x:n*t.x,y:n*t.y}}({x:n.x-t.x,y:n.y-t.y},l);if(Math.sqrt(u.x**2+u.y**2)>5)return n;let d={x:t.x+u.x,y:t.y+u.y};var f=IS(o(i.nodes()),{vertical:[{guide:d.x,offset:0,snap:`start`,nodes:i.nodes()}],horizontal:[{guide:d.y,offset:0,snap:`start`,nodes:i.nodes()}]});if(!f.length||(s(f),r.ctrlKey||r.metaKey))return n;let p=[];if(f.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}}}(d,c,{orientation:e.orientation,lineGuide:e.lineGuide});t&&p.push(t)}),p.length>0){let e=p[0],t=Math.sqrt((d.x-e.x)**2+(d.y-e.y)**2);if(p.forEach(n=>{let r=Math.sqrt((d.x-n.x)**2+(d.y-n.y)**2);r<t&&(t=r,e=n)}),t<10)return e}return d},u=e=>{if(!e.target)return;let t=e.target.getLayer();t.children.find(e=>e.name()===`line-guides`)?.destroyChildren(),t.batchDraw()};_.useEffect(()=>{e.current&&(e.current.anchorDragBoundFunc(l),e.current.on(`dragstart`,e=>{setTimeout(()=>{LS()})}),e.current.on(`dragmove`,c),e.current.on(`dragend`,u),e.current.on(`transformend`,u),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 zS(e,t,n){let{snapGuideStyle:r}=Ff(),i=_.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=>{n.target.getLayer().children.find(e=>e.name()===`line-guides`)?.destroyChildren();var r,o=IS(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:(r=n.target).absolutePosition().x,offset:0,snap:`center`,nodes:[r]}],horizontal:[{guide:r.absolutePosition().y,offset:0,snap:`center`,nodes:[r]}]});if(!o.length)return;(function(t){let n=e.current?.getLayer(),r=n?.children.find(e=>e.name()===`line-guides`);t.forEach(e=>{if(e.orientation===`H`){var t=new G.Line({x:-n.getStage().x(),y:-n.getStage().y(),points:[-6e3,e.lineGuide,6e3,e.lineGuide],stroke:i.current.stroke,strokeWidth:i.current.strokeWidth,name:`guid-line`,dash:i.current.dash});r?.add(t),n.batchDraw()}else e.orientation===`V`&&(t=new G.Line({x:-n.getStage().x(),y:-n.getStage().y(),points:[e.lineGuide,-6e3,e.lineGuide,6e3],stroke:i.current.stroke,strokeWidth:i.current.strokeWidth,name:`guid-line`,dash:i.current.dash}),r?.add(t))})})(o);let s=n.target.getAbsolutePosition(),c=Object.assign({},s);o.forEach(e=>{switch(e.snap){case`start`:case`center`:case`end`:switch(e.orientation){case`V`:c.x=e.lineGuide+e.offset;break;case`H`:c.y=e.lineGuide+e.offset}}});let l=c.x-s.x,u=c.y-s.y;if(!n.evt.ctrlKey&&!n.evt.metaKey){let e=n.target.getAbsolutePosition();n.target.absolutePosition({x:e.x+l,y:e.y+u})}},s=e=>{if(!e.target)return;let t=e.target.getLayer();t.children.find(e=>e.name()===`line-guides`)?.destroyChildren(),t.batchDraw()};_.useEffect(()=>{e.current&&(e.current.on(`dragmove`,o),e.current.on(`dragend`,s))},n)}function BS(e,t){return e.x*t.x+e.y*t.y}var VS={"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 HS(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 US(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 WS=(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()}}},GS=ga(({element:e,type:t})=>{let n=ub(e,e.a.color,`fill`),r=ub(e,e.a.color,`stroke`),i=Object.assign(Object.assign(Object.assign({strokeWidth:e.height,lineCap:`round`,lineJoin:`round`},r),n),{opacity:e.a.opacity,hideInExport:!e.showInExport});return _.createElement(_.Fragment,null,t===`arrow`&&_.createElement(`Line`,Object.assign({points:[3*e.height,2*-e.height,0,0,3*e.height,2*e.height]},i)),t===`triangle`&&_.createElement(`Line`,Object.assign({points:[3*e.height,2*-e.height,0,0,3*e.height,2*e.height],closed:!0},i)),t===`bar`&&_.createElement(`Line`,Object.assign({points:[0,2*-e.height,0,2*e.height],closed:!0},i)),t===`square`&&_.createElement(`Line`,Object.assign({points:[0,2*-e.height,4*e.height,2*-e.height,4*e.height,2*e.height,0,2*e.height],closed:!0},i)),t===`circle`&&_.createElement(`Circle`,Object.assign({x:2*e.height,y:0,radius:2*e.height},i)))}),KS=ga(({element:e,store:t})=>{let{transformerStyle:n}=Ff(),r=_.useRef(null),i=_.useRef(null),a=_.useRef(null),o=e.selectable||t.role===Hx.ADMIN,s=wb(),c=t.selectedElements.indexOf(e)>=0&&t.selectedElements.length===1,l=e.isSelected,{middleLeft:u,middleRight:d}=HS(e);zS(i,[r],[c]),zS(a,[r],[c]);let f=ub(e,e.a.color,`stroke`);return _.createElement(_.Fragment,null,_.createElement(of,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()})}})),_.createElement(nf,{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)},_.createElement(GS,{element:e,type:e.startHead})),_.createElement(nf,{x:d.x,y:d.y,rotation:e.rotation+180,onClick:e=>r.current?.fire(`click`,e),onTap:e=>r.current?.fire(`tap`,e)},_.createElement(GS,{element:e,type:e.endHead})),c&&e.resizable&&_.createElement(Hy,{selector:`.page-abs-container`,enabled:!0},_.createElement(`Group`,{visible:c},_.createElement(`Rect`,Object.assign({x:u.x,y:u.y,ref:i,name:`line-anchor`},WS(t.scale,t,n),{onDragMove:t=>{let n=US(t.target.position(),d,e.height);e.set({x:n.x,y:n.y,width:n.width,rotation:n.rotation})}})),_.createElement(`Rect`,Object.assign({x:d.x,y:d.y,ref:a,name:`line-anchor`},WS(t.scale,t,n),{onDragMove:t=>{let n=US(u,t.target.position(),e.height);e.set({x:n.x,y:n.y,width:n.width,rotation:n.rotation})}})))))});function X(e){if(!e)throw Error(`Assertion failed.`)}var qS=e=>{let t=(e%360+360)%360;if(t===0||t===90||t===180||t===270)return t;throw Error(`Invalid rotation ${e}.`)},JS=e=>e&&e[e.length-1],YS=e=>e>=0&&e<2**32,XS=class e{constructor(e){this.bytes=e,this.pos=0}seekToByte(e){this.pos=8*e}readBit(){let e=Math.floor(this.pos/8),t=this.bytes[e]??0,n=7-(this.pos&7),r=(t&1<<n)>>n;return this.pos++,r}readBits(e){if(e===1)return this.readBit();let t=0;for(let n=0;n<e;n++)t<<=1,t|=this.readBit();return t}writeBits(e,t){let n=this.pos+e;for(let e=this.pos;e<n;e++){let r=Math.floor(e/8),i=this.bytes[r],a=7-(e&7);i&=~(1<<a),i|=(t&1<<n-e-1)>>n-e-1<<a,this.bytes[r]=i}this.pos=n}readAlignedByte(){if(this.pos%8!=0)throw Error(`Bitstream is not byte-aligned.`);let e=this.pos/8,t=this.bytes[e]??0;return this.pos+=8,t}skipBits(e){this.pos+=e}getBitsLeft(){return this.bytes.length*8-this.pos}clone(){let t=new e(this.bytes);return t.pos=this.pos,t}},Z=e=>{let t=0;for(;e.readBits(1)===0&&t<32;)t++;if(t>=32)throw Error(`Invalid exponential-Golomb code.`);return(1<<t)-1+e.readBits(t)},ZS=e=>{let t=Z(e);return t&1?t+1>>1:-(t>>1)},QS=e=>e.constructor===Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),$S=e=>e.constructor===DataView?e:ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e),eC=new TextDecoder,tC=new TextEncoder,nC=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[t,e])),rC={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},iC=nC(rC),aC={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},oC=nC(aC),sC={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},cC=nC(sC),lC=e=>!!e&&!!e.primaries&&!!e.transfer&&!!e.matrix&&e.fullRange!==void 0,uC=e=>e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||ArrayBuffer.isView(e),dC=class{constructor(){this.currentPromise=Promise.resolve()}async acquire(){let e,t=new Promise(t=>{e=t}),n=this.currentPromise;return this.currentPromise=t,await n,e}},fC=e=>[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``),pC=e=>(e=e>>1&1431655765|(e&1431655765)<<1,e=e>>2&858993459|(e&858993459)<<2,e=e>>4&252645135|(e&252645135)<<4,e=e>>8&16711935|(e&16711935)<<8,e=e>>16&65535|(e&65535)<<16,e>>>0),mC=(e,t,n)=>{let r=0,i=e.length-1,a=-1;for(;r<=i;){let o=r+i>>1,s=n(e[o]);s===t?(a=o,i=o-1):s<t?r=o+1:i=o-1}return a},hC=(e,t,n)=>{let r=0,i=e.length-1,a=-1;for(;r<=i;){let o=r+(i-r+1)/2|0;n(e[o])<=t?(a=o,r=o+1):i=o-1}return a},gC=(e,t,n)=>{let r=hC(e,n(t),n);e.splice(r+1,0,t)},_C=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},vC=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n]))return e[n]},yC=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1},bC=async function*(e){Symbol.iterator in e?yield*e[Symbol.iterator]():yield*e[Symbol.asyncIterator]()},xC=e=>{if(!(Symbol.iterator in e)&&!(Symbol.asyncIterator in e))throw TypeError(`Argument must be an iterable or async iterable.`)},SC=e=>{throw Error(`Unexpected value: ${e}`)},CC=(e,t,n)=>{let r=e.getUint8(t),i=e.getUint8(t+1),a=e.getUint8(t+2);return n?r|i<<8|a<<16:r<<16|i<<8|a},wC=(e,t,n)=>CC(e,t,n)<<8>>8,TC=(e,t,n,r)=>{n>>>=0,n&=16777215,r?(e.setUint8(t,n&255),e.setUint8(t+1,n>>>8&255),e.setUint8(t+2,n>>>16&255)):(e.setUint8(t,n>>>16&255),e.setUint8(t+1,n>>>8&255),e.setUint8(t+2,n&255))},EC=(e,t,n,r)=>{n=OC(n,-8388608,8388607),n<0&&(n=n+16777216&16777215),TC(e,t,n,r)},DC=(e,t)=>({async next(){let n=await e.next();return n.done?{value:void 0,done:!0}:{value:t(n.value),done:!1}},return(){return e.return()},throw(t){return e.throw(t)},[Symbol.asyncIterator](){return this}}),OC=(e,t,n)=>Math.max(t,Math.min(n,e)),kC=e=>{let t=Math.round(e);return Math.abs(e/t-1)<10*2**-52?t:e},AC=(e,t)=>Math.round(e/t)*t,jC=e=>{let t=0;for(;e;)t++,e>>=1;return t},MC=/^[a-z]{3}$/,NC=e=>MC.test(e),PC=1e6*(1+2**-52),FC=(e,t)=>{let n={...e,...t};if(e.headers||t.headers){let r=e.headers?IC(e.headers):{},i=t.headers?IC(t.headers):{},a={...r};Object.entries(i).forEach(([e,t])=>{let n=Object.keys(a).find(t=>t.toLowerCase()===e.toLowerCase());n&&delete a[n],a[e]=t}),n.headers=a}return n},IC=e=>{if(e instanceof Headers){let t={};return e.forEach((e,n)=>{t[n]=e}),t}if(Array.isArray(e)){let t={};return e.forEach(([e,n])=>{t[e]=n}),t}return e},LC=async(e,t,n,r,i)=>{let a=0;for(;;)try{return await e(t,n)}catch(e){if(i())throw e;a++;let n=r(a,e,t);if(n===null)throw e;if(console.error(`Retrying failed fetch. Error:`,e),!Number.isFinite(n)||n<0)throw TypeError(`Retry delay must be a non-negative finite number.`);if(n>0&&await new Promise(e=>setTimeout(e,1e3*n)),i())throw e}},RC=(e,t)=>{let n=e<0?-1:1;e=Math.abs(e);let r=0,i=1,a=1,o=0,s=e;for(;;){let e=Math.floor(s),c=e*a+r,l=e*o+i;if(l>t)return{numerator:n*a,denominator:o};if(r=a,i=o,a=c,o=l,s=1/(s-e),!isFinite(s))break}return{numerator:n*a,denominator:o}},zC=class{constructor(){this.currentPromise=Promise.resolve()}call(e){return this.currentPromise=this.currentPromise.then(e)}},BC=null,VC=()=>BC===null?BC=!!(typeof navigator<`u`&&(navigator.vendor?.match(/apple/i)||/AppleWebKit/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent))):BC,HC=null,UC=()=>HC===null?HC=typeof navigator<`u`&&navigator.userAgent?.includes(`Firefox`):HC,WC=null,GC=()=>WC===null?WC=!!(typeof navigator<`u`&&(navigator.vendor?.includes(`Google Inc`)||/Chrome/.test(navigator.userAgent))):WC,KC=null,qC=()=>{if(KC!==null)return KC;if(typeof navigator>`u`)return null;let e=/\bChrome\/(\d+)/.exec(navigator.userAgent);return e?KC=Number(e[1]):null},JC=(e,t)=>e===-1?t:e,YC=(e,t,n,r)=>e<=r&&n<=t,XC=function*(e){for(let t in e){let n=e[t];n!==void 0&&(yield{key:t,value:n})}},ZC=e=>{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n},QC=()=>{Symbol.dispose??=Symbol(`Symbol.dispose`)},$C=e=>typeof e==`number`&&!Number.isNaN(e),ew=class{constructor(e,t){if(this.data=e,this.mimeType=t,!(e instanceof Uint8Array))throw TypeError(`data must be a Uint8Array.`);if(typeof t!=`string`)throw TypeError(`mimeType must be a string.`)}},tw=class{constructor(e,t,n,r){if(this.data=e,this.mimeType=t,this.name=n,this.description=r,!(e instanceof Uint8Array))throw TypeError(`data must be a Uint8Array.`);if(t!==void 0&&typeof t!=`string`)throw TypeError(`mimeType, when provided, must be a string.`);if(n!==void 0&&typeof n!=`string`)throw TypeError(`name, when provided, must be a string.`);if(r!==void 0&&typeof r!=`string`)throw TypeError(`description, when provided, must be a string.`)}},nw=e=>{if(!e||typeof e!=`object`)throw TypeError(`tags must be an object.`);if(e.title!==void 0&&typeof e.title!=`string`)throw TypeError(`tags.title, when provided, must be a string.`);if(e.description!==void 0&&typeof e.description!=`string`)throw TypeError(`tags.description, when provided, must be a string.`);if(e.artist!==void 0&&typeof e.artist!=`string`)throw TypeError(`tags.artist, when provided, must be a string.`);if(e.album!==void 0&&typeof e.album!=`string`)throw TypeError(`tags.album, when provided, must be a string.`);if(e.albumArtist!==void 0&&typeof e.albumArtist!=`string`)throw TypeError(`tags.albumArtist, when provided, must be a string.`);if(e.trackNumber!==void 0&&(!Number.isInteger(e.trackNumber)||e.trackNumber<=0))throw TypeError(`tags.trackNumber, when provided, must be a positive integer.`);if(e.tracksTotal!==void 0&&(!Number.isInteger(e.tracksTotal)||e.tracksTotal<=0))throw TypeError(`tags.tracksTotal, when provided, must be a positive integer.`);if(e.discNumber!==void 0&&(!Number.isInteger(e.discNumber)||e.discNumber<=0))throw TypeError(`tags.discNumber, when provided, must be a positive integer.`);if(e.discsTotal!==void 0&&(!Number.isInteger(e.discsTotal)||e.discsTotal<=0))throw TypeError(`tags.discsTotal, when provided, must be a positive integer.`);if(e.genre!==void 0&&typeof e.genre!=`string`)throw TypeError(`tags.genre, when provided, must be a string.`);if(e.date!==void 0&&(!(e.date instanceof Date)||Number.isNaN(e.date.getTime())))throw TypeError(`tags.date, when provided, must be a valid Date.`);if(e.lyrics!==void 0&&typeof e.lyrics!=`string`)throw TypeError(`tags.lyrics, when provided, must be a string.`);if(e.images!==void 0){if(!Array.isArray(e.images))throw TypeError(`tags.images, when provided, must be an array.`);for(let t of e.images){if(!t||typeof t!=`object`)throw TypeError(`Each image in tags.images must be an object.`);if(!(t.data instanceof Uint8Array))throw TypeError(`Each image.data must be a Uint8Array.`);if(typeof t.mimeType!=`string`)throw TypeError(`Each image.mimeType must be a string.`);if(![`coverFront`,`coverBack`,`unknown`].includes(t.kind))throw TypeError(`Each image.kind must be 'coverFront', 'coverBack', or 'unknown'.`)}}if(e.comment!==void 0&&typeof e.comment!=`string`)throw TypeError(`tags.comment, when provided, must be a string.`);if(e.raw!==void 0){if(!e.raw||typeof e.raw!=`object`)throw TypeError(`tags.raw, when provided, must be an object.`);for(let t of Object.values(e.raw))if(t!==null&&typeof t!=`string`&&!(t instanceof Uint8Array)&&!(t instanceof ew)&&!(t instanceof tw))throw TypeError(`Each value in tags.raw must be a string, Uint8Array, RichImageData, AttachedFile, or null.`)}},rw={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1},iw=e=>{if(!e||typeof e!=`object`)throw TypeError(`disposition must be an object.`);if(e.default!==void 0&&typeof e.default!=`boolean`)throw TypeError(`disposition.default must be a boolean.`);if(e.forced!==void 0&&typeof e.forced!=`boolean`)throw TypeError(`disposition.forced must be a boolean.`);if(e.original!==void 0&&typeof e.original!=`boolean`)throw TypeError(`disposition.original must be a boolean.`);if(e.commentary!==void 0&&typeof e.commentary!=`boolean`)throw TypeError(`disposition.commentary must be a boolean.`);if(e.hearingImpaired!==void 0&&typeof e.hearingImpaired!=`boolean`)throw TypeError(`disposition.hearingImpaired must be a boolean.`);if(e.visuallyImpaired!==void 0&&typeof e.visuallyImpaired!=`boolean`)throw TypeError(`disposition.visuallyImpaired must be a boolean.`)},aw=[`avc`,`hevc`,`vp9`,`av1`,`vp8`],ow=[`pcm-s16`,`pcm-s16be`,`pcm-s24`,`pcm-s24be`,`pcm-s32`,`pcm-s32be`,`pcm-f32`,`pcm-f32be`,`pcm-f64`,`pcm-f64be`,`pcm-u8`,`pcm-s8`,`ulaw`,`alaw`],sw=[`aac`,`opus`,`mp3`,`vorbis`,`flac`],cw=[...sw,...ow],lw=[`webvtt`],uw=[{maxMacroblocks:99,maxBitrate:64e3,level:10},{maxMacroblocks:396,maxBitrate:192e3,level:11},{maxMacroblocks:396,maxBitrate:384e3,level:12},{maxMacroblocks:396,maxBitrate:768e3,level:13},{maxMacroblocks:396,maxBitrate:2e6,level:20},{maxMacroblocks:792,maxBitrate:4e6,level:21},{maxMacroblocks:1620,maxBitrate:4e6,level:22},{maxMacroblocks:1620,maxBitrate:1e7,level:30},{maxMacroblocks:3600,maxBitrate:14e6,level:31},{maxMacroblocks:5120,maxBitrate:2e7,level:32},{maxMacroblocks:8192,maxBitrate:2e7,level:40},{maxMacroblocks:8192,maxBitrate:5e7,level:41},{maxMacroblocks:8704,maxBitrate:5e7,level:42},{maxMacroblocks:22080,maxBitrate:135e6,level:50},{maxMacroblocks:36864,maxBitrate:24e7,level:51},{maxMacroblocks:36864,maxBitrate:24e7,level:52},{maxMacroblocks:139264,maxBitrate:24e7,level:60},{maxMacroblocks:139264,maxBitrate:48e7,level:61},{maxMacroblocks:139264,maxBitrate:8e8,level:62}],dw=[{maxPictureSize:36864,maxBitrate:128e3,tier:`L`,level:30},{maxPictureSize:122880,maxBitrate:15e5,tier:`L`,level:60},{maxPictureSize:245760,maxBitrate:3e6,tier:`L`,level:63},{maxPictureSize:552960,maxBitrate:6e6,tier:`L`,level:90},{maxPictureSize:983040,maxBitrate:1e7,tier:`L`,level:93},{maxPictureSize:2228224,maxBitrate:12e6,tier:`L`,level:120},{maxPictureSize:2228224,maxBitrate:3e7,tier:`H`,level:120},{maxPictureSize:2228224,maxBitrate:2e7,tier:`L`,level:123},{maxPictureSize:2228224,maxBitrate:5e7,tier:`H`,level:123},{maxPictureSize:8912896,maxBitrate:25e6,tier:`L`,level:150},{maxPictureSize:8912896,maxBitrate:1e8,tier:`H`,level:150},{maxPictureSize:8912896,maxBitrate:4e7,tier:`L`,level:153},{maxPictureSize:8912896,maxBitrate:16e7,tier:`H`,level:153},{maxPictureSize:8912896,maxBitrate:6e7,tier:`L`,level:156},{maxPictureSize:8912896,maxBitrate:24e7,tier:`H`,level:156},{maxPictureSize:35651584,maxBitrate:6e7,tier:`L`,level:180},{maxPictureSize:35651584,maxBitrate:24e7,tier:`H`,level:180},{maxPictureSize:35651584,maxBitrate:12e7,tier:`L`,level:183},{maxPictureSize:35651584,maxBitrate:48e7,tier:`H`,level:183},{maxPictureSize:35651584,maxBitrate:24e7,tier:`L`,level:186},{maxPictureSize:35651584,maxBitrate:8e8,tier:`H`,level:186}],fw=[{maxPictureSize:36864,maxBitrate:2e5,level:10},{maxPictureSize:73728,maxBitrate:8e5,level:11},{maxPictureSize:122880,maxBitrate:18e5,level:20},{maxPictureSize:245760,maxBitrate:36e5,level:21},{maxPictureSize:552960,maxBitrate:72e5,level:30},{maxPictureSize:983040,maxBitrate:12e6,level:31},{maxPictureSize:2228224,maxBitrate:18e6,level:40},{maxPictureSize:2228224,maxBitrate:3e7,level:41},{maxPictureSize:8912896,maxBitrate:6e7,level:50},{maxPictureSize:8912896,maxBitrate:12e7,level:51},{maxPictureSize:8912896,maxBitrate:18e7,level:52},{maxPictureSize:35651584,maxBitrate:18e7,level:60},{maxPictureSize:35651584,maxBitrate:24e7,level:61},{maxPictureSize:35651584,maxBitrate:48e7,level:62}],pw=[{maxPictureSize:147456,maxBitrate:15e5,tier:`M`,level:0},{maxPictureSize:278784,maxBitrate:3e6,tier:`M`,level:1},{maxPictureSize:665856,maxBitrate:6e6,tier:`M`,level:4},{maxPictureSize:1065024,maxBitrate:1e7,tier:`M`,level:5},{maxPictureSize:2359296,maxBitrate:12e6,tier:`M`,level:8},{maxPictureSize:2359296,maxBitrate:3e7,tier:`H`,level:8},{maxPictureSize:2359296,maxBitrate:2e7,tier:`M`,level:9},{maxPictureSize:2359296,maxBitrate:5e7,tier:`H`,level:9},{maxPictureSize:8912896,maxBitrate:3e7,tier:`M`,level:12},{maxPictureSize:8912896,maxBitrate:1e8,tier:`H`,level:12},{maxPictureSize:8912896,maxBitrate:4e7,tier:`M`,level:13},{maxPictureSize:8912896,maxBitrate:16e7,tier:`H`,level:13},{maxPictureSize:8912896,maxBitrate:6e7,tier:`M`,level:14},{maxPictureSize:8912896,maxBitrate:24e7,tier:`H`,level:14},{maxPictureSize:35651584,maxBitrate:6e7,tier:`M`,level:15},{maxPictureSize:35651584,maxBitrate:24e7,tier:`H`,level:15},{maxPictureSize:35651584,maxBitrate:6e7,tier:`M`,level:16},{maxPictureSize:35651584,maxBitrate:24e7,tier:`H`,level:16},{maxPictureSize:35651584,maxBitrate:1e8,tier:`M`,level:17},{maxPictureSize:35651584,maxBitrate:48e7,tier:`H`,level:17},{maxPictureSize:35651584,maxBitrate:16e7,tier:`M`,level:18},{maxPictureSize:35651584,maxBitrate:8e8,tier:`H`,level:18},{maxPictureSize:35651584,maxBitrate:16e7,tier:`M`,level:19},{maxPictureSize:35651584,maxBitrate:8e8,tier:`H`,level:19}],mw=`.01.01.01.01.00`,hw=`.0.110.01.01.01.0`,gw=(e,t,n,r)=>{if(e===`avc`){let e=Math.ceil(t/16)*Math.ceil(n/16),i=uw.find(t=>e<=t.maxMacroblocks&&r<=t.maxBitrate)??JS(uw),a=i?i.level:0;return`avc1.${`64`.padStart(2,`0`)}00${a.toString(16).padStart(2,`0`)}`}else if(e===`hevc`){let e=t*n,i=dw.find(t=>e<=t.maxPictureSize&&r<=t.maxBitrate)??JS(dw);return`hev1.1.6.${i.tier}${i.level}.B0`}else if(e===`vp8`)return`vp8`;else if(e===`vp9`){let e=t*n;return`vp09.00.${(fw.find(t=>e<=t.maxPictureSize&&r<=t.maxBitrate)??JS(fw)).level.toString().padStart(2,`0`)}.08`}else if(e===`av1`){let e=t*n,i=pw.find(t=>e<=t.maxPictureSize&&r<=t.maxBitrate)??JS(pw);return`av01.0.${i.level.toString().padStart(2,`0`)}${i.tier}.08`}throw TypeError(`Unhandled codec '${e}'.`)},_w=e=>{let t=e.split(`.`),n=Number(t[1]),r=t[2],i=Number(r.slice(0,-1)),a=(n<<5)+i,o=+(r.slice(-1)===`H`),s=Number(t[3])===8?0:1,c=t[4]?Number(t[4]):0,l=t[5]?Number(t[5][0]):1,u=t[5]?Number(t[5][1]):1,d=t[5]?Number(t[5][2]):0;return[129,a,(o<<7)+(s<<6)+0+(c<<4)+(l<<3)+(u<<2)+d,0]},vw=e=>{let{codec:t,codecDescription:n,colorSpace:r,avcCodecInfo:i,hevcCodecInfo:a,vp9CodecInfo:o,av1CodecInfo:s}=e;if(t===`avc`){if(X(e.avcType!==null),i){let t=new Uint8Array([i.avcProfileIndication,i.profileCompatibility,i.avcLevelIndication]);return`avc${e.avcType}.${fC(t)}`}if(!n||n.byteLength<4)throw TypeError(`AVC decoder description is not provided or is not at least 4 bytes long.`);return`avc${e.avcType}.${fC(n.subarray(1,4))}`}else if(t===`hevc`){let e,t,r,i,o,s;if(a)e=a.generalProfileSpace,t=a.generalProfileIdc,r=pC(a.generalProfileCompatibilityFlags),i=a.generalTierFlag,o=a.generalLevelIdc,s=[...a.generalConstraintIndicatorFlags];else{if(!n||n.byteLength<23)throw TypeError(`HEVC decoder description is not provided or is not at least 23 bytes long.`);let a=$S(n),c=a.getUint8(1);e=c>>6&3,t=c&31,r=pC(a.getUint32(2)),i=c>>5&1,o=a.getUint8(12),s=[];for(let e=0;e<6;e++)s.push(a.getUint8(6+e))}let c=`hev1.`;for(c+=[``,`A`,`B`,`C`][e]+t,c+=`.`,c+=r.toString(16).toUpperCase(),c+=`.`,c+=i===0?`L`:`H`,c+=o;s.length>0&&s[s.length-1]===0;)s.pop();return s.length>0&&(c+=`.`,c+=s.map(e=>e.toString(16).toUpperCase()).join(`.`)),c}else if(t===`vp8`)return`vp8`;else if(t===`vp9`){if(!o){let t=e.width*e.height,n=JS(fw).level;for(let e of fw)if(t<=e.maxPictureSize){n=e.level;break}return`vp09.00.${n.toString().padStart(2,`0`)}.08`}let t=o.profile.toString().padStart(2,`0`),n=o.level.toString().padStart(2,`0`),r=o.bitDepth.toString().padStart(2,`0`),i=o.chromaSubsampling.toString().padStart(2,`0`),a=o.colourPrimaries.toString().padStart(2,`0`),s=o.transferCharacteristics.toString().padStart(2,`0`),c=o.matrixCoefficients.toString().padStart(2,`0`),l=o.videoFullRangeFlag.toString().padStart(2,`0`),u=`vp09.${t}.${n}.${r}.${i}`;return u+=`.${a}.${s}.${c}.${l}`,u.endsWith(mw)&&(u=u.slice(0,-15)),u}else if(t===`av1`){if(!s){let t=e.width*e.height,n=JS(fw).level;for(let e of fw)if(t<=e.maxPictureSize){n=e.level;break}return`av01.0.${n.toString().padStart(2,`0`)}M.08`}let t=s.profile,n=s.level.toString().padStart(2,`0`),i=s.tier?`H`:`M`,a=s.bitDepth.toString().padStart(2,`0`),o=s.monochrome?`1`:`0`,c=100*s.chromaSubsamplingX+10*s.chromaSubsamplingY+1*(s.chromaSubsamplingX&&s.chromaSubsamplingY?s.chromaSamplePosition:0),l=r?.primaries?rC[r.primaries]:1,u=r?.transfer?aC[r.transfer]:1,d=r?.matrix?sC[r.matrix]:1,f=+!!r?.fullRange,p=`av01.${t}.${n}${i}.${a}`;return p+=`.${o}.${c.toString().padStart(3,`0`)}`,p+=`.${l.toString().padStart(2,`0`)}`,p+=`.${u.toString().padStart(2,`0`)}`,p+=`.${d.toString().padStart(2,`0`)}`,p+=`.${f}`,p.endsWith(hw)&&(p=p.slice(0,-17)),p}throw TypeError(`Unhandled codec '${t}'.`)},yw=(e,t,n)=>{if(e===`aac`)return t>=2&&n<=24e3?`mp4a.40.29`:n<=24e3?`mp4a.40.5`:`mp4a.40.2`;if(e===`mp3`)return`mp3`;if(e===`opus`)return`opus`;if(e===`vorbis`)return`vorbis`;if(e===`flac`)return`flac`;if(ow.includes(e))return e;throw TypeError(`Unhandled codec '${e}'.`)},bw=e=>{let{codec:t,codecDescription:n,aacCodecInfo:r}=e;if(t===`aac`){if(!r)throw TypeError(`AAC codec info must be provided.`);return r.isMpeg2?`mp4a.67`:`mp4a.40.${Cw(n).objectType}`}else if(t===`mp3`)return`mp3`;else if(t===`opus`)return`opus`;else if(t===`vorbis`)return`vorbis`;else if(t===`flac`)return`flac`;else if(t&&ow.includes(t))return t;throw TypeError(`Unhandled codec '${t}'.`)},xw=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Sw=[-1,1,2,3,4,5,6,8],Cw=e=>{if(!e||e.byteLength<2)throw TypeError(`AAC description must be at least 2 bytes long.`);let t=new XS(e),n=t.readBits(5);n===31&&(n=32+t.readBits(6));let r=t.readBits(4),i=null;r===15?i=t.readBits(24):r<xw.length&&(i=xw[r]);let a=t.readBits(4),o=null;return a>=1&&a<=7&&(o=Sw[a]),{objectType:n,frequencyIndex:r,sampleRate:i,channelConfiguration:a,numberOfChannels:o}},ww=e=>{let t=xw.indexOf(e.sampleRate),n=null;t===-1&&(t=15,n=e.sampleRate);let r=Sw.indexOf(e.numberOfChannels);if(r===-1)throw TypeError(`Unsupported number of channels: ${e.numberOfChannels}`);let i=13;e.objectType>=32&&(i+=6),t===15&&(i+=24);let a=Math.ceil(i/8),o=new Uint8Array(a),s=new XS(o);return e.objectType<32?s.writeBits(5,e.objectType):(s.writeBits(5,31),s.writeBits(6,e.objectType-32)),s.writeBits(4,t),t===15&&s.writeBits(24,n),s.writeBits(4,r),o},Tw=48e3,Ew=/^pcm-([usf])(\d+)+(be)?$/,Dw=e=>{if(X(ow.includes(e)),e===`ulaw`)return{dataType:`ulaw`,sampleSize:1,littleEndian:!0,silentValue:255};if(e===`alaw`)return{dataType:`alaw`,sampleSize:1,littleEndian:!0,silentValue:213};let t=Ew.exec(e);X(t);let n;n=t[1]===`u`?`unsigned`:t[1]===`s`?`signed`:`float`;let r=Number(t[2])/8,i=t[3]!==`be`;return{dataType:n,sampleSize:r,littleEndian:i,silentValue:e===`pcm-u8`?2**7:0}},Ow=e=>e.startsWith(`avc1`)||e.startsWith(`avc3`)?`avc`:e.startsWith(`hev1`)||e.startsWith(`hvc1`)?`hevc`:e===`vp8`?`vp8`:e.startsWith(`vp09`)?`vp9`:e.startsWith(`av01`)?`av1`:e.startsWith(`mp4a.40`)||e===`mp4a.67`?`aac`:e===`mp3`||e===`mp4a.69`||e===`mp4a.6B`||e===`mp4a.6b`?`mp3`:e===`opus`?`opus`:e===`vorbis`?`vorbis`:e===`flac`?`flac`:e===`ulaw`?`ulaw`:e===`alaw`?`alaw`:Ew.test(e)?e:e===`webvtt`?`webvtt`:null,kw=e=>e===`avc`?{avc:{format:`avc`}}:e===`hevc`?{hevc:{format:`hevc`}}:{},Aw=e=>e===`aac`?{aac:{format:`aac`}}:e===`opus`?{opus:{format:`opus`}}:{},jw=[`avc1`,`avc3`,`hev1`,`hvc1`,`vp8`,`vp09`,`av01`],Mw=/^(avc1|avc3)\.[0-9a-fA-F]{6}$/,Nw=/^(hev1|hvc1)\.(?:[ABC]?\d+)\.[0-9a-fA-F]{1,8}\.[LH]\d+(?:\.[0-9a-fA-F]{1,2}){0,6}$/,Pw=/^vp09(?:\.\d{2}){3}(?:(?:\.\d{2}){5})?$/,Fw=/^av01\.\d\.\d{2}[MH]\.\d{2}(?:\.\d\.\d{3}\.\d{2}\.\d{2}\.\d{2}\.\d)?$/,Iw=e=>{if(!e)throw TypeError(`Video chunk metadata must be provided.`);if(typeof e!=`object`)throw TypeError(`Video chunk metadata must be an object.`);if(!e.decoderConfig)throw TypeError(`Video chunk metadata must include a decoder configuration.`);if(typeof e.decoderConfig!=`object`)throw TypeError(`Video chunk metadata decoder configuration must be an object.`);if(typeof e.decoderConfig.codec!=`string`)throw TypeError(`Video chunk metadata decoder configuration must specify a codec string.`);if(!jw.some(t=>e.decoderConfig.codec.startsWith(t)))throw TypeError(`Video chunk metadata decoder configuration codec string must be a valid video codec string as specified in the WebCodecs Codec Registry.`);if(!Number.isInteger(e.decoderConfig.codedWidth)||e.decoderConfig.codedWidth<=0)throw TypeError(`Video chunk metadata decoder configuration must specify a valid codedWidth (positive integer).`);if(!Number.isInteger(e.decoderConfig.codedHeight)||e.decoderConfig.codedHeight<=0)throw TypeError(`Video chunk metadata decoder configuration must specify a valid codedHeight (positive integer).`);if(e.decoderConfig.description!==void 0&&!uC(e.decoderConfig.description))throw TypeError(`Video chunk metadata decoder configuration description, when defined, must be an ArrayBuffer or an ArrayBuffer view.`);if(e.decoderConfig.colorSpace!==void 0){let{colorSpace:t}=e.decoderConfig;if(typeof t!=`object`)throw TypeError(`Video chunk metadata decoder configuration colorSpace, when provided, must be an object.`);let n=Object.keys(rC);if(t.primaries!=null&&!n.includes(t.primaries))throw TypeError(`Video chunk metadata decoder configuration colorSpace primaries, when defined, must be one of ${n.join(`, `)}.`);let r=Object.keys(aC);if(t.transfer!=null&&!r.includes(t.transfer))throw TypeError(`Video chunk metadata decoder configuration colorSpace transfer, when defined, must be one of ${r.join(`, `)}.`);let i=Object.keys(sC);if(t.matrix!=null&&!i.includes(t.matrix))throw TypeError(`Video chunk metadata decoder configuration colorSpace matrix, when defined, must be one of ${i.join(`, `)}.`);if(t.fullRange!=null&&typeof t.fullRange!=`boolean`)throw TypeError(`Video chunk metadata decoder configuration colorSpace fullRange, when defined, must be a boolean.`)}if(e.decoderConfig.codec.startsWith(`avc1`)||e.decoderConfig.codec.startsWith(`avc3`)){if(!Mw.test(e.decoderConfig.codec))throw TypeError(`Video chunk metadata decoder configuration codec string for AVC must be a valid AVC codec string as specified in Section 3.4 of RFC 6381.`)}else if(e.decoderConfig.codec.startsWith(`hev1`)||e.decoderConfig.codec.startsWith(`hvc1`)){if(!Nw.test(e.decoderConfig.codec))throw TypeError(`Video chunk metadata decoder configuration codec string for HEVC must be a valid HEVC codec string as specified in Section E.3 of ISO 14496-15.`)}else if(e.decoderConfig.codec.startsWith(`vp8`)){if(e.decoderConfig.codec!==`vp8`)throw TypeError(`Video chunk metadata decoder configuration codec string for VP8 must be "vp8".`)}else if(e.decoderConfig.codec.startsWith(`vp09`)){if(!Pw.test(e.decoderConfig.codec))throw TypeError(`Video chunk metadata decoder configuration codec string for VP9 must be a valid VP9 codec string as specified in Section "Codecs Parameter String" of https://www.webmproject.org/vp9/mp4/.`)}else if(e.decoderConfig.codec.startsWith(`av01`)&&!Fw.test(e.decoderConfig.codec))throw TypeError(`Video chunk metadata decoder configuration codec string for AV1 must be a valid AV1 codec string as specified in Section "Codecs Parameter String" of https://aomediacodec.github.io/av1-isobmff/.`)},Lw=[`mp4a`,`mp3`,`opus`,`vorbis`,`flac`,`ulaw`,`alaw`,`pcm`],Rw=e=>{if(!e)throw TypeError(`Audio chunk metadata must be provided.`);if(typeof e!=`object`)throw TypeError(`Audio chunk metadata must be an object.`);if(!e.decoderConfig)throw TypeError(`Audio chunk metadata must include a decoder configuration.`);if(typeof e.decoderConfig!=`object`)throw TypeError(`Audio chunk metadata decoder configuration must be an object.`);if(typeof e.decoderConfig.codec!=`string`)throw TypeError(`Audio chunk metadata decoder configuration must specify a codec string.`);if(!Lw.some(t=>e.decoderConfig.codec.startsWith(t)))throw TypeError(`Audio chunk metadata decoder configuration codec string must be a valid audio codec string as specified in the WebCodecs Codec Registry.`);if(!Number.isInteger(e.decoderConfig.sampleRate)||e.decoderConfig.sampleRate<=0)throw TypeError(`Audio chunk metadata decoder configuration must specify a valid sampleRate (positive integer).`);if(!Number.isInteger(e.decoderConfig.numberOfChannels)||e.decoderConfig.numberOfChannels<=0)throw TypeError(`Audio chunk metadata decoder configuration must specify a valid numberOfChannels (positive integer).`);if(e.decoderConfig.description!==void 0&&!uC(e.decoderConfig.description))throw TypeError(`Audio chunk metadata decoder configuration description, when defined, must be an ArrayBuffer or an ArrayBuffer view.`);if(e.decoderConfig.codec.startsWith(`mp4a`)&&e.decoderConfig.codec!==`mp4a.69`&&e.decoderConfig.codec!==`mp4a.6B`&&e.decoderConfig.codec!==`mp4a.6b`){if(![`mp4a.40.2`,`mp4a.40.02`,`mp4a.40.5`,`mp4a.40.05`,`mp4a.40.29`,`mp4a.67`].includes(e.decoderConfig.codec))throw TypeError(`Audio chunk metadata decoder configuration codec string for AAC must be a valid AAC codec string as specified in https://www.w3.org/TR/webcodecs-aac-codec-registration/.`);if(!e.decoderConfig.description)throw TypeError(`Audio chunk metadata decoder configuration for AAC must include a description, which is expected to be an AudioSpecificConfig as specified in ISO 14496-3.`)}else if(e.decoderConfig.codec.startsWith(`mp3`)||e.decoderConfig.codec.startsWith(`mp4a`)){if(e.decoderConfig.codec!==`mp3`&&e.decoderConfig.codec!==`mp4a.69`&&e.decoderConfig.codec!==`mp4a.6B`&&e.decoderConfig.codec!==`mp4a.6b`)throw TypeError(`Audio chunk metadata decoder configuration codec string for MP3 must be "mp3", "mp4a.69" or "mp4a.6B".`)}else if(e.decoderConfig.codec.startsWith(`opus`)){if(e.decoderConfig.codec!==`opus`)throw TypeError(`Audio chunk metadata decoder configuration codec string for Opus must be "opus".`);if(e.decoderConfig.description&&e.decoderConfig.description.byteLength<18)throw TypeError(`Audio chunk metadata decoder configuration description, when specified, is expected to be an Identification Header as specified in Section 5.1 of RFC 7845.`)}else if(e.decoderConfig.codec.startsWith(`vorbis`)){if(e.decoderConfig.codec!==`vorbis`)throw TypeError(`Audio chunk metadata decoder configuration codec string for Vorbis must be "vorbis".`);if(!e.decoderConfig.description)throw TypeError(`Audio chunk metadata decoder configuration for Vorbis must include a description, which is expected to adhere to the format described in https://www.w3.org/TR/webcodecs-vorbis-codec-registration/.`)}else if(e.decoderConfig.codec.startsWith(`flac`)){if(e.decoderConfig.codec!==`flac`)throw TypeError(`Audio chunk metadata decoder configuration codec string for FLAC must be "flac".`);if(!e.decoderConfig.description||e.decoderConfig.description.byteLength<42)throw TypeError(`Audio chunk metadata decoder configuration for FLAC must include a description, which is expected to adhere to the format described in https://www.w3.org/TR/webcodecs-flac-codec-registration/.`)}else if((e.decoderConfig.codec.startsWith(`pcm`)||e.decoderConfig.codec.startsWith(`ulaw`)||e.decoderConfig.codec.startsWith(`alaw`))&&!ow.includes(e.decoderConfig.codec))throw TypeError(`Audio chunk metadata decoder configuration codec string for PCM must be one of the supported PCM codecs (${ow.join(`, `)}).`)},zw=e=>{if(!e)throw TypeError(`Subtitle metadata must be provided.`);if(typeof e!=`object`)throw TypeError(`Subtitle metadata must be an object.`);if(!e.config)throw TypeError(`Subtitle metadata must include a config object.`);if(typeof e.config!=`object`)throw TypeError(`Subtitle metadata config must be an object.`);if(typeof e.config.description!=`string`)throw TypeError(`Subtitle metadata config description must be a string.`)},Bw;(function(e){e[e.IDR=5]=`IDR`,e[e.SEI=6]=`SEI`,e[e.SPS=7]=`SPS`,e[e.PPS=8]=`PPS`,e[e.SPS_EXT=13]=`SPS_EXT`})(Bw||={});var Vw;(function(e){e[e.RASL_N=8]=`RASL_N`,e[e.RASL_R=9]=`RASL_R`,e[e.BLA_W_LP=16]=`BLA_W_LP`,e[e.RSV_IRAP_VCL23=23]=`RSV_IRAP_VCL23`,e[e.VPS_NUT=32]=`VPS_NUT`,e[e.SPS_NUT=33]=`SPS_NUT`,e[e.PPS_NUT=34]=`PPS_NUT`,e[e.PREFIX_SEI_NUT=39]=`PREFIX_SEI_NUT`,e[e.SUFFIX_SEI_NUT=40]=`SUFFIX_SEI_NUT`})(Vw||={});var Hw=e=>{let t=[],n=0;for(;n<e.length;){let r=-1,i=0;for(let t=n;t<e.length-3;t++){if(e[t]===0&&e[t+1]===0&&e[t+2]===1){r=t,i=3;break}if(t<e.length-4&&e[t]===0&&e[t+1]===0&&e[t+2]===0&&e[t+3]===1){r=t,i=4;break}}if(r===-1)break;if(n>0&&r>n){let i=e.subarray(n,r);i.length>0&&t.push(i)}n=r+i}if(n<e.length){let r=e.subarray(n);r.length>0&&t.push(r)}return t},Uw=(e,t)=>{let n=[],r=0,i=new DataView(e.buffer,e.byteOffset,e.byteLength);for(;r+t<=e.length;){let a;t===1?a=i.getUint8(r):t===2?a=i.getUint16(r,!1):t===3?a=CC(i,r,!1):t===4?a=i.getUint32(r,!1):(SC(t),X(!1)),r+=t;let o=e.subarray(r,r+a);n.push(o),r+=a}return n},Ww=e=>{let t=[],n=e.length;for(let r=0;r<n;r++)r+2<n&&e[r]===0&&e[r+1]===0&&e[r+2]===3?(t.push(0,0),r+=2):t.push(e[r]);return new Uint8Array(t)},Gw=new Uint8Array([0,0,0,1]),Kw=e=>{let t=e.reduce((e,t)=>e+Gw.byteLength+t.byteLength,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(Gw,r),r+=Gw.byteLength,n.set(t,r),r+=t.byteLength;return n},qw=(e,t)=>{let n=e.reduce((e,n)=>e+t+n.byteLength,0),r=new Uint8Array(n),i=0;for(let n of e){let e=new DataView(r.buffer,r.byteOffset,r.byteLength);switch(t){case 1:e.setUint8(i,n.byteLength);break;case 2:e.setUint16(i,n.byteLength,!1);break;case 3:TC(e,i,n.byteLength,!1);break;case 4:e.setUint32(i,n.byteLength,!1);break}i+=t,r.set(n,i),i+=n.byteLength}return r},Jw=(e,t)=>t.description?Uw(e,(QS(t.description)[4]&3)+1):Hw(e),Yw=(e,t)=>t.description?qw(e,(QS(t.description)[4]&3)+1):Kw(e),Xw=e=>e[0]&31,Zw=e=>{try{let t=Hw(e),n=t.filter(e=>Xw(e)===Bw.SPS),r=t.filter(e=>Xw(e)===Bw.PPS),i=t.filter(e=>Xw(e)===Bw.SPS_EXT);if(n.length===0||r.length===0)return null;let a=n[0],o=eT(a);X(o!==null);let s=o.profileIdc===100||o.profileIdc===110||o.profileIdc===122||o.profileIdc===144;return{configurationVersion:1,avcProfileIndication:o.profileIdc,profileCompatibility:o.constraintFlags,avcLevelIndication:o.levelIdc,lengthSizeMinusOne:3,sequenceParameterSets:n,pictureParameterSets:r,chromaFormat:s?o.chromaFormatIdc:null,bitDepthLumaMinus8:s?o.bitDepthLumaMinus8:null,bitDepthChromaMinus8:s?o.bitDepthChromaMinus8:null,sequenceParameterSetExt:s?i:null}}catch(e){return console.error(`Error building AVC Decoder Configuration Record:`,e),null}},Qw=e=>{let t=[];t.push(e.configurationVersion),t.push(e.avcProfileIndication),t.push(e.profileCompatibility),t.push(e.avcLevelIndication),t.push(252|e.lengthSizeMinusOne&3),t.push(224|e.sequenceParameterSets.length&31);for(let n of e.sequenceParameterSets){let e=n.byteLength;t.push(e>>8),t.push(e&255);for(let r=0;r<e;r++)t.push(n[r])}t.push(e.pictureParameterSets.length);for(let n of e.pictureParameterSets){let e=n.byteLength;t.push(e>>8),t.push(e&255);for(let r=0;r<e;r++)t.push(n[r])}if(e.avcProfileIndication===100||e.avcProfileIndication===110||e.avcProfileIndication===122||e.avcProfileIndication===144){X(e.chromaFormat!==null),X(e.bitDepthLumaMinus8!==null),X(e.bitDepthChromaMinus8!==null),X(e.sequenceParameterSetExt!==null),t.push(252|e.chromaFormat&3),t.push(248|e.bitDepthLumaMinus8&7),t.push(248|e.bitDepthChromaMinus8&7),t.push(e.sequenceParameterSetExt.length);for(let n of e.sequenceParameterSetExt){let e=n.byteLength;t.push(e>>8),t.push(e&255);for(let r=0;r<e;r++)t.push(n[r])}}return new Uint8Array(t)},$w=e=>{try{let t=$S(e),n=0,r=t.getUint8(n++),i=t.getUint8(n++),a=t.getUint8(n++),o=t.getUint8(n++),s=t.getUint8(n++)&3,c=t.getUint8(n++)&31,l=[];for(let r=0;r<c;r++){let r=t.getUint16(n,!1);n+=2,l.push(e.subarray(n,n+r)),n+=r}let u=t.getUint8(n++),d=[];for(let r=0;r<u;r++){let r=t.getUint16(n,!1);n+=2,d.push(e.subarray(n,n+r)),n+=r}let f={configurationVersion:r,avcProfileIndication:i,profileCompatibility:a,avcLevelIndication:o,lengthSizeMinusOne:s,sequenceParameterSets:l,pictureParameterSets:d,chromaFormat:null,bitDepthLumaMinus8:null,bitDepthChromaMinus8:null,sequenceParameterSetExt:null};if((i===100||i===110||i===122||i===144)&&n+4<=e.length){let r=t.getUint8(n++)&3,i=t.getUint8(n++)&7,a=t.getUint8(n++)&7,o=t.getUint8(n++);f.chromaFormat=r,f.bitDepthLumaMinus8=i,f.bitDepthChromaMinus8=a;let s=[];for(let r=0;r<o;r++){let r=t.getUint16(n,!1);n+=2,s.push(e.subarray(n,n+r)),n+=r}f.sequenceParameterSetExt=s}return f}catch(e){return console.error(`Error deserializing AVC Decoder Configuration Record:`,e),null}},eT=e=>{try{let t=new XS(Ww(e));if(t.skipBits(1),t.skipBits(2),t.readBits(5)!==7)return null;let n=t.readAlignedByte(),r=t.readAlignedByte(),i=t.readAlignedByte();Z(t);let a=null,o=null,s=null;if((n===100||n===110||n===122||n===244||n===44||n===83||n===86||n===118||n===128)&&(a=Z(t),a===3&&t.skipBits(1),o=Z(t),s=Z(t),t.skipBits(1),t.readBits(1))){for(let e=0;e<(a===3?12:8);e++)if(t.readBits(1)){let n=e<6?16:64,r=8,i=8;for(let e=0;e<n;e++){if(i!==0){let e=ZS(t);i=(r+e+256)%256}r=i===0?r:i}}}Z(t);let c=Z(t);if(c===0)Z(t);else if(c===1){t.skipBits(1),ZS(t),ZS(t);let e=Z(t);for(let n=0;n<e;n++)ZS(t)}return Z(t),t.skipBits(1),Z(t),Z(t),{profileIdc:n,constraintFlags:r,levelIdc:i,frameMbsOnlyFlag:t.readBits(1),chromaFormatIdc:a,bitDepthLumaMinus8:o,bitDepthChromaMinus8:s}}catch(e){return console.error(`Error parsing AVC SPS:`,e),null}},tT=(e,t)=>t.description?Uw(e,(QS(t.description)[21]&3)+1):Hw(e),nT=e=>e[0]>>1&63,rT=e=>{try{let t=Hw(e),n=t.filter(e=>nT(e)===Vw.VPS_NUT),r=t.filter(e=>nT(e)===Vw.SPS_NUT),i=t.filter(e=>nT(e)===Vw.PPS_NUT),a=t.filter(e=>nT(e)===Vw.PREFIX_SEI_NUT||nT(e)===Vw.SUFFIX_SEI_NUT);if(r.length===0||i.length===0)return null;let o=r[0],s=new XS(Ww(o));s.skipBits(16),s.readBits(4);let c=s.readBits(3),l=s.readBits(1),{general_profile_space:u,general_tier_flag:d,general_profile_idc:f,general_profile_compatibility_flags:p,general_constraint_indicator_flags:m,general_level_idc:h}=iT(s,c);Z(s);let g=Z(s);g===3&&s.skipBits(1),Z(s),Z(s),s.readBits(1)&&(Z(s),Z(s),Z(s),Z(s));let _=Z(s),v=Z(s);Z(s);let y=s.readBits(1)?0:c;for(let e=y;e<=c;e++)Z(s),Z(s),Z(s);if(Z(s),Z(s),Z(s),Z(s),Z(s),Z(s),s.readBits(1)&&s.readBits(1)&&aT(s),s.skipBits(1),s.skipBits(1),s.readBits(1)&&(s.skipBits(4),s.skipBits(4),Z(s),Z(s),s.skipBits(1)),oT(s,Z(s)),s.readBits(1)){let e=Z(s);for(let t=0;t<e;t++)Z(s),s.skipBits(1)}s.skipBits(1),s.skipBits(1);let b=0;s.readBits(1)&&(b=cT(s,c));let x=0;if(i.length>0){let e=i[0],t=new XS(Ww(e));t.skipBits(16),Z(t),Z(t),t.skipBits(1),t.skipBits(1),t.skipBits(3),t.skipBits(1),t.skipBits(1),Z(t),Z(t),ZS(t),t.skipBits(1),t.skipBits(1),t.readBits(1)&&Z(t),ZS(t),ZS(t),t.skipBits(1),t.skipBits(1),t.skipBits(1),t.skipBits(1);let n=t.readBits(1),r=t.readBits(1);x=!n&&!r?0:n&&!r?2:!n&&r?3:0}let S=[...n.length?[{arrayCompleteness:1,nalUnitType:Vw.VPS_NUT,nalUnits:n}]:[],...r.length?[{arrayCompleteness:1,nalUnitType:Vw.SPS_NUT,nalUnits:r}]:[],...i.length?[{arrayCompleteness:1,nalUnitType:Vw.PPS_NUT,nalUnits:i}]:[],...a.length?[{arrayCompleteness:1,nalUnitType:nT(a[0]),nalUnits:a}]:[]];return{configurationVersion:1,generalProfileSpace:u,generalTierFlag:d,generalProfileIdc:f,generalProfileCompatibilityFlags:p,generalConstraintIndicatorFlags:m,generalLevelIdc:h,minSpatialSegmentationIdc:b,parallelismType:x,chromaFormatIdc:g,bitDepthLumaMinus8:_,bitDepthChromaMinus8:v,avgFrameRate:0,constantFrameRate:0,numTemporalLayers:c+1,temporalIdNested:l,lengthSizeMinusOne:3,arrays:S}}catch(e){return console.error(`Error building HEVC Decoder Configuration Record:`,e),null}},iT=(e,t)=>{let n=e.readBits(2),r=e.readBits(1),i=e.readBits(5),a=0;for(let t=0;t<32;t++)a=a<<1|e.readBits(1);let o=new Uint8Array(6);for(let t=0;t<6;t++)o[t]=e.readBits(8);let s=e.readBits(8),c=[],l=[];for(let n=0;n<t;n++)c.push(e.readBits(1)),l.push(e.readBits(1));if(t>0)for(let n=t;n<8;n++)e.skipBits(2);for(let n=0;n<t;n++)c[n]&&e.skipBits(88),l[n]&&e.skipBits(8);return{general_profile_space:n,general_tier_flag:r,general_profile_idc:i,general_profile_compatibility_flags:a,general_constraint_indicator_flags:o,general_level_idc:s}},aT=e=>{for(let t=0;t<4;t++)for(let n=0;n<(t===3?2:6);n++)if(!e.readBits(1))Z(e);else{let n=Math.min(64,1<<4+(t<<1));t>1&&ZS(e);for(let t=0;t<n;t++)ZS(e)}},oT=(e,t)=>{let n=[];for(let r=0;r<t;r++)n[r]=sT(e,r,t,n)},sT=(e,t,n,r)=>{let i=0,a=0,o=0;if(t!==0&&(a=e.readBits(1)),a){o=t===n?t-(Z(e)+1):t-1,e.readBits(1),Z(e);let a=r[o]??0;for(let t=0;t<=a;t++)e.readBits(1)||e.readBits(1);i=r[o]}else{let t=Z(e),n=Z(e);for(let n=0;n<t;n++)Z(e),e.readBits(1);for(let t=0;t<n;t++)Z(e),e.readBits(1);i=t+n}return i},cT=(e,t)=>{if(e.readBits(1)&&e.readBits(8)===255&&(e.readBits(16),e.readBits(16)),e.readBits(1)&&e.readBits(1),e.readBits(1)&&(e.readBits(3),e.readBits(1),e.readBits(1)&&(e.readBits(8),e.readBits(8),e.readBits(8))),e.readBits(1)&&(Z(e),Z(e)),e.readBits(1),e.readBits(1),e.readBits(1),e.readBits(1)&&(Z(e),Z(e),Z(e),Z(e)),e.readBits(1)&&(e.readBits(32),e.readBits(32),e.readBits(1)&&Z(e),e.readBits(1)&&lT(e,!0,t)),e.readBits(1)){e.readBits(1),e.readBits(1),e.readBits(1);let t=Z(e);return Z(e),Z(e),Z(e),Z(e),t}return 0},lT=(e,t,n)=>{let r=!1,i=!1,a=!1;t&&(r=e.readBits(1)===1,i=e.readBits(1)===1,(r||i)&&(a=e.readBits(1)===1,a&&(e.readBits(8),e.readBits(5),e.readBits(1),e.readBits(5)),e.readBits(4),e.readBits(4),a&&e.readBits(4),e.readBits(5),e.readBits(5),e.readBits(5)));for(let t=0;t<=n;t++){let t=e.readBits(1)===1,n=!0;t||(n=e.readBits(1)===1);let o=!1;n?Z(e):o=e.readBits(1)===1;let s=1;o||(s=Z(e)+1),r&&uT(e,s,a),i&&uT(e,s,a)}},uT=(e,t,n)=>{for(let r=0;r<t;r++)Z(e),Z(e),n&&(Z(e),Z(e)),e.readBits(1)},dT=e=>{let t=[];t.push(e.configurationVersion),t.push((e.generalProfileSpace&3)<<6|(e.generalTierFlag&1)<<5|e.generalProfileIdc&31),t.push(e.generalProfileCompatibilityFlags>>>24&255),t.push(e.generalProfileCompatibilityFlags>>>16&255),t.push(e.generalProfileCompatibilityFlags>>>8&255),t.push(e.generalProfileCompatibilityFlags&255),t.push(...e.generalConstraintIndicatorFlags),t.push(e.generalLevelIdc&255),t.push(240|e.minSpatialSegmentationIdc>>8&15),t.push(e.minSpatialSegmentationIdc&255),t.push(252|e.parallelismType&3),t.push(252|e.chromaFormatIdc&3),t.push(248|e.bitDepthLumaMinus8&7),t.push(248|e.bitDepthChromaMinus8&7),t.push(e.avgFrameRate>>8&255),t.push(e.avgFrameRate&255),t.push((e.constantFrameRate&3)<<6|(e.numTemporalLayers&7)<<3|(e.temporalIdNested&1)<<2|e.lengthSizeMinusOne&3),t.push(e.arrays.length&255);for(let n of e.arrays){t.push((n.arrayCompleteness&1)<<7|0|n.nalUnitType&63),t.push(n.nalUnits.length>>8&255),t.push(n.nalUnits.length&255);for(let e of n.nalUnits){t.push(e.length>>8&255),t.push(e.length&255);for(let n=0;n<e.length;n++)t.push(e[n])}}return new Uint8Array(t)},fT=e=>{let t=new XS(e);if(t.readBits(2)!==2)return null;let n=t.readBits(1),r=(t.readBits(1)<<1)+n;if(r===3&&t.skipBits(1),t.readBits(1)===1||t.readBits(1)!==0||(t.skipBits(2),t.readBits(24)!==4817730))return null;let i=8;r>=2&&(i=t.readBits(1)?12:10);let a=t.readBits(3),o=0,s=0;if(a!==7)if(s=t.readBits(1),r===1||r===3){let e=t.readBits(1),n=t.readBits(1);o=!e&&!n?3:e&&!n?2:1,t.skipBits(1)}else o=1;else o=3,s=1;let c=t.readBits(16),l=t.readBits(16),u=(c+1)*(l+1),d=JS(fw).level;for(let e of fw)if(u<=e.maxPictureSize){d=e.level;break}return{profile:r,level:d,bitDepth:i,chromaSubsampling:o,videoFullRangeFlag:s,colourPrimaries:a===2?1:a===1?6:2,transferCharacteristics:a===2?1:a===1?6:2,matrixCoefficients:a===7?0:a===2?1:a===1?6:2}},pT=function*(e){let t=new XS(e),n=()=>{let e=0;for(let n=0;n<8;n++){let r=t.readAlignedByte();if(e|=(r&127)<<n*7,!(r&128))break;if(n===7&&r&128)return null}return e>=2**32-1?null:e};for(;t.getBitsLeft()>=8;){t.skipBits(1);let r=t.readBits(4),i=t.readBits(1),a=t.readBits(1);t.skipBits(1),i&&t.skipBits(8);let o;if(a){let e=n();if(e===null)return;o=e}else o=Math.floor(t.getBitsLeft()/8);X(t.pos%8==0),yield{type:r,data:e.subarray(t.pos/8,t.pos/8+o)},t.skipBits(o*8)}},mT=e=>{for(let{type:t,data:n}of pT(e)){if(t!==1)continue;let e=new XS(n),r=e.readBits(3);e.readBits(1);let i=e.readBits(1),a=0,o=0,s=0;if(i)a=e.readBits(5);else{if(e.readBits(1)&&(e.skipBits(32),e.skipBits(32),e.readBits(1)))return null;let t=e.readBits(1);t&&(s=e.readBits(5),e.skipBits(32),e.skipBits(5),e.skipBits(5));let n=e.readBits(5);for(let r=0;r<=n;r++){e.skipBits(12);let n=e.readBits(5);if(r===0&&(a=n),n>7){let t=e.readBits(1);r===0&&(o=t)}if(t&&e.readBits(1)){let t=s+1;e.skipBits(t),e.skipBits(t),e.skipBits(1)}e.readBits(1)&&e.skipBits(4)}}let c=e.readBits(4),l=e.readBits(4),u=c+1;e.skipBits(u);let d=l+1;e.skipBits(d);let f=0;if(f=i?0:e.readBits(1),f&&(e.skipBits(4),e.skipBits(3)),e.skipBits(1),e.skipBits(1),e.skipBits(1),!i){e.skipBits(1),e.skipBits(1),e.skipBits(1),e.skipBits(1);let t=e.readBits(1);t&&(e.skipBits(1),e.skipBits(1));let n=e.readBits(1),r=0;r=n?2:e.readBits(1),r>0&&(e.readBits(1)||e.skipBits(1)),t&&e.skipBits(3)}e.skipBits(1),e.skipBits(1),e.skipBits(1);let p=e.readBits(1),m=8;r===2&&p?m=e.readBits(1)?12:10:r<=2&&(m=p?10:8);let h=0;r!==1&&(h=e.readBits(1));let g=1,_=1,v=0;return h||(r===0?(g=1,_=1):r===1?(g=0,_=0):m===12&&(g=e.readBits(1),g&&(_=e.readBits(1))),g&&_&&(v=e.readBits(2))),{profile:r,level:a,tier:o,bitDepth:m,monochrome:h,chromaSubsamplingX:g,chromaSubsamplingY:_,chromaSamplePosition:v}}return null},hT=e=>{let t=$S(e),n=t.getUint8(9),r=t.getUint16(10,!0),i=t.getUint32(12,!0),a=t.getInt16(16,!0),o=t.getUint8(18),s=null;return o&&(s=e.subarray(19,21+n)),{outputChannelCount:n,preSkip:r,inputSampleRate:i,outputGain:a,channelMappingFamily:o,channelMappingTable:s}},gT=[480,960,1920,2880,480,960,1920,2880,480,960,1920,2880,480,960,480,960,120,240,480,960,120,240,480,960,120,240,480,960,120,240,480,960],_T=e=>({durationInSamples:gT[e[0]>>3]}),vT=e=>{if(e.length<7)throw Error(`Setup header is too short.`);if(e[0]!==5)throw Error(`Wrong packet type in Setup header.`);if(String.fromCharCode(...e.slice(1,7))!==`vorbis`)throw Error(`Invalid packet signature in Setup header.`);let t=e.length,n=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];let r=new XS(n),i=0;for(;r.getBitsLeft()>97;)if(r.readBits(1)===1){i=r.pos;break}if(i===0)throw Error(`Invalid Setup header: framing bit not found.`);let a=0,o=!1,s=0;for(;r.getBitsLeft()>=97;){let e=r.pos,t=r.readBits(8),n=r.readBits(16),i=r.readBits(16);if(t>63||n!==0||i!==0){r.pos=e;break}if(r.skipBits(1),a++,a>64)break;r.clone().readBits(6)+1===a&&(o=!0,s=a)}if(!o)throw Error(`Invalid Setup header: mode header not found.`);if(s>63)throw Error(`Unsupported mode count: ${s}.`);let c=s;r.pos=0,r.skipBits(i);let l=Array(c).fill(0);for(let e=c-1;e>=0;e--)r.skipBits(40),l[e]=r.readBits(1);return{modeBlockflags:l}},yT=(e,t,n)=>{switch(e){case`avc`:{let e=Jw(n,t),r=e.some(e=>Xw(e)===Bw.IDR);if(!r&&(!GC()||qC()>=144))for(let t of e){if(Xw(t)!==Bw.SEI)continue;let e=Ww(t),n=1;do{let t=0;for(;;){let r=e[n++];if(r===void 0||(t+=r,r<255))break}let i=0;for(;;){let t=e[n++];if(t===void 0||(i+=t,t<255))break}if(t===6){let t=new XS(e);t.pos=8*n;let i=Z(t),a=t.readBits(1);if(i===0&&a===1){r=!0;break}}n+=i}while(n<e.length-1)}return r?`key`:`delta`}case`hevc`:return tT(n,t).some(e=>{let t=nT(e);return Vw.BLA_W_LP<=t&&t<=Vw.RSV_IRAP_VCL23})?`key`:`delta`;case`vp8`:return n[0]&1?`delta`:`key`;case`vp9`:{let e=new XS(n);if(e.readBits(2)!==2)return null;let t=e.readBits(1);return(e.readBits(1)<<1)+t===3&&e.skipBits(1),e.readBits(1)?null:e.readBits(1)===0?`key`:`delta`}case`av1`:{let e=!1;for(let{type:t,data:r}of pT(n))if(t===1){let t=new XS(r);t.skipBits(4),e=!!t.readBits(1)}else if(t===3||t===6||t===7){if(e)return`key`;let t=new XS(r);return t.readBits(1)?null:t.readBits(2)===0?`key`:`delta`}return null}default:SC(e),X(!1)}},bT;(function(e){e[e.STREAMINFO=0]=`STREAMINFO`,e[e.VORBIS_COMMENT=4]=`VORBIS_COMMENT`,e[e.PICTURE=6]=`PICTURE`})(bT||={});var xT=(e,t)=>{let n=$S(e),r=0,i=n.getUint32(r,!0);r+=4;let a=eC.decode(e.subarray(r,r+i));r+=i,i>0&&(t.raw??={},t.raw.vendor??=a);let o=n.getUint32(r,!0);r+=4;for(let i=0;i<o;i++){let i=n.getUint32(r,!0);r+=4;let a=eC.decode(e.subarray(r,r+i));r+=i;let o=a.indexOf(`=`);if(o===-1)continue;let s=a.slice(0,o).toUpperCase(),c=a.slice(o+1);switch(t.raw??={},t.raw[s]??=c,s){case`TITLE`:t.title??=c;break;case`DESCRIPTION`:t.description??=c;break;case`ARTIST`:t.artist??=c;break;case`ALBUM`:t.album??=c;break;case`ALBUMARTIST`:t.albumArtist??=c;break;case`COMMENT`:t.comment??=c;break;case`LYRICS`:t.lyrics??=c;break;case`TRACKNUMBER`:{let e=c.split(`/`),n=Number.parseInt(e[0],10),r=e[1]&&Number.parseInt(e[1],10);Number.isInteger(n)&&n>0&&(t.trackNumber??=n),r&&Number.isInteger(r)&&r>0&&(t.tracksTotal??=r)}break;case`TRACKTOTAL`:{let e=Number.parseInt(c,10);Number.isInteger(e)&&e>0&&(t.tracksTotal??=e)}break;case`DISCNUMBER`:{let e=c.split(`/`),n=Number.parseInt(e[0],10),r=e[1]&&Number.parseInt(e[1],10);Number.isInteger(n)&&n>0&&(t.discNumber??=n),r&&Number.isInteger(r)&&r>0&&(t.discsTotal??=r)}break;case`DISCTOTAL`:{let e=Number.parseInt(c,10);Number.isInteger(e)&&e>0&&(t.discsTotal??=e)}break;case`DATE`:{let e=new Date(c);Number.isNaN(e.getTime())||(t.date??=e)}break;case`GENRE`:t.genre??=c;break;case`METADATA_BLOCK_PICTURE`:{let e=ZC(c),n=$S(e),r=n.getUint32(0,!1),i=n.getUint32(4,!1),a=String.fromCharCode(...e.subarray(8,8+i)),o=n.getUint32(8+i,!1),s=eC.decode(e.subarray(12+i,12+i+o)),l=n.getUint32(i+o+28),u=e.subarray(i+o+32,i+o+32+l);t.images??=[],t.images.push({data:u,mimeType:a,kind:r===3?`coverFront`:r===4?`coverBack`:`unknown`,name:void 0,description:s||void 0})}break}}},ST=class{constructor(e){this.input=e}},CT=[],wT=[],TT=[],ET=[],DT=new Uint8Array,OT=class e{constructor(e,t,n,r,i=-1,a,o){if(this.data=e,this.type=t,this.timestamp=n,this.duration=r,this.sequenceNumber=i,e===DT&&a===void 0)throw Error(`Internal error: byteLength must be explicitly provided when constructing metadata-only packets.`);if(a===void 0&&(a=e.byteLength),!(e instanceof Uint8Array))throw TypeError(`data must be a Uint8Array.`);if(t!==`key`&&t!==`delta`)throw TypeError(`type must be either "key" or "delta".`);if(!Number.isFinite(n))throw TypeError(`timestamp must be a number.`);if(!Number.isFinite(r)||r<0)throw TypeError(`duration must be a non-negative number.`);if(!Number.isFinite(i))throw TypeError(`sequenceNumber must be a number.`);if(!Number.isInteger(a)||a<0)throw TypeError(`byteLength must be a non-negative integer.`);if(o!==void 0&&(typeof o!=`object`||!o))throw TypeError(`sideData, when provided, must be an object.`);if(o?.alpha!==void 0&&!(o.alpha instanceof Uint8Array))throw TypeError(`sideData.alpha, when provided, must be a Uint8Array.`);if(o?.alphaByteLength!==void 0&&(!Number.isInteger(o.alphaByteLength)||o.alphaByteLength<0))throw TypeError(`sideData.alphaByteLength, when provided, must be a non-negative integer.`);this.byteLength=a,this.sideData=o??{},this.sideData.alpha&&this.sideData.alphaByteLength===void 0&&(this.sideData.alphaByteLength=this.sideData.alpha.byteLength)}get isMetadataOnly(){return this.data===DT}get microsecondTimestamp(){return Math.trunc(PC*this.timestamp)}get microsecondDuration(){return Math.trunc(PC*this.duration)}toEncodedVideoChunk(){if(this.isMetadataOnly)throw TypeError(`Metadata-only packets cannot be converted to a video chunk.`);if(typeof EncodedVideoChunk>`u`)throw Error(`Your browser does not support EncodedVideoChunk.`);return new EncodedVideoChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}alphaToEncodedVideoChunk(e=this.type){if(!this.sideData.alpha)throw TypeError(`This packet does not contain alpha side data.`);if(this.isMetadataOnly)throw TypeError(`Metadata-only packets cannot be converted to a video chunk.`);if(typeof EncodedVideoChunk>`u`)throw Error(`Your browser does not support EncodedVideoChunk.`);return new EncodedVideoChunk({data:this.sideData.alpha,type:e,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}toEncodedAudioChunk(){if(this.isMetadataOnly)throw TypeError(`Metadata-only packets cannot be converted to an audio chunk.`);if(typeof EncodedAudioChunk>`u`)throw Error(`Your browser does not support EncodedAudioChunk.`);return new EncodedAudioChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}static fromEncodedChunk(t,n){if(!(t instanceof EncodedVideoChunk||t instanceof EncodedAudioChunk))throw TypeError(`chunk must be an EncodedVideoChunk or EncodedAudioChunk.`);let r=new Uint8Array(t.byteLength);return t.copyTo(r),new e(r,t.type,t.timestamp/1e6,(t.duration??0)/1e6,void 0,void 0,n)}clone(t){if(t!==void 0&&(typeof t!=`object`||!t))throw TypeError(`options, when provided, must be an object.`);if(t?.timestamp!==void 0&&!Number.isFinite(t.timestamp))throw TypeError(`options.timestamp, when provided, must be a number.`);if(t?.duration!==void 0&&!Number.isFinite(t.duration))throw TypeError(`options.duration, when provided, must be a number.`);return new e(this.data,this.type,t?.timestamp??this.timestamp,t?.duration??this.duration,this.sequenceNumber,this.byteLength)}},kT=e=>{let t=8191,n=e,r=4096,i=0,a=12,o=0;for(n<0&&(n=-n,i=128),n+=33,n>t&&(n=t);(n&r)!==r&&a>=5;)r>>=1,a--;return o=n>>a-4&15,~(i|a-5<<4|o)&255},AT=e=>{let t=0,n=0,r=~e;r&128&&(r&=-129,t=-1),n=((r&240)>>4)+5;let i=(1<<n|(r&15)<<n-4|1<<n-5)-33;return t===0?i:-i},jT=e=>{let t=4095,n=2048,r=0,i=11,a=0,o=e;for(o<0&&(o=-o,r=128),o>t&&(o=t);(o&n)!==n&&i>=5;)n>>=1,i--;return a=o>>(i===4?1:i-4)&15,(r|i-4<<4|a)^85},MT=e=>{let t=0,n=0,r=e^85;r&128&&(r&=-129,t=-1),n=((r&240)>>4)+4;let i=0;return i=n===4?r<<1|1:1<<n|(r&15)<<n-4|1<<n-5,t===0?i:-i};QC();var NT=-1/0,PT=-1/0,FT=null;typeof FinalizationRegistry<`u`&&(FT=new FinalizationRegistry(e=>{let t=Date.now();e.type===`video`?(t-NT>=1e3&&(console.error(`A VideoSample was garbage collected without first being closed. For proper resource management, make sure to call close() on all your VideoSamples as soon as you're done using them.`),NT=t),typeof VideoFrame<`u`&&e.data instanceof VideoFrame&&e.data.close()):(t-PT>=1e3&&(console.error(`An AudioSample was garbage collected without first being closed. For proper resource management, make sure to call close() on all your AudioSamples as soon as you're done using them.`),PT=t),typeof AudioData<`u`&&e.data instanceof AudioData&&e.data.close())}));var IT=[`I420`,`I420P10`,`I420P12`,`I420A`,`I420AP10`,`I420AP12`,`I422`,`I422P10`,`I422P12`,`I422A`,`I422AP10`,`I422AP12`,`I444`,`I444P10`,`I444P12`,`I444A`,`I444AP10`,`I444AP12`,`NV12`,`RGBA`,`RGBX`,`BGRA`,`BGRX`],LT=new Set(IT),RT=class e{get displayWidth(){return this.rotation%180==0?this.codedWidth:this.codedHeight}get displayHeight(){return this.rotation%180==0?this.codedHeight:this.codedWidth}get microsecondTimestamp(){return Math.trunc(PC*this.timestamp)}get microsecondDuration(){return Math.trunc(PC*this.duration)}get hasAlpha(){return this.format&&this.format.includes(`A`)}constructor(t,n){if(this._closed=!1,t instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&t instanceof SharedArrayBuffer||ArrayBuffer.isView(t)){if(!n||typeof n!=`object`)throw TypeError(`init must be an object.`);if(n.format===void 0||!LT.has(n.format))throw TypeError(`init.format must be one of: `+IT.join(`, `));if(!Number.isInteger(n.codedWidth)||n.codedWidth<=0)throw TypeError(`init.codedWidth must be a positive integer.`);if(!Number.isInteger(n.codedHeight)||n.codedHeight<=0)throw TypeError(`init.codedHeight must be a positive integer.`);if(n.rotation!==void 0&&![0,90,180,270].includes(n.rotation))throw TypeError(`init.rotation, when provided, must be 0, 90, 180, or 270.`);if(!Number.isFinite(n.timestamp))throw TypeError(`init.timestamp must be a number.`);if(n.duration!==void 0&&(!Number.isFinite(n.duration)||n.duration<0))throw TypeError(`init.duration, when provided, must be a non-negative number.`);this._data=QS(t).slice(),this._layout=n.layout??WT(n.format,n.codedWidth,n.codedHeight),this.format=n.format,this.codedWidth=n.codedWidth,this.codedHeight=n.codedHeight,this.rotation=n.rotation??0,this.timestamp=n.timestamp,this.duration=n.duration??0,this.colorSpace=new zT(n.colorSpace)}else if(typeof VideoFrame<`u`&&t instanceof VideoFrame){if(n?.rotation!==void 0&&![0,90,180,270].includes(n.rotation))throw TypeError(`init.rotation, when provided, must be 0, 90, 180, or 270.`);if(n?.timestamp!==void 0&&!Number.isFinite(n?.timestamp))throw TypeError(`init.timestamp, when provided, must be a number.`);if(n?.duration!==void 0&&(!Number.isFinite(n.duration)||n.duration<0))throw TypeError(`init.duration, when provided, must be a non-negative number.`);this._data=t,this._layout=null,this.format=t.format,this.codedWidth=t.displayWidth,this.codedHeight=t.displayHeight,this.rotation=n?.rotation??0,this.timestamp=n?.timestamp??t.timestamp/1e6,this.duration=n?.duration??(t.duration??0)/1e6,this.colorSpace=new zT(t.colorSpace)}else if(typeof HTMLImageElement<`u`&&t instanceof HTMLImageElement||typeof SVGImageElement<`u`&&t instanceof SVGImageElement||typeof ImageBitmap<`u`&&t instanceof ImageBitmap||typeof HTMLVideoElement<`u`&&t instanceof HTMLVideoElement||typeof HTMLCanvasElement<`u`&&t instanceof HTMLCanvasElement||typeof OffscreenCanvas<`u`&&t instanceof OffscreenCanvas){if(!n||typeof n!=`object`)throw TypeError(`init must be an object.`);if(n.rotation!==void 0&&![0,90,180,270].includes(n.rotation))throw TypeError(`init.rotation, when provided, must be 0, 90, 180, or 270.`);if(!Number.isFinite(n.timestamp))throw TypeError(`init.timestamp must be a number.`);if(n.duration!==void 0&&(!Number.isFinite(n.duration)||n.duration<0))throw TypeError(`init.duration, when provided, must be a non-negative number.`);if(typeof VideoFrame<`u`)return new e(new VideoFrame(t,{timestamp:Math.trunc(n.timestamp*PC),duration:Math.trunc((n.duration??0)*PC)||void 0}),n);let r=0,i=0;if(`naturalWidth`in t?(r=t.naturalWidth,i=t.naturalHeight):`videoWidth`in t?(r=t.videoWidth,i=t.videoHeight):`width`in t&&(r=Number(t.width),i=Number(t.height)),!r||!i)throw TypeError(`Could not determine dimensions.`);let a=new OffscreenCanvas(r,i),o=a.getContext(`2d`,{alpha:UC(),willReadFrequently:!0});X(o),o.drawImage(t,0,0),this._data=a,this._layout=null,this.format=`RGBX`,this.codedWidth=r,this.codedHeight=i,this.rotation=n.rotation??0,this.timestamp=n.timestamp,this.duration=n.duration??0,this.colorSpace=new zT({matrix:`rgb`,primaries:`bt709`,transfer:`iec61966-2-1`,fullRange:!0})}else throw TypeError(`Invalid data type: Must be a BufferSource or CanvasImageSource.`);FT?.register(this,{type:`video`,data:this._data},this)}clone(){if(this._closed)throw Error(`VideoSample is closed.`);return X(this._data!==null),BT(this._data)?new e(this._data.clone(),{timestamp:this.timestamp,duration:this.duration,rotation:this.rotation}):this._data instanceof Uint8Array?(X(this._layout),new e(this._data,{format:this.format,layout:this._layout,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.timestamp,duration:this.duration,colorSpace:this.colorSpace,rotation:this.rotation})):new e(this._data,{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.timestamp,duration:this.duration,colorSpace:this.colorSpace,rotation:this.rotation})}close(){this._closed||=(FT?.unregister(this),BT(this._data)?this._data.close():this._data=null,!0)}allocationSize(e={}){if(UT(e),this._closed)throw Error(`VideoSample is closed.`);if((e.format??this.format)===null)throw Error(`Cannot get allocation size when format is null. Please manually provide an RGB pixel format in the options instead.`);if(X(this._data!==null),!BT(this._data)&&(e.colorSpace||e.format&&e.format!==this.format||e.layout||e.rect)){let t=this.toVideoFrame(),n=t.allocationSize(e);return t.close(),n}return BT(this._data)?this._data.allocationSize(e):this._data instanceof Uint8Array?this._data.byteLength:this.codedWidth*this.codedHeight*4}async copyTo(e,t={}){if(!uC(e))throw TypeError(`destination must be an ArrayBuffer or an ArrayBuffer view.`);if(UT(t),this._closed)throw Error(`VideoSample is closed.`);if((t.format??this.format)===null)throw Error(`Cannot copy video sample data when format is null. Please manually provide an RGB pixel format in the options instead.`);if(X(this._data!==null),!BT(this._data)&&(t.colorSpace||t.format&&t.format!==this.format||t.layout||t.rect)){let n=this.toVideoFrame(),r=await n.copyTo(e,t);return n.close(),r}if(BT(this._data))return this._data.copyTo(e,t);if(this._data instanceof Uint8Array)return X(this._layout),QS(e).set(this._data),this._layout;{let t=this._data.getContext(`2d`);X(t);let n=t.getImageData(0,0,this.codedWidth,this.codedHeight);return QS(e).set(n.data),[{offset:0,stride:4*this.codedWidth}]}}toVideoFrame(){if(this._closed)throw Error(`VideoSample is closed.`);return X(this._data!==null),BT(this._data)?new VideoFrame(this._data,{timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0}):this._data instanceof Uint8Array?new VideoFrame(this._data,{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0,colorSpace:this.colorSpace}):new VideoFrame(this._data,{timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0})}draw(e,t,n,r,i,a,o,s,c){let l=0,u=0,d=this.displayWidth,f=this.displayHeight,p=0,m=0,h=this.displayWidth,g=this.displayHeight;if(a===void 0?(p=t,m=n,r!==void 0&&(h=r,g=i)):(l=t,u=n,d=r,f=i,p=a,m=o,s===void 0?(h=d,g=f):(h=s,g=c)),!(typeof CanvasRenderingContext2D<`u`&&e instanceof CanvasRenderingContext2D||typeof OffscreenCanvasRenderingContext2D<`u`&&e instanceof OffscreenCanvasRenderingContext2D))throw TypeError(`context must be a CanvasRenderingContext2D or OffscreenCanvasRenderingContext2D.`);if(!Number.isFinite(l))throw TypeError(`sx must be a number.`);if(!Number.isFinite(u))throw TypeError(`sy must be a number.`);if(!Number.isFinite(d)||d<0)throw TypeError(`sWidth must be a non-negative number.`);if(!Number.isFinite(f)||f<0)throw TypeError(`sHeight must be a non-negative number.`);if(!Number.isFinite(p))throw TypeError(`dx must be a number.`);if(!Number.isFinite(m))throw TypeError(`dy must be a number.`);if(!Number.isFinite(h)||h<0)throw TypeError(`dWidth must be a non-negative number.`);if(!Number.isFinite(g)||g<0)throw TypeError(`dHeight must be a non-negative number.`);if(this._closed)throw Error(`VideoSample is closed.`);({sx:l,sy:u,sWidth:d,sHeight:f}=this._rotateSourceRegion(l,u,d,f,this.rotation));let _=this.toCanvasImageSource();e.save();let v=p+h/2,y=m+g/2;e.translate(v,y),e.rotate(this.rotation*Math.PI/180);let b=this.rotation%180==0?1:h/g;e.scale(1/b,b),e.drawImage(_,l,u,d,f,-h/2,-g/2,h,g),e.restore()}drawWithFit(e,t){if(!(typeof CanvasRenderingContext2D<`u`&&e instanceof CanvasRenderingContext2D||typeof OffscreenCanvasRenderingContext2D<`u`&&e instanceof OffscreenCanvasRenderingContext2D))throw TypeError(`context must be a CanvasRenderingContext2D or OffscreenCanvasRenderingContext2D.`);if(!t||typeof t!=`object`)throw TypeError(`options must be an object.`);if(![`fill`,`contain`,`cover`].includes(t.fit))throw TypeError(`options.fit must be 'fill', 'contain', or 'cover'.`);if(t.rotation!==void 0&&![0,90,180,270].includes(t.rotation))throw TypeError(`options.rotation, when provided, must be 0, 90, 180, or 270.`);t.crop!==void 0&&HT(t.crop,`options.`);let n=e.canvas.width,r=e.canvas.height,i=t.rotation??this.rotation,[a,o]=i%180==0?[this.codedWidth,this.codedHeight]:[this.codedHeight,this.codedWidth];t.crop&&VT(t.crop,a,o);let s,c,l,u,{sx:d,sy:f,sWidth:p,sHeight:m}=this._rotateSourceRegion(t.crop?.left??0,t.crop?.top??0,t.crop?.width??a,t.crop?.height??o,i);if(t.fit===`fill`)s=0,c=0,l=n,u=r;else{let[e,i]=t.crop?[t.crop.width,t.crop.height]:[a,o],d=t.fit===`contain`?Math.min(n/e,r/i):Math.max(n/e,r/i);l=e*d,u=i*d,s=(n-l)/2,c=(r-u)/2}e.save();let h=i%180==0?1:l/u;e.translate(n/2,r/2),e.rotate(i*Math.PI/180),e.scale(1/h,h),e.translate(-n/2,-r/2),e.drawImage(this.toCanvasImageSource(),d,f,p,m,s,c,l,u),e.restore()}_rotateSourceRegion(e,t,n,r,i){return i===90?[e,t,n,r]=[t,this.codedHeight-e-n,r,n]:i===180?[e,t]=[this.codedWidth-e-n,this.codedHeight-t-r]:i===270&&([e,t,n,r]=[this.codedWidth-t-r,e,r,n]),{sx:e,sy:t,sWidth:n,sHeight:r}}toCanvasImageSource(){if(this._closed)throw Error(`VideoSample is closed.`);if(X(this._data!==null),this._data instanceof Uint8Array){let e=this.toVideoFrame();return queueMicrotask(()=>e.close()),e}else return this._data}setRotation(e){if(![0,90,180,270].includes(e))throw TypeError(`newRotation must be 0, 90, 180, or 270.`);this.rotation=e}setTimestamp(e){if(!Number.isFinite(e))throw TypeError(`newTimestamp must be a number.`);this.timestamp=e}setDuration(e){if(!Number.isFinite(e)||e<0)throw TypeError(`newDuration must be a non-negative number.`);this.duration=e}[Symbol.dispose](){this.close()}},zT=class{constructor(e){this.primaries=e?.primaries??null,this.transfer=e?.transfer??null,this.matrix=e?.matrix??null,this.fullRange=e?.fullRange??null}toJSON(){return{primaries:this.primaries,transfer:this.transfer,matrix:this.matrix,fullRange:this.fullRange}}},BT=e=>typeof VideoFrame<`u`&&e instanceof VideoFrame,VT=(e,t,n)=>{e.left=Math.min(e.left,t),e.top=Math.min(e.top,n),e.width=Math.min(e.width,t-e.left),e.height=Math.min(e.height,n-e.top),X(e.width>=0),X(e.height>=0)},HT=(e,t)=>{if(!e||typeof e!=`object`)throw TypeError(t+`crop, when provided, must be an object.`);if(!Number.isInteger(e.left)||e.left<0)throw TypeError(t+`crop.left must be a non-negative integer.`);if(!Number.isInteger(e.top)||e.top<0)throw TypeError(t+`crop.top must be a non-negative integer.`);if(!Number.isInteger(e.width)||e.width<0)throw TypeError(t+`crop.width must be a non-negative integer.`);if(!Number.isInteger(e.height)||e.height<0)throw TypeError(t+`crop.height must be a non-negative integer.`)},UT=e=>{if(!e||typeof e!=`object`)throw TypeError(`options must be an object.`);if(e.colorSpace!==void 0&&![`display-p3`,`srgb`].includes(e.colorSpace))throw TypeError(`options.colorSpace, when provided, must be 'display-p3' or 'srgb'.`);if(e.format!==void 0&&typeof e.format!=`string`)throw TypeError(`options.format, when provided, must be a string.`);if(e.layout!==void 0){if(!Array.isArray(e.layout))throw TypeError(`options.layout, when provided, must be an array.`);for(let t of e.layout){if(!t||typeof t!=`object`)throw TypeError(`Each entry in options.layout must be an object.`);if(!Number.isInteger(t.offset)||t.offset<0)throw TypeError(`plane.offset must be a non-negative integer.`);if(!Number.isInteger(t.stride)||t.stride<0)throw TypeError(`plane.stride must be a non-negative integer.`)}}if(e.rect!==void 0){if(!e.rect||typeof e.rect!=`object`)throw TypeError(`options.rect, when provided, must be an object.`);if(e.rect.x!==void 0&&(!Number.isInteger(e.rect.x)||e.rect.x<0))throw TypeError(`options.rect.x, when provided, must be a non-negative integer.`);if(e.rect.y!==void 0&&(!Number.isInteger(e.rect.y)||e.rect.y<0))throw TypeError(`options.rect.y, when provided, must be a non-negative integer.`);if(e.rect.width!==void 0&&(!Number.isInteger(e.rect.width)||e.rect.width<0))throw TypeError(`options.rect.width, when provided, must be a non-negative integer.`);if(e.rect.height!==void 0&&(!Number.isInteger(e.rect.height)||e.rect.height<0))throw TypeError(`options.rect.height, when provided, must be a non-negative integer.`)}},WT=(e,t,n)=>{let r=GT(e),i=[],a=0;for(let e of r){let r=Math.ceil(t/e.widthDivisor),o=Math.ceil(n/e.heightDivisor),s=r*e.sampleBytes,c=s*o;i.push({offset:a,stride:s}),a+=c}return i},GT=e=>{let t=(e,t,n,r,i)=>{let a=[{sampleBytes:e,widthDivisor:1,heightDivisor:1},{sampleBytes:t,widthDivisor:n,heightDivisor:r},{sampleBytes:t,widthDivisor:n,heightDivisor:r}];return i&&a.push({sampleBytes:e,widthDivisor:1,heightDivisor:1}),a};switch(e){case`I420`:return t(1,1,2,2,!1);case`I420P10`:case`I420P12`:return t(2,2,2,2,!1);case`I420A`:return t(1,1,2,2,!0);case`I420AP10`:case`I420AP12`:return t(2,2,2,2,!0);case`I422`:return t(1,1,2,1,!1);case`I422P10`:case`I422P12`:return t(2,2,2,1,!1);case`I422A`:return t(1,1,2,1,!0);case`I422AP10`:case`I422AP12`:return t(2,2,2,1,!0);case`I444`:return t(1,1,1,1,!1);case`I444P10`:case`I444P12`:return t(2,2,1,1,!1);case`I444A`:return t(1,1,1,1,!0);case`I444AP10`:case`I444AP12`:return t(2,2,1,1,!0);case`NV12`:return[{sampleBytes:1,widthDivisor:1,heightDivisor:1},{sampleBytes:2,widthDivisor:2,heightDivisor:2}];case`RGBA`:case`RGBX`:case`BGRA`:case`BGRX`:return[{sampleBytes:4,widthDivisor:1,heightDivisor:1}];default:SC(e),X(!1)}},KT=new Set([`f32`,`f32-planar`,`s16`,`s16-planar`,`s32`,`s32-planar`,`u8`,`u8-planar`]),qT=class e{get microsecondTimestamp(){return Math.trunc(PC*this.timestamp)}get microsecondDuration(){return Math.trunc(PC*this.duration)}constructor(e){if(this._closed=!1,QT(e)){if(e.format===null)throw TypeError(`AudioData with null format is not supported.`);this._data=e,this.format=e.format,this.sampleRate=e.sampleRate,this.numberOfFrames=e.numberOfFrames,this.numberOfChannels=e.numberOfChannels,this.timestamp=e.timestamp/1e6,this.duration=e.numberOfFrames/e.sampleRate}else{if(!e||typeof e!=`object`)throw TypeError(`Invalid AudioDataInit: must be an object.`);if(!KT.has(e.format))throw TypeError(`Invalid AudioDataInit: invalid format.`);if(!Number.isFinite(e.sampleRate)||e.sampleRate<=0)throw TypeError(`Invalid AudioDataInit: sampleRate must be > 0.`);if(!Number.isInteger(e.numberOfChannels)||e.numberOfChannels===0)throw TypeError(`Invalid AudioDataInit: numberOfChannels must be an integer > 0.`);if(!Number.isFinite(e?.timestamp))throw TypeError(`init.timestamp must be a number.`);let t=e.data.byteLength/(JT(e.format)*e.numberOfChannels);if(!Number.isInteger(t))throw TypeError(`Invalid AudioDataInit: data size is not a multiple of frame size.`);this.format=e.format,this.sampleRate=e.sampleRate,this.numberOfFrames=t,this.numberOfChannels=e.numberOfChannels,this.timestamp=e.timestamp,this.duration=t/e.sampleRate;let n;if(e.data instanceof ArrayBuffer)n=new Uint8Array(e.data);else if(ArrayBuffer.isView(e.data))n=new Uint8Array(e.data.buffer,e.data.byteOffset,e.data.byteLength);else throw TypeError(`Invalid AudioDataInit: data is not a BufferSource.`);let r=this.numberOfFrames*this.numberOfChannels*JT(this.format);if(n.byteLength<r)throw TypeError(`Invalid AudioDataInit: insufficient data size.`);this._data=n}FT?.register(this,{type:`audio`,data:this._data},this)}allocationSize(e){if(!e||typeof e!=`object`)throw TypeError(`options must be an object.`);if(!Number.isInteger(e.planeIndex)||e.planeIndex<0)throw TypeError(`planeIndex must be a non-negative integer.`);if(e.format!==void 0&&!KT.has(e.format))throw TypeError(`Invalid format.`);if(e.frameOffset!==void 0&&(!Number.isInteger(e.frameOffset)||e.frameOffset<0))throw TypeError(`frameOffset must be a non-negative integer.`);if(e.frameCount!==void 0&&(!Number.isInteger(e.frameCount)||e.frameCount<0))throw TypeError(`frameCount must be a non-negative integer.`);if(this._closed)throw Error(`AudioSample is closed.`);let t=e.format??this.format,n=e.frameOffset??0;if(n>=this.numberOfFrames)throw RangeError(`frameOffset out of range`);let r=e.frameCount===void 0?this.numberOfFrames-n:e.frameCount;if(r>this.numberOfFrames-n)throw RangeError(`frameCount out of range`);let i=JT(t),a=YT(t);if(a&&e.planeIndex>=this.numberOfChannels||!a&&e.planeIndex!==0)throw RangeError(`planeIndex out of range`);return(a?r:r*this.numberOfChannels)*i}copyTo(e,t){if(!uC(e))throw TypeError(`destination must be an ArrayBuffer or an ArrayBuffer view.`);if(!t||typeof t!=`object`)throw TypeError(`options must be an object.`);if(!Number.isInteger(t.planeIndex)||t.planeIndex<0)throw TypeError(`planeIndex must be a non-negative integer.`);if(t.format!==void 0&&!KT.has(t.format))throw TypeError(`Invalid format.`);if(t.frameOffset!==void 0&&(!Number.isInteger(t.frameOffset)||t.frameOffset<0))throw TypeError(`frameOffset must be a non-negative integer.`);if(t.frameCount!==void 0&&(!Number.isInteger(t.frameCount)||t.frameCount<0))throw TypeError(`frameCount must be a non-negative integer.`);if(this._closed)throw Error(`AudioSample is closed.`);let{planeIndex:n,format:r,frameCount:i,frameOffset:a}=t,o=this.format,s=r??this.format;if(!s)throw Error(`Destination format not determined`);let c=this.numberOfFrames,l=this.numberOfChannels,u=a??0;if(u>=c)throw RangeError(`frameOffset out of range`);let d=i===void 0?c-u:i;if(d>c-u)throw RangeError(`frameCount out of range`);let f=JT(s),p=YT(s);if(p&&n>=l||!p&&n!==0)throw RangeError(`planeIndex out of range`);let m=(p?d:d*l)*f;if(e.byteLength<m)throw RangeError(`Destination buffer is too small`);let h=$S(e),g=ZT(s);if(QT(this._data))VC()&&l>2&&s!==o?$T(this._data,h,o,s,l,n,u,d):this._data.copyTo(e,{planeIndex:n,frameOffset:u,frameCount:d,format:s});else{let e=this._data,t=$S(e),r=XT(o),i=JT(o),a=YT(o);for(let e=0;e<d;e++)if(p){let o=e*f,s;s=a?(n*c+(e+u))*i:((e+u)*l+n)*i,g(h,o,r(t,s))}else for(let n=0;n<l;n++){let o=(e*l+n)*f,s;s=a?(n*c+(e+u))*i:((e+u)*l+n)*i,g(h,o,r(t,s))}}}clone(){if(this._closed)throw Error(`AudioSample is closed.`);if(QT(this._data)){let t=new e(this._data.clone());return t.setTimestamp(this.timestamp),t}else return new e({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.timestamp,data:this._data})}close(){this._closed||=(FT?.unregister(this),QT(this._data)?this._data.close():this._data=new Uint8Array,!0)}toAudioData(){if(this._closed)throw Error(`AudioSample is closed.`);if(QT(this._data)){if(this._data.timestamp===this.microsecondTimestamp)return this._data.clone();if(YT(this.format)){let e=this.allocationSize({planeIndex:0,format:this.format}),t=new ArrayBuffer(e*this.numberOfChannels);for(let n=0;n<this.numberOfChannels;n++)this.copyTo(new Uint8Array(t,n*e,e),{planeIndex:n,format:this.format});return new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:t})}else{let e=new ArrayBuffer(this.allocationSize({planeIndex:0,format:this.format}));return this.copyTo(e,{planeIndex:0,format:this.format}),new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:e})}}else return new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:this._data.buffer instanceof ArrayBuffer?this._data.buffer:this._data.slice()})}toAudioBuffer(){if(this._closed)throw Error(`AudioSample is closed.`);let e=new AudioBuffer({numberOfChannels:this.numberOfChannels,length:this.numberOfFrames,sampleRate:this.sampleRate}),t=new Float32Array(this.allocationSize({planeIndex:0,format:`f32-planar`})/4);for(let n=0;n<this.numberOfChannels;n++)this.copyTo(t,{planeIndex:n,format:`f32-planar`}),e.copyToChannel(t,n);return e}setTimestamp(e){if(!Number.isFinite(e))throw TypeError(`newTimestamp must be a number.`);this.timestamp=e}[Symbol.dispose](){this.close()}static*_fromAudioBuffer(t,n){if(!(t instanceof AudioBuffer))throw TypeError(`audioBuffer must be an AudioBuffer.`);let r=t.numberOfChannels,i=t.sampleRate,a=t.length,o=Math.floor(24e4/r),s=0,c=a;for(;c>0;){let a=Math.min(o,c),l=new Float32Array(r*a);for(let e=0;e<r;e++)t.copyFromChannel(l.subarray(e*a,(e+1)*a),e,s);yield new e({format:`f32-planar`,sampleRate:i,numberOfFrames:a,numberOfChannels:r,timestamp:n+s/i,data:l}),s+=a,c-=a}}static fromAudioBuffer(t,n){if(!(t instanceof AudioBuffer))throw TypeError(`audioBuffer must be an AudioBuffer.`);let r=t.numberOfChannels,i=t.sampleRate,a=t.length,o=Math.floor(24e4/r),s=0,c=a,l=[];for(;c>0;){let a=Math.min(o,c),u=new Float32Array(r*a);for(let e=0;e<r;e++)t.copyFromChannel(u.subarray(e*a,(e+1)*a),e,s);let d=new e({format:`f32-planar`,sampleRate:i,numberOfFrames:a,numberOfChannels:r,timestamp:n+s/i,data:u});l.push(d),s+=a,c-=a}return l}},JT=e=>{switch(e){case`u8`:case`u8-planar`:return 1;case`s16`:case`s16-planar`:return 2;case`s32`:case`s32-planar`:return 4;case`f32`:case`f32-planar`:return 4;default:throw Error(`Unknown AudioSampleFormat`)}},YT=e=>{switch(e){case`u8-planar`:case`s16-planar`:case`s32-planar`:case`f32-planar`:return!0;default:return!1}},XT=e=>{switch(e){case`u8`:case`u8-planar`:return(e,t)=>(e.getUint8(t)-128)/128;case`s16`:case`s16-planar`:return(e,t)=>e.getInt16(t,!0)/32768;case`s32`:case`s32-planar`:return(e,t)=>e.getInt32(t,!0)/2147483648;case`f32`:case`f32-planar`:return(e,t)=>e.getFloat32(t,!0)}},ZT=e=>{switch(e){case`u8`:case`u8-planar`:return(e,t,n)=>e.setUint8(t,OC((n+1)*127.5,0,255));case`s16`:case`s16-planar`:return(e,t,n)=>e.setInt16(t,OC(Math.round(n*32767),-32768,32767),!0);case`s32`:case`s32-planar`:return(e,t,n)=>e.setInt32(t,OC(Math.round(n*2147483647),-2147483648,2147483647),!0);case`f32`:case`f32-planar`:return(e,t,n)=>e.setFloat32(t,n,!0)}},QT=e=>typeof AudioData<`u`&&e instanceof AudioData,$T=(e,t,n,r,i,a,o,s)=>{let c=XT(n),l=ZT(r),u=JT(n),d=JT(r),f=YT(n);if(YT(r))if(f){let r=new ArrayBuffer(s*u),i=$S(r);e.copyTo(r,{planeIndex:a,frameOffset:o,frameCount:s,format:n});for(let e=0;e<s;e++){let n=e*u;l(t,e*d,c(i,n))}}else{let r=new ArrayBuffer(s*i*u),f=$S(r);e.copyTo(r,{planeIndex:0,frameOffset:o,frameCount:s,format:n});for(let e=0;e<s;e++){let n=(e*i+a)*u;l(t,e*d,c(f,n))}}else if(f){let r=s*u,a=new ArrayBuffer(r),f=$S(a);for(let r=0;r<i;r++){e.copyTo(a,{planeIndex:r,frameOffset:o,frameCount:s,format:n});for(let e=0;e<s;e++){let n=e*u;l(t,(e*i+r)*d,c(f,n))}}}else{let r=new ArrayBuffer(s*i*u),a=$S(r);e.copyTo(r,{planeIndex:0,frameOffset:o,frameCount:s,format:n});for(let e=0;e<s;e++)for(let n=0;n<i;n++){let r=e*i+n,o=r*u;l(t,r*d,c(a,o))}}},eE=e=>{if(!e||typeof e!=`object`)throw TypeError(`options must be an object.`);if(e.metadataOnly!==void 0&&typeof e.metadataOnly!=`boolean`)throw TypeError(`options.metadataOnly, when defined, must be a boolean.`);if(e.verifyKeyPackets!==void 0&&typeof e.verifyKeyPackets!=`boolean`)throw TypeError(`options.verifyKeyPackets, when defined, must be a boolean.`);if(e.verifyKeyPackets&&e.metadataOnly)throw TypeError(`options.verifyKeyPackets and options.metadataOnly cannot be enabled together.`)},tE=e=>{if(!$C(e))throw TypeError(`timestamp must be a number.`)},nE=(e,t,n)=>n.verifyKeyPackets?t.then(async t=>{if(!t||t.type===`delta`)return t;let n=await e.determinePacketType(t);return n&&(t.type=n),t}):t,rE=class{constructor(e){if(!(e instanceof hE))throw TypeError(`track must be an InputTrack.`);this._track=e}getFirstPacket(e={}){if(eE(e),this._track.input._disposed)throw new hO;return nE(this._track,this._track._backing.getFirstPacket(e),e)}getPacket(e,t={}){if(tE(e),eE(t),this._track.input._disposed)throw new hO;return nE(this._track,this._track._backing.getPacket(e,t),t)}getNextPacket(e,t={}){if(!(e instanceof OT))throw TypeError(`packet must be an EncodedPacket.`);if(eE(t),this._track.input._disposed)throw new hO;return nE(this._track,this._track._backing.getNextPacket(e,t),t)}async getKeyPacket(e,t={}){if(tE(e),eE(t),this._track.input._disposed)throw new hO;if(!t.verifyKeyPackets)return this._track._backing.getKeyPacket(e,t);let n=await this._track._backing.getKeyPacket(e,t);return n&&(X(n.type===`key`),await this._track.determinePacketType(n)===`delta`?this.getKeyPacket(n.timestamp-1/this._track.timeResolution,t):n)}async getNextKeyPacket(e,t={}){if(!(e instanceof OT))throw TypeError(`packet must be an EncodedPacket.`);if(eE(t),this._track.input._disposed)throw new hO;if(!t.verifyKeyPackets)return this._track._backing.getNextKeyPacket(e,t);let n=await this._track._backing.getNextKeyPacket(e,t);return n&&(X(n.type===`key`),await this._track.determinePacketType(n)===`delta`?this.getNextKeyPacket(n,t):n)}packets(e,t,n={}){if(e!==void 0&&!(e instanceof OT))throw TypeError(`startPacket must be an EncodedPacket.`);if(e!==void 0&&e.isMetadataOnly&&!n?.metadataOnly)throw TypeError(`startPacket can only be metadata-only if options.metadataOnly is enabled.`);if(t!==void 0&&!(t instanceof OT))throw TypeError(`endPacket must be an EncodedPacket.`);if(eE(n),this._track.input._disposed)throw new hO;let r=[],{promise:i,resolve:a}=_C(),{promise:o,resolve:s}=_C(),c=!1,l=!1,u=null,d=[],f=()=>Math.max(2,d.length);(async()=>{let u=e??await this.getFirstPacket(n);for(;u&&!l&&!this._track.input._disposed&&!(t&&u.sequenceNumber>=t?.sequenceNumber);){if(r.length>f()){({promise:o,resolve:s}=_C()),await o;continue}r.push(u),a(),{promise:i,resolve:a}=_C(),u=await this.getNextPacket(u,n)}c=!0,a()})().catch(e=>{u||(u=e,a())});let p=this._track;return{async next(){for(;;)if(p.input._disposed)throw new hO;else if(l)return{value:void 0,done:!0};else if(u)throw u;else if(r.length>0){let e=r.shift(),t=performance.now();for(d.push(t);d.length>0&&t-d[0]>=1e3;)d.shift();return s(),{value:e,done:!1}}else if(c)return{value:void 0,done:!0};else await i},async return(){return l=!0,s(),a(),{value:void 0,done:!0}},async throw(e){throw e},[Symbol.asyncIterator](){return this}}}},iE=class{constructor(e,t){this.onSample=e,this.onError=t}},aE=class{mediaSamplesInRange(e=0,t=1/0){tE(e),tE(t);let n=[],r=!1,i=null,{promise:a,resolve:o}=_C(),{promise:s,resolve:c}=_C(),l=!1,u=!1,d=!1,f=null;(async()=>{let p=await this._createDecoder(s=>{if(c(),s.timestamp>=t&&(u=!0),u){s.close();return}i&&(s.timestamp>e?(n.push(i),r=!0):i.close()),s.timestamp>=e&&(n.push(s),r=!0),i=r?null:s,n.length>0&&(o(),{promise:a,resolve:o}=_C())},e=>{f||(f=e,o())}),m=this._createPacketSink(),h=await m.getKeyPacket(e,{verifyKeyPackets:!0})??await m.getFirstPacket(),g=h,_;if(t<1/0){let e=await m.getPacket(t),n=e?e.type===`key`&&e.timestamp===t?e:await m.getNextKeyPacket(e,{verifyKeyPackets:!0}):null;n&&(_=n)}let v=m.packets(h??void 0,_);for(await v.next();g&&!u&&!this._track.input._disposed;){let e=oE(n.length);if(n.length+p.getDecodeQueueSize()>e){({promise:s,resolve:c}=_C()),await s;continue}p.decode(g);let t=await v.next();if(t.done)break;g=t.value}await v.return(),!d&&!this._track.input._disposed&&await p.flush(),p.close(),!r&&i&&n.push(i),l=!0,o()})().catch(e=>{f||(f=e,o())});let p=this._track,m=()=>{i?.close();for(let e of n)e.close()};return{async next(){for(;;)if(p.input._disposed)throw m(),new hO;else if(d)return{value:void 0,done:!0};else if(f)throw m(),f;else if(n.length>0){let e=n.shift();return c(),{value:e,done:!1}}else if(!l)await a;else return{value:void 0,done:!0}},async return(){return d=!0,u=!0,c(),o(),m(),{value:void 0,done:!0}},async throw(e){throw e},[Symbol.asyncIterator](){return this}}}mediaSamplesAtTimestamps(e){xC(e);let t=bC(e),n=[],r=[],{promise:i,resolve:a}=_C(),{promise:o,resolve:s}=_C(),c=!1,l=!1,u=null,d=e=>{r.push(e),a(),{promise:i,resolve:a}=_C()};(async()=>{let e=await this._createDecoder(e=>{if(s(),l){e.close();return}let t=0;for(;n.length>0&&e.timestamp-n[0]>-1e-10;)t++,n.shift();if(t>0)for(let n=0;n<t;n++)d(n<t-1?e.clone():e);else e.close()},e=>{u||(u=e,a())}),i=this._createPacketSink(),f=null,p=null,m=-1,h=async()=>{X(p);let t=p;for(e.decode(t);t.sequenceNumber<m;){let n=oE(r.length);for(;r.length+e.getDecodeQueueSize()>n&&!l;)({promise:o,resolve:s}=_C()),await o;if(l)break;let a=await i.getNextPacket(t);X(a),e.decode(a),t=a}m=-1},g=async()=>{await e.flush();for(let e=0;e<n.length;e++)d(null);n.length=0};for await(let e of t){if(tE(e),l||this._track.input._disposed)break;let t=await i.getPacket(e),r=t&&await i.getKeyPacket(e,{verifyKeyPackets:!0});if(!r){m!==-1&&(await h(),await g()),d(null),f=null;continue}f&&(r.sequenceNumber!==p.sequenceNumber||t.timestamp<f.timestamp)&&(await h(),await g()),n.push(t.timestamp),m=Math.max(t.sequenceNumber,m),f=t,p=r}!l&&!this._track.input._disposed&&(m!==-1&&await h(),await g()),e.close(),c=!0,a()})().catch(e=>{u||(u=e,a())});let f=this._track,p=()=>{for(let e of r)e?.close()};return{async next(){for(;;)if(f.input._disposed)throw p(),new hO;else if(l)return{value:void 0,done:!0};else if(u)throw p(),u;else if(r.length>0){let e=r.shift();return X(e!==void 0),s(),{value:e,done:!1}}else if(!c)await i;else return{value:void 0,done:!0}},async return(){return l=!0,s(),a(),p(),{value:void 0,done:!0}},async throw(e){throw e},[Symbol.asyncIterator](){return this}}}},oE=e=>e===0?40:8,sE=class extends iE{constructor(e,t,n,r,i,a){super(e,t),this.codec=n,this.decoderConfig=r,this.rotation=i,this.timeResolution=a,this.decoder=null,this.customDecoder=null,this.customDecoderCallSerializer=new zC,this.customDecoderQueueSize=0,this.inputTimestamps=[],this.sampleQueue=[],this.currentPacketIndex=0,this.raslSkipped=!1,this.alphaDecoder=null,this.alphaHadKeyframe=!1,this.colorQueue=[],this.alphaQueue=[],this.merger=null,this.mergerCreationFailed=!1,this.decodedAlphaChunkCount=0,this.alphaDecoderQueueSize=0,this.nullAlphaFrameQueue=[],this.currentAlphaPacketIndex=0,this.alphaRaslSkipped=!1;let o=CT.find(e=>e.supports(n,r));if(o)this.customDecoder=new o,this.customDecoder.codec=n,this.customDecoder.config=r,this.customDecoder.onSample=e=>{if(!(e instanceof RT))throw TypeError(`The argument passed to onSample must be a VideoSample.`);this.finalizeAndEmitSample(e)},this.customDecoderCallSerializer.call(()=>this.customDecoder.init());else{let e=e=>{if(this.alphaQueue.length>0){let t=this.alphaQueue.shift();X(t!==void 0),this.mergeAlpha(e,t)}else this.colorQueue.push(e)};if(n===`avc`&&this.decoderConfig.description&&GC()){let e=$w(QS(this.decoderConfig.description));if(e&&e.sequenceParameterSets.length>0){let t=eT(e.sequenceParameterSets[0]);t&&t.frameMbsOnlyFlag===0&&(this.decoderConfig={...this.decoderConfig,hardwareAcceleration:`prefer-software`})}}let t=Error(`Decoding error`).stack;this.decoder=new VideoDecoder({output:t=>{try{e(t)}catch(e){this.onError(e)}},error:e=>{e.stack=t,this.onError(e)}}),this.decoder.configure(this.decoderConfig)}}getDecodeQueueSize(){return this.customDecoder?this.customDecoderQueueSize:(X(this.decoder),Math.max(this.decoder.decodeQueueSize,this.alphaDecoder?.decodeQueueSize??0))}decode(e){if(this.codec===`hevc`&&this.currentPacketIndex>0&&!this.raslSkipped){if(this.hasHevcRaslPicture(e.data))return;this.raslSkipped=!0}this.customDecoder?(this.customDecoderQueueSize++,this.customDecoderCallSerializer.call(()=>this.customDecoder.decode(e)).then(()=>this.customDecoderQueueSize--)):(X(this.decoder),VC()||gC(this.inputTimestamps,e.timestamp,e=>e),GC()&&this.currentPacketIndex===0&&this.codec===`avc`&&(e=new OT(Yw(Jw(e.data,this.decoderConfig).filter(e=>{let t=Xw(e);return!(t>=20&&t<=31)}),this.decoderConfig),e.type,e.timestamp,e.duration)),this.decoder.decode(e.toEncodedVideoChunk()),this.decodeAlphaData(e)),this.currentPacketIndex++}decodeAlphaData(e){if(!e.sideData.alpha||this.mergerCreationFailed){this.pushNullAlphaFrame();return}if(!this.merger)try{this.merger=new cE}catch(t){console.error(`Due to an error, only color data will be decoded.`,t),this.mergerCreationFailed=!0,this.decodeAlphaData(e);return}if(!this.alphaDecoder){let e=e=>{if(this.alphaDecoderQueueSize--,this.colorQueue.length>0){let t=this.colorQueue.shift();X(t!==void 0),this.mergeAlpha(t,e)}else this.alphaQueue.push(e);for(this.decodedAlphaChunkCount++;this.nullAlphaFrameQueue.length>0&&this.nullAlphaFrameQueue[0]===this.decodedAlphaChunkCount;)if(this.nullAlphaFrameQueue.shift(),this.colorQueue.length>0){let e=this.colorQueue.shift();X(e!==void 0),this.mergeAlpha(e,null)}else this.alphaQueue.push(null)},t=Error(`Decoding error`).stack;this.alphaDecoder=new VideoDecoder({output:t=>{try{e(t)}catch(e){this.onError(e)}},error:e=>{e.stack=t,this.onError(e)}}),this.alphaDecoder.configure(this.decoderConfig)}let t=yT(this.codec,this.decoderConfig,e.sideData.alpha);if(this.alphaHadKeyframe||=t===`key`,this.alphaHadKeyframe){if(this.codec===`hevc`&&this.currentAlphaPacketIndex>0&&!this.alphaRaslSkipped){if(this.hasHevcRaslPicture(e.sideData.alpha)){this.pushNullAlphaFrame();return}this.alphaRaslSkipped=!0}this.currentAlphaPacketIndex++,this.alphaDecoder.decode(e.alphaToEncodedVideoChunk(t??e.type)),this.alphaDecoderQueueSize++}else this.pushNullAlphaFrame()}pushNullAlphaFrame(){this.alphaDecoderQueueSize===0?this.alphaQueue.push(null):this.nullAlphaFrameQueue.push(this.decodedAlphaChunkCount+this.alphaDecoderQueueSize)}hasHevcRaslPicture(e){return tT(e,this.decoderConfig).some(e=>{let t=nT(e);return t===Vw.RASL_N||t===Vw.RASL_R})}sampleHandler(e){if(VC()){if(this.sampleQueue.length>0&&e.timestamp>=JS(this.sampleQueue).timestamp){for(let e of this.sampleQueue)this.finalizeAndEmitSample(e);this.sampleQueue.length=0}gC(this.sampleQueue,e,e=>e.timestamp)}else{let t=this.inputTimestamps.shift();X(t!==void 0),e.setTimestamp(t),this.finalizeAndEmitSample(e)}}finalizeAndEmitSample(e){e.setTimestamp(Math.round(e.timestamp*this.timeResolution)/this.timeResolution),e.setDuration(Math.round(e.duration*this.timeResolution)/this.timeResolution),e.setRotation(this.rotation),this.onSample(e)}mergeAlpha(e,t){if(!t){let t=new RT(e);this.sampleHandler(t);return}X(this.merger),this.merger.update(e,t),e.close(),t.close();let n=new RT(new VideoFrame(this.merger.canvas,{timestamp:e.timestamp,duration:e.duration??void 0}));this.sampleHandler(n)}async flush(){if(this.customDecoder?await this.customDecoderCallSerializer.call(()=>this.customDecoder.flush()):(X(this.decoder),await Promise.all([this.decoder.flush(),this.alphaDecoder?.flush()]),this.colorQueue.forEach(e=>e.close()),this.colorQueue.length=0,this.alphaQueue.forEach(e=>e?.close()),this.alphaQueue.length=0,this.alphaHadKeyframe=!1,this.decodedAlphaChunkCount=0,this.alphaDecoderQueueSize=0,this.nullAlphaFrameQueue.length=0,this.currentAlphaPacketIndex=0,this.alphaRaslSkipped=!1),VC()){for(let e of this.sampleQueue)this.finalizeAndEmitSample(e);this.sampleQueue.length=0}this.currentPacketIndex=0,this.raslSkipped=!1}close(){this.customDecoder?this.customDecoderCallSerializer.call(()=>this.customDecoder.close()):(X(this.decoder),this.decoder.close(),this.alphaDecoder?.close(),this.colorQueue.forEach(e=>e.close()),this.colorQueue.length=0,this.alphaQueue.forEach(e=>e?.close()),this.alphaQueue.length=0,this.merger?.close());for(let e of this.sampleQueue)e.close();this.sampleQueue.length=0}},cE=class{w=0;h=0;colorImageData=null;alphaImageData=null;constructor(){typeof OffscreenCanvas<`u`?(this.canvas=new OffscreenCanvas(1,1),this.alphaCanvas=new OffscreenCanvas(1,1)):(this.canvas=document.createElement(`canvas`),this.alphaCanvas=document.createElement(`canvas`));let e=this.canvas.getContext(`2d`,{alpha:!0,willReadFrequently:!0}),t=this.alphaCanvas.getContext(`2d`,{alpha:!0,willReadFrequently:!0});if(!e||!t)throw Error(`Couldn't acquire 2D canvas context.`);this.ctx=e,this.alphaCtx=t}update(e,t){let n=e.displayWidth,r=e.displayHeight;(n!==this.w||r!==this.h)&&(this.w=n,this.h=r,this.canvas.width=n,this.canvas.height=r,this.alphaCanvas.width=n,this.alphaCanvas.height=r,this.colorImageData=this.ctx.createImageData(n,r),this.alphaImageData=this.ctx.createImageData(n,r)),this.ctx.drawImage(e,0,0,n,r),this.alphaCtx.drawImage(t,0,0,n,r);let i=this.ctx.getImageData(0,0,n,r,{colorSpace:`srgb`}),a=this.alphaCtx.getImageData(0,0,n,r,{colorSpace:`srgb`}),o=new Uint32Array(i.data.buffer),s=new Uint32Array(a.data.buffer),c=o.length;for(let e=0;e<c;e++)o[e]=o[e]&16777215|(s[e]&255)<<24;this.ctx.putImageData(i,0,0)}close(){this.ctx=null,this.alphaCtx=null,this.colorImageData=null,this.alphaImageData=null}},lE=class extends aE{constructor(e){if(!(e instanceof gE))throw TypeError(`videoTrack must be an InputVideoTrack.`);super(),this._track=e}async _createDecoder(e,t){if(!await this._track.canDecode())throw Error(`This video track cannot be decoded by this browser. Make sure to check decodability before using a track.`);let n=this._track.codec,r=this._track.rotation,i=await this._track.getDecoderConfig(),a=this._track.timeResolution;return X(n&&i),new sE(e,t,n,i,r,a)}_createPacketSink(){return new rE(this._track)}async getSample(e){tE(e);for await(let t of this.mediaSamplesAtTimestamps([e]))return t;throw Error(`Internal error: Iterator returned nothing.`)}samples(e=0,t=1/0){return this.mediaSamplesInRange(e,t)}samplesAtTimestamps(e){return this.mediaSamplesAtTimestamps(e)}},uE=class{constructor(e,t={}){if(this._nextCanvasIndex=0,!(e instanceof gE))throw TypeError(`videoTrack must be an InputVideoTrack.`);if(t&&typeof t!=`object`)throw TypeError(`options must be an object.`);if(t.alpha!==void 0&&typeof t.alpha!=`boolean`)throw TypeError(`options.alpha, when provided, must be a boolean.`);if(t.width!==void 0&&(!Number.isInteger(t.width)||t.width<=0))throw TypeError(`options.width, when defined, must be a positive integer.`);if(t.height!==void 0&&(!Number.isInteger(t.height)||t.height<=0))throw TypeError(`options.height, when defined, must be a positive integer.`);if(t.fit!==void 0&&![`fill`,`contain`,`cover`].includes(t.fit))throw TypeError(`options.fit, when provided, must be one of "fill", "contain", or "cover".`);if(t.width!==void 0&&t.height!==void 0&&t.fit===void 0)throw TypeError(`When both options.width and options.height are provided, options.fit must also be provided.`);if(t.rotation!==void 0&&![0,90,180,270].includes(t.rotation))throw TypeError(`options.rotation, when provided, must be 0, 90, 180 or 270.`);if(t.crop!==void 0&&HT(t.crop,`options.`),t.poolSize!==void 0&&(typeof t.poolSize!=`number`||!Number.isInteger(t.poolSize)||t.poolSize<0))throw TypeError(`poolSize must be a non-negative integer.`);let n=t.rotation??e.rotation,[r,i]=n%180==0?[e.codedWidth,e.codedHeight]:[e.codedHeight,e.codedWidth],a=t.crop;a&&VT(a,r,i);let[o,s]=a?[a.width,a.height]:[r,i],c=o/s;t.width!==void 0&&t.height===void 0?(o=t.width,s=Math.round(o/c)):t.width===void 0&&t.height!==void 0?(s=t.height,o=Math.round(s*c)):t.width!==void 0&&t.height!==void 0&&(o=t.width,s=t.height),this._videoTrack=e,this._alpha=t.alpha??!1,this._width=o,this._height=s,this._rotation=n,this._crop=a,this._fit=t.fit??`fill`,this._videoSampleSink=new lE(e),this._canvasPool=Array.from({length:t.poolSize??0},()=>null)}_videoSampleToWrappedCanvas(e){let t=this._canvasPool[this._nextCanvasIndex],n=!1;t||(typeof document<`u`?(t=document.createElement(`canvas`),t.width=this._width,t.height=this._height):t=new OffscreenCanvas(this._width,this._height),this._canvasPool.length>0&&(this._canvasPool[this._nextCanvasIndex]=t),n=!0),this._canvasPool.length>0&&(this._nextCanvasIndex=(this._nextCanvasIndex+1)%this._canvasPool.length);let r=t.getContext(`2d`,{alpha:this._alpha||UC()});X(r),r.resetTransform(),n||(!this._alpha&&UC()?(r.fillStyle=`black`,r.fillRect(0,0,this._width,this._height)):r.clearRect(0,0,this._width,this._height)),e.drawWithFit(r,{fit:this._fit,rotation:this._rotation,crop:this._crop});let i={canvas:t,timestamp:e.timestamp,duration:e.duration};return e.close(),i}async getCanvas(e){tE(e);let t=await this._videoSampleSink.getSample(e);return t&&this._videoSampleToWrappedCanvas(t)}canvases(e=0,t=1/0){return DC(this._videoSampleSink.samples(e,t),e=>this._videoSampleToWrappedCanvas(e))}canvasesAtTimestamps(e){return DC(this._videoSampleSink.samplesAtTimestamps(e),e=>e&&this._videoSampleToWrappedCanvas(e))}},dE=class extends iE{constructor(e,t,n,r){super(e,t),this.decoder=null,this.customDecoder=null,this.customDecoderCallSerializer=new zC,this.customDecoderQueueSize=0,this.currentTimestamp=null;let i=t=>{(this.currentTimestamp===null||Math.abs(t.timestamp-this.currentTimestamp)>=t.duration)&&(this.currentTimestamp=t.timestamp);let n=this.currentTimestamp;if(this.currentTimestamp+=t.duration,t.numberOfFrames===0){t.close();return}let i=r.sampleRate;t.setTimestamp(Math.round(n*i)/i),e(t)},a=wT.find(e=>e.supports(n,r));if(a)this.customDecoder=new a,this.customDecoder.codec=n,this.customDecoder.config=r,this.customDecoder.onSample=e=>{if(!(e instanceof qT))throw TypeError(`The argument passed to onSample must be an AudioSample.`);i(e)},this.customDecoderCallSerializer.call(()=>this.customDecoder.init());else{let e=Error(`Decoding error`).stack;this.decoder=new AudioDecoder({output:e=>{try{i(new qT(e))}catch(e){this.onError(e)}},error:t=>{t.stack=e,this.onError(t)}}),this.decoder.configure(r)}}getDecodeQueueSize(){return this.customDecoder?this.customDecoderQueueSize:(X(this.decoder),this.decoder.decodeQueueSize)}decode(e){this.customDecoder?(this.customDecoderQueueSize++,this.customDecoderCallSerializer.call(()=>this.customDecoder.decode(e)).then(()=>this.customDecoderQueueSize--)):(X(this.decoder),this.decoder.decode(e.toEncodedAudioChunk()))}flush(){return this.customDecoder?this.customDecoderCallSerializer.call(()=>this.customDecoder.flush()):(X(this.decoder),this.decoder.flush())}close(){this.customDecoder?this.customDecoderCallSerializer.call(()=>this.customDecoder.close()):(X(this.decoder),this.decoder.close())}},fE=class extends iE{constructor(e,t,n){super(e,t),this.decoderConfig=n,this.currentTimestamp=null,X(ow.includes(n.codec)),this.codec=n.codec;let{dataType:r,sampleSize:i,littleEndian:a}=Dw(this.codec);switch(this.inputSampleSize=i,i){case 1:r===`unsigned`?this.readInputValue=(e,t)=>e.getUint8(t)-2**7:r===`signed`?this.readInputValue=(e,t)=>e.getInt8(t):r===`ulaw`?this.readInputValue=(e,t)=>AT(e.getUint8(t)):r===`alaw`?this.readInputValue=(e,t)=>MT(e.getUint8(t)):X(!1);break;case 2:r===`unsigned`?this.readInputValue=(e,t)=>e.getUint16(t,a)-2**15:r===`signed`?this.readInputValue=(e,t)=>e.getInt16(t,a):X(!1);break;case 3:r===`unsigned`?this.readInputValue=(e,t)=>CC(e,t,a)-2**23:r===`signed`?this.readInputValue=(e,t)=>wC(e,t,a):X(!1);break;case 4:r===`unsigned`?this.readInputValue=(e,t)=>e.getUint32(t,a)-2**31:r===`signed`?this.readInputValue=(e,t)=>e.getInt32(t,a):r===`float`?this.readInputValue=(e,t)=>e.getFloat32(t,a):X(!1);break;case 8:r===`float`?this.readInputValue=(e,t)=>e.getFloat64(t,a):X(!1);break;default:SC(i),X(!1)}switch(i){case 1:r===`ulaw`||r===`alaw`?(this.outputSampleSize=2,this.outputFormat=`s16`,this.writeOutputValue=(e,t,n)=>e.setInt16(t,n,!0)):(this.outputSampleSize=1,this.outputFormat=`u8`,this.writeOutputValue=(e,t,n)=>e.setUint8(t,n+2**7));break;case 2:this.outputSampleSize=2,this.outputFormat=`s16`,this.writeOutputValue=(e,t,n)=>e.setInt16(t,n,!0);break;case 3:this.outputSampleSize=4,this.outputFormat=`s32`,this.writeOutputValue=(e,t,n)=>e.setInt32(t,n<<8,!0);break;case 4:this.outputSampleSize=4,r===`float`?(this.outputFormat=`f32`,this.writeOutputValue=(e,t,n)=>e.setFloat32(t,n,!0)):(this.outputFormat=`s32`,this.writeOutputValue=(e,t,n)=>e.setInt32(t,n,!0));break;case 8:this.outputSampleSize=4,this.outputFormat=`f32`,this.writeOutputValue=(e,t,n)=>e.setFloat32(t,n,!0);break;default:SC(i),X(!1)}}getDecodeQueueSize(){return 0}decode(e){let t=$S(e.data),n=e.byteLength/this.decoderConfig.numberOfChannels/this.inputSampleSize,r=n*this.decoderConfig.numberOfChannels*this.outputSampleSize,i=new ArrayBuffer(r),a=new DataView(i);for(let e=0;e<n*this.decoderConfig.numberOfChannels;e++){let n=e*this.inputSampleSize,r=e*this.outputSampleSize,i=this.readInputValue(t,n);this.writeOutputValue(a,r,i)}let o=n/this.decoderConfig.sampleRate;(this.currentTimestamp===null||Math.abs(e.timestamp-this.currentTimestamp)>=o)&&(this.currentTimestamp=e.timestamp);let s=this.currentTimestamp;this.currentTimestamp+=o;let c=new qT({format:this.outputFormat,data:i,numberOfChannels:this.decoderConfig.numberOfChannels,sampleRate:this.decoderConfig.sampleRate,numberOfFrames:n,timestamp:s});this.onSample(c)}async flush(){}close(){}},pE=class extends aE{constructor(e){if(!(e instanceof _E))throw TypeError(`audioTrack must be an InputAudioTrack.`);super(),this._track=e}async _createDecoder(e,t){if(!await this._track.canDecode())throw Error(`This audio track cannot be decoded by this browser. Make sure to check decodability before using a track.`);let n=this._track.codec,r=await this._track.getDecoderConfig();return X(n&&r),ow.includes(r.codec)?new fE(e,t,r):new dE(e,t,n,r)}_createPacketSink(){return new rE(this._track)}async getSample(e){tE(e);for await(let t of this.mediaSamplesAtTimestamps([e]))return t;throw Error(`Internal error: Iterator returned nothing.`)}samples(e=0,t=1/0){return this.mediaSamplesInRange(e,t)}samplesAtTimestamps(e){return this.mediaSamplesAtTimestamps(e)}},mE=class{constructor(e){if(!(e instanceof _E))throw TypeError(`audioTrack must be an InputAudioTrack.`);this._audioSampleSink=new pE(e)}_audioSampleToWrappedArrayBuffer(e){let t={buffer:e.toAudioBuffer(),timestamp:e.timestamp,duration:e.duration};return e.close(),t}async getBuffer(e){tE(e);let t=await this._audioSampleSink.getSample(e);return t&&this._audioSampleToWrappedArrayBuffer(t)}buffers(e=0,t=1/0){return DC(this._audioSampleSink.samples(e,t),e=>this._audioSampleToWrappedArrayBuffer(e))}buffersAtTimestamps(e){return DC(this._audioSampleSink.samplesAtTimestamps(e),e=>e&&this._audioSampleToWrappedArrayBuffer(e))}},hE=class{constructor(e,t){this.input=e,this._backing=t}isVideoTrack(){return this instanceof gE}isAudioTrack(){return this instanceof _E}get id(){return this._backing.getId()}get internalCodecId(){return this._backing.getInternalCodecId()}get languageCode(){return this._backing.getLanguageCode()}get name(){return this._backing.getName()}get timeResolution(){return this._backing.getTimeResolution()}get disposition(){return this._backing.getDisposition()}getFirstTimestamp(){return this._backing.getFirstTimestamp()}computeDuration(){return this._backing.computeDuration()}async computePacketStats(e=1/0){let t=new rE(this),n=1/0,r=-1/0,i=0,a=0;for await(let o of t.packets(void 0,void 0,{metadataOnly:!0})){if(i>=e&&o.timestamp>=r)break;n=Math.min(n,o.timestamp),r=Math.max(r,o.timestamp+o.duration),i++,a+=o.byteLength}return{packetCount:i,averagePacketRate:i?Number((i/(r-n)).toPrecision(16)):0,averageBitrate:i?Number((8*a/(r-n)).toPrecision(16)):0}}},gE=class extends hE{constructor(e,t){super(e,t),this._backing=t}get type(){return`video`}get codec(){return this._backing.getCodec()}get codedWidth(){return this._backing.getCodedWidth()}get codedHeight(){return this._backing.getCodedHeight()}get rotation(){return this._backing.getRotation()}get displayWidth(){return this._backing.getRotation()%180==0?this._backing.getCodedWidth():this._backing.getCodedHeight()}get displayHeight(){return this._backing.getRotation()%180==0?this._backing.getCodedHeight():this._backing.getCodedWidth()}getColorSpace(){return this._backing.getColorSpace()}async hasHighDynamicRange(){let e=await this._backing.getColorSpace();return e.primaries===`bt2020`||e.primaries===`smpte432`||e.transfer===`pg`||e.transfer===`hlg`||e.matrix===`bt2020-ncl`}canBeTransparent(){return this._backing.canBeTransparent()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){return(await this._backing.getDecoderConfig())?.codec??null}async canDecode(){try{let e=await this._backing.getDecoderConfig();if(!e)return!1;let t=this._backing.getCodec();return X(t!==null),CT.some(n=>n.supports(t,e))?!0:typeof VideoDecoder>`u`?!1:(await VideoDecoder.isConfigSupported(e)).supported===!0}catch(e){return console.error(`Error during decodability check:`,e),!1}}async determinePacketType(e){if(!(e instanceof OT))throw TypeError(`packet must be an EncodedPacket.`);if(e.isMetadataOnly)throw TypeError(`packet must not be metadata-only to determine its type.`);if(this.codec===null)return null;let t=await this.getDecoderConfig();return X(t),yT(this.codec,t,e.data)}},_E=class extends hE{constructor(e,t){super(e,t),this._backing=t}get type(){return`audio`}get codec(){return this._backing.getCodec()}get numberOfChannels(){return this._backing.getNumberOfChannels()}get sampleRate(){return this._backing.getSampleRate()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){return(await this._backing.getDecoderConfig())?.codec??null}async canDecode(){try{let e=await this._backing.getDecoderConfig();if(!e)return!1;let t=this._backing.getCodec();return X(t!==null),wT.some(n=>n.supports(t,e))||e.codec.startsWith(`pcm-`)?!0:typeof AudioDecoder>`u`?!1:(await AudioDecoder.isConfigSupported(e)).supported===!0}catch(e){return console.error(`Error during decodability check:`,e),!1}}async determinePacketType(e){if(!(e instanceof OT))throw TypeError(`packet must be an EncodedPacket.`);return this.codec===null?null:`key`}},vE=e=>{let t=(e.hasVideo?`video/`:e.hasAudio?`audio/`:`application/`)+(e.isQuickTime?`quicktime`:`mp4`);if(e.codecStrings.length>0){let n=[...new Set(e.codecStrings)];t+=`; codecs="${n.join(`, `)}"`}return t},yE=e=>{let t=$(e),n=FO(e,4),r=8;t===1&&(t=AO(e),r=16);let i=t-r;return i<0?null:{name:n,totalSize:t,headerSize:r,contentSize:i}},bE=e=>DO(e)/65536,xE=e=>DO(e)/1073741824,SE=e=>{let t=0;for(let n=0;n<4;n++){t<<=7;let n=bO(e);if(t|=n&127,!(n&128))break}return t},CE=e=>{let t=SO(e);return e.skip(2),t=Math.min(t,e.remainingLength),eC.decode(yO(e,t))},wE=e=>{let t=yE(e);if(!t||t.name!==`data`||e.remainingLength<8)return null;let n=$(e);e.skip(4);let r=yO(e,t.contentSize-8);switch(n){case 1:return eC.decode(r);case 2:return new TextDecoder(`utf-16be`).decode(r);case 13:return new ew(r,`image/jpeg`);case 14:return new ew(r,`image/png`);case 27:return new ew(r,`image/bmp`);default:return r}},TE=class extends ST{constructor(e){super(e),this.moovSlice=null,this.currentTrack=null,this.tracks=[],this.metadataPromise=null,this.movieTimescale=-1,this.movieDurationInTimescale=-1,this.isQuickTime=!1,this.metadataTags={},this.currentMetadataKeys=null,this.isFragmented=!1,this.fragmentTrackDefaults=[],this.currentFragment=null,this.lastReadFragment=null,this.reader=e._reader}async computeDuration(){let e=await this.getTracks(),t=await Promise.all(e.map(e=>e.computeDuration()));return Math.max(0,...t)}async getTracks(){return await this.readMetadata(),this.tracks.map(e=>e.inputTrack)}async getMimeType(){await this.readMetadata();let e=await Promise.all(this.tracks.map(e=>e.inputTrack.getCodecParameterString()));return vE({isQuickTime:this.isQuickTime,hasVideo:this.tracks.some(e=>e.info?.type===`video`),hasAudio:this.tracks.some(e=>e.info?.type===`audio`),codecStrings:e.filter(Boolean)})}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}readMetadata(){return this.metadataPromise??=(async()=>{let e=0;for(;;){let t=this.reader.requestSliceRange(e,8,16);if(t instanceof Promise&&(t=await t),!t)break;let n=e,r=yE(t);if(!r)break;if(r.name===`ftyp`){let e=FO(t,4);this.isQuickTime=e===`qt `}else if(r.name===`moov`){let e=this.reader.requestSlice(t.filePos,r.contentSize);if(e instanceof Promise&&(e=await e),!e)break;this.moovSlice=e,this.readContiguousBoxes(this.moovSlice),this.tracks.sort((e,t)=>Number(t.disposition.default)-Number(e.disposition.default));for(let e of this.tracks){let t=e.editListPreviousSegmentDurations/this.movieTimescale;e.editListOffset-=Math.round(t*e.timescale)}break}e=n+r.totalSize}if(this.isFragmented&&this.reader.fileSize!==null){let e=this.reader.requestSlice(this.reader.fileSize-4,4);e instanceof Promise&&(e=await e),X(e);let t=$(e),n=this.reader.fileSize-t;if(n>=0&&n<=this.reader.fileSize-16){let e=this.reader.requestSliceRange(n,8,16);if(e instanceof Promise&&(e=await e),e){let t=yE(e);if(t&&t.name===`mfra`){let n=this.reader.requestSlice(e.filePos,t.contentSize);n instanceof Promise&&(n=await n),n&&this.readContiguousBoxes(n)}}}}})()}getSampleTableForTrack(e){if(e.sampleTable)return e.sampleTable;let t={sampleTimingEntries:[],sampleCompositionTimeOffsets:[],sampleSizes:[],keySampleIndices:null,chunkOffsets:[],sampleToChunk:[],presentationTimestamps:null,presentationTimestampIndexMap:null};e.sampleTable=t,X(this.moovSlice);let n=this.moovSlice.slice(e.sampleTableByteOffset);if(this.currentTrack=e,this.traverseBox(n),this.currentTrack=null,e.info?.type===`audio`&&e.info.codec&&ow.includes(e.info.codec)&&t.sampleCompositionTimeOffsets.length===0){X(e.info?.type===`audio`);let n=Dw(e.info.codec),r=[],i=[];for(let a=0;a<t.sampleToChunk.length;a++){let o=t.sampleToChunk[a],s=t.sampleToChunk[a+1],c=(s?s.startChunkIndex:t.chunkOffsets.length)-o.startChunkIndex;for(let a=0;a<c;a++){let s=o.startSampleIndex+a*o.samplesPerChunk,c=s+o.samplesPerChunk,l=hC(t.sampleTimingEntries,s,e=>e.startIndex),u=t.sampleTimingEntries[l],d=hC(t.sampleTimingEntries,c,e=>e.startIndex),f=t.sampleTimingEntries[d],p=u.startDecodeTimestamp+(s-u.startIndex)*u.delta,m=f.startDecodeTimestamp+(c-f.startIndex)*f.delta-p,h=JS(r);h&&h.delta===m?h.count++:r.push({startIndex:o.startChunkIndex+a,startDecodeTimestamp:p,count:1,delta:m});let g=o.samplesPerChunk*n.sampleSize*e.info.numberOfChannels;i.push(g)}o.startSampleIndex=o.startChunkIndex,o.samplesPerChunk=1}t.sampleTimingEntries=r,t.sampleSizes=i}if(t.sampleCompositionTimeOffsets.length>0){t.presentationTimestamps=[];for(let e of t.sampleTimingEntries)for(let n=0;n<e.count;n++)t.presentationTimestamps.push({presentationTimestamp:e.startDecodeTimestamp+n*e.delta,sampleIndex:e.startIndex+n});for(let e of t.sampleCompositionTimeOffsets)for(let n=0;n<e.count;n++){let r=e.startIndex+n,i=t.presentationTimestamps[r];i&&(i.presentationTimestamp+=e.offset)}t.presentationTimestamps.sort((e,t)=>e.presentationTimestamp-t.presentationTimestamp),t.presentationTimestampIndexMap=Array(t.presentationTimestamps.length).fill(-1);for(let e=0;e<t.presentationTimestamps.length;e++)t.presentationTimestampIndexMap[t.presentationTimestamps[e].sampleIndex]=e}return t}async readFragment(e){if(this.lastReadFragment?.moofOffset===e)return this.lastReadFragment;let t=this.reader.requestSliceRange(e,8,16);t instanceof Promise&&(t=await t),X(t);let n=yE(t);X(n?.name===`moof`);let r=this.reader.requestSlice(e,n.totalSize);r instanceof Promise&&(r=await r),X(r),this.traverseBox(r);let i=this.lastReadFragment;X(i&&i.moofOffset===e);for(let[,e]of i.trackData){let t=e.track,{fragmentPositionCache:n}=t;if(!e.startTimestampIsFinal){let r=t.fragmentLookupTable.find(e=>e.moofOffset===i.moofOffset);if(r)NE(e,r.timestamp);else{let t=hC(n,i.moofOffset-1,e=>e.moofOffset);if(t!==-1){let r=n[t];NE(e,r.endTimestamp)}}e.startTimestampIsFinal=!0}let r=hC(n,e.startTimestamp,e=>e.startTimestamp);(r===-1||n[r].moofOffset!==i.moofOffset)&&n.splice(r+1,0,{moofOffset:i.moofOffset,startTimestamp:e.startTimestamp,endTimestamp:e.endTimestamp})}return i}readContiguousBoxes(e){let t=e.filePos;for(;e.filePos-t<=e.length-8&&this.traverseBox(e););}*iterateContiguousBoxes(e){let t=e.filePos;for(;e.filePos-t<=e.length-8;){let t=e.filePos,n=yE(e);if(!n)break;yield{boxInfo:n,slice:e},e.filePos=t+n.totalSize}}traverseBox(e){let t=e.filePos,n=yE(e);if(!n)return!1;let r=e.filePos,i=t+n.totalSize;switch(n.name){case`mdia`:case`minf`:case`dinf`:case`mfra`:case`edts`:this.readContiguousBoxes(e.slice(r,n.contentSize));break;case`mvhd`:{let t=bO(e);e.skip(3),t===1?(e.skip(16),this.movieTimescale=$(e),this.movieDurationInTimescale=AO(e)):(e.skip(8),this.movieTimescale=$(e),this.movieDurationInTimescale=$(e))}break;case`trak`:{let t={id:-1,demuxer:this,inputTrack:null,disposition:{...rw},info:null,timescale:-1,durationInMovieTimescale:-1,durationInMediaTimescale:-1,rotation:0,internalCodecId:null,name:null,languageCode:`und`,sampleTableByteOffset:-1,sampleTable:null,fragmentLookupTable:[],currentFragmentState:null,fragmentPositionCache:[],editListPreviousSegmentDurations:0,editListOffset:0};if(this.currentTrack=t,this.readContiguousBoxes(e.slice(r,n.contentSize)),t.id!==-1&&t.timescale!==-1&&t.info!==null){if(t.info.type===`video`&&t.info.width!==-1){let e=t;t.inputTrack=new gE(this.input,new DE(e)),this.tracks.push(t)}else if(t.info.type===`audio`&&t.info.numberOfChannels!==-1){let e=t;t.inputTrack=new _E(this.input,new OE(e)),this.tracks.push(t)}}this.currentTrack=null}break;case`tkhd`:{let t=this.currentTrack;if(!t)break;let n=bO(e),r=!!(CO(e)&1);if(t.disposition.default=r,n===0)e.skip(8),t.id=$(e),e.skip(4),t.durationInMovieTimescale=$(e);else if(n===1)e.skip(16),t.id=$(e),e.skip(4),t.durationInMovieTimescale=AO(e);else throw Error(`Incorrect track header version ${n}.`);e.skip(16);let i=qS(AC(PE([bE(e),bE(e),xE(e),bE(e),bE(e),xE(e),bE(e),bE(e),xE(e)]),90));X(i===0||i===90||i===180||i===270),t.rotation=i}break;case`elst`:{let t=this.currentTrack;if(!t)break;let n=bO(e);e.skip(3);let r=!1,i=0,a=$(e);for(let o=0;o<a;o++){let a=n===1?AO(e):$(e),o=n===1?jO(e):DO(e),s=bE(e);if(a!==0){if(r){console.warn(`Unsupported edit list: multiple edits are not currently supported. Only using first edit.`);break}if(o===-1){i+=a;continue}if(s!==1){console.warn(`Unsupported edit list entry: media rate must be 1.`);break}t.editListPreviousSegmentDurations=i,t.editListOffset=o,r=!0}}}break;case`mdhd`:{let t=this.currentTrack;if(!t)break;let n=bO(e);e.skip(3),n===0?(e.skip(8),t.timescale=$(e),t.durationInMediaTimescale=$(e)):n===1&&(e.skip(16),t.timescale=$(e),t.durationInMediaTimescale=AO(e));let r=SO(e);if(r>0){t.languageCode=``;for(let e=0;e<3;e++)t.languageCode=String.fromCharCode(96+(r&31))+t.languageCode,r>>=5;NC(t.languageCode)||(t.languageCode=`und`)}}break;case`hdlr`:{let t=this.currentTrack;if(!t)break;e.skip(8);let n=FO(e,4);n===`vide`?t.info={type:`video`,width:-1,height:-1,codec:null,codecDescription:null,colorSpace:null,avcType:null,avcCodecInfo:null,hevcCodecInfo:null,vp9CodecInfo:null,av1CodecInfo:null}:n===`soun`&&(t.info={type:`audio`,numberOfChannels:-1,sampleRate:-1,codec:null,codecDescription:null,aacCodecInfo:null})}break;case`stbl`:{let i=this.currentTrack;if(!i)break;i.sampleTableByteOffset=t,this.readContiguousBoxes(e.slice(r,n.contentSize))}break;case`stsd`:{let t=this.currentTrack;if(!t||t.info===null||t.sampleTable)break;let n=bO(e);e.skip(3);let r=$(e);for(let i=0;i<r;i++){let r=e.filePos,i=yE(e);if(!i)break;t.internalCodecId=i.name;let a=i.name.toLowerCase();if(t.info.type===`video`)a===`avc1`||a===`avc3`?(t.info.codec=`avc`,t.info.avcType=a===`avc1`?1:3):a===`hvc1`||a===`hev1`?t.info.codec=`hevc`:a===`vp08`?t.info.codec=`vp8`:a===`vp09`?t.info.codec=`vp9`:a===`av01`?t.info.codec=`av1`:console.warn(`Unsupported video codec (sample entry type '${i.name}').`),e.skip(24),t.info.width=SO(e),t.info.height=SO(e),e.skip(50),this.readContiguousBoxes(e.slice(e.filePos,r+i.totalSize-e.filePos));else{a===`mp4a`||(a===`opus`?t.info.codec=`opus`:a===`flac`?t.info.codec=`flac`:a===`twos`||a===`sowt`||a===`raw `||a===`in24`||a===`in32`||a===`fl32`||a===`fl64`||a===`lpcm`||a===`ipcm`||a===`fpcm`||(a===`ulaw`?t.info.codec=`ulaw`:a===`alaw`?t.info.codec=`alaw`:console.warn(`Unsupported audio codec (sample entry type '${i.name}').`))),e.skip(8);let o=SO(e);e.skip(6);let s=SO(e),c=SO(e);e.skip(4);let l=$(e)/65536;if(n===0&&o>0){if(o===1)e.skip(4),c=8*$(e),e.skip(8);else if(o===2){e.skip(4),l=PO(e),s=$(e),e.skip(4),c=$(e);let n=$(e);if(e.skip(8),a===`lpcm`){let e=c+7>>3,r=!!(n&1),i=!!(n&2),a=n&4?-1:0;c>0&&c<=64&&(r?c===32&&(t.info.codec=i?`pcm-f32be`:`pcm-f32`):a&1<<e-1?e===1?t.info.codec=`pcm-s8`:e===2?t.info.codec=i?`pcm-s16be`:`pcm-s16`:e===3?t.info.codec=i?`pcm-s24be`:`pcm-s24`:e===4&&(t.info.codec=i?`pcm-s32be`:`pcm-s32`):e===1&&(t.info.codec=`pcm-u8`)),t.info.codec===null&&console.warn(`Unsupported PCM format.`)}}}t.info.codec===`opus`&&(l=Tw),t.info.numberOfChannels=s,t.info.sampleRate=l,a===`twos`?c===8?t.info.codec=`pcm-s8`:c===16?t.info.codec=`pcm-s16be`:(console.warn(`Unsupported sample size ${c} for codec 'twos'.`),t.info.codec=null):a===`sowt`?c===8?t.info.codec=`pcm-s8`:c===16?t.info.codec=`pcm-s16`:(console.warn(`Unsupported sample size ${c} for codec 'sowt'.`),t.info.codec=null):a===`raw `?t.info.codec=`pcm-u8`:a===`in24`?t.info.codec=`pcm-s24be`:a===`in32`?t.info.codec=`pcm-s32be`:a===`fl32`?t.info.codec=`pcm-f32be`:a===`fl64`?t.info.codec=`pcm-f64be`:a===`ipcm`?t.info.codec=`pcm-s16be`:a===`fpcm`&&(t.info.codec=`pcm-f32be`),this.readContiguousBoxes(e.slice(e.filePos,r+i.totalSize-e.filePos))}}}break;case`avcC`:{let t=this.currentTrack;if(!t)break;X(t.info),t.info.codecDescription=yO(e,n.contentSize)}break;case`hvcC`:{let t=this.currentTrack;if(!t)break;X(t.info),t.info.codecDescription=yO(e,n.contentSize)}break;case`vpcC`:{let t=this.currentTrack;if(!t)break;X(t.info?.type===`video`),e.skip(4);let n=bO(e),r=bO(e),i=bO(e),a=i>>4,o=i>>1&7,s=i&1,c=bO(e),l=bO(e),u=bO(e);t.info.vp9CodecInfo={profile:n,level:r,bitDepth:a,chromaSubsampling:o,videoFullRangeFlag:s,colourPrimaries:c,transferCharacteristics:l,matrixCoefficients:u}}break;case`av1C`:{let t=this.currentTrack;if(!t)break;X(t.info?.type===`video`),e.skip(1);let n=bO(e),r=n>>5,i=n&31,a=bO(e),o=a>>7,s=a>>6&1,c=a>>5&1,l=a>>4&1,u=a>>3&1,d=a>>2&1,f=a&3,p=r===2&&s?c?12:10:s?10:8;t.info.av1CodecInfo={profile:r,level:i,tier:o,bitDepth:p,monochrome:l,chromaSubsamplingX:u,chromaSubsamplingY:d,chromaSamplePosition:f}}break;case`colr`:{let t=this.currentTrack;if(!t||(X(t.info?.type===`video`),FO(e,4)!==`nclx`))break;let n=SO(e),r=SO(e),i=SO(e),a=!!(bO(e)&128);t.info.colorSpace={primaries:iC[n],transfer:oC[r],matrix:cC[i],fullRange:a}}break;case`wave`:this.readContiguousBoxes(e.slice(r,n.contentSize));break;case`esds`:{let t=this.currentTrack;if(!t)break;X(t.info?.type===`audio`),e.skip(4),X(bO(e)===3),SE(e),e.skip(2);let n=bO(e),r=(n&128)!=0,i=(n&64)!=0,a=(n&32)!=0;if(r&&e.skip(2),i){let t=bO(e);e.skip(t)}a&&e.skip(2),X(bO(e)===4);let o=SE(e),s=e.filePos,c=bO(e);if(c===64||c===103?(t.info.codec=`aac`,t.info.aacCodecInfo={isMpeg2:c===103}):c===105||c===107?t.info.codec=`mp3`:c===221?t.info.codec=`vorbis`:console.warn(`Unsupported audio codec (objectTypeIndication ${c}) - discarding track.`),e.skip(12),o>e.filePos-s){X(bO(e)===5);let n=SE(e);if(t.info.codecDescription=yO(e,n),t.info.codec===`aac`){let e=Cw(t.info.codecDescription);e.numberOfChannels!==null&&(t.info.numberOfChannels=e.numberOfChannels),e.sampleRate!==null&&(t.info.sampleRate=e.sampleRate)}}}break;case`enda`:{let t=this.currentTrack;if(!t)break;X(t.info?.type===`audio`),SO(e)&255&&(t.info.codec===`pcm-s16be`?t.info.codec=`pcm-s16`:t.info.codec===`pcm-s24be`?t.info.codec=`pcm-s24`:t.info.codec===`pcm-s32be`?t.info.codec=`pcm-s32`:t.info.codec===`pcm-f32be`?t.info.codec=`pcm-f32`:t.info.codec===`pcm-f64be`&&(t.info.codec=`pcm-f64`))}break;case`pcmC`:{let t=this.currentTrack;if(!t)break;X(t.info?.type===`audio`),e.skip(4);let n=!!(bO(e)&1),r=bO(e);t.info.codec===`pcm-s16be`?n?r===16?t.info.codec=`pcm-s16`:r===24?t.info.codec=`pcm-s24`:r===32?t.info.codec=`pcm-s32`:(console.warn(`Invalid ipcm sample size ${r}.`),t.info.codec=null):r===16?t.info.codec=`pcm-s16be`:r===24?t.info.codec=`pcm-s24be`:r===32?t.info.codec=`pcm-s32be`:(console.warn(`Invalid ipcm sample size ${r}.`),t.info.codec=null):t.info.codec===`pcm-f32be`&&(n?r===32?t.info.codec=`pcm-f32`:r===64?t.info.codec=`pcm-f64`:(console.warn(`Invalid fpcm sample size ${r}.`),t.info.codec=null):r===32?t.info.codec=`pcm-f32be`:r===64?t.info.codec=`pcm-f64be`:(console.warn(`Invalid fpcm sample size ${r}.`),t.info.codec=null));break}case`dOps`:{let t=this.currentTrack;if(!t)break;X(t.info?.type===`audio`),e.skip(1);let n=bO(e),r=SO(e),i=$(e),a=wO(e),o=bO(e),s;s=o===0?new Uint8Array:yO(e,2+n);let c=new Uint8Array(19+s.byteLength),l=new DataView(c.buffer);l.setUint32(0,1332770163,!1),l.setUint32(4,1214603620,!1),l.setUint8(8,1),l.setUint8(9,n),l.setUint16(10,r,!0),l.setUint32(12,i,!0),l.setInt16(16,a,!0),l.setUint8(18,o),c.set(s,19),t.info.codecDescription=c,t.info.numberOfChannels=n}break;case`dfLa`:{let t=this.currentTrack;if(!t)break;X(t.info?.type===`audio`),e.skip(4);let n=e.filePos;for(;e.filePos<i;){let n=bO(e),r=CO(e);if((n&127)===bT.STREAMINFO){e.skip(10);let n=$(e),r=n>>>12,i=(n>>9&7)+1;t.info.sampleRate=r,t.info.numberOfChannels=i,e.skip(20)}else e.skip(r);if(n&128)break}let r=e.filePos;e.filePos=n;let a=yO(e,r-n),o=new Uint8Array(4+a.byteLength);new DataView(o.buffer).setUint32(0,1716281667,!1),o.set(a,4),t.info.codecDescription=o}break;case`stts`:{let t=this.currentTrack;if(!t||!t.sampleTable)break;e.skip(4);let n=$(e),r=0,i=0;for(let a=0;a<n;a++){let n=$(e),a=$(e);t.sampleTable.sampleTimingEntries.push({startIndex:r,startDecodeTimestamp:i,count:n,delta:a}),r+=n,i+=n*a}}break;case`ctts`:{let t=this.currentTrack;if(!t||!t.sampleTable)break;e.skip(4);let n=$(e),r=0;for(let i=0;i<n;i++){let n=$(e),i=DO(e);t.sampleTable.sampleCompositionTimeOffsets.push({startIndex:r,count:n,offset:i}),r+=n}}break;case`stsz`:{let t=this.currentTrack;if(!t||!t.sampleTable)break;e.skip(4);let n=$(e),r=$(e);if(n===0)for(let n=0;n<r;n++){let n=$(e);t.sampleTable.sampleSizes.push(n)}else t.sampleTable.sampleSizes.push(n)}break;case`stz2`:{let t=this.currentTrack;if(!t||!t.sampleTable)break;e.skip(4),e.skip(3);let n=bO(e),r=$(e),i=new XS(yO(e,Math.ceil(r*n/8)));for(let e=0;e<r;e++){let e=i.readBits(n);t.sampleTable.sampleSizes.push(e)}}break;case`stss`:{let t=this.currentTrack;if(!t||!t.sampleTable)break;e.skip(4),t.sampleTable.keySampleIndices=[];let n=$(e);for(let r=0;r<n;r++){let n=$(e)-1;t.sampleTable.keySampleIndices.push(n)}t.sampleTable.keySampleIndices[0]!==0&&t.sampleTable.keySampleIndices.unshift(0)}break;case`stsc`:{let t=this.currentTrack;if(!t||!t.sampleTable)break;e.skip(4);let n=$(e);for(let r=0;r<n;r++){let n=$(e)-1,r=$(e),i=$(e);t.sampleTable.sampleToChunk.push({startSampleIndex:-1,startChunkIndex:n,samplesPerChunk:r,sampleDescriptionIndex:i})}let r=0;for(let e=0;e<t.sampleTable.sampleToChunk.length;e++)if(t.sampleTable.sampleToChunk[e].startSampleIndex=r,e<t.sampleTable.sampleToChunk.length-1){let n=t.sampleTable.sampleToChunk[e+1].startChunkIndex-t.sampleTable.sampleToChunk[e].startChunkIndex;r+=n*t.sampleTable.sampleToChunk[e].samplesPerChunk}}break;case`stco`:{let t=this.currentTrack;if(!t||!t.sampleTable)break;e.skip(4);let n=$(e);for(let r=0;r<n;r++){let n=$(e);t.sampleTable.chunkOffsets.push(n)}}break;case`co64`:{let t=this.currentTrack;if(!t||!t.sampleTable)break;e.skip(4);let n=$(e);for(let r=0;r<n;r++){let n=AO(e);t.sampleTable.chunkOffsets.push(n)}}break;case`mvex`:this.isFragmented=!0,this.readContiguousBoxes(e.slice(r,n.contentSize));break;case`mehd`:{let t=bO(e);e.skip(3);let n=t===1?AO(e):$(e);this.movieDurationInTimescale=n}break;case`trex`:{e.skip(4);let t=$(e),n=$(e),r=$(e),i=$(e),a=$(e);this.fragmentTrackDefaults.push({trackId:t,defaultSampleDescriptionIndex:n,defaultSampleDuration:r,defaultSampleSize:i,defaultSampleFlags:a})}break;case`tfra`:{let t=bO(e);e.skip(3);let n=$(e),r=this.tracks.find(e=>e.id===n);if(!r)break;let i=$(e),a=(i&48)>>4,o=(i&12)>>2,s=i&3,c=[bO,SO,CO,$],l=c[a],u=c[o],d=c[s],f=$(e);for(let n=0;n<f;n++){let n=t===1?AO(e):$(e),i=t===1?AO(e):$(e);l(e),u(e),d(e),r.fragmentLookupTable.push({timestamp:n,moofOffset:i})}r.fragmentLookupTable.sort((e,t)=>e.timestamp-t.timestamp);for(let e=0;e<r.fragmentLookupTable.length-1;e++){let t=r.fragmentLookupTable[e],n=r.fragmentLookupTable[e+1];t.timestamp===n.timestamp&&(r.fragmentLookupTable.splice(e+1,1),e--)}}break;case`moof`:this.currentFragment={moofOffset:t,moofSize:n.totalSize,implicitBaseDataOffset:t,trackData:new Map},this.readContiguousBoxes(e.slice(r,n.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case`traf`:if(X(this.currentFragment),this.readContiguousBoxes(e.slice(r,n.contentSize)),this.currentTrack){let e=this.currentFragment.trackData.get(this.currentTrack.id);if(e){let{currentFragmentState:t}=this.currentTrack;X(t),t.startTimestamp!==null&&(NE(e,t.startTimestamp),e.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case`tfhd`:{X(this.currentFragment),e.skip(1);let t=CO(e),n=!!(t&1),r=!!(t&2),i=!!(t&8),a=!!(t&16),o=!!(t&32),s=!!(t&65536),c=!!(t&131072),l=$(e),u=this.tracks.find(e=>e.id===l);if(!u)break;let d=this.fragmentTrackDefaults.find(e=>e.trackId===l);this.currentTrack=u,u.currentFragmentState={baseDataOffset:this.currentFragment.implicitBaseDataOffset,sampleDescriptionIndex:d?.defaultSampleDescriptionIndex??null,defaultSampleDuration:d?.defaultSampleDuration??null,defaultSampleSize:d?.defaultSampleSize??null,defaultSampleFlags:d?.defaultSampleFlags??null,startTimestamp:null},n?u.currentFragmentState.baseDataOffset=AO(e):c&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),r&&(u.currentFragmentState.sampleDescriptionIndex=$(e)),i&&(u.currentFragmentState.defaultSampleDuration=$(e)),a&&(u.currentFragmentState.defaultSampleSize=$(e)),o&&(u.currentFragmentState.defaultSampleFlags=$(e)),s&&(u.currentFragmentState.defaultSampleDuration=0)}break;case`tfdt`:{let t=this.currentTrack;if(!t)break;X(t.currentFragmentState);let n=bO(e);e.skip(3);let r=n===0?$(e):AO(e);t.currentFragmentState.startTimestamp=r}break;case`trun`:{let t=this.currentTrack;if(!t)break;if(X(this.currentFragment),X(t.currentFragmentState),this.currentFragment.trackData.has(t.id)){console.warn(`Can't have two trun boxes for the same track in one fragment. Ignoring...`);break}let n=bO(e),r=CO(e),i=!!(r&1),a=!!(r&4),o=!!(r&256),s=!!(r&512),c=!!(r&1024),l=!!(r&2048),u=$(e),d=t.currentFragmentState.baseDataOffset;i&&(d+=DO(e));let f=null;a&&(f=$(e));let p=d;if(u===0){this.currentFragment.implicitBaseDataOffset=p;break}let m=0,h={track:t,startTimestamp:0,endTimestamp:0,firstKeyFrameTimestamp:null,samples:[],presentationTimestamps:[],startTimestampIsFinal:!1};this.currentFragment.trackData.set(t.id,h);for(let r=0;r<u;r++){let i;o?i=$(e):(X(t.currentFragmentState.defaultSampleDuration!==null),i=t.currentFragmentState.defaultSampleDuration);let a;s?a=$(e):(X(t.currentFragmentState.defaultSampleSize!==null),a=t.currentFragmentState.defaultSampleSize);let u;c?u=$(e):(X(t.currentFragmentState.defaultSampleFlags!==null),u=t.currentFragmentState.defaultSampleFlags),r===0&&f!==null&&(u=f);let d=0;l&&(d=n===0?$(e):DO(e));let g=!(u&65536);h.samples.push({presentationTimestamp:m+d,duration:i,byteOffset:p,byteSize:a,isKeyFrame:g}),p+=a,m+=i}h.presentationTimestamps=h.samples.map((e,t)=>({presentationTimestamp:e.presentationTimestamp,sampleIndex:t})).sort((e,t)=>e.presentationTimestamp-t.presentationTimestamp);for(let e=0;e<h.presentationTimestamps.length;e++){let t=h.presentationTimestamps[e],n=h.samples[t.sampleIndex];h.firstKeyFrameTimestamp===null&&n.isKeyFrame&&(h.firstKeyFrameTimestamp=n.presentationTimestamp),e<h.presentationTimestamps.length-1&&(n.duration=h.presentationTimestamps[e+1].presentationTimestamp-t.presentationTimestamp)}let g=h.samples[h.presentationTimestamps[0].sampleIndex],_=h.samples[JS(h.presentationTimestamps).sampleIndex];h.startTimestamp=g.presentationTimestamp,h.endTimestamp=_.presentationTimestamp+_.duration,this.currentFragment.implicitBaseDataOffset=p}break;case`udta`:{let t=this.iterateContiguousBoxes(e.slice(r,n.contentSize));for(let{boxInfo:e,slice:n}of t){if(e.name!==`meta`&&!this.currentTrack){let t=n.filePos;this.metadataTags.raw??={},e.name[0]===`©`?this.metadataTags.raw[e.name]??=CE(n):this.metadataTags.raw[e.name]??=yO(n,e.contentSize),n.filePos=t}switch(e.name){case`meta`:n.skip(-e.headerSize),this.traverseBox(n);break;case`©nam`:case`name`:this.currentTrack?this.currentTrack.name=eC.decode(yO(n,e.contentSize)):this.metadataTags.title??=CE(n);break;case`©des`:this.currentTrack||(this.metadataTags.description??=CE(n));break;case`©ART`:this.currentTrack||(this.metadataTags.artist??=CE(n));break;case`©alb`:this.currentTrack||(this.metadataTags.album??=CE(n));break;case`albr`:this.currentTrack||(this.metadataTags.albumArtist??=CE(n));break;case`©gen`:this.currentTrack||(this.metadataTags.genre??=CE(n));break;case`©day`:if(!this.currentTrack){let e=new Date(CE(n));Number.isNaN(e.getTime())||(this.metadataTags.date??=e)}break;case`©cmt`:this.currentTrack||(this.metadataTags.comment??=CE(n));break;case`©lyr`:this.currentTrack||(this.metadataTags.lyrics??=CE(n));break}}}break;case`meta`:{if(this.currentTrack)break;let t=$(e)!==0;this.currentMetadataKeys=new Map,t?this.readContiguousBoxes(e.slice(r,n.contentSize)):this.readContiguousBoxes(e.slice(r+4,n.contentSize-4)),this.currentMetadataKeys=null}break;case`keys`:{if(!this.currentMetadataKeys)break;e.skip(4);let t=$(e);for(let n=0;n<t;n++){let t=$(e);e.skip(4);let r=eC.decode(yO(e,t-8));this.currentMetadataKeys.set(n+1,r)}}break;case`ilst`:{if(!this.currentMetadataKeys)break;let t=this.iterateContiguousBoxes(e.slice(r,n.contentSize));for(let{boxInfo:e,slice:n}of t){let t=e.name,r=(t.charCodeAt(0)<<24)+(t.charCodeAt(1)<<16)+(t.charCodeAt(2)<<8)+t.charCodeAt(3);this.currentMetadataKeys.has(r)&&(t=this.currentMetadataKeys.get(r));let i=wE(n);switch(this.metadataTags.raw??={},this.metadataTags.raw[t]??=i,t){case`©nam`:case`titl`:case`com.apple.quicktime.title`:case`title`:typeof i==`string`&&(this.metadataTags.title??=i);break;case`©des`:case`desc`:case`dscp`:case`com.apple.quicktime.description`:case`description`:typeof i==`string`&&(this.metadataTags.description??=i);break;case`©ART`:case`com.apple.quicktime.artist`:case`artist`:typeof i==`string`&&(this.metadataTags.artist??=i);break;case`©alb`:case`albm`:case`com.apple.quicktime.album`:case`album`:typeof i==`string`&&(this.metadataTags.album??=i);break;case`aART`:case`album_artist`:typeof i==`string`&&(this.metadataTags.albumArtist??=i);break;case`©cmt`:case`com.apple.quicktime.comment`:case`comment`:typeof i==`string`&&(this.metadataTags.comment??=i);break;case`©gen`:case`gnre`:case`com.apple.quicktime.genre`:case`genre`:typeof i==`string`&&(this.metadataTags.genre??=i);break;case`©lyr`:case`lyrics`:typeof i==`string`&&(this.metadataTags.lyrics??=i);break;case`©day`:case`rldt`:case`com.apple.quicktime.creationdate`:case`date`:if(typeof i==`string`){let e=new Date(i);Number.isNaN(e.getTime())||(this.metadataTags.date??=e)}break;case`covr`:case`com.apple.quicktime.artwork`:i instanceof ew?(this.metadataTags.images??=[],this.metadataTags.images.push({data:i.data,kind:`coverFront`,mimeType:i.mimeType})):i instanceof Uint8Array&&(this.metadataTags.images??=[],this.metadataTags.images.push({data:i,kind:`coverFront`,mimeType:`image/*`}));break;case`track`:if(typeof i==`string`){let e=i.split(`/`),t=Number.parseInt(e[0],10),n=e[1]&&Number.parseInt(e[1],10);Number.isInteger(t)&&t>0&&(this.metadataTags.trackNumber??=t),n&&Number.isInteger(n)&&n>0&&(this.metadataTags.tracksTotal??=n)}break;case`trkn`:if(i instanceof Uint8Array&&i.length>=6){let e=$S(i),t=e.getUint16(2,!1),n=e.getUint16(4,!1);t>0&&(this.metadataTags.trackNumber??=t),n>0&&(this.metadataTags.tracksTotal??=n)}break;case`disc`:case`disk`:if(i instanceof Uint8Array&&i.length>=6){let e=$S(i),t=e.getUint16(2,!1),n=e.getUint16(4,!1);t>0&&(this.metadataTags.discNumber??=t),n>0&&(this.metadataTags.discsTotal??=n)}break}}}break}return e.filePos=i,!0}},EE=class{constructor(e){this.internalTrack=e,this.packetToSampleIndex=new WeakMap,this.packetToFragmentLocation=new WeakMap}getId(){return this.internalTrack.id}getCodec(){throw Error(`Not implemented on base class.`)}getInternalCodecId(){return this.internalTrack.internalCodecId}getName(){return this.internalTrack.name}getLanguageCode(){return this.internalTrack.languageCode}getTimeResolution(){return this.internalTrack.timescale}getDisposition(){return this.internalTrack.disposition}async computeDuration(){let e=await this.getPacket(1/0,{metadataOnly:!0});return(e?.timestamp??0)+(e?.duration??0)}async getFirstTimestamp(){return(await this.getFirstPacket({metadataOnly:!0}))?.timestamp??0}async getFirstPacket(e){let t=await this.fetchPacketForSampleIndex(0,e);return t||!this.internalTrack.demuxer.isFragmented?t:this.performFragmentedLookup(null,e=>e.trackData.get(this.internalTrack.id)?{sampleIndex:0,correctSampleFound:!0}:{sampleIndex:-1,correctSampleFound:!1},-1/0,1/0,e)}mapTimestampIntoTimescale(e){return kC(e*this.internalTrack.timescale)+this.internalTrack.editListOffset}async getPacket(e,t){let n=this.mapTimestampIntoTimescale(e),r=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=kE(r,n),a=await this.fetchPacketForSampleIndex(i,t);return!FE(r)||!this.internalTrack.demuxer.isFragmented?a:this.performFragmentedLookup(null,e=>{let t=e.trackData.get(this.internalTrack.id);if(!t)return{sampleIndex:-1,correctSampleFound:!1};let r=hC(t.presentationTimestamps,n,e=>e.presentationTimestamp);return{sampleIndex:r===-1?-1:t.presentationTimestamps[r].sampleIndex,correctSampleFound:r!==-1&&n<t.endTimestamp}},n,n,t)}async getNextPacket(e,t){let n=this.packetToSampleIndex.get(e);if(n!==void 0)return this.fetchPacketForSampleIndex(n+1,t);let r=this.packetToFragmentLocation.get(e);if(r===void 0)throw Error(`Packet was not created from this track.`);return this.performFragmentedLookup(r.fragment,e=>{if(e===r.fragment){let t=e.trackData.get(this.internalTrack.id);if(r.sampleIndex+1<t.samples.length)return{sampleIndex:r.sampleIndex+1,correctSampleFound:!0}}else if(e.trackData.get(this.internalTrack.id))return{sampleIndex:0,correctSampleFound:!0};return{sampleIndex:-1,correctSampleFound:!1}},-1/0,1/0,t)}async getKeyPacket(e,t){let n=this.mapTimestampIntoTimescale(e),r=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=AE(r,n),a=await this.fetchPacketForSampleIndex(i,t);return!FE(r)||!this.internalTrack.demuxer.isFragmented?a:this.performFragmentedLookup(null,e=>{let t=e.trackData.get(this.internalTrack.id);if(!t)return{sampleIndex:-1,correctSampleFound:!1};let r=yC(t.presentationTimestamps,e=>t.samples[e.sampleIndex].isKeyFrame&&e.presentationTimestamp<=n);return{sampleIndex:r===-1?-1:t.presentationTimestamps[r].sampleIndex,correctSampleFound:r!==-1&&n<t.endTimestamp}},n,n,t)}async getNextKeyPacket(e,t){let n=this.packetToSampleIndex.get(e);if(n!==void 0){let e=ME(this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),n);return this.fetchPacketForSampleIndex(e,t)}let r=this.packetToFragmentLocation.get(e);if(r===void 0)throw Error(`Packet was not created from this track.`);return this.performFragmentedLookup(r.fragment,e=>{if(e===r.fragment){let t=e.trackData.get(this.internalTrack.id).samples.findIndex((e,t)=>e.isKeyFrame&&t>r.sampleIndex);if(t!==-1)return{sampleIndex:t,correctSampleFound:!0}}else{let t=e.trackData.get(this.internalTrack.id);if(t&&t.firstKeyFrameTimestamp!==null){let e=t.samples.findIndex(e=>e.isKeyFrame);return X(e!==-1),{sampleIndex:e,correctSampleFound:!0}}}return{sampleIndex:-1,correctSampleFound:!1}},-1/0,1/0,t)}async fetchPacketForSampleIndex(e,t){if(e===-1)return null;let n=jE(this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),e);if(!n)return null;let r;if(t.metadataOnly)r=DT;else{let e=this.internalTrack.demuxer.reader.requestSlice(n.sampleOffset,n.sampleSize);e instanceof Promise&&(e=await e),X(e),r=yO(e,n.sampleSize)}let i=(n.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,a=n.duration/this.internalTrack.timescale,o=new OT(r,n.isKeyFrame?`key`:`delta`,i,a,e,n.sampleSize);return this.packetToSampleIndex.set(o,e),o}async fetchPacketInFragment(e,t,n){if(t===-1)return null;let r=e.trackData.get(this.internalTrack.id).samples[t];X(r);let i;if(n.metadataOnly)i=DT;else{let e=this.internalTrack.demuxer.reader.requestSlice(r.byteOffset,r.byteSize);e instanceof Promise&&(e=await e),X(e),i=yO(e,r.byteSize)}let a=(r.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,o=r.duration/this.internalTrack.timescale,s=new OT(i,r.isKeyFrame?`key`:`delta`,a,o,e.moofOffset+t,r.byteSize);return this.packetToFragmentLocation.set(s,{fragment:e,sampleIndex:t}),s}async performFragmentedLookup(e,t,n,r,i){let a=this.internalTrack.demuxer,o=null,s=null,c=-1;if(e){let{sampleIndex:n,correctSampleFound:r}=t(e);if(r)return this.fetchPacketInFragment(e,n,i);n!==-1&&(s=e,c=n)}let l=hC(this.internalTrack.fragmentLookupTable,n,e=>e.timestamp),u=l===-1?null:this.internalTrack.fragmentLookupTable[l],d=hC(this.internalTrack.fragmentPositionCache,n,e=>e.startTimestamp),f=d===-1?null:this.internalTrack.fragmentPositionCache[d],p=Math.max(u?.moofOffset??0,f?.moofOffset??0)||null,m;for(e?p===null||e.moofOffset>=p?(m=e.moofOffset+e.moofSize,o=e):m=p:m=p??0;;){if(o){let e=o.trackData.get(this.internalTrack.id);if(e&&e.startTimestamp>r)break}let e=a.reader.requestSliceRange(m,8,16);if(e instanceof Promise&&(e=await e),!e)break;let n=m,l=yE(e);if(!l)break;if(l.name===`moof`){o=await a.readFragment(n);let{sampleIndex:e,correctSampleFound:r}=t(o);if(r)return this.fetchPacketInFragment(o,e,i);e!==-1&&(s=o,c=e)}m=n+l.totalSize}if(u&&(!s||s.moofOffset<u.moofOffset)){let e=this.internalTrack.fragmentLookupTable[l-1];X(!e||e.timestamp<u.timestamp);let n=e?.timestamp??-1/0;return this.performFragmentedLookup(null,t,n,r,i)}return s?this.fetchPacketInFragment(s,c,i):null}},DE=class extends EE{constructor(e){super(e),this.decoderConfigPromise=null,this.internalTrack=e}getCodec(){return this.internalTrack.info.codec}getCodedWidth(){return this.internalTrack.info.width}getCodedHeight(){return this.internalTrack.info.height}getRotation(){return this.internalTrack.rotation}async getColorSpace(){return{primaries:this.internalTrack.info.colorSpace?.primaries,transfer:this.internalTrack.info.colorSpace?.transfer,matrix:this.internalTrack.info.colorSpace?.matrix,fullRange:this.internalTrack.info.colorSpace?.fullRange}}async canBeTransparent(){return!1}async getDecoderConfig(){return this.internalTrack.info.codec?this.decoderConfigPromise??=(async()=>{if(this.internalTrack.info.codec===`vp9`&&!this.internalTrack.info.vp9CodecInfo){let e=await this.getFirstPacket({});this.internalTrack.info.vp9CodecInfo=e&&fT(e.data)}else if(this.internalTrack.info.codec===`av1`&&!this.internalTrack.info.av1CodecInfo){let e=await this.getFirstPacket({});this.internalTrack.info.av1CodecInfo=e&&mT(e.data)}return{codec:vw(this.internalTrack.info),codedWidth:this.internalTrack.info.width,codedHeight:this.internalTrack.info.height,description:this.internalTrack.info.codecDescription??void 0,colorSpace:this.internalTrack.info.colorSpace??void 0}})():null}},OE=class extends EE{constructor(e){super(e),this.decoderConfig=null,this.internalTrack=e}getCodec(){return this.internalTrack.info.codec}getNumberOfChannels(){return this.internalTrack.info.numberOfChannels}getSampleRate(){return this.internalTrack.info.sampleRate}async getDecoderConfig(){return this.internalTrack.info.codec?this.decoderConfig??={codec:bw(this.internalTrack.info),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:this.internalTrack.info.codecDescription??void 0}:null}},kE=(e,t)=>{if(e.presentationTimestamps){let n=hC(e.presentationTimestamps,t,e=>e.presentationTimestamp);return n===-1?-1:e.presentationTimestamps[n].sampleIndex}else{let n=hC(e.sampleTimingEntries,t,e=>e.startDecodeTimestamp);if(n===-1)return-1;let r=e.sampleTimingEntries[n];return r.startIndex+Math.min(Math.floor((t-r.startDecodeTimestamp)/r.delta),r.count-1)}},AE=(e,t)=>{if(!e.keySampleIndices)return kE(e,t);if(e.presentationTimestamps){let n=hC(e.presentationTimestamps,t,e=>e.presentationTimestamp);if(n===-1)return-1;for(let t=n;t>=0;t--){let n=e.presentationTimestamps[t].sampleIndex;if(mC(e.keySampleIndices,n,e=>e)!==-1)return n}return-1}else{let n=kE(e,t),r=hC(e.keySampleIndices,n,e=>e);return e.keySampleIndices[r]??-1}},jE=(e,t)=>{let n=hC(e.sampleTimingEntries,t,e=>e.startIndex),r=e.sampleTimingEntries[n];if(!r||r.startIndex+r.count<=t)return null;let i=r.startDecodeTimestamp+(t-r.startIndex)*r.delta,a=hC(e.sampleCompositionTimeOffsets,t,e=>e.startIndex),o=e.sampleCompositionTimeOffsets[a];o&&t-o.startIndex<o.count&&(i+=o.offset);let s=e.sampleSizes[Math.min(t,e.sampleSizes.length-1)],c=hC(e.sampleToChunk,t,e=>e.startSampleIndex),l=e.sampleToChunk[c];X(l);let u=l.startChunkIndex+Math.floor((t-l.startSampleIndex)/l.samplesPerChunk),d=e.chunkOffsets[u],f=l.startSampleIndex+(u-l.startChunkIndex)*l.samplesPerChunk,p=0,m=d;if(e.sampleSizes.length===1)m+=s*(t-f),p+=s*l.samplesPerChunk;else for(let n=f;n<f+l.samplesPerChunk;n++){let r=e.sampleSizes[n];n<t&&(m+=r),p+=r}let h=r.delta;if(e.presentationTimestamps){let n=e.presentationTimestampIndexMap[t];X(n!==void 0),n<e.presentationTimestamps.length-1&&(h=e.presentationTimestamps[n+1].presentationTimestamp-i)}return{presentationTimestamp:i,duration:h,sampleOffset:m,sampleSize:s,chunkOffset:d,chunkSize:p,isKeyFrame:e.keySampleIndices?mC(e.keySampleIndices,t,e=>e)!==-1:!0}},ME=(e,t)=>{if(!e.keySampleIndices)return t+1;let n=hC(e.keySampleIndices,t,e=>e);return e.keySampleIndices[n+1]??-1},NE=(e,t)=>{e.startTimestamp+=t,e.endTimestamp+=t;for(let n of e.samples)n.presentationTimestamp+=t;for(let n of e.presentationTimestamps)n.presentationTimestamp+=t},PE=e=>{let[t,,,n]=e,r=Math.hypot(t,n),i=t/r,a=n/r,o=-Math.atan2(a,i)*(180/Math.PI);return Number.isFinite(o)?o:0},FE=e=>e.sampleSizes.length===0,Q;(function(e){e[e.EBML=440786851]=`EBML`,e[e.EBMLVersion=17030]=`EBMLVersion`,e[e.EBMLReadVersion=17143]=`EBMLReadVersion`,e[e.EBMLMaxIDLength=17138]=`EBMLMaxIDLength`,e[e.EBMLMaxSizeLength=17139]=`EBMLMaxSizeLength`,e[e.DocType=17026]=`DocType`,e[e.DocTypeVersion=17031]=`DocTypeVersion`,e[e.DocTypeReadVersion=17029]=`DocTypeReadVersion`,e[e.Void=236]=`Void`,e[e.Segment=408125543]=`Segment`,e[e.SeekHead=290298740]=`SeekHead`,e[e.Seek=19899]=`Seek`,e[e.SeekID=21419]=`SeekID`,e[e.SeekPosition=21420]=`SeekPosition`,e[e.Duration=17545]=`Duration`,e[e.Info=357149030]=`Info`,e[e.TimestampScale=2807729]=`TimestampScale`,e[e.MuxingApp=19840]=`MuxingApp`,e[e.WritingApp=22337]=`WritingApp`,e[e.Tracks=374648427]=`Tracks`,e[e.TrackEntry=174]=`TrackEntry`,e[e.TrackNumber=215]=`TrackNumber`,e[e.TrackUID=29637]=`TrackUID`,e[e.TrackType=131]=`TrackType`,e[e.FlagEnabled=185]=`FlagEnabled`,e[e.FlagDefault=136]=`FlagDefault`,e[e.FlagForced=21930]=`FlagForced`,e[e.FlagOriginal=21934]=`FlagOriginal`,e[e.FlagHearingImpaired=21931]=`FlagHearingImpaired`,e[e.FlagVisualImpaired=21932]=`FlagVisualImpaired`,e[e.FlagCommentary=21935]=`FlagCommentary`,e[e.FlagLacing=156]=`FlagLacing`,e[e.Name=21358]=`Name`,e[e.Language=2274716]=`Language`,e[e.LanguageBCP47=2274717]=`LanguageBCP47`,e[e.CodecID=134]=`CodecID`,e[e.CodecPrivate=25506]=`CodecPrivate`,e[e.CodecDelay=22186]=`CodecDelay`,e[e.SeekPreRoll=22203]=`SeekPreRoll`,e[e.DefaultDuration=2352003]=`DefaultDuration`,e[e.Video=224]=`Video`,e[e.PixelWidth=176]=`PixelWidth`,e[e.PixelHeight=186]=`PixelHeight`,e[e.AlphaMode=21440]=`AlphaMode`,e[e.Audio=225]=`Audio`,e[e.SamplingFrequency=181]=`SamplingFrequency`,e[e.Channels=159]=`Channels`,e[e.BitDepth=25188]=`BitDepth`,e[e.SimpleBlock=163]=`SimpleBlock`,e[e.BlockGroup=160]=`BlockGroup`,e[e.Block=161]=`Block`,e[e.BlockAdditions=30113]=`BlockAdditions`,e[e.BlockMore=166]=`BlockMore`,e[e.BlockAdditional=165]=`BlockAdditional`,e[e.BlockAddID=238]=`BlockAddID`,e[e.BlockDuration=155]=`BlockDuration`,e[e.ReferenceBlock=251]=`ReferenceBlock`,e[e.Cluster=524531317]=`Cluster`,e[e.Timestamp=231]=`Timestamp`,e[e.Cues=475249515]=`Cues`,e[e.CuePoint=187]=`CuePoint`,e[e.CueTime=179]=`CueTime`,e[e.CueTrackPositions=183]=`CueTrackPositions`,e[e.CueTrack=247]=`CueTrack`,e[e.CueClusterPosition=241]=`CueClusterPosition`,e[e.Colour=21936]=`Colour`,e[e.MatrixCoefficients=21937]=`MatrixCoefficients`,e[e.TransferCharacteristics=21946]=`TransferCharacteristics`,e[e.Primaries=21947]=`Primaries`,e[e.Range=21945]=`Range`,e[e.Projection=30320]=`Projection`,e[e.ProjectionType=30321]=`ProjectionType`,e[e.ProjectionPoseRoll=30325]=`ProjectionPoseRoll`,e[e.Attachments=423732329]=`Attachments`,e[e.AttachedFile=24999]=`AttachedFile`,e[e.FileDescription=18046]=`FileDescription`,e[e.FileName=18030]=`FileName`,e[e.FileMediaType=18016]=`FileMediaType`,e[e.FileData=18012]=`FileData`,e[e.FileUID=18094]=`FileUID`,e[e.Chapters=272869232]=`Chapters`,e[e.Tags=307544935]=`Tags`,e[e.Tag=29555]=`Tag`,e[e.Targets=25536]=`Targets`,e[e.TargetTypeValue=26826]=`TargetTypeValue`,e[e.TargetType=25546]=`TargetType`,e[e.TagTrackUID=25541]=`TagTrackUID`,e[e.TagEditionUID=25545]=`TagEditionUID`,e[e.TagChapterUID=25540]=`TagChapterUID`,e[e.TagAttachmentUID=25542]=`TagAttachmentUID`,e[e.SimpleTag=26568]=`SimpleTag`,e[e.TagName=17827]=`TagName`,e[e.TagLanguage=17530]=`TagLanguage`,e[e.TagString=17543]=`TagString`,e[e.TagBinary=17541]=`TagBinary`,e[e.ContentEncodings=28032]=`ContentEncodings`,e[e.ContentEncoding=25152]=`ContentEncoding`,e[e.ContentEncodingOrder=20529]=`ContentEncodingOrder`,e[e.ContentEncodingScope=20530]=`ContentEncodingScope`,e[e.ContentCompression=20532]=`ContentCompression`,e[e.ContentCompAlgo=16980]=`ContentCompAlgo`,e[e.ContentCompSettings=16981]=`ContentCompSettings`,e[e.ContentEncryption=20533]=`ContentEncryption`})(Q||={});var IE=[Q.EBML,Q.Segment],LE=[Q.SeekHead,Q.Info,Q.Cluster,Q.Tracks,Q.Cues,Q.Attachments,Q.Chapters,Q.Tags],RE=[...IE,...LE],zE=e=>{let t=bO(e);if(e.skip(-1),t===0)return null;let n=1,r=128;for(;(t&r)===0;)n++,r>>=1;return n},BE=e=>{let t=bO(e);if(t===0)return null;let n=1,r=128;for(;(t&r)===0;)n++,r>>=1;let i=t&r-1;for(let t=1;t<n;t++)i*=256,i+=bO(e);return i},VE=(e,t)=>{if(t<1||t>8)throw Error(`Bad unsigned int size `+t);let n=0;for(let r=0;r<t;r++)n*=256,n+=bO(e);return n},HE=(e,t)=>{if(t<1)throw Error(`Bad unsigned int size `+t);let n=0n;for(let r=0;r<t;r++)n<<=8n,n+=BigInt(bO(e));return n},UE=e=>{let t=zE(e);return t===null?null:VE(e,t)},WE=e=>{let t=bO(e);return t===255?t=null:(e.skip(-1),t=BE(e),t===72057594037927940&&(t=null)),t},GE=e=>{let t=UE(e);return t===null?null:{id:t,size:WE(e)}},KE=(e,t)=>{let n=yO(e,t),r=0;for(;r<t&&n[r]!==0;)r+=1;return String.fromCharCode(...n.subarray(0,r))},qE=(e,t)=>{let n=yO(e,t),r=0;for(;r<t&&n[r]!==0;)r+=1;return eC.decode(n.subarray(0,r))},JE=(e,t)=>{if(t===0)return 0;if(t!==4&&t!==8)throw Error(`Bad float size `+t);return t===4?NO(e):PO(e)},YE=async(e,t,n,r)=>{let i=new Set(n),a=t;for(;r===null||a<r;){let t=e.requestSliceRange(a,2,16);if(t instanceof Promise&&(t=await t),!t)break;let n=GE(t);if(!n)break;if(i.has(n.id))return{pos:a,found:!0};QE(n.size),a=t.filePos+n.size}return{pos:r!==null&&r>a?r:a,found:!1}},XE=async(e,t,n,r)=>{let i=2**16,a=new Set(n),o=t;for(;o<r;){let t=e.requestSliceRange(o,0,Math.min(i,r-o));if(t instanceof Promise&&(t=await t),!t||t.length<8)break;for(let e=0;e<t.length-8;e++){t.filePos=o;let e=UE(t);if(e!==null&&a.has(e))return o;o++}}return null},ZE={avc:`V_MPEG4/ISO/AVC`,hevc:`V_MPEGH/ISO/HEVC`,vp8:`V_VP8`,vp9:`V_VP9`,av1:`V_AV1`,aac:`A_AAC`,mp3:`A_MPEG/L3`,opus:`A_OPUS`,vorbis:`A_VORBIS`,flac:`A_FLAC`,"pcm-u8":`A_PCM/INT/LIT`,"pcm-s16":`A_PCM/INT/LIT`,"pcm-s16be":`A_PCM/INT/BIG`,"pcm-s24":`A_PCM/INT/LIT`,"pcm-s24be":`A_PCM/INT/BIG`,"pcm-s32":`A_PCM/INT/LIT`,"pcm-s32be":`A_PCM/INT/BIG`,"pcm-f32":`A_PCM/FLOAT/IEEE`,"pcm-f64":`A_PCM/FLOAT/IEEE`,webvtt:`S_TEXT/WEBVTT`};function QE(e){if(e===null)throw Error(`Undefined element size is used in a place where it is not supported.`)}var $E=e=>{let t=(e.hasVideo?`video/`:e.hasAudio?`audio/`:`application/`)+(e.isWebM?`webm`:`x-matroska`);if(e.codecStrings.length>0){let n=[...new Set(e.codecStrings.filter(Boolean))];t+=`; codecs="${n.join(`, `)}"`}return t},eD;(function(e){e[e.None=0]=`None`,e[e.Xiph=1]=`Xiph`,e[e.FixedSize=2]=`FixedSize`,e[e.Ebml=3]=`Ebml`})(eD||={});var tD;(function(e){e[e.Block=1]=`Block`,e[e.Private=2]=`Private`,e[e.Next=4]=`Next`})(tD||={});var nD;(function(e){e[e.Zlib=0]=`Zlib`,e[e.Bzlib=1]=`Bzlib`,e[e.lzo1x=2]=`lzo1x`,e[e.HeaderStripping=3]=`HeaderStripping`})(nD||={});var rD=[{id:Q.SeekHead,flag:`seekHeadSeen`},{id:Q.Info,flag:`infoSeen`},{id:Q.Tracks,flag:`tracksSeen`},{id:Q.Cues,flag:`cuesSeen`}],iD=10*2**20,aD=class extends ST{constructor(e){super(e),this.readMetadataPromise=null,this.segments=[],this.currentSegment=null,this.currentTrack=null,this.currentCluster=null,this.currentBlock=null,this.currentBlockAdditional=null,this.currentCueTime=null,this.currentDecodingInstruction=null,this.currentTagTargetIsMovie=!0,this.currentSimpleTagName=null,this.currentAttachedFile=null,this.isWebM=!1,this.reader=e._reader}async computeDuration(){let e=await this.getTracks(),t=await Promise.all(e.map(e=>e.computeDuration()));return Math.max(0,...t)}async getTracks(){return await this.readMetadata(),this.segments.flatMap(e=>e.tracks.map(e=>e.inputTrack))}async getMimeType(){await this.readMetadata();let e=await this.getTracks(),t=await Promise.all(e.map(e=>e.getCodecParameterString()));return $E({isWebM:this.isWebM,hasVideo:this.segments.some(e=>e.tracks.some(e=>e.info?.type===`video`)),hasAudio:this.segments.some(e=>e.tracks.some(e=>e.info?.type===`audio`)),codecStrings:t.filter(Boolean)})}async getMetadataTags(){await this.readMetadata();for(let e of this.segments)e.metadataTagsCollected||=(this.reader.fileSize!==null&&await this.loadSegmentMetadata(e),!0);let e={};for(let t of this.segments)e={...e,...t.metadataTags};return e}readMetadata(){return this.readMetadataPromise??=(async()=>{let e=0;for(;;){let t=this.reader.requestSliceRange(e,2,16);if(t instanceof Promise&&(t=await t),!t)break;let n=GE(t);if(!n)break;let r=n.id,i=n.size,a=t.filePos;if(r===Q.EBML){QE(i);let e=this.reader.requestSlice(a,i);if(e instanceof Promise&&(e=await e),!e)break;this.readContiguousElements(e)}else if(r===Q.Segment){if(await this.readSegment(a,i),i===null||this.reader.fileSize===null)break}else if(r===Q.Cluster){if(this.reader.fileSize===null)break;i===null&&(i=(await YE(this.reader,a,RE,this.reader.fileSize)).pos-a);let e=JS(this.segments);e&&(e.elementEndPos=a+i)}QE(i),e=a+i}})()}async readSegment(e,t){this.currentSegment={seekHeadSeen:!1,infoSeen:!1,tracksSeen:!1,cuesSeen:!1,tagsSeen:!1,attachmentsSeen:!1,timestampScale:-1,timestampFactor:-1,duration:-1,seekEntries:[],tracks:[],cuePoints:[],dataStartPos:e,elementEndPos:t===null?null:e+t,clusterSeekStartPos:e,lastReadCluster:null,metadataTags:{},metadataTagsCollected:!1},this.segments.push(this.currentSegment);let n=e;for(;this.currentSegment.elementEndPos===null||n<this.currentSegment.elementEndPos;){let e=this.reader.requestSliceRange(n,2,16);if(e instanceof Promise&&(e=await e),!e)break;let t=n,r=GE(e);if(!r||!LE.includes(r.id)&&r.id!==Q.Void){let e=await XE(this.reader,t,LE,Math.min(this.currentSegment.elementEndPos??1/0,t+iD));if(e){n=e;continue}else break}let{id:i,size:a}=r,o=e.filePos,s=rD.findIndex(e=>e.id===i);if(s!==-1){let e=rD[s].flag;this.currentSegment[e]=!0,QE(a);let t=this.reader.requestSlice(o,a);t instanceof Promise&&(t=await t),t&&this.readContiguousElements(t)}else if(i===Q.Tags||i===Q.Attachments){i===Q.Tags?this.currentSegment.tagsSeen=!0:this.currentSegment.attachmentsSeen=!0,QE(a);let e=this.reader.requestSlice(o,a);e instanceof Promise&&(e=await e),e&&this.readContiguousElements(e)}else if(i===Q.Cluster){this.currentSegment.clusterSeekStartPos=t;break}if(a===null)break;n=o+a}if(this.currentSegment.seekEntries.sort((e,t)=>e.segmentPosition-t.segmentPosition),this.reader.fileSize!==null)for(let t of this.currentSegment.seekEntries){let n=rD.find(e=>e.id===t.id);if(!n||this.currentSegment[n.flag])continue;let r=this.reader.requestSliceRange(e+t.segmentPosition,2,16);if(r instanceof Promise&&(r=await r),!r)continue;let i=GE(r);if(!i)continue;let{id:a,size:o}=i;if(a!==n.id)continue;QE(o),this.currentSegment[n.flag]=!0;let s=this.reader.requestSlice(r.filePos,o);s instanceof Promise&&(s=await s),s&&this.readContiguousElements(s)}this.currentSegment.timestampScale===-1&&(this.currentSegment.timestampScale=1e6,this.currentSegment.timestampFactor=1e9/1e6),this.currentSegment.tracks.sort((e,t)=>Number(t.disposition.default)-Number(e.disposition.default));let r=new Map(this.currentSegment.tracks.map(e=>[e.id,e]));for(let e of this.currentSegment.cuePoints){let t=r.get(e.trackId);t&&t.cuePoints.push(e)}for(let e of this.currentSegment.tracks){e.cuePoints.sort((e,t)=>e.time-t.time);for(let t=0;t<e.cuePoints.length-1;t++){let n=e.cuePoints[t],r=e.cuePoints[t+1];n.time===r.time&&(e.cuePoints.splice(t+1,1),t--)}}let i=null,a=-1/0;for(let e of this.currentSegment.tracks)e.cuePoints.length>a&&(a=e.cuePoints.length,i=e);for(let e of this.currentSegment.tracks)e.cuePoints.length===0&&(e.cuePoints=i.cuePoints);this.currentSegment=null}async readCluster(e,t){if(t.lastReadCluster?.elementStartPos===e)return t.lastReadCluster;let n=this.reader.requestSliceRange(e,2,16);n instanceof Promise&&(n=await n),X(n);let r=e,i=GE(n);X(i);let a=i.id;X(a===Q.Cluster);let o=i.size,s=n.filePos;o===null&&(o=(await YE(this.reader,s,RE,t.elementEndPos)).pos-s);let c=this.reader.requestSlice(s,o);c instanceof Promise&&(c=await c);let l={segment:t,elementStartPos:r,elementEndPos:s+o,dataStartPos:s,timestamp:-1,trackData:new Map};this.currentCluster=l,c&&(l.elementEndPos=this.readContiguousElements(c,RE));for(let[,e]of l.trackData){let t=e.track;X(e.blocks.length>0);let n=!1;for(let t=0;t<e.blocks.length;t++){let r=e.blocks[t];r.timestamp+=l.timestamp,n||=r.lacing!==eD.None}e.presentationTimestamps=e.blocks.map((e,t)=>({timestamp:e.timestamp,blockIndex:t})).sort((e,t)=>e.timestamp-t.timestamp);for(let n=0;n<e.presentationTimestamps.length;n++){let r=e.presentationTimestamps[n],i=e.blocks[r.blockIndex];e.firstKeyFrameTimestamp===null&&i.isKeyFrame&&(e.firstKeyFrameTimestamp=i.timestamp),n<e.presentationTimestamps.length-1?i.duration=e.presentationTimestamps[n+1].timestamp-i.timestamp:i.duration===0&&t.defaultDuration!=null&&i.lacing===eD.None&&(i.duration=t.defaultDuration)}n&&(this.expandLacedBlocks(e.blocks,t),e.presentationTimestamps=e.blocks.map((e,t)=>({timestamp:e.timestamp,blockIndex:t})).sort((e,t)=>e.timestamp-t.timestamp));let i=e.blocks[e.presentationTimestamps[0].blockIndex],a=e.blocks[JS(e.presentationTimestamps).blockIndex];e.startTimestamp=i.timestamp,e.endTimestamp=a.timestamp+a.duration;let o=hC(t.clusterPositionCache,e.startTimestamp,e=>e.startTimestamp);(o===-1||t.clusterPositionCache[o].elementStartPos!==r)&&t.clusterPositionCache.splice(o+1,0,{elementStartPos:l.elementStartPos,startTimestamp:e.startTimestamp})}return t.lastReadCluster=l,l}getTrackDataInCluster(e,t){let n=e.trackData.get(t);if(!n){let r=e.segment.tracks.find(e=>e.id===t);if(!r)return null;n={track:r,startTimestamp:0,endTimestamp:0,firstKeyFrameTimestamp:null,blocks:[],presentationTimestamps:[]},e.trackData.set(t,n)}return n}expandLacedBlocks(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r.lacing===eD.None)continue;r.decoded||=(r.data=this.decodeBlockData(t,r.data),!0);let i=_O.tempFromBytes(r.data),a=[],o=bO(i)+1;switch(r.lacing){case eD.Xiph:{let e=0;for(let t=0;t<o-1;t++){let t=0;for(;i.bufferPos<i.length;){let n=bO(i);if(t+=n,n<255){a.push(t),e+=t;break}}}a.push(i.length-(i.bufferPos+e))}break;case eD.FixedSize:{let e=i.length-1,t=Math.floor(e/o);for(let e=0;e<o;e++)a.push(t)}break;case eD.Ebml:{let e=BE(i);X(e!==null);let t=e;a.push(t);let n=t;for(let e=1;e<o-1;e++){let e=i.bufferPos,r=BE(i);X(r!==null);let o=r-((1<<(i.bufferPos-e)*7-1)-1);t+=o,a.push(t),n+=t}a.push(i.length-(i.bufferPos+n))}break;default:X(!1)}X(a.length===o),e.splice(n,1);let s=r.duration||o*(t.defaultDuration??0);for(let t=0;t<o;t++){let c=a[t],l=yO(i,c),u=r.timestamp+s*t/o,d=s/o;e.splice(n+t,0,{timestamp:u,duration:d,isKeyFrame:r.isKeyFrame,data:l,lacing:eD.None,decoded:!0,mainAdditional:r.mainAdditional})}n+=o,n--}}async loadSegmentMetadata(e){for(let t of e.seekEntries){if(!(t.id===Q.Tags&&!e.tagsSeen)&&!(t.id===Q.Attachments&&!e.attachmentsSeen))continue;let n=this.reader.requestSliceRange(e.dataStartPos+t.segmentPosition,2,16);if(n instanceof Promise&&(n=await n),!n)continue;let r=GE(n);if(!r||r.id!==t.id)continue;let{size:i}=r;QE(i),X(!this.currentSegment),this.currentSegment=e;let a=this.reader.requestSlice(n.filePos,i);a instanceof Promise&&(a=await a),a&&this.readContiguousElements(a),this.currentSegment=null,t.id===Q.Tags?e.tagsSeen=!0:t.id===Q.Attachments&&(e.attachmentsSeen=!0)}}readContiguousElements(e,t){let n=e.filePos;for(;e.filePos-n<=e.length-2;){let n=e.filePos;if(!this.traverseElement(e,t))return n}return e.filePos}traverseElement(e,t){let n=GE(e);if(!n||t&&t.includes(n.id))return!1;let{id:r,size:i}=n,a=e.filePos;switch(QE(i),r){case Q.DocType:this.isWebM=KE(e,i)===`webm`;break;case Q.Seek:{if(!this.currentSegment)break;let t={id:-1,segmentPosition:-1};this.currentSegment.seekEntries.push(t),this.readContiguousElements(e.slice(a,i)),(t.id===-1||t.segmentPosition===-1)&&this.currentSegment.seekEntries.pop()}break;case Q.SeekID:{let t=this.currentSegment?.seekEntries[this.currentSegment.seekEntries.length-1];if(!t)break;t.id=VE(e,i)}break;case Q.SeekPosition:{let t=this.currentSegment?.seekEntries[this.currentSegment.seekEntries.length-1];if(!t)break;t.segmentPosition=VE(e,i)}break;case Q.TimestampScale:if(!this.currentSegment)break;this.currentSegment.timestampScale=VE(e,i),this.currentSegment.timestampFactor=1e9/this.currentSegment.timestampScale;break;case Q.Duration:if(!this.currentSegment)break;this.currentSegment.duration=JE(e,i);break;case Q.TrackEntry:if(!this.currentSegment)break;if(this.currentTrack={id:-1,segment:this.currentSegment,demuxer:this,clusterPositionCache:[],cuePoints:[],disposition:{...rw},inputTrack:null,codecId:null,codecPrivate:null,defaultDuration:null,name:null,languageCode:`und`,decodingInstructions:[],info:null},this.readContiguousElements(e.slice(a,i)),this.currentTrack.decodingInstructions.some(e=>e.data?.type!==`decompress`||e.scope!==tD.Block||e.data.algorithm!==nD.HeaderStripping)&&(console.warn(`Track #${this.currentTrack.id} has an unsupported content encoding; dropping.`),this.currentTrack=null),this.currentTrack&&this.currentTrack.id!==-1&&this.currentTrack.codecId&&this.currentTrack.info){let e=this.currentTrack.codecId.indexOf(`/`),t=e===-1?this.currentTrack.codecId:this.currentTrack.codecId.slice(0,e);if(this.currentTrack.info.type===`video`&&this.currentTrack.info.width!==-1&&this.currentTrack.info.height!==-1){this.currentTrack.codecId===ZE.avc?(this.currentTrack.info.codec=`avc`,this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):this.currentTrack.codecId===ZE.hevc?(this.currentTrack.info.codec=`hevc`,this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):t===ZE.vp8?this.currentTrack.info.codec=`vp8`:t===ZE.vp9?this.currentTrack.info.codec=`vp9`:t===ZE.av1&&(this.currentTrack.info.codec=`av1`);let e=this.currentTrack,n=new gE(this.input,new sD(e));this.currentTrack.inputTrack=n,this.currentSegment.tracks.push(this.currentTrack)}else if(this.currentTrack.info.type===`audio`&&this.currentTrack.info.numberOfChannels!==-1&&this.currentTrack.info.sampleRate!==-1){t===ZE.aac?(this.currentTrack.info.codec=`aac`,this.currentTrack.info.aacCodecInfo={isMpeg2:this.currentTrack.codecId.includes(`MPEG2`)},this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):this.currentTrack.codecId===ZE.mp3?this.currentTrack.info.codec=`mp3`:t===ZE.opus?(this.currentTrack.info.codec=`opus`,this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate,this.currentTrack.info.sampleRate=Tw):t===ZE.vorbis?(this.currentTrack.info.codec=`vorbis`,this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):t===ZE.flac?(this.currentTrack.info.codec=`flac`,this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):this.currentTrack.codecId===`A_PCM/INT/LIT`?this.currentTrack.info.bitDepth===8?this.currentTrack.info.codec=`pcm-u8`:this.currentTrack.info.bitDepth===16?this.currentTrack.info.codec=`pcm-s16`:this.currentTrack.info.bitDepth===24?this.currentTrack.info.codec=`pcm-s24`:this.currentTrack.info.bitDepth===32&&(this.currentTrack.info.codec=`pcm-s32`):this.currentTrack.codecId===`A_PCM/INT/BIG`?this.currentTrack.info.bitDepth===8?this.currentTrack.info.codec=`pcm-u8`:this.currentTrack.info.bitDepth===16?this.currentTrack.info.codec=`pcm-s16be`:this.currentTrack.info.bitDepth===24?this.currentTrack.info.codec=`pcm-s24be`:this.currentTrack.info.bitDepth===32&&(this.currentTrack.info.codec=`pcm-s32be`):this.currentTrack.codecId===`A_PCM/FLOAT/IEEE`&&(this.currentTrack.info.bitDepth===32?this.currentTrack.info.codec=`pcm-f32`:this.currentTrack.info.bitDepth===64&&(this.currentTrack.info.codec=`pcm-f64`));let e=this.currentTrack,n=new _E(this.input,new cD(e));this.currentTrack.inputTrack=n,this.currentSegment.tracks.push(this.currentTrack)}}this.currentTrack=null;break;case Q.TrackNumber:if(!this.currentTrack)break;this.currentTrack.id=VE(e,i);break;case Q.TrackType:{if(!this.currentTrack)break;let t=VE(e,i);t===1?this.currentTrack.info={type:`video`,width:-1,height:-1,rotation:0,codec:null,codecDescription:null,colorSpace:null,alphaMode:!1}:t===2&&(this.currentTrack.info={type:`audio`,numberOfChannels:-1,sampleRate:-1,bitDepth:-1,codec:null,codecDescription:null,aacCodecInfo:null})}break;case Q.FlagEnabled:if(!this.currentTrack)break;VE(e,i)||(this.currentSegment.tracks.pop(),this.currentTrack=null);break;case Q.FlagDefault:if(!this.currentTrack)break;this.currentTrack.disposition.default=!!VE(e,i);break;case Q.FlagForced:if(!this.currentTrack)break;this.currentTrack.disposition.forced=!!VE(e,i);break;case Q.FlagOriginal:if(!this.currentTrack)break;this.currentTrack.disposition.original=!!VE(e,i);break;case Q.FlagHearingImpaired:if(!this.currentTrack)break;this.currentTrack.disposition.hearingImpaired=!!VE(e,i);break;case Q.FlagVisualImpaired:if(!this.currentTrack)break;this.currentTrack.disposition.visuallyImpaired=!!VE(e,i);break;case Q.FlagCommentary:if(!this.currentTrack)break;this.currentTrack.disposition.commentary=!!VE(e,i);break;case Q.CodecID:if(!this.currentTrack)break;this.currentTrack.codecId=KE(e,i);break;case Q.CodecPrivate:if(!this.currentTrack)break;this.currentTrack.codecPrivate=yO(e,i);break;case Q.DefaultDuration:if(!this.currentTrack)break;this.currentTrack.defaultDuration=this.currentTrack.segment.timestampFactor*VE(e,i)/1e9;break;case Q.Name:if(!this.currentTrack)break;this.currentTrack.name=qE(e,i);break;case Q.Language:if(!this.currentTrack||this.currentTrack.languageCode!==`und`)break;this.currentTrack.languageCode=KE(e,i),NC(this.currentTrack.languageCode)||(this.currentTrack.languageCode=`und`);break;case Q.LanguageBCP47:{if(!this.currentTrack)break;let t=KE(e,i).split(`-`)[0];t?this.currentTrack.languageCode=t:this.currentTrack.languageCode=`und`}break;case Q.Video:if(this.currentTrack?.info?.type!==`video`)break;this.readContiguousElements(e.slice(a,i));break;case Q.PixelWidth:if(this.currentTrack?.info?.type!==`video`)break;this.currentTrack.info.width=VE(e,i);break;case Q.PixelHeight:if(this.currentTrack?.info?.type!==`video`)break;this.currentTrack.info.height=VE(e,i);break;case Q.AlphaMode:if(this.currentTrack?.info?.type!==`video`)break;this.currentTrack.info.alphaMode=VE(e,i)===1;break;case Q.Colour:if(this.currentTrack?.info?.type!==`video`)break;this.currentTrack.info.colorSpace={},this.readContiguousElements(e.slice(a,i));break;case Q.MatrixCoefficients:{if(this.currentTrack?.info?.type!==`video`||!this.currentTrack.info.colorSpace)break;let t=cC[VE(e,i)]??null;this.currentTrack.info.colorSpace.matrix=t}break;case Q.Range:if(this.currentTrack?.info?.type!==`video`||!this.currentTrack.info.colorSpace)break;this.currentTrack.info.colorSpace.fullRange=VE(e,i)===2;break;case Q.TransferCharacteristics:{if(this.currentTrack?.info?.type!==`video`||!this.currentTrack.info.colorSpace)break;let t=oC[VE(e,i)]??null;this.currentTrack.info.colorSpace.transfer=t}break;case Q.Primaries:{if(this.currentTrack?.info?.type!==`video`||!this.currentTrack.info.colorSpace)break;let t=iC[VE(e,i)]??null;this.currentTrack.info.colorSpace.primaries=t}break;case Q.Projection:if(this.currentTrack?.info?.type!==`video`)break;this.readContiguousElements(e.slice(a,i));break;case Q.ProjectionPoseRoll:{if(this.currentTrack?.info?.type!==`video`)break;let t=-JE(e,i);try{this.currentTrack.info.rotation=qS(t)}catch{}}break;case Q.Audio:if(this.currentTrack?.info?.type!==`audio`)break;this.readContiguousElements(e.slice(a,i));break;case Q.SamplingFrequency:if(this.currentTrack?.info?.type!==`audio`)break;this.currentTrack.info.sampleRate=JE(e,i);break;case Q.Channels:if(this.currentTrack?.info?.type!==`audio`)break;this.currentTrack.info.numberOfChannels=VE(e,i);break;case Q.BitDepth:if(this.currentTrack?.info?.type!==`audio`)break;this.currentTrack.info.bitDepth=VE(e,i);break;case Q.CuePoint:if(!this.currentSegment)break;this.readContiguousElements(e.slice(a,i)),this.currentCueTime=null;break;case Q.CueTime:this.currentCueTime=VE(e,i);break;case Q.CueTrackPositions:{if(this.currentCueTime===null)break;X(this.currentSegment);let t={time:this.currentCueTime,trackId:-1,clusterPosition:-1};this.currentSegment.cuePoints.push(t),this.readContiguousElements(e.slice(a,i)),(t.trackId===-1||t.clusterPosition===-1)&&this.currentSegment.cuePoints.pop()}break;case Q.CueTrack:{let t=this.currentSegment?.cuePoints[this.currentSegment.cuePoints.length-1];if(!t)break;t.trackId=VE(e,i)}break;case Q.CueClusterPosition:{let t=this.currentSegment?.cuePoints[this.currentSegment.cuePoints.length-1];if(!t)break;X(this.currentSegment),t.clusterPosition=this.currentSegment.dataStartPos+VE(e,i)}break;case Q.Timestamp:if(!this.currentCluster)break;this.currentCluster.timestamp=VE(e,i);break;case Q.SimpleBlock:{if(!this.currentCluster)break;let t=BE(e);if(t===null)break;let n=this.getTrackDataInCluster(this.currentCluster,t);if(!n)break;let r=wO(e),o=bO(e),s=o>>1&3,c=!!(o&128);n.track.info?.type===`audio`&&n.track.info.codec&&(c=!0);let l=yO(e,i-(e.filePos-a)),u=n.track.decodingInstructions.length>0;n.blocks.push({timestamp:r,duration:0,isKeyFrame:c,data:l,lacing:s,decoded:!u,mainAdditional:null})}break;case Q.BlockGroup:if(!this.currentCluster)break;this.readContiguousElements(e.slice(a,i)),this.currentBlock=null;break;case Q.Block:{if(!this.currentCluster)break;let t=BE(e);if(t===null)break;let n=this.getTrackDataInCluster(this.currentCluster,t);if(!n)break;let r=wO(e),o=bO(e)>>1&3,s=yO(e,i-(e.filePos-a)),c=n.track.decodingInstructions.length>0;this.currentBlock={timestamp:r,duration:0,isKeyFrame:!0,data:s,lacing:o,decoded:!c,mainAdditional:null},n.blocks.push(this.currentBlock)}break;case Q.BlockAdditions:this.readContiguousElements(e.slice(a,i));break;case Q.BlockMore:if(!this.currentBlock)break;this.currentBlockAdditional={addId:1,data:null},this.readContiguousElements(e.slice(a,i)),this.currentBlockAdditional.data&&this.currentBlockAdditional.addId===1&&(this.currentBlock.mainAdditional=this.currentBlockAdditional.data),this.currentBlockAdditional=null;break;case Q.BlockAdditional:if(!this.currentBlockAdditional)break;this.currentBlockAdditional.data=yO(e,i);break;case Q.BlockAddID:if(!this.currentBlockAdditional)break;this.currentBlockAdditional.addId=VE(e,i);break;case Q.BlockDuration:if(!this.currentBlock)break;this.currentBlock.duration=VE(e,i);break;case Q.ReferenceBlock:if(!this.currentBlock)break;this.currentBlock.isKeyFrame=!1;break;case Q.Tag:this.currentTagTargetIsMovie=!0,this.readContiguousElements(e.slice(a,i));break;case Q.Targets:this.readContiguousElements(e.slice(a,i));break;case Q.TargetTypeValue:VE(e,i)!==50&&(this.currentTagTargetIsMovie=!1);break;case Q.TagTrackUID:case Q.TagEditionUID:case Q.TagChapterUID:case Q.TagAttachmentUID:this.currentTagTargetIsMovie=!1;break;case Q.SimpleTag:if(!this.currentTagTargetIsMovie)break;this.currentSimpleTagName=null,this.readContiguousElements(e.slice(a,i));break;case Q.TagName:this.currentSimpleTagName=qE(e,i);break;case Q.TagString:{if(!this.currentSimpleTagName)break;let t=qE(e,i);this.processTagValue(this.currentSimpleTagName,t)}break;case Q.TagBinary:{if(!this.currentSimpleTagName)break;let t=yO(e,i);this.processTagValue(this.currentSimpleTagName,t)}break;case Q.AttachedFile:{if(!this.currentSegment)break;this.currentAttachedFile={fileUid:null,fileName:null,fileMediaType:null,fileData:null,fileDescription:null},this.readContiguousElements(e.slice(a,i));let t=this.currentSegment.metadataTags;if(this.currentAttachedFile.fileUid&&this.currentAttachedFile.fileData&&(t.raw??={},t.raw[this.currentAttachedFile.fileUid.toString()]=new tw(this.currentAttachedFile.fileData,this.currentAttachedFile.fileMediaType??void 0,this.currentAttachedFile.fileName??void 0,this.currentAttachedFile.fileDescription??void 0)),this.currentAttachedFile.fileMediaType?.startsWith(`image/`)&&this.currentAttachedFile.fileData){let e=this.currentAttachedFile.fileName,n=`unknown`;if(e){let t=e.toLowerCase();t.startsWith(`cover.`)?n=`coverFront`:t.startsWith(`back.`)&&(n=`coverBack`)}t.images??=[],t.images.push({data:this.currentAttachedFile.fileData,mimeType:this.currentAttachedFile.fileMediaType,kind:n,name:this.currentAttachedFile.fileName??void 0,description:this.currentAttachedFile.fileDescription??void 0})}this.currentAttachedFile=null}break;case Q.FileUID:if(!this.currentAttachedFile)break;this.currentAttachedFile.fileUid=HE(e,i);break;case Q.FileName:if(!this.currentAttachedFile)break;this.currentAttachedFile.fileName=qE(e,i);break;case Q.FileMediaType:if(!this.currentAttachedFile)break;this.currentAttachedFile.fileMediaType=KE(e,i);break;case Q.FileData:if(!this.currentAttachedFile)break;this.currentAttachedFile.fileData=yO(e,i);break;case Q.FileDescription:if(!this.currentAttachedFile)break;this.currentAttachedFile.fileDescription=qE(e,i);break;case Q.ContentEncodings:if(!this.currentTrack)break;this.readContiguousElements(e.slice(a,i)),this.currentTrack.decodingInstructions.sort((e,t)=>t.order-e.order);break;case Q.ContentEncoding:this.currentDecodingInstruction={order:0,scope:tD.Block,data:null},this.readContiguousElements(e.slice(a,i)),this.currentDecodingInstruction.data&&this.currentTrack.decodingInstructions.push(this.currentDecodingInstruction),this.currentDecodingInstruction=null;break;case Q.ContentEncodingOrder:if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.order=VE(e,i);break;case Q.ContentEncodingScope:if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.scope=VE(e,i);break;case Q.ContentCompression:if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.data={type:`decompress`,algorithm:nD.Zlib,settings:null},this.readContiguousElements(e.slice(a,i));break;case Q.ContentCompAlgo:if(this.currentDecodingInstruction?.data?.type!==`decompress`)break;this.currentDecodingInstruction.data.algorithm=VE(e,i);break;case Q.ContentCompSettings:if(this.currentDecodingInstruction?.data?.type!==`decompress`)break;this.currentDecodingInstruction.data.settings=yO(e,i);break;case Q.ContentEncryption:if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.data={type:`decrypt`};break}return e.filePos=a+i,!0}decodeBlockData(e,t){X(e.decodingInstructions.length>0);let n=t;for(let t of e.decodingInstructions)switch(X(t.data),t.data.type){case`decompress`:switch(t.data.algorithm){case nD.HeaderStripping:if(t.data.settings&&t.data.settings.length>0){let e=t.data.settings,r=new Uint8Array(e.length+n.length);r.set(e,0),r.set(n,e.length),n=r}break;default:}break;default:}return n}processTagValue(e,t){if(!this.currentSegment?.metadataTags)return;let n=this.currentSegment.metadataTags;if(n.raw??={},n.raw[e]??=t,typeof t==`string`)switch(e.toLowerCase()){case`title`:n.title??=t;break;case`description`:n.description??=t;break;case`artist`:n.artist??=t;break;case`album`:n.album??=t;break;case`album_artist`:n.albumArtist??=t;break;case`genre`:n.genre??=t;break;case`comment`:n.comment??=t;break;case`lyrics`:n.lyrics??=t;break;case`date`:{let e=new Date(t);Number.isNaN(e.getTime())||(n.date??=e)}break;case`track_number`:case`part_number`:{let e=t.split(`/`),r=Number.parseInt(e[0],10),i=e[1]&&Number.parseInt(e[1],10);Number.isInteger(r)&&r>0&&(n.trackNumber??=r),i&&Number.isInteger(i)&&i>0&&(n.tracksTotal??=i)}break;case`disc_number`:case`disc`:{let e=t.split(`/`),r=Number.parseInt(e[0],10),i=e[1]&&Number.parseInt(e[1],10);Number.isInteger(r)&&r>0&&(n.discNumber??=r),i&&Number.isInteger(i)&&i>0&&(n.discsTotal??=i)}break}}},oD=class{constructor(e){this.internalTrack=e,this.packetToClusterLocation=new WeakMap}getId(){return this.internalTrack.id}getCodec(){throw Error(`Not implemented on base class.`)}getInternalCodecId(){return this.internalTrack.codecId}async computeDuration(){let e=await this.getPacket(1/0,{metadataOnly:!0});return(e?.timestamp??0)+(e?.duration??0)}getName(){return this.internalTrack.name}getLanguageCode(){return this.internalTrack.languageCode}async getFirstTimestamp(){return(await this.getFirstPacket({metadataOnly:!0}))?.timestamp??0}getTimeResolution(){return this.internalTrack.segment.timestampFactor}getDisposition(){return this.internalTrack.disposition}async getFirstPacket(e){return this.performClusterLookup(null,e=>e.trackData.get(this.internalTrack.id)?{blockIndex:0,correctBlockFound:!0}:{blockIndex:-1,correctBlockFound:!1},-1/0,1/0,e)}intoTimescale(e){return kC(e*this.internalTrack.segment.timestampFactor)}async getPacket(e,t){let n=this.intoTimescale(e);return this.performClusterLookup(null,e=>{let t=e.trackData.get(this.internalTrack.id);if(!t)return{blockIndex:-1,correctBlockFound:!1};let r=hC(t.presentationTimestamps,n,e=>e.timestamp);return{blockIndex:r===-1?-1:t.presentationTimestamps[r].blockIndex,correctBlockFound:r!==-1&&n<t.endTimestamp}},n,n,t)}async getNextPacket(e,t){let n=this.packetToClusterLocation.get(e);if(n===void 0)throw Error(`Packet was not created from this track.`);return this.performClusterLookup(n.cluster,e=>{if(e===n.cluster){let t=e.trackData.get(this.internalTrack.id);if(n.blockIndex+1<t.blocks.length)return{blockIndex:n.blockIndex+1,correctBlockFound:!0}}else if(e.trackData.get(this.internalTrack.id))return{blockIndex:0,correctBlockFound:!0};return{blockIndex:-1,correctBlockFound:!1}},-1/0,1/0,t)}async getKeyPacket(e,t){let n=this.intoTimescale(e);return this.performClusterLookup(null,e=>{let t=e.trackData.get(this.internalTrack.id);if(!t)return{blockIndex:-1,correctBlockFound:!1};let r=yC(t.presentationTimestamps,e=>t.blocks[e.blockIndex].isKeyFrame&&e.timestamp<=n);return{blockIndex:r===-1?-1:t.presentationTimestamps[r].blockIndex,correctBlockFound:r!==-1&&n<t.endTimestamp}},n,n,t)}async getNextKeyPacket(e,t){let n=this.packetToClusterLocation.get(e);if(n===void 0)throw Error(`Packet was not created from this track.`);return this.performClusterLookup(n.cluster,e=>{if(e===n.cluster){let t=e.trackData.get(this.internalTrack.id).blocks.findIndex((e,t)=>e.isKeyFrame&&t>n.blockIndex);if(t!==-1)return{blockIndex:t,correctBlockFound:!0}}else{let t=e.trackData.get(this.internalTrack.id);if(t&&t.firstKeyFrameTimestamp!==null){let e=t.blocks.findIndex(e=>e.isKeyFrame);return X(e!==-1),{blockIndex:e,correctBlockFound:!0}}}return{blockIndex:-1,correctBlockFound:!1}},-1/0,1/0,t)}async fetchPacketInCluster(e,t,n){if(t===-1)return null;let r=e.trackData.get(this.internalTrack.id).blocks[t];X(r),r.decoded||=(r.data=this.internalTrack.demuxer.decodeBlockData(this.internalTrack,r.data),!0);let i=n.metadataOnly?DT:r.data,a=r.timestamp/this.internalTrack.segment.timestampFactor,o=r.duration/this.internalTrack.segment.timestampFactor,s={};r.mainAdditional&&this.internalTrack.info?.type===`video`&&this.internalTrack.info.alphaMode&&(s.alpha=n.metadataOnly?DT:r.mainAdditional,s.alphaByteLength=r.mainAdditional.byteLength);let c=new OT(i,r.isKeyFrame?`key`:`delta`,a,o,e.dataStartPos+t,r.data.byteLength,s);return this.packetToClusterLocation.set(c,{cluster:e,blockIndex:t}),c}async performClusterLookup(e,t,n,r,i){let{demuxer:a,segment:o}=this.internalTrack,s=null,c=null,l=-1;if(e){let{blockIndex:n,correctBlockFound:r}=t(e);if(r)return this.fetchPacketInCluster(e,n,i);n!==-1&&(c=e,l=n)}let u=hC(this.internalTrack.cuePoints,n,e=>e.time),d=u===-1?null:this.internalTrack.cuePoints[u],f=hC(this.internalTrack.clusterPositionCache,n,e=>e.startTimestamp),p=f===-1?null:this.internalTrack.clusterPositionCache[f],m=Math.max(d?.clusterPosition??0,p?.elementStartPos??0)||null,h;for(e?m===null||e.elementStartPos>=m?(h=e.elementEndPos,s=e):h=m:h=m??o.clusterSeekStartPos;o.elementEndPos===null||h<=o.elementEndPos-2;){if(s){let e=s.trackData.get(this.internalTrack.id);if(e&&e.startTimestamp>r)break}let e=a.reader.requestSliceRange(h,2,16);if(e instanceof Promise&&(e=await e),!e)break;let n=h,u=GE(e);if(!u||!LE.includes(u.id)&&u.id!==Q.Void){let e=await XE(a.reader,n,LE,Math.min(o.elementEndPos??1/0,n+iD));if(e){h=e;continue}else break}let d=u.id,f=u.size,p=e.filePos;if(d===Q.Cluster){s=await a.readCluster(n,o),f=s.elementEndPos-p;let{blockIndex:e,correctBlockFound:r}=t(s);if(r)return this.fetchPacketInCluster(s,e,i);e!==-1&&(c=s,l=e)}f===null&&(X(d!==Q.Cluster),f=(await YE(a.reader,p,RE,o.elementEndPos)).pos-p);let m=p+f;if(o.elementEndPos===null){let e=a.reader.requestSliceRange(m,2,16);if(e instanceof Promise&&(e=await e),!e)break;if(UE(e)===Q.Segment){o.elementEndPos=m;break}}h=m}if(d&&(!c||c.elementStartPos<d.clusterPosition)){let e=this.internalTrack.cuePoints[u-1];X(!e||e.time<d.time);let n=e?.time??-1/0;return this.performClusterLookup(null,t,n,r,i)}return c?this.fetchPacketInCluster(c,l,i):null}},sD=class extends oD{constructor(e){super(e),this.decoderConfigPromise=null,this.internalTrack=e}getCodec(){return this.internalTrack.info.codec}getCodedWidth(){return this.internalTrack.info.width}getCodedHeight(){return this.internalTrack.info.height}getRotation(){return this.internalTrack.info.rotation}async getColorSpace(){return{primaries:this.internalTrack.info.colorSpace?.primaries,transfer:this.internalTrack.info.colorSpace?.transfer,matrix:this.internalTrack.info.colorSpace?.matrix,fullRange:this.internalTrack.info.colorSpace?.fullRange}}async canBeTransparent(){return this.internalTrack.info.alphaMode}async getDecoderConfig(){return this.internalTrack.info.codec?this.decoderConfigPromise??=(async()=>{let e=null;return(this.internalTrack.info.codec===`vp9`||this.internalTrack.info.codec===`av1`||this.internalTrack.info.codec===`avc`&&!this.internalTrack.info.codecDescription||this.internalTrack.info.codec===`hevc`&&!this.internalTrack.info.codecDescription)&&(e=await this.getFirstPacket({})),{codec:vw({width:this.internalTrack.info.width,height:this.internalTrack.info.height,codec:this.internalTrack.info.codec,codecDescription:this.internalTrack.info.codecDescription,colorSpace:this.internalTrack.info.colorSpace,avcType:1,avcCodecInfo:this.internalTrack.info.codec===`avc`&&e?Zw(e.data):null,hevcCodecInfo:this.internalTrack.info.codec===`hevc`&&e?rT(e.data):null,vp9CodecInfo:this.internalTrack.info.codec===`vp9`&&e?fT(e.data):null,av1CodecInfo:this.internalTrack.info.codec===`av1`&&e?mT(e.data):null}),codedWidth:this.internalTrack.info.width,codedHeight:this.internalTrack.info.height,description:this.internalTrack.info.codecDescription??void 0,colorSpace:this.internalTrack.info.colorSpace??void 0}})():null}},cD=class extends oD{constructor(e){super(e),this.decoderConfig=null,this.internalTrack=e}getCodec(){return this.internalTrack.info.codec}getNumberOfChannels(){return this.internalTrack.info.numberOfChannels}getSampleRate(){return this.internalTrack.info.sampleRate}async getDecoderConfig(){return this.internalTrack.info.codec?this.decoderConfig??={codec:bw({codec:this.internalTrack.info.codec,codecDescription:this.internalTrack.info.codecDescription,aacCodecInfo:this.internalTrack.info.aacCodecInfo}),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:this.internalTrack.info.codecDescription??void 0}:null}},lD=[44100,48e3,32e3],uD=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1,-1,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1,-1,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,16,24,32,40,48,56,64,80,96,112,128,144,160,-1,-1,8,16,24,32,40,48,56,64,80,96,112,128,144,160,-1,-1,32,48,56,64,80,96,112,128,144,160,176,192,224,256,-1],dD=(e,t,n,r,i)=>t===0?0:t===1?Math.floor(144*n/(r<<e))+i:t===2?Math.floor(144*n/r)+i:(Math.floor(12*n/r)+i)*4,fD=(e,t)=>e===3?t===3?21:36:t===3?13:21,pD=(e,t)=>{let n=e>>>24,r=e>>>16&255,i=e>>>8&255,a=e&255;if(n!==255&&r!==255&&i!==255&&a!==255)return{header:null,bytesAdvanced:4};if(n!==255||(r&224)!=224)return{header:null,bytesAdvanced:1};let o=0,s=0;r&16?o=r&8?0:1:(o=1,s=1);let c=r>>3&3,l=r>>1&3,u=i>>4&15,d=(i>>2&3)%3,f=i>>1&1,p=a>>6&3,m=a>>4&3,h=a>>3&1,g=a>>2&1,_=a&3,v=uD[o*16*4+l*16+u];if(v===-1)return{header:null,bytesAdvanced:1};let y=v*1e3,b=lD[d]>>o+s,x=dD(o,l,y,b,f);if(t!==null&&t<x)return{header:null,bytesAdvanced:1};let S;return S=c===3?l===3?384:1152:l===3?384:l===2?1152:576,{header:{totalSize:x,mpegVersionId:c,layer:l,bitrate:y,frequencyIndex:d,sampleRate:b,channel:p,modeExtension:m,copyright:h,original:g,emphasis:_,audioSamplesInFrame:S},bytesAdvanced:1}},mD=e=>{let t=2130706432,n=0;for(;t!==0;)n>>=1,n|=e&t,t>>=8;return n},hD;(function(e){e[e.Unsynchronisation=128]=`Unsynchronisation`,e[e.ExtendedHeader=64]=`ExtendedHeader`,e[e.ExperimentalIndicator=32]=`ExperimentalIndicator`,e[e.Footer=16]=`Footer`})(hD||={});var gD;(function(e){e[e.ISO_8859_1=0]=`ISO_8859_1`,e[e.UTF_16_WITH_BOM=1]=`UTF_16_WITH_BOM`,e[e.UTF_16_BE_NO_BOM=2]=`UTF_16_BE_NO_BOM`,e[e.UTF_8=3]=`UTF_8`})(gD||={});var _D=`Blues.Classic rock.Country.Dance.Disco.Funk.Grunge.Hip-hop.Jazz.Metal.New age.Oldies.Other.Pop.Rhythm and blues.Rap.Reggae.Rock.Techno.Industrial.Alternative.Ska.Death metal.Pranks.Soundtrack.Euro-techno.Ambient.Trip-hop.Vocal.Jazz & funk.Fusion.Trance.Classical.Instrumental.Acid.House.Game.Sound clip.Gospel.Noise.Alternative rock.Bass.Soul.Punk.Space.Meditative.Instrumental pop.Instrumental rock.Ethnic.Gothic.Darkwave.Techno-industrial.Electronic.Pop-folk.Eurodance.Dream.Southern rock.Comedy.Cult.Gangsta.Top 40.Christian rap.Pop/funk.Jungle music.Native US.Cabaret.New wave.Psychedelic.Rave.Showtunes.Trailer.Lo-fi.Tribal.Acid punk.Acid jazz.Polka.Retro.Musical.Rock 'n' roll.Hard rock.Folk.Folk rock.National folk.Swing.Fast fusion.Bebop.Latin.Revival.Celtic.Bluegrass.Avantgarde.Gothic rock.Progressive rock.Psychedelic rock.Symphonic rock.Slow rock.Big band.Chorus.Easy listening.Acoustic.Humour.Speech.Chanson.Opera.Chamber music.Sonata.Symphony.Booty bass.Primus.Porn groove.Satire.Slow jam.Club.Tango.Samba.Folklore.Ballad.Power ballad.Rhythmic Soul.Freestyle.Duet.Punk rock.Drum solo.A cappella.Euro-house.Dance hall.Goa music.Drum & bass.Club-house.Hardcore techno.Terror.Indie.Britpop.Negerpunk.Polsk punk.Beat.Christian gangsta rap.Heavy metal.Black metal.Crossover.Contemporary Christian.Christian rock.Merengue.Salsa.Thrash metal.Anime.Jpop.Synthpop.Christmas.Art rock.Baroque.Bhangra.Big beat.Breakbeat.Chillout.Downtempo.Dub.EBM.Eclectic.Electro.Electroclash.Emo.Experimental.Garage.Global.IDM.Illbient.Industro-Goth.Jam Band.Krautrock.Leftfield.Lounge.Math rock.New romantic.Nu-breakz.Post-punk.Post-rock.Psytrance.Shoegaze.Space rock.Trop rock.World music.Neoclassical.Audiobook.Audio theatre.Neue Deutsche Welle.Podcast.Indie rock.G-Funk.Dubstep.Garage rock.Psybient`.split(`.`),vD=(e,t)=>{let n=e.filePos;t.raw??={},t.raw.TAG??=yO(e,125),e.filePos=n;let r=yD(e,30);r&&(t.title??=r);let i=yD(e,30);i&&(t.artist??=i);let a=yD(e,30);a&&(t.album??=a);let o=yD(e,4),s=Number.parseInt(o,10);Number.isInteger(s)&&s>0&&(t.date??=new Date(s,0,1));let c=yO(e,30),l;if(c[28]===0&&c[29]!==0){let n=c[29];n>0&&(t.trackNumber??=n),e.skip(-30),l=yD(e,28),e.skip(2)}else e.skip(-30),l=yD(e,30);l&&(t.comment??=l);let u=bO(e);u<_D.length&&(t.genre??=_D[u])},yD=(e,t)=>{let n=yO(e,t),r=JC(n.indexOf(0),n.length),i=n.subarray(0,r),a=``;for(let e=0;e<i.length;e++)a+=String.fromCharCode(i[e]);return a.trimEnd()},bD=e=>{let t=e.filePos,n=FO(e,3),r=bO(e),i=bO(e),a=bO(e),o=$(e);return n!==`ID3`||r===255||i===255||o&2155905152?(e.filePos=t,null):{majorVersion:r,revision:i,flags:a,size:mD(o)}},xD=(e,t,n)=>{if(![2,3,4].includes(t.majorVersion)){console.warn(`Unsupported ID3v2 major version: ${t.majorVersion}`);return}let r=new SD(t,yO(e,t.size));if(t.flags&hD.Footer&&r.removeFooter(),t.flags&hD.Unsynchronisation&&t.majorVersion===3&&r.ununsynchronizeAll(),t.flags&hD.ExtendedHeader){let e=r.readU32();t.majorVersion===3?r.pos+=e:r.pos+=e-4}for(;r.pos<=r.bytes.length-r.frameHeaderSize();){let e=r.readId3V2Frame();if(!e)break;let i=r.pos,a=r.pos+e.size,o=!1,s=!1,c=!1;if(t.majorVersion===3?(o=!!(e.flags&64),s=!!(e.flags&128)):t.majorVersion===4&&(o=!!(e.flags&4),s=!!(e.flags&8),c=!!(e.flags&2)||!!(t.flags&hD.Unsynchronisation)),o){console.warn(`Skipping encrypted ID3v2 frame ${e.id}`),r.pos=a;continue}if(s){console.warn(`Skipping compressed ID3v2 frame ${e.id}`),r.pos=a;continue}switch(c&&r.ununsynchronizeRegion(r.pos,a),n.raw??={},e.id[0]===`T`?n.raw[e.id]??=r.readId3V2EncodingAndText(a):n.raw[e.id]??=r.readBytes(e.size),r.pos=i,e.id){case`TIT2`:case`TT2`:n.title??=r.readId3V2EncodingAndText(a);break;case`TIT3`:case`TT3`:n.description??=r.readId3V2EncodingAndText(a);break;case`TPE1`:case`TP1`:n.artist??=r.readId3V2EncodingAndText(a);break;case`TALB`:case`TAL`:n.album??=r.readId3V2EncodingAndText(a);break;case`TPE2`:case`TP2`:n.albumArtist??=r.readId3V2EncodingAndText(a);break;case`TRCK`:case`TRK`:{let e=r.readId3V2EncodingAndText(a).split(`/`),t=Number.parseInt(e[0],10),i=e[1]&&Number.parseInt(e[1],10);Number.isInteger(t)&&t>0&&(n.trackNumber??=t),i&&Number.isInteger(i)&&i>0&&(n.tracksTotal??=i)}break;case`TPOS`:case`TPA`:{let e=r.readId3V2EncodingAndText(a).split(`/`),t=Number.parseInt(e[0],10),i=e[1]&&Number.parseInt(e[1],10);Number.isInteger(t)&&t>0&&(n.discNumber??=t),i&&Number.isInteger(i)&&i>0&&(n.discsTotal??=i)}break;case`TCON`:case`TCO`:{let e=r.readId3V2EncodingAndText(a),t=/^\((\d+)\)/.exec(e);if(t){let e=Number.parseInt(t[1]);if(_D[e]!==void 0){n.genre??=_D[e];break}}if(t=/^\d+$/.exec(e),t){let e=Number.parseInt(t[0]);if(_D[e]!==void 0){n.genre??=_D[e];break}}n.genre??=e}break;case`TDRC`:case`TDAT`:{let e=r.readId3V2EncodingAndText(a),t=new Date(e);Number.isNaN(t.getTime())||(n.date??=t)}break;case`TYER`:case`TYE`:{let e=r.readId3V2EncodingAndText(a),t=Number.parseInt(e,10);Number.isInteger(t)&&(n.date??=new Date(t,0,1))}break;case`USLT`:case`ULT`:{let e=r.readU8();r.pos+=3,r.readId3V2Text(e,a),n.lyrics??=r.readId3V2Text(e,a)}break;case`COMM`:case`COM`:{let e=r.readU8();r.pos+=3,r.readId3V2Text(e,a),n.comment??=r.readId3V2Text(e,a)}break;case`APIC`:case`PIC`:{let e=r.readId3V2TextEncoding(),i;if(t.majorVersion===2){let e=r.readAscii(3);i=e===`PNG`?`image/png`:e===`JPG`?`image/jpeg`:`image/*`}else i=r.readId3V2Text(e,a);let o=r.readU8(),s=r.readId3V2Text(e,a).trimEnd(),c=a-r.pos;if(c>=0){let e=r.readBytes(c);n.images||=[],n.images.push({data:e,mimeType:i,kind:o===3?`coverFront`:o===4?`coverBack`:`unknown`,description:s})}}break;default:r.pos+=e.size;break}r.pos=a}},SD=class{constructor(e,t){this.header=e,this.bytes=t,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}frameHeaderSize(){return this.header.majorVersion===2?6:10}ununsynchronizeAll(){let e=[];for(let t=0;t<this.bytes.length;t++){let n=this.bytes[t];e.push(n),n===255&&t!==this.bytes.length-1&&this.bytes[t]===0&&t++}this.bytes=new Uint8Array(e),this.view=new DataView(this.bytes.buffer)}ununsynchronizeRegion(e,t){let n=[];for(let r=e;r<t;r++){let e=this.bytes[r];n.push(e),e===255&&r!==t-1&&this.bytes[r+1]===0&&r++}let r=this.bytes.subarray(0,e),i=this.bytes.subarray(t);this.bytes=new Uint8Array(r.length+n.length+i.length),this.bytes.set(r,0),this.bytes.set(n,r.length),this.bytes.set(i,r.length+n.length),this.view=new DataView(this.bytes.buffer)}removeFooter(){this.bytes=this.bytes.subarray(0,this.bytes.length-10),this.view=new DataView(this.bytes.buffer)}readBytes(e){let t=this.bytes.subarray(this.pos,this.pos+e);return this.pos+=e,t}readU8(){let e=this.view.getUint8(this.pos);return this.pos+=1,e}readU16(){let e=this.view.getUint16(this.pos,!1);return this.pos+=2,e}readU24(){let e=this.view.getUint16(this.pos,!1),t=this.view.getUint8(this.pos+1);return this.pos+=3,e*256+t}readU32(){let e=this.view.getUint32(this.pos,!1);return this.pos+=4,e}readAscii(e){let t=``;for(let n=0;n<e;n++)t+=String.fromCharCode(this.view.getUint8(this.pos+n));return this.pos+=e,t}readId3V2Frame(){if(this.header.majorVersion===2){let e=this.readAscii(3);return e===`\0\0\0`?null:{id:e,size:this.readU24(),flags:0}}else{let e=this.readAscii(4);if(e===`\0\0\0\0`)return null;let t=this.readU32(),n=this.header.majorVersion===4?mD(t):t,r=this.readU16(),i=this.pos,a=e=>{let t=this.pos+e;if(t>this.bytes.length)return!1;if(t<=this.bytes.length-this.frameHeaderSize()){this.pos+=e;let t=this.readAscii(4);if(t!==`\0\0\0\0`&&!/[0-9A-Z]{4}/.test(t))return!1}return!0};if(!a(n)){let e=this.header.majorVersion===4?t:mD(t);a(e)&&(n=e)}return this.pos=i,{id:e,size:n,flags:r}}}readId3V2TextEncoding(){let e=this.readU8();if(e>3)throw Error(`Unsupported text encoding: ${e}`);return e}readId3V2Text(e,t){let n=this.pos,r=this.readBytes(t-this.pos);switch(e){case gD.ISO_8859_1:{let e=``;for(let t=0;t<r.length;t++){let i=r[t];if(i===0){this.pos=n+t+1;break}e+=String.fromCharCode(i)}return e}case gD.UTF_16_WITH_BOM:if(r[0]===255&&r[1]===254){let e=new TextDecoder(`utf-16le`),t=JC(r.findIndex((e,t)=>e===0&&r[t+1]===0&&t%2==0),r.length);return this.pos=n+Math.min(t+2,r.length),e.decode(r.subarray(2,t))}else if(r[0]===254&&r[1]===255){let e=new TextDecoder(`utf-16be`),t=JC(r.findIndex((e,t)=>e===0&&r[t+1]===0&&t%2==0),r.length);return this.pos=n+Math.min(t+2,r.length),e.decode(r.subarray(2,t))}else{let e=JC(r.findIndex(e=>e===0),r.length);return this.pos=n+Math.min(e+1,r.length),eC.decode(r.subarray(0,e))}case gD.UTF_16_BE_NO_BOM:{let e=new TextDecoder(`utf-16be`),t=JC(r.findIndex((e,t)=>e===0&&r[t+1]===0&&t%2==0),r.length);return this.pos=n+Math.min(t+2,r.length),e.decode(r.subarray(0,t))}case gD.UTF_8:{let e=JC(r.findIndex(e=>e===0),r.length);return this.pos=n+Math.min(e+1,r.length),eC.decode(r.subarray(0,e))}}}readId3V2EncodingAndText(e){if(this.pos>=e)return``;let t=this.readId3V2TextEncoding();return this.readId3V2Text(t,e)}},CD=async(e,t,n)=>{let r=t;for(;n===null||r<n;){let t=e.requestSlice(r,4);if(t instanceof Promise&&(t=await t),!t)break;let n=pD($(t),e.fileSize===null?null:e.fileSize-r);if(n.header)return{header:n.header,startPos:r};r+=n.bytesAdvanced}return null},wD=class extends ST{constructor(e){super(e),this.metadataPromise=null,this.firstFrameHeader=null,this.loadedSamples=[],this.metadataTags=null,this.tracks=[],this.readingMutex=new dC,this.lastSampleLoaded=!1,this.lastLoadedPos=0,this.nextTimestampInSamples=0,this.reader=e._reader}async readMetadata(){return this.metadataPromise??=(async()=>{for(;!this.firstFrameHeader&&!this.lastSampleLoaded;)await this.advanceReader();if(!this.firstFrameHeader)throw Error(`No valid MP3 frame found.`);this.tracks=[new _E(this.input,new TD(this))]})()}async advanceReader(){if(this.lastLoadedPos===0)for(;;){let e=this.reader.requestSlice(this.lastLoadedPos,10);if(e instanceof Promise&&(e=await e),!e){this.lastSampleLoaded=!0;return}let t=bD(e);if(!t)break;this.lastLoadedPos=e.filePos+t.size}let e=await CD(this.reader,this.lastLoadedPos,this.reader.fileSize);if(!e){this.lastSampleLoaded=!0;return}let t=e.header;this.lastLoadedPos=e.startPos+t.totalSize-1;let n=fD(t.mpegVersionId,t.channel),r=this.reader.requestSlice(e.startPos+n,4);if(r instanceof Promise&&(r=await r),r){let e=$(r);if(e===1483304551||e===1231971951)return}this.firstFrameHeader||=t,t.sampleRate!==this.firstFrameHeader.sampleRate&&console.warn(`MP3 changed sample rate mid-file: ${this.firstFrameHeader.sampleRate} Hz to ${t.sampleRate} Hz. Might be a bug, so please report this file.`);let i=t.audioSamplesInFrame/this.firstFrameHeader.sampleRate,a={timestamp:this.nextTimestampInSamples/this.firstFrameHeader.sampleRate,duration:i,dataStart:e.startPos,dataSize:t.totalSize};this.loadedSamples.push(a),this.nextTimestampInSamples+=t.audioSamplesInFrame}async getMimeType(){return`audio/mpeg`}async getTracks(){return await this.readMetadata(),this.tracks}async computeDuration(){await this.readMetadata();let e=this.tracks[0];return X(e),e.computeDuration()}async getMetadataTags(){let e=await this.readingMutex.acquire();try{if(await this.readMetadata(),this.metadataTags)return this.metadataTags;this.metadataTags={};let e=0,t=!1;for(;;){let n=this.reader.requestSlice(e,10);if(n instanceof Promise&&(n=await n),!n)break;let r=bD(n);if(!r)break;t=!0;let i=this.reader.requestSlice(n.filePos,r.size);if(i instanceof Promise&&(i=await i),!i)break;xD(i,r,this.metadataTags),e=n.filePos+r.size}if(!t&&this.reader.fileSize!==null&&this.reader.fileSize>=128){let e=this.reader.requestSlice(this.reader.fileSize-128,128);e instanceof Promise&&(e=await e),X(e),FO(e,3)===`TAG`&&vD(e,this.metadataTags)}return this.metadataTags}finally{e()}}},TD=class{constructor(e){this.demuxer=e}getId(){return 1}async getFirstTimestamp(){return 0}getTimeResolution(){return X(this.demuxer.firstFrameHeader),this.demuxer.firstFrameHeader.sampleRate/this.demuxer.firstFrameHeader.audioSamplesInFrame}async computeDuration(){let e=await this.getPacket(1/0,{metadataOnly:!0});return(e?.timestamp??0)+(e?.duration??0)}getName(){return null}getLanguageCode(){return`und`}getCodec(){return`mp3`}getInternalCodecId(){return null}getNumberOfChannels(){return X(this.demuxer.firstFrameHeader),this.demuxer.firstFrameHeader.channel===3?1:2}getSampleRate(){return X(this.demuxer.firstFrameHeader),this.demuxer.firstFrameHeader.sampleRate}getDisposition(){return{...rw}}async getDecoderConfig(){return X(this.demuxer.firstFrameHeader),{codec:`mp3`,numberOfChannels:this.demuxer.firstFrameHeader.channel===3?1:2,sampleRate:this.demuxer.firstFrameHeader.sampleRate}}async getPacketAtIndex(e,t){if(e===-1)return null;let n=this.demuxer.loadedSamples[e];if(!n)return null;let r;if(t.metadataOnly)r=DT;else{let e=this.demuxer.reader.requestSlice(n.dataStart,n.dataSize);if(e instanceof Promise&&(e=await e),!e)return null;r=yO(e,n.dataSize)}return new OT(r,`key`,n.timestamp,n.duration,e,n.dataSize)}getFirstPacket(e){return this.getPacketAtIndex(0,e)}async getNextPacket(e,t){let n=await this.demuxer.readingMutex.acquire();try{let n=mC(this.demuxer.loadedSamples,e.timestamp,e=>e.timestamp);if(n===-1)throw Error(`Packet was not created from this track.`);let r=n+1;for(;r>=this.demuxer.loadedSamples.length&&!this.demuxer.lastSampleLoaded;)await this.demuxer.advanceReader();return this.getPacketAtIndex(r,t)}finally{n()}}async getPacket(e,t){let n=await this.demuxer.readingMutex.acquire();try{for(;;){let n=hC(this.demuxer.loadedSamples,e,e=>e.timestamp);if(n===-1&&this.demuxer.loadedSamples.length>0)return null;if(this.demuxer.lastSampleLoaded||n>=0&&n+1<this.demuxer.loadedSamples.length)return this.getPacketAtIndex(n,t);await this.demuxer.advanceReader()}}finally{n()}}getKeyPacket(e,t){return this.getPacket(e,t)}getNextKeyPacket(e,t){return this.getNextPacket(e,t)}},ED=79764919,DD=new Uint32Array(256);for(let e=0;e<256;e++){let t=e<<24;for(let e=0;e<8;e++)t=t&2147483648?t<<1^ED:t<<1;DD[e]=t>>>0&4294967295}var OD=e=>{let t=$S(e),n=t.getUint32(22,!0);t.setUint32(22,0,!0);let r=0;for(let t=0;t<e.length;t++){let n=e[t];r=(r<<8^DD[r>>>24^n])>>>0}return t.setUint32(22,n,!0),r},kD=(e,t,n)=>{let r=0,i=null;if(e.length>0)if(t.codec===`vorbis`){X(t.vorbisInfo);let a=t.vorbisInfo.modeBlockflags.length,o=(1<<jC(a-1))-1<<1,s=(e[0]&o)>>1;if(s>=t.vorbisInfo.modeBlockflags.length)throw Error(`Invalid mode number.`);let c=n,l=t.vorbisInfo.modeBlockflags[s];if(i=t.vorbisInfo.blocksizes[l],l===1){let n=(o|1)+1,r=e[0]&n?1:0;c=t.vorbisInfo.blocksizes[r]}r=c===null?0:c+i>>2}else t.codec===`opus`&&(r=_T(e).durationInSamples);return{durationInSamples:r,vorbisBlockSize:i}},AD=e=>{let t=`audio/ogg`;if(e.codecStrings){let n=[...new Set(e.codecStrings)];t+=`; codecs="${n.join(`, `)}"`}return t},jD=65307,MD=e=>{let t=e.filePos;if(EO(e)!==1399285583)return null;e.skip(1);let n=bO(e),r=MO(e),i=EO(e),a=EO(e),o=EO(e),s=bO(e),c=new Uint8Array(s);for(let t=0;t<s;t++)c[t]=bO(e);let l=27+s,u=c.reduce((e,t)=>e+t,0);return{headerStartPos:t,totalSize:l+u,dataStartPos:t+l,dataSize:u,headerType:n,granulePosition:r,serialNumber:i,sequenceNumber:a,checksum:o,lacingValues:c}},ND=(e,t)=>{for(;e.filePos<t-3;){let t=EO(e),n=t&255,r=t>>>8&255,i=t>>>16&255,a=t>>>24&255;if(!(n!==79&&r!==79&&i!==79&&a!==79)){if(e.skip(-4),t===1399285583)return!0;e.skip(1)}}return!1},PD=class extends ST{constructor(e){super(e),this.metadataPromise=null,this.bitstreams=[],this.tracks=[],this.metadataTags={},this.reader=e._reader}async readMetadata(){return this.metadataPromise??=(async()=>{let e=0;for(;;){let t=this.reader.requestSliceRange(e,27,282);if(t instanceof Promise&&(t=await t),!t)break;let n=MD(t);if(!n||!(n.headerType&2))break;this.bitstreams.push({serialNumber:n.serialNumber,bosPage:n,description:null,numberOfChannels:-1,sampleRate:-1,codecInfo:{codec:null,vorbisInfo:null,opusInfo:null},lastMetadataPacket:null}),e=n.headerStartPos+n.totalSize}for(let e of this.bitstreams){let t=await this.readPacket(e.bosPage,0);t&&(t.data.byteLength>=7&&t.data[0]===1&&t.data[1]===118&&t.data[2]===111&&t.data[3]===114&&t.data[4]===98&&t.data[5]===105&&t.data[6]===115?await this.readVorbisMetadata(t,e):t.data.byteLength>=8&&t.data[0]===79&&t.data[1]===112&&t.data[2]===117&&t.data[3]===115&&t.data[4]===72&&t.data[5]===101&&t.data[6]===97&&t.data[7]===100&&await this.readOpusMetadata(t,e),e.codecInfo.codec!==null&&this.tracks.push(new _E(this.input,new FD(e,this))))}})()}async readVorbisMetadata(e,t){let n=await this.findNextPacketStart(e);if(!n)return;let r=await this.readPacket(n.startPage,n.startSegmentIndex);if(!r||(n=await this.findNextPacketStart(r),!n))return;let i=await this.readPacket(n.startPage,n.startSegmentIndex);if(!i||r.data[0]!==3||i.data[0]!==5)return;let a=[],o=e=>{for(;a.push(Math.min(255,e)),!(e<255);)e-=255};o(e.data.length),o(r.data.length);let s=new Uint8Array(1+a.length+e.data.length+r.data.length+i.data.length);s[0]=2,s.set(a,1),s.set(e.data,1+a.length),s.set(r.data,1+a.length+e.data.length),s.set(i.data,1+a.length+e.data.length+r.data.length),t.codecInfo.codec=`vorbis`,t.description=s,t.lastMetadataPacket=i;let c=$S(e.data);t.numberOfChannels=c.getUint8(11),t.sampleRate=c.getUint32(12,!0);let l=c.getUint8(28);t.codecInfo.vorbisInfo={blocksizes:[1<<(l&15),1<<(l>>4)],modeBlockflags:vT(i.data).modeBlockflags},xT(r.data.subarray(7),this.metadataTags)}async readOpusMetadata(e,t){let n=await this.findNextPacketStart(e);if(!n)return;let r=await this.readPacket(n.startPage,n.startSegmentIndex);if(!r)return;t.codecInfo.codec=`opus`,t.description=e.data,t.lastMetadataPacket=r;let i=hT(e.data);t.numberOfChannels=i.outputChannelCount,t.sampleRate=Tw,t.codecInfo.opusInfo={preSkip:i.preSkip},xT(r.data.subarray(8),this.metadataTags)}async readPacket(e,t){X(t<e.lacingValues.length);let n=0;for(let r=0;r<t;r++)n+=e.lacingValues[r];let r=e,i=n,a=t,o=[];outer:for(;;){let t=this.reader.requestSlice(r.dataStartPos,r.dataSize);t instanceof Promise&&(t=await t),X(t);let s=yO(t,r.dataSize);for(;;){if(a===r.lacingValues.length){o.push(s.subarray(n,i));break}let e=r.lacingValues[a];if(i+=e,e<255){o.push(s.subarray(n,i));break outer}a++}let c=r.headerStartPos+r.totalSize;for(;;){let t=this.reader.requestSliceRange(c,27,282);if(t instanceof Promise&&(t=await t),!t)return null;let n=MD(t);if(!n)return null;if(r=n,r.serialNumber===e.serialNumber)break;c=r.headerStartPos+r.totalSize}n=0,i=0,a=0}let s=o.reduce((e,t)=>e+t.length,0),c=new Uint8Array(s),l=0;for(let e=0;e<o.length;e++){let t=o[e];c.set(t,l),l+=t.length}return{data:c,endPage:r,endSegmentIndex:a}}async findNextPacketStart(e){if(e.endSegmentIndex<e.endPage.lacingValues.length-1)return{startPage:e.endPage,startSegmentIndex:e.endSegmentIndex+1};if(e.endPage.headerType&4)return null;let t=e.endPage.headerStartPos+e.endPage.totalSize;for(;;){let n=this.reader.requestSliceRange(t,27,282);if(n instanceof Promise&&(n=await n),!n)return null;let r=MD(n);if(!r)return null;if(r.serialNumber===e.endPage.serialNumber)return{startPage:r,startSegmentIndex:0};t=r.headerStartPos+r.totalSize}}async getMimeType(){return await this.readMetadata(),AD({codecStrings:(await Promise.all(this.tracks.map(e=>e.getCodecParameterString()))).filter(Boolean)})}async getTracks(){return await this.readMetadata(),this.tracks}async computeDuration(){let e=await this.getTracks(),t=await Promise.all(e.map(e=>e.computeDuration()));return Math.max(0,...t)}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}},FD=class{constructor(e,t){this.bitstream=e,this.demuxer=t,this.encodedPacketToMetadata=new WeakMap,this.sequentialScanCache=[],this.sequentialScanMutex=new dC,this.internalSampleRate=e.codecInfo.codec===`opus`?Tw:e.sampleRate}getId(){return this.bitstream.serialNumber}getNumberOfChannels(){return this.bitstream.numberOfChannels}getSampleRate(){return this.bitstream.sampleRate}getTimeResolution(){return this.bitstream.sampleRate}getCodec(){return this.bitstream.codecInfo.codec}getInternalCodecId(){return null}async getDecoderConfig(){return X(this.bitstream.codecInfo.codec),{codec:this.bitstream.codecInfo.codec,numberOfChannels:this.bitstream.numberOfChannels,sampleRate:this.bitstream.sampleRate,description:this.bitstream.description??void 0}}getName(){return null}getLanguageCode(){return`und`}getDisposition(){return{...rw}}async getFirstTimestamp(){return 0}async computeDuration(){let e=await this.getPacket(1/0,{metadataOnly:!0});return(e?.timestamp??0)+(e?.duration??0)}granulePositionToTimestampInSamples(e){return this.bitstream.codecInfo.codec===`opus`?(X(this.bitstream.codecInfo.opusInfo),e-this.bitstream.codecInfo.opusInfo.preSkip):e}createEncodedPacketFromOggPacket(e,t,n){if(!e)return null;let{durationInSamples:r,vorbisBlockSize:i}=kD(e.data,this.bitstream.codecInfo,t.vorbisLastBlocksize),a=new OT(n.metadataOnly?DT:e.data,`key`,Math.max(0,t.timestampInSamples)/this.internalSampleRate,r/this.internalSampleRate,e.endPage.headerStartPos+e.endSegmentIndex,e.data.byteLength);return this.encodedPacketToMetadata.set(a,{packet:e,timestampInSamples:t.timestampInSamples,durationInSamples:r,vorbisLastBlockSize:t.vorbisLastBlocksize,vorbisBlockSize:i}),a}async getFirstPacket(e){X(this.bitstream.lastMetadataPacket);let t=await this.demuxer.findNextPacketStart(this.bitstream.lastMetadataPacket);if(!t)return null;let n=0;this.bitstream.codecInfo.codec===`opus`&&(X(this.bitstream.codecInfo.opusInfo),n-=this.bitstream.codecInfo.opusInfo.preSkip);let r=await this.demuxer.readPacket(t.startPage,t.startSegmentIndex);return this.createEncodedPacketFromOggPacket(r,{timestampInSamples:n,vorbisLastBlocksize:null},e)}async getNextPacket(e,t){let n=this.encodedPacketToMetadata.get(e);if(!n)throw Error(`Packet was not created from this track.`);let r=await this.demuxer.findNextPacketStart(n.packet);if(!r)return null;let i=n.timestampInSamples+n.durationInSamples,a=await this.demuxer.readPacket(r.startPage,r.startSegmentIndex);return this.createEncodedPacketFromOggPacket(a,{timestampInSamples:i,vorbisLastBlocksize:n.vorbisBlockSize},t)}async getPacket(e,t){if(this.demuxer.reader.fileSize===null)return this.getPacketSequential(e,t);let n=kC(e*this.internalSampleRate);if(n===0)return this.getFirstPacket(t);if(n<0)return null;X(this.bitstream.lastMetadataPacket);let r=await this.demuxer.findNextPacketStart(this.bitstream.lastMetadataPacket);if(!r)return null;let i=r.startPage,a=this.demuxer.reader.fileSize,o=[i];outer:for(;i.headerStartPos+i.totalSize<a;){let e=i.headerStartPos,t=Math.floor((e+a)/2),r=t;for(;;){let e=Math.min(r+jD,a-27),s=this.demuxer.reader.requestSlice(r,e-r);if(s instanceof Promise&&(s=await s),X(s),!ND(s,e)){a=t+27;continue outer}let c=this.demuxer.reader.requestSliceRange(s.filePos,27,282);c instanceof Promise&&(c=await c),X(c);let l=MD(c);X(l);let u=!1;if(l.serialNumber===this.bitstream.serialNumber)u=!0;else{let e=this.demuxer.reader.requestSlice(l.headerStartPos,l.totalSize);e instanceof Promise&&(e=await e),X(e),u=OD(yO(e,l.totalSize))===l.checksum}if(!u){r=l.headerStartPos+4;continue}if(u&&l.serialNumber!==this.bitstream.serialNumber){r=l.headerStartPos+l.totalSize;continue}if(l.granulePosition===-1){r=l.headerStartPos+l.totalSize;continue}this.granulePositionToTimestampInSamples(l.granulePosition)>n?a=l.headerStartPos:(i=l,o.push(l));continue outer}}let s=r.startPage;for(let e of o){if(e.granulePosition===i.granulePosition)break;(!s||e.headerStartPos>s.headerStartPos)&&(s=e)}let c=s,l=[c];for(;!(c.serialNumber===this.bitstream.serialNumber&&c.granulePosition===i.granulePosition);){let e=c.headerStartPos+c.totalSize,t=this.demuxer.reader.requestSliceRange(e,27,282);t instanceof Promise&&(t=await t),X(t);let n=MD(t);X(n),c=n,c.serialNumber===this.bitstream.serialNumber&&l.push(c)}X(c.granulePosition!==-1);let u=null,d,f,p=c,m=0;if(c.headerStartPos===r.startPage.headerStartPos)d=this.granulePositionToTimestampInSamples(0),f=!0,u=0;else{d=0,f=!1;for(let e=c.lacingValues.length-1;e>=0;e--)if(c.lacingValues[e]<255){u=e+1;break}if(u===null)throw Error(`Invalid page with granule position: no packets end on this page.`);m=u-1;let e={data:DT,endPage:p,endSegmentIndex:m};if(await this.demuxer.findNextPacketStart(e)){let e=LD(l,c,u);X(e);let t=ID(l,e.page,e.segmentIndex);t&&(c=t.page,u=t.segmentIndex)}else for(;;){let e=LD(l,c,u);if(!e)break;let t=ID(l,e.page,e.segmentIndex);if(!t)break;if(c=t.page,u=t.segmentIndex,e.page.headerStartPos!==p.headerStartPos){p=e.page,m=e.segmentIndex;break}}}let h=null,g=null;for(;c!==null;){X(u!==null);let e=await this.demuxer.readPacket(c,u);if(!e)break;if(!(c.headerStartPos===r.startPage.headerStartPos&&u<r.startSegmentIndex)){let r=this.createEncodedPacketFromOggPacket(e,{timestampInSamples:d,vorbisLastBlocksize:g?.vorbisBlockSize??null},t);X(r);let i=this.encodedPacketToMetadata.get(r);if(X(i),!f&&e.endPage.headerStartPos===p.headerStartPos&&e.endSegmentIndex===m?(d=this.granulePositionToTimestampInSamples(c.granulePosition),f=!0,r=this.createEncodedPacketFromOggPacket(e,{timestampInSamples:d-i.durationInSamples,vorbisLastBlocksize:g?.vorbisBlockSize??null},t),X(r),i=this.encodedPacketToMetadata.get(r),X(i)):d+=i.durationInSamples,h=r,g=i,f&&(Math.max(d,0)>n||Math.max(i.timestampInSamples,0)===n))break}let i=await this.demuxer.findNextPacketStart(e);if(!i)break;c=i.startPage,u=i.startSegmentIndex}return h}async getPacketSequential(e,t){let n=await this.sequentialScanMutex.acquire();try{let n=kC(e*this.internalSampleRate);e=n/this.internalSampleRate;let r=hC(this.sequentialScanCache,n,e=>e.timestampInSamples),i;if(r!==-1){let e=this.sequentialScanCache[r];i=this.createEncodedPacketFromOggPacket(e.packet,{timestampInSamples:e.timestampInSamples,vorbisLastBlocksize:e.vorbisLastBlockSize},t)}else i=await this.getFirstPacket(t);let a=0;for(;i&&i.timestamp<e;){let n=await this.getNextPacket(i,t);if(!n||n.timestamp>e)break;if(i=n,a++,a===100){a=0;let e=this.encodedPacketToMetadata.get(i);X(e),this.sequentialScanCache.length>0&&X(JS(this.sequentialScanCache).timestampInSamples<=e.timestampInSamples),this.sequentialScanCache.push(e)}}return i}finally{n()}}getKeyPacket(e,t){return this.getPacket(e,t)}getNextKeyPacket(e,t){return this.getNextPacket(e,t)}},ID=(e,t,n)=>{let r=t,i=n;outer:for(;;){for(i--;i>=0;i--)if(r.lacingValues[i]<255){i++;break outer}if(X(i===-1),!(r.headerType&1)){i=0;break}let t=vC(e,e=>e.headerStartPos<r.headerStartPos);if(!t)return null;r=t,i=r.lacingValues.length}if(X(i!==-1),i===r.lacingValues.length){let t=e[e.indexOf(r)+1];X(t),r=t,i=0}return{page:r,segmentIndex:i}},LD=(e,t,n)=>{if(n>0)return{page:t,segmentIndex:n-1};let r=vC(e,e=>e.headerStartPos<t.headerStartPos);return r?{page:r,segmentIndex:r.lacingValues.length-1}:null},RD;(function(e){e[e.PCM=1]=`PCM`,e[e.IEEE_FLOAT=3]=`IEEE_FLOAT`,e[e.ALAW=6]=`ALAW`,e[e.MULAW=7]=`MULAW`,e[e.EXTENSIBLE=65534]=`EXTENSIBLE`})(RD||={});var zD=class extends ST{constructor(e){super(e),this.metadataPromise=null,this.dataStart=-1,this.dataSize=-1,this.audioInfo=null,this.tracks=[],this.lastKnownPacketIndex=0,this.metadataTags={},this.reader=e._reader}async readMetadata(){return this.metadataPromise??=(async()=>{let e=this.reader.requestSlice(0,12);e instanceof Promise&&(e=await e),X(e);let t=FO(e,4),n=t!==`RIFX`,r=t===`RF64`,i=TO(e,n),a=r?this.reader.fileSize:Math.min(i+8,this.reader.fileSize??1/0);if(FO(e,4)!==`WAVE`)throw Error(`Invalid WAVE file - wrong format`);let o=0,s=null,c=e.filePos;for(;a===null||c<a;){let e=this.reader.requestSlice(c,8);if(e instanceof Promise&&(e=await e),!e)break;let t=FO(e,4),i=TO(e,n),l=e.filePos;if(r&&o===0&&t!==`ds64`)throw Error(`Invalid RF64 file: First chunk must be "ds64".`);if(t===`fmt `)await this.parseFmtChunk(l,i,n);else if(t===`data`){if(s??=i,this.dataStart=e.filePos,this.dataSize=Math.min(s,(a??1/0)-this.dataStart),this.reader.fileSize===null)break}else if(t===`ds64`){let e=this.reader.requestSlice(l,i);if(e instanceof Promise&&(e=await e),!e)break;let t=kO(e,n);s=kO(e,n),a=Math.min(t+8,this.reader.fileSize??1/0)}else t===`LIST`?await this.parseListChunk(l,i,n):(t===`ID3 `||t===`id3 `)&&await this.parseId3Chunk(l,i);c=l+i+(i&1),o++}if(!this.audioInfo)throw Error(`Invalid WAVE file - missing "fmt " chunk`);if(this.dataStart===-1)throw Error(`Invalid WAVE file - missing "data" chunk`);let l=this.audioInfo.blockSizeInBytes;this.dataSize=Math.floor(this.dataSize/l)*l,this.tracks.push(new _E(this.input,new VD(this)))})()}async parseFmtChunk(e,t,n){let r=this.reader.requestSlice(e,t);if(r instanceof Promise&&(r=await r),!r)return;let i=xO(r,n),a=xO(r,n),o=TO(r,n);r.skip(4);let s=xO(r,n),c;if(c=t===14?8:xO(r,n),t>=18&&i!==357){let e=xO(r,n),a=t-18;if(Math.min(a,e)>=22&&i===RD.EXTENSIBLE){r.skip(6);let e=yO(r,16);i=e[0]|e[1]<<8}}(i===RD.MULAW||i===RD.ALAW)&&(c=8),this.audioInfo={format:i,numberOfChannels:a,sampleRate:o,sampleSizeInBytes:Math.ceil(c/8),blockSizeInBytes:s}}async parseListChunk(e,t,n){let r=this.reader.requestSlice(e,t);if(r instanceof Promise&&(r=await r),!r)return;let i=FO(r,4);if(i!==`INFO`&&i!==`INF0`)return;let a=r.filePos;for(;a<=e+t-8;){r.filePos=a;let e=FO(r,4),t=TO(r,n),i=yO(r,t),o=0;for(let e=0;e<i.length&&i[e]!==0;e++)o++;let s=String.fromCharCode(...i.subarray(0,o));switch(this.metadataTags.raw??={},this.metadataTags.raw[e]=s,e){case`INAM`:case`TITL`:this.metadataTags.title??=s;break;case`TIT3`:this.metadataTags.description??=s;break;case`IART`:this.metadataTags.artist??=s;break;case`IPRD`:this.metadataTags.album??=s;break;case`IPRT`:case`ITRK`:case`TRCK`:{let e=s.split(`/`),t=Number.parseInt(e[0],10),n=e[1]&&Number.parseInt(e[1],10);Number.isInteger(t)&&t>0&&(this.metadataTags.trackNumber??=t),n&&Number.isInteger(n)&&n>0&&(this.metadataTags.tracksTotal??=n)}break;case`ICRD`:case`IDIT`:{let e=new Date(s);Number.isNaN(e.getTime())||(this.metadataTags.date??=e)}break;case`YEAR`:{let e=Number.parseInt(s,10);Number.isInteger(e)&&e>0&&(this.metadataTags.date??=new Date(e,0,1))}break;case`IGNR`:case`GENR`:this.metadataTags.genre??=s;break;case`ICMT`:case`CMNT`:case`COMM`:this.metadataTags.comment??=s;break}a+=8+t+(t&1)}}async parseId3Chunk(e,t){let n=this.reader.requestSlice(e,t);if(n instanceof Promise&&(n=await n),!n)return;let r=bD(n);r&&xD(n.slice(e+10,r.size),r,this.metadataTags)}getCodec(){if(X(this.audioInfo),this.audioInfo.format===RD.MULAW)return`ulaw`;if(this.audioInfo.format===RD.ALAW)return`alaw`;if(this.audioInfo.format===RD.PCM){if(this.audioInfo.sampleSizeInBytes===1)return`pcm-u8`;if(this.audioInfo.sampleSizeInBytes===2)return`pcm-s16`;if(this.audioInfo.sampleSizeInBytes===3)return`pcm-s24`;if(this.audioInfo.sampleSizeInBytes===4)return`pcm-s32`}return this.audioInfo.format===RD.IEEE_FLOAT&&this.audioInfo.sampleSizeInBytes===4?`pcm-f32`:null}async getMimeType(){return`audio/wav`}async computeDuration(){await this.readMetadata();let e=this.tracks[0];return X(e),e.computeDuration()}async getTracks(){return await this.readMetadata(),this.tracks}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}},BD=2048,VD=class{constructor(e){this.demuxer=e}getId(){return 1}getCodec(){return this.demuxer.getCodec()}getInternalCodecId(){return X(this.demuxer.audioInfo),this.demuxer.audioInfo.format}async getDecoderConfig(){let e=this.demuxer.getCodec();return e?(X(this.demuxer.audioInfo),{codec:e,numberOfChannels:this.demuxer.audioInfo.numberOfChannels,sampleRate:this.demuxer.audioInfo.sampleRate}):null}async computeDuration(){let e=await this.getPacket(1/0,{metadataOnly:!0});return(e?.timestamp??0)+(e?.duration??0)}getNumberOfChannels(){return X(this.demuxer.audioInfo),this.demuxer.audioInfo.numberOfChannels}getSampleRate(){return X(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}getTimeResolution(){return X(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}getName(){return null}getLanguageCode(){return`und`}getDisposition(){return{...rw}}async getFirstTimestamp(){return 0}async getPacketAtIndex(e,t){X(this.demuxer.audioInfo);let n=e*BD*this.demuxer.audioInfo.blockSizeInBytes;if(n>=this.demuxer.dataSize)return null;let r=Math.min(BD*this.demuxer.audioInfo.blockSizeInBytes,this.demuxer.dataSize-n);if(this.demuxer.reader.fileSize===null){let e=this.demuxer.reader.requestSlice(this.demuxer.dataStart+n,r);if(e instanceof Promise&&(e=await e),!e)return null}let i;if(t.metadataOnly)i=DT;else{let e=this.demuxer.reader.requestSlice(this.demuxer.dataStart+n,r);e instanceof Promise&&(e=await e),X(e),i=yO(e,r)}let a=e*BD/this.demuxer.audioInfo.sampleRate,o=r/this.demuxer.audioInfo.blockSizeInBytes/this.demuxer.audioInfo.sampleRate;return this.demuxer.lastKnownPacketIndex=Math.max(e,a),new OT(i,`key`,a,o,e,r)}getFirstPacket(e){return this.getPacketAtIndex(0,e)}async getPacket(e,t){X(this.demuxer.audioInfo);let n=Math.floor(Math.min(e*this.demuxer.audioInfo.sampleRate/BD,(this.demuxer.dataSize-1)/(BD*this.demuxer.audioInfo.blockSizeInBytes))),r=await this.getPacketAtIndex(n,t);if(r)return r;if(n===0)return null;X(this.demuxer.reader.fileSize===null);let i=await this.getPacketAtIndex(this.demuxer.lastKnownPacketIndex,t);for(;i;){let e=await this.getNextPacket(i,t);if(!e)break;i=e}return i}getNextPacket(e,t){X(this.demuxer.audioInfo);let n=Math.round(e.timestamp*this.demuxer.audioInfo.sampleRate/BD);return this.getPacketAtIndex(n+1,t)}getKeyPacket(e,t){return this.getPacket(e,t)}getNextKeyPacket(e,t){return this.getNextPacket(e,t)}},HD=e=>{let t=e.filePos,n=new XS(yO(e,9));if(n.readBits(12)!==4095||(n.skipBits(1),n.readBits(2)!==0))return null;let r=n.readBits(1),i=n.readBits(2)+1,a=n.readBits(4);if(a===15)return null;n.skipBits(1);let o=n.readBits(3);if(o===0)throw Error(`ADTS frames with channel configuration 0 are not supported.`);n.skipBits(1),n.skipBits(1),n.skipBits(1),n.skipBits(1);let s=n.readBits(13);n.skipBits(11);let c=n.readBits(2)+1;if(c!==1)throw Error(`ADTS frames with more than one AAC frame are not supported.`);let l=null;return r===1?e.filePos-=2:l=n.readBits(16),{objectType:i,samplingFrequencyIndex:a,channelConfiguration:o,frameLength:s,numberOfAacFrames:c,crcCheck:l,startPos:t}},UD=1024,WD=class extends ST{constructor(e){super(e),this.metadataPromise=null,this.firstFrameHeader=null,this.loadedSamples=[],this.tracks=[],this.readingMutex=new dC,this.lastSampleLoaded=!1,this.lastLoadedPos=0,this.nextTimestampInSamples=0,this.reader=e._reader}async readMetadata(){return this.metadataPromise??=(async()=>{for(;!this.firstFrameHeader&&!this.lastSampleLoaded;)await this.advanceReader();X(this.firstFrameHeader),this.tracks=[new _E(this.input,new GD(this))]})()}async advanceReader(){let e=this.reader.requestSliceRange(this.lastLoadedPos,7,9);if(e instanceof Promise&&(e=await e),!e){this.lastSampleLoaded=!0;return}let t=HD(e);if(!t){this.lastSampleLoaded=!0;return}if(this.reader.fileSize!==null&&t.startPos+t.frameLength>this.reader.fileSize){this.lastSampleLoaded=!0;return}this.firstFrameHeader||=t;let n=xw[t.samplingFrequencyIndex];X(n!==void 0);let r=UD/n,i=t.crcCheck?9:7,a={timestamp:this.nextTimestampInSamples/n,duration:r,dataStart:t.startPos+i,dataSize:t.frameLength-i};this.loadedSamples.push(a),this.nextTimestampInSamples+=UD,this.lastLoadedPos=t.startPos+t.frameLength}async getMimeType(){return`audio/aac`}async getTracks(){return await this.readMetadata(),this.tracks}async computeDuration(){await this.readMetadata();let e=this.tracks[0];return X(e),e.computeDuration()}async getMetadataTags(){return{}}},GD=class{constructor(e){this.demuxer=e}getId(){return 1}async getFirstTimestamp(){return 0}getTimeResolution(){return this.getSampleRate()/UD}async computeDuration(){let e=await this.getPacket(1/0,{metadataOnly:!0});return(e?.timestamp??0)+(e?.duration??0)}getName(){return null}getLanguageCode(){return`und`}getCodec(){return`aac`}getInternalCodecId(){return X(this.demuxer.firstFrameHeader),this.demuxer.firstFrameHeader.objectType}getNumberOfChannels(){X(this.demuxer.firstFrameHeader);let e=Sw[this.demuxer.firstFrameHeader.channelConfiguration];return X(e!==void 0),e}getSampleRate(){X(this.demuxer.firstFrameHeader);let e=xw[this.demuxer.firstFrameHeader.samplingFrequencyIndex];return X(e!==void 0),e}getDisposition(){return{...rw}}async getDecoderConfig(){X(this.demuxer.firstFrameHeader);let e=new Uint8Array(3),t=new XS(e),{objectType:n,samplingFrequencyIndex:r,channelConfiguration:i}=this.demuxer.firstFrameHeader;return n>31?(t.writeBits(5,31),t.writeBits(6,n-32)):t.writeBits(5,n),t.writeBits(4,r),t.writeBits(4,i),{codec:`mp4a.40.${this.demuxer.firstFrameHeader.objectType}`,numberOfChannels:this.getNumberOfChannels(),sampleRate:this.getSampleRate(),description:e.subarray(0,Math.ceil((t.pos-1)/8))}}async getPacketAtIndex(e,t){if(e===-1)return null;let n=this.demuxer.loadedSamples[e];if(!n)return null;let r;if(t.metadataOnly)r=DT;else{let e=this.demuxer.reader.requestSlice(n.dataStart,n.dataSize);if(e instanceof Promise&&(e=await e),!e)return null;r=yO(e,n.dataSize)}return new OT(r,`key`,n.timestamp,n.duration,e,n.dataSize)}getFirstPacket(e){return this.getPacketAtIndex(0,e)}async getNextPacket(e,t){let n=await this.demuxer.readingMutex.acquire();try{let n=mC(this.demuxer.loadedSamples,e.timestamp,e=>e.timestamp);if(n===-1)throw Error(`Packet was not created from this track.`);let r=n+1;for(;r>=this.demuxer.loadedSamples.length&&!this.demuxer.lastSampleLoaded;)await this.demuxer.advanceReader();return this.getPacketAtIndex(r,t)}finally{n()}}async getPacket(e,t){let n=await this.demuxer.readingMutex.acquire();try{for(;;){let n=hC(this.demuxer.loadedSamples,e,e=>e.timestamp);if(n===-1&&this.demuxer.loadedSamples.length>0)return null;if(this.demuxer.lastSampleLoaded||n>=0&&n+1<this.demuxer.loadedSamples.length)return this.getPacketAtIndex(n,t);await this.demuxer.advanceReader()}}finally{n()}}getKeyPacket(e,t){return this.getPacket(e,t)}getNextKeyPacket(e,t){return this.getNextPacket(e,t)}},KD=e=>e===0?null:e===1?192:e>=2&&e<=5?144*2**e:e===6?`uncommon-u8`:e===7?`uncommon-u16`:e>=8&&e<=15?2**e:null,qD=(e,t)=>{switch(e){case 0:return t;case 1:return 88200;case 2:return 176400;case 3:return 192e3;case 4:return 8e3;case 5:return 16e3;case 6:return 22050;case 7:return 24e3;case 8:return 32e3;case 9:return 44100;case 10:return 48e3;case 11:return 96e3;case 12:return`uncommon-u8`;case 13:return`uncommon-u16`;case 14:return`uncommon-u16-10`;default:return null}},JD=e=>{let t=0,n=new XS(yO(e,1));for(;n.readBits(1)===1;)t++;if(t===0)return n.readBits(7);let r=[],i=t-1,a=new XS(yO(e,i)),o=8-t-1;for(let e=0;e<o;e++)r.unshift(n.readBits(1));for(let e=0;e<i;e++)for(let e=0;e<8;e++){let t=a.readBits(1);e<2||r.unshift(t)}return r.reduce((e,t,n)=>e|t<<n,0)},YD=(e,t)=>{if(t===`uncommon-u16`)return SO(e)+1;if(t===`uncommon-u8`)return bO(e)+1;if(typeof t==`number`)return t;SC(t),X(!1)},XD=(e,t)=>t===`uncommon-u16`?SO(e):t===`uncommon-u16-10`?SO(e)*10:t===`uncommon-u8`?bO(e):typeof t==`number`?t:null,ZD=e=>{let t=0;for(let n of e){t^=n;for(let e=0;e<8;e++)t&128?t=t<<1^7:t<<=1,t&=255}return t},QD=class extends ST{constructor(e){super(e),this.loadedSamples=[],this.metadataPromise=null,this.track=null,this.metadataTags={},this.audioInfo=null,this.lastLoadedPos=null,this.blockingBit=null,this.readingMutex=new dC,this.lastSampleLoaded=!1,this.reader=e._reader}async computeDuration(){return await this.readMetadata(),X(this.track),this.track.computeDuration()}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}async getTracks(){return await this.readMetadata(),X(this.track),[this.track]}async getMimeType(){return`audio/flac`}async readMetadata(){let e=4;return this.metadataPromise??=(async()=>{for(;this.reader.fileSize===null||e<this.reader.fileSize;){let t=this.reader.requestSlice(e,4);if(t instanceof Promise&&(t=await t),e+=4,t===null)throw Error(`Metadata block at position ${e} is too small! Corrupted file.`);X(t);let n=bO(t),r=CO(t),i=(n&128)!=0;switch(n&127){case bT.STREAMINFO:{let t=this.reader.requestSlice(e,r);if(t instanceof Promise&&(t=await t),X(t),t===null)throw Error(`StreamInfo block at position ${e} is too small! Corrupted file.`);let n=yO(t,34),i=new XS(n),a=i.readBits(16),o=i.readBits(16),s=i.readBits(24),c=i.readBits(24),l=i.readBits(20),u=i.readBits(3)+1;i.readBits(5);let d=i.readBits(36);i.skipBits(128);let f=new Uint8Array(42);f.set(new Uint8Array([102,76,97,67]),0),f.set(new Uint8Array([128,0,0,34]),4),f.set(n,8),this.audioInfo={numberOfChannels:u,sampleRate:l,totalSamples:d,minimumBlockSize:a,maximumBlockSize:o,minimumFrameSize:s,maximumFrameSize:c,description:f},this.track=new _E(this.input,new $D(this));break}case bT.VORBIS_COMMENT:{let t=this.reader.requestSlice(e,r);t instanceof Promise&&(t=await t),X(t),xT(yO(t,r),this.metadataTags);break}case bT.PICTURE:{let t=this.reader.requestSlice(e,r);t instanceof Promise&&(t=await t),X(t);let n=$(t),i=$(t),a=eC.decode(yO(t,i)),o=$(t),s=eC.decode(yO(t,o));t.skip(16);let c=$(t),l=yO(t,c);this.metadataTags.images??=[],this.metadataTags.images.push({data:l,mimeType:a,kind:n===3?`coverFront`:n===4?`coverBack`:`unknown`,description:s});break}default:break}if(e+=r,i){this.lastLoadedPos=e;break}}})()}async readNextFlacFrame({startPos:e,isFirstPacket:t}){X(this.audioInfo);let n=this.audioInfo.maximumFrameSize+16,r=await this.reader.requestSliceRange(e,this.audioInfo.minimumFrameSize,n);if(!r)return null;let i=this.readFlacFrameHeader({slice:r,isFirstPacket:t});if(!i)return null;for(r.filePos=e+this.audioInfo.minimumFrameSize;;){if(r.filePos>r.end-6)return{num:i.num,blockSize:i.blockSize,sampleRate:i.sampleRate,size:r.end-e,isLastFrame:!0};if(bO(r)===255){let t=r.filePos;if(bO(r)!==(this.blockingBit===1?249:248)){r.filePos=t;continue}r.skip(-2);let n=r.filePos-e,a=this.readFlacFrameHeader({slice:r,isFirstPacket:!1});if(!a){r.filePos=t;continue}if(this.blockingBit===0){if(a.num-i.num!==1){r.filePos=t;continue}}else if(a.num-i.num!==i.blockSize){r.filePos=t;continue}return{num:i.num,blockSize:i.blockSize,sampleRate:i.sampleRate,size:n,isLastFrame:!1}}}}readFlacFrameHeader({slice:e,isFirstPacket:t}){let n=e.filePos,r=new XS(yO(e,4));if(r.readBits(15)!==32764)return null;if(this.blockingBit===null){X(t);let e=r.readBits(1);this.blockingBit=e}else if(this.blockingBit===1){if(X(!t),r.readBits(1)!==1)return null}else if(this.blockingBit===0){if(X(!t),r.readBits(1)!==0)return null}else throw Error(`Invalid blocking bit`);let i=KD(r.readBits(4));if(!i)return null;X(this.audioInfo);let a=qD(r.readBits(4),this.audioInfo.sampleRate);if(!a||(r.readBits(4),r.readBits(3),r.readBits(1)!==0))return null;let o=JD(e),s=YD(e,i),c=XD(e,a);if(c===null||c!==this.audioInfo.sampleRate)return null;let l=e.filePos-n,u=bO(e);return e.skip(-l),e.skip(-1),u===ZD(yO(e,l))?{num:o,blockSize:s,sampleRate:c}:null}async advanceReader(){await this.readMetadata(),X(this.lastLoadedPos!==null),X(this.audioInfo);let e=this.lastLoadedPos,t=await this.readNextFlacFrame({startPos:e,isFirstPacket:this.loadedSamples.length===0});if(!t){this.lastSampleLoaded=!0;return}let n=this.loadedSamples[this.loadedSamples.length-1],r={blockOffset:n?n.blockOffset+n.blockSize:0,blockSize:t.blockSize,byteOffset:e,byteSize:t.size};if(this.lastLoadedPos+=t.size,this.loadedSamples.push(r),t.isLastFrame){this.lastSampleLoaded=!0;return}}},$D=class{constructor(e){this.demuxer=e}getId(){return 1}getCodec(){return`flac`}getInternalCodecId(){return null}getNumberOfChannels(){return X(this.demuxer.audioInfo),this.demuxer.audioInfo.numberOfChannels}async computeDuration(){let e=await this.getPacket(1/0,{metadataOnly:!0});return(e?.timestamp??0)+(e?.duration??0)}getSampleRate(){return X(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}getName(){return null}getLanguageCode(){return`und`}getTimeResolution(){return X(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}getDisposition(){return{...rw}}async getFirstTimestamp(){return 0}async getDecoderConfig(){return X(this.demuxer.audioInfo),{codec:`flac`,numberOfChannels:this.demuxer.audioInfo.numberOfChannels,sampleRate:this.demuxer.audioInfo.sampleRate,description:this.demuxer.audioInfo.description}}async getPacket(e,t){if(X(this.demuxer.audioInfo),e<0)throw Error(`Timestamp cannot be negative`);let n=await this.demuxer.readingMutex.acquire();try{for(;;){let n=hC(this.demuxer.loadedSamples,e,e=>e.blockOffset/this.demuxer.audioInfo.sampleRate);if(n===-1){await this.demuxer.advanceReader();continue}let r=this.demuxer.loadedSamples[n];if(r.blockOffset/this.demuxer.audioInfo.sampleRate+r.blockSize/this.demuxer.audioInfo.sampleRate<=e){if(this.demuxer.lastSampleLoaded)return this.getPacketAtIndex(this.demuxer.loadedSamples.length-1,t);await this.demuxer.advanceReader();continue}return this.getPacketAtIndex(n,t)}}finally{n()}}async getNextPacket(e,t){let n=await this.demuxer.readingMutex.acquire();try{let n=e.sequenceNumber+1;if(this.demuxer.lastSampleLoaded&&n>=this.demuxer.loadedSamples.length)return null;for(;n>=this.demuxer.loadedSamples.length&&!this.demuxer.lastSampleLoaded;)await this.demuxer.advanceReader();return this.getPacketAtIndex(n,t)}finally{n()}}getKeyPacket(e,t){return this.getPacket(e,t)}getNextKeyPacket(e,t){return this.getNextPacket(e,t)}async getPacketAtIndex(e,t){let n=this.demuxer.loadedSamples[e];if(!n)return null;let r;if(t.metadataOnly)r=DT;else{let e=this.demuxer.reader.requestSlice(n.byteOffset,n.byteSize);if(e instanceof Promise&&(e=await e),!e)return null;r=yO(e,n.byteSize)}X(this.demuxer.audioInfo);let i=n.blockOffset/this.demuxer.audioInfo.sampleRate,a=n.blockSize/this.demuxer.audioInfo.sampleRate;return new OT(r,`key`,i,a,e,n.byteSize)}async getFirstPacket(e){for(;this.demuxer.loadedSamples.length===0&&!this.demuxer.lastSampleLoaded;)await this.demuxer.advanceReader();return this.getPacketAtIndex(0,e)}},eO=class{},tO=class extends eO{async _getMajorBrand(e){let t=e._reader.requestSlice(0,12);return t instanceof Promise&&(t=await t),!t||(t.skip(4),FO(t,4)!==`ftyp`)?null:FO(t,4)}_createDemuxer(e){return new TE(e)}},nO=class extends tO{async _canReadInput(e){let t=await this._getMajorBrand(e);return!!t&&t!==`qt `}get name(){return`MP4`}get mimeType(){return`video/mp4`}},rO=class extends tO{async _canReadInput(e){return await this._getMajorBrand(e)===`qt `}get name(){return`QuickTime File Format`}get mimeType(){return`video/quicktime`}},iO=class extends eO{async isSupportedEBMLOfDocType(e,t){let n=e._reader.requestSlice(0,16);if(n instanceof Promise&&(n=await n),!n)return!1;let r=zE(n);if(r===null||r<1||r>8||VE(n,r)!==Q.EBML)return!1;let i=WE(n);if(i===null)return!1;let a=e._reader.requestSlice(n.filePos,i);if(a instanceof Promise&&(a=await a),!a)return!1;let o=n.filePos;for(;a.filePos<=o+i-2;){let e=GE(a);if(!e)break;let{id:n,size:r}=e,i=a.filePos;if(r===null)return!1;switch(n){case Q.EBMLVersion:if(VE(a,r)!==1)return!1;break;case Q.EBMLReadVersion:if(VE(a,r)!==1)return!1;break;case Q.DocType:if(KE(a,r)!==t)return!1;break;case Q.DocTypeVersion:if(VE(a,r)>4)return!1;break}a.filePos=i+r}return!0}_canReadInput(e){return this.isSupportedEBMLOfDocType(e,`matroska`)}_createDemuxer(e){return new aD(e)}get name(){return`Matroska`}get mimeType(){return`video/x-matroska`}},aO=[new nO,new rO,new iO,new class extends iO{_canReadInput(e){return this.isSupportedEBMLOfDocType(e,`webm`)}get name(){return`WebM`}get mimeType(){return`video/webm`}},new class extends eO{async _canReadInput(e){let t=e._reader.requestSlice(0,12);if(t instanceof Promise&&(t=await t),!t)return!1;let n=FO(t,4);return n!==`RIFF`&&n!==`RIFX`&&n!==`RF64`?!1:(t.skip(4),FO(t,4)===`WAVE`)}_createDemuxer(e){return new zD(e)}get name(){return`WAVE`}get mimeType(){return`audio/wav`}},new class extends eO{async _canReadInput(e){let t=e._reader.requestSlice(0,4);return t instanceof Promise&&(t=await t),t?FO(t,4)===`OggS`:!1}_createDemuxer(e){return new PD(e)}get name(){return`Ogg`}get mimeType(){return`application/ogg`}},new class extends eO{async _canReadInput(e){let t=e._reader.requestSlice(0,4);return t instanceof Promise&&(t=await t),t?FO(t,4)===`fLaC`:!1}get name(){return`FLAC`}get mimeType(){return`audio/flac`}_createDemuxer(e){return new QD(e)}},new class extends eO{async _canReadInput(e){let t=e._reader.requestSlice(0,10);if(t instanceof Promise&&(t=await t),!t)return!1;let n=0,r=!1;for(;;){let t=e._reader.requestSlice(n,10);if(t instanceof Promise&&(t=await t),!t)break;let i=bD(t);if(!i)break;r=!0,n=t.filePos+i.size}let i=await CD(e._reader,n,n+4096);if(!i)return!1;if(r)return!0;n=i.startPos+i.header.totalSize;let a=await CD(e._reader,n,n+4);if(!a)return!1;let o=i.header,s=a.header;return!(o.channel!==s.channel||o.sampleRate!==s.sampleRate)}_createDemuxer(e){return new wD(e)}get name(){return`MP3`}get mimeType(){return`audio/mpeg`}},new class extends eO{async _canReadInput(e){let t=e._reader.requestSliceRange(0,7,9);if(t instanceof Promise&&(t=await t),!t)return!1;let n=HD(t);if(!n||(t=e._reader.requestSliceRange(n.frameLength,7,9),t instanceof Promise&&(t=await t),!t))return!1;let r=HD(t);return r?n.objectType===r.objectType&&n.samplingFrequencyIndex===r.samplingFrequencyIndex&&n.channelConfiguration===r.channelConfiguration:!1}_createDemuxer(e){return new WD(e)}get name(){return`ADTS`}get mimeType(){return`audio/aac`}}],oO=o(((e,t)=>{t.exports={}}));oO();var sO=class{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){if(this._disposed)throw new hO;return this._sizePromise??=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new hO;let e=await this.getSizeOrNull();if(e===null)throw Error(`Cannot determine the size of an unsized source.`);return e}},cO=class extends sO{constructor(e){if(!(e instanceof ArrayBuffer)&&!(typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)&&!ArrayBuffer.isView(e))throw TypeError(`buffer must be an ArrayBuffer, SharedArrayBuffer, or ArrayBufferView.`);super(),this._onreadCalled=!1,this._bytes=QS(e),this._view=$S(e)}_retrieveSize(){return this._bytes.byteLength}_read(){return this._onreadCalled||=(this.onread?.(0,this._bytes.byteLength),!0),{bytes:this._bytes,view:this._view,offset:0}}_dispose(){}},lO=.5*2**20,uO=((e,t,n)=>{if(t instanceof Error&&(t.message.includes(`Failed to fetch`)||t.message.includes(`Load failed`)||t.message.includes(`NetworkError when attempting to fetch resource`))){let e=null;try{typeof window<`u`&&window.location!==void 0&&(e=new URL(n instanceof Request?n.url:n,window.location.href).origin)}catch{}if((!(typeof navigator<`u`&&typeof navigator.onLine==`boolean`)||navigator.onLine)&&e!==null&&e!==window.location.origin)return console.warn(`Request will not be retried because a CORS error was suspected due to different origins. You can modify this behavior by providing your own function for the 'getRetryDelay' option.`),null}return Math.min(2**(e-2),16)}),dO=class extends sO{constructor(e,t={}){if(typeof e!=`string`&&!(e instanceof URL)&&!(typeof Request<`u`&&e instanceof Request))throw TypeError(`url must be a string, URL or Request.`);if(!t||typeof t!=`object`)throw TypeError(`options must be an object.`);if(t.requestInit!==void 0&&(!t.requestInit||typeof t.requestInit!=`object`))throw TypeError(`options.requestInit, when provided, must be an object.`);if(t.getRetryDelay!==void 0&&typeof t.getRetryDelay!=`function`)throw TypeError(`options.getRetryDelay, when provided, must be a function.`);if(t.maxCacheSize!==void 0&&(!$C(t.maxCacheSize)||t.maxCacheSize<0))throw TypeError(`options.maxCacheSize, when provided, must be a non-negative number.`);if(t.fetchFn!==void 0&&typeof t.fetchFn!=`function`)throw TypeError(`options.fetchFn, when provided, must be a function.`);super(),this._existingResponses=new WeakMap,this._url=e,this._options=t,this._getRetryDelay=t.getRetryDelay??uO,this._orchestrator=new pO({maxCacheSize:t.maxCacheSize??64*2**20,maxWorkerCount:2,runWorker:this._runWorker.bind(this),prefetchProfile:fO.network})}async _retrieveSize(){let e=new AbortController,t=await LC(this._options.fetchFn??fetch,this._url,FC(this._options.requestInit??{},{headers:{Range:`bytes=0-`},signal:e.signal}),this._getRetryDelay,()=>this._disposed);if(!t.ok)throw Error(`Error fetching ${String(this._url)}: ${t.status} ${t.statusText}`);let n,r;if(t.status===206)r=this._getTotalLengthFromRangeResponse(t),n=this._orchestrator.createWorker(0,Math.min(r,lO));else{let e=t.headers.get(`Content-Length`);if(e)r=Number(e),n=this._orchestrator.createWorker(0,r),this._orchestrator.options.maxCacheSize=1/0,console.warn(`HTTP server did not respond with 206 Partial Content, meaning the entire remote resource now has to be downloaded. For efficient media file streaming across a network, please make sure your server supports range requests.`);else throw Error(`HTTP response (status ${t.status}) must surface Content-Length header.`)}return this._orchestrator.fileSize=r,this._existingResponses.set(n,{response:t,abortController:e}),this._orchestrator.runWorker(n),r}_read(e,t){return this._orchestrator.read(e,t)}async _runWorker(e){for(;;){let t=this._existingResponses.get(e);this._existingResponses.delete(e);let n=t?.abortController,r=t?.response;if(n||(n=new AbortController,r=await LC(this._options.fetchFn??fetch,this._url,FC(this._options.requestInit??{},{headers:{Range:`bytes=${e.currentPos}-`},signal:n.signal}),this._getRetryDelay,()=>this._disposed)),X(r),!r.ok)throw Error(`Error fetching ${String(this._url)}: ${r.status} ${r.statusText}`);if(e.currentPos>0&&r.status!==206)throw Error(`HTTP server did not respond with 206 Partial Content to a range request. To enable efficient media file streaming across a network, please make sure your server supports range requests.`);if(!r.body)throw Error(`Missing HTTP response body stream. The used fetch function must provide the response body as a ReadableStream.`);let i=r.body.getReader();for(;;){if(e.currentPos>=e.targetPos||e.aborted){n.abort(),e.running=!1;return}let t;try{t=await i.read()}catch(e){if(this._disposed)throw e;let t=this._getRetryDelay(1,e,this._url);if(t!==null){console.error(`Error while reading response stream. Attempting to resume.`,e),await new Promise(e=>setTimeout(e,1e3*t));break}else throw e}if(e.aborted)continue;let{done:r,value:a}=t;if(r){if(e.currentPos>=e.targetPos){this._orchestrator.forgetWorker(e),e.running=!1;return}break}this.onread?.(e.currentPos,e.currentPos+a.length),this._orchestrator.supplyWorkerData(e,a)}}}_getTotalLengthFromRangeResponse(e){let t=e.headers.get(`Content-Range`);if(t){let e=/\/(\d+)/.exec(t);if(e)return Number(e[1])}let n=e.headers.get(`Content-Length`);if(n)return Number(n);throw Error(`Partial HTTP response (status 206) must surface either Content-Range or Content-Length header.`)}_dispose(){this._orchestrator.dispose()}},fO={none:(e,t)=>({start:e,end:t}),fileSystem:(e,t)=>{let n=2**16;return e=Math.floor((e-n)/n)*n,t=Math.ceil((t+n)/n)*n,{start:e,end:t}},network:(e,t,n)=>{let r=2**16;e=Math.max(0,Math.floor((e-r)/r)*r);for(let r of n){let n=8*2**20,i=Math.max((r.startPos+r.targetPos)/2,r.targetPos-n);if(YC(e,t,i,r.targetPos)){let e=r.targetPos-r.startPos,i=Math.ceil((e+1)/n)*n,a=2**Math.ceil(Math.log2(e+1)),o=Math.min(a,i);t=Math.max(t,r.startPos+o)}}return t=Math.max(t,e+lO),{start:e,end:t}}},pO=class{constructor(e){this.options=e,this.fileSize=null,this.nextAge=0,this.workers=[],this.cache=[],this.currentCacheSize=0,this.disposed=!1}read(e,t){X(this.fileSize!==null);let n=this.options.prefetchProfile(e,t,this.workers),r=Math.max(n.start,0),i=Math.min(n.end,this.fileSize);X(r<=e&&t<=i);let a=null,o=hC(this.cache,e,e=>e.start),s=o===-1?null:this.cache[o];s&&s.start<=e&&t<=s.end&&(s.age=this.nextAge++,a={bytes:s.bytes,view:s.view,offset:s.start});let c=hC(this.cache,r,e=>e.start),l=a?null:new Uint8Array(t-e),u=0,d=r,f=[];if(c!==-1){for(let n=c;n<this.cache.length;n++){let a=this.cache[n];if(a.start>=i)break;if(a.end<=r)continue;let o=Math.max(r,a.start),s=Math.min(i,a.end);if(X(o<=s),d<o&&f.push({start:d,end:o}),d=s,l){let n=Math.max(e,a.start),r=Math.min(t,a.end);if(n<r){let t=n-e;l.set(a.bytes.subarray(n-a.start,r-a.start),t),t===u&&(u=r-e)}}a.age=this.nextAge++}d<i&&f.push({start:d,end:i})}else f.push({start:r,end:i});if(l&&u>=l.length&&(a={bytes:l,view:$S(l),offset:e}),f.length===0)return X(a),a;let{promise:p,resolve:m,reject:h}=_C(),g=[];for(let n of f){let r=Math.max(e,n.start),i=Math.min(t,n.end);r===n.start&&i===n.end?g.push(n):r<i&&g.push({start:r,end:i})}for(let t of f){let n=l&&{start:e,bytes:l,holes:g,resolve:m,reject:h},r=!1;for(let e of this.workers)if(YC(t.start-2**17,t.start,e.currentPos,e.targetPos)){e.targetPos=Math.max(e.targetPos,t.end),r=!0,n&&!e.pendingSlices.includes(n)&&e.pendingSlices.push(n),e.running||this.runWorker(e);break}if(!r){let e=this.createWorker(t.start,t.end);n&&(e.pendingSlices=[n]),this.runWorker(e)}}return a||=(X(l),p.then(t=>({bytes:t,view:$S(t),offset:e}))),a}createWorker(e,t){let n={startPos:e,currentPos:e,targetPos:t,running:!1,aborted:this.disposed,pendingSlices:[],age:this.nextAge++};for(this.workers.push(n);this.workers.length>this.options.maxWorkerCount;){let e=0,t=this.workers[0];for(let n=1;n<this.workers.length;n++){let r=this.workers[n];r.age<t.age&&(e=n,t=r)}if(t.running&&t.pendingSlices.length>0)break;t.aborted=!0,this.workers.splice(e,1)}return n}runWorker(e){X(!e.running),X(e.currentPos<e.targetPos),e.running=!0,e.age=this.nextAge++,this.options.runWorker(e).catch(t=>{if(e.running=!1,e.pendingSlices.length>0)e.pendingSlices.forEach(e=>e.reject(t)),e.pendingSlices.length=0;else throw t})}supplyWorkerData(e,t){X(!e.aborted);let n=e.currentPos,r=n+t.length;this.insertIntoCache({start:n,end:r,bytes:t,view:$S(t),age:this.nextAge++}),e.currentPos+=t.length,e.targetPos=Math.max(e.targetPos,e.currentPos);for(let i=0;i<e.pendingSlices.length;i++){let a=e.pendingSlices[i],o=Math.max(n,a.start),s=Math.min(r,a.start+a.bytes.length);o<s&&a.bytes.set(t.subarray(o-n,s-n),o-a.start);for(let e=0;e<a.holes.length;e++){let t=a.holes[e];n<=t.start&&r>t.start&&(t.start=r),t.end<=t.start&&(a.holes.splice(e,1),e--)}a.holes.length===0&&(a.resolve(a.bytes),e.pendingSlices.splice(i,1),i--)}for(let t=0;t<this.workers.length;t++){let i=this.workers[t];e===i||i.running||YC(n,r,i.currentPos,i.targetPos)&&(this.workers.splice(t,1),t--)}}forgetWorker(e){let t=this.workers.indexOf(e);X(t!==-1),this.workers.splice(t,1)}insertIntoCache(e){if(this.options.maxCacheSize===0)return;let t=hC(this.cache,e.start,e=>e.start)+1;if(t>0){let n=this.cache[t-1];if(n.end>=e.end)return;if(n.end>e.start){let r=new Uint8Array(e.end-n.start);r.set(n.bytes,0),r.set(e.bytes,e.start-n.start),this.currentCacheSize+=e.end-n.end,n.bytes=r,n.view=$S(r),n.end=e.end,t--,e=n}else this.cache.splice(t,0,e),this.currentCacheSize+=e.bytes.length}else this.cache.splice(t,0,e),this.currentCacheSize+=e.bytes.length;for(let n=t+1;n<this.cache.length;n++){let t=this.cache[n];if(e.end<=t.start)break;if(e.end>=t.end){this.cache.splice(n,1),this.currentCacheSize-=t.bytes.length,n--;continue}let r=new Uint8Array(t.end-e.start);r.set(e.bytes,0),r.set(t.bytes,t.start-e.start),this.currentCacheSize-=e.end-t.start,e.bytes=r,e.view=$S(r),e.end=t.end,this.cache.splice(n,1);break}for(;this.currentCacheSize>this.options.maxCacheSize;){let e=0,t=this.cache[0];for(let n=1;n<this.cache.length;n++){let r=this.cache[n];r.age<t.age&&(e=n,t=r)}if(this.currentCacheSize-t.bytes.length<=this.options.maxCacheSize)break;this.cache.splice(e,1),this.currentCacheSize-=t.bytes.length}}dispose(){for(let e of this.workers)e.aborted=!0;this.workers.length=0,this.cache.length=0,this.disposed=!0}};QC();var mO=class{get disposed(){return this._disposed}constructor(e){if(this._demuxerPromise=null,this._format=null,this._disposed=!1,!e||typeof e!=`object`)throw TypeError(`options must be an object.`);if(!Array.isArray(e.formats)||e.formats.some(e=>!(e instanceof eO)))throw TypeError(`options.formats must be an array of InputFormat.`);if(!(e.source instanceof sO))throw TypeError(`options.source must be a Source.`);if(e.source._disposed)throw Error(`options.source must not be disposed.`);this._formats=e.formats,this._source=e.source,this._reader=new gO(e.source)}_getDemuxer(){return this._demuxerPromise??=(async()=>{this._reader.fileSize=await this._source.getSizeOrNull();for(let e of this._formats)if(await e._canReadInput(this))return this._format=e,e._createDemuxer(this);throw Error(`Input has an unsupported or unrecognizable format.`)})()}get source(){return this._source}async getFormat(){return await this._getDemuxer(),X(this._format),this._format}async computeDuration(){return(await this._getDemuxer()).computeDuration()}async getTracks(){return(await this._getDemuxer()).getTracks()}async getVideoTracks(){return(await this.getTracks()).filter(e=>e.isVideoTrack())}async getAudioTracks(){return(await this.getTracks()).filter(e=>e.isAudioTrack())}async getPrimaryVideoTrack(){return(await this.getTracks()).find(e=>e.isVideoTrack())??null}async getPrimaryAudioTrack(){return(await this.getTracks()).find(e=>e.isAudioTrack())??null}async getMimeType(){return(await this._getDemuxer()).getMimeType()}async getMetadataTags(){return(await this._getDemuxer()).getMetadataTags()}dispose(){this._disposed||(this._disposed=!0,this._source._disposed=!0,this._source._dispose())}[Symbol.dispose](){this.dispose()}},hO=class extends Error{constructor(e=`Input has been disposed.`){super(e),this.name=`InputDisposedError`}},gO=class{constructor(e){this.source=e}requestSlice(e,t){if(this.source._disposed)throw new hO;if(this.fileSize!==null&&e+t>this.fileSize)return null;let n=e+t,r=this.source._read(e,n);return r instanceof Promise?r.then(t=>t?new _O(t.bytes,t.view,t.offset,e,n):null):r?new _O(r.bytes,r.view,r.offset,e,n):null}requestSliceRange(e,t,n){if(this.source._disposed)throw new hO;if(this.fileSize!==null)return this.requestSlice(e,OC(this.fileSize-e,t,n));{let r=this.requestSlice(e,n),i=r=>{if(r)return r;let i=r=>(X(r!==null),this.requestSlice(e,OC(r-e,t,n))),a=this.source._retrieveSize();return a instanceof Promise?a.then(i):i(a)};return r instanceof Promise?r.then(i):i(r)}}},_O=class e{constructor(e,t,n,r,i){this.bytes=e,this.view=t,this.offset=n,this.start=r,this.end=i,this.bufferPos=r-n}static tempFromBytes(t){return new e(t,$S(t),0,0,t.length)}get length(){return this.end-this.start}get filePos(){return this.offset+this.bufferPos}set filePos(e){this.bufferPos=e-this.offset}get remainingLength(){return Math.max(this.end-this.filePos,0)}skip(e){this.bufferPos+=e}slice(t,n=this.end-t){if(t<this.start||t+n>this.end)throw RangeError(`Slicing outside of original slice.`);return new e(this.bytes,this.view,this.offset,t,t+n)}},vO=(e,t)=>{if(e.filePos<e.start||e.filePos+t>e.end)throw RangeError(`Tried reading [${e.filePos}, ${e.filePos+t}), but slice is [${e.start}, ${e.end}). This is likely an internal error, please report it alongside the file that caused it.`)},yO=(e,t)=>{vO(e,t);let n=e.bytes.subarray(e.bufferPos,e.bufferPos+t);return e.bufferPos+=t,n},bO=e=>(vO(e,1),e.view.getUint8(e.bufferPos++)),xO=(e,t)=>{vO(e,2);let n=e.view.getUint16(e.bufferPos,t);return e.bufferPos+=2,n},SO=e=>{vO(e,2);let t=e.view.getUint16(e.bufferPos,!1);return e.bufferPos+=2,t},CO=e=>{vO(e,3);let t=CC(e.view,e.bufferPos,!1);return e.bufferPos+=3,t},wO=e=>{vO(e,2);let t=e.view.getInt16(e.bufferPos,!1);return e.bufferPos+=2,t},TO=(e,t)=>{vO(e,4);let n=e.view.getUint32(e.bufferPos,t);return e.bufferPos+=4,n},$=e=>{vO(e,4);let t=e.view.getUint32(e.bufferPos,!1);return e.bufferPos+=4,t},EO=e=>{vO(e,4);let t=e.view.getUint32(e.bufferPos,!0);return e.bufferPos+=4,t},DO=e=>{vO(e,4);let t=e.view.getInt32(e.bufferPos,!1);return e.bufferPos+=4,t},OO=e=>{vO(e,4);let t=e.view.getInt32(e.bufferPos,!0);return e.bufferPos+=4,t},kO=(e,t)=>{let n,r;return t?(n=TO(e,!0),r=TO(e,!0)):(r=TO(e,!1),n=TO(e,!1)),r*4294967296+n},AO=e=>{let t=$(e),n=$(e);return t*4294967296+n},jO=e=>{let t=DO(e),n=$(e);return t*4294967296+n},MO=e=>{let t=EO(e);return OO(e)*4294967296+t},NO=e=>{vO(e,4);let t=e.view.getFloat32(e.bufferPos,!1);return e.bufferPos+=4,t},PO=e=>{vO(e,8);let t=e.view.getFloat64(e.bufferPos,!1);return e.bufferPos+=8,t},FO=(e,t)=>{vO(e,t);let n=``;for(let r=0;r<t;r++)n+=String.fromCharCode(e.bytes[e.bufferPos++]);return n},IO=.05,LO=(e,t,n)=>{let[r,i]=_.useState({input:null,videoSink:null,duration:0,isReady:!1,error:null});_.useRef(r).current=r;let a=_.useRef(0),o=_.useRef(null),s=_.useRef(null),c=_.useRef(null),l=_.useRef(null),u=_.useRef(null),d=_.useRef(null),f=_.useRef(!1),p=_.useRef(null),m=_.useRef([]),h=_.useRef(null),g=_.useRef(!1),[,v]=_.useReducer(e=>e+1,0);return _.useEffect(()=>{if(!n)return;let t=!0,r=++a.current,o=null;return(async()=>{try{if(!t||r!==a.current)return;o=c_(`mediabunny init ${e.id}`);let n=await async function(e){if(function(e){return e.startsWith(`data:`)}(e))return new cO(function(e){let t=e.indexOf(`,`);if(t===-1)throw Error(`Invalid data URL format`);let n=e.slice(t+1),r=atob(n),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);return i.buffer}(e));if(function(e){return e.startsWith(`file://`)}(e))try{return new cO(await(await fetch(e)).arrayBuffer())}catch(t){throw Error(`Failed to load file URL: ${e}. File URLs may not be supported in this environment. Error: ${t}`)}return new dO(e)}(e.src);if(!t||r!==a.current){o&&=(o(),null);return}let s=new mO({source:n,formats:aO}),c=await s.computeDuration(),l=await s.getPrimaryVideoTrack();if(!l)throw Error(`No video track found`);if(l.codec===null)throw Error(`Unsupported video codec`);if(!await l.canDecode())throw Error(`Unable to decode the video track`);let u=new uE(l,{poolSize:5,fit:`contain`,alpha:await l.canBeTransparent()});if(!t||r!==a.current){s.dispose(),o&&=(o(),null);return}o&&=(o(),null),i(e=>Object.assign(Object.assign({},e),{input:s,videoSink:u,duration:c,isReady:!0,error:null}))}catch(n){console.error(`Failed to initialize mediabunny:`,n),o&&=(o(),null),t&&r===a.current&&(p_(`Failed to initialize mediabunny for video ${e.id}: ${n}`),i(e=>Object.assign(Object.assign({},e),{error:String(n),isReady:!1})))}})(),()=>{t=!1,o&&=(o(),null)}},[e.src,n]),_.useEffect(()=>()=>{s.current&&=(s.current.return(),null),o.current&&=(o.current(),null),c.current=null,l.current=null,u.current=null,f.current=!1,p.current=null,m.current=[],h.current=null,g.current=!1,i({input:null,videoSink:null,duration:0,isReady:!1,error:null})},[n]),_.useEffect(()=>{if(!n||!r.isReady||!r.videoSink)return;let i=++a.current,_=typeof e.src==`string`?e.src.slice(0,120):String(e.src),y=(t,n={},i=`debug`)=>{let a=``;try{a=JSON.stringify(Object.assign(Object.assign({},n),{timeCalc:d.current}))}catch(e){a=`[unserializable extras: ${String(e)}]`}let o=`mediabunny event=${t} elementId=${e.id} targetTime=${u.current} duration=${r.duration} lastFrameTimestamp=${l.current} hasIterator=${!!s.current} prefetchSize=${m.current.length} srcHint=${_} extras=${a}`;i===`error`?console.error(o):i===`warn`?console.warn(o):console.debug(o)},b=e=>{let t=r.duration||0;if(!t||!Number.isFinite(t))return e;let n=t>IO?t-IO:t;return Math.max(0,Math.min(e,n))},x=e=>{let t=r.duration||0;return!(!t||!Number.isFinite(t))&&t-e<=.050001000000000004},S=e=>{let t=c.current;t&&t.width===e.canvas.width&&t.height===e.canvas.height||(t||(t=document.createElement(`canvas`),c.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)),l.current=e.timestamp},C=e=>{let t=s.current;t&&(g.current||(g.current=!0,h.current=(async()=>{try{for(;m.current.length<4&&e===a.current;){let n=await t.next();if(e!==a.current)return;if(n.done||!n.value)break;m.current.push({timestamp:n.value.timestamp,frame:n.value})}}catch{}finally{g.current=!1,h.current=null}})()))},w=e=>{let t=m.current;for(let n=0;n<t.length;n++)if(Math.abs(t[n].timestamp-e)<IO){let e=t[n];return m.current=t.slice(n+1),e}return null},T=()=>{m.current=[]},E=async(e,t,n=0)=>{let i=b(e),o=(e=>{let t=l.current;return t===null||e<t-IO||e>t+.5})(i)?`seek`:`iterate`;try{let n=r.videoSink,c=l.current;if(c!==null&&Math.abs(c-i)<IO){u.current=e;return}let d=w(i);if(d){S(d.frame),u.current=e,C(t),v();return}if(h.current){await h.current;let n=w(i);if(n){S(n.frame),u.current=e,C(t),v();return}}if(T(),o===`seek`){s.current&&=(await s.current.return(),null);let r=n.canvases(i);s.current=r;let c=await r.next();if(t!==a.current){s.current&&=(await s.current.return(),null);return}if(c.done||!c.value){if(x(i)||y(`iterator_exhausted`,{mode:o,requestedTargetTime:e,clampedTargetTime:i},`warn`),t===a.current&&!x(i))try{s.current&&=(await s.current.return(),null),T();let r=n.canvases(i);s.current=r;let a=await r.next();!a.done&&a.value&&(S(a.value),C(t),u.current=e,v())}catch{}return}S(c.value),C(t)}else{let r=s.current;if(!r)return;let c=!1;for(;t===a.current;){let l=await r.next();if(t!==a.current)break;if(l.done||!l.value){if(x(i)||y(`iterator_exhausted`,{mode:o,requestedTargetTime:e,clampedTargetTime:i},`warn`),!c&&!x(i)){c=!0;try{s.current&&=(await s.current.return(),null),T();let e=n.canvases(i);s.current=e;let r=await e.next();if(t!==a.current||r.done||!r.value)break;S(r.value),C(t);break}catch{break}}break}let u=l.value;if(S(u),Math.abs(u.timestamp-i)<IO){C(t);break}if(u.timestamp>i){C(t);break}}}u.current=e,v()}catch(r){let a=r instanceof Error?{name:r.name,message:r.message,stack:r.stack}:{message:String(r)},c=r instanceof Error?`${r.name}: ${r.message}`:String(r),u=c.includes(`Unsupported configuration`)||c.includes(`isConfigSupported`)||c.includes(`OperationError`);if(y(`frame_process_failed`,{mode:o,requestedTargetTime:e,clampedTargetTime:i,unsupportedConfigAttempt:n,isUnsupportedConfig:u,error:a},`error`),u&&n<1)try{s.current&&=(await s.current.return(),null),T(),h.current=null,g.current=!1,l.current=null,await E(e,t,n+1)}catch{}}},D=er(()=>{let n=r.videoSink,s=r.duration;if(!n||!s)return;let c=e.startTime*s*1e3,l=s*(e.endTime-e.startTime)*1e3,u=((t.currentTime||e.page.startTime)-e.page.startTime)%l+c,m=u/1e3,h=b(m);d.current={pageStartTime:e.page.startTime,storeCurrentTime:t.currentTime,offsetMs:c,durationMs:l,restMs:u,targetTime:m,clampedTargetTime:h,startTime:e.startTime,endTime:e.endTime,videoDuration:s},((t,n)=>{f.current?p.current=t:(f.current=!0,o.current||=c_(`mediabunny video frame ${e.id}`),(async()=>{let e=t;for(;e!==null&&n===a.current;)await E(e,n),e=p.current,p.current=null;o.current&&=(o.current(),null),f.current=!1})())})(h,i)});return()=>{D(),a.current++,o.current&&=(o.current(),null)}},[n,r.isReady,r.videoSink,r.duration,t,e]),n&&r.isReady?c.current:null};function RO(){return document.createElement(`canvas`)}var zO=new window.Image;zO.src=mv(`
|
|
289
|
-
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
290
|
-
<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"/>
|
|
291
|
-
<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"/>
|
|
292
|
-
</svg>
|
|
293
|
-
`);var BO=new window.Image;BO.src=mv(`
|
|
294
|
-
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
295
|
-
<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"/>
|
|
296
|
-
<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"/>
|
|
297
|
-
<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"/>
|
|
298
|
-
<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"/>
|
|
299
|
-
</svg>
|
|
300
|
-
`);var VO=(e,t,n,r,i=0,a=!1)=>{let o=Math.floor(Math.max(e.width*r,1)),s=Math.floor(Math.max(e.height*r,1)),c=Math.min(i*r,o/2,s/2),l=Math.max(e.width/n.width,e.height/n.height)*r,u=e.page._exportingOrRendering&&kg.imageDownScalingEnabled&&l<1&&!a,d=t instanceof HTMLVideoElement?t.videoWidth:t?.width,f=t instanceof HTMLVideoElement?t.videoHeight:t?.height,p=n.x===0&&n.y===0&&n.width===d&&n.height===f,m=_.useMemo(()=>{if(t&&d&&f)return p&&c===0&&!u?void 0:RO()},[t,c,u,p,d,f]),h=()=>{if(!m||!t)return;m.width=o,m.height=s;let e=m.getContext(`2d`);if(!e)return;c&&(e.beginPath(),e.moveTo(c,0),e.lineTo(o-c,0),e.arc(o-c,c,c,3*Math.PI/2,0,!1),e.lineTo(o,s-c),e.arc(o-c,s-c,c,0,Math.PI/2,!1),e.lineTo(c,s),e.arc(c,s-c,c,Math.PI/2,Math.PI,!1),e.lineTo(0,c),e.arc(c,c,c,Math.PI,3*Math.PI/2,!1),e.clip());let r=u?function(e,t){var n,r;let i=RO(),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,l):t,i=u?{x:Math.floor(n.x*l),y:Math.floor(n.y*l),width:Math.floor(n.width*l),height:Math.floor(n.height*l)}:n;e.drawImage(r,i.x,i.y,i.width,i.height,0,0,m.width,m.height)};return _.useLayoutEffect(()=>{h()},[m,e.width,e.height,n.x,n.y,n.width,n.height,i,r,a,e.page._exportingOrRendering,u]),_.useEffect(()=>()=>{m&&m.nodeName===`CANVAS`&&G.Util.releaseCanvas(m)},[m]),[m||t,h]},HO=RO(),UO=ga(({element:e})=>{let t=Math.min(30,e.width/4,e.height/4),n=_.useRef(null);_.useEffect(()=>{let e=n.current;if(!e)return;let t=new G.Animation(t=>{e.rotate((t?.timeDiff||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}});let{mediaLoadingStyle:r}=Ff();return _.createElement(nf,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport},_.createElement(af,{width:e.width,height:e.height,fill:r.fill}),_.createElement(`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}))}),WO=ga(({element:e})=>{let{mediaErrorStyle:t}=Ff(),n=Math.max(10,Math.min(30,e.width/25));return _.createElement(nf,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport},_.createElement(af,{width:e.width,height:e.height,fill:t.fill}),_.createElement(cf,{text:`Can not load the video...`,fontSize:n,width:e.width,height:e.height,align:`center`,fill:t.textFill,verticalAlign:`middle`,padding:5}))}),GO=function(e,t,n){let r=_.useRef(`loading`),i=_.useRef(void 0),[a,o]=_.useState(0),s=_.useRef(),c=_.useRef(),l=_.useRef();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),_.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 KO(e){return e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA}var qO=(e,t,n)=>{let r=_.useRef(),i=()=>{var e;(e=r.current)==null||e.call(r),r.current=void 0};_.useEffect(()=>i,[]),_.useLayoutEffect(()=>{let a=`video with id ${n} url: ${t.slice(0,200)}`;e!==`loading`||r.current||(r.current=c_(a)),e!==`loading`&&i(),e===`failed`&&p_(a)},[e])},JO=ga(({element:e,store:t})=>{let[n,r]=_.useState(!1),i=_.useRef(null),a=_.useRef(null),o=e.isSelected,[s,c]=_.useState(!1),[l,u]=GO(e.src,`anonymous`),[d,f]=_.useState(!1),p=t.activePage===e.page,m=e.page._exportingOrRendering&&u===`loaded`,h=LO(e,t,m);qO(u,e.src,e.id),l&&(l.playsInline=!0);let g=((e,t,n)=>{let r=_.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=RO(),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 _.useEffect(()=>()=>{r&&r.nodeName===`CANVAS`&&G.Util.releaseCanvas(r)},[r]),r})(e,l,t._elementsPixelRatio),v=m&&h||g||HO;_.useEffect(()=>{l&&t.history.ignore(()=>{e.set({duration:1e3*l.duration})})},[l]),_.useEffect(()=>{if(!l)return;let n=t.animatedElementsIds,r=(!n.length||n.includes(e.id))&&t.isPlaying,a=p&&(r||s);if(!a){l.pause();return}a&&(l.currentTime=e.startTime*l.duration,l.play());let o=new G.Animation(()=>{se.current()},i.current?.getLayer());o.start();let u=()=>{c(!1),l.currentTime=e.startTime*l.duration},d=()=>{l.currentTime>=e.endTime*l.duration&&(l.pause(),l.currentTime=e.startTime*l.duration,c(!1))};return l.addEventListener(`ended`,u),l.addEventListener(`timeupdate`,d),()=>{l.pause(),o.stop(),l.removeEventListener(`ended`,u),l.removeEventListener(`timeupdate`,d)}},[l,s,t.isPlaying,p]),_.useEffect(()=>{l&&(l.volume=e.volume)},[l,e.volume]);let y=_.useRef(null);_.useEffect(()=>{let n=er(()=>{var n;if(l){if(m&&h){N(),t.currentTime;return}let r=t.animatedElementsIds;if(r.length&&!r.includes(e.id))return;let a=t.currentTime>=e.page.startTime&&t.currentTime<e.page.startTime+e.page.duration,o=e.startTime*l.duration*1e3,s=l.duration*(e.endTime-e.startTime)*1e3,c=((t.currentTime||e.page.startTime)-e.page.startTime)%s+o;if(a||(c=0),Math.abs(1e3*l.currentTime-c)>500||!t.isPlaying){let n=c/1e3;n!==l.currentTime&&(l.currentTime=n),!KO(l)&&!t.isPlaying&&!y.current&&(y.current=c_(`video ${e.id}`))}se.current(),(n=i.current?.getLayer())==null||n.batchDraw()}});return()=>{n(),y.current&&=(y.current(),null)}},[t,l,m,h]),_.useEffect(()=>{var t;if(!l)return;if(m){(t=y.current)==null||t.call(y),y.current=null;return}let n=()=>{var t;!KO(l)&&e.page._exportingOrRendering||(y.current&&=(se.current(),(t=i.current?.getLayer())==null||t.batchDraw(),y.current(),null))},r;return e.page._exportingOrRendering&&(r=setInterval(n,20)),l.addEventListener(`timeupdate`,n),l.addEventListener(`canplay`,n),()=>{clearInterval(r),l.removeEventListener(`timeupdate`,n),l.removeEventListener(`canplay`,n)}},[e.page._exportingOrRendering,l,e.id,c_,m]);let{cropX:b,cropY:x,cropWidth:S,cropHeight:C}=e;u!==`loaded`&&(b=x=0,S=C=1);let w=(T=v)instanceof HTMLVideoElement?T.videoWidth:T?.width||0;var T;let E=(e=>e instanceof HTMLVideoElement?e.videoHeight:e?.height||0)(v),D=w*S,ee=E*C,O=e.width/e.height,k,A,te=D/ee,ne=e.type===`svg`;ne?(k=D,A=ee):O>=te?(k=D,A=D/O):(k=ee*O,A=ee);let j={x:w*b,y:E*x,width:k,height:A},M=e.cornerRadius??0,[re,ie]=VO(e,v,j,t._elementsPixelRatio,M,!0),[ae,oe]=((e,t,n,r)=>{let[i,a]=(0,mf.default)((e=>{let[t,n]=_.useState(e);return _.useEffect(()=>{(async()=>{let r=await async function(e){return e.indexOf(`data:image/svg+xml`)>=0||e.indexOf(`.svg`)>=0?mv(hv(await pv(e))):e}(e);r!==t&&n(r)})()},[e]),t})(e.clipSrc||``),`anonymous`);qO(e.clipSrc?a:`loaded`,e.clipSrc,e.id);let o=_.useMemo(()=>{if(t&&i)return RO()},[t,i]);function s(){var r;if(!i)return;let a=t instanceof HTMLVideoElement?t.videoWidth:t?.width,s=t instanceof HTMLVideoElement?t.videoHeight:t?.height;if(!t||!a||!s||!i||!i.width||!i.height||!o)return;let c=RO(),l=Math.max(e.width/i.width*n,e.height/i.height*n);c.width=i.width*l,c.height=i.height*l,(r=c.getContext(`2d`))==null||r.drawImage(i,0,0,c.width,c.height),o.width=Math.max(a,1),o.height=Math.max(s,1);let u=o.getContext(`2d`);u&&(u.save(),u.drawImage(c,0,0,a,s),G.Util.releaseCanvas(c),u.globalCompositeOperation=`source-in`,u.drawImage(t,0,0,o.width,o.height),u.restore())}return _.useLayoutEffect(()=>{s()},[o,t,i,e.width,e.height,n,...r]),[e.clipSrc&&i?o:t,s]})(e,re,t._elementsPixelRatio,[j,M,t._elementsPixelRatio]);function N(){var e;ie(),oe(),(e=i.current?.getLayer())==null||e.batchDraw()}_.useEffect(()=>{N()});let se=_.useRef(N);se.current=N;let ce=Math.max(e.width/k,e.height/A);_.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]),_.useLayoutEffect(()=>{if(!n&&!e._cropModeEnabled)return Cb(i.current,e),er(()=>{Cb(i.current,e)},{delay:100})},[v,n,S,C,e._cropModeEnabled]),_.useLayoutEffect(()=>{var t;n||e._cropModeEnabled?(t=i.current)==null||t.clearCache():Cb(i.current,e)},[n,e.width,e.height,e._cropModeEnabled]),_.useEffect(()=>{Cb(i.current,e)},[e.shadowEnabled,e.shadowBlur,e.cornerRadius,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]);let le=_.useRef(null),ue=_.useRef(null),de=_.useRef(null);_.useLayoutEffect(()=>{e._cropModeEnabled&&(ue.current.nodes([le.current]),de.current.nodes([a.current]))},[e._cropModeEnabled]);let fe=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,k/n),a=Math.min(1,A/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*w,y:-l*E,scaleX:1,scaleY:1}),e.set({cropX:s,cropY:l,cropWidth:i,cropHeight:a})},pe=()=>{e.type!==`svg`&&e.contentEditable&&setTimeout(()=>{e.toggleCropMode(!0)})},me=u===`loading`,he=u===`failed`,ge=!me&&!he,_e=_.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),ve=ge?e.a.opacity:0;e_(i,ve);let ye=e.selectable||t.role===Hx.ADMIN,be=wb();return _.createElement(_.Fragment,null,_.createElement(nf,{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1)},me&&_.createElement(UO,{element:e}),he&&_.createElement(WO,{element:e}),_.createElement(sf,{ref:i,name:`element`,id:e.id,image:ae,x:e.a.x,y:e.a.y,width:e.a.width||1,height:e.a.height||1,rotation:e.a.rotation,opacity:ve,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:j,listening:ye,draggable:be?e.draggable&&o:e.draggable,preventDefault:!be||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:pe,onDblTap:pe,onTransformStart:()=>{r(!0),_e.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=t.target.getStage()?.findOne(`Transformer`),o=1-k/w,s=Math.min(o,Math.max(0,e.cropX)),c=1-A/E,l=Math.min(c,Math.max(0,e.cropY)),u=a.getActiveAnchor(),d=!(u.indexOf(`middle`)>=0||u.indexOf(`center`)>=0),f=!d&&r<1&&_e.current.cropHeight>A/E,p=d?e.cropWidth:e.cropWidth*r;f&&(p=e.cropWidth);let m=!d&&i<1&&_e.current.cropWidth>k/w,h=d?e.cropHeight:e.cropHeight*i;m&&(h=e.cropHeight),ne&&(p=e.cropWidth,h=e.cropHeight),e.set({cropX:s,cropY:l,x:n.x(),y:n.y(),width:n.width()*r,height:n.height()*i,rotation:t.target.rotation(),cropWidth:Math.min(p,1-s),cropHeight:Math.min(h,1-l)})},onTransformEnd:t=>{let n=t.currentTarget;e.set({width:n.width(),height:n.height(),x:n.x(),y:n.y(),rotation:t.target.rotation(),cropWidth:k/w,cropHeight:A/E}),r(!1)}}),_.createElement(af,{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:ve,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,M-e.borderSize),hideInExport:!e.showInExport}),!t.isPlaying&&_.createElement(`Image`,{image:s?d||be?BO:void 0:zO,x:e.a.x,y:e.a.y,offsetX:-e.a.width/2+15/t.scale,offsetY:-e.a.height/2+15/t.scale,rotation:e.a.rotation,width:30/t.scale,height:30/t.scale,hideInExport:!0,onClick:()=>c(!s),onTap:()=>c(!s)}),e._cropModeEnabled&&_.createElement(Hy,{selector:`.page-abs-container`,enabled:!0},_.createElement(`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)`}),_.createElement(`Image`,{listening:!1,image:ae,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}),_.createElement(`Group`,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,scaleX:ce,scaleY:ce},_.createElement(`Image`,{image:v,ref:a,width:w,height:E,opacity:.4,draggable:!0,x:-e.cropX*w,y:-e.cropY*E,onDragMove:fe,onTransform:fe}),_.createElement(`Transformer`,{ref:de,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}),_.createElement(`Rect`,{width:k,height:A,ref:le,listening:!1,onTransform:t=>{t.target.x()<-e.cropX*w-1e-9&&(t.target.x(-e.cropX*w),t.target.scaleX(1)),t.target.y()<-e.cropY*E-1e-9&&(t.target.y(-e.cropY*E),t.target.scaleY(1));let n=Math.min(1,Math.max(0,e.cropX+t.target.x()/w)),r=Math.min(1,Math.max(0,t.target.y()/E+e.cropY)),i=t.target.width()*t.target.scaleX(),a=t.target.height()*t.target.scaleY(),o=Math.min(1-n,i/w),s=Math.min(1-r,a/E),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*ce,w*(1-n)*ce),height:Math.min(a*ce,E*(1-r)*ce)})}}),_.createElement(`Transformer`,{ref:ue,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})))))}),YO={},XO=ga(({element:e,store:t})=>{let n=_.useRef(null),r=e.selectable||t.role===Hx.ADMIN,i=wb(),a=e.isSelected,o=Math.min(e.strokeWidth,e.width/2,e.height/2),s=Math.max(0,Math.min(e.width/2,e.height/2,e.cornerRadius)),c=ub(e,e.a.fill,`fill`),l=Object.assign(Object.assign({width:e.a.width,height:e.a.height},c),{cornerRadius:s,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,preventDefault:!i||a,hideInExport:!e.showInExport}),u=ub(e,e.stroke,`stroke`),d=Object.assign(Object.assign({visible:o>0,x:o/2,y:o/2,width:e.a.width-o,height:e.a.height-o},u),{strokeWidth:o,cornerRadius:Math.max(0,s-o),dash:e.dash.map(e=>e*o),hideInExport:!e.showInExport,listening:!1}),f=Math.max(0,10-Math.min(e.a.width,e.a.height)),p=(m=e.subType,YO[m]||(YO[m]=(h=Mv(m),ga(({element:e,fillProps:t,strokeProps:n,hitStrokeWidth:r})=>{let i=h({width:e.a.width,height:e.a.height,cornerRadius:e.cornerRadius}),a=1,o=1;typeof i!=`string`&&(a=i.scaleX,o=i.scaleY,i=i.path);let s=_.useRef(null);return _.createElement(_.Fragment,null,_.createElement(`Rect`,{width:e.a.width,height:e.a.height,fill:`transparent`,hitStrokeWidth:r}),_.createElement(`Path`,Object.assign({},t,{ref:s,data:i,scaleX:a,scaleY:o})),_.createElement(`Group`,{clipFunc:e=>{let t=s.current;if(t){var n=t.dataArray;e.beginPath();for(var r=0;r<n.length;r++){var i=n[r].command,a=n[r].points;switch(i){case`L`:e.lineTo(a[0],a[1]);break;case`M`:e.moveTo(a[0],a[1]);break;case`C`:e.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case`Q`:e.quadraticCurveTo(a[0],a[1],a[2],a[3]);break;case`A`:var o=a[0],c=a[1],l=a[2],u=a[3],d=a[4],f=a[5],p=a[6],m=a[7],h=l>u?l:u,g=l>u?1:l/u,_=l>u?u/l:1;e.translate(o,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(-o,-c);break;case`z`:e.closePath()}}}},scaleX:a,scaleY:o},_.createElement(`Path`,Object.assign({},n,{x:0,y:0,data:i,strokeWidth:2*n.strokeWidth,dash:n.dash.map(e=>e)}))))}))),YO[m]||`Group`);var m,h;return _.createElement(_.Fragment,null,_.createElement(nf,{ref:n,id:e.id,x:e.a.x,y:e.a.y,rotation:e.a.rotation,opacity:e.a.opacity,listening:r,draggable:i?e.draggable&&a: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()})},onTransform:t=>{let n=t.target.scale();t.target.scaleX(1),t.target.scaleY(1),e.set({width:e.width*n.x,height:e.height*n.y,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation()})}},_.createElement(p,{element:e,fillProps:l,strokeProps:d,hitStrokeWidth:f})))}),ZO=o((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}}})),QO=o((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 i.length?t[n]=r(a,i.index,i.length):t[n]=a[i.index],t},{})}}})),$O=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var t=ZO(),n=QO(),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})}]})),ek=o((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}})),tk=o((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}})),nk=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.decompressFrames=e.decompressFrame=e.parseGIF=void 0;var t=o($O()),n=ZO(),r=QO(),i=ek(),a=tk();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 r.descriptor.lct&&r.descriptor.lct.exists?l.colorTable=r.lct:l.colorTable=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 rk(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 ik=ga(({element:e})=>{let t=Math.min(30,e.width/4,e.height/4),n=_.useRef(null);_.useEffect(()=>{let e=n.current;if(!e)return;let t=new G.Animation(t=>{e.rotate((t?.timeDiff||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}},[]);let{mediaLoadingStyle:r}=Ff();return _.createElement(nf,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport},_.createElement(af,{width:e.width,height:e.height,fill:r.fill}),_.createElement(`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}))}),ak=ga(({element:e})=>{let{mediaErrorStyle:t}=Ff(),n=Math.max(10,Math.min(30,e.width/22));return _.createElement(nf,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport},_.createElement(af,{width:e.width,height:e.height,fill:t.fill}),_.createElement(cf,{text:`Cannot load the GIF...`,fontSize:n,width:e.width,height:e.height,align:`center`,fill:t.textFill,verticalAlign:`middle`,padding:5}))}),ok=ga(({element:e,store:t})=>{let[n,r]=_.useState(!1),i=e.isSelected,a=_.useRef(null),o=_.useRef(),[s,c,l,u]=function(e){let[t,n]=_.useState([]),[r,i]=_.useState(0),[a,o]=_.useState(`loading`),[s,c]=_.useState({width:0,height:0});return _.useEffect(()=>{(async()=>{try{let t=(0,nk.parseGIF)(await(await fetch(e)).arrayBuffer()),r=(0,nk.decompressFrames)(t,!0),a=t.lsd.width,s=t.lsd.height;c({width:a,height:s});let l=r.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})),u=l.reduce((e,t)=>e+t.delay,0);n(l),i(u),o(`loaded`)}catch(e){console.error(`Failed to load GIF:`,e),o(`failed`)}})()},[e]),[t,r,s,a]}(e.src);aS(u,e.src,e.id),_.useEffect(()=>(o.current=document.createElement(`canvas`),()=>{o.current&&G.Util.releaseCanvas(o.current)}),[]),_.useEffect(()=>{if(u===`loaded`&&o.current&&(o.current.width=l.width,o.current.height=l.height,s.length>0)){let e=o.current.getContext(`2d`);if(e){e.clearRect(0,0,l.width,l.height);let t=document.createElement(`canvas`);rk(s[0],o.current,t)}}},[l,u,s]),_.useEffect(()=>{if(!s.length||!o.current)return;let n=o.current;n.width=l.width,n.height=l.height;let r=document.createElement(`canvas`),i=n.getContext(`2d`);i&&i.clearRect(0,0,n.width,n.height);let u=-1;rk(s[0],n,r),y(),u=0;let d=e=>{let t=(e=>{let t=e%c,n=0;for(let e=0;e<s.length;e++)if(n+=s[e].delay,n>t)return e;return 0})(e);t!==u&&(rk(s[t],n,r),y(),a.current.getLayer().draw(),u=t)};if(t.isPlaying||e.page._exportingOrRendering)return er(()=>{d(t.currentTime-e.page.startTime)});{let e=window.setInterval(()=>{d(t.currentTime||performance.now())},16);return()=>{clearInterval(e)}}},[t.isPlaying,s,c,e.page._exportingOrRendering]),_.useEffect(()=>{c&&t.history.ignore(()=>{e.set({duration:c})})},[c]);let{cropX:d,cropY:f,cropWidth:p,cropHeight:m}=e;u!==`loaded`&&(d=f=0,p=m=1);let h={x:l.width*d,y:l.height*f,width:l.width*p,height:l.height*m},g=e.cornerRadius??0,[v,y]=VO(e,o.current,h,t._elementsPixelRatio,g,n||e._cropModeEnabled);_.useLayoutEffect(()=>{if(!n&&!e._cropModeEnabled&&a.current)return Cb(a.current,e),er(()=>{Cb(a.current,e)},{delay:100})},[o.current,n,p,m,e._cropModeEnabled,l.width,l.height]);let b=u===`loading`,x=u===`failed`,S=b||x?0:e.a.opacity;e_(a,S);let C=e.selectable||t.role===Hx.ADMIN,w=wb();return _.createElement(_.Fragment,null,b&&_.createElement(ik,{element:e}),x&&_.createElement(ak,{element:e}),_.createElement(sf,{ref:a,name:`element`,id:e.id,image:v,x:e.a.x,y:e.a.y,width:e.a.width||1,height:e.a.height||1,rotation:e.a.rotation,opacity:S,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:h,listening:C,draggable:w?e.draggable&&i:e.draggable,preventDefault:!w||i,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:()=>r(!0),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),e.set({x:n.x(),y:n.y(),width:n.width()*r,height:n.height()*i,rotation:n.rotation()})},onTransformEnd:()=>r(!1)}),_.createElement(af,{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:S,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,g-e.borderSize),hideInExport:!e.showInExport}))}),sk=`#0d83dd`,ck=(e,t)=>{let n=e.target.getStage();n&&(n.container().style.cursor=t)},lk=ga(({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})=>_.createElement(_.Fragment,null,t&&_.createElement(`Rect`,{x:u.x,y:u.y,width:u.width,height:u.height,fill:`rgba(13, 131, 221, 0.08)`,listening:!1}),_.createElement(af,{x:n,y:r,width:i,height:a,cornerRadius:Math.min(i,a)/2,fill:t?sk:`#9ca3af`,opacity:t?.55:.18,listening:!1}),_.createElement(af,{x:o,y:s,width:c,height:l,fill:`transparent`,onMouseEnter:e=>{m({kind:d,idx:f}),ck(e,`pointer`)},onMouseLeave:e=>{m(null),ck(e,``)},onClick:p}))),uk=ga(({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 _.createElement(nf,{x:e,y:t,onMouseEnter:e=>{c({kind:r,idx:i}),ck(e,`pointer`)},onMouseLeave:e=>{c(null),ck(e,``)},onClick:e=>{e.cancelBubble=!0,s()}},_.createElement(af,{x:-l/2,y:-l/2,width:l,height:l,fill:`transparent`}),p&&_.createElement(_.Fragment,null,_.createElement(`Circle`,{radius:u+d,fill:`white`,listening:!1}),_.createElement(`Circle`,{radius:u,fill:sk,listening:!1}),_.createElement(`Line`,{points:[.55*-u,0,.55*u,0],stroke:`white`,strokeWidth:f,lineCap:`round`,listening:!1}),_.createElement(`Line`,{points:[0,.55*-u,0,.55*u],stroke:`white`,strokeWidth:f,lineCap:`round`,listening:!1})))}),dk=ga(({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(_.createElement(lk,{key:`col-pill-${t}`,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}))}for(let n=0;n<=e.cols;n++)m.push(_.createElement(uk,{key:`col-insert-${n}`,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}));for(let t=0;t<e.rows;t++){let n=Math.max(0,p[t+1]-p[t]-6);n<=0||m.push(_.createElement(lk,{key:`row-pill-${t}`,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}))}for(let n=0;n<=e.rows;n++)m.push(_.createElement(uk,{key:`row-insert-${n}`,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}));return _.createElement(_.Fragment,null,m)}),fk=ga(({element:e,store:t})=>{let n=_.useRef(null),r=_.useRef(null),i=e.selectable||t.role===Hx.ADMIN,a=wb(),o=e.isSelected,s=e._focusedCellIds.length>0,c=e.editingCell,l=1/Math.max(.01,t.scale),[u,d]=_.useState(null);_.useEffect(()=>{o||(e.clearCellFocus(),d(null))},[o]);let f=c?._editModeEnabled;_.useEffect(()=>{e._editingCellId&&c&&!c._editModeEnabled&&e.exitCellEdit()},[f]),_.useEffect(()=>{s&&!e._editingCellId&&setTimeout(()=>r.current?.focus(),0)},[s,e._editingCellId]);let p=_.useMemo(()=>It.box(!1),[]);_.useEffect(()=>er(()=>{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(_.createElement(of,{key:`bt-${t.id}`,points:[i,r,s,r],stroke:e.color,strokeWidth:e.width,dash:h(e.style,e.width),listening:!1}))}}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(_.createElement(of,{key:`bl-${t.id}`,points:[a,o,a,s],stroke:e.color,strokeWidth:e.width,dash:h(e.style,e.width),listening:!1}))}}{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(_.createElement(of,{key:`bb-${t.id}`,points:[s,r,c,r],stroke:e.color,strokeWidth:e.width,dash:h(e.style,e.width),listening:!1}))}}{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(_.createElement(of,{key:`br-${t.id}`,points:[a,s,a,c],stroke:e.color,strokeWidth:e.width,dash:h(e.style,e.width),listening:!1}))}}}return _.createElement(_.Fragment,null,_.createElement(af,{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:()=>{Qn(()=>p.set(!0))},onTransformEnd:()=>{e._resetBaseRowHeights(),Qn(()=>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)}}),_.createElement(nf,{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},e.visibleCells.map(t=>{let n=e.getCellRect(t.row,t.col,t.rowSpan,t.colSpan);return t.cellBackground===`transparent`?null:_.createElement(af,{key:`bg-${t.id}`,x:n.x,y:n.y,width:n.width,height:n.height,fill:t.cellBackground,listening:!1})}),g,e.visibleCells.map(e=>_.createElement(Rb,{key:`text-${e.id}`,element:e,store:t})),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 _.createElement(`Rect`,{key:`focus-${t}`,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})}),s&&!c&&_.createElement(Vy,null,_.createElement(`input`,{ref:r,style:{position:`absolute`,opacity:0,width:`1px`,height:`1px`,pointerEvents:`none`},readOnly:!0})),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(_.createElement(`Line`,{key:`col-resize-${i}`,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()}}))}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(_.createElement(`Line`,{key:`row-resize-${i}`,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,Qn(()=>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(),Qn(()=>p.set(!1)),t.history.endTransaction()}}))}return n})(),o&&!c&&!t.isPlaying&&_.createElement(dk,{element:e,store:t,inv:l,isTouch:a,hover:u,setHover:d})))}),pk=ga(({element:e})=>{let{highlighterStyle:t}=Ff();return _.createElement(af,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))}),mk={text:Rb,image:oS,svg:oS,line:KS,video:JO,figure:XO,group:ga(e=>{let{element:t,store:n}=e,{children:r}=t,i=t.selectable||n.role===Hx.ADMIN;return _.createElement(nf,{opacity:t.opacity,listening:i,hideInExport:!t.showInExport,id:t.id},r.map(t=>_.createElement(gk,Object.assign({},e,{key:t.id,store:n,element:t}))))}),gif:ok,table:fk},hk=(e,t)=>{let n=[];Ay(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 G.Transform;n.translate(e.x,e.y),n.rotate(G.Util.degToRad(e.rotation)),t.forEach(e=>{let t=n.point(e);r.push(t)})});let i=new G.Transform;i.rotate(-G.Util.degToRad(t));let a=1/0,o=1/0,s=-1/0,c=-1/0;r.forEach(e=>{let t=i.point(e);a=Math.min(a,t.x),o=Math.min(o,t.y),s=Math.max(s,t.x),c=Math.max(c,t.y)}),i.invert();let l=i.point({x:a,y:o});return{x:l.x,y:l.y,width:s-a,height:c-o,rotation:t}},gk=ga(e=>{let{element:t,store:n}=e,[r,i]=_.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]=_.useState(!1),d=(e=>{let[t,n]=_.useState();return _.useEffect(()=>{let t=setTimeout(()=>{let t=e.page.id,r=G.stages.find(e=>e.getAttr(`pageId`)===t);r||console.error(`No stage is found for element`,e.id),n(r)});return()=>clearTimeout(t)},[e.id]),t})(t),f=_.useRef(),p=()=>(f.current||=d?.findOne(`Transformer`),f.current);_.useEffect(()=>{if(d){let e=e=>{let r=e.target.findAncestor(`.element`,!0),a=n.getElementById(r?.id())?.top;i(a?.id===t.id)};d.on(`mouseover`,e);let r=()=>{i(!1)};return d.on(`mouseleave`,r),()=>{d.off(`mouseover`,e),d.off(`mouseleave`,r)}}},[d]),_.useEffect(()=>{if(!c)return;let e=p();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 m=mk[e.element.type];return e.element.type===`text`&&kg.htmlRenderEnabled&&(m=NS),e.element.visible?m?_.createElement(nf,{name:`element-container`},_.createElement(m,Object.assign({},e)),(r||c)&&!a&&!o&&!l&&_.createElement(pk,{element:t.type===`group`?{a:hk(t,c?`rotation`in s[0]?s[0].rotation:0:p()?.rotation()||0)}:t})):(console.error(`Can not find component for `+e.element.type),null):null});function _k(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 vk(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 yk(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 bk(e,t){if(e.length===0)throw Error(`Cannot create SVG from empty path`);let n=t.smooth?_k(e):e,r=yk(n),i=t.strokeWidth,a=r.x-i,o=r.y-i,s=r.width+2*i,c=r.height+2*i;return{src:mv(`\n <svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${c}" viewBox="0 0 ${s} ${c}">\n <path\n d="${vk(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 xk=ga(({store:e,page:t,width:n,height:r,scale:i,xPadding:a,yPadding:o,bleed:s})=>{let[c,l]=_.useState(!1),[u,d]=_.useState([]),f=_.useRef(null),p=e.tool===`draw`,{strokeWidth:m,stroke:h,opacity:g,brushType:v}=e.toolOptions,y=_.useCallback(e=>{if(!p||(l(!0),e.cancelBubble=!0,!e.target.getStage()))return;let t=f.current.getRelativePointerPosition();t&&d([{x:t.x,y:t.y}])},[p,i,a,o,s]),b=_.useCallback(e=>{if(!p||!c||(e.cancelBubble=!0,!e.target.getStage()))return;let t=f.current.getRelativePointerPosition();t&&d(e=>[...e,{x:t.x,y:t.y}])},[p,c,i,a,o,s]),x=_.useCallback(()=>{if(p&&c){if(l(!1),u.length>=1)try{let n=bk(u,{stroke:h,strokeWidth:m,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:g},{skipSelect:!0})}),e.selectElements(r)}catch(e){console.error(`Error creating path SVG:`,e)}d([])}},[p,c,u,h,m,g,t,e.history,e]);_.useEffect(()=>{if(!c)return;let e=()=>x();return window.addEventListener(`mouseup`,e),window.addEventListener(`touchend`,e),()=>{window.removeEventListener(`mouseup`,e),window.removeEventListener(`touchend`,e)}},[c,x]);let S=_.useMemo(()=>u.flatMap(e=>[e.x,e.y]),[u]);return _.useEffect(()=>{if(p&&f.current){let e=f.current.getStage();if(!e)return;let t=m*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="${h}" opacity="${g}" 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=``)}}},[p,h,m,g,i]),p?_.createElement(nf,{ref:f,listening:p,x:a+s*i,y:o+s*i,scaleX:i,scaleY:i},_.createElement(af,{x:-(a+s*i)/i,y:-(o+s*i)/i,width:n/i,height:r/i,fill:`transparent`,onMouseDown:y,onMouseMove:b,onMouseUp:x,onTouchStart:y,onTouchMove:b,onTouchEnd:x}),u.length>0&&_.createElement(`Line`,{points:S,stroke:h,strokeWidth:m,lineCap:`round`,lineJoin:`round`,opacity:g,tension:.5,listening:!1})):null});function Sk(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 Ck=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},wk=e=>ff.batchedUpdates(e,null);ea(e=>{ff.isAlreadyRendering()?queueMicrotask(()=>wk(e)):wk(e)});var Tk=G.DD._drag;window.removeEventListener(`mousemove`,Tk),G.DD._drag=function(e){Qn(()=>{Tk.call(this,e)})},window.addEventListener(`mousemove`,G.DD._drag);var Ek={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},Dk={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`]}},Ok=e=>_.createElement(af,Object.assign({},e,{preventDefault:!1})),kk=e=>{var{url:t}=e,n=Ck(e,[`url`]);let[r,i]=(0,mf.default)(t,`anonymous`),a=r?Sk(r,{width:n.width,height:n.height},`center-middle`):{};return aS(i,t,`page background`),_.createElement(sf,Object.assign({image:r},n,a))},Ak=e=>{let t=ub({a:{width:e.width,height:e.height},width:e.width,height:e.height},e.fill);return _.createElement(af,Object.assign({},e,t))},jk=e=>{let{background:t,scale:n,borderColor:r,transparencyBackgroundColor:i}=e,a=Ck(e,[`background`,`scale`,`borderColor`,`transparencyBackgroundColor`]),o=_.useMemo(()=>!!G.Util.colorToRGBA(t)||$_(t),[t]),s=_.useMemo(()=>{if($_(t))return!0;let e=G.Util.colorToRGBA(t);return!e||e.a<1},[t]),c=_.useMemo(()=>{if(!s||i)return null;let e=document.createElement(`canvas`);e.width=60,e.height=60;let t=e.getContext(`2d`);return t&&(t.fillStyle=`black`,t.fillRect(30,0,30,30),t.fillRect(0,30,30,30)),e},[s,i]);return _.createElement(_.Fragment,null,s&&(i?_.createElement(`Rect`,Object.assign({fill:i},a,{hideInExport:!0})):_.createElement(`Rect`,Object.assign({fillPatternImage:c},a,{opacity:.1,hideInExport:!0}))),o?_.createElement(Ak,Object.assign({fill:t},a)):_.createElement(kk,Object.assign({url:t},a)))},Mk=ga(({selection:e})=>{if(!e.visible)return null;let{selectionRectStyle:t}=Ff();return _.createElement(af,{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})});function Nk(e){let t=180*e/Math.PI;return t%=360,t>180?t-=360:t<-180&&(t+=360),Math.round(t)}var Pk=ga(({x:e,y:t,width:n,height:r,rotation:i,anchor:a,store:o})=>{let{transformLabelStyle:s}=Ff();if(e===void 0||t===void 0||n===void 0||r===void 0||i===void 0||a===void 0)return null;let c=Vv({x:e,y:t,width:n,height:r,rotation:G.Util.radToDeg(i)}),l=(r/2+70)*Math.cos(i-Math.PI/2),u=(r/2+70)*Math.sin(i-Math.PI/2),d=q_({unit:o.unit,dpi:o.dpi,px:n/o.scale,precious:o.unit===`px`?0:1})+` x `+q_({unit:o.unit,dpi:o.dpi,px:r/o.scale,precious:o.unit===`px`?0:1})+(o.unit===`px`?``:` `+o.unit);return _.createElement(_.Fragment,null,_.createElement(rf,{x:(c.minX+c.maxX)/2+l,y:(c.minY+c.maxY)/2+u,offsetX:14,offsetY:14,visible:a===`rotater`},_.createElement(`Tag`,{cornerRadius:5,fill:s.fill}),_.createElement(cf,{align:`center`,verticalAlign:`middle`,fill:s.textFill,padding:8,text:Nk(i).toString()+`°`})),_.createElement(rf,{x:(c.minX+c.maxX)/2,y:c.maxY+20,visible:a!==`rotater`},_.createElement(`Tag`,{cornerRadius:5,fill:s.fill,pointerDirection:`up`,pointerHeight:0,pointerWidth:0}),_.createElement(cf,{align:`center`,verticalAlign:`middle`,fill:s.textFill,padding:8,text:d})))}),Fk=ga(({elements:e,store:t})=>{let n=e.filter(e=>e.alwaysOnTop),r=e.filter(e=>!e.alwaysOnTop).concat(n);return _.createElement(_.Fragment,null,r.map(e=>_.createElement(gk,{key:e.id,store:t,element:e,onClick:()=>{console.warn(`Polotno warning: onClick callback is deprecated. Just stop using it. Polotno will do selection automatically.`)}})))}),Ik=({store:e})=>{let[t,n]=_.useState(!1),[r,i]=_.useState({x:0,y:0});return{open:_.useCallback(e=>{n(!0),i(e)},[]),close:_.useCallback(()=>{n(!1)},[]),props:{isOpen:t,offset:r,setIsOpen:n}}},Lk=null,Rk=atob(`UG9sb3RubyBmcmVlIGxpY2Vuc2UgbGltaXRhdGlvbiBleGNlZWRlZCAtIFBsZWFzZSB1cGdyYWRlIHlvdXIgYWNjb3VudC4=`),zk=atob(`I2MwMzkyYg==`),Bk=atob(`djAuOS4y`),Vk=e=>_.createElement(_.Fragment,null,_.createElement(rf,{fill:zk,height:200},_.createElement(`Tag`,{fill:zk}),_.createElement(cf,Object.assign({},e,{fill:`white`,text:Rk,height:void 0,padding:10,fontSize:20})))),Hk=atob(`RlJFRSAgVFJJQUwgIExJQ0VOU0U=`),Uk=(atob(`UG93ZXJlZCBieSBQb2xvdG5v`),atob(`TElDRU5TRSAgS0VZICBJUyAgTUlTU0lORw==`)),Wk=atob(`UGxlYXNlIGFjdGl2YXRlIHlvdXIgbGljZW5zZS4KTGljZW5zZSByZWxhdGVkIHF1ZXN0aW9uczoKcG9sb3Ruby5jb20vY29udGFjdA==`),Gk=e=>{let t=Vg()===1,n=t?Uk:Hk,r=t?230:195;return _.createElement(nf,Object.assign({},e,{listening:!1}),_.createElement(af,{fill:zk,width:r,height:24,cornerRadius:2}),_.createElement(cf,{text:n,fill:`white`,fontSize:13,fontFamily:`monospace`,width:r,align:`center`,y:5,listening:!1}),t&&_.createElement(`Text`,{text:Wk,fill:`rgba(0,0,0,0.6)`,fontSize:14,y:30,listening:!1}))},Kk=ga(({store:e,page:t,width:n,height:r,pageControlsEnabled:i,components:a,altCloneEnabled:o,groupClickBehavior:s=`select-child`,viewportSize:c,layout:l=`vertical`,tooltipSafeArea:u,transformerSafeArea:d})=>{let f=Ff(),p=f.transformerStyle,m=Ek,h=e.bleedVisible?t.bleed:0,g=t.computedWidth+2*h,v=t.computedHeight+2*h,y=(n-g*e.scale)/2,b=(r-v*e.scale)/2,x=_.useRef(null),S=_.useRef(null),C=_.useRef(null),w=i==null||i,T=_.useRef(!1),[E,D]=_.useState(null),[ee,O]=_.useState({}),[k,A]=_.useState(0),te=Ik({store:e}),ne=e.selectedElements.find(e=>e._cropModeEnabled),j=e.selectedElements.find(e=>e.curveEnabled),M=e.selectedShapes.filter(e=>!e.resizable).length>0,re=e.selectedShapes.filter(e=>!e.draggable).length>0,ie=e.selectedElements.filter(e=>!e.visible).length>0;_.useLayoutEffect(()=>{var t;if(!x.current)return;let n=x.current.getStage(),r=e.selectedShapes.map(e=>e._cropModeEnabled?null:n.findOne(`#`+e.id)).filter(e=>!!e),i=e.selectedElements.length===1,a=i&&e.selectedElements[0]?.type||`many`,o=Dk[a],s=Object.assign(Object.assign({},m),o||{});o&&(a!==`svg`&&a!==`image`&&a!==`gif`||e.selectedElements[0].keepRatio||(s.enabledAnchors=m.enabledAnchors),a===`text`&&kg.textVerticalResizeEnabled&&(s.enabledAnchors=Dk.text.enabledAnchors?.concat([`bottom-center`,`top-center`])),a===`text`&&i&&e.selectedElements[0].curveEnabled&&(s.enabledAnchors=Dk.many.enabledAnchors)),x.current.setAttrs(Object.assign(Object.assign({},s),p)),M&&x.current.enabledAnchors([]),re&&x.current.rotateEnabled(!1),r.find(e=>e?.isDragging())&&r.forEach(e=>{e.isDragging()||e==null||e.startDrag()}),x.current.nodes(r),LS(),(t=x.current.getLayer())==null||t.batchDraw()},[e.selectedShapes,ne,M,ie,re,j,p]);let ae=()=>{let e=x.current;if(!e)return;if(!e.isTransforming()){O({});return}if(!e.nodes().length||!e.isTransforming())return;let t=e.__getNodeRect(),n=e?.getActiveAnchor(),r=e.getStage();O({anchor:n,x:t.x-(r?.x()??0),y:t.y-(r?.y()??0),rotation:t.rotation,width:t.width,height:t.height})},oe=_.useCallback(()=>{if(x.current?.isTransforming())return;let e=x.current;if(!e||!e.nodes().length){A(0);return}let t=e.getClientRect();e.getStage()&&A(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()))},[d,n,r]);_.useEffect(()=>{var e;(e=x.current)==null||e.update(),ae(),oe()},[e.scale,oe]),_.useEffect(()=>{oe()},[e.selectedShapes,oe]);let N=ba(()=>({visible:!1,x1:0,y1:0,x2:0,y2:0})),se=_.useRef(!1),ce=Xn(t=>{if(e.role===Hx.VIEWER)return;se.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,N.visible=!0,N.x1=a.x,N.y1=a.y,N.x2=a.x,N.y2=a.y,(t.target.getStage()?.getPointersPositions().length??0)>=2&&(N.visible=!1))});(({stageRef:e,containerRef:t,viewportSize:n})=>{_.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:S,containerRef:C,viewportSize:c}),_.useEffect(()=>{let t=Xn(e=>{var t;if(!N.visible)return;(t=S.current)==null||t.setPointersPositions(e);let n=S.current?.getPointerPosition();n?(n.x-=S.current?.x()??0,n.y-=S.current?.y()??0):n={x:N.x2,y:N.y2},N.x2=n.x,N.y2=n.y}),n=Xn(()=>{if(!N.visible||!S.current)return;let t=S.current.findOne(`.selection`),n=t?t.getClientRect({skipStroke:!0}):{width:0,height:0,x:0,y:0};if(n.width&&n.height){let t=[];S.current.find(`.element`).forEach(r=>{let i=r.getClientRect(),a=e.getElementById(r.id()),o=a?.draggable,s=a?.selectable;G.Util.haveIntersection(n,i)&&o&&s&&t.push(a.top.id)});let r=[...new Set(t)];se.current=!0,e.selectElements(r)}N.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 le=_.useCallback(n=>{if(!e.selectedElements[0]||n&&e.selectedElementsIds.includes(n))return;let r=Hv(e.selectedShapes),i=Vv(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(E)!==JSON.stringify(a)&&D(a)},[e,t]);_.useEffect(()=>{e.selectedElements[0]&&e.distanceGuidesVisible?le():E&&D(null)},[e.distanceGuidesVisible,le,e.selectedShapes.map(e=>`${e.x},${e.y},${e.width},${e.height},${e.rotation}`).join(`|`)]);let ue=_.useRef(!1);_.useEffect(()=>{let e,t=C.current?.closest(`.polotno-workspace-inner`),n=()=>{ue.current=!0,clearTimeout(e),e=setTimeout(()=>{ue.current=!1},300)};return t?.addEventListener(`scroll`,n),()=>{clearTimeout(e),t?.removeEventListener(`scroll`,n)}},[]),_.useEffect(()=>{let e=S.current;if(!e)return;let t=e.container(),n=e=>{var t,n;e.touches.length>=2&&((t=x.current)!=null&&t.isDragging()&&x.current.stopDrag(),(n=x.current)==null||n.nodes().forEach(e=>{e.isDragging()&&e.stopDrag()}))};return t.addEventListener(`touchstart`,n,{passive:!0}),t.addEventListener(`touchmove`,n,{passive:!0}),()=>{t.removeEventListener(`touchstart`,n),t.removeEventListener(`touchmove`,n)}},[]);let de=n=>{if(e.role===Hx.VIEWER||(e.activePage!==t&&t.select(),ue.current)||se.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||N.visible)){e.selectElements([]),e.selectPages([]);return}if(i&&!r){let t=S.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===`select-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([]))};RS(x,e);let fe=e.activePage===t,pe=e._selectedPagesIds.includes(t.id),me=a?.PageControls,he=a?.Tooltip,ge=a?.ContextMenu,_e=1/e.scale,ve=0/e.scale;return _.createElement(`div`,{ref:C,onDragOver:e=>e.preventDefault(),onDrop:n=>{if(n.preventDefault(),e.role===Hx.VIEWER||!S.current)return;S.current.setPointersPositions(n);let r=S.current.findOne(`.elements-container`)?.getRelativePointerPosition(),i=S.current.getPointerPosition(),a=S.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];Lk&&r&&(Lk(r,s,{elements:o,page:t}),Lk=null)},style:{position:`relative`,width:n+`px`,height:r+`px`,overflow:`hidden`,flexShrink:0},className:`polotno-page-container`+(fe?` active-page`:``)},_.createElement(pf,{ref:S,width:Math.min(n,c.width+200),height:Math.min(c.height+200,r),onClick:de,onTap:de,onContextMenu:t=>{if(t.evt.preventDefault(),e.role===Hx.VIEWER)return;let n=t.target.findAncestor(`.element`,!0),r=e.getElementById(n?.id())?.top?.id;r?e.selectedElementsIds.indexOf(r)>=0||e.selectElements([r]):e.selectElements([]),te.open({x:t.evt.clientX,y:t.evt.clientY})},onMouseDown:ce,onMouseMove:t=>{if(!e.distanceGuidesVisible&&!t.evt.altKey){E&&D(null);return}le(t.target.findAncestor(`.element`,!0)?.id())},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;!(r&&e.selectedElementsIds.indexOf(r.id)>=0||a&&e.selectedElementsIds.indexOf(a)>=0)&&a&&(e.selectElements([a]),t.target.stopDrag(),t.target.startDrag(t),(n=x.current)==null||n.startDrag(t))}E&&D(null)},pageId:t.id,style:{position:`absolute`,overflow:`hidden`,top:0,left:0}},_.createElement(tf,null,_.createElement(Ok,{width:n,height:r,fill:f.workspaceBackgroundColor}),_.createElement(nf,{x:y,y:b,scaleX:e.scale,scaleY:e.scale,name:`page-container`},_.createElement(nf,{name:`page-container-2`},_.createElement(nf,{name:`page-background-group`,x:h,y:h},_.createElement(jk,{x:-t.bleed,y:-t.bleed,width:t.computedWidth+2*t.bleed,height:t.computedHeight+2*t.bleed,background:t.background,transparencyBackgroundColor:f.transparencyBackgroundColor,name:`page-background`,preventDefault:!1,scale:e.scale})),_.createElement(nf,{x:h,y:h,name:`elements-container`,listening:!e.isPlaying&&e.role!==Hx.VIEWER},_.createElement(af,{name:`elements-area`,width:t.computedWidth,height:t.computedHeight,listening:!1}),_.createElement(Fk,{elements:t.children,store:e})),_.createElement(af,{stroke:f.bleedColor,name:`bleed`,strokeWidth:t.bleed,x:t.bleed/2,y:t.bleed/2,width:t.computedWidth+t.bleed,height:t.computedHeight+t.bleed,listening:!1,visible:t.bleed>0&&e.bleedVisible,hideInExport:!0}),zg()===Bk&&_.createElement(Vk,{name:`hit-detection`,x:-_e/2-ve,y:-_e/2-ve,width:g+_e+2*ve,height:v+_e+2*ve}))),_.createElement(of,{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}),_.createElement(nf,{x:y,y:b,scaleX:e.scale,scaleY:e.scale},_.createElement(af,{name:`page-highlight`,hideInExport:!0,x:-_e/2-ve,y:-_e/2-ve,width:g+_e+2*ve,height:v+_e+2*ve,stroke:pe?f.activePageBorderColor:f.pageBorderColor,strokeWidth:2,listening:!1,strokeScaleEnabled:!1})),_.createElement(nf,{x:y+h*e.scale,y:b+h*e.scale,scaleX:e.scale,scaleY:e.scale,name:`page-abs-container`},_.createElement(df,{ref:x,rotateAnchorAngle:k,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)}),T.current=!0,e.history.startTransaction())},onDragEnd:()=>{T.current&&=(e.history.endTransaction(),!1),oe()},onTransformStart:()=>{e.history.startTransaction(),D(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,l.x=t.x),c<e.minHeight&&(l.height=t.height,l.y=t.y),l}}return n},onTransform:e=>{let t=x.current.nodes(),n=t[t.length-1];e.target===n&&setTimeout(()=>{ae()},0)},onTransformEnd:t=>{O({}),e.history.endTransaction(),oe()},visible:!e.isPlaying}),E&&E.map(({points:t,distance:n,box1:r,box2:i},a)=>_.createElement(`Group`,{name:`distances-container`,hideInExport:!0,key:a,listening:!1},_.createElement(`Rect`,Object.assign({},r,{stroke:f.distanceGuideStyle.stroke,strokeWidth:1,strokeScaleEnabled:!1})),_.createElement(`Rect`,Object.assign({},i,{stroke:f.distanceGuideStyle.stroke,strokeWidth:1,strokeScaleEnabled:!1})),_.createElement(`Line`,{points:[t[0].x,t[0].y,t[1].x,t[1].y],stroke:f.distanceGuideStyle.stroke,strokeWidth:1,strokeScaleEnabled:!1}),_.createElement(`Line`,{points:[t[1].x,t[1].y,t[2].x,t[2].y],stroke:f.distanceGuideStyle.stroke,strokeWidth:1,strokeScaleEnabled:!1}),_.createElement(`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},_.createElement(`Tag`,{cornerRadius:5,fill:f.distanceGuideStyle.labelFill,pointerDirection:`down`}),_.createElement(`Text`,{align:`center`,verticalAlign:`middle`,fill:f.distanceGuideStyle.labelTextFill,padding:5,text:Y_({unit:e.unit,dpi:e.dpi,px:n})})))),t._rendering&&_.createElement(`Group`,null,_.createElement(`Rect`,{width:g,height:v,fill:`rgba(255,255,255,0.9)`}),_.createElement(`Text`,{text:`Rendering...`,fontSize:60,width:g,height:v,align:`center`,verticalAlign:`middle`})),he&&_.createElement(he,{components:a,store:e,page:t,stageRef:S,tooltipSafeArea:u}),ge&&_.createElement(Vy,null,_.createElement(ge,Object.assign({components:a,store:e},te.props)))),_.createElement(xk,{store:e,page:t,width:n,height:r,scale:e.scale,xPadding:y,yPadding:b,bleed:h}),_.createElement(Pk,Object.assign({},ee,{store:e})),_.createElement(Mk,{selection:N}),Vg()>0&&_.createElement(`Group`,{hideInExport:!0},_.createElement(Gk,{name:`cache-bounds`,x:n-(Vg()===1?250:210),y:r-(Vg()===1?95:45)}),_.createElement(Gk,{name:`cache-bounds-t`,x:10,y:10})),Hg()&&_.createElement(`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`)}}),_.createElement(nf,{name:`line-guides`}))),w&&me&&_.createElement(me,{store:e,page:t,xPadding:y,yPadding:b,layout:l}))}),qk=xS(`div`,_.forwardRef)`
|
|
301
|
-
position: absolute;
|
|
302
|
-
top: 0;
|
|
303
|
-
left: 0;
|
|
304
|
-
pointer-events: none;
|
|
305
|
-
`,Jk=xS(`div`,_.forwardRef)`
|
|
306
|
-
height: 14px;
|
|
307
|
-
position: sticky;
|
|
308
|
-
font-size: 8px;
|
|
309
|
-
line-height: 14px;
|
|
310
|
-
top: 0;
|
|
311
|
-
left: 0;
|
|
312
|
-
color: grey;
|
|
313
|
-
border-bottom: 1px solid grey;
|
|
314
|
-
background-color: #e8e8e8;
|
|
315
|
-
overflow: hidden;
|
|
316
|
-
box-sizing: border-box;
|
|
317
|
-
`,Yk=xS(`div`,_.forwardRef)`
|
|
318
|
-
left: 0;
|
|
319
|
-
width: 14px;
|
|
320
|
-
position: sticky;
|
|
321
|
-
font-size: 8px;
|
|
322
|
-
line-height: 14px;
|
|
323
|
-
color: grey;
|
|
324
|
-
border-right: 1px solid grey;
|
|
325
|
-
background-color: #e8e8e8;
|
|
326
|
-
overflow: hidden;
|
|
327
|
-
box-sizing: border-box;
|
|
328
|
-
`,Xk=xS(`div`,_.forwardRef)`
|
|
329
|
-
position: absolute;
|
|
330
|
-
border-left: 1px solid grey;
|
|
331
|
-
padding-left: 2px;
|
|
332
|
-
`,Zk=xS(`div`,_.forwardRef)`
|
|
333
|
-
position: absolute;
|
|
334
|
-
left: 14px;
|
|
335
|
-
border-left: 1px solid grey;
|
|
336
|
-
padding-left: 2px;
|
|
337
|
-
transform: rotate(90deg);
|
|
338
|
-
transform-origin: left top;
|
|
339
|
-
overflow: hidden;
|
|
340
|
-
`,Qk=[.1,.2,.5,1,2,5,10,20,25,50,100,200,500,1e3,2e3,5e3,1e4],$k=ga(({store:e,width:t,height:n,pageSizes:r,layout:i=`vertical`,renderOnlyActivePage:a})=>{let{rulerStyle:o}=Ff(),s=_.useRef(null);if(!e.activePage)return null;let c=i===`horizontal`,l=e.activePage,u=(e.bleedVisible&&l.bleed,l.computedWidth*e.scale),d=l.computedHeight*e.scale,f=(t-u)/2,p=(n-d)/2,m=(h=t=>J_({unitVal:t,dpi:e.dpi,unit:e.unit})*e.scale,Qk.find(e=>h(e)>30)||1e4);var h;let g=J_({unitVal:m,dpi:e.dpi,unit:e.unit})*e.scale,v=Math.round(u/g)+1,y=Math.round(d/g)+1,b=Hv(e.selectedShapes),{backgroundColor:x,textColor:S,borderColor:C,borderSize:w,tickColor:T,tickSize:E}=o;return _.createElement(qk,{ref:s,className:`polotno-rulers`,style:{display:`flex`,flexDirection:`column`}},c?_.createElement(_.Fragment,null,_.createElement(`div`,{style:{display:`flex`,flexDirection:`row`,position:`sticky`,top:0,zIndex:1}},_.createElement(`div`,{className:`polotno-ruler-corner`,style:{width:`14px`,height:`14px`,flexShrink:0,marginRight:`-14px`,boxSizing:`border-box`,backgroundColor:x,borderRight:`${w}px solid ${C}`,borderBottom:`${w}px solid ${C}`,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 _.createElement(Jk,{key:n.id,style:{width:a+`px`,flexShrink:0,position:`relative`,backgroundColor:x,color:S,borderBottom:`${w}px solid ${C}`},className:`polotno-x-ruler`},[...Array(v)].map((t,n)=>_.createElement(Xk,{key:n,className:`polotno-ruler-tick`,style:{left:o+n*g+`px`,width:g+`px`,borderLeft:`${E}px solid ${T}`}},e.unit===`px`||m>=1?Math.round(m*n):(m*n).toFixed(1))),e.selectedShapes[0]?.page===n&&_.createElement(`div`,{className:`polotno-ruler-selection`,style:{position:`absolute`,left:o+b.x*e.scale+`px`,height:`14px`,width:b.width*e.scale,backgroundColor:`rgba(0,0,0,0.15)`}}))})),_.createElement(Yk,{style:{height:n+`px`,position:`sticky`,left:0,marginTop:`-14px`,backgroundColor:x,color:S,borderRight:`${w}px solid ${C}`},className:`polotno-y-ruler`},[...Array(y)].map((t,n)=>_.createElement(Zk,{key:n,className:`polotno-ruler-tick`,style:{top:p+n*g+`px`,width:g+`px`,borderLeft:`${E}px solid ${T}`}},e.unit===`px`||m>=1?Math.round(m*n):(m*n).toFixed(1))),!!e.selectedShapes.length&&_.createElement(`div`,{className:`polotno-ruler-selection`,style:{position:`absolute`,top:p+b.y*e.scale+`px`,width:`14px`,height:b.height*e.scale,backgroundColor:`rgba(0,0,0,0.15)`}}))):_.createElement(_.Fragment,null,_.createElement(Jk,{style:{width:t+`px`,backgroundColor:x,color:S,borderBottom:`${w}px solid ${C}`},className:`polotno-x-ruler`},[...Array(v)].map((t,n)=>_.createElement(Xk,{key:n,className:`polotno-ruler-tick`,style:{left:f+n*g+`px`,width:g+`px`,borderLeft:`${E}px solid ${T}`}},e.unit===`px`||m>=1?Math.round(m*n):(m*n).toFixed(1))),!!e.selectedShapes.length&&_.createElement(`div`,{className:`polotno-ruler-selection`,style:{position:`absolute`,left:f+b.x*e.scale+`px`,height:`14px`,width:b.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 _.createElement(Yk,{key:t.id,style:{height:a-s+`px`,backgroundColor:x,color:S,borderRight:`${w}px solid ${C}`},className:`polotno-y-ruler`},[...Array(y)].map((t,n)=>_.createElement(Zk,{key:n,className:`polotno-ruler-tick`,style:{top:o+n*g-s+`px`,width:g+`px`,borderLeft:`${E}px solid ${T}`}},e.unit===`px`||m>=1?Math.round(m*n):(m*n).toFixed(1))),e.selectedShapes[0]?.page===t&&_.createElement(`div`,{className:`polotno-ruler-selection`,style:{position:`absolute`,top:o+b.y*e.scale-s+`px`,width:`14px`,height:b.height*e.scale,backgroundColor:`rgba(0,0,0,0.15)`}}))})))}),eA=ga(({audio:e,store:t})=>{let[n,r]=function(e){let[t,n]=_.useState(null),[r,i]=_.useState(`loading`);return _.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);return _.useEffect(()=>{n&&t.history.ignore(()=>{e.set({duration:1e3*n.duration})})},[n,e,t.history]),_.useEffect(()=>{if(!n)return;let r=()=>{n.currentTime=e.startTime*e.duration/1e3},i=()=>{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`,i);let a=er(()=>{let r=t.animatedElementsIds;if(r.length&&!r.includes(e.id))return;let i=t.currentTime-e.delay,a=e.duration*(e.endTime-e.startTime),o=i>=0&&i<a;if(!t.isPlaying||t.animatedElementsIds.length!==0||!o){n.pause();return}n.volume=e.volume,n.paused&&n.play();let s=i%a/1e3+e.startTime*e.duration/1e3,c=n.currentTime;Math.abs(c-s)>.5&&s!==c&&(n.currentTime=s)});return()=>{n.pause(),n.removeEventListener(`ended`,r),n.removeEventListener(`timeupdate`,i),a()}},[t.isPlaying,e.startTime,e.endTime,e.volume,n]),null}),tA={data:[],pageId:``},nA=`polotno_clipboard`,rA=(e,t)=>{tA={data:JSON.parse(JSON.stringify(e)),pageId:t||``};try{localStorage.setItem(nA,JSON.stringify(e)),localStorage.setItem(nA+`_page`,t||``)}catch{}},iA=()=>{try{let e=localStorage.getItem(nA),t=localStorage.getItem(nA+`_page`);if(e)return{data:JSON.parse(e),pageId:t}}catch{}return tA},aA=e=>{e.selectedElements.length!==0&&rA(e.selectedElements.map(e=>e.toJSON()),e.activePage?.id)},oA=e=>{rA(e.selectedElements.map(e=>e.toJSON()),e.activePage?.id);let t=e.selectedElements.filter(e=>e.removable).map(e=>e.id);e.deleteElements(t)},sA=e=>{e.history.transaction(()=>{let t=0,n=0,{data:r,pageId:i}=iA();if(i===e.activePage?.id)t=e.width/20,n=e.height/20;else{let i=[];Ay({children:r},e=>{e.type!==`group`&&i.push(e)});let a=Hv(i);a.maxX>e.width&&(t=-a.minX),a.maxY>e.height&&(n=-a.minY)}let a=[];Ay({children:r},e=>{delete e.id,e.type!==`group`&&(e.x+=t,e.y+=n)}),r.forEach(t=>{let n=e.activePage?.addElement(t);n&&a.push(n.id)}),rA(r,e.activePage?.id),e.selectElements(a)})};function cA(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 lA=e=>{if(e.type!==`group`)return Vv(e);let t=1/0,n=1/0,r=-1/0,i=-1/0;return e.children.forEach(e=>{let a=lA(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}},uA=(e,t,n)=>{if(e.type!==`group`){let r=Vv(e),i=t-r.x,a=n-r.y;e.set({x:e.x+i,y:e.y+a})}else{let r=t-lA(e).x,i=n-lA(e).y;e.children.forEach(e=>{let t=lA(e);uA(e,t.x+r,t.y+i)})}};function dA(e){let t=e.activePage?.computedWidth;e.selectedElements.forEach(e=>{t=Math.min(t,lA(e).x)}),e.selectedElements.length===1&&(t=0),e.selectedElements.forEach(e=>{let n=lA(e);uA(e,n.x-n.x+t,n.y)})}function fA(e){let t=0;e.selectedElements.forEach(e=>{let n=lA(e);t=Math.max(t,n.x+n.width)}),e.selectedElements.length===1&&(t=e.activePage?.computedWidth),e.selectedElements.forEach(e=>{let n=lA(e);uA(e,t-n.width,n.y)})}function pA(e){let t=e.activePage?.computedHeight;e.selectedElements.forEach(e=>{t=Math.min(t,lA(e).y)}),e.selectedElements.length===1&&(t=0),e.selectedElements.forEach(e=>{let n=lA(e);uA(e,n.x,n.y-n.y+t)})}function mA(e){let t=e.activePage?.computedHeight,n=0;e.selectedElements.forEach(e=>{let r=lA(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=lA(e);uA(e,t.x,r-t.height/2)})}function hA(e){let t=0;e.selectedElements.forEach(e=>{let n=lA(e);t=Math.max(t,n.y+n.height)}),e.selectedElements.length===1&&(t=e.activePage?.computedHeight),e.selectedElements.forEach(e=>{let n=lA(e);uA(e,n.x,t-n.height)})}function gA(e){let t=e.activePage?.computedWidth,n=0;e.selectedElements.forEach(e=>{let r=lA(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=lA(e);uA(e,r-t.width/2,t.y)})}var _A=`rgba(191, 191, 191, 100)`;function vA(e,t,n){let r=e.getCell(t,n);r&&e.focusCell(r.id)}function yA(e,t,n){let r=e.getCell(t,n);r&&e.enterCellEdit(r.id)}function bA(e,t){var n,r,i,a;if(t.role===Hx.VIEWER)return;let o=document.activeElement,s=document.querySelector(`.polotno-workspace-container`),c=o?.tagName===`INPUT`||o?.tagName===`TEXTAREA`||!!o?.isContentEditable,l=!(!o||!s?.contains(o)),u=c&&!l,d=function(e){if(e.selectedElements.length!==1)return null;let t=e.selectedElements[0];return t.type===`table`?t:null}(t);if(!u&&d&&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),yA(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),yA(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:n.fontWeight===`bold`?`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),vA(t,n,e)}else{let e=s+1,n=o;e>=t.cols&&(n+=1,e=0),n>=t.rows&&(n=0,e=0),vA(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`&&vA(t,o,Math.min(s+1,t.cols-1)),e.key===`ArrowLeft`&&vA(t,o,Math.max(s-1,0)),e.key===`ArrowDown`&&vA(t,Math.min(o+1,t.rows-1),s),e.key===`ArrowUp`&&vA(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}if(c&&e.code===`KeyC`){e.preventDefault();let n=t.focusedCells.map(e=>m_(e.text));return navigator.clipboard.writeText(n.join(`
|
|
341
|
-
`)),!0}return c&&e.code===`KeyV`?(e.preventDefault(),navigator.clipboard.readText().then(e=>{let n=t.focusedCells[0];n&&n.set({text:e})}),!0):!(!c||e.code!==`KeyA`||(e.preventDefault(),t.cells.forEach(e=>{t.focusCell(e.id,!0)}),0))}(e,d,t)||c)return;let f=document.activeElement===s||l;if(!f){let e=window.getSelection();if(e&&e.toString().length>0)return}if(e.key===`Alt`){let n=s;(f||t.distanceGuidesVisible||n&&n.matches(`:hover`))&&e.preventDefault();return}let p=t.selectedElements.filter(e=>e.removable).map(e=>e.id);e.keyCode!==46&&e.keyCode!==8||t.deleteElements(p);let m=e.ctrlKey||e.metaKey,h=e.shiftKey,g=e.altKey;if(e.key===`Escape`){e.preventDefault(),t.tool===`draw`?t.setTool(`selection`):t.selectElements([]);return}if(!m||h||e.key.toLowerCase()!==`z`&&e.key.toLowerCase()!==`y`||(e.preventDefault(),t.history.undo()),m&&h&&(e.key.toLowerCase()===`z`||e.key.toLowerCase()===`y`)&&(e.preventDefault(),t.history.redo()),m&&e.code===`KeyA`){e.preventDefault();let n=(t.activePage?.children.filter(e=>e.selectable))?.map(e=>e.id)||[];t.selectElements(n)}if(m&&e.code===`KeyC`&&(e.preventDefault(),aA(t)),m&&e.code===`KeyX`&&(e.preventDefault(),oA(t)),m&&e.code===`KeyV`&&(e.preventDefault(),sA(t)),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(m&&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(m&&e.code===`KeyD`&&(e.preventDefault(),cA(t.selectedElements,t)),e.code===`KeyT`&&!m){e.preventDefault();let r=t.width/2,i=t.width/2-r/2,a=t.height/2-30/2,o=(t.width+t.height)/2160;(n=t.activePage)==null||n.addElement({type:`text`,x:i,y:a,width:r,fontSize:30*o,text:`Sample Text`,fontFamily:`Roboto`})}if(e.code===`KeyR`&&!m){e.preventDefault();let n={type:`figure`,x:t.width/4,y:t.height/4,width:300,height:300,fill:_A,stroke:`#0c0c0c`,strokeWidth:0,subType:`rect`};(r=t.activePage)==null||r.addElement(n)}if(e.code===`KeyL`&&!m){e.preventDefault();let n=(t.activePage?.computedWidth??0)/3,r={type:`line`,x:(t.activePage?.computedWidth??0)/2-n/2,y:(t.activePage?.computedHeight??0)/2,width:n,color:_A};(i=t.activePage)==null||i.addElement(r)}if(e.code===`KeyO`&&!m){e.preventDefault(),e.preventDefault();let n={type:`figure`,x:t.width/4,y:t.height/4,width:300,height:300,fill:_A,stroke:`#0c0c0c`,strokeWidth:0,subType:`circle`};(a=t.activePage)==null||a.addElement(n)}m&&e.code===`Equal`&&(e.preventDefault(),t.setScale(t.scale+.1)),m&&e.code===`Minus`&&(e.preventDefault(),t.setScale(t.scale-.1)),g&&(e.code===`KeyA`&&(e.preventDefault(),dA(t)),e.code===`KeyD`&&(e.preventDefault(),fA(t)),e.code===`KeyS`&&(e.preventDefault(),hA(t)),e.code===`KeyW`&&(e.preventDefault(),pA(t)),e.code===`KeyV`&&(e.preventDefault(),mA(t)),e.code===`KeyH`&&(e.preventDefault(),gA(t))),e.code===`BracketRight`&&(e.preventDefault(),t.selectedElements.forEach(e=>m?e.moveUp():e.moveTop())),e.code===`BracketLeft`&&(e.preventDefault(),t.selectedElements.forEach(e=>m?e.moveDown():e.moveBottom()))}var xA=It({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`,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`,lineStyle:`Line style`,lineStartHead:`Line start`,lineEndHead:`Line end`,textDirection:`Text direction`,fontSize:`Font size`,fontFamily:`Font family`,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`},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`,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`,clipImage:`Mask image`,width:`Width`,height:`Height`,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`,muteAudio:`Mute`,unmuteAudio:`Unmute`,volume:`Volume`},contextMenu:{duplicate:`Duplicate`,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`}}),SA=e=>e&&typeof e==`object`;function CA(e,t){Object.keys(t).forEach(n=>{let r=e[n],i=t[n];SA(i)&&SA(r)?CA(r,i):e[n]=i})}function wA(e,t,n=``){Object.keys(t).forEach(r=>{let i=t[r],a=n?`${n}.${r}`:r;SA(i)?SA(e[r])?wA(e[r],i,a):console.warn(`Missing nested translation object at '${a}'`):e[r]===void 0&&console.warn(`Missing translation '${a}'`)})}Xn((e,{validate:t=!1}={})=>{t&&wA(e,xA),CA(xA,e)});var TA={},EA=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}(xA,e);if(t!==void 0)return t;TA[e]||(TA[e]=!0,console.warn(`Missing translation '${e}'`));let n=e.split(`.`),r=n[n.length-1]||` `;return r.charAt(0).toUpperCase()+r.slice(1)},DA=(e,t,n)=>Math.max(t,Math.min(n,e)),OA=(e,t)=>Math.sqrt((t.clientX-e.clientX)**2+(t.clientY-e.clientY)**2),kA=({store:e})=>_.createElement(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,textAlign:`center`}},_.createElement(`p`,null,EA(`workspace.noPages`)),_.createElement(`button`,{onClick:()=>{e.addPage()}},EA(`workspace.addPage`))),AA=({width:e,height:t,xPadding:n,yPadding:r,backgroundColor:i})=>_.createElement(`div`,{style:{width:e+`px`,height:t+`px`,backgroundColor:i,paddingLeft:n+`px`,paddingRight:n+`px`,paddingTop:r+`px`,paddingBottom:r+`px`,flexShrink:0}},_.createElement(`div`,{style:{width:` 100%`,height:`100%`,backgroundColor:`white`}})),jA=ga(({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:v,innerImageCropTransformerStyle:y,outerImageCropTransformerStyle:b,highlighterStyle:x,mediaLoadingStyle:S,mediaErrorStyle:C,textOverflowIndicatorStyle:w,distanceGuideStroke:T,distanceLabelFill:E,distanceLabelTextFill:D,rulerBackgroundColor:ee,rulerTextColor:O,rulerBorderColor:k,rulerBorderSize:A,rulerTickColor:te,rulerTickSize:ne,components:j,onKeyDown:M,paddingX:re,paddingY:ie,pageGap:ae,altCloneEnabled:oe=!0,groupClickBehavior:N=`select-child`,visiblePagesOffset:se,renderOnlyActivePage:ce,scrollToPageThreshold:le=.5,tooltipSafeArea:ue})=>{let de=t===`horizontal`,fe=re??20,pe=ie??55,[me,he]=_.useState({width:100,height:100}),ge=_.useRef(me),_e=_.useRef(null),ve=_.useRef(null),ye=_.useRef(0),be=e.bleedVisible?Math.max(0,...e.pages.map(e=>e.bleed)):0,xe=Math.max(...e.pages.map(e=>e.computedWidth)),Se=Math.max(...e.pages.map(e=>e.computedHeight)),Ce=e.activePage?.computedHeight||0,we=xe+2*be,Te=(ce?Ce:Se)+2*be,Ee=async({skipTimeout:t}={skipTimeout:!1})=>{if(t||await new Promise(e=>setTimeout(e,50)),_e.current===null)return;let n=_e.current.getBoundingClientRect();n.width!==0&&n.height!==0||(console.warn(`Polotno warning: <Workspace /> component can not automatically detect its size.
|
|
342
|
-
Width or height of parent elements is equal 0.
|
|
343
|
-
Please make sure it has non-zero size. You may need to adjust it with your styles. <Workspace /> will automatically fit into parent container.
|
|
344
|
-
For simpler debugging here is the log of the parent element:`),console.log(_e.current));let r=ve.current.clientWidth||n.width,i={width:r,height:n.height};(ge.current.width!==i.width||ge.current.height!==i.height)&&(he(i),ge.current=i);let a=(r-2*fe)/we,o=e.pages.length>1?3.1:2,s=(n.height-pe*o)/Te,c=(r-fe*(e.pages.length>1?3.1:2))/we,l=(n.height-2*pe)/Te,u=e.pages.length?Math.max(Math.min(de?c:a,de?l:s),.01):1;e.scaleToFit!==u&&(e.setScale(u),e._setScaleToFit(u))};_.useLayoutEffect(()=>{Ee({skipTimeout:!0})},[]),_.useEffect(()=>{Ee()},[we,Te,ie,re]),_.useLayoutEffect(()=>{Ee({skipTimeout:!0})},[e.openedSidePanel]),_.useEffect(()=>{e.__()},[]),_.useEffect(()=>{let e=_e.current;if(window.ResizeObserver){let t=new ResizeObserver(()=>{Ee({skipTimeout:!0})});return t.observe(e),()=>t.unobserve(e)}{let e=setInterval(()=>{Ee({skipTimeout:!0})},100);return()=>clearInterval(e)}},[we,Te]);let De=ce?1:e.pages.length,Oe,ke;if(de){let t=we*e.scale*De;Oe=Math.max(fe,(me.width-t)/De/2),ke=Math.max(pe,(me.height-Te*e.scale)/2)}else{Oe=Math.max(fe,(me.width-we*e.scale)/2);let t=Te*e.scale*De;ke=Math.max(pe,(me.height-t)/De/2)}Number.isNaN(Oe)&&(Oe=fe),Number.isNaN(ke)&&(ke=pe),_.useEffect(()=>{let t=t=>{(M||bA)(t,e)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[]),_.useEffect(()=>{let t=t=>{if(t.ctrlKey||t.metaKey){t.preventDefault();let n=Math.max(5,e.scaleToFit),r=Math.min(.1,e.scaleToFit);de&&we>0&&Number.isFinite(we)&&(r=Math.max(r,300/we)),r=Math.max(r,.01);let i=.03,a=DA(t.deltaY<0?e.scale*(1+i):e.scale/(1+i),r,n);e.setScale(a);return}},n=ve.current;return n?.addEventListener(`wheel`,t),()=>n?.removeEventListener(`wheel`,t)},[de,we,e]),_.useEffect(()=>{let t=ve.current;if(!t)return;let n=e=>{e.touches.length===2&&(ye.current=OA(e.touches[0],e.touches[1]))},r=n=>{if(n.touches.length===2&&ye.current>0){n.preventDefault();let r=OA(n.touches[0],n.touches[1]),i=r/ye.current,a=Math.max(5,e.scaleToFit),o=Math.min(.1,e.scaleToFit);de&&we>0&&Number.isFinite(we)&&(o=Math.max(o,300/we)),o=Math.max(o,.01);let s=e.scale,c=DA(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,ye.current=r}},i=()=>{ye.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)}},[de,we,e]);let Ae=ae!==void 0,je=e.pages.map(t=>{if(de){let n=(t.computedWidth+2*be)*e.scale;return Ae?n+ae:n+2*Oe}{let n=(t.computedHeight+2*be)*e.scale;return Ae?n+ae:n+2*ke}}),Me=[],P=Ae?de?Oe:ke:0;for(let e=0;e<je.length;e++)Me.push(P),P+=je[e];let Ne=je.reduce((e,t)=>e+t,0),Pe=Ae?Ne+(de?2*Oe:2*ke):Ne,Fe=_.useRef(!1),[,Ie]=_.useReducer(e=>e+1,0);((e,t,n,r,i)=>{let a=_.useRef(0),o=_.useRef(0),s=_.useRef(null),c=_.useRef(null),l=_.useRef(!1),u=_.useRef(r.pages.length);l.current=u.current!==r.pages.length,u.current=r.pages.length,_.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)}},[]),_.useLayoutEffect(()=>{if(!e.current||l.current)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=DA(f*t.scrollWidth-u/2,0,m),t.scrollTop=DA(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])})(ve,Pe,e.scale,e,Fe);let{handleScroll:Le}=((e,t,n,r,i,a,o,s,c,l)=>{let u=_.useRef(!1),d=_.useRef(null),f=_.useRef(!1),p=c===`horizontal`;_.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 _.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()}}})(ve,Me,je,e,le,me,Fe,ce,t,Ie),Re=me.width>=we*e.scale+2*Oe,ze=me.height>=Te*e.scale+2*ke,Be=r||`rgba(232, 232, 232, 0.9)`,Ve=j?.NoPages||kA,He=de?me.width:me.height,Ue=ve.current?de?ve.current.scrollLeft:ve.current.scrollTop:0,We=e=>{for(let t=Me.length-1;t>=0;t--)if(e>=Me[t])return t;return 0},Ge=Math.max(0,We(Ue)),Ke=Math.min(e.pages.length-1,We(Ue+He)),qe=se??1,Je=Math.max(0,Ge-qe),Ye=Math.min(e.pages.length-1,Ke+qe),Xe=Bf({cropOverlayFill:g,workspaceBackgroundColor:r,pageBorderColor:a,activePageBorderColor:o,bleedColor:s,transparencyBackgroundColor:i,transformerStyle:v,innerImageCropTransformerStyle:y,outerImageCropTransformerStyle:b,highlighterStyle:x,snapGuideStroke:c,snapGuideStrokeWidth:l,snapGuideDash:u,selectionRectFill:d,selectionRectStroke:f,selectionRectStrokeWidth:p,transformLabelFill:m,transformLabelTextFill:h,distanceGuideStroke:T,distanceLabelFill:E,distanceLabelTextFill:D,mediaLoadingStyle:S,mediaErrorStyle:C,textOverflowIndicatorStyle:w,rulerBackgroundColor:ee,rulerTextColor:O,rulerBorderColor:k,rulerBorderSize:A,rulerTickColor:te,rulerTickSize:ne});return _.createElement(Pf,{value:Xe},_.createElement(`div`,{ref:_e,style:{width:`100%`,height:`100%`,position:`relative`,outline:`none`,flex:1,backgroundColor:Be,overflow:`hidden`},tabIndex:0,className:`polotno-workspace-container`},_.createElement(`div`,{ref:ve,onScroll:Le,style:Object.assign({position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,display:`flex`,flexDirection:de?`row`:`column`,overflow:`auto`,overflowX:de?`auto`:Re?`hidden`:`auto`,overflowY:de&&ze?`hidden`:`auto`},Ae&&{paddingTop:de?0:ke,paddingBottom:de?0:ke,paddingLeft:de?Oe:0,paddingRight:de?Oe:0,boxSizing:`border-box`}),className:`polotno-workspace-inner`},e.pages.map((r,i)=>{let a=r===e.activePage;if(ce&&!a&&!r._exportingOrRendering&&!r._forceMount)return null;let o=a||i>=Je&&i<=Ye||r._exportingOrRendering||r._forceMount,s=de?je[i]:we*e.scale+2*Oe,c=de?Te*e.scale+2*ke:je[i];if(!o)return _.createElement(`div`,{key:r.id,style:{flexShrink:0}},_.createElement(AA,{width:s,height:c,backgroundColor:Be,xPadding:Oe,yPadding:ke}));let l=_.createElement(Kk,{key:r.id,page:r,xPadding:Oe,yPadding:ke,width:s,height:c,store:e,pageControlsEnabled:n,altCloneEnabled:oe,groupClickBehavior:N,components:j,viewportSize:me,layout:t,tooltipSafeArea:ue});return(r._exportingOrRendering||r._forceMount)&&!a&&ce?_.createElement(`div`,{style:{display:`none`,flexShrink:0},key:r.id},l):l}),e.rulesVisible&&_.createElement($k,{store:e,xPadding:Oe,yPadding:ke,width:we*e.scale+2*Oe,height:Te*e.scale+2*ke,pageSizes:je,layout:t,renderOnlyActivePage:ce}),e.pages.length===0&&_.createElement(Ve,{store:e}),e.audios.map(t=>_.createElement(eA,{key:t.id,audio:t,store:e})))))}),MA=`modulepreload`,NA=function(e,t){return new URL(e,t).href},PA={},FA=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=NA(t,n),t in PA)return;PA[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:MA,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};H.prototype._requestDraw=()=>{},Qg(!1),Fg(`change-font-size`);var IA=Wx({key:new URLSearchParams(location.search).get(`key`)});window.store=IA;var LA=null;window.__polotnoLoadJspdf=async()=>(LA||=FA(()=>import(`./jspdf.es.min-kwORMdcW.js`),__vite__mapDeps([0,1]),import.meta.url),await LA);var RA=null;window.__polotnoLoadVideoExport=async()=>(RA||=FA(()=>import(`./lib-BagY_77q.js`),[],import.meta.url),await RA),window.config={addGlobalFont:y_,setRichTextEnabled:Ng,setTextVerticalResizeEnabled:jg,setTextOverflow:Fg,onLoadError:f_,setAssetLoadTimeout:i_,setFontLoadTimeout:o_,unstable_setTextSplitAllowed:Ig},v.createRoot(document.getElementById(`root`)).render(_.createElement(jA,{visiblePagesOffset:0,renderOnlyActivePage:!0,store:IA,components:{PageControls:()=>null,Tooltip:()=>null}}));export{UC as $,gw as A,ew as B,cw as C,aw as D,lw as E,Cw as F,zC as G,iw as H,Dw as I,X as J,sC as K,Rw as L,Aw as M,kw as N,ww as O,Ow as P,RC as Q,zw as R,dT as S,ow as T,dC as U,nw as V,rC as W,OC as X,SC as Y,lC as Z,Zw as _,oO as a,EC as at,hT as b,mE as c,QS as ct,jT as d,l as dt,NC as et,kT as f,qw as g,TT as h,dO as i,_C as it,_w as j,yw as k,qT as l,G_ as lt,ET as m,mO as n,XC as nt,aO as o,TC as ot,OT as p,aC as q,cO as r,JS as rt,vE as s,tC as st,FA as t,YS as tt,RT as u,o as ut,rT as v,sw as w,Qw as x,Hw as y,Iw as z};
|