tiny-essentials 1.18.0 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -3
- package/dist/legacy/get/countObj.cjs +2 -2
- package/dist/legacy/get/countObj.d.mts +1 -1
- package/dist/legacy/get/countObj.mjs +1 -1
- package/dist/legacy/index.cjs +2 -1
- package/dist/node_modules/firebase-functions/lib/common/trace.cjs +0 -1
- package/dist/node_modules/firebase-functions/lib/logger/index.cjs +1 -0
- package/dist/v1/ColorSafeStringify.min.js +1 -1
- package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
- package/dist/v1/TinyBasicsEs.js +402 -390
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyClipboard.min.js +1 -1
- package/dist/v1/TinyColorConverter.js +617 -0
- package/dist/v1/TinyColorConverter.min.js +1 -0
- package/dist/v1/TinyDomReadyManager.min.js +1 -1
- package/dist/v1/TinyDragger.js +6 -2433
- package/dist/v1/TinyDragger.min.js +1 -2
- package/dist/v1/TinyEssentials.js +3546 -1388
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyEvents.js +402 -0
- package/dist/v1/TinyEvents.min.js +1 -0
- package/dist/v1/TinyHtml.min.js +1 -1
- package/dist/v1/TinyLocalStorage.js +1292 -0
- package/dist/v1/TinyLocalStorage.min.js +1 -0
- package/dist/v1/TinyNotifications.min.js +1 -1
- package/dist/v1/TinyNotifyCenter.min.js +1 -1
- package/dist/v1/TinyPromiseQueue.min.js +1 -1
- package/dist/v1/TinyRateLimiter.js +2 -1
- package/dist/v1/TinyRateLimiter.min.js +1 -1
- package/dist/v1/TinySmartScroller.js +570 -52
- package/dist/v1/TinySmartScroller.min.js +1 -1
- package/dist/v1/TinyTextRangeEditor.min.js +1 -1
- package/dist/v1/TinyTimeout.js +233 -0
- package/dist/v1/TinyTimeout.min.js +1 -0
- package/dist/v1/TinyToastNotify.min.js +1 -1
- package/dist/v1/TinyUploadClicker.js +2087 -1129
- package/dist/v1/TinyUploadClicker.min.js +1 -1
- package/dist/v1/UltraRandomMsgGen.min.js +1 -1
- package/dist/v1/basics/html.cjs +16 -9
- package/dist/v1/basics/html.d.mts +12 -4
- package/dist/v1/basics/html.mjs +14 -7
- package/dist/v1/basics/index.cjs +3 -2
- package/dist/v1/basics/index.d.mts +2 -2
- package/dist/v1/basics/index.mjs +2 -1
- package/dist/v1/basics/objChecker.cjs +46 -0
- package/dist/v1/basics/objChecker.d.mts +29 -0
- package/dist/v1/basics/objChecker.mjs +45 -0
- package/dist/v1/basics/objFilter.cjs +4 -45
- package/dist/v1/basics/objFilter.d.mts +3 -28
- package/dist/v1/basics/objFilter.mjs +2 -45
- package/dist/v1/build/TinyColorConverter.cjs +7 -0
- package/dist/v1/build/TinyColorConverter.d.mts +3 -0
- package/dist/v1/build/TinyColorConverter.mjs +2 -0
- package/dist/v1/build/TinyEvents.cjs +7 -0
- package/dist/v1/build/TinyEvents.d.mts +3 -0
- package/dist/v1/build/TinyEvents.mjs +2 -0
- package/dist/v1/build/TinyLocalStorage.cjs +7 -0
- package/dist/v1/build/TinyLocalStorage.d.mts +3 -0
- package/dist/v1/build/TinyLocalStorage.mjs +2 -0
- package/dist/v1/build/TinyTimeout.cjs +7 -0
- package/dist/v1/build/TinyTimeout.d.mts +3 -0
- package/dist/v1/build/TinyTimeout.mjs +2 -0
- package/dist/v1/index.cjs +11 -2
- package/dist/v1/index.d.mts +7 -3
- package/dist/v1/index.mjs +7 -2
- package/dist/v1/libs/TinyColorConverter.cjs +578 -0
- package/dist/v1/libs/TinyColorConverter.d.mts +396 -0
- package/dist/v1/libs/TinyColorConverter.mjs +520 -0
- package/dist/v1/libs/TinyDragger.cjs +3 -3
- package/dist/v1/libs/TinyDragger.mjs +1 -1
- package/dist/v1/libs/TinyEvents.cjs +363 -0
- package/dist/v1/libs/TinyEvents.d.mts +160 -0
- package/dist/v1/libs/TinyEvents.mjs +328 -0
- package/dist/v1/libs/TinyLocalStorage.cjs +847 -0
- package/dist/v1/libs/TinyLocalStorage.d.mts +407 -0
- package/dist/v1/libs/TinyLocalStorage.mjs +740 -0
- package/dist/v1/libs/TinySmartScroller.cjs +207 -52
- package/dist/v1/libs/TinySmartScroller.d.mts +164 -16
- package/dist/v1/libs/TinySmartScroller.mjs +181 -52
- package/dist/v1/libs/TinyTimeout.cjs +194 -0
- package/dist/v1/libs/TinyTimeout.d.mts +89 -0
- package/dist/v1/libs/TinyTimeout.mjs +179 -0
- package/dist/v1/libs/TinyUploadClicker.cjs +6 -4
- package/docs/v1/README.md +5 -0
- package/docs/v1/basics/objChecker.md +47 -0
- package/docs/v1/basics/objFilter.md +0 -40
- package/docs/v1/libs/TinyColorConverter.md +220 -0
- package/docs/v1/libs/TinyEvents.md +199 -0
- package/docs/v1/libs/TinyLocalStorage.md +350 -0
- package/docs/v1/libs/TinyRateLimiter.md +0 -3
- package/docs/v1/libs/TinyTimeout.md +190 -0
- package/package.json +28 -5
- package/dist/v1/TinyDragger.min.js.LICENSE.txt +0 -8
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see TinyEssentials.min.js.LICENSE.txt */
|
|
2
|
-
(()=>{var e={133:()=>{},251:(e,t)=>{t.read=function(e,t,r,n,o){var i,s,a=8*o-n-1,l=(1<<a)-1,u=l>>1,c=-7,h=r?o-1:0,d=r?-1:1,f=e[t+h];for(h+=d,i=f&(1<<-c)-1,f>>=-c,c+=a;c>0;i=256*i+e[t+h],h+=d,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=n;c>0;s=256*s+e[t+h],h+=d,c-=8);if(0===i)i=1-u;else{if(i===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),i-=u}return(f?-1:1)*s*Math.pow(2,i-n)},t.write=function(e,t,r,n,o,i){var s,a,l,u=8*i-o-1,c=(1<<u)-1,h=c>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,m=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(t*l-1)*Math.pow(2,o),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;e[r+f]=255&a,f+=m,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;e[r+f]=255&s,f+=m,s/=256,u-=8);e[r+f-m]|=128*p}},287:(e,t,r)=>{"use strict";var n=r(526),o=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=l,t.IS=50;var s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return h(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|p(e,t),n=a(r),o=n.write(e,t);return o!==r&&(n=n.slice(0,o)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(F(e,Uint8Array)){var t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(F(e,ArrayBuffer)||e&&F(e.buffer,ArrayBuffer))return f(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(F(e,SharedArrayBuffer)||e&&F(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return l.from(n,t,r);var o=function(e){if(l.isBuffer(e)){var t=0|m(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||$(e.length)?a(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return c(e),a(e<0?0:0|m(e))}function d(e){for(var t=e.length<0?0:0|m(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,l.prototype),n}function m(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function p(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||F(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return O(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(e).length;default:if(o)return n?-1:O(e).length;t=(""+t).toLowerCase(),o=!0}}function g(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return _(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return D(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return C(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),$(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:w(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):w(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function w(e,t,r,n,o){var i,s=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,l/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var c=-1;for(i=r;i<a;i++)if(u(e,i)===u(t,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===l)return c*s}else-1!==c&&(i-=i-c),c=-1}else for(r+l>a&&(r=a-l),i=r;i>=0;i--){for(var h=!0,d=0;d<l;d++)if(u(e,i+d)!==u(t,d)){h=!1;break}if(h)return i}return-1}function v(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if($(a))return s;e[r+s]=a}return s}function E(e,t,r,n){return W(O(t,e.length-r),e,r,n)}function T(e,t,r,n){return W(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function x(e,t,r,n){return W(H(t),e,r,n)}function S(e,t,r,n){return W(function(e,t){for(var r,n,o,i=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function C(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,s,a,l,u=e[o],c=null,h=u>239?4:u>223?3:u>191?2:1;if(o+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(l=(15&u)<<12|(63&i)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(l=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=h}return function(e){var t=e.length;if(t<=L)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=L));return r}(n)}l.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,r){return function(e,t,r){return c(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},l.allocUnsafe=function(e){return h(e)},l.allocUnsafeSlow=function(e){return h(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(F(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),F(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=l.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(F(i,Uint8Array))o+i.length>n.length?l.from(i).copy(n,o):Uint8Array.prototype.set.call(n,i,o);else{if(!l.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o)}o+=i.length}return n},l.byteLength=p,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},l.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?A(this,0,e):g.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",r=t.IS;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(l.prototype[i]=l.prototype.inspect),l.prototype.compare=function(e,t,r,n,o){if(F(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(i,s),u=this.slice(n,o),c=e.slice(t,r),h=0;h<a;++h)if(u[h]!==c[h]){i=u[h],s=c[h];break}return i<s?-1:s<i?1:0},l.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},l.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},l.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},l.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return T(this,e,t,r);case"base64":return x(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var L=4096;function D(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function k(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function _(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=t;i<r;++i)o+=U[e[i]];return o}function M(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function B(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function I(e,t,r,n,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function N(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(e,t,r,n,i){return t=+t,r>>>=0,i||N(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function P(e,t,r,n,i){return t=+t,r>>>=0,i||N(e,0,r,8),o.write(e,t,r,n,52,8),r+8}l.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,l.prototype),n},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||B(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||B(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return e>>>=0,t||B(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||I(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||I(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);I(this,e,t,r,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/s|0)-a&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);I(this,e,t,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s|0)-a&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeFloatLE=function(e,t,r){return j(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return j(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return P(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return P(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),o},l.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var s=l.isBuffer(e)?e:l.from(e,n),a=s.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%a]}return this};var R=/[^+/0-9A-Za-z-_]/g;function O(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function H(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(R,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function W(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function F(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function $(e){return e!=e}var U=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)t[n+o]=e[r]+e[o];return t}()},370:()=>{},526:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,i=a(e),s=i[0],l=i[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,l)),c=0,h=l>0?s-4:s;for(r=0;r<h;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===l&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===l&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],s=16383,a=0,u=n-o;a<u;a+=s)i.push(l(e,a,a+s>u?u:a+s));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=i[s],n[i.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,n){for(var o,i,s=[],a=t;a<n;a+=3)o=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},606:e=>{var t,r,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var a,l=[],u=!1,c=-1;function h(){u&&a&&(u=!1,a.length?l=a.concat(l):c=-1,l.length&&d())}function d(){if(!u){var e=s(h);u=!0;for(var t=l.length;t;){for(a=l,l=[];++c<t;)a&&a[c].run();c=-1,t=l.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function m(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new f(e,t)),1!==l.length||u||s(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=m,n.addListener=m,n.once=m,n.off=m,n.removeListener=m,n.removeAllListeners=m,n.emit=m,n.prependListener=m,n.prependOnceListener=m,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},975:(e,t,r)=>{"use strict";var n=r(606);function o(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function i(e,t){for(var r,n="",o=0,i=-1,s=0,a=0;a<=e.length;++a){if(a<e.length)r=e.charCodeAt(a);else{if(47===r)break;r=47}if(47===r){if(i===a-1||1===s);else if(i!==a-1&&2===s){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var l=n.lastIndexOf("/");if(l!==n.length-1){-1===l?(n="",o=0):o=(n=n.slice(0,l)).length-1-n.lastIndexOf("/"),i=a,s=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=a,s=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),o=a-i-1;i=a,s=0}else 46===r&&-1!==s?++s:s=-1}return n}var s={resolve:function(){for(var e,t="",r=!1,s=arguments.length-1;s>=-1&&!r;s--){var a;s>=0?a=arguments[s]:(void 0===e&&(e=n.cwd()),a=e),o(a),0!==a.length&&(t=a+"/"+t,r=47===a.charCodeAt(0))}return t=i(t,!r),r?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(o(e),0===e.length)return".";var t=47===e.charCodeAt(0),r=47===e.charCodeAt(e.length-1);return 0!==(e=i(e,!t)).length||t||(e="."),e.length>0&&r&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return o(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var r=arguments[t];o(r),r.length>0&&(void 0===e?e=r:e+="/"+r)}return void 0===e?".":s.normalize(e)},relative:function(e,t){if(o(e),o(t),e===t)return"";if((e=s.resolve(e))===(t=s.resolve(t)))return"";for(var r=1;r<e.length&&47===e.charCodeAt(r);++r);for(var n=e.length,i=n-r,a=1;a<t.length&&47===t.charCodeAt(a);++a);for(var l=t.length-a,u=i<l?i:l,c=-1,h=0;h<=u;++h){if(h===u){if(l>u){if(47===t.charCodeAt(a+h))return t.slice(a+h+1);if(0===h)return t.slice(a+h)}else i>u&&(47===e.charCodeAt(r+h)?c=h:0===h&&(c=0));break}var d=e.charCodeAt(r+h);if(d!==t.charCodeAt(a+h))break;47===d&&(c=h)}var f="";for(h=r+c+1;h<=n;++h)h!==n&&47!==e.charCodeAt(h)||(0===f.length?f+="..":f+="/..");return f.length>0?f+t.slice(a+c):(a+=c,47===t.charCodeAt(a)&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(o(e),0===e.length)return".";for(var t=e.charCodeAt(0),r=47===t,n=-1,i=!0,s=e.length-1;s>=1;--s)if(47===(t=e.charCodeAt(s))){if(!i){n=s;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"//":e.slice(0,n)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');o(e);var r,n=0,i=-1,s=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,l=-1;for(r=e.length-1;r>=0;--r){var u=e.charCodeAt(r);if(47===u){if(!s){n=r+1;break}}else-1===l&&(s=!1,l=r+1),a>=0&&(u===t.charCodeAt(a)?-1==--a&&(i=r):(a=-1,i=l))}return n===i?i=l:-1===i&&(i=e.length),e.slice(n,i)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!s){n=r+1;break}}else-1===i&&(s=!1,i=r+1);return-1===i?"":e.slice(n,i)},extname:function(e){o(e);for(var t=-1,r=0,n=-1,i=!0,s=0,a=e.length-1;a>=0;--a){var l=e.charCodeAt(a);if(47!==l)-1===n&&(i=!1,n=a+1),46===l?-1===t?t=a:1!==s&&(s=1):-1!==t&&(s=-1);else if(!i){r=a+1;break}}return-1===t||-1===n||0===s||1===s&&t===n-1&&t===r+1?"":e.slice(t,n)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+"/"+n:n}(0,e)},parse:function(e){o(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var r,n=e.charCodeAt(0),i=47===n;i?(t.root="/",r=1):r=0;for(var s=-1,a=0,l=-1,u=!0,c=e.length-1,h=0;c>=r;--c)if(47!==(n=e.charCodeAt(c)))-1===l&&(u=!1,l=c+1),46===n?-1===s?s=c:1!==h&&(h=1):-1!==s&&(h=-1);else if(!u){a=c+1;break}return-1===s||-1===l||0===h||1===h&&s===l-1&&s===a+1?-1!==l&&(t.base=t.name=0===a&&i?e.slice(1,l):e.slice(a,l)):(0===a&&i?(t.name=e.slice(1,s),t.base=e.slice(1,l)):(t.name=e.slice(a,s),t.base=e.slice(a,l)),t.ext=e.slice(s,l)),a>0?t.dir=e.slice(0,a-1):i&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};s.posix=s,e.exports=s}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{ColorSafeStringify:()=>W,TinyAfterScrollWatcher:()=>gt,TinyClipboard:()=>Lt,TinyDomReadyManager:()=>mt,TinyDragDropDetector:()=>Ne,TinyDragger:()=>ft,TinyHtml:()=>Ae,TinyLevelUp:()=>o,TinyNotifications:()=>pt,TinyNotifyCenter:()=>z,TinyPromiseQueue:()=>F,TinyRateLimiter:()=>$,TinySmartScroller:()=>Ct,TinyTextRangeEditor:()=>At,TinyToastNotify:()=>V,UltraRandomMsgGen:()=>xt,addAiMarkerShortcut:()=>R,areElsCollBottom:()=>Z,areElsCollLeft:()=>ee,areElsCollPerfBottom:()=>ne,areElsCollPerfLeft:()=>oe,areElsCollPerfRight:()=>ie,areElsCollPerfTop:()=>re,areElsCollRight:()=>te,areElsCollTop:()=>K,areElsColliding:()=>se,areElsPerfColliding:()=>ae,areHtmlElsColliding:()=>Le,arraySortPositions:()=>i,asyncReplace:()=>t,backupFile:()=>Qe,checkObj:()=>w,clearDirectory:()=>We,clearDirectoryAsync:()=>st,cloneObjTypeOrder:()=>g,countObj:()=>v,dirExists:()=>$e,dirSize:()=>Xe,dirSizeAsync:()=>ht,documentIsFullScreen:()=>T,ensureCopyFile:()=>ze,ensureDirectory:()=>He,exitFullScreen:()=>A,extendObjType:()=>m,fetchJson:()=>X,fileExists:()=>Fe,fileSize:()=>Ye,fileSizeAsync:()=>ct,formatBytes:()=>I,formatCustomTimer:()=>l,formatDayTimer:()=>c,formatTimer:()=>u,genFibonacciSeq:()=>N,getAge:()=>B,getElsCollDetails:()=>pe,getElsCollDirDepth:()=>me,getElsCollOverlap:()=>ce,getElsCollOverlapPos:()=>he,getElsColliding:()=>le,getElsPerfColliding:()=>ue,getElsRelativeCenterOffset:()=>fe,getHtmlElBorders:()=>ke,getHtmlElBordersWidth:()=>De,getHtmlElMargin:()=>_e,getHtmlElPadding:()=>Me,getLatestBackupPath:()=>Ke,getRectCenter:()=>de,getSimplePerc:()=>M,getTimeDuration:()=>a,installWindowHiddenScript:()=>Q,isDirEmpty:()=>Ue,isDirEmptyAsync:()=>at,isFullScreenMode:()=>S,isInViewport:()=>Be,isJsonObject:()=>E,isScreenFilled:()=>x,isScrolledIntoView:()=>Ie,listDirs:()=>Je,listDirsAsync:()=>ut,listFiles:()=>Ge,listFilesAsync:()=>lt,objType:()=>b,offFullScreenChange:()=>k,onFullScreenChange:()=>D,readBase64Blob:()=>G,readFileBlob:()=>q,readJsonBlob:()=>J,readJsonFile:()=>Re,renameFileAddPrefixSuffix:()=>rt,renameFileBatch:()=>et,renameFileNormalizeCase:()=>nt,renameFilePadNumbers:()=>ot,renameFileRegex:()=>tt,reorderObjTypeOrder:()=>p,requestFullScreen:()=>C,restoreLatestBackup:()=>Ze,ruleOfThree:()=>_,safeTextTrim:()=>O,saveJsonFile:()=>Y,shuffleArray:()=>s,toTitleCase:()=>j,toTitleCaseLowerFirst:()=>P,tryDeleteFile:()=>Ve,writeJsonFile:()=>Oe,writeTextFile:()=>qe});var e={};async function t(e,t,r){const n=[];e.replace(t,((e,...t)=>(n.push(r(e,...t)),e)));const o=await Promise.all(n);return e.replace(t,(()=>o.shift()))}r.r(e),r.d(e,{areElsCollBottom:()=>Z,areElsCollLeft:()=>ee,areElsCollPerfBottom:()=>ne,areElsCollPerfLeft:()=>oe,areElsCollPerfRight:()=>ie,areElsCollPerfTop:()=>re,areElsCollRight:()=>te,areElsCollTop:()=>K,areElsColliding:()=>se,areElsPerfColliding:()=>ae,getElsCollDetails:()=>pe,getElsCollDirDepth:()=>me,getElsCollOverlap:()=>ce,getElsCollOverlapPos:()=>he,getElsColliding:()=>le,getElsPerfColliding:()=>ue,getElsRelativeCenterOffset:()=>fe,getRectCenter:()=>de});const o=class{constructor(e,t){if("number"!=typeof e||Number.isNaN(e))throw new Error("giveExp must be a valid number");if("number"!=typeof t||Number.isNaN(t))throw new Error("expLevel must be a valid number");this.giveExp=e,this.expLevel=t}createUser(){return{exp:0,level:1,totalExp:0}}validateUser(e){if("number"!=typeof e.exp||Number.isNaN(e.exp))throw new Error("exp must be a valid number");if("number"!=typeof e.level||Number.isNaN(e.level))throw new Error("level must be a valid number");if(e.level<1)throw new Error("level must be at least 1");if("number"!=typeof e.totalExp||Number.isNaN(e.totalExp))throw new Error("totalExp must be a valid number")}isValidUser(e){return!("number"!=typeof e.exp||Number.isNaN(e.exp)||"number"!=typeof e.level||Number.isNaN(e.level)||e.level<1||"number"!=typeof e.totalExp||Number.isNaN(e.totalExp))}getGiveExpBase(){if("number"!=typeof this.giveExp||Number.isNaN(this.giveExp))throw new Error("giveExp must be a valid number");return this.giveExp}getExpLevelBase(){if("number"!=typeof this.expLevel||Number.isNaN(this.expLevel))throw new Error("expLevel must be a valid number");return this.expLevel}expValidator(e){const t=this.getExpLevelBase();this.validateUser(e);let r=0;const n=t*e.level;return e.exp>=n&&(e.level++,r=e.exp-n,e.exp=0,r>0)?this.give(e,r,"extra"):e.exp<1&&e.level>1&&(e.level--,r=Math.abs(e.exp),e.exp=t*e.level,r>0)?this.remove(e,r,"extra"):e}getTotalExp(e){this.validateUser(e);let t=0;for(let r=1;r<=e.level;r++)t+=this.getExpLevelBase()*r;return t+=e.exp,t}expGenerator(e=1){if("number"!=typeof e||Number.isNaN(e))throw new Error("multi must be a valid number");return Math.floor(Math.random()*this.getGiveExpBase())*e}getMissingExp(e){return this.getProgress(e)-e.exp}progress(e){return this.getProgress(e)}getProgress(e){return this.validateUser(e),this.getExpLevelBase()*e.level}set(e,t){if("number"!=typeof t||Number.isNaN(t))throw new Error("value must be a valid number");return e.exp=t,this.expValidator(e),e.totalExp=this.getTotalExp(e),e}give(e,t=0,r="add",n=1){if("number"!=typeof n||Number.isNaN(n))throw new Error("multi must be a valid number");if("number"!=typeof t||Number.isNaN(t))throw new Error("extraExp must be a valid number");if("string"!=typeof r)throw new Error("type must be a valid string");return"add"===r?e.exp+=this.expGenerator(n)+t:"extra"===r&&(e.exp+=t),this.expValidator(e),e.totalExp=this.getTotalExp(e),e}remove(e,t=0,r="add",n=1){if("number"!=typeof n||Number.isNaN(n))throw new Error("multi must be a valid number");if("number"!=typeof t||Number.isNaN(t))throw new Error("extraExp must be a valid number");if("string"!=typeof r)throw new Error("type must be a valid string");return"add"===r?e.exp-=this.expGenerator(n)+t:"extra"===r&&(e.exp-=t),this.expValidator(e),e.totalExp=this.getTotalExp(e),e}};function i(e,t=!1){return t?function(t,r){return t[e]>r[e]?-1:t[e]<r[e]?1:0}:function(t,r){return t[e]<r[e]?-1:t[e]>r[e]?1:0}}function s(e){let t,r=e.length;for(;0!==r;)t=Math.floor(Math.random()*r),r--,[e[r],e[t]]=[e[t],e[r]];return e}function a(e=new Date,t="asSeconds",r=null){if(e instanceof Date){const n=r instanceof Date?r:new Date,o=e.getTime()-n.getTime();switch(t){case"asMilliseconds":return o;case"asSeconds":default:return o/1e3;case"asMinutes":return o/6e4;case"asHours":return o/36e5;case"asDays":return o/864e5}}return null}function l(e,t="seconds",r="{time}"){e=Math.max(0,Math.floor(e));const n=["seconds","minutes","hours","days","months","years"].indexOf(t),o=n>=5,i=n>=4,s=n>=3,a=n>=2,l=n>=1,u=n>=0,c={years:o?0:NaN,months:i?0:NaN,days:s?0:NaN,hours:a?0:NaN,minutes:l?0:NaN,seconds:u?0:NaN,total:NaN};let h=e;if(o||i||s){const e=new Date(1980,0,1),t=new Date(e.getTime()+1e3*h),r=new Date(e);if(o)for(;new Date(r.getFullYear()+1,r.getMonth(),r.getDate()).getTime()<=t.getTime();)r.setFullYear(r.getFullYear()+1),c.years++;if(i)for(;new Date(r.getFullYear(),r.getMonth()+1,r.getDate()).getTime()<=t.getTime();)r.setMonth(r.getMonth()+1),c.months++;if(s)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=t.getTime();)r.setDate(r.getDate()+1),c.days++;h=Math.floor((t.getTime()-r.getTime())/1e3)}a&&(c.hours=Math.floor(h/3600),h%=3600),l&&(c.minutes=Math.floor(h/60),h%=60),u&&(c.seconds=h);const d={seconds:u?e:NaN,minutes:l?e/60:NaN,hours:a?e/3600:NaN,days:s?e/86400:NaN,months:i?12*c.years+c.months+(c.days||0)/30:NaN,years:o?c.years+(c.months||0)/12+(c.days||0)/365:NaN};c.total=+(d[t]||0).toFixed(2).replace(/\.00$/,"");const f=e=>{const t="string"==typeof e?parseInt(e):e;return Number.isNaN(t)?"NaN":String(t).padStart(2,"0")},m=[a?f(c.hours):null,l?f(c.minutes):null,u?f(c.seconds):null].filter((e=>null!==e)).join(":");return r.replace(/\{years\}/g,String(c.years)).replace(/\{months\}/g,String(c.months)).replace(/\{days\}/g,String(c.days)).replace(/\{hours\}/g,f(c.hours)).replace(/\{minutes\}/g,f(c.minutes)).replace(/\{seconds\}/g,f(c.seconds)).replace(/\{time\}/g,m).replace(/\{total\}/g,String(c.total)).trim()}function u(e){return l(e,"hours","{hours}:{minutes}:{seconds}")}function c(e){return l(e,"days","{days}d {hours}:{minutes}:{seconds}")}var h=r(287);const d="undefined"!=typeof window&&void 0!==window.document,f={items:{},order:[]};function m(e,t){const r=[],n=Array.isArray(e)?e:Object.entries(e);for(const[e,o]of n)if(!f.items.hasOwnProperty(e)){f.items[e]=o;let n="number"==typeof t?t:-1;if(-1===n){const e=f.order.indexOf("object");n=e>-1?e:f.order.length}n=Math.min(Math.max(0,n),f.order.length),f.order.splice(n,0,e),r.push(e)}return r}function p(e){const t=[...f.order];return!!e.every((e=>t.includes(e)))&&(f.order=e.slice(),!0)}function g(){return[...f.order]}const y=e=>{if(null===e)return"null";for(const t of f.order)if("function"!=typeof f.items[t]||f.items[t](e))return t;return"unknown"};function b(e,t){if(void 0===e)return null;const r=y(e);return"string"==typeof t?r===t.toLowerCase():r}function w(e){const t={valid:null,type:null};for(const r of f.order)if("function"==typeof f.items[r]){const n=f.items[r](e);if(n){t.valid=n,t.type=r;break}}return t}function v(e){return Array.isArray(e)?e.length:b(e,"object")?Object.keys(e).length:0}function E(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"===Object.prototype.toString.call(e)}m([["undefined",e=>void 0===e],["null",e=>null===e],["boolean",e=>"boolean"==typeof e],["number",e=>"number"==typeof e&&!Number.isNaN(e)],["bigint",e=>"bigint"==typeof e],["string",e=>"string"==typeof e],["symbol",e=>"symbol"==typeof e],["function",e=>"function"==typeof e],["array",e=>Array.isArray(e)]]),d||m([["buffer",e=>void 0!==h.hp&&h.hp.isBuffer(e)]]),d&&m([["file",e=>"undefined"!=typeof File&&e instanceof File]]),m([["date",e=>e instanceof Date],["regexp",e=>e instanceof RegExp],["map",e=>e instanceof Map],["set",e=>e instanceof Set],["weakmap",e=>e instanceof WeakMap],["weakset",e=>e instanceof WeakSet],["promise",e=>e instanceof Promise]]),d&&m([["htmlelement",e=>"undefined"!=typeof HTMLElement&&e instanceof HTMLElement]]),m([["object",e=>E(e)]]);const T=()=>!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitIsFullScreen||document.mozFullScreen),x=()=>window.innerHeight===screen.height&&window.innerWidth===screen.width,S=()=>T()||x(),C=e=>new Promise((async(t,r)=>{const n=document.documentElement;try{n.requestFullscreen?await n.requestFullscreen(e):n.mozRequestFullScreen?n.mozRequestFullScreen(e):n.webkitRequestFullScreen?n.webkitRequestFullScreen(e):n.msRequestFullscreen&&n.msRequestFullscreen(e),t()}catch(e){r(e)}})),A=()=>new Promise(((e,t)=>{if(document.exitFullscreen)document.exitFullscreen().then(e).catch(t);else try{if(document.mozCancelFullScreen)document.mozCancelFullScreen();else if(document.webkitCancelFullScreen)document.webkitCancelFullScreen();else{if(!document.msExitFullscreen)throw new Error("Fullscreen API is not supported");document.msExitFullscreen()}e()}catch(e){t(e)}})),L=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],D=(e,t)=>{L.forEach((r=>{document.addEventListener(r,e,t)}))},k=(e,t)=>{L.forEach((r=>{document.removeEventListener(r,e,t)}))};function _(e,t,r,n=!1){return n?Number(e*t)/r:Number(r*t)/e}function M(e,t){return e*(t/100)}function B(e=0,t=null){if(null!=e&&0!==e){const r=new Date(e);if(Number.isNaN(r.getTime()))return null;const n=t instanceof Date?t:new Date;let o=n.getFullYear()-r.getFullYear();const i=n.getMonth(),s=r.getMonth(),a=n.getDate(),l=r.getDate();return(i<s||i===s&&a<l)&&o--,Math.abs(o)}return null}function I(e,t=null,r=null){if("number"!=typeof e||e<0)return{unit:null,value:null};if(0===e)return{unit:"Bytes",value:0};const n=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],o=r&&n.includes(r)?n.indexOf(r):n.length-1,i=Math.min(Math.floor(Math.log(e)/Math.log(1024)),o);let s=e/Math.pow(1024,i);if(null!==t){const e=t<0?0:t;s=parseFloat(s.toFixed(e))}return{unit:n[i],value:s}}function N({baseValues:e=[0,1],length:t=10,combiner:r=(e,t)=>e+t}={}){if(!Array.isArray(e)||2!==e.length)throw new Error("baseValues must be an array of exactly two numbers");const n=[...e.slice(0,2)];for(let e=2;e<t;e++){const t=r(n[e-2],n[e-1],e);n.push(t)}return n}function j(e){return e.replace(/\w\S*/g,(e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()))}function P(e){const t=e.replace(/\w\S*/g,(e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()));return t.charAt(0).toLowerCase()+t.slice(1)}function R(e="a"){"undefined"!=typeof HTMLElement?document.addEventListener("keydown",(function(t){if(t.ctrlKey&&t.altKey&&t.key.toLowerCase()===e){if(t.preventDefault(),!document.body)return void console.warn("[AiMarkerShortcut] <body> element not found. Cannot toggle class. Ensure the DOM is fully loaded when using the shortcut.");document.body.classList.toggle("detect-made-by-ai")}})):console.error("[AiMarkerShortcut] Environment does not support the DOM. This function must be run in a browser.")}function O(e,t,r=.6){if("string"!=typeof e)throw new TypeError("Expected a string for 'text', but received "+typeof e);if(!Number.isInteger(t)||t<=0)throw new TypeError(`Expected 'limit' to be a positive integer, but received ${t}`);if("number"!=typeof r||r<0||r>1)throw new TypeError(`Expected 'safeCutZone' to be a number between 0 and 1, but received ${r}`);let n=e.trim();if(n.length>t){const e=n.lastIndexOf(" ",t);return e>0&&e>=t*r?`${n.substring(0,e).trim()}...`:`${n.substring(0,t).trim()}...`}return n}class H{#e;static#t={default:{reset:"[0m",key:"[36m",string:"[32m",string_url:"[34m",string_bool:"[35m",string_number:"[33m",number:"[33m",boolean:"[35m",null:"[1;30m",special:"[31m",func:"[90m"},solarized:{reset:"[0m",key:"[38;5;37m",string:"[38;5;136m",string_url:"[38;5;33m",string_bool:"[38;5;166m",string_number:"[38;5;136m",number:"[38;5;136m",boolean:"[38;5;166m",null:"[38;5;241m",special:"[38;5;160m",func:"[38;5;244m"},monokai:{reset:"[0m",key:"[38;5;81m",string:"[38;5;114m",string_url:"[38;5;75m",string_bool:"[38;5;204m",string_number:"[38;5;221m",number:"[38;5;221m",boolean:"[38;5;204m",null:"[38;5;241m",special:"[38;5;160m",func:"[38;5;102m"}};constructor(e={}){this.#e={...H.#t.default,...e}}#r(e,t){const r=[];e=(e=(e=e.replace(/(?<!")\b(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b(?!")/g,`${t.number}$1${t.reset}`)).replace(/"([^"]+)":/g,((e,t)=>{const n=`___KEY${r.length}___`;return r.push({marker:n,key:t}),`${n}:`}))).replace(/"(?:\\.|[^"\\])*?"/g,(e=>{const r=e.slice(1,-1);return/^(https?|ftp):\/\/[^\s]+$/i.test(r)?`${t.string_url}${e}${t.reset}`:/^(true|false|null)$/.test(r)?`${t.string_bool}${e}${t.reset}`:/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(r)?`${t.string_number}${e}${t.reset}`:`${t.string}${e}${t.reset}`}));for(const{marker:n,key:o}of r){const r=new RegExp(n,"g");e=e.replace(r,`${t.key}"${o}"${t.reset}`)}return(e=(e=(e=(e=e.replace(/(?<!")\b(true|false)\b(?!")/g,`${t.boolean}$1${t.reset}`)).replace(/(?<!")\bnull\b(?!")/g,`${t.null}null${t.reset}`)).replace(/\[Circular\]/g,`${t.special}[Circular]${t.reset}`)).replace(/\[undefined\]/g,`${t.special}[undefined]${t.reset}`)).replace(/"function.*?[^\\]"/gs,`${t.func}$&${t.reset}`)}colorize(e,t={}){const r={...this.#e,...t};return this.#r(e,r)}getColors(){return{...this.#e}}updateColors(e){Object.assign(this.#e,e)}resetColors(){this.#e={...H.#t.default}}loadColorPreset(e){const t=H.#t[e];if(!t)throw new Error(`Preset "${e}" not found.`);this.#e={...t}}saveColorPreset(e,t){H.#t[e]={...t}}getAvailablePresets(){return Object.keys(H.#t)}}const W=H,F=class{#n=[];#o=!1;#i={};#s=new Set;isRunning(){return this.#o}async#a(e){if(e&&"function"==typeof e.task&&"function"==typeof e.resolve&&"function"==typeof e.reject){const{task:t,resolve:r,reject:n,delay:o,id:i}=e;try{if(i&&this.#s.has(i))return n(new Error("The function was canceled on TinyPromiseQueue.")),this.#s.delete(i),this.#o=!1,void this.#l();o&&i&&await new Promise((e=>{const t=setTimeout((()=>{delete this.#i[i],e(null)}),o);this.#i[i]=t})),r(await t())}catch(e){n(e)}finally{this.#o=!1,this.#l()}}}async#u(){const e=[];for(;this.#n.length&&"POINT_MARKER"===this.#n[0]?.marker;)e.push(this.#n.shift());if(0===e.length)return this.#o=!1,void this.#l();await Promise.all(e.map((({task:e,resolve:t,reject:r,id:n})=>new Promise((async o=>{if(n&&this.#s.has(n))return this.#s.delete(n),r(new Error("The function was canceled on TinyPromiseQueue.")),void o(!0);await e().then(t).catch(r),o(!0)}))))),this.#o=!1,this.#l()}async#l(){if(!this.#o&&0!==this.#n.length)if(this.#o=!0,"string"!=typeof this.#n[0]?.marker||"POINT_MARKER"!==this.#n[0]?.marker){const e=this.#n.shift();this.#a(e)}else this.#u()}getIndexById(e){return this.#n.findIndex((t=>t.id===e))}getQueuedIds(){return this.#n.map(((e,t)=>({index:t,id:e.id}))).filter((e=>"string"==typeof e.id))}reorderQueue(e,t){if("number"!=typeof e||"number"!=typeof t||e<0||t<0||e>=this.#n.length||t>=this.#n.length)return;const[r]=this.#n.splice(e,1);this.#n.splice(t,0,r)}async enqueuePoint(e,t){if("function"!=typeof e)return Promise.reject(new Error("Task must be a function returning a Promise."));if(void 0!==t&&"string"!=typeof t)throw new Error('The "id" parameter must be a string.');return this.#o?new Promise(((r,n)=>{this.#n.push({marker:"POINT_MARKER",task:e,resolve:r,reject:n,id:t}),this.#l()})):e()}enqueue(e,t,r){if("function"!=typeof e)return Promise.reject(new Error("Task must be a function returning a Promise."));if(void 0!==t&&("number"!=typeof t||t<0))return Promise.reject(new Error("Delay must be a positive number or undefined."));if(void 0!==r&&"string"!=typeof r)throw new Error('The "id" parameter must be a string.');return new Promise(((n,o)=>{this.#n.push({task:e,resolve:n,reject:o,id:r,delay:t}),this.#l()}))}cancelTask(e){if("string"!=typeof e)throw new Error('The "id" parameter must be a string.');let t=!1;e in this.#i&&(clearTimeout(this.#i[e]),delete this.#i[e],t=!0);const r=this.getIndexById(e);if(-1!==r){const[e]=this.#n.splice(r,1);e?.reject?.(new Error("The function was canceled on TinyPromiseQueue.")),t=!0}return t&&this.#s.add(e),t}},$=class{#c=null;#h=null;#d=null;#f=null;#m=null;#p=null;groupData=new Map;lastSeen=new Map;userToGroup=new Map;groupFlags=new Map;groupTTL=new Map;#g=null;setOnMemoryExceeded(e){if("function"!=typeof e)throw new Error("onMemoryExceeded must be a function");this.#g=e}clearOnMemoryExceeded(){this.#g=null}#y=null;setOnGroupExpired(e){if("function"!=typeof e)throw new Error("onGroupExpired must be a function");this.#y=e}clearOnGroupExpired(){this.#y=null}constructor({maxHits:e,interval:t,cleanupInterval:r,maxIdle:n=3e5,maxMemory:o=1e5}){const i=e=>"number"==typeof e&&Number.isFinite(e)&&e>=1&&Number.isInteger(e),s=i(e),a=i(t),l=i(r),u=i(n);if(!s&&!a)throw new Error("RateLimiter requires at least one valid option: 'maxHits' or 'interval'.");if(void 0!==e&&!s)throw new Error("'maxHits' must be a positive integer if defined.");if(void 0!==t&&!a)throw new Error("'interval' must be a positive integer in milliseconds if defined.");if(void 0!==r&&!l)throw new Error("'cleanupInterval' must be a positive integer in milliseconds if defined.");if(!u)throw new Error("'maxIdle' must be a positive integer in milliseconds.");if("number"==typeof o&&Number.isFinite(o)&&o>0)this.#c=Math.floor(o);else{if(null!=o)throw new Error("maxMemory must be a positive number or null");this.#c=null}this.#d=s?e:null,this.#f=a?t:null,this.#m=l?r:null,this.#p=n,null!==this.#m&&(this.#h=setInterval((()=>this._cleanup()),this.#m))}isGroupId(e){const t=this.groupFlags.get(e);return"boolean"==typeof t&&t}getUsersInGroup(e){const t=[];for(const[r,n]of this.userToGroup.entries())n===e&&t.push(r);return t}setGroupTTL(e,t){if("number"!=typeof t||!Number.isFinite(t)||t<=0)throw new Error("TTL must be a positive number in milliseconds");this.groupTTL.set(e,t)}getGroupTTL(e){return this.groupTTL.get(e)??null}deleteGroupTTL(e){this.groupTTL.delete(e)}assignToGroup(e,t){const r=this.userToGroup.get(e);if(r&&r!==t)throw new Error(`User ${e} is already assigned to group ${r}`);if(r===t)return;const n=this.groupData.get(e);if(this.isGroupId(e)){for(const[r,n]of this.userToGroup.entries())n===e&&this.userToGroup.set(r,t);this.userToGroup.delete(e)}else this.userToGroup.set(e,t);if(!n)return;const o=this.groupData.get(t);if(o)for(const e of n)o.push(e);else{const e=[];for(const t of n)e.push(t);this.groupData.set(t,e)}this.lastSeen.set(t,Date.now()),this.groupFlags.delete(e),this.groupData.delete(e),this.lastSeen.delete(e),this.groupTTL.delete(e),this.groupFlags.set(t,!0)}getGroupId(e){return this.userToGroup.get(e)||e}hit(e){const t=this.getGroupId(e),r=Date.now();this.groupData.has(t)||(this.groupData.set(t,[]),this.groupFlags.set(t,!1));const n=this.groupData.get(t);if(!n)throw new Error(`No data found for groupId: ${t}`);if(n.push(r),this.lastSeen.set(t,r),null!==this.#f){const e=r-this.getInterval();for(;n.length&&n[0]<e;)n.shift()}null!==this.#c&&"number"==typeof this.#c&&n.length>this.#c&&(n.splice(0,n.length-this.#c),"function"==typeof this.#g&&this.#g(t))}isRateLimited(e){const t=this.getGroupId(e);if(!this.groupData.has(t))return!1;const r=this.groupData.get(t);if(!r)throw new Error(`No data found for groupId: ${t}`);if(null!==this.#f){const e=Date.now()-this.getInterval();let t=0;for(let n=r.length-1;n>=0&&r[n]>e;n--)t++;return null!==this.#d?t>this.getMaxHits():t>0}return null!==this.#d&&r.length>this.getMaxHits()}resetGroup(e){this.groupFlags.delete(e),this.groupData.delete(e),this.lastSeen.delete(e),this.groupTTL.delete(e)}reset(e){return this.resetUserGroup(e)}resetUserGroup(e){this.userToGroup.delete(e)}setData(e,t){if(!Array.isArray(t))throw new Error("timestamps must be an array of numbers.");for(const e of t)if("number"!=typeof e||!Number.isFinite(e))throw new Error("All timestamps must be finite numbers.");this.groupData.has(e)||this.groupFlags.set(e,!1),this.groupData.set(e,t),this.lastSeen.set(e,Date.now())}hasData(e){return this.groupData.has(e)}getData(e){return this.groupData.get(e)||[]}getMaxIdle(){if("number"!=typeof this.#p||!Number.isFinite(this.#p)||this.#p<0)throw new Error("'maxIdle' must be a non-negative finite number.");return this.#p}setMaxIdle(e){if("number"!=typeof e||!Number.isFinite(e)||e<0)throw new Error("'maxIdle' must be a non-negative finite number.");this.#p=e}_cleanup(){const e=Date.now();for(const[t,r]of this.lastSeen.entries())e-r>(this.getGroupTTL(t)??this.getMaxIdle())&&(this.groupFlags.delete(t),this.groupData.delete(t),this.lastSeen.delete(t),this.groupTTL.delete(t),"function"==typeof this.#y&&this.#y(t))}getActiveGroups(){return Array.from(this.groupData.keys())}getAllUserMappings(){return Object.fromEntries(this.userToGroup)}getInterval(){if("number"!=typeof this.#f||!Number.isFinite(this.#f))throw new Error("'interval' is not a valid finite number.");return this.#f}getMaxHits(){if("number"!=typeof this.#d||!Number.isFinite(this.#d))throw new Error("'maxHits' is not a valid finite number.");return this.#d}getTotalHits(e){const t=this.groupData.get(e);return Array.isArray(t)?t.length:0}getLastHit(e){const t=this.groupData.get(e);return t?.length?t[t.length-1]:null}getTimeSinceLastHit(e){const t=this.getLastHit(e);return null!==t?Date.now()-t:null}_calculateAverageSpacing(e){if(!Array.isArray(e)||e.length<2)return null;let t=0;for(let r=1;r<e.length;r++)t+=e[r]-e[r-1];return t/(e.length-1)}getAverageHitSpacing(e){return this._calculateAverageSpacing(this.groupData.get(e))}getMetrics(e){const t=this.groupData.get(e);if(!Array.isArray(t)||0===t.length)return{totalHits:0,lastHit:null,timeSinceLastHit:null,averageHitSpacing:null};const r=t.length,n=t[r-1];return{totalHits:r,lastHit:n,timeSinceLastHit:Date.now()-n,averageHitSpacing:this._calculateAverageSpacing(t)}}destroy(){this.#h&&clearInterval(this.#h),this._cleanup(),this.groupData.clear(),this.lastSeen.clear(),this.userToGroup.clear(),this.groupTTL.clear(),this.groupFlags.clear()}};class U{static getTemplate(){return'\n<div class="notify-overlay hidden">\n <div class="notify-center" id="notifCenter">\n <div class="header">\n <div>Notifications</div>\n <div class="options">\n <button class="clear-all" type="button">\n <svg\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n fill="currentColor"\n >\n <path\n d="M21.6 2.4a1 1 0 0 0-1.4 0L13 9.6l-1.3-1.3a1 1 0 0 0-1.4 0L3 15.6a1 1 0 0 0 0 1.4l4 4a1 1 0 0 0 1.4 0l7.3-7.3a1 1 0 0 0 0-1.4l-1.3-1.3 7.2-7.2a1 1 0 0 0 0-1.4zM6 17l3.5-3.5 1.5 1.5L7.5 18.5 6 17z"\n />\n </svg>\n </button>\n <button class="close">×</button>\n </div>\n </div>\n <div class="list"></div>\n </div>\n</div>\n\n<button class="notify-bell" aria-label="Open notifications">\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="20"\n height="20"\n fill="currentColor"\n viewBox="0 0 24 24"\n >\n <path\n d="M12 2C10.3 2 9 3.3 9 5v1.1C6.7 7.2 5 9.4 5 12v5l-1 1v1h16v-1l-1-1v-5c0-2.6-1.7-4.8-4-5.9V5c0-1.7-1.3-3-3-3zm0 20c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2z"\n />\n </svg>\n <span class="badge" id="notifBadge">0</span>\n</button>\n '}static insertTemplate(e="afterbegin"){document.body.insertAdjacentHTML(e,U.getTemplate())}#b;#w;#v;#E;#T;#x=0;#S=99;#C=300;#A=!1;#L=new WeakMap;#D(e){if(this.#L.delete(e),!(e instanceof HTMLElement))throw new Error("Invalid HTMLElement to clear.");e.classList.add("removing"),setTimeout((()=>{this.markAsRead(e),e.remove()}),this.#C)}#k(e){this.#x=Math.max(0,e),this.#v.setAttribute("data-value",String(this.#x)),this.#v.textContent=this.#x>this.#S?`${this.#S}+`:String(this.#x)}constructor(e={}){const{center:t=document.getElementById("notifCenter"),badge:r=document.getElementById("notifBadge"),button:n=document.querySelector(".notify-bell"),overlay:o=document.querySelector(".notify-overlay")}=e;if(!(t instanceof HTMLElement))throw new Error(`NotificationCenter: "center" must be an HTMLElement. Got: ${t}`);if(!(o instanceof HTMLElement))throw new Error(`NotificationCenter: "overlay" must be an HTMLElement. Got: ${o}`);if(!(r instanceof HTMLElement))throw new Error(`NotificationCenter: "badge" must be an HTMLElement. Got: ${r}`);if(!(n instanceof HTMLElement))throw new Error(`NotificationCenter: "button" must be an HTMLElement. Got: ${n}`);const i=t?.querySelector(".clear-all"),s=t?.querySelector(".list")??null;if(!(s instanceof HTMLElement))throw new Error(`NotificationCenter: ".list" inside center must be an HTMLElement. Got: ${s}`);this.#b=t,this.#w=s,this.#v=r,this.#E=n,this.#T=o,this.#E.addEventListener("click",(()=>this.toggle())),this.#b.querySelector(".close")?.addEventListener("click",(()=>this.close())),i&&i.addEventListener("click",(()=>this.clear())),this.#T.addEventListener("click",(e=>{e.target===this.#T&&this.close()}))}setMarkAllAsReadOnClose(e){if("boolean"!=typeof e)throw new TypeError("Expected boolean for markAllAsReadOnClose, got "+typeof e);this.#A=e}setRemoveDelay(e){if("number"!=typeof e)throw new Error('NotificationCenter: "ms" must be an number.');this.#C=e}getItemMode(e){const t=this.getItem(e);return t?this.#L.get(t):null}getItem(e){const t=this.#w.children.item(e);if(!(t instanceof HTMLElement))throw new Error(`NotificationCenter: "item" must be an HTMLElement. Got: ${t}`);return t}hasItem(e){return e>=0&&e<this.#w.children.length}markAsRead(e){const t=e instanceof HTMLElement?e:this.getItem(e);t.classList.contains("unread")&&(t.classList.remove("unread"),this.#k(this.#x-1))}add(e,t="text"){const r=document.createElement("div");r.className="item unread";let n=null,o=null,i=null,s=null;if("object"==typeof e&&null!==e?(n=e.title,o=e.message,i=e.avatar,s=e.onClick):o=e,i){const e=document.createElement("div");e.className="avatar",e.style.backgroundImage=`url("${i}")`,r.appendChild(e)}const a=document.createElement("div");if(a.className="content",n){const e=document.createElement("div");e.className="title",e.textContent=n,a.appendChild(e)}const l=document.createElement("div");l.className="message","html"===t?l.innerHTML=o:l.textContent=o,a.appendChild(l),"function"==typeof s&&(r.classList.add("clickable"),r.addEventListener("click",(e=>{e.target instanceof HTMLElement&&!e.target.closest(".notify-close")&&s(e)})));const u=document.createElement("button");u.className="notify-close",u.setAttribute("type","button"),u.innerHTML="×",u.addEventListener("click",(e=>{e.stopPropagation(),this.#D(r)})),r.append(a,u),this.#w.prepend(r),this.#L.set(r,t),this.#k(this.#x+1)}remove(e){const t=this.getItem(e);this.#D(t)}clear(){let e=!0;for(;e;){e=!1;const t=Array.from(this.#w.children);for(const r of t)r instanceof HTMLElement&&!r.classList.contains("removing")&&(this.#D(r),e=!0)}}open(){this.#T.classList.remove("hidden"),this.#b.classList.add("open")}close(){if(this.#T.classList.add("hidden"),this.#b.classList.remove("open"),this.#A){const e=this.#w.querySelectorAll(".item.unread");for(const t of e)t instanceof HTMLElement&&this.markAsRead(t)}}toggle(){this.#b.classList.contains("open")?this.close():this.open()}recount(){const e=this.#w.querySelectorAll(".item.unread").length;this.#k(e)}get count(){return this.#x}destroy(){this.#E?.removeEventListener("click",this.toggle),this.#b?.querySelector(".close")?.removeEventListener("click",this.close),this.#b?.querySelector(".clear-all")?.removeEventListener("click",this.clear),this.#T?.removeEventListener("click",this.close),this.clear(),this.#b?.remove(),this.#T?.remove(),this.#E?.remove(),this.#x=0,this.#L=new WeakMap}}const z=U,V=class{#_;#M;#B;#I;#N;#j;constructor(e="top",t="right",r=3e3,n=50,o=300,i=".notify-container"){this.#P(e),this.#R(t),this.#O(r,"baseDuration"),this.#O(n,"extraPerChar"),this.#O(o,"fadeOutDuration"),this.#_=e,this.#M=t,this.#B=r,this.#I=n,this.#N=o;const s=document.querySelector(`${i}.${e}.${t}`);s instanceof HTMLElement?this.#j=s:(this.#j=document.createElement("div"),this.#j.className=`notify-container ${e} ${t}`,document.body.appendChild(this.#j))}getContainer(){if(!(this.#j instanceof HTMLElement))throw new Error("Container is not a valid HTMLElement.");return this.#j}#P(e){if(!["top","bottom"].includes(e))throw new Error(`Invalid vertical direction "${e}". Expected "top" or "bottom".`)}#R(e){if(!["left","right","center"].includes(e))throw new Error(`Invalid horizontal position "${e}". Expected "left", "right" or "center".`)}#O(e,t){if("number"!=typeof e||e<0||!Number.isFinite(e))throw new Error(`Invalid value for "${t}": ${e}. Must be a non-negative finite number.`)}getY(){return this.#_}setY(e){this.#P(e);const t=this.getContainer();t.classList.remove(this.#_),t.classList.add(e),this.#_=e}getX(){return this.#M}setX(e){this.#R(e);const t=this.getContainer();t.classList.remove(this.#M),t.classList.add(e),this.#M=e}getBaseDuration(){return this.#B}setBaseDuration(e){this.#O(e,"baseDuration"),this.#B=e}getExtraPerChar(){return this.#I}setExtraPerChar(e){this.#O(e,"extraPerChar"),this.#I=e}getFadeOutDuration(){return this.#N}setFadeOutDuration(e){this.#O(e,"fadeOutDuration"),this.#N=e}show(e){let t="",r="",n=null,o=!1,i=null;const s=document.createElement("div");if(s.className="notify enter","string"==typeof e)t=e;else{if("object"!=typeof e||null===e||"string"!=typeof e.message)throw new Error("Invalid argument for show(): expected string or { message: string, title?: string, onClick?: function, html?: boolean, avatar?: string }");if(t=e.message,r="string"==typeof e.title?e.title:"",o=!0===e.html,i="string"==typeof e.avatar?e.avatar:null,void 0!==e.onClick){if("function"!=typeof e.onClick)throw new Error("onClick must be a function if defined");n=e.onClick,s.classList.add("clickable")}}const a=document.createElement("button");if(a.innerHTML="×",a.className="close",a.setAttribute("aria-label","Close"),a.addEventListener("mouseenter",(()=>{a.style.color="var(--notif-close-color-hover)"})),a.addEventListener("mouseleave",(()=>{a.style.color="var(--notif-close-color)"})),i){const e=document.createElement("img");e.src=i,e.alt="avatar",e.className="avatar",s.appendChild(e)}if(r){const e=document.createElement("strong");e.textContent=r,e.style.display="block",s.appendChild(e)}if(o){const e=document.createElement("div");e.innerHTML=t,s.appendChild(e)}else s.appendChild(document.createTextNode(t));s.appendChild(a),this.getContainer().appendChild(s);const l=this.#B+t.length*this.#I+this.#N;let u=!1;const c=()=>{u||(u=!0,s.classList.remove("enter","show"),s.classList.add("exit"),setTimeout((()=>s.remove()),this.#N))};"function"==typeof n&&s.addEventListener("click",(e=>{e.target!==a&&n(e,c)})),a.addEventListener("click",(e=>{e.stopPropagation(),c()})),setTimeout((()=>{s.classList.remove("enter"),s.classList.add("show")}),1),setTimeout((()=>c()),l)}destroy(){this.#j instanceof HTMLElement&&(this.#j.querySelectorAll(".notify").forEach((e=>e.remove())),this.#j.parentNode&&this.#j.parentNode.removeChild(this.#j),this.#j=null)}};function q(e,t){return new Promise(((r,n)=>{const o=new FileReader;o.onload=()=>{try{r(o.result)}catch(e){n(e)}},o.onerror=()=>{n(o.error)},o[t](e)}))}function G(e,t=!1){return new Promise(((r,n)=>{"string"!=typeof t&&"boolean"!=typeof t&&n(new TypeError("The isDataUrl parameter must be a boolean or a string.")),q(e,"readAsDataURL").then((e=>{if("string"!=typeof e)throw new TypeError("Expected file content to be a string.");const n=e.match(/^data:(.+);base64,(.*)$/);if(!n||!n[2])throw new Error("Invalid data URL format or missing Base64 content.");const[,o,i]=n;if(!/^[\w/+]+=*$/.test(i))throw new Error("Base64 content is malformed.");if("boolean"==typeof t)return r(t?e:i);if(!/^[\w-]+\/[\w.+-]+$/.test(t))throw new Error(`Invalid MIME type string: ${t}`);return r(`data:${t};base64,${i}`)})).catch(n)}))}function J(e){return new Promise(((t,r)=>q(e,"readAsText").then((e=>{if("string"!=typeof e)throw new TypeError("Expected file content to be a string.");const r=e.trim();if(0===r.length)throw new Error("File is empty or contains only whitespace.");const n=JSON.parse(r);if("object"!=typeof n||null===n)throw new Error("Parsed content is not a valid JSON object or array.");t(n)})).catch(r)))}function Y(e,t,r=2){const n=JSON.stringify(t,null,r),o=new Blob([n],{type:"application/json"}),i=URL.createObjectURL(o),s=document.createElement("a");s.href=i,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i)}async function X(e,t){return new Promise(((r,n)=>{(async function(e,{method:t="GET",body:r,timeout:n=0,retries:o=0,headers:i={},signal:s=null}={}){if("string"!=typeof e||!e.startsWith("../")&&!e.startsWith("./")&&!e.startsWith("/")&&!e.startsWith("https://")&&!e.startsWith("http://"))throw new Error("Invalid URL: must be a valid http or https address.");if("string"!=typeof t||!t.trim())throw new Error("Invalid method: must be a non-empty string.");if(!s){if("number"!=typeof n||!Number.isFinite(n)||Number.isNaN(n)||n<0)throw new Error("Invalid timeout: must be a positive number.");if("number"!=typeof o||!Number.isFinite(o)||Number.isNaN(o)||o<0)throw new Error("Invalid retries: must be a positive number.")}const a=s?1:o+1;let l=null;for(let u=0;u<a;u++){const a=s?null:new AbortController,c=s||(a?.signal??null),h=!s&&n&&a?setTimeout((()=>a.abort()),n):null;try{const n=await fetch(e,{method:t.toUpperCase(),headers:{Accept:"application/json",...i},body:void 0!==r?E(r)?JSON.stringify(r):r:void 0,signal:c});if(h&&clearTimeout(h),!n.ok)throw new Error(`HTTP error: ${n.status} ${n.statusText}`);return n}catch(e){if(l=e,s)break;u<o&&await new Promise((e=>setTimeout(e,300*(u+1))))}}throw new Error(`Failed to fetch JSON from "${e}"${l?`: ${l.message}`:"."}`)})(e,t).then((async e=>{const t=e.headers.get("content-type")||"";if(!t.includes("application/json"))throw new Error(`Unexpected content-type: ${t}`);const n=await e.json();if(!Array.isArray(n)&&!E(n))throw new Error("Received invalid data instead of valid JSON.");return r(n)})).catch(n)}))}function Q({element:e=document.body,hiddenClass:t="windowHidden",visibleClass:r="windowVisible",onVisible:n,onHidden:o}={}){if(!(e instanceof Element))throw new TypeError('"element" must be an instance of Element.');if("string"!=typeof t)throw new TypeError('"hiddenClass" must be a string.');if("string"!=typeof r)throw new TypeError('"visibleClass" must be a string.');if(void 0!==n&&"function"!=typeof n)throw new TypeError('"onVisible" must be a function if provided.');if(void 0!==o&&"function"!=typeof o)throw new TypeError('"onHidden" must be a function if provided.');const i=()=>{e.classList.remove(t),e.classList.remove(r)};let s=null;const a=["visibilitychange","mozvisibilitychange","webkitvisibilitychange","msvisibilitychange"],l=["hidden","mozHidden","webkitHidden","msHidden"];for(let e=0;e<l.length;e++)if(l[e]in document){s=l[e];break}const u=function(a){i();const l=a?.type,u=s&&document[s];["focus","focusin","pageshow"].includes(l)?(e.classList.add(r),n?.()):["blur","focusout","pagehide"].includes(l)||u?(e.classList.add(t),o?.()):(e.classList.add(r),n?.())};let c=()=>{};if(s){const e=a[l.indexOf(s)];document.addEventListener(e,u),window.addEventListener("focus",u),window.addEventListener("blur",u),c=()=>{document.removeEventListener(e,u),window.removeEventListener("focus",u),window.removeEventListener("blur",u),i()}}else"onfocusin"in document?(document.onfocusin=document.onfocusout=u,c=()=>{document.onfocusin=document.onfocusout=null,i()}):(window.onpageshow=window.onpagehide=window.onfocus=window.onblur=u,c=()=>{window.onpageshow=window.onpagehide=window.onfocus=window.onblur=null,i()});const h=new Event(s&&document[s]?"blur":"focus");return u(h),c}const K=(e,t)=>e.bottom<t.top,Z=(e,t)=>e.top>t.bottom,ee=(e,t)=>e.right<t.left,te=(e,t)=>e.left>t.right,re=(e,t)=>e.bottom<=t.top,ne=(e,t)=>e.top>=t.bottom,oe=(e,t)=>e.right<=t.left,ie=(e,t)=>e.left>=t.right,se=(e,t)=>!(ee(e,t)||te(e,t)||K(e,t)||Z(e,t)),ae=(e,t)=>!(oe(e,t)||ie(e,t)||re(e,t)||ne(e,t)),le=(e,t)=>ee(e,t)?"left":te(e,t)?"right":K(e,t)?"top":Z(e,t)?"bottom":null,ue=(e,t)=>oe(e,t)?"left":ie(e,t)?"right":re(e,t)?"top":ne(e,t)?"bottom":null,ce=(e,t)=>({overlapLeft:t.right-e.left,overlapRight:e.right-t.left,overlapTop:t.bottom-e.top,overlapBottom:e.bottom-t.top}),he=({overlapLeft:e=-1,overlapRight:t=-1,overlapTop:r=-1,overlapBottom:n=-1}={})=>({dirX:e<t?"right":"left",dirY:r<n?"bottom":"top"}),de=e=>({x:e.left+e.width/2,y:e.top+e.height/2});function fe(e,t){const r=e.left+e.width/2,n=e.top+e.height/2;return{x:t.left+t.width/2-r,y:t.top+t.height/2-n}}function me(e,t){if(!ae(e,t))return{inDir:null,dirX:null,dirY:null,depthX:0,depthY:0};const{overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}=ce(e,t),{dirX:s,dirY:a}=he({overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}),l=Math.min(r,n),u=Math.min(o,i);let c;return c=l<u?s:a,{inDir:c,dirX:s,dirY:a,depthX:l,depthY:u}}function pe(e,t){const r=ae(e,t),n={in:null,x:null,y:null},o={y:null,x:null},i={top:0,bottom:0,left:0,right:0},{overlapLeft:s,overlapRight:a,overlapTop:l,overlapBottom:u}=ce(t,e);i.top=l,i.bottom=u,i.left=s,i.right=a;const c=Object.entries(i).filter((([,e])=>e>0)).sort(((e,t)=>e[1]-t[1])),{dirX:h,dirY:d}=he({overlapLeft:a,overlapRight:s,overlapTop:u,overlapBottom:l});return n.y=d,n.x=h,i.bottom<0?o.y="bottom":i.top<0&&(o.y="top"),i.left<0?o.x="left":i.right<0&&(o.x="right"),n.in=r?i.top===i.bottom&&i.bottom===i.left&&i.left===i.right?"center":c.length?c[0][0]:"top":null,{dirs:n,depth:i,isNeg:o}}const{areElsColliding:ge,areElsPerfColliding:ye,areElsCollTop:be,areElsCollBottom:we,areElsCollLeft:ve,areElsCollRight:Ee}=e,Te=new WeakMap,xe=new WeakMap,Se={top:new WeakMap,bottom:new WeakMap,left:new WeakMap,right:new WeakMap};class Ce{static Utils={...e};static createElement(e,t){if("string"!=typeof e)throw new TypeError("[TinyHtml] createElement(): The tagName must be a string.");if(void 0!==t&&"object"!=typeof t)throw new TypeError("[TinyHtml] createElement(): The ops must be a object.");return new Ce(document.createElement(e,t))}static createTextNode(e){if("string"!=typeof e)throw new TypeError("[TinyHtml] createTextNode(): The value must be a string.");return new Ce(document.createTextNode(e))}static createElementFromHTML(e){const t=document.createElement("template");if(!(e=e.trim()).startsWith("<"))return Ce.createTextNode(e);if(t.innerHTML=e,!(t.content.firstChild instanceof Element))throw new Error("");return new Ce(t.content.firstChild)}static query(e,t=document){const r=t.querySelector(e);return r?new Ce(r):null}querySelector(e){return Ce.query(e,Ce._preElem(this,"query"))}static queryAll(e,t=document){const r=t.querySelectorAll(e);return Ce.toTinyElm([...r])}querySelectorAll(e){return Ce.queryAll(e,Ce._preElem(this,"queryAll"))}static getById(e){const t=document.getElementById(e);return t?new Ce(t):null}static getByClassName(e,t=document){const r=t.getElementsByClassName(e);return Ce.toTinyElm([...r])}getElementsByClassName(e){return Ce.getByClassName(e,Ce._preElem(this,"getByClassName"))}static getByName(e){const t=document.getElementsByName(e);return Ce.toTinyElm([...t])}static getByTagNameNS(e,t="http://www.w3.org/1999/xhtml",r=document){const n=r.getElementsByTagNameNS(t,e);return Ce.toTinyElm([...n])}getElementsByTagNameNS(e,t="http://www.w3.org/1999/xhtml"){return Ce.getByTagNameNS(e,t,Ce._preElem(this,"getByTagNameNS"))}get(){return this.#H}_getElement(e){if(!(this.#H instanceof Element||this.#H instanceof Window||this.#H instanceof Document))throw new Error(`[TinyHtml] Invalid Element in ${e}().`);return this.#H}static _preElemsTemplate(e,t,r,n){const o=e=>e.map((e=>{const o=e instanceof Ce?e._getElement(t):e;let i=!1;for(const e of r)if(o instanceof e){i=!0;break}if(!i)throw new Error(`[TinyHtml] Invalid element of the list "${n.join(",")}" in ${t}().`);return o}));return Array.isArray(e)?o(e):o([e])}static _preElemTemplate(e,t,r,n,o=!1){const i=e=>{const i=e[0];let s=i instanceof Ce?i._getElement(t):i,a=!1;for(const e of r)if(s instanceof e){a=!0;break}if(o&&null==s&&(s=null,a=!0),!a)throw new Error(`[TinyHtml] Invalid element of the list "${n.join(",")}" in ${t}().`);return s};if(!Array.isArray(e))return i([e]);if(e.length>1)throw new Error(`[TinyHtml] Invalid element amount in ${t}() (Received ${e.length}/1).`);return i(e)}static _preElems(e,t){return Ce._preElemsTemplate(e,t,[Element],["Element"])}static _preElem(e,t){return Ce._preElemTemplate(e,t,[Element],["Element"])}static _preNodeElems(e,t){return Ce._preElemsTemplate(e,t,[Node],["Node"])}static _preNodeElem(e,t){return Ce._preElemTemplate(e,t,[Node],["Node"])}static _preNodeElemWithNull(e,t){return Ce._preElemTemplate(e,t,[Node],["Node"],!0)}static _preHtmlElems(e,t){return Ce._preElemsTemplate(e,t,[HTMLElement],["HTMLElement"])}static _preHtmlElem(e,t){return Ce._preElemTemplate(e,t,[HTMLElement],["HTMLElement"])}static _preInputElems(e,t){return Ce._preElemsTemplate(e,t,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}static _preInputElem(e,t){return Ce._preElemTemplate(e,t,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}static _preEventTargetElems(e,t){return Ce._preElemsTemplate(e,t,[EventTarget],["EventTarget"])}static _preEventTargetElem(e,t){return Ce._preElemTemplate(e,t,[EventTarget],["EventTarget"])}static _preElemsAndWindow(e,t){return Ce._preElemsTemplate(e,t,[Element,Window],["Element","Window"])}static _preElemAndWindow(e,t){return Ce._preElemTemplate(e,t,[Element,Window],["Element","Window"])}static _preElemsAndWinAndDoc(e,t){return Ce._preElemsTemplate(e,t,[Element,Window,Document],["Element","Window","Document"]).map((e=>e instanceof Document?e.documentElement:e))}static _preElemAndWinAndDoc(e,t){const r=Ce._preElemTemplate(e,t,[Element,Window,Document],["Element","Window","Document"]);return r instanceof Document?r.documentElement:r}static _preElemsWithDoc(e,t){return Ce._preElemsTemplate(e,t,[Element,Document],["Element","Document"])}static _preElemWithDoc(e,t){return Ce._preElemTemplate(e,t,[Element,Document],["Element","Document"])}static toTinyElm(e){const t=e=>e.map((e=>e instanceof Ce?e:new Ce(e)));return Array.isArray(e)?t(e):t([e])}static fromTinyElm(e){const t=e=>e.map((e=>e instanceof Ce?e._getElement("fromTinyElm"):e));return Array.isArray(e)?t(e):t([e])}static winnow(e,t,r,n=!1){if("boolean"!=typeof n)throw new TypeError('The "not" must be a boolean.');if("function"==typeof t)return Ce._preElems(e,r).filter(((e,r)=>!!t.call(e,r,e)!==n));if(t instanceof Element)return Ce._preElems(e,r).filter((e=>e===t!==n));if(Array.isArray(t)||"string"!=typeof t&&null!=t.length)return Ce._preElems(e,r).filter((e=>t.includes(e)!==n));let o=t;return n&&(o=`:not(${o})`),Ce._preElems(e,r).filter((e=>1===e.nodeType&&e.matches(o)))}static filter(e,t,r=!1){return r&&(t=`:not(${t})`),Ce._preElems(e,"filter").filter((e=>1===e.nodeType&&e.matches(t)))}static filterOnly(e,t){return Ce.winnow(e,t,"filterOnly",!1)}static not(e,t){return Ce.winnow(e,t,"not",!0)}not(e){return Ce.not(this,e)}static find(e,t){const r=[];for(const n of Ce._preElems(e,"find"))r.push(...n.querySelectorAll(t));return[...new Set(r)]}find(e){return Ce.find(this,e)}static is(e,t){return Ce.winnow(e,t,"is",!1).length>0}is(e){return Ce.is(this,e)}static has(e,t){const r="string"==typeof t?[...document.querySelectorAll(t)]:Ce._preElems(t,"has");return Ce._preElems(e,"has").filter((e=>r.some((t=>e&&e.contains(t)))))}has(e){return Ce.has(this,e).length>0}static closest(e,t,r){const n=[];for(const o of Ce._preElems(e,"closest")){let e=o;for(;e&&e!==r;){if(1===e.nodeType&&("string"==typeof t?e.matches(t):e===t)){n.push(e);break}e=e.parentElement}}return[...new Set(n)]}closest(e,t){return Ce.closest(this,e,t)}static isSameDom(e,t){return Ce._preNodeElem(e,"isSameDom")===Ce._preNodeElem(t,"isSameDom")}isSameDom(e){return Ce.isSameDom(this,e)}_data={};static _dataSelector={public:(e,t)=>{const r=Ce._preElem(t,e);let n=xe.get(r);return n||(n={},xe.set(r,n)),n},private:(e,t)=>{if(!(t instanceof Ce))throw new Error(`Element must be a TinyHtml instance to execute ${e}().`);return t._data}};static data(e,t,r=!1){const n=Ce._dataSelector[r?"private":"public"]("data",e);if(null==t)return{...n};if("string"!=typeof t)throw new TypeError("The key must be a string.");return n.hasOwnProperty(t)?n[t]:void 0}data(e,t){return Ce.data(this,e,t)}static setData(e,t,r,n=!1){const o=Ce._dataSelector[n?"private":"public"]("setData",e);if("string"!=typeof t)throw new TypeError("The key must be a string.");return o[t]=r,e}setData(e,t,r=!1){return Ce.setData(this,e,t,r)}static _getSibling(e,t,r){let n=Ce._preNodeElemWithNull(e,r);for(;n&&(n=n[t])&&1!==n.nodeType;);return n instanceof Node?n:null}static _getSiblings(e,t){let r=e;const n=[];for(;r;r=r.nextSibling)1===r.nodeType&&r!==t&&n.push(r);return n}static domDir(e,t,r,n="domDir"){if("string"!=typeof t)throw new TypeError('The "direction" must be a string.');let o=Ce._preNodeElemWithNull(e,n);const i=[];for(;o&&(o=o[t]);)if(1===o.nodeType){if(r&&("string"==typeof r?o.matches(r):o===r))break;i.push(o)}return i}static parent(e){let t=Ce._preNodeElemWithNull(e,"parent");const r=t?t.parentNode:null;return r&&11!==r.nodeType?r:null}parent(){return Ce.parent(this)}static parents(e,t){return Ce.domDir(e,"parentNode",t,"parents")}parents(e){return Ce.parents(this,e)}static next(e){return Ce._getSibling(e,"nextSibling","next")}next(){return Ce.next(this)}static prev(e){return Ce._getSibling(e,"previousSibling","prev")}prev(){return Ce.prev(this)}static nextAll(e){return Ce.domDir(e,"nextSibling",void 0,"nextAll")}nextAll(){return Ce.nextAll(this)}static prevAll(e){return Ce.domDir(e,"previousSibling",void 0,"prevAll")}prevAll(){return Ce.prevAll(this)}static nextUntil(e,t){return Ce.domDir(e,"nextSibling",t,"nextUtil")}nextUntil(e){return Ce.nextUntil(this,e)}static prevUntil(e,t){return Ce.domDir(e,"previousSibling",t,"prevUtil")}prevUntil(e){return Ce.prevUntil(this,e)}static siblings(e){const t=Ce._preNodeElemWithNull(e,"siblings");return Ce._getSiblings(t&&t.parentNode?t.parentNode.firstChild:null,t)}siblings(){return Ce.siblings(this)}static children(e){const t=Ce._preNodeElemWithNull(e,"children");return Ce._getSiblings(t?t.firstChild:null)}children(){return Ce.children(this)}static contents(e){const t=Ce._preNodeElemWithNull(e,"contents");return t instanceof HTMLIFrameElement&&null!=t.contentDocument&&Object.getPrototypeOf(t.contentDocument)?[t.contentDocument]:t instanceof HTMLTemplateElement?Array.from((t.content||t).childNodes):t?Array.from(t.childNodes):[]}contents(){return Ce.contents(this)}static clone(e,t=!0){if("boolean"!=typeof t)throw new TypeError('The "deep" must be a boolean.');return Ce._preNodeElems(e,"clone").map((e=>e.cloneNode(t)))}clone(e){return Ce.clone(this,e)[0]}static _appendChecker(e,...t){const r=[],n=[...t];for(const t in n)"string"!=typeof n[t]?r.push(Ce._preNodeElem(n[t],e)):r.push(n[t]);return r}static append(e,...t){return Ce._preElem(e,"append").append(...Ce._appendChecker("append",...t)),e}append(...e){return Ce.append(this,...e)}static prepend(e,...t){return Ce._preElem(e,"prepend").prepend(...Ce._appendChecker("prepend",...t)),e}prepend(...e){return Ce.prepend(this,...e)}static before(e,...t){return Ce._preElem(e,"before").before(...Ce._appendChecker("before",...t)),e}before(...e){return Ce.before(this,...e)}static after(e,...t){return Ce._preElem(e,"after").after(...Ce._appendChecker("after",...t)),e}after(...e){return Ce.after(this,...e)}static replaceWith(e,...t){return Ce._preElem(e,"replaceWith").replaceWith(...Ce._appendChecker("replaceWith",...t)),e}replaceWith(...e){return Ce.replaceWith(this,...e)}static appendTo(e,t){const r=Ce._preNodeElems(e,"appendTo"),n=Ce._preNodeElems(t,"appendTo");return n.forEach(((e,t)=>{r.forEach((r=>e.appendChild(t===n.length-1?r:r.cloneNode(!0))))})),e}appendTo(e){return Ce.appendTo(this,e)}static prependTo(e,t){const r=Ce._preElems(e,"prependTo"),n=Ce._preElems(t,"prependTo");return n.forEach(((e,t)=>{r.slice().reverse().forEach((r=>e.prepend(t===n.length-1?r:r.cloneNode(!0))))})),e}prependTo(e){return Ce.prependTo(this,e)}static insertBefore(e,t,r=null){const n=Ce._preNodeElem(e,"insertBefore"),o=Ce._preNodeElem(t,"insertBefore"),i=Ce._preNodeElemWithNull(r,"insertBefore");if(!o.parentNode)throw new Error("");return o.parentNode.insertBefore(n,i||o),e}insertBefore(e,t){return Ce.insertBefore(this,e,t)}static insertAfter(e,t,r=null){const n=Ce._preNodeElem(e,"insertAfter"),o=Ce._preNodeElem(t,"insertBefore"),i=Ce._preNodeElemWithNull(r,"insertBefore");if(!o.parentNode)throw new Error("");return o.parentNode.insertBefore(n,i||o.nextSibling),e}insertAfter(e,t){return Ce.insertAfter(this,e,t)}static replaceAll(e,t){const r=Ce._preNodeElems(e,"replaceAll"),n=Ce._preNodeElems(t,"replaceAll");return n.forEach(((e,t)=>{const o=e.parentNode;r.forEach((r=>{o&&o.replaceChild(t===n.length-1?r:r.cloneNode(!0),e)}))})),e}replaceAll(e){return Ce.replaceAll(this,e)}#H;constructor(e){if(e instanceof Ce)throw new Error("[TinyHtml] You are trying to put a TinyHtml inside another TinyHtml in constructor.");if(!(e instanceof Element||e instanceof Window||e instanceof Document||e instanceof Text))throw new Error("[TinyHtml] Invalid Target in constructor.");this.#H=e}static isWindow(e){return null!=e&&e===e.window}static css(e){const t=Ce._preElem(e,"css");return window.getComputedStyle(t)}css(){return Ce.css(this)}static cssString(e,t){const r=Ce._preElem(e,"cssString");if("string"!=typeof t)throw new TypeError("The prop must be a string.");const n=window.getComputedStyle(r)[t];return"string"==typeof n?n:"number"==typeof n?n.toString():null}cssString(e){return Ce.cssString(this,e)}static cssList(e,t){const r=Ce._preElem(e,"cssList");if(!Array.isArray(t))throw new TypeError("The prop must be an array of strings.");const n=window.getComputedStyle(r),o={};for(const e of t)void 0!==e&&(o[e]=n.getPropertyValue(e));return o}cssList(e){return Ce.cssList(this,e)}static cssFloat(e,t){const r=Ce._preElem(e,"cssFloat");if("string"!=typeof t)throw new TypeError("The prop must be a string.");const n=window.getComputedStyle(r)[t];return parseFloat(n)||0}cssFloat(e){return Ce.cssFloat(this,e)}static cssFloats(e,t){const r=Ce._preElem(e,"cssFloats");if(!Array.isArray(t))throw new TypeError("The prop must be an array of strings.");const n=window.getComputedStyle(r),o={};for(const e of t)o[e]=parseFloat(n[e])||0;return o}cssFloats(e){return Ce.cssFloats(this,e)}static#W={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(Ce.#W,{set:(e,t,r)=>(e[t]=r,Ce.cssPropRevAliases[r]=t,!0)});static cssPropRevAliases=Object.fromEntries(Object.entries(Ce.#W).map((([e,t])=>[t,e])));static toStyleKc(e){return"string"==typeof Ce.cssPropAliases[e]?Ce.cssPropAliases[e]:e}static toStyleCc(e){return"string"==typeof Ce.cssPropRevAliases[e]?Ce.cssPropRevAliases[e]:e}static setStyle(e,t,r=null){return Ce._preHtmlElems(e,"setStyle").forEach((e=>{if("object"==typeof t)for(const[r,n]of Object.entries(t))e.style.setProperty(Ce.toStyleKc(r),"string"==typeof n?n:"number"==typeof n?`${n}px`:String(n));else e.style.setProperty(Ce.toStyleKc(t),r)})),e}setStyle(e,t){return Ce.setStyle(this,e,t)}static getStyle(e,t){return Ce._preHtmlElem(e,"getStyle").style.getPropertyValue(Ce.toStyleKc(t))}getStyle(e){return Ce.getStyle(this,e)}static style(e,{camelCase:t=!1,rawAttr:r=!1}={}){if("boolean"!=typeof t)throw new TypeError('"camelCase" must be a boolean. Received: '+typeof t);if("boolean"!=typeof r)throw new TypeError('"rawAttr" must be a boolean. Received: '+typeof r);const n=Ce._preHtmlElem(e,"style"),o={};if(r){const e=(n.getAttribute("style")||"").split(";");for(const r of e){const[e,n]=r.split(":");if(!e||!n)continue;const i=e.trim(),s=n.trim();o[t?Ce.toStyleCc(i):i]=s}}else{const e=n.style;for(let r=0;r<e.length;r++){const n=e[r],i=e.getPropertyValue(n);o[t?Ce.toStyleCc(n):n]=i}}return o}style(e){return Ce.style(this,e)}static removeStyle(e,t){return Ce._preHtmlElems(e,"removeStyle").forEach((e=>{if(Array.isArray(t))for(const r of t)e.style.removeProperty(Ce.toStyleKc(r));else e.style.removeProperty(Ce.toStyleKc(t))})),e}removeStyle(e){return Ce.removeStyle(this,e)}static toggleStyle(e,t,r,n){return Ce._preHtmlElems(e,"toggleStyle").forEach((e=>{const o=Ce.getStyle(e,t).trim()===Ce.toStyleKc(r)?n:r;Ce.setStyle(e,t,o)})),e}toggleStyle(e,t,r){return Ce.toggleStyle(this,e,t,r)}static clearStyle(e){return Ce._preElems(e,"clearStyle").forEach((e=>e.removeAttribute("style"))),e}clearStyle(){return Ce.clearStyle(this)}static focus(e){return Ce._preHtmlElem(e,"focus").focus(),e}focus(){return Ce.focus(this)}static blur(e){return Ce._preHtmlElem(e,"blur").blur(),e}blur(){return Ce.blur(this)}static boolCheck(e){return void 0!==e&&("true"===e||"1"===e||!0===e||"on"===e||"number"==typeof e&&e>0)}static setWinScrollTop(e){if("number"!=typeof e)throw new TypeError("The value must be a number.");Ce.setScrollTop(window,e)}static setWinScrollLeft(e){if("number"!=typeof e)throw new TypeError("The value must be a number.");Ce.setScrollLeft(window,e)}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(e,t,r="content"){const n=Ce._preElemAndWinAndDoc(e,"getDimension");if("string"!=typeof t)throw new TypeError("The type must be a string.");if("string"!=typeof r)throw new TypeError("The extra must be a string.");const o="width"===t?"Width":"Height";if(Ce.isWindow(n))return"margin"===r?n["inner"+o]:n.document.documentElement["client"+o];const i=n;if(9===i.nodeType){const e=i.documentElement;return Math.max(i.body["scroll"+o],e["scroll"+o],i.body["offset"+o],e["offset"+o],e["client"+o])}let s=i.getBoundingClientRect()[t];function a(e){return"width"===t?Ce.cssFloat(i,e+"Left")+Ce.cssFloat(i,e+"Right"):Ce.cssFloat(i,e+"Top")+Ce.cssFloat(i,e+"Bottom")}switch(r){case"content":s-=a("padding"),s-=a("border");break;case"padding":s-=a("border");break;case"border":break;case"margin":s+=a("margin")}return s}getDimension(e,t){return Ce.getDimension(this,e,t)}static setHeight(e,t){const r=Ce._preHtmlElem(e,"setHeight");if("number"!=typeof t&&"string"!=typeof t)throw new TypeError("The value must be a string or number.");return r.style.height="number"==typeof t?`${t}px`:t,e}setHeight(e){return Ce.setHeight(this,e)}static setWidth(e,t){const r=Ce._preHtmlElem(e,"setWidth");if("number"!=typeof t&&"string"!=typeof t)throw new TypeError("The value must be a string or number.");return r.style.width="number"==typeof t?`${t}px`:t,e}setWidth(e){return Ce.setWidth(this,e)}static height(e){const t=Ce._preElemAndWinAndDoc(e,"height");return Ce.getDimension(t,"height","content")}height(){return Ce.height(this)}static width(e){const t=Ce._preElemAndWinAndDoc(e,"width");return Ce.getDimension(t,"width","content")}width(){return Ce.width(this)}static innerHeight(e){const t=Ce._preElemAndWinAndDoc(e,"innerHeight");return Ce.getDimension(t,"height","padding")}innerHeight(){return Ce.innerHeight(this)}static innerWidth(e){const t=Ce._preElemAndWinAndDoc(e,"innerWidth");return Ce.getDimension(t,"width","padding")}innerWidth(){return Ce.innerWidth(this)}static outerHeight(e,t=!1){if("boolean"!=typeof t)throw new TypeError('The "includeMargin" must be a boolean.');const r=Ce._preElemAndWinAndDoc(e,"outerHeight");return Ce.getDimension(r,"height",t?"margin":"border")}outerHeight(e){return Ce.outerHeight(this,e)}static outerWidth(e,t=!1){if("boolean"!=typeof t)throw new TypeError('The "includeMargin" must be a boolean.');const r=Ce._preElemAndWinAndDoc(e,"outerWidth");return Ce.getDimension(r,"width",t?"margin":"border")}outerWidth(e){return Ce.outerWidth(this,e)}static animate(e,t,r){return Ce._preElems(e,"animate").forEach((e=>e.animate(t,r))),e}animate(e,t){return Ce.animate(this,e,t)}static offset(e){const t=Ce._preElem(e,"offset").getBoundingClientRect(),r=window.scrollY||document.documentElement.scrollTop,n=window.scrollX||document.documentElement.scrollLeft;return{top:t.top+r,left:t.left+n}}offset(){return Ce.offset(this)}static position(e){const t=Ce._preHtmlElem(e,"position");let r,n,o={top:0,left:0};if("fixed"===window.getComputedStyle(t).position)n=t.getBoundingClientRect();else{n=Ce.offset(t),r=t.offsetParent||document.documentElement;const{position:e}=window.getComputedStyle(r);for(;r instanceof HTMLElement&&(r===document.body||r===document.documentElement)&&"static"===e;)r=r.parentNode;if(r instanceof HTMLElement&&r!==t&&1===r.nodeType){const{borderTopWidth:e,borderLeftWidth:t}=Ce.cssFloats(r,["borderTopWidth","borderLeftWidth"]);o=Ce.offset(r),o.top+=e,o.left+=t}}return{top:n.top-o.top-Ce.cssFloat(t,"marginTop"),left:n.left-o.left-Ce.cssFloat(t,"marginLeft")}}position(){return Ce.position(this)}static offsetParent(e){let t=Ce._preHtmlElem(e,"offsetParent").offsetParent;for(;t instanceof HTMLElement&&"static"===window.getComputedStyle(t).position;)t=t.offsetParent;return t instanceof HTMLElement?t:document.documentElement}offsetParent(){return Ce.offsetParent(this)}static scrollTop(e){const t=Ce._preElemAndWindow(e,"scrollTop");return Ce.isWindow(t)?t.pageYOffset:9===t.nodeType?t.defaultView.pageYOffset:t.scrollTop}scrollTop(){return Ce.scrollTop(this)}static scrollLeft(e){const t=Ce._preElemAndWindow(e,"scrollLeft");return Ce.isWindow(t)?t.pageXOffset:9===t.nodeType?t.defaultView.pageXOffset:t.scrollLeft}scrollLeft(){return Ce.scrollLeft(this)}static easings={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:(4-2*e)*e-1,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1};static scrollToXY(e,{targetX:t,targetY:r,duration:n,easing:o,onAnimation:i}={}){if(void 0!==t&&"number"!=typeof t)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!==n&&"number"!=typeof n)throw new TypeError("`duration` must be a number if provided.");if(void 0!==o&&"string"!=typeof o)throw new TypeError("`easing` must be a string if provided.");if(void 0!==o&&"function"!=typeof Ce.easings[o])throw new TypeError(`Unknown easing function: "${o}".`);if(void 0!==i&&"function"!=typeof i)throw new TypeError("`onAnimation` must be a function if provided.");const s=(e,t,r,n)=>{if(e instanceof Window)window.scrollTo(t,r);else if(9===e.nodeType)e.defaultView.scrollTo(t,r);else{const n=e instanceof Window?window.scrollX:e.scrollLeft,o=e instanceof Window?window.scrollY:e.scrollTop;n!==t&&(e.scrollLeft=t),o!==r&&(e.scrollTop=r)}"function"==typeof i&&i({x:t,y:r,isComplete:n>=1,time:n})};return Ce._preElemsAndWindow(e,"scrollToXY").forEach((e=>{const i=e instanceof Window?window.scrollX:e.scrollLeft,a=e instanceof Window?window.scrollY:e.scrollTop,l=t??i,u=r??a,c=l-i,h=u-a,d="string"==typeof o&&Ce.easings[o]||null;if("number"!=typeof n||"function"!=typeof d)return s(e,l,u,1);const f=performance.now(),m=n??0;requestAnimationFrame((function t(r){if("function"!=typeof d)return;const n=Math.min(1,(r-f)/m),o=d(n);s(e,i+c*o,a+h*o,n),n<1&&requestAnimationFrame(t)}))})),e}scrollToXY({targetX:e,targetY:t,duration:r,easing:n,onAnimation:o}={}){return Ce.scrollToXY(this,{targetX:e,targetY:t,duration:r,easing:n,onAnimation:o})}static setScrollTop(e,t){if("number"!=typeof t)throw new TypeError("ScrollTop value must be a number.");return Ce.scrollToXY(e,{targetY:t})}setScrollTop(e){return Ce.setScrollTop(this,e)}static setScrollLeft(e,t){if("number"!=typeof t)throw new TypeError("ScrollLeft value must be a number.");return Ce.scrollToXY(e,{targetX:t})}setScrollLeft(e){return Ce.setScrollLeft(this,e)}static borderWidth(e){const t=Ce._preElem(e,"borderWidth"),{borderLeftWidth:r,borderRightWidth:n,borderTopWidth:o,borderBottomWidth:i}=Ce.cssFloats(t,["borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"]);return{x:r+n,y:o+i,left:r,right:n,top:o,bottom:i}}borderWidth(){return Ce.borderWidth(this)}static border(e){const t=Ce._preElem(e,"border"),{borderLeft:r,borderRight:n,borderTop:o,borderBottom:i}=Ce.cssFloats(t,["borderLeft","borderRight","borderTop","borderBottom"]);return{x:r+n,y:o+i,left:r,right:n,top:o,bottom:i}}border(){return Ce.border(this)}static margin(e){const t=Ce._preElem(e,"margin"),{marginLeft:r,marginRight:n,marginTop:o,marginBottom:i}=Ce.cssFloats(t,["marginLeft","marginRight","marginTop","marginBottom"]);return{x:r+n,y:o+i,left:r,right:n,top:o,bottom:i}}margin(){return Ce.margin(this)}static padding(e){const t=Ce._preElem(e,"padding"),{paddingLeft:r,paddingRight:n,paddingTop:o,paddingBottom:i}=Ce.cssFloats(t,["paddingLeft","paddingRight","paddingTop","paddingBottom"]);return{x:r+n,y:o+i,left:r,right:n,top:o,bottom:i}}padding(){return Ce.padding(this)}static addClass(e,...t){return Ce._preElems(e,"addClass").forEach((e=>e.classList.add(...t))),e}addClass(...e){return Ce.addClass(this,...e)}static removeClass(e,...t){return Ce._preElems(e,"removeClass").forEach((e=>e.classList.remove(...t))),e}removeClass(...e){return Ce.removeClass(this,...e)}static replaceClass(e,t,r){if("string"!=typeof t)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 n=[];return Ce._preElems(e,"replaceClass").forEach((e=>n.push(e.classList.replace(t,r)))),n}replaceClass(e,t){return Ce.replaceClass(this,e,t)[0]}static classItem(e,t){const r=Ce._preElem(e,"classItem");if("number"!=typeof t)throw new TypeError('The "index" parameter must be a number.');return r.classList.item(t)}classItem(e){return Ce.classItem(this,e)}static toggleClass(e,t,r){if("string"!=typeof t)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 n=[];return Ce._preElems(e,"toggleClass").forEach((e=>n.push(e.classList.toggle(t,r)))),n}toggleClass(e,t){return Ce.toggleClass(this,e,t)[0]}static hasClass(e,t){const r=Ce._preElem(e,"hasClass");if("string"!=typeof t)throw new TypeError('The "token" parameter must be a string.');return r.classList.contains(t)}hasClass(e){return Ce.hasClass(this,e)}static classLength(e){return Ce._preElem(e,"classLength").classList.length}classLength(){return Ce.classLength(this)}static classList(e){return Ce._preElem(e,"classList").classList.values().toArray()}classList(){return Ce.classList(this)}static tagName(e){return Ce._preElem(e,"tagName").tagName}tagName(){return Ce.tagName(this)}static id(e){return Ce._preElem(e,"id").id}id(){return Ce.id(this)}static text(e){return Ce._preElem(e,"text").textContent}text(){return Ce.text(this)}static setText(e,t){if("string"!=typeof t)throw new Error("Value is not a valid string.");return Ce._preElems(e,"setText").forEach((e=>e.textContent=t)),e}setText(e){return Ce.setText(this,e)}static empty(e){return Ce._preElems(e,"empty").forEach((e=>e.textContent="")),e}empty(){return Ce.empty(this)}static html(e,t){return Ce._preElem(e,"html").getHTML(t)}html(e){return Ce.html(this,e)}static setHtml(e,t){if("string"!=typeof t)throw new Error("Value is not a valid string.");return Ce._preElems(e,"setHtml").forEach((e=>e.innerHTML=t)),e}setHtml(e){return Ce.setHtml(this,e)}static _valHooks={option:{get:e=>{const t=e.getAttribute("value");return null!=t?t:e.textContent}},select:{get:e=>{const t=e.options,r=e.selectedIndex,n="select-one"===e.type,o=n?r+1:t.length,i=[];let s=r<0?o:n?r:0;for(;s<o;s++){const e=t[s],o=e.parentNode;if((e.selected||s===r)&&!e.disabled&&(!o||!o.disabled||"OPTGROUP"!==o.tagName)){const t=Ce._valHooks.option.get(e);if(n)return t;i.push(t)}}return i},set:(e,t)=>{const r=e.options,n=Array.isArray(t)?t.map(String):[String(t)];let o=!1;for(let e=0;e<r.length;e++){const t=r[e],i=Ce._valHooks.option.get(t);"string"==typeof i&&(t.selected=n.includes(i))&&(o=!0)}return o||(e.selectedIndex=-1),n}},radio:{get:e=>e.checked?"on":"off",set(e,t){if("boolean"==typeof t){const r=e.closest("label");return t&&r&&r.querySelectorAll('input[type="radio"]').forEach((t=>{t instanceof HTMLInputElement&&t!==e&&(t.checked=!1)})),e.checked=t,t}}},checkbox:{get:e=>e.checked?"on":"off",set(e,t){if("boolean"==typeof t)return e.checked=t,t}}};static setVal(e,t){return Ce._preInputElems(e,"setVal").forEach((e=>{if(1!==e.nodeType)return;let r="function"==typeof t?t(e,Ce.val(e)):t;null==r?r="":"number"==typeof r?r=String(r):Array.isArray(r)&&(r=(e=>{const t=[];for(let n=0;n<e.length;n++)t.push(null==(r=e[n])?"":String(r));var r;return t})(r));const n=Ce._valHooks[e.type]||Ce._valHooks[e.nodeName.toLowerCase()];if(!n||"function"!=typeof n.set||void 0===n.set(e,r,"value")){if("string"!=typeof r&&"boolean"!=typeof r)throw new Error(`Invalid setValue "${typeof r}" value.`);"string"==typeof r&&(e.value=r)}})),e}setVal(e){return Ce.setVal(this,e)}static _valTypes={string:e=>e.value,date:e=>e.valueAsDate,number:e=>e.valueAsNumber};static _getValByType(e,t,r){if("string"!=typeof t)throw new TypeError('The "type" must be a string.');if("string"!=typeof r)throw new TypeError('The "where" must be a string.');if(!(e instanceof HTMLInputElement))throw new Error(`Provided element is not an HTMLInputElement in ${r}().`);if("function"!=typeof Ce._valTypes[t])throw new Error(`No handler found for type "${t}" in ${r}().`);return Ce._valTypes[t](e)}static _val(e,t,r){const n=Ce._preInputElem(e,t),o=Ce._valHooks[n.type]||Ce._valHooks[n.nodeName.toLowerCase()];if(o&&"function"==typeof o.get){const e=o.get(n,"value",r);if(void 0!==e)return"string"==typeof e?e.replace(/\r/g,""):e}return Ce._getValByType(n,r,t)}_val(e,t){return Ce._val(this,e,t)}static val(e){return Ce._val(e,"val","string")}val(){return Ce.val(this)}static valTxt(e){const t=Ce._val(e,"valTxt","string");if("string"!=typeof t&&null!==t)throw new Error("Value is not a valid string.");return null==t?"":"string"==typeof t?t.replace(/\r/g,""):t}valTxt(){return Ce.valTxt(this)}static _valArr(e,t,r){const n=Ce._val(e,t,r);if(!Array.isArray(n))throw new Error(`Value expected an array but got ${typeof n}.`);return n}_valArr(e,t){return Ce._valArr(this,e,t)}static valArr(e){return Ce._valArr(e,"valArr","string")}valArr(){return Ce.valArr(this)}static valNb(e){if(!(Ce._preInputElem(e,"valNb")instanceof HTMLInputElement))throw new Error("Element must be an input element.");const t=Ce._val(e,"valNb","number");if(Number.isNaN(t))throw new Error("Value is not a valid number.");return t}valNb(){return Ce.valNb(this)}static valDate(e){if(!(Ce._preInputElem(e,"valDate")instanceof HTMLInputElement))throw new Error("Element must be an input element.");const t=Ce._val(e,"valDate","date");if(!(t instanceof Date))throw new Error("Value is not a valid date.");return t}valDate(){return Ce.valDate(this)}static valBool(e){const t=Ce._preInputElem(e,"valBool");if(!(t instanceof HTMLInputElement))throw new Error("Element must be an input element.");return"on"===Ce.val(t)}valBool(){return Ce.valBool(this)}static listenForPaste(e,{onFilePaste:t,onTextPaste:r}={}){if(void 0!==t&&"function"!=typeof t)throw new TypeError("onFilePaste must be a function.");if(void 0!==r&&"function"!=typeof r)throw new TypeError("onTextPaste must be a function.");const n=e=>{if(!(e instanceof ClipboardEvent))return;const n=e.clipboardData?.items||[];for(const e of n)if("file"===e.kind){if("function"==typeof t){const r=e.getAsFile();r&&t(e,r)}}else"string"===e.kind&&"function"==typeof r&&e.getAsString((t=>r(e,t)))};return Ce._preElemsWithDoc(e,"listenForPaste").forEach((e=>Ce.on(e,"paste",n))),n}listenForPaste({onFilePaste:e,onTextPaste:t}={}){return Ce.listenForPaste(this,{onFilePaste:e,onTextPaste:t})}static hasEventListener(e,t){const r=Ce._preEventTargetElem(e,"hasEventListener");if(!Te.has(r))return!1;const n=Te.get(r);return!!(n&&Array.isArray(n[t])&&n[t].length>0)}hasEventListener(e){return Ce.hasEventListener(this,e)}static hasExactEventListener(e,t,r){const n=Ce._preEventTargetElem(e,"hasExactEventListener");if("function"!=typeof r)throw new TypeError('The "handler" must be a function.');if(!Te.has(n))return!1;const o=Te.get(n);return!(!o||!Array.isArray(o[t]))&&o[t].some((e=>e.handler===r))}hasExactEventListener(e,t){return Ce.hasExactEventListener(this,e,t)}static on(e,t,r,n){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return Ce._preEventTargetElems(e,"on").forEach((e=>{e.addEventListener(t,r,n),Te.has(e)||Te.set(e,{});const o=Te.get(e);o&&(Array.isArray(o[t])||(o[t]=[]),o[t].push({handler:r,options:n}))})),e}on(e,t,r){return Ce.on(this,e,t,r)}static once(e,t,r,n={}){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return Ce._preEventTargetElems(e,"once").forEach((e=>{const o=n=>{Ce.off(e,t,o),"function"==typeof r&&r(n)};Ce.on(e,t,o,"boolean"==typeof n?n:{...n,once:!0})})),e}once(e,t,r={}){return Ce.once(this,e,t,r)}static off(e,t,r,n){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return Ce._preEventTargetElems(e,"off").forEach((e=>{e.removeEventListener(t,r,n);const o=Te.get(e);o&&o[t]&&(o[t]=o[t].filter((e=>e.handler!==r)),0===o[t].length&&delete o[t])})),e}off(e,t,r){return Ce.off(this,e,t,r)}static offAll(e,t){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return Ce._preEventTargetElems(e,"offAll").forEach((e=>{const r=Te.get(e);if(r&&r[t]){for(const n of r[t])e.removeEventListener(t,n.handler,n.options);delete r[t]}})),e}offAll(e){return Ce.offAll(this,e)}static offAllTypes(e,t=null){if(null!==t&&"function"!=typeof t)throw new TypeError('The "filterFn" must be a function.');return Ce._preEventTargetElems(e,"offAllTypes").forEach((e=>{const r=Te.get(e);if(r){for(const n in r)for(const o of r[n])("function"!=typeof t||t(o.handler,n))&&e.removeEventListener(n,o.handler,o.options);Te.delete(e)}})),e}offAllTypes(e=null){return Ce.offAllTypes(this,e)}static trigger(e,t,r={}){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return Ce._preEventTargetElems(e,"trigger").forEach((e=>{const n=r instanceof Event||r instanceof CustomEvent?r:new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e.dispatchEvent(n)})),e}trigger(e,t={}){return Ce.trigger(this,e,t)}static _propFix={for:"htmlFor",class:"className"};static attr(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return Ce._preElem(e,"attr").getAttribute(t)}attr(e){return Ce.attr(this,e)}static setAttr(e,t,r=null){if("string"!=typeof t)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 Ce._preElems(e,"setAttr").forEach((e=>{null===r?e.removeAttribute(t):e.setAttribute(t,r)})),e}setAttr(e,t){return Ce.setAttr(this,e,t)}static removeAttr(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return Ce._preElems(e,"removeAttr").forEach((e=>e.removeAttribute(t))),e}removeAttr(e){return Ce.removeAttr(this,e)}static hasAttr(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return Ce._preElem(e,"hasAttr").hasAttribute(t)}hasAttr(e){return Ce.hasAttr(this,e)}static hasProp(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return!!Ce._preElem(e,"hasProp")[Ce._propFix[t]||t]}hasProp(e){return Ce.hasProp(this,e)}static addProp(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return Ce._preElems(e,"addProp").forEach((e=>{e[t=Ce._propFix[t]||t]=!0})),e}addProp(e){return Ce.addProp(this,e)}static removeProp(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return Ce._preElems(e,"removeProp").forEach((e=>{e[t=Ce._propFix[t]||t]=!1})),e}removeProp(e){return Ce.removeProp(this,e)}static toggleProp(e,t,r){if("string"!=typeof t)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.');Ce._preElems(e,"toggleProp").forEach((e=>{const n=Ce._propFix[t]||t;(void 0===r?!e[n]:r)?Ce.addProp(e,t):Ce.removeProp(e,t)}))}toggleProp(e,t){return Ce.toggleProp(this,e,t)}static remove(e){return Ce._preElems(e,"remove").forEach((e=>e.remove())),e}remove(){return Ce.remove(this)}static index(e,t=null){const r=Ce._preElem(e,"index");if(!r)return-1;if(!t)return Array.prototype.indexOf.call(r.parentNode?.children||[],r);if(t){const e="string"==typeof t?document.querySelectorAll(t):Ce._preElems(t,"index");return Array.prototype.indexOf.call(e,r)}return-1}index(e){return Ce.index(this,e)}static _getCustomRect(e,t){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 t in e)"number"==typeof e[t]&&(r[t]=e[t]);if("object"!=typeof t||null===t||Array.isArray(t))throw new Error("");const{height:n=0,width:o=0,top:i=0,bottom:s=0,left:a=0,right:l=0}=t;if("number"!=typeof n)throw new Error("");if("number"!=typeof o)throw new Error("");if("number"!=typeof i)throw new Error("");if("number"!=typeof s)throw new Error("");if("number"!=typeof a)throw new Error("");if("number"!=typeof l)throw new Error("");return r.height+=n,r.width+=o,r.top+=i,r.bottom+=s,r.left+=a,r.right+=l,r}static isCollWith(e,t,r={}){const n=Ce._getCustomRect(Ce._preElem(e,"isCollWith").getBoundingClientRect(),r),o=Ce._preElem(t,"isCollWith").getBoundingClientRect();return ge(n,o)}isCollWith(e,t){return Ce.isCollWith(this,e,t)}static isCollPerfWith(e,t,r={}){const n=Ce._getCustomRect(Ce._preElem(e,"isCollPerfWith").getBoundingClientRect(),r),o=Ce._preElem(t,"isCollPerfWith").getBoundingClientRect();return ye(n,o)}isCollPerfWith(e,t){return Ce.isCollPerfWith(this,e,t)}static _isCollWithLock(e,t,r,n,o){const i=Se[o];if(e)return i.has(n)||i.set(n,!0),!0;if(i.has(n)){let e=!1;switch(o){case"top":e=be(t,r);break;case"bottom":e=we(t,r);break;case"left":e=ve(t,r);break;case"right":e=Ee(t,r)}return e&&i.delete(n),i.has(n)}return!1}static isCollWithLock(e,t,r,n={}){const o=Ce._preElem(e,"isCollWithLock"),i=Ce._preElem(t,"isCollWithLock"),s=Ce._getCustomRect(o.getBoundingClientRect(),n),a=i.getBoundingClientRect(),l=ge(s,a);return Ce._isCollWithLock(l,s,a,o,r)}isCollWithLock(e,t,r){return Ce.isCollWithLock(this,e,t,r)}static isCollPerfWithLock(e,t,r,n={}){const o=Ce._preElem(e,"isCollPerfWithLock"),i=Ce._preElem(t,"isCollPerfWithLock"),s=Ce._getCustomRect(o.getBoundingClientRect(),n),a=i.getBoundingClientRect(),l=ye(s,a);return Ce._isCollWithLock(l,s,a,o,r)}isCollPerfWithLock(e,t,r){return Ce.isCollPerfWithLock(this,e,t,r)}static resetCollLock(e){const t=Ce._preElem(e,"resetCollLock");let r=!1;for(const e of["top","bottom","left","right"])Se[e].has(t)&&(Se[e].delete(t),r=!0);return r}resetCollLock(){return Ce.resetCollLock(this)}static resetCollLockDir(e,t){const r=Ce._preElem(e,"resetCollLockDir"),n=Se[t];return!!n.has(r)&&(n.delete(r),!0)}resetCollLockDir(e){return Ce.resetCollLockDir(this,e)}static isInViewport(e){const t=Ce._preElem(e,"isInViewport");if(!t.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const r=Ce.offset(t).top,n=r+Ce.outerHeight(t),o=Ce.scrollTop(window),i=o+Ce.height(window);return n>o&&r<i}isInViewport(){return Ce.isInViewport(this)}static isScrolledIntoView(e){const t=Ce._preElem(e,"isScrolledIntoView");if(!t.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const r=Ce.scrollTop(window),n=r+Ce.height(window),o=Ce.offset(t).top;return o+Ce.height(t)<=n&&o>=r}isScrolledIntoView(){return Ce.isScrolledIntoView(this)}static isInContainer(e,t){const r=Ce._preElem(e,"isInContainer"),n=Ce._preElem(t,"isInContainer");if(!r.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const o=r.getBoundingClientRect(),i=n.getBoundingClientRect(),s=o.bottom>i.top&&o.top<i.bottom,a=o.right>i.left&&o.left<i.right;return s&&a}isInContainer(e){return Ce.isInContainer(this,e)}static isFullyInContainer(e,t){const r=Ce._preElem(e,"isScrolledIntoView"),n=Ce._preElem(t,"isInContainer");if(!r.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const o=r.getBoundingClientRect(),i=n.getBoundingClientRect();return o.top>=i.top&&o.bottom<=i.bottom&&o.left>=i.left&&o.right<=i.right}isFullyInContainer(e){return Ce.isFullyInContainer(this,e)}static hasScroll(e){const t=Ce._preElem(e,"hasScroll");return{v:t.scrollHeight>t.clientHeight,h:t.scrollWidth>t.clientWidth}}hasScroll(){return Ce.hasScroll(this)}}const Ae=Ce;function Le(e,t){return Ae.isCollWith(e,t)}const De=e=>Ae.borderWidth(e),ke=e=>Ae.border(e),_e=e=>Ae.margin(e),Me=e=>Ae.padding(e);function Be(e){const t=e.offsetTop,r=t+e.offsetHeight,n=window.scrollY,o=n+window.innerHeight;return r>n&&t<o}function Ie(e){const t=window.scrollY,r=t+window.innerHeight,n=e.offsetTop;return n+e.offsetHeight<=r&&n>=t}const Ne=class{#F;#$;#U;#z;#V;#q;#G;#J;constructor(e={}){const{target:t,fullscreen:r=!0,hoverClass:n="dnd-hover",onDrop:o,onEnter:i,onLeave:s}=e;if("boolean"!=typeof r)throw new TypeError('The "fullscreen" option must be a boolean.');const a=r?document.body:t||document.body;if(!(a instanceof HTMLElement))throw new TypeError('The "target" option must be an instance of HTMLElement.');if("string"!=typeof n)throw new TypeError('The "hoverClass" option must be a string.');if("function"!=typeof o)throw new TypeError('The "onDrop" option must be a function.');if("function"!=typeof i)throw new TypeError('The "onEnter" option must be a function.');if("function"!=typeof s)throw new TypeError('The "onLeave" option must be a function.');this.#F=a,this.#$=r,this.#U=n,this.#z=o||(()=>{}),this.#V=i,this.#q=s,this.#G=!1,this.#J=!1,this._handleDragEnter=this._handleDragEnter.bind(this),this._handleDragOver=this._handleDragOver.bind(this),this._handleDragLeave=this._handleDragLeave.bind(this),this._handleDrop=this._handleDrop.bind(this),this.#Y()}getTarget(){return this.#F}getHoverClass(){return this.#U}isFullScreen(){return this.#$}isDragging(){return this.#G}bound(){return this.#J}#Y(){if(this.#J)return;const e=this.getTarget();e.addEventListener("dragenter",this._handleDragEnter),e.addEventListener("dragover",this._handleDragOver),e.addEventListener("dragleave",this._handleDragLeave),e.addEventListener("drop",this._handleDrop),this.#J=!0}#X(){if(!this.#J)return;const e=this.getTarget();e.removeEventListener("dragenter",this._handleDragEnter),e.removeEventListener("dragover",this._handleDragOver),e.removeEventListener("dragleave",this._handleDragLeave),e.removeEventListener("drop",this._handleDrop),this.#J=!1}_handleDragEnter(e){if(e.preventDefault(),!this.#G){const t=this.getTarget();this.#G=!0,t.classList.add(this.#U),this.#V(e)}}_handleDragOver(e){e.preventDefault(),e.dataTransfer?e.dataTransfer.dropEffect="copy":console.warn("[TinyDragDropDetector] [handleDragOver] DragOver event missing dataTransfer.")}_handleDragLeave(e){e.preventDefault();const t=this.getTarget();null!==e.relatedTarget&&t.contains(e.relatedTarget)||(this.#G=!1,t.classList.remove(this.#U),this.#q(e))}_handleDrop(e){if(e.preventDefault(),!e.dataTransfer)return void console.warn("[TinyDragDropDetector] [handleDrop] DragOver event missing dataTransfer.");const t=this.getTarget();this.#G=!1,t.classList.remove(this.#U);const r=e.dataTransfer.files;r.length>0&&this.#z(r,e)}destroy(){this.#X(),this.getTarget().classList.remove(this.#U)}};var je=r(133),Pe=r(975);function Re(e){if(!(0,je.existsSync)(e))throw new Error(`File not found: ${e}`);const t=(0,je.readFileSync)(e,"utf-8");return JSON.parse(t)}function Oe(e,t,r=2){const n=JSON.stringify(t,null,r);(0,je.writeFileSync)(e,n,"utf-8")}function He(e){(0,je.existsSync)(e)||(0,je.mkdirSync)(e,{recursive:!0})}function We(e){if(!(0,je.existsSync)(e))return;const t=(0,je.readdirSync)(e);for(const r of t){const t=(0,Pe.join)(e,r);(0,je.lstatSync)(t).isDirectory()?(0,je.rmSync)(t,{recursive:!0,force:!0}):(0,je.unlinkSync)(t)}}function Fe(e){return(0,je.existsSync)(e)&&(0,je.lstatSync)(e).isFile()}function $e(e){return(0,je.existsSync)(e)&&(0,je.lstatSync)(e).isDirectory()}function Ue(e){return 0===(0,je.readdirSync)(e).length}function ze(e,t,r){He((0,Pe.dirname)(t)),(0,je.copyFileSync)(e,t,r)}function Ve(e){return!!Fe(e)&&((0,je.unlinkSync)(e),!0)}function qe(e,t,r="utf-8"){He((0,Pe.dirname)(e)),(0,je.writeFileSync)(e,t,r)}function Ge(e,t=!1){const r={files:[],dirs:[]};if(!$e(e))return r;const n=(0,je.readdirSync)(e);for(const o of n){const n=(0,Pe.join)(e,o);if((0,je.lstatSync)(n).isDirectory()){if(r.dirs.push(n),t){const e=Ge(n,!0);r.files.push(...e.files),r.dirs.push(...e.dirs)}}else r.files.push(n)}return r}function Je(e,t=!1){const r=[];if(!$e(e))return r;const n=(0,je.readdirSync)(e);for(const o of n){const n=(0,Pe.join)(e,o);(0,je.lstatSync)(n).isDirectory()&&(r.push(n),t&&r.push(...Je(n,!0)))}return r}function Ye(e){return Fe(e)?(0,je.statSync)(e).size:0}function Xe(e){let t=0;const r=Ge(e,!0).files;for(const e of r)t+=Ye(e);return t}function Qe(e,t="bak"){Fe(e)&&ze(e,`${e}.${t}.${(new Date).toISOString().replace(/[:.]/g,"-")}`)}function Ke(e,t="bak"){const r=(0,Pe.dirname)(e),n=(0,Pe.basename)(e),o=(0,je.readdirSync)(r).filter((e=>e.startsWith(`${n}.${t}.`))).sort().reverse();if(0===o.length)throw new Error(`No backups found for ${e}`);return(0,Pe.join)(r,o[0])}function Ze(e,t="bak"){ze(Ke(e,t),e)}function et(e,t,r=[]){if("string"!=typeof e)throw new TypeError("dirPath must be a string");if("function"!=typeof t)throw new TypeError("renameFn must be a function");if(!Array.isArray(r))throw new TypeError("extensions must be an array of strings");if(!(0,je.existsSync)(e)||!(0,je.statSync)(e).isDirectory())throw new Error(`Directory not found or invalid: ${e}`);for(const e of r)if("string"!=typeof e||!e.startsWith("."))throw new TypeError(`Invalid extension: ${e}`);const n=Ge(e).files;let o=0;for(const i of n){const n=(0,Pe.extname)(i);if(r.length&&!r.includes(n))continue;const s=(0,Pe.basename)(i),a=t(s,o++),l=(0,Pe.join)(e,a);s!==a&&(0,je.renameSync)(i,l)}}function tt(e,t,r,n=[]){et(e,(e=>{const n=(0,Pe.extname)(e);return`${(0,Pe.basename)(e,n).replace(t,r)}${n}`}),n)}function rt(e,{prefix:t="",suffix:r=""},n=[]){et(e,(e=>{const n=(0,Pe.extname)(e),o=(0,Pe.basename)(e,n);return`${t}${o}${r}${n}`}),n)}function nt(e,t="lower",r=[],n=!1){if("string"!=typeof t||!["lower","upper","title"].includes(t))throw new Error(`Invalid mode "${t}". Must be 'lower', 'upper' or 'title'.`);et(e,(e=>{const r=e=>"lower"===t?e.toLowerCase():"upper"===t?e.toUpperCase():"title"===t?j(e):e,o=(0,Pe.extname)(e),i=n?r(o):o;return`${r((0,Pe.basename)(e,o))}${i}`}),r)}function ot(e,t=3,r=[]){et(e,(e=>e.replace(/\d+/,(e=>e.padStart(t,"0")))),r)}var it=r(370);async function st(e){if(!(0,je.existsSync)(e))return;const t=await(0,it.readdir)(e),r={},n=[];for(const o of t){const t=(0,Pe.join)(e,o),i=(0,it.lstat)(t);i.then((e=>(r[t]=e,e))),n.push(i)}await Promise.all(n);const o=[];for(const e in r)r[e].isDirectory()?o.push((0,it.rm)(e,{recursive:!0,force:!0})):o.push((0,it.unlink)(e));await Promise.all(o)}async function at(e){return 0===(await(0,it.readdir)(e)).length}async function lt(e,t=!1){const r={files:[],dirs:[]};if(!$e(e))return r;const n=await(0,it.readdir)(e);for(const o of n){const n=(0,Pe.join)(e,o);if((await(0,it.lstat)(n)).isDirectory()){if(r.dirs.push(n),t){const e=await lt(n,!0);r.files.push(...e.files),r.dirs.push(...e.dirs)}}else r.files.push(n)}return r}async function ut(e,t=!1){const r=[];if(!$e(e))return r;const n=await(0,it.readdir)(e);for(const o of n){const n=(0,Pe.join)(e,o);(await(0,it.lstat)(n)).isDirectory()&&(r.push(n),t&&r.push(...await ut(n,!0)))}return r}async function ct(e){return Fe(e)?(await(0,it.stat)(e)).size:0}async function ht(e){let t=0;const{files:r}=await lt(e,!0),n=[];for(const e of r){const r=ct(e);r.then((e=>(t+=e,e))),n.push(r)}return await Promise.all(n),t}class dt{static Utils={...e,TinyHtml:Ae};#Q=!0;#K=!1;#Z=0;#ee=0;#te=!0;#re=!1;#ne=!1;#oe=!1;#ie=!1;#se=!1;#ae=!1;#le=null;#ue=[];#ce=null;#he={start:!1,end:!1,collide:!1,move:!1};#de=null;#F;#fe="drag-hidden";#me="dragging";#pe="drag-active";#ge="jail-drag-active";#ye="jail-drag-disabled";#be="dragging-collision";#we=9999;constructor(e,t={}){const r=e instanceof Ae?e.get():e;if(!(r instanceof HTMLElement))throw new Error("TinyDragger requires a valid target HTMLElement to initialize.");if(this.#F=r,void 0!==t.jail&&!(t.jail instanceof HTMLElement))throw new Error('The "jail" option must be an HTMLElement if provided.');if(void 0!==t.defaultZIndex&&this.setDefaultZIndex(t.defaultZIndex),void 0!==t.vibration&&!1!==t.vibration&&!E(t.vibration))throw new Error('The "vibration" option must be an object or false.');const n=(e,t)=>{if(void 0!==e&&"boolean"!=typeof e)throw new Error(`The "${t}" option must be a boolean.`)},o=(e,t)=>{if(void 0!==e&&"string"!=typeof e)throw new Error(`The "${t}" option must be a string.`)};n(t.mirrorElem,"mirrorElem"),n(t.collisionByMouse,"collisionByMouse"),n(t.lockInsideJail,"lockInsideJail"),n(t.dropInJailOnly,"dropInJailOnly"),n(t.revertOnDrop,"revertOnDrop"),n(t.multiCollision,"multiCollision"),o(t.classDragging,"classDragging"),o(t.classBodyDragging,"classBodyDragging"),o(t.classJailDragging,"classJailDragging"),o(t.classJailDragDisabled,"classJailDragDisabled"),o(t.classDragCollision,"classDragCollision"),o(t.classHidden,"classHidden"),t.jail instanceof HTMLElement&&(this.#de=t.jail),this.#he=Object.assign({start:!1,end:!1,collide:!1,move:!1},E(t.vibration)?t.vibration:{}),"string"==typeof t.classDragging&&(this.#me=t.classDragging),"string"==typeof t.classBodyDragging&&(this.#pe=t.classBodyDragging),"string"==typeof t.classJailDragging&&(this.#ge=t.classJailDragging),"string"==typeof t.classJailDragDisabled&&(this.#ye=t.classJailDragDisabled),"string"==typeof t.classHidden&&(this.#fe=t.classHidden),"string"==typeof t.classDragCollision&&(this.#be=t.classDragCollision),"boolean"==typeof t.collisionByMouse&&(this.#se=t.collisionByMouse),"boolean"==typeof t.mirrorElem&&(this.#te=t.mirrorElem),"boolean"==typeof t.revertOnDrop&&(this.#oe=t.revertOnDrop),"boolean"==typeof t.lockInsideJail&&(this.#ne=t.lockInsideJail),"boolean"==typeof t.dropInJailOnly&&(this.#ae=t.dropInJailOnly),"boolean"==typeof t.multiCollision&&(this.#re=t.multiCollision),this._onMouseDown=this.#ve.bind(this),this._onMouseMove=this.#Ee.bind(this),this._onMouseUp=this.#Te.bind(this),this._onTouchStart=e=>this.#ve(e.touches[0]),this._onTouchMove=e=>this.#Ee(e.touches[0]),this._onTouchEnd=e=>this.#Te(e.changedTouches[0]),this.#F.addEventListener("mousedown",this._onMouseDown),this.#F.addEventListener("touchstart",this._onTouchStart,{passive:!1})}enable(){this.#xe(),this.#de&&this.#de.classList.add(this.#ye),this.#Q=!0}disable(){this.#de&&this.#de.classList.remove(this.#ye),this.#Q=!1}addCollidable(e){if(this.#xe(),!(e instanceof HTMLElement))throw new Error("addCollidable expects an HTMLElement as argument.");this.#ue.includes(e)||this.#ue.push(e)}removeCollidable(e){if(this.#xe(),!(e instanceof HTMLElement))throw new Error("removeCollidable expects an HTMLElement as argument.");this.#ue=this.#ue.filter((t=>t!==e))}setVibrationPattern({startPattern:e=!1,endPattern:t=!1,collidePattern:r=!1,movePattern:n=!1}={}){this.#xe();const o=e=>!1===e||Array.isArray(e)&&e.every((e=>"number"==typeof e));if(!o(e))throw new Error('Invalid "startPattern": must be false or an array of numbers.');if(!o(t))throw new Error('Invalid "endPattern": must be false or an array of numbers.');if(!o(r))throw new Error('Invalid "collidePattern": must be false or an array of numbers.');if(!o(n))throw new Error('Invalid "movePattern": must be false or an array of numbers.');this.#he={start:e,end:t,collide:r,move:n}}disableVibration(){this.#xe(),this.#he={start:!1,end:!1,collide:!1,move:!1}}getOffset(e){if(this.#xe(),!(e instanceof MouseEvent||e instanceof Touch)||"number"!=typeof e.clientX||"number"!=typeof e.clientY)throw new Error("getOffset expects an event with valid clientX and clientY coordinates.");const t=this.#F.getBoundingClientRect(),{left:r,top:n}=Ae.borderWidth(this.#F);return{x:e.clientX-t.left+r,y:e.clientY-t.top+n}}#ve(e){if(e instanceof MouseEvent&&e.preventDefault(),this.#K||!this.#Q||!this.#F.parentElement)return;if(this.#te){const e=this.#F.cloneNode(!0);if(!(e instanceof HTMLElement))throw new Error("[TinyDragger] INVALID DRAG ELEMENT!");this.#ce=e}else this.#ce=this.#F;this.#ie=!0;const t=this.#F.getBoundingClientRect();Object.assign(this.#ce.style,{position:"absolute",pointerEvents:"none",left:`${this.#F.offsetLeft}px`,top:`${this.#F.offsetTop}px`,width:`${t.width}px`,height:`${t.height}px`,zIndex:this.#we}),this.#te&&(this.#F.classList.add(this.#fe),this.#F.parentElement.appendChild(this.#ce));const{x:r,y:n}=this.getOffset(e);this.#ee=r,this.#Z=n,this.#ce.classList.add(this.#me),document.body.classList.add(this.#pe),this.#de&&this.#de.classList.add(this.#ge),document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp),document.addEventListener("touchmove",this._onTouchMove,{passive:!1}),document.addEventListener("touchend",this._onTouchEnd),navigator.vibrate&&Array.isArray(this.#he.start)&&navigator.vibrate(this.#he.start),this.checkDragCollision(e),this.#Se("drag")}#Ce=[];#Ae(e){e&&(e.classList.add(this.#be),this.#Ce.push(e))}#Le(){for(;this.#Ce.length>0;){const e=this.#Ce.shift();e&&e.classList.remove(this.#be)}this.#le&&this.#le.classList.remove(this.#be)}checkDragCollision(e){const{collidedElements:t}=this.execCollision(e),r=t[0]||null;this.#le&&!t.includes(this.#le)&&this.#Le(),t.forEach((e=>this.#Ae(e))),this.#ue.forEach((e=>{t.includes(e)||e.classList.remove(this.#be)})),navigator.vibrate&&Array.isArray(this.#he.collide)&&t.length>0&&navigator.vibrate(this.#he.collide),this.#le=r}#Ee(e){if(e instanceof MouseEvent&&e.preventDefault(),this.#K||!this.#ie||!this.#Q||!this.#ce)return;const t=(this.#ce.offsetParent||document.body).getBoundingClientRect();let r=e.clientX-t.left-this.#ee,n=e.clientY-t.top-this.#Z;if(this.#ne&&this.#de){const e=this.#de.getBoundingClientRect(),o=this.#ce.getBoundingClientRect(),i=e.left-t.left,s=e.top-t.top,{x:a,y:l}=Ae.borderWidth(this.#de),u=i+e.width-o.width-l,c=s+e.height-o.height-a;r=Math.max(i,Math.min(r,u)),n=Math.max(s,Math.min(n,c))}this.#ce.style.position="absolute",this.#ce.style.left=`${r}px`,this.#ce.style.top=`${n}px`,navigator.vibrate&&Array.isArray(this.#he.move)&&navigator.vibrate(this.#he.move),this.checkDragCollision(e),this.#Se("dragging")}execCollision(e){if(this.#K||!this.#ce)return{inJail:!1,collidedElements:[]};let t=[],r=!0;const n=this.#de?.getBoundingClientRect();if(this.#se){const o=e.clientX,i=e.clientY;this.#ae&&this.#de&&n&&(r=o>=n.left&&o<=n.right&&i>=n.top&&i<=n.bottom),t=r?this.#re?this.getAllCollidedElements(o,i):[this.getCollidedElement(o,i)].filter(Boolean):[]}else{const e=this.#ce.getBoundingClientRect();this.#ae&&this.#de&&n&&(r=e.left>=n.left&&e.right<=n.right&&e.top>=n.top&&e.bottom<=n.bottom),t=r?this.#re?this.getAllCollidedElementsByRect(e):[this.getCollidedElementByRect(e)].filter(Boolean):[]}return{inJail:r,collidedElements:t}}#Te(e){if(e instanceof MouseEvent&&e.preventDefault(),this.#K||!this.#ie)return;if(this.#ie=!1,!this.#ce)return;this.#F.classList.remove(this.#me),document.body.classList.remove(this.#pe),this.#de&&this.#de.classList.remove(this.#ge),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd);const{collidedElements:t}=this.execCollision(e);navigator.vibrate&&Array.isArray(this.#he.end)&&navigator.vibrate(this.#he.end);const r=this.#ce.style.left,n=this.#ce.style.top;this.#ce&&(this.#te?this.#ce.remove():Object.assign(this.#ce.style,{position:"",pointerEvents:"",left:"",top:"",width:"",height:"",zIndex:""}),this.#ce=null),this.#le&&this.#Le(),this.#le=null,this.#te&&this.#F.classList.remove(this.#fe),this.#oe||(this.#F.style.left=r,this.#F.style.top=n);const o=new CustomEvent("drop",{detail:{targets:t,first:t[0]||null}});this.#F.dispatchEvent(o)}#De(e,t){const r=e.getBoundingClientRect();return!(t.right<r.left||t.left>r.right||t.bottom<r.top||t.top>r.bottom)}getAllCollidedElementsByRect(e){if(this.#xe(),!(e instanceof DOMRect)||"number"!=typeof e.left||"number"!=typeof e.right||"number"!=typeof e.top||"number"!=typeof e.bottom)throw new Error("getCollidedElementByRect expects a valid DOMRect object.");return this.#ue.filter((t=>this.#De(t,e)))}getCollidedElementByRect(e){if(this.#xe(),!(e instanceof DOMRect)||"number"!=typeof e.left||"number"!=typeof e.right||"number"!=typeof e.top||"number"!=typeof e.bottom)throw new Error("getCollidedElementByRect expects a valid DOMRect object.");return this.#ue.find((t=>this.#De(t,e)))||null}#ke(e,t,r){const n=e.getBoundingClientRect();return t>=n.left&&t<=n.right&&r>=n.top&&r<=n.bottom}getAllCollidedElements(e,t){if(this.#xe(),"number"!=typeof e||"number"!=typeof t)throw new Error("getCollidedElement expects numeric x and y coordinates.");return this.#ue.filter((r=>this.#ke(r,e,t)))}getCollidedElement(e,t){if(this.#xe(),"number"!=typeof e||"number"!=typeof t)throw new Error("getCollidedElement expects numeric x and y coordinates.");return this.#ue.find((r=>this.#ke(r,e,t)))||null}#Se(e){const t=new CustomEvent(e);this.#F.dispatchEvent(t)}getDragging(){return this.#ie}getLockInsideJail(){return this.#ne}setLockInsideJail(e){if("boolean"!=typeof e)throw new Error("lockInsideJail must be a boolean.");this.#ne=e}getRevertOnDrop(){return this.#oe}setRevertOnDrop(e){if("boolean"!=typeof e)throw new Error("revertOnDrop must be a boolean.");this.#oe=e}getCollisionByMouse(){return this.#se}setCollisionByMouse(e){if("boolean"!=typeof e)throw new Error("collisionByMouse must be a boolean.");this.#se=e}getDropInJailOnly(){return this.#ae}setDropInJailOnly(e){if("boolean"!=typeof e)throw new Error("dropInJailOnly must be a boolean.");this.#ae=e}getDefaultZIndex(){return this.#we}setDefaultZIndex(e){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError("Z-index must be a finite number.");this.#we=e}isMirrorEnabled(){return this.#te}setMirrorEnabled(e){if("boolean"!=typeof e)throw new TypeError("Mirror setting must be a boolean.");this.#te=e}getTarget(){return this.#F}getJail(){return this.#de}getDragProxy(){return this.#ce}getLastCollision(){return this.#le}getCollidables(){return[...this.#ue]}getDragHiddenClass(){return this.#fe}getClassDragging(){return this.#me}getClassBodyDragging(){return this.#pe}getClassJailDragging(){return this.#ge}getClassJailDragDisabled(){return this.#ye}getClassDragCollision(){return this.#be}getVibrations(){return{...this.#he}}getStartVibration(){return this.#he.start}getEndVibration(){return this.#he.end}getCollideVibration(){return this.#he.collide}getMoveVibration(){return this.#he.move}isEnabled(){return this.#Q}#xe(){if(this.#K)throw new Error("This TinyDragger instance has been destroyed and can no longer be used.")}destroy(){this.#K||(this.disable(),this.#F.removeEventListener("mousedown",this._onMouseDown),this.#F.removeEventListener("touchstart",this._onTouchStart),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd),this.#le&&this.#Le(),this.#ce&&(this.#te?this.#ce.remove():Object.assign(this.#ce.style,{position:"",pointerEvents:"",left:"",top:"",width:"",height:"",zIndex:""}),this.#ce=null),this.#ue=[],this.#ie=!1,this.#le=null,this.#te&&this.#F.classList.remove(this.#fe),this.#F.classList.remove(this.#me),document.body.classList.remove(this.#pe),this.#de&&this.#de.classList.remove(this.#ge,this.#ye),this.#K=!0)}}const ft=dt,mt=class{#_e=[];#Me=!1;#Be=!1;#Ie=[];#Ne(){this.#Me&&Promise.all(this.#Ie).then((()=>{this.#Be=!0,this.#je(!1)})).catch((e=>{console.error("[TinyDomReadyManager] Promise rejected:",e)}))}#je(e){this.#_e.filter((t=>t.domOnly===e)).sort(((e,t)=>t.priority-e.priority)).forEach((e=>this.#Pe(e))),this.#_e=this.#_e.filter((t=>!(t.once&&(!e||t.domOnly))))}#Pe(e){if("function"==typeof e.filter)try{if(!e.filter())return}catch(e){return void console.warn("[TinyDomReadyManager] Filter error:",e)}try{e.fn()}catch(e){console.error("[TinyDomReadyManager] Handler error:",e)}}_markDomReady(){this.#Me=!0,this.#je(!0),this.#Ne()}init(){if(this.#Me)throw new Error("[TinyDomReadyManager] init() has already been called.");"interactive"===document.readyState||"complete"===document.readyState?this._markDomReady():document.addEventListener("DOMContentLoaded",(()=>this._markDomReady()))}addPromise(e){if(!(e instanceof Promise))throw new TypeError("[TinyDomReadyManager] promise must be a valid Promise.");this.#Be||(this.#Ie.push(e),this.#Me&&this.#Ne())}onReady(e,{once:t=!0,priority:r=0,filter:n=null,domOnly:o=!1}={}){if("function"!=typeof e)throw new TypeError("[TinyDomReadyManager] fn must be a function.");const i={fn:e,once:t,priority:r,filter:n,domOnly:o};if(o&&this.#Me)return this.#Pe(i),void(t||this.#_e.push(i));!o&&this.#Be?this.#Pe(i):this.#_e.push(i)}isReady(){return this.#Be}isDomReady(){return this.#Me}},pt=class{#Re=!1;#Oe=!1;#He=null;#We=100;#Fe=null;#$e;constructor({audio:e=null,defaultIcon:t=null,bodyLimit:r=100,defaultOnClick:n=function(e){e.preventDefault(),window.focus&&window.focus(),this.close()}}={}){if(!(e instanceof HTMLAudioElement)&&"string"!=typeof e&&null!==e)throw new TypeError("audio must be an instance of HTMLAudioElement or null.");if(null!==t&&"string"!=typeof t)throw new TypeError("defaultIcon must be a string or null.");if(!Number.isFinite(r)||r<0)throw new TypeError("bodyLimit must be a non-negative number.");if("function"!=typeof n)throw new TypeError("defaultOnClick must be a function.");this.#He="string"!=typeof e?e:new Audio(e),this.#Fe=t,this.#We=r,this.#$e=n}requestPerm(){const e=this;return new Promise(((t,r)=>{e.isCompatible()?"default"===Notification.permission?Notification.requestPermission().then((r=>{this.#Oe=!0,e.#Re="granted"===r,t(e.#Re)})).catch(r):(this.#Oe=!0,e.#Re="granted"===Notification.permission,t(e.#Re)):(this.#Oe=!0,e.#Re=!1,t(!1))}))}isCompatible(){return"Notification"in window}send(e,t={}){if(!this.#Oe)throw new Error("You must call requestPerm() before sending a notification.");if("string"!=typeof e)throw new TypeError("title must be a string.");if("object"!=typeof t||null===t)throw new TypeError("config must be a non-null object.");if(!this.#Re)return null;const{icon:r=this.#Fe||void 0,vibrate:n=[200,100,200]}=t,o={...t};"string"==typeof r&&(o.icon=r),Array.isArray(n)&&(o.vibrate=n),"string"==typeof o.body&&(o.body=O(o.body,this.#We));const i=new Notification(e,o);return i.addEventListener("show",(()=>{this.#He instanceof HTMLAudioElement&&(this.#He.currentTime=0,this.#He.play().catch((e=>console.error(e))))})),"function"==typeof this.#$e&&i.addEventListener("click",this.#$e),i}wasPermissionRequested(){return this.#Oe}isAllowed(){return this.#Re}getAudio(){return this.#He}setAudio(e){if(!(e instanceof HTMLAudioElement)&&"string"!=typeof e&&null!==e)throw new TypeError("sound must be an instance of HTMLAudioElement or null.");this.#He="string"!=typeof e?e:new Audio(e)}getBodyLimit(){return this.#We}setBodyLimit(e){if(!Number.isFinite(e)||e<0)throw new TypeError("bodyLimit must be a non-negative number.");this.#We=e}getDefaultAvatar(){return this.#Fe}setDefaultAvatar(e){if("string"!=typeof e&&null!==e)throw new TypeError("defaultIcon must be a string or null.");this.#Fe=e}getDefaultOnClick(){return this.#$e}setDefaultOnClick(e){if("function"!=typeof e)throw new TypeError("defaultOnClick must be a function.");this.#$e=e}},gt=class{#Ue;#ze=null;#Ve=[];#qe=100;#Ge=new Set;#Je=new Set;#K=!1;constructor(e=window,t=100){if(!(e instanceof Element||e instanceof Window))throw new TypeError("scrollTarget must be an Element or the Window object.");this.#Ue=e,this._checkTimer=this._checkTimer.bind(this),this.#Ue.addEventListener("scroll",this._checkTimer),this.#qe=t}_checkTimer=()=>{this.#ze&&clearTimeout(this.#ze),this.#ze=setTimeout((()=>{this.#ze=null,this.#Ye()}),this.#qe)};get inactivityTime(){return this.#qe}set inactivityTime(e){if("number"!=typeof e||e<=0||!Number.isFinite(e))throw new Error("inactivityTime must be a positive number in milliseconds.");this.#qe=e}#Ye(){if(!this.#K){for(const e of this.#Je)"function"==typeof e&&e();for(;this.#Ve.length;){const e=this.#Ve.pop();"function"==typeof e&&e()}}}doAfterScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.lastScrollTime=Date.now(),this.#Ve.push(e)}onStop(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#Je.add(e)}offStop(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#Je.delete(e)}onScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#Ue.addEventListener("scroll",e),this.#Ge.add(e)}offScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#Ge.has(e)&&(this.#Ue.removeEventListener("scroll",e),this.#Ge.delete(e))}destroy(){if(!this.#K){this.#K=!0,this.#Ue.removeEventListener("scroll",this._checkTimer);for(const e of this.#Ge)this.#Ue.removeEventListener("scroll",e);this.#Ge.clear(),this.#Je.clear()}}},yt=["lorem","ipsum","dolor","sit","amet","consectetur","adipiscing","elit","sed","do","eiusmod","tempor","incididunt","ut","labore","et","dolore","magna","aliqua"],bt=["😂","🌈","🤖","💥","🐸","🍕","🦄","🧠","🧬","🚀","🫠","💫","🍩","👾","🎉","🥴","🐙","🧃","🪐","🎈","🧸","👻","🥳","🍭","💖","😺","🌮","🪅","🎮","🥓","🍮"],wt=["pudding","bean","snuggle","bloop","jelly","unicorn","floof","giggle","bubble","muffin","puff","pickle","goblin","waffle","sprinkle","cupcake","fizzle","marshmallow","duckling","sock","cloud","teacup","nugget","gnome","hug","moonbean","crayon","jiggle","glitter","carrot","goober"],vt=["wiggles","bounces","flies","splats","scoots","giggles","wigglesnacks","twirls","boops","pops","sings","hugs","floats","glows","flaps","mlems","dances","puddles","nomnoms","wigglejumps","sniffs","tumbles","slides","chirps","burps","sparkles","waddles","rambles","blinks","mews"],Et=["fluffy","silly","yummy","squishy","wobbly","magical","tiny","sleepy","wiggly","bubbly","glittery","fuzzy","jiggly","sparkly","giggly","crunchy","goofy","soft","mushy","sweet","loopy","floaty","bonkers","chewy","ticklish","dreamy","pastel","cozy","teensy","grumbly"],Tt=["Boop!","Wiggle achieved.","Oops, {noun} everywhere!","Tiny {adj} {noun}, big {adj} {noun}.","Snuggle initiated with a {adj} {noun}.","{adj} vibes only, powered by {noun}.","No {noun}, no {noun}.","Bounce first, {verb} later.","Mlem. {verb}. {noun}.","{noun} go brrr and {verb}.","Why not? {noun} did. Then {noun} followed.","A {adj} {noun} just {verb} near the {adj} window.","That {adj} {noun} stole my {noun}!","Look, a {adj} {noun} trying to {verb} again!","Every {noun} deserves a {adj} nap.","The {adj} {noun} is my {adj} spirit animal.","Someone call the {noun}, it’s {verb}ing and {verb}ing again!","Don’t touch the {adj} {noun}. It {verb}s loudly.","{noun} forgot how {noun}s work and just {verb}ed.","There once was a {adj} {noun} who loved to {verb} with a {adj} {noun} all day.","Apparently, {noun}s are banned from {verb}ing and {verb}ing in the {noun} library.","That {adj} noise? Just a {noun} learning to {verb} on a {adj} {noun}.","I saw a {adj} {noun} {verb} so hard, it became a {adj} muffin.","The {adj} {noun} met a {adj} pickle and everything {verb}ed.","{noun}s are like {noun}: {adj}, unpredictable, and wiggly.","Don’t judge a {adj} {noun} by its ability to {verb}, or by its {adj} hat.","All I wanted was peace, but a {adj} {noun} with a {adj} {noun} had other plans.","One {adj} morning, a {adj} {noun} decided it was finally time to {verb}, but halfway through, it tripped on a {noun} and turned into a {adj} marshmallow.","I tried to be {adj} today, but then a {noun} {verb}ed across my {noun} and typed “asdfgh{noun}” repeatedly.","If you think you’ve seen everything, wait until a {adj} {noun} {verb}s on a {noun} wearing {adj} socks with tiny {noun}s.","No one ever believed the stories about the ancient {adj} {noun} who could {verb} with such {adj} grace that entire {noun}s turned pink out of embarrassment.","A curious {adj} {noun} wandered into a {noun} shop, not knowing that its destiny involved twelve {adj} {noun}s, one rubber {noun}, and a suspiciously quiet {adj} llama.","In a land where every {adj} {noun} was made of pudding and the sky was {adj} whipped cream, one brave {adj} {noun} set out to discover the legendary Spoon of {noun}s, facing obstacles like bouncing {noun}s, sassy {noun}s, and the Great Wobble of the {noun}.","Once upon a {adj} time, long before the {noun}s learned to {verb}, there existed a tiny {adj} {noun} who dreamed of swimming in a pool made entirely of {adj} glitter pudding while {verb}ing off-key lullabies to passing {noun}s with monocles.","The Council of {noun}s gathered in {adj} secret when the sacred {adj} {noun} started to {verb} uncontrollably, threatening the entire {adj} dessert-based civilization with spontaneous {noun} jiggles and uncontainable {noun} fits across the {noun}.","Hey... do you ever wonder if {noun}s dream of {noun}s?","Okay but hear me out: what if the {adj} {noun} could actually {verb} backwards?","Can we talk about the {noun} that just {verb}ed and vanished?","So I was talking to a {noun}, and it told me to stop being {adj}. Rude.","Not to alarm you, but there’s a {adj} {noun} behind you doing the {verb}.","Why does this {noun} keep staring at me like I owe it pudding?","Is this a safe space to admit I accidentally {verb}ed a {noun}?","I just walked into the room and someone shouted “{adj} {noun}!” — what did I miss?","Wait... we were supposed to bring a {noun}? No one told me!","Okay but what if the {adj} {noun} has feelings too?","Be honest, do I look like a {noun} that forgot how to {verb}?",'If I say "oops", do I still have to explain why the {noun} is glowing?',"I don’t know what’s going on but I brought snacks and a confused {noun}.","Do you think pudding knows it’s pudding? Just a thought.","Is this about the time I {verb}ed the {adj} {noun} by accident? Because I can explain.","Wait, are we talking about {noun}s or am I on the wrong chat again?",'What is this group even about? I just saw "pudding" and joined.',"Hi! I have no idea what’s happening but I’m here and I brought a {noun}.","I blinked and now there’s a {adj} {noun} in charge of everything.","Can someone please explain why the {noun} is floating and chanting?","Okay who gave the {noun} access to glitter and emotional support pickles?","I came for a calm discussion and now there’s a {adj} battle between {noun}s.","Not sure if I’m early, late, or inside a {noun} dream.","I was gone for 3 minutes and now someone’s riding a {noun} into the pudding realm.","This isn’t the pudding appreciation group, is it? ...oh no.","So... who summoned the {adj} {noun} this time? Be honest.","I came here for vibes and stayed for the {noun}s.","Does anyone else hear faint giggling or is that just the {adj} {noun} again?","I feel like I missed step one, two, and also three of this conversation.","All I asked was “what’s up?” and now I’m emotionally attached to a {noun}.",'Me: "I’ll be normal today." Also me: *{verb}s into a meeting riding a {adj} {noun}*','"It’s just pudding," they said. "It can’t hurt you," they said. They were wrong.',"I said one nice thing to a {noun} and now it follows me everywhere.","Can we take a moment to appreciate how the {adj} {noun} is just vibing?","Who put a tiny hat on the {noun}? Because that’s adorable.","My life has been different ever since the {noun} started {verb}ing.","Raise your hand if you’ve ever been personally attacked by a {adj} {noun}.",'"Don’t be weird," they said. So I became a {noun} instead.',"Do {noun}s have feelings? Asking for a {adj} friend.","I trusted the {noun} and all I got was a glitter-covered sock.","Plot twist: the {adj} {noun} was inside us all along.","The {adj} {noun} {verb} and {verb} all over the {adj} {noun}!","Oops! {noun}s {verb}ed into the {adj} {noun} while {verb}ing crazily.","{adj}, {adj}, and more {adj} {noun}s just {verb}ed by!","Why does the {adj} {noun} keep {verb}ing and {verb}ing without stopping?","Look! A {adj} {noun}, a {adj} {noun}, and a {noun} all {verb}ing together!","Sometimes, the {noun} just {verb}s, then {verb}s again, and never stops being {adj}.","{noun}, {noun}, and {noun} — all {verb}ing and {verb}ing in a {adj} {noun}.","I saw a {adj} {noun} {verb}, then another {noun} {verb}ing with a {adj} {noun}.","The {noun} {verb}s {verb} while the {adj} {noun} {verb}s and the {noun} just {verb}s.","Can a {adj} {noun} {verb} {verb} without a {adj} {noun} watching?","Whoa! The {adj} {noun} just {verb}ed... and then {verb}ed again!","Hey... did you see that {adj} {noun} {verb} over there?","Umm, the {noun} is {verb}ing but also {verb}ing and {verb}ing!","Lol! {noun}s {verb} so {adj}ly, it’s impossible not to giggle.",'"Hey! What’s up?" asked the {adj} {noun}, who {verb}ed loudly.','"I’m just a {adj} {noun} trying to {verb}, you know?"','"Did you see the {adj} {noun} that just {verb}ed in the pudding?"','"No way! The {noun} {verb}s better than me!"','"Wait, the {adj} {noun} said it would {verb}, but it {verb}ed instead!"',"Once upon a {adj} {noun}, a group of {adj} {noun}s {verb}ed through the {adj} forest, singing {adj} songs and eating {noun}s made of pudding.","The legend tells of a {adj} {noun} who could {verb} faster than any {noun} ever seen, leaving trails of {adj} sparkles behind.","Every day, the {adj} {noun} would {verb} around the {adj} meadow, trying to convince the {noun}s to join the grand pudding party.","No one knows why the {adj} {noun} suddenly {verb}ed and then {verb}ed again, but everyone agrees it was the cutest thing they ever saw.","In the kingdom of {adj} {noun}s, only the bravest {noun} dared to {verb} the giant pudding monster, armed with nothing but {adj} smiles and jellybeans.","{adj} {noun} {verb} {verb} {verb} {noun} {verb} {adj} {noun} {verb} {noun}!","{noun} {noun} {verb} {adj} {noun} and then {verb} {verb} the {adj} {noun}.","{verb} the {adj} {noun}, then {verb} the {noun} while {verb}ing {adj}ly.","Can the {adj} {noun} {verb} and {verb} the {adj} {noun} at the same time?","{noun} {verb} {noun} {verb}, but the {adj} {noun} {verb}s better.","Boop! The {adj} {noun} just {verb}ed in the pudding.","Bloop bloop, the {noun} is {verb}ing all over again!","Mlem mlem, a {adj} {noun} {verb}s quietly in the corner.","Splat! {noun} {verb}ed right on the {adj} {noun}.","Yum! A {adj} {noun} just {verb}ed in my mouth.","Do {noun}s really {verb} when nobody’s watching?","Why does the {adj} {noun} always {verb} at midnight?","Can a {noun} be too {adj} to {verb} properly?","Is it normal for a {adj} {noun} to {verb} three times in a row?","Who taught the {noun} to {verb} like that?","Wait, did the {adj} {noun} just {verb} itself?","I can’t believe the {noun} {verb}ed into a {adj} {noun}!","Suddenly, a {adj} {noun} appeared and started to {verb} wildly.","That {noun} was {verb}ing so {adj}ly it broke the pudding meter.","Everyone’s talking about the {adj} {noun} that {verb}ed out of nowhere."],xt=class{static defaultWords=yt;static defaultEmojis=bt;static defaultNouns=wt;static defaultVerbs=vt;static defaultAdjectives=Et;static defaultTemplates=Tt;config={minLength:10,maxLength:300,readable:!0,useEmojis:!0,includeNumbers:!0,includeSymbols:!0,allowWeirdSpacing:!1,emojiSet:[],wordSet:[],mode:"mixed",grammar:{templates:[],nouns:[],verbs:[],adjectives:[]},repeatWords:!0,emojiPlacement:"inline",line:{minLength:20,maxLength:120,emojiChance:.3}};constructor(e={}){this.symbols="!@#$%^&*()-_=+[]{}|;:,.<>?/\\~".split("");const{minLength:t,maxLength:r,readable:n,useEmojis:o,includeNumbers:i,includeSymbols:s,allowWeirdSpacing:a,emojiSet:l,wordSet:u,mode:c,grammar:h,repeatWords:d,emojiPlacement:f,paragraphs:m,line:p}=e;if(void 0!==t&&(!Number.isInteger(t)||t<1))throw new TypeError("config.minLength must be an integer >= 1");if(void 0!==r&&(!Number.isInteger(r)||r<1))throw new TypeError("config.maxLength must be an integer >= 1");if(void 0!==t&&void 0!==r&&t>r)throw new RangeError("config.minLength cannot be greater than config.maxLength");if(void 0!==n&&"boolean"!=typeof n)throw new TypeError("config.readable must be a boolean");if(void 0!==o&&"boolean"!=typeof o)throw new TypeError("config.useEmojis must be a boolean");if(void 0!==i&&"boolean"!=typeof i)throw new TypeError("config.includeNumbers must be a boolean");if(void 0!==s&&"boolean"!=typeof s)throw new TypeError("config.includeSymbols must be a boolean");if(void 0!==a&&"boolean"!=typeof a)throw new TypeError("config.allowWeirdSpacing must be a boolean");if(void 0!==l&&!Array.isArray(l))throw new TypeError("config.emojiSet must be an array of strings");if(void 0!==u&&!Array.isArray(u))throw new TypeError("config.wordSet must be an array of strings");if(void 0!==c&&!["mixed","readable","chaotic","natural"].includes(c))throw new RangeError('config.mode must be one of: "mixed", "readable", "chaotic", "natural');if(void 0!==h){if("object"!=typeof h||null===h)throw new TypeError("config.grammar must be an object");const{templates:e,nouns:t,verbs:r,adjectives:n}=h;if(void 0!==e&&!Array.isArray(e))throw new TypeError("config.grammar.templates must be an array of strings");if(void 0!==t&&!Array.isArray(t))throw new TypeError("config.grammar.nouns must be an array of strings");if(void 0!==r&&!Array.isArray(r))throw new TypeError("config.grammar.verbs must be an array of strings");if(void 0!==n&&!Array.isArray(n))throw new TypeError("config.grammar.adjectives must be an array of strings")}if(void 0!==d&&"boolean"!=typeof d)throw new TypeError("config.repeatWords must be a boolean");if(void 0!==f&&!["inline","end","none"].includes(f))throw new RangeError('config.emojiPlacement must be one of: "inline", "end", "none"');if(void 0!==m){if("object"!=typeof m)throw new TypeError("config.paragraphs must be an object or null");const{min:e,max:t}=m;if(void 0!==e&&(!Number.isInteger(e)||e<1))throw new TypeError("config.paragraphs.min must be an integer >= 1");if(void 0!==t&&(!Number.isInteger(t)||t<1))throw new TypeError("config.paragraphs.max must be an integer >= 1");if(void 0!==e&&void 0!==t&&e>t)throw new RangeError("config.paragraphs.min cannot be greater than config.paragraphs.max")}if(void 0!==p){if("object"!=typeof p||null===p)throw new TypeError("config.line must be an object");const{minLength:e,maxLength:t,emojiChance:r}=p;if(void 0!==e&&(!Number.isInteger(e)||e<1))throw new TypeError("config.line.minLength must be an integer >= 1");if(void 0!==t&&(!Number.isInteger(t)||t<1))throw new TypeError("config.line.maxLength must be an integer >= 1");if(void 0!==e&&void 0!==t&&e>t)throw new RangeError("config.line.minLength cannot be greater than config.line.maxLength");if(void 0!==r&&("number"!=typeof r||r<0||r>1))throw new RangeError("config.line.emojiChance must be a number between 0 and 1")}this.config.emojiSet=[...bt],this.config.wordSet=[...yt],this.config.grammar.templates=[...Tt],this.config.grammar.nouns=[...wt],this.config.grammar.verbs=[...vt],this.config.grammar.adjectives=[...Et],Object.assign(this.config,e)}configure(e={}){return Object.assign(this.config,e),this}setGrammarTemplates(...e){return this.config.grammar.templates=e.flat(),this}addGrammarTemplates(...e){return this.config.grammar.templates.push(...e.flat()),this}setGrammarNouns(...e){return this.config.grammar.nouns=e.flat(),this}addGrammarNouns(...e){return this.config.grammar.nouns.push(...e.flat()),this}setGrammarVerbs(...e){return this.config.grammar.verbs=e.flat(),this}addGrammarVerbs(...e){return this.config.grammar.verbs.push(...e.flat()),this}setGrammarAdjectives(...e){return this.config.grammar.adjectives=e.flat(),this}addGrammarAdjectives(...e){return this.config.grammar.adjectives.push(...e.flat()),this}removeGrammarTemplates(...e){const t=new Set(e.flat());return this.config.grammar.templates=this.config.grammar.templates.filter((e=>!t.has(e))),this}removeGrammarNouns(...e){const t=new Set(e.flat());return this.config.grammar.nouns=this.config.grammar.nouns.filter((e=>!t.has(e))),this}removeGrammarVerbs(...e){const t=new Set(e.flat());return this.config.grammar.verbs=this.config.grammar.verbs.filter((e=>!t.has(e))),this}removeGrammarAdjectives(...e){const t=new Set(e.flat());return this.config.grammar.adjectives=this.config.grammar.adjectives.filter((e=>!t.has(e))),this}setWords(...e){return this.config.wordSet=e.flat(),this}addWords(...e){return this.config.wordSet.push(...e.flat()),this}removeWords(...e){const t=new Set(e.flat());return this.config.wordSet=this.config.wordSet.filter((e=>!t.has(e))),this}setEmojis(...e){return this.config.emojiSet=e.flat(),this}addEmojis(...e){return this.config.emojiSet.push(...e.flat()),this}removeEmojis(...e){const t=new Set(e.flat());return this.config.emojiSet=this.config.emojiSet.filter((e=>!t.has(e))),this}_getRandomItem(e){return e[Math.floor(Math.random()*e.length)]}_generateChunk(){const{wordSet:e,emojiSet:t,includeNumbers:r,includeSymbols:n,useEmojis:o,readable:i,mode:s,emojiPlacement:a}=this.config;if("natural"===s)return this._generateNaturalSentence();const l=[];return(i||"readable"===s||"mixed"===s)&&l.push(this._getRandomItem(e)),"chaotic"!==s&&"mixed"!==s||l.push(Math.random().toString(36).slice(2)),r&&l.push(Math.floor(99999*Math.random()).toString()),n&&l.push(this._getRandomItem(this.symbols)),"inline"===a&&o&&t.length&&l.push(this._getRandomItem(t)),this._getRandomItem(l)}_generateNaturalSentence(){const{templates:e,nouns:t,verbs:r,adjectives:n}=this.config.grammar;return this._getRandomItem(e).replace(/{noun}/g,(()=>this._getRandomItem(t))).replace(/{verb}/g,(()=>this._getRandomItem(r))).replace(/{adj}/g,(()=>this._getRandomItem(n)))}_generateLine(e,t){const{allowWeirdSpacing:r,repeatWords:n,readable:o,emojiSet:i,useEmojis:s,emojiPlacement:a,line:l}=this.config,u=[];for(t??=new Set;u.join(" ").length<e;){let e=this._generateChunk();!n&&t.has(e)||(t.add(e),r&&(Math.random()<.1&&(e="\n"+e),Math.random()<.1&&(e=" "+e),Math.random()<.05&&(e=e.toUpperCase())),u.push(e))}let c=u.join(o?" ":"");return"end"===a&&s&&i.length&&Math.random()<(l?.emojiChance||0)&&(c+=" "+this._getRandomItem(i)),c}_generateParagraphLines(e){const{line:t}=this.config,r=[],n=new Set;let o=0;for(;o<e;){const i=Math.floor(Math.random()*(t.maxLength-t.minLength+1)+t.minLength),s=Math.min(i,e-o);r.push(this._generateLine(s,n)),o+=s}return r}generate(){const{minLength:e,maxLength:t,paragraphs:r}=this.config,n=Math.floor(Math.random()*(t-e+1))+e;if(r&&"object"==typeof r){const e=Math.floor(Math.random()*(r.max-r.min+1))+r.min,t=Math.floor(n/e),o=[];for(let r=0;r<e;r++){const e=this._generateParagraphLines(t);o.push(e.join("\n"))}return o.join("\n\n")}return this._generateParagraphLines(n).join("\n")}};class St{static Utils={...e,TinyHtml:Ae};#Xe=new WeakMap;#Qe=new WeakMap;#Ke=new WeakMap;#Ze=new WeakMap;#et=new WeakMap;#tt=new WeakMap;#rt={};#nt=null;#ot=null;#it=new Set(["IMG","IFRAME","VIDEO"]);#st=null;#at=!1;#lt=!1;#ut=!1;#ct=!1;#ht="";#dt=!1;#K=!1;#ft=!1;#mt=!1;#pt=!1;#gt=!1;#yt=0;#bt=0;#wt=0;#vt=0;#Et=0;#Tt;#F;#xt=new Set;constructor(e,{extraScrollBoundary:t=0,autoScrollBottom:r=!0,observeMutations:n=!0,preserveScrollOnLayoutShift:o=!0,debounceTime:i=100,querySelector:s=null,attributeFilter:a=["class","style","src","data-*","height","width"]}={}){if(!(e instanceof Element||e===window))throw new TypeError("TinySmartScroller: 'target' must be a DOM Element or 'window', but got "+typeof e);if("number"!=typeof t||Number.isNaN(t))throw new TypeError(`TinySmartScroller: 'extraScrollBoundary' must be a valid number, received ${t}`);if("boolean"!=typeof r)throw new TypeError("TinySmartScroller: 'autoScrollBottom' must be a boolean, received "+typeof r);if("boolean"!=typeof n)throw new TypeError("TinySmartScroller: 'observeMutations' must be a boolean, received "+typeof n);if("boolean"!=typeof o)throw new TypeError("TinySmartScroller: 'preserveScrollOnLayoutShift' must be a boolean, received "+typeof o);if("number"!=typeof i||i<0||Number.isNaN(i))throw new TypeError(`TinySmartScroller: 'debounceTime' must be a non-negative number, received ${i}`);if(null!==s&&"string"!=typeof s)throw new TypeError("TinySmartScroller: 'querySelector' must be a string or null, received "+typeof s);if(!(null===a||Array.isArray(a)||a instanceof Set))throw new TypeError("TinySmartScroller: 'attributeFilter' must be an array, Set, or null. Got "+typeof a);let l;this.#F=e instanceof Window?document.documentElement:e,this.#dt=e instanceof Window,this.#mt=r,this.#pt=n,this.#gt=o,this.#yt=i,this.#Et=t,this.#ht=s||"",this.#Tt=new Set(a||void 0),this.#st=()=>{this._scrollDataUpdater(),clearTimeout(l),l=setTimeout((()=>this._onScroll()),this.#yt)},(this.#dt?window:this.#F).addEventListener("scroll",this.#st,{passive:!0}),this.#pt&&(this._observeMutations(),this._observeResizes(this.#F.children)),this._scrollDataUpdater()}getSimpleOnHeight(e=[]){if(!Array.isArray(e))throw new TypeError("getSimpleOnHeight(filter): filter must be an array of tag names");return(t,r,n)=>{if(e.length>0&&!e.includes(t.tagName)||n.now!==n.old)return;const o=r.old;return{height:r.now.height-o.height,width:0}}}addSimpleOnHeight(e){if(!Array.isArray(e))throw new TypeError("addSimpleOnHeight(filter): filter must be an array of tag names");const t=this.getSimpleOnHeight(e);return this.onSize(t),t}getLoadTags(){return Array.from(this.#it)}addLoadTag(e){if("string"!=typeof e)throw new TypeError("addLoadTag(tag): tag must be a string");this.#it.add(e.toUpperCase())}removeLoadTag(e){if("string"!=typeof e)throw new TypeError("removeLoadTag(tag): tag must be a string");this.#it.delete(e.toUpperCase())}hasLoadTag(e){if("string"!=typeof e)throw new TypeError("hasLoadTag(tag): tag must be a string");return this.#it.has(e.toUpperCase())}resetLoadTags(e=!1){if("boolean"!=typeof e)throw new TypeError("resetLoadTags(addDefault): addDefault must be a boolean");this.#it.clear(),e&&(this.#it.add("IMG"),this.#it.add("IFRAME"),this.#it.add("VIDEO"))}getAttributeFilters(){return Array.from(this.#Tt)}addAttributeFilter(e){if("string"!=typeof e)throw new TypeError("addAttributeFilter(attr): attr must be a string");this.#Tt.add(e)}removeAttributeFilter(e){if("string"!=typeof e)throw new TypeError("removeAttributeFilter(attr): attr must be a string");this.#Tt.delete(e)}hasAttributeFilter(e){if("string"!=typeof e)throw new TypeError("hasAttributeFilter(attr): attr must be a string");return this.#Tt.has(e)}resetAttributeFilters(e=!1){if("boolean"!=typeof e)throw new TypeError("resetAttributeFilters(addDefault): addDefault must be a boolean");this.#Tt.clear(),e&&["class","style","src","data-*","height","width"].forEach((e=>this.#Tt.add(e)))}onSize(e){if(!this.#K){if("function"!=typeof e)throw new TypeError("onSize(handler): handler must be a function");this.#xt.add(e)}}offSize(e){if(!this.#K){if("function"!=typeof e)throw new TypeError("offSize(handler): handler must be a function");this.#xt.delete(e)}}on(e,t){if(!this.#K){if("string"!=typeof e)throw new TypeError("on(event, handler): event name must be a string");if("function"!=typeof t)throw new TypeError("on(event, handler): handler must be a function");this.#rt[e]||(this.#rt[e]=[]),this.#rt[e].push(t)}}off(e,t){if(this.#K)return;if("string"!=typeof e)throw new TypeError("off(event, handler): event name must be a string");if("function"!=typeof t)throw new TypeError("off(event, handler): handler must be a function");const r=this.#rt[e];if(!Array.isArray(r))return;const n=r.indexOf(t);-1!==n&&r.splice(n,1),0===r.length&&delete this.#rt[e]}_scrollDataUpdater(){const e=new Map;return this.#F.querySelectorAll(this.#ht||"*").forEach((t=>{const r=this.#Ke.get(t)??!1;this.#Ze.set(t,r);const n=Ae.isInContainer(this.#F,t);this.#Ke.set(t,n),e.set(t,{oldIsVisible:r,isVisible:n})})),e}_emit(e,t){if(!this.#K){if("string"!=typeof e)throw new TypeError("_emit(event, payload): event name must be a string");(this.#rt[e]||[]).forEach((e=>e(t)))}}_onScroll(){if(this.#K)return;const e=this._scrollDataUpdater(),t=this.#F,r=t.scrollTop,n=t.scrollHeight,o=t.clientHeight,i={scrollTop:r,scrollHeight:n,clientHeight:o};let s=null,a=null;const l=0===r,u=r+o>=n-1,c=r<=0+this.#Et,h=r+o>=n-1-this.#Et;l&&u?s="all":l?s="top":u&&(s="bottom"),c&&h?a="all":c?a="top":h&&(a="bottom"),this.#lt=l,this.#at=u,this.#ut=c,this.#ct=h,this.#ft=!(this.#mt&&this.#at),this.#vt=n-r-o,this._emit("onScrollBoundary",{status:s,...i,scrollCache:e}),this._emit("onExtraScrollBoundary",{status:a,...i,scrollCache:e}),this.#ft?this._emit("onScrollPause",{...i,scrollCache:e}):this._emit("onAutoScroll",{...i,scrollCache:e})}_fixScroll(e=[]){if(this.#K)return;if(!Array.isArray(e))throw new TypeError("_fixScroll: targets must be an array of Elements");const t=this.#F.scrollHeight,r=this.#F.scrollTop,n=this.#F.scrollHeight-this.#F.scrollTop-this.#F.clientHeight,o=this.#F.scrollHeight-t,i=()=>{const t={height:0,width:0};for(const r of e){const e=this.#Xe.get(r)||{height:0,width:0},n=this.#Qe.get(r)||{height:0,width:0};this.#xt.forEach((o=>{const i=o(r,{old:e,now:n},{old:this.#wt,now:this.#bt});if(this.#Ke.get(r)||this.#et.get(r)){if(void 0!==i&&"object"!=typeof i)throw new Error("_fixScroll: size filter must return an object or undefined");if(void 0===i)return;t.height=i.height,t.width=i.width}}))}if("number"!=typeof t.height&&t.height<0)throw new Error("_fixScroll: invalid scrollSize.height value");if("number"!=typeof t.width&&t.width<0)throw new Error("_fixScroll: invalid scrollSize.width value");if(0!==t.height||0!==t.width)for(const t of e)this.#et.set(t,this.#Ke.get(t)??!1),this.#tt.set(t,this.#Ze.get(t)??!1);return t};if(this.#wt>0&&Ae.hasScroll(this.#F).v&&this.#mt&&this.#gt&&!this.#at&&!this.#lt){const e=i();this.#F.scrollTop=r+o+e.height,e.width>0&&(this.#F.scrollLeft=this.#F.scrollLeft+e.width)}else!this.#ft&&this.#mt?(i(),this.scrollToBottom()):this.#mt||this.#at||(i(),this.#F.scrollTop=this.#F.scrollHeight-this.#F.clientHeight-n)}_observeMutations(){this.#ot=new MutationObserver((e=>{this.#K||(this._scrollDataUpdater(),this.#wt=this.#bt,this.#bt=this.#F.childElementCount,e.forEach((e=>{e.addedNodes.forEach((e=>{if(e instanceof Element&&1===e.nodeType&&(this._observeResizes([e]),this._listenLoadEvents(e),this.#ht)){const t=e.querySelectorAll(this.#ht);this._observeResizes(t),this._listenLoadEvents(t)}}))})),this._fixScroll())})),this.#ot.observe(this.#F,{childList:!0,subtree:!0,attributes:!0,attributeFilter:this.#Tt.size>0?Array.from(this.#Tt):void 0})}_observeResizes(e){this.#nt||(this.#nt=new ResizeObserver((e=>{if(this.#K)return;this._scrollDataUpdater();const t=[];for(const r of e){const e=r.target,n=this.#Qe.get(e);n&&this.#Xe.set(e,n);const{width:o,height:i}=r.contentRect;this.#Qe.set(e,{width:o,height:i}),t.push(e)}this._fixScroll(t)}))),Array.from(e).forEach((e=>{if(!this.#nt)throw new Error("_observeResizes: ResizeObserver instance is not initialized");this.#nt.observe(e)}))}_listenLoadEvents(e){this.#K||(e instanceof NodeList?Array.from(e):[e]).forEach((e=>{this.#it.has(e.tagName)&&(e.complete||e.addEventListener("load",(()=>{this._scrollDataUpdater(),!this.#ft&&this.#mt&&this.scrollToBottom()})))}))}get target(){return this.#F}getOldSize(e){return this.#Xe.get(e)??null}getNewSize(e){return this.#Qe.get(e)??null}wasVisible(e){return this.#Ze.get(e)??!1}isVisible(e){return this.#Ke.get(e)??!1}wasTimedVisible(e){return this.#tt.get(e)??!1}isTimedVisible(e){return this.#et.get(e)??!1}setExtraScrollBoundary(e){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("setExtraScrollBoundary(value): value must be a valid number");this.#Et=e}getExtraScrollBoundary(){return this.#Et}getLastKnownScrollBottomOffset(){return this.#vt}scrollToBottom(){this.#F.scrollTop=this.#F.scrollHeight}scrollToTop(){this.#F.scrollTop=0}isUserAtCustomBottom(){return this.#ct}isUserAtCustomTop(){return this.#ut}isUserAtBottom(){return this.#at}isUserAtTop(){return this.#lt}isScrollPaused(){return this.#ft}isWindow(){return this.#dt}isDestroyed(){return this.#K}getAutoScrollBottom(){return this.#mt}getObserveMutations(){return this.#pt}getPreserveScrollOnLayoutShift(){return this.#gt}getDebounceTime(){return this.#yt}getElemAmount(){return this.#bt}getPrevElemAmount(){return this.#wt}getQuerySelector(){return this.#ht}destroy(){if(this.#K)return;this.#K=!0,this.#ot&&(this.#ot.disconnect(),this.#ot=null),this.#nt&&(this.#nt.disconnect(),this.#nt=null);const e=this.#dt?window:this.#F;this.#st&&e.removeEventListener("scroll",this.#st),this.#Xe=new WeakMap,this.#Qe=new WeakMap,this.#Ke=new WeakMap,this.#Ze=new WeakMap,this.#et=new WeakMap,this.#tt=new WeakMap,this.#rt={},this.#xt.clear(),this.#it.clear()}}const Ct=St,At=class{#H;#St;#Ct;constructor(e,{openTag:t="[",closeTag:r="]"}={}){if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))throw new TypeError("Element must be an input or textarea.");if("string"!=typeof t)throw new TypeError("openTag must be a string.");if("string"!=typeof r)throw new TypeError("closeTag must be a string.");this.#H=e,this.#St=t,this.#Ct=r}getOpenTag(){return this.#St}getCloseTag(){return this.#Ct}setOpenTag(e){if("string"!=typeof e)throw new TypeError("Open tag must be a string.");this.#St=e}setCloseTag(e){if("string"!=typeof e)throw new TypeError("Close tag must be a string.");this.#Ct=e}ensureFocus(){return document.activeElement!==this.#H&&this.#H.focus(),this}focus(){return this.#H.focus(),this}getSelectionRange(){return{start:this.#H.selectionStart??NaN,end:this.#H.selectionEnd??NaN}}setSelectionRange(e,t,r=!0){if("number"!=typeof e||"number"!=typeof t)throw new TypeError("start and end must be numbers.");if("boolean"!=typeof r)throw new TypeError("preserveScroll must be a boolean.");const n=this.#H.scrollTop,o=this.#H.scrollLeft;return this.#H.setSelectionRange(e,t),r&&(this.#H.scrollTop=n,this.#H.scrollLeft=o),this}getValue(){return this.#H.value}setValue(e){if("string"!=typeof e)throw new TypeError("Value must be a string.");return this.#H.value=e,this}getSelectedText(){const{start:e,end:t}=this.getSelectionRange();return this.#H.value.slice(e,t)}insertText(e,{newCursor:t="end",autoSpacing:r=!1,autoSpaceLeft:n=r,autoSpaceRight:o=r}={}){if("string"!=typeof e)throw new TypeError("Text must be a string.");if(!["start","end","preserve"].includes(t))throw new TypeError("newCursor must be one of 'start', 'end', or 'preserve'.");if("boolean"!=typeof r)throw new TypeError("autoSpacing must be a boolean.");if("boolean"!=typeof n)throw new TypeError("autoSpaceLeft must be a boolean.");if("boolean"!=typeof o)throw new TypeError("autoSpaceRight must be a boolean.");const{start:i,end:s}=this.getSelectionRange(),a=this.#H.value,l=a[i-1]||"",u=a[s]||"",c=`${n&&l&&!/\s/.test(l)?" ":""}${e}${o&&u&&!/\s/.test(u)?" ":""}`,h=a.slice(0,i)+c+a.slice(s);this.setValue(h);let d=i;return"end"===t?d=i+c.length:"preserve"===t&&(d=i),this.setSelectionRange(d,d),this}deleteSelection(){return this.insertText(""),this}transformSelection(e){if("function"!=typeof e)throw new TypeError("transformer must be a function.");const{start:t}=this.getSelectionRange(),r=e(this.getSelectedText());return this.insertText(r),this.setSelectionRange(t,t+r.length),this}surroundSelection(e,t){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("prefix and suffix must be strings.");const r=this.getSelectedText();return this.insertText(`${e}${r}${t}`),this}moveCaret(e){if("number"!=typeof e)throw new TypeError("offset must be a number.");const{start:t}=this.getSelectionRange(),r=Math.max(0,t+e);return this.setSelectionRange(r,r),this}selectAll(){return this.setSelectionRange(0,this.#H.value.length),this}expandSelection(e,t){if("number"!=typeof e||"number"!=typeof t)throw new TypeError("before and after must be numbers.");const{start:r,end:n}=this.getSelectionRange(),o=Math.max(0,r-e),i=Math.min(this.#H.value.length,n+t);return this.setSelectionRange(o,i),this}replaceAll(e,t){if(!(e instanceof RegExp))throw new TypeError("regex must be a RegExp.");if("function"!=typeof t)throw new TypeError("replacer must be a function.");const r=this.#H.value.replace(e,t);return this.setValue(r),this}replaceInSelection(e,t){if(!(e instanceof RegExp))throw new TypeError("regex must be a RegExp.");if("function"!=typeof t)throw new TypeError("replacer must be a function.");const{start:r,end:n}=this.getSelectionRange(),o=this.#H.value,i=o.slice(r,n).replace(e,t),s=o.slice(0,r)+i+o.slice(n);return this.setValue(s),this.setSelectionRange(r,r+i.length),this}toggleCode(e){if("string"!=typeof e)throw new TypeError("codeName must be a string.");const t=this.getSelectedText();if(t.startsWith(e)&&t.endsWith(e)){const r=t.slice(e.length,t.length-e.length);this.insertText(r)}else this.insertText(`${e}${t}${e}`);return this}_insertAttr(e){let t="";if(Array.isArray(e)){if(!e.every((e=>"string"==typeof e)))throw new TypeError("All entries in attributes array must be strings.");t=e.map((e=>`${e}`)).join(" ")}else{if("object"!=typeof e||null===e)throw new TypeError("attributes must be an object or an array of strings.");t=Object.entries(e).map((([e,t])=>{if("string"!=typeof t)throw new TypeError("All entries in attributes object must be strings.");return`${e}${t.length>0?`="${t}"`:""}`})).join(" ")}return t}wrapWithTag(e,t={}){if("string"!=typeof e)throw new TypeError("tagName must be a string.");const r=this._insertAttr(t),n=r?`${this.#St}${e} ${r}${this.#Ct}`:`${this.#St}${e}${this.#Ct}`,o=`${this.#St}/${e}${this.#Ct}`;return this.surroundSelection(n,o),this}insertTag(e,t="",r={}){if("string"!=typeof e)throw new TypeError("tagName must be a string.");if("string"!=typeof t)throw new TypeError("content must be a string.");const n=this._insertAttr(r),o=n?`${this.#St}${e} ${n}${this.#Ct}`:`${this.#St}${e}${this.#Ct}`,i=`${this.#St}/${e}${this.#Ct}`;return this.insertText(`${o}${t}${i}`),this}insertSelfClosingTag(e,t={}){if("string"!=typeof e)throw new TypeError("tagName must be a string.");const r=this._insertAttr(t),n=r?`${this.#St}${e} ${r}${this.#Ct}`:`${this.#St}${e}${this.#Ct}`;return this.insertText(n),this}toggleTag(e,t={}){if("string"!=typeof e)throw new TypeError("tagName must be a string.");const r=this.getSelectedText(),n=new RegExp(`^\\[${e}(\\s+[^\\]]*)?\\]`),o=new RegExp(`\\[/${e}\\]$`),i=n.test(r),s=o.test(r);if(i&&s){const e=r.replace(n,"").replace(o,"");this.insertText(e)}else{const n=this._insertAttr(t),o=n?`${this.#St}${e} ${n}${this.#Ct}`:`${this.#St}${e}${this.#Ct}`,i=`${this.#St}/${e}${this.#Ct}`;this.insertText(`${o}${r}${i}`)}return this}},Lt=class{#At=!1;#Lt=!1;#Dt=null;#kt=null;constructor(){void 0!==navigator.clipboard&&null!==navigator.clipboard&&(this.#Lt=!0,this.#Dt=e=>navigator.clipboard.writeText(e),this.#kt=e=>navigator.clipboard.write([new ClipboardItem({[e.type]:e})])),this.#At=void 0!==document.execCommand&&null!==document.execCommand}setCopyText(e){if("function"!=typeof e)throw new TypeError("setCopyText expected a function that returns Promise<void>.");this.#Dt=e}setCopyBlob(e){if("function"!=typeof e)throw new TypeError("setCopyBlob expected a function that returns Promise<void>.");this.#kt=e}copyText(e){if("string"!=typeof e)throw new TypeError("copyText expected a string.");if(this.#Dt)return this.#Dt(e);if(this.#At){const t=document.body,r=document.createElement("input");return r.style.position="fixed",r.style.opacity="0",r.value=e,t.append(r),r.select(),r.setSelectionRange(0,99999),document.execCommand("Copy"),r.remove(),new Promise((e=>e(void 0)))}throw new Error("Clipboard API not found!")}copyBlob(e){if(!(e instanceof Blob))throw new TypeError("copyBlob expected a Blob instance.");return new Promise(((t,r)=>{if(this.#kt)return this.#kt(e).then(t).catch(r);throw new Error("Clipboard API not found!")}))}_handleBlob(e,t){return t.getType(e)}_handleText(e,t){return this._handleBlob(e,t).then((e=>e.text()))}_readData(e=0,t=null,r=null,n=!1){return new Promise(((o,i)=>{this._read(e).then((s=>{if(!s)return o(null);const a=[];let l=!0;const u=async(e,o)=>{if(l)if(null!==t&&"custom"!==t||"string"!=typeof r||!(!n&&e.startsWith(r)||n&&e===r))if(null!==t&&"text"!==t||"text/plain"!==e){if(null===t){l=!1;const t=await this._handleBlob(e,o);t&&a.push(t)}}else{l=!1;const t=await this._handleText(e,o);t&&a.push(t)}else{l=!1;const t=await this._handleBlob(e,o);t&&a.push(t)}},c=[],h=e=>{if(!(e instanceof ClipboardItem))throw new Error("Expected ClipboardItem when reading data.");for(const t in e.types)c.push(u(e.types[t],e))};if("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)&&e>-1)h(s),Promise.all(c).then((()=>{a[0]?o(a[0]):o(null)})).catch(i);else if(Array.isArray(s)){for(const e in s)h(s[e]);Promise.all(c).then((()=>o(a))).catch(i)}})).catch(i)}))}async readText(e=0){const t=await this._readData(e,"text");if("string"!=typeof t)throw new Error("Failed to read text: expected string result.");return t}async readCustom(e=null,t=!1,r=0){const n=await this._readData(r,"custom",e,t);if(!(n instanceof Blob))throw new Error("Failed to read custom data: expected Blob.");return n}async readAllTexts(){const e=await this._readData(null,"text");if(!Array.isArray(e))throw new Error("Expected array of strings when reading all texts.");if(!e.every((e=>"string"==typeof e)))throw new Error("Some values returned were not strings.");return e}async readAllCustom(e=null,t=!1){const r=await this._readData(null,"custom",e,t);if(!Array.isArray(r))throw new Error("Expected array of blobs when reading all custom items.");if(!r.every((e=>e instanceof Blob)))throw new Error("Some values returned were not Blob instances.");return r}async readAllData(e=null,t=null){const r=await this._readData(null,e,t);if(!Array.isArray(r))throw new Error("Expected array result when reading all data.");return r}_read(e){return new Promise(((t,r)=>{this.#Lt||r(new Error("Clipboard API not found!")),navigator.clipboard.read().then((r=>{if("number"==typeof e){if(Number.isNaN(e)||!Number.isFinite(e)||e<0)throw new Error(`Invalid index value: ${e}`);r[e]?t(r[e]):t(null)}t(r)})).catch(r)}))}async readIndex(e){const t=await this._read(e);if(null!==t&&!(t instanceof ClipboardItem))throw new Error(`Value at index ${e} is not a ClipboardItem.`);return t}async readAll(){const e=await this._read(null);if(!Array.isArray(e))throw new Error("Expected array result from clipboard read.");for(const t of e)if(!(t instanceof ClipboardItem))throw new Error("Invalid item type found in clipboard result.");return e}isExecCommandAvailable(){return this.#At}isNavigatorClipboardAvailable(){return this.#Lt}getCopyTextFunc(){return this.#Dt}getCopyBlobFunc(){return this.#kt}}})(),window.TinyEssentials=n})();
|
|
2
|
+
(()=>{var e={133:()=>{},251:(e,t)=>{t.read=function(e,t,r,n,o){var i,s,a=8*o-n-1,l=(1<<a)-1,u=l>>1,c=-7,h=r?o-1:0,d=r?-1:1,f=e[t+h];for(h+=d,i=f&(1<<-c)-1,f>>=-c,c+=a;c>0;i=256*i+e[t+h],h+=d,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=n;c>0;s=256*s+e[t+h],h+=d,c-=8);if(0===i)i=1-u;else{if(i===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),i-=u}return(f?-1:1)*s*Math.pow(2,i-n)},t.write=function(e,t,r,n,o,i){var s,a,l,u=8*i-o-1,c=(1<<u)-1,h=c>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,m=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(t*l-1)*Math.pow(2,o),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;e[r+f]=255&a,f+=m,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;e[r+f]=255&s,f+=m,s/=256,u-=8);e[r+f-m]|=128*g}},287:(e,t,r)=>{"use strict";var n=r(526),o=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=l,t.IS=50;var s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return h(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|g(e,t),n=a(r),o=n.write(e,t);return o!==r&&(n=n.slice(0,o)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(F(e,Uint8Array)){var t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(F(e,ArrayBuffer)||e&&F(e.buffer,ArrayBuffer))return f(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(F(e,SharedArrayBuffer)||e&&F(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return l.from(n,t,r);var o=function(e){if(l.isBuffer(e)){var t=0|m(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||$(e.length)?a(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return c(e),a(e<0?0:0|m(e))}function d(e){for(var t=e.length<0?0:0|m(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,l.prototype),n}function m(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||F(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return P(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(e).length;default:if(o)return n?-1:P(e).length;t=(""+t).toLowerCase(),o=!0}}function p(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,r);case"utf8":case"utf-8":return L(this,t,r);case"ascii":return _(this,t,r);case"latin1":case"binary":return D(this,t,r);case"base64":return C(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),$(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:w(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):w(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function w(e,t,r,n,o){var i,s=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,l/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var c=-1;for(i=r;i<a;i++)if(u(e,i)===u(t,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===l)return c*s}else-1!==c&&(i-=i-c),c=-1}else for(r+l>a&&(r=a-l),i=r;i>=0;i--){for(var h=!0,d=0;d<l;d++)if(u(e,i+d)!==u(t,d)){h=!1;break}if(h)return i}return-1}function v(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if($(a))return s;e[r+s]=a}return s}function E(e,t,r,n){return W(P(t,e.length-r),e,r,n)}function T(e,t,r,n){return W(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function x(e,t,r,n){return W(H(t),e,r,n)}function S(e,t,r,n){return W(function(e,t){for(var r,n,o,i=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function C(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function L(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,s,a,l,u=e[o],c=null,h=u>239?4:u>223?3:u>191?2:1;if(o+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(l=(15&u)<<12|(63&i)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(l=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=h}return function(e){var t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=A));return r}(n)}l.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,r){return function(e,t,r){return c(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},l.allocUnsafe=function(e){return h(e)},l.allocUnsafeSlow=function(e){return h(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(F(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),F(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=l.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(F(i,Uint8Array))o+i.length>n.length?l.from(i).copy(n,o):Uint8Array.prototype.set.call(n,i,o);else{if(!l.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o)}o+=i.length}return n},l.byteLength=g,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},l.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?L(this,0,e):p.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",r=t.IS;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(l.prototype[i]=l.prototype.inspect),l.prototype.compare=function(e,t,r,n,o){if(F(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(i,s),u=this.slice(n,o),c=e.slice(t,r),h=0;h<a;++h)if(u[h]!==c[h]){i=u[h],s=c[h];break}return i<s?-1:s<i?1:0},l.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},l.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},l.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},l.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return T(this,e,t,r);case"base64":return x(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function _(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function D(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function k(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=t;i<r;++i)o+=U[e[i]];return o}function M(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function I(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,r,n,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function B(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(e,t,r,n,i){return t=+t,r>>>=0,i||B(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function R(e,t,r,n,i){return t=+t,r>>>=0,i||B(e,0,r,8),o.write(e,t,r,n,52,8),r+8}l.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,l.prototype),n},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||I(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||I(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||I(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||I(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||I(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||I(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return e>>>=0,t||I(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||I(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||I(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||I(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||N(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||N(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);N(this,e,t,r,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/s|0)-a&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);N(this,e,t,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s|0)-a&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeFloatLE=function(e,t,r){return j(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return j(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return R(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return R(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),o},l.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var s=l.isBuffer(e)?e:l.from(e,n),a=s.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%a]}return this};var O=/[^+/0-9A-Za-z-_]/g;function P(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function H(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(O,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function W(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function F(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function $(e){return e!=e}var U=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)t[n+o]=e[r]+e[o];return t}()},370:()=>{},526:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,i=a(e),s=i[0],l=i[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,l)),c=0,h=l>0?s-4:s;for(r=0;r<h;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===l&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===l&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],s=16383,a=0,l=n-o;a<l;a+=s)i.push(u(e,a,a+s>l?l:a+s));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=i[s],n[i.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function u(e,t,r){for(var n,o=[],i=t;i<r;i+=3)n=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),o.push(l(n));return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},606:e=>{var t,r,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var a,l=[],u=!1,c=-1;function h(){u&&a&&(u=!1,a.length?l=a.concat(l):c=-1,l.length&&d())}function d(){if(!u){var e=s(h);u=!0;for(var t=l.length;t;){for(a=l,l=[];++c<t;)a&&a[c].run();c=-1,t=l.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function m(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new f(e,t)),1!==l.length||u||s(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=m,n.addListener=m,n.once=m,n.off=m,n.removeListener=m,n.removeAllListeners=m,n.emit=m,n.prependListener=m,n.prependOnceListener=m,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},975:(e,t,r)=>{"use strict";var n=r(606);function o(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function i(e,t){for(var r,n="",o=0,i=-1,s=0,a=0;a<=e.length;++a){if(a<e.length)r=e.charCodeAt(a);else{if(47===r)break;r=47}if(47===r){if(i===a-1||1===s);else if(i!==a-1&&2===s){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var l=n.lastIndexOf("/");if(l!==n.length-1){-1===l?(n="",o=0):o=(n=n.slice(0,l)).length-1-n.lastIndexOf("/"),i=a,s=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=a,s=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),o=a-i-1;i=a,s=0}else 46===r&&-1!==s?++s:s=-1}return n}var s={resolve:function(){for(var e,t="",r=!1,s=arguments.length-1;s>=-1&&!r;s--){var a;s>=0?a=arguments[s]:(void 0===e&&(e=n.cwd()),a=e),o(a),0!==a.length&&(t=a+"/"+t,r=47===a.charCodeAt(0))}return t=i(t,!r),r?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(o(e),0===e.length)return".";var t=47===e.charCodeAt(0),r=47===e.charCodeAt(e.length-1);return 0!==(e=i(e,!t)).length||t||(e="."),e.length>0&&r&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return o(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var r=arguments[t];o(r),r.length>0&&(void 0===e?e=r:e+="/"+r)}return void 0===e?".":s.normalize(e)},relative:function(e,t){if(o(e),o(t),e===t)return"";if((e=s.resolve(e))===(t=s.resolve(t)))return"";for(var r=1;r<e.length&&47===e.charCodeAt(r);++r);for(var n=e.length,i=n-r,a=1;a<t.length&&47===t.charCodeAt(a);++a);for(var l=t.length-a,u=i<l?i:l,c=-1,h=0;h<=u;++h){if(h===u){if(l>u){if(47===t.charCodeAt(a+h))return t.slice(a+h+1);if(0===h)return t.slice(a+h)}else i>u&&(47===e.charCodeAt(r+h)?c=h:0===h&&(c=0));break}var d=e.charCodeAt(r+h);if(d!==t.charCodeAt(a+h))break;47===d&&(c=h)}var f="";for(h=r+c+1;h<=n;++h)h!==n&&47!==e.charCodeAt(h)||(0===f.length?f+="..":f+="/..");return f.length>0?f+t.slice(a+c):(a+=c,47===t.charCodeAt(a)&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(o(e),0===e.length)return".";for(var t=e.charCodeAt(0),r=47===t,n=-1,i=!0,s=e.length-1;s>=1;--s)if(47===(t=e.charCodeAt(s))){if(!i){n=s;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"//":e.slice(0,n)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');o(e);var r,n=0,i=-1,s=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,l=-1;for(r=e.length-1;r>=0;--r){var u=e.charCodeAt(r);if(47===u){if(!s){n=r+1;break}}else-1===l&&(s=!1,l=r+1),a>=0&&(u===t.charCodeAt(a)?-1===--a&&(i=r):(a=-1,i=l))}return n===i?i=l:-1===i&&(i=e.length),e.slice(n,i)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!s){n=r+1;break}}else-1===i&&(s=!1,i=r+1);return-1===i?"":e.slice(n,i)},extname:function(e){o(e);for(var t=-1,r=0,n=-1,i=!0,s=0,a=e.length-1;a>=0;--a){var l=e.charCodeAt(a);if(47!==l)-1===n&&(i=!1,n=a+1),46===l?-1===t?t=a:1!==s&&(s=1):-1!==t&&(s=-1);else if(!i){r=a+1;break}}return-1===t||-1===n||0===s||1===s&&t===n-1&&t===r+1?"":e.slice(t,n)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+"/"+n:n}(0,e)},parse:function(e){o(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var r,n=e.charCodeAt(0),i=47===n;i?(t.root="/",r=1):r=0;for(var s=-1,a=0,l=-1,u=!0,c=e.length-1,h=0;c>=r;--c)if(47!==(n=e.charCodeAt(c)))-1===l&&(u=!1,l=c+1),46===n?-1===s?s=c:1!==h&&(h=1):-1!==s&&(h=-1);else if(!u){a=c+1;break}return-1===s||-1===l||0===h||1===h&&s===l-1&&s===a+1?-1!==l&&(t.base=t.name=0===a&&i?e.slice(1,l):e.slice(a,l)):(0===a&&i?(t.name=e.slice(1,s),t.base=e.slice(1,l)):(t.name=e.slice(a,s),t.base=e.slice(a,l)),t.ext=e.slice(s,l)),a>0?t.dir=e.slice(0,a-1):i&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};s.posix=s,e.exports=s}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{ColorSafeStringify:()=>W,TinyAfterScrollWatcher:()=>pt,TinyClipboard:()=>_t,TinyColorConverter:()=>kt,TinyDomReadyManager:()=>mt,TinyDragDropDetector:()=>Be,TinyDragger:()=>ft,TinyEvents:()=>St,TinyHtml:()=>Le,TinyLevelUp:()=>o,TinyLocalStorage:()=>Rt,TinyNotifications:()=>gt,TinyNotifyCenter:()=>V,TinyPromiseQueue:()=>F,TinyRateLimiter:()=>$,TinySmartScroller:()=>Lt,TinyTextRangeEditor:()=>At,TinyTimeout:()=>It,TinyToastNotify:()=>J,UltraRandomMsgGen:()=>xt,addAiMarkerShortcut:()=>O,areElsCollBottom:()=>Z,areElsCollLeft:()=>ee,areElsCollPerfBottom:()=>ne,areElsCollPerfLeft:()=>oe,areElsCollPerfRight:()=>ie,areElsCollPerfTop:()=>re,areElsCollRight:()=>te,areElsCollTop:()=>Q,areElsColliding:()=>se,areElsPerfColliding:()=>ae,areHtmlElsColliding:()=>Ae,arraySortPositions:()=>i,asyncReplace:()=>t,backupFile:()=>Ke,checkObj:()=>E,clearDirectory:()=>We,clearDirectoryAsync:()=>st,cloneObjTypeOrder:()=>b,countObj:()=>d,dirExists:()=>$e,dirSize:()=>Xe,dirSizeAsync:()=>ht,documentIsFullScreen:()=>T,ensureCopyFile:()=>Ve,ensureDirectory:()=>He,exitFullScreen:()=>L,extendObjType:()=>p,fetchJson:()=>X,fileExists:()=>Fe,fileSize:()=>Ye,fileSizeAsync:()=>ct,formatBytes:()=>N,formatCustomTimer:()=>l,formatDayTimer:()=>c,formatTimer:()=>u,genFibonacciSeq:()=>B,getAge:()=>I,getElsCollDetails:()=>ge,getElsCollDirDepth:()=>me,getElsCollOverlap:()=>ce,getElsCollOverlapPos:()=>he,getElsColliding:()=>le,getElsPerfColliding:()=>ue,getElsRelativeCenterOffset:()=>fe,getHtmlElBorders:()=>De,getHtmlElBordersWidth:()=>_e,getHtmlElMargin:()=>ke,getHtmlElPadding:()=>Me,getLatestBackupPath:()=>Qe,getRectCenter:()=>de,getSimplePerc:()=>M,getTimeDuration:()=>a,installWindowHiddenScript:()=>K,isDirEmpty:()=>Ue,isDirEmptyAsync:()=>at,isFullScreenMode:()=>S,isInViewport:()=>Ie,isJsonObject:()=>f,isScreenFilled:()=>x,isScrolledIntoView:()=>Ne,listDirs:()=>Ge,listDirsAsync:()=>ut,listFiles:()=>qe,listFilesAsync:()=>lt,objType:()=>v,offFullScreenChange:()=>D,onFullScreenChange:()=>_,readBase64Blob:()=>q,readFileBlob:()=>z,readJsonBlob:()=>G,readJsonFile:()=>Oe,renameFileAddPrefixSuffix:()=>rt,renameFileBatch:()=>et,renameFileNormalizeCase:()=>nt,renameFilePadNumbers:()=>ot,renameFileRegex:()=>tt,reorderObjTypeOrder:()=>y,requestFullScreen:()=>C,restoreLatestBackup:()=>Ze,ruleOfThree:()=>k,safeTextTrim:()=>P,saveJsonFile:()=>Y,shuffleArray:()=>s,toTitleCase:()=>j,toTitleCaseLowerFirst:()=>R,tryDeleteFile:()=>Je,writeJsonFile:()=>Pe,writeTextFile:()=>ze});var e={};async function t(e,t,r){const n=[];e.replace(t,(e,...t)=>(n.push(r(e,...t)),e));const o=await Promise.all(n);return e.replace(t,()=>o.shift())}r.r(e),r.d(e,{areElsCollBottom:()=>Z,areElsCollLeft:()=>ee,areElsCollPerfBottom:()=>ne,areElsCollPerfLeft:()=>oe,areElsCollPerfRight:()=>ie,areElsCollPerfTop:()=>re,areElsCollRight:()=>te,areElsCollTop:()=>Q,areElsColliding:()=>se,areElsPerfColliding:()=>ae,getElsCollDetails:()=>ge,getElsCollDirDepth:()=>me,getElsCollOverlap:()=>ce,getElsCollOverlapPos:()=>he,getElsColliding:()=>le,getElsPerfColliding:()=>ue,getElsRelativeCenterOffset:()=>fe,getRectCenter:()=>de});const o=class{constructor(e,t){if("number"!=typeof e||Number.isNaN(e))throw new Error("giveExp must be a valid number");if("number"!=typeof t||Number.isNaN(t))throw new Error("expLevel must be a valid number");this.giveExp=e,this.expLevel=t}createUser(){return{exp:0,level:1,totalExp:0}}validateUser(e){if("number"!=typeof e.exp||Number.isNaN(e.exp))throw new Error("exp must be a valid number");if("number"!=typeof e.level||Number.isNaN(e.level))throw new Error("level must be a valid number");if(e.level<1)throw new Error("level must be at least 1");if("number"!=typeof e.totalExp||Number.isNaN(e.totalExp))throw new Error("totalExp must be a valid number")}isValidUser(e){return!("number"!=typeof e.exp||Number.isNaN(e.exp)||"number"!=typeof e.level||Number.isNaN(e.level)||e.level<1||"number"!=typeof e.totalExp||Number.isNaN(e.totalExp))}getGiveExpBase(){if("number"!=typeof this.giveExp||Number.isNaN(this.giveExp))throw new Error("giveExp must be a valid number");return this.giveExp}getExpLevelBase(){if("number"!=typeof this.expLevel||Number.isNaN(this.expLevel))throw new Error("expLevel must be a valid number");return this.expLevel}expValidator(e){const t=this.getExpLevelBase();this.validateUser(e);let r=0;const n=t*e.level;return e.exp>=n&&(e.level++,r=e.exp-n,e.exp=0,r>0)?this.give(e,r,"extra"):e.exp<1&&e.level>1&&(e.level--,r=Math.abs(e.exp),e.exp=t*e.level,r>0)?this.remove(e,r,"extra"):e}getTotalExp(e){this.validateUser(e);let t=0;for(let r=1;r<=e.level;r++)t+=this.getExpLevelBase()*r;return t+=e.exp,t}expGenerator(e=1){if("number"!=typeof e||Number.isNaN(e))throw new Error("multi must be a valid number");return Math.floor(Math.random()*this.getGiveExpBase())*e}getMissingExp(e){return this.getProgress(e)-e.exp}progress(e){return this.getProgress(e)}getProgress(e){return this.validateUser(e),this.getExpLevelBase()*e.level}set(e,t){if("number"!=typeof t||Number.isNaN(t))throw new Error("value must be a valid number");return e.exp=t,this.expValidator(e),e.totalExp=this.getTotalExp(e),e}give(e,t=0,r="add",n=1){if("number"!=typeof n||Number.isNaN(n))throw new Error("multi must be a valid number");if("number"!=typeof t||Number.isNaN(t))throw new Error("extraExp must be a valid number");if("string"!=typeof r)throw new Error("type must be a valid string");return"add"===r?e.exp+=this.expGenerator(n)+t:"extra"===r&&(e.exp+=t),this.expValidator(e),e.totalExp=this.getTotalExp(e),e}remove(e,t=0,r="add",n=1){if("number"!=typeof n||Number.isNaN(n))throw new Error("multi must be a valid number");if("number"!=typeof t||Number.isNaN(t))throw new Error("extraExp must be a valid number");if("string"!=typeof r)throw new Error("type must be a valid string");return"add"===r?e.exp-=this.expGenerator(n)+t:"extra"===r&&(e.exp-=t),this.expValidator(e),e.totalExp=this.getTotalExp(e),e}};function i(e,t=!1){return t?function(t,r){return t[e]>r[e]?-1:t[e]<r[e]?1:0}:function(t,r){return t[e]<r[e]?-1:t[e]>r[e]?1:0}}function s(e){let t,r=e.length;for(;0!==r;)t=Math.floor(Math.random()*r),r--,[e[r],e[t]]=[e[t],e[r]];return e}function a(e=new Date,t="asSeconds",r=null){if(e instanceof Date){const n=r instanceof Date?r:new Date,o=e.getTime()-n.getTime();switch(t){case"asMilliseconds":return o;case"asSeconds":default:return o/1e3;case"asMinutes":return o/6e4;case"asHours":return o/36e5;case"asDays":return o/864e5}}return null}function l(e,t="seconds",r="{time}"){e=Math.max(0,Math.floor(e));const n=["seconds","minutes","hours","days","months","years"].indexOf(t),o=n>=5,i=n>=4,s=n>=3,a=n>=2,l=n>=1,u=n>=0,c={years:o?0:NaN,months:i?0:NaN,days:s?0:NaN,hours:a?0:NaN,minutes:l?0:NaN,seconds:u?0:NaN,total:NaN};let h=e;if(o||i||s){const e=new Date(1980,0,1),t=new Date(e.getTime()+1e3*h),r=new Date(e);if(o)for(;new Date(r.getFullYear()+1,r.getMonth(),r.getDate()).getTime()<=t.getTime();)r.setFullYear(r.getFullYear()+1),c.years++;if(i)for(;new Date(r.getFullYear(),r.getMonth()+1,r.getDate()).getTime()<=t.getTime();)r.setMonth(r.getMonth()+1),c.months++;if(s)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=t.getTime();)r.setDate(r.getDate()+1),c.days++;h=Math.floor((t.getTime()-r.getTime())/1e3)}a&&(c.hours=Math.floor(h/3600),h%=3600),l&&(c.minutes=Math.floor(h/60),h%=60),u&&(c.seconds=h);const d={seconds:u?e:NaN,minutes:l?e/60:NaN,hours:a?e/3600:NaN,days:s?e/86400:NaN,months:i?12*c.years+c.months+(c.days||0)/30:NaN,years:o?c.years+(c.months||0)/12+(c.days||0)/365:NaN};c.total=+(d[t]||0).toFixed(2).replace(/\.00$/,"");const f=e=>{const t="string"==typeof e?parseInt(e):e;return Number.isNaN(t)?"NaN":String(t).padStart(2,"0")},m=[a?f(c.hours):null,l?f(c.minutes):null,u?f(c.seconds):null].filter(e=>null!==e).join(":");return r.replace(/\{years\}/g,String(c.years)).replace(/\{months\}/g,String(c.months)).replace(/\{days\}/g,String(c.days)).replace(/\{hours\}/g,f(c.hours)).replace(/\{minutes\}/g,f(c.minutes)).replace(/\{seconds\}/g,f(c.seconds)).replace(/\{time\}/g,m).replace(/\{total\}/g,String(c.total)).trim()}function u(e){return l(e,"hours","{hours}:{minutes}:{seconds}")}function c(e){return l(e,"days","{days}d {hours}:{minutes}:{seconds}")}var h=r(287);function d(e){return Array.isArray(e)?e.length:f(e)?Object.keys(e).length:0}function f(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"===Object.prototype.toString.call(e)}const m="undefined"!=typeof window&&void 0!==window.document,g={items:{},order:[]};function p(e,t){const r=[],n=Array.isArray(e)?e:Object.entries(e);for(const[e,o]of n)if(!g.items.hasOwnProperty(e)){g.items[e]=o;let n="number"==typeof t?t:-1;if(-1===n){const e=g.order.indexOf("object");n=e>-1?e:g.order.length}n=Math.min(Math.max(0,n),g.order.length),g.order.splice(n,0,e),r.push(e)}return r}function y(e){const t=[...g.order];return!!e.every(e=>t.includes(e))&&(g.order=e.slice(),!0)}function b(){return[...g.order]}const w=e=>{if(null===e)return"null";for(const t of g.order)if("function"!=typeof g.items[t]||g.items[t](e))return t;return"unknown"};function v(e,t){if(void 0===e)return null;const r=w(e);return"string"==typeof t?r===t.toLowerCase():r}function E(e){const t={valid:null,type:null};for(const r of g.order)if("function"==typeof g.items[r]){const n=g.items[r](e);if(n){t.valid=n,t.type=r;break}}return t}p([["undefined",e=>void 0===e],["null",e=>null===e],["boolean",e=>"boolean"==typeof e],["number",e=>"number"==typeof e&&!Number.isNaN(e)],["bigint",e=>"bigint"==typeof e],["string",e=>"string"==typeof e],["symbol",e=>"symbol"==typeof e],["function",e=>"function"==typeof e],["array",e=>Array.isArray(e)]]),m||p([["buffer",e=>void 0!==h.hp&&h.hp.isBuffer(e)]]),m&&p([["file",e=>"undefined"!=typeof File&&e instanceof File]]),p([["date",e=>e instanceof Date],["regexp",e=>e instanceof RegExp],["map",e=>e instanceof Map],["set",e=>e instanceof Set],["weakmap",e=>e instanceof WeakMap],["weakset",e=>e instanceof WeakSet],["promise",e=>e instanceof Promise]]),m&&p([["htmlelement",e=>"undefined"!=typeof HTMLElement&&e instanceof HTMLElement]]),p([["object",e=>f(e)]]);const T=()=>!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitIsFullScreen||document.mozFullScreen),x=()=>window.innerHeight===screen.height&&window.innerWidth===screen.width,S=()=>T()||x(),C=e=>new Promise(async(t,r)=>{const n=document.documentElement;try{n.requestFullscreen?await n.requestFullscreen(e):n.mozRequestFullScreen?n.mozRequestFullScreen(e):n.webkitRequestFullScreen?n.webkitRequestFullScreen(e):n.msRequestFullscreen&&n.msRequestFullscreen(e),t()}catch(e){r(e)}}),L=()=>new Promise((e,t)=>{if(document.exitFullscreen)document.exitFullscreen().then(e).catch(t);else try{if(document.mozCancelFullScreen)document.mozCancelFullScreen();else if(document.webkitCancelFullScreen)document.webkitCancelFullScreen();else{if(!document.msExitFullscreen)throw new Error("Fullscreen API is not supported");document.msExitFullscreen()}e()}catch(e){t(e)}}),A=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],_=(e,t)=>{A.forEach(r=>{document.addEventListener(r,e,t)})},D=(e,t)=>{A.forEach(r=>{document.removeEventListener(r,e,t)})};function k(e,t,r,n=!1){return n?Number(e*t)/r:Number(r*t)/e}function M(e,t){return e*(t/100)}function I(e=0,t=null){if(null!=e&&0!==e){const r=new Date(e);if(Number.isNaN(r.getTime()))return null;const n=t instanceof Date?t:new Date;let o=n.getFullYear()-r.getFullYear();const i=n.getMonth(),s=r.getMonth(),a=n.getDate(),l=r.getDate();return(i<s||i===s&&a<l)&&o--,Math.abs(o)}return null}function N(e,t=null,r=null){if("number"!=typeof e||e<0)return{unit:null,value:null};if(0===e)return{unit:"Bytes",value:0};const n=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],o=r&&n.includes(r)?n.indexOf(r):n.length-1,i=Math.min(Math.floor(Math.log(e)/Math.log(1024)),o);let s=e/Math.pow(1024,i);if(null!==t){const e=t<0?0:t;s=parseFloat(s.toFixed(e))}return{unit:n[i],value:s}}function B({baseValues:e=[0,1],length:t=10,combiner:r=(e,t)=>e+t}={}){if(!Array.isArray(e)||2!==e.length)throw new Error("baseValues must be an array of exactly two numbers");const n=[...e.slice(0,2)];for(let e=2;e<t;e++){const t=r(n[e-2],n[e-1],e);n.push(t)}return n}function j(e){return e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase())}function R(e){const t=e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase());return t.charAt(0).toLowerCase()+t.slice(1)}function O(e="a"){"undefined"!=typeof HTMLElement?document.addEventListener("keydown",function(t){if(t.ctrlKey&&t.altKey&&t.key.toLowerCase()===e){if(t.preventDefault(),!document.body)return void console.warn("[AiMarkerShortcut] <body> element not found. Cannot toggle class. Ensure the DOM is fully loaded when using the shortcut.");document.body.classList.toggle("detect-made-by-ai")}}):console.error("[AiMarkerShortcut] Environment does not support the DOM. This function must be run in a browser.")}function P(e,t,r=.6){if("string"!=typeof e)throw new TypeError("Expected a string for 'text', but received "+typeof e);if(!Number.isInteger(t)||t<=0)throw new TypeError(`Expected 'limit' to be a positive integer, but received ${t}`);if("number"!=typeof r||r<0||r>1)throw new TypeError(`Expected 'safeCutZone' to be a number between 0 and 1, but received ${r}`);let n=e.trim();if(n.length>t){const e=n.lastIndexOf(" ",t);return e>0&&e>=t*r?`${n.substring(0,e).trim()}...`:`${n.substring(0,t).trim()}...`}return n}class H{#e;static#t={default:{reset:"[0m",key:"[36m",string:"[32m",string_url:"[34m",string_bool:"[35m",string_number:"[33m",number:"[33m",boolean:"[35m",null:"[1;30m",special:"[31m",func:"[90m"},solarized:{reset:"[0m",key:"[38;5;37m",string:"[38;5;136m",string_url:"[38;5;33m",string_bool:"[38;5;166m",string_number:"[38;5;136m",number:"[38;5;136m",boolean:"[38;5;166m",null:"[38;5;241m",special:"[38;5;160m",func:"[38;5;244m"},monokai:{reset:"[0m",key:"[38;5;81m",string:"[38;5;114m",string_url:"[38;5;75m",string_bool:"[38;5;204m",string_number:"[38;5;221m",number:"[38;5;221m",boolean:"[38;5;204m",null:"[38;5;241m",special:"[38;5;160m",func:"[38;5;102m"}};constructor(e={}){this.#e={...H.#t.default,...e}}#r(e,t){const r=[];e=(e=(e=e.replace(/(?<!")\b(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b(?!")/g,`${t.number}$1${t.reset}`)).replace(/"([^"]+)":/g,(e,t)=>{const n=`___KEY${r.length}___`;return r.push({marker:n,key:t}),`${n}:`})).replace(/"(?:\\.|[^"\\])*?"/g,e=>{const r=e.slice(1,-1);return/^(https?|ftp):\/\/[^\s]+$/i.test(r)?`${t.string_url}${e}${t.reset}`:/^(true|false|null)$/.test(r)?`${t.string_bool}${e}${t.reset}`:/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(r)?`${t.string_number}${e}${t.reset}`:`${t.string}${e}${t.reset}`});for(const{marker:n,key:o}of r){const r=new RegExp(n,"g");e=e.replace(r,`${t.key}"${o}"${t.reset}`)}return(e=(e=(e=(e=e.replace(/(?<!")\b(true|false)\b(?!")/g,`${t.boolean}$1${t.reset}`)).replace(/(?<!")\bnull\b(?!")/g,`${t.null}null${t.reset}`)).replace(/\[Circular\]/g,`${t.special}[Circular]${t.reset}`)).replace(/\[undefined\]/g,`${t.special}[undefined]${t.reset}`)).replace(/"function.*?[^\\]"/gs,`${t.func}$&${t.reset}`)}colorize(e,t={}){const r={...this.#e,...t};return this.#r(e,r)}getColors(){return{...this.#e}}updateColors(e){Object.assign(this.#e,e)}resetColors(){this.#e={...H.#t.default}}loadColorPreset(e){const t=H.#t[e];if(!t)throw new Error(`Preset "${e}" not found.`);this.#e={...t}}saveColorPreset(e,t){H.#t[e]={...t}}getAvailablePresets(){return Object.keys(H.#t)}}const W=H,F=class{#n=[];#o=!1;#i={};#s=new Set;isRunning(){return this.#o}async#a(e){if(e&&"function"==typeof e.task&&"function"==typeof e.resolve&&"function"==typeof e.reject){const{task:t,resolve:r,reject:n,delay:o,id:i}=e;try{if(i&&this.#s.has(i))return n(new Error("The function was canceled on TinyPromiseQueue.")),this.#s.delete(i),this.#o=!1,void this.#l();o&&i&&await new Promise(e=>{const t=setTimeout(()=>{delete this.#i[i],e(null)},o);this.#i[i]=t}),r(await t())}catch(e){n(e)}finally{this.#o=!1,this.#l()}}}async#u(){const e=[];for(;this.#n.length&&"POINT_MARKER"===this.#n[0]?.marker;)e.push(this.#n.shift());if(0===e.length)return this.#o=!1,void this.#l();await Promise.all(e.map(({task:e,resolve:t,reject:r,id:n})=>new Promise(async o=>{if(n&&this.#s.has(n))return this.#s.delete(n),r(new Error("The function was canceled on TinyPromiseQueue.")),void o(!0);await e().then(t).catch(r),o(!0)}))),this.#o=!1,this.#l()}async#l(){if(!this.#o&&0!==this.#n.length)if(this.#o=!0,"string"!=typeof this.#n[0]?.marker||"POINT_MARKER"!==this.#n[0]?.marker){const e=this.#n.shift();this.#a(e)}else this.#u()}getIndexById(e){return this.#n.findIndex(t=>t.id===e)}getQueuedIds(){return this.#n.map((e,t)=>({index:t,id:e.id})).filter(e=>"string"==typeof e.id)}reorderQueue(e,t){if("number"!=typeof e||"number"!=typeof t||e<0||t<0||e>=this.#n.length||t>=this.#n.length)return;const[r]=this.#n.splice(e,1);this.#n.splice(t,0,r)}async enqueuePoint(e,t){if("function"!=typeof e)return Promise.reject(new Error("Task must be a function returning a Promise."));if(void 0!==t&&"string"!=typeof t)throw new Error('The "id" parameter must be a string.');return this.#o?new Promise((r,n)=>{this.#n.push({marker:"POINT_MARKER",task:e,resolve:r,reject:n,id:t}),this.#l()}):e()}enqueue(e,t,r){if("function"!=typeof e)return Promise.reject(new Error("Task must be a function returning a Promise."));if(void 0!==t&&("number"!=typeof t||t<0))return Promise.reject(new Error("Delay must be a positive number or undefined."));if(void 0!==r&&"string"!=typeof r)throw new Error('The "id" parameter must be a string.');return new Promise((n,o)=>{this.#n.push({task:e,resolve:n,reject:o,id:r,delay:t}),this.#l()})}cancelTask(e){if("string"!=typeof e)throw new Error('The "id" parameter must be a string.');let t=!1;e in this.#i&&(clearTimeout(this.#i[e]),delete this.#i[e],t=!0);const r=this.getIndexById(e);if(-1!==r){const[e]=this.#n.splice(r,1);e?.reject?.(new Error("The function was canceled on TinyPromiseQueue.")),t=!0}return t&&this.#s.add(e),t}},$=class{#c=null;#h=null;#d=null;#f=null;#m=null;#g=null;groupData=new Map;lastSeen=new Map;userToGroup=new Map;groupFlags=new Map;groupTTL=new Map;#p=null;setOnMemoryExceeded(e){if("function"!=typeof e)throw new Error("onMemoryExceeded must be a function");this.#p=e}clearOnMemoryExceeded(){this.#p=null}#y=null;setOnGroupExpired(e){if("function"!=typeof e)throw new Error("onGroupExpired must be a function");this.#y=e}clearOnGroupExpired(){this.#y=null}constructor({maxHits:e,interval:t,cleanupInterval:r,maxIdle:n=3e5,maxMemory:o=1e5}){const i=e=>"number"==typeof e&&Number.isFinite(e)&&e>=1&&Number.isInteger(e),s=i(e),a=i(t),l=i(r),u=i(n);if(!s&&!a)throw new Error("RateLimiter requires at least one valid option: 'maxHits' or 'interval'.");if(void 0!==e&&!s)throw new Error("'maxHits' must be a positive integer if defined.");if(void 0!==t&&!a)throw new Error("'interval' must be a positive integer in milliseconds if defined.");if(void 0!==r&&!l)throw new Error("'cleanupInterval' must be a positive integer in milliseconds if defined.");if(!u)throw new Error("'maxIdle' must be a positive integer in milliseconds.");if("number"==typeof o&&Number.isFinite(o)&&o>0)this.#c=Math.floor(o);else{if(null!=o)throw new Error("maxMemory must be a positive number or null");this.#c=null}this.#d=s?e:null,this.#f=a?t:null,this.#m=l?r:null,this.#g=n,null!==this.#m&&(this.#h=setInterval(()=>this._cleanup(),this.#m))}isGroupId(e){const t=this.groupFlags.get(e);return"boolean"==typeof t&&t}getUsersInGroup(e){const t=[];for(const[r,n]of this.userToGroup.entries())n===e&&t.push(r);return t}setGroupTTL(e,t){if("number"!=typeof t||!Number.isFinite(t)||t<=0)throw new Error("TTL must be a positive number in milliseconds");this.groupTTL.set(e,t)}getGroupTTL(e){return this.groupTTL.get(e)??null}deleteGroupTTL(e){this.groupTTL.delete(e)}assignToGroup(e,t){const r=this.userToGroup.get(e);if(r&&r!==t)throw new Error(`User ${e} is already assigned to group ${r}`);if(r===t)return;const n=this.groupData.get(e);if(this.isGroupId(e)){for(const[r,n]of this.userToGroup.entries())n===e&&this.userToGroup.set(r,t);this.userToGroup.delete(e)}else this.userToGroup.set(e,t);if(!n)return;const o=this.groupData.get(t);if(o)for(const e of n)o.push(e);else{const e=[];for(const t of n)e.push(t);this.groupData.set(t,e)}this.lastSeen.set(t,Date.now()),this.groupFlags.delete(e),this.groupData.delete(e),this.lastSeen.delete(e),this.groupTTL.delete(e),this.groupFlags.set(t,!0)}getGroupId(e){return this.userToGroup.get(e)||e}hit(e){const t=this.getGroupId(e),r=Date.now();this.groupData.has(t)||(this.groupData.set(t,[]),this.groupFlags.set(t,!1));const n=this.groupData.get(t);if(!n)throw new Error(`No data found for groupId: ${t}`);if(n.push(r),this.lastSeen.set(t,r),null!==this.#f){const e=r-this.getInterval();for(;n.length&&n[0]<e;)n.shift()}null!==this.#c&&"number"==typeof this.#c&&n.length>this.#c&&(n.splice(0,n.length-this.#c),"function"==typeof this.#p&&this.#p(t))}isRateLimited(e){const t=this.getGroupId(e);if(!this.groupData.has(t))return!1;const r=this.groupData.get(t);if(!r)throw new Error(`No data found for groupId: ${t}`);if(null!==this.#f){const e=Date.now()-this.getInterval();let t=0;for(let n=r.length-1;n>=0&&r[n]>e;n--)t++;return null!==this.#d?t>this.getMaxHits():t>0}return null!==this.#d&&r.length>this.getMaxHits()}resetGroup(e){this.groupFlags.delete(e),this.groupData.delete(e),this.lastSeen.delete(e),this.groupTTL.delete(e)}reset(e){return this.resetUserGroup(e)}resetUserGroup(e){this.userToGroup.delete(e)}setData(e,t){if(!Array.isArray(t))throw new Error("timestamps must be an array of numbers.");for(const e of t)if("number"!=typeof e||!Number.isFinite(e))throw new Error("All timestamps must be finite numbers.");this.groupData.has(e)||this.groupFlags.set(e,!1),this.groupData.set(e,t),this.lastSeen.set(e,Date.now())}hasData(e){return this.groupData.has(e)}getData(e){return this.groupData.get(e)||[]}getMaxIdle(){if("number"!=typeof this.#g||!Number.isFinite(this.#g)||this.#g<0)throw new Error("'maxIdle' must be a non-negative finite number.");return this.#g}setMaxIdle(e){if("number"!=typeof e||!Number.isFinite(e)||e<0)throw new Error("'maxIdle' must be a non-negative finite number.");this.#g=e}_cleanup(){const e=Date.now();for(const[t,r]of this.lastSeen.entries())e-r>(this.getGroupTTL(t)??this.getMaxIdle())&&(this.groupFlags.delete(t),this.groupData.delete(t),this.lastSeen.delete(t),this.groupTTL.delete(t),"function"==typeof this.#y&&this.#y(t))}getActiveGroups(){return Array.from(this.groupData.keys())}getAllUserMappings(){return Object.fromEntries(this.userToGroup)}getInterval(){if("number"!=typeof this.#f||!Number.isFinite(this.#f))throw new Error("'interval' is not a valid finite number.");return this.#f}getMaxHits(){if("number"!=typeof this.#d||!Number.isFinite(this.#d))throw new Error("'maxHits' is not a valid finite number.");return this.#d}getTotalHits(e){const t=this.groupData.get(e);return Array.isArray(t)?t.length:0}getLastHit(e){const t=this.groupData.get(e);return t?.length?t[t.length-1]:null}getTimeSinceLastHit(e){const t=this.getLastHit(e);return null!==t?Date.now()-t:null}_calculateAverageSpacing(e){if(!Array.isArray(e)||e.length<2)return null;let t=0;for(let r=1;r<e.length;r++)t+=e[r]-e[r-1];return t/(e.length-1)}getAverageHitSpacing(e){return this._calculateAverageSpacing(this.groupData.get(e))}getMetrics(e){const t=this.groupData.get(e);if(!Array.isArray(t)||0===t.length)return{totalHits:0,lastHit:null,timeSinceLastHit:null,averageHitSpacing:null};const r=t.length,n=t[r-1];return{totalHits:r,lastHit:n,timeSinceLastHit:Date.now()-n,averageHitSpacing:this._calculateAverageSpacing(t)}}destroy(){this.#h&&clearInterval(this.#h),this._cleanup(),this.groupData.clear(),this.lastSeen.clear(),this.userToGroup.clear(),this.groupTTL.clear(),this.groupFlags.clear()}};class U{static getTemplate(){return'\n<div class="notify-overlay hidden">\n <div class="notify-center" id="notifCenter">\n <div class="header">\n <div>Notifications</div>\n <div class="options">\n <button class="clear-all" type="button">\n <svg\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n fill="currentColor"\n >\n <path\n d="M21.6 2.4a1 1 0 0 0-1.4 0L13 9.6l-1.3-1.3a1 1 0 0 0-1.4 0L3 15.6a1 1 0 0 0 0 1.4l4 4a1 1 0 0 0 1.4 0l7.3-7.3a1 1 0 0 0 0-1.4l-1.3-1.3 7.2-7.2a1 1 0 0 0 0-1.4zM6 17l3.5-3.5 1.5 1.5L7.5 18.5 6 17z"\n />\n </svg>\n </button>\n <button class="close">×</button>\n </div>\n </div>\n <div class="list"></div>\n </div>\n</div>\n\n<button class="notify-bell" aria-label="Open notifications">\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="20"\n height="20"\n fill="currentColor"\n viewBox="0 0 24 24"\n >\n <path\n d="M12 2C10.3 2 9 3.3 9 5v1.1C6.7 7.2 5 9.4 5 12v5l-1 1v1h16v-1l-1-1v-5c0-2.6-1.7-4.8-4-5.9V5c0-1.7-1.3-3-3-3zm0 20c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2z"\n />\n </svg>\n <span class="badge" id="notifBadge">0</span>\n</button>\n '}static insertTemplate(e="afterbegin"){document.body.insertAdjacentHTML(e,U.getTemplate())}#b;#w;#v;#E;#T;#x=0;#S=99;#C=300;#L=!1;#A=new WeakMap;#_(e){if(this.#A.delete(e),!(e instanceof HTMLElement))throw new Error("Invalid HTMLElement to clear.");e.classList.add("removing"),setTimeout(()=>{this.markAsRead(e),e.remove()},this.#C)}#D(e){this.#x=Math.max(0,e),this.#v.setAttribute("data-value",String(this.#x)),this.#v.textContent=this.#x>this.#S?`${this.#S}+`:String(this.#x)}constructor(e={}){const{center:t=document.getElementById("notifCenter"),badge:r=document.getElementById("notifBadge"),button:n=document.querySelector(".notify-bell"),overlay:o=document.querySelector(".notify-overlay")}=e;if(!(t instanceof HTMLElement))throw new Error(`NotificationCenter: "center" must be an HTMLElement. Got: ${t}`);if(!(o instanceof HTMLElement))throw new Error(`NotificationCenter: "overlay" must be an HTMLElement. Got: ${o}`);if(!(r instanceof HTMLElement))throw new Error(`NotificationCenter: "badge" must be an HTMLElement. Got: ${r}`);if(!(n instanceof HTMLElement))throw new Error(`NotificationCenter: "button" must be an HTMLElement. Got: ${n}`);const i=t?.querySelector(".clear-all"),s=t?.querySelector(".list")??null;if(!(s instanceof HTMLElement))throw new Error(`NotificationCenter: ".list" inside center must be an HTMLElement. Got: ${s}`);this.#b=t,this.#w=s,this.#v=r,this.#E=n,this.#T=o,this.#E.addEventListener("click",()=>this.toggle()),this.#b.querySelector(".close")?.addEventListener("click",()=>this.close()),i&&i.addEventListener("click",()=>this.clear()),this.#T.addEventListener("click",e=>{e.target===this.#T&&this.close()})}setMarkAllAsReadOnClose(e){if("boolean"!=typeof e)throw new TypeError("Expected boolean for markAllAsReadOnClose, got "+typeof e);this.#L=e}setRemoveDelay(e){if("number"!=typeof e)throw new Error('NotificationCenter: "ms" must be an number.');this.#C=e}getItemMode(e){const t=this.getItem(e);return t?this.#A.get(t):null}getItem(e){const t=this.#w.children.item(e);if(!(t instanceof HTMLElement))throw new Error(`NotificationCenter: "item" must be an HTMLElement. Got: ${t}`);return t}hasItem(e){return e>=0&&e<this.#w.children.length}markAsRead(e){const t=e instanceof HTMLElement?e:this.getItem(e);t.classList.contains("unread")&&(t.classList.remove("unread"),this.#D(this.#x-1))}add(e,t="text"){const r=document.createElement("div");r.className="item unread";let n=null,o=null,i=null,s=null;if("object"==typeof e&&null!==e?(n=e.title,o=e.message,i=e.avatar,s=e.onClick):o=e,i){const e=document.createElement("div");e.className="avatar",e.style.backgroundImage=`url("${i}")`,r.appendChild(e)}const a=document.createElement("div");if(a.className="content",n){const e=document.createElement("div");e.className="title",e.textContent=n,a.appendChild(e)}const l=document.createElement("div");l.className="message","html"===t?l.innerHTML=o:l.textContent=o,a.appendChild(l),"function"==typeof s&&(r.classList.add("clickable"),r.addEventListener("click",e=>{e.target instanceof HTMLElement&&!e.target.closest(".notify-close")&&s(e)}));const u=document.createElement("button");u.className="notify-close",u.setAttribute("type","button"),u.innerHTML="×",u.addEventListener("click",e=>{e.stopPropagation(),this.#_(r)}),r.append(a,u),this.#w.prepend(r),this.#A.set(r,t),this.#D(this.#x+1)}remove(e){const t=this.getItem(e);this.#_(t)}clear(){let e=!0;for(;e;){e=!1;const t=Array.from(this.#w.children);for(const r of t)r instanceof HTMLElement&&!r.classList.contains("removing")&&(this.#_(r),e=!0)}}open(){this.#T.classList.remove("hidden"),this.#b.classList.add("open")}close(){if(this.#T.classList.add("hidden"),this.#b.classList.remove("open"),this.#L){const e=this.#w.querySelectorAll(".item.unread");for(const t of e)t instanceof HTMLElement&&this.markAsRead(t)}}toggle(){this.#b.classList.contains("open")?this.close():this.open()}recount(){const e=this.#w.querySelectorAll(".item.unread").length;this.#D(e)}get count(){return this.#x}destroy(){this.#E?.removeEventListener("click",this.toggle),this.#b?.querySelector(".close")?.removeEventListener("click",this.close),this.#b?.querySelector(".clear-all")?.removeEventListener("click",this.clear),this.#T?.removeEventListener("click",this.close),this.clear(),this.#b?.remove(),this.#T?.remove(),this.#E?.remove(),this.#x=0,this.#A=new WeakMap}}const V=U,J=class{#k;#M;#I;#N;#B;#j;constructor(e="top",t="right",r=3e3,n=50,o=300,i=".notify-container"){this.#R(e),this.#O(t),this.#P(r,"baseDuration"),this.#P(n,"extraPerChar"),this.#P(o,"fadeOutDuration"),this.#k=e,this.#M=t,this.#I=r,this.#N=n,this.#B=o;const s=document.querySelector(`${i}.${e}.${t}`);s instanceof HTMLElement?this.#j=s:(this.#j=document.createElement("div"),this.#j.className=`notify-container ${e} ${t}`,document.body.appendChild(this.#j))}getContainer(){if(!(this.#j instanceof HTMLElement))throw new Error("Container is not a valid HTMLElement.");return this.#j}#R(e){if(!["top","bottom"].includes(e))throw new Error(`Invalid vertical direction "${e}". Expected "top" or "bottom".`)}#O(e){if(!["left","right","center"].includes(e))throw new Error(`Invalid horizontal position "${e}". Expected "left", "right" or "center".`)}#P(e,t){if("number"!=typeof e||e<0||!Number.isFinite(e))throw new Error(`Invalid value for "${t}": ${e}. Must be a non-negative finite number.`)}getY(){return this.#k}setY(e){this.#R(e);const t=this.getContainer();t.classList.remove(this.#k),t.classList.add(e),this.#k=e}getX(){return this.#M}setX(e){this.#O(e);const t=this.getContainer();t.classList.remove(this.#M),t.classList.add(e),this.#M=e}getBaseDuration(){return this.#I}setBaseDuration(e){this.#P(e,"baseDuration"),this.#I=e}getExtraPerChar(){return this.#N}setExtraPerChar(e){this.#P(e,"extraPerChar"),this.#N=e}getFadeOutDuration(){return this.#B}setFadeOutDuration(e){this.#P(e,"fadeOutDuration"),this.#B=e}show(e){let t="",r="",n=null,o=!1,i=null;const s=document.createElement("div");if(s.className="notify enter","string"==typeof e)t=e;else{if("object"!=typeof e||null===e||"string"!=typeof e.message)throw new Error("Invalid argument for show(): expected string or { message: string, title?: string, onClick?: function, html?: boolean, avatar?: string }");if(t=e.message,r="string"==typeof e.title?e.title:"",o=!0===e.html,i="string"==typeof e.avatar?e.avatar:null,void 0!==e.onClick){if("function"!=typeof e.onClick)throw new Error("onClick must be a function if defined");n=e.onClick,s.classList.add("clickable")}}const a=document.createElement("button");if(a.innerHTML="×",a.className="close",a.setAttribute("aria-label","Close"),a.addEventListener("mouseenter",()=>{a.style.color="var(--notif-close-color-hover)"}),a.addEventListener("mouseleave",()=>{a.style.color="var(--notif-close-color)"}),i){const e=document.createElement("img");e.src=i,e.alt="avatar",e.className="avatar",s.appendChild(e)}if(r){const e=document.createElement("strong");e.textContent=r,e.style.display="block",s.appendChild(e)}if(o){const e=document.createElement("div");e.innerHTML=t,s.appendChild(e)}else s.appendChild(document.createTextNode(t));s.appendChild(a),this.getContainer().appendChild(s);const l=this.#I+t.length*this.#N+this.#B;let u=!1;const c=()=>{u||(u=!0,s.classList.remove("enter","show"),s.classList.add("exit"),setTimeout(()=>s.remove(),this.#B))};"function"==typeof n&&s.addEventListener("click",e=>{e.target!==a&&n(e,c)}),a.addEventListener("click",e=>{e.stopPropagation(),c()}),setTimeout(()=>{s.classList.remove("enter"),s.classList.add("show")},1),setTimeout(()=>c(),l)}destroy(){this.#j instanceof HTMLElement&&(this.#j.querySelectorAll(".notify").forEach(e=>e.remove()),this.#j.parentNode&&this.#j.parentNode.removeChild(this.#j),this.#j=null)}};function z(e,t){return new Promise((r,n)=>{const o=new FileReader;o.onload=()=>{try{r(o.result)}catch(e){n(e)}},o.onerror=()=>{n(o.error)},o[t](e)})}function q(e,t=!1){return new Promise((r,n)=>{"string"!=typeof t&&"boolean"!=typeof t&&n(new TypeError("The isDataUrl parameter must be a boolean or a string.")),z(e,"readAsDataURL").then(e=>{if("string"!=typeof e)throw new TypeError("Expected file content to be a string.");const n=e.match(/^data:(.+);base64,(.*)$/);if(!n||!n[2])throw new Error("Invalid data URL format or missing Base64 content.");const[,o,i]=n;if(!/^[\w/+]+=*$/.test(i))throw new Error("Base64 content is malformed.");if("boolean"==typeof t)return r(t?e:i);if(!/^[\w-]+\/[\w.+-]+$/.test(t))throw new Error(`Invalid MIME type string: ${t}`);return r(`data:${t};base64,${i}`)}).catch(n)})}function G(e){return new Promise((t,r)=>z(e,"readAsText").then(e=>{if("string"!=typeof e)throw new TypeError("Expected file content to be a string.");const r=e.trim();if(0===r.length)throw new Error("File is empty or contains only whitespace.");const n=JSON.parse(r);if("object"!=typeof n||null===n)throw new Error("Parsed content is not a valid JSON object or array.");t(n)}).catch(r))}function Y(e,t,r=2){const n=JSON.stringify(t,null,r),o=new Blob([n],{type:"application/json"}),i=URL.createObjectURL(o),s=document.createElement("a");s.href=i,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i)}async function X(e,t){return new Promise((r,n)=>{(async function(e,{method:t="GET",body:r,timeout:n=0,retries:o=0,headers:i={},signal:s=null}={}){if("string"!=typeof e||!e.startsWith("../")&&!e.startsWith("./")&&!e.startsWith("/")&&!e.startsWith("https://")&&!e.startsWith("http://"))throw new Error("Invalid URL: must be a valid http or https address.");if("string"!=typeof t||!t.trim())throw new Error("Invalid method: must be a non-empty string.");if(!s){if("number"!=typeof n||!Number.isFinite(n)||Number.isNaN(n)||n<0)throw new Error("Invalid timeout: must be a positive number.");if("number"!=typeof o||!Number.isFinite(o)||Number.isNaN(o)||o<0)throw new Error("Invalid retries: must be a positive number.")}const a=s?1:o+1;let l=null;for(let u=0;u<a;u++){const a=s?null:new AbortController,c=s||(a?.signal??null),h=!s&&n&&a?setTimeout(()=>a.abort(),n):null;try{const n=await fetch(e,{method:t.toUpperCase(),headers:{Accept:"application/json",...i},body:void 0!==r?f(r)?JSON.stringify(r):r:void 0,signal:c});if(h&&clearTimeout(h),!n.ok)throw new Error(`HTTP error: ${n.status} ${n.statusText}`);return n}catch(e){if(l=e,s)break;u<o&&await new Promise(e=>setTimeout(e,300*(u+1)))}}throw new Error(`Failed to fetch JSON from "${e}"${l?`: ${l.message}`:"."}`)})(e,t).then(async e=>{const t=e.headers.get("content-type")||"";if(!t.includes("application/json"))throw new Error(`Unexpected content-type: ${t}`);const n=await e.json();if(!Array.isArray(n)&&!f(n))throw new Error("Received invalid data instead of valid JSON.");return r(n)}).catch(n)})}function K({element:e=document.body,hiddenClass:t="windowHidden",visibleClass:r="windowVisible",onVisible:n,onHidden:o}={}){if(!(e instanceof Element))throw new TypeError('"element" must be an instance of Element.');if("string"!=typeof t)throw new TypeError('"hiddenClass" must be a string.');if("string"!=typeof r)throw new TypeError('"visibleClass" must be a string.');if(void 0!==n&&"function"!=typeof n)throw new TypeError('"onVisible" must be a function if provided.');if(void 0!==o&&"function"!=typeof o)throw new TypeError('"onHidden" must be a function if provided.');let i="",s="";const a=()=>{e.classList.remove(t),e.classList.remove(r)};let l=null;const u=["visibilitychange","mozvisibilitychange","webkitvisibilitychange","msvisibilitychange"],c=["hidden","mozHidden","webkitHidden","msHidden"];for(let e=0;e<c.length;e++)if(c[e]in document){l=c[e];break}const h=function(u){a();const c=u?.type,h=l&&document[l];["focus","focusin","pageshow"].includes(c)?(e.classList.add(r),n?.({type:c,oldClass:s,oldType:i}),s=r):["blur","focusout","pagehide"].includes(c)||h?(e.classList.add(t),o?.({type:c,oldClass:s,oldType:i}),s=t):(e.classList.add(r),n?.({type:c,oldClass:s,oldType:i}),s=r),i=c};let d=()=>{};if(l){const e=u[c.indexOf(l)];document.addEventListener(e,h),window.addEventListener("focus",h),window.addEventListener("blur",h),d=()=>{document.removeEventListener(e,h),window.removeEventListener("focus",h),window.removeEventListener("blur",h),a()}}else"onfocusin"in document?(document.onfocusin=document.onfocusout=h,d=()=>{document.onfocusin=document.onfocusout=null,a()}):(window.onpageshow=window.onpagehide=window.onfocus=window.onblur=h,d=()=>{window.onpageshow=window.onpagehide=window.onfocus=window.onblur=null,a()});const f=new Event(l&&document[l]?"blur":"focus");return h(f),d}const Q=(e,t)=>e.bottom<t.top,Z=(e,t)=>e.top>t.bottom,ee=(e,t)=>e.right<t.left,te=(e,t)=>e.left>t.right,re=(e,t)=>e.bottom<=t.top,ne=(e,t)=>e.top>=t.bottom,oe=(e,t)=>e.right<=t.left,ie=(e,t)=>e.left>=t.right,se=(e,t)=>!(ee(e,t)||te(e,t)||Q(e,t)||Z(e,t)),ae=(e,t)=>!(oe(e,t)||ie(e,t)||re(e,t)||ne(e,t)),le=(e,t)=>ee(e,t)?"left":te(e,t)?"right":Q(e,t)?"top":Z(e,t)?"bottom":null,ue=(e,t)=>oe(e,t)?"left":ie(e,t)?"right":re(e,t)?"top":ne(e,t)?"bottom":null,ce=(e,t)=>({overlapLeft:t.right-e.left,overlapRight:e.right-t.left,overlapTop:t.bottom-e.top,overlapBottom:e.bottom-t.top}),he=({overlapLeft:e=-1,overlapRight:t=-1,overlapTop:r=-1,overlapBottom:n=-1}={})=>({dirX:e<t?"right":"left",dirY:r<n?"bottom":"top"}),de=e=>({x:e.left+e.width/2,y:e.top+e.height/2});function fe(e,t){const r=e.left+e.width/2,n=e.top+e.height/2;return{x:t.left+t.width/2-r,y:t.top+t.height/2-n}}function me(e,t){if(!ae(e,t))return{inDir:null,dirX:null,dirY:null,depthX:0,depthY:0};const{overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}=ce(e,t),{dirX:s,dirY:a}=he({overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}),l=Math.min(r,n),u=Math.min(o,i);let c;return c=l<u?s:a,{inDir:c,dirX:s,dirY:a,depthX:l,depthY:u}}function ge(e,t){const r=ae(e,t),n={in:null,x:null,y:null},o={y:null,x:null},i={top:0,bottom:0,left:0,right:0},{overlapLeft:s,overlapRight:a,overlapTop:l,overlapBottom:u}=ce(t,e);i.top=l,i.bottom=u,i.left=s,i.right=a;const c=Object.entries(i).filter(([,e])=>e>0).sort((e,t)=>e[1]-t[1]),{dirX:h,dirY:d}=he({overlapLeft:a,overlapRight:s,overlapTop:u,overlapBottom:l});return n.y=d,n.x=h,i.bottom<0?o.y="bottom":i.top<0&&(o.y="top"),i.left<0?o.x="left":i.right<0&&(o.x="right"),n.in=r?i.top===i.bottom&&i.bottom===i.left&&i.left===i.right?"center":c.length?c[0][0]:"top":null,{dirs:n,depth:i,isNeg:o}}const{areElsColliding:pe,areElsPerfColliding:ye,areElsCollTop:be,areElsCollBottom:we,areElsCollLeft:ve,areElsCollRight:Ee}=e,Te=new WeakMap,xe=new WeakMap,Se={top:new WeakMap,bottom:new WeakMap,left:new WeakMap,right:new WeakMap};class Ce{static Utils={...e};static createElement(e,t){if("string"!=typeof e)throw new TypeError("[TinyHtml] createElement(): The tagName must be a string.");if(void 0!==t&&"object"!=typeof t)throw new TypeError("[TinyHtml] createElement(): The ops must be a object.");return new Ce(document.createElement(e,t))}static createTextNode(e){if("string"!=typeof e)throw new TypeError("[TinyHtml] createTextNode(): The value must be a string.");return new Ce(document.createTextNode(e))}static createElementFromHTML(e){const t=document.createElement("template");if(!(e=e.trim()).startsWith("<"))return Ce.createTextNode(e);if(t.innerHTML=e,!(t.content.firstChild instanceof Element))throw new Error("");return new Ce(t.content.firstChild)}static query(e,t=document){const r=t.querySelector(e);return r?new Ce(r):null}querySelector(e){return Ce.query(e,Ce._preElem(this,"query"))}static queryAll(e,t=document){const r=t.querySelectorAll(e);return Ce.toTinyElm([...r])}querySelectorAll(e){return Ce.queryAll(e,Ce._preElem(this,"queryAll"))}static getById(e){const t=document.getElementById(e);return t?new Ce(t):null}static getByClassName(e,t=document){const r=t.getElementsByClassName(e);return Ce.toTinyElm([...r])}getElementsByClassName(e){return Ce.getByClassName(e,Ce._preElem(this,"getByClassName"))}static getByName(e){const t=document.getElementsByName(e);return Ce.toTinyElm([...t])}static getByTagNameNS(e,t="http://www.w3.org/1999/xhtml",r=document){const n=r.getElementsByTagNameNS(t,e);return Ce.toTinyElm([...n])}getElementsByTagNameNS(e,t="http://www.w3.org/1999/xhtml"){return Ce.getByTagNameNS(e,t,Ce._preElem(this,"getByTagNameNS"))}get(){return this.#H}_getElement(e){if(!(this.#H instanceof Element||this.#H instanceof Window||this.#H instanceof Document))throw new Error(`[TinyHtml] Invalid Element in ${e}().`);return this.#H}static _preElemsTemplate(e,t,r,n){const o=e=>e.map(e=>{const o=e instanceof Ce?e._getElement(t):e;let i=!1;for(const e of r)if(o instanceof e){i=!0;break}if(!i)throw new Error(`[TinyHtml] Invalid element of the list "${n.join(",")}" in ${t}().`);return o});return Array.isArray(e)?o(e):o([e])}static _preElemTemplate(e,t,r,n,o=!1){const i=e=>{const i=e[0];let s=i instanceof Ce?i._getElement(t):i,a=!1;for(const e of r)if(s instanceof e){a=!0;break}if(o&&null==s&&(s=null,a=!0),!a)throw new Error(`[TinyHtml] Invalid element of the list "${n.join(",")}" in ${t}().`);return s};if(!Array.isArray(e))return i([e]);if(e.length>1)throw new Error(`[TinyHtml] Invalid element amount in ${t}() (Received ${e.length}/1).`);return i(e)}static _preElems(e,t){return Ce._preElemsTemplate(e,t,[Element],["Element"])}static _preElem(e,t){return Ce._preElemTemplate(e,t,[Element],["Element"])}static _preNodeElems(e,t){return Ce._preElemsTemplate(e,t,[Node],["Node"])}static _preNodeElem(e,t){return Ce._preElemTemplate(e,t,[Node],["Node"])}static _preNodeElemWithNull(e,t){return Ce._preElemTemplate(e,t,[Node],["Node"],!0)}static _preHtmlElems(e,t){return Ce._preElemsTemplate(e,t,[HTMLElement],["HTMLElement"])}static _preHtmlElem(e,t){return Ce._preElemTemplate(e,t,[HTMLElement],["HTMLElement"])}static _preInputElems(e,t){return Ce._preElemsTemplate(e,t,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}static _preInputElem(e,t){return Ce._preElemTemplate(e,t,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}static _preEventTargetElems(e,t){return Ce._preElemsTemplate(e,t,[EventTarget],["EventTarget"])}static _preEventTargetElem(e,t){return Ce._preElemTemplate(e,t,[EventTarget],["EventTarget"])}static _preElemsAndWindow(e,t){return Ce._preElemsTemplate(e,t,[Element,Window],["Element","Window"])}static _preElemAndWindow(e,t){return Ce._preElemTemplate(e,t,[Element,Window],["Element","Window"])}static _preElemsAndWinAndDoc(e,t){return Ce._preElemsTemplate(e,t,[Element,Window,Document],["Element","Window","Document"]).map(e=>e instanceof Document?e.documentElement:e)}static _preElemAndWinAndDoc(e,t){const r=Ce._preElemTemplate(e,t,[Element,Window,Document],["Element","Window","Document"]);return r instanceof Document?r.documentElement:r}static _preElemsWithDoc(e,t){return Ce._preElemsTemplate(e,t,[Element,Document],["Element","Document"])}static _preElemWithDoc(e,t){return Ce._preElemTemplate(e,t,[Element,Document],["Element","Document"])}static toTinyElm(e){const t=e=>e.map(e=>e instanceof Ce?e:new Ce(e));return Array.isArray(e)?t(e):t([e])}static fromTinyElm(e){const t=e=>e.map(e=>e instanceof Ce?e._getElement("fromTinyElm"):e);return Array.isArray(e)?t(e):t([e])}static winnow(e,t,r,n=!1){if("boolean"!=typeof n)throw new TypeError('The "not" must be a boolean.');if("function"==typeof t)return Ce._preElems(e,r).filter((e,r)=>!!t.call(e,r,e)!==n);if(t instanceof Element)return Ce._preElems(e,r).filter(e=>e===t!==n);if(Array.isArray(t)||"string"!=typeof t&&null!=t.length)return Ce._preElems(e,r).filter(e=>t.includes(e)!==n);let o=t;return n&&(o=`:not(${o})`),Ce._preElems(e,r).filter(e=>1===e.nodeType&&e.matches(o))}static filter(e,t,r=!1){return r&&(t=`:not(${t})`),Ce._preElems(e,"filter").filter(e=>1===e.nodeType&&e.matches(t))}static filterOnly(e,t){return Ce.winnow(e,t,"filterOnly",!1)}static not(e,t){return Ce.winnow(e,t,"not",!0)}not(e){return Ce.not(this,e)}static find(e,t){const r=[];for(const n of Ce._preElems(e,"find"))r.push(...n.querySelectorAll(t));return[...new Set(r)]}find(e){return Ce.find(this,e)}static is(e,t){return Ce.winnow(e,t,"is",!1).length>0}is(e){return Ce.is(this,e)}static has(e,t){const r="string"==typeof t?[...document.querySelectorAll(t)]:Ce._preElems(t,"has");return Ce._preElems(e,"has").filter(e=>r.some(t=>e&&e.contains(t)))}has(e){return Ce.has(this,e).length>0}static closest(e,t,r){const n=[];for(const o of Ce._preElems(e,"closest")){let e=o;for(;e&&e!==r;){if(1===e.nodeType&&("string"==typeof t?e.matches(t):e===t)){n.push(e);break}e=e.parentElement}}return[...new Set(n)]}closest(e,t){return Ce.closest(this,e,t)}static isSameDom(e,t){return Ce._preNodeElem(e,"isSameDom")===Ce._preNodeElem(t,"isSameDom")}isSameDom(e){return Ce.isSameDom(this,e)}_data={};static _dataSelector={public:(e,t)=>{const r=Ce._preElem(t,e);let n=xe.get(r);return n||(n={},xe.set(r,n)),n},private:(e,t)=>{if(!(t instanceof Ce))throw new Error(`Element must be a TinyHtml instance to execute ${e}().`);return t._data}};static data(e,t,r=!1){const n=Ce._dataSelector[r?"private":"public"]("data",e);if(null==t)return{...n};if("string"!=typeof t)throw new TypeError("The key must be a string.");return n.hasOwnProperty(t)?n[t]:void 0}data(e,t){return Ce.data(this,e,t)}static setData(e,t,r,n=!1){const o=Ce._dataSelector[n?"private":"public"]("setData",e);if("string"!=typeof t)throw new TypeError("The key must be a string.");return o[t]=r,e}setData(e,t,r=!1){return Ce.setData(this,e,t,r)}static _getSibling(e,t,r){let n=Ce._preNodeElemWithNull(e,r);for(;n&&(n=n[t])&&1!==n.nodeType;);return n instanceof Node?n:null}static _getSiblings(e,t){let r=e;const n=[];for(;r;r=r.nextSibling)1===r.nodeType&&r!==t&&n.push(r);return n}static domDir(e,t,r,n="domDir"){if("string"!=typeof t)throw new TypeError('The "direction" must be a string.');let o=Ce._preNodeElemWithNull(e,n);const i=[];for(;o&&(o=o[t]);)if(1===o.nodeType){if(r&&("string"==typeof r?o.matches(r):o===r))break;i.push(o)}return i}static parent(e){let t=Ce._preNodeElemWithNull(e,"parent");const r=t?t.parentNode:null;return r&&11!==r.nodeType?r:null}parent(){return Ce.parent(this)}static parents(e,t){return Ce.domDir(e,"parentNode",t,"parents")}parents(e){return Ce.parents(this,e)}static next(e){return Ce._getSibling(e,"nextSibling","next")}next(){return Ce.next(this)}static prev(e){return Ce._getSibling(e,"previousSibling","prev")}prev(){return Ce.prev(this)}static nextAll(e){return Ce.domDir(e,"nextSibling",void 0,"nextAll")}nextAll(){return Ce.nextAll(this)}static prevAll(e){return Ce.domDir(e,"previousSibling",void 0,"prevAll")}prevAll(){return Ce.prevAll(this)}static nextUntil(e,t){return Ce.domDir(e,"nextSibling",t,"nextUtil")}nextUntil(e){return Ce.nextUntil(this,e)}static prevUntil(e,t){return Ce.domDir(e,"previousSibling",t,"prevUtil")}prevUntil(e){return Ce.prevUntil(this,e)}static siblings(e){const t=Ce._preNodeElemWithNull(e,"siblings");return Ce._getSiblings(t&&t.parentNode?t.parentNode.firstChild:null,t)}siblings(){return Ce.siblings(this)}static children(e){const t=Ce._preNodeElemWithNull(e,"children");return Ce._getSiblings(t?t.firstChild:null)}children(){return Ce.children(this)}static contents(e){const t=Ce._preNodeElemWithNull(e,"contents");return t instanceof HTMLIFrameElement&&null!=t.contentDocument&&Object.getPrototypeOf(t.contentDocument)?[t.contentDocument]:t instanceof HTMLTemplateElement?Array.from((t.content||t).childNodes):t?Array.from(t.childNodes):[]}contents(){return Ce.contents(this)}static clone(e,t=!0){if("boolean"!=typeof t)throw new TypeError('The "deep" must be a boolean.');return Ce._preNodeElems(e,"clone").map(e=>e.cloneNode(t))}clone(e){return Ce.clone(this,e)[0]}static _appendChecker(e,...t){const r=[],n=[...t];for(const t in n)"string"!=typeof n[t]?r.push(Ce._preNodeElem(n[t],e)):r.push(n[t]);return r}static append(e,...t){return Ce._preElem(e,"append").append(...Ce._appendChecker("append",...t)),e}append(...e){return Ce.append(this,...e)}static prepend(e,...t){return Ce._preElem(e,"prepend").prepend(...Ce._appendChecker("prepend",...t)),e}prepend(...e){return Ce.prepend(this,...e)}static before(e,...t){return Ce._preElem(e,"before").before(...Ce._appendChecker("before",...t)),e}before(...e){return Ce.before(this,...e)}static after(e,...t){return Ce._preElem(e,"after").after(...Ce._appendChecker("after",...t)),e}after(...e){return Ce.after(this,...e)}static replaceWith(e,...t){return Ce._preElem(e,"replaceWith").replaceWith(...Ce._appendChecker("replaceWith",...t)),e}replaceWith(...e){return Ce.replaceWith(this,...e)}static appendTo(e,t){const r=Ce._preNodeElems(e,"appendTo"),n=Ce._preNodeElems(t,"appendTo");return n.forEach((e,t)=>{r.forEach(r=>e.appendChild(t===n.length-1?r:r.cloneNode(!0)))}),e}appendTo(e){return Ce.appendTo(this,e)}static prependTo(e,t){const r=Ce._preElems(e,"prependTo"),n=Ce._preElems(t,"prependTo");return n.forEach((e,t)=>{r.slice().reverse().forEach(r=>e.prepend(t===n.length-1?r:r.cloneNode(!0)))}),e}prependTo(e){return Ce.prependTo(this,e)}static insertBefore(e,t,r=null){const n=Ce._preNodeElem(e,"insertBefore"),o=Ce._preNodeElem(t,"insertBefore"),i=Ce._preNodeElemWithNull(r,"insertBefore");if(!o.parentNode)throw new Error("");return o.parentNode.insertBefore(n,i||o),e}insertBefore(e,t){return Ce.insertBefore(this,e,t)}static insertAfter(e,t,r=null){const n=Ce._preNodeElem(e,"insertAfter"),o=Ce._preNodeElem(t,"insertBefore"),i=Ce._preNodeElemWithNull(r,"insertBefore");if(!o.parentNode)throw new Error("");return o.parentNode.insertBefore(n,i||o.nextSibling),e}insertAfter(e,t){return Ce.insertAfter(this,e,t)}static replaceAll(e,t){const r=Ce._preNodeElems(e,"replaceAll"),n=Ce._preNodeElems(t,"replaceAll");return n.forEach((e,t)=>{const o=e.parentNode;r.forEach(r=>{o&&o.replaceChild(t===n.length-1?r:r.cloneNode(!0),e)})}),e}replaceAll(e){return Ce.replaceAll(this,e)}#H;constructor(e){if(e instanceof Ce)throw new Error("[TinyHtml] You are trying to put a TinyHtml inside another TinyHtml in constructor.");if(!(e instanceof Element||e instanceof Window||e instanceof Document||e instanceof Text))throw new Error("[TinyHtml] Invalid Target in constructor.");this.#H=e}static isWindow(e){return null!=e&&e===e.window}static css(e){const t=Ce._preElem(e,"css");return window.getComputedStyle(t)}css(){return Ce.css(this)}static cssString(e,t){const r=Ce._preElem(e,"cssString");if("string"!=typeof t)throw new TypeError("The prop must be a string.");const n=window.getComputedStyle(r)[t];return"string"==typeof n?n:"number"==typeof n?n.toString():null}cssString(e){return Ce.cssString(this,e)}static cssList(e,t){const r=Ce._preElem(e,"cssList");if(!Array.isArray(t))throw new TypeError("The prop must be an array of strings.");const n=window.getComputedStyle(r),o={};for(const e of t)void 0!==e&&(o[e]=n.getPropertyValue(e));return o}cssList(e){return Ce.cssList(this,e)}static cssFloat(e,t){const r=Ce._preElem(e,"cssFloat");if("string"!=typeof t)throw new TypeError("The prop must be a string.");const n=window.getComputedStyle(r)[t];return parseFloat(n)||0}cssFloat(e){return Ce.cssFloat(this,e)}static cssFloats(e,t){const r=Ce._preElem(e,"cssFloats");if(!Array.isArray(t))throw new TypeError("The prop must be an array of strings.");const n=window.getComputedStyle(r),o={};for(const e of t)o[e]=parseFloat(n[e])||0;return o}cssFloats(e){return Ce.cssFloats(this,e)}static#W={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(Ce.#W,{set:(e,t,r)=>(e[t]=r,Ce.cssPropRevAliases[r]=t,!0)});static cssPropRevAliases=Object.fromEntries(Object.entries(Ce.#W).map(([e,t])=>[t,e]));static toStyleKc(e){return"string"==typeof Ce.cssPropAliases[e]?Ce.cssPropAliases[e]:e}static toStyleCc(e){return"string"==typeof Ce.cssPropRevAliases[e]?Ce.cssPropRevAliases[e]:e}static setStyle(e,t,r=null){return Ce._preHtmlElems(e,"setStyle").forEach(e=>{if("object"==typeof t)for(const[r,n]of Object.entries(t))e.style.setProperty(Ce.toStyleKc(r),"string"==typeof n?n:"number"==typeof n?`${n}px`:String(n));else e.style.setProperty(Ce.toStyleKc(t),r)}),e}setStyle(e,t){return Ce.setStyle(this,e,t)}static getStyle(e,t){return Ce._preHtmlElem(e,"getStyle").style.getPropertyValue(Ce.toStyleKc(t))}getStyle(e){return Ce.getStyle(this,e)}static style(e,{camelCase:t=!1,rawAttr:r=!1}={}){if("boolean"!=typeof t)throw new TypeError('"camelCase" must be a boolean. Received: '+typeof t);if("boolean"!=typeof r)throw new TypeError('"rawAttr" must be a boolean. Received: '+typeof r);const n=Ce._preHtmlElem(e,"style"),o={};if(r){const e=(n.getAttribute("style")||"").split(";");for(const r of e){const[e,n]=r.split(":");if(!e||!n)continue;const i=e.trim(),s=n.trim();o[t?Ce.toStyleCc(i):i]=s}}else{const e=n.style;for(let r=0;r<e.length;r++){const n=e[r],i=e.getPropertyValue(n);o[t?Ce.toStyleCc(n):n]=i}}return o}style(e){return Ce.style(this,e)}static removeStyle(e,t){return Ce._preHtmlElems(e,"removeStyle").forEach(e=>{if(Array.isArray(t))for(const r of t)e.style.removeProperty(Ce.toStyleKc(r));else e.style.removeProperty(Ce.toStyleKc(t))}),e}removeStyle(e){return Ce.removeStyle(this,e)}static toggleStyle(e,t,r,n){return Ce._preHtmlElems(e,"toggleStyle").forEach(e=>{const o=Ce.getStyle(e,t).trim()===Ce.toStyleKc(r)?n:r;Ce.setStyle(e,t,o)}),e}toggleStyle(e,t,r){return Ce.toggleStyle(this,e,t,r)}static clearStyle(e){return Ce._preElems(e,"clearStyle").forEach(e=>e.removeAttribute("style")),e}clearStyle(){return Ce.clearStyle(this)}static focus(e){return Ce._preHtmlElem(e,"focus").focus(),e}focus(){return Ce.focus(this)}static blur(e){return Ce._preHtmlElem(e,"blur").blur(),e}blur(){return Ce.blur(this)}static boolCheck(e){return void 0!==e&&("true"===e||"1"===e||!0===e||"on"===e||"number"==typeof e&&e>0)}static setWinScrollTop(e){if("number"!=typeof e)throw new TypeError("The value must be a number.");Ce.setScrollTop(window,e)}static setWinScrollLeft(e){if("number"!=typeof e)throw new TypeError("The value must be a number.");Ce.setScrollLeft(window,e)}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(e,t,r="content"){const n=Ce._preElemAndWinAndDoc(e,"getDimension");if("string"!=typeof t)throw new TypeError("The type must be a string.");if("string"!=typeof r)throw new TypeError("The extra must be a string.");const o="width"===t?"Width":"Height";if(Ce.isWindow(n))return"margin"===r?n["inner"+o]:n.document.documentElement["client"+o];const i=n;if(9===i.nodeType){const e=i.documentElement;return Math.max(i.body["scroll"+o],e["scroll"+o],i.body["offset"+o],e["offset"+o],e["client"+o])}let s=i.getBoundingClientRect()[t];function a(e){return"width"===t?Ce.cssFloat(i,e+"Left")+Ce.cssFloat(i,e+"Right"):Ce.cssFloat(i,e+"Top")+Ce.cssFloat(i,e+"Bottom")}switch(r){case"content":s-=a("padding"),s-=a("border");break;case"padding":s-=a("border");break;case"border":break;case"margin":s+=a("margin")}return s}getDimension(e,t){return Ce.getDimension(this,e,t)}static setHeight(e,t){const r=Ce._preHtmlElem(e,"setHeight");if("number"!=typeof t&&"string"!=typeof t)throw new TypeError("The value must be a string or number.");return r.style.height="number"==typeof t?`${t}px`:t,e}setHeight(e){return Ce.setHeight(this,e)}static setWidth(e,t){const r=Ce._preHtmlElem(e,"setWidth");if("number"!=typeof t&&"string"!=typeof t)throw new TypeError("The value must be a string or number.");return r.style.width="number"==typeof t?`${t}px`:t,e}setWidth(e){return Ce.setWidth(this,e)}static height(e){const t=Ce._preElemAndWinAndDoc(e,"height");return Ce.getDimension(t,"height","content")}height(){return Ce.height(this)}static width(e){const t=Ce._preElemAndWinAndDoc(e,"width");return Ce.getDimension(t,"width","content")}width(){return Ce.width(this)}static innerHeight(e){const t=Ce._preElemAndWinAndDoc(e,"innerHeight");return Ce.getDimension(t,"height","padding")}innerHeight(){return Ce.innerHeight(this)}static innerWidth(e){const t=Ce._preElemAndWinAndDoc(e,"innerWidth");return Ce.getDimension(t,"width","padding")}innerWidth(){return Ce.innerWidth(this)}static outerHeight(e,t=!1){if("boolean"!=typeof t)throw new TypeError('The "includeMargin" must be a boolean.');const r=Ce._preElemAndWinAndDoc(e,"outerHeight");return Ce.getDimension(r,"height",t?"margin":"border")}outerHeight(e){return Ce.outerHeight(this,e)}static outerWidth(e,t=!1){if("boolean"!=typeof t)throw new TypeError('The "includeMargin" must be a boolean.');const r=Ce._preElemAndWinAndDoc(e,"outerWidth");return Ce.getDimension(r,"width",t?"margin":"border")}outerWidth(e){return Ce.outerWidth(this,e)}static animate(e,t,r){return Ce._preElems(e,"animate").forEach(e=>e.animate(t,r)),e}animate(e,t){return Ce.animate(this,e,t)}static offset(e){const t=Ce._preElem(e,"offset").getBoundingClientRect(),r=window.scrollY||document.documentElement.scrollTop,n=window.scrollX||document.documentElement.scrollLeft;return{top:t.top+r,left:t.left+n}}offset(){return Ce.offset(this)}static position(e){const t=Ce._preHtmlElem(e,"position");let r,n,o={top:0,left:0};if("fixed"===window.getComputedStyle(t).position)n=t.getBoundingClientRect();else{n=Ce.offset(t),r=t.offsetParent||document.documentElement;const{position:e}=window.getComputedStyle(r);for(;r instanceof HTMLElement&&(r===document.body||r===document.documentElement)&&"static"===e;)r=r.parentNode;if(r instanceof HTMLElement&&r!==t&&1===r.nodeType){const{borderTopWidth:e,borderLeftWidth:t}=Ce.cssFloats(r,["borderTopWidth","borderLeftWidth"]);o=Ce.offset(r),o.top+=e,o.left+=t}}return{top:n.top-o.top-Ce.cssFloat(t,"marginTop"),left:n.left-o.left-Ce.cssFloat(t,"marginLeft")}}position(){return Ce.position(this)}static offsetParent(e){let t=Ce._preHtmlElem(e,"offsetParent").offsetParent;for(;t instanceof HTMLElement&&"static"===window.getComputedStyle(t).position;)t=t.offsetParent;return t instanceof HTMLElement?t:document.documentElement}offsetParent(){return Ce.offsetParent(this)}static scrollTop(e){const t=Ce._preElemAndWindow(e,"scrollTop");return Ce.isWindow(t)?t.pageYOffset:9===t.nodeType?t.defaultView.pageYOffset:t.scrollTop}scrollTop(){return Ce.scrollTop(this)}static scrollLeft(e){const t=Ce._preElemAndWindow(e,"scrollLeft");return Ce.isWindow(t)?t.pageXOffset:9===t.nodeType?t.defaultView.pageXOffset:t.scrollLeft}scrollLeft(){return Ce.scrollLeft(this)}static easings={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:(4-2*e)*e-1,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1};static scrollToXY(e,{targetX:t,targetY:r,duration:n,easing:o,onAnimation:i}={}){if(void 0!==t&&"number"!=typeof t)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!==n&&"number"!=typeof n)throw new TypeError("`duration` must be a number if provided.");if(void 0!==o&&"string"!=typeof o)throw new TypeError("`easing` must be a string if provided.");if(void 0!==o&&"function"!=typeof Ce.easings[o])throw new TypeError(`Unknown easing function: "${o}".`);if(void 0!==i&&"function"!=typeof i)throw new TypeError("`onAnimation` must be a function if provided.");const s=(e,t,r,n)=>{if(e instanceof Window)window.scrollTo(t,r);else if(9===e.nodeType)e.defaultView.scrollTo(t,r);else{const n=e instanceof Window?window.scrollX:e.scrollLeft,o=e instanceof Window?window.scrollY:e.scrollTop;n!==t&&(e.scrollLeft=t),o!==r&&(e.scrollTop=r)}"function"==typeof i&&i({x:t,y:r,isComplete:n>=1,time:n})};return Ce._preElemsAndWindow(e,"scrollToXY").forEach(e=>{const i=e instanceof Window?window.scrollX:e.scrollLeft,a=e instanceof Window?window.scrollY:e.scrollTop,l=t??i,u=r??a,c=l-i,h=u-a,d="string"==typeof o&&Ce.easings[o]||null;if("number"!=typeof n||"function"!=typeof d)return s(e,l,u,1);const f=performance.now(),m=n??0;requestAnimationFrame(function t(r){if("function"!=typeof d)return;const n=Math.min(1,(r-f)/m),o=d(n);s(e,i+c*o,a+h*o,n),n<1&&requestAnimationFrame(t)})}),e}scrollToXY({targetX:e,targetY:t,duration:r,easing:n,onAnimation:o}={}){return Ce.scrollToXY(this,{targetX:e,targetY:t,duration:r,easing:n,onAnimation:o})}static setScrollTop(e,t){if("number"!=typeof t)throw new TypeError("ScrollTop value must be a number.");return Ce.scrollToXY(e,{targetY:t})}setScrollTop(e){return Ce.setScrollTop(this,e)}static setScrollLeft(e,t){if("number"!=typeof t)throw new TypeError("ScrollLeft value must be a number.");return Ce.scrollToXY(e,{targetX:t})}setScrollLeft(e){return Ce.setScrollLeft(this,e)}static borderWidth(e){const t=Ce._preElem(e,"borderWidth"),{borderLeftWidth:r,borderRightWidth:n,borderTopWidth:o,borderBottomWidth:i}=Ce.cssFloats(t,["borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"]);return{x:r+n,y:o+i,left:r,right:n,top:o,bottom:i}}borderWidth(){return Ce.borderWidth(this)}static border(e){const t=Ce._preElem(e,"border"),{borderLeft:r,borderRight:n,borderTop:o,borderBottom:i}=Ce.cssFloats(t,["borderLeft","borderRight","borderTop","borderBottom"]);return{x:r+n,y:o+i,left:r,right:n,top:o,bottom:i}}border(){return Ce.border(this)}static margin(e){const t=Ce._preElem(e,"margin"),{marginLeft:r,marginRight:n,marginTop:o,marginBottom:i}=Ce.cssFloats(t,["marginLeft","marginRight","marginTop","marginBottom"]);return{x:r+n,y:o+i,left:r,right:n,top:o,bottom:i}}margin(){return Ce.margin(this)}static padding(e){const t=Ce._preElem(e,"padding"),{paddingLeft:r,paddingRight:n,paddingTop:o,paddingBottom:i}=Ce.cssFloats(t,["paddingLeft","paddingRight","paddingTop","paddingBottom"]);return{x:r+n,y:o+i,left:r,right:n,top:o,bottom:i}}padding(){return Ce.padding(this)}static addClass(e,...t){return Ce._preElems(e,"addClass").forEach(e=>e.classList.add(...t)),e}addClass(...e){return Ce.addClass(this,...e)}static removeClass(e,...t){return Ce._preElems(e,"removeClass").forEach(e=>e.classList.remove(...t)),e}removeClass(...e){return Ce.removeClass(this,...e)}static replaceClass(e,t,r){if("string"!=typeof t)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 n=[];return Ce._preElems(e,"replaceClass").forEach(e=>n.push(e.classList.replace(t,r))),n}replaceClass(e,t){return Ce.replaceClass(this,e,t)[0]}static classItem(e,t){const r=Ce._preElem(e,"classItem");if("number"!=typeof t)throw new TypeError('The "index" parameter must be a number.');return r.classList.item(t)}classItem(e){return Ce.classItem(this,e)}static toggleClass(e,t,r){if("string"!=typeof t)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 n=[];return Ce._preElems(e,"toggleClass").forEach(e=>n.push(e.classList.toggle(t,r))),n}toggleClass(e,t){return Ce.toggleClass(this,e,t)[0]}static hasClass(e,t){const r=Ce._preElem(e,"hasClass");if("string"!=typeof t)throw new TypeError('The "token" parameter must be a string.');return r.classList.contains(t)}hasClass(e){return Ce.hasClass(this,e)}static classLength(e){return Ce._preElem(e,"classLength").classList.length}classLength(){return Ce.classLength(this)}static classList(e){return Ce._preElem(e,"classList").classList.values().toArray()}classList(){return Ce.classList(this)}static tagName(e){return Ce._preElem(e,"tagName").tagName}tagName(){return Ce.tagName(this)}static id(e){return Ce._preElem(e,"id").id}id(){return Ce.id(this)}static text(e){return Ce._preElem(e,"text").textContent}text(){return Ce.text(this)}static setText(e,t){if("string"!=typeof t)throw new Error("Value is not a valid string.");return Ce._preElems(e,"setText").forEach(e=>e.textContent=t),e}setText(e){return Ce.setText(this,e)}static empty(e){return Ce._preElems(e,"empty").forEach(e=>e.textContent=""),e}empty(){return Ce.empty(this)}static html(e,t){return Ce._preElem(e,"html").getHTML(t)}html(e){return Ce.html(this,e)}static setHtml(e,t){if("string"!=typeof t)throw new Error("Value is not a valid string.");return Ce._preElems(e,"setHtml").forEach(e=>e.innerHTML=t),e}setHtml(e){return Ce.setHtml(this,e)}static _valHooks={option:{get:e=>{const t=e.getAttribute("value");return null!=t?t:e.textContent}},select:{get:e=>{const t=e.options,r=e.selectedIndex,n="select-one"===e.type,o=n?r+1:t.length,i=[];let s=r<0?o:n?r:0;for(;s<o;s++){const e=t[s],o=e.parentNode;if((e.selected||s===r)&&!e.disabled&&(!o||!o.disabled||"OPTGROUP"!==o.tagName)){const t=Ce._valHooks.option.get(e);if(n)return t;i.push(t)}}return i},set:(e,t)=>{const r=e.options,n=Array.isArray(t)?t.map(String):[String(t)];let o=!1;for(let e=0;e<r.length;e++){const t=r[e],i=Ce._valHooks.option.get(t);"string"==typeof i&&(t.selected=n.includes(i))&&(o=!0)}return o||(e.selectedIndex=-1),n}},radio:{get:e=>e.checked?"on":"off",set(e,t){if("boolean"==typeof t){const r=e.closest("label");return t&&r&&r.querySelectorAll('input[type="radio"]').forEach(t=>{t instanceof HTMLInputElement&&t!==e&&(t.checked=!1)}),e.checked=t,t}}},checkbox:{get:e=>e.checked?"on":"off",set(e,t){if("boolean"==typeof t)return e.checked=t,t}}};static setVal(e,t){return Ce._preInputElems(e,"setVal").forEach(e=>{if(1!==e.nodeType)return;let r="function"==typeof t?t(e,Ce.val(e)):t;null==r?r="":"number"==typeof r?r=String(r):Array.isArray(r)&&(r=((e,t)=>{const r=[];for(let n=0;n<e.length;n++)r.push(t(e[n]));return r})(r,e=>null==e?"":String(e)));const n=Ce._valHooks[e.type]||Ce._valHooks[e.nodeName.toLowerCase()];if(!n||"function"!=typeof n.set||void 0===n.set(e,r,"value")){if("string"!=typeof r&&"boolean"!=typeof r)throw new Error(`Invalid setValue "${typeof r}" value.`);"string"==typeof r&&(e.value=r)}}),e}setVal(e){return Ce.setVal(this,e)}static _valTypes={string:e=>e.value,date:e=>e.valueAsDate,number:e=>e.valueAsNumber};static _getValByType(e,t,r){if("string"!=typeof t)throw new TypeError('The "type" must be a string.');if("string"!=typeof r)throw new TypeError('The "where" must be a string.');if(!(e instanceof HTMLInputElement))throw new Error(`Provided element is not an HTMLInputElement in ${r}().`);if("function"!=typeof Ce._valTypes[t])throw new Error(`No handler found for type "${t}" in ${r}().`);return Ce._valTypes[t](e)}static _val(e,t,r){const n=Ce._preInputElem(e,t),o=Ce._valHooks[n.type]||Ce._valHooks[n.nodeName.toLowerCase()];if(o&&"function"==typeof o.get){const e=o.get(n,"value",r);if(void 0!==e)return"string"==typeof e?e.replace(/\r/g,""):e}return Ce._getValByType(n,r,t)}_val(e,t){return Ce._val(this,e,t)}static val(e){return Ce._val(e,"val","string")}val(){return Ce.val(this)}static valTxt(e){const t=Ce._val(e,"valTxt","string");if("string"!=typeof t&&null!==t)throw new Error("Value is not a valid string.");return null==t?"":"string"==typeof t?t.replace(/\r/g,""):t}valTxt(){return Ce.valTxt(this)}static _valArr(e,t,r){const n=Ce._val(e,t,r);if(!Array.isArray(n))throw new Error(`Value expected an array but got ${typeof n}.`);return n}_valArr(e,t){return Ce._valArr(this,e,t)}static valArr(e){return Ce._valArr(e,"valArr","string")}valArr(){return Ce.valArr(this)}static valNb(e){if(!(Ce._preInputElem(e,"valNb")instanceof HTMLInputElement))throw new Error("Element must be an input element.");const t=Ce._val(e,"valNb","number");if(Number.isNaN(t))throw new Error("Value is not a valid number.");return t}valNb(){return Ce.valNb(this)}static valDate(e){if(!(Ce._preInputElem(e,"valDate")instanceof HTMLInputElement))throw new Error("Element must be an input element.");const t=Ce._val(e,"valDate","date");if(!(t instanceof Date))throw new Error("Value is not a valid date.");return t}valDate(){return Ce.valDate(this)}static valBool(e){const t=Ce._preInputElem(e,"valBool");if(!(t instanceof HTMLInputElement))throw new Error("Element must be an input element.");return"on"===Ce.val(t)}valBool(){return Ce.valBool(this)}static listenForPaste(e,{onFilePaste:t,onTextPaste:r}={}){if(void 0!==t&&"function"!=typeof t)throw new TypeError("onFilePaste must be a function.");if(void 0!==r&&"function"!=typeof r)throw new TypeError("onTextPaste must be a function.");const n=e=>{if(!(e instanceof ClipboardEvent))return;const n=e.clipboardData?.items||[];for(const e of n)if("file"===e.kind){if("function"==typeof t){const r=e.getAsFile();r&&t(e,r)}}else"string"===e.kind&&"function"==typeof r&&e.getAsString(t=>r(e,t))};return Ce._preElemsWithDoc(e,"listenForPaste").forEach(e=>Ce.on(e,"paste",n)),n}listenForPaste({onFilePaste:e,onTextPaste:t}={}){return Ce.listenForPaste(this,{onFilePaste:e,onTextPaste:t})}static hasEventListener(e,t){const r=Ce._preEventTargetElem(e,"hasEventListener");if(!Te.has(r))return!1;const n=Te.get(r);return!!(n&&Array.isArray(n[t])&&n[t].length>0)}hasEventListener(e){return Ce.hasEventListener(this,e)}static hasExactEventListener(e,t,r){const n=Ce._preEventTargetElem(e,"hasExactEventListener");if("function"!=typeof r)throw new TypeError('The "handler" must be a function.');if(!Te.has(n))return!1;const o=Te.get(n);return!(!o||!Array.isArray(o[t]))&&o[t].some(e=>e.handler===r)}hasExactEventListener(e,t){return Ce.hasExactEventListener(this,e,t)}static on(e,t,r,n){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return Ce._preEventTargetElems(e,"on").forEach(e=>{e.addEventListener(t,r,n),Te.has(e)||Te.set(e,{});const o=Te.get(e);o&&(Array.isArray(o[t])||(o[t]=[]),o[t].push({handler:r,options:n}))}),e}on(e,t,r){return Ce.on(this,e,t,r)}static once(e,t,r,n={}){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return Ce._preEventTargetElems(e,"once").forEach(e=>{const o=n=>{Ce.off(e,t,o),"function"==typeof r&&r(n)};Ce.on(e,t,o,"boolean"==typeof n?n:{...n,once:!0})}),e}once(e,t,r={}){return Ce.once(this,e,t,r)}static off(e,t,r,n){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return Ce._preEventTargetElems(e,"off").forEach(e=>{e.removeEventListener(t,r,n);const o=Te.get(e);o&&o[t]&&(o[t]=o[t].filter(e=>e.handler!==r),0===o[t].length&&delete o[t])}),e}off(e,t,r){return Ce.off(this,e,t,r)}static offAll(e,t){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return Ce._preEventTargetElems(e,"offAll").forEach(e=>{const r=Te.get(e);if(r&&r[t]){for(const n of r[t])e.removeEventListener(t,n.handler,n.options);delete r[t]}}),e}offAll(e){return Ce.offAll(this,e)}static offAllTypes(e,t=null){if(null!==t&&"function"!=typeof t)throw new TypeError('The "filterFn" must be a function.');return Ce._preEventTargetElems(e,"offAllTypes").forEach(e=>{const r=Te.get(e);if(r){for(const n in r)for(const o of r[n])("function"!=typeof t||t(o.handler,n))&&e.removeEventListener(n,o.handler,o.options);Te.delete(e)}}),e}offAllTypes(e=null){return Ce.offAllTypes(this,e)}static trigger(e,t,r={}){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return Ce._preEventTargetElems(e,"trigger").forEach(e=>{const n=r instanceof Event||r instanceof CustomEvent?r:new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e.dispatchEvent(n)}),e}trigger(e,t={}){return Ce.trigger(this,e,t)}static _propFix={for:"htmlFor",class:"className"};static attr(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return Ce._preElem(e,"attr").getAttribute(t)}attr(e){return Ce.attr(this,e)}static setAttr(e,t,r=null){if("string"!=typeof t)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 Ce._preElems(e,"setAttr").forEach(e=>{null===r?e.removeAttribute(t):e.setAttribute(t,r)}),e}setAttr(e,t){return Ce.setAttr(this,e,t)}static removeAttr(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return Ce._preElems(e,"removeAttr").forEach(e=>e.removeAttribute(t)),e}removeAttr(e){return Ce.removeAttr(this,e)}static hasAttr(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return Ce._preElem(e,"hasAttr").hasAttribute(t)}hasAttr(e){return Ce.hasAttr(this,e)}static hasProp(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return!!Ce._preElem(e,"hasProp")[Ce._propFix[t]||t]}hasProp(e){return Ce.hasProp(this,e)}static addProp(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return Ce._preElems(e,"addProp").forEach(e=>{e[t=Ce._propFix[t]||t]=!0}),e}addProp(e){return Ce.addProp(this,e)}static removeProp(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return Ce._preElems(e,"removeProp").forEach(e=>{e[t=Ce._propFix[t]||t]=!1}),e}removeProp(e){return Ce.removeProp(this,e)}static toggleProp(e,t,r){if("string"!=typeof t)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.');Ce._preElems(e,"toggleProp").forEach(e=>{const n=Ce._propFix[t]||t;(void 0===r?!e[n]:r)?Ce.addProp(e,t):Ce.removeProp(e,t)})}toggleProp(e,t){return Ce.toggleProp(this,e,t)}static remove(e){return Ce._preElems(e,"remove").forEach(e=>e.remove()),e}remove(){return Ce.remove(this)}static index(e,t=null){const r=Ce._preElem(e,"index");if(!r)return-1;if(!t)return Array.prototype.indexOf.call(r.parentNode?.children||[],r);if(t){const e="string"==typeof t?document.querySelectorAll(t):Ce._preElems(t,"index");return Array.prototype.indexOf.call(e,r)}return-1}index(e){return Ce.index(this,e)}static _getCustomRect(e,t){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 t in e)"number"==typeof e[t]&&(r[t]=e[t]);if("object"!=typeof t||null===t||Array.isArray(t))throw new Error("");const{height:n=0,width:o=0,top:i=0,bottom:s=0,left:a=0,right:l=0}=t;if("number"!=typeof n)throw new Error("");if("number"!=typeof o)throw new Error("");if("number"!=typeof i)throw new Error("");if("number"!=typeof s)throw new Error("");if("number"!=typeof a)throw new Error("");if("number"!=typeof l)throw new Error("");return r.height+=n,r.width+=o,r.top+=i,r.bottom+=s,r.left+=a,r.right+=l,r}static isCollWith(e,t,r={}){const n=Ce._getCustomRect(Ce._preElem(e,"isCollWith").getBoundingClientRect(),r),o=Ce._preElem(t,"isCollWith").getBoundingClientRect();return pe(n,o)}isCollWith(e,t){return Ce.isCollWith(this,e,t)}static isCollPerfWith(e,t,r={}){const n=Ce._getCustomRect(Ce._preElem(e,"isCollPerfWith").getBoundingClientRect(),r),o=Ce._preElem(t,"isCollPerfWith").getBoundingClientRect();return ye(n,o)}isCollPerfWith(e,t){return Ce.isCollPerfWith(this,e,t)}static _isCollWithLock(e,t,r,n,o){const i=Se[o];if(e)return i.has(n)||i.set(n,!0),!0;if(i.has(n)){let e=!1;switch(o){case"top":e=be(t,r);break;case"bottom":e=we(t,r);break;case"left":e=ve(t,r);break;case"right":e=Ee(t,r)}return e&&i.delete(n),i.has(n)}return!1}static isCollWithLock(e,t,r,n={}){const o=Ce._preElem(e,"isCollWithLock"),i=Ce._preElem(t,"isCollWithLock"),s=Ce._getCustomRect(o.getBoundingClientRect(),n),a=i.getBoundingClientRect(),l=pe(s,a);return Ce._isCollWithLock(l,s,a,o,r)}isCollWithLock(e,t,r){return Ce.isCollWithLock(this,e,t,r)}static isCollPerfWithLock(e,t,r,n={}){const o=Ce._preElem(e,"isCollPerfWithLock"),i=Ce._preElem(t,"isCollPerfWithLock"),s=Ce._getCustomRect(o.getBoundingClientRect(),n),a=i.getBoundingClientRect(),l=ye(s,a);return Ce._isCollWithLock(l,s,a,o,r)}isCollPerfWithLock(e,t,r){return Ce.isCollPerfWithLock(this,e,t,r)}static resetCollLock(e){const t=Ce._preElem(e,"resetCollLock");let r=!1;for(const e of["top","bottom","left","right"])Se[e].has(t)&&(Se[e].delete(t),r=!0);return r}resetCollLock(){return Ce.resetCollLock(this)}static resetCollLockDir(e,t){const r=Ce._preElem(e,"resetCollLockDir"),n=Se[t];return!!n.has(r)&&(n.delete(r),!0)}resetCollLockDir(e){return Ce.resetCollLockDir(this,e)}static isInViewport(e){const t=Ce._preElem(e,"isInViewport");if(!t.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const r=Ce.offset(t).top,n=r+Ce.outerHeight(t),o=Ce.scrollTop(window),i=o+Ce.height(window);return n>o&&r<i}isInViewport(){return Ce.isInViewport(this)}static isScrolledIntoView(e){const t=Ce._preElem(e,"isScrolledIntoView");if(!t.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const r=Ce.scrollTop(window),n=r+Ce.height(window),o=Ce.offset(t).top;return o+Ce.height(t)<=n&&o>=r}isScrolledIntoView(){return Ce.isScrolledIntoView(this)}static isInContainer(e,t){const r=Ce._preElem(e,"isInContainer"),n=Ce._preElem(t,"isInContainer");if(!r.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const o=r.getBoundingClientRect(),i=n.getBoundingClientRect(),s=o.bottom>i.top&&o.top<i.bottom,a=o.right>i.left&&o.left<i.right;return s&&a}isInContainer(e){return Ce.isInContainer(this,e)}static isFullyInContainer(e,t){const r=Ce._preElem(e,"isScrolledIntoView"),n=Ce._preElem(t,"isInContainer");if(!r.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const o=r.getBoundingClientRect(),i=n.getBoundingClientRect();return o.top>=i.top&&o.bottom<=i.bottom&&o.left>=i.left&&o.right<=i.right}isFullyInContainer(e){return Ce.isFullyInContainer(this,e)}static hasScroll(e){const t=Ce._preElem(e,"hasScroll");return{v:t.scrollHeight>t.clientHeight,h:t.scrollWidth>t.clientWidth}}hasScroll(){return Ce.hasScroll(this)}}const Le=Ce;function Ae(e,t){return Le.isCollWith(e,t)}const _e=e=>Le.borderWidth(e),De=e=>Le.border(e),ke=e=>Le.margin(e),Me=e=>Le.padding(e);function Ie(e){const t=e.offsetTop,r=t+e.offsetHeight,n=window.scrollY,o=n+window.innerHeight;return r>n&&t<o}function Ne(e){const t=window.scrollY,r=t+window.innerHeight,n=e.offsetTop;return n+e.offsetHeight<=r&&n>=t}const Be=class{#F;#$;#U;#V;#J;#z;#q;#G;constructor(e={}){const{target:t,fullscreen:r=!0,hoverClass:n="dnd-hover",onDrop:o,onEnter:i,onLeave:s}=e;if("boolean"!=typeof r)throw new TypeError('The "fullscreen" option must be a boolean.');const a=r?document.body:t||document.body;if(!(a instanceof HTMLElement))throw new TypeError('The "target" option must be an instance of HTMLElement.');if("string"!=typeof n)throw new TypeError('The "hoverClass" option must be a string.');if("function"!=typeof o)throw new TypeError('The "onDrop" option must be a function.');if("function"!=typeof i)throw new TypeError('The "onEnter" option must be a function.');if("function"!=typeof s)throw new TypeError('The "onLeave" option must be a function.');this.#F=a,this.#$=r,this.#U=n,this.#V=o||(()=>{}),this.#J=i,this.#z=s,this.#q=!1,this.#G=!1,this._handleDragEnter=this._handleDragEnter.bind(this),this._handleDragOver=this._handleDragOver.bind(this),this._handleDragLeave=this._handleDragLeave.bind(this),this._handleDrop=this._handleDrop.bind(this),this.#Y()}getTarget(){return this.#F}getHoverClass(){return this.#U}isFullScreen(){return this.#$}isDragging(){return this.#q}bound(){return this.#G}#Y(){if(this.#G)return;const e=this.getTarget();e.addEventListener("dragenter",this._handleDragEnter),e.addEventListener("dragover",this._handleDragOver),e.addEventListener("dragleave",this._handleDragLeave),e.addEventListener("drop",this._handleDrop),this.#G=!0}#X(){if(!this.#G)return;const e=this.getTarget();e.removeEventListener("dragenter",this._handleDragEnter),e.removeEventListener("dragover",this._handleDragOver),e.removeEventListener("dragleave",this._handleDragLeave),e.removeEventListener("drop",this._handleDrop),this.#G=!1}_handleDragEnter(e){if(e.preventDefault(),!this.#q){const t=this.getTarget();this.#q=!0,t.classList.add(this.#U),this.#J(e)}}_handleDragOver(e){e.preventDefault(),e.dataTransfer?e.dataTransfer.dropEffect="copy":console.warn("[TinyDragDropDetector] [handleDragOver] DragOver event missing dataTransfer.")}_handleDragLeave(e){e.preventDefault();const t=this.getTarget();null!==e.relatedTarget&&t.contains(e.relatedTarget)||(this.#q=!1,t.classList.remove(this.#U),this.#z(e))}_handleDrop(e){if(e.preventDefault(),!e.dataTransfer)return void console.warn("[TinyDragDropDetector] [handleDrop] DragOver event missing dataTransfer.");const t=this.getTarget();this.#q=!1,t.classList.remove(this.#U);const r=e.dataTransfer.files;r.length>0&&this.#V(r,e)}destroy(){this.#X(),this.getTarget().classList.remove(this.#U)}};var je=r(133),Re=r(975);function Oe(e){if(!(0,je.existsSync)(e))throw new Error(`File not found: ${e}`);const t=(0,je.readFileSync)(e,"utf-8");return JSON.parse(t)}function Pe(e,t,r=2){const n=JSON.stringify(t,null,r);(0,je.writeFileSync)(e,n,"utf-8")}function He(e){(0,je.existsSync)(e)||(0,je.mkdirSync)(e,{recursive:!0})}function We(e){if(!(0,je.existsSync)(e))return;const t=(0,je.readdirSync)(e);for(const r of t){const t=(0,Re.join)(e,r);(0,je.lstatSync)(t).isDirectory()?(0,je.rmSync)(t,{recursive:!0,force:!0}):(0,je.unlinkSync)(t)}}function Fe(e){return(0,je.existsSync)(e)&&(0,je.lstatSync)(e).isFile()}function $e(e){return(0,je.existsSync)(e)&&(0,je.lstatSync)(e).isDirectory()}function Ue(e){return 0===(0,je.readdirSync)(e).length}function Ve(e,t,r){He((0,Re.dirname)(t)),(0,je.copyFileSync)(e,t,r)}function Je(e){return!!Fe(e)&&((0,je.unlinkSync)(e),!0)}function ze(e,t,r="utf-8"){He((0,Re.dirname)(e)),(0,je.writeFileSync)(e,t,r)}function qe(e,t=!1){const r={files:[],dirs:[]};if(!$e(e))return r;const n=(0,je.readdirSync)(e);for(const o of n){const n=(0,Re.join)(e,o);if((0,je.lstatSync)(n).isDirectory()){if(r.dirs.push(n),t){const e=qe(n,!0);r.files.push(...e.files),r.dirs.push(...e.dirs)}}else r.files.push(n)}return r}function Ge(e,t=!1){const r=[];if(!$e(e))return r;const n=(0,je.readdirSync)(e);for(const o of n){const n=(0,Re.join)(e,o);(0,je.lstatSync)(n).isDirectory()&&(r.push(n),t&&r.push(...Ge(n,!0)))}return r}function Ye(e){return Fe(e)?(0,je.statSync)(e).size:0}function Xe(e){let t=0;const r=qe(e,!0).files;for(const e of r)t+=Ye(e);return t}function Ke(e,t="bak"){Fe(e)&&Ve(e,`${e}.${t}.${(new Date).toISOString().replace(/[:.]/g,"-")}`)}function Qe(e,t="bak"){const r=(0,Re.dirname)(e),n=(0,Re.basename)(e),o=(0,je.readdirSync)(r).filter(e=>e.startsWith(`${n}.${t}.`)).sort().reverse();if(0===o.length)throw new Error(`No backups found for ${e}`);return(0,Re.join)(r,o[0])}function Ze(e,t="bak"){Ve(Qe(e,t),e)}function et(e,t,r=[]){if("string"!=typeof e)throw new TypeError("dirPath must be a string");if("function"!=typeof t)throw new TypeError("renameFn must be a function");if(!Array.isArray(r))throw new TypeError("extensions must be an array of strings");if(!(0,je.existsSync)(e)||!(0,je.statSync)(e).isDirectory())throw new Error(`Directory not found or invalid: ${e}`);for(const e of r)if("string"!=typeof e||!e.startsWith("."))throw new TypeError(`Invalid extension: ${e}`);const n=qe(e).files;let o=0;for(const i of n){const n=(0,Re.extname)(i);if(r.length&&!r.includes(n))continue;const s=(0,Re.basename)(i),a=t(s,o++),l=(0,Re.join)(e,a);s!==a&&(0,je.renameSync)(i,l)}}function tt(e,t,r,n=[]){et(e,e=>{const n=(0,Re.extname)(e);return`${(0,Re.basename)(e,n).replace(t,r)}${n}`},n)}function rt(e,{prefix:t="",suffix:r=""},n=[]){et(e,e=>{const n=(0,Re.extname)(e),o=(0,Re.basename)(e,n);return`${t}${o}${r}${n}`},n)}function nt(e,t="lower",r=[],n=!1){if("string"!=typeof t||!["lower","upper","title"].includes(t))throw new Error(`Invalid mode "${t}". Must be 'lower', 'upper' or 'title'.`);et(e,e=>{const r=e=>"lower"===t?e.toLowerCase():"upper"===t?e.toUpperCase():"title"===t?j(e):e,o=(0,Re.extname)(e),i=n?r(o):o;return`${r((0,Re.basename)(e,o))}${i}`},r)}function ot(e,t=3,r=[]){et(e,e=>e.replace(/\d+/,e=>e.padStart(t,"0")),r)}var it=r(370);async function st(e){if(!(0,je.existsSync)(e))return;const t=await(0,it.readdir)(e),r={},n=[];for(const o of t){const t=(0,Re.join)(e,o),i=(0,it.lstat)(t);i.then(e=>(r[t]=e,e)),n.push(i)}await Promise.all(n);const o=[];for(const e in r)r[e].isDirectory()?o.push((0,it.rm)(e,{recursive:!0,force:!0})):o.push((0,it.unlink)(e));await Promise.all(o)}async function at(e){return 0===(await(0,it.readdir)(e)).length}async function lt(e,t=!1){const r={files:[],dirs:[]};if(!$e(e))return r;const n=await(0,it.readdir)(e);for(const o of n){const n=(0,Re.join)(e,o);if((await(0,it.lstat)(n)).isDirectory()){if(r.dirs.push(n),t){const e=await lt(n,!0);r.files.push(...e.files),r.dirs.push(...e.dirs)}}else r.files.push(n)}return r}async function ut(e,t=!1){const r=[];if(!$e(e))return r;const n=await(0,it.readdir)(e);for(const o of n){const n=(0,Re.join)(e,o);(await(0,it.lstat)(n)).isDirectory()&&(r.push(n),t&&r.push(...await ut(n,!0)))}return r}async function ct(e){return Fe(e)?(await(0,it.stat)(e)).size:0}async function ht(e){let t=0;const{files:r}=await lt(e,!0),n=[];for(const e of r){const r=ct(e);r.then(e=>(t+=e,e)),n.push(r)}return await Promise.all(n),t}class dt{static Utils={...e,TinyHtml:Le};#K=!0;#Q=!1;#Z=0;#ee=0;#te=!0;#re=!1;#ne=!1;#oe=!1;#ie=!1;#se=!1;#ae=!1;#le=null;#ue=[];#ce=null;#he={start:!1,end:!1,collide:!1,move:!1};#de=null;#F;#fe="drag-hidden";#me="dragging";#ge="drag-active";#pe="jail-drag-active";#ye="jail-drag-disabled";#be="dragging-collision";#we=9999;constructor(e,t={}){const r=e instanceof Le?e.get():e;if(!(r instanceof HTMLElement))throw new Error("TinyDragger requires a valid target HTMLElement to initialize.");if(this.#F=r,void 0!==t.jail&&!(t.jail instanceof HTMLElement))throw new Error('The "jail" option must be an HTMLElement if provided.');if(void 0!==t.defaultZIndex&&this.setDefaultZIndex(t.defaultZIndex),void 0!==t.vibration&&!1!==t.vibration&&!f(t.vibration))throw new Error('The "vibration" option must be an object or false.');const n=(e,t)=>{if(void 0!==e&&"boolean"!=typeof e)throw new Error(`The "${t}" option must be a boolean.`)},o=(e,t)=>{if(void 0!==e&&"string"!=typeof e)throw new Error(`The "${t}" option must be a string.`)};n(t.mirrorElem,"mirrorElem"),n(t.collisionByMouse,"collisionByMouse"),n(t.lockInsideJail,"lockInsideJail"),n(t.dropInJailOnly,"dropInJailOnly"),n(t.revertOnDrop,"revertOnDrop"),n(t.multiCollision,"multiCollision"),o(t.classDragging,"classDragging"),o(t.classBodyDragging,"classBodyDragging"),o(t.classJailDragging,"classJailDragging"),o(t.classJailDragDisabled,"classJailDragDisabled"),o(t.classDragCollision,"classDragCollision"),o(t.classHidden,"classHidden"),t.jail instanceof HTMLElement&&(this.#de=t.jail),this.#he=Object.assign({start:!1,end:!1,collide:!1,move:!1},f(t.vibration)?t.vibration:{}),"string"==typeof t.classDragging&&(this.#me=t.classDragging),"string"==typeof t.classBodyDragging&&(this.#ge=t.classBodyDragging),"string"==typeof t.classJailDragging&&(this.#pe=t.classJailDragging),"string"==typeof t.classJailDragDisabled&&(this.#ye=t.classJailDragDisabled),"string"==typeof t.classHidden&&(this.#fe=t.classHidden),"string"==typeof t.classDragCollision&&(this.#be=t.classDragCollision),"boolean"==typeof t.collisionByMouse&&(this.#se=t.collisionByMouse),"boolean"==typeof t.mirrorElem&&(this.#te=t.mirrorElem),"boolean"==typeof t.revertOnDrop&&(this.#oe=t.revertOnDrop),"boolean"==typeof t.lockInsideJail&&(this.#ne=t.lockInsideJail),"boolean"==typeof t.dropInJailOnly&&(this.#ae=t.dropInJailOnly),"boolean"==typeof t.multiCollision&&(this.#re=t.multiCollision),this._onMouseDown=this.#ve.bind(this),this._onMouseMove=this.#Ee.bind(this),this._onMouseUp=this.#Te.bind(this),this._onTouchStart=e=>this.#ve(e.touches[0]),this._onTouchMove=e=>this.#Ee(e.touches[0]),this._onTouchEnd=e=>this.#Te(e.changedTouches[0]),this.#F.addEventListener("mousedown",this._onMouseDown),this.#F.addEventListener("touchstart",this._onTouchStart,{passive:!1})}enable(){this.#xe(),this.#de&&this.#de.classList.add(this.#ye),this.#K=!0}disable(){this.#de&&this.#de.classList.remove(this.#ye),this.#K=!1}addCollidable(e){if(this.#xe(),!(e instanceof HTMLElement))throw new Error("addCollidable expects an HTMLElement as argument.");this.#ue.includes(e)||this.#ue.push(e)}removeCollidable(e){if(this.#xe(),!(e instanceof HTMLElement))throw new Error("removeCollidable expects an HTMLElement as argument.");this.#ue=this.#ue.filter(t=>t!==e)}setVibrationPattern({startPattern:e=!1,endPattern:t=!1,collidePattern:r=!1,movePattern:n=!1}={}){this.#xe();const o=e=>!1===e||Array.isArray(e)&&e.every(e=>"number"==typeof e);if(!o(e))throw new Error('Invalid "startPattern": must be false or an array of numbers.');if(!o(t))throw new Error('Invalid "endPattern": must be false or an array of numbers.');if(!o(r))throw new Error('Invalid "collidePattern": must be false or an array of numbers.');if(!o(n))throw new Error('Invalid "movePattern": must be false or an array of numbers.');this.#he={start:e,end:t,collide:r,move:n}}disableVibration(){this.#xe(),this.#he={start:!1,end:!1,collide:!1,move:!1}}getOffset(e){if(this.#xe(),!(e instanceof MouseEvent||e instanceof Touch)||"number"!=typeof e.clientX||"number"!=typeof e.clientY)throw new Error("getOffset expects an event with valid clientX and clientY coordinates.");const t=this.#F.getBoundingClientRect(),{left:r,top:n}=Le.borderWidth(this.#F);return{x:e.clientX-t.left+r,y:e.clientY-t.top+n}}#ve(e){if(e instanceof MouseEvent&&e.preventDefault(),this.#Q||!this.#K||!this.#F.parentElement)return;if(this.#te){const e=this.#F.cloneNode(!0);if(!(e instanceof HTMLElement))throw new Error("[TinyDragger] INVALID DRAG ELEMENT!");this.#ce=e}else this.#ce=this.#F;this.#ie=!0;const t=this.#F.getBoundingClientRect();Object.assign(this.#ce.style,{position:"absolute",pointerEvents:"none",left:`${this.#F.offsetLeft}px`,top:`${this.#F.offsetTop}px`,width:`${t.width}px`,height:`${t.height}px`,zIndex:this.#we}),this.#te&&(this.#F.classList.add(this.#fe),this.#F.parentElement.appendChild(this.#ce));const{x:r,y:n}=this.getOffset(e);this.#ee=r,this.#Z=n,this.#ce.classList.add(this.#me),document.body.classList.add(this.#ge),this.#de&&this.#de.classList.add(this.#pe),document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp),document.addEventListener("touchmove",this._onTouchMove,{passive:!1}),document.addEventListener("touchend",this._onTouchEnd),navigator.vibrate&&Array.isArray(this.#he.start)&&navigator.vibrate(this.#he.start),this.checkDragCollision(e),this.#Se("drag")}#Ce=[];#Le(e){e&&(e.classList.add(this.#be),this.#Ce.push(e))}#Ae(){for(;this.#Ce.length>0;){const e=this.#Ce.shift();e&&e.classList.remove(this.#be)}this.#le&&this.#le.classList.remove(this.#be)}checkDragCollision(e){const{collidedElements:t}=this.execCollision(e),r=t[0]||null;this.#le&&!t.includes(this.#le)&&this.#Ae(),t.forEach(e=>this.#Le(e)),this.#ue.forEach(e=>{t.includes(e)||e.classList.remove(this.#be)}),navigator.vibrate&&Array.isArray(this.#he.collide)&&t.length>0&&navigator.vibrate(this.#he.collide),this.#le=r}#Ee(e){if(e instanceof MouseEvent&&e.preventDefault(),this.#Q||!this.#ie||!this.#K||!this.#ce)return;const t=(this.#ce.offsetParent||document.body).getBoundingClientRect();let r=e.clientX-t.left-this.#ee,n=e.clientY-t.top-this.#Z;if(this.#ne&&this.#de){const e=this.#de.getBoundingClientRect(),o=this.#ce.getBoundingClientRect(),i=e.left-t.left,s=e.top-t.top,{x:a,y:l}=Le.borderWidth(this.#de),u=i+e.width-o.width-l,c=s+e.height-o.height-a;r=Math.max(i,Math.min(r,u)),n=Math.max(s,Math.min(n,c))}this.#ce.style.position="absolute",this.#ce.style.left=`${r}px`,this.#ce.style.top=`${n}px`,navigator.vibrate&&Array.isArray(this.#he.move)&&navigator.vibrate(this.#he.move),this.checkDragCollision(e),this.#Se("dragging")}execCollision(e){if(this.#Q||!this.#ce)return{inJail:!1,collidedElements:[]};let t=[],r=!0;const n=this.#de?.getBoundingClientRect();if(this.#se){const o=e.clientX,i=e.clientY;this.#ae&&this.#de&&n&&(r=o>=n.left&&o<=n.right&&i>=n.top&&i<=n.bottom),t=r?this.#re?this.getAllCollidedElements(o,i):[this.getCollidedElement(o,i)].filter(Boolean):[]}else{const e=this.#ce.getBoundingClientRect();this.#ae&&this.#de&&n&&(r=e.left>=n.left&&e.right<=n.right&&e.top>=n.top&&e.bottom<=n.bottom),t=r?this.#re?this.getAllCollidedElementsByRect(e):[this.getCollidedElementByRect(e)].filter(Boolean):[]}return{inJail:r,collidedElements:t}}#Te(e){if(e instanceof MouseEvent&&e.preventDefault(),this.#Q||!this.#ie)return;if(this.#ie=!1,!this.#ce)return;this.#F.classList.remove(this.#me),document.body.classList.remove(this.#ge),this.#de&&this.#de.classList.remove(this.#pe),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd);const{collidedElements:t}=this.execCollision(e);navigator.vibrate&&Array.isArray(this.#he.end)&&navigator.vibrate(this.#he.end);const r=this.#ce.style.left,n=this.#ce.style.top;this.#ce&&(this.#te?this.#ce.remove():Object.assign(this.#ce.style,{position:"",pointerEvents:"",left:"",top:"",width:"",height:"",zIndex:""}),this.#ce=null),this.#le&&this.#Ae(),this.#le=null,this.#te&&this.#F.classList.remove(this.#fe),this.#oe||(this.#F.style.left=r,this.#F.style.top=n);const o=new CustomEvent("drop",{detail:{targets:t,first:t[0]||null}});this.#F.dispatchEvent(o)}#_e(e,t){const r=e.getBoundingClientRect();return!(t.right<r.left||t.left>r.right||t.bottom<r.top||t.top>r.bottom)}getAllCollidedElementsByRect(e){if(this.#xe(),!(e instanceof DOMRect)||"number"!=typeof e.left||"number"!=typeof e.right||"number"!=typeof e.top||"number"!=typeof e.bottom)throw new Error("getCollidedElementByRect expects a valid DOMRect object.");return this.#ue.filter(t=>this.#_e(t,e))}getCollidedElementByRect(e){if(this.#xe(),!(e instanceof DOMRect)||"number"!=typeof e.left||"number"!=typeof e.right||"number"!=typeof e.top||"number"!=typeof e.bottom)throw new Error("getCollidedElementByRect expects a valid DOMRect object.");return this.#ue.find(t=>this.#_e(t,e))||null}#De(e,t,r){const n=e.getBoundingClientRect();return t>=n.left&&t<=n.right&&r>=n.top&&r<=n.bottom}getAllCollidedElements(e,t){if(this.#xe(),"number"!=typeof e||"number"!=typeof t)throw new Error("getCollidedElement expects numeric x and y coordinates.");return this.#ue.filter(r=>this.#De(r,e,t))}getCollidedElement(e,t){if(this.#xe(),"number"!=typeof e||"number"!=typeof t)throw new Error("getCollidedElement expects numeric x and y coordinates.");return this.#ue.find(r=>this.#De(r,e,t))||null}#Se(e){const t=new CustomEvent(e);this.#F.dispatchEvent(t)}getDragging(){return this.#ie}getLockInsideJail(){return this.#ne}setLockInsideJail(e){if("boolean"!=typeof e)throw new Error("lockInsideJail must be a boolean.");this.#ne=e}getRevertOnDrop(){return this.#oe}setRevertOnDrop(e){if("boolean"!=typeof e)throw new Error("revertOnDrop must be a boolean.");this.#oe=e}getCollisionByMouse(){return this.#se}setCollisionByMouse(e){if("boolean"!=typeof e)throw new Error("collisionByMouse must be a boolean.");this.#se=e}getDropInJailOnly(){return this.#ae}setDropInJailOnly(e){if("boolean"!=typeof e)throw new Error("dropInJailOnly must be a boolean.");this.#ae=e}getDefaultZIndex(){return this.#we}setDefaultZIndex(e){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError("Z-index must be a finite number.");this.#we=e}isMirrorEnabled(){return this.#te}setMirrorEnabled(e){if("boolean"!=typeof e)throw new TypeError("Mirror setting must be a boolean.");this.#te=e}getTarget(){return this.#F}getJail(){return this.#de}getDragProxy(){return this.#ce}getLastCollision(){return this.#le}getCollidables(){return[...this.#ue]}getDragHiddenClass(){return this.#fe}getClassDragging(){return this.#me}getClassBodyDragging(){return this.#ge}getClassJailDragging(){return this.#pe}getClassJailDragDisabled(){return this.#ye}getClassDragCollision(){return this.#be}getVibrations(){return{...this.#he}}getStartVibration(){return this.#he.start}getEndVibration(){return this.#he.end}getCollideVibration(){return this.#he.collide}getMoveVibration(){return this.#he.move}isEnabled(){return this.#K}#xe(){if(this.#Q)throw new Error("This TinyDragger instance has been destroyed and can no longer be used.")}destroy(){this.#Q||(this.disable(),this.#F.removeEventListener("mousedown",this._onMouseDown),this.#F.removeEventListener("touchstart",this._onTouchStart),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd),this.#le&&this.#Ae(),this.#ce&&(this.#te?this.#ce.remove():Object.assign(this.#ce.style,{position:"",pointerEvents:"",left:"",top:"",width:"",height:"",zIndex:""}),this.#ce=null),this.#ue=[],this.#ie=!1,this.#le=null,this.#te&&this.#F.classList.remove(this.#fe),this.#F.classList.remove(this.#me),document.body.classList.remove(this.#ge),this.#de&&this.#de.classList.remove(this.#pe,this.#ye),this.#Q=!0)}}const ft=dt,mt=class{#ke=[];#Me=!1;#Ie=!1;#Ne=[];#Be(){this.#Me&&Promise.all(this.#Ne).then(()=>{this.#Ie=!0,this.#je(!1)}).catch(e=>{console.error("[TinyDomReadyManager] Promise rejected:",e)})}#je(e){this.#ke.filter(t=>t.domOnly===e).sort((e,t)=>t.priority-e.priority).forEach(e=>this.#Re(e)),this.#ke=this.#ke.filter(t=>!(t.once&&(!e||t.domOnly)))}#Re(e){if("function"==typeof e.filter)try{if(!e.filter())return}catch(e){return void console.warn("[TinyDomReadyManager] Filter error:",e)}try{e.fn()}catch(e){console.error("[TinyDomReadyManager] Handler error:",e)}}_markDomReady(){this.#Me=!0,this.#je(!0),this.#Be()}init(){if(this.#Me)throw new Error("[TinyDomReadyManager] init() has already been called.");"interactive"===document.readyState||"complete"===document.readyState?this._markDomReady():document.addEventListener("DOMContentLoaded",()=>this._markDomReady())}addPromise(e){if(!(e instanceof Promise))throw new TypeError("[TinyDomReadyManager] promise must be a valid Promise.");this.#Ie||(this.#Ne.push(e),this.#Me&&this.#Be())}onReady(e,{once:t=!0,priority:r=0,filter:n=null,domOnly:o=!1}={}){if("function"!=typeof e)throw new TypeError("[TinyDomReadyManager] fn must be a function.");const i={fn:e,once:t,priority:r,filter:n,domOnly:o};if(o&&this.#Me)return this.#Re(i),void(t||this.#ke.push(i));!o&&this.#Ie?this.#Re(i):this.#ke.push(i)}isReady(){return this.#Ie}isDomReady(){return this.#Me}},gt=class{#Oe=!1;#Pe=!1;#He=null;#We=100;#Fe=null;#$e;constructor({audio:e=null,defaultIcon:t=null,bodyLimit:r=100,defaultOnClick:n=function(e){e.preventDefault(),window.focus&&window.focus(),this.close()}}={}){if(!(e instanceof HTMLAudioElement)&&"string"!=typeof e&&null!==e)throw new TypeError("audio must be an instance of HTMLAudioElement or null.");if(null!==t&&"string"!=typeof t)throw new TypeError("defaultIcon must be a string or null.");if(!Number.isFinite(r)||r<0)throw new TypeError("bodyLimit must be a non-negative number.");if("function"!=typeof n)throw new TypeError("defaultOnClick must be a function.");this.#He="string"!=typeof e?e:new Audio(e),this.#Fe=t,this.#We=r,this.#$e=n}requestPerm(){const e=this;return new Promise((t,r)=>{e.isCompatible()?"default"===Notification.permission?Notification.requestPermission().then(r=>{this.#Pe=!0,e.#Oe="granted"===r,t(e.#Oe)}).catch(r):(this.#Pe=!0,e.#Oe="granted"===Notification.permission,t(e.#Oe)):(this.#Pe=!0,e.#Oe=!1,t(!1))})}isCompatible(){return"Notification"in window}send(e,t={}){if(!this.#Pe)throw new Error("You must call requestPerm() before sending a notification.");if("string"!=typeof e)throw new TypeError("title must be a string.");if("object"!=typeof t||null===t)throw new TypeError("config must be a non-null object.");if(!this.#Oe)return null;const{icon:r=this.#Fe||void 0,vibrate:n=[200,100,200]}=t,o={...t};"string"==typeof r&&(o.icon=r),Array.isArray(n)&&(o.vibrate=n),"string"==typeof o.body&&(o.body=P(o.body,this.#We));const i=new Notification(e,o);return i.addEventListener("show",()=>{this.#He instanceof HTMLAudioElement&&(this.#He.currentTime=0,this.#He.play().catch(e=>console.error(e)))}),"function"==typeof this.#$e&&i.addEventListener("click",this.#$e),i}wasPermissionRequested(){return this.#Pe}isAllowed(){return this.#Oe}getAudio(){return this.#He}setAudio(e){if(!(e instanceof HTMLAudioElement)&&"string"!=typeof e&&null!==e)throw new TypeError("sound must be an instance of HTMLAudioElement or null.");this.#He="string"!=typeof e?e:new Audio(e)}getBodyLimit(){return this.#We}setBodyLimit(e){if(!Number.isFinite(e)||e<0)throw new TypeError("bodyLimit must be a non-negative number.");this.#We=e}getDefaultAvatar(){return this.#Fe}setDefaultAvatar(e){if("string"!=typeof e&&null!==e)throw new TypeError("defaultIcon must be a string or null.");this.#Fe=e}getDefaultOnClick(){return this.#$e}setDefaultOnClick(e){if("function"!=typeof e)throw new TypeError("defaultOnClick must be a function.");this.#$e=e}},pt=class{#Ue;#Ve=null;#Je=[];#ze=100;#qe=new Set;#Ge=new Set;#Q=!1;constructor(e=window,t=100){if(!(e instanceof Element||e instanceof Window))throw new TypeError("scrollTarget must be an Element or the Window object.");this.#Ue=e,this._checkTimer=this._checkTimer.bind(this),this.#Ue.addEventListener("scroll",this._checkTimer),this.#ze=t}_checkTimer=()=>{this.#Ve&&clearTimeout(this.#Ve),this.#Ve=setTimeout(()=>{this.#Ve=null,this.#Ye()},this.#ze)};get inactivityTime(){return this.#ze}set inactivityTime(e){if("number"!=typeof e||e<=0||!Number.isFinite(e))throw new Error("inactivityTime must be a positive number in milliseconds.");this.#ze=e}#Ye(){if(!this.#Q){for(const e of this.#Ge)"function"==typeof e&&e();for(;this.#Je.length;){const e=this.#Je.pop();"function"==typeof e&&e()}}}doAfterScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.lastScrollTime=Date.now(),this.#Je.push(e)}onStop(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#Ge.add(e)}offStop(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#Ge.delete(e)}onScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#Ue.addEventListener("scroll",e),this.#qe.add(e)}offScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#qe.has(e)&&(this.#Ue.removeEventListener("scroll",e),this.#qe.delete(e))}destroy(){if(!this.#Q){this.#Q=!0,this.#Ue.removeEventListener("scroll",this._checkTimer);for(const e of this.#qe)this.#Ue.removeEventListener("scroll",e);this.#qe.clear(),this.#Ge.clear()}}},yt=["lorem","ipsum","dolor","sit","amet","consectetur","adipiscing","elit","sed","do","eiusmod","tempor","incididunt","ut","labore","et","dolore","magna","aliqua"],bt=["😂","🌈","🤖","💥","🐸","🍕","🦄","🧠","🧬","🚀","🫠","💫","🍩","👾","🎉","🥴","🐙","🧃","🪐","🎈","🧸","👻","🥳","🍭","💖","😺","🌮","🪅","🎮","🥓","🍮"],wt=["pudding","bean","snuggle","bloop","jelly","unicorn","floof","giggle","bubble","muffin","puff","pickle","goblin","waffle","sprinkle","cupcake","fizzle","marshmallow","duckling","sock","cloud","teacup","nugget","gnome","hug","moonbean","crayon","jiggle","glitter","carrot","goober"],vt=["wiggles","bounces","flies","splats","scoots","giggles","wigglesnacks","twirls","boops","pops","sings","hugs","floats","glows","flaps","mlems","dances","puddles","nomnoms","wigglejumps","sniffs","tumbles","slides","chirps","burps","sparkles","waddles","rambles","blinks","mews"],Et=["fluffy","silly","yummy","squishy","wobbly","magical","tiny","sleepy","wiggly","bubbly","glittery","fuzzy","jiggly","sparkly","giggly","crunchy","goofy","soft","mushy","sweet","loopy","floaty","bonkers","chewy","ticklish","dreamy","pastel","cozy","teensy","grumbly"],Tt=["Boop!","Wiggle achieved.","Oops, {noun} everywhere!","Tiny {adj} {noun}, big {adj} {noun}.","Snuggle initiated with a {adj} {noun}.","{adj} vibes only, powered by {noun}.","No {noun}, no {noun}.","Bounce first, {verb} later.","Mlem. {verb}. {noun}.","{noun} go brrr and {verb}.","Why not? {noun} did. Then {noun} followed.","A {adj} {noun} just {verb} near the {adj} window.","That {adj} {noun} stole my {noun}!","Look, a {adj} {noun} trying to {verb} again!","Every {noun} deserves a {adj} nap.","The {adj} {noun} is my {adj} spirit animal.","Someone call the {noun}, it’s {verb}ing and {verb}ing again!","Don’t touch the {adj} {noun}. It {verb}s loudly.","{noun} forgot how {noun}s work and just {verb}ed.","There once was a {adj} {noun} who loved to {verb} with a {adj} {noun} all day.","Apparently, {noun}s are banned from {verb}ing and {verb}ing in the {noun} library.","That {adj} noise? Just a {noun} learning to {verb} on a {adj} {noun}.","I saw a {adj} {noun} {verb} so hard, it became a {adj} muffin.","The {adj} {noun} met a {adj} pickle and everything {verb}ed.","{noun}s are like {noun}: {adj}, unpredictable, and wiggly.","Don’t judge a {adj} {noun} by its ability to {verb}, or by its {adj} hat.","All I wanted was peace, but a {adj} {noun} with a {adj} {noun} had other plans.","One {adj} morning, a {adj} {noun} decided it was finally time to {verb}, but halfway through, it tripped on a {noun} and turned into a {adj} marshmallow.","I tried to be {adj} today, but then a {noun} {verb}ed across my {noun} and typed “asdfgh{noun}” repeatedly.","If you think you’ve seen everything, wait until a {adj} {noun} {verb}s on a {noun} wearing {adj} socks with tiny {noun}s.","No one ever believed the stories about the ancient {adj} {noun} who could {verb} with such {adj} grace that entire {noun}s turned pink out of embarrassment.","A curious {adj} {noun} wandered into a {noun} shop, not knowing that its destiny involved twelve {adj} {noun}s, one rubber {noun}, and a suspiciously quiet {adj} llama.","In a land where every {adj} {noun} was made of pudding and the sky was {adj} whipped cream, one brave {adj} {noun} set out to discover the legendary Spoon of {noun}s, facing obstacles like bouncing {noun}s, sassy {noun}s, and the Great Wobble of the {noun}.","Once upon a {adj} time, long before the {noun}s learned to {verb}, there existed a tiny {adj} {noun} who dreamed of swimming in a pool made entirely of {adj} glitter pudding while {verb}ing off-key lullabies to passing {noun}s with monocles.","The Council of {noun}s gathered in {adj} secret when the sacred {adj} {noun} started to {verb} uncontrollably, threatening the entire {adj} dessert-based civilization with spontaneous {noun} jiggles and uncontainable {noun} fits across the {noun}.","Hey... do you ever wonder if {noun}s dream of {noun}s?","Okay but hear me out: what if the {adj} {noun} could actually {verb} backwards?","Can we talk about the {noun} that just {verb}ed and vanished?","So I was talking to a {noun}, and it told me to stop being {adj}. Rude.","Not to alarm you, but there’s a {adj} {noun} behind you doing the {verb}.","Why does this {noun} keep staring at me like I owe it pudding?","Is this a safe space to admit I accidentally {verb}ed a {noun}?","I just walked into the room and someone shouted “{adj} {noun}!” — what did I miss?","Wait... we were supposed to bring a {noun}? No one told me!","Okay but what if the {adj} {noun} has feelings too?","Be honest, do I look like a {noun} that forgot how to {verb}?",'If I say "oops", do I still have to explain why the {noun} is glowing?',"I don’t know what’s going on but I brought snacks and a confused {noun}.","Do you think pudding knows it’s pudding? Just a thought.","Is this about the time I {verb}ed the {adj} {noun} by accident? Because I can explain.","Wait, are we talking about {noun}s or am I on the wrong chat again?",'What is this group even about? I just saw "pudding" and joined.',"Hi! I have no idea what’s happening but I’m here and I brought a {noun}.","I blinked and now there’s a {adj} {noun} in charge of everything.","Can someone please explain why the {noun} is floating and chanting?","Okay who gave the {noun} access to glitter and emotional support pickles?","I came for a calm discussion and now there’s a {adj} battle between {noun}s.","Not sure if I’m early, late, or inside a {noun} dream.","I was gone for 3 minutes and now someone’s riding a {noun} into the pudding realm.","This isn’t the pudding appreciation group, is it? ...oh no.","So... who summoned the {adj} {noun} this time? Be honest.","I came here for vibes and stayed for the {noun}s.","Does anyone else hear faint giggling or is that just the {adj} {noun} again?","I feel like I missed step one, two, and also three of this conversation.","All I asked was “what’s up?” and now I’m emotionally attached to a {noun}.",'Me: "I’ll be normal today." Also me: *{verb}s into a meeting riding a {adj} {noun}*','"It’s just pudding," they said. "It can’t hurt you," they said. They were wrong.',"I said one nice thing to a {noun} and now it follows me everywhere.","Can we take a moment to appreciate how the {adj} {noun} is just vibing?","Who put a tiny hat on the {noun}? Because that’s adorable.","My life has been different ever since the {noun} started {verb}ing.","Raise your hand if you’ve ever been personally attacked by a {adj} {noun}.",'"Don’t be weird," they said. So I became a {noun} instead.',"Do {noun}s have feelings? Asking for a {adj} friend.","I trusted the {noun} and all I got was a glitter-covered sock.","Plot twist: the {adj} {noun} was inside us all along.","The {adj} {noun} {verb} and {verb} all over the {adj} {noun}!","Oops! {noun}s {verb}ed into the {adj} {noun} while {verb}ing crazily.","{adj}, {adj}, and more {adj} {noun}s just {verb}ed by!","Why does the {adj} {noun} keep {verb}ing and {verb}ing without stopping?","Look! A {adj} {noun}, a {adj} {noun}, and a {noun} all {verb}ing together!","Sometimes, the {noun} just {verb}s, then {verb}s again, and never stops being {adj}.","{noun}, {noun}, and {noun} — all {verb}ing and {verb}ing in a {adj} {noun}.","I saw a {adj} {noun} {verb}, then another {noun} {verb}ing with a {adj} {noun}.","The {noun} {verb}s {verb} while the {adj} {noun} {verb}s and the {noun} just {verb}s.","Can a {adj} {noun} {verb} {verb} without a {adj} {noun} watching?","Whoa! The {adj} {noun} just {verb}ed... and then {verb}ed again!","Hey... did you see that {adj} {noun} {verb} over there?","Umm, the {noun} is {verb}ing but also {verb}ing and {verb}ing!","Lol! {noun}s {verb} so {adj}ly, it’s impossible not to giggle.",'"Hey! What’s up?" asked the {adj} {noun}, who {verb}ed loudly.','"I’m just a {adj} {noun} trying to {verb}, you know?"','"Did you see the {adj} {noun} that just {verb}ed in the pudding?"','"No way! The {noun} {verb}s better than me!"','"Wait, the {adj} {noun} said it would {verb}, but it {verb}ed instead!"',"Once upon a {adj} {noun}, a group of {adj} {noun}s {verb}ed through the {adj} forest, singing {adj} songs and eating {noun}s made of pudding.","The legend tells of a {adj} {noun} who could {verb} faster than any {noun} ever seen, leaving trails of {adj} sparkles behind.","Every day, the {adj} {noun} would {verb} around the {adj} meadow, trying to convince the {noun}s to join the grand pudding party.","No one knows why the {adj} {noun} suddenly {verb}ed and then {verb}ed again, but everyone agrees it was the cutest thing they ever saw.","In the kingdom of {adj} {noun}s, only the bravest {noun} dared to {verb} the giant pudding monster, armed with nothing but {adj} smiles and jellybeans.","{adj} {noun} {verb} {verb} {verb} {noun} {verb} {adj} {noun} {verb} {noun}!","{noun} {noun} {verb} {adj} {noun} and then {verb} {verb} the {adj} {noun}.","{verb} the {adj} {noun}, then {verb} the {noun} while {verb}ing {adj}ly.","Can the {adj} {noun} {verb} and {verb} the {adj} {noun} at the same time?","{noun} {verb} {noun} {verb}, but the {adj} {noun} {verb}s better.","Boop! The {adj} {noun} just {verb}ed in the pudding.","Bloop bloop, the {noun} is {verb}ing all over again!","Mlem mlem, a {adj} {noun} {verb}s quietly in the corner.","Splat! {noun} {verb}ed right on the {adj} {noun}.","Yum! A {adj} {noun} just {verb}ed in my mouth.","Do {noun}s really {verb} when nobody’s watching?","Why does the {adj} {noun} always {verb} at midnight?","Can a {noun} be too {adj} to {verb} properly?","Is it normal for a {adj} {noun} to {verb} three times in a row?","Who taught the {noun} to {verb} like that?","Wait, did the {adj} {noun} just {verb} itself?","I can’t believe the {noun} {verb}ed into a {adj} {noun}!","Suddenly, a {adj} {noun} appeared and started to {verb} wildly.","That {noun} was {verb}ing so {adj}ly it broke the pudding meter.","Everyone’s talking about the {adj} {noun} that {verb}ed out of nowhere."],xt=class{static defaultWords=yt;static defaultEmojis=bt;static defaultNouns=wt;static defaultVerbs=vt;static defaultAdjectives=Et;static defaultTemplates=Tt;config={minLength:10,maxLength:300,readable:!0,useEmojis:!0,includeNumbers:!0,includeSymbols:!0,allowWeirdSpacing:!1,emojiSet:[],wordSet:[],mode:"mixed",grammar:{templates:[],nouns:[],verbs:[],adjectives:[]},repeatWords:!0,emojiPlacement:"inline",line:{minLength:20,maxLength:120,emojiChance:.3}};constructor(e={}){this.symbols="!@#$%^&*()-_=+[]{}|;:,.<>?/\\~".split("");const{minLength:t,maxLength:r,readable:n,useEmojis:o,includeNumbers:i,includeSymbols:s,allowWeirdSpacing:a,emojiSet:l,wordSet:u,mode:c,grammar:h,repeatWords:d,emojiPlacement:f,paragraphs:m,line:g}=e;if(void 0!==t&&(!Number.isInteger(t)||t<1))throw new TypeError("config.minLength must be an integer >= 1");if(void 0!==r&&(!Number.isInteger(r)||r<1))throw new TypeError("config.maxLength must be an integer >= 1");if(void 0!==t&&void 0!==r&&t>r)throw new RangeError("config.minLength cannot be greater than config.maxLength");if(void 0!==n&&"boolean"!=typeof n)throw new TypeError("config.readable must be a boolean");if(void 0!==o&&"boolean"!=typeof o)throw new TypeError("config.useEmojis must be a boolean");if(void 0!==i&&"boolean"!=typeof i)throw new TypeError("config.includeNumbers must be a boolean");if(void 0!==s&&"boolean"!=typeof s)throw new TypeError("config.includeSymbols must be a boolean");if(void 0!==a&&"boolean"!=typeof a)throw new TypeError("config.allowWeirdSpacing must be a boolean");if(void 0!==l&&!Array.isArray(l))throw new TypeError("config.emojiSet must be an array of strings");if(void 0!==u&&!Array.isArray(u))throw new TypeError("config.wordSet must be an array of strings");if(void 0!==c&&!["mixed","readable","chaotic","natural"].includes(c))throw new RangeError('config.mode must be one of: "mixed", "readable", "chaotic", "natural');if(void 0!==h){if("object"!=typeof h||null===h)throw new TypeError("config.grammar must be an object");const{templates:e,nouns:t,verbs:r,adjectives:n}=h;if(void 0!==e&&!Array.isArray(e))throw new TypeError("config.grammar.templates must be an array of strings");if(void 0!==t&&!Array.isArray(t))throw new TypeError("config.grammar.nouns must be an array of strings");if(void 0!==r&&!Array.isArray(r))throw new TypeError("config.grammar.verbs must be an array of strings");if(void 0!==n&&!Array.isArray(n))throw new TypeError("config.grammar.adjectives must be an array of strings")}if(void 0!==d&&"boolean"!=typeof d)throw new TypeError("config.repeatWords must be a boolean");if(void 0!==f&&!["inline","end","none"].includes(f))throw new RangeError('config.emojiPlacement must be one of: "inline", "end", "none"');if(void 0!==m){if("object"!=typeof m)throw new TypeError("config.paragraphs must be an object or null");const{min:e,max:t}=m;if(void 0!==e&&(!Number.isInteger(e)||e<1))throw new TypeError("config.paragraphs.min must be an integer >= 1");if(void 0!==t&&(!Number.isInteger(t)||t<1))throw new TypeError("config.paragraphs.max must be an integer >= 1");if(void 0!==e&&void 0!==t&&e>t)throw new RangeError("config.paragraphs.min cannot be greater than config.paragraphs.max")}if(void 0!==g){if("object"!=typeof g||null===g)throw new TypeError("config.line must be an object");const{minLength:e,maxLength:t,emojiChance:r}=g;if(void 0!==e&&(!Number.isInteger(e)||e<1))throw new TypeError("config.line.minLength must be an integer >= 1");if(void 0!==t&&(!Number.isInteger(t)||t<1))throw new TypeError("config.line.maxLength must be an integer >= 1");if(void 0!==e&&void 0!==t&&e>t)throw new RangeError("config.line.minLength cannot be greater than config.line.maxLength");if(void 0!==r&&("number"!=typeof r||r<0||r>1))throw new RangeError("config.line.emojiChance must be a number between 0 and 1")}this.config.emojiSet=[...bt],this.config.wordSet=[...yt],this.config.grammar.templates=[...Tt],this.config.grammar.nouns=[...wt],this.config.grammar.verbs=[...vt],this.config.grammar.adjectives=[...Et],Object.assign(this.config,e)}configure(e={}){return Object.assign(this.config,e),this}setGrammarTemplates(...e){return this.config.grammar.templates=e.flat(),this}addGrammarTemplates(...e){return this.config.grammar.templates.push(...e.flat()),this}setGrammarNouns(...e){return this.config.grammar.nouns=e.flat(),this}addGrammarNouns(...e){return this.config.grammar.nouns.push(...e.flat()),this}setGrammarVerbs(...e){return this.config.grammar.verbs=e.flat(),this}addGrammarVerbs(...e){return this.config.grammar.verbs.push(...e.flat()),this}setGrammarAdjectives(...e){return this.config.grammar.adjectives=e.flat(),this}addGrammarAdjectives(...e){return this.config.grammar.adjectives.push(...e.flat()),this}removeGrammarTemplates(...e){const t=new Set(e.flat());return this.config.grammar.templates=this.config.grammar.templates.filter(e=>!t.has(e)),this}removeGrammarNouns(...e){const t=new Set(e.flat());return this.config.grammar.nouns=this.config.grammar.nouns.filter(e=>!t.has(e)),this}removeGrammarVerbs(...e){const t=new Set(e.flat());return this.config.grammar.verbs=this.config.grammar.verbs.filter(e=>!t.has(e)),this}removeGrammarAdjectives(...e){const t=new Set(e.flat());return this.config.grammar.adjectives=this.config.grammar.adjectives.filter(e=>!t.has(e)),this}setWords(...e){return this.config.wordSet=e.flat(),this}addWords(...e){return this.config.wordSet.push(...e.flat()),this}removeWords(...e){const t=new Set(e.flat());return this.config.wordSet=this.config.wordSet.filter(e=>!t.has(e)),this}setEmojis(...e){return this.config.emojiSet=e.flat(),this}addEmojis(...e){return this.config.emojiSet.push(...e.flat()),this}removeEmojis(...e){const t=new Set(e.flat());return this.config.emojiSet=this.config.emojiSet.filter(e=>!t.has(e)),this}_getRandomItem(e){return e[Math.floor(Math.random()*e.length)]}_generateChunk(){const{wordSet:e,emojiSet:t,includeNumbers:r,includeSymbols:n,useEmojis:o,readable:i,mode:s,emojiPlacement:a}=this.config;if("natural"===s)return this._generateNaturalSentence();const l=[];return(i||"readable"===s||"mixed"===s)&&l.push(this._getRandomItem(e)),"chaotic"!==s&&"mixed"!==s||l.push(Math.random().toString(36).slice(2)),r&&l.push(Math.floor(99999*Math.random()).toString()),n&&l.push(this._getRandomItem(this.symbols)),"inline"===a&&o&&t.length&&l.push(this._getRandomItem(t)),this._getRandomItem(l)}_generateNaturalSentence(){const{templates:e,nouns:t,verbs:r,adjectives:n}=this.config.grammar;return this._getRandomItem(e).replace(/{noun}/g,()=>this._getRandomItem(t)).replace(/{verb}/g,()=>this._getRandomItem(r)).replace(/{adj}/g,()=>this._getRandomItem(n))}_generateLine(e,t){const{allowWeirdSpacing:r,repeatWords:n,readable:o,emojiSet:i,useEmojis:s,emojiPlacement:a,line:l}=this.config,u=[];for(t??=new Set;u.join(" ").length<e;){let e=this._generateChunk();!n&&t.has(e)||(t.add(e),r&&(Math.random()<.1&&(e="\n"+e),Math.random()<.1&&(e=" "+e),Math.random()<.05&&(e=e.toUpperCase())),u.push(e))}let c=u.join(o?" ":"");return"end"===a&&s&&i.length&&Math.random()<(l?.emojiChance||0)&&(c+=" "+this._getRandomItem(i)),c}_generateParagraphLines(e){const{line:t}=this.config,r=[],n=new Set;let o=0;for(;o<e;){const i=Math.floor(Math.random()*(t.maxLength-t.minLength+1)+t.minLength),s=Math.min(i,e-o);r.push(this._generateLine(s,n)),o+=s}return r}generate(){const{minLength:e,maxLength:t,paragraphs:r}=this.config,n=Math.floor(Math.random()*(t-e+1))+e;if(r&&"object"==typeof r){const e=Math.floor(Math.random()*(r.max-r.min+1))+r.min,t=Math.floor(n/e),o=[];for(let r=0;r<e;r++){const e=this._generateParagraphLines(t);o.push(e.join("\n"))}return o.join("\n\n")}return this._generateParagraphLines(n).join("\n")}},St=class{#Xe=new Map;#Ke=10;#Qe=!1;setThrowOnMaxListeners(e){if("boolean"!=typeof e)throw new TypeError("setThrowOnMaxListeners(value): value must be a boolean");this.#Qe=e}getThrowOnMaxListeners(){return this.#Qe}#Ze(e,t,{once:r=!1}={}){let n=this.#Xe.get(e);Array.isArray(n)||(n=[],this.#Xe.set(e,n)),n.unshift({handler:t,config:{once:r}});const o=this.#Ke;if(o>0&&n.length>o){const t=`Possible memory leak detected. ${n.length} "${e}" listeners added. Use setMaxListeners() to increase limit.`;if(this.#Qe)throw new Error(t);console.warn(t)}}prependListener(e,t){if("string"!=typeof e)throw new TypeError("prepend(event, handler): event name must be a string");if("function"!=typeof t)throw new TypeError("prepend(event, handler): handler must be a function");this.#Ze(e,t)}prependListenerOnce(e,t){if("string"!=typeof e)throw new TypeError("prependOnceListener(event, handler): event name must be a string");if("function"!=typeof t)throw new TypeError("prependOnceListener(event, handler): handler must be a function");const r=(...n)=>{this.off(e,r),t(...n)};return this.#Ze(e,r,{once:!0}),r}#et(e,t,{once:r=!1}={}){let n=this.#Xe.get(e);Array.isArray(n)||(n=[],this.#Xe.set(e,n)),n.push({handler:t,config:{once:r}});const o=this.#Ke;if(o>0&&n.length>o){const t=`Possible memory leak detected. ${n.length} "${e}" listeners added. Use setMaxListeners() to increase limit.`;if(this.#Qe)throw new Error(t);console.warn(t)}}on(e,t){if("string"!=typeof e)throw new TypeError("on(event, handler): event name must be a string");if("function"!=typeof t)throw new TypeError("on(event, handler): handler must be a function");return this.#et(e,t)}once(e,t){if("string"!=typeof e)throw new TypeError("The event name must be a string.");if("function"!=typeof t)throw new TypeError("once(event, handler): handler must be a function");const r=n=>{this.off(e,r),"function"==typeof t&&t(n)};return this.#et(e,r,{once:!0}),r}appendListener(e,t){return this.on(e,t)}appendListenerOnce(e,t){return this.once(e,t)}off(e,t){if("string"!=typeof e)throw new TypeError("off(event, handler): event name must be a string");if("function"!=typeof t)throw new TypeError("off(event, handler): handler must be a function");const r=this.#Xe.get(e);if(!Array.isArray(r))return;const n=r.findIndex(e=>e.handler===t);-1!==n&&r.splice(n,1),0===r.length&&this.#Xe.delete(e)}offAll(e){if("string"!=typeof e)throw new TypeError("The event name must be a string.");this.#Xe.delete(e)}offAllTypes(){this.#Xe.clear()}listenerCount(e){if("string"!=typeof e)throw new TypeError("listenerCount(event): event name must be a string");const t=this.#Xe.get(e);return Array.isArray(t)?t.length:0}listeners(e){if("string"!=typeof e)throw new TypeError("listeners(event): event name must be a string");const t=this.#Xe.get(e);return Array.isArray(t)?[...t].filter(e=>!e.config.once).map(e=>e.handler):[]}onceListeners(e){if("string"!=typeof e)throw new TypeError("onceListeners(event): event name must be a string");const t=this.#Xe.get(e);return Array.isArray(t)?[...t].filter(e=>e.config.once).map(e=>e.handler):[]}allListeners(e){if("string"!=typeof e)throw new TypeError("allListeners(event): event name must be a string");const t=this.#Xe.get(e);return Array.isArray(t)?[...t].map(e=>e.handler):[]}eventNames(){return[...this.#Xe.keys()]}emit(e,...t){if("string"!=typeof e)throw new TypeError("emit(event, data): event name must be a string");const r=this.#Xe.get(e);return!(!Array.isArray(r)||0===r.length||(r.forEach(e=>e.handler(...t)),0))}setMaxListeners(e){if(!Number.isInteger(e)||e<0)throw new TypeError("setMaxListeners(n): n must be a non-negative integer");this.#Ke=e}getMaxListeners(){return this.#Ke}};class Ct{static Utils={...e,TinyHtml:Le};#tt=new St;setThrowOnMaxListeners(e){return this.#tt.setThrowOnMaxListeners(e)}getThrowOnMaxListeners(){return this.#tt.getThrowOnMaxListeners()}prependListener(e,t){return this.#tt.prependListener(e,t)}prependListenerOnce(e,t){return this.#tt.prependListenerOnce(e,t)}appendListener(e,t){return this.#tt.appendListener(e,t)}appendListenerOnce(e,t){return this.#tt.appendListenerOnce(e,t)}on(e,t){return this.#tt.on(e,t)}once(e,t){return this.#tt.once(e,t)}off(e,t){return this.#tt.off(e,t)}offAll(e){return this.#tt.offAll(e)}offAllTypes(){return this.#tt.offAllTypes()}listenerCount(e){return this.#tt.listenerCount(e)}listeners(e){return this.#tt.listeners(e)}onceListeners(e){return this.#tt.onceListeners(e)}allListeners(e){return this.#tt.allListeners(e)}eventNames(){return this.#tt.eventNames()}emit(e,...t){return this.#tt.emit(e,...t)}setMaxListeners(e){return this.#tt.setMaxListeners(e)}getMaxListeners(){return this.#tt.getMaxListeners()}#rt=new WeakMap;#nt=new WeakMap;#ot=new WeakMap;#it=new WeakMap;#st=new WeakMap;#at=new WeakMap;#lt=null;#ut=null;#ct=new Set(["IMG","IFRAME","VIDEO"]);#ht=null;#dt=!1;#ft=!1;#mt=!1;#gt=!1;#pt="";#yt=!1;#Q=!1;#bt=!1;#wt=!1;#vt=!1;#Et=!1;#Tt=0;#xt=0;#St=0;#Ct=0;#Lt=0;#At;#F;#_t=new Set;constructor(e,{extraScrollBoundary:t=0,autoScrollBottom:r=!0,observeMutations:n=!0,preserveScrollOnLayoutShift:o=!0,debounceTime:i=100,querySelector:s=null,attributeFilter:a=["class","style","src","data-*","height","width"]}={}){if(!(e instanceof Element||e===window))throw new TypeError("TinySmartScroller: 'target' must be a DOM Element or 'window', but got "+typeof e);if("number"!=typeof t||Number.isNaN(t))throw new TypeError(`TinySmartScroller: 'extraScrollBoundary' must be a valid number, received ${t}`);if("boolean"!=typeof r)throw new TypeError("TinySmartScroller: 'autoScrollBottom' must be a boolean, received "+typeof r);if("boolean"!=typeof n)throw new TypeError("TinySmartScroller: 'observeMutations' must be a boolean, received "+typeof n);if("boolean"!=typeof o)throw new TypeError("TinySmartScroller: 'preserveScrollOnLayoutShift' must be a boolean, received "+typeof o);if("number"!=typeof i||i<0||Number.isNaN(i))throw new TypeError(`TinySmartScroller: 'debounceTime' must be a non-negative number, received ${i}`);if(null!==s&&"string"!=typeof s)throw new TypeError("TinySmartScroller: 'querySelector' must be a string or null, received "+typeof s);if(!(null===a||Array.isArray(a)||a instanceof Set))throw new TypeError("TinySmartScroller: 'attributeFilter' must be an array, Set, or null. Got "+typeof a);let l;this.#F=e instanceof Window?document.documentElement:e,this.#yt=e instanceof Window,this.#wt=r,this.#vt=n,this.#Et=o,this.#Tt=i,this.#Lt=t,this.#pt=s||"",this.#At=new Set(a||void 0),this.#ht=()=>{this._scrollDataUpdater(),clearTimeout(l),l=setTimeout(()=>this._onScroll(),this.#Tt)},(this.#yt?window:this.#F).addEventListener("scroll",this.#ht,{passive:!0}),this.#vt&&(this._observeMutations(),this._observeResizes(this.#F.children)),this._scrollDataUpdater()}getSimpleOnHeight(e=[]){if(!Array.isArray(e))throw new TypeError("getSimpleOnHeight(filter): filter must be an array of tag names");return(t,r,n)=>{if(e.length>0&&!e.includes(t.tagName)||n.now!==n.old)return;const o=r.old;return{height:r.now.height-o.height,width:0}}}addSimpleOnHeight(e){if(!Array.isArray(e))throw new TypeError("addSimpleOnHeight(filter): filter must be an array of tag names");const t=this.getSimpleOnHeight(e);return this.onSize(t),t}getLoadTags(){return Array.from(this.#ct)}addLoadTag(e){if("string"!=typeof e)throw new TypeError("addLoadTag(tag): tag must be a string");this.#ct.add(e.toUpperCase())}removeLoadTag(e){if("string"!=typeof e)throw new TypeError("removeLoadTag(tag): tag must be a string");this.#ct.delete(e.toUpperCase())}hasLoadTag(e){if("string"!=typeof e)throw new TypeError("hasLoadTag(tag): tag must be a string");return this.#ct.has(e.toUpperCase())}resetLoadTags(e=!1){if("boolean"!=typeof e)throw new TypeError("resetLoadTags(addDefault): addDefault must be a boolean");this.#ct.clear(),e&&(this.#ct.add("IMG"),this.#ct.add("IFRAME"),this.#ct.add("VIDEO"))}getAttributeFilters(){return Array.from(this.#At)}addAttributeFilter(e){if("string"!=typeof e)throw new TypeError("addAttributeFilter(attr): attr must be a string");this.#At.add(e)}removeAttributeFilter(e){if("string"!=typeof e)throw new TypeError("removeAttributeFilter(attr): attr must be a string");this.#At.delete(e)}hasAttributeFilter(e){if("string"!=typeof e)throw new TypeError("hasAttributeFilter(attr): attr must be a string");return this.#At.has(e)}resetAttributeFilters(e=!1){if("boolean"!=typeof e)throw new TypeError("resetAttributeFilters(addDefault): addDefault must be a boolean");this.#At.clear(),e&&["class","style","src","data-*","height","width"].forEach(e=>this.#At.add(e))}onSize(e){if(!this.#Q){if("function"!=typeof e)throw new TypeError("onSize(handler): handler must be a function");this.#_t.add(e)}}offSize(e){if(!this.#Q){if("function"!=typeof e)throw new TypeError("offSize(handler): handler must be a function");this.#_t.delete(e)}}_scrollDataUpdater(){const e=new Map;return this.#F.querySelectorAll(this.#pt||"*").forEach(t=>{const r=this.#ot.get(t)??!1;this.#it.set(t,r);const n=Le.isInContainer(this.#F,t);this.#ot.set(t,n),e.set(t,{oldIsVisible:r,isVisible:n})}),e}_emit(e,t){this.emit(e,t)}_onScroll(){if(this.#Q)return;const e=this._scrollDataUpdater(),t=this.#F,r=t.scrollTop,n=t.scrollHeight,o=t.clientHeight,i={scrollTop:r,scrollHeight:n,clientHeight:o};let s=null,a=null;const l=0===r,u=r+o>=n-1,c=r<=0+this.#Lt,h=r+o>=n-1-this.#Lt;l&&u?s="all":l?s="top":u&&(s="bottom"),c&&h?a="all":c?a="top":h&&(a="bottom"),this.#ft=l,this.#dt=u,this.#mt=c,this.#gt=h,this.#bt=!(this.#wt&&this.#dt),this.#Ct=n-r-o,this.emit("onScrollBoundary",{status:s,...i,scrollCache:e}),this.emit("onExtraScrollBoundary",{status:a,...i,scrollCache:e}),this.#bt?this.emit("onScrollPause",{...i,scrollCache:e}):this.emit("onAutoScroll",{...i,scrollCache:e})}_fixScroll(e=[]){if(this.#Q)return;if(!Array.isArray(e))throw new TypeError("_fixScroll: targets must be an array of Elements");const t=this.#F.scrollHeight,r=this.#F.scrollTop,n=this.#F.scrollHeight-this.#F.scrollTop-this.#F.clientHeight,o=this.#F.scrollHeight-t,i=()=>{const t={height:0,width:0};for(const r of e){const e=this.#rt.get(r)||{height:0,width:0},n=this.#nt.get(r)||{height:0,width:0};this.#_t.forEach(o=>{const i=o(r,{old:e,now:n},{old:this.#St,now:this.#xt});if(this.#ot.get(r)||this.#st.get(r)){if(void 0!==i&&"object"!=typeof i)throw new Error("_fixScroll: size filter must return an object or undefined");if(void 0===i)return;t.height=i.height,t.width=i.width}})}if("number"!=typeof t.height&&t.height<0)throw new Error("_fixScroll: invalid scrollSize.height value");if("number"!=typeof t.width&&t.width<0)throw new Error("_fixScroll: invalid scrollSize.width value");if(0!==t.height||0!==t.width)for(const t of e)this.#st.set(t,this.#ot.get(t)??!1),this.#at.set(t,this.#it.get(t)??!1);return t};if(this.#St>0&&Le.hasScroll(this.#F).v&&this.#wt&&this.#Et&&!this.#dt&&!this.#ft){const e=i();this.#F.scrollTop=r+o+e.height,e.width>0&&(this.#F.scrollLeft=this.#F.scrollLeft+e.width)}else!this.#bt&&this.#wt?(i(),this.scrollToBottom()):this.#wt||this.#dt||(i(),this.#F.scrollTop=this.#F.scrollHeight-this.#F.clientHeight-n)}_observeMutations(){this.#ut=new MutationObserver(e=>{this.#Q||(this._scrollDataUpdater(),this.#St=this.#xt,this.#xt=this.#F.childElementCount,e.forEach(e=>{e.addedNodes.forEach(e=>{if(e instanceof Element&&1===e.nodeType&&(this._observeResizes([e]),this._listenLoadEvents(e),this.#pt)){const t=e.querySelectorAll(this.#pt);this._observeResizes(t),this._listenLoadEvents(t)}})}),this._fixScroll())}),this.#ut.observe(this.#F,{childList:!0,subtree:!0,attributes:!0,attributeFilter:this.#At.size>0?Array.from(this.#At):void 0})}_observeResizes(e){this.#lt||(this.#lt=new ResizeObserver(e=>{if(this.#Q)return;this._scrollDataUpdater();const t=[];for(const r of e){const e=r.target,n=this.#nt.get(e);n&&this.#rt.set(e,n);const{width:o,height:i}=r.contentRect;this.#nt.set(e,{width:o,height:i}),t.push(e)}this._fixScroll(t)})),Array.from(e).forEach(e=>{if(!this.#lt)throw new Error("_observeResizes: ResizeObserver instance is not initialized");this.#lt.observe(e)})}_listenLoadEvents(e){this.#Q||(e instanceof NodeList?Array.from(e):[e]).forEach(e=>{this.#ct.has(e.tagName)&&(e.complete||e.addEventListener("load",()=>{this._scrollDataUpdater(),!this.#bt&&this.#wt&&this.scrollToBottom()}))})}get target(){return this.#F}getOldSize(e){return this.#rt.get(e)??null}getNewSize(e){return this.#nt.get(e)??null}wasVisible(e){return this.#it.get(e)??!1}isVisible(e){return this.#ot.get(e)??!1}wasTimedVisible(e){return this.#at.get(e)??!1}isTimedVisible(e){return this.#st.get(e)??!1}setExtraScrollBoundary(e){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("setExtraScrollBoundary(value): value must be a valid number");this.#Lt=e}getExtraScrollBoundary(){return this.#Lt}getLastKnownScrollBottomOffset(){return this.#Ct}scrollToBottom(){this.#F.scrollTop=this.#F.scrollHeight}scrollToTop(){this.#F.scrollTop=0}isUserAtCustomBottom(){return this.#gt}isUserAtCustomTop(){return this.#mt}isUserAtBottom(){return this.#dt}isUserAtTop(){return this.#ft}isScrollPaused(){return this.#bt}isWindow(){return this.#yt}isDestroyed(){return this.#Q}getAutoScrollBottom(){return this.#wt}getObserveMutations(){return this.#vt}getPreserveScrollOnLayoutShift(){return this.#Et}getDebounceTime(){return this.#Tt}getElemAmount(){return this.#xt}getPrevElemAmount(){return this.#St}getQuerySelector(){return this.#pt}destroy(){if(this.#Q)return;this.#Q=!0,this.#ut&&(this.#ut.disconnect(),this.#ut=null),this.#lt&&(this.#lt.disconnect(),this.#lt=null);const e=this.#yt?window:this.#F;this.#ht&&e.removeEventListener("scroll",this.#ht),this.#rt=new WeakMap,this.#nt=new WeakMap,this.#ot=new WeakMap,this.#it=new WeakMap,this.#st=new WeakMap,this.#at=new WeakMap,this.#tt.offAllTypes(),this.#_t.clear(),this.#ct.clear()}}const Lt=Ct,At=class{#H;#Dt;#kt;constructor(e,{openTag:t="[",closeTag:r="]"}={}){if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))throw new TypeError("Element must be an input or textarea.");if("string"!=typeof t)throw new TypeError("openTag must be a string.");if("string"!=typeof r)throw new TypeError("closeTag must be a string.");this.#H=e,this.#Dt=t,this.#kt=r}getOpenTag(){return this.#Dt}getCloseTag(){return this.#kt}setOpenTag(e){if("string"!=typeof e)throw new TypeError("Open tag must be a string.");this.#Dt=e}setCloseTag(e){if("string"!=typeof e)throw new TypeError("Close tag must be a string.");this.#kt=e}ensureFocus(){return document.activeElement!==this.#H&&this.#H.focus(),this}focus(){return this.#H.focus(),this}getSelectionRange(){return{start:this.#H.selectionStart??NaN,end:this.#H.selectionEnd??NaN}}setSelectionRange(e,t,r=!0){if("number"!=typeof e||"number"!=typeof t)throw new TypeError("start and end must be numbers.");if("boolean"!=typeof r)throw new TypeError("preserveScroll must be a boolean.");const n=this.#H.scrollTop,o=this.#H.scrollLeft;return this.#H.setSelectionRange(e,t),r&&(this.#H.scrollTop=n,this.#H.scrollLeft=o),this}getValue(){return this.#H.value}setValue(e){if("string"!=typeof e)throw new TypeError("Value must be a string.");return this.#H.value=e,this}getSelectedText(){const{start:e,end:t}=this.getSelectionRange();return this.#H.value.slice(e,t)}insertText(e,{newCursor:t="end",autoSpacing:r=!1,autoSpaceLeft:n=r,autoSpaceRight:o=r}={}){if("string"!=typeof e)throw new TypeError("Text must be a string.");if(!["start","end","preserve"].includes(t))throw new TypeError("newCursor must be one of 'start', 'end', or 'preserve'.");if("boolean"!=typeof r)throw new TypeError("autoSpacing must be a boolean.");if("boolean"!=typeof n)throw new TypeError("autoSpaceLeft must be a boolean.");if("boolean"!=typeof o)throw new TypeError("autoSpaceRight must be a boolean.");const{start:i,end:s}=this.getSelectionRange(),a=this.#H.value,l=a[i-1]||"",u=a[s]||"",c=`${n&&l&&!/\s/.test(l)?" ":""}${e}${o&&u&&!/\s/.test(u)?" ":""}`,h=a.slice(0,i)+c+a.slice(s);this.setValue(h);let d=i;return"end"===t?d=i+c.length:"preserve"===t&&(d=i),this.setSelectionRange(d,d),this}deleteSelection(){return this.insertText(""),this}transformSelection(e){if("function"!=typeof e)throw new TypeError("transformer must be a function.");const{start:t}=this.getSelectionRange(),r=e(this.getSelectedText());return this.insertText(r),this.setSelectionRange(t,t+r.length),this}surroundSelection(e,t){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("prefix and suffix must be strings.");const r=this.getSelectedText();return this.insertText(`${e}${r}${t}`),this}moveCaret(e){if("number"!=typeof e)throw new TypeError("offset must be a number.");const{start:t}=this.getSelectionRange(),r=Math.max(0,t+e);return this.setSelectionRange(r,r),this}selectAll(){return this.setSelectionRange(0,this.#H.value.length),this}expandSelection(e,t){if("number"!=typeof e||"number"!=typeof t)throw new TypeError("before and after must be numbers.");const{start:r,end:n}=this.getSelectionRange(),o=Math.max(0,r-e),i=Math.min(this.#H.value.length,n+t);return this.setSelectionRange(o,i),this}replaceAll(e,t){if(!(e instanceof RegExp))throw new TypeError("regex must be a RegExp.");if("function"!=typeof t)throw new TypeError("replacer must be a function.");const r=this.#H.value.replace(e,t);return this.setValue(r),this}replaceInSelection(e,t){if(!(e instanceof RegExp))throw new TypeError("regex must be a RegExp.");if("function"!=typeof t)throw new TypeError("replacer must be a function.");const{start:r,end:n}=this.getSelectionRange(),o=this.#H.value,i=o.slice(r,n).replace(e,t),s=o.slice(0,r)+i+o.slice(n);return this.setValue(s),this.setSelectionRange(r,r+i.length),this}toggleCode(e){if("string"!=typeof e)throw new TypeError("codeName must be a string.");const t=this.getSelectedText();if(t.startsWith(e)&&t.endsWith(e)){const r=t.slice(e.length,t.length-e.length);this.insertText(r)}else this.insertText(`${e}${t}${e}`);return this}_insertAttr(e){let t="";if(Array.isArray(e)){if(!e.every(e=>"string"==typeof e))throw new TypeError("All entries in attributes array must be strings.");t=e.map(e=>`${e}`).join(" ")}else{if("object"!=typeof e||null===e)throw new TypeError("attributes must be an object or an array of strings.");t=Object.entries(e).map(([e,t])=>{if("string"!=typeof t)throw new TypeError("All entries in attributes object must be strings.");return`${e}${t.length>0?`="${t}"`:""}`}).join(" ")}return t}wrapWithTag(e,t={}){if("string"!=typeof e)throw new TypeError("tagName must be a string.");const r=this._insertAttr(t),n=r?`${this.#Dt}${e} ${r}${this.#kt}`:`${this.#Dt}${e}${this.#kt}`,o=`${this.#Dt}/${e}${this.#kt}`;return this.surroundSelection(n,o),this}insertTag(e,t="",r={}){if("string"!=typeof e)throw new TypeError("tagName must be a string.");if("string"!=typeof t)throw new TypeError("content must be a string.");const n=this._insertAttr(r),o=n?`${this.#Dt}${e} ${n}${this.#kt}`:`${this.#Dt}${e}${this.#kt}`,i=`${this.#Dt}/${e}${this.#kt}`;return this.insertText(`${o}${t}${i}`),this}insertSelfClosingTag(e,t={}){if("string"!=typeof e)throw new TypeError("tagName must be a string.");const r=this._insertAttr(t),n=r?`${this.#Dt}${e} ${r}${this.#kt}`:`${this.#Dt}${e}${this.#kt}`;return this.insertText(n),this}toggleTag(e,t={}){if("string"!=typeof e)throw new TypeError("tagName must be a string.");const r=this.getSelectedText(),n=new RegExp(`^\\[${e}(\\s+[^\\]]*)?\\]`),o=new RegExp(`\\[/${e}\\]$`),i=n.test(r),s=o.test(r);if(i&&s){const e=r.replace(n,"").replace(o,"");this.insertText(e)}else{const n=this._insertAttr(t),o=n?`${this.#Dt}${e} ${n}${this.#kt}`:`${this.#Dt}${e}${this.#kt}`,i=`${this.#Dt}/${e}${this.#kt}`;this.insertText(`${o}${r}${i}`)}return this}},_t=class{#Mt=!1;#It=!1;#Nt=null;#Bt=null;constructor(){void 0!==navigator.clipboard&&null!==navigator.clipboard&&(this.#It=!0,this.#Nt=e=>navigator.clipboard.writeText(e),this.#Bt=e=>navigator.clipboard.write([new ClipboardItem({[e.type]:e})])),this.#Mt=void 0!==document.execCommand&&null!==document.execCommand}setCopyText(e){if("function"!=typeof e)throw new TypeError("setCopyText expected a function that returns Promise<void>.");this.#Nt=e}setCopyBlob(e){if("function"!=typeof e)throw new TypeError("setCopyBlob expected a function that returns Promise<void>.");this.#Bt=e}copyText(e){if("string"!=typeof e)throw new TypeError("copyText expected a string.");if(this.#Nt)return this.#Nt(e);if(this.#Mt){const t=document.body,r=document.createElement("input");return r.style.position="fixed",r.style.opacity="0",r.value=e,t.append(r),r.select(),r.setSelectionRange(0,99999),document.execCommand("Copy"),r.remove(),new Promise(e=>e(void 0))}throw new Error("Clipboard API not found!")}copyBlob(e){if(!(e instanceof Blob))throw new TypeError("copyBlob expected a Blob instance.");return new Promise((t,r)=>{if(this.#Bt)return this.#Bt(e).then(t).catch(r);throw new Error("Clipboard API not found!")})}_handleBlob(e,t){return t.getType(e)}_handleText(e,t){return this._handleBlob(e,t).then(e=>e.text())}_readData(e=0,t=null,r=null,n=!1){return new Promise((o,i)=>{this._read(e).then(s=>{if(!s)return o(null);const a=[];let l=!0;const u=async(e,o)=>{if(l)if(null!==t&&"custom"!==t||"string"!=typeof r||!(!n&&e.startsWith(r)||n&&e===r))if(null!==t&&"text"!==t||"text/plain"!==e){if(null===t){l=!1;const t=await this._handleBlob(e,o);t&&a.push(t)}}else{l=!1;const t=await this._handleText(e,o);t&&a.push(t)}else{l=!1;const t=await this._handleBlob(e,o);t&&a.push(t)}},c=[],h=e=>{if(!(e instanceof ClipboardItem))throw new Error("Expected ClipboardItem when reading data.");for(const t in e.types)c.push(u(e.types[t],e))};if("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)&&e>-1)h(s),Promise.all(c).then(()=>{a[0]?o(a[0]):o(null)}).catch(i);else if(Array.isArray(s)){for(const e in s)h(s[e]);Promise.all(c).then(()=>o(a)).catch(i)}}).catch(i)})}async readText(e=0){const t=await this._readData(e,"text");if("string"!=typeof t)throw new Error("Failed to read text: expected string result.");return t}async readCustom(e=null,t=!1,r=0){const n=await this._readData(r,"custom",e,t);if(!(n instanceof Blob))throw new Error("Failed to read custom data: expected Blob.");return n}async readAllTexts(){const e=await this._readData(null,"text");if(!Array.isArray(e))throw new Error("Expected array of strings when reading all texts.");if(!e.every(e=>"string"==typeof e))throw new Error("Some values returned were not strings.");return e}async readAllCustom(e=null,t=!1){const r=await this._readData(null,"custom",e,t);if(!Array.isArray(r))throw new Error("Expected array of blobs when reading all custom items.");if(!r.every(e=>e instanceof Blob))throw new Error("Some values returned were not Blob instances.");return r}async readAllData(e=null,t=null){const r=await this._readData(null,e,t);if(!Array.isArray(r))throw new Error("Expected array result when reading all data.");return r}_read(e){return new Promise((t,r)=>{this.#It||r(new Error("Clipboard API not found!")),navigator.clipboard.read().then(r=>{if("number"==typeof e){if(Number.isNaN(e)||!Number.isFinite(e)||e<0)throw new Error(`Invalid index value: ${e}`);r[e]?t(r[e]):t(null)}t(r)}).catch(r)})}async readIndex(e){const t=await this._read(e);if(null!==t&&!(t instanceof ClipboardItem))throw new Error(`Value at index ${e} is not a ClipboardItem.`);return t}async readAll(){const e=await this._read(null);if(!Array.isArray(e))throw new Error("Expected array result from clipboard read.");for(const t of e)if(!(t instanceof ClipboardItem))throw new Error("Invalid item type found in clipboard result.");return e}isExecCommandAvailable(){return this.#Mt}isNavigatorClipboardAvailable(){return this.#It}getCopyTextFunc(){return this.#Nt}getCopyBlobFunc(){return this.#Bt}};class Dt{static _rca(e,t,r){let n=127,o=128;void 0===e&&(e=24),void 0===t&&(t="rgb"),!0===r&&(n=55,o=200);const i=2*Math.PI/e,s=[];for(let r=0;r<e;++r){const e=Math.sin(i*r+2)*n+o,a=Math.sin(i*r+0)*n+o,l=Math.sin(i*r+4)*n+o;switch(t){case"hex":s.push({hex:this.rgbToHex(Math.round(e),Math.round(a),Math.round(l))});break;case"rgb":s.push({r:e,g:a,b:l});break;case"hsl":const[t,r,n]=this.rgbaToHsl(Math.round(e),Math.round(a),Math.round(l));s.push({h:t,s:r,l:n})}}return s}static rcaRgb(e,t){return Dt._rca(e,"rgb",t)}static rcaHsl(e,t){return Dt._rca(e,"hsl",t)}static rcaHex(e,t){return Dt._rca(e,"hex",t)}static randomColor(){return`#${Math.floor(16777216*Math.random()).toString(16).padStart(6,"0")}`}static parseInput(e,t){if("string"==typeof e){if((e=e.trim().toLowerCase()).startsWith("#"))return this.hexToRgba(e);if(e.startsWith("rgb"))return this.rgbStringToRgbaArray(e);if(e.startsWith("hsl"))return this.hslStringToRgbaArray(e)}if("number"==typeof e)return this.intToRgba(e);if(Array.isArray(e)&&(3===e.length||4===e.length)&&e.every(e=>"number"==typeof e)){if(t){const[t,r,n,o]=e;if(t<=360&&r<=100&&n<=100)return this.hslToRgba(t,r,n,o)}return[...e,1].slice(0,4)}throw new Error("Unsupported color format.")}static hslToInt(e,t,r){const[n,o,i]=Dt.hslToRgba(e,t,r);return Dt.rgbToInt(n,o,i)}static hslToHex(e,t,r){const[n,o,i]=Dt.hslToRgba(e,t,r);return Dt.rgbToHex(n,o,i)}static hslStringToRgbaArray(e){const t=e.match(/[\d.]+/g)?.map(Number);if(!t||t.length<3)return[0,0,0,1];const[r,n,o,i=1]=t;return this.hslToRgba(r,n,o,i)}static hslToRgba(e,t,r,n=1){r/=100;const o=t=>(t+e/30)%12,i=(t/=100)*Math.min(r,1-r),s=e=>r-i*Math.max(-1,Math.min(o(e)-3,Math.min(9-o(e),1)));return[Math.round(255*s(0)),Math.round(255*s(8)),Math.round(255*s(4)),n]}static hslToRgb(e,t,r,n=1){return Dt.hslToRgba(e,t,r,n).slice(0,3)}static hexToInt(e){return parseInt(e.replace(/^#/,""),16)}static hexToHsl(e){const[t,r,n,o]=Dt.hexToRgba(e);return Dt.rgbaToHsl(t,r,n,o)}static hexToHsla(e){const[t,r,n,o]=Dt.hexToRgba(e);return Dt.rgbaToHsla(t,r,n,o)}static hexToRgba(e){3===(e=e.replace(/^#/,"")).length&&(e=e.split("").map(e=>e+e).join(""));const t=parseInt(e,16);return[t>>16&255,t>>8&255,255&t,1]}static hexToRgb(e){return this.hexToRgba(e).slice(0,3)}static rgbToHex(e,t,r){return"#"+[e,t,r].map(e=>e.toString(16).padStart(2,"0")).join("")}static rgbToInt(e,t,r){return e<<16|t<<8|r}static rgbaToHsla(e,t,r,n=1){e/=255,t/=255,r/=255;const o=Math.max(e,t,r),i=Math.min(e,t,r);let s=0,a=0,l=(o+i)/2;const u=o-i;if(0!==u){switch(a=u/(1-Math.abs(2*l-1)),o){case e:s=(t-r)/u+(t<r?6:0);break;case t:s=(r-e)/u+2;break;case r:s=(e-t)/u+4}s*=60}return[Math.round(s),Math.round(100*a),Math.round(100*l),n]}static rgbaToHsl(e,t,r,n){return this.rgbaToHsla(e,t,r,n).slice(0,3)}static rgbStringToRgbaArray(e){const t=e.match(/[\d.]+/g)?.map(Number);return t?[...t,1].slice(0,4):[]}static intToHsl(e){const[t,r,n,o]=Dt.intToRgba(e);return Dt.rgbaToHsl(t,r,n,o)}static intToHsla(e){const[t,r,n,o]=Dt.intToRgba(e);return Dt.rgbaToHsla(t,r,n,o)}static intToHex(e){return"#"+e.toString(16).padStart(6,"0")}static intToRgba(e){return[e>>16&255,e>>8&255,255&e,1]}#jt="#000000";#Rt=[0,0,0,0];#Ot;constructor(e=null,t=!1){this.#Ot=t,null!=e&&this.setColor(e)}setColor(e){this.#jt=e;const t=this.#Ot&&Array.isArray(e)&&e[0]<=360&&e[1]<=100&&e[2]<=100;this.#Rt=Dt.parseInput(e,t)}toHslaArray(){const[e,t,r,n]=this.#Rt;return Dt.rgbaToHsla(e,t,r,n)}toHslString(){const[e,t,r]=this.#Rt,[n,o,i]=Dt.rgbaToHsl(e,t,r);return`hsl(${n}, ${o}%, ${i}%)`}toHslaString(){const[e,t,r,n]=this.#Rt,[o,i,s,a]=Dt.rgbaToHsla(e,t,r,n);return`hsla(${o}, ${i}%, ${s}%, ${a??1})`}toRgbaArray(){return[...this.#Rt]}toRgbString(){const[e,t,r]=this.#Rt;return`rgb(${e}, ${t}, ${r})`}toRgbaString(){const[e,t,r,n]=this.#Rt;return`rgba(${e}, ${t}, ${r}, ${n??1})`}toHex(){const[e,t,r]=this.#Rt;return Dt.rgbToHex(e,t,r)}toInt(){const[e,t,r]=this.#Rt;return Dt.rgbToInt(e,t,r)}getOriginal(){return this.#jt}}const kt=Dt;class Mt{#Pt=!1;#Ht;#Wt;#Ft=null;#$t=new Map;constructor({cooldownWatcherTime:e=5e3,allowAutoConfigChange:t=!1}={}){if(!Number.isFinite(e)||e<=0)throw new TypeError("Expected 'cooldownWatcherTime' to be a positive number.");if("boolean"!=typeof t)throw new TypeError("Expected 'allowAutoConfigChange' to be a boolean.");this.#Wt=e,this.#Ht=t,this.setCooldownWatcherTime(e)}isDestroyed(){return this.#Pt}getAllowAutoConfigChange(){return this.#Ht}getCooldownWatcherTime(){return this.#Wt}setAllowAutoConfigChange(e){if("boolean"!=typeof e)throw new TypeError("Expected 'value' to be a boolean.");this.#Ht=e}setCooldownWatcherTime(e){if(this.#Pt)throw new Error("TinyTimeout has been destroyed.");if(!Number.isFinite(e)||e<=0)throw new TypeError("Expected 'value' to be a positive number.");this.#Wt=e,this.#Ft&&clearInterval(this.#Ft),this.#Ft=setInterval(()=>{this.#$t.forEach(e=>{e.now>0&&e.now--})},this.#Wt)}set(e,t,r,n=null){if(this.#Pt)throw new Error("TinyTimeout has been destroyed.");if("string"!=typeof e||""===e.trim())throw new TypeError("Expected 'id' to be a non-empty string.");if("function"!=typeof t)throw new TypeError("Expected 'callback' to be a function.");if(!Number.isFinite(r)||r<0)throw new TypeError("Expected 'value' to be a non-negative number.");if(null!==n&&(!Number.isFinite(n)||n<0))throw new TypeError("Expected 'limit' to be null or a non-negative number.");let o=this.#$t.get(e);(!o||this.#Ht&&r!==o.value)&&(o={value:r,now:0},this.#$t.set(e,o));const i=o.value*o.now;return o.now++,setTimeout(t,"number"==typeof n?Math.min(i,n):i)}static waitForTrue(e,t=100){if("function"!=typeof e)throw new TypeError("Expected 'getValue' to be a function.");if(!Number.isFinite(t)||t<=0)throw new TypeError("Expected 'checkInterval' to be a positive number.");return new Promise(r=>{const n=setInterval(()=>{e()&&(clearInterval(n),r())},t)})}waitForTrue(e,t=100){if(this.#Pt)throw new Error("TinyTimeout has been destroyed.");if("function"!=typeof e)throw new TypeError("Expected 'getValue' to be a function.");if(null!==t&&(!Number.isFinite(t)||t<=0))throw new TypeError("Expected 'checkInterval' to be null or a positive number.");return Mt.waitForTrue(e,t??this.#Wt)}destroy(){this.#Pt||(this.#Pt=!0,this.#Ft&&clearInterval(this.#Ft),this.#Ft=null,this.#$t.clear())}}const It=Mt,Nt=new Map,Bt=new Map;class jt{#tt=new St;setThrowOnMaxListeners(e){return this.#tt.setThrowOnMaxListeners(e)}getThrowOnMaxListeners(){return this.#tt.getThrowOnMaxListeners()}prependListener(e,t){return this.#tt.prependListener(e,t)}prependListenerOnce(e,t){return this.#tt.prependListenerOnce(e,t)}appendListener(e,t){return this.#tt.appendListener(e,t)}appendListenerOnce(e,t){return this.#tt.appendListenerOnce(e,t)}on(e,t){return this.#tt.on(e,t)}once(e,t){return this.#tt.once(e,t)}off(e,t){return this.#tt.off(e,t)}offAll(e){return this.#tt.offAll(e)}offAllTypes(){return this.#tt.offAllTypes()}listenerCount(e){return this.#tt.listenerCount(e)}listeners(e){return this.#tt.listeners(e)}onceListeners(e){return this.#tt.onceListeners(e)}allListeners(e){return this.#tt.allListeners(e)}eventNames(){return this.#tt.eventNames()}emit(e,...t){return this.#tt.emit(e,...t)}setMaxListeners(e){return this.#tt.setMaxListeners(e)}getMaxListeners(){return this.#tt.getMaxListeners()}static registerJsonType(e,t,r){Nt.set(e,t),Bt.set(e,r)}static deleteJsonType(e){Nt.delete(e),Bt.delete(e)}static encodeSpecialJson(e){if(void 0===e)return{__undefined__:!0};if(null===e)return{__null__:!0};for(const[t,r]of Nt.entries())if("string"!=typeof t&&e instanceof t||typeof e===t)return r(e,jt.encodeSpecialJson);if(Array.isArray(e))return e.map(jt.encodeSpecialJson);if(f(e)){const t={};for(const r in e)t[r]=jt.encodeSpecialJson(e[r]);return t}return e}static decodeSpecialJson(e){const t=f(e);if(t){if(e.__undefined__)return;if(e.__null__)return null}if(Array.isArray(e))return e.map(jt.decodeSpecialJson);if(t){for(const[t,r]of Bt.entries())if(r.check&&r.check(e))return r.decode(e,jt.decodeSpecialJson);const t={};for(const r in e)t[r]=jt.decodeSpecialJson(e[r]);return t}return e}#Ut=window.localStorage;#Vt=e=>this.emit("storage",e);constructor(){window.addEventListener("storage",this.#Vt)}setLocalStorage(e){if(!(e instanceof Storage))throw new Error("Argument must be a valid instance of Storage.");this.#Ut=e}localStorageExists(){return this.#Ut instanceof Storage}#Jt(e,t){if("string"!=typeof e||!e.length)throw new Error("Key must be a non-empty string.");return jt.encodeSpecialJson(t)}setJson(e,t){if(!(f(t)||Array.isArray(t)||t instanceof Map||t instanceof Set))throw new Error("The storage value is not a valid JSON-compatible structure.");const r=this.#Jt(e,t);this.emit("setJson",e,t),this.#Ut.setItem(e,JSON.stringify(r))}#zt(e,t){if("string"!=typeof e||!e.length)throw new Error("Key must be a non-empty string.");const r=this.#Ut.getItem(e),n={obj:()=>({}),array:()=>[],map:()=>new Map,set:()=>new Set},o="function"==typeof n[t]?n[t]():null;let i;try{i=JSON.parse(r)}catch{return o}return{decoded:jt.decodeSpecialJson(i),fallback:o}}getJson(e,t){const{decoded:r,fallback:n}=this.#zt(e,t);return r instanceof Map||r instanceof Set||Array.isArray(r)||f(r)?r:n}setDate(e,t){if(!(t instanceof Date))throw new Error("Value must be a Date.");const r=this.#Jt(e,t);this.#Ut.setItem(e,JSON.stringify(r)),this.emit("setDate",e,t)}getDate(e){const t=this.#zt(e).decoded;return t instanceof Date?t:null}setRegExp(e,t){if(!(t instanceof RegExp))throw new Error("Value must be a RegExp.");const r=this.#Jt(e,t);this.#Ut.setItem(e,JSON.stringify(r)),this.emit("setRegExp",e,t)}getRegExp(e){const t=this.#zt(e).decoded;return t instanceof RegExp?t:null}setBigInt(e,t){if("bigint"!=typeof t)throw new Error("Value must be a BigInt.");const r=this.#Jt(e,t);this.#Ut.setItem(e,JSON.stringify(r)),this.emit("setBigInt",e,t)}getBigInt(e){const t=this.#zt(e).decoded;return"bigint"==typeof t?t:null}setSymbol(e,t){if("symbol"!=typeof t)throw new Error("Value must be a Symbol.");const r=this.#Jt(e,t);this.#Ut.setItem(e,JSON.stringify(r)),this.emit("setSymbol",e,t)}getSymbol(e){const t=this.#zt(e).decoded;return"symbol"==typeof t?t:null}getValue(e){return this.#zt(e).decoded??null}setItem(e,t){if("string"!=typeof e||!e.length)throw new Error("Key must be a non-empty string.");return this.emit("setItem",e,t),this.#Ut.setItem(e,t)}getItem(e){if("string"!=typeof e||!e.length)throw new Error("Key must be a non-empty string.");return this.#Ut.getItem(e)}setString(e,t){if("string"!=typeof e||!e.length)throw new Error("Key must be a non-empty string.");if("string"!=typeof t)throw new Error("Value must be a string.");return this.emit("setString",e,t),this.#Ut.setItem(e,t)}getString(e){if("string"!=typeof e||!e.length)throw new Error("Key must be a non-empty string.");let t=this.#Ut.getItem(e);return"string"==typeof t?t:null}setNumber(e,t){if("string"!=typeof e||!e.length)throw new Error("Key must be a non-empty string.");if("number"!=typeof t)throw new Error("Value must be a number.");return this.emit("setNumber",e,t),this.#Ut.setItem(e,String(t))}getNumber(e){if("string"!=typeof e||!e.length)throw new Error("Key must be a non-empty string.");let t=this.#Ut.getItem(e);return"number"==typeof t||"string"==typeof t&&t.length>0&&(t=parseFloat(t),!Number.isNaN(t))?t:null}setBool(e,t){if("string"!=typeof e||!e.length)throw new Error("Key must be a non-empty string.");if("boolean"!=typeof t)throw new Error("Value must be a boolean.");return this.emit("setBool",e,t),this.#Ut.setItem(e,String(t))}getBool(e){if("string"!=typeof e||!e.length)throw new Error("Key must be a non-empty string.");const t=this.#Ut.getItem(e);if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===t)return!0;if("false"===t)return!1}return null}removeItem(e){if("string"!=typeof e||!e.length)throw new Error("Key must be a non-empty string.");return this.emit("removeItem",e),this.#Ut.removeItem(e)}clearLocalStorage(){this.#Ut.clear()}destroy(){window.removeEventListener("storage",this.#Vt),this.#tt.offAllTypes()}}jt.registerJsonType(Map,(e,t)=>({__map__:!0,data:Array.from(e.entries()).map(([e,r])=>[e,t(r)])}),{check:e=>e.__map__,decode:(e,t)=>new Map(e.data.map(([e,r])=>[e,t(r)]))}),jt.registerJsonType(Set,(e,t)=>({__set__:!0,data:Array.from(e).map(t)}),{check:e=>e.__set__,decode:(e,t)=>new Set(e.data.map(t))}),jt.registerJsonType(Date,e=>({__date__:!0,value:e.toISOString()}),{check:e=>e.__date__,decode:e=>new Date(e.value)}),jt.registerJsonType(RegExp,e=>({__regexp__:!0,source:e.source,flags:e.flags}),{check:e=>e.__regexp__,decode:e=>new RegExp(e.source,e.flags)}),jt.registerJsonType("bigint",e=>({__bigint__:!0,value:e.toString()}),{check:e=>e.__bigint__,decode:e=>BigInt(e.value)}),jt.registerJsonType("symbol",e=>({__symbol__:!0,key:Symbol.keyFor(e)??e.description??null}),{check:e=>e.__symbol__,decode:e=>{const t=e.key;return null!=t?Symbol.for(t):Symbol()}});const Rt=jt})(),window.TinyEssentials=n})();
|