ziko 0.36.2 → 0.37.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 Aug 14 2025 10:09:49 GMT+0100 (UTC+01:00)
5
+ Date : Fri Aug 15 2025 09:48:20 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
@@ -1292,17 +1292,25 @@ function __addItem__(adder, pusher, ...ele) {
1292
1292
  }
1293
1293
  for (let i = 0; i < ele.length; i++) {
1294
1294
  if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
1295
- if (
1296
- typeof globalThis?.Node === "function" &&
1297
- ele[i] instanceof globalThis?.Node
1298
- )
1299
- ele[i] = new this.constructor(ele[i]);
1295
+ if (typeof globalThis?.Node === "function" && ele[i] instanceof globalThis?.Node) ele[i] = new this.constructor(ele[i]);
1300
1296
  if (ele[i]?.isZikoUIElement) {
1301
- ele[i].cache.parent = this;
1302
- this.element[adder](ele[i].element);
1303
- ele[i].target = this.element;
1304
- this.items[pusher](ele[i]);
1305
- } else if (ele[i] instanceof Object) {
1297
+ ele[i].cache.parent = this;
1298
+ this.element[adder](ele[i].element);
1299
+ ele[i].target = this.element;
1300
+ this.items[pusher](ele[i]);
1301
+ }
1302
+ // Fix Items Latter
1303
+ if( ele[i] instanceof Function){
1304
+ const getter = ele[i]();
1305
+ if (getter.isStateGetter) {
1306
+ const textNode = document?.createTextNode(getter.value);
1307
+ this.element.appendChild(textNode);
1308
+ getter._subscribe(
1309
+ (newValue) => (textNode.textContent = newValue),
1310
+ );
1311
+ }
1312
+ }
1313
+ else if (ele[i] instanceof Object) {
1306
1314
  if (ele[i]?.style) this.style(ele[i]?.style);
1307
1315
  if (ele[i]?.attr) {
1308
1316
  Object.entries(ele[i].attr).forEach((n) =>
@@ -8034,6 +8042,29 @@ const App={
8034
8042
  // ...Params
8035
8043
  };
8036
8044
 
8045
+ function useState(initialValue) {
8046
+ let value = initialValue;
8047
+ const subscribers = new Set();
8048
+
8049
+ function getValue() {
8050
+ return {
8051
+ value,
8052
+ isStateGetter: () => true,
8053
+ _subscribe: (fn) => subscribers.add(fn),
8054
+ };
8055
+ }
8056
+
8057
+ function setValue(newValue) {
8058
+ if (typeof newValue === "function") newValue = newValue(value);
8059
+ if (newValue !== value) {
8060
+ value = newValue;
8061
+ subscribers.forEach(fn => fn(value));
8062
+ }
8063
+ }
8064
+
8065
+ return [getValue, setValue];
8066
+ }
8067
+
8037
8068
  class ZikoUseChannel{
8038
8069
  constructor(name = ""){
8039
8070
  this.channel = new BroadcastChannel(name);
@@ -8617,6 +8648,7 @@ exports.useMediaQuery = useMediaQuery;
8617
8648
  exports.useMeta = useMeta$1;
8618
8649
  exports.useRoot = useRoot;
8619
8650
  exports.useSessionStorage = useSessionStorage;
8651
+ exports.useState = useState;
8620
8652
  exports.useStyle = useStyle;
8621
8653
  exports.useSuccesifKeys = useSuccesifKeys;
8622
8654
  exports.useSwipeEvent = useSwipeEvent;
package/dist/ziko.js CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Thu Aug 14 2025 10:09:49 GMT+0100 (UTC+01:00)
5
+ Date : Fri Aug 15 2025 09:48:20 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
@@ -1294,17 +1294,25 @@
1294
1294
  }
1295
1295
  for (let i = 0; i < ele.length; i++) {
1296
1296
  if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
1297
- if (
1298
- typeof globalThis?.Node === "function" &&
1299
- ele[i] instanceof globalThis?.Node
1300
- )
1301
- ele[i] = new this.constructor(ele[i]);
1297
+ if (typeof globalThis?.Node === "function" && ele[i] instanceof globalThis?.Node) ele[i] = new this.constructor(ele[i]);
1302
1298
  if (ele[i]?.isZikoUIElement) {
1303
- ele[i].cache.parent = this;
1304
- this.element[adder](ele[i].element);
1305
- ele[i].target = this.element;
1306
- this.items[pusher](ele[i]);
1307
- } else if (ele[i] instanceof Object) {
1299
+ ele[i].cache.parent = this;
1300
+ this.element[adder](ele[i].element);
1301
+ ele[i].target = this.element;
1302
+ this.items[pusher](ele[i]);
1303
+ }
1304
+ // Fix Items Latter
1305
+ if( ele[i] instanceof Function){
1306
+ const getter = ele[i]();
1307
+ if (getter.isStateGetter) {
1308
+ const textNode = document?.createTextNode(getter.value);
1309
+ this.element.appendChild(textNode);
1310
+ getter._subscribe(
1311
+ (newValue) => (textNode.textContent = newValue),
1312
+ );
1313
+ }
1314
+ }
1315
+ else if (ele[i] instanceof Object) {
1308
1316
  if (ele[i]?.style) this.style(ele[i]?.style);
1309
1317
  if (ele[i]?.attr) {
1310
1318
  Object.entries(ele[i].attr).forEach((n) =>
@@ -8036,6 +8044,29 @@
8036
8044
  // ...Params
8037
8045
  };
8038
8046
 
8047
+ function useState(initialValue) {
8048
+ let value = initialValue;
8049
+ const subscribers = new Set();
8050
+
8051
+ function getValue() {
8052
+ return {
8053
+ value,
8054
+ isStateGetter: () => true,
8055
+ _subscribe: (fn) => subscribers.add(fn),
8056
+ };
8057
+ }
8058
+
8059
+ function setValue(newValue) {
8060
+ if (typeof newValue === "function") newValue = newValue(value);
8061
+ if (newValue !== value) {
8062
+ value = newValue;
8063
+ subscribers.forEach(fn => fn(value));
8064
+ }
8065
+ }
8066
+
8067
+ return [getValue, setValue];
8068
+ }
8069
+
8039
8070
  class ZikoUseChannel{
8040
8071
  constructor(name = ""){
8041
8072
  this.channel = new BroadcastChannel(name);
@@ -8619,6 +8650,7 @@
8619
8650
  exports.useMeta = useMeta$1;
8620
8651
  exports.useRoot = useRoot;
8621
8652
  exports.useSessionStorage = useSessionStorage;
8653
+ exports.useState = useState;
8622
8654
  exports.useStyle = useStyle;
8623
8655
  exports.useSuccesifKeys = useSuccesifKeys;
8624
8656
  exports.useSwipeEvent = useSwipeEvent;
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 Aug 14 2025 10:09:49 GMT+0100 (UTC+01:00)
4
+ Date : Fri Aug 15 2025 09:48:20 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";function e(t,...e){if("function"==typeof t)return e.forEach((e=>function(t,e){const s=Object.getOwnPropertyDescriptors(e);class r extends t{constructor(...t){super(...t);for(const t of Reflect.ownKeys(s)){const e=s[t];"function"==typeof e.value&&(this[t]=e.value.bind(this))}}}for(const t of Reflect.ownKeys(s)){const e=s[t];("get"in e||"set"in e||"function"!=typeof e.value)&&Object.defineProperty(r.prototype,t,e)}return r}(t,e)));if("object"!=typeof t)throw new TypeError("compose: target must be a class or instance");e.forEach((e=>function(t,e){const s=Object.getOwnPropertyDescriptors(e);for(const e of Reflect.ownKeys(s)){const r=s[e];"get"in r||"set"in r?Object.defineProperty(t,e,r):"function"==typeof r.value?t[e]=r.value.bind(t):t[e]=r.value}}(t,e)))}const{PI:s,E:r}=Math,i=Number.EPSILON;var n=Object.freeze({__proto__:null,E:r,EPSILON:i,PI:s});const{PI:a,cos:o,sin:h,tan:l,acos:u,asin:m,atan:p,cosh:f,sinh:g,tanh:b,acosh:y,asinh:w,atanh:x,log:v}=Math;let _={cos:o,sin:h,tan:l,sinc:t=>h(a*t)/(a*t),sec:t=>1/o(t),csc:t=>1/h(t),cot:t=>1/l(t),acos:u,asin:m,atan:p,acot:t=>a/2-p(t),cosh:f,sinh:g,tanh:b,coth:t=>.5*v((1+t)/(1-t)),acosh:y,asinh:w,atanh:x};_=new Proxy(_,{get(t,e){if(e in t)return s=>+t[e](s).toFixed(15)}});class k{}const I=(t,...e)=>{const s=e.map((e=>{if(null===e)return t(null);if(["number","string","boolean","bigint","undefined"].includes(typeof e))return t(e);if(e instanceof Array)return e.map((e=>I(t,e)));if(ArrayBuffer.isView(e))return e.map((e=>t(e)));if(e instanceof Set)return new Set(I(t,...e));if(e instanceof Map)return new Map([...e].map((e=>[e[0],I(t,e[1])])));if(e instanceof kn)return new kn(e.rows,e.cols,I(e.arr.flat(1)));if(e instanceof Mn){const[s,r,i,n]=[e.a,e.b,e.z,e.phi];switch(t){case Math.log:return On(Ln(i),n);case Math.exp:return On(Dn(s)*Pn(r),Dn(s)*zn(r));case Math.abs:return i;case Math.sqrt:return On(Zn(i)*Pn(n/2),Zn(i)*zn(n/2));case _.cos:return On(Pn(s)*Gn(r),-zn(s)*Xn(r));case _.sin:return On(zn(s)*Gn(r),Pn(s)*Xn(r));case _.tan:{const t=Pn(2*s)+Gn(2*r);return On(zn(2*s)/t,Xn(2*r)/t)}case _.cosh:return On(Gn(s)*Pn(r),Xn(s)*zn(r));case _.sinh:return On(Xn(s)*Pn(r),Gn(s)*zn(r));case _.tanh:{const t=Gn(2*s)+Pn(2*r);return On(Xn(2*s)/t,zn(2*r)/t)}default:return t(e)}}else if(e instanceof Object)return t(Object)||Object.fromEntries(Object.entries(e).map((e=>[e[0],I(t,e[1])])))}));return 1==s.length?s[0]:s},E=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t+e;if(e instanceof Mn)return On(t+e.a,e.b);if(e instanceof kn)return kn.nums(e.rows,e.cols,t).add(e);if(e instanceof Array)return e.map((e=>O(e,t)))}else{if(t instanceof Mn||t instanceof kn)return e instanceof Array?e.map((e=>t.clone.add(e))):t.clone.add(e);if(t instanceof Array){if(!(e instanceof Array))return t.map((t=>O(t,e)));if(t.length===e.length)return t.map(((t,s)=>O(t,e[s])))}}},T=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t-e;if(e instanceof Mn)return On(t-e.a,-e.b);if(e instanceof kn)return kn.nums(e.rows,e.cols,t).sub(e);if(e instanceof Array)return e.map((e=>S(e,t)))}else{if(t instanceof Mn||t instanceof kn)return e instanceof Array?e.map((e=>t.clone.sub(e))):t.clone.sub(e);if(t instanceof Array){if(!(e instanceof Array))return t.map((t=>S(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>S(t,e[s])))}}},A=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t*e;if(e instanceof Mn)return On(t*e.a,t*e.b);if(e instanceof kn)return kn.nums(e.rows,e.cols,t).mul(e);if(e instanceof Array)return e.map((e=>j(t,e)))}else{if(t instanceof Mn||t instanceof kn)return e instanceof Array?e.map((e=>t.clone.mul(e))):t.clone.mul(e);if(t instanceof Array){if(!(e instanceof Array))return t.map((t=>j(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>j(t,e[s])))}}},C=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t/e;if(e instanceof Mn)return On(t/e.a,t/e.b);if(e instanceof kn)return kn.nums(e.rows,e.cols,t).div(e);if(e instanceof Array)return e.map((e=>Z(t,e)))}else{if(t instanceof Mn||t instanceof kn)return e instanceof Array?e.map((e=>t.clone.div(e))):t.clone.div(e);if(t instanceof Array){if(!(e instanceof Array))return t.map((t=>Z(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>Z(t,e[s])))}}},M=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t%e;if(e instanceof Mn)return On(t%e.a,t%e.b);if(e instanceof kn)return kn.nums(e.rows,e.cols,t).modulo(e);if(e instanceof Array)return e.map((e=>Z(t,e)))}else{if(t instanceof Mn||t instanceof kn)return e instanceof Array?e.map((e=>t.clone.div(e))):t.clone.div(e);if(t instanceof Array&&!(e instanceof Array))return t.map((t=>O(t,e)))}},O=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=E(s,e[t]);return s},S=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=T(s,e[t]);return s},j=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=A(s,e[t]);return s},Z=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=C(s,e[t]);return s},U=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=M(s,e[t]);return s},R=t=>new Array(t).fill(0),D=t=>new Array(t).fill(1),L=(t,e)=>new Array(e).fill(t),P=(t,e,s)=>{if("number"==typeof t)return e!==s?(t-e)/(s-e):0;if(t instanceof kn)return new kn(t.rows,t.cols,P(t.arr.flat(1),e,s));if(t instanceof Mn)return new Mn(P(t.a,e,s),P(t.b,e,s));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>P(t,e,s)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=P(t[s])}}},F=(t,e,s)=>{if("number"==typeof t)return(s-e)*t+e;if(t instanceof kn)return new kn(t.rows,t.cols,F(t.arr.flat(1),e,s));if(t instanceof Mn)return new Mn(F(t.a,e,s),F(t.b,e,s));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>F(t,e,s)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=F(t[s])}}},H=(t,e,s,r,i)=>{if("number"==typeof t)return F(P(t,e,s),r,i);if(t instanceof kn)return new kn(t.rows,t.cols,H(t.arr.flat(1),e,s,r,i));if(t instanceof Mn)return new Mn(H(t.a,s,r,i),H(t.b,e,s,r,i));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>H(t,e,s,r,i)));{let n=new Array(t.length);for(let a=0;a<t.length;a++)n[a]=H(t[a],e,s,r,i)}}},B=(t,e,s)=>{const[r,i]=[K(e,s),Q(e,s)];if("number"==typeof t)return K(Q(t,r),i);if(t instanceof kn)return new kn(t.rows,t.cols,B(t.arr.flat(1),r,i));if(t instanceof Mn)return new Mn(B(t.a,r,i),B(t.b,r,i));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>B(t,r,i)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=B(t[s],r,i)}}},N=(t,e,s,r=!1)=>{let i=[];if(t<e)for(let n=t;r?n<=e:n<e;n+=s)i.push(10*n/10);else for(let n=t;r?n>=e:n>e;n-=s)i.push(10*n/10);return i},$=(t,e,s=jn(e-t)+1,r=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[a,o]=[t,e].sort(((t,e)=>e-t));var i=[];let h;h=r?(a-o)/(s-1):(a-o)/s;for(var n=0;n<s;n++)t<e?i.push(o+h*n):i.push(a-h*n);return i}if([t,e].some((t=>t instanceof Mn))){const i=On(t),n=On(e);s=s||Math.abs(i.a-n.a)+1;const a=$(i.a,n.a,s,r),o=$(i.b,n.b,s,r);let h=new Array(s).fill(null);return h=h.map(((t,e)=>On(a[e],o[e]))),h}}},V=(t,e,s=e-t+1,i=r,n=!0)=>$(t,e,s,n).map((t=>Un(i,t))),q=(t,e,s=jn(e-t)+1,r=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[i,n]=[t,e].sort(((t,e)=>e-t));let a;a=Rn(i/n,r?s-1:s);const o=[n];for(let t=1;t<s;t++)o.push(o[t-1]*a);return t<e?o:o.reverse()}if([t,e].some((t=>t instanceof Mn))){const i=On(t),n=On(e);let a;s=s||Math.abs(i.a-n.a)+1,a=Rn(n.div(i),r?s-1:s);const o=[i];for(let t=1;t<s;t++)o.push(j(o[t-1],a));return o}}},W=(...t)=>mapfun((t=>t*Math.PI/180),...t),Y=(...t)=>mapfun((t=>t/Math.PI*180),...t),G=(...t)=>{if(t.every((t=>"number"==typeof t))){let e=t[0];for(let s=1;s<t.length;s++)e+=t[s];return e}const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(G(...t[s])):t[s]instanceof Object&&e.push(G(...Object.values(t[s])));return 1===e.length?e[0]:e},X=(...t)=>{if(t.every((t=>"number"==typeof t))){let e=t[0];for(let s=1;s<t.length;s++)e*=t[s];return e}const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(X(...t[s])):t[s]instanceof Object&&e.push(X(...Object.values(t[s])));return 1===e.length?e[0]:e},K=(...t)=>{if(t.every((t=>"number"==typeof t)))return Math.min(...t);const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(K(...t[s])):t[s]instanceof Object&&e.push(Object.fromEntries([Object.entries(t[s]).sort(((t,e)=>t[1]-e[1]))[0]]));return 1===e.length?e[0]:e},Q=(...t)=>{if(t.every((t=>"number"==typeof t)))return Math.max(...t);const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(K(...t[s])):t[s]instanceof Object&&e.push(Object.fromEntries([Object.entries(t[s]).sort(((t,e)=>e[1]-t[1]))[0]]));return 1===e.length?e[0]:e},J=(...t)=>{if(t.every((t=>"number"==typeof t))){let e=t.reduce(((t,e)=>[...t,t[t.length-1]+e]),[0]);return e.shift(),e}const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(J(...t[s])):t[s]instanceof Object&&e.push(null);return 1===e.length?e[0]:e},tt=(t,e,s)=>{const[r,i]=[Math.min(e,s),Math.max(e,s)];return t>=r&&t<=i},et=(t,e,s=1e-4)=>Math.abs(t-e)<=s,st=(t,e)=>t.reduce(((t,s)=>[...t,...e.map((t=>[s,t]))]),[]),rt=(t,e)=>{let s,r=1;if(t==ra(t)&&e==ra(e)){for(s=2;s<=t&&s<=e;++s)t%s==0&&e%s==0&&(r=s);return r}console.log("error")},it=(t,e)=>{let s;if(t==ra(t)&&e==ra(e)){for(s=t>e?t:e;s%t!=0||s%e!=0;)++s;return s}console.log("error")},nt={add:O,sub:S,mul:j,div:Z,modulo:U,zeros:R,ones:D,nums:L,norm:P,lerp:F,map:H,clamp:B,arange:N,linspace:$,logspace:V,geomspace:q,sum:G,prod:X,accum:J,cartesianProduct:st,ppcm:it,pgcd:rt,deg2rad:W,rad2deg:Y,inRange:tt,isApproximatlyEqual:et};var at=Object.freeze({__proto__:null,Utils:nt,add:O,arange:N,cartesianProduct:st,clamp:B,deg2rad:W,div:Z,geomspace:q,inRange:tt,isApproximatlyEqual:et,lerp:F,linspace:$,logspace:V,map:H,mapfun:I,modulo:U,mul:j,norm:P,nums:L,ones:D,pgcd:rt,ppcm:it,prod:X,rad2deg:Y,sub:S,sum:G,zeros:R});const ot=t=>{const e=[],s=2**t.length;for(let r=0;r<s;r+=1){const s=[];for(let e=0;e<t.length;e+=1)r&1<<e&&s.push(t[e]);e.push(s)}return e},ht={_mode:Number,_map:function(t,e,s){return e instanceof kn?new kn(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof Mn?new Mn(t(e.a,s),t(e.b,s)):e instanceof Array?e.map((e=>t(e,s))):void 0},dec2base(t,e){return this._mode=e<=10?Number:String,"number"==typeof t?this._mode((t>>>0).toString(e)):this._map(this.dec2base,t,e)},dec2bin(t){return this.dec2base(t,2)},dec2oct(t){return this.dec2base(t,8)},dec2hex(t){return this.dec2base(t,16)},bin2base(t,e){return this.dec2base(this.bin2dec(t),e)},bin2dec(t){return this._mode("0b"+t)},bin2oct(t){return this.bin2base(t,8)},bin2hex(t){return this.bin2base(t,16)},oct2dec(t){return this._mode("0o"+t)},oct2bin(t){return this.dec2bin(this.oct2dec(t))},oct2hex(t){return this.dec2hex(this.oct2dec(t))},oct2base(t,e){return this.dec2base(this.oct2dec(t),e)},hex2dec(t){return this._mode("0x"+t)},hex2bin(t){return this.dec2bin(this.hex2dec(t))},hex2oct(t){return this.dec2oct(this.hex2dec(t))},hex2base(t,e){return this.dec2base(this.hex2dec(t),e)},IEEE32toDec(t){let e=t.split(" ").join("").padEnd(32,"0"),s=e[0],r=2**(+("0b"+e.slice(1,9))-127);return(-1)**s*(1+e.slice(9,32).split("").map((t=>+t)).map(((t,e)=>t*2**(-e-1))).reduce(((t,e)=>t+e),0))*r},IEEE64toDec(t){let e=t.split(" ").join("").padEnd(64,"0"),s=e[0],r=2**(+("0b"+e.slice(1,12))-1023);return(-1)**s*(1+e.slice(13,64).split("").map((t=>+t)).map(((t,e)=>t*2**(-e-1))).reduce(((t,e)=>t+e),0))*r}},ct={_mode:Number,_map:function(t,e,s){return e instanceof kn?new kn(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof Mn?new Mn(t(e.a,s),t(e.b,s)):e instanceof Array?e.map((e=>t(e,s))):void 0},not:function(t){return["number","boolean"].includes(typeof t)?ct._mode(!t):this._map(this.not,t)},and:function(t,...e){return["number","boolean"].includes(typeof t)?ct._mode(e.reduce(((t,e)=>t&e),t)):this._map(this.and,t,e)},or:function(t,...e){return["number","boolean"].includes(typeof t)?ct._mode(e.reduce(((t,e)=>t|e),t)):this._map(this.or,t,e)},nand:function(t,...e){return this.not(this.and(t,e))},nor:function(t,...e){return this.not(this.or(t,e))},xor:function(t,...e){let s=[t,...e];return["number","boolean"].includes(typeof t)?this._mode(1===s.reduce(((t,e)=>(1==+e&&(t+=1),t)),0)):this._map(this.xor,t,e)},xnor:function(t,...e){return ct.not(ct.xor(t,e))}};class lt{static withDiscount(t,e=t.length){if(1===e)return t.map((t=>[t]));const s=[];let r;return r=this.withDiscount(t,e-1),t.forEach((t=>{r.forEach((e=>{s.push([t].concat(e))}))})),s}static withoutDiscount(t){if(1===t.length)return t.map((t=>[t]));const e=[],s=this.withoutDiscount(t.slice(1)),r=t[0];for(let t=0;t<s.length;t++){const i=s[t];for(let t=0;t<=i.length;t++){const s=i.slice(0,t),n=i.slice(t);e.push(s.concat([r],n))}}return e}}class ut{static withDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((r,i)=>{this.withDiscount(t.slice(i),e-1).forEach((t=>{s.push([r].concat(t))}))})),s}static withoutDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((r,i)=>{this.withoutDiscount(t.slice(i+1),e-1).forEach((t=>{s.push([r].concat(t))}))})),s}}const mt=(t,e,s=!1)=>ut[s?"withDiscount":"withoutDiscount"](t,e);var pt=Object.freeze({__proto__:null,Base:ht,Combinaison:ut,Logic:ct,Permutation:lt,combinaison:mt,powerSet:ot,subSet:null});class dt{static float(t=1,e){return e?Math.random()*(e-t)+t:t*Math.random()}static int(t,e){return Math.floor(this.float(t,e))}static char(t){t=t??this.bool();const e=String.fromCharCode(this.int(97,120));return t?e.toUpperCase():e}static bool(){return[!1,!0][Math.floor(2*Math.random())]}static string(t,e){return t instanceof Array?new Array(this.int(...t)).fill(0).map((()=>this.char(e))).join(""):new Array(t).fill(0).map((()=>this.char(e))).join("")}static bin(){return this.int(2)}static oct(){return this.int(8)}static dec(){return this.int(8)}static hex(){return this.int(16)}static choice(t=[1,2,3],e=new Array(t.length).fill(1/t.length)){let s=new Array(100);e=nt.accum(...e).map((t=>100*t)),s.fill(t[0],0,e[0]);for(let r=1;r<t.length;r++)s.fill(t[r],e[r-1],e[r]);return s[this.int(s.length-1)]}static shuffleArr(t){return t.sort((()=>.5-Math.random()))}static shuffleMatrix(t){const{rows:e,cols:s,arr:r}=t;return In(e,s,r.flat().sort((()=>.5-Math.random())))}static floats(t,e,s){return new Array(t).fill(0).map((()=>this.float(e,s)))}static ints(t,e,s){return new Array(t).fill(0).map((()=>this.int(e,s)))}static bools(t){return new Array(t).fill(0).map((()=>this.bool()))}static bins(t){return new Array(t).fill(0).map((()=>this.int(2)))}static octs(t){return new Array(t).fill(0).map((()=>this.int(8)))}static decs(t){return new Array(t).fill(0).map((()=>this.int(10)))}static hexs(t){return new Array(t).fill(0).map((()=>this.int(16)))}static choices(t,e,s){return new Array(t).fill(0).map((()=>this.choice(e,s)))}static perm(...t){return t.permS[this.int(t.length)]}static color(){return"#"+ht.dec2hex(this.float(16777216)).padStart(6,0)}static colors(t){return new Array(t).fill(null).map((()=>this.color()))}static complex(t=[0,1],e=[0,1]){return t instanceof Array?new Mn(this.float(t[0],t[1]),this.float(e[0],e[1])):new Mn(...this.floats(2,t,e))}static complexInt(t=[0,1],e=[0,1]){return new Mn(this.int(t[0],t[1]),this.int(e[0],e[1]))}static complexBin(){return new Mn(...this.bins(2))}static complexOct(){return new Mn(...this.octs(2))}static complexDec(){return new Mn(...this.decs(10))}static complexHex(){return new Mn(...this.octs(2))}static complexes(t,e=0,s=1){return new Array(t).fill(0).map((()=>this.complex(e,s)))}static complexesInt(t,e=0,s=1){return new Array(t).fill(0).map((()=>this.complexInt(e,s)))}static complexesBin(t){return new Array(t).fill(0).map((()=>this.complexBin()))}static complexesOct(t){return new Array(t).fill(0).map((()=>this.complexOct()))}static complexesDec(t){return new Array(t).fill(0).map((()=>this.complexDec()))}static complexesHex(t){return new Array(t).fill(0).map((()=>this.complexHex()))}static matrix(t,e,s,r){return In(t,e,this.floats(t*e,s,r))}static matrixInt(t,e,s,r){return In(t,e,this.ints(t*e,s,r))}static matrixBin(t,e){return In(t,e,this.bins(t*e))}static matrixOct(t,e){return In(t,e,this.octs(t*e))}static matrixDec(t,e){return In(t,e,this.decs(t*e))}static matrixHex(t,e){return In(t,e,this.hex(t*e))}static matrixColor(t,e){return In(t,e,this.colors(t*e))}static matrixComplex(t,e,s,r){return In(t,e,this.complexes(t*e,s,r))}static matrixComplexInt(t,e,s,r){return In(t,e,this.complexesInt(t*e,s,r))}static matrixComplexBin(t,e){return In(t,e,this.complexesBin(t*e))}static matrixComplexOct(t,e){return In(t,e,this.complexesBin(t*e))}static matrixComplexDec(t,e){return In(t,e,this.complexesBin(t*e))}static matrixComplexHex(t,e){return In(t,e,this.complexesBin(t*e))}}var ft=Object.freeze({__proto__:null,Random:dt});const gt=t=>{const e=new XMLHttpRequest;if(e.open("GET",t,!1),e.send(),200===e.status)return e.responseText;throw new Error(`Failed to fetch data from ${t}. Status: ${e.status}`)};globalThis.fetchdom=async function(t="https://github.com/zakarialaoui10"){const e=await fetch(t),s=await e.text();return(new DOMParser).parseFromString(s,"text/xml").documentElement},globalThis.fetchdomSync=function(t="https://github.com/zakarialaoui10"){const e=gt(t);return(new DOMParser).parseFromString(e,"text/xml").documentElement};var bt=Object.freeze({__proto__:null,preload:gt});const yt=(t,e=",")=>t.trim().trimEnd().split("\n").map((t=>t.split(e))),wt=(t,e=",")=>new kn(yt(t,e)),xt=(t,e=",")=>{const[s,...r]=yt(t,e);return r.map((t=>{const e={};return s.forEach(((s,r)=>{e[s]=t[r]})),e}))},vt=(t,e=",")=>JSON.stringify(xt(t,e)),_t=(t,e)=>{const s=t.trim().trimEnd().split("\n").filter((t=>t));let r=`INSERT INTO ${e} (${s[0].split(",").join(", ")}) Values `,i=[];for(let t=1;t<s.length;t++){const e=s[t].split(",");i.push(`(${e})`)}return r+i.join(",\n")},kt=t=>t instanceof Array?[Object.keys(t[0]),...t.map((t=>Object.values(t)))]:[Object.keys(t)],It=(t,e)=>kt(t).map((t=>t.join(e))).join("\n"),Et=t=>kt(t instanceof Object?t:JSON.parse(t)),Tt=(t,e=",")=>It(t instanceof Object?t:JSON.parse(t),e),At=(t,e)=>{const s=Tt(t,e),r=new Blob([s],{type:"text/csv;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}},Ct=(t,e)=>{const s=[];if(Array.isArray(t))t.forEach((t=>{if("object"==typeof t&&null!==t){s.push(`${e}-`);const r=Ct(t,`${e} `);s.push(...r)}else s.push(`${e}- ${t}`)}));else for(const r in t)if(t.hasOwnProperty(r)){const i=t[r];if("object"==typeof i&&null!==i){s.push(`${e}${r}:`);const t=Ct(i,`${e} `);s.push(...t)}else s.push(`${e}${r}: ${i}`)}return s},Mt=(t,e="")=>Ct(t,e).join("\n"),Ot=(t,e)=>Mt(t instanceof Object?t:JSON.parse(t),e),St=(t,e)=>{const s=Ot(t,e),r=new Blob([s],{type:"text/yml;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}},jt=(t,e=1)=>{let s="";for(const r in t)if(t.hasOwnProperty(r)){const i=t[r];s+="\n"+" ".repeat(e)+`<${r}>`,s+="object"==typeof i?jt(i,e+2):`${i}`,s+=`</${r}>`}return s.trim()},Zt=(t,e)=>{const s=jt(t,e),r=new Blob([s],{type:"text/xml;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}};class Ut{constructor(t){this.cache={node:t}}isZikoUINode(){return!0}get node(){return this.cache.node}}globalThis.node=t=>new Ut(t);const Rt={append(...t){return Dt.call(this,"append","push",...t),this},prepend(...t){return this.__addItem__.call(this,"prepend","unshift",...t),this},insertAt(t,...e){if(t>=this.element.children.length)this.append(...e);else for(let s=0;s<e.length;s++)["number","string"].includes(typeof e[s])&&(e[s]=_s(e[s])),this.element?.insertBefore(e[s].element,this.items[t].element),this.items.splice(t,0,e[s]);return this},remove(...t){const e=t=>{"number"==typeof t&&(t=this.items[t]),t?.isZikoUIElement&&this.element?.removeChild(t.element),this.items=this.items.filter((e=>e!==t))};for(let s=0;s<t.length;s++)e(t[s]);for(let t=0;t<this.items.length;t++)Object.assign(this,{[[t]]:this.items[t]});return this},clear(){return this?.items?.forEach((t=>t.unrender())),this.element.innerHTML="",this},render(t=this.target){if(!this.isBody)return t?.isZikoUIElement&&(t=t.element),this.target=t,this.target?.appendChild(this.element),this},unrender(){return this.cache.parent?this.cache.parent.remove(this):this.target?.children?.length&&[...this.target?.children].includes(this.element)&&this.target.removeChild(this.element),this},renderAfter(t=1){return setTimeout((()=>this.render()),t),this},unrenderAfter(t=1){return setTimeout((()=>this.unrender()),t),this},after(t){return t?.isZikoUIElement&&(t=t.element),this.element?.after(t),this},before(t){return t?.isZikoUIElement&&(t=t.element),this.element?.before(t),this}};function Dt(t,e,...s){if(this.cache.isFrozzen)return console.warn("You can't append new item to frozzen element"),this;for(let r=0;r<s.length;r++)["number","string"].includes(typeof s[r])&&(s[r]=_s(s[r])),"function"==typeof globalThis?.Node&&s[r]instanceof globalThis?.Node&&(s[r]=new this.constructor(s[r])),s[r]?.isZikoUIElement?(s[r].cache.parent=this,this.element[t](s[r].element),s[r].target=this.element,this.items[e](s[r])):s[r]instanceof Object&&(s[r]?.style&&this.style(s[r]?.style),s[r]?.attr&&Object.entries(s[r].attr).forEach((t=>this.setAttr(""+t[0],t[1]))));return this.maintain(),this}const Lt={at(t){return this.items.at(t)},forEach(t){return this.items.forEach(t),this},map(t){return this.items.map(t)},find(t){return this.items.filter(t)}},Pt={Click:["Click","DblClick"],Ptr:["PtrMove","PtrDown","PtrUp","PtrLeave","PtrEnter","PtrOut","PtrCancel"],Mouse:["MouseMove","MouseDown","MouseUp","MouseEnter","MouseLeave","MouseOut"],Key:["KeyDown","KeyPress","KeyUp"],Clipboard:["Copy","Cut","Paste"],Focus:["focus","blur"],Drag:["Drag","DragStart","DragEnd","Drop"],Wheel:["Wheel"]},zt=(t="")=>t.startsWith("Ptr")?`pointer${t.split("Ptr")[1].toLowerCase()}`:t.toLowerCase();function Ft(t,e,s,r,i){this.cache.currentEvent=e,this.cache.event=t,s?.call(this),r?.hasOwnProperty("prototype")?r?.call(this):r?.call(null,this),this.cache.preventDefault[e]&&t.preventDefault(),this.cache.stopPropagation[e]&&t.stopPropagation(),this.cache.stopImmediatePropagation[e]&&t.stopImmediatePropagation(),this.cache.stream.enabled[e]&&i&&this.cache.stream.history[e].push(i),this.cache.callbacks[e]?.map((t=>t(this)))}class Ht{constructor(t=null,e=[],s,r){this.target=t,this.cache={currentEvent:null,event:null,options:{},preventDefault:{},stopPropagation:{},stopImmediatePropagation:{},event_flow:{},paused:{},stream:{enabled:{},clear:{},history:{}},callbacks:{},__controllers__:{}},e&&this._register_events(e,s,r)}_register_events(t,e,s,r=!0){const i=t?.map((t=>zt(t)));return i?.forEach(((i,n)=>{Object.assign(this.cache.preventDefault,{[i]:!1}),Object.assign(this.cache.options,{[i]:{}}),Object.assign(this.cache.paused,{[i]:!1}),Object.assign(this.cache.stream.enabled,{[i]:!1}),Object.assign(this.cache.stream.clear,{[i]:!1}),Object.assign(this.cache.stream.history,{[i]:[]}),Object.assign(this.cache.__controllers__,{[i]:t=>Ft.call(this,t,i,e,s)}),r&&Object.assign(this,{[`on${t[n]}`]:(...t)=>this.__onEvent(i,this.cache.options[i],{},...t)})})),this}get targetElement(){return this.target?.element}get isParent(){return this.target?.element===this.event.srcElement}get item(){return this.target.find((t=>t.element==this.event?.srcElement))?.[0]}get currentEvent(){return this.cache.currentEvent}get event(){return this.cache.event}setTarget(t){return this.target=t,this}__handle(t,e,s,r){return this.targetElement?.addEventListener(t,e,s),this}__onEvent(t,e,s,...r){if(0===r.length){if(console.log("00"),!this.cache.callbacks[t])return this;console.log("Call"),this.cache.callbacks[t].map((t=>e=>t.call(this,e)))}else this.cache.callbacks[t]=r.map((t=>e=>t.call(this,e)));return this.__handle(t,this.cache.__controllers__[t],e,s),this}#t(t,e,s){"default"===s&&Object.assign(this.cache[t],{...this.cache[t],...e});const r="default"===s?this.cache[t]:Object.fromEntries(Object.keys(this.cache.preventDefault).map((t=>[t,s])));return Object.assign(this.cache[t],{...r,...e}),this}preventDefault(t={},e="default"){return this.#t("preventDefault",t,e),this}stopPropagation(t={},e="default"){return this.#t("stopPropagation",t,e),this}stopImmediatePropagation(t={},e="default"){return this.#t("stopImmediatePropagation",t,e),this}setEventOptions(t,e){return this.pause({[t]:!0},"default"),Object.assign(this.cache.options[zt(t)],e),this.resume({[t]:!0},"default"),this}pause(t={},e="default"){t={..."default"===e?this.cache.stream.enabled:Object.entries(Object.keys(this.cache.stream.enabled).map((t=>[t,e]))),...t};for(let e in t)t[e]&&(this.targetElement?.removeEventListener(e,this.cache.__controllers__[e],this.cache.options[e]),this.cache.paused[e]=!0);return this}resume(t={},e="default"){t={..."default"===e?this.cache.stream.enabled:Object.entries(Object.keys(this.cache.stream.enabled).map((t=>[t,e]))),...t};for(let e in t)t[e]&&(this.targetElement?.addEventListener(e,this.cache.__controllers__[e],this.cache.options[e]),this.cache.paused[e]=!1);return this}stream(t={},e="default"){this.cache.stream.t0=Date.now();return t={...Object.fromEntries(Object.keys(this.cache.stream.enabled).map((t=>[t,e]))),...t},Object.assign(this.cache.stream.enabled,t),this}clear(){return this}dispose(t={},e="default"){return this.pause(t,e),this}}class Bt extends Ht{constructor(t,e){super(t,Pt.Click,Nt,e)}}function Nt(){"click"===this.currentEvent?this.dx=0:this.dx=1}const $t=(t,e)=>new Bt(t,e);class Vt extends Ht{constructor(t,e){super(t,Pt.Clipboard,qt,e)}}function qt(){}const Wt=(t,e)=>new Vt(t,e);class Yt extends Ht{constructor(t,e,s){super(t,e,Gt,s)}_register_events(t){return super._register_events(t,null,null,!1),this}emit(t,e={}){const s=new Event(t);return this.targetElement.dispatchEvent(s),this}on(t,...e){return this.cache.options.hasOwnProperty(t)||this._register_events([t]),this.__onEvent(t,this.cache.options[t],{},...e),this}}function Gt(){}class Xt extends Ht{constructor(t,e){super(t,Pt.Drag,Kt,e)}}function Kt(){}const Qt=(t,e)=>new Xt(t,e);class Jt extends Ht{constructor(t,e){super(t,Pt.Focus,te,e)}}function te(){}const ee=(t,e)=>new Jt(t,e);let se=class extends Ht{constructor(t,e){super(t,Pt.Hash,re,e)}};function re(){}class ie extends Ht{constructor(t,e){super(t,Pt.Key,ne,e)}}function ne(){switch(this.currentEvent){case"keydown":this.kd=this.event.key;break;case"keypress":this.kp=this.event.key;break;case"keyup":this.ku=this.event.key}}const ae=(t,e)=>new ie(t,e);class oe extends Ht{constructor(t,e){super(t,Pt.Mouse,he,e)}}function he(){}const ce=(t,e)=>new oe(t,e);class le extends Ht{constructor(t,e){super(t,Pt.Ptr,ue,e),this.isDown=!1}}function ue(){switch(this.currentEvent){case"pointerdown":this.dx=parseInt(this.event.offsetX),this.dy=parseInt(this.event.offsetY),this.isDown=!0;break;case"pointermove":this.mx=parseInt(this.event.offsetX),this.my=parseInt(this.event.offsetY),this.isMoving=!0;break;case"pointerup":{this.ux=parseInt(this.event.offsetX),this.uy=parseInt(this.event.offsetY),this.isDown=!1,console.log(this.target.width);const t=(this.ux-this.dx)/this.target.width,e=(this.dy-this.uy)/this.target.height,s=t<0?"left":t>0?"right":"none",r=e<0?"bottom":e>0?"top":"none";this.swippe={h:s,v:r,delta_x:t,delta_y:e}}}}const me=(t,e)=>new le(t,e);class pe extends Ht{constructor(t,e){super(t,Pt.Touch,de,e)}}function de(){}class fe extends Ht{constructor(t,e){super(t,Pt.Wheel,ge,e)}}function ge(){}const be=(t,e)=>new fe(t,e),ye={ptr:me,mouse:ce,key:ae,click:$t,drag:Qt,clipboard:Wt,focus:ee,wheel:be},we={};Object.entries(Pt).forEach((([t,e])=>{e.forEach((e=>{const s=`on${e}`;we[s]=function(...e){return this.events[t]||(this.events[t]=ye[t.toLowerCase()](this)),this.events[t][s](...e),this}}))}));class xe{constructor(t={},e=(t.hasOwnProperty("default")?"default":Object.keys(t)[0]),s=0){this.id="Ziko-Style-"+s,this.keys=new Set,this.styles={default:{fontSize:"1em",color:"green"},other:{fontSize:"2em",color:"cyan"}},t&&this.add(t),e&&this.use(e)}get current(){return[...this.keys].reduce(((t,e)=>(t[e]=`var(--${e}-${this.id})`,t)),{})}add(t,e={}){return t&&"object"==typeof t&&!Array.isArray(t)?Object.assign(this.styles,t):"string"==typeof t&&Object.assign(this.styles,{[t]:e}),this}#e(t){const e=Object.keys(this.styles);for(let s in this.styles[e[t]])Object.prototype.hasOwnProperty.call(this.styles[e[t]],s)&&(document.documentElement.style.setProperty(`--${s}-${this.id}`,this.styles[e[t]][s]),this.keys.add(s));return this}#s(t){if(!this.styles[t])return this;for(let e in this.styles[t])Object.prototype.hasOwnProperty.call(this.styles[t],e)&&(document.documentElement.style.setProperty(`--${e}-${this.id}`,this.styles[t][e]),this.keys.add(e));return this}#r(t){for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(document.documentElement.style.setProperty(`--${e}-${this.id}`,t[e]),this.keys.add(e));return this}use(t){return"number"==typeof t?this.#e(t):"string"==typeof t?this.#s(t):t&&"object"==typeof t?this.#r(t):this}}const ve=(t,e,s)=>new xe(t,e,s),_e=(t,e="px")=>("number"==typeof t&&(t+=e),t instanceof Array&&(t=t.map((t=>"number"==typeof t?t+=e:t)).join(" ")),t);class ke{constructor(t={}){this.target=null,this.styles=new Map([["default",t]]),this.cache={isHidden:!1,isFaddedOut:!1,transformation:{Flip:[0,0,0],matrix:new kn([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]])}}}style(t){for(const[e,s]of Object.entries(t))bn.isCamelCase(e)&&(delete t[e],Object.assign(t,{[bn.camel2hyphencase(e)]:s}));return this?.target?.element?.style&&Object.assign(this?.target?.element?.style,t),this}linkTo(t){return this.target=t,this}use(t="default"){return this.style(this.styles.get(t)),this}update(t,e){const s=this.styles.get(t);return s?this.styles.set(t,Object.assign(s,e)):this.styles.set(t,e),this}add(t,e){return this.styles.set(t,e),this}replace(t,e){return this.styles.set(t,e),this}delete(...t){return t.forEach((t=>this.styles.delete(t))),this}updateDefaultStyle(){const t=Object.fromEntries(Object.entries(this.target.element.style).filter((t=>isNaN(+t[0]))));return this.update("default",t),this}hover(t){return t&&this.add("hover",t),this.target?.element?.addEventListener("pointerenter",(()=>this.use("hover"))),this.target?.element?.addEventListener("pointerleave",(()=>this.use("default"))),this}isInline(){return getComputedStyle(this.target.element).display.includes("inline")}isBlock(){return!this.isInline()}size(t,e){return this.style({width:t,height:e}),this}width(t){if(t instanceof Object){if(t instanceof Array&&(t={min:t[0],max:t[1]}),"min"in t||"max"in t){let e=t.min??t.max,s=t.max??t.min;e=_e(e,"px"),s=_e(s,"px"),this.style({minWidth:e,maxWidth:s},{target:target,maskVector:maskVector})}}else t=_e(t,"px"),this.style({width:t});return this}height(t){if(t instanceof Object){if(t instanceof Array&&(t={min:t[0],max:t[1]}),"min"in t||"max"in t){let e=t.min??t.max,s=t.max??t.min;e=_e(e,"px"),s=_e(s,"px"),this.style({minHeight:e,maxHeight:s},{target:target,maskVector:maskVector})}}else t=_e(t,"px"),this.style({height:t});return this}enableResize(t=!1,e=!1){let s="none";return s=t?e?"both":"horizontal":e?"vertical":"none",this.style({resize:s,overflow:"hidden"}),this.isInline()&&(console.group("Ziko Issue : Temporarily Incompatible Method"),console.warn(".enableResize has no effect on inline elements!"),console.info("%cConsider using other display types such as block, inline-block, flex, or grid for proper resizing behavior.","color:gold;background-color:#3333cc;padding:5px"),console.groupEnd()),this}hide({after:t,target:e,maskVector:s}={}){if("number"==typeof t){const r=()=>this.hide({target:e,maskVector:s});setTimeout(r,t),clearTimeout(r)}else this.cache.isHidden=!0,this.style({display:"none"},{target:e,maskVector:s});return this}show({after:t,target:e,maskVector:s}={}){if("number"==typeof t){const r=()=>this.show({target:e,maskVector:s});setTimeout(r,t),clearTimeout(r)}else this.cache.isHidden=!1,this.style({display:""},{target:e,maskVector:s});return this}color(t){return this.style({color:t}),this}background(t){return this.style({background:t}),this}backgroundColor(t){return this.style({backgroundColor:t}),this}opacity(t,{target:e,maskVector:s}={}){return this.style({opacity:t},{target:e,maskVector:s}),this}position(t){return this.style({position:t}),this}display(t,{target:e,maskVector:s}={}){return this.style({display:t},{target:e,maskVector:s}),this}zIndex(t){return this.style({zIndex:t}),this}float(t,{target:e,maskVector:s}={}){return this.style({float:t},{target:e,maskVector:s}),this}border(t="1px solid red",{target:e,maskVector:s}={}){return this.style({border:t},{target:e,maskVector:s}),this}borderTop(t="1px solid red",{target:e,maskVector:s}={}){return this.style({borderTop:t},{target:e,maskVector:s}),this}borderRight(t="1px solid red",{target:e,maskVector:s}={}){return this.style({borderRight:t},{target:e,maskVector:s}),this}borderBottom(t="1px solid red",{target:e,maskVector:s}={}){return this.style({borderBottom:t},{target:e,maskVector:s}),this}borderLeft(t="1px solid red",{target:e,maskVector:s}={}){return this.style({borderLeft:t},{target:e,maskVector:s}),this}borderRadius(t){return t=_e(t,"px"),this.style({borderRadius:t},{target:target,maskVector:maskVector}),this}margin(t){return t=_e(t,"px"),this.style({margin:t},{target:target,maskVector:maskVector}),this}marginTop(t){return t=_e(t,"px"),this.style({marginTop:t}),this}marginRight(t){return t=_e(t,"px"),this.style({marginRight:t}),this}marginBootom(t){return t=_e(t,"px"),this.style({marginBootom:t}),this}marginLeft(t){return t=_e(t,"px"),this.style({marginLeft:t}),this}padding(t){return t=_e(t,"px"),this.style({padding:t}),this}paddingTop(t){return t=_e(t,"px"),this.style({paddingTop:t}),this}paddingRight(t){return t=_e(t,"px"),this.style({paddingRight:t}),this}paddingBootom(t){return t=_e(t,"px"),this.style({paddingBootom:t}),this}paddingLeft(t){return t=_e(t,"px"),this.style({paddingLeft:t}),this}font(t){return this.style({font:t}),this}fontFamily(t=""){return this.style({fontFamily:t}),this}fontSize(t){return this.style({fontSize:t}),this}cursor(t="pointer"){return this.style({cursor:t}),this}overflow(t,e){const s=["hidden","auto"];return this.style({overflowX:"number"==typeof t?s[t]:t,overflowY:"number"==typeof e?s[e]:e},{target:target,maskVector:maskVector}),this}clip(t,{target:e,maskVector:s}={}){return"string"==typeof t&&(t="polygon("+t+")"),this.style({clipPath:t},{target:e,maskVector:s}),this}fadeOut(t=1){return this.style({transition:`opacity ${t/1e3}s`,opacity:0}),this.cache.isFaddedOut=!0,this}fadeIn(t=1){return this.style({transition:`opacity ${t/1e3}s`,opacity:1}),this.cache.isFaddedOut=!1,this}toggleFade(t=1e3,e=t){return this.cache.isFaddedOut?this.fadeIn(t):this.fadeOut(e),this}morphBorderRadius(t,e){return this.style({borderRadius:t,transition:`borderRadius ${e/1e3}s`}),this}#i(t){const e=this.cache.transformation.matrix.arr.join(",");this.style({transform:`matrix3d(${e})`,"-webkit-transform":`matrix3d(${e})`,"-moz-transform":`matrix3d(${e})`,"-ms-transform":`matrix3d(${e})`,"-o-transform":`matrix3d(${e})`}),0!=t&&this.style({transition:`transform ${t/1e3}s ease`})}translate(t,e=t,s=0,r=0){return this.cache.transformation.matrix.set(3,0,t),this.cache.transformation.matrix.set(3,1,e),this.cache.transformation.matrix.set(3,2,s),this.#i(r),this}translateX(t,e=0){return this.cache.transformation.matrix.set(3,0,t),this.#i(e),this}translateY(t,e=0){return this.cache.transformation.matrix.set(3,1,t),this.#i(e),this}translateZ(t,e=0){const s=-1/this.cache.transformation.matrix[2][2];return this.cache.transformation.matrix.set(3,2,z),this.cache.transformation.matrix.set(3,3,1-t/s),this.#i(e),this}perspective(t,e=0){const s=this.cache.transformation.matrix[3][2];return this.cache.transformation.matrix.set(2,2,-1/d),this.cache.transformation.matrix.set(3,3,1-s/t),this.#i(e),this}scale(t,e=t,s=0){return this.cache.transformation.matrix.set(0,0,t),this.cache.transformation.matrix.set(1,1,e),this.#i(s),this}scaleX(t=1,e=0){return this.cache.transformation.matrix.set(0,0,t),this.#i(e),this}scaleY(t=1,e=0){return this.cache.transformation.matrix.set(1,1,t),this.cache.transformation.matrix.arr.join(","),this.#i(e),this}skew(t,e=t,s=0){return this.cache.transformation.matrix.set(0,1,t),this.cache.transformation.matrix.set(1,0,e),this.cache.transformation.matrix.arr.join(","),this.#i(s),this}skewX(t=1,e=0){return this.cache.transformation.matrix.set(0,1,t),this.cache.transformation.matrix.arr.join(","),this.#i(e),this}skewY(t=1,e=0){return this.cache.transformation.matrix.set(1,0,t),this.cache.transformation.matrix.arr.join(","),this.#i(e),this}rotateX(t,e=0){return this.cache.transformation.matrix.set(1,1,Pn(t)),this.cache.transformation.matrix.set(1,2,-zn(t)),this.cache.transformation.matrix.set(2,1,zn(t)),this.cache.transformation.matrix.set(1,2,Pn(t)),this.#i(e),this}rotateY(t,e=0){return this.cache.transformation.matrix.set(0,0,Pn(t)),this.cache.transformation.matrix.set(0,2,zn(t)),this.cache.transformation.matrix.set(2,0,-zn(t)),this.cache.transformation.matrix.set(2,2,Pn(t)),this.#i(e),this}rotateZ(t,e=0){return this.cache.transformation.matrix.set(0,0,Pn(t)),this.cache.transformation.matrix.set(0,1,-zn(t)),this.cache.transformation.matrix.set(1,0,zn(t)),this.cache.transformation.matrix.set(1,1,Pn(t)),this.#i(e),this}flipeX(t=1){return this.cache.transformation.Flip[0]+=180,this.cache.transformation.Flip[0]%=360,this.rotateX(this.cache.transformation.Flip[0],t),this}flipeY(t=1){return this.cache.transformation.Flip[1]+=180,this.cache.transformation.Flip[1]%=360,this.rotateY(this.cache.transformation.Flip[1],t),this}flipeZ(t=1){return this.cache.transformation.Flip[2]+=180,this.cache.transformation.Flip[2]%=360,this.rotateZ(this.cache.transformation.Flip[2],t),this}slideHeightIn(t=1,e=this.h){return this.style({transition:t+"s",height:e}),this}slideHeightOut(t=1){return this.style({transition:t+"s",height:0}),this.target?.element?.n("transitionend",(()=>this.style({opacity:"none"}))),this}slideWidthIn(t=1,e=this.w){return this.style({transition:t+"s",width:e}),this}slideWidthOut(t=1){this.style({transition:t+"s",width:0});const e=()=>{this.style({opacity:"none"})};return this.target?.element?.addEventListener("transitionend",e),this.target?.element?.removeEventListener("transitionend",e),this}slideIn({transitionTimming:t=1,w:e="100%",h:s="auto"}={}){return this.style({transition:t+"s",width:e,height:s,visibility:"visible"}),this}slideOut({transitionTimming:t=1,width:e=0,heightransitionTimming:s=0}={}){this.style({visibility:"hidden",transition:t+"s",opacity:"none",width:e,height:height});const r=()=>{this.style({opacity:"none"})};return this.target?.element?.addEventListener("transitionend",r),this.target?.element?.removeEventListener("transitionend",r),this}}function Ie(t,e,s,r){return this.event=t,this.cache.preventDefault[e]&&t.preventDefault(),console.log({setter:s}),s&&s(),this.cache.stream.enabled[e]&&r&&this.cache.stream.history[e].push(r),this.cache.callbacks[e].map((t=>t(this))),this}class Ee{constructor(t){this.target=null,this.setTarget(t),this.__dispose=this.dispose.bind(this)}get targetElement(){return this.target.element}setTarget(t){return this.target=t,this}__handle(t,e,s){const r="drag"===t?t:`${this.cache.prefixe}${t}`;return this.dispose(s),this.targetElement?.addEventListener(r,e),this}__onEvent(t,e,...s){if(0===s.length){if(!(this.cache.callbacks.length>1))return this;this.cache.callbacks.map((t=>e=>t.call(this,e)))}else this.cache.callbacks[t]=s.map((t=>e=>t.call(this,e)));return this.__handle(t,this.__controller[t],e),this}preventDefault(t={}){return Object.assign(this.cache.preventDefault,t),this}pause(t={}){t={...Object.fromEntries(Object.keys(this.cache.stream.enabled).map((t=>[t,!0]))),...t};for(let e in t)t[e]&&(this.targetElement?.removeEventListener(`${this.cache.prefixe}${e}`,this.__controller[`${this.cache.prefixe}${e}`]),this.cache.paused[`${this.cache.prefixe}${e}`]=!0);return this}resume(t={}){t={...Object.fromEntries(Object.keys(this.cache.stream.enabled).map((t=>[t,!0]))),...t};for(let e in t)t[e]&&(this.targetElement?.addEventListener(`${this.cache.prefixe}${e}`,this.__controller[`${this.cache.prefixe}${e}`]),this.cache.paused[`${this.cache.prefixe}${e}`]=!1);return this}dispose(t={}){return this.pause(t),this}stream(t={}){this.cache.stream.t0=Date.now();return t={...Object.fromEntries(Object.keys(this.cache.stream.enabled).map((t=>[t,!0]))),...t},Object.assign(this.cache.stream.enabled,t),this}clear(t={}){t={...Object.fromEntries(Object.keys(this.cache.stream.clear).map((t=>[t,!0]))),...t};for(let e in t)t[e]&&(this.cache.stream.history[e]=[]);return this}}function Te(t){Ie.call(this,t,"input",null,null)}function Ae(t){Ie.call(this,t,"change",null,null)}class Ce extends Ee{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{input:!1,change:!1},paused:{input:!1,change:!1},stream:{enabled:{input:!1,change:!1},clear:{input:!1,change:!1},history:{input:[],change:[]}},callbacks:{input:[],change:[]}},this.__controller={input:Te.bind(this),change:Ae.bind(this)}}get value(){return this.target.value}onInput(...t){return this.__onEvent("input",{},...t),this}onChange(...t){return this.__onEvent("change",{},...t),this}}const Me=t=>new Ce(t);function Oe(t){Ie.call(this,t,"hashchange",null,null)}class Se extends Ee{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{hashchange:!1},paused:{hashchange:!1},stream:{enabled:{hashchange:!1},clear:{hashchange:!1},history:{hashchange:[]}},callbacks:{hashchange:[]}},this.__controller={hashchange:Oe.bind(this)}}onChange(...t){return this.__onEvent("hashchange",{},...t),this}}const je=t=>new Se(t),Ze=t=>function(e){Ie.call(this,e,t,null,null)};class Ue extends Ee{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{},paused:{},stream:{enabled:{},clear:{},history:{}},callbacks:{}},this.__controller={}}#n(t){return this.cache.preventDefault[t]=!1,this.cache.paused[t]=!1,this.cache.stream.enabled=!1,this.cache.stream.clear=!1,this.cache.stream.history=[],this.cache.callbacks[t]=[],this.__controller[t]=Ze(t).bind(this),this}on(t,...e){return this.__controller[t]||this.#n(t),this.__onEvent(t,{},...e),this}emit(t,e={}){this.__controller[t]||this.#n(t),this.detail=e;const s=new Event(t);return this.targetElement.dispatchEvent(s),this}}const Re=t=>new Ue(t);class De extends Ee{constructor(t,e=.3,s=.3){super(t);const{removeListener:r,setWidthThreshold:i,setHeightThreshold:n}=function(t,e=.5,s=.5,r,i){let n=F(e,0,r),a=F(s,0,i),o=0,h=0,c=0,l=0;const u=t=>{o=t.clientX,h=t.clientY},m=t=>{c=t.clientX,l=t.clientY,p()};function p(){const t=c-o,e=l-h;(Math.abs(t)>n||Math.abs(e)>a)&&d(t,e)}function d(e,s){const o=globalThis?.CustomEvent?new CustomEvent("swipe",{detail:{deltaX:jn(e)<n?0:oa(e)*P(jn(e),0,r),deltaY:jn(s)<a?0:oa(s)*P(jn(s),0,i),direction:{x:jn(e)<n?"none":e>0?"right":"left",y:jn(s)<a?"none":s>0?"down":"up"}}}):null;t?.dispatchEvent(o)}function f(t){n=F(t,0,r)}function g(t){a=F(t,0,i)}return t?.addEventListener("pointerdown",u),t?.addEventListener("pointerup",m),{removeListener(){t?.removeEventListener("pointerdown",u),t?.removeEventListener("pointerup",m),console.log("Swipe event listeners removed")},setWidthThreshold:f,setHeightThreshold:g}}(this.target?.element,e,s,this.target.width,this.target.height);this.cache={width_threshold:e,height_threshold:s,removeListener:r,setWidthThreshold:i,setHeightThreshold:n,legacyTouchAction:globalThis?.document?.body?.style?.touchAction,prefixe:"",preventDefault:{swipe:!1},paused:{swipe:!1},stream:{enabled:{swipe:!1},clear:{swipe:!1},history:{swipe:[]}},callbacks:{swipe:[]}},this.__controller={swipe:Le.bind(this)}}onSwipe(...t){return Object.assign(globalThis?.document?.body?.style,{touchAction:"none"}),this.__onEvent("swipe",{},...t),this}updateThresholds(t=this.cache.width_threshold,e=this.cache.height_threshold){return void 0!==t&&this.cache.setWidthThreshold(t),void 0!==e&&this.cache.setHeightThreshold(e),this}destroy(){return this.cache.removeListener(),Object.assign(globalThis?.document?.body?.style,{touchAction:this.cache.legacyTouchAction}),this}}function Le(t){Ie.call(this,t,"swipe",null,null)}const Pe=(t,e,s)=>new De(t,e,s);var ze=Object.freeze({__proto__:null,ZikoCustomEvent:Ue,ZikoEventHash:Se,ZikoEventInput:Ce,ZikoEventSwipe:De,useCustomEvent:Re,useHashEvent:je,useInputEvent:Me,useSwipeEvent:Pe});class Fe{constructor(t,e){this.target=t,this.observer=null,this.cache={options:e||{attributes:!0,childList:!0,subtree:!0},streamingEnabled:!0,lastMutation:null,mutationHistory:{}},this.observeCallback=(t,e)=>{if(this.cache.streamingEnabled)for(const e of t)switch(e.type){case"attributes":this.cache.mutationHistory.attributes.push(e.target.getAttribute(e.attributeName));break;case"childList":this.cache.mutationHistory.childList.push(e);break;case"subtree":this.cache.mutationHistory.subtree.push(e)}this.callback&&this.callback(t,e)}}observe(t){if(!this.observer){if(!globalThis.MutationObserver)return void console.log("MutationObserver Nor Supported");this.observer=new MutationObserver(this.cache.observeCallback),this.observer.observe(this.target.element,this.cache.options),this.callback=([e])=>t.call(e,this),this.cache.streamingEnabled=!0}}pause(t){this.observer&&(this.observer.disconnect(),t&&this.observer.observe(this.target,t))}reset(t){this.observer&&(this.observer.disconnect(),this.observer.observe(this.target,t||this.cache.options))}clear(){return this.observer&&(this.observer.disconnect(),this.observer=null,this.cache.mutationHistory={attributes:[],childList:[],subtree:[]}),this.cache.streamingEnabled=!1,this}getMutationHistory(){return this.cache.mutationHistory}enableStreaming(){return this.cache.streamingEnabled=!0,this}disableStreaming(){return this.cache.streamingEnabled=!1,this}}const He=(t,e={},s=null)=>{const r=new Fe(t,e);return s&&r.observe(s),r};class Be extends Fe{constructor(t,e){super(t,{attributes:!0,childList:!1,subtree:!1}),Object.assign(this.cache,{observeCallback:(t,e)=>{for(const e of t)this.cache.lastMutation={name:e.attributeName,value:e.target.getAttribute(e.attributeName)},this.cache.streamingEnabled&&this.cache.mutationHistory.attributes.push(this.cache.lastMutation);this.callback&&this.callback(t,e)}}),this.cache.mutationHistory.attributes=[],e&&this.observe(e)}get history(){return this.cache.mutationHistory.attributes}}const Ne=(t,e)=>new Be(t,e);class $e extends Fe{constructor(t,e){super(t,{attributes:!1,childList:!0,subtree:!1}),Object.assign(this.cache,{observeCallback:(t,e)=>{for(const e of t)e.addedNodes?this.cache.lastMutation={type:"add",item:this.target.find((t=>t.element===e.addedNodes[0]))[0],previous:this.target.find((t=>t.element===e.previousSibling))[0]}:e.addedNodes&&(this.cache.lastMutation={type:"remove",item:this.target.find((t=>t.element===e.removedNodes[0]))[0],previous:this.target.find((t=>t.element===e.previousSibling))[0]}),this.cache.streamingEnabled&&this.cache.mutationHistory.children.push(this.cache.lastMutation);this.callback&&this.callback(t,e)}}),this.cache.mutationHistory.children=[],e&&this.observe(e)}get item(){return this.cache.lastMutation.item}get history(){return this.cache.mutationHistory.children}}const Ve=(t,e)=>new $e(t,e);class qe{constructor(t,e,{threshold:s=0,margin:r=0}={}){this.target=t,this.config={threshold:s,margin:r},globalThis.IntersectionObserver?this.observer=new IntersectionObserver((t=>{this.entrie=t[0],e(this)}),{threshold:this.threshold}):console.log("IntersectionObserver Not Supported")}get ratio(){return this.entrie.intersectionRatio}get isIntersecting(){return this.entrie.isIntersecting}setThreshould(t){return this.config.threshold=t,this}setMargin(t){return t="number"==typeof t?t+"px":t,this.config.margin=t,this}start(){return this.observer.observe(this.target.element),this}stop(){return this}}const We=(t,e,s)=>new qe(t,e,s);class Ye{constructor(t,e){this.target=t,this.contentRect=null,this.observer=new ResizeObserver((()=>{e(this)}))}get BoundingRect(){return this.target.element.getBoundingClientRect()}get width(){return this.BoundingRect.width}get height(){return this.BoundingRect.height}get top(){return this.BoundingRect.top}get bottom(){return this.BoundingRect.bottom}get right(){return this.BoundingRect.right}get left(){return this.BoundingRect.left}get x(){return this.BoundingRect.x}get y(){return this.BoundingRect.y}start(){return this.observer.observe(this.target.element),this}stop(){return this.observer.unobserve(this.target.element),this}}const Ge=(t,e)=>new Ye(t,e);class Xe{constructor(t=(t=>console.log({x:t.x,y:t.y}))){this.cache={},this.previousX=globalThis?.screenX,this.previousY=globalThis?.screenY}update(){Object.assign(this.cache,{screenXLeft:globalThis?.screenX,screenXRight:globalThis?.screen.availWidth-globalThis?.screenX,screenYTop:globalThis?.screenY,screenYBottom:globalThis?.screen.availHeight-globalThis?.screenY-globalThis?.outerHeight,screenCenterX:globalThis?.screen.availWidth/2,screenCenterY:globalThis?.screen.availHeight/2,windowCenterX:globalThis?.outerWidth/2+globalThis?.screenX,windowCenterY:globalThis?.outerHeight/2+globalThis?.screenY,deltaCenterX:globalThis?.screen.availWidth/2-globalThis?.outerWidth/2+globalThis?.screenX,deltaCenterY:null})}get x0(){return H(globalThis?.screenX,0,globalThis.screen.availWidth,-1,1)}get y0(){return-H(globalThis?.screenY,0,globalThis.screen.availHeight,-1,1)}get x1(){return H(globalThis?.screenX+globalThis?.outerWidth,0,globalThis.screen.availWidth,-1,1)}get y1(){return-H(globalThis?.screenY+globalThis?.outerHeight,0,globalThis.screen.availHeight,-1,1)}get cx(){return H(globalThis?.outerWidth/2+globalThis?.screenX,0,globalThis.screen.availWidth,-1,1)}get cy(){return-H(globalThis?.outerHeight/2+globalThis?.screenY,0,globalThis.screen.availHeight,-1,1)}}const Ke=t=>new Xe(t);var Qe=Object.freeze({__proto__:null,ZikoMutationObserver:Fe,watch:He,watchAttr:Ne,watchChildren:Ve,watchIntersection:We,watchScreen:Ke,watchSize:Ge});const Je=(t,e=[],s=(()=>{}))=>{t.cache.stream.enabled.down=!0;const r=e.length,i=t.cache.stream.history.down.slice(-r).map((t=>t.key));e.join("")===i.join("")&&(t.event.preventDefault(),s.call(t,t))};class ts{constructor(){this.events={},this.maxListeners=10}on(t,e){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.`)}once(t,e){const s=r=>{this.off(t,s),e(r)};this.on(t,s)}off(t,e){const s=this.events[t];if(s){const t=s.indexOf(e);-1!==t&&s.splice(t,1)}}emit(t,e){const s=this.events[t];s&&s.forEach((t=>{t(e)}))}clear(t){t?delete this.events[t]:this.events={}}setMaxListener(t,e){this.maxListeners=e}removeAllListeners(t){t?this.events[t]=[]:this.events={}}}const es=()=>new ts;let ss=class{constructor(t,e=!0){this.#n(),this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}#n(){return this.__FavIcon__=document.querySelector("link[rel*='icon']")||document?.createElement("link"),this.__FavIcon__.type="image/x-icon",this.__FavIcon__.rel="shortcut icon",this}set(t){return t!==this.__FavIcon__.href&&(this.__FavIcon__.href=t,this.cache.Emitter&&this.cache.Emitter.emit("ziko:favicon-changed")),this}get current(){return document.__FavIcon__.href}onChange(t){return this.cache.Emitter&&this.cache.Emitter.on("ziko:favicon-changed",t),this}useEventEmitter(){return this.cache.Emitter=es(),this}};const rs=(t,e)=>new ss(t,e);let is=class{constructor({viewport:t,charset:e,description:s,author:r,keywords:i}){this.document=globalThis?.document,this.meta={},this.init({viewport:t,charset:e,description:s,author:r,keywords:i})}init({viewport:t,charset:e,description:s,author:r,keywords:i}){t&&this.setViewport(t),e&&this.setCharset(e),s&&this.describe(s),r&&this.setAuthor(r),i&&this.setKeywords(i)}set(t,e){const s="charset"===(t=t.toLowerCase()),r=s?document.querySelector("meta[charset]"):document.querySelector(`meta[name=${t}]`);return this.meta=r??document?.createElement("meta"),s?this.meta.setAttribute("charset",e):(this.meta.setAttribute("name",t),this.meta.setAttribute("content",e)),r||this.document.head.append(this.meta),this}setCharset(t="utf-8"){return this.set("charset",t),this}describe(t){return this.set("description",t),this}setViewport(t="width=device-width, initial-scale=1.0"){return this.set("viewport",t),this}setKeywords(...t){return t=[...new Set(t)].join(", "),this.set("keywords",t),this}setAuthor(t){return this.set("author",t),this}};const ns=({viewport:t,charset:e,description:s,author:r,keywords:i})=>new is({viewport:t,charset:e,description:s,author:r,keywords:i});let as=class{constructor(t=document.title,e=!0){this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}useEventEmitter(){return this.cache.Emitter=es(),this}set(t){return t!==document.title&&(document.title=t,this.cache.Emitter&&this.cache.Emitter.emit("ziko:title-changed")),this}get current(){return document.title}onChange(t){return this.cache.Emitter&&this.cache.Emitter.on("ziko:title-changed",t),this}};const os=(t,e)=>new as(t,e);let hs=class{constructor({title:t,lang:e,icon:s,meta:r,noscript:i}){this.html=globalThis?.document?.documentElement,this.head=globalThis?.document?.head,t&&os(t),e&&this.setLang(e),s&&rs(s),r&&ns(r),i&&this.setNoScript()}setLang(t){this.html.setAttribute("lang",t)}setNoScript(t){}};const cs=({title:t,lang:e,icon:s,meta:r,noscript:i})=>new hs({title:t,lang:e,icon:s,meta:r,noscript:i});class ls{constructor(t=[],e=(()=>{})){this.mediaQueryRules=t,this.fallback=e,this.lastCalledCallback=null,this.init()}init(){this.mediaQueryRules.forEach((({query:t,callback:e})=>{const s=globalThis.matchMedia(t),r=()=>{const t=this.mediaQueryRules.some((({query:t})=>globalThis.matchMedia(t).matches));s.matches?(e(),this.lastCalledCallback=e):t||this.lastCalledCallback===this.fallback||(this.fallback(),this.lastCalledCallback=this.fallback)};r(),s.addListener(r)}))}}const us=(t,e)=>new ls(t,e);const ms={...ze,...Qe,...Object.freeze({__proto__:null,ZikoHead:hs,ZikoUseStyle:xe,useFavIcon:rs,useHead:cs,useMediaQuery:us,useMeta:ns,useStyle:ve,useSuccesifKeys:Je,useTitle:os})};class ps extends Ut{constructor(t,s="",{el_type:r="html",useDefaultStyle:i=!1}={}){if(super(),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);default:throw Error("Not supported")}else this.target=t.parentElement;e(this,Rt,Lt,we),Object.assign(this.cache,{name:s,isInteractive:[!0,!1][Math.floor(2*Math.random())],parent:null,isBody:!1,isRoot:!1,isHidden:!1,isFrozzen:!1,legacyParent:null,style:new ke({}),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.uuid=`${this.cache.name}-${dt.string(16)}`,this.ui_index=globalThis.__Ziko__.__CACHE__.get_ui_index(),this.cache.style.linkTo(this),i&&this.style({position:"relative",boxSizing:"border-box",margin:0,padding:0,width:"auto",height:"auto"}),this.items=[],globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this],t&&globalThis.__Ziko__.__Config__.default.render&&this?.render?.(),this.isInteractive()&&(this.setAttr("ziko-hydration-index",globalThis.__Ziko__.__HYDRATION__.index),globalThis.__Ziko__.__HYDRATION__.map.set(globalThis.__Ziko__.__HYDRATION__.index,(()=>this)),globalThis.__Ziko__.__HYDRATION__.increment())}get element(){return this.cache.element}isInteractive(){return this.cache.isInteractive}isZikoUIElement(){return!0}register(){return 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}clone(t=!1){const e=new this.constructor;if(e.__proto__=this.__proto__,this.items.length){const t=[...this.items].map((t=>t.clone()));e.append(...t)}else e.element=this.element.cloneNode(!0);return e.render(t)}style(t){return t instanceof xe?this.st.style(t.current):this.st.style(t),this}size(t,e){return this.st.size(t,e),this}[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})}filter(t,e=(()=>{}),s=(()=>{})){const r=this.items.filter(t);return r.forEach(e),this.items.filter((t=>!r.includes(t))).forEach(s),this}filterByTextContent(t,e=!1){this.items.forEach((t=>t.render())),this.filter((s=>!(e?s.text===t:s.text.includes(t))),(t=>t.unrender()))}filterByClass(t){return this.items.map((t=>t.render())),this.items.filter((e=>!e.classes.includes(t))).map((t=>t.unrender())),this}sortByTextContent(t,e){let s=this.children;return s.filter((e=>!e.textContent.toLowerCase().includes(t.toLowerCase()))).map((t=>{t.style.display="none"})),s.filter((e=>e.textContent.toLowerCase().includes(t.toLowerCase()))).map(((t,s)=>t.style.display=e[s])),s.filter((t=>"none"!=t.style.display)),this}get#a(){const t=globalThis.getComputedStyle(this.element),e={};return"0px"!==t.marginRight&&Object.assign(e,{marginLeft:t.marginRight}),"0px"!==t.marginLeft&&Object.assign(e,{marginRight:t.marginLeft}),"0px"!==t.paddingRight&&Object.assign(e,{paddingLeft:t.paddingRight}),"0px"!==t.paddingLeft&&Object.assign(e,{paddingRight:t.paddingLeft}),"0px"!==t.left&&Object.assign(e,{right:t.left}),"0px"!==t.right&&Object.assign(e,{left:t.right}),"right"===t.textAlign&&Object.assign(e,{textAlign:"left"}),"left"===t.textAlign&&Object.assign(e,{textAlign:"right"}),"right"===t.float&&Object.assign(e,{float:"left"}),"left"===t.float&&Object.assign(e,{float:"right"}),"0px"!==t.borderRadiusLeft&&Object.assign(e,{right:t.borderRadiusRight}),"0px"!==t.borderRadiusRight&&Object.assign(e,{right:t.borderRadiusLeft}),["flex","inline-flex"].includes(t.display)&&("flex-end"===t.justifyContent&&Object.assign(e,{justifyContent:"flex-start"}),"flex-start"===t.justifyContent&&Object.assign(e,{justifyContent:"flex-end"})),e}useRtl(t=!1){return t?this.style({...this.#a,direction:"rtl"}):this.style({direction:"rtl"}),this}useLtr(t=!1){return t?this.style({...this.#a,direction:"ltr"}):this.style({direction:"ltr"}),this}freeze(t){return this.cache.isFrozzen=t,this}setTarget(t){if(!this.isBody)return t?.isZikoUIElement&&(t=t.element),this.unrender(),this.target=t,this.render(),this}describe(t){t&&this.setAttr("aria-label",t)}animate(t,{duration:e=1e3,iterations:s=1,easing:r="ease"}={}){return this.element?.animate(t,{duration:e,iterations:s,easing:r}),this}#o(t,e){"svg"!==this.element.tagName&&(t=bn.isCamelCase(t)?bn.camel2hyphencase(t):t),this?.attr[t]&&this?.attr[t]===e||(this.element.setAttribute(t,e),Object.assign(this.cache.attributes,{[t]:e}))}setAttr(t,e){if(t instanceof Object){const[s,r]=[Object.keys(t),Object.values(t)];for(let t=0;t<s.length;t++)r[t]instanceof Array&&(e[t]=r[t].join(" ")),this.#o(s[t],r[t])}else e instanceof Array&&(e=e.join(" ")),this.#o(t,e);return this}removeAttr(...t){for(let e=0;e<t.length;e++)this.element?.removeAttribute(t[e]);return this}getAttr(t){return t=bn.isCamelCase(t)?bn.camel2hyphencase(t):t,this.element.attributes[t].value}setContentEditable(t=!0){return this.setAttr("contenteditable",t),this}get children(){return[...this.element.children]}get cloneElement(){return this.element.cloneNode(!0)}setClasses(...t){return this.setAttr("class",t.join(" ")),this}get classes(){const t=this.element.getAttribute("class");return null===t?[]:t.split(" ")}addClass(){}setId(t){return this.setAttr("id",t),this}get id(){return this.element.getAttribute("id")}onSwipe(t,e,...s){return this.events.swipe||(this.events.swipe=Pe(this,t,e)),this.events.swipe.onSwipe(...s),this}on(t,...e){return this.events.custom||(this.events.custom=Re(this)),this.events.custom.on(t,...e),this}emit(t,e={}){return this.events.custom||(this.events.custom=Re(this)),this.events.custom.emit(t,e),this}watchAttr(t){return this.observer.attr||(this.observer.attr=Ne(this,t)),this}watchChildren(t){return this.observer.children||(this.observer.children=Ve(this,t)),this}watchSize(t){return this.observer.resize||(this.observer.resize=Ge(this,t)),this.observer.resize.start(),this}watchIntersection(t,e){return this.observer.intersection||(this.observer.intersection=We(this,t,e)),this.observer.intersection.start(),this}}class ds extends ps{constructor(t,e,s,...r){super(t,e),this.addValue(...r),this.style({margin:0,padding:0}),Object.assign(this.cache,{lineBreak:s})}get isText(){return!0}get value(){return this.element.textContent}clear(){return this.element.childNodes.forEach((t=>t.remove())),this.element.textContent="",this}addValue(...t){return t.forEach(((t,e)=>{"string"==typeof t||"number"==typeof t?this.element?.appendChild(globalThis?.document.createTextNode(t)):t instanceof ps?this.element?.appendChild(t.element):t instanceof Mn||t instanceof kn?this.element?.appendChild(new Text(t.toString())):t instanceof Array?this.element?.appendChild(new Text(un(t))):t instanceof Object&&this.element?.appendChild(new Text(cn(t))),this.cache.lineBreak&&this.element?.appendChild(globalThis.document?.createElement("br"))})),this}setValue(...t){return this.clear(),this.addValue(...t),this}}class fs extends ds{constructor(...t){super("span","text",!1,...t)}}class gs extends ds{constructor(...t){super("q","quote",!1,...t),this.style({fontStyle:"italic"})}get isQuote(){return!0}}class bs extends ds{constructor(...t){super("dfn","dfnText",!1,...t)}get isDfnText(){return!0}}class ys extends ds{constructor(t){super("sup","supText",!1,t)}get isSupText(){return!0}}class ws extends ds{constructor(...t){super("sub","subText",!1,...t)}get isSubText(){return!0}}class xs extends ds{constructor(...t){super("code","codeText",!1,...t)}get isCodeText(){return!0}}class vs extends ds{constructor(t,e){super("abbr","abbrText",!1,t),this.setAttr("title",e)}get isAbbrText(){return!0}}const _s=(...t)=>new fs(...t),ks=(...t)=>new gs(...t),Is=(...t)=>new bs(...t),Es=(...t)=>new ys(...t),Ts=(...t)=>new ws(...t),As=(...t)=>new xs(...t),Cs=(t,e)=>new vs(t,e);class Ms extends ds{constructor(...t){super("p","p",!0,...t)}get isPara(){return!0}}class Os extends ds{constructor(t,e){super("blockquote","blockquote",!0,e),this.setAttr("cite",t)}get isBlockQuote(){return!0}}const Ss=(...t)=>new Ms(...t),js=(t,e)=>new Os(t,e);class Zs extends ps{constructor(t=1,e=""){super(`h${t}`,`h${t}`),this.element.textContent=e}get isHeading(){return!0}get value(){return this.element.innerText}setValue(t=""){this.element.innerText=t}addValue(t=""){return this.element.innerText+=t,this}}const Us=(t="")=>new Zs(1,t),Rs=(t="")=>new Zs(2,t),Ds=(t="")=>new Zs(3,t),Ls=(t="")=>new Zs(4,t),Ps=(t="")=>new Zs(5,t),zs=(t="")=>new Zs(6,t);var Fs=Object.freeze({__proto__:null,ZikoUIAbbrText:vs,ZikoUIBlockQuote:Os,ZikoUICodeText:xs,ZikoUIDefintion:bs,ZikoUIHeading:Zs,ZikoUIParagraphe:Ms,ZikoUIQuote:gs,ZikoUISubText:ws,ZikoUISupText:ys,ZikoUIText:fs,abbrText:Cs,blockQuote:js,codeText:As,dfnText:Is,h1:Us,h2:Rs,h3:Ds,h4:Ls,h5:Ps,h6:zs,p:Ss,quote:ks,subText:Ts,supText:Es,text:_s});class Hs extends ps{constructor(t){super("li","li"),this.append(t)}get isLi(){return!0}}class Bs extends ps{constructor(t,e){super(t,e),delete this.append,this.style({listStylePosition:"inside"})}get isList(){return!0}append(...t){for(let e=0;e<t.length;e++){let s=null;["string","number"].includes(typeof t[e])&&(t[e]=_s(t[e])),t[e]instanceof ps&&(s=new Hs(t[e])),s.setTarget(this.element),this.items.push(s[0]),this.maintain()}}remove(...t){if(0==t.length)this.target.children.length&&this.target.removeChild(this.element);else{const e=t=>{"number"==typeof t&&(t=this.items[t]),t instanceof ps&&this.element?.removeChild(t.parent.element),this.items=this.items.filter((e=>e!==t))};for(let s=0;s<t.length;s++)e(t[s]);for(let t=0;t<this.items.length;t++)Object.assign(this,{[[t]]:this.items[t]})}return this}insertAt(t,...e){if(t>=this.element.children.length)this.append(...e);else for(let s=0;s<e.length;s++){let r=null;["number","string"].includes(typeof e[s])&&(e[s]=_s(e[s])),e[s]instanceof ps&&(r=new Hs(e[s])),this.element?.insertBefore(r.element,this.items[t].parent.element),this.items.splice(t,0,e[s][0])}return this}filterByTextContent(t,e=!1){return this.items.map((t=>t.parent.render())),this.items.filter((s=>{const r=s.element.textContent;return!(e?r===t:r.includes(t))})).map((t=>t.parent.render(!1))),this}sortByTextContent(t=1){return this.items.map((t=>t.parent.render(!1))),this.sortedItems=this.items.sort(((e,s)=>t*e.element.textContent.localeCompare(s.element.textContent))),this.append(...this.sortedItems),this}filterByClass(t){return this.items.map((t=>t.parent.render(!0))),this.items.filter((e=>!e.Classes.includes(t))).map((t=>t.parent.render(!1))),this}delete(t){return[...this.element.children].indexOf(t)}push(){}pop(){}unshift(){}shift(){}sort(){}filter(){}slice(){}}class Ns extends Bs{constructor(...t){super("ol","ol"),this.append(...t)}get isOl(){return!0}type(t=1){return this.element?.setAttribute("type",t),this}start(t=1){return this.element?.setAttribute("start",t),this}}class $s extends Bs{constructor(...t){super("ul","ul"),this.append(...t)}get isUl(){return!0}}const Vs=t=>new Hs(t),qs=(...t)=>new Ns(...t),Ws=(...t)=>new $s(...t);var Ys=Object.freeze({__proto__:null,li:Vs,ol:qs,ul:Ws});class Gs extends ps{constructor(t,e,s="",r){super("input","input"),Object.assign(this.events,{input:null}),this.setValue(s),this.setAttr("type",t),this.setAttr("name",e),r&&this.linkDatalist(r)}get isInput(){return!0}setName(t){return this.setAttr("name",t),this}onInput(...t){return this.events.input||(this.events.input=Me(this)),this.events.input.onInput(...t),this}onChange(...t){return this.events.input||(this.events.input=Me(this)),this.events.input.onChange(...t),this}linkDatalist(t){let e;if(t instanceof ZikoUIInputDatalist)e=t.Id;else if(t instanceof Array){const s=new ZikoUIInputDatalist(...t);e=s.Id,console.log(s)}else e=t;return this.element?.setAttribute("list",e),this}get value(){return this.element.value}setValue(t=""){return this.element.value=t,this}useState(t){return this.setValue(t),[{value:this.value},t=>this.setValue(t)]}setPlaceholder(t){return t&&(this.element.placeholder=t),this}get isValide(){return this.element.checkValidity()}setRequired(t=!0){return this.element.required=t,this}select(){return this.element.select(),this}copy(){return this.element.select(),document.execCommand("copy"),this}cut(){return this.element.select(),document.execCommand("cut"),this}accept(t){return this.element.accept=t,this}}const Xs=(t,e)=>{if(t instanceof Object){const{datalist:e,placeholder:s}=t;return t=t.value??"",new Gs("text","input",t,e).setPlaceholder(s)}return new Gs("text","input",t,e)};class Ks extends Gs{constructor(t,e,s=1){super("number","inpuNumber"),this.setMin(t).setMax(e).setStep(s)}get isInputNumber(){return!0}get value(){return+this.element.value}setMin(t){return this.element.min=t,this}setMax(t){return this.element.max=t,this}setStep(t){return this.element.step=t,this}}const Qs=(t,e,s)=>{if(t instanceof Object){const{value:e,max:s=10,step:r=1,placeholder:i=""}=t;return t=t?.min??0,new ZikoUIInputSlider(t,s,r).setValue(e).setPlaceholder(i)}return new Ks(t,e,s)};let Js=class extends Gs{constructor(t=0,e=0,s=10,r=1){super("range","inputSlider"),this.setMin(e).setMax(s).setValue(t).setStep(r)}get isInputSlider(){return!0}setMin(t){return this.element.min=t,this}setMax(t){return this.element.max=t,this}setStep(t){return this.element.step=t,this}};const tr=(t,e,s,r)=>{if(t instanceof Object){const{min:e=0,max:s=10,step:r=1}=t;return new Js(t=t?.value??5,e,s,r)}return new Js(t,e,s,r)};class er extends Gs{constructor(){super("color","inputColor"),this.background(this.value),this.onInput((()=>this.background(this.value)))}get isInputColor(){return!0}}const sr=()=>new er;class rr extends Gs{constructor(){super("search","inputSearch"),this.Length=0}get isInputSearch(){return!0}onsearch(t){return this.element?.addEventListener("search",(()=>t())),this}connect(...t){return this}displayLength(t){return this.element?.addEventListener("keyup",(()=>t.setValue(this.Length))),this}}const ir=(...t)=>(new rr).connect(...t);class nr extends Gs{constructor(){super("checkbox","inputCheckbox"),this.cursor("pointer")}get isInputCheckbox(){return!0}get checked(){return this.element.checked}check(t=!0){return this.element.checked=t,this}color(t){return this.element.style.accentColor=t,this}}const ar=()=>new nr;class or extends Gs{constructor(){super("radio","inputRadio"),this.cursor("pointer")}get isInputRadio(){return!0}get checked(){return this.element.checked}check(t=!0){return this.element.checked=t,this}color(t){return this.element.style.accentColor=t,this}}const hr=()=>new or;class cr extends Gs{constructor(){super("email","inputEmail")}get isInputEmail(){return!0}}const lr=()=>new cr;class ur extends Gs{constructor(){super("password","inputPassword")}get isInputPassword(){return!0}}const mr=()=>new ur;class pr extends Gs{constructor(){super("date","inputDate")}get isInputDate(){return!0}}const dr=()=>new pr;class fr extends Gs{constructor(){super("time","inputTime")}get isInputTime(){return!0}}const gr=()=>new fr;class br extends Gs{constructor(){super("datetime-local","inputDateTime")}get isInputDateTime(){return!0}}const yr=()=>new br;class wr extends ps{constructor(t,e){super("div",""),this.element.append("svg"===e?function(t){if(globalThis?.DOMParser){return(new DOMParser).parseFromString(t.replace(/\s+/g," ").trim(),"image/svg+xml").documentElement}}(t):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))}}class xr extends wr{constructor(t){super(t,"html")}}class vr extends wr{constructor(t){super(t,"svg")}}const _r=t=>new xr(t),kr=t=>new vr(t);class Ir extends ps{constructor(t,e){super("div","suspense"),this.setAttr({dataTemp:"suspense"}),this.fallback_ui=t,this.append(t),(async()=>{try{const s=await e();t.unrender(),this.append(s)}catch(t){console.log({error:t})}})()}}const Er=(t,e)=>new Ir(t,e),Tr=(t,e,s,...r)=>{const{name:i,style:n,...a}=s;let o=new ps(t,i,e);return n&&o.style(n),a&&o.setAttr(a),r&&o.append(...r),o},Ar=(t,e={},...s)=>Tr(t,"html",e,...s),Cr=(t,e={},...s)=>Tr(t,"svg",e,...s),Mr=["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","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"].reduce(((t,e)=>(t[e]=(t,...s)=>Ar(e,t,...s),t)),{}),Or=["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"].reduce(((t,e)=>(t[e]=(t,...s)=>Ar(e,t,...s),t)),{});class Sr extends ps{constructor(t){super(t,"html")}}class jr extends ps{constructor(t="button"){super("button","btn"),this.setValue(t),this.st.cursor("pointer"),globalThis.__Ziko__.__Config__.default.render&&this.render()}get isBtn(){return!0}setValue(t){return t instanceof ps?t.setTarget(this.element):(this.element?.appendChild(document.createTextNode("")),this.element.childNodes[0].data=t),this}get value(){return this.element.innerText}toggleValues(...t){let e=(t=t.map((t=>""+t))).indexOf(""+this.value);return-1!=e&&e!=t.length-1?this.setValue(t[e+1]):this.setValue(t[0]),this}}class Zr extends ps{constructor(){super("br","br")}get isBr(){return!0}}class Ur extends ps{constructor(){super("hr","hr"),this.setAttr("role","none")}get isHr(){return!0}}class Rr extends ps{constructor(t){super("a","link"),Object.assign(this.cache,{defaultStyle:{color:"#0275d8",textDecoration:"none"},hoverStyle:{color:"#01447e",textDecoration:"underline"}}),this.setHref(t),this.style(this.cache.defaultStyle),this.onPtrEnter((()=>this.style(this.cache.hoverStyle))),this.onPtrLeave((()=>this.style(this.cache.defaultStyle)))}setHref(t){this.element.href=t}get isLink(){return!0}}const Dr=()=>new Zr,Lr=()=>new Ur,Pr=(t=1)=>new Array(t).fill(new Zr),zr=(t=1)=>new Array(t).fill(new Ur),Fr=(t,...e)=>new Rr(t).append(...e),Hr=(t,...e)=>new Sr(t).append(...e),Br=t=>new jr(t);var Nr=Object.freeze({__proto__:null,HTMLWrapper:_r,SVGWrapper:kr,Suspense:Er,ZikoUIBr:Zr,ZikoUIHTMLWrapper:xr,ZikoUIHr:Ur,ZikoUIHtmlTag:Sr,ZikoUILink:Rr,ZikoUISVGWrapper:vr,ZikoUISuspense:Ir,ZikoUIXMLWrapper:wr,br:Dr,brs:Pr,btn:Br,h:Ar,hTags:Mr,hr:Lr,hrs:zr,html:Hr,link:Fr,s:Cr,sTags:Or});class $r extends ps{constructor(t="File"){super("inputImage"),this._aux_element=Br(t).setTarget(this.target),this.element=document?.createElement("input"),this.element?.setAttribute("type","file"),this.element?.setAttribute("accept","image"),this._aux_element.onClick((()=>this.element.click())),this.element.onChange=this.handleImage.bind(this)}get isInputImage(){return!0}handleImage(t){const e=new FileReader,s=new Image;e.onload=function(t){s.src=t.target.result,console.log(s.src)},e.readAsDataURL(t.target.files[0]),this.img=s}get value(){return this.img}render(t=!0){return t?this.target.appendChild(this._aux_element.element):this.remove(),this}remove(){return this.target.children.length&&this.target.removeChild(this._aux_element.element),this}}const Vr=t=>new $r(t);class qr extends ps{constructor(t,e,s,r){super("img","image"),this.value=t,"IMG"===t.nodeName?this.element.setAttribute("src",t.src):this.element?.setAttribute("src",t),"number"==typeof s&&(s+="%"),"number"==typeof r&&(r+="%"),this.setAttr("alt",e),this.style({border:"1px solid black",width:s,height:r})}get isImg(){return!0}updateSrc(t){return this.value=t,this.element.src=t,this}toggleSrc(...t){let e=(t=t.map((t=>""+t))).indexOf(""+this.value);return-1!=e&&e!=t.length-1?this.updateSrc(t[e+1]):this.updateSrc(t[0]),this}alt(t){return this.element.alt=t,this}}const Wr=(t,e,s,r)=>new qr(t,e,s,r);class Yr extends ps{constructor(t,e){super("figure","figure"),this.img=t.width("100%").element,this.caption=document?.createElement("figcaption"),this.caption.append(e.element),this.element?.append(this.img),this.element?.append(this.caption)}get isFigure(){return!0}}const Gr=(t,e)=>new Yr(t,e);class Xr extends ps{constructor(t,e){super(t,e),this.useControls()}get t(){return this.element.currentTime}useControls(t=!0){return this.element.controls=t,this}enableControls(){return this.element.controls=!0,this}disableControls(){return this.element.controls=!0,this}toggleControls(){return this.element.controls=!this.element.controls,this}play(){return this.element.play(),this}pause(){return this.element.pause(),this}seekTo(t){return this.element.currentTime=t,this}onPlay(){}onPause(){}}class Kr extends Xr{constructor(t="",e="100%",s="50vh"){super("video","video"),"VIDEO"===t.nodeName?this.element?.setAttribute("src",t.src):this.element?.setAttribute("src",t),"number"==typeof e&&(e+="%"),"number"==typeof s&&(s+="%"),this.style({width:e,height:s})}get isVideo(){return!0}usePoster(t=""){return this.element.poster=t,this}usePIP(t){return this.element.requestPictureInPicture(t),this}}const Qr=(t,e,s)=>new Kr(t,e,s);class Jr extends Xr{constructor(t){super("audio","audio"),this.element?.setAttribute("src",t),this.size("150px","30px")}get isAudio(){return!0}}const ti=t=>new Jr(t);var ei=Object.freeze({__proto__:null,ZikoUIAudio:Jr,ZikoUIFigure:Yr,ZikoUIImage:qr,ZikoUIVideo:Kr,audio:ti,figure:Gr,image:Wr,video:Qr});class si extends Kr{constructor(){super(),this.element?.setAttribute("src",""),this.constraints={audio:!0,video:{width:1280,height:720}}}get isInputCamera(){return!0}start(){return navigator.mediaDevices.getUserMedia(this.constraints).then((t=>{this.element.srcObject=t,this.element.onloadedmetadata=()=>{this.element.play()}})).catch((function(t){console.log(t.name+": "+t.message)})),this}}const ri=()=>new si;class ii extends ps{constructor(){super(),this.element=document?.createElement("label")}get isLabel(){return!0}}class ni extends ps{constructor(t=""){super(),this.element=document?.createElement("option"),t instanceof Object&&"value"in t?(this.setValue(t.value),this.setText(t?.text??t.value)):this.setValue(t)}setValue(t=""){return this.element.value=t,this}setText(t=""){return t&&(this.element.textContent=t),this}}let ai=class extends ps{constructor(...t){super(),this.element=document?.createElement("datalist"),this.addOptions(...t).setId("ziko-datalist-id"+dt.string(10))}get isDatalist(){return!0}addOptions(...t){return t.map((t=>this.append(new ni(t)))),this}};const oi=(...t)=>new ai(...t);class hi extends ps{constructor(){super(),this.element=document?.createElement("select")}addOptions(...t){return t.map((t=>this.append(new ni(t)))),this}get isSelect(){return!0}}const ci=()=>new hi;class li extends ps{constructor(){super(),this.element=document?.createElement("textarea")}get value(){return this.element.textContent}get isTextArea(){return!0}}const ui=()=>new li;class mi extends ps{constructor(t="div",e="100%",s="100%"){super(t,"Flex"),this.direction="cols","number"==typeof e&&(e+="%"),"number"==typeof s&&(s+="%"),this.style({width:e,height:s}),this.style({display:"flex"})}get isFlex(){return!0}resp(t,e=!0){return this.wrap(e),this.element.clientWidth<t?this.vertical():this.horizontal(),this}setSpaceAround(){return this.style({justifyContent:"space-around"}),this}setSpaceBetween(){return this.style({justifyContent:"space-between"}),this}setBaseline(){return this.style({alignItems:"baseline"}),this}gap(t){return"row"===this.direction?this.style({columnGap:t}):"column"===this.direction&&this.style({rowGap:t}),this}wrap(t="wrap"){return this.style({flexWrap:"string"==typeof t?t:["no-wrap","wrap","wrap-reverse"][+t]}),this}_justifyContent(t="center"){return this.style({justifyContent:t}),this}vertical(t,e,s=1){return di.call(this,s),this.style({alignItems:"number"==typeof t?gi.call(this,t):t,justifyContent:"number"==typeof e?bi.call(this,e):e}),this}horizontal(t,e,s=1){return fi.call(this,s),this.style({alignItems:"number"==typeof e?bi.call(this,e):e,justifyContent:"number"==typeof t?gi.call(this,t):t}),this}show(){return this.isHidden=!1,this.style({display:"flex"}),this}}const pi=(...t)=>{let e="div";return"string"==typeof t[0]&&(e=t[0],t.pop()),new mi(e).append(...t)};function di(t){return 1==t?this.style({flexDirection:"column"}):-1==t&&this.style({flexDirection:"column-reverse"}),this}function fi(t){return 1==t?this.style({flexDirection:"row"}):-1==t&&this.style({flexDirection:"row-reverse"}),this}function gi(t){return"number"==typeof t&&(t=["flex-start","center","flex-end"][t+1]),t}function bi(t){return gi(-t)}var yi=Object.freeze({__proto__:null,Flex:pi,ZikoUIFlex:mi});class wi extends mi{constructor(...t){super("form","Form"),this.append(...t),this.setMethod("POST"),this.setAction("/")}setAction(t="/"){return this.setAttr("action",t),this}setMethod(t="post"){return this.setAttr("method",t),this}get data(){let t=new FormData(this.element);return this.items.forEach((e=>{(e.isInput||e.isSelect||e.isTextarea)&&t.append(e.element.name,e.value)})),t}sendFormData(){return fetch(this.element.action,{method:this.element.method,body:this.data}).then((t=>t.json())).then((t=>console.log(t))).catch((t=>console.error("Error:",t))),this}getByName(t){return this.data.get(t)}}const xi=(...t)=>new wi(...t);var vi=Object.freeze({__proto__:null,Form:xi,ZikoUIForm:wi,ZikoUIInput:Gs,ZikoUIInputCheckbox:nr,ZikoUIInputColor:er,ZikoUIInputDatalist:ai,ZikoUIInputDate:pr,ZikoUIInputDateTime:br,ZikoUIInputEmail:cr,ZikoUIInputImage:$r,ZikoUIInputNumber:Ks,ZikoUIInputOption:ni,ZikoUIInputPassword:ur,ZikoUIInputRadio:or,ZikoUIInputSearch:rr,ZikoUIInputSlider:Js,ZikoUIInputTime:fr,ZikoUILabel:ii,ZikoUISelect:hi,ZikoUITextArea:li,checkbox:ar,datalist:oi,input:Xs,inputCamera:ri,inputColor:sr,inputDate:dr,inputDateTime:yr,inputEmail:lr,inputImage:Vr,inputNumber:Qs,inputPassword:mr,inputTime:gr,radio:hr,search:ir,select:ci,slider:tr,textarea:ui});class _i extends ps{constructor(...t){super(),this.element=document?.createElement("Tr"),this.append(...t)}}class ki extends ps{constructor(...t){super(),this.element=document?.createElement("Td"),this.append(...t)}}class Ii extends ps{constructor(...t){super(),this.element=document?.createElement("Thead"),this.append(...t)}}class Ei extends ps{constructor(...t){super(),this.element=document?.createElement("Tbody"),this.append(...t)}}class Ti extends ps{constructor(t){super(),this.element=document?.createElement("Caption"),this.append(t)}}const Ai=(...t)=>(t=t.map((t=>(t instanceof ps||(t=_s(t)),t))),new ki(...t)),Ci=t=>new Ti(t),Mi=t=>{var e=new Array(t.rows).fill(null).map((()=>((...t)=>new _i(...t))())),s=t.arr.map((t=>t.map((()=>null))));for(let r=0;r<s.length;r++)for(let i=0;i<s[0].length;i++)s[r][i]=Ai(t.arr[r][i]),e[r].append(s[r][i]);return e};class Oi extends ps{constructor(t,{caption:e=null,head:s=null,foot:r=null}={}){super("table","Table"),this.structure={caption:e,head:s,body:null,foot:r},t&&this.fromMatrix(t),e&&this.setCaption(e)}get isTable(){return!0}get caption(){return this.structure.caption}get header(){}get body(){}get footer(){}setCaption(t){return this.removeCaption(),this.structure.caption=Ci(t),this.append(this.structure.caption),this}removeCaption(){return this.structure.caption&&this.removeItem(...this.items.filter((t=>t instanceof Ti))),this.structure.caption=null,this}setHeader(...t){return this.tHead=((...t)=>(t=t.map((t=>(t instanceof ps||(t=Ai(t)),t))),new Ii(...UI)))(...t),this.append(this.tHead),this}removeHeader(){return this.removeItem(...this.items.filter((t=>t instanceof Ti))),this}setFooter(t){return this.structure.caption=Ci(t),this.append(this.structure.caption),this}removeFooter(){return this.removeItem(...this.items.filter((t=>t instanceof Ti))),this}fromMatrix(t){return this.bodyMatrix=t instanceof Array?In(t):t,this.structure.body&&this.remove(this.structure.body),this.structure.body=((...t)=>new Ei(...t))(),this.append(this.structure.body),this.structure.body.append(...Mi(this.bodyMatrix)),this}transpose(){return this.fromMatrix(this.bodyMatrix.T),this}hstack(t){return t instanceof Oi&&(t=t.bodyMatrix),this.fromMatrix(this.bodyMatrix.clone.hstack(t)),this}vstack(t){return t instanceof Oi&&(t=t.bodyMatrix),this.fromMatrix(this.bodyMatrix.clone.vstack(t)),this}slice(t=0,e=0,s=this.bodyMatrix.rows-1,r=this.bodyMatrix.cols-1){return this.fromMatrix(this.bodyMatrix.slice(t,e,s,r)),this}sortByCols(t,e={type:"num",order:"asc"}){return this.fromMatrix(this.bodyMatrix.clone.sortTable(t,e)),this}sortByRows(t,e={type:"num",order:"asc"}){return this.fromMatrix(this.bodyMatrix.T.clone.sortTable(t,e).T),this}filterByRows(t){return this.fromMatrix(this.bodyMatrix.clone.filterByRows(t)),this}filterByCols(t){return this.fromMatrix(this.bodyMatrix.clone.filterByCols(t)),this}forEachRow(t){return this.structure.body.forEach(t),this}forEachItem(t){return this.structure.body.forEach((e=>e.forEach(t))),this}}const Si=(t,e)=>new Oi(t,e);var ji=Object.freeze({__proto__:null,Table:Si});const Zi=["Main","Header","Nav","Section","Article","Aside","Footer"],Ui={},Ri={};for(let t=0;t<Zi.length;t++)Ui[`ZikoUI${Zi[t]}`]=class extends ps{constructor(){super(Zi[t].toLowerCase()),this.style({position:"relative"})}get[`is${Zi[t]}`](){return!0}},Ri[Zi[t]]=(...e)=>(new Ui[`ZikoUI${Zi[t]}`]).append(...e);const{Main:Di,Header:Li,Nav:Pi,Section:zi,Article:Fi,Aside:Hi,Footer:Bi}=Ri,{ZikoUIMain:Ni,ZikoUIHeader:$i,ZikoUINav:Vi,ZikoUISection:qi,ZikoUIArticle:Wi,ZikoUIAside:Yi,ZikoUIFooter:Gi}=Ui;var Xi=Object.freeze({__proto__:null,Article:Fi,Aside:Hi,Footer:Bi,Header:Li,Main:Di,Nav:Pi,Section:zi,ZikoUIArticle:Wi,ZikoUIAside:Yi,ZikoUIFooter:Gi,ZikoUIHeader:$i,ZikoUIMain:Ni,ZikoUINav:Vi,ZikoUISection:qi});class Ki extends ps{constructor(t="div",e="50vw",s="50vh"){super(t,"Grid"),this.direction="cols","number"==typeof e&&(e+="%"),"number"==typeof s&&(s+="%"),this.style({border:"1px solid black",width:e,height:s}),this.style({display:"grid"})}get isGird(){return!0}columns(t){let e="";for(let s=0;s<t;s++)e=e.concat(" auto");return this.#h(e),this}#h(t="auto auto"){return this.style({gridTemplateColumns:t}),this}gap(t=10,e=t){return"number"==typeof t&&(t+="px"),"number"==typeof e&&(e+="px"),this.style({gridColumnGap:t,gridRowGap:e}),this}}const Qi=(...t)=>new Ki("div").append(...t);var Ji=Object.freeze({__proto__:null,Grid:Qi,ZikoUIGrid:Ki});const tn=["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","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"],en=["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"],sn=new Proxy({},{get(t,e){if("string"!=typeof e)return;let s=e.replaceAll("_","-").toLowerCase();return tn.includes(s)?(...t)=>{if(!(t[0]instanceof ps)&&t[0]instanceof Object){let e=t.shift();return console.log(t),new ps(s).setAttr(e).append(...t)}return new ps(s).append(...t)}:en.includes(s)?(...t)=>new ps(s,"",{el_type:"svg"}).append(...t):(...t)=>{if(!(t[0]instanceof ps)&&t[0]instanceof Object){let e=t.shift();return new ps(s).setAttr(e).append(...t)}return new ps(s).append(...t)}}}),rn={...Fs,...Ys,...vi,...ei,...ji,...Xi,...Nr,...yi,...Ji,ZikoUIElement:ps},nn=t=>(new XMLSerializer).serializeToString(t),an=t=>btoa(nn(t)),on=t=>"data:image/svg+xml;base64,"+an(t),hn=(t,e=!0)=>Wr(on(t)).render(e),cn=t=>JSON.stringify(I((t=>["number","string","boolean","bigint"].includes(typeof t)?String(t):t instanceof Mn||t instanceof kn?t.toString():t instanceof Array?un(t):void 0),t),null," ").replace(/"([^"]+)":/g,"$1:").replace(/: "([^"]+)"/g,": $1"),ln=t=>{if(!Array.isArray(t))return 0;let e=1;for(const s of t)if(Array.isArray(s)){const t=ln(s);t+1>e&&(e=t+1)}return e},un=t=>{let e=0;return function t(s){let r=ln(s),i=0;return s.some((t=>Array.isArray(t)))&&(e++,i=1),"["+s.map(((r,i)=>["number","string","boolean","bigint"].includes(typeof r)?String(r):r instanceof Mn?r.toString():r instanceof Array?`\n${" ".repeat(e)}${t(r)}${i===s.length-1?"\n":""}`:r instanceof Object?cn(r):void 0))+`${" ".repeat((r+e+1)*i)}]`}(t)},mn=(t,e=0)=>{t=pn(t);let s="";const r=" ".repeat(e);for(let i in t)if("object"==typeof t[i]){s+=`${r}${i} {\n`;const n=t[i];for(let t in n)"object"==typeof n[t]?s+=mn({[t]:n[t]},e+1):s+=`${r} ${t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}: ${n[t]};\n`;s+=`${r}}\n`}return s};function pn(t){return"object"!=typeof t||null===t?t:Object.keys(t).reduce(((e,s)=>(e[s.trim()]=pn(t[s]),e)),Array.isArray(t)?[]:{})}var dn=Object.freeze({__proto__:null,arr2str:un,csv2arr:yt,csv2json:vt,csv2matrix:wt,csv2object:xt,csv2sql:_t,json2arr:Et,json2css:mn,json2csv:Tt,json2csvFile:At,json2xml:jt,json2xmlFile:Zt,json2yml:Ot,json2ymlFile:St,obj2str:cn,svg2ascii:an,svg2img:hn,svg2imgUrl:on,svg2str:nn}),fn=Object.freeze({__proto__:null});const gn={isDigit:/^\d+$/,isURL:/^(https?:\/\/)?([\w\-]+\.)+[\w\-]+(\/[\w\-./?%&=]*)?$/,isHexColor:/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,isIPv4:/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,isMACAddress:/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/,isDate:/^\d{4}-\d{2}-\d{2}$/};class bn{constructor(t){this.string=t}isDigit(){return gn.isDigit.test(this.string)}static isDigit(t){return new bn(t).isDigit()}isNumber(){return!isNaN(this.string)}static isNumber(t){return new bn(t).isNumber()}isUrl(){return gn.isURL.test(this.string)}static isUrl(t){return new bn(t).isUrl()}isHexColor(){return gn.isHexColor.test(this.string)}static isHexColor(t){return new bn(t).isHexColor()}isIPv4(){return gn.isIPv4.test(this.string)}static isIPv4(t){return new bn(t).isIPv4()}isDate(){return gn.isDate.test(this.string)}static isDate(t){return new bn(t).isDate()}isMACAddress(){return gn.isMACAddress.test(this.string)}static isMACAddress(t){return new bn(t).isMACAddress()}isPascalCase(){if(0===this.string.length)return!1;return/^[A-Z][a-zA-Z0-9]*$/.test(this.string)}static isPascalCase(t){return new bn(t).isPascalCase()}isCamelCase(){if(0===this.string.length)return!1;return/^[a-z][a-zA-Z0-9]*$/.test(this.string)}static isCamelCase(t){return new bn(t).isCamelCase()}isHyphenCase(){return this.string.split("-").length>1}static isHyphenCase(t){return new bn(t).isHyphenCase()}isSnakeCase(){return this.string.split("_").length>1}static isSnakeCase(t){return new bn(t).isSnakeCase()}isPalindrome(){const t=this.string.toLocaleLowerCase();let e,s=t.length;for(e=0;e<s/2;e++)if(t[e]!=t[s-e-1])return!1;return!0}static isPalindrome(t){return new bn(t).isPalindrome()}static isAnagrams(t,e){return t=t.split("").sort(),e=e.split("").sort(),JSON.stringify(t)===JSON.stringify(e)}isIsogram(){return[...new Set(this.string.toLowerCase())].length===this.string.length}static isIsogram(t){return new bn(t).isIsogram()}static camel2hyphencase(t){return t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}static camel2snakecase(t){return t.replace(/[A-Z]/g,(t=>"_"+t.toLowerCase()))}static camel2pascalcase(t){return t.charAt(0).toUpperCase()+t.slice(1)}static camel2constantcase(t){return t.replace(/[A-Z]/g,(t=>"_"+t)).toUpperCase()}static pascal2snakecase(t){return t.replace(/([A-Z])/g,((t,e)=>e?"_"+t.toLowerCase():t.toLowerCase()))}static pascal2hyphencase(t){return t.replace(/([A-Z])/g,((t,e)=>e?"-"+t.toLowerCase():t.toLowerCase()))}static pascal2camelcase(t){return t.charAt(0).toLowerCase()+t.slice(1)}static pascal2constantcase(t){return t.replace(/([A-Z])/g,((t,e)=>e?"_"+t:t)).toUpperCase()}static snake2camelcase(t){return t.replace(/(_\w)/g,(t=>t[1].toUpperCase()))}static snake2hyphencase(t){return t.replace(/_/g,"-")}static snake2pascalcase(t){return t.split("_").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("")}static snake2constantcase(t){return t.toUpperCase()}static hyphen2camelcase(t){return t.replace(/-([a-z])/g,(t=>t[1].toUpperCase()))}static hyphen2snakecase(t){return t.replace(/-/g,"_")}static hyphen2pascalcase(t){return t.split("-").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("")}static hyphen2constantcase(t){return t.replace(/-/g,"_").toUpperCase()}static constant2camelcase(t){return t.toLowerCase().replace(/_([a-z])/g,(t=>t[1].toUpperCase()))}static constant2snakecase(t){return t.toLowerCase()}static constant2pascalcase(t){return t.toLowerCase().split("_").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("")}static constant2hyphencase(t){return t.toLowerCase().replace(/_/g,"-")}}const yn=t=>t.replace(/\s+/g," "),wn=(t,e)=>t.split("").filter((t=>t==e)).length,xn=(t,e)=>t.split(" ").filter((t=>t==e)).length,vn=t=>new bn(t);const _n={...bt,...dn,...fn,...Object.freeze({__proto__:null,Str:bn,count:wn,countWords:xn,removeExtraSpace:yn,str:vn})};class kn extends k{constructor(t,e,s=[]){if(super(),t instanceof kn)this.arr=t.arr,this.rows=t.rows,this.cols=t.cols;else{let r,i,n=[];if(arguments[0]instanceof Array)t=arguments[0].length,e=arguments[0][0].length,n=arguments[0];else for(r=0;r<t;r++)for(n.push([]),n[r].push(new Array(e)),i=0;i<e;i++)n[r][i]=s[r*e+i],null==s[r*e+i]&&(n[r][i]=0);this.rows=t,this.cols=e,this.arr=n}this.#c()}toString(){return un(this.arr)}at(t=0,e=void 0){return t<0&&(t=this.rows+t),null==e?this.arr[t]:(e<0&&(e=this.cols+e),this.arr[t][e])}reshape(t,e){if(t*e==this.rows*this.cols)return new kn(t,e,this.arr.flat(1));console.error("Err")}static eye(t){let e=new kn(t,t);for(let s=0;s<t;s++)for(let r=0;r<t;r++)e.arr[s][r]=s===r?1:0;return e}get clone(){return new kn(this.rows,this.cols,this.arr.flat(1))}get size(){return this.rows*this.cols}get shape(){return[this.rows,this.cols]}get reel(){return new kn(this.cols,this.rows,this.arr.flat(1).reel)}get imag(){return new kn(this.cols,this.rows,this.arr.flat(1).imag)}[Symbol.iterator](){return this.arr[Symbol.iterator]()}#c(){for(let t=0;t<this.arr.length;t++)Object.defineProperty(this,t,{value:this.arr[t],writable:!0,configurable:!0,enumerable:!1})}get(t=0,e=0){return-1==e?this.arr[t]:-1==t?this.arr.map((t=>t[e])):this.arr[t][e]}set(t=0,e=0,s){if(-1==e)return this.arr[t]=s;if(-1==t){for(let t=0;t<this.cols;t++)this.arr[t][e]=s[t]||0;return this.arr}return this.arr[t][e]=s}get isSquare(){return this.rows/this.cols==1}get isSym(){if(!this.isSquare)return!1;const t=this.T,e=this.clone;return 0==kn.sub(e,t).max&&0==kn.sub(e,t).min}get isAntiSym(){if(!this.isSquare)return!1;const t=this.T,e=this.clone;return 0==kn.add(e,t).max&&0==kn.add(e,t).min}get isDiag(){if(!this.isSquare)return!1;const t=this.T,e=this.clone,s=kn.mul(e,t),r=kn.dot(t,e);return 0==kn.sub(s,r).max&&0==kn.sub(s,r).min}get isOrtho(){return!!this.isSquare&&(this.isDiag&&(1==this.det||-1==this.det))}get isIdemp(){if(!this.isSquare)return!1;const t=this.clone,e=kn.dot(t,t);return 0==kn.sub(e,t).max&&0==kn.sub(e,t).min}get T(){let t=[];for(let e=0;e<this.arr[0].length;e++){t[e]=[];for(let s=0;s<this.arr.length;s++)t[e][s]=this.arr[s][e]}return new kn(this.cols,this.rows,t.flat(1))}get det(){if(!this.isSquare)return new Error("is not square matrix");if(1==this.rows)return this.arr[0][0];function t(t,e){var s=[];for(let e=0;e<t.length;e++)s.push(t[e].slice(0));s.splice(0,1);for(let t=0;t<s.length;t++)s[t].splice(e,1);return s}return function e(s){if(2==s.length)return s.flat(1).some((t=>t instanceof kn))?void console.warn("Tensors are not completely supported yet ..."):nt.sub(nt.mul(s[0][0],s[1][1]),nt.mul(s[0][1],s[1][0]));for(var r=0,i=0;i<s.length;i++){const n=nt.add(nt.mul(Un(-1,i),nt.mul(s[0][i],e(t(s,i)))));r=nt.add(r,n)}return r}(this.arr)}get inv(){if(!this.isSquare)return new Error("is not square matrix");if(0===this.det)return"determinat = 0 !!!";let t=function(t){if(t.length!==t[0].length)return;var e=0,s=0,r=0,i=t.length,n=0,a=[],o=[];for(e=0;e<i;e+=1)for(a[a.length]=[],o[o.length]=[],r=0;r<i;r+=1)a[e][r]=e==r?1:0,o[e][r]=t[e][r];for(e=0;e<i;e+=1){if(0==(n=o[e][e])){for(s=e+1;s<i;s+=1)if(0!=o[s][e]){for(r=0;r<i;r++)n=o[e][r],o[e][r]=o[s][r],o[s][r]=n,n=a[e][r],a[e][r]=a[s][r],a[s][r]=n;break}if(0==(n=o[e][e]))return}for(r=0;r<i;r++)o[e][r]=o[e][r]/n,a[e][r]=a[e][r]/n;for(s=0;s<i;s++)if(s!=e)for(n=o[s][e],r=0;r<i;r++)o[s][r]-=n*o[e][r],a[s][r]-=n*a[e][r]}return a}(this.arr);return new kn(this.rows,this.cols,t.flat(1))}static zeros(t,e){let s=new kn(t,e);for(let i=0;i<t;i++)for(var r=0;r<e;r++)s.arr[i][r]=0;return s}static ones(t,e){let s=new kn(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)s.arr[r][t]=1;return s}static nums(t,e,s){let r=new kn(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)r.arr[i][t]=s;return r}static get rand(){return{int:(t,e,s,r)=>{let i=new kn(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)i.arr[n][t]=dt.randInt(s,r);return i},bin:(t,e)=>{let s=new kn(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)s.arr[r][t]=dt.randBin;return s},hex:(t,e)=>{let s=new kn(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)s.arr[r][t]=dt.randHex;return s},choices:(t,e,s,r)=>{let i=new kn(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)i.arr[n][t]=dt.choice(s,r);return i},permutation:(t,e,s)=>{}}}static rands(t,e,s=1,r){let i=new kn(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)i.arr[n][t]=dt.rand(s,r);return i}map(t,e,s,r){return nt.map(this,t,e,s,r)}lerp(t,e){return nt.lerp(this,t,e)}norm(t,e){return nt.norm(this,t,e)}clamp(t,e){return nt.clamp(this,t,e)}static map(t,e,s,r,i){return nt.map(t,e,s,r,i)}static lerp(t,e,s){return nt.lerp(t,e,s)}static norm(t,e,s){return nt.norm(t,e,s)}static clamp(t,e,s){return nt.clamp(In,e,s)}toPrecision(t){for(let e=0;e<this.cols;e++)for(let s=0;s<this.rows;s++)this.arr[e][s]=+this.arr[e][s].toPrecision(t);return this}get toBin(){let t=this.arr.flat(1).toBin;return new kn(this.rows,this.cols,t)}get toOct(){let t=this.arr.flat(1).toOct;return new kn(this.rows,this.cols,t)}get toHex(){let t=this.arr.flat(1).toHex;return new kn(this.rows,this.cols,t)}max2min(){let t=this.arr.flat(1).max2min;return new kn(this.rows,this.cols,t)}min2max(){let t=this.arr.flat(1).min2max;return new kn(this.rows,this.cols,t)}sortRows(t=void 0){let e=this.arr.map((e=>e.sort(t))).flat(1);return new kn(this.rows,this.cols,e)}sortCols(t=void 0){let e=this.T.arr.map((e=>e.sort(t))).flat(1);return new kn(this.rows,this.cols,e).T}filterByRows(t){var e=this.arr.map((e=>e.map((e=>+(""+e).includes(t))))).map((t=>!!Logic.or(...t))),s=this.arr.filter(((t,s)=>!0===e[s]));return 0===s.length&&s.push([]),console.log(s),new kn(s)}filterByCols(t){return new kn(this.T.arr.filter((e=>e.includes(t))))}sortAll(t=void 0){let e=this.arr.flat(1).sort(t);return new kn(this.rows,this.cols,e)}count(t){return this.arr.flat(1).count(t)}toBase(t){let e=this.arr.flat(1).toBase(t);return new kn(this.rows,this.cols,e)}#l(t){if(this.rows!==t.rows)return;let e=this.arr;for(let s=0;s<this.rows;s++)for(let r=this.cols;r<this.cols+t.cols;r++)e[s][r]=t.arr[s][r-this.cols];return this.cols+=t.cols,new kn(this.rows,this.cols,e.flat(1))}hstack(...t){const e=[this,...t].reduce(((t,e)=>t.#l(e)));return Object.assign(this,e),this}static hstack(t,...e){return t.clone.hstack(...e)}#u(t){if(this.cols!==t.cols)return;let e=this.arr;for(let s=this.rows;s<this.rows+t.rows;s++){e[s]=[];for(let r=0;r<this.cols;r++)e[s][r]=t.arr[s-this.rows][r]}return this.rows+=t.rows,new kn(this.rows,this.cols,e.flat(1))}vstack(...t){const e=[this,...t].reduce(((t,e)=>t.#u(e)));return Object.assign(this,e),this}static vstack(t,...e){return t.clone.vstack(...e)}hqueue(...t){const e=[this,...t].reverse().reduce(((t,e)=>t.#l(e)));return Object.assign(this,e),this}vqueue(...t){const e=[this,...t].reverse().reduce(((t,e)=>t.#u(e)));return Object.assign(this,e),this}static hqueue(t,...e){return t.clone.hqueue(...e)}static vqueue(t,...e){return t.clone.vqueue(...e)}slice(t=0,e=0,s=this.rows-1,r=this.cols-1){let i=s-t,n=r-e,a=new Array(n);for(let s=0;s<i;s++){a[s]=[];for(let r=0;r<n;r++)a[s][r]=this.arr[s+t][r+e]}return new kn(i,n,a.flat(1))}static slice(t,e=0,s=0,r=this.rows-1,i=this.cols-1){return t.slice(e,s,r,i)}splice(t,e,s,...r){}getRows(t,e=t+1){return this.slice(t,0,e,this.cols)}getCols(t,e=t+1){return this.slice(0,t,this.rows,e)}static getRows(t,e,s=e+1){return t.slice(e,0,s,t.cols)}static getCols(t,e,s=e+1){return t.slice(0,e,t.rows,s)}add(...t){for(let s=0;s<t.length;s++){("number"==typeof t[s]||t[s]instanceof Mn)&&(t[s]=kn.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=nt.add(this.arr[r][e],t[s].arr[r][e])}return new kn(this.rows,this.cols,this.arr.flat(1))}sub(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=kn.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=nt.sub(this.arr[r][e],t[s].arr[r][e])}return new kn(this.rows,this.cols,this.arr.flat(1))}static add(t,...e){return t.clone.add(...e)}static sub(t,...e){return t.clone.sub(...e)}mul(...t){for(let r=0;r<t.length;r++){"number"==typeof t[r]&&(t[r]=kn.nums(this.rows,this.cols,t[r]));for(var e=0;e<this.rows;e++)for(var s=0;s<this.cols;s++)this.arr[e][s]=nt.mul(this.arr[e][s],t[r].arr[e][s])}return new kn(this.rows,this.cols,this.arr.flat(1))}div(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=kn.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=nt.div(this.arr[r][e],t[s].arr[r][e])}return new kn(this.rows,this.cols,this.arr.flat(1))}static div(t,...e){return t.clone.div(...e)}static mul(t,...e){return t.clone.mul(...e)}modulo(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=kn.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=nt.modulo(this.arr[r][e],t[s].arr[r][e])}return new kn(this.rows,this.cols,this.arr.flat(1))}static modulo(t,...e){return t.clone.modulo(...e)}dot(t){for(var e=[],s=0;s<this.arr.length;s++){e[s]=[];for(var r=0;r<t.arr[0].length;r++){e[s][r]=0;for(var i=0;i<this.arr[0].length;i++)e[s][r]=nt.add(e[s][r],nt.mul(this.arr[s][i],t.arr[i][r]))}}return new kn(this.arr.length,t.arr[0].length,e.flat(1))}static dot(t,e){return t.dot(e)}pow(t){let e=this.clone,s=this.clone;for(let r=0;r<t-1;r++)s=s.dot(e);return s}static pow(t,e){return t.clone.pow(e)}get somme(){let t=0;for(let e=0;e<this.rows;e++)for(let s=0;s<this.cols;s++)t+=this.arr[e][s];return t}get DoesItContainComplexNumbers(){return this.arr.flat(1/0).some((t=>t instanceof Mn))}get min(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(K(...this.arr[e]));return K(...t)}get max(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(Q(...this.arr[e]));return Q(...t)}get minRows(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(K(...this.arr[e]));return t}get maxRows(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(Q(...this.arr[e]));return t}get minCols(){return this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable"),this.T.minRows}get maxCols(){return this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable"),this.T.maxRows}static fromVector(t){return new kn(t.length,1,t)}get toArray(){let t=[];for(let e=0;e<this.rows;e++)for(let s=0;s<this.cols;s++)t.push(this.arr[e][s]);return t}get print(){let t="[";for(let e=0;e<this.arr.length;e++)t+=(0!=e?" ":"")+` [${this.arr[e].map((t=>" "+t.toString()+" "))}],\n`;console.log(t.substring(0,t.length-2)+" ]"),document.write(t.substring(0,t.length-2)+" ]")}get table(){console.table(this.arr)}get serialize(){return JSON.stringify(this)}static deserialize(t){"string"==typeof t&&(t=JSON.parse(t));let e=new kn(t.rows,t.cols);return e.arr=t.arr,e}toTable(){var t=new DocumentFragment,e=new Array(this.rows).fill(null).map((()=>document?.createElement("tr"))),s=this.arr.map((t=>t.map((()=>document?.createElement("td")))));for(let t=0;t<s.length;t++)for(let r=0;r<s[0].length;r++)s[t][r].innerHTML=this.arr[t][r],e[t].appendChild(s[t][r]);return e.map((e=>t.appendChild(e))),t}toGrid(t,e={}){let s=Grid();return s.append(...this.map(t).arr.flat(1).map((t=>t.style(e)))),s.Columns(this.cols),s}sortTable(t=0,{type:e="num",order:s="asc"}={}){var r=this.T.arr.map((t=>t.map(((t,e)=>Object.assign({},{x:t,y:e}))))),i=this.T.arr.map((t=>t.map(((t,e)=>Object.assign({},{x:t,y:e})))));"num"===e?"asc"===s?r[t].sort(((t,e)=>t.x-e.x)):"desc"===s?r[t].sort(((t,e)=>e.x-t.x)):"toggle"===s&&(r[t][0].x>r[t][1].x?r[t].sort(((t,e)=>e.x-t.x)):r[t].sort(((t,e)=>t.x-e.x))):"alpha"===e&&("asc"===s?r[t].sort(((t,e)=>(""+t.x).localeCompare(""+e.x))):"desc"===s&&r[t].sort(((t,e)=>(""+e.x).localeCompare(""+t.x)))),s=r[t].map((t=>t.y));for(let e=0;e<r.length;e++)e!==t&&r[e].map(((t,e)=>t.y=s[e]));for(let e=0;e<r.length;e++)e!==t&&i[e].map(((t,i)=>t.x=r[e][s[i]].x));i[t]=r[t];var n=i.map((t=>t.map((t=>t.x))));return new kn(n).T}}const In=(t,e,s)=>new kn(t,e,s),En=(...t)=>new kn(2,2,t),Tn=(...t)=>new kn(3,3,t),An=(...t)=>new kn(4,4,t);var Cn=Object.freeze({__proto__:null,Matrix:kn,matrix:In,matrix2:En,matrix3:Tn,matrix4:An});class Mn extends k{constructor(t=0,e=0){super(),t instanceof Mn?(this.a=t.a,this.b=t.b):"object"==typeof t?"a"in e&&"b"in t?(this.a=t.a,this.b=t.b):"a"in e&&"z"in t?(this.a=t.a,this.b=Zn(t.z**2-t.a**2)):"a"in e&&"phi"in t?(this.a=t.a,this.b=t.a*Fn(t.phi)):"b"in e&&"z"in t?(this.b=t.b,this.a=Zn(t.z**2-t.b**2)):"b"in e&&"phi"in t?(this.b=e,this.a=t.b/Fn(t.phi)):"z"in e&&"phi"in t&&(this.a=t.z*Pn(t.phi),this.a=t.z*zn(t.phi)):"number"==typeof t&&"number"==typeof e&&(this.a=+t.toFixed(32),this.b=+e.toFixed(32))}toString(){let t="";return t=0!==this.a?this.b>=0?`${this.a}+${this.b}*i`:`${this.a}-${Math.abs(this.b)}*i`:this.b>=0?`${this.b}*i`:`-${Math.abs(this.b)}*i`,t}get clone(){return new Mn(this.a,this.b)}get z(){return ca(this.a,this.b)}get phi(){return na(this.b,this.a)}static Zero(){return new Mn(0,0)}get conj(){return new Mn(this.a,-this.b)}get inv(){return new Mn(this.a/(Un(this.a,2)+Un(this.b,2)),-this.b/(Un(this.a,2)+Un(this.b,2)))}add(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new Mn(t[e],0));let e=t.map((t=>t.a)),s=t.map((t=>t.b));return this.a+=+G(...e).toFixed(15),this.b+=+G(...s).toFixed(15),this}sub(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new Mn(t[e],0));let e=t.map((t=>t.a)),s=t.map((t=>t.b));return this.a-=+G(...e).toFixed(15),this.b-=+G(...s).toFixed(15),this}mul(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new Mn(t[e],0));let e=+X(this.z,...t.map((t=>t.z))).toFixed(15),s=+G(this.phi,...t.map((t=>t.phi))).toFixed(15);return this.a=+(e*Pn(s).toFixed(15)).toFixed(14),this.b=+(e*zn(s).toFixed(15)).toFixed(14),this}div(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new Mn(t[e],0));let e=+(this.z/X(...t.map((t=>t.z)))).toFixed(15),s=+(this.phi-G(...t.map((t=>t.phi)))).toFixed(15);return this.a=+(e*Pn(s).toFixed(15)).toFixed(15),this.b=+(e*zn(s).toFixed(15)).toFixed(15),this}pow(t){if(ra(t)===t&&t>0){let e=+(this.z**t).toFixed(15),s=+(this.phi*t).toFixed(15);this.a=+(e*Pn(s).toFixed(15)).toFixed(15),this.b=+(e*zn(s).toFixed(15)).toFixed(15)}return this}static fromExpo(t,e){return new Mn(+(t*Pn(e)).toFixed(13),+(t*zn(e)).toFixed(13))}get expo(){return[this.z,this.phi]}static add(t,...e){return t.clone.add(...e)}static sub(t,...e){return t.clone.sub(...e)}static mul(t,...e){return t.clone.mul(...e)}static div(t,...e){return t.clone.div(...e)}static pow(t,e){return t.clone.pow(e)}static xpowZ(t){return On(t**this.a*Pn(this.b*Ln(t)),t**this.a*zn(this.b*Ln(t)))}sqrtn(t=2){return On(Rn(this.z,t)*Pn(this.phi/t),Rn(this.z,t)*zn(this.phi/t))}get sqrt(){return this.sqrtn(2)}get log(){return On(this.z,this.phi)}get cos(){return On(Pn(this.a)*Gn(this.b),zn(this.a)*Xn(this.b))}get sin(){return On(zn(this.a)*Gn(this.b),Pn(this.a)*Xn(this.b))}get tan(){const t=Pn(2*this.a)+Gn(2*this.b);return On(zn(2*this.a)/t,Xn(2*this.b)/t)}printInConsole(){let t=this.a+" + "+this.b+" * i";return console.log(t),t}print(){}UI(){return"<span>"+this.a+" + i * "+this.b+"</span>"}}const On=(t,e)=>{if((t instanceof Array||ArrayBuffer.isView(t))&&(e instanceof Array||ArrayBuffer.isView(t)))return t.map(((s,r)=>On(t[r],e[r])));if(t instanceof kn&&e instanceof kn){if(t.shape[0]!==e.shape[0]||t.shape[1]!==e.shape[1])return Error(0);const s=t.arr.map(((s,r)=>On(t.arr[r],e.arr[r])));return new kn(t.rows,t.cols,...s)}return new Mn(t,e)};var Sn=Object.freeze({__proto__:null,Complex:Mn,complex:On});const jn=(...t)=>I(Math.abs,...t),Zn=(...t)=>I(Math.sqrt,...t),Un=(t,e)=>{if("number"==typeof t)return"number"==typeof e?Math.pow(t,e):e instanceof Mn?Mn.fromExpo(t**e.a,e.b*Ln(t)):I((e=>Un(t,e)),...e);if(t instanceof Mn)return"number"==typeof e?Mn.fromExpo(t.z**e,t.phi*e):e instanceof Mn?Mn.fromExpo(t.z**e.a*Dn(-t.phi*e.b),Ln(t.z)*e.b+e.a*t.phi):I((e=>Un(t,e)),...e);if(t instanceof Array){if("number"==typeof e)return I((t=>Un(t,e)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(I((e=>Un(t[r],e)),...e));return s}}},Rn=(t,e)=>{if("number"==typeof t)return"number"==typeof e?Math.pow(t,1/e):I((e=>Rn(t,e)),...e);if(t instanceof Mn)return"number"==typeof e?Mn.fromExpo(Rn(t.z,e),t.phi/e):I((e=>Rn(t,e)),...e);if(t instanceof Array){if("number"==typeof e)return I((t=>Rn(t,e)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(I((e=>Rn(t[r],e)),...e));return s}}},Dn=(...t)=>I(Math.exp,...t),Ln=(...t)=>I(Math.log,...t),Pn=(...t)=>I(_.cos,...t),zn=(...t)=>I(_.sin,...t),Fn=(...t)=>I(_.tan,...t),Hn=(...t)=>I(_.sec,...t),Bn=(...t)=>I(_.sinc,...t),Nn=(...t)=>I(_.csc,...t),$n=(...t)=>I(_.cot,...t),Vn=(...t)=>I(_.acos,...t),qn=(...t)=>I(_.asin,...t),Wn=(...t)=>I(_.atan,...t),Yn=(...t)=>I(_.acot,...t),Gn=(...t)=>I(_.cosh,...t),Xn=(...t)=>I(_.sinh,...t),Kn=(...t)=>I(_.tanh,...t),Qn=(...t)=>I(_.coth,...t),Jn=(...t)=>I(_.acosh,...t),ta=(...t)=>I(_.asinh,...t),ea=(...t)=>I(_.atanh,...t),sa=(...t)=>I(Math.ceil,...t),ra=(...t)=>I(Math.floor,...t),ia=(...t)=>I(Math.round,...t),na=(t,e,s=!0)=>{if("number"==typeof t)return"number"==typeof e?s?Math.atan2(t,e):180*Math.atan2(t,e)/Math.PI:I((e=>na(t,e,s)),...e);if(t instanceof Array){if("number"==typeof e)return I((t=>na(t,e,s)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(I((e=>Un(t[r],e)),...e));return s}}},aa=(...t)=>I((t=>{let e,s=1;if(0==t)s=1;else if(t>0)for(e=1;e<=t;e++)s*=e;else s=NaN;return s}),...t),oa=(...t)=>I(Math.sign,...t),ha=(...t)=>I((t=>1/(1+Dn(-t))),...t),ca=(...t)=>t.every((t=>"number"==typeof t))?Math.hypot(...t):t.every((t=>t instanceof Array))?I(Math.hypot,...t):void 0;const la={...n,...Object.freeze({__proto__:null,abs:jn,acos:Vn,acosh:Jn,acot:Yn,asin:qn,asinh:ta,atan:Wn,atan2:na,atanh:ea,ceil:sa,cos:Pn,cosh:Gn,cot:$n,coth:Qn,csc:Nn,e:Dn,fact:aa,floor:ra,hypot:ca,ln:Ln,max:Q,min:K,pow:Un,round:ia,sec:Hn,sig:ha,sign:oa,sin:zn,sinc:Bn,sinh:Xn,sqrt:Zn,sqrtn:Rn,tan:Fn,tanh:Kn}),...Sn,...Cn,...ft,...at,...pt};class ua{constructor(t,e=1e3/30,s=0,r=1/0,i=!0){this.callback=t,this.cache={isRunning:!1,AnimationId:null,t0:null,step:e,startTime:s,endTime:r,started:i},this.init(),this.i=0}init(){return this.cache.started&&(this.cache.startTime?this.startAfter(this.cache.startTime):this.start(),this.cache.endTime&&this.cache.endTime!==1/0&&this.stopAfter(this.cache.endTime)),this}start(){return this.cache.isRunning||(this.i=0,this.cache.isRunning=!0,this.cache.t0=Date.now(),this.animate()),this}pause(){return this.cache.isRunning&&(clearTimeout(this.cache.AnimationId),this.cache.isRunning=!1),this}stop(){return this.pause(),this.i=0,this}resume(){return this.cache.isRunning=!0,this.animate(),this}startAfter(t=1e3){return setTimeout(this.start.bind(this),t),this}stopAfter(t=1e3){return setTimeout(this.stop.bind(this),t),this}animate=()=>{if(this.cache.isRunning){const t=Date.now(),e=t-this.cache.t0;e>this.cache.step&&(this.callback(this),this.i++,this.cache.t0=t-e%this.cache.step),this.cache.AnimationId=setTimeout(this.animate,0)}}}const ma=t=>1e3/t,pa=(t,e,s,r,i)=>new ua(t,e,s,r,i);var da=Object.freeze({__proto__:null,useFps:ma,useTimeLoop:pa});const fa={Linear:function(t){return t},InSin:t=>1-Math.cos(t*Math.PI/2),OutSin:t=>Math.sin(t*Math.PI/2),InOutSin:t=>-(Math.cos(Math.PI*t)-1)/2,InQuad:t=>t**2,OutQuad:t=>1-Math.pow(1-t,2),InOutQuad:t=>t<.5?2*Math.pow(t,2):1-Math.pow(-2*t+2,2)/2,InCubic:t=>t**3,OutCubic:t=>1-Math.pow(1-t,3),InOutCubic:t=>t<.5?4*Math.pow(t,3):1-Math.pow(-2*t+2,3)/2,InQuart:t=>t**4,OutQuart:t=>1-Math.pow(1-t,4),InOutQuart:t=>t<.5?8*Math.pow(t,4):1-Math.pow(-2*t+2,4)/2,InQuint:t=>t**5,OutQuint:t=>1-Math.pow(1-t,5),InOutQuint:t=>t<.5?16*Math.pow(t,5):1-Math.pow(-2*t+2,5)/2,InExpo:t=>0===t?0:Math.pow(2,10*t-10),OutExpo:t=>1===t?1:1-Math.pow(2,-10*t),InOutExpo:t=>0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2,InCirc:t=>1-Math.sqrt(1-Math.pow(t,2)),OutCirc:t=>Math.sqrt(1-Math.pow(t-1,2)),InOutCic:t=>t<.5?(1-Math.sqrt(1-Math.pow(2*t,2)))/2:(Math.sqrt(1-Math.pow(-2*t+2,2))+1)/2,Arc:t=>1-Math.sin(Math.acos(t)),Back:t=>Math.pow(t,2)*(2*t-1),Elastic:t=>-2*Math.pow(2,10*(t-1))*Math.cos(20*Math.PI*t/3*t),InBack(t){const e=1.70158;return 2.70158*Math.pow(t,3)-e*t**2},OutBack(t){const e=1.70158;return 1+2.70158*Math.pow(t-1,3)+e*Math.pow(t-1,2)},InOutBack(t){const e=2.5949095;return t<.5?Math.pow(2*t,2)*(7.189819*t-e)/2:(Math.pow(2*t-2,2)*((e+1)*(2*t-2)+e)+2)/2},InElastic(t){const e=2*Math.PI/3;return 0===t?0:1===t?1:-Math.pow(2,10*t-10)*Math.sin((10*t-10.75)*e)},OutElastic(t){const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},InOutElastic(t){const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1},InBounce:t=>1-fa.OutBounce(1-t),OutBounce(t){const e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-=1.5/s)*t+.75:t<2.5/s?e*(t-=2.25/s)*t+.9375:e*(t-=2.625/s)*t+.984375},InOutBounce:t=>t<.5?(1-fa.OutBounce(1-2*t))/2:(1+fa.OutBounce(2*t-1))/2},ga=t=>{const e=Date.now(),s=performance.memory.usedJSHeapSize,r=t();return{elapsedTime:Date.now()-e,usedMemory:performance.memory.usedJSHeapSize-s,result:r}},ba=t=>new Promise((e=>{if(t.element)return e(t.element);const s=new MutationObserver((()=>{t.element&&(e(t.element),s.disconnect())}));s.observe(document?.body,{childList:!0,subtree:!0})})),ya=(t,e=2e3)=>{const s=Date.now();for(;Date.now()-s<e;)if(t.element)return t.element},wa=t=>new Promise((e=>setTimeout(e,t))),xa=t=>{console.time("timeTaken");const e=t();return console.timeEnd("timeTaken"),e};var va=Object.freeze({__proto__:null,Ease:fa,timeTaken:xa,time_memory_Taken:ga,useDebounce:(t,e=1e3)=>(...s)=>setTimeout((()=>t(...s)),e),useThrottle:(t,e)=>{let s=0;return(...r)=>{const i=(new Date).getTime();i-s<e||(s=i,t(...r))}},wait:wa,waitForUIElm:ba,waitForUIElmSync:ya});class _a{constructor(t,e=fa.Linear,s=50,{t:r=[0,null],start:i=!0,duration:n=3e3}={}){this.cache={isRunning:!1,AnimationId:null,startTime:null,ease:e,step:s,intervall:r,started:i,duration:n},this.t=0,this.tx=0,this.ty=0,this.i=0,this.callback=t}#m(){this.t+=this.cache.step,this.i++,this.tx=H(this.t,0,this.cache.duration,0,1),this.ty=this.cache.ease(this.tx),this.callback(this),this.t>=this.cache.duration&&(clearInterval(this.cache.AnimationId),this.cache.isRunning=!1)}reset(t=!0){return this.t=0,this.tx=0,this.ty=0,this.i=0,t&&this.start(),this}#p(t=!0){return this.cache.isRunning||(t&&this.reset(!1),this.cache.isRunning=!0,this.cache.startTime=Date.now(),this.cache.AnimationId=setInterval(this.#m.bind(this),this.cache.step)),this}start(){return this.#p(!0),this}pause(){return this.cache.isRunning&&(clearTimeout(this.cache.AnimationId),this.cache.isRunning=!1),this}resume(){return this.#p(!1),this}stop(){return this.pause(),this.reset(!1),this}}const ka={...da,...da,...va};class Ia extends ps{constructor(t=360,e=300){super("svg","svg"),this.style({border:"1px black solid"}),this.size(t,e),this.view(-10,-10,10,10)}size(t,e){return this.setAttr({width:t,height:e}),this}view(t,e,s,r){let i=Math.abs(s-t),n=Math.abs(r-e);return this.setAttr("viewBox",[t,e,i,n].join(" ")),this.st.scaleY(-1),this}add(...t){for(let e=0;e<t.length;e++)this.element.append(t[e].element),this.items.push(t[e]);return this.maintain(),this}remove(...t){for(let e=0;e<t.length;e++)this.element?.removeChild(t[e].element),this.items=this.items.filter((e=>!t));return this.maintain(),this}mask(){}toString(){return(new XMLSerializer).serializeToString(this.element)}btoa(){return btoa(this.toString())}toImg(){return"data:image/svg+xml;base64,"+this.btoa()}toImg2(){return"data:image/svg+xml;charset=utf8,"+this.toString().replaceAll("<","%3C").replaceAll(">","%3E").replaceAll("#","%23").replaceAll('"',"'")}}const Ea=(t,e)=>new Ia(t,e);var Ta=Object.freeze({__proto__:null,Svg:Ea,ZikoUISvg:Ia});class Aa extends ps{constructor(t,e){super("canvas","canvas"),this.ctx=this.element?.getContext("2d"),this.style({border:"1px red solid"}),this.transformMatrix=new kn([[1,0,0],[0,1,0],[0,0,1]]),this.axisMatrix=new kn([[-10,-10],[10,10]]),requestAnimationFrame((()=>this.resize(t,e)),0),this.on("sizeupdated",(()=>this.adjust()))}get Xmin(){return this.axisMatrix[0][0]}get Ymin(){return this.axisMatrix[0][1]}get Xmax(){return this.axisMatrix[1][0]}get Ymax(){return this.axisMatrix[1][1]}get ImageData(){return this.ctx.getImageData(0,0,c.Width,c.Height)}draw(t=!0){return t?(this.clear(),this.items.forEach((t=>{t.parent=this,t.draw(this.ctx)}))):(this.items.at(-1).parent=this,this.items.at(-1).draw(this.ctx)),this.maintain(),this}applyTransformMatrix(){return this.ctx.setTransform(this.transformMatrix[0][0],this.transformMatrix[1][0],this.transformMatrix[0][1],this.transformMatrix[1][1],this.transformMatrix[0][2],this.transformMatrix[1][2]),this}resize(t,e){return this.size(t,e),this.lineWidth(),this.view(this.axisMatrix[0][0],this.axisMatrix[0][1],this.axisMatrix[1][0],this.axisMatrix[1][1]),this.emit("sizeupdated"),this}adjust(){return this.element.width=this.element?.getBoundingClientRect().width,this.element.height=this.element?.getBoundingClientRect().height,this.view(this.axisMatrix[0][0],this.axisMatrix[0][1],this.axisMatrix[1][0],this.axisMatrix[1][1]),this}view(t,e,s,r){return this.transformMatrix[0][0]=this.width/(s-t),this.transformMatrix[1][1]=-this.height/(r-e),this.transformMatrix[0][2]=this.width/2,this.transformMatrix[1][2]=this.height/2,this.axisMatrix=new kn([[t,e],[s,r]]),this.applyTransformMatrix(),this.clear(),this.lineWidth(1),this.draw(),this}reset(){return this.ctx.setTransform(1,0,0,0,0,0),this}append(t){return this.items.push(t),this.draw(!1),this}background(t){this.ctx.fillStyle=t,this.ctx.setTransform(1,0,0,1,0,0),this.ctx.fillRect(0,0,this.width,this.height),this.applyTransformMatrix(),this.draw()}lineWidth(t){return this.ctx.lineWidth=t/this.transformMatrix[0][0],this}getImageData(t=0,e=0,s=this.width,r=this.height){return this.ctx.getImageData(t,e,s,r)}clear(){return this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.width,this.height),this.applyTransformMatrix(),this}clone(){console.log(this.width);const t=new Aa;return t.items=this.items,t.transformMatrix=this.transformMatrix,t.axisMatrix=this.axisMatrix,Object.assign(t.cache,{...this.cache}),this.size(this.element.style.width,this.element.style.width),this.applyTransformMatrix(),this.draw(),this.adjust(),t}toImage(){return this.img=document?.createElement("img"),this.img.src=this.element?.toDataURL("image/png"),this}toBlob(){this.element.toBlob((function(t){var e=document?.createElement("img"),s=URL.createObjectURL(t);e.onload=function(){URL.revokeObjectURL(s)},e.src=s,console.log(e)}))}zoomIn(){}zoomOut(){}undo(t){}redo(t){}stream(){}}const Ca=(t,e)=>new Aa(t,e);const Ma={...Ta,...Object.freeze({__proto__:null,Canvas:Ca,ZikoUICanvas:Aa})};class Oa{constructor(t,e=!0){this.#n(),this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}#n(){return this.__FavIcon__=document.querySelector("link[rel*='icon']")||document?.createElement("link"),this.__FavIcon__.type="image/x-icon",this.__FavIcon__.rel="shortcut icon",this}set(t){return t!==this.__FavIcon__.href&&(this.__FavIcon__.href=t,this.cache.Emitter&&this.cache.Emitter.emit("ziko:favicon-changed")),this}get current(){return document.__FavIcon__.href}onChange(t){return this.cache.Emitter&&this.cache.Emitter.on("ziko:favicon-changed",t),this}useEventEmitter(){return this.cache.Emitter=es(),this}}class Sa{constructor({viewport:t,charset:e,description:s,author:r,keywords:i}){this.document=globalThis?.document,this.meta={},this.init({viewport:t,charset:e,description:s,author:r,keywords:i})}init({viewport:t,charset:e,description:s,author:r,keywords:i}){t&&this.setViewport(t),e&&this.setCharset(e),s&&this.describe(s),r&&this.setAuthor(r),i&&this.setKeywords(i)}set(t,e){const s="charset"===(t=t.toLowerCase()),r=s?document.querySelector("meta[charset]"):document.querySelector(`meta[name=${t}]`);return this.meta=r??document?.createElement("meta"),s?this.meta.setAttribute("charset",e):(this.meta.setAttribute("name",t),this.meta.setAttribute("content",e)),r||this.document.head.append(this.meta),this}setCharset(t="utf-8"){return this.set("charset",t),this}describe(t){return this.set("description",t),this}setViewport(t="width=device-width, initial-scale=1.0"){return this.set("viewport",t),this}setKeywords(...t){return t=[...new Set(t)].join(", "),this.set("keywords",t),this}setAuthor(t){return this.set("author",t),this}}class ja{constructor(t=document.title,e=!0){this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}useEventEmitter(){return this.cache.Emitter=es(),this}set(t){return t!==document.title&&(document.title=t,this.cache.Emitter&&this.cache.Emitter.emit("ziko:title-changed")),this}get current(){return document.title}onChange(t){return this.cache.Emitter&&this.cache.Emitter.on("ziko:title-changed",t),this}}class Za{constructor({title:t,lang:e,icon:s,meta:r,noscript:i}){this.html=globalThis?.document?.documentElement,this.head=globalThis?.document?.head,t&&((t,e)=>{new ja(t,e)})(t),e&&this.setLang(e),s&&((t,e)=>{new Oa(t,e)})(s),r&&(({viewport:t,charset:e,description:s,author:r,keywords:i})=>{new Sa({viewport:t,charset:e,description:s,author:r,keywords:i})})(r),i&&this.setNoScript()}setLang(t){this.html.setAttribute("lang",t)}setNoScript(t){}}class Ua{constructor({head:t=null,wrapper:e=null,target:s=null}){this.head=t,this.wrapper=e,this.target=s,this.init()}get isZikoApp(){return!0}init(){this.head&&this.setHead(this.head),this.wrapper&&this.setWrapper(this.wrapper),this.target&&this.setTarget(this.target),this.wrapper&&this.target&&this.wrapper.render(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?.isZikoUIElement?this.wrapper=t:"function"==typeof t&&(this.wrapper=t()),this}setHead(t){return this.head=t instanceof Za?t:(({title:t,lang:e,icon:s,meta:r,noscript:i})=>new Za({title:t,lang:e,icon:s,meta:r,noscript:i}))(t),this}}const Ra=({head:t,wrapper:e,target:s})=>new Ua({head:t,wrapper:e,target:s});var Da=Object.freeze({__proto__:null,App:Ra,ZikoApp:Ua});function La(t){return/:\w+/.test(t)}class Pa extends Ua{constructor({head:t,wrapper:e,target:s,routes:r}){super({head:t,wrapper:e,target:s}),this.routes=new Map([["404",_s("Error 404")],...Object.entries(r)]),this.clear(),globalThis.onpopstate=this.render(location.pathname)}clear(){return[...this.routes].forEach((t=>{!La(t[0])&&t[1]?.isZikoUIElement&&t[1].unrender()})),this}render(t){const[e,s]=[...this.routes].find((e=>function(t,e){const s=t.split("/"),r=e.split("/");if(s.length!==r.length)return!1;for(let t=0;t<s.length;t++){const e=s[t],i=r[t];if(!e.startsWith(":")&&e!==i)return!1}return!0}(e[0],t)));let r;if(La(e)){const i=function(t,e){const s=t.split("/"),r=e.split("/"),i={};if(s.length!==r.length)return i;for(let t=0;t<s.length;t++){const e=s[t],n=r[t];if(e.startsWith(":"))i[e.slice(1)]=n;else if(e!==n)return{}}return i}(e,t);r=s.call(this,i)}else s?.isZikoUIElement&&s.render(this.wrapper),"function"==typeof s&&(r=s());return r?.isZikoUIElement&&r.render(this.wrapper),r instanceof Promise&&r.then((t=>t.render(this.wrapper))),globalThis.history.pushState({},"",t),this}}const za=({head:t,wrapper:e,target:s,routes:r})=>new Pa({head:t,wrapper:e,target:s,routes:r});var Fa=Object.freeze({__proto__:null,SPA:za,ZikoSPA:Pa});function Ha(t){Object.defineProperties(t,{QueryParams:{get:function(){return function(t){const e={};return t.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi,(t=>{const[s,r]=t.split("=");e[s]=r})),e}(globalThis.location.search.substring(1))},configurable:!1,enumerable:!0},HashParams:{get:function(){return globalThis.location.hash.substring(1).split("#")},configurable:!1,enumerable:!0}})}const Ba={__all__(){return Object.values(this).filter(Array.isArray).flat()},querySelectorAll(){return this.__all__().filter((t=>t))},getElementByIndex(t){return this.__all__().find((e=>e.ui_index===t))},getElementById:t=>null,getElementsByClass(){},getElementsByTagName(){}},Na={map:new Map,index:0,increment:function(){return this.index++}},$a=new Map,Va={default:{target:null,render:!0,math:{mode:"deg"}},setDefault:function(t){const e=Object.keys(t),s=Object.values(t);for(let t=0;t<e.length;t++)this.default[e[t]]=s[t]},init:()=>{},renderingMode:"spa",isSSC:!1},qa={ui_index:0,get_ui_index:function(){return this.ui_index++}};function Wa(t,e="./src/pages",s=["js","ts"]){"/"===e.at(-1)&&(e=e.slice(0,-1));const r=t.replace(/\\/g,"/").replace(/\[(\w+)\]/g,"$1/:$1").split("/"),i=e.split("/"),n=r.indexOf(i[i.length-1]);if(-1!==n){const t=r.slice(n+1),e=t[t.length-1],i="index.js"===e||"index.ts"===e,a=s.some((t=>e===`.${t}`||e.endsWith(`.${t}`)));if(i)return"/"+(t.length>1?t.slice(0,-1).join("/"):"");if(a)return"/"+t.join("/").replace(/\.(js|ts)$/,"")}return""}const Ya={...Da,...Fa,...Object.freeze({__proto__:null,__CACHE__:qa,__Config__:Va,__HYDRATION_MAP__:$a,__HYDRATION__:Na,__UI__:Ba})};class Ga{constructor(t=""){this.channel=new BroadcastChannel(t),this.EVENTS_DATAS_PAIRS=new Map,this.EVENTS_HANDLERS_PAIRS=new Map,this.LAST_RECEIVED_EVENT="",this.UUID="ziko-channel"+dt.string(10),this.SUBSCRIBERS=new Set([this.UUID])}get broadcast(){return this}emit(t,e){return this.EVENTS_DATAS_PAIRS.set(t,e),this.#d(t),this}on(t,e=console.log){return this.EVENTS_HANDLERS_PAIRS.set(t,e),this.#f(),this}#f(){return this.channel.onmessage=t=>{this.LAST_RECEIVED_EVENT=t.data.last_sended_event;const e=t.data.userId;this.SUBSCRIBERS.add(e);const s=t.data.EVENTS_DATAS_PAIRS.get(this.LAST_RECEIVED_EVENT),r=this.EVENTS_HANDLERS_PAIRS.get(this.LAST_RECEIVED_EVENT);s&&r&&r(s)},this}#d(t){return this.channel.postMessage({EVENTS_DATAS_PAIRS:this.EVENTS_DATAS_PAIRS,last_sended_event:t,userId:this.UUID}),this}close(){return this.channel.close(),this}}const Xa=t=>new Ga(t);class Ka{#g;constructor(){this.#g=function(t){try{let e=new Function("return "+t.data.fun)()();postMessage({result:e})}catch(t){postMessage({error:t.message})}finally{t.data.close&&self.close()}}.toString(),this.blob=new Blob(["this.onmessage = "+this.#g],{type:"text/javascript"}),this.worker=new Worker(window.URL.createObjectURL(this.blob))}call(t,e,s=!0){return this.worker.postMessage({fun:t.toString(),close:s}),this.worker.onmessage=function(t){t.data.error?console.error(t.data.error):e(t.data.result)},this}}class Qa{constructor(t,{namespace:e="Ziko",register:s,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(let s in t)if(!e.has(s))throw new Error(`Invalid CSS property: "${s}"`)}(t),this.currentPropsMap=t,this.#c(),this}#c(){const t=globalThis?.document?.documentElement?.style;for(let e in this.currentPropsMap){const s=this.namespace?`--${this.namespace}-${e}`:`--${e}`;t.setProperty(s,this.currentPropsMap[e]),console.log({cssProp:s}),Object.defineProperty(this,e,{value:`var(${s})`,writable:!0,configurable:!0,enumerable:!1})}}}class Ja{constructor(t,e,s){this.cache={storage:t,globalKey:e,channel:Xa(`Ziko:useStorage-${e}`),oldItemKeys:new Set},this.#n(s),this.#c()}get items(){return JSON.parse(this.cache.storage[this.cache.globalKey]??null)}#c(){for(let t in this.items)Object.assign(this,{[[t]]:this.items[t]})}#n(t){this.cache.channel=Xa(`Ziko:useStorage-${this.cache.globalKey}`),this.cache.channel.on("Ziko-Storage-Updated",(()=>this.#c())),t&&(this.cache.storage[this.cache.globalKey]?(Object.keys(this.items).forEach((t=>this.cache.oldItemKeys.add(t))),console.group("Ziko:useStorage"),console.warn(`Storage key '${this.cache.globalKey}' already exists. we will not overwrite it.`),console.info("%cWe'll keep the existing data.","background-color:#2222dd; color:gold;"),console.group("")):this.set(t))}set(t){return this.cache.storage.setItem(this.cache.globalKey,JSON.stringify(t)),this.cache.channel.emit("Ziko-Storage-Updated",{}),Object.keys(t).forEach((t=>this.cache.oldItemKeys.add(t))),this.#c(),this}add(t){const e={...this.items,...t};return this.cache.storage.setItem(this.cache.globalKey,JSON.stringify(e)),this.#c(),this}remove(...t){const e={...this.items};for(let s=0;s<t.length;s++)delete e[t[s]],delete this[t[s]];return this.set(e),this}get(t){return this.items[t]}clear(){return this.cache.storage.removeItem(this.cache.globalKey),this.#c(),this}}[Ya,la,rn,ka,_n,ms,Ma].forEach((t=>Object.assign(t,{ExtractAll:()=>(t=>{const e=Object.keys(t);for(let s=0;s<e.length;s++){const r=e[s];["__ExtractAll__","__RemoveAll__","ExtractAll","RemoveAll"].includes(r)||(globalThis[r]=t[r])}})(t),RemoveAll:()=>(t=>{const e=Object.keys(t);for(let t=0;t<e.length;t++){const s=e[t];"__RemoveAll__"!==s&&delete globalThis[s]}})(t)})));const to={App:Ya,Math:la,UI:rn,Time:ka,Data:_n,Reactivity:ms,Graphics:Ma};globalThis.__Ziko__?console.warn("WARNING: Multiple instances of Ziko.js being imported."):(globalThis.__Ziko__={...to,__UI__:Ba,__HYDRATION__:Na,__HYDRATION_MAP__:$a,__Config__:Va,__CACHE__:qa,ExtractAll:function(){return rn.ExtractAll(),la.ExtractAll(),ka.ExtractAll(),ms.ExtractAll(),Ma.ExtractAll(),_n.ExtractAll(),this},RemoveAll:function(){rn.RemoveAll(),la.RemoveAll(),ka.RemoveAll(),ms.RemoveAll(),Ma.RemoveAll(),_n.RemoveAll()}},Ha(__Ziko__)),globalThis?.document&&document?.addEventListener("DOMContentLoaded",__Ziko__.__Config__.init()),t.App=Ra,t.Article=Fi,t.Aside=Hi,t.Base=ht,t.Canvas=Ca,t.Combinaison=ut,t.Complex=Mn,t.E=r,t.EPSILON=i,t.Ease=fa,t.FileBasedRouting=async function(t){const e=Object.keys(t),s=function(t){if(0===t.length)return"";const e=t.map((t=>t.split("/"))),s=Math.min(...e.map((t=>t.length)));let r=[];for(let t=0;t<s;t++){const s=e[0][t];if(!e.every((e=>e[t]===s||e[t].startsWith("["))))break;r.push(s)}return r.join("/")+(r.length?"/":"")}(e),r={};for(let i=0;i<e.length;i++){const n=await t[e[i]](),a=await n.default;Object.assign(r,{[Wa(e[i],s)]:a})}return za({target:document.body,routes:{"/":()=>{},...r},wrapper:zi()})},t.Flex=pi,t.Footer=Bi,t.Form=xi,t.Grid=Qi,t.HTMLWrapper=_r,t.Header=Li,t.Logic=ct,t.Main=Di,t.Matrix=kn,t.Nav=Pi,t.PI=s,t.Permutation=lt,t.Random=dt,t.SPA=za,t.SVGWrapper=kr,t.Section=zi,t.Str=bn,t.Suspense=Er,t.Svg=Ea,t.Table=Si,t.Utils=nt,t.ZikoApp=Ua,t.ZikoCustomEvent=Ue,t.ZikoEventClick=Bt,t.ZikoEventClipboard=Vt,t.ZikoEventCustom=Yt,t.ZikoEventDrag=Xt,t.ZikoEventFocus=Jt,t.ZikoEventInput=Ce,t.ZikoEventKey=ie,t.ZikoEventMouse=oe,t.ZikoEventPointer=le,t.ZikoEventSwipe=De,t.ZikoEventTouch=pe,t.ZikoEventWheel=fe,t.ZikoHead=hs,t.ZikoMutationObserver=Fe,t.ZikoSPA=Pa,t.ZikoUIAbbrText=vs,t.ZikoUIArticle=Wi,t.ZikoUIAside=Yi,t.ZikoUIAudio=Jr,t.ZikoUIBlockQuote=Os,t.ZikoUIBr=Zr,t.ZikoUICanvas=Aa,t.ZikoUICodeText=xs,t.ZikoUIDefintion=bs,t.ZikoUIElement=ps,t.ZikoUIFigure=Yr,t.ZikoUIFlex=mi,t.ZikoUIFooter=Gi,t.ZikoUIForm=wi,t.ZikoUIGrid=Ki,t.ZikoUIHTMLWrapper=xr,t.ZikoUIHeader=$i,t.ZikoUIHeading=Zs,t.ZikoUIHr=Ur,t.ZikoUIHtmlTag=Sr,t.ZikoUIImage=qr,t.ZikoUIInput=Gs,t.ZikoUIInputCheckbox=nr,t.ZikoUIInputColor=er,t.ZikoUIInputDatalist=ai,t.ZikoUIInputDate=pr,t.ZikoUIInputDateTime=br,t.ZikoUIInputEmail=cr,t.ZikoUIInputImage=$r,t.ZikoUIInputNumber=Ks,t.ZikoUIInputOption=ni,t.ZikoUIInputPassword=ur,t.ZikoUIInputRadio=or,t.ZikoUIInputSearch=rr,t.ZikoUIInputSlider=Js,t.ZikoUIInputTime=fr,t.ZikoUILabel=ii,t.ZikoUILink=Rr,t.ZikoUIMain=Ni,t.ZikoUINav=Vi,t.ZikoUIParagraphe=Ms,t.ZikoUIQuote=gs,t.ZikoUISVGWrapper=vr,t.ZikoUISection=qi,t.ZikoUISelect=hi,t.ZikoUISubText=ws,t.ZikoUISupText=ys,t.ZikoUISuspense=Ir,t.ZikoUISvg=Ia,t.ZikoUIText=fs,t.ZikoUITextArea=li,t.ZikoUIVideo=Kr,t.ZikoUIXMLWrapper=wr,t.ZikoUseRoot=Qa,t.ZikoUseStyle=xe,t.__CACHE__=qa,t.__Config__=Va,t.__HYDRATION_MAP__=$a,t.__HYDRATION__=Na,t.__UI__=Ba,t.__ZikoEvent__=Ht,t.abbrText=Cs,t.abs=jn,t.accum=J,t.acos=Vn,t.acosh=Jn,t.acot=Yn,t.add=O,t.arange=N,t.arr2str=un,t.asin=qn,t.asinh=ta,t.atan=Wn,t.atan2=na,t.atanh=ea,t.audio=ti,t.bindClickEvent=$t,t.bindClipboardEvent=Wt,t.bindCustomEvent=(t,e,s)=>new Yt(t,e,s),t.bindDragEvent=Qt,t.bindFocusEvent=ee,t.bindHashEvent=(t,e)=>new se(t,e),t.bindKeyEvent=ae,t.bindMouseEvent=ce,t.bindPointerEvent=me,t.bindTouchEvent=(t,e)=>new pe(t,e),t.bindWheelEvent=be,t.blockQuote=js,t.br=Dr,t.brs=Pr,t.btn=Br,t.cartesianProduct=st,t.ceil=sa,t.checkbox=ar,t.clamp=B,t.codeText=As,t.combinaison=mt,t.complex=On,t.cos=Pn,t.cosh=Gn,t.cot=$n,t.coth=Qn,t.count=wn,t.countWords=xn,t.csc=Nn,t.csv2arr=yt,t.csv2json=vt,t.csv2matrix=wt,t.csv2object=xt,t.csv2sql=_t,t.datalist=oi,t.default=to,t.defineParamsGetter=Ha,t.deg2rad=W,t.dfnText=Is,t.div=Z,t.e=Dn,t.fact=aa,t.figure=Gr,t.floor=ra,t.geomspace=q,t.getEvent=zt,t.h=Ar,t.h1=Us,t.h2=Rs,t.h3=Ds,t.h4=Ls,t.h5=Ps,t.h6=zs,t.hTags=Mr,t.hr=Lr,t.hrs=zr,t.html=Hr,t.hypot=ca,t.image=Wr,t.inRange=tt,t.input=Xs,t.inputCamera=ri,t.inputColor=sr,t.inputDate=dr,t.inputDateTime=yr,t.inputEmail=lr,t.inputImage=Vr,t.inputNumber=Qs,t.inputPassword=mr,t.inputTime=gr,t.isApproximatlyEqual=et,t.json2arr=Et,t.json2css=mn,t.json2csv=Tt,t.json2csvFile=At,t.json2xml=jt,t.json2xmlFile=Zt,t.json2yml=Ot,t.json2ymlFile=St,t.lerp=F,t.li=Vs,t.link=Fr,t.linspace=$,t.ln=Ln,t.logspace=V,t.map=H,t.mapfun=I,t.matrix=In,t.matrix2=En,t.matrix3=Tn,t.matrix4=An,t.max=Q,t.min=K,t.modulo=U,t.mul=j,t.norm=P,t.nums=L,t.obj2str=cn,t.ol=qs,t.ones=D,t.p=Ss,t.pgcd=rt,t.pow=Un,t.powerSet=ot,t.ppcm=it,t.preload=gt,t.prod=X,t.quote=ks,t.rad2deg=Y,t.radio=hr,t.removeExtraSpace=yn,t.round=ia,t.s=Cr,t.sTags=Or,t.search=ir,t.sec=Hn,t.select=ci,t.sig=ha,t.sign=oa,t.sin=zn,t.sinc=Bn,t.sinh=Xn,t.slider=tr,t.sqrt=Zn,t.sqrtn=Rn,t.str=vn,t.sub=S,t.subSet=null,t.subText=Ts,t.sum=G,t.supText=Es,t.svg2ascii=an,t.svg2img=hn,t.svg2imgUrl=on,t.svg2str=nn,t.tags=sn,t.tan=Fn,t.tanh=Kn,t.text=_s,t.textarea=ui,t.timeTaken=xa,t.time_memory_Taken=ga,t.ul=Ws,t.useAnimation=(t,e=fa.Linear,s=50,r)=>new _a(t,fa.Linear,50,r),t.useChannel=Xa,t.useCustomEvent=Re,t.useEventEmitter=es,t.useFavIcon=rs,t.useFps=ma,t.useHashEvent=je,t.useHead=cs,t.useInputEvent=Me,t.useLocaleStorage=(t,e)=>new Ja(localStorage,t,e),t.useMediaQuery=us,t.useMeta=ns,t.useRoot=(t,{namespace:e,register:s,ValidateCssProps:r}={})=>new Qa(t,{namespace:e,register:s,ValidateCssProps:r}),t.useSessionStorage=(t,e)=>new Ja(sessionStorage,t,e),t.useStyle=ve,t.useSuccesifKeys=Je,t.useSwipeEvent=Pe,t.useThread=(t,e,s)=>{const r=new Ka;return t&&r.call(t,e,s),r},t.useTimeLoop=pa,t.useTitle=os,t.video=Qr,t.wait=wa,t.waitForUIElm=ba,t.waitForUIElmSync=ya,t.watch=He,t.watchAttr=Ne,t.watchChildren=Ve,t.watchIntersection=We,t.watchScreen=Ke,t.watchSize=Ge,t.zeros=R,Object.defineProperty(t,"__esModule",{value:!0})}));
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";function e(t,...e){if("function"==typeof t)return e.forEach((e=>function(t,e){const s=Object.getOwnPropertyDescriptors(e);class r extends t{constructor(...t){super(...t);for(const t of Reflect.ownKeys(s)){const e=s[t];"function"==typeof e.value&&(this[t]=e.value.bind(this))}}}for(const t of Reflect.ownKeys(s)){const e=s[t];("get"in e||"set"in e||"function"!=typeof e.value)&&Object.defineProperty(r.prototype,t,e)}return r}(t,e)));if("object"!=typeof t)throw new TypeError("compose: target must be a class or instance");e.forEach((e=>function(t,e){const s=Object.getOwnPropertyDescriptors(e);for(const e of Reflect.ownKeys(s)){const r=s[e];"get"in r||"set"in r?Object.defineProperty(t,e,r):"function"==typeof r.value?t[e]=r.value.bind(t):t[e]=r.value}}(t,e)))}const{PI:s,E:r}=Math,i=Number.EPSILON;var n=Object.freeze({__proto__:null,E:r,EPSILON:i,PI:s});const{PI:a,cos:o,sin:h,tan:l,acos:u,asin:m,atan:p,cosh:f,sinh:g,tanh:b,acosh:y,asinh:w,atanh:x,log:v}=Math;let _={cos:o,sin:h,tan:l,sinc:t=>h(a*t)/(a*t),sec:t=>1/o(t),csc:t=>1/h(t),cot:t=>1/l(t),acos:u,asin:m,atan:p,acot:t=>a/2-p(t),cosh:f,sinh:g,tanh:b,coth:t=>.5*v((1+t)/(1-t)),acosh:y,asinh:w,atanh:x};_=new Proxy(_,{get(t,e){if(e in t)return s=>+t[e](s).toFixed(15)}});class k{}const I=(t,...e)=>{const s=e.map((e=>{if(null===e)return t(null);if(["number","string","boolean","bigint","undefined"].includes(typeof e))return t(e);if(e instanceof Array)return e.map((e=>I(t,e)));if(ArrayBuffer.isView(e))return e.map((e=>t(e)));if(e instanceof Set)return new Set(I(t,...e));if(e instanceof Map)return new Map([...e].map((e=>[e[0],I(t,e[1])])));if(e instanceof kn)return new kn(e.rows,e.cols,I(e.arr.flat(1)));if(e instanceof Mn){const[s,r,i,n]=[e.a,e.b,e.z,e.phi];switch(t){case Math.log:return On(Ln(i),n);case Math.exp:return On(Dn(s)*Pn(r),Dn(s)*zn(r));case Math.abs:return i;case Math.sqrt:return On(Zn(i)*Pn(n/2),Zn(i)*zn(n/2));case _.cos:return On(Pn(s)*Gn(r),-zn(s)*Xn(r));case _.sin:return On(zn(s)*Gn(r),Pn(s)*Xn(r));case _.tan:{const t=Pn(2*s)+Gn(2*r);return On(zn(2*s)/t,Xn(2*r)/t)}case _.cosh:return On(Gn(s)*Pn(r),Xn(s)*zn(r));case _.sinh:return On(Xn(s)*Pn(r),Gn(s)*zn(r));case _.tanh:{const t=Gn(2*s)+Pn(2*r);return On(Xn(2*s)/t,zn(2*r)/t)}default:return t(e)}}else if(e instanceof Object)return t(Object)||Object.fromEntries(Object.entries(e).map((e=>[e[0],I(t,e[1])])))}));return 1==s.length?s[0]:s},E=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t+e;if(e instanceof Mn)return On(t+e.a,e.b);if(e instanceof kn)return kn.nums(e.rows,e.cols,t).add(e);if(e instanceof Array)return e.map((e=>O(e,t)))}else{if(t instanceof Mn||t instanceof kn)return e instanceof Array?e.map((e=>t.clone.add(e))):t.clone.add(e);if(t instanceof Array){if(!(e instanceof Array))return t.map((t=>O(t,e)));if(t.length===e.length)return t.map(((t,s)=>O(t,e[s])))}}},T=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t-e;if(e instanceof Mn)return On(t-e.a,-e.b);if(e instanceof kn)return kn.nums(e.rows,e.cols,t).sub(e);if(e instanceof Array)return e.map((e=>S(e,t)))}else{if(t instanceof Mn||t instanceof kn)return e instanceof Array?e.map((e=>t.clone.sub(e))):t.clone.sub(e);if(t instanceof Array){if(!(e instanceof Array))return t.map((t=>S(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>S(t,e[s])))}}},A=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t*e;if(e instanceof Mn)return On(t*e.a,t*e.b);if(e instanceof kn)return kn.nums(e.rows,e.cols,t).mul(e);if(e instanceof Array)return e.map((e=>j(t,e)))}else{if(t instanceof Mn||t instanceof kn)return e instanceof Array?e.map((e=>t.clone.mul(e))):t.clone.mul(e);if(t instanceof Array){if(!(e instanceof Array))return t.map((t=>j(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>j(t,e[s])))}}},C=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t/e;if(e instanceof Mn)return On(t/e.a,t/e.b);if(e instanceof kn)return kn.nums(e.rows,e.cols,t).div(e);if(e instanceof Array)return e.map((e=>Z(t,e)))}else{if(t instanceof Mn||t instanceof kn)return e instanceof Array?e.map((e=>t.clone.div(e))):t.clone.div(e);if(t instanceof Array){if(!(e instanceof Array))return t.map((t=>Z(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>Z(t,e[s])))}}},M=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t%e;if(e instanceof Mn)return On(t%e.a,t%e.b);if(e instanceof kn)return kn.nums(e.rows,e.cols,t).modulo(e);if(e instanceof Array)return e.map((e=>Z(t,e)))}else{if(t instanceof Mn||t instanceof kn)return e instanceof Array?e.map((e=>t.clone.div(e))):t.clone.div(e);if(t instanceof Array&&!(e instanceof Array))return t.map((t=>O(t,e)))}},O=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=E(s,e[t]);return s},S=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=T(s,e[t]);return s},j=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=A(s,e[t]);return s},Z=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=C(s,e[t]);return s},U=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=M(s,e[t]);return s},R=t=>new Array(t).fill(0),D=t=>new Array(t).fill(1),L=(t,e)=>new Array(e).fill(t),P=(t,e,s)=>{if("number"==typeof t)return e!==s?(t-e)/(s-e):0;if(t instanceof kn)return new kn(t.rows,t.cols,P(t.arr.flat(1),e,s));if(t instanceof Mn)return new Mn(P(t.a,e,s),P(t.b,e,s));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>P(t,e,s)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=P(t[s])}}},F=(t,e,s)=>{if("number"==typeof t)return(s-e)*t+e;if(t instanceof kn)return new kn(t.rows,t.cols,F(t.arr.flat(1),e,s));if(t instanceof Mn)return new Mn(F(t.a,e,s),F(t.b,e,s));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>F(t,e,s)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=F(t[s])}}},H=(t,e,s,r,i)=>{if("number"==typeof t)return F(P(t,e,s),r,i);if(t instanceof kn)return new kn(t.rows,t.cols,H(t.arr.flat(1),e,s,r,i));if(t instanceof Mn)return new Mn(H(t.a,s,r,i),H(t.b,e,s,r,i));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>H(t,e,s,r,i)));{let n=new Array(t.length);for(let a=0;a<t.length;a++)n[a]=H(t[a],e,s,r,i)}}},N=(t,e,s)=>{const[r,i]=[K(e,s),Q(e,s)];if("number"==typeof t)return K(Q(t,r),i);if(t instanceof kn)return new kn(t.rows,t.cols,N(t.arr.flat(1),r,i));if(t instanceof Mn)return new Mn(N(t.a,r,i),N(t.b,r,i));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>N(t,r,i)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=N(t[s],r,i)}}},B=(t,e,s,r=!1)=>{let i=[];if(t<e)for(let n=t;r?n<=e:n<e;n+=s)i.push(10*n/10);else for(let n=t;r?n>=e:n>e;n-=s)i.push(10*n/10);return i},$=(t,e,s=jn(e-t)+1,r=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[a,o]=[t,e].sort(((t,e)=>e-t));var i=[];let h;h=r?(a-o)/(s-1):(a-o)/s;for(var n=0;n<s;n++)t<e?i.push(o+h*n):i.push(a-h*n);return i}if([t,e].some((t=>t instanceof Mn))){const i=On(t),n=On(e);s=s||Math.abs(i.a-n.a)+1;const a=$(i.a,n.a,s,r),o=$(i.b,n.b,s,r);let h=new Array(s).fill(null);return h=h.map(((t,e)=>On(a[e],o[e]))),h}}},V=(t,e,s=e-t+1,i=r,n=!0)=>$(t,e,s,n).map((t=>Un(i,t))),q=(t,e,s=jn(e-t)+1,r=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[i,n]=[t,e].sort(((t,e)=>e-t));let a;a=Rn(i/n,r?s-1:s);const o=[n];for(let t=1;t<s;t++)o.push(o[t-1]*a);return t<e?o:o.reverse()}if([t,e].some((t=>t instanceof Mn))){const i=On(t),n=On(e);let a;s=s||Math.abs(i.a-n.a)+1,a=Rn(n.div(i),r?s-1:s);const o=[i];for(let t=1;t<s;t++)o.push(j(o[t-1],a));return o}}},W=(...t)=>mapfun((t=>t*Math.PI/180),...t),Y=(...t)=>mapfun((t=>t/Math.PI*180),...t),G=(...t)=>{if(t.every((t=>"number"==typeof t))){let e=t[0];for(let s=1;s<t.length;s++)e+=t[s];return e}const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(G(...t[s])):t[s]instanceof Object&&e.push(G(...Object.values(t[s])));return 1===e.length?e[0]:e},X=(...t)=>{if(t.every((t=>"number"==typeof t))){let e=t[0];for(let s=1;s<t.length;s++)e*=t[s];return e}const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(X(...t[s])):t[s]instanceof Object&&e.push(X(...Object.values(t[s])));return 1===e.length?e[0]:e},K=(...t)=>{if(t.every((t=>"number"==typeof t)))return Math.min(...t);const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(K(...t[s])):t[s]instanceof Object&&e.push(Object.fromEntries([Object.entries(t[s]).sort(((t,e)=>t[1]-e[1]))[0]]));return 1===e.length?e[0]:e},Q=(...t)=>{if(t.every((t=>"number"==typeof t)))return Math.max(...t);const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(K(...t[s])):t[s]instanceof Object&&e.push(Object.fromEntries([Object.entries(t[s]).sort(((t,e)=>e[1]-t[1]))[0]]));return 1===e.length?e[0]:e},J=(...t)=>{if(t.every((t=>"number"==typeof t))){let e=t.reduce(((t,e)=>[...t,t[t.length-1]+e]),[0]);return e.shift(),e}const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(J(...t[s])):t[s]instanceof Object&&e.push(null);return 1===e.length?e[0]:e},tt=(t,e,s)=>{const[r,i]=[Math.min(e,s),Math.max(e,s)];return t>=r&&t<=i},et=(t,e,s=1e-4)=>Math.abs(t-e)<=s,st=(t,e)=>t.reduce(((t,s)=>[...t,...e.map((t=>[s,t]))]),[]),rt=(t,e)=>{let s,r=1;if(t==ra(t)&&e==ra(e)){for(s=2;s<=t&&s<=e;++s)t%s==0&&e%s==0&&(r=s);return r}console.log("error")},it=(t,e)=>{let s;if(t==ra(t)&&e==ra(e)){for(s=t>e?t:e;s%t!=0||s%e!=0;)++s;return s}console.log("error")},nt={add:O,sub:S,mul:j,div:Z,modulo:U,zeros:R,ones:D,nums:L,norm:P,lerp:F,map:H,clamp:N,arange:B,linspace:$,logspace:V,geomspace:q,sum:G,prod:X,accum:J,cartesianProduct:st,ppcm:it,pgcd:rt,deg2rad:W,rad2deg:Y,inRange:tt,isApproximatlyEqual:et};var at=Object.freeze({__proto__:null,Utils:nt,add:O,arange:B,cartesianProduct:st,clamp:N,deg2rad:W,div:Z,geomspace:q,inRange:tt,isApproximatlyEqual:et,lerp:F,linspace:$,logspace:V,map:H,mapfun:I,modulo:U,mul:j,norm:P,nums:L,ones:D,pgcd:rt,ppcm:it,prod:X,rad2deg:Y,sub:S,sum:G,zeros:R});const ot=t=>{const e=[],s=2**t.length;for(let r=0;r<s;r+=1){const s=[];for(let e=0;e<t.length;e+=1)r&1<<e&&s.push(t[e]);e.push(s)}return e},ht={_mode:Number,_map:function(t,e,s){return e instanceof kn?new kn(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof Mn?new Mn(t(e.a,s),t(e.b,s)):e instanceof Array?e.map((e=>t(e,s))):void 0},dec2base(t,e){return this._mode=e<=10?Number:String,"number"==typeof t?this._mode((t>>>0).toString(e)):this._map(this.dec2base,t,e)},dec2bin(t){return this.dec2base(t,2)},dec2oct(t){return this.dec2base(t,8)},dec2hex(t){return this.dec2base(t,16)},bin2base(t,e){return this.dec2base(this.bin2dec(t),e)},bin2dec(t){return this._mode("0b"+t)},bin2oct(t){return this.bin2base(t,8)},bin2hex(t){return this.bin2base(t,16)},oct2dec(t){return this._mode("0o"+t)},oct2bin(t){return this.dec2bin(this.oct2dec(t))},oct2hex(t){return this.dec2hex(this.oct2dec(t))},oct2base(t,e){return this.dec2base(this.oct2dec(t),e)},hex2dec(t){return this._mode("0x"+t)},hex2bin(t){return this.dec2bin(this.hex2dec(t))},hex2oct(t){return this.dec2oct(this.hex2dec(t))},hex2base(t,e){return this.dec2base(this.hex2dec(t),e)},IEEE32toDec(t){let e=t.split(" ").join("").padEnd(32,"0"),s=e[0],r=2**(+("0b"+e.slice(1,9))-127);return(-1)**s*(1+e.slice(9,32).split("").map((t=>+t)).map(((t,e)=>t*2**(-e-1))).reduce(((t,e)=>t+e),0))*r},IEEE64toDec(t){let e=t.split(" ").join("").padEnd(64,"0"),s=e[0],r=2**(+("0b"+e.slice(1,12))-1023);return(-1)**s*(1+e.slice(13,64).split("").map((t=>+t)).map(((t,e)=>t*2**(-e-1))).reduce(((t,e)=>t+e),0))*r}},ct={_mode:Number,_map:function(t,e,s){return e instanceof kn?new kn(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof Mn?new Mn(t(e.a,s),t(e.b,s)):e instanceof Array?e.map((e=>t(e,s))):void 0},not:function(t){return["number","boolean"].includes(typeof t)?ct._mode(!t):this._map(this.not,t)},and:function(t,...e){return["number","boolean"].includes(typeof t)?ct._mode(e.reduce(((t,e)=>t&e),t)):this._map(this.and,t,e)},or:function(t,...e){return["number","boolean"].includes(typeof t)?ct._mode(e.reduce(((t,e)=>t|e),t)):this._map(this.or,t,e)},nand:function(t,...e){return this.not(this.and(t,e))},nor:function(t,...e){return this.not(this.or(t,e))},xor:function(t,...e){let s=[t,...e];return["number","boolean"].includes(typeof t)?this._mode(1===s.reduce(((t,e)=>(1==+e&&(t+=1),t)),0)):this._map(this.xor,t,e)},xnor:function(t,...e){return ct.not(ct.xor(t,e))}};class lt{static withDiscount(t,e=t.length){if(1===e)return t.map((t=>[t]));const s=[];let r;return r=this.withDiscount(t,e-1),t.forEach((t=>{r.forEach((e=>{s.push([t].concat(e))}))})),s}static withoutDiscount(t){if(1===t.length)return t.map((t=>[t]));const e=[],s=this.withoutDiscount(t.slice(1)),r=t[0];for(let t=0;t<s.length;t++){const i=s[t];for(let t=0;t<=i.length;t++){const s=i.slice(0,t),n=i.slice(t);e.push(s.concat([r],n))}}return e}}class ut{static withDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((r,i)=>{this.withDiscount(t.slice(i),e-1).forEach((t=>{s.push([r].concat(t))}))})),s}static withoutDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((r,i)=>{this.withoutDiscount(t.slice(i+1),e-1).forEach((t=>{s.push([r].concat(t))}))})),s}}const mt=(t,e,s=!1)=>ut[s?"withDiscount":"withoutDiscount"](t,e);var pt=Object.freeze({__proto__:null,Base:ht,Combinaison:ut,Logic:ct,Permutation:lt,combinaison:mt,powerSet:ot,subSet:null});class dt{static float(t=1,e){return e?Math.random()*(e-t)+t:t*Math.random()}static int(t,e){return Math.floor(this.float(t,e))}static char(t){t=t??this.bool();const e=String.fromCharCode(this.int(97,120));return t?e.toUpperCase():e}static bool(){return[!1,!0][Math.floor(2*Math.random())]}static string(t,e){return t instanceof Array?new Array(this.int(...t)).fill(0).map((()=>this.char(e))).join(""):new Array(t).fill(0).map((()=>this.char(e))).join("")}static bin(){return this.int(2)}static oct(){return this.int(8)}static dec(){return this.int(8)}static hex(){return this.int(16)}static choice(t=[1,2,3],e=new Array(t.length).fill(1/t.length)){let s=new Array(100);e=nt.accum(...e).map((t=>100*t)),s.fill(t[0],0,e[0]);for(let r=1;r<t.length;r++)s.fill(t[r],e[r-1],e[r]);return s[this.int(s.length-1)]}static shuffleArr(t){return t.sort((()=>.5-Math.random()))}static shuffleMatrix(t){const{rows:e,cols:s,arr:r}=t;return In(e,s,r.flat().sort((()=>.5-Math.random())))}static floats(t,e,s){return new Array(t).fill(0).map((()=>this.float(e,s)))}static ints(t,e,s){return new Array(t).fill(0).map((()=>this.int(e,s)))}static bools(t){return new Array(t).fill(0).map((()=>this.bool()))}static bins(t){return new Array(t).fill(0).map((()=>this.int(2)))}static octs(t){return new Array(t).fill(0).map((()=>this.int(8)))}static decs(t){return new Array(t).fill(0).map((()=>this.int(10)))}static hexs(t){return new Array(t).fill(0).map((()=>this.int(16)))}static choices(t,e,s){return new Array(t).fill(0).map((()=>this.choice(e,s)))}static perm(...t){return t.permS[this.int(t.length)]}static color(){return"#"+ht.dec2hex(this.float(16777216)).padStart(6,0)}static colors(t){return new Array(t).fill(null).map((()=>this.color()))}static complex(t=[0,1],e=[0,1]){return t instanceof Array?new Mn(this.float(t[0],t[1]),this.float(e[0],e[1])):new Mn(...this.floats(2,t,e))}static complexInt(t=[0,1],e=[0,1]){return new Mn(this.int(t[0],t[1]),this.int(e[0],e[1]))}static complexBin(){return new Mn(...this.bins(2))}static complexOct(){return new Mn(...this.octs(2))}static complexDec(){return new Mn(...this.decs(10))}static complexHex(){return new Mn(...this.octs(2))}static complexes(t,e=0,s=1){return new Array(t).fill(0).map((()=>this.complex(e,s)))}static complexesInt(t,e=0,s=1){return new Array(t).fill(0).map((()=>this.complexInt(e,s)))}static complexesBin(t){return new Array(t).fill(0).map((()=>this.complexBin()))}static complexesOct(t){return new Array(t).fill(0).map((()=>this.complexOct()))}static complexesDec(t){return new Array(t).fill(0).map((()=>this.complexDec()))}static complexesHex(t){return new Array(t).fill(0).map((()=>this.complexHex()))}static matrix(t,e,s,r){return In(t,e,this.floats(t*e,s,r))}static matrixInt(t,e,s,r){return In(t,e,this.ints(t*e,s,r))}static matrixBin(t,e){return In(t,e,this.bins(t*e))}static matrixOct(t,e){return In(t,e,this.octs(t*e))}static matrixDec(t,e){return In(t,e,this.decs(t*e))}static matrixHex(t,e){return In(t,e,this.hex(t*e))}static matrixColor(t,e){return In(t,e,this.colors(t*e))}static matrixComplex(t,e,s,r){return In(t,e,this.complexes(t*e,s,r))}static matrixComplexInt(t,e,s,r){return In(t,e,this.complexesInt(t*e,s,r))}static matrixComplexBin(t,e){return In(t,e,this.complexesBin(t*e))}static matrixComplexOct(t,e){return In(t,e,this.complexesBin(t*e))}static matrixComplexDec(t,e){return In(t,e,this.complexesBin(t*e))}static matrixComplexHex(t,e){return In(t,e,this.complexesBin(t*e))}}var ft=Object.freeze({__proto__:null,Random:dt});const gt=t=>{const e=new XMLHttpRequest;if(e.open("GET",t,!1),e.send(),200===e.status)return e.responseText;throw new Error(`Failed to fetch data from ${t}. Status: ${e.status}`)};globalThis.fetchdom=async function(t="https://github.com/zakarialaoui10"){const e=await fetch(t),s=await e.text();return(new DOMParser).parseFromString(s,"text/xml").documentElement},globalThis.fetchdomSync=function(t="https://github.com/zakarialaoui10"){const e=gt(t);return(new DOMParser).parseFromString(e,"text/xml").documentElement};var bt=Object.freeze({__proto__:null,preload:gt});const yt=(t,e=",")=>t.trim().trimEnd().split("\n").map((t=>t.split(e))),wt=(t,e=",")=>new kn(yt(t,e)),xt=(t,e=",")=>{const[s,...r]=yt(t,e);return r.map((t=>{const e={};return s.forEach(((s,r)=>{e[s]=t[r]})),e}))},vt=(t,e=",")=>JSON.stringify(xt(t,e)),_t=(t,e)=>{const s=t.trim().trimEnd().split("\n").filter((t=>t));let r=`INSERT INTO ${e} (${s[0].split(",").join(", ")}) Values `,i=[];for(let t=1;t<s.length;t++){const e=s[t].split(",");i.push(`(${e})`)}return r+i.join(",\n")},kt=t=>t instanceof Array?[Object.keys(t[0]),...t.map((t=>Object.values(t)))]:[Object.keys(t)],It=(t,e)=>kt(t).map((t=>t.join(e))).join("\n"),Et=t=>kt(t instanceof Object?t:JSON.parse(t)),Tt=(t,e=",")=>It(t instanceof Object?t:JSON.parse(t),e),At=(t,e)=>{const s=Tt(t,e),r=new Blob([s],{type:"text/csv;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}},Ct=(t,e)=>{const s=[];if(Array.isArray(t))t.forEach((t=>{if("object"==typeof t&&null!==t){s.push(`${e}-`);const r=Ct(t,`${e} `);s.push(...r)}else s.push(`${e}- ${t}`)}));else for(const r in t)if(t.hasOwnProperty(r)){const i=t[r];if("object"==typeof i&&null!==i){s.push(`${e}${r}:`);const t=Ct(i,`${e} `);s.push(...t)}else s.push(`${e}${r}: ${i}`)}return s},Mt=(t,e="")=>Ct(t,e).join("\n"),Ot=(t,e)=>Mt(t instanceof Object?t:JSON.parse(t),e),St=(t,e)=>{const s=Ot(t,e),r=new Blob([s],{type:"text/yml;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}},jt=(t,e=1)=>{let s="";for(const r in t)if(t.hasOwnProperty(r)){const i=t[r];s+="\n"+" ".repeat(e)+`<${r}>`,s+="object"==typeof i?jt(i,e+2):`${i}`,s+=`</${r}>`}return s.trim()},Zt=(t,e)=>{const s=jt(t,e),r=new Blob([s],{type:"text/xml;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}};class Ut{constructor(t){this.cache={node:t}}isZikoUINode(){return!0}get node(){return this.cache.node}}globalThis.node=t=>new Ut(t);const Rt={append(...t){return Dt.call(this,"append","push",...t),this},prepend(...t){return this.__addItem__.call(this,"prepend","unshift",...t),this},insertAt(t,...e){if(t>=this.element.children.length)this.append(...e);else for(let s=0;s<e.length;s++)["number","string"].includes(typeof e[s])&&(e[s]=_s(e[s])),this.element?.insertBefore(e[s].element,this.items[t].element),this.items.splice(t,0,e[s]);return this},remove(...t){const e=t=>{"number"==typeof t&&(t=this.items[t]),t?.isZikoUIElement&&this.element?.removeChild(t.element),this.items=this.items.filter((e=>e!==t))};for(let s=0;s<t.length;s++)e(t[s]);for(let t=0;t<this.items.length;t++)Object.assign(this,{[[t]]:this.items[t]});return this},clear(){return this?.items?.forEach((t=>t.unrender())),this.element.innerHTML="",this},render(t=this.target){if(!this.isBody)return t?.isZikoUIElement&&(t=t.element),this.target=t,this.target?.appendChild(this.element),this},unrender(){return this.cache.parent?this.cache.parent.remove(this):this.target?.children?.length&&[...this.target?.children].includes(this.element)&&this.target.removeChild(this.element),this},renderAfter(t=1){return setTimeout((()=>this.render()),t),this},unrenderAfter(t=1){return setTimeout((()=>this.unrender()),t),this},after(t){return t?.isZikoUIElement&&(t=t.element),this.element?.after(t),this},before(t){return t?.isZikoUIElement&&(t=t.element),this.element?.before(t),this}};function Dt(t,e,...s){if(this.cache.isFrozzen)return console.warn("You can't append new item to frozzen element"),this;for(let r=0;r<s.length;r++)if(["number","string"].includes(typeof s[r])&&(s[r]=_s(s[r])),"function"==typeof globalThis?.Node&&s[r]instanceof globalThis?.Node&&(s[r]=new this.constructor(s[r])),s[r]?.isZikoUIElement&&(s[r].cache.parent=this,this.element[t](s[r].element),s[r].target=this.element,this.items[e](s[r])),s[r]instanceof Function){const t=s[r]();if(t.isStateGetter){const e=document?.createTextNode(t.value);this.element.appendChild(e),t._subscribe((t=>e.textContent=t))}}else s[r]instanceof Object&&(s[r]?.style&&this.style(s[r]?.style),s[r]?.attr&&Object.entries(s[r].attr).forEach((t=>this.setAttr(""+t[0],t[1]))));return this.maintain(),this}const Lt={at(t){return this.items.at(t)},forEach(t){return this.items.forEach(t),this},map(t){return this.items.map(t)},find(t){return this.items.filter(t)}},Pt={Click:["Click","DblClick"],Ptr:["PtrMove","PtrDown","PtrUp","PtrLeave","PtrEnter","PtrOut","PtrCancel"],Mouse:["MouseMove","MouseDown","MouseUp","MouseEnter","MouseLeave","MouseOut"],Key:["KeyDown","KeyPress","KeyUp"],Clipboard:["Copy","Cut","Paste"],Focus:["focus","blur"],Drag:["Drag","DragStart","DragEnd","Drop"],Wheel:["Wheel"]},zt=(t="")=>t.startsWith("Ptr")?`pointer${t.split("Ptr")[1].toLowerCase()}`:t.toLowerCase();function Ft(t,e,s,r,i){this.cache.currentEvent=e,this.cache.event=t,s?.call(this),r?.hasOwnProperty("prototype")?r?.call(this):r?.call(null,this),this.cache.preventDefault[e]&&t.preventDefault(),this.cache.stopPropagation[e]&&t.stopPropagation(),this.cache.stopImmediatePropagation[e]&&t.stopImmediatePropagation(),this.cache.stream.enabled[e]&&i&&this.cache.stream.history[e].push(i),this.cache.callbacks[e]?.map((t=>t(this)))}class Ht{constructor(t=null,e=[],s,r){this.target=t,this.cache={currentEvent:null,event:null,options:{},preventDefault:{},stopPropagation:{},stopImmediatePropagation:{},event_flow:{},paused:{},stream:{enabled:{},clear:{},history:{}},callbacks:{},__controllers__:{}},e&&this._register_events(e,s,r)}_register_events(t,e,s,r=!0){const i=t?.map((t=>zt(t)));return i?.forEach(((i,n)=>{Object.assign(this.cache.preventDefault,{[i]:!1}),Object.assign(this.cache.options,{[i]:{}}),Object.assign(this.cache.paused,{[i]:!1}),Object.assign(this.cache.stream.enabled,{[i]:!1}),Object.assign(this.cache.stream.clear,{[i]:!1}),Object.assign(this.cache.stream.history,{[i]:[]}),Object.assign(this.cache.__controllers__,{[i]:t=>Ft.call(this,t,i,e,s)}),r&&Object.assign(this,{[`on${t[n]}`]:(...t)=>this.__onEvent(i,this.cache.options[i],{},...t)})})),this}get targetElement(){return this.target?.element}get isParent(){return this.target?.element===this.event.srcElement}get item(){return this.target.find((t=>t.element==this.event?.srcElement))?.[0]}get currentEvent(){return this.cache.currentEvent}get event(){return this.cache.event}setTarget(t){return this.target=t,this}__handle(t,e,s,r){return this.targetElement?.addEventListener(t,e,s),this}__onEvent(t,e,s,...r){if(0===r.length){if(console.log("00"),!this.cache.callbacks[t])return this;console.log("Call"),this.cache.callbacks[t].map((t=>e=>t.call(this,e)))}else this.cache.callbacks[t]=r.map((t=>e=>t.call(this,e)));return this.__handle(t,this.cache.__controllers__[t],e,s),this}#t(t,e,s){"default"===s&&Object.assign(this.cache[t],{...this.cache[t],...e});const r="default"===s?this.cache[t]:Object.fromEntries(Object.keys(this.cache.preventDefault).map((t=>[t,s])));return Object.assign(this.cache[t],{...r,...e}),this}preventDefault(t={},e="default"){return this.#t("preventDefault",t,e),this}stopPropagation(t={},e="default"){return this.#t("stopPropagation",t,e),this}stopImmediatePropagation(t={},e="default"){return this.#t("stopImmediatePropagation",t,e),this}setEventOptions(t,e){return this.pause({[t]:!0},"default"),Object.assign(this.cache.options[zt(t)],e),this.resume({[t]:!0},"default"),this}pause(t={},e="default"){t={..."default"===e?this.cache.stream.enabled:Object.entries(Object.keys(this.cache.stream.enabled).map((t=>[t,e]))),...t};for(let e in t)t[e]&&(this.targetElement?.removeEventListener(e,this.cache.__controllers__[e],this.cache.options[e]),this.cache.paused[e]=!0);return this}resume(t={},e="default"){t={..."default"===e?this.cache.stream.enabled:Object.entries(Object.keys(this.cache.stream.enabled).map((t=>[t,e]))),...t};for(let e in t)t[e]&&(this.targetElement?.addEventListener(e,this.cache.__controllers__[e],this.cache.options[e]),this.cache.paused[e]=!1);return this}stream(t={},e="default"){this.cache.stream.t0=Date.now();return t={...Object.fromEntries(Object.keys(this.cache.stream.enabled).map((t=>[t,e]))),...t},Object.assign(this.cache.stream.enabled,t),this}clear(){return this}dispose(t={},e="default"){return this.pause(t,e),this}}class Nt extends Ht{constructor(t,e){super(t,Pt.Click,Bt,e)}}function Bt(){"click"===this.currentEvent?this.dx=0:this.dx=1}const $t=(t,e)=>new Nt(t,e);class Vt extends Ht{constructor(t,e){super(t,Pt.Clipboard,qt,e)}}function qt(){}const Wt=(t,e)=>new Vt(t,e);class Yt extends Ht{constructor(t,e,s){super(t,e,Gt,s)}_register_events(t){return super._register_events(t,null,null,!1),this}emit(t,e={}){const s=new Event(t);return this.targetElement.dispatchEvent(s),this}on(t,...e){return this.cache.options.hasOwnProperty(t)||this._register_events([t]),this.__onEvent(t,this.cache.options[t],{},...e),this}}function Gt(){}class Xt extends Ht{constructor(t,e){super(t,Pt.Drag,Kt,e)}}function Kt(){}const Qt=(t,e)=>new Xt(t,e);class Jt extends Ht{constructor(t,e){super(t,Pt.Focus,te,e)}}function te(){}const ee=(t,e)=>new Jt(t,e);let se=class extends Ht{constructor(t,e){super(t,Pt.Hash,re,e)}};function re(){}class ie extends Ht{constructor(t,e){super(t,Pt.Key,ne,e)}}function ne(){switch(this.currentEvent){case"keydown":this.kd=this.event.key;break;case"keypress":this.kp=this.event.key;break;case"keyup":this.ku=this.event.key}}const ae=(t,e)=>new ie(t,e);class oe extends Ht{constructor(t,e){super(t,Pt.Mouse,he,e)}}function he(){}const ce=(t,e)=>new oe(t,e);class le extends Ht{constructor(t,e){super(t,Pt.Ptr,ue,e),this.isDown=!1}}function ue(){switch(this.currentEvent){case"pointerdown":this.dx=parseInt(this.event.offsetX),this.dy=parseInt(this.event.offsetY),this.isDown=!0;break;case"pointermove":this.mx=parseInt(this.event.offsetX),this.my=parseInt(this.event.offsetY),this.isMoving=!0;break;case"pointerup":{this.ux=parseInt(this.event.offsetX),this.uy=parseInt(this.event.offsetY),this.isDown=!1,console.log(this.target.width);const t=(this.ux-this.dx)/this.target.width,e=(this.dy-this.uy)/this.target.height,s=t<0?"left":t>0?"right":"none",r=e<0?"bottom":e>0?"top":"none";this.swippe={h:s,v:r,delta_x:t,delta_y:e}}}}const me=(t,e)=>new le(t,e);class pe extends Ht{constructor(t,e){super(t,Pt.Touch,de,e)}}function de(){}class fe extends Ht{constructor(t,e){super(t,Pt.Wheel,ge,e)}}function ge(){}const be=(t,e)=>new fe(t,e),ye={ptr:me,mouse:ce,key:ae,click:$t,drag:Qt,clipboard:Wt,focus:ee,wheel:be},we={};Object.entries(Pt).forEach((([t,e])=>{e.forEach((e=>{const s=`on${e}`;we[s]=function(...e){return this.events[t]||(this.events[t]=ye[t.toLowerCase()](this)),this.events[t][s](...e),this}}))}));class xe{constructor(t={},e=(t.hasOwnProperty("default")?"default":Object.keys(t)[0]),s=0){this.id="Ziko-Style-"+s,this.keys=new Set,this.styles={default:{fontSize:"1em",color:"green"},other:{fontSize:"2em",color:"cyan"}},t&&this.add(t),e&&this.use(e)}get current(){return[...this.keys].reduce(((t,e)=>(t[e]=`var(--${e}-${this.id})`,t)),{})}add(t,e={}){return t&&"object"==typeof t&&!Array.isArray(t)?Object.assign(this.styles,t):"string"==typeof t&&Object.assign(this.styles,{[t]:e}),this}#e(t){const e=Object.keys(this.styles);for(let s in this.styles[e[t]])Object.prototype.hasOwnProperty.call(this.styles[e[t]],s)&&(document.documentElement.style.setProperty(`--${s}-${this.id}`,this.styles[e[t]][s]),this.keys.add(s));return this}#s(t){if(!this.styles[t])return this;for(let e in this.styles[t])Object.prototype.hasOwnProperty.call(this.styles[t],e)&&(document.documentElement.style.setProperty(`--${e}-${this.id}`,this.styles[t][e]),this.keys.add(e));return this}#r(t){for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(document.documentElement.style.setProperty(`--${e}-${this.id}`,t[e]),this.keys.add(e));return this}use(t){return"number"==typeof t?this.#e(t):"string"==typeof t?this.#s(t):t&&"object"==typeof t?this.#r(t):this}}const ve=(t,e,s)=>new xe(t,e,s),_e=(t,e="px")=>("number"==typeof t&&(t+=e),t instanceof Array&&(t=t.map((t=>"number"==typeof t?t+=e:t)).join(" ")),t);class ke{constructor(t={}){this.target=null,this.styles=new Map([["default",t]]),this.cache={isHidden:!1,isFaddedOut:!1,transformation:{Flip:[0,0,0],matrix:new kn([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]])}}}style(t){for(const[e,s]of Object.entries(t))bn.isCamelCase(e)&&(delete t[e],Object.assign(t,{[bn.camel2hyphencase(e)]:s}));return this?.target?.element?.style&&Object.assign(this?.target?.element?.style,t),this}linkTo(t){return this.target=t,this}use(t="default"){return this.style(this.styles.get(t)),this}update(t,e){const s=this.styles.get(t);return s?this.styles.set(t,Object.assign(s,e)):this.styles.set(t,e),this}add(t,e){return this.styles.set(t,e),this}replace(t,e){return this.styles.set(t,e),this}delete(...t){return t.forEach((t=>this.styles.delete(t))),this}updateDefaultStyle(){const t=Object.fromEntries(Object.entries(this.target.element.style).filter((t=>isNaN(+t[0]))));return this.update("default",t),this}hover(t){return t&&this.add("hover",t),this.target?.element?.addEventListener("pointerenter",(()=>this.use("hover"))),this.target?.element?.addEventListener("pointerleave",(()=>this.use("default"))),this}isInline(){return getComputedStyle(this.target.element).display.includes("inline")}isBlock(){return!this.isInline()}size(t,e){return this.style({width:t,height:e}),this}width(t){if(t instanceof Object){if(t instanceof Array&&(t={min:t[0],max:t[1]}),"min"in t||"max"in t){let e=t.min??t.max,s=t.max??t.min;e=_e(e,"px"),s=_e(s,"px"),this.style({minWidth:e,maxWidth:s},{target:target,maskVector:maskVector})}}else t=_e(t,"px"),this.style({width:t});return this}height(t){if(t instanceof Object){if(t instanceof Array&&(t={min:t[0],max:t[1]}),"min"in t||"max"in t){let e=t.min??t.max,s=t.max??t.min;e=_e(e,"px"),s=_e(s,"px"),this.style({minHeight:e,maxHeight:s},{target:target,maskVector:maskVector})}}else t=_e(t,"px"),this.style({height:t});return this}enableResize(t=!1,e=!1){let s="none";return s=t?e?"both":"horizontal":e?"vertical":"none",this.style({resize:s,overflow:"hidden"}),this.isInline()&&(console.group("Ziko Issue : Temporarily Incompatible Method"),console.warn(".enableResize has no effect on inline elements!"),console.info("%cConsider using other display types such as block, inline-block, flex, or grid for proper resizing behavior.","color:gold;background-color:#3333cc;padding:5px"),console.groupEnd()),this}hide({after:t,target:e,maskVector:s}={}){if("number"==typeof t){const r=()=>this.hide({target:e,maskVector:s});setTimeout(r,t),clearTimeout(r)}else this.cache.isHidden=!0,this.style({display:"none"},{target:e,maskVector:s});return this}show({after:t,target:e,maskVector:s}={}){if("number"==typeof t){const r=()=>this.show({target:e,maskVector:s});setTimeout(r,t),clearTimeout(r)}else this.cache.isHidden=!1,this.style({display:""},{target:e,maskVector:s});return this}color(t){return this.style({color:t}),this}background(t){return this.style({background:t}),this}backgroundColor(t){return this.style({backgroundColor:t}),this}opacity(t,{target:e,maskVector:s}={}){return this.style({opacity:t},{target:e,maskVector:s}),this}position(t){return this.style({position:t}),this}display(t,{target:e,maskVector:s}={}){return this.style({display:t},{target:e,maskVector:s}),this}zIndex(t){return this.style({zIndex:t}),this}float(t,{target:e,maskVector:s}={}){return this.style({float:t},{target:e,maskVector:s}),this}border(t="1px solid red",{target:e,maskVector:s}={}){return this.style({border:t},{target:e,maskVector:s}),this}borderTop(t="1px solid red",{target:e,maskVector:s}={}){return this.style({borderTop:t},{target:e,maskVector:s}),this}borderRight(t="1px solid red",{target:e,maskVector:s}={}){return this.style({borderRight:t},{target:e,maskVector:s}),this}borderBottom(t="1px solid red",{target:e,maskVector:s}={}){return this.style({borderBottom:t},{target:e,maskVector:s}),this}borderLeft(t="1px solid red",{target:e,maskVector:s}={}){return this.style({borderLeft:t},{target:e,maskVector:s}),this}borderRadius(t){return t=_e(t,"px"),this.style({borderRadius:t},{target:target,maskVector:maskVector}),this}margin(t){return t=_e(t,"px"),this.style({margin:t},{target:target,maskVector:maskVector}),this}marginTop(t){return t=_e(t,"px"),this.style({marginTop:t}),this}marginRight(t){return t=_e(t,"px"),this.style({marginRight:t}),this}marginBootom(t){return t=_e(t,"px"),this.style({marginBootom:t}),this}marginLeft(t){return t=_e(t,"px"),this.style({marginLeft:t}),this}padding(t){return t=_e(t,"px"),this.style({padding:t}),this}paddingTop(t){return t=_e(t,"px"),this.style({paddingTop:t}),this}paddingRight(t){return t=_e(t,"px"),this.style({paddingRight:t}),this}paddingBootom(t){return t=_e(t,"px"),this.style({paddingBootom:t}),this}paddingLeft(t){return t=_e(t,"px"),this.style({paddingLeft:t}),this}font(t){return this.style({font:t}),this}fontFamily(t=""){return this.style({fontFamily:t}),this}fontSize(t){return this.style({fontSize:t}),this}cursor(t="pointer"){return this.style({cursor:t}),this}overflow(t,e){const s=["hidden","auto"];return this.style({overflowX:"number"==typeof t?s[t]:t,overflowY:"number"==typeof e?s[e]:e},{target:target,maskVector:maskVector}),this}clip(t,{target:e,maskVector:s}={}){return"string"==typeof t&&(t="polygon("+t+")"),this.style({clipPath:t},{target:e,maskVector:s}),this}fadeOut(t=1){return this.style({transition:`opacity ${t/1e3}s`,opacity:0}),this.cache.isFaddedOut=!0,this}fadeIn(t=1){return this.style({transition:`opacity ${t/1e3}s`,opacity:1}),this.cache.isFaddedOut=!1,this}toggleFade(t=1e3,e=t){return this.cache.isFaddedOut?this.fadeIn(t):this.fadeOut(e),this}morphBorderRadius(t,e){return this.style({borderRadius:t,transition:`borderRadius ${e/1e3}s`}),this}#i(t){const e=this.cache.transformation.matrix.arr.join(",");this.style({transform:`matrix3d(${e})`,"-webkit-transform":`matrix3d(${e})`,"-moz-transform":`matrix3d(${e})`,"-ms-transform":`matrix3d(${e})`,"-o-transform":`matrix3d(${e})`}),0!=t&&this.style({transition:`transform ${t/1e3}s ease`})}translate(t,e=t,s=0,r=0){return this.cache.transformation.matrix.set(3,0,t),this.cache.transformation.matrix.set(3,1,e),this.cache.transformation.matrix.set(3,2,s),this.#i(r),this}translateX(t,e=0){return this.cache.transformation.matrix.set(3,0,t),this.#i(e),this}translateY(t,e=0){return this.cache.transformation.matrix.set(3,1,t),this.#i(e),this}translateZ(t,e=0){const s=-1/this.cache.transformation.matrix[2][2];return this.cache.transformation.matrix.set(3,2,z),this.cache.transformation.matrix.set(3,3,1-t/s),this.#i(e),this}perspective(t,e=0){const s=this.cache.transformation.matrix[3][2];return this.cache.transformation.matrix.set(2,2,-1/d),this.cache.transformation.matrix.set(3,3,1-s/t),this.#i(e),this}scale(t,e=t,s=0){return this.cache.transformation.matrix.set(0,0,t),this.cache.transformation.matrix.set(1,1,e),this.#i(s),this}scaleX(t=1,e=0){return this.cache.transformation.matrix.set(0,0,t),this.#i(e),this}scaleY(t=1,e=0){return this.cache.transformation.matrix.set(1,1,t),this.cache.transformation.matrix.arr.join(","),this.#i(e),this}skew(t,e=t,s=0){return this.cache.transformation.matrix.set(0,1,t),this.cache.transformation.matrix.set(1,0,e),this.cache.transformation.matrix.arr.join(","),this.#i(s),this}skewX(t=1,e=0){return this.cache.transformation.matrix.set(0,1,t),this.cache.transformation.matrix.arr.join(","),this.#i(e),this}skewY(t=1,e=0){return this.cache.transformation.matrix.set(1,0,t),this.cache.transformation.matrix.arr.join(","),this.#i(e),this}rotateX(t,e=0){return this.cache.transformation.matrix.set(1,1,Pn(t)),this.cache.transformation.matrix.set(1,2,-zn(t)),this.cache.transformation.matrix.set(2,1,zn(t)),this.cache.transformation.matrix.set(1,2,Pn(t)),this.#i(e),this}rotateY(t,e=0){return this.cache.transformation.matrix.set(0,0,Pn(t)),this.cache.transformation.matrix.set(0,2,zn(t)),this.cache.transformation.matrix.set(2,0,-zn(t)),this.cache.transformation.matrix.set(2,2,Pn(t)),this.#i(e),this}rotateZ(t,e=0){return this.cache.transformation.matrix.set(0,0,Pn(t)),this.cache.transformation.matrix.set(0,1,-zn(t)),this.cache.transformation.matrix.set(1,0,zn(t)),this.cache.transformation.matrix.set(1,1,Pn(t)),this.#i(e),this}flipeX(t=1){return this.cache.transformation.Flip[0]+=180,this.cache.transformation.Flip[0]%=360,this.rotateX(this.cache.transformation.Flip[0],t),this}flipeY(t=1){return this.cache.transformation.Flip[1]+=180,this.cache.transformation.Flip[1]%=360,this.rotateY(this.cache.transformation.Flip[1],t),this}flipeZ(t=1){return this.cache.transformation.Flip[2]+=180,this.cache.transformation.Flip[2]%=360,this.rotateZ(this.cache.transformation.Flip[2],t),this}slideHeightIn(t=1,e=this.h){return this.style({transition:t+"s",height:e}),this}slideHeightOut(t=1){return this.style({transition:t+"s",height:0}),this.target?.element?.n("transitionend",(()=>this.style({opacity:"none"}))),this}slideWidthIn(t=1,e=this.w){return this.style({transition:t+"s",width:e}),this}slideWidthOut(t=1){this.style({transition:t+"s",width:0});const e=()=>{this.style({opacity:"none"})};return this.target?.element?.addEventListener("transitionend",e),this.target?.element?.removeEventListener("transitionend",e),this}slideIn({transitionTimming:t=1,w:e="100%",h:s="auto"}={}){return this.style({transition:t+"s",width:e,height:s,visibility:"visible"}),this}slideOut({transitionTimming:t=1,width:e=0,heightransitionTimming:s=0}={}){this.style({visibility:"hidden",transition:t+"s",opacity:"none",width:e,height:height});const r=()=>{this.style({opacity:"none"})};return this.target?.element?.addEventListener("transitionend",r),this.target?.element?.removeEventListener("transitionend",r),this}}function Ie(t,e,s,r){return this.event=t,this.cache.preventDefault[e]&&t.preventDefault(),console.log({setter:s}),s&&s(),this.cache.stream.enabled[e]&&r&&this.cache.stream.history[e].push(r),this.cache.callbacks[e].map((t=>t(this))),this}class Ee{constructor(t){this.target=null,this.setTarget(t),this.__dispose=this.dispose.bind(this)}get targetElement(){return this.target.element}setTarget(t){return this.target=t,this}__handle(t,e,s){const r="drag"===t?t:`${this.cache.prefixe}${t}`;return this.dispose(s),this.targetElement?.addEventListener(r,e),this}__onEvent(t,e,...s){if(0===s.length){if(!(this.cache.callbacks.length>1))return this;this.cache.callbacks.map((t=>e=>t.call(this,e)))}else this.cache.callbacks[t]=s.map((t=>e=>t.call(this,e)));return this.__handle(t,this.__controller[t],e),this}preventDefault(t={}){return Object.assign(this.cache.preventDefault,t),this}pause(t={}){t={...Object.fromEntries(Object.keys(this.cache.stream.enabled).map((t=>[t,!0]))),...t};for(let e in t)t[e]&&(this.targetElement?.removeEventListener(`${this.cache.prefixe}${e}`,this.__controller[`${this.cache.prefixe}${e}`]),this.cache.paused[`${this.cache.prefixe}${e}`]=!0);return this}resume(t={}){t={...Object.fromEntries(Object.keys(this.cache.stream.enabled).map((t=>[t,!0]))),...t};for(let e in t)t[e]&&(this.targetElement?.addEventListener(`${this.cache.prefixe}${e}`,this.__controller[`${this.cache.prefixe}${e}`]),this.cache.paused[`${this.cache.prefixe}${e}`]=!1);return this}dispose(t={}){return this.pause(t),this}stream(t={}){this.cache.stream.t0=Date.now();return t={...Object.fromEntries(Object.keys(this.cache.stream.enabled).map((t=>[t,!0]))),...t},Object.assign(this.cache.stream.enabled,t),this}clear(t={}){t={...Object.fromEntries(Object.keys(this.cache.stream.clear).map((t=>[t,!0]))),...t};for(let e in t)t[e]&&(this.cache.stream.history[e]=[]);return this}}function Te(t){Ie.call(this,t,"input",null,null)}function Ae(t){Ie.call(this,t,"change",null,null)}class Ce extends Ee{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{input:!1,change:!1},paused:{input:!1,change:!1},stream:{enabled:{input:!1,change:!1},clear:{input:!1,change:!1},history:{input:[],change:[]}},callbacks:{input:[],change:[]}},this.__controller={input:Te.bind(this),change:Ae.bind(this)}}get value(){return this.target.value}onInput(...t){return this.__onEvent("input",{},...t),this}onChange(...t){return this.__onEvent("change",{},...t),this}}const Me=t=>new Ce(t);function Oe(t){Ie.call(this,t,"hashchange",null,null)}class Se extends Ee{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{hashchange:!1},paused:{hashchange:!1},stream:{enabled:{hashchange:!1},clear:{hashchange:!1},history:{hashchange:[]}},callbacks:{hashchange:[]}},this.__controller={hashchange:Oe.bind(this)}}onChange(...t){return this.__onEvent("hashchange",{},...t),this}}const je=t=>new Se(t),Ze=t=>function(e){Ie.call(this,e,t,null,null)};class Ue extends Ee{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{},paused:{},stream:{enabled:{},clear:{},history:{}},callbacks:{}},this.__controller={}}#n(t){return this.cache.preventDefault[t]=!1,this.cache.paused[t]=!1,this.cache.stream.enabled=!1,this.cache.stream.clear=!1,this.cache.stream.history=[],this.cache.callbacks[t]=[],this.__controller[t]=Ze(t).bind(this),this}on(t,...e){return this.__controller[t]||this.#n(t),this.__onEvent(t,{},...e),this}emit(t,e={}){this.__controller[t]||this.#n(t),this.detail=e;const s=new Event(t);return this.targetElement.dispatchEvent(s),this}}const Re=t=>new Ue(t);class De extends Ee{constructor(t,e=.3,s=.3){super(t);const{removeListener:r,setWidthThreshold:i,setHeightThreshold:n}=function(t,e=.5,s=.5,r,i){let n=F(e,0,r),a=F(s,0,i),o=0,h=0,c=0,l=0;const u=t=>{o=t.clientX,h=t.clientY},m=t=>{c=t.clientX,l=t.clientY,p()};function p(){const t=c-o,e=l-h;(Math.abs(t)>n||Math.abs(e)>a)&&d(t,e)}function d(e,s){const o=globalThis?.CustomEvent?new CustomEvent("swipe",{detail:{deltaX:jn(e)<n?0:oa(e)*P(jn(e),0,r),deltaY:jn(s)<a?0:oa(s)*P(jn(s),0,i),direction:{x:jn(e)<n?"none":e>0?"right":"left",y:jn(s)<a?"none":s>0?"down":"up"}}}):null;t?.dispatchEvent(o)}function f(t){n=F(t,0,r)}function g(t){a=F(t,0,i)}return t?.addEventListener("pointerdown",u),t?.addEventListener("pointerup",m),{removeListener(){t?.removeEventListener("pointerdown",u),t?.removeEventListener("pointerup",m),console.log("Swipe event listeners removed")},setWidthThreshold:f,setHeightThreshold:g}}(this.target?.element,e,s,this.target.width,this.target.height);this.cache={width_threshold:e,height_threshold:s,removeListener:r,setWidthThreshold:i,setHeightThreshold:n,legacyTouchAction:globalThis?.document?.body?.style?.touchAction,prefixe:"",preventDefault:{swipe:!1},paused:{swipe:!1},stream:{enabled:{swipe:!1},clear:{swipe:!1},history:{swipe:[]}},callbacks:{swipe:[]}},this.__controller={swipe:Le.bind(this)}}onSwipe(...t){return Object.assign(globalThis?.document?.body?.style,{touchAction:"none"}),this.__onEvent("swipe",{},...t),this}updateThresholds(t=this.cache.width_threshold,e=this.cache.height_threshold){return void 0!==t&&this.cache.setWidthThreshold(t),void 0!==e&&this.cache.setHeightThreshold(e),this}destroy(){return this.cache.removeListener(),Object.assign(globalThis?.document?.body?.style,{touchAction:this.cache.legacyTouchAction}),this}}function Le(t){Ie.call(this,t,"swipe",null,null)}const Pe=(t,e,s)=>new De(t,e,s);var ze=Object.freeze({__proto__:null,ZikoCustomEvent:Ue,ZikoEventHash:Se,ZikoEventInput:Ce,ZikoEventSwipe:De,useCustomEvent:Re,useHashEvent:je,useInputEvent:Me,useSwipeEvent:Pe});class Fe{constructor(t,e){this.target=t,this.observer=null,this.cache={options:e||{attributes:!0,childList:!0,subtree:!0},streamingEnabled:!0,lastMutation:null,mutationHistory:{}},this.observeCallback=(t,e)=>{if(this.cache.streamingEnabled)for(const e of t)switch(e.type){case"attributes":this.cache.mutationHistory.attributes.push(e.target.getAttribute(e.attributeName));break;case"childList":this.cache.mutationHistory.childList.push(e);break;case"subtree":this.cache.mutationHistory.subtree.push(e)}this.callback&&this.callback(t,e)}}observe(t){if(!this.observer){if(!globalThis.MutationObserver)return void console.log("MutationObserver Nor Supported");this.observer=new MutationObserver(this.cache.observeCallback),this.observer.observe(this.target.element,this.cache.options),this.callback=([e])=>t.call(e,this),this.cache.streamingEnabled=!0}}pause(t){this.observer&&(this.observer.disconnect(),t&&this.observer.observe(this.target,t))}reset(t){this.observer&&(this.observer.disconnect(),this.observer.observe(this.target,t||this.cache.options))}clear(){return this.observer&&(this.observer.disconnect(),this.observer=null,this.cache.mutationHistory={attributes:[],childList:[],subtree:[]}),this.cache.streamingEnabled=!1,this}getMutationHistory(){return this.cache.mutationHistory}enableStreaming(){return this.cache.streamingEnabled=!0,this}disableStreaming(){return this.cache.streamingEnabled=!1,this}}const He=(t,e={},s=null)=>{const r=new Fe(t,e);return s&&r.observe(s),r};class Ne extends Fe{constructor(t,e){super(t,{attributes:!0,childList:!1,subtree:!1}),Object.assign(this.cache,{observeCallback:(t,e)=>{for(const e of t)this.cache.lastMutation={name:e.attributeName,value:e.target.getAttribute(e.attributeName)},this.cache.streamingEnabled&&this.cache.mutationHistory.attributes.push(this.cache.lastMutation);this.callback&&this.callback(t,e)}}),this.cache.mutationHistory.attributes=[],e&&this.observe(e)}get history(){return this.cache.mutationHistory.attributes}}const Be=(t,e)=>new Ne(t,e);class $e extends Fe{constructor(t,e){super(t,{attributes:!1,childList:!0,subtree:!1}),Object.assign(this.cache,{observeCallback:(t,e)=>{for(const e of t)e.addedNodes?this.cache.lastMutation={type:"add",item:this.target.find((t=>t.element===e.addedNodes[0]))[0],previous:this.target.find((t=>t.element===e.previousSibling))[0]}:e.addedNodes&&(this.cache.lastMutation={type:"remove",item:this.target.find((t=>t.element===e.removedNodes[0]))[0],previous:this.target.find((t=>t.element===e.previousSibling))[0]}),this.cache.streamingEnabled&&this.cache.mutationHistory.children.push(this.cache.lastMutation);this.callback&&this.callback(t,e)}}),this.cache.mutationHistory.children=[],e&&this.observe(e)}get item(){return this.cache.lastMutation.item}get history(){return this.cache.mutationHistory.children}}const Ve=(t,e)=>new $e(t,e);class qe{constructor(t,e,{threshold:s=0,margin:r=0}={}){this.target=t,this.config={threshold:s,margin:r},globalThis.IntersectionObserver?this.observer=new IntersectionObserver((t=>{this.entrie=t[0],e(this)}),{threshold:this.threshold}):console.log("IntersectionObserver Not Supported")}get ratio(){return this.entrie.intersectionRatio}get isIntersecting(){return this.entrie.isIntersecting}setThreshould(t){return this.config.threshold=t,this}setMargin(t){return t="number"==typeof t?t+"px":t,this.config.margin=t,this}start(){return this.observer.observe(this.target.element),this}stop(){return this}}const We=(t,e,s)=>new qe(t,e,s);class Ye{constructor(t,e){this.target=t,this.contentRect=null,this.observer=new ResizeObserver((()=>{e(this)}))}get BoundingRect(){return this.target.element.getBoundingClientRect()}get width(){return this.BoundingRect.width}get height(){return this.BoundingRect.height}get top(){return this.BoundingRect.top}get bottom(){return this.BoundingRect.bottom}get right(){return this.BoundingRect.right}get left(){return this.BoundingRect.left}get x(){return this.BoundingRect.x}get y(){return this.BoundingRect.y}start(){return this.observer.observe(this.target.element),this}stop(){return this.observer.unobserve(this.target.element),this}}const Ge=(t,e)=>new Ye(t,e);class Xe{constructor(t=(t=>console.log({x:t.x,y:t.y}))){this.cache={},this.previousX=globalThis?.screenX,this.previousY=globalThis?.screenY}update(){Object.assign(this.cache,{screenXLeft:globalThis?.screenX,screenXRight:globalThis?.screen.availWidth-globalThis?.screenX,screenYTop:globalThis?.screenY,screenYBottom:globalThis?.screen.availHeight-globalThis?.screenY-globalThis?.outerHeight,screenCenterX:globalThis?.screen.availWidth/2,screenCenterY:globalThis?.screen.availHeight/2,windowCenterX:globalThis?.outerWidth/2+globalThis?.screenX,windowCenterY:globalThis?.outerHeight/2+globalThis?.screenY,deltaCenterX:globalThis?.screen.availWidth/2-globalThis?.outerWidth/2+globalThis?.screenX,deltaCenterY:null})}get x0(){return H(globalThis?.screenX,0,globalThis.screen.availWidth,-1,1)}get y0(){return-H(globalThis?.screenY,0,globalThis.screen.availHeight,-1,1)}get x1(){return H(globalThis?.screenX+globalThis?.outerWidth,0,globalThis.screen.availWidth,-1,1)}get y1(){return-H(globalThis?.screenY+globalThis?.outerHeight,0,globalThis.screen.availHeight,-1,1)}get cx(){return H(globalThis?.outerWidth/2+globalThis?.screenX,0,globalThis.screen.availWidth,-1,1)}get cy(){return-H(globalThis?.outerHeight/2+globalThis?.screenY,0,globalThis.screen.availHeight,-1,1)}}const Ke=t=>new Xe(t);var Qe=Object.freeze({__proto__:null,ZikoMutationObserver:Fe,watch:He,watchAttr:Be,watchChildren:Ve,watchIntersection:We,watchScreen:Ke,watchSize:Ge});const Je=(t,e=[],s=(()=>{}))=>{t.cache.stream.enabled.down=!0;const r=e.length,i=t.cache.stream.history.down.slice(-r).map((t=>t.key));e.join("")===i.join("")&&(t.event.preventDefault(),s.call(t,t))};class ts{constructor(){this.events={},this.maxListeners=10}on(t,e){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.`)}once(t,e){const s=r=>{this.off(t,s),e(r)};this.on(t,s)}off(t,e){const s=this.events[t];if(s){const t=s.indexOf(e);-1!==t&&s.splice(t,1)}}emit(t,e){const s=this.events[t];s&&s.forEach((t=>{t(e)}))}clear(t){t?delete this.events[t]:this.events={}}setMaxListener(t,e){this.maxListeners=e}removeAllListeners(t){t?this.events[t]=[]:this.events={}}}const es=()=>new ts;let ss=class{constructor(t,e=!0){this.#n(),this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}#n(){return this.__FavIcon__=document.querySelector("link[rel*='icon']")||document?.createElement("link"),this.__FavIcon__.type="image/x-icon",this.__FavIcon__.rel="shortcut icon",this}set(t){return t!==this.__FavIcon__.href&&(this.__FavIcon__.href=t,this.cache.Emitter&&this.cache.Emitter.emit("ziko:favicon-changed")),this}get current(){return document.__FavIcon__.href}onChange(t){return this.cache.Emitter&&this.cache.Emitter.on("ziko:favicon-changed",t),this}useEventEmitter(){return this.cache.Emitter=es(),this}};const rs=(t,e)=>new ss(t,e);let is=class{constructor({viewport:t,charset:e,description:s,author:r,keywords:i}){this.document=globalThis?.document,this.meta={},this.init({viewport:t,charset:e,description:s,author:r,keywords:i})}init({viewport:t,charset:e,description:s,author:r,keywords:i}){t&&this.setViewport(t),e&&this.setCharset(e),s&&this.describe(s),r&&this.setAuthor(r),i&&this.setKeywords(i)}set(t,e){const s="charset"===(t=t.toLowerCase()),r=s?document.querySelector("meta[charset]"):document.querySelector(`meta[name=${t}]`);return this.meta=r??document?.createElement("meta"),s?this.meta.setAttribute("charset",e):(this.meta.setAttribute("name",t),this.meta.setAttribute("content",e)),r||this.document.head.append(this.meta),this}setCharset(t="utf-8"){return this.set("charset",t),this}describe(t){return this.set("description",t),this}setViewport(t="width=device-width, initial-scale=1.0"){return this.set("viewport",t),this}setKeywords(...t){return t=[...new Set(t)].join(", "),this.set("keywords",t),this}setAuthor(t){return this.set("author",t),this}};const ns=({viewport:t,charset:e,description:s,author:r,keywords:i})=>new is({viewport:t,charset:e,description:s,author:r,keywords:i});let as=class{constructor(t=document.title,e=!0){this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}useEventEmitter(){return this.cache.Emitter=es(),this}set(t){return t!==document.title&&(document.title=t,this.cache.Emitter&&this.cache.Emitter.emit("ziko:title-changed")),this}get current(){return document.title}onChange(t){return this.cache.Emitter&&this.cache.Emitter.on("ziko:title-changed",t),this}};const os=(t,e)=>new as(t,e);let hs=class{constructor({title:t,lang:e,icon:s,meta:r,noscript:i}){this.html=globalThis?.document?.documentElement,this.head=globalThis?.document?.head,t&&os(t),e&&this.setLang(e),s&&rs(s),r&&ns(r),i&&this.setNoScript()}setLang(t){this.html.setAttribute("lang",t)}setNoScript(t){}};const cs=({title:t,lang:e,icon:s,meta:r,noscript:i})=>new hs({title:t,lang:e,icon:s,meta:r,noscript:i});class ls{constructor(t=[],e=(()=>{})){this.mediaQueryRules=t,this.fallback=e,this.lastCalledCallback=null,this.init()}init(){this.mediaQueryRules.forEach((({query:t,callback:e})=>{const s=globalThis.matchMedia(t),r=()=>{const t=this.mediaQueryRules.some((({query:t})=>globalThis.matchMedia(t).matches));s.matches?(e(),this.lastCalledCallback=e):t||this.lastCalledCallback===this.fallback||(this.fallback(),this.lastCalledCallback=this.fallback)};r(),s.addListener(r)}))}}const us=(t,e)=>new ls(t,e);const ms={...ze,...Qe,...Object.freeze({__proto__:null,ZikoHead:hs,ZikoUseStyle:xe,useFavIcon:rs,useHead:cs,useMediaQuery:us,useMeta:ns,useStyle:ve,useSuccesifKeys:Je,useTitle:os})};class ps extends Ut{constructor(t,s="",{el_type:r="html",useDefaultStyle:i=!1}={}){if(super(),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);default:throw Error("Not supported")}else this.target=t.parentElement;e(this,Rt,Lt,we),Object.assign(this.cache,{name:s,isInteractive:[!0,!1][Math.floor(2*Math.random())],parent:null,isBody:!1,isRoot:!1,isHidden:!1,isFrozzen:!1,legacyParent:null,style:new ke({}),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.uuid=`${this.cache.name}-${dt.string(16)}`,this.ui_index=globalThis.__Ziko__.__CACHE__.get_ui_index(),this.cache.style.linkTo(this),i&&this.style({position:"relative",boxSizing:"border-box",margin:0,padding:0,width:"auto",height:"auto"}),this.items=[],globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this],t&&globalThis.__Ziko__.__Config__.default.render&&this?.render?.(),this.isInteractive()&&(this.setAttr("ziko-hydration-index",globalThis.__Ziko__.__HYDRATION__.index),globalThis.__Ziko__.__HYDRATION__.map.set(globalThis.__Ziko__.__HYDRATION__.index,(()=>this)),globalThis.__Ziko__.__HYDRATION__.increment())}get element(){return this.cache.element}isInteractive(){return this.cache.isInteractive}isZikoUIElement(){return!0}register(){return 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}clone(t=!1){const e=new this.constructor;if(e.__proto__=this.__proto__,this.items.length){const t=[...this.items].map((t=>t.clone()));e.append(...t)}else e.element=this.element.cloneNode(!0);return e.render(t)}style(t){return t instanceof xe?this.st.style(t.current):this.st.style(t),this}size(t,e){return this.st.size(t,e),this}[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})}filter(t,e=(()=>{}),s=(()=>{})){const r=this.items.filter(t);return r.forEach(e),this.items.filter((t=>!r.includes(t))).forEach(s),this}filterByTextContent(t,e=!1){this.items.forEach((t=>t.render())),this.filter((s=>!(e?s.text===t:s.text.includes(t))),(t=>t.unrender()))}filterByClass(t){return this.items.map((t=>t.render())),this.items.filter((e=>!e.classes.includes(t))).map((t=>t.unrender())),this}sortByTextContent(t,e){let s=this.children;return s.filter((e=>!e.textContent.toLowerCase().includes(t.toLowerCase()))).map((t=>{t.style.display="none"})),s.filter((e=>e.textContent.toLowerCase().includes(t.toLowerCase()))).map(((t,s)=>t.style.display=e[s])),s.filter((t=>"none"!=t.style.display)),this}get#a(){const t=globalThis.getComputedStyle(this.element),e={};return"0px"!==t.marginRight&&Object.assign(e,{marginLeft:t.marginRight}),"0px"!==t.marginLeft&&Object.assign(e,{marginRight:t.marginLeft}),"0px"!==t.paddingRight&&Object.assign(e,{paddingLeft:t.paddingRight}),"0px"!==t.paddingLeft&&Object.assign(e,{paddingRight:t.paddingLeft}),"0px"!==t.left&&Object.assign(e,{right:t.left}),"0px"!==t.right&&Object.assign(e,{left:t.right}),"right"===t.textAlign&&Object.assign(e,{textAlign:"left"}),"left"===t.textAlign&&Object.assign(e,{textAlign:"right"}),"right"===t.float&&Object.assign(e,{float:"left"}),"left"===t.float&&Object.assign(e,{float:"right"}),"0px"!==t.borderRadiusLeft&&Object.assign(e,{right:t.borderRadiusRight}),"0px"!==t.borderRadiusRight&&Object.assign(e,{right:t.borderRadiusLeft}),["flex","inline-flex"].includes(t.display)&&("flex-end"===t.justifyContent&&Object.assign(e,{justifyContent:"flex-start"}),"flex-start"===t.justifyContent&&Object.assign(e,{justifyContent:"flex-end"})),e}useRtl(t=!1){return t?this.style({...this.#a,direction:"rtl"}):this.style({direction:"rtl"}),this}useLtr(t=!1){return t?this.style({...this.#a,direction:"ltr"}):this.style({direction:"ltr"}),this}freeze(t){return this.cache.isFrozzen=t,this}setTarget(t){if(!this.isBody)return t?.isZikoUIElement&&(t=t.element),this.unrender(),this.target=t,this.render(),this}describe(t){t&&this.setAttr("aria-label",t)}animate(t,{duration:e=1e3,iterations:s=1,easing:r="ease"}={}){return this.element?.animate(t,{duration:e,iterations:s,easing:r}),this}#o(t,e){"svg"!==this.element.tagName&&(t=bn.isCamelCase(t)?bn.camel2hyphencase(t):t),this?.attr[t]&&this?.attr[t]===e||(this.element.setAttribute(t,e),Object.assign(this.cache.attributes,{[t]:e}))}setAttr(t,e){if(t instanceof Object){const[s,r]=[Object.keys(t),Object.values(t)];for(let t=0;t<s.length;t++)r[t]instanceof Array&&(e[t]=r[t].join(" ")),this.#o(s[t],r[t])}else e instanceof Array&&(e=e.join(" ")),this.#o(t,e);return this}removeAttr(...t){for(let e=0;e<t.length;e++)this.element?.removeAttribute(t[e]);return this}getAttr(t){return t=bn.isCamelCase(t)?bn.camel2hyphencase(t):t,this.element.attributes[t].value}setContentEditable(t=!0){return this.setAttr("contenteditable",t),this}get children(){return[...this.element.children]}get cloneElement(){return this.element.cloneNode(!0)}setClasses(...t){return this.setAttr("class",t.join(" ")),this}get classes(){const t=this.element.getAttribute("class");return null===t?[]:t.split(" ")}addClass(){}setId(t){return this.setAttr("id",t),this}get id(){return this.element.getAttribute("id")}onSwipe(t,e,...s){return this.events.swipe||(this.events.swipe=Pe(this,t,e)),this.events.swipe.onSwipe(...s),this}on(t,...e){return this.events.custom||(this.events.custom=Re(this)),this.events.custom.on(t,...e),this}emit(t,e={}){return this.events.custom||(this.events.custom=Re(this)),this.events.custom.emit(t,e),this}watchAttr(t){return this.observer.attr||(this.observer.attr=Be(this,t)),this}watchChildren(t){return this.observer.children||(this.observer.children=Ve(this,t)),this}watchSize(t){return this.observer.resize||(this.observer.resize=Ge(this,t)),this.observer.resize.start(),this}watchIntersection(t,e){return this.observer.intersection||(this.observer.intersection=We(this,t,e)),this.observer.intersection.start(),this}}class ds extends ps{constructor(t,e,s,...r){super(t,e),this.addValue(...r),this.style({margin:0,padding:0}),Object.assign(this.cache,{lineBreak:s})}get isText(){return!0}get value(){return this.element.textContent}clear(){return this.element.childNodes.forEach((t=>t.remove())),this.element.textContent="",this}addValue(...t){return t.forEach(((t,e)=>{"string"==typeof t||"number"==typeof t?this.element?.appendChild(globalThis?.document.createTextNode(t)):t instanceof ps?this.element?.appendChild(t.element):t instanceof Mn||t instanceof kn?this.element?.appendChild(new Text(t.toString())):t instanceof Array?this.element?.appendChild(new Text(un(t))):t instanceof Object&&this.element?.appendChild(new Text(cn(t))),this.cache.lineBreak&&this.element?.appendChild(globalThis.document?.createElement("br"))})),this}setValue(...t){return this.clear(),this.addValue(...t),this}}class fs extends ds{constructor(...t){super("span","text",!1,...t)}}class gs extends ds{constructor(...t){super("q","quote",!1,...t),this.style({fontStyle:"italic"})}get isQuote(){return!0}}class bs extends ds{constructor(...t){super("dfn","dfnText",!1,...t)}get isDfnText(){return!0}}class ys extends ds{constructor(t){super("sup","supText",!1,t)}get isSupText(){return!0}}class ws extends ds{constructor(...t){super("sub","subText",!1,...t)}get isSubText(){return!0}}class xs extends ds{constructor(...t){super("code","codeText",!1,...t)}get isCodeText(){return!0}}class vs extends ds{constructor(t,e){super("abbr","abbrText",!1,t),this.setAttr("title",e)}get isAbbrText(){return!0}}const _s=(...t)=>new fs(...t),ks=(...t)=>new gs(...t),Is=(...t)=>new bs(...t),Es=(...t)=>new ys(...t),Ts=(...t)=>new ws(...t),As=(...t)=>new xs(...t),Cs=(t,e)=>new vs(t,e);class Ms extends ds{constructor(...t){super("p","p",!0,...t)}get isPara(){return!0}}class Os extends ds{constructor(t,e){super("blockquote","blockquote",!0,e),this.setAttr("cite",t)}get isBlockQuote(){return!0}}const Ss=(...t)=>new Ms(...t),js=(t,e)=>new Os(t,e);class Zs extends ps{constructor(t=1,e=""){super(`h${t}`,`h${t}`),this.element.textContent=e}get isHeading(){return!0}get value(){return this.element.innerText}setValue(t=""){this.element.innerText=t}addValue(t=""){return this.element.innerText+=t,this}}const Us=(t="")=>new Zs(1,t),Rs=(t="")=>new Zs(2,t),Ds=(t="")=>new Zs(3,t),Ls=(t="")=>new Zs(4,t),Ps=(t="")=>new Zs(5,t),zs=(t="")=>new Zs(6,t);var Fs=Object.freeze({__proto__:null,ZikoUIAbbrText:vs,ZikoUIBlockQuote:Os,ZikoUICodeText:xs,ZikoUIDefintion:bs,ZikoUIHeading:Zs,ZikoUIParagraphe:Ms,ZikoUIQuote:gs,ZikoUISubText:ws,ZikoUISupText:ys,ZikoUIText:fs,abbrText:Cs,blockQuote:js,codeText:As,dfnText:Is,h1:Us,h2:Rs,h3:Ds,h4:Ls,h5:Ps,h6:zs,p:Ss,quote:ks,subText:Ts,supText:Es,text:_s});class Hs extends ps{constructor(t){super("li","li"),this.append(t)}get isLi(){return!0}}class Ns extends ps{constructor(t,e){super(t,e),delete this.append,this.style({listStylePosition:"inside"})}get isList(){return!0}append(...t){for(let e=0;e<t.length;e++){let s=null;["string","number"].includes(typeof t[e])&&(t[e]=_s(t[e])),t[e]instanceof ps&&(s=new Hs(t[e])),s.setTarget(this.element),this.items.push(s[0]),this.maintain()}}remove(...t){if(0==t.length)this.target.children.length&&this.target.removeChild(this.element);else{const e=t=>{"number"==typeof t&&(t=this.items[t]),t instanceof ps&&this.element?.removeChild(t.parent.element),this.items=this.items.filter((e=>e!==t))};for(let s=0;s<t.length;s++)e(t[s]);for(let t=0;t<this.items.length;t++)Object.assign(this,{[[t]]:this.items[t]})}return this}insertAt(t,...e){if(t>=this.element.children.length)this.append(...e);else for(let s=0;s<e.length;s++){let r=null;["number","string"].includes(typeof e[s])&&(e[s]=_s(e[s])),e[s]instanceof ps&&(r=new Hs(e[s])),this.element?.insertBefore(r.element,this.items[t].parent.element),this.items.splice(t,0,e[s][0])}return this}filterByTextContent(t,e=!1){return this.items.map((t=>t.parent.render())),this.items.filter((s=>{const r=s.element.textContent;return!(e?r===t:r.includes(t))})).map((t=>t.parent.render(!1))),this}sortByTextContent(t=1){return this.items.map((t=>t.parent.render(!1))),this.sortedItems=this.items.sort(((e,s)=>t*e.element.textContent.localeCompare(s.element.textContent))),this.append(...this.sortedItems),this}filterByClass(t){return this.items.map((t=>t.parent.render(!0))),this.items.filter((e=>!e.Classes.includes(t))).map((t=>t.parent.render(!1))),this}delete(t){return[...this.element.children].indexOf(t)}push(){}pop(){}unshift(){}shift(){}sort(){}filter(){}slice(){}}class Bs extends Ns{constructor(...t){super("ol","ol"),this.append(...t)}get isOl(){return!0}type(t=1){return this.element?.setAttribute("type",t),this}start(t=1){return this.element?.setAttribute("start",t),this}}class $s extends Ns{constructor(...t){super("ul","ul"),this.append(...t)}get isUl(){return!0}}const Vs=t=>new Hs(t),qs=(...t)=>new Bs(...t),Ws=(...t)=>new $s(...t);var Ys=Object.freeze({__proto__:null,li:Vs,ol:qs,ul:Ws});class Gs extends ps{constructor(t,e,s="",r){super("input","input"),Object.assign(this.events,{input:null}),this.setValue(s),this.setAttr("type",t),this.setAttr("name",e),r&&this.linkDatalist(r)}get isInput(){return!0}setName(t){return this.setAttr("name",t),this}onInput(...t){return this.events.input||(this.events.input=Me(this)),this.events.input.onInput(...t),this}onChange(...t){return this.events.input||(this.events.input=Me(this)),this.events.input.onChange(...t),this}linkDatalist(t){let e;if(t instanceof ZikoUIInputDatalist)e=t.Id;else if(t instanceof Array){const s=new ZikoUIInputDatalist(...t);e=s.Id,console.log(s)}else e=t;return this.element?.setAttribute("list",e),this}get value(){return this.element.value}setValue(t=""){return this.element.value=t,this}useState(t){return this.setValue(t),[{value:this.value},t=>this.setValue(t)]}setPlaceholder(t){return t&&(this.element.placeholder=t),this}get isValide(){return this.element.checkValidity()}setRequired(t=!0){return this.element.required=t,this}select(){return this.element.select(),this}copy(){return this.element.select(),document.execCommand("copy"),this}cut(){return this.element.select(),document.execCommand("cut"),this}accept(t){return this.element.accept=t,this}}const Xs=(t,e)=>{if(t instanceof Object){const{datalist:e,placeholder:s}=t;return t=t.value??"",new Gs("text","input",t,e).setPlaceholder(s)}return new Gs("text","input",t,e)};class Ks extends Gs{constructor(t,e,s=1){super("number","inpuNumber"),this.setMin(t).setMax(e).setStep(s)}get isInputNumber(){return!0}get value(){return+this.element.value}setMin(t){return this.element.min=t,this}setMax(t){return this.element.max=t,this}setStep(t){return this.element.step=t,this}}const Qs=(t,e,s)=>{if(t instanceof Object){const{value:e,max:s=10,step:r=1,placeholder:i=""}=t;return t=t?.min??0,new ZikoUIInputSlider(t,s,r).setValue(e).setPlaceholder(i)}return new Ks(t,e,s)};let Js=class extends Gs{constructor(t=0,e=0,s=10,r=1){super("range","inputSlider"),this.setMin(e).setMax(s).setValue(t).setStep(r)}get isInputSlider(){return!0}setMin(t){return this.element.min=t,this}setMax(t){return this.element.max=t,this}setStep(t){return this.element.step=t,this}};const tr=(t,e,s,r)=>{if(t instanceof Object){const{min:e=0,max:s=10,step:r=1}=t;return new Js(t=t?.value??5,e,s,r)}return new Js(t,e,s,r)};class er extends Gs{constructor(){super("color","inputColor"),this.background(this.value),this.onInput((()=>this.background(this.value)))}get isInputColor(){return!0}}const sr=()=>new er;class rr extends Gs{constructor(){super("search","inputSearch"),this.Length=0}get isInputSearch(){return!0}onsearch(t){return this.element?.addEventListener("search",(()=>t())),this}connect(...t){return this}displayLength(t){return this.element?.addEventListener("keyup",(()=>t.setValue(this.Length))),this}}const ir=(...t)=>(new rr).connect(...t);class nr extends Gs{constructor(){super("checkbox","inputCheckbox"),this.cursor("pointer")}get isInputCheckbox(){return!0}get checked(){return this.element.checked}check(t=!0){return this.element.checked=t,this}color(t){return this.element.style.accentColor=t,this}}const ar=()=>new nr;class or extends Gs{constructor(){super("radio","inputRadio"),this.cursor("pointer")}get isInputRadio(){return!0}get checked(){return this.element.checked}check(t=!0){return this.element.checked=t,this}color(t){return this.element.style.accentColor=t,this}}const hr=()=>new or;class cr extends Gs{constructor(){super("email","inputEmail")}get isInputEmail(){return!0}}const lr=()=>new cr;class ur extends Gs{constructor(){super("password","inputPassword")}get isInputPassword(){return!0}}const mr=()=>new ur;class pr extends Gs{constructor(){super("date","inputDate")}get isInputDate(){return!0}}const dr=()=>new pr;class fr extends Gs{constructor(){super("time","inputTime")}get isInputTime(){return!0}}const gr=()=>new fr;class br extends Gs{constructor(){super("datetime-local","inputDateTime")}get isInputDateTime(){return!0}}const yr=()=>new br;class wr extends ps{constructor(t,e){super("div",""),this.element.append("svg"===e?function(t){if(globalThis?.DOMParser){return(new DOMParser).parseFromString(t.replace(/\s+/g," ").trim(),"image/svg+xml").documentElement}}(t):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))}}class xr extends wr{constructor(t){super(t,"html")}}class vr extends wr{constructor(t){super(t,"svg")}}const _r=t=>new xr(t),kr=t=>new vr(t);class Ir extends ps{constructor(t,e){super("div","suspense"),this.setAttr({dataTemp:"suspense"}),this.fallback_ui=t,this.append(t),(async()=>{try{const s=await e();t.unrender(),this.append(s)}catch(t){console.log({error:t})}})()}}const Er=(t,e)=>new Ir(t,e),Tr=(t,e,s,...r)=>{const{name:i,style:n,...a}=s;let o=new ps(t,i,e);return n&&o.style(n),a&&o.setAttr(a),r&&o.append(...r),o},Ar=(t,e={},...s)=>Tr(t,"html",e,...s),Cr=(t,e={},...s)=>Tr(t,"svg",e,...s),Mr=["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","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"].reduce(((t,e)=>(t[e]=(t,...s)=>Ar(e,t,...s),t)),{}),Or=["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"].reduce(((t,e)=>(t[e]=(t,...s)=>Ar(e,t,...s),t)),{});class Sr extends ps{constructor(t){super(t,"html")}}class jr extends ps{constructor(t="button"){super("button","btn"),this.setValue(t),this.st.cursor("pointer"),globalThis.__Ziko__.__Config__.default.render&&this.render()}get isBtn(){return!0}setValue(t){return t instanceof ps?t.setTarget(this.element):(this.element?.appendChild(document.createTextNode("")),this.element.childNodes[0].data=t),this}get value(){return this.element.innerText}toggleValues(...t){let e=(t=t.map((t=>""+t))).indexOf(""+this.value);return-1!=e&&e!=t.length-1?this.setValue(t[e+1]):this.setValue(t[0]),this}}class Zr extends ps{constructor(){super("br","br")}get isBr(){return!0}}class Ur extends ps{constructor(){super("hr","hr"),this.setAttr("role","none")}get isHr(){return!0}}class Rr extends ps{constructor(t){super("a","link"),Object.assign(this.cache,{defaultStyle:{color:"#0275d8",textDecoration:"none"},hoverStyle:{color:"#01447e",textDecoration:"underline"}}),this.setHref(t),this.style(this.cache.defaultStyle),this.onPtrEnter((()=>this.style(this.cache.hoverStyle))),this.onPtrLeave((()=>this.style(this.cache.defaultStyle)))}setHref(t){this.element.href=t}get isLink(){return!0}}const Dr=()=>new Zr,Lr=()=>new Ur,Pr=(t=1)=>new Array(t).fill(new Zr),zr=(t=1)=>new Array(t).fill(new Ur),Fr=(t,...e)=>new Rr(t).append(...e),Hr=(t,...e)=>new Sr(t).append(...e),Nr=t=>new jr(t);var Br=Object.freeze({__proto__:null,HTMLWrapper:_r,SVGWrapper:kr,Suspense:Er,ZikoUIBr:Zr,ZikoUIHTMLWrapper:xr,ZikoUIHr:Ur,ZikoUIHtmlTag:Sr,ZikoUILink:Rr,ZikoUISVGWrapper:vr,ZikoUISuspense:Ir,ZikoUIXMLWrapper:wr,br:Dr,brs:Pr,btn:Nr,h:Ar,hTags:Mr,hr:Lr,hrs:zr,html:Hr,link:Fr,s:Cr,sTags:Or});class $r extends ps{constructor(t="File"){super("inputImage"),this._aux_element=Nr(t).setTarget(this.target),this.element=document?.createElement("input"),this.element?.setAttribute("type","file"),this.element?.setAttribute("accept","image"),this._aux_element.onClick((()=>this.element.click())),this.element.onChange=this.handleImage.bind(this)}get isInputImage(){return!0}handleImage(t){const e=new FileReader,s=new Image;e.onload=function(t){s.src=t.target.result,console.log(s.src)},e.readAsDataURL(t.target.files[0]),this.img=s}get value(){return this.img}render(t=!0){return t?this.target.appendChild(this._aux_element.element):this.remove(),this}remove(){return this.target.children.length&&this.target.removeChild(this._aux_element.element),this}}const Vr=t=>new $r(t);class qr extends ps{constructor(t,e,s,r){super("img","image"),this.value=t,"IMG"===t.nodeName?this.element.setAttribute("src",t.src):this.element?.setAttribute("src",t),"number"==typeof s&&(s+="%"),"number"==typeof r&&(r+="%"),this.setAttr("alt",e),this.style({border:"1px solid black",width:s,height:r})}get isImg(){return!0}updateSrc(t){return this.value=t,this.element.src=t,this}toggleSrc(...t){let e=(t=t.map((t=>""+t))).indexOf(""+this.value);return-1!=e&&e!=t.length-1?this.updateSrc(t[e+1]):this.updateSrc(t[0]),this}alt(t){return this.element.alt=t,this}}const Wr=(t,e,s,r)=>new qr(t,e,s,r);class Yr extends ps{constructor(t,e){super("figure","figure"),this.img=t.width("100%").element,this.caption=document?.createElement("figcaption"),this.caption.append(e.element),this.element?.append(this.img),this.element?.append(this.caption)}get isFigure(){return!0}}const Gr=(t,e)=>new Yr(t,e);class Xr extends ps{constructor(t,e){super(t,e),this.useControls()}get t(){return this.element.currentTime}useControls(t=!0){return this.element.controls=t,this}enableControls(){return this.element.controls=!0,this}disableControls(){return this.element.controls=!0,this}toggleControls(){return this.element.controls=!this.element.controls,this}play(){return this.element.play(),this}pause(){return this.element.pause(),this}seekTo(t){return this.element.currentTime=t,this}onPlay(){}onPause(){}}class Kr extends Xr{constructor(t="",e="100%",s="50vh"){super("video","video"),"VIDEO"===t.nodeName?this.element?.setAttribute("src",t.src):this.element?.setAttribute("src",t),"number"==typeof e&&(e+="%"),"number"==typeof s&&(s+="%"),this.style({width:e,height:s})}get isVideo(){return!0}usePoster(t=""){return this.element.poster=t,this}usePIP(t){return this.element.requestPictureInPicture(t),this}}const Qr=(t,e,s)=>new Kr(t,e,s);class Jr extends Xr{constructor(t){super("audio","audio"),this.element?.setAttribute("src",t),this.size("150px","30px")}get isAudio(){return!0}}const ti=t=>new Jr(t);var ei=Object.freeze({__proto__:null,ZikoUIAudio:Jr,ZikoUIFigure:Yr,ZikoUIImage:qr,ZikoUIVideo:Kr,audio:ti,figure:Gr,image:Wr,video:Qr});class si extends Kr{constructor(){super(),this.element?.setAttribute("src",""),this.constraints={audio:!0,video:{width:1280,height:720}}}get isInputCamera(){return!0}start(){return navigator.mediaDevices.getUserMedia(this.constraints).then((t=>{this.element.srcObject=t,this.element.onloadedmetadata=()=>{this.element.play()}})).catch((function(t){console.log(t.name+": "+t.message)})),this}}const ri=()=>new si;class ii extends ps{constructor(){super(),this.element=document?.createElement("label")}get isLabel(){return!0}}class ni extends ps{constructor(t=""){super(),this.element=document?.createElement("option"),t instanceof Object&&"value"in t?(this.setValue(t.value),this.setText(t?.text??t.value)):this.setValue(t)}setValue(t=""){return this.element.value=t,this}setText(t=""){return t&&(this.element.textContent=t),this}}let ai=class extends ps{constructor(...t){super(),this.element=document?.createElement("datalist"),this.addOptions(...t).setId("ziko-datalist-id"+dt.string(10))}get isDatalist(){return!0}addOptions(...t){return t.map((t=>this.append(new ni(t)))),this}};const oi=(...t)=>new ai(...t);class hi extends ps{constructor(){super(),this.element=document?.createElement("select")}addOptions(...t){return t.map((t=>this.append(new ni(t)))),this}get isSelect(){return!0}}const ci=()=>new hi;class li extends ps{constructor(){super(),this.element=document?.createElement("textarea")}get value(){return this.element.textContent}get isTextArea(){return!0}}const ui=()=>new li;class mi extends ps{constructor(t="div",e="100%",s="100%"){super(t,"Flex"),this.direction="cols","number"==typeof e&&(e+="%"),"number"==typeof s&&(s+="%"),this.style({width:e,height:s}),this.style({display:"flex"})}get isFlex(){return!0}resp(t,e=!0){return this.wrap(e),this.element.clientWidth<t?this.vertical():this.horizontal(),this}setSpaceAround(){return this.style({justifyContent:"space-around"}),this}setSpaceBetween(){return this.style({justifyContent:"space-between"}),this}setBaseline(){return this.style({alignItems:"baseline"}),this}gap(t){return"row"===this.direction?this.style({columnGap:t}):"column"===this.direction&&this.style({rowGap:t}),this}wrap(t="wrap"){return this.style({flexWrap:"string"==typeof t?t:["no-wrap","wrap","wrap-reverse"][+t]}),this}_justifyContent(t="center"){return this.style({justifyContent:t}),this}vertical(t,e,s=1){return di.call(this,s),this.style({alignItems:"number"==typeof t?gi.call(this,t):t,justifyContent:"number"==typeof e?bi.call(this,e):e}),this}horizontal(t,e,s=1){return fi.call(this,s),this.style({alignItems:"number"==typeof e?bi.call(this,e):e,justifyContent:"number"==typeof t?gi.call(this,t):t}),this}show(){return this.isHidden=!1,this.style({display:"flex"}),this}}const pi=(...t)=>{let e="div";return"string"==typeof t[0]&&(e=t[0],t.pop()),new mi(e).append(...t)};function di(t){return 1==t?this.style({flexDirection:"column"}):-1==t&&this.style({flexDirection:"column-reverse"}),this}function fi(t){return 1==t?this.style({flexDirection:"row"}):-1==t&&this.style({flexDirection:"row-reverse"}),this}function gi(t){return"number"==typeof t&&(t=["flex-start","center","flex-end"][t+1]),t}function bi(t){return gi(-t)}var yi=Object.freeze({__proto__:null,Flex:pi,ZikoUIFlex:mi});class wi extends mi{constructor(...t){super("form","Form"),this.append(...t),this.setMethod("POST"),this.setAction("/")}setAction(t="/"){return this.setAttr("action",t),this}setMethod(t="post"){return this.setAttr("method",t),this}get data(){let t=new FormData(this.element);return this.items.forEach((e=>{(e.isInput||e.isSelect||e.isTextarea)&&t.append(e.element.name,e.value)})),t}sendFormData(){return fetch(this.element.action,{method:this.element.method,body:this.data}).then((t=>t.json())).then((t=>console.log(t))).catch((t=>console.error("Error:",t))),this}getByName(t){return this.data.get(t)}}const xi=(...t)=>new wi(...t);var vi=Object.freeze({__proto__:null,Form:xi,ZikoUIForm:wi,ZikoUIInput:Gs,ZikoUIInputCheckbox:nr,ZikoUIInputColor:er,ZikoUIInputDatalist:ai,ZikoUIInputDate:pr,ZikoUIInputDateTime:br,ZikoUIInputEmail:cr,ZikoUIInputImage:$r,ZikoUIInputNumber:Ks,ZikoUIInputOption:ni,ZikoUIInputPassword:ur,ZikoUIInputRadio:or,ZikoUIInputSearch:rr,ZikoUIInputSlider:Js,ZikoUIInputTime:fr,ZikoUILabel:ii,ZikoUISelect:hi,ZikoUITextArea:li,checkbox:ar,datalist:oi,input:Xs,inputCamera:ri,inputColor:sr,inputDate:dr,inputDateTime:yr,inputEmail:lr,inputImage:Vr,inputNumber:Qs,inputPassword:mr,inputTime:gr,radio:hr,search:ir,select:ci,slider:tr,textarea:ui});class _i extends ps{constructor(...t){super(),this.element=document?.createElement("Tr"),this.append(...t)}}class ki extends ps{constructor(...t){super(),this.element=document?.createElement("Td"),this.append(...t)}}class Ii extends ps{constructor(...t){super(),this.element=document?.createElement("Thead"),this.append(...t)}}class Ei extends ps{constructor(...t){super(),this.element=document?.createElement("Tbody"),this.append(...t)}}class Ti extends ps{constructor(t){super(),this.element=document?.createElement("Caption"),this.append(t)}}const Ai=(...t)=>(t=t.map((t=>(t instanceof ps||(t=_s(t)),t))),new ki(...t)),Ci=t=>new Ti(t),Mi=t=>{var e=new Array(t.rows).fill(null).map((()=>((...t)=>new _i(...t))())),s=t.arr.map((t=>t.map((()=>null))));for(let r=0;r<s.length;r++)for(let i=0;i<s[0].length;i++)s[r][i]=Ai(t.arr[r][i]),e[r].append(s[r][i]);return e};class Oi extends ps{constructor(t,{caption:e=null,head:s=null,foot:r=null}={}){super("table","Table"),this.structure={caption:e,head:s,body:null,foot:r},t&&this.fromMatrix(t),e&&this.setCaption(e)}get isTable(){return!0}get caption(){return this.structure.caption}get header(){}get body(){}get footer(){}setCaption(t){return this.removeCaption(),this.structure.caption=Ci(t),this.append(this.structure.caption),this}removeCaption(){return this.structure.caption&&this.removeItem(...this.items.filter((t=>t instanceof Ti))),this.structure.caption=null,this}setHeader(...t){return this.tHead=((...t)=>(t=t.map((t=>(t instanceof ps||(t=Ai(t)),t))),new Ii(...UI)))(...t),this.append(this.tHead),this}removeHeader(){return this.removeItem(...this.items.filter((t=>t instanceof Ti))),this}setFooter(t){return this.structure.caption=Ci(t),this.append(this.structure.caption),this}removeFooter(){return this.removeItem(...this.items.filter((t=>t instanceof Ti))),this}fromMatrix(t){return this.bodyMatrix=t instanceof Array?In(t):t,this.structure.body&&this.remove(this.structure.body),this.structure.body=((...t)=>new Ei(...t))(),this.append(this.structure.body),this.structure.body.append(...Mi(this.bodyMatrix)),this}transpose(){return this.fromMatrix(this.bodyMatrix.T),this}hstack(t){return t instanceof Oi&&(t=t.bodyMatrix),this.fromMatrix(this.bodyMatrix.clone.hstack(t)),this}vstack(t){return t instanceof Oi&&(t=t.bodyMatrix),this.fromMatrix(this.bodyMatrix.clone.vstack(t)),this}slice(t=0,e=0,s=this.bodyMatrix.rows-1,r=this.bodyMatrix.cols-1){return this.fromMatrix(this.bodyMatrix.slice(t,e,s,r)),this}sortByCols(t,e={type:"num",order:"asc"}){return this.fromMatrix(this.bodyMatrix.clone.sortTable(t,e)),this}sortByRows(t,e={type:"num",order:"asc"}){return this.fromMatrix(this.bodyMatrix.T.clone.sortTable(t,e).T),this}filterByRows(t){return this.fromMatrix(this.bodyMatrix.clone.filterByRows(t)),this}filterByCols(t){return this.fromMatrix(this.bodyMatrix.clone.filterByCols(t)),this}forEachRow(t){return this.structure.body.forEach(t),this}forEachItem(t){return this.structure.body.forEach((e=>e.forEach(t))),this}}const Si=(t,e)=>new Oi(t,e);var ji=Object.freeze({__proto__:null,Table:Si});const Zi=["Main","Header","Nav","Section","Article","Aside","Footer"],Ui={},Ri={};for(let t=0;t<Zi.length;t++)Ui[`ZikoUI${Zi[t]}`]=class extends ps{constructor(){super(Zi[t].toLowerCase()),this.style({position:"relative"})}get[`is${Zi[t]}`](){return!0}},Ri[Zi[t]]=(...e)=>(new Ui[`ZikoUI${Zi[t]}`]).append(...e);const{Main:Di,Header:Li,Nav:Pi,Section:zi,Article:Fi,Aside:Hi,Footer:Ni}=Ri,{ZikoUIMain:Bi,ZikoUIHeader:$i,ZikoUINav:Vi,ZikoUISection:qi,ZikoUIArticle:Wi,ZikoUIAside:Yi,ZikoUIFooter:Gi}=Ui;var Xi=Object.freeze({__proto__:null,Article:Fi,Aside:Hi,Footer:Ni,Header:Li,Main:Di,Nav:Pi,Section:zi,ZikoUIArticle:Wi,ZikoUIAside:Yi,ZikoUIFooter:Gi,ZikoUIHeader:$i,ZikoUIMain:Bi,ZikoUINav:Vi,ZikoUISection:qi});class Ki extends ps{constructor(t="div",e="50vw",s="50vh"){super(t,"Grid"),this.direction="cols","number"==typeof e&&(e+="%"),"number"==typeof s&&(s+="%"),this.style({border:"1px solid black",width:e,height:s}),this.style({display:"grid"})}get isGird(){return!0}columns(t){let e="";for(let s=0;s<t;s++)e=e.concat(" auto");return this.#h(e),this}#h(t="auto auto"){return this.style({gridTemplateColumns:t}),this}gap(t=10,e=t){return"number"==typeof t&&(t+="px"),"number"==typeof e&&(e+="px"),this.style({gridColumnGap:t,gridRowGap:e}),this}}const Qi=(...t)=>new Ki("div").append(...t);var Ji=Object.freeze({__proto__:null,Grid:Qi,ZikoUIGrid:Ki});const tn=["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","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"],en=["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"],sn=new Proxy({},{get(t,e){if("string"!=typeof e)return;let s=e.replaceAll("_","-").toLowerCase();return tn.includes(s)?(...t)=>{if(!(t[0]instanceof ps)&&t[0]instanceof Object){let e=t.shift();return console.log(t),new ps(s).setAttr(e).append(...t)}return new ps(s).append(...t)}:en.includes(s)?(...t)=>new ps(s,"",{el_type:"svg"}).append(...t):(...t)=>{if(!(t[0]instanceof ps)&&t[0]instanceof Object){let e=t.shift();return new ps(s).setAttr(e).append(...t)}return new ps(s).append(...t)}}}),rn={...Fs,...Ys,...vi,...ei,...ji,...Xi,...Br,...yi,...Ji,ZikoUIElement:ps},nn=t=>(new XMLSerializer).serializeToString(t),an=t=>btoa(nn(t)),on=t=>"data:image/svg+xml;base64,"+an(t),hn=(t,e=!0)=>Wr(on(t)).render(e),cn=t=>JSON.stringify(I((t=>["number","string","boolean","bigint"].includes(typeof t)?String(t):t instanceof Mn||t instanceof kn?t.toString():t instanceof Array?un(t):void 0),t),null," ").replace(/"([^"]+)":/g,"$1:").replace(/: "([^"]+)"/g,": $1"),ln=t=>{if(!Array.isArray(t))return 0;let e=1;for(const s of t)if(Array.isArray(s)){const t=ln(s);t+1>e&&(e=t+1)}return e},un=t=>{let e=0;return function t(s){let r=ln(s),i=0;return s.some((t=>Array.isArray(t)))&&(e++,i=1),"["+s.map(((r,i)=>["number","string","boolean","bigint"].includes(typeof r)?String(r):r instanceof Mn?r.toString():r instanceof Array?`\n${" ".repeat(e)}${t(r)}${i===s.length-1?"\n":""}`:r instanceof Object?cn(r):void 0))+`${" ".repeat((r+e+1)*i)}]`}(t)},mn=(t,e=0)=>{t=pn(t);let s="";const r=" ".repeat(e);for(let i in t)if("object"==typeof t[i]){s+=`${r}${i} {\n`;const n=t[i];for(let t in n)"object"==typeof n[t]?s+=mn({[t]:n[t]},e+1):s+=`${r} ${t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}: ${n[t]};\n`;s+=`${r}}\n`}return s};function pn(t){return"object"!=typeof t||null===t?t:Object.keys(t).reduce(((e,s)=>(e[s.trim()]=pn(t[s]),e)),Array.isArray(t)?[]:{})}var dn=Object.freeze({__proto__:null,arr2str:un,csv2arr:yt,csv2json:vt,csv2matrix:wt,csv2object:xt,csv2sql:_t,json2arr:Et,json2css:mn,json2csv:Tt,json2csvFile:At,json2xml:jt,json2xmlFile:Zt,json2yml:Ot,json2ymlFile:St,obj2str:cn,svg2ascii:an,svg2img:hn,svg2imgUrl:on,svg2str:nn}),fn=Object.freeze({__proto__:null});const gn={isDigit:/^\d+$/,isURL:/^(https?:\/\/)?([\w\-]+\.)+[\w\-]+(\/[\w\-./?%&=]*)?$/,isHexColor:/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,isIPv4:/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,isMACAddress:/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/,isDate:/^\d{4}-\d{2}-\d{2}$/};class bn{constructor(t){this.string=t}isDigit(){return gn.isDigit.test(this.string)}static isDigit(t){return new bn(t).isDigit()}isNumber(){return!isNaN(this.string)}static isNumber(t){return new bn(t).isNumber()}isUrl(){return gn.isURL.test(this.string)}static isUrl(t){return new bn(t).isUrl()}isHexColor(){return gn.isHexColor.test(this.string)}static isHexColor(t){return new bn(t).isHexColor()}isIPv4(){return gn.isIPv4.test(this.string)}static isIPv4(t){return new bn(t).isIPv4()}isDate(){return gn.isDate.test(this.string)}static isDate(t){return new bn(t).isDate()}isMACAddress(){return gn.isMACAddress.test(this.string)}static isMACAddress(t){return new bn(t).isMACAddress()}isPascalCase(){if(0===this.string.length)return!1;return/^[A-Z][a-zA-Z0-9]*$/.test(this.string)}static isPascalCase(t){return new bn(t).isPascalCase()}isCamelCase(){if(0===this.string.length)return!1;return/^[a-z][a-zA-Z0-9]*$/.test(this.string)}static isCamelCase(t){return new bn(t).isCamelCase()}isHyphenCase(){return this.string.split("-").length>1}static isHyphenCase(t){return new bn(t).isHyphenCase()}isSnakeCase(){return this.string.split("_").length>1}static isSnakeCase(t){return new bn(t).isSnakeCase()}isPalindrome(){const t=this.string.toLocaleLowerCase();let e,s=t.length;for(e=0;e<s/2;e++)if(t[e]!=t[s-e-1])return!1;return!0}static isPalindrome(t){return new bn(t).isPalindrome()}static isAnagrams(t,e){return t=t.split("").sort(),e=e.split("").sort(),JSON.stringify(t)===JSON.stringify(e)}isIsogram(){return[...new Set(this.string.toLowerCase())].length===this.string.length}static isIsogram(t){return new bn(t).isIsogram()}static camel2hyphencase(t){return t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}static camel2snakecase(t){return t.replace(/[A-Z]/g,(t=>"_"+t.toLowerCase()))}static camel2pascalcase(t){return t.charAt(0).toUpperCase()+t.slice(1)}static camel2constantcase(t){return t.replace(/[A-Z]/g,(t=>"_"+t)).toUpperCase()}static pascal2snakecase(t){return t.replace(/([A-Z])/g,((t,e)=>e?"_"+t.toLowerCase():t.toLowerCase()))}static pascal2hyphencase(t){return t.replace(/([A-Z])/g,((t,e)=>e?"-"+t.toLowerCase():t.toLowerCase()))}static pascal2camelcase(t){return t.charAt(0).toLowerCase()+t.slice(1)}static pascal2constantcase(t){return t.replace(/([A-Z])/g,((t,e)=>e?"_"+t:t)).toUpperCase()}static snake2camelcase(t){return t.replace(/(_\w)/g,(t=>t[1].toUpperCase()))}static snake2hyphencase(t){return t.replace(/_/g,"-")}static snake2pascalcase(t){return t.split("_").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("")}static snake2constantcase(t){return t.toUpperCase()}static hyphen2camelcase(t){return t.replace(/-([a-z])/g,(t=>t[1].toUpperCase()))}static hyphen2snakecase(t){return t.replace(/-/g,"_")}static hyphen2pascalcase(t){return t.split("-").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("")}static hyphen2constantcase(t){return t.replace(/-/g,"_").toUpperCase()}static constant2camelcase(t){return t.toLowerCase().replace(/_([a-z])/g,(t=>t[1].toUpperCase()))}static constant2snakecase(t){return t.toLowerCase()}static constant2pascalcase(t){return t.toLowerCase().split("_").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("")}static constant2hyphencase(t){return t.toLowerCase().replace(/_/g,"-")}}const yn=t=>t.replace(/\s+/g," "),wn=(t,e)=>t.split("").filter((t=>t==e)).length,xn=(t,e)=>t.split(" ").filter((t=>t==e)).length,vn=t=>new bn(t);const _n={...bt,...dn,...fn,...Object.freeze({__proto__:null,Str:bn,count:wn,countWords:xn,removeExtraSpace:yn,str:vn})};class kn extends k{constructor(t,e,s=[]){if(super(),t instanceof kn)this.arr=t.arr,this.rows=t.rows,this.cols=t.cols;else{let r,i,n=[];if(arguments[0]instanceof Array)t=arguments[0].length,e=arguments[0][0].length,n=arguments[0];else for(r=0;r<t;r++)for(n.push([]),n[r].push(new Array(e)),i=0;i<e;i++)n[r][i]=s[r*e+i],null==s[r*e+i]&&(n[r][i]=0);this.rows=t,this.cols=e,this.arr=n}this.#c()}toString(){return un(this.arr)}at(t=0,e=void 0){return t<0&&(t=this.rows+t),null==e?this.arr[t]:(e<0&&(e=this.cols+e),this.arr[t][e])}reshape(t,e){if(t*e==this.rows*this.cols)return new kn(t,e,this.arr.flat(1));console.error("Err")}static eye(t){let e=new kn(t,t);for(let s=0;s<t;s++)for(let r=0;r<t;r++)e.arr[s][r]=s===r?1:0;return e}get clone(){return new kn(this.rows,this.cols,this.arr.flat(1))}get size(){return this.rows*this.cols}get shape(){return[this.rows,this.cols]}get reel(){return new kn(this.cols,this.rows,this.arr.flat(1).reel)}get imag(){return new kn(this.cols,this.rows,this.arr.flat(1).imag)}[Symbol.iterator](){return this.arr[Symbol.iterator]()}#c(){for(let t=0;t<this.arr.length;t++)Object.defineProperty(this,t,{value:this.arr[t],writable:!0,configurable:!0,enumerable:!1})}get(t=0,e=0){return-1==e?this.arr[t]:-1==t?this.arr.map((t=>t[e])):this.arr[t][e]}set(t=0,e=0,s){if(-1==e)return this.arr[t]=s;if(-1==t){for(let t=0;t<this.cols;t++)this.arr[t][e]=s[t]||0;return this.arr}return this.arr[t][e]=s}get isSquare(){return this.rows/this.cols==1}get isSym(){if(!this.isSquare)return!1;const t=this.T,e=this.clone;return 0==kn.sub(e,t).max&&0==kn.sub(e,t).min}get isAntiSym(){if(!this.isSquare)return!1;const t=this.T,e=this.clone;return 0==kn.add(e,t).max&&0==kn.add(e,t).min}get isDiag(){if(!this.isSquare)return!1;const t=this.T,e=this.clone,s=kn.mul(e,t),r=kn.dot(t,e);return 0==kn.sub(s,r).max&&0==kn.sub(s,r).min}get isOrtho(){return!!this.isSquare&&(this.isDiag&&(1==this.det||-1==this.det))}get isIdemp(){if(!this.isSquare)return!1;const t=this.clone,e=kn.dot(t,t);return 0==kn.sub(e,t).max&&0==kn.sub(e,t).min}get T(){let t=[];for(let e=0;e<this.arr[0].length;e++){t[e]=[];for(let s=0;s<this.arr.length;s++)t[e][s]=this.arr[s][e]}return new kn(this.cols,this.rows,t.flat(1))}get det(){if(!this.isSquare)return new Error("is not square matrix");if(1==this.rows)return this.arr[0][0];function t(t,e){var s=[];for(let e=0;e<t.length;e++)s.push(t[e].slice(0));s.splice(0,1);for(let t=0;t<s.length;t++)s[t].splice(e,1);return s}return function e(s){if(2==s.length)return s.flat(1).some((t=>t instanceof kn))?void console.warn("Tensors are not completely supported yet ..."):nt.sub(nt.mul(s[0][0],s[1][1]),nt.mul(s[0][1],s[1][0]));for(var r=0,i=0;i<s.length;i++){const n=nt.add(nt.mul(Un(-1,i),nt.mul(s[0][i],e(t(s,i)))));r=nt.add(r,n)}return r}(this.arr)}get inv(){if(!this.isSquare)return new Error("is not square matrix");if(0===this.det)return"determinat = 0 !!!";let t=function(t){if(t.length!==t[0].length)return;var e=0,s=0,r=0,i=t.length,n=0,a=[],o=[];for(e=0;e<i;e+=1)for(a[a.length]=[],o[o.length]=[],r=0;r<i;r+=1)a[e][r]=e==r?1:0,o[e][r]=t[e][r];for(e=0;e<i;e+=1){if(0==(n=o[e][e])){for(s=e+1;s<i;s+=1)if(0!=o[s][e]){for(r=0;r<i;r++)n=o[e][r],o[e][r]=o[s][r],o[s][r]=n,n=a[e][r],a[e][r]=a[s][r],a[s][r]=n;break}if(0==(n=o[e][e]))return}for(r=0;r<i;r++)o[e][r]=o[e][r]/n,a[e][r]=a[e][r]/n;for(s=0;s<i;s++)if(s!=e)for(n=o[s][e],r=0;r<i;r++)o[s][r]-=n*o[e][r],a[s][r]-=n*a[e][r]}return a}(this.arr);return new kn(this.rows,this.cols,t.flat(1))}static zeros(t,e){let s=new kn(t,e);for(let i=0;i<t;i++)for(var r=0;r<e;r++)s.arr[i][r]=0;return s}static ones(t,e){let s=new kn(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)s.arr[r][t]=1;return s}static nums(t,e,s){let r=new kn(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)r.arr[i][t]=s;return r}static get rand(){return{int:(t,e,s,r)=>{let i=new kn(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)i.arr[n][t]=dt.randInt(s,r);return i},bin:(t,e)=>{let s=new kn(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)s.arr[r][t]=dt.randBin;return s},hex:(t,e)=>{let s=new kn(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)s.arr[r][t]=dt.randHex;return s},choices:(t,e,s,r)=>{let i=new kn(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)i.arr[n][t]=dt.choice(s,r);return i},permutation:(t,e,s)=>{}}}static rands(t,e,s=1,r){let i=new kn(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)i.arr[n][t]=dt.rand(s,r);return i}map(t,e,s,r){return nt.map(this,t,e,s,r)}lerp(t,e){return nt.lerp(this,t,e)}norm(t,e){return nt.norm(this,t,e)}clamp(t,e){return nt.clamp(this,t,e)}static map(t,e,s,r,i){return nt.map(t,e,s,r,i)}static lerp(t,e,s){return nt.lerp(t,e,s)}static norm(t,e,s){return nt.norm(t,e,s)}static clamp(t,e,s){return nt.clamp(In,e,s)}toPrecision(t){for(let e=0;e<this.cols;e++)for(let s=0;s<this.rows;s++)this.arr[e][s]=+this.arr[e][s].toPrecision(t);return this}get toBin(){let t=this.arr.flat(1).toBin;return new kn(this.rows,this.cols,t)}get toOct(){let t=this.arr.flat(1).toOct;return new kn(this.rows,this.cols,t)}get toHex(){let t=this.arr.flat(1).toHex;return new kn(this.rows,this.cols,t)}max2min(){let t=this.arr.flat(1).max2min;return new kn(this.rows,this.cols,t)}min2max(){let t=this.arr.flat(1).min2max;return new kn(this.rows,this.cols,t)}sortRows(t=void 0){let e=this.arr.map((e=>e.sort(t))).flat(1);return new kn(this.rows,this.cols,e)}sortCols(t=void 0){let e=this.T.arr.map((e=>e.sort(t))).flat(1);return new kn(this.rows,this.cols,e).T}filterByRows(t){var e=this.arr.map((e=>e.map((e=>+(""+e).includes(t))))).map((t=>!!Logic.or(...t))),s=this.arr.filter(((t,s)=>!0===e[s]));return 0===s.length&&s.push([]),console.log(s),new kn(s)}filterByCols(t){return new kn(this.T.arr.filter((e=>e.includes(t))))}sortAll(t=void 0){let e=this.arr.flat(1).sort(t);return new kn(this.rows,this.cols,e)}count(t){return this.arr.flat(1).count(t)}toBase(t){let e=this.arr.flat(1).toBase(t);return new kn(this.rows,this.cols,e)}#l(t){if(this.rows!==t.rows)return;let e=this.arr;for(let s=0;s<this.rows;s++)for(let r=this.cols;r<this.cols+t.cols;r++)e[s][r]=t.arr[s][r-this.cols];return this.cols+=t.cols,new kn(this.rows,this.cols,e.flat(1))}hstack(...t){const e=[this,...t].reduce(((t,e)=>t.#l(e)));return Object.assign(this,e),this}static hstack(t,...e){return t.clone.hstack(...e)}#u(t){if(this.cols!==t.cols)return;let e=this.arr;for(let s=this.rows;s<this.rows+t.rows;s++){e[s]=[];for(let r=0;r<this.cols;r++)e[s][r]=t.arr[s-this.rows][r]}return this.rows+=t.rows,new kn(this.rows,this.cols,e.flat(1))}vstack(...t){const e=[this,...t].reduce(((t,e)=>t.#u(e)));return Object.assign(this,e),this}static vstack(t,...e){return t.clone.vstack(...e)}hqueue(...t){const e=[this,...t].reverse().reduce(((t,e)=>t.#l(e)));return Object.assign(this,e),this}vqueue(...t){const e=[this,...t].reverse().reduce(((t,e)=>t.#u(e)));return Object.assign(this,e),this}static hqueue(t,...e){return t.clone.hqueue(...e)}static vqueue(t,...e){return t.clone.vqueue(...e)}slice(t=0,e=0,s=this.rows-1,r=this.cols-1){let i=s-t,n=r-e,a=new Array(n);for(let s=0;s<i;s++){a[s]=[];for(let r=0;r<n;r++)a[s][r]=this.arr[s+t][r+e]}return new kn(i,n,a.flat(1))}static slice(t,e=0,s=0,r=this.rows-1,i=this.cols-1){return t.slice(e,s,r,i)}splice(t,e,s,...r){}getRows(t,e=t+1){return this.slice(t,0,e,this.cols)}getCols(t,e=t+1){return this.slice(0,t,this.rows,e)}static getRows(t,e,s=e+1){return t.slice(e,0,s,t.cols)}static getCols(t,e,s=e+1){return t.slice(0,e,t.rows,s)}add(...t){for(let s=0;s<t.length;s++){("number"==typeof t[s]||t[s]instanceof Mn)&&(t[s]=kn.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=nt.add(this.arr[r][e],t[s].arr[r][e])}return new kn(this.rows,this.cols,this.arr.flat(1))}sub(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=kn.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=nt.sub(this.arr[r][e],t[s].arr[r][e])}return new kn(this.rows,this.cols,this.arr.flat(1))}static add(t,...e){return t.clone.add(...e)}static sub(t,...e){return t.clone.sub(...e)}mul(...t){for(let r=0;r<t.length;r++){"number"==typeof t[r]&&(t[r]=kn.nums(this.rows,this.cols,t[r]));for(var e=0;e<this.rows;e++)for(var s=0;s<this.cols;s++)this.arr[e][s]=nt.mul(this.arr[e][s],t[r].arr[e][s])}return new kn(this.rows,this.cols,this.arr.flat(1))}div(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=kn.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=nt.div(this.arr[r][e],t[s].arr[r][e])}return new kn(this.rows,this.cols,this.arr.flat(1))}static div(t,...e){return t.clone.div(...e)}static mul(t,...e){return t.clone.mul(...e)}modulo(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=kn.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=nt.modulo(this.arr[r][e],t[s].arr[r][e])}return new kn(this.rows,this.cols,this.arr.flat(1))}static modulo(t,...e){return t.clone.modulo(...e)}dot(t){for(var e=[],s=0;s<this.arr.length;s++){e[s]=[];for(var r=0;r<t.arr[0].length;r++){e[s][r]=0;for(var i=0;i<this.arr[0].length;i++)e[s][r]=nt.add(e[s][r],nt.mul(this.arr[s][i],t.arr[i][r]))}}return new kn(this.arr.length,t.arr[0].length,e.flat(1))}static dot(t,e){return t.dot(e)}pow(t){let e=this.clone,s=this.clone;for(let r=0;r<t-1;r++)s=s.dot(e);return s}static pow(t,e){return t.clone.pow(e)}get somme(){let t=0;for(let e=0;e<this.rows;e++)for(let s=0;s<this.cols;s++)t+=this.arr[e][s];return t}get DoesItContainComplexNumbers(){return this.arr.flat(1/0).some((t=>t instanceof Mn))}get min(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(K(...this.arr[e]));return K(...t)}get max(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(Q(...this.arr[e]));return Q(...t)}get minRows(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(K(...this.arr[e]));return t}get maxRows(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(Q(...this.arr[e]));return t}get minCols(){return this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable"),this.T.minRows}get maxCols(){return this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable"),this.T.maxRows}static fromVector(t){return new kn(t.length,1,t)}get toArray(){let t=[];for(let e=0;e<this.rows;e++)for(let s=0;s<this.cols;s++)t.push(this.arr[e][s]);return t}get print(){let t="[";for(let e=0;e<this.arr.length;e++)t+=(0!=e?" ":"")+` [${this.arr[e].map((t=>" "+t.toString()+" "))}],\n`;console.log(t.substring(0,t.length-2)+" ]"),document.write(t.substring(0,t.length-2)+" ]")}get table(){console.table(this.arr)}get serialize(){return JSON.stringify(this)}static deserialize(t){"string"==typeof t&&(t=JSON.parse(t));let e=new kn(t.rows,t.cols);return e.arr=t.arr,e}toTable(){var t=new DocumentFragment,e=new Array(this.rows).fill(null).map((()=>document?.createElement("tr"))),s=this.arr.map((t=>t.map((()=>document?.createElement("td")))));for(let t=0;t<s.length;t++)for(let r=0;r<s[0].length;r++)s[t][r].innerHTML=this.arr[t][r],e[t].appendChild(s[t][r]);return e.map((e=>t.appendChild(e))),t}toGrid(t,e={}){let s=Grid();return s.append(...this.map(t).arr.flat(1).map((t=>t.style(e)))),s.Columns(this.cols),s}sortTable(t=0,{type:e="num",order:s="asc"}={}){var r=this.T.arr.map((t=>t.map(((t,e)=>Object.assign({},{x:t,y:e}))))),i=this.T.arr.map((t=>t.map(((t,e)=>Object.assign({},{x:t,y:e})))));"num"===e?"asc"===s?r[t].sort(((t,e)=>t.x-e.x)):"desc"===s?r[t].sort(((t,e)=>e.x-t.x)):"toggle"===s&&(r[t][0].x>r[t][1].x?r[t].sort(((t,e)=>e.x-t.x)):r[t].sort(((t,e)=>t.x-e.x))):"alpha"===e&&("asc"===s?r[t].sort(((t,e)=>(""+t.x).localeCompare(""+e.x))):"desc"===s&&r[t].sort(((t,e)=>(""+e.x).localeCompare(""+t.x)))),s=r[t].map((t=>t.y));for(let e=0;e<r.length;e++)e!==t&&r[e].map(((t,e)=>t.y=s[e]));for(let e=0;e<r.length;e++)e!==t&&i[e].map(((t,i)=>t.x=r[e][s[i]].x));i[t]=r[t];var n=i.map((t=>t.map((t=>t.x))));return new kn(n).T}}const In=(t,e,s)=>new kn(t,e,s),En=(...t)=>new kn(2,2,t),Tn=(...t)=>new kn(3,3,t),An=(...t)=>new kn(4,4,t);var Cn=Object.freeze({__proto__:null,Matrix:kn,matrix:In,matrix2:En,matrix3:Tn,matrix4:An});class Mn extends k{constructor(t=0,e=0){super(),t instanceof Mn?(this.a=t.a,this.b=t.b):"object"==typeof t?"a"in e&&"b"in t?(this.a=t.a,this.b=t.b):"a"in e&&"z"in t?(this.a=t.a,this.b=Zn(t.z**2-t.a**2)):"a"in e&&"phi"in t?(this.a=t.a,this.b=t.a*Fn(t.phi)):"b"in e&&"z"in t?(this.b=t.b,this.a=Zn(t.z**2-t.b**2)):"b"in e&&"phi"in t?(this.b=e,this.a=t.b/Fn(t.phi)):"z"in e&&"phi"in t&&(this.a=t.z*Pn(t.phi),this.a=t.z*zn(t.phi)):"number"==typeof t&&"number"==typeof e&&(this.a=+t.toFixed(32),this.b=+e.toFixed(32))}toString(){let t="";return t=0!==this.a?this.b>=0?`${this.a}+${this.b}*i`:`${this.a}-${Math.abs(this.b)}*i`:this.b>=0?`${this.b}*i`:`-${Math.abs(this.b)}*i`,t}get clone(){return new Mn(this.a,this.b)}get z(){return ca(this.a,this.b)}get phi(){return na(this.b,this.a)}static Zero(){return new Mn(0,0)}get conj(){return new Mn(this.a,-this.b)}get inv(){return new Mn(this.a/(Un(this.a,2)+Un(this.b,2)),-this.b/(Un(this.a,2)+Un(this.b,2)))}add(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new Mn(t[e],0));let e=t.map((t=>t.a)),s=t.map((t=>t.b));return this.a+=+G(...e).toFixed(15),this.b+=+G(...s).toFixed(15),this}sub(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new Mn(t[e],0));let e=t.map((t=>t.a)),s=t.map((t=>t.b));return this.a-=+G(...e).toFixed(15),this.b-=+G(...s).toFixed(15),this}mul(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new Mn(t[e],0));let e=+X(this.z,...t.map((t=>t.z))).toFixed(15),s=+G(this.phi,...t.map((t=>t.phi))).toFixed(15);return this.a=+(e*Pn(s).toFixed(15)).toFixed(14),this.b=+(e*zn(s).toFixed(15)).toFixed(14),this}div(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new Mn(t[e],0));let e=+(this.z/X(...t.map((t=>t.z)))).toFixed(15),s=+(this.phi-G(...t.map((t=>t.phi)))).toFixed(15);return this.a=+(e*Pn(s).toFixed(15)).toFixed(15),this.b=+(e*zn(s).toFixed(15)).toFixed(15),this}pow(t){if(ra(t)===t&&t>0){let e=+(this.z**t).toFixed(15),s=+(this.phi*t).toFixed(15);this.a=+(e*Pn(s).toFixed(15)).toFixed(15),this.b=+(e*zn(s).toFixed(15)).toFixed(15)}return this}static fromExpo(t,e){return new Mn(+(t*Pn(e)).toFixed(13),+(t*zn(e)).toFixed(13))}get expo(){return[this.z,this.phi]}static add(t,...e){return t.clone.add(...e)}static sub(t,...e){return t.clone.sub(...e)}static mul(t,...e){return t.clone.mul(...e)}static div(t,...e){return t.clone.div(...e)}static pow(t,e){return t.clone.pow(e)}static xpowZ(t){return On(t**this.a*Pn(this.b*Ln(t)),t**this.a*zn(this.b*Ln(t)))}sqrtn(t=2){return On(Rn(this.z,t)*Pn(this.phi/t),Rn(this.z,t)*zn(this.phi/t))}get sqrt(){return this.sqrtn(2)}get log(){return On(this.z,this.phi)}get cos(){return On(Pn(this.a)*Gn(this.b),zn(this.a)*Xn(this.b))}get sin(){return On(zn(this.a)*Gn(this.b),Pn(this.a)*Xn(this.b))}get tan(){const t=Pn(2*this.a)+Gn(2*this.b);return On(zn(2*this.a)/t,Xn(2*this.b)/t)}printInConsole(){let t=this.a+" + "+this.b+" * i";return console.log(t),t}print(){}UI(){return"<span>"+this.a+" + i * "+this.b+"</span>"}}const On=(t,e)=>{if((t instanceof Array||ArrayBuffer.isView(t))&&(e instanceof Array||ArrayBuffer.isView(t)))return t.map(((s,r)=>On(t[r],e[r])));if(t instanceof kn&&e instanceof kn){if(t.shape[0]!==e.shape[0]||t.shape[1]!==e.shape[1])return Error(0);const s=t.arr.map(((s,r)=>On(t.arr[r],e.arr[r])));return new kn(t.rows,t.cols,...s)}return new Mn(t,e)};var Sn=Object.freeze({__proto__:null,Complex:Mn,complex:On});const jn=(...t)=>I(Math.abs,...t),Zn=(...t)=>I(Math.sqrt,...t),Un=(t,e)=>{if("number"==typeof t)return"number"==typeof e?Math.pow(t,e):e instanceof Mn?Mn.fromExpo(t**e.a,e.b*Ln(t)):I((e=>Un(t,e)),...e);if(t instanceof Mn)return"number"==typeof e?Mn.fromExpo(t.z**e,t.phi*e):e instanceof Mn?Mn.fromExpo(t.z**e.a*Dn(-t.phi*e.b),Ln(t.z)*e.b+e.a*t.phi):I((e=>Un(t,e)),...e);if(t instanceof Array){if("number"==typeof e)return I((t=>Un(t,e)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(I((e=>Un(t[r],e)),...e));return s}}},Rn=(t,e)=>{if("number"==typeof t)return"number"==typeof e?Math.pow(t,1/e):I((e=>Rn(t,e)),...e);if(t instanceof Mn)return"number"==typeof e?Mn.fromExpo(Rn(t.z,e),t.phi/e):I((e=>Rn(t,e)),...e);if(t instanceof Array){if("number"==typeof e)return I((t=>Rn(t,e)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(I((e=>Rn(t[r],e)),...e));return s}}},Dn=(...t)=>I(Math.exp,...t),Ln=(...t)=>I(Math.log,...t),Pn=(...t)=>I(_.cos,...t),zn=(...t)=>I(_.sin,...t),Fn=(...t)=>I(_.tan,...t),Hn=(...t)=>I(_.sec,...t),Nn=(...t)=>I(_.sinc,...t),Bn=(...t)=>I(_.csc,...t),$n=(...t)=>I(_.cot,...t),Vn=(...t)=>I(_.acos,...t),qn=(...t)=>I(_.asin,...t),Wn=(...t)=>I(_.atan,...t),Yn=(...t)=>I(_.acot,...t),Gn=(...t)=>I(_.cosh,...t),Xn=(...t)=>I(_.sinh,...t),Kn=(...t)=>I(_.tanh,...t),Qn=(...t)=>I(_.coth,...t),Jn=(...t)=>I(_.acosh,...t),ta=(...t)=>I(_.asinh,...t),ea=(...t)=>I(_.atanh,...t),sa=(...t)=>I(Math.ceil,...t),ra=(...t)=>I(Math.floor,...t),ia=(...t)=>I(Math.round,...t),na=(t,e,s=!0)=>{if("number"==typeof t)return"number"==typeof e?s?Math.atan2(t,e):180*Math.atan2(t,e)/Math.PI:I((e=>na(t,e,s)),...e);if(t instanceof Array){if("number"==typeof e)return I((t=>na(t,e,s)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(I((e=>Un(t[r],e)),...e));return s}}},aa=(...t)=>I((t=>{let e,s=1;if(0==t)s=1;else if(t>0)for(e=1;e<=t;e++)s*=e;else s=NaN;return s}),...t),oa=(...t)=>I(Math.sign,...t),ha=(...t)=>I((t=>1/(1+Dn(-t))),...t),ca=(...t)=>t.every((t=>"number"==typeof t))?Math.hypot(...t):t.every((t=>t instanceof Array))?I(Math.hypot,...t):void 0;const la={...n,...Object.freeze({__proto__:null,abs:jn,acos:Vn,acosh:Jn,acot:Yn,asin:qn,asinh:ta,atan:Wn,atan2:na,atanh:ea,ceil:sa,cos:Pn,cosh:Gn,cot:$n,coth:Qn,csc:Bn,e:Dn,fact:aa,floor:ra,hypot:ca,ln:Ln,max:Q,min:K,pow:Un,round:ia,sec:Hn,sig:ha,sign:oa,sin:zn,sinc:Nn,sinh:Xn,sqrt:Zn,sqrtn:Rn,tan:Fn,tanh:Kn}),...Sn,...Cn,...ft,...at,...pt};class ua{constructor(t,e=1e3/30,s=0,r=1/0,i=!0){this.callback=t,this.cache={isRunning:!1,AnimationId:null,t0:null,step:e,startTime:s,endTime:r,started:i},this.init(),this.i=0}init(){return this.cache.started&&(this.cache.startTime?this.startAfter(this.cache.startTime):this.start(),this.cache.endTime&&this.cache.endTime!==1/0&&this.stopAfter(this.cache.endTime)),this}start(){return this.cache.isRunning||(this.i=0,this.cache.isRunning=!0,this.cache.t0=Date.now(),this.animate()),this}pause(){return this.cache.isRunning&&(clearTimeout(this.cache.AnimationId),this.cache.isRunning=!1),this}stop(){return this.pause(),this.i=0,this}resume(){return this.cache.isRunning=!0,this.animate(),this}startAfter(t=1e3){return setTimeout(this.start.bind(this),t),this}stopAfter(t=1e3){return setTimeout(this.stop.bind(this),t),this}animate=()=>{if(this.cache.isRunning){const t=Date.now(),e=t-this.cache.t0;e>this.cache.step&&(this.callback(this),this.i++,this.cache.t0=t-e%this.cache.step),this.cache.AnimationId=setTimeout(this.animate,0)}}}const ma=t=>1e3/t,pa=(t,e,s,r,i)=>new ua(t,e,s,r,i);var da=Object.freeze({__proto__:null,useFps:ma,useTimeLoop:pa});const fa={Linear:function(t){return t},InSin:t=>1-Math.cos(t*Math.PI/2),OutSin:t=>Math.sin(t*Math.PI/2),InOutSin:t=>-(Math.cos(Math.PI*t)-1)/2,InQuad:t=>t**2,OutQuad:t=>1-Math.pow(1-t,2),InOutQuad:t=>t<.5?2*Math.pow(t,2):1-Math.pow(-2*t+2,2)/2,InCubic:t=>t**3,OutCubic:t=>1-Math.pow(1-t,3),InOutCubic:t=>t<.5?4*Math.pow(t,3):1-Math.pow(-2*t+2,3)/2,InQuart:t=>t**4,OutQuart:t=>1-Math.pow(1-t,4),InOutQuart:t=>t<.5?8*Math.pow(t,4):1-Math.pow(-2*t+2,4)/2,InQuint:t=>t**5,OutQuint:t=>1-Math.pow(1-t,5),InOutQuint:t=>t<.5?16*Math.pow(t,5):1-Math.pow(-2*t+2,5)/2,InExpo:t=>0===t?0:Math.pow(2,10*t-10),OutExpo:t=>1===t?1:1-Math.pow(2,-10*t),InOutExpo:t=>0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2,InCirc:t=>1-Math.sqrt(1-Math.pow(t,2)),OutCirc:t=>Math.sqrt(1-Math.pow(t-1,2)),InOutCic:t=>t<.5?(1-Math.sqrt(1-Math.pow(2*t,2)))/2:(Math.sqrt(1-Math.pow(-2*t+2,2))+1)/2,Arc:t=>1-Math.sin(Math.acos(t)),Back:t=>Math.pow(t,2)*(2*t-1),Elastic:t=>-2*Math.pow(2,10*(t-1))*Math.cos(20*Math.PI*t/3*t),InBack(t){const e=1.70158;return 2.70158*Math.pow(t,3)-e*t**2},OutBack(t){const e=1.70158;return 1+2.70158*Math.pow(t-1,3)+e*Math.pow(t-1,2)},InOutBack(t){const e=2.5949095;return t<.5?Math.pow(2*t,2)*(7.189819*t-e)/2:(Math.pow(2*t-2,2)*((e+1)*(2*t-2)+e)+2)/2},InElastic(t){const e=2*Math.PI/3;return 0===t?0:1===t?1:-Math.pow(2,10*t-10)*Math.sin((10*t-10.75)*e)},OutElastic(t){const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},InOutElastic(t){const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1},InBounce:t=>1-fa.OutBounce(1-t),OutBounce(t){const e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-=1.5/s)*t+.75:t<2.5/s?e*(t-=2.25/s)*t+.9375:e*(t-=2.625/s)*t+.984375},InOutBounce:t=>t<.5?(1-fa.OutBounce(1-2*t))/2:(1+fa.OutBounce(2*t-1))/2},ga=t=>{const e=Date.now(),s=performance.memory.usedJSHeapSize,r=t();return{elapsedTime:Date.now()-e,usedMemory:performance.memory.usedJSHeapSize-s,result:r}},ba=t=>new Promise((e=>{if(t.element)return e(t.element);const s=new MutationObserver((()=>{t.element&&(e(t.element),s.disconnect())}));s.observe(document?.body,{childList:!0,subtree:!0})})),ya=(t,e=2e3)=>{const s=Date.now();for(;Date.now()-s<e;)if(t.element)return t.element},wa=t=>new Promise((e=>setTimeout(e,t))),xa=t=>{console.time("timeTaken");const e=t();return console.timeEnd("timeTaken"),e};var va=Object.freeze({__proto__:null,Ease:fa,timeTaken:xa,time_memory_Taken:ga,useDebounce:(t,e=1e3)=>(...s)=>setTimeout((()=>t(...s)),e),useThrottle:(t,e)=>{let s=0;return(...r)=>{const i=(new Date).getTime();i-s<e||(s=i,t(...r))}},wait:wa,waitForUIElm:ba,waitForUIElmSync:ya});class _a{constructor(t,e=fa.Linear,s=50,{t:r=[0,null],start:i=!0,duration:n=3e3}={}){this.cache={isRunning:!1,AnimationId:null,startTime:null,ease:e,step:s,intervall:r,started:i,duration:n},this.t=0,this.tx=0,this.ty=0,this.i=0,this.callback=t}#m(){this.t+=this.cache.step,this.i++,this.tx=H(this.t,0,this.cache.duration,0,1),this.ty=this.cache.ease(this.tx),this.callback(this),this.t>=this.cache.duration&&(clearInterval(this.cache.AnimationId),this.cache.isRunning=!1)}reset(t=!0){return this.t=0,this.tx=0,this.ty=0,this.i=0,t&&this.start(),this}#p(t=!0){return this.cache.isRunning||(t&&this.reset(!1),this.cache.isRunning=!0,this.cache.startTime=Date.now(),this.cache.AnimationId=setInterval(this.#m.bind(this),this.cache.step)),this}start(){return this.#p(!0),this}pause(){return this.cache.isRunning&&(clearTimeout(this.cache.AnimationId),this.cache.isRunning=!1),this}resume(){return this.#p(!1),this}stop(){return this.pause(),this.reset(!1),this}}const ka={...da,...da,...va};class Ia extends ps{constructor(t=360,e=300){super("svg","svg"),this.style({border:"1px black solid"}),this.size(t,e),this.view(-10,-10,10,10)}size(t,e){return this.setAttr({width:t,height:e}),this}view(t,e,s,r){let i=Math.abs(s-t),n=Math.abs(r-e);return this.setAttr("viewBox",[t,e,i,n].join(" ")),this.st.scaleY(-1),this}add(...t){for(let e=0;e<t.length;e++)this.element.append(t[e].element),this.items.push(t[e]);return this.maintain(),this}remove(...t){for(let e=0;e<t.length;e++)this.element?.removeChild(t[e].element),this.items=this.items.filter((e=>!t));return this.maintain(),this}mask(){}toString(){return(new XMLSerializer).serializeToString(this.element)}btoa(){return btoa(this.toString())}toImg(){return"data:image/svg+xml;base64,"+this.btoa()}toImg2(){return"data:image/svg+xml;charset=utf8,"+this.toString().replaceAll("<","%3C").replaceAll(">","%3E").replaceAll("#","%23").replaceAll('"',"'")}}const Ea=(t,e)=>new Ia(t,e);var Ta=Object.freeze({__proto__:null,Svg:Ea,ZikoUISvg:Ia});class Aa extends ps{constructor(t,e){super("canvas","canvas"),this.ctx=this.element?.getContext("2d"),this.style({border:"1px red solid"}),this.transformMatrix=new kn([[1,0,0],[0,1,0],[0,0,1]]),this.axisMatrix=new kn([[-10,-10],[10,10]]),requestAnimationFrame((()=>this.resize(t,e)),0),this.on("sizeupdated",(()=>this.adjust()))}get Xmin(){return this.axisMatrix[0][0]}get Ymin(){return this.axisMatrix[0][1]}get Xmax(){return this.axisMatrix[1][0]}get Ymax(){return this.axisMatrix[1][1]}get ImageData(){return this.ctx.getImageData(0,0,c.Width,c.Height)}draw(t=!0){return t?(this.clear(),this.items.forEach((t=>{t.parent=this,t.draw(this.ctx)}))):(this.items.at(-1).parent=this,this.items.at(-1).draw(this.ctx)),this.maintain(),this}applyTransformMatrix(){return this.ctx.setTransform(this.transformMatrix[0][0],this.transformMatrix[1][0],this.transformMatrix[0][1],this.transformMatrix[1][1],this.transformMatrix[0][2],this.transformMatrix[1][2]),this}resize(t,e){return this.size(t,e),this.lineWidth(),this.view(this.axisMatrix[0][0],this.axisMatrix[0][1],this.axisMatrix[1][0],this.axisMatrix[1][1]),this.emit("sizeupdated"),this}adjust(){return this.element.width=this.element?.getBoundingClientRect().width,this.element.height=this.element?.getBoundingClientRect().height,this.view(this.axisMatrix[0][0],this.axisMatrix[0][1],this.axisMatrix[1][0],this.axisMatrix[1][1]),this}view(t,e,s,r){return this.transformMatrix[0][0]=this.width/(s-t),this.transformMatrix[1][1]=-this.height/(r-e),this.transformMatrix[0][2]=this.width/2,this.transformMatrix[1][2]=this.height/2,this.axisMatrix=new kn([[t,e],[s,r]]),this.applyTransformMatrix(),this.clear(),this.lineWidth(1),this.draw(),this}reset(){return this.ctx.setTransform(1,0,0,0,0,0),this}append(t){return this.items.push(t),this.draw(!1),this}background(t){this.ctx.fillStyle=t,this.ctx.setTransform(1,0,0,1,0,0),this.ctx.fillRect(0,0,this.width,this.height),this.applyTransformMatrix(),this.draw()}lineWidth(t){return this.ctx.lineWidth=t/this.transformMatrix[0][0],this}getImageData(t=0,e=0,s=this.width,r=this.height){return this.ctx.getImageData(t,e,s,r)}clear(){return this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.width,this.height),this.applyTransformMatrix(),this}clone(){console.log(this.width);const t=new Aa;return t.items=this.items,t.transformMatrix=this.transformMatrix,t.axisMatrix=this.axisMatrix,Object.assign(t.cache,{...this.cache}),this.size(this.element.style.width,this.element.style.width),this.applyTransformMatrix(),this.draw(),this.adjust(),t}toImage(){return this.img=document?.createElement("img"),this.img.src=this.element?.toDataURL("image/png"),this}toBlob(){this.element.toBlob((function(t){var e=document?.createElement("img"),s=URL.createObjectURL(t);e.onload=function(){URL.revokeObjectURL(s)},e.src=s,console.log(e)}))}zoomIn(){}zoomOut(){}undo(t){}redo(t){}stream(){}}const Ca=(t,e)=>new Aa(t,e);const Ma={...Ta,...Object.freeze({__proto__:null,Canvas:Ca,ZikoUICanvas:Aa})};class Oa{constructor(t,e=!0){this.#n(),this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}#n(){return this.__FavIcon__=document.querySelector("link[rel*='icon']")||document?.createElement("link"),this.__FavIcon__.type="image/x-icon",this.__FavIcon__.rel="shortcut icon",this}set(t){return t!==this.__FavIcon__.href&&(this.__FavIcon__.href=t,this.cache.Emitter&&this.cache.Emitter.emit("ziko:favicon-changed")),this}get current(){return document.__FavIcon__.href}onChange(t){return this.cache.Emitter&&this.cache.Emitter.on("ziko:favicon-changed",t),this}useEventEmitter(){return this.cache.Emitter=es(),this}}class Sa{constructor({viewport:t,charset:e,description:s,author:r,keywords:i}){this.document=globalThis?.document,this.meta={},this.init({viewport:t,charset:e,description:s,author:r,keywords:i})}init({viewport:t,charset:e,description:s,author:r,keywords:i}){t&&this.setViewport(t),e&&this.setCharset(e),s&&this.describe(s),r&&this.setAuthor(r),i&&this.setKeywords(i)}set(t,e){const s="charset"===(t=t.toLowerCase()),r=s?document.querySelector("meta[charset]"):document.querySelector(`meta[name=${t}]`);return this.meta=r??document?.createElement("meta"),s?this.meta.setAttribute("charset",e):(this.meta.setAttribute("name",t),this.meta.setAttribute("content",e)),r||this.document.head.append(this.meta),this}setCharset(t="utf-8"){return this.set("charset",t),this}describe(t){return this.set("description",t),this}setViewport(t="width=device-width, initial-scale=1.0"){return this.set("viewport",t),this}setKeywords(...t){return t=[...new Set(t)].join(", "),this.set("keywords",t),this}setAuthor(t){return this.set("author",t),this}}class ja{constructor(t=document.title,e=!0){this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}useEventEmitter(){return this.cache.Emitter=es(),this}set(t){return t!==document.title&&(document.title=t,this.cache.Emitter&&this.cache.Emitter.emit("ziko:title-changed")),this}get current(){return document.title}onChange(t){return this.cache.Emitter&&this.cache.Emitter.on("ziko:title-changed",t),this}}class Za{constructor({title:t,lang:e,icon:s,meta:r,noscript:i}){this.html=globalThis?.document?.documentElement,this.head=globalThis?.document?.head,t&&((t,e)=>{new ja(t,e)})(t),e&&this.setLang(e),s&&((t,e)=>{new Oa(t,e)})(s),r&&(({viewport:t,charset:e,description:s,author:r,keywords:i})=>{new Sa({viewport:t,charset:e,description:s,author:r,keywords:i})})(r),i&&this.setNoScript()}setLang(t){this.html.setAttribute("lang",t)}setNoScript(t){}}class Ua{constructor({head:t=null,wrapper:e=null,target:s=null}){this.head=t,this.wrapper=e,this.target=s,this.init()}get isZikoApp(){return!0}init(){this.head&&this.setHead(this.head),this.wrapper&&this.setWrapper(this.wrapper),this.target&&this.setTarget(this.target),this.wrapper&&this.target&&this.wrapper.render(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?.isZikoUIElement?this.wrapper=t:"function"==typeof t&&(this.wrapper=t()),this}setHead(t){return this.head=t instanceof Za?t:(({title:t,lang:e,icon:s,meta:r,noscript:i})=>new Za({title:t,lang:e,icon:s,meta:r,noscript:i}))(t),this}}const Ra=({head:t,wrapper:e,target:s})=>new Ua({head:t,wrapper:e,target:s});var Da=Object.freeze({__proto__:null,App:Ra,ZikoApp:Ua});function La(t){return/:\w+/.test(t)}class Pa extends Ua{constructor({head:t,wrapper:e,target:s,routes:r}){super({head:t,wrapper:e,target:s}),this.routes=new Map([["404",_s("Error 404")],...Object.entries(r)]),this.clear(),globalThis.onpopstate=this.render(location.pathname)}clear(){return[...this.routes].forEach((t=>{!La(t[0])&&t[1]?.isZikoUIElement&&t[1].unrender()})),this}render(t){const[e,s]=[...this.routes].find((e=>function(t,e){const s=t.split("/"),r=e.split("/");if(s.length!==r.length)return!1;for(let t=0;t<s.length;t++){const e=s[t],i=r[t];if(!e.startsWith(":")&&e!==i)return!1}return!0}(e[0],t)));let r;if(La(e)){const i=function(t,e){const s=t.split("/"),r=e.split("/"),i={};if(s.length!==r.length)return i;for(let t=0;t<s.length;t++){const e=s[t],n=r[t];if(e.startsWith(":"))i[e.slice(1)]=n;else if(e!==n)return{}}return i}(e,t);r=s.call(this,i)}else s?.isZikoUIElement&&s.render(this.wrapper),"function"==typeof s&&(r=s());return r?.isZikoUIElement&&r.render(this.wrapper),r instanceof Promise&&r.then((t=>t.render(this.wrapper))),globalThis.history.pushState({},"",t),this}}const za=({head:t,wrapper:e,target:s,routes:r})=>new Pa({head:t,wrapper:e,target:s,routes:r});var Fa=Object.freeze({__proto__:null,SPA:za,ZikoSPA:Pa});function Ha(t){Object.defineProperties(t,{QueryParams:{get:function(){return function(t){const e={};return t.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi,(t=>{const[s,r]=t.split("=");e[s]=r})),e}(globalThis.location.search.substring(1))},configurable:!1,enumerable:!0},HashParams:{get:function(){return globalThis.location.hash.substring(1).split("#")},configurable:!1,enumerable:!0}})}const Na={__all__(){return Object.values(this).filter(Array.isArray).flat()},querySelectorAll(){return this.__all__().filter((t=>t))},getElementByIndex(t){return this.__all__().find((e=>e.ui_index===t))},getElementById:t=>null,getElementsByClass(){},getElementsByTagName(){}},Ba={map:new Map,index:0,increment:function(){return this.index++}},$a=new Map,Va={default:{target:null,render:!0,math:{mode:"deg"}},setDefault:function(t){const e=Object.keys(t),s=Object.values(t);for(let t=0;t<e.length;t++)this.default[e[t]]=s[t]},init:()=>{},renderingMode:"spa",isSSC:!1},qa={ui_index:0,get_ui_index:function(){return this.ui_index++}};function Wa(t,e="./src/pages",s=["js","ts"]){"/"===e.at(-1)&&(e=e.slice(0,-1));const r=t.replace(/\\/g,"/").replace(/\[(\w+)\]/g,"$1/:$1").split("/"),i=e.split("/"),n=r.indexOf(i[i.length-1]);if(-1!==n){const t=r.slice(n+1),e=t[t.length-1],i="index.js"===e||"index.ts"===e,a=s.some((t=>e===`.${t}`||e.endsWith(`.${t}`)));if(i)return"/"+(t.length>1?t.slice(0,-1).join("/"):"");if(a)return"/"+t.join("/").replace(/\.(js|ts)$/,"")}return""}const Ya={...Da,...Fa,...Object.freeze({__proto__:null,__CACHE__:qa,__Config__:Va,__HYDRATION_MAP__:$a,__HYDRATION__:Ba,__UI__:Na})};class Ga{constructor(t=""){this.channel=new BroadcastChannel(t),this.EVENTS_DATAS_PAIRS=new Map,this.EVENTS_HANDLERS_PAIRS=new Map,this.LAST_RECEIVED_EVENT="",this.UUID="ziko-channel"+dt.string(10),this.SUBSCRIBERS=new Set([this.UUID])}get broadcast(){return this}emit(t,e){return this.EVENTS_DATAS_PAIRS.set(t,e),this.#d(t),this}on(t,e=console.log){return this.EVENTS_HANDLERS_PAIRS.set(t,e),this.#f(),this}#f(){return this.channel.onmessage=t=>{this.LAST_RECEIVED_EVENT=t.data.last_sended_event;const e=t.data.userId;this.SUBSCRIBERS.add(e);const s=t.data.EVENTS_DATAS_PAIRS.get(this.LAST_RECEIVED_EVENT),r=this.EVENTS_HANDLERS_PAIRS.get(this.LAST_RECEIVED_EVENT);s&&r&&r(s)},this}#d(t){return this.channel.postMessage({EVENTS_DATAS_PAIRS:this.EVENTS_DATAS_PAIRS,last_sended_event:t,userId:this.UUID}),this}close(){return this.channel.close(),this}}const Xa=t=>new Ga(t);class Ka{#g;constructor(){this.#g=function(t){try{let e=new Function("return "+t.data.fun)()();postMessage({result:e})}catch(t){postMessage({error:t.message})}finally{t.data.close&&self.close()}}.toString(),this.blob=new Blob(["this.onmessage = "+this.#g],{type:"text/javascript"}),this.worker=new Worker(window.URL.createObjectURL(this.blob))}call(t,e,s=!0){return this.worker.postMessage({fun:t.toString(),close:s}),this.worker.onmessage=function(t){t.data.error?console.error(t.data.error):e(t.data.result)},this}}class Qa{constructor(t,{namespace:e="Ziko",register:s,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(let s in t)if(!e.has(s))throw new Error(`Invalid CSS property: "${s}"`)}(t),this.currentPropsMap=t,this.#c(),this}#c(){const t=globalThis?.document?.documentElement?.style;for(let e in this.currentPropsMap){const s=this.namespace?`--${this.namespace}-${e}`:`--${e}`;t.setProperty(s,this.currentPropsMap[e]),console.log({cssProp:s}),Object.defineProperty(this,e,{value:`var(${s})`,writable:!0,configurable:!0,enumerable:!1})}}}class Ja{constructor(t,e,s){this.cache={storage:t,globalKey:e,channel:Xa(`Ziko:useStorage-${e}`),oldItemKeys:new Set},this.#n(s),this.#c()}get items(){return JSON.parse(this.cache.storage[this.cache.globalKey]??null)}#c(){for(let t in this.items)Object.assign(this,{[[t]]:this.items[t]})}#n(t){this.cache.channel=Xa(`Ziko:useStorage-${this.cache.globalKey}`),this.cache.channel.on("Ziko-Storage-Updated",(()=>this.#c())),t&&(this.cache.storage[this.cache.globalKey]?(Object.keys(this.items).forEach((t=>this.cache.oldItemKeys.add(t))),console.group("Ziko:useStorage"),console.warn(`Storage key '${this.cache.globalKey}' already exists. we will not overwrite it.`),console.info("%cWe'll keep the existing data.","background-color:#2222dd; color:gold;"),console.group("")):this.set(t))}set(t){return this.cache.storage.setItem(this.cache.globalKey,JSON.stringify(t)),this.cache.channel.emit("Ziko-Storage-Updated",{}),Object.keys(t).forEach((t=>this.cache.oldItemKeys.add(t))),this.#c(),this}add(t){const e={...this.items,...t};return this.cache.storage.setItem(this.cache.globalKey,JSON.stringify(e)),this.#c(),this}remove(...t){const e={...this.items};for(let s=0;s<t.length;s++)delete e[t[s]],delete this[t[s]];return this.set(e),this}get(t){return this.items[t]}clear(){return this.cache.storage.removeItem(this.cache.globalKey),this.#c(),this}}[Ya,la,rn,ka,_n,ms,Ma].forEach((t=>Object.assign(t,{ExtractAll:()=>(t=>{const e=Object.keys(t);for(let s=0;s<e.length;s++){const r=e[s];["__ExtractAll__","__RemoveAll__","ExtractAll","RemoveAll"].includes(r)||(globalThis[r]=t[r])}})(t),RemoveAll:()=>(t=>{const e=Object.keys(t);for(let t=0;t<e.length;t++){const s=e[t];"__RemoveAll__"!==s&&delete globalThis[s]}})(t)})));const to={App:Ya,Math:la,UI:rn,Time:ka,Data:_n,Reactivity:ms,Graphics:Ma};globalThis.__Ziko__?console.warn("WARNING: Multiple instances of Ziko.js being imported."):(globalThis.__Ziko__={...to,__UI__:Na,__HYDRATION__:Ba,__HYDRATION_MAP__:$a,__Config__:Va,__CACHE__:qa,ExtractAll:function(){return rn.ExtractAll(),la.ExtractAll(),ka.ExtractAll(),ms.ExtractAll(),Ma.ExtractAll(),_n.ExtractAll(),this},RemoveAll:function(){rn.RemoveAll(),la.RemoveAll(),ka.RemoveAll(),ms.RemoveAll(),Ma.RemoveAll(),_n.RemoveAll()}},Ha(__Ziko__)),globalThis?.document&&document?.addEventListener("DOMContentLoaded",__Ziko__.__Config__.init()),t.App=Ra,t.Article=Fi,t.Aside=Hi,t.Base=ht,t.Canvas=Ca,t.Combinaison=ut,t.Complex=Mn,t.E=r,t.EPSILON=i,t.Ease=fa,t.FileBasedRouting=async function(t){const e=Object.keys(t),s=function(t){if(0===t.length)return"";const e=t.map((t=>t.split("/"))),s=Math.min(...e.map((t=>t.length)));let r=[];for(let t=0;t<s;t++){const s=e[0][t];if(!e.every((e=>e[t]===s||e[t].startsWith("["))))break;r.push(s)}return r.join("/")+(r.length?"/":"")}(e),r={};for(let i=0;i<e.length;i++){const n=await t[e[i]](),a=await n.default;Object.assign(r,{[Wa(e[i],s)]:a})}return za({target:document.body,routes:{"/":()=>{},...r},wrapper:zi()})},t.Flex=pi,t.Footer=Ni,t.Form=xi,t.Grid=Qi,t.HTMLWrapper=_r,t.Header=Li,t.Logic=ct,t.Main=Di,t.Matrix=kn,t.Nav=Pi,t.PI=s,t.Permutation=lt,t.Random=dt,t.SPA=za,t.SVGWrapper=kr,t.Section=zi,t.Str=bn,t.Suspense=Er,t.Svg=Ea,t.Table=Si,t.Utils=nt,t.ZikoApp=Ua,t.ZikoCustomEvent=Ue,t.ZikoEventClick=Nt,t.ZikoEventClipboard=Vt,t.ZikoEventCustom=Yt,t.ZikoEventDrag=Xt,t.ZikoEventFocus=Jt,t.ZikoEventInput=Ce,t.ZikoEventKey=ie,t.ZikoEventMouse=oe,t.ZikoEventPointer=le,t.ZikoEventSwipe=De,t.ZikoEventTouch=pe,t.ZikoEventWheel=fe,t.ZikoHead=hs,t.ZikoMutationObserver=Fe,t.ZikoSPA=Pa,t.ZikoUIAbbrText=vs,t.ZikoUIArticle=Wi,t.ZikoUIAside=Yi,t.ZikoUIAudio=Jr,t.ZikoUIBlockQuote=Os,t.ZikoUIBr=Zr,t.ZikoUICanvas=Aa,t.ZikoUICodeText=xs,t.ZikoUIDefintion=bs,t.ZikoUIElement=ps,t.ZikoUIFigure=Yr,t.ZikoUIFlex=mi,t.ZikoUIFooter=Gi,t.ZikoUIForm=wi,t.ZikoUIGrid=Ki,t.ZikoUIHTMLWrapper=xr,t.ZikoUIHeader=$i,t.ZikoUIHeading=Zs,t.ZikoUIHr=Ur,t.ZikoUIHtmlTag=Sr,t.ZikoUIImage=qr,t.ZikoUIInput=Gs,t.ZikoUIInputCheckbox=nr,t.ZikoUIInputColor=er,t.ZikoUIInputDatalist=ai,t.ZikoUIInputDate=pr,t.ZikoUIInputDateTime=br,t.ZikoUIInputEmail=cr,t.ZikoUIInputImage=$r,t.ZikoUIInputNumber=Ks,t.ZikoUIInputOption=ni,t.ZikoUIInputPassword=ur,t.ZikoUIInputRadio=or,t.ZikoUIInputSearch=rr,t.ZikoUIInputSlider=Js,t.ZikoUIInputTime=fr,t.ZikoUILabel=ii,t.ZikoUILink=Rr,t.ZikoUIMain=Bi,t.ZikoUINav=Vi,t.ZikoUIParagraphe=Ms,t.ZikoUIQuote=gs,t.ZikoUISVGWrapper=vr,t.ZikoUISection=qi,t.ZikoUISelect=hi,t.ZikoUISubText=ws,t.ZikoUISupText=ys,t.ZikoUISuspense=Ir,t.ZikoUISvg=Ia,t.ZikoUIText=fs,t.ZikoUITextArea=li,t.ZikoUIVideo=Kr,t.ZikoUIXMLWrapper=wr,t.ZikoUseRoot=Qa,t.ZikoUseStyle=xe,t.__CACHE__=qa,t.__Config__=Va,t.__HYDRATION_MAP__=$a,t.__HYDRATION__=Ba,t.__UI__=Na,t.__ZikoEvent__=Ht,t.abbrText=Cs,t.abs=jn,t.accum=J,t.acos=Vn,t.acosh=Jn,t.acot=Yn,t.add=O,t.arange=B,t.arr2str=un,t.asin=qn,t.asinh=ta,t.atan=Wn,t.atan2=na,t.atanh=ea,t.audio=ti,t.bindClickEvent=$t,t.bindClipboardEvent=Wt,t.bindCustomEvent=(t,e,s)=>new Yt(t,e,s),t.bindDragEvent=Qt,t.bindFocusEvent=ee,t.bindHashEvent=(t,e)=>new se(t,e),t.bindKeyEvent=ae,t.bindMouseEvent=ce,t.bindPointerEvent=me,t.bindTouchEvent=(t,e)=>new pe(t,e),t.bindWheelEvent=be,t.blockQuote=js,t.br=Dr,t.brs=Pr,t.btn=Nr,t.cartesianProduct=st,t.ceil=sa,t.checkbox=ar,t.clamp=N,t.codeText=As,t.combinaison=mt,t.complex=On,t.cos=Pn,t.cosh=Gn,t.cot=$n,t.coth=Qn,t.count=wn,t.countWords=xn,t.csc=Bn,t.csv2arr=yt,t.csv2json=vt,t.csv2matrix=wt,t.csv2object=xt,t.csv2sql=_t,t.datalist=oi,t.default=to,t.defineParamsGetter=Ha,t.deg2rad=W,t.dfnText=Is,t.div=Z,t.e=Dn,t.fact=aa,t.figure=Gr,t.floor=ra,t.geomspace=q,t.getEvent=zt,t.h=Ar,t.h1=Us,t.h2=Rs,t.h3=Ds,t.h4=Ls,t.h5=Ps,t.h6=zs,t.hTags=Mr,t.hr=Lr,t.hrs=zr,t.html=Hr,t.hypot=ca,t.image=Wr,t.inRange=tt,t.input=Xs,t.inputCamera=ri,t.inputColor=sr,t.inputDate=dr,t.inputDateTime=yr,t.inputEmail=lr,t.inputImage=Vr,t.inputNumber=Qs,t.inputPassword=mr,t.inputTime=gr,t.isApproximatlyEqual=et,t.json2arr=Et,t.json2css=mn,t.json2csv=Tt,t.json2csvFile=At,t.json2xml=jt,t.json2xmlFile=Zt,t.json2yml=Ot,t.json2ymlFile=St,t.lerp=F,t.li=Vs,t.link=Fr,t.linspace=$,t.ln=Ln,t.logspace=V,t.map=H,t.mapfun=I,t.matrix=In,t.matrix2=En,t.matrix3=Tn,t.matrix4=An,t.max=Q,t.min=K,t.modulo=U,t.mul=j,t.norm=P,t.nums=L,t.obj2str=cn,t.ol=qs,t.ones=D,t.p=Ss,t.pgcd=rt,t.pow=Un,t.powerSet=ot,t.ppcm=it,t.preload=gt,t.prod=X,t.quote=ks,t.rad2deg=Y,t.radio=hr,t.removeExtraSpace=yn,t.round=ia,t.s=Cr,t.sTags=Or,t.search=ir,t.sec=Hn,t.select=ci,t.sig=ha,t.sign=oa,t.sin=zn,t.sinc=Nn,t.sinh=Xn,t.slider=tr,t.sqrt=Zn,t.sqrtn=Rn,t.str=vn,t.sub=S,t.subSet=null,t.subText=Ts,t.sum=G,t.supText=Es,t.svg2ascii=an,t.svg2img=hn,t.svg2imgUrl=on,t.svg2str=nn,t.tags=sn,t.tan=Fn,t.tanh=Kn,t.text=_s,t.textarea=ui,t.timeTaken=xa,t.time_memory_Taken=ga,t.ul=Ws,t.useAnimation=(t,e=fa.Linear,s=50,r)=>new _a(t,fa.Linear,50,r),t.useChannel=Xa,t.useCustomEvent=Re,t.useEventEmitter=es,t.useFavIcon=rs,t.useFps=ma,t.useHashEvent=je,t.useHead=cs,t.useInputEvent=Me,t.useLocaleStorage=(t,e)=>new Ja(localStorage,t,e),t.useMediaQuery=us,t.useMeta=ns,t.useRoot=(t,{namespace:e,register:s,ValidateCssProps:r}={})=>new Qa(t,{namespace:e,register:s,ValidateCssProps:r}),t.useSessionStorage=(t,e)=>new Ja(sessionStorage,t,e),t.useState=function(t){let e=t;const s=new Set;return[function(){return{value:e,isStateGetter:()=>!0,_subscribe:t=>s.add(t)}},function(t){"function"==typeof t&&(t=t(e)),t!==e&&(e=t,s.forEach((t=>t(e))))}]},t.useStyle=ve,t.useSuccesifKeys=Je,t.useSwipeEvent=Pe,t.useThread=(t,e,s)=>{const r=new Ka;return t&&r.call(t,e,s),r},t.useTimeLoop=pa,t.useTitle=os,t.video=Qr,t.wait=wa,t.waitForUIElm=ba,t.waitForUIElmSync=ya,t.watch=He,t.watchAttr=Be,t.watchChildren=Ve,t.watchIntersection=We,t.watchScreen=Ke,t.watchSize=Ge,t.zeros=R,Object.defineProperty(t,"__esModule",{value:!0})}));
package/dist/ziko.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Thu Aug 14 2025 10:09:49 GMT+0100 (UTC+01:00)
5
+ Date : Fri Aug 15 2025 09:48:20 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
@@ -1288,17 +1288,25 @@ function __addItem__(adder, pusher, ...ele) {
1288
1288
  }
1289
1289
  for (let i = 0; i < ele.length; i++) {
1290
1290
  if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
1291
- if (
1292
- typeof globalThis?.Node === "function" &&
1293
- ele[i] instanceof globalThis?.Node
1294
- )
1295
- ele[i] = new this.constructor(ele[i]);
1291
+ if (typeof globalThis?.Node === "function" && ele[i] instanceof globalThis?.Node) ele[i] = new this.constructor(ele[i]);
1296
1292
  if (ele[i]?.isZikoUIElement) {
1297
- ele[i].cache.parent = this;
1298
- this.element[adder](ele[i].element);
1299
- ele[i].target = this.element;
1300
- this.items[pusher](ele[i]);
1301
- } else if (ele[i] instanceof Object) {
1293
+ ele[i].cache.parent = this;
1294
+ this.element[adder](ele[i].element);
1295
+ ele[i].target = this.element;
1296
+ this.items[pusher](ele[i]);
1297
+ }
1298
+ // Fix Items Latter
1299
+ if( ele[i] instanceof Function){
1300
+ const getter = ele[i]();
1301
+ if (getter.isStateGetter) {
1302
+ const textNode = document?.createTextNode(getter.value);
1303
+ this.element.appendChild(textNode);
1304
+ getter._subscribe(
1305
+ (newValue) => (textNode.textContent = newValue),
1306
+ );
1307
+ }
1308
+ }
1309
+ else if (ele[i] instanceof Object) {
1302
1310
  if (ele[i]?.style) this.style(ele[i]?.style);
1303
1311
  if (ele[i]?.attr) {
1304
1312
  Object.entries(ele[i].attr).forEach((n) =>
@@ -8030,6 +8038,29 @@ const App={
8030
8038
  // ...Params
8031
8039
  };
8032
8040
 
8041
+ function useState(initialValue) {
8042
+ let value = initialValue;
8043
+ const subscribers = new Set();
8044
+
8045
+ function getValue() {
8046
+ return {
8047
+ value,
8048
+ isStateGetter: () => true,
8049
+ _subscribe: (fn) => subscribers.add(fn),
8050
+ };
8051
+ }
8052
+
8053
+ function setValue(newValue) {
8054
+ if (typeof newValue === "function") newValue = newValue(value);
8055
+ if (newValue !== value) {
8056
+ value = newValue;
8057
+ subscribers.forEach(fn => fn(value));
8058
+ }
8059
+ }
8060
+
8061
+ return [getValue, setValue];
8062
+ }
8063
+
8033
8064
  class ZikoUseChannel{
8034
8065
  constructor(name = ""){
8035
8066
  this.channel = new BroadcastChannel(name);
@@ -8331,4 +8362,4 @@ function RemoveAll(){
8331
8362
  Data.RemoveAll();
8332
8363
  }
8333
8364
 
8334
- export { App$1 as App, Article, Aside, Base, Canvas, Combinaison, Complex, E, EPSILON, Ease, FileBasedRouting, Flex, Footer, Form, Grid$1 as Grid, HTMLWrapper, Header, Logic$1 as Logic, Main, Matrix, Nav, PI$1 as PI, Permutation, Random, SPA, SVGWrapper, Section, Str, Suspense, Svg, Table$1 as Table, Utils$1 as Utils, ZikoApp, ZikoCustomEvent, ZikoEventClick, ZikoEventClipboard, ZikoEventCustom, ZikoEventDrag, ZikoEventFocus, ZikoEventInput, ZikoEventKey, ZikoEventMouse, ZikoEventPointer, ZikoEventSwipe, ZikoEventTouch, ZikoEventWheel, ZikoHead$1 as ZikoHead, ZikoMutationObserver, ZikoSPA, ZikoUIAbbrText, ZikoUIArticle, ZikoUIAside, ZikoUIAudio, ZikoUIBlockQuote, ZikoUIBr, ZikoUICanvas, ZikoUICodeText, ZikoUIDefintion, ZikoUIElement, ZikoUIFigure, ZikoUIFlex, ZikoUIFooter, ZikoUIForm, ZikoUIGrid, ZikoUIHTMLWrapper, ZikoUIHeader, ZikoUIHeading, ZikoUIHr, ZikoUIHtmlTag, ZikoUIImage, ZikoUIInput, ZikoUIInputCheckbox, ZikoUIInputColor, ZikoUIInputDatalist$1 as ZikoUIInputDatalist, ZikoUIInputDate, ZikoUIInputDateTime, ZikoUIInputEmail, ZikoUIInputImage, ZikoUIInputNumber, ZikoUIInputOption, ZikoUIInputPassword, ZikoUIInputRadio, ZikoUIInputSearch, ZikoUIInputSlider$1 as ZikoUIInputSlider, ZikoUIInputTime, ZikoUILabel, ZikoUILink, ZikoUIMain, ZikoUINav, ZikoUIParagraphe, ZikoUIQuote, ZikoUISVGWrapper, ZikoUISection, ZikoUISelect, ZikoUISubText, ZikoUISupText, ZikoUISuspense, ZikoUISvg, ZikoUIText, ZikoUITextArea, ZikoUIVideo, ZikoUIXMLWrapper, ZikoUseRoot, ZikoUseStyle, __CACHE__, __Config__, __HYDRATION_MAP__, __HYDRATION__, __UI__, __ZikoEvent__, abbrText, abs, accum, acos, acosh, acot, add, arange, arr2str, asin, asinh, atan, atan2, atanh, audio, bindClickEvent, bindClipboardEvent, bindCustomEvent, bindDragEvent, bindFocusEvent, bindHashEvent, bindKeyEvent, bindMouseEvent, bindPointerEvent, bindTouchEvent, bindWheelEvent, blockQuote, br, brs, btn, cartesianProduct, ceil, checkbox, clamp, codeText, combinaison, complex, cos, cosh, cot, coth, count, countWords, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, datalist, Ziko as default, defineParamsGetter, deg2rad, dfnText, div, e, fact, figure, floor, geomspace, getEvent, h, h1, h2, h3, h4, h5, h6, hTags, hr, hrs, html, hypot, image, inRange, input, inputCamera, inputColor, inputDate, inputDateTime, inputEmail, inputImage, inputNumber, inputPassword, inputTime, isApproximatlyEqual, json2arr, json2css, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, lerp, li, link, linspace, ln, logspace, map, mapfun$1 as mapfun, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, obj2str, ol, ones, p, pgcd, pow, powerSet, ppcm, preload, prod, quote, rad2deg, radio, removeExtraSpace, round, s, sTags, search, sec, select, sig, sign, sin, sinc, sinh, slider, sqrt, sqrtn, str, sub, subSet, subText, sum, supText, svg2ascii, svg2img, svg2imgUrl, svg2str, tags, tan, tanh, text, textarea, timeTaken, time_memory_Taken, ul, useAnimation, useChannel, useCustomEvent, useEventEmitter, useFavIcon$1 as useFavIcon, useFps, useHashEvent, useHead$1 as useHead, useInputEvent, useLocaleStorage, useMediaQuery, useMeta$1 as useMeta, useRoot, useSessionStorage, useStyle, useSuccesifKeys, useSwipeEvent, useThread, useTimeLoop, useTitle$1 as useTitle, video, wait, waitForUIElm, waitForUIElmSync, watch, watchAttr, watchChildren, watchIntersection, watchScreen, watchSize, zeros };
8365
+ export { App$1 as App, Article, Aside, Base, Canvas, Combinaison, Complex, E, EPSILON, Ease, FileBasedRouting, Flex, Footer, Form, Grid$1 as Grid, HTMLWrapper, Header, Logic$1 as Logic, Main, Matrix, Nav, PI$1 as PI, Permutation, Random, SPA, SVGWrapper, Section, Str, Suspense, Svg, Table$1 as Table, Utils$1 as Utils, ZikoApp, ZikoCustomEvent, ZikoEventClick, ZikoEventClipboard, ZikoEventCustom, ZikoEventDrag, ZikoEventFocus, ZikoEventInput, ZikoEventKey, ZikoEventMouse, ZikoEventPointer, ZikoEventSwipe, ZikoEventTouch, ZikoEventWheel, ZikoHead$1 as ZikoHead, ZikoMutationObserver, ZikoSPA, ZikoUIAbbrText, ZikoUIArticle, ZikoUIAside, ZikoUIAudio, ZikoUIBlockQuote, ZikoUIBr, ZikoUICanvas, ZikoUICodeText, ZikoUIDefintion, ZikoUIElement, ZikoUIFigure, ZikoUIFlex, ZikoUIFooter, ZikoUIForm, ZikoUIGrid, ZikoUIHTMLWrapper, ZikoUIHeader, ZikoUIHeading, ZikoUIHr, ZikoUIHtmlTag, ZikoUIImage, ZikoUIInput, ZikoUIInputCheckbox, ZikoUIInputColor, ZikoUIInputDatalist$1 as ZikoUIInputDatalist, ZikoUIInputDate, ZikoUIInputDateTime, ZikoUIInputEmail, ZikoUIInputImage, ZikoUIInputNumber, ZikoUIInputOption, ZikoUIInputPassword, ZikoUIInputRadio, ZikoUIInputSearch, ZikoUIInputSlider$1 as ZikoUIInputSlider, ZikoUIInputTime, ZikoUILabel, ZikoUILink, ZikoUIMain, ZikoUINav, ZikoUIParagraphe, ZikoUIQuote, ZikoUISVGWrapper, ZikoUISection, ZikoUISelect, ZikoUISubText, ZikoUISupText, ZikoUISuspense, ZikoUISvg, ZikoUIText, ZikoUITextArea, ZikoUIVideo, ZikoUIXMLWrapper, ZikoUseRoot, ZikoUseStyle, __CACHE__, __Config__, __HYDRATION_MAP__, __HYDRATION__, __UI__, __ZikoEvent__, abbrText, abs, accum, acos, acosh, acot, add, arange, arr2str, asin, asinh, atan, atan2, atanh, audio, bindClickEvent, bindClipboardEvent, bindCustomEvent, bindDragEvent, bindFocusEvent, bindHashEvent, bindKeyEvent, bindMouseEvent, bindPointerEvent, bindTouchEvent, bindWheelEvent, blockQuote, br, brs, btn, cartesianProduct, ceil, checkbox, clamp, codeText, combinaison, complex, cos, cosh, cot, coth, count, countWords, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, datalist, Ziko as default, defineParamsGetter, deg2rad, dfnText, div, e, fact, figure, floor, geomspace, getEvent, h, h1, h2, h3, h4, h5, h6, hTags, hr, hrs, html, hypot, image, inRange, input, inputCamera, inputColor, inputDate, inputDateTime, inputEmail, inputImage, inputNumber, inputPassword, inputTime, isApproximatlyEqual, json2arr, json2css, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, lerp, li, link, linspace, ln, logspace, map, mapfun$1 as mapfun, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, obj2str, ol, ones, p, pgcd, pow, powerSet, ppcm, preload, prod, quote, rad2deg, radio, removeExtraSpace, round, s, sTags, search, sec, select, sig, sign, sin, sinc, sinh, slider, sqrt, sqrtn, str, sub, subSet, subText, sum, supText, svg2ascii, svg2img, svg2imgUrl, svg2str, tags, tan, tanh, text, textarea, timeTaken, time_memory_Taken, ul, useAnimation, useChannel, useCustomEvent, useEventEmitter, useFavIcon$1 as useFavIcon, useFps, useHashEvent, useHead$1 as useHead, useInputEvent, useLocaleStorage, useMediaQuery, useMeta$1 as useMeta, useRoot, useSessionStorage, useState, useStyle, useSuccesifKeys, useSwipeEvent, useThread, useTimeLoop, useTitle$1 as useTitle, video, wait, waitForUIElm, waitForUIElmSync, watch, watchAttr, watchChildren, watchIntersection, watchScreen, watchSize, zeros };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ziko",
3
- "version": "0.36.2",
3
+ "version": "0.37.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",
@@ -75,17 +75,25 @@ function __addItem__(adder, pusher, ...ele) {
75
75
  }
76
76
  for (let i = 0; i < ele.length; i++) {
77
77
  if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
78
- if (
79
- typeof globalThis?.Node === "function" &&
80
- ele[i] instanceof globalThis?.Node
81
- )
82
- ele[i] = new this.constructor(ele[i]);
78
+ if (typeof globalThis?.Node === "function" && ele[i] instanceof globalThis?.Node) ele[i] = new this.constructor(ele[i]);
83
79
  if (ele[i]?.isZikoUIElement) {
84
- ele[i].cache.parent = this;
85
- this.element[adder](ele[i].element);
86
- ele[i].target = this.element;
87
- this.items[pusher](ele[i]);
88
- } else if (ele[i] instanceof Object) {
80
+ ele[i].cache.parent = this;
81
+ this.element[adder](ele[i].element);
82
+ ele[i].target = this.element;
83
+ this.items[pusher](ele[i]);
84
+ }
85
+ // Fix Items Latter
86
+ if( ele[i] instanceof Function){
87
+ const getter = ele[i]();
88
+ if (getter.isStateGetter) {
89
+ const textNode = document?.createTextNode(getter.value);
90
+ this.element.appendChild(textNode);
91
+ getter._subscribe(
92
+ (newValue) => (textNode.textContent = newValue),
93
+ );
94
+ }
95
+ }
96
+ else if (ele[i] instanceof Object) {
89
97
  if (ele[i]?.style) this.style(ele[i]?.style);
90
98
  if (ele[i]?.attr) {
91
99
  Object.entries(ele[i].attr).forEach((n) =>
package/src/use/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "./use-state.js"
1
2
  export * from './use-debounce.js';
2
3
  export * from './use-throttle.js';
3
4
 
@@ -21,7 +21,6 @@ class ZikoUseRoot {
21
21
  cssProp,
22
22
  this.currentPropsMap[prop]
23
23
  );
24
- console.log({cssProp})
25
24
  // Object.assign(this.pairs, {
26
25
  // [prop] : `var(--${this.namespace}-${prop})`
27
26
  // })
@@ -0,0 +1,22 @@
1
+ export function useState(initialValue) {
2
+ let value = initialValue;
3
+ const subscribers = new Set();
4
+
5
+ function getValue() {
6
+ return {
7
+ value,
8
+ isStateGetter: () => true,
9
+ _subscribe: (fn) => subscribers.add(fn),
10
+ };
11
+ }
12
+
13
+ function setValue(newValue) {
14
+ if (typeof newValue === "function") newValue = newValue(value);
15
+ if (newValue !== value) {
16
+ value = newValue;
17
+ subscribers.forEach(fn => fn(value));
18
+ }
19
+ }
20
+
21
+ return [getValue, setValue];
22
+ }