ziko 0.0.20 → 0.0.21
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 +317 -186
- package/dist/ziko.js +317 -186
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +314 -186
- package/package.json +2 -1
- package/src/math/functions/helper.js +30 -20
- package/src/math/functions/index.js +2 -1
- package/src/math/index.js +2 -2
- package/src/math/utils/mapfun.js +3 -2
- package/src/ui/elements/primitives/ZikoUIContainerElement.js +108 -149
- package/src/ui/elements/primitives/ZikoUIElement.js +119 -11
- package/src/ui/elements/primitives/misc/hyperscript.js +11 -0
- package/src/ui/elements/primitives/misc/index.js +3 -1
- package/src/ui/elements/primitives/misc/suspense.js +42 -0
- package/starter/bin/index.js +1 -1
- package/src/math/complex/Fractals/julia.js +0 -0
- package/src/ui/elements/derived/elements/Notification.js +0 -0
- package/src/ui/elements/derived/elements/Popover.js +0 -0
- package/src/ui/elements/derived/elements/Popup.js +0 -0
- package/src/ui/elements/derived/elements/Swipper.js +0 -4
- package/src/ui/elements/derived/elements/Timeline.js +0 -0
- package/src/ui/elements/derived/elements/Toast.js +0 -0
- package/src/ui/elements/derived/elements/Treeview.js +0 -0
- package/src/ui/elements/derived/elements/columns.js +0 -1
- package/src/ui/elements/derived/elements/fab.js +0 -0
- package/src/ui/elements/derived/elements/index.js +0 -9
package/dist/ziko.min.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Project: ziko.js
|
|
3
3
|
Author: Zakaria Elalaoui
|
|
4
|
-
Date :
|
|
4
|
+
Date : Sun Dec 08 2024 12:19:40 GMT+0100 (UTC+01:00)
|
|
5
5
|
Git-Repo : https://github.com/zakarialaoui10/ziko.js
|
|
6
6
|
Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
|
|
7
7
|
Released under MIT License
|
|
8
8
|
*/
|
|
9
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Ziko={})}(this,(function(t){"use strict";const{PI:e,E:s}=Math,i=Number.EPSILON;var r=Object.freeze({__proto__:null,E:s,EPSILON:i,PI:e});const n=t=>+Math.cos(t).toFixed(15),o=t=>+Math.sin(t).toFixed(15),a=t=>+Math.tan(t).toFixed(31),h=t=>+Math.sin(Math.PI*t)/(Math.PI*t),l=t=>1/Math.cos(t).toFixed(15),u=t=>1/Math.sin(t).toFixed(15),p=t=>1/Math.tan(t).toFixed(15),m=t=>+Math.acos(t).toFixed(15),g=t=>+Math.asin(t).toFixed(15),f=t=>+Math.atan(t).toFixed(15),b=t=>+Math.PI/2-Math.atan(t).toFixed(15),y=t=>+Math.cosh(t).toFixed(15),v=t=>+Math.sinh(t).toFixed(15),w=t=>+Math.tanh(t).toFixed(15),x=t=>+(.5*Math.log((1+t)/(1-t))).toFixed(15),k=t=>+Math.acosh(t).toFixed(15),_=t=>+Math.asinh(t).toFixed(15),C=t=>+Math.atanh(t).toFixed(15);class E{}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 ha)return new ha(e.rows,e.cols,I(e.arr.flat(1)));if(e instanceof ga){const[s,i,r,h]=[e.a,e.b,e.z,e.phi];switch(t){case Math.log:return fa(Ma(r),h);case Math.exp:return fa(Sa(s)*Oa(i),Sa(s)*ja(i));case Math.abs:return r;case Math.sqrt:return fa(Ia(r)*Oa(h/2),Ia(r)*ja(h/2));case n:return fa(Oa(s)*Fa(i),-ja(s)*Va(i));case o:return fa(ja(s)*Fa(i),Oa(s)*Va(i));case a:{const t=Oa(2*s)+Fa(2*i);return fa(ja(2*s)/t,Va(2*i)/t)}case y:return fa(Fa(s)*Oa(i),Va(s)*ja(i));case v:return fa(Va(s)*Oa(i),Fa(s)*ja(i));case w:{const t=Fa(2*s)+Oa(2*i);return fa(Va(2*s)/t,ja(2*i)/t)}default:return t(e)}}else if(e instanceof Object)return Object.fromEntries(Object.entries(e).map((e=>[e[0],I(t,e[1])])))}));return 1==s.length?s[0]:s},T=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t+e;if(e instanceof ga)return fa(t+e.a,e.b);if(e instanceof ha)return ha.nums(e.rows,e.cols,t).add(e);if(e instanceof Array)return e.map((e=>j(e,t)))}else{if(t instanceof ga||t instanceof ha)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=>j(t,e)));if(t.length===e.length)return t.map(((t,s)=>j(t,e[s])))}}},A=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t-e;if(e instanceof ga)return fa(t-e.a,-e.b);if(e instanceof ha)return ha.nums(e.rows,e.cols,t).sub(e);if(e instanceof Array)return e.map((e=>D(e,t)))}else{if(t instanceof ga||t instanceof ha)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=>D(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>D(t,e[s])))}}},S=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t*e;if(e instanceof ga)return fa(t*e.a,t*e.b);if(e instanceof ha)return ha.nums(e.rows,e.cols,t).mul(e);if(e instanceof Array)return e.map((e=>Z(t,e)))}else{if(t instanceof ga||t instanceof ha)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=>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 ga)return fa(t/e.a,t/e.b);if(e instanceof ha)return ha.nums(e.rows,e.cols,t).div(e);if(e instanceof Array)return e.map((e=>P(t,e)))}else{if(t instanceof ga||t instanceof ha)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=>P(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>P(t,e[s])))}}},O=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t%e;if(e instanceof ga)return fa(t%e.a,t%e.b);if(e instanceof ha)return ha.nums(e.rows,e.cols,t).modulo(e);if(e instanceof Array)return e.map((e=>P(t,e)))}else{if(t instanceof ga||t instanceof ha)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=>j(t,e)))}},j=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=T(s,e[t]);return s},D=(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=S(s,e[t]);return s},P=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=M(s,e[t]);return s},L=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=O(s,e[t]);return s},U=t=>new Array(t).fill(0),R=t=>new Array(t).fill(1),$=(t,e)=>new Array(e).fill(t),N=(t,e,s)=>{if("number"==typeof t)return e!==s?(t-e)/(s-e):0;if(t instanceof ha)return new ha(t.rows,t.cols,N(t.arr.flat(1),e,s));if(t instanceof ga)return new ga(N(t.a,e,s),N(t.b,e,s));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>N(t,e,s)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=N(t[s])}}},F=(t,e,s)=>{if("number"==typeof t)return(s-e)*t+e;if(t instanceof ha)return new ha(t.rows,t.cols,F(t.arr.flat(1),e,s));if(t instanceof ga)return new ga(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])}}},V=(t,e,s,i,r)=>{if("number"==typeof t)return F(N(t,e,s),i,r);if(t instanceof ha)return new ha(t.rows,t.cols,V(t.arr.flat(1),e,s,i,r));if(t instanceof ga)return new ga(V(t.a,s,i,r),V(t.b,e,s,i,r));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>V(t,e,s,i,r)));{let n=new Array(t.length);for(let o=0;o<t.length;o++)n[o]=V(t[o],e,s,i,r)}}},B=(t,e,s)=>{const[i,r]=[J(e,s),tt(e,s)];if("number"==typeof t)return J(tt(t,i),r);if(t instanceof ha)return new ha(t.rows,t.cols,B(t.arr.flat(1),i,r));if(t instanceof ga)return new ga(B(t.a,i,r),B(t.b,i,r));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>B(t,i,r)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=B(t[s],i,r)}}},H=(t,e,s,i=!1)=>{let r=[];if(t<e)for(let n=t;i?n<=e:n<e;n+=s)r.push(10*n/10);else for(let n=t;i?n>=e:n>e;n-=s)r.push(10*n/10);return r},W=(t,e,s=Ea(e-t)+1,i=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[o,a]=[t,e].sort(((t,e)=>e-t));var r=[];let h;h=i?(o-a)/(s-1):(o-a)/s;for(var n=0;n<s;n++)t<e?r.push(a+h*n):r.push(o-h*n);return r}if([t,e].some((t=>t instanceof ga))){const r=fa(t),n=fa(e);s=s||Math.abs(r.a-n.a)+1;const o=W(r.a,n.a,s,i),a=W(r.b,n.b,s,i);let h=new Array(s).fill(null);return h=h.map(((t,e)=>fa(o[e],a[e]))),h}}},X=(t,e,i=e-t+1,r=s,n=!0)=>W(t,e,i,n).map((t=>Ta(r,t))),q=(t,e,s=Ea(e-t)+1,i=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[r,n]=[t,e].sort(((t,e)=>e-t));let o;o=Aa(r/n,i?s-1:s);const a=[n];for(let t=1;t<s;t++)a.push(a[t-1]*o);return t<e?a:a.reverse()}if([t,e].some((t=>t instanceof ga))){const r=fa(t),n=fa(e);let o;s=s||Math.abs(r.a-n.a)+1,o=Aa(n.div(r),i?s-1:s);const a=[r];for(let t=1;t<s;t++)a.push(Z(a[t-1],o));return a}}},Y=(...t)=>mapfun((t=>t*Math.PI/180),...t),G=(...t)=>mapfun((t=>t/Math.PI*180),...t),K=(...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(K(...t[s])):t[s]instanceof Object&&e.push(K(...Object.values(t[s])));return 1===e.length?e[0]:e},Q=(...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(Q(...t[s])):t[s]instanceof Object&&e.push(Q(...Object.values(t[s])));return 1===e.length?e[0]:e},J=(...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(J(...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},tt=(...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(J(...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},et=(...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(et(...t[s])):t[s]instanceof Object&&e.push(null);return 1===e.length?e[0]:e},st=(t,e,s)=>{const[i,r]=[Math.min(e,s),Math.max(e,s)];return t>=i&&t<=r},it=(t,e,s=1e-4)=>Math.abs(t-e)<=s,rt=(t,e)=>t.reduce(((t,s)=>[...t,...e.map((t=>[s,t]))]),[]),nt=(t,e)=>{let s,i=1;if(t==Ga(t)&&e==Ga(e)){for(s=2;s<=t&&s<=e;++s)t%s==0&&e%s==0&&(i=s);return i}console.log("error")},ot=(t,e)=>{let s;if(t==Ga(t)&&e==Ga(e)){for(s=t>e?t:e;s%t!=0||s%e!=0;)++s;return s}console.log("error")},at={add:j,sub:D,mul:Z,div:P,modulo:L,zeros:U,ones:R,nums:$,norm:N,lerp:F,map:V,clamp:B,arange:H,linspace:W,logspace:X,geomspace:q,sum:K,prod:Q,accum:et,cartesianProduct:rt,ppcm:ot,pgcd:nt,deg2rad:Y,rad2deg:G,inRange:st,isApproximatlyEqual:it};var ht=Object.freeze({__proto__:null,Utils:at,add:j,arange:H,cartesianProduct:rt,clamp:B,deg2rad:Y,div:P,geomspace:q,inRange:st,isApproximatlyEqual:it,lerp:F,linspace:W,logspace:X,map:V,mapfun:I,modulo:L,mul:Z,norm:N,nums:$,ones:R,pgcd:nt,ppcm:ot,prod:Q,rad2deg:G,sub:D,sum:K,zeros:U});const lt=t=>{const e=[],s=2**t.length;for(let i=0;i<s;i+=1){const s=[];for(let e=0;e<t.length;e+=1)i&1<<e&&s.push(t[e]);e.push(s)}return e},ct={_mode:Number,_map:function(t,e,s){return e instanceof ha?new ha(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof ga?new ga(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],i=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))*i},IEEE64toDec(t){let e=t.split(" ").join("").padEnd(64,"0"),s=e[0],i=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))*i}},ut={_mode:Number,_map:function(t,e,s){return e instanceof ha?new ha(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof ga?new ga(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)?ut._mode(!t):this._map(this.not,t)},and:function(t,...e){return["number","boolean"].includes(typeof t)?ut._mode(e.reduce(((t,e)=>t&e),t)):this._map(this.and,t,e)},or:function(t,...e){return["number","boolean"].includes(typeof t)?ut._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 ut.not(ut.xor(t,e))}};class pt{static withDiscount(t,e=t.length){if(1===e)return t.map((t=>[t]));const s=[];let i;return i=this.withDiscount(t,e-1),t.forEach((t=>{i.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)),i=t[0];for(let t=0;t<s.length;t++){const r=s[t];for(let t=0;t<=r.length;t++){const s=r.slice(0,t),n=r.slice(t);e.push(s.concat([i],n))}}return e}}class dt{static withDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((i,r)=>{this.withDiscount(t.slice(r),e-1).forEach((t=>{s.push([i].concat(t))}))})),s}static withoutDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((i,r)=>{this.withoutDiscount(t.slice(r+1),e-1).forEach((t=>{s.push([i].concat(t))}))})),s}}const mt=(t,e,s=!1)=>dt[s?"withDiscount":"withoutDiscount"](t,e);var gt=Object.freeze({__proto__:null,Base:ct,Combinaison:dt,Logic:ut,Permutation:pt,combinaison:mt,powerSet:lt,subSet:null});class ft{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=at.accum(...e).map((t=>100*t)),s.fill(t[0],0,e[0]);for(let i=1;i<t.length;i++)s.fill(t[i],e[i-1],e[i]);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:i}=t;return la(e,s,i.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"#"+ct.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 ga(this.float(t[0],t[1]),this.float(e[0],e[1])):new ga(...this.floats(2,t,e))}static complexInt(t=[0,1],e=[0,1]){return new ga(this.int(t[0],t[1]),this.int(e[0],e[1]))}static complexBin(){return new ga(...this.bins(2))}static complexOct(){return new ga(...this.octs(2))}static complexDec(){return new ga(...this.decs(10))}static complexHex(){return new ga(...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,i){return la(t,e,this.floats(t*e,s,i))}static matrixInt(t,e,s,i){return la(t,e,this.ints(t*e,s,i))}static matrixBin(t,e){return la(t,e,this.bins(t*e))}static matrixOct(t,e){return la(t,e,this.octs(t*e))}static matrixDec(t,e){return la(t,e,this.decs(t*e))}static matrixHex(t,e){return la(t,e,this.hex(t*e))}static matrixColor(t,e){return la(t,e,this.colors(t*e))}static matrixComplex(t,e,s,i){return la(t,e,this.complexes(t*e,s,i))}static matrixComplexInt(t,e,s,i){return la(t,e,this.complexesInt(t*e,s,i))}static matrixComplexBin(t,e){return la(t,e,this.complexesBin(t*e))}static matrixComplexOct(t,e){return la(t,e,this.complexesBin(t*e))}static matrixComplexDec(t,e){return la(t,e,this.complexesBin(t*e))}static matrixComplexHex(t,e){return la(t,e,this.complexesBin(t*e))}}const bt=t=>{t instanceof ha&&(t=t.arr);const e=t.length,s=new Array(e).fill(0).map((()=>new Array(e).fill(0))),i=new Array(e).fill(0).map((()=>new Array(e).fill(0)));for(let r=0;r<e;r++){for(let n=r;n<e;n++){let e=0;for(let t=0;t<r;t++)e+=s[r][t]*i[t][n];i[r][n]=t[r][n]-e}for(let n=r;n<e;n++)if(r==n)s[r][r]=1;else{let e=0;for(let t=0;t<r;t++)e+=s[n][t]*i[t][r];s[n][r]=(t[n][r]-e)/i[r][r]}}return[s,i].map((t=>new ha(t)))},yt=(t,e)=>t.reduce(((t,s,i)=>t+s*e[i]),0),vt=t=>Math.sqrt(t.reduce(((t,e)=>t+e*e),0)),wt=t=>t.map((e=>e/vt(t))),xt=t=>{t instanceof ha&&(t=t.arr);const e=t.length,s=t[0].length,i=[],r=[];for(let t=0;t<e;t++)r.push(new Array(s).fill(0));for(let n=0;n<s;n++){let s=t.map((t=>t[n]));for(let o=0;o<n;o++){const a=i[o],h=yt(a,t.map((t=>t[n])));for(let t=0;t<e;t++)s[t]-=h*a[t];r[o][n]=h}const o=vt(s);i.push(wt(s)),r[n][n]=o}return[i,r].map((t=>new ha(t)))},kt=t=>{t instanceof ha&&(t=t.arr);const e=t.length,s=new Array(e).fill(0).map((()=>new Array(e).fill(0)));for(let i=0;i<e;i++)for(let e=0;e<=i;e++){let r=0;for(let t=0;t<e;t++)r+=s[i][t]*s[e][t];s[i][e]=i===e?Math.sqrt(t[i][i]-r):1/s[e][e]*(t[i][e]-r)}return new ha(s)},_t=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=_t(t);return(new DOMParser).parseFromString(e,"text/xml").documentElement};var Ct=Object.freeze({__proto__:null,preload:_t});const Et=t=>t.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/\[(.*?)\]\((.*?)\)/g,'<a href="$2">$1</a>').replace(/!\[(.*?)\]\((.*?)\)/g,'<img src="$2" alt="$1">').replace(/`([^`]+)`/g,"<code>$1</code>"),It=t=>`<tr>${t.split("|").map((t=>t.trim())).filter((t=>""!==t)).map((t=>`<td>${Et(t)}</td>`)).join("")}</tr>\n`,Tt=(t,e)=>{const s=t.join("\n");return`${e?`<pre><code data-language="${e}">${s}</code></pre>`:`<pre><code>${s}</code></pre>`}\n`},At=t=>{const e=t.match(/^\d+\.\s/);if(e){let s=+e[1];return`<ol${1===s?"":` start="${s}"`}>${Et(t.slice(e[0].length))}</ol>\n`}return`<ul>${Et(t)}</ul>\n`},St=t=>{const e=t.split("\n");let s="",i=!1,r=!1,n=[],o="";for(let t=0;t<e.length;t++){let a=e[t];if(a.startsWith("|"))i||(i=!0,s+="<table>\n"),s+=It(a);else if(i&&(i=!1,s+="</table>\n"),a.startsWith("```"))r?(r=!1,s+=Tt(n,o)):(r=!0,n=[],o=a.slice(3).trim());else if(r)n.push(a);else if(a.startsWith("# ")){const t=a.indexOf(" "),e=a.slice(t+1);s+=`<h${t}>${Et(e)}</h${t}>\n`}else a.startsWith("- ")||a.startsWith("* ")||a.match(/^\d+\.\s/)?s+=At(a):"---"!==a.trim()?s+=`<p>${Et(a)}</p>\n`:s+="<hr>\n"}return s},Mt=t=>t.replace(/\*(.*?)\*/g,"_$1_").replace(/\*\*(.*?)\*\*/g,"*$1*").replace(/\[(.*?)\]\((.*?)\)/g,"link:$2[$1]").replace(/!\[(.*?)\]\((.*?)\)/g,"image::$2[$1]").replace(/`([^`]+)`/g,"``$1``").replace(/^\*\s/,""),Ot=t=>`<tr>${t.split("|").map((t=>t.trim())).filter((t=>""!==t)).map((t=>`<td>${Mt(t)}</td>`)).join("")}</tr>\n`,jt=(t,e)=>{const s=t.join("\n");return`${e?`<pre><code data-language="${e}">${s}</code></pre>`:`<pre><code>${s}</code></pre>`}\n`},Dt=t=>{const e=/^(\d+)\.\s/,s=/^[.]\s/,i=/^[*]\s/;if(t.match(e)){return`<ol start="${t.match(e)[1]}"><li>${Mt(t.replace(e,""))}</li></ol>\n`}return t.match(s)?`<ol><li>${Mt(t.replace(s,""))}</li></ol>\n`:t.match(i)?`<ul><li>${Mt(t.replace(i,""))}</li></ul>\n`:`<p>${Mt(t)}</p>\n`},Zt=t=>`<blockquote>${Mt(t.slice(2))}</blockquote>\n`,Pt=t=>{const e=t.match(/\[(.*?)\]/);return e?e[1].split(",").map((t=>`[${t.trim()}]`)).join(""):""},Lt=t=>{const e=t.split("\n");let s="",i=!1,r=!1,n=[],o="";for(let t=0;t<e.length;t++){let a=e[t];if(a.startsWith("|"))i||(i=!0,s+="<table>\n"),s+=Ot(a);else if(i&&(i=!1,s+="</table>\n"),a.startsWith("```"))r?(r=!1,s+=jt(n,o)):(r=!0,n=[],o=a.slice(3).trim());else if(r)n.push(a);else if(a.startsWith("=")){const t=(a.match(/=/g)||[]).length,e=a.replace(/=/g,"").trim();s+=`<h${t}>${Mt(e)}</h${t}>\n`}else a.match(/^(\d+)\.\s/)||a.match(/^[*\.]\s/)?s+=Dt(a):a.startsWith("> ")?s+=Zt(a):"---"!==a.trim()?a.startsWith("[")?s+=Pt(a):""!==a.trim()&&(s+=`<p>${Mt(a)}</p>\n`):s+="<hr>\n"}return s},Ut=(t,e=",")=>t.trim().trimEnd().split("\n").map((t=>t.split(e))),Rt=(t,e=",")=>new ha(Ut(t,e)),zt=(t,e=",")=>{const[s,...i]=Ut(t,e);return i.map((t=>{const e={};return s.forEach(((s,i)=>{e[s]=t[i]})),e}))},$t=(t,e=",")=>JSON.stringify(zt(t,e)),Nt=(t,e)=>{const s=t.trim().trimEnd().split("\n").filter((t=>t));let i=`INSERT INTO ${e} (${s[0].split(",").join(", ")}) Values `,r=[];for(let t=1;t<s.length;t++){const e=s[t].split(",");r.push(`(${e})`)}return i+r.join(",\n")},Ft=t=>t instanceof Array?[Object.keys(t[0]),...t.map((t=>Object.values(t)))]:[Object.keys(t)],Vt=(t,e)=>Ft(t).map((t=>t.join(e))).join("\n"),Bt=t=>Ft(t instanceof Object?t:JSON.parse(t)),Ht=(t,e=",")=>Vt(t instanceof Object?t:JSON.parse(t),e),Wt=(t,e)=>{const s=Ht(t,e),i=new Blob([s],{type:"text/csv;charset=utf-8;"});return{str:s,blob:i,url:URL.createObjectURL(i)}},Xt=(t,e)=>{const s=[];if(Array.isArray(t))t.forEach((t=>{if("object"==typeof t&&null!==t){s.push(`${e}-`);const i=Xt(t,`${e} `);s.push(...i)}else s.push(`${e}- ${t}`)}));else for(const i in t)if(t.hasOwnProperty(i)){const r=t[i];if("object"==typeof r&&null!==r){s.push(`${e}${i}:`);const t=Xt(r,`${e} `);s.push(...t)}else s.push(`${e}${i}: ${r}`)}return s},qt=(t,e="")=>Xt(t,e).join("\n"),Yt=(t,e)=>qt(t instanceof Object?t:JSON.parse(t),e),Gt=(t,e)=>{const s=Yt(t,e),i=new Blob([s],{type:"text/yml;charset=utf-8;"});return{str:s,blob:i,url:URL.createObjectURL(i)}},Kt=(t,e=1)=>{let s="";for(const i in t)if(t.hasOwnProperty(i)){const r=t[i];s+="\n"+" ".repeat(e)+`<${i}>`,s+="object"==typeof r?Kt(r,e+2):`${r}`,s+=`</${i}>`}return s.trim()},Qt=(t,e)=>{const s=Kt(t,e),i=new Blob([s],{type:"text/xml;charset=utf-8;"});return{str:s,blob:i,url:URL.createObjectURL(i)}};let Jt=class{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}#t(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}#e(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}#s(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.#t(t):"string"==typeof t?this.#e(t):t&&"object"==typeof t?this.#s(t):this}};const te=(t,e="px")=>("number"==typeof t&&(t+=e),t instanceof Array&&(t=t.map((t=>"number"==typeof t?t+=e:t)).join(" ")),t);class ee{constructor(t={}){this.target=null,this.styles=new Map([["default",t]]),this.cache={isHidden:!1,isFaddedOut:!1,transformation:{Flip:[0,0,0],matrix:new ha([[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))sa.isCamelCase(e)&&(delete t[e],Object.assign(t,{[sa.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=te(e,"px"),s=te(s,"px"),this.style({minWidth:e,maxWidth:s},{target:target,maskVector:maskVector})}}else t=te(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=te(e,"px"),s=te(s,"px"),this.style({minHeight:e,maxHeight:s},{target:target,maskVector:maskVector})}}else t=te(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 i=()=>this.hide({target:e,maskVector:s});setTimeout(i,t),clearTimeout(i)}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 i=()=>this.show({target:e,maskVector:s});setTimeout(i,t),clearTimeout(i)}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=te(t,"px"),this.style({borderRadius:t},{target:target,maskVector:maskVector}),this}margin(t){return t=te(t,"px"),this.style({margin:t},{target:target,maskVector:maskVector}),this}marginTop(t){return t=te(t,"px"),this.style({marginTop:t}),this}marginRight(t){return t=te(t,"px"),this.style({marginRight:t}),this}marginBootom(t){return t=te(t,"px"),this.style({marginBootom:t}),this}marginLeft(t){return t=te(t,"px"),this.style({marginLeft:t}),this}padding(t){return t=te(t,"px"),this.style({padding:t}),this}paddingTop(t){return t=te(t,"px"),this.style({paddingTop:t}),this}paddingRight(t){return t=te(t,"px"),this.style({paddingRight:t}),this}paddingBootom(t){return t=te(t,"px"),this.style({paddingBootom:t}),this}paddingLeft(t){return t=te(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,i=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(i),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,Oa(t)),this.cache.transformation.matrix.set(1,2,-ja(t)),this.cache.transformation.matrix.set(2,1,ja(t)),this.cache.transformation.matrix.set(1,2,Oa(t)),this.#i(e),this}rotateY(t,e=0){return this.cache.transformation.matrix.set(0,0,Oa(t)),this.cache.transformation.matrix.set(0,2,ja(t)),this.cache.transformation.matrix.set(2,0,-ja(t)),this.cache.transformation.matrix.set(2,2,Oa(t)),this.#i(e),this}rotateZ(t,e=0){return this.cache.transformation.matrix.set(0,0,Oa(t)),this.cache.transformation.matrix.set(0,1,-ja(t)),this.cache.transformation.matrix.set(1,0,ja(t)),this.cache.transformation.matrix.set(1,1,Oa(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 i=()=>{this.style({opacity:"none"})};return this.target?.element?.addEventListener("transitionend",i),this.target?.element?.removeEventListener("transitionend",i),this}}function se(t,e,s,i){return this.event=t,this.cache.preventDefault[e]&&t.preventDefault(),s&&s(),this.cache.stream.enabled[e]&&i&&this.cache.stream.history[e].push(i),this.cache.callbacks[e].map((t=>t(this))),this}class ie{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 i="drag"===t?t:`${this.cache.prefixe}${t}`;return this.dispose(s),this.targetElement?.addEventListener(i,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 re(t){se.call(this,t,"click",null,null)}function ne(t){se.call(this,t,"dbclick",null,null)}class oe extends ie{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{click:!1,dbclick:!1},paused:{click:!1,dbclick:!1},stream:{enabled:{click:!1,dbclick:!1},clear:{click:!1,dbclick:!1},history:{click:[],dbclick:[]}},callbacks:{click:[],dbclick:[]}},this.__controller={click:re.bind(this),dbclick:ne.bind(this)}}onClick(...t){return this.__onEvent("click",{},...t),this}onDbClick(...t){return this.__onEvent("dbclick",{},...t),this}}const ae=t=>new oe(t);function he(t){se.call(this,t,"down",(()=>{this.dx=parseInt(t.offsetX),this.dy=parseInt(t.offsetY),this.isDown=!0}),{x:this.dx,y:this.dy,t:Date.now()-this.cache.stream.t0})}function le(t){se.call(this,t,"move",(()=>{this.mx=parseInt(t.offsetX),this.my=parseInt(t.offsetY),this.isMoving=!0}),{x:this.mx,y:this.my,t:Date.now()-this.cache.stream.t0})}function ce(t){se.call(this,t,"up",(()=>{this.ux=parseInt(t.offsetX),this.uy=parseInt(t.offsetY),this.isDown=!1;const e=this.dx,s=this.dy,i=this.ux,r=this.uy,n=(i-e)/this.target.Width,o=(s-r)/this.target.Height,a=n<0?"left":n>0?"right":"none",h=o<0?"bottom":o>0?"top":"none";this.swippe={h:a,v:h,delta_x:n,delta_y:o}}),{x:this.ux,y:this.uy,t:Date.now()-this.cache.stream.t0})}function ue(t){se.call(this,t,"enter",null,null)}function pe(t){se.call(this,t,"leave",null,null)}function de(t){se.call(this,t,"out",null,null)}function me(t){se.call(this,t,"cancel",null,null)}class ge extends ie{constructor(t){super(t),this.event=null,this.dx=0,this.dy=0,this.dt=0,this.mx=0,this.my=0,this.mt=0,this.ux=0,this.uy=0,this.ut=0,this.swippe={h:null,v:null,delta_x:0,delta_y:0},this.isMoving=!1,this.isDown=!1,this.cache={prefixe:"pointer",preventDefault:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,cancel:!1},paused:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,cancel:!1},stream:{enabled:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,cancel:!1},clear:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,cancel:!1},history:{down:[],move:[],up:[],enter:[],out:[],leave:[]}},callbacks:{down:[t=>console.log({dx:t.dx,dy:t.dy,down:t.down,move:t.move,t:t.dt})],move:[t=>console.log({mx:t.mx,my:t.my,down:t.down,move:t.move,t:t.dt})],up:[t=>console.log({ux:t.ux,uy:t.uy,down:t.down,move:t.move,t:t.dt})],enter:[t=>console.log({dx:t.dx,dy:t.dy,down:t.down,move:t.move,t:t.dt})],out:[t=>console.log({mx:t.mx,my:t.my,down:t.down,move:t.move,t:t.dt})],leave:[t=>console.log({ux:t.ux,uy:t.uy,down:t.down,move:t.move,t:t.dt})],cancel:[t=>console.log({ux:t.ux,uy:t.uy,down:t.down,move:t.move,t:t.dt})]}},this.__controller={down:he.bind(this),move:le.bind(this),up:ce.bind(this),enter:ue.bind(this),out:de.bind(this),leave:pe.bind(this),cancel:me.bind(this)}}onDown(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("down",{down:!0,move:!1,up:!1,enter:!1,out:!1,leave:!1,cancel:!1},...t),this}onMove(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("move",{down:!1,move:!0,up:!1,enter:!1,out:!1,leave:!1,cancel:!1},...t),this}onUp(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("up",{down:!1,move:!1,up:!0,enter:!1,out:!1,leave:!1,cancel:!1},...t),this}onEnter(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("enter",{down:!1,move:!1,up:!1,enter:!0,out:!1,leave:!1,cancel:!1},...t),this}onOut(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("out",{down:!1,move:!1,up:!1,enter:!1,out:!0,leave:!1,cancel:!1},...t),this}onLeave(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("leave",{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!0,cancel:!1},...t),this}onCancel(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("cancel",{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,cancel:!0},...t),this}}var fe=t=>new ge(t);class be extends ie{constructor(t){super(t),this.event=null,this.dx=0,this.dy=0,this.dt=0,this.mx=0,this.my=0,this.mt=0,this.ux=0,this.uy=0,this.ut=0,this.swippe={h:null,v:null,delta_x:0,delta_y:0},this.isMoving=!1,this.isDown=!1,this.cache={prefixe:"mouse",preventDefault:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,over:!1},paused:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,over:!1},stream:{enabled:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,over:!1},clear:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,over:!1},history:{down:[],move:[],up:[],enter:[],out:[],leave:[],over:[]}},callbacks:{down:[t=>console.log({dx:t.dx,dy:t.dy,down:t.down,move:t.move,t:t.dt})],move:[t=>console.log({mx:t.mx,my:t.my,down:t.down,move:t.move,t:t.dt})],up:[t=>console.log({ux:t.ux,uy:t.uy,down:t.down,move:t.move,t:t.dt})],enter:[t=>console.log({dx:t.dx,dy:t.dy,down:t.down,move:t.move,t:t.dt})],out:[t=>console.log({mx:t.mx,my:t.my,down:t.down,move:t.move,t:t.dt})],leave:[t=>console.log({ux:t.ux,uy:t.uy,down:t.down,move:t.move,t:t.dt})],over:[t=>console.log({ux:t.ux,uy:t.uy,down:t.down,move:t.move,t:t.dt})]}},this.__controller={down:ye.bind(this),move:ve.bind(this),up:we.bind(this),enter:xe.bind(this),out:_e.bind(this),leave:ke.bind(this),over:Ce.bind(this)}}onDown(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("down",{down:!0,move:!1,up:!1,enter:!1,out:!1,leave:!1,over:!1},...t),this}onMove(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("move",{down:!1,move:!0,up:!1,enter:!1,out:!1,leave:!1,over:!1},...t),this}onUp(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("up",{down:!1,move:!1,up:!0,enter:!1,out:!1,leave:!1,over:!1},...t),this}onEnter(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("enter",{down:!1,move:!1,up:!1,enter:!0,out:!1,leave:!1,over:!1},...t),this}onOut(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("out",{down:!1,move:!1,up:!1,enter:!1,out:!0,leave:!1,over:!1},...t),this}onLeave(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("leave",{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!0,over:!1},...t),this}onOver(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("over",{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,over:!0},...t),this}}function ye(t){se.call(this,t,"down",(()=>{this.dx=parseInt(t.offsetX),this.dy=parseInt(t.offsetY),this.isDown=!0}),{x:this.dx,y:this.dy,t:Date.now()-this.cache.stream.t0})}function ve(t){se.call(this,t,"move",(()=>{this.mx=parseInt(t.offsetX),this.my=parseInt(t.offsetY),this.isMoving=!0}),{x:this.mx,y:this.my,t:Date.now()-this.cache.stream.t0})}function we(t){se.call(this,t,"up",(()=>{this.ux=parseInt(t.offsetX),this.uy=parseInt(t.offsetY),this.isDown=!1;const e=this.dx,s=this.dy,i=this.ux,r=this.uy,n=(i-e)/this.target.Width,o=(s-r)/this.target.Height,a=n<0?"left":n>0?"right":"none",h=o<0?"bottom":o>0?"top":"none";this.swippe={h:a,v:h,delta_x:n,delta_y:o}}),{x:this.ux,y:this.uy,t:Date.now()-this.cache.stream.t0})}function xe(t){se.call(this,t,"enter",null,null)}function ke(t){se.call(this,t,"leave",null,null)}function _e(t){se.call(this,t,"out",null,null)}function Ce(t){se.call(this,t,"out",null,null)}const Ee=t=>new be(t);function Ie(t){se.call(this,t,"wheel",null,null)}class Te extends ie{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{wheel:!1},paused:{wheel:!1},stream:{enabled:{wheel:!1},clear:{wheel:!1},history:{wheel:[]}},callbacks:{click:[]}},this.__controller={wheel:Ie.bind(this)}}onWheel(...t){return this.__onEvent("wheel",{},...t),this}}const Ae=t=>new Te(t);function Se(t){se.call(this,t,"down",(()=>this.kd=t.key),{key:t.key,t:10})}function Me(t){se.call(this,t,"press",(()=>this.kp=t.key),{key:t.key,t:10})}function Oe(t){se.call(this,t,"up",(()=>this.ku=t.key),{key:t.key,t:10})}class je extends ie{constructor(t){super(t),this.kp=null,this.kd=null,this.ku=null,this.t=0,this.cache={prefixe:"key",preventDefault:{down:!1,press:!1,up:!1},paused:{down:!1,press:!1,up:!1},stream:{enabled:{down:!1,press:!1,up:!1},clear:{down:!0,press:!1,up:!1},history:{down:[],press:[],up:[]}},callbacks:{down:[t=>console.log({kd:t.kd})],press:[t=>console.log({kp:t.kp})],up:[t=>console.log({ku:t.ku})]},successifKeysCallback:{down:[t=>console.log(1111)],press:[t=>console.log(1112)],kyup:[t=>console.log(1113)]}},this.__controller={down:Se.bind(this),press:Me.bind(this),up:Oe.bind(this)}}onDown(...t){return this.__onEvent("down",{down:!0},...t),this}onPress(...t){return this.__onEvent("press",{press:!0},...t),this}onUp(...t){return this.__onEvent("up",{up:!0},...t),this}}var De=t=>new je(t);function Ze(t){se(this,t,"start",null)}function Pe(t){se.call(this,t,"drag",null,null)}function Le(t){se.call(this,t,"end",null,null)}function Ue(t){se.call(this,t,"drop",null,null)}class Re extends ie{constructor(t){super(t),this.target.setAttribute("draggable",!0),this.cache={prefixe:"drag",preventDefault:{drag:!1,start:!1,end:!1,enter:!1,leave:!1,over:!1},paused:{drag:!1,start:!1,end:!1,enter:!1,leave:!1,over:!1},enabled:{drag:!1,start:!1,end:!1,enter:!1,leave:!1,over:!1},callbacks:{drag:[],start:[],end:[],enter:[],leave:[],over:[]},stream:{enabled:{drag:!1,start:!1,end:!1,enter:!1,leave:!1,over:!1},clear:{drag:!1,start:!1,end:!1,enter:!1,leave:!1,over:!1},history:{drag:[],start:[],end:[],enter:[],leave:[],over:[]}}},this.__controller={start:Ze.bind(this),drag:Pe.bind(this),end:Le.bind(this)}}onStart(...t){return this.__onEvent("start",{},...t),this}onDrag(...t){return this.__onEvent("drag",{},...t),this}onEnd(...t){return this.__onEvent("end",{},...t),this}}class ze extends ie{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{drop:!1},paused:{drop:!1},stream:{enabled:{drop:!1},clear:{drop:!1},history:{drop:[]}},callbacks:{drop:[t=>console.log({dx:t.dx,dy:t.dy,drop:t.drop,move:t.move,t:t.dt})]}},this.__controller={drop:Ue.bind(this)}}onDrop(...t){return this.__onEvent("drop",{},...t),this}}const $e=t=>new Re(t),Ne=t=>new ze(t);function Fe(t){se.call(this,t,"copy",null,null)}function Ve(t){se.call(this,t,"cut",null,null)}function Be(t){se.call(this,t,"paste",null,null)}function He(t){se.call(this,t,"select",null,null)}class We extends ie{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{copy:!1,cut:!1,paste:!1,select:!1},paused:{copy:!1,cut:!1,paste:!1,select:!1},stream:{enabled:{copy:!1,cut:!1,paste:!1,select:!1},clear:{copy:!1,cut:!1,paste:!1,select:!1},history:{copy:[],cut:[],paste:[],select:[]}},callbacks:{copy:[],cut:[],paste:[],select:[]}},this.__controller={copy:Fe.bind(this),cut:Ve.bind(this),paste:Be.bind(this),select:He.bind(this)}}onCopy(...t){return this.__onEvent("copy",{},...t),this}onCut(...t){return this.__onEvent("cut",{},...t),this}onPaste(...t){return this.__onEvent("paste",{},...t),this}onSelect(...t){return this.__onEvent("select",{},...t),this}}const Xe=t=>new We(t);function qe(t){se.call(this,t,"focus",null,null)}function Ye(t){se.call(this,t,"blur",null,null)}class Ge extends ie{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{focus:!1,blur:!1},paused:{focus:!1,blur:!1},stream:{enabled:{focus:!1,blur:!1},clear:{focus:!1,blur:!1},history:{focus:[],blur:[]}},callbacks:{focus:[],blur:[]}},this.__controller={focus:qe.bind(this),blur:Ye.bind(this)}}onFocus(...t){return this.__onEvent("focus",{},...t),this}onBlur(...t){return this.__onEvent("blur",{},...t),this}}const Ke=t=>new Ge(t);function Qe(t){se.call(this,t,"input",null,null)}function Je(t){se.call(this,t,"change",null,null)}class ts extends ie{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:Qe.bind(this),change:Je.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 es=t=>new ts(t);function ss(t){se.call(this,t,"hashchange",null,null)}class is extends ie{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:ss.bind(this)}}onChange(...t){return this.__onEvent("hashchange",{},...t),this}}const rs=t=>new is(t),ns=t=>function(e){se.call(this,e,t,null,null)};class os extends ie{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{},paused:{},stream:{enabled:{},clear:{},history:{}},callbacks:{}},this.__controller={}}#r(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]=ns(t).bind(this),this}on(t,...e){return this.__controller[t]||this.#r(t),this.__onEvent(t,{},...e),this}emit(t,e={}){this.__controller[t]||this.#r(t),this.detail=e;const s=new Event(t);return this.targetElement.dispatchEvent(s),this}}const as=t=>new os(t);class hs extends ie{constructor(t,e=.3,s=.3){super(t);const{removeListener:i,setWidthThreshold:r,setHeightThreshold:n}=function(t,e=.5,s=.5,i,r){let n=F(e,0,i),o=F(s,0,r),a=0,h=0,l=0,c=0;const u=t=>{a=t.clientX,h=t.clientY},p=t=>{l=t.clientX,c=t.clientY,d()};function d(){const t=l-a,e=c-h;(Math.abs(t)>n||Math.abs(e)>o)&&m(t,e)}function m(e,s){const a=globalThis?.CustomEvent?new CustomEvent("swipe",{detail:{deltaX:Ea(e)<n?0:th(e)*N(Ea(e),0,i),deltaY:Ea(s)<o?0:th(s)*N(Ea(s),0,r),direction:{x:Ea(e)<n?"none":e>0?"right":"left",y:Ea(s)<o?"none":s>0?"down":"up"}}}):null;t?.dispatchEvent(a)}function g(t){n=F(t,0,i)}function f(t){o=F(t,0,r)}return t?.addEventListener("pointerdown",u),t?.addEventListener("pointerup",p),{removeListener(){t?.removeEventListener("pointerdown",u),t?.removeEventListener("pointerup",p),console.log("Swipe event listeners removed")},setWidthThreshold:g,setHeightThreshold:f}}(this.target?.element,e,s,this.target.width,this.target.height);this.cache={width_threshold:e,height_threshold:s,removeListener:i,setWidthThreshold:r,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:ls.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 ls(t){se.call(this,t,"swipe",null,null)}const cs=(t,e,s)=>new hs(t,e,s);var us=Object.freeze({__proto__:null,ZikoCustomEvent:os,ZikoEvent:ie,ZikoEventClick:oe,ZikoEventClipboard:We,ZikoEventHash:is,ZikoEventInput:ts,ZikoEventKey:je,ZikoEventMouse:be,ZikoEventPointer:ge,ZikoEventSwipe:hs,ZikoEventWheel:Te,useClickEvent:ae,useClipboardEvent:Xe,useCustomEvent:as,useDragEvent:$e,useDropEvent:Ne,useFocusEvent:Ke,useHashEvent:rs,useInputEvent:es,useKeyEvent:De,useMouseEvent:Ee,usePointerEvent:fe,useSwipeEvent:cs,useWheelEvent:Ae});class ps{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 ds=(t,e={},s=null)=>{const i=new ps(t,e);return s&&i.observe(s),i};class ms extends ps{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 gs=(t,e)=>new ms(t,e);class fs extends ps{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 bs=(t,e)=>new fs(t,e);class ys{constructor(t,e,{threshold:s=0,margin:i=0}={}){this.target=t,this.config={threshold:s,margin:i},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 vs=(t,e,s)=>new ys(t,e,s);class ws{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 xs=(t,e)=>new ws(t,e);class ks{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 V(globalThis?.screenX,0,globalThis.screen.availWidth,-1,1)}get y0(){return-V(globalThis?.screenY,0,globalThis.screen.availHeight,-1,1)}get x1(){return V(globalThis?.screenX+globalThis?.outerWidth,0,globalThis.screen.availWidth,-1,1)}get y1(){return-V(globalThis?.screenY+globalThis?.outerHeight,0,globalThis.screen.availHeight,-1,1)}get cx(){return V(globalThis?.outerWidth/2+globalThis?.screenX,0,globalThis.screen.availWidth,-1,1)}get cy(){return-V(globalThis?.outerHeight/2+globalThis?.screenY,0,globalThis.screen.availHeight,-1,1)}}const _s=t=>new ks(t);var Cs=Object.freeze({__proto__:null,ZikoMutationObserver:ps,watch:ds,watchAttr:gs,watchChildren:bs,watchIntersection:vs,watchScreen:_s,watchSize:xs});const Es=(t,e=[],s=(()=>{}))=>{t.cache.stream.enabled.down=!0;const i=e.length,r=t.cache.stream.history.down.slice(-i).map((t=>t.key));e.join("")===r.join("")&&(t.event.preventDefault(),s.call(t,t))};function Is(t,...e){const s=t.toString().match(/\(([^)]*)\)/)[1].split(",").map((t=>t.trim()));return function(...i){const r=e[e.length-1];for(let t=0;t<i.length;t++){const n=t>=e.length,o=n?r:e[t],a=i[t];n?(s[s.length-1],e.length):s[t];let h=!1;if("object"==typeof o){if(o.or)for(const t of o.types)if(Ts(t,a)){h=!0;break}if(o.nor)for(const t of o.types){if(Ts(t,a)){h=!1;break}h=!0}else o.not&&(h=!Ts(o.type,a))}else h=Ts(o,a);if(!h)throw new TypeError("jjj")}return t(...i)}}const Ts=(t,e)=>"string"==typeof t?typeof e===t:t instanceof Function?e instanceof t:Array.isArray(t)?!(!Array.isArray(e)||e.length!==t.length)&&e.every(((e,s)=>Ts(t[s],e))):"object"==typeof t&&!Array.isArray(t)&&("object"==typeof e&&null!==e&&Object.keys(t).every((s=>s in e&&Ts(t[s],e[s]))));class As{constructor(t,e=1e3/30,s=0,i=1/0,r=!0){this.callback=t,this.cache={isRunning:!1,AnimationId:null,t0:null,step:e,startTime:s,endTime:i,started:r},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 Ss=t=>1e3/t,Ms=(t,e,s,i,r)=>new As(t,e,s,i,r);var Os=Object.freeze({__proto__:null,useFps:Ss,useTimeLoop:Ms});const js={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-js.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-js.OutBounce(1-2*t))/2:(1+js.OutBounce(2*t-1))/2},Ds=(t,e=1e3)=>(...s)=>setTimeout((()=>t(...s)),e),Zs=(t,e)=>{let s=0;return(...i)=>{const r=(new Date).getTime();r-s<e||(s=r,t(...i))}},Ps=t=>{const e=Date.now(),s=performance.memory.usedJSHeapSize,i=t();return{elapsedTime:Date.now()-e,usedMemory:performance.memory.usedJSHeapSize-s,result:i}},Ls=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})})),Us=(t,e=2e3)=>{const s=Date.now();for(;Date.now()-s<e;)if(t.element)return t.element},Rs=t=>new Promise((e=>setTimeout(e,t))),zs=t=>{console.time("timeTaken");const e=t();return console.timeEnd("timeTaken"),e};var $s=Object.freeze({__proto__:null,Ease:js,timeTaken:zs,time_memory_Taken:Ps,useDebounce:Ds,useThrottle:Zs,wait:Rs,waitForUIElm:Ls,waitForUIElmSync:Us});class Ns{constructor(t,e=js.Linear,s=50,{t:i=[0,null],start:r=!0,duration:n=3e3}={}){this.cache={isRunning:!1,AnimationId:null,startTime:null,ease:e,step:s,intervall:i,started:r,duration:n},this.t=0,this.tx=0,this.ty=0,this.i=0,this.callback=t}#n(){this.t+=this.cache.step,this.i++,this.tx=V(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}#o(t=!0){return this.cache.isRunning||(t&&this.reset(!1),this.cache.isRunning=!0,this.cache.startTime=Date.now(),this.cache.AnimationId=setInterval(this.#n.bind(this),this.cache.step)),this}start(){return this.#o(!0),this}pause(){return this.cache.isRunning&&(clearTimeout(this.cache.AnimationId),this.cache.isRunning=!1),this}resume(){return this.#o(!1),this}stop(){return this.pause(),this.reset(!1),this}}const Fs={...Os,...Os,...$s};let Vs=class{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=i=>{this.off(t,s),e(i)};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 Bs=()=>new Vs;let Hs=class{constructor(t,e=!0){this.#r(),this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}#r(){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=Bs(),this}};const Ws=(t,e)=>new Hs(t,e);let Xs=class{constructor({viewport:t,charset:e,description:s,author:i,keywords:r}){this.document=globalThis?.document,this.meta={},this.init({viewport:t,charset:e,description:s,author:i,keywords:r})}init({viewport:t,charset:e,description:s,author:i,keywords:r}){t&&this.setViewport(t),e&&this.setCharset(e),s&&this.describe(s),i&&this.setAuthor(i),r&&this.setKeywords(r)}set(t,e){const s="charset"===(t=t.toLowerCase()),i=s?document.querySelector("meta[charset]"):document.querySelector(`meta[name=${t}]`);return this.meta=i??document?.createElement("meta"),s?this.meta.setAttribute("charset",e):(this.meta.setAttribute("name",t),this.meta.setAttribute("content",e)),i||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 qs=({viewport:t,charset:e,description:s,author:i,keywords:r})=>new Xs({viewport:t,charset:e,description:s,author:i,keywords:r});let Ys=class{constructor(t=document.title,e=!0){this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}useEventEmitter(){return this.cache.Emitter=Bs(),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 Gs=(t,e)=>new Ys(t,e);let Ks=class{constructor({title:t,lang:e,icon:s,meta:i,noscript:r}){this.html=globalThis?.document?.documentElement,this.head=globalThis?.document?.head,t&&Gs(t),e&&this.setLang(e),s&&Ws(s),i&&qs(i),r&&this.setNoScript()}setLang(t){this.html.setAttribute("lang",t)}setNoScript(t){}};const Qs=({title:t,lang:e,icon:s,meta:i,noscript:r})=>new Ks({title:t,lang:e,icon:s,meta:i,noscript:r});let Js=class{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"+ft.string(10),this.SUBSCRIBERS=new Set([this.UUID])}get broadcast(){return this}emit(t,e){return this.EVENTS_DATAS_PAIRS.set(t,e),this.#a(t),this}on(t,e=console.log){return this.EVENTS_HANDLERS_PAIRS.set(t,e),this.#h(),this}#h(){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),i=this.EVENTS_HANDLERS_PAIRS.get(this.LAST_RECEIVED_EVENT);s&&i&&i(s)},this}#a(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 ti=t=>new Js(t);class ei{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=i=>{this.off(t,s),e(i)};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 si=()=>new ei;class ii{#l;constructor(){this.#l=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.#l],{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}}const ri=(t,e,s)=>{const i=new ii;return t&&i.call(t,e,s),i};class ni{constructor(){this.isSupported&&this.#r()}async#r(){this.__Battery__=await navigator.getBattery()}get isSupported(){return!!navigator.getBattery}get current(){const{level:t,charging:e,chargingTime:s,dischargingTime:i}=this.__Battery__;return{level:t,charging:e,chargingTime:s,dischargingTime:i}}onChargingChange(t){return this.__Battery__?.addEventListener("chargingchange",t),this}onLevelChange(t){return this.__Battery__?.addEventListener("levelchange",t),this}}const oi=()=>new ni;class ai{constructor(){this.isSupported&&this.#r()}async#r(){navigator.geolocation.getCurrentPosition((t=>this.__Geolocation__=t))}get isSupported(){return!!navigator.geolocation}get current(){return this.__Geolocation__}}const hi=()=>new ai;class li{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"+ft.string(10),this.SUBSCRIBERS=new Set([this.UUID])}get broadcast(){return this}emit(t,e){return this.EVENTS_DATAS_PAIRS.set(t,e),this.#a(t),this}on(t,e=console.log){return this.EVENTS_HANDLERS_PAIRS.set(t,e),this.#h(),this}#h(){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),i=this.EVENTS_HANDLERS_PAIRS.get(this.LAST_RECEIVED_EVENT);s&&i&&i(s)},this}#a(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 ci=t=>new li(t);class ui{constructor(t,e,s){this.cache={storage:t,globalKey:e,channel:ci(`Ziko:useStorage-${e}`),oldItemKeys:new Set},this.#r(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]})}#r(t){this.cache.channel=ci(`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}}const pi=(t,e)=>new ui(localStorage,t,e),di=(t,e)=>new ui(sessionStorage,t,e);class mi{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}#t(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}#e(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}#s(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.#t(t):"string"==typeof t?this.#e(t):t&&"object"==typeof t?this.#s(t):this}}const gi=(t,e,s)=>new mi(t,e,s);class fi{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),i=()=>{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)};i(),s.addListener(i)}))}}const bi=(t,e)=>new fi(t,e);class yi{constructor(t){this.props={},t&&this.set(t)}get(t){return this.props[t]}set(t){return Object.entries(t).forEach((([t,e])=>this.#u(t,e))),this}#u(t,e){const s=`--${sa.camel2hyphencase(t)}`;document.documentElement.style.setProperty(s,e),Object.assign(this.props,{[t]:`var(${s})`}),Object.assign(this,{[t]:`var(${s})`})}}const vi=t=>(t.startsWith("--")||(t=`--${sa.camel2hyphencase(t)}`),`var(${t})`),wi=t=>new yi(t);const xi={...us,...Cs,...Object.freeze({__proto__:null,ZikoHead:Ks,ZikoUseRoot:yi,ZikoUseStyle:mi,useBattery:oi,useChannel:ti,useDebounce:Ds,useEventEmitter:si,useFavIcon:Ws,useGeolocation:hi,useHead:Qs,useLocaleStorage:pi,useMediaQuery:bi,useMeta:qs,useRoot:wi,useRootValue:vi,useSessionStorage:di,useStyle:gi,useSuccesifKeys:Es,useThread:ri,useThrottle:Zs,useTitle:Gs,useType:Is})};class ki{constructor(t,e=""){this.target=globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body,"string"==typeof t&&(t="svg"===t?globalThis?.document?.createElementNS("http://www.w3.org/2000/svg","svg"):globalThis?.document?.createElement(t)),t&&(this.element=t),this.uuid=this.constructor.name+"-"+ft.string(10),this.cache={name:e,parent:null,isBody:!1,isRoot:!1,isHidden:!1,isFrozzen:!1,legacyParent:null,style:new ee({}),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},this.cache.style.linkTo(this),this.style({position:"relative",boxSizing:"border-box",margin:0,padding:0}),this.size("auto","auto"),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()}get isZikoUIElement(){return!0}get st(){return this.cache.style}get attr(){return this.cache.attributes}get evt(){return this.cache.events}get html(){return this.element.innerHTML}get text(){return this.element.textContent}get isBody(){return this.element===globalThis?.document.body}get __app__(){if(this.cache.isRoot)return this;let t=this.cache.parent;for(;;){if(!t)return null;if(t.cache.isRoot)return t;t=t.parent}}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 Jt?this.st.style(t.current):this.st.style(t),this}size(t,e){return this.st.size(t,e),this}get#p(){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.#p,direction:"rtl"}):this.style({direction:"rtl"}),this}useLtr(t=!1){return t?this.style({...this.#p,direction:"ltr"}):this.style({direction:"ltr"}),this}freeze(t){return this.cache.isFrozzen=t,this}setTarget(t){if(!this.isBody)return t instanceof ki&&(t=t.element),this.unrender(),this.target=t,this.render(),this}describe(t){t&&this.setAttr("aria-label",t)}clear(){return this?.items?.forEach((t=>t.unrender())),this.element.innerHTML="",this}render(t=this.target){if(!this.isBody)return t instanceof ki&&(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 instanceof ki&&(t=t.element),this.element?.after(t),this}before(t){return t instanceof ki&&(t=t.element),this.element?.before(t),this}animate(t,{duration:e=1e3,iterations:s=1,easing:i="ease"}={}){return this.element?.animate(t,{duration:e,iterations:s,easing:i}),this}#d(t,e){"svg"!==this.element.tagName&&(t=sa.isCamelCase(t)?sa.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,i]=[Object.keys(t),Object.values(t)];for(let t=0;t<s.length;t++)i[t]instanceof Array&&(e[t]=i[t].join(" ")),this.#d(s[t],i[t])}else e instanceof Array&&(e=e.join(" ")),this.#d(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=sa.isCamelCase(t)?sa.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")}onPtrMove(...t){return this.events.ptr||(this.events.ptr=fe(this)),this.events.ptr.onMove(...t),this}onPtrDown(...t){return this.events.ptr||(this.events.ptr=fe(this)),this.events.ptr.onDown(...t),this}onPtrUp(...t){return this.events.ptr||(this.events.ptr=fe(this)),this.events.ptr.onUp(...t),this}onPtrEnter(...t){return this.events.ptr||(this.events.ptr=fe(this)),this.events.ptr.onEnter(...t),this}onPtrLeave(...t){return this.events.ptr||(this.events.ptr=fe(this)),this.events.ptr.onLeave(...t),this}onPtrOut(...t){return this.events.ptr||(this.events.ptr=fe(this)),this.events.ptr.onOut(...t),this}onPtrCancel(...t){return this.events.ptr||(this.events.ptr=fe(this)),this.events.ptr.onCancel(...t),this}onSwipe(t,e,...s){return this.events.swipe||(this.events.swipe=cs(this,t,e)),this.events.swipe.onSwipe(...s),this}onMouseMove(...t){return this.events.mouse||(this.events.mouse=Ee(this)),this.events.mouse.onMove(...t),this}onMouseDown(...t){return this.events.mouse||(this.events.mouse=Ee(this)),this.events.mouse.onDown(...t),this}onMouseUp(...t){return this.events.mouse||(this.events.mouse=Ee(this)),this.events.mouse.onUp(...t),this}onMouseEnter(...t){return this.events.mouse||(this.events.mouse=Ee(this)),this.events.mouse.onEnter(...t),this}onMouseLeave(...t){return this.events.mouse||(this.events.mouse=Ee(this)),this.events.mouse.onLeave(...t),this}onMouseOut(...t){return this.events.mouse||(this.events.mouse=Ee(this)),this.events.mouse.onOut(...t),this}onWheel(...t){return this.events.wheel||(this.events.wheel=Ae(this)),this.events.wheel.onWheel(...t),this}onKeyDown(...t){return this.events.key||(this.events.key=De(this)),this.events.key.onDown(...t),this}onKeyPress(...t){return this.events.key||(this.events.key=De(this)),this.events.key.onPress(...t),this}onKeyUp(...t){return this.events.key||(this.events.key=De(this)),this.events.key.onUp(...t),this}onKeysDown({keys:t=[],callback:e}={}){return this.events.key||(this.events.key=De(this)),this.events.key.handleSuccessifKeys({keys:t,callback:e}),this}onDragStart(...t){return this.events.drag||(this.events.drag=$e(this)),this.events.drag.onStart(...t),this}onDrag(...t){return this.events.drag||(this.events.drag=$e(this)),this.events.drag.onDrag(...t),this}onDragEnd(...t){return this.events.drag||(this.events.drag=$e(this)),this.events.drag.onEnd(...t),this}onDrop(...t){return this.events.drop||(this.events.drop=Ne(this)),this.events.drop.onDrop(...t),this}onClick(...t){return this.events.click||(this.events.click=ae(this)),this.events.click.onClick(...t),this}onDbClick(...t){return this.events.click||(this.events.click=ae(this)),this.events.click.onDbClick(...t),this}onCopy(...t){return this.events.clipboard||(this.events.clipboard=Xe(this)),this.events.clipboard.onCopy(...t),this}onCut(...t){return this.events.clipboard||(this.events.clipboard=Xe(this)),this.events.clipboard.onCut(...t),this}onPaste(...t){return this.events.clipboard||(this.events.clipboard=Xe(this)),this.events.clipboard.onPaste(...t),this}onSelect(...t){return this.events.clipboard||(this.events.clipboard=Xe(this)),this.events.clipboard.onSelect(...t),this}onFocus(...t){return this.events.focus||(this.events.focus=Ke(this)),this.events.focus.onFocus(...t),this}onBlur(...t){return this.events.focus||(this.events.focus=Ke(this)),this.events.focus.onFocus(...t),this}on(t,...e){return this.events.custom||(this.events.custom=as(this)),this.events.custom.on(t,...e),this}emit(t,e={}){return this.events.custom||(this.events.custom=as(this)),this.events.custom.emit(t,e),this}watchAttr(t){return this.observer.attr||(this.observer.attr=gs(this,t)),this}watchChildren(t){return this.observer.children||(this.observer.children=bs(this,t)),this}watchSize(t){return this.observer.resize||(this.observer.resize=xs(this,t)),this.observer.resize.start(),this}watchIntersection(t,e){return this.observer.intersection||(this.observer.intersection=vs(this,t,e)),this.observer.intersection.start(),this}setFullScreen(t=!0,e){return this.element.requestFullscreen?(t?this.element.requestFullscreen(e):globalThis.document.exitFullscreen(),this):(console.error("Fullscreen API is not supported in this browser."),this)}toggleFullScreen(t){return globalThis.document.fullscreenElement?globalThis.document.exitFullscreen():this.element.requestFullscreen(t),this}toPdf(){return __ZikoPdf__,this}}class _i extends ki{constructor(t,e=""){super(t,e),this.items=[]}maintain(){for(let t=0;t<this.items.length;t++)Object.assign(this,{[[t]]:this.items[t]});return this.length=this.items.length,this}at(t){return this.items.at(t)}#m(t,e,...s){if(this.cache.isFrozzen)return console.warn("You can't append new item to frozzen element"),this;for(let i=0;i<s.length;i++)["number","string"].includes(typeof s[i])&&(s[i]=ji(s[i])),s[i]instanceof ki?(s[i].cache.parent=this,this.element[t](s[i].element),s[i].target=this.element,this.items[e](s[i])):s[i]instanceof Object&&(s[i]?.style&&this.style(s[i]?.style),s[i]?.attr&&Object.entries(s[i].attr).forEach((t=>this.setAttr(""+t[0],t[1]))));return this.maintain(),this}append(...t){return this.#m("append","push",...t),this}prepend(...t){return this.#m("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]=ji(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 instanceof ki&&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}forEach(t){return this.items.forEach(t),this}map(t){return this.items.map(t)}find(t){return this.items.filter(t)}filter(t,e=(()=>{}),s=(()=>{})){const i=this.items.filter(t);return i.forEach(e),this.items.filter((t=>!i.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}}class Ci extends _i{constructor(t,e,s,...i){super(t,e),this.addValue(...i),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 ki?this.element?.appendChild(t.element):t instanceof ga||t instanceof ha?this.element?.appendChild(new Text(t.toString())):t instanceof Array?this.element?.appendChild(new Text(Go(t))):t instanceof Object&&this.element?.appendChild(new Text(qo(t))),this.cache.lineBreak&&this.element?.appendChild(globalThis.document?.createElement("br"))})),this.element?.innerHTML&&(this.element.innerHTML=this.element.innerHTML.replace(/\n/g,"<br>").replace(/(?<!<[^>]+) /g," ")),this}setValue(...t){return this.clear(),this.addValue(...t),this}}class Ei extends Ci{constructor(...t){super("span","text",!1,...t)}}class Ii extends Ci{constructor(...t){super("q","quote",!1,...t),this.style({fontStyle:"italic"})}get isQuote(){return!0}}class Ti extends Ci{constructor(...t){super("dfn","dfnText",!1,...t)}get isDfnText(){return!0}}class Ai extends Ci{constructor(t){super("sup","supText",!1,t)}get isSupText(){return!0}}class Si extends Ci{constructor(...t){super("sub","subText",!1,...t)}get isSubText(){return!0}}class Mi extends Ci{constructor(...t){super("code","codeText",!1,...t)}get isCodeText(){return!0}}class Oi extends Ci{constructor(t,e){super("abbr","abbrText",!1,t),this.setAttr("title",e)}get isAbbrText(){return!0}}const ji=(...t)=>new Ei(...t),Di=(...t)=>new Ii(...t),Zi=(...t)=>new Ti(...t),Pi=(...t)=>new Ai(...t),Li=(...t)=>new Si(...t),Ui=(...t)=>new Mi(...t),Ri=(t,e)=>new Oi(t,e);class zi extends Ci{constructor(...t){super("p","p",!0,...t)}get isPara(){return!0}}class $i extends Ci{constructor(t,e){super("blockquote","blockquote",!0,e),this.setAttr("cite",t)}get isBlockQuote(){return!0}}const Ni=(...t)=>new zi(...t),Fi=(t,e)=>new $i(t,e);class Vi extends ki{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 Bi=(t="")=>new Vi(1,t),Hi=(t="")=>new Vi(2,t),Wi=(t="")=>new Vi(3,t),Xi=(t="")=>new Vi(4,t),qi=(t="")=>new Vi(5,t),Yi=(t="")=>new Vi(6,t);var Gi=Object.freeze({__proto__:null,ZikoUIAbbrText:Oi,ZikoUIBlockQuote:$i,ZikoUICodeText:Mi,ZikoUIDefintion:Ti,ZikoUIHeading:Vi,ZikoUIParagraphe:zi,ZikoUIQuote:Ii,ZikoUISubText:Si,ZikoUISupText:Ai,ZikoUIText:Ei,abbrText:Ri,blockQuote:Fi,codeText:Ui,dfnText:Zi,h1:Bi,h2:Hi,h3:Wi,h4:Xi,h5:qi,h6:Yi,p:Ni,quote:Di,subText:Li,supText:Pi,text:ji});class Ki extends _i{constructor(t){super("li","li"),this.append(t)}get isLi(){return!0}}class Qi extends _i{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]=ji(t[e])),t[e]instanceof ki&&(s=new Ki(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 ki&&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 i=null;["number","string"].includes(typeof e[s])&&(e[s]=ji(e[s])),e[s]instanceof ki&&(i=new Ki(e[s])),this.element?.insertBefore(i.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 i=s.element.textContent;return!(e?i===t:i.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 Ji extends Qi{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 tr extends Qi{constructor(...t){super("ul","ul"),this.append(...t)}get isUl(){return!0}}const er=t=>new Ki(t),sr=(...t)=>new Ji(...t),ir=(...t)=>new tr(...t);var rr=Object.freeze({__proto__:null,li:er,ol:sr,ul:ir});class nr extends ki{constructor(t,e,s="",i){super("input","input"),Object.assign(this.events,{input:null}),this.setValue(s),this.setAttr("type",t),this.setAttr("name",e),i&&this.linkDatalist(i)}get isInput(){return!0}setName(t){return this.setAttr("name",t),this}onInput(...t){return this.events.input||(this.events.input=es(this)),this.events.input.onInput(...t),this}onChange(...t){return this.events.input||(this.events.input=es(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 or=(t,e)=>{if(t instanceof Object){const{datalist:e,placeholder:s}=t;return t=t.value??"",new nr("text","input",t,e).setPlaceholder(s)}return new nr("text","input",t,e)};class ar extends nr{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 hr=(t,e,s)=>{if(t instanceof Object){const{value:e,max:s=10,step:i=1,placeholder:r=""}=t;return t=t?.min??0,new ZikoUIInputSlider(t,s,i).setValue(e).setPlaceholder(r)}return new ar(t,e,s)};let lr=class extends nr{constructor(t=0,e=0,s=10,i=1){super("range","inputSlider"),this.setMin(e).setMax(s).setValue(t).setStep(i)}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 cr=(t,e,s,i)=>{if(t instanceof Object){const{min:e=0,max:s=10,step:i=1}=t;return new lr(t=t?.value??5,e,s,i)}return new lr(t,e,s,i)};class ur extends nr{constructor(){super("color","inputColor"),this.background(this.value),this.onInput((()=>this.background(this.value)))}get isInputColor(){return!0}}const pr=()=>new ur;class dr extends nr{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 mr=(...t)=>(new dr).connect(...t);class gr extends nr{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 fr=()=>new gr;class br extends nr{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 yr=()=>new br;class vr extends nr{constructor(){super("email","inputEmail")}get isInputEmail(){return!0}}const wr=()=>new vr;class xr extends nr{constructor(){super("password","inputPassword")}get isInputPassword(){return!0}}const kr=()=>new xr;class _r extends nr{constructor(){super("date","inputDate")}get isInputDate(){return!0}}const Cr=()=>new _r;class Er extends nr{constructor(){super("time","inputTime")}get isInputTime(){return!0}}const Ir=()=>new Er;class Tr extends nr{constructor(){super("datetime-local","inputDateTime")}get isInputDateTime(){return!0}}const Ar=()=>new Tr;class Sr extends ki{constructor(t,e){super("div",""),this.element.append("svg"===e?function(t){const e=new DOMParser;return e.parseFromString(t.replace(/\s+/g," ").trim(),"image/svg+xml").documentElement}(t):function(t){const e=(new DOMParser).parseFromString(`<div>${t}</div>`,"text/html");return e.body.firstChild.style.display="contents",e.body.firstChild}(t))}}class Mr extends Sr{constructor(t){super(t,"html")}}class Or extends Sr{constructor(t){super(t,"svg")}}const jr=t=>new Mr(t),Dr=t=>new Or(t);class Zr extends _i{constructor(t){super(t,"html")}}class Pr extends ki{constructor(t="button"){super("button","btn"),this.element=document?.createElement("button"),this.setValue(t),this.st.cursor("pointer"),globalThis.__Ziko__.__Config__.default.render&&this.render()}get isBtn(){return!0}setValue(t){return t instanceof ki?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 Lr extends ki{constructor(){super("br","br")}get isBr(){return!0}}class Ur extends ki{constructor(){super("hr","hr"),this.setAttr("role","none")}get isHr(){return!0}}class Rr extends _i{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 zr=()=>new Lr,$r=()=>new Ur,Nr=(t=1)=>new Array(t).fill(new Lr),Fr=(t=1)=>new Array(t).fill(new Ur),Vr=(t,...e)=>new Rr(t).append(...e),Br=(t,...e)=>new Zr(t).append(...e),Hr=t=>new Pr(t);var Wr=Object.freeze({__proto__:null,HTMLWrapper:jr,SVGWrapper:Dr,ZikoUIBr:Lr,ZikoUIHTMLWrapper:Mr,ZikoUIHr:Ur,ZikoUIHtmlTag:Zr,ZikoUILink:Rr,ZikoUISVGWrapper:Or,ZikoUIXMLWrapper:Sr,br:zr,brs:Nr,btn:Hr,hr:$r,hrs:Fr,html:Br,link:Vr});class Xr extends ki{constructor(t="File"){super("inputImage"),this._aux_element=Hr(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 qr=t=>new Xr(t);class Yr extends ki{constructor(t,e,s,i){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 i&&(i+="%"),this.setAttr("alt",e),this.style({border:"1px solid black",width:s,height:i})}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 Gr=(t,e,s,i)=>new Yr(t,e,s,i);class Kr extends ki{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 Qr=(t,e)=>new Kr(t,e);class Jr extends ki{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 tn extends Jr{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 en=(t,e,s)=>new tn(t,e,s);class sn extends Jr{constructor(t){super("audio","audio"),this.element?.setAttribute("src",t),this.size("150px","30px")}get isAudio(){return!0}}const rn=t=>new sn(t);var nn=Object.freeze({__proto__:null,ZikoUIAudio:sn,ZikoUIFigure:Kr,ZikoUIImage:Yr,ZikoUIVideo:tn,audio:rn,figure:Qr,image:Gr,video:en});class on extends tn{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 an=()=>new on;class hn extends ki{constructor(){super(),this.element=document?.createElement("label")}get isLabel(){return!0}}class ln extends ki{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 cn=class extends ki{constructor(...t){super(),this.element=document?.createElement("datalist"),this.addOptions(...t).setId("ziko-datalist-id"+ft.string(10))}get isDatalist(){return!0}addOptions(...t){return t.map((t=>this.append(new ln(t)))),this}};const un=(...t)=>new cn(...t);class pn extends ki{constructor(){super(),this.element=document?.createElement("select")}addOptions(...t){return t.map((t=>this.append(new ln(t)))),this}get isSelect(){return!0}}const dn=()=>new pn;class mn extends ki{constructor(){super(),this.element=document?.createElement("textarea")}get value(){return this.element.textContent}get isTextArea(){return!0}}const gn=()=>new mn;let fn=class extends _i{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 yn.call(this,s),this.style({alignItems:"number"==typeof t?wn.call(this,t):t,justifyContent:"number"==typeof e?xn.call(this,e):e}),this}horizontal(t,e,s=1){return vn.call(this,s),this.style({alignItems:"number"==typeof e?xn.call(this,e):e,justifyContent:"number"==typeof t?wn.call(this,t):t}),this}show(){return this.isHidden=!1,this.style({display:"flex"}),this}};const bn=(...t)=>{let e="div";return"string"==typeof t[0]&&(e=t[0],t.pop()),new fn(e).append(...t)};function yn(t){return 1==t?this.style({flexDirection:"column"}):-1==t&&this.style({flexDirection:"column-reverse"}),this}function vn(t){return 1==t?this.style({flexDirection:"row"}):-1==t&&this.style({flexDirection:"row-reverse"}),this}function wn(t){return"number"==typeof t&&(t=["flex-start","center","flex-end"][t+1]),t}function xn(t){return wn(-t)}class kn extends fn{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 _n=(...t)=>new kn(...t);var Cn=Object.freeze({__proto__:null,Form:_n,ZikoUIForm:kn,ZikoUIInput:nr,ZikoUIInputCheckbox:gr,ZikoUIInputColor:ur,ZikoUIInputDatalist:cn,ZikoUIInputDate:_r,ZikoUIInputDateTime:Tr,ZikoUIInputEmail:vr,ZikoUIInputImage:Xr,ZikoUIInputNumber:ar,ZikoUIInputOption:ln,ZikoUIInputPassword:xr,ZikoUIInputRadio:br,ZikoUIInputSearch:dr,ZikoUIInputSlider:lr,ZikoUIInputTime:Er,ZikoUILabel:hn,ZikoUISelect:pn,ZikoUITextArea:mn,checkbox:fr,datalist:un,input:or,inputCamera:an,inputColor:pr,inputDate:Cr,inputDateTime:Ar,inputEmail:wr,inputImage:qr,inputNumber:hr,inputPassword:kr,inputTime:Ir,radio:yr,search:mr,select:dn,slider:cr,textarea:gn});class En extends ki{constructor(...t){super(),this.element=document?.createElement("Tr"),this.append(...t)}}class In extends ki{constructor(...t){super(),this.element=document?.createElement("Td"),this.append(...t)}}class Tn extends ki{constructor(...t){super(),this.element=document?.createElement("Thead"),this.append(...t)}}class An extends ki{constructor(...t){super(),this.element=document?.createElement("Tbody"),this.append(...t)}}class Sn extends ki{constructor(t){super(),this.element=document?.createElement("Caption"),this.append(t)}}const Mn=(...t)=>(t=t.map((t=>(t instanceof ki||(t=ji(t)),t))),new In(...t)),On=t=>new Sn(t),jn=t=>{var e=new Array(t.rows).fill(null).map((()=>((...t)=>new En(...t))())),s=t.arr.map((t=>t.map((()=>null))));for(let i=0;i<s.length;i++)for(let r=0;r<s[0].length;r++)s[i][r]=Mn(t.arr[i][r]),e[i].append(s[i][r]);return e};class Dn extends ki{constructor(t,{caption:e=null,head:s=null,foot:i=null}={}){super("table","Table"),this.structure={caption:e,head:s,body:null,foot:i},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=On(t),this.append(this.structure.caption),this}removeCaption(){return this.structure.caption&&this.removeItem(...this.items.filter((t=>t instanceof Sn))),this.structure.caption=null,this}setHeader(...t){return this.tHead=((...t)=>(t=t.map((t=>(t instanceof ki||(t=Mn(t)),t))),new Tn(...UI)))(...t),this.append(this.tHead),this}removeHeader(){return this.removeItem(...this.items.filter((t=>t instanceof Sn))),this}setFooter(t){return this.structure.caption=On(t),this.append(this.structure.caption),this}removeFooter(){return this.removeItem(...this.items.filter((t=>t instanceof Sn))),this}fromMatrix(t){return this.bodyMatrix=t instanceof Array?la(t):t,this.structure.body&&this.remove(this.structure.body),this.structure.body=((...t)=>new An(...t))(),this.append(this.structure.body),this.structure.body.append(...jn(this.bodyMatrix)),this}transpose(){return this.fromMatrix(this.bodyMatrix.T),this}hstack(t){return t instanceof Dn&&(t=t.bodyMatrix),this.fromMatrix(this.bodyMatrix.clone.hstack(t)),this}vstack(t){return t instanceof Dn&&(t=t.bodyMatrix),this.fromMatrix(this.bodyMatrix.clone.vstack(t)),this}slice(t=0,e=0,s=this.bodyMatrix.rows-1,i=this.bodyMatrix.cols-1){return this.fromMatrix(this.bodyMatrix.slice(t,e,s,i)),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 Zn=(t,e)=>new Dn(t,e);var Pn=Object.freeze({__proto__:null,Table:Zn});class Ln extends _i{constructor(){super("main","Main")}get isMain(){return!0}}class Un extends _i{constructor(){super("header","Header")}get isHeader(){return!0}}class Rn extends _i{constructor(){super("nav","Nav")}get isNav(){return!0}}class zn extends _i{constructor(){super("section","Section"),this.style({position:"relative"})}get isSection(){return!0}}class $n extends _i{constructor(){super("article","Article")}get isArticle(){return!0}}class Nn extends _i{constructor(){super("aside","Aside")}get isAside(){return!0}}class Fn extends _i{constructor(){super("footer","Footer"),this.element=document?.createElement("footer")}get isFooter(){return!0}}const Vn=(...t)=>(new zn).append(...t),Bn=(...t)=>(new $n).append(...t),Hn=(...t)=>(new Ln).append(...t),Wn=(...t)=>(new Un).append(...t),Xn=(...t)=>(new Fn).append(...t),qn=(...t)=>(new Rn).append(...t),Yn=(...t)=>(new Nn).append(...t);var Gn=Object.freeze({__proto__:null,Article:Bn,Aside:Yn,Footer:Xn,Header:Wn,Main:Hn,Nav:qn,Section:Vn,ZikoUIArticle:$n,ZikoUIAside:Nn,ZikoUIFooter:Fn,ZikoUIHeader:Un,ZikoUIMain:Ln,ZikoUINav:Rn,ZikoUISection:zn});class Kn extends _i{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.#g(e),this}#g(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 Qn=(...t)=>new Kn("div").append(...t);class Jn extends ki{constructor(t,e,s="😁",i=s){super("details","Collapsible"),Object.assign(this.cache,{icons:{open:s,close:i}}),this.summary=Br("summary",t).style({fontSize:"1.1em",padding:"0.625rem",fontWeight:"bold",listStyleType:`"${s}"`,cursor:"pointer"}),this.summary[0].style({marginLeft:"0.5em"}),this.content=e.style({margin:"0.7em"}),this.element?.append(this.summary.element,this.content.element),this.style({marginBottom:"0.7em"}),gs(this,(t=>{t.target.isOpen?(t.target.emit("open"),this?.parent?.isAccordion&&this.parent.cache.autoClose&&this.parent.closeExcept(this),this.summary.style({listStyleType:`"${this.cache.icons.close}"`})):(t.target.emit("close"),this.summary.style({listStyleType:`"${this.cache.icons.open}"`}))}))}get isCollapsible(){return!0}get isOpen(){return this.element.open}open(t=this){return this.element.open=!0,this.emit("open",t),this}close(){return this.element.open=!1,this}onOpen(t){return this.on("open",t),this}onClose(t){return this.on("close",t),this}toggle(){return this.element.open=!this.element.open,this}}const to=(t,e,s,i)=>new Jn(t,e,s,i);class eo extends _i{constructor(...t){super("div","Accordion"),this.append(...t),Object.assign(this.cache,{autoClose:!0})}get isAccordion(){return!0}closeAll(){return this.items.forEach((t=>t.close())),this}closeExcept(...t){return this.items.filter((e=>!t.includes(e))).forEach((t=>t.close())),this}open(t){return t.isCollapsible?t.open():this.items[t].open(),this.closeExcept(t.isCollapsible?t:this.items[t]),this}enableAutoClose(){return this.cache.autoClose=!0,this}disableAutoClose(){return this.cache.autoClose=!1,this}toggleAutoClose(){this.cache.autoClose=!this.cache.autoClose}}const so=(...t)=>new eo(...t);class io extends _i{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 no.call(this,s),this.style({alignItems:"number"==typeof t?ao.call(this,t):t,justifyContent:"number"==typeof e?ho.call(this,e):e}),this}horizontal(t,e,s=1){return oo.call(this,s),this.style({alignItems:"number"==typeof e?ho.call(this,e):e,justifyContent:"number"==typeof t?ao.call(this,t):t}),this}show(){return this.isHidden=!1,this.style({display:"flex"}),this}}const ro=(...t)=>{let e="div";return"string"==typeof t[0]&&(e=t[0],t.pop()),new io(e).append(...t)};function no(t){return 1==t?this.style({flexDirection:"column"}):-1==t&&this.style({flexDirection:"column-reverse"}),this}function oo(t){return 1==t?this.style({flexDirection:"row"}):-1==t&&this.style({flexDirection:"row-reverse"}),this}function ao(t){return"number"==typeof t&&(t=["flex-start","center","flex-end"][t+1]),t}function ho(t){return ao(-t)}class lo extends io{constructor(...t){super(),this.style({position:"relative",overflow:"hidden",touchAction:"none",userSelect:"none"}),this.horizontal("space-around",0),this.track=Vn(...t).style({display:"inline-flex"}),this.track.size(100*this.track.children.length+"vw"),this.track.setTarget(this),this.track.items.map((t=>t.style({pointerEvents:"none",margin:"auto 10px"}))),this.x0=null,this.tx=0,this.onPtrMove((t=>{if(t.isDown){let e=t.event.pageX-this.x0;this.track.st.translateX(this.tx+e,0)}})),this.onPtrDown((t=>{console.log(t.event),this.x0=t.event.pageX;const e=window.getComputedStyle(this.track.element).getPropertyValue("transform");"none"!==e&&(this.tx=+e.split(",")[4])})),this.onPtrUp((t=>console.log(t.isDown))),this.onPtrLeave((t=>{}))}get isCarousel(){return!0}}const co=(...t)=>new lo(...t);class uo extends io{constructor(){super("section"),Object.assign(this.cache,{order:0,currentNote:null,currentNoteIndex:null}),this.vertical(0,0)}get isCodeNote(){return!0}setCurrentNote(t){return this.cache.currentNote=t,this.cache.currentNoteIndex=this.items.findIndex((e=>e===t)),t.focus(),this.items.forEach((t=>t.Input.style({border:"1px solid #ccc"}))),t.Input.style({border:"2px lightgreen solid"}),this}addNote(t=""){return this.append(fo(t)),this}execute(){return this.cache.currentNote.execute(),this.incrementOrder(),this}incrementOrder(){return this.cache.order++,this.cache.currentNote.setOrder(this.cache.order),this}next(){return this.cache.currentNote===this.items.at(-1)?(this.addNote(),this.setCurrentNote(this.items.at(-1))):this.setCurrentNote(this.items[this.cache.currentNoteIndex+1]),this}previous(){return this.cache.currentNote!==this.items[0]&&this.setCurrentNote(this.items[this.cache.currentNoteIndex-1]),this}data(){return this.items.map((t=>t.cellData()))}serialize(){return JSON.stringify(this.data())}import(t=[]){return t.forEach(((e,s)=>this.addNote(t[s].input))),this}}const po=()=>new uo,mo={background:"none",width:"25px",height:"25px",fontSize:"1.2rem",cursor:"pointer"};class go extends io{constructor(t="",{type:e="js",order:s=null}={}){var i;super("section"),Object.assign(this.cache,{state:null,order:s,type:e,metadata:{created:Date.now(),updated:null}}),this.Input=((t="")=>Br("code",t).style({width:"100%",height:"auto",padding:"10px",boxSizing:"border-box",border:"1px solid #ccc",outline:"none",fontSize:"1rem",fontFamily:"Lucida Console, Courier New, monospace",padding:"1rem 0.5rem",wordBreak:"break-all",background:"#f6f8fa",color:"#0062C3"}).setAttr("contenteditable",!0).setAttr("spellcheck",!1))(t),this.Output=Br("output").style({width:"100%",height:"auto",padding:"5px 0"}),this.InOut=ro(this.Input,this.Output).vertical().style({width:"100%",margin:"10px auto"}),this.RightControl=(i=this,bn(ji("▶️").style(mo).onClick((t=>{i.parent instanceof uo&&i.parent.setCurrentNote(i),i.execute(),globalThis.__Ziko__.__Config__.default.target=t.target.parent.parent[1][1]})),ji("📋").style(mo).onClick((()=>{navigator.clipboard.writeText(i.codeText)})),ji("✖️").style(mo).onClick((()=>i.remove())),ji("✖️").style(mo).onClick((()=>i.remove()))).style({width:"70px",height:"50px",margin:"10px 0"}).horizontal(0,0).wrap(!0)),this.LeftControl=bn(ji("[ ]")).style({width:"50px",height:"50px",margin:"10px 4px",padding:"5px",color:"darkblue",borderBottom:"4px solid gold"}).horizontal(0,0),this.append(this.LeftControl,this.InOut,this.RightControl),this.horizontal(-1,1).style({width:"95vw",margin:"0 auto",border:"1px darkblue dotted"});let r=this.Input.element.getElementsByClassName("cm-content")[0];r?r.addEventListener("keydown",(t=>{"Enter"===t.key&&t.shiftKey&&(t.preventDefault(),this.execute(this.cache.order))})):(this.Input.onKeyDown((t=>{"Enter"===t.kd&&t.event.shiftKey&&(t.event.preventDefault(),this.execute(this.cache.order)),this.cache.parent instanceof uo&&("ArrowDown"===t.kd&&t.event.shiftKey&&this.cache.parent.next(),"ArrowUp"===t.kd&&t.event.shiftKey&&this.cache.parent.previous())})),this.Input.onFocus((()=>{this.cache.parent instanceof uo&&(this.cache.parent.cache.currentNote=this,this.cache.parent.setCurrentNote(this))})),this.Input.onPaste((t=>{})))}get isCodeCell(){return!0}get codeText(){return this.Input.element.getElementsByClassName("cm-content")[0]?this.Input.element.getElementsByClassName("cm-content")[0].innerText.trim():this.Input.element.innerText.trim()}get codeHTML(){return this.Input.element.innerHTML}get outputHTML(){return this.Output.element.innerHTML}setValue(t){return this.Input[0].setValue(t),this}cellData(){return{input:this.codeText,output:this.outputHTML,order:this.cache.order,type:this.cache.type}}execute(t){return this.clearOutput(),this.evaluate(t),this.cache.metadata.updated=Date.now(),this}#f(t){try{this.LeftControl[0].setValue("pending"),this.cache.state="pending",globalThis.eval(this.codeText)}catch(t){console.log(t),text(`Error : ${t.message}`).style({color:"red",background:"gold",border:"2px red solid",padding:"10px",margin:"10px 0",display:"flex",justifyContent:"center"}),this.LeftControl[0].setValue("Err"),this.cache.state="Error"}finally{"pending"===this.cache.state&&(this.cache.state="success",this.setOrder(t),this.cache.parent instanceof uo&&(this.cache.parent.incrementOrder(),this.cache.parent.next()))}}#b(){}#y(){}evaluate(t){if(globalThis.__Ziko__.__Config__.default.target=this.Output.element,"js"===this.cache.type)this.#f(t);return this}clearInput(){return this.Output.element.innerText="",this}clearOutput(){return this.Output.element.innerText="",this}setOrder(t,e=!0){return this.cache.order=t,e&&("number"==typeof t?this.LeftControl[0].setValue(`[${t}]`):this.LeftControl[0].setValue("[-]")),this}focus(){return this.Input.element.focus(),this}}const fo=(t,{type:e,order:s}={})=>new go(t,{type:e,order:s});class bo extends io{#v=0;constructor(t,e){super("div","Tabs"),Object.assign(this.cache,{config:{controllersPercent:.5}}),this.style({boxSizing:"border-box",backgroundColor:"blanchedalmond",border:"1px red solid",margin:"30px"}),this.controllersContainer=ro().size("auto","auto").style({boxSizing:"border-box",justifyContent:"center",alignItems:"center",textAlign:"center",minWidth:"50px",minHeight:"50px",backgroundColor:"darkblue",border:"1px darkblue solid"}).setAttr("role","tablist"),this.contentContainer=ro().style({boxSizing:"border-box",justifyContent:"center",alignItems:"center",textAlign:"center",width:"100%",height:"100%",backgroundColor:"darkslategrey"}),this.append(this.controllersContainer,this.contentContainer),t.length!==e.length?console.error(""):(this.controllersContainer.append(...t),this.contentContainer.append(...e)),this.init(),this.display(0),this.useVertical()}get isTabs(){return!0}init(){for(let t=0;t<this.controllersContainer.length;t++)this.controllersContainer[t].setAttr("role","tab").setAttr("aria-controls",`tab${t}`),this.contentContainer[t].setAttr("role","tabpanel").setAttr("aria-labelledby",`tab${t}`).setAttr("tabindex",-1);return this.controllersContainer.forEach((t=>t.onClick((t=>{const e=t.target.element.getAttribute("aria-controls"),s=+e.slice(3);this.contentContainer.filter((t=>t.element.getAttribute("aria-labelledby")===e),(()=>{this.#v!==s&&this.display(s)}))})))),this}addPairs(t,e){this.controllersContainer.append(t),this.contentContainer.append(e);const s=this.controllersContainer.length;return this.controllersContainer.at(-1).setAttr("role","tab").setAttr("aria-controls","tab"+(s-1)),this.contentContainer.at(-1).setAttr("role","tabpanel").setAttr("aria-labelledby","tab"+(s-1)).setAttr("tabindex",-1),this}removePairs(t){}display(t){this.#v=t%this.contentContainer.length;const e=this.contentContainer.at(this.#v);return this.controllersContainer.forEach((t=>t.setAttr("tabindex",-1).setAttr("aria-selected",!1))),this.controllersContainer.at(this.#v).setAttr("tabindex",0).setAttr("aria-selected",!0),this.contentContainer.forEach((t=>t.st.hide())),e.st.translateX(100,0),e.setAttr("tabindex",0).st.show(),e.st.translateX(0,1e3),this}next(t=1){return this.display(this.#v+t),this}previous(t=1){return this.display(this.#v-t),this}useVertical(){return this.vertical(0,0),this.controllersContainer.horizontal(0,0),this.controllersContainer.style({width:"100%",height:100*this.cache.config.controllersPercent+"%"}),this.contentContainer.style({width:"100%",height:100*(1-this.cache.config.controllersPercent)+"%"}),this}useHorizontal(){return this.horizontal(0,0),this.controllersContainer.vertical(0,0),this.controllersContainer.style({height:"100%",width:100*this.cache.config.controllersPercent+"%"}),this.contentContainer.style({height:"100%",width:100*(1-this.cache.config.controllersPercent)+"%"}),this}}const yo=(t,e)=>new bo(t,e),vo={success:{titleColor:"green",contentColor:"#35495e",bgColor:"#d4edda",bgColor:"linear-gradient(-225deg, #DFFFCD 0%, #90F9C4 48%, #39F3BB 100%)",borderColor:"#28a745",icon:"✅"},info:{titleColor:"blue",contentColor:"#00204a",bgColor:"#93deff",bgColor:"radial-gradient(circle at 10% 20%, rgb(147, 230, 241) 0%, rgb(145, 192, 241) 45.5%)",borderColor:"#005689",icon:"ℹ️"},warning:{titleColor:"#e4663a",contentColor:"#45171d",bgColor:"#fdffcd",bgColor:"radial-gradient(907px at 3.4% 19.8%, rgb(255, 243, 122) 0%, rgb(255, 102, 145) 97.4%)",borderColor:"#efd510",icon:"⚠️"},danger:{titleColor:"red",contentColor:"#721c24",bgColor:"#f8d7da",bgColor:"linear-gradient(90deg, rgb(255, 157, 129) 24.3%, rgb(255, 138, 138) 78.3%)",borderColor:"#c50000",icon:"❌"},tips:{titleColor:null,contentColor:null,bgColor:null,borderColor:null,icon:"💡"},important:{titleColor:null,contentColor:null,bgColor:null,borderColor:null,icon:"📌"}};class wo extends fn{constructor(t,e,s){super(),this.title=Wi(e),this.icon=ji(vo[t].icon).style({display:"flex",justifyContent:"center",borderRadius:"50%",minWidth:"30px",minHeight:"30px"}),this.content=s,this.vertical().size("200px","auto").style({borderRadius:"10px",padding:"10px"}),this.append(bn(this.title,this.icon).size("100%","40px").style({}).horizontal("space-between",0),this.content),this.useType(t)}get isAlert(){return!0}useType(t){return this.style({color:vo[t].color,background:vo[t].bgColor,border:"1px darkblue solid",borderLeft:`15px ${vo[t].borderColor} solid`}),this.title.style({color:vo[t].titleColor}),this.content.st.color(vo[t].titleColor),this.icon.setValue(vo[t].icon).style({border:`2px ${vo[t].borderColor} solid`,alignItems:"warning"===t?"flex-start":"center"}),this}useSuccess(){return this.useType("success"),this}useInfo(){return this.useType("info"),this}useWarning(){return this.useType("warning"),this}useDanger(){return this.useType("danger"),this}}const xo=(t,e)=>new wo("success",t,e),ko=(t,e)=>new wo("info",t,e),_o=(t,e)=>new wo("warning",t,e),Co=(t,e)=>new wo("danger",t,e);class Eo extends ki{constructor(t,e,s){super("div","Splitter"),Object.assign(this.cache,{isResizing:!1,flexDirection:t,resizerCursor:e,resizerProp:s}),this.style({display:"flex",flexDirection:this.cache.flexDirection,border:"2px solid #333",overflow:"hidden"}),this.resizer=new ki("div","resizer").style({[this.cache.resizerProp]:"5px",backgroundColor:"gold",cursor:this.cache.resizerCursor,touchAction:"none"}),this.onPtrDown((t=>{this.cache.isResizing=!0,this.style({cursor:this.cache.resizerCursor}),this.resizer.element.setPointerCapture(t.event.pointerId)})),this.onPtrUp((t=>{this.cache.isResizing=!1,this.style({cursor:"default"}),this.resizer.element.releasePointerCapture(t.event.pointerId)})),this.onPtrCancel((()=>{this.cache.isResizing=!1,this.style({cursor:"default"})})),this.onPtrOut((()=>{this.cache.isResizing&&(this.cache.isResizing=!1,this.style({cursor:"default"}))}))}get isSplitter(){return!0}styleResizer(t={}){return this.resizer.style(t),this}}class Io extends Eo{constructor(t,e){super("row","ew-resize","width"),this.leftPane=t.style({width:"50%",flexGrow:1,overflow:"hidden"}),this.rightPane=e.style({width:"50%",flexGrow:1,overflow:"hidden"}),this.element?.append(this.leftPane.element,this.resizer.element,this.rightPane.element),this.onPtrMove((t=>{if(!this.cache.isResizing)return;const e=this.element.getBoundingClientRect().width;let s=(t.event.clientX-this.element.getBoundingClientRect().x)/e*100,i=100-s;s<0&&(s=0),i<0&&(i=0),this.leftPane.element.style.width=`${s}%`,this.rightPane.element.style.width=`${i}%`}))}get isHorizontalSplitter(){return!0}}const To=(t,e)=>new Io(t,e);class Ao extends Eo{constructor(t,e){super("column","ns-resize","height"),this.topPane=t.style({height:"50%",flexGrow:1,overflow:"hidden"}),this.bottomPane=e.style({height:"50%",flexGrow:1,overflow:"hidden"}),this.element?.append(this.topPane.element,this.resizer.element,this.bottomPane.element),this.onPtrMove((t=>{if(!this.cache.isResizing)return;const e=this.element.getBoundingClientRect().height;let s=(t.event.clientY-this.element.getBoundingClientRect().y)/e*100,i=100-s;s<0&&(s=0),i<0&&(i=0),this.topPane.element.style.height=`${s}%`,this.bottomPane.element.style.height=`${i}%`}))}get isHorizontalSplitter(){return!0}}const So=(t,e)=>new Ao(t,e),Mo=({orintation:t="horizontal",slides:e=[]})=>["v","vertical"].includes(t.toLowerCase())?So(...e):["h","horizontal"].includes(t.toLowerCase())?To(...e):void 0;class Oo extends ki{constructor(...t){super("ul","Breadcrumbs"),Object.assign(this.cache,{separatorTextContent:"/"}),this.style({listStyle:"none",display:"flex",flexWrap:"wrap"}),this.list=Br("li").style({display:"flex",flexWrap:"wrap"}),this.append(...t)}#m(t){["string","number","boolean"].includes(typeof t)&&(t=ji(t));const e=Br("li",t).style({display:"flex",alignItems:"center"});if(this.element.children.length>0){const t=ji(this.cache.separatorTextContent).style({padding:"0 4px"});this.element?.append(t.element)}this.element?.append(e.element)}append(...t){return t.forEach((t=>this.#m(t))),this}configSeparator(t=this.cache.separator,e={}){this.cache.separatorTextContent=t;return[...this.element.children].filter((t=>"SPAN"===t.tagName)).forEach((s=>{s.textContent=t,Object.assign(s.style,e)})),this}}const jo=(...t)=>new Oo(...t);class Do extends fn{constructor(t,e){super("div","menu3d"),this.controller=t,this.content=e,this.cover=null,Object.assign(this.cache,{config:{useTransfo:!1,isOpen:!1,position:"left",threshold:40,angle:70,overlap:6,width:300,height:300,transitionDuration:"0.5s",transitionEasing:"ease",menuTransformOrigin:null,menuTransformClosed:null,menuTransformOpened:null,contentTransformOrigin:null,contentTransformClosed:null,contentTransformOpened:null}}),this.append(this.controller,this.content),this.update()}get isOpen(){return this.cache.config.isOpen}update(){this.controller.style({display:"none",padding:"20px",overflow:"auto",background:"darkblue",color:"#eee",webkitboxSizing:"border-box",mozBoxSizing:"border-box",boxSizing:"border-box"}),this.content.style({padding:"20px 40px",width:"100%",height:"100%",background:"gold",color:"#eee",webkitboxSizing:"border-box",mozBoxSizing:"border-box",boxSizing:"border-box",webkitOverflowScrolling:"touch",webkitTransformStyle:"preserve-3d"}),this.setupPositions(),this.setupWrapper(),this.setupCover(),this.setupMenu(),this.setupContent()}setupPositions(){this.cache.config.menuTransformOpened="",this.cache.config.contentTransformClosed="";let t=this.cache.config.angle,e=this.cache.config.angle/-2;switch(this.cache.config.position){case"top":this.cache.config.menuTransformOrigin="50% 0%",this.cache.config.menuTransformClosed=`rotateX(${t}deg) translateY(-100%) translateY(${this.cache.config.overlap}px)`,this.cache.config.contentTransformOrigin="50% 0",this.cache.config.contentTransformOpened=`translateY(${this.height/2}px) rotateX(${e}deg)`;break;case"right":this.cache.config.menuTransformOrigin="100% 50%",this.cache.config.menuTransformClosed="rotateY( "+t+"deg ) translateX( 100% ) translateX( -2px ) scale( 1.01 )",this.cache.config.contentTransformOrigin="100% 50%",this.cache.config.contentTransformOpened="translateX( -"+this.width/2+"px ) rotateY( "+e+"deg )";break;case"bottom":this.cache.config.menuTransformOrigin="50% 100%",this.cache.config.menuTransformClosed="rotateX( "+-t+"deg ) translateY( 100% ) translateY( -"+this.cache.config.overlap+"px )",this.cache.config.contentTransformOrigin="50% 100%",this.cache.config.contentTransformOpened="translateY( -"+this.height/2+"px ) rotateX( "+-e+"deg )";break;default:this.cache.config.menuTransformOrigin="100% 50%",this.cache.config.menuTransformClosed="translateX( -100% ) translateX( "+this.cache.config.overlap+"px ) scale( 1.01 ) rotateY( "+-t+"deg )",this.cache.config.contentTransformOrigin="0 50%",this.cache.config.contentTransformOpened="translateX( "+this.width/2+"px ) rotateY( "+-e+"deg )"}}setupWrapper(){this.style({perspective:"800px",perspectiveOrigin:this.cache.config.contentTransformOrigin})}setupCover(){this.cover&&this.cover.element.parentNode.removeChild(this.cover.element),this.cover=new ki("div","div").style({position:"absolute",display:"block",width:"100%",height:"100%",left:0,top:0,zIndex:1e3,visibility:"hidden",opacity:0,transition:`all ${this.cache.config.transitionDuration} ${this.cache.config.transitionEasing}`}),this.content.element.appendChild(this.cover.element)}setupMenu(){switch(this.cache.config.position){case"top":this.controller.style({width:"100%",height:this.height/2+"px"});break;case"right":this.controller.style({right:0,width:this.width/2+"px",height:"100%"});break;case"bottom":this.controller.style({bottom:"0",width:"100%",height:this.height/2+"px"});break;case"left":this.controller.style({width:this.width/2+"px",height:"100%"})}this.controller.style({position:"fixed",display:"block",zIndex:1,transform:this.cache.config.menuTransformClosed,transformOrigin:this.cache.config.menuTransformOrigin,transition:"all "+this.cache.config.transitionDuration+" "+this.cache.config.transitionEasing})}setupContent(){this.content.style({transform:this.cache.config.contentTransformClosed,transformOrigin:this.cache.config.contentTransformOrigin,transition:`all ${this.cache.config.transitionDuration} ${this.cache.config.transitionEasing}`})}open(){this.cache.config.isOpen||(this.cache.config.isOpen=!0,this.cover.style({height:this.content.element.scrollHeight+"px",visibility:"visible",opacity:1}),this.cache.config.useTransfo&&this.content.style({transform:this.cache.config.contentTransformOpened,userSelect:"default"}),this.controller.style({transform:this.cache.config.menuTransformOpened,useSelect:"none"}),this.emit("opened"))}close(){this.cache.config.isOpen&&(this.cache.config.isOpen=!1,this.cover.style({visibility:"hidden",opacity:0}),this.content.style({transform:this.cache.config.contentTransformClosed,useSelect:"default"}),this.controller.style({transform:this.cache.config.menuTransformClosed,userSelect:"none"})),this.emit("closed")}onOpen(t){return this.on("opened",t.bind(this)),this}onClose(t){return this.on("closed",t.bind(this)),this}#w(t){if(this.cache.config.position!==t){this.cache.config.position=t;const e=this.isOpen;this.close(),this.update(),e&&this.open()}}useRight(){return this.#w("left"),this}useRight(){return this.#w("right"),this}useTop(){return this.#w("top"),this}useBottom(){return this.#w("bottom"),this}}const Zo=(t,e)=>new Do(t,e);globalThis.menu3d=Zo;class Po extends _i{constructor(...t){super("dialog","modal"),this.append(...t),Object.assign(this.cache,{config:{mode:"modal",useTransition:!0}}),this.style({display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",padding:"20px",border:"none",backgroundCcolor:"#f5f5f5",boxShadow:"0px 4px 10px rgba(0, 0, 0, 0.1)",borderRadius:"8px"}),this.close()}open(){if(!this.element.open){if("modal"===this.cache.config.mode)this.element.showModal();else this.element.show();this.st.fadeIn(1e3),this.emit("modal:opened")}return this}close(){return this.st.fadeOut(1e3),this.element.open&&this.element.close(),this.emit("modal:closed"),this}closeAfter(t=1e3){return globalThis?.setTimeout((()=>this.close()),t),this}onOpen(t){return this.on("modal:opened",t.bind(this)),this}onClose(t){return this.on("modal:closed",t.bind(this)),this}useModal(){return this.cache.config.mode="modal",this}useDialog(){return this.cache.config.mode="dialog",this}useTransition(t=!0){return this.cache.config.useTransition=t,this}}const Lo=(...t)=>new Po(...t);class Uo extends zn{constructor(){super("section",""),Object.assign(this.cache,{currentIndex:0,slideBuilder:null}),this.container=ro().size("100%","100%").vertical(0,0).style({overflow:"hidden"}),this.container.setAttr({ariaRoledescription:"carousel",ariaLive:"polite",ariaLabel:"Content Slider"}),this.track=Vn().size("100%","100%").style({transition:"transform 0.3s ease-in-out"}),this.bullets=ro().style({gap:"10px",padding:"10px"}),this.container.append(this.track,this.bullets),this.append(this.container)}#x(){for(let t=0;t<this.track.items.length;t++)this.track[t].setAttr({ariaHidden:t!==this.cache.currentIndex})}goto(t=0){this.cache.currentIndex=t,this.__updatePos(),this.#x()}next(t=1){return this.cache.currentIndex+=t,this.__updatePos(),this.#x(),this}previous(t=1){return this.cache.currentIndex-=t,this.__updatePos(),this.#x(),this}#k(){const t=this.track.items.length;for(let e=0;e<t;e++)this.track.items[e].setAttr({ariaLabel:`Slide ${e+1} of ${t}`,dataSlideIndex:e}),this.bullets.items[e].setAttr({dataIndex:e,ariaLabel:`Go to slide ${e}`}),this.bullets[e].events.click?.destroy(),this.bullets[e].onClick((()=>this.goto(e)))}#_(t){this.track.append(this.cache.slideBuilder(t).setAttr({ariaRoledescription:"slide",role:"group",ariaLabel:""}));const e=ji().size("15px","15px").style({borderRadius:"50%",cursor:"pointer",border:"3px solid blue",background:"white"}).setAttr({role:"button",tabIndex:0}).onPtrEnter((t=>t.target.st.background("gold").scale(1.2,1.2))).onPtrLeave((t=>t.target.st.background("white").scale(1,1)));return this.bullets.append(e),this}addSlides(...t){return t.forEach((t=>this.#_(t))),this.#k(),this.#x(),this}}class Ro extends Uo{constructor(...t){super("section","hSlider"),this.container.vertical(0,0),Object.assign(this.cache,{slideBuilder:t=>ro(t).style({minWidth:"100%",width:"100%",height:"100%"}).vertical(0,0)}),this.track.size("100%","90%").style({display:"flex"}),this.addSlides(...t),this.bullets.horizontal(0,0).style({width:"100%",height:"10%"})}__updatePos(){const t=this.container.width;this.track.st.translateX(-this.cache.currentIndex*t)}}const zo=(...t)=>new Ro(...t);class $o extends Uo{constructor(...t){super("section","vSlider"),Object.assign(this.cache,{slideBuilder:t=>ro(t).size("100%","100%").vertical(0,0)}),this.addSlides(...t),this.container.horizontal(0,0),this.track.size("90%","100%"),this.bullets.vertical(0,0).style({height:"100%",width:"10%"})}__updatePos(){const t=this.container.height;this.track.st.translateY(-this.cache.currentIndex*t)}}const No=(...t)=>new $o(...t),Fo=({orintation:t="horizontal",slides:e=[]})=>["v","vertical"].includes(t.toLowerCase())?No(...e):["h","horizontal"].includes(t.toLowerCase())?zo(...e):void 0;const Vo={...Gi,...rr,...Cn,...nn,...Pn,...Gn,...Wr,...Object.freeze({__proto__:null,Accordion:so,Breadcrumbs:jo,Carousel:co,CodeCell:fo,CodeNote:po,Collapsible:to,Flex:bn,Grid:Qn,Modal:Lo,Slider:Fo,Splitter:Mo,Tabs:yo,ZikoUIAccordion:eo,ZikoUIBreadcrumbs:Oo,ZikoUICodeNote:uo,ZikoUIFlex:fn,ZikoUIGrid:Kn,ZikoUIHorizontalSlider:Ro,ZikoUIHorizontalSplitter:Io,ZikoUIMenu3d:Do,ZikoUIModal:Po,ZikoUIVerticalSlider:$o,ZikoUIVerticalSplitter:Ao,dangerAlert:Co,hSlider:zo,hSplitter:To,infoAlert:ko,menu3d:Zo,successAlert:xo,vSlider:No,vSplitter:So,warningAlert:_o}),ZikoUIElement:ki,ZikoUIContainerElement:_i},Bo=t=>(new XMLSerializer).serializeToString(t),Ho=t=>btoa(Bo(t)),Wo=t=>"data:image/svg+xml;base64,"+Ho(t),Xo=(t,e=!0)=>Gr(Wo(t)).render(e),qo=t=>JSON.stringify(I((t=>["number","string","boolean","bigint"].includes(typeof t)?String(t):t instanceof ga||t instanceof ha?t.toString():t instanceof Array?Go(t):void 0),t),null," ").replace(/"([^"]+)":/g,"$1:").replace(/: "([^"]+)"/g,": $1"),Yo=t=>{if(!Array.isArray(t))return 0;let e=1;for(const s of t)if(Array.isArray(s)){const t=Yo(s);t+1>e&&(e=t+1)}return e},Go=t=>{let e=0;return function t(s){let i=Yo(s),r=0;return s.some((t=>Array.isArray(t)))&&(e++,r=1),"["+s.map(((i,r)=>["number","string","boolean","bigint"].includes(typeof i)?String(i):i instanceof ga?i.toString():i instanceof Array?`\n${" ".repeat(e)}${t(i)}${r===s.length-1?"\n":""}`:i instanceof Object?qo(i):void 0))+`${" ".repeat((i+e+1)*r)}]`}(t)},Ko=(t,e=0)=>{t=Qo(t);let s="";const i=" ".repeat(e);for(let r in t)if("object"==typeof t[r]){s+=`${i}${r} {\n`;const n=t[r];for(let t in n)"object"==typeof n[t]?s+=Ko({[t]:n[t]},e+1):s+=`${i} ${t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}: ${n[t]};\n`;s+=`${i}}\n`}return s};function Qo(t){return"object"!=typeof t||null===t?t:Object.keys(t).reduce(((e,s)=>(e[s.trim()]=Qo(t[s]),e)),Array.isArray(t)?[]:{})}var Jo=Object.freeze({__proto__:null,adoc2html:Lt,arr2str:Go,csv2arr:Ut,csv2json:$t,csv2matrix:Rt,csv2object:zt,csv2sql:Nt,json2arr:Bt,json2css:Ko,json2csv:Ht,json2csvFile:Wt,json2xml:Kt,json2xmlFile:Qt,json2yml:Yt,json2ymlFile:Gt,markdown2html:St,obj2str:qo,svg2ascii:Ho,svg2img:Xo,svg2imgUrl:Wo,svg2str:Bo}),ta=Object.freeze({__proto__:null});const ea={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 sa{constructor(t){this.string=t}isDigit(){return ea.isDigit.test(this.string)}static isDigit(t){return new sa(t).isDigit()}isNumber(){return!isNaN(this.string)}static isNumber(t){return new sa(t).isNumber()}isUrl(){return ea.isURL.test(this.string)}static isUrl(t){return new sa(t).isUrl()}isHexColor(){return ea.isHexColor.test(this.string)}static isHexColor(t){return new sa(t).isHexColor()}isIPv4(){return ea.isIPv4.test(this.string)}static isIPv4(t){return new sa(t).isIPv4()}isDate(){return ea.isDate.test(this.string)}static isDate(t){return new sa(t).isDate()}isMACAddress(){return ea.isMACAddress.test(this.string)}static isMACAddress(t){return new sa(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 sa(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 sa(t).isCamelCase()}isHyphenCase(){return this.string.split("-").length>1}static isHyphenCase(t){return new sa(t).isHyphenCase()}isSnakeCase(){return this.string.split("_").length>1}static isSnakeCase(t){return new sa(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 sa(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 sa(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 ia=t=>t.replace(/\s+/g," "),ra=(t,e)=>t.split("").filter((t=>t==e)).length,na=(t,e)=>t.split(" ").filter((t=>t==e)).length,oa=t=>new sa(t);const aa={...Ct,...Jo,...ta,...Object.freeze({__proto__:null,Str:sa,count:ra,countWords:na,removeExtraSpace:ia,str:oa})};class ha extends E{constructor(t,e,s=[]){if(super(),t instanceof ha)this.arr=t.arr,this.rows=t.rows,this.cols=t.cols;else{let i,r,n=[];if(arguments[0]instanceof Array)t=arguments[0].length,e=arguments[0][0].length,n=arguments[0];else for(i=0;i<t;i++)for(n.push([]),n[i].push(new Array(e)),r=0;r<e;r++)n[i][r]=s[i*e+r],null==s[i*e+r]&&(n[i][r]=0);this.rows=t,this.cols=e,this.arr=n}this._maintain()}toString(){return Go(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 ha(t,e,this.arr.flat(1));console.error("Err")}static eye(t){let e=new ha(t,t);for(let s=0;s<t;s++)for(let i=0;i<t;i++)e.arr[s][i]=s===i?1:0;return e}get clone(){return new ha(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 ha(this.cols,this.rows,this.arr.flat(1).reel)}get imag(){return new ha(this.cols,this.rows,this.arr.flat(1).imag)}_maintain(){for(let t=0;t<this.arr.length;t++)Object.assign(this,{[[t]]:this.arr[t]});return this}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==ha.sub(e,t).max&&0==ha.sub(e,t).min}get isAntiSym(){if(!this.isSquare)return!1;const t=this.T,e=this.clone;return 0==ha.add(e,t).max&&0==ha.add(e,t).min}get isDiag(){if(!this.isSquare)return!1;const t=this.T,e=this.clone,s=ha.mul(e,t),i=ha.dot(t,e);return 0==ha.sub(s,i).max&&0==ha.sub(s,i).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=ha.dot(t,t);return 0==ha.sub(e,t).max&&0==ha.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 ha(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 ha))?void console.warn("Tensors are not completely supported yet ..."):at.sub(at.mul(s[0][0],s[1][1]),at.mul(s[0][1],s[1][0]));for(var i=0,r=0;r<s.length;r++){const n=at.add(at.mul(Ta(-1,r),at.mul(s[0][r],e(t(s,r)))));i=at.add(i,n)}return i}(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,i=0,r=t.length,n=0,o=[],a=[];for(e=0;e<r;e+=1)for(o[o.length]=[],a[a.length]=[],i=0;i<r;i+=1)o[e][i]=e==i?1:0,a[e][i]=t[e][i];for(e=0;e<r;e+=1){if(0==(n=a[e][e])){for(s=e+1;s<r;s+=1)if(0!=a[s][e]){for(i=0;i<r;i++)n=a[e][i],a[e][i]=a[s][i],a[s][i]=n,n=o[e][i],o[e][i]=o[s][i],o[s][i]=n;break}if(0==(n=a[e][e]))return}for(i=0;i<r;i++)a[e][i]=a[e][i]/n,o[e][i]=o[e][i]/n;for(s=0;s<r;s++)if(s!=e)for(n=a[s][e],i=0;i<r;i++)a[s][i]-=n*a[e][i],o[s][i]-=n*o[e][i]}return o}(this.arr);return new ha(this.rows,this.cols,t.flat(1))}static zeros(t,e){let s=new ha(t,e);for(let r=0;r<t;r++)for(var i=0;i<e;i++)s.arr[r][i]=0;return s}static ones(t,e){let s=new ha(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)s.arr[i][t]=1;return s}static nums(t,e,s){let i=new ha(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)i.arr[r][t]=s;return i}static get rand(){return{int:(t,e,s,i)=>{let r=new ha(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)r.arr[n][t]=ft.randInt(s,i);return r},bin:(t,e)=>{let s=new ha(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)s.arr[i][t]=ft.randBin;return s},hex:(t,e)=>{let s=new ha(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)s.arr[i][t]=ft.randHex;return s},choices:(t,e,s,i)=>{let r=new ha(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)r.arr[n][t]=ft.choice(s,i);return r},permutation:(t,e,s)=>{}}}static rands(t,e,s=1,i){let r=new ha(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)r.arr[n][t]=ft.rand(s,i);return r}map(t,e,s,i){return at.map(this,t,e,s,i)}lerp(t,e){return at.lerp(this,t,e)}norm(t,e){return at.norm(this,t,e)}clamp(t,e){return at.clamp(this,t,e)}static map(t,e,s,i,r){return at.map(t,e,s,i,r)}static lerp(t,e,s){return at.lerp(t,e,s)}static norm(t,e,s){return at.norm(t,e,s)}static clamp(t,e,s){return at.clamp(la,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 ha(this.rows,this.cols,t)}get toOct(){let t=this.arr.flat(1).toOct;return new ha(this.rows,this.cols,t)}get toHex(){let t=this.arr.flat(1).toHex;return new ha(this.rows,this.cols,t)}max2min(){let t=this.arr.flat(1).max2min;return new ha(this.rows,this.cols,t)}min2max(){let t=this.arr.flat(1).min2max;return new ha(this.rows,this.cols,t)}sortRows(t=void 0){let e=this.arr.map((e=>e.sort(t))).flat(1);return new ha(this.rows,this.cols,e)}sortCols(t=void 0){let e=this.T.arr.map((e=>e.sort(t))).flat(1);return new ha(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 ha(s)}filterByCols(t){return new ha(this.T.arr.filter((e=>e.includes(t))))}sortAll(t=void 0){let e=this.arr.flat(1).sort(t);return new ha(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 ha(this.rows,this.cols,e)}#C(t){if(this.rows!==t.rows)return;let e=this.arr;for(let s=0;s<this.rows;s++)for(let i=this.cols;i<this.cols+t.cols;i++)e[s][i]=t.arr[s][i-this.cols];return this.cols+=t.cols,new ha(this.rows,this.cols,e.flat(1))}hstack(...t){const e=[this,...t].reduce(((t,e)=>t.#C(e)));return Object.assign(this,e),this}static hstack(t,...e){return t.clone.hstack(...e)}#E(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 i=0;i<this.cols;i++)e[s][i]=t.arr[s-this.rows][i]}return this.rows+=t.rows,new ha(this.rows,this.cols,e.flat(1))}vstack(...t){const e=[this,...t].reduce(((t,e)=>t.#E(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.#C(e)));return Object.assign(this,e),this}vqueue(...t){const e=[this,...t].reverse().reduce(((t,e)=>t.#E(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,i=this.cols-1){let r=s-t,n=i-e,o=new Array(n);for(let s=0;s<r;s++){o[s]=[];for(let i=0;i<n;i++)o[s][i]=this.arr[s+t][i+e]}return new ha(r,n,o.flat(1))}static slice(t,e=0,s=0,i=this.rows-1,r=this.cols-1){return t.slice(e,s,i,r)}splice(t,e,s,...i){}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 ga)&&(t[s]=ha.nums(this.rows,this.cols,t[s]));for(let i=0;i<this.rows;i++)for(var e=0;e<this.cols;e++)this.arr[i][e]=at.add(this.arr[i][e],t[s].arr[i][e])}return new ha(this.rows,this.cols,this.arr.flat(1))}sub(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=ha.nums(this.rows,this.cols,t[s]));for(let i=0;i<this.rows;i++)for(var e=0;e<this.cols;e++)this.arr[i][e]=at.sub(this.arr[i][e],t[s].arr[i][e])}return new ha(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 i=0;i<t.length;i++){"number"==typeof t[i]&&(t[i]=ha.nums(this.rows,this.cols,t[i]));for(var e=0;e<this.rows;e++)for(var s=0;s<this.cols;s++)this.arr[e][s]=at.mul(this.arr[e][s],t[i].arr[e][s])}return new ha(this.rows,this.cols,this.arr.flat(1))}div(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=ha.nums(this.rows,this.cols,t[s]));for(let i=0;i<this.rows;i++)for(var e=0;e<this.cols;e++)this.arr[i][e]=at.div(this.arr[i][e],t[s].arr[i][e])}return new ha(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]=ha.nums(this.rows,this.cols,t[s]));for(let i=0;i<this.rows;i++)for(var e=0;e<this.cols;e++)this.arr[i][e]=at.modulo(this.arr[i][e],t[s].arr[i][e])}return new ha(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 i=0;i<t.arr[0].length;i++){e[s][i]=0;for(var r=0;r<this.arr[0].length;r++)e[s][i]=at.add(e[s][i],at.mul(this.arr[s][r],t.arr[r][i]))}}return new ha(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 i=0;i<t-1;i++)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 ga))}get min(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(J(...this.arr[e]));return J(...t)}get max(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(tt(...this.arr[e]));return tt(...t)}get minRows(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(J(...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(tt(...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 ha(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 ha(t.rows,t.cols);return e.arr=t.arr,e}DecompositionLU(){const[t,e]=bt(this);return{L:t,U:e}}static DecompositionLU(...t){const e=t.map((t=>t.clone.LU()));return 1===e.length?e[0]:e}DecompositionQR(){const[t,e]=xt(this);return{Q:t,R:e}}static DecompositionQR(...t){const e=t.map((t=>t.clone.DecompositionQr()));return 1===e.length?e[0]:e}DecompositionCholesky(){return{L:kt(this)}}static DecompositionCholesky(...t){const e=t.map((t=>t.clone.DecompositionCholesky()));return 1===e.length?e[0]:e}get decomposition(){return{LU:()=>this.DecompositionLU(),QR:()=>this.DecompositionQR(),Cholesky:()=>this.DecompositionCholesky()}}static get decomposition(){return{LU:(...t)=>ha.LU(...t),QR:(...t)=>ha.QR(...t),CHOLESKY:(...t)=>ha.CHOLESKY(...t)}}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 i=0;i<s[0].length;i++)s[t][i].innerHTML=this.arr[t][i],e[t].appendChild(s[t][i]);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 i=this.T.arr.map((t=>t.map(((t,e)=>Object.assign({},{x:t,y:e}))))),r=this.T.arr.map((t=>t.map(((t,e)=>Object.assign({},{x:t,y:e})))));"num"===e?"asc"===s?i[t].sort(((t,e)=>t.x-e.x)):"desc"===s?i[t].sort(((t,e)=>e.x-t.x)):"toggle"===s&&(i[t][0].x>i[t][1].x?i[t].sort(((t,e)=>e.x-t.x)):i[t].sort(((t,e)=>t.x-e.x))):"alpha"===e&&("asc"===s?i[t].sort(((t,e)=>(""+t.x).localeCompare(""+e.x))):"desc"===s&&i[t].sort(((t,e)=>(""+e.x).localeCompare(""+t.x)))),s=i[t].map((t=>t.y));for(let e=0;e<i.length;e++)e!==t&&i[e].map(((t,e)=>t.y=s[e]));for(let e=0;e<i.length;e++)e!==t&&r[e].map(((t,r)=>t.x=i[e][s[r]].x));r[t]=i[t];var n=r.map((t=>t.map((t=>t.x))));return new ha(n).T}}const la=(t,e,s)=>new ha(t,e,s),ca=(...t)=>new ha(2,2,t),ua=(...t)=>new ha(3,3,t),pa=(...t)=>new ha(4,4,t);class da{static resolve(t,e){return t.inv.dot(ha.fromVector(e)).arr.flat(1).map((t=>+t.toFixed(10)))}}var ma=Object.freeze({__proto__:null,LinearSystem:da,Matrix:ha,choleskyDecomposition:kt,luDecomposition:bt,matrix:la,matrix2:ca,matrix3:ua,matrix4:pa,qrDecomposition:xt});class ga extends E{constructor(t=0,e=0){super(),t instanceof ga?(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=Ia(t.z**2-t.a**2)):"a"in e&&"phi"in t?(this.a=t.a,this.b=t.a*Da(t.phi)):"b"in e&&"z"in t?(this.b=t.b,this.a=Ia(t.z**2-t.b**2)):"b"in e&&"phi"in t?(this.b=e,this.a=t.b/Da(t.phi)):"z"in e&&"phi"in t&&(this.a=t.z*Oa(t.phi),this.a=t.z*ja(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 ga(this.a,this.b)}get z(){return sh(this.a,this.b)}get phi(){return Qa(this.b,this.a)}static Zero(){return new ga(0,0)}get conj(){return new ga(this.a,-this.b)}get inv(){return new ga(this.a/(Ta(this.a,2)+Ta(this.b,2)),-this.b/(Ta(this.a,2)+Ta(this.b,2)))}add(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new ga(t[e],0));let e=t.map((t=>t.a)),s=t.map((t=>t.b));return this.a+=+K(...e).toFixed(15),this.b+=+K(...s).toFixed(15),this}sub(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new ga(t[e],0));let e=t.map((t=>t.a)),s=t.map((t=>t.b));return this.a-=+K(...e).toFixed(15),this.b-=+K(...s).toFixed(15),this}mul(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new ga(t[e],0));let e=+Q(this.z,...t.map((t=>t.z))).toFixed(15),s=+K(this.phi,...t.map((t=>t.phi))).toFixed(15);return this.a=+(e*Oa(s).toFixed(15)).toFixed(14),this.b=+(e*ja(s).toFixed(15)).toFixed(14),this}div(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new ga(t[e],0));let e=+(this.z/Q(...t.map((t=>t.z)))).toFixed(15),s=+(this.phi-K(...t.map((t=>t.phi)))).toFixed(15);return this.a=+(e*Oa(s).toFixed(15)).toFixed(15),this.b=+(e*ja(s).toFixed(15)).toFixed(15),this}pow(t){if(Ga(t)===t&&t>0){let e=+(this.z**t).toFixed(15),s=+(this.phi*t).toFixed(15);this.a=+(e*Oa(s).toFixed(15)).toFixed(15),this.b=+(e*ja(s).toFixed(15)).toFixed(15)}return this}static fromExpo(t,e){return new ga(+(t*Oa(e)).toFixed(13),+(t*ja(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 fa(t**this.a*Oa(this.b*Ma(t)),t**this.a*ja(this.b*Ma(t)))}sqrtn(t=2){return fa(Aa(this.z,t)*Oa(this.phi/t),Aa(this.z,t)*ja(this.phi/t))}get sqrt(){return this.sqrtn(2)}get log(){return fa(this.z,this.phi)}get cos(){return fa(Oa(this.a)*Fa(this.b),ja(this.a)*Va(this.b))}get sin(){return fa(ja(this.a)*Fa(this.b),Oa(this.a)*Va(this.b))}get tan(){const t=Oa(2*this.a)+Fa(2*this.b);return fa(ja(2*this.a)/t,Va(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 fa=(t,e)=>{if((t instanceof Array||ArrayBuffer.isView(t))&&(e instanceof Array||ArrayBuffer.isView(t)))return t.map(((s,i)=>fa(t[i],e[i])));if(t instanceof ha&&e instanceof ha){if(t.shape[0]!==e.shape[0]||t.shape[1]!==e.shape[1])return Error(0);const s=t.arr.map(((s,i)=>fa(t.arr[i],e.arr[i])));return new ha(t.rows,t.cols,...s)}return new ga(t,e)};var ba=Object.freeze({__proto__:null,Complex:ga,complex:fa});const ya=t=>{const e=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7];if(t<.5)return+(Math.PI/(Math.sin(Math.PI*t)*ya(1-t))).toFixed(10);t-=1;let s=e[0];for(let i=1;i<9;i++)s+=e[i]/(t+i);const i=t+7+.5;return+(Math.sqrt(2*Math.PI)*Math.pow(i,t+.5)*Math.exp(-i)*s).toFixed(10)},va=(...t)=>I(ya,...t),wa=(t,e)=>{let s=0;for(let i=0;i<100;i++){s+=Math.pow(-1,i)*Math.pow(e/2,t+2*i)/(Ja(i)*Ja(t+i))}return s},xa=(t,e)=>{if("number"==typeof t){if("number"==typeof t)return wa(t,e);console.warn("Not supported yet")}else if(t instanceof Array){if("number"==typeof e)return I((t=>wa(t,e)),...t);if(e instanceof Array){const s=[];for(let i=0;i<t.length;i++)s.push(I((e=>wa(t[i],e)),...e));return s}}},ka=(t,e)=>{let s=0;const i=s=>Math.pow(s,t-1)*Math.pow(1-s,e-1);s+=.5*(i(0)+i(1));for(let t=1;t<1e3;t++){s+=i(0+.001*t)}return.001*s},_a=(t,e)=>{if("number"==typeof t){if("number"==typeof t)return ka(t,e);console.warn("Not supported yet")}else if(t instanceof Array){if("number"==typeof e)return I((t=>ka(t,e)),...t);if(e instanceof Array){const s=[];for(let i=0;i<t.length;i++)s.push(I((e=>ka(t[i],e)),...e));return s}}};var Ca=Object.freeze({__proto__:null,bessel:xa,beta:_a,gamma:va});const Ea=(...t)=>I(Math.abs,...t),Ia=(...t)=>I(Math.sqrt,...t),Ta=(t,e)=>{if("number"==typeof t)return"number"==typeof e?Math.pow(t,e):e instanceof ga?ga.fromExpo(t**e.a,e.b*Ma(t)):I((e=>Ta(t,e)),...e);if(t instanceof ga)return"number"==typeof e?ga.fromExpo(t.z**e,t.phi*e):e instanceof ga?ga.fromExpo(t.z**e.a*Sa(-t.phi*e.b),Ma(t.z)*e.b+e.a*t.phi):I((e=>Ta(t,e)),...e);if(t instanceof Array){if("number"==typeof e)return I((t=>Ta(t,e)),...t);if(e instanceof Array){const s=[];for(let i=0;i<t.length;i++)s.push(I((e=>Ta(t[i],e)),...e));return s}}},Aa=(t,e)=>{if("number"==typeof t)return"number"==typeof e?Math.pow(t,1/e):I((e=>Aa(t,e)),...e);if(t instanceof ga)return"number"==typeof e?ga.fromExpo(Aa(t.z,e),t.phi/e):I((e=>Aa(t,e)),...e);if(t instanceof Array){if("number"==typeof e)return I((t=>Aa(t,e)),...t);if(e instanceof Array){const s=[];for(let i=0;i<t.length;i++)s.push(I((e=>Aa(t[i],e)),...e));return s}}},Sa=(...t)=>I(Math.exp,...t),Ma=(...t)=>I(Math.log,...t),Oa=(...t)=>I(n,...t),ja=(...t)=>I(o,...t),Da=(...t)=>I(a,...t),Za=(...t)=>I(l,...t),Pa=(...t)=>I(h,...t),La=(...t)=>I(u,...t),Ua=(...t)=>I(p,...t),Ra=(...t)=>I(m,...t),za=(...t)=>I(g,...t),$a=(...t)=>I(f,...t),Na=(...t)=>I(b,...t),Fa=(...t)=>I(y,...t),Va=(...t)=>I(v,...t),Ba=(...t)=>I(w,...t),Ha=(...t)=>I(x,...t),Wa=(...t)=>I(k,...t),Xa=(...t)=>I(_,...t),qa=(...t)=>I(C,...t),Ya=(...t)=>I(Math.ceil,...t),Ga=(...t)=>I(Math.floor,...t),Ka=(...t)=>I(Math.round,...t),Qa=(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=>Qa(t,e,s)),...e);if(t instanceof Array){if("number"==typeof e)return I((t=>Qa(t,e,s)),...t);if(e instanceof Array){const s=[];for(let i=0;i<t.length;i++)s.push(I((e=>Ta(t[i],e)),...e));return s}}},Ja=(...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),th=(...t)=>I(Math.sign,...t),eh=(...t)=>I((t=>1/(1+Sa(-t))),...t),sh=(...t)=>t.every((t=>"number"==typeof t))?Math.hypot(...t):t.every((t=>t instanceof Array))?I(Math.hypot,...t):void 0;const ih={...r,...Object.freeze({__proto__:null,abs:Ea,acos:Ra,acosh:Wa,acot:Na,asin:za,asinh:Xa,atan:$a,atan2:Qa,atanh:qa,bessel:xa,beta:_a,ceil:Ya,cos:Oa,cosh:Fa,cot:Ua,coth:Ha,csc:La,e:Sa,fact:Ja,floor:Ga,gamma:va,hypot:sh,ln:Ma,max:tt,min:J,pow:Ta,round:Ka,sec:Za,sig:eh,sign:th,sin:ja,sinc:Pa,sinh:Va,sqrt:Ia,sqrtn:Aa,tan:Da,tanh:Ba}),...ba,...ma,...ht,...gt,...Ca};class rh extends _i{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,i){let r=Math.abs(s-t),n=Math.abs(i-e);return this.setAttr("viewBox",[t,e,r,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 nh=(t,e)=>new rh(t,e);class oh extends ki{constructor(t){super(),Object.assign(this.cache,{type:t})}pos(t,e){return this.posX(t).posY(e)}posX(t){return["circle","ellipse"].includes(this.cache.type)?this.element.cx.baseVal.value=t:this.element.x.baseVal.value=t,this}posY(t){return["circle","ellipse"].includes(this.cache.type)?this.element.cy.baseVal.value=t:this.element.y.baseVal.value=t,this}translate(t,e){return this}color({stroke:t,fill:e}){return this.element?.setAttribute("stroke",t),this.element?.setAttribute("fill",e),this}fill(t="none"){return this.element?.setAttribute("fill",t),this}stroke(t="none",e){return this.element?.setAttribute("stroke",t),e&&this.strokeWidth(e),this}strokeWidth(t=1){return this.element?.setAttribute("stroke-width",t),this}opacity(t=1){return this.element?.setAttribute("opacity",t),this}}class ah extends oh{constructor(t,e,s){super("circle"),this.element=document.createElementNS("http://www.w3.org/2000/svg","circle"),this.pos(t,e).setR(s)}setR(t){return this.element.r.baseVal.value=t,this}get r(){return this.element.baseVal.value}get cx(){return this.element.baseVal.value}get cy(){return this.element.baseVal.value}}const hh=(t,e,s)=>new ah(t,e,s);class lh extends oh{constructor(t,e,s,i){super("ellipse"),this.element=document?.createElementNS("http://www.w3.org/2000/svg","ellipse"),this.pos(t,e).setRx(s).setRy(i)}setRx(t){return this.element.rx.baseVal.value=t,this}setRy(t){return this.element.ry.baseVal.value=t,this}}const ch=(t,e,s,i)=>new lh(t,e,s,i);class uh extends oh{constructor(t=0,e=0,s="100%",i="100%",...r){super("foreignObject"),this.items=[],this.element=document?.createElementNS("http://www.w3.org/2000/svg","foreignObject"),this.container=bn().setTarget(this.element).vertical(0,0).size("auto","auto"),this.container.st.scaleY(-1),this.posX(t).posY(e).width(s).height(i)}width(t){return this.element.etAttribute("width",t),this}height(t){return this.element.etAttribute("height",t),this}add(...t){return this.container.append(...t),this}remove(...t){return this.container.append(...t),this}}const ph=(t,e,s,i)=>new uh(t,e,s,i);class dh extends oh{constructor(...t){super(),this.items=[],this.element=document?.createElementNS("http://www.w3.org/2000/svg","g"),this.add(...t)}add(...t){for(let e=0;e<t.length;e++)this.element?.appendChild(t[e].element),this.items.push(t[e]);return 1===t.length?t[0]:t}remove(...t){for(let e=0;e<t.length;e++)this.element?.removeChild(t[e].element),this.items=this.items.filter((e=>e!=t));return this}}const mh=(...t)=>new dh(...t);class gh extends oh{constructor(t="",e="100%",s="100%",i=0,r=0){super(),this.element=document?.createElementNS("http://www.w3.org/2000/svg","image"),this.setSrc(t).width(e).height(s).x(i).y(r)}x(t){return this.element.x.baseVal.value=t,this}y(t){return this.element.y.baseVal.value=t,this}width(t){return this.element?.setAttribute("width",t),this}height(t){return this.element?.setAttribute("height",t),this}setSrc(t=""){return this.element?.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t),this}}const fh=(t,e,s,i,r)=>new gh(t,e,s,i,r);class bh extends oh{constructor(t,e,s,i){super(),this.element=document?.createElementNS("http://www.w3.org/2000/svg","line"),this.x1(t).y1(e).x2(s).y2(i).stroke("black")}x1(t){return this.element.x1.baseVal.value=t,this}y1(t){return this.element.y1.baseVal.value=t,this}x2(t){return this.element.x2.baseVal.value=t,this}y2(t){return this.element.y2.baseVal.value=t,this}}const yh=(t,e,s,i)=>new bh(t,e,s,i);class vh extends oh{constructor(t,...e){super(),this.items=[],this.element=document?.createElementNS("http://www.w3.org/2000/svg","a"),this.element.etAttribute("href",t),this.add(...e)}add(...t){for(let e=0;e<t.length;e++)this.element.ppendChild(t[e].element),this.items.push(t[e]);return 1===t.length?t[0]:t}remove(...t){for(let e=0;e<t.length;e++)this.element.moveChild(t[e].element),this.items=this.items.filter((e=>e!=t));return this}}const wh=(t,...e)=>new vh(t,...e);class xh extends oh{constructor(){super(),this.element=document?.createElementNS("http://www.w3.org/2000/svg","path"),this.path=""}setPath(){return this.element.etAttribute("d",this.path),this}clear(){return this.path="",this.setPath(),this}moveTo(t,e){return this.path+=`M${t} ${e} `,this.setPath(),this}lineTo(t,e){return this.path+=`L${t} ${e} `,this.setPath(),this}hr(t){return this.path+=`H${t} `,this.setPath(),this}vr(t){return this.path+=`V${t} `,this.setPath(),this}bezier(t,e,s,i,r,n){return this.path+=`C ${t} ${e},${s} ${i},${r} ${n} `,this.setPath(),this}quadratic(t,e,s,i){return this.path+=`Q ${t} ${e} ${s} ${i} `,this.setPath(),this}close(){return this.path+="Z",this.setPath(),this}}const kh=()=>new xh;class _h extends oh{constructor(t=[],e=[]){super(),this.X=t,this.Y=e,this.element=document?.createElementNS("http://www.w3.org/2000/svg","polygon"),this.element?.setAttribute("points",""),this.addPoints(t,e)}addPoint(t,e){let s=this.element.parentElement.createSVGPoint();return s.x=t,s.y=e,this.element.points.appendItem(s),this}addPoints(t,e){for(let s=0;s<t.length;s++){let i=this.element.parentElement.createSVGPoint();i.x=t[s],i.y=e[s],this.element.oints.appendItem(i)}return this}}const Ch=(t,e)=>new _h(t,e);class Eh extends oh{constructor(t,e,s,i,r=!0){super(),this.element=document?.createElementNS("http://www.w3.org/2000/svg","rect"),this.setX(t).setY(e).width(s).height(i),this.rx=this.x+this.w/2,this.ty=this.y+this.h/2}setX(t){return this.element.x.baseVal.value=t,this.x=t,this}setY(t){return this.element.y.baseVal.value=t,this.y=t,this}r(t,e){return this.rx=t,this.ry=e,this.setX(this.rx-this.w/2),this.setY(this.ry-this.h/2),this}width(t){return this.element.width.baseVal.value=t,this.w=t,this}height(t){return this.element.height.baseVal.value=t,this.h=t,this}}const Ih=(t,e,s,i,r)=>new Eh(t,e,s,i,r);class Th extends oh{constructor(t,e,s){super(),this.element=document?.createElementNS("http://www.w3.org/2000/svg","text"),this.setText(t),this.x(e).y(s)}x(t){return this.element?.setAttribute("x",t),this}y(t){return this.element?.setAttribute("y",t),this}setText(t=""){return this.element.textContent=t,this}}const Ah=(t,e,s)=>new Th(t,e,s),Sh=(t,e,s=10,i=10)=>{let r=kh().fill("none").stroke("coral").strokeWidth(.6);console.log({x:t/s,y:e/i});for(let e=0;e<t;e++)r.moveTo(0,e*t/s).hr(t);for(let t=0;t<e;t++)r.moveTo(t*e/i,0).vr(e);return r};var Mh=Object.freeze({__proto__:null,Svg:nh,ZikoSvgCircle:ah,ZikoSvgEllipse:lh,ZikoSvgForeignObject:uh,ZikoSvgGroupe:dh,ZikoSvgImage:gh,ZikoSvgLine:bh,ZikoSvgLink:vh,ZikoSvgPath:xh,ZikoSvgRectangle:Eh,ZikoSvgText:Th,ZikoUISvg:rh,svgCircle:hh,svgEllipse:ch,svgGrid:Sh,svgGroupe:mh,svgImage:fh,svgLine:yh,svgLink:wh,svgObject:ph,svgPath:kh,svgPolygon:Ch,svgRect:Ih,svgText:Ah});class Oh extends _i{constructor(t,e){super("canvas","canvas"),this.ctx=this.element?.getContext("2d"),this.style({border:"1px red solid"}),this.transformMatrix=new ha([[1,0,0],[0,1,0],[0,0,1]]),this.axisMatrix=new ha([[-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,i){return this.transformMatrix[0][0]=this.width/(s-t),this.transformMatrix[1][1]=-this.height/(i-e),this.transformMatrix[0][2]=this.width/2,this.transformMatrix[1][2]=this.height/2,this.axisMatrix=new ha([[t,e],[s,i]]),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,i=this.height){return this.ctx.getImageData(t,e,s,i)}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 Oh;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 jh=(t,e)=>new Oh(t,e);class Dh{constructor(t,e){this.parent=null,this.position={x:t,y:e},this.cache={interact:null,config:{draggable:!1,selected:!1,highlighted:!1,rendered:!1},style:{normal:{strokeEnabled:!0,fillEnabled:!1,strokeColor:"#111111",fillColor:"#777777"},highlighted:{strokeEnabled:!0,fillEnabled:!1,strokeColor:null,fillColor:null}}},this.history={position:[],styles:[]},this.render()}get px(){return(this.position.x??0)+(this.parent?.position?.x??0)}get py(){return(this.position.y??0)+(this.parent?.position?.y??0)}isIntersectedWith(){}isInStroke(t,e){let s;return this.parent&&(this.parent.ctx.setTransform(1,0,0,1,0,0),s=this.parent.ctx.isPointInStroke(this.path,t,e),this.parent.applyTransformMatrix()),s}isInPath(t,e){let s;return this.parent&&(this.parent.ctx.setTransform(1,0,0,1,0,0),s=this.parent.ctx.isPointInPath(this.path,t,e),this.parent.applyTransformMatrix()),s}posX(t){return this.position.x=t,this.parent&&this.parent.draw(),this}posY(t){return this.position.y=t,this.parent&&this.parent.draw(),this}color({stroke:t=this.cache.style.normal.strokeColor,fill:e=this.cache.style.normal.fillColor}={stroke:t,fill:e}){return this.cache.style.normal.strokeColor=t,this.cache.style.normal.fillColor=e,this.parent&&this.parent.draw(),this}translate(t=0,e=0){this.position.x+=t,this.position.y+=e,this.parent&&this.parent.draw()}applyNormalStyle(t){return t.strokeStyle=this.cache.style.normal.strokeColor,t.fillStyle=this.cache.style.normal.fillColor,this}applyHighlightedStyle(t){return t.strokeStyle=this.cache.style.highlighted.strokeColor,t.fillStyle=this.cache.style.highlighted.fillColor,this}stroke(t=this.cache.style.normal.strokeColor,e=!0){return this.cache.style.normal.strokeEnabled=e,this.cache.style.normal.strokeColor=t,this.parent&&this.parent.draw(),this}fill(t=this.cache.style.normal.fillColor,e=!0){return this.cache.style.normal.fillEnabled=e,this.cache.style.normal.filleColor=t,this.parent&&this.parent.draw(),this}render(t=!0){return this.cache.config.rendered=t,this}}class Zh extends Dh{constructor(t,e,s,i){super(t,e),this.r=s,this.angle=i,this.path=null}draw(t){if(this.cache.config.rendered){t.save(),this.applyNormalStyle(t),t.beginPath(),this.path=new Path2D,this.path.arc(this.px,this.py,this.r,0,this.angle);const{strokeEnabled:e,fillEnabled:s}=this.cache.style.normal;e&&t.stroke(this.path),s&&t.fill(this.path),t.closePath(),t.restore()}return this}radius(t){return this.r=t,this.parent&&this.parent.draw(),this}}const Ph=(t,e,s,i)=>new Zh(t,e,s,i),Lh=(t,e,s)=>new Zh(t,e,s,2*Math.PI);class Uh extends Dh{constructor(t,e){super(),this.pointsMatrix=null,this.path=new Path2D,this.fromXY(t,e)}get points(){return this.pointsMatrix.T.arr}draw(t){if(this.cache.config.rendered){t.save(),this.applyNormalStyle(t),t.beginPath(),this.path.moveTo(this.points[1][0]+this._x,this.points[1][1]+this._y);for(let t=1;t<this.points.length;t++)this.path.lineTo(this.points[t][0]+this._x,this.points[t][1]+this._y);t.stroke(this.path),t.restore()}return this}fromXY(t,e){return this.pointsMatrix=la([t,e]),this}push(t,e){return this.pointsMatrix.hstack(la([t,e])),this.parent&&this.parent.draw(),this}isIn(t,e){let s;return this.parent&&(this.parent.ctx.setTransform(1,0,0,1,0,0),s=this.parent.ctx.isPointInPath(this.path,t,e),this.parent.applyTransformMatrix()),s}}const Rh=(t=[],e=[])=>new Uh(t,e);class zh extends Dh{constructor(t,e,s,i){super(),this.x0=t,this.x1=s,this.y0=e,this.y1=i,delete this.fill}draw(t){return this.cache.config.rendered&&(t.save(),this.applyNormalStyle(t),t.beginPath(),t.moveTo(this.x0+this._x,this.y0+this._y_),t.lineTo(this.x1+this._x,this.y1+this._y),t.stroke(),this.cache.style.normal.strokeEnabled&&t.stroke(),t.restore()),this}}const $h=(t,e,s,i)=>new zh(t,e,s,i);class Nh extends Dh{constructor(t,e,s,i){super(t,e),this.w=s,this.h=i,this.path=new Path2D}draw(t){if(this.cache.config.rendered){t.save(),this.applyNormalStyle(t),t.beginPath(),this.path.rect(this.px,this.py,this.w,this.h);const{strokeEnabled:e,fillEnabled:s}=this.cache.style.normal;e&&t.stroke(this.path),s&&t.fill(this.path),t.closePath(),t.restore()}return this}width(t){return this.w=t,this.parent&&this.parent.draw(),this}height(t){return this.h=t,this.parent&&this.parent.draw(),this}}const Fh=(t,e,s,i)=>new Nh(t,e,s,i);const Vh={...Mh,...Object.freeze({__proto__:null,Canvas:jh,ZikoUICanvas:Oh,canvasArc:Ph,canvasCircle:Lh,canvasLine:$h,canvasPoints:Rh,canvasRect:Fh})};class Bh{constructor(t,e=!0){this.#r(),this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}#r(){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=Bs(),this}}class Hh{constructor({viewport:t,charset:e,description:s,author:i,keywords:r}){this.document=globalThis?.document,this.meta={},this.init({viewport:t,charset:e,description:s,author:i,keywords:r})}init({viewport:t,charset:e,description:s,author:i,keywords:r}){t&&this.setViewport(t),e&&this.setCharset(e),s&&this.describe(s),i&&this.setAuthor(i),r&&this.setKeywords(r)}set(t,e){const s="charset"===(t=t.toLowerCase()),i=s?document.querySelector("meta[charset]"):document.querySelector(`meta[name=${t}]`);return this.meta=i??document?.createElement("meta"),s?this.meta.setAttribute("charset",e):(this.meta.setAttribute("name",t),this.meta.setAttribute("content",e)),i||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 Wh{constructor(t=document.title,e=!0){this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}useEventEmitter(){return this.cache.Emitter=Bs(),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 Xh{constructor({title:t,lang:e,icon:s,meta:i,noscript:r}){this.html=globalThis?.document?.documentElement,this.head=globalThis?.document?.head,t&&((t,e)=>{new Wh(t,e)})(t),e&&this.setLang(e),s&&((t,e)=>{new Bh(t,e)})(s),i&&(({viewport:t,charset:e,description:s,author:i,keywords:r})=>{new Hh({viewport:t,charset:e,description:s,author:i,keywords:r})})(i),r&&this.setNoScript()}setLang(t){this.html.setAttribute("lang",t)}setNoScript(t){}}class qh{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 Xh?t:(({title:t,lang:e,icon:s,meta:i,noscript:r})=>new Xh({title:t,lang:e,icon:s,meta:i,noscript:r}))(t),this}}const Yh=({head:t,wrapper:e,target:s})=>new qh({head:t,wrapper:e,target:s});var Gh=Object.freeze({__proto__:null,App:Yh,ZikoApp:qh});class Kh{constructor(t={}){this.cache={JsonStyle:t,isRenderd:!1},this.target=globalThis?.document?.head,this.element=document.createElement("style"),this.element.setAttribute("data-generator","zikojs"),this.write(),this.render()}get CssText(){return Ko(this.cache.JsonStyle)}render(){return this.target.append(this.element),this.cache.isRenderd=!0,this}unrender(){return this.target?.children?.length&&[...this.target?.children].includes(this.element)&&this.target.removeChild(this.element),this.cache.isRenderd=!1,this}write(){return this.element.textContent=this.CssText,this}style(t,e=!1){return e&&this.clear(),Object.assign(this.cache.JsonStyle,t),this.write(),this}clear(){return this.cache.JsonStyle={},this.write(),this}}const Qh=t=>new Kh(t);var Jh=Object.freeze({__proto__:null,ZikoJsonStyleSheet:Kh,jsonStyleSheet:Qh});function tl(t){return/:\w+/.test(t)}class el extends qh{constructor({head:t,wrapper:e,target:s,routes:i}){super({head:t,wrapper:e,target:s}),this.routes=new Map([["404",ji("Error 404")],...Object.entries(i)]),this.clear(),globalThis.onpopstate=this.render(location.pathname)}clear(){return[...this.routes].forEach((t=>{!tl(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("/"),i=e.split("/");if(s.length!==i.length)return!1;for(let t=0;t<s.length;t++){const e=s[t],r=i[t];if(!e.startsWith(":")&&e!==r)return!1}return!0}(e[0],t)));let i;if(tl(e)){const r=function(t,e){const s=t.split("/"),i=e.split("/"),r={};if(s.length!==i.length)return r;for(let t=0;t<s.length;t++){const e=s[t],n=i[t];if(e.startsWith(":"))r[e.slice(1)]=n;else if(e!==n)return{}}return r}(e,t);i=s.call(this,r)}else s?.isZikoUIElement&&s.render(this.wrapper),"function"==typeof s&&(i=s());return i?.isZikoUIElement&&i.render(this.wrapper),i instanceof Promise&&i.then((t=>t.render(this.wrapper))),globalThis.history.pushState({},"",t),this}}const sl=({head:t,wrapper:e,target:s,routes:i})=>new el({head:t,wrapper:e,target:s,routes:i});function il(t){Object.defineProperties(t,{QueryParams:{get:function(){return function(t){const e={};return t.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi,(t=>{const[s,i]=t.split("=");e[s]=i})),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 rl={},nl={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:()=>document.documentElement.setAttribute("data-engine","zikojs")};function ol(t,e="./src/pages",s=["js","ts"]){"/"===e.at(-1)&&(e=e.slice(0,-1));const i=t.replace(/\\/g,"/").replace(/\[(\w+)\]/g,"$1/:$1").split("/"),r=e.split("/"),n=i.indexOf(r[r.length-1]);if(-1!==n){const t=i.slice(n+1),e=t[t.length-1],r="index.js"===e||"index.ts"===e,o=s.some((t=>e===`.${t}`||e.endsWith(`.${t}`)));if(r)return"/"+(t.length>1?t.slice(0,-1).join("/"):"");if(o)return"/"+t.join("/").replace(/\.(js|ts)$/,"")}return""}const al={...Gh,...Jh,...Object.freeze({__proto__:null,SPA:sl,ZikoSPA:el}),...Object.freeze({__proto__:null,__Config__:nl,__UI__:rl})};[al,ih,Vo,Fs,aa,xi,Vh].forEach((t=>Object.assign(t,{ExtractAll:()=>(t=>{const e=Object.keys(t);for(let s=0;s<e.length;s++){const i=e[s];["__ExtractAll__","__RemoveAll__","ExtractAll","RemoveAll"].includes(i)||(globalThis[i]=t[i])}})(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 hl={App:al,Math:ih,UI:Vo,Time:Fs,Data:aa,Reactivity:xi,Graphics:Vh};globalThis.__Ziko__?console.warn("WARNING: Multiple instances of Ziko.js being imported."):(globalThis.__Ziko__={...hl,__UI__:rl,__Config__:nl,ExtractAll:function(){return Vo.ExtractAll(),ih.ExtractAll(),Fs.ExtractAll(),xi.ExtractAll(),Vh.ExtractAll(),aa.ExtractAll(),this},RemoveAll:function(){Vo.RemoveAll(),ih.RemoveAll(),Fs.RemoveAll(),xi.RemoveAll(),Vh.RemoveAll(),aa.RemoveAll()}},il(__Ziko__)),globalThis?.document&&document?.addEventListener("DOMContentLoaded",__Ziko__.__Config__.init()),t.Accordion=so,t.App=Yh,t.Article=Bn,t.Aside=Yn,t.Base=ct,t.Breadcrumbs=jo,t.Canvas=jh,t.Carousel=co,t.CodeCell=fo,t.CodeNote=po,t.Collapsible=to,t.Combinaison=dt,t.Complex=ga,t.E=s,t.EPSILON=i,t.Ease=js,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 i=[];for(let t=0;t<s;t++){const s=e[0][t];if(!e.every((e=>e[t]===s||e[t].startsWith("["))))break;i.push(s)}return i.join("/")+(i.length?"/":"")}(e),i={};for(let r=0;r<e.length;r++){const n=await t[e[r]](),o=await n.default;Object.assign(i,{[ol(e[r],s)]:o})}return sl({target:document.body,routes:{"/":()=>{},...i},wrapper:Vn()})},t.Flex=bn,t.Footer=Xn,t.Form=_n,t.Grid=Qn,t.HTMLWrapper=jr,t.Header=Wn,t.LinearSystem=da,t.Logic=ut,t.Main=Hn,t.Matrix=ha,t.Modal=Lo,t.Nav=qn,t.PI=e,t.Permutation=pt,t.Random=ft,t.SPA=sl,t.SVGWrapper=Dr,t.Section=Vn,t.Slider=Fo,t.Splitter=Mo,t.Str=sa,t.Svg=nh,t.Table=Zn,t.Tabs=yo,t.Utils=at,t.ZikoApp=qh,t.ZikoCustomEvent=os,t.ZikoEvent=ie,t.ZikoEventClick=oe,t.ZikoEventClipboard=We,t.ZikoEventHash=is,t.ZikoEventInput=ts,t.ZikoEventKey=je,t.ZikoEventMouse=be,t.ZikoEventPointer=ge,t.ZikoEventSwipe=hs,t.ZikoEventWheel=Te,t.ZikoHead=Ks,t.ZikoJsonStyleSheet=Kh,t.ZikoMutationObserver=ps,t.ZikoSPA=el,t.ZikoSvgCircle=ah,t.ZikoSvgEllipse=lh,t.ZikoSvgForeignObject=uh,t.ZikoSvgGroupe=dh,t.ZikoSvgImage=gh,t.ZikoSvgLine=bh,t.ZikoSvgLink=vh,t.ZikoSvgPath=xh,t.ZikoSvgRectangle=Eh,t.ZikoSvgText=Th,t.ZikoUIAbbrText=Oi,t.ZikoUIAccordion=eo,t.ZikoUIArticle=$n,t.ZikoUIAside=Nn,t.ZikoUIAudio=sn,t.ZikoUIBlockQuote=$i,t.ZikoUIBr=Lr,t.ZikoUIBreadcrumbs=Oo,t.ZikoUICanvas=Oh,t.ZikoUICodeNote=uo,t.ZikoUICodeText=Mi,t.ZikoUIContainerElement=_i,t.ZikoUIDefintion=Ti,t.ZikoUIElement=ki,t.ZikoUIFigure=Kr,t.ZikoUIFlex=fn,t.ZikoUIFooter=Fn,t.ZikoUIForm=kn,t.ZikoUIGrid=Kn,t.ZikoUIHTMLWrapper=Mr,t.ZikoUIHeader=Un,t.ZikoUIHeading=Vi,t.ZikoUIHorizontalSlider=Ro,t.ZikoUIHorizontalSplitter=Io,t.ZikoUIHr=Ur,t.ZikoUIHtmlTag=Zr,t.ZikoUIImage=Yr,t.ZikoUIInput=nr,t.ZikoUIInputCheckbox=gr,t.ZikoUIInputColor=ur,t.ZikoUIInputDatalist=cn,t.ZikoUIInputDate=_r,t.ZikoUIInputDateTime=Tr,t.ZikoUIInputEmail=vr,t.ZikoUIInputImage=Xr,t.ZikoUIInputNumber=ar,t.ZikoUIInputOption=ln,t.ZikoUIInputPassword=xr,t.ZikoUIInputRadio=br,t.ZikoUIInputSearch=dr,t.ZikoUIInputSlider=lr,t.ZikoUIInputTime=Er,t.ZikoUILabel=hn,t.ZikoUILink=Rr,t.ZikoUIMain=Ln,t.ZikoUIMenu3d=Do,t.ZikoUIModal=Po,t.ZikoUINav=Rn,t.ZikoUIParagraphe=zi,t.ZikoUIQuote=Ii,t.ZikoUISVGWrapper=Or,t.ZikoUISection=zn,t.ZikoUISelect=pn,t.ZikoUISubText=Si,t.ZikoUISupText=Ai,t.ZikoUISvg=rh,t.ZikoUIText=Ei,t.ZikoUITextArea=mn,t.ZikoUIVerticalSlider=$o,t.ZikoUIVerticalSplitter=Ao,t.ZikoUIVideo=tn,t.ZikoUIXMLWrapper=Sr,t.ZikoUseRoot=yi,t.ZikoUseStyle=mi,t.__Config__=nl,t.__UI__=rl,t.abbrText=Ri,t.abs=Ea,t.accum=et,t.acos=Ra,t.acosh=Wa,t.acot=Na,t.add=j,t.adoc2html=Lt,t.arange=H,t.arr2str=Go,t.asin=za,t.asinh=Xa,t.atan=$a,t.atan2=Qa,t.atanh=qa,t.audio=rn,t.bessel=xa,t.beta=_a,t.blockQuote=Fi,t.br=zr,t.brs=Nr,t.btn=Hr,t.canvasArc=Ph,t.canvasCircle=Lh,t.canvasLine=$h,t.canvasPoints=Rh,t.canvasRect=Fh,t.cartesianProduct=rt,t.ceil=Ya,t.checkbox=fr,t.choleskyDecomposition=kt,t.clamp=B,t.codeText=Ui,t.combinaison=mt,t.complex=fa,t.cos=Oa,t.cosh=Fa,t.cot=Ua,t.coth=Ha,t.count=ra,t.countWords=na,t.csc=La,t.csv2arr=Ut,t.csv2json=$t,t.csv2matrix=Rt,t.csv2object=zt,t.csv2sql=Nt,t.dangerAlert=Co,t.datalist=un,t.default=hl,t.defineParamsGetter=il,t.deg2rad=Y,t.dfnText=Zi,t.div=P,t.e=Sa,t.fact=Ja,t.figure=Qr,t.floor=Ga,t.gamma=va,t.geomspace=q,t.h1=Bi,t.h2=Hi,t.h3=Wi,t.h4=Xi,t.h5=qi,t.h6=Yi,t.hSlider=zo,t.hSplitter=To,t.hr=$r,t.hrs=Fr,t.html=Br,t.hypot=sh,t.image=Gr,t.inRange=st,t.infoAlert=ko,t.input=or,t.inputCamera=an,t.inputColor=pr,t.inputDate=Cr,t.inputDateTime=Ar,t.inputEmail=wr,t.inputImage=qr,t.inputNumber=hr,t.inputPassword=kr,t.inputTime=Ir,t.isApproximatlyEqual=it,t.json2arr=Bt,t.json2css=Ko,t.json2csv=Ht,t.json2csvFile=Wt,t.json2xml=Kt,t.json2xmlFile=Qt,t.json2yml=Yt,t.json2ymlFile=Gt,t.jsonStyleSheet=Qh,t.lerp=F,t.li=er,t.link=Vr,t.linspace=W,t.ln=Ma,t.logspace=X,t.luDecomposition=bt,t.map=V,t.mapfun=I,t.markdown2html=St,t.matrix=la,t.matrix2=ca,t.matrix3=ua,t.matrix4=pa,t.max=tt,t.menu3d=Zo,t.min=J,t.modulo=L,t.mul=Z,t.norm=N,t.nums=$,t.obj2str=qo,t.ol=sr,t.ones=R,t.p=Ni,t.pgcd=nt,t.pow=Ta,t.powerSet=lt,t.ppcm=ot,t.preload=_t,t.prod=Q,t.qrDecomposition=xt,t.quote=Di,t.rad2deg=G,t.radio=yr,t.removeExtraSpace=ia,t.round=Ka,t.search=mr,t.sec=Za,t.select=dn,t.sig=eh,t.sign=th,t.sin=ja,t.sinc=Pa,t.sinh=Va,t.slider=cr,t.sqrt=Ia,t.sqrtn=Aa,t.str=oa,t.sub=D,t.subSet=null,t.subText=Li,t.successAlert=xo,t.sum=K,t.supText=Pi,t.svg2ascii=Ho,t.svg2img=Xo,t.svg2imgUrl=Wo,t.svg2str=Bo,t.svgCircle=hh,t.svgEllipse=ch,t.svgGrid=Sh,t.svgGroupe=mh,t.svgImage=fh,t.svgLine=yh,t.svgLink=wh,t.svgObject=ph,t.svgPath=kh,t.svgPolygon=Ch,t.svgRect=Ih,t.svgText=Ah,t.tan=Da,t.tanh=Ba,t.text=ji,t.textarea=gn,t.timeTaken=zs,t.time_memory_Taken=Ps,t.ul=ir,t.useAnimation=(t,e=js.Linear,s=50,i)=>new Ns(t,js.Linear,50,i),t.useBattery=oi,t.useChannel=ti,t.useClickEvent=ae,t.useClipboardEvent=Xe,t.useCustomEvent=as,t.useDebounce=Ds,t.useDragEvent=$e,t.useDropEvent=Ne,t.useEventEmitter=si,t.useFavIcon=Ws,t.useFocusEvent=Ke,t.useFps=Ss,t.useGeolocation=hi,t.useHashEvent=rs,t.useHead=Qs,t.useInputEvent=es,t.useKeyEvent=De,t.useLocaleStorage=pi,t.useMediaQuery=bi,t.useMeta=qs,t.useMouseEvent=Ee,t.usePointerEvent=fe,t.useRoot=wi,t.useRootValue=vi,t.useSessionStorage=di,t.useStyle=gi,t.useSuccesifKeys=Es,t.useSwipeEvent=cs,t.useThread=ri,t.useThrottle=Zs,t.useTimeLoop=Ms,t.useTitle=Gs,t.useType=Is,t.useWheelEvent=Ae,t.vSlider=No,t.vSplitter=So,t.video=en,t.wait=Rs,t.waitForUIElm=Ls,t.waitForUIElmSync=Us,t.warningAlert=_o,t.watch=ds,t.watchAttr=gs,t.watchChildren=bs,t.watchIntersection=vs,t.watchScreen=_s,t.watchSize=xs,t.zeros=U,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";const{PI:e,E:s}=Math,i=Number.EPSILON;var r=Object.freeze({__proto__:null,E:s,EPSILON:i,PI:e});const{PI:n,cos:o,sin:a,tan:h,acos:l,asin:u,atan:p,cosh:m,sinh:g,tanh:f,acosh:b,asinh:y,atanh:w,log:v}=Math;let x={cos:o,sin:a,tan:h,sinc:t=>a(n*t)/(n*t),sec:t=>1/o(t),csc:t=>1/a(t),cot:t=>1/h(t),acos:l,asin:u,atan:p,acot:t=>n/2-p(t),cosh:m,sinh:g,tanh:f,coth:t=>.5*v((1+t)/(1-t)),acosh:b,asinh:y,atanh:w};x=new Proxy(x,{get(t,e){if(e in t)return s=>+t[e](s).toFixed(15)}});class k{}const _=(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=>_(t,e)));if(ArrayBuffer.isView(e))return e.map((e=>t(e)));if(e instanceof Set)return new Set(_(t,...e));if(e instanceof Map)return new Map([...e].map((e=>[e[0],_(t,e[1])])));if(e instanceof ha)return new ha(e.rows,e.cols,_(e.arr.flat(1)));if(e instanceof ga){const[s,i,r,n]=[e.a,e.b,e.z,e.phi];switch(t){case Math.log:return fa(Oa(r),n);case Math.exp:return fa(Sa(s)*Ma(i),Sa(s)*ja(i));case Math.abs:return r;case Math.sqrt:return fa(Ia(r)*Ma(n/2),Ia(r)*ja(n/2));case x.cos:return fa(Ma(s)*Va(i),-ja(s)*Ba(i));case x.sin:return fa(ja(s)*Va(i),Ma(s)*Ba(i));case x.tan:{const t=Ma(2*s)+Va(2*i);return fa(ja(2*s)/t,Ba(2*i)/t)}case x.cosh:return fa(Va(s)*Ma(i),Ba(s)*ja(i));case x.sinh:return fa(Ba(s)*Ma(i),Va(s)*ja(i));case x.tanh:{const t=Va(2*s)+Ma(2*i);return fa(Ba(2*s)/t,ja(2*i)/t)}default:return t(e)}}else if(e instanceof Object)return t(Object)||Object.fromEntries(Object.entries(e).map((e=>[e[0],_(t,e[1])])))}));return 1==s.length?s[0]:s},C=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t+e;if(e instanceof ga)return fa(t+e.a,e.b);if(e instanceof ha)return ha.nums(e.rows,e.cols,t).add(e);if(e instanceof Array)return e.map((e=>S(e,t)))}else{if(t instanceof ga||t instanceof ha)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=>S(t,e)));if(t.length===e.length)return t.map(((t,s)=>S(t,e[s])))}}},E=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t-e;if(e instanceof ga)return fa(t-e.a,-e.b);if(e instanceof ha)return ha.nums(e.rows,e.cols,t).sub(e);if(e instanceof Array)return e.map((e=>O(e,t)))}else{if(t instanceof ga||t instanceof ha)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=>O(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>O(t,e[s])))}}},I=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t*e;if(e instanceof ga)return fa(t*e.a,t*e.b);if(e instanceof ha)return ha.nums(e.rows,e.cols,t).mul(e);if(e instanceof Array)return e.map((e=>M(t,e)))}else{if(t instanceof ga||t instanceof ha)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=>M(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>M(t,e[s])))}}},T=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t/e;if(e instanceof ga)return fa(t/e.a,t/e.b);if(e instanceof ha)return ha.nums(e.rows,e.cols,t).div(e);if(e instanceof Array)return e.map((e=>j(t,e)))}else{if(t instanceof ga||t instanceof ha)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=>j(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>j(t,e[s])))}}},A=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t%e;if(e instanceof ga)return fa(t%e.a,t%e.b);if(e instanceof ha)return ha.nums(e.rows,e.cols,t).modulo(e);if(e instanceof Array)return e.map((e=>j(t,e)))}else{if(t instanceof ga||t instanceof ha)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=>S(t,e)))}},S=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=C(s,e[t]);return s},O=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=E(s,e[t]);return s},M=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=I(s,e[t]);return s},j=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=T(s,e[t]);return s},D=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=A(s,e[t]);return s},Z=t=>new Array(t).fill(0),L=t=>new Array(t).fill(1),P=(t,e)=>new Array(e).fill(t),U=(t,e,s)=>{if("number"==typeof t)return e!==s?(t-e)/(s-e):0;if(t instanceof ha)return new ha(t.rows,t.cols,U(t.arr.flat(1),e,s));if(t instanceof ga)return new ga(U(t.a,e,s),U(t.b,e,s));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>U(t,e,s)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=U(t[s])}}},R=(t,e,s)=>{if("number"==typeof t)return(s-e)*t+e;if(t instanceof ha)return new ha(t.rows,t.cols,R(t.arr.flat(1),e,s));if(t instanceof ga)return new ga(R(t.a,e,s),R(t.b,e,s));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>R(t,e,s)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=R(t[s])}}},$=(t,e,s,i,r)=>{if("number"==typeof t)return R(U(t,e,s),i,r);if(t instanceof ha)return new ha(t.rows,t.cols,$(t.arr.flat(1),e,s,i,r));if(t instanceof ga)return new ga($(t.a,s,i,r),$(t.b,e,s,i,r));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>$(t,e,s,i,r)));{let n=new Array(t.length);for(let o=0;o<t.length;o++)n[o]=$(t[o],e,s,i,r)}}},N=(t,e,s)=>{const[i,r]=[G(e,s),K(e,s)];if("number"==typeof t)return G(K(t,i),r);if(t instanceof ha)return new ha(t.rows,t.cols,N(t.arr.flat(1),i,r));if(t instanceof ga)return new ga(N(t.a,i,r),N(t.b,i,r));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>N(t,i,r)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=N(t[s],i,r)}}},V=(t,e,s,i=!1)=>{let r=[];if(t<e)for(let n=t;i?n<=e:n<e;n+=s)r.push(10*n/10);else for(let n=t;i?n>=e:n>e;n-=s)r.push(10*n/10);return r},B=(t,e,s=Ea(e-t)+1,i=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[o,a]=[t,e].sort(((t,e)=>e-t));var r=[];let h;h=i?(o-a)/(s-1):(o-a)/s;for(var n=0;n<s;n++)t<e?r.push(a+h*n):r.push(o-h*n);return r}if([t,e].some((t=>t instanceof ga))){const r=fa(t),n=fa(e);s=s||Math.abs(r.a-n.a)+1;const o=B(r.a,n.a,s,i),a=B(r.b,n.b,s,i);let h=new Array(s).fill(null);return h=h.map(((t,e)=>fa(o[e],a[e]))),h}}},F=(t,e,i=e-t+1,r=s,n=!0)=>B(t,e,i,n).map((t=>Ta(r,t))),H=(t,e,s=Ea(e-t)+1,i=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[r,n]=[t,e].sort(((t,e)=>e-t));let o;o=Aa(r/n,i?s-1:s);const a=[n];for(let t=1;t<s;t++)a.push(a[t-1]*o);return t<e?a:a.reverse()}if([t,e].some((t=>t instanceof ga))){const r=fa(t),n=fa(e);let o;s=s||Math.abs(r.a-n.a)+1,o=Aa(n.div(r),i?s-1:s);const a=[r];for(let t=1;t<s;t++)a.push(M(a[t-1],o));return a}}},W=(...t)=>mapfun((t=>t*Math.PI/180),...t),X=(...t)=>mapfun((t=>t/Math.PI*180),...t),q=(...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(q(...t[s])):t[s]instanceof Object&&e.push(q(...Object.values(t[s])));return 1===e.length?e[0]:e},Y=(...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(Y(...t[s])):t[s]instanceof Object&&e.push(Y(...Object.values(t[s])));return 1===e.length?e[0]:e},G=(...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(G(...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},K=(...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(G(...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},Q=(...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(Q(...t[s])):t[s]instanceof Object&&e.push(null);return 1===e.length?e[0]:e},J=(t,e,s)=>{const[i,r]=[Math.min(e,s),Math.max(e,s)];return t>=i&&t<=r},tt=(t,e,s=1e-4)=>Math.abs(t-e)<=s,et=(t,e)=>t.reduce(((t,s)=>[...t,...e.map((t=>[s,t]))]),[]),st=(t,e)=>{let s,i=1;if(t==Ga(t)&&e==Ga(e)){for(s=2;s<=t&&s<=e;++s)t%s==0&&e%s==0&&(i=s);return i}console.log("error")},it=(t,e)=>{let s;if(t==Ga(t)&&e==Ga(e)){for(s=t>e?t:e;s%t!=0||s%e!=0;)++s;return s}console.log("error")},rt={add:S,sub:O,mul:M,div:j,modulo:D,zeros:Z,ones:L,nums:P,norm:U,lerp:R,map:$,clamp:N,arange:V,linspace:B,logspace:F,geomspace:H,sum:q,prod:Y,accum:Q,cartesianProduct:et,ppcm:it,pgcd:st,deg2rad:W,rad2deg:X,inRange:J,isApproximatlyEqual:tt};var nt=Object.freeze({__proto__:null,Utils:rt,add:S,arange:V,cartesianProduct:et,clamp:N,deg2rad:W,div:j,geomspace:H,inRange:J,isApproximatlyEqual:tt,lerp:R,linspace:B,logspace:F,map:$,mapfun:_,modulo:D,mul:M,norm:U,nums:P,ones:L,pgcd:st,ppcm:it,prod:Y,rad2deg:X,sub:O,sum:q,zeros:Z});const ot=t=>{const e=[],s=2**t.length;for(let i=0;i<s;i+=1){const s=[];for(let e=0;e<t.length;e+=1)i&1<<e&&s.push(t[e]);e.push(s)}return e},at={_mode:Number,_map:function(t,e,s){return e instanceof ha?new ha(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof ga?new ga(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],i=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))*i},IEEE64toDec(t){let e=t.split(" ").join("").padEnd(64,"0"),s=e[0],i=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))*i}},ht={_mode:Number,_map:function(t,e,s){return e instanceof ha?new ha(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof ga?new ga(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)?ht._mode(!t):this._map(this.not,t)},and:function(t,...e){return["number","boolean"].includes(typeof t)?ht._mode(e.reduce(((t,e)=>t&e),t)):this._map(this.and,t,e)},or:function(t,...e){return["number","boolean"].includes(typeof t)?ht._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 ht.not(ht.xor(t,e))}};class lt{static withDiscount(t,e=t.length){if(1===e)return t.map((t=>[t]));const s=[];let i;return i=this.withDiscount(t,e-1),t.forEach((t=>{i.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)),i=t[0];for(let t=0;t<s.length;t++){const r=s[t];for(let t=0;t<=r.length;t++){const s=r.slice(0,t),n=r.slice(t);e.push(s.concat([i],n))}}return e}}class ct{static withDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((i,r)=>{this.withDiscount(t.slice(r),e-1).forEach((t=>{s.push([i].concat(t))}))})),s}static withoutDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((i,r)=>{this.withoutDiscount(t.slice(r+1),e-1).forEach((t=>{s.push([i].concat(t))}))})),s}}const ut=(t,e,s=!1)=>ct[s?"withDiscount":"withoutDiscount"](t,e);var pt=Object.freeze({__proto__:null,Base:at,Combinaison:ct,Logic:ht,Permutation:lt,combinaison:ut,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=rt.accum(...e).map((t=>100*t)),s.fill(t[0],0,e[0]);for(let i=1;i<t.length;i++)s.fill(t[i],e[i-1],e[i]);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:i}=t;return la(e,s,i.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"#"+at.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 ga(this.float(t[0],t[1]),this.float(e[0],e[1])):new ga(...this.floats(2,t,e))}static complexInt(t=[0,1],e=[0,1]){return new ga(this.int(t[0],t[1]),this.int(e[0],e[1]))}static complexBin(){return new ga(...this.bins(2))}static complexOct(){return new ga(...this.octs(2))}static complexDec(){return new ga(...this.decs(10))}static complexHex(){return new ga(...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,i){return la(t,e,this.floats(t*e,s,i))}static matrixInt(t,e,s,i){return la(t,e,this.ints(t*e,s,i))}static matrixBin(t,e){return la(t,e,this.bins(t*e))}static matrixOct(t,e){return la(t,e,this.octs(t*e))}static matrixDec(t,e){return la(t,e,this.decs(t*e))}static matrixHex(t,e){return la(t,e,this.hex(t*e))}static matrixColor(t,e){return la(t,e,this.colors(t*e))}static matrixComplex(t,e,s,i){return la(t,e,this.complexes(t*e,s,i))}static matrixComplexInt(t,e,s,i){return la(t,e,this.complexesInt(t*e,s,i))}static matrixComplexBin(t,e){return la(t,e,this.complexesBin(t*e))}static matrixComplexOct(t,e){return la(t,e,this.complexesBin(t*e))}static matrixComplexDec(t,e){return la(t,e,this.complexesBin(t*e))}static matrixComplexHex(t,e){return la(t,e,this.complexesBin(t*e))}}const mt=t=>{t instanceof ha&&(t=t.arr);const e=t.length,s=new Array(e).fill(0).map((()=>new Array(e).fill(0))),i=new Array(e).fill(0).map((()=>new Array(e).fill(0)));for(let r=0;r<e;r++){for(let n=r;n<e;n++){let e=0;for(let t=0;t<r;t++)e+=s[r][t]*i[t][n];i[r][n]=t[r][n]-e}for(let n=r;n<e;n++)if(r==n)s[r][r]=1;else{let e=0;for(let t=0;t<r;t++)e+=s[n][t]*i[t][r];s[n][r]=(t[n][r]-e)/i[r][r]}}return[s,i].map((t=>new ha(t)))},gt=(t,e)=>t.reduce(((t,s,i)=>t+s*e[i]),0),ft=t=>Math.sqrt(t.reduce(((t,e)=>t+e*e),0)),bt=t=>t.map((e=>e/ft(t))),yt=t=>{t instanceof ha&&(t=t.arr);const e=t.length,s=t[0].length,i=[],r=[];for(let t=0;t<e;t++)r.push(new Array(s).fill(0));for(let n=0;n<s;n++){let s=t.map((t=>t[n]));for(let o=0;o<n;o++){const a=i[o],h=gt(a,t.map((t=>t[n])));for(let t=0;t<e;t++)s[t]-=h*a[t];r[o][n]=h}const o=ft(s);i.push(bt(s)),r[n][n]=o}return[i,r].map((t=>new ha(t)))},wt=t=>{t instanceof ha&&(t=t.arr);const e=t.length,s=new Array(e).fill(0).map((()=>new Array(e).fill(0)));for(let i=0;i<e;i++)for(let e=0;e<=i;e++){let r=0;for(let t=0;t<e;t++)r+=s[i][t]*s[e][t];s[i][e]=i===e?Math.sqrt(t[i][i]-r):1/s[e][e]*(t[i][e]-r)}return new ha(s)},vt=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=vt(t);return(new DOMParser).parseFromString(e,"text/xml").documentElement};var xt=Object.freeze({__proto__:null,preload:vt});const kt=t=>t.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/\[(.*?)\]\((.*?)\)/g,'<a href="$2">$1</a>').replace(/!\[(.*?)\]\((.*?)\)/g,'<img src="$2" alt="$1">').replace(/`([^`]+)`/g,"<code>$1</code>"),_t=t=>`<tr>${t.split("|").map((t=>t.trim())).filter((t=>""!==t)).map((t=>`<td>${kt(t)}</td>`)).join("")}</tr>\n`,Ct=(t,e)=>{const s=t.join("\n");return`${e?`<pre><code data-language="${e}">${s}</code></pre>`:`<pre><code>${s}</code></pre>`}\n`},Et=t=>{const e=t.match(/^\d+\.\s/);if(e){let s=+e[1];return`<ol${1===s?"":` start="${s}"`}>${kt(t.slice(e[0].length))}</ol>\n`}return`<ul>${kt(t)}</ul>\n`},It=t=>{const e=t.split("\n");let s="",i=!1,r=!1,n=[],o="";for(let t=0;t<e.length;t++){let a=e[t];if(a.startsWith("|"))i||(i=!0,s+="<table>\n"),s+=_t(a);else if(i&&(i=!1,s+="</table>\n"),a.startsWith("```"))r?(r=!1,s+=Ct(n,o)):(r=!0,n=[],o=a.slice(3).trim());else if(r)n.push(a);else if(a.startsWith("# ")){const t=a.indexOf(" "),e=a.slice(t+1);s+=`<h${t}>${kt(e)}</h${t}>\n`}else a.startsWith("- ")||a.startsWith("* ")||a.match(/^\d+\.\s/)?s+=Et(a):"---"!==a.trim()?s+=`<p>${kt(a)}</p>\n`:s+="<hr>\n"}return s},Tt=t=>t.replace(/\*(.*?)\*/g,"_$1_").replace(/\*\*(.*?)\*\*/g,"*$1*").replace(/\[(.*?)\]\((.*?)\)/g,"link:$2[$1]").replace(/!\[(.*?)\]\((.*?)\)/g,"image::$2[$1]").replace(/`([^`]+)`/g,"``$1``").replace(/^\*\s/,""),At=t=>`<tr>${t.split("|").map((t=>t.trim())).filter((t=>""!==t)).map((t=>`<td>${Tt(t)}</td>`)).join("")}</tr>\n`,St=(t,e)=>{const s=t.join("\n");return`${e?`<pre><code data-language="${e}">${s}</code></pre>`:`<pre><code>${s}</code></pre>`}\n`},Ot=t=>{const e=/^(\d+)\.\s/,s=/^[.]\s/,i=/^[*]\s/;if(t.match(e)){return`<ol start="${t.match(e)[1]}"><li>${Tt(t.replace(e,""))}</li></ol>\n`}return t.match(s)?`<ol><li>${Tt(t.replace(s,""))}</li></ol>\n`:t.match(i)?`<ul><li>${Tt(t.replace(i,""))}</li></ul>\n`:`<p>${Tt(t)}</p>\n`},Mt=t=>`<blockquote>${Tt(t.slice(2))}</blockquote>\n`,jt=t=>{const e=t.match(/\[(.*?)\]/);return e?e[1].split(",").map((t=>`[${t.trim()}]`)).join(""):""},Dt=t=>{const e=t.split("\n");let s="",i=!1,r=!1,n=[],o="";for(let t=0;t<e.length;t++){let a=e[t];if(a.startsWith("|"))i||(i=!0,s+="<table>\n"),s+=At(a);else if(i&&(i=!1,s+="</table>\n"),a.startsWith("```"))r?(r=!1,s+=St(n,o)):(r=!0,n=[],o=a.slice(3).trim());else if(r)n.push(a);else if(a.startsWith("=")){const t=(a.match(/=/g)||[]).length,e=a.replace(/=/g,"").trim();s+=`<h${t}>${Tt(e)}</h${t}>\n`}else a.match(/^(\d+)\.\s/)||a.match(/^[*\.]\s/)?s+=Ot(a):a.startsWith("> ")?s+=Mt(a):"---"!==a.trim()?a.startsWith("[")?s+=jt(a):""!==a.trim()&&(s+=`<p>${Tt(a)}</p>\n`):s+="<hr>\n"}return s},Zt=(t,e=",")=>t.trim().trimEnd().split("\n").map((t=>t.split(e))),Lt=(t,e=",")=>new ha(Zt(t,e)),Pt=(t,e=",")=>{const[s,...i]=Zt(t,e);return i.map((t=>{const e={};return s.forEach(((s,i)=>{e[s]=t[i]})),e}))},Ut=(t,e=",")=>JSON.stringify(Pt(t,e)),Rt=(t,e)=>{const s=t.trim().trimEnd().split("\n").filter((t=>t));let i=`INSERT INTO ${e} (${s[0].split(",").join(", ")}) Values `,r=[];for(let t=1;t<s.length;t++){const e=s[t].split(",");r.push(`(${e})`)}return i+r.join(",\n")},zt=t=>t instanceof Array?[Object.keys(t[0]),...t.map((t=>Object.values(t)))]:[Object.keys(t)],$t=(t,e)=>zt(t).map((t=>t.join(e))).join("\n"),Nt=t=>zt(t instanceof Object?t:JSON.parse(t)),Vt=(t,e=",")=>$t(t instanceof Object?t:JSON.parse(t),e),Bt=(t,e)=>{const s=Vt(t,e),i=new Blob([s],{type:"text/csv;charset=utf-8;"});return{str:s,blob:i,url:URL.createObjectURL(i)}},Ft=(t,e)=>{const s=[];if(Array.isArray(t))t.forEach((t=>{if("object"==typeof t&&null!==t){s.push(`${e}-`);const i=Ft(t,`${e} `);s.push(...i)}else s.push(`${e}- ${t}`)}));else for(const i in t)if(t.hasOwnProperty(i)){const r=t[i];if("object"==typeof r&&null!==r){s.push(`${e}${i}:`);const t=Ft(r,`${e} `);s.push(...t)}else s.push(`${e}${i}: ${r}`)}return s},Ht=(t,e="")=>Ft(t,e).join("\n"),Wt=(t,e)=>Ht(t instanceof Object?t:JSON.parse(t),e),Xt=(t,e)=>{const s=Wt(t,e),i=new Blob([s],{type:"text/yml;charset=utf-8;"});return{str:s,blob:i,url:URL.createObjectURL(i)}},qt=(t,e=1)=>{let s="";for(const i in t)if(t.hasOwnProperty(i)){const r=t[i];s+="\n"+" ".repeat(e)+`<${i}>`,s+="object"==typeof r?qt(r,e+2):`${r}`,s+=`</${i}>`}return s.trim()},Yt=(t,e)=>{const s=qt(t,e),i=new Blob([s],{type:"text/xml;charset=utf-8;"});return{str:s,blob:i,url:URL.createObjectURL(i)}};let Gt=class{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}#t(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}#e(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}#s(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.#t(t):"string"==typeof t?this.#e(t):t&&"object"==typeof t?this.#s(t):this}};const Kt=(t,e="px")=>("number"==typeof t&&(t+=e),t instanceof Array&&(t=t.map((t=>"number"==typeof t?t+=e:t)).join(" ")),t);class Qt{constructor(t={}){this.target=null,this.styles=new Map([["default",t]]),this.cache={isHidden:!1,isFaddedOut:!1,transformation:{Flip:[0,0,0],matrix:new ha([[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))sa.isCamelCase(e)&&(delete t[e],Object.assign(t,{[sa.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=Kt(e,"px"),s=Kt(s,"px"),this.style({minWidth:e,maxWidth:s},{target:target,maskVector:maskVector})}}else t=Kt(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=Kt(e,"px"),s=Kt(s,"px"),this.style({minHeight:e,maxHeight:s},{target:target,maskVector:maskVector})}}else t=Kt(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 i=()=>this.hide({target:e,maskVector:s});setTimeout(i,t),clearTimeout(i)}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 i=()=>this.show({target:e,maskVector:s});setTimeout(i,t),clearTimeout(i)}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=Kt(t,"px"),this.style({borderRadius:t},{target:target,maskVector:maskVector}),this}margin(t){return t=Kt(t,"px"),this.style({margin:t},{target:target,maskVector:maskVector}),this}marginTop(t){return t=Kt(t,"px"),this.style({marginTop:t}),this}marginRight(t){return t=Kt(t,"px"),this.style({marginRight:t}),this}marginBootom(t){return t=Kt(t,"px"),this.style({marginBootom:t}),this}marginLeft(t){return t=Kt(t,"px"),this.style({marginLeft:t}),this}padding(t){return t=Kt(t,"px"),this.style({padding:t}),this}paddingTop(t){return t=Kt(t,"px"),this.style({paddingTop:t}),this}paddingRight(t){return t=Kt(t,"px"),this.style({paddingRight:t}),this}paddingBootom(t){return t=Kt(t,"px"),this.style({paddingBootom:t}),this}paddingLeft(t){return t=Kt(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,i=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(i),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,Ma(t)),this.cache.transformation.matrix.set(1,2,-ja(t)),this.cache.transformation.matrix.set(2,1,ja(t)),this.cache.transformation.matrix.set(1,2,Ma(t)),this.#i(e),this}rotateY(t,e=0){return this.cache.transformation.matrix.set(0,0,Ma(t)),this.cache.transformation.matrix.set(0,2,ja(t)),this.cache.transformation.matrix.set(2,0,-ja(t)),this.cache.transformation.matrix.set(2,2,Ma(t)),this.#i(e),this}rotateZ(t,e=0){return this.cache.transformation.matrix.set(0,0,Ma(t)),this.cache.transformation.matrix.set(0,1,-ja(t)),this.cache.transformation.matrix.set(1,0,ja(t)),this.cache.transformation.matrix.set(1,1,Ma(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 i=()=>{this.style({opacity:"none"})};return this.target?.element?.addEventListener("transitionend",i),this.target?.element?.removeEventListener("transitionend",i),this}}function Jt(t,e,s,i){return this.event=t,this.cache.preventDefault[e]&&t.preventDefault(),s&&s(),this.cache.stream.enabled[e]&&i&&this.cache.stream.history[e].push(i),this.cache.callbacks[e].map((t=>t(this))),this}class te{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 i="drag"===t?t:`${this.cache.prefixe}${t}`;return this.dispose(s),this.targetElement?.addEventListener(i,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 ee(t){Jt.call(this,t,"click",null,null)}function se(t){Jt.call(this,t,"dbclick",null,null)}class ie extends te{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{click:!1,dbclick:!1},paused:{click:!1,dbclick:!1},stream:{enabled:{click:!1,dbclick:!1},clear:{click:!1,dbclick:!1},history:{click:[],dbclick:[]}},callbacks:{click:[],dbclick:[]}},this.__controller={click:ee.bind(this),dbclick:se.bind(this)}}onClick(...t){return this.__onEvent("click",{},...t),this}onDbClick(...t){return this.__onEvent("dbclick",{},...t),this}}const re=t=>new ie(t);function ne(t){Jt.call(this,t,"down",(()=>{this.dx=parseInt(t.offsetX),this.dy=parseInt(t.offsetY),this.isDown=!0}),{x:this.dx,y:this.dy,t:Date.now()-this.cache.stream.t0})}function oe(t){Jt.call(this,t,"move",(()=>{this.mx=parseInt(t.offsetX),this.my=parseInt(t.offsetY),this.isMoving=!0}),{x:this.mx,y:this.my,t:Date.now()-this.cache.stream.t0})}function ae(t){Jt.call(this,t,"up",(()=>{this.ux=parseInt(t.offsetX),this.uy=parseInt(t.offsetY),this.isDown=!1;const e=this.dx,s=this.dy,i=this.ux,r=this.uy,n=(i-e)/this.target.Width,o=(s-r)/this.target.Height,a=n<0?"left":n>0?"right":"none",h=o<0?"bottom":o>0?"top":"none";this.swippe={h:a,v:h,delta_x:n,delta_y:o}}),{x:this.ux,y:this.uy,t:Date.now()-this.cache.stream.t0})}function he(t){Jt.call(this,t,"enter",null,null)}function le(t){Jt.call(this,t,"leave",null,null)}function ce(t){Jt.call(this,t,"out",null,null)}function ue(t){Jt.call(this,t,"cancel",null,null)}class pe extends te{constructor(t){super(t),this.event=null,this.dx=0,this.dy=0,this.dt=0,this.mx=0,this.my=0,this.mt=0,this.ux=0,this.uy=0,this.ut=0,this.swippe={h:null,v:null,delta_x:0,delta_y:0},this.isMoving=!1,this.isDown=!1,this.cache={prefixe:"pointer",preventDefault:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,cancel:!1},paused:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,cancel:!1},stream:{enabled:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,cancel:!1},clear:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,cancel:!1},history:{down:[],move:[],up:[],enter:[],out:[],leave:[]}},callbacks:{down:[t=>console.log({dx:t.dx,dy:t.dy,down:t.down,move:t.move,t:t.dt})],move:[t=>console.log({mx:t.mx,my:t.my,down:t.down,move:t.move,t:t.dt})],up:[t=>console.log({ux:t.ux,uy:t.uy,down:t.down,move:t.move,t:t.dt})],enter:[t=>console.log({dx:t.dx,dy:t.dy,down:t.down,move:t.move,t:t.dt})],out:[t=>console.log({mx:t.mx,my:t.my,down:t.down,move:t.move,t:t.dt})],leave:[t=>console.log({ux:t.ux,uy:t.uy,down:t.down,move:t.move,t:t.dt})],cancel:[t=>console.log({ux:t.ux,uy:t.uy,down:t.down,move:t.move,t:t.dt})]}},this.__controller={down:ne.bind(this),move:oe.bind(this),up:ae.bind(this),enter:he.bind(this),out:ce.bind(this),leave:le.bind(this),cancel:ue.bind(this)}}onDown(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("down",{down:!0,move:!1,up:!1,enter:!1,out:!1,leave:!1,cancel:!1},...t),this}onMove(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("move",{down:!1,move:!0,up:!1,enter:!1,out:!1,leave:!1,cancel:!1},...t),this}onUp(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("up",{down:!1,move:!1,up:!0,enter:!1,out:!1,leave:!1,cancel:!1},...t),this}onEnter(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("enter",{down:!1,move:!1,up:!1,enter:!0,out:!1,leave:!1,cancel:!1},...t),this}onOut(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("out",{down:!1,move:!1,up:!1,enter:!1,out:!0,leave:!1,cancel:!1},...t),this}onLeave(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("leave",{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!0,cancel:!1},...t),this}onCancel(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("cancel",{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,cancel:!0},...t),this}}var de=t=>new pe(t);class me extends te{constructor(t){super(t),this.event=null,this.dx=0,this.dy=0,this.dt=0,this.mx=0,this.my=0,this.mt=0,this.ux=0,this.uy=0,this.ut=0,this.swippe={h:null,v:null,delta_x:0,delta_y:0},this.isMoving=!1,this.isDown=!1,this.cache={prefixe:"mouse",preventDefault:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,over:!1},paused:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,over:!1},stream:{enabled:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,over:!1},clear:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,over:!1},history:{down:[],move:[],up:[],enter:[],out:[],leave:[],over:[]}},callbacks:{down:[t=>console.log({dx:t.dx,dy:t.dy,down:t.down,move:t.move,t:t.dt})],move:[t=>console.log({mx:t.mx,my:t.my,down:t.down,move:t.move,t:t.dt})],up:[t=>console.log({ux:t.ux,uy:t.uy,down:t.down,move:t.move,t:t.dt})],enter:[t=>console.log({dx:t.dx,dy:t.dy,down:t.down,move:t.move,t:t.dt})],out:[t=>console.log({mx:t.mx,my:t.my,down:t.down,move:t.move,t:t.dt})],leave:[t=>console.log({ux:t.ux,uy:t.uy,down:t.down,move:t.move,t:t.dt})],over:[t=>console.log({ux:t.ux,uy:t.uy,down:t.down,move:t.move,t:t.dt})]}},this.__controller={down:ge.bind(this),move:fe.bind(this),up:be.bind(this),enter:ye.bind(this),out:ve.bind(this),leave:we.bind(this),over:xe.bind(this)}}onDown(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("down",{down:!0,move:!1,up:!1,enter:!1,out:!1,leave:!1,over:!1},...t),this}onMove(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("move",{down:!1,move:!0,up:!1,enter:!1,out:!1,leave:!1,over:!1},...t),this}onUp(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("up",{down:!1,move:!1,up:!0,enter:!1,out:!1,leave:!1,over:!1},...t),this}onEnter(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("enter",{down:!1,move:!1,up:!1,enter:!0,out:!1,leave:!1,over:!1},...t),this}onOut(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("out",{down:!1,move:!1,up:!1,enter:!1,out:!0,leave:!1,over:!1},...t),this}onLeave(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("leave",{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!0,over:!1},...t),this}onOver(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("over",{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1,over:!0},...t),this}}function ge(t){Jt.call(this,t,"down",(()=>{this.dx=parseInt(t.offsetX),this.dy=parseInt(t.offsetY),this.isDown=!0}),{x:this.dx,y:this.dy,t:Date.now()-this.cache.stream.t0})}function fe(t){Jt.call(this,t,"move",(()=>{this.mx=parseInt(t.offsetX),this.my=parseInt(t.offsetY),this.isMoving=!0}),{x:this.mx,y:this.my,t:Date.now()-this.cache.stream.t0})}function be(t){Jt.call(this,t,"up",(()=>{this.ux=parseInt(t.offsetX),this.uy=parseInt(t.offsetY),this.isDown=!1;const e=this.dx,s=this.dy,i=this.ux,r=this.uy,n=(i-e)/this.target.Width,o=(s-r)/this.target.Height,a=n<0?"left":n>0?"right":"none",h=o<0?"bottom":o>0?"top":"none";this.swippe={h:a,v:h,delta_x:n,delta_y:o}}),{x:this.ux,y:this.uy,t:Date.now()-this.cache.stream.t0})}function ye(t){Jt.call(this,t,"enter",null,null)}function we(t){Jt.call(this,t,"leave",null,null)}function ve(t){Jt.call(this,t,"out",null,null)}function xe(t){Jt.call(this,t,"out",null,null)}const ke=t=>new me(t);function _e(t){Jt.call(this,t,"wheel",null,null)}class Ce extends te{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{wheel:!1},paused:{wheel:!1},stream:{enabled:{wheel:!1},clear:{wheel:!1},history:{wheel:[]}},callbacks:{click:[]}},this.__controller={wheel:_e.bind(this)}}onWheel(...t){return this.__onEvent("wheel",{},...t),this}}const Ee=t=>new Ce(t);function Ie(t){Jt.call(this,t,"down",(()=>this.kd=t.key),{key:t.key,t:10})}function Te(t){Jt.call(this,t,"press",(()=>this.kp=t.key),{key:t.key,t:10})}function Ae(t){Jt.call(this,t,"up",(()=>this.ku=t.key),{key:t.key,t:10})}class Se extends te{constructor(t){super(t),this.kp=null,this.kd=null,this.ku=null,this.t=0,this.cache={prefixe:"key",preventDefault:{down:!1,press:!1,up:!1},paused:{down:!1,press:!1,up:!1},stream:{enabled:{down:!1,press:!1,up:!1},clear:{down:!0,press:!1,up:!1},history:{down:[],press:[],up:[]}},callbacks:{down:[t=>console.log({kd:t.kd})],press:[t=>console.log({kp:t.kp})],up:[t=>console.log({ku:t.ku})]},successifKeysCallback:{down:[t=>console.log(1111)],press:[t=>console.log(1112)],kyup:[t=>console.log(1113)]}},this.__controller={down:Ie.bind(this),press:Te.bind(this),up:Ae.bind(this)}}onDown(...t){return this.__onEvent("down",{down:!0},...t),this}onPress(...t){return this.__onEvent("press",{press:!0},...t),this}onUp(...t){return this.__onEvent("up",{up:!0},...t),this}}var Oe=t=>new Se(t);function Me(t){Jt(this,t,"start",null)}function je(t){Jt.call(this,t,"drag",null,null)}function De(t){Jt.call(this,t,"end",null,null)}function Ze(t){Jt.call(this,t,"drop",null,null)}class Le extends te{constructor(t){super(t),this.target.setAttribute("draggable",!0),this.cache={prefixe:"drag",preventDefault:{drag:!1,start:!1,end:!1,enter:!1,leave:!1,over:!1},paused:{drag:!1,start:!1,end:!1,enter:!1,leave:!1,over:!1},enabled:{drag:!1,start:!1,end:!1,enter:!1,leave:!1,over:!1},callbacks:{drag:[],start:[],end:[],enter:[],leave:[],over:[]},stream:{enabled:{drag:!1,start:!1,end:!1,enter:!1,leave:!1,over:!1},clear:{drag:!1,start:!1,end:!1,enter:!1,leave:!1,over:!1},history:{drag:[],start:[],end:[],enter:[],leave:[],over:[]}}},this.__controller={start:Me.bind(this),drag:je.bind(this),end:De.bind(this)}}onStart(...t){return this.__onEvent("start",{},...t),this}onDrag(...t){return this.__onEvent("drag",{},...t),this}onEnd(...t){return this.__onEvent("end",{},...t),this}}class Pe extends te{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{drop:!1},paused:{drop:!1},stream:{enabled:{drop:!1},clear:{drop:!1},history:{drop:[]}},callbacks:{drop:[t=>console.log({dx:t.dx,dy:t.dy,drop:t.drop,move:t.move,t:t.dt})]}},this.__controller={drop:Ze.bind(this)}}onDrop(...t){return this.__onEvent("drop",{},...t),this}}const Ue=t=>new Le(t),Re=t=>new Pe(t);function ze(t){Jt.call(this,t,"copy",null,null)}function $e(t){Jt.call(this,t,"cut",null,null)}function Ne(t){Jt.call(this,t,"paste",null,null)}function Ve(t){Jt.call(this,t,"select",null,null)}class Be extends te{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{copy:!1,cut:!1,paste:!1,select:!1},paused:{copy:!1,cut:!1,paste:!1,select:!1},stream:{enabled:{copy:!1,cut:!1,paste:!1,select:!1},clear:{copy:!1,cut:!1,paste:!1,select:!1},history:{copy:[],cut:[],paste:[],select:[]}},callbacks:{copy:[],cut:[],paste:[],select:[]}},this.__controller={copy:ze.bind(this),cut:$e.bind(this),paste:Ne.bind(this),select:Ve.bind(this)}}onCopy(...t){return this.__onEvent("copy",{},...t),this}onCut(...t){return this.__onEvent("cut",{},...t),this}onPaste(...t){return this.__onEvent("paste",{},...t),this}onSelect(...t){return this.__onEvent("select",{},...t),this}}const Fe=t=>new Be(t);function He(t){Jt.call(this,t,"focus",null,null)}function We(t){Jt.call(this,t,"blur",null,null)}class Xe extends te{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{focus:!1,blur:!1},paused:{focus:!1,blur:!1},stream:{enabled:{focus:!1,blur:!1},clear:{focus:!1,blur:!1},history:{focus:[],blur:[]}},callbacks:{focus:[],blur:[]}},this.__controller={focus:He.bind(this),blur:We.bind(this)}}onFocus(...t){return this.__onEvent("focus",{},...t),this}onBlur(...t){return this.__onEvent("blur",{},...t),this}}const qe=t=>new Xe(t);function Ye(t){Jt.call(this,t,"input",null,null)}function Ge(t){Jt.call(this,t,"change",null,null)}class Ke extends te{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:Ye.bind(this),change:Ge.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 Qe=t=>new Ke(t);function Je(t){Jt.call(this,t,"hashchange",null,null)}class ts extends te{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:Je.bind(this)}}onChange(...t){return this.__onEvent("hashchange",{},...t),this}}const es=t=>new ts(t),ss=t=>function(e){Jt.call(this,e,t,null,null)};class is extends te{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{},paused:{},stream:{enabled:{},clear:{},history:{}},callbacks:{}},this.__controller={}}#r(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]=ss(t).bind(this),this}on(t,...e){return this.__controller[t]||this.#r(t),this.__onEvent(t,{},...e),this}emit(t,e={}){this.__controller[t]||this.#r(t),this.detail=e;const s=new Event(t);return this.targetElement.dispatchEvent(s),this}}const rs=t=>new is(t);class ns extends te{constructor(t,e=.3,s=.3){super(t);const{removeListener:i,setWidthThreshold:r,setHeightThreshold:n}=function(t,e=.5,s=.5,i,r){let n=R(e,0,i),o=R(s,0,r),a=0,h=0,l=0,c=0;const u=t=>{a=t.clientX,h=t.clientY},p=t=>{l=t.clientX,c=t.clientY,d()};function d(){const t=l-a,e=c-h;(Math.abs(t)>n||Math.abs(e)>o)&&m(t,e)}function m(e,s){const a=globalThis?.CustomEvent?new CustomEvent("swipe",{detail:{deltaX:Ea(e)<n?0:th(e)*U(Ea(e),0,i),deltaY:Ea(s)<o?0:th(s)*U(Ea(s),0,r),direction:{x:Ea(e)<n?"none":e>0?"right":"left",y:Ea(s)<o?"none":s>0?"down":"up"}}}):null;t?.dispatchEvent(a)}function g(t){n=R(t,0,i)}function f(t){o=R(t,0,r)}return t?.addEventListener("pointerdown",u),t?.addEventListener("pointerup",p),{removeListener(){t?.removeEventListener("pointerdown",u),t?.removeEventListener("pointerup",p),console.log("Swipe event listeners removed")},setWidthThreshold:g,setHeightThreshold:f}}(this.target?.element,e,s,this.target.width,this.target.height);this.cache={width_threshold:e,height_threshold:s,removeListener:i,setWidthThreshold:r,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:os.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 os(t){Jt.call(this,t,"swipe",null,null)}const as=(t,e,s)=>new ns(t,e,s);var hs=Object.freeze({__proto__:null,ZikoCustomEvent:is,ZikoEvent:te,ZikoEventClick:ie,ZikoEventClipboard:Be,ZikoEventHash:ts,ZikoEventInput:Ke,ZikoEventKey:Se,ZikoEventMouse:me,ZikoEventPointer:pe,ZikoEventSwipe:ns,ZikoEventWheel:Ce,useClickEvent:re,useClipboardEvent:Fe,useCustomEvent:rs,useDragEvent:Ue,useDropEvent:Re,useFocusEvent:qe,useHashEvent:es,useInputEvent:Qe,useKeyEvent:Oe,useMouseEvent:ke,usePointerEvent:de,useSwipeEvent:as,useWheelEvent:Ee});class ls{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 cs=(t,e={},s=null)=>{const i=new ls(t,e);return s&&i.observe(s),i};class us extends ls{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 ps=(t,e)=>new us(t,e);class ds extends ls{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 ms=(t,e)=>new ds(t,e);class gs{constructor(t,e,{threshold:s=0,margin:i=0}={}){this.target=t,this.config={threshold:s,margin:i},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 fs=(t,e,s)=>new gs(t,e,s);class bs{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 ys=(t,e)=>new bs(t,e);class ws{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 $(globalThis?.screenX,0,globalThis.screen.availWidth,-1,1)}get y0(){return-$(globalThis?.screenY,0,globalThis.screen.availHeight,-1,1)}get x1(){return $(globalThis?.screenX+globalThis?.outerWidth,0,globalThis.screen.availWidth,-1,1)}get y1(){return-$(globalThis?.screenY+globalThis?.outerHeight,0,globalThis.screen.availHeight,-1,1)}get cx(){return $(globalThis?.outerWidth/2+globalThis?.screenX,0,globalThis.screen.availWidth,-1,1)}get cy(){return-$(globalThis?.outerHeight/2+globalThis?.screenY,0,globalThis.screen.availHeight,-1,1)}}const vs=t=>new ws(t);var xs=Object.freeze({__proto__:null,ZikoMutationObserver:ls,watch:cs,watchAttr:ps,watchChildren:ms,watchIntersection:fs,watchScreen:vs,watchSize:ys});const ks=(t,e=[],s=(()=>{}))=>{t.cache.stream.enabled.down=!0;const i=e.length,r=t.cache.stream.history.down.slice(-i).map((t=>t.key));e.join("")===r.join("")&&(t.event.preventDefault(),s.call(t,t))};function _s(t,...e){const s=t.toString().match(/\(([^)]*)\)/)[1].split(",").map((t=>t.trim()));return function(...i){const r=e[e.length-1];for(let t=0;t<i.length;t++){const n=t>=e.length,o=n?r:e[t],a=i[t];n?(s[s.length-1],e.length):s[t];let h=!1;if("object"==typeof o){if(o.or)for(const t of o.types)if(Cs(t,a)){h=!0;break}if(o.nor)for(const t of o.types){if(Cs(t,a)){h=!1;break}h=!0}else o.not&&(h=!Cs(o.type,a))}else h=Cs(o,a);if(!h)throw new TypeError("jjj")}return t(...i)}}const Cs=(t,e)=>"string"==typeof t?typeof e===t:t instanceof Function?e instanceof t:Array.isArray(t)?!(!Array.isArray(e)||e.length!==t.length)&&e.every(((e,s)=>Cs(t[s],e))):"object"==typeof t&&!Array.isArray(t)&&("object"==typeof e&&null!==e&&Object.keys(t).every((s=>s in e&&Cs(t[s],e[s]))));class Es{constructor(t,e=1e3/30,s=0,i=1/0,r=!0){this.callback=t,this.cache={isRunning:!1,AnimationId:null,t0:null,step:e,startTime:s,endTime:i,started:r},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 Is=t=>1e3/t,Ts=(t,e,s,i,r)=>new Es(t,e,s,i,r);var As=Object.freeze({__proto__:null,useFps:Is,useTimeLoop:Ts});const Ss={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-Ss.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-Ss.OutBounce(1-2*t))/2:(1+Ss.OutBounce(2*t-1))/2},Os=(t,e=1e3)=>(...s)=>setTimeout((()=>t(...s)),e),Ms=(t,e)=>{let s=0;return(...i)=>{const r=(new Date).getTime();r-s<e||(s=r,t(...i))}},js=t=>{const e=Date.now(),s=performance.memory.usedJSHeapSize,i=t();return{elapsedTime:Date.now()-e,usedMemory:performance.memory.usedJSHeapSize-s,result:i}},Ds=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})})),Zs=(t,e=2e3)=>{const s=Date.now();for(;Date.now()-s<e;)if(t.element)return t.element},Ls=t=>new Promise((e=>setTimeout(e,t))),Ps=t=>{console.time("timeTaken");const e=t();return console.timeEnd("timeTaken"),e};var Us=Object.freeze({__proto__:null,Ease:Ss,timeTaken:Ps,time_memory_Taken:js,useDebounce:Os,useThrottle:Ms,wait:Ls,waitForUIElm:Ds,waitForUIElmSync:Zs});class Rs{constructor(t,e=Ss.Linear,s=50,{t:i=[0,null],start:r=!0,duration:n=3e3}={}){this.cache={isRunning:!1,AnimationId:null,startTime:null,ease:e,step:s,intervall:i,started:r,duration:n},this.t=0,this.tx=0,this.ty=0,this.i=0,this.callback=t}#n(){this.t+=this.cache.step,this.i++,this.tx=$(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}#o(t=!0){return this.cache.isRunning||(t&&this.reset(!1),this.cache.isRunning=!0,this.cache.startTime=Date.now(),this.cache.AnimationId=setInterval(this.#n.bind(this),this.cache.step)),this}start(){return this.#o(!0),this}pause(){return this.cache.isRunning&&(clearTimeout(this.cache.AnimationId),this.cache.isRunning=!1),this}resume(){return this.#o(!1),this}stop(){return this.pause(),this.reset(!1),this}}const zs={...As,...As,...Us};let $s=class{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=i=>{this.off(t,s),e(i)};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 Ns=()=>new $s;let Vs=class{constructor(t,e=!0){this.#r(),this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}#r(){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=Ns(),this}};const Bs=(t,e)=>new Vs(t,e);let Fs=class{constructor({viewport:t,charset:e,description:s,author:i,keywords:r}){this.document=globalThis?.document,this.meta={},this.init({viewport:t,charset:e,description:s,author:i,keywords:r})}init({viewport:t,charset:e,description:s,author:i,keywords:r}){t&&this.setViewport(t),e&&this.setCharset(e),s&&this.describe(s),i&&this.setAuthor(i),r&&this.setKeywords(r)}set(t,e){const s="charset"===(t=t.toLowerCase()),i=s?document.querySelector("meta[charset]"):document.querySelector(`meta[name=${t}]`);return this.meta=i??document?.createElement("meta"),s?this.meta.setAttribute("charset",e):(this.meta.setAttribute("name",t),this.meta.setAttribute("content",e)),i||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 Hs=({viewport:t,charset:e,description:s,author:i,keywords:r})=>new Fs({viewport:t,charset:e,description:s,author:i,keywords:r});let Ws=class{constructor(t=document.title,e=!0){this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}useEventEmitter(){return this.cache.Emitter=Ns(),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 Xs=(t,e)=>new Ws(t,e);let qs=class{constructor({title:t,lang:e,icon:s,meta:i,noscript:r}){this.html=globalThis?.document?.documentElement,this.head=globalThis?.document?.head,t&&Xs(t),e&&this.setLang(e),s&&Bs(s),i&&Hs(i),r&&this.setNoScript()}setLang(t){this.html.setAttribute("lang",t)}setNoScript(t){}};const Ys=({title:t,lang:e,icon:s,meta:i,noscript:r})=>new qs({title:t,lang:e,icon:s,meta:i,noscript:r});let Gs=class{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.#a(t),this}on(t,e=console.log){return this.EVENTS_HANDLERS_PAIRS.set(t,e),this.#h(),this}#h(){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),i=this.EVENTS_HANDLERS_PAIRS.get(this.LAST_RECEIVED_EVENT);s&&i&&i(s)},this}#a(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 Ks=t=>new Gs(t);class Qs{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=i=>{this.off(t,s),e(i)};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 Js=()=>new Qs;class ti{#l;constructor(){this.#l=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.#l],{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}}const ei=(t,e,s)=>{const i=new ti;return t&&i.call(t,e,s),i};class si{constructor(){this.isSupported&&this.#r()}async#r(){this.__Battery__=await navigator.getBattery()}get isSupported(){return!!navigator.getBattery}get current(){const{level:t,charging:e,chargingTime:s,dischargingTime:i}=this.__Battery__;return{level:t,charging:e,chargingTime:s,dischargingTime:i}}onChargingChange(t){return this.__Battery__?.addEventListener("chargingchange",t),this}onLevelChange(t){return this.__Battery__?.addEventListener("levelchange",t),this}}const ii=()=>new si;class ri{constructor(){this.isSupported&&this.#r()}async#r(){navigator.geolocation.getCurrentPosition((t=>this.__Geolocation__=t))}get isSupported(){return!!navigator.geolocation}get current(){return this.__Geolocation__}}const ni=()=>new ri;class oi{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.#a(t),this}on(t,e=console.log){return this.EVENTS_HANDLERS_PAIRS.set(t,e),this.#h(),this}#h(){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),i=this.EVENTS_HANDLERS_PAIRS.get(this.LAST_RECEIVED_EVENT);s&&i&&i(s)},this}#a(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 ai=t=>new oi(t);class hi{constructor(t,e,s){this.cache={storage:t,globalKey:e,channel:ai(`Ziko:useStorage-${e}`),oldItemKeys:new Set},this.#r(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]})}#r(t){this.cache.channel=ai(`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}}const li=(t,e)=>new hi(localStorage,t,e),ci=(t,e)=>new hi(sessionStorage,t,e);class ui{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}#t(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}#e(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}#s(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.#t(t):"string"==typeof t?this.#e(t):t&&"object"==typeof t?this.#s(t):this}}const pi=(t,e,s)=>new ui(t,e,s);class di{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),i=()=>{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)};i(),s.addListener(i)}))}}const mi=(t,e)=>new di(t,e);class gi{constructor(t){this.props={},t&&this.set(t)}get(t){return this.props[t]}set(t){return Object.entries(t).forEach((([t,e])=>this.#u(t,e))),this}#u(t,e){const s=`--${sa.camel2hyphencase(t)}`;document.documentElement.style.setProperty(s,e),Object.assign(this.props,{[t]:`var(${s})`}),Object.assign(this,{[t]:`var(${s})`})}}const fi=t=>(t.startsWith("--")||(t=`--${sa.camel2hyphencase(t)}`),`var(${t})`),bi=t=>new gi(t);const yi={...hs,...xs,...Object.freeze({__proto__:null,ZikoHead:qs,ZikoUseRoot:gi,ZikoUseStyle:ui,useBattery:ii,useChannel:Ks,useDebounce:Os,useEventEmitter:Js,useFavIcon:Bs,useGeolocation:ni,useHead:Ys,useLocaleStorage:li,useMediaQuery:mi,useMeta:Hs,useRoot:bi,useRootValue:fi,useSessionStorage:ci,useStyle:pi,useSuccesifKeys:ks,useThread:ei,useThrottle:Ms,useTitle:Xs,useType:_s})};class wi{constructor(t,e=""){this.target=globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body,"string"==typeof t&&(t="svg"===t?globalThis?.document?.createElementNS("http://www.w3.org/2000/svg","svg"):globalThis?.document?.createElement(t)),t&&(this.__ele__=t),this.uuid=this.constructor.name+"-"+dt.string(10),this.cache={name:e,parent:null,isBody:!1,isRoot:!1,isHidden:!1,isFrozzen:!1,legacyParent:null,style:new Qt({}),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},this.cache.style.linkTo(this),this.style({position:"relative",boxSizing:"border-box",margin:0,padding:0}),this.items=[],this.size("auto","auto"),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()}get element(){return this.__ele__}get isZikoUIElement(){return!0}get st(){return this.cache.style}get attr(){return this.cache.attributes}get evt(){return this.cache.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 Gt?this.st.style(t.current):this.st.style(t),this}size(t,e){return this.st.size(t,e),this}maintain(){for(let t=0;t<this.items.length;t++)Object.assign(this,{[[t]]:this.items[t]});return this.length=this.items.length,this}at(t){return this.items.at(t)}#p(t,e,...s){if(this.cache.isFrozzen)return console.warn("You can't append new item to frozzen element"),this;for(let i=0;i<s.length;i++)["number","string"].includes(typeof s[i])&&(s[i]=text(s[i])),s[i]instanceof wi?(s[i].cache.parent=this,this.element[t](s[i].element),s[i].target=this.element,this.items[e](s[i])):s[i]instanceof Object&&(s[i]?.style&&this.style(s[i]?.style),s[i]?.attr&&Object.entries(s[i].attr).forEach((t=>this.setAttr(""+t[0],t[1]))));return this.maintain(),this}append(...t){return this.#p("append","push",...t),this}prepend(...t){return this.#p("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]=text(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 instanceof wi&&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}forEach(t){return this.items.forEach(t),this}map(t){return this.items.map(t)}find(t){return this.items.filter(t)}filter(t,e=(()=>{}),s=(()=>{})){const i=this.items.filter(t);return i.forEach(e),this.items.filter((t=>!i.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#d(){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.#d,direction:"rtl"}):this.style({direction:"rtl"}),this}useLtr(t=!1){return t?this.style({...this.#d,direction:"ltr"}):this.style({direction:"ltr"}),this}freeze(t){return this.cache.isFrozzen=t,this}setTarget(t){if(!this.isBody)return t instanceof wi&&(t=t.element),this.unrender(),this.target=t,this.render(),this}describe(t){t&&this.setAttr("aria-label",t)}clear(){return this?.items?.forEach((t=>t.unrender())),this.element.innerHTML="",this}render(t=this.target){if(!this.isBody)return t instanceof wi&&(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 instanceof wi&&(t=t.element),this.element?.after(t),this}before(t){return t instanceof wi&&(t=t.element),this.element?.before(t),this}animate(t,{duration:e=1e3,iterations:s=1,easing:i="ease"}={}){return this.element?.animate(t,{duration:e,iterations:s,easing:i}),this}#m(t,e){"svg"!==this.element.tagName&&(t=sa.isCamelCase(t)?sa.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,i]=[Object.keys(t),Object.values(t)];for(let t=0;t<s.length;t++)i[t]instanceof Array&&(e[t]=i[t].join(" ")),this.#m(s[t],i[t])}else e instanceof Array&&(e=e.join(" ")),this.#m(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=sa.isCamelCase(t)?sa.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")}onPtrMove(...t){return this.events.ptr||(this.events.ptr=de(this)),this.events.ptr.onMove(...t),this}onPtrDown(...t){return this.events.ptr||(this.events.ptr=de(this)),this.events.ptr.onDown(...t),this}onPtrUp(...t){return this.events.ptr||(this.events.ptr=de(this)),this.events.ptr.onUp(...t),this}onPtrEnter(...t){return this.events.ptr||(this.events.ptr=de(this)),this.events.ptr.onEnter(...t),this}onPtrLeave(...t){return this.events.ptr||(this.events.ptr=de(this)),this.events.ptr.onLeave(...t),this}onPtrOut(...t){return this.events.ptr||(this.events.ptr=de(this)),this.events.ptr.onOut(...t),this}onPtrCancel(...t){return this.events.ptr||(this.events.ptr=de(this)),this.events.ptr.onCancel(...t),this}onSwipe(t,e,...s){return this.events.swipe||(this.events.swipe=as(this,t,e)),this.events.swipe.onSwipe(...s),this}onMouseMove(...t){return this.events.mouse||(this.events.mouse=ke(this)),this.events.mouse.onMove(...t),this}onMouseDown(...t){return this.events.mouse||(this.events.mouse=ke(this)),this.events.mouse.onDown(...t),this}onMouseUp(...t){return this.events.mouse||(this.events.mouse=ke(this)),this.events.mouse.onUp(...t),this}onMouseEnter(...t){return this.events.mouse||(this.events.mouse=ke(this)),this.events.mouse.onEnter(...t),this}onMouseLeave(...t){return this.events.mouse||(this.events.mouse=ke(this)),this.events.mouse.onLeave(...t),this}onMouseOut(...t){return this.events.mouse||(this.events.mouse=ke(this)),this.events.mouse.onOut(...t),this}onWheel(...t){return this.events.wheel||(this.events.wheel=Ee(this)),this.events.wheel.onWheel(...t),this}onKeyDown(...t){return this.events.key||(this.events.key=Oe(this)),this.events.key.onDown(...t),this}onKeyPress(...t){return this.events.key||(this.events.key=Oe(this)),this.events.key.onPress(...t),this}onKeyUp(...t){return this.events.key||(this.events.key=Oe(this)),this.events.key.onUp(...t),this}onKeysDown({keys:t=[],callback:e}={}){return this.events.key||(this.events.key=Oe(this)),this.events.key.handleSuccessifKeys({keys:t,callback:e}),this}onDragStart(...t){return this.events.drag||(this.events.drag=Ue(this)),this.events.drag.onStart(...t),this}onDrag(...t){return this.events.drag||(this.events.drag=Ue(this)),this.events.drag.onDrag(...t),this}onDragEnd(...t){return this.events.drag||(this.events.drag=Ue(this)),this.events.drag.onEnd(...t),this}onDrop(...t){return this.events.drop||(this.events.drop=Re(this)),this.events.drop.onDrop(...t),this}onClick(...t){return this.events.click||(this.events.click=re(this)),this.events.click.onClick(...t),this}onDbClick(...t){return this.events.click||(this.events.click=re(this)),this.events.click.onDbClick(...t),this}onCopy(...t){return this.events.clipboard||(this.events.clipboard=Fe(this)),this.events.clipboard.onCopy(...t),this}onCut(...t){return this.events.clipboard||(this.events.clipboard=Fe(this)),this.events.clipboard.onCut(...t),this}onPaste(...t){return this.events.clipboard||(this.events.clipboard=Fe(this)),this.events.clipboard.onPaste(...t),this}onSelect(...t){return this.events.clipboard||(this.events.clipboard=Fe(this)),this.events.clipboard.onSelect(...t),this}onFocus(...t){return this.events.focus||(this.events.focus=qe(this)),this.events.focus.onFocus(...t),this}onBlur(...t){return this.events.focus||(this.events.focus=qe(this)),this.events.focus.onFocus(...t),this}on(t,...e){return this.events.custom||(this.events.custom=rs(this)),this.events.custom.on(t,...e),this}emit(t,e={}){return this.events.custom||(this.events.custom=rs(this)),this.events.custom.emit(t,e),this}watchAttr(t){return this.observer.attr||(this.observer.attr=ps(this,t)),this}watchChildren(t){return this.observer.children||(this.observer.children=ms(this,t)),this}watchSize(t){return this.observer.resize||(this.observer.resize=ys(this,t)),this.observer.resize.start(),this}watchIntersection(t,e){return this.observer.intersection||(this.observer.intersection=fs(this,t,e)),this.observer.intersection.start(),this}setFullScreen(t=!0,e){return this.element.requestFullscreen?(t?this.element.requestFullscreen(e):globalThis.document.exitFullscreen(),this):(console.error("Fullscreen API is not supported in this browser."),this)}toggleFullScreen(t){return globalThis.document.fullscreenElement?globalThis.document.exitFullscreen():this.element.requestFullscreen(t),this}toPdf(){return __ZikoPdf__,this}}class vi extends wi{constructor(t,e=""){super(t,e),this.items=[]}}class xi extends vi{constructor(t,e,s,...i){super(t,e),this.addValue(...i),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 wi?this.element?.appendChild(t.element):t instanceof ga||t instanceof ha?this.element?.appendChild(new Text(t.toString())):t instanceof Array?this.element?.appendChild(new Text(Go(t))):t instanceof Object&&this.element?.appendChild(new Text(qo(t))),this.cache.lineBreak&&this.element?.appendChild(globalThis.document?.createElement("br"))})),this.element?.innerHTML&&(this.element.innerHTML=this.element.innerHTML.replace(/\n/g,"<br>").replace(/(?<!<[^>]+) /g," ")),this}setValue(...t){return this.clear(),this.addValue(...t),this}}class ki extends xi{constructor(...t){super("span","text",!1,...t)}}class _i extends xi{constructor(...t){super("q","quote",!1,...t),this.style({fontStyle:"italic"})}get isQuote(){return!0}}class Ci extends xi{constructor(...t){super("dfn","dfnText",!1,...t)}get isDfnText(){return!0}}class Ei extends xi{constructor(t){super("sup","supText",!1,t)}get isSupText(){return!0}}class Ii extends xi{constructor(...t){super("sub","subText",!1,...t)}get isSubText(){return!0}}class Ti extends xi{constructor(...t){super("code","codeText",!1,...t)}get isCodeText(){return!0}}class Ai extends xi{constructor(t,e){super("abbr","abbrText",!1,t),this.setAttr("title",e)}get isAbbrText(){return!0}}const Si=(...t)=>new ki(...t),Oi=(...t)=>new _i(...t),Mi=(...t)=>new Ci(...t),ji=(...t)=>new Ei(...t),Di=(...t)=>new Ii(...t),Zi=(...t)=>new Ti(...t),Li=(t,e)=>new Ai(t,e);class Pi extends xi{constructor(...t){super("p","p",!0,...t)}get isPara(){return!0}}class Ui extends xi{constructor(t,e){super("blockquote","blockquote",!0,e),this.setAttr("cite",t)}get isBlockQuote(){return!0}}const Ri=(...t)=>new Pi(...t),zi=(t,e)=>new Ui(t,e);class $i extends wi{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 Ni=(t="")=>new $i(1,t),Vi=(t="")=>new $i(2,t),Bi=(t="")=>new $i(3,t),Fi=(t="")=>new $i(4,t),Hi=(t="")=>new $i(5,t),Wi=(t="")=>new $i(6,t);var Xi=Object.freeze({__proto__:null,ZikoUIAbbrText:Ai,ZikoUIBlockQuote:Ui,ZikoUICodeText:Ti,ZikoUIDefintion:Ci,ZikoUIHeading:$i,ZikoUIParagraphe:Pi,ZikoUIQuote:_i,ZikoUISubText:Ii,ZikoUISupText:Ei,ZikoUIText:ki,abbrText:Li,blockQuote:zi,codeText:Zi,dfnText:Mi,h1:Ni,h2:Vi,h3:Bi,h4:Fi,h5:Hi,h6:Wi,p:Ri,quote:Oi,subText:Di,supText:ji,text:Si});class qi extends vi{constructor(t){super("li","li"),this.append(t)}get isLi(){return!0}}class Yi extends vi{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]=Si(t[e])),t[e]instanceof wi&&(s=new qi(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 wi&&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 i=null;["number","string"].includes(typeof e[s])&&(e[s]=Si(e[s])),e[s]instanceof wi&&(i=new qi(e[s])),this.element?.insertBefore(i.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 i=s.element.textContent;return!(e?i===t:i.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 Gi extends Yi{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 Ki extends Yi{constructor(...t){super("ul","ul"),this.append(...t)}get isUl(){return!0}}const Qi=t=>new qi(t),Ji=(...t)=>new Gi(...t),tr=(...t)=>new Ki(...t);var er=Object.freeze({__proto__:null,li:Qi,ol:Ji,ul:tr});class sr extends wi{constructor(t,e,s="",i){super("input","input"),Object.assign(this.events,{input:null}),this.setValue(s),this.setAttr("type",t),this.setAttr("name",e),i&&this.linkDatalist(i)}get isInput(){return!0}setName(t){return this.setAttr("name",t),this}onInput(...t){return this.events.input||(this.events.input=Qe(this)),this.events.input.onInput(...t),this}onChange(...t){return this.events.input||(this.events.input=Qe(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 ir=(t,e)=>{if(t instanceof Object){const{datalist:e,placeholder:s}=t;return t=t.value??"",new sr("text","input",t,e).setPlaceholder(s)}return new sr("text","input",t,e)};class rr extends sr{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 nr=(t,e,s)=>{if(t instanceof Object){const{value:e,max:s=10,step:i=1,placeholder:r=""}=t;return t=t?.min??0,new ZikoUIInputSlider(t,s,i).setValue(e).setPlaceholder(r)}return new rr(t,e,s)};let or=class extends sr{constructor(t=0,e=0,s=10,i=1){super("range","inputSlider"),this.setMin(e).setMax(s).setValue(t).setStep(i)}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 ar=(t,e,s,i)=>{if(t instanceof Object){const{min:e=0,max:s=10,step:i=1}=t;return new or(t=t?.value??5,e,s,i)}return new or(t,e,s,i)};class hr extends sr{constructor(){super("color","inputColor"),this.background(this.value),this.onInput((()=>this.background(this.value)))}get isInputColor(){return!0}}const lr=()=>new hr;class cr extends sr{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 ur=(...t)=>(new cr).connect(...t);class pr extends sr{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 dr=()=>new pr;class mr extends sr{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 gr=()=>new mr;class fr extends sr{constructor(){super("email","inputEmail")}get isInputEmail(){return!0}}const br=()=>new fr;class yr extends sr{constructor(){super("password","inputPassword")}get isInputPassword(){return!0}}const wr=()=>new yr;class vr extends sr{constructor(){super("date","inputDate")}get isInputDate(){return!0}}const xr=()=>new vr;class kr extends sr{constructor(){super("time","inputTime")}get isInputTime(){return!0}}const _r=()=>new kr;class Cr extends sr{constructor(){super("datetime-local","inputDateTime")}get isInputDateTime(){return!0}}const Er=()=>new Cr;class Ir extends wi{constructor(t,e){super("div",""),this.element.append("svg"===e?function(t){const e=new DOMParser;return e.parseFromString(t.replace(/\s+/g," ").trim(),"image/svg+xml").documentElement}(t):function(t){const e=(new DOMParser).parseFromString(`<div>${t}</div>`,"text/html");return e.body.firstChild.style.display="contents",e.body.firstChild}(t))}}class Tr extends Ir{constructor(t){super(t,"html")}}class Ar extends Ir{constructor(t){super(t,"svg")}}const Sr=t=>new Tr(t),Or=t=>new Ar(t);class Mr extends wi{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 jr=(t,e)=>new Mr(t,e);function Dr(t,e={},...s){const{name:i,style:r,...n}=e;let o=new wi(t,i);return r&&o.style(r),n&&o.setAttr(n),s&&o.append(...s),o}class Zr extends vi{constructor(t){super(t,"html")}}class Lr extends wi{constructor(t="button"){super("button","btn"),this.element=document?.createElement("button"),this.setValue(t),this.st.cursor("pointer"),globalThis.__Ziko__.__Config__.default.render&&this.render()}get isBtn(){return!0}setValue(t){return t instanceof wi?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 Pr extends wi{constructor(){super("br","br")}get isBr(){return!0}}class Ur extends wi{constructor(){super("hr","hr"),this.setAttr("role","none")}get isHr(){return!0}}class Rr extends vi{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 zr=()=>new Pr,$r=()=>new Ur,Nr=(t=1)=>new Array(t).fill(new Pr),Vr=(t=1)=>new Array(t).fill(new Ur),Br=(t,...e)=>new Rr(t).append(...e),Fr=(t,...e)=>new Zr(t).append(...e),Hr=t=>new Lr(t);var Wr=Object.freeze({__proto__:null,HTMLWrapper:Sr,SVGWrapper:Or,Suspense:jr,ZikoUIBr:Pr,ZikoUIHTMLWrapper:Tr,ZikoUIHr:Ur,ZikoUIHtmlTag:Zr,ZikoUILink:Rr,ZikoUISVGWrapper:Ar,ZikoUISuspense:Mr,ZikoUIXMLWrapper:Ir,br:zr,brs:Nr,btn:Hr,h:Dr,hr:$r,hrs:Vr,html:Fr,link:Br});class Xr extends wi{constructor(t="File"){super("inputImage"),this._aux_element=Hr(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 qr=t=>new Xr(t);class Yr extends wi{constructor(t,e,s,i){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 i&&(i+="%"),this.setAttr("alt",e),this.style({border:"1px solid black",width:s,height:i})}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 Gr=(t,e,s,i)=>new Yr(t,e,s,i);class Kr extends wi{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 Qr=(t,e)=>new Kr(t,e);class Jr extends wi{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 tn extends Jr{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 en=(t,e,s)=>new tn(t,e,s);class sn extends Jr{constructor(t){super("audio","audio"),this.element?.setAttribute("src",t),this.size("150px","30px")}get isAudio(){return!0}}const rn=t=>new sn(t);var nn=Object.freeze({__proto__:null,ZikoUIAudio:sn,ZikoUIFigure:Kr,ZikoUIImage:Yr,ZikoUIVideo:tn,audio:rn,figure:Qr,image:Gr,video:en});class on extends tn{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 an=()=>new on;class hn extends wi{constructor(){super(),this.element=document?.createElement("label")}get isLabel(){return!0}}class ln extends wi{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 cn=class extends wi{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 ln(t)))),this}};const un=(...t)=>new cn(...t);class pn extends wi{constructor(){super(),this.element=document?.createElement("select")}addOptions(...t){return t.map((t=>this.append(new ln(t)))),this}get isSelect(){return!0}}const dn=()=>new pn;class mn extends wi{constructor(){super(),this.element=document?.createElement("textarea")}get value(){return this.element.textContent}get isTextArea(){return!0}}const gn=()=>new mn;let fn=class extends vi{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 yn.call(this,s),this.style({alignItems:"number"==typeof t?vn.call(this,t):t,justifyContent:"number"==typeof e?xn.call(this,e):e}),this}horizontal(t,e,s=1){return wn.call(this,s),this.style({alignItems:"number"==typeof e?xn.call(this,e):e,justifyContent:"number"==typeof t?vn.call(this,t):t}),this}show(){return this.isHidden=!1,this.style({display:"flex"}),this}};const bn=(...t)=>{let e="div";return"string"==typeof t[0]&&(e=t[0],t.pop()),new fn(e).append(...t)};function yn(t){return 1==t?this.style({flexDirection:"column"}):-1==t&&this.style({flexDirection:"column-reverse"}),this}function wn(t){return 1==t?this.style({flexDirection:"row"}):-1==t&&this.style({flexDirection:"row-reverse"}),this}function vn(t){return"number"==typeof t&&(t=["flex-start","center","flex-end"][t+1]),t}function xn(t){return vn(-t)}class kn extends fn{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 _n=(...t)=>new kn(...t);var Cn=Object.freeze({__proto__:null,Form:_n,ZikoUIForm:kn,ZikoUIInput:sr,ZikoUIInputCheckbox:pr,ZikoUIInputColor:hr,ZikoUIInputDatalist:cn,ZikoUIInputDate:vr,ZikoUIInputDateTime:Cr,ZikoUIInputEmail:fr,ZikoUIInputImage:Xr,ZikoUIInputNumber:rr,ZikoUIInputOption:ln,ZikoUIInputPassword:yr,ZikoUIInputRadio:mr,ZikoUIInputSearch:cr,ZikoUIInputSlider:or,ZikoUIInputTime:kr,ZikoUILabel:hn,ZikoUISelect:pn,ZikoUITextArea:mn,checkbox:dr,datalist:un,input:ir,inputCamera:an,inputColor:lr,inputDate:xr,inputDateTime:Er,inputEmail:br,inputImage:qr,inputNumber:nr,inputPassword:wr,inputTime:_r,radio:gr,search:ur,select:dn,slider:ar,textarea:gn});class En extends wi{constructor(...t){super(),this.element=document?.createElement("Tr"),this.append(...t)}}class In extends wi{constructor(...t){super(),this.element=document?.createElement("Td"),this.append(...t)}}class Tn extends wi{constructor(...t){super(),this.element=document?.createElement("Thead"),this.append(...t)}}class An extends wi{constructor(...t){super(),this.element=document?.createElement("Tbody"),this.append(...t)}}class Sn extends wi{constructor(t){super(),this.element=document?.createElement("Caption"),this.append(t)}}const On=(...t)=>(t=t.map((t=>(t instanceof wi||(t=Si(t)),t))),new In(...t)),Mn=t=>new Sn(t),jn=t=>{var e=new Array(t.rows).fill(null).map((()=>((...t)=>new En(...t))())),s=t.arr.map((t=>t.map((()=>null))));for(let i=0;i<s.length;i++)for(let r=0;r<s[0].length;r++)s[i][r]=On(t.arr[i][r]),e[i].append(s[i][r]);return e};class Dn extends wi{constructor(t,{caption:e=null,head:s=null,foot:i=null}={}){super("table","Table"),this.structure={caption:e,head:s,body:null,foot:i},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=Mn(t),this.append(this.structure.caption),this}removeCaption(){return this.structure.caption&&this.removeItem(...this.items.filter((t=>t instanceof Sn))),this.structure.caption=null,this}setHeader(...t){return this.tHead=((...t)=>(t=t.map((t=>(t instanceof wi||(t=On(t)),t))),new Tn(...UI)))(...t),this.append(this.tHead),this}removeHeader(){return this.removeItem(...this.items.filter((t=>t instanceof Sn))),this}setFooter(t){return this.structure.caption=Mn(t),this.append(this.structure.caption),this}removeFooter(){return this.removeItem(...this.items.filter((t=>t instanceof Sn))),this}fromMatrix(t){return this.bodyMatrix=t instanceof Array?la(t):t,this.structure.body&&this.remove(this.structure.body),this.structure.body=((...t)=>new An(...t))(),this.append(this.structure.body),this.structure.body.append(...jn(this.bodyMatrix)),this}transpose(){return this.fromMatrix(this.bodyMatrix.T),this}hstack(t){return t instanceof Dn&&(t=t.bodyMatrix),this.fromMatrix(this.bodyMatrix.clone.hstack(t)),this}vstack(t){return t instanceof Dn&&(t=t.bodyMatrix),this.fromMatrix(this.bodyMatrix.clone.vstack(t)),this}slice(t=0,e=0,s=this.bodyMatrix.rows-1,i=this.bodyMatrix.cols-1){return this.fromMatrix(this.bodyMatrix.slice(t,e,s,i)),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 Zn=(t,e)=>new Dn(t,e);var Ln=Object.freeze({__proto__:null,Table:Zn});class Pn extends vi{constructor(){super("main","Main")}get isMain(){return!0}}class Un extends vi{constructor(){super("header","Header")}get isHeader(){return!0}}class Rn extends vi{constructor(){super("nav","Nav")}get isNav(){return!0}}class zn extends vi{constructor(){super("section","Section"),this.style({position:"relative"})}get isSection(){return!0}}class $n extends vi{constructor(){super("article","Article")}get isArticle(){return!0}}class Nn extends vi{constructor(){super("aside","Aside")}get isAside(){return!0}}class Vn extends vi{constructor(){super("footer","Footer"),this.element=document?.createElement("footer")}get isFooter(){return!0}}const Bn=(...t)=>(new zn).append(...t),Fn=(...t)=>(new $n).append(...t),Hn=(...t)=>(new Pn).append(...t),Wn=(...t)=>(new Un).append(...t),Xn=(...t)=>(new Vn).append(...t),qn=(...t)=>(new Rn).append(...t),Yn=(...t)=>(new Nn).append(...t);var Gn=Object.freeze({__proto__:null,Article:Fn,Aside:Yn,Footer:Xn,Header:Wn,Main:Hn,Nav:qn,Section:Bn,ZikoUIArticle:$n,ZikoUIAside:Nn,ZikoUIFooter:Vn,ZikoUIHeader:Un,ZikoUIMain:Pn,ZikoUINav:Rn,ZikoUISection:zn});class Kn extends vi{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.#g(e),this}#g(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 Qn=(...t)=>new Kn("div").append(...t);class Jn extends wi{constructor(t,e,s="😁",i=s){super("details","Collapsible"),Object.assign(this.cache,{icons:{open:s,close:i}}),this.summary=Fr("summary",t).style({fontSize:"1.1em",padding:"0.625rem",fontWeight:"bold",listStyleType:`"${s}"`,cursor:"pointer"}),this.summary[0].style({marginLeft:"0.5em"}),this.content=e.style({margin:"0.7em"}),this.element?.append(this.summary.element,this.content.element),this.style({marginBottom:"0.7em"}),ps(this,(t=>{t.target.isOpen?(t.target.emit("open"),this?.parent?.isAccordion&&this.parent.cache.autoClose&&this.parent.closeExcept(this),this.summary.style({listStyleType:`"${this.cache.icons.close}"`})):(t.target.emit("close"),this.summary.style({listStyleType:`"${this.cache.icons.open}"`}))}))}get isCollapsible(){return!0}get isOpen(){return this.element.open}open(t=this){return this.element.open=!0,this.emit("open",t),this}close(){return this.element.open=!1,this}onOpen(t){return this.on("open",t),this}onClose(t){return this.on("close",t),this}toggle(){return this.element.open=!this.element.open,this}}const to=(t,e,s,i)=>new Jn(t,e,s,i);class eo extends vi{constructor(...t){super("div","Accordion"),this.append(...t),Object.assign(this.cache,{autoClose:!0})}get isAccordion(){return!0}closeAll(){return this.items.forEach((t=>t.close())),this}closeExcept(...t){return this.items.filter((e=>!t.includes(e))).forEach((t=>t.close())),this}open(t){return t.isCollapsible?t.open():this.items[t].open(),this.closeExcept(t.isCollapsible?t:this.items[t]),this}enableAutoClose(){return this.cache.autoClose=!0,this}disableAutoClose(){return this.cache.autoClose=!1,this}toggleAutoClose(){this.cache.autoClose=!this.cache.autoClose}}const so=(...t)=>new eo(...t);class io extends vi{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 no.call(this,s),this.style({alignItems:"number"==typeof t?ao.call(this,t):t,justifyContent:"number"==typeof e?ho.call(this,e):e}),this}horizontal(t,e,s=1){return oo.call(this,s),this.style({alignItems:"number"==typeof e?ho.call(this,e):e,justifyContent:"number"==typeof t?ao.call(this,t):t}),this}show(){return this.isHidden=!1,this.style({display:"flex"}),this}}const ro=(...t)=>{let e="div";return"string"==typeof t[0]&&(e=t[0],t.pop()),new io(e).append(...t)};function no(t){return 1==t?this.style({flexDirection:"column"}):-1==t&&this.style({flexDirection:"column-reverse"}),this}function oo(t){return 1==t?this.style({flexDirection:"row"}):-1==t&&this.style({flexDirection:"row-reverse"}),this}function ao(t){return"number"==typeof t&&(t=["flex-start","center","flex-end"][t+1]),t}function ho(t){return ao(-t)}class lo extends io{constructor(...t){super(),this.style({position:"relative",overflow:"hidden",touchAction:"none",userSelect:"none"}),this.horizontal("space-around",0),this.track=Bn(...t).style({display:"inline-flex"}),this.track.size(100*this.track.children.length+"vw"),this.track.setTarget(this),this.track.items.map((t=>t.style({pointerEvents:"none",margin:"auto 10px"}))),this.x0=null,this.tx=0,this.onPtrMove((t=>{if(t.isDown){let e=t.event.pageX-this.x0;this.track.st.translateX(this.tx+e,0)}})),this.onPtrDown((t=>{console.log(t.event),this.x0=t.event.pageX;const e=window.getComputedStyle(this.track.element).getPropertyValue("transform");"none"!==e&&(this.tx=+e.split(",")[4])})),this.onPtrUp((t=>console.log(t.isDown))),this.onPtrLeave((t=>{}))}get isCarousel(){return!0}}const co=(...t)=>new lo(...t);class uo extends io{constructor(){super("section"),Object.assign(this.cache,{order:0,currentNote:null,currentNoteIndex:null}),this.vertical(0,0)}get isCodeNote(){return!0}setCurrentNote(t){return this.cache.currentNote=t,this.cache.currentNoteIndex=this.items.findIndex((e=>e===t)),t.focus(),this.items.forEach((t=>t.Input.style({border:"1px solid #ccc"}))),t.Input.style({border:"2px lightgreen solid"}),this}addNote(t=""){return this.append(fo(t)),this}execute(){return this.cache.currentNote.execute(),this.incrementOrder(),this}incrementOrder(){return this.cache.order++,this.cache.currentNote.setOrder(this.cache.order),this}next(){return this.cache.currentNote===this.items.at(-1)?(this.addNote(),this.setCurrentNote(this.items.at(-1))):this.setCurrentNote(this.items[this.cache.currentNoteIndex+1]),this}previous(){return this.cache.currentNote!==this.items[0]&&this.setCurrentNote(this.items[this.cache.currentNoteIndex-1]),this}data(){return this.items.map((t=>t.cellData()))}serialize(){return JSON.stringify(this.data())}import(t=[]){return t.forEach(((e,s)=>this.addNote(t[s].input))),this}}const po=()=>new uo,mo={background:"none",width:"25px",height:"25px",fontSize:"1.2rem",cursor:"pointer"};class go extends io{constructor(t="",{type:e="js",order:s=null}={}){var i;super("section"),Object.assign(this.cache,{state:null,order:s,type:e,metadata:{created:Date.now(),updated:null}}),this.Input=((t="")=>Fr("code",t).style({width:"100%",height:"auto",padding:"10px",boxSizing:"border-box",border:"1px solid #ccc",outline:"none",fontSize:"1rem",fontFamily:"Lucida Console, Courier New, monospace",padding:"1rem 0.5rem",wordBreak:"break-all",background:"#f6f8fa",color:"#0062C3"}).setAttr("contenteditable",!0).setAttr("spellcheck",!1))(t),this.Output=Fr("output").style({width:"100%",height:"auto",padding:"5px 0"}),this.InOut=ro(this.Input,this.Output).vertical().style({width:"100%",margin:"10px auto"}),this.RightControl=(i=this,bn(Si("▶️").style(mo).onClick((t=>{i.parent instanceof uo&&i.parent.setCurrentNote(i),i.execute(),globalThis.__Ziko__.__Config__.default.target=t.target.parent.parent[1][1]})),Si("📋").style(mo).onClick((()=>{navigator.clipboard.writeText(i.codeText)})),Si("✖️").style(mo).onClick((()=>i.remove())),Si("✖️").style(mo).onClick((()=>i.remove()))).style({width:"70px",height:"50px",margin:"10px 0"}).horizontal(0,0).wrap(!0)),this.LeftControl=bn(Si("[ ]")).style({width:"50px",height:"50px",margin:"10px 4px",padding:"5px",color:"darkblue",borderBottom:"4px solid gold"}).horizontal(0,0),this.append(this.LeftControl,this.InOut,this.RightControl),this.horizontal(-1,1).style({width:"95vw",margin:"0 auto",border:"1px darkblue dotted"});let r=this.Input.element.getElementsByClassName("cm-content")[0];r?r.addEventListener("keydown",(t=>{"Enter"===t.key&&t.shiftKey&&(t.preventDefault(),this.execute(this.cache.order))})):(this.Input.onKeyDown((t=>{"Enter"===t.kd&&t.event.shiftKey&&(t.event.preventDefault(),this.execute(this.cache.order)),this.cache.parent instanceof uo&&("ArrowDown"===t.kd&&t.event.shiftKey&&this.cache.parent.next(),"ArrowUp"===t.kd&&t.event.shiftKey&&this.cache.parent.previous())})),this.Input.onFocus((()=>{this.cache.parent instanceof uo&&(this.cache.parent.cache.currentNote=this,this.cache.parent.setCurrentNote(this))})),this.Input.onPaste((t=>{})))}get isCodeCell(){return!0}get codeText(){return this.Input.element.getElementsByClassName("cm-content")[0]?this.Input.element.getElementsByClassName("cm-content")[0].innerText.trim():this.Input.element.innerText.trim()}get codeHTML(){return this.Input.element.innerHTML}get outputHTML(){return this.Output.element.innerHTML}setValue(t){return this.Input[0].setValue(t),this}cellData(){return{input:this.codeText,output:this.outputHTML,order:this.cache.order,type:this.cache.type}}execute(t){return this.clearOutput(),this.evaluate(t),this.cache.metadata.updated=Date.now(),this}#f(t){try{this.LeftControl[0].setValue("pending"),this.cache.state="pending",globalThis.eval(this.codeText)}catch(t){console.log(t),text(`Error : ${t.message}`).style({color:"red",background:"gold",border:"2px red solid",padding:"10px",margin:"10px 0",display:"flex",justifyContent:"center"}),this.LeftControl[0].setValue("Err"),this.cache.state="Error"}finally{"pending"===this.cache.state&&(this.cache.state="success",this.setOrder(t),this.cache.parent instanceof uo&&(this.cache.parent.incrementOrder(),this.cache.parent.next()))}}#b(){}#y(){}evaluate(t){if(globalThis.__Ziko__.__Config__.default.target=this.Output.element,"js"===this.cache.type)this.#f(t);return this}clearInput(){return this.Output.element.innerText="",this}clearOutput(){return this.Output.element.innerText="",this}setOrder(t,e=!0){return this.cache.order=t,e&&("number"==typeof t?this.LeftControl[0].setValue(`[${t}]`):this.LeftControl[0].setValue("[-]")),this}focus(){return this.Input.element.focus(),this}}const fo=(t,{type:e,order:s}={})=>new go(t,{type:e,order:s});class bo extends io{#w=0;constructor(t,e){super("div","Tabs"),Object.assign(this.cache,{config:{controllersPercent:.5}}),this.style({boxSizing:"border-box",backgroundColor:"blanchedalmond",border:"1px red solid",margin:"30px"}),this.controllersContainer=ro().size("auto","auto").style({boxSizing:"border-box",justifyContent:"center",alignItems:"center",textAlign:"center",minWidth:"50px",minHeight:"50px",backgroundColor:"darkblue",border:"1px darkblue solid"}).setAttr("role","tablist"),this.contentContainer=ro().style({boxSizing:"border-box",justifyContent:"center",alignItems:"center",textAlign:"center",width:"100%",height:"100%",backgroundColor:"darkslategrey"}),this.append(this.controllersContainer,this.contentContainer),t.length!==e.length?console.error(""):(this.controllersContainer.append(...t),this.contentContainer.append(...e)),this.init(),this.display(0),this.useVertical()}get isTabs(){return!0}init(){for(let t=0;t<this.controllersContainer.length;t++)this.controllersContainer[t].setAttr("role","tab").setAttr("aria-controls",`tab${t}`),this.contentContainer[t].setAttr("role","tabpanel").setAttr("aria-labelledby",`tab${t}`).setAttr("tabindex",-1);return this.controllersContainer.forEach((t=>t.onClick((t=>{const e=t.target.element.getAttribute("aria-controls"),s=+e.slice(3);this.contentContainer.filter((t=>t.element.getAttribute("aria-labelledby")===e),(()=>{this.#w!==s&&this.display(s)}))})))),this}addPairs(t,e){this.controllersContainer.append(t),this.contentContainer.append(e);const s=this.controllersContainer.length;return this.controllersContainer.at(-1).setAttr("role","tab").setAttr("aria-controls","tab"+(s-1)),this.contentContainer.at(-1).setAttr("role","tabpanel").setAttr("aria-labelledby","tab"+(s-1)).setAttr("tabindex",-1),this}removePairs(t){}display(t){this.#w=t%this.contentContainer.length;const e=this.contentContainer.at(this.#w);return this.controllersContainer.forEach((t=>t.setAttr("tabindex",-1).setAttr("aria-selected",!1))),this.controllersContainer.at(this.#w).setAttr("tabindex",0).setAttr("aria-selected",!0),this.contentContainer.forEach((t=>t.st.hide())),e.st.translateX(100,0),e.setAttr("tabindex",0).st.show(),e.st.translateX(0,1e3),this}next(t=1){return this.display(this.#w+t),this}previous(t=1){return this.display(this.#w-t),this}useVertical(){return this.vertical(0,0),this.controllersContainer.horizontal(0,0),this.controllersContainer.style({width:"100%",height:100*this.cache.config.controllersPercent+"%"}),this.contentContainer.style({width:"100%",height:100*(1-this.cache.config.controllersPercent)+"%"}),this}useHorizontal(){return this.horizontal(0,0),this.controllersContainer.vertical(0,0),this.controllersContainer.style({height:"100%",width:100*this.cache.config.controllersPercent+"%"}),this.contentContainer.style({height:"100%",width:100*(1-this.cache.config.controllersPercent)+"%"}),this}}const yo=(t,e)=>new bo(t,e),wo={success:{titleColor:"green",contentColor:"#35495e",bgColor:"#d4edda",bgColor:"linear-gradient(-225deg, #DFFFCD 0%, #90F9C4 48%, #39F3BB 100%)",borderColor:"#28a745",icon:"✅"},info:{titleColor:"blue",contentColor:"#00204a",bgColor:"#93deff",bgColor:"radial-gradient(circle at 10% 20%, rgb(147, 230, 241) 0%, rgb(145, 192, 241) 45.5%)",borderColor:"#005689",icon:"ℹ️"},warning:{titleColor:"#e4663a",contentColor:"#45171d",bgColor:"#fdffcd",bgColor:"radial-gradient(907px at 3.4% 19.8%, rgb(255, 243, 122) 0%, rgb(255, 102, 145) 97.4%)",borderColor:"#efd510",icon:"⚠️"},danger:{titleColor:"red",contentColor:"#721c24",bgColor:"#f8d7da",bgColor:"linear-gradient(90deg, rgb(255, 157, 129) 24.3%, rgb(255, 138, 138) 78.3%)",borderColor:"#c50000",icon:"❌"},tips:{titleColor:null,contentColor:null,bgColor:null,borderColor:null,icon:"💡"},important:{titleColor:null,contentColor:null,bgColor:null,borderColor:null,icon:"📌"}};class vo extends fn{constructor(t,e,s){super(),this.title=Bi(e),this.icon=Si(wo[t].icon).style({display:"flex",justifyContent:"center",borderRadius:"50%",minWidth:"30px",minHeight:"30px"}),this.content=s,this.vertical().size("200px","auto").style({borderRadius:"10px",padding:"10px"}),this.append(bn(this.title,this.icon).size("100%","40px").style({}).horizontal("space-between",0),this.content),this.useType(t)}get isAlert(){return!0}useType(t){return this.style({color:wo[t].color,background:wo[t].bgColor,border:"1px darkblue solid",borderLeft:`15px ${wo[t].borderColor} solid`}),this.title.style({color:wo[t].titleColor}),this.content.st.color(wo[t].titleColor),this.icon.setValue(wo[t].icon).style({border:`2px ${wo[t].borderColor} solid`,alignItems:"warning"===t?"flex-start":"center"}),this}useSuccess(){return this.useType("success"),this}useInfo(){return this.useType("info"),this}useWarning(){return this.useType("warning"),this}useDanger(){return this.useType("danger"),this}}const xo=(t,e)=>new vo("success",t,e),ko=(t,e)=>new vo("info",t,e),_o=(t,e)=>new vo("warning",t,e),Co=(t,e)=>new vo("danger",t,e);class Eo extends wi{constructor(t,e,s){super("div","Splitter"),Object.assign(this.cache,{isResizing:!1,flexDirection:t,resizerCursor:e,resizerProp:s}),this.style({display:"flex",flexDirection:this.cache.flexDirection,border:"2px solid #333",overflow:"hidden"}),this.resizer=new wi("div","resizer").style({[this.cache.resizerProp]:"5px",backgroundColor:"gold",cursor:this.cache.resizerCursor,touchAction:"none"}),this.onPtrDown((t=>{this.cache.isResizing=!0,this.style({cursor:this.cache.resizerCursor}),this.resizer.element.setPointerCapture(t.event.pointerId)})),this.onPtrUp((t=>{this.cache.isResizing=!1,this.style({cursor:"default"}),this.resizer.element.releasePointerCapture(t.event.pointerId)})),this.onPtrCancel((()=>{this.cache.isResizing=!1,this.style({cursor:"default"})})),this.onPtrOut((()=>{this.cache.isResizing&&(this.cache.isResizing=!1,this.style({cursor:"default"}))}))}get isSplitter(){return!0}styleResizer(t={}){return this.resizer.style(t),this}}class Io extends Eo{constructor(t,e){super("row","ew-resize","width"),this.leftPane=t.style({width:"50%",flexGrow:1,overflow:"hidden"}),this.rightPane=e.style({width:"50%",flexGrow:1,overflow:"hidden"}),this.element?.append(this.leftPane.element,this.resizer.element,this.rightPane.element),this.onPtrMove((t=>{if(!this.cache.isResizing)return;const e=this.element.getBoundingClientRect().width;let s=(t.event.clientX-this.element.getBoundingClientRect().x)/e*100,i=100-s;s<0&&(s=0),i<0&&(i=0),this.leftPane.element.style.width=`${s}%`,this.rightPane.element.style.width=`${i}%`}))}get isHorizontalSplitter(){return!0}}const To=(t,e)=>new Io(t,e);class Ao extends Eo{constructor(t,e){super("column","ns-resize","height"),this.topPane=t.style({height:"50%",flexGrow:1,overflow:"hidden"}),this.bottomPane=e.style({height:"50%",flexGrow:1,overflow:"hidden"}),this.element?.append(this.topPane.element,this.resizer.element,this.bottomPane.element),this.onPtrMove((t=>{if(!this.cache.isResizing)return;const e=this.element.getBoundingClientRect().height;let s=(t.event.clientY-this.element.getBoundingClientRect().y)/e*100,i=100-s;s<0&&(s=0),i<0&&(i=0),this.topPane.element.style.height=`${s}%`,this.bottomPane.element.style.height=`${i}%`}))}get isHorizontalSplitter(){return!0}}const So=(t,e)=>new Ao(t,e),Oo=({orintation:t="horizontal",slides:e=[]})=>["v","vertical"].includes(t.toLowerCase())?So(...e):["h","horizontal"].includes(t.toLowerCase())?To(...e):void 0;class Mo extends wi{constructor(...t){super("ul","Breadcrumbs"),Object.assign(this.cache,{separatorTextContent:"/"}),this.style({listStyle:"none",display:"flex",flexWrap:"wrap"}),this.list=Fr("li").style({display:"flex",flexWrap:"wrap"}),this.append(...t)}#p(t){["string","number","boolean"].includes(typeof t)&&(t=Si(t));const e=Fr("li",t).style({display:"flex",alignItems:"center"});if(this.element.children.length>0){const t=Si(this.cache.separatorTextContent).style({padding:"0 4px"});this.element?.append(t.element)}this.element?.append(e.element)}append(...t){return t.forEach((t=>this.#p(t))),this}configSeparator(t=this.cache.separator,e={}){this.cache.separatorTextContent=t;return[...this.element.children].filter((t=>"SPAN"===t.tagName)).forEach((s=>{s.textContent=t,Object.assign(s.style,e)})),this}}const jo=(...t)=>new Mo(...t);class Do extends fn{constructor(t,e){super("div","menu3d"),this.controller=t,this.content=e,this.cover=null,Object.assign(this.cache,{config:{useTransfo:!1,isOpen:!1,position:"left",threshold:40,angle:70,overlap:6,width:300,height:300,transitionDuration:"0.5s",transitionEasing:"ease",menuTransformOrigin:null,menuTransformClosed:null,menuTransformOpened:null,contentTransformOrigin:null,contentTransformClosed:null,contentTransformOpened:null}}),this.append(this.controller,this.content),this.update()}get isOpen(){return this.cache.config.isOpen}update(){this.controller.style({display:"none",padding:"20px",overflow:"auto",background:"darkblue",color:"#eee",webkitboxSizing:"border-box",mozBoxSizing:"border-box",boxSizing:"border-box"}),this.content.style({padding:"20px 40px",width:"100%",height:"100%",background:"gold",color:"#eee",webkitboxSizing:"border-box",mozBoxSizing:"border-box",boxSizing:"border-box",webkitOverflowScrolling:"touch",webkitTransformStyle:"preserve-3d"}),this.setupPositions(),this.setupWrapper(),this.setupCover(),this.setupMenu(),this.setupContent()}setupPositions(){this.cache.config.menuTransformOpened="",this.cache.config.contentTransformClosed="";let t=this.cache.config.angle,e=this.cache.config.angle/-2;switch(this.cache.config.position){case"top":this.cache.config.menuTransformOrigin="50% 0%",this.cache.config.menuTransformClosed=`rotateX(${t}deg) translateY(-100%) translateY(${this.cache.config.overlap}px)`,this.cache.config.contentTransformOrigin="50% 0",this.cache.config.contentTransformOpened=`translateY(${this.height/2}px) rotateX(${e}deg)`;break;case"right":this.cache.config.menuTransformOrigin="100% 50%",this.cache.config.menuTransformClosed="rotateY( "+t+"deg ) translateX( 100% ) translateX( -2px ) scale( 1.01 )",this.cache.config.contentTransformOrigin="100% 50%",this.cache.config.contentTransformOpened="translateX( -"+this.width/2+"px ) rotateY( "+e+"deg )";break;case"bottom":this.cache.config.menuTransformOrigin="50% 100%",this.cache.config.menuTransformClosed="rotateX( "+-t+"deg ) translateY( 100% ) translateY( -"+this.cache.config.overlap+"px )",this.cache.config.contentTransformOrigin="50% 100%",this.cache.config.contentTransformOpened="translateY( -"+this.height/2+"px ) rotateX( "+-e+"deg )";break;default:this.cache.config.menuTransformOrigin="100% 50%",this.cache.config.menuTransformClosed="translateX( -100% ) translateX( "+this.cache.config.overlap+"px ) scale( 1.01 ) rotateY( "+-t+"deg )",this.cache.config.contentTransformOrigin="0 50%",this.cache.config.contentTransformOpened="translateX( "+this.width/2+"px ) rotateY( "+-e+"deg )"}}setupWrapper(){this.style({perspective:"800px",perspectiveOrigin:this.cache.config.contentTransformOrigin})}setupCover(){this.cover&&this.cover.element.parentNode.removeChild(this.cover.element),this.cover=new wi("div","div").style({position:"absolute",display:"block",width:"100%",height:"100%",left:0,top:0,zIndex:1e3,visibility:"hidden",opacity:0,transition:`all ${this.cache.config.transitionDuration} ${this.cache.config.transitionEasing}`}),this.content.element.appendChild(this.cover.element)}setupMenu(){switch(this.cache.config.position){case"top":this.controller.style({width:"100%",height:this.height/2+"px"});break;case"right":this.controller.style({right:0,width:this.width/2+"px",height:"100%"});break;case"bottom":this.controller.style({bottom:"0",width:"100%",height:this.height/2+"px"});break;case"left":this.controller.style({width:this.width/2+"px",height:"100%"})}this.controller.style({position:"fixed",display:"block",zIndex:1,transform:this.cache.config.menuTransformClosed,transformOrigin:this.cache.config.menuTransformOrigin,transition:"all "+this.cache.config.transitionDuration+" "+this.cache.config.transitionEasing})}setupContent(){this.content.style({transform:this.cache.config.contentTransformClosed,transformOrigin:this.cache.config.contentTransformOrigin,transition:`all ${this.cache.config.transitionDuration} ${this.cache.config.transitionEasing}`})}open(){this.cache.config.isOpen||(this.cache.config.isOpen=!0,this.cover.style({height:this.content.element.scrollHeight+"px",visibility:"visible",opacity:1}),this.cache.config.useTransfo&&this.content.style({transform:this.cache.config.contentTransformOpened,userSelect:"default"}),this.controller.style({transform:this.cache.config.menuTransformOpened,useSelect:"none"}),this.emit("opened"))}close(){this.cache.config.isOpen&&(this.cache.config.isOpen=!1,this.cover.style({visibility:"hidden",opacity:0}),this.content.style({transform:this.cache.config.contentTransformClosed,useSelect:"default"}),this.controller.style({transform:this.cache.config.menuTransformClosed,userSelect:"none"})),this.emit("closed")}onOpen(t){return this.on("opened",t.bind(this)),this}onClose(t){return this.on("closed",t.bind(this)),this}#v(t){if(this.cache.config.position!==t){this.cache.config.position=t;const e=this.isOpen;this.close(),this.update(),e&&this.open()}}useRight(){return this.#v("left"),this}useRight(){return this.#v("right"),this}useTop(){return this.#v("top"),this}useBottom(){return this.#v("bottom"),this}}const Zo=(t,e)=>new Do(t,e);globalThis.menu3d=Zo;class Lo extends vi{constructor(...t){super("dialog","modal"),this.append(...t),Object.assign(this.cache,{config:{mode:"modal",useTransition:!0}}),this.style({display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",padding:"20px",border:"none",backgroundCcolor:"#f5f5f5",boxShadow:"0px 4px 10px rgba(0, 0, 0, 0.1)",borderRadius:"8px"}),this.close()}open(){if(!this.element.open){if("modal"===this.cache.config.mode)this.element.showModal();else this.element.show();this.st.fadeIn(1e3),this.emit("modal:opened")}return this}close(){return this.st.fadeOut(1e3),this.element.open&&this.element.close(),this.emit("modal:closed"),this}closeAfter(t=1e3){return globalThis?.setTimeout((()=>this.close()),t),this}onOpen(t){return this.on("modal:opened",t.bind(this)),this}onClose(t){return this.on("modal:closed",t.bind(this)),this}useModal(){return this.cache.config.mode="modal",this}useDialog(){return this.cache.config.mode="dialog",this}useTransition(t=!0){return this.cache.config.useTransition=t,this}}const Po=(...t)=>new Lo(...t);class Uo extends zn{constructor(){super("section",""),Object.assign(this.cache,{currentIndex:0,slideBuilder:null}),this.container=ro().size("100%","100%").vertical(0,0).style({overflow:"hidden"}),this.container.setAttr({ariaRoledescription:"carousel",ariaLive:"polite",ariaLabel:"Content Slider"}),this.track=Bn().size("100%","100%").style({transition:"transform 0.3s ease-in-out"}),this.bullets=ro().style({gap:"10px",padding:"10px"}),this.container.append(this.track,this.bullets),this.append(this.container)}#x(){for(let t=0;t<this.track.items.length;t++)this.track[t].setAttr({ariaHidden:t!==this.cache.currentIndex})}goto(t=0){this.cache.currentIndex=t,this.__updatePos(),this.#x()}next(t=1){return this.cache.currentIndex+=t,this.__updatePos(),this.#x(),this}previous(t=1){return this.cache.currentIndex-=t,this.__updatePos(),this.#x(),this}#k(){const t=this.track.items.length;for(let e=0;e<t;e++)this.track.items[e].setAttr({ariaLabel:`Slide ${e+1} of ${t}`,dataSlideIndex:e}),this.bullets.items[e].setAttr({dataIndex:e,ariaLabel:`Go to slide ${e}`}),this.bullets[e].events.click?.destroy(),this.bullets[e].onClick((()=>this.goto(e)))}#_(t){this.track.append(this.cache.slideBuilder(t).setAttr({ariaRoledescription:"slide",role:"group",ariaLabel:""}));const e=Si().size("15px","15px").style({borderRadius:"50%",cursor:"pointer",border:"3px solid blue",background:"white"}).setAttr({role:"button",tabIndex:0}).onPtrEnter((t=>t.target.st.background("gold").scale(1.2,1.2))).onPtrLeave((t=>t.target.st.background("white").scale(1,1)));return this.bullets.append(e),this}addSlides(...t){return t.forEach((t=>this.#_(t))),this.#k(),this.#x(),this}}class Ro extends Uo{constructor(...t){super("section","hSlider"),this.container.vertical(0,0),Object.assign(this.cache,{slideBuilder:t=>ro(t).style({minWidth:"100%",width:"100%",height:"100%"}).vertical(0,0)}),this.track.size("100%","90%").style({display:"flex"}),this.addSlides(...t),this.bullets.horizontal(0,0).style({width:"100%",height:"10%"})}__updatePos(){const t=this.container.width;this.track.st.translateX(-this.cache.currentIndex*t)}}const zo=(...t)=>new Ro(...t);class $o extends Uo{constructor(...t){super("section","vSlider"),Object.assign(this.cache,{slideBuilder:t=>ro(t).size("100%","100%").vertical(0,0)}),this.addSlides(...t),this.container.horizontal(0,0),this.track.size("90%","100%"),this.bullets.vertical(0,0).style({height:"100%",width:"10%"})}__updatePos(){const t=this.container.height;this.track.st.translateY(-this.cache.currentIndex*t)}}const No=(...t)=>new $o(...t),Vo=({orintation:t="horizontal",slides:e=[]})=>["v","vertical"].includes(t.toLowerCase())?No(...e):["h","horizontal"].includes(t.toLowerCase())?zo(...e):void 0;const Bo={...Xi,...er,...Cn,...nn,...Ln,...Gn,...Wr,...Object.freeze({__proto__:null,Accordion:so,Breadcrumbs:jo,Carousel:co,CodeCell:fo,CodeNote:po,Collapsible:to,Flex:bn,Grid:Qn,Modal:Po,Slider:Vo,Splitter:Oo,Tabs:yo,ZikoUIAccordion:eo,ZikoUIBreadcrumbs:Mo,ZikoUICodeNote:uo,ZikoUIFlex:fn,ZikoUIGrid:Kn,ZikoUIHorizontalSlider:Ro,ZikoUIHorizontalSplitter:Io,ZikoUIMenu3d:Do,ZikoUIModal:Lo,ZikoUIVerticalSlider:$o,ZikoUIVerticalSplitter:Ao,dangerAlert:Co,hSlider:zo,hSplitter:To,infoAlert:ko,menu3d:Zo,successAlert:xo,vSlider:No,vSplitter:So,warningAlert:_o}),ZikoUIElement:wi,ZikoUIContainerElement:vi},Fo=t=>(new XMLSerializer).serializeToString(t),Ho=t=>btoa(Fo(t)),Wo=t=>"data:image/svg+xml;base64,"+Ho(t),Xo=(t,e=!0)=>Gr(Wo(t)).render(e),qo=t=>JSON.stringify(_((t=>["number","string","boolean","bigint"].includes(typeof t)?String(t):t instanceof ga||t instanceof ha?t.toString():t instanceof Array?Go(t):void 0),t),null," ").replace(/"([^"]+)":/g,"$1:").replace(/: "([^"]+)"/g,": $1"),Yo=t=>{if(!Array.isArray(t))return 0;let e=1;for(const s of t)if(Array.isArray(s)){const t=Yo(s);t+1>e&&(e=t+1)}return e},Go=t=>{let e=0;return function t(s){let i=Yo(s),r=0;return s.some((t=>Array.isArray(t)))&&(e++,r=1),"["+s.map(((i,r)=>["number","string","boolean","bigint"].includes(typeof i)?String(i):i instanceof ga?i.toString():i instanceof Array?`\n${" ".repeat(e)}${t(i)}${r===s.length-1?"\n":""}`:i instanceof Object?qo(i):void 0))+`${" ".repeat((i+e+1)*r)}]`}(t)},Ko=(t,e=0)=>{t=Qo(t);let s="";const i=" ".repeat(e);for(let r in t)if("object"==typeof t[r]){s+=`${i}${r} {\n`;const n=t[r];for(let t in n)"object"==typeof n[t]?s+=Ko({[t]:n[t]},e+1):s+=`${i} ${t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}: ${n[t]};\n`;s+=`${i}}\n`}return s};function Qo(t){return"object"!=typeof t||null===t?t:Object.keys(t).reduce(((e,s)=>(e[s.trim()]=Qo(t[s]),e)),Array.isArray(t)?[]:{})}var Jo=Object.freeze({__proto__:null,adoc2html:Dt,arr2str:Go,csv2arr:Zt,csv2json:Ut,csv2matrix:Lt,csv2object:Pt,csv2sql:Rt,json2arr:Nt,json2css:Ko,json2csv:Vt,json2csvFile:Bt,json2xml:qt,json2xmlFile:Yt,json2yml:Wt,json2ymlFile:Xt,markdown2html:It,obj2str:qo,svg2ascii:Ho,svg2img:Xo,svg2imgUrl:Wo,svg2str:Fo}),ta=Object.freeze({__proto__:null});const ea={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 sa{constructor(t){this.string=t}isDigit(){return ea.isDigit.test(this.string)}static isDigit(t){return new sa(t).isDigit()}isNumber(){return!isNaN(this.string)}static isNumber(t){return new sa(t).isNumber()}isUrl(){return ea.isURL.test(this.string)}static isUrl(t){return new sa(t).isUrl()}isHexColor(){return ea.isHexColor.test(this.string)}static isHexColor(t){return new sa(t).isHexColor()}isIPv4(){return ea.isIPv4.test(this.string)}static isIPv4(t){return new sa(t).isIPv4()}isDate(){return ea.isDate.test(this.string)}static isDate(t){return new sa(t).isDate()}isMACAddress(){return ea.isMACAddress.test(this.string)}static isMACAddress(t){return new sa(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 sa(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 sa(t).isCamelCase()}isHyphenCase(){return this.string.split("-").length>1}static isHyphenCase(t){return new sa(t).isHyphenCase()}isSnakeCase(){return this.string.split("_").length>1}static isSnakeCase(t){return new sa(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 sa(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 sa(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 ia=t=>t.replace(/\s+/g," "),ra=(t,e)=>t.split("").filter((t=>t==e)).length,na=(t,e)=>t.split(" ").filter((t=>t==e)).length,oa=t=>new sa(t);const aa={...xt,...Jo,...ta,...Object.freeze({__proto__:null,Str:sa,count:ra,countWords:na,removeExtraSpace:ia,str:oa})};class ha extends k{constructor(t,e,s=[]){if(super(),t instanceof ha)this.arr=t.arr,this.rows=t.rows,this.cols=t.cols;else{let i,r,n=[];if(arguments[0]instanceof Array)t=arguments[0].length,e=arguments[0][0].length,n=arguments[0];else for(i=0;i<t;i++)for(n.push([]),n[i].push(new Array(e)),r=0;r<e;r++)n[i][r]=s[i*e+r],null==s[i*e+r]&&(n[i][r]=0);this.rows=t,this.cols=e,this.arr=n}this._maintain()}toString(){return Go(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 ha(t,e,this.arr.flat(1));console.error("Err")}static eye(t){let e=new ha(t,t);for(let s=0;s<t;s++)for(let i=0;i<t;i++)e.arr[s][i]=s===i?1:0;return e}get clone(){return new ha(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 ha(this.cols,this.rows,this.arr.flat(1).reel)}get imag(){return new ha(this.cols,this.rows,this.arr.flat(1).imag)}_maintain(){for(let t=0;t<this.arr.length;t++)Object.assign(this,{[[t]]:this.arr[t]});return this}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==ha.sub(e,t).max&&0==ha.sub(e,t).min}get isAntiSym(){if(!this.isSquare)return!1;const t=this.T,e=this.clone;return 0==ha.add(e,t).max&&0==ha.add(e,t).min}get isDiag(){if(!this.isSquare)return!1;const t=this.T,e=this.clone,s=ha.mul(e,t),i=ha.dot(t,e);return 0==ha.sub(s,i).max&&0==ha.sub(s,i).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=ha.dot(t,t);return 0==ha.sub(e,t).max&&0==ha.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 ha(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 ha))?void console.warn("Tensors are not completely supported yet ..."):rt.sub(rt.mul(s[0][0],s[1][1]),rt.mul(s[0][1],s[1][0]));for(var i=0,r=0;r<s.length;r++){const n=rt.add(rt.mul(Ta(-1,r),rt.mul(s[0][r],e(t(s,r)))));i=rt.add(i,n)}return i}(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,i=0,r=t.length,n=0,o=[],a=[];for(e=0;e<r;e+=1)for(o[o.length]=[],a[a.length]=[],i=0;i<r;i+=1)o[e][i]=e==i?1:0,a[e][i]=t[e][i];for(e=0;e<r;e+=1){if(0==(n=a[e][e])){for(s=e+1;s<r;s+=1)if(0!=a[s][e]){for(i=0;i<r;i++)n=a[e][i],a[e][i]=a[s][i],a[s][i]=n,n=o[e][i],o[e][i]=o[s][i],o[s][i]=n;break}if(0==(n=a[e][e]))return}for(i=0;i<r;i++)a[e][i]=a[e][i]/n,o[e][i]=o[e][i]/n;for(s=0;s<r;s++)if(s!=e)for(n=a[s][e],i=0;i<r;i++)a[s][i]-=n*a[e][i],o[s][i]-=n*o[e][i]}return o}(this.arr);return new ha(this.rows,this.cols,t.flat(1))}static zeros(t,e){let s=new ha(t,e);for(let r=0;r<t;r++)for(var i=0;i<e;i++)s.arr[r][i]=0;return s}static ones(t,e){let s=new ha(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)s.arr[i][t]=1;return s}static nums(t,e,s){let i=new ha(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)i.arr[r][t]=s;return i}static get rand(){return{int:(t,e,s,i)=>{let r=new ha(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)r.arr[n][t]=dt.randInt(s,i);return r},bin:(t,e)=>{let s=new ha(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)s.arr[i][t]=dt.randBin;return s},hex:(t,e)=>{let s=new ha(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)s.arr[i][t]=dt.randHex;return s},choices:(t,e,s,i)=>{let r=new ha(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)r.arr[n][t]=dt.choice(s,i);return r},permutation:(t,e,s)=>{}}}static rands(t,e,s=1,i){let r=new ha(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)r.arr[n][t]=dt.rand(s,i);return r}map(t,e,s,i){return rt.map(this,t,e,s,i)}lerp(t,e){return rt.lerp(this,t,e)}norm(t,e){return rt.norm(this,t,e)}clamp(t,e){return rt.clamp(this,t,e)}static map(t,e,s,i,r){return rt.map(t,e,s,i,r)}static lerp(t,e,s){return rt.lerp(t,e,s)}static norm(t,e,s){return rt.norm(t,e,s)}static clamp(t,e,s){return rt.clamp(la,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 ha(this.rows,this.cols,t)}get toOct(){let t=this.arr.flat(1).toOct;return new ha(this.rows,this.cols,t)}get toHex(){let t=this.arr.flat(1).toHex;return new ha(this.rows,this.cols,t)}max2min(){let t=this.arr.flat(1).max2min;return new ha(this.rows,this.cols,t)}min2max(){let t=this.arr.flat(1).min2max;return new ha(this.rows,this.cols,t)}sortRows(t=void 0){let e=this.arr.map((e=>e.sort(t))).flat(1);return new ha(this.rows,this.cols,e)}sortCols(t=void 0){let e=this.T.arr.map((e=>e.sort(t))).flat(1);return new ha(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 ha(s)}filterByCols(t){return new ha(this.T.arr.filter((e=>e.includes(t))))}sortAll(t=void 0){let e=this.arr.flat(1).sort(t);return new ha(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 ha(this.rows,this.cols,e)}#C(t){if(this.rows!==t.rows)return;let e=this.arr;for(let s=0;s<this.rows;s++)for(let i=this.cols;i<this.cols+t.cols;i++)e[s][i]=t.arr[s][i-this.cols];return this.cols+=t.cols,new ha(this.rows,this.cols,e.flat(1))}hstack(...t){const e=[this,...t].reduce(((t,e)=>t.#C(e)));return Object.assign(this,e),this}static hstack(t,...e){return t.clone.hstack(...e)}#E(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 i=0;i<this.cols;i++)e[s][i]=t.arr[s-this.rows][i]}return this.rows+=t.rows,new ha(this.rows,this.cols,e.flat(1))}vstack(...t){const e=[this,...t].reduce(((t,e)=>t.#E(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.#C(e)));return Object.assign(this,e),this}vqueue(...t){const e=[this,...t].reverse().reduce(((t,e)=>t.#E(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,i=this.cols-1){let r=s-t,n=i-e,o=new Array(n);for(let s=0;s<r;s++){o[s]=[];for(let i=0;i<n;i++)o[s][i]=this.arr[s+t][i+e]}return new ha(r,n,o.flat(1))}static slice(t,e=0,s=0,i=this.rows-1,r=this.cols-1){return t.slice(e,s,i,r)}splice(t,e,s,...i){}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 ga)&&(t[s]=ha.nums(this.rows,this.cols,t[s]));for(let i=0;i<this.rows;i++)for(var e=0;e<this.cols;e++)this.arr[i][e]=rt.add(this.arr[i][e],t[s].arr[i][e])}return new ha(this.rows,this.cols,this.arr.flat(1))}sub(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=ha.nums(this.rows,this.cols,t[s]));for(let i=0;i<this.rows;i++)for(var e=0;e<this.cols;e++)this.arr[i][e]=rt.sub(this.arr[i][e],t[s].arr[i][e])}return new ha(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 i=0;i<t.length;i++){"number"==typeof t[i]&&(t[i]=ha.nums(this.rows,this.cols,t[i]));for(var e=0;e<this.rows;e++)for(var s=0;s<this.cols;s++)this.arr[e][s]=rt.mul(this.arr[e][s],t[i].arr[e][s])}return new ha(this.rows,this.cols,this.arr.flat(1))}div(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=ha.nums(this.rows,this.cols,t[s]));for(let i=0;i<this.rows;i++)for(var e=0;e<this.cols;e++)this.arr[i][e]=rt.div(this.arr[i][e],t[s].arr[i][e])}return new ha(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]=ha.nums(this.rows,this.cols,t[s]));for(let i=0;i<this.rows;i++)for(var e=0;e<this.cols;e++)this.arr[i][e]=rt.modulo(this.arr[i][e],t[s].arr[i][e])}return new ha(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 i=0;i<t.arr[0].length;i++){e[s][i]=0;for(var r=0;r<this.arr[0].length;r++)e[s][i]=rt.add(e[s][i],rt.mul(this.arr[s][r],t.arr[r][i]))}}return new ha(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 i=0;i<t-1;i++)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 ga))}get min(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(G(...this.arr[e]));return G(...t)}get max(){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 minRows(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(G(...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(K(...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 ha(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 ha(t.rows,t.cols);return e.arr=t.arr,e}DecompositionLU(){const[t,e]=mt(this);return{L:t,U:e}}static DecompositionLU(...t){const e=t.map((t=>t.clone.LU()));return 1===e.length?e[0]:e}DecompositionQR(){const[t,e]=yt(this);return{Q:t,R:e}}static DecompositionQR(...t){const e=t.map((t=>t.clone.DecompositionQr()));return 1===e.length?e[0]:e}DecompositionCholesky(){return{L:wt(this)}}static DecompositionCholesky(...t){const e=t.map((t=>t.clone.DecompositionCholesky()));return 1===e.length?e[0]:e}get decomposition(){return{LU:()=>this.DecompositionLU(),QR:()=>this.DecompositionQR(),Cholesky:()=>this.DecompositionCholesky()}}static get decomposition(){return{LU:(...t)=>ha.LU(...t),QR:(...t)=>ha.QR(...t),CHOLESKY:(...t)=>ha.CHOLESKY(...t)}}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 i=0;i<s[0].length;i++)s[t][i].innerHTML=this.arr[t][i],e[t].appendChild(s[t][i]);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 i=this.T.arr.map((t=>t.map(((t,e)=>Object.assign({},{x:t,y:e}))))),r=this.T.arr.map((t=>t.map(((t,e)=>Object.assign({},{x:t,y:e})))));"num"===e?"asc"===s?i[t].sort(((t,e)=>t.x-e.x)):"desc"===s?i[t].sort(((t,e)=>e.x-t.x)):"toggle"===s&&(i[t][0].x>i[t][1].x?i[t].sort(((t,e)=>e.x-t.x)):i[t].sort(((t,e)=>t.x-e.x))):"alpha"===e&&("asc"===s?i[t].sort(((t,e)=>(""+t.x).localeCompare(""+e.x))):"desc"===s&&i[t].sort(((t,e)=>(""+e.x).localeCompare(""+t.x)))),s=i[t].map((t=>t.y));for(let e=0;e<i.length;e++)e!==t&&i[e].map(((t,e)=>t.y=s[e]));for(let e=0;e<i.length;e++)e!==t&&r[e].map(((t,r)=>t.x=i[e][s[r]].x));r[t]=i[t];var n=r.map((t=>t.map((t=>t.x))));return new ha(n).T}}const la=(t,e,s)=>new ha(t,e,s),ca=(...t)=>new ha(2,2,t),ua=(...t)=>new ha(3,3,t),pa=(...t)=>new ha(4,4,t);class da{static resolve(t,e){return t.inv.dot(ha.fromVector(e)).arr.flat(1).map((t=>+t.toFixed(10)))}}var ma=Object.freeze({__proto__:null,LinearSystem:da,Matrix:ha,choleskyDecomposition:wt,luDecomposition:mt,matrix:la,matrix2:ca,matrix3:ua,matrix4:pa,qrDecomposition:yt});class ga extends k{constructor(t=0,e=0){super(),t instanceof ga?(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=Ia(t.z**2-t.a**2)):"a"in e&&"phi"in t?(this.a=t.a,this.b=t.a*Da(t.phi)):"b"in e&&"z"in t?(this.b=t.b,this.a=Ia(t.z**2-t.b**2)):"b"in e&&"phi"in t?(this.b=e,this.a=t.b/Da(t.phi)):"z"in e&&"phi"in t&&(this.a=t.z*Ma(t.phi),this.a=t.z*ja(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 ga(this.a,this.b)}get z(){return sh(this.a,this.b)}get phi(){return Qa(this.b,this.a)}static Zero(){return new ga(0,0)}get conj(){return new ga(this.a,-this.b)}get inv(){return new ga(this.a/(Ta(this.a,2)+Ta(this.b,2)),-this.b/(Ta(this.a,2)+Ta(this.b,2)))}add(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new ga(t[e],0));let e=t.map((t=>t.a)),s=t.map((t=>t.b));return this.a+=+q(...e).toFixed(15),this.b+=+q(...s).toFixed(15),this}sub(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new ga(t[e],0));let e=t.map((t=>t.a)),s=t.map((t=>t.b));return this.a-=+q(...e).toFixed(15),this.b-=+q(...s).toFixed(15),this}mul(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new ga(t[e],0));let e=+Y(this.z,...t.map((t=>t.z))).toFixed(15),s=+q(this.phi,...t.map((t=>t.phi))).toFixed(15);return this.a=+(e*Ma(s).toFixed(15)).toFixed(14),this.b=+(e*ja(s).toFixed(15)).toFixed(14),this}div(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new ga(t[e],0));let e=+(this.z/Y(...t.map((t=>t.z)))).toFixed(15),s=+(this.phi-q(...t.map((t=>t.phi)))).toFixed(15);return this.a=+(e*Ma(s).toFixed(15)).toFixed(15),this.b=+(e*ja(s).toFixed(15)).toFixed(15),this}pow(t){if(Ga(t)===t&&t>0){let e=+(this.z**t).toFixed(15),s=+(this.phi*t).toFixed(15);this.a=+(e*Ma(s).toFixed(15)).toFixed(15),this.b=+(e*ja(s).toFixed(15)).toFixed(15)}return this}static fromExpo(t,e){return new ga(+(t*Ma(e)).toFixed(13),+(t*ja(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 fa(t**this.a*Ma(this.b*Oa(t)),t**this.a*ja(this.b*Oa(t)))}sqrtn(t=2){return fa(Aa(this.z,t)*Ma(this.phi/t),Aa(this.z,t)*ja(this.phi/t))}get sqrt(){return this.sqrtn(2)}get log(){return fa(this.z,this.phi)}get cos(){return fa(Ma(this.a)*Va(this.b),ja(this.a)*Ba(this.b))}get sin(){return fa(ja(this.a)*Va(this.b),Ma(this.a)*Ba(this.b))}get tan(){const t=Ma(2*this.a)+Va(2*this.b);return fa(ja(2*this.a)/t,Ba(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 fa=(t,e)=>{if((t instanceof Array||ArrayBuffer.isView(t))&&(e instanceof Array||ArrayBuffer.isView(t)))return t.map(((s,i)=>fa(t[i],e[i])));if(t instanceof ha&&e instanceof ha){if(t.shape[0]!==e.shape[0]||t.shape[1]!==e.shape[1])return Error(0);const s=t.arr.map(((s,i)=>fa(t.arr[i],e.arr[i])));return new ha(t.rows,t.cols,...s)}return new ga(t,e)};var ba=Object.freeze({__proto__:null,Complex:ga,complex:fa});const ya=t=>{const e=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7];if(t<.5)return+(Math.PI/(Math.sin(Math.PI*t)*ya(1-t))).toFixed(10);t-=1;let s=e[0];for(let i=1;i<9;i++)s+=e[i]/(t+i);const i=t+7+.5;return+(Math.sqrt(2*Math.PI)*Math.pow(i,t+.5)*Math.exp(-i)*s).toFixed(10)},wa=(...t)=>_(ya,...t),va=(t,e)=>{let s=0;for(let i=0;i<100;i++){s+=Math.pow(-1,i)*Math.pow(e/2,t+2*i)/(Ja(i)*Ja(t+i))}return s},xa=(t,e)=>{if("number"==typeof t){if("number"==typeof t)return va(t,e);console.warn("Not supported yet")}else if(t instanceof Array){if("number"==typeof e)return _((t=>va(t,e)),...t);if(e instanceof Array){const s=[];for(let i=0;i<t.length;i++)s.push(_((e=>va(t[i],e)),...e));return s}}},ka=(t,e)=>{let s=0;const i=s=>Math.pow(s,t-1)*Math.pow(1-s,e-1);s+=.5*(i(0)+i(1));for(let t=1;t<1e3;t++){s+=i(0+.001*t)}return.001*s},_a=(t,e)=>{if("number"==typeof t){if("number"==typeof t)return ka(t,e);console.warn("Not supported yet")}else if(t instanceof Array){if("number"==typeof e)return _((t=>ka(t,e)),...t);if(e instanceof Array){const s=[];for(let i=0;i<t.length;i++)s.push(_((e=>ka(t[i],e)),...e));return s}}};var Ca=Object.freeze({__proto__:null,bessel:xa,beta:_a,gamma:wa});const Ea=(...t)=>_(Math.abs,...t),Ia=(...t)=>_(Math.sqrt,...t),Ta=(t,e)=>{if("number"==typeof t)return"number"==typeof e?Math.pow(t,e):e instanceof ga?ga.fromExpo(t**e.a,e.b*Oa(t)):_((e=>Ta(t,e)),...e);if(t instanceof ga)return"number"==typeof e?ga.fromExpo(t.z**e,t.phi*e):e instanceof ga?ga.fromExpo(t.z**e.a*Sa(-t.phi*e.b),Oa(t.z)*e.b+e.a*t.phi):_((e=>Ta(t,e)),...e);if(t instanceof Array){if("number"==typeof e)return _((t=>Ta(t,e)),...t);if(e instanceof Array){const s=[];for(let i=0;i<t.length;i++)s.push(_((e=>Ta(t[i],e)),...e));return s}}},Aa=(t,e)=>{if("number"==typeof t)return"number"==typeof e?Math.pow(t,1/e):_((e=>Aa(t,e)),...e);if(t instanceof ga)return"number"==typeof e?ga.fromExpo(Aa(t.z,e),t.phi/e):_((e=>Aa(t,e)),...e);if(t instanceof Array){if("number"==typeof e)return _((t=>Aa(t,e)),...t);if(e instanceof Array){const s=[];for(let i=0;i<t.length;i++)s.push(_((e=>Aa(t[i],e)),...e));return s}}},Sa=(...t)=>_(Math.exp,...t),Oa=(...t)=>_(Math.log,...t),Ma=(...t)=>_(x.cos,...t),ja=(...t)=>_(x.sin,...t),Da=(...t)=>_(x.tan,...t),Za=(...t)=>_(x.sec,...t),La=(...t)=>_(x.sinc,...t),Pa=(...t)=>_(x.csc,...t),Ua=(...t)=>_(x.cot,...t),Ra=(...t)=>_(x.acos,...t),za=(...t)=>_(x.asin,...t),$a=(...t)=>_(x.atan,...t),Na=(...t)=>_(x.acot,...t),Va=(...t)=>_(x.cosh,...t),Ba=(...t)=>_(x.sinh,...t),Fa=(...t)=>_(x.tanh,...t),Ha=(...t)=>_(x.coth,...t),Wa=(...t)=>_(x.acosh,...t),Xa=(...t)=>_(x.asinh,...t),qa=(...t)=>_(x.atanh,...t),Ya=(...t)=>_(Math.ceil,...t),Ga=(...t)=>_(Math.floor,...t),Ka=(...t)=>_(Math.round,...t),Qa=(t,e,s=!0)=>{if("number"==typeof t)return"number"==typeof e?s?Math.atan2(t,e):180*Math.atan2(t,e)/Math.PI:_((e=>Qa(t,e,s)),...e);if(t instanceof Array){if("number"==typeof e)return _((t=>Qa(t,e,s)),...t);if(e instanceof Array){const s=[];for(let i=0;i<t.length;i++)s.push(_((e=>Ta(t[i],e)),...e));return s}}},Ja=(...t)=>_((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),th=(...t)=>_(Math.sign,...t),eh=(...t)=>_((t=>1/(1+Sa(-t))),...t),sh=(...t)=>t.every((t=>"number"==typeof t))?Math.hypot(...t):t.every((t=>t instanceof Array))?_(Math.hypot,...t):void 0;const ih={...r,...Object.freeze({__proto__:null,abs:Ea,acos:Ra,acosh:Wa,acot:Na,asin:za,asinh:Xa,atan:$a,atan2:Qa,atanh:qa,bessel:xa,beta:_a,ceil:Ya,cos:Ma,cosh:Va,cot:Ua,coth:Ha,csc:Pa,e:Sa,fact:Ja,floor:Ga,gamma:wa,hypot:sh,ln:Oa,max:K,min:G,pow:Ta,round:Ka,sec:Za,sig:eh,sign:th,sin:ja,sinc:La,sinh:Ba,sqrt:Ia,sqrtn:Aa,tan:Da,tanh:Fa}),...ba,...ma,...nt,...pt,...Ca};class rh extends vi{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,i){let r=Math.abs(s-t),n=Math.abs(i-e);return this.setAttr("viewBox",[t,e,r,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 nh=(t,e)=>new rh(t,e);class oh extends wi{constructor(t){super(),Object.assign(this.cache,{type:t})}pos(t,e){return this.posX(t).posY(e)}posX(t){return["circle","ellipse"].includes(this.cache.type)?this.element.cx.baseVal.value=t:this.element.x.baseVal.value=t,this}posY(t){return["circle","ellipse"].includes(this.cache.type)?this.element.cy.baseVal.value=t:this.element.y.baseVal.value=t,this}translate(t,e){return this}color({stroke:t,fill:e}){return this.element?.setAttribute("stroke",t),this.element?.setAttribute("fill",e),this}fill(t="none"){return this.element?.setAttribute("fill",t),this}stroke(t="none",e){return this.element?.setAttribute("stroke",t),e&&this.strokeWidth(e),this}strokeWidth(t=1){return this.element?.setAttribute("stroke-width",t),this}opacity(t=1){return this.element?.setAttribute("opacity",t),this}}class ah extends oh{constructor(t,e,s){super("circle"),this.element=document.createElementNS("http://www.w3.org/2000/svg","circle"),this.pos(t,e).setR(s)}setR(t){return this.element.r.baseVal.value=t,this}get r(){return this.element.baseVal.value}get cx(){return this.element.baseVal.value}get cy(){return this.element.baseVal.value}}const hh=(t,e,s)=>new ah(t,e,s);class lh extends oh{constructor(t,e,s,i){super("ellipse"),this.element=document?.createElementNS("http://www.w3.org/2000/svg","ellipse"),this.pos(t,e).setRx(s).setRy(i)}setRx(t){return this.element.rx.baseVal.value=t,this}setRy(t){return this.element.ry.baseVal.value=t,this}}const ch=(t,e,s,i)=>new lh(t,e,s,i);class uh extends oh{constructor(t=0,e=0,s="100%",i="100%",...r){super("foreignObject"),this.items=[],this.element=document?.createElementNS("http://www.w3.org/2000/svg","foreignObject"),this.container=bn().setTarget(this.element).vertical(0,0).size("auto","auto"),this.container.st.scaleY(-1),this.posX(t).posY(e).width(s).height(i)}width(t){return this.element.etAttribute("width",t),this}height(t){return this.element.etAttribute("height",t),this}add(...t){return this.container.append(...t),this}remove(...t){return this.container.append(...t),this}}const ph=(t,e,s,i)=>new uh(t,e,s,i);class dh extends oh{constructor(...t){super(),this.items=[],this.element=document?.createElementNS("http://www.w3.org/2000/svg","g"),this.add(...t)}add(...t){for(let e=0;e<t.length;e++)this.element?.appendChild(t[e].element),this.items.push(t[e]);return 1===t.length?t[0]:t}remove(...t){for(let e=0;e<t.length;e++)this.element?.removeChild(t[e].element),this.items=this.items.filter((e=>e!=t));return this}}const mh=(...t)=>new dh(...t);class gh extends oh{constructor(t="",e="100%",s="100%",i=0,r=0){super(),this.element=document?.createElementNS("http://www.w3.org/2000/svg","image"),this.setSrc(t).width(e).height(s).x(i).y(r)}x(t){return this.element.x.baseVal.value=t,this}y(t){return this.element.y.baseVal.value=t,this}width(t){return this.element?.setAttribute("width",t),this}height(t){return this.element?.setAttribute("height",t),this}setSrc(t=""){return this.element?.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t),this}}const fh=(t,e,s,i,r)=>new gh(t,e,s,i,r);class bh extends oh{constructor(t,e,s,i){super(),this.element=document?.createElementNS("http://www.w3.org/2000/svg","line"),this.x1(t).y1(e).x2(s).y2(i).stroke("black")}x1(t){return this.element.x1.baseVal.value=t,this}y1(t){return this.element.y1.baseVal.value=t,this}x2(t){return this.element.x2.baseVal.value=t,this}y2(t){return this.element.y2.baseVal.value=t,this}}const yh=(t,e,s,i)=>new bh(t,e,s,i);class wh extends oh{constructor(t,...e){super(),this.items=[],this.element=document?.createElementNS("http://www.w3.org/2000/svg","a"),this.element.etAttribute("href",t),this.add(...e)}add(...t){for(let e=0;e<t.length;e++)this.element.ppendChild(t[e].element),this.items.push(t[e]);return 1===t.length?t[0]:t}remove(...t){for(let e=0;e<t.length;e++)this.element.moveChild(t[e].element),this.items=this.items.filter((e=>e!=t));return this}}const vh=(t,...e)=>new wh(t,...e);class xh extends oh{constructor(){super(),this.element=document?.createElementNS("http://www.w3.org/2000/svg","path"),this.path=""}setPath(){return this.element.etAttribute("d",this.path),this}clear(){return this.path="",this.setPath(),this}moveTo(t,e){return this.path+=`M${t} ${e} `,this.setPath(),this}lineTo(t,e){return this.path+=`L${t} ${e} `,this.setPath(),this}hr(t){return this.path+=`H${t} `,this.setPath(),this}vr(t){return this.path+=`V${t} `,this.setPath(),this}bezier(t,e,s,i,r,n){return this.path+=`C ${t} ${e},${s} ${i},${r} ${n} `,this.setPath(),this}quadratic(t,e,s,i){return this.path+=`Q ${t} ${e} ${s} ${i} `,this.setPath(),this}close(){return this.path+="Z",this.setPath(),this}}const kh=()=>new xh;class _h extends oh{constructor(t=[],e=[]){super(),this.X=t,this.Y=e,this.element=document?.createElementNS("http://www.w3.org/2000/svg","polygon"),this.element?.setAttribute("points",""),this.addPoints(t,e)}addPoint(t,e){let s=this.element.parentElement.createSVGPoint();return s.x=t,s.y=e,this.element.points.appendItem(s),this}addPoints(t,e){for(let s=0;s<t.length;s++){let i=this.element.parentElement.createSVGPoint();i.x=t[s],i.y=e[s],this.element.oints.appendItem(i)}return this}}const Ch=(t,e)=>new _h(t,e);class Eh extends oh{constructor(t,e,s,i,r=!0){super(),this.element=document?.createElementNS("http://www.w3.org/2000/svg","rect"),this.setX(t).setY(e).width(s).height(i),this.rx=this.x+this.w/2,this.ty=this.y+this.h/2}setX(t){return this.element.x.baseVal.value=t,this.x=t,this}setY(t){return this.element.y.baseVal.value=t,this.y=t,this}r(t,e){return this.rx=t,this.ry=e,this.setX(this.rx-this.w/2),this.setY(this.ry-this.h/2),this}width(t){return this.element.width.baseVal.value=t,this.w=t,this}height(t){return this.element.height.baseVal.value=t,this.h=t,this}}const Ih=(t,e,s,i,r)=>new Eh(t,e,s,i,r);class Th extends oh{constructor(t,e,s){super(),this.element=document?.createElementNS("http://www.w3.org/2000/svg","text"),this.setText(t),this.x(e).y(s)}x(t){return this.element?.setAttribute("x",t),this}y(t){return this.element?.setAttribute("y",t),this}setText(t=""){return this.element.textContent=t,this}}const Ah=(t,e,s)=>new Th(t,e,s),Sh=(t,e,s=10,i=10)=>{let r=kh().fill("none").stroke("coral").strokeWidth(.6);console.log({x:t/s,y:e/i});for(let e=0;e<t;e++)r.moveTo(0,e*t/s).hr(t);for(let t=0;t<e;t++)r.moveTo(t*e/i,0).vr(e);return r};var Oh=Object.freeze({__proto__:null,Svg:nh,ZikoSvgCircle:ah,ZikoSvgEllipse:lh,ZikoSvgForeignObject:uh,ZikoSvgGroupe:dh,ZikoSvgImage:gh,ZikoSvgLine:bh,ZikoSvgLink:wh,ZikoSvgPath:xh,ZikoSvgRectangle:Eh,ZikoSvgText:Th,ZikoUISvg:rh,svgCircle:hh,svgEllipse:ch,svgGrid:Sh,svgGroupe:mh,svgImage:fh,svgLine:yh,svgLink:vh,svgObject:ph,svgPath:kh,svgPolygon:Ch,svgRect:Ih,svgText:Ah});class Mh extends vi{constructor(t,e){super("canvas","canvas"),this.ctx=this.element?.getContext("2d"),this.style({border:"1px red solid"}),this.transformMatrix=new ha([[1,0,0],[0,1,0],[0,0,1]]),this.axisMatrix=new ha([[-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,i){return this.transformMatrix[0][0]=this.width/(s-t),this.transformMatrix[1][1]=-this.height/(i-e),this.transformMatrix[0][2]=this.width/2,this.transformMatrix[1][2]=this.height/2,this.axisMatrix=new ha([[t,e],[s,i]]),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,i=this.height){return this.ctx.getImageData(t,e,s,i)}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 Mh;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 jh=(t,e)=>new Mh(t,e);class Dh{constructor(t,e){this.parent=null,this.position={x:t,y:e},this.cache={interact:null,config:{draggable:!1,selected:!1,highlighted:!1,rendered:!1},style:{normal:{strokeEnabled:!0,fillEnabled:!1,strokeColor:"#111111",fillColor:"#777777"},highlighted:{strokeEnabled:!0,fillEnabled:!1,strokeColor:null,fillColor:null}}},this.history={position:[],styles:[]},this.render()}get px(){return(this.position.x??0)+(this.parent?.position?.x??0)}get py(){return(this.position.y??0)+(this.parent?.position?.y??0)}isIntersectedWith(){}isInStroke(t,e){let s;return this.parent&&(this.parent.ctx.setTransform(1,0,0,1,0,0),s=this.parent.ctx.isPointInStroke(this.path,t,e),this.parent.applyTransformMatrix()),s}isInPath(t,e){let s;return this.parent&&(this.parent.ctx.setTransform(1,0,0,1,0,0),s=this.parent.ctx.isPointInPath(this.path,t,e),this.parent.applyTransformMatrix()),s}posX(t){return this.position.x=t,this.parent&&this.parent.draw(),this}posY(t){return this.position.y=t,this.parent&&this.parent.draw(),this}color({stroke:t=this.cache.style.normal.strokeColor,fill:e=this.cache.style.normal.fillColor}={stroke:t,fill:e}){return this.cache.style.normal.strokeColor=t,this.cache.style.normal.fillColor=e,this.parent&&this.parent.draw(),this}translate(t=0,e=0){this.position.x+=t,this.position.y+=e,this.parent&&this.parent.draw()}applyNormalStyle(t){return t.strokeStyle=this.cache.style.normal.strokeColor,t.fillStyle=this.cache.style.normal.fillColor,this}applyHighlightedStyle(t){return t.strokeStyle=this.cache.style.highlighted.strokeColor,t.fillStyle=this.cache.style.highlighted.fillColor,this}stroke(t=this.cache.style.normal.strokeColor,e=!0){return this.cache.style.normal.strokeEnabled=e,this.cache.style.normal.strokeColor=t,this.parent&&this.parent.draw(),this}fill(t=this.cache.style.normal.fillColor,e=!0){return this.cache.style.normal.fillEnabled=e,this.cache.style.normal.filleColor=t,this.parent&&this.parent.draw(),this}render(t=!0){return this.cache.config.rendered=t,this}}class Zh extends Dh{constructor(t,e,s,i){super(t,e),this.r=s,this.angle=i,this.path=null}draw(t){if(this.cache.config.rendered){t.save(),this.applyNormalStyle(t),t.beginPath(),this.path=new Path2D,this.path.arc(this.px,this.py,this.r,0,this.angle);const{strokeEnabled:e,fillEnabled:s}=this.cache.style.normal;e&&t.stroke(this.path),s&&t.fill(this.path),t.closePath(),t.restore()}return this}radius(t){return this.r=t,this.parent&&this.parent.draw(),this}}const Lh=(t,e,s,i)=>new Zh(t,e,s,i),Ph=(t,e,s)=>new Zh(t,e,s,2*Math.PI);class Uh extends Dh{constructor(t,e){super(),this.pointsMatrix=null,this.path=new Path2D,this.fromXY(t,e)}get points(){return this.pointsMatrix.T.arr}draw(t){if(this.cache.config.rendered){t.save(),this.applyNormalStyle(t),t.beginPath(),this.path.moveTo(this.points[1][0]+this._x,this.points[1][1]+this._y);for(let t=1;t<this.points.length;t++)this.path.lineTo(this.points[t][0]+this._x,this.points[t][1]+this._y);t.stroke(this.path),t.restore()}return this}fromXY(t,e){return this.pointsMatrix=la([t,e]),this}push(t,e){return this.pointsMatrix.hstack(la([t,e])),this.parent&&this.parent.draw(),this}isIn(t,e){let s;return this.parent&&(this.parent.ctx.setTransform(1,0,0,1,0,0),s=this.parent.ctx.isPointInPath(this.path,t,e),this.parent.applyTransformMatrix()),s}}const Rh=(t=[],e=[])=>new Uh(t,e);class zh extends Dh{constructor(t,e,s,i){super(),this.x0=t,this.x1=s,this.y0=e,this.y1=i,delete this.fill}draw(t){return this.cache.config.rendered&&(t.save(),this.applyNormalStyle(t),t.beginPath(),t.moveTo(this.x0+this._x,this.y0+this._y_),t.lineTo(this.x1+this._x,this.y1+this._y),t.stroke(),this.cache.style.normal.strokeEnabled&&t.stroke(),t.restore()),this}}const $h=(t,e,s,i)=>new zh(t,e,s,i);class Nh extends Dh{constructor(t,e,s,i){super(t,e),this.w=s,this.h=i,this.path=new Path2D}draw(t){if(this.cache.config.rendered){t.save(),this.applyNormalStyle(t),t.beginPath(),this.path.rect(this.px,this.py,this.w,this.h);const{strokeEnabled:e,fillEnabled:s}=this.cache.style.normal;e&&t.stroke(this.path),s&&t.fill(this.path),t.closePath(),t.restore()}return this}width(t){return this.w=t,this.parent&&this.parent.draw(),this}height(t){return this.h=t,this.parent&&this.parent.draw(),this}}const Vh=(t,e,s,i)=>new Nh(t,e,s,i);const Bh={...Oh,...Object.freeze({__proto__:null,Canvas:jh,ZikoUICanvas:Mh,canvasArc:Lh,canvasCircle:Ph,canvasLine:$h,canvasPoints:Rh,canvasRect:Vh})};class Fh{constructor(t,e=!0){this.#r(),this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}#r(){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=Ns(),this}}class Hh{constructor({viewport:t,charset:e,description:s,author:i,keywords:r}){this.document=globalThis?.document,this.meta={},this.init({viewport:t,charset:e,description:s,author:i,keywords:r})}init({viewport:t,charset:e,description:s,author:i,keywords:r}){t&&this.setViewport(t),e&&this.setCharset(e),s&&this.describe(s),i&&this.setAuthor(i),r&&this.setKeywords(r)}set(t,e){const s="charset"===(t=t.toLowerCase()),i=s?document.querySelector("meta[charset]"):document.querySelector(`meta[name=${t}]`);return this.meta=i??document?.createElement("meta"),s?this.meta.setAttribute("charset",e):(this.meta.setAttribute("name",t),this.meta.setAttribute("content",e)),i||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 Wh{constructor(t=document.title,e=!0){this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}useEventEmitter(){return this.cache.Emitter=Ns(),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 Xh{constructor({title:t,lang:e,icon:s,meta:i,noscript:r}){this.html=globalThis?.document?.documentElement,this.head=globalThis?.document?.head,t&&((t,e)=>{new Wh(t,e)})(t),e&&this.setLang(e),s&&((t,e)=>{new Fh(t,e)})(s),i&&(({viewport:t,charset:e,description:s,author:i,keywords:r})=>{new Hh({viewport:t,charset:e,description:s,author:i,keywords:r})})(i),r&&this.setNoScript()}setLang(t){this.html.setAttribute("lang",t)}setNoScript(t){}}class qh{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 Xh?t:(({title:t,lang:e,icon:s,meta:i,noscript:r})=>new Xh({title:t,lang:e,icon:s,meta:i,noscript:r}))(t),this}}const Yh=({head:t,wrapper:e,target:s})=>new qh({head:t,wrapper:e,target:s});var Gh=Object.freeze({__proto__:null,App:Yh,ZikoApp:qh});class Kh{constructor(t={}){this.cache={JsonStyle:t,isRenderd:!1},this.target=globalThis?.document?.head,this.element=document.createElement("style"),this.element.setAttribute("data-generator","zikojs"),this.write(),this.render()}get CssText(){return Ko(this.cache.JsonStyle)}render(){return this.target.append(this.element),this.cache.isRenderd=!0,this}unrender(){return this.target?.children?.length&&[...this.target?.children].includes(this.element)&&this.target.removeChild(this.element),this.cache.isRenderd=!1,this}write(){return this.element.textContent=this.CssText,this}style(t,e=!1){return e&&this.clear(),Object.assign(this.cache.JsonStyle,t),this.write(),this}clear(){return this.cache.JsonStyle={},this.write(),this}}const Qh=t=>new Kh(t);var Jh=Object.freeze({__proto__:null,ZikoJsonStyleSheet:Kh,jsonStyleSheet:Qh});function tl(t){return/:\w+/.test(t)}class el extends qh{constructor({head:t,wrapper:e,target:s,routes:i}){super({head:t,wrapper:e,target:s}),this.routes=new Map([["404",Si("Error 404")],...Object.entries(i)]),this.clear(),globalThis.onpopstate=this.render(location.pathname)}clear(){return[...this.routes].forEach((t=>{!tl(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("/"),i=e.split("/");if(s.length!==i.length)return!1;for(let t=0;t<s.length;t++){const e=s[t],r=i[t];if(!e.startsWith(":")&&e!==r)return!1}return!0}(e[0],t)));let i;if(tl(e)){const r=function(t,e){const s=t.split("/"),i=e.split("/"),r={};if(s.length!==i.length)return r;for(let t=0;t<s.length;t++){const e=s[t],n=i[t];if(e.startsWith(":"))r[e.slice(1)]=n;else if(e!==n)return{}}return r}(e,t);i=s.call(this,r)}else s?.isZikoUIElement&&s.render(this.wrapper),"function"==typeof s&&(i=s());return i?.isZikoUIElement&&i.render(this.wrapper),i instanceof Promise&&i.then((t=>t.render(this.wrapper))),globalThis.history.pushState({},"",t),this}}const sl=({head:t,wrapper:e,target:s,routes:i})=>new el({head:t,wrapper:e,target:s,routes:i});function il(t){Object.defineProperties(t,{QueryParams:{get:function(){return function(t){const e={};return t.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi,(t=>{const[s,i]=t.split("=");e[s]=i})),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 rl={},nl={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:()=>document.documentElement.setAttribute("data-engine","zikojs")};function ol(t,e="./src/pages",s=["js","ts"]){"/"===e.at(-1)&&(e=e.slice(0,-1));const i=t.replace(/\\/g,"/").replace(/\[(\w+)\]/g,"$1/:$1").split("/"),r=e.split("/"),n=i.indexOf(r[r.length-1]);if(-1!==n){const t=i.slice(n+1),e=t[t.length-1],r="index.js"===e||"index.ts"===e,o=s.some((t=>e===`.${t}`||e.endsWith(`.${t}`)));if(r)return"/"+(t.length>1?t.slice(0,-1).join("/"):"");if(o)return"/"+t.join("/").replace(/\.(js|ts)$/,"")}return""}const al={...Gh,...Jh,...Object.freeze({__proto__:null,SPA:sl,ZikoSPA:el}),...Object.freeze({__proto__:null,__Config__:nl,__UI__:rl})};[al,ih,Bo,zs,aa,yi,Bh].forEach((t=>Object.assign(t,{ExtractAll:()=>(t=>{const e=Object.keys(t);for(let s=0;s<e.length;s++){const i=e[s];["__ExtractAll__","__RemoveAll__","ExtractAll","RemoveAll"].includes(i)||(globalThis[i]=t[i])}})(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 hl={App:al,Math:ih,UI:Bo,Time:zs,Data:aa,Reactivity:yi,Graphics:Bh};globalThis.__Ziko__?console.warn("WARNING: Multiple instances of Ziko.js being imported."):(globalThis.__Ziko__={...hl,__UI__:rl,__Config__:nl,ExtractAll:function(){return Bo.ExtractAll(),ih.ExtractAll(),zs.ExtractAll(),yi.ExtractAll(),Bh.ExtractAll(),aa.ExtractAll(),this},RemoveAll:function(){Bo.RemoveAll(),ih.RemoveAll(),zs.RemoveAll(),yi.RemoveAll(),Bh.RemoveAll(),aa.RemoveAll()}},il(__Ziko__)),globalThis?.document&&document?.addEventListener("DOMContentLoaded",__Ziko__.__Config__.init()),t.Accordion=so,t.App=Yh,t.Article=Fn,t.Aside=Yn,t.Base=at,t.Breadcrumbs=jo,t.Canvas=jh,t.Carousel=co,t.CodeCell=fo,t.CodeNote=po,t.Collapsible=to,t.Combinaison=ct,t.Complex=ga,t.E=s,t.EPSILON=i,t.Ease=Ss,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 i=[];for(let t=0;t<s;t++){const s=e[0][t];if(!e.every((e=>e[t]===s||e[t].startsWith("["))))break;i.push(s)}return i.join("/")+(i.length?"/":"")}(e),i={};for(let r=0;r<e.length;r++){const n=await t[e[r]](),o=await n.default;Object.assign(i,{[ol(e[r],s)]:o})}return sl({target:document.body,routes:{"/":()=>{},...i},wrapper:Bn()})},t.Flex=bn,t.Footer=Xn,t.Form=_n,t.Grid=Qn,t.HTMLWrapper=Sr,t.Header=Wn,t.LinearSystem=da,t.Logic=ht,t.Main=Hn,t.Matrix=ha,t.Modal=Po,t.Nav=qn,t.PI=e,t.Permutation=lt,t.Random=dt,t.SPA=sl,t.SVGWrapper=Or,t.Section=Bn,t.Slider=Vo,t.Splitter=Oo,t.Str=sa,t.Suspense=jr,t.Svg=nh,t.Table=Zn,t.Tabs=yo,t.Utils=rt,t.ZikoApp=qh,t.ZikoCustomEvent=is,t.ZikoEvent=te,t.ZikoEventClick=ie,t.ZikoEventClipboard=Be,t.ZikoEventHash=ts,t.ZikoEventInput=Ke,t.ZikoEventKey=Se,t.ZikoEventMouse=me,t.ZikoEventPointer=pe,t.ZikoEventSwipe=ns,t.ZikoEventWheel=Ce,t.ZikoHead=qs,t.ZikoJsonStyleSheet=Kh,t.ZikoMutationObserver=ls,t.ZikoSPA=el,t.ZikoSvgCircle=ah,t.ZikoSvgEllipse=lh,t.ZikoSvgForeignObject=uh,t.ZikoSvgGroupe=dh,t.ZikoSvgImage=gh,t.ZikoSvgLine=bh,t.ZikoSvgLink=wh,t.ZikoSvgPath=xh,t.ZikoSvgRectangle=Eh,t.ZikoSvgText=Th,t.ZikoUIAbbrText=Ai,t.ZikoUIAccordion=eo,t.ZikoUIArticle=$n,t.ZikoUIAside=Nn,t.ZikoUIAudio=sn,t.ZikoUIBlockQuote=Ui,t.ZikoUIBr=Pr,t.ZikoUIBreadcrumbs=Mo,t.ZikoUICanvas=Mh,t.ZikoUICodeNote=uo,t.ZikoUICodeText=Ti,t.ZikoUIContainerElement=vi,t.ZikoUIDefintion=Ci,t.ZikoUIElement=wi,t.ZikoUIFigure=Kr,t.ZikoUIFlex=fn,t.ZikoUIFooter=Vn,t.ZikoUIForm=kn,t.ZikoUIGrid=Kn,t.ZikoUIHTMLWrapper=Tr,t.ZikoUIHeader=Un,t.ZikoUIHeading=$i,t.ZikoUIHorizontalSlider=Ro,t.ZikoUIHorizontalSplitter=Io,t.ZikoUIHr=Ur,t.ZikoUIHtmlTag=Zr,t.ZikoUIImage=Yr,t.ZikoUIInput=sr,t.ZikoUIInputCheckbox=pr,t.ZikoUIInputColor=hr,t.ZikoUIInputDatalist=cn,t.ZikoUIInputDate=vr,t.ZikoUIInputDateTime=Cr,t.ZikoUIInputEmail=fr,t.ZikoUIInputImage=Xr,t.ZikoUIInputNumber=rr,t.ZikoUIInputOption=ln,t.ZikoUIInputPassword=yr,t.ZikoUIInputRadio=mr,t.ZikoUIInputSearch=cr,t.ZikoUIInputSlider=or,t.ZikoUIInputTime=kr,t.ZikoUILabel=hn,t.ZikoUILink=Rr,t.ZikoUIMain=Pn,t.ZikoUIMenu3d=Do,t.ZikoUIModal=Lo,t.ZikoUINav=Rn,t.ZikoUIParagraphe=Pi,t.ZikoUIQuote=_i,t.ZikoUISVGWrapper=Ar,t.ZikoUISection=zn,t.ZikoUISelect=pn,t.ZikoUISubText=Ii,t.ZikoUISupText=Ei,t.ZikoUISuspense=Mr,t.ZikoUISvg=rh,t.ZikoUIText=ki,t.ZikoUITextArea=mn,t.ZikoUIVerticalSlider=$o,t.ZikoUIVerticalSplitter=Ao,t.ZikoUIVideo=tn,t.ZikoUIXMLWrapper=Ir,t.ZikoUseRoot=gi,t.ZikoUseStyle=ui,t.__Config__=nl,t.__UI__=rl,t.abbrText=Li,t.abs=Ea,t.accum=Q,t.acos=Ra,t.acosh=Wa,t.acot=Na,t.add=S,t.adoc2html=Dt,t.arange=V,t.arr2str=Go,t.asin=za,t.asinh=Xa,t.atan=$a,t.atan2=Qa,t.atanh=qa,t.audio=rn,t.bessel=xa,t.beta=_a,t.blockQuote=zi,t.br=zr,t.brs=Nr,t.btn=Hr,t.canvasArc=Lh,t.canvasCircle=Ph,t.canvasLine=$h,t.canvasPoints=Rh,t.canvasRect=Vh,t.cartesianProduct=et,t.ceil=Ya,t.checkbox=dr,t.choleskyDecomposition=wt,t.clamp=N,t.codeText=Zi,t.combinaison=ut,t.complex=fa,t.cos=Ma,t.cosh=Va,t.cot=Ua,t.coth=Ha,t.count=ra,t.countWords=na,t.csc=Pa,t.csv2arr=Zt,t.csv2json=Ut,t.csv2matrix=Lt,t.csv2object=Pt,t.csv2sql=Rt,t.dangerAlert=Co,t.datalist=un,t.default=hl,t.defineParamsGetter=il,t.deg2rad=W,t.dfnText=Mi,t.div=j,t.e=Sa,t.fact=Ja,t.figure=Qr,t.floor=Ga,t.gamma=wa,t.geomspace=H,t.h=Dr,t.h1=Ni,t.h2=Vi,t.h3=Bi,t.h4=Fi,t.h5=Hi,t.h6=Wi,t.hSlider=zo,t.hSplitter=To,t.hr=$r,t.hrs=Vr,t.html=Fr,t.hypot=sh,t.image=Gr,t.inRange=J,t.infoAlert=ko,t.input=ir,t.inputCamera=an,t.inputColor=lr,t.inputDate=xr,t.inputDateTime=Er,t.inputEmail=br,t.inputImage=qr,t.inputNumber=nr,t.inputPassword=wr,t.inputTime=_r,t.isApproximatlyEqual=tt,t.json2arr=Nt,t.json2css=Ko,t.json2csv=Vt,t.json2csvFile=Bt,t.json2xml=qt,t.json2xmlFile=Yt,t.json2yml=Wt,t.json2ymlFile=Xt,t.jsonStyleSheet=Qh,t.lerp=R,t.li=Qi,t.link=Br,t.linspace=B,t.ln=Oa,t.logspace=F,t.luDecomposition=mt,t.map=$,t.mapfun=_,t.markdown2html=It,t.matrix=la,t.matrix2=ca,t.matrix3=ua,t.matrix4=pa,t.max=K,t.menu3d=Zo,t.min=G,t.modulo=D,t.mul=M,t.norm=U,t.nums=P,t.obj2str=qo,t.ol=Ji,t.ones=L,t.p=Ri,t.pgcd=st,t.pow=Ta,t.powerSet=ot,t.ppcm=it,t.preload=vt,t.prod=Y,t.qrDecomposition=yt,t.quote=Oi,t.rad2deg=X,t.radio=gr,t.removeExtraSpace=ia,t.round=Ka,t.search=ur,t.sec=Za,t.select=dn,t.sig=eh,t.sign=th,t.sin=ja,t.sinc=La,t.sinh=Ba,t.slider=ar,t.sqrt=Ia,t.sqrtn=Aa,t.str=oa,t.sub=O,t.subSet=null,t.subText=Di,t.successAlert=xo,t.sum=q,t.supText=ji,t.svg2ascii=Ho,t.svg2img=Xo,t.svg2imgUrl=Wo,t.svg2str=Fo,t.svgCircle=hh,t.svgEllipse=ch,t.svgGrid=Sh,t.svgGroupe=mh,t.svgImage=fh,t.svgLine=yh,t.svgLink=vh,t.svgObject=ph,t.svgPath=kh,t.svgPolygon=Ch,t.svgRect=Ih,t.svgText=Ah,t.tan=Da,t.tanh=Fa,t.text=Si,t.textarea=gn,t.timeTaken=Ps,t.time_memory_Taken=js,t.ul=tr,t.useAnimation=(t,e=Ss.Linear,s=50,i)=>new Rs(t,Ss.Linear,50,i),t.useBattery=ii,t.useChannel=Ks,t.useClickEvent=re,t.useClipboardEvent=Fe,t.useCustomEvent=rs,t.useDebounce=Os,t.useDragEvent=Ue,t.useDropEvent=Re,t.useEventEmitter=Js,t.useFavIcon=Bs,t.useFocusEvent=qe,t.useFps=Is,t.useGeolocation=ni,t.useHashEvent=es,t.useHead=Ys,t.useInputEvent=Qe,t.useKeyEvent=Oe,t.useLocaleStorage=li,t.useMediaQuery=mi,t.useMeta=Hs,t.useMouseEvent=ke,t.usePointerEvent=de,t.useRoot=bi,t.useRootValue=fi,t.useSessionStorage=ci,t.useStyle=pi,t.useSuccesifKeys=ks,t.useSwipeEvent=as,t.useThread=ei,t.useThrottle=Ms,t.useTimeLoop=Ts,t.useTitle=Xs,t.useType=_s,t.useWheelEvent=Ee,t.vSlider=No,t.vSplitter=So,t.video=en,t.wait=Ls,t.waitForUIElm=Ds,t.waitForUIElmSync=Zs,t.warningAlert=_o,t.watch=cs,t.watchAttr=ps,t.watchChildren=ms,t.watchIntersection=fs,t.watchScreen=vs,t.watchSize=ys,t.zeros=Z,Object.defineProperty(t,"__esModule",{value:!0})}));
|