ziko 0.53.0 → 0.54.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ziko.min.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /*
2
2
  Project: ziko.js
3
3
  Author: Zakaria Elalaoui
4
- Date : Fri Dec 05 2025 11:33:57 GMT+0100 (UTC+01:00)
4
+ Date : Sun Dec 07 2025 10:51:21 GMT+0100 (UTC+01:00)
5
5
  Git-Repo : https://github.com/zakarialaoui10/ziko.js
6
6
  Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
7
7
  Released under MIT License
8
8
  */
9
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Ziko={})}(this,(function(t){"use strict";const{PI:e,E:s}=Math,r=Number.EPSILON,{PI:n,cos:i,sin:o,tan:c,atan:h,cosh:l,sinh:u,tanh:f,acosh:m,asinh:p,atanh:d,log:g}=Math;let w={cos:t=>t.isComplex?.()?new t.constructor(i(t.a)*l(t.b),-o(t.a)*u(t.b)):i(t),sin:t=>t?.isComplex?new t.constructor(o(t.a)*l(t.b),i(t.a)*u(t.b)):o(t),tan:t=>{if(t?.isComplex){const e=i(2*t.a)+l(2*t.b);return new t.constructor(o(2*t.a)/e,u(2*t.b)/e)}return c(t)},sinc:t=>o(n*t)/(n*t),sec:t=>1/i(t),csc:t=>1/o(t),cot:t=>1/c(t),acos:t=>{if(!t?.isComplex)return o(t)},asin:t=>{if(!t?.isComplex)return o(t)},atan:t=>{if(!t?.isComplex)return o(t)},acot:t=>n/2-h(t),cosh:t=>t?.isComplex?new t.constructor(l(t.a)*i(t.b),u(t.a)*o(t.b)):l(t),sinh:t=>t?.isComplex?new t.constructor(u(t.a)*i(t.b),l(t.a)*o(t.b)):u(t),tanh:t=>{if(t?.isComplex){const e=l(2*a)+i(2*b);return new t.constructor(u(2*a)/e,o(2*b)/e)}return f(t)},coth:t=>.5*g((1+t)/(1-t)),acosh:m,asinh:p,atanh:d};const y=(t,...e)=>{const s=e.map((e=>null===e||["number","string","boolean","bigint","undefined"].includes(typeof e)||e?.__mapfun__?t(e):e instanceof Array?e.map((e=>y(t,e))):ArrayBuffer.isView(e)?e.map((e=>t(e))):e instanceof Set?new Set(y(t,...e)):e instanceof Map?new Map([...e].map((e=>[e[0],y(t,e[1])]))):e.isMatrix?.()?new e.constructor(e.rows,e.cols,y(e.arr.flat(1))):e instanceof Object?Object.fromEntries(Object.entries(e).map((e=>[e[0],y(t,e[1])]))):void 0));return 1==s.length?s[0]:s},v=(...t)=>{if(t.every((t=>"number"==typeof t))){let e=t[0];for(let s=1;s<t.length;s++)e+=t[s];return e}const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(v(...t[s])):t[s]instanceof Object&&e.push(v(...Object.values(t[s])));return 1===e.length?e[0]:e},_=(...t)=>{if(t.every((t=>"number"==typeof t))){let e=t[0];for(let s=1;s<t.length;s++)e*=t[s];return e}const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(_(...t[s])):t[s]instanceof Object&&e.push(_(...Object.values(t[s])));return 1===e.length?e[0]:e},x=(...t)=>{if(t.every((t=>"number"==typeof t)))return Math.min(...t);const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(x(...t[s])):t[s]instanceof Object&&e.push(Object.fromEntries([Object.entries(t[s]).sort(((t,e)=>t[1]-e[1]))[0]]));return 1===e.length?e[0]:e},E=(...t)=>{if(t.every((t=>"number"==typeof t)))return Math.max(...t);const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(x(...t[s])):t[s]instanceof Object&&e.push(Object.fromEntries([Object.entries(t[s]).sort(((t,e)=>e[1]-t[1]))[0]]));return 1===e.length?e[0]:e},k=(...t)=>{if(t.every((t=>"number"==typeof t))){let e=t.reduce(((t,e)=>[...t,t[t.length-1]+e]),[0]);return e.shift(),e}const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(k(...t[s])):t[s]instanceof Object&&e.push(null);return 1===e.length?e[0]:e},C=(...t)=>y(Math.abs,...t),A=(...t)=>y(Math.sqrt,...t),M=(t,e)=>{if("number"==typeof t)return"number"==typeof e?Math.pow(t,e):e?.isComplex?.()?e.constructor.fromExpo(t**e.a,e.b*O(t)):y((e=>M(t,e)),...e);if(t.isComplex?.())return"number"==typeof e?t.constructor.fromExpo(t.z**e,t.phi*e):e.isComplex?.()?t.constructor.fromExpo(t.z**e.a*S(-t.phi*e.b),O(t.z)*e.b+e.a*t.phi):y((e=>M(t,e)),...e);if(t instanceof Array){if("number"==typeof e)return y((t=>M(t,e)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(y((e=>M(t[r],e)),...e));return s}}},T=(t,e)=>{if("number"==typeof t)return"number"==typeof e?Math.pow(t,1/e):y((e=>T(t,e)),...e);if(t.isComplex?.())return"number"==typeof e?t.constructor.fromExpo(T(t.z,e),t.phi/e):y((e=>T(t,e)),...e);if(t instanceof Array){if("number"==typeof e)return y((t=>T(t,e)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(y((e=>T(t[r],e)),...e));return s}}},S=(...t)=>y(Math.exp,...t),O=(...t)=>y(Math.log,...t),j=(...t)=>y(w.cos,...t),P=(...t)=>y(w.sin,...t),I=(...t)=>y(w.tan,...t),D=(...t)=>y(w.cosh,...t),R=(...t)=>y(w.sinh,...t),z=(...t)=>y(Math.floor,...t),F=(t,e,s=!0)=>{if("number"==typeof t)return"number"==typeof e?s?Math.atan2(t,e):180*Math.atan2(t,e)/Math.PI:y((e=>F(t,e,s)),...e);if(t instanceof Array){if("number"==typeof e)return y((t=>F(t,e,s)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(y((e=>M(t[r],e)),...e));return s}}},$=(...t)=>t.every((t=>"number"==typeof t))?Math.hypot(...t):t.every((t=>t instanceof Array))?y(Math.hypot,...t):void 0,L=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t+e;if(e.isComplex?.())return new e.constructor(t+e.a,e.b);if(e.isMatrix?.())return e.constructor.nums(e.rows,e.cols,t).add(e);if(e instanceof Array)return e.map((e=>B(e,t)))}else{if(t.isComplex?.()||t.isMatrix?.())return e instanceof Array?e.map((e=>t.clone.add(e))):t.clone.add(e);if(t instanceof Array){if(!(e instanceof Array))return t.map((t=>B(t,e)));if(t.length===e.length)return t.map(((t,s)=>B(t,e[s])))}}},q=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t-e;if(e.isComplex?.())return new e.constructor(t-e.a,-e.b);if(e.isMatrix?.())return e.constructor.nums(e.rows,e.cols,t).sub(e);if(e instanceof Array)return e.map((e=>W(e,t)))}else{if(t.isComplex?.()||t.isMatrix?.())return e instanceof Array?e.map((e=>t.clone.sub(e))):t.clone.sub(e);if(t instanceof Array){if(!(e instanceof Array))return t.map((t=>W(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>W(t,e[s])))}}},U=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t*e;if(e.isComplex?.())return new e.constructor(t*e.a,t*e.b);if(e.isMatrix?.())return e.constructor.nums(e.rows,e.cols,t).mul(e);if(e instanceof Array)return e.map((e=>H(t,e)))}else{if(t.isComplex?.()||t.isMatrix?.())return e instanceof Array?e.map((e=>t.clone.mul(e))):t.clone.mul(e);if(t instanceof Array){if(!(e instanceof Array))return t.map((t=>H(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>H(t,e[s])))}}},N=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t/e;if(e.isComplex?.())return new e.constructor(t/e.a,t/e.b);if(e.isMatrix?.())return e.constructor.nums(e.rows,e.cols,t).div(e);if(e instanceof Array)return e.map((e=>V(t,e)))}else{if(t.isComplex?.()||t.isMatrix?.())return e instanceof Array?e.map((e=>t.clone.div(e))):t.clone.div(e);if(t instanceof Array){if(!(e instanceof Array))return t.map((t=>V(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>V(t,e[s])))}}},Z=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t%e;if(e.isComplex?.())return new e.constructor(t%e.a,t%e.b);if(e.isMatrix?.())return e.constructor.nums(e.rows,e.cols,t).modulo(e);if(e instanceof Array)return e.map((e=>V(t,e)))}else{if(t.isComplex?.()||t.isMatrix?.())return e instanceof Array?e.map((e=>t.clone.div(e))):t.clone.div(e);if(t instanceof Array&&!(e instanceof Array))return t.map((t=>B(t,e)))}},B=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=L(s,e[t]);return s},W=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=q(s,e[t]);return s},H=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=U(s,e[t]);return s},V=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=N(s,e[t]);return s},G=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=Z(s,e[t]);return s},K=t=>new Array(t).fill(0),J=t=>new Array(t).fill(1),Y=(t,e)=>new Array(e).fill(t),X=(t,e,s)=>{if("number"==typeof t)return e!==s?(t-e)/(s-e):0;if(t.isMatrix?.())return new t.constructor(t.rows,t.cols,X(t.arr.flat(1),e,s));if(t.isComplex?.())return new t.constructor(X(t.a,e,s),X(t.b,e,s));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>X(t,e,s)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=X(t[s])}}},Q=(t,e,s)=>{if("number"==typeof t)return(s-e)*t+e;if(t.isMatrix?.())return new t.constructor(t.rows,t.cols,Q(t.arr.flat(1),e,s));if(t.isComplex?.())return new t.constructor(Q(t.a,e,s),Q(t.b,e,s));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>Q(t,e,s)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=Q(t[s])}}},tt=(t,e,s,r,n)=>{if("number"==typeof t)return Q(X(t,e,s),r,n);if(t.isMatrix?.())return new t.constructor(t.rows,t.cols,tt(t.arr.flat(1),e,s,r,n));if(t.isComplex?.())return new t.constructor(tt(t.a,s,r,n),tt(t.b,e,s,r,n));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>tt(t,e,s,r,n)));{let i=new Array(t.length);for(let o=0;o<t.length;o++)i[o]=tt(t[o],e,s,r,n)}}},et=(t,e,s)=>{const[r,n]=[x(e,s),E(e,s)];if("number"==typeof t)return x(E(t,r),n);if(t.isMatrix?.())return new t.constructor(t.rows,t.cols,et(t.arr.flat(1),r,n));if(t.isComplex?.())return new t.constructor(et(t.a,r,n),et(t.b,r,n));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>et(t,r,n)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=et(t[s],r,n)}}},st=(t,e,s,r=!1)=>{let n=[];if(t<e)for(let i=t;r?i<=e:i<e;i+=s)n.push(10*i/10);else for(let i=t;r?i>=e:i>e;i-=s)n.push(10*i/10);return n},rt=(t,e,s=C(e-t)+1,r=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[o,a]=[t,e].sort(((t,e)=>e-t));var n=[];let c;c=r?(o-a)/(s-1):(o-a)/s;for(var i=0;i<s;i++)t<e?n.push(a+c*i):n.push(o-c*i);return n}if([t,e].some((t=>t.isComplex?.()))){const n=new s.constructor(t),i=new s.constructor(e);s=s||Math.abs(n.a-i.a)+1;const o=rt(n.a,i.a,s,r),a=rt(n.b,i.b,s,r);let c=new Array(s).fill(null);return c=c.map(((t,e)=>new t.constructor(o[e],a[e]))),c}}},nt=(t,e,r=e-t+1,n=s,i=!0)=>rt(t,e,r,i).map((t=>M(n,t))),it=(t,e,s=C(e-t)+1,r=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[n,i]=[t,e].sort(((t,e)=>e-t));let o;o=T(n/i,r?s-1:s);const a=[i];for(let t=1;t<s;t++)a.push(a[t-1]*o);return t<e?a:a.reverse()}if([t,e].some((t=>t.isComplex?.()))){const n=new s.constructor(t),i=new s.constructor(e);let o;s=s||Math.abs(n.a-i.a)+1,o=T(i.div(n),r?s-1:s);const a=[n];for(let t=1;t<s;t++)a.push(H(a[t-1],o));return a}}},ot=(...t)=>mapfun((t=>t*Math.PI/180),...t),at=(...t)=>mapfun((t=>t/Math.PI*180),...t),ct=(t,e,s)=>{const[r,n]=[Math.min(e,s),Math.max(e,s)];return t>=r&&t<=n},ht=(t,e,s=1e-4)=>Math.abs(t-e)<=s,lt=(t,e)=>t.reduce(((t,s)=>[...t,...e.map((t=>[s,t]))]),[]),ut=(t,e)=>{let s,r=1;if(t==z(t)&&e==z(e)){for(s=2;s<=t&&s<=e;++s)t%s==0&&e%s==0&&(r=s);return r}console.log("error")},ft=(t,e)=>{let s;if(t==z(t)&&e==z(e)){for(s=t>e?t:e;s%t!=0||s%e!=0;)++s;return s}console.log("error")},mt={add:B,sub:W,mul:H,div:V,modulo:G,zeros:K,ones:J,nums:Y,norm:X,lerp:Q,map:tt,clamp:et,arange:st,linspace:rt,logspace:nt,geomspace:it,sum:v,prod:_,accum:k,cartesianProduct:lt,ppcm:ft,pgcd:ut,deg2rad:ot,rad2deg:at,inRange:ct,isApproximatlyEqual:ht};class pt{constructor(t=0,e=0){t instanceof pt?(this.a=t.a,this.b=t.b):"object"==typeof t?"a"in t&&"b"in t?(this.a=t.a,this.b=t.b):"a"in t&&"z"in t?(this.a=t.a,this.b=A(t.z**2-t.a**2)):"a"in t&&"phi"in t?(this.a=t.a,this.b=t.a*I(t.phi)):"b"in t&&"z"in t?(this.b=t.b,this.a=A(t.z**2-t.b**2)):"b"in t&&"phi"in t?(this.b=e,this.a=t.b/I(t.phi)):"z"in t&&"phi"in t&&(this.a=t.z*j(t.phi),this.a=t.z*P(t.phi)):"number"==typeof t&&"number"==typeof e&&(this.a=+t.toFixed(32),this.b=+e.toFixed(32))}get __mapfun__(){return!0}isComplex(){return!0}toString(){let t="";return t=0!==this.a?this.b>=0?`${this.a}+${this.b}*i`:`${this.a}-${Math.abs(this.b)}*i`:this.b>=0?`${this.b}*i`:`-${Math.abs(this.b)}*i`,t}get clone(){return new pt(this.a,this.b)}get z(){return $(this.a,this.b)}get phi(){return F(this.b,this.a)}static Zero(){return new pt(0,0)}get conj(){return new pt(this.a,-this.b)}get inv(){return new pt(this.a/(M(this.a,2)+M(this.b,2)),-this.b/(M(this.a,2)+M(this.b,2)))}add(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new pt(t[e],0));let e=t.map((t=>t.a)),s=t.map((t=>t.b));return this.a+=+v(...e).toFixed(15),this.b+=+v(...s).toFixed(15),this}sub(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new pt(t[e],0));let e=t.map((t=>t.a)),s=t.map((t=>t.b));return this.a-=+v(...e).toFixed(15),this.b-=+v(...s).toFixed(15),this}mul(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new pt(t[e],0));let e=+_(this.z,...t.map((t=>t.z))).toFixed(15),s=+v(this.phi,...t.map((t=>t.phi))).toFixed(15);return this.a=+(e*j(s).toFixed(15)).toFixed(14),this.b=+(e*P(s).toFixed(15)).toFixed(14),this}div(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new pt(t[e],0));let e=+(this.z/_(...t.map((t=>t.z)))).toFixed(15),s=+(this.phi-v(...t.map((t=>t.phi)))).toFixed(15);return this.a=+(e*j(s).toFixed(15)).toFixed(15),this.b=+(e*P(s).toFixed(15)).toFixed(15),this}pow(t){if(z(t)===t&&t>0){let e=+(this.z**t).toFixed(15),s=+(this.phi*t).toFixed(15);this.a=+(e*j(s).toFixed(15)).toFixed(15),this.b=+(e*P(s).toFixed(15)).toFixed(15)}return this}static fromExpo(t,e){return new pt(+(t*j(e)).toFixed(13),+(t*P(e)).toFixed(13))}get expo(){return[this.z,this.phi]}static add(t,...e){return t.clone.add(...e)}static sub(t,...e){return t.clone.sub(...e)}static mul(t,...e){return t.clone.mul(...e)}static div(t,...e){return t.clone.div(...e)}static pow(t,e){return t.clone.pow(e)}static xpowZ(t){return dt(t**this.a*j(this.b*O(t)),t**this.a*P(this.b*O(t)))}sqrtn(t=2){return dt(T(this.z,t)*j(this.phi/t),T(this.z,t)*P(this.phi/t))}get sqrt(){return this.sqrtn(2)}get log(){return dt(this.z,this.phi)}get cos(){return dt(j(this.a)*D(this.b),P(this.a)*R(this.b))}get sin(){return dt(P(this.a)*D(this.b),j(this.a)*R(this.b))}get tan(){const t=j(2*this.a)+D(2*this.b);return dt(P(2*this.a)/t,R(2*this.b)/t)}}const dt=(t,e)=>{if((t instanceof Array||ArrayBuffer.isView(t))&&(e instanceof Array||ArrayBuffer.isView(t)))return t.map(((s,r)=>dt(t[r],e[r])));if(t.isMatrix?.()&&e.isMatrix?.()){if(t.shape[0]!==e.shape[0]||t.shape[1]!==e.shape[1])return Error(0);const s=t.arr.map(((s,r)=>dt(t.arr[r],e.arr[r])));return new t.constructor(t.rows,t.cols,...s)}return new pt(t,e)},gt=t=>{const e=new XMLHttpRequest;if(e.open("GET",t,!1),e.send(),200===e.status)return e.responseText;throw new Error(`Failed to fetch data from ${t}. Status: ${e.status}`)};globalThis.fetchdom=async function(t="https://github.com/zakarialaoui10"){try{const e=await fetch(t);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const s=await e.text();return(new DOMParser).parseFromString(s,"text/html").documentElement}catch(t){throw console.error("Failed to fetch DOM:",t),t}},globalThis.fetchdomSync=function(t="https://github.com/zakarialaoui10"){try{const e=gt(t);return(new DOMParser).parseFromString(e,"text/html").documentElement}catch(t){throw console.error("Failed to fetch DOM synchronously:",t),t}};const bt=(t,e=",")=>t.trim().trimEnd().split("\n").map((t=>t.split(e))),wt=(t,e=",")=>{const[s,...r]=bt(t,e);return r.map((t=>{const e={};return s.forEach(((s,r)=>{e[s]=t[r]})),e}))},yt=t=>t instanceof Array?[Object.keys(t[0]),...t.map((t=>Object.values(t)))]:[Object.keys(t)],vt=(t,e)=>yt(t).map((t=>t.join(e))).join("\n"),_t=(t,e=",")=>vt(t instanceof Object?t:JSON.parse(t),e),xt=(t,e)=>{const s=[];if(Array.isArray(t))t.forEach((t=>{if("object"==typeof t&&null!==t){s.push(`${e}-`);const r=xt(t,`${e} `);s.push(...r)}else s.push(`${e}- ${t}`)}));else for(const r in t)if(t.hasOwnProperty(r)){const n=t[r];if("object"==typeof n&&null!==n){s.push(`${e}${r}:`);const t=xt(n,`${e} `);s.push(...t)}else s.push(`${e}${r}: ${n}`)}return s},Et=(t,e="")=>xt(t,e).join("\n"),kt=(t,e)=>Et(t instanceof Object?t:JSON.parse(t),e),Ct=(t,e=1)=>{let s="";for(const r in t)if(t.hasOwnProperty(r)){const n=t[r];s+="\n"+" ".repeat(e)+`<${r}>`,s+="object"==typeof n?Ct(n,e+2):`${n}`,s+=`</${r}>`}return s.trim()};class At{constructor(t){this.cache={node:t}}isZikoUINode(){return!0}get node(){return this.cache.node}}class Mt extends Array{constructor(...t){super(...t)}clear(){return this.length=0,this}getItemById(t){return this.find((e=>e.element.id===t))}getItemsByTagName(t){return this.filter((e=>e.element.tagName.toLowerCase()===t.toLowerCase()))}getElementsByClassName(t){return this.filter((e=>e.element.classList?.contains(t)))}querySelector(t){const e=globalThis?.document?.querySelector(t);return e&&this.find((t=>t.element===e))||null}querySelectorAll(t){const e=globalThis?.document?.querySelectorAll(t);return Array.from(e).map((t=>this.find((e=>e.element===t)))).filter(Boolean)}}const Tt=new Mt,St={default:{target:null,render:!0,math:{mode:"deg"}},setDefault:function(t){const e=Object.keys(t),s=Object.values(t);for(let t=0;t<e.length;t++)this.default[e[t]]=s[t]},init:()=>{},renderingMode:"spa",isSSC:!1},Ot={store:new Map,index:0,register:function(t){this.store.set(this.index++,t)},reset(){this.index=0,this.store.clear()}},jt={ui_index:0,get_ui_index:function(){return this.ui_index++},register_ui:function(t){}};class Pt{#t;#e;#s;#r;#n;#i;constructor(t=""){this.#t=new BroadcastChannel(t),this.#e=new Map,this.#s=new Map,this.#r="ziko-channel:"+1e17*Math.random(),this.#n=new Set([this.#r]),this.#i=new Set,this.#t.addEventListener("message",(t=>{const{last_sent_event:e,userId:s,eventData:r,rooms:n}=t.data;if(s===this.#r)return;if(n&&n.length&&!n.some((t=>this.#i.has(t))))return;this.#n.add(s),this.#e=new Map(r);const i=this.#s.get(e);i&&i.forEach((({fn:t,rooms:s})=>{s&&0!==s.length&&n&&!n.some((t=>s.includes(t)))||t(this.#e.get(e))}))}))}emit(t,e,s){return this.#e.set(t,e),"string"==typeof s&&(s=[s]),this.#t.postMessage({eventData:Array.from(this.#e.entries()),last_sent_event:t,userId:this.#r,rooms:s&&s.length?s:void 0}),this}on(t,e=console.log,s){return this.#s.has(t)||this.#s.set(t,[]),"string"==typeof s&&(s=[s]),this.#s.get(t).push({fn:e,rooms:s}),this}off(t,e){return this.#s.has(t)?(this.#s.set(t,this.#s.get(t).filter((t=>t.fn!==e))),this):this}once(t,e,s){const r=s=>{e(s),this.off(t,r)};return this.on(t,r,s),this}join(...t){return t.forEach((t=>this.#i.add(t))),this}leave(...t){return t.length?t.forEach((t=>this.#i.delete(t))):this.#i.clear(),this}close(){return this.#t.close(),this}}const It=t=>new Pt(t);class Dt{constructor(t,e,s,r=!0){this.cache={storage:t,globalKey:e,channel:r?It(`Ziko:useStorage-${e}`):null,oldItemKeys:new Set},this.#o(s,r)}get items(){const t=this.cache.storage.getItem(this.cache.globalKey);if(!t)return{};try{return JSON.parse(t)}catch{return{}}}#a(){const t=this.items;this.cache.oldItemKeys.forEach((t=>delete this[t]));for(const e in t)this[e]=t[e],this.cache.oldItemKeys.add(e)}#o(t,e){if(e&&this.cache.channel&&this.cache.channel.on("Ziko-Storage-Updated",(()=>this.#a())),t)if(this.cache.storage.getItem(this.cache.globalKey)){const t=this.items;Object.keys(t).forEach((t=>this.cache.oldItemKeys.add(t))),this.#a()}else this.set(t);else this.#a()}set(t){return this.cache.storage.setItem(this.cache.globalKey,JSON.stringify(t)),this.cache.channel&&this.cache.channel.emit("Ziko-Storage-Updated",t),this.#a(),this}add(t){return this.set({...this.items,...t}),this}remove(...t){const e={...this.items};return t.forEach((t=>{delete e[t],delete this[t],this.cache.oldItemKeys.delete(t)})),this.set(e),this}get(t){return this.items[t]}clear(){return this.cache.storage.removeItem(this.cache.globalKey),this.cache.oldItemKeys.forEach((t=>delete this[t])),this.cache.oldItemKeys.clear(),this.#a(),this}onStorageUpdated(t){return this.cache.channel&&this.cache.channel.on("Ziko-Storage-Updated",t),this}}const Rt=(t,e,s=!0)=>new Dt(sessionStorage,t,e,s);var zt={store:new Map,index:0,session_storage:null,register:function(t){if(!(void 0).SSR&&(void 0).DEV){this.session||(this.session_storage=Rt("ziko-state",{}));const e=this.session_storage.get(this.index);e?t.value=e:this.session_storage.add({[this.index]:t.value})}this.store.set(this.index++,t)},update:function(t,e){!(void 0).SSR&&(void 0).DEV&&this.session_storage.add({[t]:e})}};function Ft(){var t;globalThis?.__Ziko__||(globalThis.__Ziko__={__UI__:Tt,__HYDRATION__:Ot,__State__:zt,__Config__:St,__CACHE__:jt},t=__Ziko__,Object.defineProperties(t,{QueryParams:{get:function(){return function(t){const e={};return t.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi,(t=>{const[s,r]=t.split("=");e[s]=r})),e}(globalThis.location.search.substring(1))},configurable:!1,enumerable:!0},HashParams:{get:function(){return globalThis.location.hash.substring(1).split("#")},configurable:!1,enumerable:!0}}))}Ft();class $t extends At{constructor(){super()}init(t,e,s,r){if(this.target=globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body,"string"==typeof t)switch(s){case"html":t=globalThis?.document?.createElement(t);break;case"svg":t=globalThis?.document?.createElementNS("http://www.w3.org/2000/svg",t);break;default:throw Error("Not supported")}else this.target=t?.parentElement;Object.assign(this.cache,{name:e,isInteractive:!1,parent:null,isBody:!1,isRoot:!1,isHidden:!1,isFrozzen:!1,legacyParent:null,attributes:{},filters:{},temp:{}}),this.events={ptr:null,mouse:null,wheel:null,key:null,drag:null,drop:null,click:null,clipboard:null,focus:null,swipe:null,custom:null},this.observer={resize:null,intersection:null},t&&Object.assign(this.cache,{element:t}),this.items=new Mt,globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this],t&&r&&this?.render?.(),globalThis.__Ziko__.__UI__.push(this)}get element(){return this.cache.element}[Symbol.iterator](){return this.items[Symbol.iterator]()}maintain(){for(let t=0;t<this.items.length;t++)Object.defineProperty(this,t,{value:this.items[t],writable:!0,configurable:!0,enumerable:!1})}isInteractive(){return this.cache.isInteractive}isUIElement(){return!0}}function Lt(t,...e){e.forEach((e=>function(t,e){const s=Object.getOwnPropertyDescriptors(e);for(const e of Reflect.ownKeys(s)){const r=s[e];"get"in r||"set"in r||"function"!=typeof r.value?Object.defineProperty(Object.getPrototypeOf(t),e,r):"function"==typeof r.value&&(Object.getPrototypeOf(t).hasOwnProperty(e)||Object.defineProperty(Object.getPrototypeOf(t),e,r))}}(t,e)))}var qt=Object.freeze({__proto__:null,mount:function(t=this.target,e=0){return e>0?(setTimeout((()=>this.mount(t,0)),e),this):(this.isBody||(t?.isUIElement&&(t=t.element),this.target=t,this.target?.appendChild(this.element)),this)},unmount:function(t=0){return t>0?(setTimeout((()=>this.unmount(0)),t),this):(this.cache.parent?this.cache.parent.remove(this):this.target?.children?.length&&[...this.target.children].includes(this.element)&&this.target.removeChild(this.element),this)}});function Ut(t){const{store:e,index:s}=__Ziko__.__State__;__Ziko__.__State__.register({value:t,subscribers:new Set,paused:!1});let r=e.get(s);return[function(){return{value:r.value,isStateGetter:()=>!0,_subscribe:t=>r.subscribers.add(t)}},function(t){r.paused||("function"==typeof t&&(t=t(r.value)),t!==r.value&&(r.value=t,r.subscribers.forEach((t=>t(r.value))),__Ziko__.__State__.update(s,t)))},{pause:()=>{r.paused=!0},resume:()=>{r.paused=!1},clear:()=>{r.subscribers.clear()},force:t=>{"function"==typeof t&&(t=t(r.value)),r.value=t,r.subscribers.forEach((t=>t(r.value)))},getSubscribers:()=>new Set(r.subscribers)}]}globalThis.__Ziko__||Ft();const Nt=t=>"function"==typeof t&&t?.()?.isStateGetter?.(),Zt=(t="")=>t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase())),Bt=(t="")=>{if(0===t.length)return!1;return/^[a-z][a-zA-Z0-9]*$/.test(t)};class Wt extends At{constructor(...t){super("span","text",!1,...t),this.element=globalThis?.document?.createTextNode(...t)}isText(){return!0}}const Ht=(...t)=>new Wt(...t);async function Vt(t,e,...s){if(this.cache.isFrozzen)return console.warn("You can't append new item to frozzen element"),this;for(let r=0;r<s.length;r++){if(["number","string"].includes(typeof s[r])&&(s[r]=Ht(s[r])),s[r]instanceof Function){const t=s[r]();t.isStateGetter&&(s[r]=Ht(t.value),t._subscribe((t=>s[r].element.textContent=t),s[r]))}if("function"==typeof globalThis?.Node&&s[r]instanceof globalThis?.Node&&(s[r]=new this.constructor(s[r])),s[r]?.isZikoUINode)s[r].cache.parent=this,this.element?.[t](s[r].element),s[r].target=this.element,this.items[e](s[r]);else if(s[r]instanceof Promise){const n=await s[r];n.cache.parent=this,this.element?.[t](n.element),n.target=this.element,this.items[e](n)}else s[r]instanceof Object&&(s[r]?.style&&this.style(s[r]?.style),s[r]?.attr&&Object.entries(s[r].attr).forEach((t=>this.setAttr(""+t[0],t[1]))))}return this.maintain(),this}function Gt(t,e){if(globalThis.SVGAElement&&this.element instanceof globalThis.SVGAElement&&(t=Bt(t)?Zt(t):t),!this?.attr[t]||this?.attr[t]!==e){if(Nt(e)){e()._subscribe((e=>this.element?.setAttribute(t,e)),this)}else this.element?.setAttribute(t,e);Object.assign(this.cache.attributes,{[t]:e})}}var Kt=Object.freeze({__proto__:null,getAttr:function(t){return t=is_camelcase(t)?camel2hyphencase(t):t,this.element.attributes[t].value},removeAttr:function(...t){for(let e=0;e<t.length;e++)this.element?.removeAttribute(t[e]);return this},setAttr:function(t,e){if(t instanceof Object){const[s,r]=[Object.keys(t),Object.values(t)];for(let t=0;t<s.length;t++)r[t]instanceof Array&&(e[t]=r[t].join(" ")),Gt.call(this,s[t],r[t])}else e instanceof Array&&(e=e.join(" ")),Gt.call(this,t,e);return this},setContentEditable:function(t=!0){return this.setAttr("contenteditable",t),this}});var Jt=Object.freeze({__proto__:null,after:function(t){return t?.isUIElement&&(t=t.element),this.element?.after(t),this},append:function(...t){return Vt.call(this,"append","push",...t),this},before:function(t){return t?.isUIElement&&(t=t.element),this.element?.before(t),this},clear:function(){return this?.items?.forEach((t=>t.unmount())),this.element.innerHTML="",this},insertAt:function(t,...e){if(t>=this.element.children.length)this.append(...e);else for(let s=0;s<e.length;s++)["number","string"].includes(typeof e[s])&&(e[s]=Ht(e[s])),this.element?.insertBefore(e[s].element,this.items[t].element),this.items.splice(t,0,e[s]);return this},prepend:function(...t){return this.__addItem__.call(this,"prepend","unshift",...t),this},remove:function(...t){const e=t=>{"number"==typeof t&&(t=this.items[t]),t?.isUIElement&&this.element?.removeChild(t.element),this.items=this.items.filter((e=>e!==t))};for(let s=0;s<t.length;s++)e(t[s]);for(let t=0;t<this.items.length;t++)Object.assign(this,{[[t]]:this.items[t]});return this},replaceElementWith:function(t){return this.cache.element.replaceWith(t),this.cache.element=t,this}});const Yt={Click:["Click","DblClick","ClickAway"],Ptr:["PtrMove","PtrDown","PtrUp","PtrLeave","PtrEnter","PtrOut","PtrCancel"],Mouse:["MouseMove","MouseDown","MouseUp","MouseEnter","MouseLeave","MouseOut"],Key:["KeyDown","KeyPress","KeyUp"],Clipboard:["Copy","Cut","Paste"],Focus:["focus","blur"],Drag:["Drag","DragStart","DragEnd","Drop"],Wheel:["Wheel"],View:["EnterView","ExitView","ResizeView"],Swipe:["SwipeLeft","SwipeUp","SwipeRight","SwipeDown"]};function Xt(t,e,s,r){this.cache.currentEvent=e,this.cache.event=t,s?.call(this),r?.hasOwnProperty("prototype")?r?.call(this):r?.call(null,this),this.cache.preventDefault[e]&&t.preventDefault(),this.cache.stopPropagation[e]&&t.stopPropagation(),this.cache.stopImmediatePropagation[e]&&t.stopImmediatePropagation(),this.cache.callbacks[e]?.(this)}function Qt(t,...e){return(0===e.length?Object.keys(this.cache.paused):e).forEach((e=>{this.cache.paused.hasOwnProperty(e)&&(this.targetElement?.[t](e,this.cache.__controllers__[e],this.cache.options[e]),this.cache.paused[e]="removeEventListener"===t)})),this}const te=(t="")=>t.startsWith("Ptr")?`pointer${t.split("Ptr")[1].toLowerCase()}`:t.toLowerCase();class ee{constructor(t,e=null,s=[],r,n){this.target=e,this.cache={signature:t,currentEvent:null,event:null,options:{},preventDefault:{},stopPropagation:{},stopImmediatePropagation:{},paused:{},callbacks:{},__controllers__:{}},s&&this._register_events(s,r,n)}_register_events(t,e,s,r=!0){const n=t?.map((t=>te(t)));return n?.forEach(((n,i)=>{this.cache.preventDefault[n]=!1,this.cache.options[n]={},this.cache.paused[n]=!1,this.cache.__controllers__[n]=t=>Xt.call(this,t,n,e,s),r&&(this[`on${t[i]}`]=t=>this.__onEvent(n,this.cache.options[n],{},t))})),this}__onEvent(t,e,s,r){return r?(this.cache.callbacks[t]=r,this.__handle(t,this.cache.__controllers__[t],e,s),this):this}get targetElement(){return this.target?.element}get isParent(){return this.target?.element===this.event?.srcElement}get item(){return this.target.find((t=>t.element==this.event?.srcElement))?.[0]}get currentEvent(){return this.cache.currentEvent}get event(){return this.cache.event}get detail(){return this.cache.event.detail}setTarget(t){return this.target=t,this}__handle(t,e,s){return this.targetElement?.addEventListener(t,e,s),this}#c(t,...e){return(0===e.length?Object.keys(this.cache[t]):e).forEach((e=>{this.cache[t].hasOwnProperty(e)&&(this.cache[t][e]=!0)})),this}preventDefault(...t){return this.#c("preventDefault",...t)}stopPropagation(...t){return this.#c("stopPropagation",...t)}stopImmediatePropagation(...t){return this.#c("stopImmediatePropagation",...t)}setEventOptions(t,e){const s=te(t);return this.pause(),Object.assign(this.cache.options[s],e),this.resume(),this}pause(...t){return Qt.call(this,"removeEventListener",...t)}resume(...t){return Qt.call(this,"addEventListener",...t)}dispose(){return this.pause(),this.target.events[this.cache.signature]=null,this}}function se(){switch(this.currentEvent){case"keydown":this.kd=this.event.key;break;case"keypress":this.kp=this.event.key;break;case"keyup":this.ku=this.event.key}}function re(){const t=this.targetElement.getBoundingClientRect(),e=this.event;let s=e.clientX-t.left|0,r=e.clientY-t.top|0;if(this.cache.useNormalisedCoordinates){const t=this.targetElement.clientWidth,e=this.targetElement.clientHeight;s=+(s/t*2-1).toFixed(8),r=+(r/e*-2+1).toFixed(8)}switch(this.currentEvent){case"pointerdown":this.dx=s,this.dy=r,this.isDown=!0;break;case"pointermove":this.mx=s,this.my=r,this.isMoving=!0;break;case"pointerup":this.ux=s,this.uy=r,this.isDown=!1,this.isMoving=!1}}function ne(){const t=this.targetElement.getBoundingClientRect(),e=this.event;let s=e.clientX-t.left|0,r=e.clientY-t.top|0;if(this.cache.useNormalisedCoordinates){const t=this.targetElement.clientWidth,e=this.targetElement.clientHeight;s=+(s/t*2-1).toFixed(8),r=+(r/e*-2+1).toFixed(8)}switch(this.currentEvent){case"mousedown":this.dx=s,this.dy=r,this.isDown=!0;break;case"mousemove":this.mx=s,this.my=r,this.isMoving=!0;break;case"mouserup":this.ux=s,this.uy=r,this.isDown=!1,this.isMoving=!1}}function ie(){const t=this.event,e=t.touches?.[0]||t.changedTouches?.[0];if(!e)return;const s=this.targetElement.getBoundingClientRect();let r=e.clientX-s.left,n=e.clientY-s.top;if(this.cache.useNormalisedCoordinates){const t=this.targetElement.clientWidth,e=this.targetElement.clientHeight;r=+(r/t*2-1).toFixed(8),n=+(n/e*-2+1).toFixed(8)}switch(this.currentEvent){case"touchstart":this.dx=r,this.dy=n,this.isDown=!0;break;case"touchmove":this.mx=r,this.my=n,this.isMoving=!0;break;case"touchend":this.ux=r,this.uy=n,this.isDown=!1}}class oe extends ee{constructor(t,e=null,s=[],r,n){super(t,e,s,r,n),Object.assign(this.cache,{useNormalisedCoordinates:!1}),this.isDown=!1,this.isMoving=!1,this.dx=0,this.dy=0,this.mx=0,this.my=0,this.ux=0,this.uy=0}get isDragging(){return this.isDown&&this.isMoving}useNormalisedCoordinates(t=!0){return this.cache.useNormalisedCoordinates=t,this}}class ae extends Event{constructor(t,e){super("clickaway",{bubbles:!0,cancelable:!0}),this.originalEvent=t,this.targetElement=e}}const ce=(t,e)=>{let s=0;return(...r)=>{const n=(new Date).getTime();n-s<e||(s=n,t(...r))}};class he extends CustomEvent{constructor(t,e,{bubbles:s=!0,cancelable:r=!0}={}){super(t,{detail:e,bubbles:s,cancelable:r})}}class le extends CustomEvent{constructor(t,e){super(t,{detail:e,bubbles:!0,cancelable:!0})}}const ue=(t,e)=>(function(t){function e(e){if(!t.contains(e.target)){const s=new ae(e,t);t.dispatchEvent(s)}}console.log(t),globalThis?.document?.addEventListener("click",e)}(t.element),new ee("click",t,Yt.Click,null,e)),fe=(t,e)=>new ee("clipboard",t,Yt.Clipboard,null,e),me=(t,e)=>new ee("drag",t,Yt.Drag,null,e),pe=(t,e)=>new ee("focus",t,Yt.Focus,null,e),de=(t,e)=>new ee("key",t,Yt.Key,se,e),ge=(t,e)=>new oe("mouse",t,Yt.Mouse,ne,e),be=(t,e)=>new oe("ptr",t,Yt.Ptr,re,e),we=(t,e)=>new ee("wheel",t,Yt.Wheel,null,e),ye=(t,e)=>(function(t,{intersection:e=!0,resize:s=!0,threshold:r=0,throttleResize:n=100,throttleEnterExit:i=0}={}){let o,a;const c=e=>{for(let s of e){const{width:e,height:r}=s.contentRect;t.dispatchEvent(new he("resizeview",{width:e,height:r,entry:s}))}},h=n>0?ce(c,n):c,l=e=>{for(let s of e){const e=s.isIntersecting?"enterview":"exitview";t.dispatchEvent(new he(e,s))}},u=i>0?ce(l,i):l;e&&(o=new IntersectionObserver(u,{threshold:r}),o.observe(t)),s&&(a=new ResizeObserver(h),a.observe(t))}(t.element),new ee("view",t,Yt.View,null,e)),ve=(t,e)=>(function(t,e=50,s=100,r=500){let n=0,i=0,o=0,a=!1;function c(t){n=t.clientX,i=t.clientY,o=performance.now(),a=!0}function h(c){if(!a)return;a=!1;const h=c.clientX-n,l=c.clientY-i;let u=null,f=null;performance.now()-o<=r&&(Math.abs(h)>=e&&Math.abs(l)<=s?(u=h<0?"left":"right",f="swipe"+u):Math.abs(l)>=e&&Math.abs(h)<=s&&(u=l<0?"up":"down",f="swipe"+u)),f&&t.dispatchEvent(new le(f,{direction:u,distX:h,distY:l,originalEvent:c}))}t.addEventListener("pointerdown",c,{passive:!0}),t.addEventListener("pointerup",h,{passive:!0})}(t.element),new ee("swipe",t,Yt.Swipe,null,e));class _e extends ee{constructor(t,e,s){super("custom",t,e,xe,s)}_register_events(t){return super._register_events(t,null,null,!1),this}emit(t,e={}){const s=new CustomEvent(t,{detail:e,bubbles:!0,cancelable:!0});return this.targetElement.dispatchEvent(s),this}on(t,...e){return this.cache.options.hasOwnProperty(t)||this._register_events([t]),this.__onEvent(t,this.cache.options[t],{},...e),this}}function xe(){}const Ee=(t,e,s)=>new _e(t,e,s),ke={ptr:be,mouse:ge,key:de,click:ue,drag:me,clipboard:fe,focus:pe,wheel:we,view:ye,swipe:ve},Ce={on(t,...e){return this.events.custom||(this.events.custom=Ee(this)),this.events.custom.on(t,...e),this},emit(t,e={}){return this.events.custom||(this.events.custom=Ee(this)),this.events.custom.emit(t,e),this}};Object.entries(Yt).forEach((([t,e])=>{const s=t.toLowerCase();e.forEach((t=>{const e=`on${t}`;Ce[e]=function(t){return this.events[s]||(this.events[s]=ke[s](this)),this.events[s][e](t),this}}))}));var Ae=Object.freeze({__proto__:null,at:function(t){return this.items.at(t)},find:function(t){return this.items.filter(t)},forEach:function(t){return this.items.forEach(t),this},map:function(t){return this.items.map(t)}});var Me=Object.freeze({__proto__:null,animate:function(t,{duration:e=1e3,iterations:s=1,easing:r="ease"}={}){return this.element?.animate(t,{duration:e,iterations:s,easing:r}),this},hide:function(){},show:function(){},size:function(t,e){return this.style({width:t,height:e})},style:function(t){if(!this.element?.style)return this;for(let e in t){const s=t[e];if(Nt(s)){const t=s();Object.assign(this.element.style,{[e]:t.value}),t._subscribe((t=>{console.log({newValue:t}),Object.assign(this.element.style,{[e]:t})}))}else Object.assign(this.element.style,{[e]:s})}return this}});let Te=class extends $t{constructor({element:t,name:e="",type:s="html",render:r=__Ziko__.__Config__.default.render}={}){super(),Lt(this,qt,Kt,Jt,Me,Ae,Ce),t&&this.init(t,e,s,r)}get element(){return this.cache.element}isInteractive(){return this.cache.isInteractive}useClient(t){return this.cache.isInteractive||(this.element.setAttribute("data-hydration-index",globalThis.__Ziko__.__HYDRATION__.index),globalThis.__Ziko__.__HYDRATION__.register((()=>this)),this.cache.isInteractive=!0),t&&this.element.setAttribute("data-hydration-directive",t),this}get st(){return this.cache.style}get attr(){return this.cache.attributes}get evt(){return this.events}get html(){return this.element.innerHTML}get text(){return this.element.textContent}get isBody(){return this.element===globalThis?.document.body}get parent(){return this.cache.parent}get width(){return this.element.getBoundingClientRect().width}get height(){return this.element.getBoundingClientRect().height}get top(){return this.element.getBoundingClientRect().top}get right(){return this.element.getBoundingClientRect().right}get bottom(){return this.element.getBoundingClientRect().bottom}get left(){return this.element.getBoundingClientRect().left}};class Se extends Te{constructor(...t){super({element:"div",name:"view"}),this.append(...t)}}const Oe=["a","abb","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","ipnut","ins","kbd","label","legend","li","main","map","mark","menu","meter","nav","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"],je=["svg","g","defs","symbol","use","image","switch","rect","circle","ellipse","line","polyline","polygon","path","text","tspan","textPath","altGlyph","altGlyphDef","altGlyphItem","glyph","glyphRef","linearGradient","radialGradient","pattern","solidColor","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncR","feFuncG","feFuncB","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","animate","animateMotion","animateTransform","set","script","desc","title","metadata","foreignObject"],Pe=new Proxy({},{get(t,e){if("string"!=typeof e)return;let s,r=e.replaceAll("_","-").toLowerCase();return Oe.includes(r)&&(s="html"),je.includes(r)&&(s="svg"),(...t)=>0===t.length?new Te({element:r,name:r,type:s}):["string","number"].includes(typeof t[0])||t[0]instanceof Te||"function"==typeof t[0]&&t[0]().isStateGetter()?new Te({element:r,name:r,type:s}).append(...t):new Te({element:r,type:s}).setAttr(t.shift()).append(...t)}});class Ie extends Te{constructor(t="div",e="100%",s="100%"){super({element:t,name:"Flex"}),this.direction="cols","number"==typeof e&&(e+="%"),"number"==typeof s&&(s+="%"),this.style({width:e,height:s}),this.style({display:"flex"})}get isFlex(){return!0}resp(t,e=!0){return this.wrap(e),this.element.clientWidth<t?this.vertical():this.horizontal(),this}setSpaceAround(){return this.style({justifyContent:"space-around"}),this}setSpaceBetween(){return this.style({justifyContent:"space-between"}),this}setBaseline(){return this.style({alignItems:"baseline"}),this}gap(t){return"row"===this.direction?this.style({columnGap:t}):"column"===this.direction&&this.style({rowGap:t}),this}wrap(t="wrap"){return this.style({flexWrap:"string"==typeof t?t:["no-wrap","wrap","wrap-reverse"][+t]}),this}_justifyContent(t="center"){return this.style({justifyContent:t}),this}vertical(t,e,s=1){return De.call(this,s),this.style({alignItems:"number"==typeof t?ze.call(this,t):t,justifyContent:"number"==typeof e?Fe.call(this,e):e}),this}horizontal(t,e,s=1){return Re.call(this,s),this.style({alignItems:"number"==typeof e?Fe.call(this,e):e,justifyContent:"number"==typeof t?ze.call(this,t):t}),this}show(){return this.isHidden=!1,this.style({display:"flex"}),this}}function De(t){return 1==t?this.style({flexDirection:"column"}):-1==t&&this.style({flexDirection:"column-reverse"}),this}function Re(t){return 1==t?this.style({flexDirection:"row"}):-1==t&&this.style({flexDirection:"row-reverse"}),this}function ze(t){return"number"==typeof t&&(t=["flex-start","center","flex-end"][t+1]),t}function Fe(t){return ze(-t)}class $e extends $t{constructor({element:t,name:e,type:s,render:r}){super({element:t,name:e,type:s,render:r})}}class Le extends $e{constructor(t,e){super({element:"div",name:"suspense"}),this.setAttr({dataTemp:"suspense"}),this.fallback_ui=t,this.append(t),(async()=>{try{const s=await e();t.unmount(),this.append(s)}catch(t){console.log({error:t})}})()}}class qe extends Te{constructor(t){super({element:"div",name:"html_wrappper"}),this.element.append(function(t){if(globalThis?.DOMParser){const e=(new DOMParser).parseFromString(`<div>${t}</div>`,"text/html");return e.body.firstChild.style.display="contents",e.body.firstChild}}(t)),this.style({display:"contents"})}}class Ue extends Te{constructor(t){super({element:"div",name:"html_wrappper"}),this.element.append(function(t){if("undefined"!=typeof DOMParser){const e=(new DOMParser).parseFromString(t.trim(),"image/svg+xml").documentElement;if("parsererror"===e.nodeName)throw new Error("Invalid SVG string");if(e.hasAttribute("xmlns"))return e;const{children:s,attributes:r}=e,n=document.createElementNS("http://www.w3.org/2000/svg","svg");for(let{name:t,value:e}of r)n.setAttribute(t,e);return n.append(...s),globalThis.svg=e,globalThis.children=s,globalThis.attributes=r,globalThis.element=n,n}throw new Error("DOMParser is not available in this environment")}(t)),this.style({display:"contents"})}}class Ne extends Te{constructor(t,e){super(),this.key=t,this.cases=e,this.init()}init(){Object.values(this.cases).filter((t=>t!=this.current)).forEach((t=>t.unmount())),super.init(this.current.element)}get current(){const t=Object.keys(this.cases).find((t=>t==this.key))??"default";return this.cases[t]}updateKey(t){return this.key=t,this.replaceElementWith(this.current.element),this}}const Ze=t=>(new XMLSerializer).serializeToString(t),Be=t=>btoa(Ze(t)),We=t=>"data:image/svg+xml;base64,"+Be(t),He=t=>JSON.stringify(y((t=>["number","string","boolean","bigint"].includes(typeof t)?String(t):t instanceof pt||t instanceof ts?t.toString():t instanceof Array?Ge(t):void 0),t),null," ").replace(/"([^"]+)":/g,"$1:").replace(/: "([^"]+)"/g,": $1"),Ve=t=>{if(!Array.isArray(t))return 0;let e=1;for(const s of t)if(Array.isArray(s)){const t=Ve(s);t+1>e&&(e=t+1)}return e},Ge=t=>{let e=0;return function t(s){let r=Ve(s),n=0;return s.some((t=>Array.isArray(t)))&&(e++,n=1),"["+s.map(((r,n)=>["number","string","boolean","bigint"].includes(typeof r)?String(r):r instanceof pt?r.toString():r instanceof Array?`\n${" ".repeat(e)}${t(r)}${n===s.length-1?"\n":""}`:r instanceof Object?He(r):void 0))+`${" ".repeat((r+e+1)*n)}]`}(t)},Ke=(t,e=0)=>{t=Je(t);let s="";const r=" ".repeat(e);for(let n in t)if("object"==typeof t[n]){s+=`${r}${n} {\n`;const i=t[n];for(let t in i)"object"==typeof i[t]?s+=Ke({[t]:i[t]},e+1):s+=`${r} ${t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}: ${i[t]};\n`;s+=`${r}}\n`}return s};function Je(t){return"object"!=typeof t||null===t?t:Object.keys(t).reduce(((e,s)=>(e[s.trim()]=Je(t[s]),e)),Array.isArray(t)?[]:{})}function Ye(t,e){var s=[];for(let e=0;e<t.length;e++)s.push(t[e].slice(0));s.splice(0,1);for(let t=0;t<s.length;t++)s[t].splice(e,1);return s}function Xe(t,e){if(t=t.clone(),e=e.clone(),t.rows!==e.rows)return;let s=t.arr;for(let r=0;r<t.rows;r++)for(let n=t.cols;n<t.cols+e.cols;n++)s[r][n]=e.arr[r][n-t.cols];return t.cols+=e.cols,new t.constructor(t.rows,t.cols,s.flat(1))}function Qe(t,e){if(t=t.clone(),e=e.clone(),t.cols!==e.cols)return;let s=t.arr;for(let r=t.rows;r<t.rows+e.rows;r++){s[r]=[];for(let n=0;n<t.cols;n++)s[r][n]=e.arr[r-t.rows][n]}return t.rows+=e.rows,new t.constructor(t.rows,t.cols,s.flat(1))}class ts{constructor(t,e,s=[]){if(t instanceof ts)this.arr=t.arr,this.rows=t.rows,this.cols=t.cols;else{let r,n,i=[];if(arguments[0]instanceof Array)t=arguments[0].length,e=arguments[0][0].length,i=arguments[0];else for(r=0;r<t;r++)for(i.push([]),i[r].push(new Array(e)),n=0;n<e;n++)i[r][n]=s[r*e+n],null==s[r*e+n]&&(i[r][n]=0);this.rows=t,this.cols=e,this.arr=i}this.#a()}isMatrix(){return!0}clone(){return new ts(this.rows,this.cols,this.arr.flat(1))}[Symbol.iterator](){return this.arr[Symbol.iterator]()}#a(){for(let t=0;t<this.arr.length;t++)Object.defineProperty(this,t,{value:this.arr[t],writable:!0,configurable:!0,enumerable:!1})}get size(){return this.rows*this.cols}get shape(){return[this.rows,this.cols]}toString(){return Ge(this.arr)}at(t=0,e=void 0){if(t<0&&(t+=this.rows),t<0||t>=this.rows)throw new Error("Row index out of bounds");if(void 0===e)return this.arr[t];if(e<0&&(e+=this.cols),e<0||e>=this.cols)throw new Error("Column index out of bounds");return this.arr[t][e]}slice(t=0,e=0,s=this.rows-1,r=this.cols-1){let n=s-t,i=r-e,o=new Array(i);for(let s=0;s<n;s++){o[s]=[];for(let r=0;r<i;r++)o[s][r]=this.arr[s+t][r+e]}return new ts(n,i,o.flat(1))}static slice(t,e=0,s=0,r=this.rows-1,n=this.cols-1){return t.slice(e,s,r,n)}reshape(t,e){if(t*e!=this.rows*this.cols)throw Error("size not matched");return new ts(t,e,this.arr.flat(1))}get T(){let t=[];for(let e=0;e<this.arr[0].length;e++){t[e]=[];for(let s=0;s<this.arr.length;s++)t[e][s]=this.arr[s][e]}return new ts(this.cols,this.rows,t.flat(1))}get det(){return(t=this).isSquare?1==t.rows?t.arr[0][0]:function t(e){if(2==e.length)return e.flat(1).some((t=>t?.isMatrix?.()))?void console.warn("Tensors are not completely supported yet ..."):W(H(e[0][0],e[1][1]),H(e[0][1],e[1][0]));for(var s=0,r=0;r<e.length;r++){const n=B(H(M(-1,r),H(e[0][r],t(Ye(e,r)))));s=B(s,n)}return s}(t.arr):new Error("is not square matrix");var t}get inv(){return function(t){if(t.row!==t.cols)throw Error('is not a square matrix"');if(0===t.det)throw Error("determinant should not equal 0");const{arr:e}=t;if(e.length===e[0].length){var s=0,r=0,n=0,i=e.length,o=0,a=[],c=[];for(s=0;s<i;s+=1)for(a[a.length]=[],c[c.length]=[],n=0;n<i;n+=1)a[s][n]=s==n?1:0,c[s][n]=e[s][n];for(s=0;s<i;s+=1){if(0==(o=c[s][s])){for(r=s+1;r<i;r+=1)if(0!=c[r][s]){for(n=0;n<i;n++)o=c[s][n],c[s][n]=c[r][n],c[r][n]=o,o=a[s][n],a[s][n]=a[r][n],a[r][n]=o;break}if(0==(o=c[s][s]))return}for(n=0;n<i;n++)c[s][n]=c[s][n]/o,a[s][n]=a[s][n]/o;for(r=0;r<i;r++)if(r!=s)for(o=c[r][s],n=0;n<i;n++)c[r][n]-=o*c[s][n],a[r][n]-=o*a[s][n]}return new t.constructor(a)}}(this)}static eye(t){let e=new ts(t,t);for(let s=0;s<t;s++)for(let r=0;r<t;r++)e.arr[s][r]=s===r?1:0;return e}static zeros(t,e){let s=new ts(t,e);for(let n=0;n<t;n++)for(var r=0;r<e;r++)s.arr[n][r]=0;return s}static ones(t,e){let s=new ts(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)s.arr[r][t]=1;return s}static nums(t,e,s){let r=new ts(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)r.arr[n][t]=s;return r}hstack(...t){const e=[this,...t].reduce(((t,e)=>Xe(t,e)));return Object.assign(this,e),this.#a(),this}static hstack(t,...e){return t.clone().hstack(...e)}vstack(...t){const e=[this,...t].reduce(((t,e)=>Qe(t,e)));return Object.assign(this,e),this.#a(),this}static vstack(t,...e){return t.clone().vstack(...e)}hqueue(...t){const e=[this,...t].reverse().reduce(((t,e)=>Xe(t,e)));return Object.assign(this,e),this}static hqueue(t,...e){return t.clone().hqueue(...e)}vqueue(...t){const e=[this,...t].reverse().reduce(((t,e)=>Qe(t,e)));return Object.assign(this,e),this}static vqueue(t,...e){return t.clone().vqueue(...e)}shuffle(){return this.arr=this.arr.sort((()=>.5-Math.random())),this}static shuffle(t){return t.clone().shuffle()}get isSquare(){return this.rows===this.cols}get isSym(){if(!this.isSquare)return!1;for(let t=0;t<this.rows;t++)for(let e=t+1;e<this.cols;e++)if(this.arr[t][e]!==this.arr[e][t])return!1;return!0}get isAntiSym(){if(!this.isSquare)return!1;const t=this.rows;for(let e=0;e<t;e++){if(0!==this.arr[e][e])return!1;for(let s=e+1;s<t;s++)if(this.arr[e][s]!==-this.arr[s][e])return!1}return!0}get isDiag(){if(!this.isSquare)return!1;const t=this.rows;for(let e=0;e<t;e++)for(let s=e+1;s<t;s++)if(0!==this.arr[e][s]||0!==this.arr[s][e])return!1;return!0}get isOrtho(){return!!this.isSquare&&(this.isDiag&&(1==this.det||-1==this.det))}get isIdemp(){if(!this.isSquare)return!1;const t=this.rows,e=this.arr,s=[];for(let r=0;r<t;r++){s[r]=[];for(let n=0;n<t;n++){let i=0;for(let s=0;s<t;s++)i+=e[r][s]*e[s][n];s[r][n]=i}}for(let r=0;r<t;r++)for(let n=0;n<t;n++)if(s[r][n]!==e[r][n])return!1;return!0}get isUpperTri(){if(!this.isSquare)return!1;const t=this.rows;for(let e=1;e<t;e++)for(let t=0;t<e;t++)if(0!==this.arr[e][t])return!1;return!0}get isLowerTri(){if(!this.isSquare)return!1;const t=this.rows;for(let e=0;e<t-1;e++)for(let s=e+1;s<t;s++)if(0!==this.arr[e][s])return!1;return!0}map(t,e,s,r){return this.arr=tt(this.arr,t,e,s,r),this}lerp(t,e){return this.arr=Q(this.arr,t,e),this}norm(t,e){return this.arr=X(this.arr,t,e),this}clamp(t,e){return this.arr=et(this.arr,t,e),this}static map(t,e,s,r,n){return t.clone().map(e,s,r,n)}static lerp(t,e,s){return t.clone().lerp(e,s)}static norm(t,e,s){return t.clone().norm(e,s)}static clamp(t,e,s){return t.clone().clamp(e,s)}toPrecision(t){for(let e=0;e<this.cols;e++)for(let s=0;s<this.rows;s++)this.arr[e][s]=+this.arr[e][s].toPrecision(t);return this}max2min(){let t=this.arr.flat(1).max2min;return new ts(this.rows,this.cols,t)}min2max(){let t=this.arr.flat(1).min2max;return new ts(this.rows,this.cols,t)}sortRows(t=void 0){let e=this.arr.map((e=>e.sort(t))).flat(1);return new ts(this.rows,this.cols,e)}sortCols(t=void 0){let e=this.T.arr.map((e=>e.sort(t))).flat(1);return new ts(this.rows,this.cols,e).T}filterByRows(t){var e=this.arr.map((e=>e.map((e=>+(""+e).includes(t))))).map((t=>!!Logic.or(...t))),s=this.arr.filter(((t,s)=>!0===e[s]));return 0===s.length&&s.push([]),console.log(s),new ts(s)}filterByCols(t){return new ts(this.T.arr.filter((e=>e.includes(t))))}sortAll(t=void 0){let e=this.arr.flat(1).sort(t);return new ts(this.rows,this.cols,e)}count(t){return this.arr.flat(1).count(t)}splice(t,e,s,...r){}getRows(t,e=t+1){return this.slice(t,0,e,this.cols)}getCols(t,e=t+1){return this.slice(0,t,this.rows,e)}static getRows(t,e,s=e+1){return t.slice(e,0,s,t.cols)}static getCols(t,e,s=e+1){return t.slice(0,e,t.rows,s)}add(...t){for(let s=0;s<t.length;s++){("number"==typeof t[s]||t[s]instanceof pt)&&(t[s]=ts.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=B(this.arr[r][e],t[s].arr[r][e])}return new ts(this.rows,this.cols,this.arr.flat(1))}sub(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=ts.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=W(this.arr[r][e],t[s].arr[r][e])}return new ts(this.rows,this.cols,this.arr.flat(1))}static add(t,...e){return t.clone().add(...e)}static sub(t,...e){return t.clone().sub(...e)}mul(...t){for(let r=0;r<t.length;r++){"number"==typeof t[r]&&(t[r]=ts.nums(this.rows,this.cols,t[r]));for(var e=0;e<this.rows;e++)for(var s=0;s<this.cols;s++)this.arr[e][s]=H(this.arr[e][s],t[r].arr[e][s])}return new ts(this.rows,this.cols,this.arr.flat(1))}div(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=ts.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=V(this.arr[r][e],t[s].arr[r][e])}return new ts(this.rows,this.cols,this.arr.flat(1))}static div(t,...e){return t.clone().div(...e)}static mul(t,...e){return t.clone().mul(...e)}modulo(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=ts.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=G(this.arr[r][e],t[s].arr[r][e])}return new ts(this.rows,this.cols,this.arr.flat(1))}static modulo(t,...e){return t.clone().modulo(...e)}dot(t){for(var e=[],s=0;s<this.arr.length;s++){e[s]=[];for(var r=0;r<t.arr[0].length;r++){e[s][r]=0;for(var n=0;n<this.arr[0].length;n++)e[s][r]=B(e[s][r],H(this.arr[s][n],t.arr[n][r]))}}return new ts(this.arr.length,t.arr[0].length,e.flat(1))}static dot(t,e){return t.dot(e)}pow(t){let e=this.clone(),s=this.clone();for(let r=0;r<t-1;r++)s=s.dot(e);return s}static pow(t,e){return t.clone().pow(e)}get somme(){let t=0;for(let e=0;e<this.rows;e++)for(let s=0;s<this.cols;s++)t+=this.arr[e][s];return t}get hasComplex(){return this.arr.flat(1/0).some((t=>t instanceof pt))}get min(){this.hasComplex&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(x(...this.arr[e]));return x(...t)}get max(){this.hasComplex&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(E(...this.arr[e]));return E(...t)}get minRows(){this.hasComplex&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(x(...this.arr[e]));return t}get maxRows(){this.hasComplex&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(E(...this.arr[e]));return t}get minCols(){return this.hasComplex&&console.error("Complex numbers are not comparable"),this.T.minRows}get maxCols(){return this.hasComplex&&console.error("Complex numbers are not comparable"),this.T.maxRows}static fromVector(t){return new ts(t.length,1,t)}get toArray(){let t=[];for(let e=0;e<this.rows;e++)for(let s=0;s<this.cols;s++)t.push(this.arr[e][s]);return t}get serialize(){return JSON.stringify(this)}static deserialize(t){"string"==typeof t&&(t=JSON.parse(t));let e=new ts(t.rows,t.cols);return e.arr=t.arr,e}sortTable(t=0,{type:e="num",order:s="asc"}={}){var r=this.T.arr.map((t=>t.map(((t,e)=>Object.assign({},{x:t,y:e}))))),n=this.T.arr.map((t=>t.map(((t,e)=>Object.assign({},{x:t,y:e})))));"num"===e?"asc"===s?r[t].sort(((t,e)=>t.x-e.x)):"desc"===s?r[t].sort(((t,e)=>e.x-t.x)):"toggle"===s&&(r[t][0].x>r[t][1].x?r[t].sort(((t,e)=>e.x-t.x)):r[t].sort(((t,e)=>t.x-e.x))):"alpha"===e&&("asc"===s?r[t].sort(((t,e)=>(""+t.x).localeCompare(""+e.x))):"desc"===s&&r[t].sort(((t,e)=>(""+e.x).localeCompare(""+t.x)))),s=r[t].map((t=>t.y));for(let e=0;e<r.length;e++)e!==t&&r[e].map(((t,e)=>t.y=s[e]));for(let e=0;e<r.length;e++)e!==t&&n[e].map(((t,n)=>t.x=r[e][s[n]].x));n[t]=r[t];var i=n.map((t=>t.map((t=>t.x))));return new ts(i).T}}const es={_mode:Number,_map:function(t,e,s){return e instanceof ts?new ts(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof pt?new pt(t(e.a,s),t(e.b,s)):e instanceof Array?e.map((e=>t(e,s))):void 0},dec2base(t,e){return this._mode=e<=10?Number:String,"number"==typeof t?this._mode((t>>>0).toString(e)):this._map(this.dec2base,t,e)},dec2bin(t){return this.dec2base(t,2)},dec2oct(t){return this.dec2base(t,8)},dec2hex(t){return this.dec2base(t,16)},bin2base(t,e){return this.dec2base(this.bin2dec(t),e)},bin2dec(t){return this._mode("0b"+t)},bin2oct(t){return this.bin2base(t,8)},bin2hex(t){return this.bin2base(t,16)},oct2dec(t){return this._mode("0o"+t)},oct2bin(t){return this.dec2bin(this.oct2dec(t))},oct2hex(t){return this.dec2hex(this.oct2dec(t))},oct2base(t,e){return this.dec2base(this.oct2dec(t),e)},hex2dec(t){return this._mode("0x"+t)},hex2bin(t){return this.dec2bin(this.hex2dec(t))},hex2oct(t){return this.dec2oct(this.hex2dec(t))},hex2base(t,e){return this.dec2base(this.hex2dec(t),e)},IEEE32toDec(t){let e=t.split(" ").join("").padEnd(32,"0"),s=e[0],r=2**(+("0b"+e.slice(1,9))-127);return(-1)**s*(1+e.slice(9,32).split("").map((t=>+t)).map(((t,e)=>t*2**(-e-1))).reduce(((t,e)=>t+e),0))*r},IEEE64toDec(t){let e=t.split(" ").join("").padEnd(64,"0"),s=e[0],r=2**(+("0b"+e.slice(1,12))-1023);return(-1)**s*(1+e.slice(13,64).split("").map((t=>+t)).map(((t,e)=>t*2**(-e-1))).reduce(((t,e)=>t+e),0))*r}},ss={_mode:Number,_map:function(t,e,s){return e instanceof ts?new ts(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof pt?new pt(t(e.a,s),t(e.b,s)):e instanceof Array?e.map((e=>t(e,s))):void 0},not:function(t){return["number","boolean"].includes(typeof t)?ss._mode(!t):this._map(this.not,t)},and:function(t,...e){return["number","boolean"].includes(typeof t)?ss._mode(e.reduce(((t,e)=>t&e),t)):this._map(this.and,t,e)},or:function(t,...e){return["number","boolean"].includes(typeof t)?ss._mode(e.reduce(((t,e)=>t|e),t)):this._map(this.or,t,e)},nand:function(t,...e){return this.not(this.and(t,e))},nor:function(t,...e){return this.not(this.or(t,e))},xor:function(t,...e){let s=[t,...e];return["number","boolean"].includes(typeof t)?this._mode(1===s.reduce(((t,e)=>(1==+e&&(t+=1),t)),0)):this._map(this.xor,t,e)},xnor:function(t,...e){return ss.not(ss.xor(t,e))}};class rs{static withDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((r,n)=>{this.withDiscount(t.slice(n),e-1).forEach((t=>{s.push([r].concat(t))}))})),s}static withoutDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((r,n)=>{this.withoutDiscount(t.slice(n+1),e-1).forEach((t=>{s.push([r].concat(t))}))})),s}}const{PI:ns,sqrt:is,cos:os,sin:as,acos:cs,pow:hs}=Math,ls=t=>t,us=(t,e=7.5625,s=2.75)=>t<1/s?e*t*t:t<2/s?e*(t-=1.5/s)*t+.75:t<2.5/s?e*(t-=2.25/s)*t+.9375:e*(t-=2.625/s)*t+.984375;class fs{constructor(t,{ease:e=ls,step:s=50,t0:r=0,start:n=!0,duration:i=3e3}={}){this.callback=t,this.state={isRunning:!1,animationId:null,startTime:null,ease:e,step:s,autoStart:n,duration:i},this.t=0,this.tx=0,this.ty=0,this.i=0,this.state.autoStart&&this.start()}#h=()=>{this.t+=this.state.step,this.i++,this.tx=tt(this.t,0,this.state.duration,0,1),this.ty=this.state.ease(this.tx),this.callback(this),this.t>=this.state.duration&&(clearInterval(this.state.animationId),this.state.isRunning=!1)};#l(t=!0){return this.state.isRunning||(t&&this.reset(!1),this.state.isRunning=!0,this.state.startTime=Date.now(),this.state.animationId=setInterval(this.#h,this.state.step)),this}start(){return this.#l(!0)}pause(){return this.state.isRunning&&(clearInterval(this.state.animationId),this.state.isRunning=!1),this}resume(){return this.#l(!1)}stop(){return this.pause(),this.reset(!1),this}reset(t=!0){return this.t=0,this.tx=0,this.ty=0,this.i=0,t&&this.start(),this}}class ms{constructor(t,e,s=1/0,r){this.ms=e,this.fn=t,this.count=s,this.frame=1,this.id=null,this.running=!1,r&&this.start()}start(){return this.running||(this.running=!0,this.frame=1,this.id=setInterval((()=>{this.frame>this.count?this.stop():(this.fn.call(null,this),this.frame++)}),this.ms)),this}stop(){return this.running&&(this.running=!1,clearInterval(this.id),this.id=null),this}isRunning(){return this.running}}class ps extends ms{constructor(t=1e3/60){super(t,(()=>this._tick())),this.elapsed=0,this._lastTime=performance.now(),this._callbacks=new Set}_tick(){const t=performance.now(),e=t-this._lastTime;this.elapsed+=e,this._lastTime=t;for(const t of this._callbacks)t({elapsed:this.elapsed,delta:e})}onTick(t){return this._callbacks.add(t),()=>this._callbacks.delete(t)}reset(){this.elapsed=0,this._lastTime=performance.now()}pause(){super.stop()}resume(){this._lastTime=performance.now(),super.start()}}class ds{constructor(t=[],{repeat:e=1,loop:s=!1}={}){this.tasks=t,this.repeat=e,this.loop=s,this.stopped=!1,this.running=!1,this.onStart=null,this.onTask=null,this.onEnd=null}async run(){if(this.running)return;this.running=!0,this.stopped=!1,this.onStart&&this.onStart();let t=this.repeat;do{for(const t of this.tasks){if(this.stopped)return;if(Array.isArray(t))await Promise.all(t.map((({fn:t,delay:e=0})=>new Promise((async s=>{e>0&&await new Promise((t=>setTimeout(t,e))),this.onTask&&this.onTask(t),await t(),s()})))));else{const{fn:e,delay:s=0}=t;s>0&&await new Promise((t=>setTimeout(t,s))),this.onTask&&this.onTask(e),await e()}}}while(this.loop&&!this.stopped&&(t===1/0||t-- >1));!this.stopped&&this.onEnd&&this.onEnd(),this.running=!1}stop(){this.stopped=!0,this.running=!1}addTask(t){this.tasks.push(t)}clearTasks(){this.tasks=[]}}class gs{constructor(t,{step:e=1e3,t0:s=0,t1:r=1/0,autoplay:n=!0}={}){this.callback=t,this.cache={isRunning:!1,id:null,last_tick:null,step:e,t0:s,t1:r,autoplay:n,pauseTime:null,frame:0},n&&(s?this.startAfter(s):this.start(),r!==1/0&&this.stopAfter(r))}get frame(){return this.cache.frame}get elapsed(){return this.cache.elapsed}start(){return this.cache.isRunning||(this.cache.frame=0,this.cache.isRunning=!0,this.cache.last_tick=Date.now(),this.animate()),this}pause(){return this.cache.isRunning&&(clearTimeout(this.cache.id),this.cache.isRunning=!1,this.cache.pauseTime=Date.now()),this}resume(){if(!this.cache.isRunning){if(this.cache.isRunning=!0,this.cache.pauseTime){const t=Date.now()-this.cache.pauseTime;this.cache.last_tick+=t}this.animate()}return this}stop(){return this.pause(),this.cache.frame=0,this}startAfter(t=1e3){return setTimeout((()=>this.start()),t),this}stopAfter(t=1e3){return setTimeout((()=>this.stop()),t),this}animate=()=>{if(this.cache.isRunning){const t=Date.now(),e=t-this.cache.last_tick;e>=this.cache.step&&(this.cache.elapsed=t-(this.cache.t0||0),this.callback(this),this.cache.frame++,this.cache.last_tick=t-e%this.cache.step),this.cache.id=setTimeout(this.animate,0)}}}class bs{constructor({head:t=null,wrapper:e=null,target:s=null}){this.head=t,this.wrapper=e,this.target=s,this.init()}get isZikoApp(){return!0}init(){this.head&&this.setHead(this.head),this.wrapper&&this.setWrapper(this.wrapper),this.target&&this.setTarget(this.target),this.wrapper&&this.target&&this.wrapper.mount(this.target)}setTarget(t){return t instanceof HTMLElement?this.target=t:"string"==typeof t&&(this.target=globalThis?.document?.querySelector(t)),this}setWrapper(t){return t?.isUIElement?this.wrapper=t:"function"==typeof t&&(this.wrapper=t()),this}}function ws(t){return/:\w+/.test(t)}class ys extends bs{constructor({head:t,wrapper:e,target:s,routes:r}){super({head:t,wrapper:e,target:s}),this.routes=new Map([["404",Ht("Error 404")],...Object.entries(r)]),this.clear(),globalThis.onpopstate=this.mount(location.pathname)}clear(){return[...this.routes].forEach((t=>{!ws(t[0])&&t[1]?.isUIElement&&t[1].unmount()})),this}mount(t){const[e,s]=[...this.routes].find((e=>function(t,e){const s=t.split("/"),r=e.split("/");if(s.length!==r.length)return!1;for(let t=0;t<s.length;t++){const e=s[t],n=r[t];if(!e.startsWith(":")&&e!==n)return!1}return!0}(e[0],t)));let r;if(ws(e)){const n=function(t,e){const s=t.split("/"),r=e.split("/"),n={};if(s.length!==r.length)return n;for(let t=0;t<s.length;t++){const e=s[t],i=r[t];if(e.startsWith(":"))n[e.slice(1)]=i;else if(e!==i)return{}}return n}(e,t);r=s.call(this,n)}else s?.isUIElement&&s.mount(this.wrapper),"function"==typeof s&&(r=s());return r?.isUIElement&&r.mount(this.wrapper),r instanceof Promise&&r.then((t=>t.mount(this.wrapper))),globalThis.history.pushState({},"",t),this}}const vs=({head:t,wrapper:e,target:s,routes:r})=>new ys({head:t,wrapper:e,target:s,routes:r});function _s(t,e="./src/pages",s=["js","ts"]){"/"===e.at(-1)&&(e=e.slice(0,-1));const r=t.replace(/\\/g,"/").replace(/\[(\w+)\]/g,"$1/:$1").split("/"),n=e.split("/"),i=r.indexOf(n.at(-1));if(-1!==i){const t=r.slice(i+1),e=r.at(-1),n="index.js"===e||"index.ts"===e,o=s.some((t=>e===`.${t}`||e.endsWith(`.${t}`)));if(n)return"/"+(t.length>1?t.slice(0,-1).join("/"):"");if(o)return"/"+t.join("/").replace(/\.(js|ts)$/,"")}return""}class xs{#u;#f=new Map;#m=0;constructor(){const t=new Blob(['\n this.onmessage = function(e) {\n const { id, funStr, args, close } = e.data;\n try {\n const func = new Function("return " + funStr)();\n const result = func(...args);\n postMessage({ id, result });\n } catch (error) {\n postMessage({ id, error: error.message });\n } finally {\n if (close) self.close();\n }\n }\n '],{type:"text/javascript"});this.#u=new Worker(URL.createObjectURL(t)),this.#u.addEventListener("message",(t=>{const{id:e,result:s,error:r}=t.data,n=this.#f.get(e);n&&(n(s,r),this.#f.delete(e))}))}call(t,e,s=[],r=!0){if("function"!=typeof t)throw new TypeError("func must be a function");const n=++this.#m;return this.#f.set(n,e),this.#u.postMessage({id:n,funStr:t.toString(),args:s,close:r}),this}terminate(){this.#u.terminate()}}class Es{constructor(t=10){this.events={},this.maxListeners=t}on(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this.events[t].length>this.maxListeners&&console.warn(`Warning: Possible memory leak. Event '${t}' has more than ${this.maxListeners} listeners.`),this}once(t,e){const s=(...r)=>{this.off(t,s),e(...r)};return this.on(t,s)}off(t,e){const s=this.events[t];if(!s)return this;const r=s.indexOf(e);return-1!==r&&s.splice(r,1),this}emit(t,e){const s=this.events[t];return!!s&&([...s].forEach((s=>{try{s(e)}catch(e){console.error(`Error in listener for '${t}':`,e)}})),!0)}remove(t){return delete this.events[t],this}clear(){return this.events={},this}setMaxListeners(t){return this.maxListeners=t,this}}const ks=t=>new Es(t);class Cs{#p;#d;#g=null;constructor(t=[],e=(()=>{})){this.#p=t,this.#d=e,this.#o()}#b(){return this.#p.some((({query:t})=>globalThis.matchMedia(t).matches))}#o(){this.#p.forEach((({query:t,callback:e})=>{const s=globalThis.matchMedia(t),r=()=>{const t=this.#b();s.matches?(e(),this.#g=e):t||this.#g===this.#d||(this.#d(),this.#g=this.#d)};r(),s.addEventListener("change",r)}))}}class As{constructor(t=document.title,e=!0){this.cache={emitter:null},e&&this.useEventEmitter(),this.set(t)}useEventEmitter(){return this.cache.emitter=ks(),this}setTitle(t){return t!==document.title&&(document.title=t,this.cache.emitter&&this.cache.emitter.emit("ziko:title-changed",t)),this}get current(){return document.title}onChange(t){return this.cache.emitter&&this.cache.emitter.on("ziko:title-changed",t),this}}class Ms{constructor(t,{namespace:e="Ziko",ValidateCssProps:s=!1}={}){this.currentPropsMap=t,this.namespace=e,this.ValidateCssProps=s,this.use(t)}use(t){return this.ValidateCssProps&&function(t){const e=new Set(Object.keys(document.documentElement.style));for(const s in t)if(!e.has(s))throw new Error(`Invalid CSS property: "${s}"`)}(t),this.currentPropsMap=t,this.#a(),this}#a(){const t=globalThis?.document?.documentElement?.style;for(const e in this.currentPropsMap){const s=this.namespace?`--${this.namespace}-${e}`:`--${e}`;t.setProperty(s,this.currentPropsMap[e]),Object.defineProperty(this,e,{value:`var(${s})`,writable:!0,configurable:!0,enumerable:!1})}}}let{sqrt:Ts,cos:Ss,sin:Os,exp:js,log:Ps,cosh:Is,sinh:Ds}=Math;for(const t of Object.getOwnPropertyNames(Math)){const e=Math[t];"function"==typeof e&&(Math[t]=new Proxy(e,{apply(e,s,r){const n=r[0];if("number"==typeof n||0===r.length)return e.apply(s,r);if(n?.isComplex?.()){const{a:t,b:i,z:o,phi:a}=n,c=(t,e)=>new n.constructor(t,e);switch(e.name){case"abs":return n.z;case"sqrt":return c(Ts(o)*Ss(a/2),Ts(o)*Os(a/2));case"log":return c(Ps(o),a);case"exp":return c(js(t)*Ss(i),js(t)*Os(i));case"cos":return c(Ss(t)*Is(i),-Os(t)*Ds(i));case"sin":return c(Os(t)*Is(i),Ss(t)*Ds(i));case"tan":{const e=Ss(2*t)+Is(2*i);return c(Os(2*t)/e,Ds(2*i)/e)}case"cosh":return c(Is(t)*Ss(i),Ds(t)*Os(i));case"sinh":return c(Ds(t)*Ss(i),Is(t)*Os(i));case"tanh":{const e=Is(2*t)+Ss(2*i);return c(Ds(2*t)/e,Os(2*i)/e)}default:return e.apply(s,r)}}throw new TypeError(`Math.${t} expects only numbers`)}}))}globalThis?.document&&document?.addEventListener("DOMContentLoaded",__Ziko__.__Config__.init()),t.App=({head:t,wrapper:e,target:s})=>new bs({head:t,wrapper:e,target:s}),t.Base=es,t.Clock=ps,t.Combinaison=rs,t.Complex=pt,t.E=s,t.EPSILON=r,t.FileBasedRouting=async function(t){const e=Object.keys(t),s=function(t){if(0===t.length)return"";const e=t.map((t=>t.split("/"))),s=Math.min(...e.map((t=>t.length)));let r=[];for(let t=0;t<s;t++){const s=e[0][t];if(!e.every((e=>e[t]===s||e[t].startsWith("["))))break;r.push(s)}return r.join("/")+(r.length?"/":"")}(e),r={};for(let n=0;n<e.length;n++){const i=await t[e[n]](),o=await i.default;Object.assign(r,{[_s(e[n],s)]:o})}return vs({target:document.body,routes:{"/":()=>{},...r},wrapper:Pe.section()})},t.Flex=(...t)=>{let e="div";return"string"==typeof t[0]&&(e=t[0],t.pop()),new Ie(e).append(...t)},t.HTMLWrapper=t=>new qe(t),t.Logic=ss,t.Matrix=ts,t.PI=e,t.Permutation=class{static withDiscount(t,e=t.length){if(1===e)return t.map((t=>[t]));const s=[];let r;return r=this.withDiscount(t,e-1),t.forEach((t=>{r.forEach((e=>{s.push([t].concat(e))}))})),s}static withoutDiscount(t){if(1===t.length)return t.map((t=>[t]));const e=[],s=this.withoutDiscount(t.slice(1)),r=t[0];for(let t=0;t<s.length;t++){const n=s[t];for(let t=0;t<=n.length;t++){const s=n.slice(0,t),i=n.slice(t);e.push(s.concat([r],i))}}return e}},t.Random=class{static float(t=1,e){return e?Math.random()*(e-t)+t:t*Math.random()}static int(t,e){return Math.floor(this.float(t,e))}static char(t){t=t??this.bool();const e=String.fromCharCode(this.int(97,120));return t?e.toUpperCase():e}static bool(){return[!1,!0][Math.floor(2*Math.random())]}static string(t,e){return t instanceof Array?new Array(this.int(...t)).fill(0).map((()=>this.char(e))).join(""):new Array(t).fill(0).map((()=>this.char(e))).join("")}static bin(){return this.int(2)}static oct(){return this.int(8)}static dec(){return this.int(8)}static hex(){return this.int(16)}static choice(t=[1,2,3],e=new Array(t.length).fill(1/t.length)){let s=new Array(100);e=mt.accum(...e).map((t=>100*t)),s.fill(t[0],0,e[0]);for(let r=1;r<t.length;r++)s.fill(t[r],e[r-1],e[r]);return s[this.int(s.length-1)]}static shuffleArr(t){return t.sort((()=>.5-Math.random()))}static floats(t,e,s){return new Array(t).fill(0).map((()=>this.float(e,s)))}static ints(t,e,s){return new Array(t).fill(0).map((()=>this.int(e,s)))}static bools(t){return new Array(t).fill(0).map((()=>this.bool()))}static bins(t){return new Array(t).fill(0).map((()=>this.int(2)))}static octs(t){return new Array(t).fill(0).map((()=>this.int(8)))}static decs(t){return new Array(t).fill(0).map((()=>this.int(10)))}static hexs(t){return new Array(t).fill(0).map((()=>this.int(16)))}static choices(t,e,s){return new Array(t).fill(0).map((()=>this.choice(e,s)))}static perm(...t){return t.permS[this.int(t.length)]}static color(){return"#"+es.dec2hex(this.float(16777216)).padStart(6,0)}static colors(t){return new Array(t).fill(null).map((()=>this.color()))}},t.SPA=vs,t.SVGWrapper=t=>new Ue(t),t.Scheduler=(t,{repeat:e=null}={})=>new ds(t,{repeat:e}),t.Suspense=(t,e)=>new Le(t,e),t.Switch=({key:t,cases:e})=>new Ne(t,e),t.Tick=ms,t.TimeAnimation=fs,t.TimeLoop=gs,t.TimeScheduler=ds,t.UIElement=Te,t.UIHTMLWrapper=qe,t.UINode=At,t.UISVGWrapper=Ue,t.UISwitch=Ne,t.UIView=Se,t.UseRoot=Ms,t.UseThread=xs,t.Utils=mt,t.View=(...t)=>new Se(...t),t.ZikoApp=bs,t.ZikoEvent=ee,t.ZikoSPA=ys,t.ZikoUIFlex=Ie,t.ZikoUISuspense=Le,t.ZikoUIText=Wt,t.abs=C,t.accum=k,t.acos=(...t)=>y(w.acos,...t),t.acosh=(...t)=>y(w.acosh,...t),t.acot=(...t)=>y(w.acot,...t),t.add=B,t.animation=(t,{ease:e,t0:s,t1:r,start:n,duration:i}={})=>new fs(t,{ease:e,t0:s,t1:r,start:n,duration:i}),t.arange=st,t.arc=t=>1-as(cs(t)),t.arr2str=Ge,t.asin=(...t)=>y(w.asin,...t),t.asinh=(...t)=>y(w.asinh,...t),t.atan=(...t)=>y(w.atan,...t),t.atan2=F,t.atanh=(...t)=>y(w.atanh,...t),t.back=(t,e=1)=>t**2*((e+1)*t-e),t.bind_click_event=ue,t.bind_clipboard_event=fe,t.bind_drag_event=me,t.bind_focus_event=pe,t.bind_key_event=de,t.bind_mouse_event=ge,t.bind_pointer_event=be,t.bind_swipe_event=ve,t.bind_touch_event=(t,e)=>new oe("touch",t,Yt.Touch,ie,e),t.bind_view_event=ye,t.bind_wheel_event=we,t.cartesianProduct=lt,t.ceil=(...t)=>y(Math.ceil,...t),t.clamp=et,t.clock=t=>new ps(t),t.combinaison=(t,e,s=!1)=>rs[s?"withDiscount":"withoutDiscount"](t,e),t.complex=dt,t.cos=j,t.cosh=D,t.cot=(...t)=>y(w.cot,...t),t.coth=(...t)=>y(w.coth,...t),t.csc=(...t)=>y(w.csc,...t),t.csv2arr=bt,t.csv2json=(t,e=",")=>JSON.stringify(wt(t,e)),t.csv2matrix=(t,e=",")=>new ts(bt(t,e)),t.csv2object=wt,t.csv2sql=(t,e)=>{const s=t.trim().trimEnd().split("\n").filter((t=>t));let r=`INSERT INTO ${e} (${s[0].split(",").join(", ")}) Values `,n=[];for(let t=1;t<s.length;t++){const e=s[t].split(",");n.push(`(${e})`)}return r+n.join(",\n")},t.debounce=(t,e=1e3)=>(...s)=>setTimeout((()=>t(...s)),e),t.defineParamsGetter=function(t){Object.defineProperties(t,{QueryParams:{get:function(){return function(t){const e={};return t.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi,(t=>{const[s,r]=t.split("=");e[s]=r})),e}(globalThis.location.search.substring(1))},configurable:!1,enumerable:!0},HashParams:{get:function(){return globalThis.location.hash.substring(1).split("#")},configurable:!1,enumerable:!0}})},t.define_wc=function(t,e,s={},{mode:r="open"}={}){globalThis.customElements?.get(t)?console.warn(`Custom element "${t}" is already defined`):-1!==t.search("-")?globalThis.customElements?.define(t,class extends HTMLElement{static get observedAttributes(){return["style",...Object.keys(s)]}constructor(){super(),this.attachShadow({mode:r}),this.props={},this.mask={...s}}connectedCallback(){this.render()}render(){this.shadowRoot.innerHTML="";const t=e(this.props);t instanceof Array?t.forEach((t=>t.mount(this.shadowRoot))):t.mount(this.shadowRoot)}attributeChangedCallback(t,e,s){Object.assign(this.props,{[t]:this.mask[t].type(s)}),this.render()}}):console.warn(`"${t}" is not a valid custom element name`)},t.deg2rad=ot,t.discret=(t,e=5)=>Math.ceil(t*e)/e,t.div=V,t.e=S,t.elastic=t=>-2*hs(2,10*(t-1))*os(20*ns*t/3*t),t.event_controller=Xt,t.fact=(...t)=>y((t=>{let e,s=1;if(0==t)s=1;else if(t>0)for(e=1;e<=t;e++)s*=e;else s=NaN;return s}),...t),t.floor=z,t.geomspace=it,t.getEvent=te,t.hypot=$,t.inRange=ct,t.in_back=(t,e=1.70158,s=e+1)=>s*hs(t,3)-e*t**2,t.in_bounce=(t,e=7.5625,s=2.75)=>1-us(1-t,e,s),t.in_circ=t=>1-is(1-t**2),t.in_cubic=t=>t**3,t.in_elastic=(t,e=2*ns/3)=>0===t?0:1===t?1:-hs(2,10*t-10)*as((10*t-10.75)*e),t.in_expo=t=>0===t?0:2**(10*t-10),t.in_out_back=(t,e=1.70158,s=1.525*e)=>t<.5?hs(2*t,2)*(2*(s+1)*t-s)/2:(hs(2*t-2,2)*((s+1)*(2*t-2)+s)+2)/2,t.in_out_bounce=(t,e=7.5625,s=2.75)=>t<.5?us(1-2*t,e,s)/2:us(2*t-1,e,s)/2,t.in_out_circ=t=>t<.5?(1-is(1-(2*t)**2))/2:(is(1-(-2*t+2)**2)+1)/2,t.in_out_cubic=t=>t<.5?4*t**3:1-(-2*t+2)**3/2,t.in_out_elastic=(t,e=2*ns/4.5)=>0===t?0:1===t?1:t<.5?-hs(2,20*t-10)*as((20*t-11.125)*e)/2:hs(2,-20*t+10)*as((20*t-11.125)*e)/2+1,t.in_out_expo=t=>0===t?0:1===t?1:t<.5?2**(20*t-10)/2:(2-2**(-20*t+10))/2,t.in_out_quad=t=>t<.5?2*t**2:1-(-2*t+2)**2/2,t.in_out_quart=t=>t<.5?8*t**4:1-(-2*t+2)**4/2,t.in_out_quint=t=>t<.5?16*t**5:1-(-2*t+2)**5/2,t.in_out_sin=t=>-(os(ns*t)-1)/2,t.in_quad=t=>t**2,t.in_quart=t=>t**4,t.in_quint=t=>t**5,t.in_sin=t=>1-os(t*ns/2),t.isApproximatlyEqual=ht,t.isStateGetter=Nt,t.json2arr=t=>yt(t instanceof Object?t:JSON.parse(t)),t.json2css=Ke,t.json2csv=_t,t.json2csvFile=(t,e)=>{const s=_t(t,e),r=new Blob([s],{type:"text/csv;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}},t.json2xml=Ct,t.json2xmlFile=(t,e)=>{const s=Ct(t,e),r=new Blob([s],{type:"text/xml;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}},t.json2yml=kt,t.json2ymlFile=(t,e)=>{const s=kt(t,e),r=new Blob([s],{type:"text/yml;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}},t.lerp=Q,t.linear=ls,t.linspace=rt,t.ln=O,t.logspace=nt,t.loop=(t,e={})=>new gs(t,e),t.map=tt,t.mapfun=y,t.matrix=(t,e,s)=>new ts(t,e,s),t.matrix2=(...t)=>new ts(2,2,t),t.matrix3=(...t)=>new ts(3,3,t),t.matrix4=(...t)=>new ts(4,4,t),t.max=E,t.min=x,t.modulo=G,t.mul=H,t.norm=X,t.nums=Y,t.obj2str=He,t.ones=J,t.out_back=(t,e=1.70158,s=e+1)=>1+s*hs(t-1,3)+e*hs(t-1,2),t.out_bounce=us,t.out_circ=t=>is(1-(t-1)**2),t.out_cubic=t=>1-(1-t)**3,t.out_elastic=(t,e=2*ns/3)=>0===t?0:1===t?1:hs(2,-10*t)*as((10*t-.75)*e)+1,t.out_expo=t=>1===t?1:1-2**(-10*t),t.out_quad=t=>1-(1-t)**2,t.out_quart=t=>1-(1-t)**4,t.out_quint=t=>1-(1-t)**5,t.out_sin=t=>as(t*ns/2),t.pgcd=ut,t.pow=M,t.powerSet=t=>{const e=[],s=2**t.length;for(let r=0;r<s;r+=1){const s=[];for(let e=0;e<t.length;e+=1)r&1<<e&&s.push(t[e]);e.push(s)}return e},t.ppcm=ft,t.preload=gt,t.prod=_,t.rad2deg=at,t.round=(...t)=>y(Math.round,...t),t.sec=(...t)=>y(w.sec,...t),t.sig=(...t)=>y((t=>1/(1+S(-t))),...t),t.sign=(...t)=>y(Math.sign,...t),t.sin=P,t.sinc=(...t)=>y(w.sinc,...t),t.sinh=R,t.sleep=t=>new Promise((e=>setTimeout(e,t))),t.sqrt=A,t.sqrtn=T,t.step=(t,e=5)=>Math.floor(t*e)/e,t.step_fps=t=>1e3/t,t.sub=W,t.subSet=null,t.sum=v,t.svg2ascii=Be,t.svg2img=(t,e=!0)=>Pe.img(We(t)).mount(e),t.svg2imgUrl=We,t.svg2str=Ze,t.tags=Pe,t.tan=I,t.tanh=(...t)=>y(w.tanh,...t),t.text=Ht,t.throttle=ce,t.tick=(t,e,s=1/0,r=!0)=>new ms(t,e,s,r),t.timeTaken=t=>{console.time("timeTaken");const e=t();return console.timeEnd("timeTaken"),e},t.time_memory_Taken=t=>{const e=Date.now(),s=performance.memory.usedJSHeapSize,r=t();return{elapsedTime:Date.now()-e,usedMemory:performance.memory.usedJSHeapSize-s,result:r}},t.timeout=function(t,e){let s;const r=new Promise((r=>{s=setTimeout((()=>{e&&e(),r()}),t)}));return{id:s,clear:()=>clearTimeout(s),promise:r}},t.toggle_event_listener=Qt,t.useDerived=function(t,e){let s=t(...e.map((t=>t().value)));const r=new Set;return e.forEach((n=>{n()._subscribe((()=>{{const n=t(...e.map((t=>t().value)));n!==s&&(s=n,r.forEach((t=>t(s))))}}))})),()=>({value:s,isStateGetter:()=>!0,_subscribe:t=>r.add(t)})},t.useEventEmitter=ks,t.useIPC=It,t.useLocaleStorage=(t,e,s=!0)=>new Dt(localStorage,t,e,s),t.useMediaQuery=(t,e)=>new Cs(t,e),t.useReactive=t=>y((t=>{const e=Ut(t);return{get:e[0],set:e[1]}}),t),t.useRoot=(t,e={})=>new Ms(t,e),t.useSessionStorage=Rt,t.useState=Ut,t.useThread=(t,e,s=[],r=!0)=>(new xs).call(t,e,s,r),t.useTitle=(t,e=!0)=>new As(t,e),t.wait=t=>new Promise((e=>setTimeout(e,t))),t.waitForUIElm=t=>new Promise((e=>{if(t.element)return e(t.element);const s=new MutationObserver((()=>{t.element&&(e(t.element),s.disconnect())}));s.observe(document?.body,{childList:!0,subtree:!0})})),t.waitForUIElmSync=(t,e=2e3)=>{const s=Date.now();for(;Date.now()-s<e;)if(t.element)return t.element},t.zeros=K}));
9
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Ziko={})}(this,(function(t){"use strict";const{PI:e,E:s}=Math,r=Number.EPSILON,n=(t,...e)=>{const s=e.map((e=>{return"object"!=typeof(s=e)&&"function"!=typeof s||null===s||e?.__mapfun__?t(e):e instanceof Array?e.map((e=>n(t,e))):ArrayBuffer.isView(e)?e.map((e=>t(e))):e instanceof Set?new Set(n(t,...e)):e instanceof Map?new Map([...e].map((e=>[e[0],n(t,e[1])]))):e.isMatrix?.()?new e.constructor(e.rows,e.cols,n(e.arr.flat(1))):e instanceof Object?Object.fromEntries(Object.entries(e).map((e=>[e[0],n(t,e[1])]))):void 0;var s}));return 1==s.length?s[0]:s},i=(t,e)=>t.isComplex?.()?new t.constructor(e(t.a),e(t.b)):t.isMatrix?.()?new t.constructor(t.rows,t.cols,t.arr.flat(1).map(e)):(t instanceof Array&&n(e,...t),e(t));class o{constructor(t=0,e=0){t instanceof o?(this.a=t.a,this.b=t.b):"object"==typeof t?"a"in t&&"b"in t?(this.a=t.a,this.b=t.b):"a"in t&&"z"in t?(this.a=t.a,this.b=Math.sqrt(t.z**2-t.a**2)):"a"in t&&"phi"in t?(this.a=t.a,this.b=t.a*Math.tan(t.phi)):"b"in t&&"z"in t?(this.b=t.b,this.a=Math.sqrt(t.z**2-t.b**2)):"b"in t&&"phi"in t?(this.b=e,this.a=t.b/Math.tan(t.phi)):"z"in t&&"phi"in t&&(this.a=+t.z*Math.cos(t.phi).toFixed(15),this.b=+t.z*Math.sin(t.phi).toFixed(15)):"number"==typeof t&&"number"==typeof e&&(this.a=+t.toFixed(32),this.b=+e.toFixed(32))}get __mapfun__(){return!0}isComplex(){return!0}toString(){let t="";return t=0!==this.a?this.b>=0?`${this.a}+${this.b}*i`:`${this.a}-${Math.abs(this.b)}*i`:this.b>=0?`${this.b}*i`:`-${Math.abs(this.b)}*i`,t}clone(){return new o(this.a,this.b)}get z(){return Math.hypot(this.a,this.b)}get phi(){return Math.atan2(this.b,this.a)}static Zero(){return new o(0,0)}get conj(){return new o(this.a,-this.b)}get inv(){return new o(this.a/Math.hypot(this.a,this.b),-this.b/Math.hypot(this.a,this.b))}add(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new o(t[e],0)),this.a+=t[e].a,this.b+=t[e].b;return this}sub(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new o(t[e],0)),this.a-=t[e].a,this.b-=t[e].b;return this}mul(...t){let{z:e,phi:s}=this;for(let r=0;r<t.length;r++)"number"==typeof t[r]&&(t[r]=new o(t[r],0)),e*=t[r].z,s+=t[r].z;return this.a=e*Math.cos(s),this.b=e*Math.sin(s),this}div(...t){let{z:e,phi:s}=this;for(let r=0;r<t.length;r++)"number"==typeof t[r]&&(t[r]=new o(t[r],0)),e/=t[r].z,s-=t[r].z;return this.a=e*Math.cos(s),this.b=e*Math.sin(s),this}modulo(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new o(t[e],0)),this.a%=t[e].a,this.b%=t[e].b;return this}static fromExpo(t,e){return new o(+(t*cos(e)).toFixed(13),+(t*sin(e)).toFixed(13))}get expo(){return[this.z,this.phi]}static add(t,...e){return t.clone().add(...e)}static sub(t,...e){return t.clone().sub(...e)}static mul(t,...e){return t.clone().mul(...e)}static div(t,...e){return t.clone().div(...e)}nthr(t=2){return h({z:this.z**(1/t),phi:this.phi/t})}get sqrt(){return this.nrth(2)}get cbrt(){return this.nrth(3)}get log(){return h(this.z,this.phi)}get cos(){return h(Math.cos(this.a)*Math.cosh(this.b),Math.sin(this.a)*Math.sinh(this.b))}get sin(){return h(Math.sin(this.a)*Math.cosh(this.b),Math.cos(this.a)*Math.sinh(this.b))}get tan(){const t=cos(2*this.a)+cosh(2*this.b);return h(Math.sin(2*this.a)/t,Math.sinh(2*this.b)/t)}}const h=(t,e)=>{if((t instanceof Array||ArrayBuffer.isView(t))&&(e instanceof Array||ArrayBuffer.isView(t)))return t.map(((s,r)=>h(t[r],e[r])));if(t.isMatrix?.()&&e.isMatrix?.()){if(t.shape[0]!==e.shape[0]||t.shape[1]!==e.shape[1])return Error(0);const s=t.arr.map(((s,r)=>h(t.arr[r],e.arr[r])));return new t.constructor(t.rows,t.cols,...s)}return new o(t,e)},c=(...t)=>n((t=>t.isComplex?.()?t.z:Math.abs(t)),...t),l=(...t)=>{const e=t.pop();return n((t=>t.isComplex?.()?e.isComplex?.()?new t.constructor({z:Math.exp(e.a*Math.log(t.z)-e.b*t.phi),phi:e.b*Math.log(t.z)+e.a*t.phi}):new t.constructor({z:t.z**e,phi:t.phi*e}):e.isComplex?.()?new t.constructor({z:Math.exp(e.a*Math.log(t)),phi:e.b*Math.log(t)}):Math.pow(t,e)),...t)},u=(...t)=>n((t=>t.isComplex?.()?new t.constructor({z:t.z**.5,phi:t.phi/2}):t<0?h(0,Math.sqrt(-t)):Math.sqrt(t)),...t),p=(...t)=>{const e=t.pop();if("number"!=typeof e)throw Error("nthr expects a real number n");return n((t=>t.isComplex?.()?new t.constructor({z:t.z**(1/e),phi:t.phi/e}):t<0?e%2==2?h(0,(-t)**(1/e)):-1*(-t)**(1/e):t**(1/e)),...t)},m=(...t)=>n((t=>t.isComplex?.()?new t.constructor(Math.log(t.z),t.phi):Math.log(t)),...t),f=(...t)=>n((t=>t.isComplex?.()?new t.constructor(Math.floor(t.a),Math.floor(t.b)):Math.floor(t)),...t),d=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t+e;if(e.isComplex?.())return e.clone().add(t)}if(t.isComplex?.()&&("number"==typeof e||e.isComplex?.()))return(new t.clone).add(e)},g=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t-e;if(e.isComplex?.())return new e.constructor(t-e.a,e.b)}if(t.isComplex?.()&&("number"==typeof e||e.isComplex?.()))return(new t.clone).sub(e)},w=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t*e;if(e.isComplex?.())return e.clone().mul(t)}if(t.isComplex?.()&&("number"==typeof e||e.isComplex?.()))return(new t.clone).mul(e)},y=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t/e;if(e.isComplex?.())return new e.constructor(t,0).div(e)}if(t.isComplex?.()&&("number"==typeof e||e.isComplex?.()))return(new t.clone).mul(e)},_=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t%e;if(e.isComplex?.())return new e.constructor(t,0).modulo(e)}if(t.isComplex?.()&&("number"==typeof e||e.isComplex?.()))return(new t.clone).modulo(e)},v=(t,...e)=>{let s=t;for(let t=0;t<e.length;t++)s=d(s,e[t]);return s},x=(t,...e)=>{let s=t;for(let t=0;t<e.length;t++)s=g(s,e[t]);return s},M=(t,...e)=>{let s=t;for(let t=0;t<e.length;t++)s=w(s,e[t]);return s},E=(t,...e)=>{let s=t;for(let t=0;t<e.length;t++)s=y(s,e[t]);return s},k=(t,...e)=>{let s=t;for(let t=0;t<e.length;t++)s=_(s,e[t]);return s},C=(t,e,s)=>i(t,(t=>e!==s?(t-e)/(s-e):0)),T=(t,e,s)=>i(t,(t=>(s-e)*t+e)),S=(t,e,s)=>i(t,(t=>Math.min(Math.max(t,e),s))),j=(t,e,s,r,n)=>i(t,(t=>T(C(t,e,s),r,n))),O=(t,e,s=!0)=>{if(t instanceof Array&&!(e instanceof Array))return n((t=>O(t,e,s)),...t);if(e instanceof Array&&!(t instanceof Array))return n((e=>O(t,e,s)),...e);if(t instanceof Array&&e instanceof Array)return t.map(((t,r)=>O(t,e[r],s)));const r=Math.atan2(t,e);return s?r:180*r/Math.PI},A=t=>{const e=new XMLHttpRequest;if(e.open("GET",t,!1),e.send(),200===e.status)return e.responseText;throw new Error(`Failed to fetch data from ${t}. Status: ${e.status}`)};globalThis.fetchdom=async function(t="https://github.com/zakarialaoui10"){try{const e=await fetch(t);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const s=await e.text();return(new DOMParser).parseFromString(s,"text/html").documentElement}catch(t){throw console.error("Failed to fetch DOM:",t),t}},globalThis.fetchdomSync=function(t="https://github.com/zakarialaoui10"){try{const e=A(t);return(new DOMParser).parseFromString(e,"text/html").documentElement}catch(t){throw console.error("Failed to fetch DOM synchronously:",t),t}};const P=(t,e=",")=>t.trim().trimEnd().split("\n").map((t=>t.split(e))),I=(t,e=",")=>{const[s,...r]=P(t,e);return r.map((t=>{const e={};return s.forEach(((s,r)=>{e[s]=t[r]})),e}))},D=t=>t instanceof Array?[Object.keys(t[0]),...t.map((t=>Object.values(t)))]:[Object.keys(t)],R=(t,e)=>D(t).map((t=>t.join(e))).join("\n"),z=(t,e=",")=>R(t instanceof Object?t:JSON.parse(t),e),$=(t,e)=>{const s=[];if(Array.isArray(t))t.forEach((t=>{if("object"==typeof t&&null!==t){s.push(`${e}-`);const r=$(t,`${e} `);s.push(...r)}else s.push(`${e}- ${t}`)}));else for(const r in t)if(t.hasOwnProperty(r)){const n=t[r];if("object"==typeof n&&null!==n){s.push(`${e}${r}:`);const t=$(n,`${e} `);s.push(...t)}else s.push(`${e}${r}: ${n}`)}return s},L=(t,e="")=>$(t,e).join("\n"),q=(t,e)=>L(t instanceof Object?t:JSON.parse(t),e),U=(t,e=1)=>{let s="";for(const r in t)if(t.hasOwnProperty(r)){const n=t[r];s+="\n"+" ".repeat(e)+`<${r}>`,s+="object"==typeof n?U(n,e+2):`${n}`,s+=`</${r}>`}return s.trim()};class N{constructor(t){this.cache={node:t}}isZikoUINode(){return!0}get node(){return this.cache.node}}class F extends Array{constructor(...t){super(...t)}clear(){return this.length=0,this}getItemById(t){return this.find((e=>e.element.id===t))}getItemsByTagName(t){return this.filter((e=>e.element.tagName.toLowerCase()===t.toLowerCase()))}getElementsByClassName(t){return this.filter((e=>e.element.classList?.contains(t)))}querySelector(t){const e=globalThis?.document?.querySelector(t);return e&&this.find((t=>t.element===e))||null}querySelectorAll(t){const e=globalThis?.document?.querySelectorAll(t);return Array.from(e).map((t=>this.find((e=>e.element===t)))).filter(Boolean)}}const Z=new F,B={default:{target:null,render:!0,math:{mode:"deg"}},setDefault:function(t){const e=Object.keys(t),s=Object.values(t);for(let t=0;t<e.length;t++)this.default[e[t]]=s[t]},init:()=>{},renderingMode:"spa",isSSC:!1},W={store:new Map,index:0,register:function(t){this.store.set(this.index++,t)},reset(){this.index=0,this.store.clear()}},H={ui_index:0,get_ui_index:function(){return this.ui_index++},register_ui:function(t){}};class V{#t;#e;#s;#r;#n;#i;constructor(t=""){this.#t=new BroadcastChannel(t),this.#e=new Map,this.#s=new Map,this.#r="ziko-channel:"+1e17*Math.random(),this.#n=new Set([this.#r]),this.#i=new Set,this.#t.addEventListener("message",(t=>{const{last_sent_event:e,userId:s,eventData:r,rooms:n}=t.data;if(s===this.#r)return;if(n&&n.length&&!n.some((t=>this.#i.has(t))))return;this.#n.add(s),this.#e=new Map(r);const i=this.#s.get(e);i&&i.forEach((({fn:t,rooms:s})=>{s&&0!==s.length&&n&&!n.some((t=>s.includes(t)))||t(this.#e.get(e))}))}))}emit(t,e,s){return this.#e.set(t,e),"string"==typeof s&&(s=[s]),this.#t.postMessage({eventData:Array.from(this.#e.entries()),last_sent_event:t,userId:this.#r,rooms:s&&s.length?s:void 0}),this}on(t,e=console.log,s){return this.#s.has(t)||this.#s.set(t,[]),"string"==typeof s&&(s=[s]),this.#s.get(t).push({fn:e,rooms:s}),this}off(t,e){return this.#s.has(t)?(this.#s.set(t,this.#s.get(t).filter((t=>t.fn!==e))),this):this}once(t,e,s){const r=s=>{e(s),this.off(t,r)};return this.on(t,r,s),this}join(...t){return t.forEach((t=>this.#i.add(t))),this}leave(...t){return t.length?t.forEach((t=>this.#i.delete(t))):this.#i.clear(),this}close(){return this.#t.close(),this}}const G=t=>new V(t);class K{constructor(t,e,s,r=!0){this.cache={storage:t,globalKey:e,channel:r?G(`Ziko:useStorage-${e}`):null,oldItemKeys:new Set},this.#o(s,r)}get items(){const t=this.cache.storage.getItem(this.cache.globalKey);if(!t)return{};try{return JSON.parse(t)}catch{return{}}}#a(){const t=this.items;this.cache.oldItemKeys.forEach((t=>delete this[t]));for(const e in t)this[e]=t[e],this.cache.oldItemKeys.add(e)}#o(t,e){if(e&&this.cache.channel&&this.cache.channel.on("Ziko-Storage-Updated",(()=>this.#a())),t)if(this.cache.storage.getItem(this.cache.globalKey)){const t=this.items;Object.keys(t).forEach((t=>this.cache.oldItemKeys.add(t))),this.#a()}else this.set(t);else this.#a()}set(t){return this.cache.storage.setItem(this.cache.globalKey,JSON.stringify(t)),this.cache.channel&&this.cache.channel.emit("Ziko-Storage-Updated",t),this.#a(),this}add(t){return this.set({...this.items,...t}),this}remove(...t){const e={...this.items};return t.forEach((t=>{delete e[t],delete this[t],this.cache.oldItemKeys.delete(t)})),this.set(e),this}get(t){return this.items[t]}clear(){return this.cache.storage.removeItem(this.cache.globalKey),this.cache.oldItemKeys.forEach((t=>delete this[t])),this.cache.oldItemKeys.clear(),this.#a(),this}onStorageUpdated(t){return this.cache.channel&&this.cache.channel.on("Ziko-Storage-Updated",t),this}}const J=(t,e,s=!0)=>new K(sessionStorage,t,e,s);var Y={store:new Map,index:0,session_storage:null,register:function(t){if(!(void 0).SSR&&(void 0).DEV){this.session||(this.session_storage=J("ziko-state",{}));const e=this.session_storage.get(this.index);e?t.value=e:this.session_storage.add({[this.index]:t.value})}this.store.set(this.index++,t)},update:function(t,e){!(void 0).SSR&&(void 0).DEV&&this.session_storage.add({[t]:e})}};function X(){var t;globalThis?.__Ziko__||(globalThis.__Ziko__={__UI__:Z,__HYDRATION__:W,__State__:Y,__Config__:B,__CACHE__:H},t=__Ziko__,Object.defineProperties(t,{QueryParams:{get:function(){return function(t){const e={};return t.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi,(t=>{const[s,r]=t.split("=");e[s]=r})),e}(globalThis.location.search.substring(1))},configurable:!1,enumerable:!0},HashParams:{get:function(){return globalThis.location.hash.substring(1).split("#")},configurable:!1,enumerable:!0}}))}X();class Q extends N{constructor(){super()}init(t,e,s,r){if(this.target=globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body,"string"==typeof t)switch(s){case"html":t=globalThis?.document?.createElement(t);break;case"svg":t=globalThis?.document?.createElementNS("http://www.w3.org/2000/svg",t);break;default:throw Error("Not supported")}else this.target=t?.parentElement;Object.assign(this.cache,{name:e,isInteractive:!1,parent:null,isBody:!1,isRoot:!1,isHidden:!1,isFrozzen:!1,legacyParent:null,attributes:{},filters:{},temp:{}}),this.events={ptr:null,mouse:null,wheel:null,key:null,drag:null,drop:null,click:null,clipboard:null,focus:null,swipe:null,custom:null},this.observer={resize:null,intersection:null},t&&Object.assign(this.cache,{element:t}),this.items=new F,globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this],t&&r&&this?.render?.(),globalThis.__Ziko__.__UI__.push(this)}get element(){return this.cache.element}[Symbol.iterator](){return this.items[Symbol.iterator]()}maintain(){for(let t=0;t<this.items.length;t++)Object.defineProperty(this,t,{value:this.items[t],writable:!0,configurable:!0,enumerable:!1})}isInteractive(){return this.cache.isInteractive}isUIElement(){return!0}}function tt(t,...e){e.forEach((e=>function(t,e){const s=Object.getOwnPropertyDescriptors(e);for(const e of Reflect.ownKeys(s)){const r=s[e];"get"in r||"set"in r||"function"!=typeof r.value?Object.defineProperty(Object.getPrototypeOf(t),e,r):"function"==typeof r.value&&(Object.getPrototypeOf(t).hasOwnProperty(e)||Object.defineProperty(Object.getPrototypeOf(t),e,r))}}(t,e)))}var et=Object.freeze({__proto__:null,mount:function(t=this.target,e=0){return e>0?(setTimeout((()=>this.mount(t,0)),e),this):(this.isBody||(t?.isUIElement&&(t=t.element),this.target=t,this.target?.appendChild(this.element)),this)},unmount:function(t=0){return t>0?(setTimeout((()=>this.unmount(0)),t),this):(this.cache.parent?this.cache.parent.remove(this):this.target?.children?.length&&[...this.target.children].includes(this.element)&&this.target.removeChild(this.element),this)}});function st(t){const{store:e,index:s}=__Ziko__.__State__;__Ziko__.__State__.register({value:t,subscribers:new Set,paused:!1});let r=e.get(s);return[function(){return{value:r.value,isStateGetter:()=>!0,_subscribe:t=>r.subscribers.add(t)}},function(t){r.paused||("function"==typeof t&&(t=t(r.value)),t!==r.value&&(r.value=t,r.subscribers.forEach((t=>t(r.value))),__Ziko__.__State__.update(s,t)))},{pause:()=>{r.paused=!0},resume:()=>{r.paused=!1},clear:()=>{r.subscribers.clear()},force:t=>{"function"==typeof t&&(t=t(r.value)),r.value=t,r.subscribers.forEach((t=>t(r.value)))},getSubscribers:()=>new Set(r.subscribers)}]}globalThis.__Ziko__||X();const rt=t=>"function"==typeof t&&t?.()?.isStateGetter?.(),nt=(t="")=>t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase())),it=(t="")=>{if(0===t.length)return!1;return/^[a-z][a-zA-Z0-9]*$/.test(t)};class ot extends N{constructor(...t){super("span","text",!1,...t),this.element=globalThis?.document?.createTextNode(...t)}isText(){return!0}}const at=(...t)=>new ot(...t);async function ht(t,e,...s){if(this.cache.isFrozzen)return console.warn("You can't append new item to frozzen element"),this;for(let r=0;r<s.length;r++){if(["number","string"].includes(typeof s[r])&&(s[r]=at(s[r])),s[r]instanceof Function){const t=s[r]();t.isStateGetter&&(s[r]=at(t.value),t._subscribe((t=>s[r].element.textContent=t),s[r]))}if("function"==typeof globalThis?.Node&&s[r]instanceof globalThis?.Node&&(s[r]=new this.constructor(s[r])),s[r]?.isZikoUINode)s[r].cache.parent=this,this.element?.[t](s[r].element),s[r].target=this.element,this.items[e](s[r]);else if(s[r]instanceof Promise){const n=await s[r];n.cache.parent=this,this.element?.[t](n.element),n.target=this.element,this.items[e](n)}else s[r]instanceof Object&&(s[r]?.style&&this.style(s[r]?.style),s[r]?.attr&&Object.entries(s[r].attr).forEach((t=>this.setAttr(""+t[0],t[1]))))}return this.maintain(),this}function ct(t,e){if(globalThis.SVGAElement&&this.element instanceof globalThis.SVGAElement&&(t=it(t)?nt(t):t),!this?.attr[t]||this?.attr[t]!==e){if(rt(e)){e()._subscribe((e=>this.element?.setAttribute(t,e)),this)}else this.element?.setAttribute(t,e);Object.assign(this.cache.attributes,{[t]:e})}}var lt=Object.freeze({__proto__:null,getAttr:function(t){return t=is_camelcase(t)?camel2hyphencase(t):t,this.element.attributes[t].value},removeAttr:function(...t){for(let e=0;e<t.length;e++)this.element?.removeAttribute(t[e]);return this},setAttr:function(t,e){if(t instanceof Object){const[s,r]=[Object.keys(t),Object.values(t)];for(let t=0;t<s.length;t++)r[t]instanceof Array&&(e[t]=r[t].join(" ")),ct.call(this,s[t],r[t])}else e instanceof Array&&(e=e.join(" ")),ct.call(this,t,e);return this},setContentEditable:function(t=!0){return this.setAttr("contenteditable",t),this}});var ut=Object.freeze({__proto__:null,after:function(t){return t?.isUIElement&&(t=t.element),this.element?.after(t),this},append:function(...t){return ht.call(this,"append","push",...t),this},before:function(t){return t?.isUIElement&&(t=t.element),this.element?.before(t),this},clear:function(){return this?.items?.forEach((t=>t.unmount())),this.element.innerHTML="",this},insertAt:function(t,...e){if(t>=this.element.children.length)this.append(...e);else for(let s=0;s<e.length;s++)["number","string"].includes(typeof e[s])&&(e[s]=at(e[s])),this.element?.insertBefore(e[s].element,this.items[t].element),this.items.splice(t,0,e[s]);return this},prepend:function(...t){return this.__addItem__.call(this,"prepend","unshift",...t),this},remove:function(...t){const e=t=>{"number"==typeof t&&(t=this.items[t]),t?.isUIElement&&this.element?.removeChild(t.element),this.items=this.items.filter((e=>e!==t))};for(let s=0;s<t.length;s++)e(t[s]);for(let t=0;t<this.items.length;t++)Object.assign(this,{[[t]]:this.items[t]});return this},replaceElementWith:function(t){return this.cache.element.replaceWith(t),this.cache.element=t,this}});const pt={Click:["Click","DblClick","ClickAway"],Ptr:["PtrMove","PtrDown","PtrUp","PtrLeave","PtrEnter","PtrOut","PtrCancel"],Mouse:["MouseMove","MouseDown","MouseUp","MouseEnter","MouseLeave","MouseOut"],Key:["KeyDown","KeyPress","KeyUp"],Clipboard:["Copy","Cut","Paste"],Focus:["focus","blur"],Drag:["Drag","DragStart","DragEnd","Drop"],Wheel:["Wheel"],View:["EnterView","ExitView","ResizeView"],Swipe:["SwipeLeft","SwipeUp","SwipeRight","SwipeDown"]};function mt(t,e,s,r){this.cache.currentEvent=e,this.cache.event=t,s?.call(this),r?.hasOwnProperty("prototype")?r?.call(this):r?.call(null,this),this.cache.preventDefault[e]&&t.preventDefault(),this.cache.stopPropagation[e]&&t.stopPropagation(),this.cache.stopImmediatePropagation[e]&&t.stopImmediatePropagation(),this.cache.callbacks[e]?.(this)}function ft(t,...e){return(0===e.length?Object.keys(this.cache.paused):e).forEach((e=>{this.cache.paused.hasOwnProperty(e)&&(this.targetElement?.[t](e,this.cache.__controllers__[e],this.cache.options[e]),this.cache.paused[e]="removeEventListener"===t)})),this}const dt=(t="")=>t.startsWith("Ptr")?`pointer${t.split("Ptr")[1].toLowerCase()}`:t.toLowerCase();class gt{constructor(t,e=null,s=[],r,n){this.target=e,this.cache={signature:t,currentEvent:null,event:null,options:{},preventDefault:{},stopPropagation:{},stopImmediatePropagation:{},paused:{},callbacks:{},__controllers__:{}},s&&this._register_events(s,r,n)}_register_events(t,e,s,r=!0){const n=t?.map((t=>dt(t)));return n?.forEach(((n,i)=>{this.cache.preventDefault[n]=!1,this.cache.options[n]={},this.cache.paused[n]=!1,this.cache.__controllers__[n]=t=>mt.call(this,t,n,e,s),r&&(this[`on${t[i]}`]=t=>this.__onEvent(n,this.cache.options[n],{},t))})),this}__onEvent(t,e,s,r){return r?(this.cache.callbacks[t]=r,this.__handle(t,this.cache.__controllers__[t],e,s),this):this}get targetElement(){return this.target?.element}get isParent(){return this.target?.element===this.event?.srcElement}get item(){return this.target.find((t=>t.element==this.event?.srcElement))?.[0]}get currentEvent(){return this.cache.currentEvent}get event(){return this.cache.event}get detail(){return this.cache.event.detail}setTarget(t){return this.target=t,this}__handle(t,e,s){return this.targetElement?.addEventListener(t,e,s),this}#h(t,...e){return(0===e.length?Object.keys(this.cache[t]):e).forEach((e=>{this.cache[t].hasOwnProperty(e)&&(this.cache[t][e]=!0)})),this}preventDefault(...t){return this.#h("preventDefault",...t)}stopPropagation(...t){return this.#h("stopPropagation",...t)}stopImmediatePropagation(...t){return this.#h("stopImmediatePropagation",...t)}setEventOptions(t,e){const s=dt(t);return this.pause(),Object.assign(this.cache.options[s],e),this.resume(),this}pause(...t){return ft.call(this,"removeEventListener",...t)}resume(...t){return ft.call(this,"addEventListener",...t)}dispose(){return this.pause(),this.target.events[this.cache.signature]=null,this}}function bt(){switch(this.currentEvent){case"keydown":this.kd=this.event.key;break;case"keypress":this.kp=this.event.key;break;case"keyup":this.ku=this.event.key}}function wt(){const t=this.targetElement.getBoundingClientRect(),e=this.event;let s=e.clientX-t.left|0,r=e.clientY-t.top|0;if(this.cache.useNormalisedCoordinates){const t=this.targetElement.clientWidth,e=this.targetElement.clientHeight;s=+(s/t*2-1).toFixed(8),r=+(r/e*-2+1).toFixed(8)}switch(this.currentEvent){case"pointerdown":this.dx=s,this.dy=r,this.isDown=!0;break;case"pointermove":this.mx=s,this.my=r,this.isMoving=!0;break;case"pointerup":this.ux=s,this.uy=r,this.isDown=!1,this.isMoving=!1}}function yt(){const t=this.targetElement.getBoundingClientRect(),e=this.event;let s=e.clientX-t.left|0,r=e.clientY-t.top|0;if(this.cache.useNormalisedCoordinates){const t=this.targetElement.clientWidth,e=this.targetElement.clientHeight;s=+(s/t*2-1).toFixed(8),r=+(r/e*-2+1).toFixed(8)}switch(this.currentEvent){case"mousedown":this.dx=s,this.dy=r,this.isDown=!0;break;case"mousemove":this.mx=s,this.my=r,this.isMoving=!0;break;case"mouserup":this.ux=s,this.uy=r,this.isDown=!1,this.isMoving=!1}}function _t(){const t=this.event,e=t.touches?.[0]||t.changedTouches?.[0];if(!e)return;const s=this.targetElement.getBoundingClientRect();let r=e.clientX-s.left,n=e.clientY-s.top;if(this.cache.useNormalisedCoordinates){const t=this.targetElement.clientWidth,e=this.targetElement.clientHeight;r=+(r/t*2-1).toFixed(8),n=+(n/e*-2+1).toFixed(8)}switch(this.currentEvent){case"touchstart":this.dx=r,this.dy=n,this.isDown=!0;break;case"touchmove":this.mx=r,this.my=n,this.isMoving=!0;break;case"touchend":this.ux=r,this.uy=n,this.isDown=!1}}class vt extends gt{constructor(t,e=null,s=[],r,n){super(t,e,s,r,n),Object.assign(this.cache,{useNormalisedCoordinates:!1}),this.isDown=!1,this.isMoving=!1,this.dx=0,this.dy=0,this.mx=0,this.my=0,this.ux=0,this.uy=0}get isDragging(){return this.isDown&&this.isMoving}useNormalisedCoordinates(t=!0){return this.cache.useNormalisedCoordinates=t,this}}class xt extends Event{constructor(t,e){super("clickaway",{bubbles:!0,cancelable:!0}),this.originalEvent=t,this.targetElement=e}}const Mt=(t,e)=>{let s=0;return(...r)=>{const n=(new Date).getTime();n-s<e||(s=n,t(...r))}};class Et extends CustomEvent{constructor(t,e,{bubbles:s=!0,cancelable:r=!0}={}){super(t,{detail:e,bubbles:s,cancelable:r})}}class kt extends CustomEvent{constructor(t,e){super(t,{detail:e,bubbles:!0,cancelable:!0})}}const Ct=(t,e)=>(function(t){function e(e){if(!t.contains(e.target)){const s=new xt(e,t);t.dispatchEvent(s)}}console.log(t),globalThis?.document?.addEventListener("click",e)}(t.element),new gt("click",t,pt.Click,null,e)),Tt=(t,e)=>new gt("clipboard",t,pt.Clipboard,null,e),St=(t,e)=>new gt("drag",t,pt.Drag,null,e),jt=(t,e)=>new gt("focus",t,pt.Focus,null,e),Ot=(t,e)=>new gt("key",t,pt.Key,bt,e),At=(t,e)=>new vt("mouse",t,pt.Mouse,yt,e),Pt=(t,e)=>new vt("ptr",t,pt.Ptr,wt,e),It=(t,e)=>new gt("wheel",t,pt.Wheel,null,e),Dt=(t,e)=>(function(t,{intersection:e=!0,resize:s=!0,threshold:r=0,throttleResize:n=100,throttleEnterExit:i=0}={}){let o,a;const h=e=>{for(let s of e){const{width:e,height:r}=s.contentRect;t.dispatchEvent(new Et("resizeview",{width:e,height:r,entry:s}))}},c=n>0?Mt(h,n):h,l=e=>{for(let s of e){const e=s.isIntersecting?"enterview":"exitview";t.dispatchEvent(new Et(e,s))}},u=i>0?Mt(l,i):l;e&&(o=new IntersectionObserver(u,{threshold:r}),o.observe(t)),s&&(a=new ResizeObserver(c),a.observe(t))}(t.element),new gt("view",t,pt.View,null,e)),Rt=(t,e)=>(function(t,e=50,s=100,r=500){let n=0,i=0,o=0,a=!1;function h(t){n=t.clientX,i=t.clientY,o=performance.now(),a=!0}function c(h){if(!a)return;a=!1;const c=h.clientX-n,l=h.clientY-i;let u=null,p=null;performance.now()-o<=r&&(Math.abs(c)>=e&&Math.abs(l)<=s?(u=c<0?"left":"right",p="swipe"+u):Math.abs(l)>=e&&Math.abs(c)<=s&&(u=l<0?"up":"down",p="swipe"+u)),p&&t.dispatchEvent(new kt(p,{direction:u,distX:c,distY:l,originalEvent:h}))}t.addEventListener("pointerdown",h,{passive:!0}),t.addEventListener("pointerup",c,{passive:!0})}(t.element),new gt("swipe",t,pt.Swipe,null,e));class zt extends gt{constructor(t,e,s){super("custom",t,e,$t,s)}_register_events(t){return super._register_events(t,null,null,!1),this}emit(t,e={}){const s=new CustomEvent(t,{detail:e,bubbles:!0,cancelable:!0});return this.targetElement.dispatchEvent(s),this}on(t,...e){return this.cache.options.hasOwnProperty(t)||this._register_events([t]),this.__onEvent(t,this.cache.options[t],{},...e),this}}function $t(){}const Lt=(t,e,s)=>new zt(t,e,s),qt={ptr:Pt,mouse:At,key:Ot,click:Ct,drag:St,clipboard:Tt,focus:jt,wheel:It,view:Dt,swipe:Rt},Ut={on(t,...e){return this.events.custom||(this.events.custom=Lt(this)),this.events.custom.on(t,...e),this},emit(t,e={}){return this.events.custom||(this.events.custom=Lt(this)),this.events.custom.emit(t,e),this}};Object.entries(pt).forEach((([t,e])=>{const s=t.toLowerCase();e.forEach((t=>{const e=`on${t}`;Ut[e]=function(t){return this.events[s]||(this.events[s]=qt[s](this)),this.events[s][e](t),this}}))}));var Nt=Object.freeze({__proto__:null,at:function(t){return this.items.at(t)},find:function(t){return this.items.filter(t)},forEach:function(t){return this.items.forEach(t),this},map:function(t){return this.items.map(t)}});var Ft=Object.freeze({__proto__:null,animate:function(t,{duration:e=1e3,iterations:s=1,easing:r="ease"}={}){return this.element?.animate(t,{duration:e,iterations:s,easing:r}),this},hide:function(){},show:function(){},size:function(t,e){return this.style({width:t,height:e})},style:function(t){if(!this.element?.style)return this;for(let e in t){const s=t[e];if(rt(s)){const t=s();Object.assign(this.element.style,{[e]:t.value}),t._subscribe((t=>{console.log({newValue:t}),Object.assign(this.element.style,{[e]:t})}))}else Object.assign(this.element.style,{[e]:s})}return this}});let Zt=class extends Q{constructor({element:t,name:e="",type:s="html",render:r=__Ziko__.__Config__.default.render}={}){super(),tt(this,et,lt,ut,Ft,Nt,Ut),t&&this.init(t,e,s,r)}get element(){return this.cache.element}isInteractive(){return this.cache.isInteractive}useClient(t){return this.cache.isInteractive||(this.element.setAttribute("data-hydration-index",globalThis.__Ziko__.__HYDRATION__.index),globalThis.__Ziko__.__HYDRATION__.register((()=>this)),this.cache.isInteractive=!0),t&&this.element.setAttribute("data-hydration-directive",t),this}get st(){return this.cache.style}get attr(){return this.cache.attributes}get evt(){return this.events}get html(){return this.element.innerHTML}get text(){return this.element.textContent}get isBody(){return this.element===globalThis?.document.body}get parent(){return this.cache.parent}get width(){return this.element.getBoundingClientRect().width}get height(){return this.element.getBoundingClientRect().height}get top(){return this.element.getBoundingClientRect().top}get right(){return this.element.getBoundingClientRect().right}get bottom(){return this.element.getBoundingClientRect().bottom}get left(){return this.element.getBoundingClientRect().left}};class Bt extends Zt{constructor(...t){super({element:"div",name:"view"}),this.append(...t)}}const Wt=["a","abb","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","ipnut","ins","kbd","label","legend","li","main","map","mark","menu","meter","nav","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"],Ht=["svg","g","defs","symbol","use","image","switch","rect","circle","ellipse","line","polyline","polygon","path","text","tspan","textPath","altGlyph","altGlyphDef","altGlyphItem","glyph","glyphRef","linearGradient","radialGradient","pattern","solidColor","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncR","feFuncG","feFuncB","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","animate","animateMotion","animateTransform","set","script","desc","title","metadata","foreignObject"],Vt=new Proxy({},{get(t,e){if("string"!=typeof e)return;let s,r=e.replaceAll("_","-").toLowerCase();return Wt.includes(r)&&(s="html"),Ht.includes(r)&&(s="svg"),(...t)=>0===t.length?new Zt({element:r,name:r,type:s}):["string","number"].includes(typeof t[0])||t[0]instanceof Zt||"function"==typeof t[0]&&t[0]().isStateGetter()?new Zt({element:r,name:r,type:s}).append(...t):new Zt({element:r,type:s}).setAttr(t.shift()).append(...t)}});class Gt extends Zt{constructor(t="div",e="100%",s="100%"){super({element:t,name:"Flex"}),this.direction="cols","number"==typeof e&&(e+="%"),"number"==typeof s&&(s+="%"),this.style({width:e,height:s}),this.style({display:"flex"})}get isFlex(){return!0}resp(t,e=!0){return this.wrap(e),this.element.clientWidth<t?this.vertical():this.horizontal(),this}setSpaceAround(){return this.style({justifyContent:"space-around"}),this}setSpaceBetween(){return this.style({justifyContent:"space-between"}),this}setBaseline(){return this.style({alignItems:"baseline"}),this}gap(t){return"row"===this.direction?this.style({columnGap:t}):"column"===this.direction&&this.style({rowGap:t}),this}wrap(t="wrap"){return this.style({flexWrap:"string"==typeof t?t:["no-wrap","wrap","wrap-reverse"][+t]}),this}_justifyContent(t="center"){return this.style({justifyContent:t}),this}vertical(t,e,s=1){return Kt.call(this,s),this.style({alignItems:"number"==typeof t?Yt.call(this,t):t,justifyContent:"number"==typeof e?Xt.call(this,e):e}),this}horizontal(t,e,s=1){return Jt.call(this,s),this.style({alignItems:"number"==typeof e?Xt.call(this,e):e,justifyContent:"number"==typeof t?Yt.call(this,t):t}),this}show(){return this.isHidden=!1,this.style({display:"flex"}),this}}function Kt(t){return 1==t?this.style({flexDirection:"column"}):-1==t&&this.style({flexDirection:"column-reverse"}),this}function Jt(t){return 1==t?this.style({flexDirection:"row"}):-1==t&&this.style({flexDirection:"row-reverse"}),this}function Yt(t){return"number"==typeof t&&(t=["flex-start","center","flex-end"][t+1]),t}function Xt(t){return Yt(-t)}class Qt extends Q{constructor({element:t,name:e,type:s,render:r}){super({element:t,name:e,type:s,render:r})}}class te extends Qt{constructor(t,e){super({element:"div",name:"suspense"}),this.setAttr({dataTemp:"suspense"}),this.fallback_ui=t,this.append(t),(async()=>{try{const s=await e();t.unmount(),this.append(s)}catch(t){console.log({error:t})}})()}}class ee extends Zt{constructor(t){super({element:"div",name:"html_wrappper"}),this.element.append(function(t){if(globalThis?.DOMParser){const e=(new DOMParser).parseFromString(`<div>${t}</div>`,"text/html");return e.body.firstChild.style.display="contents",e.body.firstChild}}(t)),this.style({display:"contents"})}}class se extends Zt{constructor(t){super({element:"div",name:"html_wrappper"}),this.element.append(function(t){if("undefined"!=typeof DOMParser){const e=(new DOMParser).parseFromString(t.trim(),"image/svg+xml").documentElement;if("parsererror"===e.nodeName)throw new Error("Invalid SVG string");if(e.hasAttribute("xmlns"))return e;const{children:s,attributes:r}=e,n=document.createElementNS("http://www.w3.org/2000/svg","svg");for(let{name:t,value:e}of r)n.setAttribute(t,e);return n.append(...s),globalThis.svg=e,globalThis.children=s,globalThis.attributes=r,globalThis.element=n,n}throw new Error("DOMParser is not available in this environment")}(t)),this.style({display:"contents"})}}class re extends Zt{constructor(t,e){super(),this.key=t,this.cases=e,this.init()}init(){Object.values(this.cases).filter((t=>t!=this.current)).forEach((t=>t.unmount())),super.init(this.current.element)}get current(){const t=Object.keys(this.cases).find((t=>t==this.key))??"default";return this.cases[t]}updateKey(t){return this.key=t,this.replaceElementWith(this.current.element),this}}const ne=t=>(new XMLSerializer).serializeToString(t),ie=t=>btoa(ne(t)),oe=t=>"data:image/svg+xml;base64,"+ie(t),ae=t=>JSON.stringify(n((t=>["number","string","boolean","bigint"].includes(typeof t)?String(t):t instanceof o||t instanceof de?t.toString():t instanceof Array?ce(t):void 0),t),null," ").replace(/"([^"]+)":/g,"$1:").replace(/: "([^"]+)"/g,": $1"),he=t=>{if(!Array.isArray(t))return 0;let e=1;for(const s of t)if(Array.isArray(s)){const t=he(s);t+1>e&&(e=t+1)}return e},ce=t=>{let e=0;return function t(s){let r=he(s),n=0;return s.some((t=>Array.isArray(t)))&&(e++,n=1),"["+s.map(((r,n)=>["number","string","boolean","bigint"].includes(typeof r)?String(r):r instanceof o?r.toString():r instanceof Array?`\n${" ".repeat(e)}${t(r)}${n===s.length-1?"\n":""}`:r instanceof Object?ae(r):void 0))+`${" ".repeat((r+e+1)*n)}]`}(t)},le=(t,e=0)=>{t=ue(t);let s="";const r=" ".repeat(e);for(let n in t)if("object"==typeof t[n]){s+=`${r}${n} {\n`;const i=t[n];for(let t in i)"object"==typeof i[t]?s+=le({[t]:i[t]},e+1):s+=`${r} ${t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}: ${i[t]};\n`;s+=`${r}}\n`}return s};function ue(t){return"object"!=typeof t||null===t?t:Object.keys(t).reduce(((e,s)=>(e[s.trim()]=ue(t[s]),e)),Array.isArray(t)?[]:{})}function pe(t,e){var s=[];for(let e=0;e<t.length;e++)s.push(t[e].slice(0));s.splice(0,1);for(let t=0;t<s.length;t++)s[t].splice(e,1);return s}function me(t,e){if(t=t.clone(),e=e.clone(),t.rows!==e.rows)return;let s=t.arr;for(let r=0;r<t.rows;r++)for(let n=t.cols;n<t.cols+e.cols;n++)s[r][n]=e.arr[r][n-t.cols];return t.cols+=e.cols,new t.constructor(t.rows,t.cols,s.flat(1))}function fe(t,e){if(t=t.clone(),e=e.clone(),t.cols!==e.cols)return;let s=t.arr;for(let r=t.rows;r<t.rows+e.rows;r++){s[r]=[];for(let n=0;n<t.cols;n++)s[r][n]=e.arr[r-t.rows][n]}return t.rows+=e.rows,new t.constructor(t.rows,t.cols,s.flat(1))}class de{constructor(t,e,s=[]){if(t instanceof de)this.arr=t.arr,this.rows=t.rows,this.cols=t.cols;else{let r,n,i=[];if(arguments[0]instanceof Array)t=arguments[0].length,e=arguments[0][0].length,i=arguments[0];else for(r=0;r<t;r++)for(i.push([]),i[r].push(new Array(e)),n=0;n<e;n++)i[r][n]=s[r*e+n],null==s[r*e+n]&&(i[r][n]=0);this.rows=t,this.cols=e,this.arr=i}this.#a()}isMatrix(){return!0}clone(){return new de(this.rows,this.cols,this.arr.flat(1))}[Symbol.iterator](){return this.arr[Symbol.iterator]()}#a(){for(let t=0;t<this.arr.length;t++)Object.defineProperty(this,t,{value:this.arr[t],writable:!0,configurable:!0,enumerable:!1})}get size(){return this.rows*this.cols}get shape(){return[this.rows,this.cols]}toString(){return ce(this.arr)}at(t=0,e=void 0){if(t<0&&(t+=this.rows),t<0||t>=this.rows)throw new Error("Row index out of bounds");if(void 0===e)return this.arr[t];if(e<0&&(e+=this.cols),e<0||e>=this.cols)throw new Error("Column index out of bounds");return this.arr[t][e]}slice(t=0,e=0,s=this.rows-1,r=this.cols-1){let n=s-t,i=r-e,o=new Array(i);for(let s=0;s<n;s++){o[s]=[];for(let r=0;r<i;r++)o[s][r]=this.arr[s+t][r+e]}return new de(n,i,o.flat(1))}static slice(t,e=0,s=0,r=this.rows-1,n=this.cols-1){return t.slice(e,s,r,n)}reshape(t,e){if(t*e!=this.rows*this.cols)throw Error("size not matched");return new de(t,e,this.arr.flat(1))}get T(){let t=[];for(let e=0;e<this.arr[0].length;e++){t[e]=[];for(let s=0;s<this.arr.length;s++)t[e][s]=this.arr[s][e]}return new de(this.cols,this.rows,t.flat(1))}get det(){return(t=this).isSquare?1==t.rows?t.arr[0][0]:function t(e){if(2==e.length)return e.flat(1).some((t=>t?.isMatrix?.()))?void console.warn("Tensors are not completely supported yet ..."):x(M(e[0][0],e[1][1]),M(e[0][1],e[1][0]));for(var s=0,r=0;r<e.length;r++){const n=v(M(l(-1,r),M(e[0][r],t(pe(e,r)))));s=v(s,n)}return s}(t.arr):new Error("is not square matrix");var t}get inv(){return function(t){if(t.row!==t.cols)throw Error('is not a square matrix"');if(0===t.det)throw Error("determinant should not equal 0");const{arr:e}=t;if(e.length===e[0].length){var s=0,r=0,n=0,i=e.length,o=0,a=[],h=[];for(s=0;s<i;s+=1)for(a[a.length]=[],h[h.length]=[],n=0;n<i;n+=1)a[s][n]=s==n?1:0,h[s][n]=e[s][n];for(s=0;s<i;s+=1){if(0==(o=h[s][s])){for(r=s+1;r<i;r+=1)if(0!=h[r][s]){for(n=0;n<i;n++)o=h[s][n],h[s][n]=h[r][n],h[r][n]=o,o=a[s][n],a[s][n]=a[r][n],a[r][n]=o;break}if(0==(o=h[s][s]))return}for(n=0;n<i;n++)h[s][n]=h[s][n]/o,a[s][n]=a[s][n]/o;for(r=0;r<i;r++)if(r!=s)for(o=h[r][s],n=0;n<i;n++)h[r][n]-=o*h[s][n],a[r][n]-=o*a[s][n]}return new t.constructor(a)}}(this)}static eye(t){let e=new de(t,t);for(let s=0;s<t;s++)for(let r=0;r<t;r++)e.arr[s][r]=s===r?1:0;return e}static zeros(t,e){let s=new de(t,e);for(let n=0;n<t;n++)for(var r=0;r<e;r++)s.arr[n][r]=0;return s}static ones(t,e){let s=new de(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)s.arr[r][t]=1;return s}static nums(t,e,s){let r=new de(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)r.arr[n][t]=s;return r}hstack(...t){const e=[this,...t].reduce(((t,e)=>me(t,e)));return Object.assign(this,e),this.#a(),this}static hstack(t,...e){return t.clone().hstack(...e)}vstack(...t){const e=[this,...t].reduce(((t,e)=>fe(t,e)));return Object.assign(this,e),this.#a(),this}static vstack(t,...e){return t.clone().vstack(...e)}hqueue(...t){const e=[this,...t].reverse().reduce(((t,e)=>me(t,e)));return Object.assign(this,e),this}static hqueue(t,...e){return t.clone().hqueue(...e)}vqueue(...t){const e=[this,...t].reverse().reduce(((t,e)=>fe(t,e)));return Object.assign(this,e),this}static vqueue(t,...e){return t.clone().vqueue(...e)}shuffle(){return this.arr=this.arr.sort((()=>.5-Math.random())),this}static shuffle(t){return t.clone().shuffle()}get isSquare(){return this.rows===this.cols}get isSym(){if(!this.isSquare)return!1;for(let t=0;t<this.rows;t++)for(let e=t+1;e<this.cols;e++)if(this.arr[t][e]!==this.arr[e][t])return!1;return!0}get isAntiSym(){if(!this.isSquare)return!1;const t=this.rows;for(let e=0;e<t;e++){if(0!==this.arr[e][e])return!1;for(let s=e+1;s<t;s++)if(this.arr[e][s]!==-this.arr[s][e])return!1}return!0}get isDiag(){if(!this.isSquare)return!1;const t=this.rows;for(let e=0;e<t;e++)for(let s=e+1;s<t;s++)if(0!==this.arr[e][s]||0!==this.arr[s][e])return!1;return!0}get isOrtho(){return!!this.isSquare&&(this.isDiag&&(1==this.det||-1==this.det))}get isIdemp(){if(!this.isSquare)return!1;const t=this.rows,e=this.arr,s=[];for(let r=0;r<t;r++){s[r]=[];for(let n=0;n<t;n++){let i=0;for(let s=0;s<t;s++)i+=e[r][s]*e[s][n];s[r][n]=i}}for(let r=0;r<t;r++)for(let n=0;n<t;n++)if(s[r][n]!==e[r][n])return!1;return!0}get isUpperTri(){if(!this.isSquare)return!1;const t=this.rows;for(let e=1;e<t;e++)for(let t=0;t<e;t++)if(0!==this.arr[e][t])return!1;return!0}get isLowerTri(){if(!this.isSquare)return!1;const t=this.rows;for(let e=0;e<t-1;e++)for(let s=e+1;s<t;s++)if(0!==this.arr[e][s])return!1;return!0}map(t,e,s,r){return this.arr=j(this.arr,t,e,s,r),this}lerp(t,e){return this.arr=T(this.arr,t,e),this}norm(t,e){return this.arr=C(this.arr,t,e),this}clamp(t,e){return this.arr=S(this.arr,t,e),this}static map(t,e,s,r,n){return t.clone().map(e,s,r,n)}static lerp(t,e,s){return t.clone().lerp(e,s)}static norm(t,e,s){return t.clone().norm(e,s)}static clamp(t,e,s){return t.clone().clamp(e,s)}toPrecision(t){for(let e=0;e<this.cols;e++)for(let s=0;s<this.rows;s++)this.arr[e][s]=+this.arr[e][s].toPrecision(t);return this}max2min(){let t=this.arr.flat(1).max2min;return new de(this.rows,this.cols,t)}min2max(){let t=this.arr.flat(1).min2max;return new de(this.rows,this.cols,t)}sortRows(t=void 0){let e=this.arr.map((e=>e.sort(t))).flat(1);return new de(this.rows,this.cols,e)}sortCols(t=void 0){let e=this.T.arr.map((e=>e.sort(t))).flat(1);return new de(this.rows,this.cols,e).T}filterByRows(t){var e=this.arr.map((e=>e.map((e=>+(""+e).includes(t))))).map((t=>!!Logic.or(...t))),s=this.arr.filter(((t,s)=>!0===e[s]));return 0===s.length&&s.push([]),console.log(s),new de(s)}filterByCols(t){return new de(this.T.arr.filter((e=>e.includes(t))))}sortAll(t=void 0){let e=this.arr.flat(1).sort(t);return new de(this.rows,this.cols,e)}count(t){return this.arr.flat(1).count(t)}splice(t,e,s,...r){}getRows(t,e=t+1){return this.slice(t,0,e,this.cols)}getCols(t,e=t+1){return this.slice(0,t,this.rows,e)}static getRows(t,e,s=e+1){return t.slice(e,0,s,t.cols)}static getCols(t,e,s=e+1){return t.slice(0,e,t.rows,s)}add(...t){for(let s=0;s<t.length;s++){("number"==typeof t[s]||t[s]instanceof o)&&(t[s]=de.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=v(this.arr[r][e],t[s].arr[r][e])}return new de(this.rows,this.cols,this.arr.flat(1))}sub(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=de.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=x(this.arr[r][e],t[s].arr[r][e])}return new de(this.rows,this.cols,this.arr.flat(1))}static add(t,...e){return t.clone().add(...e)}static sub(t,...e){return t.clone().sub(...e)}mul(...t){for(let r=0;r<t.length;r++){"number"==typeof t[r]&&(t[r]=de.nums(this.rows,this.cols,t[r]));for(var e=0;e<this.rows;e++)for(var s=0;s<this.cols;s++)this.arr[e][s]=M(this.arr[e][s],t[r].arr[e][s])}return new de(this.rows,this.cols,this.arr.flat(1))}div(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=de.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=E(this.arr[r][e],t[s].arr[r][e])}return new de(this.rows,this.cols,this.arr.flat(1))}static div(t,...e){return t.clone().div(...e)}static mul(t,...e){return t.clone().mul(...e)}modulo(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=de.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=k(this.arr[r][e],t[s].arr[r][e])}return new de(this.rows,this.cols,this.arr.flat(1))}static modulo(t,...e){return t.clone().modulo(...e)}dot(t){for(var e=[],s=0;s<this.arr.length;s++){e[s]=[];for(var r=0;r<t.arr[0].length;r++){e[s][r]=0;for(var n=0;n<this.arr[0].length;n++)e[s][r]=v(e[s][r],M(this.arr[s][n],t.arr[n][r]))}}return new de(this.arr.length,t.arr[0].length,e.flat(1))}static dot(t,e){return t.dot(e)}pow(t){let e=this.clone(),s=this.clone();for(let r=0;r<t-1;r++)s=s.dot(e);return s}static pow(t,e){return t.clone().pow(e)}get somme(){let t=0;for(let e=0;e<this.rows;e++)for(let s=0;s<this.cols;s++)t+=this.arr[e][s];return t}get hasComplex(){return this.arr.flat(1/0).some((t=>t instanceof o))}get min(){this.hasComplex&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(min(...this.arr[e]));return min(...t)}get max(){this.hasComplex&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(max(...this.arr[e]));return max(...t)}get minRows(){this.hasComplex&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(min(...this.arr[e]));return t}get maxRows(){this.hasComplex&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(max(...this.arr[e]));return t}get minCols(){return this.hasComplex&&console.error("Complex numbers are not comparable"),this.T.minRows}get maxCols(){return this.hasComplex&&console.error("Complex numbers are not comparable"),this.T.maxRows}static fromVector(t){return new de(t.length,1,t)}get toArray(){let t=[];for(let e=0;e<this.rows;e++)for(let s=0;s<this.cols;s++)t.push(this.arr[e][s]);return t}get serialize(){return JSON.stringify(this)}static deserialize(t){"string"==typeof t&&(t=JSON.parse(t));let e=new de(t.rows,t.cols);return e.arr=t.arr,e}sortTable(t=0,{type:e="num",order:s="asc"}={}){var r=this.T.arr.map((t=>t.map(((t,e)=>Object.assign({},{x:t,y:e}))))),n=this.T.arr.map((t=>t.map(((t,e)=>Object.assign({},{x:t,y:e})))));"num"===e?"asc"===s?r[t].sort(((t,e)=>t.x-e.x)):"desc"===s?r[t].sort(((t,e)=>e.x-t.x)):"toggle"===s&&(r[t][0].x>r[t][1].x?r[t].sort(((t,e)=>e.x-t.x)):r[t].sort(((t,e)=>t.x-e.x))):"alpha"===e&&("asc"===s?r[t].sort(((t,e)=>(""+t.x).localeCompare(""+e.x))):"desc"===s&&r[t].sort(((t,e)=>(""+e.x).localeCompare(""+t.x)))),s=r[t].map((t=>t.y));for(let e=0;e<r.length;e++)e!==t&&r[e].map(((t,e)=>t.y=s[e]));for(let e=0;e<r.length;e++)e!==t&&n[e].map(((t,n)=>t.x=r[e][s[n]].x));n[t]=r[t];var i=n.map((t=>t.map((t=>t.x))));return new de(i).T}}const ge=t=>new Array(t).fill(0),be=t=>new Array(t).fill(1),we=(t,e)=>new Array(e).fill(t),ye=(t,e,s,r=!1)=>{let n=[];if(t<e)for(let i=t;r?i<=e:i<e;i+=s)n.push(10*i/10);else for(let i=t;r?i>=e:i>e;i-=s)n.push(10*i/10);return n},_e=(t,e,s=c(e-t)+1,r=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[o,a]=[t,e].sort(((t,e)=>e-t));var n=[];let h;h=r?(o-a)/(s-1):(o-a)/s;for(var i=0;i<s;i++)t<e?n.push(a+h*i):n.push(o-h*i);return n}if([t,e].some((t=>t.isComplex?.()))){const n=new s.constructor(t),i=new s.constructor(e);s=s||Math.abs(n.a-i.a)+1;const o=_e(n.a,i.a,s,r),a=_e(n.b,i.b,s,r);let h=new Array(s).fill(null);return h=h.map(((t,e)=>new t.constructor(o[e],a[e]))),h}}},ve=(t,e,r=e-t+1,n=s,i=!0)=>_e(t,e,r,i).map((t=>l(n,t))),xe=(t,e,s=c(e-t)+1,r=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[n,i]=[t,e].sort(((t,e)=>e-t));let o;o=p(n/i,r?s-1:s);const a=[i];for(let t=1;t<s;t++)a.push(a[t-1]*o);return t<e?a:a.reverse()}if([t,e].some((t=>t.isComplex?.()))){const n=new s.constructor(t),i=new s.constructor(e);let o;s=s||Math.abs(n.a-i.a)+1,o=p(i.div(n),r?s-1:s);const a=[n];for(let t=1;t<s;t++)a.push(M(a[t-1],o));return a}}},Me=(...t)=>{if(t.every((t=>"number"==typeof t))){let e=t[0];for(let s=1;s<t.length;s++)e+=t[s];return e}const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(Me(...t[s])):t[s]instanceof Object&&e.push(Me(...Object.values(t[s])));return 1===e.length?e[0]:e},Ee=(...t)=>{if(t.every((t=>"number"==typeof t))){let e=t[0];for(let s=1;s<t.length;s++)e*=t[s];return e}const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(Ee(...t[s])):t[s]instanceof Object&&e.push(Ee(...Object.values(t[s])));return 1===e.length?e[0]:e},ke=(...t)=>{if(t.every((t=>"number"==typeof t))){let e=t.reduce(((t,e)=>[...t,t[t.length-1]+e]),[0]);return e.shift(),e}const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(ke(...t[s])):t[s]instanceof Object&&e.push(null);return 1===e.length?e[0]:e},Ce=(t,e,s)=>{const[r,n]=[Math.min(e,s),Math.max(e,s)];return t>=r&&t<=n},Te=(t,e,s=1e-4)=>Math.abs(t-e)<=s,Se=(t,e)=>t.reduce(((t,s)=>[...t,...e.map((t=>[s,t]))]),[]),je=(t,e)=>{let s,r=1;if(t==f(t)&&e==f(e)){for(s=2;s<=t&&s<=e;++s)t%s==0&&e%s==0&&(r=s);return r}console.log("error")},Oe=(t,e)=>{let s;if(t==f(t)&&e==f(e)){for(s=t>e?t:e;s%t!=0||s%e!=0;)++s;return s}console.log("error")},Ae={zeros:ge,ones:be,nums:we,arange:ye,linspace:_e,logspace:ve,geomspace:xe,sum:Me,prod:Ee,accum:ke,cartesianProduct:Se,ppcm:Oe,pgcd:je,inRange:Ce,isApproximatlyEqual:Te},Pe={_mode:Number,_map:function(t,e,s){return e instanceof de?new de(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof o?new o(t(e.a,s),t(e.b,s)):e instanceof Array?e.map((e=>t(e,s))):void 0},dec2base(t,e){return this._mode=e<=10?Number:String,"number"==typeof t?this._mode((t>>>0).toString(e)):this._map(this.dec2base,t,e)},dec2bin(t){return this.dec2base(t,2)},dec2oct(t){return this.dec2base(t,8)},dec2hex(t){return this.dec2base(t,16)},bin2base(t,e){return this.dec2base(this.bin2dec(t),e)},bin2dec(t){return this._mode("0b"+t)},bin2oct(t){return this.bin2base(t,8)},bin2hex(t){return this.bin2base(t,16)},oct2dec(t){return this._mode("0o"+t)},oct2bin(t){return this.dec2bin(this.oct2dec(t))},oct2hex(t){return this.dec2hex(this.oct2dec(t))},oct2base(t,e){return this.dec2base(this.oct2dec(t),e)},hex2dec(t){return this._mode("0x"+t)},hex2bin(t){return this.dec2bin(this.hex2dec(t))},hex2oct(t){return this.dec2oct(this.hex2dec(t))},hex2base(t,e){return this.dec2base(this.hex2dec(t),e)},IEEE32toDec(t){let e=t.split(" ").join("").padEnd(32,"0"),s=e[0],r=2**(+("0b"+e.slice(1,9))-127);return(-1)**s*(1+e.slice(9,32).split("").map((t=>+t)).map(((t,e)=>t*2**(-e-1))).reduce(((t,e)=>t+e),0))*r},IEEE64toDec(t){let e=t.split(" ").join("").padEnd(64,"0"),s=e[0],r=2**(+("0b"+e.slice(1,12))-1023);return(-1)**s*(1+e.slice(13,64).split("").map((t=>+t)).map(((t,e)=>t*2**(-e-1))).reduce(((t,e)=>t+e),0))*r}},Ie={_mode:Number,_map:function(t,e,s){return e instanceof de?new de(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof o?new o(t(e.a,s),t(e.b,s)):e instanceof Array?e.map((e=>t(e,s))):void 0},not:function(t){return["number","boolean"].includes(typeof t)?Ie._mode(!t):this._map(this.not,t)},and:function(t,...e){return["number","boolean"].includes(typeof t)?Ie._mode(e.reduce(((t,e)=>t&e),t)):this._map(this.and,t,e)},or:function(t,...e){return["number","boolean"].includes(typeof t)?Ie._mode(e.reduce(((t,e)=>t|e),t)):this._map(this.or,t,e)},nand:function(t,...e){return this.not(this.and(t,e))},nor:function(t,...e){return this.not(this.or(t,e))},xor:function(t,...e){let s=[t,...e];return["number","boolean"].includes(typeof t)?this._mode(1===s.reduce(((t,e)=>(1==+e&&(t+=1),t)),0)):this._map(this.xor,t,e)},xnor:function(t,...e){return Ie.not(Ie.xor(t,e))}};class De{static withDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((r,n)=>{this.withDiscount(t.slice(n),e-1).forEach((t=>{s.push([r].concat(t))}))})),s}static withoutDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((r,n)=>{this.withoutDiscount(t.slice(n+1),e-1).forEach((t=>{s.push([r].concat(t))}))})),s}}const{PI:Re,sqrt:ze,cos:$e,sin:Le,acos:qe,pow:Ue}=Math,Ne=t=>t,Fe=(t,e=7.5625,s=2.75)=>t<1/s?e*t*t:t<2/s?e*(t-=1.5/s)*t+.75:t<2.5/s?e*(t-=2.25/s)*t+.9375:e*(t-=2.625/s)*t+.984375;class Ze{constructor(t,{ease:e=Ne,step:s=50,t0:r=0,start:n=!0,duration:i=3e3}={}){this.callback=t,this.state={isRunning:!1,animationId:null,startTime:null,ease:e,step:s,autoStart:n,duration:i},this.t=0,this.tx=0,this.ty=0,this.i=0,this.state.autoStart&&this.start()}#c=()=>{this.t+=this.state.step,this.i++,this.tx=j(this.t,0,this.state.duration,0,1),this.ty=this.state.ease(this.tx),this.callback(this),this.t>=this.state.duration&&(clearInterval(this.state.animationId),this.state.isRunning=!1)};#l(t=!0){return this.state.isRunning||(t&&this.reset(!1),this.state.isRunning=!0,this.state.startTime=Date.now(),this.state.animationId=setInterval(this.#c,this.state.step)),this}start(){return this.#l(!0)}pause(){return this.state.isRunning&&(clearInterval(this.state.animationId),this.state.isRunning=!1),this}resume(){return this.#l(!1)}stop(){return this.pause(),this.reset(!1),this}reset(t=!0){return this.t=0,this.tx=0,this.ty=0,this.i=0,t&&this.start(),this}}class Be{constructor(t,e,s=1/0,r){this.ms=e,this.fn=t,this.count=s,this.frame=1,this.id=null,this.running=!1,r&&this.start()}start(){return this.running||(this.running=!0,this.frame=1,this.id=setInterval((()=>{this.frame>this.count?this.stop():(this.fn.call(null,this),this.frame++)}),this.ms)),this}stop(){return this.running&&(this.running=!1,clearInterval(this.id),this.id=null),this}isRunning(){return this.running}}class We extends Be{constructor(t=1e3/60){super(t,(()=>this._tick())),this.elapsed=0,this._lastTime=performance.now(),this._callbacks=new Set}_tick(){const t=performance.now(),e=t-this._lastTime;this.elapsed+=e,this._lastTime=t;for(const t of this._callbacks)t({elapsed:this.elapsed,delta:e})}onTick(t){return this._callbacks.add(t),()=>this._callbacks.delete(t)}reset(){this.elapsed=0,this._lastTime=performance.now()}pause(){super.stop()}resume(){this._lastTime=performance.now(),super.start()}}class He{constructor(t=[],{repeat:e=1,loop:s=!1}={}){this.tasks=t,this.repeat=e,this.loop=s,this.stopped=!1,this.running=!1,this.onStart=null,this.onTask=null,this.onEnd=null}async run(){if(this.running)return;this.running=!0,this.stopped=!1,this.onStart&&this.onStart();let t=this.repeat;do{for(const t of this.tasks){if(this.stopped)return;if(Array.isArray(t))await Promise.all(t.map((({fn:t,delay:e=0})=>new Promise((async s=>{e>0&&await new Promise((t=>setTimeout(t,e))),this.onTask&&this.onTask(t),await t(),s()})))));else{const{fn:e,delay:s=0}=t;s>0&&await new Promise((t=>setTimeout(t,s))),this.onTask&&this.onTask(e),await e()}}}while(this.loop&&!this.stopped&&(t===1/0||t-- >1));!this.stopped&&this.onEnd&&this.onEnd(),this.running=!1}stop(){this.stopped=!0,this.running=!1}addTask(t){this.tasks.push(t)}clearTasks(){this.tasks=[]}}class Ve{constructor(t,{step:e=1e3,t0:s=0,t1:r=1/0,autoplay:n=!0}={}){this.callback=t,this.cache={isRunning:!1,id:null,last_tick:null,step:e,t0:s,t1:r,autoplay:n,pauseTime:null,frame:0},n&&(s?this.startAfter(s):this.start(),r!==1/0&&this.stopAfter(r))}get frame(){return this.cache.frame}get elapsed(){return this.cache.elapsed}start(){return this.cache.isRunning||(this.cache.frame=0,this.cache.isRunning=!0,this.cache.last_tick=Date.now(),this.animate()),this}pause(){return this.cache.isRunning&&(clearTimeout(this.cache.id),this.cache.isRunning=!1,this.cache.pauseTime=Date.now()),this}resume(){if(!this.cache.isRunning){if(this.cache.isRunning=!0,this.cache.pauseTime){const t=Date.now()-this.cache.pauseTime;this.cache.last_tick+=t}this.animate()}return this}stop(){return this.pause(),this.cache.frame=0,this}startAfter(t=1e3){return setTimeout((()=>this.start()),t),this}stopAfter(t=1e3){return setTimeout((()=>this.stop()),t),this}animate=()=>{if(this.cache.isRunning){const t=Date.now(),e=t-this.cache.last_tick;e>=this.cache.step&&(this.cache.elapsed=t-(this.cache.t0||0),this.callback(this),this.cache.frame++,this.cache.last_tick=t-e%this.cache.step),this.cache.id=setTimeout(this.animate,0)}}}class Ge{constructor({head:t=null,wrapper:e=null,target:s=null}){this.head=t,this.wrapper=e,this.target=s,this.init()}get isZikoApp(){return!0}init(){this.head&&this.setHead(this.head),this.wrapper&&this.setWrapper(this.wrapper),this.target&&this.setTarget(this.target),this.wrapper&&this.target&&this.wrapper.mount(this.target)}setTarget(t){return t instanceof HTMLElement?this.target=t:"string"==typeof t&&(this.target=globalThis?.document?.querySelector(t)),this}setWrapper(t){return t?.isUIElement?this.wrapper=t:"function"==typeof t&&(this.wrapper=t()),this}}function Ke(t){return/:\w+/.test(t)}class Je extends Ge{constructor({head:t,wrapper:e,target:s,routes:r}){super({head:t,wrapper:e,target:s}),this.routes=new Map([["404",at("Error 404")],...Object.entries(r)]),this.clear(),globalThis.onpopstate=this.mount(location.pathname)}clear(){return[...this.routes].forEach((t=>{!Ke(t[0])&&t[1]?.isUIElement&&t[1].unmount()})),this}mount(t){const[e,s]=[...this.routes].find((e=>function(t,e){const s=t.split("/"),r=e.split("/");if(s.length!==r.length)return!1;for(let t=0;t<s.length;t++){const e=s[t],n=r[t];if(!e.startsWith(":")&&e!==n)return!1}return!0}(e[0],t)));let r;if(Ke(e)){const n=function(t,e){const s=t.split("/"),r=e.split("/"),n={};if(s.length!==r.length)return n;for(let t=0;t<s.length;t++){const e=s[t],i=r[t];if(e.startsWith(":"))n[e.slice(1)]=i;else if(e!==i)return{}}return n}(e,t);r=s.call(this,n)}else s?.isUIElement&&s.mount(this.wrapper),"function"==typeof s&&(r=s());return r?.isUIElement&&r.mount(this.wrapper),r instanceof Promise&&r.then((t=>t.mount(this.wrapper))),globalThis.history.pushState({},"",t),this}}const Ye=({head:t,wrapper:e,target:s,routes:r})=>new Je({head:t,wrapper:e,target:s,routes:r});function Xe(t,e="./src/pages",s=["js","ts"]){"/"===e.at(-1)&&(e=e.slice(0,-1));const r=t.replace(/\\/g,"/").replace(/\[(\w+)\]/g,"$1/:$1").split("/"),n=e.split("/"),i=r.indexOf(n.at(-1));if(-1!==i){const t=r.slice(i+1),e=r.at(-1),n="index.js"===e||"index.ts"===e,o=s.some((t=>e===`.${t}`||e.endsWith(`.${t}`)));if(n)return"/"+(t.length>1?t.slice(0,-1).join("/"):"");if(o)return"/"+t.join("/").replace(/\.(js|ts)$/,"")}return""}class Qe{#u;#p=new Map;#m=0;constructor(){const t=new Blob(['\n this.onmessage = function(e) {\n const { id, funStr, args, close } = e.data;\n try {\n const func = new Function("return " + funStr)();\n const result = func(...args);\n postMessage({ id, result });\n } catch (error) {\n postMessage({ id, error: error.message });\n } finally {\n if (close) self.close();\n }\n }\n '],{type:"text/javascript"});this.#u=new Worker(URL.createObjectURL(t)),this.#u.addEventListener("message",(t=>{const{id:e,result:s,error:r}=t.data,n=this.#p.get(e);n&&(n(s,r),this.#p.delete(e))}))}call(t,e,s=[],r=!0){if("function"!=typeof t)throw new TypeError("func must be a function");const n=++this.#m;return this.#p.set(n,e),this.#u.postMessage({id:n,funStr:t.toString(),args:s,close:r}),this}terminate(){this.#u.terminate()}}class ts{constructor(t=10){this.events={},this.maxListeners=t}on(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this.events[t].length>this.maxListeners&&console.warn(`Warning: Possible memory leak. Event '${t}' has more than ${this.maxListeners} listeners.`),this}once(t,e){const s=(...r)=>{this.off(t,s),e(...r)};return this.on(t,s)}off(t,e){const s=this.events[t];if(!s)return this;const r=s.indexOf(e);return-1!==r&&s.splice(r,1),this}emit(t,e){const s=this.events[t];return!!s&&([...s].forEach((s=>{try{s(e)}catch(e){console.error(`Error in listener for '${t}':`,e)}})),!0)}remove(t){return delete this.events[t],this}clear(){return this.events={},this}setMaxListeners(t){return this.maxListeners=t,this}}const es=t=>new ts(t);class ss{#f;#d;#g=null;constructor(t=[],e=(()=>{})){this.#f=t,this.#d=e,this.#o()}#b(){return this.#f.some((({query:t})=>globalThis.matchMedia(t).matches))}#o(){this.#f.forEach((({query:t,callback:e})=>{const s=globalThis.matchMedia(t),r=()=>{const t=this.#b();s.matches?(e(),this.#g=e):t||this.#g===this.#d||(this.#d(),this.#g=this.#d)};r(),s.addEventListener("change",r)}))}}class rs{constructor(t=document.title,e=!0){this.cache={emitter:null},e&&this.useEventEmitter(),this.set(t)}useEventEmitter(){return this.cache.emitter=es(),this}setTitle(t){return t!==document.title&&(document.title=t,this.cache.emitter&&this.cache.emitter.emit("ziko:title-changed",t)),this}get current(){return document.title}onChange(t){return this.cache.emitter&&this.cache.emitter.on("ziko:title-changed",t),this}}class ns{constructor(t,{namespace:e="Ziko",ValidateCssProps:s=!1}={}){this.currentPropsMap=t,this.namespace=e,this.ValidateCssProps=s,this.use(t)}use(t){return this.ValidateCssProps&&function(t){const e=new Set(Object.keys(document.documentElement.style));for(const s in t)if(!e.has(s))throw new Error(`Invalid CSS property: "${s}"`)}(t),this.currentPropsMap=t,this.#a(),this}#a(){const t=globalThis?.document?.documentElement?.style;for(const e in this.currentPropsMap){const s=this.namespace?`--${this.namespace}-${e}`:`--${e}`;t.setProperty(s,this.currentPropsMap[e]),Object.defineProperty(this,e,{value:`var(${s})`,writable:!0,configurable:!0,enumerable:!1})}}}let{sqrt:is,cos:os,sin:as,exp:hs,log:cs,cosh:ls,sinh:us}=Math;for(const t of Object.getOwnPropertyNames(Math)){const e=Math[t];"function"==typeof e&&(Math[t]=new Proxy(e,{apply(e,s,r){const n=r[0];if("number"==typeof n||0===r.length)return e.apply(s,r);if(n?.isComplex?.()){const{a:t,b:i,z:o,phi:a}=n,h=(t,e)=>new n.constructor(t,e);switch(e.name){case"abs":return n.z;case"sqrt":return h(is(o)*os(a/2),is(o)*as(a/2));case"log":return h(cs(o),a);case"exp":return h(hs(t)*os(i),hs(t)*as(i));case"cos":return h(os(t)*ls(i),-as(t)*us(i));case"sin":return h(as(t)*ls(i),os(t)*us(i));case"tan":{const e=os(2*t)+ls(2*i);return h(as(2*t)/e,us(2*i)/e)}case"cosh":return h(ls(t)*os(i),us(t)*as(i));case"sinh":return h(us(t)*os(i),ls(t)*as(i));case"tanh":{const e=ls(2*t)+os(2*i);return h(us(2*t)/e,as(2*i)/e)}default:return e.apply(s,r)}}throw new TypeError(`Math.${t} expects only numbers`)}}))}globalThis?.document&&document?.addEventListener("DOMContentLoaded",__Ziko__.__Config__.init()),t.App=({head:t,wrapper:e,target:s})=>new Ge({head:t,wrapper:e,target:s}),t.Base=Pe,t.Clock=We,t.Combinaison=De,t.Complex=o,t.E=s,t.EPSILON=r,t.FileBasedRouting=async function(t){const e=Object.keys(t),s=function(t){if(0===t.length)return"";const e=t.map((t=>t.split("/"))),s=Math.min(...e.map((t=>t.length)));let r=[];for(let t=0;t<s;t++){const s=e[0][t];if(!e.every((e=>e[t]===s||e[t].startsWith("["))))break;r.push(s)}return r.join("/")+(r.length?"/":"")}(e),r={};for(let n=0;n<e.length;n++){const i=await t[e[n]](),o=await i.default;Object.assign(r,{[Xe(e[n],s)]:o})}return Ye({target:document.body,routes:{"/":()=>{},...r},wrapper:Vt.section()})},t.Flex=(...t)=>{let e="div";return"string"==typeof t[0]&&(e=t[0],t.pop()),new Gt(e).append(...t)},t.HTMLWrapper=t=>new ee(t),t.Logic=Ie,t.Matrix=de,t.PI=e,t.Permutation=class{static withDiscount(t,e=t.length){if(1===e)return t.map((t=>[t]));const s=[];let r;return r=this.withDiscount(t,e-1),t.forEach((t=>{r.forEach((e=>{s.push([t].concat(e))}))})),s}static withoutDiscount(t){if(1===t.length)return t.map((t=>[t]));const e=[],s=this.withoutDiscount(t.slice(1)),r=t[0];for(let t=0;t<s.length;t++){const n=s[t];for(let t=0;t<=n.length;t++){const s=n.slice(0,t),i=n.slice(t);e.push(s.concat([r],i))}}return e}},t.Random=class{static float(t=1,e){return e?Math.random()*(e-t)+t:t*Math.random()}static int(t,e){return Math.floor(this.float(t,e))}static char(t){t=t??this.bool();const e=String.fromCharCode(this.int(97,120));return t?e.toUpperCase():e}static bool(){return[!1,!0][Math.floor(2*Math.random())]}static string(t,e){return t instanceof Array?new Array(this.int(...t)).fill(0).map((()=>this.char(e))).join(""):new Array(t).fill(0).map((()=>this.char(e))).join("")}static bin(){return this.int(2)}static oct(){return this.int(8)}static dec(){return this.int(8)}static hex(){return this.int(16)}static choice(t=[1,2,3],e=new Array(t.length).fill(1/t.length)){let s=new Array(100);e=Ae.accum(...e).map((t=>100*t)),s.fill(t[0],0,e[0]);for(let r=1;r<t.length;r++)s.fill(t[r],e[r-1],e[r]);return s[this.int(s.length-1)]}static shuffleArr(t){return t.sort((()=>.5-Math.random()))}static floats(t,e,s){return new Array(t).fill(0).map((()=>this.float(e,s)))}static ints(t,e,s){return new Array(t).fill(0).map((()=>this.int(e,s)))}static bools(t){return new Array(t).fill(0).map((()=>this.bool()))}static bins(t){return new Array(t).fill(0).map((()=>this.int(2)))}static octs(t){return new Array(t).fill(0).map((()=>this.int(8)))}static decs(t){return new Array(t).fill(0).map((()=>this.int(10)))}static hexs(t){return new Array(t).fill(0).map((()=>this.int(16)))}static choices(t,e,s){return new Array(t).fill(0).map((()=>this.choice(e,s)))}static perm(...t){return t.permS[this.int(t.length)]}static color(){return"#"+Pe.dec2hex(this.float(16777216)).padStart(6,0)}static colors(t){return new Array(t).fill(null).map((()=>this.color()))}},t.SPA=Ye,t.SVGWrapper=t=>new se(t),t.Scheduler=(t,{repeat:e=null}={})=>new He(t,{repeat:e}),t.Suspense=(t,e)=>new te(t,e),t.Switch=({key:t,cases:e})=>new re(t,e),t.Tick=Be,t.TimeAnimation=Ze,t.TimeLoop=Ve,t.TimeScheduler=He,t.UIElement=Zt,t.UIHTMLWrapper=ee,t.UINode=N,t.UISVGWrapper=se,t.UISwitch=re,t.UIView=Bt,t.UseRoot=ns,t.UseThread=Qe,t.Utils=Ae,t.View=(...t)=>new Bt(...t),t.ZikoApp=Ge,t.ZikoEvent=gt,t.ZikoSPA=Je,t.ZikoUIFlex=Gt,t.ZikoUISuspense=te,t.ZikoUIText=ot,t.abs=c,t.accum=ke,t.acos=(...t)=>n((t=>{if(t?.isComplex){const{a:e,b:s}=t,r=Math.hypot(e+1,s),n=Math.hypot(e-1,s);return globalThis.Rp=r,globalThis.Rm=n,new t.constructor(Math.acos((r-n)/2),-Math.acosh((r+n)/2))}return Math.acos(t)}),...t),t.acosh=(...t)=>n((t=>t?.isComplex?m(t.clone().add(u(t.clone().mul(t.clone()).sub(1)))):Math.acosh(t)),...t),t.acot=(...t)=>n((t=>{if(t?.isComplex){const{a:e,b:s}=t;return new t.constructor(Math.atan(2*e/(e**2+(s-1)*(s+1)))/2,Math.log((e**2+(s-1)**2)/(e**2+(s+1)**2))/4)}return Math.PI/2-Math.atan(t)}),...t),t.add=v,t.animation=(t,{ease:e,t0:s,t1:r,start:n,duration:i}={})=>new Ze(t,{ease:e,t0:s,t1:r,start:n,duration:i}),t.apply_fun=i,t.arange=ye,t.arc=t=>1-Le(qe(t)),t.arr2str=ce,t.asin=(...t)=>n((t=>{if(t?.isComplex){const{a:e,b:s}=t,r=Math.hypot(e+1,s),n=Math.hypot(e-1,s);return new t.constructor(Math.asin((r-n)/2),Math.acosh((r+n)/2))}return Math.asin(t)}),...t),t.asinh=(...t)=>n((t=>t?.isComplex?m(t.clone().add(u(t.clone().mul(t.clone()).add(1)))):Math.asinh(t)),...t),t.atan=(...t)=>n((t=>{if(t?.isComplex){const{a:e,b:s}=t;return new t.constructor(Math.atan(2*e/(1-e**2-s**2))/2,Math.log((e**2+(1+s)**2)/(e**2+(1-s)**2))/4)}return Math.atan(t)}),...t),t.atan2=O,t.atanh=(...t)=>n((t=>Math.atanh(t)),...t),t.back=(t,e=1)=>t**2*((e+1)*t-e),t.bind_click_event=Ct,t.bind_clipboard_event=Tt,t.bind_drag_event=St,t.bind_focus_event=jt,t.bind_key_event=Ot,t.bind_mouse_event=At,t.bind_pointer_event=Pt,t.bind_swipe_event=Rt,t.bind_touch_event=(t,e)=>new vt("touch",t,pt.Touch,_t,e),t.bind_view_event=Dt,t.bind_wheel_event=It,t.cartesianProduct=Se,t.cbrt=(...t)=>n((t=>t.isComplex?.()?new t.constructor({z:t.z**(1/3),phi:t.phi/3}):Math.cbrt(t)),...t),t.ceil=(...t)=>n((t=>t.isComplex?.()?new t.constructor(Math.ceil(t.a),Math.ceil(t.b)):Math.ceil(t)),...t),t.clamp=S,t.clock=t=>new We(t),t.combinaison=(t,e,s=!1)=>De[s?"withDiscount":"withoutDiscount"](t,e),t.complex=h,t.cos=(...t)=>n((t=>t.isComplex?.()?new t.constructor(Math.cos(t.a)*Math.cosh(t.b),-Math.sin(t.a)*Math.sinh(t.b)):Math.cos(t)),...t),t.cosh=(...t)=>n((t=>t?.isComplex?new t.constructor(Math.cosh(t.a)*Math.cos(t.b),Math.sinh(t.a)*Math.sin(t.b)):Math.cosh(t)),...t),t.coth=(...t)=>n((t=>{if(t?.isComplex){const{a:e,b:s}=t,r=Math.sinh(e)**2*Math.cos(s)**2+Math.cosh(e)**2*Math.sin(s)**2;return new t.constructor(Math.cosh(e)*Math.sinh(e)/r,-Math.sin(s)*Math.cos(s)/r)}return 1/Math.tanh(t)}),...t),t.croot=(...t)=>{const e=t.pop();if(!e.isComplex?.())throw Error("croot expect Complex number as root");return n((t=>{"number"==typeof t&&(t=new e.constructor(t,0));const{a:s,b:r}=e,{z:n,phi:i}=t,o=Math.hypot(s,r),a=Math.exp((Math.log(n)*s+i*r)/o),h=(i*s-Math.log(n)*r)/o;return new e.constructor(a*Math.cos(h),a*Math.sin(h))}),...t)},t.csv2arr=P,t.csv2json=(t,e=",")=>JSON.stringify(I(t,e)),t.csv2matrix=(t,e=",")=>new de(P(t,e)),t.csv2object=I,t.csv2sql=(t,e)=>{const s=t.trim().trimEnd().split("\n").filter((t=>t));let r=`INSERT INTO ${e} (${s[0].split(",").join(", ")}) Values `,n=[];for(let t=1;t<s.length;t++){const e=s[t].split(",");n.push(`(${e})`)}return r+n.join(",\n")},t.debounce=(t,e=1e3)=>(...s)=>setTimeout((()=>t(...s)),e),t.defineParamsGetter=function(t){Object.defineProperties(t,{QueryParams:{get:function(){return function(t){const e={};return t.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi,(t=>{const[s,r]=t.split("=");e[s]=r})),e}(globalThis.location.search.substring(1))},configurable:!1,enumerable:!0},HashParams:{get:function(){return globalThis.location.hash.substring(1).split("#")},configurable:!1,enumerable:!0}})},t.define_wc=function(t,e,s={},{mode:r="open"}={}){globalThis.customElements?.get(t)?console.warn(`Custom element "${t}" is already defined`):-1!==t.search("-")?globalThis.customElements?.define(t,class extends HTMLElement{static get observedAttributes(){return["style",...Object.keys(s)]}constructor(){super(),this.attachShadow({mode:r}),this.props={},this.mask={...s}}connectedCallback(){this.render()}render(){this.shadowRoot.innerHTML="";const t=e(this.props);t instanceof Array?t.forEach((t=>t.mount(this.shadowRoot))):t.mount(this.shadowRoot)}attributeChangedCallback(t,e,s){Object.assign(this.props,{[t]:this.mask[t].type(s)}),this.render()}}):console.warn(`"${t}" is not a valid custom element name`)},t.deg2rad=(...t)=>n((t=>t*Math.PI/180),...t),t.discret=(t,e=5)=>Math.ceil(t*e)/e,t.div=E,t.elastic=t=>-2*Ue(2,10*(t-1))*$e(20*Re*t/3*t),t.event_controller=mt,t.exp=(...t)=>n((t=>t.isComplex?.()?new t.constructor(Math.exp(t.a)*Math.cos(t.b),Math.exp(t.a)*Math.sin(t.b)):Math.exp(t)),...t),t.floor=f,t.fract=(...t)=>n((t=>t.isComplex?.()?new t.constructor(t.a-Math.trunc(t.a),t.b-Math.trunc(t.b)):t-Math.trunc(t)),...t),t.geomspace=xe,t.getEvent=dt,t.hypot=(...t)=>{const e=t.find((t=>t.isComplex?.()));if(e){const s=t.map((t=>t.isComplex?.()?t:new e.constructor(t,0)));return Math.hypot(...s.map((t=>t.z)))}return Math.hypot(...t)},t.inRange=Ce,t.in_back=(t,e=1.70158,s=e+1)=>s*Ue(t,3)-e*t**2,t.in_bounce=(t,e=7.5625,s=2.75)=>1-Fe(1-t,e,s),t.in_circ=t=>1-ze(1-t**2),t.in_cubic=t=>t**3,t.in_elastic=(t,e=2*Re/3)=>0===t?0:1===t?1:-Ue(2,10*t-10)*Le((10*t-10.75)*e),t.in_expo=t=>0===t?0:2**(10*t-10),t.in_out_back=(t,e=1.70158,s=1.525*e)=>t<.5?Ue(2*t,2)*(2*(s+1)*t-s)/2:(Ue(2*t-2,2)*((s+1)*(2*t-2)+s)+2)/2,t.in_out_bounce=(t,e=7.5625,s=2.75)=>t<.5?Fe(1-2*t,e,s)/2:Fe(2*t-1,e,s)/2,t.in_out_circ=t=>t<.5?(1-ze(1-(2*t)**2))/2:(ze(1-(-2*t+2)**2)+1)/2,t.in_out_cubic=t=>t<.5?4*t**3:1-(-2*t+2)**3/2,t.in_out_elastic=(t,e=2*Re/4.5)=>0===t?0:1===t?1:t<.5?-Ue(2,20*t-10)*Le((20*t-11.125)*e)/2:Ue(2,-20*t+10)*Le((20*t-11.125)*e)/2+1,t.in_out_expo=t=>0===t?0:1===t?1:t<.5?2**(20*t-10)/2:(2-2**(-20*t+10))/2,t.in_out_quad=t=>t<.5?2*t**2:1-(-2*t+2)**2/2,t.in_out_quart=t=>t<.5?8*t**4:1-(-2*t+2)**4/2,t.in_out_quint=t=>t<.5?16*t**5:1-(-2*t+2)**5/2,t.in_out_sin=t=>-($e(Re*t)-1)/2,t.in_quad=t=>t**2,t.in_quart=t=>t**4,t.in_quint=t=>t**5,t.in_sin=t=>1-$e(t*Re/2),t.isApproximatlyEqual=Te,t.isStateGetter=rt,t.json2arr=t=>D(t instanceof Object?t:JSON.parse(t)),t.json2css=le,t.json2csv=z,t.json2csvFile=(t,e)=>{const s=z(t,e),r=new Blob([s],{type:"text/csv;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}},t.json2xml=U,t.json2xmlFile=(t,e)=>{const s=U(t,e),r=new Blob([s],{type:"text/xml;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}},t.json2yml=q,t.json2ymlFile=(t,e)=>{const s=q(t,e),r=new Blob([s],{type:"text/yml;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}},t.lerp=T,t.linear=Ne,t.linspace=_e,t.ln=m,t.logspace=ve,t.loop=(t,e={})=>new Ve(t,e),t.map=j,t.mapfun=n,t.matrix=(t,e,s)=>new de(t,e,s),t.matrix2=(...t)=>new de(2,2,t),t.matrix3=(...t)=>new de(3,3,t),t.matrix4=(...t)=>new de(4,4,t),t.max=(...t)=>Math.max(...t),t.min=(...t)=>Math.min(...t),t.modulo=k,t.mul=M,t.norm=C,t.nthr=p,t.nums=we,t.obj2str=ae,t.ones=be,t.out_back=(t,e=1.70158,s=e+1)=>1+s*Ue(t-1,3)+e*Ue(t-1,2),t.out_bounce=Fe,t.out_circ=t=>ze(1-(t-1)**2),t.out_cubic=t=>1-(1-t)**3,t.out_elastic=(t,e=2*Re/3)=>0===t?0:1===t?1:Ue(2,-10*t)*Le((10*t-.75)*e)+1,t.out_expo=t=>1===t?1:1-2**(-10*t),t.out_quad=t=>1-(1-t)**2,t.out_quart=t=>1-(1-t)**4,t.out_quint=t=>1-(1-t)**5,t.out_sin=t=>Le(t*Re/2),t.pgcd=je,t.pow=l,t.powerSet=t=>{const e=[],s=2**t.length;for(let r=0;r<s;r+=1){const s=[];for(let e=0;e<t.length;e+=1)r&1<<e&&s.push(t[e]);e.push(s)}return e},t.ppcm=Oe,t.preload=A,t.prod=Ee,t.rad2deg=(...t)=>n((t=>t/Math.PI*180),...t),t.round=(...t)=>n((t=>t.isComplex?.()?new t.constructor(Math.round(t.a),Math.round(t.b)):Math.round(t)),...t),t.sec=(...t)=>n((t=>(t.isComplex?.(),1/Math.cos(t))),...t),t.sig=(...t)=>n((t=>1/(1+Math.exp(-t))),...t),t.sign=(...t)=>n((t=>{if(t.isComplex?.()){const{z:e,phi:s}=t;return 0===e?new t.constructor(0,0):new t.constructor({z:1,phi:s})}return Math.sign(t)}),...t),t.sin=(...t)=>n((t=>t?.isComplex?new t.constructor(Math.sin(t.a)*Math.cosh(t.b),Math.cos(t.a)*Math.sinh(t.b)):Math.sin(t)),...t),t.sinh=(...t)=>n((t=>t?.isComplex?new t.constructor(Math.sinh(t.a)*Math.cos(t.b),Math.cosh(t.a)*Math.sin(t.b)):Math.sinh(t)),...t),t.sleep=t=>new Promise((e=>setTimeout(e,t))),t.sqrt=u,t.step=(t,e=5)=>Math.floor(t*e)/e,t.step_fps=t=>1e3/t,t.sub=x,t.subSet=null,t.sum=Me,t.svg2ascii=ie,t.svg2img=(t,e=!0)=>Vt.img(oe(t)).mount(e),t.svg2imgUrl=oe,t.svg2str=ne,t.tags=Vt,t.tan=(...t)=>n((t=>{if(t?.isComplex){const e=Math.cos(2*t.a)+Math.cosh(2*t.b);return new t.constructor(Math.sin(2*t.a)/e,Math.sinh(2*t.b)/e)}return Math.tan(t)}),...t),t.tanh=(...t)=>n((t=>{if(t?.isComplex){const e=Math.cosh(2*a)+Math.cos(2*b);return new t.constructor(Math.sinh(2*a)/e,Math.sin(2*b)/e)}return Math.tanh(t)}),...t),t.text=at,t.throttle=Mt,t.tick=(t,e,s=1/0,r=!0)=>new Be(t,e,s,r),t.timeTaken=t=>{console.time("timeTaken");const e=t();return console.timeEnd("timeTaken"),e},t.time_memory_Taken=t=>{const e=Date.now(),s=performance.memory.usedJSHeapSize,r=t();return{elapsedTime:Date.now()-e,usedMemory:performance.memory.usedJSHeapSize-s,result:r}},t.timeout=function(t,e){let s;const r=new Promise((r=>{s=setTimeout((()=>{e&&e(),r()}),t)}));return{id:s,clear:()=>clearTimeout(s),promise:r}},t.toggle_event_listener=ft,t.trunc=(...t)=>n((t=>t.isComplex?.()?new t.constructor(Math.trunc(t.a),Math.trunc(t.b)):Math.trunc(t)),...t),t.useDerived=function(t,e){let s=t(...e.map((t=>t().value)));const r=new Set;return e.forEach((n=>{n()._subscribe((()=>{{const n=t(...e.map((t=>t().value)));n!==s&&(s=n,r.forEach((t=>t(s))))}}))})),()=>({value:s,isStateGetter:()=>!0,_subscribe:t=>r.add(t)})},t.useEventEmitter=es,t.useIPC=G,t.useLocaleStorage=(t,e,s=!0)=>new K(localStorage,t,e,s),t.useMediaQuery=(t,e)=>new ss(t,e),t.useReactive=t=>n((t=>{const e=st(t);return{get:e[0],set:e[1]}}),t),t.useRoot=(t,e={})=>new ns(t,e),t.useSessionStorage=J,t.useState=st,t.useThread=(t,e,s=[],r=!0)=>(new Qe).call(t,e,s,r),t.useTitle=(t,e=!0)=>new rs(t,e),t.wait=t=>new Promise((e=>setTimeout(e,t))),t.waitForUIElm=t=>new Promise((e=>{if(t.element)return e(t.element);const s=new MutationObserver((()=>{t.element&&(e(t.element),s.disconnect())}));s.observe(document?.body,{childList:!0,subtree:!0})})),t.waitForUIElmSync=(t,e=2e3)=>{const s=Date.now();for(;Date.now()-s<e;)if(t.element)return t.element},t.zeros=ge}));