ziko
Version:
a versatile javaScript framework offering a rich set of UI components, advanced mathematical utilities, reactivity, animations, client side routing and graphics capabilities
9 lines • 150 kB
JavaScript
/*
Project: ziko.js
Author: Zakaria Elalaoui
Date : Thu Feb 13 2025 17:40:20 GMT+0100 (UTC+01:00)
Git-Repo : https://github.com/zakarialaoui10/ziko.js
Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
Released under MIT License
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Ziko={})}(this,(function(t){"use strict";const{PI:e,E:s}=Math,r=Number.EPSILON;var i=Object.freeze({__proto__:null,E:s,EPSILON:r,PI:e});const{PI:n,cos:o,sin:a,tan:h,acos:l,asin:u,atan:m,cosh:p,sinh:f,tanh:g,acosh:b,asinh:y,atanh:v,log:w}=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:m,acot:t=>n/2-m(t),cosh:p,sinh:f,tanh:g,coth:t=>.5*w((1+t)/(1-t)),acosh:b,asinh:y,atanh:v};x=new Proxy(x,{get(t,e){if(e in t)return s=>+t[e](s).toFixed(15)}});class _{}const k=(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=>k(t,e)));if(ArrayBuffer.isView(e))return e.map((e=>t(e)));if(e instanceof Set)return new Set(k(t,...e));if(e instanceof Map)return new Map([...e].map((e=>[e[0],k(t,e[1])])));if(e instanceof oo)return new oo(e.rows,e.cols,k(e.arr.flat(1)));if(e instanceof po){const[s,r,i,n]=[e.a,e.b,e.z,e.phi];switch(t){case Math.log:return fo(So(i),n);case Math.exp:return fo(Co(s)*Mo(r),Co(s)*Oo(r));case Math.abs:return i;case Math.sqrt:return fo(Io(i)*Mo(n/2),Io(i)*Oo(n/2));case x.cos:return fo(Mo(s)*No(r),-Oo(s)*Bo(r));case x.sin:return fo(Oo(s)*No(r),Mo(s)*Bo(r));case x.tan:{const t=Mo(2*s)+No(2*r);return fo(Oo(2*s)/t,Bo(2*r)/t)}case x.cosh:return fo(No(s)*Mo(r),Bo(s)*Oo(r));case x.sinh:return fo(Bo(s)*Mo(r),No(s)*Oo(r));case x.tanh:{const t=No(2*s)+Mo(2*r);return fo(Bo(2*s)/t,Oo(2*r)/t)}default:return t(e)}}else if(e instanceof Object)return t(Object)||Object.fromEntries(Object.entries(e).map((e=>[e[0],k(t,e[1])])))}));return 1==s.length?s[0]:s},E=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t+e;if(e instanceof po)return fo(t+e.a,e.b);if(e instanceof oo)return oo.nums(e.rows,e.cols,t).add(e);if(e instanceof Array)return e.map((e=>S(e,t)))}else{if(t instanceof po||t instanceof oo)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])))}}},I=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t-e;if(e instanceof po)return fo(t-e.a,-e.b);if(e instanceof oo)return oo.nums(e.rows,e.cols,t).sub(e);if(e instanceof Array)return e.map((e=>M(e,t)))}else{if(t instanceof po||t instanceof oo)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=>M(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>M(t,e[s])))}}},A=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t*e;if(e instanceof po)return fo(t*e.a,t*e.b);if(e instanceof oo)return oo.nums(e.rows,e.cols,t).mul(e);if(e instanceof Array)return e.map((e=>O(t,e)))}else{if(t instanceof po||t instanceof oo)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=>O(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>O(t,e[s])))}}},T=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t/e;if(e instanceof po)return fo(t/e.a,t/e.b);if(e instanceof oo)return oo.nums(e.rows,e.cols,t).div(e);if(e instanceof Array)return e.map((e=>j(t,e)))}else{if(t instanceof po||t instanceof oo)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])))}}},C=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t%e;if(e instanceof po)return fo(t%e.a,t%e.b);if(e instanceof oo)return oo.nums(e.rows,e.cols,t).modulo(e);if(e instanceof Array)return e.map((e=>j(t,e)))}else{if(t instanceof po||t instanceof oo)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=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},O=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=A(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},U=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=C(s,e[t]);return s},D=t=>new Array(t).fill(0),Z=t=>new Array(t).fill(1),R=(t,e)=>new Array(e).fill(t),L=(t,e,s)=>{if("number"==typeof t)return e!==s?(t-e)/(s-e):0;if(t instanceof oo)return new oo(t.rows,t.cols,L(t.arr.flat(1),e,s));if(t instanceof po)return new po(L(t.a,e,s),L(t.b,e,s));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>L(t,e,s)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=L(t[s])}}},P=(t,e,s)=>{if("number"==typeof t)return(s-e)*t+e;if(t instanceof oo)return new oo(t.rows,t.cols,P(t.arr.flat(1),e,s));if(t instanceof po)return new po(P(t.a,e,s),P(t.b,e,s));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>P(t,e,s)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=P(t[s])}}},F=(t,e,s,r,i)=>{if("number"==typeof t)return P(L(t,e,s),r,i);if(t instanceof oo)return new oo(t.rows,t.cols,F(t.arr.flat(1),e,s,r,i));if(t instanceof po)return new po(F(t.a,s,r,i),F(t.b,e,s,r,i));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>F(t,e,s,r,i)));{let n=new Array(t.length);for(let o=0;o<t.length;o++)n[o]=F(t[o],e,s,r,i)}}},N=(t,e,s)=>{const[r,i]=[Q(e,s),K(e,s)];if("number"==typeof t)return Q(K(t,r),i);if(t instanceof oo)return new oo(t.rows,t.cols,N(t.arr.flat(1),r,i));if(t instanceof po)return new po(N(t.a,r,i),N(t.b,r,i));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>N(t,r,i)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=N(t[s],r,i)}}},B=(t,e,s,r=!1)=>{let i=[];if(t<e)for(let n=t;r?n<=e:n<e;n+=s)i.push(10*n/10);else for(let n=t;r?n>=e:n>e;n-=s)i.push(10*n/10);return i},H=(t,e,s=Eo(e-t)+1,r=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[o,a]=[t,e].sort(((t,e)=>e-t));var i=[];let h;h=r?(o-a)/(s-1):(o-a)/s;for(var n=0;n<s;n++)t<e?i.push(a+h*n):i.push(o-h*n);return i}if([t,e].some((t=>t instanceof po))){const i=fo(t),n=fo(e);s=s||Math.abs(i.a-n.a)+1;const o=H(i.a,n.a,s,r),a=H(i.b,n.b,s,r);let h=new Array(s).fill(null);return h=h.map(((t,e)=>fo(o[e],a[e]))),h}}},V=(t,e,r=e-t+1,i=s,n=!0)=>H(t,e,r,n).map((t=>Ao(i,t))),$=(t,e,s=Eo(e-t)+1,r=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[i,n]=[t,e].sort(((t,e)=>e-t));let o;o=To(i/n,r?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 po))){const i=fo(t),n=fo(e);let o;s=s||Math.abs(i.a-n.a)+1,o=To(n.div(i),r?s-1:s);const a=[i];for(let t=1;t<s;t++)a.push(O(a[t-1],o));return a}}},q=(...t)=>mapfun((t=>t*Math.PI/180),...t),W=(...t)=>mapfun((t=>t/Math.PI*180),...t),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},X=(...t)=>{if(t.every((t=>"number"==typeof t))){let e=t[0];for(let s=1;s<t.length;s++)e*=t[s];return e}const e=[];for(let s=0;s<t.length;s++)t[s]instanceof Array?e.push(X(...t[s])):t[s]instanceof Object&&e.push(X(...Object.values(t[s])));return 1===e.length?e[0]:e},Q=(...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(Q(...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(Q(...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},G=(...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(G(...t[s])):t[s]instanceof Object&&e.push(null);return 1===e.length?e[0]:e},J=(t,e,s)=>{const[r,i]=[Math.min(e,s),Math.max(e,s)];return t>=r&&t<=i},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,r=1;if(t==Xo(t)&&e==Xo(e)){for(s=2;s<=t&&s<=e;++s)t%s==0&&e%s==0&&(r=s);return r}console.log("error")},rt=(t,e)=>{let s;if(t==Xo(t)&&e==Xo(e)){for(s=t>e?t:e;s%t!=0||s%e!=0;)++s;return s}console.log("error")},it={add:S,sub:M,mul:O,div:j,modulo:U,zeros:D,ones:Z,nums:R,norm:L,lerp:P,map:F,clamp:N,arange:B,linspace:H,logspace:V,geomspace:$,sum:Y,prod:X,accum:G,cartesianProduct:et,ppcm:rt,pgcd:st,deg2rad:q,rad2deg:W,inRange:J,isApproximatlyEqual:tt};var nt=Object.freeze({__proto__:null,Utils:it,add:S,arange:B,cartesianProduct:et,clamp:N,deg2rad:q,div:j,geomspace:$,inRange:J,isApproximatlyEqual:tt,lerp:P,linspace:H,logspace:V,map:F,mapfun:k,modulo:U,mul:O,norm:L,nums:R,ones:Z,pgcd:st,ppcm:rt,prod:X,rad2deg:W,sub:M,sum:Y,zeros:D});const ot=t=>{const e=[],s=2**t.length;for(let r=0;r<s;r+=1){const s=[];for(let e=0;e<t.length;e+=1)r&1<<e&&s.push(t[e]);e.push(s)}return e},at={_mode:Number,_map:function(t,e,s){return e instanceof oo?new oo(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof po?new po(t(e.a,s),t(e.b,s)):e instanceof Array?e.map((e=>t(e,s))):void 0},dec2base(t,e){return this._mode=e<=10?Number:String,"number"==typeof t?this._mode((t>>>0).toString(e)):this._map(this.dec2base,t,e)},dec2bin(t){return this.dec2base(t,2)},dec2oct(t){return this.dec2base(t,8)},dec2hex(t){return this.dec2base(t,16)},bin2base(t,e){return this.dec2base(this.bin2dec(t),e)},bin2dec(t){return this._mode("0b"+t)},bin2oct(t){return this.bin2base(t,8)},bin2hex(t){return this.bin2base(t,16)},oct2dec(t){return this._mode("0o"+t)},oct2bin(t){return this.dec2bin(this.oct2dec(t))},oct2hex(t){return this.dec2hex(this.oct2dec(t))},oct2base(t,e){return this.dec2base(this.oct2dec(t),e)},hex2dec(t){return this._mode("0x"+t)},hex2bin(t){return this.dec2bin(this.hex2dec(t))},hex2oct(t){return this.dec2oct(this.hex2dec(t))},hex2base(t,e){return this.dec2base(this.hex2dec(t),e)},IEEE32toDec(t){let e=t.split(" ").join("").padEnd(32,"0"),s=e[0],r=2**(+("0b"+e.slice(1,9))-127);return(-1)**s*(1+e.slice(9,32).split("").map((t=>+t)).map(((t,e)=>t*2**(-e-1))).reduce(((t,e)=>t+e),0))*r},IEEE64toDec(t){let e=t.split(" ").join("").padEnd(64,"0"),s=e[0],r=2**(+("0b"+e.slice(1,12))-1023);return(-1)**s*(1+e.slice(13,64).split("").map((t=>+t)).map(((t,e)=>t*2**(-e-1))).reduce(((t,e)=>t+e),0))*r}},ht={_mode:Number,_map:function(t,e,s){return e instanceof oo?new oo(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof po?new po(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 r;return r=this.withDiscount(t,e-1),t.forEach((t=>{r.forEach((e=>{s.push([t].concat(e))}))})),s}static withoutDiscount(t){if(1===t.length)return t.map((t=>[t]));const e=[],s=this.withoutDiscount(t.slice(1)),r=t[0];for(let t=0;t<s.length;t++){const i=s[t];for(let t=0;t<=i.length;t++){const s=i.slice(0,t),n=i.slice(t);e.push(s.concat([r],n))}}return e}}class ct{static withDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((r,i)=>{this.withDiscount(t.slice(i),e-1).forEach((t=>{s.push([r].concat(t))}))})),s}static withoutDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((r,i)=>{this.withoutDiscount(t.slice(i+1),e-1).forEach((t=>{s.push([r].concat(t))}))})),s}}const ut=(t,e,s=!1)=>ct[s?"withDiscount":"withoutDiscount"](t,e);var mt=Object.freeze({__proto__:null,Base:at,Combinaison:ct,Logic:ht,Permutation:lt,combinaison:ut,powerSet:ot,subSet:null});class pt{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=it.accum(...e).map((t=>100*t)),s.fill(t[0],0,e[0]);for(let r=1;r<t.length;r++)s.fill(t[r],e[r-1],e[r]);return s[this.int(s.length-1)]}static shuffleArr(t){return t.sort((()=>.5-Math.random()))}static shuffleMatrix(t){const{rows:e,cols:s,arr:r}=t;return ao(e,s,r.flat().sort((()=>.5-Math.random())))}static floats(t,e,s){return new Array(t).fill(0).map((()=>this.float(e,s)))}static ints(t,e,s){return new Array(t).fill(0).map((()=>this.int(e,s)))}static bools(t){return new Array(t).fill(0).map((()=>this.bool()))}static bins(t){return new Array(t).fill(0).map((()=>this.int(2)))}static octs(t){return new Array(t).fill(0).map((()=>this.int(8)))}static decs(t){return new Array(t).fill(0).map((()=>this.int(10)))}static hexs(t){return new Array(t).fill(0).map((()=>this.int(16)))}static choices(t,e,s){return new Array(t).fill(0).map((()=>this.choice(e,s)))}static perm(...t){return t.permS[this.int(t.length)]}static color(){return"#"+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 po(this.float(t[0],t[1]),this.float(e[0],e[1])):new po(...this.floats(2,t,e))}static complexInt(t=[0,1],e=[0,1]){return new po(this.int(t[0],t[1]),this.int(e[0],e[1]))}static complexBin(){return new po(...this.bins(2))}static complexOct(){return new po(...this.octs(2))}static complexDec(){return new po(...this.decs(10))}static complexHex(){return new po(...this.octs(2))}static complexes(t,e=0,s=1){return new Array(t).fill(0).map((()=>this.complex(e,s)))}static complexesInt(t,e=0,s=1){return new Array(t).fill(0).map((()=>this.complexInt(e,s)))}static complexesBin(t){return new Array(t).fill(0).map((()=>this.complexBin()))}static complexesOct(t){return new Array(t).fill(0).map((()=>this.complexOct()))}static complexesDec(t){return new Array(t).fill(0).map((()=>this.complexDec()))}static complexesHex(t){return new Array(t).fill(0).map((()=>this.complexHex()))}static matrix(t,e,s,r){return ao(t,e,this.floats(t*e,s,r))}static matrixInt(t,e,s,r){return ao(t,e,this.ints(t*e,s,r))}static matrixBin(t,e){return ao(t,e,this.bins(t*e))}static matrixOct(t,e){return ao(t,e,this.octs(t*e))}static matrixDec(t,e){return ao(t,e,this.decs(t*e))}static matrixHex(t,e){return ao(t,e,this.hex(t*e))}static matrixColor(t,e){return ao(t,e,this.colors(t*e))}static matrixComplex(t,e,s,r){return ao(t,e,this.complexes(t*e,s,r))}static matrixComplexInt(t,e,s,r){return ao(t,e,this.complexesInt(t*e,s,r))}static matrixComplexBin(t,e){return ao(t,e,this.complexesBin(t*e))}static matrixComplexOct(t,e){return ao(t,e,this.complexesBin(t*e))}static matrixComplexDec(t,e){return ao(t,e,this.complexesBin(t*e))}static matrixComplexHex(t,e){return ao(t,e,this.complexesBin(t*e))}}const dt=t=>{t instanceof oo&&(t=t.arr);const e=t.length,s=new Array(e).fill(0).map((()=>new Array(e).fill(0))),r=new Array(e).fill(0).map((()=>new Array(e).fill(0)));for(let i=0;i<e;i++){for(let n=i;n<e;n++){let e=0;for(let t=0;t<i;t++)e+=s[i][t]*r[t][n];r[i][n]=t[i][n]-e}for(let n=i;n<e;n++)if(i==n)s[i][i]=1;else{let e=0;for(let t=0;t<i;t++)e+=s[n][t]*r[t][i];s[n][i]=(t[n][i]-e)/r[i][i]}}return[s,r].map((t=>new oo(t)))},ft=(t,e)=>t.reduce(((t,s,r)=>t+s*e[r]),0),gt=t=>Math.sqrt(t.reduce(((t,e)=>t+e*e),0)),bt=t=>t.map((e=>e/gt(t))),yt=t=>{t instanceof oo&&(t=t.arr);const e=t.length,s=t[0].length,r=[],i=[];for(let t=0;t<e;t++)i.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=r[o],h=ft(a,t.map((t=>t[n])));for(let t=0;t<e;t++)s[t]-=h*a[t];i[o][n]=h}const o=gt(s);r.push(bt(s)),i[n][n]=o}return[r,i].map((t=>new oo(t)))},vt=t=>{t instanceof oo&&(t=t.arr);const e=t.length,s=new Array(e).fill(0).map((()=>new Array(e).fill(0)));for(let r=0;r<e;r++)for(let e=0;e<=r;e++){let i=0;for(let t=0;t<e;t++)i+=s[r][t]*s[e][t];s[r][e]=r===e?Math.sqrt(t[r][r]-i):1/s[e][e]*(t[r][e]-i)}return new oo(s)},wt=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=wt(t);return(new DOMParser).parseFromString(e,"text/xml").documentElement};var xt=Object.freeze({__proto__:null,preload:wt});const _t=(t,e=",")=>t.trim().trimEnd().split("\n").map((t=>t.split(e))),kt=(t,e=",")=>new oo(_t(t,e)),Et=(t,e=",")=>{const[s,...r]=_t(t,e);return r.map((t=>{const e={};return s.forEach(((s,r)=>{e[s]=t[r]})),e}))},It=(t,e=",")=>JSON.stringify(Et(t,e)),At=(t,e)=>{const s=t.trim().trimEnd().split("\n").filter((t=>t));let r=`INSERT INTO ${e} (${s[0].split(",").join(", ")}) Values `,i=[];for(let t=1;t<s.length;t++){const e=s[t].split(",");i.push(`(${e})`)}return r+i.join(",\n")},Tt=t=>t instanceof Array?[Object.keys(t[0]),...t.map((t=>Object.values(t)))]:[Object.keys(t)],Ct=(t,e)=>Tt(t).map((t=>t.join(e))).join("\n"),St=t=>Tt(t instanceof Object?t:JSON.parse(t)),Mt=(t,e=",")=>Ct(t instanceof Object?t:JSON.parse(t),e),Ot=(t,e)=>{const s=Mt(t,e),r=new Blob([s],{type:"text/csv;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}},jt=(t,e)=>{const s=[];if(Array.isArray(t))t.forEach((t=>{if("object"==typeof t&&null!==t){s.push(`${e}-`);const r=jt(t,`${e} `);s.push(...r)}else s.push(`${e}- ${t}`)}));else for(const r in t)if(t.hasOwnProperty(r)){const i=t[r];if("object"==typeof i&&null!==i){s.push(`${e}${r}:`);const t=jt(i,`${e} `);s.push(...t)}else s.push(`${e}${r}: ${i}`)}return s},Ut=(t,e="")=>jt(t,e).join("\n"),Dt=(t,e)=>Ut(t instanceof Object?t:JSON.parse(t),e),Zt=(t,e)=>{const s=Dt(t,e),r=new Blob([s],{type:"text/yml;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}},Rt=(t,e=1)=>{let s="";for(const r in t)if(t.hasOwnProperty(r)){const i=t[r];s+="\n"+" ".repeat(e)+`<${r}>`,s+="object"==typeof i?Rt(i,e+2):`${i}`,s+=`</${r}>`}return s.trim()},Lt=(t,e)=>{const s=Rt(t,e),r=new Blob([s],{type:"text/xml;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}};let Pt=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 zt=(t,e="px")=>("number"==typeof t&&(t+=e),t instanceof Array&&(t=t.map((t=>"number"==typeof t?t+=e:t)).join(" ")),t);class Ft{constructor(t={}){this.target=null,this.styles=new Map([["default",t]]),this.cache={isHidden:!1,isFaddedOut:!1,transformation:{Flip:[0,0,0],matrix:new oo([[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))to.isCamelCase(e)&&(delete t[e],Object.assign(t,{[to.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=zt(e,"px"),s=zt(s,"px"),this.style({minWidth:e,maxWidth:s},{target:target,maskVector:maskVector})}}else t=zt(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=zt(e,"px"),s=zt(s,"px"),this.style({minHeight:e,maxHeight:s},{target:target,maskVector:maskVector})}}else t=zt(t,"px"),this.style({height:t});return this}enableResize(t=!1,e=!1){let s="none";return s=t?e?"both":"horizontal":e?"vertical":"none",this.style({resize:s,overflow:"hidden"}),this.isInline()&&(console.group("Ziko Issue : Temporarily Incompatible Method"),console.warn(".enableResize has no effect on inline elements!"),console.info("%cConsider using other display types such as block, inline-block, flex, or grid for proper resizing behavior.","color:gold;background-color:#3333cc;padding:5px"),console.groupEnd()),this}hide({after:t,target:e,maskVector:s}={}){if("number"==typeof t){const r=()=>this.hide({target:e,maskVector:s});setTimeout(r,t),clearTimeout(r)}else this.cache.isHidden=!0,this.style({display:"none"},{target:e,maskVector:s});return this}show({after:t,target:e,maskVector:s}={}){if("number"==typeof t){const r=()=>this.show({target:e,maskVector:s});setTimeout(r,t),clearTimeout(r)}else this.cache.isHidden=!1,this.style({display:""},{target:e,maskVector:s});return this}color(t){return this.style({color:t}),this}background(t){return this.style({background:t}),this}backgroundColor(t){return this.style({backgroundColor:t}),this}opacity(t,{target:e,maskVector:s}={}){return this.style({opacity:t},{target:e,maskVector:s}),this}position(t){return this.style({position:t}),this}display(t,{target:e,maskVector:s}={}){return this.style({display:t},{target:e,maskVector:s}),this}zIndex(t){return this.style({zIndex:t}),this}float(t,{target:e,maskVector:s}={}){return this.style({float:t},{target:e,maskVector:s}),this}border(t="1px solid red",{target:e,maskVector:s}={}){return this.style({border:t},{target:e,maskVector:s}),this}borderTop(t="1px solid red",{target:e,maskVector:s}={}){return this.style({borderTop:t},{target:e,maskVector:s}),this}borderRight(t="1px solid red",{target:e,maskVector:s}={}){return this.style({borderRight:t},{target:e,maskVector:s}),this}borderBottom(t="1px solid red",{target:e,maskVector:s}={}){return this.style({borderBottom:t},{target:e,maskVector:s}),this}borderLeft(t="1px solid red",{target:e,maskVector:s}={}){return this.style({borderLeft:t},{target:e,maskVector:s}),this}borderRadius(t){return t=zt(t,"px"),this.style({borderRadius:t},{target:target,maskVector:maskVector}),this}margin(t){return t=zt(t,"px"),this.style({margin:t},{target:target,maskVector:maskVector}),this}marginTop(t){return t=zt(t,"px"),this.style({marginTop:t}),this}marginRight(t){return t=zt(t,"px"),this.style({marginRight:t}),this}marginBootom(t){return t=zt(t,"px"),this.style({marginBootom:t}),this}marginLeft(t){return t=zt(t,"px"),this.style({marginLeft:t}),this}padding(t){return t=zt(t,"px"),this.style({padding:t}),this}paddingTop(t){return t=zt(t,"px"),this.style({paddingTop:t}),this}paddingRight(t){return t=zt(t,"px"),this.style({paddingRight:t}),this}paddingBootom(t){return t=zt(t,"px"),this.style({paddingBootom:t}),this}paddingLeft(t){return t=zt(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}#r(t){const e=this.cache.transformation.matrix.arr.join(",");this.style({transform:`matrix3d(${e})`,"-webkit-transform":`matrix3d(${e})`,"-moz-transform":`matrix3d(${e})`,"-ms-transform":`matrix3d(${e})`,"-o-transform":`matrix3d(${e})`}),0!=t&&this.style({transition:`transform ${t/1e3}s ease`})}translate(t,e=t,s=0,r=0){return this.cache.transformation.matrix.set(3,0,t),this.cache.transformation.matrix.set(3,1,e),this.cache.transformation.matrix.set(3,2,s),this.#r(r),this}translateX(t,e=0){return this.cache.transformation.matrix.set(3,0,t),this.#r(e),this}translateY(t,e=0){return this.cache.transformation.matrix.set(3,1,t),this.#r(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.#r(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.#r(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.#r(s),this}scaleX(t=1,e=0){return this.cache.transformation.matrix.set(0,0,t),this.#r(e),this}scaleY(t=1,e=0){return this.cache.transformation.matrix.set(1,1,t),this.cache.transformation.matrix.arr.join(","),this.#r(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.#r(s),this}skewX(t=1,e=0){return this.cache.transformation.matrix.set(0,1,t),this.cache.transformation.matrix.arr.join(","),this.#r(e),this}skewY(t=1,e=0){return this.cache.transformation.matrix.set(1,0,t),this.cache.transformation.matrix.arr.join(","),this.#r(e),this}rotateX(t,e=0){return this.cache.transformation.matrix.set(1,1,Mo(t)),this.cache.transformation.matrix.set(1,2,-Oo(t)),this.cache.transformation.matrix.set(2,1,Oo(t)),this.cache.transformation.matrix.set(1,2,Mo(t)),this.#r(e),this}rotateY(t,e=0){return this.cache.transformation.matrix.set(0,0,Mo(t)),this.cache.transformation.matrix.set(0,2,Oo(t)),this.cache.transformation.matrix.set(2,0,-Oo(t)),this.cache.transformation.matrix.set(2,2,Mo(t)),this.#r(e),this}rotateZ(t,e=0){return this.cache.transformation.matrix.set(0,0,Mo(t)),this.cache.transformation.matrix.set(0,1,-Oo(t)),this.cache.transformation.matrix.set(1,0,Oo(t)),this.cache.transformation.matrix.set(1,1,Mo(t)),this.#r(e),this}flipeX(t=1){return this.cache.transformation.Flip[0]+=180,this.cache.transformation.Flip[0]%=360,this.rotateX(this.cache.transformation.Flip[0],t),this}flipeY(t=1){return this.cache.transformation.Flip[1]+=180,this.cache.transformation.Flip[1]%=360,this.rotateY(this.cache.transformation.Flip[1],t),this}flipeZ(t=1){return this.cache.transformation.Flip[2]+=180,this.cache.transformation.Flip[2]%=360,this.rotateZ(this.cache.transformation.Flip[2],t),this}slideHeightIn(t=1,e=this.h){return this.style({transition:t+"s",height:e}),this}slideHeightOut(t=1){return this.style({transition:t+"s",height:0}),this.target?.element?.n("transitionend",(()=>this.style({opacity:"none"}))),this}slideWidthIn(t=1,e=this.w){return this.style({transition:t+"s",width:e}),this}slideWidthOut(t=1){this.style({transition:t+"s",width:0});const e=()=>{this.style({opacity:"none"})};return this.target?.element?.addEventListener("transitionend",e),this.target?.element?.removeEventListener("transitionend",e),this}slideIn({transitionTimming:t=1,w:e="100%",h:s="auto"}={}){return this.style({transition:t+"s",width:e,height:s,visibility:"visible"}),this}slideOut({transitionTimming:t=1,width:e=0,heightransitionTimming:s=0}={}){this.style({visibility:"hidden",transition:t+"s",opacity:"none",width:e,height:height});const r=()=>{this.style({opacity:"none"})};return this.target?.element?.addEventListener("transitionend",r),this.target?.element?.removeEventListener("transitionend",r),this}}function Nt(t,e,s,r){return this.event=t,this.cache.preventDefault[e]&&t.preventDefault(),s&&s(),this.cache.stream.enabled[e]&&r&&this.cache.stream.history[e].push(r),this.cache.callbacks[e].map((t=>t(this))),this}class Bt{constructor(t){this.target=null,this.setTarget(t),this.__dispose=this.dispose.bind(this)}get targetElement(){return this.target.element}setTarget(t){return this.target=t,this}__handle(t,e,s){const r="drag"===t?t:`${this.cache.prefixe}${t}`;return this.dispose(s),this.targetElement?.addEventListener(r,e),this}__onEvent(t,e,...s){if(0===s.length){if(!(this.cache.callbacks.length>1))return this;this.cache.callbacks.map((t=>e=>t.call(this,e)))}else this.cache.callbacks[t]=s.map((t=>e=>t.call(this,e)));return this.__handle(t,this.__controller[t],e),this}preventDefault(t={}){return Object.assign(this.cache.preventDefault,t),this}pause(t={}){t={...Object.fromEntries(Object.keys(this.cache.stream.enabled).map((t=>[t,!0]))),...t};for(let e in t)t[e]&&(this.targetElement?.removeEventListener(`${this.cache.prefixe}${e}`,this.__controller[`${this.cache.prefixe}${e}`]),this.cache.paused[`${this.cache.prefixe}${e}`]=!0);return this}resume(t={}){t={...Object.fromEntries(Object.keys(this.cache.stream.enabled).map((t=>[t,!0]))),...t};for(let e in t)t[e]&&(this.targetElement?.addEventListener(`${this.cache.prefixe}${e}`,this.__controller[`${this.cache.prefixe}${e}`]),this.cache.paused[`${this.cache.prefixe}${e}`]=!1);return this}dispose(t={}){return this.pause(t),this}stream(t={}){this.cache.stream.t0=Date.now();return t={...Object.fromEntries(Object.keys(this.cache.stream.enabled).map((t=>[t,!0]))),...t},Object.assign(this.cache.stream.enabled,t),this}clear(t={}){t={...Object.fromEntries(Object.keys(this.cache.stream.clear).map((t=>[t,!0]))),...t};for(let e in t)t[e]&&(this.cache.stream.history[e]=[]);return this}}function Ht(t){Nt.call(this,t,"click",null,null)}function Vt(t){Nt.call(this,t,"dbclick",null,null)}class $t extends Bt{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:Ht.bind(this),dbclick:Vt.bind(this)}}onClick(...t){return this.__onEvent("click",{},...t),this}onDbClick(...t){return this.__onEvent("dbclick",{},...t),this}}const qt=t=>new $t(t);function Wt(t){Nt.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 Yt(t){Nt.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 Xt(t){Nt.call(this,t,"up",(()=>{this.ux=parseInt(t.offsetX),this.uy=parseInt(t.offsetY),this.isDown=!1;const e=this.dx,s=this.dy,r=this.ux,i=this.uy,n=(r-e)/this.target.Width,o=(s-i)/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 Qt(t){Nt.call(this,t,"enter",null,null)}function Kt(t){Nt.call(this,t,"leave",null,null)}function Gt(t){Nt.call(this,t,"out",null,null)}function Jt(t){Nt.call(this,t,"cancel",null,null)}class te extends Bt{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:Wt.bind(this),move:Yt.bind(this),up:Xt.bind(this),enter:Qt.bind(this),out:Gt.bind(this),leave:Kt.bind(this),cancel:Jt.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 ee=t=>new te(t);class se extends Bt{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:re.bind(this),move:ie.bind(this),up:ne.bind(this),enter:oe.bind(this),out:he.bind(this),leave:ae.bind(this),over:le.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 re(t){Nt.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 ie(t){Nt.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 ne(t){Nt.call(this,t,"up",(()=>{this.ux=parseInt(t.offsetX),this.uy=parseInt(t.offsetY),this.isDown=!1;const e=this.dx,s=this.dy,r=this.ux,i=this.uy,n=(r-e)/this.target.Width,o=(s-i)/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 oe(t){Nt.call(this,t,"enter",null,null)}function ae(t){Nt.call(this,t,"leave",null,null)}function he(t){Nt.call(this,t,"out",null,null)}function le(t){Nt.call(this,t,"out",null,null)}const ce=t=>new se(t);function ue(t){Nt.call(this,t,"wheel",null,null)}class me extends Bt{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:ue.bind(this)}}onWheel(...t){return this.__onEvent("wheel",{},...t),this}}const pe=t=>new me(t);function de(t){Nt.call(this,t,"down",(()=>this.kd=t.key),{key:t.key,t:10})}function fe(t){Nt.call(this,t,"press",(()=>this.kp=t.key),{key:t.key,t:10})}function ge(t){Nt.call(this,t,"up",(()=>this.ku=t.key),{key:t.key,t:10})}class be extends Bt{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:de.bind(this),press:fe.bind(this),up:ge.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 ye=t=>new be(t);function ve(t){Nt(this,t,"start",null)}function we(t){Nt.call(this,t,"drag",null,null)}function xe(t){Nt.call(this,t,"end",null,null)}function _e(t){Nt.call(this,t,"drop",null,null)}class ke extends Bt{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:ve.bind(this),drag:we.bind(this),end:xe.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 Ee extends Bt{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:_e.bind(this)}}onDrop(...t){return this.__onEvent("drop",{},...t),this}}const Ie=t=>new ke(t),Ae=t=>new Ee(t);function Te(t){Nt.call(this,t,"copy",null,null)}function Ce(t){Nt.call(this,t,"cut",null,null)}function Se(t){Nt.call(this,t,"paste",null,null)}function Me(t){Nt.call(this,t,"select",null,null)}class Oe extends Bt{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:Te.bind(this),cut:Ce.bind(this),paste:Se.bind(this),select:Me.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 je=t=>new Oe(t);function Ue(t){Nt.call(this,t,"focus",null,null)}function De(t){Nt.call(this,t,"blur",null,null)}class Ze extends Bt{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:Ue.bind(this),blur:De.bind(this)}}onFocus(...t){return this.__onEvent("focus",{},...t),this}onBlur(...t){return this.__onEvent("blur",{},...t),this}}const Re=t=>new Ze(t);function Le(t){Nt.call(this,t,"input",null,null)}function Pe(t){Nt.call(this,t,"change",null,null)}class ze extends Bt{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:Le.bind(this),change:Pe.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 Fe=t=>new ze(t);function Ne(t){Nt.call(this,t,"hashchange",null,null)}class Be extends Bt{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:Ne.bind(this)}}onChange(...t){return this.__onEvent("hashchange",{},...t),this}}const He=t=>new Be(t),Ve=t=>function(e){Nt.call(this,e,t,null,null)};class $e extends Bt{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{},paused:{},stream:{enabled:{},clear:{},history:{}},callbacks:{}},this.__controller={}}#i(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]=Ve(t).bind(this),this}on(t,...e){return this.__controller[t]||this.#i(t),this.__onEvent(t,{},...e),this}emit(t,e={}){this.__controller[t]||this.#i(t),this.detail=e;const s=new Event(t);return this.targetElement.dispatchEvent(s),this}}const qe=t=>new $e(t);class We extends Bt{constructor(t,e=.3,s=.3){super(t);const{removeListener:r,setWidthThreshold:i,setHeightThreshold:n}=function(t,e=.5,s=.5,r,i){let n=P(e,0,r),o=P(s,0,i),a=0,h=0,l=0,c=0;const u=t=>{a=t.clientX,h=t.clientY},m=t=>{l=t.clientX,c=t.clientY,p()};function p(){const t=l-a,e=c-h;(Math.abs(t)>n||Math.abs(e)>o)&&d(t,e)}function d(e,s){const a=globalThis?.CustomEvent?new CustomEvent("swipe",{detail:{deltaX:Eo(e)<n?0:Jo(e)*L(Eo(e),0,r),deltaY:Eo(s)<o?0:Jo(s)*L(Eo(s),0,i),direction:{x:Eo(e)<n?"none":e>0?"right":"left",y:Eo(s)<o?"none":s>0?"down":"up"}}}):null;t?.dispatchEvent(a)}function f(t){n=P(t,0,r)}function g(t){o=P(t,0,i)}return t?.addEventListener("pointerdown",u),t?.addEventListener("pointerup",m),{removeListener(){t?.removeEventListener("pointerdown",u),t?.removeEventListener("pointerup",m),console.log("Swipe event listeners removed")},setWidthThreshold:f,setHeightThreshold:g}}(this.target?.element,e,s,this.target.width,this.target.height);this.cache={width_threshold:e,height_threshold:s,removeListener:r,setWidthThreshold:i,setHeightThreshold:n,legacyTouchAction:globalThis?.document?.body?.style?.touchAction,prefixe:"",preventDefault:{swipe:!1},paused:{swipe:!1},stream:{enabled:{swipe:!1},clear:{swipe:!1},history:{swipe:[]}},callbacks:{swipe:[]}},this.__controller={swipe:Ye.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 Ye(t){Nt.call(this,t,"swipe",null,null)}const Xe=(t,e,s)=>new We(t,e,s);var Qe=Object.freeze({__proto__:null,ZikoCustomEvent:$e,ZikoEvent:Bt,ZikoEventClick:$t,ZikoEventClipboard:Oe,ZikoEventHash:Be,ZikoEventInput:ze,ZikoEventKey:be,ZikoEventMouse:se,ZikoEventPointer:te,ZikoEventSwipe:We,ZikoEventWheel:me,useClickEvent:qt,useClipboardEvent:je,useCustomEvent:qe,useDragEvent:Ie,useDropEvent:Ae,useFocusEvent:Re,useHashEvent:He,useInputEvent:Fe,useKeyEvent:ye,useMouseEvent:ce,usePointerEvent:ee,useSwipeEvent:Xe,useWheelEvent:pe});class Ke{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 Ge=(t,e={},s=null)=>{const r=new Ke(t,e);return s&&r.observe(s),r};class Je extends Ke{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 ts=(t,e)=>new Je(t,e);class es extends Ke{co