bard-attachment_field 0.4.2 → 0.4.3

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.
@@ -1,5 +1,5 @@
1
- var __glob = (map2) => (path) => {
2
- var fn = map2[path];
1
+ var __glob = (map) => (path) => {
2
+ var fn = map[path];
3
3
  if (fn) return fn();
4
4
  throw new Error("Module not found in bundle: " + path);
5
5
  };
@@ -76,9 +76,11 @@ var BUILD = {
76
76
  constructableCSS: true,
77
77
  devTools: false,
78
78
  shadowDelegatesFocus: true,
79
+ shadowSlotAssignmentManual: false,
79
80
  initializeNextTick: false,
80
81
  asyncLoading: true,
81
82
  asyncQueue: false,
83
+ // TODO: deprecated in favour of `setTagTransformer` and `transformTag`. Remove in 5.0
82
84
  transformTagName: false,
83
85
  attachStyles: true,
84
86
  // TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
@@ -99,11 +101,6 @@ var globalStyles = (
99
101
  var globImport_entry_js = __glob({});
100
102
 
101
103
  // node_modules/@stencil/core/internal/client/index.js
102
- var __defProp = Object.defineProperty;
103
- var __export = (target, all) => {
104
- for (var name in all)
105
- __defProp(target, name, { get: all[name], enumerable: true });
106
- };
107
104
  var Build = {
108
105
  isDev: BUILD.isDev ? true : false,
109
106
  isBrowser: true,
@@ -136,6 +133,15 @@ var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
136
133
  var TYPE_CONSTANT = "type";
137
134
  var VALUE_CONSTANT = "value";
138
135
  var SERIALIZED_PREFIX = "serialized:";
136
+ function getPropertyDescriptor(obj, memberName, getOnly) {
137
+ const stopAt = typeof HTMLElement !== "undefined" ? HTMLElement.prototype : null;
138
+ while (obj && obj !== stopAt) {
139
+ const desc = Object.getOwnPropertyDescriptor(obj, memberName);
140
+ if (desc && (!getOnly || desc.get)) return desc;
141
+ obj = Object.getPrototypeOf(obj);
142
+ }
143
+ return void 0;
144
+ }
139
145
  var reWireGetterSetter = (instance, hostRef) => {
140
146
  var _a;
141
147
  const cmpMeta = hostRef.$cmpMeta$;
@@ -143,7 +149,7 @@ var reWireGetterSetter = (instance, hostRef) => {
143
149
  members.map(([memberName, [memberFlags]]) => {
144
150
  if ((BUILD.state || BUILD.prop) && (memberFlags & 31 || memberFlags & 32)) {
145
151
  const ogValue = instance[memberName];
146
- const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName) || Object.getOwnPropertyDescriptor(instance, memberName);
152
+ const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName, true) || Object.getOwnPropertyDescriptor(instance, memberName);
147
153
  if (ogDescriptor) {
148
154
  Object.defineProperty(instance, memberName, {
149
155
  get() {
@@ -156,18 +162,14 @@ var reWireGetterSetter = (instance, hostRef) => {
156
162
  enumerable: true
157
163
  });
158
164
  }
159
- instance[memberName] = hostRef.$instanceValues$.has(memberName) ? hostRef.$instanceValues$.get(memberName) : ogValue;
165
+ if (hostRef.$instanceValues$.has(memberName)) {
166
+ instance[memberName] = hostRef.$instanceValues$.get(memberName);
167
+ } else if (ogValue !== void 0) {
168
+ instance[memberName] = ogValue;
169
+ }
160
170
  }
161
171
  });
162
172
  };
163
- function getPropertyDescriptor(obj, memberName) {
164
- while (obj) {
165
- const desc = Object.getOwnPropertyDescriptor(obj, memberName);
166
- if (desc == null ? void 0 : desc.get) return desc;
167
- obj = Object.getPrototypeOf(obj);
168
- }
169
- return void 0;
170
- }
171
173
  var getHostRef = (ref) => {
172
174
  if (ref.__stencil__getHostRef) {
173
175
  return ref.__stencil__getHostRef();
@@ -186,10 +188,10 @@ var registerHost = (hostElement, cmpMeta) => {
186
188
  hostRef.$renderCount$ = 0;
187
189
  }
188
190
  if (BUILD.method && BUILD.lazyLoad) {
189
- hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
191
+ hostRef.$onInstancePromise$ = new Promise((r2) => hostRef.$onInstanceResolve$ = r2);
190
192
  }
191
193
  if (BUILD.asyncLoading) {
192
- hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
194
+ hostRef.$onReadyPromise$ = new Promise((r2) => hostRef.$onReadyResolve$ = r2);
193
195
  hostElement["s-p"] = [];
194
196
  hostElement["s-rc"] = [];
195
197
  }
@@ -198,20 +200,20 @@ var registerHost = (hostElement, cmpMeta) => {
198
200
  }
199
201
  const ref = hostRef;
200
202
  hostElement.__stencil__getHostRef = () => ref;
201
- if (!BUILD.lazyLoad && BUILD.modernPropertyDecls && (BUILD.state || BUILD.prop)) {
203
+ if (!BUILD.lazyLoad && cmpMeta.$flags$ & 512 && (BUILD.state || BUILD.prop)) {
202
204
  reWireGetterSetter(hostElement, hostRef);
203
205
  }
204
206
  return ref;
205
207
  };
206
208
  var isMemberInElement = (elm, memberName) => memberName in elm;
207
209
  var customError;
208
- var consoleError = (e, el) => (customError || console.error)(e, el);
210
+ var consoleError = (e2, el) => (customError || console.error)(e2, el);
209
211
  var STENCIL_DEV_MODE = BUILD.isTesting ? ["STENCIL:"] : [
210
212
  "%cstencil",
211
213
  "color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
212
214
  ];
213
- var consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
214
- var consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
215
+ var consoleDevError = (...m2) => console.error(...STENCIL_DEV_MODE, ...m2);
216
+ var consoleDevWarn = (...m2) => console.warn(...STENCIL_DEV_MODE, ...m2);
215
217
  var cmpModules = /* @__PURE__ */ new Map();
216
218
  var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
217
219
  const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
@@ -235,8 +237,8 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
235
237
  }
236
238
  return importedModule[exportName];
237
239
  },
238
- (e) => {
239
- consoleError(e, hostRef.$hostElement$);
240
+ (e2) => {
241
+ consoleError(e2, hostRef.$hostElement$);
240
242
  }
241
243
  );
242
244
  };
@@ -265,8 +267,8 @@ var H = win.HTMLElement || class {
265
267
  var plt = {
266
268
  $flags$: 0,
267
269
  $resourcesUrl$: "",
268
- jmp: (h2) => h2(),
269
- raf: (h2) => requestAnimationFrame(h2),
270
+ jmp: (h22) => h22(),
271
+ raf: (h22) => requestAnimationFrame(h22),
270
272
  ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
271
273
  rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
272
274
  ce: (eventName, opts) => new CustomEvent(eventName, opts)
@@ -285,16 +287,19 @@ var supportsListenerOptions = /* @__PURE__ */ (() => {
285
287
  }
286
288
  })
287
289
  );
288
- } catch (e) {
290
+ } catch (e2) {
289
291
  }
290
292
  return supportsListenerOptions2;
291
293
  })();
292
- var promiseResolve = (v) => Promise.resolve(v);
294
+ var promiseResolve = (v2) => Promise.resolve(v2);
293
295
  var supportsConstructableStylesheets = BUILD.constructableCSS ? /* @__PURE__ */ (() => {
294
296
  try {
297
+ if (!win.document.adoptedStyleSheets) {
298
+ return false;
299
+ }
295
300
  new CSSStyleSheet();
296
301
  return typeof new CSSStyleSheet().replaceSync === "function";
297
- } catch (e) {
302
+ } catch (e2) {
298
303
  }
299
304
  return false;
300
305
  })() : false;
@@ -319,8 +324,8 @@ var consume = (queue) => {
319
324
  for (let i2 = 0; i2 < queue.length; i2++) {
320
325
  try {
321
326
  queue[i2](performance.now());
322
- } catch (e) {
323
- consoleError(e);
327
+ } catch (e2) {
328
+ consoleError(e2);
324
329
  }
325
330
  }
326
331
  queue.length = 0;
@@ -331,8 +336,8 @@ var consumeTimeout = (queue, timeout) => {
331
336
  while (i2 < queue.length && (ts = performance.now()) < timeout) {
332
337
  try {
333
338
  queue[i2++](ts);
334
- } catch (e) {
335
- consoleError(e);
339
+ } catch (e2) {
340
+ consoleError(e2);
336
341
  }
337
342
  }
338
343
  if (i2 === queue.length) {
@@ -373,164 +378,6 @@ var getAssetPath = (path) => {
373
378
  return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
374
379
  };
375
380
  var setAssetPath = (path) => plt.$resourcesUrl$ = path;
376
- var isDef = (v) => v != null && v !== void 0;
377
- var isComplexType = (o) => {
378
- o = typeof o;
379
- return o === "object" || o === "function";
380
- };
381
- function queryNonceMetaTagContent(doc) {
382
- var _a, _b, _c;
383
- return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
384
- }
385
- var escapeRegExpSpecialCharacters = (text) => {
386
- return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
387
- };
388
- var RemoteValue = class _RemoteValue {
389
- /**
390
- * Deserializes a LocalValue serialized object back to its original JavaScript representation
391
- *
392
- * @param serialized The serialized LocalValue object
393
- * @returns The original JavaScript value/object
394
- */
395
- static fromLocalValue(serialized) {
396
- const type = serialized[TYPE_CONSTANT];
397
- const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
398
- switch (type) {
399
- case "string":
400
- return value;
401
- case "boolean":
402
- return value;
403
- case "bigint":
404
- return BigInt(value);
405
- case "undefined":
406
- return void 0;
407
- case "null":
408
- return null;
409
- case "number":
410
- if (value === "NaN") return NaN;
411
- if (value === "-0") return -0;
412
- if (value === "Infinity") return Infinity;
413
- if (value === "-Infinity") return -Infinity;
414
- return value;
415
- case "array":
416
- return value.map((item) => _RemoteValue.fromLocalValue(item));
417
- case "date":
418
- return new Date(value);
419
- case "map":
420
- const map2 = /* @__PURE__ */ new Map();
421
- for (const [key, val] of value) {
422
- const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
423
- const deserializedValue = _RemoteValue.fromLocalValue(val);
424
- map2.set(deserializedKey, deserializedValue);
425
- }
426
- return map2;
427
- case "object":
428
- const obj = {};
429
- for (const [key, val] of value) {
430
- obj[key] = _RemoteValue.fromLocalValue(val);
431
- }
432
- return obj;
433
- case "regexp":
434
- const { pattern, flags } = value;
435
- return new RegExp(pattern, flags);
436
- case "set":
437
- const set = /* @__PURE__ */ new Set();
438
- for (const item of value) {
439
- set.add(_RemoteValue.fromLocalValue(item));
440
- }
441
- return set;
442
- case "symbol":
443
- return Symbol(value);
444
- default:
445
- throw new Error(`Unsupported type: ${type}`);
446
- }
447
- }
448
- /**
449
- * Utility method to deserialize multiple LocalValues at once
450
- *
451
- * @param serializedValues Array of serialized LocalValue objects
452
- * @returns Array of deserialized JavaScript values
453
- */
454
- static fromLocalValueArray(serializedValues) {
455
- return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
456
- }
457
- /**
458
- * Verifies if the given object matches the structure of a serialized LocalValue
459
- *
460
- * @param obj Object to verify
461
- * @returns boolean indicating if the object has LocalValue structure
462
- */
463
- static isLocalValueObject(obj) {
464
- if (typeof obj !== "object" || obj === null) {
465
- return false;
466
- }
467
- if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
468
- return false;
469
- }
470
- const type = obj[TYPE_CONSTANT];
471
- const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
472
- if (!hasTypeProperty) {
473
- return false;
474
- }
475
- if (type !== "null" && type !== "undefined") {
476
- return obj.hasOwnProperty(VALUE_CONSTANT);
477
- }
478
- return true;
479
- }
480
- };
481
- var result_exports = {};
482
- __export(result_exports, {
483
- err: () => err,
484
- map: () => map,
485
- ok: () => ok,
486
- unwrap: () => unwrap,
487
- unwrapErr: () => unwrapErr
488
- });
489
- var ok = (value) => ({
490
- isOk: true,
491
- isErr: false,
492
- value
493
- });
494
- var err = (value) => ({
495
- isOk: false,
496
- isErr: true,
497
- value
498
- });
499
- function map(result, fn) {
500
- if (result.isOk) {
501
- const val = fn(result.value);
502
- if (val instanceof Promise) {
503
- return val.then((newVal) => ok(newVal));
504
- } else {
505
- return ok(val);
506
- }
507
- }
508
- if (result.isErr) {
509
- const value = result.value;
510
- return err(value);
511
- }
512
- throw "should never get here";
513
- }
514
- var unwrap = (result) => {
515
- if (result.isOk) {
516
- return result.value;
517
- } else {
518
- throw result.value;
519
- }
520
- };
521
- var unwrapErr = (result) => {
522
- if (result.isErr) {
523
- return result.value;
524
- } else {
525
- throw result.value;
526
- }
527
- };
528
- function deserializeProperty(value) {
529
- if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
530
- return value;
531
- }
532
- return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
533
- }
534
381
  function createStyleSheetIfNeededAndSupported(styles2) {
535
382
  if (!styles2 || !supportsConstructableStylesheets) return void 0;
536
383
  const sheet = new CSSStyleSheet();
@@ -538,12 +385,20 @@ function createStyleSheetIfNeededAndSupported(styles2) {
538
385
  return sheet;
539
386
  }
540
387
  var globalStyleSheet;
388
+ var GLOBAL_STYLE_ID = "sc-global";
541
389
  function createShadowRoot(cmpMeta) {
542
390
  var _a;
543
- const shadowRoot = BUILD.shadowDelegatesFocus ? this.attachShadow({
544
- mode: "open",
545
- delegatesFocus: !!(cmpMeta.$flags$ & 16)
546
- }) : this.attachShadow({ mode: "open" });
391
+ const opts = { mode: "open" };
392
+ if (BUILD.shadowDelegatesFocus) {
393
+ opts.delegatesFocus = !!(cmpMeta.$flags$ & 16);
394
+ }
395
+ if (BUILD.shadowSlotAssignmentManual) {
396
+ const isManual = !!(cmpMeta.$flags$ & 1024);
397
+ if (isManual) {
398
+ opts.slotAssignment = "manual";
399
+ }
400
+ }
401
+ const shadowRoot = this.attachShadow(opts);
547
402
  if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported(globalStyles)) != null ? _a : null;
548
403
  if (globalStyleSheet) {
549
404
  if (supportsMutableAdoptedStyleSheets) {
@@ -551,20 +406,15 @@ function createShadowRoot(cmpMeta) {
551
406
  } else {
552
407
  shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
553
408
  }
409
+ } else if (globalStyles && !supportsConstructableStylesheets) {
410
+ const styleElm = document.createElement("style");
411
+ styleElm.innerHTML = globalStyles;
412
+ if (BUILD.hotModuleReplacement) {
413
+ styleElm.setAttribute(HYDRATED_STYLE_ID, GLOBAL_STYLE_ID);
414
+ }
415
+ shadowRoot.prepend(styleElm);
554
416
  }
555
417
  }
556
- var lowerPathParam = (fn) => (p) => fn(p.toLowerCase());
557
- var isDtsFile = lowerPathParam((p) => p.endsWith(".d.ts") || p.endsWith(".d.mts") || p.endsWith(".d.cts"));
558
- var isTsFile = lowerPathParam(
559
- (p) => !isDtsFile(p) && (p.endsWith(".ts") || p.endsWith(".mts") || p.endsWith(".cts"))
560
- );
561
- var isTsxFile = lowerPathParam(
562
- (p) => p.endsWith(".tsx") || p.endsWith(".mtsx") || p.endsWith(".ctsx")
563
- );
564
- var isJsxFile = lowerPathParam(
565
- (p) => p.endsWith(".jsx") || p.endsWith(".mjsx") || p.endsWith(".cjsx")
566
- );
567
- var isJsFile = lowerPathParam((p) => p.endsWith(".js") || p.endsWith(".mjs") || p.endsWith(".cjs"));
568
418
  var updateFallbackSlotVisibility = (elm) => {
569
419
  const childNodes = internalCall(elm, "childNodes");
570
420
  if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
@@ -647,15 +497,15 @@ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
647
497
  slottedNodeLocation["s-oo"] = position;
648
498
  const childNodes = internalCall(parent, "childNodes");
649
499
  const slotRelocateNodes = [slottedNodeLocation];
650
- childNodes.forEach((n) => {
651
- if (n["s-nr"]) slotRelocateNodes.push(n);
500
+ childNodes.forEach((n3) => {
501
+ if (n3["s-nr"]) slotRelocateNodes.push(n3);
652
502
  });
653
- slotRelocateNodes.sort((a, b) => {
654
- if (!a["s-oo"] || a["s-oo"] < (b["s-oo"] || 0)) return -1;
655
- else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
503
+ slotRelocateNodes.sort((a3, b2) => {
504
+ if (!a3["s-oo"] || a3["s-oo"] < (b2["s-oo"] || 0)) return -1;
505
+ else if (!b2["s-oo"] || b2["s-oo"] < a3["s-oo"]) return 1;
656
506
  return 0;
657
507
  });
658
- slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
508
+ slotRelocateNodes.forEach((n3) => appendMethod.call(parent, n3));
659
509
  } else {
660
510
  appendMethod.call(parent, slottedNodeLocation);
661
511
  }
@@ -677,14 +527,14 @@ function patchSlotNode(node) {
677
527
  }
678
528
  const parent = this["s-cr"].parentElement;
679
529
  const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
680
- slottedNodes.forEach((n) => {
681
- if (slotName === getSlotName(n)) {
682
- toReturn.push(n);
530
+ slottedNodes.forEach((n3) => {
531
+ if (slotName === getSlotName(n3)) {
532
+ toReturn.push(n3);
683
533
  }
684
534
  });
685
535
  if (elementsOnly) {
686
536
  return toReturn.filter(
687
- (n) => n.nodeType === 1
537
+ (n3) => n3.nodeType === 1
688
538
  /* ElementNode */
689
539
  );
690
540
  }
@@ -719,7 +569,8 @@ var patchPseudoShadowDom = (hostElementPrototype) => {
719
569
  patchSlotRemoveChild(hostElementPrototype);
720
570
  };
721
571
  var patchCloneNode = (HostElementPrototype) => {
722
- const orgCloneNode = HostElementPrototype.cloneNode;
572
+ if (HostElementPrototype.__cloneNode) return;
573
+ const orgCloneNode = HostElementPrototype.__cloneNode = HostElementPrototype.cloneNode;
723
574
  HostElementPrototype.cloneNode = function(deep) {
724
575
  const srcNode = this;
725
576
  const isShadowDom = BUILD.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
@@ -764,6 +615,7 @@ var patchCloneNode = (HostElementPrototype) => {
764
615
  };
765
616
  };
766
617
  var patchSlotAppendChild = (HostElementPrototype) => {
618
+ if (HostElementPrototype.__appendChild) return;
767
619
  HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
768
620
  HostElementPrototype.appendChild = function(newChild) {
769
621
  const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
@@ -781,6 +633,7 @@ var patchSlotAppendChild = (HostElementPrototype) => {
781
633
  };
782
634
  };
783
635
  var patchSlotRemoveChild = (ElementPrototype) => {
636
+ if (ElementPrototype.__removeChild) return;
784
637
  ElementPrototype.__removeChild = ElementPrototype.removeChild;
785
638
  ElementPrototype.removeChild = function(toRemove) {
786
639
  if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
@@ -796,6 +649,7 @@ var patchSlotRemoveChild = (ElementPrototype) => {
796
649
  };
797
650
  };
798
651
  var patchSlotPrepend = (HostElementPrototype) => {
652
+ if (HostElementPrototype.__prepend) return;
799
653
  HostElementPrototype.__prepend = HostElementPrototype.prepend;
800
654
  HostElementPrototype.prepend = function(...newChildren) {
801
655
  newChildren.forEach((newChild) => {
@@ -822,6 +676,7 @@ var patchSlotPrepend = (HostElementPrototype) => {
822
676
  };
823
677
  };
824
678
  var patchSlotAppend = (HostElementPrototype) => {
679
+ if (HostElementPrototype.__append) return;
825
680
  HostElementPrototype.__append = HostElementPrototype.append;
826
681
  HostElementPrototype.append = function(...newChildren) {
827
682
  newChildren.forEach((newChild) => {
@@ -833,6 +688,7 @@ var patchSlotAppend = (HostElementPrototype) => {
833
688
  };
834
689
  };
835
690
  var patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
691
+ if (HostElementPrototype.__insertAdjacentHTML) return;
836
692
  const originalInsertAdjacentHtml = HostElementPrototype.insertAdjacentHTML;
837
693
  HostElementPrototype.insertAdjacentHTML = function(position, text) {
838
694
  if (position !== "afterbegin" && position !== "beforeend") {
@@ -858,6 +714,7 @@ var patchSlotInsertAdjacentText = (HostElementPrototype) => {
858
714
  };
859
715
  };
860
716
  var patchInsertBefore = (HostElementPrototype) => {
717
+ if (HostElementPrototype.__insertBefore) return;
861
718
  const eleProto = HostElementPrototype;
862
719
  if (eleProto.__insertBefore) return;
863
720
  eleProto.__insertBefore = HostElementPrototype.insertBefore;
@@ -892,6 +749,7 @@ var patchInsertBefore = (HostElementPrototype) => {
892
749
  };
893
750
  };
894
751
  var patchSlotInsertAdjacentElement = (HostElementPrototype) => {
752
+ if (HostElementPrototype.__insertAdjacentElement) return;
895
753
  const originalInsertAdjacentElement = HostElementPrototype.insertAdjacentElement;
896
754
  HostElementPrototype.insertAdjacentElement = function(position, element) {
897
755
  if (position !== "afterbegin" && position !== "beforeend") {
@@ -928,14 +786,14 @@ var patchTextContent = (hostElementPrototype) => {
928
786
  };
929
787
  var patchChildSlotNodes = (elm) => {
930
788
  class FakeNodeList extends Array {
931
- item(n) {
932
- return this[n];
789
+ item(n3) {
790
+ return this[n3];
933
791
  }
934
792
  }
935
793
  patchHostOriginalAccessor("children", elm);
936
794
  Object.defineProperty(elm, "children", {
937
795
  get() {
938
- return this.childNodes.filter((n) => n.nodeType === 1);
796
+ return this.childNodes.filter((n3) => n3.nodeType === 1);
939
797
  }
940
798
  });
941
799
  Object.defineProperty(elm, "childElementCount", {
@@ -1110,6 +968,10 @@ var uniqueTime = (key, measureText) => {
1110
968
  };
1111
969
  }
1112
970
  };
971
+ function queryNonceMetaTagContent(doc) {
972
+ var _a, _b, _c;
973
+ return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
974
+ }
1113
975
  var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
1114
976
  var registerStyle = (scopeId2, cssText, allowCS) => {
1115
977
  let style = styles.get(scopeId2);
@@ -1126,7 +988,7 @@ var registerStyle = (scopeId2, cssText, allowCS) => {
1126
988
  styles.set(scopeId2, style);
1127
989
  };
1128
990
  var addStyle = (styleContainerNode, cmpMeta, mode) => {
1129
- var _a;
991
+ var _a, _b, _c;
1130
992
  const scopeId2 = getScopeId(cmpMeta, mode);
1131
993
  const style = styles.get(scopeId2);
1132
994
  if (!BUILD.attachStyles || !win.document) {
@@ -1141,64 +1003,87 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1141
1003
  if (!appliedStyles) {
1142
1004
  rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
1143
1005
  }
1144
- if (!appliedStyles.has(scopeId2)) {
1145
- if (BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
1146
- styleElm.innerHTML = style;
1147
- } else {
1148
- styleElm = win.document.createElement("style");
1149
- styleElm.innerHTML = style;
1150
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1151
- if (nonce != null) {
1152
- styleElm.setAttribute("nonce", nonce);
1153
- }
1154
- if ((BUILD.hydrateServerSide || BUILD.hotModuleReplacement) && (cmpMeta.$flags$ & 2 || cmpMeta.$flags$ & 128)) {
1155
- styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
1156
- }
1157
- if (!(cmpMeta.$flags$ & 1)) {
1158
- if (styleContainerNode.nodeName === "HEAD") {
1159
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
1160
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
1161
- styleContainerNode.insertBefore(
1162
- styleElm,
1163
- (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
1164
- );
1165
- } else if ("host" in styleContainerNode) {
1166
- if (supportsConstructableStylesheets) {
1167
- const stylesheet = new CSSStyleSheet();
1168
- stylesheet.replaceSync(style);
1169
- if (supportsMutableAdoptedStyleSheets) {
1170
- styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
1171
- } else {
1172
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
1173
- }
1006
+ const existingStyleElm = (BUILD.hydrateClientSide || BUILD.hotModuleReplacement) && styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
1007
+ if (existingStyleElm) {
1008
+ existingStyleElm.textContent = style;
1009
+ } else if (!appliedStyles.has(scopeId2)) {
1010
+ styleElm = win.document.createElement("style");
1011
+ styleElm.textContent = style;
1012
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1013
+ if (nonce != null) {
1014
+ styleElm.setAttribute("nonce", nonce);
1015
+ }
1016
+ if ((BUILD.hydrateServerSide || BUILD.hotModuleReplacement) && (cmpMeta.$flags$ & 2 || cmpMeta.$flags$ & 128 || cmpMeta.$flags$ & 1)) {
1017
+ styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
1018
+ }
1019
+ if (!(cmpMeta.$flags$ & 1)) {
1020
+ if (styleContainerNode.nodeName === "HEAD") {
1021
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
1022
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
1023
+ styleContainerNode.insertBefore(
1024
+ styleElm,
1025
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
1026
+ );
1027
+ } else if ("host" in styleContainerNode) {
1028
+ if (supportsConstructableStylesheets) {
1029
+ const currentWindow = (_b = styleContainerNode.defaultView) != null ? _b : styleContainerNode.ownerDocument.defaultView;
1030
+ const stylesheet = new currentWindow.CSSStyleSheet();
1031
+ stylesheet.replaceSync(style);
1032
+ if (supportsMutableAdoptedStyleSheets) {
1033
+ styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
1174
1034
  } else {
1175
- const existingStyleContainer = styleContainerNode.querySelector("style");
1176
- if (existingStyleContainer) {
1177
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
1178
- } else {
1179
- styleContainerNode.prepend(styleElm);
1180
- }
1035
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
1181
1036
  }
1182
1037
  } else {
1183
- styleContainerNode.append(styleElm);
1038
+ const existingStyleContainer = styleContainerNode.querySelector("style");
1039
+ if (existingStyleContainer && !BUILD.hotModuleReplacement) {
1040
+ existingStyleContainer.textContent = style + existingStyleContainer.textContent;
1041
+ } else {
1042
+ styleContainerNode.prepend(styleElm);
1043
+ }
1184
1044
  }
1045
+ } else {
1046
+ styleContainerNode.append(styleElm);
1185
1047
  }
1186
- if (cmpMeta.$flags$ & 1) {
1187
- styleContainerNode.insertBefore(styleElm, null);
1188
- }
1048
+ }
1049
+ if (cmpMeta.$flags$ & 1) {
1050
+ styleContainerNode.insertBefore(styleElm, null);
1189
1051
  }
1190
1052
  if (cmpMeta.$flags$ & 4) {
1191
- styleElm.innerHTML += SLOT_FB_CSS;
1053
+ styleElm.textContent += SLOT_FB_CSS;
1192
1054
  }
1193
1055
  if (appliedStyles) {
1194
1056
  appliedStyles.add(scopeId2);
1195
1057
  }
1196
1058
  }
1197
- } else if (BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
1198
- if (supportsMutableAdoptedStyleSheets) {
1199
- styleContainerNode.adoptedStyleSheets.push(style);
1200
- } else {
1201
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
1059
+ } else if (BUILD.constructableCSS) {
1060
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
1061
+ if (!appliedStyles) {
1062
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
1063
+ }
1064
+ if (!appliedStyles.has(scopeId2)) {
1065
+ const currentWindow = (_c = styleContainerNode.defaultView) != null ? _c : styleContainerNode.ownerDocument.defaultView;
1066
+ let stylesheet;
1067
+ if (style.constructor === currentWindow.CSSStyleSheet) {
1068
+ stylesheet = style;
1069
+ } else {
1070
+ stylesheet = new currentWindow.CSSStyleSheet();
1071
+ for (let i2 = 0; i2 < style.cssRules.length; i2++) {
1072
+ stylesheet.insertRule(style.cssRules[i2].cssText, i2);
1073
+ }
1074
+ }
1075
+ if (supportsMutableAdoptedStyleSheets) {
1076
+ styleContainerNode.adoptedStyleSheets.push(stylesheet);
1077
+ } else {
1078
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, stylesheet];
1079
+ }
1080
+ appliedStyles.add(scopeId2);
1081
+ if (BUILD.hydrateClientSide && "host" in styleContainerNode) {
1082
+ const ssrStyleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
1083
+ if (ssrStyleElm) {
1084
+ writeTask(() => ssrStyleElm.remove());
1085
+ }
1086
+ }
1202
1087
  }
1203
1088
  }
1204
1089
  }
@@ -1232,16 +1117,24 @@ var hydrateScopedToShadow = () => {
1232
1117
  registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
1233
1118
  }
1234
1119
  };
1120
+ var isDef = (v2) => v2 != null && v2 !== void 0;
1121
+ var isComplexType = (o3) => {
1122
+ o3 = typeof o3;
1123
+ return o3 === "object" || o3 === "function";
1124
+ };
1235
1125
  var h = (nodeName, vnodeData, ...children) => {
1126
+ if (typeof nodeName === "string") {
1127
+ nodeName = transformTag(nodeName);
1128
+ }
1236
1129
  let child = null;
1237
1130
  let key = null;
1238
1131
  let slotName = null;
1239
1132
  let simple = false;
1240
1133
  let lastSimple = false;
1241
1134
  const vNodeChildren = [];
1242
- const walk = (c) => {
1243
- for (let i2 = 0; i2 < c.length; i2++) {
1244
- child = c[i2];
1135
+ const walk = (c5) => {
1136
+ for (let i2 = 0; i2 < c5.length; i2++) {
1137
+ child = c5[i2];
1245
1138
  if (Array.isArray(child)) {
1246
1139
  walk(child);
1247
1140
  } else if (child != null && typeof child !== "boolean") {
@@ -1275,7 +1168,7 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
1275
1168
  if (BUILD.vdomClass) {
1276
1169
  const classData = vnodeData.className || vnodeData.class;
1277
1170
  if (classData) {
1278
- vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
1171
+ vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k2) => classData[k2]).join(" ");
1279
1172
  }
1280
1173
  }
1281
1174
  }
@@ -1308,7 +1201,8 @@ var newVNode = (tag, text) => {
1308
1201
  const vnode = {
1309
1202
  $flags$: 0,
1310
1203
  $tag$: tag,
1311
- $text$: text,
1204
+ // Normalize undefined to null to prevent rendering "undefined" as text
1205
+ $text$: text != null ? text : null,
1312
1206
  $elm$: null,
1313
1207
  $children$: null
1314
1208
  };
@@ -1370,7 +1264,7 @@ var validateInputProperties = (inputElm) => {
1370
1264
  }
1371
1265
  };
1372
1266
  var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1373
- var _a, _b;
1267
+ var _a, _b, _c, _d;
1374
1268
  const endHydrate = createTime("hydrateClient", tagName);
1375
1269
  const shadowRoot = hostElm.shadowRoot;
1376
1270
  const childRenderNodes = [];
@@ -1413,7 +1307,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1413
1307
  const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1414
1308
  const node = childRenderNode.$elm$;
1415
1309
  if (!shadowRoot) {
1416
- node["s-hn"] = tagName.toUpperCase();
1310
+ node["s-hn"] = transformTag(tagName).toUpperCase();
1417
1311
  if (childRenderNode.$tag$ === "slot") {
1418
1312
  node["s-cr"] = hostElm["s-cr"];
1419
1313
  }
@@ -1426,7 +1320,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1426
1320
  );
1427
1321
  const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
1428
1322
  if (styleSheet) {
1429
- hostElm.shadowRoot.append(styleSheet.cloneNode(true));
1323
+ shadowRootNodes.unshift(styleSheet.cloneNode(true));
1430
1324
  }
1431
1325
  }
1432
1326
  }
@@ -1435,8 +1329,8 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1435
1329
  if (childRenderNode.$children$) {
1436
1330
  childRenderNode.$flags$ |= 2;
1437
1331
  if (!childRenderNode.$elm$.childNodes.length) {
1438
- childRenderNode.$children$.forEach((c) => {
1439
- childRenderNode.$elm$.appendChild(c.$elm$);
1332
+ childRenderNode.$children$.forEach((c5) => {
1333
+ childRenderNode.$elm$.appendChild(c5.$elm$);
1440
1334
  });
1441
1335
  }
1442
1336
  } else {
@@ -1463,6 +1357,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1463
1357
  let snGroupIdx;
1464
1358
  let snGroupLen;
1465
1359
  let slottedItem;
1360
+ let currentPos = 0;
1466
1361
  for (snIndex; snIndex < snLen; snIndex++) {
1467
1362
  slotGroup = slottedNodes[snIndex];
1468
1363
  if (!slotGroup || !slotGroup.length) continue;
@@ -1476,7 +1371,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1476
1371
  if (!hosts[slottedItem.hostId]) continue;
1477
1372
  const hostEle = hosts[slottedItem.hostId];
1478
1373
  if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
1479
- hostEle.appendChild(slottedItem.node);
1374
+ hostEle.insertBefore(slottedItem.node, (_c = (_b = slotGroup[snGroupIdx - 1]) == null ? void 0 : _b.node) == null ? void 0 : _c.nextSibling);
1480
1375
  }
1481
1376
  if (!hostEle.shadowRoot || !shadowRoot) {
1482
1377
  if (!slottedItem.slot["s-cr"]) {
@@ -1487,14 +1382,15 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1487
1382
  slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1488
1383
  }
1489
1384
  }
1490
- addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
1491
- if (((_b = slottedItem.node.parentElement) == null ? void 0 : _b.shadowRoot) && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) {
1385
+ addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"] || currentPos);
1386
+ if (((_d = slottedItem.node.parentElement) == null ? void 0 : _d.shadowRoot) && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) {
1492
1387
  slottedItem.node.removeAttribute("slot");
1493
1388
  }
1494
1389
  if (BUILD.experimentalSlotFixes) {
1495
1390
  patchSlottedNode(slottedItem.node);
1496
1391
  }
1497
1392
  }
1393
+ currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
1498
1394
  }
1499
1395
  }
1500
1396
  if (BUILD.scoped && scopeId2 && slotNodes.length) {
@@ -1502,7 +1398,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1502
1398
  slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
1503
1399
  });
1504
1400
  }
1505
- if (BUILD.shadowDom && shadowRoot) {
1401
+ if (BUILD.shadowDom && shadowRoot && !shadowRoot.childNodes.length) {
1506
1402
  let rnIdex = 0;
1507
1403
  const rnLen = shadowRootNodes.length;
1508
1404
  if (rnLen) {
@@ -1516,7 +1412,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1516
1412
  if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
1517
1413
  if (node.nodeType === 1 && node.slot && node.hidden) {
1518
1414
  node.removeAttribute("hidden");
1519
- } else if (node.nodeType === 8 && !node.nodeValue || node.nodeType === 3 && !node.wholeText.trim()) {
1415
+ } else if (node.nodeType === 8 && !node.nodeValue) {
1520
1416
  node.parentNode.removeChild(node);
1521
1417
  }
1522
1418
  }
@@ -1691,10 +1587,6 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1691
1587
  vnode.$elm$ = node;
1692
1588
  vnode.$index$ = "0";
1693
1589
  parentVNode.$children$ = [vnode];
1694
- } else {
1695
- if (node.nodeType === 3 && !node.wholeText.trim() && !node["s-nr"]) {
1696
- node.remove();
1697
- }
1698
1590
  }
1699
1591
  return parentVNode;
1700
1592
  };
@@ -1796,6 +1688,9 @@ var findCorrespondingNode = (node, type) => {
1796
1688
  } while (sibling && (sibling.nodeType !== type || !sibling.nodeValue));
1797
1689
  return sibling;
1798
1690
  };
1691
+ var escapeRegExpSpecialCharacters = (text) => {
1692
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1693
+ };
1799
1694
  var safeSelector = (selector) => {
1800
1695
  const placeholders = [];
1801
1696
  let index = 0;
@@ -1849,9 +1744,6 @@ var createSupportsRuleRe = (selector) => {
1849
1744
  "g"
1850
1745
  );
1851
1746
  };
1852
- var _colonSlottedRe = createSupportsRuleRe("::slotted");
1853
- var _colonHostRe = createSupportsRuleRe(":host");
1854
- var _colonHostContextRe = createSupportsRuleRe(":host-context");
1855
1747
  var _commentRe = /\/\*\s*[\s\S]*?\*\//g;
1856
1748
  var stripComments = (input) => {
1857
1749
  return input.replace(_commentRe, "");
@@ -1869,10 +1761,10 @@ var BLOCK_PLACEHOLDER = "%BLOCK%";
1869
1761
  var processRules = (input, ruleCallback) => {
1870
1762
  const inputWithEscapedBlocks = escapeBlocks(input);
1871
1763
  let nextBlockIndex = 0;
1872
- return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {
1873
- const selector = m[2];
1764
+ return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m2) => {
1765
+ const selector = m2[2];
1874
1766
  let content = "";
1875
- let suffix = m[4];
1767
+ let suffix = m2[4];
1876
1768
  let contentPrefix = "";
1877
1769
  if (suffix && suffix.startsWith("{" + BLOCK_PLACEHOLDER)) {
1878
1770
  content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
@@ -1884,7 +1776,7 @@ var processRules = (input, ruleCallback) => {
1884
1776
  content
1885
1777
  };
1886
1778
  const rule = ruleCallback(cssRule);
1887
- return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
1779
+ return `${m2[1]}${rule.selector}${m2[3]}${contentPrefix}${rule.content}${suffix}`;
1888
1780
  });
1889
1781
  };
1890
1782
  var escapeBlocks = (input) => {
@@ -1929,6 +1821,9 @@ var insertPolyfillHostInCssText = (cssText) => {
1929
1821
  supportsBlocks.push(selectorContent);
1930
1822
  return `@supports selector(${placeholder})`;
1931
1823
  });
1824
+ const _colonSlottedRe = createSupportsRuleRe("::slotted");
1825
+ const _colonHostRe = createSupportsRuleRe(":host");
1826
+ const _colonHostContextRe = createSupportsRuleRe(":host-context");
1932
1827
  cssText = cssText.replace(_colonHostContextRe, `$1${_polyfillHostContext}`).replace(_colonHostRe, `$1${_polyfillHost}`).replace(_colonSlottedRe, `$1${_polyfillSlotted}`);
1933
1828
  supportsBlocks.forEach((originalSelector, index) => {
1934
1829
  cssText = cssText.replace(`__supports_${index}__`, originalSelector);
@@ -1936,18 +1831,18 @@ var insertPolyfillHostInCssText = (cssText) => {
1936
1831
  return cssText;
1937
1832
  };
1938
1833
  var convertColonRule = (cssText, regExp, partReplacer) => {
1939
- return cssText.replace(regExp, (...m) => {
1940
- if (m[2]) {
1941
- const parts = m[2].split(",");
1942
- const r = [];
1834
+ return cssText.replace(regExp, (...m2) => {
1835
+ if (m2[2]) {
1836
+ const parts = m2[2].split(",");
1837
+ const r2 = [];
1943
1838
  for (let i2 = 0; i2 < parts.length; i2++) {
1944
- const p = parts[i2].trim();
1945
- if (!p) break;
1946
- r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
1839
+ const p2 = parts[i2].trim();
1840
+ if (!p2) break;
1841
+ r2.push(partReplacer(_polyfillHostNoCombinator, p2, m2[3]));
1947
1842
  }
1948
- return r.join(",");
1843
+ return r2.join(",");
1949
1844
  } else {
1950
- return _polyfillHostNoCombinator + m[3];
1845
+ return _polyfillHostNoCombinator + m2[3];
1951
1846
  }
1952
1847
  });
1953
1848
  };
@@ -1967,14 +1862,14 @@ var colonHostContextPartReplacer = (host, part, suffix) => {
1967
1862
  var convertColonSlotted = (cssText, slotScopeId) => {
1968
1863
  const slotClass = "." + slotScopeId + " > ";
1969
1864
  const selectors = [];
1970
- cssText = cssText.replace(_cssColonSlottedRe, (...m) => {
1971
- if (m[2]) {
1972
- const compound = m[2].trim();
1973
- const suffix = m[3];
1865
+ cssText = cssText.replace(_cssColonSlottedRe, (...m2) => {
1866
+ if (m2[2]) {
1867
+ const compound = m2[2].trim();
1868
+ const suffix = m2[3];
1974
1869
  const slottedSelector = slotClass + compound + suffix;
1975
1870
  let prefixSelector = "";
1976
- for (let i2 = m[4] - 1; i2 >= 0; i2--) {
1977
- const char = m[5][i2];
1871
+ for (let i2 = m2[4] - 1; i2 >= 0; i2--) {
1872
+ const char = m2[5][i2];
1978
1873
  if (char === "}" || char === ",") {
1979
1874
  break;
1980
1875
  }
@@ -1991,7 +1886,7 @@ var convertColonSlotted = (cssText, slotScopeId) => {
1991
1886
  }
1992
1887
  return slottedSelector;
1993
1888
  } else {
1994
- return _polyfillHostNoCombinator + m[3];
1889
+ return _polyfillHostNoCombinator + m2[3];
1995
1890
  }
1996
1891
  });
1997
1892
  return {
@@ -2032,15 +1927,15 @@ var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
2032
1927
  const isRe = /\[is=([^\]]*)\]/g;
2033
1928
  scopeSelector2 = scopeSelector2.replace(isRe, (_, ...parts) => parts[0]);
2034
1929
  const className = "." + scopeSelector2;
2035
- const _scopeSelectorPart = (p) => {
2036
- let scopedP = p.trim();
1930
+ const _scopeSelectorPart = (p2) => {
1931
+ let scopedP = p2.trim();
2037
1932
  if (!scopedP) {
2038
1933
  return "";
2039
1934
  }
2040
- if (p.indexOf(_polyfillHostNoCombinator) > -1) {
2041
- scopedP = applySimpleSelectorScope(p, scopeSelector2, hostSelector);
1935
+ if (p2.indexOf(_polyfillHostNoCombinator) > -1) {
1936
+ scopedP = applySimpleSelectorScope(p2, scopeSelector2, hostSelector);
2042
1937
  } else {
2043
- const t = p.replace(_polyfillHostRe, "");
1938
+ const t = p2.replace(_polyfillHostRe, "");
2044
1939
  if (t.length > 0) {
2045
1940
  scopedP = injectScopingSelector(t, className);
2046
1941
  }
@@ -2129,14 +2024,14 @@ var expandPartSelectors = (cssText) => {
2129
2024
  }
2130
2025
  const selectors = rule.selector.split(",").map((sel) => {
2131
2026
  const out = [sel.trim()];
2132
- let m;
2133
- while ((m = partSelectorRe.exec(sel)) !== null) {
2134
- const before = m[1].trimEnd();
2135
- const partNames = m[2].trim().split(/\s+/);
2136
- const after = m[3] || "";
2137
- const partAttr = partNames.flatMap((p) => {
2138
- if (!rule.selector.includes(`[part~="${p}"]`)) {
2139
- return [`[part~="${p}"]`];
2027
+ let m2;
2028
+ while ((m2 = partSelectorRe.exec(sel)) !== null) {
2029
+ const before = m2[1].trimEnd();
2030
+ const partNames = m2[2].trim().split(/\s+/);
2031
+ const after = m2[3] || "";
2032
+ const partAttr = partNames.flatMap((p2) => {
2033
+ if (!rule.selector.includes(`[part~="${p2}"]`)) {
2034
+ return [`[part~="${p2}"]`];
2140
2035
  }
2141
2036
  return [];
2142
2037
  }).join("");
@@ -2183,31 +2078,130 @@ var scopeCss = (cssText, scopeId2, commentOriginalSelector) => {
2183
2078
  });
2184
2079
  }
2185
2080
  scoped.slottedSelectors.forEach((slottedSelector) => {
2186
- const regex = new RegExp(escapeRegExpSpecialCharacters(slottedSelector.orgSelector), "g");
2081
+ const regex = new RegExp(escapeRegExpSpecialCharacters(slottedSelector.orgSelector) + "(?=\\s*[,{]|$)", "g");
2187
2082
  cssText = cssText.replace(regex, slottedSelector.updatedSelector);
2188
2083
  });
2189
2084
  cssText = expandPartSelectors(cssText);
2190
2085
  return cssText;
2191
2086
  };
2192
- var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
2193
- var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2194
- if ((BUILD.hydrateClientSide || BUILD.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2195
- propValue = deserializeProperty(propValue);
2196
- return propValue;
2197
- }
2198
- if (propValue != null && !isComplexType(propValue)) {
2199
- if (BUILD.propBoolean && propType & 4) {
2200
- if (BUILD.formAssociated && isFormAssociated && typeof propValue === "string") {
2201
- return propValue === "" || !!propValue;
2202
- } else {
2203
- return propValue === "false" ? false : propValue === "" || !!propValue;
2204
- }
2205
- }
2206
- if (BUILD.propNumber && propType & 2) {
2207
- return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
2208
- }
2209
- if (BUILD.propString && propType & 1) {
2210
- return String(propValue);
2087
+ var computeMode = (elm) => modeResolutionChain.map((h22) => h22(elm)).find((m2) => !!m2);
2088
+ var RemoteValue = class _RemoteValue {
2089
+ /**
2090
+ * Deserializes a LocalValue serialized object back to its original JavaScript representation
2091
+ *
2092
+ * @param serialized The serialized LocalValue object
2093
+ * @returns The original JavaScript value/object
2094
+ */
2095
+ static fromLocalValue(serialized) {
2096
+ const type = serialized[TYPE_CONSTANT];
2097
+ const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
2098
+ switch (type) {
2099
+ case "string":
2100
+ return value;
2101
+ case "boolean":
2102
+ return value;
2103
+ case "bigint":
2104
+ return BigInt(value);
2105
+ case "undefined":
2106
+ return void 0;
2107
+ case "null":
2108
+ return null;
2109
+ case "number":
2110
+ if (value === "NaN") return NaN;
2111
+ if (value === "-0") return -0;
2112
+ if (value === "Infinity") return Infinity;
2113
+ if (value === "-Infinity") return -Infinity;
2114
+ return value;
2115
+ case "array":
2116
+ return value.map((item) => _RemoteValue.fromLocalValue(item));
2117
+ case "date":
2118
+ return new Date(value);
2119
+ case "map":
2120
+ const map = /* @__PURE__ */ new Map();
2121
+ for (const [key, val] of value) {
2122
+ const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
2123
+ const deserializedValue = _RemoteValue.fromLocalValue(val);
2124
+ map.set(deserializedKey, deserializedValue);
2125
+ }
2126
+ return map;
2127
+ case "object":
2128
+ const obj = {};
2129
+ for (const [key, val] of value) {
2130
+ obj[key] = _RemoteValue.fromLocalValue(val);
2131
+ }
2132
+ return obj;
2133
+ case "regexp":
2134
+ const { pattern, flags } = value;
2135
+ return new RegExp(pattern, flags);
2136
+ case "set":
2137
+ const set = /* @__PURE__ */ new Set();
2138
+ for (const item of value) {
2139
+ set.add(_RemoteValue.fromLocalValue(item));
2140
+ }
2141
+ return set;
2142
+ case "symbol":
2143
+ return Symbol(value);
2144
+ default:
2145
+ throw new Error(`Unsupported type: ${type}`);
2146
+ }
2147
+ }
2148
+ /**
2149
+ * Utility method to deserialize multiple LocalValues at once
2150
+ *
2151
+ * @param serializedValues Array of serialized LocalValue objects
2152
+ * @returns Array of deserialized JavaScript values
2153
+ */
2154
+ static fromLocalValueArray(serializedValues) {
2155
+ return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
2156
+ }
2157
+ /**
2158
+ * Verifies if the given object matches the structure of a serialized LocalValue
2159
+ *
2160
+ * @param obj Object to verify
2161
+ * @returns boolean indicating if the object has LocalValue structure
2162
+ */
2163
+ static isLocalValueObject(obj) {
2164
+ if (typeof obj !== "object" || obj === null) {
2165
+ return false;
2166
+ }
2167
+ if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
2168
+ return false;
2169
+ }
2170
+ const type = obj[TYPE_CONSTANT];
2171
+ const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
2172
+ if (!hasTypeProperty) {
2173
+ return false;
2174
+ }
2175
+ if (type !== "null" && type !== "undefined") {
2176
+ return obj.hasOwnProperty(VALUE_CONSTANT);
2177
+ }
2178
+ return true;
2179
+ }
2180
+ };
2181
+ function deserializeProperty(value) {
2182
+ if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
2183
+ return value;
2184
+ }
2185
+ return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
2186
+ }
2187
+ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2188
+ if ((BUILD.hydrateClientSide || BUILD.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2189
+ propValue = deserializeProperty(propValue);
2190
+ return propValue;
2191
+ }
2192
+ if (propValue != null && !isComplexType(propValue)) {
2193
+ if (BUILD.propBoolean && propType & 4) {
2194
+ if (BUILD.formAssociated && isFormAssociated && typeof propValue === "string") {
2195
+ return propValue === "" || !!propValue;
2196
+ } else {
2197
+ return propValue === "false" ? false : propValue === "" || !!propValue;
2198
+ }
2199
+ }
2200
+ if (BUILD.propNumber && propType & 2) {
2201
+ return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
2202
+ }
2203
+ if (BUILD.propString && propType & 1) {
2204
+ return String(propValue);
2211
2205
  }
2212
2206
  return propValue;
2213
2207
  }
@@ -2251,14 +2245,14 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
2251
2245
  if (BUILD.hydrateClientSide && (elm["s-si"] || elm["s-sc"]) && initialRender) {
2252
2246
  const scopeId2 = elm["s-sc"] || elm["s-si"];
2253
2247
  newClasses.push(scopeId2);
2254
- oldClasses.forEach((c) => {
2255
- if (c.startsWith(scopeId2)) newClasses.push(c);
2248
+ oldClasses.forEach((c5) => {
2249
+ if (c5.startsWith(scopeId2)) newClasses.push(c5);
2256
2250
  });
2257
- newClasses = [...new Set(newClasses)].filter((c) => c);
2251
+ newClasses = [...new Set(newClasses)].filter((c5) => c5);
2258
2252
  classList.add(...newClasses);
2259
2253
  } else {
2260
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
2261
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
2254
+ classList.remove(...oldClasses.filter((c5) => c5 && !newClasses.includes(c5)));
2255
+ classList.add(...newClasses.filter((c5) => c5 && !oldClasses.includes(c5)));
2262
2256
  }
2263
2257
  } else if (BUILD.vdomStyle && memberName === "style") {
2264
2258
  if (BUILD.updatable) {
@@ -2284,7 +2278,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
2284
2278
  } else if (BUILD.vdomKey && memberName === "key") {
2285
2279
  } else if (BUILD.vdomRef && memberName === "ref") {
2286
2280
  if (newValue) {
2287
- newValue(elm);
2281
+ queueRefAttachment(newValue, elm);
2288
2282
  }
2289
2283
  } else if (BUILD.vdomListener && (BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
2290
2284
  if (memberName[2] === "-") {
@@ -2304,25 +2298,55 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
2304
2298
  plt.ael(elm, memberName, newValue, capture);
2305
2299
  }
2306
2300
  }
2301
+ } else if (BUILD.vdomPropOrAttr && memberName[0] === "a" && memberName.startsWith("attr:")) {
2302
+ const propName = memberName.slice(5);
2303
+ let attrName;
2304
+ if (BUILD.member) {
2305
+ const hostRef = getHostRef(elm);
2306
+ if (hostRef && hostRef.$cmpMeta$ && hostRef.$cmpMeta$.$members$) {
2307
+ const memberMeta = hostRef.$cmpMeta$.$members$[propName];
2308
+ if (memberMeta && memberMeta[1]) {
2309
+ attrName = memberMeta[1];
2310
+ }
2311
+ }
2312
+ }
2313
+ if (!attrName) {
2314
+ attrName = propName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
2315
+ }
2316
+ if (newValue == null || newValue === false) {
2317
+ if (newValue !== false || elm.getAttribute(attrName) === "") {
2318
+ elm.removeAttribute(attrName);
2319
+ }
2320
+ } else {
2321
+ elm.setAttribute(attrName, newValue === true ? "" : newValue);
2322
+ }
2323
+ return;
2324
+ } else if (BUILD.vdomPropOrAttr && memberName[0] === "p" && memberName.startsWith("prop:")) {
2325
+ const propName = memberName.slice(5);
2326
+ try {
2327
+ elm[propName] = newValue;
2328
+ } catch (e2) {
2329
+ }
2330
+ return;
2307
2331
  } else if (BUILD.vdomPropOrAttr) {
2308
2332
  const isComplex = isComplexType(newValue);
2309
2333
  if ((isProp || isComplex && newValue !== null) && !isSvg) {
2310
2334
  try {
2311
2335
  if (!elm.tagName.includes("-")) {
2312
- const n = newValue == null ? "" : newValue;
2336
+ const n3 = newValue == null ? "" : newValue;
2313
2337
  if (memberName === "list") {
2314
2338
  isProp = false;
2315
- } else if (oldValue == null || elm[memberName] != n) {
2339
+ } else if (oldValue == null || elm[memberName] !== n3) {
2316
2340
  if (typeof elm.__lookupSetter__(memberName) === "function") {
2317
- elm[memberName] = n;
2341
+ elm[memberName] = n3;
2318
2342
  } else {
2319
- elm.setAttribute(memberName, n);
2343
+ elm.setAttribute(memberName, n3);
2320
2344
  }
2321
2345
  }
2322
2346
  } else if (elm[memberName] !== newValue) {
2323
2347
  elm[memberName] = newValue;
2324
2348
  }
2325
- } catch (e) {
2349
+ } catch (e2) {
2326
2350
  }
2327
2351
  }
2328
2352
  let xlink = false;
@@ -2409,6 +2433,8 @@ var useNativeShadowDom = false;
2409
2433
  var checkSlotFallbackVisibility = false;
2410
2434
  var checkSlotRelocate = false;
2411
2435
  var isSvgMode = false;
2436
+ var refCallbacksToRemove = [];
2437
+ var refCallbacksToAttach = [];
2412
2438
  var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2413
2439
  var _a;
2414
2440
  const newVNode2 = newParentVNode.$children$[childIndex];
@@ -2436,7 +2462,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2436
2462
  `The JSX ${newVNode2.$text$ !== null ? `"${newVNode2.$text$}" text` : `"${newVNode2.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`
2437
2463
  );
2438
2464
  }
2439
- if (BUILD.vdomText && newVNode2.$text$ !== null) {
2465
+ if (BUILD.vdomText && newVNode2.$text$ != null) {
2440
2466
  elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
2441
2467
  } else if (BUILD.slotRelocation && newVNode2.$flags$ & 1) {
2442
2468
  elm = newVNode2.$elm$ = BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : win.document.createTextNode("");
@@ -2448,9 +2474,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2448
2474
  isSvgMode = newVNode2.$tag$ === "svg";
2449
2475
  }
2450
2476
  if (!win.document) {
2451
- throw new Error(
2452
- "You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
2453
- );
2477
+ throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
2454
2478
  }
2455
2479
  elm = newVNode2.$elm$ = BUILD.svg ? win.document.createElementNS(
2456
2480
  isSvgMode ? SVG_NS : HTML_NS,
@@ -2468,10 +2492,11 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2468
2492
  elm.classList.add(elm["s-si"] = scopeId);
2469
2493
  }
2470
2494
  if (newVNode2.$children$) {
2495
+ const appendTarget = newVNode2.$tag$ === "template" ? elm.content : elm;
2471
2496
  for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
2472
2497
  childNode = createElm(oldParentVNode, newVNode2, i2);
2473
2498
  if (childNode) {
2474
- elm.appendChild(childNode);
2499
+ appendTarget.appendChild(childNode);
2475
2500
  }
2476
2501
  }
2477
2502
  }
@@ -2493,11 +2518,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2493
2518
  patchSlotNode(elm);
2494
2519
  oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
2495
2520
  if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
2496
- if (BUILD.experimentalSlotFixes) {
2497
- relocateToHostRoot(oldParentVNode.$elm$);
2498
- } else {
2499
- putBackInOriginalLocation(oldParentVNode.$elm$, false);
2500
- }
2521
+ relocateToHostRoot(oldParentVNode.$elm$);
2501
2522
  }
2502
2523
  if (BUILD.scoped || BUILD.hydrateServerSide && 128) {
2503
2524
  addRemoveSlotScopedClass(contentRef, elm, newParentVNode.$elm$, oldParentVNode == null ? void 0 : oldParentVNode.$elm$);
@@ -2529,7 +2550,7 @@ var relocateToHostRoot = (parentElm) => {
2529
2550
  var putBackInOriginalLocation = (parentElm, recursive) => {
2530
2551
  plt.$flags$ |= 1;
2531
2552
  const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
2532
- if (parentElm["s-sr"] && BUILD.experimentalSlotFixes) {
2553
+ if (parentElm["s-sr"]) {
2533
2554
  let node = parentElm;
2534
2555
  while (node = node.nextSibling) {
2535
2556
  if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
@@ -2558,6 +2579,9 @@ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
2558
2579
  if (BUILD.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
2559
2580
  containerElm = containerElm.shadowRoot;
2560
2581
  }
2582
+ if (parentVNode.$tag$ === "template") {
2583
+ containerElm = containerElm.content;
2584
+ }
2561
2585
  for (; startIdx <= endIdx; ++startIdx) {
2562
2586
  if (vnodes[startIdx]) {
2563
2587
  childNode = createElm(null, parentVNode, startIdx);
@@ -2601,6 +2625,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
2601
2625
  let newEndVnode = newCh[newEndIdx];
2602
2626
  let node;
2603
2627
  let elmToMove;
2628
+ const containerElm = newVNode2.$tag$ === "template" ? parentElm.content : parentElm;
2604
2629
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
2605
2630
  if (oldStartVnode == null) {
2606
2631
  oldStartVnode = oldCh[++oldStartIdx];
@@ -2623,7 +2648,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
2623
2648
  putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
2624
2649
  }
2625
2650
  patch(oldStartVnode, newEndVnode, isInitialRender);
2626
- insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
2651
+ insertBefore(containerElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
2627
2652
  oldStartVnode = oldCh[++oldStartIdx];
2628
2653
  newEndVnode = newCh[--newEndIdx];
2629
2654
  } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
@@ -2631,7 +2656,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
2631
2656
  putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
2632
2657
  }
2633
2658
  patch(oldEndVnode, newStartVnode, isInitialRender);
2634
- insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
2659
+ insertBefore(containerElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
2635
2660
  oldEndVnode = oldCh[--oldEndIdx];
2636
2661
  newStartVnode = newCh[++newStartIdx];
2637
2662
  } else {
@@ -2707,13 +2732,13 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
2707
2732
  const tag = newVNode2.$tag$;
2708
2733
  const text = newVNode2.$text$;
2709
2734
  let defaultHolder;
2710
- if (!BUILD.vdomText || text === null) {
2735
+ if (!BUILD.vdomText || text == null) {
2711
2736
  if (BUILD.svg) {
2712
2737
  isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
2713
2738
  }
2714
2739
  if (BUILD.vdomAttribute || BUILD.reflect) {
2715
2740
  if (BUILD.slot && tag === "slot" && !useNativeShadowDom) {
2716
- if (BUILD.experimentalSlotFixes && oldVNode.$name$ !== newVNode2.$name$) {
2741
+ if (oldVNode.$name$ !== newVNode2.$name$) {
2717
2742
  newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
2718
2743
  relocateToHostRoot(newVNode2.$elm$.parentElement);
2719
2744
  }
@@ -2748,17 +2773,17 @@ var relocateNodes = [];
2748
2773
  var markSlotContentForRelocation = (elm) => {
2749
2774
  let node;
2750
2775
  let hostContentNodes;
2751
- let j;
2776
+ let j2;
2752
2777
  const children = elm.__childNodes || elm.childNodes;
2753
2778
  for (const childNode of children) {
2754
2779
  if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
2755
2780
  hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
2756
2781
  const slotName = childNode["s-sn"];
2757
- for (j = hostContentNodes.length - 1; j >= 0; j--) {
2758
- node = hostContentNodes[j];
2759
- if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD.experimentalSlotFixes || !node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
2782
+ for (j2 = hostContentNodes.length - 1; j2 >= 0; j2--) {
2783
+ node = hostContentNodes[j2];
2784
+ if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
2760
2785
  if (isNodeLocatedInSlot(node, slotName)) {
2761
- let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
2786
+ let relocateNodeData = relocateNodes.find((r2) => r2.$nodeToRelocate$ === node);
2762
2787
  checkSlotFallbackVisibility = true;
2763
2788
  node["s-sn"] = node["s-sn"] || slotName;
2764
2789
  if (relocateNodeData) {
@@ -2774,14 +2799,14 @@ var markSlotContentForRelocation = (elm) => {
2774
2799
  if (node["s-sr"]) {
2775
2800
  relocateNodes.map((relocateNode) => {
2776
2801
  if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
2777
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
2802
+ relocateNodeData = relocateNodes.find((r2) => r2.$nodeToRelocate$ === node);
2778
2803
  if (relocateNodeData && !relocateNode.$slotRefNode$) {
2779
2804
  relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
2780
2805
  }
2781
2806
  }
2782
2807
  });
2783
2808
  }
2784
- } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
2809
+ } else if (!relocateNodes.some((r2) => r2.$nodeToRelocate$ === node)) {
2785
2810
  relocateNodes.push({
2786
2811
  $nodeToRelocate$: node
2787
2812
  });
@@ -2796,23 +2821,40 @@ var markSlotContentForRelocation = (elm) => {
2796
2821
  };
2797
2822
  var nullifyVNodeRefs = (vNode) => {
2798
2823
  if (BUILD.vdomRef) {
2799
- vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
2824
+ if (vNode.$attrs$ && vNode.$attrs$.ref) {
2825
+ refCallbacksToRemove.push(() => vNode.$attrs$.ref(null));
2826
+ }
2800
2827
  vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
2801
2828
  }
2802
2829
  };
2803
- var insertBefore = (parent, newNode, reference) => {
2804
- if (BUILD.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) {
2805
- addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
2806
- } else if (BUILD.experimentalSlotFixes && typeof newNode["s-sn"] === "string") {
2807
- if (parent.getRootNode().nodeType !== 11) {
2808
- patchParentNode(newNode);
2830
+ var queueRefAttachment = (refCallback, elm) => {
2831
+ if (BUILD.vdomRef) {
2832
+ refCallbacksToAttach.push(() => refCallback(elm));
2833
+ }
2834
+ };
2835
+ var flushQueuedRefCallbacks = () => {
2836
+ if (BUILD.vdomRef) {
2837
+ refCallbacksToRemove.forEach((cb) => cb());
2838
+ refCallbacksToRemove.length = 0;
2839
+ refCallbacksToAttach.forEach((cb) => cb());
2840
+ refCallbacksToAttach.length = 0;
2841
+ }
2842
+ };
2843
+ var insertBefore = (parent, newNode, reference, isInitialLoad) => {
2844
+ if (BUILD.slotRelocation) {
2845
+ if (BUILD.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) {
2846
+ addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
2847
+ } else if (typeof newNode["s-sn"] === "string") {
2848
+ if (BUILD.experimentalSlotFixes && parent.getRootNode().nodeType !== 11) {
2849
+ patchParentNode(newNode);
2850
+ }
2851
+ parent.insertBefore(newNode, reference);
2852
+ const { slotNode } = findSlotFromSlottedNode(newNode);
2853
+ if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);
2854
+ return newNode;
2809
2855
  }
2810
- parent.insertBefore(newNode, reference);
2811
- const { slotNode } = findSlotFromSlottedNode(newNode);
2812
- if (slotNode) dispatchSlotChangeEvent(slotNode);
2813
- return newNode;
2814
2856
  }
2815
- if (BUILD.experimentalSlotFixes && parent.__insertBefore) {
2857
+ if (parent.__insertBefore) {
2816
2858
  return parent.__insertBefore(newNode, reference);
2817
2859
  } else {
2818
2860
  return parent == null ? void 0 : parent.insertBefore(newNode, reference);
@@ -2900,19 +2942,27 @@ render() {
2900
2942
  if (!nodeToRelocate["s-ol"] && win.document) {
2901
2943
  const orgLocationNode = BUILD.isDebug || BUILD.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : win.document.createTextNode("");
2902
2944
  orgLocationNode["s-nr"] = nodeToRelocate;
2903
- insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
2945
+ insertBefore(
2946
+ nodeToRelocate.parentNode,
2947
+ nodeToRelocate["s-ol"] = orgLocationNode,
2948
+ nodeToRelocate,
2949
+ isInitialLoad
2950
+ );
2904
2951
  }
2905
2952
  }
2906
2953
  for (const relocateData of relocateNodes) {
2907
2954
  const nodeToRelocate = relocateData.$nodeToRelocate$;
2908
2955
  const slotRefNode = relocateData.$slotRefNode$;
2956
+ if (nodeToRelocate.nodeType === 1 && isInitialLoad) {
2957
+ nodeToRelocate["s-ih"] = (_a = nodeToRelocate.hidden) != null ? _a : false;
2958
+ }
2909
2959
  if (slotRefNode) {
2910
2960
  const parentNodeRef = slotRefNode.parentNode;
2911
2961
  let insertBeforeNode = slotRefNode.nextSibling;
2912
- if (!BUILD.hydrateServerSide && (!BUILD.experimentalSlotFixes || insertBeforeNode && insertBeforeNode.nodeType === 1)) {
2913
- let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
2962
+ if (!BUILD.hydrateServerSide && insertBeforeNode && insertBeforeNode.nodeType === 1) {
2963
+ let orgLocationNode = (_b = nodeToRelocate["s-ol"]) == null ? void 0 : _b.previousSibling;
2914
2964
  while (orgLocationNode) {
2915
- let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
2965
+ let refNode = (_c = orgLocationNode["s-nr"]) != null ? _c : null;
2916
2966
  if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === (refNode.__parentNode || refNode.parentNode)) {
2917
2967
  refNode = refNode.nextSibling;
2918
2968
  while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
@@ -2930,23 +2980,26 @@ render() {
2930
2980
  const nextSibling = nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling;
2931
2981
  if (!insertBeforeNode && parentNodeRef !== parent || nextSibling !== insertBeforeNode) {
2932
2982
  if (nodeToRelocate !== insertBeforeNode) {
2933
- if (!BUILD.experimentalSlotFixes && !nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
2934
- nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
2983
+ insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode, isInitialLoad);
2984
+ if (nodeToRelocate.nodeType === 8 && nodeToRelocate.nodeValue.startsWith("s-nt-")) {
2985
+ const textNode = win.document.createTextNode(nodeToRelocate.nodeValue.replace(/^s-nt-/, ""));
2986
+ textNode["s-hn"] = nodeToRelocate["s-hn"];
2987
+ textNode["s-sn"] = nodeToRelocate["s-sn"];
2988
+ textNode["s-sh"] = nodeToRelocate["s-sh"];
2989
+ textNode["s-sr"] = nodeToRelocate["s-sr"];
2990
+ textNode["s-ol"] = nodeToRelocate["s-ol"];
2991
+ textNode["s-ol"]["s-nr"] = textNode;
2992
+ insertBefore(nodeToRelocate.parentNode, textNode, nodeToRelocate, isInitialLoad);
2993
+ nodeToRelocate.parentNode.removeChild(nodeToRelocate);
2935
2994
  }
2936
- insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
2937
2995
  if (nodeToRelocate.nodeType === 1 && nodeToRelocate.tagName !== "SLOT-FB") {
2938
- nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
2996
+ nodeToRelocate.hidden = (_d = nodeToRelocate["s-ih"]) != null ? _d : false;
2939
2997
  }
2940
2998
  }
2941
2999
  }
2942
3000
  nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
2943
- } else {
2944
- if (nodeToRelocate.nodeType === 1) {
2945
- if (isInitialLoad) {
2946
- nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
2947
- }
2948
- nodeToRelocate.hidden = true;
2949
- }
3001
+ } else if (nodeToRelocate.nodeType === 1) {
3002
+ nodeToRelocate.hidden = true;
2950
3003
  }
2951
3004
  }
2952
3005
  }
@@ -2956,18 +3009,26 @@ render() {
2956
3009
  plt.$flags$ &= ~1;
2957
3010
  relocateNodes.length = 0;
2958
3011
  }
2959
- if (BUILD.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2) {
3012
+ if (BUILD.slotRelocation && !useNativeShadowDom && !(cmpMeta.$flags$ & 1) && hostElm["s-cr"]) {
2960
3013
  const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
2961
3014
  for (const childNode of children) {
2962
3015
  if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
2963
3016
  if (isInitialLoad && childNode["s-ih"] == null) {
2964
3017
  childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
2965
3018
  }
2966
- childNode.hidden = true;
3019
+ if (childNode.nodeType === 1) {
3020
+ childNode.hidden = true;
3021
+ } else if (childNode.nodeType === 3 && !!childNode.nodeValue.trim()) {
3022
+ const textCommentNode = win.document.createComment("s-nt-" + childNode.nodeValue);
3023
+ textCommentNode["s-sn"] = childNode["s-sn"];
3024
+ insertBefore(childNode.parentNode, textCommentNode, childNode, isInitialLoad);
3025
+ childNode.parentNode.removeChild(childNode);
3026
+ }
2967
3027
  }
2968
3028
  }
2969
3029
  }
2970
3030
  contentRef = void 0;
3031
+ flushQueuedRefCallbacks();
2971
3032
  };
2972
3033
  var slotReferenceDebugNode = (slotVNode) => {
2973
3034
  var _a;
@@ -2985,9 +3046,9 @@ var attachToAncestor = (hostRef, ancestorComponent) => {
2985
3046
  if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
2986
3047
  const index = ancestorComponent["s-p"].push(
2987
3048
  new Promise(
2988
- (r) => hostRef.$onRenderResolve$ = () => {
3049
+ (r2) => hostRef.$onRenderResolve$ = () => {
2989
3050
  ancestorComponent["s-p"].splice(index - 1, 1);
2990
- r();
3051
+ r2();
2991
3052
  }
2992
3053
  )
2993
3054
  );
@@ -3023,6 +3084,10 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
3023
3084
  let maybePromise;
3024
3085
  if (isInitialLoad) {
3025
3086
  if (BUILD.lazyLoad) {
3087
+ if (BUILD.slotRelocation && hostRef.$deferredConnectedCallback$) {
3088
+ hostRef.$deferredConnectedCallback$ = false;
3089
+ safeCall(instance, "connectedCallback", void 0, elm);
3090
+ }
3026
3091
  if (BUILD.hostListener) {
3027
3092
  hostRef.$flags$ |= 256;
3028
3093
  if (hostRef.$queuedListeners$) {
@@ -3045,8 +3110,8 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
3045
3110
  endSchedule();
3046
3111
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
3047
3112
  };
3048
- var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err2) => {
3049
- console.error(err2);
3113
+ var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err) => {
3114
+ console.error(err);
3050
3115
  fn();
3051
3116
  }) : fn();
3052
3117
  var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
@@ -3081,8 +3146,8 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
3081
3146
  elm["s-en"] = "c";
3082
3147
  }
3083
3148
  }
3084
- } catch (e) {
3085
- consoleError(e, elm);
3149
+ } catch (e2) {
3150
+ consoleError(e2, elm);
3086
3151
  }
3087
3152
  }
3088
3153
  if (BUILD.asyncLoading && rc) {
@@ -3097,7 +3162,7 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
3097
3162
  if (childrenPromises.length === 0) {
3098
3163
  postUpdate();
3099
3164
  } else {
3100
- Promise.all(childrenPromises).then(postUpdate);
3165
+ Promise.all(childrenPromises).then(postUpdate).catch(postUpdate);
3101
3166
  hostRef.$flags$ |= 4;
3102
3167
  childrenPromises.length = 0;
3103
3168
  }
@@ -3136,8 +3201,8 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
3136
3201
  }
3137
3202
  }
3138
3203
  }
3139
- } catch (e) {
3140
- consoleError(e, hostRef.$hostElement$);
3204
+ } catch (e2) {
3205
+ consoleError(e2, hostRef.$hostElement$);
3141
3206
  }
3142
3207
  renderingRef = null;
3143
3208
  return null;
@@ -3232,8 +3297,8 @@ var safeCall = (instance, method, arg, elm) => {
3232
3297
  if (instance && instance[method]) {
3233
3298
  try {
3234
3299
  return instance[method](arg);
3235
- } catch (e) {
3236
- consoleError(e, elm);
3300
+ } catch (e2) {
3301
+ consoleError(e2, elm);
3237
3302
  }
3238
3303
  }
3239
3304
  return void 0;
@@ -3293,12 +3358,22 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
3293
3358
  if ((!BUILD.lazyLoad || !(flags & 8) || oldVal === void 0) && didValueChange) {
3294
3359
  hostRef.$instanceValues$.set(propName, newVal);
3295
3360
  if (BUILD.serializer && BUILD.reflect && cmpMeta.$attrsToReflect$) {
3296
- if (instance && cmpMeta.$serializers$ && cmpMeta.$serializers$[propName]) {
3297
- let attrVal = newVal;
3298
- for (const methodName of cmpMeta.$serializers$[propName]) {
3299
- attrVal = instance[methodName](attrVal, propName);
3361
+ if (cmpMeta.$serializers$ && cmpMeta.$serializers$[propName]) {
3362
+ const runSerializer = (inst) => {
3363
+ let attrVal = newVal;
3364
+ for (const serializer of cmpMeta.$serializers$[propName]) {
3365
+ const [[methodName]] = Object.entries(serializer);
3366
+ attrVal = inst[methodName](attrVal, propName);
3367
+ }
3368
+ hostRef.$serializerValues$.set(propName, attrVal);
3369
+ };
3370
+ if (instance) {
3371
+ runSerializer(instance);
3372
+ } else {
3373
+ hostRef.$fetchedCbList$.push(() => {
3374
+ runSerializer(hostRef.$lazyInstance$);
3375
+ });
3300
3376
  }
3301
- hostRef.$serializerValues$.set(propName, attrVal);
3302
3377
  }
3303
3378
  }
3304
3379
  if (BUILD.isDev) {
@@ -3324,25 +3399,35 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
3324
3399
  );
3325
3400
  }
3326
3401
  }
3327
- if (!BUILD.lazyLoad || instance) {
3328
- if (BUILD.propChangeCallback && cmpMeta.$watchers$ && flags & 128) {
3329
- const watchMethods = cmpMeta.$watchers$[propName];
3330
- if (watchMethods) {
3331
- watchMethods.map((watchMethodName) => {
3332
- try {
3333
- instance[watchMethodName](newVal, oldVal, propName);
3334
- } catch (e) {
3335
- consoleError(e, elm);
3402
+ if (BUILD.propChangeCallback && cmpMeta.$watchers$) {
3403
+ const watchMethods = cmpMeta.$watchers$[propName];
3404
+ if (watchMethods) {
3405
+ watchMethods.map((watcher) => {
3406
+ try {
3407
+ const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
3408
+ if (flags & 128 || watcherFlags & 1) {
3409
+ if (!instance) {
3410
+ hostRef.$fetchedCbList$.push(() => {
3411
+ hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
3412
+ });
3413
+ } else {
3414
+ instance[watchMethodName](newVal, oldVal, propName);
3415
+ }
3336
3416
  }
3337
- });
3338
- }
3339
- }
3340
- if (BUILD.updatable && (flags & (2 | 16)) === 2) {
3341
- if (instance.componentShouldUpdate) {
3342
- if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
3343
- return;
3417
+ } catch (e2) {
3418
+ consoleError(e2, elm);
3344
3419
  }
3420
+ });
3421
+ }
3422
+ }
3423
+ if (BUILD.updatable && flags & 2) {
3424
+ if (instance.componentShouldUpdate) {
3425
+ const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
3426
+ if (shouldUpdate === false && !(flags & 16)) {
3427
+ return;
3345
3428
  }
3429
+ }
3430
+ if (!(flags & 16)) {
3346
3431
  scheduleUpdate(hostRef, false);
3347
3432
  }
3348
3433
  }
@@ -3393,7 +3478,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
3393
3478
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
3394
3479
  members.map(([memberName, [memberFlags]]) => {
3395
3480
  if ((BUILD.prop || BUILD.state) && (memberFlags & 31 || (!BUILD.lazyLoad || flags & 2) && memberFlags & 32)) {
3396
- const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
3481
+ const { get: origGetter, set: origSetter } = getPropertyDescriptor(prototype, memberName) || {};
3397
3482
  if (origGetter) cmpMeta.$members$[memberName][0] |= 2048;
3398
3483
  if (origSetter) cmpMeta.$members$[memberName][0] |= 4096;
3399
3484
  if (flags & 1 || !origGetter) {
@@ -3525,7 +3610,8 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
3525
3610
  this[propName] = deserializeVal;
3526
3611
  }
3527
3612
  };
3528
- for (const methodName of cmpMeta.$deserializers$[propName]) {
3613
+ for (const deserializer of cmpMeta.$deserializers$[propName]) {
3614
+ const [[methodName]] = Object.entries(deserializer);
3529
3615
  if (BUILD.lazyLoad) {
3530
3616
  if (hostRef.$lazyInstance$) {
3531
3617
  setVal(methodName, hostRef.$lazyInstance$);
@@ -3544,19 +3630,20 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
3544
3630
  return;
3545
3631
  } else if (propName == null) {
3546
3632
  const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
3547
- if (hostRef && flags2 && !(flags2 & 8) && flags2 & 128 && newValue !== oldValue) {
3633
+ if (hostRef && flags2 && !(flags2 & 8) && newValue !== oldValue) {
3548
3634
  const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : this;
3549
3635
  const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
3550
3636
  const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
3551
- entry == null ? void 0 : entry.forEach((callbackName) => {
3552
- if (instance[callbackName] != null) {
3553
- instance[callbackName].call(instance, newValue, oldValue, attrName);
3637
+ entry == null ? void 0 : entry.forEach((watcher) => {
3638
+ const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
3639
+ if (instance[watchMethodName] != null && (flags2 & 128 || watcherFlags & 1)) {
3640
+ instance[watchMethodName].call(instance, newValue, oldValue, attrName);
3554
3641
  }
3555
3642
  });
3556
3643
  }
3557
3644
  return;
3558
3645
  }
3559
- const propFlags = members.find(([m]) => m === propName);
3646
+ const propFlags = members.find(([m2]) => m2 === propName);
3560
3647
  if (propFlags && propFlags[1][0] & 4) {
3561
3648
  newValue = newValue === null || newValue === "false" ? false : true;
3562
3649
  }
@@ -3570,13 +3657,13 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
3570
3657
  /* @__PURE__ */ new Set([
3571
3658
  ...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
3572
3659
  ...members.filter(
3573
- ([_, m]) => m[0] & 31
3660
+ ([_, m2]) => m2[0] & 31
3574
3661
  /* HasAttribute */
3575
- ).map(([propName, m]) => {
3662
+ ).map(([propName, m2]) => {
3576
3663
  var _a2;
3577
- const attrName = m[1] || propName;
3664
+ const attrName = m2[1] || propName;
3578
3665
  attrNameToPropName.set(attrName, propName);
3579
- if (BUILD.reflect && m[0] & 512) {
3666
+ if (BUILD.reflect && m2[0] & 512) {
3580
3667
  (_a2 = cmpMeta.$attrsToReflect$) == null ? void 0 : _a2.push([propName, attrName]);
3581
3668
  }
3582
3669
  return attrName;
@@ -3589,97 +3676,113 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
3589
3676
  };
3590
3677
  var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
3591
3678
  let Cstr;
3592
- if ((hostRef.$flags$ & 32) === 0) {
3593
- hostRef.$flags$ |= 32;
3594
- const bundleId = cmpMeta.$lazyBundleId$;
3595
- if (BUILD.lazyLoad && bundleId) {
3596
- const CstrImport = loadModule(cmpMeta, hostRef, hmrVersionId);
3597
- if (CstrImport && "then" in CstrImport) {
3598
- const endLoad = uniqueTime(
3599
- `st:load:${cmpMeta.$tagName$}:${hostRef.$modeName$}`,
3600
- `[Stencil] Load module for <${cmpMeta.$tagName$}>`
3601
- );
3602
- Cstr = await CstrImport;
3603
- endLoad();
3604
- } else {
3605
- Cstr = CstrImport;
3606
- }
3607
- if (!Cstr) {
3608
- throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
3609
- }
3610
- if (BUILD.member && !Cstr.isProxied) {
3679
+ try {
3680
+ if ((hostRef.$flags$ & 32) === 0) {
3681
+ hostRef.$flags$ |= 32;
3682
+ const bundleId = cmpMeta.$lazyBundleId$;
3683
+ if (BUILD.lazyLoad && bundleId) {
3684
+ const CstrImport = loadModule(cmpMeta, hostRef, hmrVersionId);
3685
+ if (CstrImport && "then" in CstrImport) {
3686
+ const endLoad = uniqueTime(
3687
+ `st:load:${cmpMeta.$tagName$}:${hostRef.$modeName$}`,
3688
+ `[Stencil] Load module for <${cmpMeta.$tagName$}>`
3689
+ );
3690
+ Cstr = await CstrImport;
3691
+ endLoad();
3692
+ } else {
3693
+ Cstr = CstrImport;
3694
+ }
3695
+ if (!Cstr) {
3696
+ throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
3697
+ }
3698
+ if (BUILD.member && !Cstr.isProxied) {
3699
+ if (BUILD.propChangeCallback) {
3700
+ cmpMeta.$watchers$ = Cstr.watchers;
3701
+ cmpMeta.$serializers$ = Cstr.serializers;
3702
+ cmpMeta.$deserializers$ = Cstr.deserializers;
3703
+ }
3704
+ proxyComponent(
3705
+ Cstr,
3706
+ cmpMeta,
3707
+ 2
3708
+ /* proxyState */
3709
+ );
3710
+ Cstr.isProxied = true;
3711
+ }
3712
+ const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
3713
+ if (BUILD.member) {
3714
+ hostRef.$flags$ |= 8;
3715
+ }
3716
+ try {
3717
+ new Cstr(hostRef);
3718
+ } catch (e2) {
3719
+ consoleError(e2, elm);
3720
+ }
3721
+ if (BUILD.member) {
3722
+ hostRef.$flags$ &= ~8;
3723
+ }
3611
3724
  if (BUILD.propChangeCallback) {
3612
- cmpMeta.$watchers$ = Cstr.watchers;
3613
- cmpMeta.$serializers$ = Cstr.serializers;
3614
- cmpMeta.$deserializers$ = Cstr.deserializers;
3725
+ hostRef.$flags$ |= 128;
3726
+ }
3727
+ endNewInstance();
3728
+ const needsDeferredCallback = BUILD.slotRelocation && cmpMeta.$flags$ & 4;
3729
+ if (!needsDeferredCallback) {
3730
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
3731
+ } else {
3732
+ hostRef.$deferredConnectedCallback$ = true;
3615
3733
  }
3616
- proxyComponent(
3617
- Cstr,
3618
- cmpMeta,
3619
- 2
3620
- /* proxyState */
3734
+ } else {
3735
+ Cstr = elm.constructor;
3736
+ const cmpTag = elm.localName;
3737
+ customElements.whenDefined(cmpTag).then(
3738
+ () => hostRef.$flags$ |= 128
3739
+ /* isWatchReady */
3621
3740
  );
3622
- Cstr.isProxied = true;
3623
- }
3624
- const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
3625
- if (BUILD.member) {
3626
- hostRef.$flags$ |= 8;
3627
- }
3628
- try {
3629
- new Cstr(hostRef);
3630
- } catch (e) {
3631
- consoleError(e, elm);
3632
3741
  }
3633
- if (BUILD.member) {
3634
- hostRef.$flags$ &= ~8;
3635
- }
3636
- if (BUILD.propChangeCallback) {
3637
- hostRef.$flags$ |= 128;
3638
- }
3639
- endNewInstance();
3640
- fireConnectedCallback(hostRef.$lazyInstance$, elm);
3641
- } else {
3642
- Cstr = elm.constructor;
3643
- const cmpTag = elm.localName;
3644
- customElements.whenDefined(cmpTag).then(
3645
- () => hostRef.$flags$ |= 128
3646
- /* isWatchReady */
3647
- );
3648
- }
3649
- if (BUILD.style && Cstr && Cstr.style) {
3650
- let style;
3651
- if (typeof Cstr.style === "string") {
3652
- style = Cstr.style;
3653
- } else if (BUILD.mode && typeof Cstr.style !== "string") {
3654
- hostRef.$modeName$ = computeMode(elm);
3655
- if (hostRef.$modeName$) {
3656
- style = Cstr.style[hostRef.$modeName$];
3657
- }
3658
- if (BUILD.hydrateServerSide && hostRef.$modeName$) {
3659
- elm.setAttribute("s-mode", hostRef.$modeName$);
3742
+ if (BUILD.style && Cstr && Cstr.style) {
3743
+ let style;
3744
+ if (typeof Cstr.style === "string") {
3745
+ style = Cstr.style;
3746
+ } else if (BUILD.mode && typeof Cstr.style !== "string") {
3747
+ hostRef.$modeName$ = computeMode(elm);
3748
+ if (hostRef.$modeName$) {
3749
+ style = Cstr.style[hostRef.$modeName$];
3750
+ }
3751
+ if (BUILD.hydrateServerSide && hostRef.$modeName$) {
3752
+ elm.setAttribute("s-mode", hostRef.$modeName$);
3753
+ }
3660
3754
  }
3661
- }
3662
- const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
3663
- if (!styles.has(scopeId2)) {
3664
- const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
3665
- if (BUILD.hydrateServerSide && BUILD.shadowDom) {
3666
- if (cmpMeta.$flags$ & 128) {
3667
- style = scopeCss(style, scopeId2, true);
3668
- } else if (needsScopedSSR()) {
3669
- style = expandPartSelectors(style);
3755
+ const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
3756
+ if (!styles.has(scopeId2) || BUILD.hotModuleReplacement && hmrVersionId) {
3757
+ const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
3758
+ if (BUILD.hydrateServerSide && BUILD.shadowDom) {
3759
+ if (cmpMeta.$flags$ & 128) {
3760
+ style = scopeCss(style, scopeId2, true);
3761
+ } else if (needsScopedSSR()) {
3762
+ style = expandPartSelectors(style);
3763
+ }
3670
3764
  }
3765
+ registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1));
3766
+ endRegisterStyles();
3671
3767
  }
3672
- registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1));
3673
- endRegisterStyles();
3674
3768
  }
3675
3769
  }
3676
- }
3677
- const ancestorComponent = hostRef.$ancestorComponent$;
3678
- const schedule = () => scheduleUpdate(hostRef, true);
3679
- if (BUILD.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
3680
- ancestorComponent["s-rc"].push(schedule);
3681
- } else {
3682
- schedule();
3770
+ const ancestorComponent = hostRef.$ancestorComponent$;
3771
+ const schedule = () => scheduleUpdate(hostRef, true);
3772
+ if (BUILD.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
3773
+ ancestorComponent["s-rc"].push(schedule);
3774
+ } else {
3775
+ schedule();
3776
+ }
3777
+ } catch (e2) {
3778
+ consoleError(e2, elm);
3779
+ if (BUILD.asyncLoading && hostRef.$onRenderResolve$) {
3780
+ hostRef.$onRenderResolve$();
3781
+ hostRef.$onRenderResolve$ = void 0;
3782
+ }
3783
+ if (BUILD.asyncLoading && hostRef.$onReadyResolve$) {
3784
+ hostRef.$onReadyResolve$(elm);
3785
+ }
3683
3786
  }
3684
3787
  };
3685
3788
  var fireConnectedCallback = (instance, elm) => {
@@ -3731,7 +3834,7 @@ var connectedCallback = (elm) => {
3731
3834
  }
3732
3835
  if (BUILD.prop && !BUILD.hydrateServerSide && cmpMeta.$members$) {
3733
3836
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
3734
- if (memberFlags & 31 && memberName in elm && elm[memberName] !== Object.prototype[memberName]) {
3837
+ if (memberFlags & 31 && Object.prototype.hasOwnProperty.call(elm, memberName)) {
3735
3838
  const value = elm[memberName];
3736
3839
  delete elm[memberName];
3737
3840
  elm[memberName] = value;
@@ -3798,94 +3901,104 @@ var proxyCustomElement = (Cstr, compactMeta) => {
3798
3901
  $flags$: compactMeta[0],
3799
3902
  $tagName$: compactMeta[1]
3800
3903
  };
3801
- if (BUILD.member) {
3802
- cmpMeta.$members$ = compactMeta[2];
3803
- }
3804
- if (BUILD.hostListener) {
3805
- cmpMeta.$listeners$ = compactMeta[3];
3806
- }
3807
- if (BUILD.propChangeCallback) {
3808
- cmpMeta.$watchers$ = Cstr.$watchers$;
3809
- cmpMeta.$deserializers$ = Cstr.$deserializers$;
3810
- cmpMeta.$serializers$ = Cstr.$serializers$;
3811
- }
3812
- if (BUILD.reflect) {
3813
- cmpMeta.$attrsToReflect$ = [];
3814
- }
3815
- if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1) {
3816
- cmpMeta.$flags$ |= 8;
3817
- }
3818
- if (!(cmpMeta.$flags$ & 1) && cmpMeta.$flags$ & 256) {
3819
- if (BUILD.experimentalSlotFixes) {
3820
- patchPseudoShadowDom(Cstr.prototype);
3821
- } else {
3822
- if (BUILD.slotChildNodesFix) {
3823
- patchChildSlotNodes(Cstr.prototype);
3824
- }
3825
- if (BUILD.cloneNodeFix) {
3826
- patchCloneNode(Cstr.prototype);
3827
- }
3828
- if (BUILD.appendChildSlotFix) {
3829
- patchSlotAppendChild(Cstr.prototype);
3830
- }
3831
- if (BUILD.scopedSlotTextContentFix && cmpMeta.$flags$ & 2) {
3832
- patchTextContent(Cstr.prototype);
3833
- }
3904
+ try {
3905
+ if (BUILD.member) {
3906
+ cmpMeta.$members$ = compactMeta[2];
3834
3907
  }
3835
- }
3836
- if (BUILD.hydrateClientSide && BUILD.shadowDom) {
3837
- hydrateScopedToShadow();
3838
- }
3839
- const originalConnectedCallback = Cstr.prototype.connectedCallback;
3840
- const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
3841
- Object.assign(Cstr.prototype, {
3842
- __hasHostListenerAttached: false,
3843
- __registerHost() {
3844
- registerHost(this, cmpMeta);
3845
- },
3846
- connectedCallback() {
3847
- if (!this.__hasHostListenerAttached) {
3848
- const hostRef = getHostRef(this);
3849
- if (!hostRef) {
3850
- return;
3908
+ if (BUILD.hostListener) {
3909
+ cmpMeta.$listeners$ = compactMeta[3];
3910
+ }
3911
+ if (BUILD.propChangeCallback) {
3912
+ cmpMeta.$watchers$ = Cstr.$watchers$;
3913
+ cmpMeta.$deserializers$ = Cstr.$deserializers$;
3914
+ cmpMeta.$serializers$ = Cstr.$serializers$;
3915
+ }
3916
+ if (BUILD.reflect) {
3917
+ cmpMeta.$attrsToReflect$ = [];
3918
+ }
3919
+ if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1) {
3920
+ cmpMeta.$flags$ |= 8;
3921
+ }
3922
+ if (!(cmpMeta.$flags$ & 1) && cmpMeta.$flags$ & 256) {
3923
+ if (BUILD.experimentalSlotFixes) {
3924
+ patchPseudoShadowDom(Cstr.prototype);
3925
+ } else {
3926
+ if (BUILD.slotChildNodesFix) {
3927
+ patchChildSlotNodes(Cstr.prototype);
3928
+ }
3929
+ if (BUILD.cloneNodeFix) {
3930
+ patchCloneNode(Cstr.prototype);
3931
+ }
3932
+ if (BUILD.appendChildSlotFix) {
3933
+ patchSlotAppendChild(Cstr.prototype);
3934
+ }
3935
+ if (BUILD.scopedSlotTextContentFix && cmpMeta.$flags$ & 2) {
3936
+ patchTextContent(Cstr.prototype);
3851
3937
  }
3852
- addHostEventListeners(this, hostRef, cmpMeta.$listeners$, false);
3853
- this.__hasHostListenerAttached = true;
3854
- }
3855
- connectedCallback(this);
3856
- if (originalConnectedCallback) {
3857
- originalConnectedCallback.call(this);
3858
- }
3859
- },
3860
- disconnectedCallback() {
3861
- disconnectedCallback(this);
3862
- if (originalDisconnectedCallback) {
3863
- originalDisconnectedCallback.call(this);
3864
3938
  }
3865
- },
3866
- __attachShadow() {
3867
- if (supportsShadow) {
3868
- if (!this.shadowRoot) {
3869
- createShadowRoot.call(this, cmpMeta);
3870
- } else {
3871
- if (this.shadowRoot.mode !== "open") {
3872
- throw new Error(
3873
- `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`
3874
- );
3939
+ } else if (BUILD.cloneNodeFix) {
3940
+ patchCloneNode(Cstr.prototype);
3941
+ }
3942
+ if (BUILD.hydrateClientSide && BUILD.shadowDom) {
3943
+ hydrateScopedToShadow();
3944
+ }
3945
+ const originalConnectedCallback = Cstr.prototype.connectedCallback;
3946
+ const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
3947
+ Object.assign(Cstr.prototype, {
3948
+ __hasHostListenerAttached: false,
3949
+ __registerHost() {
3950
+ registerHost(this, cmpMeta);
3951
+ },
3952
+ connectedCallback() {
3953
+ if (!this.__hasHostListenerAttached) {
3954
+ const hostRef = getHostRef(this);
3955
+ if (!hostRef) {
3956
+ return;
3875
3957
  }
3958
+ addHostEventListeners(this, hostRef, cmpMeta.$listeners$, false);
3959
+ this.__hasHostListenerAttached = true;
3960
+ }
3961
+ connectedCallback(this);
3962
+ if (originalConnectedCallback) {
3963
+ originalConnectedCallback.call(this);
3964
+ }
3965
+ },
3966
+ disconnectedCallback() {
3967
+ disconnectedCallback(this);
3968
+ if (originalDisconnectedCallback) {
3969
+ originalDisconnectedCallback.call(this);
3970
+ }
3971
+ },
3972
+ __attachShadow() {
3973
+ if (supportsShadow) {
3974
+ if (!this.shadowRoot) {
3975
+ createShadowRoot.call(this, cmpMeta);
3976
+ } else {
3977
+ if (this.shadowRoot.mode !== "open") {
3978
+ throw new Error(
3979
+ `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`
3980
+ );
3981
+ }
3982
+ }
3983
+ } else {
3984
+ this.shadowRoot = this;
3876
3985
  }
3877
- } else {
3878
- this.shadowRoot = this;
3879
3986
  }
3880
- }
3881
- });
3882
- Cstr.is = cmpMeta.$tagName$;
3883
- return proxyComponent(
3884
- Cstr,
3885
- cmpMeta,
3886
- 1 | 2
3887
- /* proxyState */
3888
- );
3987
+ });
3988
+ Object.defineProperty(Cstr, "is", {
3989
+ value: cmpMeta.$tagName$,
3990
+ configurable: true
3991
+ });
3992
+ return proxyComponent(
3993
+ Cstr,
3994
+ cmpMeta,
3995
+ 1 | 2
3996
+ /* proxyState */
3997
+ );
3998
+ } catch (e2) {
3999
+ consoleError(e2);
4000
+ return Cstr;
4001
+ }
3889
4002
  };
3890
4003
  var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
3891
4004
  if (BUILD.hostListener && listeners && win.document) {
@@ -3920,8 +4033,8 @@ var hostListenerProxy = (hostRef, methodName) => (ev) => {
3920
4033
  } else {
3921
4034
  hostRef.$hostElement$[methodName](ev);
3922
4035
  }
3923
- } catch (e) {
3924
- consoleError(e, hostRef.$hostElement$);
4036
+ } catch (e2) {
4037
+ consoleError(e2, hostRef.$hostElement$);
3925
4038
  }
3926
4039
  };
3927
4040
  var getHostListenerTarget = (doc, elm, flags) => {
@@ -3960,904 +4073,391 @@ function render(vnode, container) {
3960
4073
  };
3961
4074
  renderVdom(ref, vnode);
3962
4075
  }
4076
+ var tagTransformer = void 0;
4077
+ function transformTag(tag) {
4078
+ if (!tagTransformer) return tag;
4079
+ return tagTransformer(tag);
4080
+ }
3963
4081
 
3964
4082
  // dist/components/attachment-preview2.js
3965
- var attachmentPreviewCss = ":host{display:block;font-size:13px}img,video{max-width:100%;margin-top:10px}";
3966
- var AttachmentPreview = /* @__PURE__ */ proxyCustomElement(class AttachmentPreview2 extends H {
3967
- constructor(registerHost2) {
3968
- super();
3969
- if (registerHost2 !== false) {
3970
- this.__registerHost();
3971
- }
3972
- this.__attachShadow();
4083
+ var a = proxyCustomElement(class extends H {
4084
+ constructor(e2) {
4085
+ super(), false !== e2 && this.__registerHost(), this.__attachShadow();
3973
4086
  }
3974
4087
  src;
3975
4088
  filetype;
3976
4089
  render() {
3977
- return h(Host, { key: "429f17fda03ded975255da6335ba23a663ee662e", class: this.computeClass() }, this.isImage() && h("img", { key: "daa4e38cb1375db7d8852ab1cb401f048efbbdc7", src: this.src }), this.isVideo() && h("video", { key: "1b7860bc3edf2f4ba4951dd0bd8a88f14db078a0", src: this.src, onClick: toggle }), this.isOther() && "This file does not offer a preview", h("slot", { key: "b8a894bcc9ae11619d543b20f2bd2ee9167616d8" }));
4090
+ return h(Host, { key: "429f17fda03ded975255da6335ba23a663ee662e", class: this.computeClass() }, this.isImage() && h("img", { key: "daa4e38cb1375db7d8852ab1cb401f048efbbdc7", src: this.src }), this.isVideo() && h("video", { key: "1b7860bc3edf2f4ba4951dd0bd8a88f14db078a0", src: this.src, onClick: n }), this.isOther() && "This file does not offer a preview", h("slot", { key: "b8a894bcc9ae11619d543b20f2bd2ee9167616d8" }));
3978
4091
  }
3979
4092
  computeClass() {
3980
- if (this.isImage())
3981
- return "image";
3982
- if (this.isVideo())
3983
- return "video";
3984
- return "other";
4093
+ return this.isImage() ? "image" : this.isVideo() ? "video" : "other";
3985
4094
  }
3986
4095
  isImage() {
3987
- return this.filetype == "image";
4096
+ return "image" == this.filetype;
3988
4097
  }
3989
4098
  isVideo() {
3990
- return this.filetype == "video";
4099
+ return "video" == this.filetype;
3991
4100
  }
3992
4101
  isOther() {
3993
4102
  return !this.isImage() && !this.isVideo();
3994
4103
  }
3995
4104
  static get style() {
3996
- return attachmentPreviewCss;
3997
- }
3998
- }, [257, "attachment-preview", {
3999
- "src": [513],
4000
- "filetype": [513]
4001
- }]);
4002
- var toggle = function() {
4003
- this.paused ? this.play() : this.pause();
4004
- return false;
4105
+ return ":host{display:block;font-size:13px}img,video{max-width:100%;margin-top:10px}";
4106
+ }
4107
+ }, [769, "attachment-preview", { src: [513], filetype: [513] }]);
4108
+ var n = function() {
4109
+ return this.paused ? this.play() : this.pause(), false;
4005
4110
  };
4006
4111
 
4007
4112
  // dist/components/attachment-file2.js
4008
- var sparkMd5 = {
4009
- exports: {}
4010
- };
4011
- (function(module, exports) {
4012
- (function(factory) {
4013
- {
4014
- module.exports = factory();
4015
- }
4016
- })((function(undefined$1) {
4017
- var hex_chr = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
4018
- function md5cycle(x, k) {
4019
- var a = x[0], b = x[1], c = x[2], d = x[3];
4020
- a += (b & c | ~b & d) + k[0] - 680876936 | 0;
4021
- a = (a << 7 | a >>> 25) + b | 0;
4022
- d += (a & b | ~a & c) + k[1] - 389564586 | 0;
4023
- d = (d << 12 | d >>> 20) + a | 0;
4024
- c += (d & a | ~d & b) + k[2] + 606105819 | 0;
4025
- c = (c << 17 | c >>> 15) + d | 0;
4026
- b += (c & d | ~c & a) + k[3] - 1044525330 | 0;
4027
- b = (b << 22 | b >>> 10) + c | 0;
4028
- a += (b & c | ~b & d) + k[4] - 176418897 | 0;
4029
- a = (a << 7 | a >>> 25) + b | 0;
4030
- d += (a & b | ~a & c) + k[5] + 1200080426 | 0;
4031
- d = (d << 12 | d >>> 20) + a | 0;
4032
- c += (d & a | ~d & b) + k[6] - 1473231341 | 0;
4033
- c = (c << 17 | c >>> 15) + d | 0;
4034
- b += (c & d | ~c & a) + k[7] - 45705983 | 0;
4035
- b = (b << 22 | b >>> 10) + c | 0;
4036
- a += (b & c | ~b & d) + k[8] + 1770035416 | 0;
4037
- a = (a << 7 | a >>> 25) + b | 0;
4038
- d += (a & b | ~a & c) + k[9] - 1958414417 | 0;
4039
- d = (d << 12 | d >>> 20) + a | 0;
4040
- c += (d & a | ~d & b) + k[10] - 42063 | 0;
4041
- c = (c << 17 | c >>> 15) + d | 0;
4042
- b += (c & d | ~c & a) + k[11] - 1990404162 | 0;
4043
- b = (b << 22 | b >>> 10) + c | 0;
4044
- a += (b & c | ~b & d) + k[12] + 1804603682 | 0;
4045
- a = (a << 7 | a >>> 25) + b | 0;
4046
- d += (a & b | ~a & c) + k[13] - 40341101 | 0;
4047
- d = (d << 12 | d >>> 20) + a | 0;
4048
- c += (d & a | ~d & b) + k[14] - 1502002290 | 0;
4049
- c = (c << 17 | c >>> 15) + d | 0;
4050
- b += (c & d | ~c & a) + k[15] + 1236535329 | 0;
4051
- b = (b << 22 | b >>> 10) + c | 0;
4052
- a += (b & d | c & ~d) + k[1] - 165796510 | 0;
4053
- a = (a << 5 | a >>> 27) + b | 0;
4054
- d += (a & c | b & ~c) + k[6] - 1069501632 | 0;
4055
- d = (d << 9 | d >>> 23) + a | 0;
4056
- c += (d & b | a & ~b) + k[11] + 643717713 | 0;
4057
- c = (c << 14 | c >>> 18) + d | 0;
4058
- b += (c & a | d & ~a) + k[0] - 373897302 | 0;
4059
- b = (b << 20 | b >>> 12) + c | 0;
4060
- a += (b & d | c & ~d) + k[5] - 701558691 | 0;
4061
- a = (a << 5 | a >>> 27) + b | 0;
4062
- d += (a & c | b & ~c) + k[10] + 38016083 | 0;
4063
- d = (d << 9 | d >>> 23) + a | 0;
4064
- c += (d & b | a & ~b) + k[15] - 660478335 | 0;
4065
- c = (c << 14 | c >>> 18) + d | 0;
4066
- b += (c & a | d & ~a) + k[4] - 405537848 | 0;
4067
- b = (b << 20 | b >>> 12) + c | 0;
4068
- a += (b & d | c & ~d) + k[9] + 568446438 | 0;
4069
- a = (a << 5 | a >>> 27) + b | 0;
4070
- d += (a & c | b & ~c) + k[14] - 1019803690 | 0;
4071
- d = (d << 9 | d >>> 23) + a | 0;
4072
- c += (d & b | a & ~b) + k[3] - 187363961 | 0;
4073
- c = (c << 14 | c >>> 18) + d | 0;
4074
- b += (c & a | d & ~a) + k[8] + 1163531501 | 0;
4075
- b = (b << 20 | b >>> 12) + c | 0;
4076
- a += (b & d | c & ~d) + k[13] - 1444681467 | 0;
4077
- a = (a << 5 | a >>> 27) + b | 0;
4078
- d += (a & c | b & ~c) + k[2] - 51403784 | 0;
4079
- d = (d << 9 | d >>> 23) + a | 0;
4080
- c += (d & b | a & ~b) + k[7] + 1735328473 | 0;
4081
- c = (c << 14 | c >>> 18) + d | 0;
4082
- b += (c & a | d & ~a) + k[12] - 1926607734 | 0;
4083
- b = (b << 20 | b >>> 12) + c | 0;
4084
- a += (b ^ c ^ d) + k[5] - 378558 | 0;
4085
- a = (a << 4 | a >>> 28) + b | 0;
4086
- d += (a ^ b ^ c) + k[8] - 2022574463 | 0;
4087
- d = (d << 11 | d >>> 21) + a | 0;
4088
- c += (d ^ a ^ b) + k[11] + 1839030562 | 0;
4089
- c = (c << 16 | c >>> 16) + d | 0;
4090
- b += (c ^ d ^ a) + k[14] - 35309556 | 0;
4091
- b = (b << 23 | b >>> 9) + c | 0;
4092
- a += (b ^ c ^ d) + k[1] - 1530992060 | 0;
4093
- a = (a << 4 | a >>> 28) + b | 0;
4094
- d += (a ^ b ^ c) + k[4] + 1272893353 | 0;
4095
- d = (d << 11 | d >>> 21) + a | 0;
4096
- c += (d ^ a ^ b) + k[7] - 155497632 | 0;
4097
- c = (c << 16 | c >>> 16) + d | 0;
4098
- b += (c ^ d ^ a) + k[10] - 1094730640 | 0;
4099
- b = (b << 23 | b >>> 9) + c | 0;
4100
- a += (b ^ c ^ d) + k[13] + 681279174 | 0;
4101
- a = (a << 4 | a >>> 28) + b | 0;
4102
- d += (a ^ b ^ c) + k[0] - 358537222 | 0;
4103
- d = (d << 11 | d >>> 21) + a | 0;
4104
- c += (d ^ a ^ b) + k[3] - 722521979 | 0;
4105
- c = (c << 16 | c >>> 16) + d | 0;
4106
- b += (c ^ d ^ a) + k[6] + 76029189 | 0;
4107
- b = (b << 23 | b >>> 9) + c | 0;
4108
- a += (b ^ c ^ d) + k[9] - 640364487 | 0;
4109
- a = (a << 4 | a >>> 28) + b | 0;
4110
- d += (a ^ b ^ c) + k[12] - 421815835 | 0;
4111
- d = (d << 11 | d >>> 21) + a | 0;
4112
- c += (d ^ a ^ b) + k[15] + 530742520 | 0;
4113
- c = (c << 16 | c >>> 16) + d | 0;
4114
- b += (c ^ d ^ a) + k[2] - 995338651 | 0;
4115
- b = (b << 23 | b >>> 9) + c | 0;
4116
- a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;
4117
- a = (a << 6 | a >>> 26) + b | 0;
4118
- d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;
4119
- d = (d << 10 | d >>> 22) + a | 0;
4120
- c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;
4121
- c = (c << 15 | c >>> 17) + d | 0;
4122
- b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;
4123
- b = (b << 21 | b >>> 11) + c | 0;
4124
- a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;
4125
- a = (a << 6 | a >>> 26) + b | 0;
4126
- d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;
4127
- d = (d << 10 | d >>> 22) + a | 0;
4128
- c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;
4129
- c = (c << 15 | c >>> 17) + d | 0;
4130
- b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;
4131
- b = (b << 21 | b >>> 11) + c | 0;
4132
- a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;
4133
- a = (a << 6 | a >>> 26) + b | 0;
4134
- d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;
4135
- d = (d << 10 | d >>> 22) + a | 0;
4136
- c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;
4137
- c = (c << 15 | c >>> 17) + d | 0;
4138
- b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;
4139
- b = (b << 21 | b >>> 11) + c | 0;
4140
- a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;
4141
- a = (a << 6 | a >>> 26) + b | 0;
4142
- d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;
4143
- d = (d << 10 | d >>> 22) + a | 0;
4144
- c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;
4145
- c = (c << 15 | c >>> 17) + d | 0;
4146
- b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;
4147
- b = (b << 21 | b >>> 11) + c | 0;
4148
- x[0] = a + x[0] | 0;
4149
- x[1] = b + x[1] | 0;
4150
- x[2] = c + x[2] | 0;
4151
- x[3] = d + x[3] | 0;
4152
- }
4153
- function md5blk(s) {
4154
- var md5blks = [], i2;
4155
- for (i2 = 0; i2 < 64; i2 += 4) {
4156
- md5blks[i2 >> 2] = s.charCodeAt(i2) + (s.charCodeAt(i2 + 1) << 8) + (s.charCodeAt(i2 + 2) << 16) + (s.charCodeAt(i2 + 3) << 24);
4157
- }
4158
- return md5blks;
4159
- }
4160
- function md5blk_array(a) {
4161
- var md5blks = [], i2;
4162
- for (i2 = 0; i2 < 64; i2 += 4) {
4163
- md5blks[i2 >> 2] = a[i2] + (a[i2 + 1] << 8) + (a[i2 + 2] << 16) + (a[i2 + 3] << 24);
4164
- }
4165
- return md5blks;
4166
- }
4167
- function md51(s) {
4168
- var n = s.length, state = [1732584193, -271733879, -1732584194, 271733878], i2, length, tail, tmp, lo, hi;
4169
- for (i2 = 64; i2 <= n; i2 += 64) {
4170
- md5cycle(state, md5blk(s.substring(i2 - 64, i2)));
4171
- }
4172
- s = s.substring(i2 - 64);
4173
- length = s.length;
4174
- tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
4175
- for (i2 = 0; i2 < length; i2 += 1) {
4176
- tail[i2 >> 2] |= s.charCodeAt(i2) << (i2 % 4 << 3);
4177
- }
4178
- tail[i2 >> 2] |= 128 << (i2 % 4 << 3);
4179
- if (i2 > 55) {
4180
- md5cycle(state, tail);
4181
- for (i2 = 0; i2 < 16; i2 += 1) {
4182
- tail[i2] = 0;
4183
- }
4184
- }
4185
- tmp = n * 8;
4186
- tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
4187
- lo = parseInt(tmp[2], 16);
4188
- hi = parseInt(tmp[1], 16) || 0;
4189
- tail[14] = lo;
4190
- tail[15] = hi;
4191
- md5cycle(state, tail);
4192
- return state;
4193
- }
4194
- function md51_array(a) {
4195
- var n = a.length, state = [1732584193, -271733879, -1732584194, 271733878], i2, length, tail, tmp, lo, hi;
4196
- for (i2 = 64; i2 <= n; i2 += 64) {
4197
- md5cycle(state, md5blk_array(a.subarray(i2 - 64, i2)));
4198
- }
4199
- a = i2 - 64 < n ? a.subarray(i2 - 64) : new Uint8Array(0);
4200
- length = a.length;
4201
- tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
4202
- for (i2 = 0; i2 < length; i2 += 1) {
4203
- tail[i2 >> 2] |= a[i2] << (i2 % 4 << 3);
4204
- }
4205
- tail[i2 >> 2] |= 128 << (i2 % 4 << 3);
4206
- if (i2 > 55) {
4207
- md5cycle(state, tail);
4208
- for (i2 = 0; i2 < 16; i2 += 1) {
4209
- tail[i2] = 0;
4210
- }
4211
- }
4212
- tmp = n * 8;
4213
- tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
4214
- lo = parseInt(tmp[2], 16);
4215
- hi = parseInt(tmp[1], 16) || 0;
4216
- tail[14] = lo;
4217
- tail[15] = hi;
4218
- md5cycle(state, tail);
4219
- return state;
4220
- }
4221
- function rhex(n) {
4222
- var s = "", j;
4223
- for (j = 0; j < 4; j += 1) {
4224
- s += hex_chr[n >> j * 8 + 4 & 15] + hex_chr[n >> j * 8 & 15];
4225
- }
4226
- return s;
4227
- }
4228
- function hex(x) {
4229
- var i2;
4230
- for (i2 = 0; i2 < x.length; i2 += 1) {
4231
- x[i2] = rhex(x[i2]);
4232
- }
4233
- return x.join("");
4234
- }
4235
- if (hex(md51("hello")) !== "5d41402abc4b2a76b9719d911017c592") ;
4236
- if (typeof ArrayBuffer !== "undefined" && !ArrayBuffer.prototype.slice) {
4237
- (function() {
4238
- function clamp(val, length) {
4239
- val = val | 0 || 0;
4240
- if (val < 0) {
4241
- return Math.max(val + length, 0);
4242
- }
4243
- return Math.min(val, length);
4244
- }
4245
- ArrayBuffer.prototype.slice = function(from, to) {
4246
- var length = this.byteLength, begin = clamp(from, length), end = length, num, target, targetArray, sourceArray;
4247
- if (to !== undefined$1) {
4248
- end = clamp(to, length);
4249
- }
4250
- if (begin > end) {
4251
- return new ArrayBuffer(0);
4252
- }
4253
- num = end - begin;
4254
- target = new ArrayBuffer(num);
4255
- targetArray = new Uint8Array(target);
4256
- sourceArray = new Uint8Array(this, begin, num);
4257
- targetArray.set(sourceArray);
4258
- return target;
4259
- };
4260
- })();
4261
- }
4262
- function toUtf8(str) {
4263
- if (/[\u0080-\uFFFF]/.test(str)) {
4264
- str = unescape(encodeURIComponent(str));
4265
- }
4266
- return str;
4267
- }
4268
- function utf8Str2ArrayBuffer(str, returnUInt8Array) {
4269
- var length = str.length, buff = new ArrayBuffer(length), arr = new Uint8Array(buff), i2;
4270
- for (i2 = 0; i2 < length; i2 += 1) {
4271
- arr[i2] = str.charCodeAt(i2);
4272
- }
4273
- return returnUInt8Array ? arr : buff;
4274
- }
4275
- function arrayBuffer2Utf8Str(buff) {
4276
- return String.fromCharCode.apply(null, new Uint8Array(buff));
4277
- }
4278
- function concatenateArrayBuffers(first, second, returnUInt8Array) {
4279
- var result = new Uint8Array(first.byteLength + second.byteLength);
4280
- result.set(new Uint8Array(first));
4281
- result.set(new Uint8Array(second), first.byteLength);
4282
- return result;
4283
- }
4284
- function hexToBinaryString(hex2) {
4285
- var bytes = [], length = hex2.length, x;
4286
- for (x = 0; x < length - 1; x += 2) {
4287
- bytes.push(parseInt(hex2.substr(x, 2), 16));
4288
- }
4289
- return String.fromCharCode.apply(String, bytes);
4290
- }
4291
- function SparkMD52() {
4292
- this.reset();
4293
- }
4294
- SparkMD52.prototype.append = function(str) {
4295
- this.appendBinary(toUtf8(str));
4296
- return this;
4297
- };
4298
- SparkMD52.prototype.appendBinary = function(contents) {
4299
- this._buff += contents;
4300
- this._length += contents.length;
4301
- var length = this._buff.length, i2;
4302
- for (i2 = 64; i2 <= length; i2 += 64) {
4303
- md5cycle(this._hash, md5blk(this._buff.substring(i2 - 64, i2)));
4304
- }
4305
- this._buff = this._buff.substring(i2 - 64);
4306
- return this;
4307
- };
4308
- SparkMD52.prototype.end = function(raw) {
4309
- var buff = this._buff, length = buff.length, i2, tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ret;
4310
- for (i2 = 0; i2 < length; i2 += 1) {
4311
- tail[i2 >> 2] |= buff.charCodeAt(i2) << (i2 % 4 << 3);
4312
- }
4313
- this._finish(tail, length);
4314
- ret = hex(this._hash);
4315
- if (raw) {
4316
- ret = hexToBinaryString(ret);
4317
- }
4318
- this.reset();
4319
- return ret;
4320
- };
4321
- SparkMD52.prototype.reset = function() {
4322
- this._buff = "";
4323
- this._length = 0;
4324
- this._hash = [1732584193, -271733879, -1732584194, 271733878];
4325
- return this;
4326
- };
4327
- SparkMD52.prototype.getState = function() {
4328
- return {
4329
- buff: this._buff,
4330
- length: this._length,
4331
- hash: this._hash.slice()
4332
- };
4333
- };
4334
- SparkMD52.prototype.setState = function(state) {
4335
- this._buff = state.buff;
4336
- this._length = state.length;
4337
- this._hash = state.hash;
4338
- return this;
4113
+ var a2 = { exports: {} };
4114
+ a2.exports = (function() {
4115
+ var t = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
4116
+ function e2(t2, e3) {
4117
+ var i3 = t2[0], s2 = t2[1], r3 = t2[2], n4 = t2[3];
4118
+ s2 = ((s2 += ((r3 = ((r3 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & r3 | ~s2 & n4) + e3[0] - 680876936 | 0) << 7 | i3 >>> 25) + s2 | 0) & s2 | ~i3 & r3) + e3[1] - 389564586 | 0) << 12 | n4 >>> 20) + i3 | 0) & i3 | ~n4 & s2) + e3[2] + 606105819 | 0) << 17 | r3 >>> 15) + n4 | 0) & n4 | ~r3 & i3) + e3[3] - 1044525330 | 0) << 22 | s2 >>> 10) + r3 | 0, s2 = ((s2 += ((r3 = ((r3 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & r3 | ~s2 & n4) + e3[4] - 176418897 | 0) << 7 | i3 >>> 25) + s2 | 0) & s2 | ~i3 & r3) + e3[5] + 1200080426 | 0) << 12 | n4 >>> 20) + i3 | 0) & i3 | ~n4 & s2) + e3[6] - 1473231341 | 0) << 17 | r3 >>> 15) + n4 | 0) & n4 | ~r3 & i3) + e3[7] - 45705983 | 0) << 22 | s2 >>> 10) + r3 | 0, s2 = ((s2 += ((r3 = ((r3 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & r3 | ~s2 & n4) + e3[8] + 1770035416 | 0) << 7 | i3 >>> 25) + s2 | 0) & s2 | ~i3 & r3) + e3[9] - 1958414417 | 0) << 12 | n4 >>> 20) + i3 | 0) & i3 | ~n4 & s2) + e3[10] - 42063 | 0) << 17 | r3 >>> 15) + n4 | 0) & n4 | ~r3 & i3) + e3[11] - 1990404162 | 0) << 22 | s2 >>> 10) + r3 | 0, s2 = ((s2 += ((r3 = ((r3 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & r3 | ~s2 & n4) + e3[12] + 1804603682 | 0) << 7 | i3 >>> 25) + s2 | 0) & s2 | ~i3 & r3) + e3[13] - 40341101 | 0) << 12 | n4 >>> 20) + i3 | 0) & i3 | ~n4 & s2) + e3[14] - 1502002290 | 0) << 17 | r3 >>> 15) + n4 | 0) & n4 | ~r3 & i3) + e3[15] + 1236535329 | 0) << 22 | s2 >>> 10) + r3 | 0, s2 = ((s2 += ((r3 = ((r3 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & n4 | r3 & ~n4) + e3[1] - 165796510 | 0) << 5 | i3 >>> 27) + s2 | 0) & r3 | s2 & ~r3) + e3[6] - 1069501632 | 0) << 9 | n4 >>> 23) + i3 | 0) & s2 | i3 & ~s2) + e3[11] + 643717713 | 0) << 14 | r3 >>> 18) + n4 | 0) & i3 | n4 & ~i3) + e3[0] - 373897302 | 0) << 20 | s2 >>> 12) + r3 | 0, s2 = ((s2 += ((r3 = ((r3 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & n4 | r3 & ~n4) + e3[5] - 701558691 | 0) << 5 | i3 >>> 27) + s2 | 0) & r3 | s2 & ~r3) + e3[10] + 38016083 | 0) << 9 | n4 >>> 23) + i3 | 0) & s2 | i3 & ~s2) + e3[15] - 660478335 | 0) << 14 | r3 >>> 18) + n4 | 0) & i3 | n4 & ~i3) + e3[4] - 405537848 | 0) << 20 | s2 >>> 12) + r3 | 0, s2 = ((s2 += ((r3 = ((r3 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & n4 | r3 & ~n4) + e3[9] + 568446438 | 0) << 5 | i3 >>> 27) + s2 | 0) & r3 | s2 & ~r3) + e3[14] - 1019803690 | 0) << 9 | n4 >>> 23) + i3 | 0) & s2 | i3 & ~s2) + e3[3] - 187363961 | 0) << 14 | r3 >>> 18) + n4 | 0) & i3 | n4 & ~i3) + e3[8] + 1163531501 | 0) << 20 | s2 >>> 12) + r3 | 0, s2 = ((s2 += ((r3 = ((r3 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & n4 | r3 & ~n4) + e3[13] - 1444681467 | 0) << 5 | i3 >>> 27) + s2 | 0) & r3 | s2 & ~r3) + e3[2] - 51403784 | 0) << 9 | n4 >>> 23) + i3 | 0) & s2 | i3 & ~s2) + e3[7] + 1735328473 | 0) << 14 | r3 >>> 18) + n4 | 0) & i3 | n4 & ~i3) + e3[12] - 1926607734 | 0) << 20 | s2 >>> 12) + r3 | 0, s2 = ((s2 += ((r3 = ((r3 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 ^ r3 ^ n4) + e3[5] - 378558 | 0) << 4 | i3 >>> 28) + s2 | 0) ^ s2 ^ r3) + e3[8] - 2022574463 | 0) << 11 | n4 >>> 21) + i3 | 0) ^ i3 ^ s2) + e3[11] + 1839030562 | 0) << 16 | r3 >>> 16) + n4 | 0) ^ n4 ^ i3) + e3[14] - 35309556 | 0) << 23 | s2 >>> 9) + r3 | 0, s2 = ((s2 += ((r3 = ((r3 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 ^ r3 ^ n4) + e3[1] - 1530992060 | 0) << 4 | i3 >>> 28) + s2 | 0) ^ s2 ^ r3) + e3[4] + 1272893353 | 0) << 11 | n4 >>> 21) + i3 | 0) ^ i3 ^ s2) + e3[7] - 155497632 | 0) << 16 | r3 >>> 16) + n4 | 0) ^ n4 ^ i3) + e3[10] - 1094730640 | 0) << 23 | s2 >>> 9) + r3 | 0, s2 = ((s2 += ((r3 = ((r3 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 ^ r3 ^ n4) + e3[13] + 681279174 | 0) << 4 | i3 >>> 28) + s2 | 0) ^ s2 ^ r3) + e3[0] - 358537222 | 0) << 11 | n4 >>> 21) + i3 | 0) ^ i3 ^ s2) + e3[3] - 722521979 | 0) << 16 | r3 >>> 16) + n4 | 0) ^ n4 ^ i3) + e3[6] + 76029189 | 0) << 23 | s2 >>> 9) + r3 | 0, s2 = ((s2 += ((r3 = ((r3 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 ^ r3 ^ n4) + e3[9] - 640364487 | 0) << 4 | i3 >>> 28) + s2 | 0) ^ s2 ^ r3) + e3[12] - 421815835 | 0) << 11 | n4 >>> 21) + i3 | 0) ^ i3 ^ s2) + e3[15] + 530742520 | 0) << 16 | r3 >>> 16) + n4 | 0) ^ n4 ^ i3) + e3[2] - 995338651 | 0) << 23 | s2 >>> 9) + r3 | 0, s2 = ((s2 += ((n4 = ((n4 += (s2 ^ ((i3 = ((i3 += (r3 ^ (s2 | ~n4)) + e3[0] - 198630844 | 0) << 6 | i3 >>> 26) + s2 | 0) | ~r3)) + e3[7] + 1126891415 | 0) << 10 | n4 >>> 22) + i3 | 0) ^ ((r3 = ((r3 += (i3 ^ (n4 | ~s2)) + e3[14] - 1416354905 | 0) << 15 | r3 >>> 17) + n4 | 0) | ~i3)) + e3[5] - 57434055 | 0) << 21 | s2 >>> 11) + r3 | 0, s2 = ((s2 += ((n4 = ((n4 += (s2 ^ ((i3 = ((i3 += (r3 ^ (s2 | ~n4)) + e3[12] + 1700485571 | 0) << 6 | i3 >>> 26) + s2 | 0) | ~r3)) + e3[3] - 1894986606 | 0) << 10 | n4 >>> 22) + i3 | 0) ^ ((r3 = ((r3 += (i3 ^ (n4 | ~s2)) + e3[10] - 1051523 | 0) << 15 | r3 >>> 17) + n4 | 0) | ~i3)) + e3[1] - 2054922799 | 0) << 21 | s2 >>> 11) + r3 | 0, s2 = ((s2 += ((n4 = ((n4 += (s2 ^ ((i3 = ((i3 += (r3 ^ (s2 | ~n4)) + e3[8] + 1873313359 | 0) << 6 | i3 >>> 26) + s2 | 0) | ~r3)) + e3[15] - 30611744 | 0) << 10 | n4 >>> 22) + i3 | 0) ^ ((r3 = ((r3 += (i3 ^ (n4 | ~s2)) + e3[6] - 1560198380 | 0) << 15 | r3 >>> 17) + n4 | 0) | ~i3)) + e3[13] + 1309151649 | 0) << 21 | s2 >>> 11) + r3 | 0, s2 = ((s2 += ((n4 = ((n4 += (s2 ^ ((i3 = ((i3 += (r3 ^ (s2 | ~n4)) + e3[4] - 145523070 | 0) << 6 | i3 >>> 26) + s2 | 0) | ~r3)) + e3[11] - 1120210379 | 0) << 10 | n4 >>> 22) + i3 | 0) ^ ((r3 = ((r3 += (i3 ^ (n4 | ~s2)) + e3[2] + 718787259 | 0) << 15 | r3 >>> 17) + n4 | 0) | ~i3)) + e3[9] - 343485551 | 0) << 21 | s2 >>> 11) + r3 | 0, t2[0] = i3 + t2[0] | 0, t2[1] = s2 + t2[1] | 0, t2[2] = r3 + t2[2] | 0, t2[3] = n4 + t2[3] | 0;
4119
+ }
4120
+ function i2(t2) {
4121
+ var e3, i3 = [];
4122
+ for (e3 = 0; e3 < 64; e3 += 4) i3[e3 >> 2] = t2.charCodeAt(e3) + (t2.charCodeAt(e3 + 1) << 8) + (t2.charCodeAt(e3 + 2) << 16) + (t2.charCodeAt(e3 + 3) << 24);
4123
+ return i3;
4124
+ }
4125
+ function s(t2) {
4126
+ var e3, i3 = [];
4127
+ for (e3 = 0; e3 < 64; e3 += 4) i3[e3 >> 2] = t2[e3] + (t2[e3 + 1] << 8) + (t2[e3 + 2] << 16) + (t2[e3 + 3] << 24);
4128
+ return i3;
4129
+ }
4130
+ function r2(t2) {
4131
+ var s2, r3, n4, o4, a4, h4, c6 = t2.length, l3 = [1732584193, -271733879, -1732584194, 271733878];
4132
+ for (s2 = 64; s2 <= c6; s2 += 64) e2(l3, i2(t2.substring(s2 - 64, s2)));
4133
+ for (r3 = (t2 = t2.substring(s2 - 64)).length, n4 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], s2 = 0; s2 < r3; s2 += 1) n4[s2 >> 2] |= t2.charCodeAt(s2) << (s2 % 4 << 3);
4134
+ if (n4[s2 >> 2] |= 128 << (s2 % 4 << 3), s2 > 55) for (e2(l3, n4), s2 = 0; s2 < 16; s2 += 1) n4[s2] = 0;
4135
+ return o4 = (o4 = 8 * c6).toString(16).match(/(.*?)(.{0,8})$/), a4 = parseInt(o4[2], 16), h4 = parseInt(o4[1], 16) || 0, n4[14] = a4, n4[15] = h4, e2(l3, n4), l3;
4136
+ }
4137
+ function n3(e3) {
4138
+ var i3, s2 = "";
4139
+ for (i3 = 0; i3 < 4; i3 += 1) s2 += t[e3 >> 8 * i3 + 4 & 15] + t[e3 >> 8 * i3 & 15];
4140
+ return s2;
4141
+ }
4142
+ function o3(t2) {
4143
+ var e3;
4144
+ for (e3 = 0; e3 < t2.length; e3 += 1) t2[e3] = n3(t2[e3]);
4145
+ return t2.join("");
4146
+ }
4147
+ function a3(t2) {
4148
+ return /[\u0080-\uFFFF]/.test(t2) && (t2 = unescape(encodeURIComponent(t2))), t2;
4149
+ }
4150
+ function h3(t2) {
4151
+ var e3, i3 = [], s2 = t2.length;
4152
+ for (e3 = 0; e3 < s2 - 1; e3 += 2) i3.push(parseInt(t2.substr(e3, 2), 16));
4153
+ return String.fromCharCode.apply(String, i3);
4154
+ }
4155
+ function c5() {
4156
+ this.reset();
4157
+ }
4158
+ return o3(r2("hello")), "undefined" == typeof ArrayBuffer || ArrayBuffer.prototype.slice || (function() {
4159
+ function t2(t3, e3) {
4160
+ return (t3 = 0 | t3 || 0) < 0 ? Math.max(t3 + e3, 0) : Math.min(t3, e3);
4161
+ }
4162
+ ArrayBuffer.prototype.slice = function(e3, i3) {
4163
+ var s2, r3, n4, o4, a4 = this.byteLength, h4 = t2(e3, a4), c6 = a4;
4164
+ return void 0 !== i3 && (c6 = t2(i3, a4)), h4 > c6 ? new ArrayBuffer(0) : (s2 = c6 - h4, r3 = new ArrayBuffer(s2), n4 = new Uint8Array(r3), o4 = new Uint8Array(this, h4, s2), n4.set(o4), r3);
4339
4165
  };
4340
- SparkMD52.prototype.destroy = function() {
4341
- delete this._hash;
4342
- delete this._buff;
4343
- delete this._length;
4344
- };
4345
- SparkMD52.prototype._finish = function(tail, length) {
4346
- var i2 = length, tmp, lo, hi;
4347
- tail[i2 >> 2] |= 128 << (i2 % 4 << 3);
4348
- if (i2 > 55) {
4349
- md5cycle(this._hash, tail);
4350
- for (i2 = 0; i2 < 16; i2 += 1) {
4351
- tail[i2] = 0;
4352
- }
4353
- }
4354
- tmp = this._length * 8;
4355
- tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
4356
- lo = parseInt(tmp[2], 16);
4357
- hi = parseInt(tmp[1], 16) || 0;
4358
- tail[14] = lo;
4359
- tail[15] = hi;
4360
- md5cycle(this._hash, tail);
4361
- };
4362
- SparkMD52.hash = function(str, raw) {
4363
- return SparkMD52.hashBinary(toUtf8(str), raw);
4364
- };
4365
- SparkMD52.hashBinary = function(content, raw) {
4366
- var hash = md51(content), ret = hex(hash);
4367
- return raw ? hexToBinaryString(ret) : ret;
4368
- };
4369
- SparkMD52.ArrayBuffer = function() {
4370
- this.reset();
4371
- };
4372
- SparkMD52.ArrayBuffer.prototype.append = function(arr) {
4373
- var buff = concatenateArrayBuffers(this._buff.buffer, arr), length = buff.length, i2;
4374
- this._length += arr.byteLength;
4375
- for (i2 = 64; i2 <= length; i2 += 64) {
4376
- md5cycle(this._hash, md5blk_array(buff.subarray(i2 - 64, i2)));
4377
- }
4378
- this._buff = i2 - 64 < length ? new Uint8Array(buff.buffer.slice(i2 - 64)) : new Uint8Array(0);
4379
- return this;
4380
- };
4381
- SparkMD52.ArrayBuffer.prototype.end = function(raw) {
4382
- var buff = this._buff, length = buff.length, tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], i2, ret;
4383
- for (i2 = 0; i2 < length; i2 += 1) {
4384
- tail[i2 >> 2] |= buff[i2] << (i2 % 4 << 3);
4385
- }
4386
- this._finish(tail, length);
4387
- ret = hex(this._hash);
4388
- if (raw) {
4389
- ret = hexToBinaryString(ret);
4390
- }
4391
- this.reset();
4392
- return ret;
4393
- };
4394
- SparkMD52.ArrayBuffer.prototype.reset = function() {
4395
- this._buff = new Uint8Array(0);
4396
- this._length = 0;
4397
- this._hash = [1732584193, -271733879, -1732584194, 271733878];
4398
- return this;
4399
- };
4400
- SparkMD52.ArrayBuffer.prototype.getState = function() {
4401
- var state = SparkMD52.prototype.getState.call(this);
4402
- state.buff = arrayBuffer2Utf8Str(state.buff);
4403
- return state;
4404
- };
4405
- SparkMD52.ArrayBuffer.prototype.setState = function(state) {
4406
- state.buff = utf8Str2ArrayBuffer(state.buff, true);
4407
- return SparkMD52.prototype.setState.call(this, state);
4408
- };
4409
- SparkMD52.ArrayBuffer.prototype.destroy = SparkMD52.prototype.destroy;
4410
- SparkMD52.ArrayBuffer.prototype._finish = SparkMD52.prototype._finish;
4411
- SparkMD52.ArrayBuffer.hash = function(arr, raw) {
4412
- var hash = md51_array(new Uint8Array(arr)), ret = hex(hash);
4413
- return raw ? hexToBinaryString(ret) : ret;
4414
- };
4415
- return SparkMD52;
4416
- }));
4417
- })(sparkMd5);
4418
- var SparkMD5 = sparkMd5.exports;
4419
- var fileSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice;
4420
- var FileChecksum = class _FileChecksum {
4421
- static create(file, callback) {
4422
- const instance = new _FileChecksum(file);
4423
- instance.create(callback);
4424
- }
4425
- constructor(file) {
4426
- this.file = file;
4427
- this.chunkSize = 2097152;
4428
- this.chunkCount = Math.ceil(this.file.size / this.chunkSize);
4429
- this.chunkIndex = 0;
4430
- }
4431
- create(callback) {
4432
- this.callback = callback;
4433
- this.md5Buffer = new SparkMD5.ArrayBuffer();
4434
- this.fileReader = new FileReader();
4435
- this.fileReader.addEventListener("load", ((event) => this.fileReaderDidLoad(event)));
4436
- this.fileReader.addEventListener("error", ((event) => this.fileReaderDidError(event)));
4437
- this.readNextChunk();
4438
- }
4439
- fileReaderDidLoad(event) {
4440
- this.md5Buffer.append(event.target.result);
4441
- if (!this.readNextChunk()) {
4442
- const binaryDigest = this.md5Buffer.end(true);
4443
- const base64digest = btoa(binaryDigest);
4444
- this.callback(null, base64digest);
4445
- }
4446
- }
4447
- fileReaderDidError(event) {
4166
+ })(), c5.prototype.append = function(t2) {
4167
+ return this.appendBinary(a3(t2)), this;
4168
+ }, c5.prototype.appendBinary = function(t2) {
4169
+ this._buff += t2, this._length += t2.length;
4170
+ var s2, r3 = this._buff.length;
4171
+ for (s2 = 64; s2 <= r3; s2 += 64) e2(this._hash, i2(this._buff.substring(s2 - 64, s2)));
4172
+ return this._buff = this._buff.substring(s2 - 64), this;
4173
+ }, c5.prototype.end = function(t2) {
4174
+ var e3, i3, s2 = this._buff, r3 = s2.length, n4 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
4175
+ for (e3 = 0; e3 < r3; e3 += 1) n4[e3 >> 2] |= s2.charCodeAt(e3) << (e3 % 4 << 3);
4176
+ return this._finish(n4, r3), i3 = o3(this._hash), t2 && (i3 = h3(i3)), this.reset(), i3;
4177
+ }, c5.prototype.reset = function() {
4178
+ return this._buff = "", this._length = 0, this._hash = [1732584193, -271733879, -1732584194, 271733878], this;
4179
+ }, c5.prototype.getState = function() {
4180
+ return { buff: this._buff, length: this._length, hash: this._hash.slice() };
4181
+ }, c5.prototype.setState = function(t2) {
4182
+ return this._buff = t2.buff, this._length = t2.length, this._hash = t2.hash, this;
4183
+ }, c5.prototype.destroy = function() {
4184
+ delete this._hash, delete this._buff, delete this._length;
4185
+ }, c5.prototype._finish = function(t2, i3) {
4186
+ var s2, r3, n4, o4 = i3;
4187
+ if (t2[o4 >> 2] |= 128 << (o4 % 4 << 3), o4 > 55) for (e2(this._hash, t2), o4 = 0; o4 < 16; o4 += 1) t2[o4] = 0;
4188
+ s2 = (s2 = 8 * this._length).toString(16).match(/(.*?)(.{0,8})$/), r3 = parseInt(s2[2], 16), n4 = parseInt(s2[1], 16) || 0, t2[14] = r3, t2[15] = n4, e2(this._hash, t2);
4189
+ }, c5.hash = function(t2, e3) {
4190
+ return c5.hashBinary(a3(t2), e3);
4191
+ }, c5.hashBinary = function(t2, e3) {
4192
+ var i3 = o3(r2(t2));
4193
+ return e3 ? h3(i3) : i3;
4194
+ }, (c5.ArrayBuffer = function() {
4195
+ this.reset();
4196
+ }).prototype.append = function(t2) {
4197
+ var i3, r3, n4, o4, a4 = (r3 = this._buff.buffer, n4 = t2, (o4 = new Uint8Array(r3.byteLength + n4.byteLength)).set(new Uint8Array(r3)), o4.set(new Uint8Array(n4), r3.byteLength), o4), h4 = a4.length;
4198
+ for (this._length += t2.byteLength, i3 = 64; i3 <= h4; i3 += 64) e2(this._hash, s(a4.subarray(i3 - 64, i3)));
4199
+ return this._buff = i3 - 64 < h4 ? new Uint8Array(a4.buffer.slice(i3 - 64)) : new Uint8Array(0), this;
4200
+ }, c5.ArrayBuffer.prototype.end = function(t2) {
4201
+ var e3, i3, s2 = this._buff, r3 = s2.length, n4 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
4202
+ for (e3 = 0; e3 < r3; e3 += 1) n4[e3 >> 2] |= s2[e3] << (e3 % 4 << 3);
4203
+ return this._finish(n4, r3), i3 = o3(this._hash), t2 && (i3 = h3(i3)), this.reset(), i3;
4204
+ }, c5.ArrayBuffer.prototype.reset = function() {
4205
+ return this._buff = new Uint8Array(0), this._length = 0, this._hash = [1732584193, -271733879, -1732584194, 271733878], this;
4206
+ }, c5.ArrayBuffer.prototype.getState = function() {
4207
+ var t2 = c5.prototype.getState.call(this);
4208
+ return t2.buff = String.fromCharCode.apply(null, new Uint8Array(t2.buff)), t2;
4209
+ }, c5.ArrayBuffer.prototype.setState = function(t2) {
4210
+ return t2.buff = (function(t3, e3) {
4211
+ var i3, s2 = t3.length, r3 = new ArrayBuffer(s2), n4 = new Uint8Array(r3);
4212
+ for (i3 = 0; i3 < s2; i3 += 1) n4[i3] = t3.charCodeAt(i3);
4213
+ return e3 ? n4 : r3;
4214
+ })(t2.buff, true), c5.prototype.setState.call(this, t2);
4215
+ }, c5.ArrayBuffer.prototype.destroy = c5.prototype.destroy, c5.ArrayBuffer.prototype._finish = c5.prototype._finish, c5.ArrayBuffer.hash = function(t2, i3) {
4216
+ var r3 = o3((function(t3) {
4217
+ var i4, r4, n4, o4, a4, h4, c6 = t3.length, l3 = [1732584193, -271733879, -1732584194, 271733878];
4218
+ for (i4 = 64; i4 <= c6; i4 += 64) e2(l3, s(t3.subarray(i4 - 64, i4)));
4219
+ for (r4 = (t3 = i4 - 64 < c6 ? t3.subarray(i4 - 64) : new Uint8Array(0)).length, n4 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], i4 = 0; i4 < r4; i4 += 1) n4[i4 >> 2] |= t3[i4] << (i4 % 4 << 3);
4220
+ if (n4[i4 >> 2] |= 128 << (i4 % 4 << 3), i4 > 55) for (e2(l3, n4), i4 = 0; i4 < 16; i4 += 1) n4[i4] = 0;
4221
+ return o4 = (o4 = 8 * c6).toString(16).match(/(.*?)(.{0,8})$/), a4 = parseInt(o4[2], 16), h4 = parseInt(o4[1], 16) || 0, n4[14] = a4, n4[15] = h4, e2(l3, n4), l3;
4222
+ })(new Uint8Array(t2)));
4223
+ return i3 ? h3(r3) : r3;
4224
+ }, c5;
4225
+ })();
4226
+ var h2 = a2.exports;
4227
+ var c2 = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice;
4228
+ var l = class _l {
4229
+ static create(t, e2) {
4230
+ new _l(t).create(e2);
4231
+ }
4232
+ constructor(t) {
4233
+ this.file = t, this.chunkSize = 2097152, this.chunkCount = Math.ceil(this.file.size / this.chunkSize), this.chunkIndex = 0;
4234
+ }
4235
+ create(t) {
4236
+ this.callback = t, this.md5Buffer = new h2.ArrayBuffer(), this.fileReader = new FileReader(), this.fileReader.addEventListener("load", ((t2) => this.fileReaderDidLoad(t2))), this.fileReader.addEventListener("error", ((t2) => this.fileReaderDidError(t2))), this.readNextChunk();
4237
+ }
4238
+ fileReaderDidLoad(t) {
4239
+ if (this.md5Buffer.append(t.target.result), !this.readNextChunk()) {
4240
+ const t2 = this.md5Buffer.end(true), e2 = btoa(t2);
4241
+ this.callback(null, e2);
4242
+ }
4243
+ }
4244
+ fileReaderDidError(t) {
4448
4245
  this.callback(`Error reading ${this.file.name}`);
4449
4246
  }
4450
4247
  readNextChunk() {
4451
- if (this.chunkIndex < this.chunkCount || this.chunkIndex == 0 && this.chunkCount == 0) {
4452
- const start2 = this.chunkIndex * this.chunkSize;
4453
- const end = Math.min(start2 + this.chunkSize, this.file.size);
4454
- const bytes = fileSlice.call(this.file, start2, end);
4455
- this.fileReader.readAsArrayBuffer(bytes);
4456
- this.chunkIndex++;
4457
- return true;
4458
- } else {
4459
- return false;
4248
+ if (this.chunkIndex < this.chunkCount || 0 == this.chunkIndex && 0 == this.chunkCount) {
4249
+ const t = this.chunkIndex * this.chunkSize, e2 = Math.min(t + this.chunkSize, this.file.size), i2 = c2.call(this.file, t, e2);
4250
+ return this.fileReader.readAsArrayBuffer(i2), this.chunkIndex++, true;
4460
4251
  }
4252
+ return false;
4461
4253
  }
4462
4254
  };
4463
- function getMetaValue(name) {
4464
- const element = findElement(document.head, `meta[name="${name}"]`);
4465
- if (element) {
4466
- return element.getAttribute("content");
4467
- }
4255
+ function d(t, e2) {
4256
+ return "string" == typeof t && (e2 = t, t = document), t.querySelector(e2);
4468
4257
  }
4469
- function findElements(root, selector) {
4470
- if (typeof root == "string") {
4471
- selector = root;
4472
- root = document;
4473
- }
4474
- const elements = root.querySelectorAll(selector);
4475
- return toArray(elements);
4476
- }
4477
- function findElement(root, selector) {
4478
- if (typeof root == "string") {
4479
- selector = root;
4480
- root = document;
4481
- }
4482
- return root.querySelector(selector);
4483
- }
4484
- function dispatchEvent$1(element, type, eventInit = {}) {
4485
- const { disabled } = element;
4486
- const { bubbles, cancelable, detail } = eventInit;
4487
- const event = document.createEvent("Event");
4488
- event.initEvent(type, bubbles || true, cancelable || true);
4489
- event.detail = detail || {};
4258
+ function u(t, e2, i2 = {}) {
4259
+ const { disabled: s } = t, { bubbles: r2, cancelable: n3, detail: o3 } = i2, a3 = document.createEvent("Event");
4260
+ a3.initEvent(e2, r2 || true, n3 || true), a3.detail = o3 || {};
4490
4261
  try {
4491
- element.disabled = false;
4492
- element.dispatchEvent(event);
4262
+ t.disabled = false, t.dispatchEvent(a3);
4493
4263
  } finally {
4494
- element.disabled = disabled;
4264
+ t.disabled = s;
4495
4265
  }
4496
- return event;
4266
+ return a3;
4497
4267
  }
4498
- function toArray(value) {
4499
- if (Array.isArray(value)) {
4500
- return value;
4501
- } else if (Array.from) {
4502
- return Array.from(value);
4503
- } else {
4504
- return [].slice.call(value);
4505
- }
4268
+ function p(t) {
4269
+ return Array.isArray(t) ? t : Array.from ? Array.from(t) : [].slice.call(t);
4506
4270
  }
4507
- var BlobRecord = class {
4508
- constructor(file, checksum, url, customHeaders = {}) {
4509
- this.file = file;
4510
- this.attributes = {
4511
- filename: file.name,
4512
- content_type: file.type || "application/octet-stream",
4513
- byte_size: file.size,
4514
- checksum
4515
- };
4516
- this.xhr = new XMLHttpRequest();
4517
- this.xhr.open("POST", url, true);
4518
- this.xhr.responseType = "json";
4519
- this.xhr.setRequestHeader("Content-Type", "application/json");
4520
- this.xhr.setRequestHeader("Accept", "application/json");
4521
- this.xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
4522
- Object.keys(customHeaders).forEach(((headerKey) => {
4523
- this.xhr.setRequestHeader(headerKey, customHeaders[headerKey]);
4271
+ var f = class {
4272
+ constructor(t, e2, i2, s = {}) {
4273
+ this.file = t, this.attributes = { filename: t.name, content_type: t.type || "application/octet-stream", byte_size: t.size, checksum: e2 }, this.xhr = new XMLHttpRequest(), this.xhr.open("POST", i2, true), this.xhr.responseType = "json", this.xhr.setRequestHeader("Content-Type", "application/json"), this.xhr.setRequestHeader("Accept", "application/json"), this.xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"), Object.keys(s).forEach(((t2) => {
4274
+ this.xhr.setRequestHeader(t2, s[t2]);
4524
4275
  }));
4525
- const csrfToken = getMetaValue("csrf-token");
4526
- if (csrfToken != void 0) {
4527
- this.xhr.setRequestHeader("X-CSRF-Token", csrfToken);
4528
- }
4529
- this.xhr.addEventListener("load", ((event) => this.requestDidLoad(event)));
4530
- this.xhr.addEventListener("error", ((event) => this.requestDidError(event)));
4276
+ const r2 = (function() {
4277
+ const t2 = d(document.head, 'meta[name="csrf-token"]');
4278
+ if (t2) return t2.getAttribute("content");
4279
+ })();
4280
+ null != r2 && this.xhr.setRequestHeader("X-CSRF-Token", r2), this.xhr.addEventListener("load", ((t2) => this.requestDidLoad(t2))), this.xhr.addEventListener("error", ((t2) => this.requestDidError(t2)));
4531
4281
  }
4532
4282
  get status() {
4533
4283
  return this.xhr.status;
4534
4284
  }
4535
4285
  get response() {
4536
- const { responseType, response } = this.xhr;
4537
- if (responseType == "json") {
4538
- return response;
4539
- } else {
4540
- return JSON.parse(response);
4541
- }
4286
+ const { responseType: t, response: e2 } = this.xhr;
4287
+ return "json" == t ? e2 : JSON.parse(e2);
4542
4288
  }
4543
- create(callback) {
4544
- this.callback = callback;
4545
- this.xhr.send(JSON.stringify({
4546
- blob: this.attributes
4547
- }));
4289
+ create(t) {
4290
+ this.callback = t, this.xhr.send(JSON.stringify({ blob: this.attributes }));
4548
4291
  }
4549
- requestDidLoad(event) {
4292
+ requestDidLoad(t) {
4550
4293
  if (this.status >= 200 && this.status < 300) {
4551
- const { response } = this;
4552
- const { direct_upload } = response;
4553
- delete response.direct_upload;
4554
- this.attributes = response;
4555
- this.directUploadData = direct_upload;
4556
- this.callback(null, this.toJSON());
4557
- } else {
4558
- this.requestDidError(event);
4559
- }
4294
+ const { response: t2 } = this, { direct_upload: e2 } = t2;
4295
+ delete t2.direct_upload, this.attributes = t2, this.directUploadData = e2, this.callback(null, this.toJSON());
4296
+ } else this.requestDidError(t);
4560
4297
  }
4561
- requestDidError(event) {
4298
+ requestDidError(t) {
4562
4299
  this.callback(`Error creating Blob for "${this.file.name}". Status: ${this.status}`);
4563
4300
  }
4564
4301
  toJSON() {
4565
- const result = {};
4566
- for (const key in this.attributes) {
4567
- result[key] = this.attributes[key];
4568
- }
4569
- return result;
4570
- }
4571
- };
4572
- var BlobUpload = class {
4573
- constructor(blob) {
4574
- this.blob = blob;
4575
- this.file = blob.file;
4576
- const { url, headers } = blob.directUploadData;
4577
- this.xhr = new XMLHttpRequest();
4578
- this.xhr.open("PUT", url, true);
4579
- this.xhr.responseType = "text";
4580
- for (const key in headers) {
4581
- this.xhr.setRequestHeader(key, headers[key]);
4582
- }
4583
- this.xhr.addEventListener("load", ((event) => this.requestDidLoad(event)));
4584
- this.xhr.addEventListener("error", ((event) => this.requestDidError(event)));
4585
- }
4586
- create(callback) {
4587
- this.callback = callback;
4588
- this.xhr.send(this.file.slice());
4589
- }
4590
- requestDidLoad(event) {
4591
- const { status, response } = this.xhr;
4592
- if (status >= 200 && status < 300) {
4593
- this.callback(null, response);
4594
- } else {
4595
- this.requestDidError(event);
4596
- }
4302
+ const t = {};
4303
+ for (const e2 in this.attributes) t[e2] = this.attributes[e2];
4304
+ return t;
4305
+ }
4306
+ };
4307
+ var m = class {
4308
+ constructor(t) {
4309
+ this.blob = t, this.file = t.file;
4310
+ const { url: e2, headers: i2 } = t.directUploadData;
4311
+ this.xhr = new XMLHttpRequest(), this.xhr.open("PUT", e2, true), this.xhr.responseType = "text";
4312
+ for (const t2 in i2) this.xhr.setRequestHeader(t2, i2[t2]);
4313
+ this.xhr.addEventListener("load", ((t2) => this.requestDidLoad(t2))), this.xhr.addEventListener("error", ((t2) => this.requestDidError(t2)));
4597
4314
  }
4598
- requestDidError(event) {
4315
+ create(t) {
4316
+ this.callback = t, this.xhr.send(this.file.slice());
4317
+ }
4318
+ requestDidLoad(t) {
4319
+ const { status: e2, response: i2 } = this.xhr;
4320
+ e2 >= 200 && e2 < 300 ? this.callback(null, i2) : this.requestDidError(t);
4321
+ }
4322
+ requestDidError(t) {
4599
4323
  this.callback(`Error storing "${this.file.name}". Status: ${this.xhr.status}`);
4600
4324
  }
4601
4325
  };
4602
- var id = 0;
4603
- var DirectUpload = class {
4604
- constructor(file, url, delegate, customHeaders = {}) {
4605
- this.id = ++id;
4606
- this.file = file;
4607
- this.url = url;
4608
- this.delegate = delegate;
4609
- this.customHeaders = customHeaders;
4610
- }
4611
- create(callback) {
4612
- FileChecksum.create(this.file, ((error, checksum) => {
4613
- if (error) {
4614
- callback(error);
4615
- return;
4616
- }
4617
- const blob = new BlobRecord(this.file, checksum, this.url, this.customHeaders);
4618
- notify(this.delegate, "directUploadWillCreateBlobWithXHR", blob.xhr);
4619
- blob.create(((error2) => {
4620
- if (error2) {
4621
- callback(error2);
4622
- } else {
4623
- const upload = new BlobUpload(blob);
4624
- notify(this.delegate, "directUploadWillStoreFileWithXHR", upload.xhr);
4625
- upload.create(((error3) => {
4626
- if (error3) {
4627
- callback(error3);
4628
- } else {
4629
- callback(null, blob.toJSON());
4630
- }
4326
+ var g = 0;
4327
+ var b = class {
4328
+ constructor(t, e2, i2, s = {}) {
4329
+ this.id = ++g, this.file = t, this.url = e2, this.delegate = i2, this.customHeaders = s;
4330
+ }
4331
+ create(t) {
4332
+ l.create(this.file, ((e2, i2) => {
4333
+ if (e2) return void t(e2);
4334
+ const s = new f(this.file, i2, this.url, this.customHeaders);
4335
+ v(this.delegate, "directUploadWillCreateBlobWithXHR", s.xhr), s.create(((e3) => {
4336
+ if (e3) t(e3);
4337
+ else {
4338
+ const e4 = new m(s);
4339
+ v(this.delegate, "directUploadWillStoreFileWithXHR", e4.xhr), e4.create(((e5) => {
4340
+ e5 ? t(e5) : t(null, s.toJSON());
4631
4341
  }));
4632
4342
  }
4633
4343
  }));
4634
4344
  }));
4635
4345
  }
4636
4346
  };
4637
- function notify(object, methodName, ...messages) {
4638
- if (object && typeof object[methodName] == "function") {
4639
- return object[methodName](...messages);
4640
- }
4347
+ function v(t, e2, ...i2) {
4348
+ if (t && "function" == typeof t[e2]) return t[e2](...i2);
4641
4349
  }
4642
- var DirectUploadController$1 = class DirectUploadController {
4643
- constructor(input, file) {
4644
- this.input = input;
4645
- this.file = file;
4646
- this.directUpload = new DirectUpload(this.file, this.url, this);
4647
- this.dispatch("initialize");
4648
- }
4649
- start(callback) {
4650
- const hiddenInput = document.createElement("input");
4651
- hiddenInput.type = "hidden";
4652
- hiddenInput.name = this.input.name;
4653
- this.input.insertAdjacentElement("beforebegin", hiddenInput);
4654
- this.dispatch("start");
4655
- this.directUpload.create(((error, attributes) => {
4656
- if (error) {
4657
- hiddenInput.parentNode.removeChild(hiddenInput);
4658
- this.dispatchError(error);
4659
- } else {
4660
- hiddenInput.value = attributes.signed_id;
4661
- }
4662
- this.dispatch("end");
4663
- callback(error);
4350
+ var w = class {
4351
+ constructor(t, e2) {
4352
+ this.input = t, this.file = e2, this.directUpload = new b(this.file, this.url, this), this.dispatch("initialize");
4353
+ }
4354
+ start(t) {
4355
+ const e2 = document.createElement("input");
4356
+ e2.type = "hidden", e2.name = this.input.name, this.input.insertAdjacentElement("beforebegin", e2), this.dispatch("start"), this.directUpload.create(((i2, s) => {
4357
+ i2 ? (e2.parentNode.removeChild(e2), this.dispatchError(i2)) : e2.value = s.signed_id, this.dispatch("end"), t(i2);
4664
4358
  }));
4665
4359
  }
4666
- uploadRequestDidProgress(event) {
4667
- const progress = event.loaded / event.total * 90;
4668
- if (progress) {
4669
- this.dispatch("progress", {
4670
- progress
4671
- });
4672
- }
4360
+ uploadRequestDidProgress(t) {
4361
+ const e2 = t.loaded / t.total * 90;
4362
+ e2 && this.dispatch("progress", { progress: e2 });
4673
4363
  }
4674
4364
  get url() {
4675
4365
  return this.input.getAttribute("data-direct-upload-url");
4676
4366
  }
4677
- dispatch(name, detail = {}) {
4678
- detail.file = this.file;
4679
- detail.id = this.directUpload.id;
4680
- return dispatchEvent$1(this.input, `direct-upload:${name}`, {
4681
- detail
4682
- });
4367
+ dispatch(t, e2 = {}) {
4368
+ return e2.file = this.file, e2.id = this.directUpload.id, u(this.input, `direct-upload:${t}`, { detail: e2 });
4683
4369
  }
4684
- dispatchError(error) {
4685
- const event = this.dispatch("error", {
4686
- error
4687
- });
4688
- if (!event.defaultPrevented) {
4689
- alert(error);
4690
- }
4370
+ dispatchError(t) {
4371
+ this.dispatch("error", { error: t }).defaultPrevented || alert(t);
4691
4372
  }
4692
- directUploadWillCreateBlobWithXHR(xhr) {
4693
- this.dispatch("before-blob-request", {
4694
- xhr
4695
- });
4373
+ directUploadWillCreateBlobWithXHR(t) {
4374
+ this.dispatch("before-blob-request", { xhr: t });
4696
4375
  }
4697
- directUploadWillStoreFileWithXHR(xhr) {
4698
- this.dispatch("before-storage-request", {
4699
- xhr
4700
- });
4701
- xhr.upload.addEventListener("progress", ((event) => this.uploadRequestDidProgress(event)));
4702
- xhr.upload.addEventListener("loadend", (() => {
4703
- this.simulateResponseProgress(xhr);
4376
+ directUploadWillStoreFileWithXHR(t) {
4377
+ this.dispatch("before-storage-request", { xhr: t }), t.upload.addEventListener("progress", ((t2) => this.uploadRequestDidProgress(t2))), t.upload.addEventListener("loadend", (() => {
4378
+ this.simulateResponseProgress(t);
4704
4379
  }));
4705
4380
  }
4706
- simulateResponseProgress(xhr) {
4707
- let progress = 90;
4708
- const startTime = Date.now();
4709
- const updateProgress = () => {
4710
- const elapsed = Date.now() - startTime;
4711
- const estimatedResponseTime = this.estimateResponseTime();
4712
- const responseProgress = Math.min(elapsed / estimatedResponseTime, 1);
4713
- progress = 90 + responseProgress * 9;
4714
- this.dispatch("progress", {
4715
- progress
4716
- });
4717
- if (xhr.readyState !== XMLHttpRequest.DONE && progress < 99) {
4718
- requestAnimationFrame(updateProgress);
4719
- }
4381
+ simulateResponseProgress(t) {
4382
+ let e2 = 90;
4383
+ const i2 = Date.now(), s = () => {
4384
+ const r2 = Date.now() - i2, n3 = this.estimateResponseTime(), o3 = Math.min(r2 / n3, 1);
4385
+ e2 = 90 + 9 * o3, this.dispatch("progress", { progress: e2 }), t.readyState !== XMLHttpRequest.DONE && e2 < 99 && requestAnimationFrame(s);
4720
4386
  };
4721
- xhr.addEventListener("loadend", (() => {
4722
- this.dispatch("progress", {
4723
- progress: 100
4724
- });
4725
- }));
4726
- requestAnimationFrame(updateProgress);
4387
+ t.addEventListener("loadend", (() => {
4388
+ this.dispatch("progress", { progress: 100 });
4389
+ })), requestAnimationFrame(s);
4727
4390
  }
4728
4391
  estimateResponseTime() {
4729
- const fileSize = this.file.size;
4730
- const MB = 1024 * 1024;
4731
- if (fileSize < MB) {
4732
- return 1e3;
4733
- } else if (fileSize < 10 * MB) {
4734
- return 2e3;
4735
- } else {
4736
- return 3e3 + fileSize / MB * 50;
4737
- }
4392
+ const t = this.file.size, e2 = 1048576;
4393
+ return t < e2 ? 1e3 : t < 10 * e2 ? 2e3 : 3e3 + t / e2 * 50;
4738
4394
  }
4739
4395
  };
4740
- var inputSelector = "input[type=file][data-direct-upload-url]:not([disabled])";
4741
- var DirectUploadsController = class {
4742
- constructor(form) {
4743
- this.form = form;
4744
- this.inputs = findElements(form, inputSelector).filter(((input) => input.files.length));
4396
+ var y = class {
4397
+ constructor(t) {
4398
+ var e2, i2;
4399
+ this.form = t, this.inputs = (e2 = t, i2 = "input[type=file][data-direct-upload-url]:not([disabled])", "string" == typeof e2 && (i2 = e2, e2 = document), p(e2.querySelectorAll(i2))).filter(((t2) => t2.files.length));
4745
4400
  }
4746
- start(callback) {
4747
- const controllers = this.createDirectUploadControllers();
4748
- const startNextController = () => {
4749
- const controller = controllers.shift();
4750
- if (controller) {
4751
- controller.start(((error) => {
4752
- if (error) {
4753
- callback(error);
4754
- this.dispatch("end");
4755
- } else {
4756
- startNextController();
4757
- }
4758
- }));
4759
- } else {
4760
- callback();
4761
- this.dispatch("end");
4762
- }
4401
+ start(t) {
4402
+ const e2 = this.createDirectUploadControllers(), i2 = () => {
4403
+ const s = e2.shift();
4404
+ s ? s.start(((e3) => {
4405
+ e3 ? (t(e3), this.dispatch("end")) : i2();
4406
+ })) : (t(), this.dispatch("end"));
4763
4407
  };
4764
- this.dispatch("start");
4765
- startNextController();
4408
+ this.dispatch("start"), i2();
4766
4409
  }
4767
4410
  createDirectUploadControllers() {
4768
- const controllers = [];
4769
- this.inputs.forEach(((input) => {
4770
- toArray(input.files).forEach(((file) => {
4771
- const controller = new DirectUploadController$1(input, file);
4772
- controllers.push(controller);
4411
+ const t = [];
4412
+ return this.inputs.forEach(((e2) => {
4413
+ p(e2.files).forEach(((i2) => {
4414
+ const s = new w(e2, i2);
4415
+ t.push(s);
4773
4416
  }));
4774
- }));
4775
- return controllers;
4417
+ })), t;
4776
4418
  }
4777
- dispatch(name, detail = {}) {
4778
- return dispatchEvent$1(this.form, `direct-uploads:${name}`, {
4779
- detail
4780
- });
4419
+ dispatch(t, e2 = {}) {
4420
+ return u(this.form, `direct-uploads:${t}`, { detail: e2 });
4781
4421
  }
4782
4422
  };
4783
- var processingAttribute = "data-direct-uploads-processing";
4784
- var submitButtonsByForm = /* @__PURE__ */ new WeakMap();
4785
- var started = false;
4786
- function start() {
4787
- if (!started) {
4788
- started = true;
4789
- document.addEventListener("click", didClick, true);
4790
- document.addEventListener("submit", didSubmitForm, true);
4791
- document.addEventListener("ajax:before", didSubmitRemoteElement);
4792
- }
4423
+ var x = "data-direct-uploads-processing";
4424
+ var k = /* @__PURE__ */ new WeakMap();
4425
+ var R = false;
4426
+ function M(t) {
4427
+ const e2 = t.target.closest("button, input");
4428
+ e2 && "submit" === e2.type && e2.form && k.set(e2.form, e2);
4793
4429
  }
4794
- function didClick(event) {
4795
- const button = event.target.closest("button, input");
4796
- if (button && button.type === "submit" && button.form) {
4797
- submitButtonsByForm.set(button.form, button);
4798
- }
4430
+ function j(t) {
4431
+ $(t);
4799
4432
  }
4800
- function didSubmitForm(event) {
4801
- handleFormSubmissionEvent(event);
4433
+ function A(t) {
4434
+ "FORM" == t.target.tagName && $(t);
4802
4435
  }
4803
- function didSubmitRemoteElement(event) {
4804
- if (event.target.tagName == "FORM") {
4805
- handleFormSubmissionEvent(event);
4806
- }
4436
+ function $(t) {
4437
+ const e2 = t.target;
4438
+ if (e2.hasAttribute(x)) return void t.preventDefault();
4439
+ const i2 = new y(e2), { inputs: s } = i2;
4440
+ s.length && (t.preventDefault(), e2.setAttribute(x, ""), s.forEach(E), i2.start(((t2) => {
4441
+ e2.removeAttribute(x), t2 ? s.forEach(U) : (function(t3) {
4442
+ let e3 = k.get(t3) || d(t3, "input[type=submit], button[type=submit]");
4443
+ if (e3) {
4444
+ const { disabled: t4 } = e3;
4445
+ e3.disabled = false, e3.focus(), e3.click(), e3.disabled = t4;
4446
+ } else e3 = document.createElement("input"), e3.type = "submit", e3.style.display = "none", t3.appendChild(e3), e3.click(), t3.removeChild(e3);
4447
+ k.delete(t3);
4448
+ })(e2);
4449
+ })));
4807
4450
  }
4808
- function handleFormSubmissionEvent(event) {
4809
- const form = event.target;
4810
- if (form.hasAttribute(processingAttribute)) {
4811
- event.preventDefault();
4812
- return;
4813
- }
4814
- const controller = new DirectUploadsController(form);
4815
- const { inputs } = controller;
4816
- if (inputs.length) {
4817
- event.preventDefault();
4818
- form.setAttribute(processingAttribute, "");
4819
- inputs.forEach(disable);
4820
- controller.start(((error) => {
4821
- form.removeAttribute(processingAttribute);
4822
- if (error) {
4823
- inputs.forEach(enable);
4824
- } else {
4825
- submitForm(form);
4826
- }
4827
- }));
4828
- }
4451
+ function E(t) {
4452
+ t.disabled = true;
4829
4453
  }
4830
- function submitForm(form) {
4831
- let button = submitButtonsByForm.get(form) || findElement(form, "input[type=submit], button[type=submit]");
4832
- if (button) {
4833
- const { disabled } = button;
4834
- button.disabled = false;
4835
- button.focus();
4836
- button.click();
4837
- button.disabled = disabled;
4838
- } else {
4839
- button = document.createElement("input");
4840
- button.type = "submit";
4841
- button.style.display = "none";
4842
- form.appendChild(button);
4843
- button.click();
4844
- form.removeChild(button);
4845
- }
4846
- submitButtonsByForm.delete(form);
4847
- }
4848
- function disable(input) {
4849
- input.disabled = true;
4454
+ function U(t) {
4455
+ t.disabled = false;
4850
4456
  }
4851
- function enable(input) {
4852
- input.disabled = false;
4853
- }
4854
- function autostart() {
4855
- if (window.ActiveStorage) {
4856
- start();
4857
- }
4858
- }
4859
- setTimeout(autostart, 1);
4860
- var DirectUploadController2 = class {
4457
+ setTimeout((function() {
4458
+ window.ActiveStorage && (R || (R = true, document.addEventListener("click", M, true), document.addEventListener("submit", j, true), document.addEventListener("ajax:before", A)));
4459
+ }), 1);
4460
+ var C = class {
4861
4461
  uploadedFile;
4862
4462
  file;
4863
4463
  directUpload;
@@ -4866,179 +4466,95 @@ var DirectUploadController2 = class {
4866
4466
  callback = null;
4867
4467
  cancelled = false;
4868
4468
  completed = false;
4869
- constructor(uploadedFile, file) {
4870
- this.uploadedFile = uploadedFile;
4871
- this.file = file;
4872
- this.directUpload = new DirectUpload(this.file, this.uploadedFile.url, this);
4469
+ constructor(t, e2) {
4470
+ this.uploadedFile = t, this.file = e2, this.directUpload = new b(this.file, this.uploadedFile.url, this);
4873
4471
  }
4874
4472
  cancel() {
4875
- this.cancelled = true;
4876
- this.abortXHR(this.recordXHR);
4877
- this.abortXHR(this.uploadXHR);
4878
- this.complete("aborted", {});
4473
+ this.cancelled = true, this.abortXHR(this.recordXHR), this.abortXHR(this.uploadXHR), this.complete("aborted", {});
4879
4474
  }
4880
- abortXHR(xhr) {
4881
- if (!xhr)
4882
- return;
4883
- xhr.abort();
4475
+ abortXHR(t) {
4476
+ t && t.abort();
4884
4477
  }
4885
- start(callback) {
4886
- this.callback = callback;
4887
- this.dispatch("start");
4888
- this.directUpload.create((error, attributes) => {
4889
- this.complete(error, attributes);
4890
- });
4478
+ start(t) {
4479
+ this.callback = t, this.dispatch("start"), this.directUpload.create(((t2, e2) => {
4480
+ this.complete(t2, e2);
4481
+ }));
4891
4482
  }
4892
- complete(error, _attributes) {
4893
- if (this.completed)
4894
- return;
4895
- this.completed = true;
4896
- if (error) {
4897
- this.dispatchError(error);
4898
- }
4899
- this.dispatch("end");
4900
- this.callback(error);
4901
- }
4902
- uploadRequestDidProgress(event) {
4903
- const progress = event.loaded / event.total * 100;
4904
- if (progress) {
4905
- this.dispatch("progress", {
4906
- progress
4907
- });
4908
- }
4483
+ complete(t, e2) {
4484
+ this.completed || (this.completed = true, t && this.dispatchError(t), this.dispatch("end"), this.callback(t));
4909
4485
  }
4910
- dispatch(name, detail = {}) {
4911
- return dispatchEvent(this.uploadedFile, `direct-upload:${name}`, {
4912
- detail: {
4913
- ...detail,
4914
- file: this.file,
4915
- id: this.directUpload.id
4486
+ uploadRequestDidProgress(t) {
4487
+ const e2 = t.loaded / t.total * 100;
4488
+ e2 && this.dispatch("progress", { progress: e2 });
4489
+ }
4490
+ dispatch(t, e2 = {}) {
4491
+ return (function(t2, e3, i2 = {}) {
4492
+ const { disabled: s } = t2, { bubbles: r2, cancelable: n3, detail: o3 } = i2, a3 = document.createEvent("Event");
4493
+ a3.initEvent(e3, r2 || true, n3 || true), a3.detail = o3 || {};
4494
+ try {
4495
+ t2.disabled = false, t2.dispatchEvent(a3);
4496
+ } finally {
4497
+ t2.disabled = s;
4916
4498
  }
4917
- });
4499
+ return a3;
4500
+ })(this.uploadedFile, `direct-upload:${t}`, { detail: { ...e2, file: this.file, id: this.directUpload.id } });
4918
4501
  }
4919
- dispatchError(error) {
4920
- this.dispatch("error", {
4921
- error
4922
- });
4502
+ dispatchError(t) {
4503
+ this.dispatch("error", { error: t });
4923
4504
  }
4924
- directUploadWillCreateBlobWithXHR(xhr) {
4925
- this.recordXHR = xhr;
4926
- if (this.cancelled) {
4927
- xhr.send = () => {
4928
- };
4929
- return;
4930
- }
4931
- this.dispatch("before-blob-request", {
4932
- xhr
4933
- });
4505
+ directUploadWillCreateBlobWithXHR(t) {
4506
+ this.recordXHR = t, this.cancelled ? t.send = () => {
4507
+ } : this.dispatch("before-blob-request", { xhr: t });
4934
4508
  }
4935
- directUploadWillStoreFileWithXHR(xhr) {
4936
- this.uploadXHR = xhr;
4937
- if (this.cancelled) {
4938
- xhr.send = () => {
4939
- };
4940
- return;
4941
- }
4942
- this.uploadedFile.value = this.recordXHR.response.signed_id;
4943
- this.dispatch("before-storage-request", {
4944
- xhr
4945
- });
4946
- xhr.upload.addEventListener("progress", ((event) => this.uploadRequestDidProgress(event)));
4509
+ directUploadWillStoreFileWithXHR(t) {
4510
+ this.uploadXHR = t, this.cancelled ? t.send = () => {
4511
+ } : (this.uploadedFile.value = this.recordXHR.response.signed_id, this.dispatch("before-storage-request", { xhr: t }), t.upload.addEventListener("progress", ((t2) => this.uploadRequestDidProgress(t2))));
4947
4512
  }
4948
4513
  };
4949
- function dispatchEvent(element, type, eventInit = {}) {
4950
- const { disabled } = element;
4951
- const { bubbles, cancelable, detail } = eventInit;
4952
- const event = document.createEvent("Event");
4953
- event.initEvent(type, bubbles || true, cancelable || true);
4954
- event.detail = detail || {};
4955
- try {
4956
- element.disabled = false;
4957
- element.dispatchEvent(event);
4958
- } finally {
4959
- element.disabled = disabled;
4960
- }
4961
- return event;
4962
- }
4963
- var Max = class {
4514
+ var q = class {
4964
4515
  uploadedFile;
4965
- constructor(uploadedFile) {
4966
- this.uploadedFile = uploadedFile;
4516
+ constructor(t) {
4517
+ this.uploadedFile = t;
4967
4518
  }
4968
4519
  get errors() {
4969
- if (this.#errors)
4970
- return this.#errors;
4971
- this.#errors = [];
4972
- if (!this.checkValidity()) {
4973
- this.#errors.push(this.errorMessage);
4974
- }
4975
- return this.#errors;
4520
+ return this.#t || (this.#t = [], this.checkValidity() || this.#t.push(this.errorMessage)), this.#t;
4976
4521
  }
4977
- #errors;
4522
+ #t;
4978
4523
  checkValidity() {
4979
- if (!this.uploadedFile.max)
4980
- return true;
4981
- return this.uploadedFile.size <= this.uploadedFile.max;
4524
+ return !this.uploadedFile.max || this.uploadedFile.size <= this.uploadedFile.max;
4982
4525
  }
4983
4526
  get errorMessage() {
4984
- return [
4985
- `Must be smaller than ${this.formatBytes(this.uploadedFile.max)},`,
4986
- `and "${this.uploadedFile.filename}" is ${this.formatBytes(this.uploadedFile.size)}.`,
4987
- `Please attach a smaller file.`
4988
- ].join(" ");
4989
- }
4990
- formatBytes(bytes, decimals = 2) {
4991
- if (bytes === 0)
4992
- return "0 Bytes";
4993
- const k = 1024;
4994
- const dm = decimals < 0 ? 0 : decimals;
4995
- const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
4996
- const i2 = Math.floor(Math.log(bytes) / Math.log(k));
4997
- return parseFloat((bytes / Math.pow(k, i2)).toFixed(dm)) + sizes[i2];
4998
- }
4999
- };
5000
- var Accepts = class {
4527
+ return [`Must be smaller than ${this.formatBytes(this.uploadedFile.max)},`, `and "${this.uploadedFile.filename}" is ${this.formatBytes(this.uploadedFile.size)}.`, "Please attach a smaller file."].join(" ");
4528
+ }
4529
+ formatBytes(t, e2 = 2) {
4530
+ if (0 === t) return "0 Bytes";
4531
+ const i2 = e2 < 0 ? 0 : e2, s = Math.floor(Math.log(t) / Math.log(1024));
4532
+ return parseFloat((t / Math.pow(1024, s)).toFixed(i2)) + ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"][s];
4533
+ }
4534
+ };
4535
+ var B = class {
5001
4536
  uploadedFile;
5002
- constructor(uploadedFile) {
5003
- this.uploadedFile = uploadedFile;
4537
+ constructor(t) {
4538
+ this.uploadedFile = t;
5004
4539
  }
5005
4540
  get errors() {
5006
- if (this.#errors)
5007
- return this.#errors;
5008
- this.#errors = [];
5009
- const accepts = this.uploadedFile.accepts ? this.uploadedFile.accepts.split(/,\s*/) : [];
5010
- if (accepts.length > 0 && !accepts.includes(this.uploadedFile.filetype)) {
5011
- this.#errors.push(`Must be a ${this.joinWords(accepts)}.`);
5012
- }
5013
- return this.#errors;
5014
- }
5015
- #errors;
5016
- joinWords(words) {
5017
- if (words.length >= 3) {
5018
- return (words.slice(0, -1) + [`or ${words.at(-1)}`]).join(", ");
5019
- } else {
5020
- return words.join(" or ");
5021
- }
4541
+ if (this.#t) return this.#t;
4542
+ this.#t = [];
4543
+ const t = this.uploadedFile.accepts ? this.uploadedFile.accepts.split(/,\s*/) : [];
4544
+ return t.length > 0 && !t.includes(this.uploadedFile.filetype) && this.#t.push(`Must be a ${this.joinWords(t)}.`), this.#t;
5022
4545
  }
5023
- };
5024
- var Extensions = {
5025
- image: ["ase", "art", "bmp", "blp", "cd5", "cit", "cpt", "cr2", "cut", "dds", "dib", "djvu", "egt", "exif", "gif", "gpl", "grf", "icns", "ico", "iff", "jng", "jpeg", "jpg", "jfif", "jp2", "jps", "lbm", "max", "miff", "mng", "msp", "nef", "nitf", "ota", "pbm", "pc1", "pc2", "pc3", "pcf", "pcx", "pdn", "pgm", "PI1", "PI2", "PI3", "pict", "pct", "pnm", "pns", "ppm", "psb", "psd", "pdd", "psp", "px", "pxm", "pxr", "qfx", "raw", "rle", "sct", "sgi", "rgb", "int", "bw", "tga", "tiff", "tif", "vtf", "xbm", "xcf", "xpm", "3dv", "amf", "ai", "awg", "cgm", "cdr", "cmx", "dxf", "e2d", "egt", "eps", "fs", "gbr", "odg", "svg", "stl", "vrml", "x3d", "sxd", "v2d", "vnd", "wmf", "emf", "art", "xar", "png", "webp", "jxr", "hdp", "wdp", "cur", "ecw", "iff", "lbm", "liff", "nrrd", "pam", "pcx", "pgf", "sgi", "rgb", "rgba", "bw", "int", "inta", "sid", "ras", "sun", "tga", "heic", "heif"],
5026
- video: ["3g2", "3gp", "3gpp", "aaf", "asf", "avchd", "avi", "drc", "flv", "m2v", "m3u8", "m4p", "m4v", "mkv", "mng", "mov", "mp2", "mp4", "mpe", "mpeg", "mpg", "mpv", "mxf", "nsv", "ogg", "ogv", "qt", "rm", "rmvb", "roq", "svi", "vob", "webm", "wmv", "yuv"],
5027
- pdf: ["pdf"],
5028
- getFileType: function(filename) {
5029
- const normalized = filename.toString().split(".").at(-1).toLowerCase().trim();
5030
- if (this.video.includes(normalized))
5031
- return "video";
5032
- if (this.image.includes(normalized))
5033
- return "image";
5034
- if (this.pdf.includes(normalized))
5035
- return "pdf";
5036
- return "unknown";
4546
+ #t;
4547
+ joinWords(t) {
4548
+ return t.length >= 3 ? (t.slice(0, -1) + [`or ${t.at(-1)}`]).join(", ") : t.join(" or ");
5037
4549
  }
5038
4550
  };
5039
- var FetchResponse = class {
5040
- constructor(response) {
5041
- this.response = response;
4551
+ var F = { image: ["ase", "art", "bmp", "blp", "cd5", "cit", "cpt", "cr2", "cut", "dds", "dib", "djvu", "egt", "exif", "gif", "gpl", "grf", "icns", "ico", "iff", "jng", "jpeg", "jpg", "jfif", "jp2", "jps", "lbm", "max", "miff", "mng", "msp", "nef", "nitf", "ota", "pbm", "pc1", "pc2", "pc3", "pcf", "pcx", "pdn", "pgm", "PI1", "PI2", "PI3", "pict", "pct", "pnm", "pns", "ppm", "psb", "psd", "pdd", "psp", "px", "pxm", "pxr", "qfx", "raw", "rle", "sct", "sgi", "rgb", "int", "bw", "tga", "tiff", "tif", "vtf", "xbm", "xcf", "xpm", "3dv", "amf", "ai", "awg", "cgm", "cdr", "cmx", "dxf", "e2d", "egt", "eps", "fs", "gbr", "odg", "svg", "stl", "vrml", "x3d", "sxd", "v2d", "vnd", "wmf", "emf", "art", "xar", "png", "webp", "jxr", "hdp", "wdp", "cur", "ecw", "iff", "lbm", "liff", "nrrd", "pam", "pcx", "pgf", "sgi", "rgb", "rgba", "bw", "int", "inta", "sid", "ras", "sun", "tga", "heic", "heif"], video: ["3g2", "3gp", "3gpp", "aaf", "asf", "avchd", "avi", "drc", "flv", "m2v", "m3u8", "m4p", "m4v", "mkv", "mng", "mov", "mp2", "mp4", "mpe", "mpeg", "mpg", "mpv", "mxf", "nsv", "ogg", "ogv", "qt", "rm", "rmvb", "roq", "svi", "vob", "webm", "wmv", "yuv"], pdf: ["pdf"], getFileType: function(t) {
4552
+ const e2 = t.toString().split(".").at(-1).toLowerCase().trim();
4553
+ return this.video.includes(e2) ? "video" : this.image.includes(e2) ? "image" : this.pdf.includes(e2) ? "pdf" : "unknown";
4554
+ } };
4555
+ var S = class {
4556
+ constructor(t) {
4557
+ this.response = t;
5042
4558
  }
5043
4559
  get statusCode() {
5044
4560
  return this.response.status;
@@ -5050,32 +4566,25 @@ var FetchResponse = class {
5050
4566
  return this.response.ok;
5051
4567
  }
5052
4568
  get unauthenticated() {
5053
- return this.statusCode === 401;
4569
+ return 401 === this.statusCode;
5054
4570
  }
5055
4571
  get unprocessableEntity() {
5056
- return this.statusCode === 422;
4572
+ return 422 === this.statusCode;
5057
4573
  }
5058
4574
  get authenticationURL() {
5059
4575
  return this.response.headers.get("WWW-Authenticate");
5060
4576
  }
5061
4577
  get contentType() {
5062
- const contentType = this.response.headers.get("Content-Type") || "";
5063
- return contentType.replace(/;.*$/, "");
4578
+ return (this.response.headers.get("Content-Type") || "").replace(/;.*$/, "");
5064
4579
  }
5065
4580
  get headers() {
5066
4581
  return this.response.headers;
5067
4582
  }
5068
4583
  get html() {
5069
- if (this.contentType.match(/^(application|text)\/(html|xhtml\+xml)$/)) {
5070
- return this.text;
5071
- }
5072
- return Promise.reject(new Error(`Expected an HTML response but got "${this.contentType}" instead`));
4584
+ return this.contentType.match(/^(application|text)\/(html|xhtml\+xml)$/) ? this.text : Promise.reject(new Error(`Expected an HTML response but got "${this.contentType}" instead`));
5073
4585
  }
5074
4586
  get json() {
5075
- if (this.contentType.match(/^application\/.*json$/)) {
5076
- return this.responseJson || (this.responseJson = this.response.json());
5077
- }
5078
- return Promise.reject(new Error(`Expected a JSON response but got "${this.contentType}" instead`));
4587
+ return this.contentType.match(/^application\/.*json$/) ? this.responseJson || (this.responseJson = this.response.json()) : Promise.reject(new Error(`Expected a JSON response but got "${this.contentType}" instead`));
5079
4588
  }
5080
4589
  get text() {
5081
4590
  return this.responseText || (this.responseText = this.response.text());
@@ -5084,20 +4593,13 @@ var FetchResponse = class {
5084
4593
  return this.contentType.match(/^text\/vnd\.turbo-stream\.html/);
5085
4594
  }
5086
4595
  async renderTurboStream() {
5087
- if (this.isTurboStream) {
5088
- if (window.Turbo) {
5089
- await window.Turbo.renderStreamMessage(await this.text);
5090
- } else {
5091
- console.warn("You must set `window.Turbo = Turbo` to automatically process Turbo Stream events with request.js");
5092
- }
5093
- } else {
5094
- return Promise.reject(new Error(`Expected a Turbo Stream response but got "${this.contentType}" instead`));
5095
- }
4596
+ if (!this.isTurboStream) return Promise.reject(new Error(`Expected a Turbo Stream response but got "${this.contentType}" instead`));
4597
+ window.Turbo ? await window.Turbo.renderStreamMessage(await this.text) : console.warn("You must set `window.Turbo = Turbo` to automatically process Turbo Stream events with request.js");
5096
4598
  }
5097
4599
  };
5098
- var RequestInterceptor = class {
5099
- static register(interceptor) {
5100
- this.interceptor = interceptor;
4600
+ var T = class {
4601
+ static register(t) {
4602
+ this.interceptor = t;
5101
4603
  }
5102
4604
  static get() {
5103
4605
  return this.interceptor;
@@ -5106,111 +4608,52 @@ var RequestInterceptor = class {
5106
4608
  this.interceptor = void 0;
5107
4609
  }
5108
4610
  };
5109
- function getCookie(name) {
5110
- const cookies = document.cookie ? document.cookie.split("; ") : [];
5111
- const prefix = `${encodeURIComponent(name)}=`;
5112
- const cookie = cookies.find((cookie2) => cookie2.startsWith(prefix));
5113
- if (cookie) {
5114
- const value = cookie.split("=").slice(1).join("=");
5115
- if (value) {
5116
- return decodeURIComponent(value);
5117
- }
5118
- }
5119
- }
5120
- function compact(object) {
5121
- const result = {};
5122
- for (const key in object) {
5123
- const value = object[key];
5124
- if (value !== void 0) {
5125
- result[key] = value;
5126
- }
5127
- }
5128
- return result;
5129
- }
5130
- function metaContent(name) {
5131
- const element = document.head.querySelector(`meta[name="${name}"]`);
5132
- return element && element.content;
4611
+ function W(t) {
4612
+ const e2 = document.head.querySelector(`meta[name="${t}"]`);
4613
+ return e2 && e2.content;
5133
4614
  }
5134
- function stringEntriesFromFormData(formData) {
5135
- return [...formData].reduce((entries, [name, value]) => {
5136
- return entries.concat(typeof value === "string" ? [[name, value]] : []);
5137
- }, []);
5138
- }
5139
- function mergeEntries(searchParams, entries) {
5140
- for (const [name, value] of entries) {
5141
- if (value instanceof window.File) continue;
5142
- if (searchParams.has(name)) {
5143
- searchParams.delete(name);
5144
- searchParams.set(name, value);
5145
- } else {
5146
- searchParams.append(name, value);
5147
- }
5148
- }
5149
- }
5150
- var FetchRequest = class {
5151
- constructor(method, url, options = {}) {
5152
- this.method = method;
5153
- this.options = options;
5154
- this.originalUrl = url.toString();
4615
+ var X = class {
4616
+ constructor(t, e2, i2 = {}) {
4617
+ this.method = t, this.options = i2, this.originalUrl = e2.toString();
5155
4618
  }
5156
4619
  async perform() {
5157
4620
  try {
5158
- const requestInterceptor = RequestInterceptor.get();
5159
- if (requestInterceptor) {
5160
- await requestInterceptor(this);
5161
- }
5162
- } catch (error) {
5163
- console.error(error);
5164
- }
5165
- const response = new FetchResponse(await window.fetch(this.url, this.fetchOptions));
5166
- if (response.unauthenticated && response.authenticationURL) {
5167
- return Promise.reject(window.location.href = response.authenticationURL);
5168
- }
5169
- if (response.ok && response.isTurboStream) {
5170
- await response.renderTurboStream();
4621
+ const t2 = T.get();
4622
+ t2 && await t2(this);
4623
+ } catch (t2) {
4624
+ console.error(t2);
5171
4625
  }
5172
- return response;
4626
+ const t = new S(await window.fetch(this.url, this.fetchOptions));
4627
+ return t.unauthenticated && t.authenticationURL ? Promise.reject(window.location.href = t.authenticationURL) : (t.ok && t.isTurboStream && await t.renderTurboStream(), t);
5173
4628
  }
5174
- addHeader(key, value) {
5175
- const headers = this.additionalHeaders;
5176
- headers[key] = value;
5177
- this.options.headers = headers;
4629
+ addHeader(t, e2) {
4630
+ const i2 = this.additionalHeaders;
4631
+ i2[t] = e2, this.options.headers = i2;
5178
4632
  }
5179
4633
  get fetchOptions() {
5180
- return {
5181
- method: this.method.toUpperCase(),
5182
- headers: this.headers,
5183
- body: this.formattedBody,
5184
- signal: this.signal,
5185
- credentials: "same-origin",
5186
- redirect: this.redirect
5187
- };
4634
+ return { method: this.method.toUpperCase(), headers: this.headers, body: this.formattedBody, signal: this.signal, credentials: "same-origin", redirect: this.redirect };
5188
4635
  }
5189
4636
  get headers() {
5190
- return compact(
5191
- Object.assign(
5192
- {
5193
- "X-Requested-With": "XMLHttpRequest",
5194
- "X-CSRF-Token": this.csrfToken,
5195
- "Content-Type": this.contentType,
5196
- Accept: this.accept
5197
- },
5198
- this.additionalHeaders
5199
- )
5200
- );
4637
+ return (function(t) {
4638
+ const e2 = {};
4639
+ for (const i2 in t) {
4640
+ const s = t[i2];
4641
+ void 0 !== s && (e2[i2] = s);
4642
+ }
4643
+ return e2;
4644
+ })(Object.assign({ "X-Requested-With": "XMLHttpRequest", "X-CSRF-Token": this.csrfToken, "Content-Type": this.contentType, Accept: this.accept }, this.additionalHeaders));
5201
4645
  }
5202
4646
  get csrfToken() {
5203
- return getCookie(metaContent("csrf-param")) || metaContent("csrf-token");
4647
+ return (function(t) {
4648
+ const e2 = document.cookie ? document.cookie.split("; ") : [], i2 = `${encodeURIComponent(t)}=`, s = e2.find(((t2) => t2.startsWith(i2)));
4649
+ if (s) {
4650
+ const t2 = s.split("=").slice(1).join("=");
4651
+ if (t2) return decodeURIComponent(t2);
4652
+ }
4653
+ })(W("csrf-param")) || W("csrf-token");
5204
4654
  }
5205
4655
  get contentType() {
5206
- if (this.options.contentType) {
5207
- return this.options.contentType;
5208
- } else if (this.body == null || this.body instanceof window.FormData) {
5209
- return void 0;
5210
- } else if (this.body instanceof window.File) {
5211
- return this.body.type;
5212
- }
5213
- return "application/json";
4656
+ return this.options.contentType ? this.options.contentType : null == this.body || this.body instanceof window.FormData ? void 0 : this.body instanceof window.File ? this.body.type : "application/json";
5214
4657
  }
5215
4658
  get accept() {
5216
4659
  switch (this.responseKind) {
@@ -5228,19 +4671,14 @@ var FetchRequest = class {
5228
4671
  return this.options.body;
5229
4672
  }
5230
4673
  get query() {
5231
- const originalQuery = (this.originalUrl.split("?")[1] || "").split("#")[0];
5232
- const params = new URLSearchParams(originalQuery);
5233
- let requestQuery = this.options.query;
5234
- if (requestQuery instanceof window.FormData) {
5235
- requestQuery = stringEntriesFromFormData(requestQuery);
5236
- } else if (requestQuery instanceof window.URLSearchParams) {
5237
- requestQuery = requestQuery.entries();
5238
- } else {
5239
- requestQuery = Object.entries(requestQuery || {});
5240
- }
5241
- mergeEntries(params, requestQuery);
5242
- const query = params.toString();
5243
- return query.length > 0 ? `?${query}` : "";
4674
+ const t = (this.originalUrl.split("?")[1] || "").split("#")[0], e2 = new URLSearchParams(t);
4675
+ let i2 = this.options.query;
4676
+ var s;
4677
+ i2 instanceof window.FormData ? (s = i2, i2 = [...s].reduce(((t2, [e3, i3]) => t2.concat("string" == typeof i3 ? [[e3, i3]] : [])), [])) : i2 = i2 instanceof window.URLSearchParams ? i2.entries() : Object.entries(i2 || {}), (function(t2, e3) {
4678
+ for (const [i3, s2] of e3) s2 instanceof window.File || (t2.has(i3) ? (t2.delete(i3), t2.set(i3, s2)) : t2.append(i3, s2));
4679
+ })(e2, i2);
4680
+ const r2 = e2.toString();
4681
+ return r2.length > 0 ? `?${r2}` : "";
5244
4682
  }
5245
4683
  get url() {
5246
4684
  return this.originalUrl.split("?")[0].split("#")[0] + this.query;
@@ -5258,39 +4696,13 @@ var FetchRequest = class {
5258
4696
  return this.options.headers || {};
5259
4697
  }
5260
4698
  get formattedBody() {
5261
- const bodyIsAString = Object.prototype.toString.call(this.body) === "[object String]";
5262
- const contentTypeIsJson = this.headers["Content-Type"] === "application/json";
5263
- if (contentTypeIsJson && !bodyIsAString) {
5264
- return JSON.stringify(this.body);
5265
- }
5266
- return this.body;
4699
+ const t = "[object String]" === Object.prototype.toString.call(this.body);
4700
+ return "application/json" !== this.headers["Content-Type"] || t ? this.body : JSON.stringify(this.body);
5267
4701
  }
5268
4702
  };
5269
- var request = (verb, url, payload, headers) => {
5270
- const req = new FetchRequest(verb, url, {
5271
- headers: { Accept: "application/json", ...headers },
5272
- ...{ query: payload }
5273
- });
5274
- return req.perform().then((response) => {
5275
- if (response.response.ok) {
5276
- return response.json;
5277
- } else {
5278
- return response;
5279
- }
5280
- });
5281
- };
5282
- var get = (url, payload = {}, headers = {}) => request("get", url, payload, headers);
5283
- var attachmentFileCss = `:host{display:block;width:100%;max-width:100%;font-size:13px}figure{margin:0}.progress-details{position:relative;display:flex;align-items:center}progress-bar{flex:1 0;padding:0 10px}progress-bar.pending{opacity:0.5}progress-bar.complete{opacity:0.8}progress-bar:not(.complete)+.progress-icon{display:none}progress-bar.complete+.progress-icon{content:url('data:image/svg+xml;utf8,<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 20 20" style="enable-background:new 0 0 20 20;" xml:space="preserve"><g><path d="M6.3,9.1c0.2,0,0.5,0.1,0.7,0.4c0.5,0.5,1,1,1.4,1.4c0.3,0.3,0.3,0.3,0.6,0c1.4-1.3,2.7-2.6,4-3.9c0.3-0.3,0.6-0.4,1-0.4 c0.5,0.1,0.9,0.6,0.7,1.1c-0.1,0.2-0.2,0.4-0.3,0.6c-1.6,1.6-3.2,3.2-4.8,4.8c-0.5,0.5-1,0.5-1.6,0c-0.8-0.7-1.5-1.5-2.3-2.3 c-0.3-0.3-0.5-0.6-0.3-1.1C5.5,9.3,5.8,9.1,6.3,9.1z"/></g></svg>');filter:invert(100%)}.progress-icon{display:inline-block;flex:0 0 20px;width:28px;height:28px;background-size:contain;position:absolute;right:30px;z-index:1}progress-bar.error{background:var(--input-attachment-error-bg, rgba(74, 70, 70, 0.25));opacity:1}.progress-bar a{color:#fff}.download-link{padding-right:20px;color:#fff}.remove-media{display:inline-block;content:url('data:image/svg+xml;utf8,<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 40 40" style="enable-background:new 0 0 40 40;" xml:space="preserve"><g><path d="M0,19.9C0.2,8.5,9.2-0.1,20.1,0C31.8,0.1,40.2,9.5,40,20.4c-0.2,11-8.9,19.7-20.1,19.6C8,39.9,0,30.5,0,19.9z M20,3.7 c-9,0-16.3,7-16.3,16.2C3.7,29,10.9,36.3,20,36.3c9,0,16.3-7.1,16.4-16.3C36.3,11,29.2,3.8,20,3.7z"/><path d="M17.3,20c-0.2-0.2-0.3-0.4-0.5-0.6c-1-1-2-1.9-2.9-2.9c-0.5-0.5-0.8-1.1-0.7-1.9c0.1-0.7,0.5-1.2,1.2-1.4 c0.8-0.2,1.5,0,2.1,0.6c1,1,2,2,3,3.1c0.3,0.4,0.6,0.3,0.9,0c1-1,2-2,3-3c0.3-0.3,0.7-0.5,1.1-0.6c0.8-0.2,1.6,0.1,2,0.8 c0.4,0.8,0.3,1.7-0.4,2.4c-1,1-2,2-3,3c-0.2,0.2-0.3,0.4-0.5,0.6c1.2,1.2,2.3,2.3,3.4,3.4c0.6,0.6,0.9,1.3,0.6,2.2 c-0.4,1.1-1.7,1.6-2.6,1c-0.3-0.2-0.5-0.4-0.8-0.6c-1-1-1.9-1.9-2.9-2.9c-0.3-0.3-0.5-0.3-0.9,0c-1,1-2,2.1-3,3 c-0.4,0.4-1,0.6-1.5,0.8c-0.6,0.1-1.2-0.2-1.5-0.8c-0.4-0.6-0.5-1.3-0.1-1.9c0.2-0.3,0.4-0.5,0.6-0.7C15.1,22.3,16.2,21.2,17.3,20z "/></g></svg>');flex:0 0 25px;width:25px;height:20px;align-items:center;opacity:0.25}.remove-media:hover{opacity:1;filter:invert(50%)sepia(100%)saturate(10000%)}.remove-media span{display:inline-block;text-indent:-9999px;color:transparent}.retry-media{color:var(--input-attachment-error-color, #c00);font-size:12px;text-decoration:underline;cursor:pointer;padding-left:8px}.retry-media:hover{color:var(--input-attachment-error-color-hover, #900)}.validation-error{color:var(--input-attachment-error-color, #c00);font-size:12px;margin:4px 0 0 10px}@media (prefers-color-scheme: dark){:host{--input-attachment-error-color:#f66;--input-attachment-error-color-hover:#f99;--input-attachment-error-bg:rgba(200, 100, 100, 0.2)}.remove-media{filter:invert(1)}}`;
5284
- var AttachmentFile = /* @__PURE__ */ proxyCustomElement(class AttachmentFile2 extends H {
5285
- constructor(registerHost2) {
5286
- super();
5287
- if (registerHost2 !== false) {
5288
- this.__registerHost();
5289
- }
5290
- this.__attachShadow();
5291
- this.removeEvent = createEvent(this, "attachment-file:remove", 7);
5292
- this.validationEvent = createEvent(this, "attachment-file:validation", 7);
5293
- this.readyEvent = createEvent(this, "attachment-file:ready", 7);
4703
+ var H2 = proxyCustomElement(class extends H {
4704
+ constructor(t) {
4705
+ super(), false !== t && this.__registerHost(), this.__attachShadow(), this.removeEvent = createEvent(this, "attachment-file:remove", 7), this.validationEvent = createEvent(this, "attachment-file:validation", 7), this.readyEvent = createEvent(this, "attachment-file:ready", 7);
5294
4706
  }
5295
4707
  get el() {
5296
4708
  return this;
@@ -5311,21 +4723,11 @@ var AttachmentFile = /* @__PURE__ */ proxyCustomElement(class AttachmentFile2 ex
5311
4723
  removeEvent;
5312
4724
  validationEvent;
5313
4725
  readyEvent;
5314
- removeClicked = (event) => {
5315
- event.stopPropagation();
5316
- event.preventDefault();
5317
- this.controller?.cancel();
5318
- this.removeEvent.emit(this);
4726
+ removeClicked = (t) => {
4727
+ t.stopPropagation(), t.preventDefault(), this.controller?.cancel(), this.removeEvent.emit(this);
5319
4728
  };
5320
- retryClicked = (event) => {
5321
- event.stopPropagation();
5322
- event.preventDefault();
5323
- this.state = "pending";
5324
- this.percent = 0;
5325
- this.validationError = "";
5326
- this.uploadError = "";
5327
- this.controller = new DirectUploadController2(this.el, this._file);
5328
- this.controller.dispatch("initialize", { controller: this.controller });
4729
+ retryClicked = (t) => {
4730
+ t.stopPropagation(), t.preventDefault(), this.state = "pending", this.percent = 0, this.validationError = "", this.uploadError = "", this.controller = new C(this.el, this._file), this.controller.dispatch("initialize", { controller: this.controller });
5329
4731
  };
5330
4732
  controller;
5331
4733
  _file;
@@ -5337,405 +4739,200 @@ var AttachmentFile = /* @__PURE__ */ proxyCustomElement(class AttachmentFile2 ex
5337
4739
  get file() {
5338
4740
  return this._file;
5339
4741
  }
5340
- set file(file) {
5341
- this.src = URL.createObjectURL(file);
5342
- this.filename = file.name;
5343
- this.size = file.size;
5344
- this.state = "pending";
5345
- this.percent = 0;
5346
- this._file = file;
5347
- }
5348
- set signedId(val) {
5349
- if (this.value !== val) {
5350
- get(`/rails/active_storage/blobs/info/${val}`).then((blob) => {
5351
- this.src = `/rails/active_storage/blobs/redirect/${val}/${blob.filename}`;
5352
- this.filename = blob.filename;
5353
- this.size = blob.byte_size;
5354
- this.state = "complete";
5355
- this.percent = 100;
5356
- this.value = val;
5357
- this.readyEvent.emit(this);
5358
- });
5359
- }
4742
+ set file(t) {
4743
+ this.src = URL.createObjectURL(t), this.filename = t.name, this.size = t.size, this.state = "pending", this.percent = 0, this._file = t;
5360
4744
  }
5361
- setMissingFiletype(_value, _previousValue) {
5362
- if (!this.filetype && this.filename) {
5363
- this.filetype = Extensions.getFileType(this.filename);
5364
- }
4745
+ set signedId(t) {
4746
+ this.value !== t && ((t2, e2 = {}, i2 = {}) => ((t3, e3, i3, s) => new X("get", e3, { headers: { Accept: "application/json", ...s }, query: i3 }).perform().then(((t4) => t4.response.ok ? t4.json : t4)))(0, t2, e2, i2))(`/rails/active_storage/blobs/info/${t}`).then(((e2) => {
4747
+ this.src = `/rails/active_storage/blobs/redirect/${t}/${e2.filename}`, this.filename = e2.filename, this.size = e2.byte_size, this.state = "complete", this.percent = 100, this.value = t, this.readyEvent.emit(this);
4748
+ }));
5365
4749
  }
5366
- start(_event) {
5367
- this.state = "pending";
5368
- this.percent = 0;
4750
+ setMissingFiletype(t, e2) {
4751
+ !this.filetype && this.filename && (this.filetype = F.getFileType(this.filename));
5369
4752
  }
5370
- progress(event) {
5371
- const { progress } = event.detail;
5372
- this.percent = progress;
4753
+ start(t) {
4754
+ this.state = "pending", this.percent = 0;
5373
4755
  }
5374
- error(event) {
5375
- event.preventDefault();
5376
- const { error } = event.detail;
5377
- this.state = "error";
5378
- this.uploadError = error;
4756
+ progress(t) {
4757
+ const { progress: e2 } = t.detail;
4758
+ this.percent = e2;
5379
4759
  }
5380
- end(_event) {
5381
- if (this.state !== "error") {
5382
- this.state = "complete";
5383
- this.percent = 100;
5384
- }
4760
+ error(t) {
4761
+ t.preventDefault();
4762
+ const { error: e2 } = t.detail;
4763
+ this.state = "error", this.uploadError = e2;
4764
+ }
4765
+ end(t) {
4766
+ "error" !== this.state && (this.state = "complete", this.percent = 100);
5385
4767
  }
5386
4768
  render() {
5387
- return h(Host, { key: "1af2d43e01a8714c658ea70a9ca68cce57bbda12" }, h("slot", { key: "deadfff4a159e17d52ed8f66d5d18aecc71fb44d" }), h("figure", { key: "7319a724f2d51c396734dacd7528b1864fb8e980" }, h("div", { key: "ce0794f4062073a8fc28e4f2398a91d711f00521", class: "progress-details" }, h("progress-bar", { key: "30c130654e71e87036beaaf02f15453e1d35ab7a", percent: this.percent, class: this.state }, h("a", { key: "12dcf70078803fe226e9abf265dcaacd0241bfe3", class: "download-link", href: this.src, download: this.filename, onClick: (e) => e.stopPropagation() }, this.filename)), h("span", { key: "e736b315d4e0c3ec601c0fdec08ce7cce5665bef", class: "progress-icon" }), h("a", { key: "dd356dcc5f72ad33a5a52de080aa60f4af7df284", class: "remove-media", onClick: this.removeClicked, href: "#" }, h("span", { key: "c9976fdb30e8d3fa78bfc838eba1e8c33ff11c04" }, "Remove media")), this.uploadError && this._file ? h("a", { class: "retry-media", onClick: this.retryClicked, href: "#" }, h("span", null, "Retry upload")) : ""), this.validationError || this.uploadError ? h("p", { class: "validation-error" }, this.validationError || this.uploadError) : "", this.preview ? h("attachment-preview", { src: this.src, filetype: this.filetype }) : ""));
4769
+ return h(Host, { key: "1af2d43e01a8714c658ea70a9ca68cce57bbda12" }, h("slot", { key: "deadfff4a159e17d52ed8f66d5d18aecc71fb44d" }), h("figure", { key: "7319a724f2d51c396734dacd7528b1864fb8e980" }, h("div", { key: "ce0794f4062073a8fc28e4f2398a91d711f00521", class: "progress-details" }, h("progress-bar", { key: "30c130654e71e87036beaaf02f15453e1d35ab7a", percent: this.percent, class: this.state }, h("a", { key: "12dcf70078803fe226e9abf265dcaacd0241bfe3", class: "download-link", href: this.src, download: this.filename, onClick: (t) => t.stopPropagation() }, this.filename)), h("span", { key: "e736b315d4e0c3ec601c0fdec08ce7cce5665bef", class: "progress-icon" }), h("a", { key: "dd356dcc5f72ad33a5a52de080aa60f4af7df284", class: "remove-media", onClick: this.removeClicked, href: "#" }, h("span", { key: "c9976fdb30e8d3fa78bfc838eba1e8c33ff11c04" }, "Remove media")), this.uploadError && this._file ? h("a", { class: "retry-media", onClick: this.retryClicked, href: "#" }, h("span", null, "Retry upload")) : ""), this.validationError || this.uploadError ? h("p", { class: "validation-error" }, this.validationError || this.uploadError) : "", this.preview ? h("attachment-preview", { src: this.src, filetype: this.filetype }) : ""));
5388
4770
  }
5389
4771
  componentDidLoad() {
5390
- if (this.state == "pending" && this._file) {
5391
- if (this.checkValidity()) {
5392
- this.controller = new DirectUploadController2(this.el, this._file);
5393
- this.controller.dispatch("initialize", { controller: this.controller });
5394
- } else {
5395
- this.state = "error";
5396
- }
5397
- }
4772
+ "pending" == this.state && this._file && (this.checkValidity() ? (this.controller = new C(this.el, this._file), this.controller.dispatch("initialize", { controller: this.controller })) : this.state = "error");
5398
4773
  }
5399
4774
  checkValidity() {
5400
- let errors = [];
5401
- errors.push(...new Accepts(this).errors);
5402
- errors.push(...new Max(this).errors);
5403
- this.validationError = errors.join(" ");
5404
- this.validationEvent.emit({ valid: errors.length === 0, error: this.validationError });
5405
- return errors.length === 0;
4775
+ let t = [];
4776
+ return t.push(...new B(this).errors), t.push(...new q(this).errors), this.validationError = t.join(" "), this.validationEvent.emit({ valid: 0 === t.length, error: this.validationError }), 0 === t.length;
5406
4777
  }
5407
4778
  static get watchers() {
5408
- return {
5409
- "filename": ["setMissingFiletype"]
5410
- };
4779
+ return { filename: [{ setMissingFiletype: 0 }] };
5411
4780
  }
5412
4781
  static get style() {
5413
- return attachmentFileCss;
5414
- }
5415
- }, [257, "attachment-file", {
5416
- "name": [1537],
5417
- "accepts": [1537],
5418
- "max": [1538],
5419
- "url": [1537],
5420
- "value": [1537],
5421
- "filename": [1537],
5422
- "src": [1537],
5423
- "filetype": [1537],
5424
- "size": [1538],
5425
- "state": [1537],
5426
- "percent": [1538],
5427
- "preview": [1540],
5428
- "validationMessage": [1, "validation-message"]
5429
- }, [[0, "direct-upload:initialize", "start"], [0, "direct-upload:start", "start"], [0, "direct-upload:progress", "progress"], [0, "direct-upload:error", "error"], [0, "direct-upload:end", "end"]], {
5430
- "filename": ["setMissingFiletype"]
5431
- }]);
4782
+ return `:host{display:block;width:100%;max-width:100%;font-size:13px}figure{margin:0}.progress-details{position:relative;display:flex;align-items:center}progress-bar{flex:1 0;padding:0 10px}progress-bar.pending{opacity:0.5}progress-bar.complete{opacity:0.8}progress-bar:not(.complete)+.progress-icon{display:none}progress-bar.complete+.progress-icon{content:url('data:image/svg+xml;utf8,<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 20 20" style="enable-background:new 0 0 20 20;" xml:space="preserve"><g><path d="M6.3,9.1c0.2,0,0.5,0.1,0.7,0.4c0.5,0.5,1,1,1.4,1.4c0.3,0.3,0.3,0.3,0.6,0c1.4-1.3,2.7-2.6,4-3.9c0.3-0.3,0.6-0.4,1-0.4 c0.5,0.1,0.9,0.6,0.7,1.1c-0.1,0.2-0.2,0.4-0.3,0.6c-1.6,1.6-3.2,3.2-4.8,4.8c-0.5,0.5-1,0.5-1.6,0c-0.8-0.7-1.5-1.5-2.3-2.3 c-0.3-0.3-0.5-0.6-0.3-1.1C5.5,9.3,5.8,9.1,6.3,9.1z"/></g></svg>');filter:invert(100%)}.progress-icon{display:inline-block;flex:0 0 20px;width:28px;height:28px;background-size:contain;position:absolute;right:30px;z-index:1}progress-bar.error{background:var(--input-attachment-error-bg, rgba(74, 70, 70, 0.25));opacity:1}.progress-bar a{color:#fff}.download-link{padding-right:20px;color:#fff}.remove-media{display:inline-block;content:url('data:image/svg+xml;utf8,<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 40 40" style="enable-background:new 0 0 40 40;" xml:space="preserve"><g><path d="M0,19.9C0.2,8.5,9.2-0.1,20.1,0C31.8,0.1,40.2,9.5,40,20.4c-0.2,11-8.9,19.7-20.1,19.6C8,39.9,0,30.5,0,19.9z M20,3.7 c-9,0-16.3,7-16.3,16.2C3.7,29,10.9,36.3,20,36.3c9,0,16.3-7.1,16.4-16.3C36.3,11,29.2,3.8,20,3.7z"/><path d="M17.3,20c-0.2-0.2-0.3-0.4-0.5-0.6c-1-1-2-1.9-2.9-2.9c-0.5-0.5-0.8-1.1-0.7-1.9c0.1-0.7,0.5-1.2,1.2-1.4 c0.8-0.2,1.5,0,2.1,0.6c1,1,2,2,3,3.1c0.3,0.4,0.6,0.3,0.9,0c1-1,2-2,3-3c0.3-0.3,0.7-0.5,1.1-0.6c0.8-0.2,1.6,0.1,2,0.8 c0.4,0.8,0.3,1.7-0.4,2.4c-1,1-2,2-3,3c-0.2,0.2-0.3,0.4-0.5,0.6c1.2,1.2,2.3,2.3,3.4,3.4c0.6,0.6,0.9,1.3,0.6,2.2 c-0.4,1.1-1.7,1.6-2.6,1c-0.3-0.2-0.5-0.4-0.8-0.6c-1-1-1.9-1.9-2.9-2.9c-0.3-0.3-0.5-0.3-0.9,0c-1,1-2,2.1-3,3 c-0.4,0.4-1,0.6-1.5,0.8c-0.6,0.1-1.2-0.2-1.5-0.8c-0.4-0.6-0.5-1.3-0.1-1.9c0.2-0.3,0.4-0.5,0.6-0.7C15.1,22.3,16.2,21.2,17.3,20z "/></g></svg>');flex:0 0 25px;width:25px;height:20px;align-items:center;opacity:0.25}.remove-media:hover{opacity:1;filter:invert(50%)sepia(100%)saturate(10000%)}.remove-media span{display:inline-block;text-indent:-9999px;color:transparent}.retry-media{color:var(--input-attachment-error-color, #c00);font-size:12px;text-decoration:underline;cursor:pointer;padding-left:8px}.retry-media:hover{color:var(--input-attachment-error-color-hover, #900)}.validation-error{color:var(--input-attachment-error-color, #c00);font-size:12px;margin:4px 0 0 10px}@media (prefers-color-scheme: dark){:host{--input-attachment-error-color:#f66;--input-attachment-error-color-hover:#f99;--input-attachment-error-bg:rgba(200, 100, 100, 0.2)}.remove-media{filter:invert(1)}}`;
4783
+ }
4784
+ }, [769, "attachment-file", { name: [1537], accepts: [1537], max: [1538], url: [1537], value: [1537], filename: [1537], src: [1537], filetype: [1537], size: [1538], state: [1537], percent: [1538], preview: [1540], validationMessage: [1, "validation-message"] }, [[0, "direct-upload:initialize", "start"], [0, "direct-upload:start", "start"], [0, "direct-upload:progress", "progress"], [0, "direct-upload:error", "error"], [0, "direct-upload:end", "end"]], { filename: [{ setMissingFiletype: 0 }] }]);
5432
4785
 
5433
4786
  // dist/components/attachment-file.js
5434
- var AttachmentFile3 = AttachmentFile;
4787
+ var o = H2;
5435
4788
 
5436
4789
  // dist/components/attachment-preview.js
5437
- var AttachmentPreview3 = AttachmentPreview;
4790
+ var e = a;
5438
4791
 
5439
4792
  // dist/components/index2.js
5440
- var ProgressBar = class extends HTMLElement {
4793
+ var n2 = class extends HTMLElement {
5441
4794
  constructor() {
5442
- super();
5443
- this.attachShadow({ mode: "open" });
5444
- this._percent = 0;
4795
+ super(), this.attachShadow({ mode: "open" }), this._percent = 0;
5445
4796
  }
5446
4797
  connectedCallback() {
5447
- this.render();
5448
- this.updateBar();
4798
+ this.render(), this.updateBar();
5449
4799
  }
5450
4800
  get percent() {
5451
4801
  return this._percent;
5452
4802
  }
5453
- set percent(value) {
5454
- this._percent = Number(value) || 0;
5455
- this.setAttribute("percent", this._percent);
5456
- this.updateBar();
4803
+ set percent(n3) {
4804
+ this._percent = Number(n3) || 0, this.setAttribute("percent", this._percent), this.updateBar();
5457
4805
  }
5458
4806
  static get observedAttributes() {
5459
4807
  return ["percent"];
5460
4808
  }
5461
- attributeChangedCallback(name, oldValue, newValue) {
5462
- if (name === "percent") {
5463
- this._percent = Number(newValue) || 0;
5464
- this.updateBar();
5465
- }
4809
+ attributeChangedCallback(n3, r2, t) {
4810
+ "percent" === n3 && (this._percent = Number(t) || 0, this.updateBar());
5466
4811
  }
5467
4812
  updateBar() {
5468
- const bar = this.shadowRoot?.querySelector(".bar");
5469
- if (bar) {
5470
- bar.style.width = `${this._percent}%`;
5471
- }
4813
+ const n3 = this.shadowRoot?.querySelector(".bar");
4814
+ n3 && (n3.style.width = `${this._percent}%`);
5472
4815
  }
5473
4816
  render() {
5474
- this.shadowRoot.innerHTML = `
5475
- <style>
5476
- :host {
5477
- --progress-color: rgb(57, 137, 39);
5478
- --progress-duration: 120ms;
5479
- --bar-height: 32px;
5480
- --bar-radius: 4px;
5481
- --bar-padding: 8px;
5482
- --bar-border-color: #999;
5483
-
5484
- display: block;
5485
- position: relative;
5486
- padding: var(--bar-padding);
5487
- border: 1px solid var(--bar-border-color);
5488
- border-radius: var(--bar-radius);
5489
- }
5490
-
5491
- .bar {
5492
- position: absolute;
5493
- top: 0;
5494
- left: 0;
5495
- height: 100%;
5496
- background: var(--progress-color);
5497
- width: 0%;
5498
- transition: width var(--progress-duration) ease, opacity 60ms ease;
5499
- border-radius: var(--bar-radius);
5500
- }
5501
-
5502
- .content {
5503
- position: relative;
5504
- display: block;
5505
- color: white;
5506
- font-size: 13px;
5507
- z-index: 1;
5508
- }
5509
- </style>
5510
-
5511
- <div class="bar"></div>
5512
- <span class="content">
5513
- <slot></slot>
5514
- </span>
5515
- `;
4817
+ this.shadowRoot.innerHTML = '\n <style>\n :host {\n --progress-color: rgb(57, 137, 39);\n --progress-duration: 120ms;\n --bar-height: 32px;\n --bar-radius: 4px;\n --bar-padding: 8px;\n --bar-border-color: #999;\n\n display: block;\n position: relative;\n padding: var(--bar-padding);\n border: 1px solid var(--bar-border-color);\n border-radius: var(--bar-radius);\n }\n\n .bar {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n background: var(--progress-color);\n width: 0%;\n transition: width var(--progress-duration) ease, opacity 60ms ease;\n border-radius: var(--bar-radius);\n }\n\n .content {\n position: relative;\n display: block;\n color: white;\n font-size: 13px;\n z-index: 1;\n }\n </style>\n\n <div class="bar"></div>\n <span class="content">\n <slot></slot>\n </span>\n ';
5516
4818
  }
5517
4819
  };
5518
- if (!customElements.get("progress-bar")) {
5519
- customElements.define("progress-bar", ProgressBar);
5520
- }
4820
+ customElements.get("progress-bar") || customElements.define("progress-bar", n2);
5521
4821
 
5522
4822
  // dist/components/input-attachment.js
5523
- var FormController = class _FormController {
5524
- static instance(form, options = {}) {
5525
- return form.inputAttachmentFormController ||= new _FormController(form, options);
4823
+ var o2 = class _o {
4824
+ static instance(t, e2 = {}) {
4825
+ return t.inputAttachmentFormController ||= new _o(t, e2);
5526
4826
  }
5527
4827
  dialog;
5528
4828
  element;
5529
4829
  controllers;
5530
4830
  submitted;
5531
4831
  processing;
5532
- constructor(form, { uploadDialog = true } = {}) {
5533
- this.element = form;
5534
- this.controllers = [];
5535
- this.submitted = false;
5536
- this.processing = false;
5537
- if (uploadDialog) {
5538
- this.dialog = document.createElement("upload-dialog");
5539
- this.dialog.id = "form-controller-dialog";
5540
- this.element.appendChild(this.dialog);
5541
- }
5542
- this.element.addEventListener("submit", (event) => this.submit(event));
5543
- window.addEventListener("beforeunload", (event) => this.beforeUnload(event));
5544
- this.element.addEventListener("direct-upload:initialize", (event) => this.init(event));
5545
- this.element.addEventListener("direct-upload:start", (event) => this.start(event));
5546
- this.element.addEventListener("direct-upload:progress", (event) => this.progress(event));
5547
- this.element.addEventListener("direct-upload:error", (event) => this.error(event));
5548
- this.element.addEventListener("direct-upload:end", (event) => this.end(event));
5549
- this.element.addEventListener("attachment-file:remove", (event) => this.removeUploadedFile(event));
5550
- }
5551
- beforeUnload(event) {
5552
- if (this.processing) {
5553
- event.preventDefault();
5554
- return event.returnValue = "";
5555
- }
5556
- }
5557
- submit(event) {
5558
- if (this.controllers.length === 0 && !this.hasUploadErrors() && !this.processing)
5559
- return;
5560
- event.preventDefault();
5561
- this.submitted = true;
5562
- this.setInputAttachmentsDisabled(true);
5563
- this.startNextController();
5564
- if (this.processing) {
5565
- this.dialog?.open();
5566
- }
4832
+ constructor(t, { uploadDialog: e2 = true } = {}) {
4833
+ this.element = t, this.controllers = [], this.submitted = false, this.processing = false, e2 && (this.dialog = document.createElement("upload-dialog"), this.dialog.id = "form-controller-dialog", this.element.appendChild(this.dialog)), this.element.addEventListener("submit", ((t2) => this.submit(t2))), window.addEventListener("beforeunload", ((t2) => this.beforeUnload(t2))), this.element.addEventListener("direct-upload:initialize", ((t2) => this.init(t2))), this.element.addEventListener("direct-upload:start", ((t2) => this.start(t2))), this.element.addEventListener("direct-upload:progress", ((t2) => this.progress(t2))), this.element.addEventListener("direct-upload:error", ((t2) => this.error(t2))), this.element.addEventListener("direct-upload:end", ((t2) => this.end(t2))), this.element.addEventListener("attachment-file:remove", ((t2) => this.removeUploadedFile(t2)));
4834
+ }
4835
+ beforeUnload(t) {
4836
+ if (this.processing) return t.preventDefault(), t.returnValue = "";
4837
+ }
4838
+ submit(t) {
4839
+ (0 !== this.controllers.length || this.hasUploadErrors() || this.processing) && (t.preventDefault(), this.submitted = true, this.setInputAttachmentsDisabled(true), this.startNextController(), this.processing && this.dialog?.open());
5567
4840
  }
5568
4841
  startNextController() {
5569
- if (this.processing)
5570
- return;
5571
- const controller = this.controllers.shift();
5572
- if (controller) {
5573
- this.processing = true;
5574
- if (this.submitted) {
5575
- this.setInputAttachmentsDisabled(true);
5576
- } else {
5577
- this.setControllerInputDisabled(controller, true);
5578
- }
5579
- controller.start((error) => {
5580
- if (this.submitted) {
5581
- if (error) {
5582
- this.setInputAttachmentsDisabled(false);
5583
- }
5584
- } else {
5585
- this.setControllerInputDisabled(controller, false);
5586
- }
5587
- this.processing = false;
5588
- this.startNextController();
5589
- });
5590
- } else {
5591
- this.submitForm();
5592
- }
4842
+ if (this.processing) return;
4843
+ const t = this.controllers.shift();
4844
+ t ? (this.processing = true, this.submitted ? this.setInputAttachmentsDisabled(true) : this.setControllerInputDisabled(t, true), t.start(((e2) => {
4845
+ this.submitted ? e2 && this.setInputAttachmentsDisabled(false) : this.setControllerInputDisabled(t, false), this.processing = false, this.startNextController();
4846
+ }))) : this.submitForm();
5593
4847
  }
5594
4848
  hasUploadErrors() {
5595
- return Array.from(this.element.querySelectorAll("attachment-file")).some((el) => el.state === "error");
4849
+ return Array.from(this.element.querySelectorAll("attachment-file")).some(((t) => "error" === t.state));
5596
4850
  }
5597
4851
  submitForm() {
5598
- if (!this.submitted)
5599
- return;
5600
- if (this.hasUploadErrors()) {
5601
- this.dialog?.close();
5602
- this.setInputAttachmentsDisabled(false);
5603
- return;
4852
+ if (this.submitted) {
4853
+ if (this.hasUploadErrors()) return this.dialog?.close(), void this.setInputAttachmentsDisabled(false);
4854
+ this.setInputAttachmentsDisabled(true), requestAnimationFrame((() => {
4855
+ this.element.submit();
4856
+ }));
5604
4857
  }
5605
- this.setInputAttachmentsDisabled(true);
5606
- requestAnimationFrame(() => {
5607
- this.element.submit();
5608
- });
5609
4858
  }
5610
- setControllerInputDisabled(controller, disabled) {
5611
- const inputAttachment = controller.uploadedFile.closest("input-attachment");
5612
- if (inputAttachment) {
5613
- inputAttachment.disabled = disabled;
5614
- }
4859
+ setControllerInputDisabled(t, e2) {
4860
+ const i2 = t.uploadedFile.closest("input-attachment");
4861
+ i2 && (i2.disabled = e2);
5615
4862
  }
5616
- setInputAttachmentsDisabled(disabled) {
5617
- Array.from(this.element.querySelectorAll("input-attachment")).forEach((el) => {
5618
- el.disabled = disabled;
5619
- });
4863
+ setInputAttachmentsDisabled(t) {
4864
+ Array.from(this.element.querySelectorAll("input-attachment")).forEach(((e2) => {
4865
+ e2.disabled = t;
4866
+ }));
5620
4867
  }
5621
- init(event) {
5622
- const { id: id2, file, controller } = event.detail;
5623
- this.dialog?.addUpload(`direct-upload-${id2}`, file?.name || "Uploading...");
5624
- this.controllers.push(controller);
5625
- this.startNextController();
4868
+ init(t) {
4869
+ const { id: e2, file: i2, controller: s } = t.detail;
4870
+ this.dialog?.addUpload("direct-upload-" + e2, i2?.name || "Uploading..."), this.controllers.push(s), this.startNextController();
5626
4871
  }
5627
- start(event) {
5628
- this.dialog?.startUpload(`direct-upload-${event.detail.id}`);
4872
+ start(t) {
4873
+ this.dialog?.startUpload("direct-upload-" + t.detail.id);
5629
4874
  }
5630
- progress(event) {
5631
- const { id: id2, progress } = event.detail;
5632
- this.dialog?.updateProgress(`direct-upload-${id2}`, progress);
4875
+ progress(t) {
4876
+ const { id: e2, progress: i2 } = t.detail;
4877
+ this.dialog?.updateProgress("direct-upload-" + e2, i2);
5633
4878
  }
5634
- error(event) {
5635
- event.preventDefault();
5636
- const { id: id2, error } = event.detail;
5637
- this.dialog?.setError(`direct-upload-${id2}`, error);
4879
+ error(t) {
4880
+ t.preventDefault();
4881
+ const { id: e2, error: i2 } = t.detail;
4882
+ this.dialog?.setError("direct-upload-" + e2, i2);
5638
4883
  }
5639
- end(event) {
5640
- this.dialog?.completeUpload(`direct-upload-${event.detail.id}`);
4884
+ end(t) {
4885
+ this.dialog?.completeUpload("direct-upload-" + t.detail.id);
5641
4886
  }
5642
- removeUploadedFile(event) {
5643
- const uploadedFile = event.detail;
5644
- const id2 = uploadedFile.controller?.directUpload?.id;
5645
- if (id2) {
5646
- this.dialog?.removeUpload(`direct-upload-${id2}`);
5647
- }
5648
- this.setInputAttachmentsDisabled(false);
5649
- requestAnimationFrame(() => this.submitForm());
4887
+ removeUploadedFile(t) {
4888
+ const e2 = t.detail, i2 = e2.controller?.directUpload?.id;
4889
+ i2 && this.dialog?.removeUpload("direct-upload-" + i2), this.setInputAttachmentsDisabled(false), requestAnimationFrame((() => this.submitForm()));
5650
4890
  }
5651
4891
  };
5652
- function arrayRemove(arr, e) {
5653
- const index = arr.findIndex((x) => x === e);
5654
- if (index !== -1) {
5655
- arr.splice(index, 1);
5656
- }
5657
- }
5658
- var FileDrop = class extends HTMLElement {
4892
+ var l2 = class extends HTMLElement {
5659
4893
  constructor() {
5660
- super();
5661
- this.handleDragOver = this.handleDragOver.bind(this);
5662
- this.handleDragLeave = this.handleDragLeave.bind(this);
5663
- this.handleDrop = this.handleDrop.bind(this);
4894
+ super(), this.handleDragOver = this.handleDragOver.bind(this), this.handleDragLeave = this.handleDragLeave.bind(this), this.handleDrop = this.handleDrop.bind(this);
5664
4895
  }
5665
4896
  static get observedAttributes() {
5666
4897
  return ["for"];
5667
4898
  }
5668
4899
  connectedCallback() {
5669
- this.addEventListener("dragover", this.handleDragOver);
5670
- this.addEventListener("dragleave", this.handleDragLeave);
5671
- this.addEventListener("drop", this.handleDrop);
5672
- this.applyDefaultStyles();
4900
+ this.addEventListener("dragover", this.handleDragOver), this.addEventListener("dragleave", this.handleDragLeave), this.addEventListener("drop", this.handleDrop), this.applyDefaultStyles();
5673
4901
  }
5674
4902
  disconnectedCallback() {
5675
- this.removeEventListener("dragover", this.handleDragOver);
5676
- this.removeEventListener("dragleave", this.handleDragLeave);
5677
- this.removeEventListener("drop", this.handleDrop);
4903
+ this.removeEventListener("dragover", this.handleDragOver), this.removeEventListener("dragleave", this.handleDragLeave), this.removeEventListener("drop", this.handleDrop);
5678
4904
  }
5679
4905
  get fileTarget() {
5680
- const forValue = this.getAttribute("for");
5681
- if (!forValue) return null;
5682
- return document.querySelector(`#${forValue}`);
4906
+ const t = this.getAttribute("for");
4907
+ return t ? document.querySelector("#" + t) : null;
5683
4908
  }
5684
- handleDragOver(event) {
5685
- event.preventDefault();
5686
- this.classList.add("-dragover");
4909
+ handleDragOver(t) {
4910
+ t.preventDefault(), this.classList.add("-dragover");
5687
4911
  }
5688
4912
  handleDragLeave() {
5689
4913
  this.classList.remove("-dragover");
5690
4914
  }
5691
- handleDrop(event) {
5692
- event.preventDefault();
5693
- this.classList.remove("-dragover");
5694
- const target = this.fileTarget;
5695
- if (target && event.dataTransfer.files.length > 0) {
5696
- target.files = event.dataTransfer.files;
5697
- const changeEvent = new Event("change", { bubbles: true });
5698
- target.dispatchEvent(changeEvent);
4915
+ handleDrop(t) {
4916
+ t.preventDefault(), this.classList.remove("-dragover");
4917
+ const e2 = this.fileTarget;
4918
+ if (e2 && t.dataTransfer.files.length > 0) {
4919
+ e2.files = t.dataTransfer.files;
4920
+ const i2 = new Event("change", { bubbles: true });
4921
+ e2.dispatchEvent(i2);
5699
4922
  }
5700
4923
  }
5701
4924
  applyDefaultStyles() {
5702
4925
  if (!this.hasAttribute("data-no-default-styles")) {
5703
- const styles2 = `
5704
- file-drop {
5705
- display: flex;
5706
- flex-direction: column;
5707
- justify-content: center;
5708
- align-items: center;
5709
- box-sizing: border-box;
5710
- min-height: 60px;
5711
- outline-offset: -10px;
5712
- padding: 20px;
5713
- background: rgba(255, 255, 255, 0.25);
5714
- text-align: center;
5715
- transition: all 0.15s ease 0s;
5716
- outline: rgba(0, 0, 0, 0.25) dashed 2px;
5717
- font-size: 13px;
5718
- }
5719
-
5720
- file-drop.-dragover {
5721
- background: rgba(0, 0, 0, 0.1);
5722
- outline-color: rgba(0, 0, 0, 0.5);
5723
- }
5724
- `;
4926
+ const t = "\n file-drop {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n min-height: 60px;\n outline-offset: -10px;\n padding: 20px;\n background: rgba(255, 255, 255, 0.25);\n text-align: center;\n transition: all 0.15s ease 0s;\n outline: rgba(0, 0, 0, 0.25) dashed 2px;\n font-size: 13px;\n }\n\n file-drop.-dragover {\n background: rgba(0, 0, 0, 0.1);\n outline-color: rgba(0, 0, 0, 0.5);\n }\n ";
5725
4927
  if (!document.querySelector("#file-drop-default-styles")) {
5726
- const styleElement = document.createElement("style");
5727
- styleElement.id = "file-drop-default-styles";
5728
- styleElement.textContent = styles2;
5729
- document.head.appendChild(styleElement);
4928
+ const e2 = document.createElement("style");
4929
+ e2.id = "file-drop-default-styles", e2.textContent = t, document.head.appendChild(e2);
5730
4930
  }
5731
4931
  }
5732
4932
  }
5733
4933
  };
5734
- if (!customElements.get("file-drop")) {
5735
- customElements.define("file-drop", FileDrop);
5736
- }
5737
- var inputAttachmentCss = ":host{display:block;padding:25px;color:var(--input-attachment-text-color, #000);font-size:13px}:host *{box-sizing:border-box;position:relative}file-drop{cursor:pointer;display:block;outline-offset:-10px;background:var(--input-attachment-drop-bg, rgba(255,255,255, 0.25));padding:20px;text-align:center;transition:all 0.15s;outline:2px dashed var(--input-attachment-drop-border, rgba(0,0,0,0.25));color:var(--input-attachment-drop-color, #444);font-size:14px}file-drop.-full{width:100%}p{padding:10px 20px;margin:0}.-dragover{background:var(--input-attachment-drop-bg-active, rgba(255,255,255,0.5));outline:2px dashed var(--input-attachment-drop-border, rgba(0,0,0,0.25))}.media-preview{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:center}:host.separate-upload{padding:0 10px;margin-top:10px;font-size:0.9em}@media (prefers-color-scheme: dark){:host{--input-attachment-text-color:#e0e0e0;--input-attachment-drop-bg:rgba(255,255,255, 0.08);--input-attachment-drop-border:rgba(255,255,255, 0.25);--input-attachment-drop-color:#bbb;--input-attachment-drop-bg-active:rgba(255,255,255, 0.15);--input-attachment-error-color:#f66}}";
5738
- var InputAttachment$1 = /* @__PURE__ */ proxyCustomElement(class InputAttachment extends H {
4934
+ customElements.get("file-drop") || customElements.define("file-drop", l2);
4935
+ var d2 = proxyCustomElement(class extends H {
5739
4936
  get el() {
5740
4937
  return this;
5741
4938
  }
@@ -5752,194 +4949,104 @@ var InputAttachment$1 = /* @__PURE__ */ proxyCustomElement(class InputAttachment
5752
4949
  internals;
5753
4950
  fileInput;
5754
4951
  _files = [];
5755
- constructor(registerHost2) {
5756
- super();
5757
- if (registerHost2 !== false) {
5758
- this.__registerHost();
5759
- }
5760
- this.__attachShadow();
5761
- this.internals = this.el.attachInternals();
4952
+ constructor(t) {
4953
+ super(), false !== t && this.__registerHost(), this.__attachShadow(), this.internals = this.el.attachInternals();
5762
4954
  }
5763
4955
  componentWillLoad() {
5764
- this.form = this.internals.form;
5765
- if (this.form) {
5766
- this.form.addEventListener("reset", () => this.reset());
5767
- FormController.instance(this.form, { uploadDialog: this.uploadDialog });
5768
- }
5769
- const existingFiles = Array.from(this.el.children).filter((e) => e.tagName == "ATTACHMENT-FILE");
5770
- if (existingFiles.length > 0)
5771
- this.files = existingFiles;
5772
- if (this.files.length > 0)
5773
- this.updateFormValue();
4956
+ this.form = this.internals.form, this.form && (this.form.addEventListener("reset", (() => this.reset())), o2.instance(this.form, { uploadDialog: this.uploadDialog }));
4957
+ const t = Array.from(this.el.children).filter(((t2) => "ATTACHMENT-FILE" == t2.tagName));
4958
+ t.length > 0 && (this.files = t), this.files.length > 0 && this.updateFormValue();
5774
4959
  }
5775
4960
  componentDidLoad() {
5776
4961
  this.fileInput?.addEventListener("change", this.handleFileInputChange);
5777
4962
  }
5778
- // Methods
5779
4963
  get files() {
5780
4964
  return this._files;
5781
4965
  }
5782
- set files(val) {
5783
- this._files = val;
5784
- if (!this.multiple)
5785
- this._files = this._files.slice(-1);
5786
- forceUpdate(this.el);
5787
- this.fireChangeEvent();
4966
+ set files(t) {
4967
+ this._files = t, this.multiple || (this._files = this._files.slice(-1)), forceUpdate(this.el), this.fireChangeEvent();
5788
4968
  }
5789
4969
  get value() {
5790
- return JSON.stringify(this.files.map((f) => ({
5791
- value: f.value,
5792
- filename: f.filename,
5793
- src: f.src,
5794
- state: f.state,
5795
- percent: f.percent,
5796
- size: f.size,
5797
- filetype: f.filetype
5798
- })));
5799
- }
5800
- set value(val) {
5801
- const data = JSON.parse(val || "[]");
5802
- if (data.length === 0) {
5803
- this.files = [];
5804
- return;
5805
- }
5806
- this.files = data.map((item) => {
5807
- const attachmentFile = document.createElement("attachment-file");
5808
- attachmentFile.name = this.name;
5809
- attachmentFile.preview = this.preview;
5810
- attachmentFile.value = item.value;
5811
- attachmentFile.filename = item.filename;
5812
- attachmentFile.src = item.src;
5813
- attachmentFile.state = item.state || "complete";
5814
- attachmentFile.percent = item.percent || 100;
5815
- attachmentFile.size = item.size;
5816
- attachmentFile.filetype = item.filetype;
5817
- return attachmentFile;
5818
- });
5819
- requestAnimationFrame(() => this.componentDidRender());
4970
+ return JSON.stringify(this.files.map(((t) => ({ value: t.value, filename: t.filename, src: t.src, state: t.state, percent: t.percent, size: t.size, filetype: t.filetype }))));
4971
+ }
4972
+ set value(t) {
4973
+ const e2 = JSON.parse(t || "[]");
4974
+ 0 !== e2.length ? (this.files = e2.map(((t2) => {
4975
+ const e3 = document.createElement("attachment-file");
4976
+ return e3.name = this.name, e3.preview = this.preview, e3.value = t2.value, e3.filename = t2.filename, e3.src = t2.src, e3.state = t2.state || "complete", e3.percent = t2.percent || 100, e3.size = t2.size, e3.filetype = t2.filetype, e3;
4977
+ })), requestAnimationFrame((() => this.componentDidRender()))) : this.files = [];
5820
4978
  }
5821
4979
  updateFormValue() {
5822
- if (!this.name || !this.internals?.setFormValue)
5823
- return;
5824
- const formData = new FormData();
5825
- const values = this.files.map((f) => f.value).filter((v) => v);
5826
- if (this.multiple) {
5827
- values.forEach((signedId) => formData.append(this.name, signedId));
5828
- if (values.length === 0)
5829
- formData.append(this.name, "");
5830
- } else {
5831
- formData.set(this.name, values[0] || "");
5832
- }
5833
- this.internals.setFormValue(formData);
5834
- if (this.required && this.files.length === 0) {
5835
- this.internals.setValidity({ valueMissing: true }, "Please select a file.", this.fileInput);
5836
- } else {
5837
- const childErrors = this.files.map((f) => f.validationError).filter((e) => e && e.length > 0);
5838
- if (childErrors.length > 0) {
5839
- this.internals.setValidity({ customError: true }, childErrors[0], this.fileInput);
5840
- } else {
5841
- this.internals.setValidity({});
5842
- }
4980
+ if (!this.name || !this.internals?.setFormValue) return;
4981
+ const t = new FormData(), e2 = this.files.map(((t2) => t2.value)).filter(((t2) => t2));
4982
+ if (this.multiple ? (e2.forEach(((e3) => t.append(this.name, e3))), 0 === e2.length && t.append(this.name, "")) : t.set(this.name, e2[0] || ""), this.internals.setFormValue(t), this.required && 0 === this.files.length) this.internals.setValidity({ valueMissing: true }, "Please select a file.", this.fileInput);
4983
+ else {
4984
+ const t2 = this.files.map(((t3) => t3.validationError)).filter(((t3) => t3 && t3.length > 0));
4985
+ t2.length > 0 ? this.internals.setValidity({ customError: true }, t2[0], this.fileInput) : this.internals.setValidity({});
5843
4986
  }
5844
4987
  }
5845
4988
  reset() {
5846
4989
  this.files = [];
5847
4990
  }
5848
4991
  handleFileInputChange = () => {
5849
- if (!this.fileInput?.files?.length)
5850
- return;
5851
- this.addFiles(this.fileInput.files);
5852
- this.fileInput.value = null;
4992
+ this.fileInput?.files?.length && (this.addFiles(this.fileInput.files), this.fileInput.value = null);
5853
4993
  };
5854
- handleDrop = (event) => {
5855
- event.preventDefault();
5856
- if (this.isDisabled)
5857
- return;
5858
- if (event.dataTransfer?.files?.length) {
5859
- this.addFiles(event.dataTransfer.files);
5860
- }
4994
+ handleDrop = (t) => {
4995
+ t.preventDefault(), this.isDisabled || t.dataTransfer?.files?.length && this.addFiles(t.dataTransfer.files);
5861
4996
  };
5862
- removeUploadedFile(event) {
5863
- arrayRemove(this.files, event.detail);
5864
- this.files = this.files;
4997
+ removeUploadedFile(t) {
4998
+ !(function(t2, e2) {
4999
+ const i2 = t2.findIndex(((t3) => t3 === e2));
5000
+ -1 !== i2 && t2.splice(i2, 1);
5001
+ })(this.files, t.detail), this.files = this.files;
5865
5002
  }
5866
- handleChildValidation(_event) {
5003
+ handleChildValidation(t) {
5867
5004
  this.updateFormValue();
5868
5005
  }
5869
- handleChildReady(_event) {
5006
+ handleChildReady(t) {
5870
5007
  this.updateFormValue();
5871
5008
  }
5872
5009
  fireChangeEvent() {
5873
- requestAnimationFrame(() => {
5874
- this.updateFormValue();
5875
- this.el.dispatchEvent(new Event("change", { bubbles: true }));
5876
- });
5010
+ requestAnimationFrame((() => {
5011
+ this.updateFormValue(), this.el.dispatchEvent(new Event("change", { bubbles: true }));
5012
+ }));
5877
5013
  }
5878
- // Rendering
5879
5014
  get isDisabled() {
5880
5015
  return this.disabled || !!this.el.closest("fieldset[disabled]");
5881
5016
  }
5882
5017
  render() {
5883
- return h(Host, { key: "6a45fb4254e303d6bdc0e904129d5db9f94799b3" }, h("input", { key: "68df3d0b0b7ea59551a6a2ef78a59f0ac77cb848", ref: (el) => this.fileInput = el, type: "file", multiple: this.multiple, accept: this.accepts, required: this.required && this.files.length === 0, disabled: this.isDisabled, onChange: () => this.handleFileInputChange(), style: {
5884
- opacity: "0.01",
5885
- width: "1px",
5886
- height: "1px",
5887
- zIndex: "-999"
5888
- } }), h("file-drop", { key: "4af1e60084b31e232bbda03a540d0a87e301ee1e", onClick: () => this.fileInput?.click(), onDrop: this.handleDrop }, h("p", { key: "c714acafc22ec669b2978065b04559cd0f097e57", part: "title" }, h("strong", { key: "3fab310e5ee4e1d8ceb65076a88f67a9a51a3a4d" }, "Choose ", this.multiple ? "files" : "file", " "), h("span", { key: "694f5681825da6005f65d6f8038fb75170b5dfca" }, "or drag ", this.multiple ? "them" : "it", " here.")), h("div", { key: "8a0d60e85928524d2adbcf58b24bbce095cc9a11", class: `media-preview ${this.multiple ? "-stacked" : ""}` }, h("slot", { key: "5b8ee7c5eb04099451d2d5059095d62b39b430b5" }))));
5018
+ return h(Host, { key: "6a45fb4254e303d6bdc0e904129d5db9f94799b3" }, h("input", { key: "93ce74b844ae92450b526209aa4a7a50f1b3195e", ref: (t) => this.fileInput = t, type: "file", "aria-label": "Choose " + (this.multiple ? "files" : "file"), multiple: this.multiple, accept: this.accepts, required: this.required && 0 === this.files.length, disabled: this.isDisabled, onChange: () => this.handleFileInputChange(), style: { opacity: "0.01", width: "1px", height: "1px", zIndex: "-999" } }), h("file-drop", { key: "b6a85d8c0f6293a5797394f84459c68ae51cf50b", onClick: () => this.fileInput?.click(), onDrop: this.handleDrop }, h("p", { key: "db21308765a43e470f7498f9af4fa2115dcebe1a", part: "title" }, h("strong", { key: "dc7af1ff4ab0a691005c2389c5c2733b3c6510ee" }, "Choose ", this.multiple ? "files" : "file", " "), h("span", { key: "0876a9b640be39081265252373196cb19bf291d8" }, "or drag ", this.multiple ? "them" : "it", " here.")), h("div", { key: "31a2aa334cf416934f947549479afde627f3166c", class: "media-preview " + (this.multiple ? "-stacked" : "") }, h("slot", { key: "ac3208347ce232eeab80626c712ad4cbb3a1cdbf" }))));
5889
5019
  }
5890
5020
  componentDidRender() {
5891
- if (this.files.length === 0) {
5892
- const existingFiles = Array.from(this.el.children).filter((e) => e.tagName == "ATTACHMENT-FILE");
5893
- if (existingFiles.length > 0) {
5894
- this._files = existingFiles;
5895
- }
5896
- }
5897
- const wrapper = document.createElement("div");
5898
- this.files.forEach((file) => wrapper.appendChild(file));
5899
- let needsUpdate = false;
5900
- if (wrapper.children.length !== this.el.children.length) {
5901
- needsUpdate = true;
5902
- } else {
5903
- for (let i2 = 0; i2 < wrapper.children.length; i2++) {
5904
- if (wrapper.children[i2] !== this.el.children[i2]) {
5905
- needsUpdate = true;
5906
- break;
5907
- }
5908
- }
5909
- }
5910
- if (needsUpdate) {
5911
- while (this.el.firstChild) {
5912
- this.el.removeChild(this.el.firstChild);
5913
- }
5914
- this.el.appendChild(wrapper);
5021
+ if (0 === this.files.length) {
5022
+ const t2 = Array.from(this.el.children).filter(((t3) => "ATTACHMENT-FILE" == t3.tagName));
5023
+ t2.length > 0 && (this._files = t2);
5024
+ }
5025
+ const t = document.createElement("div");
5026
+ this.files.forEach(((e3) => t.appendChild(e3)));
5027
+ let e2 = false;
5028
+ if (t.children.length !== this.el.children.length) e2 = true;
5029
+ else for (let i2 = 0; i2 < t.children.length; i2++) if (t.children[i2] !== this.el.children[i2]) {
5030
+ e2 = true;
5031
+ break;
5032
+ }
5033
+ if (e2) {
5034
+ for (; this.el.firstChild; ) this.el.removeChild(this.el.firstChild);
5035
+ this.el.appendChild(t);
5915
5036
  }
5916
5037
  this.updateFormValue();
5917
5038
  }
5918
- // Test helper - adds files programmatically with proper lifecycle
5919
- addFiles(files) {
5920
- const fileArray = Array.from(files);
5921
- fileArray.forEach((file) => {
5922
- const attachmentFile = document.createElement("attachment-file");
5923
- attachmentFile.name = this.name;
5924
- attachmentFile.preview = this.preview;
5925
- attachmentFile.setAttribute("url", this.directupload);
5926
- attachmentFile.accepts = this.accepts;
5927
- attachmentFile.max = this.max;
5928
- attachmentFile.file = file;
5929
- this._files.push(attachmentFile);
5930
- });
5931
- this.files = this._files;
5932
- requestAnimationFrame(() => this.componentDidRender());
5039
+ addFiles(t) {
5040
+ Array.from(t).forEach(((t2) => {
5041
+ const e2 = document.createElement("attachment-file");
5042
+ e2.name = this.name, e2.preview = this.preview, e2.setAttribute("url", this.directupload), e2.accepts = this.accepts, e2.max = this.max, e2.file = t2, this._files.push(e2);
5043
+ })), this.files = this._files, requestAnimationFrame((() => this.componentDidRender()));
5933
5044
  }
5934
- // Validations
5935
5045
  checkValidity() {
5936
- if (this.required && this.files.length === 0) {
5937
- return false;
5938
- }
5939
- return true;
5046
+ return !this.required || 0 !== this.files.length;
5940
5047
  }
5941
- setCustomValidity(msg) {
5942
- this.internals.setValidity(msg ? { customError: true } : {}, msg, this.fileInput);
5048
+ setCustomValidity(t) {
5049
+ this.internals.setValidity(t ? { customError: true } : {}, t, this.fileInput);
5943
5050
  }
5944
5051
  reportValidity() {
5945
5052
  return this.internals.reportValidity();
@@ -5951,30 +5058,15 @@ var InputAttachment$1 = /* @__PURE__ */ proxyCustomElement(class InputAttachment
5951
5058
  return true;
5952
5059
  }
5953
5060
  static get style() {
5954
- return inputAttachmentCss;
5955
- }
5956
- }, [321, "input-attachment", {
5957
- "name": [1],
5958
- "directupload": [1],
5959
- "multiple": [4],
5960
- "required": [4],
5961
- "accepts": [1],
5962
- "max": [2],
5963
- "preview": [4],
5964
- "disabled": [4],
5965
- "uploadDialog": [4, "upload-dialog"]
5966
- }, [[0, "attachment-file:remove", "removeUploadedFile"], [0, "attachment-file:validation", "handleChildValidation"], [0, "attachment-file:ready", "handleChildReady"], [0, "direct-upload:end", "fireChangeEvent"]]]);
5967
- var InputAttachment2 = InputAttachment$1;
5061
+ return ":host{display:block;padding:25px;color:var(--input-attachment-text-color, #000);font-size:13px}:host *{box-sizing:border-box;position:relative}file-drop{cursor:pointer;display:block;outline-offset:-10px;background:var(--input-attachment-drop-bg, rgba(255,255,255, 0.25));padding:20px;text-align:center;transition:all 0.15s;outline:2px dashed var(--input-attachment-drop-border, rgba(0,0,0,0.25));color:var(--input-attachment-drop-color, #444);font-size:14px}file-drop.-full{width:100%}p{padding:10px 20px;margin:0}.-dragover{background:var(--input-attachment-drop-bg-active, rgba(255,255,255,0.5));outline:2px dashed var(--input-attachment-drop-border, rgba(0,0,0,0.25))}.media-preview{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:center}:host.separate-upload{padding:0 10px;margin-top:10px;font-size:0.9em}@media (prefers-color-scheme: dark){:host{--input-attachment-text-color:#e0e0e0;--input-attachment-drop-bg:#333;--input-attachment-drop-border:rgba(255,255,255, 0.25);--input-attachment-drop-color:#bbb;--input-attachment-drop-bg-active:#444;--input-attachment-error-color:#f66}}";
5062
+ }
5063
+ }, [833, "input-attachment", { name: [1], directupload: [1], multiple: [4], required: [4], accepts: [1], max: [2], preview: [4], disabled: [4], uploadDialog: [4, "upload-dialog"] }, [[0, "attachment-file:remove", "removeUploadedFile"], [0, "attachment-file:validation", "handleChildValidation"], [0, "attachment-file:ready", "handleChildReady"], [0, "direct-upload:end", "fireChangeEvent"]]]);
5064
+ var c3 = d2;
5968
5065
 
5969
5066
  // dist/components/upload-dialog.js
5970
- var uploadDialogCss = "dialog{border:none;padding:0;background:transparent;max-width:100vw;max-height:100vh}dialog::backdrop{background:transparent}.direct-upload-wrapper{position:fixed;z-index:9999;top:0;left:0;width:100vw;height:100vh;display:flex;align-items:center;justify-content:center;background:var(--input-attachment-overlay-bg, rgba(51, 51, 51, 0.9))}.direct-upload-content{display:block;background:var(--input-attachment-dialog-bg, #fcfcfc);color:var(--input-attachment-text-color, #000);padding:40px 60px 60px;border-radius:3px;width:60vw}.direct-upload-content h3{border-bottom:2px solid var(--input-attachment-dialog-border, #1f1f1f);margin-bottom:20px}.direct-upload--pending{opacity:0.6}.direct-upload--complete{opacity:0.4}.direct-upload--error{border-color:var(--input-attachment-error-color, red)}@media (prefers-color-scheme: dark){:host{--input-attachment-dialog-bg:#2a2a2a;--input-attachment-dialog-border:#555;--input-attachment-error-color:#f66}}";
5971
- var UploadDialog$1 = /* @__PURE__ */ proxyCustomElement(class UploadDialog extends H {
5972
- constructor(registerHost2) {
5973
- super();
5974
- if (registerHost2 !== false) {
5975
- this.__registerHost();
5976
- }
5977
- this.__attachShadow();
5067
+ var d3 = proxyCustomElement(class extends H {
5068
+ constructor(e2) {
5069
+ super(), false !== e2 && this.__registerHost(), this.__attachShadow();
5978
5070
  }
5979
5071
  dialog;
5980
5072
  uploads = [];
@@ -5984,71 +5076,44 @@ var UploadDialog$1 = /* @__PURE__ */ proxyCustomElement(class UploadDialog exten
5984
5076
  async close() {
5985
5077
  this.dialog.close();
5986
5078
  }
5987
- async addUpload(id2, filename) {
5988
- this.uploads = [...this.uploads, {
5989
- id: id2,
5990
- filename,
5991
- pending: true,
5992
- percent: 0,
5993
- complete: false,
5994
- error: null
5995
- }];
5079
+ async addUpload(e2, t) {
5080
+ this.uploads = [...this.uploads, { id: e2, filename: t, pending: true, percent: 0, complete: false, error: null }];
5996
5081
  }
5997
- async startUpload(id2) {
5998
- this.uploads = this.uploads.map((u) => u.id === id2 ? { ...u, pending: false } : u);
5082
+ async startUpload(e2) {
5083
+ this.uploads = this.uploads.map(((t) => t.id === e2 ? { ...t, pending: false } : t));
5999
5084
  }
6000
- async updateProgress(id2, percent) {
6001
- this.uploads = this.uploads.map((u) => u.id === id2 ? { ...u, percent } : u);
5085
+ async updateProgress(e2, t) {
5086
+ this.uploads = this.uploads.map(((a3) => a3.id === e2 ? { ...a3, percent: t } : a3));
6002
5087
  }
6003
- async setError(id2, error) {
6004
- this.uploads = this.uploads.map((u) => u.id === id2 ? { ...u, error } : u);
5088
+ async setError(e2, t) {
5089
+ this.uploads = this.uploads.map(((a3) => a3.id === e2 ? { ...a3, error: t } : a3));
6005
5090
  }
6006
- async completeUpload(id2) {
6007
- this.uploads = this.uploads.map((u) => u.id === id2 ? { ...u, complete: true } : u);
5091
+ async completeUpload(e2) {
5092
+ this.uploads = this.uploads.map(((t) => t.id === e2 ? { ...t, complete: true } : t));
6008
5093
  }
6009
- async removeUpload(id2) {
6010
- this.uploads = this.uploads.filter((u) => u.id !== id2);
5094
+ async removeUpload(e2) {
5095
+ this.uploads = this.uploads.filter(((t) => t.id !== e2));
6011
5096
  }
6012
5097
  render() {
6013
- return h(Host, { key: "76874b06863ae2cab526de1f0e491bb04300c6fc" }, h("dialog", { key: "55b715d6d5fc6ee0c6a16df16c6374ca6e285aee", ref: (el) => this.dialog = el }, h("div", { key: "bab0ae4ed41bb5a909351866d92f0da330858691", class: "direct-upload-wrapper" }, h("div", { key: "23fe0a67bd942f5f4a53df1bd61bec8863104b2c", class: "direct-upload-content" }, h("h3", { key: "d2e349d855c046a541c9dc3ac837873bcd75da22" }, "Uploading your media"), this.uploads.map((upload) => h("progress-bar", { key: upload.id, class: {
6014
- "direct-upload--pending": upload.pending,
6015
- "direct-upload--complete": upload.complete,
6016
- "direct-upload--error": !!upload.error
6017
- }, percent: upload.percent, title: upload.error || void 0 }, upload.filename))))));
5098
+ return h(Host, { key: "76874b06863ae2cab526de1f0e491bb04300c6fc" }, h("dialog", { key: "55b715d6d5fc6ee0c6a16df16c6374ca6e285aee", ref: (e2) => this.dialog = e2 }, h("div", { key: "bab0ae4ed41bb5a909351866d92f0da330858691", class: "direct-upload-wrapper" }, h("div", { key: "23fe0a67bd942f5f4a53df1bd61bec8863104b2c", class: "direct-upload-content" }, h("h3", { key: "d2e349d855c046a541c9dc3ac837873bcd75da22" }, "Uploading your media"), this.uploads.map(((e2) => h("progress-bar", { key: e2.id, class: { "direct-upload--pending": e2.pending, "direct-upload--complete": e2.complete, "direct-upload--error": !!e2.error }, percent: e2.percent, title: e2.error || void 0 }, e2.filename)))))));
6018
5099
  }
6019
5100
  static get style() {
6020
- return uploadDialogCss;
6021
- }
6022
- }, [257, "upload-dialog", {
6023
- "uploads": [32],
6024
- "open": [64],
6025
- "close": [64],
6026
- "addUpload": [64],
6027
- "startUpload": [64],
6028
- "updateProgress": [64],
6029
- "setError": [64],
6030
- "completeUpload": [64],
6031
- "removeUpload": [64]
6032
- }]);
6033
- var UploadDialog2 = UploadDialog$1;
5101
+ return "dialog{border:none;padding:0;background:transparent;max-width:100vw;max-height:100vh}dialog::backdrop{background:transparent}.direct-upload-wrapper{position:fixed;z-index:9999;top:0;left:0;width:100vw;height:100vh;display:flex;align-items:center;justify-content:center;background:var(--input-attachment-overlay-bg, rgba(51, 51, 51, 0.9))}.direct-upload-content{display:block;background:var(--input-attachment-dialog-bg, #fcfcfc);color:var(--input-attachment-text-color, #000);padding:40px 60px 60px;border-radius:3px;width:60vw}.direct-upload-content h3{border-bottom:2px solid var(--input-attachment-dialog-border, #1f1f1f);margin-bottom:20px}.direct-upload--pending{opacity:0.6}.direct-upload--complete{opacity:0.4}.direct-upload--error{border-color:var(--input-attachment-error-color, red)}@media (prefers-color-scheme: dark){:host{--input-attachment-dialog-bg:#2a2a2a;--input-attachment-dialog-border:#555;--input-attachment-error-color:#f66}}";
5102
+ }
5103
+ }, [513, "upload-dialog", { uploads: [32], open: [64], close: [64], addUpload: [64], startUpload: [64], updateProgress: [64], setError: [64], completeUpload: [64], removeUpload: [64] }]);
5104
+ var c4 = d3;
6034
5105
 
6035
5106
  // dist/components/index.js
6036
- var defineCustomElements = (opts) => {
6037
- if (typeof customElements !== "undefined") {
6038
- [
6039
- AttachmentFile3,
6040
- AttachmentPreview3,
6041
- InputAttachment2,
6042
- UploadDialog2
6043
- ].forEach((cmp) => {
6044
- if (!customElements.get(cmp.is)) {
6045
- customElements.define(cmp.is, cmp, opts);
6046
- }
6047
- });
6048
- }
5107
+ var r = (r2) => {
5108
+ "undefined" != typeof customElements && [o, e, c3, c4].forEach(((e2) => {
5109
+ customElements.get(transformTag(e2.is)) || customElements.define(transformTag(e2.is), e2, r2);
5110
+ }));
6049
5111
  };
5112
+
5113
+ // src/entry.js
5114
+ r();
6050
5115
  export {
6051
- defineCustomElements,
5116
+ r as defineCustomElements,
6052
5117
  getAssetPath,
6053
5118
  render,
6054
5119
  setAssetPath,
@@ -6073,4 +5138,3 @@ export {
6073
5138
  * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
6074
5139
  *)
6075
5140
  */
6076
- defineCustomElements();