ziko 0.0.11 â 0.0.13
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/README.md +6 -3
- package/dist/ziko.cjs +5640 -4532
- package/dist/ziko.js +5640 -4532
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +5602 -4532
- package/package.json +39 -12
- package/src/__helpers__/index.js +41 -0
- package/src/app/accessibility/index.js +0 -0
- package/src/app/app.js +46 -0
- package/src/app/component/index.js +38 -0
- package/src/app/globals/index.js +20 -0
- package/src/app/index.js +12 -0
- package/src/app/params/index.js +40 -0
- package/src/app/router/index.js +67 -0
- package/src/app/seo/index.js +43 -0
- package/src/app/themes/dark.js +885 -0
- package/src/app/themes/index.js +11 -0
- package/src/app/themes/light.js +255 -0
- package/src/data/api/fetchdom.js +14 -0
- package/src/data/api/index.js +4 -0
- package/src/data/api/preload.js +11 -0
- package/src/data/converter/adoc.js +130 -0
- package/src/data/converter/array.js +43 -0
- package/src/data/converter/canvas.js +25 -0
- package/src/data/converter/csv.js +33 -0
- package/src/data/converter/idea.txt +10 -0
- package/src/data/converter/index.js +34 -0
- package/src/data/converter/json.js +80 -0
- package/src/data/converter/markdown.js +95 -0
- package/src/data/converter/object.js +70 -0
- package/src/data/converter/svg.js +11 -0
- package/src/data/decorators.js +0 -0
- package/src/data/index.js +74 -0
- package/src/data/parser/markdown.js +0 -0
- package/src/data/parser/xml.js +47 -0
- package/src/data/string/index.js +1 -0
- package/src/data/string/patterns.js +12 -0
- package/src/data/string/string.js +170 -0
- package/src/graphics/canvas/_canvas_offscreen +0 -0
- package/src/graphics/canvas/canvas.js +189 -0
- package/src/graphics/canvas/elements/Basic/arc.js +43 -0
- package/src/graphics/canvas/elements/Basic/image.js +0 -0
- package/src/graphics/canvas/elements/Basic/line.js +26 -0
- package/src/graphics/canvas/elements/Basic/path.js +0 -0
- package/src/graphics/canvas/elements/Basic/points.js +48 -0
- package/src/graphics/canvas/elements/Basic/polygon.js +7 -0
- package/src/graphics/canvas/elements/Basic/polyline.js +0 -0
- package/src/graphics/canvas/elements/Basic/rect.js +46 -0
- package/src/graphics/canvas/elements/Basic/text.js +0 -0
- package/src/graphics/canvas/elements/Chart/histogram.js +0 -0
- package/src/graphics/canvas/elements/Chart/plot.js +0 -0
- package/src/graphics/canvas/elements/Chart/scatter.js +2 -0
- package/src/graphics/canvas/elements/Chart/stem.js +0 -0
- package/src/graphics/canvas/elements/Element.js +115 -0
- package/src/graphics/canvas/elements/Groupe.js +0 -0
- package/src/graphics/canvas/elements/grid.js +0 -0
- package/src/graphics/canvas/elements/index.js +13 -0
- package/src/graphics/canvas/filter/index.js +0 -0
- package/src/graphics/canvas/index.js +15 -0
- package/src/graphics/canvas/paint/index.js +0 -0
- package/src/graphics/canvas/utils/color.js +8 -0
- package/src/graphics/canvas/utils/floodFill.js +58 -0
- package/src/graphics/index.js +69 -0
- package/src/graphics/svg/Elements/Basic/circle.js +26 -0
- package/src/graphics/svg/Elements/Basic/ellipse.js +21 -0
- package/src/graphics/svg/Elements/Basic/foreignObject.js +33 -0
- package/src/graphics/svg/Elements/Basic/groupe.js +29 -0
- package/src/graphics/svg/Elements/Basic/image.js +33 -0
- package/src/graphics/svg/Elements/Basic/line.js +29 -0
- package/src/graphics/svg/Elements/Basic/link.js +30 -0
- package/src/graphics/svg/Elements/Basic/path.js +59 -0
- package/src/graphics/svg/Elements/Basic/polygon.js +32 -0
- package/src/graphics/svg/Elements/Basic/polyline.js +4 -0
- package/src/graphics/svg/Elements/Basic/rect.js +43 -0
- package/src/graphics/svg/Elements/Basic/text.js +26 -0
- package/src/graphics/svg/Elements/Derived/grid.js +9 -0
- package/src/graphics/svg/Elements/ZikoSvgElement.js +46 -0
- package/src/graphics/svg/Elements/index.js +14 -0
- package/src/graphics/svg/index.js +2 -0
- package/src/graphics/svg/svg.js +115 -0
- package/src/index.js +88 -0
- package/src/math/absract.js +1 -0
- package/src/math/calculus/index.js +1 -0
- package/src/math/calculus/special-functions/bessel.js +31 -0
- package/src/math/calculus/special-functions/beta.js +38 -0
- package/src/math/calculus/special-functions/gamma.js +30 -0
- package/src/math/calculus/special-functions/index.js +4 -0
- package/src/math/complex/Fractals/julia.js +0 -0
- package/src/math/complex/index.js +203 -0
- package/src/math/const.js +3 -0
- package/src/math/discret/Combinaison/index.js +34 -0
- package/src/math/discret/Conversion/index.js +86 -0
- package/src/math/discret/Logic/index.js +46 -0
- package/src/math/discret/Permutation/index.js +31 -0
- package/src/math/discret/Set/index.js +2 -0
- package/src/math/discret/Set/power-set.js +15 -0
- package/src/math/discret/Set/sub-set.js +10 -0
- package/src/math/discret/index.js +23 -0
- package/src/math/functions/index.js +182 -0
- package/src/math/index.js +189 -0
- package/src/math/matrix/Decomposition.js +90 -0
- package/src/math/matrix/LinearSystem.js +10 -0
- package/src/math/matrix/Matrix.js +717 -0
- package/src/math/matrix/index.js +3 -0
- package/src/math/numeric/index.js +0 -0
- package/src/math/random/index.js +173 -0
- package/src/math/signal/__np.py.txt +40 -0
- package/src/math/signal/conv.js +175 -0
- package/src/math/signal/fft.js +55 -0
- package/src/math/signal/filter.js +39 -0
- package/src/math/signal/functions.js +146 -0
- package/src/math/signal/index.js +110 -0
- package/src/math/statistics/Functions/index.js +100 -0
- package/src/math/statistics/index.js +16 -0
- package/src/math/utils/arithmetic.js +139 -0
- package/src/math/utils/checkers.js +29 -0
- package/src/math/utils/comparaison.js +1 -0
- package/src/math/utils/conversions.js +19 -0
- package/src/math/utils/discret.js +51 -0
- package/src/math/utils/index.js +102 -0
- package/src/math/utils/mapfun.js +50 -0
- package/src/reactivity/events/Global/Click.js +56 -0
- package/src/reactivity/events/Global/Clipboard.js +84 -0
- package/src/reactivity/events/Global/CustomEvent.js +53 -0
- package/src/reactivity/events/Global/Drag.js +137 -0
- package/src/reactivity/events/Global/Focus.js +56 -0
- package/src/reactivity/events/Global/Key.js +104 -0
- package/src/reactivity/events/Global/Mouse.js +230 -0
- package/src/reactivity/events/Global/Pointer.js +234 -0
- package/src/reactivity/events/Global/Swipe.js +147 -0
- package/src/reactivity/events/Global/Touch.js +0 -0
- package/src/reactivity/events/Global/Wheel.js +44 -0
- package/src/reactivity/events/Partiel/Hash.js +44 -0
- package/src/reactivity/events/Partiel/Input.js +59 -0
- package/src/reactivity/events/Partiel/Media.js +1 -0
- package/src/reactivity/events/ZikoEvent.js +91 -0
- package/src/reactivity/events/index.js +63 -0
- package/src/reactivity/hooks/Contexte/index.js +1 -0
- package/src/reactivity/hooks/Contexte/useSuccesifKeys.js +14 -0
- package/src/reactivity/hooks/Decorators/index.js +6 -0
- package/src/reactivity/hooks/Decorators/time.js +17 -0
- package/src/reactivity/hooks/Decorators/type.js +88 -0
- package/src/reactivity/hooks/Interactions/index.js +4 -0
- package/src/reactivity/hooks/Interactions/useBluetooth.js +48 -0
- package/src/reactivity/hooks/Interactions/useChannel.js +50 -0
- package/src/reactivity/hooks/Interactions/useEventEmmiter.js +64 -0
- package/src/reactivity/hooks/Interactions/useSerial.js +0 -0
- package/src/reactivity/hooks/Interactions/useThread.js +44 -0
- package/src/reactivity/hooks/Interactions/useUsb.js +0 -0
- package/src/reactivity/hooks/Sensors/index.js +2 -0
- package/src/reactivity/hooks/Sensors/useBattery.js +36 -0
- package/src/reactivity/hooks/Sensors/useCamera.js +0 -0
- package/src/reactivity/hooks/Sensors/useGeolocation.js +17 -0
- package/src/reactivity/hooks/Sensors/useMicro.js +0 -0
- package/src/reactivity/hooks/Sensors/useOrientation.js +0 -0
- package/src/reactivity/hooks/Storage/index.js +1 -0
- package/src/reactivity/hooks/Storage/useCookie.js +0 -0
- package/src/reactivity/hooks/Storage/useIndexedDb.js +0 -0
- package/src/reactivity/hooks/Storage/useStorage.js +73 -0
- package/src/reactivity/hooks/UI/index.js +5 -0
- package/src/reactivity/hooks/UI/useCssLink.js +0 -0
- package/src/reactivity/hooks/UI/useCssText.js +21 -0
- package/src/reactivity/hooks/UI/useFavIcon.js +38 -0
- package/src/reactivity/hooks/UI/useLinearGradient.js +0 -0
- package/src/reactivity/hooks/UI/useMediaQuery.js +43 -0
- package/src/reactivity/hooks/UI/useRadialGradient.js +0 -0
- package/src/reactivity/hooks/UI/useStyle.js +79 -0
- package/src/reactivity/hooks/UI/useTheme.js +62 -0
- package/src/reactivity/hooks/UI/useTitle.js +30 -0
- package/src/reactivity/hooks/index.js +85 -0
- package/src/reactivity/hooks/todo.md +26 -0
- package/src/reactivity/idea +2 -0
- package/src/reactivity/index.js +22 -0
- package/src/reactivity/observer/attributes.js +28 -0
- package/src/reactivity/observer/children.js +37 -0
- package/src/reactivity/observer/index.js +44 -0
- package/src/reactivity/observer/intersection.js +44 -0
- package/src/reactivity/observer/mutation.js +113 -0
- package/src/reactivity/observer/resize.js +47 -0
- package/src/reactivity/observer/screen.js +45 -0
- package/src/reactivity/observer/screen.js.txt +84 -0
- package/src/reactivity/observer/screen.txt +13 -0
- package/src/time/animation.js +76 -0
- package/src/time/index.js +54 -0
- package/src/time/loop.js +87 -0
- package/src/time/utils/decorators.js +17 -0
- package/src/time/utils/ease.js +144 -0
- package/src/time/utils/index.js +18 -0
- package/src/time/utils/performance.js +16 -0
- package/src/time/utils/ui.js +26 -0
- package/src/user-interface/elements/derived/Flex.js +103 -0
- package/src/user-interface/elements/derived/Grid.js +33 -0
- package/src/user-interface/elements/derived/elements/Notification.js +0 -0
- package/src/user-interface/elements/derived/elements/Popover.js +0 -0
- package/src/user-interface/elements/derived/elements/Popup.js +0 -0
- package/src/user-interface/elements/derived/elements/Swipper.js +4 -0
- package/src/user-interface/elements/derived/elements/Timeline.js +0 -0
- package/src/user-interface/elements/derived/elements/Toast.js +0 -0
- package/src/user-interface/elements/derived/elements/Treeview.js +0 -0
- package/src/user-interface/elements/derived/elements/accordion/accordion.js +45 -0
- package/src/user-interface/elements/derived/elements/accordion/collapsible.js +82 -0
- package/src/user-interface/elements/derived/elements/accordion/index.js +2 -0
- package/src/user-interface/elements/derived/elements/alert/alert.js +80 -0
- package/src/user-interface/elements/derived/elements/alert/index.js +1 -0
- package/src/user-interface/elements/derived/elements/alert/palette.js +52 -0
- package/src/user-interface/elements/derived/elements/carousel/index.js +50 -0
- package/src/user-interface/elements/derived/elements/code-note/SubElements.js.txt +105 -0
- package/src/user-interface/elements/derived/elements/code-note/code-cell.js +195 -0
- package/src/user-interface/elements/derived/elements/code-note/code-note.js +72 -0
- package/src/user-interface/elements/derived/elements/code-note/index.js +2 -0
- package/src/user-interface/elements/derived/elements/code-note/sub-elements.js +67 -0
- package/src/user-interface/elements/derived/elements/columns.js +1 -0
- package/src/user-interface/elements/derived/elements/fab.js +0 -0
- package/src/user-interface/elements/derived/elements/index.js +9 -0
- package/src/user-interface/elements/derived/elements/menu/index.js +1 -0
- package/src/user-interface/elements/derived/elements/menu/menu3d.js +260 -0
- package/src/user-interface/elements/derived/elements/modal/index.js +92 -0
- package/src/user-interface/elements/derived/elements/pagination/breadcrumbs.js +54 -0
- package/src/user-interface/elements/derived/elements/pagination/index.js +1 -0
- package/src/user-interface/elements/derived/elements/splitter/__ZikoUISplitter__.js +62 -0
- package/src/user-interface/elements/derived/elements/splitter/hsplitter.js +40 -0
- package/src/user-interface/elements/derived/elements/splitter/index.js +2 -0
- package/src/user-interface/elements/derived/elements/splitter/vsplitter.js +40 -0
- package/src/user-interface/elements/derived/elements/tabs/index.js +180 -0
- package/src/user-interface/elements/derived/index.js +3 -0
- package/src/user-interface/elements/primitives/ZikoUIContainerElement.js +127 -0
- package/src/user-interface/elements/primitives/ZikoUIElement.js +478 -0
- package/src/user-interface/elements/primitives/embaded/index.js +1 -0
- package/src/user-interface/elements/primitives/index.js +8 -0
- package/src/user-interface/elements/primitives/io/Form/index.js +42 -0
- package/src/user-interface/elements/primitives/io/Form/index.js.txt +104 -0
- package/src/user-interface/elements/primitives/io/Inputs/__helpers__.js +52 -0
- package/src/user-interface/elements/primitives/io/Inputs/index.js +12 -0
- package/src/user-interface/elements/primitives/io/Inputs/input/index.js +98 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-camera/index.js +26 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-checkbox/index.js +26 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-color/index.js +16 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-date-time/index.js +3 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-date-time.js +14 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-date.js +14 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-time.js +14 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-email-password/index.js +2 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-email-password/input-email.js +15 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-email-password/input-password.js +14 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-file/index.js +1 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-file/input-file.js +0 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-file/input-image.js +43 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-number/index.js +37 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-radio/index.js +26 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-search/index.js +45 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-slider/index.js +34 -0
- package/src/user-interface/elements/primitives/io/Select/index.js +20 -0
- package/src/user-interface/elements/primitives/io/Textarea/index.js +18 -0
- package/src/user-interface/elements/primitives/io/index.js +4 -0
- package/src/user-interface/elements/primitives/list/elements.js +0 -0
- package/src/user-interface/elements/primitives/list/index.js +139 -0
- package/src/user-interface/elements/primitives/media/Audio/index.js +17 -0
- package/src/user-interface/elements/primitives/media/Image/figure.js +19 -0
- package/src/user-interface/elements/primitives/media/Image/image.js +36 -0
- package/src/user-interface/elements/primitives/media/Image/index.js +2 -0
- package/src/user-interface/elements/primitives/media/Video/index.js +27 -0
- package/src/user-interface/elements/primitives/media/__ZikoUIDynamicMediaELement__.js +47 -0
- package/src/user-interface/elements/primitives/media/index.js +3 -0
- package/src/user-interface/elements/primitives/misc/index.js +99 -0
- package/src/user-interface/elements/primitives/semantic/index.js +82 -0
- package/src/user-interface/elements/primitives/table/elements.js +94 -0
- package/src/user-interface/elements/primitives/table/index.js +3 -0
- package/src/user-interface/elements/primitives/table/table.js +115 -0
- package/src/user-interface/elements/primitives/table/utils.js +12 -0
- package/src/user-interface/elements/primitives/text/__ZikoUIText__.js +71 -0
- package/src/user-interface/elements/primitives/text/heading.js +36 -0
- package/src/user-interface/elements/primitives/text/index.js +3 -0
- package/src/user-interface/elements/primitives/text/p.js +26 -0
- package/src/user-interface/elements/primitives/text/pre.js +0 -0
- package/src/user-interface/elements/primitives/text/text.js +81 -0
- package/src/user-interface/index.js +188 -0
- package/src/user-interface/style/index.js +510 -0
- package/src/user-interface/utils/index.js +70 -0
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 : Mon Sep 16 2024 15:12:38 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(e){"use strict";const{PI:s,E:r}=Math,n=Number.EPSILON;class i{}class o extends i{constructor(t=0,e=0){super(),t instanceof o?(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=v(t.z**2-t.a**2)):"a"in e&&"phi"in t?(this.a=t.a,this.b=t.a*D(t.phi)):"b"in e&&"z"in t?(this.b=t.b,this.a=v(t.z**2-t.b**2)):"b"in e&&"phi"in t?(this.b=e,this.a=t.b/D(t.phi)):"z"in e&&"phi"in t&&(this.a=t.z*k(t.phi),this.a=t.z*A(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 o(this.a,this.b)}get z(){return Q(this.a,this.b)}get phi(){return W(this.b,this.a)}static Zero(){return new o(0,0)}get conj(){return new o(this.a,-this.b)}get inv(){return new o(this.a/(x(this.a,2)+x(this.b,2)),-this.b/(x(this.a,2)+x(this.b,2)))}add(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new o(t[e],0));let e=t.map((t=>t.a)),s=t.map((t=>t.b));return this.a+=+h(...e).toFixed(15),this.b+=+h(...s).toFixed(15),this}sub(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new o(t[e],0));let e=t.map((t=>t.a)),s=t.map((t=>t.b));return this.a-=+h(...e).toFixed(15),this.b-=+h(...s).toFixed(15),this}mul(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new o(t[e],0));let e=+l(this.z,...t.map((t=>t.z))).toFixed(15),s=+h(this.phi,...t.map((t=>t.phi))).toFixed(15);return this.a=+(e*k(s).toFixed(15)).toFixed(14),this.b=+(e*A(s).toFixed(15)).toFixed(14),this}div(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new o(t[e],0));let e=+(this.z/l(...t.map((t=>t.z)))).toFixed(15),s=+(this.phi-h(...t.map((t=>t.phi)))).toFixed(15);return this.a=+(e*k(s).toFixed(15)).toFixed(15),this.b=+(e*A(s).toFixed(15)).toFixed(15),this}pow(t){if(Z(t)===t&&t>0){let e=+(this.z**t).toFixed(15),s=+(this.phi*t).toFixed(15);this.a=+(e*k(s).toFixed(15)).toFixed(15),this.b=+(e*A(s).toFixed(15)).toFixed(15)}return this}static fromExpo(t,e){return new o(+(t*k(e)).toFixed(13),+(t*A(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 a(t**this.a*k(this.b*E(t)),t**this.a*A(this.b*E(t)))}sqrtn(t=2){return a(F(this.z,t)*k(this.phi/t),F(this.z,t)*A(this.phi/t))}get sqrt(){return this.sqrtn(2)}get log(){return a(this.z,this.phi)}get cos(){return a(k(this.a)*j(this.b),A(this.a)*R(this.b))}get sin(){return a(A(this.a)*j(this.b),k(this.a)*R(this.b))}get tan(){const t=k(2*this.a)+j(2*this.b);return a(A(2*this.a)/t,R(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 a=(t,e)=>{if((t instanceof Array||ArrayBuffer.isView(t))&&(e instanceof Array||ArrayBuffer.isView(t)))return t.map(((s,r)=>a(t[r],e[r])));if(t instanceof vr&&e instanceof vr){if(t.shape[0]!==e.shape[0]||t.shape[1]!==e.shape[1])return Error(0);const s=t.arr.map(((s,r)=>a(t.arr[r],e.arr[r])));return new vr(t.rows,t.cols,...s)}return new o(t,e)},h=(...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(h(...t[s])):t[s]instanceof Object&&e.push(h(...Object.values(t[s])));return 1===e.length?e[0]:e},l=(...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(l(...t[s])):t[s]instanceof Object&&e.push(l(...Object.values(t[s])));return 1===e.length?e[0]:e},u=(...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(u(...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},p=(...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(u(...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},m=(...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(m(...t[s])):t[s]instanceof Object&&e.push(null);return 1===e.length?e[0]:e},g=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)*g(1-t))).toFixed(10);t-=1;let s=e[0];for(let r=1;r<9;r++)s+=e[r]/(t+r);const r=t+7+.5;return+(Math.sqrt(2*Math.PI)*Math.pow(r,t+.5)*Math.exp(-r)*s).toFixed(10)},f=(t,e)=>{let s=0;for(let r=0;r<100;r++){s+=Math.pow(-1,r)*Math.pow(e/2,t+2*r)/(X(r)*X(t+r))}return s},b=(t,e)=>{let s=0;const r=s=>Math.pow(s,t-1)*Math.pow(1-s,e-1);s+=.5*(r(0)+r(1));for(let t=1;t<1e3;t++){s+=r(0+.001*t)}return.001*s},y={cos:t=>+Math.cos(t).toFixed(15),sin:t=>+Math.sin(t).toFixed(15),tan:t=>+Math.tan(t).toFixed(31),sinc:t=>+Math.sin(Math.PI*t)/(Math.PI*t),sec:t=>1/Math.cos(t).toFixed(15),csc:t=>1/Math.sin(t).toFixed(15),cot:t=>1/Math.tan(t).toFixed(15),acos:t=>+Math.acos(t).toFixed(15),asin:t=>+Math.asin(t).toFixed(15),atan:t=>+Math.atan(t).toFixed(15),acot:t=>+Math.PI/2-Math.atan(t).toFixed(15),cosh:t=>+Math.cosh(t).toFixed(15),sinh:t=>+Math.sinh(t).toFixed(15),tanh:t=>+Math.tanh(t).toFixed(15),coth:t=>+(.5*Math.log((1+t)/(1-t))).toFixed(15),acosh:t=>+Math.acosh(t).toFixed(15),asinh:t=>+Math.asinh(t).toFixed(15),atanh:t=>+Math.atanh(t).toFixed(15)},w=(...t)=>Ar(Math.abs,...t),v=(...t)=>Ar(Math.sqrt,...t),x=(t,e)=>{if("number"==typeof t)return"number"==typeof e?Math.pow(t,e):e instanceof o?o.fromExpo(t**e.a,e.b*E(t)):Ar((e=>x(t,e)),...e);if(t instanceof o)return"number"==typeof e?o.fromExpo(t.z**e,t.phi*e):e instanceof o?o.fromExpo(t.z**e.a*C(-t.phi*e.b),E(t.z)*e.b+e.a*t.phi):Ar((e=>x(t,e)),...e);if(t instanceof Array){if("number"==typeof e)return Ar((t=>x(t,e)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(Ar((e=>x(t[r],e)),...e));return s}}},F=(t,e)=>{if("number"==typeof t)return"number"==typeof e?Math.pow(t,1/e):Ar((e=>F(t,e)),...e);if(t instanceof o)return"number"==typeof e?o.fromExpo(F(t.z,e),t.phi/e):Ar((e=>F(t,e)),...e);if(t instanceof Array){if("number"==typeof e)return Ar((t=>F(t,e)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(Ar((e=>F(t[r],e)),...e));return s}}},C=(...t)=>Ar(Math.exp,...t),E=(...t)=>Ar(Math.log,...t),k=(...t)=>Ar(y.cos,...t),A=(...t)=>Ar(y.sin,...t),D=(...t)=>Ar(y.tan,...t),B=(...t)=>Ar(y.sec,...t),_=(...t)=>Ar(y.sinc,...t),T=(...t)=>Ar(y.csc,...t),M=(...t)=>Ar(y.cot,...t),I=(...t)=>Ar(y.acos,...t),S=(...t)=>Ar(y.asin,...t),L=(...t)=>Ar(y.atan,...t),O=(...t)=>Ar(y.acot,...t),j=(...t)=>Ar(y.cosh,...t),R=(...t)=>Ar(y.sinh,...t),P=(...t)=>Ar(y.tanh,...t),V=(...t)=>Ar(y.coth,...t),N=(...t)=>Ar(y.acosh,...t),$=(...t)=>Ar(y.asinh,...t),U=(...t)=>Ar(y.atanh,...t),H=(...t)=>Ar(Math.ceil,...t),Z=(...t)=>Ar(Math.floor,...t),q=(...t)=>Ar(Math.round,...t),W=(t,e,s=!0)=>{if("number"==typeof t)return"number"==typeof e?s?Math.atan2(t,e):180*Math.atan2(t,e)/Math.PI:Ar((e=>W(t,e,s)),...e);if(t instanceof Array){if("number"==typeof e)return Ar((t=>W(t,e,s)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(Ar((e=>x(t[r],e)),...e));return s}}},X=(...t)=>Ar((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),Y=(...t)=>Ar(Math.sign,...t),K=(...t)=>Ar((t=>1/(1+C(-t))),...t),Q=(...t)=>t.every((t=>"number"==typeof t))?Math.hypot(...t):t.every((t=>t instanceof Array))?Ar(Math.hypot,...t):void 0,G=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},J=null,tt={_mode:Number,_map:function(t,e,s){return e instanceof vr?new vr(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof o?new o(t(e.a,s),t(e.b,s)):e instanceof Array?e.map((e=>t(e,s))):void 0},dec2base(t,e){return this._mode=e<=10?Number:String,"number"==typeof t?this._mode((t>>>0).toString(e)):this._map(this.dec2base,t,e)},dec2bin(t){return this.dec2base(t,2)},dec2oct(t){return this.dec2base(t,8)},dec2hex(t){return this.dec2base(t,16)},bin2base(t,e){return this.dec2base(this.bin2dec(t),e)},bin2dec(t){return this._mode("0b"+t)},bin2oct(t){return this.bin2base(t,8)},bin2hex(t){return this.bin2base(t,16)},oct2dec(t){return this._mode("0o"+t)},oct2bin(t){return this.dec2bin(this.oct2dec(t))},oct2hex(t){return this.dec2hex(this.oct2dec(t))},oct2base(t,e){return this.dec2base(this.oct2dec(t),e)},hex2dec(t){return this._mode("0x"+t)},hex2bin(t){return this.dec2bin(this.hex2dec(t))},hex2oct(t){return this.dec2oct(this.hex2dec(t))},hex2base(t,e){return this.dec2base(this.hex2dec(t),e)},IEEE32toDec(t){let e=t.split(" ").join("").padEnd(32,"0"),s=e[0],r=2**(+("0b"+e.slice(1,9))-127);return(-1)**s*(1+e.slice(9,32).split("").map((t=>+t)).map(((t,e)=>t*2**(-e-1))).reduce(((t,e)=>t+e),0))*r},IEEE64toDec(t){let e=t.split(" ").join("").padEnd(64,"0"),s=e[0],r=2**(+("0b"+e.slice(1,12))-1023);return(-1)**s*(1+e.slice(13,64).split("").map((t=>+t)).map(((t,e)=>t*2**(-e-1))).reduce(((t,e)=>t+e),0))*r}},et={_mode:Number,_map:function(t,e,s){return e instanceof vr?new vr(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof o?new o(t(e.a,s),t(e.b,s)):e instanceof Array?e.map((e=>t(e,s))):void 0},not:function(t){return["number","boolean"].includes(typeof t)?et._mode(!t):this._map(this.not,t)},and:function(t,...e){return["number","boolean"].includes(typeof t)?et._mode(e.reduce(((t,e)=>t&e),t)):this._map(this.and,t,e)},or:function(t,...e){return["number","boolean"].includes(typeof t)?et._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 et.not(et.xor(t,e))}};class st{static withDiscount(t,e=t.length){if(1===e)return t.map((t=>[t]));const s=[];let r;return r=this.withDiscount(t,e-1),t.forEach((t=>{r.forEach((e=>{s.push([t].concat(e))}))})),s}static withoutDiscount(t){if(1===t.length)return t.map((t=>[t]));const e=[],s=this.withoutDiscount(t.slice(1)),r=t[0];for(let t=0;t<s.length;t++){const n=s[t];for(let t=0;t<=n.length;t++){const s=n.slice(0,t),i=n.slice(t);e.push(s.concat([r],i))}}return e}}class rt{static withDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((r,n)=>{this.withDiscount(t.slice(n),e-1).forEach((t=>{s.push([r].concat(t))}))})),s}static withoutDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((r,n)=>{this.withoutDiscount(t.slice(n+1),e-1).forEach((t=>{s.push([r].concat(t))}))})),s}}const nt={Logic:et,Base:tt,Permutation:st,Combinaison:rt,combinaison:(t,e,s=!1)=>rt[s?"withDiscount":"withoutDiscount"](t,e),powerSet:G,subSet:J};class it{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=en.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 xr(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"#"+tt.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 o(this.float(t[0],t[1]),this.float(e[0],e[1])):new o(...this.floats(2,t,e))}static complexInt(t=[0,1],e=[0,1]){return new o(this.int(t[0],t[1]),this.int(e[0],e[1]))}static complexBin(){return new o(...this.bins(2))}static complexOct(){return new o(...this.octs(2))}static complexDec(){return new o(...this.decs(10))}static complexHex(){return new o(...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 xr(t,e,this.floats(t*e,s,r))}static matrixInt(t,e,s,r){return xr(t,e,this.ints(t*e,s,r))}static matrixBin(t,e){return xr(t,e,this.bins(t*e))}static matrixOct(t,e){return xr(t,e,this.octs(t*e))}static matrixDec(t,e){return xr(t,e,this.decs(t*e))}static matrixHex(t,e){return xr(t,e,this.hex(t*e))}static matrixColor(t,e){return xr(t,e,this.colors(t*e))}static matrixComplex(t,e,s,r){return xr(t,e,this.complexes(t*e,s,r))}static matrixComplexInt(t,e,s,r){return xr(t,e,this.complexesInt(t*e,s,r))}static matrixComplexBin(t,e){return xr(t,e,this.complexesBin(t*e))}static matrixComplexOct(t,e){return xr(t,e,this.complexesBin(t*e))}static matrixComplexDec(t,e){return xr(t,e,this.complexesBin(t*e))}static matrixComplexHex(t,e){return xr(t,e,this.complexesBin(t*e))}}const ot=t=>{t instanceof vr&&(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 n=0;n<e;n++){for(let i=n;i<e;i++){let e=0;for(let t=0;t<n;t++)e+=s[n][t]*r[t][i];r[n][i]=t[n][i]-e}for(let i=n;i<e;i++)if(n==i)s[n][n]=1;else{let e=0;for(let t=0;t<n;t++)e+=s[i][t]*r[t][n];s[i][n]=(t[i][n]-e)/r[n][n]}}return[s,r].map((t=>new vr(t)))},at=(t,e)=>t.reduce(((t,s,r)=>t+s*e[r]),0),ht=t=>Math.sqrt(t.reduce(((t,e)=>t+e*e),0)),lt=t=>t.map((e=>e/ht(t))),ct=t=>{t instanceof vr&&(t=t.arr);const e=t.length,s=t[0].length,r=[],n=[];for(let t=0;t<e;t++)n.push(new Array(s).fill(0));for(let i=0;i<s;i++){let s=t.map((t=>t[i]));for(let o=0;o<i;o++){const a=r[o],h=at(a,t.map((t=>t[i])));for(let t=0;t<e;t++)s[t]-=h*a[t];n[o][i]=h}const o=ht(s);r.push(lt(s)),n[i][i]=o}return[r,n].map((t=>new vr(t)))},ut=t=>{t instanceof vr&&(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 n=0;for(let t=0;t<e;t++)n+=s[r][t]*s[e][t];s[r][e]=r===e?Math.sqrt(t[r][r]-n):1/s[e][e]*(t[r][e]-n)}return new vr(s)},pt=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>"),mt=t=>`<tr>${t.split("|").map((t=>t.trim())).filter((t=>""!==t)).map((t=>`<td>${pt(t)}</td>`)).join("")}</tr>\n`,dt=(t,e)=>{const s=t.join("\n");return`${e?`<pre><code data-language="${e}">${s}</code></pre>`:`<pre><code>${s}</code></pre>`}\n`},gt=t=>{const e=t.match(/^\d+\.\s/);if(e){let s=+e[1];return`<ol${1===s?"":` start="${s}"`}>${pt(t.slice(e[0].length))}</ol>\n`}return`<ul>${pt(t)}</ul>\n`},ft=t=>{const e=t.split("\n");let s="",r=!1,n=!1,i=[],o="";for(let t=0;t<e.length;t++){let a=e[t];if(a.startsWith("|"))r||(r=!0,s+="<table>\n"),s+=mt(a);else if(r&&(r=!1,s+="</table>\n"),a.startsWith("```"))n?(n=!1,s+=dt(i,o)):(n=!0,i=[],o=a.slice(3).trim());else if(n)i.push(a);else if(a.startsWith("# ")){const t=a.indexOf(" "),e=a.slice(t+1);s+=`<h${t}>${pt(e)}</h${t}>\n`}else a.startsWith("- ")||a.startsWith("* ")||a.match(/^\d+\.\s/)?s+=gt(a):"---"!==a.trim()?s+=`<p>${pt(a)}</p>\n`:s+="<hr>\n"}return s},bt=t=>t.replace(/\*(.*?)\*/g,"_$1_").replace(/\*\*(.*?)\*\*/g,"*$1*").replace(/\[(.*?)\]\((.*?)\)/g,"link:$2[$1]").replace(/!\[(.*?)\]\((.*?)\)/g,"image::$2[$1]").replace(/`([^`]+)`/g,"``$1``").replace(/^\*\s/,""),yt=t=>`<tr>${t.split("|").map((t=>t.trim())).filter((t=>""!==t)).map((t=>`<td>${bt(t)}</td>`)).join("")}</tr>\n`,wt=(t,e)=>{const s=t.join("\n");return`${e?`<pre><code data-language="${e}">${s}</code></pre>`:`<pre><code>${s}</code></pre>`}\n`},vt=t=>{const e=/^(\d+)\.\s/,s=/^[.]\s/,r=/^[*]\s/;if(t.match(e)){return`<ol start="${t.match(e)[1]}"><li>${bt(t.replace(e,""))}</li></ol>\n`}return t.match(s)?`<ol><li>${bt(t.replace(s,""))}</li></ol>\n`:t.match(r)?`<ul><li>${bt(t.replace(r,""))}</li></ul>\n`:`<p>${bt(t)}</p>\n`},xt=t=>`<blockquote>${bt(t.slice(2))}</blockquote>\n`,Ft=t=>{const e=t.match(/\[(.*?)\]/);return e?e[1].split(",").map((t=>`[${t.trim()}]`)).join(""):""},Ct=t=>{const e=t.split("\n");let s="",r=!1,n=!1,i=[],o="";for(let t=0;t<e.length;t++){let a=e[t];if(a.startsWith("|"))r||(r=!0,s+="<table>\n"),s+=yt(a);else if(r&&(r=!1,s+="</table>\n"),a.startsWith("```"))n?(n=!1,s+=wt(i,o)):(n=!0,i=[],o=a.slice(3).trim());else if(n)i.push(a);else if(a.startsWith("=")){const t=(a.match(/=/g)||[]).length,e=a.replace(/=/g,"").trim();s+=`<h${t}>${bt(e)}</h${t}>\n`}else a.match(/^(\d+)\.\s/)||a.match(/^[*\.]\s/)?s+=vt(a):a.startsWith("> ")?s+=xt(a):"---"!==a.trim()?a.startsWith("[")?s+=Ft(a):""!==a.trim()&&(s+=`<p>${bt(a)}</p>\n`):s+="<hr>\n"}return s},Et=(t,e=",")=>t.trim().trimEnd().split("\n").map((t=>t.split(e))),kt=(t,e=",")=>new vr(Et(t,e)),At=(t,e=",")=>{const[s,...r]=Et(t,e);return r.map((t=>{const e={};return s.forEach(((s,r)=>{e[s]=t[r]})),e}))},Dt=(t,e=",")=>JSON.stringify(At(t,e)),Bt=(t,e)=>{const s=t.trim().trimEnd().split("\n").filter((t=>t));let r=`INSERT INTO ${e} (${s[0].split(",").join(", ")}) Values `,n=[];for(let t=1;t<s.length;t++){const e=s[t].split(",");n.push(`(${e})`)}return r+n.join(",\n")},_t=t=>t instanceof Array?[Object.keys(t[0]),...t.map((t=>Object.values(t)))]:[Object.keys(t)],Tt=(t,e)=>_t(t).map((t=>t.join(e))).join("\n"),Mt=t=>_t(t instanceof Object?t:JSON.parse(t)),It=(t,e=",")=>Tt(t instanceof Object?t:JSON.parse(t),e),St=(t,e)=>{const s=It(t,e),r=new Blob([s],{type:"text/csv;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}},Lt=(t,e)=>{const s=[];if(Array.isArray(t))t.forEach((t=>{if("object"==typeof t&&null!==t){s.push(`${e}-`);const r=Lt(t,`${e} `);s.push(...r)}else s.push(`${e}- ${t}`)}));else for(const r in t)if(t.hasOwnProperty(r)){const n=t[r];if("object"==typeof n&&null!==n){s.push(`${e}${r}:`);const t=Lt(n,`${e} `);s.push(...t)}else s.push(`${e}${r}: ${n}`)}return s},Ot=(t,e="")=>Lt(t,e).join("\n"),jt=(t,e)=>Ot(t instanceof Object?t:JSON.parse(t),e),Rt=(t,e)=>{const s=jt(t,e),r=new Blob([s],{type:"text/yml;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}},Pt=(t,e=1)=>{let s="";for(const r in t)if(t.hasOwnProperty(r)){const n=t[r];s+="\n"+" ".repeat(e)+`<${r}>`,s+="object"==typeof n?Pt(n,e+2):`${n}`,s+=`</${r}>`}return s.trim()},Vt=(t,e)=>{const s=Pt(t,e),r=new Blob([s],{type:"text/xml;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}},Nt=(t,e="px")=>("number"==typeof t&&(t+=e),t instanceof Array&&(t=t.map((t=>"number"==typeof t?t+=e:t)).join(" ")),t);class $t{constructor(t={}){this.target=null,this.styles=new Map([["default",t]]),this.cache={isHidden:!1,isFaddedOut:!1,transformation:{Flip:[0,0,0],matrix:new vr([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]])}}}style(t){return 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,{target:s,maskVector:r}={}){return this.style({width:t,height:e},{target:s,maskVector:r}),this}width(t,{target:e,maskVector:s}={}){if(t instanceof Object){if(t instanceof Array&&(t={min:t[0],max:t[1]}),"min"in t||"max"in t){let r=t.min??t.max,n=t.max??t.min;r=Nt(r,"px"),n=Nt(n,"px"),this.style({minWidth:r,maxWidth:n},{target:e,maskVector:s})}}else t=Nt(t,"px"),this.style({width:t},{target:e,maskVector:s});return this}height(t,{target:e,maskVector:s}={}){if(t instanceof Object){if(t instanceof Array&&(t={min:t[0],max:t[1]}),"min"in t||"max"in t){let r=t.min??t.max,n=t.max??t.min;r=Nt(r,"px"),n=Nt(n,"px"),this.style({minHeight:r,maxHeight:n},{target:e,maskVector:s})}}else t=Nt(t,"px"),this.style({height:t},{target:e,maskVector:s});return this}enableResize(t=!1,e=!1,{target:s,maskVector:r}={}){let n="none";return n=t?e?"both":"horizontal":e?"vertical":"none",this.style({resize:n,overflow:"hidden"},{target:s,maskVector:r}),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,{target:e,maskVector:s}={}){return this.style({color:t},{target:e,maskVector:s}),this}background(t,{target:e,maskVector:s}={}){return this.style({background:t},{target:e,maskVector:s}),this}backgroundColor(t,{target:e,maskVector:s}={}){return this.style({backgroundColor:t},{target:e,maskVector:s}),this}opacity(t,{target:e,maskVector:s}={}){return this.style({opacity:t},{target:e,maskVector:s}),this}position(t,{target:e,maskVector:s}={}){return this.style({position:t},{target:e,maskVector:s}),this}display(t,{target:e,maskVector:s}={}){return this.style({display:t},{target:e,maskVector:s}),this}zIndex(t,{target:e,maskVector:s}={}){return this.style({zIndex:t},{target:e,maskVector:s}),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,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({borderRadius:t},{target:e,maskVector:s}),this}margin(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({margin:t},{target:e,maskVector:s}),this}marginTop(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({marginTop:t},{target:e,maskVector:s}),this}marginRight(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({marginRight:t},{target:e,maskVector:s}),this}marginBootom(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({marginBootom:t},{target:e,maskVector:s}),this}marginLeft(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({marginLeft:t},{target:e,maskVector:s}),this}padding(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({padding:t},{target:e,maskVector:s}),this}paddingTop(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({paddingTop:t},{target:e,maskVector:s}),this}paddingRight(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({paddingRight:t},{target:e,maskVector:s}),this}paddingBootom(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({paddingBootom:t},{target:e,maskVector:s}),this}paddingLeft(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({paddingLeft:t},{target:e,maskVector:s}),this}font(t,{target:e,maskVector:s}={}){return this.style({font:t},{target:e,maskVector:s}),this}fontFamily(t="",{target:e,maskVector:s}={}){return this.style({fontFamily:t},{target:e,maskVector:s}),this}fontSize(t,{target:e,maskVector:s}={}){return this.style({fontSize:t},{target:e,maskVector:s}),this}cursor(t="pointer"){return this.style({cursor:t}),this}overflow(t,e,{target:s,maskVector:r}={}){const n=["hidden","auto"];return this.style({overflowX:"number"==typeof t?n[t]:t,overflowY:"number"==typeof e?n[e]:e},{target:s,maskVector:r}),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:t/1e3+"s",opacity:0}),this.cache.isFaddedOut=!0,this}fadeIn(t=1){return this.style({transition: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}#t(e){const s=this.cache.transformation.matrix.arr.join(",");this.style({transform:`matrix3d(${s})`,"-webkit-transform":`matrix3d(${s})`,"-moz-transform":`matrix3d(${s})`,"-ms-transform":`matrix3d(${s})`,"-o-transform":`matrix3d(${s})`}),0!=t&&this.style({transition:`transform ${e/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.#t(r),this}translateX(t,e=0){return this.cache.transformation.matrix.set(3,0,t),this.#t(e),this}translateY(t,e=0){return this.cache.transformation.matrix.set(3,1,t),this.#t(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.#t(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.#t(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.#t(s),this}scaleX(t=1,e=0){return this.cache.transformation.matrix.set(0,0,t),this.#t(e),this}scaleY(t=1,e=0){return this.cache.transformation.matrix.set(1,1,t),this.cache.transformation.matrix.arr.join(","),this.#t(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.#t(s),this}skewX(t=1,e=0){return this.cache.transformation.matrix.set(0,1,t),this.cache.transformation.matrix.arr.join(","),this.#t(e),this}skewY(t=1,e=0){return this.cache.transformation.matrix.set(1,0,t),this.cache.transformation.matrix.arr.join(","),this.#t(e),this}rotateX(t,e=0){return this.cache.transformation.matrix.set(1,1,k(t)),this.cache.transformation.matrix.set(1,2,-A(t)),this.cache.transformation.matrix.set(2,1,A(t)),this.cache.transformation.matrix.set(1,2,k(t)),this.#t(e),this}rotateY(t,e=0){return this.cache.transformation.matrix.set(0,0,k(t)),this.cache.transformation.matrix.set(0,2,A(t)),this.cache.transformation.matrix.set(2,0,-A(t)),this.cache.transformation.matrix.set(2,2,k(t)),this.#t(e),this}rotateZ(t,e=0){return this.cache.transformation.matrix.set(0,0,k(t)),this.cache.transformation.matrix.set(0,1,-A(t)),this.cache.transformation.matrix.set(1,0,A(t)),this.cache.transformation.matrix.set(1,1,k(t)),this.#t(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.addEventListener("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}}class zt{constructor(t={},e=(t.hasOwnProperty("default")?"default":Object.keys(t)[0]),s=0){this.id="Ziko-Style-"+s,this.keys=new Set,this.styles={default:{fontSize:"1em",color:"green"},other:{fontSize:"2em",color:"cyan"}},t&&this.add(t),e&&this.use(e)}get current(){return[...this.keys].reduce(((t,e)=>(t[e]=`var(--${e}-${this.id})`,t)),{})}add(t,e={}){return t&&"object"==typeof t&&!Array.isArray(t)?Object.assign(this.styles,t):"string"==typeof t&&Object.assign(this.styles,{[t]:e}),this}#e(t){const e=Object.keys(this.styles);for(let s in this.styles[e[t]])Object.prototype.hasOwnProperty.call(this.styles[e[t]],s)&&(document.documentElement.style.setProperty(`--${s}-${this.id}`,this.styles[e[t]][s]),this.keys.add(s));return this}#s(t){if(!this.styles[t])return this;for(let e in this.styles[t])Object.prototype.hasOwnProperty.call(this.styles[t],e)&&(document.documentElement.style.setProperty(`--${e}-${this.id}`,this.styles[t][e]),this.keys.add(e));return this}#r(t){for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(document.documentElement.style.setProperty(`--${e}-${this.id}`,t[e]),this.keys.add(e));return this}use(t){return"number"==typeof t?this.#e(t):"string"==typeof t?this.#s(t):t&&"object"==typeof t?this.#r(t):this}}const Ut=(t,e,s)=>new zt(t,e,s),Ht={cozyCottonCandy:{background:"#FCE4EC",currentLine:"#F8BBD0",selection:"#FFCDD2",foreground:"#673AB7",comment:"#9575CD",cyan:"#00BCD4",green:"#4CAF50",orange:"#FF9800",pink:"#E91E63",purple:"#9C27B0",red:"#F44336",yellow:"#FFEB3B"},crystalClear:{background:"#F6F8FA",currentLine:"#E8F0F5",selection:"#D4E9F7",foreground:"#485766",comment:"#8492A6",cyan:"#00ACC1",green:"#8BC34A",orange:"#FFA726",pink:"#FF4081",purple:"#7E57C2",red:"#EF5350",yellow:"#FFD740"},lightdreamyDusk:{background:"#F5F5F5",currentLine:"#E8E8E8",selection:"#DADADA",foreground:"#555555",comment:"#999999",cyan:"#5FB3B3",green:"#68C386",orange:"#FFB67A",pink:"#FF94B0",purple:"#B78BC3",red:"#FF6666",yellow:"#FFD666"},luminousLavender:{background:"#F3E5F5",currentLine:"#E1BEE7",selection:"#CE93D8",foreground:"#311B92",comment:"#673AB7",cyan:"#00BCD4",green:"#8BC34A",orange:"#FF9800",pink:"#E91E63",purple:"#9C27B0",red:"#F44336",yellow:"#FFEB3B"},meadowMornings:{background:"#F3E5F5",currentLine:"#E1BEE7",selection:"#CE93D8",foreground:"#311B92",comment:"#673AB7",cyan:"#00BCD4",green:"#8BC34A",orange:"#FF9800",pink:"#E91E63",purple:"#9C27B0",red:"#F44336",yellow:"#FFEB3B"},moonlitMauve:{background:"#F3E5F5",currentLine:"#E1BEE7",selection:"#CE93D8",foreground:"#311B92",comment:"#673AB7",cyan:"#00BCD4",green:"#8BC34A",orange:"#FF9800",pink:"#E91E63",purple:"#9C27B0",red:"#F44336",yellow:"#FFEB3B"},morningMist:{background:"#F6F6F6",currentLine:"#EAEAEA",selection:"#D8D8D8",foreground:"#333333",comment:"#808080",cyan:"#00A6A6",green:"#4CAF50",orange:"#FFA726",pink:"#FF4081",purple:"#9C27B0",red:"#FF5252",yellow:"#FFD740"},oceanBreeze:{background:"#ECF1F4",currentLine:"#DDE8ED",selection:"#BFD3C1",foreground:"#37474F",comment:"#607D8B",cyan:"#00BCD4",green:"#8BC34A",orange:"#FF9800",pink:"#E91E63",purple:"#673AB7",red:"#F44336",yellow:"#FFEB3B"},pastelParadise:{background:"#F5F5F5",currentLine:"#E8E8E8",selection:"#DADADA",foreground:"#555555",comment:"#999999",cyan:"#5FB3B3",green:"#68C386",orange:"#FFB67A",pink:"#FF94B0",purple:"#B78BC3",red:"#FF6666",yellow:"#FFD666"},pastelPetals:{background:"#FCE4EC",currentLine:"#F8BBD0",selection:"#FFCDD2",foreground:"#673AB7",comment:"#9575CD",cyan:"#00BCD4",green:"#4CAF50",orange:"#FF9800",pink:"#E91E63",purple:"#9C27B0",red:"#F44336",yellow:"#FFEB3B"},sereneSnowfall:{background:"#F9F9F9",currentLine:"#EDEDED",selection:"#D8D8D8",foreground:"#454545",comment:"#888888",cyan:"#5FA5A5",green:"#5BC47E",orange:"#FFBC8D",pink:"#FFA7BF",purple:"#B88AAE",red:"#FF7575",yellow:"#FFD98F"},softSherbet:{background:"#FDF8F3",currentLine:"#FAF1EB",selection:"#FFEBEE",foreground:"#6D4C41",comment:"#A1887F",cyan:"#00BCD4",green:"#689F38",orange:"#FFA000",pink:"#EC407A",purple:"#8E24AA",red:"#E53935",yellow:"#FFC107"},subtleSerenity:{background:"#F3F5F7",currentLine:"#E8EDF2",selection:"#D1D9E6",foreground:"#2C3E50",comment:"#95A5A6",cyan:"#3498DB",green:"#2ECC71",orange:"#F39C12",pink:"#E74C3C",purple:"#9B59B6",red:"#C0392B",yellow:"#F1C40F"},summerSunset:{background:"#FCE4EC",currentLine:"#F8BBD0",selection:"#FFCDD2",foreground:"#4E342E",comment:"#795548",cyan:"#009688",green:"#43A047",orange:"#FF5722",pink:"#E91E63",purple:"#9C27B0",red:"#F44336",yellow:"#FFEB3B"},sunnyDay:{background:"#FFF8E1",currentLine:"#FFF3E0",selection:"#FFE0B2",foreground:"#4E342E",comment:"#795548",cyan:"#00BCD4",green:"#8BC34A",orange:"#FF9800",pink:"#E91E63",purple:"#673AB7",red:"#F44336",yellow:"#FFEB3B"},tranquilTwilight:{background:"#F9F9F9",currentLine:"#EDEDED",selection:"#D8D8D8",foreground:"#454545",comment:"#888888",cyan:"#5FA5A5",green:"#5BC47E",orange:"#FFBC8D",pink:"#FFA7BF",purple:"#B88AAE",red:"#FF7575",yellow:"#FFD98F"},tranquilWaves:{background:"#F9F9F9",currentLine:"#E4E4E4",selection:"#D4D4D4",foreground:"#2C3E50",comment:"#7F8C8D",cyan:"#3498DB",green:"#2ECC71",orange:"#F39C12",pink:"#E74C3C",purple:"#9B59B6",red:"#C0392B",yellow:"#F1C40F"},whisperingWillow:{background:"#F6F8FA",currentLine:"#E8F0F5",selection:"#D4E9F7",foreground:"#485766",comment:"#8492A6",cyan:"#00ACC1",green:"#8BC34A",orange:"#FFA726",pink:"#FF4081",purple:"#7E57C2",red:"#EF5350",yellow:"#FFD740"}},Zt={antiqueRose:{background:"#1C1014",currentLine:"#2B1B21",selection:"#443034",foreground:"#D8B5B5",comment:"#7F5E5E",cyan:"#6FA2A2",green:"#66A66F",orange:"#FFB97A",pink:"#FFA8BD",purple:"#B78DA5",red:"#FF6C6C",yellow:"#FFD579"},auroraBorealis:{background:"#1D1426",currentLine:"#2B1E35",selection:"#432D4E",foreground:"#C2AABF",comment:"#7F6E8E",cyan:"#7EA5D3",green:"#77C992",orange:"#FFC476",pink:"#FFA8B3",purple:"#AE9AC3",red:"#FF6C6C",yellow:"#FFD576"},autumnHarvest:{background:"#291C10",currentLine:"#3A2A1E",selection:"#573C2C",foreground:"#D4C3A2",comment:"#7F6F52",cyan:"#82B4BF",green:"#7FB074",orange:"#FFAB6E",pink:"#FF8196",purple:"#B394A9",red:"#FF6565",yellow:"#FFD270"},aylin:{background:"#13161E",currentLine:"#161A28",selection:"#222B3E",foreground:"#D2D8E0",comment:"#697098",cyan:"#78D1E1",green:"#98C379",orange:"#EBCB8B",pink:"#D16D9E",purple:"#C678DD",red:"#E88388",yellow:"#EBCB8B"},azureBlue:{background:"#001B29",currentLine:"#002C3E",selection:"#004E6B",foreground:"#C3D7E2",comment:"#5F7C92",cyan:"#75B7D1",green:"#70C8A7",orange:"#FFB476",pink:"#FF92B0",purple:"#B88BC3",red:"#FF6666",yellow:"#FFD666"},cobalt2:{background:"#193549",currentLine:"#1F4662",selection:"#193549",foreground:"#B9BED0",comment:"#627D98",cyan:"#4DB5BD",green:"#86B300",orange:"#FFB86C",pink:"#FF7F7B",purple:"#9B64FB",red:"#FF6672",yellow:"#FFCC99"},cobaltMaterialTheme:{background:"#263238",currentLine:"#37474F",selection:"#80CBC4",foreground:"#CFD8DC",comment:"#78909C",cyan:"#80CBC4",green:"#A5D6A7",orange:"#FFD54F",pink:"#FF80AB",purple:"#CE93D8",red:"#EF5350",yellow:"#FFEE58"},cosmicBlue:{background:"#1B2836",currentLine:"#223348",selection:"#39516D",foreground:"#C0D4E5",comment:"#728CAB",cyan:"#75A6FF",green:"#5ED99F",orange:"#FFAD6F",pink:"#FF90B6",purple:"#A889C5",red:"#FF6E6E",yellow:"#FCD256"},cosmicSunset:{background:"#1B1921",currentLine:"#272530",selection:"#3C3948",foreground:"#B8B4CB",comment:"#7A738B",cyan:"#77B4D8",green:"#6CC09E",orange:"#FFA677",pink:"#FF95B2",purple:"#B48FC1",red:"#FF6565",yellow:"#FFD566"},cyberForest:{background:"#0D151D",currentLine:"#18262F",selection:"#2B3B47",foreground:"#CDD7E0",comment:"#667B8B",cyan:"#7EC4CF",green:"#68CC96",orange:"#FFAC6C",pink:"#FF89B4",purple:"#A889C5",red:"#FF6565",yellow:"#FFCB6B"},cyberPunkCity:{background:"#000000",currentLine:"#121212",selection:"#1F1F1F",foreground:"#DADADA",comment:"#626262",cyan:"#71B7FF",green:"#50D890",orange:"#FFB86C",pink:"#FF79C6",purple:"#BB86FC",red:"#FF5454",yellow:"#FDD663"},cyberpunkNeon:{background:"#121212",currentLine:"#1B1B1B",selection:"#262626",foreground:"#DADADA",comment:"#6C6C6C",cyan:"#69AEDB",green:"#4ECCA3",orange:"#FFB86C",pink:"#FF79C6",purple:"#D08EFF",red:"#FF5454",yellow:"#FDD663"},darkDesert:{background:"#1E2022",currentLine:"#282A2E",selection:"#393D42",foreground:"#C0C5CE",comment:"#5C6368",cyan:"#6FB3E0",green:"#88C076",orange:"#FFB454",pink:"#FF7F90",purple:"#B48EAD",red:"#FF6666",yellow:"#FFCC66"},darkMint:{background:"#11161A",currentLine:"#1B2128",selection:"#3D4853",foreground:"#D9DEE5",comment:"#65737E",cyan:"#88C0D0",green:"#98C379",orange:"#FFB86C",pink:"#FF7F8B",purple:"#C594C5",red:"#FF6561",yellow:"#FAD07B"},deepOcean:{background:"#121C2C",currentLine:"#182236",selection:"#2B3E50",foreground:"#BDC3C7",comment:"#6C7A89",cyan:"#59ABE3",green:"#26A65B",orange:"#F9690E",pink:"#EB3B5A",purple:"#D2527F",red:"#E74C3C",yellow:"#F5AB35"},deepOceanBlue:{background:"#1B2F40",currentLine:"#263B53",selection:"#3A536E",foreground:"#BFC9D4",comment:"#657C8E",cyan:"#6CB5FF",green:"#65C287",orange:"#FFA974",pink:"#FF87B4",purple:"#AE9BFF",red:"#FF6666",yellow:"#FFD67B"},deepOceanSunset:{background:"#151D2A",currentLine:"#1D2735",selection:"#31405B",foreground:"#D5D9E0",comment:"#6C7B8B",cyan:"#6FAAD4",green:"#66C295",orange:"#FFA476",pink:"#FF94B0",purple:"#B08FC0",red:"#FF6565",yellow:"#FFD466"},deepSpace:{background:"#0F1419",currentLine:"#1A232D",selection:"#3A4758",foreground:"#CDD9E5",comment:"#657C96",cyan:"#6CB6FF",green:"#4CAF50",orange:"#FFB454",pink:"#FF75B5",purple:"#9A76FF",red:"#FF5555",yellow:"#FFC857"},dracula:{background:"#282a36",currentLine:"#44475a",selection:"#44475a",foreground:"#f8f8f2",comment:"#6272a4",cyan:"#8be9fd",green:"#50fa7b",orange:"#ffb86c",pink:"#ff79c6",purple:"#bd93f9",red:"#ff5555",yellow:"#f1fa8c"},dreamyDusk:{background:"#22243D",currentLine:"#313558",selection:"#4C4F6D",foreground:"#A5A7C5",comment:"#6F728E",cyan:"#81A2BE",green:"#7FB074",orange:"#FFB476",pink:"#FF91A4",purple:"#AE8DC2",red:"#FF7272",yellow:"#FFD67A"},electricLagoon:{background:"#15232B",currentLine:"#20323E",selection:"#344E5F",foreground:"#A6C0B9",comment:"#6C8F81",cyan:"#80C7D1",green:"#7FCD97",orange:"#FFBC76",pink:"#FF9FB3",purple:"#AE8FC3",red:"#FF7272",yellow:"#FFD674"},emeraldCity:{background:"#112E26",currentLine:"#1B3F38",selection:"#2F6253",foreground:"#A6C0B9",comment:"#6C8F81",cyan:"#80C7D1",green:"#7FCD97",orange:"#FFBC76",pink:"#FF9FB3",purple:"#AE8FC3",red:"#FF7272",yellow:"#FFD674"},enchantedEclipse:{background:"#131A22",currentLine:"#1F2C3A",selection:"#2D4455",foreground:"#A7B6C2",comment:"#6B7B8C",cyan:"#5FA8D3",green:"#5CB8A4",orange:"#FFA96C",pink:"#FF8FA2",purple:"#A88ED1",red:"#FF6B6B",yellow:"#FFD575"},enchantedEvening:{background:"#1E1824",currentLine:"#2A2332",selection:"#3F3A4F",foreground:"#C2B4CB",comment:"#7F7292",cyan:"#76AAD8",green:"#6CC095",orange:"#FFB36C",pink:"#FF8FB0",purple:"#AB8CC2",red:"#FF6464",yellow:"#FFD164"},fireAndIce:{background:"#1F2532",currentLine:"#292F3D",selection:"#4E556A",foreground:"#D8DEE9",comment:"#69758E",cyan:"#7EC4CF",green:"#68CC98",orange:"#FFA071",pink:"#FF88B5",purple:"#AE9BFF",red:"#FF657E",yellow:"#FDCB83"},forestGreen:{background:"#1A1E22",currentLine:"#24292F",selection:"#394147",foreground:"#C8C8C8",comment:"#5C6370",cyan:"#7AAB9D",green:"#88B379",orange:"#FFAC6F",pink:"#F97B77",purple:"#A187BE",red:"#FF5C5C",yellow:"#F5D76E"},futuristicBlue:{background:"#111B26",currentLine:"#1B2E3F",selection:"#334D65",foreground:"#C0D2E3",comment:"#6E859E",cyan:"#77AADB",green:"#78C196",orange:"#FFAC6C",pink:"#FF8DBE",purple:"#A48ADA",red:"#FF6666",yellow:"#FFD66D"},gentlePurple:{background:"#2E2E3D",currentLine:"#383849",selection:"#4D4D5C",foreground:"#B2B2CC",comment:"#6E6E8F",cyan:"#6D77CC",green:"#81C995",orange:"#FFB16A",pink:"#FF7CAC",purple:"#8A80A1",red:"#FF657A",yellow:"#FDB26E"},githubDarkDimmed:{background:"#0D1117",currentLine:"#161B22",selection:"#1F6F8B",foreground:"#8B949E",comment:"#8B949E",cyan:"#79C0FF",green:"#2DD57A",orange:"#FFB454",pink:"#FF80AB",purple:"#D781D3",red:"#EF5252",yellow:"#D29922"},gruvbox:{background:"#282828",currentLine:"#3c3836",selection:"#bdae93",foreground:"#ebdbb2",comment:"#928374",cyan:"#83a598",green:"#b8bb26",orange:"#fe8019",pink:"#d3869b",purple:"#d3869b",red:"#fb4934",yellow:"#fabd2f"},materialTheme:{background:"#263238",currentLine:"#37474f",selection:"#90a4ae",foreground:"#eceff1",comment:"#546e7a",cyan:"#80cbc4",green:"#a5d6a7",orange:"#ffb74d",pink:"#f06292",purple:"#ba68c8",red:"#ef5350",yellow:"#ffee58"},midnightMystique:{background:"#1E1E27",currentLine:"#292935",selection:"#3F3F4F",foreground:"#C2C2D3",comment:"#757593",cyan:"#76D4D6",green:"#6CC18F",orange:"#FFB36C",pink:"#FF8FAB",purple:"#AB8BC7",red:"#FF6464",yellow:"#FFD164"},midnightSunset:{background:"#182233",currentLine:"#1D2D46",selection:"#384B66",foreground:"#B7C0CE",comment:"#6A788A",cyan:"#6B98FF",green:"#6BD49D",orange:"#FFA178",pink:"#FF8DAB",purple:"#B48EAD",red:"#F96263",yellow:"#FADA5E"},minimalMonochrome:{background:"#1C1C1C",currentLine:"#262626",selection:"#363636",foreground:"#D9D9D9",comment:"#757575",cyan:"#7DC1C7",green:"#7FB074",orange:"#FFB869",pink:"#FF81A2",purple:"#B48EAD",red:"#FF6B6B",yellow:"#FFD57B"},modernMarine:{background:"#0A0E19",currentLine:"#121929",selection:"#1E2B42",foreground:"#D5D8DE",comment:"#7F8493",cyan:"#6FB1D3",green:"#6CC792",orange:"#FFB577",pink:"#FF96B0",purple:"#B690C2",red:"#FF6666",yellow:"#FFD666"},monokai:{background:"#272822",currentLine:"#3e3d32",selection:"#49483e",foreground:"#f8f8f2",comment:"#75715e",cyan:"#66d9ef",green:"#a6e22e",orange:"#fd971f",pink:"#f92672",purple:"#ae81ff",red:"#f92672",yellow:"#e6db74"},moonlitMeadow:{background:"#12252C",currentLine:"#1D3B47",selection:"#24566E",foreground:"#A7C4BC",comment:"#5E7D84",cyan:"#82B7BD",green:"#87C38A",orange:"#F4B66A",pink:"#F77A92",purple:"#C58AC9",red:"#F0725E",yellow:"#E8C284"},mysticalMauve:{background:"#1A1A26",currentLine:"#252533",selection:"#3E3E57",foreground:"#B2B2CC",comment:"#757593",cyan:"#76D4D6",green:"#6CC18F",orange:"#FFB36C",pink:"#FF8FAB",purple:"#AB8BC7",red:"#FF6464",yellow:"#FFD164"},nebulaNights:{background:"#1B1821",currentLine:"#262330",selection:"#3C3A48",foreground:"#B8B4CB",comment:"#7A738B",cyan:"#77B4D8",green:"#6CC09E",orange:"#FFA677",pink:"#FF95B2",purple:"#B48FC1",red:"#FF6565",yellow:"#FFD566"},neonLights:{background:"#000000",currentLine:"#0D0D0D",selection:"#1A1A1A",foreground:"#DADADA",comment:"#7F7F7F",cyan:"#6FE3E3",green:"#60FFA0",orange:"#FFB67A",pink:"#FF9FBD",purple:"#BF8CC2",red:"#FF6666",yellow:"#FFD666"},nightSky:{background:"#17202A",currentLine:"#1C2732",selection:"#2E4053",foreground:"#D0D3D4",comment:"#566573",cyan:"#5DADE2",green:"#45B39D",orange:"#F5B041",pink:"#EB984E",purple:"#AF7AC5",red:"#EC7063",yellow:"#F4D03F"},nord:{background:"#2e3440",currentLine:"#3b4252",selection:"#4c566a",foreground:"#d8dee9",comment:"#616e88",cyan:"#88c0d0",green:"#a3be8c",orange:"#ebcb8b",pink:"#bf616a",purple:"#b48ead",red:"#bf616a",yellow:"#ebcb8b"},nova:{background:"#1F262D",currentLine:"#232A32",selection:"#414B56",foreground:"#D9E2EC",comment:"#525F69",cyan:"#89DDFF",green:"#64D989",orange:"#E7C664",pink:"#E95678",purple:"#C594C5",red:"#FF5656",yellow:"#FFC172"},novaDark:{background:"#1A2026",currentLine:"#212930",selection:"#36424F",foreground:"#C0C6D9",comment:"#5B6C7F",cyan:"#84CEE4",green:"#89DD6D",orange:"#FFB46E",pink:"#FF7CAB",purple:"#BB80B3",red:"#FC6161",yellow:"#FAB795"},oceanBlue:{background:"#12232E",currentLine:"#1D3B53",selection:"#205072",foreground:"#A8DADC",comment:"#5E81AC",cyan:"#7FB2F0",green:"#88C0D0",orange:"#FFB86C",pink:"#FFA0A0",purple:"#D4A3D9",red:"#EF8E8E",yellow:"#FFD180"},oceanicAzure:{background:"#001A23",currentLine:"#002B36",selection:"#004056",foreground:"#C0C5CE",comment:"#4D5767",cyan:"#75A4C0",green:"#68A3A8",orange:"#FFA45E",pink:"#FF94B0",purple:"#B48EAD",red:"#FF6363",yellow:"#FFD464"},oceanicGruvbox:{background:"#1d2021",currentLine:"#282828",selection:"#458588",foreground:"#ebdbb2",comment:"#928374",cyan:"#89b482",green:"#a9b665",orange:"#d79921",pink:"#d3869b",purple:"#b16286",red:"#fb4934",yellow:"#d5c4a1"},oceanicNext:{background:"#1B2B34",currentLine:"#343D46",selection:"#4F5B66",foreground:"#A7ADBA",comment:"#616E7C",cyan:"#7FB5DA",green:"#98C379",orange:"#EBCB8B",pink:"#EC5f67",purple:"#C594C5",red:"#EC5f67",yellow:"#D29922"},oneDark:{background:"#282c34",currentLine:"#3e4451",selection:"#4f5b66",foreground:"#abb2bf",comment:"#5c6370",cyan:"#56b6c2",green:"#98c379",orange:"#d19a66",pink:"#c678dd",purple:"#c678dd",red:"#e06c75",yellow:"#e5c07b"},polarNight:{background:"#2E3440",currentLine:"#3B4252",selection:"#4C566A",foreground:"#D8DEE9",comment:"#616E88",cyan:"#81A1C1",green:"#A3BE8C",orange:"#EBCB8B",pink:"#BF616A",purple:"#B48EAD",red:"#BF616A",yellow:"#EBCB8B"},radiantRainforest:{background:"#16231A",currentLine:"#1F3927",selection:"#355D43",foreground:"#A7C9A2",comment:"#6F8D77",cyan:"#80C3BB",green:"#76CC8F",orange:"#FFB56C",pink:"#FF8FA6",purple:"#AB8CC2",red:"#FF6C6C",yellow:"#FFD576"},retroTech:{background:"#0C0C0C",currentLine:"#141414",selection:"#1F1F1F",foreground:"#D9D9D9",comment:"#626262",cyan:"#77BFC9",green:"#69CC6D",orange:"#FFC46D",pink:"#FF7D99",purple:"#BB86FC",red:"#FF5555",yellow:"#FACD60"},royalPurple:{background:"#1E1B2E",currentLine:"#272337",selection:"#3E395B",foreground:"#D5D1E2",comment:"#76708E",cyan:"#76D7C4",green:"#47B87C",orange:"#FFC300",pink:"#F39C9D",purple:"#9B59B6",red:"#E74C3C",yellow:"#F1C40F"},sapphireSkies:{background:"#081125",currentLine:"#0F1F3A",selection:"#1E3874",foreground:"#D8DCE6",comment:"#6B7394",cyan:"#7EC4D9",green:"#7DCB9E",orange:"#FFB578",pink:"#FF8FB3",purple:"#B992CC",red:"#FF6767",yellow:"#FFD684"},shadesOfPurple:{background:"#2d2b55",currentLine:"#37355a",selection:"#444267",foreground:"#ecebf0",comment:"#9a99a3",cyan:"#a1efe4",green:"#72f1b8",orange:"#f78c6c",pink:"#ffcc99",purple:"#9a99a3",red:"#ff6188",yellow:"#ffcc99"},solarizedDark:{background:"#002b36",currentLine:"#073642",selection:"#586e75",foreground:"#839496",comment:"#586e75",cyan:"#2aa198",green:"#859900",orange:"#cb4b16",pink:"#d33682",purple:"#6c71c4",red:"#dc322f",yellow:"#b58900"},synthWave84:{background:"#2b213a",currentLine:"#3e3650",selection:"#564d7a",foreground:"#e0def4",comment:"#9c8c98",cyan:"#95e6cb",green:"#00ffb9",orange:"#f28779",pink:"#f771ac",purple:"#d3bfff",red:"#ff6188",yellow:"#ffd866"},tokyoNight:{background:"#1a1b26",currentLine:"#282a36",selection:"#44475a",foreground:"#eff0eb",comment:"#6b6e76",cyan:"#78d1e1",green:"#67b11d",orange:"#e1a80e",pink:"#ff79c6",purple:"#d27bff",red:"#ff5555",yellow:"#f3f99d"},tomorrowNight:{background:"#1d1f21",currentLine:"#282a36",selection:"#373b41",foreground:"#c5c8c6",comment:"#616e7c",cyan:"#81a2be",green:"#b5bd68",orange:"#de935f",pink:"#cc6666",purple:"#b294bb",red:"#cc6666",yellow:"#f0c674"},twilightMeadow:{background:"#14202A",currentLine:"#1F2E3F",selection:"#334D65",foreground:"#A6C0B9",comment:"#6C8F81",cyan:"#80C7D1",green:"#7FCD97",orange:"#FFBC76",pink:"#FF9FB3",purple:"#AE8FC3",red:"#FF7272",yellow:"#FFD674"},urbanTwilight:{background:"#161727",currentLine:"#1F2737",selection:"#35415B",foreground:"#BDC9D7",comment:"#7F8C9C",cyan:"#77AED8",green:"#6CC492",orange:"#FFB677",pink:"#FF95B1",purple:"#B48DC2",red:"#FF6C6C",yellow:"#FFD576"},vibrantInk:{background:"#1C1E26",currentLine:"#242730",selection:"#363B4A",foreground:"#BFC7D5",comment:"#5C6672",cyan:"#6A76FB",green:"#33CC95",orange:"#FF9A65",pink:"#FF75B5",purple:"#AE81FF",red:"#FF6188",yellow:"#FDD269"},vintageRust:{background:"#301F1A",currentLine:"#3E2A23",selection:"#5D3E35",foreground:"#D7C3A7",comment:"#7F6C55",cyan:"#83A4C4",green:"#7EAD90",orange:"#FFA45E",pink:"#FF8C9E",purple:"#B491A9",red:"#FF7262",yellow:"#FFD372"}},qt={...Ht,...Zt};class Wt{constructor(t,e=0){this.id="Ziko-Theme-"+e,this.use(t)}get current(){return["background","currentLine","selection","foreground","comment","cyan","green","orange","pink","purple","red","yellow"].reduce(((t,e)=>(t[e]=`var(--${e}-${this.id})`,t)),{})}useThemeIndex(t){const e=Object.keys(qt);for(let s in qt[e[t]])document.documentElement.style.setProperty(`--${s}-${this.id}`,qt[e[t]][s]);return this}useThemeName(t){t=t.toLowerCase();const e=Object.fromEntries(Object.entries(qt).map((t=>[t[0].toLowerCase(),t[1]])));for(let s in e[t])document.documentElement.style.setProperty(`--${s}-${this.id}`,e[t][s]);return this}useThemeObject(t){for(let e in t)document.documentElement.style.setProperty(`--${e}-${this.id}`,t[e]);return this}use(t){return"number"==typeof t&&this.useThemeIndex(t),"string"==typeof t&&this.useThemeName(t),t instanceof Object&&this.useThemeObject(t),this}}const Xt=(t=0)=>(e=0)=>new Wt(e,t);class Yt{constructor(){this.events={},this.maxListeners=10}on(t,e){this.events[t]||(this.events[t]=[]),this.events[t].push(e),this.events[t].length>this.maxListeners&&console.warn(`Warning: Possible memory leak. Event '${t}' has more than ${this.maxListeners} listeners.`)}once(t,e){const s=r=>{this.off(t,s),e(r)};this.on(t,s)}off(t,e){const s=this.events[t];if(s){const t=s.indexOf(e);-1!==t&&s.splice(t,1)}}emit(t,e){const s=this.events[t];s&&s.forEach((t=>{t(e)}))}clear(t){t?delete this.events[t]:this.events={}}setMaxListener(t,e){this.maxListeners=e}removeAllListeners(t){t?this.events[t]=[]:this.events={}}}const Kt=()=>new Yt;class Qt{constructor(t=document.title,e=!0){this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}useEventEmitter(){return this.cache.Emitter=Kt(),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 Gt=(t,e)=>new Qt(t,e);class Jt{constructor(t,e=!0){this.#n(),this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}#n(){return this.__FavIcon__=document.querySelector("link[rel*='icon']")||document.createElement("link"),this.__FavIcon__.type="image/x-icon",this.__FavIcon__.rel="shortcut icon",this}set(t){return t!==this.__FavIcon__.href&&(this.__FavIcon__.href=t,this.cache.Emitter&&this.cache.Emitter.emit("ziko:favicon-changed")),this}get current(){return document.__FavIcon__.href}onChange(t){return this.cache.Emitter&&this.cache.Emitter.on("ziko:favicon-changed",t),this}useEventEmitter(){return this.cache.Emitter=Kt(),this}}const te=(t,e)=>new Jt(t,e);class ee{constructor(t=[],e=(()=>{})){this.mediaQueryRules=t,this.fallback=e,this.lastCalledCallback=null,this.init()}init(){this.mediaQueryRules.forEach((({query:t,callback:e})=>{const s=globalThis.matchMedia(t),r=()=>{const t=this.mediaQueryRules.some((({query:t})=>globalThis.matchMedia(t).matches));s.matches?(e(),this.lastCalledCallback=e):t||this.lastCalledCallback===this.fallback||(this.fallback(),this.lastCalledCallback=this.fallback)};r(),s.addListener(r)}))}}const se=(t,e)=>new ee(t,e);function re(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 ne{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 ie(t){re.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){re.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){re.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,n=this.uy,i=(r-e)/this.target.Width,o=(s-n)/this.target.Height,a=i<0?"left":i>0?"right":"none",h=o<0?"bottom":o>0?"top":"none";this.swippe={h:a,v:h,delta_x:i,delta_y:o}}),{x:this.ux,y:this.uy,t:Date.now()-this.cache.stream.t0})}function he(t){re.call(this,t,"enter",null,null)}function le(t){re.call(this,t,"leave",null,null)}function ce(t){re.call(this,t,"out",null,null)}class ue extends ne{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},paused:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1},stream:{enabled:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!1},clear:{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!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})]}},this.__controller={down:ie.bind(this),move:oe.bind(this),up:ae.bind(this),enter:he.bind(this),out:ce.bind(this),leave: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},...t),this}onMove(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("move",{down:!1,move:!0,up:!1,enter:!1,out:!1,leave:!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},...t),this}onEnter(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("enter",{down:!1,move:!1,up:!1,enter:!0,out:!1,leave:!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},...t),this}onLeave(...t){return 0===t.length&&(t=[()=>{}]),this.__onEvent("leave",{down:!1,move:!1,up:!1,enter:!1,out:!1,leave:!0},...t),this}}var pe=t=>new ue(t);class me extends ne{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:de.bind(this),move:ge.bind(this),up:fe.bind(this),enter:be.bind(this),out:we.bind(this),leave:ye.bind(this),over:ve.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 de(t){re.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 ge(t){re.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 fe(t){re.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,n=this.uy,i=(r-e)/this.target.Width,o=(s-n)/this.target.Height,a=i<0?"left":i>0?"right":"none",h=o<0?"bottom":o>0?"top":"none";this.swippe={h:a,v:h,delta_x:i,delta_y:o}}),{x:this.ux,y:this.uy,t:Date.now()-this.cache.stream.t0})}function be(t){re.call(this,t,"enter",null,null)}function ye(t){re.call(this,t,"leave",null,null)}function we(t){re.call(this,t,"out",null,null)}function ve(t){re.call(this,t,"out",null,null)}const xe=t=>new me(t);function Fe(t){re.call(this,t,"wheel",null,null)}class Ce extends ne{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:Fe.bind(this)}}onWheel(...t){return this.__onEvent("wheel",{},...t),this}}const Ee=t=>new Ce(t);function ke(t){re.call(this,t,"down",(()=>this.kd=t.key),{key:t.key,t:10})}function Ae(t){re.call(this,t,"press",(()=>this.kp=t.key),{key:t.key,t:10})}function De(t){re.call(this,t,"up",(()=>this.ku=t.key),{key:t.key,t:10})}class Be extends ne{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:ke.bind(this),press:Ae.bind(this),up:De.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 _e=t=>new Be(t);function Te(t){re(this,t,"start",null)}function Me(t){re.call(this,t,"drag",null,null)}function Ie(t){re.call(this,t,"end",null,null)}function Se(t){re.call(this,t,"drop",null,null)}class Le extends ne{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:Te.bind(this),drag:Me.bind(this),end:Ie.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 Oe extends ne{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:Se.bind(this)}}onDrop(...t){return this.__onEvent("drop",{},...t),this}}const je=t=>new Le(t),Re=t=>new Oe(t);function Pe(t){re.call(this,t,"click",null,null)}function Ve(t){re.call(this,t,"dbclick",null,null)}class Ne extends ne{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:Pe.bind(this),dbclick:Ve.bind(this)}}onClick(...t){return this.__onEvent("click",{},...t),this}onDbClick(...t){return this.__onEvent("dbclick",{},...t),this}}const $e=t=>new Ne(t);function ze(t){re.call(this,t,"copy",null,null)}function Ue(t){re.call(this,t,"cut",null,null)}function He(t){re.call(this,t,"paste",null,null)}function Ze(t){re.call(this,t,"select",null,null)}class qe extends ne{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:Ue.bind(this),paste:He.bind(this),select:Ze.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 We=t=>new qe(t);function Xe(t){re.call(this,t,"focus",null,null)}function Ye(t){re.call(this,t,"blur",null,null)}class Ke extends ne{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:Xe.bind(this),blur:Ye.bind(this)}}onFocus(...t){return this.__onEvent("focus",{},...t),this}onBlur(...t){return this.__onEvent("blur",{},...t),this}}const Qe=t=>new Ke(t);function Ge(t){re.call(this,t,"input",null,null)}function Je(t){re.call(this,t,"change",null,null)}class ts extends ne{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:Ge.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){re.call(this,t,"hashchange",null,null)}class rs extends ne{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 ns=t=>new rs(t),is=t=>function(e){re.call(this,e,t,null,null)};class os extends ne{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{},paused:{},stream:{enabled:{},clear:{},history:{}},callbacks:{}},this.__controller={}}#n(t){return this.cache.preventDefault[t]=!1,this.cache.paused[t]=!1,this.cache.stream.enabled=!1,this.cache.stream.clear=!1,this.cache.stream.history=[],this.cache.callbacks[t]=[],this.__controller[t]=is(t).bind(this),this}on(t,...e){return this.__controller[t]||this.#n(t),this.__onEvent(t,{},...e),this}emit(t,e={}){this.__controller[t]||this.#n(t),this.detail=e;const s=new Event(t);return this.targetElement.dispatchEvent(s),this}}const as=t=>new os(t),hs={usePointerEvent:pe,useMouseEvent:xe,useWheelEvent:Ee,useKeyEvent:_e,useDragEvent:je,useDropEvent:Re,useClickEvent:$e,useClipboardEvent:We,useFocusEvent:Qe,useInputEvent:es,useHashEvent:ns,useCustomEvent:as,ExtractAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"ExtractAll"!==s&&"RemoveAll"!==s&&(globalThis[s]=this[s])}return this},RemoveAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"RemoveAll"!==s&&delete globalThis[s]}return this}};class ls{constructor(t,e,{threshold:s=0,margin:r=0}={}){this.target=t,this.config={threshold:s,margin:r},this.observer=new IntersectionObserver((t=>{this.entrie=t[0],e(this)}),{threshold:this.threshold})}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 cs=(t,e,s)=>new ls(t,e,s);class us{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){this.observer||(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}}class ps{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 ms=(t,e)=>new ps(t,e);class ds{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 zr(globalThis?.screenX,0,globalThis.screen.availWidth,-1,1)}get y0(){return-zr(globalThis?.screenY,0,globalThis.screen.availHeight,-1,1)}get x1(){return zr(globalThis?.screenX+globalThis?.outerWidth,0,globalThis.screen.availWidth,-1,1)}get y1(){return-zr(globalThis?.screenY+globalThis?.outerHeight,0,globalThis.screen.availHeight,-1,1)}get cx(){return zr(globalThis?.outerWidth/2+globalThis?.screenX,0,globalThis.screen.availWidth,-1,1)}get cy(){return-zr(globalThis?.outerHeight/2+globalThis?.screenY,0,globalThis.screen.availHeight,-1,1)}}const gs=t=>new ds(t);class fs extends us{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 bs=(t,e)=>new fs(t,e);class ys extends us{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 ws=(t,e)=>new ys(t,e),vs={watch:(t,e={},s=null)=>{const r=new us(t,e);return s&&r.observe(s),r},watchAttr:bs,watchChildren:ws,watchIntersection:cs,watchSize:ms,watchScreen:gs,ExtractAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"ExtractAll"!==s&&"RemoveAll"!==s&&(globalThis[s]=this[s])}return this},RemoveAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"RemoveAll"!==s&&delete globalThis[s]}return this}};class xs{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"+it.string(10),this.SUBSCRIBERS=new Set([this.UUID])}get broadcast(){return this}emit(t,e){return this.EVENTS_DATAS_PAIRS.set(t,e),this.#i(t),this}on(t,e=console.log){return this.EVENTS_HANDLERS_PAIRS.set(t,e),this.#o(),this}#o(){return this.channel.onmessage=t=>{this.LAST_RECEIVED_EVENT=t.data.last_sended_event;const e=t.data.userId;this.SUBSCRIBERS.add(e);const s=t.data.EVENTS_DATAS_PAIRS.get(this.LAST_RECEIVED_EVENT),r=this.EVENTS_HANDLERS_PAIRS.get(this.LAST_RECEIVED_EVENT);s&&r&&r(s)},this}#i(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 Fs=t=>new xs(t);class Cs{#a;constructor(){this.#a=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.#a],{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 Es=(t,e,s)=>{const r=new Cs;return t&&r.call(t,e,s),r};class ks{constructor(t={acceptAllDevices:!0}){this.options=t,this.__Emitter__=Kt(),this.isSupported&&this.#n()}async#n(){this.promise=navigator.bluetooth.requestDevice(this.options).then((t=>this.device=t))}get isSupported(){return!!navigator.bluetooth}get current(){return this.device}connect(){return this.server=this.device.gatt.connect(),this.__Emitter__.emit("ziko:bluetooth-connected"),this}disconnect(){return this.device.gatt.disconnect(),this.__Emitter__.emit("ziko:bluetooth-disconnected"),this}onConnect(t){return this.__Emitter__.on("ziko:bluetooth-connected",t),this}onDisconnect(t){return this.__Emitter__.on("ziko:bluetooth-disconnected",t),this}dispose(){}async battery(t){const e=await this.server.getPrimaryService("battery_service"),s=await e.getCharacteristic("battery_level"),r=await s.readValue();t(await r.getUint8(0))}}const As=t=>new ks(t);class Ds{constructor(){this.isSupported&&this.#n()}async#n(){this.__Battery__=await navigator.getBattery()}get isSupported(){return!!navigator.getBattery}get current(){const{level:t,charging:e,chargingTime:s,dischargingTime:r}=this.__Battery__;return{level:t,charging:e,chargingTime:s,dischargingTime:r}}onChargingChange(t){return this.__Battery__.addEventListener("chargingchange",t),this}onLevelChange(t){return this.__Battery__.addEventListener("levelchange",t),this}}const Bs=()=>new Ds;class _s{constructor(){this.isSupported&&this.#n()}async#n(){navigator.geolocation.getCurrentPosition((t=>this.__Geolocation__=t))}get isSupported(){return!!navigator.geolocation}get current(){return this.__Geolocation__}}const Ts=()=>new _s;function Ms(t,...e){const s=t.toString().match(/\(([^)]*)\)/)[1].split(",").map((t=>t.trim()));return function(...r){const n=e[e.length-1];for(let t=0;t<r.length;t++){const i=t>=e.length,o=i?n:e[t],a=r[t];i?(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(Is(t,a)){h=!0;break}if(o.nor)for(const t of o.types){if(Is(t,a)){h=!1;break}h=!0}else o.not&&(h=!Is(o.type,a))}else h=Is(o,a);if(!h)throw new TypeError("jjj")}return t(...r)}}const Is=(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)=>Is(t[s],e))):"object"==typeof t&&!Array.isArray(t)&&("object"==typeof e&&null!==e&&Object.keys(t).every((s=>s in e&&Is(t[s],e[s]))));function Ss(t,e=0){return t+e}globalThis.useType=Ms,globalThis.useNot=function(t){return{not:!0,type:t}},globalThis.useOr=function(...t){return{or:!0,types:t}},Ss=Ms(Ss,"number",function(...t){return{nor:!0,types:t}}("string","number")),console.log(Ss(1));class Ls{constructor(t,e=1e3/30,s=0,r=1/0,n=!0){this.callback=t,this.cache={isRunning:!1,AnimationId:null,t0:null,step:e,startTime:s,endTime:r,started:n},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 Os=(t,e,s,r,n)=>new Ls(t,e,s,r,n),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},Rs=(t,e=1e3)=>(...s)=>setTimeout((()=>t(...s)),e),Ps=(t,e)=>{let s=0;return(...r)=>{const n=(new Date).getTime();n-s<e||(s=n,t(...r))}},Vs=t=>{const e=Date.now(),s=performance.memory.usedJSHeapSize,r=t();return{elapsedTime:Date.now()-e,usedMemory:performance.memory.usedJSHeapSize-s,result:r}},Ns=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})})),$s=(t,e=2e3)=>{const s=Date.now();for(;Date.now()-s<e;)if(t.element)return t.element},zs=t=>new Promise((e=>setTimeout(e,t))),Us=t=>{console.time("timeTaken");const e=t();return console.timeEnd("timeTaken"),e};class Hs{constructor(t,e=js.Linear,s=50,{t:r=[0,null],start:n=!0,duration:i=3e3}={}){this.cache={isRunning:!1,AnimationId:null,startTime:null,ease:e,step:s,intervall:r,started:n,duration:i},this.t=0,this.tx=0,this.ty=0,this.i=0,this.callback=t}#h(){this.t+=this.cache.step,this.i++,this.tx=zr(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}#l(t=!0){return this.cache.isRunning||(t&&this.reset(!1),this.cache.isRunning=!0,this.cache.startTime=Date.now(),this.cache.AnimationId=setInterval(this.#h.bind(this),this.cache.step)),this}start(){return this.#l(!0),this}pause(){return this.cache.isRunning&&(clearTimeout(this.cache.AnimationId),this.cache.isRunning=!1),this}resume(){return this.#l(!1),this}stop(){return this.pause(),this.reset(!1),this}}const Zs=(t,e=js.Linear,s=50,r)=>new Hs(t,js.Linear,50,r),qs={wait:zs,timeTaken:Us,useThrottle:Ps,useDebounce:Rs,Ease:js,time_memory_Taken:Vs,useTimeLoop:Os,useAnimation:Zs,waitForUIElm:Ns,waitForUIElmSync:$s,ExtractAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"ExtractAll"!==s&&"RemoveAll"!==s&&(globalThis[s]=this[s])}return this},RemoveAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"RemoveAll"!==s&&delete globalThis[s]}return this}};class Ws{constructor(t,e,s){this.cache={storage:t,globalKey:e,channel:Fs(`Ziko:useStorage-${e}`),oldItemKeys:new Set},this.#n(s),this.#c()}get items(){return JSON.parse(this.cache.storage[this.cache.globalKey]??null)}#c(){for(let t in this.items)Object.assign(this,{[[t]]:this.items[t]})}#n(t){this.cache.channel=Fs(`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 Xs=(t,e)=>new Ws(localStorage,t,e),Ys=(t,e)=>new Ws(sessionStorage,t,e),Ks=(t,e=[],s=(()=>{}))=>{t.cache.stream.enabled.down=!0;const r=e.length,n=t.cache.stream.history.down.slice(-r).map((t=>t.key));e.join("")===n.join("")&&(t.event.preventDefault(),s.call(t,t))},Qs={Events:hs,Observer:vs,Hooks:{useStyle:Ut,useTheme:Xt,useMediaQuery:se,useBattery:Bs,useGeolocation:Ts,useEventEmitter:Kt,useChannel:Fs,useThread:Es,useBluetooth:As,useTitle:Gt,useFavIcon:te,useThrottle:Ps,useDebounce:Rs,useLocaleStorage:Xs,useSessionStorage:Ys,useSuccesifKeys:Ks,ExtractAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"ExtractAll"!==s&&"RemoveAll"!==s&&(globalThis[s]=this[s])}return this},RemoveAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"RemoveAll"!==s&&delete globalThis[s]}return this}},ExtractAll:function(){this.Events.ExtractAll(),this.Observer.ExtractAll(),this.Hooks.ExtractAll()},RemoveAll:function(){this.Events.RemoveAll(),this.Observer.RemoveAll(),this.Hooks.RemoveAll()}};class Gs{constructor(t,e=""){var s;this.target=globalThis.__Ziko__.__Config__.default.target||globalThis.document.body,"string"==typeof t&&(t="svg"===t?document.createElementNS("http://www.w3.org/2000/svg","svg"):globalThis.document.createElement(t)),this.element=t,this.uuid=this.constructor.name+"-"+it.string(10),this.cache={name:e,parent:null,isRoot:!1,isHidden:!1,isFrozzen:!1,legacyParent:null,style:(s={},new $t(s)),attributes:{},filters:{},temp:{}},this.events={ptr:null,mouse:null,wheel:null,key:null,drag:null,drop:null,click:null,clipboard:null,focus:null,custom:null},this.observer={resize:null,intersection:null},this.cache.style.linkTo(this),this.style({position:"relative",boxSizing:"border-box",fontFamily:"verdana",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],globalThis.__Ziko__.__Config__.default.render&&this.render()}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 __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 zt?this.st.style(t.current):this.st.style(t),this}size(t,e){return this.st.size(t,e),this}freeze(t){return this.cache.isFrozzen=t,this}setTarget(t){return t instanceof Gs&&(t=t.element),this.unrender(),this.target=t,this.render(),this}render(t=this.target){return t instanceof Gs&&(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}setAttr(t,e){if(t instanceof Object){const[s,r]=[Object.keys(t),Object.values(t)];for(let n=0;n<s.length;n++)r[n]instanceof Array&&(e[n]=r[n].join(" ")),this?.attr[t[n]]!==e[n]&&(this.element.setAttribute(s[n],r[n]),Object.assign(this.cache.attributes,Object.fromEntries([[s[n],r[n]]])))}else e instanceof Array&&(e=e.join(" ")),this?.attr[t]!==e&&(this.element.setAttribute(t,e),Object.assign(this.cache.attributes,Object.fromEntries([[t,e]])));return this}removeAttr(...t){for(let e=0;e<t.length;e++)this.element.removeAttribute(t[e]);return this}getAttr(t){return 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=pe(this)),this.events.ptr.onMove(...t),this}onPtrDown(...t){return this.events.ptr||(this.events.ptr=pe(this)),this.events.ptr.onDown(...t),this}onPtrUp(...t){return this.events.ptr||(this.events.ptr=pe(this)),this.events.ptr.onUp(...t),this}onPtrEnter(...t){return this.events.ptr||(this.events.ptr=pe(this)),this.events.ptr.onEnter(...t),this}onPtrLeave(...t){return this.events.ptr||(this.events.ptr=pe(this)),this.events.ptr.onLeave(...t),this}onPtrOut(...t){return this.events.ptr||(this.events.ptr=pe(this)),this.events.ptr.onOut(...t),this}onMouseMove(...t){return this.events.mouse||(this.events.mouse=xe(this)),this.events.mouse.onMove(...t),this}onMouseDown(...t){return this.events.mouse||(this.events.mouse=xe(this)),this.events.mouse.onDown(...t),this}onMouseUp(...t){return this.events.mouse||(this.events.mouse=xe(this)),this.events.mouse.onUp(...t),this}onMouseEnter(...t){return this.events.mouse||(this.events.mouse=xe(this)),this.events.mouse.onEnter(...t),this}onMouseLeave(...t){return this.events.mouse||(this.events.mouse=xe(this)),this.events.mouse.onLeave(...t),this}onMouseOut(...t){return this.events.mouse||(this.events.mouse=xe(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=_e(this)),this.events.key.onDown(...t),this}onKeyPress(...t){return this.events.key||(this.events.key=_e(this)),this.events.key.onPress(...t),this}onKeyUp(...t){return this.events.key||(this.events.key=_e(this)),this.events.key.onUp(...t),this}onKeysDown({keys:t=[],callback:e}={}){return this.events.key||(this.events.key=_e(this)),this.events.key.handleSuccessifKeys({keys:t,callback:e}),this}onDragStart(...t){return this.events.drag||(this.events.drag=je(this)),this.events.drag.onStart(...t),this}onDrag(...t){return this.events.drag||(this.events.drag=je(this)),this.events.drag.onDrag(...t),this}onDragEnd(...t){return this.events.drag||(this.events.drag=je(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=$e(this)),this.events.click.onClick(...t),this}onDbClick(...t){return this.events.click||(this.events.click=$e(this)),this.events.click.onDbClick(...t),this}onCopy(...t){return this.events.clipboard||(this.events.clipboard=We(this)),this.events.clipboard.onCopy(...t),this}onCut(...t){return this.events.clipboard||(this.events.clipboard=We(this)),this.events.clipboard.onCut(...t),this}onPaste(...t){return this.events.clipboard||(this.events.clipboard=We(this)),this.events.clipboard.onPaste(...t),this}onSelect(...t){return this.events.clipboard||(this.events.clipboard=We(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=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=bs(this,t)),this}watchChildren(t){return this.observer.children||(this.observer.children=ws(this,t)),this}watchSize(t){return this.observer.resize||(this.observer.resize=ms(this,t)),this.observer.resize.start(),this}watchIntersection(t,e){return this.observer.intersection||(this.observer.intersection=cs(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 Js extends Gs{constructor(t,e,s){super("img","image"),this.value=t,"IMG"===t.nodeName?this.element.setAttribute("src",t.src):this.element.setAttribute("src",t),"number"==typeof e&&(e+="%"),"number"==typeof s&&(s+="%"),this.style({border:"1px solid black",width:e,height:s})}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 tr=(t,e,s)=>new Js(t,e,s);class er extends Gs{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)}}const sr=(t,e)=>new er(t,e);class rr extends Gs{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 t(){return this.element.currentTime}useControls(t=!0){return this.element.controls=t,this}play(){return this.element.play(),this}pause(){return this.element.pause(),this}poster(t=""){return this.element.poster=t,this}usePIP(t){return this.element.requestPictureInPicture(t),this}seekTo(t){return this.element.currentTime=t,this}onPlay(){}onPause(){}}const nr=(t,e,s)=>new rr(t,e,s);class ir extends Gs{constructor(t){super("audio","audio"),this.element.setAttribute("src",t),this.useControls()}get t(){return this.element.currentTime}useControls(t=!0){return this.element.controls=t,this}play(){return this.element.play(),this}pause(){return this.element.pause(),this}seekTo(t){return this.element.currentTime=t,this}onPlay(){}onPause(){}}const or=t=>new ir(t),ar=t=>(new XMLSerializer).serializeToString(t),hr=t=>btoa(ar(t)),lr=t=>"data:image/svg+xml;base64,"+hr(t),cr=(t,e=!0)=>tr(lr(t)).render(e),ur=t=>JSON.stringify(Ar((t=>["number","string","boolean","bigint"].includes(typeof t)?String(t):t instanceof o||t instanceof vr?t.toString():t instanceof Array?mr(t):void 0),t),null," ").replace(/"([^"]+)":/g,"$1:").replace(/: "([^"]+)"/g,": $1"),pr=t=>{if(!Array.isArray(t))return 0;let e=1;for(const s of t)if(Array.isArray(s)){const t=pr(s);t+1>e&&(e=t+1)}return e},mr=t=>{let e=0;return function t(s){let r=pr(s),n=0;return s.some((t=>Array.isArray(t)))&&(e++,n=1),"["+s.map(((r,n)=>["number","string","boolean","bigint"].includes(typeof r)?String(r):r instanceof o?r.toString():r instanceof Array?`\n${" ".repeat(e)}${t(r)}${n===s.length-1?"\n":""}`:r instanceof Object?ur(r):void 0))+`${" ".repeat((r+e+1)*n)}]`}(t)};function dr(t){const e={type:t.nodeName,attributes:{},children:[]};for(let s=0;s<t.attributes.length;s++){const r=t.attributes[s];e.attributes[r.name]=r.value}for(let s=0;s<t.childNodes.length;s++){const r=t.childNodes[s];r.nodeType===Node.ELEMENT_NODE?e.children.push(dr(r)):r.nodeType===Node.TEXT_NODE&&(e.text=r.textContent.trim())}return e}const gr=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=gr(t);return(new DOMParser).parseFromString(e,"text/xml").documentElement};const fr={isDigit:/^\d+$/,isEmail:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,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 br{constructor(t){this.string=t}isDigit(){return fr.isDigit.test(this.string)}static isDigit(t){return new br(t).isDigit()}isNumber(){return!isNaN(this.string)}static isNumber(t){return new br(t).isNumber()}isUrl(){return fr.isURL.test(this.string)}static isUrl(t){return new br(t).isUrl()}isHexColor(){return fr.isHexColor.test(this.string)}static isHexColor(t){return new br(t).isHexColor()}isIPv4(){return fr.isIPv4.test(this.string)}static isIPv4(t){return new br(t).isIPv4()}isDate(){return fr.isDate.test(this.string)}static isDate(t){return new br(t).isDate()}isMACAddress(){return fr.isMACAddress.test(this.string)}static isMACAddress(t){return new br(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 br(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 br(t).isCamelCase()}isHyphenCase(){return this.string.split("-").length>1}static isHyphenCase(t){return new br(t).isHyphenCase()}isSnakeCase(){return this.string.split("_").length>1}static isSnakeCase(t){return new br(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 br(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 br(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 yr=t=>new br(t),wr={str:yr,Str:br,parseXML:function(t){return dr((new DOMParser).parseFromString(t,"text/xml").documentElement)},preload:gr,obj2str:ur,arr2str:mr,markdown2html:ft,adoc2html:Ct,csv2arr:Et,csv2matrix:kt,csv2object:At,csv2json:Dt,csv2sql:Bt,json2arr:Mt,json2csv:It,json2csvFile:St,json2yml:jt,json2ymlFile:Rt,json2xml:Pt,json2xmlFile:Vt,svg2str:ar,svg2ascii:hr,svg2imgUrl:lr,svg2img:cr,ExtractAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"ExtractAll"!==s&&"RemoveAll"!==s&&(globalThis[s]=this[s])}return this},RemoveAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"RemoveAll"!==s&&delete globalThis[s]}return this}};class vr extends i{constructor(t,e,s=[]){if(super(),t instanceof vr)this.arr=t.arr,this.rows=t.rows,this.cols=t.cols;else{let r,n,i=[];if(arguments[0]instanceof Array)t=arguments[0].length,e=arguments[0][0].length,i=arguments[0];else for(r=0;r<t;r++)for(i.push([]),i[r].push(new Array(e)),n=0;n<e;n++)i[r][n]=s[r*e+n],null==s[r*e+n]&&(i[r][n]=0);this.rows=t,this.cols=e,this.arr=i}this._maintain()}toString(){return mr(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 vr(t,e,this.arr.flat(1));console.error("Err")}static eye(t){let e=new vr(t,t);for(let s=0;s<t;s++)for(let r=0;r<t;r++)e.arr[s][r]=s===r?1:0;return e}get clone(){return new vr(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 vr(this.cols,this.rows,this.arr.flat(1).reel)}get imag(){return new vr(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==vr.sub(e,t).max&&0==vr.sub(e,t).min}get isAntiSym(){if(!this.isSquare)return!1;const t=this.T,e=this.clone;return 0==vr.add(e,t).max&&0==vr.add(e,t).min}get isDiag(){if(!this.isSquare)return!1;const t=this.T,e=this.clone,s=vr.mul(e,t),r=vr.dot(t,e);return 0==vr.sub(s,r).max&&0==vr.sub(s,r).min}get isOrtho(){return!!this.isSquare&&(this.isDiag&&(1==this.det||-1==this.det))}get isIdemp(){if(!this.isSquare)return!1;const t=this.clone,e=vr.dot(t,t);return 0==vr.sub(e,t).max&&0==vr.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 vr(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 vr))?void console.warn("Tensors are not completely supported yet ..."):en.sub(en.mul(s[0][0],s[1][1]),en.mul(s[0][1],s[1][0]));for(var r=0,n=0;n<s.length;n++){const i=en.add(en.mul(x(-1,n),en.mul(s[0][n],e(t(s,n)))));r=en.add(r,i)}return r}(this.arr)}get inv(){if(!this.isSquare)return new Error("is not square matrix");if(0===this.det)return"determinat = 0 !!!";let t=function(t){if(t.length!==t[0].length)return;var e=0,s=0,r=0,n=t.length,i=0,o=[],a=[];for(e=0;e<n;e+=1)for(o[o.length]=[],a[a.length]=[],r=0;r<n;r+=1)o[e][r]=e==r?1:0,a[e][r]=t[e][r];for(e=0;e<n;e+=1){if(0==(i=a[e][e])){for(s=e+1;s<n;s+=1)if(0!=a[s][e]){for(r=0;r<n;r++)i=a[e][r],a[e][r]=a[s][r],a[s][r]=i,i=o[e][r],o[e][r]=o[s][r],o[s][r]=i;break}if(0==(i=a[e][e]))return}for(r=0;r<n;r++)a[e][r]=a[e][r]/i,o[e][r]=o[e][r]/i;for(s=0;s<n;s++)if(s!=e)for(i=a[s][e],r=0;r<n;r++)a[s][r]-=i*a[e][r],o[s][r]-=i*o[e][r]}return o}(this.arr);return new vr(this.rows,this.cols,t.flat(1))}static zeros(t,e){let s=new vr(t,e);for(let n=0;n<t;n++)for(var r=0;r<e;r++)s.arr[n][r]=0;return s}static ones(t,e){let s=new vr(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)s.arr[r][t]=1;return s}static nums(t,e,s){let r=new vr(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)r.arr[n][t]=s;return r}static get rand(){return{int:(t,e,s,r)=>{let n=new vr(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)n.arr[i][t]=it.randInt(s,r);return n},bin:(t,e)=>{let s=new vr(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)s.arr[r][t]=it.randBin;return s},hex:(t,e)=>{let s=new vr(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)s.arr[r][t]=it.randHex;return s},choices:(t,e,s,r)=>{let n=new vr(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)n.arr[i][t]=it.choice(s,r);return n},permutation:(t,e,s)=>{}}}static rands(t,e,s=1,r){let n=new vr(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)n.arr[i][t]=it.rand(s,r);return n}map(t,e,s,r){return en.map(this,t,e,s,r)}lerp(t,e){return en.lerp(this,t,e)}norm(t,e){return en.norm(this,t,e)}clamp(t,e){return en.clamp(this,t,e)}static map(t,e,s,r,n){return en.map(t,e,s,r,n)}static lerp(t,e,s){return en.lerp(t,e,s)}static norm(t,e,s){return en.norm(t,e,s)}static clamp(t,e,s){return en.clamp(xr,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 vr(this.rows,this.cols,t)}get toOct(){let t=this.arr.flat(1).toOct;return new vr(this.rows,this.cols,t)}get toHex(){let t=this.arr.flat(1).toHex;return new vr(this.rows,this.cols,t)}max2min(){let t=this.arr.flat(1).max2min;return new vr(this.rows,this.cols,t)}min2max(){let t=this.arr.flat(1).min2max;return new vr(this.rows,this.cols,t)}sortRows(t=void 0){let e=this.arr.map((e=>e.sort(t))).flat(1);return new vr(this.rows,this.cols,e)}sortCols(t=void 0){let e=this.T.arr.map((e=>e.sort(t))).flat(1);return new vr(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 vr(s)}filterByCols(t){return new vr(this.T.arr.filter((e=>e.includes(t))))}sortAll(t=void 0){let e=this.arr.flat(1).sort(t);return new vr(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 vr(this.rows,this.cols,e)}#u(t){if(this.rows!==t.rows)return;let e=this.arr;for(let s=0;s<this.rows;s++)for(let r=this.cols;r<this.cols+t.cols;r++)e[s][r]=t.arr[s][r-this.cols];return this.cols+=t.cols,new vr(this.rows,this.cols,e.flat(1))}hstack(...t){const e=[this,...t].reduce(((t,e)=>t.#u(e)));return Object.assign(this,e),this}static hstack(t,...e){return t.clone.hstack(...e)}#p(t){if(this.cols!==t.cols)return;let e=this.arr;for(let s=this.rows;s<this.rows+t.rows;s++){e[s]=[];for(let r=0;r<this.cols;r++)e[s][r]=t.arr[s-this.rows][r]}return this.rows+=t.rows,new vr(this.rows,this.cols,e.flat(1))}vstack(...t){const e=[this,...t].reduce(((t,e)=>t.#p(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.#u(e)));return Object.assign(this,e),this}vqueue(...t){const e=[this,...t].reverse().reduce(((t,e)=>t.#p(e)));return Object.assign(this,e),this}static hqueue(t,...e){return t.clone.hqueue(...e)}static vqueue(t,...e){return t.clone.vqueue(...e)}slice(t=0,e=0,s=this.rows-1,r=this.cols-1){let n=s-t,i=r-e,o=new Array(i);for(let s=0;s<n;s++){o[s]=[];for(let r=0;r<i;r++)o[s][r]=this.arr[s+t][r+e]}return new vr(n,i,o.flat(1))}static slice(t,e=0,s=0,r=this.rows-1,n=this.cols-1){return t.slice(e,s,r,n)}splice(t,e,s,...r){}getRows(t,e=t+1){return this.slice(t,0,e,this.cols)}getCols(t,e=t+1){return this.slice(0,t,this.rows,e)}static getRows(t,e,s=e+1){return t.slice(e,0,s,t.cols)}static getCols(t,e,s=e+1){return t.slice(0,e,t.rows,s)}add(...t){for(let s=0;s<t.length;s++){("number"==typeof t[s]||t[s]instanceof o)&&(t[s]=vr.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=en.add(this.arr[r][e],t[s].arr[r][e])}return new vr(this.rows,this.cols,this.arr.flat(1))}sub(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=vr.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=en.sub(this.arr[r][e],t[s].arr[r][e])}return new vr(this.rows,this.cols,this.arr.flat(1))}static add(t,...e){return t.clone.add(...e)}static sub(t,...e){return t.clone.sub(...e)}mul(...t){for(let r=0;r<t.length;r++){"number"==typeof t[r]&&(t[r]=vr.nums(this.rows,this.cols,t[r]));for(var e=0;e<this.rows;e++)for(var s=0;s<this.cols;s++)this.arr[e][s]=en.mul(this.arr[e][s],t[r].arr[e][s])}return new vr(this.rows,this.cols,this.arr.flat(1))}div(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=vr.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=en.div(this.arr[r][e],t[s].arr[r][e])}return new vr(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]=vr.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=en.modulo(this.arr[r][e],t[s].arr[r][e])}return new vr(this.rows,this.cols,this.arr.flat(1))}static modulo(t,...e){return t.clone.modulo(...e)}dot(t){for(var e=[],s=0;s<this.arr.length;s++){e[s]=[];for(var r=0;r<t.arr[0].length;r++){e[s][r]=0;for(var n=0;n<this.arr[0].length;n++)e[s][r]=en.add(e[s][r],en.mul(this.arr[s][n],t.arr[n][r]))}}return new vr(this.arr.length,t.arr[0].length,e.flat(1))}static dot(t,e){return t.dot(e)}pow(t){let e=this.clone,s=this.clone;for(let r=0;r<t-1;r++)s=s.dot(e);return s}static pow(t,e){return t.clone.pow(e)}get somme(){let t=0;for(let e=0;e<this.rows;e++)for(let s=0;s<this.cols;s++)t+=this.arr[e][s];return t}get DoesItContainComplexNumbers(){return this.arr.flat(1/0).some((t=>t instanceof o))}get min(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(u(...this.arr[e]));return u(...t)}get max(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(p(...this.arr[e]));return p(...t)}get minRows(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(u(...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(p(...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 vr(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 vr(t.rows,t.cols);return e.arr=t.arr,e}DecompositionLU(){const[t,e]=ot(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]=ct(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:ut(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)=>vr.LU(...t),QR:(...t)=>vr.QR(...t),CHOLESKY:(...t)=>vr.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 r=0;r<s[0].length;r++)s[t][r].innerHTML=this.arr[t][r],e[t].appendChild(s[t][r]);return e.map((e=>t.appendChild(e))),t}toGrid(t,e={}){let s=Grid();return s.append(...this.map(t).arr.flat(1).map((t=>t.style(e)))),s.Columns(this.cols),s}sortTable(t=0,{type:e="num",order:s="asc"}={}){var r=this.T.arr.map((t=>t.map(((t,e)=>Object.assign({},{x:t,y:e}))))),n=this.T.arr.map((t=>t.map(((t,e)=>Object.assign({},{x:t,y:e})))));"num"===e?"asc"===s?r[t].sort(((t,e)=>t.x-e.x)):"desc"===s?r[t].sort(((t,e)=>e.x-t.x)):"toggle"===s&&(r[t][0].x>r[t][1].x?r[t].sort(((t,e)=>e.x-t.x)):r[t].sort(((t,e)=>t.x-e.x))):"alpha"===e&&("asc"===s?r[t].sort(((t,e)=>(""+t.x).localeCompare(""+e.x))):"desc"===s&&r[t].sort(((t,e)=>(""+e.x).localeCompare(""+t.x)))),s=r[t].map((t=>t.y));for(let e=0;e<r.length;e++)e!==t&&r[e].map(((t,e)=>t.y=s[e]));for(let e=0;e<r.length;e++)e!==t&&n[e].map(((t,n)=>t.x=r[e][s[n]].x));n[t]=r[t];var i=n.map((t=>t.map((t=>t.x))));return new vr(i).T}}const xr=(t,e,s)=>new vr(t,e,s),Fr=(...t)=>new vr(2,2,t),Cr=(...t)=>new vr(3,3,t),Er=(...t)=>new vr(4,4,t);class kr{static resolve(t,e){return t.inv.dot(vr.fromVector(e)).arr.flat(1).map((t=>+t.toFixed(10)))}}const Ar=(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=>Ar(t,e)));if(ArrayBuffer.isView(e))return e.map((e=>t(e)));if(e instanceof Set)return new Set(Ar(t,...e));if(e instanceof Map)return new Map([...e].map((e=>[e[0],Ar(t,e[1])])));if(e instanceof vr)return new vr(e.rows,e.cols,Ar(e.arr.flat(1)));if(e instanceof o){const[s,r,n,i]=[e.a,e.b,e.z,e.phi];switch(t){case Math.log:return a(E(n),i);case Math.exp:return a(C(s)*k(r),C(s)*A(r));case Math.abs:return n;case Math.sqrt:return a(v(n)*k(i/2),v(n)*A(i/2));case y.cos:return a(k(s)*j(r),-A(s)*R(r));case y.sin:return a(A(s)*j(r),k(s)*R(r));case y.tan:{const t=k(2*s)+j(2*r);return a(A(2*s)/t,R(2*r)/t)}case y.cosh:return a(j(s)*k(r),R(s)*A(r));case y.sinh:return a(R(s)*k(r),j(s)*A(r));case y.tanh:{const t=j(2*s)+k(2*r);return a(R(2*s)/t,A(2*r)/t)}default:return t(e)}}else if(e instanceof Object)return Object.fromEntries(Object.entries(e).map((e=>[e[0],Ar(t,e[1])])))}));return 1==s.length?s[0]:s},Dr=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t+e;if(e instanceof o)return a(t+e.a,e.b);if(e instanceof vr)return vr.nums(e.rows,e.cols,t).add(e);if(e instanceof Array)return e.map((e=>Ir(e,t)))}else{if(t instanceof o||t instanceof vr)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=>Ir(t,e)));if(t.length===e.length)return t.map(((t,s)=>Ir(t,e[s])))}}},Br=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t-e;if(e instanceof o)return a(t-e.a,-e.b);if(e instanceof vr)return vr.nums(e.rows,e.cols,t).sub(e);if(e instanceof Array)return e.map((e=>Sr(e,t)))}else{if(t instanceof o||t instanceof vr)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=>Sr(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>Sr(t,e[s])))}}},_r=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t*e;if(e instanceof o)return a(t*e.a,t*e.b);if(e instanceof vr)return vr.nums(e.rows,e.cols,t).mul(e);if(e instanceof Array)return e.map((e=>Lr(t,e)))}else{if(t instanceof o||t instanceof vr)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=>Lr(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>Lr(t,e[s])))}}},Tr=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t/e;if(e instanceof o)return a(t/e.a,t/e.b);if(e instanceof vr)return vr.nums(e.rows,e.cols,t).div(e);if(e instanceof Array)return e.map((e=>Or(t,e)))}else{if(t instanceof o||t instanceof vr)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=>Or(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>Or(t,e[s])))}}},Mr=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t%e;if(e instanceof o)return a(t%e.a,t%e.b);if(e instanceof vr)return vr.nums(e.rows,e.cols,t).modulo(e);if(e instanceof Array)return e.map((e=>Or(t,e)))}else{if(t instanceof o||t instanceof vr)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=>Ir(t,e)))}},Ir=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=Dr(s,e[t]);return s},Sr=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=Br(s,e[t]);return s},Lr=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=_r(s,e[t]);return s},Or=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=Tr(s,e[t]);return s},jr=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=Mr(s,e[t]);return s},Rr=t=>new Array(t).fill(0),Pr=t=>new Array(t).fill(1),Vr=(t,e)=>new Array(e).fill(t),Nr=(t,e,s)=>{if("number"==typeof t)return e!==s?(t-e)/(s-e):0;if(t instanceof vr)return new vr(t.rows,t.cols,Nr(t.arr.flat(1),e,s));if(t instanceof o)return new o(Nr(t.a,e,s),Nr(t.b,e,s));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>Nr(t,e,s)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=Nr(t[s])}}},$r=(t,e,s)=>{if("number"==typeof t)return(s-e)*t+e;if(t instanceof vr)return new vr(t.rows,t.cols,$r(t.arr.flat(1),e,s));if(t instanceof o)return new o($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])}}},zr=(t,e,s,r,n)=>{if("number"==typeof t)return $r(Nr(t,e,s),r,n);if(t instanceof vr)return new vr(t.rows,t.cols,zr(t.arr.flat(1),e,s,r,n));if(t instanceof o)return new o(zr(t.a,s,r,n),zr(t.b,e,s,r,n));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>zr(t,e,s,r,n)));{let i=new Array(t.length);for(let o=0;o<t.length;o++)i[o]=zr(t[o],e,s,r,n)}}},Ur=(t,e,s)=>{const[r,n]=[u(e,s),p(e,s)];if("number"==typeof t)return u(p(t,r),n);if(t instanceof vr)return new vr(t.rows,t.cols,Ur(t.arr.flat(1),r,n));if(t instanceof o)return new o(Ur(t.a,r,n),Ur(t.b,r,n));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>Ur(t,r,n)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=Ur(t[s],r,n)}}},Hr=(t,e,s,r=!1)=>{let n=[];if(t<e)for(let i=t;r?i<=e:i<e;i+=s)n.push(10*i/10);else for(let i=t;r?i>=e:i>e;i-=s)n.push(10*i/10);return n},Zr=(t,e,s=w(e-t)+1,r=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[o,a]=[t,e].sort(((t,e)=>e-t));var n=[];let h;h=r?(o-a)/(s-1):(o-a)/s;for(var i=0;i<s;i++)t<e?n.push(a+h*i):n.push(o-h*i);return n}if([t,e].some((t=>t instanceof o))){const n=a(t),i=a(e);s=s||Math.abs(n.a-i.a)+1;const o=Zr(n.a,i.a,s,r),h=Zr(n.b,i.b,s,r);let l=new Array(s).fill(null);return l=l.map(((t,e)=>a(o[e],h[e]))),l}}},qr=(t,e,s=e-t+1,n=r,i=!0)=>Zr(t,e,s,i).map((t=>x(n,t))),Wr=(t,e,s=w(e-t)+1,r=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[n,i]=[t,e].sort(((t,e)=>e-t));let o;o=F(n/i,r?s-1:s);const a=[i];for(let t=1;t<s;t++)a.push(a[t-1]*o);return t<e?a:a.reverse()}if([t,e].some((t=>t instanceof o))){const n=a(t),i=a(e);let o;s=s||Math.abs(n.a-i.a)+1,o=F(i.div(n),r?s-1:s);const h=[n];for(let t=1;t<s;t++)h.push(Lr(h[t-1],o));return h}}},Xr=(...t)=>mapfun((t=>t*Math.PI/180),...t),Yr=(...t)=>mapfun((t=>t/Math.PI*180),...t),Kr=(t,e,s)=>{const[r,n]=[Math.min(e,s),Math.max(e,s)];return t>=r&&t<=n},Qr=(t,e,s=1e-4)=>Math.abs(t-e)<=s,Gr=(t,e)=>t.reduce(((t,s)=>[...t,...e.map((t=>[s,t]))]),[]),Jr=(t,e)=>{let s,r=1;if(t==Z(t)&&e==Z(e)){for(s=2;s<=t&&s<=e;++s)t%s==0&&e%s==0&&(r=s);return r}console.log("error")},tn=(t,e)=>{let s;if(t==Z(t)&&e==Z(e)){for(s=t>e?t:e;s%t!=0||s%e!=0;)++s;return s}console.log("error")},en={add:Ir,sub:Sr,mul:Lr,div:Or,modulo:jr,zeros:Rr,ones:Pr,nums:Vr,norm:Nr,lerp:$r,map:zr,clamp:Ur,arange:Hr,linspace:Zr,logspace:qr,geomspace:Wr,sum:h,prod:l,accum:m,cartesianProduct:Gr,ppcm:tn,pgcd:Jr,deg2rad:Xr,rad2deg:Yr,inRange:Kr,isApproximatlyEqual:Qr},sn=t=>{const e=[],r=t.length;t[0]instanceof o||(t=t.map((t=>a(t,0))));for(let n=0;n<r;n++){let i=0,o=0;for(let e=0;e<r;e++){const a=2*s*n*e/r;i+=t[e].a*k(a)+t[e].b*A(a),o+=-t[e].a*A(a)+t[e].b*k(a)}i/=r,o/=r,e[n]=a(i,o)}return{output:e,re:e.map((t=>t.a)),im:e.map((t=>t.b)),z:e.map((t=>t.z)),phi:e.map((t=>t.phi))}},rn=t=>{const e=[],r=t.length;t[0]instanceof o||(t=t.map((t=>a(t,0))));for(let n=0;n<r;n++){let i=0,o=0;for(let e=0;e<r;e++){const a=2*s*n*e/r;i+=t[e].a*k(a)+t[e].b*A(a),o+=t[e].a*A(a)+t[e].b*k(a)}i/=r,o/=r,e[n]=a(i,o)}return{output:e,re:e.map((t=>t.a)),im:e.map((t=>t.b)),z:e.map((t=>t.z)),phi:e.map((t=>t.phi))}},nn=(t,e,s=!0)=>{const r=t.length,n=e.length,i=[],o=s?Math.max(r,n):r+n-1;for(let s=0;s<o;s++){let o=0;for(let i=0;i<n;i++){const a=s+i-Math.floor(n/2);o+=(a>=0&&a<r?t[a]:0)*e[i]}i.push(o)}return i},on=(t,e,s=!0)=>{t instanceof vr||(t=xr(t)),e instanceof vr||(e=xr(e));const r=t.rows,n=t.cols,i=s?Math.max(t.rows,e.rows):t.rows+e.rows-1,o=s?Math.max(t.cols,e.cols):t.cols+e.cols-1,a=e.rows,h=[];for(let s=0;s<i;s++){const i=[];for(let h=0;h<o;h++){let o=0;for(let i=0;i<a;i++)for(let l=0;l<a;l++){const c=s+i-Math.floor(a/2),u=h+l-Math.floor(a/2);o+=(c>=0&&c<r&&u>=0&&u<n?t[c][u]:0)*e[i][l]}i.push(o)}h.push(i)}return h},an=(t,e,s)=>t instanceof vr||t instanceof Array&&t[0][0]?on(t,e,s):nn(t,e,s);class hn{constructor(t){this.input=t,this.input_fft=sn(this.input),this.output_fft=[]}lowPass(t){return this.input_fft.output.forEach(((e,s)=>{e=e.z<t?this.output_fft[s]=this.input_fft.output[s]:this.output_fft[s]=a(0,0)})),rn(this.output_fft).re}highPass(t){return this.input_fft.output.forEach(((e,s)=>{e=e.z>t?this.output_fft[s]=this.input_fft.output[s]:this.output_fft[s]=a(0,0)})),rn(this.output_fft).re}bandePass(){}bandeCoupe(){}}const ln={zeros:Rr,ones:Pr,nums:Vr,arange:Hr,linspace:Zr,logspace:qr,geomspace:Wr,map:zr,norm:Nr,lerp:$r,clamp:Ur,noise:(t,e=0,s=1)=>it.floats(t,e,s),echelon(t,e=0,s=1){t instanceof Array||(t=[t]);const r=Ar((t=>t>=e?1:0),...t);return r instanceof Array?r.map((t=>t*s)):r*s},rampe(t,e=0,s=1){t instanceof Array||(t=[t]);const r=Ar((t=>t>=e?t-e:0),...t);return r instanceof Array?r.map((t=>t*s)):r*s},sign(t,e=0,s=1){t instanceof Array||(t=[t]);const r=Ar((t=>Math.sign(t-e)),...t);return r instanceof Array?r.map((t=>t*s)):r*s},rect(t,e,s=0,r=1){t instanceof Array||(t=[t]);const n=Ar((t=>s-e/2<t&&s+e/2>t?1-2*w(t/e):0),...t);return n instanceof Array?n.map((t=>t*r)):n*r},tri(t,e,s=0,r=1){t instanceof Array||(t=[t]);const n=Ar((t=>s-e/2<t&&s+e/2>t?1-2*w(t/e):0),...t);return n instanceof Array?n.map((t=>t*r)):n*r},dirac:(t,e)=>Ar((t=>t===e?1/0:0),...t),lorentz(t,e=0,s=1){t instanceof Array||(t=[t]);const r=Ar((t=>1/(1+(t-e)**2)),...t);return r instanceof Array?r.map((t=>t*s)):r*s},sinc(t,e,s=1){t instanceof Array||(t=[t]);const r=Ar((t=>_(t-e)),...t);return r instanceof Array?r.map((t=>t*s)):r*s},square(t,e=1,s=1){t instanceof Array||(t=[t]);const r=Ar((t=>Y(A(2*t*Math.PI/e))),...t);return r instanceof Array?r.map((t=>t*s)):r*s},sawtooth(){},conv:an,conv1d:nn,conv2d:on,circularConv:(t,e)=>an(t,e,!0),linearConv:(t,e)=>an(t,e,!1),circularConv1d:(t,e)=>nn(t,e,!0),linearConv1d:(t,e)=>nn(t,e,!1),circularConv2d:(t,e)=>on(t,e,!0),linearConv2d:(t,e)=>on(t,e,!1),fft:sn,ifft:rn,filter:t=>new hn(t)},cn={PI:s,E:r,EPSILON:n,Random:it,complex:a,Complex:o,Matrix:vr,LinearSystem:kr,matrix:xr,matrix2:Fr,matrix3:Cr,matrix4:Er,cos:k,sin:A,tan:D,sinc:_,sec:B,csc:T,cot:M,abs:w,sqrt:v,pow:x,sqrtn:F,e:C,ln:E,acos:I,asin:S,atan:L,acot:O,cosh:j,sinh:R,tanh:P,coth:V,acosh:N,asinh:$,atanh:U,min:u,max:p,sign:Y,floor:Z,ceil:H,round:q,fact:X,hypot:Q,sig:K,atan2:W,Utils:en,mapfun:Ar,nums:Vr,zeros:Rr,ones:Pr,sum:h,prod:l,add:Ir,mul:Lr,div:Or,sub:Sr,modulo:jr,rad2deg:Yr,deg2rad:Xr,arange:Hr,linspace:Zr,logspace:qr,geomspace:Wr,norm:Nr,lerp:$r,map:zr,clamp:Ur,pgcd:Jr,ppcm:tn,isApproximatlyEqual:Qr,inRange:Kr,cartesianProduct:Gr,Discret:nt,Logic:et,Base:tt,Permutation:st,Combinaison:rt,powerSet:G,subSet:J,Signal:ln,ExtractAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"ExtractAll"!==s&&"RemoveAll"!==s&&(globalThis[s]=this[s])}return this},RemoveAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"RemoveAll"!==s&&delete globalThis[s]}return this}};class un extends Gs{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)}append(...t){if(this.cache.isFrozzen)return console.warn("You can't append new item to frozzen element"),this;for(let e=0;e<t.length;e++)["number","string"].includes(typeof t[e])&&(t[e]=vn(t[e])),t[e]instanceof Gs?(t[e].cache.parent=this,this.element.appendChild(t[e].element),t[e].target=this.element,this.items.push(t[e])):t[e]instanceof Object&&(t[e]?.style&&this.style(t[e]?.style),t[e]?.attr&&Object.entries(t[e].attr).forEach((t=>this.setAttr(""+t[0],t[1]))));return this.maintain(),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]=vn(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 Gs&&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 r=this.items.filter(t);return r.forEach(e),this.items.filter((t=>!r.includes(t))).forEach(s),this}filterByTextContent(t,e=!1){this.items.forEach((t=>t.render())),this.filter((s=>!(e?s.text===t:s.text.includes(t))),(t=>t.unrender()))}filterByClass(t){return this.items.map((t=>t.render())),this.items.filter((e=>!e.classes.includes(t))).map((t=>t.unrender())),this}sortByTextContent(t,e){let s=this.children;return s.filter((e=>!e.textContent.toLowerCase().includes(t.toLowerCase()))).map((t=>{t.style.display="none"})),s.filter((e=>e.textContent.toLowerCase().includes(t.toLowerCase()))).map(((t,s)=>t.style.display=e[s])),s.filter((t=>"none"!=t.style.display)),this}}class pn extends un{constructor(t,e,s,...r){super(t,e),this.addValue(...r),this.style({margin:0,padding:0}),Object.assign(this.cache,{lineBreak:s})}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(document.createTextNode(t)):t instanceof Gs?this.element.appendChild(t.element):t instanceof o||t instanceof vr?this.element.appendChild(new Text(t.toString())):t instanceof Array?this.element.appendChild(new Text(mr(t))):t instanceof Object&&this.element.appendChild(new Text(ur(t))),this.cache.lineBreak&&this.element.appendChild(document.createElement("br"))})),this.element.innerHTML=this.element.innerHTML.replace(/\n/g,"<br>").replace(/(?<!<[^>]+) /g," "),this}setValue(...t){return this.clear(),this.addValue(...t),this}}class mn extends pn{constructor(...t){super("span","text",!1,...t)}}class dn extends pn{constructor(...t){super("q","quote",!1,...t),this.style({fontStyle:"italic"})}}class gn extends pn{constructor(...t){super("dfn","dfnText",!1,...t)}}class fn extends pn{constructor(t){super("sup","supText",!1,t)}}class bn extends pn{constructor(...t){super("sub","subText",!1,...t)}}class yn extends pn{constructor(...t){super("code","codeText",!1,...t)}}class wn extends pn{constructor(t,e){super("abbr","abbrText",!1,t),this.setAttr("title",e)}}const vn=(...t)=>new mn(...t),xn=(...t)=>new dn(...t),Fn=(...t)=>new gn(...t),Cn=(...t)=>new fn(...t),En=(...t)=>new bn(...t),kn=(...t)=>new yn(...t),An=(t,e)=>new wn(t,e);class Dn extends pn{constructor(...t){super("p","p",!0,...t)}}class Bn extends pn{constructor(t,e){super("blockquote","blockquote",!0,e),this.setAttr("cite",t)}}const _n=(...t)=>new Dn(...t),Tn=(t,e)=>new Bn(t,e);class Mn extends Gs{constructor(t=1,e=""){super(`h${t}`,`h${t}`),this.element.textContent=e}get value(){return this.element.innerText}setValue(t=""){this.element.innerText=t}addValue(t=""){return this.element.innerText+=t,this}}const In=(t="")=>new Mn(1,t),Sn=(t="")=>new Mn(2,t),Ln=(t="")=>new Mn(3,t),On=(t="")=>new Mn(4,t),jn=(t="")=>new Mn(5,t),Rn=(t="")=>new Mn(6,t);class Pn extends un{constructor(t){super(t,"html")}}class Vn extends Gs{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()}setValue(t){return t instanceof Gs?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 Nn extends Gs{constructor(){super("br","br")}}class $n extends Gs{constructor(){super("hr","hr")}}class zn extends un{constructor(t){super("a","link"),this.setHref(t)}setHref(t){this.element.href=t}}const Un=()=>new Nn,Hn=()=>new $n,Zn=(t=1)=>new Array(t).fill(new Nn),qn=(t=1)=>new Array(t).fill(new $n),Wn=(t,...e)=>new zn(t).append(...e),Xn=(t,...e)=>new Pn(t).append(...e),Yn=t=>new Vn(t);class Kn extends un{constructor(t){super("li","li"),this.append(t)}}class Qn extends un{constructor(t,e){super(t,e),delete this.append,this.style({listStylePosition:"inside"})}append(...t){for(let e=0;e<t.length;e++){let s=null;["string","number"].includes(typeof t[e])&&(t[e]=vn(t[e])),t[e]instanceof Gs&&(s=new Kn(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 Gs&&this.element.removeChild(t.parent.element),this.items=this.items.filter((e=>e!==t))};for(let s=0;s<t.length;s++)e(t[s]);for(let t=0;t<this.items.length;t++)Object.assign(this,{[[t]]:this.items[t]})}return this}insertAt(t,...e){if(t>=this.element.children.length)this.append(...e);else for(let s=0;s<e.length;s++){let r=null;["number","string"].includes(typeof e[s])&&(e[s]=vn(e[s])),e[s]instanceof Gs&&(r=new Kn(e[s])),this.element.insertBefore(r.element,this.items[t].parent.element),this.items.splice(t,0,e[s][0])}return this}filterByTextContent(t,e=!1){return this.items.map((t=>t.parent.render())),this.items.filter((s=>{const r=s.element.textContent;return!(e?r===t:r.includes(t))})).map((t=>t.parent.render(!1))),this}sortByTextContent(t=1){return this.items.map((t=>t.parent.render(!1))),this.sortedItems=this.items.sort(((e,s)=>t*e.element.textContent.localeCompare(s.element.textContent))),this.append(...this.sortedItems),this}filterByClass(t){return this.items.map((t=>t.parent.render(!0))),this.items.filter((e=>!e.Classes.includes(t))).map((t=>t.parent.render(!1))),this}delete(t){return[...this.element.children].indexOf(t)}push(){}pop(){}unshift(){}shift(){}sort(){}filter(){}slice(){}}class Gn extends Qn{constructor(...t){super("ol","ol"),this.append(...t)}type(t=1){return this.element.setAttribute("type",t),this}start(t=1){return this.element.setAttribute("start",t),this}}class Jn extends Qn{constructor(...t){super("ul","ul"),this.append(...t)}}const ti=(...t)=>new Gn(...t),ei=(...t)=>new Jn(...t);class si extends Gs{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}}class ri extends Gs{constructor(){super(),this.element=document.createElement("textarea")}get value(){return this.element.textContent}}const ni=()=>new ri;class ii extends Gs{constructor(t,e="",s){super("input",t),Object.assign(this.events,{input:null}),this.setValue(e),s&&this.linkDatalist(s)}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 yi)e=t.Id;else if(t instanceof Array){const s=new yi(...t);e=s.Id,console.log(s)}else e=t;return this.element.setAttribute("list",e),this}get value(){return this.element.value}_setType(t){return this.element.type=t,this}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}}class oi extends ii{constructor(){super("inputSearch"),this._setType("search"),this.Length=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}}class ai extends ii{constructor(t,e,s=1){super("inpuNumber"),this._setType("number"),this.setMin(t).setMax(e).setStep(s)}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}}class hi extends ai{constructor(t=0,e=0,s=10,r=1){super("inputSlider"),this._setType("range"),this.setMin(e).setMax(s).setValue(t).setStep(r)}}class li extends ii{constructor(){super("inputColor"),this._setType("color"),this.background(this.value),this.onInput((()=>this.background(this.value)))}}class ci extends ii{constructor(){super("inputPassword"),this._setType("password")}}class ui extends ii{constructor(){super("inputEmail"),this._setType("email")}}class pi extends ii{constructor(){super("inputTime"),this._setType("time")}}class mi extends ii{constructor(){super("inputDate"),this._setType("date")}}class di extends ii{constructor(){super("inputDateTime"),this._setType("datetime-local")}}class gi extends ii{constructor(){super("inputCheckbox"),this._setType("checkbox"),this.cursor("pointer")}get checked(){return this.element.checked}check(t=!0){return this.element.checked=t,this}color(t){return this.element.style.accentColor=t,this}}class fi extends ii{constructor(){super("inputRadio"),this._setType("radio"),this.cursor("pointer")}get checked(){return this.element.checked}check(t=!0){return this.element.checked=t,this}color(t){return this.element.style.accentColor=t,this}}class bi extends Gs{constructor(t="File"){super("inputImage"),this._aux_element=Yn(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)}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}}class yi extends Gs{constructor(...t){super(),this.element=document.createElement("datalist"),this.addOptions(...t).setId("ziko-datalist-id"+it.string(10))}addOptions(...t){return t.map((t=>this.append(new si(t)))),this}}const wi=(t,e)=>{if(t instanceof Object){const{datalist:e,placeholder:s}=t;return t=t.value??"",new ii(t,e).setPlaceholder(s)}return new ii(t,e)},vi=(...t)=>new yi(...t),xi=(t,e,s,r)=>{if(t instanceof Object){const{min:e=0,max:s=10,step:r=1}=t;return new hi(t=t?.value??5,e,s,r)}return new hi(t,e,s,r)},Fi=(t,e,s)=>{if(t instanceof Object){const{value:e,max:s=10,step:r=1,placeholder:n=""}=t;return new hi(t=t?.min??0,s,r).setValue(e).setPlaceholder(n)}return new ai(t,e,s)},Ci=(...t)=>(new oi).connect(...t),Ei=t=>new bi(t),ki=()=>new ci,Ai=()=>new ui,Di=()=>new li,Bi=()=>new pi,_i=()=>new mi,Ti=()=>new di,Mi=()=>new gi,Ii=()=>new fi;class Si extends Gs{constructor(){super(),this.element=document.createElement("select")}addOptions(...t){return t.map((t=>this.append(new si(t)))),this}}const Li=()=>new Si;class Oi extends rr{constructor(){super(),this.element.setAttribute("src",""),this.constraints={audio:!0,video:{width:1280,height:720}}}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 ji=()=>new Oi;class Ri extends un{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"})}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 Vi.call(this,s),this.style({alignItems:"number"==typeof t?$i.call(this,t):t,justifyContent:"number"==typeof e?zi.call(this,e):e}),this}horizontal(t,e,s=1){return Ni.call(this,s),this.style({alignItems:"number"==typeof e?zi.call(this,e):e,justifyContent:"number"==typeof t?$i.call(this,t):t}),this}show(){return this.isHidden=!1,this.style({display:"flex"}),this}}const Pi=(...t)=>{let e="div";return"string"==typeof t[0]&&(e=t[0],t.pop()),new Ri(e).append(...t)};function Vi(t){return 1==t?this.style({flexDirection:"column"}):-1==t&&this.style({flexDirection:"column-reverse"}),this}function Ni(t){return 1==t?this.style({flexDirection:"row"}):-1==t&&this.style({flexDirection:"row-reverse"}),this}function $i(t){return"number"==typeof t&&(t=["flex-start","center","flex-end"][t+1]),t}function zi(t){return $i(-t)}class Ui extends un{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"})}columns(t){let e="";for(let s=0;s<t;s++)e=e.concat(" auto");return this.#m(e),this}#m(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 Hi=(...t)=>new Ui("div").append(...t);class Zi extends Gs{constructor(t,e,s="đ",r=s){super("details","Collapsible"),Object.assign(this.cache,{icons:{open:s,close:r}}),this.summary=Xn("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"}),bs(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 qi=(t,e,s,r)=>new Zi(t,e,s,r);class Wi extends un{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 Xi=(...t)=>new Wi(...t);class Yi extends Ri{constructor(...t){super(),this.style({position:"relative",overflow:"hidden",touchAction:"none",userSelect:"none"}),this.horizontal("space-around",0),this.track=Section(...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=>{}))}}const Ki=(...t)=>new Yi(...t);class Qi extends Ri{constructor(){super("section"),Object.assign(this.cache,{order:0,currentNote:null,currentNoteIndex:null}),this.vertical(0,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(eo(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 Gi=()=>new Qi,Ji={background:"none",width:"25px",height:"25px",fontSize:"1.2rem",cursor:"pointer"};class to extends Ri{constructor(t="",{type:e="js",order:s=null}={}){var r;super("section"),Object.assign(this.cache,{state:null,order:s,type:e,metadata:{created:Date.now(),updated:null}}),this.Input=((t="")=>Xn("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=Xn("output").style({width:"100%",height:"auto",padding:"5px 0"}),this.InOut=Pi(this.Input,this.Output).vertical().style({width:"100%",margin:"10px auto"}),this.RightControl=(r=this,Pi(vn("âļī¸").style(Ji).onClick((t=>{r.parent instanceof Qi&&r.parent.setCurrentNote(r),r.execute(),globalThis.__Ziko__.__Config__.default.target=t.target.parent.parent[1][1]})),vn("đ").style(Ji).onClick((()=>{navigator.clipboard.writeText(r.codeText)})),vn("âī¸").style(Ji).onClick((()=>r.remove())),vn("âī¸").style(Ji).onClick((()=>r.remove()))).style({width:"70px",height:"50px",margin:"10px 0"}).horizontal(0,0).wrap(!0)),this.LeftControl=Pi(vn("[ ]")).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 n=this.Input.element.getElementsByClassName("cm-content")[0];n?n.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 Qi&&("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 Qi&&(this.cache.parent.cache.currentNote=this,this.cache.parent.setCurrentNote(this))})),this.Input.onPaste((t=>{})))}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}#d(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 Qi&&(this.cache.parent.incrementOrder(),this.cache.parent.next()))}}#g(){}#f(){}evaluate(t){if(globalThis.__Ziko__.__Config__.default.target=this.Output.element,"js"===this.cache.type)this.#d(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 eo=(t,{type:e,order:s}={})=>new to(t,{type:e,order:s});class so extends Ri{#b=0;constructor(t,e){super("div","Tabs"),this.style({boxSizing:"border-box",backgroundColor:"blanchedalmond",border:"1px red solid",margin:"30px"}),this.append(Pi().size("auto","auto").style({boxSizing:"border-box",justifyContent:"center",alignItems:"center",textAlign:"center",minWidth:"50px",minHeight:"50px",backgroundColor:"darkblue",border:"1px darkblue solid"}),Pi().style({boxSizing:"border-box",justifyContent:"center",alignItems:"center",textAlign:"center",width:"100%",height:"100%",backgroundColor:"darkslategrey"})),this.Controller=this.items[0].setAttr("role","tablist"),this.Content=this.items[1],t.length!==e.length?console.error(""):(this.Controller.append(...t),this.Content.append(...e)),this.init(),this.display(0)}init(){for(let t=0;t<this.Controller.length;t++)this.Controller[t].setAttr("role","tab").setAttr("aria-controls",`tab${t}`),this.Content[t].setAttr("role","tabpanel").setAttr("aria-labelledby",`tab${t}`).setAttr("tabindex",-1);return this.Controller.forEach((t=>t.onClick((t=>{const e=t.target.element.getAttribute("aria-controls"),s=+e.slice(3);this.Content.filter((t=>t.element.getAttribute("aria-labelledby")===e),(()=>{this.#b!==s&&this.display(s)}))})))),this}addPairs(t,e){this.Controller.append(t),this.Content.append(e);const s=this.Controller.length;return this.Controller.at(-1).setAttr("role","tab").setAttr("aria-controls","tab"+(s-1)),this.Content.at(-1).setAttr("role","tabpanel").setAttr("aria-labelledby","tab"+(s-1)).setAttr("tabindex",-1),this}removePairs(t){}display(t){return this.#b=t%this.Content.length,this.Controller.forEach((t=>t.setAttr("tabindex",-1).setAttr("aria-selected",!1))),this.Controller.at(this.#b).setAttr("tabindex",0).setAttr("aria-selected",!0),(async()=>{await this.Content.forEach((t=>t.st.hide())),await this.Content.at(this.#b).setAttr("tabindex",0).st.show()})(),this}next(t=1){return this.display(this.#b+t),this}previous(t=1){return this.display(this.#b-t),this}useHorizontalSwippe(){return this.onPtrDown(),this.onPtrUp((t=>this.next(Math.sign(t.swippe.delta_x)))),this}useVerticalSwippe(){return this.onPtrDown(),this.onPtrUp((t=>this.next(Math.sign(t.swippe.delta_y)))),this}}const ro=(t,e)=>new so(t,e);class no extends un{constructor(){super("main","Main")}}class io extends un{constructor(){super("header","Header")}}class oo extends un{constructor(){super("nav","Nav")}}class ao extends un{constructor(){super("section","Section"),this.style({position:"relative"})}}class ho extends un{constructor(){super("article","Article")}}class lo extends un{constructor(){super("aside","Aside")}}class co extends un{constructor(){super("footer","Footer"),this.element=document.createElement("footer")}}const uo=(...t)=>(new ao).append(...t),po=(...t)=>(new ho).append(...t),mo=(...t)=>(new no).append(...t),go=(...t)=>(new io).append(...t),fo=(...t)=>(new co).append(...t),bo=(...t)=>(new oo).append(...t),yo=(...t)=>(new lo).append(...t);class wo extends Gs{constructor(...t){super(),this.element=document.createElement("Tr"),this.append(...t)}}class vo extends Gs{constructor(...t){super(),this.element=document.createElement("Td"),this.append(...t)}}class xo extends Gs{constructor(...t){super(),this.element=document.createElement("Thead"),this.append(...t)}}class Fo extends Gs{constructor(...t){super(),this.element=document.createElement("Tbody"),this.append(...t)}}class Co extends Gs{constructor(t){super(),this.element=document.createElement("Caption"),this.append(t)}}const Eo=(...t)=>(t=t.map((t=>(t instanceof Gs||(t=vn(t)),t))),new vo(...t)),ko=t=>new Co(t),Ao=t=>{var e=new Array(t.rows).fill(null).map((()=>((...t)=>new wo(...t))())),s=t.arr.map((t=>t.map((()=>null))));for(let r=0;r<s.length;r++)for(let n=0;n<s[0].length;n++)s[r][n]=Eo(t.arr[r][n]),e[r].append(s[r][n]);return e};class Do extends Gs{constructor(t,{caption:e=null,head:s=null,foot:r=null}={}){super("table","Table"),this.structure={caption:e,head:s,body:null,foot:r},t&&this.fromMatrix(t),e&&this.setCaption(e)}get caption(){return this.structure.caption}get header(){}get body(){}get footer(){}setCaption(t){return this.removeCaption(),this.structure.caption=ko(t),this.append(this.structure.caption),this}removeCaption(){return this.structure.caption&&this.removeItem(...this.items.filter((t=>t instanceof Co))),this.structure.caption=null,this}setHeader(...t){return this.tHead=((...t)=>(t=t.map((t=>(t instanceof Gs||(t=Eo(t)),t))),new xo(...UI)))(...t),this.append(this.tHead),this}removeHeader(){return this.removeItem(...this.items.filter((t=>t instanceof Co))),this}setFooter(t){return this.structure.caption=ko(t),this.append(this.structure.caption),this}removeFooter(){return this.removeItem(...this.items.filter((t=>t instanceof Co))),this}fromMatrix(t){return this.bodyMatrix=t instanceof Array?xr(t):t,this.structure.body&&this.remove(this.structure.body),this.structure.body=((...t)=>new Fo(...t))(),this.append(this.structure.body),this.structure.body.append(...Ao(this.bodyMatrix)),this}transpose(){return this.fromMatrix(this.bodyMatrix.T),this}hstack(t){return t instanceof Do&&(t=t.bodyMatrix),this.fromMatrix(this.bodyMatrix.clone.hstack(t)),this}vstack(t){return t instanceof Do&&(t=t.bodyMatrix),this.fromMatrix(this.bodyMatrix.clone.vstack(t)),this}slice(t=0,e=0,s=this.bodyMatrix.rows-1,r=this.bodyMatrix.cols-1){return this.fromMatrix(this.bodyMatrix.slice(t,e,s,r)),this}sortByCols(t,e={type:"num",order:"asc"}){return this.fromMatrix(this.bodyMatrix.clone.sortTable(t,e)),this}sortByRows(t,e={type:"num",order:"asc"}){return this.fromMatrix(this.bodyMatrix.T.clone.sortTable(t,e).T),this}filterByRows(t){return this.fromMatrix(this.bodyMatrix.clone.filterByRows(t)),this}filterByCols(t){return this.fromMatrix(this.bodyMatrix.clone.filterByCols(t)),this}forEachRow(t){return this.structure.body.forEach(t),this}forEachItem(t){return this.structure.body.forEach((e=>e.forEach(t))),this}}const Bo=(t,e)=>new Do(t,e),_o={html:Xn,text:vn,quote:xn,dfnText:Fn,supText:Cn,subText:En,codeText:kn,abbrText:An,p:_n,blockQuote:Tn,h1:In,h2:Sn,h3:Ln,h4:On,h5:jn,h6:Rn,btn:Yn,br:Un,hr:Hn,brs:Zn,hrs:qn,link:Wn,ol:ti,ul:ei,input:wi,search:Ci,slider:xi,checkbox:Mi,radio:Ii,datalist:vi,inputNumber:Fi,inputColor:Di,inputDate:_i,inputDateTime:Ti,inputEmail:Ai,inputImage:Ei,inputPassword:ki,inputTime:Bi,select:Li,textarea:ni,inputCamera:ji,image:tr,video:nr,audio:or,figure:sr,Flex:Pi,Carousel:Ki,Grid:Hi,Header:go,Main:mo,Section:uo,Article:po,Aside:yo,Nav:bo,Footer:fo,Table:Bo,CodeCell:eo,CodeNote:Gi,Tabs:ro,Collapsible:qi,Accordion:Xi,ExtractAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"ExtractAll"!==s&&"RemoveAll"!==s&&(globalThis[s]=this[s])}return this},RemoveAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"RemoveAll"!==s&&delete globalThis[s]}return this}};class To extends Gs{constructor(t=360,e=300){super("svg","svg"),this.setAttr("width",t),this.setAttr("height",e),this.style({border:"1px black solid"}),this.view(-10,-10,10,10)}view(t,e,s,r){let n=Math.abs(s-t),i=Math.abs(r-e);return this.setAttr("viewBox",[t,e,n,i].join(" ")),this.st.scaleY(-1),this}add(...t){for(let e=0;e<t.length;e++)this.element.appendChild(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 Mo=(t,e)=>new To(t,e);class Io{constructor(t){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 So extends Io{constructor(t,e,s,r,n=!0){super(),this.element=document.createElementNS("http://www.w3.org/2000/svg","rect"),this.setX(t).setY(e).width(s).height(r),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 Lo=(t,e,s,r,n)=>new So(t,e,s,r,n);class Oo extends Io{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.r.baseVal.value}get cx(){return this.element.cx.baseVal.value}get cy(){return this.element.cy.baseVal.value}}const jo=(t,e,s)=>new Oo(t,e,s);class Ro extends Io{constructor(t,e,s,r){super("ellipse"),this.element=document.createElementNS("http://www.w3.org/2000/svg","ellipse"),this.pos(t,e).setRx(s).setRy(r)}setRx(t){return this.element.rx.baseVal.value=t,this}setRy(t){return this.element.ry.baseVal.value=t,this}}const Po=(t,e,s,r)=>new Ro(t,e,s,r);class Vo extends Io{constructor(t,e,s,r){super(),this.element=document.createElementNS("http://www.w3.org/2000/svg","line"),this.x1(t).y1(e).x2(s).y2(r).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 No=(t,e,s,r)=>new Vo(t,e,s,r);class $o extends Io{}class zo extends Io{constructor(){super(),this.element=document.createElementNS("http://www.w3.org/2000/svg","path"),this.path=""}setPath(){return this.element.setAttribute("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,r,n,i){return this.path+=`C ${t} ${e},${s} ${r},${n} ${i} `,this.setPath(),this}quadratic(t,e,s,r){return this.path+=`Q ${t} ${e} ${s} ${r} `,this.setPath(),this}close(){return this.path+="Z",this.setPath(),this}}const Uo=()=>new zo;class Ho extends Io{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 r=this.element.parentElement.createSVGPoint();r.x=t[s],r.y=e[s],this.element.points.appendItem(r)}return this}}const Zo=(t,e)=>new Ho(t,e);class qo extends Io{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 Wo=(t,e,s)=>new qo(t,e,s);class Xo extends Io{constructor(t="",e="100%",s="100%",r=0,n=0){super(),this.element=document.createElementNS("http://www.w3.org/2000/svg","image"),this.setSrc(t).width(e).height(s).x(r).y(n)}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 Yo=(t,e,s,r,n)=>new Xo(t,e,s,r,n);class Ko extends Io{constructor(t=0,e=0,s="100%",r="100%",...n){super("foreignObject"),this.items=[],this.element=document.createElementNS("http://www.w3.org/2000/svg","foreignObject"),this.container=Pi().setTarget(this.element).vertical(0,0).size("auto","auto"),this.container.st.scaleY(-1),this.posX(t).posY(e).width(s).height(r)}width(t){return this.element.setAttribute("width",t),this}height(t){return this.element.setAttribute("height",t),this}add(...t){return this.container.append(...t),this}remove(...t){return this.container.append(...t),this}}const Qo=(t,e,s)=>new Ko(t,e,s);class Go extends Io{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 Jo=(...t)=>new Go(...t);class ta extends Io{constructor(t,...e){super(),this.items=[],this.element=document.createElementNS("http://www.w3.org/2000/svg","a"),this.element.setAttribute("href",t),this.add(...e)}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 ea=(t,...e)=>new ta(t,...e),sa=(t,e,s=10,r=10)=>{let n=Uo().fill("none").stroke("coral").strokeWidth(.6);console.log({x:t/s,y:e/r});for(let e=0;e<t;e++)n.moveTo(0,e*t/s).hr(t);for(let t=0;t<e;t++)n.moveTo(t*e/r,0).vr(e);return n};class ra extends un{constructor(t,e){super("canvas","canvas"),this.ctx=this.element.getContext("2d"),this.style({border:"1px red solid"}),this.transformMatrix=new vr([[1,0,0],[0,1,0],[0,0,1]]),this.axisMatrix=new vr([[-10,-10],[10,10]]),setTimeout((()=>this.resize(t,e)),0),this.on("sizeupdated",(()=>this.adjust()))}get Width(){return this.element.width}get Height(){return this.element.height}get Xmin(){return this.axisMatrix[0][0]}get Ymin(){return this.axisMatrix[0][1]}get Xmax(){return this.axisMatrix[1][0]}get Ymax(){return this.axisMatrix[1][1]}get ImageData(){return this.ctx.getImageData(0,0,c.Width,c.Height)}draw(t=!0){return t?(this.clear(),this.items.forEach((t=>{t.parent=this,t.draw(this.ctx)}))):(this.items.at(-1).parent=this,this.items.at(-1).draw(this.ctx)),this.maintain(),this}applyTransformMatrix(){return this.ctx.setTransform(this.transformMatrix[0][0],this.transformMatrix[1][0],this.transformMatrix[0][1],this.transformMatrix[1][1],this.transformMatrix[0][2],this.transformMatrix[1][2]),this}resize(t,e){return this.size(t,e),this.lineWidth(),this.view(this.axisMatrix[0][0],this.axisMatrix[0][1],this.axisMatrix[1][0],this.axisMatrix[1][1]),this.emit("sizeupdated"),this}adjust(){return this.element.width=this.element.getBoundingClientRect().width,this.element.height=this.element.getBoundingClientRect().height,this.view(this.axisMatrix[0][0],this.axisMatrix[0][1],this.axisMatrix[1][0],this.axisMatrix[1][1]),this}view(t,e,s,r){return this.transformMatrix[0][0]=this.Width/(s-t),this.transformMatrix[1][1]=-this.Height/(r-e),this.transformMatrix[0][2]=this.Width/2,this.transformMatrix[1][2]=this.Height/2,this.axisMatrix=new vr([[t,e],[s,r]]),this.applyTransformMatrix(),this.clear(),this.lineWidth(1),this.draw(),this}reset(){return this.ctx.setTransform(1,0,0,0,0,0),this}append(t){return this.items.push(t),this.draw(!1),this}background(t){this.ctx.fillStyle=t,this.ctx.setTransform(1,0,0,1,0,0),this.ctx.fillRect(0,0,this.Width,this.Height),this.applyTransformMatrix(),this.draw()}lineWidth(t){return this.ctx.lineWidth=t/this.transformMatrix[0][0],this}ImageData(t=0,e=0,s=this.Width,r=this.Height){return this.ctx.getImageData(t,e,s,r)}clear(){return this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.Width,this.Height),this.applyTransformMatrix(),this}clone(){console.log(this.Width);const t=new ra;return t.items=this.items,t.transformMatrix=this.transformMatrix,t.axisMatrix=this.axisMatrix,Object.assign(t.cache,{...this.cache}),this.size(element.style.width,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 na=(t,e)=>new ra(t,e);class ia{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 oa extends ia{constructor(t,e,s,r){super(t,e),this.r=s,this.angle=r,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 aa=(t,e,s,r)=>new oa(t,e,s,r),ha=(t,e,s)=>new oa(t,e,s,2*Math.PI);class la extends ia{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=xr([t,e]),this}push(t,e){return this.pointsMatrix.hstack(xr([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 ca=(t=[],e=[])=>new la(t,e);class ua extends ia{constructor(t,e,s,r){super(),this.x0=t,this.x1=s,this.y0=e,this.y1=r,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 pa=(t,e,s,r)=>new ua(t,e,s,r);class ma extends ia{constructor(t,e,s,r){super(t,e),this.w=s,this.h=r,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 da=(t,e,s,r)=>new ma(t,e,s,r),ga={Svg:Mo,ZikoUISvg:To,svgCircle:jo,svgEllipse:Po,svgImage:Yo,svgLine:No,svgPolygon:Zo,svgRect:Lo,svgText:Wo,svgGroupe:Jo,svgLink:ea,svgGrid:sa,svgObject:Qo,svgPath:Uo,Canvas:na,canvasArc:aa,canvasCircle:ha,canvasPoints:ca,canvasLine:pa,canvasRect:da,ExtractAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"ExtractAll"!==s&&"RemoveAll"!==s&&(globalThis[s]=this[s])}return this},RemoveAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"RemoveAll"!==s&&delete globalThis[s]}return this}};class fa{constructor(t,e){this.root_UI=t,this.routes=new Map([[404,vn("Error 404")],...Object.entries(e)]),this.patterns=new Map,this.maintain(),window.onpopstate=this.render(location.pathname)}get(t,e){if("string"==typeof t&&t.includes(":")){const s=new RegExp(`^${t.replace(/:([^/]+)/g,((t,e)=>"(.+)"))}$`);this.patterns.set(s,(t=>{const r=s.exec(t).slice(1);e(...r)}))}else t instanceof RegExp?this.patterns.set(t,e):this.routes.set(t,e);return this.maintain(),this}maintain(){return this.root_UI.append(...this.routes.values()),[...this.routes.values()].map((t=>t.render(!1))),this.render(location.pathname),this}render(t){if(this.routes.get(t))this.routes.get(t).render(!0);else{const e=[...this.patterns.keys()].find((e=>e.test(t)));e?this.patterns.get(e)(t):this.routes.get(404).render(!0)}return window.history.pushState({},"",t),this}}const ba=(t,e,s)=>new fa(t,e,s),ya={},wa={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")};if(globalThis?.document){class t extends HTMLElement{constructor(){super(),this.shadowDOM=this.attachShadow({mode:"open"}),this.wrapper=document.createElement("div")}connectedCallback(){this.setAttribute("role","region"),this.setAttribute("data-engine","zikojs"),this.shadowDOM.append(this.wrapper),this.observeContentChanges()}observeContentChanges(){new MutationObserver((t=>{t.forEach((t=>{"childList"!==t.type&&"characterData"!==t.type||(this.wrapper.innerHTML="",__Ziko__.__Config__.setDefault({target:this.wrapper}),globalThis.eval(this.innerHTML))}))})).observe(this,{childList:!0,subtree:!0,characterData:!0})}disconnectedCallback(){console.log("ZikoUIComponent removed from page.")}}globalThis.customElements.define("ziko-ui",t)}else e.ZikoUIComponent=null;class va{constructor(t){this.app=t,this.meta={},this.#y("generator","zikojs")}#y(t,e){const s=document.querySelector(`meta[name=${t}]`);return this.meta=s||document.createElement("meta"),this.meta.setAttribute("name",t),this.meta.setAttribute("content",e),s||this.app.head.append(this.meta),this}charset(t="utf-8"){const e=document.querySelector("meta[charset]");return this.meta=e||document.createElement("meta"),this.meta.setAttribute("charset",t),e||this.app.head.append(this.meta),this}description(t){return this.#y("description",t),this}viewport(t="width=device-width, initial-scale=1.0"){return this.#y("viewport",t),this}keywords(...t){return t.push("zikojs"),t=[...new Set(t)].join(", "),this.#y("keywords",t),this}author(t="",e=""){const s=[t,e].join(", ");return this.#y("author",s),this}}class xa extends Ri{constructor(){super("main"),this.root=document.documentElement,this.head=null,this.#n(),this.seo=new va(this),Object.assign(this.events,{hash:null}),Object.assign(this.cache,{theme:null,isRoot:!0})}#n(){this.root.setAttribute("data-engine","zikojs");const t=this.root.getElementsByTagName("head")[0];this.head=t||(this.head=document.createElement("head")),t||this.root.insertBefore(this.head,document.body);const e=this.head.getElementsByTagName("title")[0];this.Title=e||document.createElement("title"),e||this.head.append(this.Title)}title(t=this.title.textContent){return this.Title.textContent=t,this}prefetch(){}description(){}onHashChange(...t){return this.events.hash||(this.events.hash=ns(this)),this.events.hash.onChange(...t),this}}const Fa=(...t)=>(new xa).append(...t),Ca={App:Fa,Math:cn,UI:_o,Time:qs,Graphics:ga,Reactivity:Qs,Data:wr,SPA:ba};function Ea(){return _o.ExtractAll(),cn.ExtractAll(),qs.ExtractAll(),Qs.ExtractAll(),ga.ExtractAll(),wr.ExtractAll(),this}function ka(){_o.RemoveAll(),cn.RemoveAll(),qs.RemoveAll(),Qs.RemoveAll(),ga.RemoveAll(),wr.RemoveAll()}globalThis.__Ziko__?console.warn("WARNING: Multiple instances of Ziko.js being imported."):globalThis.__Ziko__={...Ca,__UI__:ya,__Config__:wa,ExtractAll:Ea,RemoveAll:ka},globalThis.document&&document.addEventListener("DOMContentLoaded",__Ziko__.__Config__.init()),e.Accordion=Xi,e.App=Fa,e.Article=po,e.Aside=yo,e.Base=tt,e.Canvas=na,e.Carousel=Ki,e.CodeCell=eo,e.CodeNote=Gi,e.Collapsible=qi,e.Combinaison=rt,e.Complex=o,e.DarkThemes=Zt,e.Data=wr,e.E=r,e.EPSILON=n,e.Ease=js,e.ExtractAll=Ea,e.Fixed=y,e.Flex=Pi,e.Footer=fo,e.Graphics=ga,e.Grid=Hi,e.Header=go,e.LightThemes=Ht,e.LinearSystem=kr,e.Logic=et,e.Main=mo,e.Math=cn,e.Matrix=vr,e.Nav=bo,e.PI=s,e.Permutation=st,e.Random=it,e.Reactivity=Qs,e.RemoveAll=ka,e.SPA=ba,e.Section=uo,e.Signal=ln,e.Str=br,e.Svg=Mo,e.Table=Bo,e.Tabs=ro,e.Themes=qt,e.Time=qs,e.UI=_o,e.Utils=en,e.ZikoUIAbbrText=wn,e.ZikoUIAccordion=Wi,e.ZikoUIArticle=ho,e.ZikoUIAside=lo,e.ZikoUIAudio=ir,e.ZikoUIBlockQuote=Bn,e.ZikoUIBr=Nn,e.ZikoUICanvas=ra,e.ZikoUICodeNote=Qi,e.ZikoUICodeText=yn,e.ZikoUIDefintion=gn,e.ZikoUIElement=Gs,e.ZikoUIFigure=er,e.ZikoUIFooter=co,e.ZikoUIHeader=io,e.ZikoUIHeading=Mn,e.ZikoUIHr=$n,e.ZikoUIHtmlTag=Pn,e.ZikoUIImage=Js,e.ZikoUILink=zn,e.ZikoUIMain=no,e.ZikoUINav=oo,e.ZikoUIParagraphe=Dn,e.ZikoUIQuote=dn,e.ZikoUISection=ao,e.ZikoUISubText=bn,e.ZikoUISupText=fn,e.ZikoUISvg=To,e.ZikoUIText=mn,e.ZikoUIVideo=rr,e.__Config__=wa,e.abbrText=An,e.abs=w,e.accum=m,e.acos=I,e.acosh=N,e.acot=O,e.add=Ir,e.adoc2html=Ct,e.arange=Hr,e.arr2str=mr,e.asin=S,e.asinh=$,e.atan=L,e.atan2=W,e.atanh=U,e.audio=or,e.bessel=(t,e)=>{if("number"==typeof t){if("number"==typeof t)return f(t,e);console.warn("Not supported yet")}else if(t instanceof Array){if("number"==typeof e)return Ar((t=>f(t,e)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(Ar((e=>f(t[r],e)),...e));return s}}},e.beta=(t,e)=>{if("number"==typeof t){if("number"==typeof t)return b(t,e);console.warn("Not supported yet")}else if(t instanceof Array){if("number"==typeof e)return Ar((t=>b(t,e)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(Ar((e=>b(t[r],e)),...e));return s}}},e.blockQuote=Tn,e.br=Un,e.brs=Zn,e.btn=Yn,e.canvasArc=aa,e.canvasCircle=ha,e.canvasLine=pa,e.canvasPoints=ca,e.canvasRect=da,e.cartesianProduct=Gr,e.ceil=H,e.checkbox=Mi,e.choleskyDecomposition=ut,e.clamp=Ur,e.codeText=kn,e.complex=a,e.cos=k,e.cosh=j,e.cot=M,e.coth=V,e.count=(t,e)=>t.split("").filter((t=>t==e)).length,e.countWords=(t,e)=>t.split(" ").filter((t=>t==e)).length,e.csc=T,e.csv2arr=Et,e.csv2json=Dt,e.csv2matrix=kt,e.csv2object=At,e.csv2sql=Bt,e.datalist=vi,e.default=Ca,e.deg2rad=Xr,e.dfnText=Fn,e.div=Or,e.e=C,e.fact=X,e.figure=sr,e.floor=Z,e.gamma=(...t)=>Ar(g,...t),e.geomspace=Wr,e.h1=In,e.h2=Sn,e.h3=Ln,e.h4=On,e.h5=jn,e.h6=Rn,e.hr=Hn,e.hrs=qn,e.html=Xn,e.hypot=Q,e.image=tr,e.inRange=Kr,e.input=wi,e.inputCamera=ji,e.inputColor=Di,e.inputDate=_i,e.inputDateTime=Ti,e.inputEmail=Ai,e.inputImage=Ei,e.inputNumber=Fi,e.inputPassword=ki,e.inputTime=Bi,e.isApproximatlyEqual=Qr,e.json2arr=Mt,e.json2csv=It,e.json2csvFile=St,e.json2xml=Pt,e.json2xmlFile=Vt,e.json2yml=jt,e.json2ymlFile=Rt,e.lerp=$r,e.li=t=>new Kn(t),e.link=Wn,e.linspace=Zr,e.ln=E,e.logspace=qr,e.luDecomposition=ot,e.map=zr,e.mapfun=Ar,e.markdown2html=ft,e.matrix=xr,e.matrix2=Fr,e.matrix3=Cr,e.matrix4=Er,e.max=p,e.min=u,e.modulo=jr,e.mul=Lr,e.norm=Nr,e.nums=Vr,e.obj2str=ur,e.ol=ti,e.ones=Pr,e.p=_n,e.pgcd=Jr,e.pow=x,e.powerSet=G,e.ppcm=tn,e.prod=l,e.qrDecomposition=ct,e.quote=xn,e.rad2deg=Yr,e.radio=Ii,e.removeExtraSpace=t=>t.replace(/\s+/g," "),e.round=q,e.search=Ci,e.sec=B,e.select=Li,e.sig=K,e.sign=Y,e.sin=A,e.sinc=_,e.sinh=R,e.slider=xi,e.sqrt=v,e.sqrtn=F,e.str=yr,e.sub=Sr,e.subSet=J,e.subText=En,e.sum=h,e.supText=Cn,e.svg2ascii=hr,e.svg2img=cr,e.svg2imgUrl=lr,e.svg2str=ar,e.svgCircle=jo,e.svgEllipse=Po,e.svgGrid=sa,e.svgGroupe=Jo,e.svgImage=Yo,e.svgLine=No,e.svgLink=ea,e.svgObject=Qo,e.svgPath=Uo,e.svgPolyLine=(t,e)=>new $o(t,e),e.svgPolygon=Zo,e.svgRect=Lo,e.svgText=Wo,e.tan=D,e.tanh=P,e.text=vn,e.textarea=ni,e.timeTaken=Us,e.time_memory_Taken=Vs,e.ul=ei,e.useAnimation=Zs,e.useBattery=Bs,e.useBluetooth=As,e.useChannel=Fs,e.useClickEvent=$e,e.useClipboardEvent=We,e.useCustomEvent=as,e.useDebounce=Rs,e.useDragEvent=je,e.useDropEvent=Re,e.useEventEmitter=Kt,e.useFavIcon=te,e.useFocusEvent=Qe,e.useGeolocation=Ts,e.useHashEvent=ns,e.useInputEvent=es,e.useKeyEvent=_e,e.useLocaleStorage=Xs,e.useMediaQuery=se,e.useMouseEvent=xe,e.usePointerEvent=pe,e.useSessionStorage=Ys,e.useStyle=Ut,e.useSuccesifKeys=Ks,e.useTheme=Xt,e.useThread=Es,e.useThrottle=Ps,e.useTimeLoop=Os,e.useTitle=Gt,e.useWheelEvent=Ee,e.video=nr,e.wait=zs,e.waitForUIElm=Ns,e.waitForUIElmSync=$s,e.watchAttr=bs,e.watchChildren=ws,e.watchIntersection=cs,e.watchScreen=gs,e.watchSize=ms,e.zeros=Rr,Object.defineProperty(e,"__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,r=Number.EPSILON;class n{}class i extends n{constructor(t=0,e=0){super(),t instanceof i?(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=w(t.z**2-t.a**2)):"a"in e&&"phi"in t?(this.a=t.a,this.b=t.a*A(t.phi)):"b"in e&&"z"in t?(this.b=t.b,this.a=w(t.z**2-t.b**2)):"b"in e&&"phi"in t?(this.b=e,this.a=t.b/A(t.phi)):"z"in e&&"phi"in t&&(this.a=t.z*k(t.phi),this.a=t.z*E(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 i(this.a,this.b)}get z(){return G(this.a,this.b)}get phi(){return X(this.b,this.a)}static Zero(){return new i(0,0)}get conj(){return new i(this.a,-this.b)}get inv(){return new i(this.a/(x(this.a,2)+x(this.b,2)),-this.b/(x(this.a,2)+x(this.b,2)))}add(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new i(t[e],0));let e=t.map((t=>t.a)),s=t.map((t=>t.b));return this.a+=+a(...e).toFixed(15),this.b+=+a(...s).toFixed(15),this}sub(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new i(t[e],0));let e=t.map((t=>t.a)),s=t.map((t=>t.b));return this.a-=+a(...e).toFixed(15),this.b-=+a(...s).toFixed(15),this}mul(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new i(t[e],0));let e=+h(this.z,...t.map((t=>t.z))).toFixed(15),s=+a(this.phi,...t.map((t=>t.phi))).toFixed(15);return this.a=+(e*k(s).toFixed(15)).toFixed(14),this.b=+(e*E(s).toFixed(15)).toFixed(14),this}div(...t){for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(t[e]=new i(t[e],0));let e=+(this.z/h(...t.map((t=>t.z)))).toFixed(15),s=+(this.phi-a(...t.map((t=>t.phi)))).toFixed(15);return this.a=+(e*k(s).toFixed(15)).toFixed(15),this.b=+(e*E(s).toFixed(15)).toFixed(15),this}pow(t){if(H(t)===t&&t>0){let e=+(this.z**t).toFixed(15),s=+(this.phi*t).toFixed(15);this.a=+(e*k(s).toFixed(15)).toFixed(15),this.b=+(e*E(s).toFixed(15)).toFixed(15)}return this}static fromExpo(t,e){return new i(+(t*k(e)).toFixed(13),+(t*E(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 o(t**this.a*k(this.b*F(t)),t**this.a*E(this.b*F(t)))}sqrtn(t=2){return o(v(this.z,t)*k(this.phi/t),v(this.z,t)*E(this.phi/t))}get sqrt(){return this.sqrtn(2)}get log(){return o(this.z,this.phi)}get cos(){return o(k(this.a)*L(this.b),E(this.a)*j(this.b))}get sin(){return o(E(this.a)*L(this.b),k(this.a)*j(this.b))}get tan(){const t=k(2*this.a)+L(2*this.b);return o(E(2*this.a)/t,j(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 o=(t,e)=>{if((t instanceof Array||ArrayBuffer.isView(t))&&(e instanceof Array||ArrayBuffer.isView(t)))return t.map(((s,r)=>o(t[r],e[r])));if(t instanceof dr&&e instanceof dr){if(t.shape[0]!==e.shape[0]||t.shape[1]!==e.shape[1])return Error(0);const s=t.arr.map(((s,r)=>o(t.arr[r],e.arr[r])));return new dr(t.rows,t.cols,...s)}return new i(t,e)},a=(...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(a(...t[s])):t[s]instanceof Object&&e.push(a(...Object.values(t[s])));return 1===e.length?e[0]:e},h=(...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(h(...t[s])):t[s]instanceof Object&&e.push(h(...Object.values(t[s])));return 1===e.length?e[0]:e},l=(...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(l(...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},u=(...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(l(...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},p=(...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(p(...t[s])):t[s]instanceof Object&&e.push(null);return 1===e.length?e[0]:e},m=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)*m(1-t))).toFixed(10);t-=1;let s=e[0];for(let r=1;r<9;r++)s+=e[r]/(t+r);const r=t+7+.5;return+(Math.sqrt(2*Math.PI)*Math.pow(r,t+.5)*Math.exp(-r)*s).toFixed(10)},g=(t,e)=>{let s=0;for(let r=0;r<100;r++){s+=Math.pow(-1,r)*Math.pow(e/2,t+2*r)/(W(r)*W(t+r))}return s},f=(t,e)=>{let s=0;const r=s=>Math.pow(s,t-1)*Math.pow(1-s,e-1);s+=.5*(r(0)+r(1));for(let t=1;t<1e3;t++){s+=r(0+.001*t)}return.001*s},b={cos:t=>+Math.cos(t).toFixed(15),sin:t=>+Math.sin(t).toFixed(15),tan:t=>+Math.tan(t).toFixed(31),sinc:t=>+Math.sin(Math.PI*t)/(Math.PI*t),sec:t=>1/Math.cos(t).toFixed(15),csc:t=>1/Math.sin(t).toFixed(15),cot:t=>1/Math.tan(t).toFixed(15),acos:t=>+Math.acos(t).toFixed(15),asin:t=>+Math.asin(t).toFixed(15),atan:t=>+Math.atan(t).toFixed(15),acot:t=>+Math.PI/2-Math.atan(t).toFixed(15),cosh:t=>+Math.cosh(t).toFixed(15),sinh:t=>+Math.sinh(t).toFixed(15),tanh:t=>+Math.tanh(t).toFixed(15),coth:t=>+(.5*Math.log((1+t)/(1-t))).toFixed(15),acosh:t=>+Math.acosh(t).toFixed(15),asinh:t=>+Math.asinh(t).toFixed(15),atanh:t=>+Math.atanh(t).toFixed(15)},y=(...t)=>yr(Math.abs,...t),w=(...t)=>yr(Math.sqrt,...t),x=(t,e)=>{if("number"==typeof t)return"number"==typeof e?Math.pow(t,e):e instanceof i?i.fromExpo(t**e.a,e.b*F(t)):yr((e=>x(t,e)),...e);if(t instanceof i)return"number"==typeof e?i.fromExpo(t.z**e,t.phi*e):e instanceof i?i.fromExpo(t.z**e.a*C(-t.phi*e.b),F(t.z)*e.b+e.a*t.phi):yr((e=>x(t,e)),...e);if(t instanceof Array){if("number"==typeof e)return yr((t=>x(t,e)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(yr((e=>x(t[r],e)),...e));return s}}},v=(t,e)=>{if("number"==typeof t)return"number"==typeof e?Math.pow(t,1/e):yr((e=>v(t,e)),...e);if(t instanceof i)return"number"==typeof e?i.fromExpo(v(t.z,e),t.phi/e):yr((e=>v(t,e)),...e);if(t instanceof Array){if("number"==typeof e)return yr((t=>v(t,e)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(yr((e=>v(t[r],e)),...e));return s}}},C=(...t)=>yr(Math.exp,...t),F=(...t)=>yr(Math.log,...t),k=(...t)=>yr(b.cos,...t),E=(...t)=>yr(b.sin,...t),A=(...t)=>yr(b.tan,...t),D=(...t)=>yr(b.sec,...t),B=(...t)=>yr(b.sinc,...t),T=(...t)=>yr(b.csc,...t),_=(...t)=>yr(b.cot,...t),I=(...t)=>yr(b.acos,...t),M=(...t)=>yr(b.asin,...t),S=(...t)=>yr(b.atan,...t),O=(...t)=>yr(b.acot,...t),L=(...t)=>yr(b.cosh,...t),j=(...t)=>yr(b.sinh,...t),R=(...t)=>yr(b.tanh,...t),P=(...t)=>yr(b.coth,...t),$=(...t)=>yr(b.acosh,...t),N=(...t)=>yr(b.asinh,...t),V=(...t)=>yr(b.atanh,...t),U=(...t)=>yr(Math.ceil,...t),H=(...t)=>yr(Math.floor,...t),Z=(...t)=>yr(Math.round,...t),X=(t,e,s=!0)=>{if("number"==typeof t)return"number"==typeof e?s?Math.atan2(t,e):180*Math.atan2(t,e)/Math.PI:yr((e=>X(t,e,s)),...e);if(t instanceof Array){if("number"==typeof e)return yr((t=>X(t,e,s)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(yr((e=>x(t[r],e)),...e));return s}}},W=(...t)=>yr((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),q=(...t)=>yr(Math.sign,...t),Y=(...t)=>yr((t=>1/(1+C(-t))),...t),G=(...t)=>t.every((t=>"number"==typeof t))?Math.hypot(...t):t.every((t=>t instanceof Array))?yr(Math.hypot,...t):void 0,Q=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},K=null,J={_mode:Number,_map:function(t,e,s){return e instanceof dr?new dr(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof i?new i(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}},tt={_mode:Number,_map:function(t,e,s){return e instanceof dr?new dr(e.rows,e.cols,e.arr.flat(1).map((e=>t(e,s)))):e instanceof i?new i(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)?tt._mode(!t):this._map(this.not,t)},and:function(t,...e){return["number","boolean"].includes(typeof t)?tt._mode(e.reduce(((t,e)=>t&e),t)):this._map(this.and,t,e)},or:function(t,...e){return["number","boolean"].includes(typeof t)?tt._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 tt.not(tt.xor(t,e))}};class et{static withDiscount(t,e=t.length){if(1===e)return t.map((t=>[t]));const s=[];let r;return r=this.withDiscount(t,e-1),t.forEach((t=>{r.forEach((e=>{s.push([t].concat(e))}))})),s}static withoutDiscount(t){if(1===t.length)return t.map((t=>[t]));const e=[],s=this.withoutDiscount(t.slice(1)),r=t[0];for(let t=0;t<s.length;t++){const n=s[t];for(let t=0;t<=n.length;t++){const s=n.slice(0,t),i=n.slice(t);e.push(s.concat([r],i))}}return e}}class st{static withDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((r,n)=>{this.withDiscount(t.slice(n),e-1).forEach((t=>{s.push([r].concat(t))}))})),s}static withoutDiscount(t,e){if(1===e)return t.map((t=>[t]));const s=[];return t.forEach(((r,n)=>{this.withoutDiscount(t.slice(n+1),e-1).forEach((t=>{s.push([r].concat(t))}))})),s}}const rt={Logic:tt,Base:J,Permutation:et,Combinaison:st,combinaison:(t,e,s=!1)=>st[s?"withDiscount":"withoutDiscount"](t,e),powerSet:Q,subSet:K};class nt{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=Wr.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 pr(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"#"+J.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 i(this.float(t[0],t[1]),this.float(e[0],e[1])):new i(...this.floats(2,t,e))}static complexInt(t=[0,1],e=[0,1]){return new i(this.int(t[0],t[1]),this.int(e[0],e[1]))}static complexBin(){return new i(...this.bins(2))}static complexOct(){return new i(...this.octs(2))}static complexDec(){return new i(...this.decs(10))}static complexHex(){return new i(...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 pr(t,e,this.floats(t*e,s,r))}static matrixInt(t,e,s,r){return pr(t,e,this.ints(t*e,s,r))}static matrixBin(t,e){return pr(t,e,this.bins(t*e))}static matrixOct(t,e){return pr(t,e,this.octs(t*e))}static matrixDec(t,e){return pr(t,e,this.decs(t*e))}static matrixHex(t,e){return pr(t,e,this.hex(t*e))}static matrixColor(t,e){return pr(t,e,this.colors(t*e))}static matrixComplex(t,e,s,r){return pr(t,e,this.complexes(t*e,s,r))}static matrixComplexInt(t,e,s,r){return pr(t,e,this.complexesInt(t*e,s,r))}static matrixComplexBin(t,e){return pr(t,e,this.complexesBin(t*e))}static matrixComplexOct(t,e){return pr(t,e,this.complexesBin(t*e))}static matrixComplexDec(t,e){return pr(t,e,this.complexesBin(t*e))}static matrixComplexHex(t,e){return pr(t,e,this.complexesBin(t*e))}}const it=t=>{t instanceof dr&&(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 n=0;n<e;n++){for(let i=n;i<e;i++){let e=0;for(let t=0;t<n;t++)e+=s[n][t]*r[t][i];r[n][i]=t[n][i]-e}for(let i=n;i<e;i++)if(n==i)s[n][n]=1;else{let e=0;for(let t=0;t<n;t++)e+=s[i][t]*r[t][n];s[i][n]=(t[i][n]-e)/r[n][n]}}return[s,r].map((t=>new dr(t)))},ot=(t,e)=>t.reduce(((t,s,r)=>t+s*e[r]),0),at=t=>Math.sqrt(t.reduce(((t,e)=>t+e*e),0)),ht=t=>t.map((e=>e/at(t))),lt=t=>{t instanceof dr&&(t=t.arr);const e=t.length,s=t[0].length,r=[],n=[];for(let t=0;t<e;t++)n.push(new Array(s).fill(0));for(let i=0;i<s;i++){let s=t.map((t=>t[i]));for(let o=0;o<i;o++){const a=r[o],h=ot(a,t.map((t=>t[i])));for(let t=0;t<e;t++)s[t]-=h*a[t];n[o][i]=h}const o=at(s);r.push(ht(s)),n[i][i]=o}return[r,n].map((t=>new dr(t)))},ct=t=>{t instanceof dr&&(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 n=0;for(let t=0;t<e;t++)n+=s[r][t]*s[e][t];s[r][e]=r===e?Math.sqrt(t[r][r]-n):1/s[e][e]*(t[r][e]-n)}return new dr(s)},ut=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>"),dt=t=>`<tr>${t.split("|").map((t=>t.trim())).filter((t=>""!==t)).map((t=>`<td>${ut(t)}</td>`)).join("")}</tr>\n`,pt=(t,e)=>{const s=t.join("\n");return`${e?`<pre><code data-language="${e}">${s}</code></pre>`:`<pre><code>${s}</code></pre>`}\n`},mt=t=>{const e=t.match(/^\d+\.\s/);if(e){let s=+e[1];return`<ol${1===s?"":` start="${s}"`}>${ut(t.slice(e[0].length))}</ol>\n`}return`<ul>${ut(t)}</ul>\n`},gt=t=>{const e=t.split("\n");let s="",r=!1,n=!1,i=[],o="";for(let t=0;t<e.length;t++){let a=e[t];if(a.startsWith("|"))r||(r=!0,s+="<table>\n"),s+=dt(a);else if(r&&(r=!1,s+="</table>\n"),a.startsWith("```"))n?(n=!1,s+=pt(i,o)):(n=!0,i=[],o=a.slice(3).trim());else if(n)i.push(a);else if(a.startsWith("# ")){const t=a.indexOf(" "),e=a.slice(t+1);s+=`<h${t}>${ut(e)}</h${t}>\n`}else a.startsWith("- ")||a.startsWith("* ")||a.match(/^\d+\.\s/)?s+=mt(a):"---"!==a.trim()?s+=`<p>${ut(a)}</p>\n`:s+="<hr>\n"}return s},ft=t=>t.replace(/\*(.*?)\*/g,"_$1_").replace(/\*\*(.*?)\*\*/g,"*$1*").replace(/\[(.*?)\]\((.*?)\)/g,"link:$2[$1]").replace(/!\[(.*?)\]\((.*?)\)/g,"image::$2[$1]").replace(/`([^`]+)`/g,"``$1``").replace(/^\*\s/,""),bt=t=>`<tr>${t.split("|").map((t=>t.trim())).filter((t=>""!==t)).map((t=>`<td>${ft(t)}</td>`)).join("")}</tr>\n`,yt=(t,e)=>{const s=t.join("\n");return`${e?`<pre><code data-language="${e}">${s}</code></pre>`:`<pre><code>${s}</code></pre>`}\n`},wt=t=>{const e=/^(\d+)\.\s/,s=/^[.]\s/,r=/^[*]\s/;if(t.match(e)){return`<ol start="${t.match(e)[1]}"><li>${ft(t.replace(e,""))}</li></ol>\n`}return t.match(s)?`<ol><li>${ft(t.replace(s,""))}</li></ol>\n`:t.match(r)?`<ul><li>${ft(t.replace(r,""))}</li></ul>\n`:`<p>${ft(t)}</p>\n`},xt=t=>`<blockquote>${ft(t.slice(2))}</blockquote>\n`,vt=t=>{const e=t.match(/\[(.*?)\]/);return e?e[1].split(",").map((t=>`[${t.trim()}]`)).join(""):""},Ct=t=>{const e=t.split("\n");let s="",r=!1,n=!1,i=[],o="";for(let t=0;t<e.length;t++){let a=e[t];if(a.startsWith("|"))r||(r=!0,s+="<table>\n"),s+=bt(a);else if(r&&(r=!1,s+="</table>\n"),a.startsWith("```"))n?(n=!1,s+=yt(i,o)):(n=!0,i=[],o=a.slice(3).trim());else if(n)i.push(a);else if(a.startsWith("=")){const t=(a.match(/=/g)||[]).length,e=a.replace(/=/g,"").trim();s+=`<h${t}>${ft(e)}</h${t}>\n`}else a.match(/^(\d+)\.\s/)||a.match(/^[*\.]\s/)?s+=wt(a):a.startsWith("> ")?s+=xt(a):"---"!==a.trim()?a.startsWith("[")?s+=vt(a):""!==a.trim()&&(s+=`<p>${ft(a)}</p>\n`):s+="<hr>\n"}return s},Ft=(t,e=",")=>t.trim().trimEnd().split("\n").map((t=>t.split(e))),kt=(t,e=",")=>new dr(Ft(t,e)),Et=(t,e=",")=>{const[s,...r]=Ft(t,e);return r.map((t=>{const e={};return s.forEach(((s,r)=>{e[s]=t[r]})),e}))},At=(t,e=",")=>JSON.stringify(Et(t,e)),Dt=(t,e)=>{const s=t.trim().trimEnd().split("\n").filter((t=>t));let r=`INSERT INTO ${e} (${s[0].split(",").join(", ")}) Values `,n=[];for(let t=1;t<s.length;t++){const e=s[t].split(",");n.push(`(${e})`)}return r+n.join(",\n")},Bt=t=>t instanceof Array?[Object.keys(t[0]),...t.map((t=>Object.values(t)))]:[Object.keys(t)],Tt=(t,e)=>Bt(t).map((t=>t.join(e))).join("\n"),_t=t=>Bt(t instanceof Object?t:JSON.parse(t)),It=(t,e=",")=>Tt(t instanceof Object?t:JSON.parse(t),e),Mt=(t,e)=>{const s=It(t,e),r=new Blob([s],{type:"text/csv;charset=utf-8;"});return{str:s,blob:r,url:URL.createObjectURL(r)}},St=(t,e)=>{const s=[];if(Array.isArray(t))t.forEach((t=>{if("object"==typeof t&&null!==t){s.push(`${e}-`);const r=St(t,`${e} `);s.push(...r)}else s.push(`${e}- ${t}`)}));else for(const r in t)if(t.hasOwnProperty(r)){const n=t[r];if("object"==typeof n&&null!==n){s.push(`${e}${r}:`);const t=St(n,`${e} `);s.push(...t)}else s.push(`${e}${r}: ${n}`)}return s},Ot=(t,e="")=>St(t,e).join("\n"),Lt=(t,e)=>Ot(t instanceof Object?t:JSON.parse(t),e),jt=(t,e)=>{const s=Lt(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 n=t[r];s+="\n"+" ".repeat(e)+`<${r}>`,s+="object"==typeof n?Rt(n,e+2):`${n}`,s+=`</${r}>`}return s.trim()},Pt=(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)}};class zt{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 $t=(t,e,s)=>new zt(t,e,s),Nt=(t,e="px")=>("number"==typeof t&&(t+=e),t instanceof Array&&(t=t.map((t=>"number"==typeof t?t+=e:t)).join(" ")),t);class Vt{constructor(t={}){this.target=null,this.styles=new Map([["default",t]]),this.cache={isHidden:!1,isFaddedOut:!1,transformation:{Flip:[0,0,0],matrix:new dr([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]])}}}style(t){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,{target:s,maskVector:r}={}){return this.style({width:t,height:e},{target:s,maskVector:r}),this}width(t,{target:e,maskVector:s}={}){if(t instanceof Object){if(t instanceof Array&&(t={min:t[0],max:t[1]}),"min"in t||"max"in t){let r=t.min??t.max,n=t.max??t.min;r=Nt(r,"px"),n=Nt(n,"px"),this.style({minWidth:r,maxWidth:n},{target:e,maskVector:s})}}else t=Nt(t,"px"),this.style({width:t},{target:e,maskVector:s});return this}height(t,{target:e,maskVector:s}={}){if(t instanceof Object){if(t instanceof Array&&(t={min:t[0],max:t[1]}),"min"in t||"max"in t){let r=t.min??t.max,n=t.max??t.min;r=Nt(r,"px"),n=Nt(n,"px"),this.style({minHeight:r,maxHeight:n},{target:e,maskVector:s})}}else t=Nt(t,"px"),this.style({height:t},{target:e,maskVector:s});return this}enableResize(t=!1,e=!1,{target:s,maskVector:r}={}){let n="none";return n=t?e?"both":"horizontal":e?"vertical":"none",this.style({resize:n,overflow:"hidden"},{target:s,maskVector:r}),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,{target:e,maskVector:s}={}){return this.style({color:t},{target:e,maskVector:s}),this}background(t,{target:e,maskVector:s}={}){return this.style({background:t},{target:e,maskVector:s}),this}backgroundColor(t,{target:e,maskVector:s}={}){return this.style({backgroundColor:t},{target:e,maskVector:s}),this}opacity(t,{target:e,maskVector:s}={}){return this.style({opacity:t},{target:e,maskVector:s}),this}position(t,{target:e,maskVector:s}={}){return this.style({position:t},{target:e,maskVector:s}),this}display(t,{target:e,maskVector:s}={}){return this.style({display:t},{target:e,maskVector:s}),this}zIndex(t,{target:e,maskVector:s}={}){return this.style({zIndex:t},{target:e,maskVector:s}),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,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({borderRadius:t},{target:e,maskVector:s}),this}margin(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({margin:t},{target:e,maskVector:s}),this}marginTop(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({marginTop:t},{target:e,maskVector:s}),this}marginRight(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({marginRight:t},{target:e,maskVector:s}),this}marginBootom(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({marginBootom:t},{target:e,maskVector:s}),this}marginLeft(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({marginLeft:t},{target:e,maskVector:s}),this}padding(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({padding:t},{target:e,maskVector:s}),this}paddingTop(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({paddingTop:t},{target:e,maskVector:s}),this}paddingRight(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({paddingRight:t},{target:e,maskVector:s}),this}paddingBootom(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({paddingBootom:t},{target:e,maskVector:s}),this}paddingLeft(t,{target:e,maskVector:s}={}){return t=Nt(t,"px"),this.style({paddingLeft:t},{target:e,maskVector:s}),this}font(t,{target:e,maskVector:s}={}){return this.style({font:t},{target:e,maskVector:s}),this}fontFamily(t="",{target:e,maskVector:s}={}){return this.style({fontFamily:t},{target:e,maskVector:s}),this}fontSize(t,{target:e,maskVector:s}={}){return this.style({fontSize:t},{target:e,maskVector:s}),this}cursor(t="pointer"){return this.style({cursor:t}),this}overflow(t,e,{target:s,maskVector:r}={}){const n=["hidden","auto"];return this.style({overflowX:"number"==typeof t?n[t]:t,overflowY:"number"==typeof e?n[e]:e},{target:s,maskVector:r}),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,k(t)),this.cache.transformation.matrix.set(1,2,-E(t)),this.cache.transformation.matrix.set(2,1,E(t)),this.cache.transformation.matrix.set(1,2,k(t)),this.#r(e),this}rotateY(t,e=0){return this.cache.transformation.matrix.set(0,0,k(t)),this.cache.transformation.matrix.set(0,2,E(t)),this.cache.transformation.matrix.set(2,0,-E(t)),this.cache.transformation.matrix.set(2,2,k(t)),this.#r(e),this}rotateZ(t,e=0){return this.cache.transformation.matrix.set(0,0,k(t)),this.cache.transformation.matrix.set(0,1,-E(t)),this.cache.transformation.matrix.set(1,0,E(t)),this.cache.transformation.matrix.set(1,1,k(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 Ut(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 Ht{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 Zt(t){Ut.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 Xt(t){Ut.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 Wt(t){Ut.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,n=this.uy,i=(r-e)/this.target.Width,o=(s-n)/this.target.Height,a=i<0?"left":i>0?"right":"none",h=o<0?"bottom":o>0?"top":"none";this.swippe={h:a,v:h,delta_x:i,delta_y:o}}),{x:this.ux,y:this.uy,t:Date.now()-this.cache.stream.t0})}function qt(t){Ut.call(this,t,"enter",null,null)}function Yt(t){Ut.call(this,t,"leave",null,null)}function Gt(t){Ut.call(this,t,"out",null,null)}function Qt(t){Ut.call(this,t,"cancel",null,null)}class Kt extends Ht{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:Zt.bind(this),move:Xt.bind(this),up:Wt.bind(this),enter:qt.bind(this),out:Gt.bind(this),leave:Yt.bind(this),cancel:Qt.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 Jt=t=>new Kt(t);class te extends Ht{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:ee.bind(this),move:se.bind(this),up:re.bind(this),enter:ne.bind(this),out:oe.bind(this),leave:ie.bind(this),over:ae.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 ee(t){Ut.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 se(t){Ut.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 re(t){Ut.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,n=this.uy,i=(r-e)/this.target.Width,o=(s-n)/this.target.Height,a=i<0?"left":i>0?"right":"none",h=o<0?"bottom":o>0?"top":"none";this.swippe={h:a,v:h,delta_x:i,delta_y:o}}),{x:this.ux,y:this.uy,t:Date.now()-this.cache.stream.t0})}function ne(t){Ut.call(this,t,"enter",null,null)}function ie(t){Ut.call(this,t,"leave",null,null)}function oe(t){Ut.call(this,t,"out",null,null)}function ae(t){Ut.call(this,t,"out",null,null)}const he=t=>new te(t);function le(t){Ut.call(this,t,"wheel",null,null)}class ce extends Ht{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:le.bind(this)}}onWheel(...t){return this.__onEvent("wheel",{},...t),this}}const ue=t=>new ce(t);function de(t){Ut.call(this,t,"down",(()=>this.kd=t.key),{key:t.key,t:10})}function pe(t){Ut.call(this,t,"press",(()=>this.kp=t.key),{key:t.key,t:10})}function me(t){Ut.call(this,t,"up",(()=>this.ku=t.key),{key:t.key,t:10})}class ge extends Ht{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:pe.bind(this),up:me.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 fe=t=>new ge(t);function be(t){Ut(this,t,"start",null)}function ye(t){Ut.call(this,t,"drag",null,null)}function we(t){Ut.call(this,t,"end",null,null)}function xe(t){Ut.call(this,t,"drop",null,null)}class ve extends Ht{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:be.bind(this),drag:ye.bind(this),end:we.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 Ce extends Ht{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:xe.bind(this)}}onDrop(...t){return this.__onEvent("drop",{},...t),this}}const Fe=t=>new ve(t),ke=t=>new Ce(t);function Ee(t){Ut.call(this,t,"click",null,null)}function Ae(t){Ut.call(this,t,"dbclick",null,null)}class De extends Ht{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:Ae.bind(this)}}onClick(...t){return this.__onEvent("click",{},...t),this}onDbClick(...t){return this.__onEvent("dbclick",{},...t),this}}const Be=t=>new De(t);function Te(t){Ut.call(this,t,"copy",null,null)}function _e(t){Ut.call(this,t,"cut",null,null)}function Ie(t){Ut.call(this,t,"paste",null,null)}function Me(t){Ut.call(this,t,"select",null,null)}class Se extends Ht{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:_e.bind(this),paste:Ie.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 Oe=t=>new Se(t);function Le(t){Ut.call(this,t,"focus",null,null)}function je(t){Ut.call(this,t,"blur",null,null)}class Re extends Ht{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:Le.bind(this),blur:je.bind(this)}}onFocus(...t){return this.__onEvent("focus",{},...t),this}onBlur(...t){return this.__onEvent("blur",{},...t),this}}const Pe=t=>new Re(t);function ze(t){Ut.call(this,t,"input",null,null)}function $e(t){Ut.call(this,t,"change",null,null)}class Ne extends Ht{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:ze.bind(this),change:$e.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 Ve=t=>new Ne(t);function Ue(t){Ut.call(this,t,"hashchange",null,null)}class He extends Ht{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:Ue.bind(this)}}onChange(...t){return this.__onEvent("hashchange",{},...t),this}}const Ze=t=>new He(t),Xe=t=>function(e){Ut.call(this,e,t,null,null)};class We extends Ht{constructor(t){super(t),this.event=null,this.cache={prefixe:"",preventDefault:{},paused:{},stream:{enabled:{},clear:{},history:{}},callbacks:{}},this.__controller={}}#n(t){return this.cache.preventDefault[t]=!1,this.cache.paused[t]=!1,this.cache.stream.enabled=!1,this.cache.stream.clear=!1,this.cache.stream.history=[],this.cache.callbacks[t]=[],this.__controller[t]=Xe(t).bind(this),this}on(t,...e){return this.__controller[t]||this.#n(t),this.__onEvent(t,{},...e),this}emit(t,e={}){this.__controller[t]||this.#n(t),this.detail=e;const s=new Event(t);return this.targetElement.dispatchEvent(s),this}}const qe=t=>new We(t);class Ye extends Ht{constructor(t,e=.3,s=.3){super(t);const{removeListener:r,setWidthThreshold:n,setHeightThreshold:i}=function(t,e=.5,s=.5,r,n){let i=Sr(e,0,r),o=Sr(s,0,n),a=0,h=0,l=0,c=0;const u=t=>{a=t.clientX,h=t.clientY},d=t=>{l=t.clientX,c=t.clientY,p()};function p(){const t=l-a,e=c-h;(Math.abs(t)>i||Math.abs(e)>o)&&m(t,e)}function m(e,s){const a=globalThis?.CustomEvent?new CustomEvent("swipe",{detail:{deltaX:y(e)<i?0:q(e)*Mr(y(e),0,r),deltaY:y(s)<o?0:q(s)*Mr(y(s),0,n),direction:{x:y(e)<i?"none":e>0?"right":"left",y:y(s)<o?"none":s>0?"down":"up"}}}):null;t?.dispatchEvent(a)}function g(t){i=Sr(t,0,r)}function f(t){o=Sr(t,0,n)}return t?.addEventListener("pointerdown",u),t?.addEventListener("pointerup",d),{removeListener(){t?.removeEventListener("pointerdown",u),t?.removeEventListener("pointerup",d),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:r,setWidthThreshold:n,setHeightThreshold:i,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:Ge.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 Ge(t){Ut.call(this,t,"swipe",null,null)}const Qe=(t,e,s)=>new Ye(t,e,s),Ke={usePointerEvent:Jt,useMouseEvent:he,useWheelEvent:ue,useKeyEvent:fe,useDragEvent:Fe,useDropEvent:ke,useClickEvent:Be,useClipboardEvent:Oe,useFocusEvent:Pe,useInputEvent:Ve,useHashEvent:Ze,useCustomEvent:qe,useSwipeEvent:Qe,ExtractAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"ExtractAll"!==s&&"RemoveAll"!==s&&(globalThis[s]=this[s])}return this},RemoveAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"RemoveAll"!==s&&delete globalThis[s]}return this}};class Je{constructor(t,e,{threshold:s=0,margin:r=0}={}){this.target=t,this.config={threshold:s,margin:r},globalThis.IntersectionObserver?this.observer=new IntersectionObserver((t=>{this.entrie=t[0],e(this)}),{threshold:this.threshold}):console.log("IntersectionObserver Nor 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 ts=(t,e,s)=>new Je(t,e,s);class es{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}}class ss{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 rs=(t,e)=>new ss(t,e);class ns{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 Or(globalThis?.screenX,0,globalThis.screen.availWidth,-1,1)}get y0(){return-Or(globalThis?.screenY,0,globalThis.screen.availHeight,-1,1)}get x1(){return Or(globalThis?.screenX+globalThis?.outerWidth,0,globalThis.screen.availWidth,-1,1)}get y1(){return-Or(globalThis?.screenY+globalThis?.outerHeight,0,globalThis.screen.availHeight,-1,1)}get cx(){return Or(globalThis?.outerWidth/2+globalThis?.screenX,0,globalThis.screen.availWidth,-1,1)}get cy(){return-Or(globalThis?.outerHeight/2+globalThis?.screenY,0,globalThis.screen.availHeight,-1,1)}}const is=t=>new ns(t);class os extends es{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 as=(t,e)=>new os(t,e);class hs extends es{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 ls=(t,e)=>new hs(t,e),cs={watch:(t,e={},s=null)=>{const r=new es(t,e);return s&&r.observe(s),r},watchAttr:as,watchChildren:ls,watchIntersection:ts,watchSize:rs,watchScreen:is,ExtractAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"ExtractAll"!==s&&"RemoveAll"!==s&&(globalThis[s]=this[s])}return this},RemoveAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"RemoveAll"!==s&&delete globalThis[s]}return this}},us={cozyCottonCandy:{background:"#FCE4EC",currentLine:"#F8BBD0",selection:"#FFCDD2",foreground:"#673AB7",comment:"#9575CD",cyan:"#00BCD4",green:"#4CAF50",orange:"#FF9800",pink:"#E91E63",purple:"#9C27B0",red:"#F44336",yellow:"#FFEB3B"},crystalClear:{background:"#F6F8FA",currentLine:"#E8F0F5",selection:"#D4E9F7",foreground:"#485766",comment:"#8492A6",cyan:"#00ACC1",green:"#8BC34A",orange:"#FFA726",pink:"#FF4081",purple:"#7E57C2",red:"#EF5350",yellow:"#FFD740"},lightdreamyDusk:{background:"#F5F5F5",currentLine:"#E8E8E8",selection:"#DADADA",foreground:"#555555",comment:"#999999",cyan:"#5FB3B3",green:"#68C386",orange:"#FFB67A",pink:"#FF94B0",purple:"#B78BC3",red:"#FF6666",yellow:"#FFD666"},luminousLavender:{background:"#F3E5F5",currentLine:"#E1BEE7",selection:"#CE93D8",foreground:"#311B92",comment:"#673AB7",cyan:"#00BCD4",green:"#8BC34A",orange:"#FF9800",pink:"#E91E63",purple:"#9C27B0",red:"#F44336",yellow:"#FFEB3B"},meadowMornings:{background:"#F3E5F5",currentLine:"#E1BEE7",selection:"#CE93D8",foreground:"#311B92",comment:"#673AB7",cyan:"#00BCD4",green:"#8BC34A",orange:"#FF9800",pink:"#E91E63",purple:"#9C27B0",red:"#F44336",yellow:"#FFEB3B"},moonlitMauve:{background:"#F3E5F5",currentLine:"#E1BEE7",selection:"#CE93D8",foreground:"#311B92",comment:"#673AB7",cyan:"#00BCD4",green:"#8BC34A",orange:"#FF9800",pink:"#E91E63",purple:"#9C27B0",red:"#F44336",yellow:"#FFEB3B"},morningMist:{background:"#F6F6F6",currentLine:"#EAEAEA",selection:"#D8D8D8",foreground:"#333333",comment:"#808080",cyan:"#00A6A6",green:"#4CAF50",orange:"#FFA726",pink:"#FF4081",purple:"#9C27B0",red:"#FF5252",yellow:"#FFD740"},oceanBreeze:{background:"#ECF1F4",currentLine:"#DDE8ED",selection:"#BFD3C1",foreground:"#37474F",comment:"#607D8B",cyan:"#00BCD4",green:"#8BC34A",orange:"#FF9800",pink:"#E91E63",purple:"#673AB7",red:"#F44336",yellow:"#FFEB3B"},pastelParadise:{background:"#F5F5F5",currentLine:"#E8E8E8",selection:"#DADADA",foreground:"#555555",comment:"#999999",cyan:"#5FB3B3",green:"#68C386",orange:"#FFB67A",pink:"#FF94B0",purple:"#B78BC3",red:"#FF6666",yellow:"#FFD666"},pastelPetals:{background:"#FCE4EC",currentLine:"#F8BBD0",selection:"#FFCDD2",foreground:"#673AB7",comment:"#9575CD",cyan:"#00BCD4",green:"#4CAF50",orange:"#FF9800",pink:"#E91E63",purple:"#9C27B0",red:"#F44336",yellow:"#FFEB3B"},sereneSnowfall:{background:"#F9F9F9",currentLine:"#EDEDED",selection:"#D8D8D8",foreground:"#454545",comment:"#888888",cyan:"#5FA5A5",green:"#5BC47E",orange:"#FFBC8D",pink:"#FFA7BF",purple:"#B88AAE",red:"#FF7575",yellow:"#FFD98F"},softSherbet:{background:"#FDF8F3",currentLine:"#FAF1EB",selection:"#FFEBEE",foreground:"#6D4C41",comment:"#A1887F",cyan:"#00BCD4",green:"#689F38",orange:"#FFA000",pink:"#EC407A",purple:"#8E24AA",red:"#E53935",yellow:"#FFC107"},subtleSerenity:{background:"#F3F5F7",currentLine:"#E8EDF2",selection:"#D1D9E6",foreground:"#2C3E50",comment:"#95A5A6",cyan:"#3498DB",green:"#2ECC71",orange:"#F39C12",pink:"#E74C3C",purple:"#9B59B6",red:"#C0392B",yellow:"#F1C40F"},summerSunset:{background:"#FCE4EC",currentLine:"#F8BBD0",selection:"#FFCDD2",foreground:"#4E342E",comment:"#795548",cyan:"#009688",green:"#43A047",orange:"#FF5722",pink:"#E91E63",purple:"#9C27B0",red:"#F44336",yellow:"#FFEB3B"},sunnyDay:{background:"#FFF8E1",currentLine:"#FFF3E0",selection:"#FFE0B2",foreground:"#4E342E",comment:"#795548",cyan:"#00BCD4",green:"#8BC34A",orange:"#FF9800",pink:"#E91E63",purple:"#673AB7",red:"#F44336",yellow:"#FFEB3B"},tranquilTwilight:{background:"#F9F9F9",currentLine:"#EDEDED",selection:"#D8D8D8",foreground:"#454545",comment:"#888888",cyan:"#5FA5A5",green:"#5BC47E",orange:"#FFBC8D",pink:"#FFA7BF",purple:"#B88AAE",red:"#FF7575",yellow:"#FFD98F"},tranquilWaves:{background:"#F9F9F9",currentLine:"#E4E4E4",selection:"#D4D4D4",foreground:"#2C3E50",comment:"#7F8C8D",cyan:"#3498DB",green:"#2ECC71",orange:"#F39C12",pink:"#E74C3C",purple:"#9B59B6",red:"#C0392B",yellow:"#F1C40F"},whisperingWillow:{background:"#F6F8FA",currentLine:"#E8F0F5",selection:"#D4E9F7",foreground:"#485766",comment:"#8492A6",cyan:"#00ACC1",green:"#8BC34A",orange:"#FFA726",pink:"#FF4081",purple:"#7E57C2",red:"#EF5350",yellow:"#FFD740"}},ds={antiqueRose:{background:"#1C1014",currentLine:"#2B1B21",selection:"#443034",foreground:"#D8B5B5",comment:"#7F5E5E",cyan:"#6FA2A2",green:"#66A66F",orange:"#FFB97A",pink:"#FFA8BD",purple:"#B78DA5",red:"#FF6C6C",yellow:"#FFD579"},auroraBorealis:{background:"#1D1426",currentLine:"#2B1E35",selection:"#432D4E",foreground:"#C2AABF",comment:"#7F6E8E",cyan:"#7EA5D3",green:"#77C992",orange:"#FFC476",pink:"#FFA8B3",purple:"#AE9AC3",red:"#FF6C6C",yellow:"#FFD576"},autumnHarvest:{background:"#291C10",currentLine:"#3A2A1E",selection:"#573C2C",foreground:"#D4C3A2",comment:"#7F6F52",cyan:"#82B4BF",green:"#7FB074",orange:"#FFAB6E",pink:"#FF8196",purple:"#B394A9",red:"#FF6565",yellow:"#FFD270"},aylin:{background:"#13161E",currentLine:"#161A28",selection:"#222B3E",foreground:"#D2D8E0",comment:"#697098",cyan:"#78D1E1",green:"#98C379",orange:"#EBCB8B",pink:"#D16D9E",purple:"#C678DD",red:"#E88388",yellow:"#EBCB8B"},azureBlue:{background:"#001B29",currentLine:"#002C3E",selection:"#004E6B",foreground:"#C3D7E2",comment:"#5F7C92",cyan:"#75B7D1",green:"#70C8A7",orange:"#FFB476",pink:"#FF92B0",purple:"#B88BC3",red:"#FF6666",yellow:"#FFD666"},cobalt2:{background:"#193549",currentLine:"#1F4662",selection:"#193549",foreground:"#B9BED0",comment:"#627D98",cyan:"#4DB5BD",green:"#86B300",orange:"#FFB86C",pink:"#FF7F7B",purple:"#9B64FB",red:"#FF6672",yellow:"#FFCC99"},cobaltMaterialTheme:{background:"#263238",currentLine:"#37474F",selection:"#80CBC4",foreground:"#CFD8DC",comment:"#78909C",cyan:"#80CBC4",green:"#A5D6A7",orange:"#FFD54F",pink:"#FF80AB",purple:"#CE93D8",red:"#EF5350",yellow:"#FFEE58"},cosmicBlue:{background:"#1B2836",currentLine:"#223348",selection:"#39516D",foreground:"#C0D4E5",comment:"#728CAB",cyan:"#75A6FF",green:"#5ED99F",orange:"#FFAD6F",pink:"#FF90B6",purple:"#A889C5",red:"#FF6E6E",yellow:"#FCD256"},cosmicSunset:{background:"#1B1921",currentLine:"#272530",selection:"#3C3948",foreground:"#B8B4CB",comment:"#7A738B",cyan:"#77B4D8",green:"#6CC09E",orange:"#FFA677",pink:"#FF95B2",purple:"#B48FC1",red:"#FF6565",yellow:"#FFD566"},cyberForest:{background:"#0D151D",currentLine:"#18262F",selection:"#2B3B47",foreground:"#CDD7E0",comment:"#667B8B",cyan:"#7EC4CF",green:"#68CC96",orange:"#FFAC6C",pink:"#FF89B4",purple:"#A889C5",red:"#FF6565",yellow:"#FFCB6B"},cyberPunkCity:{background:"#000000",currentLine:"#121212",selection:"#1F1F1F",foreground:"#DADADA",comment:"#626262",cyan:"#71B7FF",green:"#50D890",orange:"#FFB86C",pink:"#FF79C6",purple:"#BB86FC",red:"#FF5454",yellow:"#FDD663"},cyberpunkNeon:{background:"#121212",currentLine:"#1B1B1B",selection:"#262626",foreground:"#DADADA",comment:"#6C6C6C",cyan:"#69AEDB",green:"#4ECCA3",orange:"#FFB86C",pink:"#FF79C6",purple:"#D08EFF",red:"#FF5454",yellow:"#FDD663"},darkDesert:{background:"#1E2022",currentLine:"#282A2E",selection:"#393D42",foreground:"#C0C5CE",comment:"#5C6368",cyan:"#6FB3E0",green:"#88C076",orange:"#FFB454",pink:"#FF7F90",purple:"#B48EAD",red:"#FF6666",yellow:"#FFCC66"},darkMint:{background:"#11161A",currentLine:"#1B2128",selection:"#3D4853",foreground:"#D9DEE5",comment:"#65737E",cyan:"#88C0D0",green:"#98C379",orange:"#FFB86C",pink:"#FF7F8B",purple:"#C594C5",red:"#FF6561",yellow:"#FAD07B"},deepOcean:{background:"#121C2C",currentLine:"#182236",selection:"#2B3E50",foreground:"#BDC3C7",comment:"#6C7A89",cyan:"#59ABE3",green:"#26A65B",orange:"#F9690E",pink:"#EB3B5A",purple:"#D2527F",red:"#E74C3C",yellow:"#F5AB35"},deepOceanBlue:{background:"#1B2F40",currentLine:"#263B53",selection:"#3A536E",foreground:"#BFC9D4",comment:"#657C8E",cyan:"#6CB5FF",green:"#65C287",orange:"#FFA974",pink:"#FF87B4",purple:"#AE9BFF",red:"#FF6666",yellow:"#FFD67B"},deepOceanSunset:{background:"#151D2A",currentLine:"#1D2735",selection:"#31405B",foreground:"#D5D9E0",comment:"#6C7B8B",cyan:"#6FAAD4",green:"#66C295",orange:"#FFA476",pink:"#FF94B0",purple:"#B08FC0",red:"#FF6565",yellow:"#FFD466"},deepSpace:{background:"#0F1419",currentLine:"#1A232D",selection:"#3A4758",foreground:"#CDD9E5",comment:"#657C96",cyan:"#6CB6FF",green:"#4CAF50",orange:"#FFB454",pink:"#FF75B5",purple:"#9A76FF",red:"#FF5555",yellow:"#FFC857"},dracula:{background:"#282a36",currentLine:"#44475a",selection:"#44475a",foreground:"#f8f8f2",comment:"#6272a4",cyan:"#8be9fd",green:"#50fa7b",orange:"#ffb86c",pink:"#ff79c6",purple:"#bd93f9",red:"#ff5555",yellow:"#f1fa8c"},dreamyDusk:{background:"#22243D",currentLine:"#313558",selection:"#4C4F6D",foreground:"#A5A7C5",comment:"#6F728E",cyan:"#81A2BE",green:"#7FB074",orange:"#FFB476",pink:"#FF91A4",purple:"#AE8DC2",red:"#FF7272",yellow:"#FFD67A"},electricLagoon:{background:"#15232B",currentLine:"#20323E",selection:"#344E5F",foreground:"#A6C0B9",comment:"#6C8F81",cyan:"#80C7D1",green:"#7FCD97",orange:"#FFBC76",pink:"#FF9FB3",purple:"#AE8FC3",red:"#FF7272",yellow:"#FFD674"},emeraldCity:{background:"#112E26",currentLine:"#1B3F38",selection:"#2F6253",foreground:"#A6C0B9",comment:"#6C8F81",cyan:"#80C7D1",green:"#7FCD97",orange:"#FFBC76",pink:"#FF9FB3",purple:"#AE8FC3",red:"#FF7272",yellow:"#FFD674"},enchantedEclipse:{background:"#131A22",currentLine:"#1F2C3A",selection:"#2D4455",foreground:"#A7B6C2",comment:"#6B7B8C",cyan:"#5FA8D3",green:"#5CB8A4",orange:"#FFA96C",pink:"#FF8FA2",purple:"#A88ED1",red:"#FF6B6B",yellow:"#FFD575"},enchantedEvening:{background:"#1E1824",currentLine:"#2A2332",selection:"#3F3A4F",foreground:"#C2B4CB",comment:"#7F7292",cyan:"#76AAD8",green:"#6CC095",orange:"#FFB36C",pink:"#FF8FB0",purple:"#AB8CC2",red:"#FF6464",yellow:"#FFD164"},fireAndIce:{background:"#1F2532",currentLine:"#292F3D",selection:"#4E556A",foreground:"#D8DEE9",comment:"#69758E",cyan:"#7EC4CF",green:"#68CC98",orange:"#FFA071",pink:"#FF88B5",purple:"#AE9BFF",red:"#FF657E",yellow:"#FDCB83"},forestGreen:{background:"#1A1E22",currentLine:"#24292F",selection:"#394147",foreground:"#C8C8C8",comment:"#5C6370",cyan:"#7AAB9D",green:"#88B379",orange:"#FFAC6F",pink:"#F97B77",purple:"#A187BE",red:"#FF5C5C",yellow:"#F5D76E"},futuristicBlue:{background:"#111B26",currentLine:"#1B2E3F",selection:"#334D65",foreground:"#C0D2E3",comment:"#6E859E",cyan:"#77AADB",green:"#78C196",orange:"#FFAC6C",pink:"#FF8DBE",purple:"#A48ADA",red:"#FF6666",yellow:"#FFD66D"},gentlePurple:{background:"#2E2E3D",currentLine:"#383849",selection:"#4D4D5C",foreground:"#B2B2CC",comment:"#6E6E8F",cyan:"#6D77CC",green:"#81C995",orange:"#FFB16A",pink:"#FF7CAC",purple:"#8A80A1",red:"#FF657A",yellow:"#FDB26E"},githubDarkDimmed:{background:"#0D1117",currentLine:"#161B22",selection:"#1F6F8B",foreground:"#8B949E",comment:"#8B949E",cyan:"#79C0FF",green:"#2DD57A",orange:"#FFB454",pink:"#FF80AB",purple:"#D781D3",red:"#EF5252",yellow:"#D29922"},gruvbox:{background:"#282828",currentLine:"#3c3836",selection:"#bdae93",foreground:"#ebdbb2",comment:"#928374",cyan:"#83a598",green:"#b8bb26",orange:"#fe8019",pink:"#d3869b",purple:"#d3869b",red:"#fb4934",yellow:"#fabd2f"},materialTheme:{background:"#263238",currentLine:"#37474f",selection:"#90a4ae",foreground:"#eceff1",comment:"#546e7a",cyan:"#80cbc4",green:"#a5d6a7",orange:"#ffb74d",pink:"#f06292",purple:"#ba68c8",red:"#ef5350",yellow:"#ffee58"},midnightMystique:{background:"#1E1E27",currentLine:"#292935",selection:"#3F3F4F",foreground:"#C2C2D3",comment:"#757593",cyan:"#76D4D6",green:"#6CC18F",orange:"#FFB36C",pink:"#FF8FAB",purple:"#AB8BC7",red:"#FF6464",yellow:"#FFD164"},midnightSunset:{background:"#182233",currentLine:"#1D2D46",selection:"#384B66",foreground:"#B7C0CE",comment:"#6A788A",cyan:"#6B98FF",green:"#6BD49D",orange:"#FFA178",pink:"#FF8DAB",purple:"#B48EAD",red:"#F96263",yellow:"#FADA5E"},minimalMonochrome:{background:"#1C1C1C",currentLine:"#262626",selection:"#363636",foreground:"#D9D9D9",comment:"#757575",cyan:"#7DC1C7",green:"#7FB074",orange:"#FFB869",pink:"#FF81A2",purple:"#B48EAD",red:"#FF6B6B",yellow:"#FFD57B"},modernMarine:{background:"#0A0E19",currentLine:"#121929",selection:"#1E2B42",foreground:"#D5D8DE",comment:"#7F8493",cyan:"#6FB1D3",green:"#6CC792",orange:"#FFB577",pink:"#FF96B0",purple:"#B690C2",red:"#FF6666",yellow:"#FFD666"},monokai:{background:"#272822",currentLine:"#3e3d32",selection:"#49483e",foreground:"#f8f8f2",comment:"#75715e",cyan:"#66d9ef",green:"#a6e22e",orange:"#fd971f",pink:"#f92672",purple:"#ae81ff",red:"#f92672",yellow:"#e6db74"},moonlitMeadow:{background:"#12252C",currentLine:"#1D3B47",selection:"#24566E",foreground:"#A7C4BC",comment:"#5E7D84",cyan:"#82B7BD",green:"#87C38A",orange:"#F4B66A",pink:"#F77A92",purple:"#C58AC9",red:"#F0725E",yellow:"#E8C284"},mysticalMauve:{background:"#1A1A26",currentLine:"#252533",selection:"#3E3E57",foreground:"#B2B2CC",comment:"#757593",cyan:"#76D4D6",green:"#6CC18F",orange:"#FFB36C",pink:"#FF8FAB",purple:"#AB8BC7",red:"#FF6464",yellow:"#FFD164"},nebulaNights:{background:"#1B1821",currentLine:"#262330",selection:"#3C3A48",foreground:"#B8B4CB",comment:"#7A738B",cyan:"#77B4D8",green:"#6CC09E",orange:"#FFA677",pink:"#FF95B2",purple:"#B48FC1",red:"#FF6565",yellow:"#FFD566"},neonLights:{background:"#000000",currentLine:"#0D0D0D",selection:"#1A1A1A",foreground:"#DADADA",comment:"#7F7F7F",cyan:"#6FE3E3",green:"#60FFA0",orange:"#FFB67A",pink:"#FF9FBD",purple:"#BF8CC2",red:"#FF6666",yellow:"#FFD666"},nightSky:{background:"#17202A",currentLine:"#1C2732",selection:"#2E4053",foreground:"#D0D3D4",comment:"#566573",cyan:"#5DADE2",green:"#45B39D",orange:"#F5B041",pink:"#EB984E",purple:"#AF7AC5",red:"#EC7063",yellow:"#F4D03F"},nord:{background:"#2e3440",currentLine:"#3b4252",selection:"#4c566a",foreground:"#d8dee9",comment:"#616e88",cyan:"#88c0d0",green:"#a3be8c",orange:"#ebcb8b",pink:"#bf616a",purple:"#b48ead",red:"#bf616a",yellow:"#ebcb8b"},nova:{background:"#1F262D",currentLine:"#232A32",selection:"#414B56",foreground:"#D9E2EC",comment:"#525F69",cyan:"#89DDFF",green:"#64D989",orange:"#E7C664",pink:"#E95678",purple:"#C594C5",red:"#FF5656",yellow:"#FFC172"},novaDark:{background:"#1A2026",currentLine:"#212930",selection:"#36424F",foreground:"#C0C6D9",comment:"#5B6C7F",cyan:"#84CEE4",green:"#89DD6D",orange:"#FFB46E",pink:"#FF7CAB",purple:"#BB80B3",red:"#FC6161",yellow:"#FAB795"},oceanBlue:{background:"#12232E",currentLine:"#1D3B53",selection:"#205072",foreground:"#A8DADC",comment:"#5E81AC",cyan:"#7FB2F0",green:"#88C0D0",orange:"#FFB86C",pink:"#FFA0A0",purple:"#D4A3D9",red:"#EF8E8E",yellow:"#FFD180"},oceanicAzure:{background:"#001A23",currentLine:"#002B36",selection:"#004056",foreground:"#C0C5CE",comment:"#4D5767",cyan:"#75A4C0",green:"#68A3A8",orange:"#FFA45E",pink:"#FF94B0",purple:"#B48EAD",red:"#FF6363",yellow:"#FFD464"},oceanicGruvbox:{background:"#1d2021",currentLine:"#282828",selection:"#458588",foreground:"#ebdbb2",comment:"#928374",cyan:"#89b482",green:"#a9b665",orange:"#d79921",pink:"#d3869b",purple:"#b16286",red:"#fb4934",yellow:"#d5c4a1"},oceanicNext:{background:"#1B2B34",currentLine:"#343D46",selection:"#4F5B66",foreground:"#A7ADBA",comment:"#616E7C",cyan:"#7FB5DA",green:"#98C379",orange:"#EBCB8B",pink:"#EC5f67",purple:"#C594C5",red:"#EC5f67",yellow:"#D29922"},oneDark:{background:"#282c34",currentLine:"#3e4451",selection:"#4f5b66",foreground:"#abb2bf",comment:"#5c6370",cyan:"#56b6c2",green:"#98c379",orange:"#d19a66",pink:"#c678dd",purple:"#c678dd",red:"#e06c75",yellow:"#e5c07b"},polarNight:{background:"#2E3440",currentLine:"#3B4252",selection:"#4C566A",foreground:"#D8DEE9",comment:"#616E88",cyan:"#81A1C1",green:"#A3BE8C",orange:"#EBCB8B",pink:"#BF616A",purple:"#B48EAD",red:"#BF616A",yellow:"#EBCB8B"},radiantRainforest:{background:"#16231A",currentLine:"#1F3927",selection:"#355D43",foreground:"#A7C9A2",comment:"#6F8D77",cyan:"#80C3BB",green:"#76CC8F",orange:"#FFB56C",pink:"#FF8FA6",purple:"#AB8CC2",red:"#FF6C6C",yellow:"#FFD576"},retroTech:{background:"#0C0C0C",currentLine:"#141414",selection:"#1F1F1F",foreground:"#D9D9D9",comment:"#626262",cyan:"#77BFC9",green:"#69CC6D",orange:"#FFC46D",pink:"#FF7D99",purple:"#BB86FC",red:"#FF5555",yellow:"#FACD60"},royalPurple:{background:"#1E1B2E",currentLine:"#272337",selection:"#3E395B",foreground:"#D5D1E2",comment:"#76708E",cyan:"#76D7C4",green:"#47B87C",orange:"#FFC300",pink:"#F39C9D",purple:"#9B59B6",red:"#E74C3C",yellow:"#F1C40F"},sapphireSkies:{background:"#081125",currentLine:"#0F1F3A",selection:"#1E3874",foreground:"#D8DCE6",comment:"#6B7394",cyan:"#7EC4D9",green:"#7DCB9E",orange:"#FFB578",pink:"#FF8FB3",purple:"#B992CC",red:"#FF6767",yellow:"#FFD684"},shadesOfPurple:{background:"#2d2b55",currentLine:"#37355a",selection:"#444267",foreground:"#ecebf0",comment:"#9a99a3",cyan:"#a1efe4",green:"#72f1b8",orange:"#f78c6c",pink:"#ffcc99",purple:"#9a99a3",red:"#ff6188",yellow:"#ffcc99"},solarizedDark:{background:"#002b36",currentLine:"#073642",selection:"#586e75",foreground:"#839496",comment:"#586e75",cyan:"#2aa198",green:"#859900",orange:"#cb4b16",pink:"#d33682",purple:"#6c71c4",red:"#dc322f",yellow:"#b58900"},synthWave84:{background:"#2b213a",currentLine:"#3e3650",selection:"#564d7a",foreground:"#e0def4",comment:"#9c8c98",cyan:"#95e6cb",green:"#00ffb9",orange:"#f28779",pink:"#f771ac",purple:"#d3bfff",red:"#ff6188",yellow:"#ffd866"},tokyoNight:{background:"#1a1b26",currentLine:"#282a36",selection:"#44475a",foreground:"#eff0eb",comment:"#6b6e76",cyan:"#78d1e1",green:"#67b11d",orange:"#e1a80e",pink:"#ff79c6",purple:"#d27bff",red:"#ff5555",yellow:"#f3f99d"},tomorrowNight:{background:"#1d1f21",currentLine:"#282a36",selection:"#373b41",foreground:"#c5c8c6",comment:"#616e7c",cyan:"#81a2be",green:"#b5bd68",orange:"#de935f",pink:"#cc6666",purple:"#b294bb",red:"#cc6666",yellow:"#f0c674"},twilightMeadow:{background:"#14202A",currentLine:"#1F2E3F",selection:"#334D65",foreground:"#A6C0B9",comment:"#6C8F81",cyan:"#80C7D1",green:"#7FCD97",orange:"#FFBC76",pink:"#FF9FB3",purple:"#AE8FC3",red:"#FF7272",yellow:"#FFD674"},urbanTwilight:{background:"#161727",currentLine:"#1F2737",selection:"#35415B",foreground:"#BDC9D7",comment:"#7F8C9C",cyan:"#77AED8",green:"#6CC492",orange:"#FFB677",pink:"#FF95B1",purple:"#B48DC2",red:"#FF6C6C",yellow:"#FFD576"},vibrantInk:{background:"#1C1E26",currentLine:"#242730",selection:"#363B4A",foreground:"#BFC7D5",comment:"#5C6672",cyan:"#6A76FB",green:"#33CC95",orange:"#FF9A65",pink:"#FF75B5",purple:"#AE81FF",red:"#FF6188",yellow:"#FDD269"},vintageRust:{background:"#301F1A",currentLine:"#3E2A23",selection:"#5D3E35",foreground:"#D7C3A7",comment:"#7F6C55",cyan:"#83A4C4",green:"#7EAD90",orange:"#FFA45E",pink:"#FF8C9E",purple:"#B491A9",red:"#FF7262",yellow:"#FFD372"}},ps={...us,...ds};class ms{constructor(t,e=0){this.id="Ziko-Theme-"+e,this.use(t)}get current(){return["background","currentLine","selection","foreground","comment","cyan","green","orange","pink","purple","red","yellow"].reduce(((t,e)=>(t[e]=`var(--${e}-${this.id})`,t)),{})}useThemeIndex(t){const e=Object.keys(ps);for(let s in ps[e[t]])document.documentElement.style.setProperty(`--${s}-${this.id}`,ps[e[t]][s]);return this}useThemeName(t){t=t.toLowerCase();const e=Object.fromEntries(Object.entries(ps).map((t=>[t[0].toLowerCase(),t[1]])));for(let s in e[t])document.documentElement.style.setProperty(`--${s}-${this.id}`,e[t][s]);return this}useThemeObject(t){for(let e in t)document.documentElement.style.setProperty(`--${e}-${this.id}`,t[e]);return this}use(t){return"number"==typeof t&&this.useThemeIndex(t),"string"==typeof t&&this.useThemeName(t),t instanceof Object&&this.useThemeObject(t),this}}const gs=(t,e=0)=>new ms(t,e);class fs{constructor(){this.events={},this.maxListeners=10}on(t,e){this.events[t]||(this.events[t]=[]),this.events[t].push(e),this.events[t].length>this.maxListeners&&console.warn(`Warning: Possible memory leak. Event '${t}' has more than ${this.maxListeners} listeners.`)}once(t,e){const s=r=>{this.off(t,s),e(r)};this.on(t,s)}off(t,e){const s=this.events[t];if(s){const t=s.indexOf(e);-1!==t&&s.splice(t,1)}}emit(t,e){const s=this.events[t];s&&s.forEach((t=>{t(e)}))}clear(t){t?delete this.events[t]:this.events={}}setMaxListener(t,e){this.maxListeners=e}removeAllListeners(t){t?this.events[t]=[]:this.events={}}}const bs=()=>new fs;class ys{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 ws=(t,e)=>new ys(t,e);class xs{constructor(t,e=!0){this.#n(),this.cache={Emitter:null},e&&this.useEventEmitter(),this.set(t)}#n(){return this.__FavIcon__=document.querySelector("link[rel*='icon']")||document?.createElement("link"),this.__FavIcon__.type="image/x-icon",this.__FavIcon__.rel="shortcut icon",this}set(t){return t!==this.__FavIcon__.href&&(this.__FavIcon__.href=t,this.cache.Emitter&&this.cache.Emitter.emit("ziko:favicon-changed")),this}get current(){return document.__FavIcon__.href}onChange(t){return this.cache.Emitter&&this.cache.Emitter.on("ziko:favicon-changed",t),this}useEventEmitter(){return this.cache.Emitter=bs(),this}}const vs=(t,e)=>new xs(t,e);class Cs{constructor(t=[],e=(()=>{})){this.mediaQueryRules=t,this.fallback=e,this.lastCalledCallback=null,this.init()}init(){this.mediaQueryRules.forEach((({query:t,callback:e})=>{const s=globalThis.matchMedia(t),r=()=>{const t=this.mediaQueryRules.some((({query:t})=>globalThis.matchMedia(t).matches));s.matches?(e(),this.lastCalledCallback=e):t||this.lastCalledCallback===this.fallback||(this.fallback(),this.lastCalledCallback=this.fallback)};r(),s.addListener(r)}))}}const Fs=(t,e)=>new Cs(t,e);class ks{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"+nt.string(10),this.SUBSCRIBERS=new Set([this.UUID])}get broadcast(){return this}emit(t,e){return this.EVENTS_DATAS_PAIRS.set(t,e),this.#i(t),this}on(t,e=console.log){return this.EVENTS_HANDLERS_PAIRS.set(t,e),this.#o(),this}#o(){return this.channel.onmessage=t=>{this.LAST_RECEIVED_EVENT=t.data.last_sended_event;const e=t.data.userId;this.SUBSCRIBERS.add(e);const s=t.data.EVENTS_DATAS_PAIRS.get(this.LAST_RECEIVED_EVENT),r=this.EVENTS_HANDLERS_PAIRS.get(this.LAST_RECEIVED_EVENT);s&&r&&r(s)},this}#i(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 Es=t=>new ks(t);class As{#a;constructor(){this.#a=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.#a],{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 Ds=(t,e,s)=>{const r=new As;return t&&r.call(t,e,s),r};class Bs{constructor(t={acceptAllDevices:!0}){this.options=t,this.__Emitter__=bs(),this.isSupported&&this.#n()}async#n(){this.promise=navigator.bluetooth.requestDevice(this.options).then((t=>this.device=t))}get isSupported(){return!!navigator.bluetooth}get current(){return this.device}connect(){return this.server=this.device.gatt.connect(),this.__Emitter__.emit("ziko:bluetooth-connected"),this}disconnect(){return this.device.gatt.disconnect(),this.__Emitter__.emit("ziko:bluetooth-disconnected"),this}onConnect(t){return this.__Emitter__.on("ziko:bluetooth-connected",t),this}onDisconnect(t){return this.__Emitter__.on("ziko:bluetooth-disconnected",t),this}dispose(){}async battery(t){const e=await this.server.getPrimaryService("battery_service"),s=await e.getCharacteristic("battery_level"),r=await s.readValue();t(await r.getUint8(0))}}const Ts=t=>new Bs(t);class _s{constructor(){this.isSupported&&this.#n()}async#n(){this.__Battery__=await navigator.getBattery()}get isSupported(){return!!navigator.getBattery}get current(){const{level:t,charging:e,chargingTime:s,dischargingTime:r}=this.__Battery__;return{level:t,charging:e,chargingTime:s,dischargingTime:r}}onChargingChange(t){return this.__Battery__?.addEventListener("chargingchange",t),this}onLevelChange(t){return this.__Battery__?.addEventListener("levelchange",t),this}}const Is=()=>new _s;class Ms{constructor(){this.isSupported&&this.#n()}async#n(){navigator.geolocation.getCurrentPosition((t=>this.__Geolocation__=t))}get isSupported(){return!!navigator.geolocation}get current(){return this.__Geolocation__}}const Ss=()=>new Ms;class Os{constructor(t,e=1e3/30,s=0,r=1/0,n=!0){this.callback=t,this.cache={isRunning:!1,AnimationId:null,t0:null,step:e,startTime:s,endTime:r,started:n},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 Ls=(t,e,s,r,n)=>new Os(t,e,s,r,n),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},Rs=(t,e=1e3)=>(...s)=>setTimeout((()=>t(...s)),e),Ps=(t,e)=>{let s=0;return(...r)=>{const n=(new Date).getTime();n-s<e||(s=n,t(...r))}},zs=t=>{const e=Date.now(),s=performance.memory.usedJSHeapSize,r=t();return{elapsedTime:Date.now()-e,usedMemory:performance.memory.usedJSHeapSize-s,result:r}},$s=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})})),Ns=(t,e=2e3)=>{const s=Date.now();for(;Date.now()-s<e;)if(t.element)return t.element},Vs=t=>new Promise((e=>setTimeout(e,t))),Us=t=>{console.time("timeTaken");const e=t();return console.timeEnd("timeTaken"),e};class Hs{constructor(t,e=js.Linear,s=50,{t:r=[0,null],start:n=!0,duration:i=3e3}={}){this.cache={isRunning:!1,AnimationId:null,startTime:null,ease:e,step:s,intervall:r,started:n,duration:i},this.t=0,this.tx=0,this.ty=0,this.i=0,this.callback=t}#h(){this.t+=this.cache.step,this.i++,this.tx=Or(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}#l(t=!0){return this.cache.isRunning||(t&&this.reset(!1),this.cache.isRunning=!0,this.cache.startTime=Date.now(),this.cache.AnimationId=setInterval(this.#h.bind(this),this.cache.step)),this}start(){return this.#l(!0),this}pause(){return this.cache.isRunning&&(clearTimeout(this.cache.AnimationId),this.cache.isRunning=!1),this}resume(){return this.#l(!1),this}stop(){return this.pause(),this.reset(!1),this}}const Zs=(t,e=js.Linear,s=50,r)=>new Hs(t,js.Linear,50,r),Xs={wait:Vs,timeTaken:Us,useThrottle:Ps,useDebounce:Rs,Ease:js,time_memory_Taken:zs,useTimeLoop:Ls,useAnimation:Zs,waitForUIElm:$s,waitForUIElmSync:Ns,ExtractAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"ExtractAll"!==s&&"RemoveAll"!==s&&(globalThis[s]=this[s])}return this},RemoveAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"RemoveAll"!==s&&delete globalThis[s]}return this}};class Ws{constructor(t,e,s){this.cache={storage:t,globalKey:e,channel:Es(`Ziko:useStorage-${e}`),oldItemKeys:new Set},this.#n(s),this.#c()}get items(){return JSON.parse(this.cache.storage[this.cache.globalKey]??null)}#c(){for(let t in this.items)Object.assign(this,{[[t]]:this.items[t]})}#n(t){this.cache.channel=Es(`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 qs=(t,e)=>new Ws(localStorage,t,e),Ys=(t,e)=>new Ws(sessionStorage,t,e),Gs=(t,e=[],s=(()=>{}))=>{t.cache.stream.enabled.down=!0;const r=e.length,n=t.cache.stream.history.down.slice(-r).map((t=>t.key));e.join("")===n.join("")&&(t.event.preventDefault(),s.call(t,t))},Qs={Events:Ke,Observer:cs,Hooks:{useStyle:$t,useTheme:gs,useMediaQuery:Fs,useBattery:Is,useGeolocation:Ss,useEventEmitter:bs,useChannel:Es,useThread:Ds,useBluetooth:Ts,useTitle:ws,useFavIcon:vs,useThrottle:Ps,useDebounce:Rs,useLocaleStorage:qs,useSessionStorage:Ys,useSuccesifKeys:Gs,ExtractAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"ExtractAll"!==s&&"RemoveAll"!==s&&(globalThis[s]=this[s])}return this},RemoveAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"RemoveAll"!==s&&delete globalThis[s]}return this}},ExtractAll:function(){this.Events.ExtractAll(),this.Observer.ExtractAll(),this.Hooks.ExtractAll()},RemoveAll:function(){this.Events.RemoveAll(),this.Observer.RemoveAll(),this.Hooks.RemoveAll()}};class Ks{constructor(t,e=""){var s;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)),this.element=t,this.uuid=this.constructor.name+"-"+nt.string(10),this.cache={name:e,parent:null,isRoot:!1,isHidden:!1,isFrozzen:!1,legacyParent:null,style:(s={},new Vt(s)),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",fontFamily:"verdana",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],globalThis.__Ziko__.__Config__.default.render&&this.render()}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 __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 zt?this.st.style(t.current):this.st.style(t),this}size(t,e){return this.st.size(t,e),this}get#u(){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.#u,direction:"rtl"}):this.style({direction:"rtl"}),this}useLtr(t=!1){return t?this.style({...this.#u,direction:"ltr"}):this.style({direction:"ltr"}),this}freeze(t){return this.cache.isFrozzen=t,this}setTarget(t){return t instanceof Ks&&(t=t.element),this.unrender(),this.target=t,this.render(),this}render(t=this.target){return t instanceof Ks&&(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 Ks&&(t=t.element),this.element?.after(t),this}before(t){return t instanceof Ks&&(t=t.element),this.element?.before(t),this}animate(t,{duration:e=1e3,iterations:s=1,easing:r="ease"}={}){return this.element?.animate(t,{duration:e,iterations:s,easing:r}),this}setAttr(t,e){if(t instanceof Object){const[s,r]=[Object.keys(t),Object.values(t)];for(let n=0;n<s.length;n++)r[n]instanceof Array&&(e[n]=r[n].join(" ")),this?.attr[t[n]]!==e[n]&&(this.element?.setAttribute(s[n],r[n]),Object.assign(this.cache.attributes,Object.fromEntries([[s[n],r[n]]])))}else e instanceof Array&&(e=e.join(" ")),this?.attr[t]!==e&&(this.element?.setAttribute(t,e),Object.assign(this.cache.attributes,Object.fromEntries([[t,e]])));return this}removeAttr(...t){for(let e=0;e<t.length;e++)this.element?.removeAttribute(t[e]);return this}getAttr(t){return 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=Jt(this)),this.events.ptr.onMove(...t),this}onPtrDown(...t){return this.events.ptr||(this.events.ptr=Jt(this)),this.events.ptr.onDown(...t),this}onPtrUp(...t){return this.events.ptr||(this.events.ptr=Jt(this)),this.events.ptr.onUp(...t),this}onPtrEnter(...t){return this.events.ptr||(this.events.ptr=Jt(this)),this.events.ptr.onEnter(...t),this}onPtrLeave(...t){return this.events.ptr||(this.events.ptr=Jt(this)),this.events.ptr.onLeave(...t),this}onPtrOut(...t){return this.events.ptr||(this.events.ptr=Jt(this)),this.events.ptr.onOut(...t),this}onPtrCancel(...t){return this.events.ptr||(this.events.ptr=Jt(this)),this.events.ptr.onCancel(...t),this}onSwipe(t,e,...s){return this.events.swipe||(this.events.swipe=Qe(this,t,e)),this.events.swipe.onSwipe(...s),this}onMouseMove(...t){return this.events.mouse||(this.events.mouse=he(this)),this.events.mouse.onMove(...t),this}onMouseDown(...t){return this.events.mouse||(this.events.mouse=he(this)),this.events.mouse.onDown(...t),this}onMouseUp(...t){return this.events.mouse||(this.events.mouse=he(this)),this.events.mouse.onUp(...t),this}onMouseEnter(...t){return this.events.mouse||(this.events.mouse=he(this)),this.events.mouse.onEnter(...t),this}onMouseLeave(...t){return this.events.mouse||(this.events.mouse=he(this)),this.events.mouse.onLeave(...t),this}onMouseOut(...t){return this.events.mouse||(this.events.mouse=he(this)),this.events.mouse.onOut(...t),this}onWheel(...t){return this.events.wheel||(this.events.wheel=ue(this)),this.events.wheel.onWheel(...t),this}onKeyDown(...t){return this.events.key||(this.events.key=fe(this)),this.events.key.onDown(...t),this}onKeyPress(...t){return this.events.key||(this.events.key=fe(this)),this.events.key.onPress(...t),this}onKeyUp(...t){return this.events.key||(this.events.key=fe(this)),this.events.key.onUp(...t),this}onKeysDown({keys:t=[],callback:e}={}){return this.events.key||(this.events.key=fe(this)),this.events.key.handleSuccessifKeys({keys:t,callback:e}),this}onDragStart(...t){return this.events.drag||(this.events.drag=Fe(this)),this.events.drag.onStart(...t),this}onDrag(...t){return this.events.drag||(this.events.drag=Fe(this)),this.events.drag.onDrag(...t),this}onDragEnd(...t){return this.events.drag||(this.events.drag=Fe(this)),this.events.drag.onEnd(...t),this}onDrop(...t){return this.events.drop||(this.events.drop=ke(this)),this.events.drop.onDrop(...t),this}onClick(...t){return this.events.click||(this.events.click=Be(this)),this.events.click.onClick(...t),this}onDbClick(...t){return this.events.click||(this.events.click=Be(this)),this.events.click.onDbClick(...t),this}onCopy(...t){return this.events.clipboard||(this.events.clipboard=Oe(this)),this.events.clipboard.onCopy(...t),this}onCut(...t){return this.events.clipboard||(this.events.clipboard=Oe(this)),this.events.clipboard.onCut(...t),this}onPaste(...t){return this.events.clipboard||(this.events.clipboard=Oe(this)),this.events.clipboard.onPaste(...t),this}onSelect(...t){return this.events.clipboard||(this.events.clipboard=Oe(this)),this.events.clipboard.onSelect(...t),this}onFocus(...t){return this.events.focus||(this.events.focus=Pe(this)),this.events.focus.onFocus(...t),this}onBlur(...t){return this.events.focus||(this.events.focus=Pe(this)),this.events.focus.onFocus(...t),this}on(t,...e){return this.events.custom||(this.events.custom=qe(this)),this.events.custom.on(t,...e),this}emit(t,e={}){return this.events.custom||(this.events.custom=qe(this)),this.events.custom.emit(t,e),this}watchAttr(t){return this.observer.attr||(this.observer.attr=as(this,t)),this}watchChildren(t){return this.observer.children||(this.observer.children=ls(this,t)),this}watchSize(t){return this.observer.resize||(this.observer.resize=rs(this,t)),this.observer.resize.start(),this}watchIntersection(t,e){return this.observer.intersection||(this.observer.intersection=ts(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}}let Js=class extends Ks{constructor(t,e,s){super("img","image"),this.value=t,"IMG"===t.nodeName?this.element?.setAttribute("src",t.src):this.element?.setAttribute("src",t),"number"==typeof e&&(e+="%"),"number"==typeof s&&(s+="%"),this.style({border:"1px solid black",width:e,height:s})}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 tr=t=>(new XMLSerializer).serializeToString(t),er=t=>btoa(tr(t)),sr=t=>"data:image/svg+xml;base64,"+er(t),rr=(t,e=!0)=>((t,e,s)=>new Js(t,e,s))(sr(t)).render(e),nr=t=>JSON.stringify(yr((t=>["number","string","boolean","bigint"].includes(typeof t)?String(t):t instanceof i||t instanceof dr?t.toString():t instanceof Array?or(t):void 0),t),null," ").replace(/"([^"]+)":/g,"$1:").replace(/: "([^"]+)"/g,": $1"),ir=t=>{if(!Array.isArray(t))return 0;let e=1;for(const s of t)if(Array.isArray(s)){const t=ir(s);t+1>e&&(e=t+1)}return e},or=t=>{let e=0;return function t(s){let r=ir(s),n=0;return s.some((t=>Array.isArray(t)))&&(e++,n=1),"["+s.map(((r,n)=>["number","string","boolean","bigint"].includes(typeof r)?String(r):r instanceof i?r.toString():r instanceof Array?`\n${" ".repeat(e)}${t(r)}${n===s.length-1?"\n":""}`:r instanceof Object?nr(r):void 0))+`${" ".repeat((r+e+1)*n)}]`}(t)};function ar(t){const e={type:t.nodeName,attributes:{},children:[]};for(let s=0;s<t.attributes.length;s++){const r=t.attributes[s];e.attributes[r.name]=r.value}for(let s=0;s<t.childNodes.length;s++){const r=t.childNodes[s];r.nodeType===Node.ELEMENT_NODE?e.children.push(ar(r)):r.nodeType===Node.TEXT_NODE&&(e.text=r.textContent.trim())}return e}const hr={isDigit:/^\d+$/,isEmail:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,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 lr{constructor(t){this.string=t}isDigit(){return hr.isDigit.test(this.string)}static isDigit(t){return new lr(t).isDigit()}isNumber(){return!isNaN(this.string)}static isNumber(t){return new lr(t).isNumber()}isUrl(){return hr.isURL.test(this.string)}static isUrl(t){return new lr(t).isUrl()}isHexColor(){return hr.isHexColor.test(this.string)}static isHexColor(t){return new lr(t).isHexColor()}isIPv4(){return hr.isIPv4.test(this.string)}static isIPv4(t){return new lr(t).isIPv4()}isDate(){return hr.isDate.test(this.string)}static isDate(t){return new lr(t).isDate()}isMACAddress(){return hr.isMACAddress.test(this.string)}static isMACAddress(t){return new lr(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 lr(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 lr(t).isCamelCase()}isHyphenCase(){return this.string.split("-").length>1}static isHyphenCase(t){return new lr(t).isHyphenCase()}isSnakeCase(){return this.string.split("_").length>1}static isSnakeCase(t){return new lr(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 lr(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 lr(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 cr=t=>new lr(t),ur={str:cr,Str:lr,parseXML:function(t){return ar((new DOMParser).parseFromString(t,"text/xml").documentElement)},preload: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}`)},obj2str:nr,arr2str:or,markdown2html:gt,adoc2html:Ct,csv2arr:Ft,csv2matrix:kt,csv2object:Et,csv2json:At,csv2sql:Dt,json2arr:_t,json2csv:It,json2csvFile:Mt,json2yml:Lt,json2ymlFile:jt,json2xml:Rt,json2xmlFile:Pt,svg2str:tr,svg2ascii:er,svg2imgUrl:sr,svg2img:rr,ExtractAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"ExtractAll"!==s&&"RemoveAll"!==s&&(globalThis[s]=this[s])}return this},RemoveAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"RemoveAll"!==s&&delete globalThis[s]}return this}};class dr extends n{constructor(t,e,s=[]){if(super(),t instanceof dr)this.arr=t.arr,this.rows=t.rows,this.cols=t.cols;else{let r,n,i=[];if(arguments[0]instanceof Array)t=arguments[0].length,e=arguments[0][0].length,i=arguments[0];else for(r=0;r<t;r++)for(i.push([]),i[r].push(new Array(e)),n=0;n<e;n++)i[r][n]=s[r*e+n],null==s[r*e+n]&&(i[r][n]=0);this.rows=t,this.cols=e,this.arr=i}this._maintain()}toString(){return or(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 dr(t,e,this.arr.flat(1));console.error("Err")}static eye(t){let e=new dr(t,t);for(let s=0;s<t;s++)for(let r=0;r<t;r++)e.arr[s][r]=s===r?1:0;return e}get clone(){return new dr(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 dr(this.cols,this.rows,this.arr.flat(1).reel)}get imag(){return new dr(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==dr.sub(e,t).max&&0==dr.sub(e,t).min}get isAntiSym(){if(!this.isSquare)return!1;const t=this.T,e=this.clone;return 0==dr.add(e,t).max&&0==dr.add(e,t).min}get isDiag(){if(!this.isSquare)return!1;const t=this.T,e=this.clone,s=dr.mul(e,t),r=dr.dot(t,e);return 0==dr.sub(s,r).max&&0==dr.sub(s,r).min}get isOrtho(){return!!this.isSquare&&(this.isDiag&&(1==this.det||-1==this.det))}get isIdemp(){if(!this.isSquare)return!1;const t=this.clone,e=dr.dot(t,t);return 0==dr.sub(e,t).max&&0==dr.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 dr(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 dr))?void console.warn("Tensors are not completely supported yet ..."):Wr.sub(Wr.mul(s[0][0],s[1][1]),Wr.mul(s[0][1],s[1][0]));for(var r=0,n=0;n<s.length;n++){const i=Wr.add(Wr.mul(x(-1,n),Wr.mul(s[0][n],e(t(s,n)))));r=Wr.add(r,i)}return r}(this.arr)}get inv(){if(!this.isSquare)return new Error("is not square matrix");if(0===this.det)return"determinat = 0 !!!";let t=function(t){if(t.length!==t[0].length)return;var e=0,s=0,r=0,n=t.length,i=0,o=[],a=[];for(e=0;e<n;e+=1)for(o[o.length]=[],a[a.length]=[],r=0;r<n;r+=1)o[e][r]=e==r?1:0,a[e][r]=t[e][r];for(e=0;e<n;e+=1){if(0==(i=a[e][e])){for(s=e+1;s<n;s+=1)if(0!=a[s][e]){for(r=0;r<n;r++)i=a[e][r],a[e][r]=a[s][r],a[s][r]=i,i=o[e][r],o[e][r]=o[s][r],o[s][r]=i;break}if(0==(i=a[e][e]))return}for(r=0;r<n;r++)a[e][r]=a[e][r]/i,o[e][r]=o[e][r]/i;for(s=0;s<n;s++)if(s!=e)for(i=a[s][e],r=0;r<n;r++)a[s][r]-=i*a[e][r],o[s][r]-=i*o[e][r]}return o}(this.arr);return new dr(this.rows,this.cols,t.flat(1))}static zeros(t,e){let s=new dr(t,e);for(let n=0;n<t;n++)for(var r=0;r<e;r++)s.arr[n][r]=0;return s}static ones(t,e){let s=new dr(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)s.arr[r][t]=1;return s}static nums(t,e,s){let r=new dr(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)r.arr[n][t]=s;return r}static get rand(){return{int:(t,e,s,r)=>{let n=new dr(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)n.arr[i][t]=nt.randInt(s,r);return n},bin:(t,e)=>{let s=new dr(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)s.arr[r][t]=nt.randBin;return s},hex:(t,e)=>{let s=new dr(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)s.arr[r][t]=nt.randHex;return s},choices:(t,e,s,r)=>{let n=new dr(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)n.arr[i][t]=nt.choice(s,r);return n},permutation:(t,e,s)=>{}}}static rands(t,e,s=1,r){let n=new dr(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)n.arr[i][t]=nt.rand(s,r);return n}map(t,e,s,r){return Wr.map(this,t,e,s,r)}lerp(t,e){return Wr.lerp(this,t,e)}norm(t,e){return Wr.norm(this,t,e)}clamp(t,e){return Wr.clamp(this,t,e)}static map(t,e,s,r,n){return Wr.map(t,e,s,r,n)}static lerp(t,e,s){return Wr.lerp(t,e,s)}static norm(t,e,s){return Wr.norm(t,e,s)}static clamp(t,e,s){return Wr.clamp(pr,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 dr(this.rows,this.cols,t)}get toOct(){let t=this.arr.flat(1).toOct;return new dr(this.rows,this.cols,t)}get toHex(){let t=this.arr.flat(1).toHex;return new dr(this.rows,this.cols,t)}max2min(){let t=this.arr.flat(1).max2min;return new dr(this.rows,this.cols,t)}min2max(){let t=this.arr.flat(1).min2max;return new dr(this.rows,this.cols,t)}sortRows(t=void 0){let e=this.arr.map((e=>e.sort(t))).flat(1);return new dr(this.rows,this.cols,e)}sortCols(t=void 0){let e=this.T.arr.map((e=>e.sort(t))).flat(1);return new dr(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 dr(s)}filterByCols(t){return new dr(this.T.arr.filter((e=>e.includes(t))))}sortAll(t=void 0){let e=this.arr.flat(1).sort(t);return new dr(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 dr(this.rows,this.cols,e)}#d(t){if(this.rows!==t.rows)return;let e=this.arr;for(let s=0;s<this.rows;s++)for(let r=this.cols;r<this.cols+t.cols;r++)e[s][r]=t.arr[s][r-this.cols];return this.cols+=t.cols,new dr(this.rows,this.cols,e.flat(1))}hstack(...t){const e=[this,...t].reduce(((t,e)=>t.#d(e)));return Object.assign(this,e),this}static hstack(t,...e){return t.clone.hstack(...e)}#p(t){if(this.cols!==t.cols)return;let e=this.arr;for(let s=this.rows;s<this.rows+t.rows;s++){e[s]=[];for(let r=0;r<this.cols;r++)e[s][r]=t.arr[s-this.rows][r]}return this.rows+=t.rows,new dr(this.rows,this.cols,e.flat(1))}vstack(...t){const e=[this,...t].reduce(((t,e)=>t.#p(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.#d(e)));return Object.assign(this,e),this}vqueue(...t){const e=[this,...t].reverse().reduce(((t,e)=>t.#p(e)));return Object.assign(this,e),this}static hqueue(t,...e){return t.clone.hqueue(...e)}static vqueue(t,...e){return t.clone.vqueue(...e)}slice(t=0,e=0,s=this.rows-1,r=this.cols-1){let n=s-t,i=r-e,o=new Array(i);for(let s=0;s<n;s++){o[s]=[];for(let r=0;r<i;r++)o[s][r]=this.arr[s+t][r+e]}return new dr(n,i,o.flat(1))}static slice(t,e=0,s=0,r=this.rows-1,n=this.cols-1){return t.slice(e,s,r,n)}splice(t,e,s,...r){}getRows(t,e=t+1){return this.slice(t,0,e,this.cols)}getCols(t,e=t+1){return this.slice(0,t,this.rows,e)}static getRows(t,e,s=e+1){return t.slice(e,0,s,t.cols)}static getCols(t,e,s=e+1){return t.slice(0,e,t.rows,s)}add(...t){for(let s=0;s<t.length;s++){("number"==typeof t[s]||t[s]instanceof i)&&(t[s]=dr.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=Wr.add(this.arr[r][e],t[s].arr[r][e])}return new dr(this.rows,this.cols,this.arr.flat(1))}sub(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=dr.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=Wr.sub(this.arr[r][e],t[s].arr[r][e])}return new dr(this.rows,this.cols,this.arr.flat(1))}static add(t,...e){return t.clone.add(...e)}static sub(t,...e){return t.clone.sub(...e)}mul(...t){for(let r=0;r<t.length;r++){"number"==typeof t[r]&&(t[r]=dr.nums(this.rows,this.cols,t[r]));for(var e=0;e<this.rows;e++)for(var s=0;s<this.cols;s++)this.arr[e][s]=Wr.mul(this.arr[e][s],t[r].arr[e][s])}return new dr(this.rows,this.cols,this.arr.flat(1))}div(...t){for(let s=0;s<t.length;s++){"number"==typeof t[s]&&(t[s]=dr.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=Wr.div(this.arr[r][e],t[s].arr[r][e])}return new dr(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]=dr.nums(this.rows,this.cols,t[s]));for(let r=0;r<this.rows;r++)for(var e=0;e<this.cols;e++)this.arr[r][e]=Wr.modulo(this.arr[r][e],t[s].arr[r][e])}return new dr(this.rows,this.cols,this.arr.flat(1))}static modulo(t,...e){return t.clone.modulo(...e)}dot(t){for(var e=[],s=0;s<this.arr.length;s++){e[s]=[];for(var r=0;r<t.arr[0].length;r++){e[s][r]=0;for(var n=0;n<this.arr[0].length;n++)e[s][r]=Wr.add(e[s][r],Wr.mul(this.arr[s][n],t.arr[n][r]))}}return new dr(this.arr.length,t.arr[0].length,e.flat(1))}static dot(t,e){return t.dot(e)}pow(t){let e=this.clone,s=this.clone;for(let r=0;r<t-1;r++)s=s.dot(e);return s}static pow(t,e){return t.clone.pow(e)}get somme(){let t=0;for(let e=0;e<this.rows;e++)for(let s=0;s<this.cols;s++)t+=this.arr[e][s];return t}get DoesItContainComplexNumbers(){return this.arr.flat(1/0).some((t=>t instanceof i))}get min(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(l(...this.arr[e]));return l(...t)}get max(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(u(...this.arr[e]));return u(...t)}get minRows(){this.DoesItContainComplexNumbers&&console.error("Complex numbers are not comparable");let t=[];for(let e=0;e<this.rows;e++)t.push(l(...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(u(...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 dr(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 dr(t.rows,t.cols);return e.arr=t.arr,e}DecompositionLU(){const[t,e]=it(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]=lt(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:ct(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)=>dr.LU(...t),QR:(...t)=>dr.QR(...t),CHOLESKY:(...t)=>dr.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 r=0;r<s[0].length;r++)s[t][r].innerHTML=this.arr[t][r],e[t].appendChild(s[t][r]);return e.map((e=>t.appendChild(e))),t}toGrid(t,e={}){let s=Grid();return s.append(...this.map(t).arr.flat(1).map((t=>t.style(e)))),s.Columns(this.cols),s}sortTable(t=0,{type:e="num",order:s="asc"}={}){var r=this.T.arr.map((t=>t.map(((t,e)=>Object.assign({},{x:t,y:e}))))),n=this.T.arr.map((t=>t.map(((t,e)=>Object.assign({},{x:t,y:e})))));"num"===e?"asc"===s?r[t].sort(((t,e)=>t.x-e.x)):"desc"===s?r[t].sort(((t,e)=>e.x-t.x)):"toggle"===s&&(r[t][0].x>r[t][1].x?r[t].sort(((t,e)=>e.x-t.x)):r[t].sort(((t,e)=>t.x-e.x))):"alpha"===e&&("asc"===s?r[t].sort(((t,e)=>(""+t.x).localeCompare(""+e.x))):"desc"===s&&r[t].sort(((t,e)=>(""+e.x).localeCompare(""+t.x)))),s=r[t].map((t=>t.y));for(let e=0;e<r.length;e++)e!==t&&r[e].map(((t,e)=>t.y=s[e]));for(let e=0;e<r.length;e++)e!==t&&n[e].map(((t,n)=>t.x=r[e][s[n]].x));n[t]=r[t];var i=n.map((t=>t.map((t=>t.x))));return new dr(i).T}}const pr=(t,e,s)=>new dr(t,e,s),mr=(...t)=>new dr(2,2,t),gr=(...t)=>new dr(3,3,t),fr=(...t)=>new dr(4,4,t);class br{static resolve(t,e){return t.inv.dot(dr.fromVector(e)).arr.flat(1).map((t=>+t.toFixed(10)))}}const yr=(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=>yr(t,e)));if(ArrayBuffer.isView(e))return e.map((e=>t(e)));if(e instanceof Set)return new Set(yr(t,...e));if(e instanceof Map)return new Map([...e].map((e=>[e[0],yr(t,e[1])])));if(e instanceof dr)return new dr(e.rows,e.cols,yr(e.arr.flat(1)));if(e instanceof i){const[s,r,n,i]=[e.a,e.b,e.z,e.phi];switch(t){case Math.log:return o(F(n),i);case Math.exp:return o(C(s)*k(r),C(s)*E(r));case Math.abs:return n;case Math.sqrt:return o(w(n)*k(i/2),w(n)*E(i/2));case b.cos:return o(k(s)*L(r),-E(s)*j(r));case b.sin:return o(E(s)*L(r),k(s)*j(r));case b.tan:{const t=k(2*s)+L(2*r);return o(E(2*s)/t,j(2*r)/t)}case b.cosh:return o(L(s)*k(r),j(s)*E(r));case b.sinh:return o(j(s)*k(r),L(s)*E(r));case b.tanh:{const t=L(2*s)+k(2*r);return o(j(2*s)/t,E(2*r)/t)}default:return t(e)}}else if(e instanceof Object)return Object.fromEntries(Object.entries(e).map((e=>[e[0],yr(t,e[1])])))}));return 1==s.length?s[0]:s},wr=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t+e;if(e instanceof i)return o(t+e.a,e.b);if(e instanceof dr)return dr.nums(e.rows,e.cols,t).add(e);if(e instanceof Array)return e.map((e=>kr(e,t)))}else{if(t instanceof i||t instanceof dr)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=>kr(t,e)));if(t.length===e.length)return t.map(((t,s)=>kr(t,e[s])))}}},xr=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t-e;if(e instanceof i)return o(t-e.a,-e.b);if(e instanceof dr)return dr.nums(e.rows,e.cols,t).sub(e);if(e instanceof Array)return e.map((e=>Er(e,t)))}else{if(t instanceof i||t instanceof dr)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=>Er(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>Er(t,e[s])))}}},vr=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t*e;if(e instanceof i)return o(t*e.a,t*e.b);if(e instanceof dr)return dr.nums(e.rows,e.cols,t).mul(e);if(e instanceof Array)return e.map((e=>Ar(t,e)))}else{if(t instanceof i||t instanceof dr)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=>Ar(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>Ar(t,e[s])))}}},Cr=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t/e;if(e instanceof i)return o(t/e.a,t/e.b);if(e instanceof dr)return dr.nums(e.rows,e.cols,t).div(e);if(e instanceof Array)return e.map((e=>Dr(t,e)))}else{if(t instanceof i||t instanceof dr)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=>Dr(t,e)));if(e instanceof Array&&t.length===e.length)return t.map(((t,s)=>Dr(t,e[s])))}}},Fr=(t,e)=>{if("number"==typeof t){if("number"==typeof e)return t%e;if(e instanceof i)return o(t%e.a,t%e.b);if(e instanceof dr)return dr.nums(e.rows,e.cols,t).modulo(e);if(e instanceof Array)return e.map((e=>Dr(t,e)))}else{if(t instanceof i||t instanceof dr)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=>kr(t,e)))}},kr=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=wr(s,e[t]);return s},Er=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=xr(s,e[t]);return s},Ar=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=vr(s,e[t]);return s},Dr=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=Cr(s,e[t]);return s},Br=(t,...e)=>{var s=t;for(let t=0;t<e.length;t++)s=Fr(s,e[t]);return s},Tr=t=>new Array(t).fill(0),_r=t=>new Array(t).fill(1),Ir=(t,e)=>new Array(e).fill(t),Mr=(t,e,s)=>{if("number"==typeof t)return e!==s?(t-e)/(s-e):0;if(t instanceof dr)return new dr(t.rows,t.cols,Mr(t.arr.flat(1),e,s));if(t instanceof i)return new i(Mr(t.a,e,s),Mr(t.b,e,s));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>Mr(t,e,s)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=Mr(t[s])}}},Sr=(t,e,s)=>{if("number"==typeof t)return(s-e)*t+e;if(t instanceof dr)return new dr(t.rows,t.cols,Sr(t.arr.flat(1),e,s));if(t instanceof i)return new i(Sr(t.a,e,s),Sr(t.b,e,s));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>Sr(t,e,s)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=Sr(t[s])}}},Or=(t,e,s,r,n)=>{if("number"==typeof t)return Sr(Mr(t,e,s),r,n);if(t instanceof dr)return new dr(t.rows,t.cols,Or(t.arr.flat(1),e,s,r,n));if(t instanceof i)return new i(Or(t.a,s,r,n),Or(t.b,e,s,r,n));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>Or(t,e,s,r,n)));{let i=new Array(t.length);for(let o=0;o<t.length;o++)i[o]=Or(t[o],e,s,r,n)}}},Lr=(t,e,s)=>{const[r,n]=[l(e,s),u(e,s)];if("number"==typeof t)return l(u(t,r),n);if(t instanceof dr)return new dr(t.rows,t.cols,Lr(t.arr.flat(1),r,n));if(t instanceof i)return new i(Lr(t.a,r,n),Lr(t.b,r,n));if(t instanceof Array){if(t.every((t=>typeof("number"===t))))return t.map((t=>Lr(t,r,n)));{let e=new Array(t.length);for(let s=0;s<t.length;s++)e[s]=Lr(t[s],r,n)}}},jr=(t,e,s,r=!1)=>{let n=[];if(t<e)for(let i=t;r?i<=e:i<e;i+=s)n.push(10*i/10);else for(let i=t;r?i>=e:i>e;i-=s)n.push(10*i/10);return n},Rr=(t,e,s=y(e-t)+1,r=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[i,o]=[t,e].sort(((t,e)=>e-t));var n=[];let h;h=r?(i-o)/(s-1):(i-o)/s;for(var a=0;a<s;a++)t<e?n.push(o+h*a):n.push(i-h*a);return n}if([t,e].some((t=>t instanceof i))){const n=o(t),i=o(e);s=s||Math.abs(n.a-i.a)+1;const a=Rr(n.a,i.a,s,r),h=Rr(n.b,i.b,s,r);let l=new Array(s).fill(null);return l=l.map(((t,e)=>o(a[e],h[e]))),l}}},Pr=(t,e,r=e-t+1,n=s,i=!0)=>Rr(t,e,r,i).map((t=>x(n,t))),zr=(t,e,s=y(e-t)+1,r=!0)=>{if(Math.floor(s)===s){if([t,e].every((t=>"number"==typeof t))){const[n,i]=[t,e].sort(((t,e)=>e-t));let o;o=v(n/i,r?s-1:s);const a=[i];for(let t=1;t<s;t++)a.push(a[t-1]*o);return t<e?a:a.reverse()}if([t,e].some((t=>t instanceof i))){const n=o(t),i=o(e);let a;s=s||Math.abs(n.a-i.a)+1,a=v(i.div(n),r?s-1:s);const h=[n];for(let t=1;t<s;t++)h.push(Ar(h[t-1],a));return h}}},$r=(...t)=>mapfun((t=>t*Math.PI/180),...t),Nr=(...t)=>mapfun((t=>t/Math.PI*180),...t),Vr=(t,e,s)=>{const[r,n]=[Math.min(e,s),Math.max(e,s)];return t>=r&&t<=n},Ur=(t,e,s=1e-4)=>Math.abs(t-e)<=s,Hr=(t,e)=>t.reduce(((t,s)=>[...t,...e.map((t=>[s,t]))]),[]),Zr=(t,e)=>{let s,r=1;if(t==H(t)&&e==H(e)){for(s=2;s<=t&&s<=e;++s)t%s==0&&e%s==0&&(r=s);return r}console.log("error")},Xr=(t,e)=>{let s;if(t==H(t)&&e==H(e)){for(s=t>e?t:e;s%t!=0||s%e!=0;)++s;return s}console.log("error")},Wr={add:kr,sub:Er,mul:Ar,div:Dr,modulo:Br,zeros:Tr,ones:_r,nums:Ir,norm:Mr,lerp:Sr,map:Or,clamp:Lr,arange:jr,linspace:Rr,logspace:Pr,geomspace:zr,sum:a,prod:h,accum:p,cartesianProduct:Hr,ppcm:Xr,pgcd:Zr,deg2rad:$r,rad2deg:Nr,inRange:Vr,isApproximatlyEqual:Ur},qr=t=>{const s=[],r=t.length;t[0]instanceof i||(t=t.map((t=>o(t,0))));for(let n=0;n<r;n++){let i=0,a=0;for(let s=0;s<r;s++){const o=2*e*n*s/r;i+=t[s].a*k(o)+t[s].b*E(o),a+=-t[s].a*E(o)+t[s].b*k(o)}i/=r,a/=r,s[n]=o(i,a)}return{output:s,re:s.map((t=>t.a)),im:s.map((t=>t.b)),z:s.map((t=>t.z)),phi:s.map((t=>t.phi))}},Yr=t=>{const s=[],r=t.length;t[0]instanceof i||(t=t.map((t=>o(t,0))));for(let n=0;n<r;n++){let i=0,a=0;for(let s=0;s<r;s++){const o=2*e*n*s/r;i+=t[s].a*k(o)+t[s].b*E(o),a+=t[s].a*E(o)+t[s].b*k(o)}i/=r,a/=r,s[n]=o(i,a)}return{output:s,re:s.map((t=>t.a)),im:s.map((t=>t.b)),z:s.map((t=>t.z)),phi:s.map((t=>t.phi))}},Gr=(t,e,s=!0)=>{const r=t.length,n=e.length,i=[],o=s?Math.max(r,n):r+n-1;for(let s=0;s<o;s++){let o=0;for(let i=0;i<n;i++){const a=s+i-Math.floor(n/2);o+=(a>=0&&a<r?t[a]:0)*e[i]}i.push(o)}return i},Qr=(t,e,s=!0)=>{t instanceof dr||(t=pr(t)),e instanceof dr||(e=pr(e));const r=t.rows,n=t.cols,i=s?Math.max(t.rows,e.rows):t.rows+e.rows-1,o=s?Math.max(t.cols,e.cols):t.cols+e.cols-1,a=e.rows,h=[];for(let s=0;s<i;s++){const i=[];for(let h=0;h<o;h++){let o=0;for(let i=0;i<a;i++)for(let l=0;l<a;l++){const c=s+i-Math.floor(a/2),u=h+l-Math.floor(a/2);o+=(c>=0&&c<r&&u>=0&&u<n?t[c][u]:0)*e[i][l]}i.push(o)}h.push(i)}return h},Kr=(t,e,s)=>t instanceof dr||t instanceof Array&&t[0][0]?Qr(t,e,s):Gr(t,e,s);class Jr{constructor(t){this.input=t,this.input_fft=qr(this.input),this.output_fft=[]}lowPass(t){return this.input_fft.output.forEach(((e,s)=>{e=e.z<t?this.output_fft[s]=this.input_fft.output[s]:this.output_fft[s]=o(0,0)})),Yr(this.output_fft).re}highPass(t){return this.input_fft.output.forEach(((e,s)=>{e=e.z>t?this.output_fft[s]=this.input_fft.output[s]:this.output_fft[s]=o(0,0)})),Yr(this.output_fft).re}bandePass(){}bandeCoupe(){}}const tn={zeros:Tr,ones:_r,nums:Ir,arange:jr,linspace:Rr,logspace:Pr,geomspace:zr,map:Or,norm:Mr,lerp:Sr,clamp:Lr,noise:(t,e=0,s=1)=>nt.floats(t,e,s),echelon(t,e=0,s=1){t instanceof Array||(t=[t]);const r=yr((t=>t>=e?1:0),...t);return r instanceof Array?r.map((t=>t*s)):r*s},rampe(t,e=0,s=1){t instanceof Array||(t=[t]);const r=yr((t=>t>=e?t-e:0),...t);return r instanceof Array?r.map((t=>t*s)):r*s},sign(t,e=0,s=1){t instanceof Array||(t=[t]);const r=yr((t=>Math.sign(t-e)),...t);return r instanceof Array?r.map((t=>t*s)):r*s},rect(t,e,s=0,r=1){t instanceof Array||(t=[t]);const n=yr((t=>s-e/2<t&&s+e/2>t?1-2*y(t/e):0),...t);return n instanceof Array?n.map((t=>t*r)):n*r},tri(t,e,s=0,r=1){t instanceof Array||(t=[t]);const n=yr((t=>s-e/2<t&&s+e/2>t?1-2*y(t/e):0),...t);return n instanceof Array?n.map((t=>t*r)):n*r},dirac:(t,e)=>yr((t=>t===e?1/0:0),...t),lorentz(t,e=0,s=1){t instanceof Array||(t=[t]);const r=yr((t=>1/(1+(t-e)**2)),...t);return r instanceof Array?r.map((t=>t*s)):r*s},sinc(t,e,s=1){t instanceof Array||(t=[t]);const r=yr((t=>B(t-e)),...t);return r instanceof Array?r.map((t=>t*s)):r*s},square(t,e=1,s=1){t instanceof Array||(t=[t]);const r=yr((t=>q(E(2*t*Math.PI/e))),...t);return r instanceof Array?r.map((t=>t*s)):r*s},sawtooth(){},conv:Kr,conv1d:Gr,conv2d:Qr,circularConv:(t,e)=>Kr(t,e,!0),linearConv:(t,e)=>Kr(t,e,!1),circularConv1d:(t,e)=>Gr(t,e,!0),linearConv1d:(t,e)=>Gr(t,e,!1),circularConv2d:(t,e)=>Qr(t,e,!0),linearConv2d:(t,e)=>Qr(t,e,!1),fft:qr,ifft:Yr,filter:t=>new Jr(t)},en={PI:e,E:s,EPSILON:r,Random:nt,complex:o,Complex:i,Matrix:dr,LinearSystem:br,matrix:pr,matrix2:mr,matrix3:gr,matrix4:fr,cos:k,sin:E,tan:A,sinc:B,sec:D,csc:T,cot:_,abs:y,sqrt:w,pow:x,sqrtn:v,e:C,ln:F,acos:I,asin:M,atan:S,acot:O,cosh:L,sinh:j,tanh:R,coth:P,acosh:$,asinh:N,atanh:V,min:l,max:u,sign:q,floor:H,ceil:U,round:Z,fact:W,hypot:G,sig:Y,atan2:X,Utils:Wr,mapfun:yr,nums:Ir,zeros:Tr,ones:_r,sum:a,prod:h,add:kr,mul:Ar,div:Dr,sub:Er,modulo:Br,rad2deg:Nr,deg2rad:$r,arange:jr,linspace:Rr,logspace:Pr,geomspace:zr,norm:Mr,lerp:Sr,map:Or,clamp:Lr,pgcd:Zr,ppcm:Xr,isApproximatlyEqual:Ur,inRange:Vr,cartesianProduct:Hr,Discret:rt,Logic:tt,Base:J,Permutation:et,Combinaison:st,powerSet:Q,subSet:K,Signal:tn,ExtractAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"ExtractAll"!==s&&"RemoveAll"!==s&&(globalThis[s]=this[s])}return this},RemoveAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"RemoveAll"!==s&&delete globalThis[s]}return this}};class sn extends Ks{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)}append(...t){if(this.cache.isFrozzen)return console.warn("You can't append new item to frozzen element"),this;for(let e=0;e<t.length;e++)["number","string"].includes(typeof t[e])&&(t[e]=dn(t[e])),t[e]instanceof Ks?(t[e].cache.parent=this,this.element?.appendChild(t[e].element),t[e].target=this.element,this.items.push(t[e])):t[e]instanceof Object&&(t[e]?.style&&this.style(t[e]?.style),t[e]?.attr&&Object.entries(t[e].attr).forEach((t=>this.setAttr(""+t[0],t[1]))));return this.maintain(),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]=dn(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 Ks&&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 r=this.items.filter(t);return r.forEach(e),this.items.filter((t=>!r.includes(t))).forEach(s),this}filterByTextContent(t,e=!1){this.items.forEach((t=>t.render())),this.filter((s=>!(e?s.text===t:s.text.includes(t))),(t=>t.unrender()))}filterByClass(t){return this.items.map((t=>t.render())),this.items.filter((e=>!e.classes.includes(t))).map((t=>t.unrender())),this}sortByTextContent(t,e){let s=this.children;return s.filter((e=>!e.textContent.toLowerCase().includes(t.toLowerCase()))).map((t=>{t.style.display="none"})),s.filter((e=>e.textContent.toLowerCase().includes(t.toLowerCase()))).map(((t,s)=>t.style.display=e[s])),s.filter((t=>"none"!=t.style.display)),this}}class rn extends sn{constructor(t,e,s,...r){super(t,e),this.addValue(...r),this.style({margin:0,padding:0}),Object.assign(this.cache,{lineBreak:s})}get isText(){return!0}get value(){return this.element.textContent}clear(){return this.element.childNodes.forEach((t=>t.remove())),this.element.textContent="",this}addValue(...t){return t.forEach(((t,e)=>{"string"==typeof t||"number"==typeof t?this.element?.appendChild(globalThis?.document.createTextNode(t)):t instanceof Ks?this.element?.appendChild(t.element):t instanceof i||t instanceof dr?this.element?.appendChild(new Text(t.toString())):t instanceof Array?this.element?.appendChild(new Text(or(t))):t instanceof Object&&this.element?.appendChild(new Text(nr(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 nn extends rn{constructor(...t){super("span","text",!1,...t)}}class on extends rn{constructor(...t){super("q","quote",!1,...t),this.style({fontStyle:"italic"})}get isQuote(){return!0}}class an extends rn{constructor(...t){super("dfn","dfnText",!1,...t)}get isDfnText(){return!0}}class hn extends rn{constructor(t){super("sup","supText",!1,t)}get isSupText(){return!0}}class ln extends rn{constructor(...t){super("sub","subText",!1,...t)}get isSubText(){return!0}}class cn extends rn{constructor(...t){super("code","codeText",!1,...t)}get isCodeText(){return!0}}class un extends rn{constructor(t,e){super("abbr","abbrText",!1,t),this.setAttr("title",e)}get isAbbrText(){return!0}}const dn=(...t)=>new nn(...t),pn=(...t)=>new on(...t),mn=(...t)=>new an(...t),gn=(...t)=>new hn(...t),fn=(...t)=>new ln(...t),bn=(...t)=>new cn(...t),yn=(t,e)=>new un(t,e);class wn extends rn{constructor(...t){super("p","p",!0,...t)}get isPara(){return!0}}class xn extends rn{constructor(t,e){super("blockquote","blockquote",!0,e),this.setAttr("cite",t)}get isBlockQuote(){return!0}}const vn=(...t)=>new wn(...t),Cn=(t,e)=>new xn(t,e);class Fn extends Ks{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 kn=(t="")=>new Fn(1,t),En=(t="")=>new Fn(2,t),An=(t="")=>new Fn(3,t),Dn=(t="")=>new Fn(4,t),Bn=(t="")=>new Fn(5,t),Tn=(t="")=>new Fn(6,t);class _n extends sn{constructor(t){super(t,"html")}}class In extends Ks{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 Ks?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 Mn extends Ks{constructor(){super("br","br")}get isBr(){return!0}}class Sn extends Ks{constructor(){super("hr","hr")}get isHr(){return!0}}class On extends sn{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 Ln=()=>new Mn,jn=()=>new Sn,Rn=(t=1)=>new Array(t).fill(new Mn),Pn=(t=1)=>new Array(t).fill(new Sn),zn=(t,...e)=>new On(t).append(...e),$n=(t,...e)=>new _n(t).append(...e),Nn=t=>new In(t);class Vn extends sn{constructor(t){super("li","li"),this.append(t)}get isLi(){return!0}}class Un extends sn{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]=dn(t[e])),t[e]instanceof Ks&&(s=new Vn(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 Ks&&this.element?.removeChild(t.parent.element),this.items=this.items.filter((e=>e!==t))};for(let s=0;s<t.length;s++)e(t[s]);for(let t=0;t<this.items.length;t++)Object.assign(this,{[[t]]:this.items[t]})}return this}insertAt(t,...e){if(t>=this.element.children.length)this.append(...e);else for(let s=0;s<e.length;s++){let r=null;["number","string"].includes(typeof e[s])&&(e[s]=dn(e[s])),e[s]instanceof Ks&&(r=new Vn(e[s])),this.element?.insertBefore(r.element,this.items[t].parent.element),this.items.splice(t,0,e[s][0])}return this}filterByTextContent(t,e=!1){return this.items.map((t=>t.parent.render())),this.items.filter((s=>{const r=s.element.textContent;return!(e?r===t:r.includes(t))})).map((t=>t.parent.render(!1))),this}sortByTextContent(t=1){return this.items.map((t=>t.parent.render(!1))),this.sortedItems=this.items.sort(((e,s)=>t*e.element.textContent.localeCompare(s.element.textContent))),this.append(...this.sortedItems),this}filterByClass(t){return this.items.map((t=>t.parent.render(!0))),this.items.filter((e=>!e.Classes.includes(t))).map((t=>t.parent.render(!1))),this}delete(t){return[...this.element.children].indexOf(t)}push(){}pop(){}unshift(){}shift(){}sort(){}filter(){}slice(){}}class Hn extends Un{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 Zn extends Un{constructor(...t){super("ul","ul"),this.append(...t)}get isUl(){return!0}}const Xn=(...t)=>new Hn(...t),Wn=(...t)=>new Zn(...t);class qn extends Ks{constructor(t,e,s="",r){super("input","input"),Object.assign(this.events,{input:null}),this.setValue(s),this.setAttr("type",t),this.setAttr("name",e),r&&this.linkDatalist(r)}get isInput(){return!0}setName(t){return this.setAttr("name",t),this}onInput(...t){return this.events.input||(this.events.input=Ve(this)),this.events.input.onInput(...t),this}onChange(...t){return this.events.input||(this.events.input=Ve(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 Yn=(t,e)=>{if(t instanceof Object){const{datalist:e,placeholder:s}=t;return t=t.value??"",new qn("text","input",t,e).setPlaceholder(s)}return new qn("text","input",t,e)};class Gn extends qn{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 Qn=(t,e,s)=>{if(t instanceof Object){const{value:e,max:s=10,step:r=1,placeholder:n=""}=t;return t=t?.min??0,new ZikoUIInputSlider(t,s,r).setValue(e).setPlaceholder(n)}return new Gn(t,e,s)};let Kn=class extends qn{constructor(t=0,e=0,s=10,r=1){super("range","inputSlider"),this.setMin(e).setMax(s).setValue(t).setStep(r)}get isInputSlider(){return!0}setMin(t){return this.element.min=t,this}setMax(t){return this.element.max=t,this}setStep(t){return this.element.step=t,this}};const Jn=(t,e,s,r)=>{if(t instanceof Object){const{min:e=0,max:s=10,step:r=1}=t;return new Kn(t=t?.value??5,e,s,r)}return new Kn(t,e,s,r)};class ti extends qn{constructor(){super("color","inputColor"),this.background(this.value),this.onInput((()=>this.background(this.value)))}get isInputColor(){return!0}}const ei=()=>new ti;class si extends qn{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 ri=(...t)=>(new si).connect(...t);class ni extends qn{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 ii=()=>new ni;class oi extends qn{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 ai=()=>new oi;class hi extends qn{constructor(){super("email","inputEmail")}get isInputEmail(){return!0}}const li=()=>new hi;class ci extends qn{constructor(){super("password","inputPassword")}get isInputPassword(){return!0}}const ui=()=>new ci;class di extends qn{constructor(){super("date","inputDate")}get isInputDate(){return!0}}const pi=()=>new di;class mi extends qn{constructor(){super("time","inputTime")}get isInputTime(){return!0}}const gi=()=>new mi;class fi extends qn{constructor(){super("datetime-local","inputDateTime")}get isInputDateTime(){return!0}}const bi=()=>new fi;class yi extends Ks{constructor(t="File"){super("inputImage"),this._aux_element=Nn(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 wi=t=>new yi(t);class xi extends Ks{constructor(t,e,s){super("img","image"),this.value=t,"IMG"===t.nodeName?this.element?.setAttribute("src",t.src):this.element?.setAttribute("src",t),"number"==typeof e&&(e+="%"),"number"==typeof s&&(s+="%"),this.style({border:"1px solid black",width:e,height:s})}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 vi=(t,e,s)=>new xi(t,e,s);class Ci extends Ks{constructor(t,e){super("figure","figure"),this.img=t.width("100%").element,this.caption=document?.createElementt("figcaption"),this.caption.append(e.element),this.element?.append(this.img),this.element?.append(this.caption)}get isFigure(){return!0}}const Fi=(t,e)=>new Ci(t,e);class ki extends Ks{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 Ei extends ki{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 Ai=(t,e,s)=>new Ei(t,e,s);class Di extends ki{constructor(t){super("audio","audio"),this.element?.setAttribute("src",t),this.size("150px","30px")}get isAudio(){return!0}}const Bi=t=>new Di(t);class Ti extends Ei{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 _i=()=>new Ti;class Ii extends Ks{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 Mi=class extends Ks{constructor(...t){super(),this.element=document?.createElement("datalist"),this.addOptions(...t).setId("ziko-datalist-id"+nt.string(10))}get isDatalist(){return!0}addOptions(...t){return t.map((t=>this.append(new Ii(t)))),this}};const Si=(...t)=>new Mi(...t);class Oi extends Ks{constructor(){super(),this.element=document?.createElement("select")}addOptions(...t){return t.map((t=>this.append(new Ii(t)))),this}get isSelect(){return!0}}const Li=()=>new Oi;class ji extends Ks{constructor(){super(),this.element=document?.createElement("textarea")}get value(){return this.element.textContent}get isTextArea(){return!0}}const Ri=()=>new ji;class Pi extends sn{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 $i.call(this,s),this.style({alignItems:"number"==typeof t?Vi.call(this,t):t,justifyContent:"number"==typeof e?Ui.call(this,e):e}),this}horizontal(t,e,s=1){return Ni.call(this,s),this.style({alignItems:"number"==typeof e?Ui.call(this,e):e,justifyContent:"number"==typeof t?Vi.call(this,t):t}),this}show(){return this.isHidden=!1,this.style({display:"flex"}),this}}const zi=(...t)=>{let e="div";return"string"==typeof t[0]&&(e=t[0],t.pop()),new Pi(e).append(...t)};function $i(t){return 1==t?this.style({flexDirection:"column"}):-1==t&&this.style({flexDirection:"column-reverse"}),this}function Ni(t){return 1==t?this.style({flexDirection:"row"}):-1==t&&this.style({flexDirection:"row-reverse"}),this}function Vi(t){return"number"==typeof t&&(t=["flex-start","center","flex-end"][t+1]),t}function Ui(t){return Vi(-t)}class Hi extends Pi{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 Zi=(...t)=>new Hi(...t);class Xi extends sn{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.#m(e),this}#m(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 Wi=(...t)=>new Xi("div").append(...t);class qi extends Ks{constructor(t,e,s="đ",r=s){super("details","Collapsible"),Object.assign(this.cache,{icons:{open:s,close:r}}),this.summary=$n("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"}),as(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 Yi=(t,e,s,r)=>new qi(t,e,s,r);class Gi extends sn{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 Qi=(...t)=>new Gi(...t);class Ki extends Pi{constructor(...t){super(),this.style({position:"relative",overflow:"hidden",touchAction:"none",userSelect:"none"}),this.horizontal("space-around",0),this.track=Section(...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 Ji=(...t)=>new Ki(...t);class to extends Pi{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(no(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 eo=()=>new to,so={background:"none",width:"25px",height:"25px",fontSize:"1.2rem",cursor:"pointer"};class ro extends Pi{constructor(t="",{type:e="js",order:s=null}={}){var r;super("section"),Object.assign(this.cache,{state:null,order:s,type:e,metadata:{created:Date.now(),updated:null}}),this.Input=((t="")=>$n("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=$n("output").style({width:"100%",height:"auto",padding:"5px 0"}),this.InOut=zi(this.Input,this.Output).vertical().style({width:"100%",margin:"10px auto"}),this.RightControl=(r=this,zi(dn("âļī¸").style(so).onClick((t=>{r.parent instanceof to&&r.parent.setCurrentNote(r),r.execute(),globalThis.__Ziko__.__Config__.default.target=t.target.parent.parent[1][1]})),dn("đ").style(so).onClick((()=>{navigator.clipboard.writeText(r.codeText)})),dn("âī¸").style(so).onClick((()=>r.remove())),dn("âī¸").style(so).onClick((()=>r.remove()))).style({width:"70px",height:"50px",margin:"10px 0"}).horizontal(0,0).wrap(!0)),this.LeftControl=zi(dn("[ ]")).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 n=this.Input.element.getElementsByClassName("cm-content")[0];n?n.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 to&&("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 to&&(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}#g(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 to&&(this.cache.parent.incrementOrder(),this.cache.parent.next()))}}#f(){}#b(){}evaluate(t){if(globalThis.__Ziko__.__Config__.default.target=this.Output.element,"js"===this.cache.type)this.#g(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 no=(t,{type:e,order:s}={})=>new ro(t,{type:e,order:s});class io extends Pi{#y=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=zi().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=zi().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.#y!==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.#y=t%this.contentContainer.length;const e=this.contentContainer.at(this.#y);return this.controllersContainer.forEach((t=>t.setAttr("tabindex",-1).setAttr("aria-selected",!1))),this.controllersContainer.at(this.#y).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.#y+t),this}previous(t=1){return this.display(this.#y-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 oo=(t,e)=>new io(t,e),ao={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 ho extends Pi{constructor(t,e,s){super(),this.title=An(e),this.icon=dn(ao[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(zi(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:ao[t].color,background:ao[t].bgColor,border:"1px darkblue solid",borderLeft:`15px ${ao[t].borderColor} solid`}),this.title.style({color:ao[t].titleColor}),this.content.st.color(ao[t].titleColor),this.icon.setValue(ao[t].icon).style({border:`2px ${ao[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 lo=(t,e)=>new ho("success",t,e),co=(t,e)=>new ho("info",t,e),uo=(t,e)=>new ho("warning",t,e),po=(t,e)=>new ho("danger",t,e);class mo extends Ks{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 Ks("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 go extends mo{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,r=100-s;s<0&&(s=0),r<0&&(r=0),this.leftPane.element.style.width=`${s}%`,this.rightPane.element.style.width=`${r}%`}))}get isHorizontalSplitter(){return!0}}const fo=(t,e)=>new go(t,e);class bo extends mo{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,r=100-s;s<0&&(s=0),r<0&&(r=0),this.topPane.element.style.height=`${s}%`,this.bottomPane.element.style.height=`${r}%`}))}get isHorizontalSplitter(){return!0}}const yo=(t,e)=>new bo(t,e);class wo extends Ks{constructor(...t){super("ul","Breadcrumbs"),Object.assign(this.cache,{separatorTextContent:"/"}),this.style({listStyle:"none",display:"flex",flexWrap:"wrap"}),this.list=$n("li").style({display:"flex",flexWrap:"wrap"}),this.append(...t)}#w(t){["string","number","boolean"].includes(typeof t)&&(t=dn(t));const e=$n("li",t).style({display:"flex",alignItems:"center"});if(this.element.children.length>0){const t=dn(this.cache.separatorTextContent).style({padding:"0 4px"});this.element?.append(t.element)}this.element?.append(e.element)}append(...t){return t.forEach((t=>this.#w(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 xo=(...t)=>new wo(...t);class vo extends Pi{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 Ks("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}#x(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.#x("left"),this}useRight(){return this.#x("right"),this}useTop(){return this.#x("top"),this}useBottom(){return this.#x("bottom"),this}}const Co=(t,e)=>new vo(t,e);globalThis.menu3d=Co;class Fo extends sn{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 ko=(...t)=>new Fo(...t);class Eo extends sn{constructor(){super("main","Main")}get isMain(){return!0}}class Ao extends sn{constructor(){super("header","Header")}get isHeader(){return!0}}class Do extends sn{constructor(){super("nav","Nav")}get isNav(){return!0}}class Bo extends sn{constructor(){super("section","Section"),this.style({position:"relative"})}get isSection(){return!0}}class To extends sn{constructor(){super("article","Article")}get isArticle(){return!0}}class _o extends sn{constructor(){super("aside","Aside")}get isAside(){return!0}}class Io extends sn{constructor(){super("footer","Footer"),this.element=document?.createElement("footer")}get isFooter(){return!0}}const Mo=(...t)=>(new Bo).append(...t),So=(...t)=>(new To).append(...t),Oo=(...t)=>(new Eo).append(...t),Lo=(...t)=>(new Ao).append(...t),jo=(...t)=>(new Io).append(...t),Ro=(...t)=>(new Do).append(...t),Po=(...t)=>(new _o).append(...t);class zo extends Ks{constructor(...t){super(),this.element=document?.createElement("Tr"),this.append(...t)}}class $o extends Ks{constructor(...t){super(),this.element=document?.createElement("Td"),this.append(...t)}}class No extends Ks{constructor(...t){super(),this.element=document?.createElement("Thead"),this.append(...t)}}class Vo extends Ks{constructor(...t){super(),this.element=document?.createElement("Tbody"),this.append(...t)}}class Uo extends Ks{constructor(t){super(),this.element=document?.createElement("Caption"),this.append(t)}}const Ho=(...t)=>(t=t.map((t=>(t instanceof Ks||(t=dn(t)),t))),new $o(...t)),Zo=t=>new Uo(t),Xo=t=>{var e=new Array(t.rows).fill(null).map((()=>((...t)=>new zo(...t))())),s=t.arr.map((t=>t.map((()=>null))));for(let r=0;r<s.length;r++)for(let n=0;n<s[0].length;n++)s[r][n]=Ho(t.arr[r][n]),e[r].append(s[r][n]);return e};class Wo extends Ks{constructor(t,{caption:e=null,head:s=null,foot:r=null}={}){super("table","Table"),this.structure={caption:e,head:s,body:null,foot:r},t&&this.fromMatrix(t),e&&this.setCaption(e)}get isTable(){return!0}get caption(){return this.structure.caption}get header(){}get body(){}get footer(){}setCaption(t){return this.removeCaption(),this.structure.caption=Zo(t),this.append(this.structure.caption),this}removeCaption(){return this.structure.caption&&this.removeItem(...this.items.filter((t=>t instanceof Uo))),this.structure.caption=null,this}setHeader(...t){return this.tHead=((...t)=>(t=t.map((t=>(t instanceof Ks||(t=Ho(t)),t))),new No(...UI)))(...t),this.append(this.tHead),this}removeHeader(){return this.removeItem(...this.items.filter((t=>t instanceof Uo))),this}setFooter(t){return this.structure.caption=Zo(t),this.append(this.structure.caption),this}removeFooter(){return this.removeItem(...this.items.filter((t=>t instanceof Uo))),this}fromMatrix(t){return this.bodyMatrix=t instanceof Array?pr(t):t,this.structure.body&&this.remove(this.structure.body),this.structure.body=((...t)=>new Vo(...t))(),this.append(this.structure.body),this.structure.body.append(...Xo(this.bodyMatrix)),this}transpose(){return this.fromMatrix(this.bodyMatrix.T),this}hstack(t){return t instanceof Wo&&(t=t.bodyMatrix),this.fromMatrix(this.bodyMatrix.clone.hstack(t)),this}vstack(t){return t instanceof Wo&&(t=t.bodyMatrix),this.fromMatrix(this.bodyMatrix.clone.vstack(t)),this}slice(t=0,e=0,s=this.bodyMatrix.rows-1,r=this.bodyMatrix.cols-1){return this.fromMatrix(this.bodyMatrix.slice(t,e,s,r)),this}sortByCols(t,e={type:"num",order:"asc"}){return this.fromMatrix(this.bodyMatrix.clone.sortTable(t,e)),this}sortByRows(t,e={type:"num",order:"asc"}){return this.fromMatrix(this.bodyMatrix.T.clone.sortTable(t,e).T),this}filterByRows(t){return this.fromMatrix(this.bodyMatrix.clone.filterByRows(t)),this}filterByCols(t){return this.fromMatrix(this.bodyMatrix.clone.filterByCols(t)),this}forEachRow(t){return this.structure.body.forEach(t),this}forEachItem(t){return this.structure.body.forEach((e=>e.forEach(t))),this}}const qo=(t,e)=>new Wo(t,e),Yo={html:$n,text:dn,quote:pn,dfnText:mn,supText:gn,subText:fn,codeText:bn,abbrText:yn,p:vn,blockQuote:Cn,h1:kn,h2:En,h3:An,h4:Dn,h5:Bn,h6:Tn,btn:Nn,br:Ln,hr:jn,brs:Rn,hrs:Pn,link:zn,ol:Xn,ul:Wn,Form:Zi,input:Yn,search:ri,slider:Jn,checkbox:ii,radio:ai,datalist:Si,inputNumber:Qn,inputColor:ei,inputDate:pi,inputDateTime:bi,inputEmail:li,inputImage:wi,inputPassword:ui,inputTime:gi,select:Li,textarea:Ri,inputCamera:_i,image:vi,video:Ai,audio:Bi,figure:Fi,Flex:zi,Carousel:Ji,Grid:Wi,Header:Lo,Main:Oo,Section:Mo,Article:So,Aside:Po,Nav:Ro,Footer:jo,Table:qo,CodeCell:no,CodeNote:eo,Tabs:oo,Collapsible:Yi,Accordion:Qi,Modal:ko,hSplitter:fo,vSplitter:yo,Breadcrumbs:xo,successAlert:lo,infoAlert:co,warningAlert:uo,dangerAlert:po,ExtractAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"ExtractAll"!==s&&"RemoveAll"!==s&&(globalThis[s]=this[s])}return this},RemoveAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"RemoveAll"!==s&&delete globalThis[s]}return this}};class Go extends Ks{constructor(t=360,e=300){super("svg","svg"),this.setAttr("width",t),this.setAttr("height",e),this.style({border:"1px black solid"}),this.view(-10,-10,10,10)}view(t,e,s,r){let n=Math.abs(s-t),i=Math.abs(r-e);return this.setAttr("viewBox",[t,e,n,i].join(" ")),this.st.scaleY(-1),this}add(...t){for(let e=0;e<t.length;e++)this.element?.appendChildddddddd(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 Qo=(t,e)=>new Go(t,e);class Ko{constructor(t){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 Jo extends Ko{constructor(t,e,s,r,n=!0){super(),this.element=document?.createElementNS("http://www.w3.org/2000/svg","rect"),this.setX(t).setY(e).width(s).height(r),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 ta=(t,e,s,r,n)=>new Jo(t,e,s,r,n);class ea extends Ko{constructor(t,e,s){super("circle"),this.element=document?.createElementttNS("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 sa=(t,e,s)=>new ea(t,e,s);class ra extends Ko{constructor(t,e,s,r){super("ellipse"),this.element=document?.createElementNS("http://www.w3.org/2000/svg","ellipse"),this.pos(t,e).setRx(s).setRy(r)}setRx(t){return this.element.rx.baseVal.value=t,this}setRy(t){return this.element.ry.baseVal.value=t,this}}const na=(t,e,s,r)=>new ra(t,e,s,r);class ia extends Ko{constructor(t,e,s,r){super(),this.element=document?.createElementtNS("http://www.w3.org/2000/svg","line"),this.x1(t).y1(e).x2(s).y2(r).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 oa=(t,e,s,r)=>new ia(t,e,s,r);class aa extends Ko{}class ha extends Ko{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,r,n,i){return this.path+=`C ${t} ${e},${s} ${r},${n} ${i} `,this.setPath(),this}quadratic(t,e,s,r){return this.path+=`Q ${t} ${e} ${s} ${r} `,this.setPath(),this}close(){return this.path+="Z",this.setPath(),this}}const la=()=>new ha;class ca extends Ko{constructor(t=[],e=[]){super(),this.X=t,this.Y=e,this.element=document?.createElementtNS("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 r=this.element.parentElement.createSVGPoint();r.x=t[s],r.y=e[s],this.element.oints.appendItem(r)}return this}}const ua=(t,e)=>new ca(t,e);class da extends Ko{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 pa=(t,e,s)=>new da(t,e,s);class ma extends Ko{constructor(t="",e="100%",s="100%",r=0,n=0){super(),this.element=document?.createElementNS("http://www.w3.org/2000/svg","image"),this.setSrc(t).width(e).height(s).x(r).y(n)}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 ga=(t,e,s,r,n)=>new ma(t,e,s,r,n);class fa extends Ko{constructor(t=0,e=0,s="100%",r="100%",...n){super("foreignObject"),this.items=[],this.element=document?.createElementtNS("http://www.w3.org/2000/svg","foreignObject"),this.container=zi().setTarget(this.element).vertical(0,0).size("auto","auto"),this.container.st.scaleY(-1),this.posX(t).posY(e).width(s).height(r)}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 ba=(t,e,s)=>new fa(t,e,s);class ya extends Ko{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 wa=(...t)=>new ya(...t);class xa extends Ko{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 va=(t,...e)=>new xa(t,...e),Ca=(t,e,s=10,r=10)=>{let n=la().fill("none").stroke("coral").strokeWidth(.6);console.log({x:t/s,y:e/r});for(let e=0;e<t;e++)n.moveTo(0,e*t/s).hr(t);for(let t=0;t<e;t++)n.moveTo(t*e/r,0).vr(e);return n};class Fa extends sn{constructor(t,e){super("canvas","canvas"),this.ctx=this.element?.getContext("2d"),this.style({border:"1px red solid"}),this.transformMatrix=new dr([[1,0,0],[0,1,0],[0,0,1]]),this.axisMatrix=new dr([[-10,-10],[10,10]]),setTimeout((()=>this.resize(t,e)),0),this.on("sizeupdated",(()=>this.adjust()))}get Width(){return this.element?.width}get Height(){return this.element?.height}get Xmin(){return this.axisMatrix[0][0]}get Ymin(){return this.axisMatrix[0][1]}get Xmax(){return this.axisMatrix[1][0]}get Ymax(){return this.axisMatrix[1][1]}get ImageData(){return this.ctx.getImageData(0,0,c.Width,c.Height)}draw(t=!0){return t?(this.clear(),this.items.forEach((t=>{t.parent=this,t.draw(this.ctx)}))):(this.items.at(-1).parent=this,this.items.at(-1).draw(this.ctx)),this.maintain(),this}applyTransformMatrix(){return this.ctx.setTransform(this.transformMatrix[0][0],this.transformMatrix[1][0],this.transformMatrix[0][1],this.transformMatrix[1][1],this.transformMatrix[0][2],this.transformMatrix[1][2]),this}resize(t,e){return this.size(t,e),this.lineWidth(),this.view(this.axisMatrix[0][0],this.axisMatrix[0][1],this.axisMatrix[1][0],this.axisMatrix[1][1]),this.emit("sizeupdated"),this}adjust(){return this.element.width=this.element?.getBoundingClientRect().width,this.element.height=this.element?.getBoundingClientRect().height,this.view(this.axisMatrix[0][0],this.axisMatrix[0][1],this.axisMatrix[1][0],this.axisMatrix[1][1]),this}view(t,e,s,r){return this.transformMatrix[0][0]=this.Width/(s-t),this.transformMatrix[1][1]=-this.Height/(r-e),this.transformMatrix[0][2]=this.Width/2,this.transformMatrix[1][2]=this.Height/2,this.axisMatrix=new dr([[t,e],[s,r]]),this.applyTransformMatrix(),this.clear(),this.lineWidth(1),this.draw(),this}reset(){return this.ctx.setTransform(1,0,0,0,0,0),this}append(t){return this.items.push(t),this.draw(!1),this}background(t){this.ctx.fillStyle=t,this.ctx.setTransform(1,0,0,1,0,0),this.ctx.fillRect(0,0,this.Width,this.Height),this.applyTransformMatrix(),this.draw()}lineWidth(t){return this.ctx.lineWidth=t/this.transformMatrix[0][0],this}ImageData(t=0,e=0,s=this.Width,r=this.Height){return this.ctx.getImageData(t,e,s,r)}clear(){return this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.Width,this.Height),this.applyTransformMatrix(),this}clone(){console.log(this.Width);const t=new Fa;return t.items=this.items,t.transformMatrix=this.transformMatrix,t.axisMatrix=this.axisMatrix,Object.assign(t.cache,{...this.cache}),this.size(element.style.width,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 ka=(t,e)=>new Fa(t,e);class Ea{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 Aa extends Ea{constructor(t,e,s,r){super(t,e),this.r=s,this.angle=r,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 Da=(t,e,s,r)=>new Aa(t,e,s,r),Ba=(t,e,s)=>new Aa(t,e,s,2*Math.PI);class Ta extends Ea{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=pr([t,e]),this}push(t,e){return this.pointsMatrix.hstack(pr([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 _a=(t=[],e=[])=>new Ta(t,e);class Ia extends Ea{constructor(t,e,s,r){super(),this.x0=t,this.x1=s,this.y0=e,this.y1=r,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 Ma=(t,e,s,r)=>new Ia(t,e,s,r);class Sa extends Ea{constructor(t,e,s,r){super(t,e),this.w=s,this.h=r,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 Oa=(t,e,s,r)=>new Sa(t,e,s,r),La={Svg:Qo,ZikoUISvg:Go,svgCircle:sa,svgEllipse:na,svgImage:ga,svgLine:oa,svgPolygon:ua,svgRect:ta,svgText:pa,svgGroupe:wa,svgLink:va,svgGrid:Ca,svgObject:ba,svgPath:la,Canvas:ka,canvasArc:Da,canvasCircle:Ba,canvasPoints:_a,canvasLine:Ma,canvasRect:Oa,ExtractAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"ExtractAll"!==s&&"RemoveAll"!==s&&(globalThis[s]=this[s])}return this},RemoveAll:function(){const t=Object.keys(this);for(let e=0;e<t.length;e++){const s=t[e];"RemoveAll"!==s&&delete globalThis[s]}return this}};class ja{constructor(t,e){this.root_UI=t,this.routes=new Map([[404,dn("Error 404")],...Object.entries(e)]),this.patterns=new Map,this.maintain(),window.onpopstate=this.render(location.pathname)}get(t,e){if("string"==typeof t&&t.includes(":")){const s=new RegExp(`^${t.replace(/:([^/]+)/g,((t,e)=>"(.+)"))}$`);this.patterns.set(s,(t=>{const r=s.exec(t).slice(1);e(...r)}))}else t instanceof RegExp?this.patterns.set(t,e):this.routes.set(t,e);return this.maintain(),this}maintain(){return this.root_UI.append(...this.routes.values()),[...this.routes.values()].map((t=>t.render(!1))),this.render(location.pathname),this}render(t){if(this.routes.get(t))this.routes.get(t).render(!0);else{const e=[...this.patterns.keys()].find((e=>e.test(t)));e?this.patterns.get(e)(t):this.routes.get(404).render(!0)}return window.history.pushState({},"",t),this}}const Ra=(t,e,s)=>new ja(t,e,s),Pa={},za={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")};class $a{constructor(t){this.app=t,this.meta={},this.#v("generator","zikojs")}#v(t,e){const s=document.querySelector(`meta[name=${t}]`);return this.meta=s||document?.createElement("meta"),this.meta.setAttribute("name",t),this.meta.setAttribute("content",e),s||this.app.head.append(this.meta),this}charset(t="utf-8"){const e=document.querySelector("meta[charset]");return this.meta=e||document?.createElementt("meta"),this.meta.setAttribute("charset",t),e||this.app.head.append(this.meta),this}description(t){return this.#v("description",t),this}viewport(t="width=device-width, initial-scale=1.0"){return this.#v("viewport",t),this}keywords(...t){return t.push("zikojs"),t=[...new Set(t)].join(", "),this.#v("keywords",t),this}author(t="",e=""){const s=[t,e].join(", ");return this.#v("author",s),this}}class Na extends Pi{constructor(){super("main"),this.root=document.documentElement,this.head=null,this.#n(),this.seo=new $a(this),Object.assign(this.events,{hash:null}),Object.assign(this.cache,{theme:null,isRoot:!0})}#n(){this.root.setAttribute("data-engine","zikojs");const t=this.root.getElementsByTagName("head")[0];this.head=t||(this.head=document?.createElementtt("head")),t||this.root.insertBefore(this.head,document?.body);const e=this.head.getElementsByTagName("title")[0];this.Title=e||document?.createElementt("title"),e||this.head.append(this.Title)}title(t=this.title.textContent){return this.Title.textContent=t,this}prefetch(){}description(){}onHashChange(...t){return this.events.hash||(this.events.hash=Ze(this)),this.events.hash.onChange(...t),this}}const Va=(...t)=>(new Na).append(...t),Ua={App:Va,Math:en,UI:Yo,Time:Xs,Graphics:La,Reactivity:Qs,Data:ur,SPA:Ra};function Ha(){return Yo.ExtractAll(),en.ExtractAll(),Xs.ExtractAll(),Qs.ExtractAll(),La.ExtractAll(),ur.ExtractAll(),this}function Za(){Yo.RemoveAll(),en.RemoveAll(),Xs.RemoveAll(),Qs.RemoveAll(),La.RemoveAll(),ur.RemoveAll()}globalThis.__Ziko__={...Ua,__UI__:Pa,__Config__:za,ExtractAll:Ha,RemoveAll:Za},globalThis?.document&&document?.addEventListener("DOMContentLoaded",__Ziko__.__Config__.init()),t.Accordion=Qi,t.App=Va,t.Article=So,t.Aside=Po,t.Base=J,t.Breadcrumbs=xo,t.Canvas=ka,t.Carousel=Ji,t.CodeCell=no,t.CodeNote=eo,t.Collapsible=Yi,t.Combinaison=st,t.Complex=i,t.DarkThemes=ds,t.Data=ur,t.E=s,t.EPSILON=r,t.Ease=js,t.ExtractAll=Ha,t.Fixed=b,t.Flex=zi,t.Footer=jo,t.Form=Zi,t.Graphics=La,t.Grid=Wi,t.Header=Lo,t.LightThemes=us,t.LinearSystem=br,t.Logic=tt,t.Main=Oo,t.Math=en,t.Matrix=dr,t.Modal=ko,t.Nav=Ro,t.PI=e,t.Permutation=et,t.Random=nt,t.Reactivity=Qs,t.RemoveAll=Za,t.SPA=Ra,t.Section=Mo,t.Signal=tn,t.Str=lr,t.Svg=Qo,t.Table=qo,t.Tabs=oo,t.Themes=ps,t.Time=Xs,t.UI=Yo,t.Utils=Wr,t.ZikoUIAbbrText=un,t.ZikoUIAccordion=Gi,t.ZikoUIArticle=To,t.ZikoUIAside=_o,t.ZikoUIAudio=Di,t.ZikoUIBlockQuote=xn,t.ZikoUIBr=Mn,t.ZikoUIBreadcrumbs=wo,t.ZikoUICanvas=Fa,t.ZikoUICodeNote=to,t.ZikoUICodeText=cn,t.ZikoUIDefintion=an,t.ZikoUIElement=Ks,t.ZikoUIFigure=Ci,t.ZikoUIFlex=Pi,t.ZikoUIFooter=Io,t.ZikoUIForm=Hi,t.ZikoUIGrid=Xi,t.ZikoUIHeader=Ao,t.ZikoUIHeading=Fn,t.ZikoUIHorizontalSplitter=go,t.ZikoUIHr=Sn,t.ZikoUIHtmlTag=_n,t.ZikoUIImage=xi,t.ZikoUIInput=qn,t.ZikoUIInputCheckbox=ni,t.ZikoUIInputColor=ti,t.ZikoUIInputDatalist=Mi,t.ZikoUIInputDate=di,t.ZikoUIInputDateTime=fi,t.ZikoUIInputEmail=hi,t.ZikoUIInputImage=yi,t.ZikoUIInputNumber=Gn,t.ZikoUIInputOption=Ii,t.ZikoUIInputPassword=ci,t.ZikoUIInputRadio=oi,t.ZikoUIInputSearch=si,t.ZikoUIInputSlider=Kn,t.ZikoUIInputTime=mi,t.ZikoUILabel=class extends Ks{constructor(){super(),this.element=document?.createElement("label")}get isLabel(){return!0}},t.ZikoUILink=On,t.ZikoUIMain=Eo,t.ZikoUIMenu3d=vo,t.ZikoUIModal=Fo,t.ZikoUINav=Do,t.ZikoUIParagraphe=wn,t.ZikoUIQuote=on,t.ZikoUISection=Bo,t.ZikoUISelect=Oi,t.ZikoUISubText=ln,t.ZikoUISupText=hn,t.ZikoUISvg=Go,t.ZikoUIText=nn,t.ZikoUITextArea=ji,t.ZikoUIVerticalSplitter=bo,t.ZikoUIVideo=Ei,t.__Config__=za,t.__UI__=Pa,t.abbrText=yn,t.abs=y,t.accum=p,t.acos=I,t.acosh=$,t.acot=O,t.add=kr,t.adoc2html=Ct,t.arange=jr,t.arr2str=or,t.asin=M,t.asinh=N,t.atan=S,t.atan2=X,t.atanh=V,t.audio=Bi,t.bessel=(t,e)=>{if("number"==typeof t){if("number"==typeof t)return g(t,e);console.warn("Not supported yet")}else if(t instanceof Array){if("number"==typeof e)return yr((t=>g(t,e)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(yr((e=>g(t[r],e)),...e));return s}}},t.beta=(t,e)=>{if("number"==typeof t){if("number"==typeof t)return f(t,e);console.warn("Not supported yet")}else if(t instanceof Array){if("number"==typeof e)return yr((t=>f(t,e)),...t);if(e instanceof Array){const s=[];for(let r=0;r<t.length;r++)s.push(yr((e=>f(t[r],e)),...e));return s}}},t.blockQuote=Cn,t.br=Ln,t.brs=Rn,t.btn=Nn,t.canvasArc=Da,t.canvasCircle=Ba,t.canvasLine=Ma,t.canvasPoints=_a,t.canvasRect=Oa,t.cartesianProduct=Hr,t.ceil=U,t.checkbox=ii,t.choleskyDecomposition=ct,t.clamp=Lr,t.codeText=bn,t.complex=o,t.cos=k,t.cosh=L,t.cot=_,t.coth=P,t.count=(t,e)=>t.split("").filter((t=>t==e)).length,t.countWords=(t,e)=>t.split(" ").filter((t=>t==e)).length,t.csc=T,t.csv2arr=Ft,t.csv2json=At,t.csv2matrix=kt,t.csv2object=Et,t.csv2sql=Dt,t.dangerAlert=po,t.datalist=Si,t.default=Ua,t.deg2rad=$r,t.dfnText=mn,t.div=Dr,t.e=C,t.fact=W,t.figure=Fi,t.floor=H,t.gamma=(...t)=>yr(m,...t),t.geomspace=zr,t.h1=kn,t.h2=En,t.h3=An,t.h4=Dn,t.h5=Bn,t.h6=Tn,t.hSplitter=fo,t.hr=jn,t.hrs=Pn,t.html=$n,t.hypot=G,t.image=vi,t.inRange=Vr,t.infoAlert=co,t.input=Yn,t.inputCamera=_i,t.inputColor=ei,t.inputDate=pi,t.inputDateTime=bi,t.inputEmail=li,t.inputImage=wi,t.inputNumber=Qn,t.inputPassword=ui,t.inputTime=gi,t.isApproximatlyEqual=Ur,t.json2arr=_t,t.json2csv=It,t.json2csvFile=Mt,t.json2xml=Rt,t.json2xmlFile=Pt,t.json2yml=Lt,t.json2ymlFile=jt,t.lerp=Sr,t.li=t=>new Vn(t),t.link=zn,t.linspace=Rr,t.ln=F,t.logspace=Pr,t.luDecomposition=it,t.map=Or,t.mapfun=yr,t.markdown2html=gt,t.matrix=pr,t.matrix2=mr,t.matrix3=gr,t.matrix4=fr,t.max=u,t.menu3d=Co,t.min=l,t.modulo=Br,t.mul=Ar,t.norm=Mr,t.nums=Ir,t.obj2str=nr,t.ol=Xn,t.ones=_r,t.p=vn,t.pgcd=Zr,t.pow=x,t.powerSet=Q,t.ppcm=Xr,t.prod=h,t.qrDecomposition=lt,t.quote=pn,t.rad2deg=Nr,t.radio=ai,t.removeExtraSpace=t=>t.replace(/\s+/g," "),t.round=Z,t.search=ri,t.sec=D,t.select=Li,t.sig=Y,t.sign=q,t.sin=E,t.sinc=B,t.sinh=j,t.slider=Jn,t.sqrt=w,t.sqrtn=v,t.str=cr,t.sub=Er,t.subSet=K,t.subText=fn,t.successAlert=lo,t.sum=a,t.supText=gn,t.svg2ascii=er,t.svg2img=rr,t.svg2imgUrl=sr,t.svg2str=tr,t.svgCircle=sa,t.svgEllipse=na,t.svgGrid=Ca,t.svgGroupe=wa,t.svgImage=ga,t.svgLine=oa,t.svgLink=va,t.svgObject=ba,t.svgPath=la,t.svgPolyLine=(t,e)=>new aa(t,e),t.svgPolygon=ua,t.svgRect=ta,t.svgText=pa,t.tan=A,t.tanh=R,t.text=dn,t.textarea=Ri,t.timeTaken=Us,t.time_memory_Taken=zs,t.ul=Wn,t.useAnimation=Zs,t.useBattery=Is,t.useBluetooth=Ts,t.useChannel=Es,t.useClickEvent=Be,t.useClipboardEvent=Oe,t.useCustomEvent=qe,t.useDebounce=Rs,t.useDragEvent=Fe,t.useDropEvent=ke,t.useEventEmitter=bs,t.useFavIcon=vs,t.useFocusEvent=Pe,t.useGeolocation=Ss,t.useHashEvent=Ze,t.useInputEvent=Ve,t.useKeyEvent=fe,t.useLocaleStorage=qs,t.useMediaQuery=Fs,t.useMouseEvent=he,t.usePointerEvent=Jt,t.useSessionStorage=Ys,t.useStyle=$t,t.useSuccesifKeys=Gs,t.useSwipeEvent=Qe,t.useTheme=gs,t.useThread=Ds,t.useThrottle=Ps,t.useTimeLoop=Ls,t.useTitle=ws,t.useWheelEvent=ue,t.vSplitter=yo,t.video=Ai,t.wait=Vs,t.waitForUIElm=$s,t.waitForUIElmSync=Ns,t.warningAlert=uo,t.watchAttr=as,t.watchChildren=ls,t.watchIntersection=ts,t.watchScreen=is,t.watchSize=rs,t.zeros=Tr,Object.defineProperty(t,"__esModule",{value:!0})}));
|