tiny-essentials 1.17.0 → 1.17.1

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.
@@ -470,6 +470,19 @@ const {
470
470
  areElsCollRight: TinyHtml_areElsCollRight,
471
471
  } = collision_namespaceObject;
472
472
 
473
+ /**
474
+ * Callback invoked on each animation frame with the current scroll position,
475
+ * normalized animation time (`0` to `1`), and a completion flag.
476
+ *
477
+ * @typedef {(progress: { x: number, y: number, isComplete: boolean, time: number }) => void} OnScrollAnimation
478
+ */
479
+
480
+ /**
481
+ * A list of supported easing function names for smooth animations.
482
+ *
483
+ * @typedef {'linear' | 'easeInQuad' | 'easeOutQuad' | 'easeInOutQuad' | 'easeInCubic' | 'easeOutCubic' | 'easeInOutCubic'} Easings
484
+ */
485
+
473
486
  /**
474
487
  * Represents a raw Node element or an instance of TinyHtml.
475
488
  * This type is used to abstract interactions with both plain elements
@@ -2878,7 +2891,7 @@ class TinyHtml {
2878
2891
  */
2879
2892
  static setWinScrollTop(value) {
2880
2893
  if (typeof value !== 'number') throw new TypeError('The value must be a number.');
2881
- window.scrollTo({ top: value });
2894
+ TinyHtml.setScrollTop(window, value);
2882
2895
  }
2883
2896
 
2884
2897
  /**
@@ -2887,7 +2900,7 @@ class TinyHtml {
2887
2900
  */
2888
2901
  static setWinScrollLeft(value) {
2889
2902
  if (typeof value !== 'number') throw new TypeError('The value must be a number.');
2890
- window.scrollTo({ left: value });
2903
+ TinyHtml.setScrollLeft(window, value);
2891
2904
  }
2892
2905
 
2893
2906
  /**
@@ -3204,6 +3217,30 @@ class TinyHtml {
3204
3217
 
3205
3218
  //////////////////////////////////////////////////
3206
3219
 
3220
+ /**
3221
+ * Applies an animation to one or multiple TinyElement instances.
3222
+ *
3223
+ * @param {TinyElement|TinyElement[]} el - A single TinyElement or an array of TinyElements to animate.
3224
+ * @param {Keyframe[] | PropertyIndexedKeyframes | null} keyframes - The keyframes used to define the animation.
3225
+ * @param {number | KeyframeAnimationOptions} [ops] - Timing or configuration options for the animation.
3226
+ * @returns {TinyElement|TinyElement[]}
3227
+ */
3228
+ static animate(el, keyframes, ops) {
3229
+ TinyHtml._preElems(el, 'animate').forEach((elem) => elem.animate(keyframes, ops));
3230
+ return el;
3231
+ }
3232
+
3233
+ /**
3234
+ * Applies an animation to one or multiple TinyElement instances.
3235
+ *
3236
+ * @param {Keyframe[] | PropertyIndexedKeyframes | null} keyframes - The keyframes used to define the animation.
3237
+ * @param {number | KeyframeAnimationOptions} [ops] - Timing or configuration options for the animation.
3238
+ * @returns {TinyElement|TinyElement[]}
3239
+ */
3240
+ animate(keyframes, ops) {
3241
+ return TinyHtml.animate(this, keyframes, ops);
3242
+ }
3243
+
3207
3244
  /**
3208
3245
  * Gets the offset of the element relative to the document.
3209
3246
  * @param {TinyElement} el - Target element.
@@ -3359,26 +3396,147 @@ class TinyHtml {
3359
3396
  }
3360
3397
 
3361
3398
  /**
3362
- * Sets the vertical scroll position.
3363
- * @param {TinyElementAndWindow|TinyElementAndWindow[]} el - Element or window.
3364
- * @param {number} value - Scroll top value.
3365
- * @returns {TinyElementAndWindow|TinyElementAndWindow[]}
3399
+ * Collection of easing functions used for scroll and animation calculations.
3400
+ * Each function receives a normalized time value (`t` from 0 to 1) and returns the eased progress.
3401
+ *
3402
+ * @type {Record<string, (t: number) => number>}
3366
3403
  */
