ziko 0.70.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ziko.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Thu Feb 26 2026 13:06:11 GMT+0000 (UTC)
5
+ Date : Thu Jun 04 2026 14:34:29 GMT+0100 (UTC+01:00)
6
6
  Git-Repo : https://github.com/zakarialaoui10/ziko.js
7
7
  Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
8
8
  Released under MIT License
@@ -1867,7 +1867,7 @@ class UINode {
1867
1867
 
1868
1868
  // globalThis.node = (node) => new UINode(node);
1869
1869
 
1870
- function parseQueryParams$1(queryString) {
1870
+ function parseQueryParams$2(queryString) {
1871
1871
  const params = {};
1872
1872
  queryString.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi, (match) => {
1873
1873
  const [key, value] = match.split('=');
@@ -1880,7 +1880,7 @@ function defineParamsGetter$1(target ){
1880
1880
  Object.defineProperties(target, {
1881
1881
  'QueryParams': {
1882
1882
  get: function() {
1883
- return parseQueryParams$1(globalThis.location.search.substring(1));
1883
+ return parseQueryParams$2(globalThis.location.search.substring(1));
1884
1884
  },
1885
1885
  configurable: false,
1886
1886
  enumerable: true
@@ -3347,9 +3347,6 @@ const MathMLTags = [
3347
3347
  `munder`, `munderover`
3348
3348
  ];
3349
3349
 
3350
- // const h=(tag, attributes = {}, ...children)=> _h(tag, "html", attributes, ...children);
3351
- // const s=(tag, attributes = {}, ...children)=> _h(tag, "svg", attributes, ...children);
3352
-
3353
3350
  const tags = new Proxy({}, {
3354
3351
  get(target, prop) {
3355
3352
  if (typeof prop !== 'string') return undefined;
@@ -4591,20 +4588,17 @@ const SPA=({head, wrapper, target, routes})=>new ZikoSPA({head, wrapper, target,
4591
4588
  // regEx
4592
4589
  */
4593
4590
 
4594
- function parseQueryParams(queryString) {
4595
- const params = {};
4596
- queryString.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi, (match) => {
4597
- const [key, value] = match.split('=');
4598
- params[key] = value;
4599
- });
4600
- return params;
4591
+ function parseQueryParams$1(queryString) {
4592
+ return Object.fromEntries(
4593
+ new URLSearchParams(location.search)
4594
+ );
4601
4595
  }
4602
4596
 
4603
4597
  function defineParamsGetter(target ){
4604
4598
  Object.defineProperties(target, {
4605
4599
  'QueryParams': {
4606
4600
  get: function() {
4607
- return parseQueryParams(globalThis.location.search.substring(1));
4601
+ return parseQueryParams$1(globalThis.location.search.substring(1));
4608
4602
  },
4609
4603
  configurable: false,
4610
4604
  enumerable: true
@@ -4999,6 +4993,77 @@ tags.p("Test useRoot ").style({
4999
4993
 
5000
4994
  */
5001
4995
 
4996
+ const parseQueryParams = queryString => Object.fromEntries(new URLSearchParams(globalThis?.location?.search));
4997
+
4998
+ function useQueryParams() {
4999
+ const getParams = () =>
5000
+ parseQueryParams();
5001
+
5002
+ const setParams = (updates, merge = true) => {
5003
+ const current = getParams();
5004
+
5005
+ const next =
5006
+ typeof updates === "function"
5007
+ ? updates(current)
5008
+ : updates;
5009
+
5010
+ const finalParams = merge
5011
+ ? { ...current, ...next }
5012
+ : next;
5013
+
5014
+ const search = new URLSearchParams(finalParams).toString();
5015
+
5016
+ window.history.pushState(
5017
+ {},
5018
+ "",
5019
+ `${window.location.pathname}${search ? `?${search}` : ""}`
5020
+ );
5021
+
5022
+ window.dispatchEvent(
5023
+ new CustomEvent("queryparamschange", {
5024
+ detail: finalParams
5025
+ })
5026
+ );
5027
+ };
5028
+
5029
+ return [getParams, setParams];
5030
+ }
5031
+
5032
+ function watchQueryParams(callback) {
5033
+ let previousSearch = location.search;
5034
+
5035
+ const notify = () => {
5036
+ const currentSearch = location.search;
5037
+
5038
+ if (currentSearch === previousSearch) {
5039
+ return;
5040
+ }
5041
+
5042
+ previousSearch = currentSearch;
5043
+ callback(parseQueryParams());
5044
+ };
5045
+
5046
+ window.addEventListener("popstate", notify);
5047
+
5048
+ const pushState = history.pushState;
5049
+ history.pushState = function (...args) {
5050
+ pushState.apply(this, args);
5051
+ notify();
5052
+ };
5053
+
5054
+ const replaceState = history.replaceState;
5055
+ history.replaceState = function (...args) {
5056
+ replaceState.apply(this, args);
5057
+ notify();
5058
+ };
5059
+
5060
+ callback(parseQueryParams());
5061
+
5062
+ return () => {
5063
+ window.removeEventListener("popstate", notify);
5064
+ };
5065
+ }
5066
+
5002
5067
  let {sqrt, cos: cos$1, sin: sin$1, exp, log, cosh: cosh$1, sinh} = Math;
5003
5068
  // Math.abs = new Proxy(Math.abs, {
5004
5069
  // apply(target, thisArg, args) {
@@ -5269,6 +5334,7 @@ exports.useEventEmitter = useEventEmitter;
5269
5334
  exports.useIPC = useIPC;
5270
5335
  exports.useLocaleStorage = useLocaleStorage;
5271
5336
  exports.useMediaQuery = useMediaQuery;
5337
+ exports.useQueryParams = useQueryParams;
5272
5338
  exports.useReactive = useReactive;
5273
5339
  exports.useRoot = useRoot;
5274
5340
  exports.useSessionStorage = useSessionStorage;
@@ -5280,6 +5346,7 @@ exports.wait = wait;
5280
5346
  exports.waitElm = waitElm;
5281
5347
  exports.waitForUIElm = waitForUIElm;
5282
5348
  exports.waitForUIElmSync = waitForUIElmSync;
5349
+ exports.watchQueryParams = watchQueryParams;
5283
5350
  exports.xnor = xnor;
5284
5351
  exports.xor = xor;
5285
5352
  exports.zeros = zeros;
package/dist/ziko.js CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Thu Feb 26 2026 13:06:11 GMT+0000 (UTC)
5
+ Date : Thu Jun 04 2026 14:34:29 GMT+0100 (UTC+01:00)
6
6
  Git-Repo : https://github.com/zakarialaoui10/ziko.js
7
7
  Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
8
8
  Released under MIT License
@@ -1871,7 +1871,7 @@
1871
1871
 
1872
1872
  // globalThis.node = (node) => new UINode(node);
1873
1873
 
1874
- function parseQueryParams$1(queryString) {
1874
+ function parseQueryParams$2(queryString) {
1875
1875
  const params = {};
1876
1876
  queryString.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi, (match) => {
1877
1877
  const [key, value] = match.split('=');
@@ -1884,7 +1884,7 @@
1884
1884
  Object.defineProperties(target, {
1885
1885
  'QueryParams': {
1886
1886
  get: function() {
1887
- return parseQueryParams$1(globalThis.location.search.substring(1));
1887
+ return parseQueryParams$2(globalThis.location.search.substring(1));
1888
1888
  },
1889
1889
  configurable: false,
1890
1890
  enumerable: true
@@ -3351,9 +3351,6 @@
3351
3351
  `munder`, `munderover`
3352
3352
  ];
3353
3353
 
3354
- // const h=(tag, attributes = {}, ...children)=> _h(tag, "html", attributes, ...children);
3355
- // const s=(tag, attributes = {}, ...children)=> _h(tag, "svg", attributes, ...children);
3356
-
3357
3354
  const tags = new Proxy({}, {
3358
3355
  get(target, prop) {
3359
3356
  if (typeof prop !== 'string') return undefined;
@@ -4595,20 +4592,17 @@
4595
4592
  // regEx
4596
4593
  */
4597
4594
 
4598
- function parseQueryParams(queryString) {
4599
- const params = {};
4600
- queryString.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi, (match) => {
4601
- const [key, value] = match.split('=');
4602
- params[key] = value;
4603
- });
4604
- return params;
4595
+ function parseQueryParams$1(queryString) {
4596
+ return Object.fromEntries(
4597
+ new URLSearchParams(location.search)
4598
+ );
4605
4599
  }
4606
4600
 
4607
4601
  function defineParamsGetter(target ){
4608
4602
  Object.defineProperties(target, {
4609
4603
  'QueryParams': {
4610
4604
  get: function() {
4611
- return parseQueryParams(globalThis.location.search.substring(1));
4605
+ return parseQueryParams$1(globalThis.location.search.substring(1));
4612
4606
  },
4613
4607
  configurable: false,
4614
4608
  enumerable: true
@@ -5003,6 +4997,77 @@
5003
4997
 
5004
4998
  */
5005
4999
 
5000
+ const parseQueryParams = queryString => Object.fromEntries(new URLSearchParams(globalThis?.location?.search));
5001
+
5002
+ function useQueryParams() {
5003
+ const getParams = () =>
5004
+ parseQueryParams();
5005
+
5006
+ const setParams = (updates, merge = true) => {
5007
+ const current = getParams();
5008
+
5009
+ const next =
5010
+ typeof updates === "function"
5011
+ ? updates(current)
5012
+ : updates;
5013
+
5014
+ const finalParams = merge
5015
+ ? { ...current, ...next }
5016
+ : next;
5017
+
5018
+ const search = new URLSearchParams(finalParams).toString();
5019
+
5020
+ window.history.pushState(
5021
+ {},
5022
+ "",
5023
+ `${window.location.pathname}${search ? `?${search}` : ""}`
5024
+ );
5025
+
5026
+ window.dispatchEvent(
5027
+ new CustomEvent("queryparamschange", {
5028
+ detail: finalParams
5029
+ })
5030
+ );
5031
+ };
5032
+
5033
+ return [getParams, setParams];
5034
+ }
5035
+
5036
+ function watchQueryParams(callback) {
5037
+ let previousSearch = location.search;
5038
+
5039
+ const notify = () => {
5040
+ const currentSearch = location.search;
5041
+
5042
+ if (currentSearch === previousSearch) {
5043
+ return;
5044
+ }
5045
+
5046
+ previousSearch = currentSearch;
5047
+ callback(parseQueryParams());
5048
+ };
5049
+
5050
+ window.addEventListener("popstate", notify);
5051
+
5052
+ const pushState = history.pushState;
5053
+ history.pushState = function (...args) {
5054
+ pushState.apply(this, args);
5055
+ notify();
5056
+ };
5057
+
5058
+ const replaceState = history.replaceState;
5059
+ history.replaceState = function (...args) {
5060
+ replaceState.apply(this, args);
5061
+ notify();
5062
+ };
5063
+
5064
+ callback(parseQueryParams());
5065
+
5066
+ return () => {
5067
+ window.removeEventListener("popstate", notify);
5068
+ };
5069
+ }
5070
+
5006
5071
  let {sqrt, cos: cos$1, sin: sin$1, exp, log, cosh: cosh$1, sinh} = Math;
5007
5072
  // Math.abs = new Proxy(Math.abs, {
5008
5073
  // apply(target, thisArg, args) {
@@ -5273,6 +5338,7 @@
5273
5338
  exports.useIPC = useIPC;
5274
5339
  exports.useLocaleStorage = useLocaleStorage;
5275
5340
  exports.useMediaQuery = useMediaQuery;
5341
+ exports.useQueryParams = useQueryParams;
5276
5342
  exports.useReactive = useReactive;
5277
5343
  exports.useRoot = useRoot;
5278
5344
  exports.useSessionStorage = useSessionStorage;
@@ -5284,6 +5350,7 @@
5284
5350
  exports.waitElm = waitElm;
5285
5351
  exports.waitForUIElm = waitForUIElm;
5286
5352
  exports.waitForUIElmSync = waitForUIElmSync;
5353
+ exports.watchQueryParams = watchQueryParams;
5287
5354
  exports.xnor = xnor;
5288
5355
  exports.xor = xor;
5289
5356
  exports.zeros = zeros;
package/dist/ziko.min.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /*
2
2
  Project: ziko.js
3
3
  Author: Zakaria Elalaoui
4
- Date : Thu Feb 26 2026 13:06:11 GMT+0000 (UTC)
4
+ Date : Thu Jun 04 2026 14:34:29 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:r}=Math,s=Number.EPSILON,n=(t,...e)=>{const r=e.map(e=>{return"object"!=typeof(r=e)&&"function"!=typeof r||null===r||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 r});return 1==r.length?r[0]:r},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)),o=(t,e,r)=>{if("number"==typeof e){if("number"==typeof r)switch(t){case"add":return e+r;case"sub":return e-r;case"mul":return e*r;case"div":return e/r;case"modulo":return e%r}return r?.isComplex?.()&&(e=new r.constructor(e,0)),r?.isMatrix?.()&&(e=r.constructor.nums(r.rows,r.cols,e)),e[t](r)}if(e?.isComplex?.()){if("number"==typeof r||r?.isComplex?.())return e.clone()[t](r);if(r?.isMatrix?.())return(e=r.constructor.nums(r.rows,r.cols,e)).clone()[t](r)}if(e?.isMatrix?.())return e.clone()[t](r)},h=(t,...e)=>{let r=t;for(let t=0;t<e.length;t++)r=o("add",r,e[t]);return r},l=(t,...e)=>{let r=t;for(let t=0;t<e.length;t++)r=o("sub",r,e[t]);return r},c=(t,...e)=>{let r=t;for(let t=0;t<e.length;t++)r=o("mul",r,e[t]);return r},u=(t,...e)=>{let r=t;for(let t=0;t<e.length;t++)r=o("div",r,e[t]);return r},m=(t,...e)=>{let r=t;for(let t=0;t<e.length;t++)r=o("modulo",r,e[t]);return r},p=(...t)=>t.reduce((t,e)=>t+e)/t.length,f=(...t)=>{const e=t.length;if(0===e)return NaN;const r=p(...t);return t.reduce((t,e)=>t+(e-r)**2,0)/e},d=(...t)=>{let e,r=[],s=0,n=t.length;for(e=0;e<n;e++)s=h(s,t[e]),r.push(s);return r},g=(t,e)=>{if(0===t.length)return NaN;let r=[...t].sort((t,e)=>t-e),s=e/100*(r.length-1),n=Math.floor(s),i=s-n;return n===r.length-1?r[n]:r[n]*(1-i)+r[n+1]*i};class w{static int(t,e){return Math.floor(this.float(t,e))}static float(t,e){return void 0!==e?Math.random()*(e-t)+t:Math.random()*t}static bin(){return this.int(2)}static oct(){return this.int(8)}static dec(){return this.int(10)}static hex(){return((t,e,r)=>{const s=parseInt(t,e);if(Number.isNaN(s))throw new TypeError("Invalid value for the given base");return s.toString(r)})(this.int(16),10,16)}static char(t=!1){const e=t?this.int(65,91):this.int(97,123);return String.fromCharCode(e)}static bool(){return Boolean(this.int(2))}static get color(){return{hex:()=>`#${this.int(16777215).toString(16).padStart(6,"0")}`,hexa:()=>{const[t,e,r,s]=Array.from({length:4},()=>this.int(255).toString(16).padStart(2,"0"));return`#${t}${e}${r}${s}`},rgb:()=>{const[t,e,r]=Array.from({length:3},()=>this.int(255));return`rgb(${t}, ${e}, ${r})`},rgba:()=>{const[t,e,r]=Array.from({length:3},()=>this.int(255));return`rgba(${t}, ${e}, ${r}, ${Math.random().toFixed(2)})`},hsl:()=>`hsl(${this.int(360)}, ${this.int(100)}%, ${this.int(100)}%)`,hsla:()=>`hsla(${this.int(360)}, ${this.int(100)}%, ${this.int(100)}%, ${Math.random().toFixed(2)})`,gray:()=>{const t=this.int(255);return`rgb(${t}, ${t}, ${t})`}}}static get sample(){const t=this;return{int:(e,r,s)=>Array.from({length:e},()=>t.int(r,s)),float:(e,r,s)=>Array.from({length:e},()=>t.float(r,s)),char:(e,r=!1)=>Array.from({length:e},()=>t.char(r)),bool:e=>Array.from({length:e},()=>t.bool()),bin:e=>Array.from({length:e},()=>t.bin()),oct:e=>Array.from({length:e},()=>t.oct()),dec:e=>Array.from({length:e},()=>t.dec()),hex:e=>Array.from({length:e},()=>t.hex()),get color(){return{hex:e=>Array.from({length:e},()=>t.color.hex()),hexa:e=>Array.from({length:e},()=>t.color.hexa()),rgb:e=>Array.from({length:e},()=>t.color.rgb()),rgba:e=>Array.from({length:e},()=>t.color.rgba()),hsl:e=>Array.from({length:e},()=>t.color.hsl()),hsla:e=>Array.from({length:e},()=>t.color.hsla()),gray:e=>Array.from({length:e},()=>t.color.gray())}},choice:(e,r,s)=>Array.from({length:e},()=>t.choice(r,s))}}static shuffle(t){return[...t].sort(()=>.5-Math.random())}static choice(t=[1,2,3],e=new Array(t.length).fill(1/t.length)){const r=d(...e).map(t=>100*t),s=new Array(100);s.fill(t[0],0,r[0]);for(let e=1;e<t.length;e++)s.fill(t[e],r[e-1],r[e]);return s[this.int(s.length)]}}globalThis.Random=w;class y{constructor(t=0,e=0){[this.a,this.b]=((t,e,r)=>{let s,n;return e instanceof t?(s=e.a,n=e.b):"object"==typeof e?"a"in e&&"b"in e?(s=e.a,n=e.b):"a"in e&&"z"in e?(s=e.a,n=Math.sqrt(e.z**2-e.a**2)):"a"in e&&"phi"in e?(s=e.a,n=e.a*Math.tan(e.phi)):"b"in e&&"z"in e?(n=e.b,s=Math.sqrt(e.z**2-e.b**2)):"b"in e&&"phi"in e?(n=r,s=e.b/Math.tan(e.phi)):"z"in e&&"phi"in e&&(s=+e.z*Math.cos(e.phi).toFixed(15),n=+e.z*Math.sin(e.phi).toFixed(15)):"number"==typeof e&&"number"==typeof r&&(s=+e.toFixed(32),n=+r.toFixed(32)),[s,n]})(y,t,e)}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}serialize(){return JSON.stringify({type:"complex",data:this})}static deserialize(t){"string"==typeof t&&(t=JSON.parse(t));let{data:e,type:r}=t;return"complex"===r&&"a"in e&&"b"in e?new y(e.a,e.b):TypeError("Not a valid complex")}toFixed(t){return this.a=+this.a.toFixed(t),this.b=+this.b.toFixed(t),this}toPrecision(t){return this.a=+this.a.toPrecision(t),this.b=+this.b.toPrecision(t),this}clone(){return new y(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 y(0,0)}static fromPolar(t,e){return new y(+(t*cos(e)).toFixed(13),+(t*sin(e)).toFixed(13))}static get random(){return{int:(t,e)=>new y(...w.sample.int(2,t,e)),float:(t,e)=>new y(...w.sample.float(2,t,e))}}static twiddle(t,e){const r=-2*Math.PI*t/e;return new y(Math.cos(r),Math.sin(r))}get conj(){return new y(this.a,-this.b)}get inv(){return new y(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 y(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 y(t[e],0)),this.a-=t[e].a,this.b-=t[e].b;return this}mul(...t){let{z:e,phi:r}=this;for(let s=0;s<t.length;s++)"number"==typeof t[s]&&(t[s]=new y(t[s],0)),e*=t[s].z,r+=t[s].phi;return this.a=e*Math.cos(r),this.b=e*Math.sin(r),this.toFixed(8)}div(...t){let{z:e,phi:r}=this;for(let s=0;s<t.length;s++)"number"==typeof t[s]&&(t[s]=new y(t[s],0)),e/=t[s].z,r-=t[s].phi;return this.a=e*Math.cos(r),this.b=e*Math.sin(r),this.toFixed(8)}modulo(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new y(t[e],0)),this.a%=t[e].a,this.b%=t[e].b;return this}pow(...t){let{z:e,phi:r}=this;for(let s=0;s<t.length;s++)"number"==typeof t[s]&&(t[s]=new y(t[s],0)),e*=Math.exp(t[s].a*Math.log(e)-t[s].b*r),r+=t[s].b*Math.log(e)+t[s].a*r;return this.a=e*Math.cos(r),this.b=e*Math.sin(r),this}get expo(){return[this.z,this.phi]}nthr(t=2){return v({z:this.z**(1/t),phi:this.phi/t})}get sqrt(){return this.nthr(2)}get cbrt(){return this.nthr(3)}get log(){return v(this.z,this.phi)}get cos(){return v(Math.cos(this.a)*Math.cosh(this.b),Math.sin(this.a)*Math.sinh(this.b))}get sin(){return v(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 v(Math.sin(2*this.a)/t,Math.sinh(2*this.b)/t)}}const v=(t,e)=>{if((t instanceof Array||ArrayBuffer.isView(t))&&(e instanceof Array||ArrayBuffer.isView(t)))return t.map((r,s)=>v(t[s],e[s]));if(t.isMatrix?.()&&e.isMatrix?.()){if(t.shape[0]!==e.shape[0]||t.shape[1]!==e.shape[1])return Error(0);const r=t.arr.map((r,s)=>v(t.arr[s],e.arr[s]));return new t.constructor(t.rows,t.cols,...r)}return new y(t,e)},x=(...t)=>n(t=>t.isComplex?.()?t.z:Math.abs(t),...t),_=(...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)},M=(...t)=>n(t=>t.isComplex?.()?new t.constructor({z:t.z**.5,phi:t.phi/2}):t<0?v(0,Math.sqrt(-t)).toFixed(8):+Math.sqrt(t).toFixed(8),...t),k=(...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?v(0,(-t)**(1/e)).toFixed(8):+(-1*(-t)**(1/e)).toFixed(8):+(t**(1/e)).toFixed(8),...t)},C=(...t)=>n(t=>t.isComplex?.()?new t.constructor(Math.log(t.z),t.phi).toFixed(8):+Math.log(t).toFixed(8),...t),E=(...t)=>n(t=>t.isComplex?.()?new t.constructor(Math.floor(t.a),Math.floor(t.b)):Math.floor(t),...t),T=(t,e,r)=>i(t,t=>e!==r?(t-e)/(r-e):0),S=(t,e,r)=>i(t,t=>(r-e)*t+e),A=(t,e,r)=>i(t,t=>Math.min(Math.max(t,e),r)),j=(t,e,r,s,n)=>i(t,t=>S(T(t,e,r),s,n)),O=(t,e,r=!0)=>{if(t instanceof Array&&!(e instanceof Array))return n(t=>O(t,e,r),...t);if(e instanceof Array&&!(t instanceof Array))return n(e=>O(t,e,r),...e);if(t instanceof Array&&e instanceof Array)return t.map((t,s)=>O(t,e[s],r));const s=Math.atan2(t,e);return r?s:180*s/Math.PI},I=t=>t.isComplex?.()?new t.constructor(I(t.a),I(t.b)):t.isMatrix?.()?new t.constructor(t.rows,t.cols,t.arr.flat(1).map(I)):+!t,R=(t,e)=>{if(t.every(t=>t.isComplex?.())){const r=t.map(t=>t.a),s=t.map(t=>t.b);return new t[0].constructor(e(...r),e(...s))}if(t.every(t=>t.isMatrix?.())){if(!t.every(e=>e.rows===t[0].rows&&e.cols===t[0].cols))return TypeError("All matrices must have the same shape");const{rows:r,cols:s}=t[0],n=Array.from({length:r},(r,n)=>Array.from({length:s},(r,s)=>e(...t.map(t=>t.arr[n][s]))));return new t[0].constructor(n)}return null},z=(...t)=>{const e=R(t,z);return null!==e?e:t.reduce((t,e)=>t&e,1)},P=(...t)=>{const e=R(t,P);return null!==e?e:t.reduce((t,e)=>t|e,0)},F=(...t)=>{const e=R(t,F);return null!==e?e:t.reduce((t,e)=>t^e,0)},$=(t,e)=>{for(let e=0;e<t.arr.length;e++)Object.defineProperty(t,e,{value:t.arr[e],writable:!0,configurable:!0,enumerable:!1});for(let r=t.arr.length;r<e;r++)delete t[r]};function D(t,e){var r=[];for(let e=0;e<t.length;e++)r.push(t[e].slice(0));r.splice(0,1);for(let t=0;t<r.length;t++)r[t].splice(e,1);return r}function L(t,e){if(t=t.clone(),e=e.clone(),t.rows!==e.rows)return;let r=t.arr;for(let s=0;s<t.rows;s++)for(let n=t.cols;n<t.cols+e.cols;n++)r[s][n]=e.arr[s][n-t.cols];return t.cols+=e.cols,new t.constructor(t.rows,t.cols,r.flat(1))}function U(t,e){if(t=t.clone(),e=e.clone(),t.cols!==e.cols)return;let r=t.arr;for(let s=t.rows;s<t.rows+e.rows;s++){r[s]=[];for(let n=0;n<t.cols;n++)r[s][n]=e.arr[s-t.rows][n]}return t.rows+=e.rows,new t.constructor(t.rows,t.cols,r.flat(1))}class N{constructor(t,e,r=[]){[this.rows,this.cols,this.arr]=((t,e,r,s)=>{if(!(e instanceof t)){let t,n,i=[];if(e instanceof Array)i=e,e=i.length,r=i[0].length;else for(t=0;t<e;t++)for(i.push([]),i[t].push(new Array(r)),n=0;n<r;n++)i[t][n]=s[t*r+n],null==s[t*r+n]&&(i[t][n]=0);return[e,r,i]}arr=e.arr,r=(e=e.rows).cols})(N,t,e,r),$(this)}isMatrix(){return!0}clone(){return new N(this.rows,this.cols,this.arr.flat(1))}toComplex(){return this.arr=n(t=>t?.isComplex?.()?t:new y(t,0),...this.arr),$(this),this}[Symbol.iterator](){return this.arr[Symbol.iterator]()}get size(){return this.rows*this.cols}get shape(){return[this.rows,this.cols]}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,r=this.rows-1,s=this.cols-1){r<0&&(r=this.rows+r),s<0&&(s=this.cols+s);let n=r-t,i=s-e,o=new Array(i);for(let r=0;r<n;r++){o[r]=[];for(let s=0;s<i;s++)o[r][s]=this.arr[r+t][s+e]}return this.arr=o,$(this.rows),this.rows=n,this.cols=i,this}reshape(t,e){if(t*e!==this.rows*this.cols)throw Error("size not matched");const r=this.rows;return Object.assign(this,new N(t,e,this.arr.flat(1))),$(r),this}get T(){let t=[];for(let e=0;e<this.arr[0].length;e++){t[e]=[];for(let r=0;r<this.arr.length;r++)t[e][r]=this.arr[r][e]}return new N(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 ..."):l(c(e[0][0],e[1][1]),c(e[0][1],e[1][0]));for(var r=0,s=0;s<e.length;s++){const n=h(c(_(-1,s),c(e[0][s],t(D(e,s)))));r=h(r,n)}return r}(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 r=0,s=0,n=0,i=e.length,o=0,a=[],h=[];for(r=0;r<i;r+=1)for(a[a.length]=[],h[h.length]=[],n=0;n<i;n+=1)a[r][n]=r==n?1:0,h[r][n]=e[r][n];for(r=0;r<i;r+=1){if(0==(o=h[r][r])){for(s=r+1;s<i;s+=1)if(0!=h[s][r]){for(n=0;n<i;n++)o=h[r][n],h[r][n]=h[s][n],h[s][n]=o,o=a[r][n],a[r][n]=a[s][n],a[s][n]=o;break}if(0==(o=h[r][r]))return}for(n=0;n<i;n++)h[r][n]=h[r][n]/o,a[r][n]=a[r][n]/o;for(s=0;s<i;s++)if(s!=r)for(o=h[s][r],n=0;n<i;n++)h[s][n]-=o*h[r][n],a[s][n]-=o*a[r][n]}return new t.constructor(a)}}(this)}static eye(t){let e=new N(t,t);for(let r=0;r<t;r++)for(let s=0;s<t;s++)e.arr[r][s]=r===s?1:0;return e}static zeros(t,e){let r=new N(t,e);for(let n=0;n<t;n++)for(var s=0;s<e;s++)r.arr[n][s]=0;return r}static ones(t,e){let r=new N(t,e);for(let s=0;s<t;s++)for(let t=0;t<e;t++)r.arr[s][t]=1;return r}static nums(t,e,r){let s=new N(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)s.arr[n][t]=r;return s}static get random(){return{int:(t,e,r,s)=>new N(t,e,w.sample.int(t*e,r,s)),float:(t,e,r)=>new N(t,e,w.sample.float(t*e,r,b))}}get range(){return{map:(t,e,r,s)=>(this.arr=j(this.arr,t,e,r,s),this),norm:(t,e)=>(this.arr=T(this.arr,t,e),this),lerp:(t,e)=>(this.arr=S(this.arr,t,e),this),clamp:(t,e)=>(this.arr=A(this.arr,t,e),this)}}hstack(...t){const e=[this,...t].reduce((t,e)=>L(t,e));return Object.assign(this,e),$(this),this}vstack(...t){const e=[this,...t].reduce((t,e)=>U(t,e));return Object.assign(this,e),$(this),this}hqueue(...t){const e=[this,...t].reverse().reduce((t,e)=>L(t,e));return Object.assign(this,e),$(this),this}vqueue(...t){const e=[this,...t].reverse().reduce((t,e)=>U(t,e));return Object.assign(this,e),$(this),this}forEach(t){return this.arr.flat(1).forEach(t),this}forEachRow(t){return this.arr.forEach(t),this}forEachCol(t){return this.clone().T.forEachRow(t),this}map(t){const e=this.arr.flat(1).map(t);return new N(this.rows,this.cols,e)}mapRows(t=()=>{}){return this.arr=this.arr.map(t),this}mapCols(t){return this.clone().T.mapRows(t).T}sort(t=()=>{}){const e=this.arr.flat(1).sort(t);return new N(this.rows,this.cols,e)}shuffle(){return this.sort(()=>.5-Math.random())}sortRows(t=()=>{}){return this.arr=this.arr.map(e=>e.sort(t)),this}shuffleRows(){return this.sortRows(()=>.5-Math.random())}sortCols(t){return this.clone().T.sortRows(t).T}shuffleCols(){return this.sortCols(()=>.5-Math.random())}reduce(t,e){const r=e?this.arr.flat(1).reduce(t,e):this.arr.flat(1).reduce(t);return new N([[r]])}reduceRows(t,e){const r=e?this.arr.map(r=>r.reduce(t,e)):this.arr.map(e=>e.reduce(t));return new N(1,this.cols,r)}reduceCols(t,e){return this.T.reduceRows(t,e).T}filterRows(t){const e=this.arr.map(e=>e.some(e=>t(e))),r=[];let s;for(s=0;s<e.length;s++)e[s]&&r.push(this.arr[s]);return new N(r)}filterCols(t){const e=this.T.filterRows(t);return new N(e).T}every(t){return this.arr.flat(1).every(t)}everyRow(t){return this.arr.map(e=>e.every(t))}everyCol(t){return this.T.arr.map(e=>e.every(t))}some(t){return this.arr.flat(1).some(t)}someRow(t){return this.arr.map(e=>e.some(t))}someCol(t){return this.T.arr.map(e=>e.some(t))}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 r=e+1;r<t;r++)if(this.arr[e][r]!==-this.arr[r][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 r=e+1;r<t;r++)if(0!==this.arr[e][r]||0!==this.arr[r][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,r=[];for(let s=0;s<t;s++){r[s]=[];for(let n=0;n<t;n++){let i=0;for(let r=0;r<t;r++)i+=e[s][r]*e[r][n];r[s][n]=i}}for(let s=0;s<t;s++)for(let n=0;n<t;n++)if(r[s][n]!==e[s][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 r=e+1;r<t;r++)if(0!==this.arr[e][r])return!1;return!0}toPrecision(t){for(let e=0;e<this.cols;e++)for(let r=0;r<this.rows;r++)this.arr[e][r]=+this.arr[e][r].toPrecision(t);return this}toFixed(t){for(let e=0;e<this.cols;e++)for(let r=0;r<this.rows;r++)this.arr[e][r]=+this.arr[e][r].toFixed(t);return this}splice(t,e,r,...s){}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)}#t(t,...e){for(let s=0;s<e.length;s++){("number"==typeof e[s]||e[s]?.isComplex?.())&&(e[s]=N.nums(this.rows,this.cols,e[s]));for(let n=0;n<this.rows;n++)for(var r=0;r<this.cols;r++)this.arr[n][r]=t(this.arr[n][r],e[s].arr[n][r])}return new N(this.rows,this.cols,this.arr.flat(1))}add(...t){return this.#t(h,...t)}sub(...t){return this.#t(l,...t)}mul(...t){return this.#t(c,...t)}div(...t){return this.#t(u,...t)}modulo(...t){return this.#t(m,...t)}dot(t){for(var e=[],r=0;r<this.arr.length;r++){e[r]=[];for(var s=0;s<t.arr[0].length;s++){e[r][s]=0;for(var n=0;n<this.arr[0].length;n++)e[r][s]=h(e[r][s],c(this.arr[r][n],t.arr[n][s]))}}return new N(this.arr.length,t.arr[0].length,e.flat(1))}pow(t){let e=this.clone(),r=this.clone();for(let s=0;s<t-1;s++)r=r.dot(e);return r}sum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.cols;r++)t=h(t,this.arr[e][r]);return t}prod(){let t=1;for(let e=0;e<this.rows;e++)for(let r=0;r<this.cols;r++)t=c(t,this.arr[e][r]);return t}hasComplex(){return this.arr.flat(1/0).some(t=>t instanceof y)}get min(){this.hasComplex()&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(Math.min(...this.arr[e]));return Math.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(Math.max(...this.arr[e]));return Math.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(Math.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(Math.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 N(t.length,1,t)}serialize(){const t=n(t=>t.serialize?.()||t,...this.arr);return JSON.stringify({type:"matrix",data:{rows:this.rows,cols:this.cols,arr:t}})}static deserialize(t){"string"==typeof t&&(t=JSON.parse(t));const{type:e,data:r}=t;if("matrix"!==e)return TypeError("Not a valid Matrix");let{arr:s}=r;return s=n(t=>{if("string"==typeof t){const e=JSON.parse(t),{type:r}=e;if("complex"===r)return y.deserialize(e)}return t},...s),new N(s)}flip(){return this.flipeH().flipeV()}flipeH(){return this.arr=this.arr.map(t=>[...t].reverse()),$(this),this}flipeV(){return this.arr=this.arr.reverse(),$(this),this}}const q=t=>new Array(t).fill(0),Z=t=>new Array(t).fill(1),B=(t,e)=>new Array(e).fill(t),V=(t,e,r,s=!1)=>{let n=[];if(t<e)for(let i=t;s?i<=e:i<e;i+=r)n.push(10*i/10);else for(let i=t;s?i>=e:i>e;i-=r)n.push(10*i/10);return n},G=(t,e,r=x(e-t)+1,s=!0)=>{if(Math.floor(r)===r){if([t,e].every(t=>"number"==typeof t)){const[o,a]=[t,e].sort((t,e)=>e-t);var n=[];let h;h=s?(o-a)/(r-1):(o-a)/r;for(var i=0;i<r;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 r.constructor(t),i=new r.constructor(e);r=r||Math.abs(n.a-i.a)+1;const o=G(n.a,i.a,r,s),a=G(n.b,i.b,r,s);let h=new Array(r).fill(null);return h=h.map((t,e)=>new t.constructor(o[e],a[e])),h}}},H=(t,e,s=e-t+1,n=r,i=!0)=>G(t,e,s,i).map(t=>_(n,t)),W=(t,e,r=x(e-t)+1,s=!0)=>{if(Math.floor(r)===r){if([t,e].every(t=>"number"==typeof t)){const[n,i]=[t,e].sort((t,e)=>e-t);let o;o=k(n/i,s?r-1:r);const a=[i];for(let t=1;t<r;t++)a.push(a[t-1]*o);return t<e?a:a.reverse()}if([t,e].some(t=>t.isComplex?.())){const n=new r.constructor(t),i=new r.constructor(e);let o;r=r||Math.abs(n.a-i.a)+1,o=k(i.div(n),s?r-1:r);const a=[n];for(let t=1;t<r;t++)a.push(c(a[t-1],o));return a}}},K=(t,e,r)=>{const[s,n]=[Math.min(e,r),Math.max(e,r)];return t>=s&&t<=n},J=(t,e,r=1e-4)=>Math.abs(t-e)<=r,Y=(t,e)=>t.reduce((t,r)=>[...t,...e.map(t=>[r,t])],[]),Q=(t,e)=>{let r,s=1;if(t==E(t)&&e==E(e)){for(r=2;r<=t&&r<=e;++r)t%r==0&&e%r==0&&(s=r);return s}console.log("error")},X=(t,e)=>{let r;if(t==E(t)&&e==E(e)){for(r=t>e?t:e;r%t!=0||r%e!=0;)++r;return r}console.log("error")},tt={zeros:q,ones:Z,nums:B,arange:V,linspace:G,logspace:H,geomspace:W,cartesianProduct:Y,ppcm:X,pgcd:Q,inRange:K,isApproximatlyEqual:J};class et{constructor(t){this.cache={node:t}}isUINode(){return!0}get node(){return this.cache.node}}class rt 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 st=new rt,nt={default:{target:null,render:!0,math:{mode:"deg"}},setDefault:function(t){const e=Object.keys(t),r=Object.values(t);for(let t=0;t<e.length;t++)this.default[e[t]]=r[t]},init:()=>{},renderingMode:"spa",isSSC:!1},it={store:new Map,index:0,register:function(t){this.store.set(this.index++,t)},reset(){this.index=0,this.store.clear()}},ot={ui_index:0,get_ui_index:function(){return this.ui_index++},register_ui:function(t){}};class at{#e;#r;#s;#n;#i;#o;constructor(t=""){this.#e=new BroadcastChannel(t),this.#r=new Map,this.#s=new Map,this.#n="ziko-channel:"+1e17*Math.random(),this.#i=new Set([this.#n]),this.#o=new Set,this.#e.addEventListener("message",t=>{const{last_sent_event:e,userId:r,eventData:s,rooms:n}=t.data;if(r===this.#n)return;if(n&&n.length&&!n.some(t=>this.#o.has(t)))return;this.#i.add(r),this.#r=new Map(s);const i=this.#s.get(e);i&&i.forEach(({fn:t,rooms:r})=>{r&&0!==r.length&&n&&!n.some(t=>r.includes(t))||t(this.#r.get(e))})})}emit(t,e,r){return this.#r.set(t,e),"string"==typeof r&&(r=[r]),this.#e.postMessage({eventData:Array.from(this.#r.entries()),last_sent_event:t,userId:this.#n,rooms:r&&r.length?r:void 0}),this}on(t,e=console.log,r){return this.#s.has(t)||this.#s.set(t,[]),"string"==typeof r&&(r=[r]),this.#s.get(t).push({fn:e,rooms:r}),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,r){const s=r=>{e(r),this.off(t,s)};return this.on(t,s,r),this}join(...t){return t.forEach(t=>this.#o.add(t)),this}leave(...t){return t.length?t.forEach(t=>this.#o.delete(t)):this.#o.clear(),this}close(){return this.#e.close(),this}}const ht=t=>new at(t);class lt{constructor(t,e,r,s=!0){this.cache={storage:t,globalKey:e,channel:s?ht(`Ziko:useStorage-${e}`):null,oldItemKeys:new Set},this.#a(r,s)}get items(){const t=this.cache.storage.getItem(this.cache.globalKey);if(!t)return{};try{return JSON.parse(t)}catch{return{}}}#h(){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)}#a(t,e){if(e&&this.cache.channel&&this.cache.channel.on("Ziko-Storage-Updated",()=>this.#h()),t)if(this.cache.storage.getItem(this.cache.globalKey)){const t=this.items;Object.keys(t).forEach(t=>this.cache.oldItemKeys.add(t)),this.#h()}else this.set(t);else this.#h()}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.#h(),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.#h(),this}onStorageUpdated(t){return this.cache.channel&&this.cache.channel.on("Ziko-Storage-Updated",t),this}}const ct=(t,e,r=!0)=>new lt(sessionStorage,t,e,r);var ut={store:new Map,index:0,session_storage:null,register:function(t){if(!(void 0).SSR&&(void 0).DEV){this.session||(this.session_storage=ct("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 mt(){var t;globalThis?.__Ziko__||(globalThis.__Ziko__={__UI__:st,__HYDRATION__:it,__State__:ut,__Config__:nt,__CACHE__:ot,__PROVIDERS__:{}},t=__Ziko__,Object.defineProperties(t,{QueryParams:{get:function(){return function(t){const e={};return t.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi,t=>{const[r,s]=t.split("=");e[r]=s}),e}(globalThis.location.search.substring(1))},configurable:!1,enumerable:!0},HashParams:{get:function(){return globalThis.location.hash.substring(1).split("#")},configurable:!1,enumerable:!0}}))}mt();class pt extends et{constructor(){super()}init(t,e,r,s){if(this.target=globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body,"string"==typeof t)switch(r){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,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 rt,globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this],t&&s&&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 ft(t,...e){e.forEach(e=>function(t,e){const r=Object.getOwnPropertyDescriptors(e);for(const e of Reflect.ownKeys(r)){const s=r[e];"get"in s||"set"in s||"function"!=typeof s.value?Object.defineProperty(Object.getPrototypeOf(t),e,s):"function"==typeof s.value&&(Object.getPrototypeOf(t).hasOwnProperty(e)||Object.defineProperty(Object.getPrototypeOf(t),e,s))}}(t,e))}var dt=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 gt(t){const{store:e,index:r}=__Ziko__.__State__;__Ziko__.__State__.register({value:t,subscribers:new Set,paused:!1});let s=e.get(r);return[function(){return{value:s.value,isStateGetter:()=>!0,_subscribe:t=>s.subscribers.add(t)}},function(t){s.paused||("function"==typeof t&&(t=t(s.value)),t!==s.value&&(s.value=t,s.subscribers.forEach(t=>t(s.value)),__Ziko__.__State__.update(r,t)))},{pause:()=>{s.paused=!0},resume:()=>{s.paused=!1},clear:()=>{s.subscribers.clear()},force:t=>{"function"==typeof t&&(t=t(s.value)),s.value=t,s.subscribers.forEach(t=>t(s.value))},getSubscribers:()=>new Set(s.subscribers)}]}globalThis.__Ziko__||mt();const bt=t=>"function"==typeof t&&t?.()?.isStateGetter?.(),wt=(t="")=>t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase()),yt=(t="")=>{if(0===t.length)return!1;return/^[a-z][a-zA-Z0-9]*$/.test(t)};function vt(t,e){if(globalThis.SVGAElement&&this.element instanceof globalThis.SVGAElement&&(t=yt(t)?wt(t):t),!this?.attr[t]||this?.attr[t]!==e){if(bt(e)){e()._subscribe(e=>this.element?.setAttribute(t,e),this)}else this.element?.setAttribute(t,e);Object.assign(this.cache.attributes,{[t]:e})}}var xt=Object.freeze({__proto__:null,_set_attrs_:vt,getAttr:function(t){return t=yt(t)?wt(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[r,s]=[Object.keys(t),Object.values(t)];for(let t=0;t<r.length;t++)s[t]instanceof Array&&(e[t]=s[t].join(" ")),vt.call(this,r[t],s[t])}else e instanceof Array&&(e=e.join(" ")),vt.call(this,t,e);return this},setContentEditable:function(t=!0){return this.setAttr("contenteditable",t),this}});class _t extends et{constructor(...t){super("span","text",!1,...t),this.element=globalThis?.document?.createTextNode(...t)}isText(){return!0}}const Mt=(...t)=>new _t(...t);async function kt(t,e,...r){if(this.cache.isFrozzen)return console.warn("You can't append new item to frozzen element"),this;for(let s=0;s<r.length;s++){if(["number","string"].includes(typeof r[s])&&(r[s]=Mt(r[s])),r[s]instanceof Function){const t=r[s]();t.isStateGetter&&(r[s]=Mt(t.value),t._subscribe(t=>r[s].element.textContent=t,r[s]))}if("function"==typeof globalThis?.Node&&r[s]instanceof globalThis?.Node&&(r[s]=new this.constructor(r[s])),r[s]?.isUINode)r[s].cache.parent=this,this.element?.[t](r[s].element),r[s].target=this.element,this.items[e](r[s]);else if(r[s]instanceof Promise){const n=await r[s];n.cache.parent=this,this.element?.[t](n.element),n.target=this.element,this.items[e](n)}else r[s]instanceof Object&&(r[s]?.style&&this.style(r[s]?.style),r[s]?.attr&&Object.entries(r[s].attr).forEach(t=>this.setAttr(""+t[0],t[1])))}return this.maintain(),this}var Ct=Object.freeze({__proto__:null,__addItem__:kt,after:function(t){return t?.isUIElement&&(t=t.element),this.element?.after(t),this},append:function(...t){return kt.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 r=0;r<e.length;r++)["number","string"].includes(typeof e[r])&&(e[r]=Mt(e[r])),this.element?.insertBefore(e[r].element,this.items[t].element),this.items.splice(t,0,e[r]);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 r=0;r<t.length;r++)e(t[r]);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}});var Et=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 Tt=Object.freeze({__proto__:null,animate:function(t,{duration:e=1e3,iterations:r=1,easing:s="ease"}={}){return this.element?.animate(t,{duration:e,iterations:r,easing:s}),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 r=t[e];if(bt(r)){const t=r();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]:r})}return this}});class St{constructor(t,e){this.cache={category:e,target:t,listeners:{},currentEvent:null,event:null,customEvents:new Set}}get event(){return this.cache.event}get target(){return this.cache.target}get element(){return this.cache.target.element}get currentEvent(){return this.cache.currentEvent}addListener(t,e,{preventDefault:r=!1,paused:s=!1}={}){return this.cache.listeners[t]={callback:r=>{this.cache.event=r,this.cache.listeners[t].preventDefault&&r.preventDefault(),this.cache.listeners[t].paused||(this.cache.currentEvent=t,e.call(this,this))},preventDefault:r,paused:s},this.element.addEventListener(t,this.cache.listeners[t].callback),this}removeListener(t){return this.element.removeEventListener(t,this.cache.listeners[t].callback),this}pause(t){return this.cache.listeners[t].paused=!0,this}resume(t){return this.cache.listeners[t].paused=!1,this}preventDefault(t){return this.cache.listeners[t].preventDefault=!0,this}useDefault(t){return this.cache.listeners[t].preventDefault=!1,this}}class At extends Event{constructor(t,e){super("clickaway",{bubbles:!0,cancelable:!0}),this.originalEvent=t,this.targetElement=e}}function jt(t){function e(e){if(!t.contains(e.target)){const r=new At(e,t);t.dispatchEvent(r)}}return globalThis?.document?.addEventListener("click",e),()=>globalThis?.document?.removeEventListener("click",e)}const Ot=(t,e=!1)=>{const r=t.element.getBoundingClientRect(),s=t.event;let n=s?.clientX-r.left|0,i=s?.clientY-r.top|0;if(e){const e=t.element.clientWidth,r=t.element.clientHeight;n=+(n/e*2-1).toFixed(8),i=+(i/r*-2+1).toFixed(8)}return{x:n,y:i}},It="click",Rt={onClick(t){return this.on("click",t,{category:It})},onDblClick(t){return this.on("dblclick",t,{category:It})},onClickAway(t){var e,r,s;return e=this,r=It,s="clickaway",e.exp.events?.[r]?.cache?.customEvents?.has(s)||jt(this.element),this.on("clickaway",t,{category:It,isCustom:!0})}},zt="ptr",Pt={onPtrDown(t,e=!1){return this.on("pointerdown",t,{category:zt,details_setter:t=>{const{x:r,y:s}=Ot(t,e);t.dx=r,t.dy=s,t.isDown=!0,t.isDragging=t.isMoving??!1}})},onPtrMove(t,e=!1){return this.on("pointermove",t,{category:zt,details_setter:t=>{const{x:r,y:s}=Ot(t,e);t.mx=r,t.my=s,t.isMoving=!0,t.isDragging=t.isDown??!1}})},onPtrUp(t,e=!1){return this.on("pointerup",t,{category:zt,details_setter:t=>{const{x:r,y:s}=Ot(t,e);t.ux=r,t.uy=s,t.isDown=!1,t.isMoving=!1,t.isDragging=!1}})}},Ft="key",$t={onKeyDown(t){return this.on("keydown",t,{category:Ft,details_setter:t=>{t.kd=t.event.key}})},onKeyPress(t){return this.on("keypress",t,{category:Ft,details_setter:t=>{t.kp=t.event.key}})},onKeyUp(t){return this.on("keydown",t,{category:Ft,details_setter:t=>{t.ku=t.event.key}})}},Dt=(t,e)=>{let r=0;return(...s)=>{const n=(new Date).getTime();n-r<e||(r=n,t(...s))}};class Lt extends CustomEvent{constructor(t,e,{bubbles:r=!0,cancelable:s=!0}={}){super(t,{detail:e,bubbles:r,cancelable:s})}}function Ut(t,{intersection:e=!0,resize:r=!0,threshold:s=0,throttleResize:n=100,throttleEnterExit:i=0}={}){let o,a;const h=e=>{for(let r of e){const{width:e,height:s}=r.contentRect;t.dispatchEvent(new Lt("resizeview",{width:e,height:s,entry:r}))}},l=n>0?Dt(h,n):h,c=e=>{for(let r of e){const e=r.isIntersecting?"enterview":"exitview";t.dispatchEvent(new Lt(e,r))}},u=i>0?Dt(c,i):c;return e&&(o=new IntersectionObserver(u,{threshold:s}),o.observe(t)),r&&(a=new ResizeObserver(l),a.observe(t)),()=>{o&&(o.unobserve(t),o.disconnect()),a&&(a.unobserve(t),a.disconnect())}}const Nt="view",qt={onEnterView(t){return this.exp.events?.[Nt]||Ut(this.element),this.on("enterview",t,{category:Nt,isCustom:!0})},onExitView(t){return this.exp.events?.[Nt]||Ut(this.element),this.on("exitview",t,{category:Nt,isCustom:!0})},onResizeView(t){return this.exp.events?.[Nt]||Ut(this.element),this.on("resizeview",t,{category:Nt,isCustom:!0})}};class Zt extends CustomEvent{constructor(t,e){super(t,{detail:e,bubbles:!0,cancelable:!0})}}let Bt=class extends pt{constructor({element:t,name:e="",type:r="html",render:s=__Ziko__.__Config__.default.render}={}){super(),this.exp={events:{}},ft(this,dt,xt,Ct,Tt,Et,Pt,Rt,$t,qt),t&&this.init(t,e,r,s)}on(t,e,{details_setter:r,category:s="global",isCustom:n=!1,preventDefault:i=!1}={}){s&&!this.exp.events.hasOwnProperty(s)&&(this.exp.events[s]=new St(this,s)),n&&this.exp.events[s].cache.customEvents.add(t);const o=this.exp.events[s];return o.addListener(t,t=>{r&&r(o),e(t)},{preventDefault:i}),this}_off(t,e="global"){this.exp.events[e].removeListener(t)}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}};function Vt(t){return"object"!=typeof t&&"function"!=typeof t||null===t}class Gt extends Bt{constructor(...t){super({element:"div",name:"view"}),this.append(...t)}}const Ht=["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"],Wt=["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"],Kt=["math","annotation","merror","mfrac","mi","mprescripts","mn","mo","mover","mpadded","mphantom","mprescripts","mroot","mrow","ms","semantics","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"],Jt=new Proxy({},{get(t,e){if("string"!=typeof e)return;let r,s=e.replaceAll("_","-").toLowerCase();return Ht.includes(s)&&(r="html"),Wt.includes(s)&&(r="svg"),Kt.includes(s)&&(r="mathml"),(...t)=>0===t.length?new Bt({element:s,name:s,type:r}):["string","number"].includes(typeof t[0])||t[0]instanceof Bt||"function"==typeof t[0]&&t[0]().isStateGetter()?new Bt({element:s,name:s,type:r}).append(...t):new Bt({element:s,type:r}).setAttr(t.shift()).append(...t)}});function Yt(t){return 1==t?this.style({flexDirection:"column"}):-1==t&&this.style({flexDirection:"column-reverse"}),this}function Qt(t){return 1==t?this.style({flexDirection:"row"}):-1==t&&this.style({flexDirection:"row-reverse"}),this}function Xt(t){return"number"==typeof t&&(t=["flex-start","center","flex-end"][t+1]),t}function te(t){return Xt(-t)}class ee extends Bt{constructor({tag:t="div",orientation:e="h",order:r,w:s="100%",h:n="100%"}={}){super({element:t,name:"Flex"}),this.direction="cols",this.style({display:"flex"})}isFlex(){return!0}responsify(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,r=1){return Yt.call(this,r),this.style({alignItems:"number"==typeof t?Xt.call(this,t):t,justifyContent:"number"==typeof e?te.call(this,e):e}),this}horizontal(t,e,r=1){return Qt.call(this,r),this.style({alignItems:"number"==typeof e?te.call(this,e):e,justifyContent:"number"==typeof t?Xt.call(this,t):t}),this}show(){return this.isHidden=!1,this.style({display:"flex"}),this}}class re extends pt{constructor({element:t,name:e,type:r,render:s}){super({element:t,name:e,type:r,render:s})}}class se extends re{constructor(t,e){super({element:"div",name:"suspense"}),this.setAttr({dataTemp:"suspense"}),this.fallback_ui=t,this.append(t),(async()=>{try{const r=await e();t.unmount(),this.append(r)}catch(t){console.log({error:t})}})()}}class ne extends Bt{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 ie extends Bt{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:r,attributes:s}=e,n=document.createElementNS("http://www.w3.org/2000/svg","svg");for(let{name:t,value:e}of s)n.setAttribute(t,e);return n.append(...r),globalThis.svg=e,globalThis.children=r,globalThis.attributes=s,globalThis.element=n,n}throw new Error("DOMParser is not available in this environment")}(t)),this.style({display:"contents"})}}class oe extends Bt{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{PI:ae,sqrt:he,cos:le,sin:ce,acos:ue,pow:me}=Math,pe=t=>t,fe=(t,e=7.5625,r=2.75)=>t<1/r?e*t*t:t<2/r?e*(t-=1.5/r)*t+.75:t<2.5/r?e*(t-=2.25/r)*t+.9375:e*(t-=2.625/r)*t+.984375;class de{constructor(t,{ease:e=pe,step:r=50,t0:s=0,start:n=!0,duration:i=3e3}={}){this.callback=t,this.state={isRunning:!1,animationId:null,startTime:null,ease:e,step:r,autoStart:n,duration:i},this.t=0,this.tx=0,this.ty=0,this.i=0,this.state.autoStart&&this.start()}#l=()=>{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)};#c(t=!0){return this.state.isRunning||(t&&this.reset(!1),this.state.isRunning=!0,this.state.startTime=Date.now(),this.state.animationId=setInterval(this.#l,this.state.step)),this}start(){return this.#c(!0)}pause(){return this.state.isRunning&&(clearInterval(this.state.animationId),this.state.isRunning=!1),this}resume(){return this.#c(!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 ge{constructor(t,e,r=1/0,s){this.ms=e,this.fn=t,this.count=r,this.frame=1,this.id=null,this.running=!1,s&&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 be extends ge{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 we{constructor(t=[],{repeat:e=1,loop:r=!1}={}){this.tasks=t,this.repeat=e,this.loop=r,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 r=>{e>0&&await new Promise(t=>setTimeout(t,e)),this.onTask&&this.onTask(t),await t(),r()})));else{const{fn:e,delay:r=0}=t;r>0&&await new Promise(t=>setTimeout(t,r)),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 ye{constructor(t,{step:e=1e3,t0:r=0,t1:s=1/0,autoplay:n=!0}={}){this.callback=t,this.cache={isRunning:!1,id:null,last_tick:null,step:e,t0:r,t1:s,autoplay:n,pauseTime:null,frame:0},n&&(r?this.startAfter(r):this.start(),s!==1/0&&this.stopAfter(s))}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)}}}const ve=(t,e=",")=>t.trim().trimEnd().split("\n").map(t=>t.split(e)),xe=(t,e=",")=>{const[r,...s]=ve(t,e);return s.map(t=>{const e={};return r.forEach((r,s)=>{e[r]=t[s]}),e})},_e=t=>t instanceof Array?[Object.keys(t[0]),...t.map(t=>Object.values(t))]:[Object.keys(t)],Me=(t,e)=>_e(t).map(t=>t.join(e)).join("\n"),ke=(t,e=",")=>Me(t instanceof Object?t:JSON.parse(t),e),Ce=(t,e)=>{const r=[];if(Array.isArray(t))t.forEach(t=>{if("object"==typeof t&&null!==t){r.push(`${e}-`);const s=Ce(t,`${e} `);r.push(...s)}else r.push(`${e}- ${t}`)});else for(const s in t)if(t.hasOwnProperty(s)){const n=t[s];if("object"==typeof n&&null!==n){r.push(`${e}${s}:`);const t=Ce(n,`${e} `);r.push(...t)}else r.push(`${e}${s}: ${n}`)}return r},Ee=(t,e="")=>Ce(t,e).join("\n"),Te=(t,e)=>Ee(t instanceof Object?t:JSON.parse(t),e),Se=(t,e=1)=>{let r="";for(const s in t)if(t.hasOwnProperty(s)){const n=t[s];r+="\n"+" ".repeat(e)+`<${s}>`,r+="object"==typeof n?Se(n,e+2):`${n}`,r+=`</${s}>`}return r.trim()},Ae=t=>(new XMLSerializer).serializeToString(t),je=t=>btoa(Ae(t)),Oe=t=>"data:image/svg+xml;base64,"+je(t),Ie=t=>JSON.stringify(n(t=>["number","string","boolean","bigint"].includes(typeof t)?String(t):t instanceof y||t instanceof N?t.toString():t instanceof Array?ze(t):void 0,t),null," ").replace(/"([^"]+)":/g,"$1:").replace(/: "([^"]+)"/g,": $1"),Re=t=>{if(!Array.isArray(t))return 0;let e=1;for(const r of t)if(Array.isArray(r)){const t=Re(r);t+1>e&&(e=t+1)}return e},ze=t=>{let e=0;return function t(r){let s=Re(r),n=0;return r.some(t=>Array.isArray(t))&&(e++,n=1),"["+r.map((s,n)=>["number","string","boolean","bigint"].includes(typeof s)?String(s):s instanceof y?s.toString():s instanceof Array?`\n${" ".repeat(e)}${t(s)}${n===r.length-1?"\n":""}`:s instanceof Object?Ie(s):void 0)+`${" ".repeat((s+e+1)*n)}]`}(t)},Pe=(t,e=0)=>{t=Fe(t);let r="";const s=" ".repeat(e);for(let n in t)if("object"==typeof t[n]){r+=`${s}${n} {\n`;const i=t[n];for(let t in i)"object"==typeof i[t]?r+=Pe({[t]:i[t]},e+1):r+=`${s} ${t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}: ${i[t]};\n`;r+=`${s}}\n`}return r};function Fe(t){return"object"!=typeof t||null===t?t:Object.keys(t).reduce((e,r)=>(e[r.trim()]=Fe(t[r]),e),Array.isArray(t)?[]:{})}class $e{constructor({head:t=null,wrapper:e=null,target:r=null}){this.head=t,this.wrapper=e,this.target=r,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 De(t){return/:\w+/.test(t)}class Le extends $e{constructor({head:t,wrapper:e,target:r,routes:s}){super({head:t,wrapper:e,target:r}),this.routes=new Map([["404",Mt("Error 404")],...Object.entries(s)]),this.clear(),globalThis.onpopstate=this.mount(location.pathname)}clear(){return[...this.routes].forEach(t=>{!De(t[0])&&t[1]?.isUIElement&&t[1].unmount()}),this}mount(t){const[e,r]=[...this.routes].find(e=>function(t,e){const r=t.split("/"),s=e.split("/");if(r.length!==s.length)return!1;for(let t=0;t<r.length;t++){const e=r[t],n=s[t];if(!e.startsWith(":")&&e!==n)return!1}return!0}(e[0],t));let s;if(De(e)){const n=function(t,e){const r=t.split("/"),s=e.split("/"),n={};if(r.length!==s.length)return n;for(let t=0;t<r.length;t++){const e=r[t],i=s[t];if(e.startsWith(":"))n[e.slice(1)]=i;else if(e!==i)return{}}return n}(e,t);s=r.call(this,n)}else r?.isUIElement&&r.mount(this.wrapper),"function"==typeof r&&(s=r());return s?.isUIElement&&s.mount(this.wrapper),s instanceof Promise&&s.then(t=>t.mount(this.wrapper)),globalThis.history.pushState({},"",t),this}}const Ue=({head:t,wrapper:e,target:r,routes:s})=>new Le({head:t,wrapper:e,target:r,routes:s});function Ne(t,e="./src/pages",r=["js","ts"]){"/"===e.at(-1)&&(e=e.slice(0,-1));const s=t.replace(/\\/g,"/").replace(/\[(\w+)\]/g,"$1/:$1").split("/"),n=e.split("/"),i=s.indexOf(n.at(-1));if(-1!==i){const t=s.slice(i+1),e=s.at(-1),n="index.js"===e||"index.ts"===e,o=r.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;#m=new Map;#p=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:r,error:s}=t.data,n=this.#m.get(e);n&&(n(r,s),this.#m.delete(e))})}call(t,e,r=[],s=!0){if("function"!=typeof t)throw new TypeError("func must be a function");const n=++this.#p;return this.#m.set(n,e),this.#u.postMessage({id:n,funStr:t.toString(),args:r,close:s}),this}terminate(){this.#u.terminate()}}class Ze{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 r=(...s)=>{this.off(t,r),e(...s)};return this.on(t,r)}off(t,e){const r=this.events[t];if(!r)return this;const s=r.indexOf(e);return-1!==s&&r.splice(s,1),this}emit(t,e){const r=this.events[t];return!!r&&([...r].forEach(r=>{try{r(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 Be=t=>new Ze(t);class Ve{#f;#d;#g=null;constructor(t=[],e=()=>{}){this.#f=t,this.#d=e,this.#a()}#b(){return this.#f.some(({query:t})=>globalThis.matchMedia(t).matches)}#a(){this.#f.forEach(({query:t,callback:e})=>{const r=globalThis.matchMedia(t),s=()=>{const t=this.#b();r.matches?(e(),this.#g=e):t||this.#g===this.#d||(this.#d(),this.#g=this.#d)};s(),r.addEventListener("change",s)})}}class Ge{constructor(t=document.title,e=!0){this.cache={emitter:null},e&&this.useEventEmitter(),this.set(t)}useEventEmitter(){return this.cache.emitter=Be(),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 He{constructor(t,{namespace:e="Ziko",ValidateCssProps:r=!1}={}){this.currentPropsMap=t,this.namespace=e,this.ValidateCssProps=r,this.use(t)}use(t){return this.ValidateCssProps&&function(t){const e=new Set(Object.keys(document.documentElement.style));for(const r in t)if(!e.has(r))throw new Error(`Invalid CSS property: "${r}"`)}(t),this.currentPropsMap=t,this.#h(),this}#h(){const t=globalThis?.document?.documentElement?.style;for(const e in this.currentPropsMap){const r=this.namespace?`--${this.namespace}-${e}`:`--${e}`;t.setProperty(r,this.currentPropsMap[e]),Object.defineProperty(this,e,{value:`var(${r})`,writable:!0,configurable:!0,enumerable:!1})}}}let{sqrt:We,cos:Ke,sin:Je,exp:Ye,log:Qe,cosh:Xe,sinh:tr}=Math;for(const t of Object.getOwnPropertyNames(Math)){const e=Math[t];"function"==typeof e&&(Math[t]=new Proxy(e,{apply(e,r,s){const n=s[0];if("number"==typeof n||0===s.length)return e.apply(r,s);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(We(o)*Ke(a/2),We(o)*Je(a/2));case"log":return h(Qe(o),a);case"exp":return h(Ye(t)*Ke(i),Ye(t)*Je(i));case"cos":return h(Ke(t)*Xe(i),-Je(t)*tr(i));case"sin":return h(Je(t)*Xe(i),Ke(t)*tr(i));case"tan":{const e=Ke(2*t)+Xe(2*i);return h(Je(2*t)/e,tr(2*i)/e)}case"cosh":return h(Xe(t)*Ke(i),tr(t)*Je(i));case"sinh":return h(tr(t)*Ke(i),Xe(t)*Je(i));case"tanh":{const e=Xe(2*t)+Ke(2*i);return h(tr(2*t)/e,Je(2*i)/e)}default:return e.apply(r,s)}}throw new TypeError(`Math.${t} expects only numbers`)}}))}globalThis?.document&&document?.addEventListener("DOMContentLoaded",__Ziko__.__Config__.init()),t.App=({head:t,wrapper:e,target:r})=>new $e({head:t,wrapper:e,target:r}),t.ClickAwayEvent=At,t.ClickListeners=Rt,t.Clock=be,t.CloneElement=t=>new t.__proto__.constructor,t.Complex=y,t.E=r,t.EPSILON=s,t.EventController=St,t.FileBasedRouting=async function(t){const e=Object.keys(t),r=function(t){if(0===t.length)return"";const e=t.map(t=>t.split("/")),r=Math.min(...e.map(t=>t.length));let s=[];for(let t=0;t<r;t++){const r=e[0][t];if(!e.every(e=>e[t]===r||e[t].startsWith("[")))break;s.push(r)}return s.join("/")+(s.length?"/":"")}(e),s={};for(let n=0;n<e.length;n++){const i=await t[e[n]](),o=await i.default;Object.assign(s,{[Ne(e[n],r)]:o})}return Ue({target:document.body,routes:{"/":()=>{},...s},wrapper:Jt.section()})},t.Flex=(...t)=>{let e="div";return"string"==typeof t[0]&&(e=t[0],t.pop()),new ee(e).append(...t)},t.HTMLWrapper=t=>new ne(t),t.KeyListeners=$t,t.Matrix=N,t.PI=e,t.PtrListeners=Pt,t.Random=w,t.SPA=Ue,t.SVGWrapper=t=>new ie(t),t.Scheduler=(t,{repeat:e=null}={})=>new we(t,{repeat:e}),t.Suspense=(t,e)=>new se(t,e),t.SwipeEvent=Zt,t.Switch=({key:t,cases:e})=>new oe(t,e),t.Tick=ge,t.TimeAnimation=de,t.TimeLoop=ye,t.TimeScheduler=we,t.UIElement=Bt,t.UIFlex=ee,t.UIHTMLWrapper=ne,t.UINode=et,t.UISVGWrapper=ie,t.UISwitch=oe,t.UIView=Gt,t.UseRoot=He,t.UseThread=qe,t.Utils=tt,t.View=(...t)=>new Gt(...t),t.ViewEvent=Lt,t.ViewListeners=qt,t.ZikoApp=$e,t.ZikoSPA=Le,t.ZikoUISuspense=se,t.ZikoUIText=_t,t.abs=x,t.accum_prod=(...t)=>{let e,r=[],s=1,n=t.length;for(e=0;e<n;e++)s=c(s,t[e]),r.push(s);return r},t.accum_sum=d,t.acos=(...t)=>n(t=>{if(t?.isComplex){const{a:e,b:r}=t,s=Math.hypot(e+1,r),n=Math.hypot(e-1,r);return globalThis.Rp=s,globalThis.Rm=n,new t.constructor(Math.acos((s-n)/2),-Math.acosh((s+n)/2)).toFixed(8)}return+Math.acos(t).toFixed(8)},...t),t.acosh=(...t)=>n(t=>t?.isComplex?C(t.clone().add(M(t.clone().mul(t.clone()).sub(1)))):+Math.acosh(t).toFixed(8),...t),t.acot=(...t)=>n(t=>{if(t?.isComplex){const{a:e,b:r}=t;return new t.constructor(Math.atan(2*e/(e**2+(r-1)*(r+1)))/2,Math.log((e**2+(r-1)**2)/(e**2+(r+1)**2))/4).toFixed(8)}return+(Math.PI/2-Math.atan(t)).toFixed(8)},...t),t.add=h,t.add_class=(t,e)=>t.element.className=t.element.className.replace(/\s+$/gi,"")+" "+e,t.add_vendor_prefix=function(t){const e=t.slice(0,1).toUpperCase()+t.slice(1),r=["Webkit","Moz","O","ms"];for(let t=0,s=r.length;t<s;t++){const s=r[t];if(void 0!==(globalThis?.document?.body).style[s+e])return s+e}return t},t.and=z,t.animation=(t,{ease:e,t0:r,t1:s,start:n,duration:i}={})=>new de(t,{ease:e,t0:r,t1:s,start:n,duration:i}),t.apply_fun=i,t.arange=V,t.arc=t=>1-ce(ue(t)),t.arr2str=ze,t.asin=(...t)=>n(t=>{if(t?.isComplex){const{a:e,b:r}=t,s=Math.hypot(e+1,r),n=Math.hypot(e-1,r);return new t.constructor(Math.asin((s-n)/2),Math.acosh((s+n)/2)).toFixed(8)}return+Math.asin(t).toFixed(8)},...t),t.asinh=(...t)=>n(t=>t?.isComplex?C(t.clone().add(M(t.clone().mul(t.clone()).add(1)))):+Math.asinh(t).toFixed(8),...t),t.atan=(...t)=>n(t=>{if(t?.isComplex){const{a:e,b:r}=t;return new t.constructor(Math.atan(2*e/(1-e**2-r**2))/2,Math.log((e**2+(1+r)**2)/(e**2+(1-r)**2))/4).toFixed(8)}return+Math.atan(t).toFixed(8)},...t),t.atan2=O,t.atanh=(...t)=>n(t=>+Math.atanh(t).toFixed(8),...t),t.back=(t,e=1)=>t**2*((e+1)*t-e),t.binomial=(t,e)=>{if(t!==Math.floor(t))return TypeError("n must be an integer");if(e!==Math.floor(e))return TypeError("k must be an integer");if(t<0)return TypeError("n must be non-negative");if(e<0||t<0||e>t)return 0;e>t-e&&(e=t-e);let r,s=1;for(r=0;r<e;r++)s=s*(t-r)/(r+1);return s},t.call_with_optional_props=t=>(...e)=>{const r=e[0];return r?.isUIElement?.()||Vt(r)?new t({},...e):new t(r,...e.slice(1))},t.cartesianProduct=Y,t.cbrt=(...t)=>n(t=>t.isComplex?.()?new t.constructor({z:t.z**(1/3),phi:t.phi/3}).toFixed(8):+Math.cbrt(t).toFixed(8),...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=A,t.clock=t=>new be(t),t.cloneUI=t=>Object.assign(Object.create(Object.getPrototypeOf(t)),t),t.complex=v,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)).toFixed(8):+Math.cos(t).toFixed(8),...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)).toFixed(8):+Math.cosh(t).toFixed(8),...t),t.coth=(...t)=>n(t=>{if(t?.isComplex){const{a:e,b:r}=t,s=Math.sinh(e)**2*Math.cos(r)**2+Math.cosh(e)**2*Math.sin(r)**2;return new t.constructor(Math.cosh(e)*Math.sinh(e)/s,-Math.sin(r)*Math.cos(r)/s).toFixed(8)}return+(1/Math.tanh(t)).toFixed(8)},...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:r,b:s}=e,{z:n,phi:i}=t,o=Math.hypot(r,s),a=Math.exp((Math.log(n)*r+i*s)/o),h=(i*r-Math.log(n)*s)/o;return new e.constructor(a*Math.cos(h),a*Math.sin(h)).toFixed(8)},...t)},t.csv2arr=ve,t.csv2json=(t,e=",")=>JSON.stringify(xe(t,e)),t.csv2matrix=(t,e=",")=>new N(ve(t,e)),t.csv2object=xe,t.csv2sql=(t,e)=>{const r=t.trim().trimEnd().split("\n").filter(t=>t);let s=`INSERT INTO ${e} (${r[0].split(",").join(", ")}) Values `,n=[];for(let t=1;t<r.length;t++){const e=r[t].split(",");n.push(`(${e})`)}return s+n.join(",\n")},t.debounce=(t,e=1e3)=>(...r)=>setTimeout(()=>t(...r),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[r,s]=t.split("=");e[r]=s}),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,r={},{mode:s="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(r)]}constructor(){super(),this.attachShadow({mode:s}),this.props={},this.mask={...r}}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,r){Object.assign(this.props,{[t]:this.mask[t].type(r)}),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=u,t.elastic=t=>-2*me(2,10*(t-1))*le(20*ae*t/3*t),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)).toFixed(8):+Math.exp(t).toFixed(8),...t),t.floor=E,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=W,t.hypot=(...t)=>{const e=t.find(t=>t.isComplex?.());if(e){const r=t.map(t=>t.isComplex?.()?t:new e.constructor(t,0));return Math.hypot(...r.map(t=>t.z))}return Math.hypot(...t)},t.inRange=K,t.in_back=(t,e=1.70158,r=e+1)=>r*me(t,3)-e*t**2,t.in_bounce=(t,e=7.5625,r=2.75)=>1-fe(1-t,e,r),t.in_circ=t=>1-he(1-t**2),t.in_cubic=t=>t**3,t.in_elastic=(t,e=2*ae/3)=>0===t?0:1===t?1:-me(2,10*t-10)*ce((10*t-10.75)*e),t.in_expo=t=>0===t?0:2**(10*t-10),t.in_out_back=(t,e=1.70158,r=1.525*e)=>t<.5?me(2*t,2)*(2*(r+1)*t-r)/2:(me(2*t-2,2)*((r+1)*(2*t-2)+r)+2)/2,t.in_out_bounce=(t,e=7.5625,r=2.75)=>t<.5?fe(1-2*t,e,r)/2:fe(2*t-1,e,r)/2,t.in_out_circ=t=>t<.5?(1-he(1-(2*t)**2))/2:(he(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*ae/4.5)=>0===t?0:1===t?1:t<.5?-me(2,20*t-10)*ce((20*t-11.125)*e)/2:me(2,-20*t+10)*ce((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=>-(le(ae*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-le(t*ae/2),t.isApproximatlyEqual=J,t.isPrimitive=Vt,t.isStateGetter=bt,t.json2arr=t=>_e(t instanceof Object?t:JSON.parse(t)),t.json2css=Pe,t.json2csv=ke,t.json2csvFile=(t,e)=>{const r=ke(t,e),s=new Blob([r],{type:"text/csv;charset=utf-8;"});return{str:r,blob:s,url:URL.createObjectURL(s)}},t.json2xml=Se,t.json2xmlFile=(t,e)=>{const r=Se(t,e),s=new Blob([r],{type:"text/xml;charset=utf-8;"});return{str:r,blob:s,url:URL.createObjectURL(s)}},t.json2yml=Te,t.json2ymlFile=(t,e)=>{const r=Te(t,e),s=new Blob([r],{type:"text/yml;charset=utf-8;"});return{str:r,blob:s,url:URL.createObjectURL(s)}},t.lerp=S,t.linear=pe,t.linkStyle=function(t){const e=document?.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("href",t),document.head.appendChild(e)},t.linspace=G,t.ln=C,t.logspace=H,t.loop=(t,e={})=>new ye(t,e),t.map=j,t.mapfun=n,t.matrix=(t,e,r)=>new N(t,e,r),t.matrix2=(...t)=>new N(2,2,t),t.matrix3=(...t)=>new N(3,3,t),t.matrix4=(...t)=>new N(4,4,t),t.max=(...t)=>Math.max(...t),t.mean=p,t.median=t=>g(t,50),t.min=(...t)=>Math.min(...t),t.modulo=m,t.mul=c,t.nand=(...t)=>I(z(...t)),t.nor=(...t)=>I(P(...t)),t.norm=T,t.normalize_css_value=t=>"number"==typeof t?t+"px":t,t.nthr=k,t.nums=B,t.obj2str=Ie,t.ones=Z,t.or=P,t.out_back=(t,e=1.70158,r=e+1)=>1+r*me(t-1,3)+e*me(t-1,2),t.out_bounce=fe,t.out_circ=t=>he(1-(t-1)**2),t.out_cubic=t=>1-(1-t)**3,t.out_elastic=(t,e=2*ae/3)=>0===t?0:1===t?1:me(2,-10*t)*ce((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=>ce(t*ae/2),t.percentile=g,t.pgcd=Q,t.pow=_,t.ppcm=X,t.rad2deg=(...t)=>n(t=>t/Math.PI*180,...t),t.register_click_away_event=jt,t.register_swipe_event=function(t,e=5,r=100,s=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 l(h){if(!a)return;a=!1;const l=h.clientX-n,c=h.clientY-i;let u=null,m=null;performance.now()-o<=s&&(Math.abs(l)>=e&&Math.abs(c)<=r?(u=l<0?"left":"right",m="swipe"+u):Math.abs(c)>=e&&Math.abs(l)<=r&&(u=c<0?"up":"down",m="swipe"+u)),m&&t.dispatchEvent(new Zt(m,{direction:u,distX:l,distY:c,originalEvent:h}))}return t.addEventListener("pointerdown",h,{passive:!0}),t.addEventListener("pointerup",l,{passive:!0}),()=>{t.removeEventListener("pointerdown",h),t.removeEventListener("pointerup",l)}},t.register_view_event=Ut,t.remove_class=(t,e)=>t.element.className=t.element.className.replace(e,""),t.round=(...t)=>n(t=>t.isComplex?.()?new t.constructor(Math.round(t.a),Math.round(t.b)):Math.round(t),...t),t.script=function(t){const e=document?.createElement("script");e.setAttribute("src",t),document.head.appendChild(e)},t.sec=(...t)=>n(t=>(t.isComplex?.(),+(1/Math.cos(t)).toFixed(8)),...t),t.sig=(...t)=>n(t=>1/(1+Math.exp(-t)).toFixed(8),...t),t.sign=(...t)=>n(t=>{if(t.isComplex?.()){const{z:e,phi:r}=t;return 0===e?new t.constructor(0,0):new t.constructor({z:1,phi:r})}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)).toFixed(8):+Math.sin(t).toFixed(8),...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)).toFixed(8):+Math.sinh(t).toFixed(8),...t),t.sleep=t=>new Promise(e=>setTimeout(e,t)),t.sqrt=M,t.std=(...t)=>Math.sqrt(f(...t)),t.step=(t,e=5)=>Math.floor(t*e)/e,t.step_fps=t=>1e3/t,t.style=(t,e)=>{t&&Object.assign(t.style,e)},t.sub=l,t.svg2ascii=je,t.svg2img=(t,e=!0)=>Jt.img(Oe(t)).mount(e),t.svg2imgUrl=Oe,t.svg2str=Ae,t.tags=Jt,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).toFixed(8)}return+Math.tan(t).toFixed(8)},...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).toFixed(8)}return+Math.tanh(t).toFixed(8)},...t),t.text=Mt,t.throttle=Dt,t.tick=(t,e,r=1/0,s=!0)=>new ge(t,e,r,s),t.timeTaken=t=>{console.time("timeTaken");const e=t();return console.timeEnd("timeTaken"),e},t.time_memory_Taken=t=>{const e=Date.now(),r=performance.memory.usedJSHeapSize,s=t();return{elapsedTime:Date.now()-e,usedMemory:performance.memory.usedJSHeapSize-r,result:s}},t.timeout=function(t,e){let r;const s=new Promise(s=>{r=setTimeout(()=>{e&&e(),s()},t)});return{id:r,clear:()=>clearTimeout(r),promise:s}},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 r=t(...e.map(t=>t().value));const s=new Set;return e.forEach(n=>{n()._subscribe(()=>{{const n=t(...e.map(t=>t().value));n!==r&&(r=n,s.forEach(t=>t(r)))}})}),()=>({value:r,isStateGetter:()=>!0,_subscribe:t=>s.add(t)})},t.useEventEmitter=Be,t.useIPC=ht,t.useLocaleStorage=(t,e,r=!0)=>new lt(localStorage,t,e,r),t.useMediaQuery=(t,e)=>new Ve(t,e),t.useReactive=t=>n(t=>{const e=gt(t);return{get:e[0],set:e[1]}},t),t.useRoot=(t,e={})=>new He(t,e),t.useSessionStorage=ct,t.useState=gt,t.useThread=(t,e,r=[],s=!0)=>(new qe).call(t,e,r,s),t.useTitle=(t,e=!0)=>new Ge(t,e),t.variance=f,t.wait=t=>new Promise(e=>setTimeout(e,t)),t.waitElm=t=>new Promise(e=>{if(t)return e(t);const r=new MutationObserver(()=>{t&&(e(t),r.disconnect())});r.observe(document?.body,{childList:!0,subtree:!0})}),t.waitForUIElm=t=>new Promise(e=>{if(t.element)return e(t.element);const r=new MutationObserver(()=>{t.element&&(e(t.element),r.disconnect())});r.observe(document?.body,{childList:!0,subtree:!0})}),t.waitForUIElmSync=(t,e=2e3)=>{const r=Date.now();for(;Date.now()-r<e;)if(t.element)return t.element},t.xnor=(...t)=>I(F(...t)),t.xor=F,t.zeros=q});
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:r}=Math,s=Number.EPSILON,n=(t,...e)=>{const r=e.map(e=>{return"object"!=typeof(r=e)&&"function"!=typeof r||null===r||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 r});return 1==r.length?r[0]:r},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)),o=(t,e,r)=>{if("number"==typeof e){if("number"==typeof r)switch(t){case"add":return e+r;case"sub":return e-r;case"mul":return e*r;case"div":return e/r;case"modulo":return e%r}return r?.isComplex?.()&&(e=new r.constructor(e,0)),r?.isMatrix?.()&&(e=r.constructor.nums(r.rows,r.cols,e)),e[t](r)}if(e?.isComplex?.()){if("number"==typeof r||r?.isComplex?.())return e.clone()[t](r);if(r?.isMatrix?.())return(e=r.constructor.nums(r.rows,r.cols,e)).clone()[t](r)}if(e?.isMatrix?.())return e.clone()[t](r)},h=(t,...e)=>{let r=t;for(let t=0;t<e.length;t++)r=o("add",r,e[t]);return r},c=(t,...e)=>{let r=t;for(let t=0;t<e.length;t++)r=o("sub",r,e[t]);return r},l=(t,...e)=>{let r=t;for(let t=0;t<e.length;t++)r=o("mul",r,e[t]);return r},u=(t,...e)=>{let r=t;for(let t=0;t<e.length;t++)r=o("div",r,e[t]);return r},m=(t,...e)=>{let r=t;for(let t=0;t<e.length;t++)r=o("modulo",r,e[t]);return r},p=(...t)=>t.reduce((t,e)=>t+e)/t.length,f=(...t)=>{const e=t.length;if(0===e)return NaN;const r=p(...t);return t.reduce((t,e)=>t+(e-r)**2,0)/e},d=(...t)=>{let e,r=[],s=0,n=t.length;for(e=0;e<n;e++)s=h(s,t[e]),r.push(s);return r},g=(t,e)=>{if(0===t.length)return NaN;let r=[...t].sort((t,e)=>t-e),s=e/100*(r.length-1),n=Math.floor(s),i=s-n;return n===r.length-1?r[n]:r[n]*(1-i)+r[n+1]*i};class w{static int(t,e){return Math.floor(this.float(t,e))}static float(t,e){return void 0!==e?Math.random()*(e-t)+t:Math.random()*t}static bin(){return this.int(2)}static oct(){return this.int(8)}static dec(){return this.int(10)}static hex(){return((t,e,r)=>{const s=parseInt(t,e);if(Number.isNaN(s))throw new TypeError("Invalid value for the given base");return s.toString(r)})(this.int(16),10,16)}static char(t=!1){const e=t?this.int(65,91):this.int(97,123);return String.fromCharCode(e)}static bool(){return Boolean(this.int(2))}static get color(){return{hex:()=>`#${this.int(16777215).toString(16).padStart(6,"0")}`,hexa:()=>{const[t,e,r,s]=Array.from({length:4},()=>this.int(255).toString(16).padStart(2,"0"));return`#${t}${e}${r}${s}`},rgb:()=>{const[t,e,r]=Array.from({length:3},()=>this.int(255));return`rgb(${t}, ${e}, ${r})`},rgba:()=>{const[t,e,r]=Array.from({length:3},()=>this.int(255));return`rgba(${t}, ${e}, ${r}, ${Math.random().toFixed(2)})`},hsl:()=>`hsl(${this.int(360)}, ${this.int(100)}%, ${this.int(100)}%)`,hsla:()=>`hsla(${this.int(360)}, ${this.int(100)}%, ${this.int(100)}%, ${Math.random().toFixed(2)})`,gray:()=>{const t=this.int(255);return`rgb(${t}, ${t}, ${t})`}}}static get sample(){const t=this;return{int:(e,r,s)=>Array.from({length:e},()=>t.int(r,s)),float:(e,r,s)=>Array.from({length:e},()=>t.float(r,s)),char:(e,r=!1)=>Array.from({length:e},()=>t.char(r)),bool:e=>Array.from({length:e},()=>t.bool()),bin:e=>Array.from({length:e},()=>t.bin()),oct:e=>Array.from({length:e},()=>t.oct()),dec:e=>Array.from({length:e},()=>t.dec()),hex:e=>Array.from({length:e},()=>t.hex()),get color(){return{hex:e=>Array.from({length:e},()=>t.color.hex()),hexa:e=>Array.from({length:e},()=>t.color.hexa()),rgb:e=>Array.from({length:e},()=>t.color.rgb()),rgba:e=>Array.from({length:e},()=>t.color.rgba()),hsl:e=>Array.from({length:e},()=>t.color.hsl()),hsla:e=>Array.from({length:e},()=>t.color.hsla()),gray:e=>Array.from({length:e},()=>t.color.gray())}},choice:(e,r,s)=>Array.from({length:e},()=>t.choice(r,s))}}static shuffle(t){return[...t].sort(()=>.5-Math.random())}static choice(t=[1,2,3],e=new Array(t.length).fill(1/t.length)){const r=d(...e).map(t=>100*t),s=new Array(100);s.fill(t[0],0,r[0]);for(let e=1;e<t.length;e++)s.fill(t[e],r[e-1],r[e]);return s[this.int(s.length)]}}globalThis.Random=w;class y{constructor(t=0,e=0){[this.a,this.b]=((t,e,r)=>{let s,n;return e instanceof t?(s=e.a,n=e.b):"object"==typeof e?"a"in e&&"b"in e?(s=e.a,n=e.b):"a"in e&&"z"in e?(s=e.a,n=Math.sqrt(e.z**2-e.a**2)):"a"in e&&"phi"in e?(s=e.a,n=e.a*Math.tan(e.phi)):"b"in e&&"z"in e?(n=e.b,s=Math.sqrt(e.z**2-e.b**2)):"b"in e&&"phi"in e?(n=r,s=e.b/Math.tan(e.phi)):"z"in e&&"phi"in e&&(s=+e.z*Math.cos(e.phi).toFixed(15),n=+e.z*Math.sin(e.phi).toFixed(15)):"number"==typeof e&&"number"==typeof r&&(s=+e.toFixed(32),n=+r.toFixed(32)),[s,n]})(y,t,e)}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}serialize(){return JSON.stringify({type:"complex",data:this})}static deserialize(t){"string"==typeof t&&(t=JSON.parse(t));let{data:e,type:r}=t;return"complex"===r&&"a"in e&&"b"in e?new y(e.a,e.b):TypeError("Not a valid complex")}toFixed(t){return this.a=+this.a.toFixed(t),this.b=+this.b.toFixed(t),this}toPrecision(t){return this.a=+this.a.toPrecision(t),this.b=+this.b.toPrecision(t),this}clone(){return new y(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 y(0,0)}static fromPolar(t,e){return new y(+(t*cos(e)).toFixed(13),+(t*sin(e)).toFixed(13))}static get random(){return{int:(t,e)=>new y(...w.sample.int(2,t,e)),float:(t,e)=>new y(...w.sample.float(2,t,e))}}static twiddle(t,e){const r=-2*Math.PI*t/e;return new y(Math.cos(r),Math.sin(r))}get conj(){return new y(this.a,-this.b)}get inv(){return new y(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 y(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 y(t[e],0)),this.a-=t[e].a,this.b-=t[e].b;return this}mul(...t){let{z:e,phi:r}=this;for(let s=0;s<t.length;s++)"number"==typeof t[s]&&(t[s]=new y(t[s],0)),e*=t[s].z,r+=t[s].phi;return this.a=e*Math.cos(r),this.b=e*Math.sin(r),this.toFixed(8)}div(...t){let{z:e,phi:r}=this;for(let s=0;s<t.length;s++)"number"==typeof t[s]&&(t[s]=new y(t[s],0)),e/=t[s].z,r-=t[s].phi;return this.a=e*Math.cos(r),this.b=e*Math.sin(r),this.toFixed(8)}modulo(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new y(t[e],0)),this.a%=t[e].a,this.b%=t[e].b;return this}pow(...t){let{z:e,phi:r}=this;for(let s=0;s<t.length;s++)"number"==typeof t[s]&&(t[s]=new y(t[s],0)),e*=Math.exp(t[s].a*Math.log(e)-t[s].b*r),r+=t[s].b*Math.log(e)+t[s].a*r;return this.a=e*Math.cos(r),this.b=e*Math.sin(r),this}get expo(){return[this.z,this.phi]}nthr(t=2){return v({z:this.z**(1/t),phi:this.phi/t})}get sqrt(){return this.nthr(2)}get cbrt(){return this.nthr(3)}get log(){return v(this.z,this.phi)}get cos(){return v(Math.cos(this.a)*Math.cosh(this.b),Math.sin(this.a)*Math.sinh(this.b))}get sin(){return v(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 v(Math.sin(2*this.a)/t,Math.sinh(2*this.b)/t)}}const v=(t,e)=>{if((t instanceof Array||ArrayBuffer.isView(t))&&(e instanceof Array||ArrayBuffer.isView(t)))return t.map((r,s)=>v(t[s],e[s]));if(t.isMatrix?.()&&e.isMatrix?.()){if(t.shape[0]!==e.shape[0]||t.shape[1]!==e.shape[1])return Error(0);const r=t.arr.map((r,s)=>v(t.arr[s],e.arr[s]));return new t.constructor(t.rows,t.cols,...r)}return new y(t,e)},x=(...t)=>n(t=>t.isComplex?.()?t.z:Math.abs(t),...t),_=(...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)},M=(...t)=>n(t=>t.isComplex?.()?new t.constructor({z:t.z**.5,phi:t.phi/2}):t<0?v(0,Math.sqrt(-t)).toFixed(8):+Math.sqrt(t).toFixed(8),...t),k=(...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?v(0,(-t)**(1/e)).toFixed(8):+(-1*(-t)**(1/e)).toFixed(8):+(t**(1/e)).toFixed(8),...t)},C=(...t)=>n(t=>t.isComplex?.()?new t.constructor(Math.log(t.z),t.phi).toFixed(8):+Math.log(t).toFixed(8),...t),E=(...t)=>n(t=>t.isComplex?.()?new t.constructor(Math.floor(t.a),Math.floor(t.b)):Math.floor(t),...t),T=(t,e,r)=>i(t,t=>e!==r?(t-e)/(r-e):0),S=(t,e,r)=>i(t,t=>(r-e)*t+e),A=(t,e,r)=>i(t,t=>Math.min(Math.max(t,e),r)),j=(t,e,r,s,n)=>i(t,t=>S(T(t,e,r),s,n)),O=(t,e,r=!0)=>{if(t instanceof Array&&!(e instanceof Array))return n(t=>O(t,e,r),...t);if(e instanceof Array&&!(t instanceof Array))return n(e=>O(t,e,r),...e);if(t instanceof Array&&e instanceof Array)return t.map((t,s)=>O(t,e[s],r));const s=Math.atan2(t,e);return r?s:180*s/Math.PI},R=t=>t.isComplex?.()?new t.constructor(R(t.a),R(t.b)):t.isMatrix?.()?new t.constructor(t.rows,t.cols,t.arr.flat(1).map(R)):+!t,I=(t,e)=>{if(t.every(t=>t.isComplex?.())){const r=t.map(t=>t.a),s=t.map(t=>t.b);return new t[0].constructor(e(...r),e(...s))}if(t.every(t=>t.isMatrix?.())){if(!t.every(e=>e.rows===t[0].rows&&e.cols===t[0].cols))return TypeError("All matrices must have the same shape");const{rows:r,cols:s}=t[0],n=Array.from({length:r},(r,n)=>Array.from({length:s},(r,s)=>e(...t.map(t=>t.arr[n][s]))));return new t[0].constructor(n)}return null},P=(...t)=>{const e=I(t,P);return null!==e?e:t.reduce((t,e)=>t&e,1)},z=(...t)=>{const e=I(t,z);return null!==e?e:t.reduce((t,e)=>t|e,0)},$=(...t)=>{const e=I(t,$);return null!==e?e:t.reduce((t,e)=>t^e,0)},F=(t,e)=>{for(let e=0;e<t.arr.length;e++)Object.defineProperty(t,e,{value:t.arr[e],writable:!0,configurable:!0,enumerable:!1});for(let r=t.arr.length;r<e;r++)delete t[r]};function D(t,e){var r=[];for(let e=0;e<t.length;e++)r.push(t[e].slice(0));r.splice(0,1);for(let t=0;t<r.length;t++)r[t].splice(e,1);return r}function L(t,e){if(t=t.clone(),e=e.clone(),t.rows!==e.rows)return;let r=t.arr;for(let s=0;s<t.rows;s++)for(let n=t.cols;n<t.cols+e.cols;n++)r[s][n]=e.arr[s][n-t.cols];return t.cols+=e.cols,new t.constructor(t.rows,t.cols,r.flat(1))}function U(t,e){if(t=t.clone(),e=e.clone(),t.cols!==e.cols)return;let r=t.arr;for(let s=t.rows;s<t.rows+e.rows;s++){r[s]=[];for(let n=0;n<t.cols;n++)r[s][n]=e.arr[s-t.rows][n]}return t.rows+=e.rows,new t.constructor(t.rows,t.cols,r.flat(1))}class N{constructor(t,e,r=[]){[this.rows,this.cols,this.arr]=((t,e,r,s)=>{if(!(e instanceof t)){let t,n,i=[];if(e instanceof Array)i=e,e=i.length,r=i[0].length;else for(t=0;t<e;t++)for(i.push([]),i[t].push(new Array(r)),n=0;n<r;n++)i[t][n]=s[t*r+n],null==s[t*r+n]&&(i[t][n]=0);return[e,r,i]}arr=e.arr,r=(e=e.rows).cols})(N,t,e,r),F(this)}isMatrix(){return!0}clone(){return new N(this.rows,this.cols,this.arr.flat(1))}toComplex(){return this.arr=n(t=>t?.isComplex?.()?t:new y(t,0),...this.arr),F(this),this}[Symbol.iterator](){return this.arr[Symbol.iterator]()}get size(){return this.rows*this.cols}get shape(){return[this.rows,this.cols]}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,r=this.rows-1,s=this.cols-1){r<0&&(r=this.rows+r),s<0&&(s=this.cols+s);let n=r-t,i=s-e,o=new Array(i);for(let r=0;r<n;r++){o[r]=[];for(let s=0;s<i;s++)o[r][s]=this.arr[r+t][s+e]}return this.arr=o,F(this.rows),this.rows=n,this.cols=i,this}reshape(t,e){if(t*e!==this.rows*this.cols)throw Error("size not matched");const r=this.rows;return Object.assign(this,new N(t,e,this.arr.flat(1))),F(r),this}get T(){let t=[];for(let e=0;e<this.arr[0].length;e++){t[e]=[];for(let r=0;r<this.arr.length;r++)t[e][r]=this.arr[r][e]}return new N(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 ..."):c(l(e[0][0],e[1][1]),l(e[0][1],e[1][0]));for(var r=0,s=0;s<e.length;s++){const n=h(l(_(-1,s),l(e[0][s],t(D(e,s)))));r=h(r,n)}return r}(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 r=0,s=0,n=0,i=e.length,o=0,a=[],h=[];for(r=0;r<i;r+=1)for(a[a.length]=[],h[h.length]=[],n=0;n<i;n+=1)a[r][n]=r==n?1:0,h[r][n]=e[r][n];for(r=0;r<i;r+=1){if(0==(o=h[r][r])){for(s=r+1;s<i;s+=1)if(0!=h[s][r]){for(n=0;n<i;n++)o=h[r][n],h[r][n]=h[s][n],h[s][n]=o,o=a[r][n],a[r][n]=a[s][n],a[s][n]=o;break}if(0==(o=h[r][r]))return}for(n=0;n<i;n++)h[r][n]=h[r][n]/o,a[r][n]=a[r][n]/o;for(s=0;s<i;s++)if(s!=r)for(o=h[s][r],n=0;n<i;n++)h[s][n]-=o*h[r][n],a[s][n]-=o*a[r][n]}return new t.constructor(a)}}(this)}static eye(t){let e=new N(t,t);for(let r=0;r<t;r++)for(let s=0;s<t;s++)e.arr[r][s]=r===s?1:0;return e}static zeros(t,e){let r=new N(t,e);for(let n=0;n<t;n++)for(var s=0;s<e;s++)r.arr[n][s]=0;return r}static ones(t,e){let r=new N(t,e);for(let s=0;s<t;s++)for(let t=0;t<e;t++)r.arr[s][t]=1;return r}static nums(t,e,r){let s=new N(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)s.arr[n][t]=r;return s}static get random(){return{int:(t,e,r,s)=>new N(t,e,w.sample.int(t*e,r,s)),float:(t,e,r)=>new N(t,e,w.sample.float(t*e,r,b))}}get range(){return{map:(t,e,r,s)=>(this.arr=j(this.arr,t,e,r,s),this),norm:(t,e)=>(this.arr=T(this.arr,t,e),this),lerp:(t,e)=>(this.arr=S(this.arr,t,e),this),clamp:(t,e)=>(this.arr=A(this.arr,t,e),this)}}hstack(...t){const e=[this,...t].reduce((t,e)=>L(t,e));return Object.assign(this,e),F(this),this}vstack(...t){const e=[this,...t].reduce((t,e)=>U(t,e));return Object.assign(this,e),F(this),this}hqueue(...t){const e=[this,...t].reverse().reduce((t,e)=>L(t,e));return Object.assign(this,e),F(this),this}vqueue(...t){const e=[this,...t].reverse().reduce((t,e)=>U(t,e));return Object.assign(this,e),F(this),this}forEach(t){return this.arr.flat(1).forEach(t),this}forEachRow(t){return this.arr.forEach(t),this}forEachCol(t){return this.clone().T.forEachRow(t),this}map(t){const e=this.arr.flat(1).map(t);return new N(this.rows,this.cols,e)}mapRows(t=()=>{}){return this.arr=this.arr.map(t),this}mapCols(t){return this.clone().T.mapRows(t).T}sort(t=()=>{}){const e=this.arr.flat(1).sort(t);return new N(this.rows,this.cols,e)}shuffle(){return this.sort(()=>.5-Math.random())}sortRows(t=()=>{}){return this.arr=this.arr.map(e=>e.sort(t)),this}shuffleRows(){return this.sortRows(()=>.5-Math.random())}sortCols(t){return this.clone().T.sortRows(t).T}shuffleCols(){return this.sortCols(()=>.5-Math.random())}reduce(t,e){const r=e?this.arr.flat(1).reduce(t,e):this.arr.flat(1).reduce(t);return new N([[r]])}reduceRows(t,e){const r=e?this.arr.map(r=>r.reduce(t,e)):this.arr.map(e=>e.reduce(t));return new N(1,this.cols,r)}reduceCols(t,e){return this.T.reduceRows(t,e).T}filterRows(t){const e=this.arr.map(e=>e.some(e=>t(e))),r=[];let s;for(s=0;s<e.length;s++)e[s]&&r.push(this.arr[s]);return new N(r)}filterCols(t){const e=this.T.filterRows(t);return new N(e).T}every(t){return this.arr.flat(1).every(t)}everyRow(t){return this.arr.map(e=>e.every(t))}everyCol(t){return this.T.arr.map(e=>e.every(t))}some(t){return this.arr.flat(1).some(t)}someRow(t){return this.arr.map(e=>e.some(t))}someCol(t){return this.T.arr.map(e=>e.some(t))}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 r=e+1;r<t;r++)if(this.arr[e][r]!==-this.arr[r][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 r=e+1;r<t;r++)if(0!==this.arr[e][r]||0!==this.arr[r][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,r=[];for(let s=0;s<t;s++){r[s]=[];for(let n=0;n<t;n++){let i=0;for(let r=0;r<t;r++)i+=e[s][r]*e[r][n];r[s][n]=i}}for(let s=0;s<t;s++)for(let n=0;n<t;n++)if(r[s][n]!==e[s][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 r=e+1;r<t;r++)if(0!==this.arr[e][r])return!1;return!0}toPrecision(t){for(let e=0;e<this.cols;e++)for(let r=0;r<this.rows;r++)this.arr[e][r]=+this.arr[e][r].toPrecision(t);return this}toFixed(t){for(let e=0;e<this.cols;e++)for(let r=0;r<this.rows;r++)this.arr[e][r]=+this.arr[e][r].toFixed(t);return this}splice(t,e,r,...s){}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)}#t(t,...e){for(let s=0;s<e.length;s++){("number"==typeof e[s]||e[s]?.isComplex?.())&&(e[s]=N.nums(this.rows,this.cols,e[s]));for(let n=0;n<this.rows;n++)for(var r=0;r<this.cols;r++)this.arr[n][r]=t(this.arr[n][r],e[s].arr[n][r])}return new N(this.rows,this.cols,this.arr.flat(1))}add(...t){return this.#t(h,...t)}sub(...t){return this.#t(c,...t)}mul(...t){return this.#t(l,...t)}div(...t){return this.#t(u,...t)}modulo(...t){return this.#t(m,...t)}dot(t){for(var e=[],r=0;r<this.arr.length;r++){e[r]=[];for(var s=0;s<t.arr[0].length;s++){e[r][s]=0;for(var n=0;n<this.arr[0].length;n++)e[r][s]=h(e[r][s],l(this.arr[r][n],t.arr[n][s]))}}return new N(this.arr.length,t.arr[0].length,e.flat(1))}pow(t){let e=this.clone(),r=this.clone();for(let s=0;s<t-1;s++)r=r.dot(e);return r}sum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.cols;r++)t=h(t,this.arr[e][r]);return t}prod(){let t=1;for(let e=0;e<this.rows;e++)for(let r=0;r<this.cols;r++)t=l(t,this.arr[e][r]);return t}hasComplex(){return this.arr.flat(1/0).some(t=>t instanceof y)}get min(){this.hasComplex()&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(Math.min(...this.arr[e]));return Math.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(Math.max(...this.arr[e]));return Math.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(Math.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(Math.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 N(t.length,1,t)}serialize(){const t=n(t=>t.serialize?.()||t,...this.arr);return JSON.stringify({type:"matrix",data:{rows:this.rows,cols:this.cols,arr:t}})}static deserialize(t){"string"==typeof t&&(t=JSON.parse(t));const{type:e,data:r}=t;if("matrix"!==e)return TypeError("Not a valid Matrix");let{arr:s}=r;return s=n(t=>{if("string"==typeof t){const e=JSON.parse(t),{type:r}=e;if("complex"===r)return y.deserialize(e)}return t},...s),new N(s)}flip(){return this.flipeH().flipeV()}flipeH(){return this.arr=this.arr.map(t=>[...t].reverse()),F(this),this}flipeV(){return this.arr=this.arr.reverse(),F(this),this}}const q=t=>new Array(t).fill(0),Z=t=>new Array(t).fill(1),B=(t,e)=>new Array(e).fill(t),V=(t,e,r,s=!1)=>{let n=[];if(t<e)for(let i=t;s?i<=e:i<e;i+=r)n.push(10*i/10);else for(let i=t;s?i>=e:i>e;i-=r)n.push(10*i/10);return n},G=(t,e,r=x(e-t)+1,s=!0)=>{if(Math.floor(r)===r){if([t,e].every(t=>"number"==typeof t)){const[o,a]=[t,e].sort((t,e)=>e-t);var n=[];let h;h=s?(o-a)/(r-1):(o-a)/r;for(var i=0;i<r;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 r.constructor(t),i=new r.constructor(e);r=r||Math.abs(n.a-i.a)+1;const o=G(n.a,i.a,r,s),a=G(n.b,i.b,r,s);let h=new Array(r).fill(null);return h=h.map((t,e)=>new t.constructor(o[e],a[e])),h}}},H=(t,e,s=e-t+1,n=r,i=!0)=>G(t,e,s,i).map(t=>_(n,t)),W=(t,e,r=x(e-t)+1,s=!0)=>{if(Math.floor(r)===r){if([t,e].every(t=>"number"==typeof t)){const[n,i]=[t,e].sort((t,e)=>e-t);let o;o=k(n/i,s?r-1:r);const a=[i];for(let t=1;t<r;t++)a.push(a[t-1]*o);return t<e?a:a.reverse()}if([t,e].some(t=>t.isComplex?.())){const n=new r.constructor(t),i=new r.constructor(e);let o;r=r||Math.abs(n.a-i.a)+1,o=k(i.div(n),s?r-1:r);const a=[n];for(let t=1;t<r;t++)a.push(l(a[t-1],o));return a}}},K=(t,e,r)=>{const[s,n]=[Math.min(e,r),Math.max(e,r)];return t>=s&&t<=n},J=(t,e,r=1e-4)=>Math.abs(t-e)<=r,Q=(t,e)=>t.reduce((t,r)=>[...t,...e.map(t=>[r,t])],[]),Y=(t,e)=>{let r,s=1;if(t==E(t)&&e==E(e)){for(r=2;r<=t&&r<=e;++r)t%r==0&&e%r==0&&(s=r);return s}console.log("error")},X=(t,e)=>{let r;if(t==E(t)&&e==E(e)){for(r=t>e?t:e;r%t!=0||r%e!=0;)++r;return r}console.log("error")},tt={zeros:q,ones:Z,nums:B,arange:V,linspace:G,logspace:H,geomspace:W,cartesianProduct:Q,ppcm:X,pgcd:Y,inRange:K,isApproximatlyEqual:J};class et{constructor(t){this.cache={node:t}}isUINode(){return!0}get node(){return this.cache.node}}class rt 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 st=new rt,nt={default:{target:null,render:!0,math:{mode:"deg"}},setDefault:function(t){const e=Object.keys(t),r=Object.values(t);for(let t=0;t<e.length;t++)this.default[e[t]]=r[t]},init:()=>{},renderingMode:"spa",isSSC:!1},it={store:new Map,index:0,register:function(t){this.store.set(this.index++,t)},reset(){this.index=0,this.store.clear()}},ot={ui_index:0,get_ui_index:function(){return this.ui_index++},register_ui:function(t){}};class at{#e;#r;#s;#n;#i;#o;constructor(t=""){this.#e=new BroadcastChannel(t),this.#r=new Map,this.#s=new Map,this.#n="ziko-channel:"+1e17*Math.random(),this.#i=new Set([this.#n]),this.#o=new Set,this.#e.addEventListener("message",t=>{const{last_sent_event:e,userId:r,eventData:s,rooms:n}=t.data;if(r===this.#n)return;if(n&&n.length&&!n.some(t=>this.#o.has(t)))return;this.#i.add(r),this.#r=new Map(s);const i=this.#s.get(e);i&&i.forEach(({fn:t,rooms:r})=>{r&&0!==r.length&&n&&!n.some(t=>r.includes(t))||t(this.#r.get(e))})})}emit(t,e,r){return this.#r.set(t,e),"string"==typeof r&&(r=[r]),this.#e.postMessage({eventData:Array.from(this.#r.entries()),last_sent_event:t,userId:this.#n,rooms:r&&r.length?r:void 0}),this}on(t,e=console.log,r){return this.#s.has(t)||this.#s.set(t,[]),"string"==typeof r&&(r=[r]),this.#s.get(t).push({fn:e,rooms:r}),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,r){const s=r=>{e(r),this.off(t,s)};return this.on(t,s,r),this}join(...t){return t.forEach(t=>this.#o.add(t)),this}leave(...t){return t.length?t.forEach(t=>this.#o.delete(t)):this.#o.clear(),this}close(){return this.#e.close(),this}}const ht=t=>new at(t);class ct{constructor(t,e,r,s=!0){this.cache={storage:t,globalKey:e,channel:s?ht(`Ziko:useStorage-${e}`):null,oldItemKeys:new Set},this.#a(r,s)}get items(){const t=this.cache.storage.getItem(this.cache.globalKey);if(!t)return{};try{return JSON.parse(t)}catch{return{}}}#h(){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)}#a(t,e){if(e&&this.cache.channel&&this.cache.channel.on("Ziko-Storage-Updated",()=>this.#h()),t)if(this.cache.storage.getItem(this.cache.globalKey)){const t=this.items;Object.keys(t).forEach(t=>this.cache.oldItemKeys.add(t)),this.#h()}else this.set(t);else this.#h()}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.#h(),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.#h(),this}onStorageUpdated(t){return this.cache.channel&&this.cache.channel.on("Ziko-Storage-Updated",t),this}}const lt=(t,e,r=!0)=>new ct(sessionStorage,t,e,r);var ut={store:new Map,index:0,session_storage:null,register:function(t){if(!(void 0).SSR&&(void 0).DEV){this.session||(this.session_storage=lt("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 mt(){var t;globalThis?.__Ziko__||(globalThis.__Ziko__={__UI__:st,__HYDRATION__:it,__State__:ut,__Config__:nt,__CACHE__:ot,__PROVIDERS__:{}},t=__Ziko__,Object.defineProperties(t,{QueryParams:{get:function(){return function(t){const e={};return t.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi,t=>{const[r,s]=t.split("=");e[r]=s}),e}(globalThis.location.search.substring(1))},configurable:!1,enumerable:!0},HashParams:{get:function(){return globalThis.location.hash.substring(1).split("#")},configurable:!1,enumerable:!0}}))}mt();class pt extends et{constructor(){super()}init(t,e,r,s){if(this.target=globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body,"string"==typeof t)switch(r){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,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 rt,globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this],t&&s&&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 ft(t,...e){e.forEach(e=>function(t,e){const r=Object.getOwnPropertyDescriptors(e);for(const e of Reflect.ownKeys(r)){const s=r[e];"get"in s||"set"in s||"function"!=typeof s.value?Object.defineProperty(Object.getPrototypeOf(t),e,s):"function"==typeof s.value&&(Object.getPrototypeOf(t).hasOwnProperty(e)||Object.defineProperty(Object.getPrototypeOf(t),e,s))}}(t,e))}var dt=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 gt(t){const{store:e,index:r}=__Ziko__.__State__;__Ziko__.__State__.register({value:t,subscribers:new Set,paused:!1});let s=e.get(r);return[function(){return{value:s.value,isStateGetter:()=>!0,_subscribe:t=>s.subscribers.add(t)}},function(t){s.paused||("function"==typeof t&&(t=t(s.value)),t!==s.value&&(s.value=t,s.subscribers.forEach(t=>t(s.value)),__Ziko__.__State__.update(r,t)))},{pause:()=>{s.paused=!0},resume:()=>{s.paused=!1},clear:()=>{s.subscribers.clear()},force:t=>{"function"==typeof t&&(t=t(s.value)),s.value=t,s.subscribers.forEach(t=>t(s.value))},getSubscribers:()=>new Set(s.subscribers)}]}globalThis.__Ziko__||mt();const bt=t=>"function"==typeof t&&t?.()?.isStateGetter?.(),wt=(t="")=>t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase()),yt=(t="")=>{if(0===t.length)return!1;return/^[a-z][a-zA-Z0-9]*$/.test(t)};function vt(t,e){if(globalThis.SVGAElement&&this.element instanceof globalThis.SVGAElement&&(t=yt(t)?wt(t):t),!this?.attr[t]||this?.attr[t]!==e){if(bt(e)){e()._subscribe(e=>this.element?.setAttribute(t,e),this)}else this.element?.setAttribute(t,e);Object.assign(this.cache.attributes,{[t]:e})}}var xt=Object.freeze({__proto__:null,_set_attrs_:vt,getAttr:function(t){return t=yt(t)?wt(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[r,s]=[Object.keys(t),Object.values(t)];for(let t=0;t<r.length;t++)s[t]instanceof Array&&(e[t]=s[t].join(" ")),vt.call(this,r[t],s[t])}else e instanceof Array&&(e=e.join(" ")),vt.call(this,t,e);return this},setContentEditable:function(t=!0){return this.setAttr("contenteditable",t),this}});class _t extends et{constructor(...t){super("span","text",!1,...t),this.element=globalThis?.document?.createTextNode(...t)}isText(){return!0}}const Mt=(...t)=>new _t(...t);async function kt(t,e,...r){if(this.cache.isFrozzen)return console.warn("You can't append new item to frozzen element"),this;for(let s=0;s<r.length;s++){if(["number","string"].includes(typeof r[s])&&(r[s]=Mt(r[s])),r[s]instanceof Function){const t=r[s]();t.isStateGetter&&(r[s]=Mt(t.value),t._subscribe(t=>r[s].element.textContent=t,r[s]))}if("function"==typeof globalThis?.Node&&r[s]instanceof globalThis?.Node&&(r[s]=new this.constructor(r[s])),r[s]?.isUINode)r[s].cache.parent=this,this.element?.[t](r[s].element),r[s].target=this.element,this.items[e](r[s]);else if(r[s]instanceof Promise){const n=await r[s];n.cache.parent=this,this.element?.[t](n.element),n.target=this.element,this.items[e](n)}else r[s]instanceof Object&&(r[s]?.style&&this.style(r[s]?.style),r[s]?.attr&&Object.entries(r[s].attr).forEach(t=>this.setAttr(""+t[0],t[1])))}return this.maintain(),this}var Ct=Object.freeze({__proto__:null,__addItem__:kt,after:function(t){return t?.isUIElement&&(t=t.element),this.element?.after(t),this},append:function(...t){return kt.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 r=0;r<e.length;r++)["number","string"].includes(typeof e[r])&&(e[r]=Mt(e[r])),this.element?.insertBefore(e[r].element,this.items[t].element),this.items.splice(t,0,e[r]);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 r=0;r<t.length;r++)e(t[r]);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}});var Et=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 Tt=Object.freeze({__proto__:null,animate:function(t,{duration:e=1e3,iterations:r=1,easing:s="ease"}={}){return this.element?.animate(t,{duration:e,iterations:r,easing:s}),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 r=t[e];if(bt(r)){const t=r();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]:r})}return this}});class St{constructor(t,e){this.cache={category:e,target:t,listeners:{},currentEvent:null,event:null,customEvents:new Set}}get event(){return this.cache.event}get target(){return this.cache.target}get element(){return this.cache.target.element}get currentEvent(){return this.cache.currentEvent}addListener(t,e,{preventDefault:r=!1,paused:s=!1}={}){return this.cache.listeners[t]={callback:r=>{this.cache.event=r,this.cache.listeners[t].preventDefault&&r.preventDefault(),this.cache.listeners[t].paused||(this.cache.currentEvent=t,e.call(this,this))},preventDefault:r,paused:s},this.element.addEventListener(t,this.cache.listeners[t].callback),this}removeListener(t){return this.element.removeEventListener(t,this.cache.listeners[t].callback),this}pause(t){return this.cache.listeners[t].paused=!0,this}resume(t){return this.cache.listeners[t].paused=!1,this}preventDefault(t){return this.cache.listeners[t].preventDefault=!0,this}useDefault(t){return this.cache.listeners[t].preventDefault=!1,this}}class At extends Event{constructor(t,e){super("clickaway",{bubbles:!0,cancelable:!0}),this.originalEvent=t,this.targetElement=e}}function jt(t){function e(e){if(!t.contains(e.target)){const r=new At(e,t);t.dispatchEvent(r)}}return globalThis?.document?.addEventListener("click",e),()=>globalThis?.document?.removeEventListener("click",e)}const Ot=(t,e=!1)=>{const r=t.element.getBoundingClientRect(),s=t.event;let n=s?.clientX-r.left|0,i=s?.clientY-r.top|0;if(e){const e=t.element.clientWidth,r=t.element.clientHeight;n=+(n/e*2-1).toFixed(8),i=+(i/r*-2+1).toFixed(8)}return{x:n,y:i}},Rt="click",It={onClick(t){return this.on("click",t,{category:Rt})},onDblClick(t){return this.on("dblclick",t,{category:Rt})},onClickAway(t){var e,r,s;return e=this,r=Rt,s="clickaway",e.exp.events?.[r]?.cache?.customEvents?.has(s)||jt(this.element),this.on("clickaway",t,{category:Rt,isCustom:!0})}},Pt="ptr",zt={onPtrDown(t,e=!1){return this.on("pointerdown",t,{category:Pt,details_setter:t=>{const{x:r,y:s}=Ot(t,e);t.dx=r,t.dy=s,t.isDown=!0,t.isDragging=t.isMoving??!1}})},onPtrMove(t,e=!1){return this.on("pointermove",t,{category:Pt,details_setter:t=>{const{x:r,y:s}=Ot(t,e);t.mx=r,t.my=s,t.isMoving=!0,t.isDragging=t.isDown??!1}})},onPtrUp(t,e=!1){return this.on("pointerup",t,{category:Pt,details_setter:t=>{const{x:r,y:s}=Ot(t,e);t.ux=r,t.uy=s,t.isDown=!1,t.isMoving=!1,t.isDragging=!1}})}},$t="key",Ft={onKeyDown(t){return this.on("keydown",t,{category:$t,details_setter:t=>{t.kd=t.event.key}})},onKeyPress(t){return this.on("keypress",t,{category:$t,details_setter:t=>{t.kp=t.event.key}})},onKeyUp(t){return this.on("keydown",t,{category:$t,details_setter:t=>{t.ku=t.event.key}})}},Dt=(t,e)=>{let r=0;return(...s)=>{const n=(new Date).getTime();n-r<e||(r=n,t(...s))}};class Lt extends CustomEvent{constructor(t,e,{bubbles:r=!0,cancelable:s=!0}={}){super(t,{detail:e,bubbles:r,cancelable:s})}}function Ut(t,{intersection:e=!0,resize:r=!0,threshold:s=0,throttleResize:n=100,throttleEnterExit:i=0}={}){let o,a;const h=e=>{for(let r of e){const{width:e,height:s}=r.contentRect;t.dispatchEvent(new Lt("resizeview",{width:e,height:s,entry:r}))}},c=n>0?Dt(h,n):h,l=e=>{for(let r of e){const e=r.isIntersecting?"enterview":"exitview";t.dispatchEvent(new Lt(e,r))}},u=i>0?Dt(l,i):l;return e&&(o=new IntersectionObserver(u,{threshold:s}),o.observe(t)),r&&(a=new ResizeObserver(c),a.observe(t)),()=>{o&&(o.unobserve(t),o.disconnect()),a&&(a.unobserve(t),a.disconnect())}}const Nt="view",qt={onEnterView(t){return this.exp.events?.[Nt]||Ut(this.element),this.on("enterview",t,{category:Nt,isCustom:!0})},onExitView(t){return this.exp.events?.[Nt]||Ut(this.element),this.on("exitview",t,{category:Nt,isCustom:!0})},onResizeView(t){return this.exp.events?.[Nt]||Ut(this.element),this.on("resizeview",t,{category:Nt,isCustom:!0})}};class Zt extends CustomEvent{constructor(t,e){super(t,{detail:e,bubbles:!0,cancelable:!0})}}let Bt=class extends pt{constructor({element:t,name:e="",type:r="html",render:s=__Ziko__.__Config__.default.render}={}){super(),this.exp={events:{}},ft(this,dt,xt,Ct,Tt,Et,zt,It,Ft,qt),t&&this.init(t,e,r,s)}on(t,e,{details_setter:r,category:s="global",isCustom:n=!1,preventDefault:i=!1}={}){s&&!this.exp.events.hasOwnProperty(s)&&(this.exp.events[s]=new St(this,s)),n&&this.exp.events[s].cache.customEvents.add(t);const o=this.exp.events[s];return o.addListener(t,t=>{r&&r(o),e(t)},{preventDefault:i}),this}_off(t,e="global"){this.exp.events[e].removeListener(t)}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}};function Vt(t){return"object"!=typeof t&&"function"!=typeof t||null===t}class Gt extends Bt{constructor(...t){super({element:"div",name:"view"}),this.append(...t)}}const Ht=["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"],Wt=["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"],Kt=["math","annotation","merror","mfrac","mi","mprescripts","mn","mo","mover","mpadded","mphantom","mprescripts","mroot","mrow","ms","semantics","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"],Jt=new Proxy({},{get(t,e){if("string"!=typeof e)return;let r,s=e.replaceAll("_","-").toLowerCase();return Ht.includes(s)&&(r="html"),Wt.includes(s)&&(r="svg"),Kt.includes(s)&&(r="mathml"),(...t)=>0===t.length?new Bt({element:s,name:s,type:r}):["string","number"].includes(typeof t[0])||t[0]instanceof Bt||"function"==typeof t[0]&&t[0]().isStateGetter()?new Bt({element:s,name:s,type:r}).append(...t):new Bt({element:s,type:r}).setAttr(t.shift()).append(...t)}});function Qt(t){return 1==t?this.style({flexDirection:"column"}):-1==t&&this.style({flexDirection:"column-reverse"}),this}function Yt(t){return 1==t?this.style({flexDirection:"row"}):-1==t&&this.style({flexDirection:"row-reverse"}),this}function Xt(t){return"number"==typeof t&&(t=["flex-start","center","flex-end"][t+1]),t}function te(t){return Xt(-t)}class ee extends Bt{constructor({tag:t="div",orientation:e="h",order:r,w:s="100%",h:n="100%"}={}){super({element:t,name:"Flex"}),this.direction="cols",this.style({display:"flex"})}isFlex(){return!0}responsify(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,r=1){return Qt.call(this,r),this.style({alignItems:"number"==typeof t?Xt.call(this,t):t,justifyContent:"number"==typeof e?te.call(this,e):e}),this}horizontal(t,e,r=1){return Yt.call(this,r),this.style({alignItems:"number"==typeof e?te.call(this,e):e,justifyContent:"number"==typeof t?Xt.call(this,t):t}),this}show(){return this.isHidden=!1,this.style({display:"flex"}),this}}class re extends pt{constructor({element:t,name:e,type:r,render:s}){super({element:t,name:e,type:r,render:s})}}class se extends re{constructor(t,e){super({element:"div",name:"suspense"}),this.setAttr({dataTemp:"suspense"}),this.fallback_ui=t,this.append(t),(async()=>{try{const r=await e();t.unmount(),this.append(r)}catch(t){console.log({error:t})}})()}}class ne extends Bt{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 ie extends Bt{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:r,attributes:s}=e,n=document.createElementNS("http://www.w3.org/2000/svg","svg");for(let{name:t,value:e}of s)n.setAttribute(t,e);return n.append(...r),globalThis.svg=e,globalThis.children=r,globalThis.attributes=s,globalThis.element=n,n}throw new Error("DOMParser is not available in this environment")}(t)),this.style({display:"contents"})}}class oe extends Bt{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{PI:ae,sqrt:he,cos:ce,sin:le,acos:ue,pow:me}=Math,pe=t=>t,fe=(t,e=7.5625,r=2.75)=>t<1/r?e*t*t:t<2/r?e*(t-=1.5/r)*t+.75:t<2.5/r?e*(t-=2.25/r)*t+.9375:e*(t-=2.625/r)*t+.984375;class de{constructor(t,{ease:e=pe,step:r=50,t0:s=0,start:n=!0,duration:i=3e3}={}){this.callback=t,this.state={isRunning:!1,animationId:null,startTime:null,ease:e,step:r,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 ge{constructor(t,e,r=1/0,s){this.ms=e,this.fn=t,this.count=r,this.frame=1,this.id=null,this.running=!1,s&&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 be extends ge{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 we{constructor(t=[],{repeat:e=1,loop:r=!1}={}){this.tasks=t,this.repeat=e,this.loop=r,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 r=>{e>0&&await new Promise(t=>setTimeout(t,e)),this.onTask&&this.onTask(t),await t(),r()})));else{const{fn:e,delay:r=0}=t;r>0&&await new Promise(t=>setTimeout(t,r)),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 ye{constructor(t,{step:e=1e3,t0:r=0,t1:s=1/0,autoplay:n=!0}={}){this.callback=t,this.cache={isRunning:!1,id:null,last_tick:null,step:e,t0:r,t1:s,autoplay:n,pauseTime:null,frame:0},n&&(r?this.startAfter(r):this.start(),s!==1/0&&this.stopAfter(s))}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)}}}const ve=(t,e=",")=>t.trim().trimEnd().split("\n").map(t=>t.split(e)),xe=(t,e=",")=>{const[r,...s]=ve(t,e);return s.map(t=>{const e={};return r.forEach((r,s)=>{e[r]=t[s]}),e})},_e=t=>t instanceof Array?[Object.keys(t[0]),...t.map(t=>Object.values(t))]:[Object.keys(t)],Me=(t,e)=>_e(t).map(t=>t.join(e)).join("\n"),ke=(t,e=",")=>Me(t instanceof Object?t:JSON.parse(t),e),Ce=(t,e)=>{const r=[];if(Array.isArray(t))t.forEach(t=>{if("object"==typeof t&&null!==t){r.push(`${e}-`);const s=Ce(t,`${e} `);r.push(...s)}else r.push(`${e}- ${t}`)});else for(const s in t)if(t.hasOwnProperty(s)){const n=t[s];if("object"==typeof n&&null!==n){r.push(`${e}${s}:`);const t=Ce(n,`${e} `);r.push(...t)}else r.push(`${e}${s}: ${n}`)}return r},Ee=(t,e="")=>Ce(t,e).join("\n"),Te=(t,e)=>Ee(t instanceof Object?t:JSON.parse(t),e),Se=(t,e=1)=>{let r="";for(const s in t)if(t.hasOwnProperty(s)){const n=t[s];r+="\n"+" ".repeat(e)+`<${s}>`,r+="object"==typeof n?Se(n,e+2):`${n}`,r+=`</${s}>`}return r.trim()},Ae=t=>(new XMLSerializer).serializeToString(t),je=t=>btoa(Ae(t)),Oe=t=>"data:image/svg+xml;base64,"+je(t),Re=t=>JSON.stringify(n(t=>["number","string","boolean","bigint"].includes(typeof t)?String(t):t instanceof y||t instanceof N?t.toString():t instanceof Array?Pe(t):void 0,t),null," ").replace(/"([^"]+)":/g,"$1:").replace(/: "([^"]+)"/g,": $1"),Ie=t=>{if(!Array.isArray(t))return 0;let e=1;for(const r of t)if(Array.isArray(r)){const t=Ie(r);t+1>e&&(e=t+1)}return e},Pe=t=>{let e=0;return function t(r){let s=Ie(r),n=0;return r.some(t=>Array.isArray(t))&&(e++,n=1),"["+r.map((s,n)=>["number","string","boolean","bigint"].includes(typeof s)?String(s):s instanceof y?s.toString():s instanceof Array?`\n${" ".repeat(e)}${t(s)}${n===r.length-1?"\n":""}`:s instanceof Object?Re(s):void 0)+`${" ".repeat((s+e+1)*n)}]`}(t)},ze=(t,e=0)=>{t=$e(t);let r="";const s=" ".repeat(e);for(let n in t)if("object"==typeof t[n]){r+=`${s}${n} {\n`;const i=t[n];for(let t in i)"object"==typeof i[t]?r+=ze({[t]:i[t]},e+1):r+=`${s} ${t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}: ${i[t]};\n`;r+=`${s}}\n`}return r};function $e(t){return"object"!=typeof t||null===t?t:Object.keys(t).reduce((e,r)=>(e[r.trim()]=$e(t[r]),e),Array.isArray(t)?[]:{})}class Fe{constructor({head:t=null,wrapper:e=null,target:r=null}){this.head=t,this.wrapper=e,this.target=r,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 De(t){return/:\w+/.test(t)}class Le extends Fe{constructor({head:t,wrapper:e,target:r,routes:s}){super({head:t,wrapper:e,target:r}),this.routes=new Map([["404",Mt("Error 404")],...Object.entries(s)]),this.clear(),globalThis.onpopstate=this.mount(location.pathname)}clear(){return[...this.routes].forEach(t=>{!De(t[0])&&t[1]?.isUIElement&&t[1].unmount()}),this}mount(t){const[e,r]=[...this.routes].find(e=>function(t,e){const r=t.split("/"),s=e.split("/");if(r.length!==s.length)return!1;for(let t=0;t<r.length;t++){const e=r[t],n=s[t];if(!e.startsWith(":")&&e!==n)return!1}return!0}(e[0],t));let s;if(De(e)){const n=function(t,e){const r=t.split("/"),s=e.split("/"),n={};if(r.length!==s.length)return n;for(let t=0;t<r.length;t++){const e=r[t],i=s[t];if(e.startsWith(":"))n[e.slice(1)]=i;else if(e!==i)return{}}return n}(e,t);s=r.call(this,n)}else r?.isUIElement&&r.mount(this.wrapper),"function"==typeof r&&(s=r());return s?.isUIElement&&s.mount(this.wrapper),s instanceof Promise&&s.then(t=>t.mount(this.wrapper)),globalThis.history.pushState({},"",t),this}}const Ue=({head:t,wrapper:e,target:r,routes:s})=>new Le({head:t,wrapper:e,target:r,routes:s});function Ne(t,e="./src/pages",r=["js","ts"]){"/"===e.at(-1)&&(e=e.slice(0,-1));const s=t.replace(/\\/g,"/").replace(/\[(\w+)\]/g,"$1/:$1").split("/"),n=e.split("/"),i=s.indexOf(n.at(-1));if(-1!==i){const t=s.slice(i+1),e=s.at(-1),n="index.js"===e||"index.ts"===e,o=r.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;#m=new Map;#p=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:r,error:s}=t.data,n=this.#m.get(e);n&&(n(r,s),this.#m.delete(e))})}call(t,e,r=[],s=!0){if("function"!=typeof t)throw new TypeError("func must be a function");const n=++this.#p;return this.#m.set(n,e),this.#u.postMessage({id:n,funStr:t.toString(),args:r,close:s}),this}terminate(){this.#u.terminate()}}class Ze{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 r=(...s)=>{this.off(t,r),e(...s)};return this.on(t,r)}off(t,e){const r=this.events[t];if(!r)return this;const s=r.indexOf(e);return-1!==s&&r.splice(s,1),this}emit(t,e){const r=this.events[t];return!!r&&([...r].forEach(r=>{try{r(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 Be=t=>new Ze(t);class Ve{#f;#d;#g=null;constructor(t=[],e=()=>{}){this.#f=t,this.#d=e,this.#a()}#b(){return this.#f.some(({query:t})=>globalThis.matchMedia(t).matches)}#a(){this.#f.forEach(({query:t,callback:e})=>{const r=globalThis.matchMedia(t),s=()=>{const t=this.#b();r.matches?(e(),this.#g=e):t||this.#g===this.#d||(this.#d(),this.#g=this.#d)};s(),r.addEventListener("change",s)})}}class Ge{constructor(t=document.title,e=!0){this.cache={emitter:null},e&&this.useEventEmitter(),this.set(t)}useEventEmitter(){return this.cache.emitter=Be(),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 He{constructor(t,{namespace:e="Ziko",ValidateCssProps:r=!1}={}){this.currentPropsMap=t,this.namespace=e,this.ValidateCssProps=r,this.use(t)}use(t){return this.ValidateCssProps&&function(t){const e=new Set(Object.keys(document.documentElement.style));for(const r in t)if(!e.has(r))throw new Error(`Invalid CSS property: "${r}"`)}(t),this.currentPropsMap=t,this.#h(),this}#h(){const t=globalThis?.document?.documentElement?.style;for(const e in this.currentPropsMap){const r=this.namespace?`--${this.namespace}-${e}`:`--${e}`;t.setProperty(r,this.currentPropsMap[e]),Object.defineProperty(this,e,{value:`var(${r})`,writable:!0,configurable:!0,enumerable:!1})}}}const We=t=>Object.fromEntries(new URLSearchParams(globalThis?.location?.search));let{sqrt:Ke,cos:Je,sin:Qe,exp:Ye,log:Xe,cosh:tr,sinh:er}=Math;for(const t of Object.getOwnPropertyNames(Math)){const e=Math[t];"function"==typeof e&&(Math[t]=new Proxy(e,{apply(e,r,s){const n=s[0];if("number"==typeof n||0===s.length)return e.apply(r,s);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(Ke(o)*Je(a/2),Ke(o)*Qe(a/2));case"log":return h(Xe(o),a);case"exp":return h(Ye(t)*Je(i),Ye(t)*Qe(i));case"cos":return h(Je(t)*tr(i),-Qe(t)*er(i));case"sin":return h(Qe(t)*tr(i),Je(t)*er(i));case"tan":{const e=Je(2*t)+tr(2*i);return h(Qe(2*t)/e,er(2*i)/e)}case"cosh":return h(tr(t)*Je(i),er(t)*Qe(i));case"sinh":return h(er(t)*Je(i),tr(t)*Qe(i));case"tanh":{const e=tr(2*t)+Je(2*i);return h(er(2*t)/e,Qe(2*i)/e)}default:return e.apply(r,s)}}throw new TypeError(`Math.${t} expects only numbers`)}}))}globalThis?.document&&document?.addEventListener("DOMContentLoaded",__Ziko__.__Config__.init()),t.App=({head:t,wrapper:e,target:r})=>new Fe({head:t,wrapper:e,target:r}),t.ClickAwayEvent=At,t.ClickListeners=It,t.Clock=be,t.CloneElement=t=>new t.__proto__.constructor,t.Complex=y,t.E=r,t.EPSILON=s,t.EventController=St,t.FileBasedRouting=async function(t){const e=Object.keys(t),r=function(t){if(0===t.length)return"";const e=t.map(t=>t.split("/")),r=Math.min(...e.map(t=>t.length));let s=[];for(let t=0;t<r;t++){const r=e[0][t];if(!e.every(e=>e[t]===r||e[t].startsWith("[")))break;s.push(r)}return s.join("/")+(s.length?"/":"")}(e),s={};for(let n=0;n<e.length;n++){const i=await t[e[n]](),o=await i.default;Object.assign(s,{[Ne(e[n],r)]:o})}return Ue({target:document.body,routes:{"/":()=>{},...s},wrapper:Jt.section()})},t.Flex=(...t)=>{let e="div";return"string"==typeof t[0]&&(e=t[0],t.pop()),new ee(e).append(...t)},t.HTMLWrapper=t=>new ne(t),t.KeyListeners=Ft,t.Matrix=N,t.PI=e,t.PtrListeners=zt,t.Random=w,t.SPA=Ue,t.SVGWrapper=t=>new ie(t),t.Scheduler=(t,{repeat:e=null}={})=>new we(t,{repeat:e}),t.Suspense=(t,e)=>new se(t,e),t.SwipeEvent=Zt,t.Switch=({key:t,cases:e})=>new oe(t,e),t.Tick=ge,t.TimeAnimation=de,t.TimeLoop=ye,t.TimeScheduler=we,t.UIElement=Bt,t.UIFlex=ee,t.UIHTMLWrapper=ne,t.UINode=et,t.UISVGWrapper=ie,t.UISwitch=oe,t.UIView=Gt,t.UseRoot=He,t.UseThread=qe,t.Utils=tt,t.View=(...t)=>new Gt(...t),t.ViewEvent=Lt,t.ViewListeners=qt,t.ZikoApp=Fe,t.ZikoSPA=Le,t.ZikoUISuspense=se,t.ZikoUIText=_t,t.abs=x,t.accum_prod=(...t)=>{let e,r=[],s=1,n=t.length;for(e=0;e<n;e++)s=l(s,t[e]),r.push(s);return r},t.accum_sum=d,t.acos=(...t)=>n(t=>{if(t?.isComplex){const{a:e,b:r}=t,s=Math.hypot(e+1,r),n=Math.hypot(e-1,r);return globalThis.Rp=s,globalThis.Rm=n,new t.constructor(Math.acos((s-n)/2),-Math.acosh((s+n)/2)).toFixed(8)}return+Math.acos(t).toFixed(8)},...t),t.acosh=(...t)=>n(t=>t?.isComplex?C(t.clone().add(M(t.clone().mul(t.clone()).sub(1)))):+Math.acosh(t).toFixed(8),...t),t.acot=(...t)=>n(t=>{if(t?.isComplex){const{a:e,b:r}=t;return new t.constructor(Math.atan(2*e/(e**2+(r-1)*(r+1)))/2,Math.log((e**2+(r-1)**2)/(e**2+(r+1)**2))/4).toFixed(8)}return+(Math.PI/2-Math.atan(t)).toFixed(8)},...t),t.add=h,t.add_class=(t,e)=>t.element.className=t.element.className.replace(/\s+$/gi,"")+" "+e,t.add_vendor_prefix=function(t){const e=t.slice(0,1).toUpperCase()+t.slice(1),r=["Webkit","Moz","O","ms"];for(let t=0,s=r.length;t<s;t++){const s=r[t];if(void 0!==(globalThis?.document?.body).style[s+e])return s+e}return t},t.and=P,t.animation=(t,{ease:e,t0:r,t1:s,start:n,duration:i}={})=>new de(t,{ease:e,t0:r,t1:s,start:n,duration:i}),t.apply_fun=i,t.arange=V,t.arc=t=>1-le(ue(t)),t.arr2str=Pe,t.asin=(...t)=>n(t=>{if(t?.isComplex){const{a:e,b:r}=t,s=Math.hypot(e+1,r),n=Math.hypot(e-1,r);return new t.constructor(Math.asin((s-n)/2),Math.acosh((s+n)/2)).toFixed(8)}return+Math.asin(t).toFixed(8)},...t),t.asinh=(...t)=>n(t=>t?.isComplex?C(t.clone().add(M(t.clone().mul(t.clone()).add(1)))):+Math.asinh(t).toFixed(8),...t),t.atan=(...t)=>n(t=>{if(t?.isComplex){const{a:e,b:r}=t;return new t.constructor(Math.atan(2*e/(1-e**2-r**2))/2,Math.log((e**2+(1+r)**2)/(e**2+(1-r)**2))/4).toFixed(8)}return+Math.atan(t).toFixed(8)},...t),t.atan2=O,t.atanh=(...t)=>n(t=>+Math.atanh(t).toFixed(8),...t),t.back=(t,e=1)=>t**2*((e+1)*t-e),t.binomial=(t,e)=>{if(t!==Math.floor(t))return TypeError("n must be an integer");if(e!==Math.floor(e))return TypeError("k must be an integer");if(t<0)return TypeError("n must be non-negative");if(e<0||t<0||e>t)return 0;e>t-e&&(e=t-e);let r,s=1;for(r=0;r<e;r++)s=s*(t-r)/(r+1);return s},t.call_with_optional_props=t=>(...e)=>{const r=e[0];return r?.isUIElement?.()||Vt(r)?new t({},...e):new t(r,...e.slice(1))},t.cartesianProduct=Q,t.cbrt=(...t)=>n(t=>t.isComplex?.()?new t.constructor({z:t.z**(1/3),phi:t.phi/3}).toFixed(8):+Math.cbrt(t).toFixed(8),...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=A,t.clock=t=>new be(t),t.cloneUI=t=>Object.assign(Object.create(Object.getPrototypeOf(t)),t),t.complex=v,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)).toFixed(8):+Math.cos(t).toFixed(8),...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)).toFixed(8):+Math.cosh(t).toFixed(8),...t),t.coth=(...t)=>n(t=>{if(t?.isComplex){const{a:e,b:r}=t,s=Math.sinh(e)**2*Math.cos(r)**2+Math.cosh(e)**2*Math.sin(r)**2;return new t.constructor(Math.cosh(e)*Math.sinh(e)/s,-Math.sin(r)*Math.cos(r)/s).toFixed(8)}return+(1/Math.tanh(t)).toFixed(8)},...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:r,b:s}=e,{z:n,phi:i}=t,o=Math.hypot(r,s),a=Math.exp((Math.log(n)*r+i*s)/o),h=(i*r-Math.log(n)*s)/o;return new e.constructor(a*Math.cos(h),a*Math.sin(h)).toFixed(8)},...t)},t.csv2arr=ve,t.csv2json=(t,e=",")=>JSON.stringify(xe(t,e)),t.csv2matrix=(t,e=",")=>new N(ve(t,e)),t.csv2object=xe,t.csv2sql=(t,e)=>{const r=t.trim().trimEnd().split("\n").filter(t=>t);let s=`INSERT INTO ${e} (${r[0].split(",").join(", ")}) Values `,n=[];for(let t=1;t<r.length;t++){const e=r[t].split(",");n.push(`(${e})`)}return s+n.join(",\n")},t.debounce=(t,e=1e3)=>(...r)=>setTimeout(()=>t(...r),e),t.defineParamsGetter=function(t){Object.defineProperties(t,{QueryParams:{get:function(){return globalThis.location.search.substring(1),Object.fromEntries(new URLSearchParams(location.search))},configurable:!1,enumerable:!0},HashParams:{get:function(){return globalThis.location.hash.substring(1).split("#")},configurable:!1,enumerable:!0}})},t.define_wc=function(t,e,r={},{mode:s="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(r)]}constructor(){super(),this.attachShadow({mode:s}),this.props={},this.mask={...r}}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,r){Object.assign(this.props,{[t]:this.mask[t].type(r)}),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=u,t.elastic=t=>-2*me(2,10*(t-1))*ce(20*ae*t/3*t),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)).toFixed(8):+Math.exp(t).toFixed(8),...t),t.floor=E,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=W,t.hypot=(...t)=>{const e=t.find(t=>t.isComplex?.());if(e){const r=t.map(t=>t.isComplex?.()?t:new e.constructor(t,0));return Math.hypot(...r.map(t=>t.z))}return Math.hypot(...t)},t.inRange=K,t.in_back=(t,e=1.70158,r=e+1)=>r*me(t,3)-e*t**2,t.in_bounce=(t,e=7.5625,r=2.75)=>1-fe(1-t,e,r),t.in_circ=t=>1-he(1-t**2),t.in_cubic=t=>t**3,t.in_elastic=(t,e=2*ae/3)=>0===t?0:1===t?1:-me(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,r=1.525*e)=>t<.5?me(2*t,2)*(2*(r+1)*t-r)/2:(me(2*t-2,2)*((r+1)*(2*t-2)+r)+2)/2,t.in_out_bounce=(t,e=7.5625,r=2.75)=>t<.5?fe(1-2*t,e,r)/2:fe(2*t-1,e,r)/2,t.in_out_circ=t=>t<.5?(1-he(1-(2*t)**2))/2:(he(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*ae/4.5)=>0===t?0:1===t?1:t<.5?-me(2,20*t-10)*le((20*t-11.125)*e)/2:me(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=>-(ce(ae*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-ce(t*ae/2),t.isApproximatlyEqual=J,t.isPrimitive=Vt,t.isStateGetter=bt,t.json2arr=t=>_e(t instanceof Object?t:JSON.parse(t)),t.json2css=ze,t.json2csv=ke,t.json2csvFile=(t,e)=>{const r=ke(t,e),s=new Blob([r],{type:"text/csv;charset=utf-8;"});return{str:r,blob:s,url:URL.createObjectURL(s)}},t.json2xml=Se,t.json2xmlFile=(t,e)=>{const r=Se(t,e),s=new Blob([r],{type:"text/xml;charset=utf-8;"});return{str:r,blob:s,url:URL.createObjectURL(s)}},t.json2yml=Te,t.json2ymlFile=(t,e)=>{const r=Te(t,e),s=new Blob([r],{type:"text/yml;charset=utf-8;"});return{str:r,blob:s,url:URL.createObjectURL(s)}},t.lerp=S,t.linear=pe,t.linkStyle=function(t){const e=document?.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("href",t),document.head.appendChild(e)},t.linspace=G,t.ln=C,t.logspace=H,t.loop=(t,e={})=>new ye(t,e),t.map=j,t.mapfun=n,t.matrix=(t,e,r)=>new N(t,e,r),t.matrix2=(...t)=>new N(2,2,t),t.matrix3=(...t)=>new N(3,3,t),t.matrix4=(...t)=>new N(4,4,t),t.max=(...t)=>Math.max(...t),t.mean=p,t.median=t=>g(t,50),t.min=(...t)=>Math.min(...t),t.modulo=m,t.mul=l,t.nand=(...t)=>R(P(...t)),t.nor=(...t)=>R(z(...t)),t.norm=T,t.normalize_css_value=t=>"number"==typeof t?t+"px":t,t.nthr=k,t.nums=B,t.obj2str=Re,t.ones=Z,t.or=z,t.out_back=(t,e=1.70158,r=e+1)=>1+r*me(t-1,3)+e*me(t-1,2),t.out_bounce=fe,t.out_circ=t=>he(1-(t-1)**2),t.out_cubic=t=>1-(1-t)**3,t.out_elastic=(t,e=2*ae/3)=>0===t?0:1===t?1:me(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*ae/2),t.percentile=g,t.pgcd=Y,t.pow=_,t.ppcm=X,t.rad2deg=(...t)=>n(t=>t/Math.PI*180,...t),t.register_click_away_event=jt,t.register_swipe_event=function(t,e=5,r=100,s=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,m=null;performance.now()-o<=s&&(Math.abs(c)>=e&&Math.abs(l)<=r?(u=c<0?"left":"right",m="swipe"+u):Math.abs(l)>=e&&Math.abs(c)<=r&&(u=l<0?"up":"down",m="swipe"+u)),m&&t.dispatchEvent(new Zt(m,{direction:u,distX:c,distY:l,originalEvent:h}))}return t.addEventListener("pointerdown",h,{passive:!0}),t.addEventListener("pointerup",c,{passive:!0}),()=>{t.removeEventListener("pointerdown",h),t.removeEventListener("pointerup",c)}},t.register_view_event=Ut,t.remove_class=(t,e)=>t.element.className=t.element.className.replace(e,""),t.round=(...t)=>n(t=>t.isComplex?.()?new t.constructor(Math.round(t.a),Math.round(t.b)):Math.round(t),...t),t.script=function(t){const e=document?.createElement("script");e.setAttribute("src",t),document.head.appendChild(e)},t.sec=(...t)=>n(t=>(t.isComplex?.(),+(1/Math.cos(t)).toFixed(8)),...t),t.sig=(...t)=>n(t=>1/(1+Math.exp(-t)).toFixed(8),...t),t.sign=(...t)=>n(t=>{if(t.isComplex?.()){const{z:e,phi:r}=t;return 0===e?new t.constructor(0,0):new t.constructor({z:1,phi:r})}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)).toFixed(8):+Math.sin(t).toFixed(8),...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)).toFixed(8):+Math.sinh(t).toFixed(8),...t),t.sleep=t=>new Promise(e=>setTimeout(e,t)),t.sqrt=M,t.std=(...t)=>Math.sqrt(f(...t)),t.step=(t,e=5)=>Math.floor(t*e)/e,t.step_fps=t=>1e3/t,t.style=(t,e)=>{t&&Object.assign(t.style,e)},t.sub=c,t.svg2ascii=je,t.svg2img=(t,e=!0)=>Jt.img(Oe(t)).mount(e),t.svg2imgUrl=Oe,t.svg2str=Ae,t.tags=Jt,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).toFixed(8)}return+Math.tan(t).toFixed(8)},...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).toFixed(8)}return+Math.tanh(t).toFixed(8)},...t),t.text=Mt,t.throttle=Dt,t.tick=(t,e,r=1/0,s=!0)=>new ge(t,e,r,s),t.timeTaken=t=>{console.time("timeTaken");const e=t();return console.timeEnd("timeTaken"),e},t.time_memory_Taken=t=>{const e=Date.now(),r=performance.memory.usedJSHeapSize,s=t();return{elapsedTime:Date.now()-e,usedMemory:performance.memory.usedJSHeapSize-r,result:s}},t.timeout=function(t,e){let r;const s=new Promise(s=>{r=setTimeout(()=>{e&&e(),s()},t)});return{id:r,clear:()=>clearTimeout(r),promise:s}},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 r=t(...e.map(t=>t().value));const s=new Set;return e.forEach(n=>{n()._subscribe(()=>{{const n=t(...e.map(t=>t().value));n!==r&&(r=n,s.forEach(t=>t(r)))}})}),()=>({value:r,isStateGetter:()=>!0,_subscribe:t=>s.add(t)})},t.useEventEmitter=Be,t.useIPC=ht,t.useLocaleStorage=(t,e,r=!0)=>new ct(localStorage,t,e,r),t.useMediaQuery=(t,e)=>new Ve(t,e),t.useQueryParams=function(){const t=()=>We();return[t,(e,r=!0)=>{const s=t(),n="function"==typeof e?e(s):e,i=r?{...s,...n}:n,o=new URLSearchParams(i).toString();window.history.pushState({},"",`${window.location.pathname}${o?`?${o}`:""}`),window.dispatchEvent(new CustomEvent("queryparamschange",{detail:i}))}]},t.useReactive=t=>n(t=>{const e=gt(t);return{get:e[0],set:e[1]}},t),t.useRoot=(t,e={})=>new He(t,e),t.useSessionStorage=lt,t.useState=gt,t.useThread=(t,e,r=[],s=!0)=>(new qe).call(t,e,r,s),t.useTitle=(t,e=!0)=>new Ge(t,e),t.variance=f,t.wait=t=>new Promise(e=>setTimeout(e,t)),t.waitElm=t=>new Promise(e=>{if(t)return e(t);const r=new MutationObserver(()=>{t&&(e(t),r.disconnect())});r.observe(document?.body,{childList:!0,subtree:!0})}),t.waitForUIElm=t=>new Promise(e=>{if(t.element)return e(t.element);const r=new MutationObserver(()=>{t.element&&(e(t.element),r.disconnect())});r.observe(document?.body,{childList:!0,subtree:!0})}),t.waitForUIElmSync=(t,e=2e3)=>{const r=Date.now();for(;Date.now()-r<e;)if(t.element)return t.element},t.watchQueryParams=function(t){let e=location.search;const r=()=>{const r=location.search;r!==e&&(e=r,t(We()))};window.addEventListener("popstate",r);const s=history.pushState;history.pushState=function(...t){s.apply(this,t),r()};const n=history.replaceState;return history.replaceState=function(...t){n.apply(this,t),r()},t(We()),()=>{window.removeEventListener("popstate",r)}},t.xnor=(...t)=>R($(...t)),t.xor=$,t.zeros=q});
package/dist/ziko.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Thu Feb 26 2026 13:06:11 GMT+0000 (UTC)
5
+ Date : Thu Jun 04 2026 14:34:29 GMT+0100 (UTC+01:00)
6
6
  Git-Repo : https://github.com/zakarialaoui10/ziko.js
7
7
  Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
8
8
  Released under MIT License
@@ -1865,7 +1865,7 @@ class UINode {
1865
1865
 
1866
1866
  // globalThis.node = (node) => new UINode(node);
1867
1867
 
1868
- function parseQueryParams$1(queryString) {
1868
+ function parseQueryParams$2(queryString) {
1869
1869
  const params = {};
1870
1870
  queryString.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi, (match) => {
1871
1871
  const [key, value] = match.split('=');
@@ -1878,7 +1878,7 @@ function defineParamsGetter$1(target ){
1878
1878
  Object.defineProperties(target, {
1879
1879
  'QueryParams': {
1880
1880
  get: function() {
1881
- return parseQueryParams$1(globalThis.location.search.substring(1));
1881
+ return parseQueryParams$2(globalThis.location.search.substring(1));
1882
1882
  },
1883
1883
  configurable: false,
1884
1884
  enumerable: true
@@ -3345,9 +3345,6 @@ const MathMLTags = [
3345
3345
  `munder`, `munderover`
3346
3346
  ];
3347
3347
 
3348
- // const h=(tag, attributes = {}, ...children)=> _h(tag, "html", attributes, ...children);
3349
- // const s=(tag, attributes = {}, ...children)=> _h(tag, "svg", attributes, ...children);
3350
-
3351
3348
  const tags = new Proxy({}, {
3352
3349
  get(target, prop) {
3353
3350
  if (typeof prop !== 'string') return undefined;
@@ -4589,20 +4586,17 @@ const SPA=({head, wrapper, target, routes})=>new ZikoSPA({head, wrapper, target,
4589
4586
  // regEx
4590
4587
  */
4591
4588
 
4592
- function parseQueryParams(queryString) {
4593
- const params = {};
4594
- queryString.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi, (match) => {
4595
- const [key, value] = match.split('=');
4596
- params[key] = value;
4597
- });
4598
- return params;
4589
+ function parseQueryParams$1(queryString) {
4590
+ return Object.fromEntries(
4591
+ new URLSearchParams(location.search)
4592
+ );
4599
4593
  }
4600
4594
 
4601
4595
  function defineParamsGetter(target ){
4602
4596
  Object.defineProperties(target, {
4603
4597
  'QueryParams': {
4604
4598
  get: function() {
4605
- return parseQueryParams(globalThis.location.search.substring(1));
4599
+ return parseQueryParams$1(globalThis.location.search.substring(1));
4606
4600
  },
4607
4601
  configurable: false,
4608
4602
  enumerable: true
@@ -4997,6 +4991,77 @@ tags.p("Test useRoot ").style({
4997
4991
 
4998
4992
  */
4999
4993
 
4994
+ const parseQueryParams = queryString => Object.fromEntries(new URLSearchParams(globalThis?.location?.search));
4995
+
4996
+ function useQueryParams() {
4997
+ const getParams = () =>
4998
+ parseQueryParams();
4999
+
5000
+ const setParams = (updates, merge = true) => {
5001
+ const current = getParams();
5002
+
5003
+ const next =
5004
+ typeof updates === "function"
5005
+ ? updates(current)
5006
+ : updates;
5007
+
5008
+ const finalParams = merge
5009
+ ? { ...current, ...next }
5010
+ : next;
5011
+
5012
+ const search = new URLSearchParams(finalParams).toString();
5013
+
5014
+ window.history.pushState(
5015
+ {},
5016
+ "",
5017
+ `${window.location.pathname}${search ? `?${search}` : ""}`
5018
+ );
5019
+
5020
+ window.dispatchEvent(
5021
+ new CustomEvent("queryparamschange", {
5022
+ detail: finalParams
5023
+ })
5024
+ );
5025
+ };
5026
+
5027
+ return [getParams, setParams];
5028
+ }
5029
+
5030
+ function watchQueryParams(callback) {
5031
+ let previousSearch = location.search;
5032
+
5033
+ const notify = () => {
5034
+ const currentSearch = location.search;
5035
+
5036
+ if (currentSearch === previousSearch) {
5037
+ return;
5038
+ }
5039
+
5040
+ previousSearch = currentSearch;
5041
+ callback(parseQueryParams());
5042
+ };
5043
+
5044
+ window.addEventListener("popstate", notify);
5045
+
5046
+ const pushState = history.pushState;
5047
+ history.pushState = function (...args) {
5048
+ pushState.apply(this, args);
5049
+ notify();
5050
+ };
5051
+
5052
+ const replaceState = history.replaceState;
5053
+ history.replaceState = function (...args) {
5054
+ replaceState.apply(this, args);
5055
+ notify();
5056
+ };
5057
+
5058
+ callback(parseQueryParams());
5059
+
5060
+ return () => {
5061
+ window.removeEventListener("popstate", notify);
5062
+ };
5063
+ }
5064
+
5000
5065
  let {sqrt, cos: cos$1, sin: sin$1, exp, log, cosh: cosh$1, sinh} = Math;
5001
5066
  // Math.abs = new Proxy(Math.abs, {
5002
5067
  // apply(target, thisArg, args) {
@@ -5060,4 +5125,4 @@ if(globalThis?.document){
5060
5125
  document?.addEventListener("DOMContentLoaded", __Ziko__.__Config__.init());
5061
5126
  }
5062
5127
 
5063
- export { App, ClickAwayEvent, ClickListeners, Clock, CloneElement, Complex, E, EPSILON, EventController, FileBasedRouting, Flex, HTMLWrapper, KeyListeners, Matrix, PI$1 as PI, PtrListeners, Random, SPA, SVGWrapper, Scheduler, Suspense, SwipeEvent, Switch, Tick, TimeAnimation, TimeLoop, TimeScheduler, UIElement$1 as UIElement, UIFlex, UIHTMLWrapper, UINode, UISVGWrapper, UISwitch, UIView, UseRoot, UseThread, Utils, View, ViewEvent, ViewListeners, ZikoApp, ZikoSPA, ZikoUISuspense, ZikoUIText, abs, accum_prod, accum_sum, acos$1 as acos, acosh, acot, add, add_class, add_vendor_prefix, and, animation, apply_fun, arange, arc, arr2str, asin, asinh, atan, atan2, atanh, back, binomial, call_with_optional_props, cartesianProduct, cbrt, ceil, clamp, clock, cloneUI, complex, cos$3 as cos, cosh$2 as cosh, coth, croot, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, debounce, defineParamsGetter, define_wc, deg2rad, discret, div, elastic, exp$1 as exp, floor, fract, geomspace, hypot, inRange, in_back, in_bounce, in_circ, in_cubic, in_elastic, in_expo, in_out_back, in_out_bounce, in_out_circ, in_out_cubic, in_out_elastic, in_out_expo, in_out_quad, in_out_quart, in_out_quint, in_out_sin, in_quad, in_quart, in_quint, in_sin, isApproximatlyEqual, isPrimitive, isStateGetter, json2arr, json2css, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, lerp, linear, linkStyle, linspace, ln, logspace, loop, map$1 as map, mapfun, matrix, matrix2, matrix3, matrix4, max, mean, median, min, modulo, mul, nand, nor, norm, normalize_css_value, nthr, nums, obj2str, ones, or, out_back, out_bounce, out_circ, out_cubic, out_elastic, out_expo, out_quad, out_quart, out_quint, out_sin, percentile, pgcd, pow$1 as pow, ppcm, rad2deg, register_click_away_event, register_swipe_event, register_view_event, remove_class, round, script, sec, sig, sign, sin$3 as sin, sinh$1 as sinh, sleep, sqrt$2 as sqrt, std, step, step_fps, style, sub, svg2ascii, svg2img, svg2imgUrl, svg2str, tags, tan, tanh, text, throttle, tick, timeTaken, time_memory_Taken, timeout, trunc, useDerived, useEventEmitter, useIPC, useLocaleStorage, useMediaQuery, useReactive, useRoot, useSessionStorage, useState, useThread, useTitle, variance, wait, waitElm, waitForUIElm, waitForUIElmSync, xnor, xor, zeros };
5128
+ export { App, ClickAwayEvent, ClickListeners, Clock, CloneElement, Complex, E, EPSILON, EventController, FileBasedRouting, Flex, HTMLWrapper, KeyListeners, Matrix, PI$1 as PI, PtrListeners, Random, SPA, SVGWrapper, Scheduler, Suspense, SwipeEvent, Switch, Tick, TimeAnimation, TimeLoop, TimeScheduler, UIElement$1 as UIElement, UIFlex, UIHTMLWrapper, UINode, UISVGWrapper, UISwitch, UIView, UseRoot, UseThread, Utils, View, ViewEvent, ViewListeners, ZikoApp, ZikoSPA, ZikoUISuspense, ZikoUIText, abs, accum_prod, accum_sum, acos$1 as acos, acosh, acot, add, add_class, add_vendor_prefix, and, animation, apply_fun, arange, arc, arr2str, asin, asinh, atan, atan2, atanh, back, binomial, call_with_optional_props, cartesianProduct, cbrt, ceil, clamp, clock, cloneUI, complex, cos$3 as cos, cosh$2 as cosh, coth, croot, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, debounce, defineParamsGetter, define_wc, deg2rad, discret, div, elastic, exp$1 as exp, floor, fract, geomspace, hypot, inRange, in_back, in_bounce, in_circ, in_cubic, in_elastic, in_expo, in_out_back, in_out_bounce, in_out_circ, in_out_cubic, in_out_elastic, in_out_expo, in_out_quad, in_out_quart, in_out_quint, in_out_sin, in_quad, in_quart, in_quint, in_sin, isApproximatlyEqual, isPrimitive, isStateGetter, json2arr, json2css, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, lerp, linear, linkStyle, linspace, ln, logspace, loop, map$1 as map, mapfun, matrix, matrix2, matrix3, matrix4, max, mean, median, min, modulo, mul, nand, nor, norm, normalize_css_value, nthr, nums, obj2str, ones, or, out_back, out_bounce, out_circ, out_cubic, out_elastic, out_expo, out_quad, out_quart, out_quint, out_sin, percentile, pgcd, pow$1 as pow, ppcm, rad2deg, register_click_away_event, register_swipe_event, register_view_event, remove_class, round, script, sec, sig, sign, sin$3 as sin, sinh$1 as sinh, sleep, sqrt$2 as sqrt, std, step, step_fps, style, sub, svg2ascii, svg2img, svg2imgUrl, svg2str, tags, tan, tanh, text, throttle, tick, timeTaken, time_memory_Taken, timeout, trunc, useDerived, useEventEmitter, useIPC, useLocaleStorage, useMediaQuery, useQueryParams, useReactive, useRoot, useSessionStorage, useState, useThread, useTitle, variance, wait, waitElm, waitForUIElm, waitForUIElmSync, watchQueryParams, xnor, xor, zeros };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ziko",
3
- "version": "0.70.0",
3
+ "version": "1.1.0",
4
4
  "description": "A versatile JavaScript library offering a rich set of Hyperscript Based UI components, advanced mathematical utilities, interactivity ,animations, client side routing and more ...",
5
5
  "keywords": [
6
6
  "front-end",
package/src/app/params.js CHANGED
@@ -1,10 +1,7 @@
1
1
  function parseQueryParams(queryString) {
2
- const params = {};
3
- queryString.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi, (match) => {
4
- const [key, value] = match.split('=');
5
- params[key] = value;
6
- });
7
- return params;
2
+ return Object.fromEntries(
3
+ new URLSearchParams(location.search)
4
+ );
8
5
  }
9
6
 
10
7
  function defineParamsGetter(target ){
@@ -1,5 +1,5 @@
1
1
  import { SPA } from "./spa.js";
2
- import { tags } from "../ui/index.js";
2
+ import { tags } from "../dom/index.js";
3
3
  // import.meta.glob('./src/pages/**/*.js')
4
4
  async function FileBasedRouting(pages /* use import.meta.glob */){
5
5
  const routes = Object.keys(pages)
package/src/app/spa.js CHANGED
@@ -1,4 +1,4 @@
1
- import { text } from "../ui/index.js";
1
+ import { text } from "../dom/index.js";
2
2
  import { dynamicRoutesParser,routesMatcher,isDynamic } from "./routes.js";
3
3
  import { ZikoApp } from "./ziko-app.js";
4
4
  class ZikoSPA extends ZikoApp{
@@ -1,4 +1,4 @@
1
- import { tags } from "../../ui"
1
+ import { tags } from "../../dom"
2
2
  const svg2str=svg=>(new XMLSerializer()).serializeToString(svg);
3
3
  const svg2ascii=svg=>btoa(svg2str(svg));
4
4
  const svg2imgUrl=svg=>'data:image/svg+xml;base64,'+svg2ascii(svg);
@@ -8,4 +8,5 @@ export type * from './use-event-emitter.d.ts'
8
8
  export type * from './use-media-query.d.ts'
9
9
  export type * from './use-title.d.ts'
10
10
  export type * from './use-favicon.d.ts'
11
- export type * from './use-root.d.ts'
11
+ export type * from './use-root.d.ts'
12
+ export type * from './use-query-params.d.ts'
@@ -10,4 +10,6 @@ export * from './use-thread.js'
10
10
  export * from './use-event-emitter.js'
11
11
  export * from './use-media-query.js'
12
12
  export * from './use-title.js'
13
- export * from './use-root.js'
13
+ export * from './use-root.js'
14
+
15
+ export * from './use-query-params.js'
@@ -0,0 +1,31 @@
1
+ export type QueryParams = Record<string, string>;
2
+
3
+ export type SetQueryParams = (
4
+ updates:
5
+ | QueryParams
6
+ | ((current: QueryParams) => QueryParams),
7
+ merge?: boolean
8
+ ) => void;
9
+
10
+ export type GetQueryParams = () => QueryParams;
11
+
12
+ /**
13
+ * Reactive query params hook-like utility
14
+ * Returns:
15
+ * - getParams: function that returns current query params
16
+ * - setParams: function to update query params
17
+ */
18
+ export function useQueryParams(): [
19
+ GetQueryParams,
20
+ SetQueryParams
21
+ ];
22
+
23
+ /**
24
+ * Watches URL query parameters changes.
25
+ * Calls callback only when params actually change.
26
+ *
27
+ * Returns an unsubscribe function.
28
+ */
29
+ export function watchQueryParams(
30
+ callback: (params: QueryParams) => void
31
+ ): () => void;
@@ -0,0 +1,71 @@
1
+ import { useState } from "./use-state.js";
2
+ const parseQueryParams = queryString => Object.fromEntries(new URLSearchParams(globalThis?.location?.search))
3
+
4
+ export function useQueryParams() {
5
+ const getParams = () =>
6
+ parseQueryParams(window.location.search);
7
+
8
+ const setParams = (updates, merge = true) => {
9
+ const current = getParams();
10
+
11
+ const next =
12
+ typeof updates === "function"
13
+ ? updates(current)
14
+ : updates;
15
+
16
+ const finalParams = merge
17
+ ? { ...current, ...next }
18
+ : next;
19
+
20
+ const search = new URLSearchParams(finalParams).toString();
21
+
22
+ window.history.pushState(
23
+ {},
24
+ "",
25
+ `${window.location.pathname}${search ? `?${search}` : ""}`
26
+ );
27
+
28
+ window.dispatchEvent(
29
+ new CustomEvent("queryparamschange", {
30
+ detail: finalParams
31
+ })
32
+ );
33
+ };
34
+
35
+ return [getParams, setParams];
36
+ }
37
+
38
+ export function watchQueryParams(callback) {
39
+ let previousSearch = location.search;
40
+
41
+ const notify = () => {
42
+ const currentSearch = location.search;
43
+
44
+ if (currentSearch === previousSearch) {
45
+ return;
46
+ }
47
+
48
+ previousSearch = currentSearch;
49
+ callback(parseQueryParams(currentSearch));
50
+ };
51
+
52
+ window.addEventListener("popstate", notify);
53
+
54
+ const pushState = history.pushState;
55
+ history.pushState = function (...args) {
56
+ pushState.apply(this, args);
57
+ notify();
58
+ };
59
+
60
+ const replaceState = history.replaceState;
61
+ history.replaceState = function (...args) {
62
+ replaceState.apply(this, args);
63
+ notify();
64
+ };
65
+
66
+ callback(parseQueryParams(location.search));
67
+
68
+ return () => {
69
+ window.removeEventListener("popstate", notify);
70
+ };
71
+ }
package/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "./math/index.js";
2
- export * from "./ui/index.js";
2
+ export * from "./dom/index.js";
3
3
  export * from "./time/index.js";
4
4
  export * from "./data/index.js";
5
5
  // export * from "./reactivity/index.js"