UNPKG

mettle

Version:

A approachable, fast, flexible JavaScript library for building user interfaces.

7 lines (6 loc) 21.9 kB
/*! * Mettle.js v1.7.6 * (c) 2021-2025 maomincoding * Released under the MIT License. */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Mettle={})}(this,(function(e){"use strict";const t=(e,n,o,r)=>{let i;n[0]=0;for(let s=1;s<n.length;s++){const c=n[s++],u=n[s]?(n[0]|=c?1:2,o[n[s++]]):n[++s];3===c?r[0]=u:4===c?r[1]=Object.assign(r[1]||{},u):5===c?(r[1]=r[1]||{})[n[++s]]=u:6===c?r[1][n[++s]]+=u+"":c?(i=e.apply(u,t(e,u,o,["",null])),r.push(i),u[0]?n[0]|=2:(n[s-2]=0,n[s]=i)):r.push(u)}return r},n=new Map,o=function(e){let o=n.get(this);return o||(o=new Map,n.set(this,o)),o=t(this,o.get(e)||(o.set(e,o=function(e){let t,n,o=1,r="",i="",s=[0];const c=e=>{1===o&&(e||(r=r.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?s.push(0,e,r):3===o&&(e||r)?(s.push(3,e,r),o=2):2===o&&"..."===r&&e?s.push(4,e,0):2===o&&r&&!e?s.push(5,0,!0,r):o>=5&&((r||!e&&5===o)&&(s.push(o,0,r,n),o=6),e&&(s.push(o,e,0,n),o=6)),r=""};for(let u=0;u<e.length;u++){u&&(1===o&&c(),c(u));for(let l=0;l<e[u].length;l++)t=e[u][l],1===o?"<"===t?(c(),s=[s],o=3):r+=t:4===o?"--"===r&&">"===t?(o=1,r=""):r=t+r[0]:i?t===i?i="":r+=t:'"'===t||"'"===t?i=t:">"===t?(c(),o=1):o&&("="===t?(o=5,n=r,r=""):"/"===t&&(o<5||">"===e[u][l+1])?(c(),3===o&&(s=s[0]),o=s,(s=s[0]).push(2,0,o),o=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(c(),o=2):r+=t),3===o&&"!--"===r&&(o=4,s=s[0])}return c(),s}(e)),o),arguments,[]),o.length>1?o:o[0]}.bind((function(e,t,n){let o=null,r=null,i=null;for(r in t)"key"===r&&(o=t[r]);return arguments.length>2&&(i=arguments.length>3?Array.prototype.slice.call(arguments,2):n),{tag:e,props:t,children:i,key:o,el:null}})),r=Symbol.for("signals"),i=32;function s(){if(a>1)return void a--;let e,t=!1;for(;void 0!==u;){let n=u;for(u=void 0,f++;void 0!==n;){const o=n._nextBatchedEffect;if(n._nextBatchedEffect=void 0,n._flags&=-3,!(8&n._flags)&&d(n))try{n._callback()}catch(n){t||(e=n,t=!0)}n=o}}if(f=0,a--,t)throw e}let c,u;function l(e){const t=c;c=void 0;try{return e()}finally{c=t}}let a=0,f=0,_=0;function h(e){if(void 0===c)return;let t=e._node;return void 0===t||t._target!==c?(t={_version:0,_source:e,_prevSource:c._sources,_nextSource:void 0,_target:c,_prevTarget:void 0,_nextTarget:void 0,_rollbackNode:t},void 0!==c._sources&&(c._sources._nextSource=t),c._sources=t,e._node=t,c._flags&i&&e._subscribe(t),t):-1===t._version?(t._version=0,void 0!==t._nextSource&&(t._nextSource._prevSource=t._prevSource,void 0!==t._prevSource&&(t._prevSource._nextSource=t._nextSource),t._prevSource=c._sources,t._nextSource=void 0,c._sources._nextSource=t,c._sources=t),t):void 0}function p(e,t){this._value=e,this._version=0,this._node=void 0,this._targets=void 0,this._watched=t?.watched,this._unwatched=t?.unwatched,this.name=t?.name}function d(e){for(let t=e._sources;void 0!==t;t=t._nextSource)if(t._source._version!==t._version||!t._source._refresh()||t._source._version!==t._version)return!0;return!1}function y(e){for(let t=e._sources;void 0!==t;t=t._nextSource){const n=t._source._node;if(void 0!==n&&(t._rollbackNode=n),t._source._node=t,t._version=-1,void 0===t._nextSource){e._sources=t;break}}}function g(e){let t,n=e._sources;for(;void 0!==n;){const e=n._prevSource;-1===n._version?(n._source._unsubscribe(n),void 0!==e&&(e._nextSource=n._nextSource),void 0!==n._nextSource&&(n._nextSource._prevSource=e)):t=n,n._source._node=n._rollbackNode,void 0!==n._rollbackNode&&(n._rollbackNode=void 0),n=e}e._sources=t}function v(e,t){p.call(this,void 0),this._fn=e,this._sources=void 0,this._globalVersion=_-1,this._flags=4,this._watched=t?.watched,this._unwatched=t?.unwatched,this.name=t?.name}function b(e){const t=e._cleanup;if(e._cleanup=void 0,"function"==typeof t){a++;const n=c;c=void 0;try{t()}catch(t){throw e._flags&=-2,e._flags|=8,m(e),t}finally{c=n,s()}}}function m(e){for(let t=e._sources;void 0!==t;t=t._nextSource)t._source._unsubscribe(t);e._fn=void 0,e._sources=void 0,b(e)}function w(e){if(c!==this)throw new Error("Out-of-order effect");g(this),c=e,this._flags&=-2,8&this._flags&&m(this),s()}function S(e,t){this._fn=e,this._cleanup=void 0,this._sources=void 0,this._nextBatchedEffect=void 0,this._flags=i,this.name=t?.name}function x(e,t){const n=new S(e,t);try{n._callback()}catch(e){throw n._dispose(),e}const o=n._dispose.bind(n);return o[Symbol.dispose]=o,o}p.prototype.brand=r,p.prototype._refresh=function(){return!0},p.prototype._subscribe=function(e){const t=this._targets;t!==e&&void 0===e._prevTarget&&(e._nextTarget=t,this._targets=e,void 0!==t?t._prevTarget=e:l((()=>{this._watched?.call(this)})))},p.prototype._unsubscribe=function(e){if(void 0!==this._targets){const t=e._prevTarget,n=e._nextTarget;void 0!==t&&(t._nextTarget=n,e._prevTarget=void 0),void 0!==n&&(n._prevTarget=t,e._nextTarget=void 0),e===this._targets&&(this._targets=n,void 0===n&&l((()=>{this._unwatched?.call(this)})))}},p.prototype.subscribe=function(e){return x((()=>{const t=this.value,n=c;c=void 0;try{e(t)}finally{c=n}}),{name:"sub"})},p.prototype.valueOf=function(){return this.value},p.prototype.toString=function(){return this.value+""},p.prototype.toJSON=function(){return this.value},p.prototype.peek=function(){const e=c;c=void 0;try{return this.value}finally{c=e}},Object.defineProperty(p.prototype,"value",{get(){const e=h(this);return void 0!==e&&(e._version=this._version),this._value},set(e){if(e!==this._value){if(f>100)throw new Error("Cycle detected");this._value=e,this._version++,_++,a++;try{for(let e=this._targets;void 0!==e;e=e._nextTarget)e._target._notify()}finally{s()}}}}),v.prototype=new p,v.prototype._refresh=function(){if(this._flags&=-3,1&this._flags)return!1;if((36&this._flags)===i)return!0;if(this._flags&=-5,this._globalVersion===_)return!0;if(this._globalVersion=_,this._flags|=1,this._version>0&&!d(this))return this._flags&=-2,!0;const e=c;try{y(this),c=this;const e=this._fn();(16&this._flags||this._value!==e||0===this._version)&&(this._value=e,this._flags&=-17,this._version++)}catch(e){this._value=e,this._flags|=16,this._version++}return c=e,g(this),this._flags&=-2,!0},v.prototype._subscribe=function(e){if(void 0===this._targets){this._flags|=36;for(let e=this._sources;void 0!==e;e=e._nextSource)e._source._subscribe(e)}p.prototype._subscribe.call(this,e)},v.prototype._unsubscribe=function(e){if(void 0!==this._targets&&(p.prototype._unsubscribe.call(this,e),void 0===this._targets)){this._flags&=-33;for(let e=this._sources;void 0!==e;e=e._nextSource)e._source._unsubscribe(e)}},v.prototype._notify=function(){if(!(2&this._flags)){this._flags|=6;for(let e=this._targets;void 0!==e;e=e._nextTarget)e._target._notify()}},Object.defineProperty(v.prototype,"value",{get(){if(1&this._flags)throw new Error("Cycle detected");const e=h(this);if(this._refresh(),void 0!==e&&(e._version=this._version),16&this._flags)throw this._value;return this._value}}),S.prototype._callback=function(){const e=this._start();try{if(8&this._flags)return;if(void 0===this._fn)return;const e=this._fn();"function"==typeof e&&(this._cleanup=e)}finally{e()}},S.prototype._start=function(){if(1&this._flags)throw new Error("Cycle detected");this._flags|=1,this._flags&=-9,b(this),y(this),a++;const e=c;return c=this,w.bind(this,e)},S.prototype._notify=function(){2&this._flags||(this._flags|=2,this._nextBatchedEffect=u,u=this)},S.prototype._dispose=function(){this._flags|=8,1&this._flags||m(this)},S.prototype.dispose=function(){this._dispose()};function k(e){const t=Object.create(null),n=e.split(",");for(let e=0;e<n.length;e++)t[n[e]]=!0;return function(e){return t[e]}}const O=k("svg,animate,circle,clippath,cursor,image,defs,desc,ellipse,filter,font-face,foreignobject,g,glyph,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feFlood,feGaussianBlur,feImage,feMerge,feMorphology,feOffset,feSpecularLighting,feTile,feTurbulence,feDistantLight,fePointLight,feSpotLight,linearGradient,stop,radialGradient,animateTransform,animateMotion"),A={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};const P=Object.prototype.hasOwnProperty,j=(e,t)=>P.call(e,t),M=e=>null!==e&&"object"==typeof e,z=e=>null==e,C=(e,t)=>e.tag===t.tag&&e.key===t.key,E=e=>null!=e&&"object"==typeof e&&"tag"in e,T=e=>!E(e)&&!Array.isArray(e);function F(e){console.warn(`[Mettle.js warn]: ${e}`)}function N(e,t){Object.assign(e.style,t)}function D(e,t,n){if("function"!=typeof n)return;const o=t.slice(2).toLowerCase();e.addEventListener(o,n)}function L(e,t,n){if("function"!=typeof n)return;const o=t.slice(2).toLowerCase();e.removeEventListener(o,n)}const W="http://www.w3.org/1999/xlink",B=new Set(["checked","disabled","readonly","selected","multiple","hidden"]);function $(e,t,n){B.has(t)?n?e.setAttribute(t,""):e.removeAttribute(t):t.startsWith("xlink:")?e.setAttributeNS(W,t,n):e.setAttribute(t,n)}function R(e,t){t.startsWith("xlink:")?e.removeAttributeNS(W,t):e.removeAttribute(t)}const K=document.createElement.bind(document),U=document.createDocumentFragment.bind(document),V=document.createComment.bind(document);function G(e){return"fragment"===e?U():"comment"===e||"null"===e?V(""):O(e)?(t=function(e){return O(e)?"svg":"math"===e?"math":void 0}(e),n=e,document.createElementNS(A[t],n)):K(e);var t,n}function I(e,t){const n=e.children,o=t.children;if(Array.isArray(o))for(let e=0;e<o.length;e++){const t=o[e],r=n[e];E(t)&&(t.el=r.el,I(r,t))}else M(o)&&(o.el=n.el)}const H=k("$ref,$once,$memo");let q=new WeakMap;const J=new WeakMap;let Q=new WeakMap;function X(e,t){t.textContent=e}function Y(e,t,n){const{tag:o,props:r,children:i}=e;if(!z(o))if("string"==typeof o){const s=G(o);if(e.el=s,!z(r)){const e=Object.keys(r);for(let t=0;t<e.length;t++){const n=e[t],o=r[n],i=M(o);n.startsWith("on")&&D(s,n,o),"function"==typeof o||"key"===n||H(n)||$(s,n,o),"style"===n&&i&&N(s,o),"$ref"===n&&i&&J.set(o,s)}}if(!z(i))if(T(i))s&&X(i,s);else{const e=M(i);if(Array.isArray(i))for(let e=0;e<i.length;e++){const t=i[e];E(t)&&Y(t,s)}else e&&Y(i,s)}if(n)t.insertBefore(s,n);else{if(!t)return s;t.appendChild(s)}}else if("function"==typeof o){const e=te(o.call(o,r,o,ee.bind(o)),o);q.set(o,e),Y(e,t)}}function Z(e,t,n){const o=e.props||{};if(!j(o,"$once")&&((e,t)=>"function"!=typeof e.tag&&"function"!=typeof t.tag)(e,t))if(C(e,t)){const o=t.el=e.el,r=e.props||{},i=t.props||{},s={},c=Object.keys(i),u=Object.keys(r),l=new Set(c);for(let e=0;e<c.length;e++)s[c[e]]=!0;for(let e=0;e<u.length;e++)s[u[e]]=!0;const a=Object.keys(s);for(let e=0;e<a.length;e++){const t=a[e],n=i[t],s=r[t];if(n===s)continue;if(z(n)){R(o,t);continue}const c=M(n),u="function"==typeof n,l="style"===t;if(u){n.toString()!==s.toString()&&(L(o,t,s),D(o,t,n));continue}if(l&&c){N(o,n);continue}"key"!==t&&!H(t)&&!u&&$(o,t,n)}for(let e=0;e<u.length;e++){const t=u[e];l.has(t)||R(o,t)}if(j(r,"$memo")){const o=r.$memo;if(n===o[1]&&!o[0])return void(o[2]&&I(e,t))}const f=e.children,_=t.children;Array.isArray(f)&&Array.isArray(_)?function(e,t,n,o){const r=t.length;let i=0,s=e.length-1,c=r-1;for(;i<=s&&i<=c&&C(e[i],t[i]);)Z(e[i],t[i],o),i++;for(;i<=s&&i<=c&&C(e[s],t[c]);)Z(e[s],t[c],o),s--,c--;if(i>s){if(i<=c){const e=c+1,o=e<r?t[e].el:null;for(;i<=c;)n.insertBefore(Y(t[i]),o),i++}}else if(i>c)for(;i<=s;)n.removeChild(e[i].el),i++;else{const u=i,l=i,a=new Map;for(i=l;i<=c;i++){const e=t[i];null!=e.key&&a.set(e.key,i)}let f,_=0;const h=c-l+1;let p=!1,d=0;const y=new Array(h);for(i=0;i<h;i++)y[i]=0;for(let r=u;r<=s;r++){if(_>=h){n.removeChild(e[r].el);continue}let i;if(null!==e[r].key)i=a.get(e[r].key);else for(f=l;f<=c;f++)if(0===y[f-l]&&C(e[r],t[f])){i=f;break}void 0===i?n.removeChild(e[r].el):(y[i-l]=r+1,i>d?d=i:p=!0,Z(e[r],t[i],o),_++)}const g=p?function(e){const t=e.slice(),n=[0];let o,r,i,s,c;const u=e.length;for(o=0;o<u;o++){const u=e[o];if(0!==u){if(r=n[n.length-1],e[r]<u){t[o]=r,n.push(o);continue}for(i=0,s=n.length-1;i<s;)c=(i+s)/2|0,e[n[c]]<u?i=c+1:s=c;u<e[n[i]]&&(i>0&&(t[o]=n[i-1]),n[i]=o)}}for(i=n.length,s=n[i-1];i-- >0;)n[i]=s,s=t[s];return n}(y):[];f=g.length-1;for(let e=h-1;e>=0;e--){const o=e+l,i=o+1<r?t[o+1].el:null;0===y[e]?n.insertBefore(Y(t[o]),i):p&&(f<0||e!==g[f]?n.insertBefore(t[o].el,i):f--)}}}(f,_,o,n):E(f)&&E(_)?Z(f,_,n):T(f)&&T(_)&&f!==_&&X(_,o)}else{const n=e.el.parentNode,o=e.el.nextSibling;n.removeChild(e.el),Y(t,n,o)}}function ee(e,t){Q.set(this,t),"function"==typeof e&&e()}function te(e,t){let n=!0;return x((()=>{t.template=e;const o=e();if(n)n=null;else{const e=Q.get(t);!function(e,t,n){try{Z(q.get(e),t,n),q.set(e,t)}catch(e){F(e)}}(t,o,e),Q.has(t)&&(Q=new WeakMap)}})),e()}function ne(e){if("string"==typeof e){const t=document.querySelector(e);if(!t){let t=null;return e.startsWith("#")?(t=document.createElement("div"),t.setAttribute("id",e.substring(1,e.length))):e.startsWith(".")?(t=document.createElement("div"),t.setAttribute("class",e.substring(1,e.length))):F(`Failed to mount app: mount target selector "${e}" returned null.`),document.body.insertAdjacentElement("afterbegin",t),t}return t}return e instanceof HTMLElement?e:window.ShadowRoot&&e instanceof window.ShadowRoot&&"closed"===e.mode?(F('mounting on a ShadowRoot with `{mode: "closed"}` may lead to unpredictable bugs.'),null):null}let oe=Object.create(null);let re=[],ie=0,se=0;function ce(){if(re.length>0)for(let e=0,t=re.length;e<t;e++)re[e]&&re[e]();se=ie,ie=0,re=[]}let ue=[];var le=Symbol.for("immer-nothing"),ae=Symbol.for("immer-draftable"),fe=Symbol.for("immer-state");function _e(e,...t){throw new Error("Error")}var he=Object.getPrototypeOf;function pe(e){return!!e&&!!e[fe]}function de(e){return!!e&&(ge(e)||Array.isArray(e)||!!e[ae]||!!e.constructor?.[ae]||Se(e)||xe(e))}var ye=Object.prototype.constructor.toString();function ge(e){if(!e||"object"!=typeof e)return!1;const t=he(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===ye}function ve(e,t){0===be(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,o)=>t(o,n,e)))}function be(e){const t=e[fe];return t?t.type_:Array.isArray(e)?1:Se(e)?2:xe(e)?3:0}function me(e,t){return 2===be(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function we(e,t,n){const o=be(e);2===o?e.set(t,n):3===o?e.add(n):e[t]=n}function Se(e){return e instanceof Map}function xe(e){return e instanceof Set}function ke(e){return e.copy_||e.base_}function Oe(e,t){if(Se(e))return new Map(e);if(xe(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=ge(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[fe];let n=Reflect.ownKeys(t);for(let o=0;o<n.length;o++){const r=n[o],i=t[r];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[r]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[r]})}return Object.create(he(e),t)}{const t=he(e);if(null!==t&&n)return{...e};const o=Object.create(t);return Object.assign(o,e)}}function Ae(e,t=!1){return je(e)||pe(e)||!de(e)||(be(e)>1&&(e.set=e.add=e.clear=e.delete=Pe),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>Ae(t,!0)))),e}function Pe(){_e()}function je(e){return Object.isFrozen(e)}var Me,ze={};function Ce(e){const t=ze[e];return t||_e(0),t}function Ee(){return Me}function Te(e,t){t&&(Ce("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Fe(e){Ne(e),e.drafts_.forEach(Le),e.drafts_=null}function Ne(e){e===Me&&(Me=e.parent_)}function De(e){return Me={drafts_:[],parent_:Me,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Le(e){const t=e[fe];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function We(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[fe].modified_&&(Fe(t),_e()),de(e)&&(e=Be(t,e),t.parent_||Re(t,e)),t.patches_&&Ce("Patches").generateReplacementPatches_(n[fe].base_,e,t.patches_,t.inversePatches_)):e=Be(t,n,[]),Fe(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==le?e:void 0}function Be(e,t,n){if(je(t))return t;const o=t[fe];if(!o)return ve(t,((r,i)=>$e(e,o,t,r,i,n))),t;if(o.scope_!==e)return t;if(!o.modified_)return Re(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let r=t,i=!1;3===o.type_&&(r=new Set(t),t.clear(),i=!0),ve(r,((r,s)=>$e(e,o,t,r,s,n,i))),Re(e,t,!1),n&&e.patches_&&Ce("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function $e(e,t,n,o,r,i,s){if(pe(r)){const s=Be(e,r,i&&t&&3!==t.type_&&!me(t.assigned_,o)?i.concat(o):void 0);if(we(n,o,s),!pe(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(de(r)&&!je(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Be(e,r),t&&t.scope_.parent_||"symbol"==typeof o||!Object.prototype.propertyIsEnumerable.call(n,o)||Re(e,r)}}function Re(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ae(t,n)}var Ke={get(e,t){if(t===fe)return e;const n=ke(e);if(!me(n,t))return function(e,t,n){const o=Ge(t,n);return o?"value"in o?o.value:o.get?.call(e.draft_):void 0}(e,n,t);const o=n[t];return e.finalized_||!de(o)?o:o===Ve(e.base_,t)?(He(e),e.copy_[t]=qe(o,e)):o},has:(e,t)=>t in ke(e),ownKeys:e=>Reflect.ownKeys(ke(e)),set(e,t,n){const o=Ge(ke(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const o=Ve(ke(e),t),s=o?.[fe];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((r=n)===(i=o)?0!==r||1/r==1/i:r!=r&&i!=i)&&(void 0!==n||me(e.base_,t)))return!0;He(e),Ie(e)}var r,i;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Ve(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,He(e),Ie(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=ke(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty(){_e()},getPrototypeOf:e=>he(e.base_),setPrototypeOf(){_e()}},Ue={};function Ve(e,t){const n=e[fe];return(n?ke(n):e)[t]}function Ge(e,t){if(!(t in e))return;let n=he(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=he(n)}}function Ie(e){e.modified_||(e.modified_=!0,e.parent_&&Ie(e.parent_))}function He(e){e.copy_||(e.copy_=Oe(e.base_,e.scope_.immer_.useStrictShallowCopy_))}ve(Ke,((e,t)=>{Ue[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ue.deleteProperty=function(e,t){return Ue.set.call(this,e,t,void 0)},Ue.set=function(e,t,n){return Ke.set.call(this,e[0],t,n,e[0])};function qe(e,t){const n=Se(e)?Ce("MapSet").proxyMap_(e,t):xe(e)?Ce("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:Ee(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,i=Ke;n&&(r=[o],i=Ue);const{revoke:s,proxy:c}=Proxy.revocable(r,i);return o.draft_=c,o.revoke_=s,c}(e,t);return(t?t.scope_:Ee()).drafts_.push(n),n}function Je(e){if(!de(e)||je(e))return e;const t=e[fe];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Oe(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Oe(e,!0);return ve(n,((e,t)=>{we(n,e,Je(t))})),t&&(t.finalized_=!1),n}var Qe=new class{autoFreeze_;useStrictShallowCopy_;produce;produceWithPatches;constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const o=this;return function(e=n,...r){return o.produce(e,(e=>t.call(this,e,...r)))}}let o;if("function"!=typeof t&&_e(),void 0!==n&&"function"!=typeof n&&_e(),de(e)){const r=De(this),i=qe(e,void 0);let s=!0;try{o=t(i),s=!1}finally{s?Fe(r):Ne(r)}return Te(r,n),We(o,r)}if(!e||"object"!=typeof e){if(o=t(e),void 0===o&&(o=e),o===le&&(o=void 0),this.autoFreeze_&&Ae(o,!0),n){const t=[],r=[];Ce("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}_e(0)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,o;return[this.produce(e,t,((e,t)=>{n=e,o=t})),n,o]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){de(e)||_e(),pe(e)&&(e=function(e){pe(e)||_e(0);return Je(e)}(e));const t=De(this),n=qe(e,void 0);return n[fe].isManual_=!0,Ne(t),n}finishDraft(e,t){const n=e&&e[fe];n&&n.isManual_||_e();const{scope_:o}=n;return Te(o,t),We(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));const o=Ce("Patches").applyPatches_;return pe(e)?o(e,t):this.produce(e,(e=>o(e,t)))}},Xe=Qe.produce;e.batch=function(e){if(a>0)return e();a++;try{return e()}finally{s()}},e.computed=function(e,t){return new v(e,t)},e.createApp=function(e,t){const n=e.tag,o=te(n.call(n,e.props,n,ee.bind(n)),n),r=ne(t);Y(o,r),q.set(n,o),oe=r,ce()},e.domInfo=J,e.effect=x,e.html=o,e.onMounted=function(e=null){null!==e&&("function"==typeof e?re.push(e):F("The parameter of onMounted is not a function!"))},e.onUnmounted=function(e=null){null!==e&&("function"==typeof e?(ie+=1,ue.push(e)):F("The parameter of onUnmounted is not a function!"))},e.produce=Xe,e.resetView=function(e,t){!function(){if(ue.length>0){for(let e=0;e<se;e++)ue[e]&&ue[e]();ue.splice(0,se)}se=ie}();const n=t?ne(t):oe;n.innerHTML="";const o=te(e.call(e,e,ee.bind(e)),e);Y(o,n),q.set(e,o),ce()},e.signal=function(e,t){return new p(e,t)},e.untracked=l,e.version="1.7.6",Object.defineProperty(e,"__esModule",{value:!0})}));