tiny-essentials 1.12.0 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2774,6 +2774,7 @@ class TinyDragger {
2774
2774
  #offsetY = 0;
2775
2775
  #offsetX = 0;
2776
2776
 
2777
+ #multiCollision = false;
2777
2778
  #lockInsideJail = false;
2778
2779
  #revertOnDrop = false;
2779
2780
  #dragging = false;
@@ -2818,6 +2819,7 @@ class TinyDragger {
2818
2819
  * @param {string} [options.classDragCollision='dragging-collision'] - CSS class applied to collision element.
2819
2820
  * @param {boolean} [options.lockInsideJail=false] - Restrict movement within the jail container.
2820
2821
  * @param {boolean} [options.dropInJailOnly=false] - Restrict drop within the jail container.
2822
+ * @param {boolean} [options.multiCollision=false] - Enables returning multiple collided elements.
2821
2823
  * @param {VibrationPatterns|false} [options.vibration=false] - Vibration feedback configuration.
2822
2824
  * @param {boolean} [options.revertOnDrop=false] - Whether to return to original position on drop.
2823
2825
  * @param {string} [options.classHidden='drag-hidden'] - CSS class to hide original element during dragging.
@@ -2864,6 +2866,7 @@ class TinyDragger {
2864
2866
  validateBoolean(options.lockInsideJail, 'lockInsideJail');
2865
2867
  validateBoolean(options.dropInJailOnly, 'dropInJailOnly');
2866
2868
  validateBoolean(options.revertOnDrop, 'revertOnDrop');
2869
+ validateBoolean(options.multiCollision, 'multiCollision');
2867
2870
 
2868
2871
  validateString(options.classDragging, 'classDragging');
2869
2872
  validateString(options.classBodyDragging, 'classBodyDragging');
@@ -2897,6 +2900,7 @@ class TinyDragger {
2897
2900
  if (typeof options.revertOnDrop === 'boolean') this.#revertOnDrop = options.revertOnDrop;
2898
2901
  if (typeof options.lockInsideJail === 'boolean') this.#lockInsideJail = options.lockInsideJail;
2899
2902
  if (typeof options.dropInJailOnly === 'boolean') this.#dropInJailOnly = options.dropInJailOnly;
2903
+ if (typeof options.multiCollision === 'boolean') this.#multiCollision = options.multiCollision;
2900
2904
 
2901
2905
  /** @private */
2902
2906
  this._onMouseDown = this.#startDrag.bind(this);
@@ -3088,22 +3092,67 @@ class TinyDragger {
3088
3092
  this.#dispatchEvent('drag');
3089
3093
  }
3090
3094
 
3095
+ /** @type {HTMLElement[]} */
3096
+ #collisionsMarked = [];
3097
+
3098
+ /**
3099
+ * Marks an element as currently collided by adding the collision CSS class.
3100
+ * The element is stored in an internal list for easy removal later.
3101
+ *
3102
+ * @param {HTMLElement|null} el - The element to mark as collided.
3103
+ */
3104
+ #addCollision(el) {
3105
+ if (!el) return;
3106
+ el.classList.add(this.#classDragCollision);
3107
+ this.#collisionsMarked.push(el);
3108
+ }
3109
+
3110
+ /**
3111
+ * Removes the collision CSS class from all previously marked elements.
3112
+ * Also clears the last single collision element, if set.
3113
+ *
3114
+ */
3115
+ #removeCollision() {
3116
+ while (this.#collisionsMarked.length > 0) {
3117
+ const el = this.#collisionsMarked.shift();
3118
+ if (el) el.classList.remove(this.#classDragCollision);
3119
+ }
3120
+ if (!this.#lastCollision) return;
3121
+ this.#lastCollision.classList.remove(this.#classDragCollision);
3122
+ }
3123
+
3091
3124
  /**
3092
3125
  * Handles dragging collision.
3093
3126
  * @param {MouseEvent|Touch} event - The drag event.
3094
3127
  */
3095
3128
  checkDragCollision(event) {
3096
- const { collidedElement: collided } = this.execCollision(event);
3097
- if (collided && collided !== this.#lastCollision) {
3098
- if (navigator.vibrate && Array.isArray(this.#vibration.collide)) {
3099
- navigator.vibrate(this.#vibration.collide);
3129
+ const { collidedElements } = this.execCollision(event);
3130
+ const first = collidedElements[0] || null;
3131
+
3132
+ // Removes old marking if necessary
3133
+ if (this.#lastCollision && !collidedElements.includes(this.#lastCollision)) {
3134
+ this.#removeCollision();
3135
+ }
3136
+
3137
+ // Adds Marking for All Colluded
3138
+ collidedElements.forEach((el) => this.#addCollision(el));
3139
+
3140
+ // Removes markings from who no longer collided
3141
+ this.#collidables.forEach((el) => {
3142
+ if (!collidedElements.includes(el)) {
3143
+ el.classList.remove(this.#classDragCollision);
3100
3144
  }
3101
- this.#lastCollision = collided;
3102
- if (this.#lastCollision) this.#lastCollision.classList.add(this.#classDragCollision);
3103
- } else if (!collided) {
3104
- if (this.#lastCollision) this.#lastCollision.classList.remove(this.#classDragCollision);
3105
- this.#lastCollision = null;
3145
+ });
3146
+
3147
+ if (
3148
+ navigator.vibrate &&
3149
+ Array.isArray(this.#vibration.collide) &&
3150
+ collidedElements.length > 0
3151
+ ) {
3152
+ navigator.vibrate(this.#vibration.collide);
3106
3153
  }
3154
+
3155
+ this.#lastCollision = first;
3107
3156
  }
3108
3157
 
3109
3158
  /**
@@ -3150,37 +3199,48 @@ class TinyDragger {
3150
3199
  /**
3151
3200
  * Handles the collision of a drag.
3152
3201
  * @param {MouseEvent|Touch} event - The release event.
3153
- * @returns {{ inJail: boolean; collidedElement: HTMLElement|null }}
3202
+ * @returns {{ inJail: boolean; collidedElements: (HTMLElement | null)[] }}
3154
3203
  */
3155
3204
  execCollision(event) {
3156
- if (this.#destroyed || !this.#dragProxy) return { inJail: false, collidedElement: null };
3205
+ if (this.#destroyed || !this.#dragProxy) return { inJail: false, collidedElements: [] };
3157
3206
 
3158
- let collidedElement;
3207
+ let collidedElements = [];
3159
3208
  let inJail = true;
3160
3209
  const jailRect = this.#jail?.getBoundingClientRect();
3210
+
3161
3211
  if (this.#collisionByMouse) {
3162
3212
  const x = event.clientX;
3163
3213
  const y = event.clientY;
3214
+
3164
3215
  if (this.#dropInJailOnly && this.#jail && jailRect) {
3165
3216
  inJail =
3166
3217
  x >= jailRect.left && x <= jailRect.right && y >= jailRect.top && y <= jailRect.bottom;
3167
3218
  }
3168
3219
 
3169
- collidedElement = inJail ? this.getCollidedElement(x, y) : null;
3220
+ collidedElements = inJail
3221
+ ? this.#multiCollision
3222
+ ? this.getAllCollidedElements(x, y)
3223
+ : [this.getCollidedElement(x, y)].filter(Boolean)
3224
+ : [];
3170
3225
  } else {
3171
- const targetRect = this.#dragProxy.getBoundingClientRect();
3226
+ const rect = this.#dragProxy.getBoundingClientRect();
3227
+
3172
3228
  if (this.#dropInJailOnly && this.#jail && jailRect) {
3173
3229
  inJail =
3174
- targetRect.left >= jailRect.left &&
3175
- targetRect.right <= jailRect.right &&
3176
- targetRect.top >= jailRect.top &&
3177
- targetRect.bottom <= jailRect.bottom;
3230
+ rect.left >= jailRect.left &&
3231
+ rect.right <= jailRect.right &&
3232
+ rect.top >= jailRect.top &&
3233
+ rect.bottom <= jailRect.bottom;
3178
3234
  }
3179
3235
 
3180
- collidedElement = inJail ? this.getCollidedElementByRect(targetRect) : null;
3236
+ collidedElements = inJail
3237
+ ? this.#multiCollision
3238
+ ? this.getAllCollidedElementsByRect(rect)
3239
+ : [this.getCollidedElementByRect(rect)].filter(Boolean)
3240
+ : [];
3181
3241
  }
3182
3242
 
3183
- return { inJail, collidedElement };
3243
+ return { inJail, collidedElements };
3184
3244
  }
3185
3245
 
3186
3246
  /**
@@ -3203,7 +3263,7 @@ class TinyDragger {
3203
3263
 
3204
3264
  document.removeEventListener('touchmove', this._onTouchMove);
3205
3265
  document.removeEventListener('touchend', this._onTouchEnd);
3206
- const { collidedElement } = this.execCollision(event);
3266
+ const { collidedElements } = this.execCollision(event);
3207
3267
 
3208
3268
  if (navigator.vibrate && Array.isArray(this.#vibration.end)) {
3209
3269
  navigator.vibrate(this.#vibration.end);
@@ -3216,7 +3276,7 @@ class TinyDragger {
3216
3276
  this.#dragProxy = null;
3217
3277
  }
3218
3278
 
3219
- if (this.#lastCollision) this.#lastCollision.classList.remove(this.#classDragCollision);
3279
+ if (this.#lastCollision) this.#removeCollision();
3220
3280
  this.#lastCollision = null;
3221
3281
 
3222
3282
  this.#target.classList.remove(this.#dragHiddenClass);
@@ -3227,13 +3287,50 @@ class TinyDragger {
3227
3287
 
3228
3288
  const dropEvent = new CustomEvent('drop', {
3229
3289
  detail: {
3230
- target: collidedElement,
3290
+ targets: collidedElements,
3291
+ first: collidedElements[0] || null,
3231
3292
  },
3232
3293
  });
3233
-
3234
3294
  this.#target.dispatchEvent(dropEvent);
3235
3295
  }
3236
3296
 
3297
+ /**
3298
+ * Checks if the provided element intersects with the given bounding rectangle.
3299
+ *
3300
+ * @param {HTMLElement} el - The element to test for collision.
3301
+ * @param {DOMRect} rect - The bounding rectangle to check against.
3302
+ * @returns {boolean} True if the element intersects with the rectangle.
3303
+ */
3304
+ #getCollidedElementByRect(el, rect) {
3305
+ const elRect = el.getBoundingClientRect();
3306
+ return !(
3307
+ rect.right < elRect.left ||
3308
+ rect.left > elRect.right ||
3309
+ rect.bottom < elRect.top ||
3310
+ rect.top > elRect.bottom
3311
+ );
3312
+ }
3313
+
3314
+ /**
3315
+ * Returns all elements currently colliding with the given rectangle.
3316
+ *
3317
+ * @param {DOMRect} rect - Bounding rectangle of the dragged proxy.
3318
+ * @returns {HTMLElement[]} A list of all collided elements.
3319
+ * @throws {Error} If the input is not a valid DOMRect with numeric bounds.
3320
+ */
3321
+ getAllCollidedElementsByRect(rect) {
3322
+ this.#checkDestroy();
3323
+ if (
3324
+ !(rect instanceof DOMRect) ||
3325
+ typeof rect.left !== 'number' ||
3326
+ typeof rect.right !== 'number' ||
3327
+ typeof rect.top !== 'number' ||
3328
+ typeof rect.bottom !== 'number'
3329
+ )
3330
+ throw new Error('getCollidedElementByRect expects a valid DOMRect object.');
3331
+ return this.#collidables.filter((el) => this.#getCollidedElementByRect(el, rect));
3332
+ }
3333
+
3237
3334
  /**
3238
3335
  * Detects collision based on rectangle intersection.
3239
3336
  * @param {DOMRect} rect - Bounding rectangle of the dragged proxy.
@@ -3250,18 +3347,32 @@ class TinyDragger {
3250
3347
  typeof rect.bottom !== 'number'
3251
3348
  )
3252
3349
  throw new Error('getCollidedElementByRect expects a valid DOMRect object.');
3350
+ return this.#collidables.find((el) => this.#getCollidedElementByRect(el, rect)) || null;
3351
+ }
3253
3352
 
3254
- return (
3255
- this.#collidables.find((el) => {
3256
- const elRect = el.getBoundingClientRect();
3257
- return !(
3258
- rect.right < elRect.left ||
3259
- rect.left > elRect.right ||
3260
- rect.bottom < elRect.top ||
3261
- rect.top > elRect.bottom
3262
- );
3263
- }) || null
3264
- );
3353
+ /**
3354
+ * Checks whether a given (x, y) coordinate is inside the bounding rectangle of an element.
3355
+ *
3356
+ * @param {HTMLElement} el - The element to test for collision.
3357
+ * @param {number} x - Horizontal screen coordinate.
3358
+ * @param {number} y - Vertical screen coordinate.
3359
+ * @returns {boolean} True if the point is within the element's bounds.
3360
+ */
3361
+ #getCollidedElement(el, x, y) {
3362
+ const rect = el.getBoundingClientRect();
3363
+ return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
3364
+ }
3365
+
3366
+ /**
3367
+ * @param {number} x - Horizontal screen coordinate.
3368
+ * @param {number} y - Vertical screen coordinate.
3369
+ * @returns {HTMLElement[]} The collided element or null.
3370
+ */
3371
+ getAllCollidedElements(x, y) {
3372
+ this.#checkDestroy();
3373
+ if (typeof x !== 'number' || typeof y !== 'number')
3374
+ throw new Error('getCollidedElement expects numeric x and y coordinates.');
3375
+ return this.#collidables.filter((el) => this.#getCollidedElement(el, x, y));
3265
3376
  }
3266
3377
 
3267
3378
  /**
@@ -3274,13 +3385,7 @@ class TinyDragger {
3274
3385
  this.#checkDestroy();
3275
3386
  if (typeof x !== 'number' || typeof y !== 'number')
3276
3387
  throw new Error('getCollidedElement expects numeric x and y coordinates.');
3277
-
3278
- return (
3279
- this.#collidables.find((el) => {
3280
- const rect = el.getBoundingClientRect();
3281
- return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
3282
- }) || null
3283
- );
3388
+ return this.#collidables.find((el) => this.#getCollidedElement(el, x, y)) || null;
3284
3389
  }
3285
3390
 
3286
3391
  /**
@@ -3530,7 +3635,7 @@ class TinyDragger {
3530
3635
  document.removeEventListener('touchmove', this._onTouchMove);
3531
3636
  document.removeEventListener('touchend', this._onTouchEnd);
3532
3637
 
3533
- if (this.#lastCollision) this.#lastCollision.classList.remove(this.#classDragCollision);
3638
+ if (this.#lastCollision) this.#removeCollision();
3534
3639
  if (this.#dragProxy) {
3535
3640
  this.#dragProxy.remove();
3536
3641
  this.#dragProxy = null;
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see TinyDragger.min.js.LICENSE.txt */
2
- (()=>{var t={251:(t,e)=>{e.read=function(t,e,r,i,n){var o,s,a=8*n-i-1,l=(1<<a)-1,h=l>>1,f=-7,u=r?n-1:0,c=r?-1:1,g=t[e+u];for(u+=c,o=g&(1<<-f)-1,g>>=-f,f+=a;f>0;o=256*o+t[e+u],u+=c,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=i;f>0;s=256*s+t[e+u],u+=c,f-=8);if(0===o)o=1-h;else{if(o===l)return s?NaN:1/0*(g?-1:1);s+=Math.pow(2,i),o-=h}return(g?-1:1)*s*Math.pow(2,o-i)},e.write=function(t,e,r,i,n,o){var s,a,l,h=8*o-n-1,f=(1<<h)-1,u=f>>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,g=i?0:o-1,d=i?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+u>=1?c/l:c*Math.pow(2,1-u))*l>=2&&(s++,l/=2),s+u>=f?(a=0,s=f):s+u>=1?(a=(e*l-1)*Math.pow(2,n),s+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,n),s=0));n>=8;t[r+g]=255&a,g+=d,a/=256,n-=8);for(s=s<<n|a,h+=n;h>0;t[r+g]=255&s,g+=d,s/=256,h-=8);t[r+g-d]|=128*p}},287:(t,e,r)=>{"use strict";var i=r(526),n=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=l,e.IS=50;var s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,l.prototype),e}function l(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return h(t,e,r)}function h(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!l.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|p(t,e),i=a(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}(t,e);if(ArrayBuffer.isView(t))return function(t){if(N(t,Uint8Array)){var e=new Uint8Array(t);return g(e.buffer,e.byteOffset,e.byteLength)}return c(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(N(t,ArrayBuffer)||t&&N(t.buffer,ArrayBuffer))return g(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(N(t,SharedArrayBuffer)||t&&N(t.buffer,SharedArrayBuffer)))return g(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return l.from(i,e,r);var n=function(t){if(l.isBuffer(t)){var e=0|d(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||F(t.length)?a(0):c(t):"Buffer"===t.type&&Array.isArray(t.data)?c(t.data):void 0}(t);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return l.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return f(t),a(t<0?0:0|d(t))}function c(t){for(var e=t.length<0?0:0|d(t.length),r=a(e),i=0;i<e;i+=1)r[i]=255&t[i];return r}function g(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var i;return i=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(i,l.prototype),i}function d(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function p(t,e){if(l.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||N(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return S(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return _(t).length;default:if(n)return i?-1:S(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,r);case"utf8":case"utf-8":return L(this,e,r);case"ascii":return x(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function v(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function b(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),F(r=+r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=l.from(e,i)),l.isBuffer(e))return 0===e.length?-1:m(t,e,r,i,n);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,i,n){var o,s=1,a=t.length,l=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;s=2,a/=2,l/=2,r/=2}function h(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(n){var f=-1;for(o=r;o<a;o++)if(h(t,o)===h(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===l)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(r+l>a&&(r=a-l),o=r;o>=0;o--){for(var u=!0,c=0;c<l;c++)if(h(t,o+c)!==h(e,c)){u=!1;break}if(u)return o}return-1}function w(t,e,r,i){r=Number(r)||0;var n=t.length-r;i?(i=Number(i))>n&&(i=n):i=n;var o=e.length;i>o/2&&(i=o/2);for(var s=0;s<i;++s){var a=parseInt(e.substr(2*s,2),16);if(F(a))return s;t[r+s]=a}return s}function E(t,e,r,i){return H(S(e,t.length-r),t,r,i)}function D(t,e,r,i){return H(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,i)}function B(t,e,r,i){return H(_(e),t,r,i)}function C(t,e,r,i){return H(function(t,e){for(var r,i,n,o=[],s=0;s<t.length&&!((e-=2)<0);++s)i=(r=t.charCodeAt(s))>>8,n=r%256,o.push(n),o.push(i);return o}(e,t.length-r),t,r,i)}function A(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function L(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n<r;){var o,s,a,l,h=t[n],f=null,u=h>239?4:h>223?3:h>191?2:1;if(n+u<=r)switch(u){case 1:h<128&&(f=h);break;case 2:128==(192&(o=t[n+1]))&&(l=(31&h)<<6|63&o)>127&&(f=l);break;case 3:o=t[n+1],s=t[n+2],128==(192&o)&&128==(192&s)&&(l=(15&h)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(f=l);break;case 4:o=t[n+1],s=t[n+2],a=t[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(f=l)}null===f?(f=65533,u=1):f>65535&&(f-=65536,i.push(f>>>10&1023|55296),f=56320|1023&f),i.push(f),n+=u}return function(t){var e=t.length;if(e<=M)return String.fromCharCode.apply(String,t);for(var r="",i=0;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=M));return r}(i)}l.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){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(t,e,r){return h(t,e,r)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(t,e,r){return function(t,e,r){return f(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},l.allocUnsafe=function(t){return u(t)},l.allocUnsafeSlow=function(t){return u(t)},l.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==l.prototype},l.compare=function(t,e){if(N(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),N(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(t)||!l.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,i=e.length,n=0,o=Math.min(r,i);n<o;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:i<r?1:0},l.isEncoding=function(t){switch(String(t).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(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return l.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=l.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){var o=t[r];if(N(o,Uint8Array))n+o.length>i.length?l.from(o).copy(i,n):Uint8Array.prototype.set.call(i,o,n);else{if(!l.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,n)}n+=o.length}return i},l.byteLength=p,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)v(this,e,e+1);return this},l.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)v(this,e,e+3),v(this,e+1,e+2);return this},l.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)v(this,e,e+7),v(this,e+1,e+6),v(this,e+2,e+5),v(this,e+3,e+4);return this},l.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?L(this,0,t):y.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(t){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===l.compare(this,t)},l.prototype.inspect=function(){var t="",r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(l.prototype[o]=l.prototype.inspect),l.prototype.compare=function(t,e,r,i,n){if(N(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),h=this.slice(i,n),f=t.slice(e,r),u=0;u<a;++u)if(h[u]!==f[u]){o=h[u],s=f[u];break}return o<s?-1:s<o?1:0},l.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},l.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},l.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},l.prototype.write=function(t,e,r,i){if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":case"latin1":case"binary":return D(this,t,e,r);case"base64":return B(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var M=4096;function x(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}function T(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function O(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var n="",o=e;o<r;++o)n+=Y[t[o]];return n}function I(t,e,r){for(var i=t.slice(e,r),n="",o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+256*i[o+1]);return n}function U(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,i,n,o){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}function j(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function J(t,e,r,i,o){return e=+e,r>>>=0,o||j(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function R(t,e,r,i,o){return e=+e,r>>>=0,o||j(t,0,r,8),n.write(t,e,r,i,52,8),r+8}l.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var i=this.subarray(t,e);return Object.setPrototypeOf(i,l.prototype),i},l.prototype.readUintLE=l.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i},l.prototype.readUintBE=l.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},l.prototype.readUint8=l.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*e)),i},l.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var i=e,n=1,o=this[t+--i];i>0&&(n*=256);)o+=this[t+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},l.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){t>>>=0,e||U(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(t,e){t>>>=0,e||U(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return t>>>=0,e||U(t,4,this.length),n.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),n.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),n.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),n.read(this,t,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||P(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o<r&&(n*=256);)this[e+o]=t/n&255;return e+r},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||P(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,255,0),this[e]=255&t,e+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},l.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);P(this,t,e,r,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s|0)-a&255;return e+r},l.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);P(this,t,e,r,n-1,-n)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s|0)-a&255;return e+r},l.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},l.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},l.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},l.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},l.prototype.writeFloatLE=function(t,e,r){return J(this,t,e,!0,r)},l.prototype.writeFloatBE=function(t,e,r){return J(this,t,e,!1,r)},l.prototype.writeDoubleLE=function(t,e,r){return R(this,t,e,!0,r)},l.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},l.prototype.copy=function(t,e,r,i){if(!l.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var n=i-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,i):Uint8Array.prototype.set.call(t,this.subarray(r,i),e),n},l.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){var n=t.charCodeAt(0);("utf8"===i&&n<128||"latin1"===i)&&(t=n)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=l.isBuffer(t)?t:l.from(t,i),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var k=/[^+/0-9A-Za-z-_]/g;function S(t,e){var r;e=e||1/0;for(var i=t.length,n=null,o=[],s=0;s<i;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function _(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(k,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function N(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function F(t){return t!=t}var Y=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var i=16*r,n=0;n<16;++n)e[i+n]=t[r]+t[n];return e}()},526:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),r=e[0],i=e[1];return 3*(r+i)/4-i},e.toByteArray=function(t){var e,r,o=a(t),s=o[0],l=o[1],h=new n(function(t,e,r){return 3*(e+r)/4-r}(0,s,l)),f=0,u=l>0?s-4:s;for(r=0;r<u;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],h[f++]=e>>16&255,h[f++]=e>>8&255,h[f++]=255&e;return 2===l&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,h[f++]=255&e),1===l&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,h[f++]=e>>8&255,h[f++]=255&e),h},e.fromByteArray=function(t){for(var e,i=t.length,n=i%3,o=[],s=16383,a=0,h=i-n;a<h;a+=s)o.push(l(t,a,a+s>h?h:a+s));return 1===n?(e=t[i-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===n&&(e=(t[i-2]<<8)+t[i-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],i=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],i[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,i){for(var n,o,s=[],a=e;a<i;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(r[(o=n)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i](o,o.exports,r),o.exports}r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var i={};(()=>{"use strict";r.d(i,{TinyDragger:()=>l});var t=r(287);const e="undefined"!=typeof window&&void 0!==window.document,n={items:{},order:[]};function o(t,e){const r=[],i=Array.isArray(t)?t:Object.entries(t);for(const[t,o]of i)if(!n.items.hasOwnProperty(t)){n.items[t]=o;let i="number"==typeof e?e:-1;if(-1===i){const t=n.order.indexOf("object");i=t>-1?t:n.order.length}i=Math.min(Math.max(0,i),n.order.length),n.order.splice(i,0,t),r.push(t)}return r}function s(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"===Object.prototype.toString.call(t)}o([["undefined",t=>void 0===t],["null",t=>null===t],["boolean",t=>"boolean"==typeof t],["number",t=>"number"==typeof t&&!Number.isNaN(t)],["bigint",t=>"bigint"==typeof t],["string",t=>"string"==typeof t],["symbol",t=>"symbol"==typeof t],["function",t=>"function"==typeof t],["array",t=>Array.isArray(t)]]),e||o([["buffer",e=>void 0!==t.hp&&t.hp.isBuffer(e)]]),e&&o([["file",t=>"undefined"!=typeof File&&t instanceof File]]),o([["date",t=>t instanceof Date],["regexp",t=>t instanceof RegExp],["map",t=>t instanceof Map],["set",t=>t instanceof Set],["weakmap",t=>t instanceof WeakMap],["weakset",t=>t instanceof WeakSet],["promise",t=>t instanceof Promise]]),e&&o([["htmlelement",t=>"undefined"!=typeof HTMLElement&&t instanceof HTMLElement]]),o([["object",t=>s(t)]]);const a=t=>{const e=getComputedStyle(t),r=parseFloat(e.borderLeftWidth)||0,i=parseFloat(e.borderRightWidth)||0,n=parseFloat(e.borderTopWidth)||0,o=parseFloat(e.borderBottomWidth)||0;return{x:r+i,y:n+o,left:r,right:i,top:n,bottom:o}},l=class{#t=!0;#e=!1;#r=0;#i=0;#n=!1;#o=!1;#s=!1;#a=!1;#l=!1;#h=null;#f=[];#u=null;#c={start:!1,end:!1,collide:!1,move:!1};#g=null;#d;#p="drag-hidden";#y="dragging";#v="drag-active";#b="jail-drag-active";#m="jail-drag-disabled";#w="dragging-collision";constructor(t,e={}){if(!(t instanceof HTMLElement))throw new Error("TinyDragger requires a valid target HTMLElement to initialize.");if(this.#d=t,void 0!==e.jail&&!(e.jail instanceof HTMLElement))throw new Error('The "jail" option must be an HTMLElement if provided.');if(void 0!==e.vibration&&!1!==e.vibration&&!s(e.vibration))throw new Error('The "vibration" option must be an object or false.');const r=(t,e)=>{if(void 0!==t&&"boolean"!=typeof t)throw new Error(`The "${e}" option must be a boolean.`)},i=(t,e)=>{if(void 0!==t&&"string"!=typeof t)throw new Error(`The "${e}" option must be a string.`)};r(e.collisionByMouse,"collisionByMouse"),r(e.lockInsideJail,"lockInsideJail"),r(e.dropInJailOnly,"dropInJailOnly"),r(e.revertOnDrop,"revertOnDrop"),i(e.classDragging,"classDragging"),i(e.classBodyDragging,"classBodyDragging"),i(e.classJailDragging,"classJailDragging"),i(e.classJailDragDisabled,"classJailDragDisabled"),i(e.classDragCollision,"classDragCollision"),i(e.classHidden,"classHidden"),e.jail instanceof HTMLElement&&(this.#g=e.jail),this.#c=Object.assign({start:!1,end:!1,collide:!1,move:!1},s(e.vibration)?e.vibration:{}),"string"==typeof e.classDragging&&(this.#y=e.classDragging),"string"==typeof e.classBodyDragging&&(this.#v=e.classBodyDragging),"string"==typeof e.classJailDragging&&(this.#b=e.classJailDragging),"string"==typeof e.classJailDragDisabled&&(this.#m=e.classJailDragDisabled),"string"==typeof e.classHidden&&(this.#p=e.classHidden),"string"==typeof e.classDragCollision&&(this.#w=e.classDragCollision),"boolean"==typeof e.collisionByMouse&&(this.#a=e.collisionByMouse),"boolean"==typeof e.revertOnDrop&&(this.#o=e.revertOnDrop),"boolean"==typeof e.lockInsideJail&&(this.#n=e.lockInsideJail),"boolean"==typeof e.dropInJailOnly&&(this.#l=e.dropInJailOnly),this._onMouseDown=this.#E.bind(this),this._onMouseMove=this.#D.bind(this),this._onMouseUp=this.#B.bind(this),this._onTouchStart=t=>this.#E(t.touches[0]),this._onTouchMove=t=>this.#D(t.touches[0]),this._onTouchEnd=t=>this.#B(t.changedTouches[0]),this.#d.addEventListener("mousedown",this._onMouseDown),this.#d.addEventListener("touchstart",this._onTouchStart,{passive:!1})}enable(){this.#C(),this.#g&&this.#g.classList.add(this.#m),this.#t=!0}disable(){this.#g&&this.#g.classList.remove(this.#m),this.#t=!1}addCollidable(t){if(this.#C(),!(t instanceof HTMLElement))throw new Error("addCollidable expects an HTMLElement as argument.");this.#f.includes(t)||this.#f.push(t)}removeCollidable(t){if(this.#C(),!(t instanceof HTMLElement))throw new Error("removeCollidable expects an HTMLElement as argument.");this.#f=this.#f.filter((e=>e!==t))}setVibrationPattern({startPattern:t=!1,endPattern:e=!1,collidePattern:r=!1,movePattern:i=!1}={}){this.#C();const n=t=>!1===t||Array.isArray(t)&&t.every((t=>"number"==typeof t));if(!n(t))throw new Error('Invalid "startPattern": must be false or an array of numbers.');if(!n(e))throw new Error('Invalid "endPattern": must be false or an array of numbers.');if(!n(r))throw new Error('Invalid "collidePattern": must be false or an array of numbers.');if(!n(i))throw new Error('Invalid "movePattern": must be false or an array of numbers.');this.#c={start:t,end:e,collide:r,move:i}}disableVibration(){this.#C(),this.#c={start:!1,end:!1,collide:!1,move:!1}}getOffset(t){if(this.#C(),!(t instanceof MouseEvent||t instanceof Touch)||"number"!=typeof t.clientX||"number"!=typeof t.clientY)throw new Error("getOffset expects an event with valid clientX and clientY coordinates.");const e=this.#d.getBoundingClientRect(),{left:r,top:i}=a(this.#d);return{x:t.clientX-e.left+r,y:t.clientY-e.top+i}}#E(t){if(t instanceof MouseEvent&&t.preventDefault(),this.#e||!this.#t||!this.#d.parentElement)return;const e=this.#d.cloneNode(!0);if(!(e instanceof HTMLElement))return;this.#u=e,this.#s=!0;const r=this.#d.getBoundingClientRect();Object.assign(this.#u.style,{position:"absolute",pointerEvents:"none",left:`${this.#d.offsetLeft}px`,top:`${this.#d.offsetTop}px`,width:`${r.width}px`,height:`${r.height}px`,zIndex:9999}),this.#d.classList.add(this.#p),this.#d.parentElement.appendChild(this.#u);const{x:i,y:n}=this.getOffset(t);this.#i=i,this.#r=n,this.#u.classList.add(this.#y),document.body.classList.add(this.#v),this.#g&&this.#g.classList.add(this.#b),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.#c.start)&&navigator.vibrate(this.#c.start),this.checkDragCollision(t),this.#A("drag")}checkDragCollision(t){const{collidedElement:e}=this.execCollision(t);e&&e!==this.#h?(navigator.vibrate&&Array.isArray(this.#c.collide)&&navigator.vibrate(this.#c.collide),this.#h=e,this.#h&&this.#h.classList.add(this.#w)):e||(this.#h&&this.#h.classList.remove(this.#w),this.#h=null)}#D(t){if(t instanceof MouseEvent&&t.preventDefault(),this.#e||!this.#s||!this.#t||!this.#u)return;const e=(this.#u.offsetParent||document.body).getBoundingClientRect();let r=t.clientX-e.left-this.#i,i=t.clientY-e.top-this.#r;if(this.#n&&this.#g){const t=this.#g.getBoundingClientRect(),n=this.#u.getBoundingClientRect(),o=t.left-e.left,s=t.top-e.top,{x:l,y:h}=a(this.#g),f=o+t.width-n.width-h,u=s+t.height-n.height-l;r=Math.max(o,Math.min(r,f)),i=Math.max(s,Math.min(i,u))}this.#u.style.position="absolute",this.#u.style.left=`${r}px`,this.#u.style.top=`${i}px`,navigator.vibrate&&Array.isArray(this.#c.move)&&navigator.vibrate(this.#c.move),this.checkDragCollision(t),this.#A("dragging")}execCollision(t){if(this.#e||!this.#u)return{inJail:!1,collidedElement:null};let e,r=!0;const i=this.#g?.getBoundingClientRect();if(this.#a){const n=t.clientX,o=t.clientY;this.#l&&this.#g&&i&&(r=n>=i.left&&n<=i.right&&o>=i.top&&o<=i.bottom),e=r?this.getCollidedElement(n,o):null}else{const t=this.#u.getBoundingClientRect();this.#l&&this.#g&&i&&(r=t.left>=i.left&&t.right<=i.right&&t.top>=i.top&&t.bottom<=i.bottom),e=r?this.getCollidedElementByRect(t):null}return{inJail:r,collidedElement:e}}#B(t){if(t instanceof MouseEvent&&t.preventDefault(),this.#e||!this.#s)return;if(this.#s=!1,!this.#u)return;this.#d.classList.remove(this.#y),document.body.classList.remove(this.#v),this.#g&&this.#g.classList.remove(this.#b),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd);const{collidedElement:e}=this.execCollision(t);navigator.vibrate&&Array.isArray(this.#c.end)&&navigator.vibrate(this.#c.end);const r=this.#u.style.left,i=this.#u.style.top;this.#u&&(this.#u.remove(),this.#u=null),this.#h&&this.#h.classList.remove(this.#w),this.#h=null,this.#d.classList.remove(this.#p),this.#o||(this.#d.style.left=r,this.#d.style.top=i);const n=new CustomEvent("drop",{detail:{target:e}});this.#d.dispatchEvent(n)}getCollidedElementByRect(t){if(this.#C(),!(t instanceof DOMRect)||"number"!=typeof t.left||"number"!=typeof t.right||"number"!=typeof t.top||"number"!=typeof t.bottom)throw new Error("getCollidedElementByRect expects a valid DOMRect object.");return this.#f.find((e=>{const r=e.getBoundingClientRect();return!(t.right<r.left||t.left>r.right||t.bottom<r.top||t.top>r.bottom)}))||null}getCollidedElement(t,e){if(this.#C(),"number"!=typeof t||"number"!=typeof e)throw new Error("getCollidedElement expects numeric x and y coordinates.");return this.#f.find((r=>{const i=r.getBoundingClientRect();return t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom}))||null}#A(t){const e=new CustomEvent(t);this.#d.dispatchEvent(e)}getDragging(){return this.#s}getLockInsideJail(){return this.#n}setLockInsideJail(t){if("boolean"!=typeof t)throw new Error("lockInsideJail must be a boolean.");this.#n=t}getRevertOnDrop(){return this.#o}setRevertOnDrop(t){if("boolean"!=typeof t)throw new Error("revertOnDrop must be a boolean.");this.#o=t}getCollisionByMouse(){return this.#a}setCollisionByMouse(t){if("boolean"!=typeof t)throw new Error("collisionByMouse must be a boolean.");this.#a=t}getDropInJailOnly(){return this.#l}setDropInJailOnly(t){if("boolean"!=typeof t)throw new Error("dropInJailOnly must be a boolean.");this.#l=t}getTarget(){return this.#d}getJail(){return this.#g}getDragProxy(){return this.#u}getLastCollision(){return this.#h}getCollidables(){return[...this.#f]}getDragHiddenClass(){return this.#p}getClassDragging(){return this.#y}getClassBodyDragging(){return this.#v}getClassJailDragging(){return this.#b}getClassJailDragDisabled(){return this.#m}getClassDragCollision(){return this.#w}getVibrations(){return{...this.#c}}getStartVibration(){return this.#c.start}getEndVibration(){return this.#c.end}getCollideVibration(){return this.#c.collide}getMoveVibration(){return this.#c.move}isEnabled(){return this.#t}#C(){if(this.#e)throw new Error("This TinyDragger instance has been destroyed and can no longer be used.")}destroy(){this.#e||(this.disable(),this.#d.removeEventListener("mousedown",this._onMouseDown),this.#d.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.#h&&this.#h.classList.remove(this.#w),this.#u&&(this.#u.remove(),this.#u=null),this.#f=[],this.#s=!1,this.#h=null,this.#d.classList.remove(this.#p,this.#y),document.body.classList.remove(this.#v),this.#g&&this.#g.classList.remove(this.#b,this.#m),this.#e=!0)}}})(),window.TinyDragger=i.TinyDragger})();
2
+ (()=>{var t={251:(t,e)=>{e.read=function(t,e,r,i,n){var o,s,a=8*n-i-1,l=(1<<a)-1,h=l>>1,f=-7,u=r?n-1:0,c=r?-1:1,g=t[e+u];for(u+=c,o=g&(1<<-f)-1,g>>=-f,f+=a;f>0;o=256*o+t[e+u],u+=c,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=i;f>0;s=256*s+t[e+u],u+=c,f-=8);if(0===o)o=1-h;else{if(o===l)return s?NaN:1/0*(g?-1:1);s+=Math.pow(2,i),o-=h}return(g?-1:1)*s*Math.pow(2,o-i)},e.write=function(t,e,r,i,n,o){var s,a,l,h=8*o-n-1,f=(1<<h)-1,u=f>>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,g=i?0:o-1,d=i?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+u>=1?c/l:c*Math.pow(2,1-u))*l>=2&&(s++,l/=2),s+u>=f?(a=0,s=f):s+u>=1?(a=(e*l-1)*Math.pow(2,n),s+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,n),s=0));n>=8;t[r+g]=255&a,g+=d,a/=256,n-=8);for(s=s<<n|a,h+=n;h>0;t[r+g]=255&s,g+=d,s/=256,h-=8);t[r+g-d]|=128*p}},287:(t,e,r)=>{"use strict";var i=r(526),n=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=l,e.IS=50;var s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,l.prototype),e}function l(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return h(t,e,r)}function h(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!l.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|p(t,e),i=a(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}(t,e);if(ArrayBuffer.isView(t))return function(t){if(N(t,Uint8Array)){var e=new Uint8Array(t);return g(e.buffer,e.byteOffset,e.byteLength)}return c(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(N(t,ArrayBuffer)||t&&N(t.buffer,ArrayBuffer))return g(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(N(t,SharedArrayBuffer)||t&&N(t.buffer,SharedArrayBuffer)))return g(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return l.from(i,e,r);var n=function(t){if(l.isBuffer(t)){var e=0|d(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||F(t.length)?a(0):c(t):"Buffer"===t.type&&Array.isArray(t.data)?c(t.data):void 0}(t);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return l.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return f(t),a(t<0?0:0|d(t))}function c(t){for(var e=t.length<0?0:0|d(t.length),r=a(e),i=0;i<e;i+=1)r[i]=255&t[i];return r}function g(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var i;return i=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(i,l.prototype),i}function d(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function p(t,e){if(l.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||N(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return S(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return _(t).length;default:if(n)return i?-1:S(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,r);case"utf8":case"utf-8":return L(this,e,r);case"ascii":return x(this,e,r);case"latin1":case"binary":return O(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function v(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function b(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),F(r=+r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=l.from(e,i)),l.isBuffer(e))return 0===e.length?-1:m(t,e,r,i,n);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,i,n){var o,s=1,a=t.length,l=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;s=2,a/=2,l/=2,r/=2}function h(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(n){var f=-1;for(o=r;o<a;o++)if(h(t,o)===h(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===l)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(r+l>a&&(r=a-l),o=r;o>=0;o--){for(var u=!0,c=0;c<l;c++)if(h(t,o+c)!==h(e,c)){u=!1;break}if(u)return o}return-1}function w(t,e,r,i){r=Number(r)||0;var n=t.length-r;i?(i=Number(i))>n&&(i=n):i=n;var o=e.length;i>o/2&&(i=o/2);for(var s=0;s<i;++s){var a=parseInt(e.substr(2*s,2),16);if(F(a))return s;t[r+s]=a}return s}function E(t,e,r,i){return H(S(e,t.length-r),t,r,i)}function C(t,e,r,i){return H(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,i)}function D(t,e,r,i){return H(_(e),t,r,i)}function B(t,e,r,i){return H(function(t,e){for(var r,i,n,o=[],s=0;s<t.length&&!((e-=2)<0);++s)i=(r=t.charCodeAt(s))>>8,n=r%256,o.push(n),o.push(i);return o}(e,t.length-r),t,r,i)}function A(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function L(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n<r;){var o,s,a,l,h=t[n],f=null,u=h>239?4:h>223?3:h>191?2:1;if(n+u<=r)switch(u){case 1:h<128&&(f=h);break;case 2:128==(192&(o=t[n+1]))&&(l=(31&h)<<6|63&o)>127&&(f=l);break;case 3:o=t[n+1],s=t[n+2],128==(192&o)&&128==(192&s)&&(l=(15&h)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(f=l);break;case 4:o=t[n+1],s=t[n+2],a=t[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(f=l)}null===f?(f=65533,u=1):f>65535&&(f-=65536,i.push(f>>>10&1023|55296),f=56320|1023&f),i.push(f),n+=u}return function(t){var e=t.length;if(e<=M)return String.fromCharCode.apply(String,t);for(var r="",i=0;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=M));return r}(i)}l.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){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(t,e,r){return h(t,e,r)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(t,e,r){return function(t,e,r){return f(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},l.allocUnsafe=function(t){return u(t)},l.allocUnsafeSlow=function(t){return u(t)},l.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==l.prototype},l.compare=function(t,e){if(N(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),N(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(t)||!l.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,i=e.length,n=0,o=Math.min(r,i);n<o;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:i<r?1:0},l.isEncoding=function(t){switch(String(t).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(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return l.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=l.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){var o=t[r];if(N(o,Uint8Array))n+o.length>i.length?l.from(o).copy(i,n):Uint8Array.prototype.set.call(i,o,n);else{if(!l.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,n)}n+=o.length}return i},l.byteLength=p,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)v(this,e,e+1);return this},l.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)v(this,e,e+3),v(this,e+1,e+2);return this},l.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)v(this,e,e+7),v(this,e+1,e+6),v(this,e+2,e+5),v(this,e+3,e+4);return this},l.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?L(this,0,t):y.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(t){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===l.compare(this,t)},l.prototype.inspect=function(){var t="",r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(l.prototype[o]=l.prototype.inspect),l.prototype.compare=function(t,e,r,i,n){if(N(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),h=this.slice(i,n),f=t.slice(e,r),u=0;u<a;++u)if(h[u]!==f[u]){o=h[u],s=f[u];break}return o<s?-1:s<o?1:0},l.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},l.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},l.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},l.prototype.write=function(t,e,r,i){if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":case"latin1":case"binary":return C(this,t,e,r);case"base64":return D(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var M=4096;function x(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}function O(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function T(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var n="",o=e;o<r;++o)n+=Y[t[o]];return n}function I(t,e,r){for(var i=t.slice(e,r),n="",o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+256*i[o+1]);return n}function U(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,r,i,n,o){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}function P(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(t,e,r,i,o){return e=+e,r>>>=0,o||P(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function k(t,e,r,i,o){return e=+e,r>>>=0,o||P(t,0,r,8),n.write(t,e,r,i,52,8),r+8}l.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var i=this.subarray(t,e);return Object.setPrototypeOf(i,l.prototype),i},l.prototype.readUintLE=l.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i},l.prototype.readUintBE=l.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},l.prototype.readUint8=l.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*e)),i},l.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var i=e,n=1,o=this[t+--i];i>0&&(n*=256);)o+=this[t+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},l.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){t>>>=0,e||U(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(t,e){t>>>=0,e||U(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return t>>>=0,e||U(t,4,this.length),n.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),n.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),n.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),n.read(this,t,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||R(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o<r&&(n*=256);)this[e+o]=t/n&255;return e+r},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||R(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,255,0),this[e]=255&t,e+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},l.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);R(this,t,e,r,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s|0)-a&255;return e+r},l.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);R(this,t,e,r,n-1,-n)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s|0)-a&255;return e+r},l.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},l.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},l.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},l.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},l.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},l.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},l.prototype.writeDoubleLE=function(t,e,r){return k(this,t,e,!0,r)},l.prototype.writeDoubleBE=function(t,e,r){return k(this,t,e,!1,r)},l.prototype.copy=function(t,e,r,i){if(!l.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var n=i-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,i):Uint8Array.prototype.set.call(t,this.subarray(r,i),e),n},l.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){var n=t.charCodeAt(0);("utf8"===i&&n<128||"latin1"===i)&&(t=n)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=l.isBuffer(t)?t:l.from(t,i),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var J=/[^+/0-9A-Za-z-_]/g;function S(t,e){var r;e=e||1/0;for(var i=t.length,n=null,o=[],s=0;s<i;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function _(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(J,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function N(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function F(t){return t!=t}var Y=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var i=16*r,n=0;n<16;++n)e[i+n]=t[r]+t[n];return e}()},526:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),r=e[0],i=e[1];return 3*(r+i)/4-i},e.toByteArray=function(t){var e,r,o=a(t),s=o[0],l=o[1],h=new n(function(t,e,r){return 3*(e+r)/4-r}(0,s,l)),f=0,u=l>0?s-4:s;for(r=0;r<u;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],h[f++]=e>>16&255,h[f++]=e>>8&255,h[f++]=255&e;return 2===l&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,h[f++]=255&e),1===l&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,h[f++]=e>>8&255,h[f++]=255&e),h},e.fromByteArray=function(t){for(var e,i=t.length,n=i%3,o=[],s=16383,a=0,h=i-n;a<h;a+=s)o.push(l(t,a,a+s>h?h:a+s));return 1===n?(e=t[i-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===n&&(e=(t[i-2]<<8)+t[i-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],i=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],i[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,i){for(var n,o,s=[],a=e;a<i;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(r[(o=n)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i](o,o.exports,r),o.exports}r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var i={};(()=>{"use strict";r.d(i,{TinyDragger:()=>l});var t=r(287);const e="undefined"!=typeof window&&void 0!==window.document,n={items:{},order:[]};function o(t,e){const r=[],i=Array.isArray(t)?t:Object.entries(t);for(const[t,o]of i)if(!n.items.hasOwnProperty(t)){n.items[t]=o;let i="number"==typeof e?e:-1;if(-1===i){const t=n.order.indexOf("object");i=t>-1?t:n.order.length}i=Math.min(Math.max(0,i),n.order.length),n.order.splice(i,0,t),r.push(t)}return r}function s(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"===Object.prototype.toString.call(t)}o([["undefined",t=>void 0===t],["null",t=>null===t],["boolean",t=>"boolean"==typeof t],["number",t=>"number"==typeof t&&!Number.isNaN(t)],["bigint",t=>"bigint"==typeof t],["string",t=>"string"==typeof t],["symbol",t=>"symbol"==typeof t],["function",t=>"function"==typeof t],["array",t=>Array.isArray(t)]]),e||o([["buffer",e=>void 0!==t.hp&&t.hp.isBuffer(e)]]),e&&o([["file",t=>"undefined"!=typeof File&&t instanceof File]]),o([["date",t=>t instanceof Date],["regexp",t=>t instanceof RegExp],["map",t=>t instanceof Map],["set",t=>t instanceof Set],["weakmap",t=>t instanceof WeakMap],["weakset",t=>t instanceof WeakSet],["promise",t=>t instanceof Promise]]),e&&o([["htmlelement",t=>"undefined"!=typeof HTMLElement&&t instanceof HTMLElement]]),o([["object",t=>s(t)]]);const a=t=>{const e=getComputedStyle(t),r=parseFloat(e.borderLeftWidth)||0,i=parseFloat(e.borderRightWidth)||0,n=parseFloat(e.borderTopWidth)||0,o=parseFloat(e.borderBottomWidth)||0;return{x:r+i,y:n+o,left:r,right:i,top:n,bottom:o}},l=class{#t=!0;#e=!1;#r=0;#i=0;#n=!1;#o=!1;#s=!1;#a=!1;#l=!1;#h=!1;#f=null;#u=[];#c=null;#g={start:!1,end:!1,collide:!1,move:!1};#d=null;#p;#y="drag-hidden";#v="dragging";#b="drag-active";#m="jail-drag-active";#w="jail-drag-disabled";#E="dragging-collision";constructor(t,e={}){if(!(t instanceof HTMLElement))throw new Error("TinyDragger requires a valid target HTMLElement to initialize.");if(this.#p=t,void 0!==e.jail&&!(e.jail instanceof HTMLElement))throw new Error('The "jail" option must be an HTMLElement if provided.');if(void 0!==e.vibration&&!1!==e.vibration&&!s(e.vibration))throw new Error('The "vibration" option must be an object or false.');const r=(t,e)=>{if(void 0!==t&&"boolean"!=typeof t)throw new Error(`The "${e}" option must be a boolean.`)},i=(t,e)=>{if(void 0!==t&&"string"!=typeof t)throw new Error(`The "${e}" option must be a string.`)};r(e.collisionByMouse,"collisionByMouse"),r(e.lockInsideJail,"lockInsideJail"),r(e.dropInJailOnly,"dropInJailOnly"),r(e.revertOnDrop,"revertOnDrop"),r(e.multiCollision,"multiCollision"),i(e.classDragging,"classDragging"),i(e.classBodyDragging,"classBodyDragging"),i(e.classJailDragging,"classJailDragging"),i(e.classJailDragDisabled,"classJailDragDisabled"),i(e.classDragCollision,"classDragCollision"),i(e.classHidden,"classHidden"),e.jail instanceof HTMLElement&&(this.#d=e.jail),this.#g=Object.assign({start:!1,end:!1,collide:!1,move:!1},s(e.vibration)?e.vibration:{}),"string"==typeof e.classDragging&&(this.#v=e.classDragging),"string"==typeof e.classBodyDragging&&(this.#b=e.classBodyDragging),"string"==typeof e.classJailDragging&&(this.#m=e.classJailDragging),"string"==typeof e.classJailDragDisabled&&(this.#w=e.classJailDragDisabled),"string"==typeof e.classHidden&&(this.#y=e.classHidden),"string"==typeof e.classDragCollision&&(this.#E=e.classDragCollision),"boolean"==typeof e.collisionByMouse&&(this.#l=e.collisionByMouse),"boolean"==typeof e.revertOnDrop&&(this.#s=e.revertOnDrop),"boolean"==typeof e.lockInsideJail&&(this.#o=e.lockInsideJail),"boolean"==typeof e.dropInJailOnly&&(this.#h=e.dropInJailOnly),"boolean"==typeof e.multiCollision&&(this.#n=e.multiCollision),this._onMouseDown=this.#C.bind(this),this._onMouseMove=this.#D.bind(this),this._onMouseUp=this.#B.bind(this),this._onTouchStart=t=>this.#C(t.touches[0]),this._onTouchMove=t=>this.#D(t.touches[0]),this._onTouchEnd=t=>this.#B(t.changedTouches[0]),this.#p.addEventListener("mousedown",this._onMouseDown),this.#p.addEventListener("touchstart",this._onTouchStart,{passive:!1})}enable(){this.#A(),this.#d&&this.#d.classList.add(this.#w),this.#t=!0}disable(){this.#d&&this.#d.classList.remove(this.#w),this.#t=!1}addCollidable(t){if(this.#A(),!(t instanceof HTMLElement))throw new Error("addCollidable expects an HTMLElement as argument.");this.#u.includes(t)||this.#u.push(t)}removeCollidable(t){if(this.#A(),!(t instanceof HTMLElement))throw new Error("removeCollidable expects an HTMLElement as argument.");this.#u=this.#u.filter((e=>e!==t))}setVibrationPattern({startPattern:t=!1,endPattern:e=!1,collidePattern:r=!1,movePattern:i=!1}={}){this.#A();const n=t=>!1===t||Array.isArray(t)&&t.every((t=>"number"==typeof t));if(!n(t))throw new Error('Invalid "startPattern": must be false or an array of numbers.');if(!n(e))throw new Error('Invalid "endPattern": must be false or an array of numbers.');if(!n(r))throw new Error('Invalid "collidePattern": must be false or an array of numbers.');if(!n(i))throw new Error('Invalid "movePattern": must be false or an array of numbers.');this.#g={start:t,end:e,collide:r,move:i}}disableVibration(){this.#A(),this.#g={start:!1,end:!1,collide:!1,move:!1}}getOffset(t){if(this.#A(),!(t instanceof MouseEvent||t instanceof Touch)||"number"!=typeof t.clientX||"number"!=typeof t.clientY)throw new Error("getOffset expects an event with valid clientX and clientY coordinates.");const e=this.#p.getBoundingClientRect(),{left:r,top:i}=a(this.#p);return{x:t.clientX-e.left+r,y:t.clientY-e.top+i}}#C(t){if(t instanceof MouseEvent&&t.preventDefault(),this.#e||!this.#t||!this.#p.parentElement)return;const e=this.#p.cloneNode(!0);if(!(e instanceof HTMLElement))return;this.#c=e,this.#a=!0;const r=this.#p.getBoundingClientRect();Object.assign(this.#c.style,{position:"absolute",pointerEvents:"none",left:`${this.#p.offsetLeft}px`,top:`${this.#p.offsetTop}px`,width:`${r.width}px`,height:`${r.height}px`,zIndex:9999}),this.#p.classList.add(this.#y),this.#p.parentElement.appendChild(this.#c);const{x:i,y:n}=this.getOffset(t);this.#i=i,this.#r=n,this.#c.classList.add(this.#v),document.body.classList.add(this.#b),this.#d&&this.#d.classList.add(this.#m),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.#g.start)&&navigator.vibrate(this.#g.start),this.checkDragCollision(t),this.#L("drag")}#M=[];#x(t){t&&(t.classList.add(this.#E),this.#M.push(t))}#O(){for(;this.#M.length>0;){const t=this.#M.shift();t&&t.classList.remove(this.#E)}this.#f&&this.#f.classList.remove(this.#E)}checkDragCollision(t){const{collidedElements:e}=this.execCollision(t),r=e[0]||null;this.#f&&!e.includes(this.#f)&&this.#O(),e.forEach((t=>this.#x(t))),this.#u.forEach((t=>{e.includes(t)||t.classList.remove(this.#E)})),navigator.vibrate&&Array.isArray(this.#g.collide)&&e.length>0&&navigator.vibrate(this.#g.collide),this.#f=r}#D(t){if(t instanceof MouseEvent&&t.preventDefault(),this.#e||!this.#a||!this.#t||!this.#c)return;const e=(this.#c.offsetParent||document.body).getBoundingClientRect();let r=t.clientX-e.left-this.#i,i=t.clientY-e.top-this.#r;if(this.#o&&this.#d){const t=this.#d.getBoundingClientRect(),n=this.#c.getBoundingClientRect(),o=t.left-e.left,s=t.top-e.top,{x:l,y:h}=a(this.#d),f=o+t.width-n.width-h,u=s+t.height-n.height-l;r=Math.max(o,Math.min(r,f)),i=Math.max(s,Math.min(i,u))}this.#c.style.position="absolute",this.#c.style.left=`${r}px`,this.#c.style.top=`${i}px`,navigator.vibrate&&Array.isArray(this.#g.move)&&navigator.vibrate(this.#g.move),this.checkDragCollision(t),this.#L("dragging")}execCollision(t){if(this.#e||!this.#c)return{inJail:!1,collidedElements:[]};let e=[],r=!0;const i=this.#d?.getBoundingClientRect();if(this.#l){const n=t.clientX,o=t.clientY;this.#h&&this.#d&&i&&(r=n>=i.left&&n<=i.right&&o>=i.top&&o<=i.bottom),e=r?this.#n?this.getAllCollidedElements(n,o):[this.getCollidedElement(n,o)].filter(Boolean):[]}else{const t=this.#c.getBoundingClientRect();this.#h&&this.#d&&i&&(r=t.left>=i.left&&t.right<=i.right&&t.top>=i.top&&t.bottom<=i.bottom),e=r?this.#n?this.getAllCollidedElementsByRect(t):[this.getCollidedElementByRect(t)].filter(Boolean):[]}return{inJail:r,collidedElements:e}}#B(t){if(t instanceof MouseEvent&&t.preventDefault(),this.#e||!this.#a)return;if(this.#a=!1,!this.#c)return;this.#p.classList.remove(this.#v),document.body.classList.remove(this.#b),this.#d&&this.#d.classList.remove(this.#m),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd);const{collidedElements:e}=this.execCollision(t);navigator.vibrate&&Array.isArray(this.#g.end)&&navigator.vibrate(this.#g.end);const r=this.#c.style.left,i=this.#c.style.top;this.#c&&(this.#c.remove(),this.#c=null),this.#f&&this.#O(),this.#f=null,this.#p.classList.remove(this.#y),this.#s||(this.#p.style.left=r,this.#p.style.top=i);const n=new CustomEvent("drop",{detail:{targets:e,first:e[0]||null}});this.#p.dispatchEvent(n)}#T(t,e){const r=t.getBoundingClientRect();return!(e.right<r.left||e.left>r.right||e.bottom<r.top||e.top>r.bottom)}getAllCollidedElementsByRect(t){if(this.#A(),!(t instanceof DOMRect)||"number"!=typeof t.left||"number"!=typeof t.right||"number"!=typeof t.top||"number"!=typeof t.bottom)throw new Error("getCollidedElementByRect expects a valid DOMRect object.");return this.#u.filter((e=>this.#T(e,t)))}getCollidedElementByRect(t){if(this.#A(),!(t instanceof DOMRect)||"number"!=typeof t.left||"number"!=typeof t.right||"number"!=typeof t.top||"number"!=typeof t.bottom)throw new Error("getCollidedElementByRect expects a valid DOMRect object.");return this.#u.find((e=>this.#T(e,t)))||null}#I(t,e,r){const i=t.getBoundingClientRect();return e>=i.left&&e<=i.right&&r>=i.top&&r<=i.bottom}getAllCollidedElements(t,e){if(this.#A(),"number"!=typeof t||"number"!=typeof e)throw new Error("getCollidedElement expects numeric x and y coordinates.");return this.#u.filter((r=>this.#I(r,t,e)))}getCollidedElement(t,e){if(this.#A(),"number"!=typeof t||"number"!=typeof e)throw new Error("getCollidedElement expects numeric x and y coordinates.");return this.#u.find((r=>this.#I(r,t,e)))||null}#L(t){const e=new CustomEvent(t);this.#p.dispatchEvent(e)}getDragging(){return this.#a}getLockInsideJail(){return this.#o}setLockInsideJail(t){if("boolean"!=typeof t)throw new Error("lockInsideJail must be a boolean.");this.#o=t}getRevertOnDrop(){return this.#s}setRevertOnDrop(t){if("boolean"!=typeof t)throw new Error("revertOnDrop must be a boolean.");this.#s=t}getCollisionByMouse(){return this.#l}setCollisionByMouse(t){if("boolean"!=typeof t)throw new Error("collisionByMouse must be a boolean.");this.#l=t}getDropInJailOnly(){return this.#h}setDropInJailOnly(t){if("boolean"!=typeof t)throw new Error("dropInJailOnly must be a boolean.");this.#h=t}getTarget(){return this.#p}getJail(){return this.#d}getDragProxy(){return this.#c}getLastCollision(){return this.#f}getCollidables(){return[...this.#u]}getDragHiddenClass(){return this.#y}getClassDragging(){return this.#v}getClassBodyDragging(){return this.#b}getClassJailDragging(){return this.#m}getClassJailDragDisabled(){return this.#w}getClassDragCollision(){return this.#E}getVibrations(){return{...this.#g}}getStartVibration(){return this.#g.start}getEndVibration(){return this.#g.end}getCollideVibration(){return this.#g.collide}getMoveVibration(){return this.#g.move}isEnabled(){return this.#t}#A(){if(this.#e)throw new Error("This TinyDragger instance has been destroyed and can no longer be used.")}destroy(){this.#e||(this.disable(),this.#p.removeEventListener("mousedown",this._onMouseDown),this.#p.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.#f&&this.#O(),this.#c&&(this.#c.remove(),this.#c=null),this.#u=[],this.#a=!1,this.#f=null,this.#p.classList.remove(this.#y,this.#v),document.body.classList.remove(this.#b),this.#d&&this.#d.classList.remove(this.#m,this.#w),this.#e=!0)}}})(),window.TinyDragger=i.TinyDragger})();