@gomusdev/web-components 0.0.21 → 0.0.23

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.
@@ -9,7 +9,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _a, _previous, _callbacks, _pending, _deferred, _neutered, _async_effects, _boundary_async_effects, _render_effects, _effects, _block_effects, _dirty_effects, _maybe_dirty_effects, _Batch_instances, traverse_effect_tree_fn, defer_effects_fn, commit_fn, _events, _instance, _data, _fetchStatus, _Shop_instances, defaultApiParams_get, _canFetch, _ensureFetch, _mode, _filters, _eventId, _museumIds, _exhibitionIds, _ticketIds, _selectedDate, _selectedTimeslot, _ticketGroups, _preCarts, _tickets, _preCart, _filters2, _ticketSelectionDetails, _ticketSelectionDetails2, _b, _document, _subscribe, _name, _key, _root, _variant, _prefix, _visibleMonths, _months, _weekdays, _initialPlaceholderYear, _defaultYears, _CalendarRootState_instances, setupInitialFocusEffect_fn, setupAccessibleHeadingEffect_fn, setupFormatterEffect_fn, _isNextButtonDisabled, _isPrevButtonDisabled, _isInvalid, _headingValue, _fullCalendarLabel, isMultipleSelectionValid_fn, _snippetProps, _props, _props2, _cellDate, _isUnavailable, _isDateToday, _isOutsideMonth, _isOutsideVisibleMonths, _isDisabled, _isFocusedDate, _isSelectedDate, _labelText, _snippetProps2, _ariaDisabled, _sharedDataAttrs, _props3, _tabindex, _snippetProps3, _props4, _isDisabled2, _props5, _isDisabled3, _props6, _props7, _props8, _props9, _props10, _props11, _props12, _startAt, _selected, _c, _details, _params, _ticketSelectionDetails3;
12
+ var _a, _previous, _callbacks, _pending, _deferred, _neutered, _async_effects, _boundary_async_effects, _render_effects, _effects, _block_effects, _dirty_effects, _maybe_dirty_effects, _Batch_instances, traverse_effect_tree_fn, defer_effects_fn, commit_fn, _events, _instance, _data, _fetchStatus, _Shop_instances, defaultApiParams_get, _canFetch, _ensureFetch, _fields, _form, _mode, _filters, _eventId, _museumIds, _exhibitionIds, _ticketIds, _selectedDate, _selectedTimeslot, _ticketGroups, _preCarts, _tickets, _preCart, _filters2, _ticketSelectionDetails, _ticketSelectionDetails2, _b, _document, _subscribe, _name, _key, _root, _variant, _prefix, _visibleMonths, _months, _weekdays, _initialPlaceholderYear, _defaultYears, _CalendarRootState_instances, setupInitialFocusEffect_fn, setupAccessibleHeadingEffect_fn, setupFormatterEffect_fn, _isNextButtonDisabled, _isPrevButtonDisabled, _isInvalid, _headingValue, _fullCalendarLabel, isMultipleSelectionValid_fn, _snippetProps, _props, _props2, _cellDate, _isUnavailable, _isDateToday, _isOutsideMonth, _isOutsideVisibleMonths, _isDisabled, _isFocusedDate, _isSelectedDate, _labelText, _snippetProps2, _ariaDisabled, _sharedDataAttrs, _props3, _tabindex, _snippetProps3, _props4, _isDisabled2, _props5, _isDisabled3, _props6, _props7, _props8, _props9, _props10, _props11, _props12, _startAt, _selected, _c, _details, _params, _ticketSelectionDetails3;
13
13
  const PUBLIC_VERSION = "5";