3367
- static setScrollTop(el, value) {
3368
- if (typeof value !== 'number') throw new TypeError('ScrollTop value must be a number.');
3369
- TinyHtml._preElemsAndWindow(el, 'setScrollTop').forEach((elem) => {
3370
- if (TinyHtml.isWindow(elem)) {
3371
- elem.scrollTo(elem.pageXOffset, value);
3404
+ static easings = {
3405
+ linear: (t) => t,
3406
+ easeInQuad: (t) => t * t,
3407
+ easeOutQuad: (t) => t * (2 - t),
3408
+ easeInOutQuad: (t) => (t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t),
3409
+ easeInCubic: (t) => t * t * t,
3410
+ easeOutCubic: (t) => --t * t * t + 1,
3411
+ easeInOutCubic: (t) => (t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1),
3412
+ };
3413
+
3414
+ /**
3415
+ * Smoothly scrolls one or more elements (or the window) to the specified X and Y coordinates
3416
+ * using a custom duration and easing function.
3417
+ *
3418
+ * If `duration` or a valid `easing` is not provided, the scroll will be performed immediately.
3419
+ *
3420
+ * @param {TinyElementAndWindow | TinyElementAndWindow[]} el - A single element, array of elements, or the window to scroll.
3421
+ * @param {Object} [settings={}] - Configuration object for the scroll animation.
3422
+ * @param {number} [settings.targetX] - The horizontal scroll target in pixels.
3423
+ * @param {number} [settings.targetY] - The vertical scroll target in pixels.
3424
+ * @param {number} [settings.duration] - The duration of the animation in milliseconds.
3425
+ * @param {Easings} [settings.easing] - The easing function name to use for the scroll animation.
3426
+ * @param {OnScrollAnimation} [settings.onAnimation] - Optional callback invoked on each animation
3427
+ * frame with the current scroll position, normalized animation time (`0` to `1`), and a completion flag.
3428
+ * @returns {TinyElementAndWindow|TinyElementAndWindow[]}
3429
+ * @throws {TypeError} If `el` is not a valid element, array, or window.
3430
+ * @throws {TypeError} If `targetX` or `targetY` is defined but not a number.
3431
+ * @throws {TypeError} If `duration` is defined but not a number.
3432
+ * @throws {TypeError} If `easing` is defined but not a valid easing function name.
3433
+ * @throws {TypeError} If `onAnimation` is defined but not a function.
3434
+ */
3435
+ static scrollToXY(el, { targetX, targetY, duration, easing, onAnimation } = {}) {
3436
+ if (targetX !== undefined && typeof targetX !== 'number')
3437
+ throw new TypeError('`targetX` must be a number if provided.');
3438
+ if (targetY !== undefined && typeof targetY !== 'number')
3439
+ throw new TypeError('`targetY` must be a number if provided.');
3440
+ if (duration !== undefined && typeof duration !== 'number')
3441
+ throw new TypeError('`duration` must be a number if provided.');
3442
+ if (easing !== undefined && typeof easing !== 'string')
3443
+ throw new TypeError('`easing` must be a string if provided.');
3444
+ if (easing !== undefined && typeof TinyHtml.easings[easing] !== 'function')
3445
+ throw new TypeError(`Unknown easing function: "${easing}".`);
3446
+ if (onAnimation !== undefined && typeof onAnimation !== 'function')
3447
+ throw new TypeError('`onAnimation` must be a function if provided.');
3448
+
3449
+ /**
3450
+ * Performs an instant scroll to the given coordinates.
3451
+ *
3452
+ * @param {ElementAndWindow} elem - The element or window to scroll.
3453
+ * @param {number} newX - The final horizontal scroll position.
3454
+ * @param {number} newY - The final vertical scroll position.
3455
+ * @param {number} time - Normalized progress value.
3456
+ */
3457
+ const executeScroll = (elem, newX, newY, time) => {
3458
+ if (elem instanceof Window) {
3459
+ window.scrollTo(newX, newY);
3372
3460
  } else if (elem.nodeType === 9) {
3373
3461
  // @ts-ignore
3374
- elem.defaultView.scrollTo(elem.defaultView.pageXOffset, value);
3462
+ elem.defaultView.scrollTo(newX, newY);
3375
3463
  } else {
3376
- elem.scrollTop = value;
3464
+ const startX = elem instanceof Window ? window.scrollX : elem.scrollLeft;
3465
+ const startY = elem instanceof Window ? window.scrollY : elem.scrollTop;
3466
+ if (startX !== newX) elem.scrollLeft = newX;
3467
+ if (startY !== newY) elem.scrollTop = newY;
3468
+ }
3469
+ if (typeof onAnimation === 'function')
3470
+ onAnimation({ x: newX, y: newY, isComplete: time >= 1, time });
3471
+ };
3472
+
3473
+ TinyHtml._preElemsAndWindow(el, 'scrollToXY').forEach((elem) => {
3474
+ const startX = elem instanceof Window ? window.scrollX : elem.scrollLeft;
3475
+ const startY = elem instanceof Window ? window.scrollY : elem.scrollTop;
3476
+ const targX = targetX ?? startX;
3477
+ const targY = targetY ?? startY;
3478
+
3479
+ const changeX = targX - startX;
3480
+ const changeY = targY - startY;
3481
+
3482
+ const ease = (typeof easing === 'string' && TinyHtml.easings[easing]) || null;
3483
+ if (typeof duration !== 'number' || typeof ease !== 'function')
3484
+ return executeScroll(elem, targX, targY, 1);
3485
+ const startTime = performance.now();
3486
+ const dur = duration ?? 0;
3487
+
3488
+ /**
3489
+ * Animates the scroll position based on easing and time.
3490
+ *
3491
+ * @param {number} currentTime - Timestamp provided by requestAnimationFrame.
3492
+ */
3493
+ function animateScroll(currentTime) {
3494
+ if (typeof ease !== 'function') return;
3495
+ const time = Math.min(1, (currentTime - startTime) / dur);
3496
+ const easedTime = ease(time);
3497
+
3498
+ const newX = startX + changeX * easedTime;
3499
+ const newY = startY + changeY * easedTime;
3500
+ executeScroll(elem, newX, newY, time);
3501
+
3502
+ if (time < 1) requestAnimationFrame(animateScroll);
3377
3503
  }
3504
+
3505
+ requestAnimationFrame(animateScroll);
3378
3506
  });
3379
3507
  return el;
3380
3508
  }
3381
3509
 
3510
+ /**
3511
+ * Smoothly scrolls one or more elements (or the window) to the specified X and Y coordinates
3512
+ * using a custom duration and easing function.
3513
+ *
3514
+ * If `duration` or a valid `easing` is not provided, the scroll will be performed immediately.
3515
+ *
3516
+ * @param {Object} [settings={}] - Configuration object for the scroll animation.
3517
+ * @param {number} [settings.targetX] - The horizontal scroll target in pixels.
3518
+ * @param {number} [settings.targetY] - The vertical scroll target in pixels.
3519
+ * @param {number} [settings.duration] - The duration of the animation in milliseconds.
3520
+ * @param {Easings} [settings.easing] - The easing function name to use for the scroll animation.
3521
+ * @param {OnScrollAnimation} [settings.onAnimation] - Optional callback invoked on each animation
3522
+ * frame with the current scroll position, normalized animation time (`0` to `1`), and a completion flag.
3523
+ * @returns {TinyElementAndWindow|TinyElementAndWindow[]}
3524
+ */
3525
+ scrollToXY({ targetX, targetY, duration, easing, onAnimation } = {}) {
3526
+ return TinyHtml.scrollToXY(this, { targetX, targetY, duration, easing, onAnimation });
3527
+ }
3528
+
3529
+ /**
3530
+ * Sets the vertical scroll position.
3531
+ * @param {TinyElementAndWindow|TinyElementAndWindow[]} el - Element or window.
3532
+ * @param {number} value - Scroll top value.
3533
+ * @returns {TinyElementAndWindow|TinyElementAndWindow[]}
3534
+ */
3535
+ static setScrollTop(el, value) {
3536
+ if (typeof value !== 'number') throw new TypeError('ScrollTop value must be a number.');
3537
+ return TinyHtml.scrollToXY(el, { targetY: value });
3538
+ }
3539
+
3382
3540
  /**
3383
3541
  * Sets the vertical scroll position.
3384
3542
  * @param {number} value - Scroll top value.
@@ -3396,17 +3554,7 @@ class TinyHtml {
3396
3554
  */
3397
3555
  static setScrollLeft(el, value) {
3398
3556
  if (typeof value !== 'number') throw new TypeError('ScrollLeft value must be a number.');
3399
- TinyHtml._preElemsAndWindow(el, 'setScrollLeft').forEach((elem) => {
3400
- if (TinyHtml.isWindow(elem)) {
3401
- elem.scrollTo(value, elem.pageYOffset);
3402
- } else if (elem.nodeType === 9) {
3403
- // @ts-ignore
3404
- elem.defaultView.scrollTo(value, elem.defaultView.pageYOffset);
3405
- } else {
3406
- elem.scrollLeft = value;
3407
- }
3408
- });
3409
- return el;
3557
+ return TinyHtml.scrollToXY(el, { targetX: value });
3410
3558
  }
3411
3559
 
3412
3560
  /**
@@ -1 +1 @@
1
- (()=>{"use strict";var t={d:(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.d(e,{TinyHtml:()=>N});var r={};t.r(r),t.d(r,{areElsCollBottom:()=>n,areElsCollLeft:()=>i,areElsCollPerfBottom:()=>a,areElsCollPerfLeft:()=>c,areElsCollPerfRight:()=>p,areElsCollPerfTop:()=>s,areElsCollRight:()=>l,areElsCollTop:()=>o,areElsColliding:()=>m,areElsPerfColliding:()=>d,getElsCollDetails:()=>w,getElsCollDirDepth:()=>b,getElsCollOverlap:()=>h,getElsCollOverlapPos:()=>g,getElsColliding:()=>u,getElsPerfColliding:()=>f,getElsRelativeCenterOffset:()=>E,getRectCenter:()=>y});const o=(t,e)=>t.bottom<e.top,n=(t,e)=>t.top>e.bottom,i=(t,e)=>t.right<e.left,l=(t,e)=>t.left>e.right,s=(t,e)=>t.bottom<=e.top,a=(t,e)=>t.top>=e.bottom,c=(t,e)=>t.right<=e.left,p=(t,e)=>t.left>=e.right,m=(t,e)=>!(i(t,e)||l(t,e)||o(t,e)||n(t,e)),d=(t,e)=>!(c(t,e)||p(t,e)||s(t,e)||a(t,e)),u=(t,e)=>i(t,e)?"left":l(t,e)?"right":o(t,e)?"top":n(t,e)?"bottom":null,f=(t,e)=>c(t,e)?"left":p(t,e)?"right":s(t,e)?"top":a(t,e)?"bottom":null,h=(t,e)=>({overlapLeft:e.right-t.left,overlapRight:t.right-e.left,overlapTop:e.bottom-t.top,overlapBottom:t.bottom-e.top}),g=({overlapLeft:t=-1,overlapRight:e=-1,overlapTop:r=-1,overlapBottom:o=-1}={})=>({dirX:t<e?"right":"left",dirY:r<o?"bottom":"top"}),y=t=>({x:t.left+t.width/2,y:t.top+t.height/2});function E(t,e){const r=t.left+t.width/2,o=t.top+t.height/2;return{x:e.left+e.width/2-r,y:e.top+e.height/2-o}}function b(t,e){if(!d(t,e))return{inDir:null,dirX:null,dirY:null,depthX:0,depthY:0};const{overlapLeft:r,overlapRight:o,overlapTop:n,overlapBottom:i}=h(t,e),{dirX:l,dirY:s}=g({overlapLeft:r,overlapRight:o,overlapTop:n,overlapBottom:i}),a=Math.min(r,o),c=Math.min(n,i);let p;return p=a<c?l:s,{inDir:p,dirX:l,dirY:s,depthX:a,depthY:c}}function w(t,e){const r=d(t,e),o={in:null,x:null,y:null},n={y:null,x:null},i={top:0,bottom:0,left:0,right:0},{overlapLeft:l,overlapRight:s,overlapTop:a,overlapBottom:c}=h(e,t);i.top=a,i.bottom=c,i.left=l,i.right=s;const p=Object.entries(i).filter((([,t])=>t>0)).sort(((t,e)=>t[1]-e[1])),{dirX:m,dirY:u}=g({overlapLeft:s,overlapRight:l,overlapTop:c,overlapBottom:a});return o.y=u,o.x=m,i.bottom<0?n.y="bottom":i.top<0&&(n.y="top"),i.left<0?n.x="left":i.right<0&&(n.x="right"),o.in=r?i.top===i.bottom&&i.bottom===i.left&&i.left===i.right?"center":p.length?p[0][0]:"top":null,{dirs:o,depth:i,isNeg:n}}const{areElsColliding:T,areElsPerfColliding:v,areElsCollTop:_,areElsCollBottom:C,areElsCollLeft:S,areElsCollRight:A}=r,k=new WeakMap,x=new WeakMap,L={top:new WeakMap,bottom:new WeakMap,left:new WeakMap,right:new WeakMap};class W{static Utils={...r};static createElement(t,e){if("string"!=typeof t)throw new TypeError("[TinyHtml] createElement(): The tagName must be a string.");if(void 0!==e&&"object"!=typeof e)throw new TypeError("[TinyHtml] createElement(): The ops must be a object.");return new W(document.createElement(t,e))}static createTextNode(t){if("string"!=typeof t)throw new TypeError("[TinyHtml] createTextNode(): The value must be a string.");return new W(document.createTextNode(t))}static createElementFromHTML(t){const e=document.createElement("template");if(!(t=t.trim()).startsWith("<"))return W.createTextNode(t);if(e.innerHTML=t,!(e.content.firstChild instanceof Element))throw new Error("");return new W(e.content.firstChild)}static query(t,e=document){const r=e.querySelector(t);return r?new W(r):null}querySelector(t){return W.query(t,W._preElem(this,"query"))}static queryAll(t,e=document){const r=e.querySelectorAll(t);return W.toTinyElm([...r])}querySelectorAll(t){return W.queryAll(t,W._preElem(this,"queryAll"))}static getById(t){const e=document.getElementById(t);return e?new W(e):null}static getByClassName(t,e=document){const r=e.getElementsByClassName(t);return W.toTinyElm([...r])}getElementsByClassName(t){return W.getByClassName(t,W._preElem(this,"getByClassName"))}static getByName(t){const e=document.getElementsByName(t);return W.toTinyElm([...e])}static getByTagNameNS(t,e="http://www.w3.org/1999/xhtml",r=document){const o=r.getElementsByTagNameNS(e,t);return W.toTinyElm([...o])}getElementsByTagNameNS(t,e="http://www.w3.org/1999/xhtml"){return W.getByTagNameNS(t,e,W._preElem(this,"getByTagNameNS"))}get(){return this.#t}_getElement(t){if(!(this.#t instanceof Element||this.#t instanceof Window||this.#t instanceof Document))throw new Error(`[TinyHtml] Invalid Element in ${t}().`);return this.#t}static _preElemsTemplate(t,e,r,o){const n=t=>t.map((t=>{const n=t instanceof W?t._getElement(e):t;let i=!1;for(const t of r)if(n instanceof t){i=!0;break}if(!i)throw new Error(`[TinyHtml] Invalid element of the list "${o.join(",")}" in ${e}().`);return n}));return Array.isArray(t)?n(t):n([t])}static _preElemTemplate(t,e,r,o,n=!1){const i=t=>{const i=t[0];let l=i instanceof W?i._getElement(e):i,s=!1;for(const t of r)if(l instanceof t){s=!0;break}if(n&&null==l&&(l=null,s=!0),!s)throw new Error(`[TinyHtml] Invalid element of the list "${o.join(",")}" in ${e}().`);return l};if(!Array.isArray(t))return i([t]);if(t.length>1)throw new Error(`[TinyHtml] Invalid element amount in ${e}() (Received ${t.length}/1).`);return i(t)}static _preElems(t,e){return W._preElemsTemplate(t,e,[Element],["Element"])}static _preElem(t,e){return W._preElemTemplate(t,e,[Element],["Element"])}static _preNodeElems(t,e){return W._preElemsTemplate(t,e,[Node],["Node"])}static _preNodeElem(t,e){return W._preElemTemplate(t,e,[Node],["Node"])}static _preNodeElemWithNull(t,e){return W._preElemTemplate(t,e,[Node],["Node"],!0)}static _preHtmlElems(t,e){return W._preElemsTemplate(t,e,[HTMLElement],["HTMLElement"])}static _preHtmlElem(t,e){return W._preElemTemplate(t,e,[HTMLElement],["HTMLElement"])}static _preInputElems(t,e){return W._preElemsTemplate(t,e,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}static _preInputElem(t,e){return W._preElemTemplate(t,e,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}static _preEventTargetElems(t,e){return W._preElemsTemplate(t,e,[EventTarget],["EventTarget"])}static _preEventTargetElem(t,e){return W._preElemTemplate(t,e,[EventTarget],["EventTarget"])}static _preElemsAndWindow(t,e){return W._preElemsTemplate(t,e,[Element,Window],["Element","Window"])}static _preElemAndWindow(t,e){return W._preElemTemplate(t,e,[Element,Window],["Element","Window"])}static _preElemsAndWinAndDoc(t,e){return W._preElemsTemplate(t,e,[Element,Window,Document],["Element","Window","Document"]).map((t=>t instanceof Document?t.documentElement:t))}static _preElemAndWinAndDoc(t,e){const r=W._preElemTemplate(t,e,[Element,Window,Document],["Element","Window","Document"]);return r instanceof Document?r.documentElement:r}static toTinyElm(t){const e=t=>t.map((t=>t instanceof W?t:new W(t)));return Array.isArray(t)?e(t):e([t])}static fromTinyElm(t){const e=t=>t.map((t=>t instanceof W?t._getElement("fromTinyElm"):t));return Array.isArray(t)?e(t):e([t])}static winnow(t,e,r,o=!1){if("boolean"!=typeof o)throw new TypeError('The "not" must be a boolean.');if("function"==typeof e)return W._preElems(t,r).filter(((t,r)=>!!e.call(t,r,t)!==o));if(e instanceof Element)return W._preElems(t,r).filter((t=>t===e!==o));if(Array.isArray(e)||"string"!=typeof e&&null!=e.length)return W._preElems(t,r).filter((t=>e.includes(t)!==o));let n=e;return o&&(n=`:not(${n})`),W._preElems(t,r).filter((t=>1===t.nodeType&&t.matches(n)))}static filter(t,e,r=!1){return r&&(e=`:not(${e})`),W._preElems(t,"filter").filter((t=>1===t.nodeType&&t.matches(e)))}static filterOnly(t,e){return W.winnow(t,e,"filterOnly",!1)}static not(t,e){return W.winnow(t,e,"not",!0)}not(t){return W.not(this,t)}static find(t,e){const r=[];for(const o of W._preElems(t,"find"))r.push(...o.querySelectorAll(e));return[...new Set(r)]}find(t){return W.find(this,t)}static is(t,e){return W.winnow(t,e,"is",!1).length>0}is(t){return W.is(this,t)}static has(t,e){const r="string"==typeof e?[...document.querySelectorAll(e)]:W._preElems(e,"has");return W._preElems(t,"has").filter((t=>r.some((e=>t&&t.contains(e)))))}has(t){return W.has(this,t).length>0}static closest(t,e,r){const o=[];for(const n of W._preElems(t,"closest")){let t=n;for(;t&&t!==r;){if(1===t.nodeType&&("string"==typeof e?t.matches(e):t===e)){o.push(t);break}t=t.parentElement}}return[...new Set(o)]}closest(t,e){return W.closest(this,t,e)}static isSameDom(t,e){return W._preNodeElem(t,"isSameDom")===W._preNodeElem(e,"isSameDom")}isSameDom(t){return W.isSameDom(this,t)}_data={};static _dataSelector={public:(t,e)=>{const r=W._preElem(e,t);let o=x.get(r);return o||(o={},x.set(r,o)),o},private:(t,e)=>{if(!(e instanceof W))throw new Error(`Element must be a TinyHtml instance to execute ${t}().`);return e._data}};static data(t,e,r=!1){const o=W._dataSelector[r?"private":"public"]("data",t);if(null==e)return{...o};if("string"!=typeof e)throw new TypeError("The key must be a string.");return o.hasOwnProperty(e)?o[e]:void 0}data(t,e){return W.data(this,t,e)}static setData(t,e,r,o=!1){const n=W._dataSelector[o?"private":"public"]("setData",t);if("string"!=typeof e)throw new TypeError("The key must be a string.");return n[e]=r,t}setData(t,e,r=!1){return W.setData(this,t,e,r)}static _getSibling(t,e,r){let o=W._preNodeElemWithNull(t,r);for(;o&&(o=o[e])&&1!==o.nodeType;);return o instanceof Node?o:null}static _getSiblings(t,e){let r=t;const o=[];for(;r;r=r.nextSibling)1===r.nodeType&&r!==e&&o.push(r);return o}static domDir(t,e,r,o="domDir"){if("string"!=typeof e)throw new TypeError('The "direction" must be a string.');let n=W._preNodeElemWithNull(t,o);const i=[];for(;n&&(n=n[e]);)if(1===n.nodeType){if(r&&("string"==typeof r?n.matches(r):n===r))break;i.push(n)}return i}static parent(t){let e=W._preNodeElemWithNull(t,"parent");const r=e?e.parentNode:null;return r&&11!==r.nodeType?r:null}parent(){return W.parent(this)}static parents(t,e){return W.domDir(t,"parentNode",e,"parents")}parents(t){return W.parents(this,t)}static next(t){return W._getSibling(t,"nextSibling","next")}next(){return W.next(this)}static prev(t){return W._getSibling(t,"previousSibling","prev")}prev(){return W.prev(this)}static nextAll(t){return W.domDir(t,"nextSibling",void 0,"nextAll")}nextAll(){return W.nextAll(this)}static prevAll(t){return W.domDir(t,"previousSibling",void 0,"prevAll")}prevAll(){return W.prevAll(this)}static nextUntil(t,e){return W.domDir(t,"nextSibling",e,"nextUtil")}nextUntil(t){return W.nextUntil(this,t)}static prevUntil(t,e){return W.domDir(t,"previousSibling",e,"prevUtil")}prevUntil(t){return W.prevUntil(this,t)}static siblings(t){const e=W._preNodeElemWithNull(t,"siblings");return W._getSiblings(e&&e.parentNode?e.parentNode.firstChild:null,e)}siblings(){return W.siblings(this)}static children(t){const e=W._preNodeElemWithNull(t,"children");return W._getSiblings(e?e.firstChild:null)}children(){return W.children(this)}static contents(t){const e=W._preNodeElemWithNull(t,"contents");return e instanceof HTMLIFrameElement&&null!=e.contentDocument&&Object.getPrototypeOf(e.contentDocument)?[e.contentDocument]:e instanceof HTMLTemplateElement?Array.from((e.content||e).childNodes):e?Array.from(e.childNodes):[]}contents(){return W.contents(this)}static clone(t,e=!0){if("boolean"!=typeof e)throw new TypeError('The "deep" must be a boolean.');return W._preNodeElems(t,"clone").map((t=>t.cloneNode(e)))}clone(t){return W.clone(this,t)[0]}static _appendChecker(t,...e){const r=[],o=[...e];for(const e in o)"string"!=typeof o[e]?r.push(W._preNodeElem(o[e],t)):r.push(o[e]);return r}static append(t,...e){return W._preElem(t,"append").append(...W._appendChecker("append",...e)),t}append(...t){return W.append(this,...t)}static prepend(t,...e){return W._preElem(t,"prepend").prepend(...W._appendChecker("prepend",...e)),t}prepend(...t){return W.prepend(this,...t)}static before(t,...e){return W._preElem(t,"before").before(...W._appendChecker("before",...e)),t}before(...t){return W.before(this,...t)}static after(t,...e){return W._preElem(t,"after").after(...W._appendChecker("after",...e)),t}after(...t){return W.after(this,...t)}static replaceWith(t,...e){return W._preElem(t,"replaceWith").replaceWith(...W._appendChecker("replaceWith",...e)),t}replaceWith(...t){return W.replaceWith(this,...t)}static appendTo(t,e){const r=W._preNodeElems(t,"appendTo"),o=W._preNodeElems(e,"appendTo");return o.forEach(((t,e)=>{r.forEach((r=>t.appendChild(e===o.length-1?r:r.cloneNode(!0))))})),t}appendTo(t){return W.appendTo(this,t)}static prependTo(t,e){const r=W._preElems(t,"prependTo"),o=W._preElems(e,"prependTo");return o.forEach(((t,e)=>{r.slice().reverse().forEach((r=>t.prepend(e===o.length-1?r:r.cloneNode(!0))))})),t}prependTo(t){return W.prependTo(this,t)}static insertBefore(t,e,r=null){const o=W._preNodeElem(t,"insertBefore"),n=W._preNodeElem(e,"insertBefore"),i=W._preNodeElemWithNull(r,"insertBefore");if(!n.parentNode)throw new Error("");return n.parentNode.insertBefore(o,i||n),t}insertBefore(t,e){return W.insertBefore(this,t,e)}static insertAfter(t,e,r=null){const o=W._preNodeElem(t,"insertAfter"),n=W._preNodeElem(e,"insertBefore"),i=W._preNodeElemWithNull(r,"insertBefore");if(!n.parentNode)throw new Error("");return n.parentNode.insertBefore(o,i||n.nextSibling),t}insertAfter(t,e){return W.insertAfter(this,t,e)}static replaceAll(t,e){const r=W._preNodeElems(t,"replaceAll"),o=W._preNodeElems(e,"replaceAll");return o.forEach(((t,e)=>{const n=t.parentNode;r.forEach((r=>{n&&n.replaceChild(e===o.length-1?r:r.cloneNode(!0),t)}))})),t}replaceAll(t){return W.replaceAll(this,t)}#t;constructor(t){if(t instanceof W)throw new Error("[TinyHtml] You are trying to put a TinyHtml inside another TinyHtml in constructor.");if(!(t instanceof Element||t instanceof Window||t instanceof Document||t instanceof Text))throw new Error("[TinyHtml] Invalid Target in constructor.");this.#t=t}static isWindow(t){return null!=t&&t===t.window}static css(t){const e=W._preElem(t,"css");return window.getComputedStyle(e)}css(){return W.css(this)}static cssString(t,e){const r=W._preElem(t,"cssString");if("string"!=typeof e)throw new TypeError("The prop must be a string.");const o=window.getComputedStyle(r)[e];return"string"==typeof o?o:"number"==typeof o?o.toString():null}cssString(t){return W.cssString(this,t)}static cssList(t,e){const r=W._preElem(t,"cssList");if(!Array.isArray(e))throw new TypeError("The prop must be an array of strings.");const o=window.getComputedStyle(r),n={};for(const t of e)void 0!==t&&(n[t]=o.getPropertyValue(t));return n}cssList(t){return W.cssList(this,t)}static cssFloat(t,e){const r=W._preElem(t,"cssFloat");if("string"!=typeof e)throw new TypeError("The prop must be a string.");const o=window.getComputedStyle(r)[e];return parseFloat(o)||0}cssFloat(t){return W.cssFloat(this,t)}static cssFloats(t,e){const r=W._preElem(t,"cssFloats");if(!Array.isArray(e))throw new TypeError("The prop must be an array of strings.");const o=window.getComputedStyle(r),n={};for(const t of e)n[t]=parseFloat(o[t])||0;return n}cssFloats(t){return W.cssFloats(this,t)}static#e={alignContent:"align-content",alignItems:"align-items",alignSelf:"align-self",animationDelay:"animation-delay",animationDirection:"animation-direction",animationDuration:"animation-duration",animationFillMode:"animation-fill-mode",animationIterationCount:"animation-iteration-count",animationName:"animation-name",animationPlayState:"animation-play-state",animationTimingFunction:"animation-timing-function",backfaceVisibility:"backface-visibility",backgroundAttachment:"background-attachment",backgroundBlendMode:"background-blend-mode",backgroundClip:"background-clip",backgroundColor:"background-color",backgroundImage:"background-image",backgroundOrigin:"background-origin",backgroundPosition:"background-position",backgroundRepeat:"background-repeat",backgroundSize:"background-size",borderBottom:"border-bottom",borderBottomColor:"border-bottom-color",borderBottomLeftRadius:"border-bottom-left-radius",borderBottomRightRadius:"border-bottom-right-radius",borderBottomStyle:"border-bottom-style",borderBottomWidth:"border-bottom-width",borderCollapse:"border-collapse",borderColor:"border-color",borderImage:"border-image",borderImageOutset:"border-image-outset",borderImageRepeat:"border-image-repeat",borderImageSlice:"border-image-slice",borderImageSource:"border-image-source",borderImageWidth:"border-image-width",borderLeft:"border-left",borderLeftColor:"border-left-color",borderLeftStyle:"border-left-style",borderLeftWidth:"border-left-width",borderRadius:"border-radius",borderRight:"border-right",borderRightColor:"border-right-color",borderRightStyle:"border-right-style",borderRightWidth:"border-right-width",borderSpacing:"border-spacing",borderStyle:"border-style",borderTop:"border-top",borderTopColor:"border-top-color",borderTopLeftRadius:"border-top-left-radius",borderTopRightRadius:"border-top-right-radius",borderTopStyle:"border-top-style",borderTopWidth:"border-top-width",borderWidth:"border-width",boxDecorationBreak:"box-decoration-break",boxShadow:"box-shadow",boxSizing:"box-sizing",breakAfter:"break-after",breakBefore:"break-before",breakInside:"break-inside",captionSide:"caption-side",caretColor:"caret-color",clipPath:"clip-path",columnCount:"column-count",columnFill:"column-fill",columnGap:"column-gap",columnRule:"column-rule",columnRuleColor:"column-rule-color",columnRuleStyle:"column-rule-style",columnRuleWidth:"column-rule-width",columnSpan:"column-span",columnWidth:"column-width",counterIncrement:"counter-increment",counterReset:"counter-reset",emptyCells:"empty-cells",flexBasis:"flex-basis",flexDirection:"flex-direction",flexFlow:"flex-flow",flexGrow:"flex-grow",flexShrink:"flex-shrink",flexWrap:"flex-wrap",fontFamily:"font-family",fontFeatureSettings:"font-feature-settings",fontKerning:"font-kerning",fontLanguageOverride:"font-language-override",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontSynthesis:"font-synthesis",fontVariant:"font-variant",fontVariantAlternates:"font-variant-alternates",fontVariantCaps:"font-variant-caps",fontVariantEastAsian:"font-variant-east-asian",fontVariantLigatures:"font-variant-ligatures",fontVariantNumeric:"font-variant-numeric",fontVariantPosition:"font-variant-position",fontWeight:"font-weight",gridArea:"grid-area",gridAutoColumns:"grid-auto-columns",gridAutoFlow:"grid-auto-flow",gridAutoRows:"grid-auto-rows",gridColumn:"grid-column",gridColumnEnd:"grid-column-end",gridColumnGap:"grid-column-gap",gridColumnStart:"grid-column-start",gridGap:"grid-gap",gridRow:"grid-row",gridRowEnd:"grid-row-end",gridRowGap:"grid-row-gap",gridRowStart:"grid-row-start",gridTemplate:"grid-template",gridTemplateAreas:"grid-template-areas",gridTemplateColumns:"grid-template-columns",gridTemplateRows:"grid-template-rows",imageRendering:"image-rendering",justifyContent:"justify-content",letterSpacing:"letter-spacing",lineBreak:"line-break",lineHeight:"line-height",listStyle:"list-style",listStyleImage:"list-style-image",listStylePosition:"list-style-position",listStyleType:"list-style-type",marginBottom:"margin-bottom",marginLeft:"margin-left",marginRight:"margin-right",marginTop:"margin-top",maskClip:"mask-clip",maskComposite:"mask-composite",maskImage:"mask-image",maskMode:"mask-mode",maskOrigin:"mask-origin",maskPosition:"mask-position",maskRepeat:"mask-repeat",maskSize:"mask-size",maskType:"mask-type",maxHeight:"max-height",maxWidth:"max-width",minHeight:"min-height",minWidth:"min-width",mixBlendMode:"mix-blend-mode",objectFit:"object-fit",objectPosition:"object-position",offsetAnchor:"offset-anchor",offsetDistance:"offset-distance",offsetPath:"offset-path",offsetRotate:"offset-rotate",outlineColor:"outline-color",outlineOffset:"outline-offset",outlineStyle:"outline-style",outlineWidth:"outline-width",overflowAnchor:"overflow-anchor",overflowWrap:"overflow-wrap",overflowX:"overflow-x",overflowY:"overflow-y",paddingBottom:"padding-bottom",paddingLeft:"padding-left",paddingRight:"padding-right",paddingTop:"padding-top",pageBreakAfter:"page-break-after",pageBreakBefore:"page-break-before",pageBreakInside:"page-break-inside",perspectiveOrigin:"perspective-origin",placeContent:"place-content",placeItems:"place-items",placeSelf:"place-self",pointerEvents:"pointer-events",rowGap:"row-gap",scrollBehavior:"scroll-behavior",scrollMargin:"scroll-margin",scrollMarginBlock:"scroll-margin-block",scrollMarginBlockEnd:"scroll-margin-block-end",scrollMarginBlockStart:"scroll-margin-block-start",scrollMarginBottom:"scroll-margin-bottom",scrollMarginInline:"scroll-margin-inline",scrollMarginInlineEnd:"scroll-margin-inline-end",scrollMarginInlineStart:"scroll-margin-inline-start",scrollMarginLeft:"scroll-margin-left",scrollMarginRight:"scroll-margin-right",scrollMarginTop:"scroll-margin-top",scrollPadding:"scroll-padding",scrollPaddingBlock:"scroll-padding-block",scrollPaddingBlockEnd:"scroll-padding-block-end",scrollPaddingBlockStart:"scroll-padding-block-start",scrollPaddingBottom:"scroll-padding-bottom",scrollPaddingInline:"scroll-padding-inline",scrollPaddingInlineEnd:"scroll-padding-inline-end",scrollPaddingInlineStart:"scroll-padding-inline-start",scrollPaddingLeft:"scroll-padding-left",scrollPaddingRight:"scroll-padding-right",scrollPaddingTop:"scroll-padding-top",scrollSnapAlign:"scroll-snap-align",scrollSnapStop:"scroll-snap-stop",scrollSnapType:"scroll-snap-type",shapeImageThreshold:"shape-image-threshold",shapeMargin:"shape-margin",shapeOutside:"shape-outside",tabSize:"tab-size",tableLayout:"table-layout",textAlign:"text-align",textAlignLast:"text-align-last",textCombineUpright:"text-combine-upright",textDecoration:"text-decoration",textDecorationColor:"text-decoration-color",textDecorationLine:"text-decoration-line",textDecorationStyle:"text-decoration-style",textIndent:"text-indent",textJustify:"text-justify",textOrientation:"text-orientation",textOverflow:"text-overflow",textShadow:"text-shadow",textTransform:"text-transform",transformBox:"transform-box",transformOrigin:"transform-origin",transformStyle:"transform-style",transitionDelay:"transition-delay",transitionDuration:"transition-duration",transitionProperty:"transition-property",transitionTimingFunction:"transition-timing-function",unicodeBidi:"unicode-bidi",userSelect:"user-select",verticalAlign:"vertical-align",whiteSpace:"white-space",willChange:"will-change",wordBreak:"word-break",wordSpacing:"word-spacing",wordWrap:"word-wrap",writingMode:"writing-mode",zIndex:"z-index",WebkitTransform:"-webkit-transform",WebkitTransition:"-webkit-transition",WebkitBoxShadow:"-webkit-box-shadow",MozBoxShadow:"-moz-box-shadow",MozTransform:"-moz-transform",MozTransition:"-moz-transition",msTransform:"-ms-transform",msTransition:"-ms-transition"};static cssPropAliases=new Proxy(W.#e,{set:(t,e,r)=>(t[e]=r,W.cssPropRevAliases[r]=e,!0)});static cssPropRevAliases=Object.fromEntries(Object.entries(W.#e).map((([t,e])=>[e,t])));static toStyleKc(t){return"string"==typeof W.cssPropAliases[t]?W.cssPropAliases[t]:t}static toStyleCc(t){return"string"==typeof W.cssPropRevAliases[t]?W.cssPropRevAliases[t]:t}static setStyle(t,e,r=null){return W._preHtmlElems(t,"setStyle").forEach((t=>{if("object"==typeof e)for(const[r,o]of Object.entries(e))t.style.setProperty(W.toStyleKc(r),"string"==typeof o?o:"number"==typeof o?`${o}px`:String(o));else t.style.setProperty(W.toStyleKc(e),r)})),t}setStyle(t,e){return W.setStyle(this,t,e)}static getStyle(t,e){return W._preHtmlElem(t,"getStyle").style.getPropertyValue(W.toStyleKc(e))}getStyle(t){return W.getStyle(this,t)}static style(t,{camelCase:e=!1,rawAttr:r=!1}={}){if("boolean"!=typeof e)throw new TypeError('"camelCase" must be a boolean. Received: '+typeof e);if("boolean"!=typeof r)throw new TypeError('"rawAttr" must be a boolean. Received: '+typeof r);const o=W._preHtmlElem(t,"style"),n={};if(r){const t=(o.getAttribute("style")||"").split(";");for(const r of t){const[t,o]=r.split(":");if(!t||!o)continue;const i=t.trim(),l=o.trim();n[e?W.toStyleCc(i):i]=l}}else{const t=o.style;for(let r=0;r<t.length;r++){const o=t[r],i=t.getPropertyValue(o);n[e?W.toStyleCc(o):o]=i}}return n}style(t){return W.style(this,t)}static removeStyle(t,e){return W._preHtmlElems(t,"removeStyle").forEach((t=>{if(Array.isArray(e))for(const r of e)t.style.removeProperty(W.toStyleKc(r));else t.style.removeProperty(W.toStyleKc(e))})),t}removeStyle(t){return W.removeStyle(this,t)}static toggleStyle(t,e,r,o){return W._preHtmlElems(t,"toggleStyle").forEach((t=>{const n=W.getStyle(t,e).trim()===W.toStyleKc(r)?o:r;W.setStyle(t,e,n)})),t}toggleStyle(t,e,r){return W.toggleStyle(this,t,e,r)}static clearStyle(t){return W._preElems(t,"clearStyle").forEach((t=>t.removeAttribute("style"))),t}clearStyle(){return W.clearStyle(this)}static focus(t){return W._preHtmlElem(t,"focus").focus(),t}focus(){return W.focus(this)}static blur(t){return W._preHtmlElem(t,"blur").blur(),t}blur(){return W.blur(this)}static boolCheck(t){return void 0!==t&&("true"===t||"1"===t||!0===t||"on"===t||"number"==typeof t&&t>0)}static setWinScrollTop(t){if("number"!=typeof t)throw new TypeError("The value must be a number.");window.scrollTo({top:t})}static setWinScrollLeft(t){if("number"!=typeof t)throw new TypeError("The value must be a number.");window.scrollTo({left:t})}static winScrollTop(){return window.scrollY||document.documentElement.scrollTop}static winScrollLeft(){return window.scrollX||document.documentElement.scrollLeft}static winInnerHeight(){return window.innerHeight||document.documentElement.clientHeight}static winInnerWidth(){return window.innerWidth||document.documentElement.clientWidth}static isPageTop(){return 0===window.scrollY}static isPageBottom(){return window.innerHeight+window.scrollY>=document.body.offsetHeight}static getDimension(t,e,r="content"){const o=W._preElemAndWinAndDoc(t,"getDimension");if("string"!=typeof e)throw new TypeError("The type must be a string.");if("string"!=typeof r)throw new TypeError("The extra must be a string.");const n="width"===e?"Width":"Height";if(W.isWindow(o))return"margin"===r?o["inner"+n]:o.document.documentElement["client"+n];const i=o;if(9===i.nodeType){const t=i.documentElement;return Math.max(i.body["scroll"+n],t["scroll"+n],i.body["offset"+n],t["offset"+n],t["client"+n])}let l=i.getBoundingClientRect()[e];function s(t){return"width"===e?W.cssFloat(i,t+"Left")+W.cssFloat(i,t+"Right"):W.cssFloat(i,t+"Top")+W.cssFloat(i,t+"Bottom")}switch(r){case"content":l-=s("padding"),l-=s("border");break;case"padding":l-=s("border");break;case"border":break;case"margin":l+=s("margin")}return l}getDimension(t,e){return W.getDimension(this,t,e)}static setHeight(t,e){const r=W._preHtmlElem(t,"setHeight");if("number"!=typeof e&&"string"!=typeof e)throw new TypeError("The value must be a string or number.");return r.style.height="number"==typeof e?`${e}px`:e,t}setHeight(t){return W.setHeight(this,t)}static setWidth(t,e){const r=W._preHtmlElem(t,"setWidth");if("number"!=typeof e&&"string"!=typeof e)throw new TypeError("The value must be a string or number.");return r.style.width="number"==typeof e?`${e}px`:e,t}setWidth(t){return W.setWidth(this,t)}static height(t){const e=W._preElemAndWinAndDoc(t,"height");return W.getDimension(e,"height","content")}height(){return W.height(this)}static width(t){const e=W._preElemAndWinAndDoc(t,"width");return W.getDimension(e,"width","content")}width(){return W.width(this)}static innerHeight(t){const e=W._preElemAndWinAndDoc(t,"innerHeight");return W.getDimension(e,"height","padding")}innerHeight(){return W.innerHeight(this)}static innerWidth(t){const e=W._preElemAndWinAndDoc(t,"innerWidth");return W.getDimension(e,"width","padding")}innerWidth(){return W.innerWidth(this)}static outerHeight(t,e=!1){if("boolean"!=typeof e)throw new TypeError('The "includeMargin" must be a boolean.');const r=W._preElemAndWinAndDoc(t,"outerHeight");return W.getDimension(r,"height",e?"margin":"border")}outerHeight(t){return W.outerHeight(this,t)}static outerWidth(t,e=!1){if("boolean"!=typeof e)throw new TypeError('The "includeMargin" must be a boolean.');const r=W._preElemAndWinAndDoc(t,"outerWidth");return W.getDimension(r,"width",e?"margin":"border")}outerWidth(t){return W.outerWidth(this,t)}static offset(t){const e=W._preElem(t,"offset").getBoundingClientRect(),r=window.scrollY||document.documentElement.scrollTop,o=window.scrollX||document.documentElement.scrollLeft;return{top:e.top+r,left:e.left+o}}offset(){return W.offset(this)}static position(t){const e=W._preHtmlElem(t,"position");let r,o,n={top:0,left:0};if("fixed"===window.getComputedStyle(e).position)o=e.getBoundingClientRect();else{o=W.offset(e),r=e.offsetParent||document.documentElement;const{position:t}=window.getComputedStyle(r);for(;r instanceof HTMLElement&&(r===document.body||r===document.documentElement)&&"static"===t;)r=r.parentNode;if(r instanceof HTMLElement&&r!==e&&1===r.nodeType){const{borderTopWidth:t,borderLeftWidth:e}=W.cssFloats(r,["borderTopWidth","borderLeftWidth"]);n=W.offset(r),n.top+=t,n.left+=e}}return{top:o.top-n.top-W.cssFloat(e,"marginTop"),left:o.left-n.left-W.cssFloat(e,"marginLeft")}}position(){return W.position(this)}static offsetParent(t){let e=W._preHtmlElem(t,"offsetParent").offsetParent;for(;e instanceof HTMLElement&&"static"===window.getComputedStyle(e).position;)e=e.offsetParent;return e instanceof HTMLElement?e:document.documentElement}offsetParent(){return W.offsetParent(this)}static scrollTop(t){const e=W._preElemAndWindow(t,"scrollTop");return W.isWindow(e)?e.pageYOffset:9===e.nodeType?e.defaultView.pageYOffset:e.scrollTop}scrollTop(){return W.scrollTop(this)}static scrollLeft(t){const e=W._preElemAndWindow(t,"scrollLeft");return W.isWindow(e)?e.pageXOffset:9===e.nodeType?e.defaultView.pageXOffset:e.scrollLeft}scrollLeft(){return W.scrollLeft(this)}static setScrollTop(t,e){if("number"!=typeof e)throw new TypeError("ScrollTop value must be a number.");return W._preElemsAndWindow(t,"setScrollTop").forEach((t=>{W.isWindow(t)?t.scrollTo(t.pageXOffset,e):9===t.nodeType?t.defaultView.scrollTo(t.defaultView.pageXOffset,e):t.scrollTop=e})),t}setScrollTop(t){return W.setScrollTop(this,t)}static setScrollLeft(t,e){if("number"!=typeof e)throw new TypeError("ScrollLeft value must be a number.");return W._preElemsAndWindow(t,"setScrollLeft").forEach((t=>{W.isWindow(t)?t.scrollTo(e,t.pageYOffset):9===t.nodeType?t.defaultView.scrollTo(e,t.defaultView.pageYOffset):t.scrollLeft=e})),t}setScrollLeft(t){return W.setScrollLeft(this,t)}static borderWidth(t){const e=W._preElem(t,"borderWidth"),{borderLeftWidth:r,borderRightWidth:o,borderTopWidth:n,borderBottomWidth:i}=W.cssFloats(e,["borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"]);return{x:r+o,y:n+i,left:r,right:o,top:n,bottom:i}}borderWidth(){return W.borderWidth(this)}static border(t){const e=W._preElem(t,"border"),{borderLeft:r,borderRight:o,borderTop:n,borderBottom:i}=W.cssFloats(e,["borderLeft","borderRight","borderTop","borderBottom"]);return{x:r+o,y:n+i,left:r,right:o,top:n,bottom:i}}border(){return W.border(this)}static margin(t){const e=W._preElem(t,"margin"),{marginLeft:r,marginRight:o,marginTop:n,marginBottom:i}=W.cssFloats(e,["marginLeft","marginRight","marginTop","marginBottom"]);return{x:r+o,y:n+i,left:r,right:o,top:n,bottom:i}}margin(){return W.margin(this)}static padding(t){const e=W._preElem(t,"padding"),{paddingLeft:r,paddingRight:o,paddingTop:n,paddingBottom:i}=W.cssFloats(e,["paddingLeft","paddingRight","paddingTop","paddingBottom"]);return{x:r+o,y:n+i,left:r,right:o,top:n,bottom:i}}padding(){return W.padding(this)}static addClass(t,...e){return W._preElems(t,"addClass").forEach((t=>t.classList.add(...e))),t}addClass(...t){return W.addClass(this,...t)}static removeClass(t,...e){return W._preElems(t,"removeClass").forEach((t=>t.classList.remove(...e))),t}removeClass(...t){return W.removeClass(this,...t)}static replaceClass(t,e,r){if("string"!=typeof e)throw new TypeError('The "token" parameter must be a string.');if("string"!=typeof r)throw new TypeError('The "newToken" parameter must be a string.');const o=[];return W._preElems(t,"replaceClass").forEach((t=>o.push(t.classList.replace(e,r)))),o}replaceClass(t,e){return W.replaceClass(this,t,e)[0]}static classItem(t,e){const r=W._preElem(t,"classItem");if("number"!=typeof e)throw new TypeError('The "index" parameter must be a number.');return r.classList.item(e)}classItem(t){return W.classItem(this,t)}static toggleClass(t,e,r){if("string"!=typeof e)throw new TypeError('The "token" parameter must be a string.');if(void 0!==r&&"boolean"!=typeof r)throw new TypeError('The "force" parameter must be a boolean.');const o=[];return W._preElems(t,"toggleClass").forEach((t=>o.push(t.classList.toggle(e,r)))),o}toggleClass(t,e){return W.toggleClass(this,t,e)[0]}static hasClass(t,e){const r=W._preElem(t,"hasClass");if("string"!=typeof e)throw new TypeError('The "token" parameter must be a string.');return r.classList.contains(e)}hasClass(t){return W.hasClass(this,t)}static classLength(t){return W._preElem(t,"classLength").classList.length}classLength(){return W.classLength(this)}static classList(t){return W._preElem(t,"classList").classList.values().toArray()}classList(){return W.classList(this)}static tagName(t){return W._preElem(t,"tagName").tagName}tagName(){return W.tagName(this)}static id(t){return W._preElem(t,"id").id}id(){return W.id(this)}static text(t){return W._preElem(t,"text").textContent}text(){return W.text(this)}static setText(t,e){if("string"!=typeof e)throw new Error("Value is not a valid string.");return W._preElems(t,"setText").forEach((t=>t.textContent=e)),t}setText(t){return W.setText(this,t)}static empty(t){return W._preElems(t,"empty").forEach((t=>t.textContent="")),t}empty(){return W.empty(this)}static html(t,e){return W._preElem(t,"html").getHTML(e)}html(t){return W.html(this,t)}static setHtml(t,e){if("string"!=typeof e)throw new Error("Value is not a valid string.");return W._preElems(t,"setHtml").forEach((t=>t.innerHTML=e)),t}setHtml(t){return W.setHtml(this,t)}static _valHooks={option:{get:t=>{const e=t.getAttribute("value");return null!=e?e:t.textContent}},select:{get:t=>{const e=t.options,r=t.selectedIndex,o="select-one"===t.type,n=o?r+1:e.length,i=[];let l=r<0?n:o?r:0;for(;l<n;l++){const t=e[l],n=t.parentNode;if((t.selected||l===r)&&!t.disabled&&(!n||!n.disabled||"OPTGROUP"!==n.tagName)){const e=W._valHooks.option.get(t);if(o)return e;i.push(e)}}return i},set:(t,e)=>{const r=t.options,o=Array.isArray(e)?e.map(String):[String(e)];let n=!1;for(let t=0;t<r.length;t++){const e=r[t],i=W._valHooks.option.get(e);"string"==typeof i&&(e.selected=o.includes(i))&&(n=!0)}return n||(t.selectedIndex=-1),o}},radio:{get:t=>t.checked?"on":"off",set(t,e){if("boolean"==typeof e){const r=t.closest("label");return e&&r&&r.querySelectorAll('input[type="radio"]').forEach((e=>{e instanceof HTMLInputElement&&e!==t&&(e.checked=!1)})),t.checked=e,e}}},checkbox:{get:t=>t.checked?"on":"off",set(t,e){if("boolean"==typeof e)return t.checked=e,e}}};static setVal(t,e){return W._preInputElems(t,"setVal").forEach((t=>{if(1!==t.nodeType)return;let r="function"==typeof e?e(t,W.val(t)):e;null==r?r="":"number"==typeof r?r=String(r):Array.isArray(r)&&(r=(t=>{const e=[];for(let o=0;o<t.length;o++)e.push(null==(r=t[o])?"":String(r));var r;return e})(r));const o=W._valHooks[t.type]||W._valHooks[t.nodeName.toLowerCase()];if(!o||"function"!=typeof o.set||void 0===o.set(t,r,"value")){if("string"!=typeof r&&"boolean"!=typeof r)throw new Error(`Invalid setValue "${typeof r}" value.`);"string"==typeof r&&(t.value=r)}})),t}setVal(t){return W.setVal(this,t)}static _valTypes={string:t=>t.value,date:t=>t.valueAsDate,number:t=>t.valueAsNumber};static _getValByType(t,e,r){if("string"!=typeof e)throw new TypeError('The "type" must be a string.');if("string"!=typeof r)throw new TypeError('The "where" must be a string.');if(!(t instanceof HTMLInputElement))throw new Error(`Provided element is not an HTMLInputElement in ${r}().`);if("function"!=typeof W._valTypes[e])throw new Error(`No handler found for type "${e}" in ${r}().`);return W._valTypes[e](t)}static _val(t,e,r){const o=W._preInputElem(t,e),n=W._valHooks[o.type]||W._valHooks[o.nodeName.toLowerCase()];if(n&&"function"==typeof n.get){const t=n.get(o,"value",r);if(void 0!==t)return"string"==typeof t?t.replace(/\r/g,""):t}return W._getValByType(o,r,e)}_val(t,e){return W._val(this,t,e)}static val(t){return W._val(t,"val","string")}val(){return W.val(this)}static valTxt(t){const e=W._val(t,"valTxt","string");if("string"!=typeof e&&null!==e)throw new Error("Value is not a valid string.");return null==e?"":"string"==typeof e?e.replace(/\r/g,""):e}valTxt(){return W.valTxt(this)}static _valArr(t,e,r){const o=W._val(t,e,r);if(!Array.isArray(o))throw new Error(`Value expected an array but got ${typeof o}.`);return o}_valArr(t,e){return W._valArr(this,t,e)}static valArr(t){return W._valArr(t,"valArr","string")}valArr(){return W.valArr(this)}static valNb(t){if(!(W._preInputElem(t,"valNb")instanceof HTMLInputElement))throw new Error("Element must be an input element.");const e=W._val(t,"valNb","number");if(Number.isNaN(e))throw new Error("Value is not a valid number.");return e}valNb(){return W.valNb(this)}static valDate(t){if(!(W._preInputElem(t,"valDate")instanceof HTMLInputElement))throw new Error("Element must be an input element.");const e=W._val(t,"valDate","date");if(!(e instanceof Date))throw new Error("Value is not a valid date.");return e}valDate(){return W.valDate(this)}static valBool(t){const e=W._preInputElem(t,"valBool");if(!(e instanceof HTMLInputElement))throw new Error("Element must be an input element.");return"on"===W.val(e)}valBool(){return W.valBool(this)}static on(t,e,r,o){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return W._preEventTargetElems(t,"on").forEach((t=>{t.addEventListener(e,r,o),k.has(t)||k.set(t,{});const n=k.get(t);n&&(Array.isArray(n[e])||(n[e]=[]),n[e].push({handler:r,options:o}))})),t}on(t,e,r){return W.on(this,t,e,r)}static once(t,e,r,o={}){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return W._preEventTargetElems(t,"once").forEach((t=>{const n=o=>{W.off(t,e,n),r(o)};W.on(t,e,n,"boolean"==typeof o?o:{...o,once:!0})})),t}once(t,e,r={}){return W.once(this,t,e,r)}static off(t,e,r,o){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return W._preEventTargetElems(t,"off").forEach((t=>{t.removeEventListener(e,r,o);const n=k.get(t);n&&n[e]&&(n[e]=n[e].filter((t=>t.handler!==r)),0===n[e].length&&delete n[e])})),t}off(t,e,r){return W.off(this,t,e,r)}static offAll(t,e){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return W._preEventTargetElems(t,"offAll").forEach((t=>{const r=k.get(t);if(r&&r[e]){for(const o of r[e])t.removeEventListener(e,o.handler,o.options);delete r[e]}})),t}offAll(t){return W.offAll(this,t)}static offAllTypes(t,e=null){if(null!==e&&"function"!=typeof e)throw new TypeError('The "filterFn" must be a function.');return W._preEventTargetElems(t,"offAllTypes").forEach((t=>{const r=k.get(t);if(r){for(const o in r)for(const n of r[o])("function"!=typeof e||e(n.handler,o))&&t.removeEventListener(o,n.handler,n.options);k.delete(t)}})),t}offAllTypes(t=null){return W.offAllTypes(this,t)}static trigger(t,e,r={}){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return W._preEventTargetElems(t,"trigger").forEach((t=>{const o=r instanceof Event||r instanceof CustomEvent?r:new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t.dispatchEvent(o)})),t}trigger(t,e={}){return W.trigger(this,t,e)}static _propFix={for:"htmlFor",class:"className"};static attr(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return W._preElem(t,"attr").getAttribute(e)}attr(t){return W.attr(this,t)}static setAttr(t,e,r=null){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');if(null!==r&&"string"!=typeof r)throw new TypeError('The "value" must be a string.');return W._preElems(t,"setAttr").forEach((t=>{null===r?t.removeAttribute(e):t.setAttribute(e,r)})),t}setAttr(t,e){return W.setAttr(this,t,e)}static removeAttr(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return W._preElems(t,"removeAttr").forEach((t=>t.removeAttribute(e))),t}removeAttr(t){return W.removeAttr(this,t)}static hasAttr(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return W._preElem(t,"hasAttr").hasAttribute(e)}hasAttr(t){return W.hasAttr(this,t)}static hasProp(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return!!W._preElem(t,"hasProp")[W._propFix[e]||e]}hasProp(t){return W.hasProp(this,t)}static addProp(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return W._preElems(t,"addProp").forEach((t=>{t[e=W._propFix[e]||e]=!0})),t}addProp(t){return W.addProp(this,t)}static removeProp(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return W._preElems(t,"removeProp").forEach((t=>{t[e=W._propFix[e]||e]=!1})),t}removeProp(t){return W.removeProp(this,t)}static toggleProp(t,e,r){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');if(void 0!==r&&"boolean"!=typeof r)throw new TypeError('The "force" must be a boolean.');W._preElems(t,"toggleProp").forEach((t=>{const o=W._propFix[e]||e;(void 0===r?!t[o]:r)?W.addProp(t,e):W.removeProp(t,e)}))}toggleProp(t,e){return W.toggleProp(this,t,e)}static remove(t){return W._preElems(t,"remove").forEach((t=>t.remove())),t}remove(){return W.remove(this)}static index(t,e=null){const r=W._preElem(t,"index");if(!r)return-1;if(!e)return Array.prototype.indexOf.call(r.parentNode?.children||[],r);if(e){const t="string"==typeof e?document.querySelectorAll(e):W._preElems(e,"index");return Array.prototype.indexOf.call(t,r)}return-1}index(t){return W.index(this,t)}static _getCustomRect(t,e){const r={height:0,width:0,x:0,y:0,bottom:0,left:0,right:0,top:0,toJSON:function(){throw new Error("Function not implemented.")}};for(const e in t)"number"==typeof t[e]&&(r[e]=t[e]);if("object"!=typeof e||null===e||Array.isArray(e))throw new Error("");const{height:o=0,width:n=0,top:i=0,bottom:l=0,left:s=0,right:a=0}=e;if("number"!=typeof o)throw new Error("");if("number"!=typeof n)throw new Error("");if("number"!=typeof i)throw new Error("");if("number"!=typeof l)throw new Error("");if("number"!=typeof s)throw new Error("");if("number"!=typeof a)throw new Error("");return r.height+=o,r.width+=n,r.top+=i,r.bottom+=l,r.left+=s,r.right+=a,r}static isCollWith(t,e,r={}){const o=W._getCustomRect(W._preElem(t,"isCollWith").getBoundingClientRect(),r),n=W._preElem(e,"isCollWith").getBoundingClientRect();return T(o,n)}isCollWith(t,e){return W.isCollWith(this,t,e)}static isCollPerfWith(t,e,r={}){const o=W._getCustomRect(W._preElem(t,"isCollPerfWith").getBoundingClientRect(),r),n=W._preElem(e,"isCollPerfWith").getBoundingClientRect();return v(o,n)}isCollPerfWith(t,e){return W.isCollPerfWith(this,t,e)}static _isCollWithLock(t,e,r,o,n){const i=L[n];if(t)return i.has(o)||i.set(o,!0),!0;if(i.has(o)){let t=!1;switch(n){case"top":t=_(e,r);break;case"bottom":t=C(e,r);break;case"left":t=S(e,r);break;case"right":t=A(e,r)}return t&&i.delete(o),i.has(o)}return!1}static isCollWithLock(t,e,r,o={}){const n=W._preElem(t,"isCollWithLock"),i=W._preElem(e,"isCollWithLock"),l=W._getCustomRect(n.getBoundingClientRect(),o),s=i.getBoundingClientRect(),a=T(l,s);return W._isCollWithLock(a,l,s,n,r)}isCollWithLock(t,e,r){return W.isCollWithLock(this,t,e,r)}static isCollPerfWithLock(t,e,r,o={}){const n=W._preElem(t,"isCollPerfWithLock"),i=W._preElem(e,"isCollPerfWithLock"),l=W._getCustomRect(n.getBoundingClientRect(),o),s=i.getBoundingClientRect(),a=v(l,s);return W._isCollWithLock(a,l,s,n,r)}isCollPerfWithLock(t,e,r){return W.isCollPerfWithLock(this,t,e,r)}static resetCollLock(t){const e=W._preElem(t,"resetCollLock");let r=!1;for(const t of["top","bottom","left","right"])L[t].has(e)&&(L[t].delete(e),r=!0);return r}resetCollLock(){return W.resetCollLock(this)}static resetCollLockDir(t,e){const r=W._preElem(t,"resetCollLockDir"),o=L[e];return!!o.has(r)&&(o.delete(r),!0)}resetCollLockDir(t){return W.resetCollLockDir(this,t)}static isInViewport(t){const e=W._preElem(t,"isInViewport");if(!e.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const r=W.offset(e).top,o=r+W.outerHeight(e),n=W.scrollTop(window),i=n+W.height(window);return o>n&&r<i}isInViewport(){return W.isInViewport(this)}static isScrolledIntoView(t){const e=W._preElem(t,"isScrolledIntoView");if(!e.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const r=W.scrollTop(window),o=r+W.height(window),n=W.offset(e).top;return n+W.height(e)<=o&&n>=r}isScrolledIntoView(){return W.isScrolledIntoView(this)}static isInContainer(t,e){const r=W._preElem(t,"isInContainer"),o=W._preElem(e,"isInContainer");if(!r.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const n=r.getBoundingClientRect(),i=o.getBoundingClientRect(),l=n.bottom>i.top&&n.top<i.bottom,s=n.right>i.left&&n.left<i.right;return l&&s}isInContainer(t){return W.isInContainer(this,t)}static isFullyInContainer(t,e){const r=W._preElem(t,"isScrolledIntoView"),o=W._preElem(e,"isInContainer");if(!r.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const n=r.getBoundingClientRect(),i=o.getBoundingClientRect();return n.top>=i.top&&n.bottom<=i.bottom&&n.left>=i.left&&n.right<=i.right}isFullyInContainer(t){return W.isFullyInContainer(this,t)}static hasScroll(t){const e=W._preElem(t,"hasScroll");return{v:e.scrollHeight>e.clientHeight,h:e.scrollWidth>e.clientWidth}}hasScroll(){return W.hasScroll(this)}}const N=W;window.TinyHtml=e.TinyHtml})();
1
+ (()=>{"use strict";var t={d:(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.d(e,{TinyHtml:()=>N});var r={};t.r(r),t.d(r,{areElsCollBottom:()=>n,areElsCollLeft:()=>i,areElsCollPerfBottom:()=>a,areElsCollPerfLeft:()=>c,areElsCollPerfRight:()=>p,areElsCollPerfTop:()=>s,areElsCollRight:()=>l,areElsCollTop:()=>o,areElsColliding:()=>m,areElsPerfColliding:()=>u,getElsCollDetails:()=>w,getElsCollDirDepth:()=>E,getElsCollOverlap:()=>g,getElsCollOverlapPos:()=>h,getElsColliding:()=>d,getElsPerfColliding:()=>f,getElsRelativeCenterOffset:()=>b,getRectCenter:()=>y});const o=(t,e)=>t.bottom<e.top,n=(t,e)=>t.top>e.bottom,i=(t,e)=>t.right<e.left,l=(t,e)=>t.left>e.right,s=(t,e)=>t.bottom<=e.top,a=(t,e)=>t.top>=e.bottom,c=(t,e)=>t.right<=e.left,p=(t,e)=>t.left>=e.right,m=(t,e)=>!(i(t,e)||l(t,e)||o(t,e)||n(t,e)),u=(t,e)=>!(c(t,e)||p(t,e)||s(t,e)||a(t,e)),d=(t,e)=>i(t,e)?"left":l(t,e)?"right":o(t,e)?"top":n(t,e)?"bottom":null,f=(t,e)=>c(t,e)?"left":p(t,e)?"right":s(t,e)?"top":a(t,e)?"bottom":null,g=(t,e)=>({overlapLeft:e.right-t.left,overlapRight:t.right-e.left,overlapTop:e.bottom-t.top,overlapBottom:t.bottom-e.top}),h=({overlapLeft:t=-1,overlapRight:e=-1,overlapTop:r=-1,overlapBottom:o=-1}={})=>({dirX:t<e?"right":"left",dirY:r<o?"bottom":"top"}),y=t=>({x:t.left+t.width/2,y:t.top+t.height/2});function b(t,e){const r=t.left+t.width/2,o=t.top+t.height/2;return{x:e.left+e.width/2-r,y:e.top+e.height/2-o}}function E(t,e){if(!u(t,e))return{inDir:null,dirX:null,dirY:null,depthX:0,depthY:0};const{overlapLeft:r,overlapRight:o,overlapTop:n,overlapBottom:i}=g(t,e),{dirX:l,dirY:s}=h({overlapLeft:r,overlapRight:o,overlapTop:n,overlapBottom:i}),a=Math.min(r,o),c=Math.min(n,i);let p;return p=a<c?l:s,{inDir:p,dirX:l,dirY:s,depthX:a,depthY:c}}function w(t,e){const r=u(t,e),o={in:null,x:null,y:null},n={y:null,x:null},i={top:0,bottom:0,left:0,right:0},{overlapLeft:l,overlapRight:s,overlapTop:a,overlapBottom:c}=g(e,t);i.top=a,i.bottom=c,i.left=l,i.right=s;const p=Object.entries(i).filter((([,t])=>t>0)).sort(((t,e)=>t[1]-e[1])),{dirX:m,dirY:d}=h({overlapLeft:s,overlapRight:l,overlapTop:c,overlapBottom:a});return o.y=d,o.x=m,i.bottom<0?n.y="bottom":i.top<0&&(n.y="top"),i.left<0?n.x="left":i.right<0&&(n.x="right"),o.in=r?i.top===i.bottom&&i.bottom===i.left&&i.left===i.right?"center":p.length?p[0][0]:"top":null,{dirs:o,depth:i,isNeg:n}}const{areElsColliding:T,areElsPerfColliding:v,areElsCollTop:_,areElsCollBottom:C,areElsCollLeft:S,areElsCollRight:A}=r,k=new WeakMap,x=new WeakMap,L={top:new WeakMap,bottom:new WeakMap,left:new WeakMap,right:new WeakMap};class W{static Utils={...r};static createElement(t,e){if("string"!=typeof t)throw new TypeError("[TinyHtml] createElement(): The tagName must be a string.");if(void 0!==e&&"object"!=typeof e)throw new TypeError("[TinyHtml] createElement(): The ops must be a object.");return new W(document.createElement(t,e))}static createTextNode(t){if("string"!=typeof t)throw new TypeError("[TinyHtml] createTextNode(): The value must be a string.");return new W(document.createTextNode(t))}static createElementFromHTML(t){const e=document.createElement("template");if(!(t=t.trim()).startsWith("<"))return W.createTextNode(t);if(e.innerHTML=t,!(e.content.firstChild instanceof Element))throw new Error("");return new W(e.content.firstChild)}static query(t,e=document){const r=e.querySelector(t);return r?new W(r):null}querySelector(t){return W.query(t,W._preElem(this,"query"))}static queryAll(t,e=document){const r=e.querySelectorAll(t);return W.toTinyElm([...r])}querySelectorAll(t){return W.queryAll(t,W._preElem(this,"queryAll"))}static getById(t){const e=document.getElementById(t);return e?new W(e):null}static getByClassName(t,e=document){const r=e.getElementsByClassName(t);return W.toTinyElm([...r])}getElementsByClassName(t){return W.getByClassName(t,W._preElem(this,"getByClassName"))}static getByName(t){const e=document.getElementsByName(t);return W.toTinyElm([...e])}static getByTagNameNS(t,e="http://www.w3.org/1999/xhtml",r=document){const o=r.getElementsByTagNameNS(e,t);return W.toTinyElm([...o])}getElementsByTagNameNS(t,e="http://www.w3.org/1999/xhtml"){return W.getByTagNameNS(t,e,W._preElem(this,"getByTagNameNS"))}get(){return this.#t}_getElement(t){if(!(this.#t instanceof Element||this.#t instanceof Window||this.#t instanceof Document))throw new Error(`[TinyHtml] Invalid Element in ${t}().`);return this.#t}static _preElemsTemplate(t,e,r,o){const n=t=>t.map((t=>{const n=t instanceof W?t._getElement(e):t;let i=!1;for(const t of r)if(n instanceof t){i=!0;break}if(!i)throw new Error(`[TinyHtml] Invalid element of the list "${o.join(",")}" in ${e}().`);return n}));return Array.isArray(t)?n(t):n([t])}static _preElemTemplate(t,e,r,o,n=!1){const i=t=>{const i=t[0];let l=i instanceof W?i._getElement(e):i,s=!1;for(const t of r)if(l instanceof t){s=!0;break}if(n&&null==l&&(l=null,s=!0),!s)throw new Error(`[TinyHtml] Invalid element of the list "${o.join(",")}" in ${e}().`);return l};if(!Array.isArray(t))return i([t]);if(t.length>1)throw new Error(`[TinyHtml] Invalid element amount in ${e}() (Received ${t.length}/1).`);return i(t)}static _preElems(t,e){return W._preElemsTemplate(t,e,[Element],["Element"])}static _preElem(t,e){return W._preElemTemplate(t,e,[Element],["Element"])}static _preNodeElems(t,e){return W._preElemsTemplate(t,e,[Node],["Node"])}static _preNodeElem(t,e){return W._preElemTemplate(t,e,[Node],["Node"])}static _preNodeElemWithNull(t,e){return W._preElemTemplate(t,e,[Node],["Node"],!0)}static _preHtmlElems(t,e){return W._preElemsTemplate(t,e,[HTMLElement],["HTMLElement"])}static _preHtmlElem(t,e){return W._preElemTemplate(t,e,[HTMLElement],["HTMLElement"])}static _preInputElems(t,e){return W._preElemsTemplate(t,e,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}static _preInputElem(t,e){return W._preElemTemplate(t,e,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}static _preEventTargetElems(t,e){return W._preElemsTemplate(t,e,[EventTarget],["EventTarget"])}static _preEventTargetElem(t,e){return W._preElemTemplate(t,e,[EventTarget],["EventTarget"])}static _preElemsAndWindow(t,e){return W._preElemsTemplate(t,e,[Element,Window],["Element","Window"])}static _preElemAndWindow(t,e){return W._preElemTemplate(t,e,[Element,Window],["Element","Window"])}static _preElemsAndWinAndDoc(t,e){return W._preElemsTemplate(t,e,[Element,Window,Document],["Element","Window","Document"]).map((t=>t instanceof Document?t.documentElement:t))}static _preElemAndWinAndDoc(t,e){const r=W._preElemTemplate(t,e,[Element,Window,Document],["Element","Window","Document"]);return r instanceof Document?r.documentElement:r}static toTinyElm(t){const e=t=>t.map((t=>t instanceof W?t:new W(t)));return Array.isArray(t)?e(t):e([t])}static fromTinyElm(t){const e=t=>t.map((t=>t instanceof W?t._getElement("fromTinyElm"):t));return Array.isArray(t)?e(t):e([t])}static winnow(t,e,r,o=!1){if("boolean"!=typeof o)throw new TypeError('The "not" must be a boolean.');if("function"==typeof e)return W._preElems(t,r).filter(((t,r)=>!!e.call(t,r,t)!==o));if(e instanceof Element)return W._preElems(t,r).filter((t=>t===e!==o));if(Array.isArray(e)||"string"!=typeof e&&null!=e.length)return W._preElems(t,r).filter((t=>e.includes(t)!==o));let n=e;return o&&(n=`:not(${n})`),W._preElems(t,r).filter((t=>1===t.nodeType&&t.matches(n)))}static filter(t,e,r=!1){return r&&(e=`:not(${e})`),W._preElems(t,"filter").filter((t=>1===t.nodeType&&t.matches(e)))}static filterOnly(t,e){return W.winnow(t,e,"filterOnly",!1)}static not(t,e){return W.winnow(t,e,"not",!0)}not(t){return W.not(this,t)}static find(t,e){const r=[];for(const o of W._preElems(t,"find"))r.push(...o.querySelectorAll(e));return[...new Set(r)]}find(t){return W.find(this,t)}static is(t,e){return W.winnow(t,e,"is",!1).length>0}is(t){return W.is(this,t)}static has(t,e){const r="string"==typeof e?[...document.querySelectorAll(e)]:W._preElems(e,"has");return W._preElems(t,"has").filter((t=>r.some((e=>t&&t.contains(e)))))}has(t){return W.has(this,t).length>0}static closest(t,e,r){const o=[];for(const n of W._preElems(t,"closest")){let t=n;for(;t&&t!==r;){if(1===t.nodeType&&("string"==typeof e?t.matches(e):t===e)){o.push(t);break}t=t.parentElement}}return[...new Set(o)]}closest(t,e){return W.closest(this,t,e)}static isSameDom(t,e){return W._preNodeElem(t,"isSameDom")===W._preNodeElem(e,"isSameDom")}isSameDom(t){return W.isSameDom(this,t)}_data={};static _dataSelector={public:(t,e)=>{const r=W._preElem(e,t);let o=x.get(r);return o||(o={},x.set(r,o)),o},private:(t,e)=>{if(!(e instanceof W))throw new Error(`Element must be a TinyHtml instance to execute ${t}().`);return e._data}};static data(t,e,r=!1){const o=W._dataSelector[r?"private":"public"]("data",t);if(null==e)return{...o};if("string"!=typeof e)throw new TypeError("The key must be a string.");return o.hasOwnProperty(e)?o[e]:void 0}data(t,e){return W.data(this,t,e)}static setData(t,e,r,o=!1){const n=W._dataSelector[o?"private":"public"]("setData",t);if("string"!=typeof e)throw new TypeError("The key must be a string.");return n[e]=r,t}setData(t,e,r=!1){return W.setData(this,t,e,r)}static _getSibling(t,e,r){let o=W._preNodeElemWithNull(t,r);for(;o&&(o=o[e])&&1!==o.nodeType;);return o instanceof Node?o:null}static _getSiblings(t,e){let r=t;const o=[];for(;r;r=r.nextSibling)1===r.nodeType&&r!==e&&o.push(r);return o}static domDir(t,e,r,o="domDir"){if("string"!=typeof e)throw new TypeError('The "direction" must be a string.');let n=W._preNodeElemWithNull(t,o);const i=[];for(;n&&(n=n[e]);)if(1===n.nodeType){if(r&&("string"==typeof r?n.matches(r):n===r))break;i.push(n)}return i}static parent(t){let e=W._preNodeElemWithNull(t,"parent");const r=e?e.parentNode:null;return r&&11!==r.nodeType?r:null}parent(){return W.parent(this)}static parents(t,e){return W.domDir(t,"parentNode",e,"parents")}parents(t){return W.parents(this,t)}static next(t){return W._getSibling(t,"nextSibling","next")}next(){return W.next(this)}static prev(t){return W._getSibling(t,"previousSibling","prev")}prev(){return W.prev(this)}static nextAll(t){return W.domDir(t,"nextSibling",void 0,"nextAll")}nextAll(){return W.nextAll(this)}static prevAll(t){return W.domDir(t,"previousSibling",void 0,"prevAll")}prevAll(){return W.prevAll(this)}static nextUntil(t,e){return W.domDir(t,"nextSibling",e,"nextUtil")}nextUntil(t){return W.nextUntil(this,t)}static prevUntil(t,e){return W.domDir(t,"previousSibling",e,"prevUtil")}prevUntil(t){return W.prevUntil(this,t)}static siblings(t){const e=W._preNodeElemWithNull(t,"siblings");return W._getSiblings(e&&e.parentNode?e.parentNode.firstChild:null,e)}siblings(){return W.siblings(this)}static children(t){const e=W._preNodeElemWithNull(t,"children");return W._getSiblings(e?e.firstChild:null)}children(){return W.children(this)}static contents(t){const e=W._preNodeElemWithNull(t,"contents");return e instanceof HTMLIFrameElement&&null!=e.contentDocument&&Object.getPrototypeOf(e.contentDocument)?[e.contentDocument]:e instanceof HTMLTemplateElement?Array.from((e.content||e).childNodes):e?Array.from(e.childNodes):[]}contents(){return W.contents(this)}static clone(t,e=!0){if("boolean"!=typeof e)throw new TypeError('The "deep" must be a boolean.');return W._preNodeElems(t,"clone").map((t=>t.cloneNode(e)))}clone(t){return W.clone(this,t)[0]}static _appendChecker(t,...e){const r=[],o=[...e];for(const e in o)"string"!=typeof o[e]?r.push(W._preNodeElem(o[e],t)):r.push(o[e]);return r}static append(t,...e){return W._preElem(t,"append").append(...W._appendChecker("append",...e)),t}append(...t){return W.append(this,...t)}static prepend(t,...e){return W._preElem(t,"prepend").prepend(...W._appendChecker("prepend",...e)),t}prepend(...t){return W.prepend(this,...t)}static before(t,...e){return W._preElem(t,"before").before(...W._appendChecker("before",...e)),t}before(...t){return W.before(this,...t)}static after(t,...e){return W._preElem(t,"after").after(...W._appendChecker("after",...e)),t}after(...t){return W.after(this,...t)}static replaceWith(t,...e){return W._preElem(t,"replaceWith").replaceWith(...W._appendChecker("replaceWith",...e)),t}replaceWith(...t){return W.replaceWith(this,...t)}static appendTo(t,e){const r=W._preNodeElems(t,"appendTo"),o=W._preNodeElems(e,"appendTo");return o.forEach(((t,e)=>{r.forEach((r=>t.appendChild(e===o.length-1?r:r.cloneNode(!0))))})),t}appendTo(t){return W.appendTo(this,t)}static prependTo(t,e){const r=W._preElems(t,"prependTo"),o=W._preElems(e,"prependTo");return o.forEach(((t,e)=>{r.slice().reverse().forEach((r=>t.prepend(e===o.length-1?r:r.cloneNode(!0))))})),t}prependTo(t){return W.prependTo(this,t)}static insertBefore(t,e,r=null){const o=W._preNodeElem(t,"insertBefore"),n=W._preNodeElem(e,"insertBefore"),i=W._preNodeElemWithNull(r,"insertBefore");if(!n.parentNode)throw new Error("");return n.parentNode.insertBefore(o,i||n),t}insertBefore(t,e){return W.insertBefore(this,t,e)}static insertAfter(t,e,r=null){const o=W._preNodeElem(t,"insertAfter"),n=W._preNodeElem(e,"insertBefore"),i=W._preNodeElemWithNull(r,"insertBefore");if(!n.parentNode)throw new Error("");return n.parentNode.insertBefore(o,i||n.nextSibling),t}insertAfter(t,e){return W.insertAfter(this,t,e)}static replaceAll(t,e){const r=W._preNodeElems(t,"replaceAll"),o=W._preNodeElems(e,"replaceAll");return o.forEach(((t,e)=>{const n=t.parentNode;r.forEach((r=>{n&&n.replaceChild(e===o.length-1?r:r.cloneNode(!0),t)}))})),t}replaceAll(t){return W.replaceAll(this,t)}#t;constructor(t){if(t instanceof W)throw new Error("[TinyHtml] You are trying to put a TinyHtml inside another TinyHtml in constructor.");if(!(t instanceof Element||t instanceof Window||t instanceof Document||t instanceof Text))throw new Error("[TinyHtml] Invalid Target in constructor.");this.#t=t}static isWindow(t){return null!=t&&t===t.window}static css(t){const e=W._preElem(t,"css");return window.getComputedStyle(e)}css(){return W.css(this)}static cssString(t,e){const r=W._preElem(t,"cssString");if("string"!=typeof e)throw new TypeError("The prop must be a string.");const o=window.getComputedStyle(r)[e];return"string"==typeof o?o:"number"==typeof o?o.toString():null}cssString(t){return W.cssString(this,t)}static cssList(t,e){const r=W._preElem(t,"cssList");if(!Array.isArray(e))throw new TypeError("The prop must be an array of strings.");const o=window.getComputedStyle(r),n={};for(const t of e)void 0!==t&&(n[t]=o.getPropertyValue(t));return n}cssList(t){return W.cssList(this,t)}static cssFloat(t,e){const r=W._preElem(t,"cssFloat");if("string"!=typeof e)throw new TypeError("The prop must be a string.");const o=window.getComputedStyle(r)[e];return parseFloat(o)||0}cssFloat(t){return W.cssFloat(this,t)}static cssFloats(t,e){const r=W._preElem(t,"cssFloats");if(!Array.isArray(e))throw new TypeError("The prop must be an array of strings.");const o=window.getComputedStyle(r),n={};for(const t of e)n[t]=parseFloat(o[t])||0;return n}cssFloats(t){return W.cssFloats(this,t)}static#e={alignContent:"align-content",alignItems:"align-items",alignSelf:"align-self",animationDelay:"animation-delay",animationDirection:"animation-direction",animationDuration:"animation-duration",animationFillMode:"animation-fill-mode",animationIterationCount:"animation-iteration-count",animationName:"animation-name",animationPlayState:"animation-play-state",animationTimingFunction:"animation-timing-function",backfaceVisibility:"backface-visibility",backgroundAttachment:"background-attachment",backgroundBlendMode:"background-blend-mode",backgroundClip:"background-clip",backgroundColor:"background-color",backgroundImage:"background-image",backgroundOrigin:"background-origin",backgroundPosition:"background-position",backgroundRepeat:"background-repeat",backgroundSize:"background-size",borderBottom:"border-bottom",borderBottomColor:"border-bottom-color",borderBottomLeftRadius:"border-bottom-left-radius",borderBottomRightRadius:"border-bottom-right-radius",borderBottomStyle:"border-bottom-style",borderBottomWidth:"border-bottom-width",borderCollapse:"border-collapse",borderColor:"border-color",borderImage:"border-image",borderImageOutset:"border-image-outset",borderImageRepeat:"border-image-repeat",borderImageSlice:"border-image-slice",borderImageSource:"border-image-source",borderImageWidth:"border-image-width",borderLeft:"border-left",borderLeftColor:"border-left-color",borderLeftStyle:"border-left-style",borderLeftWidth:"border-left-width",borderRadius:"border-radius",borderRight:"border-right",borderRightColor:"border-right-color",borderRightStyle:"border-right-style",borderRightWidth:"border-right-width",borderSpacing:"border-spacing",borderStyle:"border-style",borderTop:"border-top",borderTopColor:"border-top-color",borderTopLeftRadius:"border-top-left-radius",borderTopRightRadius:"border-top-right-radius",borderTopStyle:"border-top-style",borderTopWidth:"border-top-width",borderWidth:"border-width",boxDecorationBreak:"box-decoration-break",boxShadow:"box-shadow",boxSizing:"box-sizing",breakAfter:"break-after",breakBefore:"break-before",breakInside:"break-inside",captionSide:"caption-side",caretColor:"caret-color",clipPath:"clip-path",columnCount:"column-count",columnFill:"column-fill",columnGap:"column-gap",columnRule:"column-rule",columnRuleColor:"column-rule-color",columnRuleStyle:"column-rule-style",columnRuleWidth:"column-rule-width",columnSpan:"column-span",columnWidth:"column-width",counterIncrement:"counter-increment",counterReset:"counter-reset",emptyCells:"empty-cells",flexBasis:"flex-basis",flexDirection:"flex-direction",flexFlow:"flex-flow",flexGrow:"flex-grow",flexShrink:"flex-shrink",flexWrap:"flex-wrap",fontFamily:"font-family",fontFeatureSettings:"font-feature-settings",fontKerning:"font-kerning",fontLanguageOverride:"font-language-override",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontSynthesis:"font-synthesis",fontVariant:"font-variant",fontVariantAlternates:"font-variant-alternates",fontVariantCaps:"font-variant-caps",fontVariantEastAsian:"font-variant-east-asian",fontVariantLigatures:"font-variant-ligatures",fontVariantNumeric:"font-variant-numeric",fontVariantPosition:"font-variant-position",fontWeight:"font-weight",gridArea:"grid-area",gridAutoColumns:"grid-auto-columns",gridAutoFlow:"grid-auto-flow",gridAutoRows:"grid-auto-rows",gridColumn:"grid-column",gridColumnEnd:"grid-column-end",gridColumnGap:"grid-column-gap",gridColumnStart:"grid-column-start",gridGap:"grid-gap",gridRow:"grid-row",gridRowEnd:"grid-row-end",gridRowGap:"grid-row-gap",gridRowStart:"grid-row-start",gridTemplate:"grid-template",gridTemplateAreas:"grid-template-areas",gridTemplateColumns:"grid-template-columns",gridTemplateRows:"grid-template-rows",imageRendering:"image-rendering",justifyContent:"justify-content",letterSpacing:"letter-spacing",lineBreak:"line-break",lineHeight:"line-height",listStyle:"list-style",listStyleImage:"list-style-image",listStylePosition:"list-style-position",listStyleType:"list-style-type",marginBottom:"margin-bottom",marginLeft:"margin-left",marginRight:"margin-right",marginTop:"margin-top",maskClip:"mask-clip",maskComposite:"mask-composite",maskImage:"mask-image",maskMode:"mask-mode",maskOrigin:"mask-origin",maskPosition:"mask-position",maskRepeat:"mask-repeat",maskSize:"mask-size",maskType:"mask-type",maxHeight:"max-height",maxWidth:"max-width",minHeight:"min-height",minWidth:"min-width",mixBlendMode:"mix-blend-mode",objectFit:"object-fit",objectPosition:"object-position",offsetAnchor:"offset-anchor",offsetDistance:"offset-distance",offsetPath:"offset-path",offsetRotate:"offset-rotate",outlineColor:"outline-color",outlineOffset:"outline-offset",outlineStyle:"outline-style",outlineWidth:"outline-width",overflowAnchor:"overflow-anchor",overflowWrap:"overflow-wrap",overflowX:"overflow-x",overflowY:"overflow-y",paddingBottom:"padding-bottom",paddingLeft:"padding-left",paddingRight:"padding-right",paddingTop:"padding-top",pageBreakAfter:"page-break-after",pageBreakBefore:"page-break-before",pageBreakInside:"page-break-inside",perspectiveOrigin:"perspective-origin",placeContent:"place-content",placeItems:"place-items",placeSelf:"place-self",pointerEvents:"pointer-events",rowGap:"row-gap",scrollBehavior:"scroll-behavior",scrollMargin:"scroll-margin",scrollMarginBlock:"scroll-margin-block",scrollMarginBlockEnd:"scroll-margin-block-end",scrollMarginBlockStart:"scroll-margin-block-start",scrollMarginBottom:"scroll-margin-bottom",scrollMarginInline:"scroll-margin-inline",scrollMarginInlineEnd:"scroll-margin-inline-end",scrollMarginInlineStart:"scroll-margin-inline-start",scrollMarginLeft:"scroll-margin-left",scrollMarginRight:"scroll-margin-right",scrollMarginTop:"scroll-margin-top",scrollPadding:"scroll-padding",scrollPaddingBlock:"scroll-padding-block",scrollPaddingBlockEnd:"scroll-padding-block-end",scrollPaddingBlockStart:"scroll-padding-block-start",scrollPaddingBottom:"scroll-padding-bottom",scrollPaddingInline:"scroll-padding-inline",scrollPaddingInlineEnd:"scroll-padding-inline-end",scrollPaddingInlineStart:"scroll-padding-inline-start",scrollPaddingLeft:"scroll-padding-left",scrollPaddingRight:"scroll-padding-right",scrollPaddingTop:"scroll-padding-top",scrollSnapAlign:"scroll-snap-align",scrollSnapStop:"scroll-snap-stop",scrollSnapType:"scroll-snap-type",shapeImageThreshold:"shape-image-threshold",shapeMargin:"shape-margin",shapeOutside:"shape-outside",tabSize:"tab-size",tableLayout:"table-layout",textAlign:"text-align",textAlignLast:"text-align-last",textCombineUpright:"text-combine-upright",textDecoration:"text-decoration",textDecorationColor:"text-decoration-color",textDecorationLine:"text-decoration-line",textDecorationStyle:"text-decoration-style",textIndent:"text-indent",textJustify:"text-justify",textOrientation:"text-orientation",textOverflow:"text-overflow",textShadow:"text-shadow",textTransform:"text-transform",transformBox:"transform-box",transformOrigin:"transform-origin",transformStyle:"transform-style",transitionDelay:"transition-delay",transitionDuration:"transition-duration",transitionProperty:"transition-property",transitionTimingFunction:"transition-timing-function",unicodeBidi:"unicode-bidi",userSelect:"user-select",verticalAlign:"vertical-align",whiteSpace:"white-space",willChange:"will-change",wordBreak:"word-break",wordSpacing:"word-spacing",wordWrap:"word-wrap",writingMode:"writing-mode",zIndex:"z-index",WebkitTransform:"-webkit-transform",WebkitTransition:"-webkit-transition",WebkitBoxShadow:"-webkit-box-shadow",MozBoxShadow:"-moz-box-shadow",MozTransform:"-moz-transform",MozTransition:"-moz-transition",msTransform:"-ms-transform",msTransition:"-ms-transition"};static cssPropAliases=new Proxy(W.#e,{set:(t,e,r)=>(t[e]=r,W.cssPropRevAliases[r]=e,!0)});static cssPropRevAliases=Object.fromEntries(Object.entries(W.#e).map((([t,e])=>[e,t])));static toStyleKc(t){return"string"==typeof W.cssPropAliases[t]?W.cssPropAliases[t]:t}static toStyleCc(t){return"string"==typeof W.cssPropRevAliases[t]?W.cssPropRevAliases[t]:t}static setStyle(t,e,r=null){return W._preHtmlElems(t,"setStyle").forEach((t=>{if("object"==typeof e)for(const[r,o]of Object.entries(e))t.style.setProperty(W.toStyleKc(r),"string"==typeof o?o:"number"==typeof o?`${o}px`:String(o));else t.style.setProperty(W.toStyleKc(e),r)})),t}setStyle(t,e){return W.setStyle(this,t,e)}static getStyle(t,e){return W._preHtmlElem(t,"getStyle").style.getPropertyValue(W.toStyleKc(e))}getStyle(t){return W.getStyle(this,t)}static style(t,{camelCase:e=!1,rawAttr:r=!1}={}){if("boolean"!=typeof e)throw new TypeError('"camelCase" must be a boolean. Received: '+typeof e);if("boolean"!=typeof r)throw new TypeError('"rawAttr" must be a boolean. Received: '+typeof r);const o=W._preHtmlElem(t,"style"),n={};if(r){const t=(o.getAttribute("style")||"").split(";");for(const r of t){const[t,o]=r.split(":");if(!t||!o)continue;const i=t.trim(),l=o.trim();n[e?W.toStyleCc(i):i]=l}}else{const t=o.style;for(let r=0;r<t.length;r++){const o=t[r],i=t.getPropertyValue(o);n[e?W.toStyleCc(o):o]=i}}return n}style(t){return W.style(this,t)}static removeStyle(t,e){return W._preHtmlElems(t,"removeStyle").forEach((t=>{if(Array.isArray(e))for(const r of e)t.style.removeProperty(W.toStyleKc(r));else t.style.removeProperty(W.toStyleKc(e))})),t}removeStyle(t){return W.removeStyle(this,t)}static toggleStyle(t,e,r,o){return W._preHtmlElems(t,"toggleStyle").forEach((t=>{const n=W.getStyle(t,e).trim()===W.toStyleKc(r)?o:r;W.setStyle(t,e,n)})),t}toggleStyle(t,e,r){return W.toggleStyle(this,t,e,r)}static clearStyle(t){return W._preElems(t,"clearStyle").forEach((t=>t.removeAttribute("style"))),t}clearStyle(){return W.clearStyle(this)}static focus(t){return W._preHtmlElem(t,"focus").focus(),t}focus(){return W.focus(this)}static blur(t){return W._preHtmlElem(t,"blur").blur(),t}blur(){return W.blur(this)}static boolCheck(t){return void 0!==t&&("true"===t||"1"===t||!0===t||"on"===t||"number"==typeof t&&t>0)}static setWinScrollTop(t){if("number"!=typeof t)throw new TypeError("The value must be a number.");W.setScrollTop(window,t)}static setWinScrollLeft(t){if("number"!=typeof t)throw new TypeError("The value must be a number.");W.setScrollLeft(window,t)}static winScrollTop(){return window.scrollY||document.documentElement.scrollTop}static winScrollLeft(){return window.scrollX||document.documentElement.scrollLeft}static winInnerHeight(){return window.innerHeight||document.documentElement.clientHeight}static winInnerWidth(){return window.innerWidth||document.documentElement.clientWidth}static isPageTop(){return 0===window.scrollY}static isPageBottom(){return window.innerHeight+window.scrollY>=document.body.offsetHeight}static getDimension(t,e,r="content"){const o=W._preElemAndWinAndDoc(t,"getDimension");if("string"!=typeof e)throw new TypeError("The type must be a string.");if("string"!=typeof r)throw new TypeError("The extra must be a string.");const n="width"===e?"Width":"Height";if(W.isWindow(o))return"margin"===r?o["inner"+n]:o.document.documentElement["client"+n];const i=o;if(9===i.nodeType){const t=i.documentElement;return Math.max(i.body["scroll"+n],t["scroll"+n],i.body["offset"+n],t["offset"+n],t["client"+n])}let l=i.getBoundingClientRect()[e];function s(t){return"width"===e?W.cssFloat(i,t+"Left")+W.cssFloat(i,t+"Right"):W.cssFloat(i,t+"Top")+W.cssFloat(i,t+"Bottom")}switch(r){case"content":l-=s("padding"),l-=s("border");break;case"padding":l-=s("border");break;case"border":break;case"margin":l+=s("margin")}return l}getDimension(t,e){return W.getDimension(this,t,e)}static setHeight(t,e){const r=W._preHtmlElem(t,"setHeight");if("number"!=typeof e&&"string"!=typeof e)throw new TypeError("The value must be a string or number.");return r.style.height="number"==typeof e?`${e}px`:e,t}setHeight(t){return W.setHeight(this,t)}static setWidth(t,e){const r=W._preHtmlElem(t,"setWidth");if("number"!=typeof e&&"string"!=typeof e)throw new TypeError("The value must be a string or number.");return r.style.width="number"==typeof e?`${e}px`:e,t}setWidth(t){return W.setWidth(this,t)}static height(t){const e=W._preElemAndWinAndDoc(t,"height");return W.getDimension(e,"height","content")}height(){return W.height(this)}static width(t){const e=W._preElemAndWinAndDoc(t,"width");return W.getDimension(e,"width","content")}width(){return W.width(this)}static innerHeight(t){const e=W._preElemAndWinAndDoc(t,"innerHeight");return W.getDimension(e,"height","padding")}innerHeight(){return W.innerHeight(this)}static innerWidth(t){const e=W._preElemAndWinAndDoc(t,"innerWidth");return W.getDimension(e,"width","padding")}innerWidth(){return W.innerWidth(this)}static outerHeight(t,e=!1){if("boolean"!=typeof e)throw new TypeError('The "includeMargin" must be a boolean.');const r=W._preElemAndWinAndDoc(t,"outerHeight");return W.getDimension(r,"height",e?"margin":"border")}outerHeight(t){return W.outerHeight(this,t)}static outerWidth(t,e=!1){if("boolean"!=typeof e)throw new TypeError('The "includeMargin" must be a boolean.');const r=W._preElemAndWinAndDoc(t,"outerWidth");return W.getDimension(r,"width",e?"margin":"border")}outerWidth(t){return W.outerWidth(this,t)}static animate(t,e,r){return W._preElems(t,"animate").forEach((t=>t.animate(e,r))),t}animate(t,e){return W.animate(this,t,e)}static offset(t){const e=W._preElem(t,"offset").getBoundingClientRect(),r=window.scrollY||document.documentElement.scrollTop,o=window.scrollX||document.documentElement.scrollLeft;return{top:e.top+r,left:e.left+o}}offset(){return W.offset(this)}static position(t){const e=W._preHtmlElem(t,"position");let r,o,n={top:0,left:0};if("fixed"===window.getComputedStyle(e).position)o=e.getBoundingClientRect();else{o=W.offset(e),r=e.offsetParent||document.documentElement;const{position:t}=window.getComputedStyle(r);for(;r instanceof HTMLElement&&(r===document.body||r===document.documentElement)&&"static"===t;)r=r.parentNode;if(r instanceof HTMLElement&&r!==e&&1===r.nodeType){const{borderTopWidth:t,borderLeftWidth:e}=W.cssFloats(r,["borderTopWidth","borderLeftWidth"]);n=W.offset(r),n.top+=t,n.left+=e}}return{top:o.top-n.top-W.cssFloat(e,"marginTop"),left:o.left-n.left-W.cssFloat(e,"marginLeft")}}position(){return W.position(this)}static offsetParent(t){let e=W._preHtmlElem(t,"offsetParent").offsetParent;for(;e instanceof HTMLElement&&"static"===window.getComputedStyle(e).position;)e=e.offsetParent;return e instanceof HTMLElement?e:document.documentElement}offsetParent(){return W.offsetParent(this)}static scrollTop(t){const e=W._preElemAndWindow(t,"scrollTop");return W.isWindow(e)?e.pageYOffset:9===e.nodeType?e.defaultView.pageYOffset:e.scrollTop}scrollTop(){return W.scrollTop(this)}static scrollLeft(t){const e=W._preElemAndWindow(t,"scrollLeft");return W.isWindow(e)?e.pageXOffset:9===e.nodeType?e.defaultView.pageXOffset:e.scrollLeft}scrollLeft(){return W.scrollLeft(this)}static easings={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>t*(2-t),easeInOutQuad:t=>t<.5?2*t*t:(4-2*t)*t-1,easeInCubic:t=>t*t*t,easeOutCubic:t=>--t*t*t+1,easeInOutCubic:t=>t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1};static scrollToXY(t,{targetX:e,targetY:r,duration:o,easing:n,onAnimation:i}={}){if(void 0!==e&&"number"!=typeof e)throw new TypeError("`targetX` must be a number if provided.");if(void 0!==r&&"number"!=typeof r)throw new TypeError("`targetY` must be a number if provided.");if(void 0!==o&&"number"!=typeof o)throw new TypeError("`duration` must be a number if provided.");if(void 0!==n&&"string"!=typeof n)throw new TypeError("`easing` must be a string if provided.");if(void 0!==n&&"function"!=typeof W.easings[n])throw new TypeError(`Unknown easing function: "${n}".`);if(void 0!==i&&"function"!=typeof i)throw new TypeError("`onAnimation` must be a function if provided.");const l=(t,e,r,o)=>{if(t instanceof Window)window.scrollTo(e,r);else if(9===t.nodeType)t.defaultView.scrollTo(e,r);else{const o=t instanceof Window?window.scrollX:t.scrollLeft,n=t instanceof Window?window.scrollY:t.scrollTop;o!==e&&(t.scrollLeft=e),n!==r&&(t.scrollTop=r)}"function"==typeof i&&i({x:e,y:r,isComplete:o>=1,time:o})};return W._preElemsAndWindow(t,"scrollToXY").forEach((t=>{const i=t instanceof Window?window.scrollX:t.scrollLeft,s=t instanceof Window?window.scrollY:t.scrollTop,a=e??i,c=r??s,p=a-i,m=c-s,u="string"==typeof n&&W.easings[n]||null;if("number"!=typeof o||"function"!=typeof u)return l(t,a,c,1);const d=performance.now(),f=o??0;requestAnimationFrame((function e(r){if("function"!=typeof u)return;const o=Math.min(1,(r-d)/f),n=u(o);l(t,i+p*n,s+m*n,o),o<1&&requestAnimationFrame(e)}))})),t}scrollToXY({targetX:t,targetY:e,duration:r,easing:o,onAnimation:n}={}){return W.scrollToXY(this,{targetX:t,targetY:e,duration:r,easing:o,onAnimation:n})}static setScrollTop(t,e){if("number"!=typeof e)throw new TypeError("ScrollTop value must be a number.");return W.scrollToXY(t,{targetY:e})}setScrollTop(t){return W.setScrollTop(this,t)}static setScrollLeft(t,e){if("number"!=typeof e)throw new TypeError("ScrollLeft value must be a number.");return W.scrollToXY(t,{targetX:e})}setScrollLeft(t){return W.setScrollLeft(this,t)}static borderWidth(t){const e=W._preElem(t,"borderWidth"),{borderLeftWidth:r,borderRightWidth:o,borderTopWidth:n,borderBottomWidth:i}=W.cssFloats(e,["borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"]);return{x:r+o,y:n+i,left:r,right:o,top:n,bottom:i}}borderWidth(){return W.borderWidth(this)}static border(t){const e=W._preElem(t,"border"),{borderLeft:r,borderRight:o,borderTop:n,borderBottom:i}=W.cssFloats(e,["borderLeft","borderRight","borderTop","borderBottom"]);return{x:r+o,y:n+i,left:r,right:o,top:n,bottom:i}}border(){return W.border(this)}static margin(t){const e=W._preElem(t,"margin"),{marginLeft:r,marginRight:o,marginTop:n,marginBottom:i}=W.cssFloats(e,["marginLeft","marginRight","marginTop","marginBottom"]);return{x:r+o,y:n+i,left:r,right:o,top:n,bottom:i}}margin(){return W.margin(this)}static padding(t){const e=W._preElem(t,"padding"),{paddingLeft:r,paddingRight:o,paddingTop:n,paddingBottom:i}=W.cssFloats(e,["paddingLeft","paddingRight","paddingTop","paddingBottom"]);return{x:r+o,y:n+i,left:r,right:o,top:n,bottom:i}}padding(){return W.padding(this)}static addClass(t,...e){return W._preElems(t,"addClass").forEach((t=>t.classList.add(...e))),t}addClass(...t){return W.addClass(this,...t)}static removeClass(t,...e){return W._preElems(t,"removeClass").forEach((t=>t.classList.remove(...e))),t}removeClass(...t){return W.removeClass(this,...t)}static replaceClass(t,e,r){if("string"!=typeof e)throw new TypeError('The "token" parameter must be a string.');if("string"!=typeof r)throw new TypeError('The "newToken" parameter must be a string.');const o=[];return W._preElems(t,"replaceClass").forEach((t=>o.push(t.classList.replace(e,r)))),o}replaceClass(t,e){return W.replaceClass(this,t,e)[0]}static classItem(t,e){const r=W._preElem(t,"classItem");if("number"!=typeof e)throw new TypeError('The "index" parameter must be a number.');return r.classList.item(e)}classItem(t){return W.classItem(this,t)}static toggleClass(t,e,r){if("string"!=typeof e)throw new TypeError('The "token" parameter must be a string.');if(void 0!==r&&"boolean"!=typeof r)throw new TypeError('The "force" parameter must be a boolean.');const o=[];return W._preElems(t,"toggleClass").forEach((t=>o.push(t.classList.toggle(e,r)))),o}toggleClass(t,e){return W.toggleClass(this,t,e)[0]}static hasClass(t,e){const r=W._preElem(t,"hasClass");if("string"!=typeof e)throw new TypeError('The "token" parameter must be a string.');return r.classList.contains(e)}hasClass(t){return W.hasClass(this,t)}static classLength(t){return W._preElem(t,"classLength").classList.length}classLength(){return W.classLength(this)}static classList(t){return W._preElem(t,"classList").classList.values().toArray()}classList(){return W.classList(this)}static tagName(t){return W._preElem(t,"tagName").tagName}tagName(){return W.tagName(this)}static id(t){return W._preElem(t,"id").id}id(){return W.id(this)}static text(t){return W._preElem(t,"text").textContent}text(){return W.text(this)}static setText(t,e){if("string"!=typeof e)throw new Error("Value is not a valid string.");return W._preElems(t,"setText").forEach((t=>t.textContent=e)),t}setText(t){return W.setText(this,t)}static empty(t){return W._preElems(t,"empty").forEach((t=>t.textContent="")),t}empty(){return W.empty(this)}static html(t,e){return W._preElem(t,"html").getHTML(e)}html(t){return W.html(this,t)}static setHtml(t,e){if("string"!=typeof e)throw new Error("Value is not a valid string.");return W._preElems(t,"setHtml").forEach((t=>t.innerHTML=e)),t}setHtml(t){return W.setHtml(this,t)}static _valHooks={option:{get:t=>{const e=t.getAttribute("value");return null!=e?e:t.textContent}},select:{get:t=>{const e=t.options,r=t.selectedIndex,o="select-one"===t.type,n=o?r+1:e.length,i=[];let l=r<0?n:o?r:0;for(;l<n;l++){const t=e[l],n=t.parentNode;if((t.selected||l===r)&&!t.disabled&&(!n||!n.disabled||"OPTGROUP"!==n.tagName)){const e=W._valHooks.option.get(t);if(o)return e;i.push(e)}}return i},set:(t,e)=>{const r=t.options,o=Array.isArray(e)?e.map(String):[String(e)];let n=!1;for(let t=0;t<r.length;t++){const e=r[t],i=W._valHooks.option.get(e);"string"==typeof i&&(e.selected=o.includes(i))&&(n=!0)}return n||(t.selectedIndex=-1),o}},radio:{get:t=>t.checked?"on":"off",set(t,e){if("boolean"==typeof e){const r=t.closest("label");return e&&r&&r.querySelectorAll('input[type="radio"]').forEach((e=>{e instanceof HTMLInputElement&&e!==t&&(e.checked=!1)})),t.checked=e,e}}},checkbox:{get:t=>t.checked?"on":"off",set(t,e){if("boolean"==typeof e)return t.checked=e,e}}};static setVal(t,e){return W._preInputElems(t,"setVal").forEach((t=>{if(1!==t.nodeType)return;let r="function"==typeof e?e(t,W.val(t)):e;null==r?r="":"number"==typeof r?r=String(r):Array.isArray(r)&&(r=(t=>{const e=[];for(let o=0;o<t.length;o++)e.push(null==(r=t[o])?"":String(r));var r;return e})(r));const o=W._valHooks[t.type]||W._valHooks[t.nodeName.toLowerCase()];if(!o||"function"!=typeof o.set||void 0===o.set(t,r,"value")){if("string"!=typeof r&&"boolean"!=typeof r)throw new Error(`Invalid setValue "${typeof r}" value.`);"string"==typeof r&&(t.value=r)}})),t}setVal(t){return W.setVal(this,t)}static _valTypes={string:t=>t.value,date:t=>t.valueAsDate,number:t=>t.valueAsNumber};static _getValByType(t,e,r){if("string"!=typeof e)throw new TypeError('The "type" must be a string.');if("string"!=typeof r)throw new TypeError('The "where" must be a string.');if(!(t instanceof HTMLInputElement))throw new Error(`Provided element is not an HTMLInputElement in ${r}().`);if("function"!=typeof W._valTypes[e])throw new Error(`No handler found for type "${e}" in ${r}().`);return W._valTypes[e](t)}static _val(t,e,r){const o=W._preInputElem(t,e),n=W._valHooks[o.type]||W._valHooks[o.nodeName.toLowerCase()];if(n&&"function"==typeof n.get){const t=n.get(o,"value",r);if(void 0!==t)return"string"==typeof t?t.replace(/\r/g,""):t}return W._getValByType(o,r,e)}_val(t,e){return W._val(this,t,e)}static val(t){return W._val(t,"val","string")}val(){return W.val(this)}static valTxt(t){const e=W._val(t,"valTxt","string");if("string"!=typeof e&&null!==e)throw new Error("Value is not a valid string.");return null==e?"":"string"==typeof e?e.replace(/\r/g,""):e}valTxt(){return W.valTxt(this)}static _valArr(t,e,r){const o=W._val(t,e,r);if(!Array.isArray(o))throw new Error(`Value expected an array but got ${typeof o}.`);return o}_valArr(t,e){return W._valArr(this,t,e)}static valArr(t){return W._valArr(t,"valArr","string")}valArr(){return W.valArr(this)}static valNb(t){if(!(W._preInputElem(t,"valNb")instanceof HTMLInputElement))throw new Error("Element must be an input element.");const e=W._val(t,"valNb","number");if(Number.isNaN(e))throw new Error("Value is not a valid number.");return e}valNb(){return W.valNb(this)}static valDate(t){if(!(W._preInputElem(t,"valDate")instanceof HTMLInputElement))throw new Error("Element must be an input element.");const e=W._val(t,"valDate","date");if(!(e instanceof Date))throw new Error("Value is not a valid date.");return e}valDate(){return W.valDate(this)}static valBool(t){const e=W._preInputElem(t,"valBool");if(!(e instanceof HTMLInputElement))throw new Error("Element must be an input element.");return"on"===W.val(e)}valBool(){return W.valBool(this)}static on(t,e,r,o){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return W._preEventTargetElems(t,"on").forEach((t=>{t.addEventListener(e,r,o),k.has(t)||k.set(t,{});const n=k.get(t);n&&(Array.isArray(n[e])||(n[e]=[]),n[e].push({handler:r,options:o}))})),t}on(t,e,r){return W.on(this,t,e,r)}static once(t,e,r,o={}){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return W._preEventTargetElems(t,"once").forEach((t=>{const n=o=>{W.off(t,e,n),r(o)};W.on(t,e,n,"boolean"==typeof o?o:{...o,once:!0})})),t}once(t,e,r={}){return W.once(this,t,e,r)}static off(t,e,r,o){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return W._preEventTargetElems(t,"off").forEach((t=>{t.removeEventListener(e,r,o);const n=k.get(t);n&&n[e]&&(n[e]=n[e].filter((t=>t.handler!==r)),0===n[e].length&&delete n[e])})),t}off(t,e,r){return W.off(this,t,e,r)}static offAll(t,e){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return W._preEventTargetElems(t,"offAll").forEach((t=>{const r=k.get(t);if(r&&r[e]){for(const o of r[e])t.removeEventListener(e,o.handler,o.options);delete r[e]}})),t}offAll(t){return W.offAll(this,t)}static offAllTypes(t,e=null){if(null!==e&&"function"!=typeof e)throw new TypeError('The "filterFn" must be a function.');return W._preEventTargetElems(t,"offAllTypes").forEach((t=>{const r=k.get(t);if(r){for(const o in r)for(const n of r[o])("function"!=typeof e||e(n.handler,o))&&t.removeEventListener(o,n.handler,n.options);k.delete(t)}})),t}offAllTypes(t=null){return W.offAllTypes(this,t)}static trigger(t,e,r={}){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return W._preEventTargetElems(t,"trigger").forEach((t=>{const o=r instanceof Event||r instanceof CustomEvent?r:new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t.dispatchEvent(o)})),t}trigger(t,e={}){return W.trigger(this,t,e)}static _propFix={for:"htmlFor",class:"className"};static attr(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return W._preElem(t,"attr").getAttribute(e)}attr(t){return W.attr(this,t)}static setAttr(t,e,r=null){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');if(null!==r&&"string"!=typeof r)throw new TypeError('The "value" must be a string.');return W._preElems(t,"setAttr").forEach((t=>{null===r?t.removeAttribute(e):t.setAttribute(e,r)})),t}setAttr(t,e){return W.setAttr(this,t,e)}static removeAttr(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return W._preElems(t,"removeAttr").forEach((t=>t.removeAttribute(e))),t}removeAttr(t){return W.removeAttr(this,t)}static hasAttr(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return W._preElem(t,"hasAttr").hasAttribute(e)}hasAttr(t){return W.hasAttr(this,t)}static hasProp(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return!!W._preElem(t,"hasProp")[W._propFix[e]||e]}hasProp(t){return W.hasProp(this,t)}static addProp(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return W._preElems(t,"addProp").forEach((t=>{t[e=W._propFix[e]||e]=!0})),t}addProp(t){return W.addProp(this,t)}static removeProp(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return W._preElems(t,"removeProp").forEach((t=>{t[e=W._propFix[e]||e]=!1})),t}removeProp(t){return W.removeProp(this,t)}static toggleProp(t,e,r){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');if(void 0!==r&&"boolean"!=typeof r)throw new TypeError('The "force" must be a boolean.');W._preElems(t,"toggleProp").forEach((t=>{const o=W._propFix[e]||e;(void 0===r?!t[o]:r)?W.addProp(t,e):W.removeProp(t,e)}))}toggleProp(t,e){return W.toggleProp(this,t,e)}static remove(t){return W._preElems(t,"remove").forEach((t=>t.remove())),t}remove(){return W.remove(this)}static index(t,e=null){const r=W._preElem(t,"index");if(!r)return-1;if(!e)return Array.prototype.indexOf.call(r.parentNode?.children||[],r);if(e){const t="string"==typeof e?document.querySelectorAll(e):W._preElems(e,"index");return Array.prototype.indexOf.call(t,r)}return-1}index(t){return W.index(this,t)}static _getCustomRect(t,e){const r={height:0,width:0,x:0,y:0,bottom:0,left:0,right:0,top:0,toJSON:function(){throw new Error("Function not implemented.")}};for(const e in t)"number"==typeof t[e]&&(r[e]=t[e]);if("object"!=typeof e||null===e||Array.isArray(e))throw new Error("");const{height:o=0,width:n=0,top:i=0,bottom:l=0,left:s=0,right:a=0}=e;if("number"!=typeof o)throw new Error("");if("number"!=typeof n)throw new Error("");if("number"!=typeof i)throw new Error("");if("number"!=typeof l)throw new Error("");if("number"!=typeof s)throw new Error("");if("number"!=typeof a)throw new Error("");return r.height+=o,r.width+=n,r.top+=i,r.bottom+=l,r.left+=s,r.right+=a,r}static isCollWith(t,e,r={}){const o=W._getCustomRect(W._preElem(t,"isCollWith").getBoundingClientRect(),r),n=W._preElem(e,"isCollWith").getBoundingClientRect();return T(o,n)}isCollWith(t,e){return W.isCollWith(this,t,e)}static isCollPerfWith(t,e,r={}){const o=W._getCustomRect(W._preElem(t,"isCollPerfWith").getBoundingClientRect(),r),n=W._preElem(e,"isCollPerfWith").getBoundingClientRect();return v(o,n)}isCollPerfWith(t,e){return W.isCollPerfWith(this,t,e)}static _isCollWithLock(t,e,r,o,n){const i=L[n];if(t)return i.has(o)||i.set(o,!0),!0;if(i.has(o)){let t=!1;switch(n){case"top":t=_(e,r);break;case"bottom":t=C(e,r);break;case"left":t=S(e,r);break;case"right":t=A(e,r)}return t&&i.delete(o),i.has(o)}return!1}static isCollWithLock(t,e,r,o={}){const n=W._preElem(t,"isCollWithLock"),i=W._preElem(e,"isCollWithLock"),l=W._getCustomRect(n.getBoundingClientRect(),o),s=i.getBoundingClientRect(),a=T(l,s);return W._isCollWithLock(a,l,s,n,r)}isCollWithLock(t,e,r){return W.isCollWithLock(this,t,e,r)}static isCollPerfWithLock(t,e,r,o={}){const n=W._preElem(t,"isCollPerfWithLock"),i=W._preElem(e,"isCollPerfWithLock"),l=W._getCustomRect(n.getBoundingClientRect(),o),s=i.getBoundingClientRect(),a=v(l,s);return W._isCollWithLock(a,l,s,n,r)}isCollPerfWithLock(t,e,r){return W.isCollPerfWithLock(this,t,e,r)}static resetCollLock(t){const e=W._preElem(t,"resetCollLock");let r=!1;for(const t of["top","bottom","left","right"])L[t].has(e)&&(L[t].delete(e),r=!0);return r}resetCollLock(){return W.resetCollLock(this)}static resetCollLockDir(t,e){const r=W._preElem(t,"resetCollLockDir"),o=L[e];return!!o.has(r)&&(o.delete(r),!0)}resetCollLockDir(t){return W.resetCollLockDir(this,t)}static isInViewport(t){const e=W._preElem(t,"isInViewport");if(!e.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const r=W.offset(e).top,o=r+W.outerHeight(e),n=W.scrollTop(window),i=n+W.height(window);return o>n&&r<i}isInViewport(){return W.isInViewport(this)}static isScrolledIntoView(t){const e=W._preElem(t,"isScrolledIntoView");if(!e.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const r=W.scrollTop(window),o=r+W.height(window),n=W.offset(e).top;return n+W.height(e)<=o&&n>=r}isScrolledIntoView(){return W.isScrolledIntoView(this)}static isInContainer(t,e){const r=W._preElem(t,"isInContainer"),o=W._preElem(e,"isInContainer");if(!r.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const n=r.getBoundingClientRect(),i=o.getBoundingClientRect(),l=n.bottom>i.top&&n.top<i.bottom,s=n.right>i.left&&n.left<i.right;return l&&s}isInContainer(t){return W.isInContainer(this,t)}static isFullyInContainer(t,e){const r=W._preElem(t,"isScrolledIntoView"),o=W._preElem(e,"isInContainer");if(!r.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const n=r.getBoundingClientRect(),i=o.getBoundingClientRect();return n.top>=i.top&&n.bottom<=i.bottom&&n.left>=i.left&&n.right<=i.right}isFullyInContainer(t){return W.isFullyInContainer(this,t)}static hasScroll(t){const e=W._preElem(t,"hasScroll");return{v:e.scrollHeight>e.clientHeight,h:e.scrollWidth>e.clientWidth}}hasScroll(){return W.hasScroll(this)}}const N=W;window.TinyHtml=e.TinyHtml})();