14
14
  if (typeof window !== "undefined") {
15
15
  ((_a = window.__svelte ?? (window.__svelte = {})).v ?? (_a.v = /* @__PURE__ */ new Set())).add(PUBLIC_VERSION);
@@ -260,9 +260,9 @@ function safe_equals(value) {
260
260
  }
261
261
  const empty = [];
262
262
  function snapshot(value, skip_warning = false) {
263
- return clone(value, /* @__PURE__ */ new Map(), "", empty);
263
+ return clone$1(value, /* @__PURE__ */ new Map(), "", empty);
264
264
  }
265
- function clone(value, cloned, path, paths, original = null) {
265
+ function clone$1(value, cloned, path, paths, original = null) {
266
266
  if (typeof value === "object" && value !== null) {
267
267
  var unwrapped = cloned.get(value);
268
268
  if (unwrapped !== void 0) return unwrapped;
@@ -286,7 +286,7 @@ function clone(value, cloned, path, paths, original = null) {
286
286
  for (var i = 0; i < value.length; i += 1) {
287
287
  var element = value[i];
288
288
  if (i in value) {
289
- copy[i] = clone(element, cloned, path, paths);
289
+ copy[i] = clone$1(element, cloned, path, paths);
290
290
  }
291
291
  }
292
292
  return copy;
@@ -298,7 +298,7 @@ function clone(value, cloned, path, paths, original = null) {
298
298
  cloned.set(original, copy);
299
299
  }
300
300
  for (var key in value) {
301
- copy[key] = clone(value[key], cloned, path, paths);
301
+ copy[key] = clone$1(value[key], cloned, path, paths);
302
302
  }
303
303
  return copy;
304
304
  }
@@ -310,7 +310,7 @@ function clone(value, cloned, path, paths, original = null) {
310
310
  }
311
311
  if (typeof /** @type {T & { toJSON?: any } } */
312
312
  value.toJSON === "function") {
313
- return clone(
313
+ return clone$1(
314
314
  /** @type {T & { toJSON(): any } } */
315
315
  value.toJSON(),
316
316
  cloned,
@@ -755,6 +755,7 @@ function unset_context() {
755
755
  }
756
756
  const batches = /* @__PURE__ */ new Set();
757
757
  let current_batch = null;
758
+ let previous_batch = null;
758
759
  let batch_deriveds = null;
759
760
  let effect_pending_updates = /* @__PURE__ */ new Set();
760
761
  let tasks = [];
@@ -862,6 +863,7 @@ const _Batch = class _Batch {
862
863
  process(root_effects) {
863
864
  var _a2;
864
865
  queued_root_effects = [];
866
+ previous_batch = null;
865
867
  var current_values = null;
866
868
  if (batches.size > 1) {
867
869
  current_values = /* @__PURE__ */ new Map();
@@ -890,6 +892,7 @@ const _Batch = class _Batch {
890
892
  __privateSet(this, _render_effects, []);
891
893
  __privateSet(this, _effects, []);
892
894
  __privateSet(this, _block_effects, []);
895
+ previous_batch = current_batch;
893
896
  current_batch = null;
894
897
  flush_queued_effects(render_effects);
895
898
  flush_queued_effects(effects);
@@ -938,6 +941,7 @@ const _Batch = class _Batch {
938
941
  }
939
942
  deactivate() {
940
943
  current_batch = null;
944
+ previous_batch = null;
941
945
  for (const update of effect_pending_updates) {
942
946
  effect_pending_updates.delete(update);
943
947
  update();
@@ -2572,7 +2576,7 @@ function from_html(content, flags) {
2572
2576
  return clone2;
2573
2577
  };
2574
2578
  }
2575
- function text(value = "") {
2579
+ function text$1(value = "") {
2576
2580
  if (!hydrating) {
2577
2581
  var t = create_text(value + "");
2578
2582
  assign_nodes(t, t);
@@ -3412,7 +3416,7 @@ function link(state2, prev, next2) {
3412
3416
  next2.e.prev = prev && prev.e;
3413
3417
  }
3414
3418
  }
3415
- function html(node, get_value, svg = false, mathml = false, skip_warning = false) {
3419
+ function html$2(node, get_value, svg2 = false, mathml = false, skip_warning = false) {
3416
3420
  var anchor = node;
3417
3421
  var value = "";
3418
3422
  template_effect(() => {
@@ -3452,10 +3456,10 @@ function html(node, get_value, svg = false, mathml = false, skip_warning = false
3452
3456
  return;
3453
3457
  }
3454
3458
  var html2 = value + "";
3455
- if (svg) html2 = `<svg>${html2}</svg>`;
3459
+ if (svg2) html2 = `<svg>${html2}</svg>`;
3456
3460
  else if (mathml) html2 = `<math>${html2}</math>`;
3457
3461
  var node2 = create_fragment_from_html(html2);
3458
- if (svg || mathml) {
3462
+ if (svg2 || mathml) {
3459
3463
  node2 = /** @type {Element} */
3460
3464
  /* @__PURE__ */ get_first_child(node2);
3461
3465
  }
@@ -3465,7 +3469,7 @@ function html(node, get_value, svg = false, mathml = false, skip_warning = false
3465
3469
  /** @type {TemplateNode} */
3466
3470
  node2.lastChild
3467
3471
  );
3468
- if (svg || mathml) {
3472
+ if (svg2 || mathml) {
3469
3473
  while (/* @__PURE__ */ get_first_child(node2)) {
3470
3474
  anchor.before(
3471
3475
  /** @type {Node} */
@@ -3477,6 +3481,22 @@ function html(node, get_value, svg = false, mathml = false, skip_warning = false
3477
3481
  }
3478
3482
  });
3479
3483
  }
3484
+ function slot(anchor, $$props, name, slot_props, fallback_fn) {
3485
+ var _a2;
3486
+ if (hydrating) {
3487
+ hydrate_next();
3488
+ }
3489
+ var slot_fn = (_a2 = $$props.$$slots) == null ? void 0 : _a2[name];
3490
+ var is_interop = false;
3491
+ if (slot_fn === true) {
3492
+ slot_fn = $$props["children"];
3493
+ is_interop = true;
3494
+ }
3495
+ if (slot_fn === void 0) ;
3496
+ else {
3497
+ slot_fn(anchor, is_interop ? () => slot_props : slot_props);
3498
+ }
3499
+ }
3480
3500
  function component(node, get_component, render_fn) {
3481
3501
  if (hydrating) {
3482
3502
  hydrate_next();
@@ -3566,6 +3586,9 @@ function clsx(value) {
3566
3586
  const whitespace = [..." \n\r\f \v\uFEFF"];
3567
3587
  function to_class(value, hash, directives) {
3568
3588
  var classname = value == null ? "" : "" + value;
3589
+ if (hash) {
3590
+ classname = classname ? classname + " " + hash : hash;
3591
+ }
3569
3592
  if (directives) {
3570
3593
  for (var key in directives) {
3571
3594
  if (directives[key]) {
@@ -3780,6 +3803,35 @@ function init_select(select) {
3780
3803
  observer.disconnect();
3781
3804
  });
3782
3805
  }
3806
+ function bind_select_value(select, get2, set2 = get2) {
3807
+ var mounting = true;
3808
+ listen_to_event_and_reset_event(select, "change", (is_reset) => {
3809
+ var query = is_reset ? "[selected]" : ":checked";
3810
+ var value;
3811
+ if (select.multiple) {
3812
+ value = [].map.call(select.querySelectorAll(query), get_option_value);
3813
+ } else {
3814
+ var selected_option = select.querySelector(query) ?? // will fall back to first non-disabled option if no option is selected
3815
+ select.querySelector("option:not([disabled])");
3816
+ value = selected_option && get_option_value(selected_option);
3817
+ }
3818
+ set2(value);
3819
+ });
3820
+ effect(() => {
3821
+ var value = get2();
3822
+ select_option(select, value, mounting);
3823
+ if (mounting && value === void 0) {
3824
+ var selected_option = select.querySelector(":checked");
3825
+ if (selected_option !== null) {
3826
+ value = get_option_value(selected_option);
3827
+ set2(value);
3828
+ }
3829
+ }
3830
+ select.__value = value;
3831
+ mounting = false;
3832
+ });
3833
+ init_select(select);
3834
+ }
3783
3835
  function get_option_value(option) {
3784
3836
  if ("__value" in option) {
3785
3837
  return option.__value;
@@ -3841,6 +3893,36 @@ function set_attribute(element, attribute, value, skip_warning) {
3841
3893
  element.setAttribute(attribute, value);
3842
3894
  }
3843
3895
  }
3896
+ function set_custom_element_data(node, prop2, value) {
3897
+ var previous_reaction = active_reaction;
3898
+ var previous_effect = active_effect;
3899
+ let was_hydrating = hydrating;
3900
+ if (hydrating) {
3901
+ set_hydrating(false);
3902
+ }
3903
+ set_active_reaction(null);
3904
+ set_active_effect(null);
3905
+ try {
3906
+ if (
3907
+ // `style` should use `set_attribute` rather than the setter
3908
+ prop2 !== "style" && // Don't compute setters for custom elements while they aren't registered yet,
3909
+ // because during their upgrade/instantiation they might add more setters.
3910
+ // Instead, fall back to a simple "an object, then set as property" heuristic.
3911
+ (setters_cache.has(node.nodeName) || // customElements may not be available in browser extension contexts
3912
+ !customElements || customElements.get(node.tagName.toLowerCase()) ? get_setters(node).includes(prop2) : value && typeof value === "object")
3913
+ ) {
3914
+ node[prop2] = value;
3915
+ } else {
3916
+ set_attribute(node, prop2, value == null ? value : String(value));
3917
+ }
3918
+ } finally {
3919
+ set_active_reaction(previous_reaction);
3920
+ set_active_effect(previous_effect);
3921
+ if (was_hydrating) {
3922
+ set_hydrating(true);
3923
+ }
3924
+ }
3925
+ }
3844
3926
  function set_attributes(element, prev, next2, css_hash, skip_warning = false) {
3845
3927
  var attributes = get_attributes(element);
3846
3928
  var is_custom_element = attributes[IS_CUSTOM_ELEMENT];
@@ -4053,6 +4135,60 @@ function get_setters(element) {
4053
4135
  }
4054
4136
  return setters;
4055
4137
  }
4138
+ function bind_value(input, get2, set2 = get2) {
4139
+ var runes = is_runes();
4140
+ var batches2 = /* @__PURE__ */ new WeakSet();
4141
+ listen_to_event_and_reset_event(input, "input", (is_reset) => {
4142
+ var value = is_reset ? input.defaultValue : input.value;
4143
+ value = is_numberlike_input(input) ? to_number(value) : value;
4144
+ set2(value);
4145
+ if (current_batch !== null) {
4146
+ batches2.add(current_batch);
4147
+ }
4148
+ if (runes && value !== (value = get2())) {
4149
+ var start = input.selectionStart;
4150
+ var end = input.selectionEnd;
4151
+ input.value = value ?? "";
4152
+ if (end !== null) {
4153
+ input.selectionStart = start;
4154
+ input.selectionEnd = Math.min(end, input.value.length);
4155
+ }
4156
+ }
4157
+ });
4158
+ if (
4159
+ // If we are hydrating and the value has since changed,
4160
+ // then use the updated value from the input instead.
4161
+ hydrating && input.defaultValue !== input.value || // If defaultValue is set, then value == defaultValue
4162
+ // TODO Svelte 6: remove input.value check and set to empty string?
4163
+ untrack(get2) == null && input.value
4164
+ ) {
4165
+ set2(is_numberlike_input(input) ? to_number(input.value) : input.value);
4166
+ if (current_batch !== null) {
4167
+ batches2.add(current_batch);
4168
+ }
4169
+ }
4170
+ render_effect(() => {
4171
+ var value = get2();
4172
+ if (input === document.activeElement) {
4173
+ var batch = (
4174
+ /** @type {Batch} */
4175
+ previous_batch ?? current_batch
4176
+ );
4177
+ if (batches2.has(batch)) {
4178
+ return;
4179
+ }
4180
+ }
4181
+ if (is_numberlike_input(input) && value === to_number(input.value)) {
4182
+ return;
4183
+ }
4184
+ if (input.type === "date" && !value && !input.value) {
4185
+ return;
4186
+ }
4187
+ if (value !== input.value) {
4188
+ input.value = value ?? "";
4189
+ }
4190
+ });
4191
+ }
4056
4192
  const pending = /* @__PURE__ */ new Set();
4057
4193
  function bind_group(inputs, group_index, input, get2, set2 = get2) {
4058
4194
  var is_checkbox = input.getAttribute("type") === "checkbox";
@@ -4116,6 +4252,24 @@ function bind_group(inputs, group_index, input, get2, set2 = get2) {
4116
4252
  }
4117
4253
  });
4118
4254
  }
4255
+ function bind_checked(input, get2, set2 = get2) {
4256
+ listen_to_event_and_reset_event(input, "change", (is_reset) => {
4257
+ var value = is_reset ? input.defaultChecked : input.checked;
4258
+ set2(value);
4259
+ });
4260
+ if (
4261
+ // If we are hydrating and the value has since changed,
4262
+ // then use the update value from the input instead.
4263
+ hydrating && input.defaultChecked !== input.checked || // If defaultChecked is set, then checked == defaultChecked
4264
+ untrack(get2) == null
4265
+ ) {
4266
+ set2(input.checked);
4267
+ }
4268
+ render_effect(() => {
4269
+ var value = get2();
4270
+ input.checked = Boolean(value);
4271
+ });
4272
+ }
4119
4273
  function get_binding_group_value(group, __value, checked) {
4120
4274
  var value = /* @__PURE__ */ new Set();
4121
4275
  for (var i = 0; i < group.length; i += 1) {
@@ -4128,6 +4282,13 @@ function get_binding_group_value(group, __value, checked) {
4128
4282
  }
4129
4283
  return Array.from(value);
4130
4284
  }
4285
+ function is_numberlike_input(input) {
4286
+ var type = input.type;
4287
+ return type === "number" || type === "range";
4288
+ }
4289
+ function to_number(value) {
4290
+ return value === "" ? null : +value;
4291
+ }
4131
4292
  function is_bound_this(bound_value, element_or_component) {
4132
4293
  return bound_value === element_or_component || (bound_value == null ? void 0 : bound_value[STATE_SYMBOL]) === element_or_component;
4133
4294
  }
@@ -4603,9 +4764,9 @@ if (typeof HTMLElement === "function") {
4603
4764
  if (!this.$$c) {
4604
4765
  let create_slot2 = function(name) {
4605
4766
  return (anchor) => {
4606
- const slot = document.createElement("slot");
4607
- if (name !== "default") slot.name = name;
4608
- append(anchor, slot);
4767
+ const slot2 = document.createElement("slot");
4768
+ if (name !== "default") slot2.name = name;
4769
+ append(anchor, slot2);
4609
4770
  };
4610
4771
  };
4611
4772
  var create_slot = create_slot2;
@@ -9410,13 +9571,13 @@ class ZodPipeline extends ZodType {
9410
9571
  class ZodReadonly extends ZodType {
9411
9572
  _parse(input) {
9412
9573
  const result = this._def.innerType._parse(input);
9413
- const freeze = (data) => {
9574
+ const freeze2 = (data) => {
9414
9575
  if (isValid(data)) {
9415
9576
  data.value = Object.freeze(data.value);
9416
9577
  }
9417
9578
  return data;
9418
9579
  };
9419
- return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
9580
+ return isAsync(result) ? result.then((data) => freeze2(data)) : freeze2(result);
9420
9581
  }
9421
9582
  unwrap() {
9422
9583
  return this._def.innerType;
@@ -11311,11 +11472,11 @@ function formatCurrency(priceCents) {
11311
11472
  priceCents = priceCents ?? 0;
11312
11473
  return new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(priceCents / 100);
11313
11474
  }
11314
- var root_4$1 = /* @__PURE__ */ from_html(`<span> </span>`);
11315
- var root_3$2 = /* @__PURE__ */ from_html(`<span> </span> <!>`, 1);
11475
+ var root_4$2 = /* @__PURE__ */ from_html(`<span> </span>`);
11476
+ var root_3$4 = /* @__PURE__ */ from_html(`<span> </span> <!>`, 1);
11316
11477
  var on_click = (_, cartItem) => cart.deleteItem(get(cartItem));
11317
- var root_2$g = /* @__PURE__ */ from_html(`<li data-go-cart-item=""><article><ul><li data-go-cart-item-title=""> <!></li> <li data-go-cart-item-price=""> </li> <li data-go-cart-item-count=""> </li> <li data-go-cart-item-remove=""><button>⨉</button></li> <li data-go-cart-item-sum=""> </li></ul></article></li>`);
11318
- var root_1$3 = /* @__PURE__ */ from_html(`<ol data-testid="cart"><li data-go-cart-header="" data-testid="cart-header"><ul><li data-go-cart-item-title="">Product</li> <li data-go-cart-item-price="">Price</li> <li data-go-cart-item-count="">Count</li> <li data-go-cart-item-remove="">remove</li> <li data-go-cart-item-sum="">Sum</li></ul></li> <!> <li data-go-cart-footer="" data-testid="cart-footer"><ul><li data-go-cart-item-title=""></li> <li data-go-cart-item-price=""></li> <li data-go-cart-item-count=""></li> <li data-go-cart-item-remove=""></li> <li data-go-cart-item-sum="" data-go-cart-sum=""> </li></ul></li></ol>`);
11478
+ var root_2$j = /* @__PURE__ */ from_html(`<li data-go-cart-item=""><article><ul><li data-go-cart-item-title=""> <!></li> <li data-go-cart-item-price=""> </li> <li data-go-cart-item-count=""> </li> <li data-go-cart-item-remove=""><button>⨉</button></li> <li data-go-cart-item-sum=""> </li></ul></article></li>`);
11479
+ var root_1$9 = /* @__PURE__ */ from_html(`<ol data-testid="cart"><li data-go-cart-header="" data-testid="cart-header"><ul><li data-go-cart-item-title="">Product</li> <li data-go-cart-item-price="">Price</li> <li data-go-cart-item-count="">Count</li> <li data-go-cart-item-remove="">remove</li> <li data-go-cart-item-sum="">Sum</li></ul></li> <!> <li data-go-cart-footer="" data-testid="cart-footer"><ul><li data-go-cart-item-title=""></li> <li data-go-cart-item-price=""></li> <li data-go-cart-item-count=""></li> <li data-go-cart-item-remove=""></li> <li data-go-cart-item-sum="" data-go-cart-sum=""> </li></ul></li></ol>`);
11319
11480
  function Cart($$anchor, $$props) {
11320
11481
  push($$props, false);
11321
11482
  init();
@@ -11323,10 +11484,10 @@ function Cart($$anchor, $$props) {
11323
11484
  var node = first_child(fragment);
11324
11485
  {
11325
11486
  var consequent_2 = ($$anchor2) => {
11326
- var ol = root_1$3();
11487
+ var ol = root_1$9();
11327
11488
  var node_1 = sibling(child(ol), 2);
11328
11489
  each(node_1, 1, () => cart.items, (cartItem) => cartItem.uuid, ($$anchor3, cartItem) => {
11329
- var li = root_2$g();
11490
+ var li = root_2$j();
11330
11491
  var article = child(li);
11331
11492
  var ul = child(article);
11332
11493
  var li_1 = child(ul);
@@ -11334,14 +11495,14 @@ function Cart($$anchor, $$props) {
11334
11495
  var node_2 = sibling(text2);
11335
11496
  {
11336
11497
  var consequent_1 = ($$anchor4) => {
11337
- var fragment_1 = root_3$2();
11498
+ var fragment_1 = root_3$4();
11338
11499
  var span = first_child(fragment_1);
11339
11500
  var text_1 = child(span, true);
11340
11501
  reset(span);
11341
11502
  var node_3 = sibling(span, 2);
11342
11503
  {
11343
11504
  var consequent = ($$anchor5) => {
11344
- var span_1 = root_4$1();
11505
+ var span_1 = root_4$2();
11345
11506
  var text_2 = child(span_1, true);
11346
11507
  reset(span_1);
11347
11508
  template_effect(($0) => set_text(text_2, $0), [() => formatTime(get(cartItem).attributes.time)]);
@@ -11501,13 +11662,263 @@ customElements.define("go-init", create_custom_element(
11501
11662
  [],
11502
11663
  false
11503
11664
  ));
11504
- function evaluateExpression(expression, data) {
11505
- try {
11506
- const func = new Function("data", `return ${expression};`);
11507
- return func(data);
11508
- } catch (error) {
11509
- console.log(`Error while evaluating when in go-if: ${error.message}`);
11665
+ function createField(data) {
11666
+ const field = proxy({
11667
+ ...data,
11668
+ errors: data.errors || [],
11669
+ value: data.value ?? "",
11670
+ options: data.options ?? [],
11671
+ autocomplete: data.autocomplete ?? "",
11672
+ checked: data.checked ?? false,
11673
+ placeholder: data.placeholder ?? "",
11674
+ description: data.description ?? "",
11675
+ mounted: data.mounted ?? false,
11676
+ validate: () => {
11677
+ validateField(field);
11678
+ }
11679
+ });
11680
+ if (field.type === "checkbox") {
11681
+ user_effect(() => {
11682
+ field.value = "" + field.checked;
11683
+ });
11684
+ }
11685
+ return field;
11686
+ }
11687
+ function validateField(field) {
11688
+ if (!field.validator) return;
11689
+ const validation = field.validator.safeParse(field.value);
11690
+ if (!validation.success) {
11691
+ field.errors = validation.error.format()._errors;
11692
+ } else {
11693
+ field.errors = [];
11694
+ }
11695
+ }
11696
+ var allFields = {
11697
+ salutation: {
11698
+ id: "salutation",
11699
+ type: "select",
11700
+ label: "Please choose",
11701
+ placeholder: "",
11702
+ required: true,
11703
+ description: "",
11704
+ autocomplete: "honorific-prefix",
11705
+ options: [
11706
+ { value: "mr", label: "Mr." },
11707
+ { value: "ms", label: "Ms." },
11708
+ { value: "other", label: "Other" }
11709
+ ],
11710
+ validator: z.string().min(1, "Salutation is required")
11711
+ },
11712
+ firstName: {
11713
+ id: "firstName",
11714
+ type: "text",
11715
+ label: "First name",
11716
+ placeholder: "",
11717
+ required: true,
11718
+ description: "",
11719
+ autocomplete: "given-name",
11720
+ validator: z.string().min(1, "First name is required")
11721
+ },
11722
+ lastName: {
11723
+ id: "lastName",
11724
+ type: "text",
11725
+ label: "Last name",
11726
+ placeholder: "",
11727
+ required: true,
11728
+ description: "",
11729
+ autocomplete: "family-name",
11730
+ validator: z.string().min(1, "Last name is required")
11731
+ },
11732
+ email: {
11733
+ id: "email",
11734
+ type: "email",
11735
+ label: "E-mail",
11736
+ placeholder: "",
11737
+ required: true,
11738
+ description: "",
11739
+ autocomplete: "email",
11740
+ validator: z.string().email("Invalid email")
11741
+ },
11742
+ confirmEmail: {
11743
+ id: "confirmEmail",
11744
+ type: "email",
11745
+ label: "Confirm E-mail",
11746
+ placeholder: "",
11747
+ required: true,
11748
+ description: "",
11749
+ autocomplete: "email",
11750
+ validator: z.string().email("Invalid email").min(1, "Please confirm your email")
11751
+ },
11752
+ password: {
11753
+ id: "password",
11754
+ type: "password",
11755
+ label: "Password",
11756
+ placeholder: "",
11757
+ required: true,
11758
+ description: "",
11759
+ autocomplete: "new-password",
11760
+ validator: z.string().min(6, "Password must be at least 6 characters")
11761
+ },
11762
+ confirmPassword: {
11763
+ id: "confirmPassword",
11764
+ type: "password",
11765
+ label: "Confirm password",
11766
+ placeholder: "",
11767
+ required: true,
11768
+ description: "",
11769
+ autocomplete: "new-password",
11770
+ validator: z.string().min(6, "Please confirm your password")
11771
+ },
11772
+ addressee: {
11773
+ id: "addressee",
11774
+ type: "text",
11775
+ label: "Addressee",
11776
+ placeholder: "",
11777
+ required: true,
11778
+ description: "",
11779
+ autocomplete: "name",
11780
+ validator: z.string().min(1, "Addressee is required")
11781
+ },
11782
+ street: {
11783
+ id: "street",
11784
+ type: "text",
11785
+ label: "Street",
11786
+ placeholder: "",
11787
+ required: true,
11788
+ description: "",
11789
+ autocomplete: "street-address",
11790
+ validator: z.string().min(1, "Street is required")
11791
+ },
11792
+ postcode: {
11793
+ id: "postcode",
11794
+ type: "text",
11795
+ label: "Postcode",
11796
+ placeholder: "",
11797
+ required: true,
11798
+ description: "",
11799
+ autocomplete: "postal-code",
11800
+ validator: z.string().min(1, "Postcode is required")
11801
+ },
11802
+ city: {
11803
+ id: "city",
11804
+ type: "text",
11805
+ label: "City",
11806
+ placeholder: "",
11807
+ required: true,
11808
+ description: "",
11809
+ autocomplete: "address-level2",
11810
+ validator: z.string().min(1, "City is required")
11811
+ },
11812
+ country: {
11813
+ id: "country",
11814
+ type: "select",
11815
+ label: "Country",
11816
+ placeholder: "",
11817
+ required: true,
11818
+ description: "",
11819
+ autocomplete: "country",
11820
+ options: [
11821
+ { value: "de", label: "Germany" },
11822
+ { value: "at", label: "Austria" },
11823
+ { value: "ch", label: "Switzerland" }
11824
+ ],
11825
+ validator: z.string().min(1, "Country is required")
11826
+ },
11827
+ gender: {
11828
+ id: "gender",
11829
+ type: "select",
11830
+ label: "Gender",
11831
+ placeholder: "",
11832
+ required: true,
11833
+ description: "",
11834
+ autocomplete: "sex",
11835
+ options: [
11836
+ { value: "female", label: "Female" },
11837
+ { value: "male", label: "Male" },
11838
+ { value: "third", label: "Third Gender" },
11839
+ { value: "unspecified", label: "Not Specified" }
11840
+ ],
11841
+ validator: z.string().min(1, "Gender is required")
11842
+ },
11843
+ forWhom: {
11844
+ id: "forWhom",
11845
+ type: "select",
11846
+ label: "For Whom",
11847
+ placeholder: "",
11848
+ required: true,
11849
+ description: "",
11850
+ autocomplete: "",
11851
+ options: [
11852
+ { value: "for_me", label: "For Me" },
11853
+ { value: "as_a_gift", label: "As a Gift" }
11854
+ ]
11855
+ },
11856
+ language: {
11857
+ id: "language",
11858
+ type: "select",
11859
+ label: "Language",
11860
+ placeholder: "",
11861
+ required: true,
11862
+ description: "",
11863
+ autocomplete: "language",
11864
+ options: [
11865
+ { value: "de", label: "German" },
11866
+ { value: "en", label: "English" }
11867
+ ],
11868
+ validator: z.string().min(1, "Language is required")
11869
+ },
11870
+ acceptTerms: {
11871
+ id: "acceptTerms",
11872
+ type: "checkbox",
11873
+ label: "I agree to the Terms",
11874
+ placeholder: "",
11875
+ required: true,
11876
+ description: "",
11877
+ autocomplete: "off",
11878
+ validator: z.string().refine((val) => val === "true", {
11879
+ message: "Accepting the terms and conditions is mandatory"
11880
+ })
11881
+ },
11882
+ rememberMe: {
11883
+ id: "rememberMe",
11884
+ type: "checkbox",
11885
+ label: "Remember me",
11886
+ placeholder: "",
11887
+ required: false,
11888
+ description: "",
11889
+ autocomplete: "off",
11890
+ validator: z.boolean()
11891
+ }
11892
+ };
11893
+ const formsSvelte = {
11894
+ signup: ["firstName", "lastName", "email", "password", "acceptTerms"],
11895
+ login: ["email", "password", "rememberMe"],
11896
+ ticketPersonalization: [
11897
+ "forWhom",
11898
+ "email",
11899
+ "gender",
11900
+ "firstName",
11901
+ "lastName",
11902
+ "country",
11903
+ "postcode",
11904
+ "city",
11905
+ "street"
11906
+ ],
11907
+ custom: Object.keys(allFields)
11908
+ };
11909
+ function formFields(formId) {
11910
+ if (!formsSvelte[formId]) {
11911
+ throw new Error(`Form ${formId} not found`);
11510
11912
  }
11913
+ return formsSvelte[formId].map((fid) => createField(allFields[fid]));
11914
+ }
11915
+ function errors(fields) {
11916
+ if (!fields) return 0;
11917
+ const ret = fields.filter((f) => {
11918
+ var _a2;
11919
+ return f.mounted && ((_a2 = f.errors) == null ? void 0 : _a2.length);
11920
+ }).length;
11921
+ return ret;
11511
11922
  }
11512
11923
  function createSetDetails(KEY2) {
11513
11924
  return function(host, details) {
@@ -11530,83 +11941,1653 @@ function createGetDetails(KEY2) {
11530
11941
  }
11531
11942
  };
11532
11943
  }
11533
- const validTicketSelectionFilters = ["timeslot", "normal", "annual"];
11534
- let lastUId = 0;
11535
- class TicketSelectionDetails {
11536
- constructor() {
11537
- __publicField(this, "uid", lastUId++);
11538
- __privateAdd(this, _mode, /* @__PURE__ */ state());
11539
- __privateAdd(this, _filters, /* @__PURE__ */ state());
11540
- __privateAdd(this, _eventId, /* @__PURE__ */ state());
11541
- __privateAdd(this, _museumIds, /* @__PURE__ */ state());
11542
- __privateAdd(this, _exhibitionIds, /* @__PURE__ */ state());
11543
- __privateAdd(this, _ticketIds, /* @__PURE__ */ state());
11544
- __privateAdd(this, _selectedDate, /* @__PURE__ */ state());
11545
- __privateAdd(this, _selectedTimeslot, /* @__PURE__ */ state());
11546
- __privateAdd(this, _ticketGroups, /* @__PURE__ */ state(proxy([])));
11547
- __privateAdd(this, _preCarts, /* @__PURE__ */ user_derived(() => this.ticketGroups.map((tg) => tg.preCart)));
11548
- }
11549
- get mode() {
11550
- return get(__privateGet(this, _mode));
11944
+ class DetailsSvelte {
11945
+ constructor(formId) {
11946
+ __privateAdd(this, _fields, /* @__PURE__ */ state(proxy([])));
11947
+ __privateAdd(this, _form, /* @__PURE__ */ state());
11948
+ const _fields2 = /* @__PURE__ */ user_derived(() => formFields(formId));
11949
+ set(__privateGet(this, _fields), get(_fields2), true);
11551
11950
  }
11552
- set mode(value) {
11553
- set(__privateGet(this, _mode), value, true);
11554
- }
11555
- get filters() {
11556
- return get(__privateGet(this, _filters));
11557
- }
11558
- set filters(value) {
11559
- set(__privateGet(this, _filters), value, true);
11951
+ get form() {
11952
+ return get(__privateGet(this, _form));
11560
11953
  }
11561
- get eventId() {
11562
- return get(__privateGet(this, _eventId));
11954
+ set form(value) {
11955
+ set(__privateGet(this, _form), value, true);
11563
11956
  }
11564
- set eventId(value) {
11565
- set(__privateGet(this, _eventId), value, true);
11957
+ get fields() {
11958
+ return get(__privateGet(this, _fields));
11566
11959
  }
11567
- get museumIds() {
11568
- return get(__privateGet(this, _museumIds));
11960
+ getField(id) {
11961
+ return get(__privateGet(this, _fields)).find((f) => f.id == id);
11569
11962
  }
11570
- set museumIds(value) {
11571
- set(__privateGet(this, _museumIds), value, true);
11963
+ }
11964
+ _fields = new WeakMap();
11965
+ _form = new WeakMap();
11966
+ const KEY$2 = "go-request-form";
11967
+ const setDetails = createSetDetails(KEY$2);
11968
+ const getDetails = createGetDetails(KEY$2);
11969
+ function wrapInElement(host, tag, props) {
11970
+ var _a2;
11971
+ const first = host.firstElementChild;
11972
+ if (((_a2 = host.children) == null ? void 0 : _a2.length) === 1 && (first == null ? void 0 : first.tagName.toLowerCase()) === tag) {
11973
+ return first;
11572
11974
  }
11573
- get exhibitionIds() {
11574
- return get(__privateGet(this, _exhibitionIds));
11975
+ const element = document.createElement(tag);
11976
+ if (props) {
11977
+ Object.entries(props).forEach(([key, value]) => {
11978
+ if (typeof value === "boolean") {
11979
+ if (value) {
11980
+ element.setAttribute(key, "");
11981
+ }
11982
+ } else {
11983
+ element.setAttribute(key, value);
11984
+ }
11985
+ });
11575
11986
  }
11576
- set exhibitionIds(value) {
11577
- set(__privateGet(this, _exhibitionIds), value, true);
11987
+ const frag = document.createDocumentFragment();
11988
+ while (host.firstChild) frag.appendChild(host.firstChild);
11989
+ element.appendChild(frag);
11990
+ host.replaceChildren(element);
11991
+ return element;
11992
+ }
11993
+ var root_1$8 = /* @__PURE__ */ from_html(`<go-all-fields></go-all-fields> <go-form-feedback><go-errors-feedback></go-errors-feedback> <go-success-feedback></go-success-feedback></go-form-feedback> <go-submit>Submit</go-submit>`, 3);
11994
+ function Form($$anchor, $$props) {
11995
+ push($$props, true);
11996
+ let formId = prop($$props, "formId", 7), custom2 = prop($$props, "custom", 7);
11997
+ const details = new DetailsSvelte(formId());
11998
+ setDetails($$props.$$host, details);
11999
+ function handleSubmit(event) {
12000
+ var _a2, _b2;
12001
+ event.preventDefault();
12002
+ details.fields.forEach((f) => {
12003
+ f.validate();
12004
+ });
12005
+ (_a2 = details == null ? void 0 : details.form) == null ? void 0 : _a2.dispatchEvent(new Event("after-validation", event));
12006
+ if (errors(details.fields) === 0) {
12007
+ (_b2 = details == null ? void 0 : details.form) == null ? void 0 : _b2.dispatchEvent(new Event("success", event));
12008
+ }
11578
12009
  }
11579
- get ticketIds() {
11580
- return get(__privateGet(this, _ticketIds));
12010
+ onMount(() => {
12011
+ const form = wrapInElement($$props.$$host, "form", { novalidate: true });
12012
+ form.addEventListener("submit", handleSubmit);
12013
+ details.form = form;
12014
+ });
12015
+ var fragment = comment();
12016
+ var node = first_child(fragment);
12017
+ {
12018
+ var consequent = ($$anchor2) => {
12019
+ var fragment_1 = root_1$8();
12020
+ var go_all_fields = first_child(fragment_1);
12021
+ var go_form_feedback = sibling(go_all_fields, 2);
12022
+ sibling(go_form_feedback, 2);
12023
+ append($$anchor2, fragment_1);
12024
+ };
12025
+ if_block(node, ($$render) => {
12026
+ if (!custom2()) $$render(consequent);
12027
+ });
11581
12028
  }
11582
- set ticketIds(value) {
11583
- set(__privateGet(this, _ticketIds), value, true);
12029
+ append($$anchor, fragment);
12030
+ return pop({
12031
+ details,
12032
+ get formId() {
12033
+ return formId();
12034
+ },
12035
+ set formId($$value) {
12036
+ formId($$value);
12037
+ flushSync();
12038
+ },
12039
+ get custom() {
12040
+ return custom2();
12041
+ },
12042
+ set custom($$value) {
12043
+ custom2($$value);
12044
+ flushSync();
12045
+ }
12046
+ });
12047
+ }
12048
+ customElements.define("go-form", create_custom_element(
12049
+ Form,
12050
+ {
12051
+ formId: { attribute: "form-id", reflect: true, type: "String" },
12052
+ custom: { attribute: "custom", reflect: true, type: "Boolean" }
12053
+ },
12054
+ [],
12055
+ ["details"],
12056
+ false
12057
+ ));
12058
+ var root$5 = /* @__PURE__ */ from_html(`<go-form><!></go-form>`, 2);
12059
+ function Signup($$anchor, $$props) {
12060
+ push($$props, true);
12061
+ let custom2 = prop($$props, "custom", 7, false);
12062
+ var go_form = root$5();
12063
+ set_custom_element_data(go_form, "formId", "signup");
12064
+ template_effect(() => set_custom_element_data(go_form, "custom", custom2()));
12065
+ var node = child(go_form);
12066
+ slot(node, $$props, "default", {});
12067
+ reset(go_form);
12068
+ append($$anchor, go_form);
12069
+ return pop({
12070
+ get custom() {
12071
+ return custom2();
12072
+ },
12073
+ set custom($$value = false) {
12074
+ custom2($$value);
12075
+ flushSync();
12076
+ }
12077
+ });
12078
+ }
12079
+ customElements.define("go-signup-form", create_custom_element(
12080
+ Signup,
12081
+ {
12082
+ custom: { attribute: "custom", reflect: true, type: "Boolean" }
12083
+ },
12084
+ ["default"],
12085
+ [],
12086
+ true
12087
+ ));
12088
+ /*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */
12089
+ const {
12090
+ entries,
12091
+ setPrototypeOf,
12092
+ isFrozen,
12093
+ getPrototypeOf,
12094
+ getOwnPropertyDescriptor
12095
+ } = Object;
12096
+ let {
12097
+ freeze,
12098
+ seal,
12099
+ create
12100
+ } = Object;
12101
+ let {
12102
+ apply,
12103
+ construct
12104
+ } = typeof Reflect !== "undefined" && Reflect;
12105
+ if (!freeze) {
12106
+ freeze = function freeze2(x) {
12107
+ return x;
12108
+ };
12109
+ }
12110
+ if (!seal) {
12111
+ seal = function seal2(x) {
12112
+ return x;
12113
+ };
12114
+ }
12115
+ if (!apply) {
12116
+ apply = function apply2(fun, thisValue, args) {
12117
+ return fun.apply(thisValue, args);
12118
+ };
12119
+ }
12120
+ if (!construct) {
12121
+ construct = function construct2(Func, args) {
12122
+ return new Func(...args);
12123
+ };
12124
+ }
12125
+ const arrayForEach = unapply(Array.prototype.forEach);
12126
+ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
12127
+ const arrayPop = unapply(Array.prototype.pop);
12128
+ const arrayPush = unapply(Array.prototype.push);
12129
+ const arraySplice = unapply(Array.prototype.splice);
12130
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
12131
+ const stringToString = unapply(String.prototype.toString);
12132
+ const stringMatch = unapply(String.prototype.match);
12133
+ const stringReplace = unapply(String.prototype.replace);
12134
+ const stringIndexOf = unapply(String.prototype.indexOf);
12135
+ const stringTrim = unapply(String.prototype.trim);
12136
+ const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
12137
+ const regExpTest = unapply(RegExp.prototype.test);
12138
+ const typeErrorCreate = unconstruct(TypeError);
12139
+ function unapply(func) {
12140
+ return function(thisArg) {
12141
+ if (thisArg instanceof RegExp) {
12142
+ thisArg.lastIndex = 0;
12143
+ }
12144
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key2 = 1; _key2 < _len; _key2++) {
12145
+ args[_key2 - 1] = arguments[_key2];
12146
+ }
12147
+ return apply(func, thisArg, args);
12148
+ };
12149
+ }
12150
+ function unconstruct(func) {
12151
+ return function() {
12152
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
12153
+ args[_key2] = arguments[_key2];
12154
+ }
12155
+ return construct(func, args);
12156
+ };
12157
+ }
12158
+ function addToSet(set2, array) {
12159
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
12160
+ if (setPrototypeOf) {
12161
+ setPrototypeOf(set2, null);
12162
+ }
12163
+ let l = array.length;
12164
+ while (l--) {
12165
+ let element = array[l];
12166
+ if (typeof element === "string") {
12167
+ const lcElement = transformCaseFunc(element);
12168
+ if (lcElement !== element) {
12169
+ if (!isFrozen(array)) {
12170
+ array[l] = lcElement;
12171
+ }
12172
+ element = lcElement;
12173
+ }
12174
+ }
12175
+ set2[element] = true;
11584
12176
  }
11585
- get selectedDate() {
11586
- return get(__privateGet(this, _selectedDate));
12177
+ return set2;
12178
+ }
12179
+ function cleanArray(array) {
12180
+ for (let index2 = 0; index2 < array.length; index2++) {
12181
+ const isPropertyExist = objectHasOwnProperty(array, index2);
12182
+ if (!isPropertyExist) {
12183
+ array[index2] = null;
12184
+ }
11587
12185
  }
11588
- set selectedDate(value) {
11589
- set(__privateGet(this, _selectedDate), value, true);
12186
+ return array;
12187
+ }
12188
+ function clone(object) {
12189
+ const newObject = create(null);
12190
+ for (const [property, value] of entries(object)) {
12191
+ const isPropertyExist = objectHasOwnProperty(object, property);
12192
+ if (isPropertyExist) {
12193
+ if (Array.isArray(value)) {
12194
+ newObject[property] = cleanArray(value);
12195
+ } else if (value && typeof value === "object" && value.constructor === Object) {
12196
+ newObject[property] = clone(value);
12197
+ } else {
12198
+ newObject[property] = value;
12199
+ }
12200
+ }
11590
12201
  }
11591
- get selectedTimeslot() {
11592
- return get(__privateGet(this, _selectedTimeslot));
12202
+ return newObject;
12203
+ }
12204
+ function lookupGetter(object, prop2) {
12205
+ while (object !== null) {
12206
+ const desc = getOwnPropertyDescriptor(object, prop2);
12207
+ if (desc) {
12208
+ if (desc.get) {
12209
+ return unapply(desc.get);
12210
+ }
12211
+ if (typeof desc.value === "function") {
12212
+ return unapply(desc.value);
12213
+ }
12214
+ }
12215
+ object = getPrototypeOf(object);
11593
12216
  }
11594
- set selectedTimeslot(value) {
11595
- set(__privateGet(this, _selectedTimeslot), value, true);
12217
+ function fallbackValue() {
12218
+ return null;
11596
12219
  }
11597
- get ticketGroups() {
11598
- return get(__privateGet(this, _ticketGroups));
12220
+ return fallbackValue;
12221
+ }
12222
+ const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
12223
+ const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
12224
+ const svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]);
12225
+ const svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]);
12226
+ const mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]);
12227
+ const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
12228
+ const text = freeze(["#text"]);
12229
+ const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]);
12230
+ const svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
12231
+ const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
12232
+ const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
12233
+ const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
12234
+ const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
12235
+ const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm);
12236
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
12237
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
12238
+ const IS_ALLOWED_URI = seal(
12239
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
12240
+ // eslint-disable-line no-useless-escape
12241
+ );
12242
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
12243
+ const ATTR_WHITESPACE = seal(
12244
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
12245
+ // eslint-disable-line no-control-regex
12246
+ );
12247
+ const DOCTYPE_NAME = seal(/^html$/i);
12248
+ const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
12249
+ var EXPRESSIONS = /* @__PURE__ */ Object.freeze({
12250
+ __proto__: null,
12251
+ ARIA_ATTR,
12252
+ ATTR_WHITESPACE,
12253
+ CUSTOM_ELEMENT,
12254
+ DATA_ATTR,
12255
+ DOCTYPE_NAME,
12256
+ ERB_EXPR,
12257
+ IS_ALLOWED_URI,
12258
+ IS_SCRIPT_OR_DATA,
12259
+ MUSTACHE_EXPR,
12260
+ TMPLIT_EXPR
12261
+ });
12262
+ const NODE_TYPE = {
12263
+ element: 1,
12264
+ text: 3,
12265
+ // Deprecated
12266
+ progressingInstruction: 7,
12267
+ comment: 8,
12268
+ document: 9
12269
+ };
12270
+ const getGlobal = function getGlobal2() {
12271
+ return typeof window === "undefined" ? null : window;
12272
+ };
12273
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
12274
+ if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
12275
+ return null;
11599
12276
  }
11600
- set ticketGroups(value) {
11601
- set(__privateGet(this, _ticketGroups), value, true);
12277
+ let suffix = null;
12278
+ const ATTR_NAME = "data-tt-policy-suffix";
12279
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
12280
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
11602
12281
  }
11603
- get preCarts() {
11604
- return get(__privateGet(this, _preCarts));
12282
+ const policyName = "dompurify" + (suffix ? "#" + suffix : "");
12283
+ try {
12284
+ return trustedTypes.createPolicy(policyName, {
12285
+ createHTML(html2) {
12286
+ return html2;
12287
+ },
12288
+ createScriptURL(scriptUrl) {
12289
+ return scriptUrl;
12290
+ }
12291
+ });
12292
+ } catch (_) {
12293
+ console.warn("TrustedTypes policy " + policyName + " could not be created.");
12294
+ return null;
11605
12295
  }
11606
- set preCarts(value) {
11607
- set(__privateGet(this, _preCarts), value);
12296
+ };
12297
+ const _createHooksMap = function _createHooksMap2() {
12298
+ return {
12299
+ afterSanitizeAttributes: [],
12300
+ afterSanitizeElements: [],
12301
+ afterSanitizeShadowDOM: [],
12302
+ beforeSanitizeAttributes: [],
12303
+ beforeSanitizeElements: [],
12304
+ beforeSanitizeShadowDOM: [],
12305
+ uponSanitizeAttribute: [],
12306
+ uponSanitizeElement: [],
12307
+ uponSanitizeShadowNode: []
12308
+ };
12309
+ };
12310
+ function createDOMPurify() {
12311
+ let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
12312
+ const DOMPurify = (root2) => createDOMPurify(root2);
12313
+ DOMPurify.version = "3.2.6";
12314
+ DOMPurify.removed = [];
12315
+ if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
12316
+ DOMPurify.isSupported = false;
12317
+ return DOMPurify;
11608
12318
  }
11609
- addTicketGroup(ticketGroup) {
12319
+ let {
12320
+ document: document2
12321
+ } = window2;
12322
+ const originalDocument = document2;
12323
+ const currentScript = originalDocument.currentScript;
12324
+ const {
12325
+ DocumentFragment,
12326
+ HTMLTemplateElement,
12327
+ Node: Node2,
12328
+ Element: Element2,
12329
+ NodeFilter,
12330
+ NamedNodeMap = window2.NamedNodeMap || window2.MozNamedAttrMap,
12331
+ HTMLFormElement,
12332
+ DOMParser,
12333
+ trustedTypes
12334
+ } = window2;
12335
+ const ElementPrototype = Element2.prototype;
12336
+ const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
12337
+ const remove = lookupGetter(ElementPrototype, "remove");
12338
+ const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
12339
+ const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
12340
+ const getParentNode = lookupGetter(ElementPrototype, "parentNode");
12341
+ if (typeof HTMLTemplateElement === "function") {
12342
+ const template = document2.createElement("template");
12343
+ if (template.content && template.content.ownerDocument) {
12344
+ document2 = template.content.ownerDocument;
12345
+ }
12346
+ }
12347
+ let trustedTypesPolicy;
12348
+ let emptyHTML = "";
12349
+ const {
12350
+ implementation,
12351
+ createNodeIterator,
12352
+ createDocumentFragment,
12353
+ getElementsByTagName
12354
+ } = document2;
12355
+ const {
12356
+ importNode
12357
+ } = originalDocument;
12358
+ let hooks = _createHooksMap();
12359
+ DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
12360
+ const {
12361
+ MUSTACHE_EXPR: MUSTACHE_EXPR2,
12362
+ ERB_EXPR: ERB_EXPR2,
12363
+ TMPLIT_EXPR: TMPLIT_EXPR2,
12364
+ DATA_ATTR: DATA_ATTR2,
12365
+ ARIA_ATTR: ARIA_ATTR2,
12366
+ IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2,
12367
+ ATTR_WHITESPACE: ATTR_WHITESPACE2,
12368
+ CUSTOM_ELEMENT: CUSTOM_ELEMENT2
12369
+ } = EXPRESSIONS;
12370
+ let {
12371
+ IS_ALLOWED_URI: IS_ALLOWED_URI$1
12372
+ } = EXPRESSIONS;
12373
+ let ALLOWED_TAGS = null;
12374
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
12375
+ let ALLOWED_ATTR = null;
12376
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
12377
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
12378
+ tagNameCheck: {
12379
+ writable: true,
12380
+ configurable: false,
12381
+ enumerable: true,
12382
+ value: null
12383
+ },
12384
+ attributeNameCheck: {
12385
+ writable: true,
12386
+ configurable: false,
12387
+ enumerable: true,
12388
+ value: null
12389
+ },
12390
+ allowCustomizedBuiltInElements: {
12391
+ writable: true,
12392
+ configurable: false,
12393
+ enumerable: true,
12394
+ value: false
12395
+ }
12396
+ }));
12397
+ let FORBID_TAGS = null;
12398
+ let FORBID_ATTR = null;
12399
+ let ALLOW_ARIA_ATTR = true;
12400
+ let ALLOW_DATA_ATTR = true;
12401
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
12402
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
12403
+ let SAFE_FOR_TEMPLATES = false;
12404
+ let SAFE_FOR_XML = true;
12405
+ let WHOLE_DOCUMENT = false;
12406
+ let SET_CONFIG = false;
12407
+ let FORCE_BODY = false;
12408
+ let RETURN_DOM = false;
12409
+ let RETURN_DOM_FRAGMENT = false;
12410
+ let RETURN_TRUSTED_TYPE = false;
12411
+ let SANITIZE_DOM = true;
12412
+ let SANITIZE_NAMED_PROPS = false;
12413
+ const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
12414
+ let KEEP_CONTENT = true;
12415
+ let IN_PLACE = false;
12416
+ let USE_PROFILES = {};
12417
+ let FORBID_CONTENTS = null;
12418
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
12419
+ let DATA_URI_TAGS = null;
12420
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
12421
+ let URI_SAFE_ATTRIBUTES = null;
12422
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
12423
+ const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
12424
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
12425
+ const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
12426
+ let NAMESPACE = HTML_NAMESPACE;
12427
+ let IS_EMPTY_INPUT = false;
12428
+ let ALLOWED_NAMESPACES = null;
12429
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
12430
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
12431
+ let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
12432
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
12433
+ let PARSER_MEDIA_TYPE = null;
12434
+ const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
12435
+ const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
12436
+ let transformCaseFunc = null;
12437
+ let CONFIG = null;
12438
+ const formElement = document2.createElement("form");
12439
+ const isRegexOrFunction = function isRegexOrFunction2(testValue) {
12440
+ return testValue instanceof RegExp || testValue instanceof Function;
12441
+ };
12442
+ const _parseConfig = function _parseConfig2() {
12443
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
12444
+ if (CONFIG && CONFIG === cfg) {
12445
+ return;
12446
+ }
12447
+ if (!cfg || typeof cfg !== "object") {
12448
+ cfg = {};
12449
+ }
12450
+ cfg = clone(cfg);
12451
+ PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
12452
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
12453
+ transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
12454
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
12455
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
12456
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
12457
+ URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
12458
+ DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
12459
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
12460
+ FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
12461
+ FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
12462
+ USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES : false;
12463
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
12464
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
12465
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
12466
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
12467
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
12468
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
12469
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
12470
+ RETURN_DOM = cfg.RETURN_DOM || false;
12471
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
12472
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
12473
+ FORCE_BODY = cfg.FORCE_BODY || false;
12474
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
12475
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
12476
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
12477
+ IN_PLACE = cfg.IN_PLACE || false;
12478
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
12479
+ NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
12480
+ MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
12481
+ HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
12482
+ CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
12483
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
12484
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
12485
+ }
12486
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
12487
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
12488
+ }
12489
+ if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") {
12490
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
12491
+ }
12492
+ if (SAFE_FOR_TEMPLATES) {
12493
+ ALLOW_DATA_ATTR = false;
12494
+ }
12495
+ if (RETURN_DOM_FRAGMENT) {
12496
+ RETURN_DOM = true;
12497
+ }
12498
+ if (USE_PROFILES) {
12499
+ ALLOWED_TAGS = addToSet({}, text);
12500
+ ALLOWED_ATTR = [];
12501
+ if (USE_PROFILES.html === true) {
12502
+ addToSet(ALLOWED_TAGS, html$1);
12503
+ addToSet(ALLOWED_ATTR, html);
12504
+ }
12505
+ if (USE_PROFILES.svg === true) {
12506
+ addToSet(ALLOWED_TAGS, svg$1);
12507
+ addToSet(ALLOWED_ATTR, svg);
12508
+ addToSet(ALLOWED_ATTR, xml);
12509
+ }
12510
+ if (USE_PROFILES.svgFilters === true) {
12511
+ addToSet(ALLOWED_TAGS, svgFilters);
12512
+ addToSet(ALLOWED_ATTR, svg);
12513
+ addToSet(ALLOWED_ATTR, xml);
12514
+ }
12515
+ if (USE_PROFILES.mathMl === true) {
12516
+ addToSet(ALLOWED_TAGS, mathMl$1);
12517
+ addToSet(ALLOWED_ATTR, mathMl);
12518
+ addToSet(ALLOWED_ATTR, xml);
12519
+ }
12520
+ }
12521
+ if (cfg.ADD_TAGS) {
12522
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
12523
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
12524
+ }
12525
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
12526
+ }
12527
+ if (cfg.ADD_ATTR) {
12528
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
12529
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
12530
+ }
12531
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
12532
+ }
12533
+ if (cfg.ADD_URI_SAFE_ATTR) {
12534
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
12535
+ }
12536
+ if (cfg.FORBID_CONTENTS) {
12537
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
12538
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
12539
+ }
12540
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
12541
+ }
12542
+ if (KEEP_CONTENT) {
12543
+ ALLOWED_TAGS["#text"] = true;
12544
+ }
12545
+ if (WHOLE_DOCUMENT) {
12546
+ addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
12547
+ }
12548
+ if (ALLOWED_TAGS.table) {
12549
+ addToSet(ALLOWED_TAGS, ["tbody"]);
12550
+ delete FORBID_TAGS.tbody;
12551
+ }
12552
+ if (cfg.TRUSTED_TYPES_POLICY) {
12553
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
12554
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
12555
+ }
12556
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
12557
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
12558
+ }
12559
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
12560
+ emptyHTML = trustedTypesPolicy.createHTML("");
12561
+ } else {
12562
+ if (trustedTypesPolicy === void 0) {
12563
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
12564
+ }
12565
+ if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
12566
+ emptyHTML = trustedTypesPolicy.createHTML("");
12567
+ }
12568
+ }
12569
+ if (freeze) {
12570
+ freeze(cfg);
12571
+ }
12572
+ CONFIG = cfg;
12573
+ };
12574
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
12575
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
12576
+ const _checkValidNamespace = function _checkValidNamespace2(element) {
12577
+ let parent = getParentNode(element);
12578
+ if (!parent || !parent.tagName) {
12579
+ parent = {
12580
+ namespaceURI: NAMESPACE,
12581
+ tagName: "template"
12582
+ };
12583
+ }
12584
+ const tagName = stringToLowerCase(element.tagName);
12585
+ const parentTagName = stringToLowerCase(parent.tagName);
12586
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
12587
+ return false;
12588
+ }
12589
+ if (element.namespaceURI === SVG_NAMESPACE) {
12590
+ if (parent.namespaceURI === HTML_NAMESPACE) {
12591
+ return tagName === "svg";
12592
+ }
12593
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
12594
+ return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
12595
+ }
12596
+ return Boolean(ALL_SVG_TAGS[tagName]);
12597
+ }
12598
+ if (element.namespaceURI === MATHML_NAMESPACE) {
12599
+ if (parent.namespaceURI === HTML_NAMESPACE) {
12600
+ return tagName === "math";
12601
+ }
12602
+ if (parent.namespaceURI === SVG_NAMESPACE) {
12603
+ return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
12604
+ }
12605
+ return Boolean(ALL_MATHML_TAGS[tagName]);
12606
+ }
12607
+ if (element.namespaceURI === HTML_NAMESPACE) {
12608
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
12609
+ return false;
12610
+ }
12611
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
12612
+ return false;
12613
+ }
12614
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
12615
+ }
12616
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
12617
+ return true;
12618
+ }
12619
+ return false;
12620
+ };
12621
+ const _forceRemove = function _forceRemove2(node) {
12622
+ arrayPush(DOMPurify.removed, {
12623
+ element: node
12624
+ });
12625
+ try {
12626
+ getParentNode(node).removeChild(node);
12627
+ } catch (_) {
12628
+ remove(node);
12629
+ }
12630
+ };
12631
+ const _removeAttribute = function _removeAttribute2(name, element) {
12632
+ try {
12633
+ arrayPush(DOMPurify.removed, {
12634
+ attribute: element.getAttributeNode(name),
12635
+ from: element
12636
+ });
12637
+ } catch (_) {
12638
+ arrayPush(DOMPurify.removed, {
12639
+ attribute: null,
12640
+ from: element
12641
+ });
12642
+ }
12643
+ element.removeAttribute(name);
12644
+ if (name === "is") {
12645
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
12646
+ try {
12647
+ _forceRemove(element);
12648
+ } catch (_) {
12649
+ }
12650
+ } else {
12651
+ try {
12652
+ element.setAttribute(name, "");
12653
+ } catch (_) {
12654
+ }
12655
+ }
12656
+ }
12657
+ };
12658
+ const _initDocument = function _initDocument2(dirty) {
12659
+ let doc = null;
12660
+ let leadingWhitespace = null;
12661
+ if (FORCE_BODY) {
12662
+ dirty = "<remove></remove>" + dirty;
12663
+ } else {
12664
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
12665
+ leadingWhitespace = matches && matches[0];
12666
+ }
12667
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
12668
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
12669
+ }
12670
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
12671
+ if (NAMESPACE === HTML_NAMESPACE) {
12672
+ try {
12673
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
12674
+ } catch (_) {
12675
+ }
12676
+ }
12677
+ if (!doc || !doc.documentElement) {
12678
+ doc = implementation.createDocument(NAMESPACE, "template", null);
12679
+ try {
12680
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
12681
+ } catch (_) {
12682
+ }
12683
+ }
12684
+ const body = doc.body || doc.documentElement;
12685
+ if (dirty && leadingWhitespace) {
12686
+ body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
12687
+ }
12688
+ if (NAMESPACE === HTML_NAMESPACE) {
12689
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
12690
+ }
12691
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
12692
+ };
12693
+ const _createNodeIterator = function _createNodeIterator2(root2) {
12694
+ return createNodeIterator.call(
12695
+ root2.ownerDocument || root2,
12696
+ root2,
12697
+ // eslint-disable-next-line no-bitwise
12698
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
12699
+ null
12700
+ );
12701
+ };
12702
+ const _isClobbered = function _isClobbered2(element) {
12703
+ return element instanceof HTMLFormElement && (typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function");
12704
+ };
12705
+ const _isNode = function _isNode2(value) {
12706
+ return typeof Node2 === "function" && value instanceof Node2;
12707
+ };
12708
+ function _executeHooks(hooks2, currentNode, data) {
12709
+ arrayForEach(hooks2, (hook) => {
12710
+ hook.call(DOMPurify, currentNode, data, CONFIG);
12711
+ });
12712
+ }
12713
+ const _sanitizeElements = function _sanitizeElements2(currentNode) {
12714
+ let content = null;
12715
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
12716
+ if (_isClobbered(currentNode)) {
12717
+ _forceRemove(currentNode);
12718
+ return true;
12719
+ }
12720
+ const tagName = transformCaseFunc(currentNode.nodeName);
12721
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
12722
+ tagName,
12723
+ allowedTags: ALLOWED_TAGS
12724
+ });
12725
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
12726
+ _forceRemove(currentNode);
12727
+ return true;
12728
+ }
12729
+ if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
12730
+ _forceRemove(currentNode);
12731
+ return true;
12732
+ }
12733
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
12734
+ _forceRemove(currentNode);
12735
+ return true;
12736
+ }
12737
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
12738
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
12739
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
12740
+ return false;
12741
+ }
12742
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
12743
+ return false;
12744
+ }
12745
+ }
12746
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
12747
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
12748
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
12749
+ if (childNodes && parentNode) {
12750
+ const childCount = childNodes.length;
12751
+ for (let i = childCount - 1; i >= 0; --i) {
12752
+ const childClone = cloneNode(childNodes[i], true);
12753
+ childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
12754
+ parentNode.insertBefore(childClone, getNextSibling(currentNode));
12755
+ }
12756
+ }
12757
+ }
12758
+ _forceRemove(currentNode);
12759
+ return true;
12760
+ }
12761
+ if (currentNode instanceof Element2 && !_checkValidNamespace(currentNode)) {
12762
+ _forceRemove(currentNode);
12763
+ return true;
12764
+ }
12765
+ if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
12766
+ _forceRemove(currentNode);
12767
+ return true;
12768
+ }
12769
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
12770
+ content = currentNode.textContent;
12771
+ arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
12772
+ content = stringReplace(content, expr, " ");
12773
+ });
12774
+ if (currentNode.textContent !== content) {
12775
+ arrayPush(DOMPurify.removed, {
12776
+ element: currentNode.cloneNode()
12777
+ });
12778
+ currentNode.textContent = content;
12779
+ }
12780
+ }
12781
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
12782
+ return false;
12783
+ };
12784
+ const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
12785
+ if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
12786
+ return false;
12787
+ }
12788
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ;
12789
+ else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName)) ;
12790
+ else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
12791
+ if (
12792
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
12793
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
12794
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
12795
+ _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND
12796
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
12797
+ lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))
12798
+ ) ;
12799
+ else {
12800
+ return false;
12801
+ }
12802
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ;
12803
+ else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
12804
+ else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
12805
+ else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
12806
+ else if (value) {
12807
+ return false;
12808
+ } else ;
12809
+ return true;
12810
+ };
12811
+ const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
12812
+ return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT2);
12813
+ };
12814
+ const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
12815
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
12816
+ const {
12817
+ attributes
12818
+ } = currentNode;
12819
+ if (!attributes || _isClobbered(currentNode)) {
12820
+ return;
12821
+ }
12822
+ const hookEvent = {
12823
+ attrName: "",
12824
+ attrValue: "",
12825
+ keepAttr: true,
12826
+ allowedAttributes: ALLOWED_ATTR,
12827
+ forceKeepAttr: void 0
12828
+ };
12829
+ let l = attributes.length;
12830
+ while (l--) {
12831
+ const attr = attributes[l];
12832
+ const {
12833
+ name,
12834
+ namespaceURI,
12835
+ value: attrValue
12836
+ } = attr;
12837
+ const lcName = transformCaseFunc(name);
12838
+ const initValue = attrValue;
12839
+ let value = name === "value" ? initValue : stringTrim(initValue);
12840
+ hookEvent.attrName = lcName;
12841
+ hookEvent.attrValue = value;
12842
+ hookEvent.keepAttr = true;
12843
+ hookEvent.forceKeepAttr = void 0;
12844
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
12845
+ value = hookEvent.attrValue;
12846
+ if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) {
12847
+ _removeAttribute(name, currentNode);
12848
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
12849
+ }
12850
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
12851
+ _removeAttribute(name, currentNode);
12852
+ continue;
12853
+ }
12854
+ if (hookEvent.forceKeepAttr) {
12855
+ continue;
12856
+ }
12857
+ if (!hookEvent.keepAttr) {
12858
+ _removeAttribute(name, currentNode);
12859
+ continue;
12860
+ }
12861
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
12862
+ _removeAttribute(name, currentNode);
12863
+ continue;
12864
+ }
12865
+ if (SAFE_FOR_TEMPLATES) {
12866
+ arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
12867
+ value = stringReplace(value, expr, " ");
12868
+ });
12869
+ }
12870
+ const lcTag = transformCaseFunc(currentNode.nodeName);
12871
+ if (!_isValidAttribute(lcTag, lcName, value)) {
12872
+ _removeAttribute(name, currentNode);
12873
+ continue;
12874
+ }
12875
+ if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
12876
+ if (namespaceURI) ;
12877
+ else {
12878
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
12879
+ case "TrustedHTML": {
12880
+ value = trustedTypesPolicy.createHTML(value);
12881
+ break;
12882
+ }
12883
+ case "TrustedScriptURL": {
12884
+ value = trustedTypesPolicy.createScriptURL(value);
12885
+ break;
12886
+ }
12887
+ }
12888
+ }
12889
+ }
12890
+ if (value !== initValue) {
12891
+ try {
12892
+ if (namespaceURI) {
12893
+ currentNode.setAttributeNS(namespaceURI, name, value);
12894
+ } else {
12895
+ currentNode.setAttribute(name, value);
12896
+ }
12897
+ if (_isClobbered(currentNode)) {
12898
+ _forceRemove(currentNode);
12899
+ } else {
12900
+ arrayPop(DOMPurify.removed);
12901
+ }
12902
+ } catch (_) {
12903
+ _removeAttribute(name, currentNode);
12904
+ }
12905
+ }
12906
+ }
12907
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
12908
+ };
12909
+ const _sanitizeShadowDOM = function _sanitizeShadowDOM2(fragment) {
12910
+ let shadowNode = null;
12911
+ const shadowIterator = _createNodeIterator(fragment);
12912
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
12913
+ while (shadowNode = shadowIterator.nextNode()) {
12914
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
12915
+ _sanitizeElements(shadowNode);
12916
+ _sanitizeAttributes(shadowNode);
12917
+ if (shadowNode.content instanceof DocumentFragment) {
12918
+ _sanitizeShadowDOM2(shadowNode.content);
12919
+ }
12920
+ }
12921
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
12922
+ };
12923
+ DOMPurify.sanitize = function(dirty) {
12924
+ let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
12925
+ let body = null;
12926
+ let importedNode = null;
12927
+ let currentNode = null;
12928
+ let returnNode = null;
12929
+ IS_EMPTY_INPUT = !dirty;
12930
+ if (IS_EMPTY_INPUT) {
12931
+ dirty = "<!-->";
12932
+ }
12933
+ if (typeof dirty !== "string" && !_isNode(dirty)) {
12934
+ if (typeof dirty.toString === "function") {
12935
+ dirty = dirty.toString();
12936
+ if (typeof dirty !== "string") {
12937
+ throw typeErrorCreate("dirty is not a string, aborting");
12938
+ }
12939
+ } else {
12940
+ throw typeErrorCreate("toString is not a function");
12941
+ }
12942
+ }
12943
+ if (!DOMPurify.isSupported) {
12944
+ return dirty;
12945
+ }
12946
+ if (!SET_CONFIG) {
12947
+ _parseConfig(cfg);
12948
+ }
12949
+ DOMPurify.removed = [];
12950
+ if (typeof dirty === "string") {
12951
+ IN_PLACE = false;
12952
+ }
12953
+ if (IN_PLACE) {
12954
+ if (dirty.nodeName) {
12955
+ const tagName = transformCaseFunc(dirty.nodeName);
12956
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
12957
+ throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
12958
+ }
12959
+ }
12960
+ } else if (dirty instanceof Node2) {
12961
+ body = _initDocument("<!---->");
12962
+ importedNode = body.ownerDocument.importNode(dirty, true);
12963
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
12964
+ body = importedNode;
12965
+ } else if (importedNode.nodeName === "HTML") {
12966
+ body = importedNode;
12967
+ } else {
12968
+ body.appendChild(importedNode);
12969
+ }
12970
+ } else {
12971
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
12972
+ dirty.indexOf("<") === -1) {
12973
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
12974
+ }
12975
+ body = _initDocument(dirty);
12976
+ if (!body) {
12977
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
12978
+ }
12979
+ }
12980
+ if (body && FORCE_BODY) {
12981
+ _forceRemove(body.firstChild);
12982
+ }
12983
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
12984
+ while (currentNode = nodeIterator.nextNode()) {
12985
+ _sanitizeElements(currentNode);
12986
+ _sanitizeAttributes(currentNode);
12987
+ if (currentNode.content instanceof DocumentFragment) {
12988
+ _sanitizeShadowDOM(currentNode.content);
12989
+ }
12990
+ }
12991
+ if (IN_PLACE) {
12992
+ return dirty;
12993
+ }
12994
+ if (RETURN_DOM) {
12995
+ if (RETURN_DOM_FRAGMENT) {
12996
+ returnNode = createDocumentFragment.call(body.ownerDocument);
12997
+ while (body.firstChild) {
12998
+ returnNode.appendChild(body.firstChild);
12999
+ }
13000
+ } else {
13001
+ returnNode = body;
13002
+ }
13003
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
13004
+ returnNode = importNode.call(originalDocument, returnNode, true);
13005
+ }
13006
+ return returnNode;
13007
+ }
13008
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
13009
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
13010
+ serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
13011
+ }
13012
+ if (SAFE_FOR_TEMPLATES) {
13013
+ arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
13014
+ serializedHTML = stringReplace(serializedHTML, expr, " ");
13015
+ });
13016
+ }
13017
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
13018
+ };
13019
+ DOMPurify.setConfig = function() {
13020
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
13021
+ _parseConfig(cfg);
13022
+ SET_CONFIG = true;
13023
+ };
13024
+ DOMPurify.clearConfig = function() {
13025
+ CONFIG = null;
13026
+ SET_CONFIG = false;
13027
+ };
13028
+ DOMPurify.isValidAttribute = function(tag, attr, value) {
13029
+ if (!CONFIG) {
13030
+ _parseConfig({});
13031
+ }
13032
+ const lcTag = transformCaseFunc(tag);
13033
+ const lcName = transformCaseFunc(attr);
13034
+ return _isValidAttribute(lcTag, lcName, value);
13035
+ };
13036
+ DOMPurify.addHook = function(entryPoint, hookFunction) {
13037
+ if (typeof hookFunction !== "function") {
13038
+ return;
13039
+ }
13040
+ arrayPush(hooks[entryPoint], hookFunction);
13041
+ };
13042
+ DOMPurify.removeHook = function(entryPoint, hookFunction) {
13043
+ if (hookFunction !== void 0) {
13044
+ const index2 = arrayLastIndexOf(hooks[entryPoint], hookFunction);
13045
+ return index2 === -1 ? void 0 : arraySplice(hooks[entryPoint], index2, 1)[0];
13046
+ }
13047
+ return arrayPop(hooks[entryPoint]);
13048
+ };
13049
+ DOMPurify.removeHooks = function(entryPoint) {
13050
+ hooks[entryPoint] = [];
13051
+ };
13052
+ DOMPurify.removeAllHooks = function() {
13053
+ hooks = _createHooksMap();
13054
+ };
13055
+ return DOMPurify;
13056
+ }
13057
+ var purify = createDOMPurify();
13058
+ var root_2$i = /* @__PURE__ */ from_html(`<span class="go-field-star" aria-hidden="true">*</span>`);
13059
+ var root_1$7 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
13060
+ var root_3$3 = /* @__PURE__ */ from_html(`<label><!></label> <input/>`, 1);
13061
+ var root_4$1 = /* @__PURE__ */ from_html(`<label><input/> <span class="go-checkbox-label"><!></span></label>`);
13062
+ var root_7$1 = /* @__PURE__ */ from_html(`<option> </option>`);
13063
+ var root_5 = /* @__PURE__ */ from_html(`<label><!></label> <select><!></select>`, 1);
13064
+ var root_10 = /* @__PURE__ */ from_html(`<label> <input/></label>`);
13065
+ var root_8 = /* @__PURE__ */ from_html(`<fieldset><legend><!></legend> <!></fieldset>`);
13066
+ function InputAndLabel($$anchor, $$props) {
13067
+ push($$props, true);
13068
+ const labelText = ($$anchor2) => {
13069
+ var fragment = root_1$7();
13070
+ var node = first_child(fragment);
13071
+ html$2(node, () => purify.sanitize(field().label));
13072
+ var node_1 = sibling(node, 2);
13073
+ {
13074
+ var consequent = ($$anchor3) => {
13075
+ var span = root_2$i();
13076
+ append($$anchor3, span);
13077
+ };
13078
+ if_block(node_1, ($$render) => {
13079
+ if (field().required) $$render(consequent);
13080
+ });
13081
+ }
13082
+ append($$anchor2, fragment);
13083
+ };
13084
+ const input = ($$anchor2) => {
13085
+ var fragment_1 = root_3$3();
13086
+ var label = first_child(fragment_1);
13087
+ var node_2 = child(label);
13088
+ labelText(node_2);
13089
+ reset(label);
13090
+ var input_1 = sibling(label, 2);
13091
+ remove_input_defaults(input_1);
13092
+ attribute_effect(input_1, () => ({ ...get(fieldAttributes), ...restProps, type: field().type }));
13093
+ template_effect(() => set_attribute(label, "for", get(inputId)));
13094
+ bind_value(input_1, () => field().value, ($$value) => field().value = $$value);
13095
+ append($$anchor2, fragment_1);
13096
+ };
13097
+ const checkbox = ($$anchor2) => {
13098
+ var label_1 = root_4$1();
13099
+ var input_2 = child(label_1);
13100
+ remove_input_defaults(input_2);
13101
+ attribute_effect(input_2, () => ({ ...get(fieldAttributes), ...restProps, type: "checkbox" }));
13102
+ var span_1 = sibling(input_2, 2);
13103
+ var node_3 = child(span_1);
13104
+ labelText(node_3);
13105
+ reset(span_1);
13106
+ reset(label_1);
13107
+ template_effect(() => set_attribute(label_1, "for", get(inputId)));
13108
+ bind_checked(input_2, () => field().checked, ($$value) => field().checked = $$value);
13109
+ append($$anchor2, label_1);
13110
+ };
13111
+ const select = ($$anchor2) => {
13112
+ var fragment_2 = root_5();
13113
+ var label_2 = first_child(fragment_2);
13114
+ var node_4 = child(label_2);
13115
+ labelText(node_4);
13116
+ reset(label_2);
13117
+ var select_1 = sibling(label_2, 2);
13118
+ attribute_effect(select_1, () => ({ ...get(fieldAttributes), ...restProps }));
13119
+ var node_5 = child(select_1);
13120
+ {
13121
+ var consequent_1 = ($$anchor3) => {
13122
+ var fragment_3 = comment();
13123
+ var node_6 = first_child(fragment_3);
13124
+ each(node_6, 17, () => field().options, index, ($$anchor4, option) => {
13125
+ var option_1 = root_7$1();
13126
+ var text2 = child(option_1, true);
13127
+ reset(option_1);
13128
+ var option_1_value = {};
13129
+ template_effect(() => {
13130
+ set_text(text2, get(option).label);
13131
+ if (option_1_value !== (option_1_value = get(option).value)) {
13132
+ option_1.value = (option_1.__value = get(option).value) ?? "";
13133
+ }
13134
+ });
13135
+ append($$anchor4, option_1);
13136
+ });
13137
+ append($$anchor3, fragment_3);
13138
+ };
13139
+ if_block(node_5, ($$render) => {
13140
+ if (field().options) $$render(consequent_1);
13141
+ });
13142
+ }
13143
+ reset(select_1);
13144
+ template_effect(() => set_attribute(label_2, "for", get(inputId)));
13145
+ bind_select_value(select_1, () => field().value, ($$value) => field().value = $$value);
13146
+ append($$anchor2, fragment_2);
13147
+ };
13148
+ const radio = ($$anchor2) => {
13149
+ var fieldset = root_8();
13150
+ var legend = child(fieldset);
13151
+ var node_7 = child(legend);
13152
+ labelText(node_7);
13153
+ reset(legend);
13154
+ var node_8 = sibling(legend, 2);
13155
+ {
13156
+ var consequent_2 = ($$anchor3) => {
13157
+ var fragment_4 = comment();
13158
+ var node_9 = first_child(fragment_4);
13159
+ each(node_9, 17, () => field().options, index, ($$anchor4, option) => {
13160
+ var label_3 = root_10();
13161
+ var text_1 = child(label_3);
13162
+ var input_3 = sibling(text_1);
13163
+ remove_input_defaults(input_3);
13164
+ attribute_effect(input_3, () => ({ ...get(fieldAttributes), ...restProps, type: "radio" }));
13165
+ reset(label_3);
13166
+ template_effect(() => {
13167
+ set_attribute(label_3, "for", get(inputId) + get(option));
13168
+ set_text(text_1, `${get(option) ?? ""} `);
13169
+ });
13170
+ bind_value(input_3, () => field().value, ($$value) => field().value = $$value);
13171
+ append($$anchor4, label_3);
13172
+ });
13173
+ append($$anchor3, fragment_4);
13174
+ };
13175
+ if_block(node_8, ($$render) => {
13176
+ if (field().options) $$render(consequent_2);
13177
+ });
13178
+ }
13179
+ reset(fieldset);
13180
+ append($$anchor2, fieldset);
13181
+ };
13182
+ let field = prop($$props, "field", 7), describedById = prop($$props, "describedById", 7), restProps = /* @__PURE__ */ rest_props($$props, [
13183
+ "$$slots",
13184
+ "$$events",
13185
+ "$$legacy",
13186
+ "$$host",
13187
+ "field",
13188
+ "describedById"
13189
+ ]);
13190
+ const map = {
13191
+ input,
13192
+ text: input,
13193
+ email: input,
13194
+ password: input,
13195
+ search: input,
13196
+ tel: input,
13197
+ url: input,
13198
+ number: input,
13199
+ checkbox,
13200
+ select,
13201
+ radio,
13202
+ textarea: null
13203
+ };
13204
+ const snippet$1 = /* @__PURE__ */ user_derived(() => map[field().type]);
13205
+ let inputId = /* @__PURE__ */ user_derived(() => $$props.id || `go-field-${Math.random().toString(36).substring(2, 9)}`);
13206
+ function onblur() {
13207
+ if (field().type == "checkbox") return;
13208
+ if (field().value) field().validate();
13209
+ }
13210
+ const fieldAttributes = /* @__PURE__ */ user_derived(() => ({
13211
+ id: get(inputId),
13212
+ "aria-describedby": describedById(),
13213
+ "aria-required": field().required,
13214
+ "aria-invalid": field().errors.length > 0,
13215
+ autocomplete: field().autocomplete,
13216
+ onblur
13217
+ }));
13218
+ var fragment_5 = comment();
13219
+ var node_10 = first_child(fragment_5);
13220
+ {
13221
+ var consequent_3 = ($$anchor2) => {
13222
+ var fragment_6 = comment();
13223
+ var node_11 = first_child(fragment_6);
13224
+ snippet(node_11, () => get(snippet$1));
13225
+ append($$anchor2, fragment_6);
13226
+ };
13227
+ if_block(node_10, ($$render) => {
13228
+ if (get(snippet$1)) $$render(consequent_3);
13229
+ });
13230
+ }
13231
+ append($$anchor, fragment_5);
13232
+ return pop({
13233
+ get field() {
13234
+ return field();
13235
+ },
13236
+ set field($$value) {
13237
+ field($$value);
13238
+ flushSync();
13239
+ },
13240
+ get describedById() {
13241
+ return describedById();
13242
+ },
13243
+ set describedById($$value) {
13244
+ describedById($$value);
13245
+ flushSync();
13246
+ }
13247
+ });
13248
+ }
13249
+ create_custom_element(InputAndLabel, { field: {}, describedById: {} }, [], [], true);
13250
+ var root_2$h = /* @__PURE__ */ from_html(`<span> </span>`);
13251
+ var root_1$6 = /* @__PURE__ */ from_html(`<div><!> <!> <span class="go-error" role="alert"> </span></div>`);
13252
+ function FieldGroup($$anchor, $$props) {
13253
+ push($$props, true);
13254
+ let fieldId = prop($$props, "fieldId", 7), restProps = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy", "$$host", "fieldId"]);
13255
+ let details = /* @__PURE__ */ state(void 0);
13256
+ let field = /* @__PURE__ */ state(void 0);
13257
+ onMount(async () => {
13258
+ var _a2;
13259
+ await tick();
13260
+ set(details, getDetails($$props.$$host), true);
13261
+ set(field, (_a2 = get(details)) == null ? void 0 : _a2.getField(fieldId()), true);
13262
+ });
13263
+ let descriptionId = /* @__PURE__ */ user_derived(() => $$props.id || `go-description-${Math.random().toString(36).substring(2, 9)}`);
13264
+ let errorsId = /* @__PURE__ */ user_derived(() => $$props.id || `go-errors-${Math.random().toString(36).substring(2, 9)}`);
13265
+ let describedById = /* @__PURE__ */ user_derived(() => get(descriptionId) + " " + get(errorsId));
13266
+ user_effect(() => {
13267
+ if (!get(field)) return;
13268
+ get(field).mounted = true;
13269
+ get(
13270
+ field
13271
+ // Track the value
13272
+ ).value;
13273
+ untrack(() => {
13274
+ var _a2;
13275
+ if ((_a2 = get(field)) == null ? void 0 : _a2.errors.length) get(field).validate();
13276
+ });
13277
+ });
13278
+ var fragment = comment();
13279
+ var node = first_child(fragment);
13280
+ {
13281
+ var consequent_1 = ($$anchor2) => {
13282
+ var div = root_1$6();
13283
+ let classes;
13284
+ var node_1 = child(div);
13285
+ InputAndLabel(node_1, {
13286
+ get restProps() {
13287
+ return restProps;
13288
+ },
13289
+ get describedById() {
13290
+ return get(describedById);
13291
+ },
13292
+ get field() {
13293
+ return get(field);
13294
+ },
13295
+ set field($$value) {
13296
+ set(field, $$value, true);
13297
+ }
13298
+ });
13299
+ var node_2 = sibling(node_1, 2);
13300
+ {
13301
+ var consequent = ($$anchor3) => {
13302
+ var span = root_2$h();
13303
+ var text2 = child(span, true);
13304
+ reset(span);
13305
+ template_effect(() => {
13306
+ set_attribute(span, "id", get(descriptionId));
13307
+ set_text(text2, get(field).description);
13308
+ });
13309
+ append($$anchor3, span);
13310
+ };
13311
+ if_block(node_2, ($$render) => {
13312
+ if (get(field).description) $$render(consequent);
13313
+ });
13314
+ }
13315
+ var span_1 = sibling(node_2, 2);
13316
+ var text_1 = child(span_1, true);
13317
+ reset(span_1);
13318
+ reset(div);
13319
+ template_effect(
13320
+ ($0, $1) => {
13321
+ classes = set_class(div, 1, "go-field", null, classes, $0);
13322
+ set_attribute(span_1, "id", get(errorsId));
13323
+ set_text(text_1, $1);
13324
+ },
13325
+ [
13326
+ () => ({ "is-invalid": get(field).errors.length > 0 }),
13327
+ () => get(field).errors.join(", ")
13328
+ ]
13329
+ );
13330
+ append($$anchor2, div);
13331
+ };
13332
+ if_block(node, ($$render) => {
13333
+ if (get(field)) $$render(consequent_1);
13334
+ });
13335
+ }
13336
+ append($$anchor, fragment);
13337
+ return pop({
13338
+ get fieldId() {
13339
+ return fieldId();
13340
+ },
13341
+ set fieldId($$value) {
13342
+ fieldId($$value);
13343
+ flushSync();
13344
+ }
13345
+ });
13346
+ }
13347
+ customElements.define("go-input", create_custom_element(
13348
+ FieldGroup,
13349
+ {
13350
+ fieldId: { attribute: "field", reflect: true, type: "String" }
13351
+ },
13352
+ [],
13353
+ [],
13354
+ false
13355
+ ));
13356
+ var root_2$g = /* @__PURE__ */ from_html(`<p aria-live="assertive" class="sr-only"> </p>`);
13357
+ var root_3$2 = /* @__PURE__ */ from_html(`<p aria-hidden="true"> </p>`);
13358
+ var root_1$5 = /* @__PURE__ */ from_html(`<div><!> <!></div>`);
13359
+ function ErrorsFeedback($$anchor, $$props) {
13360
+ push($$props, true);
13361
+ let details = /* @__PURE__ */ state(void 0);
13362
+ onMount(() => {
13363
+ set(details, getDetails($$props.$$host), true);
13364
+ });
13365
+ user_effect(() => {
13366
+ var _a2, _b2;
13367
+ (_b2 = (_a2 = get(details)) == null ? void 0 : _a2.form) == null ? void 0 : _b2.addEventListener("after-validation", () => {
13368
+ var _a3;
13369
+ set(errorsOnSubmit, errors((_a3 = get(details)) == null ? void 0 : _a3.fields), true);
13370
+ });
13371
+ });
13372
+ let errorsRealtime = /* @__PURE__ */ user_derived(() => {
13373
+ var _a2;
13374
+ return errors((_a2 = get(details)) == null ? void 0 : _a2.fields);
13375
+ });
13376
+ let errorsOnSubmit = /* @__PURE__ */ state(-1);
13377
+ var fragment = comment();
13378
+ var node = first_child(fragment);
13379
+ {
13380
+ var consequent_2 = ($$anchor2) => {
13381
+ var div = root_1$5();
13382
+ let classes;
13383
+ var node_1 = child(div);
13384
+ {
13385
+ var consequent = ($$anchor3) => {
13386
+ var p = root_2$g();
13387
+ var text2 = child(p);
13388
+ reset(p);
13389
+ template_effect(() => set_text(text2, `Failed to save because ${get(errorsOnSubmit) ?? ""} fields are invalid.`));
13390
+ append($$anchor3, p);
13391
+ };
13392
+ if_block(node_1, ($$render) => {
13393
+ if (get(errorsOnSubmit) > 0) $$render(consequent);
13394
+ });
13395
+ }
13396
+ var node_2 = sibling(node_1, 2);
13397
+ {
13398
+ var consequent_1 = ($$anchor3) => {
13399
+ var p_1 = root_3$2();
13400
+ var text_1 = child(p_1);
13401
+ reset(p_1);
13402
+ template_effect(() => set_text(text_1, `Failed to save because ${get(errorsRealtime) ?? ""} fields are invalid.`));
13403
+ append($$anchor3, p_1);
13404
+ };
13405
+ if_block(node_2, ($$render) => {
13406
+ if (get(errorsRealtime) > 0) $$render(consequent_1);
13407
+ });
13408
+ }
13409
+ reset(div);
13410
+ template_effect(($0) => classes = set_class(div, 1, "go-error-feedback go-feedback", null, classes, $0), [() => ({ "is-invalid": get(errorsRealtime) })]);
13411
+ append($$anchor2, div);
13412
+ };
13413
+ if_block(node, ($$render) => {
13414
+ if (get(errorsRealtime) > 0 || get(errorsOnSubmit) > 0) $$render(consequent_2);
13415
+ });
13416
+ }
13417
+ append($$anchor, fragment);
13418
+ pop();
13419
+ }
13420
+ customElements.define("go-errors-feedback", create_custom_element(ErrorsFeedback, {}, [], [], false));
13421
+ var root_1$4 = /* @__PURE__ */ from_html(`<p>Form submitted successfully!</p>`);
13422
+ var root$4 = /* @__PURE__ */ from_html(`<div aria-live="assertive"><!></div>`);
13423
+ function SuccessFeedback($$anchor, $$props) {
13424
+ push($$props, true);
13425
+ let details = /* @__PURE__ */ state(void 0);
13426
+ onMount(() => {
13427
+ set(details, getDetails($$props.$$host), true);
13428
+ });
13429
+ let show = /* @__PURE__ */ state(false);
13430
+ user_effect(() => {
13431
+ var _a2;
13432
+ if (!((_a2 = get(details)) == null ? void 0 : _a2.form)) return;
13433
+ untrack(() => {
13434
+ var _a3, _b2;
13435
+ (_b2 = (_a3 = get(details)) == null ? void 0 : _a3.form) == null ? void 0 : _b2.addEventListener("success", () => {
13436
+ var _a4;
13437
+ set(show, errors((_a4 = get(details)) == null ? void 0 : _a4.fields) === 0);
13438
+ });
13439
+ });
13440
+ });
13441
+ var div = root$4();
13442
+ let classes;
13443
+ var node = child(div);
13444
+ {
13445
+ var consequent = ($$anchor2) => {
13446
+ var p = root_1$4();
13447
+ append($$anchor2, p);
13448
+ };
13449
+ if_block(node, ($$render) => {
13450
+ if (get(show)) $$render(consequent);
13451
+ });
13452
+ }
13453
+ reset(div);
13454
+ template_effect(($0) => classes = set_class(div, 1, "go-success-feedback go-feedback", null, classes, $0), [() => ({ "is-successful": get(show) })]);
13455
+ append($$anchor, div);
13456
+ pop();
13457
+ }
13458
+ customElements.define("go-success-feedback", create_custom_element(SuccessFeedback, {}, [], [], false));
13459
+ var root$3 = /* @__PURE__ */ from_html(`<div class="go-form-feedback"><!></div>`);
13460
+ function FormFeedback($$anchor, $$props) {
13461
+ var div = root$3();
13462
+ var node = child(div);
13463
+ slot(node, $$props, "default", {});
13464
+ reset(div);
13465
+ append($$anchor, div);
13466
+ }
13467
+ customElements.define("go-form-feedback", create_custom_element(FormFeedback, {}, ["default"], [], false));
13468
+ function Submit($$anchor, $$props) {
13469
+ push($$props, true);
13470
+ let details = /* @__PURE__ */ state(void 0);
13471
+ onMount(() => {
13472
+ set(details, getDetails($$props.$$host), true);
13473
+ });
13474
+ function submit() {
13475
+ var _a2, _b2;
13476
+ (_b2 = (_a2 = get(details)) == null ? void 0 : _a2.form) == null ? void 0 : _b2.dispatchEvent(new SubmitEvent("submit", { bubbles: true, cancelable: true }));
13477
+ }
13478
+ onMount(() => {
13479
+ const btn = wrapInElement($$props.$$host, "button", { type: "submit" });
13480
+ btn.addEventListener("click", submit);
13481
+ });
13482
+ pop();
13483
+ }
13484
+ customElements.define("go-submit", create_custom_element(Submit, {}, [], [], false));
13485
+ var root_1$3 = /* @__PURE__ */ from_html(`<go-input></go-input>`, 2);
13486
+ function AllFields($$anchor, $$props) {
13487
+ push($$props, true);
13488
+ let details = /* @__PURE__ */ state(void 0);
13489
+ onMount(async () => {
13490
+ set(details, getDetails($$props.$$host), true);
13491
+ });
13492
+ var fragment = comment();
13493
+ var node = first_child(fragment);
13494
+ each(node, 17, () => {
13495
+ var _a2;
13496
+ return ((_a2 = get(details)) == null ? void 0 : _a2.fields) || [];
13497
+ }, index, ($$anchor2, field) => {
13498
+ var go_input = root_1$3();
13499
+ template_effect(() => set_custom_element_data(go_input, "field", get(field).id));
13500
+ append($$anchor2, go_input);
13501
+ });
13502
+ append($$anchor, fragment);
13503
+ pop();
13504
+ }
13505
+ customElements.define("go-all-fields", create_custom_element(AllFields, {}, [], [], false));
13506
+ function evaluateExpression(expression, data) {
13507
+ try {
13508
+ const func = new Function("data", `return ${expression};`);
13509
+ return func(data);
13510
+ } catch (error) {
13511
+ console.log(`Error while evaluating when in go-if: ${error.message}`);
13512
+ }
13513
+ }
13514
+ const validTicketSelectionFilters = ["timeslot", "normal", "annual"];
13515
+ let lastUId = 0;
13516
+ class TicketSelectionDetails {
13517
+ constructor() {
13518
+ __publicField(this, "uid", lastUId++);
13519
+ __privateAdd(this, _mode, /* @__PURE__ */ state());
13520
+ __privateAdd(this, _filters, /* @__PURE__ */ state());
13521
+ __privateAdd(this, _eventId, /* @__PURE__ */ state());
13522
+ __privateAdd(this, _museumIds, /* @__PURE__ */ state());
13523
+ __privateAdd(this, _exhibitionIds, /* @__PURE__ */ state());
13524
+ __privateAdd(this, _ticketIds, /* @__PURE__ */ state());
13525
+ __privateAdd(this, _selectedDate, /* @__PURE__ */ state());
13526
+ __privateAdd(this, _selectedTimeslot, /* @__PURE__ */ state());
13527
+ __privateAdd(this, _ticketGroups, /* @__PURE__ */ state(proxy([])));
13528
+ __privateAdd(this, _preCarts, /* @__PURE__ */ user_derived(() => this.ticketGroups.map((tg) => tg.preCart)));
13529
+ }
13530
+ get mode() {
13531
+ return get(__privateGet(this, _mode));
13532
+ }
13533
+ set mode(value) {
13534
+ set(__privateGet(this, _mode), value, true);
13535
+ }
13536
+ get filters() {
13537
+ return get(__privateGet(this, _filters));
13538
+ }
13539
+ set filters(value) {
13540
+ set(__privateGet(this, _filters), value, true);
13541
+ }
13542
+ get eventId() {
13543
+ return get(__privateGet(this, _eventId));
13544
+ }
13545
+ set eventId(value) {
13546
+ set(__privateGet(this, _eventId), value, true);
13547
+ }
13548
+ get museumIds() {
13549
+ return get(__privateGet(this, _museumIds));
13550
+ }
13551
+ set museumIds(value) {
13552
+ set(__privateGet(this, _museumIds), value, true);
13553
+ }
13554
+ get exhibitionIds() {
13555
+ return get(__privateGet(this, _exhibitionIds));
13556
+ }
13557
+ set exhibitionIds(value) {
13558
+ set(__privateGet(this, _exhibitionIds), value, true);
13559
+ }
13560
+ get ticketIds() {
13561
+ return get(__privateGet(this, _ticketIds));
13562
+ }
13563
+ set ticketIds(value) {
13564
+ set(__privateGet(this, _ticketIds), value, true);
13565
+ }
13566
+ get selectedDate() {
13567
+ return get(__privateGet(this, _selectedDate));
13568
+ }
13569
+ set selectedDate(value) {
13570
+ set(__privateGet(this, _selectedDate), value, true);
13571
+ }
13572
+ get selectedTimeslot() {
13573
+ return get(__privateGet(this, _selectedTimeslot));
13574
+ }
13575
+ set selectedTimeslot(value) {
13576
+ set(__privateGet(this, _selectedTimeslot), value, true);
13577
+ }
13578
+ get ticketGroups() {
13579
+ return get(__privateGet(this, _ticketGroups));
13580
+ }
13581
+ set ticketGroups(value) {
13582
+ set(__privateGet(this, _ticketGroups), value, true);
13583
+ }
13584
+ get preCarts() {
13585
+ return get(__privateGet(this, _preCarts));
13586
+ }
13587
+ set preCarts(value) {
13588
+ set(__privateGet(this, _preCarts), value);
13589
+ }
13590
+ addTicketGroup(ticketGroup) {
11610
13591
  this.ticketGroups.push(ticketGroup);
11611
13592
  }
11612
13593
  addPreCart(precart) {
@@ -11874,9 +13855,9 @@ function TicketsSum($$anchor, $$props) {
11874
13855
  if (!tsd) console.error("Ticket Sum must be inside a Ticket Selection Details");
11875
13856
  let val = /* @__PURE__ */ user_derived(() => sum((tsd == null ? void 0 : tsd.preCarts) || [], (c) => c.totalPriceCents));
11876
13857
  next();
11877
- var text$1 = text();
11878
- template_effect(($0) => set_text(text$1, $0), [() => formatCurrency(get(val))]);
11879
- append($$anchor, text$1);
13858
+ var text2 = text$1();
13859
+ template_effect(($0) => set_text(text2, $0), [() => formatCurrency(get(val))]);
13860
+ append($$anchor, text2);
11880
13861
  return pop({ tsd });
11881
13862
  }
11882
13863
  customElements.define("go-tickets-sum", create_custom_element(TicketsSum, {}, [], ["tsd"], false));
@@ -12089,7 +14070,7 @@ function GroupBody($$anchor, $$props) {
12089
14070
  reset(li_1);
12090
14071
  var li_2 = sibling(li_1, 2);
12091
14072
  var node_2 = child(li_2);
12092
- html(node_2, () => get(ci).item.description);
14073
+ html$2(node_2, () => get(ci).item.description);
12093
14074
  reset(li_2);
12094
14075
  var li_3 = sibling(li_2, 2);
12095
14076
  var text_2 = child(li_3, true);
@@ -12125,9 +14106,9 @@ function GroupSum($$anchor, $$props) {
12125
14106
  const details = getTicketGroupDetails($$props.$$host);
12126
14107
  if (!details) console.warn("TicketGroupSum: details not found");
12127
14108
  next();
12128
- var text$1 = text();
12129
- template_effect(() => set_text(text$1, details == null ? void 0 : details.preCart.totalFormatted));
12130
- append($$anchor, text$1);
14109
+ var text2 = text$1();
14110
+ template_effect(() => set_text(text2, details == null ? void 0 : details.preCart.totalFormatted));
14111
+ append($$anchor, text2);
12131
14112
  return pop({ details });
12132
14113
  }
12133
14114
  customElements.define("go-ticket-group-sum", create_custom_element(GroupSum, {}, [], ["details"], false));
@@ -12144,10 +14125,10 @@ function createTimeSlotEntriesFromTicket(ticket) {
12144
14125
  });
12145
14126
  }
12146
14127
  function flattenTicketsIntoSlots(tickets) {
12147
- return alphabetical(Object.values(tickets).flatMap(createTimeSlotEntriesFromTicket), (slot) => slot.startAt);
14128
+ return alphabetical(Object.values(tickets).flatMap(createTimeSlotEntriesFromTicket), (slot2) => slot2.startAt);
12148
14129
  }
12149
14130
  function filterSlotsByQuota(allTimeSlots, quotaId) {
12150
- const slotsForThisQuota = allTimeSlots.filter((slot) => slot.quotaIds.includes(quotaId));
14131
+ const slotsForThisQuota = allTimeSlots.filter((slot2) => slot2.quotaIds.includes(quotaId));
12151
14132
  return slotsForThisQuota;
12152
14133
  }
12153
14134
  function filterSlots(allTimeSlots, quotas) {
@@ -12160,19 +14141,19 @@ function filterSlots(allTimeSlots, quotas) {
12160
14141
  }
12161
14142
  function combineSlots(timeSlots) {
12162
14143
  const slotMap = {};
12163
- for (const slot of timeSlots) {
12164
- const existing = slotMap[slot.startAt];
14144
+ for (const slot2 of timeSlots) {
14145
+ const existing = slotMap[slot2.startAt];
12165
14146
  if (existing) {
12166
- existing.capacity += slot.capacity;
12167
- existing.totalCapacity += slot.totalCapacity;
12168
- const newQuotaIds = slot.quotaIds.filter((id) => !existing.quotaIds.includes(id));
14147
+ existing.capacity += slot2.capacity;
14148
+ existing.totalCapacity += slot2.totalCapacity;
14149
+ const newQuotaIds = slot2.quotaIds.filter((id) => !existing.quotaIds.includes(id));
12169
14150
  existing.quotaIds.push(...newQuotaIds);
12170
14151
  existing.available = existing.capacity > 0;
12171
14152
  } else {
12172
- slotMap[slot.startAt] = { ...slot };
14153
+ slotMap[slot2.startAt] = { ...slot2 };
12173
14154
  }
12174
14155
  }
12175
- return alphabetical(Object.values(slotMap), (slot) => slot.startAt);
14156
+ return alphabetical(Object.values(slotMap), (slot2) => slot2.startAt);
12176
14157
  }
12177
14158
  function generateAvailableTimeSlots(tickets, quotas) {
12178
14159
  const ticketSlots = flattenTicketsIntoSlots(tickets);
@@ -12198,7 +14179,7 @@ let Details$1 = (_b = class {
12198
14179
  by_bookable: true,
12199
14180
  valid_at: date.toString(),
12200
14181
  // @ts-ignore
12201
- "by_ticket_types[]": tsd.filters,
14182
+ "by_ticket_types[]": ["time_slot"],
12202
14183
  "by_museum_ids[]": tsd.museumIds,
12203
14184
  "by_exhibition_ids[]": tsd.exhibitionIds,
12204
14185
  "by_ticket_ids[]": tsd.ticketIds
@@ -15275,9 +17256,9 @@ function Calendar_day($$anchor, $$props) {
15275
17256
  append($$anchor3, fragment_2);
15276
17257
  };
15277
17258
  var alternate = ($$anchor3) => {
15278
- var text$1 = text();
15279
- template_effect(() => set_text(text$1, dayState.cell.opts.date.current.day));
15280
- append($$anchor3, text$1);
17259
+ var text2 = text$1();
17260
+ template_effect(() => set_text(text2, dayState.cell.opts.date.current.day));
17261
+ append($$anchor3, text2);
15281
17262
  };
15282
17263
  if_block(node_2, ($$render) => {
15283
17264
  if (children()) $$render(consequent_1);
@@ -15920,9 +17901,9 @@ function Calendar_heading($$anchor, $$props) {
15920
17901
  append($$anchor3, fragment_2);
15921
17902
  };
15922
17903
  var alternate = ($$anchor3) => {
15923
- var text$1 = text();
15924
- template_effect(() => set_text(text$1, headingState.root.headingValue));
15925
- append($$anchor3, text$1);
17904
+ var text2 = text$1();
17905
+ template_effect(() => set_text(text2, headingState.root.headingValue));
17906
+ append($$anchor3, text2);
15926
17907
  };
15927
17908
  if_block(node_2, ($$render) => {
15928
17909
  if (children()) $$render(consequent_1);
@@ -16174,7 +18155,7 @@ class TicketsCalendar extends Calendar$1 {
16174
18155
  "by_museum_ids[]": (_c2 = this.details) == null ? void 0 : _c2.museumIds,
16175
18156
  "by_exhibition_ids[]": (_d = this.details) == null ? void 0 : _d.exhibitionIds,
16176
18157
  start_at: this.startAt.set({ day: 1 }).toString(),
16177
- end_at: this.startAt.add({ months: 1 }).set({ day: 7 }).toString()
18158
+ end_at: this.startAt.add({ months: 1 }).set({ day: 14 }).toString()
16178
18159
  };
16179
18160
  }));
16180
18161
  }
@@ -16231,8 +18212,8 @@ function CalendarUI($$anchor, $$props) {
16231
18212
  Calendar_PrevButton($$anchor5, {
16232
18213
  children: ($$anchor6, $$slotProps2) => {
16233
18214
  next();
16234
- var text$1 = text("Prev");
16235
- append($$anchor6, text$1);
18215
+ var text2 = text$1("Prev");
18216
+ append($$anchor6, text2);
16236
18217
  },
16237
18218
  $$slots: { default: true }
16238
18219
  });
@@ -16246,7 +18227,7 @@ function CalendarUI($$anchor, $$props) {
16246
18227
  Calendar_NextButton($$anchor5, {
16247
18228
  children: ($$anchor6, $$slotProps2) => {
16248
18229
  next();
16249
- var text_1 = text("Next");
18230
+ var text_1 = text$1("Next");
16250
18231
  append($$anchor6, text_1);
16251
18232
  },
16252
18233
  $$slots: { default: true }